Mercurial > repos > galaxytrakr > cfsan2snp2
changeset 0:8e7a84e62b43 draft
planemo upload commit e734452c606dba89b6fe58c90c5f38e5ea067edd
| author | galaxytrakr |
|---|---|
| date | Fri, 13 Mar 2026 21:22:16 +0000 |
| parents | |
| children | ea58bc28a64f |
| files | Dockerfile cfsan2snp-screen.xml cfsan2snp-snp.xml nextflow.tmpl tool-data/all_fasta.loc.sample tool_data_table_conf.xml.sample |
| diffstat | 6 files changed, 673 insertions(+), 0 deletions(-) [+] |
line wrap: on
line diff
--- /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"]
--- /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 @@ +<tool id="cfsan2snp-screen" name="CSP2 (Screening Mode)" version="0.9.7.7+gt_0.7"> + <description>Screen query assemblies against reference assemblies</description> + <requirements> + <container type="docker">quay.io/galaxytrakr/csp2:0.9.7.7-galaxy_0.1</container> + </requirements> + <version_command>nextflow -version</version_command> + <command detect_errors="exit_code"><![CDATA[ + mkdir -p queries references .nextflow + && sed "s/@CORES@/\${GALAXY_SLOTS:-1}/" $__tool_directory__/nextflow.tmpl > 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 +]]> + </command> + <inputs> + <conditional name="source"> + <param name="source_select" type="select" label="Use a curated GalaxyTrakr reference or a reference from your history"> + <option value="curated">Use a GalaxyTrakr reference</option> + <option value="history">Use a reference from your history</option> + </param> + <when value="curated"> + <param name="reference" type="select" label="Select reference fasta" multiple="true" min="1" > + <options from_data_table="all_fasta"> + <filter type="sort_by" column="2"/> + <validator type="no_options" message="No assemblies are available for the selected input dataset"/> + </options> + </param> + </when> + <when value="history"> + <param type="data" name="reference" format="fasta" label="Select reference FASTA" multiple="true" min="1" /> + </when> + </conditional> + <!-- <conditional name="query"> + <param name="query_select" type="select" label="Screen a list of paired-end reads or a list of assemblies"> + <option value="reads">Screen a list of paired reads</option> + <option value="assemblies">Screen a list of assemblies</option> + </param> + <when value="reads"> + <param label="Paired reads" name="coll" type="data_collection" format="fastq,fastqsanger,fastq.gz,fastqsanger.gz,fastq.bz2,fastqsanger.bz2" collection_type="list:paired" /> + </when> + <when value="assemblies"> --> + <param label="Assemblies" name="coll" type="data_collection" format="fasta" collection_type="list" /> + <!-- </when> --> + <!-- </conditional> --> + <section name="opt" title="Advanced options..."> + <param argument="--min_cov" name="min_cov" type="float" value="85" label="Minimum reference genome coverage to proceed with distance estimation" /> + <param argument="--min_eden" name="min_iden" type="float" value="99" label="Minimum alignment percent identity to detect SNPs" /> + <param argument="--min_len" name="min_len" type="integer" value="500" label="Minimum alignment length to detect SNPs" /> + <param argument="--ref_edge" name="ref_edge" type="integer" value="150" label="Prune SNPs within this many bases of reference contig edge" /> + <param argument="--query_edge" name="query_edge" type="integer" value="150" label="Prune SNPs within this many bases of query contig edge" /> + <param argument="--dwin" name="dwin" type="text" value="1000,125,15" label="Comma-separated set of window sizes for SNP density filtration (Set to 0 to disable density filtration)" /> + <param argument="--wsnips" name="wsnps" type="text" value="3,2,1" label="Comma-separated list of maximum SNP counts per density window" /> + </section> + </inputs> + <outputs> + <data name="raw_mummer" format="tabular" label="Raw MUMmer Output"> + <actions> + <action name="column_names" type="metadata" default="SNPDiffs_File,Query_ID,Query_Assembly,Query_Contig_Count,Query_Assembly_Bases,Query_N50,Query_N90,Query_L50,Query_L90,Query_SHA256,Reference_ID,Reference_Assembly,Reference_Contig_Count,Reference_Assembly_Bases,Reference_N50,Reference_N90,Reference_L50,Reference_L90,Reference_SHA256,SNPs,Reference_Percent_Aligned,Query_Percent_Aligned,Median_Percent_Identity,Median_Alignment_Length,Kmer_Similarity,Shared_Kmers,Reference_Unique_Kmers,Query_Unique_Kmers,Reference_Breakpoints,Query_Breakpoints,Reference_Relocations,Query_Relocations,Reference_Translocations,Query_Translocations,Reference_Inversions,Query_Inversions,Reference_Insertions,Query_Insertions,Reference_Tandem,Query_Tandem,Indels,Invalid,gSNPs,gIndels" /> + </actions> + </data> + <data name="isolate_data" format="tabular" label="Isolate Data"> + <actions> + <action name="column_names" type="metadata" default="Isolate_ID,Isolate_Type,Assembly_Path,Contig_Count,Assembly_Bases,N50,N90,L50,L90,SHA256" /> + </actions> + </data> + <data name="screening_results" format="tabular" label="Screening Results"> + <actions> + <action name="column_names" type="metadata" default="Query_ID,Reference_ID,Screen_Category,CSP2_Screen_SNPs,Query_Percent_Aligned,Reference_Percent_Aligned,Query_Contigs,Query_Bases,Reference_Contigs,Reference_Bases,Raw_SNPs,Purged_Length,Purged_Identity,Purged_LengthIdentity,Purged_Invalid,Purged_Indel,Purged_Duplicate,Purged_Het,Purged_Density,Filtered_Query_Edge,Filtered_Ref_Edge,Filtered_Both_Edge,Kmer_Similarity,Shared_Kmers,Query_Unique_Kmers,Reference_Unique_Kmers,MUMmer_gSNPs,MUMmer_gIndels" /> + </actions> + </data> + <!-- <data name="nextflow_log" format="txt" label="Nextflow Log" from_work_dir="Nextflow_Log.txt" /> --> + </outputs> + <tests> + <test> + <param name="source_select" value="history" /> + <param name="reference" value="assemblies/Sample_A.fasta" ftype="fasta" /> + <!-- <param name="query_select" value="assemblies" /> --> + <param name="coll"> + <collection type="list"> + <!-- <element name="Sample_A" value="assemblies/Sample_A.fasta" /> --> + <element name="Sample_B" value="assemblies/Sample_B.fasta" /> + <element name="Sample_C" value="assemblies/Sample_C.fasta" /> + <element name="Sample_D" value="assemblies/Sample_D.fasta" /> + <element name="Sample_E" value="assemblies/Sample_E.fasta" /> + <element name="Sample_F" value="assemblies/Sample_F.fasta" /> + <element name="Sample_G" value="assemblies/Sample_G.fasta" /> + <element name="Sample_H" value="assemblies/Sample_H.fasta" /> + <element name="Sample_I" value="assemblies/Sample_I.fasta" /> + <element name="Sample_J" value="assemblies/Sample_J.fasta" /> + <element name="Sample_K" value="assemblies/Sample_K.fasta" /> + <element name="Sample_L" value="assemblies/Sample_L.fasta" /> + <element name="Sample_M" value="assemblies/Sample_M.fasta" /> + <element name="Sample_N" value="assemblies/Sample_N.fasta" /> + <element name="Sample_O" value="assemblies/Sample_O.fasta" /> + </collection> + </param> + + <output name="screening_results" value="Screening_Results.tsv" /> + <output name="isolate_data" value="Isolate_Data.tsv" /> + </test> + <test> + <!-- Test that spaces and parens are handled --> + <param name="source_select" value="history" /> + <param name="reference" value="assemblies/Sample (A).fasta" /> + <!-- <param name="query_select" value="assemblies" /> --> + <param name="coll"> + <collection type="list"> + <!-- <element name="Sample_A" value="assemblies/Sample_A.fasta" /> --> + <element name="Sample_B" value="assemblies/Sample_B.fasta" /> + <element name="Sample_C" value="assemblies/Sample_C.fasta" /> + <element name="Sample_D" value="assemblies/Sample_D.fasta" /> + </collection> + </param> + <output name="isolate_data" value="Isolate_Data.tsv" compare="diff" lines_diff="17" /> + </test> + <!-- <test> + <param name="source_select" value="history" /> + <param name="reference" value="assemblies/Sample_A.fasta" ftype="fasta" /> + <param name="query_select" value="reads" /> + <param name="coll"> + <collection type="list:paired"> + <element name="Sample_A" > + <collection type="paired"> + <element name="forward" value="reads/Week_42_Reads_1.fq.gz" ftype="fastqsanger.gz" /> + <element name="reverse" value="reads/Week_42_Reads_2.fq.gz" ftype="fastqsanger.gz" /> + </collection> + </element> + </collection> + </param> + <output name="screening_results" value="Screening_Results.tsv" /> + <output name="isolate_data" value="Isolate_Data.tsv" /> + </test> --> + </tests> + <help> + 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. + </help> + <citations> + <citation type="doi">10.XXXX/placeholder.doi</citation> + <citation type="bibtex">@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}} + </citation> + </citations> +</tool>
--- /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 @@ +<tool id="cfsan2snp-snp" name="CSP2 (SNP Pipeline Mode)" version="0.9.7.7+gt_0.7"> + <description>Run SNP Pipeline analysis on isolates using one or more references.</description> + <requirements> + <container type="docker">quay.io/galaxytrakr/csp2:0.9.7.7-galaxy_0.1</container> + </requirements> + <version_command>nextflow -version</version_command> + <command detect_errors="exit_code"><![CDATA[ + mkdir -p queries references .nextflow + && sed "s/@CORES@/\${GALAXY_SLOTS:-1}/" $__tool_directory__/nextflow.tmpl > 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 + ]]> + </command> + <inputs> + <conditional name="source"> + <param name="source_select" type="select" label="Use a curated GalaxyTrakr reference or a reference from your history"> + <option value="curated">Use a GalaxyTrakr reference</option> + <option value="history">Use a reference from your history</option> + </param> + <when value="curated"> + <param name="reference" type="select" label="Select reference fasta" multiple="true" min="1" > + <options from_data_table="all_fasta"> + <filter type="sort_by" column="2"/> + <validator type="no_options" message="No assemblies are available for the selected input dataset"/> + </options> + </param> + </when> + <when value="history"> + <param type="data" name="reference" format="fasta" label="Select reference FASTAs" multiple="true" min="1" /> + </when> + </conditional> + <!-- <conditional name="query"> + <param name="query_select" type="select" label="Screen a list of paired-reads or a list of assemblies"> + <option value="reads">Screen a list of paired reads</option> + <option value="assemblies">Screen a list of assemblies</option> + </param> + <when value="reads"> + <param label="Paired reads" name="coll" type="data_collection" format="fastq,fastqsanger,fastq.gz,fastqsanger.gz,fastq.bz2,fastqsanger.bz2" collection_type="list:paired" /> + </when> + <when value="assemblies"> --> + <param label="Assemblies" name="coll" type="data_collection" format="fasta" collection_type="list" /> + <!-- </when> --> + <!-- </conditional> --> + <section name="opt" title="Advanced options..."> + <param name="min_cov" type="float" value="85" label="Minimum reference genome coverage to proceed with distance estimation" optional="true" /> + <param name="min_iden" type="float" value="99" label="Minimum alignment percent identity to detect SNPs" optional="true" /> + <param name="min_len" type="integer" value="500" label="Minimum alignment length to detect SNPs" optional="true" /> + <param name="ref_edge" type="integer" value="150" label="Prune SNPs within this many bases of reference contig edge" optional="true" /> + <param name="query_edge" type="integer" value="150" label="Prune SNPs within this many bases of query contig edge" optional="true" /> + <param name="dwin" type="text" value="1000,125,15" label="Comma-separated set of window sizes for SNP density filtration (Set to 0 to disable density filtration)" optional="true" /> + <param name="wsnps" type="text" value="3,2,1" label="Comma-separated list of maximum SNP counts per density window" optional="true" /> + </section> + </inputs> + <outputs> + <!-- <data name="nextflow_log" format="txt" label="Nextflow Log" from_work_dir="Nextflow_Log.txt" /> --> + <data name="isolate_data" format="tabular" label="Isolate Data"> + <actions> + <action name="column_names" type="metadata" default="Isolate_ID,Isolate_Type,Assembly_Path,Contig_Count,Assembly_Bases,N50,N90,L50,L90,SHA256" /> + </actions> + </data> + <data name="raw_mummer" format="tabular" label="Raw MUMmer Output"> + <actions> + <action name="column_names" type="metadata" default="SNPDiffs_File,Query_ID,Query_Assembly,Query_Contig_Count,Query_Assembly_Bases,Query_N50,Query_N90,Query_L50,Query_L90,Query_SHA256,Reference_ID,Reference_Assembly,Reference_Contig_Count,Reference_Assembly_Bases,Reference_N50,Reference_N90,Reference_L50,Reference_L90,Reference_SHA256,SNPs,Reference_Percent_Aligned,Query_Percent_Aligned,Median_Percent_Identity,Median_Alignment_Length,Kmer_Similarity,Shared_Kmers,Reference_Unique_Kmers,Query_Unique_Kmers,Reference_Breakpoints,Query_Breakpoints,Reference_Relocations,Query_Relocations,Reference_Translocations,Query_Translocations,Reference_Inversions,Query_Inversions,Reference_Insertions,Query_Insertions,Reference_Tandem,Query_Tandem,Indels,Invalid,gSNPs,gIndels" /> + </actions> + </data> + <!-- <data name="csp2_zip" format="zip" label="Zipped Output" from_work_dir="CSP2_Output.zip" /> --> + <!-- <discover_datasets pattern="(?P<name>.+)/CSP2_SNP_Pipeline\.log" format="txt" visible="true" directory="./CSP2_SNP_Output/SNP_Analysis" /> --> + <!-- <discover_datasets pattern="(?P<name>.+)/Reference_Screening\.tsv" format="tabular" visible="true" directory="./CSP2_SNP_Output/SNP_Analysis" /> + <discover_datasets pattern="(?P<name>.+)/snp_distance_matrix_preserved\.tsv" format="tabular" visible="true" directory="./CSP2_SNP_Output/SNP_Analysis" /> + <discover_datasets pattern="(?P<name>.+)/snp_distance_pairwise_preserved\.tsv" format="tabular" visible="true" directory="./CSP2_SNP_Output/SNP_Analysis" /> + <discover_datasets pattern="(?P<name>.+)/snpma_preserved\.fasta" format="fasta" visible="true" directory="./CSP2_SNP_Output/SNP_Analysis" /> --> + <data name="snp_pairwise" format="tabular" label="Preserved Pairwise SNP Distances"> + <actions> + <action name="column_names" type="metadata" default="Query_1,Query_2,SNP_Distance,SNPs_Cocalled" /> + </actions> + </data> + <data name="snp_list" format="txt" label="Preserved SNP List" /> + <data name="snp_matrix" format="fasta" label="Preserved SNP Matrix" /> + <discover_datasets pattern="(?P<name>.+)/snp_distance_matrix\.tsv" format="tabular" visible="false" directory="./CSP2_SNP_Output/SNP_Analysis" /> + <discover_datasets pattern="(?P<name>.+)/snp_distance_pairwise\.tsv" format="tabular" visible="false" directory="./CSP2_SNP_Output/SNP_Analysis" /> + <discover_datasets pattern="(?P<name>.+)/snpma\.fasta" format="fasta" visible="false" directory="./CSP2_SNP_Output/SNP_Analysis" /> + </outputs> + <tests> + <test> + <param name="source_select" value="history" /> + <param name="reference" value="assemblies/Sample_A.fasta" /> + <!-- <param name="query_select" value="assemblies" /> --> + <param name="coll"> + <collection type="list"> + <!-- <element name="Sample_A" value="assemblies/Sample_A.fasta" /> --> + <element name="Sample_B" value="assemblies/Sample_B.fasta" /> + <element name="Sample_C" value="assemblies/Sample_C.fasta" /> + <element name="Sample_D" value="assemblies/Sample_D.fasta" /> + <element name="Sample_E" value="assemblies/Sample_E.fasta" /> + <element name="Sample_F" value="assemblies/Sample_F.fasta" /> + <element name="Sample_G" value="assemblies/Sample_G.fasta" /> + <element name="Sample_H" value="assemblies/Sample_H.fasta" /> + <element name="Sample_I" value="assemblies/Sample_I.fasta" /> + <element name="Sample_J" value="assemblies/Sample_J.fasta" /> + <element name="Sample_K" value="assemblies/Sample_K.fasta" /> + <element name="Sample_L" value="assemblies/Sample_L.fasta" /> + <element name="Sample_M" value="assemblies/Sample_M.fasta" /> + <element name="Sample_N" value="assemblies/Sample_N.fasta" /> + <element name="Sample_O" value="assemblies/Sample_O.fasta" /> + </collection> + </param> + + <output name="isolate_data" value="Isolate_Data.tsv" /> + </test> + <test> + <!-- Test that spaces and parens are handled --> + <param name="source_select" value="history" /> + <param name="reference" value="assemblies/Sample (A).fasta" /> + <!-- <param name="query_select" value="assemblies" /> --> + <param name="coll"> + <collection type="list"> + <!-- <element name="Sample_A" value="assemblies/Sample_A.fasta" /> --> + <element name="Sample_B" value="assemblies/Sample_B.fasta" /> + <element name="Sample_C" value="assemblies/Sample_C.fasta" /> + <element name="Sample_D" value="assemblies/Sample_D.fasta" /> + </collection> + </param> + <output name="isolate_data" value="Isolate_Data.tsv" compare="diff" lines_diff="17" /> + </test> + <!-- <test> + <param name="source_select" value="history" /> + <param name="reference" value="assemblies/Sample_A.fasta" ftype="fasta" /> + <param name="query_select" value="reads" /> + <param name="coll"> + <collection type="list:paired"> + <element name="Sample_A"> + <collection type="paired"> + <element name="forward" value="reads/Week_42_Reads_1.fq.gz" ftype="fastqsanger.gz" /> + <element name="reverse" value="reads/Week_42_Reads_2.fq.gz" ftype="fastqsanger.gz" /> + </collection> + </element> + </collection> + </param> + <output name="screening_results" value="Screening_Results.tsv" /> + <output name="isolate_data" value="Isolate_Data.tsv" /> + </test> --> + </tests> + <help> + 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. + </help> + <citations> + <citation type="doi">10.XXXX/placeholder.doi</citation> + <citation type="bibtex">@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}} + </citation> + </citations> +</tool>
--- /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 <min_cov>% [Default: 85] + min_cov = 85 + + // Only consider SNPs from contig alignments longer than <min_len> bp [Default: 500] + min_len = 500 + + // Only consider SNPs from contig alignments with <min_iden>% identity [Default: 99] + min_iden = 99 + + // Remove SNPs that occur within <ref_edge>bp from the end of the reference contig [Default: 150] + ref_edge = 150 + + // Remove SNPs that occur within <query_edge>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 <trim_name>, 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 +}
--- /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): +# +#<unique_build_id> <dbkey> <display_name> <file_path> +# +#So, all_fasta.loc could look something like this: +#test1 test1 Test-Genome ./test-data/test1.fa \ No newline at end of file
--- /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 @@ +<!-- Use the file tool_data_table_conf.xml.oldlocstyle if you don't want to update your loc files as changed in revision 4550:535d276c92bc--> +<tables> + <table name="all_fasta" comment_char="#"> + <columns>value, dbkey, name, path</columns> + <file path="tool-data/all_fasta.loc" /> + </table> +</tables>
