Beefy Boxes and Bandwidth Generously Provided by pair Networks
more useful options
 
PerlMonks  

Re: FASTA Splitter

by citromatik (Curate)
on Jun 01, 2009 at 22:39 UTC ( #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


Comment on Re: FASTA Splitter
Download Code

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others lurking in the Monastery: (11)
As of 2014-09-18 18:03 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    How do you remember the number of days in each month?











    Results (120 votes), past polls