As I reread your initial post, I suspect you want to split nt into smaller chunks and write those to file. Here is a script I've been using to do that
### USAGE # perl -w splitter.pl <filename> <seq-per-file> # e.g. perl -w splitter.pl nt 20000 ### INCLUDES use strict; use Bio::SeqIO; ### LOCALS my $infile = $ARGV[0]; my $size = $ARGV[1]; my $i = 0; my $j = 1; ### OBJECT INSTANTIATION my $in = Bio::SeqIO->new( -file => $infile, -format => 'Fasta', ); my $out = Bio::SeqIO->new( -file => ">$infile"."_$j.fasta", -format => 'Fasta', ); ### PROCESS FILES while ( my $seq = $in->next_seq() ) { $i++; if ($i == $size) { $j++; $out = Bio::SeqIO->new( -file => ">$infile"."_$j.fasta", -format => 'Fasta'); $i = 0; } $out->write_seq($seq); }
In reply to Re: Re: Re: Refomating a large fasta file...
by Itatsumaki
in thread Refomating a large fasta file...
by bioinformatics
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |