[Bioperl-l] perl one-liner with Bio::SeqIO

Alper Yilmaz alperyilmaz at gmail.com
Thu Jul 22 04:09:38 UTC 2010


Hi,

I was using Bio::SeqIO with perl one-liner and I noticed an oddity.
Can someone suggest a correction or workaround?

Let test.fa be;
>1
AGTC
>2
CTGA

Then, commandline below prints the expected output:
$ perl -MBio::SeqIO -e 'my $seq=Bio::SeqIO->new(-fh =>\*STDIN); while
($myseq=$seq->next_seq){ print $myseq->id,"\t",$myseq->seq,"\n"}'  <
test.fa

output:
1	AGTC
2	CTGA

However, if use the command in a pipe, then the output has an issue
with primary_id of initial sequence.
$ cat test.fa | perl -MBio::SeqIO -e 'my $seq=Bio::SeqIO->new(-fh
=>\*STDIN); while ($myseq=$seq->next_seq){ print
$myseq->id,"\t",$myseq->seq,"\n"}'

output:
AGTC	
2	CTGA

What is the workaround to make Bio::SeqIO work correctly in a
one-liner with pipes?

thanks,

Alper Yilmaz
Post-doctoral Researcher
Plant Biotechnology Center
The Ohio State University
1060 Carmack Rd
Columbus, OH 43210
(614)688-4954


PS: Normally, the example is demonstrating useless use of cat, for the
sake giving an example, it can be "command1 | command2 | command3 |
perl -MBioSeqIO -e'...' " instead..



More information about the Bioperl-l mailing list