I’m currently working my way through the problems at “rosalind.info,”
implementing each of my solutions in Perl, Python, and Haskell. I’m stuck on
the “GC” problem (http://rosalind.info/problems/gc/) as I need to parse a FASTA
file with "Bio.Sequence.Fasta.”
In ghci, I can easily do this:
ghci> let f = readFasta "input.fasta"
ghci> f
[ID -----------------------------------------------------------------
Rosalind_6404
COMMENT ------------------------------------------------------------
DATA ---------------------------------------------------------------
0 CCTGCGGAAG ATCGGCACTA GAATAGCCAG AACCGTTTCT CTGAGGCTTC CGGCCTTCCC
60 TCCCACTAAT AATTCTGAGG,ID
-----------------------------------------------------------------
Rosalind_5959
COMMENT ------------------------------------------------------------
DATA ---------------------------------------------------------------
0 CCATCGGTAG CGCATCCTTA GTCCAATTAA GTCCCTATCC AGGCGCTCCG CCGAAGGTCT
60 ATATCCATTT GTCAGCAGAC ACGC,ID ————————————————————————————————
…
So I know it’s working, but I can’t figure out what to do with “f” now. I can
see it’s type:
ghci> :t f
f :: IO
[Bio.Sequence.SeqData.Sequence Bio.Sequence.SeqData.Unknown]
But what do I do with “f” to, say, iterate over the sequences and count G/C
content, get the length of the sequence, etc.?
Thanks,
Ken