X-Git-Url: http://source.jalview.org/gitweb/?a=blobdiff_plain;f=src%2Fjalview%2Fanalysis%2FRna.java;h=89c5c3076132b74e46bf6613fb7141d1ccd7eb35;hb=1ee1c1730f3b52aee4d039b416f276a1c55257df;hp=e3d999a98e6158e45b80811290a150eb25654662;hpb=4ed0cd5f8477ba52a9f5b19b021f8f6183f9dd61;p=jalview.git diff --git a/src/jalview/analysis/Rna.java b/src/jalview/analysis/Rna.java index e3d999a..89c5c30 100644 --- a/src/jalview/analysis/Rna.java +++ b/src/jalview/analysis/Rna.java @@ -359,8 +359,8 @@ public class Rna } /** - * Answers true if the base-pair is either a canonical (A-T/U, C-G) or a - * wobble (G-T/U) pair (either way round), else false + * Answers true if the base-pair is either a Watson-Crick (A:T/U, C:G) or a + * wobble (G:T/U) pair (either way round), else false * * @param first * @param second @@ -376,7 +376,7 @@ public class Rna { second -= 32; } - + switch (first) { case 'A': @@ -417,6 +417,62 @@ public class Rna } /** + * Answers true if the base-pair is Watson-Crick - (A:T/U or C:G, either way + * round), else false + * + * @param first + * @param second + * @return + */ + public static boolean isCanonicalPair(char first, char second) + { + + if (first > 'Z') + { + first -= 32; + } + if (second > 'Z') + { + second -= 32; + } + + switch (first) + { + case 'A': + switch (second) + { + case 'T': + case 'U': + return true; + } + break; + case 'G': + switch (second) + { + case 'C': + return true; + } + break; + case 'C': + switch (second) + { + case 'G': + return true; + } + break; + case 'T': + case 'U': + switch (second) + { + case 'A': + return true; + } + break; + } + return false; + } + + /** * Returns the matching close pair symbol for the given opening symbol. * Currently returns a-z for A-Z, or )]}> for ([{<, or the input symbol if it * is not a valid opening symbol.