\r
public class RNAStructReader {\r
\r
- private static Logger log = Logger.getLogger(RNAStructReader.class);\r
- \r
// Whitespace patterns\r
static String s = "[+\\s=]+";\r
static String bracket = "\\(|\\)|\\{|\\}|\\[|\\]";\r
assert (sline != null \r
&& Pattern.matches(AlifoldLine.ensembleFreq.regex, sline)) :\r
error + "Found 'freeEnergy' line on its own";\r
- structs.add("Free energy of ensemble (kcal/mol) followed by "\r
- + "frequency of mfe structure in ensemble");\r
+ structs.add("Free energy of ensemble (kcal/mol) followed by frequency of mfe structure in ensemble");\r
scores.add(Float.parseFloat(sc.findInLine(floatP)));\r
scores.add(Float.parseFloat(nsc.findInLine(floatP)));\r
data.add(newSetScore(AlifoldResult.ensembleValues, scores));\r
// jump line\r
sline = reader.readLine();\r
}\r
- \r
\r
assert(!ftype.equals(AlifoldLine.ensembleFreq)) :\r
error + "Wasn't expecting 'frequency of mfe structure'!";\r
error + "Wasn't expecting an alignment sequence!";\r
assert(!ftype.equals(AlifoldLine.OTHER)) :\r
error + "Wasn't expecting this whatever it is: " + fline;\r
- if (Pattern.matches("^\\s*$", fline)) {\r
- log.warn("While parsing alifold stdout: A line is either empty or"\r
- + " contains only whitespace");\r
- }\r
- \r
+\r
fline = sline;\r
}\r
\r
} else if (Pattern.matches(freqP, token)) {\r
return RNAOut.FREQ;\r
}\r
- \r
+\r
return RNAOut.OTHER;\r
}\r
\r
public static enum AlifoldResult {\r
mfeStructure, contactProbabilityStructure, MEAStucture, centroidStructure, stochBTStructure, consensusAlignment, ensembleValues, contactProbabilities\r
}\r
- \r
\r
// Print the full regex Strings for testing \r
public static void main(String[] args) {\r
System.out.println(l.toString() + ": " + l.regex.replace("^","").replace("$",""));\r
}\r
}\r
- \r
\r
- \r
-} \r
+}\r
// If data set is deemed too big for local execution, than give a\r
// cluster engine\r
// If limit is not defined then defaults to executing on the cluster\r
- Limit<V> limit = executable\r
- .getLimit(PresetManager.LOCAL_ENGINE_LIMIT_PRESET);\r
- log.trace("Inspecting whether the job can be executed locally using limit: "\r
- + limit);\r
+ Limit<V> limit = executable.getLimit(PresetManager.LOCAL_ENGINE_LIMIT_PRESET);\r
+ log.trace("Inspecting whether the job can be executed locally using limit: " + limit);\r
if (limit == null || limit.isExceeded(dataSet)) {\r
log.debug("Job EXCEEDS LOCAL execution LIMIT targeting for cluster execution! ");\r
return Executable.ExecProvider.Cluster;\r
// TODO think about appropriate exception here\r
ConfExecutable(RunConfiguration rconf) {\r
try {\r
- exec = (Executable<T>) Class.forName(rconf.runnerClassName)\r
- .newInstance();\r
+ exec = (Executable<T>) Class.forName(rconf.runnerClassName).newInstance();\r
} catch (InstantiationException e) {\r
e.printStackTrace();\r
} catch (IllegalAccessException e) {\r
\r
public class RunnerConfigMarshaller<T> {\r
\r
- private static final Logger log = Logger\r
- .getLogger(RunnerConfigMarshaller.class);\r
+ private static final Logger log = Logger.getLogger(RunnerConfigMarshaller.class);\r
\r
private final JAXBContext ctx;\r
\r
import java.io.IOException;\r
import java.io.PrintStream;\r
import java.util.List;\r
-import java.util.Map;\r
import java.util.Map.Entry;\r
import java.util.concurrent.Callable;\r
import java.util.concurrent.ExecutionException;\r
@Immutable\r
public final class OptionCombinator {\r
\r
- private static Logger log = Logger.getLogger(OptionCombinator.class);\r
- private static final String MINVALUE = "-100";\r
- private static final String MAXVALUE = "100";\r
-\r
- private static final Random rand = new Random();\r
- private final RunnerConfig<? extends Executable<?>> rconfig;\r
+ private static Logger log = Logger.getLogger(OptionCombinator.class);\r
+ private static final String MINVALUE = "-100";\r
+ private static final String MAXVALUE = "100";\r
+\r
+ private static final Random rand = new Random();\r
+ private final RunnerConfig<? extends Executable<?>> rconfig;\r
+\r
+ public OptionCombinator(RunnerConfig<? extends Executable<?>> rconfig) {\r
+ if (rconfig == null) {\r
+ throw new IllegalArgumentException("RunnerConfig must be provided!");\r
+ }\r
+ this.rconfig = rconfig;\r
+ }\r
\r
- public OptionCombinator(RunnerConfig<? extends Executable<?>> rconfig) {\r
- if (rconfig == null) {\r
- throw new IllegalArgumentException("RunnerConfig must be provided!");\r
+ public List<String> optionsToCommandString(List<Option<?>> options) {\r
+ List<String> strOptions = new ArrayList<String>();\r
+ for (Option<?> option : options) {\r
+ strOptions.add(optionToCommandString(option));\r
+ }\r
+ return strOptions;\r
}\r
- this.rconfig = rconfig;\r
- }\r
\r
- public List<String> optionsToCommandString(List<Option<?>> options) {\r
- List<String> strOptions = new ArrayList<String>();\r
- for (Option<?> option : options) {\r
- strOptions.add(optionToCommandString(option));\r
+ public List<String> getOptionsAtRandom() {\r
+ return optionsToCommandString(getAllOptions());\r
}\r
- return strOptions;\r
- }\r
-\r
- public List<String> getOptionsAtRandom() {\r
- return optionsToCommandString(getAllOptions());\r
- }\r
-\r
- public List<Option<?>> getAllOptions() {\r
- return new ArrayList<Option<?>>(rconfig.getOptions());\r
- }\r
-\r
- static String optionToCommandString(Option<?> option) {\r
- int size = option.getOptionNames().size();\r
- int idx = rand.nextInt(size);\r
- return option.getOptionNames().get(idx);\r
- }\r
-\r
- public List<Parameter<?>> getAllParameters() {\r
- List<Parameter<?>> args = new ArrayList<Parameter<?>>();\r
- for (Parameter<?> prm : rconfig.getParameters()) {\r
- // Make sure there is a default value linked to the parameter to use\r
- // later\r
- // prm.setDefaultValue(getValue(prm));\r
- args.add(prm);\r
+\r
+ public List<Option<?>> getAllOptions() {\r
+ return new ArrayList<Option<?>>(rconfig.getOptions());\r
}\r
- return args;\r
- }\r
\r
- public List<String> argumentsToCommandString(\r
- List<? extends Option<?>> arguments) {\r
- return argumentsToCommandString(arguments, rconfig);\r
- }\r
+ static String optionToCommandString(Option<?> option) {\r
+ int size = option.getOptionNames().size();\r
+ int idx = rand.nextInt(size);\r
+ return option.getOptionNames().get(idx);\r
+ }\r
\r
- public static List<String> argumentsToCommandString(\r
- List<? extends Option<?>> arguments,\r
- RunnerConfig<? extends Executable<?>> rconfig) {\r
+ public List<Parameter<?>> getAllParameters() {\r
+ List<Parameter<?>> args = new ArrayList<Parameter<?>>();\r
+ for (Parameter<?> prm : rconfig.getParameters()) {\r
+ // Make sure there is a default value linked to the parameter to use later\r
+ // prm.setDefaultValue(getValue(prm));\r
+ args.add(prm);\r
+ }\r
+ return args;\r
+ }\r
\r
- if (arguments == null || rconfig == null) {\r
- throw new NullPointerException(\r
- "Arguments and RunnerConfig objects must be provided!");\r
+ public List<String> argumentsToCommandString(List<? extends Option<?>> arguments) {\r
+ return argumentsToCommandString(arguments, rconfig);\r
}\r
\r
- List<String> command = new ArrayList<String>();\r
- for (Option<?> option : arguments) {\r
-\r
- if (option instanceof Parameter<?>) {\r
- Parameter<?> prm = (Parameter<?>) option;\r
- command.add(prm.getOptionName() + rconfig.getPrmSeparator()\r
- + getValue(prm));\r
- log.trace("Setting parameter " + prm);\r
- } else {\r
- log.trace("Setting option " + option);\r
- command.add(optionToCommandString(option));\r
- }\r
+ public static List<String> argumentsToCommandString(List<? extends Option<?>> arguments,RunnerConfig<? extends Executable<?>> rconfig) {\r
+ if (arguments == null || rconfig == null) {\r
+ throw new NullPointerException("Arguments and RunnerConfig objects must be provided!");\r
+ }\r
+\r
+ List<String> command = new ArrayList<String>();\r
+ for (Option<?> option : arguments) {\r
+ if (option instanceof Parameter<?>) {\r
+ Parameter<?> prm = (Parameter<?>) option;\r
+ command.add(prm.getOptionName() + rconfig.getPrmSeparator() + getValue(prm));\r
+ log.trace("Setting parameter " + prm);\r
+ } else {\r
+ log.trace("Setting option " + option);\r
+ command.add(optionToCommandString(option));\r
+ }\r
+ }\r
+ return command;\r
}\r
- return command;\r
- }\r
-\r
- public List<String> parametersToCommandString(\r
- List<Parameter<?>> orderedList, Map<Parameter<?>, String> prmValue) {\r
- List<String> args = new ArrayList<String>();\r
- for (Parameter<?> param : orderedList) {\r
- args.add(param.getOptionName() + rconfig.getPrmSeparator()\r
- + prmValue.get(param));\r
+\r
+ public List<String> parametersToCommandString(List<Parameter<?>> orderedList, Map<Parameter<?>, String> prmValue) {\r
+ List<String> args = new ArrayList<String>();\r
+ for (Parameter<?> param : orderedList) {\r
+ args.add(param.getOptionName() + rconfig.getPrmSeparator() + prmValue.get(param));\r
+ }\r
+ return args;\r
}\r
- return args;\r
- }\r
\r
- public Map<Parameter<?>, String> getAllConstrainedParametersWithBorderValues(\r
- boolean minValue) {\r
- Map<Parameter<?>, String> paramValue = new HashMap<Parameter<?>, String>();\r
- for (Parameter<?> prm : rconfig.getParameters()) {\r
- ValueConstrain vc = prm.getValidValue();\r
- if (vc == null) {\r
- continue;\r
- }\r
- String value = "";\r
- if (minValue) {\r
- value = getLowBorderValue(prm);\r
- } else {\r
- value = getUpperBorderValue(prm);\r
- }\r
- paramValue.put(prm, value);\r
+ public Map<Parameter<?>, String> getAllConstrainedParametersWithBorderValues( boolean minValue) {\r
+ Map<Parameter<?>, String> paramValue = new HashMap<Parameter<?>, String>();\r
+ for (Parameter<?> prm : rconfig.getParameters()) {\r
+ ValueConstrain vc = prm.getValidValue();\r
+ if (vc == null) {\r
+ continue;\r
+ }\r
+ String value = getUpperBorderValue(prm);\r
+ if (minValue) {\r
+ value = getLowBorderValue(prm);\r
+ }\r
+ paramValue.put(prm, value);\r
+ }\r
+ return paramValue;\r
}\r
- return paramValue;\r
- }\r
\r
- public Map<Parameter<?>, String> getAllConstrainedParametersWithRandomValues() {\r
+ public Map<Parameter<?>, String> getAllConstrainedParametersWithRandomValues() {\r
Map<Parameter<?>, String> paramValue = new HashMap<Parameter<?>, String>();\r
- for (Parameter<?> prm : rconfig.getParameters()) {\r
- ValueConstrain vc = prm.getValidValue();\r
- if (vc == null) {\r
- continue;\r
- }\r
- paramValue.put(prm, getRandomValue(prm));\r
+ for (Parameter<?> prm : rconfig.getParameters()) {\r
+ ValueConstrain vc = prm.getValidValue();\r
+ if (vc == null) {\r
+ continue;\r
+ }\r
+ paramValue.put(prm, getRandomValue(prm));\r
+ }\r
+ return paramValue;\r
}\r
- return paramValue;\r
- }\r
\r
- String getLowBorderValue(Parameter<?> param) {\r
- assert param != null;\r
- ValueConstrain vc = param.getValidValue();\r
- Number minVal = vc.getMin();\r
- return minVal == null ? MINVALUE : minVal.toString();\r
- }\r
+ String getLowBorderValue(Parameter<?> param) {\r
+ assert param != null;\r
+ ValueConstrain vc = param.getValidValue();\r
+ Number minVal = vc.getMin();\r
+ return minVal == null ? MINVALUE : minVal.toString();\r
+ }\r
\r
- String getUpperBorderValue(Parameter<?> param) {\r
- assert param != null;\r
- ValueConstrain vc = param.getValidValue();\r
- Number maxVal = vc.getMax();\r
- return maxVal == null ? MAXVALUE : maxVal.toString();\r
- }\r
+ String getUpperBorderValue(Parameter<?> param) {\r
+ assert param != null;\r
+ ValueConstrain vc = param.getValidValue();\r
+ Number maxVal = vc.getMax();\r
+ return maxVal == null ? MAXVALUE : maxVal.toString();\r
+ }\r
\r
- String getRandomValue(Parameter<?> param) {\r
- assert param != null;\r
- String low = getLowBorderValue(param);\r
- String high = getUpperBorderValue(param);\r
- ValueConstrain vc = param.getValidValue();\r
+ String getRandomValue(Parameter<?> param) {\r
+ assert param != null;\r
+ String low = getLowBorderValue(param);\r
+ String high = getUpperBorderValue(param);\r
+ ValueConstrain vc = param.getValidValue();\r
\r
- if (vc.getType() == ValueConstrain.Type.Float) {\r
- return new Double(Util.getRandomNumber(Double.parseDouble(low),\r
- Double.parseDouble(high))).toString();\r
+ if (vc.getType() == ValueConstrain.Type.Float) {\r
+ return new Double(Util.getRandomNumber(Double.parseDouble(low), Double.parseDouble(high))).toString();\r
+ }\r
+ return new Integer(Util.getRandomNumber(Integer.parseInt(low), Integer.parseInt(high))).toString();\r
}\r
- return new Integer(Util.getRandomNumber(Integer.parseInt(low), Integer\r
- .parseInt(high))).toString();\r
- }\r
\r
- static String getValue(Parameter<?> param) {\r
+ static String getValue(Parameter<?> param) {\r
assert param != null;\r
if (param.getDefaultValue() != null) {\r
- log.trace("Returning default value: " + param.getDefaultValue());\r
- return param.getDefaultValue();\r
+ log.trace("Returning default value: " + param.getDefaultValue());\r
+ return param.getDefaultValue();\r
} else {\r
- // Some parameters do not have default values e.g. seq type - nuc or\r
- // protein\r
- List<String> passValues = param.getPossibleValues();\r
- int idx = rand.nextInt(passValues.size());\r
- log.trace("Returning random value: " + passValues.get(idx));\r
- return passValues.get(idx);\r
+ // Some parameters do not have default values e.g. seq type - nuc or protein\r
+ List<String> passValues = param.getPossibleValues();\r
+ int idx = rand.nextInt(passValues.size());\r
+ log.trace("Returning random value: " + passValues.get(idx));\r
+ return passValues.get(idx);\r
+ }\r
}\r
- }\r
+\r
}\r
\r
import java.io.File;\r
import java.io.FileInputStream;\r
-import java.io.FileReader;\r
-import java.io.BufferedReader;\r
import java.io.FileNotFoundException;\r
import java.io.FileOutputStream;\r
import java.io.IOException;\r
-import java.util.Arrays;\r
import java.util.List;\r
-import java.util.ArrayList;\r
import java.util.Map;\r
-import java.util.Set;\r
-import java.util.TreeSet;\r
-import java.util.TreeMap;\r
-import java.util.regex.Pattern;\r
-import java.util.regex.Matcher;\r
-import java.util.Scanner;\r
-\r
-\r
-\r
\r
import org.apache.log4j.Logger;\r
\r
import compbio.data.sequence.FastaSequence;\r
import compbio.data.sequence.RNAStructScoreManager;\r
import compbio.data.sequence.Score;\r
-import compbio.data.sequence.ScoreManager;\r
-import compbio.data.sequence.Range;\r
import compbio.data.sequence.RNAStructReader;\r
import compbio.data.sequence.SequenceUtil;\r
import compbio.data.sequence.UnknownFileFormatException;\r
import compbio.engine.client.ConfExecutable;\r
import compbio.engine.client.ConfiguredExecutable;\r
import compbio.engine.client.Executable;\r
-import compbio.engine.conf.PropertyHelperManager;\r
import compbio.metadata.JobSubmissionException;\r
import compbio.metadata.PresetManager;\r
import compbio.metadata.RunnerConfig;\r
-import compbio.util.PropertyHelper;\r
\r
public final class Util {\r
\r
public static Logger log = Logger.getLogger(Util.class);\r
\r
- private static final PropertyHelper ph = PropertyHelperManager\r
- .getPropertyHelper();\r
-\r
- public static final String SPACE = " ";\r
-\r
public static synchronized <T> RunnerConfig<T> getSupportedOptions(\r
Class<? extends Executable<T>> clazz) {\r
try {\r
\r
public static void writeInput(List<FastaSequence> sequences,\r
ConfiguredExecutable<?> exec) throws JobSubmissionException {\r
-\r
try {\r
File filein = new File(exec.getInput());\r
FileOutputStream fout = new FileOutputStream(filein);\r
+ e.getLocalizedMessage(), e);\r
}\r
}\r
- \r
+\r
public static void writeClustalInput(List<FastaSequence> sequences,\r
ConfiguredExecutable<?> exec, char gapChar) throws JobSubmissionException {\r
\r
}\r
}\r
\r
- \r
public static RNAStructScoreManager readRNAStruct(String workDirectory,\r
String structFile) throws IOException, FileNotFoundException {\r
\r
new FileInputStream(aliFile));\r
}\r
}\r
- \r
\r
- \r
- public static String readFile(File inputFile) throws \r
- FileNotFoundException, IOException {\r
-\r
- BufferedReader input = new BufferedReader(new FileReader(inputFile));\r
-\r
- String file = new String();\r
- String line = new String();\r
-\r
- while (true) {\r
- line = input.readLine();\r
-\r
- if (line != null) {\r
- file = file + line + "\r\n";\r
- } else break;\r
- }\r
- // Close file\r
- input.close();\r
- return file;\r
- }\r
}\r
\r
\r
\r
import org.apache.log4j.Logger;\r
\r
-import compbio.data.sequence.SMERFSConstraints;\r
import compbio.data.sequence.ScoreManager;\r
import compbio.data.sequence.SequenceUtil;\r
import compbio.engine.client.CommandBuilder;\r
public static final String KEY_VALUE_SEPARATOR = "=";\r
public static final String STAT_FILE = "stat.txt";\r
\r
- private final int windowWidth = SMERFSConstraints.DEFAULT_WINDOW_SIZE;\r
- private final SMERFSConstraints colScoreMethod = SMERFSConstraints.MID_SCORE;\r
- private final double gapTreshold = SMERFSConstraints.DEFAULT_GAP_THRESHOLD;\r
-\r
public AACon() {\r
addParameters(Arrays.asList("-jar", getLibPath(), "-d=" + STAT_FILE,\r
"-f=RESULT_NO_ALIGNMENT"));\r
* This is not a standard DisEMBL! The script has been modified!\r
* \r
*/\r
-public class Disembl extends SkeletalExecutable<Disembl>\r
- implements\r
- PipedExecutable<Disembl> {\r
+public class Disembl extends SkeletalExecutable<Disembl> implements PipedExecutable<Disembl> {\r
\r
private static Logger log = Logger.getLogger(Disembl.class);\r
\r
- public static final String KEY_VALUE_SEPARATOR = Util.SPACE;\r
-\r
/**\r
* For the region to be considered disordered the values must exceed these\r
*/\r
log.trace("DRESULTS: " + results);\r
return results;\r
}\r
+\r
@Override\r
public Disembl setInput(String inFile) {\r
super.setInput(inFile);\r
* This is not a standard GlobPlot! The script has been modified!\r
* \r
*/\r
-public class GlobPlot extends SkeletalExecutable<GlobPlot>\r
- implements\r
- PipedExecutable<GlobPlot> {\r
+public class GlobPlot extends SkeletalExecutable<GlobPlot> implements PipedExecutable<GlobPlot> {\r
\r
private static Logger log = Logger.getLogger(GlobPlot.class);\r
\r
- public static final String KEY_VALUE_SEPARATOR = Util.SPACE;\r
-\r
/* The parameter list there must not contain same values! */\r
public GlobPlot() {\r
// remove default input to prevent it to appear in the parameters list\r
package compbio.runner.disorder;\r
\r
import java.io.File;\r
-import java.io.FileNotFoundException;\r
import java.io.IOException;\r
-import java.util.Arrays;\r
-import java.util.List;\r
import java.util.Map;\r
import java.util.Set;\r
import java.util.TreeMap;\r
import compbio.data.sequence.UnknownFileFormatException;\r
import compbio.engine.client.SkeletalExecutable;\r
import compbio.metadata.ResultNotAvailableException;\r
-import compbio.runner.msa.Mafft;\r
\r
/**\r
* iupred sequenceFile <short long glob >\r
private static final String SHORT_OUTPUT = "out.short";\r
private static final String LONG_OUTPUT = "out.long";\r
\r
- \r
@Override\r
@SuppressWarnings("unchecked")\r
public ScoreManager getResults(String workDirectory)\r
}\r
}\r
\r
- \r
- \r
@Override\r
public IUPred setInput(String inFile) {\r
super.setInput(inFile);\r
return this;\r
} \r
\r
- \r
@Override\r
public IUPred setOutput(String outFile) {\r
log.warn("IUpred output is predefined and cannot be set!"); \r
"are always either of those 3 files (depending on the method called): " + GLOB_OUTPUT + ", " \r
+ SHORT_OUTPUT + ", "+ LONG_OUTPUT);\r
}\r
+\r
@Override\r
public String getOutput() {\r
log.warn("IUpred output is predefined and is one of the three files " +\r
\r
private final String ncorePrm = "-n=";\r
\r
- public static final String KEY_VALUE_SEPARATOR = Util.SPACE;\r
public static final String STAT_FILE = "stat.txt";\r
\r
public Jronn() {\r
String settings = ph.getProperty("jronn.jar.file");\r
if (compbio.util.Util.isEmpty(settings)) {\r
throw new NullPointerException(\r
- "Please define jronn.jar.file property in Executable.properties file"\r
- + "and initialize it with the location of jronn jar file");\r
+ "Please define jronn.jar.file property in Executable.properties file and initialize it with the location of jronn jar file");\r
}\r
if (new File(settings).isAbsolute()) {\r
// Jronn jar can be found so no actions necessary\r
public class ClustalO extends SkeletalExecutable<ClustalO> {\r
\r
private static Logger log = Logger.getLogger(ClustalO.class);\r
+\r
private static final String EXEC_STAT_FILE = "stat.log";\r
- \r
\r
public static final String KEY_VALUE_SEPARATOR = "=";\r
\r
- /*\r
+ /**\r
* Number of cores parameter name\r
*/\r
private final static String ncorePrm = "--threads";\r
*/\r
private int ncoreNumber = 0;\r
\r
- \r
/**\r
* --threads=<n> Number of processors to use\r
* \r
*/\r
public ClustalO() {\r
super(KEY_VALUE_SEPARATOR);\r
- addParameters(Arrays.asList("--outfmt=clustal", "-v", "--log="\r
- + EXEC_STAT_FILE));\r
+ addParameters(Arrays.asList("--outfmt=clustal", "-v", "--log=" + EXEC_STAT_FILE));\r
// set default in, outs and err files\r
this.setInput(super.inputFile);\r
this.setOutput(super.outputFile);\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
+ throw new IndexOutOfBoundsException("Number of cores must be within 1 and 100 ");\r
}\r
this.ncoreNumber = ncoreNumber;\r
cbuilder.setParam(ncorePrm, Integer.toString(getNCore()));\r
return ncoreNumber;\r
}\r
\r
-\r
}\r
convertInputNameToTreeName());\r
}\r
\r
- /*\r
+ /**\r
* Clustal output tree with same name as input file but .dnd extension e.g.\r
* this methods do similar conversion TO122.fasta -> TO122.dnd or\r
* TO122.fasta.in -> TO122.fasta.dnd It does not seems that there is any\r
\r
private final String MATRIX_PAR_NAME = "--aamatrix";\r
\r
- public static final String KEY_VALUE_SEPARATOR = Util.SPACE;\r
+ public static final String KEY_VALUE_SEPARATOR = " ";\r
\r
public Mafft() {\r
// remove default input to prevent it to appear in the parameters list\r
\r
private static final String EXEC_STAT_FILE = "stat.log";\r
\r
- public static final String KEY_VALUE_SEPARATOR = Util.SPACE;\r
+ public static final String KEY_VALUE_SEPARATOR = " ";\r
\r
/**\r
* Default options are\r
\r
private final static String ANNOTATION = "annotation.txt";\r
\r
- public static final String KEY_VALUE_SEPARATOR = Util.SPACE;\r
+ public static final String KEY_VALUE_SEPARATOR = " ";\r
\r
/**\r
*/\r
\r
private static Logger log = Logger.getLogger(Tcoffee.class);\r
\r
- private static PropertyHelper ph = PropertyHelperManager\r
- .getPropertyHelper();\r
+ private static PropertyHelper ph = PropertyHelperManager.getPropertyHelper();\r
\r
public static final String KEY_VALUE_SEPARATOR = "=";\r
\r
package compbio.runner.structure;\r
\r
-\r
import java.io.FileNotFoundException;\r
import java.io.IOException;\r
\r
\r
public class RNAalifold extends SkeletalExecutable<RNAalifold> \r
implements PipedExecutable<RNAalifold> {\r
- \r
- \r
+\r
private static Logger log = Logger.getLogger(RNAalifold.class);\r
\r
// May not be necessary as defult is "<space>" but still dont know\r
// How to deal with different key value separators for different params\r
- public static final String KEY_VALUE_SEPARATOR = Util.SPACE;\r
+ public static final String KEY_VALUE_SEPARATOR = " ";\r
\r
public RNAalifold() {\r
super(KEY_VALUE_SEPARATOR);\r
throws ResultNotAvailableException {\r
try {\r
return Util.readRNAStruct(workDirectory, getOutput());\r
- \r
} catch (FileNotFoundException e) {\r
log.error(e.getMessage(), e.getCause());\r
throw new ResultNotAvailableException(e);\r
\r
import java.io.File;\r
import java.io.FileFilter;\r
-import java.io.IOException;\r
-import java.sql.SQLException;\r
-import java.text.SimpleDateFormat;\r
-import java.util.ArrayList;\r
import java.util.Date;\r
\r
import org.apache.log4j.Logger;\r
\r
import compbio.engine.Cleaner;\r
-import compbio.engine.client.Executable;\r
import compbio.engine.client.PathValidator;\r
-import compbio.engine.client.SkeletalExecutable;\r
-import compbio.metadata.JobStatus;\r
import compbio.stat.collector.JobStat;\r
-import compbio.util.FileUtil;\r
\r
/**\r
* Number of runs of each WS = number of folders with name\r
\r
private static boolean compareLines(File input, String[] reference) {\r
BufferedReader reader = null;\r
+ boolean status = true;\r
try {\r
reader = new BufferedReader(new FileReader(input));\r
// only compare first four lines of the file with reference\r
for (int i = 0; i < 4; i++) {\r
String line = reader.readLine();\r
if (Util.isEmpty(line)) {\r
- return false;\r
+ status = false;\r
+ break;\r
}\r
line = line.trim();\r
if (!line.equals(reference[i].trim())) {\r
- return false;\r
+ status = false;\r
+ break;\r
}\r
}\r
reader.close();\r
} finally {\r
FileUtil.closeSilently(reader);\r
}\r
- return true;\r
+ return status;\r
}\r
}\r
toCal.add(Calendar.MONTH, 1);\r
\r
try {\r
- StatCollection stats = StatCollection.newStatCollecton(fromDate,\r
- toCal.getTime());\r
+ StatCollection stats = StatCollection.newStatCollecton(fromDate, toCal.getTime());\r
\r
log.trace("Stats: " + stats);\r
req.setAttribute("stat", stats);\r
req.setAttribute("statTotal", Totals.sumStats(stats.getAllStat()));\r
- req.setAttribute("statTotalCluster",\r
- Totals.sumStats(stats.getClusterStat()));\r
- req.setAttribute("statTotalLocal",\r
- Totals.sumStats(stats.getLocalStat()));\r
+ req.setAttribute("statTotalCluster", Totals.sumStats(stats.getClusterStat()));\r
+ req.setAttribute("statTotalLocal", Totals.sumStats(stats.getLocalStat()));\r
\r
req.setAttribute("startDate", fromDate);\r
req.setAttribute("stopDate", toCal.getTime());\r
log.trace("from " + fromDate + " to " + toCal.getTime());\r
- RequestDispatcher dispatcher = req\r
- .getRequestDispatcher("statpages/Statistics.jsp");\r
+ RequestDispatcher dispatcher = req.getRequestDispatcher("statpages/Statistics.jsp");\r
dispatcher.forward(req, resp);\r
-\r
} catch (SQLException e) {\r
log.error(e.getMessage(), e);\r
throw new ServletException(e);\r
}\r
-\r
}\r
+\r
}\r
// convert it to http://localhost:8080/jabaws\r
StringBuffer jabawspath = req.getRequestURL();\r
jabawspath = jabawspath.delete(\r
- jabawspath.indexOf("/"\r
- + HttpCodeResponseServiceStatus.class.getSimpleName()),\r
+ jabawspath.indexOf("/" + HttpCodeResponseServiceStatus.class.getSimpleName()),\r
jabawspath.length());\r
boolean operating = false;\r
// save for the future use\r
"Service: " + failedService\r
+ "\n is not available! Error message:\n "\r
+ failMessage);\r
-\r
}\r
-\r
}\r
+\r
}\r
\r
import compbio.stat.collector.StatDB;\r
import compbio.stat.collector.StatProcessor;\r
-import compbio.stat.servlet.DisplayStat;\r
import compbio.ws.client.Services;\r
\r
public class StatCollection {\r
*/\r
public class AAConClient {\r
\r
- /*\r
+ /**\r
* Use java.util.Logger instead of log4j logger to reduce the size of the\r
* client package\r
*/\r
- private static final Logger log = Logger.getLogger(AAConClient.class\r
- .getCanonicalName());\r
+ private static final Logger log = Logger.getLogger(AAConClient.class.getCanonicalName());\r
\r
/**\r
* The fully qualified web service namespace\r
* Web service host\r
*/\r
static final String hostname = "http://www.compbio.dundee.ac.uk/aacon";\r
- // static final String hostname = "http://localhost:8080/jabaws";\r
\r
/**\r
* Web service name\r
*/\r
@SuppressWarnings("unchecked")\r
AAConClient(String[] cmd) throws IOException {\r
-\r
File inputFile = IOHelper.getFile(cmd, inputkey, true);\r
File outFile = IOHelper.getFile(cmd, outputkey, false);\r
File parametersFile = IOHelper.getFile(cmd, paramFile, true);\r
List<Option<AAConWS>> customOptions = null;\r
if (parametersFile != null) {\r
List<String> prms = IOHelper.loadParameters(parametersFile);\r
- customOptions = MetadataHelper.processParameters(prms,\r
- msaws.getRunnerOptions());\r
+ customOptions = MetadataHelper.processParameters(prms, msaws.getRunnerOptions());\r
}\r
ScoreManager result = null;\r
if (inputFile != null) {\r
try {\r
result.writeOut(writer);\r
} catch (IOException e) {\r
- System.err\r
- .println("Problems writing output file! Stack trace is below: ");\r
+ System.err.println("Problems writing output file! Stack trace is below: ");\r
e.printStackTrace();\r
} finally {\r
if (writer != null) {\r
QName portName = new QName(QUALIFIED_SERVICE_NAME, "AAConWS" + "Port");\r
\r
@SuppressWarnings("unchecked")\r
- SequenceAnnotation<AAConWS> serviceIF = serv.getPort(portName,\r
- SequenceAnnotation.class);\r
+ SequenceAnnotation<AAConWS> serviceIF = serv.getPort(portName, SequenceAnnotation.class);\r
\r
log.log(Level.FINE, "Connected successfully!");\r
return serviceIF;\r
\r
String jobId = null;\r
if (customOptions != null && preset != null) {\r
- System.out\r
- .println("WARN: Parameters (-f) are defined together with a preset (-r) ignoring preset!");\r
+ System.out.println("WARN: Parameters (-f) are defined together with a preset (-r) ignoring preset!");\r
}\r
if (customOptions != null) {\r
jobId = wsproxy.customAnalize(fastalist, customOptions);\r
scores = wsproxy.getAnnotation(jobId);\r
\r
} catch (IOException e) {\r
- System.err\r
- .println("Exception while reading the input file. "\r
+ System.err.println("Exception while reading the input file. "\r
+ "Check that the input file contains a list of fasta formatted sequences! "\r
+ "Exception details are below:");\r
e.printStackTrace();\r
} catch (JobSubmissionException e) {\r
- System.err\r
- .println("Exception while submitting job to a web server. "\r
+ System.err.println("Exception while submitting job to a web server. "\r
+ "Exception details are below:");\r
e.printStackTrace();\r
} catch (ResultNotAvailableException e) {\r
// ignore and propagate an interruption\r
Thread.currentThread().interrupt();\r
} catch (WrongParameterException e) {\r
- System.err\r
- .println("Exception while parsing the web method input parameters. "\r
+ System.err.println("Exception while parsing the web method input parameters. "\r
+ "Exception details are below:");\r
e.printStackTrace();\r
} catch (UnknownFileFormatException e) {\r
- System.err\r
- .println("Exception while attempting to read the input file "\r
- + "Exception details are below:");\r
+ System.err.println("Exception while attempting to read the input file "\r
+ + "Exception details are below:");\r
System.out.println(e.getMessage());\r
e.printStackTrace();\r
}\r
*/\r
static void printUsage(int exitStatus) {\r
System.out.println();\r
- System.out.println("Usage: <Class or Jar file name> "\r
- + " ACTION [OPTIONS] ");\r
+ System.out.println("Usage: <Class or Jar file name> ACTION [OPTIONS] ");\r
System.out.println();\r
System.out.println("ACTIONS: ");\r
- System.out\r
- .println(inputkey\r
- + pseparator\r
- + "<inputFile> - full path to fasta or Clustal formatted alignment file ");\r
- System.out.println(paramList\r
- + " - lists parameters supported by web service");\r
- System.out.println(presetList\r
- + " - lists presets supported by web service");\r
+ System.out.println(inputkey + pseparator + "<inputFile> - full path to fasta or Clustal formatted alignment file ");\r
+ System.out.println(paramList + " - lists parameters supported by web service");\r
+ System.out.println(presetList + " - lists presets supported by web service");\r
System.out.println(limitList + " - lists web services limits");\r
- System.out\r
- .println("Please note that if input file is specified other actions are ignored");\r
-\r
- System.out.println();\r
+ System.out.println("Please note that if input file is specified other actions are ignored\n");\r
System.out.println("OPTIONS (only for use with -i action):");\r
-\r
- System.out.println(presetkey + pseparator\r
- + "<presetName> - name of the preset to use");\r
- System.out\r
- .println(outputkey\r
- + pseparator\r
- + "<outputFile> - full path to the file where to write the result");\r
- System.out\r
- .println("-f=<parameterInputFile> - the name of the file with the list of parameters to use.");\r
- System.out\r
- .println("Please note that -r and -f options cannot be used together. "\r
- + "Conservation is calculated with either a preset or "\r
- + "the parameters from the file, but not both!");\r
-\r
+ System.out.println(presetkey + pseparator + "<presetName> - name of the preset to use");\r
+ System.out.println(outputkey + pseparator + "<outputFile> - full path to the file where to write the result");\r
+ System.out.println("-f=<parameterInputFile> - the name of the file with the list of parameters to use.");\r
+ System.out.println("Please note that -r and -f options cannot be used together. "\r
+ + "Conservation is calculated with either a preset or parameters from the file, but not both!");\r
System.exit(exitStatus);\r
}\r
\r
try {\r
new AAConClient(args);\r
} catch (IOException e) {\r
- log.log(Level.SEVERE, "IOException in client! " + e.getMessage(),\r
- e.getCause());\r
+ log.log(Level.SEVERE, "IOException in client! " + e.getMessage(), e.getCause());\r
System.err.println("Cannot write output file! Stack trace: ");\r
e.printStackTrace();\r
}\r
import java.io.FileInputStream;\r
import java.io.FileOutputStream;\r
import java.io.IOException;\r
-import java.io.OutputStream;\r
import java.io.PrintWriter;\r
import java.io.Writer;\r
import java.net.ConnectException;\r
import compbio.data.msa.RegistryWS;\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.FastaSequence;\r
import compbio.data.sequence.ScoreManager;\r
* \r
*/\r
public static void main(String[] args) {\r
-\r
if (args == null) {\r
System.out.println(Constraints.help_text);\r
System.exit(1);\r
System.out.println(Constraints.help_text);\r
System.exit(1);\r
}\r
-\r
try {\r
new Jws2Client(args);\r
} catch (IOException e) {\r
\r
private static final Logger log = Logger.getLogger(GAUtils.class);\r
\r
- static PropertyHelper PROP_HELPER = PropertyHelperManager\r
- .getPropertyHelper();\r
+ static PropertyHelper PROP_HELPER = PropertyHelperManager.getPropertyHelper();\r
\r
// compbio.dundee.ac.uk GA tracker\r
- private static AnalyticsConfigData config = new AnalyticsConfigData(\r
- "UA-5356328-1");\r
+ private static AnalyticsConfigData config = new AnalyticsConfigData("UA-5356328-1");\r
\r
private static GoogleAnalyticsTracker TRACKER = new GoogleAnalyticsTracker(\r
config);\r
\r
static <T> void reportUsage(ConfiguredExecutable<T> confExec, Logger logger) {\r
if (GAUtils.IS_GA_ENABLED) {\r
- Services service = ServicesUtil.getServiceByRunner(confExec\r
- .getExecutable().getClass());\r
+ Services service = ServicesUtil.getServiceByRunner(confExec.getExecutable().getClass());\r
GAUtils.reportUsage(service);\r
logger.info("Reporting GA usage for " + service);\r
}\r
if (limit != null && limit.isExceeded(sequences)) {\r
throw LimitExceededException.newLimitExceeded(limit, sequences);\r
}\r
- log.debug("Method: " + method + " with task: " + confExec.getTaskId());\r
compbio.runner.Util.writeInput(sequences, confExec);\r
AsyncExecutor engine = Configurator.getAsyncEngine(confExec);\r
String jobId = engine.submitJob(confExec);\r
reportUsage(confExec, log);\r
return jobId;\r
}\r
- \r
- // Same as analize but Alifold takes clustal input not fasta\r
+\r
+ // Same as analize(...) but RNAalifold takes clustal input not fasta\r
// An if condition in the above method might be a better solution but \r
// you need a way of finding out the type of confExec at runtime\r
\r
if (limit != null && limit.isExceeded(sequences)) {\r
throw LimitExceededException.newLimitExceeded(limit, sequences);\r
}\r
- log.debug("Method: " + method + " with task: " + confExec.getTaskId());\r
- // This line is different from the above method\r
compbio.runner.Util.writeClustalInput(sequences, confExec, '-');\r
AsyncExecutor engine = Configurator.getAsyncEngine(confExec);\r
String jobId = engine.submitJob(confExec);\r
AsyncExecutor asyncEngine = Configurator.getAsyncEngine(jobId);\r
ConfiguredExecutable<T> aacon = (ConfiguredExecutable<T>) asyncEngine.getResults(jobId);\r
ScoreManager mas = aacon.getResults();\r
- \r
log.trace(jobId + " getConservation : " + mas);\r
return mas;\r
}\r
- \r
\r
- /*\r
- * UNUSED\r
- * \r
- * @SuppressWarnings("unchecked") static <T> LimitsManager<T>\r
- * getLimits(Class<? extends Executable<T>> clazz, WebServiceContext\r
- * wsContext) {\r
- * \r
- * String LIMIT_KEY = CACHE_KEY + clazz.getCanonicalName(); LimitsManager<T>\r
- * limit = (LimitsManager<T>) getObjectFromApplContext( LIMIT_KEY,\r
- * wsContext); if (limit == null) { synchronized (WSUtil.class) { limit =\r
- * (LimitsManager<T>) getObjectFromApplContext(LIMIT_KEY, wsContext); if\r
- * (limit == null) { limit = compbio.runner.Util\r
- * .getLimits((Class<Executable<T>>) clazz);\r
- * addObjectToApplContext(wsContext, LIMIT_KEY, limit); } } } return limit;\r
- * }\r
- * \r
- * static void addObjectToApplContext(WebServiceContext wsContext, String\r
- * objKey, Object obj) { assert !Util.isEmpty(objKey) :\r
- * "Key for the object must not be empty! "; assert wsContext != null;\r
- * \r
- * ServletContext ctx = ((javax.servlet.ServletContext) wsContext\r
- * .getMessageContext().get(MessageContext. SERVLET_CONTEXT)); assert ctx !=\r
- * null; log.debug("Adding object with key '" + objKey + "' and value '" +\r
- * obj + "' to the application context"); ctx.setAttribute(objKey, obj); }\r
- * static Object getObjectFromApplContext(String objKey, WebServiceContext\r
- * wsContext) { assert !Util.isEmpty(objKey) :\r
- * "Key for the object must not be empty! "; assert wsContext != null;\r
- * \r
- * ServletContext ctx = ((javax.servlet.ServletContext) wsContext\r
- * .getMessageContext().get(MessageContext. SERVLET_CONTEXT)); Object obj =\r
- * ctx.getAttribute(objKey); log.trace("Retrieving object with key '" +\r
- * objKey + "' and value '" + obj + "' from the application context");\r
- * return obj; }\r
- */\r
}\r