X-Git-Url: http://source.jalview.org/gitweb/?a=blobdiff_plain;ds=sidebyside;f=src%2Fjalview%2Fws%2Fjws2%2FRNAalifoldClient.java;h=f9e597f4e549d0ad664e7d98fa8144836e27c161;hb=efb5cfa00ee832a62dfdf59f5fb847a0e16424d9;hp=ec40552b38048fe6b6a390c2c816fd6121c4550e;hpb=54da3e753588d95f08dd66ca2d111f16475b061c;p=jalview.git
diff --git a/src/jalview/ws/jws2/RNAalifoldClient.java b/src/jalview/ws/jws2/RNAalifoldClient.java
index ec40552..f9e597f 100644
--- a/src/jalview/ws/jws2/RNAalifoldClient.java
+++ b/src/jalview/ws/jws2/RNAalifoldClient.java
@@ -1,10 +1,29 @@
+/*
+ * Jalview - A Sequence Alignment Editor and Viewer ($$Version-Rel$$)
+ * Copyright (C) $$Year-Rel$$ The Jalview Authors
+ *
+ * This file is part of Jalview.
+ *
+ * Jalview is free software: you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation, either version 3
+ * of the License, or (at your option) any later version.
+ *
+ * Jalview is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty
+ * of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+ * PURPOSE. See the GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with Jalview. If not, see .
+ * The Jalview Authors are detailed in the 'AUTHORS' file.
+ */
package jalview.ws.jws2;
-import jalview.api.AlignCalcWorkerI;
import jalview.datamodel.AlignmentAnnotation;
import jalview.datamodel.Annotation;
import jalview.gui.AlignFrame;
-import jalview.ws.jws2.dm.AAConSettings;
+import jalview.util.MessageManager;
import jalview.ws.jws2.jabaws2.Jws2Instance;
import jalview.ws.params.WsParamSetI;
import jalview.ws.uimodel.AlignAnalysisUIText;
@@ -16,6 +35,7 @@ import java.util.List;
import java.util.TreeSet;
import java.util.regex.Pattern;
+import compbio.data.sequence.FastaSequence;
import compbio.data.sequence.RNAStructReader.AlifoldResult;
import compbio.data.sequence.RNAStructScoreManager;
import compbio.data.sequence.Range;
@@ -24,12 +44,12 @@ import compbio.metadata.Argument;
/**
* Client for the JABA RNA Alifold Service
+ *
* @author daluke - Daniel Barton
- *
+ *
*/
-public class RNAalifoldClient extends JabawsAlignCalcWorker implements
- AlignCalcWorkerI
+public class RNAalifoldClient extends JabawsCalcWorker
{
String methodName;
@@ -44,39 +64,32 @@ public class RNAalifoldClient extends JabawsAlignCalcWorker implements
WsParamSetI preset, List paramset)
{
super(sh, alignFrame, preset, paramset);
-
- //if (arguments == null)
- // arguments = new ArrayList();
-
af = alignFrame;
methodName = sh.serviceType;
- alignedSeqs=true;
- submitGaps=true;
+ alignedSeqs = true;
+ submitGaps = true;
nucleotidesAllowed = true;
proteinAllowed = false;
initViewportParams();
}
-
+
+ @Override
public String getCalcId()
{
return CALC_ID;
}
- private static String CALC_ID="jalview.ws.jws2.RNAalifoldClient";
+
+ private static String CALC_ID = "jalview.ws.jws2.RNAalifoldClient";
public static AlignAnalysisUIText getAlignAnalysisUITest()
{
return new AlignAnalysisUIText(
compbio.ws.client.Services.RNAalifoldWS.toString(),
- jalview.ws.jws2.RNAalifoldClient.class,
- CALC_ID,
- true,
- false,
- true,
- "RNAAliFold Prediction",
- "When checked, RNA secondary structure predictions will be calculated for the alignment, and updated when edits are made.",
- "Change RNAAliFold settings...",
- "Modify settings for the RNAAliFold prediction. Use this to hide or show different results of the RNA calculation, and change RNA folding parameters");
-
+ jalview.ws.jws2.RNAalifoldClient.class, CALC_ID, true, false,
+ true, MessageManager.getString("label.rnalifold_calculations"),
+ MessageManager.getString("tooltip.rnalifold_calculations"),
+ MessageManager.getString("label.rnalifold_settings"),
+ MessageManager.getString("tooltip.rnalifold_settings"));
}
@Override
@@ -87,6 +100,12 @@ public class RNAalifoldClient extends JabawsAlignCalcWorker implements
}
@Override
+ boolean checkValidInputSeqs(boolean dynamic, List seqs)
+ {
+ return (seqs.size() > 1);
+ }
+
+ @Override
public void updateResultAnnotation(boolean immediate)
{
@@ -160,14 +179,18 @@ public class RNAalifoldClient extends JabawsAlignCalcWorker implements
* same data object as was overwritten with the contact probabilites data.
*/
if (data == null)
+ {
data = compbio.data.sequence.RNAStructReader
.newEmptyScore(AlifoldResult.consensusAlignment);
+ }
if (descriptionData == null)
+ {
descriptionData = data;
+ }
- String[] typenameAndDescription = constructTypenameAndDescription(descriptionData
- .first());
+ String[] typenameAndDescription = constructTypenameAndDescription(
+ descriptionData.first());
String typename = typenameAndDescription[0];
String description = typenameAndDescription[1];
@@ -196,14 +219,14 @@ public class RNAalifoldClient extends JabawsAlignCalcWorker implements
}
private AlignmentAnnotation constructAnnotationFromScoreHolder(
- AlignmentAnnotation annotation, String struct, TreeSet data)
+ AlignmentAnnotation annotation, String struct,
+ TreeSet data)
{
- Annotation[] anns = new Annotation[struct.length()];
+ Annotation[] anns = new Annotation[gapMap != null ? gapMap.length + 1
+ : struct.length()];
- if (data != null
- && data.size() > 1
- && data.first().getMethod()
- .equals(AlifoldResult.contactProbabilities.toString()))
+ if (data != null && data.size() > 1 && data.first().getMethod()
+ .equals(AlifoldResult.contactProbabilities.toString()))
{
// The base pair probabilities are stored in a set in scoreholder. we want
@@ -213,13 +236,13 @@ public class RNAalifoldClient extends JabawsAlignCalcWorker implements
{
// The Score objects contain a set of size one containing the range and
// an ArrayList of size one containing the probabilty
- basePairs.put(score.getRanges().first(), new Float(score
- .getScores().get(0)));
+ basePairs.put(score.getRanges().first(),
+ Float.valueOf(score.getScores().get(0)));
}
-
- for (int i = 0,ri=0,iEnd=struct.length();i prob)
+ {
prob = t;
+ }
description += Integer.toString(contact.from) + "->"
+ Integer.toString(contact.to) + ": "
+ Float.toString(t) + "% | ";
@@ -256,15 +281,19 @@ public class RNAalifoldClient extends JabawsAlignCalcWorker implements
}
else if (data == null || data.size() == 1)
{
- for (int i = 0,ri=0,iEnd=struct.length();i