view nanopolish_eventalign.xml @ 8:1286cea13ab0 draft

"planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/nanopolish commit f325ca2ced02af231abfb08700aae1da6824c9ab"
author bgruening
date Thu, 30 Apr 2020 22:50:34 +0000
parents 67049a071226
children d03669da4b59
line wrap: on
line source

<tool id="nanopolish_eventalign" name="Nanopolish eventalign" version="@VERSION@+galaxy0">
    <description>- Align nanopore events to reference k-mers</description>
    <macros>
        <import>macros.xml</import>
    </macros>
    <expand macro="requirements" />
    <command detect_errors="exit_code"><![CDATA[
        ln -s '$input_merged' reads.fasta && 
 
        #if $input_reads_raw.extension == 'fast5':
            mkdir fast5_files && ln -s '$input_reads_raw' fast5_files/read1.fast5 &&

        #else if $input_reads_raw.extension == 'fast5.tar':
            ln -s '$input_reads_raw' fast5_files.tar &&
            mkdir fast5_files && tar -xf fast5_files.tar -C fast5_files &&

        #else if $input_reads_raw.extension == 'fast5.tar.bz2':
            ln -s '$input_reads_raw' fast5_files.tar.bz2 &&
            mkdir fast5_files && tar -xjf fast5_files.tar.bz2 -C fast5_files &&

        #else:
            ln -s '$input_reads_raw' fast5_files.tar.gz &&
            mkdir fast5_files && tar -xzf fast5_files.tar.gz -C fast5_files &&

        #end if

        nanopolish index 
        -d fast5_files/
        #if $adv.input_seq_summary:
          -s '$adv.input_seq_summary'
        #end if 
        reads.fasta &&

        ln -s '$b' reads.bam &&
        ln -s '${b.metadata.bam_index}' reads.bam.bai &&
        #if $reference_source.reference_source_selector == 'history':
            ln -f -s '$reference_source.ref_file' genome.fa &&
        #else:
            ln -f -s '$reference_source.ref_file.fields.path' genome.fa &&
        #end if
        
        nanopolish eventalign
        -r reads.fasta
        -b reads.bam
        -g genome.fa
        #if str($min_mapping_quality):
            -q $min_mapping_quality
        #end if
        --threads "\${GALAXY_SLOTS:-4}"        
        $samples
        $scale_events
        $sam
        $print_read_names
        #if $w and str($w).strip():
          -w "${w}"
        #end if        
        #if $input_models_fofn:
          --models-fofn '$input_models_fofn'
        #end if
        #if $summary:
            --summary eventalign-summary.txt
        #end if
        > eventalign.out


    ]]></command>
    <inputs>
      <!-- index inputs -->
        <param type="data" name="input_merged" format="fasta,fastq" label="Basecalled merged reads.fa"/>
        <param type="data" name="input_reads_raw" format="fast5.tar.gz,fast5.tar.bz2,fast5.tar" label="Flat archive file of raw fast5 files"/>

        <!-- variants consensus inputs -->
        <param type="data" argument="-b" format="bam" label="Reads aligned to the reference genome" />
        <conditional name="reference_source">
          <param name="reference_source_selector" type="select" label="Load reference genome from">
            <option value="cached">Local cache</option>
            <option value="history">History</option>
          </param>
          <when value="cached">
            <param name="ref_file" type="select" label="Using reference genome" help="REFERENCE_SEQUENCE">
              <options from_data_table="all_fasta">
              </options>
              <validator type="no_options" message="A built-in reference genome is not available for the build associated with the selected input file"/>
            </param>
          </when>
          <when value="history">
            <param name="ref_file" type="data" format="fasta" label="Use the following dataset as the reference sequence" help="REFERENCE_SEQUENCE; You can upload a FASTA sequence to the history and use it as reference" />
          </when>
        </conditional>

        <section name="adv" title="Optional data inputs">
            <!-- optional inputs -->
            <param type="data" name="input_seq_summary" format="txt" optional="true" label="Sequencing summary file from albacore" help="(-s)"/>       
        </section>

        <!-- optional inputs -->
        <param type="data" name="input_models_fofn" argument="--models-fofn" format="txt" optional="true"
            label="Read alternative k-mer models (optional)" />
        
        <!-- optional params -->
        <param argument="-w" type="text" optional="true"
            label="find variants in window of region chromsome:start-end" />
        <param name="min_mapping_quality" type="integer" optional="true" value=""
            label="Only use reads with mapping quality of at least this value" help="(-q)"/>

        <!-- optional flags -->
        <param argument="--summary" type="boolean" truevalue="--summary" falsevalue="" checked="true"
            label="Summarize the alignment of each read/strand" />
        <param argument="--samples" type="boolean" truevalue="--samples" falsevalue="" checked="false"
            label="Write the raw samples for the event to the tsv output" />
        <param name="scale_events" argument="--scale-events" type="boolean" truevalue="--scale-events" falsevalue="" checked="false"
            label="Scale events to the model, rather than vice-versa" />
        <param argument="--sam" type="boolean" truevalue="--sam" falsevalue="" checked="false"
            label="write output in SAM format" />
        <param name="print_read_names" argument="--print-read-names" type="boolean" truevalue="--print-read-names" falsevalue="" checked="false"
            label="Print read names instead of indexes" />

    </inputs>

    <outputs>
      <!-- variants consensus outputs -->
        <data name="output_summary" format="txt" from_work_dir="eventalign-summary.txt" label="eventalign summary of reads/strands" />
        <data name="output_eventalign" format="txt" from_work_dir="eventalign.out" label="Aligned squiggles"/>
    </outputs>
    <tests>
        <test>
            <param name="input_merged" ftype="fasta" value="reads.fasta" />
            <param name="input_reads_raw" ftype="fast5.tar.gz" value="fast5_files.tar.gz" />
            <param name="b" value="reads.sorted.bam" />
            <param name="reference_source_selector" value="history" />
            <param name="ref_file" value="draft.fa" />
            <param name="w" value="tig00000001:200000-200010" />
            <param name="sam" value="true" />
            <output name="output_summary" file="eventalign-summary.txt" />
            <output name="output_eventalign" file="reads-draft.eventalign.sam"/>
        </test>
        <test>
            <param name="input_merged" ftype="fasta" value="reads.fasta" />
            <param name="input_reads_raw" ftype="fast5.tar.gz" value="fast5_files.tar.gz" />
            <param name="b" value="reads.sorted.bam" />
            <param name="reference_source_selector" value="history" />
            <param name="ref_file" value="draft.fa" />
            <param name="w" value="tig00000001:200000-200010" />
            <param name="sam" value="false" />
            <param name="summary" value="false" />
            <param name="scale_events" value="true" />
            <param name="print_read_names" value="true" />
            <param name="min_mapping_quality" value="0" />
            <output name="output_summary" file="t2-eventalign-summary.txt" />
            <output name="output_eventalign"> 
                <assert_contents>
                    <has_text text="contig" />
                    <has_text text="position" />
                    <has_text text="event_index" />
                    <has_text text="tig00000001" />
                </assert_contents>
            </output>
        </test>
        <test>
            <!-- test data table reference -->
            <param name="input_merged" ftype="fasta" value="reads.fasta" />
            <param name="input_reads_raw" ftype="fast5.tar.gz" value="fast5_files.tar.gz" />
            <param name="b" value="reads.sorted.bam" />
            <param name="reference_source_selector" value="history" />
            <param name="ref_file" value="draft.fa"/>
            <param name="w" value="tig00000001:200000-200010" />
            <param name="sam" value="false" />
            <param name="summary" value="false" />
            <param name="scale_events" value="true" />
            <param name="print_read_names" value="true" />
            <param name="min_mapping_quality" value="0" />
            <output name="output_summary" file="t2-eventalign-summary.txt" />
            <output name="output_eventalign"> 
                <assert_contents>
                    <has_text text="contig" />
                    <has_text text="position" />
                    <has_text text="event_index" />
                    <has_text text="tig00000001" />
                </assert_contents>
            </output>
        </test>
    </tests>
    <help><![CDATA[
        Usage: nanopolish eventalign [OPTIONS] --reads reads.fa --bam alignments.bam --genome genome.fa
        Align nanopore events to reference k-mers

        Tutorial and manual available at:
        http://nanopolish.readthedocs.io/en/latest/quickstart_eventalign.html      
        
        ]]></help>
    <expand macro="citations" />
</tool>