view clamlst_search.xml @ 2:4394da33d837 draft default tip

planemo upload for repository https://github.com/bvalot/pyMLST commit 142042a3856f8886031cacaa4fb28743a1bcd540
author bvalot
date Wed, 15 Nov 2023 12:22:07 +0000
parents 5b2c48fa0175
children
line wrap: on
line source

<tool id="clamlst_search_wrapper" name="Search MLST database"
	  version="@TOOL_VERSION@+galaxy@VERSION_SUFFIX@" profile="20.05">
  <description></description>
  <macros>
    <import>macro.xml</import>
  </macros>
  <expand macro="requirements">
	<requirement type="package" version="4.8">sed</requirement>
  </expand>
  <stdio>
    <exit_code range="1:" level="fatal" />
  </stdio>
  <version_command>claMLST -v</version_command>
  <command><![CDATA[
    #set $databaselink = $database.file_name.split("/")[-1]
    ln -s $database.file_name \$_GALAXY_JOB_TMP_DIR/ &&
    claMLST
	#if $data.input == "fasta"
	  search
	#else
	  search2
	#end if
	#if str($coverage)
	  -c $coverage
	#end if
	#if str($identity)
	  -i $identity
	#end if
	#if $fasta
	  -f '${fastaout}'
	#end if
	#if $data.input == "fasta"
	  \$_GALAXY_JOB_TMP_DIR/'${databaselink}'
	  #for $datain in $data.fastain:
	    '${datain}'
	  #end for
	  #for $datain in $data.fastain:
	    #set $name = $datain.file_name.split("/")[-1].rstrip(".dat")
		| sed -e "~s/$name/$datain.name/"
	  #end for
    #end if
	#if $data.input == "fastqsingle"
	  #if str($data.reads)
	    -r $data.reads
	  #end if
	  --single
	  \$_GALAXY_JOB_TMP_DIR/'${databaselink}' 
	  #for $datain in $data.single:
	    '${datain}'
	  #end for
	  #for $datain in $data.single:
	    #set $name = $datain.file_name.split("/")[-1].rstrip(".dat")
		| sed -e "~s/$name/$datain.name/"
	  #end for
    #end if
	#if $data.input == "fastqpaired"
	  #if str($data.reads)
	    -r $data.reads
	  #end if
	  --paired 
	  \$_GALAXY_JOB_TMP_DIR/'${databaselink}' 
	  '${data.pairedfile.forward}' '${data.pairedfile.reverse}'
	  #set $name = $data.pairedfile.forward.file_name.split("/")[-1].rstrip(".dat")
	  | sed -e "~s/$name/$data.pairedfile.name/"
    #end if
	#if $data.input == "fastqpaired2"
	  #if str($data.reads)
	    -r $data.reads
	  #end if
	  --paired 
	  \$_GALAXY_JOB_TMP_DIR/'${databaselink}' 
	  #for $datain in $data.pairedfilelist:
	    '${datain.forward}' '${datain.reverse}'
	  #end for
	  #for $datain in $data.pairedfilelist:
	    #set $name = $datain.forward.file_name.split("/")[-1].rstrip(".dat")
		| sed -e "~s/$name/$datain.name/"
	  #end for
    #end if
	> '${mlst}'
	#if $log
	  2> '${logfile}'
	#end if
	]]>
  </command>
  <inputs>
	<param name="database" type="data"
           format="sqlite"
           label="Classical MLST database"
           help="Sqlite format from claMLST import" />
	<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)</option>
        <option value="fastqpaired2">Raw data (List of paired)</option>
	  </param>
	  <when value="fasta">
        <param name="fastain" type="data" format="fasta"
               label="Assembly Genome" help="Fasta format"
			   multiple="true" />
      </when>	  
	  <when value="fastqsingle">
        <param name="single" type="data" format="fastq,fastq.gz"
               label="Single read file" help="Fastq(gz) format"
			   multiple="true" />
		<param name="reads" type="integer" value="10" optional="true"
               label="Minimum reads coverage to search gene" />
      </when>
	  <when value="fastqpaired">
        <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>
	  <when value="fastqpaired2">
        <param name="pairedfilelist" type="data_collection" format="fastq,fastq.gz"
               label="Paired of read files" help="Fastq(gz) format"
               collection_type="list:paired" />
		<param name="reads" type="integer" value="10" optional="true"
			   label="Minimum reads coverage to search gene" />
	  </when>	
	</conditional>
	<param name="fasta" type="boolean" checked="false"
           label="Write fasta file with MLST genes allele" />
	<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="false"
           label="Write log file" />	
  </inputs>
  <outputs>
    <data name="logfile" format="txt" label="${tool.name} on ${on_string}: log">
	  <filter>log</filter>
	</data>
    <data name="mlst" format="txt" label="${tool.name} on ${on_string}: mlst" />
    <data name="fastaout" format="fasta" label="${tool.name} on {on_string}: fasta">
	  <filter>fasta</filter>
	</data>
  </outputs>
  <tests>
	<test expect_num_outputs="1">
	  <param name="database" value="clamlst_ecoli.db" />
	  <conditional name="data">
		<param name="input" value="fasta" />
		<param name="fastain" ftype="fasta" value="EHSB-021.fasta,EHSB-092.fasta" />
	  </conditional>
	  <param name="identity" value="0.8" />
	  <output name="mlst" ftype="txt">
	  <assert_contents>
		<has_text_matching expression="155\t6\t4\t14\t16\t24\t8\t14" />
		<has_text_matching expression="3018\t12\t58\t54\t344\t1\t2\t47" />
	  </assert_contents>
	  </output>
	</test>
	<test expect_num_outputs="1">
	  <param name="database" value="clamlst_ecoli.db" />
	  <conditional name="data">
		<param name="input" value="fastqsingle" />
		<param name="single" ftype="fastqsanger" value="EHSB-021_R1.fastq.gz,EHSB-021_R2.fastq.gz" />
	  </conditional>
	  <param name="identity" value="0.8" />
	  <param name="reads" value="5" />
	  <output name="mlst" ftype="txt">
	  <assert_contents>
		<has_text_matching expression="14\t16\t24\t8" />
	  </assert_contents>
	  </output>
	</test>
	<test expect_num_outputs="1">
	  <param name="database" value="clamlst_ecoli.db" />
	  <conditional name="data">
		<param name="input" value="fastqpaired" />
		<param name="pairedfile">
		  <collection type="paired">
			<element name="forward" value="EHSB-021_R1.fastq.gz" />
			<element name="reverse" value="EHSB-021_R2.fastq.gz" />
          </collection>
		</param>
		<param name="reads" value="5" />
	  </conditional>
	  <output name="mlst" ftype="txt">
	  <assert_contents>
		<has_text_matching expression="4\t14\t16\t24\t8\t14" />
	  </assert_contents>
	  </output>
	</test>
	<test expect_num_outputs="3">
	  <param name="database" value="clamlst_ecoli.db" />
	  <conditional name="data">
		<param name="input" value="fastqpaired2" />
		<param name="pairedfilelist">
		  <collection type="list:paired">
			<element name="EHSB-021">
			  <collection type="paired">
				<element name="forward" value="EHSB-021_R1.fastq.gz" />
				<element name="reverse" value="EHSB-021_R2.fastq.gz" />
			  </collection>
			</element>
          </collection>
		</param>
		<param name="reads" value="5" />
	  </conditional>
	  <param name="fasta" value="true" />
	  <param name="log" value="true" />
	  <output name="fastaout" ftype="fasta">
		<assert_contents>
		  <has_n_lines n="14" />
		</assert_contents>
	  </output>
	  <output name="mlst" ftype="txt">
	  <assert_contents>
		<has_text_matching expression="4\t14\t16\t24\t8\t14" />
	  </assert_contents>
	  </output>
	</test>
  </tests>
  <help>
**What it does**

Search ST number from pubMLST database

You can use
- Genome assembly (blat search)
- Raw data (kma search)

**Options:**

  -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>