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
In reply to Re: mismatching characters in dna sequence
by davido
in thread mismatching characters in dna sequence
by prbndr
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |