From: Daniel Barton Date: Wed, 28 Aug 2013 21:17:49 +0000 (+0100) Subject: Category.java updated to include new category for RNA folding. RNAalifoldParameters... X-Git-Url: http://source.jalview.org/gitweb/?a=commitdiff_plain;h=3d83a94db0413bb7beb74dc2439abb219c14a98d;p=jabaws.git Category.java updated to include new category for RNA folding. RNAalifoldParameters.xml cut down to a number of parameters which I think are needed and which work easily with Jalview --- diff --git a/conf/settings/RNAalifoldParameters.xml b/conf/settings/RNAalifoldParameters.xml index 5ee3fc2..a730f64 100644 --- a/conf/settings/RNAalifoldParameters.xml +++ b/conf/settings/RNAalifoldParameters.xml @@ -5,8 +5,6 @@ Endgaps Score pairs with endgaps same as gap-gap pairs -E - --endgaps - -E Most Informative Sequence @@ -17,43 +15,17 @@ Partition Function Output partition function and probability matrix -p - --partfunc - -p - - - p0 - deactivates the calculation of the pair probabilities - -p0 - - - color - Consensus structure plot is colored - --color - - - Alignment - Output structure annotated alignment - --aln - - - No Postscript - Do not produce postscript output - --noPS Circular Assume circular RNA molecule -c - --circ - -c G-Quadruplex Incorporate G-Quadruplex formation into prediction algorithm -g - --gquad - -g d2 @@ -84,8 +56,6 @@ Ribosum Scoring Use Ribosum Scoring Matrix -r - --ribosum_scoring - -r d2 @@ -99,49 +69,13 @@ Maximum Expected Accuracy Structure --MEA - - - - Stochastic Backtrack - Compute a number of random structures - -s - - - - 5 - - Integer - 1 - 100000 - - - - stochBT_en - Print Backtrack structures - --stochBT_en - 5 - - Integer - 1 - 100000 - - + scaling factor In calculating pf use scale*mfe as estimate for ensemble free energy] -S - 1.07 Float @@ -162,9 +96,8 @@ Temperature - Rescale Energy parameterss to Temperature + Rescale Energy parameters to Temperature -T - 37 Float @@ -173,18 +106,6 @@ - Dangling End - How to treat Dangling End energies for bases adjacent to helices - -d - - 2 - - Integer - 0 - 100000 - - - cfactor weight of covariance term --cfactor @@ -207,47 +128,4 @@ - - - - - - - - - - - - - - - - - - - - - - Allow Pairs - allow pairs in addition to AU, GC and GU - --nsp - -GA - -GA - -AG - - - - betaScale - Set scaling of Boltzmann factors - --betaScale - 1.0 - - Float - 0 - 100000 - - \ No newline at end of file diff --git a/datamodel/compbio/data/sequence/RNAStructReader.java b/datamodel/compbio/data/sequence/RNAStructReader.java index 5eec46f..4292554 100644 --- a/datamodel/compbio/data/sequence/RNAStructReader.java +++ b/datamodel/compbio/data/sequence/RNAStructReader.java @@ -34,7 +34,7 @@ public class RNAStructReader { // alifold out line patterns static String ps = "\\s*"; static String alignmentP = "^"+seqP+ps+"$"; - static String stdStructP = "^"+structP+s+"\\("+ps+floatP+s+floatP+s+floatP+ps+"\\)"+ps+"$"; + static String mfeStructP = "^"+structP+s+"\\("+ps+floatP+s+floatP+s+floatP+ps+"\\)"+ps+"$"; static String justStructP = "^"+structP+ps+"$"; static String stochBTStructP = "^"+structP+s+floatP+s+floatP+ps+"$"; static String PStructP = "^"+structP+s+"\\["+ps+floatP+ps+"\\]"+ps+"$"; @@ -42,7 +42,8 @@ public class RNAStructReader { static String MEAStructP = "^"+structP+s+"\\{"+ps+floatP+s+"MEA="+floatP+ps+"\\}"+ps+"$"; static String freeEnergyP = "^"+ps+"free energy of ensemble"+ps+"="+ps+floatP+ps+"kcal/mol"+ps+"$"; static String ensembleFreqP = "^"+ps+"frequency of mfe structure in ensemble "+floatP+ps+"$"; - + + public static RNAStructScoreManager readRNAStructStream(InputStream stdout) throws IOException { @@ -60,17 +61,17 @@ public class RNAStructReader { assert (Pattern.matches(AlifoldLine.alignment.regex, fline)) : error + "Sequence Alignment Expected"; structs.add(fline.trim()); - data.add(newEmptyScore(AlifoldResult.alifoldSeq)); + data.add(newEmptyScore(AlifoldResult.consensusAlignment)); fline = reader.readLine(); - assert (Pattern.matches(AlifoldLine.stdStruct.regex, fline)) : + assert (Pattern.matches(AlifoldLine.mfeStruct.regex, fline)) : error + "Consensus Structure and Energy Expected"; Scanner sc = new Scanner(fline); structs.add(sc.next()); for (int i = 0; i < 3; i++) { scores.add(Float.parseFloat(sc.findInLine(floatP))); } - data.add(newSetScore(AlifoldResult.alifold, scores)); + data.add(newSetScore(AlifoldResult.mfeStructure, scores)); // Now the alifold stdout file formats diverge based on arguments fline = reader.readLine(); @@ -91,7 +92,7 @@ public class RNAStructReader { structs.add(sc.next()); scores.add(Float.parseFloat(sc.findInLine(floatP))); scores.add(Float.parseFloat(nsc.findInLine(floatP))); - data.add(newSetScore(AlifoldResult.alifoldP, scores)); + data.add(newSetScore(AlifoldResult.contactProbabilityStructure, scores)); // Jump line sline = reader.readLine(); } @@ -100,24 +101,24 @@ public class RNAStructReader { for (int i = 0; i < 3; i++) { scores.add(Float.parseFloat(sc.findInLine(floatP))); } - data.add(newSetScore(AlifoldResult.alifoldCentroid, scores)); + data.add(newSetScore(AlifoldResult.centroidStructure, scores)); } else if (ftype.equals(AlifoldLine.MEAStruct)) { structs.add(sc.next()); for (int i = 0; i < 2; i++) { scores.add(Float.parseFloat(sc.findInLine(floatP))); } - data.add(newSetScore(AlifoldResult.alifoldMEA, scores)); + data.add(newSetScore(AlifoldResult.MEAStucture, scores)); } else if (ftype.equals(AlifoldLine.justStruct)) { structs.add(sc.next()); - data.add(newEmptyScore(AlifoldResult.alifoldStochBT)); + data.add(newEmptyScore(AlifoldResult.stochBTStructure)); } else if (ftype.equals(AlifoldLine.stochBTStruct)) { structs.add(sc.next()); scores.add(sc.nextFloat()); scores.add(sc.nextFloat()); - data.add(newSetScore(AlifoldResult.alifoldStochBT, scores)); + data.add(newSetScore(AlifoldResult.stochBTStructure, scores)); } else if (ftype.equals(AlifoldLine.freeEnergy)) { assert (sline != null @@ -127,7 +128,7 @@ public class RNAStructReader { + "frequency of mfe structure in ensemble"); scores.add(Float.parseFloat(sc.findInLine(floatP))); scores.add(Float.parseFloat(nsc.findInLine(floatP))); - data.add(newSetScore(AlifoldResult.alifoldMetadata, scores)); + data.add(newSetScore(AlifoldResult.ensembleValues, scores)); // jump line sline = reader.readLine(); } @@ -135,7 +136,7 @@ public class RNAStructReader { assert(!ftype.equals(AlifoldLine.ensembleFreq)) : error + "Wasn't expecting 'frequency of mfe structure'!"; - assert(!ftype.equals(AlifoldLine.stdStruct)) : + assert(!ftype.equals(AlifoldLine.mfeStruct)) : error + "'Standard output' line at a place other than line 2!"; assert(!ftype.equals(AlifoldLine.alignment)) : error + "Wasn't expecting an alignment sequence!"; @@ -218,7 +219,7 @@ public class RNAStructReader { for (int i = 0; i < rangeHolder.size(); i++) { ArrayList singleS = new ArrayList(Arrays.asList(scores.get(i))); TreeSet singleR = new TreeSet(Arrays.asList(rangeHolder.get(i))); - sHolder.add(new Score(AlifoldResult.alifoldSeq, singleS, singleR)); + sHolder.add(new Score(AlifoldResult.contactProbabilities, singleS, singleR)); } data.set(0, sHolder); @@ -249,7 +250,7 @@ public class RNAStructReader { } static enum AlifoldLine { - stdStruct (stdStructP), + mfeStruct (mfeStructP), justStruct (justStructP), stochBTStruct (stochBTStructP), PStruct (PStructP), @@ -272,11 +273,11 @@ public class RNAStructReader { //Something to put in the Score objects of the alifold result which gives information //about what kind of sequence it is holding in its String Id. - static enum AlifoldResult { - alifold, alifoldP, alifoldMEA, alifoldCentroid, alifoldStochBT, alifoldSeq, alifoldMetadata + + public static enum AlifoldResult { + mfeStructure, contactProbabilityStructure, MEAStucture, centroidStructure, stochBTStructure, consensusAlignment, ensembleValues, contactProbabilities } - // Print the full regex Strings for testing public static void main(String[] args) { diff --git a/datamodel/compbio/data/sequence/Score.java b/datamodel/compbio/data/sequence/Score.java index b886590..1cac69c 100644 --- a/datamodel/compbio/data/sequence/Score.java +++ b/datamodel/compbio/data/sequence/Score.java @@ -249,6 +249,8 @@ public class Score implements Comparable { */ + + @Override public int compareTo(Score o) { if (this.method.compareTo(o.method) != 0) { diff --git a/datamodel/compbio/data/sequence/ScoreManager.java b/datamodel/compbio/data/sequence/ScoreManager.java index 3c1bc21..61a8927 100644 --- a/datamodel/compbio/data/sequence/ScoreManager.java +++ b/datamodel/compbio/data/sequence/ScoreManager.java @@ -51,9 +51,7 @@ public class ScoreManager { } private ScoreManager(Map> data) { - System.out.println("A ScoreManager was created!!"); - List seqScores = new ArrayList(); for (Map.Entry> singleSeqScores : data.entrySet()) { seqScores.add(new ScoreHolder(singleSeqScores.getKey(), @@ -63,8 +61,6 @@ public class ScoreManager { } public static ScoreManager newInstance(Map> data) { - System.out.println("A ScoreManager was created!!"); - return new ScoreManager(data); } @@ -72,9 +68,6 @@ public class ScoreManager { public static ScoreManager newInstanceSingleScore( Map seqScoresMap) { - System.out.println("A ScoreManager was created!!"); - - Map> multipleScoresMap = new TreeMap>(); for (Map.Entry seqScore : seqScoresMap.entrySet()) { Set scores = new TreeSet(); @@ -85,9 +78,6 @@ public class ScoreManager { } public static ScoreManager newInstanceSingleSequence(Set data) { - System.out.println("A ScoreManager was created!!"); - - return new ScoreManager(ScoreManager.SINGLE_ENTRY_KEY, new TreeSet(data)); } diff --git a/webservices/compbio/data/msa/Category.java b/webservices/compbio/data/msa/Category.java index 56bf1de..3de1b31 100644 --- a/webservices/compbio/data/msa/Category.java +++ b/webservices/compbio/data/msa/Category.java @@ -34,6 +34,7 @@ public class Category { public static final String CATEGORY_ALIGNMENT = "Alignment"; public static final String CATEGORY_DISORDER = "Protein Disorder"; public static final String CATEGORY_CONSERVATION = "Conservation"; + public static final String CATEGORY_RNASTRUCT = "RNA Structure Prediction"; public String name; Set services; @@ -78,10 +79,17 @@ public class Category { Category conservation = new Category(CATEGORY_CONSERVATION, conservation_services); + Set rnastruct_services = new HashSet(); + rnastruct_services.add(Services.RNAalifoldWS); + + Category rnastruct = new Category(CATEGORY_RNASTRUCT, + rnastruct_services); + Set categories = new HashSet(); categories.add(alignment); categories.add(disorder); categories.add(conservation); + categories.add(rnastruct); return categories; }