in reply to Lower-casing Substrings and Iterating Two Files together
My idea is based upon using index, rindex and substr.
#!/usr/bin/perl use strict; use warnings; open SEQ, '<', 'data1.dat' or die $!; open MASK, '<', 'data2.dat' or die $!; while ( my $seq = <SEQ> ) { my $mask = <MASK>; my $start = index( $mask, 'N' ); my $length = rindex( $mask, 'N' ) - $start + 1; my $lc_seq = lc substr( $seq, $start, $length ); substr( $seq, $start, $length, $lc_seq ); print $seq; }
Updates:
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: Lower-casing Substrings and Iterating Two Files together
by kirillm (Friar) on Dec 27, 2008 at 16:16 UTC | |
by linuxer (Curate) on Dec 27, 2008 at 16:26 UTC |