view tximport.xml @ 0:2f5e9c0fe367 draft default tip

"planemo upload for repository https://github.com/ieguinoa/tximport-galaxy-wrapper commit 2bb25471c1320fb1206afa2c4daf536b6d6e275f-dirty"
author ieguinoa
date Wed, 09 Oct 2019 15:38:21 -0400
parents
children
line wrap: on
line source

<tool name="tximport" id="tximport" version="0.1">
    <description> Summarize transcript-level estimates for gene-level analysis </description>
    <requirements>
        <requirement type="package">bioconductor-tximport</requirement>
        <requirement type="package" version="1.34.1">bioconductor-genomicfeatures</requirement>
        <requirement type="package" version="1.20.2">r-getopt</requirement>
        <requirement type="package" version="0.2.20">r-rjson</requirement>
    </requirements>

    <stdio>
        <exit_code range="1:" level="fatal" description="Error code returned" />
        <regex match="is not TRUE"
           source="both"
           level="fatal"
           description="Execution halted." />
    </stdio>

<command>
 <![CDATA[
#import json
#if $gene_name_source_selector.gene_name_source == 'external_file':
    #if $gene_name_source_selector.gff_source_selector.gff_source == 'history':
        #if $gene_name_source_selector.gff_source_selector.gff_tx2gene_selector.mapping_file_option == 'gff_gtf':
            ln -s '$gene_name_source_selector.gff_source_selector.gff_tx2gene_selector.own_gff' mapping.gff &&
        #else:
            ln -s '$gene_name_source_selector.gff_source_selector.gff_tx2gene_selector.own_tx2gene' mapping.tab &&
        #end if
    #end if
#end if

Rscript '${__tool_directory__}/tximport.R'
    --base_dir $__tool_directory__
    --format $input_source_selector.input_source
    #if $input_source_selector.input_source == 'none':
        --txIdCol $input_source_selector.tx_id_col
        --abundanceCol $input_source_selector.abundance_col
        --countsCol $input_source_selector.counts_col
        --lengthCol $input_source_selector.length_col
    #end if
    #if $gene_name_source_selector.gene_name_source == 'gene_name_column_option':
        --geneIdCol $gene_name_source_selector.gene_id_col
    #else
        #if $gene_name_source_selector.gff_source_selector.gff_source == "history":
            #if $gene_name_source_selector.gff_source_selector.gff_tx2gene_selector.mapping_file_option == 'tx2gene':
                    --tx2gene mapping.tab
                #else
                    --gff_file mapping.gff
                #end if
        #else:
	--tx2gene $gene_name_source_selector.gff_source_selector.tx2gene.fields.path
        #end if
    #end if

    --countsFromAbundance $counts_from_abundance 
    #set $count_files = list()
    #for $file in $counts_file:
        #set $filename_to_element_identifiers = {}
        $filename_to_element_identifiers.__setitem__('id',str($file.element_identifier))
        $filename_to_element_identifiers.__setitem__('path',str($file))
        $count_files.append(filename_to_element_identifiers)
    #end for
    #set $samples_dict = {}
    $samples_dict.__setitem__('samples',$count_files)
    --countsFiles '#echo json.dumps(samples_dict)#'
    --out_file '${gene_level_values}' 

]]></command>



<inputs>
    <conditional name="input_source_selector">
        <param name="input_source" type ="select" label="Select the source of the quantification file">
           <option value="salmon" selected="True">Salmon</option>
            <option value="sailfish">Sailfish</option>
            <option value="alevin">Alevin</option>
            <option value="kallisto">Kallisto</option>
            <option value="rsem">RSEM</option>
            <option value="stringtie">Stringtie</option>
            <option value="none">Custom format (specify the columns)</option>
        </param>
        <when value="none"> 
            <param name="tx_id_col" type="text" label="Name of the txID columns"/>
            <param name="abundance_col" type="text" label="Name of the abundance column"/>
            <param name="counts_col" type="text" label="Name of the counts column"/>
            <param name="length_col" type="text" label="Name of the length column"/>
        </when>
        <when value="salmon"/>
        <when value="sailfish"/>
        <when value="alevin"/>
        <when value="kallisto"/>
        <when value="rsem"/>
         <when value="stringtie"/>
    </conditional> 
    <conditional name="gene_name_source_selector" >
        <param name="gene_name_source" type="select" label="Is the gene name part of the counts file or will be obtained from an external file?">
            <option value="external_file" selected="True">Use an external file to map transcript to gene names</option>
            <option value="gene_name_column_option">Gene name is a column of the input file</option>
        </param>
        <when value="gene_name_column_option"> 
            <param name="gene_name_column" type="text" label="Name of the column containing the geneID"/>
        </when>
        <when value="external_file">
            <conditional name="gff_source_selector">
                <param name="gff_source" type="select" label="Select a GFF from your history or use a built-in file?">
                    <option value="built-in" selected="True">Use a built-in file</option>
                    <option value="history" >Use one from the history</option>
                </param>
                <when value="built-in">
                    <param name="tx2gene" type="select" label="Select an annotation version" help="If the build of your interest is not listed contact your Galaxy admin">
                        <options from_data_table="tx2gene_table">
                            <filter type="sort_by" column="1"/>
                            <validator type="no_options" message="No files are available for the selected input dataset"/>
                          </options>
                    </param>
                </when>  
                <when value="history"> 
                    <conditional name="gff_tx2gene_selector">
                        <param name="mapping_file_option" type="select" label="Will you provide a tx2gene or a GFF/GTF file?">
                            <option value="tx2gene" selected="True">TranscriptID to GeneID table</option>
                            <option value="gff_gtf">GTF/GFF file</option>
                        </param>
                        <when value="gff_gtf">
                            <param name="own_gff" type="data" format="gff" label="Select your GFF file"/>
                        </when>
                        <when value="tx2gene">
                            <param name="own_tx2gene" type="data" format="tabular" label="Select your TranscriptID to GeneID table file"/>
                        </when>  
                    </conditional>
                 </when> 
            </conditional>
         </when>  
    </conditional>
    <param name="counts_from_abundance" type="select" label="Summarization using the abundance (TPM) values?">    
        <option value="no">No</option>
        <option value="scaled_TPM">Scaled up to library size</option>
        <option value="length_scaled_TPM">Scaled using the avg. transcript legth over samples and then the library size</option>
        <option value="dtu_scaled_TPM">Scaled using the median transcript length among isoforms of a gene, and then the library size</option>
    </param>
    <param name="counts_file" type="data" format="tabular" multiple="true" label="Counts file(s)"/>   
