*
* @author Agnieszka Golicz & Peter Troshin
*/
-public enum Method {
+public enum ConservationMethod {
KABAT, JORES, SCHNEIDER, SHENKIN, GERSTEIN, TAYLOR_GAPS, TAYLOR_NO_GAPS, ZVELIBIL, KARLIN, ARMON, THOMPSON, NOT_LANCET, MIRNY, WILLIAMSON, LANDGRAF, SANDER, VALDAR, SMERFS;
- public static Method getMethod(String meth) {
+ public static ConservationMethod getMethod(String meth) {
meth = meth.trim().toLowerCase();
if (meth.equalsIgnoreCase(KABAT.toString())) {
return KABAT;
--- /dev/null
+package compbio.data.sequence;\r
+\r
+/**\r
+ * Enumeration defining two constraints for SMERFS columns score calculation.\r
+ * MAX_SCORE gives the highest core of all the windows the column belongs to.\r
+ * MID_SCORE gives the window score to the column in the middle.\r
+ * \r
+ * @author Agnieszka Golicz & Peter Troshin\r
+ */\r
+public enum SMERFSConstraints {\r
+\r
+ MAX_SCORE, MID_SCORE;\r
+\r
+ /**\r
+ * Default column scoring schema\r
+ */\r
+ public static final SMERFSConstraints DEFAULT_COLUMN_SCORE = SMERFSConstraints.MID_SCORE;\r
+\r
+ /**\r
+ * Default window size value for SMERFS algorithm\r
+ */\r
+ public static final int DEFAULT_WINDOW_SIZE = 7;\r
+\r
+ /**\r
+ * Default gap threshold value for SMERFS algorithm\r
+ */\r
+ public static final double DEFAULT_GAP_THRESHOLD = 0.1;\r
+\r
+ public static SMERFSConstraints getSMERFSColumnScore(String score) {\r
+\r
+ score = score.trim().toLowerCase();\r
+ if (score.equalsIgnoreCase(SMERFSConstraints.MAX_SCORE.toString())) {\r
+ return SMERFSConstraints.MAX_SCORE;\r
+ }\r
+ if (score.equalsIgnoreCase(SMERFSConstraints.MID_SCORE.toString())) {\r
+ return SMERFSConstraints.MID_SCORE;\r
+ }\r
+ return null;\r
+ }\r
+}\r
@Immutable\r
public class Score {\r
\r
- private Method method;\r
+ private ConservationMethod method;\r
\r
private List<Float> scores;\r
\r
// JaXB default constructor\r
}\r
\r
- public Score(Method method, List<Float> scores) {\r
+ public Score(ConservationMethod method, List<Float> scores) {\r
this.method = method;\r
this.scores = scores;\r
}\r
\r
- public Method getMethod() {\r
+ public ConservationMethod getMethod() {\r
return method;\r
}\r
\r
* \r
* @param results\r
* output file of AAConservation\r
- * @return Map with keys {@link Method} -> float[]\r
+ * @return Map with keys {@link ConservationMethod} -> float[]\r
*/\r
public static HashSet<Score> readAAConResults(InputStream results) {\r
if (results == null) {\r
assert spacePos > 0 : "Space is expected as delimited between method "\r
+ "name and values!";\r
String methodLine = line.substring(0, spacePos);\r
- Method method = Method.getMethod(methodLine);\r
+ ConservationMethod method = ConservationMethod.getMethod(methodLine);\r
assert method != null : "Method " + methodLine\r
+ " is not recognized! ";\r
Scanner valuesScanner = new Scanner(line.substring(spacePos));\r
import org.testng.annotations.BeforeMethod;\r
import org.testng.annotations.Test;\r
\r
-import compbio.data.sequence.Method;\r
+import compbio.data.sequence.ConservationMethod;\r
import compbio.data.sequence.MultiAnnotatedSequence;\r
import compbio.engine.AsyncExecutor;\r
import compbio.engine.Configurator;\r
lr.executeJob();\r
ConfiguredExecutable<?> al1 = lr.waitForResult();\r
assertNotNull(al1.getResults());\r
- MultiAnnotatedSequence<Method> annotations = confAAcon.getResults();\r
+ MultiAnnotatedSequence<ConservationMethod> annotations = confAAcon.getResults();\r
assertNotNull(annotations);\r
assertEquals(annotations.getAnnotations().size(), 1);\r
assertEquals(al1.getResults(), annotations);\r
lr.executeJob();\r
ConfiguredExecutable<?> al1 = lr.waitForResult();\r
assertNotNull(al1.getResults());\r
- MultiAnnotatedSequence<Method> annotations = confAAcon.getResults();\r
+ MultiAnnotatedSequence<ConservationMethod> annotations = confAAcon.getResults();\r
assertNotNull(annotations);\r
assertEquals(annotations.getAnnotations().size(), 13);\r
assertEquals(al1.getResults(), annotations);\r
lr.executeJob();\r
ConfiguredExecutable<?> al1 = lr.waitForResult();\r
assertNotNull(al1.getResults());\r
- MultiAnnotatedSequence<Method> annotations = confAAcon.getResults();\r
+ MultiAnnotatedSequence<ConservationMethod> annotations = confAAcon.getResults();\r
assertNotNull(annotations);\r
assertEquals(annotations.getAnnotations().size(), 3);\r
assertEquals(al1.getResults(), annotations);\r
import java.io.FileInputStream;\r
import java.io.FileNotFoundException;\r
import java.io.IOException;\r
-import java.net.MalformedURLException;\r
-import java.net.URL;\r
import java.util.ArrayList;\r
import java.util.HashSet;\r
import java.util.List;\r
\r
-import javax.xml.namespace.QName;\r
-import javax.xml.ws.Service;\r
-\r
import org.testng.annotations.BeforeTest;\r
import org.testng.annotations.Test;\r
\r
import compbio.data.msa.Annotation;\r
+import compbio.data.msa.JABAService;\r
import compbio.data.sequence.FastaSequence;\r
-import compbio.data.sequence.Method;\r
+import compbio.data.sequence.ConservationMethod;\r
import compbio.data.sequence.Score;\r
import compbio.data.sequence.SequenceUtil;\r
import compbio.metadata.JobSubmissionException;\r
\r
@BeforeTest\r
void initConnection() {\r
- URL url = null;\r
- try {\r
- url = new URL("http://localhost:8080/jabaws/AAConWS?wsdl");\r
- } catch (MalformedURLException e) {\r
- e.printStackTrace();\r
- fail(e.getLocalizedMessage());\r
- }\r
- String namespace = "http://msa.data.compbio/01/12/2010/";\r
- QName qname = new QName(namespace, "AAConWS");\r
- Service serv = Service.create(url, qname);\r
- msaws = serv.getPort(new QName(namespace, "AAConWSPort"),\r
- Annotation.class);\r
+ /*\r
+ * URL url = null; try { url = new\r
+ * URL("http://localhost:8080/jabaws/AAConWS?wsdl"); } catch\r
+ * (MalformedURLException e) { e.printStackTrace();\r
+ * fail(e.getLocalizedMessage()); } String namespace =\r
+ * "http://msa.data.compbio/01/12/2010/"; QName qname = new\r
+ * QName(namespace, "AAConWS"); Service serv = Service.create(url,\r
+ * qname); msaws = serv.getPort(new QName(namespace, "AAConWSPort"),\r
+ * Annotation.class);\r
+ */\r
+ JABAService client = Jws2Client.connect("http://localhost:8080/jabaws",\r
+ Services.AAConWS);\r
+ msaws = (Annotation<AACon>) client;\r
}\r
\r
@Test\r
HashSet<Score> result = msaws.getAnnotation(jobId);\r
assertNotNull(result);\r
assertEquals(result.size(), 1);\r
- assertEquals(result.iterator().next().getMethod(), Method.SHENKIN);\r
+ assertEquals(result.iterator().next().getMethod(), ConservationMethod.SHENKIN);\r
List<Float> scores = result.iterator().next().getScores();\r
assertNotNull(scores);\r
assertEquals(scores.size(), 568);\r
import javax.jws.WebService;\r
\r
import compbio.data.sequence.FastaSequence;\r
+import compbio.data.sequence.SMERFSConstraints;\r
import compbio.data.sequence.Score;\r
import compbio.metadata.JobSubmissionException;\r
import compbio.metadata.LimitExceededException;\r
JobSubmissionException, WrongParameterException;\r
\r
/**\r
+ * \r
+ * Analyse the sequences. The actual analysis algorithm is defined by the\r
+ * type T.\r
+ * \r
+ * Any dataset containing a greater number of sequences or the average\r
+ * length of the sequences are greater then defined in the default Limit\r
+ * will not be accepted for an alignment operation and\r
+ * JobSubmissionException will be thrown.\r
+ * \r
+ * @param sequences\r
+ * List of FastaSequence objects. The programme does not perform\r
+ * any sequence validity checks. Nor does it checks whether the\r
+ * sequences names are unique. It is responsibility of the caller\r
+ * to validate this information\r
+ * @return jobId - unique identifier for the job\r
+ * @throws JobSubmissionException\r
+ * is thrown when the job could not be submitted due to the\r
+ * following reasons: 1) The number of sequences in the\r
+ * submission or their average length is greater then defined by\r
+ * the default Limit. 2) Any problems on the server side e.g. it\r
+ * is misconfigured or malfunction, is reported via this\r
+ * exception. In the first case the information on the limit\r
+ * could be obtained from an exception.\r
+ * @throws InvalidParameterException\r
+ * thrown if input list of fasta sequence is null or empty\r
+ * @throws UnsupportedRuntimeException\r
+ * thrown if server OS does not support native executables for a\r
+ * given web service, e.g. JABAWS is deployed on Windows and\r
+ * Mafft service is called\r
+ * @throws LimitExceededException\r
+ * is throw if the input sequences number or average length\r
+ * exceeds what is defined by the limit\r
+ */\r
+ @WebMethod\r
+ String customSMERFS(\r
+ @WebParam(name = "fastaSequences") List<FastaSequence> sequences,\r
+ int windowWidth, SMERFSConstraints scoringMethod,\r
+ float gapTreshold, boolean normalize)\r
+ throws UnsupportedRuntimeException, LimitExceededException,\r
+ JobSubmissionException;\r
+\r
+ /**\r
* Return the result of the job.\r
* \r
* @param jobId\r
\r
switch (this) {\r
case AAConWS :\r
-\r
return service.getPort(portName, Annotation.class);\r
\r
// deliberate leaking\r
\r
import compbio.data.msa.Annotation;\r
import compbio.data.sequence.FastaSequence;\r
+import compbio.data.sequence.SMERFSConstraints;\r
import compbio.data.sequence.Score;\r
import compbio.engine.AsyncExecutor;\r
import compbio.engine.Configurator;\r
return WSUtil.align(sequences, confAAcon, null, "presetAnalize", limit);\r
}\r
\r
+ @Override\r
+ public String customSMERFS(List<FastaSequence> sequences, int windowWidth,\r
+ SMERFSConstraints scoringMethod, float gapTreshold,\r
+ boolean normalize) throws UnsupportedRuntimeException,\r
+ LimitExceededException, JobSubmissionException {\r
+ // TODO Auto-generated method stub\r
+ return null;\r
+ }\r
+\r
}\r