Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl Monk, Perl Meditation
 
PerlMonks  

Re: FASTA Splitter

by citromatik (Curate)
on Jun 01, 2009 at 22:39 UTC ( [id://767402]=note: print w/replies, xml ) Need Help??


in reply to FASTA Splitter

You can also take a look at this module I wrote some time ago. It allows to access a fasta file via a Perl array, so the task could be solved with something like:

use strict; use warnings; use Tie::File::AnyData::Bio::Fasta; use Fcntl; my $fastafile = 'j:\summer\begomo_genomes2.fasta'; tie my @fastaFile, 'Tie::File::AnyData::Bio::Fasta', $fastafile or die + $!; for my $fastaRec (@fastafile) { my ($header, $rest) = split /\n/,$fastaRec, 2; my ($accession) = $header =~ /gi\|(\d+)/; tie my @outFasta, 'Tie::File::AnyData::Bio::Fasta', "${accession} +.fasta", mode => O_RDWR | O_CREAT or die $!; @outFasta = ($fastaRec); untie @outFasta; } untie @fastaFile;

citromatik

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://767402]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others chanting in the Monastery: (5)
As of 2024-03-29 11:02 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found