I had a few lines of python code, to count the fraction of A:s and C:s in a DNA (fasta) file adapted from [1]:
with open("chry_multiplied.fa") as infile:
a: int = 0
t: int = 0
g: int = 0
c: int = 0
for line in infile:
if line[0] != '>' and len(line) != line.count("N") + 1:
g += line.count("G")
c += line.count("C")
a += line.count("A")
t += line.count("T")
total_base_count = a + t + c + g
gc_count = g + c
gc_fraction = float(gc_count) / total_base_count
print( gc_fraction * 100 )
Result: $ mojo run gc.mojo
gc.mojo:1:6: error: use of unknown declaration 'open'
with open("chry_multiplied.fa") as infile:
...
"open" must be one of the most used Python functions ... :/