From e13cf660a3d30ed10e60b38b412059f9d6de929c Mon Sep 17 00:00:00 2001 From: Christophe Avenel Date: Wed, 31 Jan 2024 09:34:31 +0100 Subject: [PATCH 01/66] Use spatialdata zarr objects instead of AnnData Replace all reads and writes with SpatialData zarr, and use a "legacy anndata" conversion function to add images and scales, in order to plot with scanpy. --- bin/read_st_data.py | 174 ++------------------------- bin/st_clustering.qmd | 37 +++++- bin/st_quality_controls.qmd | 46 +++++-- bin/st_spatial_de.qmd | 32 ++++- env/reports/Dockerfile | 2 +- env/reports/environment.yml | 11 +- env/st_spatial_de/environment.yml | 12 +- modules/local/st_clustering.nf | 10 +- modules/local/st_quality_controls.nf | 10 +- modules/local/st_read_data.nf | 8 +- modules/local/st_spatial_de.nf | 6 +- subworkflows/local/st_downstream.nf | 11 +- workflows/spatialtranscriptomics.nf | 2 +- 13 files changed, 152 insertions(+), 209 deletions(-) diff --git a/bin/read_st_data.py b/bin/read_st_data.py index f83301b..f1b1547 100755 --- a/bin/read_st_data.py +++ b/bin/read_st_data.py @@ -2,168 +2,7 @@ # Load packages import argparse -from scanpy import read_10x_h5 -from pathlib import Path -from typing import Union, Optional - -import json -import pandas as pd -from matplotlib.image import imread -from anndata import AnnData - -from scanpy import logging as logg - - -def read_visium( - path: Union[str, Path], - genome: Optional[str] = None, - *, - count_file: str = "filtered_feature_bc_matrix.h5", - library_id: str = None, - load_images: Optional[bool] = True, - source_image_path: Optional[Union[str, Path]] = None, -) -> AnnData: - """\ - Read 10x-Genomics-formatted visum dataset. - - In addition to reading regular 10x output, - this looks for the `spatial` folder and loads images, - coordinates and scale factors. - Based on the `Space Ranger output docs`_. - - See :func:`~scanpy.pl.spatial` for a compatible plotting function. - - .. _Space Ranger output docs: https://support.10xgenomics.com/spatial-gene-expression/software/pipelines/latest/output/overview - - Parameters - ---------- - path - Path to directory for visium datafiles. - genome - Filter expression to genes within this genome. - count_file - Which file in the passed directory to use as the count file. Typically would be one of: - 'filtered_feature_bc_matrix.h5' or 'raw_feature_bc_matrix.h5'. - library_id - Identifier for the visium library. Can be modified when concatenating multiple adata objects. - source_image_path - Path to the high-resolution tissue image. Path will be included in - `.uns["spatial"][library_id]["metadata"]["source_image_path"]`. - - Returns - ------- - Annotated data matrix, where observations/cells are named by their - barcode and variables/genes by gene name. Stores the following information: - - :attr:`~anndata.AnnData.X` - The data matrix is stored - :attr:`~anndata.AnnData.obs_names` - Cell names - :attr:`~anndata.AnnData.var_names` - Gene names for a feature barcode matrix, probe names for a probe bc matrix - :attr:`~anndata.AnnData.var`\\ `['gene_ids']` - Gene IDs - :attr:`~anndata.AnnData.var`\\ `['feature_types']` - Feature types - :attr:`~anndata.AnnData.obs`\\ `[filtered_barcodes]` - filtered barcodes if present in the matrix - :attr:`~anndata.AnnData.var` - Any additional metadata present in /matrix/features is read in. - :attr:`~anndata.AnnData.uns`\\ `['spatial']` - Dict of spaceranger output files with 'library_id' as key - :attr:`~anndata.AnnData.uns`\\ `['spatial'][library_id]['images']` - Dict of images (`'hires'` and `'lowres'`) - :attr:`~anndata.AnnData.uns`\\ `['spatial'][library_id]['scalefactors']` - Scale factors for the spots - :attr:`~anndata.AnnData.uns`\\ `['spatial'][library_id]['metadata']` - Files metadata: 'chemistry_description', 'software_version', 'source_image_path' - :attr:`~anndata.AnnData.obsm`\\ `['spatial']` - Spatial spot coordinates, usable as `basis` by :func:`~scanpy.pl.embedding`. - """ - path = Path(path) - adata = read_10x_h5(path / "raw_feature_bc_matrix.h5") - # use ensemble IDs as index, because they are unique - adata.var["gene_symbol"] = adata.var_names - adata.var.set_index("gene_ids", inplace=True) - - adata.uns["spatial"] = dict() - - from h5py import File - - with File(path / count_file, mode="r") as f: - attrs = dict(f.attrs) - if library_id is None: - library_id = str(attrs.pop("library_ids")[0], "utf-8") - - adata.uns["spatial"][library_id] = dict() - - if load_images: - tissue_positions_file = ( - path / "spatial/tissue_positions.csv" - if (path / "spatial/tissue_positions.csv").exists() - else path / "spatial/tissue_positions_list.csv" - ) - files = dict( - tissue_positions_file=tissue_positions_file, - scalefactors_json_file=path / "spatial/scalefactors_json.json", - hires_image=path / "spatial/tissue_hires_image.png", - lowres_image=path / "spatial/tissue_lowres_image.png", - ) - - # check if files exists, continue if images are missing - for f in files.values(): - if not f.exists(): - if any(x in str(f) for x in ["hires_image", "lowres_image"]): - logg.warning(f"You seem to be missing an image file.\n" f"Could not find '{f}'.") - else: - raise OSError(f"Could not find '{f}'") - - adata.uns["spatial"][library_id]["images"] = dict() - for res in ["hires", "lowres"]: - try: - adata.uns["spatial"][library_id]["images"][res] = imread(str(files[f"{res}_image"])) - except Exception: - raise OSError(f"Could not find '{res}_image'") - - # read json scalefactors - adata.uns["spatial"][library_id]["scalefactors"] = json.loads(files["scalefactors_json_file"].read_bytes()) - - adata.uns["spatial"][library_id]["metadata"] = { - k: (str(attrs[k], "utf-8") if isinstance(attrs[k], bytes) else attrs[k]) - for k in ("chemistry_description", "software_version") - if k in attrs - } - - # read coordinates - positions = pd.read_csv( - files["tissue_positions_file"], - header=0 if tissue_positions_file.name == "tissue_positions.csv" else None, - index_col=0, - ) - positions.columns = [ - "in_tissue", - "array_row", - "array_col", - "pxl_col_in_fullres", - "pxl_row_in_fullres", - ] - - adata.obs = adata.obs.join(positions, how="left") - - adata.obsm["spatial"] = adata.obs[["pxl_row_in_fullres", "pxl_col_in_fullres"]].to_numpy() - adata.obs.drop( - columns=["pxl_row_in_fullres", "pxl_col_in_fullres"], - inplace=True, - ) - - # put image path in uns - if source_image_path is not None: - # get an absolute path - source_image_path = str(Path(source_image_path).resolve()) - adata.uns["spatial"][library_id]["metadata"]["source_image_path"] = str(source_image_path) - - return adata - +import spatialdata_io if __name__ == "__main__": # Parse command-line arguments @@ -173,11 +12,14 @@ def read_visium( parser.add_argument( "--SRCountDir", metavar="SRCountDir", type=str, default=None, help="Input directory with Spaceranger data." ) - parser.add_argument("--outAnnData", metavar="outAnnData", type=str, default=None, help="Output h5ad file path.") + parser.add_argument("--output_sdata", metavar="output_sdata", type=str, default=None, help="Output spatialdata zarr path.") + #TODO Add argument with meta.id for dataset_id + args = parser.parse_args() # Read Visium data - st_adata = read_visium(args.SRCountDir, count_file="raw_feature_bc_matrix.h5", library_id=None, load_images=True) + st_spatialdata = spatialdata_io.visium(args.SRCountDir, counts_file ="raw_feature_bc_matrix.h5", dataset_id ="visium") - # Write raw anndata to file - st_adata.write(args.outAnnData) + # Write raw spatialdata to file + st_spatialdata.write(args.output_sdata, overwrite=True) + \ No newline at end of file diff --git a/bin/st_clustering.qmd b/bin/st_clustering.qmd index c37fbbe..eef9dfd 100644 --- a/bin/st_clustering.qmd +++ b/bin/st_clustering.qmd @@ -12,10 +12,11 @@ jupyter: python3 #| tags: [parameters] #| echo: false -input_adata_filtered = "st_adata_filtered.h5ad" # Name of the input anndata file +input_sdata = "st_sdata_filtered.zarr" # Name of the input anndata file cluster_resolution = 1 # Resolution for Leiden clustering n_hvgs = 2000 # Number of HVGs to use for analyses output_adata_processed = "st_adata_processed.h5ad" # Name of the output anndata file +output_sdata = "st_sdata_processed.zarr" # Name of the input anndata file ``` The data has already been filtered in the _quality controls_ reports and is @@ -23,9 +24,11 @@ saved in the AnnData format: ```{python} #| warning: false +import spatialdata import scanpy as sc import numpy as np import pandas as pd +from anndata import AnnData from umap import UMAP from matplotlib import pyplot as plt import seaborn as sns @@ -33,7 +36,33 @@ from IPython.display import display, Markdown ``` ```{python} -st_adata = sc.read("./" + input_adata_filtered) +# Make sure we can use scanpy plots with the AnnData object exported from sdata.table +# This code is taken from the early version of https://github.com/scverse/spatialdata-io/pull/102/ +# Once the PR will be merged in spatialdata-io, we should use spatialdata_io.to_legacy_anndata(sdata). +def to_legacy_anndata(sdata: spatialdata.SpatialData) -> AnnData: + adata = sdata.table + for dataset_id in adata.uns["spatial"]: + adata.uns["spatial"][dataset_id]["images"] = { + "hires": np.array(sdata.images[f"{dataset_id}_hires_image"]).transpose([1, 2, 0]), + "lowres": np.array(sdata.images[f"{dataset_id}_lowres_image"]).transpose([1, 2, 0]), + } + adata.uns["spatial"][dataset_id]["scalefactors"] = { + "tissue_hires_scalef": spatialdata.transformations.get_transformation( + sdata.shapes[dataset_id], to_coordinate_system="downscaled_hires" + ).scale[0], + "tissue_lowres_scalef": spatialdata.transformations.get_transformation( + sdata.shapes[dataset_id], to_coordinate_system="downscaled_lowres" + ).scale[0], + "spot_diameter_fullres": sdata.shapes[dataset_id]["radius"][0] * 2, + } + return adata +``` + +```{python} +st_sdata = spatialdata.read_zarr("./" + input_sdata, ["images", "table", "shapes"]) + +st_adata = to_legacy_anndata(st_sdata) + print("Content of the AnnData object:") print(st_adata) ``` @@ -143,3 +172,7 @@ sc.pl.spatial(st_adata, img_key="hires", color="clusters", size=1.25) #| echo: false st_adata.write(output_adata_processed) ``` + +```{python} +st_sdata.write("./" + output_sdata) +``` diff --git a/bin/st_quality_controls.qmd b/bin/st_quality_controls.qmd index e209089..ce3f0ce 100644 --- a/bin/st_quality_controls.qmd +++ b/bin/st_quality_controls.qmd @@ -1,13 +1,11 @@ --- title: "nf-core/spatialtranscriptomics" subtitle: "Pre-processing and quality controls" -format: - nf-core-html: default jupyter: python3 --- # Introduction - + Spatial Transcriptomics data analysis involves several steps, including quality controls (QC) and pre-processing, to ensure the reliability of downstream analyses. This is an essential step in spatial transcriptomics to @@ -25,30 +23,59 @@ analysis tools and facilitates seamless integration into existing workflows. ```{python} #| tags: [parameters] #| echo: false -input_adata_raw = "st_adata_raw.h5ad" # Name of the input anndata file +input_sdata = "st_sdata_raw.zarr" # Name of the input anndata file min_counts = 500 # Min counts per spot min_genes = 250 # Min genes per spot min_spots = 1 # Min spots per gene mito_threshold = 20 # Mitochondrial content threshold (%) ribo_threshold = 0 # Ribosomal content threshold (%) hb_threshold = 100 # content threshold (%) -output_adata_filtered = "st_adata_filtered.h5ad" # Name of the output anndata file +output_sdata = "st_sdata_filtered.zarr" # Name of the input anndata file ``` ```{python} +import spatialdata import scanpy as sc import scipy import pandas as pd import matplotlib.pyplot as plt +import numpy as np import seaborn as sns +from anndata import AnnData from IPython.display import display, Markdown from textwrap import dedent plt.rcParams["figure.figsize"] = (6, 6) ``` +```{python} +# Make sure we can use scanpy plots with the AnnData object exported from sdata.table +# This code is taken from the early version of https://github.com/scverse/spatialdata-io/pull/102/ +# Once the PR will be merged in spatialdata-io, we should use spatialdata_io.to_legacy_anndata(sdata). +def to_legacy_anndata(sdata: spatialdata.SpatialData) -> AnnData: + adata = sdata.table + for dataset_id in adata.uns["spatial"]: + adata.uns["spatial"][dataset_id]["images"] = { + "hires": np.array(sdata.images[f"{dataset_id}_hires_image"]).transpose([1, 2, 0]), + "lowres": np.array(sdata.images[f"{dataset_id}_lowres_image"]).transpose([1, 2, 0]), + } + adata.uns["spatial"][dataset_id]["scalefactors"] = { + "tissue_hires_scalef": spatialdata.transformations.get_transformation( + sdata.shapes[dataset_id], to_coordinate_system="downscaled_hires" + ).scale[0], + "tissue_lowres_scalef": spatialdata.transformations.get_transformation( + sdata.shapes[dataset_id], to_coordinate_system="downscaled_lowres" + ).scale[0], + "spot_diameter_fullres": sdata.shapes[dataset_id]["radius"][0] * 2, + } + return adata +``` + ```{python} # Read the data -st_adata = sc.read("./" + input_adata_raw) + +st_sdata = spatialdata.read_zarr("./" + input_sdata, ["images", "table", "shapes"]) + +st_adata = to_legacy_anndata(st_sdata) # Convert X matrix from csr to csc dense matrix for output compatibility: st_adata.X = scipy.sparse.csc_matrix(st_adata.X) @@ -252,7 +279,8 @@ sc.pl.violin(st_adata, ['pct_counts_mt', 'pct_counts_ribo', 'pct_counts_hb'], ``` ```{python} -#| echo: false -# Write filtered data to disk -st_adata.write(output_adata_filtered) +st_sdata.write("./" + output_sdata) ``` + + + diff --git a/bin/st_spatial_de.qmd b/bin/st_spatial_de.qmd index 82d8e81..44da8ef 100644 --- a/bin/st_spatial_de.qmd +++ b/bin/st_spatial_de.qmd @@ -9,7 +9,7 @@ jupyter: python3 ```{python} #| tags: [parameters] #| echo: false -input_adata_processed = "st_adata_processed.h5ad" +input_sdata = "st_sdata.zarr" output_spatial_degs = "st_spatial_de.csv" n_top_spatial_degs = 14 ``` @@ -18,12 +18,40 @@ n_top_spatial_degs = 14 import scanpy as sc import pandas as pd import SpatialDE +import numpy as np +import spatialdata +from anndata import AnnData from matplotlib import pyplot as plt ``` +```{python} +# Make sure we can use scanpy plots with the AnnData object exported from sdata.table +# This code is taken from the early version of https://github.com/scverse/spatialdata-io/pull/102/ +# Once the PR will be merged in spatialdata-io, we should use spatialdata_io.to_legacy_anndata(sdata). +def to_legacy_anndata(sdata: spatialdata.SpatialData) -> AnnData: + adata = sdata.table + for dataset_id in adata.uns["spatial"]: + adata.uns["spatial"][dataset_id]["images"] = { + "hires": np.array(sdata.images[f"{dataset_id}_hires_image"]).transpose([1, 2, 0]), + "lowres": np.array(sdata.images[f"{dataset_id}_lowres_image"]).transpose([1, 2, 0]), + } + adata.uns["spatial"][dataset_id]["scalefactors"] = { + "tissue_hires_scalef": spatialdata.transformations.get_transformation( + sdata.shapes[dataset_id], to_coordinate_system="downscaled_hires" + ).scale[0], + "tissue_lowres_scalef": spatialdata.transformations.get_transformation( + sdata.shapes[dataset_id], to_coordinate_system="downscaled_lowres" + ).scale[0], + "spot_diameter_fullres": sdata.shapes[dataset_id]["radius"][0] * 2, + } + return adata +``` + ```{python} # Read data -st_adata = sc.read(input_adata_processed) +st_sdata = spatialdata.read_zarr("./" + input_sdata, ["images", "table", "shapes"]) + +st_adata = to_legacy_anndata(st_sdata) print("Content of the AnnData object:") print(st_adata) diff --git a/env/reports/Dockerfile b/env/reports/Dockerfile index e1cb40e..6c82239 100644 --- a/env/reports/Dockerfile +++ b/env/reports/Dockerfile @@ -2,7 +2,7 @@ FROM jdutant/quarto-minimal:1.3.313 as quarto # Second stage: multi-platform Mamba image -FROM condaforge/mambaforge:23.1.0-1 +FROM condaforge/mambaforge:23.11.0-0 # Copy Quarto installation from first stage and add to PATH COPY --from=quarto /opt/quarto /opt/quarto diff --git a/env/reports/environment.yml b/env/reports/environment.yml index f8f1923..6166d60 100644 --- a/env/reports/environment.yml +++ b/env/reports/environment.yml @@ -2,10 +2,17 @@ channels: - conda-forge - bioconda dependencies: + - python=3.10 - jupyter=1.0.0 - leidenalg=0.9.1 - papermill=2.3.4 - pip=23.0.1 - - scanpy=1.9.6 + - gcc=13.2.0 + - libgdal=3.8.3 + - gxx=13.2.0 + - imagecodecs=2024.1.1 - pip: - - SpatialDE==1.1.3 + - scanpy==1.9.8 + - spatialdata==0.0.15 + - spatialdata-io==0.0.9 + - spatialdata-plot==0.1.0 \ No newline at end of file diff --git a/env/st_spatial_de/environment.yml b/env/st_spatial_de/environment.yml index 28457d1..ad72fe9 100644 --- a/env/st_spatial_de/environment.yml +++ b/env/st_spatial_de/environment.yml @@ -1,13 +1,19 @@ channels: - conda-forge - bioconda - - defaults dependencies: - - quarto=1.3.353 + - python=3.10 - jupyter=1.0.0 - leidenalg=0.9.1 - papermill=2.3.4 - pip=23.0.1 - - scanpy=1.9.3 + - gcc=13.2.0 + - libgdal=3.8.3 + - gxx=13.2.0 + - imagecodecs=2024.1.1 - pip: + - scanpy==1.9.8 - SpatialDE==1.1.3 + - spatialdata==0.0.15 + - spatialdata-io==0.0.9 + - spatialdata-plot==0.1.0 \ No newline at end of file diff --git a/modules/local/st_clustering.nf b/modules/local/st_clustering.nf index 0819c7a..ceb49ff 100644 --- a/modules/local/st_clustering.nf +++ b/modules/local/st_clustering.nf @@ -9,7 +9,7 @@ process ST_CLUSTERING { label 'process_low' conda "conda-forge::quarto=1.3.353 conda-forge::scanpy=1.9.3 conda-forge::papermill=2.3.4 conda-forge::jupyter=1.0.0 conda-forge::leidenalg=0.9.1" - container "docker.io/erikfas/spatialtranscriptomics" + container "docker.io/cavenel/spatialtranscriptomics" // Exit if running this module with -profile conda / -profile mamba on ARM64 if (workflow.profile.tokenize(',').intersect(['conda', 'mamba']).size() >= 1) { @@ -22,10 +22,11 @@ process ST_CLUSTERING { input: path(report) path(report_template) - tuple val(meta), path(st_adata_filtered) + tuple val(meta), path(st_sdata) output: tuple val(meta), path("st_adata_processed.h5ad"), emit: st_adata_processed + tuple val(meta), path("st_sdata_processed.zarr"), emit: st_sdata_processed tuple val(meta), path("st_clustering.html") , emit: html path("versions.yml") , emit: versions @@ -35,10 +36,11 @@ process ST_CLUSTERING { script: """ quarto render ${report} \ - -P input_adata_filtered:${st_adata_filtered} \ + -P input_sdata:${st_sdata} \ -P cluster_resolution:${params.st_cluster_resolution} \ -P n_hvgs:${params.st_cluster_n_hvgs} \ - -P output_adata_processed:st_adata_processed.h5ad + -P output_adata_processed:st_adata_processed.h5ad \ + -P output_sdata:st_sdata_processed.zarr \ cat <<-END_VERSIONS > versions.yml "${task.process}": diff --git a/modules/local/st_quality_controls.nf b/modules/local/st_quality_controls.nf index f52b6bb..a57c89b 100644 --- a/modules/local/st_quality_controls.nf +++ b/modules/local/st_quality_controls.nf @@ -9,7 +9,7 @@ process ST_QUALITY_CONTROLS { label 'process_low' conda "conda-forge::quarto=1.3.353 conda-forge::scanpy=1.9.3 conda-forge::papermill=2.3.4 conda-forge::jupyter=1.0.0" - container "docker.io/erikfas/spatialtranscriptomics" + container "docker.io/cavenel/spatialtranscriptomics" // Exit if running this module with -profile conda / -profile mamba on ARM64 if (workflow.profile.tokenize(',').intersect(['conda', 'mamba']).size() >= 1) { @@ -22,10 +22,10 @@ process ST_QUALITY_CONTROLS { input: path(report) path(report_template) - tuple val(meta), path(st_adata_raw) + tuple val(meta), path(st_sdata_raw) output: - tuple val(meta), path("st_adata_filtered.h5ad") , emit: st_adata_filtered + tuple val(meta), path("st_sdata_filtered.zarr") , emit: st_sdata_filtered tuple val(meta), path("st_quality_controls.html"), emit: html path("versions.yml") , emit: versions @@ -35,14 +35,14 @@ process ST_QUALITY_CONTROLS { script: """ quarto render ${report} \ - -P input_adata_raw:${st_adata_raw} \ + -P input_sdata:${st_sdata_raw} \ -P min_counts:${params.st_qc_min_counts} \ -P min_genes:${params.st_qc_min_genes} \ -P min_spots:${params.st_qc_min_spots} \ -P mito_threshold:${params.st_qc_mito_threshold} \ -P ribo_threshold:${params.st_qc_ribo_threshold} \ -P hb_threshold:${params.st_qc_hb_threshold} \ - -P output_adata_filtered:st_adata_filtered.h5ad + -P output_sdata:st_sdata_filtered.zarr cat <<-END_VERSIONS > versions.yml "${task.process}": diff --git a/modules/local/st_read_data.nf b/modules/local/st_read_data.nf index a39c9c3..ce56d04 100644 --- a/modules/local/st_read_data.nf +++ b/modules/local/st_read_data.nf @@ -7,15 +7,13 @@ process ST_READ_DATA { label 'process_low' conda "conda-forge::scanpy=1.7.2 conda-forge::matplotlib=3.6.3 conda-forge::pandas=1.5.3" - container "${ workflow.containerEngine == 'singularity' && !task.ext.singularity_pull_docker_container ? - 'https://depot.galaxyproject.org/singularity/scanpy:1.7.2--pyhdfd78af_0' : - 'biocontainers/scanpy:1.7.2--pyhdfd78af_0' }" + container "docker.io/cavenel/spatialtranscriptomics" input: tuple val (meta), path("${meta.id}/*") output: - tuple val(meta), path("st_adata_raw.h5ad"), emit: st_adata_raw + tuple val(meta), path("st_sdata.zarr"), emit: st_sdata_raw path("versions.yml") , emit: versions when: @@ -32,7 +30,7 @@ process ST_READ_DATA { read_st_data.py \\ --SRCountDir "${meta.id}" \\ - --outAnnData st_adata_raw.h5ad + --output_sdata st_sdata.zarr cat <<-END_VERSIONS > versions.yml "${task.process}": diff --git a/modules/local/st_spatial_de.nf b/modules/local/st_spatial_de.nf index 249fda1..c02c0e0 100644 --- a/modules/local/st_spatial_de.nf +++ b/modules/local/st_spatial_de.nf @@ -9,7 +9,7 @@ process ST_SPATIAL_DE { label 'process_medium' conda "env/st_spatial_de/environment.yml" - container "docker.io/erikfas/spatialtranscriptomics" + container "docker.io/cavenel/spatialtranscriptomics" // Exit if running this module with -profile conda / -profile mamba on ARM64 if (workflow.profile.tokenize(',').intersect(['conda', 'mamba']).size() >= 1) { @@ -21,7 +21,7 @@ process ST_SPATIAL_DE { input: path(report) path(report_template) - tuple val(meta), path(st_adata_processed) + tuple val(meta), path(st_sdata) output: tuple val(meta), path("*.csv") , emit: degs @@ -34,7 +34,7 @@ process ST_SPATIAL_DE { script: """ quarto render ${report} \ - -P input_adata_processed:${st_adata_processed} \ + -P input_sdata:${st_sdata} \ -P n_top_spatial_degs:${params.st_n_top_spatial_degs} \ -P output_spatial_degs:st_spatial_de.csv diff --git a/subworkflows/local/st_downstream.nf b/subworkflows/local/st_downstream.nf index 91b5e74..9bb64ea 100644 --- a/subworkflows/local/st_downstream.nf +++ b/subworkflows/local/st_downstream.nf @@ -9,7 +9,7 @@ include { ST_CLUSTERING } from '../../modules/local/st_clustering' workflow ST_DOWNSTREAM { take: - st_adata_raw + st_sdata_raw main: @@ -29,7 +29,7 @@ workflow ST_DOWNSTREAM { ST_QUALITY_CONTROLS ( report_quality_controls, report_template, - st_adata_raw + st_sdata_raw ) ch_versions = ch_versions.mix(ST_QUALITY_CONTROLS.out.versions) @@ -39,7 +39,7 @@ workflow ST_DOWNSTREAM { ST_CLUSTERING ( report_clustering, report_template, - ST_QUALITY_CONTROLS.out.st_adata_filtered + ST_QUALITY_CONTROLS.out.st_sdata_filtered ) ch_versions = ch_versions.mix(ST_CLUSTERING.out.versions) @@ -49,15 +49,14 @@ workflow ST_DOWNSTREAM { ST_SPATIAL_DE ( report_spatial_de, report_template, - ST_CLUSTERING.out.st_adata_processed + ST_CLUSTERING.out.st_sdata_processed ) ch_versions = ch_versions.mix(ST_SPATIAL_DE.out.versions) emit: - st_data_norm = ST_QUALITY_CONTROLS.out.st_adata_filtered // channel: [ meta, h5ad ] html = ST_QUALITY_CONTROLS.out.html // channel: [ html ] - st_adata_processed = ST_CLUSTERING.out.st_adata_processed // channel: [ meta, h5ad] + st_sdata_processed = ST_CLUSTERING.out.st_sdata_processed // channel: [ meta, h5ad] html = ST_CLUSTERING.out.html // channel: [ html ] degs = ST_SPATIAL_DE.out.degs // channel: [ meta, csv ] diff --git a/workflows/spatialtranscriptomics.nf b/workflows/spatialtranscriptomics.nf index c3c34f9..8b65559 100644 --- a/workflows/spatialtranscriptomics.nf +++ b/workflows/spatialtranscriptomics.nf @@ -124,7 +124,7 @@ workflow ST { // SUBWORKFLOW: Downstream analyses of ST data // ST_DOWNSTREAM ( - ST_READ_DATA.out.st_adata_raw + ST_READ_DATA.out.st_sdata_raw ) ch_versions = ch_versions.mix(ST_DOWNSTREAM.out.versions) From d866f378cbc103f246166d8ceae230f141b495e1 Mon Sep 17 00:00:00 2001 From: Christophe Avenel Date: Wed, 31 Jan 2024 09:34:57 +0100 Subject: [PATCH 02/66] Fix typo --- nextflow_schema.json | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/nextflow_schema.json b/nextflow_schema.json index 5db2fe4..aa93d47 100644 --- a/nextflow_schema.json +++ b/nextflow_schema.json @@ -123,13 +123,13 @@ "st_qc_ribo_threshold": { "type": "number", "default": 0, - "description": "The minimum proportion of ribosomal content that a spot is needs to have to pass the filtering (no filtering is done by defeault).", + "description": "The minimum proportion of ribosomal content that a spot is needs to have to pass the filtering (no filtering is done by default).", "fa_icon": "fas fa-hashtag" }, "st_qc_hb_threshold": { "type": "number", "default": 100, - "description": "The maximum proportion of haemoglobin content that a spot is allowed to have to pass the filtering (no filtering is done by defeault).", + "description": "The maximum proportion of haemoglobin content that a spot is allowed to have to pass the filtering (no filtering is done by default).", "fa_icon": "fas fa-hashtag" }, "st_cluster_n_hvgs": { From aec833ff3ea98906e0630f543a32b8a1a085eb9d Mon Sep 17 00:00:00 2001 From: Christophe Avenel Date: Wed, 31 Jan 2024 11:23:56 +0100 Subject: [PATCH 03/66] Fix black and prettier --- bin/read_st_data.py | 11 ++++++----- env/reports/environment.yml | 2 +- env/st_spatial_de/environment.yml | 2 +- 3 files changed, 8 insertions(+), 7 deletions(-) diff --git a/bin/read_st_data.py b/bin/read_st_data.py index f1b1547..610d89a 100755 --- a/bin/read_st_data.py +++ b/bin/read_st_data.py @@ -12,14 +12,15 @@ parser.add_argument( "--SRCountDir", metavar="SRCountDir", type=str, default=None, help="Input directory with Spaceranger data." ) - parser.add_argument("--output_sdata", metavar="output_sdata", type=str, default=None, help="Output spatialdata zarr path.") - #TODO Add argument with meta.id for dataset_id - + parser.add_argument( + "--output_sdata", metavar="output_sdata", type=str, default=None, help="Output spatialdata zarr path." + ) + # TODO Add argument with meta.id for dataset_id + args = parser.parse_args() # Read Visium data - st_spatialdata = spatialdata_io.visium(args.SRCountDir, counts_file ="raw_feature_bc_matrix.h5", dataset_id ="visium") + st_spatialdata = spatialdata_io.visium(args.SRCountDir, counts_file="raw_feature_bc_matrix.h5", dataset_id="visium") # Write raw spatialdata to file st_spatialdata.write(args.output_sdata, overwrite=True) - \ No newline at end of file diff --git a/env/reports/environment.yml b/env/reports/environment.yml index 6166d60..b7da2be 100644 --- a/env/reports/environment.yml +++ b/env/reports/environment.yml @@ -15,4 +15,4 @@ dependencies: - scanpy==1.9.8 - spatialdata==0.0.15 - spatialdata-io==0.0.9 - - spatialdata-plot==0.1.0 \ No newline at end of file + - spatialdata-plot==0.1.0 diff --git a/env/st_spatial_de/environment.yml b/env/st_spatial_de/environment.yml index ad72fe9..984e420 100644 --- a/env/st_spatial_de/environment.yml +++ b/env/st_spatial_de/environment.yml @@ -16,4 +16,4 @@ dependencies: - SpatialDE==1.1.3 - spatialdata==0.0.15 - spatialdata-io==0.0.9 - - spatialdata-plot==0.1.0 \ No newline at end of file + - spatialdata-plot==0.1.0 From 12ca8836b63ba6a5f587bee4efe79e6520623e2e Mon Sep 17 00:00:00 2001 From: Erik Fasterius Date: Mon, 12 Feb 2024 10:45:43 +0100 Subject: [PATCH 04/66] Update Conda environment and Dockerfile --- env/{reports => }/Dockerfile | 24 +++++++++++++++++++----- env/{reports => }/environment.yml | 3 ++- env/st_spatial_de/environment.yml | 13 ------------- 3 files changed, 21 insertions(+), 19 deletions(-) rename env/{reports => }/Dockerfile (53%) rename env/{reports => }/environment.yml (84%) delete mode 100644 env/st_spatial_de/environment.yml diff --git a/env/reports/Dockerfile b/env/Dockerfile similarity index 53% rename from env/reports/Dockerfile rename to env/Dockerfile index e1cb40e..ad89aec 100644 --- a/env/reports/Dockerfile +++ b/env/Dockerfile @@ -1,10 +1,24 @@ -# First stage: multi-platform Quarto image -FROM jdutant/quarto-minimal:1.3.313 as quarto +# +# First stage: Quarto installation +# +FROM ubuntu:20.04 as quarto +ARG QUARTO_VERSION=1.4.549 +ARG TARGETARCH +RUN apt-get update \ + && apt-get install -y --no-install-recommends \ + ca-certificates \ + curl \ + && apt-get clean -# Second stage: multi-platform Mamba image -FROM condaforge/mambaforge:23.1.0-1 +RUN mkdir -p /opt/quarto \ + && curl -o quarto.tar.gz -L "https://github.com/quarto-dev/quarto-cli/releases/download/v${QUARTO_VERSION}/quarto-${QUARTO_VERSION}-linux-${TARGETARCH}.tar.gz" \ + && tar -zxvf quarto.tar.gz -C /opt/quarto/ --strip-components=1 \ + && rm quarto.tar.gz -# Copy Quarto installation from first stage and add to PATH +# +# Second stage: Conda environment +# +FROM condaforge/mambaforge:23.11.0-0 COPY --from=quarto /opt/quarto /opt/quarto ENV PATH="${PATH}:/opt/quarto/bin" diff --git a/env/reports/environment.yml b/env/environment.yml similarity index 84% rename from env/reports/environment.yml rename to env/environment.yml index f8f1923..45d6be9 100644 --- a/env/reports/environment.yml +++ b/env/environment.yml @@ -1,11 +1,12 @@ channels: - conda-forge - bioconda + - defaults dependencies: - jupyter=1.0.0 - leidenalg=0.9.1 - papermill=2.3.4 - pip=23.0.1 - - scanpy=1.9.6 + - scanpy=1.9.8 - pip: - SpatialDE==1.1.3 diff --git a/env/st_spatial_de/environment.yml b/env/st_spatial_de/environment.yml deleted file mode 100644 index 28457d1..0000000 --- a/env/st_spatial_de/environment.yml +++ /dev/null @@ -1,13 +0,0 @@ -channels: - - conda-forge - - bioconda - - defaults -dependencies: - - quarto=1.3.353 - - jupyter=1.0.0 - - leidenalg=0.9.1 - - papermill=2.3.4 - - pip=23.0.1 - - scanpy=1.9.3 - - pip: - - SpatialDE==1.1.3 From 3ced22c695b05c014c88b67514765db15c67c674 Mon Sep 17 00:00:00 2001 From: Erik Fasterius Date: Mon, 12 Feb 2024 12:43:25 +0100 Subject: [PATCH 05/66] Add QUARTONOTEBOOK nf-core module --- modules.json | 6 + modules/nf-core/quartonotebook/Dockerfile | 38 ++ .../nf-core/quartonotebook/environment.yml | 12 + modules/nf-core/quartonotebook/main.nf | 107 +++++ modules/nf-core/quartonotebook/meta.yml | 83 ++++ modules/nf-core/quartonotebook/parametrize.nf | 36 ++ .../quartonotebook/quartonotebook.diff | 14 + .../nf-core/quartonotebook/tests/main.nf.test | 212 +++++++++ .../quartonotebook/tests/main.nf.test.snap | 433 ++++++++++++++++++ .../tests/no-parametrization.config | 9 + modules/nf-core/quartonotebook/tests/tags.yml | 2 + .../tests/with-parametrization.config | 5 + 12 files changed, 957 insertions(+) create mode 100644 modules/nf-core/quartonotebook/Dockerfile create mode 100644 modules/nf-core/quartonotebook/environment.yml create mode 100644 modules/nf-core/quartonotebook/main.nf create mode 100644 modules/nf-core/quartonotebook/meta.yml create mode 100644 modules/nf-core/quartonotebook/parametrize.nf create mode 100644 modules/nf-core/quartonotebook/quartonotebook.diff create mode 100644 modules/nf-core/quartonotebook/tests/main.nf.test create mode 100644 modules/nf-core/quartonotebook/tests/main.nf.test.snap create mode 100644 modules/nf-core/quartonotebook/tests/no-parametrization.config create mode 100644 modules/nf-core/quartonotebook/tests/tags.yml create mode 100644 modules/nf-core/quartonotebook/tests/with-parametrization.config diff --git a/modules.json b/modules.json index c114074..87dcd88 100644 --- a/modules.json +++ b/modules.json @@ -20,6 +20,12 @@ "git_sha": "9e71d8519dfbfc328c078bba14d4bd4c99e39a94", "installed_by": ["modules"] }, + "quartonotebook": { + "branch": "master", + "git_sha": "07ecae35e5675ac4c1e2d84cf22021490f8b7947", + "installed_by": ["modules"], + "patch": "modules/nf-core/quartonotebook/quartonotebook.diff" + }, "spaceranger/count": { "branch": "master", "git_sha": "3bd057bfdfb64578636ff3ae7f7cb8eeab3c0cb6", diff --git a/modules/nf-core/quartonotebook/Dockerfile b/modules/nf-core/quartonotebook/Dockerfile new file mode 100644 index 0000000..0acc6f0 --- /dev/null +++ b/modules/nf-core/quartonotebook/Dockerfile @@ -0,0 +1,38 @@ +# +# First stage: Quarto installation +# +FROM ubuntu:20.04 as quarto +ARG QUARTO_VERSION=1.3.433 +ARG TARGETARCH +RUN apt-get update \ + && apt-get install -y --no-install-recommends \ + ca-certificates \ + curl \ + && apt-get clean + +RUN mkdir -p /opt/quarto \ + && curl -o quarto.tar.gz -L "https://github.com/quarto-dev/quarto-cli/releases/download/v${QUARTO_VERSION}/quarto-${QUARTO_VERSION}-linux-${TARGETARCH}.tar.gz" \ + && tar -zxvf quarto.tar.gz -C /opt/quarto/ --strip-components=1 \ + && rm quarto.tar.gz + +# +# Second stage: Conda environment +# +FROM condaforge/mambaforge:23.11.0-0 +COPY --from=quarto /opt/quarto /opt/quarto +ENV PATH="${PATH}:/opt/quarto/bin" + +# Install packages using Mamba; also remove static libraries, python bytecode +# files and javascript source maps that are not required for execution +COPY environment.yml ./ +RUN mamba env update --name base --file environment.yml \ + && mamba clean --all --force-pkgs-dirs --yes \ + && find /opt/conda -follow -type f -name '*.a' -delete \ + && find /opt/conda -follow -type f -name '*.pyc' -delete \ + && find /opt/conda -follow -type f -name '*.js.map' -delete + +CMD /bin/bash + +LABEL \ + authors = "Erik Fasterius" \ + description = "Dockerfile for the quartonotebook nf-core module" diff --git a/modules/nf-core/quartonotebook/environment.yml b/modules/nf-core/quartonotebook/environment.yml new file mode 100644 index 0000000..1084ec0 --- /dev/null +++ b/modules/nf-core/quartonotebook/environment.yml @@ -0,0 +1,12 @@ +name: quartonotebook + +channels: + - conda-forge + - bioconda + - defaults + +dependencies: + - conda-forge::jupyter=1.0.0 + - conda-forge::matplotlib=3.4.3 + - conda-forge::papermill=2.4.0 + - conda-forge::r-rmarkdown=2.25 diff --git a/modules/nf-core/quartonotebook/main.nf b/modules/nf-core/quartonotebook/main.nf new file mode 100644 index 0000000..aca349e --- /dev/null +++ b/modules/nf-core/quartonotebook/main.nf @@ -0,0 +1,107 @@ +include { dumpParamsYaml; indentCodeBlock } from "./parametrize" + +process QUARTONOTEBOOK { + tag "$meta.id" + label 'process_low' + + // NB: You'll likely want to override this with a container containing all + // required dependencies for your analyses. You'll at least need Quarto + // itself, Papermill and whatever language you are running your analyses on; + // you can see an example in this module's Dockerfile. + container "docker.io/erikfas/spatialtranscriptomics" + + input: + tuple val(meta), path(notebook) + val parameters + path input_files + path extensions + + output: + tuple val(meta), path("*.html") , emit: html + tuple val(meta), path("${notebook}"), emit: notebook + tuple val(meta), path("artifacts/*"), emit: artifacts, optional: true + tuple val(meta), path("params.yml") , emit: params_yaml, optional: true + tuple val(meta), path("_extensions"), emit: extensions, optional: true + path "versions.yml" , emit: versions + + when: + task.ext.when == null || task.ext.when + + script: + // Exit if running this module with -profile conda / -profile mamba + // This is because of issues with getting a homogenous environment across + // both AMD64 and ARM64 architectures; please find more information at + // https://github.com/nf-core/modules/pull/4876#discussion_r1483541037. + if (workflow.profile.tokenize(',').intersect(['conda', 'mamba']).size() >= 1) { + exit 1, "The QUARTONOTEBOOK module does not support Conda/Mamba, please use Docker / Singularity / Podman instead." + } + def args = task.ext.args ?: '' + def prefix = task.ext.prefix ?: "${meta.id}" + def parametrize = (task.ext.parametrize == null) ? true : task.ext.parametrize + def implicit_params = (task.ext.implicit_params == null) ? true : task.ext.implicit_params + def meta_params = (task.ext.meta_params == null) ? true : task.ext.meta_params + + // Dump parameters to yaml file. + // Using a YAML file over using the CLI params because + // - No issue with escaping + // - Allows passing nested maps instead of just single values + // - Allows running with the language-agnostic `--execute-params` + def params_cmd = "" + def render_args = "" + if (parametrize) { + nb_params = [:] + if (implicit_params) { + nb_params["cpus"] = task.cpus + nb_params["artifact_dir"] = "artifacts" + nb_params["input_dir"] = "./" + } + if (meta_params) { + nb_params["meta"] = meta + } + nb_params += parameters + params_cmd = dumpParamsYaml(nb_params) + render_args = "--execute-params params.yml" + } + """ + # Dump .params.yml heredoc (section will be empty if parametrization is disabled) + ${indentCodeBlock(params_cmd, 4)} + + # Create output directory + mkdir artifacts + + # Set environment variables needed for Quarto rendering + export XDG_CACHE_HOME="./.xdg_cache_home" + export XDG_DATA_HOME="./.xdg_data_home" + + # Set parallelism for BLAS/MKL etc. to avoid over-booking of resources + export MKL_NUM_THREADS="$task.cpus" + export OPENBLAS_NUM_THREADS="$task.cpus" + export OMP_NUM_THREADS="$task.cpus" + export NUMBA_NUM_THREADS="$task.cpus" + + # Render notebook + quarto render \\ + ${notebook} \\ + ${render_args} \\ + ${args} \\ + --output ${prefix}.html + + cat <<-END_VERSIONS > versions.yml + "${task.process}": + quarto: \$(quarto -v) + papermill: \$(papermill --version | cut -f1 -d' ') + END_VERSIONS + """ + + stub: + def args = task.ext.args ?: '' + def prefix = task.ext.prefix ?: "${meta.id}" + """ + touch ${prefix}.html + + cat <<-END_VERSIONS > versions.yml + "${task.process}": + quarto: \$(quarto -v) + END_VERSIONS + """ +} diff --git a/modules/nf-core/quartonotebook/meta.yml b/modules/nf-core/quartonotebook/meta.yml new file mode 100644 index 0000000..5d95e8b --- /dev/null +++ b/modules/nf-core/quartonotebook/meta.yml @@ -0,0 +1,83 @@ +name: "quartonotebook" +description: Render a Quarto notebook, including parametrization. +keywords: + - quarto + - notebook + - reports + - python + - r +tools: + - quartonotebook: + description: An open-source scientific and technical publishing system. + homepage: https://quarto.org/ + documentation: https://quarto.org/docs/reference/ + tool_dev_url: https://github.com/quarto-dev/quarto-cli + licence: ["MIT"] + - papermill: + description: Parameterize, execute, and analyze notebooks + homepage: https://github.com/nteract/papermill + documentation: http://papermill.readthedocs.io/en/latest/ + tool_dev_url: https://github.com/nteract/papermill + licence: ["BSD 3-clause"] + +input: + - meta: + type: map + description: | + Groovy Map containing sample information + e.g. `[ id:'sample1', single_end:false ]`. + - notebook: + type: file + description: The Quarto notebook to be rendered. + pattern: "*.{qmd}" + - parameters: + type: map + description: | + Groovy map with notebook parameters which will be passed to Quarto to + generate parametrized reports. + - input_files: + type: file + description: One or multiple files serving as input data for the notebook. + pattern: "*" + - extensions: + type: file + description: | + A quarto `_extensions` directory with custom template(s) to be + available for rendering. + pattern: "*" + +output: + - meta: + type: map + description: | + Groovy Map containing sample information + e.g. `[ id:'sample1', single_end:false ]`. + - html: + type: file + description: HTML report generated by Quarto. + pattern: "*.html" + - notebook: + type: file + description: The original, un-rendered notebook. + pattern: "*.[qmd,ipynb,rmd]" + - artifacts: + type: file + description: Artifacts generated during report rendering. + pattern: "*" + - params_yaml: + type: file + description: Parameters used during report rendering. + pattern: "*" + - extensions: + type: file + description: Quarto extensions used during report rendering. + pattern: "*" + - versions: + type: file + description: File containing software versions. + pattern: "versions.yml" + +authors: + - "@fasterius" +maintainers: + - "@fasterius" diff --git a/modules/nf-core/quartonotebook/parametrize.nf b/modules/nf-core/quartonotebook/parametrize.nf new file mode 100644 index 0000000..b3d8cea --- /dev/null +++ b/modules/nf-core/quartonotebook/parametrize.nf @@ -0,0 +1,36 @@ +import org.yaml.snakeyaml.Yaml +import org.yaml.snakeyaml.DumperOptions + + +/** + * Multiline code blocks need to have the same indentation level + * as the `script:` section. This function re-indents code to the specified level. + */ +def indentCodeBlock(code, n_spaces) { + def indent_str = " ".multiply(n_spaces) + return code.stripIndent().split("\n").join("\n" + indent_str) +} + +/** + * Create a config YAML file from a groovy map + * + * @params task The process' `task` variable + * @returns a line to be inserted in the bash script. + */ +def dumpParamsYaml(params) { + DumperOptions options = new DumperOptions(); + options.setDefaultFlowStyle(DumperOptions.FlowStyle.BLOCK); + def yaml = new Yaml(options) + def yaml_str = yaml.dump(params) + + // Writing the params.yml file directly as follows does not work. + // It only works in 'exec:', but not if there is a `script:` section: + // task.workDir.resolve('params.yml').text = yaml_str + + // Therefore, we inject it into the bash script: + return """\ + cat <<"END_PARAMS_SECTION" > ./params.yml + ${indentCodeBlock(yaml_str, 8)} + END_PARAMS_SECTION + """ +} diff --git a/modules/nf-core/quartonotebook/quartonotebook.diff b/modules/nf-core/quartonotebook/quartonotebook.diff new file mode 100644 index 0000000..29b5704 --- /dev/null +++ b/modules/nf-core/quartonotebook/quartonotebook.diff @@ -0,0 +1,14 @@ +Changes in module 'nf-core/quartonotebook' +--- modules/nf-core/quartonotebook/main.nf ++++ modules/nf-core/quartonotebook/main.nf +@@ -8,7 +8,7 @@ + // required dependencies for your analyses. You'll at least need Quarto + // itself, Papermill and whatever language you are running your analyses on; + // you can see an example in this module's Dockerfile. +- container "docker.io/erikfas/quartonotebook" ++ container "docker.io/erikfas/spatialtranscriptomics" + + input: + tuple val(meta), path(notebook) + +************************************************************ diff --git a/modules/nf-core/quartonotebook/tests/main.nf.test b/modules/nf-core/quartonotebook/tests/main.nf.test new file mode 100644 index 0000000..aeec8b1 --- /dev/null +++ b/modules/nf-core/quartonotebook/tests/main.nf.test @@ -0,0 +1,212 @@ +nextflow_process { + + name "Test Process QUARTONOTEBOOK" + script "../main.nf" + process "QUARTONOTEBOOK" + + tag "modules" + tag "modules_nfcore" + tag "quartonotebook" + + test("test notebook - [qmd:r]") { + + config "./no-parametrization.config" + + when { + process { + """ + input[0] = [ + [ id:'test' ], // meta map + file(params.test_data['generic']['notebooks']['quarto_r'], checkIfExists: true) // Notebook + ] + input[1] = [:] // Parameters + input[2] = [] // Input files + input[3] = [] // Extensions + """ + } + } + + then { + assertAll( + { assert process.success }, + { assert snapshot(process.out).match() }, + ) + } + + } + + test("test notebook - [qmd:python]") { + + config "./no-parametrization.config" + + when { + process { + """ + input[0] = [ + [ id:'test' ], // meta map + file(params.test_data['generic']['notebooks']['quarto_python'], checkIfExists: true) // Notebook + ] + input[1] = [] // Parameters + input[2] = [] // Input files + input[3] = [] // Extensions + """ + } + } + + then { + assertAll( + { assert process.success }, + { assert snapshot( + process.out.versions, + process.out.artifacts, + process.out.params_yaml, + ).match() }, + { assert path(process.out.html[0][1]).readLines().any { it.contains('Hello world') } } + ) + } + + } + + test("test notebook - parametrized - [qmd:r]") { + + config "./with-parametrization.config" + + when { + process { + """ + input[0] = [ + [ id:'test' ], // meta map + file(params.test_data['generic']['notebooks']['quarto_r'], checkIfExists: true) // Notebook + ] + input[1] = [input_filename: "hello.txt", n_iter: 12] // parameters + input[2] = file(params.test_data['generic']['txt']['hello'], checkIfExists: true) // Input files + input[3] = [] // Extensions + """ + } + } + + then { + assertAll( + { assert process.success }, + { assert snapshot(process.out).match() }, + ) + } + + } + + test("test notebook - parametrized - [qmd:python]") { + + config "./with-parametrization.config" + + when { + process { + """ + input[0] = [ + [ id:'test' ], // meta map + file(params.test_data['generic']['notebooks']['quarto_python'], checkIfExists: true) // Notebook + ] + input[1] = [input_filename: "hello.txt", n_iter: 12] // parameters + input[2] = file(params.test_data['generic']['txt']['hello'], checkIfExists: true) // Input files + input[3] = [] // Extensions + """ + } + } + + then { + assertAll( + { assert process.success }, + { assert snapshot( + process.out.versions, + process.out.artifacts, + process.out.params_yaml, + ).match() }, + { assert path(process.out.html[0][1]).readLines().any { it.contains('Hello world') } } + ) + } + + } + + test("test notebook - parametrized - [rmd]") { + + config "./with-parametrization.config" + + when { + process { + """ + input[0] = [ + [ id:'test' ], // meta map + file(params.test_data['generic']['notebooks']['rmarkdown'], checkIfExists: true) // notebook + ] + input[1] = [input_filename: "hello.txt", n_iter: 12] // parameters + input[2] = file(params.test_data['generic']['txt']['hello'], checkIfExists: true) // Input files + input[3] = [] // Extensions + """ + } + } + + then { + assertAll( + { assert process.success }, + { assert snapshot(process.out).match() }, + ) + } + + } + + test("test notebook - parametrized - [ipynb]") { + + config "./with-parametrization.config" + + when { + process { + """ + input[0] = [ + [ id:'test' ], // meta map + file(params.test_data['generic']['notebooks']['ipython_ipynb'], checkIfExists: true) // notebook + ] + input[1] = [input_filename: "hello.txt", n_iter: 12] // parameters + input[2] = file(params.test_data['generic']['txt']['hello'], checkIfExists: true) // Input files + input[3] = [] // Extensions + """ + } + } + + then { + assertAll( + { assert process.success }, + { assert snapshot(process.out).match() }, + ) + } + + } + + test("test notebook - stub - [qmd:r]") { + + config "./no-parametrization.config" + + options "-stub" + + when { + process { + """ + input[0] = [ + [ id:'test' ], // meta map + file(params.test_data['generic']['notebooks']['quarto_r'], checkIfExists: true) // Notebook + ] + input[1] = [:] // Parameters + input[2] = [] // Input files + input[3] = [] // Extensions + """ + } + } + + then { + assertAll( + { assert process.success }, + { assert snapshot(process.out).match() }, + ) + } + + } + +} \ No newline at end of file diff --git a/modules/nf-core/quartonotebook/tests/main.nf.test.snap b/modules/nf-core/quartonotebook/tests/main.nf.test.snap new file mode 100644 index 0000000..f0f04cb --- /dev/null +++ b/modules/nf-core/quartonotebook/tests/main.nf.test.snap @@ -0,0 +1,433 @@ +{ + "test notebook - stub - [qmd:r]": { + "content": [ + { + "0": [ + [ + { + "id": "test" + }, + "test.html:md5,d41d8cd98f00b204e9800998ecf8427e" + ] + ], + "1": [ + [ + { + "id": "test" + }, + "quarto_r.qmd:md5,b3fa8b456efae62495c0b278a4f7694c" + ] + ], + "2": [ + + ], + "3": [ + + ], + "4": [ + + ], + "5": [ + "versions.yml:md5,93481281b24bb1b44ecc4387e0957a0e" + ], + "artifacts": [ + + ], + "extensions": [ + + ], + "html": [ + [ + { + "id": "test" + }, + "test.html:md5,d41d8cd98f00b204e9800998ecf8427e" + ] + ], + "notebook": [ + [ + { + "id": "test" + }, + "quarto_r.qmd:md5,b3fa8b456efae62495c0b278a4f7694c" + ] + ], + "params_yaml": [ + + ], + "versions": [ + "versions.yml:md5,93481281b24bb1b44ecc4387e0957a0e" + ] + } + ], + "meta": { + "nf-test": "0.8.4", + "nextflow": "23.10.1" + }, + "timestamp": "2024-02-09T11:06:33.408525" + }, + "test notebook - [qmd:r]": { + "content": [ + { + "0": [ + [ + { + "id": "test" + }, + "test.html:md5,f09282296a5eee0154665975d842c07e" + ] + ], + "1": [ + [ + { + "id": "test" + }, + "quarto_r.qmd:md5,b3fa8b456efae62495c0b278a4f7694c" + ] + ], + "2": [ + + ], + "3": [ + + ], + "4": [ + + ], + "5": [ + "versions.yml:md5,55e1f767fbd72aae14cbbfb638e38a90" + ], + "artifacts": [ + + ], + "extensions": [ + + ], + "html": [ + [ + { + "id": "test" + }, + "test.html:md5,f09282296a5eee0154665975d842c07e" + ] + ], + "notebook": [ + [ + { + "id": "test" + }, + "quarto_r.qmd:md5,b3fa8b456efae62495c0b278a4f7694c" + ] + ], + "params_yaml": [ + + ], + "versions": [ + "versions.yml:md5,55e1f767fbd72aae14cbbfb638e38a90" + ] + } + ], + "meta": { + "nf-test": "0.8.4", + "nextflow": "23.10.1" + }, + "timestamp": "2024-02-09T11:05:50.985424" + }, + "test notebook - parametrized - [qmd:python]": { + "content": [ + [ + "versions.yml:md5,55e1f767fbd72aae14cbbfb638e38a90" + ], + [ + [ + { + "id": "test" + }, + "artifact.txt:md5,8ddd8be4b179a529afa5f2ffae4b9858" + ] + ], + [ + [ + { + "id": "test" + }, + "params.yml:md5,efd62bc975f429e8749ba787a93042dd" + ] + ] + ], + "meta": { + "nf-test": "0.8.4", + "nextflow": "23.10.1" + }, + "timestamp": "2024-02-09T09:21:18.194591" + }, + "test notebook - parametrized - [rmd]": { + "content": [ + { + "0": [ + [ + { + "id": "test" + }, + "test.html:md5,2b2026646ed8b59d49fdcbd54cb3a463" + ] + ], + "1": [ + [ + { + "id": "test" + }, + "rmarkdown_notebook.Rmd:md5,1f5e4efbb41fd499b23c5bea2fc32e68" + ] + ], + "2": [ + [ + { + "id": "test" + }, + "artifact.txt:md5,b10a8db164e0754105b7a99be72e3fe5" + ] + ], + "3": [ + [ + { + "id": "test" + }, + "params.yml:md5,efd62bc975f429e8749ba787a93042dd" + ] + ], + "4": [ + + ], + "5": [ + "versions.yml:md5,55e1f767fbd72aae14cbbfb638e38a90" + ], + "artifacts": [ + [ + { + "id": "test" + }, + "artifact.txt:md5,b10a8db164e0754105b7a99be72e3fe5" + ] + ], + "extensions": [ + + ], + "html": [ + [ + { + "id": "test" + }, + "test.html:md5,2b2026646ed8b59d49fdcbd54cb3a463" + ] + ], + "notebook": [ + [ + { + "id": "test" + }, + "rmarkdown_notebook.Rmd:md5,1f5e4efbb41fd499b23c5bea2fc32e68" + ] + ], + "params_yaml": [ + [ + { + "id": "test" + }, + "params.yml:md5,efd62bc975f429e8749ba787a93042dd" + ] + ], + "versions": [ + "versions.yml:md5,55e1f767fbd72aae14cbbfb638e38a90" + ] + } + ], + "meta": { + "nf-test": "0.8.4", + "nextflow": "23.10.1" + }, + "timestamp": "2024-02-09T11:06:25.046249" + }, + "test notebook - parametrized - [ipynb]": { + "content": [ + { + "0": [ + [ + { + "id": "test" + }, + "test.html:md5,d7378ec0d1fd83b44424a68bf03a8fc3" + ] + ], + "1": [ + [ + { + "id": "test" + }, + "ipython_notebook.ipynb:md5,02a206bf6c66396827dd310e7443926d" + ] + ], + "2": [ + + ], + "3": [ + [ + { + "id": "test" + }, + "params.yml:md5,efd62bc975f429e8749ba787a93042dd" + ] + ], + "4": [ + + ], + "5": [ + "versions.yml:md5,55e1f767fbd72aae14cbbfb638e38a90" + ], + "artifacts": [ + + ], + "extensions": [ + + ], + "html": [ + [ + { + "id": "test" + }, + "test.html:md5,d7378ec0d1fd83b44424a68bf03a8fc3" + ] + ], + "notebook": [ + [ + { + "id": "test" + }, + "ipython_notebook.ipynb:md5,02a206bf6c66396827dd310e7443926d" + ] + ], + "params_yaml": [ + [ + { + "id": "test" + }, + "params.yml:md5,efd62bc975f429e8749ba787a93042dd" + ] + ], + "versions": [ + "versions.yml:md5,55e1f767fbd72aae14cbbfb638e38a90" + ] + } + ], + "meta": { + "nf-test": "0.8.4", + "nextflow": "23.10.1" + }, + "timestamp": "2024-02-09T11:06:30.278412" + }, + "test notebook - [qmd:python]": { + "content": [ + [ + "versions.yml:md5,55e1f767fbd72aae14cbbfb638e38a90" + ], + [ + + ], + [ + + ] + ], + "meta": { + "nf-test": "0.8.4", + "nextflow": "23.10.1" + }, + "timestamp": "2024-02-09T09:21:00.324109" + }, + "test notebook - parametrized - [qmd:r]": { + "content": [ + { + "0": [ + [ + { + "id": "test" + }, + "test.html:md5,a25cdff28851a163d28669d4e62655af" + ] + ], + "1": [ + [ + { + "id": "test" + }, + "quarto_r.qmd:md5,b3fa8b456efae62495c0b278a4f7694c" + ] + ], + "2": [ + [ + { + "id": "test" + }, + "artifact.txt:md5,b10a8db164e0754105b7a99be72e3fe5" + ] + ], + "3": [ + [ + { + "id": "test" + }, + "params.yml:md5,efd62bc975f429e8749ba787a93042dd" + ] + ], + "4": [ + + ], + "5": [ + "versions.yml:md5,55e1f767fbd72aae14cbbfb638e38a90" + ], + "artifacts": [ + [ + { + "id": "test" + }, + "artifact.txt:md5,b10a8db164e0754105b7a99be72e3fe5" + ] + ], + "extensions": [ + + ], + "html": [ + [ + { + "id": "test" + }, + "test.html:md5,a25cdff28851a163d28669d4e62655af" + ] + ], + "notebook": [ + [ + { + "id": "test" + }, + "quarto_r.qmd:md5,b3fa8b456efae62495c0b278a4f7694c" + ] + ], + "params_yaml": [ + [ + { + "id": "test" + }, + "params.yml:md5,efd62bc975f429e8749ba787a93042dd" + ] + ], + "versions": [ + "versions.yml:md5,55e1f767fbd72aae14cbbfb638e38a90" + ] + } + ], + "meta": { + "nf-test": "0.8.4", + "nextflow": "23.10.1" + }, + "timestamp": "2024-02-09T11:06:08.013103" + } +} \ No newline at end of file diff --git a/modules/nf-core/quartonotebook/tests/no-parametrization.config b/modules/nf-core/quartonotebook/tests/no-parametrization.config new file mode 100644 index 0000000..f686514 --- /dev/null +++ b/modules/nf-core/quartonotebook/tests/no-parametrization.config @@ -0,0 +1,9 @@ +profiles { + docker { + docker.runOptions = '-u $(id -u):$(id -g)' + } +} + +process { + ext.parametrize = false +} diff --git a/modules/nf-core/quartonotebook/tests/tags.yml b/modules/nf-core/quartonotebook/tests/tags.yml new file mode 100644 index 0000000..638b0ce --- /dev/null +++ b/modules/nf-core/quartonotebook/tests/tags.yml @@ -0,0 +1,2 @@ +quartonotebook: + - "modules/nf-core/quartonotebook/**" diff --git a/modules/nf-core/quartonotebook/tests/with-parametrization.config b/modules/nf-core/quartonotebook/tests/with-parametrization.config new file mode 100644 index 0000000..ab7df66 --- /dev/null +++ b/modules/nf-core/quartonotebook/tests/with-parametrization.config @@ -0,0 +1,5 @@ +profiles { + docker { + docker.runOptions = '-u $(id -u):$(id -g)' + } +} From 2e595b7ce5e6edce3b017ac6bba6e446b3470a2c Mon Sep 17 00:00:00 2001 From: Erik Fasterius Date: Mon, 12 Feb 2024 12:43:42 +0100 Subject: [PATCH 06/66] Use QUARTONOTEBOOK module in pipeline --- bin/st_clustering.qmd | 4 +- bin/st_quality_controls.qmd | 4 +- bin/st_spatial_de.qmd | 8 ++- subworkflows/local/st_downstream.nf | 104 +++++++++++++++++++++------- 4 files changed, 92 insertions(+), 28 deletions(-) diff --git a/bin/st_clustering.qmd b/bin/st_clustering.qmd index be8e496..47bebfe 100644 --- a/bin/st_clustering.qmd +++ b/bin/st_clustering.qmd @@ -15,6 +15,7 @@ jupyter: python3 input_adata_filtered = "st_adata_filtered.h5ad" # Name of the input anndata file cluster_resolution = 1 # Resolution for Leiden clustering n_hvgs = 2000 # Number of HVGs to use for analyses +artifact_dir = "artifacts" output_adata_processed = "st_adata_processed.h5ad" # Name of the output anndata file ``` @@ -23,6 +24,7 @@ saved in the AnnData format: ```{python} #| warning: false +import os import scanpy as sc import numpy as np import pandas as pd @@ -141,5 +143,5 @@ sc.pl.spatial(st_adata, img_key="hires", color="clusters", size=1.25) ```{python} #| echo: false -st_adata.write(output_adata_processed) +st_adata.write(os.path.join(artifact_dir, output_adata_processed)) ``` diff --git a/bin/st_quality_controls.qmd b/bin/st_quality_controls.qmd index a841d8f..06d6dc3 100644 --- a/bin/st_quality_controls.qmd +++ b/bin/st_quality_controls.qmd @@ -32,10 +32,12 @@ min_spots = 1 # Min spots per gene mito_threshold = 20 # Mitochondrial content threshold (%) ribo_threshold = 0 # Ribosomal content threshold (%) hb_threshold = 100 # content threshold (%) +artifact_dir = "artifacts" output_adata_filtered = "st_adata_filtered.h5ad" # Name of the output anndata file ``` ```{python} +import os import scanpy as sc import scipy import pandas as pd @@ -254,5 +256,5 @@ sc.pl.violin(st_adata, ['pct_counts_mt', 'pct_counts_ribo', 'pct_counts_hb'], ```{python} #| echo: false # Write filtered data to disk -st_adata.write(output_adata_filtered) +st_adata.write(os.path.join(artifact_dir, output_adata_filtered)) ``` diff --git a/bin/st_spatial_de.qmd b/bin/st_spatial_de.qmd index 0e1e211..600d588 100644 --- a/bin/st_spatial_de.qmd +++ b/bin/st_spatial_de.qmd @@ -10,11 +10,13 @@ jupyter: python3 #| tags: [parameters] #| echo: false input_adata_processed = "st_adata_processed.h5ad" -output_spatial_degs = "st_spatial_de.csv" n_top_spatial_degs = 14 +artifact_dir = "artifacts/" +output_spatial_degs = "st_spatial_de.csv" ``` ```{python} +import os import scanpy as sc import pandas as pd import SpatialDE @@ -84,8 +86,10 @@ st_adata.var = pd.concat([st_adata.var, results.loc[st_adata.var.index.values, : # Print results table results_tab = st_adata.var.sort_values("qval", ascending=True) -results_tab.to_csv(output_spatial_degs) results_tab.head(n_top_spatial_degs) + +# Write results to file +results_tab.to_csv(os.path.join(artifact_dir, output_spatial_degs)) ``` We can also plot the top spatially variable genes on top of the tissue image diff --git a/subworkflows/local/st_downstream.nf b/subworkflows/local/st_downstream.nf index 91b5e74..9d2b5cb 100644 --- a/subworkflows/local/st_downstream.nf +++ b/subworkflows/local/st_downstream.nf @@ -2,9 +2,9 @@ // Subworkflow for downstream analyses of ST data // -include { ST_QUALITY_CONTROLS } from '../../modules/local/st_quality_controls' -include { ST_SPATIAL_DE } from '../../modules/local/st_spatial_de' -include { ST_CLUSTERING } from '../../modules/local/st_clustering' +include { QUARTONOTEBOOK as ST_QUALITY_CONTROLS } from '../../modules/nf-core/quartonotebook/main' +include { QUARTONOTEBOOK as ST_SPATIAL_DE } from '../../modules/nf-core/quartonotebook/main' +include { QUARTONOTEBOOK as ST_CLUSTERING } from '../../modules/nf-core/quartonotebook/main' workflow ST_DOWNSTREAM { @@ -16,52 +16,108 @@ workflow ST_DOWNSTREAM { ch_versions = Channel.empty() // - // Report files + // Quarto reports and extension files // - report_quality_controls = file("${projectDir}/bin/st_quality_controls.qmd") - report_clustering = file("${projectDir}/bin/st_clustering.qmd") - report_spatial_de = file("${projectDir}/bin/st_spatial_de.qmd") - report_template = Channel.fromPath("${projectDir}/assets/_extensions").collect() + quality_controls_file = file("${projectDir}/bin/st_quality_controls.qmd", checkIfExists: true) + clustering_file = file("${projectDir}/bin/st_clustering.qmd", checkIfExists: true) + spatial_de_file = file("${projectDir}/bin/st_spatial_de.qmd", checkIfExists: true) + extensions = Channel.fromPath("${projectDir}/assets/_extensions").collect() + + // input: + // tuple val(meta), path(notebook) + // val parameters + // path input_files + // path extensions + + // output: + // tuple val(meta), path("*.html") , emit: html + // tuple val(meta), path("${notebook}"), emit: notebook + // tuple val(meta), path("artifacts/*"), emit: artifacts, optional: true + // tuple val(meta), path("params.yml") , emit: params_yaml, optional: true + // tuple val(meta), path("_extensions"), emit: extensions, optional: true + // path "versions.yml" , emit: versions // // Quality controls and filtering // + ch_quality_controls_input_data = st_adata_raw + .map { it -> it[1] } + ch_quality_controls_notebook = st_adata_raw + .map { tuple(it[0], quality_controls_file) } + quality_controls_params = [ + input_raw_data: "st_adata_raw.h5ad", + min_counts: params.st_qc_min_counts, + min_genes: params.st_qc_min_genes, + min_spots: params.st_qc_min_spots, + mito_threshold: params.st_qc_mito_threshold, + ribo_threshold: params.st_qc_ribo_threshold, + hb_threshold: params.st_qc_hb_threshold, + output_adata_filtered: "st_adata_filtered.h5ad" + ] ST_QUALITY_CONTROLS ( - report_quality_controls, - report_template, - st_adata_raw + ch_quality_controls_notebook, + quality_controls_params, + ch_quality_controls_input_data, + extensions ) ch_versions = ch_versions.mix(ST_QUALITY_CONTROLS.out.versions) // // Normalisation, dimensionality reduction and clustering // + ch_clustering_input_data = ST_QUALITY_CONTROLS.out.artifacts + .map { it -> it[1] } + ch_clustering_notebook = ST_QUALITY_CONTROLS.out.artifacts + .map { tuple(it[0], clustering_file) } + clustering_params = [ + input_adata_filtered: "st_adata_filtered.h5ad", + cluster_resolution: params.st_cluster_resolution, + n_hvgs: params.st_cluster_n_hvgs, + output_adata_processed: "st_adata_processed.h5ad" + ] ST_CLUSTERING ( - report_clustering, - report_template, - ST_QUALITY_CONTROLS.out.st_adata_filtered + ch_clustering_notebook, + clustering_params, + ch_clustering_input_data, + extensions ) ch_versions = ch_versions.mix(ST_CLUSTERING.out.versions) // // Spatial differential expression // + ch_spatial_de_input_data = ST_CLUSTERING.out.artifacts + .map { it -> it[1] } + ch_spatial_de_notebook = ST_CLUSTERING.out.artifacts + .map { tuple(it[0], spatial_de_file) } + spatial_de_params = [ + input_adata_processed: "st_adata_processed.h5ad", + n_top_spatial_degs: params.st_n_top_spatial_degs, + output_spatial_degs: "st_spatial_de.csv" + ] ST_SPATIAL_DE ( - report_spatial_de, - report_template, - ST_CLUSTERING.out.st_adata_processed + ch_spatial_de_notebook, + spatial_de_params, + ch_spatial_de_input_data, + extensions ) ch_versions = ch_versions.mix(ST_SPATIAL_DE.out.versions) emit: - st_data_norm = ST_QUALITY_CONTROLS.out.st_adata_filtered // channel: [ meta, h5ad ] - html = ST_QUALITY_CONTROLS.out.html // channel: [ html ] + st_qc_html = ST_QUALITY_CONTROLS.out.html // channel: [ meta, html ] + st_adata_filtered = ST_QUALITY_CONTROLS.out.artifacts // channel: [ meta, h5ad ] + st_qc_notebook = ST_QUALITY_CONTROLS.out.notebook // channel: [ meta, qmd ] + st_qc_params = ST_QUALITY_CONTROLS.out.params_yaml // channel: [ meta, yml ] - st_adata_processed = ST_CLUSTERING.out.st_adata_processed // channel: [ meta, h5ad] - html = ST_CLUSTERING.out.html // channel: [ html ] + st_clustering_html = ST_CLUSTERING.out.html // channel: [ html ] + st_adata_processed = ST_CLUSTERING.out.artifacts // channel: [ meta, h5ad] + st_clustering_notebook = ST_CLUSTERING.out.notebook // channel: [ meta, qmd ] + st_clustering_params = ST_CLUSTERING.out.params_yaml // channel: [ meta, yml ] - degs = ST_SPATIAL_DE.out.degs // channel: [ meta, csv ] - html = ST_SPATIAL_DE.out.html // channel: [ html ] + st_spatial_html = ST_SPATIAL_DE.out.html // channel: [ meta, html ] + st_degs = ST_SPATIAL_DE.out.artifacts // channel: [ meta, csv ] + st_spatial_notebook = ST_SPATIAL_DE.out.notebook // channel: [ meta, qmd ] + st_spatial_params = ST_SPATIAL_DE.out.params_yaml // channel: [ meta, yml ] - versions = ch_versions // channel: [ versions.yml ] + versions = ch_versions // channel: [ versions.yml ] } From 508c0b25af38d2dfc46f9db4b87e575f3f7b9ed5 Mon Sep 17 00:00:00 2001 From: Erik Fasterius Date: Mon, 12 Feb 2024 12:44:22 +0100 Subject: [PATCH 07/66] Remove old local modules --- modules/local/st_clustering.nf | 49 ------------------------- modules/local/st_quality_controls.nf | 53 ---------------------------- modules/local/st_spatial_de.nf | 49 ------------------------- 3 files changed, 151 deletions(-) delete mode 100644 modules/local/st_clustering.nf delete mode 100644 modules/local/st_quality_controls.nf delete mode 100644 modules/local/st_spatial_de.nf diff --git a/modules/local/st_clustering.nf b/modules/local/st_clustering.nf deleted file mode 100644 index 0819c7a..0000000 --- a/modules/local/st_clustering.nf +++ /dev/null @@ -1,49 +0,0 @@ -// -// Dimensionality reduction and clustering -// -process ST_CLUSTERING { - - // TODO: Update Conda directive when Quarto/Pandoc works on ARM64 - - tag "${meta.id}" - label 'process_low' - - conda "conda-forge::quarto=1.3.353 conda-forge::scanpy=1.9.3 conda-forge::papermill=2.3.4 conda-forge::jupyter=1.0.0 conda-forge::leidenalg=0.9.1" - container "docker.io/erikfas/spatialtranscriptomics" - - // Exit if running this module with -profile conda / -profile mamba on ARM64 - if (workflow.profile.tokenize(',').intersect(['conda', 'mamba']).size() >= 1) { - architecture = System.getProperty("os.arch") - if (architecture == "arm64" || architecture == "aarch64") { - exit 1, "The ST_CLUSTERING module does not support Conda on ARM64. Please use Docker / Singularity / Podman instead." - } - } - - input: - path(report) - path(report_template) - tuple val(meta), path(st_adata_filtered) - - output: - tuple val(meta), path("st_adata_processed.h5ad"), emit: st_adata_processed - tuple val(meta), path("st_clustering.html") , emit: html - path("versions.yml") , emit: versions - - when: - task.ext.when == null || task.ext.when - - script: - """ - quarto render ${report} \ - -P input_adata_filtered:${st_adata_filtered} \ - -P cluster_resolution:${params.st_cluster_resolution} \ - -P n_hvgs:${params.st_cluster_n_hvgs} \ - -P output_adata_processed:st_adata_processed.h5ad - - cat <<-END_VERSIONS > versions.yml - "${task.process}": - quarto: \$(quarto -v) - scanpy: \$(python -c "import scanpy; print(scanpy.__version__)") - END_VERSIONS - """ -} diff --git a/modules/local/st_quality_controls.nf b/modules/local/st_quality_controls.nf deleted file mode 100644 index f52b6bb..0000000 --- a/modules/local/st_quality_controls.nf +++ /dev/null @@ -1,53 +0,0 @@ -// -// Quality controls and filtering -// -process ST_QUALITY_CONTROLS { - - // TODO: Update Conda directive when Quarto/Pandoc works on ARM64 - - tag "${meta.id}" - label 'process_low' - - conda "conda-forge::quarto=1.3.353 conda-forge::scanpy=1.9.3 conda-forge::papermill=2.3.4 conda-forge::jupyter=1.0.0" - container "docker.io/erikfas/spatialtranscriptomics" - - // Exit if running this module with -profile conda / -profile mamba on ARM64 - if (workflow.profile.tokenize(',').intersect(['conda', 'mamba']).size() >= 1) { - architecture = System.getProperty("os.arch") - if (architecture == "arm64" || architecture == "aarch64") { - exit 1, "The ST_QUALITY_CONTROLS module does not support Conda on ARM64. Please use Docker / Singularity / Podman instead." - } - } - - input: - path(report) - path(report_template) - tuple val(meta), path(st_adata_raw) - - output: - tuple val(meta), path("st_adata_filtered.h5ad") , emit: st_adata_filtered - tuple val(meta), path("st_quality_controls.html"), emit: html - path("versions.yml") , emit: versions - - when: - task.ext.when == null || task.ext.when - - script: - """ - quarto render ${report} \ - -P input_adata_raw:${st_adata_raw} \ - -P min_counts:${params.st_qc_min_counts} \ - -P min_genes:${params.st_qc_min_genes} \ - -P min_spots:${params.st_qc_min_spots} \ - -P mito_threshold:${params.st_qc_mito_threshold} \ - -P ribo_threshold:${params.st_qc_ribo_threshold} \ - -P hb_threshold:${params.st_qc_hb_threshold} \ - -P output_adata_filtered:st_adata_filtered.h5ad - - cat <<-END_VERSIONS > versions.yml - "${task.process}": - quarto: \$(quarto -v) - scanpy: \$(python -c "import scanpy; print(scanpy.__version__)") - END_VERSIONS - """ -} diff --git a/modules/local/st_spatial_de.nf b/modules/local/st_spatial_de.nf deleted file mode 100644 index 249fda1..0000000 --- a/modules/local/st_spatial_de.nf +++ /dev/null @@ -1,49 +0,0 @@ -// -// Spatial differential expression -// -process ST_SPATIAL_DE { - - // TODO: Update Conda directive when Quarto/Pandoc works on ARM64 - - tag "${meta.id}" - label 'process_medium' - - conda "env/st_spatial_de/environment.yml" - container "docker.io/erikfas/spatialtranscriptomics" - - // Exit if running this module with -profile conda / -profile mamba on ARM64 - if (workflow.profile.tokenize(',').intersect(['conda', 'mamba']).size() >= 1) { - architecture = System.getProperty("os.arch") - if (architecture == "arm64" || architecture == "aarch64") { - exit 1, "The ST_SPATIAL_DE module does not support Conda on ARM64. Please use Docker / Singularity / Podman instead." - } - } - input: - path(report) - path(report_template) - tuple val(meta), path(st_adata_processed) - - output: - tuple val(meta), path("*.csv") , emit: degs - tuple val(meta), path("st_spatial_de.html"), emit: html - path("versions.yml") , emit: versions - - when: - task.ext.when == null || task.ext.when - - script: - """ - quarto render ${report} \ - -P input_adata_processed:${st_adata_processed} \ - -P n_top_spatial_degs:${params.st_n_top_spatial_degs} \ - -P output_spatial_degs:st_spatial_de.csv - - cat <<-END_VERSIONS > versions.yml - "${task.process}": - quarto: \$(quarto -v) - leidenalg: \$(python -c "import leidenalg; print(leidenalg.version)") - scanpy: \$(python -c "import scanpy; print(scanpy.__version__)") - SpatialDE: \$(python -c "from importlib.metadata import version; print(version('SpatialDE'))") - END_VERSIONS - """ -} From 393bc3cdbff97a0b35e851fccec3480e0c40aae9 Mon Sep 17 00:00:00 2001 From: Erik Fasterius Date: Mon, 12 Feb 2024 12:56:46 +0100 Subject: [PATCH 08/66] Update changelog --- CHANGELOG.md | 1 + 1 file changed, 1 insertion(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index ee3eb02..07df750 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -18,6 +18,7 @@ compatible with further downstream analyses and/or exploration in _e.g._ ### `Added` +- Use the QUARTONOTEBOOK nf-core module instead of local Quarto-based modules [[#68](https://github.com/nf-core/spatialtranscriptomics/pull/68)] - Add a custom nf-core Quarto template for the downstream analysis reports [[#64](https://github.com/nf-core/spatialtranscriptomics/pull/64)] - Allow input directories `fastq_dir` and `spaceranger_dir` to be specified as tar archives (`.tar.gz`) - Add a check to make sure that there are spots left after filtering [[#46](https://github.com/nf-core/spatialtranscriptomics/issues/46)] From 64d332761b2cc678159bb966b2f2eabb20654981 Mon Sep 17 00:00:00 2001 From: Erik Fasterius Date: Mon, 12 Feb 2024 16:21:29 +0100 Subject: [PATCH 09/66] Remove XDG paths, which are now in QUARTONOTEBOOK --- conf/modules.config | 6 ------ 1 file changed, 6 deletions(-) diff --git a/conf/modules.config b/conf/modules.config index 30a52b1..ceb78b1 100644 --- a/conf/modules.config +++ b/conf/modules.config @@ -10,12 +10,6 @@ ---------------------------------------------------------------------------------------- */ -// Environment specification needed for Quarto -env { - XDG_CACHE_HOME = "./.xdg_cache_home" - XDG_DATA_HOME = "./.xdg_data_home" -} - process { publishDir = [ From fe7a7dce3d14dfd0c4c6795879787d1ac2053f0a Mon Sep 17 00:00:00 2001 From: Erik Fasterius Date: Mon, 12 Feb 2024 16:21:58 +0100 Subject: [PATCH 10/66] Lower test thresholds --- conf/test.config | 4 ++-- conf/test_downstream.config | 4 ++-- conf/test_spaceranger_v1.config | 4 ++-- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/conf/test.config b/conf/test.config index ce4909c..6bc2be8 100644 --- a/conf/test.config +++ b/conf/test.config @@ -25,7 +25,7 @@ params { spaceranger_reference = "https://raw.githubusercontent.com/nf-core/test-datasets/spatialtranscriptomics/testdata/homo_sapiens_chr22_reference.tar.gz" // Parameters - st_qc_min_counts = 5 - st_qc_min_genes = 3 + st_qc_min_counts = 1 + st_qc_min_genes = 1 outdir = 'results' } diff --git a/conf/test_downstream.config b/conf/test_downstream.config index 89a56b2..d8f951f 100644 --- a/conf/test_downstream.config +++ b/conf/test_downstream.config @@ -25,7 +25,7 @@ params { spaceranger_reference = "https://raw.githubusercontent.com/nf-core/test-datasets/spatialtranscriptomics/testdata/homo_sapiens_chr22_reference.tar.gz" // Parameters - st_qc_min_counts = 5 - st_qc_min_genes = 3 + st_qc_min_counts = 1 + st_qc_min_genes = 1 outdir = 'results' } diff --git a/conf/test_spaceranger_v1.config b/conf/test_spaceranger_v1.config index 2fca10e..b08d492 100644 --- a/conf/test_spaceranger_v1.config +++ b/conf/test_spaceranger_v1.config @@ -25,7 +25,7 @@ params { spaceranger_reference = "https://raw.githubusercontent.com/nf-core/test-datasets/spatialtranscriptomics/testdata/homo_sapiens_chr22_reference.tar.gz" // Parameters - st_qc_min_counts = 5 - st_qc_min_genes = 3 + st_qc_min_counts = 1 + st_qc_min_genes = 1 outdir = 'results' } From 548bc6778c2367100c308669182e9e50af7caa2d Mon Sep 17 00:00:00 2001 From: Erik Fasterius Date: Mon, 12 Feb 2024 16:29:27 +0100 Subject: [PATCH 11/66] Revert "Lower test thresholds" This reverts commit fe7a7dce3d14dfd0c4c6795879787d1ac2053f0a. Lowering the test thresholds was part of troubleshooting the spatial DE module, but did solve the issue. --- conf/test.config | 4 ++-- conf/test_downstream.config | 4 ++-- conf/test_spaceranger_v1.config | 4 ++-- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/conf/test.config b/conf/test.config index 6bc2be8..ce4909c 100644 --- a/conf/test.config +++ b/conf/test.config @@ -25,7 +25,7 @@ params { spaceranger_reference = "https://raw.githubusercontent.com/nf-core/test-datasets/spatialtranscriptomics/testdata/homo_sapiens_chr22_reference.tar.gz" // Parameters - st_qc_min_counts = 1 - st_qc_min_genes = 1 + st_qc_min_counts = 5 + st_qc_min_genes = 3 outdir = 'results' } diff --git a/conf/test_downstream.config b/conf/test_downstream.config index d8f951f..89a56b2 100644 --- a/conf/test_downstream.config +++ b/conf/test_downstream.config @@ -25,7 +25,7 @@ params { spaceranger_reference = "https://raw.githubusercontent.com/nf-core/test-datasets/spatialtranscriptomics/testdata/homo_sapiens_chr22_reference.tar.gz" // Parameters - st_qc_min_counts = 1 - st_qc_min_genes = 1 + st_qc_min_counts = 5 + st_qc_min_genes = 3 outdir = 'results' } diff --git a/conf/test_spaceranger_v1.config b/conf/test_spaceranger_v1.config index b08d492..2fca10e 100644 --- a/conf/test_spaceranger_v1.config +++ b/conf/test_spaceranger_v1.config @@ -25,7 +25,7 @@ params { spaceranger_reference = "https://raw.githubusercontent.com/nf-core/test-datasets/spatialtranscriptomics/testdata/homo_sapiens_chr22_reference.tar.gz" // Parameters - st_qc_min_counts = 1 - st_qc_min_genes = 1 + st_qc_min_counts = 5 + st_qc_min_genes = 3 outdir = 'results' } From 66e32bca56a81583a5542f5d8c9600a8af3f3081 Mon Sep 17 00:00:00 2001 From: Erik Fasterius Date: Mon, 12 Feb 2024 16:39:08 +0100 Subject: [PATCH 12/66] Fix report module output names and paths --- conf/modules.config | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/conf/modules.config b/conf/modules.config index ceb78b1..c3a628e 100644 --- a/conf/modules.config +++ b/conf/modules.config @@ -63,16 +63,24 @@ process { } withName: 'ST_READ_DATA|ST_QUALITY_CONTROLS|ST_CLUSTERING|ST_SPATIAL_DE' { + ext.prefix = { "${notebook.baseName}" } publishDir = [ [ path: { "${params.outdir}/${meta.id}/reports" }, mode: params.publish_dir_mode, - pattern: "*{.html,_files}" + pattern: "*{.html,.qmd,_extensions}" + ], + [ + path: { "${params.outdir}/${meta.id}/reports" }, + mode: params.publish_dir_mode, + pattern: "params.yml", + saveAs: { "${notebook.baseName}.yml" } ], [ path: { "${params.outdir}/${meta.id}/data" }, mode: params.publish_dir_mode, - pattern: "st_adata_processed.h5ad" + pattern: "artifacts/st_adata_processed.h5ad", + saveAs: { "st_adata_processed.h5ad" } ], [ path: { "${params.outdir}/${meta.id}/degs" }, From 522639895b791a3103a7a4d135c5fbd2125fd01d Mon Sep 17 00:00:00 2001 From: Erik Fasterius Date: Mon, 12 Feb 2024 16:42:02 +0100 Subject: [PATCH 13/66] Update Conda environment --- env/environment.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/env/environment.yml b/env/environment.yml index 45d6be9..6e06a99 100644 --- a/env/environment.yml +++ b/env/environment.yml @@ -8,5 +8,6 @@ dependencies: - papermill=2.3.4 - pip=23.0.1 - scanpy=1.9.8 + - seaborn=0.12.2 - pip: - SpatialDE==1.1.3 From cd7a35272c1b4a1d741758666f52463b69dd682c Mon Sep 17 00:00:00 2001 From: nf-core-bot Date: Tue, 20 Feb 2024 15:30:46 +0000 Subject: [PATCH 14/66] Template update for nf-core/tools version 2.13 --- .editorconfig | 9 +- .github/workflows/awsfulltest.yml | 4 +- .github/workflows/awstest.yml | 4 +- .github/workflows/branch.yml | 2 +- .github/workflows/ci.yml | 7 +- .github/workflows/clean-up.yml | 2 +- .github/workflows/download_pipeline.yml | 17 +- .github/workflows/linting.yml | 12 +- .github/workflows/linting_comment.yml | 4 +- .github/workflows/release-announcements.yml | 11 +- README.md | 5 +- assets/multiqc_config.yml | 2 + assets/schema_input.json | 21 +- bin/check_samplesheet.py | 259 ----------- conf/modules.config | 8 - lib/NfcoreTemplate.groovy | 356 -------------- lib/Utils.groovy | 47 -- lib/WorkflowMain.groovy | 77 --- lib/WorkflowSpatialtranscriptomics.groovy | 122 ----- main.nf | 100 ++-- modules.json | 28 +- modules/local/samplesheet_check.nf | 31 -- .../dumpsoftwareversions/environment.yml | 7 - .../custom/dumpsoftwareversions/main.nf | 24 - .../custom/dumpsoftwareversions/meta.yml | 37 -- .../templates/dumpsoftwareversions.py | 102 ---- .../dumpsoftwareversions/tests/main.nf.test | 43 -- .../tests/main.nf.test.snap | 33 -- .../dumpsoftwareversions/tests/tags.yml | 2 - modules/nf-core/fastqc/tests/main.nf.test | 14 +- .../nf-core/fastqc/tests/main.nf.test.snap | 76 ++- modules/nf-core/multiqc/environment.yml | 2 +- modules/nf-core/multiqc/main.nf | 4 +- modules/nf-core/multiqc/tests/main.nf.test | 13 +- .../nf-core/multiqc/tests/main.nf.test.snap | 32 +- nextflow.config | 5 +- nextflow_schema.json | 1 + pyproject.toml | 8 +- subworkflows/local/input_check.nf | 44 -- .../main.nf | 247 ++++++++++ .../nf-core/utils_nextflow_pipeline/main.nf | 126 +++++ .../nf-core/utils_nextflow_pipeline/meta.yml | 38 ++ .../tests/main.function.nf.test | 54 +++ .../tests/main.function.nf.test.snap | 12 + .../tests/main.workflow.nf.test | 123 +++++ .../tests/nextflow.config | 9 + .../utils_nextflow_pipeline/tests/tags.yml | 2 + .../nf-core/utils_nfcore_pipeline/main.nf | 440 ++++++++++++++++++ .../nf-core/utils_nfcore_pipeline/meta.yml | 24 + .../tests/main.function.nf.test | 134 ++++++ .../tests/main.function.nf.test.snap | 138 ++++++ .../tests/main.workflow.nf.test | 29 ++ .../tests/main.workflow.nf.test.snap | 15 + .../tests/nextflow.config | 9 + .../utils_nfcore_pipeline/tests/tags.yml | 2 + .../nf-core/utils_nfvalidation_plugin/main.nf | 62 +++ .../utils_nfvalidation_plugin/meta.yml | 44 ++ .../tests/main.nf.test | 200 ++++++++ .../tests/nextflow_schema.json | 96 ++++ .../utils_nfvalidation_plugin/tests/tags.yml | 2 + workflows/spatialtranscriptomics.nf | 133 ++---- 61 files changed, 2108 insertions(+), 1406 deletions(-) delete mode 100755 bin/check_samplesheet.py delete mode 100755 lib/NfcoreTemplate.groovy delete mode 100644 lib/Utils.groovy delete mode 100755 lib/WorkflowMain.groovy delete mode 100755 lib/WorkflowSpatialtranscriptomics.groovy delete mode 100644 modules/local/samplesheet_check.nf delete mode 100644 modules/nf-core/custom/dumpsoftwareversions/environment.yml delete mode 100644 modules/nf-core/custom/dumpsoftwareversions/main.nf delete mode 100644 modules/nf-core/custom/dumpsoftwareversions/meta.yml delete mode 100755 modules/nf-core/custom/dumpsoftwareversions/templates/dumpsoftwareversions.py delete mode 100644 modules/nf-core/custom/dumpsoftwareversions/tests/main.nf.test delete mode 100644 modules/nf-core/custom/dumpsoftwareversions/tests/main.nf.test.snap delete mode 100644 modules/nf-core/custom/dumpsoftwareversions/tests/tags.yml delete mode 100644 subworkflows/local/input_check.nf create mode 100644 subworkflows/local/utils_nfcore_spatialtranscriptomics_pipeline/main.nf create mode 100644 subworkflows/nf-core/utils_nextflow_pipeline/main.nf create mode 100644 subworkflows/nf-core/utils_nextflow_pipeline/meta.yml create mode 100644 subworkflows/nf-core/utils_nextflow_pipeline/tests/main.function.nf.test create mode 100644 subworkflows/nf-core/utils_nextflow_pipeline/tests/main.function.nf.test.snap create mode 100644 subworkflows/nf-core/utils_nextflow_pipeline/tests/main.workflow.nf.test create mode 100644 subworkflows/nf-core/utils_nextflow_pipeline/tests/nextflow.config create mode 100644 subworkflows/nf-core/utils_nextflow_pipeline/tests/tags.yml create mode 100644 subworkflows/nf-core/utils_nfcore_pipeline/main.nf create mode 100644 subworkflows/nf-core/utils_nfcore_pipeline/meta.yml create mode 100644 subworkflows/nf-core/utils_nfcore_pipeline/tests/main.function.nf.test create mode 100644 subworkflows/nf-core/utils_nfcore_pipeline/tests/main.function.nf.test.snap create mode 100644 subworkflows/nf-core/utils_nfcore_pipeline/tests/main.workflow.nf.test create mode 100644 subworkflows/nf-core/utils_nfcore_pipeline/tests/main.workflow.nf.test.snap create mode 100644 subworkflows/nf-core/utils_nfcore_pipeline/tests/nextflow.config create mode 100644 subworkflows/nf-core/utils_nfcore_pipeline/tests/tags.yml create mode 100644 subworkflows/nf-core/utils_nfvalidation_plugin/main.nf create mode 100644 subworkflows/nf-core/utils_nfvalidation_plugin/meta.yml create mode 100644 subworkflows/nf-core/utils_nfvalidation_plugin/tests/main.nf.test create mode 100644 subworkflows/nf-core/utils_nfvalidation_plugin/tests/nextflow_schema.json create mode 100644 subworkflows/nf-core/utils_nfvalidation_plugin/tests/tags.yml diff --git a/.editorconfig b/.editorconfig index 9b99008..dd9ffa5 100644 --- a/.editorconfig +++ b/.editorconfig @@ -18,7 +18,12 @@ end_of_line = unset insert_final_newline = unset trim_trailing_whitespace = unset indent_style = unset -indent_size = unset +[/subworkflows/nf-core/**] +charset = unset +end_of_line = unset +insert_final_newline = unset +trim_trailing_whitespace = unset +indent_style = unset [/assets/email*] indent_size = unset @@ -28,5 +33,5 @@ indent_size = unset indent_style = unset # ignore python -[*.{py}] +[*.{py,md}] indent_style = unset diff --git a/.github/workflows/awsfulltest.yml b/.github/workflows/awsfulltest.yml index 5906667..9fba086 100644 --- a/.github/workflows/awsfulltest.yml +++ b/.github/workflows/awsfulltest.yml @@ -14,7 +14,7 @@ jobs: runs-on: ubuntu-latest steps: - name: Launch workflow via tower - uses: seqeralabs/action-tower-launch@v2 + uses: seqeralabs/action-tower-launch@922e5c8d5ac4e918107ec311d2ebbd65e5982b3d # v2 # TODO nf-core: You can customise AWS full pipeline tests as required # Add full size test data (but still relatively small datasets for few samples) # on the `test_full.config` test runs with only one set of parameters @@ -31,7 +31,7 @@ jobs: } profiles: test_full - - uses: actions/upload-artifact@v4 + - uses: actions/upload-artifact@5d5d22a31266ced268874388b861e4b58bb5c2f3 # v4 with: name: Tower debug log file path: | diff --git a/.github/workflows/awstest.yml b/.github/workflows/awstest.yml index a3d63eb..b026b0a 100644 --- a/.github/workflows/awstest.yml +++ b/.github/workflows/awstest.yml @@ -12,7 +12,7 @@ jobs: steps: # Launch workflow using Tower CLI tool action - name: Launch workflow via tower - uses: seqeralabs/action-tower-launch@v2 + uses: seqeralabs/action-tower-launch@922e5c8d5ac4e918107ec311d2ebbd65e5982b3d # v2 with: workspace_id: ${{ secrets.TOWER_WORKSPACE_ID }} access_token: ${{ secrets.TOWER_ACCESS_TOKEN }} @@ -25,7 +25,7 @@ jobs: } profiles: test - - uses: actions/upload-artifact@v4 + - uses: actions/upload-artifact@5d5d22a31266ced268874388b861e4b58bb5c2f3 # v4 with: name: Tower debug log file path: | diff --git a/.github/workflows/branch.yml b/.github/workflows/branch.yml index 5f10613..9ab998b 100644 --- a/.github/workflows/branch.yml +++ b/.github/workflows/branch.yml @@ -19,7 +19,7 @@ jobs: # NOTE - this doesn't currently work if the PR is coming from a fork, due to limitations in GitHub actions secrets - name: Post PR comment if: failure() - uses: mshick/add-pr-comment@v2 + uses: mshick/add-pr-comment@b8f338c590a895d50bcbfa6c5859251edc8952fc # v2 with: message: | ## This PR is against the `master` branch :x: diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 396fe22..4547075 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -28,13 +28,16 @@ jobs: - "latest-everything" steps: - name: Check out pipeline code - uses: actions/checkout@v4 + uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4 - name: Install Nextflow - uses: nf-core/setup-nextflow@v1 + uses: nf-core/setup-nextflow@b9f764e8ba5c76b712ace14ecbfcef0e40ae2dd8 # v1 with: version: "${{ matrix.NXF_VER }}" + - name: Disk space cleanup + uses: jlumbroso/free-disk-space@54081f138730dfa15788a46383842cd2f914a1be # v1.3.1 + - name: Run pipeline with test data # TODO nf-core: You can customise CI pipeline run tests as required # For example: adding multiple test runs with different parameters diff --git a/.github/workflows/clean-up.yml b/.github/workflows/clean-up.yml index e37cfda..0b6b1f2 100644 --- a/.github/workflows/clean-up.yml +++ b/.github/workflows/clean-up.yml @@ -10,7 +10,7 @@ jobs: issues: write pull-requests: write steps: - - uses: actions/stale@v9 + - uses: actions/stale@28ca1036281a5e5922ead5184a1bbf96e5fc984e # v9 with: stale-issue-message: "This issue has been tagged as awaiting-changes or awaiting-feedback by an nf-core contributor. Remove stale label or add a comment otherwise this issue will be closed in 20 days." stale-pr-message: "This PR has been tagged as awaiting-changes or awaiting-feedback by an nf-core contributor. Remove stale label or add a comment if it is still useful." diff --git a/.github/workflows/download_pipeline.yml b/.github/workflows/download_pipeline.yml index 8611458..f823210 100644 --- a/.github/workflows/download_pipeline.yml +++ b/.github/workflows/download_pipeline.yml @@ -6,6 +6,11 @@ name: Test successful pipeline download with 'nf-core download' # - the head branch of the pull request is updated, i.e. if fixes for a release are pushed last minute to dev. on: workflow_dispatch: + inputs: + testbranch: + description: "The specific branch you wish to utilize for the test execution of nf-core download." + required: true + default: "dev" pull_request: types: - opened @@ -23,13 +28,13 @@ jobs: runs-on: ubuntu-latest steps: - name: Install Nextflow - uses: nf-core/setup-nextflow@v1 + uses: nf-core/setup-nextflow@b9f764e8ba5c76b712ace14ecbfcef0e40ae2dd8 # v1 - - uses: actions/setup-python@v5 + - uses: actions/setup-python@0a5c61591373683505ea898e09a3ea4f39ef2b9c # v5 with: python-version: "3.11" architecture: "x64" - - uses: eWaterCycle/setup-singularity@v7 + - uses: eWaterCycle/setup-singularity@931d4e31109e875b13309ae1d07c70ca8fbc8537 # v7 with: singularity-version: 3.8.3 @@ -42,13 +47,13 @@ jobs: run: | echo "REPO_LOWERCASE=${GITHUB_REPOSITORY,,}" >> ${GITHUB_ENV} echo "REPOTITLE_LOWERCASE=$(basename ${GITHUB_REPOSITORY,,})" >> ${GITHUB_ENV} - echo "REPO_BRANCH=${GITHUB_REF#refs/heads/}" >> ${GITHUB_ENV} + echo "REPO_BRANCH=${{ github.event.inputs.testbranch || 'dev' }}" >> ${GITHUB_ENV} - name: Download the pipeline env: NXF_SINGULARITY_CACHEDIR: ./ run: | - nf-core download ${{ env.REPO_LOWERCASE }} \ + nf-core download ${{ env.REPO_LOWERCASE }} \ --revision ${{ env.REPO_BRANCH }} \ --outdir ./${{ env.REPOTITLE_LOWERCASE }} \ --compress "none" \ @@ -64,4 +69,4 @@ jobs: env: NXF_SINGULARITY_CACHEDIR: ./ NXF_SINGULARITY_HOME_MOUNT: true - run: nextflow run ./${{ env.REPOTITLE_LOWERCASE }}/$( sed 's/\W/_/g' <<< ${{ env.REPO_BRANCH }}) -stub -profile test,singularity --outdir ./results + run: nextflow run ./${{ env.REPOTITLE_LOWERCASE }}/$( sed 's/\W/_/g' <<< ${{ env.REPO_BRANCH }}) -stub -profile test,singularity --outdir ./results diff --git a/.github/workflows/linting.yml b/.github/workflows/linting.yml index 81cd098..748b431 100644 --- a/.github/workflows/linting.yml +++ b/.github/workflows/linting.yml @@ -14,10 +14,10 @@ jobs: pre-commit: runs-on: ubuntu-latest steps: - - uses: actions/checkout@v4 + - uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4 - name: Set up Python 3.11 - uses: actions/setup-python@v5 + uses: actions/setup-python@0a5c61591373683505ea898e09a3ea4f39ef2b9c # v5 with: python-version: 3.11 cache: "pip" @@ -32,12 +32,12 @@ jobs: runs-on: ubuntu-latest steps: - name: Check out pipeline code - uses: actions/checkout@v4 + uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4 - name: Install Nextflow - uses: nf-core/setup-nextflow@v1 + uses: nf-core/setup-nextflow@b9f764e8ba5c76b712ace14ecbfcef0e40ae2dd8 # v1 - - uses: actions/setup-python@v5 + - uses: actions/setup-python@0a5c61591373683505ea898e09a3ea4f39ef2b9c # v5 with: python-version: "3.11" architecture: "x64" @@ -60,7 +60,7 @@ jobs: - name: Upload linting log file artifact if: ${{ always() }} - uses: actions/upload-artifact@v4 + uses: actions/upload-artifact@5d5d22a31266ced268874388b861e4b58bb5c2f3 # v4 with: name: linting-logs path: | diff --git a/.github/workflows/linting_comment.yml b/.github/workflows/linting_comment.yml index 147bcd1..b706875 100644 --- a/.github/workflows/linting_comment.yml +++ b/.github/workflows/linting_comment.yml @@ -11,7 +11,7 @@ jobs: runs-on: ubuntu-latest steps: - name: Download lint results - uses: dawidd6/action-download-artifact@v3 + uses: dawidd6/action-download-artifact@f6b0bace624032e30a85a8fd9c1a7f8f611f5737 # v3 with: workflow: linting.yml workflow_conclusion: completed @@ -21,7 +21,7 @@ jobs: run: echo "pr_number=$(cat linting-logs/PR_number.txt)" >> $GITHUB_OUTPUT - name: Post PR comment - uses: marocchino/sticky-pull-request-comment@v2 + uses: marocchino/sticky-pull-request-comment@331f8f5b4215f0445d3c07b4967662a32a2d3e31 # v2 with: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} number: ${{ steps.pr_number.outputs.pr_number }} diff --git a/.github/workflows/release-announcements.yml b/.github/workflows/release-announcements.yml index 21ac3f0..c3674af 100644 --- a/.github/workflows/release-announcements.yml +++ b/.github/workflows/release-announcements.yml @@ -9,6 +9,11 @@ jobs: toot: runs-on: ubuntu-latest steps: + - name: get topics and convert to hashtags + id: get_topics + run: | + curl -s https://nf-co.re/pipelines.json | jq -r '.remote_workflows[] | select(.name == "${{ github.repository }}") | .topics[]' | awk '{print "#"$0}' | tr '\n' ' ' > $GITHUB_OUTPUT + - uses: rzr/fediverse-action@master with: access-token: ${{ secrets.MASTODON_ACCESS_TOKEN }} @@ -20,11 +25,13 @@ jobs: Please see the changelog: ${{ github.event.release.html_url }} + ${{ steps.get_topics.outputs.GITHUB_OUTPUT }} #nfcore #openscience #nextflow #bioinformatics + send-tweet: runs-on: ubuntu-latest steps: - - uses: actions/setup-python@v5 + - uses: actions/setup-python@0a5c61591373683505ea898e09a3ea4f39ef2b9c # v5 with: python-version: "3.10" - name: Install dependencies @@ -56,7 +63,7 @@ jobs: bsky-post: runs-on: ubuntu-latest steps: - - uses: zentered/bluesky-post-action@v0.1.0 + - uses: zentered/bluesky-post-action@80dbe0a7697de18c15ad22f4619919ceb5ccf597 # v0.1.0 with: post: | Pipeline release! ${{ github.repository }} v${{ github.event.release.tag_name }} - ${{ github.event.release.name }}! diff --git a/README.md b/README.md index 5568c0f..c2ae3f2 100644 --- a/README.md +++ b/README.md @@ -4,8 +4,9 @@ nf-core/spatialtranscriptomics -[![GitHub Actions CI Status](https://github.com/nf-core/spatialtranscriptomics/workflows/nf-core%20CI/badge.svg)](https://github.com/nf-core/spatialtranscriptomics/actions?query=workflow%3A%22nf-core+CI%22) -[![GitHub Actions Linting Status](https://github.com/nf-core/spatialtranscriptomics/workflows/nf-core%20linting/badge.svg)](https://github.com/nf-core/spatialtranscriptomics/actions?query=workflow%3A%22nf-core+linting%22)[![AWS CI](https://img.shields.io/badge/CI%20tests-full%20size-FF9900?labelColor=000000&logo=Amazon%20AWS)](https://nf-co.re/spatialtranscriptomics/results)[![Cite with Zenodo](http://img.shields.io/badge/DOI-10.5281/zenodo.XXXXXXX-1073c8?labelColor=000000)](https://doi.org/10.5281/zenodo.XXXXXXX) + +[![GitHub Actions CI Status](https://github.com/nf-core/spatialtranscriptomics/actions/workflows/ci.yml/badge.svg)](https://github.com/nf-core/spatialtranscriptomics/actions/workflows/ci.yml) +[![GitHub Actions Linting Status](https://github.com/nf-core/spatialtranscriptomics/actions/workflows/linting.yml/badge.svg)](https://github.com/nf-core/spatialtranscriptomics/actions/workflows/linting.yml)[![AWS CI](https://img.shields.io/badge/CI%20tests-full%20size-FF9900?labelColor=000000&logo=Amazon%20AWS)](https://nf-co.re/spatialtranscriptomics/results)[![Cite with Zenodo](http://img.shields.io/badge/DOI-10.5281/zenodo.XXXXXXX-1073c8?labelColor=000000)](https://doi.org/10.5281/zenodo.XXXXXXX) [![Nextflow](https://img.shields.io/badge/nextflow%20DSL2-%E2%89%A523.04.0-23aa62.svg)](https://www.nextflow.io/) [![run with conda](http://img.shields.io/badge/run%20with-conda-3EB049?labelColor=000000&logo=anaconda)](https://docs.conda.io/en/latest/) diff --git a/assets/multiqc_config.yml b/assets/multiqc_config.yml index c73cf3b..2ea9059 100644 --- a/assets/multiqc_config.yml +++ b/assets/multiqc_config.yml @@ -11,3 +11,5 @@ report_section_order: order: -1002 export_plots: true + +disable_version_detection: true diff --git a/assets/schema_input.json b/assets/schema_input.json index 4bf3d96..44fe416 100644 --- a/assets/schema_input.json +++ b/assets/schema_input.json @@ -10,25 +10,22 @@ "sample": { "type": "string", "pattern": "^\\S+$", - "errorMessage": "Sample name must be provided and cannot contain spaces" + "errorMessage": "Sample name must be provided and cannot contain spaces", + "meta": ["id"] }, "fastq_1": { "type": "string", + "format": "file-path", + "exists": true, "pattern": "^\\S+\\.f(ast)?q\\.gz$", "errorMessage": "FastQ file for reads 1 must be provided, cannot contain spaces and must have extension '.fq.gz' or '.fastq.gz'" }, "fastq_2": { - "errorMessage": "FastQ file for reads 2 cannot contain spaces and must have extension '.fq.gz' or '.fastq.gz'", - "anyOf": [ - { - "type": "string", - "pattern": "^\\S+\\.f(ast)?q\\.gz$" - }, - { - "type": "string", - "maxLength": 0 - } - ] + "type": "string", + "format": "file-path", + "exists": true, + "pattern": "^\\S+\\.f(ast)?q\\.gz$", + "errorMessage": "FastQ file for reads 2 cannot contain spaces and must have extension '.fq.gz' or '.fastq.gz'" } }, "required": ["sample", "fastq_1"] diff --git a/bin/check_samplesheet.py b/bin/check_samplesheet.py deleted file mode 100755 index 4a758fe..0000000 --- a/bin/check_samplesheet.py +++ /dev/null @@ -1,259 +0,0 @@ -#!/usr/bin/env python - - -"""Provide a command line tool to validate and transform tabular samplesheets.""" - - -import argparse -import csv -import logging -import sys -from collections import Counter -from pathlib import Path - -logger = logging.getLogger() - - -class RowChecker: - """ - Define a service that can validate and transform each given row. - - Attributes: - modified (list): A list of dicts, where each dict corresponds to a previously - validated and transformed row. The order of rows is maintained. - - """ - - VALID_FORMATS = ( - ".fq.gz", - ".fastq.gz", - ) - - def __init__( - self, - sample_col="sample", - first_col="fastq_1", - second_col="fastq_2", - single_col="single_end", - **kwargs, - ): - """ - Initialize the row checker with the expected column names. - - Args: - sample_col (str): The name of the column that contains the sample name - (default "sample"). - first_col (str): The name of the column that contains the first (or only) - FASTQ file path (default "fastq_1"). - second_col (str): The name of the column that contains the second (if any) - FASTQ file path (default "fastq_2"). - single_col (str): The name of the new column that will be inserted and - records whether the sample contains single- or paired-end sequencing - reads (default "single_end"). - - """ - super().__init__(**kwargs) - self._sample_col = sample_col - self._first_col = first_col - self._second_col = second_col - self._single_col = single_col - self._seen = set() - self.modified = [] - - def validate_and_transform(self, row): - """ - Perform all validations on the given row and insert the read pairing status. - - Args: - row (dict): A mapping from column headers (keys) to elements of that row - (values). - - """ - self._validate_sample(row) - self._validate_first(row) - self._validate_second(row) - self._validate_pair(row) - self._seen.add((row[self._sample_col], row[self._first_col])) - self.modified.append(row) - - def _validate_sample(self, row): - """Assert that the sample name exists and convert spaces to underscores.""" - if len(row[self._sample_col]) <= 0: - raise AssertionError("Sample input is required.") - # Sanitize samples slightly. - row[self._sample_col] = row[self._sample_col].replace(" ", "_") - - def _validate_first(self, row): - """Assert that the first FASTQ entry is non-empty and has the right format.""" - if len(row[self._first_col]) <= 0: - raise AssertionError("At least the first FASTQ file is required.") - self._validate_fastq_format(row[self._first_col]) - - def _validate_second(self, row): - """Assert that the second FASTQ entry has the right format if it exists.""" - if len(row[self._second_col]) > 0: - self._validate_fastq_format(row[self._second_col]) - - def _validate_pair(self, row): - """Assert that read pairs have the same file extension. Report pair status.""" - if row[self._first_col] and row[self._second_col]: - row[self._single_col] = False - first_col_suffix = Path(row[self._first_col]).suffixes[-2:] - second_col_suffix = Path(row[self._second_col]).suffixes[-2:] - if first_col_suffix != second_col_suffix: - raise AssertionError("FASTQ pairs must have the same file extensions.") - else: - row[self._single_col] = True - - def _validate_fastq_format(self, filename): - """Assert that a given filename has one of the expected FASTQ extensions.""" - if not any(filename.endswith(extension) for extension in self.VALID_FORMATS): - raise AssertionError( - f"The FASTQ file has an unrecognized extension: {filename}\n" - f"It should be one of: {', '.join(self.VALID_FORMATS)}" - ) - - def validate_unique_samples(self): - """ - Assert that the combination of sample name and FASTQ filename is unique. - - In addition to the validation, also rename all samples to have a suffix of _T{n}, where n is the - number of times the same sample exist, but with different FASTQ files, e.g., multiple runs per experiment. - - """ - if len(self._seen) != len(self.modified): - raise AssertionError("The pair of sample name and FASTQ must be unique.") - seen = Counter() - for row in self.modified: - sample = row[self._sample_col] - seen[sample] += 1 - row[self._sample_col] = f"{sample}_T{seen[sample]}" - - -def read_head(handle, num_lines=10): - """Read the specified number of lines from the current position in the file.""" - lines = [] - for idx, line in enumerate(handle): - if idx == num_lines: - break - lines.append(line) - return "".join(lines) - - -def sniff_format(handle): - """ - Detect the tabular format. - - Args: - handle (text file): A handle to a `text file`_ object. The read position is - expected to be at the beginning (index 0). - - Returns: - csv.Dialect: The detected tabular format. - - .. _text file: - https://docs.python.org/3/glossary.html#term-text-file - - """ - peek = read_head(handle) - handle.seek(0) - sniffer = csv.Sniffer() - dialect = sniffer.sniff(peek) - return dialect - - -def check_samplesheet(file_in, file_out): - """ - Check that the tabular samplesheet has the structure expected by nf-core pipelines. - - Validate the general shape of the table, expected columns, and each row. Also add - an additional column which records whether one or two FASTQ reads were found. - - Args: - file_in (pathlib.Path): The given tabular samplesheet. The format can be either - CSV, TSV, or any other format automatically recognized by ``csv.Sniffer``. - file_out (pathlib.Path): Where the validated and transformed samplesheet should - be created; always in CSV format. - - Example: - This function checks that the samplesheet follows the following structure, - see also the `viral recon samplesheet`_:: - - sample,fastq_1,fastq_2 - SAMPLE_PE,SAMPLE_PE_RUN1_1.fastq.gz,SAMPLE_PE_RUN1_2.fastq.gz - SAMPLE_PE,SAMPLE_PE_RUN2_1.fastq.gz,SAMPLE_PE_RUN2_2.fastq.gz - SAMPLE_SE,SAMPLE_SE_RUN1_1.fastq.gz, - - .. _viral recon samplesheet: - https://raw.githubusercontent.com/nf-core/test-datasets/viralrecon/samplesheet/samplesheet_test_illumina_amplicon.csv - - """ - required_columns = {"sample", "fastq_1", "fastq_2"} - # See https://docs.python.org/3.9/library/csv.html#id3 to read up on `newline=""`. - with file_in.open(newline="") as in_handle: - reader = csv.DictReader(in_handle, dialect=sniff_format(in_handle)) - # Validate the existence of the expected header columns. - if not required_columns.issubset(reader.fieldnames): - req_cols = ", ".join(required_columns) - logger.critical(f"The sample sheet **must** contain these column headers: {req_cols}.") - sys.exit(1) - # Validate each row. - checker = RowChecker() - for i, row in enumerate(reader): - try: - checker.validate_and_transform(row) - except AssertionError as error: - logger.critical(f"{str(error)} On line {i + 2}.") - sys.exit(1) - checker.validate_unique_samples() - header = list(reader.fieldnames) - header.insert(1, "single_end") - # See https://docs.python.org/3.9/library/csv.html#id3 to read up on `newline=""`. - with file_out.open(mode="w", newline="") as out_handle: - writer = csv.DictWriter(out_handle, header, delimiter=",") - writer.writeheader() - for row in checker.modified: - writer.writerow(row) - - -def parse_args(argv=None): - """Define and immediately parse command line arguments.""" - parser = argparse.ArgumentParser( - description="Validate and transform a tabular samplesheet.", - epilog="Example: python check_samplesheet.py samplesheet.csv samplesheet.valid.csv", - ) - parser.add_argument( - "file_in", - metavar="FILE_IN", - type=Path, - help="Tabular input samplesheet in CSV or TSV format.", - ) - parser.add_argument( - "file_out", - metavar="FILE_OUT", - type=Path, - help="Transformed output samplesheet in CSV format.", - ) - parser.add_argument( - "-l", - "--log-level", - help="The desired log level (default WARNING).", - choices=("CRITICAL", "ERROR", "WARNING", "INFO", "DEBUG"), - default="WARNING", - ) - return parser.parse_args(argv) - - -def main(argv=None): - """Coordinate argument parsing and program execution.""" - args = parse_args(argv) - logging.basicConfig(level=args.log_level, format="[%(levelname)s] %(message)s") - if not args.file_in.is_file(): - logger.error(f"The given input file {args.file_in} was not found!") - sys.exit(2) - args.file_out.parent.mkdir(parents=True, exist_ok=True) - check_samplesheet(args.file_in, args.file_out) - - -if __name__ == "__main__": - sys.exit(main()) diff --git a/conf/modules.config b/conf/modules.config index d91c6ab..e3ea8fa 100644 --- a/conf/modules.config +++ b/conf/modules.config @@ -18,14 +18,6 @@ process { saveAs: { filename -> filename.equals('versions.yml') ? null : filename } ] - withName: SAMPLESHEET_CHECK { - publishDir = [ - path: { "${params.outdir}/pipeline_info" }, - mode: params.publish_dir_mode, - saveAs: { filename -> filename.equals('versions.yml') ? null : filename } - ] - } - withName: FASTQC { ext.args = '--quiet' } diff --git a/lib/NfcoreTemplate.groovy b/lib/NfcoreTemplate.groovy deleted file mode 100755 index e248e4c..0000000 --- a/lib/NfcoreTemplate.groovy +++ /dev/null @@ -1,356 +0,0 @@ -// -// This file holds several functions used within the nf-core pipeline template. -// - -import org.yaml.snakeyaml.Yaml -import groovy.json.JsonOutput -import nextflow.extension.FilesEx - -class NfcoreTemplate { - - // - // Check AWS Batch related parameters have been specified correctly - // - public static void awsBatch(workflow, params) { - if (workflow.profile.contains('awsbatch')) { - // Check params.awsqueue and params.awsregion have been set if running on AWSBatch - assert (params.awsqueue && params.awsregion) : "Specify correct --awsqueue and --awsregion parameters on AWSBatch!" - // Check outdir paths to be S3 buckets if running on AWSBatch - assert params.outdir.startsWith('s3:') : "Outdir not on S3 - specify S3 Bucket to run on AWSBatch!" - } - } - - // - // Warn if a -profile or Nextflow config has not been provided to run the pipeline - // - public static void checkConfigProvided(workflow, log) { - if (workflow.profile == 'standard' && workflow.configFiles.size() <= 1) { - log.warn "[$workflow.manifest.name] You are attempting to run the pipeline without any custom configuration!\n\n" + - "This will be dependent on your local compute environment but can be achieved via one or more of the following:\n" + - " (1) Using an existing pipeline profile e.g. `-profile docker` or `-profile singularity`\n" + - " (2) Using an existing nf-core/configs for your Institution e.g. `-profile crick` or `-profile uppmax`\n" + - " (3) Using your own local custom config e.g. `-c /path/to/your/custom.config`\n\n" + - "Please refer to the quick start section and usage docs for the pipeline.\n " - } - } - - // - // Generate version string - // - public static String version(workflow) { - String version_string = "" - - if (workflow.manifest.version) { - def prefix_v = workflow.manifest.version[0] != 'v' ? 'v' : '' - version_string += "${prefix_v}${workflow.manifest.version}" - } - - if (workflow.commitId) { - def git_shortsha = workflow.commitId.substring(0, 7) - version_string += "-g${git_shortsha}" - } - - return version_string - } - - // - // Construct and send completion email - // - public static void email(workflow, params, summary_params, projectDir, log, multiqc_report=[]) { - - // Set up the e-mail variables - def subject = "[$workflow.manifest.name] Successful: $workflow.runName" - if (!workflow.success) { - subject = "[$workflow.manifest.name] FAILED: $workflow.runName" - } - - def summary = [:] - for (group in summary_params.keySet()) { - summary << summary_params[group] - } - - def misc_fields = [:] - misc_fields['Date Started'] = workflow.start - misc_fields['Date Completed'] = workflow.complete - misc_fields['Pipeline script file path'] = workflow.scriptFile - misc_fields['Pipeline script hash ID'] = workflow.scriptId - if (workflow.repository) misc_fields['Pipeline repository Git URL'] = workflow.repository - if (workflow.commitId) misc_fields['Pipeline repository Git Commit'] = workflow.commitId - if (workflow.revision) misc_fields['Pipeline Git branch/tag'] = workflow.revision - misc_fields['Nextflow Version'] = workflow.nextflow.version - misc_fields['Nextflow Build'] = workflow.nextflow.build - misc_fields['Nextflow Compile Timestamp'] = workflow.nextflow.timestamp - - def email_fields = [:] - email_fields['version'] = NfcoreTemplate.version(workflow) - email_fields['runName'] = workflow.runName - email_fields['success'] = workflow.success - email_fields['dateComplete'] = workflow.complete - email_fields['duration'] = workflow.duration - email_fields['exitStatus'] = workflow.exitStatus - email_fields['errorMessage'] = (workflow.errorMessage ?: 'None') - email_fields['errorReport'] = (workflow.errorReport ?: 'None') - email_fields['commandLine'] = workflow.commandLine - email_fields['projectDir'] = workflow.projectDir - email_fields['summary'] = summary << misc_fields - - // On success try attach the multiqc report - def mqc_report = null - try { - if (workflow.success) { - mqc_report = multiqc_report.getVal() - if (mqc_report.getClass() == ArrayList && mqc_report.size() >= 1) { - if (mqc_report.size() > 1) { - log.warn "[$workflow.manifest.name] Found multiple reports from process 'MULTIQC', will use only one" - } - mqc_report = mqc_report[0] - } - } - } catch (all) { - if (multiqc_report) { - log.warn "[$workflow.manifest.name] Could not attach MultiQC report to summary email" - } - } - - // Check if we are only sending emails on failure - def email_address = params.email - if (!params.email && params.email_on_fail && !workflow.success) { - email_address = params.email_on_fail - } - - // Render the TXT template - def engine = new groovy.text.GStringTemplateEngine() - def tf = new File("$projectDir/assets/email_template.txt") - def txt_template = engine.createTemplate(tf).make(email_fields) - def email_txt = txt_template.toString() - - // Render the HTML template - def hf = new File("$projectDir/assets/email_template.html") - def html_template = engine.createTemplate(hf).make(email_fields) - def email_html = html_template.toString() - - // Render the sendmail template - def max_multiqc_email_size = (params.containsKey('max_multiqc_email_size') ? params.max_multiqc_email_size : 0) as nextflow.util.MemoryUnit - def smail_fields = [ email: email_address, subject: subject, email_txt: email_txt, email_html: email_html, projectDir: "$projectDir", mqcFile: mqc_report, mqcMaxSize: max_multiqc_email_size.toBytes() ] - def sf = new File("$projectDir/assets/sendmail_template.txt") - def sendmail_template = engine.createTemplate(sf).make(smail_fields) - def sendmail_html = sendmail_template.toString() - - // Send the HTML e-mail - Map colors = logColours(params.monochrome_logs) - if (email_address) { - try { - if (params.plaintext_email) { throw GroovyException('Send plaintext e-mail, not HTML') } - // Try to send HTML e-mail using sendmail - def sendmail_tf = new File(workflow.launchDir.toString(), ".sendmail_tmp.html") - sendmail_tf.withWriter { w -> w << sendmail_html } - [ 'sendmail', '-t' ].execute() << sendmail_html - log.info "-${colors.purple}[$workflow.manifest.name]${colors.green} Sent summary e-mail to $email_address (sendmail)-" - } catch (all) { - // Catch failures and try with plaintext - def mail_cmd = [ 'mail', '-s', subject, '--content-type=text/html', email_address ] - if ( mqc_report != null && mqc_report.size() <= max_multiqc_email_size.toBytes() ) { - mail_cmd += [ '-A', mqc_report ] - } - mail_cmd.execute() << email_html - log.info "-${colors.purple}[$workflow.manifest.name]${colors.green} Sent summary e-mail to $email_address (mail)-" - } - } - - // Write summary e-mail HTML to a file - def output_hf = new File(workflow.launchDir.toString(), ".pipeline_report.html") - output_hf.withWriter { w -> w << email_html } - FilesEx.copyTo(output_hf.toPath(), "${params.outdir}/pipeline_info/pipeline_report.html"); - output_hf.delete() - - // Write summary e-mail TXT to a file - def output_tf = new File(workflow.launchDir.toString(), ".pipeline_report.txt") - output_tf.withWriter { w -> w << email_txt } - FilesEx.copyTo(output_tf.toPath(), "${params.outdir}/pipeline_info/pipeline_report.txt"); - output_tf.delete() - } - - // - // Construct and send a notification to a web server as JSON - // e.g. Microsoft Teams and Slack - // - public static void IM_notification(workflow, params, summary_params, projectDir, log) { - def hook_url = params.hook_url - - def summary = [:] - for (group in summary_params.keySet()) { - summary << summary_params[group] - } - - def misc_fields = [:] - misc_fields['start'] = workflow.start - misc_fields['complete'] = workflow.complete - misc_fields['scriptfile'] = workflow.scriptFile - misc_fields['scriptid'] = workflow.scriptId - if (workflow.repository) misc_fields['repository'] = workflow.repository - if (workflow.commitId) misc_fields['commitid'] = workflow.commitId - if (workflow.revision) misc_fields['revision'] = workflow.revision - misc_fields['nxf_version'] = workflow.nextflow.version - misc_fields['nxf_build'] = workflow.nextflow.build - misc_fields['nxf_timestamp'] = workflow.nextflow.timestamp - - def msg_fields = [:] - msg_fields['version'] = NfcoreTemplate.version(workflow) - msg_fields['runName'] = workflow.runName - msg_fields['success'] = workflow.success - msg_fields['dateComplete'] = workflow.complete - msg_fields['duration'] = workflow.duration - msg_fields['exitStatus'] = workflow.exitStatus - msg_fields['errorMessage'] = (workflow.errorMessage ?: 'None') - msg_fields['errorReport'] = (workflow.errorReport ?: 'None') - msg_fields['commandLine'] = workflow.commandLine.replaceFirst(/ +--hook_url +[^ ]+/, "") - msg_fields['projectDir'] = workflow.projectDir - msg_fields['summary'] = summary << misc_fields - - // Render the JSON template - def engine = new groovy.text.GStringTemplateEngine() - // Different JSON depending on the service provider - // Defaults to "Adaptive Cards" (https://adaptivecards.io), except Slack which has its own format - def json_path = hook_url.contains("hooks.slack.com") ? "slackreport.json" : "adaptivecard.json" - def hf = new File("$projectDir/assets/${json_path}") - def json_template = engine.createTemplate(hf).make(msg_fields) - def json_message = json_template.toString() - - // POST - def post = new URL(hook_url).openConnection(); - post.setRequestMethod("POST") - post.setDoOutput(true) - post.setRequestProperty("Content-Type", "application/json") - post.getOutputStream().write(json_message.getBytes("UTF-8")); - def postRC = post.getResponseCode(); - if (! postRC.equals(200)) { - log.warn(post.getErrorStream().getText()); - } - } - - // - // Dump pipeline parameters in a json file - // - public static void dump_parameters(workflow, params) { - def timestamp = new java.util.Date().format( 'yyyy-MM-dd_HH-mm-ss') - def filename = "params_${timestamp}.json" - def temp_pf = new File(workflow.launchDir.toString(), ".${filename}") - def jsonStr = JsonOutput.toJson(params) - temp_pf.text = JsonOutput.prettyPrint(jsonStr) - - FilesEx.copyTo(temp_pf.toPath(), "${params.outdir}/pipeline_info/params_${timestamp}.json") - temp_pf.delete() - } - - // - // Print pipeline summary on completion - // - public static void summary(workflow, params, log) { - Map colors = logColours(params.monochrome_logs) - if (workflow.success) { - if (workflow.stats.ignoredCount == 0) { - log.info "-${colors.purple}[$workflow.manifest.name]${colors.green} Pipeline completed successfully${colors.reset}-" - } else { - log.info "-${colors.purple}[$workflow.manifest.name]${colors.yellow} Pipeline completed successfully, but with errored process(es) ${colors.reset}-" - } - } else { - log.info "-${colors.purple}[$workflow.manifest.name]${colors.red} Pipeline completed with errors${colors.reset}-" - } - } - - // - // ANSII Colours used for terminal logging - // - public static Map logColours(Boolean monochrome_logs) { - Map colorcodes = [:] - - // Reset / Meta - colorcodes['reset'] = monochrome_logs ? '' : "\033[0m" - colorcodes['bold'] = monochrome_logs ? '' : "\033[1m" - colorcodes['dim'] = monochrome_logs ? '' : "\033[2m" - colorcodes['underlined'] = monochrome_logs ? '' : "\033[4m" - colorcodes['blink'] = monochrome_logs ? '' : "\033[5m" - colorcodes['reverse'] = monochrome_logs ? '' : "\033[7m" - colorcodes['hidden'] = monochrome_logs ? '' : "\033[8m" - - // Regular Colors - colorcodes['black'] = monochrome_logs ? '' : "\033[0;30m" - colorcodes['red'] = monochrome_logs ? '' : "\033[0;31m" - colorcodes['green'] = monochrome_logs ? '' : "\033[0;32m" - colorcodes['yellow'] = monochrome_logs ? '' : "\033[0;33m" - colorcodes['blue'] = monochrome_logs ? '' : "\033[0;34m" - colorcodes['purple'] = monochrome_logs ? '' : "\033[0;35m" - colorcodes['cyan'] = monochrome_logs ? '' : "\033[0;36m" - colorcodes['white'] = monochrome_logs ? '' : "\033[0;37m" - - // Bold - colorcodes['bblack'] = monochrome_logs ? '' : "\033[1;30m" - colorcodes['bred'] = monochrome_logs ? '' : "\033[1;31m" - colorcodes['bgreen'] = monochrome_logs ? '' : "\033[1;32m" - colorcodes['byellow'] = monochrome_logs ? '' : "\033[1;33m" - colorcodes['bblue'] = monochrome_logs ? '' : "\033[1;34m" - colorcodes['bpurple'] = monochrome_logs ? '' : "\033[1;35m" - colorcodes['bcyan'] = monochrome_logs ? '' : "\033[1;36m" - colorcodes['bwhite'] = monochrome_logs ? '' : "\033[1;37m" - - // Underline - colorcodes['ublack'] = monochrome_logs ? '' : "\033[4;30m" - colorcodes['ured'] = monochrome_logs ? '' : "\033[4;31m" - colorcodes['ugreen'] = monochrome_logs ? '' : "\033[4;32m" - colorcodes['uyellow'] = monochrome_logs ? '' : "\033[4;33m" - colorcodes['ublue'] = monochrome_logs ? '' : "\033[4;34m" - colorcodes['upurple'] = monochrome_logs ? '' : "\033[4;35m" - colorcodes['ucyan'] = monochrome_logs ? '' : "\033[4;36m" - colorcodes['uwhite'] = monochrome_logs ? '' : "\033[4;37m" - - // High Intensity - colorcodes['iblack'] = monochrome_logs ? '' : "\033[0;90m" - colorcodes['ired'] = monochrome_logs ? '' : "\033[0;91m" - colorcodes['igreen'] = monochrome_logs ? '' : "\033[0;92m" - colorcodes['iyellow'] = monochrome_logs ? '' : "\033[0;93m" - colorcodes['iblue'] = monochrome_logs ? '' : "\033[0;94m" - colorcodes['ipurple'] = monochrome_logs ? '' : "\033[0;95m" - colorcodes['icyan'] = monochrome_logs ? '' : "\033[0;96m" - colorcodes['iwhite'] = monochrome_logs ? '' : "\033[0;97m" - - // Bold High Intensity - colorcodes['biblack'] = monochrome_logs ? '' : "\033[1;90m" - colorcodes['bired'] = monochrome_logs ? '' : "\033[1;91m" - colorcodes['bigreen'] = monochrome_logs ? '' : "\033[1;92m" - colorcodes['biyellow'] = monochrome_logs ? '' : "\033[1;93m" - colorcodes['biblue'] = monochrome_logs ? '' : "\033[1;94m" - colorcodes['bipurple'] = monochrome_logs ? '' : "\033[1;95m" - colorcodes['bicyan'] = monochrome_logs ? '' : "\033[1;96m" - colorcodes['biwhite'] = monochrome_logs ? '' : "\033[1;97m" - - return colorcodes - } - - // - // Does what is says on the tin - // - public static String dashedLine(monochrome_logs) { - Map colors = logColours(monochrome_logs) - return "-${colors.dim}----------------------------------------------------${colors.reset}-" - } - - // - // nf-core logo - // - public static String logo(workflow, monochrome_logs) { - Map colors = logColours(monochrome_logs) - String workflow_version = NfcoreTemplate.version(workflow) - String.format( - """\n - ${dashedLine(monochrome_logs)} - ${colors.green},--.${colors.black}/${colors.green},-.${colors.reset} - ${colors.blue} ___ __ __ __ ___ ${colors.green}/,-._.--~\'${colors.reset} - ${colors.blue} |\\ | |__ __ / ` / \\ |__) |__ ${colors.yellow}} {${colors.reset} - ${colors.blue} | \\| | \\__, \\__/ | \\ |___ ${colors.green}\\`-._,-`-,${colors.reset} - ${colors.green}`._,._,\'${colors.reset} - ${colors.purple} ${workflow.manifest.name} ${workflow_version}${colors.reset} - ${dashedLine(monochrome_logs)} - """.stripIndent() - ) - } -} diff --git a/lib/Utils.groovy b/lib/Utils.groovy deleted file mode 100644 index 8d030f4..0000000 --- a/lib/Utils.groovy +++ /dev/null @@ -1,47 +0,0 @@ -// -// This file holds several Groovy functions that could be useful for any Nextflow pipeline -// - -import org.yaml.snakeyaml.Yaml - -class Utils { - - // - // When running with -profile conda, warn if channels have not been set-up appropriately - // - public static void checkCondaChannels(log) { - Yaml parser = new Yaml() - def channels = [] - try { - def config = parser.load("conda config --show channels".execute().text) - channels = config.channels - } catch(NullPointerException | IOException e) { - log.warn "Could not verify conda channel configuration." - return - } - - // Check that all channels are present - // This channel list is ordered by required channel priority. - def required_channels_in_order = ['conda-forge', 'bioconda', 'defaults'] - def channels_missing = ((required_channels_in_order as Set) - (channels as Set)) as Boolean - - // Check that they are in the right order - def channel_priority_violation = false - def n = required_channels_in_order.size() - for (int i = 0; i < n - 1; i++) { - channel_priority_violation |= !(channels.indexOf(required_channels_in_order[i]) < channels.indexOf(required_channels_in_order[i+1])) - } - - if (channels_missing | channel_priority_violation) { - log.warn "~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~\n" + - " There is a problem with your Conda configuration!\n\n" + - " You will need to set-up the conda-forge and bioconda channels correctly.\n" + - " Please refer to https://bioconda.github.io/\n" + - " The observed channel order is \n" + - " ${channels}\n" + - " but the following channel order is required:\n" + - " ${required_channels_in_order}\n" + - "~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~" - } - } -} diff --git a/lib/WorkflowMain.groovy b/lib/WorkflowMain.groovy deleted file mode 100755 index 5241dd2..0000000 --- a/lib/WorkflowMain.groovy +++ /dev/null @@ -1,77 +0,0 @@ -// -// This file holds several functions specific to the main.nf workflow in the nf-core/spatialtranscriptomics pipeline -// - -import nextflow.Nextflow - -class WorkflowMain { - - // - // Citation string for pipeline - // - public static String citation(workflow) { - return "If you use ${workflow.manifest.name} for your analysis please cite:\n\n" + - // TODO nf-core: Add Zenodo DOI for pipeline after first release - //"* The pipeline\n" + - //" https://doi.org/10.5281/zenodo.XXXXXXX\n\n" + - "* The nf-core framework\n" + - " https://doi.org/10.1038/s41587-020-0439-x\n\n" + - "* Software dependencies\n" + - " https://github.com/${workflow.manifest.name}/blob/master/CITATIONS.md" - } - - - // - // Validate parameters and print summary to screen - // - public static void initialise(workflow, params, log, args) { - - // Print workflow version and exit on --version - if (params.version) { - String workflow_version = NfcoreTemplate.version(workflow) - log.info "${workflow.manifest.name} ${workflow_version}" - System.exit(0) - } - - // Check that a -profile or Nextflow config has been provided to run the pipeline - NfcoreTemplate.checkConfigProvided(workflow, log) - // Check that the profile doesn't contain spaces and doesn't end with a trailing comma - checkProfile(workflow.profile, args, log) - - // Check that conda channels are set-up correctly - if (workflow.profile.tokenize(',').intersect(['conda', 'mamba']).size() >= 1) { - Utils.checkCondaChannels(log) - } - - // Check AWS batch settings - NfcoreTemplate.awsBatch(workflow, params) - - // Check input has been provided - if (!params.input) { - Nextflow.error("Please provide an input samplesheet to the pipeline e.g. '--input samplesheet.csv'") - } - } - // - // Get attribute from genome config file e.g. fasta - // - public static Object getGenomeAttribute(params, attribute) { - if (params.genomes && params.genome && params.genomes.containsKey(params.genome)) { - if (params.genomes[ params.genome ].containsKey(attribute)) { - return params.genomes[ params.genome ][ attribute ] - } - } - return null - } - - // - // Exit pipeline if --profile contains spaces - // - private static void checkProfile(profile, args, log) { - if (profile.endsWith(',')) { - Nextflow.error "Profile cannot end with a trailing comma. Please remove the comma from the end of the profile string.\nHint: A common mistake is to provide multiple values to `-profile` separated by spaces. Please use commas to separate profiles instead,e.g., `-profile docker,test`." - } - if (args[0]) { - log.warn "nf-core pipelines do not accept positional arguments. The positional argument `${args[0]}` has been detected.\n Hint: A common mistake is to provide multiple values to `-profile` separated by spaces. Please use commas to separate profiles instead,e.g., `-profile docker,test`." - } - } -} diff --git a/lib/WorkflowSpatialtranscriptomics.groovy b/lib/WorkflowSpatialtranscriptomics.groovy deleted file mode 100755 index 56bde8d..0000000 --- a/lib/WorkflowSpatialtranscriptomics.groovy +++ /dev/null @@ -1,122 +0,0 @@ -// -// This file holds several functions specific to the workflow/spatialtranscriptomics.nf in the nf-core/spatialtranscriptomics pipeline -// - -import nextflow.Nextflow -import groovy.text.SimpleTemplateEngine - -class WorkflowSpatialtranscriptomics { - - // - // Check and validate parameters - // - public static void initialise(params, log) { - - genomeExistsError(params, log) - - - if (!params.fasta) { - Nextflow.error "Genome fasta file not specified with e.g. '--fasta genome.fa' or via a detectable config file." - } - } - - // - // Get workflow summary for MultiQC - // - public static String paramsSummaryMultiqc(workflow, summary) { - String summary_section = '' - for (group in summary.keySet()) { - def group_params = summary.get(group) // This gets the parameters of that particular group - if (group_params) { - summary_section += "

$group

\n" - summary_section += "
\n" - for (param in group_params.keySet()) { - summary_section += "
$param
${group_params.get(param) ?: 'N/A'}
\n" - } - summary_section += "
\n" - } - } - - String yaml_file_text = "id: '${workflow.manifest.name.replace('/','-')}-summary'\n" - yaml_file_text += "description: ' - this information is collected when the pipeline is started.'\n" - yaml_file_text += "section_name: '${workflow.manifest.name} Workflow Summary'\n" - yaml_file_text += "section_href: 'https://github.com/${workflow.manifest.name}'\n" - yaml_file_text += "plot_type: 'html'\n" - yaml_file_text += "data: |\n" - yaml_file_text += "${summary_section}" - return yaml_file_text - } - - // - // Generate methods description for MultiQC - // - - public static String toolCitationText(params) { - - // TODO nf-core: Optionally add in-text citation tools to this list. - // Can use ternary operators to dynamically construct based conditions, e.g. params["run_xyz"] ? "Tool (Foo et al. 2023)" : "", - // Uncomment function in methodsDescriptionText to render in MultiQC report - def citation_text = [ - "Tools used in the workflow included:", - "FastQC (Andrews 2010),", - "MultiQC (Ewels et al. 2016)", - "." - ].join(' ').trim() - - return citation_text - } - - public static String toolBibliographyText(params) { - - // TODO Optionally add bibliographic entries to this list. - // Can use ternary operators to dynamically construct based conditions, e.g. params["run_xyz"] ? "
  • Author (2023) Pub name, Journal, DOI
  • " : "", - // Uncomment function in methodsDescriptionText to render in MultiQC report - def reference_text = [ - "
  • Andrews S, (2010) FastQC, URL: https://www.bioinformatics.babraham.ac.uk/projects/fastqc/).
  • ", - "
  • Ewels, P., Magnusson, M., Lundin, S., & Käller, M. (2016). MultiQC: summarize analysis results for multiple tools and samples in a single report. Bioinformatics , 32(19), 3047–3048. doi: /10.1093/bioinformatics/btw354
  • " - ].join(' ').trim() - - return reference_text - } - - public static String methodsDescriptionText(run_workflow, mqc_methods_yaml, params) { - // Convert to a named map so can be used as with familar NXF ${workflow} variable syntax in the MultiQC YML file - def meta = [:] - meta.workflow = run_workflow.toMap() - meta["manifest_map"] = run_workflow.manifest.toMap() - - // Pipeline DOI - meta["doi_text"] = meta.manifest_map.doi ? "(doi: ${meta.manifest_map.doi})" : "" - meta["nodoi_text"] = meta.manifest_map.doi ? "": "
  • If available, make sure to update the text to include the Zenodo DOI of version of the pipeline used.
  • " - - // Tool references - meta["tool_citations"] = "" - meta["tool_bibliography"] = "" - - // TODO Only uncomment below if logic in toolCitationText/toolBibliographyText has been filled! - //meta["tool_citations"] = toolCitationText(params).replaceAll(", \\.", ".").replaceAll("\\. \\.", ".").replaceAll(", \\.", ".") - //meta["tool_bibliography"] = toolBibliographyText(params) - - - def methods_text = mqc_methods_yaml.text - - def engine = new SimpleTemplateEngine() - def description_html = engine.createTemplate(methods_text).make(meta) - - return description_html - } - - // - // Exit pipeline if incorrect --genome key provided - // - private static void genomeExistsError(params, log) { - if (params.genomes && params.genome && !params.genomes.containsKey(params.genome)) { - def error_string = "~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~\n" + - " Genome '${params.genome}' not found in any config files provided to the pipeline.\n" + - " Currently, the available genome keys are:\n" + - " ${params.genomes.keySet().join(", ")}\n" + - "~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~" - Nextflow.error(error_string) - } - } -} diff --git a/main.nf b/main.nf index 6c9f01f..f1b8a13 100644 --- a/main.nf +++ b/main.nf @@ -13,66 +13,96 @@ nextflow.enable.dsl = 2 /* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - GENOME PARAMETER VALUES + IMPORT FUNCTIONS / MODULES / SUBWORKFLOWS / WORKFLOWS ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ */ -// TODO nf-core: Remove this line if you don't need a FASTA file -// This is an example of how to use getGenomeAttribute() to fetch parameters -// from igenomes.config using `--genome` -params.fasta = WorkflowMain.getGenomeAttribute(params, 'fasta') +include { SPATIALTRANSCRIPTOMICS } from './workflows/spatialtranscriptomics' +include { PIPELINE_INITIALISATION } from './subworkflows/local/utils_nfcore_spatialtranscriptomics_pipeline' +include { PIPELINE_COMPLETION } from './subworkflows/local/utils_nfcore_spatialtranscriptomics_pipeline' + +include { getGenomeAttribute } from './subworkflows/local/utils_nfcore_spatialtranscriptomics_pipeline' /* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - VALIDATE & PRINT PARAMETER SUMMARY + GENOME PARAMETER VALUES ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ */ -include { validateParameters; paramsHelp } from 'plugin/nf-validation' - -// Print help message if needed -if (params.help) { - def logo = NfcoreTemplate.logo(workflow, params.monochrome_logs) - def citation = '\n' + WorkflowMain.citation(workflow) + '\n' - def String command = "nextflow run ${workflow.manifest.name} --input samplesheet.csv --genome GRCh37 -profile docker" - log.info logo + paramsHelp(command) + citation + NfcoreTemplate.dashedLine(params.monochrome_logs) - System.exit(0) -} - -// Validate input parameters -if (params.validate_params) { - validateParameters() -} - -WorkflowMain.initialise(workflow, params, log, args) +// TODO nf-core: Remove this line if you don't need a FASTA file +// This is an example of how to use getGenomeAttribute() to fetch parameters +// from igenomes.config using `--genome` +params.fasta = getGenomeAttribute('fasta') /* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - NAMED WORKFLOW FOR PIPELINE + NAMED WORKFLOWS FOR PIPELINE ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ */ -include { SPATIALTRANSCRIPTOMICS } from './workflows/spatialtranscriptomics' - // -// WORKFLOW: Run main nf-core/spatialtranscriptomics analysis pipeline +// WORKFLOW: Run main analysis pipeline depending on type of input // workflow NFCORE_SPATIALTRANSCRIPTOMICS { - SPATIALTRANSCRIPTOMICS () -} + take: + samplesheet // channel: samplesheet read in from --input + + main: + + // + // WORKFLOW: Run pipeline + // + SPATIALTRANSCRIPTOMICS ( + samplesheet + ) + + emit: + multiqc_report = SPATIALTRANSCRIPTOMICS.out.multiqc_report // channel: /path/to/multiqc_report.html + +} /* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - RUN ALL WORKFLOWS + RUN MAIN WORKFLOW ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ */ -// -// WORKFLOW: Execute a single named workflow for the pipeline -// See: https://github.com/nf-core/rnaseq/issues/619 -// workflow { - NFCORE_SPATIALTRANSCRIPTOMICS () + + main: + + // + // SUBWORKFLOW: Run initialisation tasks + // + PIPELINE_INITIALISATION ( + params.version, + params.help, + params.validate_params, + params.monochrome_logs, + args, + params.outdir, + params.input + ) + + // + // WORKFLOW: Run main workflow + // + NFCORE_SPATIALTRANSCRIPTOMICS ( + PIPELINE_INITIALISATION.out.samplesheet + ) + + // + // SUBWORKFLOW: Run completion tasks + // + PIPELINE_COMPLETION ( + params.email, + params.email_on_fail, + params.plaintext_email, + params.outdir, + params.monochrome_logs, + params.hook_url, + NFCORE_SPATIALTRANSCRIPTOMICS.out.multiqc_report + ) } /* diff --git a/modules.json b/modules.json index 7b99fec..14a641c 100644 --- a/modules.json +++ b/modules.json @@ -5,22 +5,36 @@ "https://github.com/nf-core/modules.git": { "modules": { "nf-core": { - "custom/dumpsoftwareversions": { - "branch": "master", - "git_sha": "8ec825f465b9c17f9d83000022995b4f7de6fe93", - "installed_by": ["modules"] - }, "fastqc": { "branch": "master", - "git_sha": "c9488585ce7bd35ccd2a30faa2371454c8112fb9", + "git_sha": "f4ae1d942bd50c5c0b9bd2de1393ce38315ba57c", "installed_by": ["modules"] }, "multiqc": { "branch": "master", - "git_sha": "8ec825f465b9c17f9d83000022995b4f7de6fe93", + "git_sha": "ccacf6f5de6df3bc6d73b665c1fd2933d8bbc290", "installed_by": ["modules"] } } + }, + "subworkflows": { + "nf-core": { + "utils_nextflow_pipeline": { + "branch": "master", + "git_sha": "cd08c91373cd00a73255081340e4914485846ba1", + "installed_by": ["subworkflows"] + }, + "utils_nfcore_pipeline": { + "branch": "master", + "git_sha": "262b17ed2aad591039f914951659177e6c39a8d8", + "installed_by": ["subworkflows"] + }, + "utils_nfvalidation_plugin": { + "branch": "master", + "git_sha": "cd08c91373cd00a73255081340e4914485846ba1", + "installed_by": ["subworkflows"] + } + } } } } diff --git a/modules/local/samplesheet_check.nf b/modules/local/samplesheet_check.nf deleted file mode 100644 index 6d13f9e..0000000 --- a/modules/local/samplesheet_check.nf +++ /dev/null @@ -1,31 +0,0 @@ -process SAMPLESHEET_CHECK { - tag "$samplesheet" - label 'process_single' - - conda "conda-forge::python=3.8.3" - container "${ workflow.containerEngine == 'singularity' && !task.ext.singularity_pull_docker_container ? - 'https://depot.galaxyproject.org/singularity/python:3.8.3' : - 'biocontainers/python:3.8.3' }" - - input: - path samplesheet - - output: - path '*.csv' , emit: csv - path "versions.yml", emit: versions - - when: - task.ext.when == null || task.ext.when - - script: // This script is bundled with the pipeline, in nf-core/spatialtranscriptomics/bin/ - """ - check_samplesheet.py \\ - $samplesheet \\ - samplesheet.valid.csv - - cat <<-END_VERSIONS > versions.yml - "${task.process}": - python: \$(python --version | sed 's/Python //g') - END_VERSIONS - """ -} diff --git a/modules/nf-core/custom/dumpsoftwareversions/environment.yml b/modules/nf-core/custom/dumpsoftwareversions/environment.yml deleted file mode 100644 index 9b3272b..0000000 --- a/modules/nf-core/custom/dumpsoftwareversions/environment.yml +++ /dev/null @@ -1,7 +0,0 @@ -name: custom_dumpsoftwareversions -channels: - - conda-forge - - bioconda - - defaults -dependencies: - - bioconda::multiqc=1.19 diff --git a/modules/nf-core/custom/dumpsoftwareversions/main.nf b/modules/nf-core/custom/dumpsoftwareversions/main.nf deleted file mode 100644 index f218761..0000000 --- a/modules/nf-core/custom/dumpsoftwareversions/main.nf +++ /dev/null @@ -1,24 +0,0 @@ -process CUSTOM_DUMPSOFTWAREVERSIONS { - label 'process_single' - - // Requires `pyyaml` which does not have a dedicated container but is in the MultiQC container - conda "${moduleDir}/environment.yml" - container "${ workflow.containerEngine == 'singularity' && !task.ext.singularity_pull_docker_container ? - 'https://depot.galaxyproject.org/singularity/multiqc:1.19--pyhdfd78af_0' : - 'biocontainers/multiqc:1.19--pyhdfd78af_0' }" - - input: - path versions - - output: - path "software_versions.yml" , emit: yml - path "software_versions_mqc.yml", emit: mqc_yml - path "versions.yml" , emit: versions - - when: - task.ext.when == null || task.ext.when - - script: - def args = task.ext.args ?: '' - template 'dumpsoftwareversions.py' -} diff --git a/modules/nf-core/custom/dumpsoftwareversions/meta.yml b/modules/nf-core/custom/dumpsoftwareversions/meta.yml deleted file mode 100644 index 5f15a5f..0000000 --- a/modules/nf-core/custom/dumpsoftwareversions/meta.yml +++ /dev/null @@ -1,37 +0,0 @@ -# yaml-language-server: $schema=https://raw.githubusercontent.com/nf-core/modules/master/modules/meta-schema.json -name: custom_dumpsoftwareversions -description: Custom module used to dump software versions within the nf-core pipeline template -keywords: - - custom - - dump - - version -tools: - - custom: - description: Custom module used to dump software versions within the nf-core pipeline template - homepage: https://github.com/nf-core/tools - documentation: https://github.com/nf-core/tools - licence: ["MIT"] -input: - - versions: - type: file - description: YML file containing software versions - pattern: "*.yml" -output: - - yml: - type: file - description: Standard YML file containing software versions - pattern: "software_versions.yml" - - mqc_yml: - type: file - description: MultiQC custom content YML file containing software versions - pattern: "software_versions_mqc.yml" - - versions: - type: file - description: File containing software versions - pattern: "versions.yml" -authors: - - "@drpatelh" - - "@grst" -maintainers: - - "@drpatelh" - - "@grst" diff --git a/modules/nf-core/custom/dumpsoftwareversions/templates/dumpsoftwareversions.py b/modules/nf-core/custom/dumpsoftwareversions/templates/dumpsoftwareversions.py deleted file mode 100755 index e55b8d4..0000000 --- a/modules/nf-core/custom/dumpsoftwareversions/templates/dumpsoftwareversions.py +++ /dev/null @@ -1,102 +0,0 @@ -#!/usr/bin/env python - - -"""Provide functions to merge multiple versions.yml files.""" - - -import platform -from textwrap import dedent - -import yaml - - -def _make_versions_html(versions): - """Generate a tabular HTML output of all versions for MultiQC.""" - html = [ - dedent( - """\\ - - - - - - - - - - """ - ) - ] - for process, tmp_versions in sorted(versions.items()): - html.append("") - for i, (tool, version) in enumerate(sorted(tmp_versions.items())): - html.append( - dedent( - f"""\\ - - - - - - """ - ) - ) - html.append("") - html.append("
    Process Name Software Version
    {process if (i == 0) else ''}{tool}{version}
    ") - return "\\n".join(html) - - -def main(): - """Load all version files and generate merged output.""" - versions_this_module = {} - versions_this_module["${task.process}"] = { - "python": platform.python_version(), - "yaml": yaml.__version__, - } - - with open("$versions") as f: - versions_by_process = yaml.load(f, Loader=yaml.BaseLoader) | versions_this_module - - # aggregate versions by the module name (derived from fully-qualified process name) - versions_by_module = {} - for process, process_versions in versions_by_process.items(): - module = process.split(":")[-1] - try: - if versions_by_module[module] != process_versions: - raise AssertionError( - "We assume that software versions are the same between all modules. " - "If you see this error-message it means you discovered an edge-case " - "and should open an issue in nf-core/tools. " - ) - except KeyError: - versions_by_module[module] = process_versions - - versions_by_module["Workflow"] = { - "Nextflow": "$workflow.nextflow.version", - "$workflow.manifest.name": "$workflow.manifest.version", - } - - versions_mqc = { - "id": "software_versions", - "section_name": "${workflow.manifest.name} Software Versions", - "section_href": "https://github.com/${workflow.manifest.name}", - "plot_type": "html", - "description": "are collected at run time from the software output.", - "data": _make_versions_html(versions_by_module), - } - - with open("software_versions.yml", "w") as f: - yaml.dump(versions_by_module, f, default_flow_style=False) - with open("software_versions_mqc.yml", "w") as f: - yaml.dump(versions_mqc, f, default_flow_style=False) - - with open("versions.yml", "w") as f: - yaml.dump(versions_this_module, f, default_flow_style=False) - - -if __name__ == "__main__": - main() diff --git a/modules/nf-core/custom/dumpsoftwareversions/tests/main.nf.test b/modules/nf-core/custom/dumpsoftwareversions/tests/main.nf.test deleted file mode 100644 index b1e1630..0000000 --- a/modules/nf-core/custom/dumpsoftwareversions/tests/main.nf.test +++ /dev/null @@ -1,43 +0,0 @@ -nextflow_process { - - name "Test Process CUSTOM_DUMPSOFTWAREVERSIONS" - script "../main.nf" - process "CUSTOM_DUMPSOFTWAREVERSIONS" - tag "modules" - tag "modules_nfcore" - tag "custom" - tag "dumpsoftwareversions" - tag "custom/dumpsoftwareversions" - - test("Should run without failures") { - when { - process { - """ - def tool1_version = ''' - TOOL1: - tool1: 0.11.9 - '''.stripIndent() - - def tool2_version = ''' - TOOL2: - tool2: 1.9 - '''.stripIndent() - - input[0] = Channel.of(tool1_version, tool2_version).collectFile() - """ - } - } - - then { - assertAll( - { assert process.success }, - { assert snapshot( - process.out.versions, - file(process.out.mqc_yml[0]).readLines()[0..10], - file(process.out.yml[0]).readLines()[0..7] - ).match() - } - ) - } - } -} diff --git a/modules/nf-core/custom/dumpsoftwareversions/tests/main.nf.test.snap b/modules/nf-core/custom/dumpsoftwareversions/tests/main.nf.test.snap deleted file mode 100644 index 5f59a93..0000000 --- a/modules/nf-core/custom/dumpsoftwareversions/tests/main.nf.test.snap +++ /dev/null @@ -1,33 +0,0 @@ -{ - "Should run without failures": { - "content": [ - [ - "versions.yml:md5,76d454d92244589d32455833f7c1ba6d" - ], - [ - "data: \"\\n\\n \\n \\n \\n \\n \\n \\n \\n\\", - " \\n\\n\\n \\n \\n\\", - " \\ \\n\\n\\n\\n \\n \\", - " \\ \\n \\n\\n\\n\\n\\", - " \\n\\n \\n \\n\\", - " \\ \\n\\n\\n\\n\\n\\n \\n\\", - " \\ \\n \\n\\n\\n\\n\\", - " \\n\\n \\n \\n\\" - ], - [ - "CUSTOM_DUMPSOFTWAREVERSIONS:", - " python: 3.11.7", - " yaml: 5.4.1", - "TOOL1:", - " tool1: 0.11.9", - "TOOL2:", - " tool2: '1.9'", - "Workflow:" - ] - ], - "timestamp": "2024-01-09T23:01:18.710682" - } -} \ No newline at end of file diff --git a/modules/nf-core/custom/dumpsoftwareversions/tests/tags.yml b/modules/nf-core/custom/dumpsoftwareversions/tests/tags.yml deleted file mode 100644 index 405aa24..0000000 --- a/modules/nf-core/custom/dumpsoftwareversions/tests/tags.yml +++ /dev/null @@ -1,2 +0,0 @@ -custom/dumpsoftwareversions: - - modules/nf-core/custom/dumpsoftwareversions/** diff --git a/modules/nf-core/fastqc/tests/main.nf.test b/modules/nf-core/fastqc/tests/main.nf.test index 1f21c66..70edae4 100644 --- a/modules/nf-core/fastqc/tests/main.nf.test +++ b/modules/nf-core/fastqc/tests/main.nf.test @@ -33,7 +33,7 @@ nextflow_process { { assert process.out.zip[0][1] ==~ ".*/test_fastqc.zip" }, { assert path(process.out.html[0][1]).text.contains("") }, - { assert snapshot(process.out.versions).match("versions") } + { assert snapshot(process.out.versions).match("fastqc_versions_single") } ) } } @@ -63,7 +63,7 @@ nextflow_process { { assert path(process.out.html[0][1][0]).text.contains("") }, { assert path(process.out.html[0][1][1]).text.contains("") }, - { assert snapshot(process.out.versions).match("versions") } + { assert snapshot(process.out.versions).match("fastqc_versions_paired") } ) } } @@ -89,7 +89,7 @@ nextflow_process { { assert process.out.zip[0][1] ==~ ".*/test_fastqc.zip" }, { assert path(process.out.html[0][1]).text.contains("") }, - { assert snapshot(process.out.versions).match("versions") } + { assert snapshot(process.out.versions).match("fastqc_versions_interleaved") } ) } } @@ -115,7 +115,7 @@ nextflow_process { { assert process.out.zip[0][1] ==~ ".*/test_fastqc.zip" }, { assert path(process.out.html[0][1]).text.contains("") }, - { assert snapshot(process.out.versions).match("versions") } + { assert snapshot(process.out.versions).match("fastqc_versions_bam") } ) } } @@ -153,7 +153,7 @@ nextflow_process { { assert path(process.out.html[0][1][2]).text.contains("") }, { assert path(process.out.html[0][1][3]).text.contains("") }, - { assert snapshot(process.out.versions).match("versions") } + { assert snapshot(process.out.versions).match("fastqc_versions_multiple") } ) } } @@ -179,7 +179,7 @@ nextflow_process { { assert process.out.zip[0][1] ==~ ".*/mysample_fastqc.zip" }, { assert path(process.out.html[0][1]).text.contains("") }, - { assert snapshot(process.out.versions).match("versions") } + { assert snapshot(process.out.versions).match("fastqc_versions_custom_prefix") } ) } } @@ -204,7 +204,7 @@ nextflow_process { { assert process.success }, { assert snapshot(process.out.html.collect { file(it[1]).getName() } + process.out.zip.collect { file(it[1]).getName() } + - process.out.versions ).match() } + process.out.versions ).match("fastqc_stub") } ) } } diff --git a/modules/nf-core/fastqc/tests/main.nf.test.snap b/modules/nf-core/fastqc/tests/main.nf.test.snap index 5d624bb..86f7c31 100644 --- a/modules/nf-core/fastqc/tests/main.nf.test.snap +++ b/modules/nf-core/fastqc/tests/main.nf.test.snap @@ -1,5 +1,17 @@ { - "sarscov2 single-end [fastq] - stub": { + "fastqc_versions_interleaved": { + "content": [ + [ + "versions.yml:md5,e1cc25ca8af856014824abd842e93978" + ] + ], + "meta": { + "nf-test": "0.8.4", + "nextflow": "23.10.1" + }, + "timestamp": "2024-01-31T17:40:07.293713" + }, + "fastqc_stub": { "content": [ [ "test.html", @@ -7,14 +19,70 @@ "versions.yml:md5,e1cc25ca8af856014824abd842e93978" ] ], - "timestamp": "2024-01-17T18:40:57.254299" + "meta": { + "nf-test": "0.8.4", + "nextflow": "23.10.1" + }, + "timestamp": "2024-01-31T17:31:01.425198" + }, + "fastqc_versions_multiple": { + "content": [ + [ + "versions.yml:md5,e1cc25ca8af856014824abd842e93978" + ] + ], + "meta": { + "nf-test": "0.8.4", + "nextflow": "23.10.1" + }, + "timestamp": "2024-01-31T17:40:55.797907" + }, + "fastqc_versions_bam": { + "content": [ + [ + "versions.yml:md5,e1cc25ca8af856014824abd842e93978" + ] + ], + "meta": { + "nf-test": "0.8.4", + "nextflow": "23.10.1" + }, + "timestamp": "2024-01-31T17:40:26.795862" + }, + "fastqc_versions_single": { + "content": [ + [ + "versions.yml:md5,e1cc25ca8af856014824abd842e93978" + ] + ], + "meta": { + "nf-test": "0.8.4", + "nextflow": "23.10.1" + }, + "timestamp": "2024-01-31T17:39:27.043675" + }, + "fastqc_versions_paired": { + "content": [ + [ + "versions.yml:md5,e1cc25ca8af856014824abd842e93978" + ] + ], + "meta": { + "nf-test": "0.8.4", + "nextflow": "23.10.1" + }, + "timestamp": "2024-01-31T17:39:47.584191" }, - "versions": { + "fastqc_versions_custom_prefix": { "content": [ [ "versions.yml:md5,e1cc25ca8af856014824abd842e93978" ] ], - "timestamp": "2024-01-17T18:36:50.033627" + "meta": { + "nf-test": "0.8.4", + "nextflow": "23.10.1" + }, + "timestamp": "2024-01-31T17:41:14.576531" } } \ No newline at end of file diff --git a/modules/nf-core/multiqc/environment.yml b/modules/nf-core/multiqc/environment.yml index 7625b75..2212096 100644 --- a/modules/nf-core/multiqc/environment.yml +++ b/modules/nf-core/multiqc/environment.yml @@ -4,4 +4,4 @@ channels: - bioconda - defaults dependencies: - - bioconda::multiqc=1.19 + - bioconda::multiqc=1.20 diff --git a/modules/nf-core/multiqc/main.nf b/modules/nf-core/multiqc/main.nf index 1b9f7c4..354f443 100644 --- a/modules/nf-core/multiqc/main.nf +++ b/modules/nf-core/multiqc/main.nf @@ -3,8 +3,8 @@ process MULTIQC { conda "${moduleDir}/environment.yml" container "${ workflow.containerEngine == 'singularity' && !task.ext.singularity_pull_docker_container ? - 'https://depot.galaxyproject.org/singularity/multiqc:1.19--pyhdfd78af_0' : - 'biocontainers/multiqc:1.19--pyhdfd78af_0' }" + 'https://depot.galaxyproject.org/singularity/multiqc:1.20--pyhdfd78af_0' : + 'biocontainers/multiqc:1.20--pyhdfd78af_0' }" input: path multiqc_files, stageAs: "?/*" diff --git a/modules/nf-core/multiqc/tests/main.nf.test b/modules/nf-core/multiqc/tests/main.nf.test index d0438ed..f1c4242 100644 --- a/modules/nf-core/multiqc/tests/main.nf.test +++ b/modules/nf-core/multiqc/tests/main.nf.test @@ -3,6 +3,7 @@ nextflow_process { name "Test Process MULTIQC" script "../main.nf" process "MULTIQC" + tag "modules" tag "modules_nfcore" tag "multiqc" @@ -12,7 +13,7 @@ nextflow_process { when { process { """ - input[0] = Channel.of([file(params.test_data['sarscov2']['illumina']['test_1_fastq_gz_fastqc_zip'], checkIfExists: true)]) + input[0] = Channel.of(file(params.modules_testdata_base_path + 'genomics/sarscov2/illumina/fastqc/test_fastqc.zip', checkIfExists: true)) input[1] = [] input[2] = [] input[3] = [] @@ -25,7 +26,7 @@ nextflow_process { { assert process.success }, { assert process.out.report[0] ==~ ".*/multiqc_report.html" }, { assert process.out.data[0] ==~ ".*/multiqc_data" }, - { assert snapshot(process.out.versions).match("versions") } + { assert snapshot(process.out.versions).match("multiqc_versions_single") } ) } @@ -36,7 +37,7 @@ nextflow_process { when { process { """ - input[0] = Channel.of([file(params.test_data['sarscov2']['illumina']['test_1_fastq_gz_fastqc_zip'], checkIfExists: true)]) + input[0] = Channel.of(file(params.modules_testdata_base_path + 'genomics/sarscov2/illumina/fastqc/test_fastqc.zip', checkIfExists: true)) input[1] = Channel.of(file("https://github.com/nf-core/tools/raw/dev/nf_core/pipeline-template/assets/multiqc_config.yml", checkIfExists: true)) input[2] = [] input[3] = [] @@ -49,7 +50,7 @@ nextflow_process { { assert process.success }, { assert process.out.report[0] ==~ ".*/multiqc_report.html" }, { assert process.out.data[0] ==~ ".*/multiqc_data" }, - { assert snapshot(process.out.versions).match("versions") } + { assert snapshot(process.out.versions).match("multiqc_versions_config") } ) } } @@ -61,7 +62,7 @@ nextflow_process { when { process { """ - input[0] = Channel.of([file(params.test_data['sarscov2']['illumina']['test_1_fastq_gz_fastqc_zip'], checkIfExists: true)]) + input[0] = Channel.of(file(params.modules_testdata_base_path + 'genomics/sarscov2/illumina/fastqc/test_fastqc.zip', checkIfExists: true)) input[1] = [] input[2] = [] input[3] = [] @@ -75,7 +76,7 @@ nextflow_process { { assert snapshot(process.out.report.collect { file(it).getName() } + process.out.data.collect { file(it).getName() } + process.out.plots.collect { file(it).getName() } + - process.out.versions ).match() } + process.out.versions ).match("multiqc_stub") } ) } diff --git a/modules/nf-core/multiqc/tests/main.nf.test.snap b/modules/nf-core/multiqc/tests/main.nf.test.snap index d37e730..c204b48 100644 --- a/modules/nf-core/multiqc/tests/main.nf.test.snap +++ b/modules/nf-core/multiqc/tests/main.nf.test.snap @@ -1,21 +1,41 @@ { - "versions": { + "multiqc_versions_single": { "content": [ [ - "versions.yml:md5,14e9a2661241abd828f4f06a7b5c222d" + "versions.yml:md5,d320d4c37e349c5588e07e7a31cd4186" ] ], - "timestamp": "2024-01-09T23:02:49.911994" + "meta": { + "nf-test": "0.8.4", + "nextflow": "23.10.1" + }, + "timestamp": "2024-02-14T09:28:51.744211298" }, - "sarscov2 single-end [fastqc] - stub": { + "multiqc_stub": { "content": [ [ "multiqc_report.html", "multiqc_data", "multiqc_plots", - "versions.yml:md5,14e9a2661241abd828f4f06a7b5c222d" + "versions.yml:md5,d320d4c37e349c5588e07e7a31cd4186" ] ], - "timestamp": "2024-01-09T23:03:14.524346" + "meta": { + "nf-test": "0.8.4", + "nextflow": "23.10.1" + }, + "timestamp": "2024-02-14T09:29:28.847433492" + }, + "multiqc_versions_config": { + "content": [ + [ + "versions.yml:md5,d320d4c37e349c5588e07e7a31cd4186" + ] + ], + "meta": { + "nf-test": "0.8.4", + "nextflow": "23.10.1" + }, + "timestamp": "2024-02-14T09:29:13.223621555" } } \ No newline at end of file diff --git a/nextflow.config b/nextflow.config index 7b8875a..c457eff 100644 --- a/nextflow.config +++ b/nextflow.config @@ -16,9 +16,7 @@ params { genome = null igenomes_base = 's3://ngi-igenomes/igenomes/' igenomes_ignore = false - - - // MultiQC options + fasta = null// MultiQC options multiqc_config = null multiqc_title = null multiqc_logo = null @@ -43,7 +41,6 @@ params { custom_config_base = "https://raw.githubusercontent.com/nf-core/configs/${params.custom_config_version}" config_profile_contact = null config_profile_url = null - // Max resource options // Defaults only, expecting to be overwritten diff --git a/nextflow_schema.json b/nextflow_schema.json index 2e615b7..2c60f90 100644 --- a/nextflow_schema.json +++ b/nextflow_schema.json @@ -16,6 +16,7 @@ "type": "string", "format": "file-path", "exists": true, + "schema": "assets/schema_input.json", "mimetype": "text/csv", "pattern": "^\\S+\\.csv$", "description": "Path to comma-separated file containing information about the samples in the experiment.", diff --git a/pyproject.toml b/pyproject.toml index 7d08e1c..5611062 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -3,11 +3,13 @@ [tool.ruff] line-length = 120 target-version = "py38" -select = ["I", "E1", "E4", "E7", "E9", "F", "UP", "N"] cache-dir = "~/.cache/ruff" -[tool.ruff.isort] +[tool.ruff.lint] +select = ["I", "E1", "E4", "E7", "E9", "F", "UP", "N"] + +[tool.ruff.lint.isort] known-first-party = ["nf_core"] -[tool.ruff.per-file-ignores] +[tool.ruff.lint.per-file-ignores] "__init__.py" = ["E402", "F401"] diff --git a/subworkflows/local/input_check.nf b/subworkflows/local/input_check.nf deleted file mode 100644 index 0aecf87..0000000 --- a/subworkflows/local/input_check.nf +++ /dev/null @@ -1,44 +0,0 @@ -// -// Check input samplesheet and get read channels -// - -include { SAMPLESHEET_CHECK } from '../../modules/local/samplesheet_check' - -workflow INPUT_CHECK { - take: - samplesheet // file: /path/to/samplesheet.csv - - main: - SAMPLESHEET_CHECK ( samplesheet ) - .csv - .splitCsv ( header:true, sep:',' ) - .map { create_fastq_channel(it) } - .set { reads } - - emit: - reads // channel: [ val(meta), [ reads ] ] - versions = SAMPLESHEET_CHECK.out.versions // channel: [ versions.yml ] -} - -// Function to get list of [ meta, [ fastq_1, fastq_2 ] ] -def create_fastq_channel(LinkedHashMap row) { - // create meta map - def meta = [:] - meta.id = row.sample - meta.single_end = row.single_end.toBoolean() - - // add path(s) of the fastq file(s) to the meta map - def fastq_meta = [] - if (!file(row.fastq_1).exists()) { - exit 1, "ERROR: Please check input samplesheet -> Read 1 FastQ file does not exist!\n${row.fastq_1}" - } - if (meta.single_end) { - fastq_meta = [ meta, [ file(row.fastq_1) ] ] - } else { - if (!file(row.fastq_2).exists()) { - exit 1, "ERROR: Please check input samplesheet -> Read 2 FastQ file does not exist!\n${row.fastq_2}" - } - fastq_meta = [ meta, [ file(row.fastq_1), file(row.fastq_2) ] ] - } - return fastq_meta -} diff --git a/subworkflows/local/utils_nfcore_spatialtranscriptomics_pipeline/main.nf b/subworkflows/local/utils_nfcore_spatialtranscriptomics_pipeline/main.nf new file mode 100644 index 0000000..dc90ad9 --- /dev/null +++ b/subworkflows/local/utils_nfcore_spatialtranscriptomics_pipeline/main.nf @@ -0,0 +1,247 @@ +// +// Subworkflow with functionality specific to the nf-core/pipeline pipeline +// + +/* +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + IMPORT FUNCTIONS / MODULES / SUBWORKFLOWS +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +*/ + +include { UTILS_NFVALIDATION_PLUGIN } from '../../nf-core/utils_nfvalidation_plugin' +include { paramsSummaryMap } from 'plugin/nf-validation' +include { fromSamplesheet } from 'plugin/nf-validation' +include { UTILS_NEXTFLOW_PIPELINE } from '../../nf-core/utils_nextflow_pipeline' +include { completionEmail } from '../../nf-core/utils_nfcore_pipeline' +include { completionSummary } from '../../nf-core/utils_nfcore_pipeline' +include { dashedLine } from '../../nf-core/utils_nfcore_pipeline' +include { nfCoreLogo } from '../../nf-core/utils_nfcore_pipeline' +include { imNotification } from '../../nf-core/utils_nfcore_pipeline' +include { UTILS_NFCORE_PIPELINE } from '../../nf-core/utils_nfcore_pipeline' +include { workflowCitation } from '../../nf-core/utils_nfcore_pipeline' + +/* +======================================================================================== + SUBWORKFLOW TO INITIALISE PIPELINE +======================================================================================== +*/ + +workflow PIPELINE_INITIALISATION { + + take: + version // boolean: Display version and exit + help // boolean: Display help text + validate_params // boolean: Boolean whether to validate parameters against the schema at runtime + monochrome_logs // boolean: Do not use coloured log outputs + nextflow_cli_args // array: List of positional nextflow CLI args + outdir // string: The output directory where the results will be saved + input // string: Path to input samplesheet + + main: + + ch_versions = Channel.empty() + + // + // Print version and exit if required and dump pipeline parameters to JSON file + // + UTILS_NEXTFLOW_PIPELINE ( + version, + true, + outdir, + workflow.profile.tokenize(',').intersect(['conda', 'mamba']).size() >= 1 + ) + + // + // Validate parameters and generate parameter summary to stdout + // + pre_help_text = nfCoreLogo(monochrome_logs) + post_help_text = '\n' + workflowCitation() + '\n' + dashedLine(monochrome_logs) + def String workflow_command = "nextflow run ${workflow.manifest.name} -profile --input samplesheet.csv --outdir " + UTILS_NFVALIDATION_PLUGIN ( + help, + workflow_command, + pre_help_text, + post_help_text, + validate_params, + "nextflow_schema.json" + ) + + // + // Check config provided to the pipeline + // + UTILS_NFCORE_PIPELINE ( + nextflow_cli_args + ) + // + // Custom validation for pipeline parameters + // + validateInputParameters() + + // + // Create channel from input file provided through params.input + // + Channel + .fromSamplesheet("input") + .map { + meta, fastq_1, fastq_2 -> + if (!fastq_2) { + return [ meta.id, meta + [ single_end:true ], [ fastq_1 ] ] + } else { + return [ meta.id, meta + [ single_end:false ], [ fastq_1, fastq_2 ] ] + } + } + .groupTuple() + .map { + validateInputSamplesheet(it) + } + .map { + meta, fastqs -> + return [ meta, fastqs.flatten() ] + } + .set { ch_samplesheet } + + emit: + samplesheet = ch_samplesheet + versions = ch_versions +} + +/* +======================================================================================== + SUBWORKFLOW FOR PIPELINE COMPLETION +======================================================================================== +*/ + +workflow PIPELINE_COMPLETION { + + take: + email // string: email address + email_on_fail // string: email address sent on pipeline failure + plaintext_email // boolean: Send plain-text email instead of HTML + outdir // path: Path to output directory where results will be published + monochrome_logs // boolean: Disable ANSI colour codes in log output + hook_url // string: hook URL for notifications + multiqc_report // string: Path to MultiQC report + + main: + + summary_params = paramsSummaryMap(workflow, parameters_schema: "nextflow_schema.json") + + // + // Completion email and summary + // + workflow.onComplete { + if (email || email_on_fail) { + completionEmail(summary_params, email, email_on_fail, plaintext_email, outdir, monochrome_logs, multiqc_report.toList()) + } + + completionSummary(monochrome_logs) + + if (hook_url) { + imNotification(summary_params, hook_url) + } + } +} + +/* +======================================================================================== + FUNCTIONS +======================================================================================== +*/ +// +// Check and validate pipeline parameters +// +def validateInputParameters() { + genomeExistsError() +}// +// Validate channels from input samplesheet +// +def validateInputSamplesheet(input) { + def (metas, fastqs) = input[1..2] + + // Check that multiple runs of the same sample are of the same datatype i.e. single-end / paired-end + def endedness_ok = metas.collect{ it.single_end }.unique().size == 1 + if (!endedness_ok) { + error("Please check input samplesheet -> Multiple runs of a sample must be of the same datatype i.e. single-end or paired-end: ${metas[0].id}") + } + + return [ metas[0], fastqs ] +} +// +// Get attribute from genome config file e.g. fasta +// +def getGenomeAttribute(attribute) { + if (params.genomes && params.genome && params.genomes.containsKey(params.genome)) { + if (params.genomes[ params.genome ].containsKey(attribute)) { + return params.genomes[ params.genome ][ attribute ] + } + } + return null +} + +// +// Exit pipeline if incorrect --genome key provided +// +def genomeExistsError() { + if (params.genomes && params.genome && !params.genomes.containsKey(params.genome)) { + def error_string = "~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~\n" + + " Genome '${params.genome}' not found in any config files provided to the pipeline.\n" + + " Currently, the available genome keys are:\n" + + " ${params.genomes.keySet().join(", ")}\n" + + "~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~" + error(error_string) + } +}// +// Generate methods description for MultiQC +// +def toolCitationText() { + // TODO nf-core: Optionally add in-text citation tools to this list. + // Can use ternary operators to dynamically construct based conditions, e.g. params["run_xyz"] ? "Tool (Foo et al. 2023)" : "", + // Uncomment function in methodsDescriptionText to render in MultiQC report + def citation_text = [ + "Tools used in the workflow included:", + "FastQC (Andrews 2010),", + "MultiQC (Ewels et al. 2016)", + "." + ].join(' ').trim() + + return citation_text +} + +def toolBibliographyText() { + // TODO nf-core: Optionally add bibliographic entries to this list. + // Can use ternary operators to dynamically construct based conditions, e.g. params["run_xyz"] ? "
  • Author (2023) Pub name, Journal, DOI
  • " : "", + // Uncomment function in methodsDescriptionText to render in MultiQC report + def reference_text = [ + "
  • Andrews S, (2010) FastQC, URL: https://www.bioinformatics.babraham.ac.uk/projects/fastqc/).
  • ", + "
  • Ewels, P., Magnusson, M., Lundin, S., & Käller, M. (2016). MultiQC: summarize analysis results for multiple tools and samples in a single report. Bioinformatics , 32(19), 3047–3048. doi: /10.1093/bioinformatics/btw354
  • " + ].join(' ').trim() + + return reference_text +} + +def methodsDescriptionText(mqc_methods_yaml) { + // Convert to a named map so can be used as with familar NXF ${workflow} variable syntax in the MultiQC YML file + def meta = [:] + meta.workflow = workflow.toMap() + meta["manifest_map"] = workflow.manifest.toMap() + + // Pipeline DOI + meta["doi_text"] = meta.manifest_map.doi ? "(doi: ${meta.manifest_map.doi})" : "" + meta["nodoi_text"] = meta.manifest_map.doi ? "": "
  • If available, make sure to update the text to include the Zenodo DOI of version of the pipeline used.
  • " + + // Tool references + meta["tool_citations"] = "" + meta["tool_bibliography"] = "" + + // TODO nf-core: Only uncomment below if logic in toolCitationText/toolBibliographyText has been filled! + // meta["tool_citations"] = toolCitationText().replaceAll(", \\.", ".").replaceAll("\\. \\.", ".").replaceAll(", \\.", ".") + // meta["tool_bibliography"] = toolBibliographyText() + + + def methods_text = mqc_methods_yaml.text + + def engine = new groovy.text.SimpleTemplateEngine() + def description_html = engine.createTemplate(methods_text).make(meta) + + return description_html.toString() +} diff --git a/subworkflows/nf-core/utils_nextflow_pipeline/main.nf b/subworkflows/nf-core/utils_nextflow_pipeline/main.nf new file mode 100644 index 0000000..ac31f28 --- /dev/null +++ b/subworkflows/nf-core/utils_nextflow_pipeline/main.nf @@ -0,0 +1,126 @@ +// +// Subworkflow with functionality that may be useful for any Nextflow pipeline +// + +import org.yaml.snakeyaml.Yaml +import groovy.json.JsonOutput +import nextflow.extension.FilesEx + +/* +======================================================================================== + SUBWORKFLOW DEFINITION +======================================================================================== +*/ + +workflow UTILS_NEXTFLOW_PIPELINE { + + take: + print_version // boolean: print version + dump_parameters // boolean: dump parameters + outdir // path: base directory used to publish pipeline results + check_conda_channels // boolean: check conda channels + + main: + + // + // Print workflow version and exit on --version + // + if (print_version) { + log.info "${workflow.manifest.name} ${getWorkflowVersion()}" + System.exit(0) + } + + // + // Dump pipeline parameters to a JSON file + // + if (dump_parameters && outdir) { + dumpParametersToJSON(outdir) + } + + // + // When running with Conda, warn if channels have not been set-up appropriately + // + if (check_conda_channels) { + checkCondaChannels() + } + + emit: + dummy_emit = true +} + +/* +======================================================================================== + FUNCTIONS +======================================================================================== +*/ + +// +// Generate version string +// +def getWorkflowVersion() { + String version_string = "" + if (workflow.manifest.version) { + def prefix_v = workflow.manifest.version[0] != 'v' ? 'v' : '' + version_string += "${prefix_v}${workflow.manifest.version}" + } + + if (workflow.commitId) { + def git_shortsha = workflow.commitId.substring(0, 7) + version_string += "-g${git_shortsha}" + } + + return version_string +} + +// +// Dump pipeline parameters to a JSON file +// +def dumpParametersToJSON(outdir) { + def timestamp = new java.util.Date().format( 'yyyy-MM-dd_HH-mm-ss') + def filename = "params_${timestamp}.json" + def temp_pf = new File(workflow.launchDir.toString(), ".${filename}") + def jsonStr = JsonOutput.toJson(params) + temp_pf.text = JsonOutput.prettyPrint(jsonStr) + + FilesEx.copyTo(temp_pf.toPath(), "${outdir}/pipeline_info/params_${timestamp}.json") + temp_pf.delete() +} + +// +// When running with -profile conda, warn if channels have not been set-up appropriately +// +def checkCondaChannels() { + Yaml parser = new Yaml() + def channels = [] + try { + def config = parser.load("conda config --show channels".execute().text) + channels = config.channels + } catch(NullPointerException | IOException e) { + log.warn "Could not verify conda channel configuration." + return + } + + // Check that all channels are present + // This channel list is ordered by required channel priority. + def required_channels_in_order = ['conda-forge', 'bioconda', 'defaults'] + def channels_missing = ((required_channels_in_order as Set) - (channels as Set)) as Boolean + + // Check that they are in the right order + def channel_priority_violation = false + def n = required_channels_in_order.size() + for (int i = 0; i < n - 1; i++) { + channel_priority_violation |= !(channels.indexOf(required_channels_in_order[i]) < channels.indexOf(required_channels_in_order[i+1])) + } + + if (channels_missing | channel_priority_violation) { + log.warn "~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~\n" + + " There is a problem with your Conda configuration!\n\n" + + " You will need to set-up the conda-forge and bioconda channels correctly.\n" + + " Please refer to https://bioconda.github.io/\n" + + " The observed channel order is \n" + + " ${channels}\n" + + " but the following channel order is required:\n" + + " ${required_channels_in_order}\n" + + "~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~" + } +} diff --git a/subworkflows/nf-core/utils_nextflow_pipeline/meta.yml b/subworkflows/nf-core/utils_nextflow_pipeline/meta.yml new file mode 100644 index 0000000..e5c3a0a --- /dev/null +++ b/subworkflows/nf-core/utils_nextflow_pipeline/meta.yml @@ -0,0 +1,38 @@ +# yaml-language-server: $schema=https://raw.githubusercontent.com/nf-core/modules/master/subworkflows/yaml-schema.json +name: "UTILS_NEXTFLOW_PIPELINE" +description: Subworkflow with functionality that may be useful for any Nextflow pipeline +keywords: + - utility + - pipeline + - initialise + - version +components: [] +input: + - print_version: + type: boolean + description: | + Print the version of the pipeline and exit + - dump_parameters: + type: boolean + description: | + Dump the parameters of the pipeline to a JSON file + - output_directory: + type: directory + description: Path to output dir to write JSON file to. + pattern: "results/" + - check_conda_channel: + type: boolean + description: | + Check if the conda channel priority is correct. +output: + - dummy_emit: + type: boolean + description: | + Dummy emit to make nf-core subworkflows lint happy +authors: + - "@adamrtalbot" + - "@drpatelh" +maintainers: + - "@adamrtalbot" + - "@drpatelh" + - "@maxulysse" diff --git a/subworkflows/nf-core/utils_nextflow_pipeline/tests/main.function.nf.test b/subworkflows/nf-core/utils_nextflow_pipeline/tests/main.function.nf.test new file mode 100644 index 0000000..8ed4310 --- /dev/null +++ b/subworkflows/nf-core/utils_nextflow_pipeline/tests/main.function.nf.test @@ -0,0 +1,54 @@ + +nextflow_function { + + name "Test Functions" + script "subworkflows/nf-core/utils_nextflow_pipeline/main.nf" + config "subworkflows/nf-core/utils_nextflow_pipeline/tests/nextflow.config" + tag 'subworkflows' + tag 'utils_nextflow_pipeline' + tag 'subworkflows/utils_nextflow_pipeline' + + test("Test Function getWorkflowVersion") { + + function "getWorkflowVersion" + + then { + assertAll( + { assert function.success }, + { assert snapshot(function.result).match() } + ) + } + } + + test("Test Function dumpParametersToJSON") { + + function "dumpParametersToJSON" + + when { + function { + """ + // define inputs of the function here. Example: + input[0] = "$outputDir" + """.stripIndent() + } + } + + then { + assertAll( + { assert function.success } + ) + } + } + + test("Test Function checkCondaChannels") { + + function "checkCondaChannels" + + then { + assertAll( + { assert function.success }, + { assert snapshot(function.result).match() } + ) + } + } +} \ No newline at end of file diff --git a/subworkflows/nf-core/utils_nextflow_pipeline/tests/main.function.nf.test.snap b/subworkflows/nf-core/utils_nextflow_pipeline/tests/main.function.nf.test.snap new file mode 100644 index 0000000..db2030f --- /dev/null +++ b/subworkflows/nf-core/utils_nextflow_pipeline/tests/main.function.nf.test.snap @@ -0,0 +1,12 @@ +{ + "Test Function getWorkflowVersion": { + "content": [ + "v9.9.9" + ], + "timestamp": "2024-01-19T11:32:36.031083" + }, + "Test Function checkCondaChannels": { + "content": null, + "timestamp": "2024-01-19T11:32:50.456" + } +} \ No newline at end of file diff --git a/subworkflows/nf-core/utils_nextflow_pipeline/tests/main.workflow.nf.test b/subworkflows/nf-core/utils_nextflow_pipeline/tests/main.workflow.nf.test new file mode 100644 index 0000000..f7c54bc --- /dev/null +++ b/subworkflows/nf-core/utils_nextflow_pipeline/tests/main.workflow.nf.test @@ -0,0 +1,123 @@ +nextflow_workflow { + + name "Test Workflow UTILS_NEXTFLOW_PIPELINE" + script "../main.nf" + config "subworkflows/nf-core/utils_nextflow_pipeline/tests/nextflow.config" + workflow "UTILS_NEXTFLOW_PIPELINE" + tag 'subworkflows' + tag 'utils_nextflow_pipeline' + tag 'subworkflows/utils_nextflow_pipeline' + + test("Should run no inputs") { + + when { + params { + outdir = "tests/results" + } + workflow { + """ + print_version = false + dump_parameters = false + outdir = null + check_conda_channels = false + + input[0] = print_version + input[1] = dump_parameters + input[2] = outdir + input[3] = check_conda_channels + """ + } + } + + then { + assertAll( + { assert workflow.success } + ) + } + } + + test("Should print version") { + + when { + params { + outdir = "tests/results" + } + workflow { + """ + print_version = true + dump_parameters = false + outdir = null + check_conda_channels = false + + input[0] = print_version + input[1] = dump_parameters + input[2] = outdir + input[3] = check_conda_channels + """ + } + } + + then { + assertAll( + { assert workflow.success }, + { assert workflow.stdout.contains("nextflow_workflow v9.9.9") } + ) + } + } + + test("Should dump params") { + + when { + params { + outdir = "$outputDir" + } + workflow { + """ + print_version = false + dump_parameters = true + outdir = params.outdir + check_conda_channels = false + + input[0] = false + input[1] = true + input[2] = params.outdir + input[3] = false + """ + } + } + + then { + assertAll( + { assert workflow.success } + ) + } + } + + test("Should not create params JSON if no output directory") { + + when { + params { + outdir = "$outputDir" + } + workflow { + """ + print_version = false + dump_parameters = true + outdir = params.outdir + check_conda_channels = false + + input[0] = false + input[1] = true + input[2] = null + input[3] = false + """ + } + } + + then { + assertAll( + { assert workflow.success } + ) + } + } +} diff --git a/subworkflows/nf-core/utils_nextflow_pipeline/tests/nextflow.config b/subworkflows/nf-core/utils_nextflow_pipeline/tests/nextflow.config new file mode 100644 index 0000000..53574ff --- /dev/null +++ b/subworkflows/nf-core/utils_nextflow_pipeline/tests/nextflow.config @@ -0,0 +1,9 @@ +manifest { + name = 'nextflow_workflow' + author = """nf-core""" + homePage = 'https://127.0.0.1' + description = """Dummy pipeline""" + nextflowVersion = '!>=23.04.0' + version = '9.9.9' + doi = 'https://doi.org/10.5281/zenodo.5070524' +} \ No newline at end of file diff --git a/subworkflows/nf-core/utils_nextflow_pipeline/tests/tags.yml b/subworkflows/nf-core/utils_nextflow_pipeline/tests/tags.yml new file mode 100644 index 0000000..f847611 --- /dev/null +++ b/subworkflows/nf-core/utils_nextflow_pipeline/tests/tags.yml @@ -0,0 +1,2 @@ +subworkflows/utils_nextflow_pipeline: + - subworkflows/nf-core/utils_nextflow_pipeline/** diff --git a/subworkflows/nf-core/utils_nfcore_pipeline/main.nf b/subworkflows/nf-core/utils_nfcore_pipeline/main.nf new file mode 100644 index 0000000..a8b55d6 --- /dev/null +++ b/subworkflows/nf-core/utils_nfcore_pipeline/main.nf @@ -0,0 +1,440 @@ +// +// Subworkflow with utility functions specific to the nf-core pipeline template +// + +import org.yaml.snakeyaml.Yaml +import nextflow.extension.FilesEx + +/* +======================================================================================== + SUBWORKFLOW DEFINITION +======================================================================================== +*/ + +workflow UTILS_NFCORE_PIPELINE { + + take: + nextflow_cli_args + + main: + valid_config = checkConfigProvided() + checkProfileProvided(nextflow_cli_args) + + emit: + valid_config +} + +/* +======================================================================================== + FUNCTIONS +======================================================================================== +*/ + +// +// Warn if a -profile or Nextflow config has not been provided to run the pipeline +// +def checkConfigProvided() { + valid_config = true + if (workflow.profile == 'standard' && workflow.configFiles.size() <= 1) { + log.warn "[$workflow.manifest.name] You are attempting to run the pipeline without any custom configuration!\n\n" + + "This will be dependent on your local compute environment but can be achieved via one or more of the following:\n" + + " (1) Using an existing pipeline profile e.g. `-profile docker` or `-profile singularity`\n" + + " (2) Using an existing nf-core/configs for your Institution e.g. `-profile crick` or `-profile uppmax`\n" + + " (3) Using your own local custom config e.g. `-c /path/to/your/custom.config`\n\n" + + "Please refer to the quick start section and usage docs for the pipeline.\n " + valid_config = false + } + return valid_config +} + +// +// Exit pipeline if --profile contains spaces +// +def checkProfileProvided(nextflow_cli_args) { + if (workflow.profile.endsWith(',')) { + error "The `-profile` option cannot end with a trailing comma, please remove it and re-run the pipeline!\n" + + "HINT: A common mistake is to provide multiple values separated by spaces e.g. `-profile test, docker`.\n" + } + if (nextflow_cli_args[0]) { + log.warn "nf-core pipelines do not accept positional arguments. The positional argument `${nextflow_cli_args[0]}` has been detected.\n" + + "HINT: A common mistake is to provide multiple values separated by spaces e.g. `-profile test, docker`.\n" + } +} + +// +// Citation string for pipeline +// +def workflowCitation() { + return "If you use ${workflow.manifest.name} for your analysis please cite:\n\n" + + "* The pipeline\n" + + " ${workflow.manifest.doi}\n\n" + + "* The nf-core framework\n" + + " https://doi.org/10.1038/s41587-020-0439-x\n\n" + + "* Software dependencies\n" + + " https://github.com/${workflow.manifest.name}/blob/master/CITATIONS.md" +} + +// +// Generate workflow version string +// +def getWorkflowVersion() { + String version_string = "" + if (workflow.manifest.version) { + def prefix_v = workflow.manifest.version[0] != 'v' ? 'v' : '' + version_string += "${prefix_v}${workflow.manifest.version}" + } + + if (workflow.commitId) { + def git_shortsha = workflow.commitId.substring(0, 7) + version_string += "-g${git_shortsha}" + } + + return version_string +} + +// +// Get software versions for pipeline +// +def processVersionsFromYAML(yaml_file) { + Yaml yaml = new Yaml() + versions = yaml.load(yaml_file).collectEntries { k, v -> [ k.tokenize(':')[-1], v ] } + return yaml.dumpAsMap(versions).trim() +} + +// +// Get workflow version for pipeline +// +def workflowVersionToYAML() { + return """ + Workflow: + $workflow.manifest.name: ${getWorkflowVersion()} + Nextflow: $workflow.nextflow.version + """.stripIndent().trim() +} + +// +// Get channel of software versions used in pipeline in YAML format +// +def softwareVersionsToYAML(ch_versions) { + return ch_versions + .unique() + .map { processVersionsFromYAML(it) } + .unique() + .mix(Channel.of(workflowVersionToYAML())) +} + +// +// Get workflow summary for MultiQC +// +def paramsSummaryMultiqc(summary_params) { + def summary_section = '' + for (group in summary_params.keySet()) { + def group_params = summary_params.get(group) // This gets the parameters of that particular group + if (group_params) { + summary_section += "

    $group

    \n" + summary_section += "
    \n" + for (param in group_params.keySet()) { + summary_section += "
    $param
    ${group_params.get(param) ?: 'N/A'}
    \n" + } + summary_section += "
    \n" + } + } + + String yaml_file_text = "id: '${workflow.manifest.name.replace('/','-')}-summary'\n" + yaml_file_text += "description: ' - this information is collected when the pipeline is started.'\n" + yaml_file_text += "section_name: '${workflow.manifest.name} Workflow Summary'\n" + yaml_file_text += "section_href: 'https://github.com/${workflow.manifest.name}'\n" + yaml_file_text += "plot_type: 'html'\n" + yaml_file_text += "data: |\n" + yaml_file_text += "${summary_section}" + + return yaml_file_text +} + +// +// nf-core logo +// +def nfCoreLogo(monochrome_logs=true) { + Map colors = logColours(monochrome_logs) + String.format( + """\n + ${dashedLine(monochrome_logs)} + ${colors.green},--.${colors.black}/${colors.green},-.${colors.reset} + ${colors.blue} ___ __ __ __ ___ ${colors.green}/,-._.--~\'${colors.reset} + ${colors.blue} |\\ | |__ __ / ` / \\ |__) |__ ${colors.yellow}} {${colors.reset} + ${colors.blue} | \\| | \\__, \\__/ | \\ |___ ${colors.green}\\`-._,-`-,${colors.reset} + ${colors.green}`._,._,\'${colors.reset} + ${colors.purple} ${workflow.manifest.name} ${getWorkflowVersion()}${colors.reset} + ${dashedLine(monochrome_logs)} + """.stripIndent() + ) +} + +// +// Return dashed line +// +def dashedLine(monochrome_logs=true) { + Map colors = logColours(monochrome_logs) + return "-${colors.dim}----------------------------------------------------${colors.reset}-" +} + +// +// ANSII colours used for terminal logging +// +def logColours(monochrome_logs=true) { + Map colorcodes = [:] + + // Reset / Meta + colorcodes['reset'] = monochrome_logs ? '' : "\033[0m" + colorcodes['bold'] = monochrome_logs ? '' : "\033[1m" + colorcodes['dim'] = monochrome_logs ? '' : "\033[2m" + colorcodes['underlined'] = monochrome_logs ? '' : "\033[4m" + colorcodes['blink'] = monochrome_logs ? '' : "\033[5m" + colorcodes['reverse'] = monochrome_logs ? '' : "\033[7m" + colorcodes['hidden'] = monochrome_logs ? '' : "\033[8m" + + // Regular Colors + colorcodes['black'] = monochrome_logs ? '' : "\033[0;30m" + colorcodes['red'] = monochrome_logs ? '' : "\033[0;31m" + colorcodes['green'] = monochrome_logs ? '' : "\033[0;32m" + colorcodes['yellow'] = monochrome_logs ? '' : "\033[0;33m" + colorcodes['blue'] = monochrome_logs ? '' : "\033[0;34m" + colorcodes['purple'] = monochrome_logs ? '' : "\033[0;35m" + colorcodes['cyan'] = monochrome_logs ? '' : "\033[0;36m" + colorcodes['white'] = monochrome_logs ? '' : "\033[0;37m" + + // Bold + colorcodes['bblack'] = monochrome_logs ? '' : "\033[1;30m" + colorcodes['bred'] = monochrome_logs ? '' : "\033[1;31m" + colorcodes['bgreen'] = monochrome_logs ? '' : "\033[1;32m" + colorcodes['byellow'] = monochrome_logs ? '' : "\033[1;33m" + colorcodes['bblue'] = monochrome_logs ? '' : "\033[1;34m" + colorcodes['bpurple'] = monochrome_logs ? '' : "\033[1;35m" + colorcodes['bcyan'] = monochrome_logs ? '' : "\033[1;36m" + colorcodes['bwhite'] = monochrome_logs ? '' : "\033[1;37m" + + // Underline + colorcodes['ublack'] = monochrome_logs ? '' : "\033[4;30m" + colorcodes['ured'] = monochrome_logs ? '' : "\033[4;31m" + colorcodes['ugreen'] = monochrome_logs ? '' : "\033[4;32m" + colorcodes['uyellow'] = monochrome_logs ? '' : "\033[4;33m" + colorcodes['ublue'] = monochrome_logs ? '' : "\033[4;34m" + colorcodes['upurple'] = monochrome_logs ? '' : "\033[4;35m" + colorcodes['ucyan'] = monochrome_logs ? '' : "\033[4;36m" + colorcodes['uwhite'] = monochrome_logs ? '' : "\033[4;37m" + + // High Intensity + colorcodes['iblack'] = monochrome_logs ? '' : "\033[0;90m" + colorcodes['ired'] = monochrome_logs ? '' : "\033[0;91m" + colorcodes['igreen'] = monochrome_logs ? '' : "\033[0;92m" + colorcodes['iyellow'] = monochrome_logs ? '' : "\033[0;93m" + colorcodes['iblue'] = monochrome_logs ? '' : "\033[0;94m" + colorcodes['ipurple'] = monochrome_logs ? '' : "\033[0;95m" + colorcodes['icyan'] = monochrome_logs ? '' : "\033[0;96m" + colorcodes['iwhite'] = monochrome_logs ? '' : "\033[0;97m" + + // Bold High Intensity + colorcodes['biblack'] = monochrome_logs ? '' : "\033[1;90m" + colorcodes['bired'] = monochrome_logs ? '' : "\033[1;91m" + colorcodes['bigreen'] = monochrome_logs ? '' : "\033[1;92m" + colorcodes['biyellow'] = monochrome_logs ? '' : "\033[1;93m" + colorcodes['biblue'] = monochrome_logs ? '' : "\033[1;94m" + colorcodes['bipurple'] = monochrome_logs ? '' : "\033[1;95m" + colorcodes['bicyan'] = monochrome_logs ? '' : "\033[1;96m" + colorcodes['biwhite'] = monochrome_logs ? '' : "\033[1;97m" + + return colorcodes +} + +// +// Attach the multiqc report to email +// +def attachMultiqcReport(multiqc_report) { + def mqc_report = null + try { + if (workflow.success) { + mqc_report = multiqc_report.getVal() + if (mqc_report.getClass() == ArrayList && mqc_report.size() >= 1) { + if (mqc_report.size() > 1) { + log.warn "[$workflow.manifest.name] Found multiple reports from process 'MULTIQC', will use only one" + } + mqc_report = mqc_report[0] + } + } + } catch (all) { + if (multiqc_report) { + log.warn "[$workflow.manifest.name] Could not attach MultiQC report to summary email" + } + } + return mqc_report +} + +// +// Construct and send completion email +// +def completionEmail(summary_params, email, email_on_fail, plaintext_email, outdir, monochrome_logs=true, multiqc_report=null) { + + // Set up the e-mail variables + def subject = "[$workflow.manifest.name] Successful: $workflow.runName" + if (!workflow.success) { + subject = "[$workflow.manifest.name] FAILED: $workflow.runName" + } + + def summary = [:] + for (group in summary_params.keySet()) { + summary << summary_params[group] + } + + def misc_fields = [:] + misc_fields['Date Started'] = workflow.start + misc_fields['Date Completed'] = workflow.complete + misc_fields['Pipeline script file path'] = workflow.scriptFile + misc_fields['Pipeline script hash ID'] = workflow.scriptId + if (workflow.repository) misc_fields['Pipeline repository Git URL'] = workflow.repository + if (workflow.commitId) misc_fields['Pipeline repository Git Commit'] = workflow.commitId + if (workflow.revision) misc_fields['Pipeline Git branch/tag'] = workflow.revision + misc_fields['Nextflow Version'] = workflow.nextflow.version + misc_fields['Nextflow Build'] = workflow.nextflow.build + misc_fields['Nextflow Compile Timestamp'] = workflow.nextflow.timestamp + + def email_fields = [:] + email_fields['version'] = getWorkflowVersion() + email_fields['runName'] = workflow.runName + email_fields['success'] = workflow.success + email_fields['dateComplete'] = workflow.complete + email_fields['duration'] = workflow.duration + email_fields['exitStatus'] = workflow.exitStatus + email_fields['errorMessage'] = (workflow.errorMessage ?: 'None') + email_fields['errorReport'] = (workflow.errorReport ?: 'None') + email_fields['commandLine'] = workflow.commandLine + email_fields['projectDir'] = workflow.projectDir + email_fields['summary'] = summary << misc_fields + + // On success try attach the multiqc report + def mqc_report = attachMultiqcReport(multiqc_report) + + // Check if we are only sending emails on failure + def email_address = email + if (!email && email_on_fail && !workflow.success) { + email_address = email_on_fail + } + + // Render the TXT template + def engine = new groovy.text.GStringTemplateEngine() + def tf = new File("${workflow.projectDir}/assets/email_template.txt") + def txt_template = engine.createTemplate(tf).make(email_fields) + def email_txt = txt_template.toString() + + // Render the HTML template + def hf = new File("${workflow.projectDir}/assets/email_template.html") + def html_template = engine.createTemplate(hf).make(email_fields) + def email_html = html_template.toString() + + // Render the sendmail template + def max_multiqc_email_size = (params.containsKey('max_multiqc_email_size') ? params.max_multiqc_email_size : 0) as nextflow.util.MemoryUnit + def smail_fields = [ email: email_address, subject: subject, email_txt: email_txt, email_html: email_html, projectDir: "${workflow.projectDir}", mqcFile: mqc_report, mqcMaxSize: max_multiqc_email_size.toBytes() ] + def sf = new File("${workflow.projectDir}/assets/sendmail_template.txt") + def sendmail_template = engine.createTemplate(sf).make(smail_fields) + def sendmail_html = sendmail_template.toString() + + // Send the HTML e-mail + Map colors = logColours(monochrome_logs) + if (email_address) { + try { + if (plaintext_email) { throw GroovyException('Send plaintext e-mail, not HTML') } + // Try to send HTML e-mail using sendmail + def sendmail_tf = new File(workflow.launchDir.toString(), ".sendmail_tmp.html") + sendmail_tf.withWriter { w -> w << sendmail_html } + [ 'sendmail', '-t' ].execute() << sendmail_html + log.info "-${colors.purple}[$workflow.manifest.name]${colors.green} Sent summary e-mail to $email_address (sendmail)-" + } catch (all) { + // Catch failures and try with plaintext + def mail_cmd = [ 'mail', '-s', subject, '--content-type=text/html', email_address ] + mail_cmd.execute() << email_html + log.info "-${colors.purple}[$workflow.manifest.name]${colors.green} Sent summary e-mail to $email_address (mail)-" + } + } + + // Write summary e-mail HTML to a file + def output_hf = new File(workflow.launchDir.toString(), ".pipeline_report.html") + output_hf.withWriter { w -> w << email_html } + FilesEx.copyTo(output_hf.toPath(), "${outdir}/pipeline_info/pipeline_report.html"); + output_hf.delete() + + // Write summary e-mail TXT to a file + def output_tf = new File(workflow.launchDir.toString(), ".pipeline_report.txt") + output_tf.withWriter { w -> w << email_txt } + FilesEx.copyTo(output_tf.toPath(), "${outdir}/pipeline_info/pipeline_report.txt"); + output_tf.delete() +} + +// +// Print pipeline summary on completion +// +def completionSummary(monochrome_logs=true) { + Map colors = logColours(monochrome_logs) + if (workflow.success) { + if (workflow.stats.ignoredCount == 0) { + log.info "-${colors.purple}[$workflow.manifest.name]${colors.green} Pipeline completed successfully${colors.reset}-" + } else { + log.info "-${colors.purple}[$workflow.manifest.name]${colors.yellow} Pipeline completed successfully, but with errored process(es) ${colors.reset}-" + } + } else { + log.info "-${colors.purple}[$workflow.manifest.name]${colors.red} Pipeline completed with errors${colors.reset}-" + } +} + +// +// Construct and send a notification to a web server as JSON e.g. Microsoft Teams and Slack +// +def imNotification(summary_params, hook_url) { + def summary = [:] + for (group in summary_params.keySet()) { + summary << summary_params[group] + } + + def misc_fields = [:] + misc_fields['start'] = workflow.start + misc_fields['complete'] = workflow.complete + misc_fields['scriptfile'] = workflow.scriptFile + misc_fields['scriptid'] = workflow.scriptId + if (workflow.repository) misc_fields['repository'] = workflow.repository + if (workflow.commitId) misc_fields['commitid'] = workflow.commitId + if (workflow.revision) misc_fields['revision'] = workflow.revision + misc_fields['nxf_version'] = workflow.nextflow.version + misc_fields['nxf_build'] = workflow.nextflow.build + misc_fields['nxf_timestamp'] = workflow.nextflow.timestamp + + def msg_fields = [:] + msg_fields['version'] = getWorkflowVersion() + msg_fields['runName'] = workflow.runName + msg_fields['success'] = workflow.success + msg_fields['dateComplete'] = workflow.complete + msg_fields['duration'] = workflow.duration + msg_fields['exitStatus'] = workflow.exitStatus + msg_fields['errorMessage'] = (workflow.errorMessage ?: 'None') + msg_fields['errorReport'] = (workflow.errorReport ?: 'None') + msg_fields['commandLine'] = workflow.commandLine.replaceFirst(/ +--hook_url +[^ ]+/, "") + msg_fields['projectDir'] = workflow.projectDir + msg_fields['summary'] = summary << misc_fields + + // Render the JSON template + def engine = new groovy.text.GStringTemplateEngine() + // Different JSON depending on the service provider + // Defaults to "Adaptive Cards" (https://adaptivecards.io), except Slack which has its own format + def json_path = hook_url.contains("hooks.slack.com") ? "slackreport.json" : "adaptivecard.json" + def hf = new File("${workflow.projectDir}/assets/${json_path}") + def json_template = engine.createTemplate(hf).make(msg_fields) + def json_message = json_template.toString() + + // POST + def post = new URL(hook_url).openConnection(); + post.setRequestMethod("POST") + post.setDoOutput(true) + post.setRequestProperty("Content-Type", "application/json") + post.getOutputStream().write(json_message.getBytes("UTF-8")); + def postRC = post.getResponseCode(); + if (! postRC.equals(200)) { + log.warn(post.getErrorStream().getText()); + } +} diff --git a/subworkflows/nf-core/utils_nfcore_pipeline/meta.yml b/subworkflows/nf-core/utils_nfcore_pipeline/meta.yml new file mode 100644 index 0000000..d08d243 --- /dev/null +++ b/subworkflows/nf-core/utils_nfcore_pipeline/meta.yml @@ -0,0 +1,24 @@ +# yaml-language-server: $schema=https://raw.githubusercontent.com/nf-core/modules/master/subworkflows/yaml-schema.json +name: "UTILS_NFCORE_PIPELINE" +description: Subworkflow with utility functions specific to the nf-core pipeline template +keywords: + - utility + - pipeline + - initialise + - version +components: [] +input: + - nextflow_cli_args: + type: list + description: | + Nextflow CLI positional arguments +output: + - success: + type: boolean + description: | + Dummy output to indicate success +authors: + - "@adamrtalbot" +maintainers: + - "@adamrtalbot" + - "@maxulysse" diff --git a/subworkflows/nf-core/utils_nfcore_pipeline/tests/main.function.nf.test b/subworkflows/nf-core/utils_nfcore_pipeline/tests/main.function.nf.test new file mode 100644 index 0000000..1dc317f --- /dev/null +++ b/subworkflows/nf-core/utils_nfcore_pipeline/tests/main.function.nf.test @@ -0,0 +1,134 @@ + +nextflow_function { + + name "Test Functions" + script "../main.nf" + config "subworkflows/nf-core/utils_nfcore_pipeline/tests/nextflow.config" + tag "subworkflows" + tag "subworkflows_nfcore" + tag "utils_nfcore_pipeline" + tag "subworkflows/utils_nfcore_pipeline" + + test("Test Function checkConfigProvided") { + + function "checkConfigProvided" + + then { + assertAll( + { assert function.success }, + { assert snapshot(function.result).match() } + ) + } + } + + test("Test Function checkProfileProvided") { + + function "checkProfileProvided" + + when { + function { + """ + input[0] = [] + """ + } + } + + then { + assertAll( + { assert function.success }, + { assert snapshot(function.result).match() } + ) + } + } + + test("Test Function workflowCitation") { + + function "workflowCitation" + + then { + assertAll( + { assert function.success }, + { assert snapshot(function.result).match() } + ) + } + } + + test("Test Function nfCoreLogo") { + + function "nfCoreLogo" + + when { + function { + """ + input[0] = false + """ + } + } + + then { + assertAll( + { assert function.success }, + { assert snapshot(function.result).match() } + ) + } + } + + test("Test Function dashedLine") { + + function "dashedLine" + + when { + function { + """ + input[0] = false + """ + } + } + + then { + assertAll( + { assert function.success }, + { assert snapshot(function.result).match() } + ) + } + } + + test("Test Function without logColours") { + + function "logColours" + + when { + function { + """ + input[0] = true + """ + } + } + + then { + assertAll( + { assert function.success }, + { assert snapshot(function.result).match() } + ) + } + } + + test("Test Function with logColours") { + function "logColours" + + when { + function { + """ + input[0] = false + """ + } + } + + then { + assertAll( + { assert function.success }, + { assert snapshot(function.result).match() } + ) + } + } +} diff --git a/subworkflows/nf-core/utils_nfcore_pipeline/tests/main.function.nf.test.snap b/subworkflows/nf-core/utils_nfcore_pipeline/tests/main.function.nf.test.snap new file mode 100644 index 0000000..10f948e --- /dev/null +++ b/subworkflows/nf-core/utils_nfcore_pipeline/tests/main.function.nf.test.snap @@ -0,0 +1,138 @@ +{ + "Test Function checkProfileProvided": { + "content": null, + "timestamp": "2024-02-09T15:43:55.145717" + }, + "Test Function checkConfigProvided": { + "content": [ + true + ], + "timestamp": "2024-01-19T11:34:13.548431224" + }, + "Test Function nfCoreLogo": { + "content": [ + "\n\n-\u001b[2m----------------------------------------------------\u001b[0m-\n \u001b[0;32m,--.\u001b[0;30m/\u001b[0;32m,-.\u001b[0m\n\u001b[0;34m ___ __ __ __ ___ \u001b[0;32m/,-._.--~'\u001b[0m\n\u001b[0;34m |\\ | |__ __ / ` / \\ |__) |__ \u001b[0;33m} {\u001b[0m\n\u001b[0;34m | \\| | \\__, \\__/ | \\ |___ \u001b[0;32m\\`-._,-`-,\u001b[0m\n \u001b[0;32m`._,._,'\u001b[0m\n\u001b[0;35m nextflow_workflow v9.9.9\u001b[0m\n-\u001b[2m----------------------------------------------------\u001b[0m-\n" + ], + "timestamp": "2024-01-19T11:34:38.840454873" + }, + "Test Function workflowCitation": { + "content": [ + "If you use nextflow_workflow for your analysis please cite:\n\n* The pipeline\n https://doi.org/10.5281/zenodo.5070524\n\n* The nf-core framework\n https://doi.org/10.1038/s41587-020-0439-x\n\n* Software dependencies\n https://github.com/nextflow_workflow/blob/master/CITATIONS.md" + ], + "timestamp": "2024-01-19T11:34:22.24352016" + }, + "Test Function without logColours": { + "content": [ + { + "reset": "", + "bold": "", + "dim": "", + "underlined": "", + "blink": "", + "reverse": "", + "hidden": "", + "black": "", + "red": "", + "green": "", + "yellow": "", + "blue": "", + "purple": "", + "cyan": "", + "white": "", + "bblack": "", + "bred": "", + "bgreen": "", + "byellow": "", + "bblue": "", + "bpurple": "", + "bcyan": "", + "bwhite": "", + "ublack": "", + "ured": "", + "ugreen": "", + "uyellow": "", + "ublue": "", + "upurple": "", + "ucyan": "", + "uwhite": "", + "iblack": "", + "ired": "", + "igreen": "", + "iyellow": "", + "iblue": "", + "ipurple": "", + "icyan": "", + "iwhite": "", + "biblack": "", + "bired": "", + "bigreen": "", + "biyellow": "", + "biblue": "", + "bipurple": "", + "bicyan": "", + "biwhite": "" + } + ], + "timestamp": "2024-01-19T11:35:04.418416984" + }, + "Test Function dashedLine": { + "content": [ + "-\u001b[2m----------------------------------------------------\u001b[0m-" + ], + "timestamp": "2024-01-19T11:34:55.420000755" + }, + "Test Function with logColours": { + "content": [ + { + "reset": "\u001b[0m", + "bold": "\u001b[1m", + "dim": "\u001b[2m", + "underlined": "\u001b[4m", + "blink": "\u001b[5m", + "reverse": "\u001b[7m", + "hidden": "\u001b[8m", + "black": "\u001b[0;30m", + "red": "\u001b[0;31m", + "green": "\u001b[0;32m", + "yellow": "\u001b[0;33m", + "blue": "\u001b[0;34m", + "purple": "\u001b[0;35m", + "cyan": "\u001b[0;36m", + "white": "\u001b[0;37m", + "bblack": "\u001b[1;30m", + "bred": "\u001b[1;31m", + "bgreen": "\u001b[1;32m", + "byellow": "\u001b[1;33m", + "bblue": "\u001b[1;34m", + "bpurple": "\u001b[1;35m", + "bcyan": "\u001b[1;36m", + "bwhite": "\u001b[1;37m", + "ublack": "\u001b[4;30m", + "ured": "\u001b[4;31m", + "ugreen": "\u001b[4;32m", + "uyellow": "\u001b[4;33m", + "ublue": "\u001b[4;34m", + "upurple": "\u001b[4;35m", + "ucyan": "\u001b[4;36m", + "uwhite": "\u001b[4;37m", + "iblack": "\u001b[0;90m", + "ired": "\u001b[0;91m", + "igreen": "\u001b[0;92m", + "iyellow": "\u001b[0;93m", + "iblue": "\u001b[0;94m", + "ipurple": "\u001b[0;95m", + "icyan": "\u001b[0;96m", + "iwhite": "\u001b[0;97m", + "biblack": "\u001b[1;90m", + "bired": "\u001b[1;91m", + "bigreen": "\u001b[1;92m", + "biyellow": "\u001b[1;93m", + "biblue": "\u001b[1;94m", + "bipurple": "\u001b[1;95m", + "bicyan": "\u001b[1;96m", + "biwhite": "\u001b[1;97m" + } + ], + "timestamp": "2024-01-19T11:35:13.436366565" + } +} \ No newline at end of file diff --git a/subworkflows/nf-core/utils_nfcore_pipeline/tests/main.workflow.nf.test b/subworkflows/nf-core/utils_nfcore_pipeline/tests/main.workflow.nf.test new file mode 100644 index 0000000..8940d32 --- /dev/null +++ b/subworkflows/nf-core/utils_nfcore_pipeline/tests/main.workflow.nf.test @@ -0,0 +1,29 @@ +nextflow_workflow { + + name "Test Workflow UTILS_NFCORE_PIPELINE" + script "../main.nf" + config "subworkflows/nf-core/utils_nfcore_pipeline/tests/nextflow.config" + workflow "UTILS_NFCORE_PIPELINE" + tag "subworkflows" + tag "subworkflows_nfcore" + tag "utils_nfcore_pipeline" + tag "subworkflows/utils_nfcore_pipeline" + + test("Should run without failures") { + + when { + workflow { + """ + input[0] = [] + """ + } + } + + then { + assertAll( + { assert workflow.success }, + { assert snapshot(workflow.out).match() } + ) + } + } +} diff --git a/subworkflows/nf-core/utils_nfcore_pipeline/tests/main.workflow.nf.test.snap b/subworkflows/nf-core/utils_nfcore_pipeline/tests/main.workflow.nf.test.snap new file mode 100644 index 0000000..d07ce54 --- /dev/null +++ b/subworkflows/nf-core/utils_nfcore_pipeline/tests/main.workflow.nf.test.snap @@ -0,0 +1,15 @@ +{ + "Should run without failures": { + "content": [ + { + "0": [ + true + ], + "valid_config": [ + true + ] + } + ], + "timestamp": "2024-01-19T11:35:22.538940073" + } +} \ No newline at end of file diff --git a/subworkflows/nf-core/utils_nfcore_pipeline/tests/nextflow.config b/subworkflows/nf-core/utils_nfcore_pipeline/tests/nextflow.config new file mode 100644 index 0000000..d0a926b --- /dev/null +++ b/subworkflows/nf-core/utils_nfcore_pipeline/tests/nextflow.config @@ -0,0 +1,9 @@ +manifest { + name = 'nextflow_workflow' + author = """nf-core""" + homePage = 'https://127.0.0.1' + description = """Dummy pipeline""" + nextflowVersion = '!>=23.04.0' + version = '9.9.9' + doi = 'https://doi.org/10.5281/zenodo.5070524' +} diff --git a/subworkflows/nf-core/utils_nfcore_pipeline/tests/tags.yml b/subworkflows/nf-core/utils_nfcore_pipeline/tests/tags.yml new file mode 100644 index 0000000..ac8523c --- /dev/null +++ b/subworkflows/nf-core/utils_nfcore_pipeline/tests/tags.yml @@ -0,0 +1,2 @@ +subworkflows/utils_nfcore_pipeline: + - subworkflows/nf-core/utils_nfcore_pipeline/** diff --git a/subworkflows/nf-core/utils_nfvalidation_plugin/main.nf b/subworkflows/nf-core/utils_nfvalidation_plugin/main.nf new file mode 100644 index 0000000..2585b65 --- /dev/null +++ b/subworkflows/nf-core/utils_nfvalidation_plugin/main.nf @@ -0,0 +1,62 @@ +// +// Subworkflow that uses the nf-validation plugin to render help text and parameter summary +// + +/* +======================================================================================== + IMPORT NF-VALIDATION PLUGIN +======================================================================================== +*/ + +include { paramsHelp } from 'plugin/nf-validation' +include { paramsSummaryLog } from 'plugin/nf-validation' +include { validateParameters } from 'plugin/nf-validation' + +/* +======================================================================================== + SUBWORKFLOW DEFINITION +======================================================================================== +*/ + +workflow UTILS_NFVALIDATION_PLUGIN { + + take: + print_help // boolean: print help + workflow_command // string: default commmand used to run pipeline + pre_help_text // string: string to be printed before help text and summary log + post_help_text // string: string to be printed after help text and summary log + validate_params // boolean: validate parameters + schema_filename // path: JSON schema file, null to use default value + + main: + + log.debug "Using schema file: ${schema_filename}" + + // Default values for strings + pre_help_text = pre_help_text ?: '' + post_help_text = post_help_text ?: '' + workflow_command = workflow_command ?: '' + + // + // Print help message if needed + // + if (print_help) { + log.info pre_help_text + paramsHelp(workflow_command, parameters_schema: schema_filename) + post_help_text + System.exit(0) + } + + // + // Print parameter summary to stdout + // + log.info pre_help_text + paramsSummaryLog(workflow, parameters_schema: schema_filename) + post_help_text + + // + // Validate parameters relative to the parameter JSON schema + // + if (validate_params){ + validateParameters(parameters_schema: schema_filename) + } + + emit: + dummy_emit = true +} diff --git a/subworkflows/nf-core/utils_nfvalidation_plugin/meta.yml b/subworkflows/nf-core/utils_nfvalidation_plugin/meta.yml new file mode 100644 index 0000000..3d4a6b0 --- /dev/null +++ b/subworkflows/nf-core/utils_nfvalidation_plugin/meta.yml @@ -0,0 +1,44 @@ +# yaml-language-server: $schema=https://raw.githubusercontent.com/nf-core/modules/master/subworkflows/yaml-schema.json +name: "UTILS_NFVALIDATION_PLUGIN" +description: Use nf-validation to initiate and validate a pipeline +keywords: + - utility + - pipeline + - initialise + - validation +components: [] +input: + - print_help: + type: boolean + description: | + Print help message and exit + - workflow_command: + type: string + description: | + The command to run the workflow e.g. "nextflow run main.nf" + - pre_help_text: + type: string + description: | + Text to print before the help message + - post_help_text: + type: string + description: | + Text to print after the help message + - validate_params: + type: boolean + description: | + Validate the parameters and error if invalid. + - schema_filename: + type: string + description: | + The filename of the schema to validate against. +output: + - dummy_emit: + type: boolean + description: | + Dummy emit to make nf-core subworkflows lint happy +authors: + - "@adamrtalbot" +maintainers: + - "@adamrtalbot" + - "@maxulysse" diff --git a/subworkflows/nf-core/utils_nfvalidation_plugin/tests/main.nf.test b/subworkflows/nf-core/utils_nfvalidation_plugin/tests/main.nf.test new file mode 100644 index 0000000..517ee54 --- /dev/null +++ b/subworkflows/nf-core/utils_nfvalidation_plugin/tests/main.nf.test @@ -0,0 +1,200 @@ +nextflow_workflow { + + name "Test Workflow UTILS_NFVALIDATION_PLUGIN" + script "../main.nf" + workflow "UTILS_NFVALIDATION_PLUGIN" + tag "subworkflows" + tag "subworkflows_nfcore" + tag "plugin/nf-validation" + tag "'plugin/nf-validation'" + tag "utils_nfvalidation_plugin" + tag "subworkflows/utils_nfvalidation_plugin" + + test("Should run nothing") { + + when { + + params { + monochrome_logs = true + test_data = '' + } + + workflow { + """ + help = false + workflow_command = null + pre_help_text = null + post_help_text = null + validate_params = false + schema_filename = "$moduleTestDir/nextflow_schema.json" + + input[0] = help + input[1] = workflow_command + input[2] = pre_help_text + input[3] = post_help_text + input[4] = validate_params + input[5] = schema_filename + """ + } + } + + then { + assertAll( + { assert workflow.success } + ) + } + } + + test("Should run help") { + + + when { + + params { + monochrome_logs = true + test_data = '' + } + workflow { + """ + help = true + workflow_command = null + pre_help_text = null + post_help_text = null + validate_params = false + schema_filename = "$moduleTestDir/nextflow_schema.json" + + input[0] = help + input[1] = workflow_command + input[2] = pre_help_text + input[3] = post_help_text + input[4] = validate_params + input[5] = schema_filename + """ + } + } + + then { + assertAll( + { assert workflow.success }, + { assert workflow.exitStatus == 0 }, + { assert workflow.stdout.any { it.contains('Input/output options') } }, + { assert workflow.stdout.any { it.contains('--outdir') } } + ) + } + } + + test("Should run help with command") { + + when { + + params { + monochrome_logs = true + test_data = '' + } + workflow { + """ + help = true + workflow_command = "nextflow run noorg/doesntexist" + pre_help_text = null + post_help_text = null + validate_params = false + schema_filename = "$moduleTestDir/nextflow_schema.json" + + input[0] = help + input[1] = workflow_command + input[2] = pre_help_text + input[3] = post_help_text + input[4] = validate_params + input[5] = schema_filename + """ + } + } + + then { + assertAll( + { assert workflow.success }, + { assert workflow.exitStatus == 0 }, + { assert workflow.stdout.any { it.contains('nextflow run noorg/doesntexist') } }, + { assert workflow.stdout.any { it.contains('Input/output options') } }, + { assert workflow.stdout.any { it.contains('--outdir') } } + ) + } + } + + test("Should run help with extra text") { + + + when { + + params { + monochrome_logs = true + test_data = '' + } + workflow { + """ + help = true + workflow_command = "nextflow run noorg/doesntexist" + pre_help_text = "pre-help-text" + post_help_text = "post-help-text" + validate_params = false + schema_filename = "$moduleTestDir/nextflow_schema.json" + + input[0] = help + input[1] = workflow_command + input[2] = pre_help_text + input[3] = post_help_text + input[4] = validate_params + input[5] = schema_filename + """ + } + } + + then { + assertAll( + { assert workflow.success }, + { assert workflow.exitStatus == 0 }, + { assert workflow.stdout.any { it.contains('pre-help-text') } }, + { assert workflow.stdout.any { it.contains('nextflow run noorg/doesntexist') } }, + { assert workflow.stdout.any { it.contains('Input/output options') } }, + { assert workflow.stdout.any { it.contains('--outdir') } }, + { assert workflow.stdout.any { it.contains('post-help-text') } } + ) + } + } + + test("Should validate params") { + + when { + + params { + monochrome_logs = true + test_data = '' + outdir = 1 + } + workflow { + """ + help = false + workflow_command = null + pre_help_text = null + post_help_text = null + validate_params = true + schema_filename = "$moduleTestDir/nextflow_schema.json" + + input[0] = help + input[1] = workflow_command + input[2] = pre_help_text + input[3] = post_help_text + input[4] = validate_params + input[5] = schema_filename + """ + } + } + + then { + assertAll( + { assert workflow.failed }, + { assert workflow.stdout.any { it.contains('ERROR ~ ERROR: Validation of pipeline parameters failed!') } } + ) + } + } +} \ No newline at end of file diff --git a/subworkflows/nf-core/utils_nfvalidation_plugin/tests/nextflow_schema.json b/subworkflows/nf-core/utils_nfvalidation_plugin/tests/nextflow_schema.json new file mode 100644 index 0000000..7626c1c --- /dev/null +++ b/subworkflows/nf-core/utils_nfvalidation_plugin/tests/nextflow_schema.json @@ -0,0 +1,96 @@ +{ + "$schema": "http://json-schema.org/draft-07/schema", + "$id": "https://raw.githubusercontent.com/./master/nextflow_schema.json", + "title": ". pipeline parameters", + "description": "", + "type": "object", + "definitions": { + "input_output_options": { + "title": "Input/output options", + "type": "object", + "fa_icon": "fas fa-terminal", + "description": "Define where the pipeline should find input data and save output data.", + "required": ["outdir"], + "properties": { + "validate_params": { + "type": "boolean", + "description": "Validate parameters?", + "default": true, + "hidden": true + }, + "outdir": { + "type": "string", + "format": "directory-path", + "description": "The output directory where the results will be saved. You have to use absolute paths to storage on Cloud infrastructure.", + "fa_icon": "fas fa-folder-open" + }, + "test_data_base": { + "type": "string", + "default": "https://raw.githubusercontent.com/nf-core/test-datasets/modules", + "description": "Base for test data directory", + "hidden": true + }, + "test_data": { + "type": "string", + "description": "Fake test data param", + "hidden": true + } + } + }, + "generic_options": { + "title": "Generic options", + "type": "object", + "fa_icon": "fas fa-file-import", + "description": "Less common options for the pipeline, typically set in a config file.", + "help_text": "These options are common to all nf-core pipelines and allow you to customise some of the core preferences for how the pipeline runs.\n\nTypically these options would be set in a Nextflow config file loaded for all pipeline runs, such as `~/.nextflow/config`.", + "properties": { + "help": { + "type": "boolean", + "description": "Display help text.", + "fa_icon": "fas fa-question-circle", + "hidden": true + }, + "version": { + "type": "boolean", + "description": "Display version and exit.", + "fa_icon": "fas fa-question-circle", + "hidden": true + }, + "logo": { + "type": "boolean", + "default": true, + "description": "Display nf-core logo in console output.", + "fa_icon": "fas fa-image", + "hidden": true + }, + "singularity_pull_docker_container": { + "type": "boolean", + "description": "Pull Singularity container from Docker?", + "hidden": true + }, + "publish_dir_mode": { + "type": "string", + "default": "copy", + "description": "Method used to save pipeline results to output directory.", + "help_text": "The Nextflow `publishDir` option specifies which intermediate files should be saved to the output directory. This option tells the pipeline what method should be used to move these files. See [Nextflow docs](https://www.nextflow.io/docs/latest/process.html#publishdir) for details.", + "fa_icon": "fas fa-copy", + "enum": ["symlink", "rellink", "link", "copy", "copyNoFollow", "move"], + "hidden": true + }, + "monochrome_logs": { + "type": "boolean", + "description": "Use monochrome_logs", + "hidden": true + } + } + } + }, + "allOf": [ + { + "$ref": "#/definitions/input_output_options" + }, + { + "$ref": "#/definitions/generic_options" + } + ] +} diff --git a/subworkflows/nf-core/utils_nfvalidation_plugin/tests/tags.yml b/subworkflows/nf-core/utils_nfvalidation_plugin/tests/tags.yml new file mode 100644 index 0000000..60b1cff --- /dev/null +++ b/subworkflows/nf-core/utils_nfvalidation_plugin/tests/tags.yml @@ -0,0 +1,2 @@ +subworkflows/utils_nfvalidation_plugin: + - subworkflows/nf-core/utils_nfvalidation_plugin/** diff --git a/workflows/spatialtranscriptomics.nf b/workflows/spatialtranscriptomics.nf index 4af7e93..4fa4d4f 100644 --- a/workflows/spatialtranscriptomics.nf +++ b/workflows/spatialtranscriptomics.nf @@ -1,54 +1,15 @@ /* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - PRINT PARAMS SUMMARY + IMPORT MODULES / SUBWORKFLOWS / FUNCTIONS ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ */ -include { paramsSummaryLog; paramsSummaryMap } from 'plugin/nf-validation' - -def logo = NfcoreTemplate.logo(workflow, params.monochrome_logs) -def citation = '\n' + WorkflowMain.citation(workflow) + '\n' -def summary_params = paramsSummaryMap(workflow) - -// Print parameter summary log to screen -log.info logo + paramsSummaryLog(workflow) + citation - -WorkflowSpatialtranscriptomics.initialise(params, log) - -/* -~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - CONFIG FILES -~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -*/ - -ch_multiqc_config = Channel.fromPath("$projectDir/assets/multiqc_config.yml", checkIfExists: true) -ch_multiqc_custom_config = params.multiqc_config ? Channel.fromPath( params.multiqc_config, checkIfExists: true ) : Channel.empty() -ch_multiqc_logo = params.multiqc_logo ? Channel.fromPath( params.multiqc_logo, checkIfExists: true ) : Channel.empty() -ch_multiqc_custom_methods_description = params.multiqc_methods_description ? file(params.multiqc_methods_description, checkIfExists: true) : file("$projectDir/assets/methods_description_template.yml", checkIfExists: true) - -/* -~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - IMPORT LOCAL MODULES/SUBWORKFLOWS -~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -*/ - -// -// SUBWORKFLOW: Consisting of a mix of local and nf-core/modules -// -include { INPUT_CHECK } from '../subworkflows/local/input_check' - -/* -~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - IMPORT NF-CORE MODULES/SUBWORKFLOWS -~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -*/ - -// -// MODULE: Installed directly from nf-core/modules -// -include { FASTQC } from '../modules/nf-core/fastqc/main' -include { MULTIQC } from '../modules/nf-core/multiqc/main' -include { CUSTOM_DUMPSOFTWAREVERSIONS } from '../modules/nf-core/custom/dumpsoftwareversions/main' +include { FASTQC } from '../modules/nf-core/fastqc/main' +include { MULTIQC } from '../modules/nf-core/multiqc/main' +include { paramsSummaryMap } from 'plugin/nf-validation' +include { paramsSummaryMultiqc } from '../subworkflows/nf-core/utils_nfcore_pipeline' +include { softwareVersionsToYAML } from '../subworkflows/nf-core/utils_nfcore_pipeline' +include { methodsDescriptionText } from '../subworkflows/local/utils_nfcore_spatialtranscriptomics_pipeline' /* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ @@ -56,50 +17,45 @@ include { CUSTOM_DUMPSOFTWAREVERSIONS } from '../modules/nf-core/custom/dumpsoft ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ */ -// Info required for completion email and summary -def multiqc_report = [] - workflow SPATIALTRANSCRIPTOMICS { - ch_versions = Channel.empty() + take: + ch_samplesheet // channel: samplesheet read in from --input - // - // SUBWORKFLOW: Read in samplesheet, validate and stage input files - // - INPUT_CHECK ( - file(params.input) - ) - ch_versions = ch_versions.mix(INPUT_CHECK.out.versions) - // TODO: OPTIONAL, you can use nf-validation plugin to create an input channel from the samplesheet with Channel.fromSamplesheet("input") - // See the documentation https://nextflow-io.github.io/nf-validation/samplesheets/fromSamplesheet/ - // ! There is currently no tooling to help you write a sample sheet schema + main: + + ch_versions = Channel.empty() + ch_multiqc_files = Channel.empty() // // MODULE: Run FastQC // FASTQC ( - INPUT_CHECK.out.reads + ch_samplesheet ) + ch_multiqc_files = ch_multiqc_files.mix(FASTQC.out.zip.collect{it[1]}) ch_versions = ch_versions.mix(FASTQC.out.versions.first()) - CUSTOM_DUMPSOFTWAREVERSIONS ( - ch_versions.unique().collectFile(name: 'collated_versions.yml') - ) + // + // Collate and save software versions + // + softwareVersionsToYAML(ch_versions) + .collectFile(storeDir: "${params.outdir}/pipeline_info", name: 'nf_core_pipeline_software_mqc_versions.yml', sort: true, newLine: true) + .set { ch_collated_versions } // // MODULE: MultiQC // - workflow_summary = WorkflowSpatialtranscriptomics.paramsSummaryMultiqc(workflow, summary_params) - ch_workflow_summary = Channel.value(workflow_summary) - - methods_description = WorkflowSpatialtranscriptomics.methodsDescriptionText(workflow, ch_multiqc_custom_methods_description, params) - ch_methods_description = Channel.value(methods_description) - - ch_multiqc_files = Channel.empty() - ch_multiqc_files = ch_multiqc_files.mix(ch_workflow_summary.collectFile(name: 'workflow_summary_mqc.yaml')) - ch_multiqc_files = ch_multiqc_files.mix(ch_methods_description.collectFile(name: 'methods_description_mqc.yaml')) - ch_multiqc_files = ch_multiqc_files.mix(CUSTOM_DUMPSOFTWAREVERSIONS.out.mqc_yml.collect()) - ch_multiqc_files = ch_multiqc_files.mix(FASTQC.out.zip.collect{it[1]}.ifEmpty([])) + ch_multiqc_config = Channel.fromPath("$projectDir/assets/multiqc_config.yml", checkIfExists: true) + ch_multiqc_custom_config = params.multiqc_config ? Channel.fromPath(params.multiqc_config, checkIfExists: true) : Channel.empty() + ch_multiqc_logo = params.multiqc_logo ? Channel.fromPath(params.multiqc_logo, checkIfExists: true) : Channel.empty() + summary_params = paramsSummaryMap(workflow, parameters_schema: "nextflow_schema.json") + ch_workflow_summary = Channel.value(paramsSummaryMultiqc(summary_params)) + ch_multiqc_custom_methods_description = params.multiqc_methods_description ? file(params.multiqc_methods_description, checkIfExists: true) : file("$projectDir/assets/methods_description_template.yml", checkIfExists: true) + ch_methods_description = Channel.value(methodsDescriptionText(ch_multiqc_custom_methods_description)) + ch_multiqc_files = ch_multiqc_files.mix(ch_workflow_summary.collectFile(name: 'workflow_summary_mqc.yaml')) + ch_multiqc_files = ch_multiqc_files.mix(ch_collated_versions) + ch_multiqc_files = ch_multiqc_files.mix(ch_methods_description.collectFile(name: 'methods_description_mqc.yaml', sort: false)) MULTIQC ( ch_multiqc_files.collect(), @@ -107,31 +63,10 @@ workflow SPATIALTRANSCRIPTOMICS { ch_multiqc_custom_config.toList(), ch_multiqc_logo.toList() ) - multiqc_report = MULTIQC.out.report.toList() -} - -/* -~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - COMPLETION EMAIL AND SUMMARY -~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -*/ - -workflow.onComplete { - if (params.email || params.email_on_fail) { - NfcoreTemplate.email(workflow, params, summary_params, projectDir, log, multiqc_report) - } - NfcoreTemplate.dump_parameters(workflow, params) - NfcoreTemplate.summary(workflow, params, log) - if (params.hook_url) { - NfcoreTemplate.IM_notification(workflow, params, summary_params, projectDir, log) - } -} -workflow.onError { - if (workflow.errorReport.contains("Process requirement exceeds available memory")) { - println("🛑 Default resources exceed availability 🛑 ") - println("💡 See here on how to configure pipeline: https://nf-co.re/docs/usage/configuration#tuning-workflow-resources 💡") - } + emit: + multiqc_report = MULTIQC.out.report.toList() // channel: /path/to/multiqc_report.html + versions = ch_versions // channel: [ path(versions.yml) ] } /* From e9d1089baf407d0cad5f9d3748973ec117d27876 Mon Sep 17 00:00:00 2001 From: nf-core-bot Date: Thu, 29 Feb 2024 16:13:12 +0000 Subject: [PATCH 15/66] Template update for nf-core/tools version 2.13.1 --- .devcontainer/devcontainer.json | 10 +---- .github/CONTRIBUTING.md | 14 ++++--- .github/PULL_REQUEST_TEMPLATE.md | 2 +- .github/workflows/awsfulltest.yml | 4 +- .github/workflows/awstest.yml | 4 +- .github/workflows/ci.yml | 2 +- .github/workflows/download_pipeline.yml | 2 +- .github/workflows/linting.yml | 2 +- .github/workflows/release-announcements.yml | 2 +- .gitpod.yml | 6 +-- README.md | 3 +- modules.json | 8 ++-- modules/nf-core/multiqc/environment.yml | 2 +- modules/nf-core/multiqc/main.nf | 4 +- .../nf-core/multiqc/tests/main.nf.test.snap | 12 +++--- .../main.nf | 10 +++-- .../tests/main.function.nf.test | 2 +- .../tests/main.function.nf.test.snap | 12 +++++- .../tests/main.workflow.nf.test | 20 ++------- .../tests/nextflow.config | 2 +- .../tests/main.function.nf.test.snap | 42 +++++++++++++++---- .../tests/main.workflow.nf.test.snap | 6 ++- .../tests/main.nf.test | 2 +- 23 files changed, 99 insertions(+), 74 deletions(-) diff --git a/.devcontainer/devcontainer.json b/.devcontainer/devcontainer.json index 4ecfbfe..b290e09 100644 --- a/.devcontainer/devcontainer.json +++ b/.devcontainer/devcontainer.json @@ -10,15 +10,7 @@ "vscode": { // Set *default* container specific settings.json values on container create. "settings": { - "python.defaultInterpreterPath": "/opt/conda/bin/python", - "python.linting.enabled": true, - "python.linting.pylintEnabled": true, - "python.formatting.autopep8Path": "/opt/conda/bin/autopep8", - "python.formatting.yapfPath": "/opt/conda/bin/yapf", - "python.linting.flake8Path": "/opt/conda/bin/flake8", - "python.linting.pycodestylePath": "/opt/conda/bin/pycodestyle", - "python.linting.pydocstylePath": "/opt/conda/bin/pydocstyle", - "python.linting.pylintPath": "/opt/conda/bin/pylint" + "python.defaultInterpreterPath": "/opt/conda/bin/python" }, // Add the IDs of extensions you want installed when the container is created. diff --git a/.github/CONTRIBUTING.md b/.github/CONTRIBUTING.md index 6ef91e2..90cd7e8 100644 --- a/.github/CONTRIBUTING.md +++ b/.github/CONTRIBUTING.md @@ -9,9 +9,8 @@ Please use the pre-filled template to save time. However, don't be put off by this template - other more general issues and suggestions are welcome! Contributions to the code are even more welcome ;) -:::info -If you need help using or modifying nf-core/spatialtranscriptomics then the best place to ask is on the nf-core Slack [#spatialtranscriptomics](https://nfcore.slack.com/channels/spatialtranscriptomics) channel ([join our Slack here](https://nf-co.re/join/slack)). -::: +> [!NOTE] +> If you need help using or modifying nf-core/spatialtranscriptomics then the best place to ask is on the nf-core Slack [#spatialtranscriptomics](https://nfcore.slack.com/channels/spatialtranscriptomics) channel ([join our Slack here](https://nf-co.re/join/slack)). ## Contribution workflow @@ -27,8 +26,11 @@ If you're not used to this workflow with git, you can start with some [docs from ## Tests -You can optionally test your changes by running the pipeline locally. Then it is recommended to use the `debug` profile to -receive warnings about process selectors and other debug info. Example: `nextflow run . -profile debug,test,docker --outdir `. +You have the option to test your changes locally by running the pipeline. For receiving warnings about process selectors and other `debug` information, it is recommended to use the debug profile. Execute all the tests with the following command: + +```bash +nf-test test --profile debug,test,docker --verbose +``` When you create a pull request with changes, [GitHub Actions](https://github.com/features/actions) will run automatic tests. Typically, pull-requests are only fully reviewed when these tests are passing, though of course we can help out before then. @@ -90,7 +92,7 @@ Once there, use `nf-core schema build` to add to `nextflow_schema.json`. Sensible defaults for process resource requirements (CPUs / memory / time) for a process should be defined in `conf/base.config`. These should generally be specified generic with `withLabel:` selectors so they can be shared across multiple processes/steps of the pipeline. A nf-core standard set of labels that should be followed where possible can be seen in the [nf-core pipeline template](https://github.com/nf-core/tools/blob/master/nf_core/pipeline-template/conf/base.config), which has the default process as a single core-process, and then different levels of multi-core configurations for increasingly large memory requirements defined with standardised labels. -The process resources can be passed on to the tool dynamically within the process with the `${task.cpu}` and `${task.memory}` variables in the `script:` block. +The process resources can be passed on to the tool dynamically within the process with the `${task.cpus}` and `${task.memory}` variables in the `script:` block. ### Naming schemes diff --git a/.github/PULL_REQUEST_TEMPLATE.md b/.github/PULL_REQUEST_TEMPLATE.md index 1213782..d90b4d8 100644 --- a/.github/PULL_REQUEST_TEMPLATE.md +++ b/.github/PULL_REQUEST_TEMPLATE.md @@ -18,7 +18,7 @@ Learn more about contributing: [CONTRIBUTING.md](https://github.com/nf-core/spat - [ ] If you've added a new tool - have you followed the pipeline conventions in the [contribution docs](https://github.com/nf-core/spatialtranscriptomics/tree/master/.github/CONTRIBUTING.md) - [ ] If necessary, also make a PR on the nf-core/spatialtranscriptomics _branch_ on the [nf-core/test-datasets](https://github.com/nf-core/test-datasets) repository. - [ ] Make sure your code lints (`nf-core lint`). -- [ ] Ensure the test suite passes (`nextflow run . -profile test,docker --outdir `). +- [ ] Ensure the test suite passes (`nf-test test main.nf.test -profile test,docker`). - [ ] Check for unexpected warnings in debug mode (`nextflow run . -profile debug,test,docker --outdir `). - [ ] Usage Documentation in `docs/usage.md` is updated. - [ ] Output Documentation in `docs/output.md` is updated. diff --git a/.github/workflows/awsfulltest.yml b/.github/workflows/awsfulltest.yml index 9fba086..5906667 100644 --- a/.github/workflows/awsfulltest.yml +++ b/.github/workflows/awsfulltest.yml @@ -14,7 +14,7 @@ jobs: runs-on: ubuntu-latest steps: - name: Launch workflow via tower - uses: seqeralabs/action-tower-launch@922e5c8d5ac4e918107ec311d2ebbd65e5982b3d # v2 + uses: seqeralabs/action-tower-launch@v2 # TODO nf-core: You can customise AWS full pipeline tests as required # Add full size test data (but still relatively small datasets for few samples) # on the `test_full.config` test runs with only one set of parameters @@ -31,7 +31,7 @@ jobs: } profiles: test_full - - uses: actions/upload-artifact@5d5d22a31266ced268874388b861e4b58bb5c2f3 # v4 + - uses: actions/upload-artifact@v4 with: name: Tower debug log file path: | diff --git a/.github/workflows/awstest.yml b/.github/workflows/awstest.yml index b026b0a..a3d63eb 100644 --- a/.github/workflows/awstest.yml +++ b/.github/workflows/awstest.yml @@ -12,7 +12,7 @@ jobs: steps: # Launch workflow using Tower CLI tool action - name: Launch workflow via tower - uses: seqeralabs/action-tower-launch@922e5c8d5ac4e918107ec311d2ebbd65e5982b3d # v2 + uses: seqeralabs/action-tower-launch@v2 with: workspace_id: ${{ secrets.TOWER_WORKSPACE_ID }} access_token: ${{ secrets.TOWER_ACCESS_TOKEN }} @@ -25,7 +25,7 @@ jobs: } profiles: test - - uses: actions/upload-artifact@5d5d22a31266ced268874388b861e4b58bb5c2f3 # v4 + - uses: actions/upload-artifact@v4 with: name: Tower debug log file path: | diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 4547075..1cbe052 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -31,7 +31,7 @@ jobs: uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4 - name: Install Nextflow - uses: nf-core/setup-nextflow@b9f764e8ba5c76b712ace14ecbfcef0e40ae2dd8 # v1 + uses: nf-core/setup-nextflow@v1 with: version: "${{ matrix.NXF_VER }}" diff --git a/.github/workflows/download_pipeline.yml b/.github/workflows/download_pipeline.yml index f823210..08622fd 100644 --- a/.github/workflows/download_pipeline.yml +++ b/.github/workflows/download_pipeline.yml @@ -28,7 +28,7 @@ jobs: runs-on: ubuntu-latest steps: - name: Install Nextflow - uses: nf-core/setup-nextflow@b9f764e8ba5c76b712ace14ecbfcef0e40ae2dd8 # v1 + uses: nf-core/setup-nextflow@v1 - uses: actions/setup-python@0a5c61591373683505ea898e09a3ea4f39ef2b9c # v5 with: diff --git a/.github/workflows/linting.yml b/.github/workflows/linting.yml index 748b431..073e187 100644 --- a/.github/workflows/linting.yml +++ b/.github/workflows/linting.yml @@ -35,7 +35,7 @@ jobs: uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4 - name: Install Nextflow - uses: nf-core/setup-nextflow@b9f764e8ba5c76b712ace14ecbfcef0e40ae2dd8 # v1 + uses: nf-core/setup-nextflow@v1 - uses: actions/setup-python@0a5c61591373683505ea898e09a3ea4f39ef2b9c # v5 with: diff --git a/.github/workflows/release-announcements.yml b/.github/workflows/release-announcements.yml index c3674af..d468aea 100644 --- a/.github/workflows/release-announcements.yml +++ b/.github/workflows/release-announcements.yml @@ -12,7 +12,7 @@ jobs: - name: get topics and convert to hashtags id: get_topics run: | - curl -s https://nf-co.re/pipelines.json | jq -r '.remote_workflows[] | select(.name == "${{ github.repository }}") | .topics[]' | awk '{print "#"$0}' | tr '\n' ' ' > $GITHUB_OUTPUT + curl -s https://nf-co.re/pipelines.json | jq -r '.remote_workflows[] | select(.full_name == "${{ github.repository }}") | .topics[]' | awk '{print "#"$0}' | tr '\n' ' ' >> $GITHUB_OUTPUT - uses: rzr/fediverse-action@master with: diff --git a/.gitpod.yml b/.gitpod.yml index 363d5b1..105a182 100644 --- a/.gitpod.yml +++ b/.gitpod.yml @@ -10,13 +10,11 @@ tasks: vscode: extensions: # based on nf-core.nf-core-extensionpack - - codezombiech.gitignore # Language support for .gitignore files - # - cssho.vscode-svgviewer # SVG viewer - esbenp.prettier-vscode # Markdown/CommonMark linting and style checking for Visual Studio Code - - eamodio.gitlens # Quickly glimpse into whom, why, and when a line or code block was changed - EditorConfig.EditorConfig # override user/workspace settings with settings found in .editorconfig files - Gruntfuggly.todo-tree # Display TODO and FIXME in a tree view in the activity bar - mechatroner.rainbow-csv # Highlight columns in csv files in different colors - # - nextflow.nextflow # Nextflow syntax highlighting + # - nextflow.nextflow # Nextflow syntax highlighting - oderwat.indent-rainbow # Highlight indentation level - streetsidesoftware.code-spell-checker # Spelling checker for source code + - charliermarsh.ruff # Code linter Ruff diff --git a/README.md b/README.md index c2ae3f2..479912f 100644 --- a/README.md +++ b/README.md @@ -7,12 +7,13 @@ [![GitHub Actions CI Status](https://github.com/nf-core/spatialtranscriptomics/actions/workflows/ci.yml/badge.svg)](https://github.com/nf-core/spatialtranscriptomics/actions/workflows/ci.yml) [![GitHub Actions Linting Status](https://github.com/nf-core/spatialtranscriptomics/actions/workflows/linting.yml/badge.svg)](https://github.com/nf-core/spatialtranscriptomics/actions/workflows/linting.yml)[![AWS CI](https://img.shields.io/badge/CI%20tests-full%20size-FF9900?labelColor=000000&logo=Amazon%20AWS)](https://nf-co.re/spatialtranscriptomics/results)[![Cite with Zenodo](http://img.shields.io/badge/DOI-10.5281/zenodo.XXXXXXX-1073c8?labelColor=000000)](https://doi.org/10.5281/zenodo.XXXXXXX) +[![nf-test](https://img.shields.io/badge/unit_tests-nf--test-337ab7.svg)](https://www.nf-test.com) [![Nextflow](https://img.shields.io/badge/nextflow%20DSL2-%E2%89%A523.04.0-23aa62.svg)](https://www.nextflow.io/) [![run with conda](http://img.shields.io/badge/run%20with-conda-3EB049?labelColor=000000&logo=anaconda)](https://docs.conda.io/en/latest/) [![run with docker](https://img.shields.io/badge/run%20with-docker-0db7ed?labelColor=000000&logo=docker)](https://www.docker.com/) [![run with singularity](https://img.shields.io/badge/run%20with-singularity-1d355c.svg?labelColor=000000)](https://sylabs.io/docs/) -[![Launch on Nextflow Tower](https://img.shields.io/badge/Launch%20%F0%9F%9A%80-Nextflow%20Tower-%234256e7)](https://tower.nf/launch?pipeline=https://github.com/nf-core/spatialtranscriptomics) +[![Launch on Seqera Platform](https://img.shields.io/badge/Launch%20%F0%9F%9A%80-Seqera%20Platform-%234256e7)](https://tower.nf/launch?pipeline=https://github.com/nf-core/spatialtranscriptomics) [![Get help on Slack](http://img.shields.io/badge/slack-nf--core%20%23spatialtranscriptomics-4A154B?labelColor=000000&logo=slack)](https://nfcore.slack.com/channels/spatialtranscriptomics)[![Follow on Twitter](http://img.shields.io/badge/twitter-%40nf__core-1DA1F2?labelColor=000000&logo=twitter)](https://twitter.com/nf_core)[![Follow on Mastodon](https://img.shields.io/badge/mastodon-nf__core-6364ff?labelColor=FFFFFF&logo=mastodon)](https://mstdn.science/@nf_core)[![Watch on YouTube](http://img.shields.io/badge/youtube-nf--core-FF0000?labelColor=000000&logo=youtube)](https://www.youtube.com/c/nf-core) diff --git a/modules.json b/modules.json index 14a641c..620e776 100644 --- a/modules.json +++ b/modules.json @@ -12,7 +12,7 @@ }, "multiqc": { "branch": "master", - "git_sha": "ccacf6f5de6df3bc6d73b665c1fd2933d8bbc290", + "git_sha": "b7ebe95761cd389603f9cc0e0dc384c0f663815a", "installed_by": ["modules"] } } @@ -21,17 +21,17 @@ "nf-core": { "utils_nextflow_pipeline": { "branch": "master", - "git_sha": "cd08c91373cd00a73255081340e4914485846ba1", + "git_sha": "5caf7640a9ef1d18d765d55339be751bb0969dfa", "installed_by": ["subworkflows"] }, "utils_nfcore_pipeline": { "branch": "master", - "git_sha": "262b17ed2aad591039f914951659177e6c39a8d8", + "git_sha": "5caf7640a9ef1d18d765d55339be751bb0969dfa", "installed_by": ["subworkflows"] }, "utils_nfvalidation_plugin": { "branch": "master", - "git_sha": "cd08c91373cd00a73255081340e4914485846ba1", + "git_sha": "5caf7640a9ef1d18d765d55339be751bb0969dfa", "installed_by": ["subworkflows"] } } diff --git a/modules/nf-core/multiqc/environment.yml b/modules/nf-core/multiqc/environment.yml index 2212096..ca39fb6 100644 --- a/modules/nf-core/multiqc/environment.yml +++ b/modules/nf-core/multiqc/environment.yml @@ -4,4 +4,4 @@ channels: - bioconda - defaults dependencies: - - bioconda::multiqc=1.20 + - bioconda::multiqc=1.21 diff --git a/modules/nf-core/multiqc/main.nf b/modules/nf-core/multiqc/main.nf index 354f443..47ac352 100644 --- a/modules/nf-core/multiqc/main.nf +++ b/modules/nf-core/multiqc/main.nf @@ -3,8 +3,8 @@ process MULTIQC { conda "${moduleDir}/environment.yml" container "${ workflow.containerEngine == 'singularity' && !task.ext.singularity_pull_docker_container ? - 'https://depot.galaxyproject.org/singularity/multiqc:1.20--pyhdfd78af_0' : - 'biocontainers/multiqc:1.20--pyhdfd78af_0' }" + 'https://depot.galaxyproject.org/singularity/multiqc:1.21--pyhdfd78af_0' : + 'biocontainers/multiqc:1.21--pyhdfd78af_0' }" input: path multiqc_files, stageAs: "?/*" diff --git a/modules/nf-core/multiqc/tests/main.nf.test.snap b/modules/nf-core/multiqc/tests/main.nf.test.snap index c204b48..bfebd80 100644 --- a/modules/nf-core/multiqc/tests/main.nf.test.snap +++ b/modules/nf-core/multiqc/tests/main.nf.test.snap @@ -2,14 +2,14 @@ "multiqc_versions_single": { "content": [ [ - "versions.yml:md5,d320d4c37e349c5588e07e7a31cd4186" + "versions.yml:md5,21f35ee29416b9b3073c28733efe4b7d" ] ], "meta": { "nf-test": "0.8.4", "nextflow": "23.10.1" }, - "timestamp": "2024-02-14T09:28:51.744211298" + "timestamp": "2024-02-29T08:48:55.657331" }, "multiqc_stub": { "content": [ @@ -17,25 +17,25 @@ "multiqc_report.html", "multiqc_data", "multiqc_plots", - "versions.yml:md5,d320d4c37e349c5588e07e7a31cd4186" + "versions.yml:md5,21f35ee29416b9b3073c28733efe4b7d" ] ], "meta": { "nf-test": "0.8.4", "nextflow": "23.10.1" }, - "timestamp": "2024-02-14T09:29:28.847433492" + "timestamp": "2024-02-29T08:49:49.071937" }, "multiqc_versions_config": { "content": [ [ - "versions.yml:md5,d320d4c37e349c5588e07e7a31cd4186" + "versions.yml:md5,21f35ee29416b9b3073c28733efe4b7d" ] ], "meta": { "nf-test": "0.8.4", "nextflow": "23.10.1" }, - "timestamp": "2024-02-14T09:29:13.223621555" + "timestamp": "2024-02-29T08:49:25.457567" } } \ No newline at end of file diff --git a/subworkflows/local/utils_nfcore_spatialtranscriptomics_pipeline/main.nf b/subworkflows/local/utils_nfcore_spatialtranscriptomics_pipeline/main.nf index dc90ad9..0a9a429 100644 --- a/subworkflows/local/utils_nfcore_spatialtranscriptomics_pipeline/main.nf +++ b/subworkflows/local/utils_nfcore_spatialtranscriptomics_pipeline/main.nf @@ -1,5 +1,5 @@ // -// Subworkflow with functionality specific to the nf-core/pipeline pipeline +// Subworkflow with functionality specific to the nf-core/spatialtranscriptomics pipeline // /* @@ -152,7 +152,9 @@ workflow PIPELINE_COMPLETION { // def validateInputParameters() { genomeExistsError() -}// +} + +// // Validate channels from input samplesheet // def validateInputSamplesheet(input) { @@ -190,7 +192,9 @@ def genomeExistsError() { "~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~" error(error_string) } -}// +} + +// // Generate methods description for MultiQC // def toolCitationText() { diff --git a/subworkflows/nf-core/utils_nextflow_pipeline/tests/main.function.nf.test b/subworkflows/nf-core/utils_nextflow_pipeline/tests/main.function.nf.test index 8ed4310..68718e4 100644 --- a/subworkflows/nf-core/utils_nextflow_pipeline/tests/main.function.nf.test +++ b/subworkflows/nf-core/utils_nextflow_pipeline/tests/main.function.nf.test @@ -51,4 +51,4 @@ nextflow_function { ) } } -} \ No newline at end of file +} diff --git a/subworkflows/nf-core/utils_nextflow_pipeline/tests/main.function.nf.test.snap b/subworkflows/nf-core/utils_nextflow_pipeline/tests/main.function.nf.test.snap index db2030f..e3f0baf 100644 --- a/subworkflows/nf-core/utils_nextflow_pipeline/tests/main.function.nf.test.snap +++ b/subworkflows/nf-core/utils_nextflow_pipeline/tests/main.function.nf.test.snap @@ -3,10 +3,18 @@ "content": [ "v9.9.9" ], - "timestamp": "2024-01-19T11:32:36.031083" + "meta": { + "nf-test": "0.8.4", + "nextflow": "23.10.1" + }, + "timestamp": "2024-02-28T12:02:05.308243" }, "Test Function checkCondaChannels": { "content": null, - "timestamp": "2024-01-19T11:32:50.456" + "meta": { + "nf-test": "0.8.4", + "nextflow": "23.10.1" + }, + "timestamp": "2024-02-28T12:02:12.425833" } } \ No newline at end of file diff --git a/subworkflows/nf-core/utils_nextflow_pipeline/tests/main.workflow.nf.test b/subworkflows/nf-core/utils_nextflow_pipeline/tests/main.workflow.nf.test index f7c54bc..ca964ce 100644 --- a/subworkflows/nf-core/utils_nextflow_pipeline/tests/main.workflow.nf.test +++ b/subworkflows/nf-core/utils_nextflow_pipeline/tests/main.workflow.nf.test @@ -11,9 +11,6 @@ nextflow_workflow { test("Should run no inputs") { when { - params { - outdir = "tests/results" - } workflow { """ print_version = false @@ -39,9 +36,6 @@ nextflow_workflow { test("Should print version") { when { - params { - outdir = "tests/results" - } workflow { """ print_version = true @@ -68,19 +62,16 @@ nextflow_workflow { test("Should dump params") { when { - params { - outdir = "$outputDir" - } workflow { """ print_version = false dump_parameters = true - outdir = params.outdir + outdir = 'results' check_conda_channels = false input[0] = false input[1] = true - input[2] = params.outdir + input[2] = outdir input[3] = false """ } @@ -96,19 +87,16 @@ nextflow_workflow { test("Should not create params JSON if no output directory") { when { - params { - outdir = "$outputDir" - } workflow { """ print_version = false dump_parameters = true - outdir = params.outdir + outdir = null check_conda_channels = false input[0] = false input[1] = true - input[2] = null + input[2] = outdir input[3] = false """ } diff --git a/subworkflows/nf-core/utils_nextflow_pipeline/tests/nextflow.config b/subworkflows/nf-core/utils_nextflow_pipeline/tests/nextflow.config index 53574ff..d0a926b 100644 --- a/subworkflows/nf-core/utils_nextflow_pipeline/tests/nextflow.config +++ b/subworkflows/nf-core/utils_nextflow_pipeline/tests/nextflow.config @@ -6,4 +6,4 @@ manifest { nextflowVersion = '!>=23.04.0' version = '9.9.9' doi = 'https://doi.org/10.5281/zenodo.5070524' -} \ No newline at end of file +} diff --git a/subworkflows/nf-core/utils_nfcore_pipeline/tests/main.function.nf.test.snap b/subworkflows/nf-core/utils_nfcore_pipeline/tests/main.function.nf.test.snap index 10f948e..1037232 100644 --- a/subworkflows/nf-core/utils_nfcore_pipeline/tests/main.function.nf.test.snap +++ b/subworkflows/nf-core/utils_nfcore_pipeline/tests/main.function.nf.test.snap @@ -1,25 +1,41 @@ { "Test Function checkProfileProvided": { "content": null, - "timestamp": "2024-02-09T15:43:55.145717" + "meta": { + "nf-test": "0.8.4", + "nextflow": "23.10.1" + }, + "timestamp": "2024-02-28T12:03:03.360873" }, "Test Function checkConfigProvided": { "content": [ true ], - "timestamp": "2024-01-19T11:34:13.548431224" + "meta": { + "nf-test": "0.8.4", + "nextflow": "23.10.1" + }, + "timestamp": "2024-02-28T12:02:59.729647" }, "Test Function nfCoreLogo": { "content": [ "\n\n-\u001b[2m----------------------------------------------------\u001b[0m-\n \u001b[0;32m,--.\u001b[0;30m/\u001b[0;32m,-.\u001b[0m\n\u001b[0;34m ___ __ __ __ ___ \u001b[0;32m/,-._.--~'\u001b[0m\n\u001b[0;34m |\\ | |__ __ / ` / \\ |__) |__ \u001b[0;33m} {\u001b[0m\n\u001b[0;34m | \\| | \\__, \\__/ | \\ |___ \u001b[0;32m\\`-._,-`-,\u001b[0m\n \u001b[0;32m`._,._,'\u001b[0m\n\u001b[0;35m nextflow_workflow v9.9.9\u001b[0m\n-\u001b[2m----------------------------------------------------\u001b[0m-\n" ], - "timestamp": "2024-01-19T11:34:38.840454873" + "meta": { + "nf-test": "0.8.4", + "nextflow": "23.10.1" + }, + "timestamp": "2024-02-28T12:03:10.562934" }, "Test Function workflowCitation": { "content": [ "If you use nextflow_workflow for your analysis please cite:\n\n* The pipeline\n https://doi.org/10.5281/zenodo.5070524\n\n* The nf-core framework\n https://doi.org/10.1038/s41587-020-0439-x\n\n* Software dependencies\n https://github.com/nextflow_workflow/blob/master/CITATIONS.md" ], - "timestamp": "2024-01-19T11:34:22.24352016" + "meta": { + "nf-test": "0.8.4", + "nextflow": "23.10.1" + }, + "timestamp": "2024-02-28T12:03:07.019761" }, "Test Function without logColours": { "content": [ @@ -73,13 +89,21 @@ "biwhite": "" } ], - "timestamp": "2024-01-19T11:35:04.418416984" + "meta": { + "nf-test": "0.8.4", + "nextflow": "23.10.1" + }, + "timestamp": "2024-02-28T12:03:17.969323" }, "Test Function dashedLine": { "content": [ "-\u001b[2m----------------------------------------------------\u001b[0m-" ], - "timestamp": "2024-01-19T11:34:55.420000755" + "meta": { + "nf-test": "0.8.4", + "nextflow": "23.10.1" + }, + "timestamp": "2024-02-28T12:03:14.366181" }, "Test Function with logColours": { "content": [ @@ -133,6 +157,10 @@ "biwhite": "\u001b[1;97m" } ], - "timestamp": "2024-01-19T11:35:13.436366565" + "meta": { + "nf-test": "0.8.4", + "nextflow": "23.10.1" + }, + "timestamp": "2024-02-28T12:03:21.714424" } } \ No newline at end of file diff --git a/subworkflows/nf-core/utils_nfcore_pipeline/tests/main.workflow.nf.test.snap b/subworkflows/nf-core/utils_nfcore_pipeline/tests/main.workflow.nf.test.snap index d07ce54..859d103 100644 --- a/subworkflows/nf-core/utils_nfcore_pipeline/tests/main.workflow.nf.test.snap +++ b/subworkflows/nf-core/utils_nfcore_pipeline/tests/main.workflow.nf.test.snap @@ -10,6 +10,10 @@ ] } ], - "timestamp": "2024-01-19T11:35:22.538940073" + "meta": { + "nf-test": "0.8.4", + "nextflow": "23.10.1" + }, + "timestamp": "2024-02-28T12:03:25.726491" } } \ No newline at end of file diff --git a/subworkflows/nf-core/utils_nfvalidation_plugin/tests/main.nf.test b/subworkflows/nf-core/utils_nfvalidation_plugin/tests/main.nf.test index 517ee54..5784a33 100644 --- a/subworkflows/nf-core/utils_nfvalidation_plugin/tests/main.nf.test +++ b/subworkflows/nf-core/utils_nfvalidation_plugin/tests/main.nf.test @@ -197,4 +197,4 @@ nextflow_workflow { ) } } -} \ No newline at end of file +} From 91ca58b582629741fcdfd76c69fceadbc6c896cf Mon Sep 17 00:00:00 2001 From: Erik Fasterius Date: Fri, 1 Mar 2024 10:44:24 +0100 Subject: [PATCH 16/66] Remove redundant environment specification --- env/{reports => }/Dockerfile | 0 env/{reports => }/environment.yml | 0 env/st_spatial_de/environment.yml | 13 ------------- 3 files changed, 13 deletions(-) rename env/{reports => }/Dockerfile (100%) rename env/{reports => }/environment.yml (100%) delete mode 100644 env/st_spatial_de/environment.yml diff --git a/env/reports/Dockerfile b/env/Dockerfile similarity index 100% rename from env/reports/Dockerfile rename to env/Dockerfile diff --git a/env/reports/environment.yml b/env/environment.yml similarity index 100% rename from env/reports/environment.yml rename to env/environment.yml diff --git a/env/st_spatial_de/environment.yml b/env/st_spatial_de/environment.yml deleted file mode 100644 index 28457d1..0000000 --- a/env/st_spatial_de/environment.yml +++ /dev/null @@ -1,13 +0,0 @@ -channels: - - conda-forge - - bioconda - - defaults -dependencies: - - quarto=1.3.353 - - jupyter=1.0.0 - - leidenalg=0.9.1 - - papermill=2.3.4 - - pip=23.0.1 - - scanpy=1.9.3 - - pip: - - SpatialDE==1.1.3 From 9539d6e80c8276d81019dddc1a72754b16e60ff4 Mon Sep 17 00:00:00 2001 From: Erik Fasterius Date: Fri, 1 Mar 2024 10:50:35 +0100 Subject: [PATCH 17/66] Update MultiQC module --- modules.json | 2 +- modules/nf-core/multiqc/environment.yml | 2 +- modules/nf-core/multiqc/main.nf | 4 ++-- modules/nf-core/multiqc/tests/main.nf.test.snap | 12 ++++++------ 4 files changed, 10 insertions(+), 10 deletions(-) diff --git a/modules.json b/modules.json index c114074..39ea71b 100644 --- a/modules.json +++ b/modules.json @@ -17,7 +17,7 @@ }, "multiqc": { "branch": "master", - "git_sha": "9e71d8519dfbfc328c078bba14d4bd4c99e39a94", + "git_sha": "b7ebe95761cd389603f9cc0e0dc384c0f663815a", "installed_by": ["modules"] }, "spaceranger/count": { diff --git a/modules/nf-core/multiqc/environment.yml b/modules/nf-core/multiqc/environment.yml index 7625b75..ca39fb6 100644 --- a/modules/nf-core/multiqc/environment.yml +++ b/modules/nf-core/multiqc/environment.yml @@ -4,4 +4,4 @@ channels: - bioconda - defaults dependencies: - - bioconda::multiqc=1.19 + - bioconda::multiqc=1.21 diff --git a/modules/nf-core/multiqc/main.nf b/modules/nf-core/multiqc/main.nf index 1b9f7c4..47ac352 100644 --- a/modules/nf-core/multiqc/main.nf +++ b/modules/nf-core/multiqc/main.nf @@ -3,8 +3,8 @@ process MULTIQC { conda "${moduleDir}/environment.yml" container "${ workflow.containerEngine == 'singularity' && !task.ext.singularity_pull_docker_container ? - 'https://depot.galaxyproject.org/singularity/multiqc:1.19--pyhdfd78af_0' : - 'biocontainers/multiqc:1.19--pyhdfd78af_0' }" + 'https://depot.galaxyproject.org/singularity/multiqc:1.21--pyhdfd78af_0' : + 'biocontainers/multiqc:1.21--pyhdfd78af_0' }" input: path multiqc_files, stageAs: "?/*" diff --git a/modules/nf-core/multiqc/tests/main.nf.test.snap b/modules/nf-core/multiqc/tests/main.nf.test.snap index 549ba79..bfebd80 100644 --- a/modules/nf-core/multiqc/tests/main.nf.test.snap +++ b/modules/nf-core/multiqc/tests/main.nf.test.snap @@ -2,14 +2,14 @@ "multiqc_versions_single": { "content": [ [ - "versions.yml:md5,14e9a2661241abd828f4f06a7b5c222d" + "versions.yml:md5,21f35ee29416b9b3073c28733efe4b7d" ] ], "meta": { "nf-test": "0.8.4", "nextflow": "23.10.1" }, - "timestamp": "2024-01-31T17:43:40.529579" + "timestamp": "2024-02-29T08:48:55.657331" }, "multiqc_stub": { "content": [ @@ -17,25 +17,25 @@ "multiqc_report.html", "multiqc_data", "multiqc_plots", - "versions.yml:md5,14e9a2661241abd828f4f06a7b5c222d" + "versions.yml:md5,21f35ee29416b9b3073c28733efe4b7d" ] ], "meta": { "nf-test": "0.8.4", "nextflow": "23.10.1" }, - "timestamp": "2024-01-31T17:45:09.605359" + "timestamp": "2024-02-29T08:49:49.071937" }, "multiqc_versions_config": { "content": [ [ - "versions.yml:md5,14e9a2661241abd828f4f06a7b5c222d" + "versions.yml:md5,21f35ee29416b9b3073c28733efe4b7d" ] ], "meta": { "nf-test": "0.8.4", "nextflow": "23.10.1" }, - "timestamp": "2024-01-31T17:44:53.535994" + "timestamp": "2024-02-29T08:49:25.457567" } } \ No newline at end of file From 1a42abfd81eb6d542cf89684862525fca795f756 Mon Sep 17 00:00:00 2001 From: Erik Fasterius Date: Fri, 1 Mar 2024 11:08:48 +0100 Subject: [PATCH 18/66] Use Space Ranger output for MultiQC --- workflows/spatialtranscriptomics.nf | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/workflows/spatialtranscriptomics.nf b/workflows/spatialtranscriptomics.nf index 37047b9..1afd25d 100644 --- a/workflows/spatialtranscriptomics.nf +++ b/workflows/spatialtranscriptomics.nf @@ -149,7 +149,8 @@ workflow ST { ch_multiqc_files = ch_workflow_summary.collectFile(name: 'workflow_summary_mqc.yaml').mix( ch_methods_description.collectFile(name: 'methods_description_mqc.yaml'), CUSTOM_DUMPSOFTWAREVERSIONS.out.mqc_yml.collect(), - FASTQC.out.zip.collect{ meta, qcfile -> qcfile } + FASTQC.out.zip.collect{ meta, qcfile -> qcfile }, + SPACERANGER.out.sr_dir.collect{ meta, sr_dir -> sr_dir }, ) MULTIQC ( From a09571330f5d4ecd8bdb313a14a5c5e1ff01b0f2 Mon Sep 17 00:00:00 2001 From: Erik Fasterius Date: Fri, 1 Mar 2024 11:17:24 +0100 Subject: [PATCH 19/66] Add missing MultiQC output documentation --- docs/output.md | 3 +++ 1 file changed, 3 insertions(+) diff --git a/docs/output.md b/docs/output.md index 23a88d8..b400143 100644 --- a/docs/output.md +++ b/docs/output.md @@ -122,6 +122,9 @@ details in the report itself. - Reports generated by the pipeline: `pipeline_report.html`, `pipeline_report.txt` and `software_versions.yml`. The `pipeline_report*` files will only be present if the `--email` / `--email_on_fail` parameter's are used when running the pipeline. - Reformatted samplesheet files used as input to the pipeline: `samplesheet.valid.csv`. - Parameters used by the pipeline run: `params.json`. +- `multiqc/` + - Report generated by MultiQC: `multiqc_report.html`. + - Data and plots generated by MultiQC: `multiqc_data/` and `multiqc_plots/`. From f8c28632e14291920d9d2d9aef23356b15b632de Mon Sep 17 00:00:00 2001 From: Erik Fasterius Date: Fri, 1 Mar 2024 11:19:43 +0100 Subject: [PATCH 20/66] Update changelog --- CHANGELOG.md | 1 + 1 file changed, 1 insertion(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index ee3eb02..56cc753 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -18,6 +18,7 @@ compatible with further downstream analyses and/or exploration in _e.g._ ### `Added` +- Add MultiQC support for Space Ranger outputs [[#70](https://github.com/nf-core/spatialtranscriptomics/pull/70)] - Add a custom nf-core Quarto template for the downstream analysis reports [[#64](https://github.com/nf-core/spatialtranscriptomics/pull/64)] - Allow input directories `fastq_dir` and `spaceranger_dir` to be specified as tar archives (`.tar.gz`) - Add a check to make sure that there are spots left after filtering [[#46](https://github.com/nf-core/spatialtranscriptomics/issues/46)] From 01eefccda58e4dde25497e61aa0ee35c833acc0d Mon Sep 17 00:00:00 2001 From: Christophe Avenel Date: Mon, 4 Mar 2024 15:39:54 +0100 Subject: [PATCH 21/66] Fix tables writing in SpatialData objects --- bin/st_clustering.qmd | 5 ++--- bin/st_quality_controls.qmd | 2 ++ 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/bin/st_clustering.qmd b/bin/st_clustering.qmd index eef9dfd..5c48926 100644 --- a/bin/st_clustering.qmd +++ b/bin/st_clustering.qmd @@ -171,8 +171,7 @@ sc.pl.spatial(st_adata, img_key="hires", color="clusters", size=1.25) ```{python} #| echo: false st_adata.write(output_adata_processed) -``` - -```{python} +del st_sdata.table +st_sdata.table = st_adata st_sdata.write("./" + output_sdata) ``` diff --git a/bin/st_quality_controls.qmd b/bin/st_quality_controls.qmd index ce3f0ce..0a23c03 100644 --- a/bin/st_quality_controls.qmd +++ b/bin/st_quality_controls.qmd @@ -279,6 +279,8 @@ sc.pl.violin(st_adata, ['pct_counts_mt', 'pct_counts_ribo', 'pct_counts_hb'], ``` ```{python} +del st_sdata.table +st_sdata.table = st_adata st_sdata.write("./" + output_sdata) ``` From d1bf3ecf5294dfe539853222a0e3693f4637e4b6 Mon Sep 17 00:00:00 2001 From: Christophe Avenel Date: Mon, 4 Mar 2024 15:40:19 +0100 Subject: [PATCH 22/66] Fix quarto formatting --- bin/st_quality_controls.qmd | 2 ++ 1 file changed, 2 insertions(+) diff --git a/bin/st_quality_controls.qmd b/bin/st_quality_controls.qmd index 0a23c03..5ab24d9 100644 --- a/bin/st_quality_controls.qmd +++ b/bin/st_quality_controls.qmd @@ -1,6 +1,8 @@ --- title: "nf-core/spatialtranscriptomics" subtitle: "Pre-processing and quality controls" +format: + nf-core-html: default jupyter: python3 --- From c606f176c3eeec3cccaef4fda7b6683c2d5599ff Mon Sep 17 00:00:00 2001 From: Christophe Avenel Date: Mon, 4 Mar 2024 15:40:50 +0100 Subject: [PATCH 23/66] Move from SpatialDE to Squidpy for SVG computation --- bin/{st_spatial_de.qmd => st_svg.qmd} | 60 +++++++++++-------- docs/output.md | 8 +-- env/reports/environment.yml | 1 + env/st_spatial_de/environment.yml | 19 ------ modules/local/{st_spatial_de.nf => st_svg.nf} | 18 +++--- subworkflows/local/st_downstream.nf | 15 +++-- tests/pipeline/test_downstream.nf.test | 8 +-- 7 files changed, 61 insertions(+), 68 deletions(-) rename bin/{st_spatial_de.qmd => st_svg.qmd} (68%) delete mode 100644 env/st_spatial_de/environment.yml rename modules/local/{st_spatial_de.nf => st_svg.nf} (64%) diff --git a/bin/st_spatial_de.qmd b/bin/st_svg.qmd similarity index 68% rename from bin/st_spatial_de.qmd rename to bin/st_svg.qmd index 44da8ef..1a648ff 100644 --- a/bin/st_spatial_de.qmd +++ b/bin/st_svg.qmd @@ -1,6 +1,6 @@ --- title: "nf-core/spatialtranscriptomics" -subtitle: "Differential gene expression" +subtitle: "Neighborhood enrichment analysis and Spatially variable genes" format: nf-core-html: default jupyter: python3 @@ -10,14 +10,16 @@ jupyter: python3 #| tags: [parameters] #| echo: false input_sdata = "st_sdata.zarr" -output_spatial_degs = "st_spatial_de.csv" +output_adata_svg = "st_adata_svg.h5ad" # Name of the output anndata file +output_sdata = "st_sdata_svg.zarr" # Name of the input anndata file +output_spatial_degs = "st_svg.csv" n_top_spatial_degs = 14 ``` ```{python} import scanpy as sc import pandas as pd -import SpatialDE +import squidpy as sq import numpy as np import spatialdata from anndata import AnnData @@ -88,40 +90,46 @@ height and width depends on the number of clusters as well as the number and intersection of the DEGs that are being plotted. ::: -# Spatial gene expression +# Neighborhood enrichment analysis -Spatial transcriptomics data can give insight into how genes are expressed in -different areas in a tissue, allowing identification of spatial gene expression -patterns. Here we use [SpatialDE](https://www.nature.com/articles/nmeth.4636) to -identify such patterns. +We can perform a neighborhood enrichment analysis to find out which +genes are enriched in the neighborhood of each cluster: ```{python} -#| output: false -results = SpatialDE.run(st_adata.obsm["spatial"], st_adata.to_df()) +sq.gr.spatial_neighbors(st_adata, coord_type="generic") +sq.gr.nhood_enrichment(st_adata, cluster_key="clusters") +sq.pl.nhood_enrichment(st_adata, cluster_key="clusters", method="ward", vmin=-100, vmax=100) ``` -We can then inspect the spatial DEGs in a table: +We visualize the interaction matrix between the different clusters: ```{python} -results.set_index("g", inplace=True) -# workaround for https://github.com/Teichlab/SpatialDE/issues/36 -results = results.loc[~results.index.duplicated(keep="first")] +sq.gr.interaction_matrix(st_adata, cluster_key="clusters") +sq.pl.interaction_matrix(st_adata, cluster_key="clusters", method="ward", vmax=20000) +``` -# Add annotations -st_adata.var = pd.concat([st_adata.var, results.loc[st_adata.var.index.values, :]], axis=1) +# Spatially variable genes with spatial autocorrelation statistics + +Spatial transcriptomics data can give insight into how genes are expressed in +different areas in a tissue, allowing identification of spatial gene expression +patterns. Here we use [Moran's I](https://en.wikipedia.org/wiki/Moran%27s_I) autocorrelation score to identify such patterns. -# Print results table -results_tab = st_adata.var.sort_values("qval", ascending=True) -results_tab.to_csv(output_spatial_degs) -results_tab.head(n_top_spatial_degs) +```{python} +st_adata.var_names_make_unique() +sq.gr.spatial_autocorr(st_adata, mode="moran") +st_adata.uns["moranI"].head(n_top_spatial_degs) +#[TODO] add gearyC as optional mode ``` -We can also plot the top spatially variable genes on top of the tissue image -itself to visualize the patterns: ```{python} -symbols = results_tab.iloc[: n_top_spatial_degs]["gene_symbol"] -plt.rcParams["figure.figsize"] = (3.5, 4) -sc.pl.spatial(st_adata, img_key="hires", color=symbols.index, alpha=0.7, - ncols=2, title=symbols, size=1.25) +#| echo: false +st_adata.write(output_adata_svg) +del st_sdata.table +st_sdata.table = st_adata +st_sdata.write("./" + output_sdata) ``` + +```{python} +st_adata.uns["moranI"].to_csv(output_spatial_degs) +``` \ No newline at end of file diff --git a/docs/output.md b/docs/output.md index 23a88d8..76cd4df 100644 --- a/docs/output.md +++ b/docs/output.md @@ -99,15 +99,15 @@ option; you can find more details in the report itself. Output files - `/reports/` - - `st_spatial_de.html`: HTML report. + - `st_svg.html`: HTML report. - `/degs/` - - `st_spatial_de.csv`: List of spatially differentially expressed genes. + - `st_svg.csv`: List of spatially variable genes. Report containing analyses related to differential expression testing and -spatially varying genes. The [SpatialDE](https://github.com/Teichlab/SpatialDE) -package is currently the only option for spatial testing; you can find more +spatially varying genes. The [Moran 1](https://en.wikipedia.org/wiki/Moran%27s_I) +score is currently the only option for spatial testing; you can find more details in the report itself. ## Workflow reporting diff --git a/env/reports/environment.yml b/env/reports/environment.yml index b7da2be..386e5ce 100644 --- a/env/reports/environment.yml +++ b/env/reports/environment.yml @@ -13,6 +13,7 @@ dependencies: - imagecodecs=2024.1.1 - pip: - scanpy==1.9.8 + - squidpy==1.4.1 - spatialdata==0.0.15 - spatialdata-io==0.0.9 - spatialdata-plot==0.1.0 diff --git a/env/st_spatial_de/environment.yml b/env/st_spatial_de/environment.yml deleted file mode 100644 index 984e420..0000000 --- a/env/st_spatial_de/environment.yml +++ /dev/null @@ -1,19 +0,0 @@ -channels: - - conda-forge - - bioconda -dependencies: - - python=3.10 - - jupyter=1.0.0 - - leidenalg=0.9.1 - - papermill=2.3.4 - - pip=23.0.1 - - gcc=13.2.0 - - libgdal=3.8.3 - - gxx=13.2.0 - - imagecodecs=2024.1.1 - - pip: - - scanpy==1.9.8 - - SpatialDE==1.1.3 - - spatialdata==0.0.15 - - spatialdata-io==0.0.9 - - spatialdata-plot==0.1.0 diff --git a/modules/local/st_spatial_de.nf b/modules/local/st_svg.nf similarity index 64% rename from modules/local/st_spatial_de.nf rename to modules/local/st_svg.nf index c02c0e0..41c75f0 100644 --- a/modules/local/st_spatial_de.nf +++ b/modules/local/st_svg.nf @@ -1,21 +1,21 @@ // // Spatial differential expression // -process ST_SPATIAL_DE { +process ST_SVG { // TODO: Update Conda directive when Quarto/Pandoc works on ARM64 tag "${meta.id}" label 'process_medium' - conda "env/st_spatial_de/environment.yml" + conda "env/ST_SVG/environment.yml" container "docker.io/cavenel/spatialtranscriptomics" // Exit if running this module with -profile conda / -profile mamba on ARM64 if (workflow.profile.tokenize(',').intersect(['conda', 'mamba']).size() >= 1) { architecture = System.getProperty("os.arch") if (architecture == "arm64" || architecture == "aarch64") { - exit 1, "The ST_SPATIAL_DE module does not support Conda on ARM64. Please use Docker / Singularity / Podman instead." + exit 1, "The ST_SVG module does not support Conda on ARM64. Please use Docker / Singularity / Podman instead." } } input: @@ -25,8 +25,10 @@ process ST_SPATIAL_DE { output: tuple val(meta), path("*.csv") , emit: degs - tuple val(meta), path("st_spatial_de.html"), emit: html - path("versions.yml") , emit: versions + tuple val(meta), path("st_adata_svg.h5ad"), emit: st_adata_svg + tuple val(meta), path("st_sdata_svg.zarr"), emit: st_sdata_svg + tuple val(meta), path("st_svg.html") , emit: html + path("versions.yml") , emit: versions when: task.ext.when == null || task.ext.when @@ -36,14 +38,16 @@ process ST_SPATIAL_DE { quarto render ${report} \ -P input_sdata:${st_sdata} \ -P n_top_spatial_degs:${params.st_n_top_spatial_degs} \ - -P output_spatial_degs:st_spatial_de.csv + -P output_spatial_degs:st_svg.csv \ + -P output_adata_processed:st_adata_svg.h5ad \ + -P output_sdata:st_sdata_svg.zarr cat <<-END_VERSIONS > versions.yml "${task.process}": quarto: \$(quarto -v) leidenalg: \$(python -c "import leidenalg; print(leidenalg.version)") scanpy: \$(python -c "import scanpy; print(scanpy.__version__)") - SpatialDE: \$(python -c "from importlib.metadata import version; print(version('SpatialDE'))") + squidpy: \$(python -c "import squidpy; print(squidpy.__version__)") END_VERSIONS """ } diff --git a/subworkflows/local/st_downstream.nf b/subworkflows/local/st_downstream.nf index 9bb64ea..8baaae5 100644 --- a/subworkflows/local/st_downstream.nf +++ b/subworkflows/local/st_downstream.nf @@ -3,7 +3,7 @@ // include { ST_QUALITY_CONTROLS } from '../../modules/local/st_quality_controls' -include { ST_SPATIAL_DE } from '../../modules/local/st_spatial_de' +include { ST_SVG } from '../../modules/local/st_svg' include { ST_CLUSTERING } from '../../modules/local/st_clustering' workflow ST_DOWNSTREAM { @@ -20,7 +20,7 @@ workflow ST_DOWNSTREAM { // report_quality_controls = file("${projectDir}/bin/st_quality_controls.qmd") report_clustering = file("${projectDir}/bin/st_clustering.qmd") - report_spatial_de = file("${projectDir}/bin/st_spatial_de.qmd") + report_svg = file("${projectDir}/bin/st_svg.qmd") report_template = Channel.fromPath("${projectDir}/assets/_extensions").collect() // @@ -46,21 +46,20 @@ workflow ST_DOWNSTREAM { // // Spatial differential expression // - ST_SPATIAL_DE ( - report_spatial_de, + ST_SVG ( + report_svg, report_template, ST_CLUSTERING.out.st_sdata_processed ) - ch_versions = ch_versions.mix(ST_SPATIAL_DE.out.versions) + ch_versions = ch_versions.mix(ST_SVG.out.versions) emit: html = ST_QUALITY_CONTROLS.out.html // channel: [ html ] - st_sdata_processed = ST_CLUSTERING.out.st_sdata_processed // channel: [ meta, h5ad] + st_sdata_svg = ST_SVG.out.st_sdata_svg // channel: [ meta, h5ad] html = ST_CLUSTERING.out.html // channel: [ html ] - degs = ST_SPATIAL_DE.out.degs // channel: [ meta, csv ] - html = ST_SPATIAL_DE.out.html // channel: [ html ] + html = ST_SVG.out.html // channel: [ html ] versions = ch_versions // channel: [ versions.yml ] } diff --git a/tests/pipeline/test_downstream.nf.test b/tests/pipeline/test_downstream.nf.test index dbfc38a..881516f 100644 --- a/tests/pipeline/test_downstream.nf.test +++ b/tests/pipeline/test_downstream.nf.test @@ -31,14 +31,14 @@ nextflow_pipeline { // Reports { assert file("$outputDir/CytAssist_11mm_FFPE_Human_Glioblastoma_2/reports/st_quality_controls.html").text.contains("final results of all the filtering") }, { assert file("$outputDir/CytAssist_11mm_FFPE_Human_Glioblastoma_2/reports/st_clustering.html").text.contains("spatial distribution of clusters") }, - { assert file("$outputDir/CytAssist_11mm_FFPE_Human_Glioblastoma_2/reports/st_spatial_de.html").text.contains("plot the top spatially variable genes") }, + { assert file("$outputDir/CytAssist_11mm_FFPE_Human_Glioblastoma_2/reports/st_svg.html").text.contains("plot the top spatially variable genes") }, { assert file("$outputDir/CytAssist_11mm_FFPE_Human_Glioblastoma_2.2/reports/st_quality_controls.html").text.contains("final results of all the filtering") }, { assert file("$outputDir/CytAssist_11mm_FFPE_Human_Glioblastoma_2.2/reports/st_clustering.html").text.contains("spatial distribution of clusters") }, - { assert file("$outputDir/CytAssist_11mm_FFPE_Human_Glioblastoma_2.2/reports/st_spatial_de.html").text.contains("plot the top spatially variable genes") }, + { assert file("$outputDir/CytAssist_11mm_FFPE_Human_Glioblastoma_2.2/reports/st_svg.html").text.contains("plot the top spatially variable genes") }, // DEGs - { assert file("$outputDir/CytAssist_11mm_FFPE_Human_Glioblastoma_2/degs/st_spatial_de.csv").exists() }, - { assert file("$outputDir/CytAssist_11mm_FFPE_Human_Glioblastoma_2.2/degs/st_spatial_de.csv").exists() }, + { assert file("$outputDir/CytAssist_11mm_FFPE_Human_Glioblastoma_2/degs/st_svg.csv").exists() }, + { assert file("$outputDir/CytAssist_11mm_FFPE_Human_Glioblastoma_2.2/degs/st_svg.csv").exists() }, // MultiQC { assert file("$outputDir/multiqc/multiqc_report.html").exists() } From 52e4c211164d0ad736b4ae620c7d1f5638acac31 Mon Sep 17 00:00:00 2001 From: Erik Fasterius Date: Tue, 5 Mar 2024 10:55:51 +0100 Subject: [PATCH 24/66] Add util-subworkflows and move most lib/ content --- lib/NfcoreTemplate.groovy | 356 -------------- lib/Utils.groovy | 40 -- lib/WorkflowMain.groovy | 65 --- lib/WorkflowSpatialtranscriptomics.groovy | 107 ----- lib/commons-csv-1.9.0.jar | Bin 51322 -> 0 bytes main.nf | 31 +- modules.json | 19 + .../main.nf | 264 +++++++++++ .../nf-core/utils_nextflow_pipeline/main.nf | 126 +++++ .../nf-core/utils_nextflow_pipeline/meta.yml | 38 ++ .../tests/main.function.nf.test | 54 +++ .../tests/main.function.nf.test.snap | 20 + .../tests/main.workflow.nf.test | 111 +++++ .../tests/nextflow.config | 9 + .../utils_nextflow_pipeline/tests/tags.yml | 2 + .../nf-core/utils_nfcore_pipeline/main.nf | 440 ++++++++++++++++++ .../nf-core/utils_nfcore_pipeline/meta.yml | 24 + .../tests/main.function.nf.test | 134 ++++++ .../tests/main.function.nf.test.snap | 166 +++++++ .../tests/main.workflow.nf.test | 29 ++ .../tests/main.workflow.nf.test.snap | 19 + .../tests/nextflow.config | 9 + .../utils_nfcore_pipeline/tests/tags.yml | 2 + .../nf-core/utils_nfvalidation_plugin/main.nf | 62 +++ .../utils_nfvalidation_plugin/meta.yml | 44 ++ .../tests/main.nf.test | 200 ++++++++ .../tests/nextflow_schema.json | 96 ++++ .../utils_nfvalidation_plugin/tests/tags.yml | 2 + 28 files changed, 1875 insertions(+), 594 deletions(-) delete mode 100755 lib/NfcoreTemplate.groovy delete mode 100755 lib/WorkflowMain.groovy delete mode 100755 lib/WorkflowSpatialtranscriptomics.groovy delete mode 100644 lib/commons-csv-1.9.0.jar create mode 100644 subworkflows/local/utils_nfcore_spatialtranscriptomics_pipeline/main.nf create mode 100644 subworkflows/nf-core/utils_nextflow_pipeline/main.nf create mode 100644 subworkflows/nf-core/utils_nextflow_pipeline/meta.yml create mode 100644 subworkflows/nf-core/utils_nextflow_pipeline/tests/main.function.nf.test create mode 100644 subworkflows/nf-core/utils_nextflow_pipeline/tests/main.function.nf.test.snap create mode 100644 subworkflows/nf-core/utils_nextflow_pipeline/tests/main.workflow.nf.test create mode 100644 subworkflows/nf-core/utils_nextflow_pipeline/tests/nextflow.config create mode 100644 subworkflows/nf-core/utils_nextflow_pipeline/tests/tags.yml create mode 100644 subworkflows/nf-core/utils_nfcore_pipeline/main.nf create mode 100644 subworkflows/nf-core/utils_nfcore_pipeline/meta.yml create mode 100644 subworkflows/nf-core/utils_nfcore_pipeline/tests/main.function.nf.test create mode 100644 subworkflows/nf-core/utils_nfcore_pipeline/tests/main.function.nf.test.snap create mode 100644 subworkflows/nf-core/utils_nfcore_pipeline/tests/main.workflow.nf.test create mode 100644 subworkflows/nf-core/utils_nfcore_pipeline/tests/main.workflow.nf.test.snap create mode 100644 subworkflows/nf-core/utils_nfcore_pipeline/tests/nextflow.config create mode 100644 subworkflows/nf-core/utils_nfcore_pipeline/tests/tags.yml create mode 100644 subworkflows/nf-core/utils_nfvalidation_plugin/main.nf create mode 100644 subworkflows/nf-core/utils_nfvalidation_plugin/meta.yml create mode 100644 subworkflows/nf-core/utils_nfvalidation_plugin/tests/main.nf.test create mode 100644 subworkflows/nf-core/utils_nfvalidation_plugin/tests/nextflow_schema.json create mode 100644 subworkflows/nf-core/utils_nfvalidation_plugin/tests/tags.yml diff --git a/lib/NfcoreTemplate.groovy b/lib/NfcoreTemplate.groovy deleted file mode 100755 index e248e4c..0000000 --- a/lib/NfcoreTemplate.groovy +++ /dev/null @@ -1,356 +0,0 @@ -// -// This file holds several functions used within the nf-core pipeline template. -// - -import org.yaml.snakeyaml.Yaml -import groovy.json.JsonOutput -import nextflow.extension.FilesEx - -class NfcoreTemplate { - - // - // Check AWS Batch related parameters have been specified correctly - // - public static void awsBatch(workflow, params) { - if (workflow.profile.contains('awsbatch')) { - // Check params.awsqueue and params.awsregion have been set if running on AWSBatch - assert (params.awsqueue && params.awsregion) : "Specify correct --awsqueue and --awsregion parameters on AWSBatch!" - // Check outdir paths to be S3 buckets if running on AWSBatch - assert params.outdir.startsWith('s3:') : "Outdir not on S3 - specify S3 Bucket to run on AWSBatch!" - } - } - - // - // Warn if a -profile or Nextflow config has not been provided to run the pipeline - // - public static void checkConfigProvided(workflow, log) { - if (workflow.profile == 'standard' && workflow.configFiles.size() <= 1) { - log.warn "[$workflow.manifest.name] You are attempting to run the pipeline without any custom configuration!\n\n" + - "This will be dependent on your local compute environment but can be achieved via one or more of the following:\n" + - " (1) Using an existing pipeline profile e.g. `-profile docker` or `-profile singularity`\n" + - " (2) Using an existing nf-core/configs for your Institution e.g. `-profile crick` or `-profile uppmax`\n" + - " (3) Using your own local custom config e.g. `-c /path/to/your/custom.config`\n\n" + - "Please refer to the quick start section and usage docs for the pipeline.\n " - } - } - - // - // Generate version string - // - public static String version(workflow) { - String version_string = "" - - if (workflow.manifest.version) { - def prefix_v = workflow.manifest.version[0] != 'v' ? 'v' : '' - version_string += "${prefix_v}${workflow.manifest.version}" - } - - if (workflow.commitId) { - def git_shortsha = workflow.commitId.substring(0, 7) - version_string += "-g${git_shortsha}" - } - - return version_string - } - - // - // Construct and send completion email - // - public static void email(workflow, params, summary_params, projectDir, log, multiqc_report=[]) { - - // Set up the e-mail variables - def subject = "[$workflow.manifest.name] Successful: $workflow.runName" - if (!workflow.success) { - subject = "[$workflow.manifest.name] FAILED: $workflow.runName" - } - - def summary = [:] - for (group in summary_params.keySet()) { - summary << summary_params[group] - } - - def misc_fields = [:] - misc_fields['Date Started'] = workflow.start - misc_fields['Date Completed'] = workflow.complete - misc_fields['Pipeline script file path'] = workflow.scriptFile - misc_fields['Pipeline script hash ID'] = workflow.scriptId - if (workflow.repository) misc_fields['Pipeline repository Git URL'] = workflow.repository - if (workflow.commitId) misc_fields['Pipeline repository Git Commit'] = workflow.commitId - if (workflow.revision) misc_fields['Pipeline Git branch/tag'] = workflow.revision - misc_fields['Nextflow Version'] = workflow.nextflow.version - misc_fields['Nextflow Build'] = workflow.nextflow.build - misc_fields['Nextflow Compile Timestamp'] = workflow.nextflow.timestamp - - def email_fields = [:] - email_fields['version'] = NfcoreTemplate.version(workflow) - email_fields['runName'] = workflow.runName - email_fields['success'] = workflow.success - email_fields['dateComplete'] = workflow.complete - email_fields['duration'] = workflow.duration - email_fields['exitStatus'] = workflow.exitStatus - email_fields['errorMessage'] = (workflow.errorMessage ?: 'None') - email_fields['errorReport'] = (workflow.errorReport ?: 'None') - email_fields['commandLine'] = workflow.commandLine - email_fields['projectDir'] = workflow.projectDir - email_fields['summary'] = summary << misc_fields - - // On success try attach the multiqc report - def mqc_report = null - try { - if (workflow.success) { - mqc_report = multiqc_report.getVal() - if (mqc_report.getClass() == ArrayList && mqc_report.size() >= 1) { - if (mqc_report.size() > 1) { - log.warn "[$workflow.manifest.name] Found multiple reports from process 'MULTIQC', will use only one" - } - mqc_report = mqc_report[0] - } - } - } catch (all) { - if (multiqc_report) { - log.warn "[$workflow.manifest.name] Could not attach MultiQC report to summary email" - } - } - - // Check if we are only sending emails on failure - def email_address = params.email - if (!params.email && params.email_on_fail && !workflow.success) { - email_address = params.email_on_fail - } - - // Render the TXT template - def engine = new groovy.text.GStringTemplateEngine() - def tf = new File("$projectDir/assets/email_template.txt") - def txt_template = engine.createTemplate(tf).make(email_fields) - def email_txt = txt_template.toString() - - // Render the HTML template - def hf = new File("$projectDir/assets/email_template.html") - def html_template = engine.createTemplate(hf).make(email_fields) - def email_html = html_template.toString() - - // Render the sendmail template - def max_multiqc_email_size = (params.containsKey('max_multiqc_email_size') ? params.max_multiqc_email_size : 0) as nextflow.util.MemoryUnit - def smail_fields = [ email: email_address, subject: subject, email_txt: email_txt, email_html: email_html, projectDir: "$projectDir", mqcFile: mqc_report, mqcMaxSize: max_multiqc_email_size.toBytes() ] - def sf = new File("$projectDir/assets/sendmail_template.txt") - def sendmail_template = engine.createTemplate(sf).make(smail_fields) - def sendmail_html = sendmail_template.toString() - - // Send the HTML e-mail - Map colors = logColours(params.monochrome_logs) - if (email_address) { - try { - if (params.plaintext_email) { throw GroovyException('Send plaintext e-mail, not HTML') } - // Try to send HTML e-mail using sendmail - def sendmail_tf = new File(workflow.launchDir.toString(), ".sendmail_tmp.html") - sendmail_tf.withWriter { w -> w << sendmail_html } - [ 'sendmail', '-t' ].execute() << sendmail_html - log.info "-${colors.purple}[$workflow.manifest.name]${colors.green} Sent summary e-mail to $email_address (sendmail)-" - } catch (all) { - // Catch failures and try with plaintext - def mail_cmd = [ 'mail', '-s', subject, '--content-type=text/html', email_address ] - if ( mqc_report != null && mqc_report.size() <= max_multiqc_email_size.toBytes() ) { - mail_cmd += [ '-A', mqc_report ] - } - mail_cmd.execute() << email_html - log.info "-${colors.purple}[$workflow.manifest.name]${colors.green} Sent summary e-mail to $email_address (mail)-" - } - } - - // Write summary e-mail HTML to a file - def output_hf = new File(workflow.launchDir.toString(), ".pipeline_report.html") - output_hf.withWriter { w -> w << email_html } - FilesEx.copyTo(output_hf.toPath(), "${params.outdir}/pipeline_info/pipeline_report.html"); - output_hf.delete() - - // Write summary e-mail TXT to a file - def output_tf = new File(workflow.launchDir.toString(), ".pipeline_report.txt") - output_tf.withWriter { w -> w << email_txt } - FilesEx.copyTo(output_tf.toPath(), "${params.outdir}/pipeline_info/pipeline_report.txt"); - output_tf.delete() - } - - // - // Construct and send a notification to a web server as JSON - // e.g. Microsoft Teams and Slack - // - public static void IM_notification(workflow, params, summary_params, projectDir, log) { - def hook_url = params.hook_url - - def summary = [:] - for (group in summary_params.keySet()) { - summary << summary_params[group] - } - - def misc_fields = [:] - misc_fields['start'] = workflow.start - misc_fields['complete'] = workflow.complete - misc_fields['scriptfile'] = workflow.scriptFile - misc_fields['scriptid'] = workflow.scriptId - if (workflow.repository) misc_fields['repository'] = workflow.repository - if (workflow.commitId) misc_fields['commitid'] = workflow.commitId - if (workflow.revision) misc_fields['revision'] = workflow.revision - misc_fields['nxf_version'] = workflow.nextflow.version - misc_fields['nxf_build'] = workflow.nextflow.build - misc_fields['nxf_timestamp'] = workflow.nextflow.timestamp - - def msg_fields = [:] - msg_fields['version'] = NfcoreTemplate.version(workflow) - msg_fields['runName'] = workflow.runName - msg_fields['success'] = workflow.success - msg_fields['dateComplete'] = workflow.complete - msg_fields['duration'] = workflow.duration - msg_fields['exitStatus'] = workflow.exitStatus - msg_fields['errorMessage'] = (workflow.errorMessage ?: 'None') - msg_fields['errorReport'] = (workflow.errorReport ?: 'None') - msg_fields['commandLine'] = workflow.commandLine.replaceFirst(/ +--hook_url +[^ ]+/, "") - msg_fields['projectDir'] = workflow.projectDir - msg_fields['summary'] = summary << misc_fields - - // Render the JSON template - def engine = new groovy.text.GStringTemplateEngine() - // Different JSON depending on the service provider - // Defaults to "Adaptive Cards" (https://adaptivecards.io), except Slack which has its own format - def json_path = hook_url.contains("hooks.slack.com") ? "slackreport.json" : "adaptivecard.json" - def hf = new File("$projectDir/assets/${json_path}") - def json_template = engine.createTemplate(hf).make(msg_fields) - def json_message = json_template.toString() - - // POST - def post = new URL(hook_url).openConnection(); - post.setRequestMethod("POST") - post.setDoOutput(true) - post.setRequestProperty("Content-Type", "application/json") - post.getOutputStream().write(json_message.getBytes("UTF-8")); - def postRC = post.getResponseCode(); - if (! postRC.equals(200)) { - log.warn(post.getErrorStream().getText()); - } - } - - // - // Dump pipeline parameters in a json file - // - public static void dump_parameters(workflow, params) { - def timestamp = new java.util.Date().format( 'yyyy-MM-dd_HH-mm-ss') - def filename = "params_${timestamp}.json" - def temp_pf = new File(workflow.launchDir.toString(), ".${filename}") - def jsonStr = JsonOutput.toJson(params) - temp_pf.text = JsonOutput.prettyPrint(jsonStr) - - FilesEx.copyTo(temp_pf.toPath(), "${params.outdir}/pipeline_info/params_${timestamp}.json") - temp_pf.delete() - } - - // - // Print pipeline summary on completion - // - public static void summary(workflow, params, log) { - Map colors = logColours(params.monochrome_logs) - if (workflow.success) { - if (workflow.stats.ignoredCount == 0) { - log.info "-${colors.purple}[$workflow.manifest.name]${colors.green} Pipeline completed successfully${colors.reset}-" - } else { - log.info "-${colors.purple}[$workflow.manifest.name]${colors.yellow} Pipeline completed successfully, but with errored process(es) ${colors.reset}-" - } - } else { - log.info "-${colors.purple}[$workflow.manifest.name]${colors.red} Pipeline completed with errors${colors.reset}-" - } - } - - // - // ANSII Colours used for terminal logging - // - public static Map logColours(Boolean monochrome_logs) { - Map colorcodes = [:] - - // Reset / Meta - colorcodes['reset'] = monochrome_logs ? '' : "\033[0m" - colorcodes['bold'] = monochrome_logs ? '' : "\033[1m" - colorcodes['dim'] = monochrome_logs ? '' : "\033[2m" - colorcodes['underlined'] = monochrome_logs ? '' : "\033[4m" - colorcodes['blink'] = monochrome_logs ? '' : "\033[5m" - colorcodes['reverse'] = monochrome_logs ? '' : "\033[7m" - colorcodes['hidden'] = monochrome_logs ? '' : "\033[8m" - - // Regular Colors - colorcodes['black'] = monochrome_logs ? '' : "\033[0;30m" - colorcodes['red'] = monochrome_logs ? '' : "\033[0;31m" - colorcodes['green'] = monochrome_logs ? '' : "\033[0;32m" - colorcodes['yellow'] = monochrome_logs ? '' : "\033[0;33m" - colorcodes['blue'] = monochrome_logs ? '' : "\033[0;34m" - colorcodes['purple'] = monochrome_logs ? '' : "\033[0;35m" - colorcodes['cyan'] = monochrome_logs ? '' : "\033[0;36m" - colorcodes['white'] = monochrome_logs ? '' : "\033[0;37m" - - // Bold - colorcodes['bblack'] = monochrome_logs ? '' : "\033[1;30m" - colorcodes['bred'] = monochrome_logs ? '' : "\033[1;31m" - colorcodes['bgreen'] = monochrome_logs ? '' : "\033[1;32m" - colorcodes['byellow'] = monochrome_logs ? '' : "\033[1;33m" - colorcodes['bblue'] = monochrome_logs ? '' : "\033[1;34m" - colorcodes['bpurple'] = monochrome_logs ? '' : "\033[1;35m" - colorcodes['bcyan'] = monochrome_logs ? '' : "\033[1;36m" - colorcodes['bwhite'] = monochrome_logs ? '' : "\033[1;37m" - - // Underline - colorcodes['ublack'] = monochrome_logs ? '' : "\033[4;30m" - colorcodes['ured'] = monochrome_logs ? '' : "\033[4;31m" - colorcodes['ugreen'] = monochrome_logs ? '' : "\033[4;32m" - colorcodes['uyellow'] = monochrome_logs ? '' : "\033[4;33m" - colorcodes['ublue'] = monochrome_logs ? '' : "\033[4;34m" - colorcodes['upurple'] = monochrome_logs ? '' : "\033[4;35m" - colorcodes['ucyan'] = monochrome_logs ? '' : "\033[4;36m" - colorcodes['uwhite'] = monochrome_logs ? '' : "\033[4;37m" - - // High Intensity - colorcodes['iblack'] = monochrome_logs ? '' : "\033[0;90m" - colorcodes['ired'] = monochrome_logs ? '' : "\033[0;91m" - colorcodes['igreen'] = monochrome_logs ? '' : "\033[0;92m" - colorcodes['iyellow'] = monochrome_logs ? '' : "\033[0;93m" - colorcodes['iblue'] = monochrome_logs ? '' : "\033[0;94m" - colorcodes['ipurple'] = monochrome_logs ? '' : "\033[0;95m" - colorcodes['icyan'] = monochrome_logs ? '' : "\033[0;96m" - colorcodes['iwhite'] = monochrome_logs ? '' : "\033[0;97m" - - // Bold High Intensity - colorcodes['biblack'] = monochrome_logs ? '' : "\033[1;90m" - colorcodes['bired'] = monochrome_logs ? '' : "\033[1;91m" - colorcodes['bigreen'] = monochrome_logs ? '' : "\033[1;92m" - colorcodes['biyellow'] = monochrome_logs ? '' : "\033[1;93m" - colorcodes['biblue'] = monochrome_logs ? '' : "\033[1;94m" - colorcodes['bipurple'] = monochrome_logs ? '' : "\033[1;95m" - colorcodes['bicyan'] = monochrome_logs ? '' : "\033[1;96m" - colorcodes['biwhite'] = monochrome_logs ? '' : "\033[1;97m" - - return colorcodes - } - - // - // Does what is says on the tin - // - public static String dashedLine(monochrome_logs) { - Map colors = logColours(monochrome_logs) - return "-${colors.dim}----------------------------------------------------${colors.reset}-" - } - - // - // nf-core logo - // - public static String logo(workflow, monochrome_logs) { - Map colors = logColours(monochrome_logs) - String workflow_version = NfcoreTemplate.version(workflow) - String.format( - """\n - ${dashedLine(monochrome_logs)} - ${colors.green},--.${colors.black}/${colors.green},-.${colors.reset} - ${colors.blue} ___ __ __ __ ___ ${colors.green}/,-._.--~\'${colors.reset} - ${colors.blue} |\\ | |__ __ / ` / \\ |__) |__ ${colors.yellow}} {${colors.reset} - ${colors.blue} | \\| | \\__, \\__/ | \\ |___ ${colors.green}\\`-._,-`-,${colors.reset} - ${colors.green}`._,._,\'${colors.reset} - ${colors.purple} ${workflow.manifest.name} ${workflow_version}${colors.reset} - ${dashedLine(monochrome_logs)} - """.stripIndent() - ) - } -} diff --git a/lib/Utils.groovy b/lib/Utils.groovy index 9d9d635..1150d58 100644 --- a/lib/Utils.groovy +++ b/lib/Utils.groovy @@ -2,8 +2,6 @@ // This file holds several Groovy functions that could be useful for any Nextflow pipeline // -import org.yaml.snakeyaml.Yaml - class Utils { public static List DOWNSTREAM_REQUIRED_SPACERANGER_FILES = [ @@ -14,42 +12,4 @@ class Utils { "tissue_lowres_image.png" ] - // - // When running with -profile conda, warn if channels have not been set-up appropriately - // - public static void checkCondaChannels(log) { - Yaml parser = new Yaml() - def channels = [] - try { - def config = parser.load("conda config --show channels".execute().text) - channels = config.channels - } catch(NullPointerException | IOException e) { - log.warn "Could not verify conda channel configuration." - return - } - - // Check that all channels are present - // This channel list is ordered by required channel priority. - def required_channels_in_order = ['conda-forge', 'bioconda', 'defaults'] - def channels_missing = ((required_channels_in_order as Set) - (channels as Set)) as Boolean - - // Check that they are in the right order - def channel_priority_violation = false - def n = required_channels_in_order.size() - for (int i = 0; i < n - 1; i++) { - channel_priority_violation |= !(channels.indexOf(required_channels_in_order[i]) < channels.indexOf(required_channels_in_order[i+1])) - } - - if (channels_missing | channel_priority_violation) { - log.warn "~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~\n" + - " There is a problem with your Conda configuration!\n\n" + - " You will need to set-up the conda-forge and bioconda channels correctly.\n" + - " Please refer to https://bioconda.github.io/\n" + - " The observed channel order is \n" + - " ${channels}\n" + - " but the following channel order is required:\n" + - " ${required_channels_in_order}\n" + - "~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~" - } - } } diff --git a/lib/WorkflowMain.groovy b/lib/WorkflowMain.groovy deleted file mode 100755 index 85469a7..0000000 --- a/lib/WorkflowMain.groovy +++ /dev/null @@ -1,65 +0,0 @@ -// -// This file holds several functions specific to the main.nf workflow in the nf-core/spatialtranscriptomics pipeline -// - -import nextflow.Nextflow - -class WorkflowMain { - - // - // Citation string for pipeline - // - public static String citation(workflow) { - return "If you use ${workflow.manifest.name} for your analysis please cite:\n\n" + - // TODO nf-core: Add Zenodo DOI for pipeline after first release - //"* The pipeline\n" + - //" https://doi.org/10.5281/zenodo.XXXXXXX\n\n" + - "* The nf-core framework\n" + - " https://doi.org/10.1038/s41587-020-0439-x\n\n" + - "* Software dependencies\n" + - " https://github.com/${workflow.manifest.name}/blob/master/CITATIONS.md" - } - - // - // Validate parameters and print summary to screen - // - public static void initialise(workflow, params, log, args) { - - // Print workflow version and exit on --version - if (params.version) { - String workflow_version = NfcoreTemplate.version(workflow) - log.info "${workflow.manifest.name} ${workflow_version}" - System.exit(0) - } - - // Check that a -profile or Nextflow config has been provided to run the pipeline - NfcoreTemplate.checkConfigProvided(workflow, log) - // Check that the profile doesn't contain spaces and doesn't end with a trailing comma - checkProfile(workflow.profile, args, log) - - // Check that conda channels are set-up correctly - if (workflow.profile.tokenize(',').intersect(['conda', 'mamba']).size() >= 1) { - Utils.checkCondaChannels(log) - } - - // Check AWS batch settings - NfcoreTemplate.awsBatch(workflow, params) - - // Check input has been provided - if (!params.input) { - Nextflow.error("Please provide an input samplesheet to the pipeline e.g. '--input samplesheet.csv'") - } - } - - // - // Exit pipeline if --profile contains spaces - // - private static void checkProfile(profile, args, log) { - if (profile.endsWith(',')) { - Nextflow.error "Profile cannot end with a trailing comma. Please remove the comma from the end of the profile string.\nHint: A common mistake is to provide multiple values to `-profile` separated by spaces. Please use commas to separate profiles instead,e.g., `-profile docker,test`." - } - if (args[0]) { - log.warn "nf-core pipelines do not accept positional arguments. The positional argument `${args[0]}` has been detected.\n Hint: A common mistake is to provide multiple values to `-profile` separated by spaces. Please use commas to separate profiles instead,e.g., `-profile docker,test`." - } - } -} diff --git a/lib/WorkflowSpatialtranscriptomics.groovy b/lib/WorkflowSpatialtranscriptomics.groovy deleted file mode 100755 index 99fb1ad..0000000 --- a/lib/WorkflowSpatialtranscriptomics.groovy +++ /dev/null @@ -1,107 +0,0 @@ -// -// This file holds several functions specific to the workflow/spatialtranscriptomics.nf in the nf-core/spatialtranscriptomics pipeline -// - -import nextflow.Nextflow -import groovy.text.SimpleTemplateEngine - -class WorkflowSpatialtranscriptomics { - - // - // Check and validate parameters - // - public static void initialise(params, log) { - - // if (!params.fasta) { - // Nextflow.error "Genome fasta file not specified with e.g. '--fasta genome.fa' or via a detectable config file." - // } - } - - // - // Get workflow summary for MultiQC - // - public static String paramsSummaryMultiqc(workflow, summary) { - String summary_section = '' - for (group in summary.keySet()) { - def group_params = summary.get(group) // This gets the parameters of that particular group - if (group_params) { - summary_section += "

    $group

    \n" - summary_section += "
    \n" - for (param in group_params.keySet()) { - summary_section += "
    $param
    ${group_params.get(param) ?: 'N/A'}
    \n" - } - summary_section += "
    \n" - } - } - - String yaml_file_text = "id: '${workflow.manifest.name.replace('/','-')}-summary'\n" - yaml_file_text += "description: ' - this information is collected when the pipeline is started.'\n" - yaml_file_text += "section_name: '${workflow.manifest.name} Workflow Summary'\n" - yaml_file_text += "section_href: 'https://github.com/${workflow.manifest.name}'\n" - yaml_file_text += "plot_type: 'html'\n" - yaml_file_text += "data: |\n" - yaml_file_text += "${summary_section}" - return yaml_file_text - } - - // - // Generate methods description for MultiQC - // - - public static String toolCitationText(params) { - - def citation_text = [ - "Tools used in the workflow included:", - "AnnData (Virshup et al. 2021),", - "FastQC (Andrews 2010),", - "MultiQC (Ewels et al. 2016),", - "Quarto (Allaire et al. 2022),", - "Scanpy (Wolf et al. 2018),", - "Space Ranger (10x Genomics) and", - "SpatialDE (Svensson et al. 2018)." - ].join(' ').trim() - - return citation_text - } - - public static String toolBibliographyText(params) { - - def reference_text = [ - "
  • Virshup I, Rybakov S, Theis FJ, Angerer P, Wolf FA. bioRxiv 2021.12.16.473007; doi: 10.1101/2021.12.16.473007
  • ", - "
  • Andrews S, (2010) FastQC, URL: bioinformatics.babraham.ac.uk.
  • ", - "
  • Ewels, P., Magnusson, M., Lundin, S., & Käller, M. (2016). MultiQC: summarize analysis results for multiple tools and samples in a single report. Bioinformatics , 32(19), 3047–3048. doi: 10.1093/bioinformatics/btw354
  • ", - "
  • Allaire J, Teague C, Scheidegger C, Xie Y, Dervieux C. Quarto (2022). doi: 10.5281/zenodo.5960048
  • ", - "
  • Wolf F, Angerer P, Theis F. SCANPY: large-scale single-cell gene expression data analysis. Genome Biol 19, 15 (2018). doi: 10.1186/s13059-017-1382-0
  • ", - "
  • 10x Genomics Space Ranger 2.1.0, URL: 10xgenomics.com/support/software/space-ranger
  • ", - "
  • Svensson V, Teichmann S, Stegle O. SpatialDE: identification of spatially variable genes. Nat Methods 15, 343–346 (2018). doi: 10.1038/nmeth.4636
  • ", - ].join(' ').trim() - - return reference_text - } - - public static String methodsDescriptionText(run_workflow, mqc_methods_yaml, params) { - // Convert to a named map so can be used as with familar NXF ${workflow} variable syntax in the MultiQC YML file - def meta = [:] - meta.workflow = run_workflow.toMap() - meta["manifest_map"] = run_workflow.manifest.toMap() - - // Pipeline DOI - meta["doi_text"] = meta.manifest_map.doi ? "(doi: ${meta.manifest_map.doi})" : "" - meta["nodoi_text"] = meta.manifest_map.doi ? "": "
  • If available, make sure to update the text to include the Zenodo DOI of version of the pipeline used.
  • " - - // Tool references - meta["tool_citations"] = "" - meta["tool_bibliography"] = "" - meta["tool_citations"] = toolCitationText(params).replaceAll(", \\.", ".").replaceAll("\\. \\.", ".").replaceAll(", \\.", ".") - meta["tool_bibliography"] = toolBibliographyText(params) - - - def methods_text = mqc_methods_yaml.text - - def engine = new SimpleTemplateEngine() - def description_html = engine.createTemplate(methods_text).make(meta) - - return description_html - } - -} diff --git a/lib/commons-csv-1.9.0.jar b/lib/commons-csv-1.9.0.jar deleted file mode 100644 index 0e3f67850c92980c43db49464317cc11e49bf099..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 51322 zcma&N1CS;`)TZ0EZQFMDv~AnAZQIkfZEM=L?XPWjPvg$N`|ob-y?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+Q#9^L~%{_>)&z_+NRyMS%Ry{M{x0 zC)1$hzcPP!(Ekqo-68rX^h^2QL;thl|L&stllM^hZ+`{sKX4>AtN;K2 diff --git a/main.nf b/main.nf index ae2df75..f65d684 100644 --- a/main.nf +++ b/main.nf @@ -11,30 +11,15 @@ nextflow.enable.dsl = 2 - /* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - VALIDATE & PRINT PARAMETER SUMMARY + IMPORT FUNCTIONS / MODULES / SUBWORKFLOWS / WORKFLOWS ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ */ -include { validateParameters; paramsHelp } from 'plugin/nf-validation' - -// Print help message if needed -if (params.help) { - def logo = NfcoreTemplate.logo(workflow, params.monochrome_logs) - def citation = '\n' + WorkflowMain.citation(workflow) + '\n' - def String command = "nextflow run ${workflow.manifest.name} --input samplesheet.csv --genome GRCh37 -profile docker" - log.info logo + paramsHelp(command) + citation + NfcoreTemplate.dashedLine(params.monochrome_logs) - System.exit(0) -} - -// Validate input parameters -if (params.validate_params) { - validateParameters() -} - -WorkflowMain.initialise(workflow, params, log, args) +include { ST } from './workflows/spatialtranscriptomics' +include { PIPELINE_INITIALISATION } from './subworkflows/local/utils_nfcore_rnaseq_pipeline' +include { PIPELINE_COMPLETION } from './subworkflows/local/utils_nfcore_rnaseq_pipeline' /* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ @@ -42,8 +27,6 @@ WorkflowMain.initialise(workflow, params, log, args) ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ */ -include { ST } from './workflows/spatialtranscriptomics' - // // WORKFLOW: Run main nf-core/spatialtranscriptomics analysis pipeline // @@ -53,14 +36,10 @@ workflow NFCORE_SPATIALTRANSCRIPTOMICS { /* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - RUN ALL WORKFLOWS + RUN MAIN WORKFLOW ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ */ -// -// WORKFLOW: Execute a single named workflow for the pipeline -// See: https://github.com/nf-core/rnaseq/issues/619 -// workflow { NFCORE_SPATIALTRANSCRIPTOMICS () } diff --git a/modules.json b/modules.json index c114074..3e848ba 100644 --- a/modules.json +++ b/modules.json @@ -31,6 +31,25 @@ "installed_by": ["modules"] } } + }, + "subworkflows": { + "nf-core": { + "utils_nextflow_pipeline": { + "branch": "master", + "git_sha": "5caf7640a9ef1d18d765d55339be751bb0969dfa", + "installed_by": ["subworkflows"] + }, + "utils_nfcore_pipeline": { + "branch": "master", + "git_sha": "5caf7640a9ef1d18d765d55339be751bb0969dfa", + "installed_by": ["subworkflows"] + }, + "utils_nfvalidation_plugin": { + "branch": "master", + "git_sha": "5caf7640a9ef1d18d765d55339be751bb0969dfa", + "installed_by": ["subworkflows"] + } + } } } } diff --git a/subworkflows/local/utils_nfcore_spatialtranscriptomics_pipeline/main.nf b/subworkflows/local/utils_nfcore_spatialtranscriptomics_pipeline/main.nf new file mode 100644 index 0000000..d7ca091 --- /dev/null +++ b/subworkflows/local/utils_nfcore_spatialtranscriptomics_pipeline/main.nf @@ -0,0 +1,264 @@ +// +// Subworkflow with functionality specific to the {{ name }} pipeline +// + +/* +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + IMPORT FUNCTIONS / MODULES / SUBWORKFLOWS +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +*/ + +include { UTILS_NFVALIDATION_PLUGIN } from '../../nf-core/utils_nfvalidation_plugin' +include { paramsSummaryMap } from 'plugin/nf-validation' +include { fromSamplesheet } from 'plugin/nf-validation' +include { UTILS_NEXTFLOW_PIPELINE } from '../../nf-core/utils_nextflow_pipeline' +include { completionEmail } from '../../nf-core/utils_nfcore_pipeline' +include { completionSummary } from '../../nf-core/utils_nfcore_pipeline' +include { dashedLine } from '../../nf-core/utils_nfcore_pipeline' +include { nfCoreLogo } from '../../nf-core/utils_nfcore_pipeline' +include { imNotification } from '../../nf-core/utils_nfcore_pipeline' +include { UTILS_NFCORE_PIPELINE } from '../../nf-core/utils_nfcore_pipeline' +include { workflowCitation } from '../../nf-core/utils_nfcore_pipeline' + +/* +======================================================================================== + SUBWORKFLOW TO INITIALISE PIPELINE +======================================================================================== +*/ + +workflow PIPELINE_INITIALISATION { + + take: + version // boolean: Display version and exit + help // boolean: Display help text + validate_params // boolean: Boolean whether to validate parameters against the schema at runtime + monochrome_logs // boolean: Do not use coloured log outputs + nextflow_cli_args // array: List of positional nextflow CLI args + outdir // string: The output directory where the results will be saved + input // string: Path to input samplesheet + + main: + + ch_versions = Channel.empty() + + // + // Print version and exit if required and dump pipeline parameters to JSON file + // + UTILS_NEXTFLOW_PIPELINE ( + version, + true, + outdir, + workflow.profile.tokenize(',').intersect(['conda', 'mamba']).size() >= 1 + ) + + // + // Validate parameters and generate parameter summary to stdout + // + pre_help_text = nfCoreLogo(monochrome_logs) + post_help_text = '\n' + workflowCitation() + '\n' + dashedLine(monochrome_logs) + def String workflow_command = "nextflow run ${workflow.manifest.name} -profile --input samplesheet.csv --outdir " + UTILS_NFVALIDATION_PLUGIN ( + help, + workflow_command, + pre_help_text, + post_help_text, + validate_params, + "nextflow_schema.json" + ) + + // + // Check config provided to the pipeline + // + UTILS_NFCORE_PIPELINE ( + nextflow_cli_args + ) + + {%- if igenomes %} + // + // Custom validation for pipeline parameters + // + validateInputParameters() + {%- endif %} + + // + // Create channel from input file provided through params.input + // + Channel + .fromSamplesheet("input") + .map { + meta, fastq_1, fastq_2 -> + if (!fastq_2) { + return [ meta.id, meta + [ single_end:true ], [ fastq_1 ] ] + } else { + return [ meta.id, meta + [ single_end:false ], [ fastq_1, fastq_2 ] ] + } + } + .groupTuple() + .map { + validateInputSamplesheet(it) + } + .map { + meta, fastqs -> + return [ meta, fastqs.flatten() ] + } + .set { ch_samplesheet } + + emit: + samplesheet = ch_samplesheet + versions = ch_versions +} + +/* +======================================================================================== + SUBWORKFLOW FOR PIPELINE COMPLETION +======================================================================================== +*/ + +workflow PIPELINE_COMPLETION { + + take: + email // string: email address + email_on_fail // string: email address sent on pipeline failure + plaintext_email // boolean: Send plain-text email instead of HTML + outdir // path: Path to output directory where results will be published + monochrome_logs // boolean: Disable ANSI colour codes in log output + hook_url // string: hook URL for notifications + multiqc_report // string: Path to MultiQC report + + main: + + summary_params = paramsSummaryMap(workflow, parameters_schema: "nextflow_schema.json") + + // + // Completion email and summary + // + workflow.onComplete { + if (email || email_on_fail) { + completionEmail(summary_params, email, email_on_fail, plaintext_email, outdir, monochrome_logs, multiqc_report.toList()) + } + + completionSummary(monochrome_logs) + + if (hook_url) { + imNotification(summary_params, hook_url) + } + } +} + +/* +======================================================================================== + FUNCTIONS +======================================================================================== +*/ + +{%- if igenomes %} +// +// Check and validate pipeline parameters +// +def validateInputParameters() { + genomeExistsError() +} +{%- endif %} + +// +// Validate channels from input samplesheet +// +def validateInputSamplesheet(input) { + def (metas, fastqs) = input[1..2] + + // Check that multiple runs of the same sample are of the same datatype i.e. single-end / paired-end + def endedness_ok = metas.collect{ it.single_end }.unique().size == 1 + if (!endedness_ok) { + error("Please check input samplesheet -> Multiple runs of a sample must be of the same datatype i.e. single-end or paired-end: ${metas[0].id}") + } + + return [ metas[0], fastqs ] +} + +{%- if igenomes %} +// +// Get attribute from genome config file e.g. fasta +// +def getGenomeAttribute(attribute) { + if (params.genomes && params.genome && params.genomes.containsKey(params.genome)) { + if (params.genomes[ params.genome ].containsKey(attribute)) { + return params.genomes[ params.genome ][ attribute ] + } + } + return null +} + +// +// Exit pipeline if incorrect --genome key provided +// +def genomeExistsError() { + if (params.genomes && params.genome && !params.genomes.containsKey(params.genome)) { + def error_string = "~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~\n" + + " Genome '${params.genome}' not found in any config files provided to the pipeline.\n" + + " Currently, the available genome keys are:\n" + + " ${params.genomes.keySet().join(", ")}\n" + + "~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~" + error(error_string) + } +} +{%- endif %} + +// +// Generate methods description for MultiQC +// +def toolCitationText() { + + def citation_text = [ + "Tools used in the workflow included:", + "AnnData (Virshup et al. 2021),", + "FastQC (Andrews 2010),", + "MultiQC (Ewels et al. 2016),", + "Quarto (Allaire et al. 2022),", + "Scanpy (Wolf et al. 2018),", + "Space Ranger (10x Genomics) and", + "SpatialDE (Svensson et al. 2018)." + ].join(' ').trim() + + return citation_text +} + +def toolBibliographyText() { + + def reference_text = [ + "
  • Virshup I, Rybakov S, Theis FJ, Angerer P, Wolf FA. bioRxiv 2021.12.16.473007; doi: 10.1101/2021.12.16.473007
  • ", + "
  • Andrews S, (2010) FastQC, URL: bioinformatics.babraham.ac.uk.
  • ", + "
  • Ewels, P., Magnusson, M., Lundin, S., & Käller, M. (2016). MultiQC: summarize analysis results for multiple tools and samples in a single report. Bioinformatics , 32(19), 3047–3048. doi: 10.1093/bioinformatics/btw354
  • ", + "
  • Allaire J, Teague C, Scheidegger C, Xie Y, Dervieux C. Quarto (2022). doi: 10.5281/zenodo.5960048
  • ", + "
  • Wolf F, Angerer P, Theis F. SCANPY: large-scale single-cell gene expression data analysis. Genome Biol 19, 15 (2018). doi: 10.1186/s13059-017-1382-0
  • ", + "
  • 10x Genomics Space Ranger 2.1.0, URL: 10xgenomics.com/support/software/space-ranger
  • ", + "
  • Svensson V, Teichmann S, Stegle O. SpatialDE: identification of spatially variable genes. Nat Methods 15, 343–346 (2018). doi: 10.1038/nmeth.4636
  • ", + ].join(' ').trim() + + return reference_text +} + +def methodsDescriptionText(mqc_methods_yaml) { + // Convert to a named map so can be used as with familar NXF ${workflow} variable syntax in the MultiQC YML file + def meta = [:] + meta.workflow = workflow.toMap() + meta["manifest_map"] = workflow.manifest.toMap() + + // Pipeline DOI + meta["doi_text"] = meta.manifest_map.doi ? "(doi: ${meta.manifest_map.doi})" : "" + meta["nodoi_text"] = meta.manifest_map.doi ? "": "
  • If available, make sure to update the text to include the Zenodo DOI of version of the pipeline used.
  • " + + // Tool references + meta["tool_citations"] = "" + meta["tool_bibliography"] = "" + meta["tool_citations"] = toolCitationText().replaceAll(", \\.", ".").replaceAll("\\. \\.", ".").replaceAll(", \\.", ".") + meta["tool_bibliography"] = toolBibliographyText() + + + def methods_text = mqc_methods_yaml.text + + def engine = new groovy.text.SimpleTemplateEngine() + def description_html = engine.createTemplate(methods_text).make(meta) + + return description_html.toString() +} + diff --git a/subworkflows/nf-core/utils_nextflow_pipeline/main.nf b/subworkflows/nf-core/utils_nextflow_pipeline/main.nf new file mode 100644 index 0000000..ac31f28 --- /dev/null +++ b/subworkflows/nf-core/utils_nextflow_pipeline/main.nf @@ -0,0 +1,126 @@ +// +// Subworkflow with functionality that may be useful for any Nextflow pipeline +// + +import org.yaml.snakeyaml.Yaml +import groovy.json.JsonOutput +import nextflow.extension.FilesEx + +/* +======================================================================================== + SUBWORKFLOW DEFINITION +======================================================================================== +*/ + +workflow UTILS_NEXTFLOW_PIPELINE { + + take: + print_version // boolean: print version + dump_parameters // boolean: dump parameters + outdir // path: base directory used to publish pipeline results + check_conda_channels // boolean: check conda channels + + main: + + // + // Print workflow version and exit on --version + // + if (print_version) { + log.info "${workflow.manifest.name} ${getWorkflowVersion()}" + System.exit(0) + } + + // + // Dump pipeline parameters to a JSON file + // + if (dump_parameters && outdir) { + dumpParametersToJSON(outdir) + } + + // + // When running with Conda, warn if channels have not been set-up appropriately + // + if (check_conda_channels) { + checkCondaChannels() + } + + emit: + dummy_emit = true +} + +/* +======================================================================================== + FUNCTIONS +======================================================================================== +*/ + +// +// Generate version string +// +def getWorkflowVersion() { + String version_string = "" + if (workflow.manifest.version) { + def prefix_v = workflow.manifest.version[0] != 'v' ? 'v' : '' + version_string += "${prefix_v}${workflow.manifest.version}" + } + + if (workflow.commitId) { + def git_shortsha = workflow.commitId.substring(0, 7) + version_string += "-g${git_shortsha}" + } + + return version_string +} + +// +// Dump pipeline parameters to a JSON file +// +def dumpParametersToJSON(outdir) { + def timestamp = new java.util.Date().format( 'yyyy-MM-dd_HH-mm-ss') + def filename = "params_${timestamp}.json" + def temp_pf = new File(workflow.launchDir.toString(), ".${filename}") + def jsonStr = JsonOutput.toJson(params) + temp_pf.text = JsonOutput.prettyPrint(jsonStr) + + FilesEx.copyTo(temp_pf.toPath(), "${outdir}/pipeline_info/params_${timestamp}.json") + temp_pf.delete() +} + +// +// When running with -profile conda, warn if channels have not been set-up appropriately +// +def checkCondaChannels() { + Yaml parser = new Yaml() + def channels = [] + try { + def config = parser.load("conda config --show channels".execute().text) + channels = config.channels + } catch(NullPointerException | IOException e) { + log.warn "Could not verify conda channel configuration." + return + } + + // Check that all channels are present + // This channel list is ordered by required channel priority. + def required_channels_in_order = ['conda-forge', 'bioconda', 'defaults'] + def channels_missing = ((required_channels_in_order as Set) - (channels as Set)) as Boolean + + // Check that they are in the right order + def channel_priority_violation = false + def n = required_channels_in_order.size() + for (int i = 0; i < n - 1; i++) { + channel_priority_violation |= !(channels.indexOf(required_channels_in_order[i]) < channels.indexOf(required_channels_in_order[i+1])) + } + + if (channels_missing | channel_priority_violation) { + log.warn "~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~\n" + + " There is a problem with your Conda configuration!\n\n" + + " You will need to set-up the conda-forge and bioconda channels correctly.\n" + + " Please refer to https://bioconda.github.io/\n" + + " The observed channel order is \n" + + " ${channels}\n" + + " but the following channel order is required:\n" + + " ${required_channels_in_order}\n" + + "~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~" + } +} diff --git a/subworkflows/nf-core/utils_nextflow_pipeline/meta.yml b/subworkflows/nf-core/utils_nextflow_pipeline/meta.yml new file mode 100644 index 0000000..e5c3a0a --- /dev/null +++ b/subworkflows/nf-core/utils_nextflow_pipeline/meta.yml @@ -0,0 +1,38 @@ +# yaml-language-server: $schema=https://raw.githubusercontent.com/nf-core/modules/master/subworkflows/yaml-schema.json +name: "UTILS_NEXTFLOW_PIPELINE" +description: Subworkflow with functionality that may be useful for any Nextflow pipeline +keywords: + - utility + - pipeline + - initialise + - version +components: [] +input: + - print_version: + type: boolean + description: | + Print the version of the pipeline and exit + - dump_parameters: + type: boolean + description: | + Dump the parameters of the pipeline to a JSON file + - output_directory: + type: directory + description: Path to output dir to write JSON file to. + pattern: "results/" + - check_conda_channel: + type: boolean + description: | + Check if the conda channel priority is correct. +output: + - dummy_emit: + type: boolean + description: | + Dummy emit to make nf-core subworkflows lint happy +authors: + - "@adamrtalbot" + - "@drpatelh" +maintainers: + - "@adamrtalbot" + - "@drpatelh" + - "@maxulysse" diff --git a/subworkflows/nf-core/utils_nextflow_pipeline/tests/main.function.nf.test b/subworkflows/nf-core/utils_nextflow_pipeline/tests/main.function.nf.test new file mode 100644 index 0000000..68718e4 --- /dev/null +++ b/subworkflows/nf-core/utils_nextflow_pipeline/tests/main.function.nf.test @@ -0,0 +1,54 @@ + +nextflow_function { + + name "Test Functions" + script "subworkflows/nf-core/utils_nextflow_pipeline/main.nf" + config "subworkflows/nf-core/utils_nextflow_pipeline/tests/nextflow.config" + tag 'subworkflows' + tag 'utils_nextflow_pipeline' + tag 'subworkflows/utils_nextflow_pipeline' + + test("Test Function getWorkflowVersion") { + + function "getWorkflowVersion" + + then { + assertAll( + { assert function.success }, + { assert snapshot(function.result).match() } + ) + } + } + + test("Test Function dumpParametersToJSON") { + + function "dumpParametersToJSON" + + when { + function { + """ + // define inputs of the function here. Example: + input[0] = "$outputDir" + """.stripIndent() + } + } + + then { + assertAll( + { assert function.success } + ) + } + } + + test("Test Function checkCondaChannels") { + + function "checkCondaChannels" + + then { + assertAll( + { assert function.success }, + { assert snapshot(function.result).match() } + ) + } + } +} diff --git a/subworkflows/nf-core/utils_nextflow_pipeline/tests/main.function.nf.test.snap b/subworkflows/nf-core/utils_nextflow_pipeline/tests/main.function.nf.test.snap new file mode 100644 index 0000000..e3f0baf --- /dev/null +++ b/subworkflows/nf-core/utils_nextflow_pipeline/tests/main.function.nf.test.snap @@ -0,0 +1,20 @@ +{ + "Test Function getWorkflowVersion": { + "content": [ + "v9.9.9" + ], + "meta": { + "nf-test": "0.8.4", + "nextflow": "23.10.1" + }, + "timestamp": "2024-02-28T12:02:05.308243" + }, + "Test Function checkCondaChannels": { + "content": null, + "meta": { + "nf-test": "0.8.4", + "nextflow": "23.10.1" + }, + "timestamp": "2024-02-28T12:02:12.425833" + } +} \ No newline at end of file diff --git a/subworkflows/nf-core/utils_nextflow_pipeline/tests/main.workflow.nf.test b/subworkflows/nf-core/utils_nextflow_pipeline/tests/main.workflow.nf.test new file mode 100644 index 0000000..ca964ce --- /dev/null +++ b/subworkflows/nf-core/utils_nextflow_pipeline/tests/main.workflow.nf.test @@ -0,0 +1,111 @@ +nextflow_workflow { + + name "Test Workflow UTILS_NEXTFLOW_PIPELINE" + script "../main.nf" + config "subworkflows/nf-core/utils_nextflow_pipeline/tests/nextflow.config" + workflow "UTILS_NEXTFLOW_PIPELINE" + tag 'subworkflows' + tag 'utils_nextflow_pipeline' + tag 'subworkflows/utils_nextflow_pipeline' + + test("Should run no inputs") { + + when { + workflow { + """ + print_version = false + dump_parameters = false + outdir = null + check_conda_channels = false + + input[0] = print_version + input[1] = dump_parameters + input[2] = outdir + input[3] = check_conda_channels + """ + } + } + + then { + assertAll( + { assert workflow.success } + ) + } + } + + test("Should print version") { + + when { + workflow { + """ + print_version = true + dump_parameters = false + outdir = null + check_conda_channels = false + + input[0] = print_version + input[1] = dump_parameters + input[2] = outdir + input[3] = check_conda_channels + """ + } + } + + then { + assertAll( + { assert workflow.success }, + { assert workflow.stdout.contains("nextflow_workflow v9.9.9") } + ) + } + } + + test("Should dump params") { + + when { + workflow { + """ + print_version = false + dump_parameters = true + outdir = 'results' + check_conda_channels = false + + input[0] = false + input[1] = true + input[2] = outdir + input[3] = false + """ + } + } + + then { + assertAll( + { assert workflow.success } + ) + } + } + + test("Should not create params JSON if no output directory") { + + when { + workflow { + """ + print_version = false + dump_parameters = true + outdir = null + check_conda_channels = false + + input[0] = false + input[1] = true + input[2] = outdir + input[3] = false + """ + } + } + + then { + assertAll( + { assert workflow.success } + ) + } + } +} diff --git a/subworkflows/nf-core/utils_nextflow_pipeline/tests/nextflow.config b/subworkflows/nf-core/utils_nextflow_pipeline/tests/nextflow.config new file mode 100644 index 0000000..d0a926b --- /dev/null +++ b/subworkflows/nf-core/utils_nextflow_pipeline/tests/nextflow.config @@ -0,0 +1,9 @@ +manifest { + name = 'nextflow_workflow' + author = """nf-core""" + homePage = 'https://127.0.0.1' + description = """Dummy pipeline""" + nextflowVersion = '!>=23.04.0' + version = '9.9.9' + doi = 'https://doi.org/10.5281/zenodo.5070524' +} diff --git a/subworkflows/nf-core/utils_nextflow_pipeline/tests/tags.yml b/subworkflows/nf-core/utils_nextflow_pipeline/tests/tags.yml new file mode 100644 index 0000000..f847611 --- /dev/null +++ b/subworkflows/nf-core/utils_nextflow_pipeline/tests/tags.yml @@ -0,0 +1,2 @@ +subworkflows/utils_nextflow_pipeline: + - subworkflows/nf-core/utils_nextflow_pipeline/** diff --git a/subworkflows/nf-core/utils_nfcore_pipeline/main.nf b/subworkflows/nf-core/utils_nfcore_pipeline/main.nf new file mode 100644 index 0000000..a8b55d6 --- /dev/null +++ b/subworkflows/nf-core/utils_nfcore_pipeline/main.nf @@ -0,0 +1,440 @@ +// +// Subworkflow with utility functions specific to the nf-core pipeline template +// + +import org.yaml.snakeyaml.Yaml +import nextflow.extension.FilesEx + +/* +======================================================================================== + SUBWORKFLOW DEFINITION +======================================================================================== +*/ + +workflow UTILS_NFCORE_PIPELINE { + + take: + nextflow_cli_args + + main: + valid_config = checkConfigProvided() + checkProfileProvided(nextflow_cli_args) + + emit: + valid_config +} + +/* +======================================================================================== + FUNCTIONS +======================================================================================== +*/ + +// +// Warn if a -profile or Nextflow config has not been provided to run the pipeline +// +def checkConfigProvided() { + valid_config = true + if (workflow.profile == 'standard' && workflow.configFiles.size() <= 1) { + log.warn "[$workflow.manifest.name] You are attempting to run the pipeline without any custom configuration!\n\n" + + "This will be dependent on your local compute environment but can be achieved via one or more of the following:\n" + + " (1) Using an existing pipeline profile e.g. `-profile docker` or `-profile singularity`\n" + + " (2) Using an existing nf-core/configs for your Institution e.g. `-profile crick` or `-profile uppmax`\n" + + " (3) Using your own local custom config e.g. `-c /path/to/your/custom.config`\n\n" + + "Please refer to the quick start section and usage docs for the pipeline.\n " + valid_config = false + } + return valid_config +} + +// +// Exit pipeline if --profile contains spaces +// +def checkProfileProvided(nextflow_cli_args) { + if (workflow.profile.endsWith(',')) { + error "The `-profile` option cannot end with a trailing comma, please remove it and re-run the pipeline!\n" + + "HINT: A common mistake is to provide multiple values separated by spaces e.g. `-profile test, docker`.\n" + } + if (nextflow_cli_args[0]) { + log.warn "nf-core pipelines do not accept positional arguments. The positional argument `${nextflow_cli_args[0]}` has been detected.\n" + + "HINT: A common mistake is to provide multiple values separated by spaces e.g. `-profile test, docker`.\n" + } +} + +// +// Citation string for pipeline +// +def workflowCitation() { + return "If you use ${workflow.manifest.name} for your analysis please cite:\n\n" + + "* The pipeline\n" + + " ${workflow.manifest.doi}\n\n" + + "* The nf-core framework\n" + + " https://doi.org/10.1038/s41587-020-0439-x\n\n" + + "* Software dependencies\n" + + " https://github.com/${workflow.manifest.name}/blob/master/CITATIONS.md" +} + +// +// Generate workflow version string +// +def getWorkflowVersion() { + String version_string = "" + if (workflow.manifest.version) { + def prefix_v = workflow.manifest.version[0] != 'v' ? 'v' : '' + version_string += "${prefix_v}${workflow.manifest.version}" + } + + if (workflow.commitId) { + def git_shortsha = workflow.commitId.substring(0, 7) + version_string += "-g${git_shortsha}" + } + + return version_string +} + +// +// Get software versions for pipeline +// +def processVersionsFromYAML(yaml_file) { + Yaml yaml = new Yaml() + versions = yaml.load(yaml_file).collectEntries { k, v -> [ k.tokenize(':')[-1], v ] } + return yaml.dumpAsMap(versions).trim() +} + +// +// Get workflow version for pipeline +// +def workflowVersionToYAML() { + return """ + Workflow: + $workflow.manifest.name: ${getWorkflowVersion()} + Nextflow: $workflow.nextflow.version + """.stripIndent().trim() +} + +// +// Get channel of software versions used in pipeline in YAML format +// +def softwareVersionsToYAML(ch_versions) { + return ch_versions + .unique() + .map { processVersionsFromYAML(it) } + .unique() + .mix(Channel.of(workflowVersionToYAML())) +} + +// +// Get workflow summary for MultiQC +// +def paramsSummaryMultiqc(summary_params) { + def summary_section = '' + for (group in summary_params.keySet()) { + def group_params = summary_params.get(group) // This gets the parameters of that particular group + if (group_params) { + summary_section += "

    $group

    \n" + summary_section += "
    \n" + for (param in group_params.keySet()) { + summary_section += "
    $param
    ${group_params.get(param) ?: 'N/A'}
    \n" + } + summary_section += "
    \n" + } + } + + String yaml_file_text = "id: '${workflow.manifest.name.replace('/','-')}-summary'\n" + yaml_file_text += "description: ' - this information is collected when the pipeline is started.'\n" + yaml_file_text += "section_name: '${workflow.manifest.name} Workflow Summary'\n" + yaml_file_text += "section_href: 'https://github.com/${workflow.manifest.name}'\n" + yaml_file_text += "plot_type: 'html'\n" + yaml_file_text += "data: |\n" + yaml_file_text += "${summary_section}" + + return yaml_file_text +} + +// +// nf-core logo +// +def nfCoreLogo(monochrome_logs=true) { + Map colors = logColours(monochrome_logs) + String.format( + """\n + ${dashedLine(monochrome_logs)} + ${colors.green},--.${colors.black}/${colors.green},-.${colors.reset} + ${colors.blue} ___ __ __ __ ___ ${colors.green}/,-._.--~\'${colors.reset} + ${colors.blue} |\\ | |__ __ / ` / \\ |__) |__ ${colors.yellow}} {${colors.reset} + ${colors.blue} | \\| | \\__, \\__/ | \\ |___ ${colors.green}\\`-._,-`-,${colors.reset} + ${colors.green}`._,._,\'${colors.reset} + ${colors.purple} ${workflow.manifest.name} ${getWorkflowVersion()}${colors.reset} + ${dashedLine(monochrome_logs)} + """.stripIndent() + ) +} + +// +// Return dashed line +// +def dashedLine(monochrome_logs=true) { + Map colors = logColours(monochrome_logs) + return "-${colors.dim}----------------------------------------------------${colors.reset}-" +} + +// +// ANSII colours used for terminal logging +// +def logColours(monochrome_logs=true) { + Map colorcodes = [:] + + // Reset / Meta + colorcodes['reset'] = monochrome_logs ? '' : "\033[0m" + colorcodes['bold'] = monochrome_logs ? '' : "\033[1m" + colorcodes['dim'] = monochrome_logs ? '' : "\033[2m" + colorcodes['underlined'] = monochrome_logs ? '' : "\033[4m" + colorcodes['blink'] = monochrome_logs ? '' : "\033[5m" + colorcodes['reverse'] = monochrome_logs ? '' : "\033[7m" + colorcodes['hidden'] = monochrome_logs ? '' : "\033[8m" + + // Regular Colors + colorcodes['black'] = monochrome_logs ? '' : "\033[0;30m" + colorcodes['red'] = monochrome_logs ? '' : "\033[0;31m" + colorcodes['green'] = monochrome_logs ? '' : "\033[0;32m" + colorcodes['yellow'] = monochrome_logs ? '' : "\033[0;33m" + colorcodes['blue'] = monochrome_logs ? '' : "\033[0;34m" + colorcodes['purple'] = monochrome_logs ? '' : "\033[0;35m" + colorcodes['cyan'] = monochrome_logs ? '' : "\033[0;36m" + colorcodes['white'] = monochrome_logs ? '' : "\033[0;37m" + + // Bold + colorcodes['bblack'] = monochrome_logs ? '' : "\033[1;30m" + colorcodes['bred'] = monochrome_logs ? '' : "\033[1;31m" + colorcodes['bgreen'] = monochrome_logs ? '' : "\033[1;32m" + colorcodes['byellow'] = monochrome_logs ? '' : "\033[1;33m" + colorcodes['bblue'] = monochrome_logs ? '' : "\033[1;34m" + colorcodes['bpurple'] = monochrome_logs ? '' : "\033[1;35m" + colorcodes['bcyan'] = monochrome_logs ? '' : "\033[1;36m" + colorcodes['bwhite'] = monochrome_logs ? '' : "\033[1;37m" + + // Underline + colorcodes['ublack'] = monochrome_logs ? '' : "\033[4;30m" + colorcodes['ured'] = monochrome_logs ? '' : "\033[4;31m" + colorcodes['ugreen'] = monochrome_logs ? '' : "\033[4;32m" + colorcodes['uyellow'] = monochrome_logs ? '' : "\033[4;33m" + colorcodes['ublue'] = monochrome_logs ? '' : "\033[4;34m" + colorcodes['upurple'] = monochrome_logs ? '' : "\033[4;35m" + colorcodes['ucyan'] = monochrome_logs ? '' : "\033[4;36m" + colorcodes['uwhite'] = monochrome_logs ? '' : "\033[4;37m" + + // High Intensity + colorcodes['iblack'] = monochrome_logs ? '' : "\033[0;90m" + colorcodes['ired'] = monochrome_logs ? '' : "\033[0;91m" + colorcodes['igreen'] = monochrome_logs ? '' : "\033[0;92m" + colorcodes['iyellow'] = monochrome_logs ? '' : "\033[0;93m" + colorcodes['iblue'] = monochrome_logs ? '' : "\033[0;94m" + colorcodes['ipurple'] = monochrome_logs ? '' : "\033[0;95m" + colorcodes['icyan'] = monochrome_logs ? '' : "\033[0;96m" + colorcodes['iwhite'] = monochrome_logs ? '' : "\033[0;97m" + + // Bold High Intensity + colorcodes['biblack'] = monochrome_logs ? '' : "\033[1;90m" + colorcodes['bired'] = monochrome_logs ? '' : "\033[1;91m" + colorcodes['bigreen'] = monochrome_logs ? '' : "\033[1;92m" + colorcodes['biyellow'] = monochrome_logs ? '' : "\033[1;93m" + colorcodes['biblue'] = monochrome_logs ? '' : "\033[1;94m" + colorcodes['bipurple'] = monochrome_logs ? '' : "\033[1;95m" + colorcodes['bicyan'] = monochrome_logs ? '' : "\033[1;96m" + colorcodes['biwhite'] = monochrome_logs ? '' : "\033[1;97m" + + return colorcodes +} + +// +// Attach the multiqc report to email +// +def attachMultiqcReport(multiqc_report) { + def mqc_report = null + try { + if (workflow.success) { + mqc_report = multiqc_report.getVal() + if (mqc_report.getClass() == ArrayList && mqc_report.size() >= 1) { + if (mqc_report.size() > 1) { + log.warn "[$workflow.manifest.name] Found multiple reports from process 'MULTIQC', will use only one" + } + mqc_report = mqc_report[0] + } + } + } catch (all) { + if (multiqc_report) { + log.warn "[$workflow.manifest.name] Could not attach MultiQC report to summary email" + } + } + return mqc_report +} + +// +// Construct and send completion email +// +def completionEmail(summary_params, email, email_on_fail, plaintext_email, outdir, monochrome_logs=true, multiqc_report=null) { + + // Set up the e-mail variables + def subject = "[$workflow.manifest.name] Successful: $workflow.runName" + if (!workflow.success) { + subject = "[$workflow.manifest.name] FAILED: $workflow.runName" + } + + def summary = [:] + for (group in summary_params.keySet()) { + summary << summary_params[group] + } + + def misc_fields = [:] + misc_fields['Date Started'] = workflow.start + misc_fields['Date Completed'] = workflow.complete + misc_fields['Pipeline script file path'] = workflow.scriptFile + misc_fields['Pipeline script hash ID'] = workflow.scriptId + if (workflow.repository) misc_fields['Pipeline repository Git URL'] = workflow.repository + if (workflow.commitId) misc_fields['Pipeline repository Git Commit'] = workflow.commitId + if (workflow.revision) misc_fields['Pipeline Git branch/tag'] = workflow.revision + misc_fields['Nextflow Version'] = workflow.nextflow.version + misc_fields['Nextflow Build'] = workflow.nextflow.build + misc_fields['Nextflow Compile Timestamp'] = workflow.nextflow.timestamp + + def email_fields = [:] + email_fields['version'] = getWorkflowVersion() + email_fields['runName'] = workflow.runName + email_fields['success'] = workflow.success + email_fields['dateComplete'] = workflow.complete + email_fields['duration'] = workflow.duration + email_fields['exitStatus'] = workflow.exitStatus + email_fields['errorMessage'] = (workflow.errorMessage ?: 'None') + email_fields['errorReport'] = (workflow.errorReport ?: 'None') + email_fields['commandLine'] = workflow.commandLine + email_fields['projectDir'] = workflow.projectDir + email_fields['summary'] = summary << misc_fields + + // On success try attach the multiqc report + def mqc_report = attachMultiqcReport(multiqc_report) + + // Check if we are only sending emails on failure + def email_address = email + if (!email && email_on_fail && !workflow.success) { + email_address = email_on_fail + } + + // Render the TXT template + def engine = new groovy.text.GStringTemplateEngine() + def tf = new File("${workflow.projectDir}/assets/email_template.txt") + def txt_template = engine.createTemplate(tf).make(email_fields) + def email_txt = txt_template.toString() + + // Render the HTML template + def hf = new File("${workflow.projectDir}/assets/email_template.html") + def html_template = engine.createTemplate(hf).make(email_fields) + def email_html = html_template.toString() + + // Render the sendmail template + def max_multiqc_email_size = (params.containsKey('max_multiqc_email_size') ? params.max_multiqc_email_size : 0) as nextflow.util.MemoryUnit + def smail_fields = [ email: email_address, subject: subject, email_txt: email_txt, email_html: email_html, projectDir: "${workflow.projectDir}", mqcFile: mqc_report, mqcMaxSize: max_multiqc_email_size.toBytes() ] + def sf = new File("${workflow.projectDir}/assets/sendmail_template.txt") + def sendmail_template = engine.createTemplate(sf).make(smail_fields) + def sendmail_html = sendmail_template.toString() + + // Send the HTML e-mail + Map colors = logColours(monochrome_logs) + if (email_address) { + try { + if (plaintext_email) { throw GroovyException('Send plaintext e-mail, not HTML') } + // Try to send HTML e-mail using sendmail + def sendmail_tf = new File(workflow.launchDir.toString(), ".sendmail_tmp.html") + sendmail_tf.withWriter { w -> w << sendmail_html } + [ 'sendmail', '-t' ].execute() << sendmail_html + log.info "-${colors.purple}[$workflow.manifest.name]${colors.green} Sent summary e-mail to $email_address (sendmail)-" + } catch (all) { + // Catch failures and try with plaintext + def mail_cmd = [ 'mail', '-s', subject, '--content-type=text/html', email_address ] + mail_cmd.execute() << email_html + log.info "-${colors.purple}[$workflow.manifest.name]${colors.green} Sent summary e-mail to $email_address (mail)-" + } + } + + // Write summary e-mail HTML to a file + def output_hf = new File(workflow.launchDir.toString(), ".pipeline_report.html") + output_hf.withWriter { w -> w << email_html } + FilesEx.copyTo(output_hf.toPath(), "${outdir}/pipeline_info/pipeline_report.html"); + output_hf.delete() + + // Write summary e-mail TXT to a file + def output_tf = new File(workflow.launchDir.toString(), ".pipeline_report.txt") + output_tf.withWriter { w -> w << email_txt } + FilesEx.copyTo(output_tf.toPath(), "${outdir}/pipeline_info/pipeline_report.txt"); + output_tf.delete() +} + +// +// Print pipeline summary on completion +// +def completionSummary(monochrome_logs=true) { + Map colors = logColours(monochrome_logs) + if (workflow.success) { + if (workflow.stats.ignoredCount == 0) { + log.info "-${colors.purple}[$workflow.manifest.name]${colors.green} Pipeline completed successfully${colors.reset}-" + } else { + log.info "-${colors.purple}[$workflow.manifest.name]${colors.yellow} Pipeline completed successfully, but with errored process(es) ${colors.reset}-" + } + } else { + log.info "-${colors.purple}[$workflow.manifest.name]${colors.red} Pipeline completed with errors${colors.reset}-" + } +} + +// +// Construct and send a notification to a web server as JSON e.g. Microsoft Teams and Slack +// +def imNotification(summary_params, hook_url) { + def summary = [:] + for (group in summary_params.keySet()) { + summary << summary_params[group] + } + + def misc_fields = [:] + misc_fields['start'] = workflow.start + misc_fields['complete'] = workflow.complete + misc_fields['scriptfile'] = workflow.scriptFile + misc_fields['scriptid'] = workflow.scriptId + if (workflow.repository) misc_fields['repository'] = workflow.repository + if (workflow.commitId) misc_fields['commitid'] = workflow.commitId + if (workflow.revision) misc_fields['revision'] = workflow.revision + misc_fields['nxf_version'] = workflow.nextflow.version + misc_fields['nxf_build'] = workflow.nextflow.build + misc_fields['nxf_timestamp'] = workflow.nextflow.timestamp + + def msg_fields = [:] + msg_fields['version'] = getWorkflowVersion() + msg_fields['runName'] = workflow.runName + msg_fields['success'] = workflow.success + msg_fields['dateComplete'] = workflow.complete + msg_fields['duration'] = workflow.duration + msg_fields['exitStatus'] = workflow.exitStatus + msg_fields['errorMessage'] = (workflow.errorMessage ?: 'None') + msg_fields['errorReport'] = (workflow.errorReport ?: 'None') + msg_fields['commandLine'] = workflow.commandLine.replaceFirst(/ +--hook_url +[^ ]+/, "") + msg_fields['projectDir'] = workflow.projectDir + msg_fields['summary'] = summary << misc_fields + + // Render the JSON template + def engine = new groovy.text.GStringTemplateEngine() + // Different JSON depending on the service provider + // Defaults to "Adaptive Cards" (https://adaptivecards.io), except Slack which has its own format + def json_path = hook_url.contains("hooks.slack.com") ? "slackreport.json" : "adaptivecard.json" + def hf = new File("${workflow.projectDir}/assets/${json_path}") + def json_template = engine.createTemplate(hf).make(msg_fields) + def json_message = json_template.toString() + + // POST + def post = new URL(hook_url).openConnection(); + post.setRequestMethod("POST") + post.setDoOutput(true) + post.setRequestProperty("Content-Type", "application/json") + post.getOutputStream().write(json_message.getBytes("UTF-8")); + def postRC = post.getResponseCode(); + if (! postRC.equals(200)) { + log.warn(post.getErrorStream().getText()); + } +} diff --git a/subworkflows/nf-core/utils_nfcore_pipeline/meta.yml b/subworkflows/nf-core/utils_nfcore_pipeline/meta.yml new file mode 100644 index 0000000..d08d243 --- /dev/null +++ b/subworkflows/nf-core/utils_nfcore_pipeline/meta.yml @@ -0,0 +1,24 @@ +# yaml-language-server: $schema=https://raw.githubusercontent.com/nf-core/modules/master/subworkflows/yaml-schema.json +name: "UTILS_NFCORE_PIPELINE" +description: Subworkflow with utility functions specific to the nf-core pipeline template +keywords: + - utility + - pipeline + - initialise + - version +components: [] +input: + - nextflow_cli_args: + type: list + description: | + Nextflow CLI positional arguments +output: + - success: + type: boolean + description: | + Dummy output to indicate success +authors: + - "@adamrtalbot" +maintainers: + - "@adamrtalbot" + - "@maxulysse" diff --git a/subworkflows/nf-core/utils_nfcore_pipeline/tests/main.function.nf.test b/subworkflows/nf-core/utils_nfcore_pipeline/tests/main.function.nf.test new file mode 100644 index 0000000..1dc317f --- /dev/null +++ b/subworkflows/nf-core/utils_nfcore_pipeline/tests/main.function.nf.test @@ -0,0 +1,134 @@ + +nextflow_function { + + name "Test Functions" + script "../main.nf" + config "subworkflows/nf-core/utils_nfcore_pipeline/tests/nextflow.config" + tag "subworkflows" + tag "subworkflows_nfcore" + tag "utils_nfcore_pipeline" + tag "subworkflows/utils_nfcore_pipeline" + + test("Test Function checkConfigProvided") { + + function "checkConfigProvided" + + then { + assertAll( + { assert function.success }, + { assert snapshot(function.result).match() } + ) + } + } + + test("Test Function checkProfileProvided") { + + function "checkProfileProvided" + + when { + function { + """ + input[0] = [] + """ + } + } + + then { + assertAll( + { assert function.success }, + { assert snapshot(function.result).match() } + ) + } + } + + test("Test Function workflowCitation") { + + function "workflowCitation" + + then { + assertAll( + { assert function.success }, + { assert snapshot(function.result).match() } + ) + } + } + + test("Test Function nfCoreLogo") { + + function "nfCoreLogo" + + when { + function { + """ + input[0] = false + """ + } + } + + then { + assertAll( + { assert function.success }, + { assert snapshot(function.result).match() } + ) + } + } + + test("Test Function dashedLine") { + + function "dashedLine" + + when { + function { + """ + input[0] = false + """ + } + } + + then { + assertAll( + { assert function.success }, + { assert snapshot(function.result).match() } + ) + } + } + + test("Test Function without logColours") { + + function "logColours" + + when { + function { + """ + input[0] = true + """ + } + } + + then { + assertAll( + { assert function.success }, + { assert snapshot(function.result).match() } + ) + } + } + + test("Test Function with logColours") { + function "logColours" + + when { + function { + """ + input[0] = false + """ + } + } + + then { + assertAll( + { assert function.success }, + { assert snapshot(function.result).match() } + ) + } + } +} diff --git a/subworkflows/nf-core/utils_nfcore_pipeline/tests/main.function.nf.test.snap b/subworkflows/nf-core/utils_nfcore_pipeline/tests/main.function.nf.test.snap new file mode 100644 index 0000000..1037232 --- /dev/null +++ b/subworkflows/nf-core/utils_nfcore_pipeline/tests/main.function.nf.test.snap @@ -0,0 +1,166 @@ +{ + "Test Function checkProfileProvided": { + "content": null, + "meta": { + "nf-test": "0.8.4", + "nextflow": "23.10.1" + }, + "timestamp": "2024-02-28T12:03:03.360873" + }, + "Test Function checkConfigProvided": { + "content": [ + true + ], + "meta": { + "nf-test": "0.8.4", + "nextflow": "23.10.1" + }, + "timestamp": "2024-02-28T12:02:59.729647" + }, + "Test Function nfCoreLogo": { + "content": [ + "\n\n-\u001b[2m----------------------------------------------------\u001b[0m-\n \u001b[0;32m,--.\u001b[0;30m/\u001b[0;32m,-.\u001b[0m\n\u001b[0;34m ___ __ __ __ ___ \u001b[0;32m/,-._.--~'\u001b[0m\n\u001b[0;34m |\\ | |__ __ / ` / \\ |__) |__ \u001b[0;33m} {\u001b[0m\n\u001b[0;34m | \\| | \\__, \\__/ | \\ |___ \u001b[0;32m\\`-._,-`-,\u001b[0m\n \u001b[0;32m`._,._,'\u001b[0m\n\u001b[0;35m nextflow_workflow v9.9.9\u001b[0m\n-\u001b[2m----------------------------------------------------\u001b[0m-\n" + ], + "meta": { + "nf-test": "0.8.4", + "nextflow": "23.10.1" + }, + "timestamp": "2024-02-28T12:03:10.562934" + }, + "Test Function workflowCitation": { + "content": [ + "If you use nextflow_workflow for your analysis please cite:\n\n* The pipeline\n https://doi.org/10.5281/zenodo.5070524\n\n* The nf-core framework\n https://doi.org/10.1038/s41587-020-0439-x\n\n* Software dependencies\n https://github.com/nextflow_workflow/blob/master/CITATIONS.md" + ], + "meta": { + "nf-test": "0.8.4", + "nextflow": "23.10.1" + }, + "timestamp": "2024-02-28T12:03:07.019761" + }, + "Test Function without logColours": { + "content": [ + { + "reset": "", + "bold": "", + "dim": "", + "underlined": "", + "blink": "", + "reverse": "", + "hidden": "", + "black": "", + "red": "", + "green": "", + "yellow": "", + "blue": "", + "purple": "", + "cyan": "", + "white": "", + "bblack": "", + "bred": "", + "bgreen": "", + "byellow": "", + "bblue": "", + "bpurple": "", + "bcyan": "", + "bwhite": "", + "ublack": "", + "ured": "", + "ugreen": "", + "uyellow": "", + "ublue": "", + "upurple": "", + "ucyan": "", + "uwhite": "", + "iblack": "", + "ired": "", + "igreen": "", + "iyellow": "", + "iblue": "", + "ipurple": "", + "icyan": "", + "iwhite": "", + "biblack": "", + "bired": "", + "bigreen": "", + "biyellow": "", + "biblue": "", + "bipurple": "", + "bicyan": "", + "biwhite": "" + } + ], + "meta": { + "nf-test": "0.8.4", + "nextflow": "23.10.1" + }, + "timestamp": "2024-02-28T12:03:17.969323" + }, + "Test Function dashedLine": { + "content": [ + "-\u001b[2m----------------------------------------------------\u001b[0m-" + ], + "meta": { + "nf-test": "0.8.4", + "nextflow": "23.10.1" + }, + "timestamp": "2024-02-28T12:03:14.366181" + }, + "Test Function with logColours": { + "content": [ + { + "reset": "\u001b[0m", + "bold": "\u001b[1m", + "dim": "\u001b[2m", + "underlined": "\u001b[4m", + "blink": "\u001b[5m", + "reverse": "\u001b[7m", + "hidden": "\u001b[8m", + "black": "\u001b[0;30m", + "red": "\u001b[0;31m", + "green": "\u001b[0;32m", + "yellow": "\u001b[0;33m", + "blue": "\u001b[0;34m", + "purple": "\u001b[0;35m", + "cyan": "\u001b[0;36m", + "white": "\u001b[0;37m", + "bblack": "\u001b[1;30m", + "bred": "\u001b[1;31m", + "bgreen": "\u001b[1;32m", + "byellow": "\u001b[1;33m", + "bblue": "\u001b[1;34m", + "bpurple": "\u001b[1;35m", + "bcyan": "\u001b[1;36m", + "bwhite": "\u001b[1;37m", + "ublack": "\u001b[4;30m", + "ured": "\u001b[4;31m", + "ugreen": "\u001b[4;32m", + "uyellow": "\u001b[4;33m", + "ublue": "\u001b[4;34m", + "upurple": "\u001b[4;35m", + "ucyan": "\u001b[4;36m", + "uwhite": "\u001b[4;37m", + "iblack": "\u001b[0;90m", + "ired": "\u001b[0;91m", + "igreen": "\u001b[0;92m", + "iyellow": "\u001b[0;93m", + "iblue": "\u001b[0;94m", + "ipurple": "\u001b[0;95m", + "icyan": "\u001b[0;96m", + "iwhite": "\u001b[0;97m", + "biblack": "\u001b[1;90m", + "bired": "\u001b[1;91m", + "bigreen": "\u001b[1;92m", + "biyellow": "\u001b[1;93m", + "biblue": "\u001b[1;94m", + "bipurple": "\u001b[1;95m", + "bicyan": "\u001b[1;96m", + "biwhite": "\u001b[1;97m" + } + ], + "meta": { + "nf-test": "0.8.4", + "nextflow": "23.10.1" + }, + "timestamp": "2024-02-28T12:03:21.714424" + } +} \ No newline at end of file diff --git a/subworkflows/nf-core/utils_nfcore_pipeline/tests/main.workflow.nf.test b/subworkflows/nf-core/utils_nfcore_pipeline/tests/main.workflow.nf.test new file mode 100644 index 0000000..8940d32 --- /dev/null +++ b/subworkflows/nf-core/utils_nfcore_pipeline/tests/main.workflow.nf.test @@ -0,0 +1,29 @@ +nextflow_workflow { + + name "Test Workflow UTILS_NFCORE_PIPELINE" + script "../main.nf" + config "subworkflows/nf-core/utils_nfcore_pipeline/tests/nextflow.config" + workflow "UTILS_NFCORE_PIPELINE" + tag "subworkflows" + tag "subworkflows_nfcore" + tag "utils_nfcore_pipeline" + tag "subworkflows/utils_nfcore_pipeline" + + test("Should run without failures") { + + when { + workflow { + """ + input[0] = [] + """ + } + } + + then { + assertAll( + { assert workflow.success }, + { assert snapshot(workflow.out).match() } + ) + } + } +} diff --git a/subworkflows/nf-core/utils_nfcore_pipeline/tests/main.workflow.nf.test.snap b/subworkflows/nf-core/utils_nfcore_pipeline/tests/main.workflow.nf.test.snap new file mode 100644 index 0000000..859d103 --- /dev/null +++ b/subworkflows/nf-core/utils_nfcore_pipeline/tests/main.workflow.nf.test.snap @@ -0,0 +1,19 @@ +{ + "Should run without failures": { + "content": [ + { + "0": [ + true + ], + "valid_config": [ + true + ] + } + ], + "meta": { + "nf-test": "0.8.4", + "nextflow": "23.10.1" + }, + "timestamp": "2024-02-28T12:03:25.726491" + } +} \ No newline at end of file diff --git a/subworkflows/nf-core/utils_nfcore_pipeline/tests/nextflow.config b/subworkflows/nf-core/utils_nfcore_pipeline/tests/nextflow.config new file mode 100644 index 0000000..d0a926b --- /dev/null +++ b/subworkflows/nf-core/utils_nfcore_pipeline/tests/nextflow.config @@ -0,0 +1,9 @@ +manifest { + name = 'nextflow_workflow' + author = """nf-core""" + homePage = 'https://127.0.0.1' + description = """Dummy pipeline""" + nextflowVersion = '!>=23.04.0' + version = '9.9.9' + doi = 'https://doi.org/10.5281/zenodo.5070524' +} diff --git a/subworkflows/nf-core/utils_nfcore_pipeline/tests/tags.yml b/subworkflows/nf-core/utils_nfcore_pipeline/tests/tags.yml new file mode 100644 index 0000000..ac8523c --- /dev/null +++ b/subworkflows/nf-core/utils_nfcore_pipeline/tests/tags.yml @@ -0,0 +1,2 @@ +subworkflows/utils_nfcore_pipeline: + - subworkflows/nf-core/utils_nfcore_pipeline/** diff --git a/subworkflows/nf-core/utils_nfvalidation_plugin/main.nf b/subworkflows/nf-core/utils_nfvalidation_plugin/main.nf new file mode 100644 index 0000000..2585b65 --- /dev/null +++ b/subworkflows/nf-core/utils_nfvalidation_plugin/main.nf @@ -0,0 +1,62 @@ +// +// Subworkflow that uses the nf-validation plugin to render help text and parameter summary +// + +/* +======================================================================================== + IMPORT NF-VALIDATION PLUGIN +======================================================================================== +*/ + +include { paramsHelp } from 'plugin/nf-validation' +include { paramsSummaryLog } from 'plugin/nf-validation' +include { validateParameters } from 'plugin/nf-validation' + +/* +======================================================================================== + SUBWORKFLOW DEFINITION +======================================================================================== +*/ + +workflow UTILS_NFVALIDATION_PLUGIN { + + take: + print_help // boolean: print help + workflow_command // string: default commmand used to run pipeline + pre_help_text // string: string to be printed before help text and summary log + post_help_text // string: string to be printed after help text and summary log + validate_params // boolean: validate parameters + schema_filename // path: JSON schema file, null to use default value + + main: + + log.debug "Using schema file: ${schema_filename}" + + // Default values for strings + pre_help_text = pre_help_text ?: '' + post_help_text = post_help_text ?: '' + workflow_command = workflow_command ?: '' + + // + // Print help message if needed + // + if (print_help) { + log.info pre_help_text + paramsHelp(workflow_command, parameters_schema: schema_filename) + post_help_text + System.exit(0) + } + + // + // Print parameter summary to stdout + // + log.info pre_help_text + paramsSummaryLog(workflow, parameters_schema: schema_filename) + post_help_text + + // + // Validate parameters relative to the parameter JSON schema + // + if (validate_params){ + validateParameters(parameters_schema: schema_filename) + } + + emit: + dummy_emit = true +} diff --git a/subworkflows/nf-core/utils_nfvalidation_plugin/meta.yml b/subworkflows/nf-core/utils_nfvalidation_plugin/meta.yml new file mode 100644 index 0000000..3d4a6b0 --- /dev/null +++ b/subworkflows/nf-core/utils_nfvalidation_plugin/meta.yml @@ -0,0 +1,44 @@ +# yaml-language-server: $schema=https://raw.githubusercontent.com/nf-core/modules/master/subworkflows/yaml-schema.json +name: "UTILS_NFVALIDATION_PLUGIN" +description: Use nf-validation to initiate and validate a pipeline +keywords: + - utility + - pipeline + - initialise + - validation +components: [] +input: + - print_help: + type: boolean + description: | + Print help message and exit + - workflow_command: + type: string + description: | + The command to run the workflow e.g. "nextflow run main.nf" + - pre_help_text: + type: string + description: | + Text to print before the help message + - post_help_text: + type: string + description: | + Text to print after the help message + - validate_params: + type: boolean + description: | + Validate the parameters and error if invalid. + - schema_filename: + type: string + description: | + The filename of the schema to validate against. +output: + - dummy_emit: + type: boolean + description: | + Dummy emit to make nf-core subworkflows lint happy +authors: + - "@adamrtalbot" +maintainers: + - "@adamrtalbot" + - "@maxulysse" diff --git a/subworkflows/nf-core/utils_nfvalidation_plugin/tests/main.nf.test b/subworkflows/nf-core/utils_nfvalidation_plugin/tests/main.nf.test new file mode 100644 index 0000000..5784a33 --- /dev/null +++ b/subworkflows/nf-core/utils_nfvalidation_plugin/tests/main.nf.test @@ -0,0 +1,200 @@ +nextflow_workflow { + + name "Test Workflow UTILS_NFVALIDATION_PLUGIN" + script "../main.nf" + workflow "UTILS_NFVALIDATION_PLUGIN" + tag "subworkflows" + tag "subworkflows_nfcore" + tag "plugin/nf-validation" + tag "'plugin/nf-validation'" + tag "utils_nfvalidation_plugin" + tag "subworkflows/utils_nfvalidation_plugin" + + test("Should run nothing") { + + when { + + params { + monochrome_logs = true + test_data = '' + } + + workflow { + """ + help = false + workflow_command = null + pre_help_text = null + post_help_text = null + validate_params = false + schema_filename = "$moduleTestDir/nextflow_schema.json" + + input[0] = help + input[1] = workflow_command + input[2] = pre_help_text + input[3] = post_help_text + input[4] = validate_params + input[5] = schema_filename + """ + } + } + + then { + assertAll( + { assert workflow.success } + ) + } + } + + test("Should run help") { + + + when { + + params { + monochrome_logs = true + test_data = '' + } + workflow { + """ + help = true + workflow_command = null + pre_help_text = null + post_help_text = null + validate_params = false + schema_filename = "$moduleTestDir/nextflow_schema.json" + + input[0] = help + input[1] = workflow_command + input[2] = pre_help_text + input[3] = post_help_text + input[4] = validate_params + input[5] = schema_filename + """ + } + } + + then { + assertAll( + { assert workflow.success }, + { assert workflow.exitStatus == 0 }, + { assert workflow.stdout.any { it.contains('Input/output options') } }, + { assert workflow.stdout.any { it.contains('--outdir') } } + ) + } + } + + test("Should run help with command") { + + when { + + params { + monochrome_logs = true + test_data = '' + } + workflow { + """ + help = true + workflow_command = "nextflow run noorg/doesntexist" + pre_help_text = null + post_help_text = null + validate_params = false + schema_filename = "$moduleTestDir/nextflow_schema.json" + + input[0] = help + input[1] = workflow_command + input[2] = pre_help_text + input[3] = post_help_text + input[4] = validate_params + input[5] = schema_filename + """ + } + } + + then { + assertAll( + { assert workflow.success }, + { assert workflow.exitStatus == 0 }, + { assert workflow.stdout.any { it.contains('nextflow run noorg/doesntexist') } }, + { assert workflow.stdout.any { it.contains('Input/output options') } }, + { assert workflow.stdout.any { it.contains('--outdir') } } + ) + } + } + + test("Should run help with extra text") { + + + when { + + params { + monochrome_logs = true + test_data = '' + } + workflow { + """ + help = true + workflow_command = "nextflow run noorg/doesntexist" + pre_help_text = "pre-help-text" + post_help_text = "post-help-text" + validate_params = false + schema_filename = "$moduleTestDir/nextflow_schema.json" + + input[0] = help + input[1] = workflow_command + input[2] = pre_help_text + input[3] = post_help_text + input[4] = validate_params + input[5] = schema_filename + """ + } + } + + then { + assertAll( + { assert workflow.success }, + { assert workflow.exitStatus == 0 }, + { assert workflow.stdout.any { it.contains('pre-help-text') } }, + { assert workflow.stdout.any { it.contains('nextflow run noorg/doesntexist') } }, + { assert workflow.stdout.any { it.contains('Input/output options') } }, + { assert workflow.stdout.any { it.contains('--outdir') } }, + { assert workflow.stdout.any { it.contains('post-help-text') } } + ) + } + } + + test("Should validate params") { + + when { + + params { + monochrome_logs = true + test_data = '' + outdir = 1 + } + workflow { + """ + help = false + workflow_command = null + pre_help_text = null + post_help_text = null + validate_params = true + schema_filename = "$moduleTestDir/nextflow_schema.json" + + input[0] = help + input[1] = workflow_command + input[2] = pre_help_text + input[3] = post_help_text + input[4] = validate_params + input[5] = schema_filename + """ + } + } + + then { + assertAll( + { assert workflow.failed }, + { assert workflow.stdout.any { it.contains('ERROR ~ ERROR: Validation of pipeline parameters failed!') } } + ) + } + } +} diff --git a/subworkflows/nf-core/utils_nfvalidation_plugin/tests/nextflow_schema.json b/subworkflows/nf-core/utils_nfvalidation_plugin/tests/nextflow_schema.json new file mode 100644 index 0000000..7626c1c --- /dev/null +++ b/subworkflows/nf-core/utils_nfvalidation_plugin/tests/nextflow_schema.json @@ -0,0 +1,96 @@ +{ + "$schema": "http://json-schema.org/draft-07/schema", + "$id": "https://raw.githubusercontent.com/./master/nextflow_schema.json", + "title": ". pipeline parameters", + "description": "", + "type": "object", + "definitions": { + "input_output_options": { + "title": "Input/output options", + "type": "object", + "fa_icon": "fas fa-terminal", + "description": "Define where the pipeline should find input data and save output data.", + "required": ["outdir"], + "properties": { + "validate_params": { + "type": "boolean", + "description": "Validate parameters?", + "default": true, + "hidden": true + }, + "outdir": { + "type": "string", + "format": "directory-path", + "description": "The output directory where the results will be saved. You have to use absolute paths to storage on Cloud infrastructure.", + "fa_icon": "fas fa-folder-open" + }, + "test_data_base": { + "type": "string", + "default": "https://raw.githubusercontent.com/nf-core/test-datasets/modules", + "description": "Base for test data directory", + "hidden": true + }, + "test_data": { + "type": "string", + "description": "Fake test data param", + "hidden": true + } + } + }, + "generic_options": { + "title": "Generic options", + "type": "object", + "fa_icon": "fas fa-file-import", + "description": "Less common options for the pipeline, typically set in a config file.", + "help_text": "These options are common to all nf-core pipelines and allow you to customise some of the core preferences for how the pipeline runs.\n\nTypically these options would be set in a Nextflow config file loaded for all pipeline runs, such as `~/.nextflow/config`.", + "properties": { + "help": { + "type": "boolean", + "description": "Display help text.", + "fa_icon": "fas fa-question-circle", + "hidden": true + }, + "version": { + "type": "boolean", + "description": "Display version and exit.", + "fa_icon": "fas fa-question-circle", + "hidden": true + }, + "logo": { + "type": "boolean", + "default": true, + "description": "Display nf-core logo in console output.", + "fa_icon": "fas fa-image", + "hidden": true + }, + "singularity_pull_docker_container": { + "type": "boolean", + "description": "Pull Singularity container from Docker?", + "hidden": true + }, + "publish_dir_mode": { + "type": "string", + "default": "copy", + "description": "Method used to save pipeline results to output directory.", + "help_text": "The Nextflow `publishDir` option specifies which intermediate files should be saved to the output directory. This option tells the pipeline what method should be used to move these files. See [Nextflow docs](https://www.nextflow.io/docs/latest/process.html#publishdir) for details.", + "fa_icon": "fas fa-copy", + "enum": ["symlink", "rellink", "link", "copy", "copyNoFollow", "move"], + "hidden": true + }, + "monochrome_logs": { + "type": "boolean", + "description": "Use monochrome_logs", + "hidden": true + } + } + } + }, + "allOf": [ + { + "$ref": "#/definitions/input_output_options" + }, + { + "$ref": "#/definitions/generic_options" + } + ] +} diff --git a/subworkflows/nf-core/utils_nfvalidation_plugin/tests/tags.yml b/subworkflows/nf-core/utils_nfvalidation_plugin/tests/tags.yml new file mode 100644 index 0000000..60b1cff --- /dev/null +++ b/subworkflows/nf-core/utils_nfvalidation_plugin/tests/tags.yml @@ -0,0 +1,2 @@ +subworkflows/utils_nfvalidation_plugin: + - subworkflows/nf-core/utils_nfvalidation_plugin/** From 99d9a8fa3f242c4a6d80c2489ac5228a587d89aa Mon Sep 17 00:00:00 2001 From: Erik Fasterius Date: Tue, 5 Mar 2024 18:04:15 +0100 Subject: [PATCH 25/66] Add missing versions export for INPUT_CHECK --- subworkflows/local/input_check.nf | 10 ++++++++-- workflows/spatialtranscriptomics.nf | 1 + 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/subworkflows/local/input_check.nf b/subworkflows/local/input_check.nf index b51756b..06a9721 100644 --- a/subworkflows/local/input_check.nf +++ b/subworkflows/local/input_check.nf @@ -11,6 +11,9 @@ workflow INPUT_CHECK { samplesheet // file: samplesheet read in from --input main: + + ch_versions = Channel.empty() + ch_st = Channel.fromPath(samplesheet) .splitCsv ( header: true, sep: ',') .branch { @@ -30,6 +33,7 @@ workflow INPUT_CHECK { // Extract tarballed inputs UNTAR_SPACERANGER_INPUT ( ch_spaceranger.tar ) + ch_versions = ch_versions.mix(UNTAR_SPACERANGER_INPUT.out.versions) // Combine extracted and directory inputs into one channel ch_spaceranger_combined = UNTAR_SPACERANGER_INPUT.out.untar @@ -51,6 +55,7 @@ workflow INPUT_CHECK { // Extract tarballed inputs UNTAR_DOWNSTREAM_INPUT ( ch_downstream.tar ) + ch_versions = ch_versions.mix(UNTAR_DOWNSTREAM_INPUT.out.versions) // Combine extracted and directory inputs into one channel ch_downstream_combined = UNTAR_DOWNSTREAM_INPUT.out.untar @@ -61,8 +66,9 @@ workflow INPUT_CHECK { ch_downstream_input = ch_downstream_combined.map { create_channel_downstream(it) } emit: - ch_spaceranger_input // channel: [ val(meta), [ st data ] ] - ch_downstream_input // channel: [ val(meta), [ st data ] ] + ch_spaceranger_input // channel: [ val(meta), [ st data ] ] + ch_downstream_input // channel: [ val(meta), [ st data ] ] + versions = ch_versions // channel: [ versions.yml ] } // Function to get list of [ meta, [ spaceranger_dir ]] diff --git a/workflows/spatialtranscriptomics.nf b/workflows/spatialtranscriptomics.nf index 3d66ad0..0e88145 100644 --- a/workflows/spatialtranscriptomics.nf +++ b/workflows/spatialtranscriptomics.nf @@ -37,6 +37,7 @@ workflow SPATIALTRANSCRIPTOMICS { INPUT_CHECK ( samplesheet ) + ch_versions = ch_versions.mix(INPUT_CHECK.out.versions) // // MODULE: FastQC From 45de379713a5cef9ab6d5bc13df559b7849b34c8 Mon Sep 17 00:00:00 2001 From: Erik Fasterius Date: Tue, 5 Mar 2024 18:14:10 +0100 Subject: [PATCH 26/66] Add missing FastQC input to MultiQC --- workflows/spatialtranscriptomics.nf | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/workflows/spatialtranscriptomics.nf b/workflows/spatialtranscriptomics.nf index 0e88145..0caa945 100644 --- a/workflows/spatialtranscriptomics.nf +++ b/workflows/spatialtranscriptomics.nf @@ -46,7 +46,7 @@ workflow SPATIALTRANSCRIPTOMICS { INPUT_CHECK.out.ch_spaceranger_input.map{ it -> [it[0] /* meta */, it[1] /* reads */]} ) ch_versions = ch_versions.mix(FASTQC.out.versions) - // ch_multiqc_files = ch_multiqc_files.mix(FASTQC.out.zip.collect{it[1]}) + ch_multiqc_files = ch_multiqc_files.mix(FASTQC.out.zip.collect{it[1]}) // // SUBWORKFLOW: Space Ranger raw data processing @@ -82,7 +82,6 @@ workflow SPATIALTRANSCRIPTOMICS { ) ch_versions = ch_versions.mix(ST_DOWNSTREAM.out.versions) - // // Collate and save software versions // From 9b8e7d5b36baa58be9d54879bbf86c79e08bd749 Mon Sep 17 00:00:00 2001 From: Erik Fasterius Date: Tue, 5 Mar 2024 18:16:52 +0100 Subject: [PATCH 27/66] Update UNTAR module --- modules.json | 2 +- modules/nf-core/untar/tests/main.nf.test | 8 -------- modules/nf-core/untar/tests/main.nf.test.snap | 12 ++++++++++-- 3 files changed, 11 insertions(+), 11 deletions(-) diff --git a/modules.json b/modules.json index 39604d4..fa8e5ee 100644 --- a/modules.json +++ b/modules.json @@ -22,7 +22,7 @@ }, "untar": { "branch": "master", - "git_sha": "e719354ba77df0a1bd310836aa2039b45c29d620", + "git_sha": "5caf7640a9ef1d18d765d55339be751bb0969dfa", "installed_by": ["modules"] } } diff --git a/modules/nf-core/untar/tests/main.nf.test b/modules/nf-core/untar/tests/main.nf.test index 679e83c..2a7c97b 100644 --- a/modules/nf-core/untar/tests/main.nf.test +++ b/modules/nf-core/untar/tests/main.nf.test @@ -3,17 +3,12 @@ nextflow_process { name "Test Process UNTAR" script "../main.nf" process "UNTAR" - tag "modules" tag "modules_nfcore" tag "untar" - test("test_untar") { when { - params { - outdir = "$outputDir" - } process { """ input[0] = [ [], file(params.modules_testdata_base_path + 'genomics/sarscov2/genome/db/kraken2.tar.gz', checkIfExists: true) ] @@ -33,9 +28,6 @@ nextflow_process { test("test_untar_onlyfiles") { when { - params { - outdir = "$outputDir" - } process { """ input[0] = [ [], file(params.modules_testdata_base_path + 'generic/tar/hello.tar.gz', checkIfExists: true) ] diff --git a/modules/nf-core/untar/tests/main.nf.test.snap b/modules/nf-core/untar/tests/main.nf.test.snap index ace4257..6455029 100644 --- a/modules/nf-core/untar/tests/main.nf.test.snap +++ b/modules/nf-core/untar/tests/main.nf.test.snap @@ -12,7 +12,11 @@ ] ] ], - "timestamp": "2023-10-18T11:56:46.878844" + "meta": { + "nf-test": "0.8.4", + "nextflow": "23.10.1" + }, + "timestamp": "2024-02-28T11:49:41.320643" }, "test_untar": { "content": [ @@ -29,6 +33,10 @@ ] ] ], - "timestamp": "2023-10-18T11:56:08.16574" + "meta": { + "nf-test": "0.8.4", + "nextflow": "23.10.1" + }, + "timestamp": "2024-02-28T11:49:33.795172" } } \ No newline at end of file From c08398d32feac05849fc5f9e97c260583619d99b Mon Sep 17 00:00:00 2001 From: Erik Fasterius Date: Tue, 5 Mar 2024 20:04:18 +0100 Subject: [PATCH 28/66] Update nf-test with new downstream subworkflow --- modules/local/st_svg.nf | 2 +- subworkflows/local/st_downstream.nf | 2 +- tests/pipeline/lib/UTILS.groovy | 2 +- tests/pipeline/test_downstream.nf.test | 2 +- tests/pipeline/test_spaceranger_ffpe_v1.nf.test | 6 +++--- tests/pipeline/test_spaceranger_ffpe_v2_cytassist.nf.test | 6 +++--- 6 files changed, 10 insertions(+), 10 deletions(-) diff --git a/modules/local/st_svg.nf b/modules/local/st_svg.nf index 41c75f0..8ec9bc9 100644 --- a/modules/local/st_svg.nf +++ b/modules/local/st_svg.nf @@ -24,7 +24,7 @@ process ST_SVG { tuple val(meta), path(st_sdata) output: - tuple val(meta), path("*.csv") , emit: degs + tuple val(meta), path("*.csv") , emit: degs tuple val(meta), path("st_adata_svg.h5ad"), emit: st_adata_svg tuple val(meta), path("st_sdata_svg.zarr"), emit: st_sdata_svg tuple val(meta), path("st_svg.html") , emit: html diff --git a/subworkflows/local/st_downstream.nf b/subworkflows/local/st_downstream.nf index 8baaae5..70eb424 100644 --- a/subworkflows/local/st_downstream.nf +++ b/subworkflows/local/st_downstream.nf @@ -3,8 +3,8 @@ // include { ST_QUALITY_CONTROLS } from '../../modules/local/st_quality_controls' -include { ST_SVG } from '../../modules/local/st_svg' include { ST_CLUSTERING } from '../../modules/local/st_clustering' +include { ST_SVG } from '../../modules/local/st_svg' workflow ST_DOWNSTREAM { diff --git a/tests/pipeline/lib/UTILS.groovy b/tests/pipeline/lib/UTILS.groovy index 311403c..deacb58 100644 --- a/tests/pipeline/lib/UTILS.groovy +++ b/tests/pipeline/lib/UTILS.groovy @@ -2,7 +2,7 @@ class UTILS { public static String removeNextflowVersion(outputDir) { - def softwareVersions = path("$outputDir/pipeline_info/software_versions.yml").yaml + def softwareVersions = path("$outputDir/pipeline_info/nf_core_pipeline_software_mqc_versions.yml").yaml if (softwareVersions.containsKey("Workflow")) { softwareVersions.Workflow.remove("Nextflow") } diff --git a/tests/pipeline/test_downstream.nf.test b/tests/pipeline/test_downstream.nf.test index 881516f..77a81f5 100644 --- a/tests/pipeline/test_downstream.nf.test +++ b/tests/pipeline/test_downstream.nf.test @@ -22,7 +22,7 @@ nextflow_pipeline { assertAll( // Workflow { assert workflow.success }, - { assert snapshot(UTILS.removeNextflowVersion("$outputDir")).match("software_versions") }, + { assert snapshot(UTILS.removeNextflowVersion("$outputDir")).match("nf_core_pipeline_software_mqc_versions.yml") }, // Data { assert file("$outputDir/CytAssist_11mm_FFPE_Human_Glioblastoma_2/data/st_adata_processed.h5ad").exists() }, diff --git a/tests/pipeline/test_spaceranger_ffpe_v1.nf.test b/tests/pipeline/test_spaceranger_ffpe_v1.nf.test index fc02eaf..bceb8a1 100644 --- a/tests/pipeline/test_spaceranger_ffpe_v1.nf.test +++ b/tests/pipeline/test_spaceranger_ffpe_v1.nf.test @@ -20,7 +20,7 @@ nextflow_pipeline { // Workflow { assert workflow.success }, - { assert snapshot(UTILS.removeNextflowVersion("$outputDir")).match("software_versions") }, + { assert snapshot(UTILS.removeNextflowVersion("$outputDir")).match("nf_core_pipeline_software_mqc_versions.yml") }, // Data { assert file("$outputDir/Visium_FFPE_Human_Ovarian_Cancer/data/st_adata_processed.h5ad").exists() }, @@ -28,10 +28,10 @@ nextflow_pipeline { // Reports { assert file("$outputDir/Visium_FFPE_Human_Ovarian_Cancer/reports/st_quality_controls.html").text.contains("final results of all the filtering") }, { assert file("$outputDir/Visium_FFPE_Human_Ovarian_Cancer/reports/st_clustering.html").text.contains("spatial distribution of clusters") }, - { assert file("$outputDir/Visium_FFPE_Human_Ovarian_Cancer/reports/st_spatial_de.html").text.contains("plot the top spatially variable genes") }, + { assert file("$outputDir/Visium_FFPE_Human_Ovarian_Cancer/reports/st_svg.html").text.contains("plot the top spatially variable genes") }, // DEGs - { assert file("$outputDir/Visium_FFPE_Human_Ovarian_Cancer/degs/st_spatial_de.csv").exists() }, + { assert file("$outputDir/Visium_FFPE_Human_Ovarian_Cancer/degs/st_svg.csv").exists() }, // Space Ranger { assert file("$outputDir/Visium_FFPE_Human_Ovarian_Cancer/spaceranger/outs/web_summary.html").exists() }, diff --git a/tests/pipeline/test_spaceranger_ffpe_v2_cytassist.nf.test b/tests/pipeline/test_spaceranger_ffpe_v2_cytassist.nf.test index ab7a967..4dd8e8d 100644 --- a/tests/pipeline/test_spaceranger_ffpe_v2_cytassist.nf.test +++ b/tests/pipeline/test_spaceranger_ffpe_v2_cytassist.nf.test @@ -16,7 +16,7 @@ nextflow_pipeline { // Workflow { assert workflow.success }, - { assert snapshot(UTILS.removeNextflowVersion("$outputDir")).match("software_versions") }, + { assert snapshot(UTILS.removeNextflowVersion("$outputDir")).match("nf_core_pipeline_software_mqc_versions.yml") }, // Data { assert file("$outputDir/CytAssist_11mm_FFPE_Human_Glioblastoma_2/data/st_adata_processed.h5ad").exists() }, @@ -24,10 +24,10 @@ nextflow_pipeline { // Reports { assert file("$outputDir/CytAssist_11mm_FFPE_Human_Glioblastoma_2/reports/st_quality_controls.html").text.contains("final results of all the filtering") }, { assert file("$outputDir/CytAssist_11mm_FFPE_Human_Glioblastoma_2/reports/st_clustering.html").text.contains("spatial distribution of clusters") }, - { assert file("$outputDir/CytAssist_11mm_FFPE_Human_Glioblastoma_2/reports/st_spatial_de.html").text.contains("plot the top spatially variable genes") }, + { assert file("$outputDir/CytAssist_11mm_FFPE_Human_Glioblastoma_2/reports/st_svg.html").text.contains("plot the top spatially variable genes") }, // DEGs - { assert file("$outputDir/CytAssist_11mm_FFPE_Human_Glioblastoma_2/degs/st_spatial_de.csv").exists() }, + { assert file("$outputDir/CytAssist_11mm_FFPE_Human_Glioblastoma_2/degs/st_svg.csv").exists() }, // Space Ranger { assert file("$outputDir/CytAssist_11mm_FFPE_Human_Glioblastoma_2/spaceranger/outs/web_summary.html").exists() }, From 370004da7d3b35772c0b9030178eb7e5bc6fc8ea Mon Sep 17 00:00:00 2001 From: Erik Fasterius Date: Wed, 6 Mar 2024 14:04:51 +0100 Subject: [PATCH 29/66] Add missing Spaceranger MultiQC input --- workflows/spatialtranscriptomics.nf | 1 + 1 file changed, 1 insertion(+) diff --git a/workflows/spatialtranscriptomics.nf b/workflows/spatialtranscriptomics.nf index e50e68f..1e1fd5a 100644 --- a/workflows/spatialtranscriptomics.nf +++ b/workflows/spatialtranscriptomics.nf @@ -62,6 +62,7 @@ workflow SPATIALTRANSCRIPTOMICS { INPUT_CHECK.out.ch_spaceranger_input ) ch_versions = ch_versions.mix(SPACERANGER.out.versions) + ch_multiqc_files = ch_multiqc_files.mix(SPACERANGER.out.sr_dir.collect{it[1]}) ch_downstream_input = INPUT_CHECK.out.ch_downstream_input.concat(SPACERANGER.out.sr_dir).map{ meta, outs -> [meta, outs.findAll{ it -> DOWNSTREAM_REQUIRED_SPACERANGER_FILES.contains(it.name) }] } From 0600a1e24d650e0071144fc45a40cd1be0e3327a Mon Sep 17 00:00:00 2001 From: Erik Fasterius Date: Wed, 6 Mar 2024 14:08:43 +0100 Subject: [PATCH 30/66] Fix notebook name and zarr/h5ad output patterns --- conf/modules.config | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/conf/modules.config b/conf/modules.config index 3e27fe3..6114657 100644 --- a/conf/modules.config +++ b/conf/modules.config @@ -62,7 +62,7 @@ process { ] } - withName: 'ST_READ_DATA|ST_QUALITY_CONTROLS|ST_CLUSTERING|ST_SPATIAL_DE' { + withName: 'ST_READ_DATA|ST_QUALITY_CONTROLS|ST_CLUSTERING|ST_SVG' { ext.prefix = { "${notebook.baseName}" } publishDir = [ [ @@ -79,7 +79,7 @@ process { [ path: { "${params.outdir}/${meta.id}/data" }, mode: params.publish_dir_mode, - pattern: "artifacts/st_adata_processed.h5ad", + pattern: "artifacts/st_{a,s}data_processed.{h5ad,zarr}", saveAs: { "st_sdata_processed.zarr" } ], [ From d8067c6bc03efe564cd2f41315ca4f01bfc5ba8b Mon Sep 17 00:00:00 2001 From: Erik Fasterius Date: Thu, 7 Mar 2024 10:57:10 +0100 Subject: [PATCH 31/66] Fix SVG report test assertions --- tests/pipeline/test_downstream.nf.test | 7 ++++--- tests/pipeline/test_spaceranger_ffpe_v1.nf.test | 2 +- tests/pipeline/test_spaceranger_ffpe_v2_cytassist.nf.test | 2 +- 3 files changed, 6 insertions(+), 5 deletions(-) diff --git a/tests/pipeline/test_downstream.nf.test b/tests/pipeline/test_downstream.nf.test index 77a81f5..456f187 100644 --- a/tests/pipeline/test_downstream.nf.test +++ b/tests/pipeline/test_downstream.nf.test @@ -1,4 +1,4 @@ -nextflow_pipeline { +extflow_pipeline { name "Test downstream workflow (excl. Space Ranger)" script "main.nf" tag "pipeline" @@ -31,10 +31,11 @@ nextflow_pipeline { // Reports { assert file("$outputDir/CytAssist_11mm_FFPE_Human_Glioblastoma_2/reports/st_quality_controls.html").text.contains("final results of all the filtering") }, { assert file("$outputDir/CytAssist_11mm_FFPE_Human_Glioblastoma_2/reports/st_clustering.html").text.contains("spatial distribution of clusters") }, - { assert file("$outputDir/CytAssist_11mm_FFPE_Human_Glioblastoma_2/reports/st_svg.html").text.contains("plot the top spatially variable genes") }, + { assert + file("$outputDir/CytAssist_11mm_FFPE_Human_Glioblastoma_2/reports/st_svg.html").text.contains("Spatial transcriptomics data can give insight") }, { assert file("$outputDir/CytAssist_11mm_FFPE_Human_Glioblastoma_2.2/reports/st_quality_controls.html").text.contains("final results of all the filtering") }, { assert file("$outputDir/CytAssist_11mm_FFPE_Human_Glioblastoma_2.2/reports/st_clustering.html").text.contains("spatial distribution of clusters") }, - { assert file("$outputDir/CytAssist_11mm_FFPE_Human_Glioblastoma_2.2/reports/st_svg.html").text.contains("plot the top spatially variable genes") }, + { assert file("$outputDir/CytAssist_11mm_FFPE_Human_Glioblastoma_2.2/reports/st_svg.html").text.contains("Spatial transcriptomics data can give insight") }, // DEGs { assert file("$outputDir/CytAssist_11mm_FFPE_Human_Glioblastoma_2/degs/st_svg.csv").exists() }, diff --git a/tests/pipeline/test_spaceranger_ffpe_v1.nf.test b/tests/pipeline/test_spaceranger_ffpe_v1.nf.test index bceb8a1..e1ef7fa 100644 --- a/tests/pipeline/test_spaceranger_ffpe_v1.nf.test +++ b/tests/pipeline/test_spaceranger_ffpe_v1.nf.test @@ -28,7 +28,7 @@ nextflow_pipeline { // Reports { assert file("$outputDir/Visium_FFPE_Human_Ovarian_Cancer/reports/st_quality_controls.html").text.contains("final results of all the filtering") }, { assert file("$outputDir/Visium_FFPE_Human_Ovarian_Cancer/reports/st_clustering.html").text.contains("spatial distribution of clusters") }, - { assert file("$outputDir/Visium_FFPE_Human_Ovarian_Cancer/reports/st_svg.html").text.contains("plot the top spatially variable genes") }, + { assert file("$outputDir/Visium_FFPE_Human_Ovarian_Cancer/reports/st_svg.html").text.contains("Spatial transcriptomics data can give insight") }, // DEGs { assert file("$outputDir/Visium_FFPE_Human_Ovarian_Cancer/degs/st_svg.csv").exists() }, diff --git a/tests/pipeline/test_spaceranger_ffpe_v2_cytassist.nf.test b/tests/pipeline/test_spaceranger_ffpe_v2_cytassist.nf.test index 4dd8e8d..3be133d 100644 --- a/tests/pipeline/test_spaceranger_ffpe_v2_cytassist.nf.test +++ b/tests/pipeline/test_spaceranger_ffpe_v2_cytassist.nf.test @@ -24,7 +24,7 @@ nextflow_pipeline { // Reports { assert file("$outputDir/CytAssist_11mm_FFPE_Human_Glioblastoma_2/reports/st_quality_controls.html").text.contains("final results of all the filtering") }, { assert file("$outputDir/CytAssist_11mm_FFPE_Human_Glioblastoma_2/reports/st_clustering.html").text.contains("spatial distribution of clusters") }, - { assert file("$outputDir/CytAssist_11mm_FFPE_Human_Glioblastoma_2/reports/st_svg.html").text.contains("plot the top spatially variable genes") }, + { assert file("$outputDir/CytAssist_11mm_FFPE_Human_Glioblastoma_2/reports/st_svg.html").text.contains("Spatial transcriptomics data can give insight") }, // DEGs { assert file("$outputDir/CytAssist_11mm_FFPE_Human_Glioblastoma_2/degs/st_svg.csv").exists() }, From bef1ce58a2033f144d1ec866307acf7f55957b2e Mon Sep 17 00:00:00 2001 From: Erik Fasterius Date: Thu, 7 Mar 2024 10:59:56 +0100 Subject: [PATCH 32/66] Delete old spatial DE report --- bin/st_spatial_de.qmd | 1 - 1 file changed, 1 deletion(-) delete mode 100644 bin/st_spatial_de.qmd diff --git a/bin/st_spatial_de.qmd b/bin/st_spatial_de.qmd deleted file mode 100644 index 8b13789..0000000 --- a/bin/st_spatial_de.qmd +++ /dev/null @@ -1 +0,0 @@ - From c49f8805528158b35ab179bac4b65550dd941777 Mon Sep 17 00:00:00 2001 From: Erik Fasterius Date: Thu, 7 Mar 2024 12:13:36 +0100 Subject: [PATCH 33/66] Fix publishing of AnnData object --- bin/st_clustering.qmd | 2 +- conf/modules.config | 8 +++++++- subworkflows/local/st_downstream.nf | 3 ++- 3 files changed, 10 insertions(+), 3 deletions(-) diff --git a/bin/st_clustering.qmd b/bin/st_clustering.qmd index e98fc53..ba26fb9 100644 --- a/bin/st_clustering.qmd +++ b/bin/st_clustering.qmd @@ -173,8 +173,8 @@ sc.pl.spatial(st_adata, img_key="hires", color="clusters", size=1.25) ```{python} #| echo: false -st_adata.write(os.path.join(artifact_dir, output_adata_processed)) del st_sdata.table st_sdata.table = st_adata +st_adata.write(os.path.join(artifact_dir, output_adata_processed)) st_sdata.write(os.path.join(artifact_dir, output_sdata)) ``` diff --git a/conf/modules.config b/conf/modules.config index 6114657..9d7fc44 100644 --- a/conf/modules.config +++ b/conf/modules.config @@ -79,9 +79,15 @@ process { [ path: { "${params.outdir}/${meta.id}/data" }, mode: params.publish_dir_mode, - pattern: "artifacts/st_{a,s}data_processed.{h5ad,zarr}", + pattern: "artifacts/st_sdata_processed.zarr", saveAs: { "st_sdata_processed.zarr" } ], + [ + path: { "${params.outdir}/${meta.id}/data" }, + mode: params.publish_dir_mode, + pattern: "artifacts/st_adata_processed.h5ad", + saveAs: { "st_adata_processed.h5ad" } + ], [ path: { "${params.outdir}/${meta.id}/degs" }, mode: params.publish_dir_mode, diff --git a/subworkflows/local/st_downstream.nf b/subworkflows/local/st_downstream.nf index d728476..4861f60 100644 --- a/subworkflows/local/st_downstream.nf +++ b/subworkflows/local/st_downstream.nf @@ -59,7 +59,8 @@ workflow ST_DOWNSTREAM { input_sdata_filtered: "st_adata_filtered.zarr", cluster_resolution: params.st_cluster_resolution, n_hvgs: params.st_cluster_n_hvgs, - output_sdata_processed: "st_sdata_processed.zarr" + output_adata_processed: "st_adata_processed.h5ad", + output_sdata: "st_sdata_processed.zarr" ] ST_CLUSTERING ( ch_clustering_notebook, From 3245e1723b63c48f2d2e105111ac6c9caf84bf82 Mon Sep 17 00:00:00 2001 From: Erik Fasterius Date: Thu, 7 Mar 2024 13:02:09 +0100 Subject: [PATCH 34/66] Fix publishing of DEG CSV --- bin/st_svg.qmd | 18 ++++++++++-------- conf/modules.config | 3 ++- subworkflows/local/st_downstream.nf | 6 ++++-- 3 files changed, 16 insertions(+), 11 deletions(-) diff --git a/bin/st_svg.qmd b/bin/st_svg.qmd index f3c401b..1951e4c 100644 --- a/bin/st_svg.qmd +++ b/bin/st_svg.qmd @@ -9,18 +9,20 @@ jupyter: python3 ```{python} #| tags: [parameters] #| echo: false -input_sdata = "st_sdata.zarr" -output_adata_svg = "st_adata_svg.h5ad" # Name of the output anndata file -output_sdata = "st_sdata_svg.zarr" # Name of the input anndata file -output_spatial_degs = "st_svg.csv" -n_top_spatial_degs = 14 +input_sdata = "st_sdata_processed.zarr" # Input: SpatialData file +output_adata_svg = "st_adata_svg.h5ad" # Output: AnnData file +output_sdata = "st_sdata_svg.zarr" # Output: SpatialData file +output_svg = "st_svg.csv" # Output: spatially variable genes +n_top_spatial_degs = 14 # Parameter: number of SVG to plot in report +artifact_dir = "artifacts" ``` ```{python} -import scanpy as sc +import numpy as np +import os import pandas as pd +import scanpy as sc import squidpy as sq -import numpy as np import spatialdata from anndata import AnnData from matplotlib import pyplot as plt @@ -131,5 +133,5 @@ st_sdata.write("./" + output_sdata) ``` ```{python} -st_adata.uns["moranI"].to_csv(output_spatial_degs) +st_adata.uns["moranI"].to_csv(os.path.join(artifact_dir, output_svg)) ``` diff --git a/conf/modules.config b/conf/modules.config index 9d7fc44..7f01fe2 100644 --- a/conf/modules.config +++ b/conf/modules.config @@ -91,7 +91,8 @@ process { [ path: { "${params.outdir}/${meta.id}/degs" }, mode: params.publish_dir_mode, - pattern: "*.csv" + pattern: "artifacts/st_svg.csv", + saveAs: { "st_svg.csv" } ] ] } diff --git a/subworkflows/local/st_downstream.nf b/subworkflows/local/st_downstream.nf index 4861f60..014e2c3 100644 --- a/subworkflows/local/st_downstream.nf +++ b/subworkflows/local/st_downstream.nf @@ -79,8 +79,10 @@ workflow ST_DOWNSTREAM { .map { tuple(it[0], svg_file) } svg_params = [ input_sdata: "st_sdata_processed.zarr", - n_top_spatial_degs: params.st_n_top_spatial_degs, - output_svg: "st_svg.csv" + output_adata_svg: "st_adata_svg.h5ad", + output_sdata: "st_sdata_svg.zarr", + output_svg: "st_svg.csv", + n_top_spatial_degs: params.st_n_top_spatial_degs ] ST_SVG ( ch_svg_notebook, From d5f16b439e0aacd653df140516d5c93f775f23c6 Mon Sep 17 00:00:00 2001 From: Erik Fasterius Date: Thu, 7 Mar 2024 13:36:29 +0100 Subject: [PATCH 35/66] Add testing of SpatialData output --- tests/pipeline/test_downstream.nf.test | 8 +++++--- tests/pipeline/test_spaceranger_ffpe_v1.nf.test | 1 + tests/pipeline/test_spaceranger_ffpe_v2_cytassist.nf.test | 1 + 3 files changed, 7 insertions(+), 3 deletions(-) diff --git a/tests/pipeline/test_downstream.nf.test b/tests/pipeline/test_downstream.nf.test index 456f187..8c400aa 100644 --- a/tests/pipeline/test_downstream.nf.test +++ b/tests/pipeline/test_downstream.nf.test @@ -1,4 +1,4 @@ -extflow_pipeline { +nextflow_pipeline { name "Test downstream workflow (excl. Space Ranger)" script "main.nf" tag "pipeline" @@ -20,19 +20,21 @@ extflow_pipeline { then { assertAll( + // Workflow { assert workflow.success }, { assert snapshot(UTILS.removeNextflowVersion("$outputDir")).match("nf_core_pipeline_software_mqc_versions.yml") }, // Data { assert file("$outputDir/CytAssist_11mm_FFPE_Human_Glioblastoma_2/data/st_adata_processed.h5ad").exists() }, + { assert path("$outputDir/CytAssist_11mm_FFPE_Human_Glioblastoma_2/data/st_sdata_processed.zarr").exists() }, { assert file("$outputDir/CytAssist_11mm_FFPE_Human_Glioblastoma_2.2/data/st_adata_processed.h5ad").exists() }, + { assert path("$outputDir/CytAssist_11mm_FFPE_Human_Glioblastoma_2.2/data/st_sdata_processed.zarr").exists() }, // Reports { assert file("$outputDir/CytAssist_11mm_FFPE_Human_Glioblastoma_2/reports/st_quality_controls.html").text.contains("final results of all the filtering") }, { assert file("$outputDir/CytAssist_11mm_FFPE_Human_Glioblastoma_2/reports/st_clustering.html").text.contains("spatial distribution of clusters") }, - { assert - file("$outputDir/CytAssist_11mm_FFPE_Human_Glioblastoma_2/reports/st_svg.html").text.contains("Spatial transcriptomics data can give insight") }, + { assert file("$outputDir/CytAssist_11mm_FFPE_Human_Glioblastoma_2/reports/st_svg.html").text.contains("Spatial transcriptomics data can give insight") }, { assert file("$outputDir/CytAssist_11mm_FFPE_Human_Glioblastoma_2.2/reports/st_quality_controls.html").text.contains("final results of all the filtering") }, { assert file("$outputDir/CytAssist_11mm_FFPE_Human_Glioblastoma_2.2/reports/st_clustering.html").text.contains("spatial distribution of clusters") }, { assert file("$outputDir/CytAssist_11mm_FFPE_Human_Glioblastoma_2.2/reports/st_svg.html").text.contains("Spatial transcriptomics data can give insight") }, diff --git a/tests/pipeline/test_spaceranger_ffpe_v1.nf.test b/tests/pipeline/test_spaceranger_ffpe_v1.nf.test index e1ef7fa..25abe67 100644 --- a/tests/pipeline/test_spaceranger_ffpe_v1.nf.test +++ b/tests/pipeline/test_spaceranger_ffpe_v1.nf.test @@ -24,6 +24,7 @@ nextflow_pipeline { // Data { assert file("$outputDir/Visium_FFPE_Human_Ovarian_Cancer/data/st_adata_processed.h5ad").exists() }, + { assert file("$outputDir/Visium_FFPE_Human_Ovarian_Cancer/data/st_sdata_processed.zarr").exists() }, // Reports { assert file("$outputDir/Visium_FFPE_Human_Ovarian_Cancer/reports/st_quality_controls.html").text.contains("final results of all the filtering") }, diff --git a/tests/pipeline/test_spaceranger_ffpe_v2_cytassist.nf.test b/tests/pipeline/test_spaceranger_ffpe_v2_cytassist.nf.test index 3be133d..8b4638d 100644 --- a/tests/pipeline/test_spaceranger_ffpe_v2_cytassist.nf.test +++ b/tests/pipeline/test_spaceranger_ffpe_v2_cytassist.nf.test @@ -20,6 +20,7 @@ nextflow_pipeline { // Data { assert file("$outputDir/CytAssist_11mm_FFPE_Human_Glioblastoma_2/data/st_adata_processed.h5ad").exists() }, + { assert file("$outputDir/CytAssist_11mm_FFPE_Human_Glioblastoma_2/data/st_sdata_processed.zarr").exists() }, // Reports { assert file("$outputDir/CytAssist_11mm_FFPE_Human_Glioblastoma_2/reports/st_quality_controls.html").text.contains("final results of all the filtering") }, From fcd540450bcc28be7739f7460cbf928535d19ecf Mon Sep 17 00:00:00 2001 From: Erik Fasterius Date: Thu, 7 Mar 2024 14:09:03 +0100 Subject: [PATCH 36/66] Minor formatting --- bin/st_clustering.qmd | 16 ++++++++-------- bin/st_quality_controls.qmd | 8 +++----- bin/st_svg.qmd | 8 ++++---- 3 files changed, 15 insertions(+), 17 deletions(-) diff --git a/bin/st_clustering.qmd b/bin/st_clustering.qmd index ba26fb9..ccb91ba 100644 --- a/bin/st_clustering.qmd +++ b/bin/st_clustering.qmd @@ -11,13 +11,12 @@ jupyter: python3 ```{python} #| tags: [parameters] #| echo: false - -input_sdata = "st_sdata_filtered.zarr" # Name of the input anndata file +input_sdata = "st_sdata_filtered.zarr" # Input: SpatialData file cluster_resolution = 1 # Resolution for Leiden clustering n_hvgs = 2000 # Number of HVGs to use for analyses -artifact_dir = "artifacts" -output_adata_processed = "st_adata_processed.h5ad" # Name of the output anndata file -output_sdata = "st_sdata_processed.zarr" # Name of the input anndata file +artifact_dir = "artifacts" # Output directory +output_sdata = "st_sdata_processed.zarr" # Output: SpatialData file +output_adata_processed = "st_adata_processed.h5ad" # Output: AnnData file ``` The data has already been filtered in the _quality controls_ reports and is @@ -39,9 +38,10 @@ from IPython.display import display, Markdown ``` ```{python} -# Make sure we can use scanpy plots with the AnnData object exported from sdata.table -# This code is taken from the early version of https://github.com/scverse/spatialdata-io/pull/102/ -# Once the PR will be merged in spatialdata-io, we should use spatialdata_io.to_legacy_anndata(sdata). +# Make sure we can use scanpy plots with the AnnData object exported from +# `sdata.table`. This code is taken from the early version of https://github.com/scverse/spatialdata-io/pull/102/ +# Once that PR is merged into spatialdata-io, we should instead use +# `spatialdata_io.to_legacy_anndata(sdata)`. def to_legacy_anndata(sdata: spatialdata.SpatialData) -> AnnData: adata = sdata.table for dataset_id in adata.uns["spatial"]: diff --git a/bin/st_quality_controls.qmd b/bin/st_quality_controls.qmd index 125beb2..ecd19a0 100644 --- a/bin/st_quality_controls.qmd +++ b/bin/st_quality_controls.qmd @@ -26,7 +26,7 @@ analysis tools and facilitates seamless integration into existing workflows. ```{python} #| tags: [parameters] #| echo: false -input_sdata = "st_sdata_raw.zarr" # Name of the input anndata file +input_sdata = "st_sdata_raw.zarr" # Input: SpatialData file min_counts = 500 # Min counts per spot min_genes = 250 # Min genes per spot min_spots = 1 # Min spots per gene @@ -34,8 +34,8 @@ mito_threshold = 20 # Mitochondrial content threshold (%) ribo_threshold = 0 # Ribosomal content threshold (%) hb_threshold = 100 # content threshold (%) artifact_dir = "artifacts" -output_sdata = "st_sdata_filtered.zarr" # Name of the output zarr file -output_adata_filtered = "st_adata_filtered.h5ad" # Name of the output anndata file +output_sdata = "st_sdata_filtered.zarr" # Output: SpatialData file +output_adata_filtered = "st_adata_filtered.h5ad" # Output: AnnData file ``` ```{python} @@ -78,9 +78,7 @@ def to_legacy_anndata(sdata: spatialdata.SpatialData) -> AnnData: ```{python} # Read the data - st_sdata = spatialdata.read_zarr(input_sdata, ["images", "table", "shapes"]) - st_adata = to_legacy_anndata(st_sdata) # Convert X matrix from csr to csc dense matrix for output compatibility: diff --git a/bin/st_svg.qmd b/bin/st_svg.qmd index 1951e4c..e9f7b00 100644 --- a/bin/st_svg.qmd +++ b/bin/st_svg.qmd @@ -9,12 +9,12 @@ jupyter: python3 ```{python} #| tags: [parameters] #| echo: false -input_sdata = "st_sdata_processed.zarr" # Input: SpatialData file +input_sdata = "st_sdata_processed.zarr" # Input: SpatialData file +n_top_spatial_degs = 14 # Number of SVG to plot in report +artifact_dir = "artifacts" # Output directory output_adata_svg = "st_adata_svg.h5ad" # Output: AnnData file output_sdata = "st_sdata_svg.zarr" # Output: SpatialData file -output_svg = "st_svg.csv" # Output: spatially variable genes -n_top_spatial_degs = 14 # Parameter: number of SVG to plot in report -artifact_dir = "artifacts" +output_svg = "st_svg.csv" # Output: spatially variable genes ``` ```{python} From 496a96ee4a8898cc8a9619fd1b5f58b36cf4d344 Mon Sep 17 00:00:00 2001 From: Erik Fasterius Date: Thu, 7 Mar 2024 14:28:36 +0100 Subject: [PATCH 37/66] Update snapshots --- tests/pipeline/test_downstream.nf.test.snap | 12 ++++++++---- .../test_spaceranger_ffpe_v1.nf.test.snap | 16 +++++++++++++++- ...st_spaceranger_ffpe_v2_cytassist.nf.test.snap | 12 ++++++++---- 3 files changed, 31 insertions(+), 9 deletions(-) diff --git a/tests/pipeline/test_downstream.nf.test.snap b/tests/pipeline/test_downstream.nf.test.snap index 75f12d8..4587197 100644 --- a/tests/pipeline/test_downstream.nf.test.snap +++ b/tests/pipeline/test_downstream.nf.test.snap @@ -1,8 +1,12 @@ { - "software_versions": { + "nf_core_pipeline_software_mqc_versions.yml": { "content": [ - "{CUSTOM_DUMPSOFTWAREVERSIONS={python=3.11.7, yaml=5.4.1}, SPACERANGER_UNTAR_REFERENCE={untar=1.30}, ST_CLUSTERING={quarto=1.3.302, scanpy=1.9.3}, ST_QUALITY_CONTROLS={quarto=1.3.302, scanpy=1.9.3}, ST_READ_DATA={scanpy=1.7.2}, ST_SPATIAL_DE={SpatialDE=1.1.3, leidenalg=0.9.1, quarto=1.3.302, scanpy=1.9.3}, Workflow={nf-core/spatialtranscriptomics=1.0dev}}" + "{SPACERANGER_UNTAR_REFERENCE={untar=1.3}, ST_CLUSTERING={quarto=1.4.549, papermill=null}, ST_QUALITY_CONTROLS={quarto=1.4.549, papermill=null}, ST_READ_DATA={scanpy=1.9.8}, ST_SVG={quarto=1.4.549, papermill=null}, UNTAR_DOWNSTREAM_INPUT={untar=1.3}, Workflow={nf-core/spatialtranscriptomics=v1.0dev}}" ], - "timestamp": "2024-01-15T16:00:03.485826" + "meta": { + "nf-test": "0.8.4", + "nextflow": "23.10.1" + }, + "timestamp": "2024-03-07T13:23:56.226763" } -} +} \ No newline at end of file diff --git a/tests/pipeline/test_spaceranger_ffpe_v1.nf.test.snap b/tests/pipeline/test_spaceranger_ffpe_v1.nf.test.snap index 441c711..c36ecfc 100644 --- a/tests/pipeline/test_spaceranger_ffpe_v1.nf.test.snap +++ b/tests/pipeline/test_spaceranger_ffpe_v1.nf.test.snap @@ -3,6 +3,20 @@ "content": [ "{CUSTOM_DUMPSOFTWAREVERSIONS={python=3.11.7, yaml=5.4.1}, FASTQC={fastqc=0.12.1}, SPACERANGER_COUNT={spaceranger=2.1.0}, SPACERANGER_UNTAR_REFERENCE={untar=1.30}, ST_CLUSTERING={quarto=1.3.302, scanpy=1.9.3}, ST_QUALITY_CONTROLS={quarto=1.3.302, scanpy=1.9.3}, ST_READ_DATA={scanpy=1.7.2}, ST_SPATIAL_DE={SpatialDE=1.1.3, leidenalg=0.9.1, quarto=1.3.302, scanpy=1.9.3}, Workflow={nf-core/spatialtranscriptomics=1.0dev}}" ], + "meta": { + "nf-test": "0.8.4", + "nextflow": "23.10.1" + }, "timestamp": "2024-01-15T13:44:40.789425" + }, + "nf_core_pipeline_software_mqc_versions.yml": { + "content": [ + "{FASTQC={fastqc=0.12.1}, SPACERANGER_COUNT={spaceranger=2.1.0}, SPACERANGER_UNTAR_REFERENCE={untar=1.3}, ST_CLUSTERING={quarto=1.4.549, papermill=null}, ST_QUALITY_CONTROLS={quarto=1.4.549, papermill=null}, ST_READ_DATA={scanpy=1.9.8}, ST_SVG={quarto=1.4.549, papermill=null}, UNTAR_SPACERANGER_INPUT={untar=1.3}, Workflow={nf-core/spatialtranscriptomics=v1.0dev}}" + ], + "meta": { + "nf-test": "0.8.4", + "nextflow": "23.10.1" + }, + "timestamp": "2024-03-07T13:55:24.407294" } -} +} \ No newline at end of file diff --git a/tests/pipeline/test_spaceranger_ffpe_v2_cytassist.nf.test.snap b/tests/pipeline/test_spaceranger_ffpe_v2_cytassist.nf.test.snap index 1dad690..02e6954 100644 --- a/tests/pipeline/test_spaceranger_ffpe_v2_cytassist.nf.test.snap +++ b/tests/pipeline/test_spaceranger_ffpe_v2_cytassist.nf.test.snap @@ -1,8 +1,12 @@ { - "software_versions": { + "nf_core_pipeline_software_mqc_versions.yml": { "content": [ - "{CUSTOM_DUMPSOFTWAREVERSIONS={python=3.11.7, yaml=5.4.1}, FASTQC={fastqc=0.12.1}, SPACERANGER_COUNT={spaceranger=2.1.0}, SPACERANGER_UNTAR_REFERENCE={untar=1.30}, ST_CLUSTERING={quarto=1.3.302, scanpy=1.9.3}, ST_QUALITY_CONTROLS={quarto=1.3.302, scanpy=1.9.3}, ST_READ_DATA={scanpy=1.7.2}, ST_SPATIAL_DE={SpatialDE=1.1.3, leidenalg=0.9.1, quarto=1.3.302, scanpy=1.9.3}, Workflow={nf-core/spatialtranscriptomics=1.0dev}}" + "{FASTQC={fastqc=0.12.1}, SPACERANGER_COUNT={spaceranger=2.1.0}, SPACERANGER_UNTAR_REFERENCE={untar=1.3}, ST_CLUSTERING={quarto=1.4.549, papermill=null}, ST_QUALITY_CONTROLS={quarto=1.4.549, papermill=null}, ST_READ_DATA={scanpy=1.9.8}, ST_SVG={quarto=1.4.549, papermill=null}, UNTAR_SPACERANGER_INPUT={untar=1.3}, Workflow={nf-core/spatialtranscriptomics=v1.0dev}}" ], - "timestamp": "2024-01-15T15:42:52.651007" + "meta": { + "nf-test": "0.8.4", + "nextflow": "23.10.1" + }, + "timestamp": "2024-03-07T14:28:20.163729" } -} +} \ No newline at end of file From 9e907df546b077df470927f763ea99e5049dfe81 Mon Sep 17 00:00:00 2001 From: Erik Fasterius Date: Tue, 19 Mar 2024 14:37:49 +0100 Subject: [PATCH 38/66] Rename SVG to spatially variable genes --- bin/st_clustering.qmd | 7 +- bin/st_quality_controls.qmd | 2 +- ...vg.qmd => st_spatially_variable_genes.qmd} | 12 +-- conf/modules.config | 6 +- docs/output.md | 4 +- subworkflows/local/st_downstream.nf | 80 ++++++++++--------- tests/pipeline/test_downstream.nf.test | 8 +- tests/pipeline/test_downstream.nf.test.snap | 4 +- .../pipeline/test_spaceranger_ffpe_v1.nf.test | 4 +- .../test_spaceranger_ffpe_v1.nf.test.snap | 4 +- ...test_spaceranger_ffpe_v2_cytassist.nf.test | 4 +- ...spaceranger_ffpe_v2_cytassist.nf.test.snap | 4 +- 12 files changed, 71 insertions(+), 68 deletions(-) rename bin/{st_svg.qmd => st_spatially_variable_genes.qmd} (93%) diff --git a/bin/st_clustering.qmd b/bin/st_clustering.qmd index ccb91ba..e7516c5 100644 --- a/bin/st_clustering.qmd +++ b/bin/st_clustering.qmd @@ -15,8 +15,8 @@ input_sdata = "st_sdata_filtered.zarr" # Input: SpatialData file cluster_resolution = 1 # Resolution for Leiden clustering n_hvgs = 2000 # Number of HVGs to use for analyses artifact_dir = "artifacts" # Output directory +output_adata = "st_adata_processed.h5ad" # Output: AnnData file output_sdata = "st_sdata_processed.zarr" # Output: SpatialData file -output_adata_processed = "st_adata_processed.h5ad" # Output: AnnData file ``` The data has already been filtered in the _quality controls_ reports and is @@ -62,8 +62,7 @@ def to_legacy_anndata(sdata: spatialdata.SpatialData) -> AnnData: ``` ```{python} -st_sdata = spatialdata.read_zarr("./" + input_sdata, ["images", "table", "shapes"]) - +st_sdata = spatialdata.read_zarr(input_sdata, ["images", "table", "shapes"]) st_adata = to_legacy_anndata(st_sdata) print("Content of the AnnData object:") @@ -175,6 +174,6 @@ sc.pl.spatial(st_adata, img_key="hires", color="clusters", size=1.25) #| echo: false del st_sdata.table st_sdata.table = st_adata -st_adata.write(os.path.join(artifact_dir, output_adata_processed)) +st_adata.write(os.path.join(artifact_dir, output_adata)) st_sdata.write(os.path.join(artifact_dir, output_sdata)) ``` diff --git a/bin/st_quality_controls.qmd b/bin/st_quality_controls.qmd index ecd19a0..0586b88 100644 --- a/bin/st_quality_controls.qmd +++ b/bin/st_quality_controls.qmd @@ -34,8 +34,8 @@ mito_threshold = 20 # Mitochondrial content threshold (%) ribo_threshold = 0 # Ribosomal content threshold (%) hb_threshold = 100 # content threshold (%) artifact_dir = "artifacts" +output_adata = "st_adata_filtered.h5ad" # Output: AnnData file output_sdata = "st_sdata_filtered.zarr" # Output: SpatialData file -output_adata_filtered = "st_adata_filtered.h5ad" # Output: AnnData file ``` ```{python} diff --git a/bin/st_svg.qmd b/bin/st_spatially_variable_genes.qmd similarity index 93% rename from bin/st_svg.qmd rename to bin/st_spatially_variable_genes.qmd index e9f7b00..2e60664 100644 --- a/bin/st_svg.qmd +++ b/bin/st_spatially_variable_genes.qmd @@ -10,11 +10,11 @@ jupyter: python3 #| tags: [parameters] #| echo: false input_sdata = "st_sdata_processed.zarr" # Input: SpatialData file -n_top_spatial_degs = 14 # Number of SVG to plot in report +n_top_spatial_degs = 14 # Number of spatially variable genes to plot artifact_dir = "artifacts" # Output directory -output_adata_svg = "st_adata_svg.h5ad" # Output: AnnData file -output_sdata = "st_sdata_svg.zarr" # Output: SpatialData file -output_svg = "st_svg.csv" # Output: spatially variable genes +output_csv = "st_spatially_variable_genes.csv" # Output: gene list +output_adata = "st_adata_spatially_variable_genes.h5ad" # Output: AnnData file +output_sdata = "st_sdata.zarr" # Output: SpatialData file ``` ```{python} @@ -126,12 +126,12 @@ st_adata.uns["moranI"].head(n_top_spatial_degs) ```{python} #| echo: false -st_adata.write(output_adata_svg) +st_adata.write(output_adata) del st_sdata.table st_sdata.table = st_adata st_sdata.write("./" + output_sdata) ``` ```{python} -st_adata.uns["moranI"].to_csv(os.path.join(artifact_dir, output_svg)) +st_adata.uns["moranI"].to_csv(os.path.join(artifact_dir, output_csv)) ``` diff --git a/conf/modules.config b/conf/modules.config index 7f01fe2..5d48d0b 100644 --- a/conf/modules.config +++ b/conf/modules.config @@ -62,7 +62,7 @@ process { ] } - withName: 'ST_READ_DATA|ST_QUALITY_CONTROLS|ST_CLUSTERING|ST_SVG' { + withName: 'ST_READ_DATA|ST_QUALITY_CONTROLS|ST_CLUSTERING|ST_SPATIALLY_VARIABLE_GENES' { ext.prefix = { "${notebook.baseName}" } publishDir = [ [ @@ -91,8 +91,8 @@ process { [ path: { "${params.outdir}/${meta.id}/degs" }, mode: params.publish_dir_mode, - pattern: "artifacts/st_svg.csv", - saveAs: { "st_svg.csv" } + pattern: "artifacts/st_spatially_variable_genes.csv", + saveAs: { "st_spatially_variable_genes.csv" } ] ] } diff --git a/docs/output.md b/docs/output.md index 875c683..98f17c9 100644 --- a/docs/output.md +++ b/docs/output.md @@ -99,9 +99,9 @@ option; you can find more details in the report itself. Output files - `/reports/` - - `st_svg.html`: HTML report. + - `st_spatially_variable_genes.html`: HTML report. - `/degs/` - - `st_svg.csv`: List of spatially variable genes. + - `st_spatially_variable_genes.csv`: List of spatially variable genes. diff --git a/subworkflows/local/st_downstream.nf b/subworkflows/local/st_downstream.nf index 014e2c3..6cef709 100644 --- a/subworkflows/local/st_downstream.nf +++ b/subworkflows/local/st_downstream.nf @@ -2,9 +2,9 @@ // Subworkflow for downstream analyses of ST data // -include { QUARTONOTEBOOK as ST_QUALITY_CONTROLS } from '../../modules/nf-core/quartonotebook/main' -include { QUARTONOTEBOOK as ST_SVG } from '../../modules/nf-core/quartonotebook/main' -include { QUARTONOTEBOOK as ST_CLUSTERING } from '../../modules/nf-core/quartonotebook/main' +include { QUARTONOTEBOOK as ST_QUALITY_CONTROLS } from '../../modules/nf-core/quartonotebook/main' +include { QUARTONOTEBOOK as ST_SPATIALLY_VARIABLE_GENES } from '../../modules/nf-core/quartonotebook/main' +include { QUARTONOTEBOOK as ST_CLUSTERING } from '../../modules/nf-core/quartonotebook/main' workflow ST_DOWNSTREAM { @@ -18,9 +18,9 @@ workflow ST_DOWNSTREAM { // // Quarto reports and extension files // - quality_controls_file = file("${projectDir}/bin/st_quality_controls.qmd", checkIfExists: true) - clustering_file = file("${projectDir}/bin/st_clustering.qmd", checkIfExists: true) - svg_file = file("${projectDir}/bin/st_svg.qmd", checkIfExists: true) + quality_controls_notebook = file("${projectDir}/bin/st_quality_controls.qmd", checkIfExists: true) + clustering_notebook = file("${projectDir}/bin/st_clustering.qmd", checkIfExists: true) + spatially_variable_genes_notebook = file("${projectDir}/bin/st_spatially_variable_genes.qmd", checkIfExists: true) extensions = Channel.fromPath("${projectDir}/assets/_extensions").collect() // @@ -29,7 +29,7 @@ workflow ST_DOWNSTREAM { ch_quality_controls_input_data = st_sdata_raw .map { it -> it[1] } ch_quality_controls_notebook = st_sdata_raw - .map { tuple(it[0], quality_controls_file) } + .map { tuple(it[0], quality_controls_notebook) } quality_controls_params = [ input_sdata: "st_sdata_raw.zarr", min_counts: params.st_qc_min_counts, @@ -38,7 +38,9 @@ workflow ST_DOWNSTREAM { mito_threshold: params.st_qc_mito_threshold, ribo_threshold: params.st_qc_ribo_threshold, hb_threshold: params.st_qc_hb_threshold, - output_sdata: "st_sdata_filtered.zarr" + artifact_dir: "artifacts", + output_adata: "st_adata_filtered.h5ad", + output_sdata: "st_sdata_filtered.zarr", ] ST_QUALITY_CONTROLS ( ch_quality_controls_notebook, @@ -54,13 +56,14 @@ workflow ST_DOWNSTREAM { ch_clustering_input_data = ST_QUALITY_CONTROLS.out.artifacts .map { it -> it[1] } ch_clustering_notebook = ST_QUALITY_CONTROLS.out.artifacts - .map { tuple(it[0], clustering_file) } + .map { tuple(it[0], clustering_notebook) } clustering_params = [ - input_sdata_filtered: "st_adata_filtered.zarr", + input_sdata: "st_sdata_filtered.zarr", cluster_resolution: params.st_cluster_resolution, n_hvgs: params.st_cluster_n_hvgs, - output_adata_processed: "st_adata_processed.h5ad", - output_sdata: "st_sdata_processed.zarr" + artifact_dir: "artifacts", + output_adata: "st_adata_processed.h5ad", + output_sdata: "st_sdata_processed.zarr", ] ST_CLUSTERING ( ch_clustering_notebook, @@ -73,40 +76,41 @@ workflow ST_DOWNSTREAM { // // Spatially variable genes // - ch_spatial_de_input_data = ST_CLUSTERING.out.artifacts + ch_spatially_variable_genes_input_data = ST_CLUSTERING.out.artifacts .map { it -> it[1] } - ch_svg_notebook = ST_CLUSTERING.out.artifacts - .map { tuple(it[0], svg_file) } - svg_params = [ + ch_spatially_variable_genes_notebook = ST_CLUSTERING.out.artifacts + .map { tuple(it[0], spatially_variable_genes_notebook) } + spatially_variable_genes_params = [ input_sdata: "st_sdata_processed.zarr", - output_adata_svg: "st_adata_svg.h5ad", - output_sdata: "st_sdata_svg.zarr", - output_svg: "st_svg.csv", - n_top_spatial_degs: params.st_n_top_spatial_degs + n_top_spatial_degs: params.st_n_top_spatial_degs, + artifact_dir: "artifacts", + output_csv: "st_spatially_variable_genes.csv", + output_adata: "st_adata_spatially_variable_genes.h5ad", + output_sdata: "st_sdata.zarr", ] - ST_SVG ( - ch_svg_notebook, - svg_params, - ch_spatial_de_input_data, + ST_SPATIALLY_VARIABLE_GENES ( + ch_spatially_variable_genes_notebook, + spatially_variable_genes_params, + ch_spatially_variable_genes_input_data, extensions ) - ch_versions = ch_versions.mix(ST_SVG.out.versions) + ch_versions = ch_versions.mix(ST_SPATIALLY_VARIABLE_GENES.out.versions) emit: - st_qc_html = ST_QUALITY_CONTROLS.out.html // channel: [ meta, html ] - st_sdata_filtered = ST_QUALITY_CONTROLS.out.artifacts // channel: [ meta, h5ad ] - st_qc_notebook = ST_QUALITY_CONTROLS.out.notebook // channel: [ meta, qmd ] - st_qc_params = ST_QUALITY_CONTROLS.out.params_yaml // channel: [ meta, yml ] + st_qc_html = ST_QUALITY_CONTROLS.out.html // channel: [ meta, html ] + st_sdata_filtered = ST_QUALITY_CONTROLS.out.artifacts // channel: [ meta, h5ad ] + st_qc_notebook = ST_QUALITY_CONTROLS.out.notebook // channel: [ meta, qmd ] + st_qc_params = ST_QUALITY_CONTROLS.out.params_yaml // channel: [ meta, yml ] - st_clustering_html = ST_CLUSTERING.out.html // channel: [ html ] - st_sdata_processed = ST_CLUSTERING.out.artifacts // channel: [ meta, h5ad] - st_clustering_notebook = ST_CLUSTERING.out.notebook // channel: [ meta, qmd ] - st_clustering_params = ST_CLUSTERING.out.params_yaml // channel: [ meta, yml ] + st_clustering_html = ST_CLUSTERING.out.html // channel: [ html ] + st_sdata_processed = ST_CLUSTERING.out.artifacts // channel: [ meta, h5ad] + st_clustering_notebook = ST_CLUSTERING.out.notebook // channel: [ meta, qmd ] + st_clustering_params = ST_CLUSTERING.out.params_yaml // channel: [ meta, yml ] - st_svg_html = ST_SVG.out.html // channel: [ meta, html ] - st_output = ST_SVG.out.artifacts // channel: [ meta, csv ] - st_svg_notebook = ST_SVG.out.notebook // channel: [ meta, qmd ] - st_svg_params = ST_SVG.out.params_yaml // channel: [ meta, yml ] + st_svg_html = ST_SPATIALLY_VARIABLE_GENES.out.html // channel: [ meta, html ] + st_output = ST_SPATIALLY_VARIABLE_GENES.out.artifacts // channel: [ meta, csv ] + st_svg_notebook = ST_SPATIALLY_VARIABLE_GENES.out.notebook // channel: [ meta, qmd ] + st_svg_params = ST_SPATIALLY_VARIABLE_GENES.out.params_yaml // channel: [ meta, yml ] - versions = ch_versions // channel: [ versions.yml ] + versions = ch_versions // channel: [ versions.yml ] } diff --git a/tests/pipeline/test_downstream.nf.test b/tests/pipeline/test_downstream.nf.test index 8c400aa..51e405d 100644 --- a/tests/pipeline/test_downstream.nf.test +++ b/tests/pipeline/test_downstream.nf.test @@ -34,14 +34,14 @@ nextflow_pipeline { // Reports { assert file("$outputDir/CytAssist_11mm_FFPE_Human_Glioblastoma_2/reports/st_quality_controls.html").text.contains("final results of all the filtering") }, { assert file("$outputDir/CytAssist_11mm_FFPE_Human_Glioblastoma_2/reports/st_clustering.html").text.contains("spatial distribution of clusters") }, - { assert file("$outputDir/CytAssist_11mm_FFPE_Human_Glioblastoma_2/reports/st_svg.html").text.contains("Spatial transcriptomics data can give insight") }, + { assert file("$outputDir/CytAssist_11mm_FFPE_Human_Glioblastoma_2/reports/st_spatially_variable_genes.html").text.contains("Spatial transcriptomics data can give insight") }, { assert file("$outputDir/CytAssist_11mm_FFPE_Human_Glioblastoma_2.2/reports/st_quality_controls.html").text.contains("final results of all the filtering") }, { assert file("$outputDir/CytAssist_11mm_FFPE_Human_Glioblastoma_2.2/reports/st_clustering.html").text.contains("spatial distribution of clusters") }, - { assert file("$outputDir/CytAssist_11mm_FFPE_Human_Glioblastoma_2.2/reports/st_svg.html").text.contains("Spatial transcriptomics data can give insight") }, + { assert file("$outputDir/CytAssist_11mm_FFPE_Human_Glioblastoma_2.2/reports/st_spatially_variable_genes.html").text.contains("Spatial transcriptomics data can give insight") }, // DEGs - { assert file("$outputDir/CytAssist_11mm_FFPE_Human_Glioblastoma_2/degs/st_svg.csv").exists() }, - { assert file("$outputDir/CytAssist_11mm_FFPE_Human_Glioblastoma_2.2/degs/st_svg.csv").exists() }, + { assert file("$outputDir/CytAssist_11mm_FFPE_Human_Glioblastoma_2/degs/st_spatially_variable_genes.csv").exists() }, + { assert file("$outputDir/CytAssist_11mm_FFPE_Human_Glioblastoma_2.2/degs/st_spatially_variable_genes.csv").exists() }, // MultiQC { assert file("$outputDir/multiqc/multiqc_report.html").exists() } diff --git a/tests/pipeline/test_downstream.nf.test.snap b/tests/pipeline/test_downstream.nf.test.snap index 4587197..b918fbc 100644 --- a/tests/pipeline/test_downstream.nf.test.snap +++ b/tests/pipeline/test_downstream.nf.test.snap @@ -1,7 +1,7 @@ { "nf_core_pipeline_software_mqc_versions.yml": { "content": [ - "{SPACERANGER_UNTAR_REFERENCE={untar=1.3}, ST_CLUSTERING={quarto=1.4.549, papermill=null}, ST_QUALITY_CONTROLS={quarto=1.4.549, papermill=null}, ST_READ_DATA={scanpy=1.9.8}, ST_SVG={quarto=1.4.549, papermill=null}, UNTAR_DOWNSTREAM_INPUT={untar=1.3}, Workflow={nf-core/spatialtranscriptomics=v1.0dev}}" + "{SPACERANGER_UNTAR_REFERENCE={untar=1.3}, ST_CLUSTERING={quarto=1.4.549, papermill=null}, ST_QUALITY_CONTROLS={quarto=1.4.549, papermill=null}, ST_READ_DATA={scanpy=1.9.8}, ST_SPATIALLY_VARIABLE_GENES={quarto=1.4.549, papermill=null}, UNTAR_DOWNSTREAM_INPUT={untar=1.3}, Workflow={nf-core/spatialtranscriptomics=v1.0dev}}" ], "meta": { "nf-test": "0.8.4", @@ -9,4 +9,4 @@ }, "timestamp": "2024-03-07T13:23:56.226763" } -} \ No newline at end of file +} diff --git a/tests/pipeline/test_spaceranger_ffpe_v1.nf.test b/tests/pipeline/test_spaceranger_ffpe_v1.nf.test index 25abe67..df375e6 100644 --- a/tests/pipeline/test_spaceranger_ffpe_v1.nf.test +++ b/tests/pipeline/test_spaceranger_ffpe_v1.nf.test @@ -29,10 +29,10 @@ nextflow_pipeline { // Reports { assert file("$outputDir/Visium_FFPE_Human_Ovarian_Cancer/reports/st_quality_controls.html").text.contains("final results of all the filtering") }, { assert file("$outputDir/Visium_FFPE_Human_Ovarian_Cancer/reports/st_clustering.html").text.contains("spatial distribution of clusters") }, - { assert file("$outputDir/Visium_FFPE_Human_Ovarian_Cancer/reports/st_svg.html").text.contains("Spatial transcriptomics data can give insight") }, + { assert file("$outputDir/Visium_FFPE_Human_Ovarian_Cancer/reports/st_spatially_variable_genes.html").text.contains("Spatial transcriptomics data can give insight") }, // DEGs - { assert file("$outputDir/Visium_FFPE_Human_Ovarian_Cancer/degs/st_svg.csv").exists() }, + { assert file("$outputDir/Visium_FFPE_Human_Ovarian_Cancer/degs/st_spatially_variable_genes.csv").exists() }, // Space Ranger { assert file("$outputDir/Visium_FFPE_Human_Ovarian_Cancer/spaceranger/outs/web_summary.html").exists() }, diff --git a/tests/pipeline/test_spaceranger_ffpe_v1.nf.test.snap b/tests/pipeline/test_spaceranger_ffpe_v1.nf.test.snap index c36ecfc..f0c3b50 100644 --- a/tests/pipeline/test_spaceranger_ffpe_v1.nf.test.snap +++ b/tests/pipeline/test_spaceranger_ffpe_v1.nf.test.snap @@ -11,7 +11,7 @@ }, "nf_core_pipeline_software_mqc_versions.yml": { "content": [ - "{FASTQC={fastqc=0.12.1}, SPACERANGER_COUNT={spaceranger=2.1.0}, SPACERANGER_UNTAR_REFERENCE={untar=1.3}, ST_CLUSTERING={quarto=1.4.549, papermill=null}, ST_QUALITY_CONTROLS={quarto=1.4.549, papermill=null}, ST_READ_DATA={scanpy=1.9.8}, ST_SVG={quarto=1.4.549, papermill=null}, UNTAR_SPACERANGER_INPUT={untar=1.3}, Workflow={nf-core/spatialtranscriptomics=v1.0dev}}" + "{FASTQC={fastqc=0.12.1}, SPACERANGER_COUNT={spaceranger=2.1.0}, SPACERANGER_UNTAR_REFERENCE={untar=1.3}, ST_CLUSTERING={quarto=1.4.549, papermill=null}, ST_QUALITY_CONTROLS={quarto=1.4.549, papermill=null}, ST_READ_DATA={scanpy=1.9.8}, ST_SPATIALLY_VARIABLE_GENES={quarto=1.4.549, papermill=null}, UNTAR_SPACERANGER_INPUT={untar=1.3}, Workflow={nf-core/spatialtranscriptomics=v1.0dev}}" ], "meta": { "nf-test": "0.8.4", @@ -19,4 +19,4 @@ }, "timestamp": "2024-03-07T13:55:24.407294" } -} \ No newline at end of file +} diff --git a/tests/pipeline/test_spaceranger_ffpe_v2_cytassist.nf.test b/tests/pipeline/test_spaceranger_ffpe_v2_cytassist.nf.test index 8b4638d..c2fba52 100644 --- a/tests/pipeline/test_spaceranger_ffpe_v2_cytassist.nf.test +++ b/tests/pipeline/test_spaceranger_ffpe_v2_cytassist.nf.test @@ -25,10 +25,10 @@ nextflow_pipeline { // Reports { assert file("$outputDir/CytAssist_11mm_FFPE_Human_Glioblastoma_2/reports/st_quality_controls.html").text.contains("final results of all the filtering") }, { assert file("$outputDir/CytAssist_11mm_FFPE_Human_Glioblastoma_2/reports/st_clustering.html").text.contains("spatial distribution of clusters") }, - { assert file("$outputDir/CytAssist_11mm_FFPE_Human_Glioblastoma_2/reports/st_svg.html").text.contains("Spatial transcriptomics data can give insight") }, + { assert file("$outputDir/CytAssist_11mm_FFPE_Human_Glioblastoma_2/reports/st_spatially_variable_genes.html").text.contains("Spatial transcriptomics data can give insight") }, // DEGs - { assert file("$outputDir/CytAssist_11mm_FFPE_Human_Glioblastoma_2/degs/st_svg.csv").exists() }, + { assert file("$outputDir/CytAssist_11mm_FFPE_Human_Glioblastoma_2/degs/st_spatially_variable_genes.csv").exists() }, // Space Ranger { assert file("$outputDir/CytAssist_11mm_FFPE_Human_Glioblastoma_2/spaceranger/outs/web_summary.html").exists() }, diff --git a/tests/pipeline/test_spaceranger_ffpe_v2_cytassist.nf.test.snap b/tests/pipeline/test_spaceranger_ffpe_v2_cytassist.nf.test.snap index 02e6954..8aede30 100644 --- a/tests/pipeline/test_spaceranger_ffpe_v2_cytassist.nf.test.snap +++ b/tests/pipeline/test_spaceranger_ffpe_v2_cytassist.nf.test.snap @@ -1,7 +1,7 @@ { "nf_core_pipeline_software_mqc_versions.yml": { "content": [ - "{FASTQC={fastqc=0.12.1}, SPACERANGER_COUNT={spaceranger=2.1.0}, SPACERANGER_UNTAR_REFERENCE={untar=1.3}, ST_CLUSTERING={quarto=1.4.549, papermill=null}, ST_QUALITY_CONTROLS={quarto=1.4.549, papermill=null}, ST_READ_DATA={scanpy=1.9.8}, ST_SVG={quarto=1.4.549, papermill=null}, UNTAR_SPACERANGER_INPUT={untar=1.3}, Workflow={nf-core/spatialtranscriptomics=v1.0dev}}" + "{FASTQC={fastqc=0.12.1}, SPACERANGER_COUNT={spaceranger=2.1.0}, SPACERANGER_UNTAR_REFERENCE={untar=1.3}, ST_CLUSTERING={quarto=1.4.549, papermill=null}, ST_QUALITY_CONTROLS={quarto=1.4.549, papermill=null}, ST_READ_DATA={scanpy=1.9.8}, ST_SPATIALLY_VARIABLE_GENES={quarto=1.4.549, papermill=null}, UNTAR_SPACERANGER_INPUT={untar=1.3}, Workflow={nf-core/spatialtranscriptomics=v1.0dev}}" ], "meta": { "nf-test": "0.8.4", @@ -9,4 +9,4 @@ }, "timestamp": "2024-03-07T14:28:20.163729" } -} \ No newline at end of file +} From 8238a32b96e817992d1469892c26fb918786990d Mon Sep 17 00:00:00 2001 From: Erik Fasterius Date: Tue, 19 Mar 2024 16:26:37 +0100 Subject: [PATCH 39/66] Remove `st_` prefix from names/variables/etc. --- bin/{st_clustering.qmd => clustering.qmd} | 52 ++++---- ...lity_controls.qmd => quality_controls.qmd} | 100 +++++++-------- bin/{read_st_data.py => read_data.py} | 5 +- ...genes.qmd => spatially_variable_genes.qmd} | 48 ++++---- conf/modules.config | 14 +-- conf/test.config | 4 +- conf/test_downstream.config | 4 +- conf/test_spaceranger_v1.config | 4 +- docs/output.md | 10 +- .../local/{st_read_data.nf => read_data.nf} | 8 +- nextflow.config | 18 +-- nextflow_schema.json | 18 +-- subworkflows/local/downstream.nf | 116 ++++++++++++++++++ subworkflows/local/spaceranger.nf | 4 +- subworkflows/local/st_downstream.nf | 116 ------------------ tests/pipeline/test_downstream.nf.test | 28 ++--- tests/pipeline/test_downstream.nf.test.snap | 2 +- .../pipeline/test_spaceranger_ffpe_v1.nf.test | 16 +-- .../test_spaceranger_ffpe_v1.nf.test.snap | 4 +- ...test_spaceranger_ffpe_v2_cytassist.nf.test | 12 +- ...spaceranger_ffpe_v2_cytassist.nf.test.snap | 2 +- workflows/spatialtranscriptomics.nf | 14 +-- 22 files changed, 300 insertions(+), 299 deletions(-) rename bin/{st_clustering.qmd => clustering.qmd} (77%) rename bin/{st_quality_controls.qmd => quality_controls.qmd} (73%) rename bin/{read_st_data.py => read_data.py} (89%) rename bin/{st_spatially_variable_genes.qmd => spatially_variable_genes.qmd} (71%) rename modules/local/{st_read_data.nf => read_data.nf} (87%) create mode 100644 subworkflows/local/downstream.nf delete mode 100644 subworkflows/local/st_downstream.nf diff --git a/bin/st_clustering.qmd b/bin/clustering.qmd similarity index 77% rename from bin/st_clustering.qmd rename to bin/clustering.qmd index e7516c5..e19cc6f 100644 --- a/bin/st_clustering.qmd +++ b/bin/clustering.qmd @@ -11,12 +11,12 @@ jupyter: python3 ```{python} #| tags: [parameters] #| echo: false -input_sdata = "st_sdata_filtered.zarr" # Input: SpatialData file +input_sdata = "sdata_filtered.zarr" # Input: SpatialData file cluster_resolution = 1 # Resolution for Leiden clustering n_hvgs = 2000 # Number of HVGs to use for analyses artifact_dir = "artifacts" # Output directory -output_adata = "st_adata_processed.h5ad" # Output: AnnData file -output_sdata = "st_sdata_processed.zarr" # Output: SpatialData file +output_adata = "adata_processed.h5ad" # Output: AnnData file +output_sdata = "sdata_processed.zarr" # Output: SpatialData file ``` The data has already been filtered in the _quality controls_ reports and is @@ -62,11 +62,11 @@ def to_legacy_anndata(sdata: spatialdata.SpatialData) -> AnnData: ``` ```{python} -st_sdata = spatialdata.read_zarr(input_sdata, ["images", "table", "shapes"]) -st_adata = to_legacy_anndata(st_sdata) +sdata = spatialdata.read_zarr(input_sdata, ["images", "table", "shapes"]) +adata = to_legacy_anndata(sdata) print("Content of the AnnData object:") -print(st_adata) +print(adata) ``` # Normalization @@ -76,8 +76,8 @@ use the built-in `normalize_total` method from [Scanpy](https://scanpy.readthedo followed by a log-transformation. ```{python} -sc.pp.normalize_total(st_adata, inplace=True) -sc.pp.log1p(st_adata) +sc.pp.normalize_total(adata, inplace=True) +sc.pp.log1p(adata) ``` # Feature selection @@ -90,13 +90,13 @@ regards to yielding a good separation of clusters. ```{python} # layout-nrow: 1 # Find top HVGs and print results -sc.pp.highly_variable_genes(st_adata, flavor="seurat", n_top_genes=n_hvgs) -var_genes_all = st_adata.var.highly_variable +sc.pp.highly_variable_genes(adata, flavor="seurat", n_top_genes=n_hvgs) +var_genes_all = adata.var.highly_variable print("Extracted highly variable genes: %d"%sum(var_genes_all)) # Plot the HVGs plt.rcParams["figure.figsize"] = (4.5, 4.5) -sc.pl.highly_variable_genes(st_adata) +sc.pl.highly_variable_genes(adata) ``` # Clustering @@ -108,10 +108,10 @@ Manifold Approximation and Projection) is used for visualization. The Leiden algorithm is employed for clustering with a given resolution. ```{python} -sc.pp.pca(st_adata) -sc.pp.neighbors(st_adata) -sc.tl.umap(st_adata) -sc.tl.leiden(st_adata, key_added="clusters", resolution=cluster_resolution) +sc.pp.pca(adata) +sc.pp.neighbors(adata) +sc.tl.umap(adata) +sc.tl.leiden(adata, key_added="clusters", resolution=cluster_resolution) Markdown(f"Resolution for Leiden clustering: `{cluster_resolution}`") ``` @@ -122,7 +122,7 @@ We then generate UMAP plots to visualize the distribution of clusters: ```{python} #| warning: false plt.rcParams["figure.figsize"] = (7, 7) -sc.pl.umap(st_adata, color="clusters") +sc.pl.umap(adata, color="clusters") ``` ## Counts and genes @@ -133,7 +133,7 @@ the UMAP: ```{python} # Make plots of UMAP of ST spots clusters plt.rcParams["figure.figsize"] = (3.5, 3.5) -sc.pl.umap(st_adata, color=["total_counts", "n_genes_by_counts"]) +sc.pl.umap(adata, color=["total_counts", "n_genes_by_counts"]) ``` ## Individual clusters @@ -142,8 +142,8 @@ An additional visualisation is to show where the various spots are in each individual cluster while ignoring all other cluster: ```{python} -sc.tl.embedding_density(st_adata, basis="umap", groupby="clusters") -sc.pl.embedding_density(st_adata, groupby="clusters", ncols=2) +sc.tl.embedding_density(adata, basis="umap", groupby="clusters") +sc.pl.embedding_density(adata, groupby="clusters", ncols=2) ``` # Spatial visualisation @@ -154,8 +154,8 @@ spatial coordinates by overlaying the spots on the tissue image itself. ```{python} #| layout-nrow: 2 plt.rcParams["figure.figsize"] = (8, 8) -sc.pl.spatial(st_adata, img_key="hires", color="total_counts", size=1.25) -sc.pl.spatial(st_adata, img_key="hires", color="n_genes_by_counts", size=1.25) +sc.pl.spatial(adata, img_key="hires", color="total_counts", size=1.25) +sc.pl.spatial(adata, img_key="hires", color="n_genes_by_counts", size=1.25) ``` To gain insights into tissue organization and potential inter-cellular @@ -167,13 +167,13 @@ organization of cells. ```{python} # TODO: Can the colour bar on this figure be fit to the figure? plt.rcParams["figure.figsize"] = (7, 7) -sc.pl.spatial(st_adata, img_key="hires", color="clusters", size=1.25) +sc.pl.spatial(adata, img_key="hires", color="clusters", size=1.25) ``` ```{python} #| echo: false -del st_sdata.table -st_sdata.table = st_adata -st_adata.write(os.path.join(artifact_dir, output_adata)) -st_sdata.write(os.path.join(artifact_dir, output_sdata)) +del sdata.table +sdata.table = adata +adata.write(os.path.join(artifact_dir, output_adata)) +sdata.write(os.path.join(artifact_dir, output_sdata)) ``` diff --git a/bin/st_quality_controls.qmd b/bin/quality_controls.qmd similarity index 73% rename from bin/st_quality_controls.qmd rename to bin/quality_controls.qmd index 0586b88..7c94f78 100644 --- a/bin/st_quality_controls.qmd +++ b/bin/quality_controls.qmd @@ -26,7 +26,7 @@ analysis tools and facilitates seamless integration into existing workflows. ```{python} #| tags: [parameters] #| echo: false -input_sdata = "st_sdata_raw.zarr" # Input: SpatialData file +input_sdata = "sdata_raw.zarr" # Input: SpatialData file min_counts = 500 # Min counts per spot min_genes = 250 # Min genes per spot min_spots = 1 # Min spots per gene @@ -34,8 +34,8 @@ mito_threshold = 20 # Mitochondrial content threshold (%) ribo_threshold = 0 # Ribosomal content threshold (%) hb_threshold = 100 # content threshold (%) artifact_dir = "artifacts" -output_adata = "st_adata_filtered.h5ad" # Output: AnnData file -output_sdata = "st_sdata_filtered.zarr" # Output: SpatialData file +output_adata = "adata_filtered.h5ad" # Output: AnnData file +output_sdata = "sdata_filtered.zarr" # Output: SpatialData file ``` ```{python} @@ -78,18 +78,18 @@ def to_legacy_anndata(sdata: spatialdata.SpatialData) -> AnnData: ```{python} # Read the data -st_sdata = spatialdata.read_zarr(input_sdata, ["images", "table", "shapes"]) -st_adata = to_legacy_anndata(st_sdata) +sdata = spatialdata.read_zarr(input_sdata, ["images", "table", "shapes"]) +adata = to_legacy_anndata(sdata) # Convert X matrix from csr to csc dense matrix for output compatibility: -st_adata.X = scipy.sparse.csc_matrix(st_adata.X) +adata.X = scipy.sparse.csc_matrix(adata.X) # Store the raw data so that it can be used for analyses from scratch if desired -st_adata.layers['raw'] = st_adata.X.copy() +adata.layers['raw'] = adata.X.copy() # Print the anndata object for inspection print("Content of the AnnData object:") -print(st_adata) +print(adata) ``` # Quality controls @@ -102,14 +102,14 @@ percentage of counts from mitochondrial, ribosomal and haemoglobin genes ```{python} # Calculate mitochondrial, ribosomal and haemoglobin percentages -st_adata.var['mt'] = st_adata.var_names.str.startswith('MT-') -st_adata.var['ribo'] = st_adata.var_names.str.contains(("^RP[LS]")) -st_adata.var['hb'] = st_adata.var_names.str.contains(("^HB[AB]")) -sc.pp.calculate_qc_metrics(st_adata, qc_vars=["mt", "ribo", "hb"], +adata.var['mt'] = adata.var_names.str.startswith('MT-') +adata.var['ribo'] = adata.var_names.str.contains(("^RP[LS]")) +adata.var['hb'] = adata.var_names.str.contains(("^HB[AB]")) +sc.pp.calculate_qc_metrics(adata, qc_vars=["mt", "ribo", "hb"], inplace=True, log1p=False) # Save a copy of data as a restore-point if filtering results in 0 spots left -st_adata_before_filtering = st_adata.copy() +adata_before_filtering = adata.copy() ``` ## Violin plots @@ -120,9 +120,9 @@ mitochondrial, ribosomal and haemoglobin genes: ```{python} #| layout-nrow: 2 -sc.pl.violin(st_adata, ['n_genes_by_counts', 'total_counts'], +sc.pl.violin(adata, ['n_genes_by_counts', 'total_counts'], multi_panel=True, jitter=0.4, rotation= 45) -sc.pl.violin(st_adata, ['pct_counts_mt', 'pct_counts_ribo', 'pct_counts_hb'], +sc.pl.violin(adata, ['pct_counts_mt', 'pct_counts_ribo', 'pct_counts_hb'], multi_panel=True, jitter=0.4, rotation= 45) ``` @@ -133,8 +133,8 @@ spatial patterns may be discerned: ```{python} #| layout-nrow: 2 -sc.pl.spatial(st_adata, color = ["total_counts", "n_genes_by_counts"], size=1.25) -sc.pl.spatial(st_adata, color = ["pct_counts_mt", "pct_counts_ribo", "pct_counts_hb"], size=1.25) +sc.pl.spatial(adata, color = ["total_counts", "n_genes_by_counts"], size=1.25) +sc.pl.spatial(adata, color = ["pct_counts_mt", "pct_counts_ribo", "pct_counts_hb"], size=1.25) ``` ## Scatter plots @@ -145,8 +145,8 @@ counts versus the number of genes: ```{python} #| layout-ncol: 2 -sc.pl.scatter(st_adata, x='pct_counts_ribo', y='pct_counts_mt') -sc.pl.scatter(st_adata, x='total_counts', y='n_genes_by_counts') +sc.pl.scatter(adata, x='pct_counts_ribo', y='pct_counts_mt') +sc.pl.scatter(adata, x='total_counts', y='n_genes_by_counts') ``` ## Top expressed genes @@ -155,7 +155,7 @@ It can also be informative to see which genes are the most expressed in the dataset; the following figure shows the top 20 most expressed genes. ```{python} -sc.pl.highest_expr_genes(st_adata, n_top=20) +sc.pl.highest_expr_genes(adata, n_top=20) ``` # Filtering @@ -167,16 +167,16 @@ are uninformative and are thus removed. ```{python} # Create a string observation "obs/in_tissue_str" with "In tissue" and "Outside tissue": -st_adata.obs["in_tissue_str"] = ["In tissue" if x == 1 else "Outside tissue" for x in st_adata.obs["in_tissue"]] +adata.obs["in_tissue_str"] = ["In tissue" if x == 1 else "Outside tissue" for x in adata.obs["in_tissue"]] # Plot spots inside tissue -sc.pl.spatial(st_adata, color=["in_tissue_str"], title="Spots in tissue", size=1.25) -del st_adata.obs["in_tissue_str"] +sc.pl.spatial(adata, color=["in_tissue_str"], title="Spots in tissue", size=1.25) +del adata.obs["in_tissue_str"] # Remove spots outside tissue and print results -n_spots = st_adata.shape[0] -st_adata = st_adata[st_adata.obs["in_tissue"] == 1] -n_spots_in_tissue = st_adata.shape[0] +n_spots = adata.shape[0] +adata = adata[adata.obs["in_tissue"] == 1] +n_spots_in_tissue = adata.shape[0] Markdown(f"""A total of `{n_spots_in_tissue}` spots are situated inside the tissue, out of `{n_spots}` spots in total.""") ``` @@ -190,18 +190,18 @@ your knowledge of the specific tissue at hand. ```{python} #| warning: false # Filter spots based on counts -n_spots = st_adata.shape[0] -n_genes = st_adata.shape[1] -sc.pp.filter_cells(st_adata, min_counts=min_counts) -n_spots_filtered_min_counts = st_adata.shape[0] +n_spots = adata.shape[0] +n_genes = adata.shape[1] +sc.pp.filter_cells(adata, min_counts=min_counts) +n_spots_filtered_min_counts = adata.shape[0] # Filter spots based on genes -sc.pp.filter_cells(st_adata, min_genes=min_genes) -n_spots_filtered_min_genes = st_adata.shape[0] +sc.pp.filter_cells(adata, min_genes=min_genes) +n_spots_filtered_min_genes = adata.shape[0] # Filter genes based on spots -sc.pp.filter_genes(st_adata, min_cells=min_spots) -n_genes_filtered_min_spots = st_adata.shape[1] +sc.pp.filter_genes(adata, min_cells=min_spots) +n_genes_filtered_min_spots = adata.shape[1] # Print results Markdown(f""" @@ -220,16 +220,16 @@ ribosomal nor haemoglobin content is filtered by default. ```{python} # Filter spots -st_adata = st_adata[st_adata.obs["pct_counts_mt"] <= mito_threshold] -n_spots_filtered_mito = st_adata.shape[0] -st_adata = st_adata[st_adata.obs["pct_counts_ribo"] >= ribo_threshold] -n_spots_filtered_ribo = st_adata.shape[0] -st_adata = st_adata[st_adata.obs["pct_counts_hb"] <= hb_threshold] -n_spots_filtered_hb = st_adata.shape[0] +adata = adata[adata.obs["pct_counts_mt"] <= mito_threshold] +n_spots_filtered_mito = adata.shape[0] +adata = adata[adata.obs["pct_counts_ribo"] >= ribo_threshold] +n_spots_filtered_ribo = adata.shape[0] +adata = adata[adata.obs["pct_counts_hb"] <= hb_threshold] +n_spots_filtered_hb = adata.shape[0] # Print results Markdown(f""" -- Removed `{st_adata.shape[0] - n_spots_filtered_mito}` spots with more than `{mito_threshold}%` mitochondrial content. +- Removed `{adata.shape[0] - n_spots_filtered_mito}` spots with more than `{mito_threshold}%` mitochondrial content. - Removed `{n_spots_filtered_mito - n_spots_filtered_ribo}` spots with less than `{ribo_threshold}%` ribosomal content. - Removed `{n_spots_filtered_ribo - n_spots_filtered_hb}` spots with more than `{hb_threshold}%` haemoglobin content. """) @@ -238,8 +238,8 @@ Markdown(f""" ```{python} #| echo: false # Restore non-filtered data if filtering results in 0 spots left -if (st_adata.shape[0] == 0 or st_adata.shape[1] == 0): - st_adata = st_adata_before_filtering +if (adata.shape[0] == 0 or adata.shape[1] == 0): + adata = adata_before_filtering display( Markdown(dedent( """ @@ -269,21 +269,21 @@ if (st_adata.shape[0] == 0 or st_adata.shape[1] == 0): Markdown(f""" The final results of all the filtering is as follows: -- A total of `{st_adata.shape[0]}` spots out of `{n_spots}` remain after filtering. -- A total of `{st_adata.shape[1]}` genes out of `{n_genes}` remain after filtering. +- A total of `{adata.shape[0]}` spots out of `{n_spots}` remain after filtering. +- A total of `{adata.shape[1]}` genes out of `{n_genes}` remain after filtering. """) ``` ```{python} #| layout-nrow: 2 -sc.pl.violin(st_adata, ['n_genes_by_counts', 'total_counts'], +sc.pl.violin(adata, ['n_genes_by_counts', 'total_counts'], multi_panel=True, jitter=0.4, rotation= 45) -sc.pl.violin(st_adata, ['pct_counts_mt', 'pct_counts_ribo', 'pct_counts_hb'], +sc.pl.violin(adata, ['pct_counts_mt', 'pct_counts_ribo', 'pct_counts_hb'], multi_panel=True, jitter=0.4, rotation= 45) ``` ```{python} -del st_sdata.table -st_sdata.table = st_adata -st_sdata.write(os.path.join(artifact_dir, output_sdata)) +del sdata.table +sdata.table = adata +sdata.write(os.path.join(artifact_dir, output_sdata)) ``` diff --git a/bin/read_st_data.py b/bin/read_data.py similarity index 89% rename from bin/read_st_data.py rename to bin/read_data.py index 8379243..fd27753 100755 --- a/bin/read_st_data.py +++ b/bin/read_data.py @@ -2,6 +2,7 @@ # Load packages import argparse + import spatialdata_io if __name__ == "__main__": @@ -28,9 +29,9 @@ args = parser.parse_args() # Read Visium data - st_spatialdata = spatialdata_io.visium( + spatialdata = spatialdata_io.visium( args.SRCountDir, counts_file="raw_feature_bc_matrix.h5", dataset_id="visium" ) # Write raw spatialdata to file - st_spatialdata.write(args.output_sdata, overwrite=True) + spatialdata.write(args.output_sdata, overwrite=True) diff --git a/bin/st_spatially_variable_genes.qmd b/bin/spatially_variable_genes.qmd similarity index 71% rename from bin/st_spatially_variable_genes.qmd rename to bin/spatially_variable_genes.qmd index 2e60664..c9421b9 100644 --- a/bin/st_spatially_variable_genes.qmd +++ b/bin/spatially_variable_genes.qmd @@ -9,12 +9,12 @@ jupyter: python3 ```{python} #| tags: [parameters] #| echo: false -input_sdata = "st_sdata_processed.zarr" # Input: SpatialData file +input_sdata = "sdata_processed.zarr" # Input: SpatialData file n_top_spatial_degs = 14 # Number of spatially variable genes to plot artifact_dir = "artifacts" # Output directory -output_csv = "st_spatially_variable_genes.csv" # Output: gene list -output_adata = "st_adata_spatially_variable_genes.h5ad" # Output: AnnData file -output_sdata = "st_sdata.zarr" # Output: SpatialData file +output_csv = "spatially_variable_genes.csv" # Output: gene list +output_adata = "adata_spatially_variable_genes.h5ad" # Output: AnnData file +output_sdata = "sdata.zarr" # Output: SpatialData file ``` ```{python} @@ -53,14 +53,14 @@ def to_legacy_anndata(sdata: spatialdata.SpatialData) -> AnnData: ```{python} # Read data -st_sdata = spatialdata.read_zarr("./" + input_sdata, ["images", "table", "shapes"]) +sdata = spatialdata.read_zarr("./" + input_sdata, ["images", "table", "shapes"]) -st_adata = to_legacy_anndata(st_sdata) +adata = to_legacy_anndata(sdata) print("Content of the AnnData object:") -print(st_adata) +print(adata) # Fix for scanpy issue https://github.com/scverse/scanpy/issues/2181 -st_adata.uns['log1p']['base'] = None +adata.uns['log1p']['base'] = None # Suppress scanpy-specific warnings sc.settings.verbosity = 0 @@ -74,8 +74,8 @@ visualize the top DEGs in a heatmap: ```{python} #| warning: false -sc.tl.rank_genes_groups(st_adata, 'clusters', method='t-test') -sc.pl.rank_genes_groups_heatmap(st_adata, n_genes=5, groupby="clusters") +sc.tl.rank_genes_groups(adata, 'clusters', method='t-test') +sc.pl.rank_genes_groups_heatmap(adata, n_genes=5, groupby="clusters") ``` A different but similar visualization of the DEGs is the dot plot, where we can @@ -83,7 +83,7 @@ also include the gene names: ```{python} #| warning: false -sc.pl.rank_genes_groups_dotplot(st_adata, n_genes=5, groupby="clusters") +sc.pl.rank_genes_groups_dotplot(adata, n_genes=5, groupby="clusters") ``` ::: {.callout-note} @@ -98,16 +98,16 @@ We can perform a neighborhood enrichment analysis to find out which genes are enriched in the neighborhood of each cluster: ```{python} -sq.gr.spatial_neighbors(st_adata, coord_type="generic") -sq.gr.nhood_enrichment(st_adata, cluster_key="clusters") -sq.pl.nhood_enrichment(st_adata, cluster_key="clusters", method="ward", vmin=-100, vmax=100) +sq.gr.spatial_neighbors(adata, coord_type="generic") +sq.gr.nhood_enrichment(adata, cluster_key="clusters") +sq.pl.nhood_enrichment(adata, cluster_key="clusters", method="ward", vmin=-100, vmax=100) ``` We visualize the interaction matrix between the different clusters: ```{python} -sq.gr.interaction_matrix(st_adata, cluster_key="clusters") -sq.pl.interaction_matrix(st_adata, cluster_key="clusters", method="ward", vmax=20000) +sq.gr.interaction_matrix(adata, cluster_key="clusters") +sq.pl.interaction_matrix(adata, cluster_key="clusters", method="ward", vmax=20000) ``` # Spatially variable genes with spatial autocorrelation statistics @@ -117,21 +117,21 @@ different areas in a tissue, allowing identification of spatial gene expression patterns. Here we use [Moran's I](https://en.wikipedia.org/wiki/Moran%27s_I) autocorrelation score to identify such patterns. ```{python} -st_adata.var_names_make_unique() -sq.gr.spatial_autocorr(st_adata, mode="moran") -st_adata.uns["moranI"].head(n_top_spatial_degs) +adata.var_names_make_unique() +sq.gr.spatial_autocorr(adata, mode="moran") +adata.uns["moranI"].head(n_top_spatial_degs) #[TODO] add gearyC as optional mode ``` ```{python} #| echo: false -st_adata.write(output_adata) -del st_sdata.table -st_sdata.table = st_adata -st_sdata.write("./" + output_sdata) +adata.write(output_adata) +del sdata.table +sdata.table = adata +sdata.write("./" + output_sdata) ``` ```{python} -st_adata.uns["moranI"].to_csv(os.path.join(artifact_dir, output_csv)) +adata.uns["moranI"].to_csv(os.path.join(artifact_dir, output_csv)) ``` diff --git a/conf/modules.config b/conf/modules.config index 5d48d0b..e8e3e63 100644 --- a/conf/modules.config +++ b/conf/modules.config @@ -62,7 +62,7 @@ process { ] } - withName: 'ST_READ_DATA|ST_QUALITY_CONTROLS|ST_CLUSTERING|ST_SPATIALLY_VARIABLE_GENES' { + withName: 'READ_DATA|QUALITY_CONTROLS|CLUSTERING|SPATIALLY_VARIABLE_GENES' { ext.prefix = { "${notebook.baseName}" } publishDir = [ [ @@ -79,20 +79,20 @@ process { [ path: { "${params.outdir}/${meta.id}/data" }, mode: params.publish_dir_mode, - pattern: "artifacts/st_sdata_processed.zarr", - saveAs: { "st_sdata_processed.zarr" } + pattern: "artifacts/sdata_processed.zarr", + saveAs: { "sdata_processed.zarr" } ], [ path: { "${params.outdir}/${meta.id}/data" }, mode: params.publish_dir_mode, - pattern: "artifacts/st_adata_processed.h5ad", - saveAs: { "st_adata_processed.h5ad" } + pattern: "artifacts/adata_processed.h5ad", + saveAs: { "adata_processed.h5ad" } ], [ path: { "${params.outdir}/${meta.id}/degs" }, mode: params.publish_dir_mode, - pattern: "artifacts/st_spatially_variable_genes.csv", - saveAs: { "st_spatially_variable_genes.csv" } + pattern: "artifacts/spatially_variable_genes.csv", + saveAs: { "spatially_variable_genes.csv" } ] ] } diff --git a/conf/test.config b/conf/test.config index ce4909c..97b801b 100644 --- a/conf/test.config +++ b/conf/test.config @@ -25,7 +25,7 @@ params { spaceranger_reference = "https://raw.githubusercontent.com/nf-core/test-datasets/spatialtranscriptomics/testdata/homo_sapiens_chr22_reference.tar.gz" // Parameters - st_qc_min_counts = 5 - st_qc_min_genes = 3 + qc_min_counts = 5 + qc_min_genes = 3 outdir = 'results' } diff --git a/conf/test_downstream.config b/conf/test_downstream.config index ddb52b1..51a6dc9 100644 --- a/conf/test_downstream.config +++ b/conf/test_downstream.config @@ -25,7 +25,7 @@ params { spaceranger_reference = "https://raw.githubusercontent.com/nf-core/test-datasets/spatialtranscriptomics/testdata/homo_sapiens_chr22_reference.tar.gz" // Parameters - st_qc_min_counts = 5 - st_qc_min_genes = 3 + qc_min_counts = 5 + qc_min_genes = 3 outdir = 'results' } diff --git a/conf/test_spaceranger_v1.config b/conf/test_spaceranger_v1.config index 2fca10e..5bce856 100644 --- a/conf/test_spaceranger_v1.config +++ b/conf/test_spaceranger_v1.config @@ -25,7 +25,7 @@ params { spaceranger_reference = "https://raw.githubusercontent.com/nf-core/test-datasets/spatialtranscriptomics/testdata/homo_sapiens_chr22_reference.tar.gz" // Parameters - st_qc_min_counts = 5 - st_qc_min_genes = 3 + qc_min_counts = 5 + qc_min_genes = 3 outdir = 'results' } diff --git a/docs/output.md b/docs/output.md index 98f17c9..d5ea2f6 100644 --- a/docs/output.md +++ b/docs/output.md @@ -53,7 +53,7 @@ information about these files at the [10X website](https://support.10xgenomics.c Output files - `/data/` - - `st_adata_processed.h5ad`: Filtered, normalised and clustered adata. + - `adata_processed.h5ad`: Filtered, normalised and clustered adata. @@ -71,7 +71,7 @@ the data in an interactive way. Output files - `/reports/` - - `st_quality_controls.html`: HTML report. + - `quality_controls.html`: HTML report. @@ -85,7 +85,7 @@ well as presence in tissue; you can find more details in the report itself. Output files - `/reports/` - - `st_clustering.html`: HTML report. + - `clustering.html`: HTML report. @@ -99,9 +99,9 @@ option; you can find more details in the report itself. Output files - `/reports/` - - `st_spatially_variable_genes.html`: HTML report. + - `spatially_variable_genes.html`: HTML report. - `/degs/` - - `st_spatially_variable_genes.csv`: List of spatially variable genes. + - `spatially_variable_genes.csv`: List of spatially variable genes. diff --git a/modules/local/st_read_data.nf b/modules/local/read_data.nf similarity index 87% rename from modules/local/st_read_data.nf rename to modules/local/read_data.nf index 9f162e5..3e15428 100644 --- a/modules/local/st_read_data.nf +++ b/modules/local/read_data.nf @@ -1,7 +1,7 @@ // // Read ST 10x visium and SC 10x data with Scanpy and save to `anndata` file // -process ST_READ_DATA { +process READ_DATA { tag "${meta.id}" label 'process_low' @@ -13,7 +13,7 @@ process ST_READ_DATA { tuple val (meta), path("${meta.id}/*") output: - tuple val(meta), path("st_sdata_raw.zarr"), emit: st_sdata_raw + tuple val(meta), path("sdata_raw.zarr"), emit: sdata_raw path("versions.yml") , emit: versions when: @@ -34,9 +34,9 @@ process ST_READ_DATA { export XDG_DATA_HOME="./.xdg_data_home" # Execute read data script - read_st_data.py \\ + read_data.py \\ --SRCountDir "${meta.id}" \\ - --output_sdata st_sdata_raw.zarr + --output_sdata sdata_raw.zarr cat <<-END_VERSIONS > versions.yml "${task.process}": diff --git a/nextflow.config b/nextflow.config index bf66982..70fa1c0 100644 --- a/nextflow.config +++ b/nextflow.config @@ -18,19 +18,19 @@ params { spaceranger_save_reference = false // Quality controls and filtering - st_qc_min_counts = 500 - st_qc_min_genes = 250 - st_qc_min_spots = 1 - st_qc_mito_threshold = 20.0 - st_qc_ribo_threshold = 0.0 - st_qc_hb_threshold = 100.0 + qc_min_counts = 500 + qc_min_genes = 250 + qc_min_spots = 1 + qc_mito_threshold = 20.0 + qc_ribo_threshold = 0.0 + qc_hb_threshold = 100.0 // Clustering - st_cluster_n_hvgs = 2000 - st_cluster_resolution = 1.0 + cluster_n_hvgs = 2000 + cluster_resolution = 1.0 // Spatial differential expression - st_n_top_spatial_degs = 14 + n_top_spatial_degs = 14 // MultiQC options multiqc_config = null diff --git a/nextflow_schema.json b/nextflow_schema.json index 17e9cde..64b7551 100644 --- a/nextflow_schema.json +++ b/nextflow_schema.json @@ -96,57 +96,57 @@ "fa_icon": "fas fa-magnifying-glass-chart", "description": "Options related to the downstream analyses performed by the pipeline.", "properties": { - "st_qc_min_counts": { + "qc_min_counts": { "type": "integer", "default": 500, "description": "The minimum number of UMIs needed in a spot for that spot to pass the filtering.", "fa_icon": "fas fa-hashtag" }, - "st_qc_min_genes": { + "qc_min_genes": { "type": "integer", "default": 250, "description": "The minimum number of expressed genes in a spot needed for that spot to pass the filtering.", "fa_icon": "fas fa-hashtag" }, - "st_qc_min_spots": { + "qc_min_spots": { "type": "integer", "default": 1, "description": "The minimum number of spots in which a gene is expressed for that gene to pass the filtering.", "fa_icon": "fas fa-hashtag" }, - "st_qc_mito_threshold": { + "qc_mito_threshold": { "type": "number", "default": 20, "description": "The maximum proportion of mitochondrial content that a spot is allowed to have to pass the filtering.", "help_text": "If you do not wish to filter based on mitochondrial content, set this parameter to `100`.", "fa_icon": "fas fa-hashtag" }, - "st_qc_ribo_threshold": { + "qc_ribo_threshold": { "type": "number", "default": 0, "description": "The minimum proportion of ribosomal content that a spot is needs to have to pass the filtering (no filtering is done by default).", "fa_icon": "fas fa-hashtag" }, - "st_qc_hb_threshold": { + "qc_hb_threshold": { "type": "number", "default": 100, "description": "The maximum proportion of haemoglobin content that a spot is allowed to have to pass the filtering (no filtering is done by default).", "fa_icon": "fas fa-hashtag" }, - "st_cluster_n_hvgs": { + "cluster_n_hvgs": { "type": "integer", "default": 2000, "description": "The number of top highly variable genes to use for the analyses.", "fa_icon": "fas fa-hashtag" }, - "st_cluster_resolution": { + "cluster_resolution": { "type": "number", "default": 1, "description": "The resolution for the clustering of the spots.", "help_text": "The resolution controls the coarseness of the clustering, where a higher resolution leads to more clusters.", "fa_icon": "fas fa-circle-nodes" }, - "st_n_top_spatial_degs": { + "n_top_spatial_degs": { "type": "integer", "default": 14, "description": "The number of top spatial differentially expressed genes to plot.", diff --git a/subworkflows/local/downstream.nf b/subworkflows/local/downstream.nf new file mode 100644 index 0000000..decbcbe --- /dev/null +++ b/subworkflows/local/downstream.nf @@ -0,0 +1,116 @@ +// +// Subworkflow for downstream analyses of ST data +// + +include { QUARTONOTEBOOK as QUALITY_CONTROLS } from '../../modules/nf-core/quartonotebook/main' +include { QUARTONOTEBOOK as SPATIALLY_VARIABLE_GENES } from '../../modules/nf-core/quartonotebook/main' +include { QUARTONOTEBOOK as CLUSTERING } from '../../modules/nf-core/quartonotebook/main' + +workflow DOWNSTREAM { + + take: + sdata_raw + + main: + + ch_versions = Channel.empty() + + // + // Quarto reports and extension files + // + quality_controls_notebook = file("${projectDir}/bin/quality_controls.qmd", checkIfExists: true) + clustering_notebook = file("${projectDir}/bin/clustering.qmd", checkIfExists: true) + spatially_variable_genes_notebook = file("${projectDir}/bin/spatially_variable_genes.qmd", checkIfExists: true) + extensions = Channel.fromPath("${projectDir}/assets/_extensions").collect() + + // + // Quality controls and filtering + // + ch_quality_controls_input_data = sdata_raw + .map { it -> it[1] } + ch_quality_controls_notebook = sdata_raw + .map { tuple(it[0], quality_controls_notebook) } + quality_controls_params = [ + input_sdata: "sdata_raw.zarr", + min_counts: params.qc_min_counts, + min_genes: params.qc_min_genes, + min_spots: params.qc_min_spots, + mito_threshold: params.qc_mito_threshold, + ribo_threshold: params.qc_ribo_threshold, + hb_threshold: params.qc_hb_threshold, + artifact_dir: "artifacts", + output_adata: "adata_filtered.h5ad", + output_sdata: "sdata_filtered.zarr", + ] + QUALITY_CONTROLS ( + ch_quality_controls_notebook, + quality_controls_params, + ch_quality_controls_input_data, + extensions + ) + ch_versions = ch_versions.mix(QUALITY_CONTROLS.out.versions) + + // + // Normalisation, dimensionality reduction and clustering + // + ch_clustering_input_data = QUALITY_CONTROLS.out.artifacts + .map { it -> it[1] } + ch_clustering_notebook = QUALITY_CONTROLS.out.artifacts + .map { tuple(it[0], clustering_notebook) } + clustering_params = [ + input_sdata: "sdata_filtered.zarr", + cluster_resolution: params.cluster_resolution, + n_hvgs: params.cluster_n_hvgs, + artifact_dir: "artifacts", + output_adata: "adata_processed.h5ad", + output_sdata: "sdata_processed.zarr", + ] + CLUSTERING ( + ch_clustering_notebook, + clustering_params, + ch_clustering_input_data, + extensions + ) + ch_versions = ch_versions.mix(CLUSTERING.out.versions) + + // + // Spatially variable genes + // + ch_spatially_variable_genes_input_data = CLUSTERING.out.artifacts + .map { it -> it[1] } + ch_spatially_variable_genes_notebook = CLUSTERING.out.artifacts + .map { tuple(it[0], spatially_variable_genes_notebook) } + spatially_variable_genes_params = [ + input_sdata: "sdata_processed.zarr", + n_top_spatial_degs: params.n_top_spatial_degs, + artifact_dir: "artifacts", + output_csv: "spatially_variable_genes.csv", + output_adata: "adata_spatially_variable_genes.h5ad", + output_sdata: "sdata.zarr", + ] + SPATIALLY_VARIABLE_GENES ( + ch_spatially_variable_genes_notebook, + spatially_variable_genes_params, + ch_spatially_variable_genes_input_data, + extensions + ) + ch_versions = ch_versions.mix(SPATIALLY_VARIABLE_GENES.out.versions) + + emit: + qc_html = QUALITY_CONTROLS.out.html // channel: [ meta, html ] + qc_sdata = QUALITY_CONTROLS.out.artifacts // channel: [ meta, h5ad ] + qc_nb = QUALITY_CONTROLS.out.notebook // channel: [ meta, qmd ] + qc_params = QUALITY_CONTROLS.out.params_yaml // channel: [ meta, yml ] + + clustering_html = CLUSTERING.out.html // channel: [ html ] + clustering_sdata = CLUSTERING.out.artifacts // channel: [ meta, h5ad] + clustering_nb = CLUSTERING.out.notebook // channel: [ meta, qmd ] + clustering_params = CLUSTERING.out.params_yaml // channel: [ meta, yml ] + + svg_html = SPATIALLY_VARIABLE_GENES.out.html // channel: [ meta, html ] + svg_csv = SPATIALLY_VARIABLE_GENES.out.artifacts // channel: [ meta, csv ] + svg_nb = SPATIALLY_VARIABLE_GENES.out.notebook // channel: [ meta, qmd ] + svg_params = SPATIALLY_VARIABLE_GENES.out.params_yaml // channel: [ meta, yml ] + + versions = ch_versions // channel: [ versions.yml ] +} diff --git a/subworkflows/local/spaceranger.nf b/subworkflows/local/spaceranger.nf index 8816074..3dab2bf 100644 --- a/subworkflows/local/spaceranger.nf +++ b/subworkflows/local/spaceranger.nf @@ -8,7 +8,7 @@ include { SPACERANGER_COUNT } from '../../modules/nf-core/spa workflow SPACERANGER { take: - ch_st_data // channel: [ val(meta), [ raw st data ] ] + ch_data // channel: [ val(meta), [ raw st data ] ] main: @@ -44,7 +44,7 @@ workflow SPACERANGER { // Run Space Ranger count // SPACERANGER_COUNT ( - ch_st_data, + ch_data, ch_reference, ch_probeset ) diff --git a/subworkflows/local/st_downstream.nf b/subworkflows/local/st_downstream.nf deleted file mode 100644 index 6cef709..0000000 --- a/subworkflows/local/st_downstream.nf +++ /dev/null @@ -1,116 +0,0 @@ -// -// Subworkflow for downstream analyses of ST data -// - -include { QUARTONOTEBOOK as ST_QUALITY_CONTROLS } from '../../modules/nf-core/quartonotebook/main' -include { QUARTONOTEBOOK as ST_SPATIALLY_VARIABLE_GENES } from '../../modules/nf-core/quartonotebook/main' -include { QUARTONOTEBOOK as ST_CLUSTERING } from '../../modules/nf-core/quartonotebook/main' - -workflow ST_DOWNSTREAM { - - take: - st_sdata_raw - - main: - - ch_versions = Channel.empty() - - // - // Quarto reports and extension files - // - quality_controls_notebook = file("${projectDir}/bin/st_quality_controls.qmd", checkIfExists: true) - clustering_notebook = file("${projectDir}/bin/st_clustering.qmd", checkIfExists: true) - spatially_variable_genes_notebook = file("${projectDir}/bin/st_spatially_variable_genes.qmd", checkIfExists: true) - extensions = Channel.fromPath("${projectDir}/assets/_extensions").collect() - - // - // Quality controls and filtering - // - ch_quality_controls_input_data = st_sdata_raw - .map { it -> it[1] } - ch_quality_controls_notebook = st_sdata_raw - .map { tuple(it[0], quality_controls_notebook) } - quality_controls_params = [ - input_sdata: "st_sdata_raw.zarr", - min_counts: params.st_qc_min_counts, - min_genes: params.st_qc_min_genes, - min_spots: params.st_qc_min_spots, - mito_threshold: params.st_qc_mito_threshold, - ribo_threshold: params.st_qc_ribo_threshold, - hb_threshold: params.st_qc_hb_threshold, - artifact_dir: "artifacts", - output_adata: "st_adata_filtered.h5ad", - output_sdata: "st_sdata_filtered.zarr", - ] - ST_QUALITY_CONTROLS ( - ch_quality_controls_notebook, - quality_controls_params, - ch_quality_controls_input_data, - extensions - ) - ch_versions = ch_versions.mix(ST_QUALITY_CONTROLS.out.versions) - - // - // Normalisation, dimensionality reduction and clustering - // - ch_clustering_input_data = ST_QUALITY_CONTROLS.out.artifacts - .map { it -> it[1] } - ch_clustering_notebook = ST_QUALITY_CONTROLS.out.artifacts - .map { tuple(it[0], clustering_notebook) } - clustering_params = [ - input_sdata: "st_sdata_filtered.zarr", - cluster_resolution: params.st_cluster_resolution, - n_hvgs: params.st_cluster_n_hvgs, - artifact_dir: "artifacts", - output_adata: "st_adata_processed.h5ad", - output_sdata: "st_sdata_processed.zarr", - ] - ST_CLUSTERING ( - ch_clustering_notebook, - clustering_params, - ch_clustering_input_data, - extensions - ) - ch_versions = ch_versions.mix(ST_CLUSTERING.out.versions) - - // - // Spatially variable genes - // - ch_spatially_variable_genes_input_data = ST_CLUSTERING.out.artifacts - .map { it -> it[1] } - ch_spatially_variable_genes_notebook = ST_CLUSTERING.out.artifacts - .map { tuple(it[0], spatially_variable_genes_notebook) } - spatially_variable_genes_params = [ - input_sdata: "st_sdata_processed.zarr", - n_top_spatial_degs: params.st_n_top_spatial_degs, - artifact_dir: "artifacts", - output_csv: "st_spatially_variable_genes.csv", - output_adata: "st_adata_spatially_variable_genes.h5ad", - output_sdata: "st_sdata.zarr", - ] - ST_SPATIALLY_VARIABLE_GENES ( - ch_spatially_variable_genes_notebook, - spatially_variable_genes_params, - ch_spatially_variable_genes_input_data, - extensions - ) - ch_versions = ch_versions.mix(ST_SPATIALLY_VARIABLE_GENES.out.versions) - - emit: - st_qc_html = ST_QUALITY_CONTROLS.out.html // channel: [ meta, html ] - st_sdata_filtered = ST_QUALITY_CONTROLS.out.artifacts // channel: [ meta, h5ad ] - st_qc_notebook = ST_QUALITY_CONTROLS.out.notebook // channel: [ meta, qmd ] - st_qc_params = ST_QUALITY_CONTROLS.out.params_yaml // channel: [ meta, yml ] - - st_clustering_html = ST_CLUSTERING.out.html // channel: [ html ] - st_sdata_processed = ST_CLUSTERING.out.artifacts // channel: [ meta, h5ad] - st_clustering_notebook = ST_CLUSTERING.out.notebook // channel: [ meta, qmd ] - st_clustering_params = ST_CLUSTERING.out.params_yaml // channel: [ meta, yml ] - - st_svg_html = ST_SPATIALLY_VARIABLE_GENES.out.html // channel: [ meta, html ] - st_output = ST_SPATIALLY_VARIABLE_GENES.out.artifacts // channel: [ meta, csv ] - st_svg_notebook = ST_SPATIALLY_VARIABLE_GENES.out.notebook // channel: [ meta, qmd ] - st_svg_params = ST_SPATIALLY_VARIABLE_GENES.out.params_yaml // channel: [ meta, yml ] - - versions = ch_versions // channel: [ versions.yml ] -} diff --git a/tests/pipeline/test_downstream.nf.test b/tests/pipeline/test_downstream.nf.test index 51e405d..404cc1f 100644 --- a/tests/pipeline/test_downstream.nf.test +++ b/tests/pipeline/test_downstream.nf.test @@ -12,8 +12,8 @@ nextflow_pipeline { spaceranger_reference = "https://raw.githubusercontent.com/nf-core/test-datasets/spatialtranscriptomics/testdata/homo_sapiens_chr22_reference.tar.gz" // Parameters - st_qc_min_counts = 5 - st_qc_min_genes = 3 + qc_min_counts = 5 + qc_min_genes = 3 outdir = "$outputDir" } } @@ -26,22 +26,22 @@ nextflow_pipeline { { assert snapshot(UTILS.removeNextflowVersion("$outputDir")).match("nf_core_pipeline_software_mqc_versions.yml") }, // Data - { assert file("$outputDir/CytAssist_11mm_FFPE_Human_Glioblastoma_2/data/st_adata_processed.h5ad").exists() }, - { assert path("$outputDir/CytAssist_11mm_FFPE_Human_Glioblastoma_2/data/st_sdata_processed.zarr").exists() }, - { assert file("$outputDir/CytAssist_11mm_FFPE_Human_Glioblastoma_2.2/data/st_adata_processed.h5ad").exists() }, - { assert path("$outputDir/CytAssist_11mm_FFPE_Human_Glioblastoma_2.2/data/st_sdata_processed.zarr").exists() }, + { assert file("$outputDir/CytAssist_11mm_FFPE_Human_Glioblastoma_2/data/adata_processed.h5ad").exists() }, + { assert path("$outputDir/CytAssist_11mm_FFPE_Human_Glioblastoma_2/data/sdata_processed.zarr").exists() }, + { assert file("$outputDir/CytAssist_11mm_FFPE_Human_Glioblastoma_2.2/data/adata_processed.h5ad").exists() }, + { assert path("$outputDir/CytAssist_11mm_FFPE_Human_Glioblastoma_2.2/data/sdata_processed.zarr").exists() }, // Reports - { assert file("$outputDir/CytAssist_11mm_FFPE_Human_Glioblastoma_2/reports/st_quality_controls.html").text.contains("final results of all the filtering") }, - { assert file("$outputDir/CytAssist_11mm_FFPE_Human_Glioblastoma_2/reports/st_clustering.html").text.contains("spatial distribution of clusters") }, - { assert file("$outputDir/CytAssist_11mm_FFPE_Human_Glioblastoma_2/reports/st_spatially_variable_genes.html").text.contains("Spatial transcriptomics data can give insight") }, - { assert file("$outputDir/CytAssist_11mm_FFPE_Human_Glioblastoma_2.2/reports/st_quality_controls.html").text.contains("final results of all the filtering") }, - { assert file("$outputDir/CytAssist_11mm_FFPE_Human_Glioblastoma_2.2/reports/st_clustering.html").text.contains("spatial distribution of clusters") }, - { assert file("$outputDir/CytAssist_11mm_FFPE_Human_Glioblastoma_2.2/reports/st_spatially_variable_genes.html").text.contains("Spatial transcriptomics data can give insight") }, + { assert file("$outputDir/CytAssist_11mm_FFPE_Human_Glioblastoma_2/reports/quality_controls.html").text.contains("final results of all the filtering") }, + { assert file("$outputDir/CytAssist_11mm_FFPE_Human_Glioblastoma_2/reports/clustering.html").text.contains("spatial distribution of clusters") }, + { assert file("$outputDir/CytAssist_11mm_FFPE_Human_Glioblastoma_2/reports/spatially_variable_genes.html").text.contains("Spatial transcriptomics data can give insight") }, + { assert file("$outputDir/CytAssist_11mm_FFPE_Human_Glioblastoma_2.2/reports/quality_controls.html").text.contains("final results of all the filtering") }, + { assert file("$outputDir/CytAssist_11mm_FFPE_Human_Glioblastoma_2.2/reports/clustering.html").text.contains("spatial distribution of clusters") }, + { assert file("$outputDir/CytAssist_11mm_FFPE_Human_Glioblastoma_2.2/reports/spatially_variable_genes.html").text.contains("Spatial transcriptomics data can give insight") }, // DEGs - { assert file("$outputDir/CytAssist_11mm_FFPE_Human_Glioblastoma_2/degs/st_spatially_variable_genes.csv").exists() }, - { assert file("$outputDir/CytAssist_11mm_FFPE_Human_Glioblastoma_2.2/degs/st_spatially_variable_genes.csv").exists() }, + { assert file("$outputDir/CytAssist_11mm_FFPE_Human_Glioblastoma_2/degs/spatially_variable_genes.csv").exists() }, + { assert file("$outputDir/CytAssist_11mm_FFPE_Human_Glioblastoma_2.2/degs/spatially_variable_genes.csv").exists() }, // MultiQC { assert file("$outputDir/multiqc/multiqc_report.html").exists() } diff --git a/tests/pipeline/test_downstream.nf.test.snap b/tests/pipeline/test_downstream.nf.test.snap index b918fbc..eba2f1a 100644 --- a/tests/pipeline/test_downstream.nf.test.snap +++ b/tests/pipeline/test_downstream.nf.test.snap @@ -1,7 +1,7 @@ { "nf_core_pipeline_software_mqc_versions.yml": { "content": [ - "{SPACERANGER_UNTAR_REFERENCE={untar=1.3}, ST_CLUSTERING={quarto=1.4.549, papermill=null}, ST_QUALITY_CONTROLS={quarto=1.4.549, papermill=null}, ST_READ_DATA={scanpy=1.9.8}, ST_SPATIALLY_VARIABLE_GENES={quarto=1.4.549, papermill=null}, UNTAR_DOWNSTREAM_INPUT={untar=1.3}, Workflow={nf-core/spatialtranscriptomics=v1.0dev}}" + "{SPACERANGER_UNTAR_REFERENCE={untar=1.3}, CLUSTERING={quarto=1.4.549, papermill=null}, QUALITY_CONTROLS={quarto=1.4.549, papermill=null}, READ_DATA={scanpy=1.9.8}, SPATIALLY_VARIABLE_GENES={quarto=1.4.549, papermill=null}, UNTAR_DOWNSTREAM_INPUT={untar=1.3}, Workflow={nf-core/spatialtranscriptomics=v1.0dev}}" ], "meta": { "nf-test": "0.8.4", diff --git a/tests/pipeline/test_spaceranger_ffpe_v1.nf.test b/tests/pipeline/test_spaceranger_ffpe_v1.nf.test index df375e6..1aa7bd5 100644 --- a/tests/pipeline/test_spaceranger_ffpe_v1.nf.test +++ b/tests/pipeline/test_spaceranger_ffpe_v1.nf.test @@ -9,8 +9,8 @@ nextflow_pipeline { input = 'https://raw.githubusercontent.com/nf-core/test-datasets/spatialtranscriptomics/testdata/human-ovarian-cancer-1-standard_v1_ffpe/samplesheet_spaceranger.csv' spaceranger_probeset = 'https://raw.githubusercontent.com/nf-core/test-datasets/spatialtranscriptomics/testdata/human-ovarian-cancer-1-standard_v1_ffpe/Visium_Human_Transcriptome_Probe_Set_v1.0_GRCh38-2020-A.csv' spaceranger_reference = "https://raw.githubusercontent.com/nf-core/test-datasets/spatialtranscriptomics/testdata/homo_sapiens_chr22_reference.tar.gz" - st_qc_min_counts = 5 - st_qc_min_genes = 3 + qc_min_counts = 5 + qc_min_genes = 3 outdir = "$outputDir" } } @@ -23,16 +23,16 @@ nextflow_pipeline { { assert snapshot(UTILS.removeNextflowVersion("$outputDir")).match("nf_core_pipeline_software_mqc_versions.yml") }, // Data - { assert file("$outputDir/Visium_FFPE_Human_Ovarian_Cancer/data/st_adata_processed.h5ad").exists() }, - { assert file("$outputDir/Visium_FFPE_Human_Ovarian_Cancer/data/st_sdata_processed.zarr").exists() }, + { assert file("$outputDir/Visium_FFPE_Human_Ovarian_Cancer/data/adata_processed.h5ad").exists() }, + { assert file("$outputDir/Visium_FFPE_Human_Ovarian_Cancer/data/sdata_processed.zarr").exists() }, // Reports - { assert file("$outputDir/Visium_FFPE_Human_Ovarian_Cancer/reports/st_quality_controls.html").text.contains("final results of all the filtering") }, - { assert file("$outputDir/Visium_FFPE_Human_Ovarian_Cancer/reports/st_clustering.html").text.contains("spatial distribution of clusters") }, - { assert file("$outputDir/Visium_FFPE_Human_Ovarian_Cancer/reports/st_spatially_variable_genes.html").text.contains("Spatial transcriptomics data can give insight") }, + { assert file("$outputDir/Visium_FFPE_Human_Ovarian_Cancer/reports/quality_controls.html").text.contains("final results of all the filtering") }, + { assert file("$outputDir/Visium_FFPE_Human_Ovarian_Cancer/reports/clustering.html").text.contains("spatial distribution of clusters") }, + { assert file("$outputDir/Visium_FFPE_Human_Ovarian_Cancer/reports/spatially_variable_genes.html").text.contains("Spatial transcriptomics data can give insight") }, // DEGs - { assert file("$outputDir/Visium_FFPE_Human_Ovarian_Cancer/degs/st_spatially_variable_genes.csv").exists() }, + { assert file("$outputDir/Visium_FFPE_Human_Ovarian_Cancer/degs/spatially_variable_genes.csv").exists() }, // Space Ranger { assert file("$outputDir/Visium_FFPE_Human_Ovarian_Cancer/spaceranger/outs/web_summary.html").exists() }, diff --git a/tests/pipeline/test_spaceranger_ffpe_v1.nf.test.snap b/tests/pipeline/test_spaceranger_ffpe_v1.nf.test.snap index f0c3b50..b8f5beb 100644 --- a/tests/pipeline/test_spaceranger_ffpe_v1.nf.test.snap +++ b/tests/pipeline/test_spaceranger_ffpe_v1.nf.test.snap @@ -1,7 +1,7 @@ { "software_versions": { "content": [ - "{CUSTOM_DUMPSOFTWAREVERSIONS={python=3.11.7, yaml=5.4.1}, FASTQC={fastqc=0.12.1}, SPACERANGER_COUNT={spaceranger=2.1.0}, SPACERANGER_UNTAR_REFERENCE={untar=1.30}, ST_CLUSTERING={quarto=1.3.302, scanpy=1.9.3}, ST_QUALITY_CONTROLS={quarto=1.3.302, scanpy=1.9.3}, ST_READ_DATA={scanpy=1.7.2}, ST_SPATIAL_DE={SpatialDE=1.1.3, leidenalg=0.9.1, quarto=1.3.302, scanpy=1.9.3}, Workflow={nf-core/spatialtranscriptomics=1.0dev}}" + "{CUSTOM_DUMPSOFTWAREVERSIONS={python=3.11.7, yaml=5.4.1}, FASTQC={fastqc=0.12.1}, SPACERANGER_COUNT={spaceranger=2.1.0}, SPACERANGER_UNTAR_REFERENCE={untar=1.30}, CLUSTERING={quarto=1.3.302, scanpy=1.9.3}, QUALITY_CONTROLS={quarto=1.3.302, scanpy=1.9.3}, READ_DATA={scanpy=1.7.2}, SPATIAL_DE={SpatialDE=1.1.3, leidenalg=0.9.1, quarto=1.3.302, scanpy=1.9.3}, Workflow={nf-core/spatialtranscriptomics=1.0dev}}" ], "meta": { "nf-test": "0.8.4", @@ -11,7 +11,7 @@ }, "nf_core_pipeline_software_mqc_versions.yml": { "content": [ - "{FASTQC={fastqc=0.12.1}, SPACERANGER_COUNT={spaceranger=2.1.0}, SPACERANGER_UNTAR_REFERENCE={untar=1.3}, ST_CLUSTERING={quarto=1.4.549, papermill=null}, ST_QUALITY_CONTROLS={quarto=1.4.549, papermill=null}, ST_READ_DATA={scanpy=1.9.8}, ST_SPATIALLY_VARIABLE_GENES={quarto=1.4.549, papermill=null}, UNTAR_SPACERANGER_INPUT={untar=1.3}, Workflow={nf-core/spatialtranscriptomics=v1.0dev}}" + "{FASTQC={fastqc=0.12.1}, SPACERANGER_COUNT={spaceranger=2.1.0}, SPACERANGER_UNTAR_REFERENCE={untar=1.3}, CLUSTERING={quarto=1.4.549, papermill=null}, QUALITY_CONTROLS={quarto=1.4.549, papermill=null}, READ_DATA={scanpy=1.9.8}, SPATIALLY_VARIABLE_GENES={quarto=1.4.549, papermill=null}, UNTAR_SPACERANGER_INPUT={untar=1.3}, Workflow={nf-core/spatialtranscriptomics=v1.0dev}}" ], "meta": { "nf-test": "0.8.4", diff --git a/tests/pipeline/test_spaceranger_ffpe_v2_cytassist.nf.test b/tests/pipeline/test_spaceranger_ffpe_v2_cytassist.nf.test index c2fba52..74ad1af 100644 --- a/tests/pipeline/test_spaceranger_ffpe_v2_cytassist.nf.test +++ b/tests/pipeline/test_spaceranger_ffpe_v2_cytassist.nf.test @@ -19,16 +19,16 @@ nextflow_pipeline { { assert snapshot(UTILS.removeNextflowVersion("$outputDir")).match("nf_core_pipeline_software_mqc_versions.yml") }, // Data - { assert file("$outputDir/CytAssist_11mm_FFPE_Human_Glioblastoma_2/data/st_adata_processed.h5ad").exists() }, - { assert file("$outputDir/CytAssist_11mm_FFPE_Human_Glioblastoma_2/data/st_sdata_processed.zarr").exists() }, + { assert file("$outputDir/CytAssist_11mm_FFPE_Human_Glioblastoma_2/data/adata_processed.h5ad").exists() }, + { assert file("$outputDir/CytAssist_11mm_FFPE_Human_Glioblastoma_2/data/sdata_processed.zarr").exists() }, // Reports - { assert file("$outputDir/CytAssist_11mm_FFPE_Human_Glioblastoma_2/reports/st_quality_controls.html").text.contains("final results of all the filtering") }, - { assert file("$outputDir/CytAssist_11mm_FFPE_Human_Glioblastoma_2/reports/st_clustering.html").text.contains("spatial distribution of clusters") }, - { assert file("$outputDir/CytAssist_11mm_FFPE_Human_Glioblastoma_2/reports/st_spatially_variable_genes.html").text.contains("Spatial transcriptomics data can give insight") }, + { assert file("$outputDir/CytAssist_11mm_FFPE_Human_Glioblastoma_2/reports/quality_controls.html").text.contains("final results of all the filtering") }, + { assert file("$outputDir/CytAssist_11mm_FFPE_Human_Glioblastoma_2/reports/clustering.html").text.contains("spatial distribution of clusters") }, + { assert file("$outputDir/CytAssist_11mm_FFPE_Human_Glioblastoma_2/reports/spatially_variable_genes.html").text.contains("Spatial transcriptomics data can give insight") }, // DEGs - { assert file("$outputDir/CytAssist_11mm_FFPE_Human_Glioblastoma_2/degs/st_spatially_variable_genes.csv").exists() }, + { assert file("$outputDir/CytAssist_11mm_FFPE_Human_Glioblastoma_2/degs/spatially_variable_genes.csv").exists() }, // Space Ranger { assert file("$outputDir/CytAssist_11mm_FFPE_Human_Glioblastoma_2/spaceranger/outs/web_summary.html").exists() }, diff --git a/tests/pipeline/test_spaceranger_ffpe_v2_cytassist.nf.test.snap b/tests/pipeline/test_spaceranger_ffpe_v2_cytassist.nf.test.snap index 8aede30..2dfeb4c 100644 --- a/tests/pipeline/test_spaceranger_ffpe_v2_cytassist.nf.test.snap +++ b/tests/pipeline/test_spaceranger_ffpe_v2_cytassist.nf.test.snap @@ -1,7 +1,7 @@ { "nf_core_pipeline_software_mqc_versions.yml": { "content": [ - "{FASTQC={fastqc=0.12.1}, SPACERANGER_COUNT={spaceranger=2.1.0}, SPACERANGER_UNTAR_REFERENCE={untar=1.3}, ST_CLUSTERING={quarto=1.4.549, papermill=null}, ST_QUALITY_CONTROLS={quarto=1.4.549, papermill=null}, ST_READ_DATA={scanpy=1.9.8}, ST_SPATIALLY_VARIABLE_GENES={quarto=1.4.549, papermill=null}, UNTAR_SPACERANGER_INPUT={untar=1.3}, Workflow={nf-core/spatialtranscriptomics=v1.0dev}}" + "{FASTQC={fastqc=0.12.1}, SPACERANGER_COUNT={spaceranger=2.1.0}, SPACERANGER_UNTAR_REFERENCE={untar=1.3}, CLUSTERING={quarto=1.4.549, papermill=null}, QUALITY_CONTROLS={quarto=1.4.549, papermill=null}, READ_DATA={scanpy=1.9.8}, SPATIALLY_VARIABLE_GENES={quarto=1.4.549, papermill=null}, UNTAR_SPACERANGER_INPUT={untar=1.3}, Workflow={nf-core/spatialtranscriptomics=v1.0dev}}" ], "meta": { "nf-test": "0.8.4", diff --git a/workflows/spatialtranscriptomics.nf b/workflows/spatialtranscriptomics.nf index 1e1fd5a..c90bfb8 100644 --- a/workflows/spatialtranscriptomics.nf +++ b/workflows/spatialtranscriptomics.nf @@ -4,13 +4,13 @@ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ */ -include { ST_READ_DATA } from '../modules/local/st_read_data' +include { READ_DATA } from '../modules/local/read_data' include { FASTQC } from '../modules/nf-core/fastqc/main' include { MULTIQC } from '../modules/nf-core/multiqc/main' include { paramsSummaryMap } from 'plugin/nf-validation' include { INPUT_CHECK } from '../subworkflows/local/input_check' include { SPACERANGER } from '../subworkflows/local/spaceranger' -include { ST_DOWNSTREAM } from '../subworkflows/local/st_downstream' +include { DOWNSTREAM } from '../subworkflows/local/downstream' include { paramsSummaryMultiqc } from '../subworkflows/nf-core/utils_nfcore_pipeline' include { softwareVersionsToYAML } from '../subworkflows/nf-core/utils_nfcore_pipeline' include { methodsDescriptionText } from '../subworkflows/local/utils_nfcore_spatialtranscriptomics_pipeline' @@ -70,18 +70,18 @@ workflow SPATIALTRANSCRIPTOMICS { // // MODULE: Read ST data and save as `anndata` // - ST_READ_DATA ( + READ_DATA ( ch_downstream_input ) - ch_versions = ch_versions.mix(ST_READ_DATA.out.versions) + ch_versions = ch_versions.mix(READ_DATA.out.versions) // // SUBWORKFLOW: Downstream analyses of ST data // - ST_DOWNSTREAM ( - ST_READ_DATA.out.st_sdata_raw + DOWNSTREAM ( + READ_DATA.out.sdata_raw ) - ch_versions = ch_versions.mix(ST_DOWNSTREAM.out.versions) + ch_versions = ch_versions.mix(DOWNSTREAM.out.versions) // // Collate and save software versions From 4143983d9dfe3ea04c09f8591b0fefe94ab3964e Mon Sep 17 00:00:00 2001 From: Erik Fasterius Date: Tue, 19 Mar 2024 18:51:53 +0100 Subject: [PATCH 40/66] Update snapshots --- tests/pipeline/test_downstream.nf.test.snap | 6 +++--- tests/pipeline/test_spaceranger_ffpe_v1.nf.test.snap | 6 +++--- .../test_spaceranger_ffpe_v2_cytassist.nf.test.snap | 6 +++--- 3 files changed, 9 insertions(+), 9 deletions(-) diff --git a/tests/pipeline/test_downstream.nf.test.snap b/tests/pipeline/test_downstream.nf.test.snap index eba2f1a..d7127c3 100644 --- a/tests/pipeline/test_downstream.nf.test.snap +++ b/tests/pipeline/test_downstream.nf.test.snap @@ -1,12 +1,12 @@ { "nf_core_pipeline_software_mqc_versions.yml": { "content": [ - "{SPACERANGER_UNTAR_REFERENCE={untar=1.3}, CLUSTERING={quarto=1.4.549, papermill=null}, QUALITY_CONTROLS={quarto=1.4.549, papermill=null}, READ_DATA={scanpy=1.9.8}, SPATIALLY_VARIABLE_GENES={quarto=1.4.549, papermill=null}, UNTAR_DOWNSTREAM_INPUT={untar=1.3}, Workflow={nf-core/spatialtranscriptomics=v1.0dev}}" + "{CLUSTERING={quarto=1.4.549, papermill=null}, QUALITY_CONTROLS={quarto=1.4.549, papermill=null}, READ_DATA={scanpy=1.9.8}, SPACERANGER_UNTAR_REFERENCE={untar=1.3}, SPATIALLY_VARIABLE_GENES={quarto=1.4.549, papermill=null}, UNTAR_DOWNSTREAM_INPUT={untar=1.3}, Workflow={nf-core/spatialtranscriptomics=v1.0dev}}" ], "meta": { "nf-test": "0.8.4", "nextflow": "23.10.1" }, - "timestamp": "2024-03-07T13:23:56.226763" + "timestamp": "2024-03-19T18:46:59.035976" } -} +} \ No newline at end of file diff --git a/tests/pipeline/test_spaceranger_ffpe_v1.nf.test.snap b/tests/pipeline/test_spaceranger_ffpe_v1.nf.test.snap index b8f5beb..2a097bc 100644 --- a/tests/pipeline/test_spaceranger_ffpe_v1.nf.test.snap +++ b/tests/pipeline/test_spaceranger_ffpe_v1.nf.test.snap @@ -11,12 +11,12 @@ }, "nf_core_pipeline_software_mqc_versions.yml": { "content": [ - "{FASTQC={fastqc=0.12.1}, SPACERANGER_COUNT={spaceranger=2.1.0}, SPACERANGER_UNTAR_REFERENCE={untar=1.3}, CLUSTERING={quarto=1.4.549, papermill=null}, QUALITY_CONTROLS={quarto=1.4.549, papermill=null}, READ_DATA={scanpy=1.9.8}, SPATIALLY_VARIABLE_GENES={quarto=1.4.549, papermill=null}, UNTAR_SPACERANGER_INPUT={untar=1.3}, Workflow={nf-core/spatialtranscriptomics=v1.0dev}}" + "{CLUSTERING={quarto=1.4.549, papermill=null}, FASTQC={fastqc=0.12.1}, QUALITY_CONTROLS={quarto=1.4.549, papermill=null}, READ_DATA={scanpy=1.9.8}, SPACERANGER_COUNT={spaceranger=2.1.0}, SPACERANGER_UNTAR_REFERENCE={untar=1.3}, SPATIALLY_VARIABLE_GENES={quarto=1.4.549, papermill=null}, UNTAR_SPACERANGER_INPUT={untar=1.3}, Workflow={nf-core/spatialtranscriptomics=v1.0dev}}" ], "meta": { "nf-test": "0.8.4", "nextflow": "23.10.1" }, - "timestamp": "2024-03-07T13:55:24.407294" + "timestamp": "2024-03-19T18:31:18.231368" } -} +} \ No newline at end of file diff --git a/tests/pipeline/test_spaceranger_ffpe_v2_cytassist.nf.test.snap b/tests/pipeline/test_spaceranger_ffpe_v2_cytassist.nf.test.snap index 2dfeb4c..76bba1a 100644 --- a/tests/pipeline/test_spaceranger_ffpe_v2_cytassist.nf.test.snap +++ b/tests/pipeline/test_spaceranger_ffpe_v2_cytassist.nf.test.snap @@ -1,12 +1,12 @@ { "nf_core_pipeline_software_mqc_versions.yml": { "content": [ - "{FASTQC={fastqc=0.12.1}, SPACERANGER_COUNT={spaceranger=2.1.0}, SPACERANGER_UNTAR_REFERENCE={untar=1.3}, CLUSTERING={quarto=1.4.549, papermill=null}, QUALITY_CONTROLS={quarto=1.4.549, papermill=null}, READ_DATA={scanpy=1.9.8}, SPATIALLY_VARIABLE_GENES={quarto=1.4.549, papermill=null}, UNTAR_SPACERANGER_INPUT={untar=1.3}, Workflow={nf-core/spatialtranscriptomics=v1.0dev}}" + "{CLUSTERING={quarto=1.4.549, papermill=null}, FASTQC={fastqc=0.12.1}, QUALITY_CONTROLS={quarto=1.4.549, papermill=null}, READ_DATA={scanpy=1.9.8}, SPACERANGER_COUNT={spaceranger=2.1.0}, SPACERANGER_UNTAR_REFERENCE={untar=1.3}, SPATIALLY_VARIABLE_GENES={quarto=1.4.549, papermill=null}, UNTAR_SPACERANGER_INPUT={untar=1.3}, Workflow={nf-core/spatialtranscriptomics=v1.0dev}}" ], "meta": { "nf-test": "0.8.4", "nextflow": "23.10.1" }, - "timestamp": "2024-03-07T14:28:20.163729" + "timestamp": "2024-03-19T18:45:01.126974" } -} +} \ No newline at end of file From 354f3af8f88f612c8de45f26e471c984b9862595 Mon Sep 17 00:00:00 2001 From: Erik Fasterius Date: Wed, 20 Mar 2024 09:28:12 +0100 Subject: [PATCH 41/66] Update citations --- CITATIONS.md | 10 +++++++--- assets/methods_description_template.yml | 9 ++++++++- 2 files changed, 15 insertions(+), 4 deletions(-) diff --git a/CITATIONS.md b/CITATIONS.md index b6b79a1..a6d8b27 100644 --- a/CITATIONS.md +++ b/CITATIONS.md @@ -32,11 +32,15 @@ - [Space Ranger](https://www.10xgenomics.com/support/software/space-ranger) - > 10x Genomics Space Ranger 2.1.0 + > 10x Genomics Space Ranger 2.1.0 [Online] -- [SpatialDE](https://github.com/Teichlab/SpatialDE) +- [SpatialData](https://www.biorxiv.org/content/10.1101/2023.05.05.539647v1) - > Svensson V, Teichmann S, Stegle O. SpatialDE: identification of spatially variable genes. Nat Methods 15, 343–346 (2018). doi: https://doi.org/10.1038/nmeth.4636 + > Marconato L, Palla G, Yamauchi K, Virshup I, Heidari E, Treis T, Toth M, Shrestha R, Vöhringer H, Huber W, Gerstung M, Moore J, Theis F, Stegle O. SpatialData: an open and universal data framework for spatial omics. bioRxiv 2023.05.05.539647; doi: https://doi.org/10.1101/2023.05.05.539647 + +- [Squipy](https://www.nature.com/articles/s41592-021-01358-2) + + > Palla G, Spitzer H, Klein M et al. Squidpy: a scalable framework for spatial omics analysis. Nat Methods 19, 171–178 (2022). doi: https://doi.org/10.1038/s41592-021-01358-2 ## Software packaging/containerisation tools diff --git a/assets/methods_description_template.yml b/assets/methods_description_template.yml index d8e566d..a18700e 100644 --- a/assets/methods_description_template.yml +++ b/assets/methods_description_template.yml @@ -3,7 +3,6 @@ description: "Suggested text and references to use when describing pipeline usag section_name: "nf-core/spatialtranscriptomics Methods Description" section_href: "https://github.com/nf-core/spatialtranscriptomics" plot_type: "html" -## TODO nf-core: Update the HTML below to your preferred methods description, e.g. add publication citation for this pipeline ## You inject any metadata in the Nextflow '${workflow}' object data: |

    Methods

    @@ -17,6 +16,14 @@ data: |
  • Ewels, P. A., Peltzer, A., Fillinger, S., Patel, H., Alneberg, J., Wilm, A., Garcia, M. U., Di Tommaso, P., & Nahnsen, S. (2020). The nf-core framework for community-curated bioinformatics pipelines. Nature Biotechnology, 38(3), 276-278. doi: 10.1038/s41587-020-0439-x
  • Grüning, B., Dale, R., Sjödin, A., Chapman, B. A., Rowe, J., Tomkins-Tinch, C. H., Valieris, R., Köster, J., & Bioconda Team. (2018). Bioconda: sustainable and comprehensive software distribution for the life sciences. Nature Methods, 15(7), 475–476. doi: 10.1038/s41592-018-0046-7
  • da Veiga Leprevost, F., Grüning, B. A., Alves Aflitos, S., Röst, H. L., Uszkoreit, J., Barsnes, H., Vaudel, M., Moreno, P., Gatto, L., Weber, J., Bai, M., Jimenez, R. C., Sachsenberg, T., Pfeuffer, J., Vera Alvarez, R., Griss, J., Nesvizhskii, A. I., & Perez-Riverol, Y. (2017). BioContainers: an open-source and community-driven framework for software standardization. Bioinformatics (Oxford, England), 33(16), 2580–2582. doi: 10.1093/bioinformatics/btx192
  • +
  • Virshup I, Rybakov S, Theis FJ, Angerer P, Wolf FA. bioRxiv 2021.12.16.473007. doi: 10.1101/2021.12.16.473007
  • +
  • Andrews S. (2010). FastQC: A Quality Control Tool for High Throughput Sequence Data [Online]: bioinformatics.babraham.ak.uk/project/fastqc
  • +
  • Ewels P, Magnusson M, Lundin S, Käller M. MultiQC: summarize analysis results for multiple tools and samples in a single report. Bioinformatics. 2016 Oct 1;32(19):3047-8. Epub 2016 Jun 16. PubMed PMID: 27312411; PubMed Central PMCID: PMC5039924. doi: 10.1093/bioinformatics/btw354
  • +
  • Allaire J, Teague C, Scheidegger C, Xie Y, Dervieux C. Quarto (2022). doi: 10.5281/zenodo.5960048
  • +
  • Wolf F, Angerer P, Theis F. SCANPY: large-scale single-cell gene expression data analysis. Genome Biol 19, 15 (2018). doi: 10.1186/s13059-017-1382-0
  • +
  • 10x Genomics Space Ranger 2.1.0 [Online]10xgenomics.com/support/software/space-ranger
  • +
  • Marconato L, Palla G, Yamauchi K, Virshup I, Heidari E, Treis T, Toth M, Shrestha R, Vöhringer H, Huber W, Gerstung M, Moore J, Theis F, Stegle O. SpatialData: an open and universal data framework for spatial omics. bioRxiv 2023.05.05.539647; doi: 10.1101/2023.05.05.539647
  • +
  • Palla G, Spitzer H, Klein M et al. Squidpy: a scalable framework for spatial omics analysis. Nat Methods 19, 171–178 (2022). doi: 10.1038/s41592-021-01358-2
  • ${tool_bibliography}
    From 2a9fb02a3a2c26d2c95ebdd52d55f9d28af0bc58 Mon Sep 17 00:00:00 2001 From: Erik Fasterius Date: Wed, 20 Mar 2024 09:48:35 +0100 Subject: [PATCH 42/66] Fix duplicate citation entries --- assets/methods_description_template.yml | 16 +----------- .../main.nf | 26 +++++++++++-------- 2 files changed, 16 insertions(+), 26 deletions(-) diff --git a/assets/methods_description_template.yml b/assets/methods_description_template.yml index a18700e..c65a0c4 100644 --- a/assets/methods_description_template.yml +++ b/assets/methods_description_template.yml @@ -11,21 +11,7 @@ data: |
    ${workflow.commandLine}

    ${tool_citations}

    References

    -
      -
    • Di Tommaso, P., Chatzou, M., Floden, E. W., Barja, P. P., Palumbo, E., & Notredame, C. (2017). Nextflow enables reproducible computational workflows. Nature Biotechnology, 35(4), 316-319. doi: 10.1038/nbt.3820
    • -
    • Ewels, P. A., Peltzer, A., Fillinger, S., Patel, H., Alneberg, J., Wilm, A., Garcia, M. U., Di Tommaso, P., & Nahnsen, S. (2020). The nf-core framework for community-curated bioinformatics pipelines. Nature Biotechnology, 38(3), 276-278. doi: 10.1038/s41587-020-0439-x
    • -
    • Grüning, B., Dale, R., Sjödin, A., Chapman, B. A., Rowe, J., Tomkins-Tinch, C. H., Valieris, R., Köster, J., & Bioconda Team. (2018). Bioconda: sustainable and comprehensive software distribution for the life sciences. Nature Methods, 15(7), 475–476. doi: 10.1038/s41592-018-0046-7
    • -
    • da Veiga Leprevost, F., Grüning, B. A., Alves Aflitos, S., Röst, H. L., Uszkoreit, J., Barsnes, H., Vaudel, M., Moreno, P., Gatto, L., Weber, J., Bai, M., Jimenez, R. C., Sachsenberg, T., Pfeuffer, J., Vera Alvarez, R., Griss, J., Nesvizhskii, A. I., & Perez-Riverol, Y. (2017). BioContainers: an open-source and community-driven framework for software standardization. Bioinformatics (Oxford, England), 33(16), 2580–2582. doi: 10.1093/bioinformatics/btx192
    • -
    • Virshup I, Rybakov S, Theis FJ, Angerer P, Wolf FA. bioRxiv 2021.12.16.473007. doi: 10.1101/2021.12.16.473007
    • -
    • Andrews S. (2010). FastQC: A Quality Control Tool for High Throughput Sequence Data [Online]: bioinformatics.babraham.ak.uk/project/fastqc
    • -
    • Ewels P, Magnusson M, Lundin S, Käller M. MultiQC: summarize analysis results for multiple tools and samples in a single report. Bioinformatics. 2016 Oct 1;32(19):3047-8. Epub 2016 Jun 16. PubMed PMID: 27312411; PubMed Central PMCID: PMC5039924. doi: 10.1093/bioinformatics/btw354
    • -
    • Allaire J, Teague C, Scheidegger C, Xie Y, Dervieux C. Quarto (2022). doi: 10.5281/zenodo.5960048
    • -
    • Wolf F, Angerer P, Theis F. SCANPY: large-scale single-cell gene expression data analysis. Genome Biol 19, 15 (2018). doi: 10.1186/s13059-017-1382-0
    • -
    • 10x Genomics Space Ranger 2.1.0 [Online]10xgenomics.com/support/software/space-ranger
    • -
    • Marconato L, Palla G, Yamauchi K, Virshup I, Heidari E, Treis T, Toth M, Shrestha R, Vöhringer H, Huber W, Gerstung M, Moore J, Theis F, Stegle O. SpatialData: an open and universal data framework for spatial omics. bioRxiv 2023.05.05.539647; doi: 10.1101/2023.05.05.539647
    • -
    • Palla G, Spitzer H, Klein M et al. Squidpy: a scalable framework for spatial omics analysis. Nat Methods 19, 171–178 (2022). doi: 10.1038/s41592-021-01358-2
    • - ${tool_bibliography} -
    +
      ${tool_bibliography}
    Notes:
      diff --git a/subworkflows/local/utils_nfcore_spatialtranscriptomics_pipeline/main.nf b/subworkflows/local/utils_nfcore_spatialtranscriptomics_pipeline/main.nf index 90f1e6a..c037da1 100644 --- a/subworkflows/local/utils_nfcore_spatialtranscriptomics_pipeline/main.nf +++ b/subworkflows/local/utils_nfcore_spatialtranscriptomics_pipeline/main.nf @@ -132,8 +132,9 @@ def toolCitationText() { "MultiQC (Ewels et al. 2016),", "Quarto (Allaire et al. 2022),", "Scanpy (Wolf et al. 2018),", - "Space Ranger (10x Genomics) and", - "SpatialDE (Svensson et al. 2018)." + "Space Ranger (10x Genomics)", + "SpatialData (Marconato et al. 2023) and", + "Squidpy (Palla et al. 2022)" ].join(' ').trim() return citation_text @@ -142,13 +143,18 @@ def toolCitationText() { def toolBibliographyText() { def reference_text = [ - "
    • Virshup I, Rybakov S, Theis FJ, Angerer P, Wolf FA. bioRxiv 2021.12.16.473007; doi: 10.1101/2021.12.16.473007
    • ", - "
    • Andrews S, (2010) FastQC, URL: bioinformatics.babraham.ac.uk.
    • ", - "
    • Ewels, P., Magnusson, M., Lundin, S., & Käller, M. (2016). MultiQC: summarize analysis results for multiple tools and samples in a single report. Bioinformatics , 32(19), 3047–3048. doi: 10.1093/bioinformatics/btw354
    • ", - "
    • Allaire J, Teague C, Scheidegger C, Xie Y, Dervieux C. Quarto (2022). doi: 10.5281/zenodo.5960048
    • ", - "
    • Wolf F, Angerer P, Theis F. SCANPY: large-scale single-cell gene expression data analysis. Genome Biol 19, 15 (2018). doi: 10.1186/s13059-017-1382-0
    • ", - "
    • 10x Genomics Space Ranger 2.1.0, URL: 10xgenomics.com/support/software/space-ranger
    • ", - "
    • Svensson V, Teichmann S, Stegle O. SpatialDE: identification of spatially variable genes. Nat Methods 15, 343–346 (2018). doi: 10.1038/nmeth.4636
    • ", + '
    • Di Tommaso, P., Chatzou, M., Floden, E. W., Barja, P. P., Palumbo, E., & Notredame, C. (2017). Nextflow enables reproducible computational workflows. Nature Biotechnology, 35(4), 316-319. doi: 10.1038/nbt.3820
    • ', + '
    • Ewels, P. A., Peltzer, A., Fillinger, S., Patel, H., Alneberg, J., Wilm, A., Garcia, M. U., Di Tommaso, P., & Nahnsen, S. (2020). The nf-core framework for community-curated bioinformatics pipelines. Nature Biotechnology, 38(3), 276-278. doi: 10.1038/s41587-020-0439-x
    • ', + '
    • Grüning, B., Dale, R., Sjödin, A., Chapman, B. A., Rowe, J., Tomkins-Tinch, C. H., Valieris, R., Köster, J., & Bioconda Team. (2018). Bioconda: sustainable and comprehensive software distribution for the life sciences. Nature Methods, 15(7), 475–476. doi: 10.1038/s41592-018-0046-7
    • ', + '
    • da Veiga Leprevost, F., Grüning, B. A., Alves Aflitos, S., Röst, H. L., Uszkoreit, J., Barsnes, H., Vaudel, M., Moreno, P., Gatto, L., Weber, J., Bai, M., Jimenez, R. C., Sachsenberg, T., Pfeuffer, J., Vera Alvarez, R., Griss, J., Nesvizhskii, A. I., & Perez-Riverol, Y. (2017). BioContainers: an open-source and community-driven framework for software standardization. Bioinformatics (Oxford, England), 33(16), 2580–2582. doi: 10.1093/bioinformatics/btx192
    • ', + '
    • Virshup I, Rybakov S, Theis FJ, Angerer P, Wolf FA. bioRxiv 2021.12.16.473007. doi: 10.1101/2021.12.16.473007
    • ', + '
    • Andrews S. (2010). FastQC: A Quality Control Tool for High Throughput Sequence Data [Online]: bioinformatics.babraham.ak.uk/project/fastqc
    • ', + '
    • Ewels P, Magnusson M, Lundin S, Käller M. MultiQC: summarize analysis results for multiple tools and samples in a single report. Bioinformatics. 2016 Oct 1;32(19):3047-8. Epub 2016 Jun 16. PubMed PMID: 27312411; PubMed Central PMCID: PMC5039924. doi: 10.1093/bioinformatics/btw354
    • ', + '
    • Allaire J, Teague C, Scheidegger C, Xie Y, Dervieux C. Quarto (2022). doi: 10.5281/zenodo.5960048
    • ', + '
    • Wolf F, Angerer P, Theis F. SCANPY: large-scale single-cell gene expression data analysis. Genome Biol 19, 15 (2018). doi: 10.1186/s13059-017-1382-0
    • ', + '
    • 10x Genomics Space Ranger 2.1.0 [Online]: 10xgenomics.com/support/software/space-ranger
    • ', + '
    • Marconato L, Palla G, Yamauchi K, Virshup I, Heidari E, Treis T, Toth M, Shrestha R, Vöhringer H, Huber W, Gerstung M, Moore J, Theis F, Stegle O. SpatialData: an open and universal data framework for spatial omics. bioRxiv 2023.05.05.539647; doi: 10.1101/2023.05.05.539647
    • ', + '
    • Palla G, Spitzer H, Klein M et al. Squidpy: a scalable framework for spatial omics analysis. Nat Methods 19, 171–178 (2022). doi: 10.1038/s41592-021-01358-2
    • ', ].join(' ').trim() return reference_text @@ -165,8 +171,6 @@ def methodsDescriptionText(mqc_methods_yaml) { meta["nodoi_text"] = meta.manifest_map.doi ? "": "
    • If available, make sure to update the text to include the Zenodo DOI of version of the pipeline used.
    • " // Tool references - meta["tool_citations"] = "" - meta["tool_bibliography"] = "" meta["tool_citations"] = toolCitationText().replaceAll(", \\.", ".").replaceAll("\\. \\.", ".").replaceAll(", \\.", ".") meta["tool_bibliography"] = toolBibliographyText() From c0c19ad7a4e14ac611ab35f3dd8f24c7c9c7ba9e Mon Sep 17 00:00:00 2001 From: Erik Fasterius Date: Thu, 21 Mar 2024 11:18:35 +0100 Subject: [PATCH 43/66] Add pipeline logo to Quarto report ToCs --- assets/_extensions/nf-core/_extension.yml | 6 +++++- .../nf-core/nf-core-spatialtranscriptomics_logo_light.png | 1 + assets/_extensions/nf-core/toc.html | 7 +++++++ 3 files changed, 13 insertions(+), 1 deletion(-) create mode 120000 assets/_extensions/nf-core/nf-core-spatialtranscriptomics_logo_light.png create mode 100644 assets/_extensions/nf-core/toc.html diff --git a/assets/_extensions/nf-core/_extension.yml b/assets/_extensions/nf-core/_extension.yml index 2089122..69579df 100644 --- a/assets/_extensions/nf-core/_extension.yml +++ b/assets/_extensions/nf-core/_extension.yml @@ -11,11 +11,15 @@ contributes: highlight-style: nf-core.theme smooth-scroll: true theme: [default, nf-core.scss] - toc-location: left toc: true + toc-image: nf-core-spatialtranscriptomics_logo_light.png + toc-location: left + template-partials: + - toc.html revealjs: code-line-numbers: false embed-resources: true + logo: nf-core-spatialtranscriptomics_logo_light.png slide-level: 2 slide-number: false theme: [default, nf-core.scss] diff --git a/assets/_extensions/nf-core/nf-core-spatialtranscriptomics_logo_light.png b/assets/_extensions/nf-core/nf-core-spatialtranscriptomics_logo_light.png new file mode 120000 index 0000000..a64fe77 --- /dev/null +++ b/assets/_extensions/nf-core/nf-core-spatialtranscriptomics_logo_light.png @@ -0,0 +1 @@ +../../nf-core-spatialtranscriptomics_logo_light.png \ No newline at end of file diff --git a/assets/_extensions/nf-core/toc.html b/assets/_extensions/nf-core/toc.html new file mode 100644 index 0000000..b402642 --- /dev/null +++ b/assets/_extensions/nf-core/toc.html @@ -0,0 +1,7 @@ + From b275bc7620afe0c183a54a4c2abb8fc4d3c92668 Mon Sep 17 00:00:00 2001 From: Erik Fasterius Date: Tue, 2 Apr 2024 14:27:10 +0200 Subject: [PATCH 44/66] Downgrade Quarto to 1.3 due to figure formatting Downgrade the Quarto version to 1.3 due to some odd interaction between the Python figures and the `layout-ncol` Quarto chunk option in 1.4, which made the figures come out horizontally squashed. --- env/Dockerfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/env/Dockerfile b/env/Dockerfile index 43f18cb..ad1c06f 100644 --- a/env/Dockerfile +++ b/env/Dockerfile @@ -2,7 +2,7 @@ # First stage: Quarto installation # FROM ubuntu:20.04 as quarto -ARG QUARTO_VERSION=1.4.549 +ARG QUARTO_VERSION=1.3.450 ARG TARGETARCH RUN apt-get update \ && apt-get install -y --no-install-recommends \ From d994410218d45aff12caeae7ddaa33513575e506 Mon Sep 17 00:00:00 2001 From: Erik Fasterius Date: Tue, 2 Apr 2024 14:37:51 +0200 Subject: [PATCH 45/66] Update snapshots --- tests/pipeline/test_downstream.nf.test.snap | 4 ++-- tests/pipeline/test_spaceranger_ffpe_v1.nf.test.snap | 4 ++-- .../pipeline/test_spaceranger_ffpe_v2_cytassist.nf.test.snap | 4 ++-- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/tests/pipeline/test_downstream.nf.test.snap b/tests/pipeline/test_downstream.nf.test.snap index d7127c3..824113d 100644 --- a/tests/pipeline/test_downstream.nf.test.snap +++ b/tests/pipeline/test_downstream.nf.test.snap @@ -1,7 +1,7 @@ { "nf_core_pipeline_software_mqc_versions.yml": { "content": [ - "{CLUSTERING={quarto=1.4.549, papermill=null}, QUALITY_CONTROLS={quarto=1.4.549, papermill=null}, READ_DATA={scanpy=1.9.8}, SPACERANGER_UNTAR_REFERENCE={untar=1.3}, SPATIALLY_VARIABLE_GENES={quarto=1.4.549, papermill=null}, UNTAR_DOWNSTREAM_INPUT={untar=1.3}, Workflow={nf-core/spatialtranscriptomics=v1.0dev}}" + "{CLUSTERING={quarto=1.3.450, papermill=null}, QUALITY_CONTROLS={quarto=1.3.450, papermill=null}, READ_DATA={scanpy=1.9.8}, SPACERANGER_UNTAR_REFERENCE={untar=1.3}, SPATIALLY_VARIABLE_GENES={quarto=1.3.450, papermill=null}, UNTAR_DOWNSTREAM_INPUT={untar=1.3}, Workflow={nf-core/spatialtranscriptomics=v1.0dev}}" ], "meta": { "nf-test": "0.8.4", @@ -9,4 +9,4 @@ }, "timestamp": "2024-03-19T18:46:59.035976" } -} \ No newline at end of file +} diff --git a/tests/pipeline/test_spaceranger_ffpe_v1.nf.test.snap b/tests/pipeline/test_spaceranger_ffpe_v1.nf.test.snap index 2a097bc..063d565 100644 --- a/tests/pipeline/test_spaceranger_ffpe_v1.nf.test.snap +++ b/tests/pipeline/test_spaceranger_ffpe_v1.nf.test.snap @@ -11,7 +11,7 @@ }, "nf_core_pipeline_software_mqc_versions.yml": { "content": [ - "{CLUSTERING={quarto=1.4.549, papermill=null}, FASTQC={fastqc=0.12.1}, QUALITY_CONTROLS={quarto=1.4.549, papermill=null}, READ_DATA={scanpy=1.9.8}, SPACERANGER_COUNT={spaceranger=2.1.0}, SPACERANGER_UNTAR_REFERENCE={untar=1.3}, SPATIALLY_VARIABLE_GENES={quarto=1.4.549, papermill=null}, UNTAR_SPACERANGER_INPUT={untar=1.3}, Workflow={nf-core/spatialtranscriptomics=v1.0dev}}" + "{CLUSTERING={quarto=1.3.450, papermill=null}, FASTQC={fastqc=0.12.1}, QUALITY_CONTROLS={quarto=1.3.450, papermill=null}, READ_DATA={scanpy=1.9.8}, SPACERANGER_COUNT={spaceranger=2.1.0}, SPACERANGER_UNTAR_REFERENCE={untar=1.3}, SPATIALLY_VARIABLE_GENES={quarto=1.3.450, papermill=null}, UNTAR_SPACERANGER_INPUT={untar=1.3}, Workflow={nf-core/spatialtranscriptomics=v1.0dev}}" ], "meta": { "nf-test": "0.8.4", @@ -19,4 +19,4 @@ }, "timestamp": "2024-03-19T18:31:18.231368" } -} \ No newline at end of file +} diff --git a/tests/pipeline/test_spaceranger_ffpe_v2_cytassist.nf.test.snap b/tests/pipeline/test_spaceranger_ffpe_v2_cytassist.nf.test.snap index 76bba1a..032f4ef 100644 --- a/tests/pipeline/test_spaceranger_ffpe_v2_cytassist.nf.test.snap +++ b/tests/pipeline/test_spaceranger_ffpe_v2_cytassist.nf.test.snap @@ -1,7 +1,7 @@ { "nf_core_pipeline_software_mqc_versions.yml": { "content": [ - "{CLUSTERING={quarto=1.4.549, papermill=null}, FASTQC={fastqc=0.12.1}, QUALITY_CONTROLS={quarto=1.4.549, papermill=null}, READ_DATA={scanpy=1.9.8}, SPACERANGER_COUNT={spaceranger=2.1.0}, SPACERANGER_UNTAR_REFERENCE={untar=1.3}, SPATIALLY_VARIABLE_GENES={quarto=1.4.549, papermill=null}, UNTAR_SPACERANGER_INPUT={untar=1.3}, Workflow={nf-core/spatialtranscriptomics=v1.0dev}}" + "{CLUSTERING={quarto=1.3.450, papermill=null}, FASTQC={fastqc=0.12.1}, QUALITY_CONTROLS={quarto=1.3.450, papermill=null}, READ_DATA={scanpy=1.9.8}, SPACERANGER_COUNT={spaceranger=2.1.0}, SPACERANGER_UNTAR_REFERENCE={untar=1.3}, SPATIALLY_VARIABLE_GENES={quarto=1.3.450, papermill=null}, UNTAR_SPACERANGER_INPUT={untar=1.3}, Workflow={nf-core/spatialtranscriptomics=v1.0dev}}" ], "meta": { "nf-test": "0.8.4", @@ -9,4 +9,4 @@ }, "timestamp": "2024-03-19T18:45:01.126974" } -} \ No newline at end of file +} From 5e64cd24db45fbab6eb732abbc3a6dd01d9bae7e Mon Sep 17 00:00:00 2001 From: Christophe Avenel Date: Tue, 2 Apr 2024 15:14:36 +0200 Subject: [PATCH 46/66] Include SpatialData description in all outputs --- CITATIONS.md | 6 +++++- bin/clustering.qmd | 4 ++-- bin/quality_controls.qmd | 2 +- modules/local/read_data.nf | 3 ++- workflows/spatialtranscriptomics.nf | 2 +- 5 files changed, 11 insertions(+), 6 deletions(-) diff --git a/CITATIONS.md b/CITATIONS.md index a6d8b27..beb3be8 100644 --- a/CITATIONS.md +++ b/CITATIONS.md @@ -10,10 +10,14 @@ ## Pipeline tools -- [AnnData](https://github.com/theislab/anndata) +- [AnnData](https://github.com/scverse/anndata) > Virshup I, Rybakov S, Theis FJ, Angerer P, Wolf FA. bioRxiv 2021.12.16.473007; doi: https://doi.org/10.1101/2021.12.16.473007 +- [SpatialData](https://github.com/scverse/spatialdata) + + > Marconato, L., Palla, G., Yamauchi, K.A. et al. SpatialData: an open and universal data framework for spatial omics. Nat Methods (2024); https://doi.org/10.1038/s41592-024-02212-x + - [FastQC](https://www.bioinformatics.babraham.ac.uk/projects/fastqc/) > Andrews, S. (2010). FastQC: A Quality Control Tool for High Throughput Sequence Data [Online]. diff --git a/bin/clustering.qmd b/bin/clustering.qmd index e19cc6f..cecc9da 100644 --- a/bin/clustering.qmd +++ b/bin/clustering.qmd @@ -20,7 +20,7 @@ output_sdata = "sdata_processed.zarr" # Output: SpatialData file ``` The data has already been filtered in the _quality controls_ reports and is -saved in the AnnData format: +saved in the SpatialData format: ```{python} #| warning: false @@ -65,7 +65,7 @@ def to_legacy_anndata(sdata: spatialdata.SpatialData) -> AnnData: sdata = spatialdata.read_zarr(input_sdata, ["images", "table", "shapes"]) adata = to_legacy_anndata(sdata) -print("Content of the AnnData object:") +print("Content of the SpatialData table object:") print(adata) ``` diff --git a/bin/quality_controls.qmd b/bin/quality_controls.qmd index 7c94f78..fd09221 100644 --- a/bin/quality_controls.qmd +++ b/bin/quality_controls.qmd @@ -21,7 +21,7 @@ and the [`scanpy` Python package](https://scanpy.readthedocs.io/en/stable/). The anndata format is utilized to organize and store the Spatial Transcriptomics data. It includes information about counts, features, observations, and additional metadata. The anndata format ensures compatibility with various -analysis tools and facilitates seamless integration into existing workflows. +analysis tools and facilitates seamless integration into existing workflows. The AnnData object is saved in a zarr [SpatialData object](https://spatialdata.scverse.org/en/latest/design_doc.html#table-table-of-annotations-for-regions). ```{python} #| tags: [parameters] diff --git a/modules/local/read_data.nf b/modules/local/read_data.nf index 3e15428..7778ded 100644 --- a/modules/local/read_data.nf +++ b/modules/local/read_data.nf @@ -1,11 +1,12 @@ // -// Read ST 10x visium and SC 10x data with Scanpy and save to `anndata` file +// Read ST 10x visium and SC 10x data with spatialdata_io and save to `SpatialData` file // process READ_DATA { tag "${meta.id}" label 'process_low' + // TODO fix conda environment to include spatialdata_io instead of scanpy conda "conda-forge::scanpy=1.7.2 conda-forge::matplotlib=3.6.3 conda-forge::pandas=1.5.3" container "docker.io/erikfas/spatialtranscriptomics" diff --git a/workflows/spatialtranscriptomics.nf b/workflows/spatialtranscriptomics.nf index c90bfb8..3b2fb75 100644 --- a/workflows/spatialtranscriptomics.nf +++ b/workflows/spatialtranscriptomics.nf @@ -68,7 +68,7 @@ workflow SPATIALTRANSCRIPTOMICS { } // - // MODULE: Read ST data and save as `anndata` + // MODULE: Read ST data and save as `SpatialData` // READ_DATA ( ch_downstream_input From 668d712cc80f2a71d0d0efb46ca0855024b3074c Mon Sep 17 00:00:00 2001 From: Christophe Avenel Date: Tue, 2 Apr 2024 16:21:14 +0200 Subject: [PATCH 47/66] Clean Spatially Variable Genes quarto markdown --- bin/spatially_variable_genes.qmd | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/bin/spatially_variable_genes.qmd b/bin/spatially_variable_genes.qmd index c9421b9..35dd79c 100644 --- a/bin/spatially_variable_genes.qmd +++ b/bin/spatially_variable_genes.qmd @@ -69,7 +69,7 @@ sc.settings.verbosity = 0 # Differential gene expression Before we look for spatially variable genes we first find differentially -expressed genes across the different clusters found in the data. We can +expressed genes (DEG) across the different clusters found in the data. We can visualize the top DEGs in a heatmap: ```{python} @@ -98,6 +98,7 @@ We can perform a neighborhood enrichment analysis to find out which genes are enriched in the neighborhood of each cluster: ```{python} +#| warning: false sq.gr.spatial_neighbors(adata, coord_type="generic") sq.gr.nhood_enrichment(adata, cluster_key="clusters") sq.pl.nhood_enrichment(adata, cluster_key="clusters", method="ward", vmin=-100, vmax=100) @@ -106,8 +107,9 @@ sq.pl.nhood_enrichment(adata, cluster_key="clusters", method="ward", vmin=-100, We visualize the interaction matrix between the different clusters: ```{python} +#| warning: false sq.gr.interaction_matrix(adata, cluster_key="clusters") -sq.pl.interaction_matrix(adata, cluster_key="clusters", method="ward", vmax=20000) +sq.pl.interaction_matrix(adata, cluster_key="clusters", method="ward") ``` # Spatially variable genes with spatial autocorrelation statistics @@ -123,15 +125,17 @@ adata.uns["moranI"].head(n_top_spatial_degs) #[TODO] add gearyC as optional mode ``` +```{python} +#| echo: false +# Save the spatially variable genes to a CSV file: +adata.uns["moranI"].to_csv(os.path.join(artifact_dir, output_csv)) +``` ```{python} #| echo: false +#| info: false adata.write(output_adata) del sdata.table sdata.table = adata sdata.write("./" + output_sdata) ``` - -```{python} -adata.uns["moranI"].to_csv(os.path.join(artifact_dir, output_csv)) -``` From e103fc4ec4b1fac7e6eb73b2381bee9e2c58f757 Mon Sep 17 00:00:00 2001 From: Erik Fasterius Date: Thu, 4 Apr 2024 08:38:10 +0200 Subject: [PATCH 48/66] Update changelog --- CHANGELOG.md | 1 + 1 file changed, 1 insertion(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 8ae362f..066d74d 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -20,6 +20,7 @@ compatible with further downstream analyses and/or exploration in _e.g._ - Add MultiQC support for Space Ranger outputs [[#70](https://github.com/nf-core/spatialtranscriptomics/pull/70)] - Use the QUARTONOTEBOOK nf-core module instead of local Quarto-based modules [[#68](https://github.com/nf-core/spatialtranscriptomics/pull/68)] +- Add support for SpatialData [[$67](https://github.com/nf-core/spatialtranscriptomics/pull/67)] - Add a custom nf-core Quarto template for the downstream analysis reports [[#64](https://github.com/nf-core/spatialtranscriptomics/pull/64)] - Allow input directories `fastq_dir` and `spaceranger_dir` to be specified as tar archives (`.tar.gz`) - Add a check to make sure that there are spots left after filtering [[#46](https://github.com/nf-core/spatialtranscriptomics/issues/46)] From 4f12ac8bc8023c7bddb5bbe191349515002ea51d Mon Sep 17 00:00:00 2001 From: Erik Fasterius Date: Thu, 4 Apr 2024 08:39:38 +0200 Subject: [PATCH 49/66] Remove duplicate citation for SpatialData --- CITATIONS.md | 4 ---- 1 file changed, 4 deletions(-) diff --git a/CITATIONS.md b/CITATIONS.md index beb3be8..d82d84d 100644 --- a/CITATIONS.md +++ b/CITATIONS.md @@ -14,10 +14,6 @@ > Virshup I, Rybakov S, Theis FJ, Angerer P, Wolf FA. bioRxiv 2021.12.16.473007; doi: https://doi.org/10.1101/2021.12.16.473007 -- [SpatialData](https://github.com/scverse/spatialdata) - - > Marconato, L., Palla, G., Yamauchi, K.A. et al. SpatialData: an open and universal data framework for spatial omics. Nat Methods (2024); https://doi.org/10.1038/s41592-024-02212-x - - [FastQC](https://www.bioinformatics.babraham.ac.uk/projects/fastqc/) > Andrews, S. (2010). FastQC: A Quality Control Tool for High Throughput Sequence Data [Online]. From f82267d08a17eb7eb11176e17855d863d47baa3a Mon Sep 17 00:00:00 2001 From: Erik Fasterius Date: Thu, 4 Apr 2024 09:21:04 +0200 Subject: [PATCH 50/66] Minor formatting --- bin/quality_controls.qmd | 2 +- modules/local/read_data.nf | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/bin/quality_controls.qmd b/bin/quality_controls.qmd index fd09221..cb2df55 100644 --- a/bin/quality_controls.qmd +++ b/bin/quality_controls.qmd @@ -81,7 +81,7 @@ def to_legacy_anndata(sdata: spatialdata.SpatialData) -> AnnData: sdata = spatialdata.read_zarr(input_sdata, ["images", "table", "shapes"]) adata = to_legacy_anndata(sdata) -# Convert X matrix from csr to csc dense matrix for output compatibility: +# Convert X matrix from CSR to CSC dense matrix for output compatibility adata.X = scipy.sparse.csc_matrix(adata.X) # Store the raw data so that it can be used for analyses from scratch if desired diff --git a/modules/local/read_data.nf b/modules/local/read_data.nf index 7778ded..dfc7563 100644 --- a/modules/local/read_data.nf +++ b/modules/local/read_data.nf @@ -15,7 +15,7 @@ process READ_DATA { output: tuple val(meta), path("sdata_raw.zarr"), emit: sdata_raw - path("versions.yml") , emit: versions + path("versions.yml") , emit: versions when: task.ext.when == null || task.ext.when From 8ae8c266e05b66c736b6d0641acda280d283a48f Mon Sep 17 00:00:00 2001 From: Erik Fasterius Date: Thu, 4 Apr 2024 09:34:44 +0200 Subject: [PATCH 51/66] Update quartonotebook module --- modules.json | 2 +- modules/nf-core/quartonotebook/Dockerfile | 2 +- modules/nf-core/quartonotebook/quartonotebook.diff | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/modules.json b/modules.json index 243013f..86c77ee 100644 --- a/modules.json +++ b/modules.json @@ -17,7 +17,7 @@ }, "quartonotebook": { "branch": "master", - "git_sha": "07ecae35e5675ac4c1e2d84cf22021490f8b7947", + "git_sha": "93b7e1bf63944488fe77ad490a9de62a73959bed", "installed_by": ["modules"], "patch": "modules/nf-core/quartonotebook/quartonotebook.diff" }, diff --git a/modules/nf-core/quartonotebook/Dockerfile b/modules/nf-core/quartonotebook/Dockerfile index 0acc6f0..78d2ab2 100644 --- a/modules/nf-core/quartonotebook/Dockerfile +++ b/modules/nf-core/quartonotebook/Dockerfile @@ -18,7 +18,7 @@ RUN mkdir -p /opt/quarto \ # # Second stage: Conda environment # -FROM condaforge/mambaforge:23.11.0-0 +FROM condaforge/mambaforge:24.1.2-0@sha256:64c45c1a743737f61cf201f54cae974b5c853be94f9c1a84f5e82e0e854f0407 COPY --from=quarto /opt/quarto /opt/quarto ENV PATH="${PATH}:/opt/quarto/bin" diff --git a/modules/nf-core/quartonotebook/quartonotebook.diff b/modules/nf-core/quartonotebook/quartonotebook.diff index f2f640e..018e646 100644 --- a/modules/nf-core/quartonotebook/quartonotebook.diff +++ b/modules/nf-core/quartonotebook/quartonotebook.diff @@ -4,7 +4,7 @@ Changes in module 'nf-core/quartonotebook' @@ -4,11 +4,7 @@ tag "$meta.id" label 'process_low' - + - // NB: You'll likely want to override this with a container containing all - // required dependencies for your analyses. You'll at least need Quarto - // itself, Papermill and whatever language you are running your analyses on; From d4861bd5dacda27029b5b45ca93cae9a3f912c34 Mon Sep 17 00:00:00 2001 From: Erik Fasterius Date: Thu, 4 Apr 2024 09:30:57 +0200 Subject: [PATCH 52/66] Update spaceranger/count module --- conf/modules.config | 1 + modules.json | 2 +- modules/nf-core/spaceranger/count/main.nf | 2 +- .../spaceranger/count/tests/main.nf.test | 4 +- .../spaceranger/count/tests/main.nf.test.snap | 80 ++++++++++++++----- .../spaceranger/count/tests/nextflow.config | 5 ++ tests/pipeline/test_downstream.nf.test.snap | 2 +- .../test_spaceranger_ffpe_v1.nf.test.snap | 8 +- ...spaceranger_ffpe_v2_cytassist.nf.test.snap | 8 +- 9 files changed, 78 insertions(+), 34 deletions(-) create mode 100644 modules/nf-core/spaceranger/count/tests/nextflow.config diff --git a/conf/modules.config b/conf/modules.config index e8e3e63..40b2dbc 100644 --- a/conf/modules.config +++ b/conf/modules.config @@ -55,6 +55,7 @@ process { } withName: SPACERANGER_COUNT { + ext.args = '--create-bam false' publishDir = [ path: { "${params.outdir}/${meta.id}/spaceranger" }, mode: params.publish_dir_mode, diff --git a/modules.json b/modules.json index 86c77ee..e071f8c 100644 --- a/modules.json +++ b/modules.json @@ -23,7 +23,7 @@ }, "spaceranger/count": { "branch": "master", - "git_sha": "3bd057bfdfb64578636ff3ae7f7cb8eeab3c0cb6", + "git_sha": "2f0ef0cd414ea43e33625023c72b6af936dce63d", "installed_by": ["modules"] }, "untar": { diff --git a/modules/nf-core/spaceranger/count/main.nf b/modules/nf-core/spaceranger/count/main.nf index cac83e0..4f766cb 100644 --- a/modules/nf-core/spaceranger/count/main.nf +++ b/modules/nf-core/spaceranger/count/main.nf @@ -2,7 +2,7 @@ process SPACERANGER_COUNT { tag "$meta.id" label 'process_high' - container "docker.io/nfcore/spaceranger:2.1.0" + container "nf-core/spaceranger:3.0.0" input: tuple val(meta), path(reads), path(image), path(cytaimage), path(darkimage), path(colorizedimage), path(alignment), path(slidefile) diff --git a/modules/nf-core/spaceranger/count/tests/main.nf.test b/modules/nf-core/spaceranger/count/tests/main.nf.test index b751b07..7631d85 100644 --- a/modules/nf-core/spaceranger/count/tests/main.nf.test +++ b/modules/nf-core/spaceranger/count/tests/main.nf.test @@ -2,6 +2,7 @@ nextflow_process { name "Test Process SPACERANGER_COUNT" script "../main.nf" + config "./nextflow.config" process "SPACERANGER_COUNT" tag "modules" @@ -210,7 +211,8 @@ nextflow_process { 'molecule_info.h5', 'barcodes.tsv.gz', 'features.tsv.gz', - 'matrix.mtx.gz' + 'matrix.mtx.gz', + 'cloupe.cloupe' ]} ).match() }, diff --git a/modules/nf-core/spaceranger/count/tests/main.nf.test.snap b/modules/nf-core/spaceranger/count/tests/main.nf.test.snap index ece665f..c13496e 100644 --- a/modules/nf-core/spaceranger/count/tests/main.nf.test.snap +++ b/modules/nf-core/spaceranger/count/tests/main.nf.test.snap @@ -2,53 +2,89 @@ "spaceranger v1 (stub) - homo_sapiens - fasta - gtf - fastq - tif - csv": { "content": [ [ - "versions.yml:md5,038e17e049a72dd3d417d0e221dce732" + "versions.yml:md5,1539e8a9a3d63ce3653920721d1af509" ] ], - "timestamp": "2024-01-09T15:09:24.723008" + "meta": { + "nf-test": "0.8.4", + "nextflow": "23.10.1" + }, + "timestamp": "2024-04-02T09:29:02.205153668" }, "spaceranger v2 - homo_sapiens - fasta - gtf - fastq - tif - csv": { "content": [ [ - "versions.yml:md5,038e17e049a72dd3d417d0e221dce732" + "versions.yml:md5,1539e8a9a3d63ce3653920721d1af509" ], [ - "filtered_feature_bc_matrix.h5:md5,509e18ed6b218850e5095124ecc771c1", - "metrics_summary.csv:md5,412caff0fcd9f39cb54671147058de2f", - "possorted_genome_bam.bam:md5,23cd192fcc217d835b8c0afee0619f40", - "possorted_genome_bam.bam.bai:md5,baf623d3e554ba5008304f32414c9fb2", + "clusters.csv:md5,2cc2d0c94ec0af69f03db235f9ea6932", + "clusters.csv:md5,46c12f3845e28f27f2cd580cb004c0ea", + "clusters.csv:md5,4e5f082240b9c9903168842d1f9dbe34", + "clusters.csv:md5,e626eb7049baf591ea49f5d8c305621c", + "clusters.csv:md5,65cfb24fc937e4df903a742c1adf8b08", + "clusters.csv:md5,819a71787618945dacfa2d5301b953b1", + "clusters.csv:md5,5ae17ed02cdb9f61d7ceb0cd6922c9d4", + "clusters.csv:md5,641550bec22e02fff3611087f7fd6e07", + "clusters.csv:md5,9fbe5c79035175bc1899e9a7fc80f7ac", + "clusters.csv:md5,ed0c2dcca15c14a9983407ff9af0daaf", + "differential_expression.csv:md5,d37a8ef21699372ec4a4bdf0c43d71b7", + "differential_expression.csv:md5,ac3181524385c88d38a0fc17d3bdd526", + "differential_expression.csv:md5,557d6dfec7421c392aa6443725608cd1", + "differential_expression.csv:md5,1437fad68d701c97a4a46318aee45575", + "differential_expression.csv:md5,7a2f3d0e90782055580f4903617a7d27", + "differential_expression.csv:md5,41756e9570d07aee6aed710e6a965846", + "differential_expression.csv:md5,62ea7651c3f195d3c960c6c688dca477", + "differential_expression.csv:md5,b630542266c4abb71f4205922340498d", + "differential_expression.csv:md5,0deb97f0be7e72ad73e456092db31e6d", + "differential_expression.csv:md5,3bba8490f753507e7e2e29be759f218b", + "components.csv:md5,568bb9bcb6ee913356fcb4be3fea1911", + "dispersion.csv:md5,e2037b1db404f6e5d8b3144629f2500d", + "features_selected.csv:md5,3ba6d1315ae594963b306d94ba1180e7", + "projection.csv:md5,aef5d71381678d5245e471f3d5a8ab67", + "variance.csv:md5,475a95e51ce66e639ae21d801c455e2b", + "projection.csv:md5,928c0f68a9c773fba590941d3d5af7ca", + "projection.csv:md5,216dcc5589a083fcc27d981aa90fa2ab", + "filtered_feature_bc_matrix.h5:md5,f1a8f225c113974b47efffe08e70f367", + "metrics_summary.csv:md5,faa17487b479eab361050d3266da2efb", "probe_set.csv:md5,5bfb8f12319be1b2b6c14142537c3804", - "raw_feature_bc_matrix.h5:md5,2263d2c756785f86dc28f6b76fd61b73", + "raw_feature_bc_matrix.h5:md5,6e40ae93a116c6fc0adbe707b0eb415f", "raw_probe_bc_matrix.h5:md5,3d5e711d0891ca2caaf301a2c1fbda91", "aligned_fiducials.jpg:md5,51dcc3a32d3d5ca4704f664c8ede81ef", "cytassist_image.tiff:md5,0fb04a55e5658f4d158d986a334b034d", - "detected_tissue_image.jpg:md5,64d9adb4844ab91506131476d93b28dc", - "tissue_hires_image.png:md5,1c0f1e94522a886c19f56a629227e097", + "detected_tissue_image.jpg:md5,1d3ccc1e12c4fee091b006e48b9cc16a", + "spatial_enrichment.csv:md5,1117792553e82feb2b4b3934907a0136", + "tissue_hires_image.png:md5,834706fff299024fab48e6366afc9cb9", "tissue_lowres_image.png:md5,8c1fcb378f7f886301f49ffc4f84360a", - "tissue_positions.csv:md5,1b2df34f9e762e9e64aa226226b96c4b" + "tissue_positions.csv:md5,425601ef21661ec0126000f905ef044f" ] ], - "timestamp": "2024-01-11T17:49:27.776247" + "meta": { + "nf-test": "0.8.4", + "nextflow": "23.10.1" + }, + "timestamp": "2024-04-02T10:13:00.787792273" }, "spaceranger v1 - homo_sapiens - fasta - gtf - fastq - tif - csv": { "content": [ [ - "versions.yml:md5,038e17e049a72dd3d417d0e221dce732" + "versions.yml:md5,1539e8a9a3d63ce3653920721d1af509" ], [ - "filtered_feature_bc_matrix.h5:md5,f444a4816bf40d377271a6157b320556", - "metrics_summary.csv:md5,5e36f2f9b6987791e0b5eb2736d25115", - "molecule_info.h5:md5,b3d14dfbfc167bb8fc9b158f083efdb6", - "possorted_genome_bam.bam:md5,6ed7f3bb2f17322113f940989a3771ff", - "possorted_genome_bam.bam.bai:md5,08ce9ffd30d9b82091932b744873610b", - "raw_feature_bc_matrix.h5:md5,7e937b4863a98b0d3784f4e21c07c326", + "filtered_feature_bc_matrix.h5:md5,7e09d1cd2e1f497a698c5efde9e4af84", + "metrics_summary.csv:md5,07a6fcc2e20f854f8d3fcde2457a2f9a", + "molecule_info.h5:md5,1f2e0fd31d15509e7916e84f22632c9c", + "raw_feature_bc_matrix.h5:md5,5a4184a3bfaf722eec8d1a763a45906e", "aligned_fiducials.jpg:md5,f6217ddd707bb189e665f56b130c3da8", - "detected_tissue_image.jpg:md5,4a26b91db5aca179d627b86f352006e2", + "detected_tissue_image.jpg:md5,c1c7e8741701a576c1ec103c1aaf98ea", "tissue_hires_image.png:md5,d91f8f176ae35ab824ede87117ac0889", "tissue_lowres_image.png:md5,475a04208d193191c84d7a3b5d4eb287", - "tissue_positions.csv:md5,37d288d0e29e8572ea4c5bef292de4b6" + "tissue_positions.csv:md5,748bf590c445db409d7dbdf5a08e72e8" ] ], - "timestamp": "2024-01-11T20:34:18.669838" + "meta": { + "nf-test": "0.8.4", + "nextflow": "23.10.1" + }, + "timestamp": "2024-04-02T09:37:13.128424153" } } \ No newline at end of file diff --git a/modules/nf-core/spaceranger/count/tests/nextflow.config b/modules/nf-core/spaceranger/count/tests/nextflow.config new file mode 100644 index 0000000..fe9d61a --- /dev/null +++ b/modules/nf-core/spaceranger/count/tests/nextflow.config @@ -0,0 +1,5 @@ +process { + withName: SPACERANGER_COUNT { + ext.args = '--create-bam false' + } +} diff --git a/tests/pipeline/test_downstream.nf.test.snap b/tests/pipeline/test_downstream.nf.test.snap index 824113d..c848af7 100644 --- a/tests/pipeline/test_downstream.nf.test.snap +++ b/tests/pipeline/test_downstream.nf.test.snap @@ -9,4 +9,4 @@ }, "timestamp": "2024-03-19T18:46:59.035976" } -} +} \ No newline at end of file diff --git a/tests/pipeline/test_spaceranger_ffpe_v1.nf.test.snap b/tests/pipeline/test_spaceranger_ffpe_v1.nf.test.snap index 063d565..ee3d586 100644 --- a/tests/pipeline/test_spaceranger_ffpe_v1.nf.test.snap +++ b/tests/pipeline/test_spaceranger_ffpe_v1.nf.test.snap @@ -11,12 +11,12 @@ }, "nf_core_pipeline_software_mqc_versions.yml": { "content": [ - "{CLUSTERING={quarto=1.3.450, papermill=null}, FASTQC={fastqc=0.12.1}, QUALITY_CONTROLS={quarto=1.3.450, papermill=null}, READ_DATA={scanpy=1.9.8}, SPACERANGER_COUNT={spaceranger=2.1.0}, SPACERANGER_UNTAR_REFERENCE={untar=1.3}, SPATIALLY_VARIABLE_GENES={quarto=1.3.450, papermill=null}, UNTAR_SPACERANGER_INPUT={untar=1.3}, Workflow={nf-core/spatialtranscriptomics=v1.0dev}}" + "{CLUSTERING={quarto=1.3.450, papermill=null}, FASTQC={fastqc=0.12.1}, QUALITY_CONTROLS={quarto=1.3.450, papermill=null}, READ_DATA={scanpy=1.9.8}, SPACERANGER_COUNT={spaceranger=3.0.0}, SPACERANGER_UNTAR_REFERENCE={untar=1.3}, SPATIALLY_VARIABLE_GENES={quarto=1.3.450, papermill=null}, UNTAR_SPACERANGER_INPUT={untar=1.3}, Workflow={nf-core/spatialtranscriptomics=v1.0dev}}" ], "meta": { "nf-test": "0.8.4", - "nextflow": "23.10.1" + "nextflow": "24.02.0" }, - "timestamp": "2024-03-19T18:31:18.231368" + "timestamp": "2024-04-04T10:08:16.975105" } -} +} \ No newline at end of file diff --git a/tests/pipeline/test_spaceranger_ffpe_v2_cytassist.nf.test.snap b/tests/pipeline/test_spaceranger_ffpe_v2_cytassist.nf.test.snap index 032f4ef..92e16a3 100644 --- a/tests/pipeline/test_spaceranger_ffpe_v2_cytassist.nf.test.snap +++ b/tests/pipeline/test_spaceranger_ffpe_v2_cytassist.nf.test.snap @@ -1,12 +1,12 @@ { "nf_core_pipeline_software_mqc_versions.yml": { "content": [ - "{CLUSTERING={quarto=1.3.450, papermill=null}, FASTQC={fastqc=0.12.1}, QUALITY_CONTROLS={quarto=1.3.450, papermill=null}, READ_DATA={scanpy=1.9.8}, SPACERANGER_COUNT={spaceranger=2.1.0}, SPACERANGER_UNTAR_REFERENCE={untar=1.3}, SPATIALLY_VARIABLE_GENES={quarto=1.3.450, papermill=null}, UNTAR_SPACERANGER_INPUT={untar=1.3}, Workflow={nf-core/spatialtranscriptomics=v1.0dev}}" + "{CLUSTERING={quarto=1.3.450, papermill=null}, FASTQC={fastqc=0.12.1}, QUALITY_CONTROLS={quarto=1.3.450, papermill=null}, READ_DATA={scanpy=1.9.8}, SPACERANGER_COUNT={spaceranger=3.0.0}, SPACERANGER_UNTAR_REFERENCE={untar=1.3}, SPATIALLY_VARIABLE_GENES={quarto=1.3.450, papermill=null}, UNTAR_SPACERANGER_INPUT={untar=1.3}, Workflow={nf-core/spatialtranscriptomics=v1.0dev}}" ], "meta": { "nf-test": "0.8.4", - "nextflow": "23.10.1" + "nextflow": "24.02.0" }, - "timestamp": "2024-03-19T18:45:01.126974" + "timestamp": "2024-04-04T10:42:54.76102" } -} +} \ No newline at end of file From f253f562f433ccd7da634a106c661a973b3562ff Mon Sep 17 00:00:00 2001 From: Erik Fasterius Date: Thu, 4 Apr 2024 21:16:34 +0200 Subject: [PATCH 53/66] Remove TODO --- bin/quality_controls.qmd | 1 - 1 file changed, 1 deletion(-) diff --git a/bin/quality_controls.qmd b/bin/quality_controls.qmd index cb2df55..995558f 100644 --- a/bin/quality_controls.qmd +++ b/bin/quality_controls.qmd @@ -8,7 +8,6 @@ jupyter: python3 # Introduction - Spatial Transcriptomics data analysis involves several steps, including quality controls (QC) and pre-processing, to ensure the reliability of downstream analyses. This is an essential step in spatial transcriptomics to identify and From 51d5918f4b43e341739aad96ff09d05a8f32304f Mon Sep 17 00:00:00 2001 From: Christophe Avenel Date: Fri, 12 Apr 2024 12:37:19 +0200 Subject: [PATCH 54/66] Update SpatialData to v0.1.2 --- bin/clustering.qmd | 10 +++++----- bin/quality_controls.qmd | 12 +++++------- bin/spatially_variable_genes.qmd | 9 ++++----- env/environment.yml | 8 ++++---- 4 files changed, 18 insertions(+), 21 deletions(-) diff --git a/bin/clustering.qmd b/bin/clustering.qmd index cecc9da..7266cab 100644 --- a/bin/clustering.qmd +++ b/bin/clustering.qmd @@ -39,11 +39,11 @@ from IPython.display import display, Markdown ```{python} # Make sure we can use scanpy plots with the AnnData object exported from -# `sdata.table`. This code is taken from the early version of https://github.com/scverse/spatialdata-io/pull/102/ +# `sdata.tables`. This code is taken from the early version of https://github.com/scverse/spatialdata-io/pull/102/ # Once that PR is merged into spatialdata-io, we should instead use # `spatialdata_io.to_legacy_anndata(sdata)`. def to_legacy_anndata(sdata: spatialdata.SpatialData) -> AnnData: - adata = sdata.table + adata = sdata.tables["table"] for dataset_id in adata.uns["spatial"]: adata.uns["spatial"][dataset_id]["images"] = { "hires": np.array(sdata.images[f"{dataset_id}_hires_image"]).transpose([1, 2, 0]), @@ -62,7 +62,7 @@ def to_legacy_anndata(sdata: spatialdata.SpatialData) -> AnnData: ``` ```{python} -sdata = spatialdata.read_zarr(input_sdata, ["images", "table", "shapes"]) +sdata = spatialdata.read_zarr(input_sdata, ["images", "tables", "shapes"]) adata = to_legacy_anndata(sdata) print("Content of the SpatialData table object:") @@ -172,8 +172,8 @@ sc.pl.spatial(adata, img_key="hires", color="clusters", size=1.25) ```{python} #| echo: false -del sdata.table -sdata.table = adata +del sdata.tables["table"] +sdata.tables["table"] = adata adata.write(os.path.join(artifact_dir, output_adata)) sdata.write(os.path.join(artifact_dir, output_sdata)) ``` diff --git a/bin/quality_controls.qmd b/bin/quality_controls.qmd index 995558f..d552d79 100644 --- a/bin/quality_controls.qmd +++ b/bin/quality_controls.qmd @@ -1,8 +1,6 @@ --- title: "nf-core/spatialtranscriptomics" subtitle: "Pre-processing and quality controls" -format: - nf-core-html: default jupyter: python3 --- @@ -53,11 +51,11 @@ plt.rcParams["figure.figsize"] = (6, 6) ``` ```{python} -# Make sure we can use scanpy plots with the AnnData object exported from sdata.table +# Make sure we can use scanpy plots with the AnnData object exported from sdata.tables # This code is taken from the early version of https://github.com/scverse/spatialdata-io/pull/102/ # Once the PR will be merged in spatialdata-io, we should use spatialdata_io.to_legacy_anndata(sdata). def to_legacy_anndata(sdata: spatialdata.SpatialData) -> AnnData: - adata = sdata.table + adata = sdata.tables["table"] for dataset_id in adata.uns["spatial"]: adata.uns["spatial"][dataset_id]["images"] = { "hires": np.array(sdata.images[f"{dataset_id}_hires_image"]).transpose([1, 2, 0]), @@ -77,8 +75,8 @@ def to_legacy_anndata(sdata: spatialdata.SpatialData) -> AnnData: ```{python} # Read the data -sdata = spatialdata.read_zarr(input_sdata, ["images", "table", "shapes"]) adata = to_legacy_anndata(sdata) +sdata = spatialdata.read_zarr(input_sdata, ["images", "tables", "shapes"]) # Convert X matrix from CSR to CSC dense matrix for output compatibility adata.X = scipy.sparse.csc_matrix(adata.X) @@ -282,7 +280,7 @@ sc.pl.violin(adata, ['pct_counts_mt', 'pct_counts_ribo', 'pct_counts_hb'], ``` ```{python} -del sdata.table -sdata.table = adata +del sdata.tables["table"] +sdata.tables["table"] = adata sdata.write(os.path.join(artifact_dir, output_sdata)) ``` diff --git a/bin/spatially_variable_genes.qmd b/bin/spatially_variable_genes.qmd index 35dd79c..c25bbdb 100644 --- a/bin/spatially_variable_genes.qmd +++ b/bin/spatially_variable_genes.qmd @@ -29,11 +29,11 @@ from matplotlib import pyplot as plt ``` ```{python} -# Make sure we can use scanpy plots with the AnnData object exported from sdata.table +# Make sure we can use scanpy plots with the AnnData object exported from sdata.tables # This code is taken from the early version of https://github.com/scverse/spatialdata-io/pull/102/ # Once the PR will be merged in spatialdata-io, we should use spatialdata_io.to_legacy_anndata(sdata). def to_legacy_anndata(sdata: spatialdata.SpatialData) -> AnnData: - adata = sdata.table + adata = sdata.tables["table"] for dataset_id in adata.uns["spatial"]: adata.uns["spatial"][dataset_id]["images"] = { "hires": np.array(sdata.images[f"{dataset_id}_hires_image"]).transpose([1, 2, 0]), @@ -53,7 +53,6 @@ def to_legacy_anndata(sdata: spatialdata.SpatialData) -> AnnData: ```{python} # Read data -sdata = spatialdata.read_zarr("./" + input_sdata, ["images", "table", "shapes"]) adata = to_legacy_anndata(sdata) print("Content of the AnnData object:") @@ -135,7 +134,7 @@ adata.uns["moranI"].to_csv(os.path.join(artifact_dir, output_csv)) #| echo: false #| info: false adata.write(output_adata) -del sdata.table -sdata.table = adata +del sdata.tables["table"] +sdata.tables["table"] = adata sdata.write("./" + output_sdata) ``` diff --git a/env/environment.yml b/env/environment.yml index 386e5ce..c376fb2 100644 --- a/env/environment.yml +++ b/env/environment.yml @@ -12,8 +12,8 @@ dependencies: - gxx=13.2.0 - imagecodecs=2024.1.1 - pip: - - scanpy==1.9.8 + - scanpy==1.10.0 - squidpy==1.4.1 - - spatialdata==0.0.15 - - spatialdata-io==0.0.9 - - spatialdata-plot==0.1.0 + - spatialdata==0.1.2 + - spatialdata-io==0.1.2 + - spatialdata-plot==0.2.1 From a9a55705eca90389ff3137b522c050746c5563f5 Mon Sep 17 00:00:00 2001 From: Christophe Avenel Date: Fri, 12 Apr 2024 12:37:53 +0200 Subject: [PATCH 55/66] Remove temporary fix for scanpy issue --- bin/spatially_variable_genes.qmd | 3 --- 1 file changed, 3 deletions(-) diff --git a/bin/spatially_variable_genes.qmd b/bin/spatially_variable_genes.qmd index c25bbdb..aea5b35 100644 --- a/bin/spatially_variable_genes.qmd +++ b/bin/spatially_variable_genes.qmd @@ -58,9 +58,6 @@ adata = to_legacy_anndata(sdata) print("Content of the AnnData object:") print(adata) -# Fix for scanpy issue https://github.com/scverse/scanpy/issues/2181 -adata.uns['log1p']['base'] = None - # Suppress scanpy-specific warnings sc.settings.verbosity = 0 ``` From b1397559b67d15f2efad1c30537ec4c44ef3174e Mon Sep 17 00:00:00 2001 From: Christophe Avenel Date: Fri, 12 Apr 2024 12:38:29 +0200 Subject: [PATCH 56/66] Add back missing line in SVG quarto --- bin/spatially_variable_genes.qmd | 1 + 1 file changed, 1 insertion(+) diff --git a/bin/spatially_variable_genes.qmd b/bin/spatially_variable_genes.qmd index aea5b35..4ad198c 100644 --- a/bin/spatially_variable_genes.qmd +++ b/bin/spatially_variable_genes.qmd @@ -53,6 +53,7 @@ def to_legacy_anndata(sdata: spatialdata.SpatialData) -> AnnData: ```{python} # Read data +sdata = spatialdata.read_zarr("./" + input_sdata, ["images", "tables", "shapes"]) adata = to_legacy_anndata(sdata) print("Content of the AnnData object:") From d2a490b8fdf6441bcca9e7b7a02ce1cfe153bfc1 Mon Sep 17 00:00:00 2001 From: Christophe Avenel Date: Fri, 12 Apr 2024 12:39:16 +0200 Subject: [PATCH 57/66] Fix spelling of AnnData --- bin/quality_controls.qmd | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/bin/quality_controls.qmd b/bin/quality_controls.qmd index d552d79..744bd0a 100644 --- a/bin/quality_controls.qmd +++ b/bin/quality_controls.qmd @@ -15,10 +15,11 @@ analysis. This report outlines the QC and pre-processing steps for Visium Spatial Transcriptomics data using the [AnnData format](https://anndata.readthedocs.io/en/latest/tutorials/notebooks/getting-started.html) and the [`scanpy` Python package](https://scanpy.readthedocs.io/en/stable/). -The anndata format is utilized to organize and store the Spatial Transcriptomics +The AnnData format is utilized to organize and store the Spatial Transcriptomics data. It includes information about counts, features, observations, and -additional metadata. The anndata format ensures compatibility with various -analysis tools and facilitates seamless integration into existing workflows. The AnnData object is saved in a zarr [SpatialData object](https://spatialdata.scverse.org/en/latest/design_doc.html#table-table-of-annotations-for-regions). +additional metadata. The AnnData format ensures compatibility with various +analysis tools and facilitates seamless integration into existing workflows. +The AnnData object is saved in the `Tables` element of a zarr [SpatialData object](https://spatialdata.scverse.org/en/latest/design_doc.html#table-table-of-annotations-for-regions). ```{python} #| tags: [parameters] From 184dec84387f370d51da93e23f8d291928d13d1a Mon Sep 17 00:00:00 2001 From: Christophe Avenel Date: Fri, 12 Apr 2024 13:00:04 +0200 Subject: [PATCH 58/66] Clean read_zarr local path --- bin/spatially_variable_genes.qmd | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/bin/spatially_variable_genes.qmd b/bin/spatially_variable_genes.qmd index 4ad198c..a3be687 100644 --- a/bin/spatially_variable_genes.qmd +++ b/bin/spatially_variable_genes.qmd @@ -53,7 +53,7 @@ def to_legacy_anndata(sdata: spatialdata.SpatialData) -> AnnData: ```{python} # Read data -sdata = spatialdata.read_zarr("./" + input_sdata, ["images", "tables", "shapes"]) +sdata = spatialdata.read_zarr(input_sdata, ["images", "tables", "shapes"]) adata = to_legacy_anndata(sdata) print("Content of the AnnData object:") From c364e3eb281b5b04945e7b6865c94a0edf41e4ad Mon Sep 17 00:00:00 2001 From: Christophe Avenel Date: Fri, 12 Apr 2024 13:30:15 +0200 Subject: [PATCH 59/66] Fix qmd headers --- bin/clustering.qmd | 2 -- bin/quality_controls.qmd | 2 ++ 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/bin/clustering.qmd b/bin/clustering.qmd index 7266cab..3985af8 100644 --- a/bin/clustering.qmd +++ b/bin/clustering.qmd @@ -3,8 +3,6 @@ title: "nf-core/spatialtranscriptomics" subtitle: "Dimensionality reduction and clustering" format: nf-core-html: default -execute: - keep-ipynb: true jupyter: python3 --- diff --git a/bin/quality_controls.qmd b/bin/quality_controls.qmd index 744bd0a..d664ecf 100644 --- a/bin/quality_controls.qmd +++ b/bin/quality_controls.qmd @@ -1,6 +1,8 @@ --- title: "nf-core/spatialtranscriptomics" subtitle: "Pre-processing and quality controls" +format: + nf-core-html: default jupyter: python3 --- From 6754c6f26fe9de5c7095f638ed90521a2827150b Mon Sep 17 00:00:00 2001 From: Erik Fasterius Date: Fri, 12 Apr 2024 13:29:36 +0200 Subject: [PATCH 60/66] Move `degs/` output to `data/` folder --- bin/spatially_variable_genes.qmd | 4 +- conf/modules.config | 2 +- docs/output.md | 37 +++++++++++++------ nextflow.config | 2 +- nextflow_schema.json | 2 +- subworkflows/local/downstream.nf | 2 +- tests/pipeline/test_downstream.nf.test | 6 +-- .../pipeline/test_spaceranger_ffpe_v1.nf.test | 4 +- ...test_spaceranger_ffpe_v2_cytassist.nf.test | 4 +- 9 files changed, 39 insertions(+), 24 deletions(-) diff --git a/bin/spatially_variable_genes.qmd b/bin/spatially_variable_genes.qmd index 4ad198c..2a30a99 100644 --- a/bin/spatially_variable_genes.qmd +++ b/bin/spatially_variable_genes.qmd @@ -10,7 +10,7 @@ jupyter: python3 #| tags: [parameters] #| echo: false input_sdata = "sdata_processed.zarr" # Input: SpatialData file -n_top_spatial_degs = 14 # Number of spatially variable genes to plot +n_top_svgs = 14 # Number of spatially variable genes to plot artifact_dir = "artifacts" # Output directory output_csv = "spatially_variable_genes.csv" # Output: gene list output_adata = "adata_spatially_variable_genes.h5ad" # Output: AnnData file @@ -118,7 +118,7 @@ patterns. Here we use [Moran's I](https://en.wikipedia.org/wiki/Moran%27s_I) aut ```{python} adata.var_names_make_unique() sq.gr.spatial_autocorr(adata, mode="moran") -adata.uns["moranI"].head(n_top_spatial_degs) +adata.uns["moranI"].head(n_top_svgs) #[TODO] add gearyC as optional mode ``` diff --git a/conf/modules.config b/conf/modules.config index 40b2dbc..274e825 100644 --- a/conf/modules.config +++ b/conf/modules.config @@ -90,7 +90,7 @@ process { saveAs: { "adata_processed.h5ad" } ], [ - path: { "${params.outdir}/${meta.id}/degs" }, + path: { "${params.outdir}/${meta.id}/data" }, mode: params.publish_dir_mode, pattern: "artifacts/spatially_variable_genes.csv", saveAs: { "spatially_variable_genes.csv" } diff --git a/docs/output.md b/docs/output.md index d5ea2f6..3d6d220 100644 --- a/docs/output.md +++ b/docs/output.md @@ -53,25 +53,38 @@ information about these files at the [10X website](https://support.10xgenomics.c Output files - `/data/` - - `adata_processed.h5ad`: Filtered, normalised and clustered adata. + - `sdata_processed.zarr`: Processed data in SpatialData format. + - `adata_processed.h5ad`: Processed data in AnnData format. + - `spatially_variable_genes.csv`: List of spatially variable genes. -Data in `.h5ad` format as processed by the pipeline, which can be used for -further downstream analyses if desired; unprocessed data is also present in this -file. It can also be used by the [TissUUmaps](https://tissuumaps.github.io/) +Data in `.zarr` and `.h5ad` formats as processed by the pipeline, which can be +used for further downstream analyses if desired; unprocessed data is also +present in these files. It can also be used by the [TissUUmaps](https://tissuumaps.github.io/) browser-based tool for visualisation and exploration, allowing you to delve into -the data in an interactive way. +the data in an interactive way. The list of spatially variable genes are added +as a convenience if you want to explore them in _e.g._ Excel. ## Reports +
      +Output files + +- `/reports/` + - `_extensions/`: Quarto nf-core extension, common to all reports. + +
      + ### Quality controls and filtering
      Output files - `/reports/` - - `quality_controls.html`: HTML report. + - `quality_controls.html`: Rendered HTML report. + - `quality_controls.yml`: YAML file containing parameters used in the report. + - `quality_controls.qmd`: Quarto document used for rendering the report.
      @@ -85,7 +98,9 @@ well as presence in tissue; you can find more details in the report itself. Output files - `/reports/` - - `clustering.html`: HTML report. + - `clustering.html`: Rendered HTML report. + - `clustering.yml`: YAML file containing parameters used in the report. + - `clustering.qmd`: Quarto document used for rendering the report. @@ -93,15 +108,15 @@ Report containing analyses related to normalisation, dimensionality reduction, clustering and spatial visualisation. Leiden clustering is currently the only option; you can find more details in the report itself. -### Differential expression +### Spatially variable genes
      Output files - `/reports/` - - `spatially_variable_genes.html`: HTML report. -- `/degs/` - - `spatially_variable_genes.csv`: List of spatially variable genes. + - `spatially_variable_genes.html`: Rendered HTML report. + - `spatially_variable_genes.yml`: YAML file containing parameters used in the report. + - `spatially_variable_genes.qmd`: Quarto document used for rendering the report.
      diff --git a/nextflow.config b/nextflow.config index 70fa1c0..c622d42 100644 --- a/nextflow.config +++ b/nextflow.config @@ -30,7 +30,7 @@ params { cluster_resolution = 1.0 // Spatial differential expression - n_top_spatial_degs = 14 + n_top_svgs = 14 // MultiQC options multiqc_config = null diff --git a/nextflow_schema.json b/nextflow_schema.json index 64b7551..ad63b5b 100644 --- a/nextflow_schema.json +++ b/nextflow_schema.json @@ -146,7 +146,7 @@ "help_text": "The resolution controls the coarseness of the clustering, where a higher resolution leads to more clusters.", "fa_icon": "fas fa-circle-nodes" }, - "n_top_spatial_degs": { + "n_top_svgs": { "type": "integer", "default": 14, "description": "The number of top spatial differentially expressed genes to plot.", diff --git a/subworkflows/local/downstream.nf b/subworkflows/local/downstream.nf index decbcbe..77269ee 100644 --- a/subworkflows/local/downstream.nf +++ b/subworkflows/local/downstream.nf @@ -82,7 +82,7 @@ workflow DOWNSTREAM { .map { tuple(it[0], spatially_variable_genes_notebook) } spatially_variable_genes_params = [ input_sdata: "sdata_processed.zarr", - n_top_spatial_degs: params.n_top_spatial_degs, + n_top_svgs: params.n_top_svgs, artifact_dir: "artifacts", output_csv: "spatially_variable_genes.csv", output_adata: "adata_spatially_variable_genes.h5ad", diff --git a/tests/pipeline/test_downstream.nf.test b/tests/pipeline/test_downstream.nf.test index 404cc1f..6233756 100644 --- a/tests/pipeline/test_downstream.nf.test +++ b/tests/pipeline/test_downstream.nf.test @@ -39,9 +39,9 @@ nextflow_pipeline { { assert file("$outputDir/CytAssist_11mm_FFPE_Human_Glioblastoma_2.2/reports/clustering.html").text.contains("spatial distribution of clusters") }, { assert file("$outputDir/CytAssist_11mm_FFPE_Human_Glioblastoma_2.2/reports/spatially_variable_genes.html").text.contains("Spatial transcriptomics data can give insight") }, - // DEGs - { assert file("$outputDir/CytAssist_11mm_FFPE_Human_Glioblastoma_2/degs/spatially_variable_genes.csv").exists() }, - { assert file("$outputDir/CytAssist_11mm_FFPE_Human_Glioblastoma_2.2/degs/spatially_variable_genes.csv").exists() }, + // Spatially variable genes + { assert file("$outputDir/CytAssist_11mm_FFPE_Human_Glioblastoma_2/data/spatially_variable_genes.csv").exists() }, + { assert file("$outputDir/CytAssist_11mm_FFPE_Human_Glioblastoma_2.2/data/spatially_variable_genes.csv").exists() }, // MultiQC { assert file("$outputDir/multiqc/multiqc_report.html").exists() } diff --git a/tests/pipeline/test_spaceranger_ffpe_v1.nf.test b/tests/pipeline/test_spaceranger_ffpe_v1.nf.test index 1aa7bd5..3ee63d2 100644 --- a/tests/pipeline/test_spaceranger_ffpe_v1.nf.test +++ b/tests/pipeline/test_spaceranger_ffpe_v1.nf.test @@ -31,8 +31,8 @@ nextflow_pipeline { { assert file("$outputDir/Visium_FFPE_Human_Ovarian_Cancer/reports/clustering.html").text.contains("spatial distribution of clusters") }, { assert file("$outputDir/Visium_FFPE_Human_Ovarian_Cancer/reports/spatially_variable_genes.html").text.contains("Spatial transcriptomics data can give insight") }, - // DEGs - { assert file("$outputDir/Visium_FFPE_Human_Ovarian_Cancer/degs/spatially_variable_genes.csv").exists() }, + // Spatially variable genes + { assert file("$outputDir/Visium_FFPE_Human_Ovarian_Cancer/data/spatially_variable_genes.csv").exists() }, // Space Ranger { assert file("$outputDir/Visium_FFPE_Human_Ovarian_Cancer/spaceranger/outs/web_summary.html").exists() }, diff --git a/tests/pipeline/test_spaceranger_ffpe_v2_cytassist.nf.test b/tests/pipeline/test_spaceranger_ffpe_v2_cytassist.nf.test index 74ad1af..124ebe3 100644 --- a/tests/pipeline/test_spaceranger_ffpe_v2_cytassist.nf.test +++ b/tests/pipeline/test_spaceranger_ffpe_v2_cytassist.nf.test @@ -27,8 +27,8 @@ nextflow_pipeline { { assert file("$outputDir/CytAssist_11mm_FFPE_Human_Glioblastoma_2/reports/clustering.html").text.contains("spatial distribution of clusters") }, { assert file("$outputDir/CytAssist_11mm_FFPE_Human_Glioblastoma_2/reports/spatially_variable_genes.html").text.contains("Spatial transcriptomics data can give insight") }, - // DEGs - { assert file("$outputDir/CytAssist_11mm_FFPE_Human_Glioblastoma_2/degs/spatially_variable_genes.csv").exists() }, + // Spatially variable genes + { assert file("$outputDir/CytAssist_11mm_FFPE_Human_Glioblastoma_2/data/spatially_variable_genes.csv").exists() }, // Space Ranger { assert file("$outputDir/CytAssist_11mm_FFPE_Human_Glioblastoma_2/spaceranger/outs/web_summary.html").exists() }, From 72e07a042618f18542d1df6bb247ee1f1139b04e Mon Sep 17 00:00:00 2001 From: Erik Fasterius Date: Fri, 12 Apr 2024 13:30:21 +0200 Subject: [PATCH 61/66] Add fix for pip install in Dockerfile --- env/Dockerfile | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/env/Dockerfile b/env/Dockerfile index ad1c06f..8c44eed 100644 --- a/env/Dockerfile +++ b/env/Dockerfile @@ -21,6 +21,10 @@ RUN mkdir -p /opt/quarto \ FROM condaforge/mambaforge:23.11.0-0 COPY --from=quarto /opt/quarto /opt/quarto ENV PATH="${PATH}:/opt/quarto/bin" +RUN apt-get update \ + && apt-get install -y --no-install-recommends \ + pkg-config \ + && apt-get clean # Install packages using Mamba; also remove static libraries, python bytecode # files and javascript source maps that are not required for execution From de3c8c171be3063808e757827ac0698456420245 Mon Sep 17 00:00:00 2001 From: Christophe Avenel Date: Fri, 12 Apr 2024 13:31:40 +0200 Subject: [PATCH 62/66] Fix adata import order --- bin/quality_controls.qmd | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/bin/quality_controls.qmd b/bin/quality_controls.qmd index d664ecf..185714d 100644 --- a/bin/quality_controls.qmd +++ b/bin/quality_controls.qmd @@ -78,8 +78,8 @@ def to_legacy_anndata(sdata: spatialdata.SpatialData) -> AnnData: ```{python} # Read the data -adata = to_legacy_anndata(sdata) sdata = spatialdata.read_zarr(input_sdata, ["images", "tables", "shapes"]) +adata = to_legacy_anndata(sdata) # Convert X matrix from CSR to CSC dense matrix for output compatibility adata.X = scipy.sparse.csc_matrix(adata.X) From a465e0fe25d7beb55964f6556bbdc457f0bbc446 Mon Sep 17 00:00:00 2001 From: Christophe Avenel Date: Fri, 12 Apr 2024 13:38:37 +0200 Subject: [PATCH 63/66] Remove trailing whitespace --- bin/quality_controls.qmd | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/bin/quality_controls.qmd b/bin/quality_controls.qmd index 185714d..4afabcc 100644 --- a/bin/quality_controls.qmd +++ b/bin/quality_controls.qmd @@ -20,7 +20,7 @@ and the [`scanpy` Python package](https://scanpy.readthedocs.io/en/stable/). The AnnData format is utilized to organize and store the Spatial Transcriptomics data. It includes information about counts, features, observations, and additional metadata. The AnnData format ensures compatibility with various -analysis tools and facilitates seamless integration into existing workflows. +analysis tools and facilitates seamless integration into existing workflows. The AnnData object is saved in the `Tables` element of a zarr [SpatialData object](https://spatialdata.scverse.org/en/latest/design_doc.html#table-table-of-annotations-for-regions). ```{python} From 7e1756f5efa195c43cd054cbe80217583a360feb Mon Sep 17 00:00:00 2001 From: Erik Fasterius Date: Fri, 12 Apr 2024 14:02:42 +0200 Subject: [PATCH 64/66] Export `spatialdata_io` version --- modules/local/read_data.nf | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/modules/local/read_data.nf b/modules/local/read_data.nf index dfc7563..209373a 100644 --- a/modules/local/read_data.nf +++ b/modules/local/read_data.nf @@ -41,7 +41,7 @@ process READ_DATA { cat <<-END_VERSIONS > versions.yml "${task.process}": - scanpy: \$(python -c "import scanpy; print(scanpy.__version__)") + spatialdata_io: \$(python -c "import spatialdata_io; print(spatialdata_io.__version__)") END_VERSIONS """ } From 7ec707c576b2718287235eef3fe13c358da6624f Mon Sep 17 00:00:00 2001 From: Erik Fasterius Date: Fri, 12 Apr 2024 14:10:06 +0200 Subject: [PATCH 65/66] Remove Conda profile for READ_DATA process --- modules/local/read_data.nf | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/modules/local/read_data.nf b/modules/local/read_data.nf index 209373a..613efd9 100644 --- a/modules/local/read_data.nf +++ b/modules/local/read_data.nf @@ -6,8 +6,6 @@ process READ_DATA { tag "${meta.id}" label 'process_low' - // TODO fix conda environment to include spatialdata_io instead of scanpy - conda "conda-forge::scanpy=1.7.2 conda-forge::matplotlib=3.6.3 conda-forge::pandas=1.5.3" container "docker.io/erikfas/spatialtranscriptomics" input: @@ -21,6 +19,9 @@ process READ_DATA { task.ext.when == null || task.ext.when script: + if (workflow.profile.tokenize(',').intersect(['conda', 'mamba']).size() >= 1) { + exit 1, "The READ_DATA module does not support Conda/Mamba, please use Docker / Singularity / Podman instead." + } """ # Fix required directory structure mkdir "${meta.id}/spatial" From 509f547c4675de0d66de334996e3b26558948827 Mon Sep 17 00:00:00 2001 From: Erik Fasterius Date: Fri, 12 Apr 2024 14:12:09 +0200 Subject: [PATCH 66/66] Update snapshots --- tests/pipeline/test_downstream.nf.test.snap | 4 ++-- tests/pipeline/test_spaceranger_ffpe_v1.nf.test.snap | 4 ++-- .../pipeline/test_spaceranger_ffpe_v2_cytassist.nf.test.snap | 4 ++-- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/tests/pipeline/test_downstream.nf.test.snap b/tests/pipeline/test_downstream.nf.test.snap index c848af7..cdacf62 100644 --- a/tests/pipeline/test_downstream.nf.test.snap +++ b/tests/pipeline/test_downstream.nf.test.snap @@ -1,7 +1,7 @@ { "nf_core_pipeline_software_mqc_versions.yml": { "content": [ - "{CLUSTERING={quarto=1.3.450, papermill=null}, QUALITY_CONTROLS={quarto=1.3.450, papermill=null}, READ_DATA={scanpy=1.9.8}, SPACERANGER_UNTAR_REFERENCE={untar=1.3}, SPATIALLY_VARIABLE_GENES={quarto=1.3.450, papermill=null}, UNTAR_DOWNSTREAM_INPUT={untar=1.3}, Workflow={nf-core/spatialtranscriptomics=v1.0dev}}" + "{CLUSTERING={quarto=1.3.450, papermill=null}, QUALITY_CONTROLS={quarto=1.3.450, papermill=null}, READ_DATA={spatialdata_io=0.1.2}, SPACERANGER_UNTAR_REFERENCE={untar=1.3}, SPATIALLY_VARIABLE_GENES={quarto=1.3.450, papermill=null}, UNTAR_DOWNSTREAM_INPUT={untar=1.3}, Workflow={nf-core/spatialtranscriptomics=v1.0dev}}" ], "meta": { "nf-test": "0.8.4", @@ -9,4 +9,4 @@ }, "timestamp": "2024-03-19T18:46:59.035976" } -} \ No newline at end of file +} diff --git a/tests/pipeline/test_spaceranger_ffpe_v1.nf.test.snap b/tests/pipeline/test_spaceranger_ffpe_v1.nf.test.snap index ee3d586..11b5370 100644 --- a/tests/pipeline/test_spaceranger_ffpe_v1.nf.test.snap +++ b/tests/pipeline/test_spaceranger_ffpe_v1.nf.test.snap @@ -11,7 +11,7 @@ }, "nf_core_pipeline_software_mqc_versions.yml": { "content": [ - "{CLUSTERING={quarto=1.3.450, papermill=null}, FASTQC={fastqc=0.12.1}, QUALITY_CONTROLS={quarto=1.3.450, papermill=null}, READ_DATA={scanpy=1.9.8}, SPACERANGER_COUNT={spaceranger=3.0.0}, SPACERANGER_UNTAR_REFERENCE={untar=1.3}, SPATIALLY_VARIABLE_GENES={quarto=1.3.450, papermill=null}, UNTAR_SPACERANGER_INPUT={untar=1.3}, Workflow={nf-core/spatialtranscriptomics=v1.0dev}}" + "{CLUSTERING={quarto=1.3.450, papermill=null}, FASTQC={fastqc=0.12.1}, QUALITY_CONTROLS={quarto=1.3.450, papermill=null}, READ_DATA={spatialdata_io=0.1.2}, SPACERANGER_COUNT={spaceranger=3.0.0}, SPACERANGER_UNTAR_REFERENCE={untar=1.3}, SPATIALLY_VARIABLE_GENES={quarto=1.3.450, papermill=null}, UNTAR_SPACERANGER_INPUT={untar=1.3}, Workflow={nf-core/spatialtranscriptomics=v1.0dev}}" ], "meta": { "nf-test": "0.8.4", @@ -19,4 +19,4 @@ }, "timestamp": "2024-04-04T10:08:16.975105" } -} \ No newline at end of file +} diff --git a/tests/pipeline/test_spaceranger_ffpe_v2_cytassist.nf.test.snap b/tests/pipeline/test_spaceranger_ffpe_v2_cytassist.nf.test.snap index 92e16a3..be972cc 100644 --- a/tests/pipeline/test_spaceranger_ffpe_v2_cytassist.nf.test.snap +++ b/tests/pipeline/test_spaceranger_ffpe_v2_cytassist.nf.test.snap @@ -1,7 +1,7 @@ { "nf_core_pipeline_software_mqc_versions.yml": { "content": [ - "{CLUSTERING={quarto=1.3.450, papermill=null}, FASTQC={fastqc=0.12.1}, QUALITY_CONTROLS={quarto=1.3.450, papermill=null}, READ_DATA={scanpy=1.9.8}, SPACERANGER_COUNT={spaceranger=3.0.0}, SPACERANGER_UNTAR_REFERENCE={untar=1.3}, SPATIALLY_VARIABLE_GENES={quarto=1.3.450, papermill=null}, UNTAR_SPACERANGER_INPUT={untar=1.3}, Workflow={nf-core/spatialtranscriptomics=v1.0dev}}" + "{CLUSTERING={quarto=1.3.450, papermill=null}, FASTQC={fastqc=0.12.1}, QUALITY_CONTROLS={quarto=1.3.450, papermill=null}, READ_DATA={spatialdata_io=0.1.2}, SPACERANGER_COUNT={spaceranger=3.0.0}, SPACERANGER_UNTAR_REFERENCE={untar=1.3}, SPATIALLY_VARIABLE_GENES={quarto=1.3.450, papermill=null}, UNTAR_SPACERANGER_INPUT={untar=1.3}, Workflow={nf-core/spatialtranscriptomics=v1.0dev}}" ], "meta": { "nf-test": "0.8.4", @@ -9,4 +9,4 @@ }, "timestamp": "2024-04-04T10:42:54.76102" } -} \ No newline at end of file +}
    Process Name \\", - " \\ Software Version
    CUSTOM_DUMPSOFTWAREVERSIONSpython3.11.7
    yaml5.4.1
    TOOL1tool10.11.9
    TOOL2tool21.9
    WorkflowNextflow
    File typeConventional base calls
    File typeConventional base calls
    File typeConventional base calls
    File typeConventional base calls
    File typeConventional base calls
    File typeConventional base calls
    File typeConventional base calls
    File typeConventional base calls