X-Git-Url: http://source.jalview.org/gitweb/?a=blobdiff_plain;f=src%2Fjalview%2Fanalysis%2FRna.java;h=e3d999a98e6158e45b80811290a150eb25654662;hb=4ed0cd5f8477ba52a9f5b19b021f8f6183f9dd61;hp=f497f0e4e909be7d49f6930d4d4c8dfe3bf9a532;hpb=32522ec3c4179494249e085506977f21f83e9b2e;p=jalview.git diff --git a/src/jalview/analysis/Rna.java b/src/jalview/analysis/Rna.java index f497f0e..e3d999a 100644 --- a/src/jalview/analysis/Rna.java +++ b/src/jalview/analysis/Rna.java @@ -52,6 +52,19 @@ public class Rna } /** + * Answers true if the string is a valid open pair rna secondary structure + * symbol. Currently accepts A-Z, ([{< + * + * @param s + * @return + */ + public static boolean isOpeningParenthesis(String s) + { + return s != null && s.length() == 1 + && isOpeningParenthesis(s.charAt(0)); + } + + /** * Answers true if the character is a valid close pair rna secondary structure * symbol. Currently accepts a-z, )]}> * @@ -64,6 +77,19 @@ public class Rna } /** + * Answers true if the string is a valid close pair rna secondary structure + * symbol. Currently accepts a-z, )]}> + * + * @param s + * @return + */ + public static boolean isClosingParenthesis(String s) + { + return s != null && s.length() == 1 + && isClosingParenthesis(s.charAt(0)); + } + + /** * Returns the matching open pair symbol for the given closing symbol. * Currently returns A-Z for a-z, or ([{< for )]}>, or the input symbol if it * is not a valid closing symbol. @@ -298,6 +324,18 @@ public class Rna } /** + * Answers true if the string is a recognised symbol for RNA secondary + * structure. Currently accepts a-z, A-Z, ()[]{}<>. + * + * @param s + * @return + */ + public static boolean isRnaSecondaryStructureSymbol(String s) + { + return isOpeningParenthesis(s) || isClosingParenthesis(s); + } + + /** * Translates a string to RNA secondary structure representation. Returns the * string with any non-SS characters changed to spaces. Accepted characters * are a-z, A-Z, and (){}[]<> brackets.