\r
import compbio.data.sequence.Alignment;\r
import compbio.data.sequence.UnknownFileFormatException;\r
+import compbio.engine.client.CommandBuilder;\r
+import compbio.engine.client.Executable;\r
import compbio.engine.client.SkeletalExecutable;\r
+import compbio.engine.client.Executable.ExecProvider;\r
import compbio.metadata.ResultNotAvailableException;\r
import compbio.runner.Util;\r
\r
\r
private static Logger log = Logger.getLogger(ClustalO.class);\r
private static final String EXEC_STAT_FILE = "stat.log";\r
- private static final String TREE_FILE_EXT = ".dnd";\r
+ \r
\r
public static final String KEY_VALUE_SEPARATOR = "=";\r
+ \r
+ /*\r
+ * Number of cores parameter name\r
+ */\r
+ private final static String ncorePrm = "--threads";\r
\r
/**\r
- * \r
- * --auto Set options automatically (might overwrite some of your options)\r
- * \r
+ * Number of cores to use, defaults to 1 for local execution or the value of\r
+ * "tcoffee.cluster.cpunum" property for cluster execution\r
+ */\r
+ private int ncoreNumber = 0;\r
+\r
+ \r
+ /**\r
* --threads=<n> Number of processors to use\r
* \r
* -l, --log=<file> Log all non-essential output to this file\r
public Class<ClustalO> getType() {\r
return (Class<ClustalO>) this.getClass();\r
}\r
+ \r
+ @Override\r
+ public CommandBuilder<ClustalO> getParameters(ExecProvider provider) {\r
+ // Limit number of cores to 1 for ANY execution which does not set\r
+ // Ncores explicitly using setNCore method\r
+ if (ncoreNumber == 0) {\r
+ setNCore(1);\r
+ }\r
+ if (provider == Executable.ExecProvider.Cluster) {\r
+ int cpunum = SkeletalExecutable.getClusterCpuNum(getType());\r
+ if (cpunum != 0) {\r
+ setNCore(cpunum);\r
+ } \r
+ }\r
+ return super.getParameters(provider);\r
+ }\r
+ \r
+ public void setNCore(int ncoreNumber) {\r
+ if (ncoreNumber < 1 || ncoreNumber > 100) {\r
+ throw new IndexOutOfBoundsException(\r
+ "Number of cores must be within 1 and 100 ");\r
+ }\r
+ this.ncoreNumber = ncoreNumber;\r
+ cbuilder.setParam(ncorePrm, Integer.toString(getNCore()));\r
+ }\r
+\r
+ int getNCore() {\r
+ return ncoreNumber;\r
+ }\r
+\r
\r
}\r