Beefy Boxes and Bandwidth Generously Provided by pair Networks
Think about Loose Coupling
 
PerlMonks  

Re: Lower-casing Substrings and Iterating Two Files together

by kirillm (Friar)
on Dec 27, 2008 at 14:27 UTC ( [id://732794]=note: print w/replies, xml ) Need Help??


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

How about reading one character from each of the files and depending on the current value of character from data2.txt print out either lowercased or uppercased value of the character from data1.txt. Something like this (no error checking etc, but you see the idea):

open D1, 'data1.txt'; open D2, 'data2.txt'; my ($c1, $c2); while (read D2, $c2, 1) { read D1, $c1, 1; print $c2 eq 'N' ? lc($c1) : $c1; } close D2; close D1;

This produces the desired output:

>seq1 GGTacacagaagccaaagcaggctccaggctctgagctgtcagcacagagaccgaT >seq2 GTCTCTGTCTCtaaaataaataaacattaaaaaaattttaaaagaaaaGATTCTCTCC

-- Kirill

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others cooling their heels in the Monastery: (None)
    As of 2024-04-25 00:23 GMT
    Sections?
    Information?
    Find Nodes?
    Leftovers?
      Voting Booth?

      No recent polls found