Here's a variation on rjt's approach that uses a different method to compare the reversed, complemented strings, and then flags locations of non-reverse-complementarity:
>perl -wMstrict -le "die 'Please enter exactly two sequences' unless @ARGV == 2; ;; my ($seq1, $seq2) = map uc, @ARGV; die 'Please enter only ATCG sequences' if grep /[^ATCG]/, $seq1, $seq +2; ;; die 'Sequence lengths differ' if length $seq1 != length $seq2; ;; (my $comp = $seq2) =~ tr/ATCG/TAGC/; my $mask = $seq1 ^ reverse $comp; ;; if ($mask !~ m{ [^\000] }xms) { print 'The sequences are reverse-complementary'; exit; } ;; $mask =~ tr{\000-\377}{_^}; print 'Sequences are non-reverse-complementary at these locations:'; print qq{@ARGV}; print qq{$mask }, ''.reverse $mask; " GGGGaaaaaaCatttatatat atatataaatttttATtcccc Sequences are non-reverse-complementary at these locations: GGGGaaaaaaCatttatatat atatataaatttttATtcccc ______^___^__________ __________^___^______
In reply to Re: Reverse Complement
by AnomalousMonk
in thread Reverse Complement
by stamp1982
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |