Chat-To-Sequence / DNAseq.py
Kevin Louis
Upload DNAseq.py
4b032bf
raw
history blame
1.91 kB
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