From: kjvdheide Date: Thu, 1 Feb 2018 15:44:22 +0000 (+0000) Subject: JAL-2890 created tree job class that encapsulates all needed parameters X-Git-Url: http://source.jalview.org/gitweb/?a=commitdiff_plain;h=8701c847b6298321ce344babd096c97811bef782;p=jalview.git JAL-2890 created tree job class that encapsulates all needed parameters --- diff --git a/src/jalview/ext/cipres/TreeJob.java b/src/jalview/ext/cipres/TreeJob.java new file mode 100644 index 0000000..1a0b550 --- /dev/null +++ b/src/jalview/ext/cipres/TreeJob.java @@ -0,0 +1,104 @@ +package jalview.ext.cipres; + +import java.util.Collection; +import java.util.HashMap; +import java.util.Map; + +import org.ngbw.directclient.CiApplication; +import org.ngbw.directclient.CiClient; + +public class TreeJob +{ + + private final CiClient cipresClient; + + private final CiApplication app = CiApplication.getInstance(); + + private Map> vParams = new HashMap<>(); + + private Map inputParams = new HashMap<>(); + + private Map metadata = new HashMap<>(); + + public TreeJob() + { + cipresClient = new CiClient( + app.getAppKey(), app.getUsername(), app.getPassword(), + app.getRestUrl() + ); + + } + + public TreeJob(String alignmentFilePath) + { + cipresClient = new CiClient( + app.getAppKey(), app.getUsername(), app.getPassword(), + app.getRestUrl() + ); + inputParams.put("infile_", alignmentFilePath); + } + + /** + * Specifies a parameter about the input data for a CIPRES job with its value, + * for example the "infile_" parameter for the MSA file to calculate a tree + * from with file path as value. + * + * @param parameter + * @param value + */ + public void addInputParameter(String parameter, String value) + { + inputParams.put(parameter, value); + + } + + /** + * Adds a CIPRES tool parameter that specifies job behaviour, for example + * "runtime_" with the maximum runtime (in hours) as value. + * + * @param parameter + * @param values + */ + public void addToolParameters(String parameter, Collection values) + { + vParams.put(parameter, values); + } + + /** + * Adds a metadata tag to the job, for example "clientJobName" with the name + * that this job should be referred by as value. CIPRES highly recommends all + * jobs are given a clientJobId metadata header. + * + * @param metadataHeader + * @param value + */ + public void addMetadata(String metadataHeader, String value) + { + metadata.put(metadataHeader, value); + } + + public void clearAllParameters() + { + vParams.clear(); + inputParams.clear(); + metadata.clear(); + } + + public void clearInputParameters() + { + inputParams.clear(); + } + + public void clearToolsParameters() + { + vParams.clear(); + } + + public void clearMetadata() + { + metadata.clear(); + } + + + +}