Beefy Boxes and Bandwidth Generously Provided by pair Networks
Welcome to the Monastery
 
PerlMonks  

Re^2: Lower-casing Substrings and Iterating Two Files together

by neversaint (Deacon)
on Dec 29, 2008 at 05:32 UTC ( [id://732959]=note: print w/replies, xml ) Need Help??


in reply to Re: Lower-casing Substrings and Iterating Two Files together
in thread Lower-casing Substrings and Iterating Two Files together

Dear BrowserUK,
Your magical approach is at least 6980x faster than mine!

My approach:
191.52user 153.47system 5:49.44elapsed 98%CPU
BrowserUk Perl's approach (modified to handle FASTA):
open SEQ, '<', $ARGV[0] or die $!; #plain open MASK, '<', $ARGV[1] or die $!; #hardmask while ( my $seq = <SEQ> ) { ## Read a sequence my $mask = <MASK>; ## And the corresponding mask if ( $mask =~ /^>/ ) { print "$seq"; } else { $mask =~ tr[N][ ]; ## Ns => spaces print $seq | $mask; ## bitwise-OR them and print the re +sult; } } close SEQ; close MASK;
Takes only this much time:
0.45user 0.07system 0:05.59elapsed 9%CPU
This is tested on 12MB dataset, and the breakdown of sequence length is this:
#Seq_name #Seq_len 2-micron 6318 MT 85779 I 230208 VI 270148 III 316617 IX 439885 VIII 562643 V 576869 XI 666454 X 745745 XIV 784333 II 813178 XIII 924429 XVI 948062 XII 1078175 VII 1090946 XV 1091289 IV 1531918
Update: These test datasets (full and hardmasked) can be downloaded here.

---
neversaint and everlastingly indebted.......

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others studying the Monastery: (4)
As of 2025-07-08 20:56 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found

    Notices?
    erzuuliAnonymous Monks are no longer allowed to use Super Search, due to an excessive use of this resource by robots.