Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 7 additions & 7 deletions DNAcalc2.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,18 +30,18 @@
#Get Length of sequence
SeqLength=len(DNAseq)

GC_count=0
Missing_count=0

#Go through each base
for Base in ('A','G','T','C', 'N'):
for Base in ('A','G','T','C', 'N','?'):
#Count the number of times the base occurs
NumBase=DNAseq.count.upper(Base)
Missing_NumBase=DNAseq.count(Base)

#print("Percent %s: %.2f" %(Base,NumBase/SeqLength*100))
#Count Gs and Cs
if Base == "G" or Base == "C":
GC_count+=NumBase
if Base == "?":
Missing_count+=Missing_NumBase
#End of for Base in loop.
#print ("Sequence is %d bp long" %(SeqLength))
print ("GC content of %s is %.2f" %(Record.id, GC_count/SeqLength*100))
#End for Record in loop.
print ("Missing data of %s is %.2f" %(Record.id, Missing_count/SeqLength*100))
#End for Record in loop.