Mercurial > repos > galaxytrakr > mitokmer
changeset 2:dd206296acbf draft
planemo upload commit 83cba09882dc583100b39b69b41cf791e4efb55a
| author | galaxytrakr |
|---|---|
| date | Mon, 14 Sep 2026 19:47:05 +0000 |
| parents | e6b5e7a0d7e7 |
| children | 45ac0b1424fc |
| files | Dockerfile mitokmer.xml tool-data/mitokmer_probe_db.loc.sample |
| diffstat | 3 files changed, 52 insertions(+), 47 deletions(-) [+] |
line wrap: on
line diff
--- a/Dockerfile Fri Sep 11 22:01:39 2026 +0000 +++ b/Dockerfile Mon Sep 14 19:47:05 2026 +0000 @@ -37,10 +37,10 @@ WORKDIR /opt/mitokmer2 -# Compile the C++ read-screening program -# kmer_read_1.cpp -> kmerread -RUN g++ -O3 kmer_read_1.cpp -o kmerread -lz && \ - chmod +x kmerread +# Compile kmer_read_1.cpp -> kmerread7 +# kmer_read_m7.py calls ./kmerread7 as a subprocess +RUN g++ -O3 kmer_read_1.cpp -o kmerread7 -lz && \ + chmod +x kmerread7 # Install any Python requirements declared in the repo RUN if [ -f requirements.txt ]; then \ @@ -64,22 +64,25 @@ && rm -rf /var/lib/apt/lists/* # Copy compiled binary from build stage -COPY --from=build /opt/mitokmer2/kmerread /usr/local/bin/kmerread +# kmerread7 is called by kmer_read_m7.py as ./kmerread7 so it +# must be in the working directory at runtime; place it in both +# /usr/local/bin (for PATH) and /opt/mitokmer2 (for relative invocation) +COPY --from=build /opt/mitokmer2/kmerread7 /usr/local/bin/kmerread7 +COPY --from=build /opt/mitokmer2/kmerread7 /opt/mitokmer2/kmerread7 # Copy Python scripts and supporting files from build stage COPY --from=build /opt/mitokmer2 /opt/mitokmer2 # Copy Python virtual environment from build stage -# --copies in the build stage ensures no broken symlinks here COPY --from=build /opt/venv /opt/venv -# Refresh the dynamic linker cache so zlib and other shared -# libraries are found at runtime +# Refresh the dynamic linker cache RUN ldconfig || true # Ensure all users (including arbitrary Galaxy UIDs) can # read and execute binaries, scripts, and the venv -RUN chmod a+rx /usr/local/bin/kmerread && \ +RUN chmod a+rx /usr/local/bin/kmerread7 \ + /opt/mitokmer2/kmerread7 && \ chmod -R a+rX /opt/mitokmer2 && \ chmod -R a+rX /opt/venv
--- a/mitokmer.xml Fri Sep 11 22:01:39 2026 +0000 +++ b/mitokmer.xml Mon Sep 14 19:47:05 2026 +0000 @@ -5,41 +5,44 @@ </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 && + ## ── All paths are hardcoded in kmer_read_m7.py: ────────────────────── + ## database: ./mitochondria7/<multiple .txt files> + ## jobs file: ./jobs7m/jobs7m.txt + ## output: ./jobs7m/jobs7m.csv + ## binary: ./kmerread7 (called as subprocess by the Python script) + mkdir -p ./mitochondria7 ./jobs7m && + + ## ── Link database files from the data table directory ───────────────── + ## The data table path points to a directory containing all the + ## mitochondria7 .txt files; symlink each one into ./mitochondria7/ + ln -sf '${probe_db.fields.path}'/* ./mitochondria7/ && - ## ── Link probe database to the path kmerread expects ───────────────── - ln -sf '${probe_db.fields.path}' ./mitoch/mitoch_probes.txt.gz && + ## ── Symlink kmerread7 into the working directory ────────────────────── + ## kmer_read_m7.py calls ./kmerread7 (relative path), so it must exist + ## in the Galaxy job working directory + ln -sf /usr/local/bin/kmerread7 ./kmerread7 && - ## ── Stage input reads ───────────────────────────────────────────────── + ## ── Write the jobs file ─────────────────────────────────────────────── + ## Format: sample_name num_files + ## /abs/path/to/read1 + ## /abs/path/to/read2 ... + #set sample_name = $reads[0].element_identifier.replace(' ', '_').split('_')[:-1] | join('_') + printf '${sample_name}\t${reads|length}\n' > ./jobs7m/jobs7m.txt && #for read in $reads - ln -sf '${read}' ./reads/${read.element_identifier.replace(' ', '_')} && + printf '${read.file_name}\n' >> ./jobs7m/jobs7m.txt && #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 the Python orchestrator (no arguments) ──────────────────────── + ## kmer_read_m7.py reads jobs7m/jobs7m.txt, calls ./kmerread7, + ## and writes results to jobs7m/jobs7m.csv + python3 /opt/mitokmer2/kmer_read_m7.py && - ## ── 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}' + ## ── Copy output CSV to Galaxy output path ───────────────────────────── + cp ./jobs7m/jobs7m.csv '${results_csv}' ]]></command> <inputs> - <!-- Probe database selected from Galaxy data table --> + <!-- Probe database directory selected from Galaxy data table --> <param name="probe_db" type="select" label="Mitochondrial k-mer probe database" @@ -107,7 +110,8 @@ **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. + ``mitokmer_probe_db`` data table. The database consists of a directory + of supporting ``.txt`` files. **Input reads** One or more FASTQ or FASTA files (gzipped or plain) for a single sample, @@ -120,10 +124,8 @@ 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. + A comma-separated file with columns: taxid, reads, abundance, uniq. + Only taxa with non-zero relative abundance are reported. Example output for the "Plodia" test sample::
--- a/tool-data/mitokmer_probe_db.loc.sample Fri Sep 11 22:01:39 2026 +0000 +++ b/tool-data/mitokmer_probe_db.loc.sample Mon Sep 14 19:47:05 2026 +0000 @@ -1,18 +1,18 @@ # mitoKmer Probe Database Location File -# +# # This file lists the mitochondrial k-mer probe databases available to mitoKmer. # Entries are tab-separated; do NOT use spaces as delimiters. # +# The database consists of a DIRECTORY containing multiple supporting .txt files +# (e.g. mitochondria7_data.txt, mitochondria7_key.txt, refKeym7.txt, etc.) +# The path column should point to that directory. +# # Columns (tab-separated): # value - unique identifier used internally by Galaxy (no spaces) # name - human-readable label shown in the tool dropdown -# path - absolute path to the gzipped probe file (mitoch_probes.txt.gz) +# path - absolute path to the database DIRECTORY # # Example entry (remove the leading # to activate): # -# mito_v1 Mitochondrial DB v1 /galaxy/tool-data/mitokmer/mitoch_probes_v1.txt.gz +# mitochondria7 Mitochondrial DB v7 /galaxy/tool-data/mitokmer/mitochondria7 # -# Multiple databases can be listed, one per line: -# -# mito_insects_v1 Insect Mitochondrial DB v1 /galaxy/tool-data/mitokmer/mitoch_probes_insects_v1.txt.gz -# mito_vertebrates_v1 Vertebrate Mitochondrial DB v1 /galaxy/tool-data/mitokmer/mitoch_probes_vertebrates_v1.txt.gz
