in reply to mismatching characters in dna sequence
This isn't built around PDL, but I'd be surprised if there's not a simple way to adapt it to work with your PDL objects.
use strict; use warnings; my $target = "ATTCCGGG"; my @tests = qw/ ATTGCGGG ATACCGGC /; foreach my $test ( @tests ) { print "Testing: Target: $target\tTest: $test\n"; my @results = map { my ( $target_c, $test_c ) = ( substr( $target, $_, 1 ), substr( $test, $_, 1 ) ); ( $target_c ne $test_c ) ? [ $_, $target_c, $test_c ] : (); } 0 .. length( $target ) - 1; print "\t$_->[0]: $_->[1] -> $_->[2]\n" for @results; }
Output:
Testing: Target: ATTCCGGG Test: ATTGCGGG 3: C -> G Testing: Target: ATTCCGGG Test: ATACCGGC 2: T -> A 7: G -> C
Dave
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: mismatching characters in dna sequence
by prbndr (Acolyte) on Dec 30, 2011 at 02:16 UTC | |
|
Re^2: mismatching characters in dna sequence
by prbndr (Acolyte) on Dec 30, 2011 at 03:26 UTC |