From 1a4c92c96d5ba229604f5b3eb332e90d893622dd Mon Sep 17 00:00:00 2001 From: Aaron Petkau Date: Fri, 31 Aug 2018 10:40:51 -0500 Subject: [PATCH] Updating example workflow --- .gitignore | 4 + pom.xml | 138 +++++++------ .../bioinformatics/irida/ExamplePlugin.java | 58 ------ .../irida/plugins/ExamplePlugin.java | 76 +++++++ .../resources/messages/messages_en.properties | 1 - .../workflows/0.1.0/irida_workflow.xml | 20 ++ .../0.1.0/irida_workflow_structure.ga | 192 ++++++++++++++++++ .../workflows/0.1.0/messages_en.properties | 10 + 8 files changed, 378 insertions(+), 121 deletions(-) delete mode 100644 src/main/java/ca/corefacility/bioinformatics/irida/ExamplePlugin.java create mode 100644 src/main/java/ca/corefacility/bioinformatics/irida/plugins/ExamplePlugin.java delete mode 100644 src/main/resources/messages/messages_en.properties create mode 100644 src/main/resources/workflows/0.1.0/irida_workflow.xml create mode 100644 src/main/resources/workflows/0.1.0/irida_workflow_structure.ga create mode 100644 src/main/resources/workflows/0.1.0/messages_en.properties diff --git a/.gitignore b/.gitignore index f83e8cf..eacd853 100644 --- a/.gitignore +++ b/.gitignore @@ -1,3 +1,7 @@ .idea target *.iml +/.classpath +/.project +/.settings +/bin diff --git a/pom.xml b/pom.xml index 316900d..9380298 100644 --- a/pom.xml +++ b/pom.xml @@ -1,75 +1,89 @@ - 4.0.0 + xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> + 4.0.0 - ca.tom - testPlugin - 1.0-SNAPSHOT + ca.tom + example-plugin + 1.0-SNAPSHOT - - - ca.corefacility.bioinformatics - irida - 0.23.0-SNAPSHOT - classes - + + + example-plugin + ca.corefacility.bioinformatics.irida.plugins.ExamplePlugin + 0.1.0 + Aaron Petkau + + 1.0.0 - - org.pf4j - pf4j - 2.3.0 - provided - - + + 0.23.0-SNAPSHOT + + + 2.4.0 - - - - - org.apache.maven.plugins - maven-compiler-plugin - 3.1 - - 1.8 - 1.8 - true - - + + 1.8 + - - org.apache.maven.plugins - maven-jar-plugin + + + ca.corefacility.bioinformatics + irida + ${irida.version} + classes + - - - - ca.corefacility.bioinformatics.irida.ExamplePlugin - - plugin-example - Tom Matthews - 0.0.1 - - - - + + org.pf4j + pf4j + ${pf4j.version} + provided + + - - org.apache.maven.plugins - maven-assembly-plugin - 2.6 - - - jar-with-dependencies - - - + + + + org.apache.maven.plugins + maven-compiler-plugin + 3.1 + + ${java.version} + ${java.version} + true + + - - - - + + org.apache.maven.plugins + maven-jar-plugin + + + + ${plugin.class} + ${plugin.dependencies} + ${plugin.id} + ${plugin.provider} + ${plugin.version} + ${plugin.requires} + + + + + + org.apache.maven.plugins + maven-assembly-plugin + 2.6 + + + jar-with-dependencies + + + + + diff --git a/src/main/java/ca/corefacility/bioinformatics/irida/ExamplePlugin.java b/src/main/java/ca/corefacility/bioinformatics/irida/ExamplePlugin.java deleted file mode 100644 index 559f226..0000000 --- a/src/main/java/ca/corefacility/bioinformatics/irida/ExamplePlugin.java +++ /dev/null @@ -1,58 +0,0 @@ -package ca.corefacility.bioinformatics.irida; - -import ca.corefacility.bioinformatics.irida.pipeline.results.AnalysisSampleUpdater; -import ca.corefacility.bioinformatics.irida.plugins.IridaPlugin; -import ca.corefacility.bioinformatics.irida.plugins.IridaPluginException; -import ca.corefacility.bioinformatics.irida.service.sample.MetadataTemplateService; -import ca.corefacility.bioinformatics.irida.service.sample.SampleService; -import org.pf4j.Extension; -import org.pf4j.Plugin; -import org.pf4j.PluginException; -import org.pf4j.PluginWrapper; - -import java.io.IOException; -import java.io.InputStream; -import java.util.Optional; -import java.util.Properties; - -/** - * An example {@link IridaPlugin} implementation - */ -public class ExamplePlugin extends Plugin { - - public ExamplePlugin(PluginWrapper wrapper) { - super(wrapper); - } - - @Override - public void start() throws PluginException { - System.out.println("Example IRIDA plugin loaded"); - } - - @Extension - public static class PluginInfo implements IridaPlugin { - - @Override - public Properties getMessages() throws IridaPluginException { - - ClassLoader classLoader = getClass().getClassLoader(); - - Properties prop = new Properties(); - - try (InputStream resourceAsStream = classLoader.getResourceAsStream("messages/messages_en.properties");) { - prop.load(resourceAsStream); - } catch (IOException e) { - throw new IridaPluginException("Cannot load messages", e); - } - - return prop; - } - - @Override - public Optional getUpdater(MetadataTemplateService metadataTemplateService, - SampleService sampleService) { - return Optional.empty(); - } - } - -} diff --git a/src/main/java/ca/corefacility/bioinformatics/irida/plugins/ExamplePlugin.java b/src/main/java/ca/corefacility/bioinformatics/irida/plugins/ExamplePlugin.java new file mode 100644 index 0000000..c418c14 --- /dev/null +++ b/src/main/java/ca/corefacility/bioinformatics/irida/plugins/ExamplePlugin.java @@ -0,0 +1,76 @@ +package ca.corefacility.bioinformatics.irida.plugins; + +import java.awt.Color; +import java.util.Optional; +import java.util.UUID; + +import org.pf4j.Extension; +import org.pf4j.Plugin; +import org.pf4j.PluginWrapper; + +import ca.corefacility.bioinformatics.irida.model.workflow.analysis.type.AnalysisType; +import ca.corefacility.bioinformatics.irida.plugins.IridaPlugin; + +/** + * An example {@link IridaPlugin} implementation + */ +public class ExamplePlugin extends Plugin { + + public ExamplePlugin(PluginWrapper wrapper) { + super(wrapper); + } + + @Extension + public static class PluginInfo implements IridaPlugin { + + /*************************************************************************************** + * Required methods + * + * These methods are required to be overridden when implementing a pipeline as a plugin. + ***************************************************************************************/ + + /** + * Gets the particular {@link AnalysisType} object for this workflow. + * This should correspond to the analysisType entry in the irida_workflow.xml file. + * + *
{@code FIRST_LINES}
+ */ + @Override + public AnalysisType getAnalysisType() { + return new AnalysisType("FIRST_LINES"); + } + + /** + * Gets the particular workflow id. + * This should correspond to the id entry in the irida_workflow.xml file. + * + *
{@code c07a0d4c-fb53-4183-8ded-298f8a4decca}
+ */ + @Override + public UUID getDefaultWorkflowUUID() { + return UUID.fromString("c07a0d4c-fb53-4183-8ded-298f8a4decca"); + } + + /********************************************************************************************************************* + * Optional methods. + * + * These methods are not required to be overridden but can be used to adjust the appearance/behaviour of the pipeline. + *********************************************************************************************************************/ + + /** + * Defines the background color in the IRIDA UI corresponding to this pipeline. + */ + @Override + public Optional getBackgroundColor() { + return Optional.of(Color.decode("#7fcdbb")); + } + + /** + * Defines the text color in the IRIDA UI corresponding to this pipeline. + */ + @Override + public Optional getTextColor() { + return Optional.of(Color.BLACK); + } + } +} diff --git a/src/main/resources/messages/messages_en.properties b/src/main/resources/messages/messages_en.properties deleted file mode 100644 index 0e0d774..0000000 --- a/src/main/resources/messages/messages_en.properties +++ /dev/null @@ -1 +0,0 @@ -irida.plugin.message=Example message from plugin \ No newline at end of file diff --git a/src/main/resources/workflows/0.1.0/irida_workflow.xml b/src/main/resources/workflows/0.1.0/irida_workflow.xml new file mode 100644 index 0000000..106a859 --- /dev/null +++ b/src/main/resources/workflows/0.1.0/irida_workflow.xml @@ -0,0 +1,20 @@ + + + c07a0d4c-fb53-4183-8ded-298f8a4decca + FirstLines + 0.1.0 + FIRST_LINES + + fastq_paired + true + + + + + + + + + + + diff --git a/src/main/resources/workflows/0.1.0/irida_workflow_structure.ga b/src/main/resources/workflows/0.1.0/irida_workflow_structure.ga new file mode 100644 index 0000000..625fc38 --- /dev/null +++ b/src/main/resources/workflows/0.1.0/irida_workflow_structure.ga @@ -0,0 +1,192 @@ +{ + "a_galaxy_workflow": "true", + "annotation": "", + "format-version": "0.1", + "name": "Select first number of lines", + "steps": { + "0": { + "annotation": "", + "content_id": null, + "errors": null, + "id": 0, + "input_connections": {}, + "inputs": [ + { + "description": "", + "name": "fastq_paired" + } + ], + "label": "fastq_paired", + "name": "Input dataset collection", + "outputs": [], + "position": { + "left": 200, + "top": 200 + }, + "tool_id": null, + "tool_state": "{\"collection_type\": \"list:paired\", \"name\": \"fastq_paired\"}", + "tool_version": null, + "type": "data_collection_input", + "uuid": "6c0e8d85-c804-45e9-b353-6cd5594e7299", + "workflow_outputs": [ + { + "label": null, + "output_name": "output", + "uuid": "dd7723a2-b3d0-49de-9ad1-c6c625456ed6" + } + ] + }, + "1": { + "annotation": "", + "content_id": "Show beginning1", + "errors": null, + "id": 1, + "input_connections": { + "input": { + "id": 0, + "output_name": "output" + } + }, + "inputs": [ + { + "description": "runtime parameter for tool Select first", + "name": "input" + } + ], + "label": null, + "name": "Select first", + "outputs": [ + { + "name": "out_file1", + "type": "input" + } + ], + "position": { + "left": 464, + "top": 200 + }, + "post_job_actions": { + "HideDatasetActionout_file1": { + "action_arguments": {}, + "action_type": "HideDatasetAction", + "output_name": "out_file1" + } + }, + "tool_id": "Show beginning1", + "tool_state": "{\"__page__\": 0, \"lineNum\": \"\\\"4\\\"\", \"__rerun_remap_job_id__\": null, \"input\": \"{\\\"__class__\\\": \\\"RuntimeValue\\\"}\"}", + "tool_version": "1.0.0", + "type": "tool", + "uuid": "081b906f-0325-4189-8e55-c507211f59e9", + "workflow_outputs": [] + }, + "2": { + "annotation": "", + "content_id": "__UNZIP_COLLECTION__", + "errors": null, + "id": 2, + "input_connections": { + "input": { + "id": 1, + "output_name": "out_file1" + } + }, + "inputs": [ + { + "description": "runtime parameter for tool Unzip Collection", + "name": "input" + } + ], + "label": null, + "name": "Unzip Collection", + "outputs": [ + { + "name": "forward", + "type": "data" + }, + { + "name": "reverse", + "type": "data" + } + ], + "position": { + "left": 692, + "top": 200 + }, + "post_job_actions": { + "HideDatasetActionforward": { + "action_arguments": {}, + "action_type": "HideDatasetAction", + "output_name": "forward" + }, + "HideDatasetActionreverse": { + "action_arguments": {}, + "action_type": "HideDatasetAction", + "output_name": "reverse" + } + }, + "tool_id": "__UNZIP_COLLECTION__", + "tool_state": "{\"input\": \"{\\\"__class__\\\": \\\"RuntimeValue\\\"}\", \"__rerun_remap_job_id__\": null, \"__page__\": 0}", + "tool_version": "1.0.0", + "type": "tool", + "uuid": "70dcb263-50f5-4de1-9a2b-e08c5e5660fc", + "workflow_outputs": [] + }, + "3": { + "annotation": "", + "content_id": "cat1", + "errors": null, + "id": 3, + "input_connections": { + "input1": { + "id": 2, + "output_name": "forward" + }, + "queries_0|input2": { + "id": 2, + "output_name": "reverse" + } + }, + "inputs": [ + { + "description": "runtime parameter for tool Concatenate datasets", + "name": "input1" + } + ], + "label": null, + "name": "Concatenate datasets", + "outputs": [ + { + "name": "out_file1", + "type": "input" + } + ], + "position": { + "left": 921, + "top": 200 + }, + "post_job_actions": { + "RenameDatasetActionout_file1": { + "action_arguments": { + "newname": "first-lines.txt" + }, + "action_type": "RenameDatasetAction", + "output_name": "out_file1" + } + }, + "tool_id": "cat1", + "tool_state": "{\"__page__\": 0, \"__rerun_remap_job_id__\": null, \"input1\": \"{\\\"__class__\\\": \\\"RuntimeValue\\\"}\", \"queries\": \"[{\\\"input2\\\": {\\\"__class__\\\": \\\"RuntimeValue\\\"}, \\\"__index__\\\": 0}]\"}", + "tool_version": "1.0.0", + "type": "tool", + "uuid": "5daee5ef-60f5-4e91-9903-a0a2883ccdba", + "workflow_outputs": [ + { + "label": null, + "output_name": "out_file1", + "uuid": "06d34b1b-eca6-4c40-b42b-e3983156a5ff" + } + ] + } + }, + "tags": [], + "uuid": "ebebd999-93a2-4fe8-aa22-c45303703f1b" +} diff --git a/src/main/resources/workflows/0.1.0/messages_en.properties b/src/main/resources/workflows/0.1.0/messages_en.properties new file mode 100644 index 0000000..ea54488 --- /dev/null +++ b/src/main/resources/workflows/0.1.0/messages_en.properties @@ -0,0 +1,10 @@ +#Pipeline Info Properties +#Thu Aug 30 14:51:58 CDT 2018 +pipeline.h1.FirstLines=FirstLines Pipeline +pipeline.title.FirstLines=Pipelines - FirstLines +workflow.FIRST_LINES.title=FirstLines Pipeline +workflow.FIRST_LINES.description= +pipeline.parameters.modal-title.firstlines=FirstLines Pipeline Parameters +#Tool Parameters - Tool: Show beginning1 - Workflow Step #: 1 +#Thu Aug 30 14:51:58 CDT 2018 +pipeline.parameters.firstlines.show-beginning1-1-lineNum=Number of lines from each file