[Bioperl-l] What happens to STDOUT?

Torsten Seemann torsten.seemann at infotech.monash.edu.au
Thu Mar 30 22:45:24 UTC 2006


Ryan,

> I'm using a simply script to reformat a genbank file to a fasta file.
> Within the script, I have it print out some information.  That
> information never appears in the console unless I print it to STDERR.
> What happened to stdout?  Here's the script:
> 	while (my $seq = $seqin->next_seq) {
> 		print $seqout->write_seq($seq);

This last line shouldn't have a "print" unless you want to print out the return 
value from write_seq(). The write_seq() function writes the sequence into your 
$fastafile. Perhaps this is cause of the STDOUT issue?

 > my $seqin = Bio::SeqIO->new(-file => "<$gbkfile", -format => 'genbank' );

It's a good idea to check if the open failed, eg:

my $seqin = Bio::SeqIO->new(-file => "<$gbkfile", -format => 'genbank') or die 
"could not open $gbkfile";

 > foreach my $gbkfile(`ls *.gbk`) {

This could also be written more portably as (<*.gbk>) or (glob('*.gbk')).

-- 
Torsten Seemann
Victorian Bioinformatics Consortium, Monash University, Australia
http://www.vicbioinformatics.com/



More information about the Bioperl-l mailing list