[Biopython] FASTA file parsing

XiaoJu Zhang xiaojuzh at gmail.com
Mon Jun 30 03:14:09 UTC 2014


Hi,

I think you would like to use function "tostring()":
For example:
contigs = SeqIO.parse(open(sys.argv[1]), 'fasta')
for contig in contigs:
    seq = contig.seq.tostring()
    print seq


Regards.
Ju


On Sun, Jun 29, 2014 at 6:43 AM, Ismail Uddin <ismail.sameeuddin at gmail.com>
wrote:

> Dear Sir or Madam,
>
> I would like to post a question regarding FASTA file parsing using the
> BioPython module. The current tutorial online indicates how to parse a
> FASTA file, but the output is in the format Seq('<<sequence here>>',
> SingleLetterAlphabet())
>
> I would like to know how one may simply print out the entire sequence
> without any adjoining text i.e. 'ACTACGGCGAT'
>
> I ask this question, as I am trying to write a script that will read each
> entry in the FASTA file and produce a dictionary of key being the ID and
> the value being the raw sequence.
>
> ​Thank you in advance for your help and cooperation,
> Ismail Uddin
>
> _______________________________________________
> Biopython mailing list  -  Biopython at mailman.open-bio.org
> http://mailman.open-bio.org/mailman/listinfo/biopython
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.open-bio.org/pipermail/biopython/attachments/20140629/67d77e19/attachment.html>


More information about the Biopython mailing list