File size: 1,908 Bytes
4b032bf
2c8f0e3
 
4b032bf
2c8f0e3
 
4b032bf
 
 
 
2c8f0e3
 
 
 
 
 
4b032bf
 
 
 
2c8f0e3
 
 
 
 
4b032bf
2c8f0e3
 
 
 
 
 
4b032bf
2c8f0e3
 
 
 
 
 
4b032bf
2c8f0e3
 
 
 
 
 
4b032bf
2c8f0e3
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
from sequence import Sequence


class DNAseq(Sequence):
    def get_base_counts(self):
        base_counts = {
            'a': self.get_unit_count('a'),
            't': self.get_unit_count('t'),
            'g': self.get_unit_count('g'),
            'c': self.get_unit_count('c'),
        }
        return base_counts
        # Total number of each base within the sequence returned as a dictionary

    def get_base_percentages(self):
        base_percentages = {
            'a': self.get_unit_percentage('a'),
            't': self.get_unit_percentage('t'),
            'g': self.get_unit_percentage('g'),
            'c': self.get_unit_percentage('c'),
        }
        return base_percentages
        # Base content percentage for each base returned as a dictionary

    def get_gc_content(self):
        total_bases = self.get_seq_length()
        gc_count = self.sequence.count('g') + self.sequence.count('c')
        gc_content = (gc_count / total_bases) * 100
        return gc_content
        # Guanine Cytosine (gc) content by percentage

    def get_at_content(self):
        total_bases = self.get_seq_length()
        at_count = self.sequence.count('a') + self.sequence.count('t')
        at_content = (at_count / total_bases) * 100
        return at_content
        # Adenine Thymine (at) content by percentage

    def get_purine_content(self):
        total_bases = self.get_seq_length()
        ag_count = self.sequence.count('a') + self.sequence.count('g')
        ag_content = (ag_count / total_bases) * 100
        return ag_content
        # Adenine Guanine (purine) content by percentage

    def get_pyrimidine_content(self):
        total_bases = self.get_seq_length()
        ct_count = self.sequence.count('c') + self.sequence.count('t')
        ct_content = (ct_count / total_bases) * 100
        return ct_content
        # Cytosine Thymine (pyrimidine) content by percentage