diff wgmlst_add.xml @ 0:a3cc35af3635 draft

planemo upload for repository https://github.com/bvalot/pyMLST commit 13edfab02a5da9e374c38ecbd0e229ec0f8d53bb
author bvalot
date Thu, 16 Jun 2022 12:32:28 +0000
parents
children 5b2c48fa0175
line wrap: on
line diff
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/wgmlst_add.xml	Thu Jun 16 12:32:28 2022 +0000
@@ -0,0 +1,192 @@
+<tool id="wgmlst_add_wrapper" name="Add strain to cg/wgMLST database" version="2.1.3">
+  <description></description>
+  <requirements>
+	<requirement type="package" version="2.1.3">pymlst</requirement>
+  </requirements>
+  <stdio>
+    <exit_code range="1:" level="fatal" />
+  </stdio>
+  <version_command>wgMLST -v</version_command>
+  <command><![CDATA[
+	cp '${database}' '${databaseout}' &&
+    wgMLST 
+	#if $data.input == "fasta"
+	  add
+	#else
+	  add2
+	#end if
+	#if str($coverage)
+	  -c $coverage
+	#end if
+	#if str($identity)
+	  -i $identity
+	#end if
+	#if $data.input == "fasta"
+	  #if $strain
+	    -s '$strain'
+	  #else
+	    -s '$data.fastain.name.replace(" ", "_").replace("-", "_")'
+	  #end if
+      '${databaseout}' '${data.fastain}'
+    #end if
+	#if $data.input == "fastqsingle"
+	  #if str($data.reads)
+	    -r $data.reads
+	  #end if
+	  #if $strain
+	    -s '$strain'
+	  #else
+	    -s '$data.single.name.replace(" ", "_").replace("-", "_")'
+	  #end if
+	  '${databaseout}' '${data.single}'
+    #end if
+	#if $data.input == "fastqpaired"
+	  #if str($data.reads)
+	    -r $data.reads
+	  #end if
+	  #if $strain
+	    -s '$strain'
+	  #else
+	    -s '$data.forward.name.replace(" ", "_").replace("-", "_")'
+	  #end if
+      '${databaseout}' '${data.forward}' '${data.reverse}'
+    #end if
+	#if $data.input == "fastqpaired2"
+	  #if str($data.reads)
+	    -r $data.reads
+	  #end if 
+	  #if $strain
+	    -s '$strain'
+	  #else
+	    -s '$data.pairedfile.name.replace(" ", "_").replace("-", "_")'
+	  #end if
+      '${databaseout}' '${data.pairedfile.forward}'
+	  '${data.pairedfile.reverse}'
+    #end if
+	#if $log
+	  2> '${logfile}'
+	#end if
+	]]>
+  </command>
+  <inputs>
+	<param name="database" type="data"
+           format="sqlite"
+           label="cg/wgMLST database"
+           help="Sqlite format from cg/wgMLST database" />
+	<conditional name="data">
+	  <param name="input" type="select" label="Select type of data">
+        <option value="fasta" selected="true">Assembly (fasta)</option>
+        <option value="fastqsingle">Raw data (single)</option>
+        <option value="fastqpaired">Raw data (paired separated)</option>
+        <option value="fastqpaired2">Raw data (paired)</option>
+	  </param>
+	  <when value="fasta">
+        <param name="fastain" type="data" format="fasta"
+               label="Assembly Genome" help="Fasta format" />
+      </when>	  
+	  <when value="fastqsingle">
+        <param name="single" type="data" format="fastq,fastq.gz"
+               label="Single read file" help="Fastq(gz) format" />
+		<param name="reads" type="integer" value="10" optional="true"
+               label="Minimum reads coverage to search gene" />
+      </when>
+	  <when value="fastqpaired">
+        <param name="forward" type="data" format="fastq,fastq.gz"
+               label="Forward read file" help="Fastq(gz) format" />
+        <param name="reverse" type="data" format="fastq,fastq.gz"
+               label="Reverse read file" help="Fastq(gz) format" />
+		<param name="reads" type="integer" value="10" optional="true"
+			   label="Minimum reads coverage to search gene" />
+      </when>
+	  <when value="fastqpaired2">
+        <param name="pairedfile" type="data_collection" format="fastq,fastq.gz"
+               label="Paired of read files" help="Fastq(gz) format"
+               collection_type="paired" />
+		<param name="reads" type="integer" value="10" optional="true"
+			   label="Minimum reads coverage to search gene" />
+	  </when>	
+	</conditional>
+	<param name="strain" type="text" value="" size="50"
+		   optional="false"
+		   label="Strain"
+		   help="Name of the strain">
+	  <sanitizer invalid_char="_" >
+        <valid initial="string.ascii_letters,string.digits">
+          <add value="_" />
+		  <add value="." />
+        </valid>
+    </sanitizer>
+	</param> 
+	<param name="identity" type="float" value="0.9" optional="false"
+		   label="Identity"
+		   help="Minimum identity to search gene" />
+	<param name="coverage" type="float" value="0.9" optional="false"
+		   label="Coverage"
+		   help="Minimum coverage to search gene" />
+	<param name="log" type="boolean" checked="true"
+           label="Write log file" />	
+  </inputs>
+  <outputs>
+    <data name="databaseout" format="sqlite" label="${database.name}">
+	</data>
+    <data name="logfile" format="txt" label="${tool.name} on ${on_string}: log">
+	  <filter>log</filter>
+	</data>	
+  </outputs>
+  <tests>
+	<test expect_num_outputs="2">
+	  <param name="database" value="wgmlst_ecoli.db" />
+	  <conditional name="data">
+		<param name="input" value="fasta" />
+		<param name="fastain" ftype="fasta" value="EHSB-021.fasta" />
+	  </conditional>
+	  <param name="identity" value="0.8" />
+	  <output name="logfile" ftype="txt">
+	  <assert_contents>
+		<has_text text="Added 2497 new MLST genes to the database" />
+		<has_text text="Found 32 partial genes, filled 30" />
+		<has_text text="Removed 4 genes" />
+	  </assert_contents>
+	  </output>
+	</test>
+	<!-- <test expect_num_outputs="2"> -->
+	<!--   <param name="database" value="wgmlst_ecoli.db" /> -->
+	<!--   <param name="strain" value="EHSB-021" /> -->
+	<!--   <conditional name="data"> -->
+	<!-- 	<param name="input" value="fastqpaired" /> -->
+	<!-- 	<param name="forward" ftype="fastq.gz" value="EHSB-021_R1.fastq.gz" /> -->
+	<!-- 	<param name="reverse" ftype="fastq.gz" value="EHSB-021_R2.fastq.gz" /> -->
+	<!-- 	<param name="reads" value="5" /> -->
+	<!--   </conditional> -->
+	<!--   <output name="logfile" ftype="txt"> -->
+	<!--   <assert_contents> -->
+	<!-- 	<has_text_matching expression="Add 24\d\d new MLST genes to database" /> -->
+	<!-- 	<has_text_matching expression="Remove \d genes with uncertain bases" /> -->
+	<!-- 	<has_text_matching expression="Remove \d\d genes with bad CDS" /> -->
+	<!--   </assert_contents> -->
+	<!--   </output> -->
+	<!-- </test> -->
+  </tests>
+  <help>
+**What it does**
+
+Add a Strain to the cg/wgMLST database
+
+You can use
+- Genome assembly (blat search)
+- Raw data (kma search)
+
+**Options:**
+  -s, --strain TEXT     Name of the strain (default:genome name).
+  -i, --identity FLOAT   Minimum identity to search gene (default=0.9).
+  -c, --coverage FLOAT   Minimum coverage to search gene (default=0.95).
+  -r, --reads INTEGER    Minimum reads coverage to search gene (default=10).
+  -f, --fasta FILENAME   Write fasta file with gene allele.
+
+**License and citation**
+
+This Galaxy tool is Copyright © 2022 `B. Valot` and is released under the `GPL3 license`.
+  </help>
+  <citations>
+  </citations>
+</tool>