in reply to Refomating a large fasta file...
I wouldn't do it this way if I were you! :)
From the size it looks like you're thinking of parsing nt, which is going to be slow no matter what. The sooner you start getting used to BioPerl the better off you are. With Bio::SeqIO this is a handful of lines. Further, the tired/tireless developers there are always looking for ways to speed up their parsers. It's a real friendly mailing list, too (bioperl-l@bioperl.org).
use Bio::SeqIO; my $seqIO = Bio::SeqIO->new({-file=>'nt', -format=>'fasta'}); my $i = 0; while (my $seq = $seqIO->next_seq()) { $i++; } print "There are $i non-redundant nucleotide sequences\n";
The last thing any bioinformatician wants to do is rewrite parsers. There are dozens of sequence formats, and BioPerl allows you to parse them all in this way, just changing the -format to what you need. In fact, it even has some rudimentary auto-identification, I believe. You can also rewrite sequence objects with BioSeqIO, allowing for two or three line reformatters. It's an invaluable resource, and it isn't too hard to learn to use.
BioPerl 1.2.3 is available from CPAN, or you can get a CVS tarball from the BioPerl project site.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Re: Refomating a large fasta file...
by bioinformatics (Friar) on Nov 19, 2003 at 18:06 UTC | |
by Itatsumaki (Friar) on Nov 19, 2003 at 18:19 UTC |