view extract_sequence_file.xml @ 1:bbde61ab5519 draft default tip

planemo upload for repository https://github.com/ASaiM/galaxytools/tree/master/tools/extract_sequence_file/ commit 5c45ed58045ce1686aa069403f8a9426ea20bac5-dirty
author bebatut
date Tue, 12 Apr 2016 02:59:22 -0400
parents 14fd6f3b0898
children
line wrap: on
line source

<tool id="extract_sequence_file" name="Extract" version="0.1.0">

	<description>from sequence file</description>

    <macros>
        <xml name="fasta_option">
            <option value="id">Identifiant</option>
            <option value="length">Length</option>
            <option value="description">Description</option>
        </xml>
        <xml name="fastq_option">
            <option value="id">Identifiant</option>
            <option value="length">Length</option>
            <option value="description">Description</option>
        </xml>
        <xml name="test_constrain_extraction">
            <param name='constrained_extraction' type='boolean' checked="false" 
                truevalue='true' falsevalue='false' label="Constrain extraction?" help=""/>
        </xml>
        <xml name="constrain_string">
            <conditional name="constraint_type">
                <param name="type" type="select" display="radio" label="Type of 
                    constraint" help="">
                    <option value="equal">Equal a value</option>
                    <option value="in">In a list</option>
                    <option value="not_in">Not in a list</option>
                </param>
                <when value="equal">
                    <param name="value" type="text" size="200" label="Equal to" 
                        help=""/>
                    <validator type="empty_field" message="Give a value"/>
                </when>
                <when value="in">
                    <param format="txt" name="value" type="data" label="List of 
                        constraint" help="Text file with a value per line and 
                        nothing else"/>
                    <validator type="unspecified_build" message="Select a file"/>
                </when>
                <when value="not_in">
                    <param format="txt" name="value" type="data" label="List of 
                        constraint" help="Text file with a value per line and 
                        nothing else"/>
                    <validator type="unspecified_build" message="Select a file"/>
                </when>
            </conditional>
        </xml>
        <xml name="constrain_number">
            <param name="type" type="select" label="Type of constraint" help="">
                <option value="equal">Equal to </option>
                <option value="lower">Lower than </option>
                <option value="strictly_lower">Strictly lower than </option>
                <option value="greater">Greater than </option>
                <option value="strictly_greater">Strictly greater than </option>
            </param>
        </xml>
        <xml name="constraint_definitions">
            <conditional name="constraints">
                <expand macro="test_constrain_extraction" />
                <when value="true">
                    <repeat name="constraint_definition" title="Constraints on 
                        sequences" min="1">
                        <conditional name="constrained_information">
                            <param name="info_to_constrain" type="select" 
                                label="Information to constrain" help="">
                                <option value="id">Identifiant</option>
                                <option value="length">Length</option>
                            </param>
                            <when value="id">
                                <expand macro="constrain_string" />
                            </when>  
                            <when value="length">
                                <repeat name="constraint_definition" title="Constraint 
                                    on sequence length" min="1">
                                    <expand macro="constrain_number" />
                                    <param name="value" type="integer" min="0" 
                                        max="3000" value="100" label="Value" help=""/>
                                </repeat>
                            </when>  
                        </conditional>
                    </repeat>
                </when>
                <when value="false" />
            </conditional>
        </xml>
    </macros>

	<requirements>
  	</requirements>

    <stdio>
    </stdio>

    <version_command><![CDATA[python -version]]></version_command>

  	<!--<command>-->
    <command><![CDATA[
  		python $__tool_directory__/extract_sequence_file.py 
      		--input=$sequence_file_format.sequence_file

            --custom_extraction_type=$sequence_file_format.extraction.specific_extraction
            #if $sequence_file_format.extraction.specific_extraction :
                --to_extract="{$sequence_file_format.extraction.to_extract}"
                --output_information=$information_file
            #else if $sequence_file_format.format=="fastq":
                --split=$sequence_file_format.extraction.split.split_test
                #if $sequence_file_format.extraction.split.split_test :
                    --quality_format=$sequence_file_format.extraction.split.quality_format
                    --output_sequence=$fasta_sequence_file_from_fastq
                    --output_quality=$quality_file
                #else:
                    --output_sequence=$fastq_sequence_file
                #end if
            #else:
                --output_sequence=$fasta_sequence_file
            #end if
                
    		#if $constraints.constrained_extraction :
                #for $i, $constrain in enumerate( $constraints.constraint_definition )
                	#set info_to_constrain=$constrain.constrained_information['info_to_constrain']             
                    #if $info_to_constrain in ("id"):
                    	--constraint="$info_to_constrain:
                    	${constrain.constrained_information.constraint_type.type}:
                    	${constrain.constrained_information.constraint_type.value}"
                    #else:
                    	#for $j, $sub_constrain in enumerate( $constrain.constrained_information.constraint_definition )
                    		--constraint="$info_to_constrain:
                    		${sub_constrain.type}:
                    		${sub_constrain.value}"
                        #end for
                    #end if
                #end for
            #end if

            --report $report_filepath
            --format=$sequence_file_format.format
        ]]>
  	</command>

  	<inputs>
        <conditional name="sequence_file_format">
        	<param name="format" type="select" display="radio" 
                label="Format of the sequence file" help="">
	            <option value="fasta">Fasta</option>
                <option value="fastq">FastQ</option>
	        </param>
            <when value="fastq">
                <param name="sequence_file" type="data" format="fastq" 
                    label="Sequence file" help=""/>
                <conditional name="extraction">
                    <param name='specific_extraction' type='boolean' 
                        checked="false" truevalue='true' falsevalue='false'
                        label="Extract specific information?" 
                        help="If no is selected, a sequence file is generated. 
                        If yes, a text file containing the wanted information is 
                        generated"/>
                    <when value="true">
                        <param name="to_extract" type="select" display="checkboxes" 
                            multiple="true" label="Information to extract" help="">
                            <expand macro="fasta_option" />
                            <validator type="no_options" message="Select at least 
                                one information to extract"/>
                        </param>
                    </when>
                    <when value="false">
                        <conditional name="split">
                            <param name='split_test' type='boolean' checked="false"
                                truevalue='true' falsevalue='false' label="Split 
                                file into sequence and quality files?" help="If 
                                yes is selected, a fasta and a quality file are 
                                generated. If no, a fastq file is generated"/>
                            <when value="true">
                                <param name="quality_format" type="select" 
                                    display="radio" label="Coding of quality 
                                    scores?" help="">
                                    <option value="sanger" selected="true">Sanger (Phred+33)</option>
                                    <option value="solexa">Solexa (Solexa+64) </option>
                                    <option value="illumina_1_3">Illumina 1.3+ (Phred+64) </option>
                                    <option value="illumina_1_5">Illumina 1.5+ (Phred+64) </option>
                                    <option value="illumina_1_8">Illumina 1.8+ (Phred+33) </option>
                                </param>
                            </when>
                            <when value="false" />
                        </conditional> 
                    </when>
                </conditional> 
            </when>
            <when value="fasta">
                <param name="sequence_file" type="data" format="fasta" 
                    label="Sequence file" help=""/>
                <conditional name="extraction">
                    <param name='specific_extraction' type='boolean' checked="false" 
                        truevalue='true' falsevalue='false' label="Extract specific 
                        information?" help="If no is selected, a sequence file is 
                        generated. If yes, a text file containing the wanted 
                        information is generated"/>
                    <when value="true">
                        <param name="to_extract" type="select" display="checkboxes" 
                            multiple="true" label="Information to extract" help="">
                            <expand macro="fasta_option" />
                            <validator type="no_options" message="Select at least 
                                one information to extract"/>
                        </param>
                    </when>
                    <when value="false" />
                </conditional> 
            </when>
        </conditional>
        
        <expand macro="constraint_definitions" />
  	</inputs>

  	<outputs>
        <data format="txt" name="information_file" 
            label="${tool.name} on ${on_string}: Information">
            <filter>((sequence_file_format['extraction']['specific_extraction']))</filter>
        </data>

        <data format="fasta" name="fasta_sequence_file"
            label="${tool.name} on ${on_string}: Extracted sequences" >
            <filter>((sequence_file_format['format'] == 'fasta' and 
                not sequence_file_format['extraction']['specific_extraction']))</filter>
        </data>

        <data format="fastq" name="fastq_sequence_file"
            label="${tool.name} on ${on_string}: Extracted sequences">
            <filter>((sequence_file_format['format'] == 'fastq' and 
                not sequence_file_format['extraction']['specific_extraction'] and
                not sequence_file_format['extraction']['split']['split_test']))</filter>
        </data>

        <data format="qual" name="quality_file" 
            label="${tool.name} on ${on_string}: Extracted quality">
            <filter>((sequence_file_format['format'] == 'fastq' and 
                not sequence_file_format['extraction']['specific_extraction'] and
                sequence_file_format['extraction']['split']['split_test']))</filter>
        </data>

        <data format="fasta" name="fasta_sequence_file_from_fastq"
            label="${tool.name} on ${on_string}: Extracted sequences">
            <filter>((sequence_file_format['format'] == 'fastq' and 
                not sequence_file_format['extraction']['specific_extraction'] and
                sequence_file_format['extraction']['split']['split_test']))</filter>
        </data>

        <data format="txt" name="report_filepath" 
            label="${tool.name} on ${on_string}: Report"/>
  	</outputs>

  	<tests>
  		<test>
  			<param name="sequence_file_format.sequence_file" 
                value="read_write_fasta_file/input_sequence_file.fasta"/>
  			<param name="sequence_file_format.extraction.specific_extraction" 
                value="false"/>
            <param name="$sequence_file_format.format" value="fasta" />
  			<output name="fasta_sequence_file" 
                file="read_write_fasta_file/input_sequence_file.fasta"/>
  			<output name="report_filepath" 
                file="read_write_fasta_file/expected_output_report.txt"/>
  		</test>
  	</tests>

  	<help><![CDATA[

**What it does**

This tool extracts information from sequence files. 

Some constraints could be added to extraction. For example, you choose 
to extract only sequences for which the length is greater than 30 bp.

More information on `ASaiM documentation <http://asaim.readthedocs.org/>`_...

-----

**Input**

The input is one file in fasta or fastq.

-----

**Outputs**

The tool generates different outputs given the choosen parameters:

    - a sequence file
    - a text file
    - a sequence file and a quality file

]]>
  	</help>

    <citations>
    </citations>
</tool>