</inputs>


<outputs>
    <data format="tabular" name="gene_level_values" label="Gene level summarization on ${on_string}"/>
</outputs>


<tests>
        <test>
            <param name="input_source" value="salmon"/>
            <param name="gene_name_source" value="external_file"/>
            <param name="counts_from_abundance" value="no"/>
            <param name="gff_source" value="history"/>
            <param name="mapping_file_option" value="tx2gene"/>
            <param name="own_tx2gene" value="tx2gene.tab"/>
            <param name="counts_file" value="salmon_sample2.tab,salmon_sample1.tab" />
            <output name="gene_level_values">
                 <assert_contents>
                    <has_text_matching expression="salmon_sample2.tab\tsalmon_sample1.tab" />
                    <has_text_matching expression="AT1G01010\t156\t156" />
                </assert_contents>
            </output>
        </test>
        <test>
            <param name="input_source" value="salmon"/>
            <param name="gene_name_source" value="external_file"/>
            <param name="counts_from_abundance" value="no"/>
            <param name="gff_source" value="history"/>
            <param name="mapping_file_option" value="gff_gtf"/>
            <param name="own_gff" value="Araport11_subset.gff3"/>
            <param name="counts_file" value="salmon_sample2.tab,salmon_sample1.tab" />
            <output name="gene_level_values">
                <assert_contents>
                    <has_text_matching expression="salmon_sample2.tab\tsalmon_sample1.tab" />
                    <has_text_matching expression="AT1G01010\t156\t156" />
                </assert_contents>
            </output>
        </test>
        <test>
            <param name="input_source" value="salmon"/>
            <param name="gene_name_source" value="external_file"/>
            <param name="counts_from_abundance" value="no"/>
            <param name="gff_source" value="built-in"/>
            <param name="tx2gene" value="Ath_Araport11_subset"/>
            <param name="counts_file" value="salmon_sample2.tab,salmon_sample1.tab" />
            <output name="gene_level_values">
                 <assert_contents>
                    <has_text_matching expression="salmon_sample2.tab\tsalmon_sample1.tab" />
                    <has_text_matching expression="AT1G01010\t156\t156" />
                </assert_contents>
            </output>
        </test>
        <!-- Test input with custom format -->
	<test>
	    <param name="input_source" value="none"/>	
            <param name="tx_id_col" value="Transcript_id_here"/>
            <param name="abundance_col" value="Abundance_goes_here"/>
            <param name="counts_col" value="Here_goes_the_counts"/>
	    <param name="length_col" value="Here_goes_the_length"/>
            <param name="counts_from_abundance" value="no"/>
            <param name="gff_source" value="built-in"/>
            <param name="tx2gene" value="Ath_Araport11_subset"/>
            <param name="counts_file" value="custom_sample.tab" />
            <output name="gene_level_values">
                 <assert_contents>
                    <has_text_matching expression="custom_sample.tab" />
                    <has_text_matching expression="AT1G01010\t156" />
                </assert_contents>
            </output>

        </test>

</tests>
    <help>

.. class:: infomark

Current version only works in 'merge' mode: A single table of gene summarizations is generated with one column for each sample file.
Take into account that DEseq2 package in Galaxy requires one table per sample. 
    </help>
    
    <citations>
        <citation type="doi">doi:10.18129/B9.bioc.tximport</citation>
    </citations>

</tool>