# HG changeset patch # User galaxytrakr # Date 1773436936 0 # Node ID 8e7a84e62b43035d8f80a8753f0fccbb0b0c8632 planemo upload commit e734452c606dba89b6fe58c90c5f38e5ea067edd diff -r 000000000000 -r 8e7a84e62b43 Dockerfile --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/Dockerfile Fri Mar 13 21:22:16 2026 +0000 @@ -0,0 +1,175 @@ +# ========================= +# CSP2 for Galaxy/AWS Batch (offline Nextflow) +# ========================= + +# ---------- Build stage ---------- +FROM ubuntu:focal AS build + +ARG DEBIAN_FRONTEND=noninteractive +ARG CSP2_VER="0.9.0" +ARG BEDTOOLS_VER="2.31.1" +ARG MUMMER_VER="4.0.0" +ARG SKESA_VER="2.4.0" +ARG MASH_VER="2.3" +ARG BBMAP_VER="38.90" +ARG PYTHON_VER="3.8" +ARG SOURCEFORGE_MIRROR="psychz" +ARG IQTREE_VER="2.0.6" + +# Use a stable working directory +WORKDIR /workspace + +# Base build deps (include Java to verify/prewarm Nextflow here) +RUN apt-get update && apt-get install -y --no-install-recommends \ + tzdata gpg-agent software-properties-common build-essential \ + zlib1g-dev libghc-bzlib-dev liblzma-dev wget ca-certificates \ + cmake curl git xz-utils openjdk-17-jre-headless \ + && rm -rf /var/lib/apt/lists/* + +# Python venv for runtime tools +RUN add-apt-repository 'ppa:deadsnakes/ppa' && apt-get update && \ + apt-get install -y --no-install-recommends \ + python${PYTHON_VER} python${PYTHON_VER}-dev python${PYTHON_VER}-venv \ + && python${PYTHON_VER} -m venv --copies /opt/venv \ + && rm -rf /var/lib/apt/lists/* + +ENV PATH="/opt/venv/bin:${PATH}" + +# Core Python packages +RUN pip install --no-cache-dir -U \ + pandas~=1.2.0 pybedtools refchooser scikit-learn + +# ---- Fetch sources/artifacts ---- + +# bedtools +ADD https://github.com/arq5x/bedtools2/archive/refs/tags/v${BEDTOOLS_VER}.tar.gz . +# mummer +ADD https://github.com/mummer4/mummer/releases/download/v${MUMMER_VER}rc1/mummer-${MUMMER_VER}rc1.tar.gz . +# skesa prebuilt bins +ADD https://github.com/ncbi/SKESA/releases/download/${SKESA_VER}/skesa.centos.7.7 . +ADD https://github.com/ncbi/SKESA/releases/download/${SKESA_VER}/gfa_connector.centos7.7 . +ADD https://github.com/ncbi/SKESA/releases/download/${SKESA_VER}/kmercounter.centos7.7 . +# mash +ADD https://github.com/marbl/Mash/releases/download/v${MASH_VER}/mash-Linux64-v${MASH_VER}.tar . +# iqtree2 +ADD https://github.com/Cibiv/IQ-TREE/releases/download/v${IQTREE_VER}/iqtree-${IQTREE_VER}-Linux.tar.gz . + +# ---- Build/install tools into /usr/local ---- +# bedtools +RUN tar -xzf v${BEDTOOLS_VER}.tar.gz && rm v${BEDTOOLS_VER}.tar.gz && \ + cd bedtools2-${BEDTOOLS_VER} && make -j && make install + +# Install MUMmer and copy Perl modules where dnadiff expects them +RUN tar -xvf mummer-${MUMMER_VER}rc1.tar.gz && rm mummer-${MUMMER_VER}rc1.tar.gz && \ + cd mummer-${MUMMER_VER}rc1 && \ + ./configure --prefix=/usr/local && make -j && make install && ldconfig && \ + mkdir -p /usr/local/lib/mummer && cp -a scripts/*.pm /usr/local/lib/mummer/ + +# skesa tools (rename and install) +RUN install -m 0755 skesa.centos.7.7 /usr/local/bin/skesa && \ + install -m 0755 gfa_connector.centos7.7 /usr/local/bin/gfa_connector && \ + install -m 0755 kmercounter.centos7.7 /usr/local/bin/kmercounter + +# mash +RUN tar -xvf mash-Linux64-v${MASH_VER}.tar && \ + install -m 0755 mash-Linux64-v${MASH_VER}/mash /usr/local/bin/mash + +# bbmap (grab all scripts/binaries) +RUN wget -O BBMap_${BBMAP_VER}.tar.gz \ + "https://sourceforge.net/projects/bbmap/files/BBMap_${BBMAP_VER}.tar.gz/download?use_mirror=${SOURCEFORGE_MIRROR}" && \ + tar -xvf BBMap_${BBMAP_VER}.tar.gz && \ + cp -a bbmap/* /usr/local/bin/ && \ + rm -rf bbmap BBMap_${BBMAP_VER}.tar.gz + +# iqtree2 +RUN tar -xzf iqtree-${IQTREE_VER}-Linux.tar.gz && \ + install -m 0755 iqtree-${IQTREE_VER}-Linux/bin/iqtree2 /usr/local/bin/iqtree && \ + rm -rf iqtree-${IQTREE_VER}-Linux iqtree-${IQTREE_VER}-Linux.tar.gz + +# choose a version +ARG NXF_VER="25.04.7" + +# install that exact launcher & prewarm framework into /opt/nextflow +RUN curl -fsSL -o /usr/local/bin/nextflow \ + "https://github.com/nextflow-io/nextflow/releases/download/v${NXF_VER}/nextflow" \ + && chmod 0755 /usr/local/bin/nextflow \ + && mkdir -p /opt/nextflow \ + && chmod -R a+rwX /opt/nextflow \ + && NXF_HOME=/opt/nextflow NXF_OFFLINE=false NXF_VER=${NXF_VER} /usr/local/bin/nextflow -version \ + && ls -l /usr/local/bin/nextflow + +# ---------- Runtime stage ---------- +FROM ubuntu:focal AS runtime + +ARG DEBIAN_FRONTEND=noninteractive +ARG CSP2_VER="0.9.0" + +# Python venv for runtime tools +# Lean runtime libs + Python3.8 + Perl (no PPAs) +RUN apt-get update && apt-get install -y --no-install-recommends \ + ca-certificates openjdk-17-jre-headless bash tzdata perl perl-modules-5.30 \ + libgomp1 liblzma5 zlib1g libbz2-1.0 coreutils make curl gawk \ + python3.8 python3.8-venv python3.8-distutils \ + && rm -rf /var/lib/apt/lists/* + +# Bring over tools and Python venv +COPY --from=build /usr/local/bin/ /usr/local/bin/ +COPY --from=build /usr/local/libexec/mummer /usr/local/libexec/mummer +COPY --from=build /usr/local/share/ /usr/local/share/ +COPY --from=build /opt/venv /opt/venv + +# Bring over Nextflow launcher and baked framework cache +COPY --from=build /usr/local/bin/nextflow /usr/local/bin/nextflow +COPY --from=build /opt/nextflow /opt/nextflow + +# Ensure any UID (Galaxy user) can execute nextflow and write minimal state into the cache +RUN chmod 0755 /usr/local/bin/nextflow \ + && chmod -R a+rwX /opt/nextflow + +# Bring the modules into the runtime image (if not already) +COPY --from=build /usr/local/lib/mummer /usr/local/lib/mummer + +# Bring MUMmer shared libs into the runtime image +COPY --from=build /usr/local/lib /usr/local/lib + +# Make sure dynamic linker can find them +RUN ldconfig || true + +# Belt-and-suspenders for minimal images +ENV LD_LIBRARY_PATH="/usr/local/lib:${LD_LIBRARY_PATH}" + +# Permissions: allow any UID to read/execute the libs +RUN chmod -R a+rX /usr/local/lib + +# Make modules readable by any UID; create compatibility symlink if needed +RUN chmod -R a+rX /usr/local/lib/mummer /usr/local/libexec/mummer && \ + test -d /usr/local/lib/mummer || ln -s /usr/local/libexec/mummer /usr/local/lib/mummer + +# Ensure the common mummer executables are executable by all +RUN chmod 0755 /usr/local/bin/dnadiff /usr/local/bin/nucmer /usr/local/bin/promer /usr/local/bin/show-snps || true + +# Help Perl find modules regardless of layout +ENV PERL5LIB="/usr/local/lib/mummer:/usr/local/libexec/mummer:/usr/local/share/mummer:${PERL5LIB}" + +# Runtime environment +ENV PATH="/opt/venv/bin:/usr/local/bin:${PATH}" \ + LC_ALL=C \ + NXF_HOME=/opt/nextflow \ + NXF_OFFLINE=true \ + CSP2_VER=${CSP2_VER} + +# Install the CSP2 pipeline under /opt/csp2 (avoid /app which Galaxy mounts) +WORKDIR /opt/csp2 + +# Copy your pipeline (these paths must exist in the build context) +COPY bin ./bin +COPY conf ./conf +COPY subworkflows ./subworkflows +COPY CSP2.nf ./CSP2.nf +COPY nextflow.config ./nextflow.config + +# permissions for arbitrary UID +RUN chmod -R a+rX /opt/csp2 && chmod -R a+rX /opt/nextflow + +# IMPORTANT: No ENTRYPOINT for Galaxy/AWS Batch. Neutral CMD. +CMD ["/bin/bash"] diff -r 000000000000 -r 8e7a84e62b43 cfsan2snp-screen.xml --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/cfsan2snp-screen.xml Fri Mar 13 21:22:16 2026 +0000 @@ -0,0 +1,170 @@ + + Screen query assemblies against reference assemblies + + quay.io/galaxytrakr/csp2:0.9.7.7-galaxy_0.1 + + nextflow -version + nextflow_gal25.config + + #set readext="" + #for $reads in $coll + && ln -sf '${reads}' 'queries/${reads.element_identifier.replace(": ", ".").replace(" ", "_")}.fasta' + #end for + #for $ref in $source.reference + #set renamedref=$ref.element_identifier.replace(": ", ".").replace(" ", "_").replace("(","").replace(")","") + && ln -sf '$ref' 'references/${renamedref}.fasta' + #end for + && echo "*** Files in queries directory: ***" + && ls -lah queries/ + && nextflow run /opt/csp2/CSP2.nf -c nextflow_gal25.config + --runmode screen + --fasta queries + --ref_fasta 'references' + --min_cov $opt.min_cov + --min_iden $opt.min_iden + --min_len $opt.min_len + --ref_edge $opt.ref_edge + --query_edge $opt.query_edge + --dwin $opt.dwin + --wsnps $opt.wsnps + --out CSP2_Screen_Output + --quiet + && echo "*** Files in output directory: ***" + && ls -lahR CSP2_Screen_Output + && tail -n +2 CSP2_Screen_Output/Isolate_Data.tsv > ${isolate_data} + && tail -n +2 CSP2_Screen_Output/Raw_MUMmer_Summary.tsv > ${raw_mummer} + && tail -n +2 CSP2_Screen_Output/Screening_Results.tsv > ${screening_results} + && echo "*** Nextflow log follows: ***" + && cat .nextflow.log +]]> + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + + + + +
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + This tool takes query assemblies and reference assemblies and calculates the pairwise distance between each query/reference combination. If no reference is provided, all queries are compared to all other queries. + + + 10.XXXX/placeholder.doi + @article{example2024,title={CFSAN SNP Pipeline 2 (CSP2): a pipeline for fast and accurate SNP distance estimation from bacterial genome assemblies.},author={Doe, John and Smith, Jane},journal={Submitted},year={2024}} + + +
diff -r 000000000000 -r 8e7a84e62b43 cfsan2snp-snp.xml --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/cfsan2snp-snp.xml Fri Mar 13 21:22:16 2026 +0000 @@ -0,0 +1,183 @@ + + Run SNP Pipeline analysis on isolates using one or more references. + + quay.io/galaxytrakr/csp2:0.9.7.7-galaxy_0.1 + + nextflow -version + nextflow_gal25.config + + #set readext="" + #for $reads in $coll + && ln -sf '${reads}' 'queries/${reads.element_identifier.replace(": ", ".").replace(" ", "_")}.fasta' + #end for + #for $ref in $source.reference + #set renamedref=$ref.element_identifier.replace(": ", ".").replace(" ", "_").replace("(","").replace(")","") + && ln -sf '$ref' 'references/${renamedref}.fasta' + #end for + + && echo "*** Files in queries directory: ***" + && ls -lah queries/ + && nextflow run /opt/csp2/CSP2.nf -c nextflow_gal25.config + --runmode snp + --fasta queries + --ref_fasta 'references' + --min_cov $opt.min_cov + --min_iden $opt.min_iden + --min_len $opt.min_len + --ref_edge $opt.ref_edge + --query_edge $opt.query_edge + --dwin $opt.dwin + --wsnps $opt.wsnps + --out CSP2_SNP_Output + --quiet + && echo "*** Files in output directory: ***" + && ls -lahR CSP2_SNP_Output + && tail -n +2 CSP2_SNP_Output/Isolate_Data.tsv > ${isolate_data} + && tail -n +2 CSP2_SNP_Output/Raw_MUMmer_Summary.tsv > ${raw_mummer} + && tail -n +2 CSP2_SNP_Output/SNP_Analysis/${renamedref}/snp_distance_pairwise_preserved.tsv > ${snp_pairwise} + && cat CSP2_SNP_Output/SNP_Analysis/${renamedref}/snplist_preserved.txt > ${snp_list} + && cat CSP2_SNP_Output/SNP_Analysis/${renamedref}/snpma_preserved.fasta > ${snp_matrix} + && echo "*** Nextflow log follows: ***" + && cat .nextflow.log + ]]> + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + + + + +
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + This tool takes query assemblies and reference assemblies and calculates the pairwise distance between each query/reference combination. If no reference is provided, all queries are compared to all other queries. + + + 10.XXXX/placeholder.doi + @article{example2024,title={CFSAN SNP Pipeline 2 (CSP2): a pipeline for fast and accurate SNP distance estimation from bacterial genome assemblies.},author={Doe, John and Smith, Jane},journal={Submitted},year={2024}} + + +
diff -r 000000000000 -r 8e7a84e62b43 nextflow.tmpl --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/nextflow.tmpl Fri Mar 13 21:22:16 2026 +0000 @@ -0,0 +1,128 @@ +/* +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + CSP2 Nextflow config file (for Dev25) +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +*/ + +profiles { + standard { + process.executor = 'local' + params.cores = @CORES@ + params.python_module = "" + params.mummer_module = "" + params.skesa_module = "" + params.bedtools_module= "" + params.mash_module = "" + params.bbtools_module = "" + } +} + +process { + cpus = @CORES@ + + withLabel: 'mummerMem' { + label = 'mummerMem' + cpus = 1 + memory = '4 GB' + } + withLabel: 'skesaMem' { + label = 'skesaMem' + memory = '12 GB' + } +} + + +// Global default params +params { + + // Setting output directory + + // Set name for output folder/file prefixes + out = "CSP2_${new java.util.Date().getTime()}" + + // Set output parent directory [Default: CWD; Set this to have all output go to the same parent folder, with unique IDs set by --out] + outroot = "" + + // CSP2 can run in the following run-modes: + + // assemble: Assemble read data (--reads/--ref_reads) into FASTA via SKESA (ignores --fasta/--ref_fasta/--snpdiffs) + // align: Given query data (--reads/--fasta) and reference data (--ref_reads/--ref_fasta), run MUMmer alignment analysis for each query/ref combination (ignores --snpdiffs) + // screen: Given query data (--reads/--fasta) and reference data (--ref_reads/--ref_fasta) and/or MUMmer output (.snpdiffs), create a report for raw SNP distances between each query and reference assembly + // snp: Given query data (--reads/--fasta) and reference data (--ref_reads/--ref_fasta) and/or MUMmer output (.snpdiffs), generate alignments and pairwise distances for all queries based on each reference dataset + + runmode = "" + + // Location for isolate sequence data + reads = "" + fasta = "" + + // Location for reference sequence data + ref_reads = "" + ref_fasta = "" + + // IDs for reference sequences (Comma-separated list) + ref_id = "" + + // Location for snpdiffs files + snpdiffs = "" + + // Read read_info + readext = "fastq.gz" + forward = "_1.fastq.gz" + reverse = "_2.fastq.gz" + + ref_readext = "fastq.gz" + ref_forward = "_1.fastq.gz" + ref_reverse = "_2.fastq.gz" + + // Analytical variables + + // Only consider queries if the reference genome is covered by at least % [Default: 85] + min_cov = 85 + + // Only consider SNPs from contig alignments longer than bp [Default: 500] + min_len = 500 + + // Only consider SNPs from contig alignments with % identity [Default: 99] + min_iden = 99 + + // Remove SNPs that occur within bp from the end of the reference contig [Default: 150] + ref_edge = 150 + + // Remove SNPs that occur within bp from the end of the query contig [Default: 150] + query_edge = 150 + + // SNP density filters: Given density windows provided by dwin, purge windows where more than the allowable window SNPs (wsnps) are found + // Default: 3 max per 1000bp, 2 max per 125bp, 1 max per 15bp, filtered from biggest window to smallest + // Set --dwin 0 to disable density filtering + dwin = "1000,125,15" + wsnps = "3,2,1" + + // If running refchooser in snp mode, compare queries to the top X references [Default: 1] + n_ref = 1 + + // If the assembly file contains the string , remove it from the sample name (e.g. '_contigs_skesa') + trim_name = '""' + + // If running SNP pipeline, set the maximum percent of isolates with missing data allowed in the final alignment/distances [Default: 50] + max_missing = 50 + + // Alternate directory for pybedtools tmp files [Default: "" (system default)] + tmp_dir = "" + + // Set IDs for isolates to exclude from analysis (Comma-separated list) + exclude = "" + + // By default, do not perform edge-filtered SNP rescuing + rescue = "norescue" + + // Help function + help = "nohelp" + h = "nohelp" + + // Bootstrap settings for iqTree + notree = "none" // Dummy setting to skip tree-building + b = 0 // Nonparametric bootstrap replicates + bb = 1000 // Ultrafast bootstrap replicates + model = "MFP+MERGE+ASC" // iqTree model +} diff -r 000000000000 -r 8e7a84e62b43 tool-data/all_fasta.loc.sample --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/tool-data/all_fasta.loc.sample Fri Mar 13 21:22:16 2026 +0000 @@ -0,0 +1,10 @@ +#This file lists the locations and dbkeys of all the fasta files +#under the "genome" directory (a directory that contains a directory +#for each build). The script extract_fasta.py will generate the file +#all_fasta.loc. This file has the format (white space characters are +#TAB characters): +# +# +# +#So, all_fasta.loc could look something like this: +#test1 test1 Test-Genome ./test-data/test1.fa \ No newline at end of file diff -r 000000000000 -r 8e7a84e62b43 tool_data_table_conf.xml.sample --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/tool_data_table_conf.xml.sample Fri Mar 13 21:22:16 2026 +0000 @@ -0,0 +1,7 @@ + + + + value, dbkey, name, path + +
+