[BioPython] Sequence from Fasta

Giovanni Marco Dall'Olio dalloliogm at gmail.com
Tue Jul 1 10:44:49 UTC 2008


On Tue, Jul 1, 2008 at 11:45 AM, Peter <biopython at maubp.freeserve.co.uk> wrote:
>> It ignores any field after the first space in the header.
>>
>> For example:
>> $ cat >seq1.fasta
>>>seq1 field2 field3
>> acatcgatgcatgctagctactgtacgac
>>
>> $ cat > fasta2tab.pl
>> my $seqin = Bio::SeqIO->newFh("-file" => "seq1.fasta", "-format" => "fasta");
>> my $seqout = Bio::SeqIO->newFh("-fh" => \*STDOUT, "-format" => "tab");
>>
>> while (<$seqin>)
>> {
>>        print $seqout $_;
>> }
>>
>> $ perl fasta2tab.pl
>> seq1    acatcgatgcatgctagctactgtacgac
>
> Interesting - and now what I had expected.
>
> Could you try getting BioPerl to read in a TSV file like this:
>
> seq1 field2 field3(tab)acatcgatgcatgctagctactgtacgac
> seq2 with a description here(tab)ctcgctgnnacatcctagctactgta
>
> I personally would prefer this sort of output as it preserves all the
> data from a FASTA input file.  On the other hand, if there are exsting
> tools which wouldn't read this then it would be a bad idea.
>

It gives an error warning for every space it encounters.

Example:
"""
perl convertformat.pl seqm.tab tab fasta

-------------------- WARNING ---------------------
MSG: No whitespace allowed in FASTA ID [seq1 field2 field3]
---------------------------------------------------

-------------------- WARNING ---------------------
MSG: No whitespace allowed in FASTA ID [seq1 field2 field3]
---------------------------------------------------
>seq1 field2 field3
CATGGCATGCATGCATGCTAGCTAC

-------------------- WARNING ---------------------
MSG: No whitespace allowed in FASTA ID [seq2 some description]
---------------------------------------------------

-------------------- WARNING ---------------------
MSG: No whitespace allowed in FASTA ID [seq2 some description]
---------------------------------------------------
>seq2 some description
CATGGCATGCATGCATGCTAGCTAC
"""

Please have a look at the script code and the makefile attached.

p.s. I already sent you a similar message, but the mailing list blocked it.


-- 
-----------------------------------------------------------

My Blog on Bioinformatics (italian): http://bioinfoblog.it
-------------- next part --------------
A non-text attachment was scrubbed...
Name: convertformat.pl
Type: application/x-perl
Size: 494 bytes
Desc: not available
URL: <http://lists.open-bio.org/pipermail/biopython/attachments/20080701/d2392763/attachment.bin>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: Makefile
Type: application/octet-stream
Size: 858 bytes
Desc: not available
URL: <http://lists.open-bio.org/pipermail/biopython/attachments/20080701/d2392763/attachment.obj>


More information about the Biopython mailing list