* @version 1.0 September 2009\r
* \r
*/\r
-@XmlSeeAlso({JpredAlignment.class})\r
+//@XmlSeeAlso({JpredAlignment.class})\r
@XmlAccessorType(XmlAccessType.FIELD)\r
public class Alignment {\r
\r
* must include this copyright and license notice.\r
*/\r
\r
-package compbio.data.sequence;\r
-\r
-import java.util.List;\r
-import java.util.ArrayList;\r
-\r
-import javax.xml.bind.annotation.XmlAccessType;\r
-import javax.xml.bind.annotation.XmlAccessorType;\r
-\r
-import compbio.util.annotation.Immutable;\r
-import compbio.data.sequence.Alignment;\r
-/**\r
- * Multiple sequence alignment and Jpred prediction.\r
- * \r
- * Does not give any guarantees on the content of individual FastaSequece\r
- * records. It does not guarantee neither the uniqueness of the names of\r
- * sequences nor it guarantees the uniqueness of the sequences.\r
- * \r
- * @see FastaSequence\r
- * @see AlignmentMetadata\r
- * \r
- * @author pvtroshin\r
- * \r
- * @version 1.0 September 2009\r
- * \r
- */\r
-@XmlAccessorType(XmlAccessType.FIELD)\r
-public class JpredAlignment extends Alignment{\r
-\r
- private JpredAlignment() {\r
- // This has to has a default constructor for JaxB\r
- }\r
-\r
- /**\r
- * @param sequences\r
- * @param program\r
- * @param gapchar\r
- */\r
- public JpredAlignment(List<FastaSequence> sequences, Program program, char gapchar) {\r
- this.sequences = sequences;\r
- this.metadata = new AlignmentMetadata(Program.Jpred, gapchar);\r
- }\r
-\r
- /**\r
- * \r
- * @param sequences\r
- * @param metadata\r
- */\r
- public JpredAlignment(List<FastaSequence> sequences, AlignmentMetadata metadata) {\r
- this.sequences = sequences;\r
- this.metadata = metadata;\r
- }\r
-\r
- private List<FastaSequence> getRealSeqs() {\r
- List<FastaSequence> realsequences = new ArrayList<FastaSequence>();\r
- for (FastaSequence s : this.sequences) {\r
- if (s.getId().equals("jnetpred") || \r
- s.getId().equals("JNETCONF") ||\r
- s.getId().equals("JNETSOL25") ||\r
- s.getId().equals("JNETSOL5") ||\r
- s.getId().equals("JNETSOL0") ||\r
- s.getId().equals("JNETHMM") ||\r
- s.getId().equals("JNETHMM") ||\r
- s.getId().equals("JNETSOL0") ||\r
- s.getId().equals("JNETHMM")) {\r
- // do nothing;\r
- } else {\r
- realsequences.add(s);\r
- }\r
- }\r
- return realsequences;\r
- }\r
-\r
-\r
- public List<FastaSequence> getJpredSequences() {\r
- List<FastaSequence> realsequences = new ArrayList<FastaSequence>();\r
- for (FastaSequence s : this.sequences) {\r
- if (s.getId().equals("jnetpred") || \r
- s.getId().equals("JNETCONF") ||\r
- s.getId().equals("JNETSOL25") ||\r
- s.getId().equals("JNETSOL5") ||\r
- s.getId().equals("JNETSOL0") ||\r
- s.getId().equals("JNETHMM") ||\r
- s.getId().equals("JNETHMM") ||\r
- s.getId().equals("JNETSOL0") ||\r
- s.getId().equals("JNETSOL0") ||\r
- s.getId().equals("QUERY")) {\r
- realsequences.add(s);\r
- }\r
- }\r
- return realsequences;\r
- }\r
- /**\r
- * \r
- * @return Jpred prediction \r
- */\r
- public String getJpredPrediction() {\r
- for (FastaSequence s : this.sequences) {\r
- if (s.getId().equals("jnetpred")) {\r
- return s.getSequence();\r
- }\r
- }\r
- return new String("");\r
- }\r
-\r
- /**\r
- * \r
- * @return Jpred JNETSOL25 line\r
- */\r
- public String getJpredSOL25() {\r
- for (FastaSequence s : this.sequences) {\r
- if (s.getId().equals("JNETSOL25")) {\r
- return s.getSequence();\r
- }\r
- }\r
- return new String("");\r
- }\r
-\r
- /**\r
- * \r
- * @return Jpred JNETSOL5 line\r
- */\r
- public String getJpredSOL5() {\r
- for (FastaSequence s : this.sequences) {\r
- if (s.getId().equals("JNETSOL5")) {\r
- return s.getSequence();\r
- }\r
- }\r
- return new String("");\r
- }\r
- /**\r
- * \r
- * @return Jpred JNETSOL0 line\r
- */\r
- public String getJpredSOL0() {\r
- for (FastaSequence s : this.sequences) {\r
- if (s.getId().equals("JNETSOL0")) {\r
- return s.getSequence();\r
- }\r
- }\r
- return new String("");\r
- }\r
- /**\r
- * \r
- * @return Jpred JNETCONF line\r
- */\r
- public String getJpredJNETCONF() {\r
- for (FastaSequence s : this.sequences) {\r
- if (s.getId().equals("JNETCONF")) {\r
- return s.getSequence();\r
- }\r
- }\r
- return new String("");\r
- }\r
-\r
- /**\r
- * \r
- * @return list of FastaSequence records\r
- */\r
- @Override\r
- public List<FastaSequence> getSequences() {\r
- return this.getRealSeqs();\r
- }\r
-\r
- /**\r
- * \r
- * @return a number of sequence in the alignment\r
- */\r
- @Override\r
- public int getSize() {\r
- return this.getRealSeqs().size();\r
- }\r
-\r
- /**\r
- * Please note that this implementation does not take the order of sequences\r
- * into account!\r
- */\r
- @Override\r
- public boolean equals(Object obj) {\r
- if (obj == null) {\r
- return false;\r
- }\r
- if (!(obj instanceof JpredAlignment)) {\r
- return false;\r
- }\r
- JpredAlignment al = (JpredAlignment) obj;\r
- if (this.getSize() != al.getSize()) {\r
- return false;\r
- }\r
- if (!this.getMetadata().equals(al.getMetadata())) {\r
- return false;\r
- }\r
- int outerCounter = 0;\r
- int matchCounter = 0;\r
- for (FastaSequence fs : getSequences()) {\r
- outerCounter++;\r
- for (FastaSequence fs1 : al.getSequences()) {\r
- if (fs.equals(fs1)) {\r
- matchCounter++;\r
- continue;\r
- }\r
- }\r
- // Match for at lease one element was not found!\r
- if (outerCounter != matchCounter) {\r
- return false;\r
- }\r
- }\r
- return true;\r
- }\r
-\r
-}\r
+//package compbio.data.sequence;\r
+//\r
+//import java.util.List;\r
+//import java.util.ArrayList;\r
+//\r
+//import javax.xml.bind.annotation.XmlAccessType;\r
+//import javax.xml.bind.annotation.XmlAccessorType;\r
+//\r
+//import compbio.util.annotation.Immutable;\r
+//import compbio.data.sequence.Alignment;\r
+///**\r
+// * Multiple sequence alignment and Jpred prediction.\r
+// *\r
+// * Does not give any guarantees on the content of individual FastaSequece\r
+// * records. It does not guarantee neither the uniqueness of the names of\r
+// * sequences nor it guarantees the uniqueness of the sequences.\r
+// *\r
+// * @see FastaSequence\r
+// * @see AlignmentMetadata\r
+// *\r
+// * @author pvtroshin\r
+// *\r
+// * @version 1.0 September 2009\r
+// *\r
+// */\r
+//@XmlAccessorType(XmlAccessType.FIELD)\r
+//public class JpredAlignment extends Alignment{\r
+//\r
+// private JpredAlignment() {\r
+// // This has to has a default constructor for JaxB\r
+// }\r
+//\r
+// /**\r
+// * @param sequences\r
+// * @param program\r
+// * @param gapchar\r
+// */\r
+// public JpredAlignment(List<FastaSequence> sequences, Program program, char gapchar) {\r
+// this.sequences = sequences;\r
+// this.metadata = new AlignmentMetadata(Program.Jpred, gapchar);\r
+// }\r
+//\r
+// /**\r
+// *\r
+// * @param sequences\r
+// * @param metadata\r
+// */\r
+// public JpredAlignment(List<FastaSequence> sequences, AlignmentMetadata metadata) {\r
+// this.sequences = sequences;\r
+// this.metadata = metadata;\r
+// }\r
+//\r
+// private List<FastaSequence> getRealSeqs() {\r
+// List<FastaSequence> realsequences = new ArrayList<FastaSequence>();\r
+// for (FastaSequence s : this.sequences) {\r
+// if (s.getId().equals("jnetpred") ||\r
+// s.getId().equals("JNETCONF") ||\r
+// s.getId().equals("JNETSOL25") ||\r
+// s.getId().equals("JNETSOL5") ||\r
+// s.getId().equals("JNETSOL0") ||\r
+// s.getId().equals("JNETHMM") ||\r
+// s.getId().equals("JNETHMM") ||\r
+// s.getId().equals("JNETSOL0") ||\r
+// s.getId().equals("JNETHMM")) {\r
+// // do nothing;\r
+// } else {\r
+// realsequences.add(s);\r
+// }\r
+// }\r
+// return realsequences;\r
+// }\r
+//\r
+//\r
+// public List<FastaSequence> getJpredSequences() {\r
+// List<FastaSequence> realsequences = new ArrayList<FastaSequence>();\r
+// for (FastaSequence s : this.sequences) {\r
+// if (s.getId().equals("jnetpred") ||\r
+// s.getId().equals("JNETCONF") ||\r
+// s.getId().equals("JNETSOL25") ||\r
+// s.getId().equals("JNETSOL5") ||\r
+// s.getId().equals("JNETSOL0") ||\r
+// s.getId().equals("JNETHMM") ||\r
+// s.getId().equals("JNETHMM") ||\r
+// s.getId().equals("JNETSOL0") ||\r
+// s.getId().equals("JNETSOL0") ||\r
+// s.getId().equals("QUERY")) {\r
+// realsequences.add(s);\r
+// }\r
+// }\r
+// return realsequences;\r
+// }\r
+// /**\r
+// *\r
+// * @return Jpred prediction\r
+// */\r
+// public String getJpredPrediction() {\r
+// for (FastaSequence s : this.sequences) {\r
+// if (s.getId().equals("jnetpred")) {\r
+// return s.getSequence();\r
+// }\r
+// }\r
+// return new String("");\r
+// }\r
+//\r
+// /**\r
+// *\r
+// * @return Jpred JNETSOL25 line\r
+// */\r
+// public String getJpredSOL25() {\r
+// for (FastaSequence s : this.sequences) {\r
+// if (s.getId().equals("JNETSOL25")) {\r
+// return s.getSequence();\r
+// }\r
+// }\r
+// return new String("");\r
+// }\r
+//\r
+// /**\r
+// *\r
+// * @return Jpred JNETSOL5 line\r
+// */\r
+// public String getJpredSOL5() {\r
+// for (FastaSequence s : this.sequences) {\r
+// if (s.getId().equals("JNETSOL5")) {\r
+// return s.getSequence();\r
+// }\r
+// }\r
+// return new String("");\r
+// }\r
+// /**\r
+// *\r
+// * @return Jpred JNETSOL0 line\r
+// */\r
+// public String getJpredSOL0() {\r
+// for (FastaSequence s : this.sequences) {\r
+// if (s.getId().equals("JNETSOL0")) {\r
+// return s.getSequence();\r
+// }\r
+// }\r
+// return new String("");\r
+// }\r
+// /**\r
+// *\r
+// * @return Jpred JNETCONF line\r
+// */\r
+// public String getJpredJNETCONF() {\r
+// for (FastaSequence s : this.sequences) {\r
+// if (s.getId().equals("JNETCONF")) {\r
+// return s.getSequence();\r
+// }\r
+// }\r
+// return new String("");\r
+// }\r
+//\r
+// /**\r
+// *\r
+// * @return list of FastaSequence records\r
+// */\r
+// @Override\r
+// public List<FastaSequence> getSequences() {\r
+// return this.getRealSeqs();\r
+// }\r
+//\r
+// /**\r
+// *\r
+// * @return a number of sequence in the alignment\r
+// */\r
+// @Override\r
+// public int getSize() {\r
+// return this.getRealSeqs().size();\r
+// }\r
+//\r
+// /**\r
+// * Please note that this implementation does not take the order of sequences\r
+// * into account!\r
+// */\r
+// @Override\r
+// public boolean equals(Object obj) {\r
+// if (obj == null) {\r
+// return false;\r
+// }\r
+// if (!(obj instanceof JpredAlignment)) {\r
+// return false;\r
+// }\r
+// JpredAlignment al = (JpredAlignment) obj;\r
+// if (this.getSize() != al.getSize()) {\r
+// return false;\r
+// }\r
+// if (!this.getMetadata().equals(al.getMetadata())) {\r
+// return false;\r
+// }\r
+// int outerCounter = 0;\r
+// int matchCounter = 0;\r
+// for (FastaSequence fs : getSequences()) {\r
+// outerCounter++;\r
+// for (FastaSequence fs1 : al.getSequences()) {\r
+// if (fs.equals(fs1)) {\r
+// matchCounter++;\r
+// continue;\r
+// }\r
+// }\r
+// // Match for at lease one element was not found!\r
+// if (outerCounter != matchCounter) {\r
+// return false;\r
+// }\r
+// }\r
+// return true;\r
+// }\r
+//\r
+//}\r
/**\r
* Jpred\r
*/\r
- Jpred\r
+// Jpred\r
}\r
}\r
\r
\r
- public static final List<FastaSequence> readJpredFile(InputStream result)\r
- throws IOException, FileNotFoundException,NullPointerException {\r
- return readFasta (result);\r
- }\r
+// public static final List<FastaSequence> readJpredFile(InputStream result)\r
+// throws IOException, FileNotFoundException,NullPointerException {\r
+// return readFasta (result);\r
+// }\r
\r
/**\r
* Read IUPred output\r
* must include this copyright and license notice.\r
*/\r
\r
-package compbio.runner.predictors;\r
-\r
-import java.io.File;\r
-import java.io.FileInputStream;\r
-import java.io.FileNotFoundException;\r
-import java.io.IOException;\r
-import java.io.InputStream;\r
-import java.util.Arrays;\r
-import java.util.List;\r
-\r
-import org.apache.log4j.Logger;\r
-\r
-import compbio.data.sequence.JpredAlignment;\r
-import compbio.data.sequence.AlignmentMetadata;\r
-import compbio.data.sequence.Program;\r
-import compbio.data.sequence.SequenceUtil;\r
-import compbio.engine.client.CommandBuilder;\r
-import compbio.engine.client.Executable;\r
-import compbio.engine.client.SkeletalExecutable;\r
-import compbio.metadata.ResultNotAvailableException;\r
-\r
-/**\r
- * Command line\r
- * \r
- * jpred.pl -in d16vpa_.fas -outfile res_d16vpa_ -dbname ported_db -dbpath\r
- * /data/UNIREFdb -ncpu 4\r
- * \r
- * @author asherstnev\r
- * \r
- */\r
-public class Jpred extends SkeletalExecutable<Jpred> {\r
-\r
- private static Logger log = Logger.getLogger(Jpred.class);\r
-\r
- /**\r
- * Number of cores to use, defaults to 1 for local execution or the value of\r
- * "jpred.cluster.cpunum" property for cluster execution\r
- */\r
- private int ncoreNumber = 0;\r
-\r
- public static final String KEY_VALUE_SEPARATOR = " ";\r
- public static final String STAT_FILE = "stat.txt";\r
-\r
- public Jpred() {\r
- String dbpath = ph.getProperty("jpred.data.uniref.path");\r
- String dbname = ph.getProperty("jpred.data.uniref.name");\r
- addParameters(Arrays.asList("-logfile " + STAT_FILE));\r
- addParameters(Arrays.asList("-dbpath " + dbpath));\r
- addParameters(Arrays.asList("-dbname " + dbname));\r
- addParameters(Arrays.asList("-jabaws"));\r
- }\r
-\r
- // HashMap<Method, float[]>\r
- @SuppressWarnings("unchecked")\r
- @Override\r
- public JpredAlignment getResults(String workDirectory) throws ResultNotAvailableException {\r
- JpredAlignment annotations = null;\r
- try {\r
- InputStream inStream = new FileInputStream(new File(workDirectory, getOutput()));\r
- annotations = new JpredAlignment(SequenceUtil.readJpredFile(inStream), new AlignmentMetadata(Program.Jpred, '-'));\r
- } catch (FileNotFoundException e) {\r
- log.error(e.getMessage(), e.getCause());\r
- throw new ResultNotAvailableException(e);\r
- } catch (IOException e) {\r
- log.error(e.getMessage(), e.getCause());\r
- throw new ResultNotAvailableException(e);\r
- } catch (NullPointerException e) {\r
- log.error(e.getMessage(), e.getCause());\r
- throw new ResultNotAvailableException(e);\r
- }\r
- return annotations;\r
- }\r
-\r
- @Override\r
- public List<String> getCreatedFiles() {\r
- return Arrays.asList(getOutput(), getError());\r
- }\r
-\r
- @Override\r
- public Jpred setInput(String inFile) {\r
- super.setInput(inFile);\r
- cbuilder.setParam("-in " + inFile);\r
- return this;\r
- }\r
-\r
- @Override\r
- public Jpred setOutput(String outFile) {\r
- super.setOutput(outFile);\r
- cbuilder.setParam("-outfile " + outFile);\r
- return this;\r
- }\r
-\r
- @SuppressWarnings("unchecked")\r
- @Override\r
- public Class<Jpred> getType() {\r
- return (Class<Jpred>) this.getClass();\r
- }\r
-\r
- public static String getStatFile() {\r
- return STAT_FILE;\r
- }\r
-\r
- public void setNCore(int ncoreNumber) {\r
- if (0 < ncoreNumber && ncoreNumber < 9) {\r
- this.ncoreNumber = ncoreNumber;\r
- cbuilder.setParam("-ncpu " + Integer.toString(getNCore()));\r
- } else {\r
- throw new IndexOutOfBoundsException("Number of cores must be between 1 and 8 ");\r
- }\r
- }\r
-\r
- int getNCore() {\r
- return ncoreNumber;\r
- }\r
-\r
- @Override\r
- public CommandBuilder<Jpred> getParameters(ExecProvider provider) {\r
- // If number of cores is provided, set it for the cluster execution\r
- // only!\r
- if (provider == Executable.ExecProvider.Cluster) {\r
- int cpunum = SkeletalExecutable.getClusterCpuNum(getType());\r
- cpunum = (cpunum == 0) ? 1 : cpunum;\r
- setNCore(cpunum);\r
- } else {\r
- // Limit number of cores to 1 for ANY execution which does not set\r
- // Ncores explicitly using setNCore method or is run on local VM\r
- if (ncoreNumber == 0) {\r
- setNCore(1);\r
- }\r
- }\r
- return super.getParameters(provider);\r
- }\r
-\r
-}\r
+//package compbio.runner.predictors;\r
+//\r
+//import java.io.File;\r
+//import java.io.FileInputStream;\r
+//import java.io.FileNotFoundException;\r
+//import java.io.IOException;\r
+//import java.io.InputStream;\r
+//import java.util.Arrays;\r
+//import java.util.List;\r
+//\r
+//import org.apache.log4j.Logger;\r
+//\r
+//import compbio.data.sequence.JpredAlignment;\r
+//import compbio.data.sequence.AlignmentMetadata;\r
+//import compbio.data.sequence.Program;\r
+//import compbio.data.sequence.SequenceUtil;\r
+//import compbio.engine.client.CommandBuilder;\r
+//import compbio.engine.client.Executable;\r
+//import compbio.engine.client.SkeletalExecutable;\r
+//import compbio.metadata.ResultNotAvailableException;\r
+//\r
+///**\r
+// * Command line\r
+// *\r
+// * jpred.pl -in d16vpa_.fas -outfile res_d16vpa_ -dbname ported_db -dbpath\r
+// * /data/UNIREFdb -ncpu 4\r
+// *\r
+// * @author asherstnev\r
+// *\r
+// */\r
+//public class Jpred extends SkeletalExecutable<Jpred> {\r
+//\r
+// private static Logger log = Logger.getLogger(Jpred.class);\r
+//\r
+// /**\r
+// * Number of cores to use, defaults to 1 for local execution or the value of\r
+// * "jpred.cluster.cpunum" property for cluster execution\r
+// */\r
+// private int ncoreNumber = 0;\r
+//\r
+// public static final String KEY_VALUE_SEPARATOR = " ";\r
+// public static final String STAT_FILE = "stat.txt";\r
+//\r
+// public Jpred() {\r
+// String dbpath = ph.getProperty("jpred.data.uniref.path");\r
+// String dbname = ph.getProperty("jpred.data.uniref.name");\r
+// addParameters(Arrays.asList("-logfile " + STAT_FILE));\r
+// addParameters(Arrays.asList("-dbpath " + dbpath));\r
+// addParameters(Arrays.asList("-dbname " + dbname));\r
+// addParameters(Arrays.asList("-jabaws"));\r
+// }\r
+//\r
+// // HashMap<Method, float[]>\r
+// @SuppressWarnings("unchecked")\r
+// @Override\r
+// public JpredAlignment getResults(String workDirectory) throws ResultNotAvailableException {\r
+// JpredAlignment annotations = null;\r
+// try {\r
+// InputStream inStream = new FileInputStream(new File(workDirectory, getOutput()));\r
+// annotations = new JpredAlignment(SequenceUtil.readJpredFile(inStream), new AlignmentMetadata(Program.Jpred, '-'));\r
+// } catch (FileNotFoundException e) {\r
+// log.error(e.getMessage(), e.getCause());\r
+// throw new ResultNotAvailableException(e);\r
+// } catch (IOException e) {\r
+// log.error(e.getMessage(), e.getCause());\r
+// throw new ResultNotAvailableException(e);\r
+// } catch (NullPointerException e) {\r
+// log.error(e.getMessage(), e.getCause());\r
+// throw new ResultNotAvailableException(e);\r
+// }\r
+// return annotations;\r
+// }\r
+//\r
+// @Override\r
+// public List<String> getCreatedFiles() {\r
+// return Arrays.asList(getOutput(), getError());\r
+// }\r
+//\r
+// @Override\r
+// public Jpred setInput(String inFile) {\r
+// super.setInput(inFile);\r
+// cbuilder.setParam("-in " + inFile);\r
+// return this;\r
+// }\r
+//\r
+// @Override\r
+// public Jpred setOutput(String outFile) {\r
+// super.setOutput(outFile);\r
+// cbuilder.setParam("-outfile " + outFile);\r
+// return this;\r
+// }\r
+//\r
+// @SuppressWarnings("unchecked")\r
+// @Override\r
+// public Class<Jpred> getType() {\r
+// return (Class<Jpred>) this.getClass();\r
+// }\r
+//\r
+// public static String getStatFile() {\r
+// return STAT_FILE;\r
+// }\r
+//\r
+// public void setNCore(int ncoreNumber) {\r
+// if (0 < ncoreNumber && ncoreNumber < 9) {\r
+// this.ncoreNumber = ncoreNumber;\r
+// cbuilder.setParam("-ncpu " + Integer.toString(getNCore()));\r
+// } else {\r
+// throw new IndexOutOfBoundsException("Number of cores must be between 1 and 8 ");\r
+// }\r
+// }\r
+//\r
+// int getNCore() {\r
+// return ncoreNumber;\r
+// }\r
+//\r
+// @Override\r
+// public CommandBuilder<Jpred> getParameters(ExecProvider provider) {\r
+// // If number of cores is provided, set it for the cluster execution\r
+// // only!\r
+// if (provider == Executable.ExecProvider.Cluster) {\r
+// int cpunum = SkeletalExecutable.getClusterCpuNum(getType());\r
+// cpunum = (cpunum == 0) ? 1 : cpunum;\r
+// setNCore(cpunum);\r
+// } else {\r
+// // Limit number of cores to 1 for ANY execution which does not set\r
+// // Ncores explicitly using setNCore method or is run on local VM\r
+// if (ncoreNumber == 0) {\r
+// setNCore(1);\r
+// }\r
+// }\r
+// return super.getParameters(provider);\r
+// }\r
+//\r
+//}\r
fail(e.getMessage());\r
}\r
}\r
- @Test\r
- public void ReadJpredResults() {\r
- try {\r
- InputStream inStream = new FileInputStream(AllTestSuit.TEST_DATA_PATH + "Jpred.test1.out");\r
- List<FastaSequence> result = SequenceUtil.readJpredFile(inStream);\r
- inStream.close();\r
- assertNotNull(result);\r
- assertEquals(result.size(), 19);\r
- } catch (IOException e) {\r
- e.printStackTrace();\r
- fail(e.getMessage());\r
- }\r
- }\r
+// @Test\r
+// public void ReadJpredResults() {\r
+// try {\r
+// InputStream inStream = new FileInputStream(AllTestSuit.TEST_DATA_PATH + "Jpred.test1.out");\r
+// List<FastaSequence> result = SequenceUtil.readJpredFile(inStream);\r
+// inStream.close();\r
+// assertNotNull(result);\r
+// assertEquals(result.size(), 19);\r
+// } catch (IOException e) {\r
+// e.printStackTrace();\r
+// fail(e.getMessage());\r
+// }\r
+// }\r
}\r
\r
import compbio.metadata.ResultNotAvailableException;\r
import compbio.metadata.RunnerConfig;\r
import compbio.runner.msa.Tcoffee;\r
-import compbio.runner.predictors.Jpred;\r
+//import compbio.runner.predictors.Jpred;\r
import compbio.util.FileWatcher;\r
import compbio.util.SysPrefs;\r
\r
* Any republication or derived work distributed in source code form must include \r
* this copyright and license notice.\r
*/\r
-package compbio.runner.predictors;\r
-\r
-import static org.testng.Assert.assertEquals;\r
-import static org.testng.Assert.assertFalse;\r
-import static org.testng.Assert.assertNotNull;\r
-import static org.testng.Assert.assertTrue;\r
-import static org.testng.Assert.fail;\r
-\r
-import java.io.File;\r
-import java.io.FileInputStream;\r
-import java.io.FileNotFoundException;\r
-import java.io.IOException;\r
-import java.text.ParseException;\r
-import java.util.Arrays;\r
-\r
-import javax.xml.bind.ValidationException;\r
-\r
-import org.ggf.drmaa.DrmaaException;\r
-import org.ggf.drmaa.JobInfo;\r
-import org.testng.annotations.BeforeMethod;\r
-import org.testng.annotations.Test;\r
-\r
-import compbio.data.sequence.JpredAlignment;\r
-import compbio.engine.AsyncExecutor;\r
-import compbio.engine.Configurator;\r
-import compbio.engine.FilePuller;\r
-import compbio.engine.SyncExecutor;\r
-import compbio.engine.client.ConfExecutable;\r
-import compbio.engine.client.ConfiguredExecutable;\r
-import compbio.engine.client.Executable;\r
-import compbio.engine.client.RunConfiguration;\r
-import compbio.engine.cluster.drmaa.ClusterEngineUtil;\r
-import compbio.engine.cluster.drmaa.ClusterRunner;\r
-import compbio.engine.cluster.drmaa.StatisticManager;\r
-import compbio.engine.local.LocalRunner;\r
-import compbio.metadata.AllTestSuit;\r
-import compbio.metadata.ChunkHolder;\r
-import compbio.metadata.JobExecutionException;\r
-import compbio.metadata.JobStatus;\r
-import compbio.metadata.JobSubmissionException;\r
-import compbio.metadata.LimitsManager;\r
-import compbio.metadata.Preset;\r
-import compbio.metadata.PresetManager;\r
-import compbio.metadata.ResultNotAvailableException;\r
-import compbio.metadata.RunnerConfig;\r
-import compbio.runner.RunnerUtil;\r
-import compbio.util.FileWatcher;\r
-import compbio.util.SysPrefs;\r
-\r
-public class JpredTester {\r
-\r
- public static final String CURRENT_DIRECTORY = SysPrefs.getCurrentDirectory() + File.separator;\r
-\r
- public static String test_output = "Jpred.test1.out";\r
- public static String test_input = CURRENT_DIRECTORY + "testsrc" + File.separator + "testdata" + File.separator + "Jpred.test1.fasta";\r
- private Jpred pred;\r
-\r
- @BeforeMethod(alwaysRun = true)\r
- void init() {\r
- pred = new Jpred();\r
- pred.setInput(test_input);\r
- pred.setOutput(test_output);\r
- }\r
-\r
- // disabled\r
- @Test(enabled=false,groups = {AllTestSuit.test_group_runner})\r
- public void RunOnCluster() {\r
- assertFalse(SysPrefs.isWindows, "Cluster execution can only be in unix environment");\r
- try {\r
- PresetManager<Jpred> jpredPreset = RunnerUtil.getPresets(Jpred.class);\r
- assert jpredPreset != null;\r
- ConfiguredExecutable<Jpred> confpred = Configurator.configureExecutable(pred, Executable.ExecProvider.Cluster);\r
- Preset<Jpred> conf = jpredPreset.getPresetByName("cluster configuration");\r
- confpred.addParameters(conf.getOptions());\r
- ClusterRunner runner = ClusterRunner.getInstance(confpred);\r
- assertNotNull(runner, "Runner is NULL");\r
-\r
- runner.executeJob();\r
- JobStatus status = runner.getJobStatus();\r
- assertTrue(status == JobStatus.PENDING || status == JobStatus.RUNNING, "Status of the process is wrong!");\r
- JobInfo info = runner.getJobInfo();\r
- assertNotNull(info, "JobInfo is null");\r
- StatisticManager sm = new StatisticManager(info);\r
- assertNotNull(sm, "Statistic manager is null");\r
- try {\r
- String exits = sm.getExitStatus();\r
- assertNotNull("Exit status is null", exits);\r
- // cut 4 trailing zeros from the number\r
- int exitsInt = ClusterEngineUtil.CLUSTER_STAT_IN_SEC.parse(exits).intValue();\r
- assertEquals(0, exitsInt);\r
- System.out.println(sm.getAllStats());\r
- } catch (ParseException e) {\r
- e.printStackTrace();\r
- fail("Parse Exception: " + e.getMessage());\r
- }\r
- assertTrue(sm.hasExited());\r
- assertFalse(sm.wasAborted());\r
- assertFalse(sm.hasDump());\r
- assertFalse(sm.hasSignaled());\r
-\r
- } catch (JobSubmissionException e) {\r
- e.printStackTrace();\r
- fail("DrmaaException caught:" + e.getMessage());\r
- } catch (JobExecutionException e) {\r
- e.printStackTrace();\r
- fail("DrmaaException caught:" + e.getMessage());\r
- } catch (DrmaaException e) {\r
- e.printStackTrace();\r
- fail("DrmaaException caught:" + e.getMessage());\r
- }\r
- }\r
-\r
- // disabled\r
- @Test(enabled=false,groups = {AllTestSuit.test_group_runner, AllTestSuit.test_group_cluster})\r
- public void RunOnClusterAsync() {\r
- assertFalse(SysPrefs.isWindows, "Cluster execution can only be in unix environment");\r
- try {\r
- pred.addParameters(Arrays.asList("-dbname uniref90", "-dbpath /homes/www-jpred/databases/"));\r
- ConfiguredExecutable<Jpred> confpred = Configurator.configureExecutable(pred, Executable.ExecProvider.Cluster);\r
- AsyncExecutor aengine = Configurator.getAsyncEngine(confpred);\r
- String jobId = aengine.submitJob(confpred);\r
- assertNotNull(jobId, "Runner is NULL");\r
- // let drmaa to start\r
- Thread.sleep(500);\r
- JobStatus status = aengine.getJobStatus(jobId);\r
- while (status != JobStatus.FINISHED) {\r
- Thread.sleep(1000);\r
- status = aengine.getJobStatus(jobId);\r
- ConfiguredExecutable<Jpred> result = (ConfiguredExecutable<Jpred>) aengine.getResults(jobId);\r
- assertNotNull(result);\r
- if (status == JobStatus.UNDEFINED || status == JobStatus.FAILED) {\r
- fail("job " + jobId +" failed!");\r
- break;\r
- }\r
- }\r
- } catch (JobSubmissionException e) {\r
- e.printStackTrace();\r
- fail("DrmaaException caught:" + e.getMessage());\r
- } catch (InterruptedException e) {\r
- e.printStackTrace();\r
- fail(e.getMessage());\r
- } catch (ResultNotAvailableException e) {\r
- e.printStackTrace();\r
- fail(e.getMessage());\r
- }\r
- }\r
-\r
- @Test(groups = {AllTestSuit.test_group_runner})\r
- public void RunLocally() {\r
- try {\r
- ConfiguredExecutable<Jpred> confpred = Configurator.configureExecutable(pred, Executable.ExecProvider.Local);\r
- confpred.addParameters(Arrays.asList("-dbname ported_db", "-dbpath /data/UNIREFdb/"));\r
-\r
- // For local execution use relative\r
- LocalRunner lr = new LocalRunner(confpred);\r
- lr.executeJob();\r
- ConfiguredExecutable<?> al1 = lr.waitForResult();\r
- assertNotNull(al1.getResults());\r
- JpredAlignment totalign = (JpredAlignment) confpred.getResults();\r
- assertNotNull(totalign);\r
- assertEquals(totalign.getSize(), 14);\r
- assertEquals(al1.getResults(), totalign);\r
- } catch (JobSubmissionException e) {\r
- e.printStackTrace();\r
- fail(e.getLocalizedMessage());\r
- } catch (ResultNotAvailableException e) {\r
- e.printStackTrace();\r
- fail(e.getLocalizedMessage());\r
- } catch (JobExecutionException e) {\r
- e.printStackTrace();\r
- fail(e.getLocalizedMessage());\r
- }\r
- }\r
-\r
- @Test(enabled=false,groups = {AllTestSuit.test_group_runner})\r
- public void RunLocallyWithPreset() {\r
- try {\r
- ConfiguredExecutable<Jpred> confpred = Configurator.configureExecutable(pred, Executable.ExecProvider.Local);\r
- PresetManager<Jpred> preset = RunnerUtil.getPresets(Jpred.class);\r
- assert preset != null;\r
- Preset<Jpred> conf = preset.getPresetByName("laptop configuration");\r
- confpred.addParameters(conf.getOptions());\r
-\r
- // For local execution use relative\r
- LocalRunner lr = new LocalRunner(confpred);\r
- lr.executeJob();\r
- ConfiguredExecutable<?> al1 = lr.waitForResult();\r
- assertNotNull(al1.getResults());\r
- JpredAlignment totalign = (JpredAlignment) confpred.getResults();\r
- assertNotNull(totalign);\r
- assertEquals(totalign.getSize(), 19);\r
- assertEquals(al1.getResults(), totalign);\r
- } catch (JobSubmissionException e) {\r
- e.printStackTrace();\r
- fail(e.getLocalizedMessage());\r
- } catch (ResultNotAvailableException e) {\r
- e.printStackTrace();\r
- fail(e.getLocalizedMessage());\r
- } catch (JobExecutionException e) {\r
- e.printStackTrace();\r
- fail(e.getLocalizedMessage());\r
- }\r
- }\r
- \r
- @Test(enabled=false,groups = {AllTestSuit.test_group_runner})\r
- public void readStatistics() {\r
- try {\r
- Jpred jpred = new Jpred();\r
- jpred.setInput(test_input);\r
- jpred.setOutput(test_output);\r
- ConfiguredExecutable<Jpred> confpred = Configurator.configureExecutable(jpred, Executable.ExecProvider.Local);\r
- PresetManager<Jpred> preset = RunnerUtil.getPresets(Jpred.class);\r
- assert preset != null;\r
- Preset<Jpred> conf = preset.getPresetByName("laptop configuration");\r
- confpred.addParameters(conf.getOptions());\r
-\r
- // For local execution use relative\r
- AsyncExecutor sexec = Configurator.getAsyncEngine(confpred);\r
- String jobId = sexec.submitJob(confpred);\r
- String file = confpred.getWorkDirectory() + File.separator + Jpred.getStatFile();\r
- FilePuller fw = FilePuller.newFilePuller(file, FileWatcher.MIN_CHUNK_SIZE_BYTES);\r
- int count = 0;\r
- long position = 0;\r
- fw.waitForFile(2);\r
- JobStatus status = sexec.getJobStatus(jobId);\r
- do {\r
- if (fw.hasMoreData()) {\r
- ChunkHolder ch = fw.pull(position);\r
- String chunk = ch.getChunk();\r
- position = ch.getNextPosition();\r
- }\r
- count++;\r
- // Make sure the loop is terminated if the job fails\r
- if ((status == JobStatus.UNDEFINED || status == JobStatus.FAILED)) {\r
- fail("job " + jobId +" failed!");\r
- break;\r
- }\r
- Thread.sleep(200);\r
- status = sexec.getJobStatus(jobId);\r
- } while (status != JobStatus.FINISHED || fw.hasMoreData());\r
-\r
- assertTrue(count >= 1);\r
- ConfiguredExecutable<?> al = sexec.getResults(jobId);\r
- assertNotNull(al.getResults());\r
- } catch (JobSubmissionException e) {\r
- e.printStackTrace();\r
- fail(e.getMessage());\r
- } catch (ResultNotAvailableException e) {\r
- e.printStackTrace();\r
- fail(e.getMessage());\r
- } catch (IOException e) {\r
- e.printStackTrace();\r
- fail(e.getMessage());\r
- } catch (InterruptedException e) {\r
- e.printStackTrace();\r
- fail(e.getMessage());\r
- }\r
- }\r
-\r
- @Test(enabled=false,groups = {AllTestSuit.test_group_runner})\r
- public void Persistance() {\r
- try {\r
- Jpred jpred = new Jpred();\r
- jpred.setError("errrr.txt");\r
- jpred.setInput(test_input);\r
- jpred.setOutput("outtt.txt");\r
- assertEquals(jpred.getInput(), test_input);\r
- assertEquals(jpred.getError(), "errrr.txt");\r
- assertEquals(jpred.getOutput(), "outtt.txt");\r
- ConfiguredExecutable<Jpred> confpred = Configurator.configureExecutable(jpred, Executable.ExecProvider.Local);\r
- confpred.addParameters(Arrays.asList("-dbname ported_db", "-dbpath /data/UNIREFdb/"));\r
-\r
- SyncExecutor sexec = Configurator.getSyncEngine(confpred);\r
- sexec.executeJob();\r
- ConfiguredExecutable<?> al = sexec.waitForResult();\r
- assertNotNull(al.getResults());\r
-\r
- // Save run configuration\r
- assertTrue(confpred.saveRunConfiguration());\r
-\r
- // See if loaded configuration is the same as saved\r
- RunConfiguration loadedRun = RunConfiguration.load(new FileInputStream(new File(confpred.getWorkDirectory(), RunConfiguration.rconfigFile)));\r
- assertEquals(((ConfExecutable<Jpred>) confpred).getRunConfiguration(),loadedRun);\r
-\r
- // Load run configuration as ConfExecutable\r
- ConfiguredExecutable<Jpred> jpred2 = (ConfiguredExecutable<Jpred>) confpred.loadRunConfiguration(new FileInputStream(new File(confpred.getWorkDirectory(), RunConfiguration.rconfigFile)));\r
- assertNotNull(jpred2);\r
- assertEquals(jpred2.getExecutable().getInput(), test_input);\r
- assertEquals(jpred2.getExecutable().getError(), "errrr.txt");\r
- assertEquals(jpred2.getExecutable().getOutput(), "outtt.txt");\r
-\r
- // See in details whether executables are the same\r
- assertEquals(jpred2.getExecutable(), jpred);\r
- ConfiguredExecutable<Jpred> resjpred2 = Configurator.configureExecutable(jpred2.getExecutable(), Executable.ExecProvider.Local);\r
-\r
- sexec = Configurator.getSyncEngine(resjpred2, Executable.ExecProvider.Local);\r
- sexec.executeJob();\r
- al = sexec.waitForResult();\r
- assertNotNull(al);\r
- } catch (JobSubmissionException e) {\r
- e.printStackTrace();\r
- fail(e.getMessage());\r
- } catch (JobExecutionException e) {\r
- e.printStackTrace();\r
- fail(e.getMessage());\r
- } catch (FileNotFoundException e) {\r
- e.printStackTrace();\r
- fail(e.getMessage());\r
- } catch (IOException e) {\r
- e.printStackTrace();\r
- fail(e.getMessage());\r
- } catch (ResultNotAvailableException e) {\r
- e.printStackTrace();\r
- fail(e.getMessage());\r
- }\r
- }\r
-\r
- @Test(enabled=false,groups = {AllTestSuit.test_group_runner})\r
- public void ConfigurationLoading() {\r
- try {\r
- RunnerConfig<Jpred> jpredConfig = ConfExecutable.getRunnerOptions(Jpred.class);\r
- assertNotNull(jpredConfig);\r
- assertTrue(jpredConfig.getArguments().size() > 0);\r
-\r
- PresetManager<Jpred> jpredPreset = ConfExecutable.getRunnerPresets(Jpred.class);\r
- assertNotNull(jpredPreset);\r
-\r
- LimitsManager<Jpred> jpredLimits = ConfExecutable.getRunnerLimits(Jpred.class);\r
- assertNotNull(jpredLimits);\r
- assertTrue(jpredLimits.getLimits().size() > 0);\r
- jpredLimits.validate(jpredPreset);\r
- } catch (FileNotFoundException e) {\r
- e.printStackTrace();\r
- fail(e.getLocalizedMessage());\r
- } catch (IOException e) {\r
- e.printStackTrace();\r
- fail(e.getLocalizedMessage());\r
- } catch (ValidationException e) {\r
- e.printStackTrace();\r
- fail(e.getLocalizedMessage());\r
- }\r
- }\r
-\r
-}\r
+//package compbio.runner.predictors;\r
+//\r
+//import static org.testng.Assert.assertEquals;\r
+//import static org.testng.Assert.assertFalse;\r
+//import static org.testng.Assert.assertNotNull;\r
+//import static org.testng.Assert.assertTrue;\r
+//import static org.testng.Assert.fail;\r
+//\r
+//import java.io.File;\r
+//import java.io.FileInputStream;\r
+//import java.io.FileNotFoundException;\r
+//import java.io.IOException;\r
+//import java.text.ParseException;\r
+//import java.util.Arrays;\r
+//\r
+//import javax.xml.bind.ValidationException;\r
+//\r
+//import org.ggf.drmaa.DrmaaException;\r
+//import org.ggf.drmaa.JobInfo;\r
+//import org.testng.annotations.BeforeMethod;\r
+//import org.testng.annotations.Test;\r
+//\r
+//import compbio.data.sequence.JpredAlignment;\r
+//import compbio.engine.AsyncExecutor;\r
+//import compbio.engine.Configurator;\r
+//import compbio.engine.FilePuller;\r
+//import compbio.engine.SyncExecutor;\r
+//import compbio.engine.client.ConfExecutable;\r
+//import compbio.engine.client.ConfiguredExecutable;\r
+//import compbio.engine.client.Executable;\r
+//import compbio.engine.client.RunConfiguration;\r
+//import compbio.engine.cluster.drmaa.ClusterEngineUtil;\r
+//import compbio.engine.cluster.drmaa.ClusterRunner;\r
+//import compbio.engine.cluster.drmaa.StatisticManager;\r
+//import compbio.engine.local.LocalRunner;\r
+//import compbio.metadata.AllTestSuit;\r
+//import compbio.metadata.ChunkHolder;\r
+//import compbio.metadata.JobExecutionException;\r
+//import compbio.metadata.JobStatus;\r
+//import compbio.metadata.JobSubmissionException;\r
+//import compbio.metadata.LimitsManager;\r
+//import compbio.metadata.Preset;\r
+//import compbio.metadata.PresetManager;\r
+//import compbio.metadata.ResultNotAvailableException;\r
+//import compbio.metadata.RunnerConfig;\r
+//import compbio.runner.RunnerUtil;\r
+//import compbio.util.FileWatcher;\r
+//import compbio.util.SysPrefs;\r
+//\r
+//public class JpredTester {\r
+//\r
+// public static final String CURRENT_DIRECTORY = SysPrefs.getCurrentDirectory() + File.separator;\r
+//\r
+// public static String test_output = "Jpred.test1.out";\r
+// public static String test_input = CURRENT_DIRECTORY + "testsrc" + File.separator + "testdata" + File.separator + "Jpred.test1.fasta";\r
+// private Jpred pred;\r
+//\r
+// @BeforeMethod(alwaysRun = true)\r
+// void init() {\r
+// pred = new Jpred();\r
+// pred.setInput(test_input);\r
+// pred.setOutput(test_output);\r
+// }\r
+//\r
+// // disabled\r
+// @Test(enabled=false,groups = {AllTestSuit.test_group_runner})\r
+// public void RunOnCluster() {\r
+// assertFalse(SysPrefs.isWindows, "Cluster execution can only be in unix environment");\r
+// try {\r
+// PresetManager<Jpred> jpredPreset = RunnerUtil.getPresets(Jpred.class);\r
+// assert jpredPreset != null;\r
+// ConfiguredExecutable<Jpred> confpred = Configurator.configureExecutable(pred, Executable.ExecProvider.Cluster);\r
+// Preset<Jpred> conf = jpredPreset.getPresetByName("cluster configuration");\r
+// confpred.addParameters(conf.getOptions());\r
+// ClusterRunner runner = ClusterRunner.getInstance(confpred);\r
+// assertNotNull(runner, "Runner is NULL");\r
+//\r
+// runner.executeJob();\r
+// JobStatus status = runner.getJobStatus();\r
+// assertTrue(status == JobStatus.PENDING || status == JobStatus.RUNNING, "Status of the process is wrong!");\r
+// JobInfo info = runner.getJobInfo();\r
+// assertNotNull(info, "JobInfo is null");\r
+// StatisticManager sm = new StatisticManager(info);\r
+// assertNotNull(sm, "Statistic manager is null");\r
+// try {\r
+// String exits = sm.getExitStatus();\r
+// assertNotNull("Exit status is null", exits);\r
+// // cut 4 trailing zeros from the number\r
+// int exitsInt = ClusterEngineUtil.CLUSTER_STAT_IN_SEC.parse(exits).intValue();\r
+// assertEquals(0, exitsInt);\r
+// System.out.println(sm.getAllStats());\r
+// } catch (ParseException e) {\r
+// e.printStackTrace();\r
+// fail("Parse Exception: " + e.getMessage());\r
+// }\r
+// assertTrue(sm.hasExited());\r
+// assertFalse(sm.wasAborted());\r
+// assertFalse(sm.hasDump());\r
+// assertFalse(sm.hasSignaled());\r
+//\r
+// } catch (JobSubmissionException e) {\r
+// e.printStackTrace();\r
+// fail("DrmaaException caught:" + e.getMessage());\r
+// } catch (JobExecutionException e) {\r
+// e.printStackTrace();\r
+// fail("DrmaaException caught:" + e.getMessage());\r
+// } catch (DrmaaException e) {\r
+// e.printStackTrace();\r
+// fail("DrmaaException caught:" + e.getMessage());\r
+// }\r
+// }\r
+//\r
+// // disabled\r
+// @Test(enabled=false,groups = {AllTestSuit.test_group_runner, AllTestSuit.test_group_cluster})\r
+// public void RunOnClusterAsync() {\r
+// assertFalse(SysPrefs.isWindows, "Cluster execution can only be in unix environment");\r
+// try {\r
+// pred.addParameters(Arrays.asList("-dbname uniref90", "-dbpath /homes/www-jpred/databases/"));\r
+// ConfiguredExecutable<Jpred> confpred = Configurator.configureExecutable(pred, Executable.ExecProvider.Cluster);\r
+// AsyncExecutor aengine = Configurator.getAsyncEngine(confpred);\r
+// String jobId = aengine.submitJob(confpred);\r
+// assertNotNull(jobId, "Runner is NULL");\r
+// // let drmaa to start\r
+// Thread.sleep(500);\r
+// JobStatus status = aengine.getJobStatus(jobId);\r
+// while (status != JobStatus.FINISHED) {\r
+// Thread.sleep(1000);\r
+// status = aengine.getJobStatus(jobId);\r
+// ConfiguredExecutable<Jpred> result = (ConfiguredExecutable<Jpred>) aengine.getResults(jobId);\r
+// assertNotNull(result);\r
+// if (status == JobStatus.UNDEFINED || status == JobStatus.FAILED) {\r
+// fail("job " + jobId +" failed!");\r
+// break;\r
+// }\r
+// }\r
+// } catch (JobSubmissionException e) {\r
+// e.printStackTrace();\r
+// fail("DrmaaException caught:" + e.getMessage());\r
+// } catch (InterruptedException e) {\r
+// e.printStackTrace();\r
+// fail(e.getMessage());\r
+// } catch (ResultNotAvailableException e) {\r
+// e.printStackTrace();\r
+// fail(e.getMessage());\r
+// }\r
+// }\r
+//\r
+// @Test(groups = {AllTestSuit.test_group_runner})\r
+// public void RunLocally() {\r
+// try {\r
+// ConfiguredExecutable<Jpred> confpred = Configurator.configureExecutable(pred, Executable.ExecProvider.Local);\r
+// confpred.addParameters(Arrays.asList("-dbname ported_db", "-dbpath /data/UNIREFdb/"));\r
+//\r
+// // For local execution use relative\r
+// LocalRunner lr = new LocalRunner(confpred);\r
+// lr.executeJob();\r
+// ConfiguredExecutable<?> al1 = lr.waitForResult();\r
+// assertNotNull(al1.getResults());\r
+// JpredAlignment totalign = (JpredAlignment) confpred.getResults();\r
+// assertNotNull(totalign);\r
+// assertEquals(totalign.getSize(), 14);\r
+// assertEquals(al1.getResults(), totalign);\r
+// } catch (JobSubmissionException e) {\r
+// e.printStackTrace();\r
+// fail(e.getLocalizedMessage());\r
+// } catch (ResultNotAvailableException e) {\r
+// e.printStackTrace();\r
+// fail(e.getLocalizedMessage());\r
+// } catch (JobExecutionException e) {\r
+// e.printStackTrace();\r
+// fail(e.getLocalizedMessage());\r
+// }\r
+// }\r
+//\r
+// @Test(enabled=false,groups = {AllTestSuit.test_group_runner})\r
+// public void RunLocallyWithPreset() {\r
+// try {\r
+// ConfiguredExecutable<Jpred> confpred = Configurator.configureExecutable(pred, Executable.ExecProvider.Local);\r
+// PresetManager<Jpred> preset = RunnerUtil.getPresets(Jpred.class);\r
+// assert preset != null;\r
+// Preset<Jpred> conf = preset.getPresetByName("laptop configuration");\r
+// confpred.addParameters(conf.getOptions());\r
+//\r
+// // For local execution use relative\r
+// LocalRunner lr = new LocalRunner(confpred);\r
+// lr.executeJob();\r
+// ConfiguredExecutable<?> al1 = lr.waitForResult();\r
+// assertNotNull(al1.getResults());\r
+// JpredAlignment totalign = (JpredAlignment) confpred.getResults();\r
+// assertNotNull(totalign);\r
+// assertEquals(totalign.getSize(), 19);\r
+// assertEquals(al1.getResults(), totalign);\r
+// } catch (JobSubmissionException e) {\r
+// e.printStackTrace();\r
+// fail(e.getLocalizedMessage());\r
+// } catch (ResultNotAvailableException e) {\r
+// e.printStackTrace();\r
+// fail(e.getLocalizedMessage());\r
+// } catch (JobExecutionException e) {\r
+// e.printStackTrace();\r
+// fail(e.getLocalizedMessage());\r
+// }\r
+// }\r
+//\r
+// @Test(enabled=false,groups = {AllTestSuit.test_group_runner})\r
+// public void readStatistics() {\r
+// try {\r
+// Jpred jpred = new Jpred();\r
+// jpred.setInput(test_input);\r
+// jpred.setOutput(test_output);\r
+// ConfiguredExecutable<Jpred> confpred = Configurator.configureExecutable(jpred, Executable.ExecProvider.Local);\r
+// PresetManager<Jpred> preset = RunnerUtil.getPresets(Jpred.class);\r
+// assert preset != null;\r
+// Preset<Jpred> conf = preset.getPresetByName("laptop configuration");\r
+// confpred.addParameters(conf.getOptions());\r
+//\r
+// // For local execution use relative\r
+// AsyncExecutor sexec = Configurator.getAsyncEngine(confpred);\r
+// String jobId = sexec.submitJob(confpred);\r
+// String file = confpred.getWorkDirectory() + File.separator + Jpred.getStatFile();\r
+// FilePuller fw = FilePuller.newFilePuller(file, FileWatcher.MIN_CHUNK_SIZE_BYTES);\r
+// int count = 0;\r
+// long position = 0;\r
+// fw.waitForFile(2);\r
+// JobStatus status = sexec.getJobStatus(jobId);\r
+// do {\r
+// if (fw.hasMoreData()) {\r
+// ChunkHolder ch = fw.pull(position);\r
+// String chunk = ch.getChunk();\r
+// position = ch.getNextPosition();\r
+// }\r
+// count++;\r
+// // Make sure the loop is terminated if the job fails\r
+// if ((status == JobStatus.UNDEFINED || status == JobStatus.FAILED)) {\r
+// fail("job " + jobId +" failed!");\r
+// break;\r
+// }\r
+// Thread.sleep(200);\r
+// status = sexec.getJobStatus(jobId);\r
+// } while (status != JobStatus.FINISHED || fw.hasMoreData());\r
+//\r
+// assertTrue(count >= 1);\r
+// ConfiguredExecutable<?> al = sexec.getResults(jobId);\r
+// assertNotNull(al.getResults());\r
+// } catch (JobSubmissionException e) {\r
+// e.printStackTrace();\r
+// fail(e.getMessage());\r
+// } catch (ResultNotAvailableException e) {\r
+// e.printStackTrace();\r
+// fail(e.getMessage());\r
+// } catch (IOException e) {\r
+// e.printStackTrace();\r
+// fail(e.getMessage());\r
+// } catch (InterruptedException e) {\r
+// e.printStackTrace();\r
+// fail(e.getMessage());\r
+// }\r
+// }\r
+//\r
+// @Test(enabled=false,groups = {AllTestSuit.test_group_runner})\r
+// public void Persistance() {\r
+// try {\r
+// Jpred jpred = new Jpred();\r
+// jpred.setError("errrr.txt");\r
+// jpred.setInput(test_input);\r
+// jpred.setOutput("outtt.txt");\r
+// assertEquals(jpred.getInput(), test_input);\r
+// assertEquals(jpred.getError(), "errrr.txt");\r
+// assertEquals(jpred.getOutput(), "outtt.txt");\r
+// ConfiguredExecutable<Jpred> confpred = Configurator.configureExecutable(jpred, Executable.ExecProvider.Local);\r
+// confpred.addParameters(Arrays.asList("-dbname ported_db", "-dbpath /data/UNIREFdb/"));\r
+//\r
+// SyncExecutor sexec = Configurator.getSyncEngine(confpred);\r
+// sexec.executeJob();\r
+// ConfiguredExecutable<?> al = sexec.waitForResult();\r
+// assertNotNull(al.getResults());\r
+//\r
+// // Save run configuration\r
+// assertTrue(confpred.saveRunConfiguration());\r
+//\r
+// // See if loaded configuration is the same as saved\r
+// RunConfiguration loadedRun = RunConfiguration.load(new FileInputStream(new File(confpred.getWorkDirectory(), RunConfiguration.rconfigFile)));\r
+// assertEquals(((ConfExecutable<Jpred>) confpred).getRunConfiguration(),loadedRun);\r
+//\r
+// // Load run configuration as ConfExecutable\r
+// ConfiguredExecutable<Jpred> jpred2 = (ConfiguredExecutable<Jpred>) confpred.loadRunConfiguration(new FileInputStream(new File(confpred.getWorkDirectory(), RunConfiguration.rconfigFile)));\r
+// assertNotNull(jpred2);\r
+// assertEquals(jpred2.getExecutable().getInput(), test_input);\r
+// assertEquals(jpred2.getExecutable().getError(), "errrr.txt");\r
+// assertEquals(jpred2.getExecutable().getOutput(), "outtt.txt");\r
+//\r
+// // See in details whether executables are the same\r
+// assertEquals(jpred2.getExecutable(), jpred);\r
+// ConfiguredExecutable<Jpred> resjpred2 = Configurator.configureExecutable(jpred2.getExecutable(), Executable.ExecProvider.Local);\r
+//\r
+// sexec = Configurator.getSyncEngine(resjpred2, Executable.ExecProvider.Local);\r
+// sexec.executeJob();\r
+// al = sexec.waitForResult();\r
+// assertNotNull(al);\r
+// } catch (JobSubmissionException e) {\r
+// e.printStackTrace();\r
+// fail(e.getMessage());\r
+// } catch (JobExecutionException e) {\r
+// e.printStackTrace();\r
+// fail(e.getMessage());\r
+// } catch (FileNotFoundException e) {\r
+// e.printStackTrace();\r
+// fail(e.getMessage());\r
+// } catch (IOException e) {\r
+// e.printStackTrace();\r
+// fail(e.getMessage());\r
+// } catch (ResultNotAvailableException e) {\r
+// e.printStackTrace();\r
+// fail(e.getMessage());\r
+// }\r
+// }\r
+//\r
+// @Test(enabled=false,groups = {AllTestSuit.test_group_runner})\r
+// public void ConfigurationLoading() {\r
+// try {\r
+// RunnerConfig<Jpred> jpredConfig = ConfExecutable.getRunnerOptions(Jpred.class);\r
+// assertNotNull(jpredConfig);\r
+// assertTrue(jpredConfig.getArguments().size() > 0);\r
+//\r
+// PresetManager<Jpred> jpredPreset = ConfExecutable.getRunnerPresets(Jpred.class);\r
+// assertNotNull(jpredPreset);\r
+//\r
+// LimitsManager<Jpred> jpredLimits = ConfExecutable.getRunnerLimits(Jpred.class);\r
+// assertNotNull(jpredLimits);\r
+// assertTrue(jpredLimits.getLimits().size() > 0);\r
+// jpredLimits.validate(jpredPreset);\r
+// } catch (FileNotFoundException e) {\r
+// e.printStackTrace();\r
+// fail(e.getLocalizedMessage());\r
+// } catch (IOException e) {\r
+// e.printStackTrace();\r
+// fail(e.getLocalizedMessage());\r
+// } catch (ValidationException e) {\r
+// e.printStackTrace();\r
+// fail(e.getLocalizedMessage());\r
+// }\r
+// }\r
+//\r
+//}\r
Category conservation = new Category(CATEGORY_CONSERVATION, conservation_services);\r
\r
Set<Services> prediction_services = new HashSet<Services>();\r
- prediction_services.add(Services.JpredWS);\r
+// prediction_services.add(Services.JpredWS);\r
prediction_services.add(Services.RNAalifoldWS);\r
Category prediction = new Category(CATEGORY_PREDICTION, prediction_services);\r
\r
import compbio.data.msa.SequenceAnnotation;\r
import compbio.data.sequence.Alignment;\r
import compbio.data.sequence.AlignmentMetadata;\r
-import compbio.data.sequence.JpredAlignment;\r
+//import compbio.data.sequence.JpredAlignment;\r
import compbio.data.sequence.FastaSequence;\r
import compbio.data.sequence.ScoreManager;\r
import compbio.data.sequence.SequenceUtil;\r
writer.close();\r
} else if (service.getServiceType() == MsaWS.class) {\r
Alignment alignment = align(infile, (MsaWS<T>) thews, preset, customOptions);\r
- if (serviceName.equalsIgnoreCase("JpredWS")) {\r
- writer.close();\r
- JpredAlignment jpred = (JpredAlignment)alignment;\r
- if (outfile != null) {\r
- FileOutputStream fout = new FileOutputStream(outfile);\r
- SequenceUtil.writeFastaKeepTheStream(fout, jpred.getJpredSequences(), 60);\r
- fout.close();\r
- } else {\r
- SequenceUtil.writeFasta(System.out, jpred.getJpredSequences());\r
- }\r
- } else {\r
- IOHelper.writeOut(writer, alignment);\r
- writer.close();\r
- }\r
+// if (serviceName.equalsIgnoreCase("JpredWS")) {\r
+// writer.close();\r
+// JpredAlignment jpred = (JpredAlignment)alignment;\r
+// if (outfile != null) {\r
+// FileOutputStream fout = new FileOutputStream(outfile);\r
+// SequenceUtil.writeFastaKeepTheStream(fout, jpred.getJpredSequences(), 60);\r
+// fout.close();\r
+// } else {\r
+// SequenceUtil.writeFasta(System.out, jpred.getJpredSequences());\r
+// }\r
+// } else {\r
+// IOHelper.writeOut(writer, alignment);\r
+// writer.close();\r
+// }\r
+\r
+ IOHelper.writeOut(writer, alignment);\r
+ writer.close();\r
AlignmentMetadata md = alignment.getMetadata();\r
System.out.println("Output has been prepared with " + md.getProgram());\r
}\r
System.exit(1);\r
}\r
if (args.length < 2) {\r
- System.err.println("Host (-h=<host>, e.g. -h=http://www.compbio.dundee.ac.uk/jabaws) and service (-s=<ServiceName>, e.g. -s=Jpred) are required!");\r
+ System.err.println("Host (-h=<host>, e.g. -h=http://www.compbio.dundee.ac.uk/jabaws) and service (-s=<ServiceName>, e.g. -s=MafftWS) are required!");\r
System.out.println(Constraints.help_text);\r
System.exit(1);\r
}\r
MafftWS, MuscleWS, ClustalWS, ClustalOWS, TcoffeeWS, ProbconsWS, MSAprobsWS, GLprobsWS,\r
AAConWS, \r
JronnWS, DisemblWS, GlobPlotWS, IUPredWS, \r
- JpredWS, \r
+// JpredWS,\r
RNAalifoldWS;\r
\r
public static Services getService(String servName) {\r
case IUPredWS :\r
case RNAalifoldWS :\r
return SequenceAnnotation.class;\r
- case JpredWS :\r
+// case JpredWS :\r
case ClustalWS :\r
case ClustalOWS :\r
case MafftWS :\r
case IUPredWS :\r
case MSAprobsWS :\r
case GLprobsWS :\r
- case JpredWS :\r
+// case JpredWS :\r
case ClustalOWS :\r
return JABAService.V2_SERVICE_NAMESPACE;\r
case ClustalWS :\r
switch (this) {\r
case AAConWS :\r
return AACON_INFO.toString();\r
- case JpredWS :\r
- return JPRED_INFO.toString();\r
+// case JpredWS :\r
+// return JPRED_INFO.toString();\r
case ClustalOWS :\r
return CLUSTAL_OMEGA_INFO.toString();\r
case ClustalWS :\r
switch (this) {\r
case AAConWS :\r
return AACON_INFO.getReference();\r
- case JpredWS :\r
- return JPRED_INFO.getReference();\r
+// case JpredWS :\r
+// return JPRED_INFO.getReference();\r
case ClustalOWS :\r
return CLUSTAL_OMEGA_INFO.getReference();\r
case ClustalWS :\r
switch (this) {\r
case AAConWS :\r
return AACON_INFO.getVersion();\r
- case JpredWS :\r
- return JPRED_INFO.getVersion();\r
+// case JpredWS :\r
+// return JPRED_INFO.getVersion();\r
case ClustalOWS :\r
return CLUSTAL_OMEGA_INFO.getVersion();\r
case ClustalWS :\r
switch (this) {\r
case AAConWS :\r
return "annotation";\r
- case JpredWS :\r
- return "annotation";\r
+// case JpredWS :\r
+// return "annotation";\r
case ClustalOWS :\r
return "alignment";\r
case ClustalWS :\r
static ServiceInfo AACON_INFO = new ServiceInfo(AAConWS,\r
"in preparation", "1.0", "http://www.compbio.dundee.ac.uk/aacon");\r
\r
- static ServiceInfo JPRED_INFO = new ServiceInfo(JpredWS,\r
- "Cole C, Barber JD, Barton GJ,\r\n" + \r
- "\"The Jpred 3 secondary structure prediction server\"\r\n" +\r
- "Nucl. Acids Res. 36 (suppl 2):W197 (2008)", \r
- "3.0.3", "http://www.compbio.dundee.ac.uk/www-jpred");\r
+// static ServiceInfo JPRED_INFO = new ServiceInfo(JpredWS,\r
+// "Cole C, Barber JD, Barton GJ,\r\n" +\r
+// "\"The Jpred 3 secondary structure prediction server\"\r\n" +\r
+// "Nucl. Acids Res. 36 (suppl 2):W197 (2008)",\r
+// "3.0.3", "http://www.compbio.dundee.ac.uk/www-jpred");\r
\r
static ServiceInfo CLUSTAL_INFO = new ServiceInfo(ClustalWS,\r
"Larkin MA, Blackshields G, Brown NP, Chenna R, McGettigan PA, McWilliam H, Valentin F, Wallace IM, Wilm A, Lopez R, Thompson JD, Gibson TJ, Higgins DG,\r\n" +\r
import compbio.engine.client.ConfExecutable;\r
import compbio.engine.client.Executable;\r
import compbio.runner.conservation.AACon;\r
-import compbio.runner.predictors.Jpred;\r
+//import compbio.runner.predictors.Jpred;\r
import compbio.runner.disorder.Disembl;\r
import compbio.runner.disorder.GlobPlot;\r
import compbio.runner.disorder.IUPred;\r
switch (service) {\r
case AAConWS :\r
return AACon.class;\r
- case JpredWS :\r
- return Jpred.class;\r
+// case JpredWS :\r
+// return Jpred.class;\r
case ClustalOWS :\r
return ClustalO.class;\r
case ClustalWS :\r
boolean succeed = false;\r
String taskId;\r
\r
- if (service == Services.JpredWS) {\r
- taskId = msaws.align(loadAlignment());\r
- } else {\r
- taskId = msaws.align(loadSeqs(2));\r
- }\r
+// if (service == Services.JpredWS) {\r
+// taskId = msaws.align(loadAlignment());\r
+// } else {\r
+// taskId = msaws.align(loadSeqs(2));\r
+// }\r
+ taskId = msaws.align(loadSeqs(2));\r
writer.print("\nQuerying job status...");\r
JobStatus status = msaws.getJobStatus(taskId);\r
while (status != JobStatus.FINISHED) {\r
* must include this copyright and license notice.\r
*/\r
\r
-package compbio.ws.server;\r
-\r
-import java.io.File;\r
-import java.util.List;\r
-\r
-import javax.jws.WebService;\r
-\r
-import org.apache.log4j.Logger;\r
-\r
-import compbio.data.msa.JABAService;\r
-import compbio.data.msa.MsaWS;\r
-import compbio.data.sequence.Alignment;\r
-import compbio.data.sequence.JpredAlignment;\r
-import compbio.data.sequence.FastaSequence;\r
-import compbio.engine.AsyncExecutor;\r
-import compbio.engine.Configurator;\r
-import compbio.engine.client.ConfiguredExecutable;\r
-import compbio.engine.client.Executable;\r
-import compbio.engine.client.SkeletalExecutable;\r
-import compbio.engine.client.EngineUtil;\r
-import compbio.metadata.ChunkHolder;\r
-import compbio.metadata.JobStatus;\r
-import compbio.metadata.JobSubmissionException;\r
-import compbio.metadata.Limit;\r
-import compbio.metadata.LimitsManager;\r
-import compbio.metadata.Option;\r
-import compbio.metadata.Preset;\r
-import compbio.metadata.PresetManager;\r
-import compbio.metadata.ResultNotAvailableException;\r
-import compbio.metadata.RunnerConfig;\r
-import compbio.metadata.WrongParameterException;\r
-import compbio.runner.RunnerUtil;\r
-import compbio.runner.predictors.Jpred;\r
-\r
-@WebService(endpointInterface = "compbio.data.msa.MsaWS", targetNamespace = JABAService.V2_SERVICE_NAMESPACE, serviceName = "JpredWS")\r
-public class JpredWS implements MsaWS<Jpred> {\r
-\r
- private static Logger log = Logger.getLogger(JpredWS.class);\r
-\r
- private static final RunnerConfig<Jpred> jpredOptions = RunnerUtil.getSupportedOptions(Jpred.class);\r
- private static final PresetManager<Jpred> jpredPresets = RunnerUtil.getPresets(Jpred.class);\r
- private static final LimitsManager<Jpred> limitMan = EngineUtil.getLimits(new Jpred().getType());\r
-\r
- @Override\r
- public String align(List<FastaSequence> sequences)\r
- throws JobSubmissionException {\r
- WSUtil.validateFastaInput(sequences);\r
- ConfiguredExecutable<Jpred> confClust = init(sequences);\r
- return WSUtil.align(sequences, confClust, log, "align", getLimit(""));\r
- }\r
-\r
- ConfiguredExecutable<Jpred> init(List<FastaSequence> dataSet)\r
- throws JobSubmissionException {\r
- Jpred jpred = new Jpred();\r
- jpred.setInput(SkeletalExecutable.INPUT);\r
- jpred.setOutput(SkeletalExecutable.OUTPUT);\r
- jpred.setError(SkeletalExecutable.ERROR);\r
- ConfiguredExecutable<Jpred> confJpred = Configurator.configureExecutable(jpred, dataSet);\r
- // Set the number of threads for the cluster execution from conf file\r
- if (confJpred.getExecProvider() == Executable.ExecProvider.Cluster) {\r
- int clusterCpuNum = SkeletalExecutable.getClusterCpuNum(jpred.getType());\r
- if (clusterCpuNum != 0) {\r
- jpred.setNCore(clusterCpuNum);\r
- }\r
- }\r
- return confJpred;\r
- }\r
-\r
- @Override\r
- public String presetAlign(List<FastaSequence> sequences,\r
- Preset<Jpred> preset) throws JobSubmissionException,\r
- WrongParameterException {\r
- WSUtil.validateFastaInput(sequences);\r
- if (preset == null) {\r
- throw new WrongParameterException("Preset must be provided!");\r
- }\r
- Limit<Jpred> limit = getLimit(preset.getName());\r
- ConfiguredExecutable<Jpred> confClust = init(sequences);\r
- confClust.addParameters(preset.getOptions());\r
- return WSUtil.align(sequences, confClust, log, "presetAlign", limit);\r
- }\r
-\r
- @Override\r
- public String customAlign(List<FastaSequence> sequences,\r
- List<Option<Jpred>> options) throws JobSubmissionException,\r
- WrongParameterException {\r
- WSUtil.validateFastaInput(sequences);\r
- ConfiguredExecutable<Jpred> confClust = init(sequences);\r
- List<String> params = WSUtil.getCommands(options, Jpred.KEY_VALUE_SEPARATOR);\r
- confClust.addParameters(params);\r
- log.info("Setting parameters: " + params);\r
- return WSUtil.align(sequences, confClust, log, "customAlign", getLimit(""));\r
- }\r
-\r
- @Override\r
- public RunnerConfig<Jpred> getRunnerOptions() {\r
- return jpredOptions;\r
- }\r
-\r
- @SuppressWarnings("unchecked")\r
- @Override\r
- public Alignment getResult(String jobId) throws ResultNotAvailableException {\r
- WSUtil.validateJobId(jobId);\r
- AsyncExecutor asyncEngine = Configurator.getAsyncEngine(jobId);\r
- ConfiguredExecutable<Jpred> jpred = (ConfiguredExecutable<Jpred>) asyncEngine.getResults(jobId);\r
- return (Alignment)jpred.getResults();\r
- }\r
-\r
- @Override\r
- public Limit<Jpred> getLimit(String presetName) {\r
- if (limitMan == null) {\r
- // No limit is configured\r
- return null;\r
- }\r
- Limit<Jpred> limit = limitMan.getLimitByName(presetName);\r
- return limit;\r
- }\r
-\r
- @Override\r
- public LimitsManager<Jpred> getLimits() {\r
- return limitMan;\r
- }\r
-\r
- @Override\r
- public boolean cancelJob(String jobId) {\r
- WSUtil.validateJobId(jobId);\r
- boolean result = WSUtil.cancelJob(jobId);\r
- return result;\r
- }\r
-\r
- @Override\r
- public JobStatus getJobStatus(String jobId) {\r
- WSUtil.validateJobId(jobId);\r
- JobStatus status = WSUtil.getJobStatus(jobId);\r
- return status;\r
- }\r
-\r
- @Override\r
- public PresetManager<Jpred> getPresets() {\r
- return jpredPresets;\r
- }\r
-\r
- @Override\r
- public ChunkHolder pullExecStatistics(String jobId, long position) {\r
- WSUtil.validateJobId(jobId);\r
- String file = Configurator.getWorkDirectory(jobId) + File.separator + Jpred.getStatFile();\r
- ChunkHolder cholder = WSUtil.pullFile(file, position);\r
- return cholder;\r
- }\r
-\r
-}\r
+//package compbio.ws.server;\r
+//\r
+//import java.io.File;\r
+//import java.util.List;\r
+//\r
+//import javax.jws.WebService;\r
+//\r
+//import org.apache.log4j.Logger;\r
+//\r
+//import compbio.data.msa.JABAService;\r
+//import compbio.data.msa.MsaWS;\r
+//import compbio.data.sequence.Alignment;\r
+//import compbio.data.sequence.JpredAlignment;\r
+//import compbio.data.sequence.FastaSequence;\r
+//import compbio.engine.AsyncExecutor;\r
+//import compbio.engine.Configurator;\r
+//import compbio.engine.client.ConfiguredExecutable;\r
+//import compbio.engine.client.Executable;\r
+//import compbio.engine.client.SkeletalExecutable;\r
+//import compbio.engine.client.EngineUtil;\r
+//import compbio.metadata.ChunkHolder;\r
+//import compbio.metadata.JobStatus;\r
+//import compbio.metadata.JobSubmissionException;\r
+//import compbio.metadata.Limit;\r
+//import compbio.metadata.LimitsManager;\r
+//import compbio.metadata.Option;\r
+//import compbio.metadata.Preset;\r
+//import compbio.metadata.PresetManager;\r
+//import compbio.metadata.ResultNotAvailableException;\r
+//import compbio.metadata.RunnerConfig;\r
+//import compbio.metadata.WrongParameterException;\r
+//import compbio.runner.RunnerUtil;\r
+//import compbio.runner.predictors.Jpred;\r
+//\r
+//@WebService(endpointInterface = "compbio.data.msa.MsaWS", targetNamespace = JABAService.V2_SERVICE_NAMESPACE, serviceName = "JpredWS")\r
+//public class JpredWS implements MsaWS<Jpred> {\r
+//\r
+// private static Logger log = Logger.getLogger(JpredWS.class);\r
+//\r
+// private static final RunnerConfig<Jpred> jpredOptions = RunnerUtil.getSupportedOptions(Jpred.class);\r
+// private static final PresetManager<Jpred> jpredPresets = RunnerUtil.getPresets(Jpred.class);\r
+// private static final LimitsManager<Jpred> limitMan = EngineUtil.getLimits(new Jpred().getType());\r
+//\r
+// @Override\r
+// public String align(List<FastaSequence> sequences)\r
+// throws JobSubmissionException {\r
+// WSUtil.validateFastaInput(sequences);\r
+// ConfiguredExecutable<Jpred> confClust = init(sequences);\r
+// return WSUtil.align(sequences, confClust, log, "align", getLimit(""));\r
+// }\r
+//\r
+// ConfiguredExecutable<Jpred> init(List<FastaSequence> dataSet)\r
+// throws JobSubmissionException {\r
+// Jpred jpred = new Jpred();\r
+// jpred.setInput(SkeletalExecutable.INPUT);\r
+// jpred.setOutput(SkeletalExecutable.OUTPUT);\r
+// jpred.setError(SkeletalExecutable.ERROR);\r
+// ConfiguredExecutable<Jpred> confJpred = Configurator.configureExecutable(jpred, dataSet);\r
+// // Set the number of threads for the cluster execution from conf file\r
+// if (confJpred.getExecProvider() == Executable.ExecProvider.Cluster) {\r
+// int clusterCpuNum = SkeletalExecutable.getClusterCpuNum(jpred.getType());\r
+// if (clusterCpuNum != 0) {\r
+// jpred.setNCore(clusterCpuNum);\r
+// }\r
+// }\r
+// return confJpred;\r
+// }\r
+//\r
+// @Override\r
+// public String presetAlign(List<FastaSequence> sequences,\r
+// Preset<Jpred> preset) throws JobSubmissionException,\r
+// WrongParameterException {\r
+// WSUtil.validateFastaInput(sequences);\r
+// if (preset == null) {\r
+// throw new WrongParameterException("Preset must be provided!");\r
+// }\r
+// Limit<Jpred> limit = getLimit(preset.getName());\r
+// ConfiguredExecutable<Jpred> confClust = init(sequences);\r
+// confClust.addParameters(preset.getOptions());\r
+// return WSUtil.align(sequences, confClust, log, "presetAlign", limit);\r
+// }\r
+//\r
+// @Override\r
+// public String customAlign(List<FastaSequence> sequences,\r
+// List<Option<Jpred>> options) throws JobSubmissionException,\r
+// WrongParameterException {\r
+// WSUtil.validateFastaInput(sequences);\r
+// ConfiguredExecutable<Jpred> confClust = init(sequences);\r
+// List<String> params = WSUtil.getCommands(options, Jpred.KEY_VALUE_SEPARATOR);\r
+// confClust.addParameters(params);\r
+// log.info("Setting parameters: " + params);\r
+// return WSUtil.align(sequences, confClust, log, "customAlign", getLimit(""));\r
+// }\r
+//\r
+// @Override\r
+// public RunnerConfig<Jpred> getRunnerOptions() {\r
+// return jpredOptions;\r
+// }\r
+//\r
+// @SuppressWarnings("unchecked")\r
+// @Override\r
+// public Alignment getResult(String jobId) throws ResultNotAvailableException {\r
+// WSUtil.validateJobId(jobId);\r
+// AsyncExecutor asyncEngine = Configurator.getAsyncEngine(jobId);\r
+// ConfiguredExecutable<Jpred> jpred = (ConfiguredExecutable<Jpred>) asyncEngine.getResults(jobId);\r
+// return (Alignment)jpred.getResults();\r
+// }\r
+//\r
+// @Override\r
+// public Limit<Jpred> getLimit(String presetName) {\r
+// if (limitMan == null) {\r
+// // No limit is configured\r
+// return null;\r
+// }\r
+// Limit<Jpred> limit = limitMan.getLimitByName(presetName);\r
+// return limit;\r
+// }\r
+//\r
+// @Override\r
+// public LimitsManager<Jpred> getLimits() {\r
+// return limitMan;\r
+// }\r
+//\r
+// @Override\r
+// public boolean cancelJob(String jobId) {\r
+// WSUtil.validateJobId(jobId);\r
+// boolean result = WSUtil.cancelJob(jobId);\r
+// return result;\r
+// }\r
+//\r
+// @Override\r
+// public JobStatus getJobStatus(String jobId) {\r
+// WSUtil.validateJobId(jobId);\r
+// JobStatus status = WSUtil.getJobStatus(jobId);\r
+// return status;\r
+// }\r
+//\r
+// @Override\r
+// public PresetManager<Jpred> getPresets() {\r
+// return jpredPresets;\r
+// }\r
+//\r
+// @Override\r
+// public ChunkHolder pullExecStatistics(String jobId, long position) {\r
+// WSUtil.validateJobId(jobId);\r
+// String file = Configurator.getWorkDirectory(jobId) + File.separator + Jpred.getStatFile();\r
+// ChunkHolder cholder = WSUtil.pullFile(file, position);\r
+// return cholder;\r
+// }\r
+//\r
+//}\r
}\r
}\r
\r
- public static void validateJpredInput(List<FastaSequence> sequences)\r
- throws JobSubmissionException {\r
- validateFastaInput(sequences);\r
- int len = 0;\r
- for (FastaSequence fs : sequences) {\r
- if (len == 0) {\r
- len = fs.getLength();\r
- continue;\r
- }\r
- if (fs.getLength() != len) {\r
- System.out.println("FASTA rec: id = " + fs.getId() + ": seq = " + fs.getSequence());\r
- throw new JobSubmissionException(\r
- "All sequences must be of the same length. Please align the sequences " + \r
- " prior to submission! The first sequence length is : " + len + \r
- " but the sequence '" + fs.getId() + "' length is " + fs.getLength());\r
- }\r
- }\r
- }\r
+// public static void validateJpredInput(List<FastaSequence> sequences)\r
+// throws JobSubmissionException {\r
+// validateFastaInput(sequences);\r
+// int len = 0;\r
+// for (FastaSequence fs : sequences) {\r
+// if (len == 0) {\r
+// len = fs.getLength();\r
+// continue;\r
+// }\r
+// if (fs.getLength() != len) {\r
+// System.out.println("FASTA rec: id = " + fs.getId() + ": seq = " + fs.getSequence());\r
+// throw new JobSubmissionException(\r
+// "All sequences must be of the same length. Please align the sequences " +\r
+// " prior to submission! The first sequence length is : " + len +\r
+// " but the sequence '" + fs.getId() + "' length is " + fs.getLength());\r
+// }\r
+// }\r
+// }\r
\r
public static <T> ScoreManager getAnnotation(String jobId, Logger log)\r
throws ResultNotAvailableException {\r