/*\r
- * Copyright (c) 2009 Peter Troshin JAva Bioinformatics Analysis Web Services\r
- * (JABAWS) @version: 1.0 This library is free software; you can redistribute it\r
+ * Copyright (c) 2011 Peter Troshin JAva Bioinformatics Analysis Web Services\r
+ * (JABAWS) @version: 2.0 This library is free software; you can redistribute it\r
* and/or modify it under the terms of the Apache License version 2 as published\r
* by the Apache Software Foundation This library is distributed in the hope\r
* that it will be useful, but WITHOUT ANY WARRANTY; without even the implied\r
\r
package compbio.runner.disorder;\r
\r
-import java.util.Arrays;\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
+\r
import java.util.Map;\r
+import java.util.Set;\r
\r
import org.apache.log4j.Logger;\r
\r
+\r
import compbio.data.sequence.Score;\r
-import compbio.engine.client.CommandBuilder;\r
+import compbio.data.sequence.SequenceUtil;\r
+import compbio.data.sequence.UnknownFileFormatException;\r
+\r
import compbio.engine.client.Executable;\r
import compbio.engine.client.PipedExecutable;\r
import compbio.engine.client.SkeletalExecutable;\r
import compbio.runner.Util;\r
\r
/**\r
- * @see DisEMBL\r
- * \r
* DisEMBL.py smooth_frame peak_frame join_frame fold_coils fold_hotloops\r
- * fold_rem465 sequence_file print 'A default run would be: ./DisEMBL.py 8\r
- * 8 4 1.2 1.4 1.2 fasta_file > out' new DisEMBL is at\r
- * /homes/pvtroshin/soft/DisEMBL-1.4raw\r
- * \r
- * This is not a standard DisEMBL! The script has been modified! DisEMBL.py\r
- * smooth_frame peak_frame join_frame fold_coils fold_hotloops fold_rem465\r
- * [mode] < fasta_file > out print\r
- * \r
- * 'A default run would be: ./DisEMBL.py 8 8 4 1.2 1.4 1.2 < fasta_file'\r
- * print 'Mode: "default"(nothing) or "scores" which will give scores per\r
- * residue in TAB separated format'\r
+ * fold_rem465 sequence_file print \r
+ * \r
+ * 'A default run would be: ./DisEMBL.py 8 8 4 1.2 1.4 1.2 fasta_file > out' \r
+ * \r
+ * This version of DisEMBL is 1.4 (latest available for download in Feb 2011)\r
+ * capable of outputting raw values \r
+ * \r
+ * The values of the parameters are hard coded in DisEMBL.py script. \r
+ * smooth_frame=8 peak_frame=8 join_frame=4 fold_coils=1.2 fold_hotloops=1.4\r
+ * fold_rem465=1.2 \r
+ * \r
+ * Changing these values are not recommended by developers, apart from smoothing window. \r
+ * However, 5 orders of magnitude changes in this parameter does not change the output\r
+ * so allowing this change also seems pointless. Finally, the binary, DisEMBL depends on\r
+ * - Tisean is not happy with arbitruary changes to these values, so changing them can \r
+ * lead to problems.\r
+ * \r
* \r
- * Internal parameters names are: sj\r
+ * This is not a standard DisEMBL! The script has been modified! \r
* \r
- * //TODO? pw jd ct rt lt\r
- * \r
- * the order is preserved\r
*/\r
public class Disembl extends SkeletalExecutable<Disembl>\r
implements\r
// Cache for Limits information\r
private static LimitsManager<Disembl> limits;\r
\r
- // CHECK THIS !!!\r
public static final String KEY_VALUE_SEPARATOR = Util.SPACE;\r
\r
+ /* The parameter list there must not contain same values! */\r
public Disembl() {\r
// remove default input to prevent it to appear in the parameters list\r
// that could happen if the parameters are set first\r
// super.setInput("");\r
- addParameters(Arrays.asList("8", "8", "4", "1.2", "1.4", "1.2",\r
- "scores"));\r
}\r
\r
@SuppressWarnings("unchecked")\r
- public Map<String, Score> getResults(String workDirectory)\r
+ public Map<String, Set<Score>> getResults(String workDirectory)\r
throws ResultNotAvailableException {\r
\r
- return null;\r
+ InputStream inStream = null;\r
+ Map<String, Set<Score>> results= null; \r
+ try {\r
+ inStream = new FileInputStream(new File(workDirectory,\r
+ getOutput()));\r
+ results = SequenceUtil.removeSequences(SequenceUtil.readDisembl(inStream));\r
+ inStream.close();\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 (UnknownFileFormatException 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
+ \r
+ return results;\r
}\r
\r
@Override\r
return this.getClass();\r
}\r
\r
- @Override\r
- public CommandBuilder<Disembl> getParameters(ExecProvider provider) {\r
- // If Savitzky-Golay smoothing parameter is specified then set it\r
- String val = cbuilder.getParamValue("sg");\r
- log.info("DisEMBL sav-gol value: " + val);\r
- if (val != null) {\r
- cbuilder.removeParam("sg");\r
- cbuilder.setFirst(val);\r
- }\r
- return super.getParameters(provider);\r
- }\r
}\r