view data_manager/salmon_index_builder.xml @ 8:ec2a1f280d67 draft

planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/main/data_managers/data_manager_salmon_index_builder commit 1ea9e99e1c7a7cd0f012467466e0740b6bdeb90e
author iuc
date Thu, 23 Oct 2025 17:05:46 +0000
parents 9fc154508622
children d31d59516633
line wrap: on
line source

<tool id="salmon_index_builder_data_manager" name="Salmon" tool_type="manage_data" version="@TOOL_VERSION@+galaxy@VERSION_SUFFIX@" profile="24.0">
    <description>index builder</description>
    <macros>
        <token name="@TOOL_VERSION@">1.10.1</token>
        <token name="@VERSION_SUFFIX@">0</token>
        <token name="@PROFILE@">24.0</token>
        <token name="@IDX_VERSION@">q7</token>
    </macros>
    <requirements>
        <requirement type="package" version="@TOOL_VERSION@">salmon</requirement>
    </requirements>
    <command detect_errors="exit_code"><![CDATA[
        ## salmon uses one thread to much 
        SLOTS=\$(( \${GALAXY_SLOTS:-12} > 1 ? \${GALAXY_SLOTS:-12} - 1 : 1 ));

        ## https://combine-lab.github.io/alevin-tutorial/2019/selective-alignment/
        ## https://salmon.readthedocs.io/en/latest/salmon.html#preparing-transcriptome-indices-mapping-based-mode
        
        #for $transcripts in $transcriptome.fields.path.split(",")
            (zcat '$transcripts' 2>/dev/null || cat '$transcripts') >> gentrome.fa &&
        #end for
        (zcat '$all_fasta_source.fields.path' 2>/dev/null || cat '$all_fasta_source.fields.path') >> gentrome.fa &&

        (zcat '$all_fasta_source.fields.path' 2>/dev/null || cat '$all_fasta_source.fields.path') | awk '{if($1 ~ /^>/) print $1}' | cut -c2- | tr -d " " > decoys.txt &&

        mkdir '$out_file.extra_files_path' &&

        salmon index
            -k $kmer_size
            -t gentrome.fa
            -d decoys.txt
            -i '$out_file.extra_files_path'
            -p "\$SLOTS"
            $gencode
            &&

        cp '$dmjson' '$out_file'
    ]]></command>
    <configfiles>
        <configfile name="dmjson"><![CDATA[{
#if str($sequence_id).strip() == ""
    #set sequence_id = $transcriptome.fields.value
#end if
#if str($sequence_name).strip() == ""
    #set sequence_name = $transcriptome.fields.name
#end if

  "data_tables":{
    "salmon_indexes_versioned":[
      {
        "value": "$sequence_id",
        "dbkey": "$all_fasta_source.fields.dbkey",
        "name": "$sequence_name",
        "path": "$out_file.extra_files_path",
        "version": "@IDX_VERSION@"
      }
    ]
  }
}]]></configfile>
    </configfiles>
    <inputs>
        <param label="Transcriptome sequences" name="transcriptome" optional="false" type="select">
            <options from_data_table="transcriptomes" />
        </param>
        <param label="Genome" name="all_fasta_source" optional="false" type="select">
            <options from_data_table="all_fasta" />
        </param>
        <param name="sequence_name" type="text" value="" label="Name of sequence" />
        <param name="sequence_id" type="text" value="" label="ID for sequence" />
        <param name="kmer_size" type="integer" optional='true' value="31" max="32" label="The size of the k-mer on which the index is built"
                    help="There is a tradeoff here between the distinctiveness of the k-mers and their robustness to errors. The shorter the k-mers, the more robust they will be to errors in the reads, but the longer the k-mers, the more distinct they will be.  We generally recommend using a k-mer size of at least 20. MUST BE AN ODD VALUE ">
            <validator type="expression" message="Only odd values">value % 2 == 1</validator>
        </param>
        <param name="gencode" type="boolean" label="Transcript sequences are in gencode format" truevalue="--gencode" falsevalue="" checked="false" help="Will split  the transcript name at the first '|' character. These reduced names will be used in the output  and when looking for these transcripts in a gene to transcript GTF."/>
    </inputs>
    <outputs>
        <data name="out_file" format="data_manager_json" />
    </outputs>
    <tests>
        <test>
            <param name="transcriptome" value="phiX174"/>
            <param name="all_fasta_source" value="phiX174"/>
            <param name="sequence_name" value="sequence_name"/>
            <param name="sequence_id" value="sequence_id"/>
            <output name="out_file">
                <assert_contents>
                    <has_text text='"salmon_indexes_versioned"' />
                    <has_text text='"dbkey": "phiX174"' />
                    <has_text text='"name": "sequence_name"' />
                    <has_text text='"value": "sequence_id"' />
                    <has_text text='"version": "q7"' />
                    <has_text text='"path":' />
                </assert_contents>
            </output>
        </test>
        <test>
            <param name="transcriptome" value="phiX174"/>
            <param name="all_fasta_source" value="phiX174"/>
            <param name="sequence_name" value=""/>
            <param name="sequence_id" value=""/>
            <output name="out_file">
                <assert_contents>
                    <has_text text='"salmon_indexes_versioned"' />
                    <has_text text='"dbkey": "phiX174"' />
                    <has_text text='"name": "phiX174"' />
                    <has_text text='"value": "phiX174"' />
                    <has_text text='"version": "q7"' />
                    <has_text text='"path":' />
                </assert_contents>
            </output>
        </test>
    </tests>
    <help>
<![CDATA[
.. class:: infomark

Indices are constructed as described here: https://combine-lab.github.io/alevin-tutorial/2019/selective-alignment/
        
See also https://salmon.readthedocs.io/en/latest/salmon.html#preparing-transcriptome-indices-mapping-based-mode

**Notice:** If you leave name, description, or id blank, it the dbkey of the genome will be used.
]]>
    </help>
    <citations>
        <citation type="doi">https://doi.org/10.1038/nmeth.4197</citation>
    </citations>
</tool>