view 1_map_reads.xml @ 47:1667e4c08344

planemo upload commit 2107f35724b3f897c9414be40a9d14663cba9f4d-dirty
author jpayne
date Tue, 07 May 2019 16:12:09 -0400
parents d273453b30bb
children e90a783a4e8b
line wrap: on
line source
<tool id="map_reads" name="1. Map Reads" version="1.0.1" profile="16.10">
    <description>to index, or lookup cached alignment</description>
    <requirements>
        <requirement type="package" version="1.0.6">bzip2</requirement>
        <requirement type="package" version="2.3.4">bowtie2</requirement>
        <requirement type="package" version="1.9.134">boto3</requirement>
        <requirement type="package" version="3.7.3">python</requirement>
    </requirements>
    <command detect_errors="exit_code"><![CDATA[
        export LD_LIBRARY_PATH="\$CONDA_DEFAULT_ENV/lib" &&
        #if $reads.reads_select == 'collection'
            #set forward=$reads.coll.forward
            #set reverse=$reads.coll.reverse
        #end if
        python ${__tool_directory__}/snp-cache.py snp_mapped_reads 
            "\$(md5sum  $reference
                        $forward
                        $reverse 
                        | cut -c -32 | md5sum | cut -c -32)"
            -c "
                cp $reference ./reference.fasta
                #if $forward.is_of_type("fastq.gz","fastqsanger.gz")
                    && cp $forward ./forward.gz
                    #set $forward="./forward.gz"
                #else if $forward.is_of_type("fastq.bz2", "fastqsanger.bz2")
                    && cp $forward ./forward.bz2
                    #set $forward="./forward.bz2"
                #end if
                #if $reverse.is_of_type("fastq.gz","fastqsanger.gz")
                    && cp $reverse ./reverse.gz
                    #set $reverse="./reverse.gz"
                #else if $reverse.is_of_type("fastq.bz2", "fastqsanger.bz2")
                    && cp $reverse ./reverse.bz2
                    #set $reverse="./reverse.bz2"
                #end if
                && bowtie2-build ./reference.fasta --quiet --threads \${GALAXY_SLOTS:-4} ./reference
                && bowtie2 -q -x ./reference -1 $forward -2 $reverse  -p \${GALAXY_SLOTS:-4} --reorder -X 1000
                "
        #if $reads.reads_select == 'collection'
            -o ${align_from_collection}
        #else
            -o ${align_from_history}
        #end if
            -l $cache_log
        && cat $cache_log
        #if $source.source_select == 'curated'
        && cp $reference $ref_out
        #end if
    ]]></command>
    <inputs>
        <!-- <conditional name="source">
            <param name="source_select" type="select" label="Use the reference associated with a provided BioProject, a curated GalaxyTrakr reference, or a reference from your history">
                <option value="bioproject">Provide a BioProject</option>
                <option value="curated">Use a GalaxyTrakr reference</option>
                <option value="history">Use a reference from your history</option>
            </param>
            <when value="bioproject">
                <param type="data" name="bioproject" format="text" />
            </when>
            <when value="curated">
    			<param name="input" type="select" label="Select reference fasta">
    				<options from_data_table="all_fasta">
    				    <filter type="sort_by" column="2"/>
        				<validator type="no_options" message="No assemblies are available for the selected input dataset"/>
    				</options>
    			</param>
    		</when>
            <when value="history">
                <param type="data" name="input" format="fasta" label="Select reference FASTA"/>
            </when>
        </conditional> -->
        <conditional name="source">
            <param name="source_select" type="select" label="Use a curated GalaxyTrakr reference or a reference from your history">
                <option value="curated">Use a GalaxyTrakr reference</option>
                <option value="history">Use a reference from your history</option>
            </param>
            <when value="curated">
    			<param name="reference" type="select" label="Select reference fasta">
    				<options from_data_table="all_fasta">
    				    <filter type="sort_by" column="2"/>
        				<validator type="no_options" message="No assemblies are available for the selected input dataset"/>
    				</options>
    			</param>
    		</when>
            <when value="history">
                <param type="data" name="reference" format="fasta" label="Select reference FASTA"/>
            </when>
        </conditional>
        <conditional name="reads">
            <param name="reads_select" type="select" label="Paired-end collection, or two datasets from your history">
                <option value="collection">Paired collection from your history</option>
                <option value="history">Two FASTQ datasets from your history</option>
            </param>
            <when value="collection">
                <param label="Paired reads" name="coll" type="data_collection" format="fastq,fastqsanger,fastq.gz,fastqsanger.gz,fastq.bz2,fastqsanger.bz2" collection_type="paired" />
            </when>
            <when value="history">
                <param label="Forward reads" type="data" name="forward" format="fastq,fastqsanger,fastq.gz,fastqsanger.gz,fastq.bz2,fastqsanger.bz2" />
                <param label="Reverse reads" type="data" name="reverse" format="fastq,fastqsanger,fastq.gz,fastqsanger.gz,fastq.bz2,fastqsanger.bz2" />
            </when>
        </conditional>
    </inputs>
    <outputs>
        <data label="${reads.coll.name} alignment" name="align_from_collection" format="sam">
            <filter>reads['reads_select'] == 'collection'</filter>
        </data>
        <data label="${reads.forward.name.split('_')[0]} alignment" name="align_from_history" format="sam">
            <filter>reads['reads_select'] == 'history'</filter>
        </data>
        <data label="S3 Cache log" name="cache_log" format="txt" hidden="true" />
        <data label="Reference" name="ref_out" format="fasta" hidden="true">
            <filter>source['source_select'] == curated</filter>
        </data>
    </outputs>
    <tests>
        <test>
            <param name="source_select" value="history" />
            <param name="reference" value="reference/lambda_virus.fasta" ftype="fasta" />
            <param name="reads_select" value="history" />
            <param name="forward" value="samples/sample1/sample1_1.fastq" ftype="fastqsanger" />
            <param name="reverse" value="samples/sample1/sample1_2.fastq" ftype="fastqsanger" />
            <output name="align_from_history" value="samples/sample1/reads.sam" lines_diff="3" />
        </test>
        <test>
            <param name="source_select" value="history" />
            <param name="reference" value="reference/lambda_virus.fasta" ftype="fasta" />
            <param name="reads_select" value="collection" />
            <param name="coll">
                <collection type="paired">
                    <element name="forward" value="samples/sample1/sample1_1.fastq" ftype="fastqsanger" />
                    <element name="reverse" value="samples/sample1/sample1_2.fastq" ftype="fastqsanger" />
                </collection>
            </param>
            <output name="align_from_collection" value="samples/sample1/reads.sam" lines_diff="3" />
        </test>
        <test>
            <param name="source_select" value="history" />
            <param name="reference" value="reference/lambda_virus.fasta" ftype="fasta" />
            <param name="reads_select" value="history" />
            <param name="forward" value="samples/sample1/sample1_1.fastq.gz" ftype="fastqsanger.gz" />
            <param name="reverse" value="samples/sample1/sample1_2.fastq.gz" ftype="fastqsanger.gz" />
            <output name="align_from_history" value="samples/sample1/reads.sam" lines_diff="3" />
        </test>
    </tests>
    <help><![CDATA[
       <a href="http://snp-pipeline.readthedocs.io/en/latest/index.html">http://snp-pipeline.readthedocs.io/en/latest/index.html</a>
    ]]></help>
    <citations>
        <citation type="doi">10.7717/peerj-cs.20</citation>
        <!-- <citation type="bibtex">
@misc{cfsan-snp-pipeline,
  author = {Steve Davis and James Pettengill and Yan Luo and Justin Payne and Albert Shpuntoff and Rugh Rand and Errol Strain},
  year = {2015},
  title = {CFSAN SNP Pipeline: an automated method for constructing SNP matrices from next-generation sequence data},
  url = {https://doi.org/10.7717/peerj-cs.20},
  journal = {PeerJ Computer Science},
}</citation> -->
    </citations>
</tool>