view mitokmer.xml @ 0:adc887a1a6de draft

planemo upload commit 927c4ee71df7d19ceb10446a04618af22c99d839
author galaxytrakr
date Fri, 11 Sep 2026 21:58:43 +0000
parents
children e6b5e7a0d7e7
line wrap: on
line source

<tool id="mitokmer" name="mitoKmer" version="2.0+galaxy0.1" python_template_version="3.5" profile="21.05">
    <description>Identify metagenomic mitochondrial reads by k-mer database matching</description>
    <requirements>
        <container type="docker">quay.io/galaxytrakr/mitokmer2:latest</container>
    </requirements>

    <command detect_errors="exit_code"><![CDATA[
        ## ── kmerread expects files at specific relative paths ─────────────────
        ## ./mitoch/mitoch_probes.txt.gz  - probe database
        ## ./jobs1/jobs1.txt              - jobs file listing sample reads
        ## It is invoked with no arguments: ./kmerread
        mkdir -p ./mitoch ./jobs1 ./reads &&

        ## ── Link probe database to the path kmerread expects ─────────────────
        ln -sf '${probe_db.fields.path}' ./mitoch/mitoch_probes.txt.gz &&

        ## ── Stage input reads ─────────────────────────────────────────────────
        #for read in $reads
            ln -sf '${read}' ./reads/${read.element_identifier.replace(' ', '_')} &&
        #end for

        ## ── Write the jobs file in the format kmerread expects ───────────────
        ## Line 1: <sample_name> <number_of_files>
        ## Lines 2+: absolute path to each read file, one per line
        #set sample_name = $reads[0].element_identifier.replace(' ', '_').split('_')[:-1] | join('_')
        echo "${sample_name} ${reads|length}" > ./jobs1/jobs1.txt &&
        #for read in $reads
            echo "\$PWD/reads/${read.element_identifier.replace(' ', '_')}" >> ./jobs1/jobs1.txt &&
        #end for

        ## ── Run kmerread (reads jobs1/jobs1.txt and mitoch/mitoch_probes.txt.gz
        ##    by convention; no CLI arguments) ──────────────────────────────────
        kmerread &&

        ## ── Summarise results into CSV ────────────────────────────────────────
        python3 /opt/mitokmer2/kmer_read_m7.py
            -i ./jobs1
            -o '${results_csv}'
    ]]></command>

    <inputs>
        <!-- Probe database selected from Galaxy data table -->
        <param name="probe_db"
               type="select"
               label="Mitochondrial k-mer probe database"
               help="Select a pre-installed mitochondrial k-mer probe database.
                     Databases are managed by your Galaxy administrator via the
                     mitokmer_probe_db data table.">
            <options from_data_table="mitokmer_probe_db">
                <filter type="sort_by" column="1" />
                <validator type="no_options"
                           message="No mitochondrial k-mer probe databases are
                                    currently installed. Please contact your
                                    Galaxy administrator." />
            </options>
        </param>

        <!-- One or more FASTQ/FASTA files for a single sample -->
        <param name="reads"
               type="data_collection"
               collection_type="list"
               format="fastq,fastq.gz,fasta,fasta.gz"
               label="Input reads (FASTQ or FASTA, gzipped or plain)"
               help="Provide one or more read files for a single sample as a Galaxy
                     list collection.  Paired-end files (R1 + R2) should both be
                     included in the same collection.  Light quality trimming of
                     read ends is performed internally; pre-trimming is optional." />
    </inputs>

    <outputs>
        <data name="results_csv"
              format="csv"
              label="mitoKmer results for ${on_string}" />
    </outputs>

    <tests>
        <test>
            <param name="probe_db" value="mitoch_probes_sample" />
            <param name="reads">
                <collection type="list">
                    <element name="Plodia_R1" value="test/Plodia_R1.fastq.gz" />
                    <element name="Plodia_R2" value="test/Plodia_R2.fastq.gz" />
                </collection>
            </param>
            <output name="results_csv">
                <assert_contents>
                    <has_text text="Plodia" />
                </assert_contents>
            </output>
        </test>
    </tests>

    <help><![CDATA[
**mitoKmer** — Metagenomic Mitochondrial Read Identification by K-mer Database
===============================================================================

Overview
--------
mitoKmer identifies the taxonomic origin of short-read shotgun sequencing data
by matching reads against a database of species-specific mitochondrial k-mer
probes.  It reports the relative abundance of taxa at multiple taxonomic ranks
(e.g. order, species) along with the number of matching reads and supporting
unique k-mers.

Inputs
------
**Mitochondrial k-mer probe database**
    Select a pre-installed probe database from the dropdown.  Databases are
    managed by your Galaxy administrator and registered in the
    ``mitokmer_probe_db`` data table.

**Input reads**
    One or more FASTQ or FASTA files (gzipped or plain) for a single sample,
    supplied as a Galaxy list collection.  Both paired-end files (R1 and R2)
    should be included in the same collection.

    * Pre-trimming is optional — the tool performs simple window-based quality
      trimming of read ends internally.

Output
------
**Results CSV**
    A comma-separated file summarising the relative abundance of each taxon
    detected in the sample.  Columns include taxon name, taxonomic rank, number
    of reads assigned, relative abundance (%), and the number of unique k-mers
    supporting the assignment.

    Example output for the "Plodia" test sample::

        Rank    Taxon                   Reads   Rel_Abund(%)   Unique_kmers
        Order   Lepidoptera             10      0.1            329
        Species Plodia interpunctella   462     99.9           466

Citation
--------
Please cite the mitoKmer GitHub repository if you use this tool in published work.
    ]]></help>

    <citations>
        <citation type="bibtex">
@misc{githubmitokmer2,
  author    = {Mammel, Mark},
  title     = {mitoKmer2},
  year      = {2024},
  publisher = {GitHub},
  journal   = {GitHub repository},
  url       = {https://github.com/mmammel8/mitokmer2},
}
        </citation>
    </citations>
</tool>