in reply to Re: very basic, just beginning
in thread very basic, just beginning
Here's some incentive to get it installed... Run this with an argument of '*.txt'.
It'll do exactly what you asked. Plus, just change 'fasta' to some other format, and it will convert that too.use Bio::Seq; use Bio::SeqIO; while(my $fname = shift) { open(INSEQ, "<$fname") or die $!; my $seq; ## Grab all the sequence in a single string while(<INSEQ>) { chomp; $seq .= $_; } close INSEQ; my $fname =~ s{\.txt}{}; # strip .txt ## Create a new Bio::Seq object with your sequence my $seqobj = Bio::Seq->new(-display_id => $fname, -seq => $seq ); ## Write it out to filename.fa my $outfile = $fname . ".fa"; my $seqout = Bio::SeqIO->new(-format => 'fasta', -file => "> $outfile", ); $seqout->write_seq($seqobj); }
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Re: Re: very basic, just beginning
by jmanning2k (Pilgrim) on Aug 27, 2003 at 18:44 UTC |