Beefy Boxes and Bandwidth Generously Provided by pair Networks
Do you know where your variables are?
 
PerlMonks  

Re: File::Wrap and Fasta format

by robsv (Curate)
on Mar 25, 2003 at 21:41 UTC ( #245796=note: print w/ replies, xml ) Need Help??


in reply to File::Wrap and Fasta format

Here's another shorter regex (although it's not doing any substitution):

... print $fh ">$description\n"; print $fh "$_\n" foreach ($seq =~ /.{1,50}/g); ...

The fastest way I've found of dumping a FASTA sequence (with very large sequences, anyways), is with substr:
... print $fh ">$description\n"; print $fh substr($seq,0,50,'') . "\n" while ($seq); ...
The thing to watch here is that it's destructive - $seq will be empty when it finishes.

- robsv


Comment on Re: File::Wrap and Fasta format
Select or Download Code

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others contemplating the Monastery: (10)
As of 2015-07-30 23:46 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    The top three priorities of my open tasks are (in descending order of likelihood to be worked on) ...









    Results (273 votes), past polls