in reply to Re: Re: very basic, just beginning
in thread very basic, just beginning

Well, I didn't realize your input files were all newline free.. Should have read the question more closely.

In that case, Bioperl is even better...

use Bio::SeqIO; while (my $fname = shift) { ## raw is one seq per line (no newlines) my $in = Bio::SeqIO->new(-file => "$fname", '-format' => 'raw'); $fname =~ s{\.txt}{}' # strip .txt my $outfile = $fname . ".fa"; my $out = Bio::SeqIO->new(-file => "> $outfile" , '-format' => 'fasta'); ## Do the conversion while ( my $seq = $in->next_seq() ) { $seq->display_id($fname); # Add a name $out->write_seq($seq); } }
Run it in the same way, with an argument of *.txt