diff --git a/CHANGELOG.md b/CHANGELOG.md index 0e4a3f2..ed29959 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -8,10 +8,24 @@ * `convert/from_h5mu_to_seurat_with_fov`: Added converter component for H5MU data to Seurat objects with spatial FOV (PR #51). +## MAJOR CHANGES + +* Pin OpenPipeline dependency to v4.1.0 (PR #56). + ## MINOR CHANGES * Pin ome-zarr to 0.13.0 to avoid a chunk shape incompatibility with zarr 3.x (PR #48). +* Bump Viash to 0.9.7 (PR #57). + +* Bump anndata to 0.12.16 (PR #57). + +* Bump mudata to 0.3.8 (PR #57). + +* Bump scanpy to 1.11.4 (PR #57) + +* Testing: bump viashpy to 0.10.0 (PR #57). + ## BUG FIXES * `convert/from_h5mu_to_spatialdata`: Make sure the AnnData table is properly parsed before inserting into the new SpatialData object (PR #53). diff --git a/_viash.yaml b/_viash.yaml index 53fb1ab..87df04f 100644 --- a/_viash.yaml +++ b/_viash.yaml @@ -1,4 +1,4 @@ -viash_version: 0.9.4 +viash_version: 0.9.7 source: src target: target name: openpipeline_spatial @@ -10,7 +10,7 @@ repositories: - name: openpipeline repo: openpipeline type: vsh - tag: v4.0.3 + tag: v4.1.0 info: test_resources: - type: s3 diff --git a/src/base/requirements/anndata.yaml b/src/base/requirements/anndata.yaml index 03552c8..9ef7f9d 100644 --- a/src/base/requirements/anndata.yaml +++ b/src/base/requirements/anndata.yaml @@ -1,3 +1,4 @@ packages: - - anndata~=0.12.7 - - awkward \ No newline at end of file + - anndata~=0.12.16 + - awkward + - scipy~=1.17.1 # Exclude scipy 1.17.0 because https://github.com/scverse/anndata/issues/339 diff --git a/src/base/requirements/anndata_mudata.yaml b/src/base/requirements/anndata_mudata.yaml index 5583ffe..ef4a23d 100644 --- a/src/base/requirements/anndata_mudata.yaml +++ b/src/base/requirements/anndata_mudata.yaml @@ -1,5 +1,5 @@ __merge__: [/src/base/requirements/anndata.yaml, .] packages: - - mudata~=0.3.2 + - mudata~=0.3.8 script: | exec("try:\n import zarr; from importlib.metadata import version\nexcept ModuleNotFoundError:\n exit(0)\nelse: assert int(version(\"zarr\").partition(\".\")[0]) > 2") diff --git a/src/base/requirements/scanpy.yaml b/src/base/requirements/scanpy.yaml index 5c1af07..8ce8839 100644 --- a/src/base/requirements/scanpy.yaml +++ b/src/base/requirements/scanpy.yaml @@ -1,2 +1,2 @@ packages: - - scanpy~=1.10.4 + - scanpy~=1.11.4 diff --git a/src/base/requirements/viashpy.yaml b/src/base/requirements/viashpy.yaml index 64b6c2a..990748a 100644 --- a/src/base/requirements/viashpy.yaml +++ b/src/base/requirements/viashpy.yaml @@ -1,2 +1,2 @@ packages: - - viashpy==0.9.0 + - viashpy==0.10.0 diff --git a/src/workflows/multiomics/spatial_process_samples/config.vsh.yaml b/src/workflows/multiomics/spatial_process_samples/config.vsh.yaml index 3a2ac50..9fcd565 100644 --- a/src/workflows/multiomics/spatial_process_samples/config.vsh.yaml +++ b/src/workflows/multiomics/spatial_process_samples/config.vsh.yaml @@ -144,6 +144,15 @@ argument_groups: type: integer description: Minimum of non-zero values per protein. + - name: "Cross-modality filtering" + arguments: + - name: "--intersect_obs" + type: boolean_true + description: | + After per-modality filtering and multisample processing, remove observations + that are not present in all processed modalities so that each modality shares + the same set of cells. + - name: "Highly variable features detection" arguments: - name: "--highly_variable_features_var_output" diff --git a/src/workflows/multiomics/spatial_process_samples/main.nf b/src/workflows/multiomics/spatial_process_samples/main.nf index 2a2c7fc..b194941 100644 --- a/src/workflows/multiomics/spatial_process_samples/main.nf +++ b/src/workflows/multiomics/spatial_process_samples/main.nf @@ -34,6 +34,7 @@ workflow run_wf { "prot_min_proteins_per_cell": state.prot_min_proteins_per_cell, "prot_max_proteins_per_cell": state.prot_max_proteins_per_cell, "prot_min_cells_per_protein": state.prot_min_cells_per_protein, + "intersect_obs": state.intersect_obs, "highly_variable_features_var_output": state.highly_variable_features_var_output, "highly_variable_features_obs_batch_key": state.highly_variable_features_obs_batch_key, "var_gene_names": state.var_gene_names, diff --git a/target/_private/executable/filter/subset_cosmx/.config.vsh.yaml b/target/_private/executable/filter/subset_cosmx/.config.vsh.yaml index d0e91ef..a206309 100644 --- a/target/_private/executable/filter/subset_cosmx/.config.vsh.yaml +++ b/target/_private/executable/filter/subset_cosmx/.config.vsh.yaml @@ -112,7 +112,7 @@ repositories: - type: "vsh" name: "openpipeline" repo: "openpipeline" - tag: "v4.0.3" + tag: "v4.1.0" links: repository: "https://github.com/openpipelines-bio/openpipeline_spatial" docker_registry: "ghcr.io" @@ -201,7 +201,7 @@ engines: - type: "python" user: false packages: - - "scanpy~=1.10.4" + - "scanpy~=1.11.4" - "squidpy~=1.8.1" upgrade: true test_setup: @@ -212,7 +212,7 @@ engines: - type: "python" user: false packages: - - "viashpy==0.9.0" + - "viashpy==0.10.0" github: - "openpipelines-bio/core#subdirectory=packages/python/openpipeline_testutils" upgrade: true @@ -226,8 +226,8 @@ build_info: engine: "docker|native" output: "target/_private/executable/filter/subset_cosmx" executable: "target/_private/executable/filter/subset_cosmx/subset_cosmx" - viash_version: "0.9.4" - git_commit: "e087099616271bd0f11e825b7817ec14ebef62d7" + viash_version: "0.9.7" + git_commit: "4449aa6094a686af0a5fbe99b9aaafd01ae75aff" git_remote: "https://github.com/openpipelines-bio/openpipeline_spatial" package_config: name: "openpipeline_spatial" @@ -241,8 +241,8 @@ package_config: - type: "vsh" name: "openpipeline" repo: "openpipeline" - tag: "v4.0.3" - viash_version: "0.9.4" + tag: "v4.1.0" + viash_version: "0.9.7" source: "src" target: "target" config_mods: diff --git a/target/_private/executable/filter/subset_cosmx/subset_cosmx b/target/_private/executable/filter/subset_cosmx/subset_cosmx index 01d687d..685127b 100755 --- a/target/_private/executable/filter/subset_cosmx/subset_cosmx +++ b/target/_private/executable/filter/subset_cosmx/subset_cosmx @@ -2,7 +2,7 @@ # subset_cosmx main # -# This wrapper script is auto-generated by viash 0.9.4 and is thus a derivative +# This wrapper script is auto-generated by viash 0.9.7 and is thus a derivative # work thereof. This software comes with ABSOLUTELY NO WARRANTY from Data # Intuitive. # @@ -454,13 +454,13 @@ RUN apt-get update && \ rm -rf /var/lib/apt/lists/* RUN pip install --upgrade pip && \ - pip install --upgrade --no-cache-dir "scanpy~=1.10.4" "squidpy~=1.8.1" + pip install --upgrade --no-cache-dir "scanpy~=1.11.4" "squidpy~=1.8.1" LABEL org.opencontainers.image.authors="Dorien Roosen, Weiwei Schultz" LABEL org.opencontainers.image.description="Companion container for running component filter subset_cosmx" -LABEL org.opencontainers.image.created="2026-05-22T11:53:11Z" +LABEL org.opencontainers.image.created="2026-06-01T12:50:40Z" LABEL org.opencontainers.image.source="https://github.com/openpipelines-bio/openpipeline_spatial" -LABEL org.opencontainers.image.revision="e087099616271bd0f11e825b7817ec14ebef62d7" +LABEL org.opencontainers.image.revision="4449aa6094a686af0a5fbe99b9aaafd01ae75aff" LABEL org.opencontainers.image.version="main" VIASHDOCKER diff --git a/target/_private/nextflow/filter/subset_cosmx/.config.vsh.yaml b/target/_private/nextflow/filter/subset_cosmx/.config.vsh.yaml index 2ec961d..9a9effd 100644 --- a/target/_private/nextflow/filter/subset_cosmx/.config.vsh.yaml +++ b/target/_private/nextflow/filter/subset_cosmx/.config.vsh.yaml @@ -112,7 +112,7 @@ repositories: - type: "vsh" name: "openpipeline" repo: "openpipeline" - tag: "v4.0.3" + tag: "v4.1.0" links: repository: "https://github.com/openpipelines-bio/openpipeline_spatial" docker_registry: "ghcr.io" @@ -201,7 +201,7 @@ engines: - type: "python" user: false packages: - - "scanpy~=1.10.4" + - "scanpy~=1.11.4" - "squidpy~=1.8.1" upgrade: true test_setup: @@ -212,7 +212,7 @@ engines: - type: "python" user: false packages: - - "viashpy==0.9.0" + - "viashpy==0.10.0" github: - "openpipelines-bio/core#subdirectory=packages/python/openpipeline_testutils" upgrade: true @@ -226,8 +226,8 @@ build_info: engine: "docker|native" output: "target/_private/nextflow/filter/subset_cosmx" executable: "target/_private/nextflow/filter/subset_cosmx/main.nf" - viash_version: "0.9.4" - git_commit: "e087099616271bd0f11e825b7817ec14ebef62d7" + viash_version: "0.9.7" + git_commit: "4449aa6094a686af0a5fbe99b9aaafd01ae75aff" git_remote: "https://github.com/openpipelines-bio/openpipeline_spatial" package_config: name: "openpipeline_spatial" @@ -241,8 +241,8 @@ package_config: - type: "vsh" name: "openpipeline" repo: "openpipeline" - tag: "v4.0.3" - viash_version: "0.9.4" + tag: "v4.1.0" + viash_version: "0.9.7" source: "src" target: "target" config_mods: diff --git a/target/_private/nextflow/filter/subset_cosmx/main.nf b/target/_private/nextflow/filter/subset_cosmx/main.nf index 5d4f6c6..b18a30f 100644 --- a/target/_private/nextflow/filter/subset_cosmx/main.nf +++ b/target/_private/nextflow/filter/subset_cosmx/main.nf @@ -1,6 +1,6 @@ // subset_cosmx main // -// This wrapper script is auto-generated by viash 0.9.4 and is thus a derivative +// This wrapper script is auto-generated by viash 0.9.7 and is thus a derivative // work thereof. This software comes with ABSOLUTELY NO WARRANTY from Data // Intuitive. // @@ -1354,47 +1354,42 @@ def readCsv(file_path) { def splitRegex = java.util.regex.Pattern.compile(''',(?=(?:[^"]*"[^"]*")*[^"]*$)''') def removeQuote = java.util.regex.Pattern.compile('''"(.*)"''') - def br = java.nio.file.Files.newBufferedReader(inputFile) + java.nio.file.Files.newBufferedReader(inputFile).withCloseable { br -> + def row = 0 + def header = null + def line - def row = -1 - def header = null - while (br.ready() && header == null) { - def line = br.readLine() - row++ - if (!line.startsWith("#")) { - header = splitRegex.split(line, -1).collect{field -> - m = removeQuote.matcher(field) - m.find() ? m.replaceFirst('$1') : field - } - } - } - assert header != null: "CSV file should contain a header" - - while (br.ready()) { - def line = br.readLine() - row++ - if (line == null) { - br.close() - break - } - - if (!line.startsWith("#")) { - def predata = splitRegex.split(line, -1) - def data = predata.collect{field -> - if (field == "") { - return null - } - def m = removeQuote.matcher(field) - if (m.find()) { - return m.replaceFirst('$1') - } else { - return field + while (header == null && (line = br.readLine()) != null) { + if (!line.startsWith("#")) { + header = splitRegex.split(line, -1).collect { field -> + def m = removeQuote.matcher(field) + m.find() ? m.replaceFirst('$1') : field } } - assert header.size() == data.size(): "Row $row should contain the same number as fields as the header" - - def dataMap = [header, data].transpose().collectEntries().findAll{it.value != null} - output.add(dataMap) + row++ + } + assert header != null : "CSV file should contain a header" + + while ((line = br.readLine()) != null) { + row++ + if (!line.startsWith("#")) { + def predata = splitRegex.split(line, -1) + def data = predata.collect { field -> + if (field == "") { + return null + } + def m = removeQuote.matcher(field) + if (m.find()) { + return m.replaceFirst('$1') + } else { + return field + } + } + assert header.size() == data.size() : "Row $row should contain the same number as fields as the header" + + def dataMap = [header, data].transpose().collectEntries().findAll { it.value != null } + output.add(dataMap) + } } } @@ -1710,10 +1705,25 @@ process publishFilesProc { ] .transpose() .collectMany{infile, outfile -> - if (infile.toString() != outfile.toString()) { + def infileString = infile.toString() + def outfileString = outfile.toString() + if (infileString != outfileString) { + /* Trailing slashes are removed from both the source and destination arguments. + From source arguments, this is useful when a source argument may have a trailing slash + and specify a symbolic link to a directory. Without removing the slash, cp will dereference + the symbolic link. + See https://www.gnu.org/software/coreutils/manual/html_node/Trailing-slashes.html#Trailing-slashes-1 + + For the destination path addding a trailing slash is a problem when publishing directories: + it requires the destination directory to exist. This fails because we only create the parent + directories first. + */ + def regexTrailingSlashes = ~/\/+$/ + def infileNoTrailingSlash = infileString - regexTrailingSlashes + def outfileNoTrailingSlash = outfileString - regexTrailingSlashes [ - "[ -d \"\$(dirname '${outfile.toString()}')\" ] || mkdir -p \"\$(dirname '${outfile.toString()}')\"", - "cp -r '${infile.toString()}' '${outfile.toString()}'" + "[ -d \"\$(dirname '${outfileNoTrailingSlash}')\" ] || mkdir -p \"\$(dirname '${outfileNoTrailingSlash}')\"", + "cp -a '${infileNoTrailingSlash}' '${outfileNoTrailingSlash}'" ] } else { // no need to copy if infile is the same as outfile @@ -3187,7 +3197,7 @@ meta = [ "type" : "vsh", "name" : "openpipeline", "repo" : "openpipeline", - "tag" : "v4.0.3" + "tag" : "v4.1.0" } ], "links" : { @@ -3295,7 +3305,7 @@ meta = [ "type" : "python", "user" : false, "packages" : [ - "scanpy~=1.10.4", + "scanpy~=1.11.4", "squidpy~=1.8.1" ], "upgrade" : true @@ -3313,7 +3323,7 @@ meta = [ "type" : "python", "user" : false, "packages" : [ - "viashpy==0.9.0" + "viashpy==0.10.0" ], "github" : [ "openpipelines-bio/core#subdirectory=packages/python/openpipeline_testutils" @@ -3332,8 +3342,8 @@ meta = [ "runner" : "nextflow", "engine" : "docker|native", "output" : "/workdir/root/repo/target/_private/nextflow/filter/subset_cosmx", - "viash_version" : "0.9.4", - "git_commit" : "e087099616271bd0f11e825b7817ec14ebef62d7", + "viash_version" : "0.9.7", + "git_commit" : "4449aa6094a686af0a5fbe99b9aaafd01ae75aff", "git_remote" : "https://github.com/openpipelines-bio/openpipeline_spatial" }, "package_config" : { @@ -3353,10 +3363,10 @@ meta = [ "type" : "vsh", "name" : "openpipeline", "repo" : "openpipeline", - "tag" : "v4.0.3" + "tag" : "v4.1.0" } ], - "viash_version" : "0.9.4", + "viash_version" : "0.9.7", "source" : "/workdir/root/repo/src", "target" : "/workdir/root/repo/target", "config_mods" : [ diff --git a/target/_test/executable/test_workflows/ingestion/spaceranger_mapping_test/.config.vsh.yaml b/target/_test/executable/test_workflows/ingestion/spaceranger_mapping_test/.config.vsh.yaml index 8d36e16..cbb244c 100644 --- a/target/_test/executable/test_workflows/ingestion/spaceranger_mapping_test/.config.vsh.yaml +++ b/target/_test/executable/test_workflows/ingestion/spaceranger_mapping_test/.config.vsh.yaml @@ -48,7 +48,7 @@ repositories: - type: "vsh" name: "openpipeline" repo: "openpipeline" - tag: "v4.0.3" + tag: "v4.1.0" links: repository: "https://github.com/openpipelines-bio/openpipeline_spatial" docker_registry: "ghcr.io" @@ -135,10 +135,11 @@ engines: - type: "python" user: false packages: - - "anndata~=0.12.7" + - "anndata~=0.12.16" - "awkward" - - "mudata~=0.3.2" - - "viashpy==0.9.0" + - "scipy~=1.17.1" + - "mudata~=0.3.8" + - "viashpy==0.10.0" github: - "openpipelines-bio/core#subdirectory=packages/python/openpipeline_testutils" script: @@ -156,8 +157,8 @@ build_info: engine: "docker|native" output: "target/_test/executable/test_workflows/ingestion/spaceranger_mapping_test" executable: "target/_test/executable/test_workflows/ingestion/spaceranger_mapping_test/spaceranger_mapping_test" - viash_version: "0.9.4" - git_commit: "e087099616271bd0f11e825b7817ec14ebef62d7" + viash_version: "0.9.7" + git_commit: "4449aa6094a686af0a5fbe99b9aaafd01ae75aff" git_remote: "https://github.com/openpipelines-bio/openpipeline_spatial" package_config: name: "openpipeline_spatial" @@ -171,8 +172,8 @@ package_config: - type: "vsh" name: "openpipeline" repo: "openpipeline" - tag: "v4.0.3" - viash_version: "0.9.4" + tag: "v4.1.0" + viash_version: "0.9.7" source: "src" target: "target" config_mods: diff --git a/target/_test/executable/test_workflows/ingestion/spaceranger_mapping_test/spaceranger_mapping_test b/target/_test/executable/test_workflows/ingestion/spaceranger_mapping_test/spaceranger_mapping_test index dde3ce7..af42e64 100755 --- a/target/_test/executable/test_workflows/ingestion/spaceranger_mapping_test/spaceranger_mapping_test +++ b/target/_test/executable/test_workflows/ingestion/spaceranger_mapping_test/spaceranger_mapping_test @@ -2,7 +2,7 @@ # spaceranger_mapping_test main # -# This wrapper script is auto-generated by viash 0.9.4 and is thus a derivative +# This wrapper script is auto-generated by viash 0.9.7 and is thus a derivative # work thereof. This software comes with ABSOLUTELY NO WARRANTY from Data # Intuitive. # @@ -453,15 +453,15 @@ RUN apt-get update && \ rm -rf /var/lib/apt/lists/* RUN pip install --upgrade pip && \ - pip install --upgrade --no-cache-dir "anndata~=0.12.7" "awkward" "mudata~=0.3.2" "viashpy==0.9.0" && \ + pip install --upgrade --no-cache-dir "anndata~=0.12.16" "awkward" "scipy~=1.17.1" "mudata~=0.3.8" "viashpy==0.10.0" && \ pip install --upgrade --no-cache-dir "git+https://github.com/openpipelines-bio/core#subdirectory=packages/python/openpipeline_testutils" && \ python -c 'exec("try:\n import zarr; from importlib.metadata import version\nexcept ModuleNotFoundError:\n exit(0)\nelse: assert int(version(\"zarr\").partition(\".\")[0]) > 2")' LABEL org.opencontainers.image.authors="Dorien Roosen" LABEL org.opencontainers.image.description="Companion container for running component test_workflows/ingestion spaceranger_mapping_test" -LABEL org.opencontainers.image.created="2026-05-22T11:53:09Z" +LABEL org.opencontainers.image.created="2026-06-01T12:50:39Z" LABEL org.opencontainers.image.source="https://github.com/openpipelines-bio/openpipeline_spatial" -LABEL org.opencontainers.image.revision="e087099616271bd0f11e825b7817ec14ebef62d7" +LABEL org.opencontainers.image.revision="4449aa6094a686af0a5fbe99b9aaafd01ae75aff" LABEL org.opencontainers.image.version="main" VIASHDOCKER diff --git a/target/_test/nextflow/test_workflows/ingestion/spaceranger_mapping_test/.config.vsh.yaml b/target/_test/nextflow/test_workflows/ingestion/spaceranger_mapping_test/.config.vsh.yaml index 57efcdf..1db2ea3 100644 --- a/target/_test/nextflow/test_workflows/ingestion/spaceranger_mapping_test/.config.vsh.yaml +++ b/target/_test/nextflow/test_workflows/ingestion/spaceranger_mapping_test/.config.vsh.yaml @@ -48,7 +48,7 @@ repositories: - type: "vsh" name: "openpipeline" repo: "openpipeline" - tag: "v4.0.3" + tag: "v4.1.0" links: repository: "https://github.com/openpipelines-bio/openpipeline_spatial" docker_registry: "ghcr.io" @@ -135,10 +135,11 @@ engines: - type: "python" user: false packages: - - "anndata~=0.12.7" + - "anndata~=0.12.16" - "awkward" - - "mudata~=0.3.2" - - "viashpy==0.9.0" + - "scipy~=1.17.1" + - "mudata~=0.3.8" + - "viashpy==0.10.0" github: - "openpipelines-bio/core#subdirectory=packages/python/openpipeline_testutils" script: @@ -156,8 +157,8 @@ build_info: engine: "docker|native" output: "target/_test/nextflow/test_workflows/ingestion/spaceranger_mapping_test" executable: "target/_test/nextflow/test_workflows/ingestion/spaceranger_mapping_test/main.nf" - viash_version: "0.9.4" - git_commit: "e087099616271bd0f11e825b7817ec14ebef62d7" + viash_version: "0.9.7" + git_commit: "4449aa6094a686af0a5fbe99b9aaafd01ae75aff" git_remote: "https://github.com/openpipelines-bio/openpipeline_spatial" package_config: name: "openpipeline_spatial" @@ -171,8 +172,8 @@ package_config: - type: "vsh" name: "openpipeline" repo: "openpipeline" - tag: "v4.0.3" - viash_version: "0.9.4" + tag: "v4.1.0" + viash_version: "0.9.7" source: "src" target: "target" config_mods: diff --git a/target/_test/nextflow/test_workflows/ingestion/spaceranger_mapping_test/main.nf b/target/_test/nextflow/test_workflows/ingestion/spaceranger_mapping_test/main.nf index a0d3750..90fd94c 100644 --- a/target/_test/nextflow/test_workflows/ingestion/spaceranger_mapping_test/main.nf +++ b/target/_test/nextflow/test_workflows/ingestion/spaceranger_mapping_test/main.nf @@ -1,6 +1,6 @@ // spaceranger_mapping_test main // -// This wrapper script is auto-generated by viash 0.9.4 and is thus a derivative +// This wrapper script is auto-generated by viash 0.9.7 and is thus a derivative // work thereof. This software comes with ABSOLUTELY NO WARRANTY from Data // Intuitive. // @@ -1353,47 +1353,42 @@ def readCsv(file_path) { def splitRegex = java.util.regex.Pattern.compile(''',(?=(?:[^"]*"[^"]*")*[^"]*$)''') def removeQuote = java.util.regex.Pattern.compile('''"(.*)"''') - def br = java.nio.file.Files.newBufferedReader(inputFile) + java.nio.file.Files.newBufferedReader(inputFile).withCloseable { br -> + def row = 0 + def header = null + def line - def row = -1 - def header = null - while (br.ready() && header == null) { - def line = br.readLine() - row++ - if (!line.startsWith("#")) { - header = splitRegex.split(line, -1).collect{field -> - m = removeQuote.matcher(field) - m.find() ? m.replaceFirst('$1') : field - } - } - } - assert header != null: "CSV file should contain a header" - - while (br.ready()) { - def line = br.readLine() - row++ - if (line == null) { - br.close() - break - } - - if (!line.startsWith("#")) { - def predata = splitRegex.split(line, -1) - def data = predata.collect{field -> - if (field == "") { - return null - } - def m = removeQuote.matcher(field) - if (m.find()) { - return m.replaceFirst('$1') - } else { - return field + while (header == null && (line = br.readLine()) != null) { + if (!line.startsWith("#")) { + header = splitRegex.split(line, -1).collect { field -> + def m = removeQuote.matcher(field) + m.find() ? m.replaceFirst('$1') : field } } - assert header.size() == data.size(): "Row $row should contain the same number as fields as the header" - - def dataMap = [header, data].transpose().collectEntries().findAll{it.value != null} - output.add(dataMap) + row++ + } + assert header != null : "CSV file should contain a header" + + while ((line = br.readLine()) != null) { + row++ + if (!line.startsWith("#")) { + def predata = splitRegex.split(line, -1) + def data = predata.collect { field -> + if (field == "") { + return null + } + def m = removeQuote.matcher(field) + if (m.find()) { + return m.replaceFirst('$1') + } else { + return field + } + } + assert header.size() == data.size() : "Row $row should contain the same number as fields as the header" + + def dataMap = [header, data].transpose().collectEntries().findAll { it.value != null } + output.add(dataMap) + } } } @@ -1709,10 +1704,25 @@ process publishFilesProc { ] .transpose() .collectMany{infile, outfile -> - if (infile.toString() != outfile.toString()) { + def infileString = infile.toString() + def outfileString = outfile.toString() + if (infileString != outfileString) { + /* Trailing slashes are removed from both the source and destination arguments. + From source arguments, this is useful when a source argument may have a trailing slash + and specify a symbolic link to a directory. Without removing the slash, cp will dereference + the symbolic link. + See https://www.gnu.org/software/coreutils/manual/html_node/Trailing-slashes.html#Trailing-slashes-1 + + For the destination path addding a trailing slash is a problem when publishing directories: + it requires the destination directory to exist. This fails because we only create the parent + directories first. + */ + def regexTrailingSlashes = ~/\/+$/ + def infileNoTrailingSlash = infileString - regexTrailingSlashes + def outfileNoTrailingSlash = outfileString - regexTrailingSlashes [ - "[ -d \"\$(dirname '${outfile.toString()}')\" ] || mkdir -p \"\$(dirname '${outfile.toString()}')\"", - "cp -r '${infile.toString()}' '${outfile.toString()}'" + "[ -d \"\$(dirname '${outfileNoTrailingSlash}')\" ] || mkdir -p \"\$(dirname '${outfileNoTrailingSlash}')\"", + "cp -a '${infileNoTrailingSlash}' '${outfileNoTrailingSlash}'" ] } else { // no need to copy if infile is the same as outfile @@ -3104,7 +3114,7 @@ meta = [ "type" : "vsh", "name" : "openpipeline", "repo" : "openpipeline", - "tag" : "v4.0.3" + "tag" : "v4.1.0" } ], "links" : { @@ -3209,10 +3219,11 @@ meta = [ "type" : "python", "user" : false, "packages" : [ - "anndata~=0.12.7", + "anndata~=0.12.16", "awkward", - "mudata~=0.3.2", - "viashpy==0.9.0" + "scipy~=1.17.1", + "mudata~=0.3.8", + "viashpy==0.10.0" ], "github" : [ "openpipelines-bio/core#subdirectory=packages/python/openpipeline_testutils" @@ -3234,8 +3245,8 @@ meta = [ "runner" : "nextflow", "engine" : "docker|native", "output" : "/workdir/root/repo/target/_test/nextflow/test_workflows/ingestion/spaceranger_mapping_test", - "viash_version" : "0.9.4", - "git_commit" : "e087099616271bd0f11e825b7817ec14ebef62d7", + "viash_version" : "0.9.7", + "git_commit" : "4449aa6094a686af0a5fbe99b9aaafd01ae75aff", "git_remote" : "https://github.com/openpipelines-bio/openpipeline_spatial" }, "package_config" : { @@ -3255,10 +3266,10 @@ meta = [ "type" : "vsh", "name" : "openpipeline", "repo" : "openpipeline", - "tag" : "v4.0.3" + "tag" : "v4.1.0" } ], - "viash_version" : "0.9.4", + "viash_version" : "0.9.7", "source" : "/workdir/root/repo/src", "target" : "/workdir/root/repo/target", "config_mods" : [ diff --git a/target/dependencies/vsh/vsh/openpipeline/v4.0.3/nextflow/feature_annotation/highly_variable_features_scanpy/subset_vars.py b/target/dependencies/vsh/vsh/openpipeline/v4.0.3/nextflow/feature_annotation/highly_variable_features_scanpy/subset_vars.py deleted file mode 100644 index 6003513..0000000 --- a/target/dependencies/vsh/vsh/openpipeline/v4.0.3/nextflow/feature_annotation/highly_variable_features_scanpy/subset_vars.py +++ /dev/null @@ -1,31 +0,0 @@ -def subset_vars(adata, subset_col): - """Subset AnnData object on highly variable genes - - Parameters - ---------- - adata : AnnData - Annotated data object - subset_col : str - Name of the boolean column in `adata.var` that contains the information if features should be used or not - - Returns - ------- - AnnData - Copy of `adata` with subsetted features - """ - if subset_col not in adata.var.columns: - raise ValueError( - f"Requested to use .var column '{subset_col}' as a selection of genes, but the column is not available." - ) - - if adata.var[subset_col].dtype == "boolean": - assert adata.var[subset_col].isna().sum() == 0, ( - f"The .var column `{subset_col}` contains NaN values. Can not subset data." - ) - adata.var[subset_col] = adata.var[subset_col].astype("bool") - - assert adata.var[subset_col].dtype == "bool", ( - f"Expected dtype of .var column '{subset_col}' to be `bool`, but found {adata.var[subset_col].dtype}. Can not subset data." - ) - - return adata[:, adata.var[subset_col]].copy() diff --git a/target/dependencies/vsh/vsh/openpipeline/v4.1.0/_private/nextflow/workflows/multiomics/process_singlesample_base/.config.vsh.yaml b/target/dependencies/vsh/vsh/openpipeline/v4.1.0/_private/nextflow/workflows/multiomics/process_singlesample_base/.config.vsh.yaml new file mode 100644 index 0000000..6931190 --- /dev/null +++ b/target/dependencies/vsh/vsh/openpipeline/v4.1.0/_private/nextflow/workflows/multiomics/process_singlesample_base/.config.vsh.yaml @@ -0,0 +1,567 @@ +name: "process_singlesample_base" +namespace: "workflows/multiomics" +version: "v4.1.0" +authors: +- name: "Dorien Roosen" + roles: + - "author" + info: + role: "Core Team Member" + links: + email: "dorien@data-intuitive.com" + github: "dorien-er" + linkedin: "dorien-roosen" + organizations: + - name: "Data Intuitive" + href: "https://www.data-intuitive.com" + role: "Data Scientist" +argument_groups: +- name: "Output State" + arguments: + - type: "string" + name: "--output_modality" + info: null + required: false + direction: "output" + multiple: false + multiple_sep: ";" +- name: "Inputs" + arguments: + - type: "file" + name: "--input" + alternatives: + - "-i" + description: "Path to the sample." + info: null + example: + - "input.h5mu" + must_exist: true + create_parent: true + required: true + direction: "input" + multiple: false + multiple_sep: ";" + - type: "string" + name: "--rna_layer" + description: "Input layer for the gene expression modality. If not specified,\ + \ .X is used." + info: null + required: false + direction: "input" + multiple: false + multiple_sep: ";" + - type: "string" + name: "--prot_layer" + description: "Input layer for the antibody capture modality. If not specified,\ + \ .X is used." + info: null + required: false + direction: "input" + multiple: false + multiple_sep: ";" + - type: "string" + name: "--gdo_layer" + description: "Input layer for the guide-derived oligonucleotide (GDO) data. If\ + \ not specified, .X is used." + info: null + required: false + direction: "input" + multiple: false + multiple_sep: ";" +- name: "Outputs" + arguments: + - type: "file" + name: "--output" + description: "Destination path to the output." + info: null + example: + - "output.h5mu" + must_exist: true + create_parent: true + required: true + direction: "output" + multiple: false + multiple_sep: ";" +- name: "Sample ID options" + description: "Options for adding the id to .obs on the MuData object. Having a sample\ + \ \nid present in a requirement of several components for this pipeline.\n" + arguments: + - type: "boolean" + name: "--add_id_to_obs" + description: "Add the value passed with --id to .obs." + info: null + default: + - true + required: false + direction: "input" + multiple: false + multiple_sep: ";" + - type: "string" + name: "--add_id_obs_output" + description: ".Obs column to add the sample IDs to. Required and only used when\ + \ \n--add_id_to_obs is set to 'true'\n" + info: null + default: + - "sample_id" + required: false + direction: "input" + multiple: false + multiple_sep: ";" + - type: "boolean" + name: "--add_id_make_observation_keys_unique" + description: "Join the id to the .obs index (.obs_names). \nOnly used when --add_id_to_obs\ + \ is set to 'true'.\n" + info: null + default: + - true + required: false + direction: "input" + multiple: false + multiple_sep: ";" +- name: "RNA filtering options" + arguments: + - type: "integer" + name: "--rna_min_counts" + description: "Minimum number of counts captured per cell." + info: null + example: + - 200 + required: false + direction: "input" + multiple: false + multiple_sep: ";" + - type: "integer" + name: "--rna_max_counts" + description: "Maximum number of counts captured per cell." + info: null + example: + - 5000000 + required: false + direction: "input" + multiple: false + multiple_sep: ";" + - type: "integer" + name: "--rna_min_genes_per_cell" + description: "Minimum of non-zero values per cell." + info: null + example: + - 200 + required: false + direction: "input" + multiple: false + multiple_sep: ";" + - type: "integer" + name: "--rna_max_genes_per_cell" + description: "Maximum of non-zero values per cell." + info: null + example: + - 1500000 + required: false + direction: "input" + multiple: false + multiple_sep: ";" + - type: "integer" + name: "--rna_min_cells_per_gene" + description: "Minimum of non-zero values per gene." + info: null + example: + - 3 + required: false + direction: "input" + multiple: false + multiple_sep: ";" + - type: "double" + name: "--rna_min_fraction_mito" + description: "Minimum fraction of UMIs that are mitochondrial." + info: null + example: + - 0.0 + required: false + direction: "input" + multiple: false + multiple_sep: ";" + - type: "double" + name: "--rna_max_fraction_mito" + description: "Maximum fraction of UMIs that are mitochondrial." + info: null + example: + - 0.2 + required: false + direction: "input" + multiple: false + multiple_sep: ";" + - type: "double" + name: "--rna_min_fraction_ribo" + description: "Minimum fraction of UMIs that are mitochondrial." + info: null + example: + - 0.0 + required: false + direction: "input" + multiple: false + multiple_sep: ";" + - type: "double" + name: "--rna_max_fraction_ribo" + description: "Maximum fraction of UMIs that are mitochondrial." + info: null + example: + - 0.2 + required: false + direction: "input" + multiple: false + multiple_sep: ";" + - type: "boolean_true" + name: "--skip_scrublet_doublet_detection" + description: "Skip the scrublet doublet detection step." + info: null + direction: "input" +- name: "CITE-seq filtering options" + arguments: + - type: "integer" + name: "--prot_min_counts" + description: "Minimum number of counts per cell." + info: null + example: + - 3 + required: false + direction: "input" + multiple: false + multiple_sep: ";" + - type: "integer" + name: "--prot_max_counts" + description: "Minimum number of counts per cell." + info: null + example: + - 5000000 + required: false + direction: "input" + multiple: false + multiple_sep: ";" + - type: "integer" + name: "--prot_min_proteins_per_cell" + description: "Minimum of non-zero values per cell." + info: null + example: + - 200 + required: false + direction: "input" + multiple: false + multiple_sep: ";" + - type: "integer" + name: "--prot_max_proteins_per_cell" + description: "Maximum of non-zero values per cell." + info: null + example: + - 100000000 + required: false + direction: "input" + multiple: false + multiple_sep: ";" + - type: "integer" + name: "--prot_min_cells_per_protein" + description: "Minimum of non-zero values per protein." + info: null + example: + - 3 + required: false + direction: "input" + multiple: false + multiple_sep: ";" +- name: "GDO filtering options" + arguments: + - type: "integer" + name: "--gdo_min_counts" + description: "Minimum number of counts per cell." + info: null + example: + - 3 + required: false + direction: "input" + multiple: false + multiple_sep: ";" + - type: "integer" + name: "--gdo_max_counts" + description: "Minimum number of counts per cell." + info: null + example: + - 5000000 + required: false + direction: "input" + multiple: false + multiple_sep: ";" + - type: "integer" + name: "--gdo_min_guides_per_cell" + description: "Minimum of non-zero values per cell." + info: null + example: + - 200 + required: false + direction: "input" + multiple: false + multiple_sep: ";" + - type: "integer" + name: "--gdo_max_guides_per_cell" + description: "Maximum of non-zero values per cell." + info: null + example: + - 100000000 + required: false + direction: "input" + multiple: false + multiple_sep: ";" + - type: "integer" + name: "--gdo_min_cells_per_guide" + description: "Minimum of non-zero values per guide." + info: null + example: + - 3 + required: false + direction: "input" + multiple: false + multiple_sep: ";" +- name: "Cross-modality filtering" + arguments: + - type: "boolean_true" + name: "--intersect_obs" + description: "After per-modality filtering, remove observations that are not present\n\ + in all processed modalities so that each modality shares the same set of cells.\n" + info: null + direction: "input" +- name: "Mitochondrial & Ribosomal Gene Detection" + arguments: + - type: "string" + name: "--var_gene_names" + description: ".var column name to be used to detect mitochondrial/ribosomal genes\ + \ instead of .var_names (default if not set).\nGene names matching with the\ + \ regex value from --mitochondrial_gene_regex or --ribosomal_gene_regex will\ + \ be \nidentified as mitochondrial or ribosomal genes, respectively. \n" + info: null + example: + - "gene_symbol" + required: false + direction: "input" + multiple: false + multiple_sep: ";" + - type: "string" + name: "--var_name_mitochondrial_genes" + description: "In which .var slot to store a boolean array corresponding the mitochondrial\ + \ genes.\n" + info: null + required: false + direction: "input" + multiple: false + multiple_sep: ";" + - type: "string" + name: "--obs_name_mitochondrial_fraction" + description: "When specified, write the fraction of counts originating from mitochondrial\ + \ genes \n(based on --mitochondrial_gene_regex) to an .obs column with the specified\ + \ name.\nRequires --var_name_mitochondrial_genes.\n" + info: null + required: false + direction: "input" + multiple: false + multiple_sep: ";" + - type: "string" + name: "--mitochondrial_gene_regex" + description: "Regex string that identifies mitochondrial genes from --var_gene_names.\n\ + By default will detect human and mouse mitochondrial genes from a gene symbol.\n" + info: null + default: + - "^[mM][tT]-" + required: false + direction: "input" + multiple: false + multiple_sep: ";" + - type: "string" + name: "--var_name_ribosomal_genes" + description: "In which .var slot to store a boolean array corresponding the ribosomal\ + \ genes.\n" + info: null + required: false + direction: "input" + multiple: false + multiple_sep: ";" + - type: "string" + name: "--obs_name_ribosomal_fraction" + description: "When specified, write the fraction of counts originating from ribosomal\ + \ genes \n(based on --ribosomal_gene_regex) to an .obs column with the specified\ + \ name.\nRequires --var_name_ribosomal_genes.\n" + info: null + required: false + direction: "input" + multiple: false + multiple_sep: ";" + - type: "string" + name: "--ribosomal_gene_regex" + description: "Regex string that identifies ribosomal genes from --var_gene_names.\n\ + By default will detect human and mouse ribosomal genes from a gene symbol.\n" + info: null + default: + - "^[Mm]?[Rr][Pp][LlSs]" + required: false + direction: "input" + multiple: false + multiple_sep: ";" +resources: +- type: "nextflow_script" + path: "main.nf" + is_executable: true + entrypoint: "run_wf" +- type: "file" + path: "utils" +- type: "file" + path: "nextflow_labels.config" + dest: "nextflow_labels.config" +description: "A pipeline to analyse a single multiomics sample." +info: null +status: "enabled" +scope: + image: "private" + target: "private" +dependencies: +- name: "metadata/add_id" + repository: + type: "local" +- name: "workflows/multiomics/split_modalities" + alias: "split_modalities_workflow" + repository: + type: "local" +- name: "workflows/rna/rna_singlesample" + repository: + type: "local" +- name: "workflows/prot/prot_singlesample" + repository: + type: "local" +- name: "workflows/gdo/gdo_singlesample" + repository: + type: "local" +license: "MIT" +links: + repository: "https://github.com/openpipelines-bio/openpipeline" + docker_registry: "ghcr.io" +runners: +- type: "nextflow" + id: "nextflow" + directives: + tag: "$id" + auto: + simplifyInput: true + simplifyOutput: false + transcript: false + publish: false + config: + labels: + mem1gb: "memory = 1000000000.B" + mem2gb: "memory = 2000000000.B" + mem5gb: "memory = 5000000000.B" + mem10gb: "memory = 10000000000.B" + mem20gb: "memory = 20000000000.B" + mem50gb: "memory = 50000000000.B" + mem100gb: "memory = 100000000000.B" + mem200gb: "memory = 200000000000.B" + mem500gb: "memory = 500000000000.B" + mem1tb: "memory = 1000000000000.B" + mem2tb: "memory = 2000000000000.B" + mem5tb: "memory = 5000000000000.B" + mem10tb: "memory = 10000000000000.B" + mem20tb: "memory = 20000000000000.B" + mem50tb: "memory = 50000000000000.B" + mem100tb: "memory = 100000000000000.B" + mem200tb: "memory = 200000000000000.B" + mem500tb: "memory = 500000000000000.B" + mem1gib: "memory = 1073741824.B" + mem2gib: "memory = 2147483648.B" + mem4gib: "memory = 4294967296.B" + mem8gib: "memory = 8589934592.B" + mem16gib: "memory = 17179869184.B" + mem32gib: "memory = 34359738368.B" + mem64gib: "memory = 68719476736.B" + mem128gib: "memory = 137438953472.B" + mem256gib: "memory = 274877906944.B" + mem512gib: "memory = 549755813888.B" + mem1tib: "memory = 1099511627776.B" + mem2tib: "memory = 2199023255552.B" + mem4tib: "memory = 4398046511104.B" + mem8tib: "memory = 8796093022208.B" + mem16tib: "memory = 17592186044416.B" + mem32tib: "memory = 35184372088832.B" + mem64tib: "memory = 70368744177664.B" + mem128tib: "memory = 140737488355328.B" + mem256tib: "memory = 281474976710656.B" + mem512tib: "memory = 562949953421312.B" + cpu1: "cpus = 1" + cpu2: "cpus = 2" + cpu5: "cpus = 5" + cpu10: "cpus = 10" + cpu20: "cpus = 20" + cpu50: "cpus = 50" + cpu100: "cpus = 100" + cpu200: "cpus = 200" + cpu500: "cpus = 500" + cpu1000: "cpus = 1000" + script: + - "includeConfig(\"nextflow_labels.config\")" + debug: false + container: "docker" +engines: +- type: "native" + id: "native" +build_info: + config: "src/workflows/multiomics/process_singlesample_base/config.vsh.yaml" + runner: "nextflow" + engine: "native" + output: "target/_private/nextflow/workflows/multiomics/process_singlesample_base" + executable: "target/_private/nextflow/workflows/multiomics/process_singlesample_base/main.nf" + viash_version: "0.9.7" + git_commit: "a6499fddaa8553874585c747370f919f4d7b729c" + git_remote: "https://github.com/openpipelines-bio/openpipeline" + dependencies: + - "target/nextflow/metadata/add_id" + - "target/_private/nextflow/workflows/multiomics/split_modalities" + - "target/nextflow/workflows/rna/rna_singlesample" + - "target/nextflow/workflows/prot/prot_singlesample" + - "target/nextflow/workflows/gdo/gdo_singlesample" +package_config: + name: "openpipeline" + version: "v4.1.0" + summary: "Best-practice workflows for single-cell multi-omics analyses.\n" + description: "OpenPipelines are extensible single cell analysis pipelines for reproducible\ + \ and large-scale single cell processing using [Viash](https://viash.io) and [Nextflow](https://www.nextflow.io/).\n\ + \nIn terms of workflows, the following has been made available, but keep in mind\ + \ that\nindividual tools and functionality can be executed as standalone components\ + \ as well.\n\n * Demultiplexing: conversion of raw sequencing data to FASTQ objects.\n\ + \ * Ingestion: Read mapping and generating a count matrix.\n * Single sample\ + \ processing: cell filtering and doublet detection.\n * Multisample processing:\ + \ Count transformation, normalization, QC metric calulations.\n * Integration:\ + \ Clustering, integration and batch correction using single and multimodal methods.\n\ + \ * Downstream analysis workflows\n" + info: + test_resources: + - type: "s3" + path: "s3://openpipelines-data" + dest: "resources_test" + nextflow_labels_ci: + - path: "src/workflows/utils/labels_ci.config" + description: "Adds the correct memory and CPU labels when running on the Viash\ + \ Hub CI." + viash_version: "0.9.7" + source: "src" + target: "target" + config_mods: + - ".resources += {path: '/src/workflows/utils/labels.config', dest: 'nextflow_labels.config'}\n\ + .runners[.type == 'nextflow'].config.script := 'includeConfig(\"nextflow_labels.config\"\ + )'" + - ".engines += { type: \"native\" }" + - ".engines[.type == 'docker'].target_registry := 'images.viash-hub.com'" + - ".engines[.type == 'docker'].target_tag := 'v4.1.0'" + keywords: + - "single-cell" + - "multimodal" + license: "MIT" + organization: "vsh" + links: + repository: "https://github.com/openpipelines-bio/openpipeline" + docker_registry: "ghcr.io" + homepage: "https://openpipelines.bio" + documentation: "https://openpipelines.bio/fundamentals" + issue_tracker: "https://github.com/openpipelines-bio/openpipeline/issues" diff --git a/target/dependencies/vsh/vsh/openpipeline/v4.1.0/_private/nextflow/workflows/multiomics/process_singlesample_base/main.nf b/target/dependencies/vsh/vsh/openpipeline/v4.1.0/_private/nextflow/workflows/multiomics/process_singlesample_base/main.nf new file mode 100644 index 0000000..dd70670 --- /dev/null +++ b/target/dependencies/vsh/vsh/openpipeline/v4.1.0/_private/nextflow/workflows/multiomics/process_singlesample_base/main.nf @@ -0,0 +1,4019 @@ +// process_singlesample_base v4.1.0 +// +// This wrapper script is auto-generated by viash 0.9.7 and is thus a derivative +// work thereof. This software comes with ABSOLUTELY NO WARRANTY from Data +// Intuitive. +// +// The component may contain files which fall under a different license. The +// authors of this component should specify the license in the header of such +// files, or include a separate license file detailing the licenses of all included +// files. +// +// Component authors: +// * Dorien Roosen (author) + +//////////////////////////// +// VDSL3 helper functions // +//////////////////////////// + +// helper file: 'src/main/resources/io/viash/runners/nextflow/arguments/_checkArgumentType.nf' +class UnexpectedArgumentTypeException extends Exception { + String errorIdentifier + String stage + String plainName + String expectedClass + String foundClass + + // ${key ? " in module '$key'" : ""}${id ? " id '$id'" : ""} + UnexpectedArgumentTypeException(String errorIdentifier, String stage, String plainName, String expectedClass, String foundClass) { + super("Error${errorIdentifier ? " $errorIdentifier" : ""}:${stage ? " $stage" : "" } argument '${plainName}' has the wrong type. " + + "Expected type: ${expectedClass}. Found type: ${foundClass}") + this.errorIdentifier = errorIdentifier + this.stage = stage + this.plainName = plainName + this.expectedClass = expectedClass + this.foundClass = foundClass + } +} + +/** + * Checks if the given value is of the expected type. If not, an exception is thrown. + * + * @param stage The stage of the argument (input or output) + * @param par The parameter definition + * @param value The value to check + * @param errorIdentifier The identifier to use in the error message + * @return The value, if it is of the expected type + * @throws UnexpectedArgumentTypeException If the value is not of the expected type +*/ +def _checkArgumentType(String stage, Map par, Object value, String errorIdentifier) { + // expectedClass will only be != null if value is not of the expected type + def expectedClass = null + def foundClass = null + + // todo: split if need be + + if (!par.required && value == null) { + expectedClass = null + } else if (par.multiple) { + if (value !instanceof Collection) { + value = [value] + } + + // split strings + value = value.collectMany{ val -> + if (val instanceof String) { + // collect() to ensure that the result is a List and not simply an array + val.split(par.multiple_sep).collect() + } else { + [val] + } + } + + // process globs + if (par.type == "file" && par.direction == "input") { + value = value.collect{ it instanceof String ? file(it, hidden: true) : it }.flatten() + } + + // check types of elements in list + try { + value = value.collect { listVal -> + _checkArgumentType(stage, par + [multiple: false], listVal, errorIdentifier) + } + } catch (UnexpectedArgumentTypeException e) { + expectedClass = "List[${e.expectedClass}]" + foundClass = "List[${e.foundClass}]" + } + } else if (par.type == "string") { + // cast to string if need be. only cast if the value is a GString + if (value instanceof GString) { + value = value as String + } + expectedClass = value instanceof String ? null : "String" + } else if (par.type == "integer") { + // cast to integer if need be + if (value !instanceof Integer) { + try { + value = value as Integer + } catch (NumberFormatException e) { + expectedClass = "Integer" + } + } + } else if (par.type == "long") { + // cast to long if need be + if (value !instanceof Long) { + try { + value = value as Long + } catch (NumberFormatException e) { + expectedClass = "Long" + } + } + } else if (par.type == "double") { + // cast to double if need be + if (value !instanceof Double) { + try { + value = value as Double + } catch (NumberFormatException e) { + expectedClass = "Double" + } + } + } else if (par.type == "float") { + // cast to float if need be + if (value !instanceof Float) { + try { + value = value as Float + } catch (NumberFormatException e) { + expectedClass = "Float" + } + } + } else if (par.type == "boolean" | par.type == "boolean_true" | par.type == "boolean_false") { + // cast to boolean if need be + if (value !instanceof Boolean) { + try { + value = value as Boolean + } catch (Exception e) { + expectedClass = "Boolean" + } + } + } else if (par.type == "file" && (par.direction == "input" || stage == "output")) { + // cast to path if need be + if (value instanceof String) { + value = file(value, hidden: true) + } + if (value instanceof File) { + value = value.toPath() + } + expectedClass = value instanceof Path ? null : "Path" + } else if (par.type == "file" && stage == "input" && par.direction == "output") { + // cast to string if need be + if (value !instanceof String) { + try { + value = value as String + } catch (Exception e) { + expectedClass = "String" + } + } + } else { + // didn't find a match for par.type + expectedClass = par.type + } + + if (expectedClass != null) { + if (foundClass == null) { + foundClass = value.getClass().getName() + } + throw new UnexpectedArgumentTypeException(errorIdentifier, stage, par.plainName, expectedClass, foundClass) + } + + return value +} +// helper file: 'src/main/resources/io/viash/runners/nextflow/arguments/_processInputValues.nf' +Map _processInputValues(Map inputs, Map config, String id, String key) { + if (!workflow.stubRun) { + config.allArguments.each { arg -> + if (arg.required && arg.direction == "input") { + assert inputs.containsKey(arg.plainName) && inputs.get(arg.plainName) != null : + "Error in module '${key}' id '${id}': required input argument '${arg.plainName}' is missing" + } + } + + inputs = inputs.collectEntries { name, value -> + def par = config.allArguments.find { it.plainName == name && (it.direction == "input" || it.type == "file") } + assert par != null : "Error in module '${key}' id '${id}': '${name}' is not a valid input argument" + + value = _checkArgumentType("input", par, value, "in module '$key' id '$id'") + + [ name, value ] + } + } + return inputs +} + +// helper file: 'src/main/resources/io/viash/runners/nextflow/arguments/_processOutputValues.nf' +Map _checkValidOutputArgument(Map outputs, Map config, String id, String key) { + if (!workflow.stubRun) { + outputs = outputs.collectEntries { name, value -> + def par = config.allArguments.find { it.plainName == name && it.direction == "output" } + assert par != null : "Error in module '${key}' id '${id}': '${name}' is not a valid output argument" + + value = _checkArgumentType("output", par, value, "in module '$key' id '$id'") + + [ name, value ] + } + } + return outputs +} + +void _checkAllRequiredOuputsPresent(Map outputs, Map config, String id, String key) { + if (!workflow.stubRun) { + config.allArguments.each { arg -> + if (arg.direction == "output" && arg.required) { + assert outputs.containsKey(arg.plainName) && outputs.get(arg.plainName) != null : + "Error in module '${key}' id '${id}': required output argument '${arg.plainName}' is missing" + } + } + } +} +// helper file: 'src/main/resources/io/viash/runners/nextflow/channel/IDChecker.nf' +class IDChecker { + final def items = [] as Set + + @groovy.transform.WithWriteLock + boolean observe(String item) { + if (items.contains(item)) { + return false + } else { + items << item + return true + } + } + + @groovy.transform.WithReadLock + boolean contains(String item) { + return items.contains(item) + } + + @groovy.transform.WithReadLock + Set getItems() { + return items.clone() + } +} +// helper file: 'src/main/resources/io/viash/runners/nextflow/channel/_checkUniqueIds.nf' + +/** + * Check if the ids are unique across parameter sets + * + * @param parameterSets a list of parameter sets. + */ +private void _checkUniqueIds(List>> parameterSets) { + def ppIds = parameterSets.collect{it[0]} + assert ppIds.size() == ppIds.unique().size() : "All argument sets should have unique ids. Detected ids: $ppIds" +} + +// helper file: 'src/main/resources/io/viash/runners/nextflow/channel/_getChild.nf' + +// helper functions for reading params from file // +def _getChild(parent, child) { + if (child.contains("://") || java.nio.file.Paths.get(child).isAbsolute()) { + child + } else { + def parentAbsolute = java.nio.file.Paths.get(parent).toAbsolutePath().toString() + parentAbsolute.replaceAll('/[^/]*$', "/") + child + } +} + +// helper file: 'src/main/resources/io/viash/runners/nextflow/channel/_parseParamList.nf' +/** + * Figure out the param list format based on the file extension + * + * @param param_list A String containing the path to the parameter list file. + * + * @return A String containing the format of the parameter list file. + */ +def _paramListGuessFormat(param_list) { + if (param_list !instanceof String) { + "asis" + } else if (param_list.endsWith(".csv")) { + "csv" + } else if (param_list.endsWith(".json") || param_list.endsWith(".jsn")) { + "json" + } else if (param_list.endsWith(".yaml") || param_list.endsWith(".yml")) { + "yaml" + } else { + "yaml_blob" + } +} + + +/** + * Read the param list + * + * @param param_list One of the following: + * - A String containing the path to the parameter list file (csv, json or yaml), + * - A yaml blob of a list of maps (yaml_blob), + * - Or a groovy list of maps (asis). + * @param config A Map of the Viash configuration. + * + * @return A List of Maps containing the parameters. + */ +def _parseParamList(param_list, Map config) { + // first determine format by extension + def paramListFormat = _paramListGuessFormat(param_list) + + def paramListPath = (paramListFormat != "asis" && paramListFormat != "yaml_blob") ? + file(param_list, hidden: true) : + null + + // get the correct parser function for the detected params_list format + def paramSets = [] + if (paramListFormat == "asis") { + paramSets = param_list + } else if (paramListFormat == "yaml_blob") { + paramSets = readYamlBlob(param_list) + } else if (paramListFormat == "yaml") { + paramSets = readYaml(paramListPath) + } else if (paramListFormat == "json") { + paramSets = readJson(paramListPath) + } else if (paramListFormat == "csv") { + paramSets = readCsv(paramListPath) + } else { + error "Format of provided --param_list not recognised.\n" + + "Found: '$paramListFormat'.\n" + + "Expected: a csv file, a json file, a yaml file,\n" + + "a yaml blob or a groovy list of maps." + } + + // data checks + assert paramSets instanceof List: "--param_list should contain a list of maps" + for (value in paramSets) { + assert value instanceof Map: "--param_list should contain a list of maps" + } + + // id is argument + def idIsArgument = config.allArguments.any{it.plainName == "id"} + + // Reformat from List to List> by adding the ID as first element of a Tuple2 + paramSets = paramSets.collect({ data -> + def id = data.id + if (!idIsArgument) { + data = data.findAll{k, v -> k != "id"} + } + [id, data] + }) + + // Split parameters with 'multiple: true' + paramSets = paramSets.collect({ id, data -> + data = _splitParams(data, config) + [id, data] + }) + + // The paths of input files inside a param_list file may have been specified relatively to the + // location of the param_list file. These paths must be made absolute. + if (paramListPath) { + paramSets = paramSets.collect({ id, data -> + def new_data = data.collectEntries{ parName, parValue -> + def par = config.allArguments.find{it.plainName == parName} + if (par && par.type == "file" && par.direction == "input") { + if (parValue instanceof Collection) { + parValue = parValue.collectMany{path -> + def x = _resolveSiblingIfNotAbsolute(path, paramListPath) + x instanceof Collection ? x : [x] + } + } else { + parValue = _resolveSiblingIfNotAbsolute(parValue, paramListPath) + } + } + [parName, parValue] + } + [id, new_data] + }) + } + + return paramSets +} + +// helper file: 'src/main/resources/io/viash/runners/nextflow/channel/_splitParams.nf' +/** + * Split parameters for arguments that accept multiple values using their separator + * + * @param paramList A Map containing parameters to split. + * @param config A Map of the Viash configuration. This Map can be generated from the config file + * using the readConfig() function. + * + * @return A Map of parameters where the parameter values have been split into a list using + * their seperator. + */ +Map _splitParams(Map parValues, Map config){ + def parsedParamValues = parValues.collectEntries { parName, parValue -> + def parameterSettings = config.allArguments.find({it.plainName == parName}) + + if (!parameterSettings) { + // if argument is not found, do not alter + return [parName, parValue] + } + if (parameterSettings.multiple) { // Check if parameter can accept multiple values + if (parValue instanceof Collection) { + parValue = parValue.collect{it instanceof String ? it.split(parameterSettings.multiple_sep) : it } + } else if (parValue instanceof String) { + parValue = parValue.split(parameterSettings.multiple_sep) + } else if (parValue == null) { + parValue = [] + } else { + parValue = [ parValue ] + } + parValue = parValue.flatten() + } + // For all parameters check if multiple values are only passed for + // arguments that allow it. Quietly simplify lists of length 1. + if (!parameterSettings.multiple && parValue instanceof Collection) { + assert parValue.size() == 1 : + "Error: argument ${parName} has too many values.\n" + + " Expected amount: 1. Found: ${parValue.size()}" + parValue = parValue[0] + } + [parName, parValue] + } + return parsedParamValues +} + +// helper file: 'src/main/resources/io/viash/runners/nextflow/channel/channelFromParams.nf' +/** + * Parse nextflow parameters based on settings defined in a viash config. + * Return a list of parameter sets, each parameter set corresponding to + * an event in a nextflow channel. The output from this function can be used + * with Channel.fromList to create a nextflow channel with Vdsl3 formatted + * events. + * + * This function performs: + * - A filtering of the params which can be found in the config file. + * - Process the params_list argument which allows a user to to initialise + * a Vsdl3 channel with multiple parameter sets. Possible formats are + * csv, json, yaml, or simply a yaml_blob. A csv should have column names + * which correspond to the different arguments of this pipeline. A json or a yaml + * file should be a list of maps, each of which has keys corresponding to the + * arguments of the pipeline. A yaml blob can also be passed directly as a parameter. + * When passing a csv, json or yaml, relative path names are relativized to the + * location of the parameter file. + * - Combine the parameter sets into a vdsl3 Channel. + * + * @param params Input parameters. Can optionaly contain a 'param_list' key that + * provides a list of arguments that can be split up into multiple events + * in the output channel possible formats of param_lists are: a csv file, + * json file, a yaml file or a yaml blob. Each parameters set (event) must + * have a unique ID. + * @param config A Map of the Viash configuration. This Map can be generated from the config file + * using the readConfig() function. + * + * @return A list of parameters with the first element of the event being + * the event ID and the second element containing a map of the parsed parameters. + */ + +private List>> _paramsToParamSets(Map params, Map config){ + // todo: fetch key from run args + def key_ = config.name + + /* parse regular parameters (not in param_list) */ + /*************************************************/ + def globalParams = config.allArguments + .findAll { params.containsKey(it.plainName) } + .collectEntries { [ it.plainName, params[it.plainName] ] } + def globalID = params.get("id", null) + + /* process params_list arguments */ + /*********************************/ + def paramList = params.containsKey("param_list") && params.param_list != null ? + params.param_list : [] + // if (paramList instanceof String) { + // paramList = [paramList] + // } + // def paramSets = paramList.collectMany{ _parseParamList(it, config) } + // TODO: be able to process param_list when it is a list of strings + def paramSets = _parseParamList(paramList, config) + if (paramSets.isEmpty()) { + paramSets = [[null, [:]]] + } + + /* combine arguments into channel */ + /**********************************/ + def processedParams = paramSets.indexed().collect{ index, tup -> + // Process ID + def id = tup[0] ?: globalID + + if (workflow.stubRun && !id) { + // if stub run, explicitly add an id if missing + id = "stub${index}" + } + assert id != null: "Each parameter set should have at least an 'id'" + + // Process params + def parValues = globalParams + tup[1] + // // Remove parameters which are null, if the default is also null + // parValues = parValues.collectEntries{paramName, paramValue -> + // parameterSettings = config.functionality.allArguments.find({it.plainName == paramName}) + // if ( paramValue != null || parameterSettings.get("default", null) != null ) { + // [paramName, paramValue] + // } + // } + parValues = parValues.collectEntries { name, value -> + def par = config.allArguments.find { it.plainName == name && (it.direction == "input" || it.type == "file") } + assert par != null : "Error in module '${key_}' id '${id}': '${name}' is not a valid input argument" + + if (par == null) { + return [:] + } + value = _checkArgumentType("input", par, value, "in module '$key_' id '$id'") + + [ name, value ] + } + + [id, parValues] + } + + // Check if ids (first element of each list) is unique + _checkUniqueIds(processedParams) + return processedParams +} + +/** + * Parse nextflow parameters based on settings defined in a viash config + * and return a nextflow channel. + * + * @param params Input parameters. Can optionaly contain a 'param_list' key that + * provides a list of arguments that can be split up into multiple events + * in the output channel possible formats of param_lists are: a csv file, + * json file, a yaml file or a yaml blob. Each parameters set (event) must + * have a unique ID. + * @param config A Map of the Viash configuration. This Map can be generated from the config file + * using the readConfig() function. + * + * @return A nextflow Channel with events. Events are formatted as a tuple that contains + * first contains the ID of the event and as second element holds a parameter map. + * + * + */ +def channelFromParams(Map params, Map config) { + def processedParams = _paramsToParamSets(params, config) + return Channel.fromList(processedParams) +} + +// helper file: 'src/main/resources/io/viash/runners/nextflow/channel/checkUniqueIds.nf' +def checkUniqueIds(Map args) { + def stopOnError = args.stopOnError == null ? args.stopOnError : true + + def idChecker = new IDChecker() + + return filter { tup -> + if (!idChecker.observe(tup[0])) { + if (stopOnError) { + error "Duplicate id: ${tup[0]}" + } else { + log.warn "Duplicate id: ${tup[0]}, removing duplicate entry" + return false + } + } + return true + } +} +// helper file: 'src/main/resources/io/viash/runners/nextflow/channel/preprocessInputs.nf' +// This helper file will be deprecated soon +preprocessInputsDeprecationWarningPrinted = false + +def preprocessInputsDeprecationWarning() { + if (!preprocessInputsDeprecationWarningPrinted) { + preprocessInputsDeprecationWarningPrinted = true + System.err.println("Warning: preprocessInputs() is deprecated and will be removed in Viash 0.9.0.") + } +} + +/** + * Generate a nextflow Workflow that allows processing a channel of + * Vdsl3 formatted events and apply a Viash config to them: + * - Gather default parameters from the Viash config and make + * sure that they are correctly formatted (see applyConfig method). + * - Format the input parameters (also using the applyConfig method). + * - Apply the default parameter to the input parameters. + * - Do some assertions: + * ~ Check if the event IDs in the channel are unique. + * + * The events in the channel are formatted as tuples, with the + * first element of the tuples being a unique id of the parameter set, + * and the second element containg the the parameters themselves. + * Optional extra elements of the tuples will be passed to the output as is. + * + * @param args A map that must contain a 'config' key that points + * to a parsed config (see readConfig()). Optionally, a + * 'key' key can be provided which can be used to create a unique + * name for the workflow process. + * + * @return A workflow that allows processing a channel of Vdsl3 formatted events + * and apply a Viash config to them. + */ +def preprocessInputs(Map args) { + preprocessInputsDeprecationWarning() + + def config = args.config + assert config instanceof Map : + "Error in preprocessInputs: config must be a map. " + + "Expected class: Map. Found: config.getClass() is ${config.getClass()}" + def key_ = args.key ?: config.name + + // Get different parameter types (used throughout this function) + def defaultArgs = config.allArguments + .findAll { it.containsKey("default") } + .collectEntries { [ it.plainName, it.default ] } + + map { tup -> + def id = tup[0] + def data = tup[1] + def passthrough = tup.drop(2) + + def new_data = (defaultArgs + data).collectEntries { name, value -> + def par = config.allArguments.find { it.plainName == name && (it.direction == "input" || it.type == "file") } + + if (par != null) { + value = _checkArgumentType("input", par, value, "in module '$key_' id '$id'") + } + + [ name, value ] + } + + [ id, new_data ] + passthrough + } +} + +// helper file: 'src/main/resources/io/viash/runners/nextflow/channel/runComponents.nf' +/** + * Run a list of components on a stream of data. + * + * @param components: list of Viash VDSL3 modules to run + * @param fromState: a closure, a map or a list of keys to extract from the input data. + * If a closure, it will be called with the id, the data and the component config. + * @param toState: a closure, a map or a list of keys to extract from the output data + * If a closure, it will be called with the id, the output data, the old state and the component config. + * @param filter: filter function to apply to the input. + * It will be called with the id, the data and the component config. + * @param id: id to use for the output data + * If a closure, it will be called with the id, the data and the component config. + * @param auto: auto options to pass to the components + * + * @return: a workflow that runs the components + **/ +def runComponents(Map args) { + log.warn("runComponents is deprecated, use runEach instead") + assert args.components: "runComponents should be passed a list of components to run" + + def components_ = args.components + if (components_ !instanceof List) { + components_ = [ components_ ] + } + assert components_.size() > 0: "pass at least one component to runComponents" + + def fromState_ = args.fromState + def toState_ = args.toState + def filter_ = args.filter + def id_ = args.id + + workflow runComponentsWf { + take: input_ch + main: + + // generate one channel per method + out_chs = components_.collect{ comp_ -> + def comp_config = comp_.config + + def filter_ch = filter_ + ? input_ch | filter{tup -> + filter_(tup[0], tup[1], comp_config) + } + : input_ch + def id_ch = id_ + ? filter_ch | map{tup -> + // def new_id = id_(tup[0], tup[1], comp_config) + def new_id = tup[0] + if (id_ instanceof String) { + new_id = id_ + } else if (id_ instanceof Closure) { + new_id = id_(new_id, tup[1], comp_config) + } + [new_id] + tup.drop(1) + } + : filter_ch + def data_ch = id_ch | map{tup -> + def new_data = tup[1] + if (fromState_ instanceof Map) { + new_data = fromState_.collectEntries{ key0, key1 -> + [key0, new_data[key1]] + } + } else if (fromState_ instanceof List) { + new_data = fromState_.collectEntries{ key -> + [key, new_data[key]] + } + } else if (fromState_ instanceof Closure) { + new_data = fromState_(tup[0], new_data, comp_config) + } + tup.take(1) + [new_data] + tup.drop(1) + } + def out_ch = data_ch + | comp_.run( + auto: (args.auto ?: [:]) + [simplifyInput: false, simplifyOutput: false] + ) + def post_ch = toState_ + ? out_ch | map{tup -> + def output = tup[1] + def old_state = tup[2] + def new_state = null + if (toState_ instanceof Map) { + new_state = old_state + toState_.collectEntries{ key0, key1 -> + [key0, output[key1]] + } + } else if (toState_ instanceof List) { + new_state = old_state + toState_.collectEntries{ key -> + [key, output[key]] + } + } else if (toState_ instanceof Closure) { + new_state = toState_(tup[0], output, old_state, comp_config) + } + [tup[0], new_state] + tup.drop(3) + } + : out_ch + + post_ch + } + + // mix all results + output_ch = + (out_chs.size == 1) + ? out_chs[0] + : out_chs[0].mix(*out_chs.drop(1)) + + emit: output_ch + } + + return runComponentsWf +} + +// helper file: 'src/main/resources/io/viash/runners/nextflow/channel/runEach.nf' +/** + * Run a list of components on a stream of data. + * + * @param components: list of Viash VDSL3 modules to run + * @param fromState: a closure, a map or a list of keys to extract from the input data. + * If a closure, it will be called with the id, the data and the component itself. + * @param toState: a closure, a map or a list of keys to extract from the output data + * If a closure, it will be called with the id, the output data, the old state and the component itself. + * @param filter: filter function to apply to the input. + * It will be called with the id, the data and the component itself. + * @param id: id to use for the output data + * If a closure, it will be called with the id, the data and the component itself. + * @param auto: auto options to pass to the components + * + * @return: a workflow that runs the components + **/ +def runEach(Map args) { + assert args.components: "runEach should be passed a list of components to run" + + def components_ = args.components + if (components_ !instanceof List) { + components_ = [ components_ ] + } + assert components_.size() > 0: "pass at least one component to runEach" + + def fromState_ = args.fromState + def toState_ = args.toState + def filter_ = args.filter + def runIf_ = args.runIf + def id_ = args.id + + assert !runIf_ || runIf_ instanceof Closure: "runEach: must pass a Closure to runIf." + + workflow runEachWf { + take: input_ch + main: + + // generate one channel per method + out_chs = components_.collect{ comp_ -> + def filter_ch = filter_ + ? input_ch | filter{tup -> + filter_(tup[0], tup[1], comp_) + } + : input_ch + def id_ch = id_ + ? filter_ch | map{tup -> + def new_id = id_ + if (new_id instanceof Closure) { + new_id = new_id(tup[0], tup[1], comp_) + } + assert new_id instanceof String : "Error in runEach: id should be a String or a Closure that returns a String. Expected: id instanceof String. Found: ${new_id.getClass()}" + [new_id] + tup.drop(1) + } + : filter_ch + def chPassthrough = null + def chRun = null + if (runIf_) { + def idRunIfBranch = id_ch.branch{ tup -> + run: runIf_(tup[0], tup[1], comp_) + passthrough: true + } + chPassthrough = idRunIfBranch.passthrough + chRun = idRunIfBranch.run + } else { + chRun = id_ch + chPassthrough = Channel.empty() + } + def data_ch = chRun | map{tup -> + def new_data = tup[1] + if (fromState_ instanceof Map) { + new_data = fromState_.collectEntries{ key0, key1 -> + [key0, new_data[key1]] + } + } else if (fromState_ instanceof List) { + new_data = fromState_.collectEntries{ key -> + [key, new_data[key]] + } + } else if (fromState_ instanceof Closure) { + new_data = fromState_(tup[0], new_data, comp_) + } + tup.take(1) + [new_data] + tup.drop(1) + } + def out_ch = data_ch + | comp_.run( + auto: (args.auto ?: [:]) + [simplifyInput: false, simplifyOutput: false] + ) + def post_ch = toState_ + ? out_ch | map{tup -> + def output = tup[1] + def old_state = tup[2] + def new_state = null + if (toState_ instanceof Map) { + new_state = old_state + toState_.collectEntries{ key0, key1 -> + [key0, output[key1]] + } + } else if (toState_ instanceof List) { + new_state = old_state + toState_.collectEntries{ key -> + [key, output[key]] + } + } else if (toState_ instanceof Closure) { + new_state = toState_(tup[0], output, old_state, comp_) + } + [tup[0], new_state] + tup.drop(3) + } + : out_ch + + def return_ch = post_ch + | concat(chPassthrough) + + return_ch + } + + // mix all results + output_ch = + (out_chs.size == 1) + ? out_chs[0] + : out_chs[0].mix(*out_chs.drop(1)) + + emit: output_ch + } + + return runEachWf +} + +// helper file: 'src/main/resources/io/viash/runners/nextflow/channel/safeJoin.nf' +/** + * Join sourceChannel to targetChannel + * + * This function joins the sourceChannel to the targetChannel. + * However, each id in the targetChannel must be present in the + * sourceChannel. If _meta.join_id exists in the targetChannel, that is + * used as an id instead. If the id doesn't match any id in the sourceChannel, + * an error is thrown. + */ + +def safeJoin(targetChannel, sourceChannel, key) { + def sourceIDs = new IDChecker() + + def sourceCheck = sourceChannel + | map { tup -> + sourceIDs.observe(tup[0]) + tup + } + def targetCheck = targetChannel + | map { tup -> + def id = tup[0] + + if (!sourceIDs.contains(id)) { + error ( + "Error in module '${key}' when merging output with original state.\n" + + " Reason: output with id '${id}' could not be joined with source channel.\n" + + " If the IDs in the output channel differ from the input channel,\n" + + " please set `tup[1]._meta.join_id to the original ID.\n" + + " Original IDs in input channel: ['${sourceIDs.getItems().join("', '")}'].\n" + + " Unexpected ID in the output channel: '${id}'.\n" + + " Example input event: [\"id\", [input: file(...)]],\n" + + " Example output event: [\"newid\", [output: file(...), _meta: [join_id: \"id\"]]]" + ) + } + // TODO: add link to our documentation on how to fix this + + tup + } + + sourceCheck.cross(targetChannel) + | map{ left, right -> + right + left.drop(1) + } +} + +// helper file: 'src/main/resources/io/viash/runners/nextflow/config/_processArgument.nf' +def _processArgument(arg) { + arg.multiple = arg.multiple != null ? arg.multiple : false + arg.required = arg.required != null ? arg.required : false + arg.direction = arg.direction != null ? arg.direction : "input" + arg.multiple_sep = arg.multiple_sep != null ? arg.multiple_sep : ";" + arg.plainName = arg.name.replaceAll("^-*", "") + + if (arg.type == "file") { + arg.must_exist = arg.must_exist != null ? arg.must_exist : true + arg.create_parent = arg.create_parent != null ? arg.create_parent : true + } + + // add default values to output files which haven't already got a default + if (arg.type == "file" && arg.direction == "output" && arg.default == null) { + def mult = arg.multiple ? "_*" : "" + def extSearch = "" + if (arg.default != null) { + extSearch = arg.default + } else if (arg.example != null) { + extSearch = arg.example + } + if (extSearch instanceof List) { + extSearch = extSearch[0] + } + def extSearchResult = extSearch.find("\\.[^\\.]+\$") + def ext = extSearchResult != null ? extSearchResult : "" + arg.default = "\$id.\$key.${arg.plainName}${mult}${ext}" + if (arg.multiple) { + arg.default = [arg.default] + } + } + + if (!arg.multiple) { + if (arg.default != null && arg.default instanceof List) { + arg.default = arg.default[0] + } + if (arg.example != null && arg.example instanceof List) { + arg.example = arg.example[0] + } + } + + if (arg.type == "boolean_true") { + arg.default = false + } + if (arg.type == "boolean_false") { + arg.default = true + } + + arg +} + +// helper file: 'src/main/resources/io/viash/runners/nextflow/config/addGlobalParams.nf' +def addGlobalArguments(config) { + def localConfig = [ + "argument_groups": [ + [ + "name": "Nextflow input-output arguments", + "description": "Input/output parameters for Nextflow itself. Please note that both publishDir and publish_dir are supported but at least one has to be configured.", + "arguments" : [ + [ + 'name': '--publish_dir', + 'required': true, + 'type': 'string', + 'description': 'Path to an output directory.', + 'example': 'output/', + 'multiple': false + ], + [ + 'name': '--param_list', + 'required': false, + 'type': 'string', + 'description': '''Allows inputting multiple parameter sets to initialise a Nextflow channel. A `param_list` can either be a list of maps, a csv file, a json file, a yaml file, or simply a yaml blob. + | + |* A list of maps (as-is) where the keys of each map corresponds to the arguments of the pipeline. Example: in a `nextflow.config` file: `param_list: [ ['id': 'foo', 'input': 'foo.txt'], ['id': 'bar', 'input': 'bar.txt'] ]`. + |* A csv file should have column names which correspond to the different arguments of this pipeline. Example: `--param_list data.csv` with columns `id,input`. + |* A json or a yaml file should be a list of maps, each of which has keys corresponding to the arguments of the pipeline. Example: `--param_list data.json` with contents `[ {'id': 'foo', 'input': 'foo.txt'}, {'id': 'bar', 'input': 'bar.txt'} ]`. + |* A yaml blob can also be passed directly as a string. Example: `--param_list "[ {'id': 'foo', 'input': 'foo.txt'}, {'id': 'bar', 'input': 'bar.txt'} ]"`. + | + |When passing a csv, json or yaml file, relative path names are relativized to the location of the parameter file. No relativation is performed when `param_list` is a list of maps (as-is) or a yaml blob.'''.stripMargin(), + 'example': 'my_params.yaml', + 'multiple': false, + 'hidden': true + ] + // TODO: allow multiple: true in param_list? + // TODO: allow to specify a --param_list_regex to filter the param_list? + // TODO: allow to specify a --param_list_from_state to remap entries in the param_list? + ] + ] + ] + ] + + return processConfig(_mergeMap(config, localConfig)) +} + +def _mergeMap(Map lhs, Map rhs) { + return rhs.inject(lhs.clone()) { map, entry -> + if (map[entry.key] instanceof Map && entry.value instanceof Map) { + map[entry.key] = _mergeMap(map[entry.key], entry.value) + } else if (map[entry.key] instanceof Collection && entry.value instanceof Collection) { + map[entry.key] += entry.value + } else { + map[entry.key] = entry.value + } + return map + } +} + +// helper file: 'src/main/resources/io/viash/runners/nextflow/config/generateHelp.nf' +def _generateArgumentHelp(param) { + // alternatives are not supported + // def names = param.alternatives ::: List(param.name) + + def unnamedProps = [ + ["required parameter", param.required], + ["multiple values allowed", param.multiple], + ["output", param.direction.toLowerCase() == "output"], + ["file must exist", param.type == "file" && param.must_exist] + ].findAll{it[1]}.collect{it[0]} + + def dflt = null + if (param.default != null) { + if (param.default instanceof List) { + dflt = param.default.join(param.multiple_sep != null ? param.multiple_sep : ", ") + } else { + dflt = param.default.toString() + } + } + def example = null + if (param.example != null) { + if (param.example instanceof List) { + example = param.example.join(param.multiple_sep != null ? param.multiple_sep : ", ") + } else { + example = param.example.toString() + } + } + def min = param.min?.toString() + def max = param.max?.toString() + + def escapeChoice = { choice -> + def s1 = choice.replaceAll("\\n", "\\\\n") + def s2 = s1.replaceAll("\"", """\\\"""") + s2.contains(",") || s2 != choice ? "\"" + s2 + "\"" : s2 + } + def choices = param.choices == null ? + null : + "[ " + param.choices.collect{escapeChoice(it.toString())}.join(", ") + " ]" + + def namedPropsStr = [ + ["type", ([param.type] + unnamedProps).join(", ")], + ["default", dflt], + ["example", example], + ["choices", choices], + ["min", min], + ["max", max] + ] + .findAll{it[1]} + .collect{"\n " + it[0] + ": " + it[1].replaceAll("\n", "\\n")} + .join("") + + def descStr = param.description == null ? + "" : + _paragraphWrap("\n" + param.description.trim(), 80 - 8).join("\n ") + + "\n --" + param.plainName + + namedPropsStr + + descStr +} + +// Based on Helper.generateHelp() in Helper.scala +def _generateHelp(config) { + def fun = config + + // PART 1: NAME AND VERSION + def nameStr = fun.name + + (fun.version == null ? "" : " " + fun.version) + + // PART 2: DESCRIPTION + def descrStr = fun.description == null ? + "" : + "\n\n" + _paragraphWrap(fun.description.trim(), 80).join("\n") + + // PART 3: Usage + def usageStr = fun.usage == null ? + "" : + "\n\nUsage:\n" + fun.usage.trim() + + // PART 4: Options + def argGroupStrs = fun.allArgumentGroups.collect{argGroup -> + def name = argGroup.name + def descriptionStr = argGroup.description == null ? + "" : + "\n " + _paragraphWrap(argGroup.description.trim(), 80-4).join("\n ") + "\n" + def arguments = argGroup.arguments.collect{arg -> + arg instanceof String ? fun.allArguments.find{it.plainName == arg} : arg + }.findAll{it != null} + def argumentStrs = arguments.collect{param -> _generateArgumentHelp(param)} + + "\n\n$name:" + + descriptionStr + + argumentStrs.join("\n") + } + + // FINAL: combine + def out = nameStr + + descrStr + + usageStr + + argGroupStrs.join("") + + return out +} + +// based on Format._paragraphWrap +def _paragraphWrap(str, maxLength) { + def outLines = [] + str.split("\n").each{par -> + def words = par.split("\\s").toList() + + def word = null + def line = words.pop() + while(!words.isEmpty()) { + word = words.pop() + if (line.length() + word.length() + 1 <= maxLength) { + line = line + " " + word + } else { + outLines.add(line) + line = word + } + } + if (words.isEmpty()) { + outLines.add(line) + } + } + return outLines +} + +def helpMessage(config) { + if (params.containsKey("help") && params.help) { + def mergedConfig = addGlobalArguments(config) + def helpStr = _generateHelp(mergedConfig) + println(helpStr) + exit 0 + } +} + +// helper file: 'src/main/resources/io/viash/runners/nextflow/config/processConfig.nf' +def processConfig(config) { + // set defaults for arguments + config.arguments = + (config.arguments ?: []).collect{_processArgument(it)} + + // set defaults for argument_group arguments + config.argument_groups = + (config.argument_groups ?: []).collect{grp -> + grp.arguments = (grp.arguments ?: []).collect{_processArgument(it)} + grp + } + + // create combined arguments list + config.allArguments = + config.arguments + + config.argument_groups.collectMany{it.arguments} + + // add missing argument groups (based on Functionality::allArgumentGroups()) + def argGroups = config.argument_groups + if (argGroups.any{it.name.toLowerCase() == "arguments"}) { + argGroups = argGroups.collect{ grp -> + if (grp.name.toLowerCase() == "arguments") { + grp = grp + [ + arguments: grp.arguments + config.arguments + ] + } + grp + } + } else { + argGroups = argGroups + [ + name: "Arguments", + arguments: config.arguments + ] + } + config.allArgumentGroups = argGroups + + config +} + +// helper file: 'src/main/resources/io/viash/runners/nextflow/config/readConfig.nf' + +def readConfig(file) { + def config = readYaml(file ?: moduleDir.resolve("config.vsh.yaml")) + processConfig(config) +} + +// helper file: 'src/main/resources/io/viash/runners/nextflow/functions/_resolveSiblingIfNotAbsolute.nf' +/** + * Resolve a path relative to the current file. + * + * @param str The path to resolve, as a String. + * @param parentPath The path to resolve relative to, as a Path. + * + * @return The path that may have been resovled, as a Path. + */ +def _resolveSiblingIfNotAbsolute(str, parentPath) { + if (str !instanceof String) { + return str + } + if (!_stringIsAbsolutePath(str)) { + return parentPath.resolveSibling(str) + } else { + return file(str, hidden: true) + } +} + +// helper file: 'src/main/resources/io/viash/runners/nextflow/functions/_stringIsAbsolutePath.nf' +/** + * Check whether a path as a string is absolute. + * + * In the past, we tried using `file(., relative: true).isAbsolute()`, + * but the 'relative' option was added in 22.10.0. + * + * @param path The path to check, as a String. + * + * @return Whether the path is absolute, as a boolean. + */ +def _stringIsAbsolutePath(path) { + def _resolve_URL_PROTOCOL = ~/^([a-zA-Z][a-zA-Z0-9]*:)?\\/.+/ + + assert path instanceof String + return _resolve_URL_PROTOCOL.matcher(path).matches() +} + +// helper file: 'src/main/resources/io/viash/runners/nextflow/functions/collectTraces.nf' +class CustomTraceObserver implements nextflow.trace.TraceObserver { + List traces + + CustomTraceObserver(List traces) { + this.traces = traces + } + + @Override + void onProcessComplete(nextflow.processor.TaskHandler handler, nextflow.trace.TraceRecord trace) { + def trace2 = trace.store.clone() + trace2.script = null + traces.add(trace2) + } + + @Override + void onProcessCached(nextflow.processor.TaskHandler handler, nextflow.trace.TraceRecord trace) { + def trace2 = trace.store.clone() + trace2.script = null + traces.add(trace2) + } +} + +def collectTraces() { + def traces = Collections.synchronizedList([]) + + // add custom trace observer which stores traces in the traces object + session.observers.add(new CustomTraceObserver(traces)) + + traces +} + +// helper file: 'src/main/resources/io/viash/runners/nextflow/functions/deepClone.nf' +/** + * Performs a deep clone of the given object. + * @param x an object + */ +def deepClone(x) { + iterateMap(x, {it instanceof Cloneable ? it.clone() : it}) +} +// helper file: 'src/main/resources/io/viash/runners/nextflow/functions/getPublishDir.nf' +def getPublishDir() { + return params.containsKey("publish_dir") ? params.publish_dir : + params.containsKey("publishDir") ? params.publishDir : + null +} + +// helper file: 'src/main/resources/io/viash/runners/nextflow/functions/getRootDir.nf' + +// Recurse upwards until we find a '.build.yaml' file +def _findBuildYamlFile(pathPossiblySymlink) { + def path = pathPossiblySymlink.toRealPath() + def child = path.resolve(".build.yaml") + if (java.nio.file.Files.isDirectory(path) && java.nio.file.Files.exists(child)) { + return child + } else { + def parent = path.getParent() + if (parent == null) { + return null + } else { + return _findBuildYamlFile(parent) + } + } +} + +// get the root of the target folder +def getRootDir() { + def dir = _findBuildYamlFile(meta.resources_dir) + assert dir != null: "Could not find .build.yaml in the folder structure" + dir.getParent() +} + +// helper file: 'src/main/resources/io/viash/runners/nextflow/functions/iterateMap.nf' +/** + * Recursively apply a function over the leaves of an object. + * @param obj The object to iterate over. + * @param fun The function to apply to each value. + * @return The object with the function applied to each value. + */ +def iterateMap(obj, fun) { + if (obj instanceof List && obj !instanceof String) { + return obj.collect{item -> + iterateMap(item, fun) + } + } else if (obj instanceof Map) { + return obj.collectEntries{key, item -> + [key.toString(), iterateMap(item, fun)] + } + } else { + return fun(obj) + } +} + +// helper file: 'src/main/resources/io/viash/runners/nextflow/functions/niceView.nf' +/** + * A view for printing the event of each channel as a YAML blob. + * This is useful for debugging. + */ +def niceView() { + workflow niceViewWf { + take: input + main: + output = input + | view{toYamlBlob(it)} + emit: output + } + return niceViewWf +} + +// helper file: 'src/main/resources/io/viash/runners/nextflow/readwrite/readCsv.nf' + +def readCsv(file_path) { + def output = [] + def inputFile = file_path !instanceof Path ? file(file_path, hidden: true) : file_path + + // todo: allow escaped quotes in string + // todo: allow single quotes? + def splitRegex = java.util.regex.Pattern.compile(''',(?=(?:[^"]*"[^"]*")*[^"]*$)''') + def removeQuote = java.util.regex.Pattern.compile('''"(.*)"''') + + java.nio.file.Files.newBufferedReader(inputFile).withCloseable { br -> + def row = 0 + def header = null + def line + + while (header == null && (line = br.readLine()) != null) { + if (!line.startsWith("#")) { + header = splitRegex.split(line, -1).collect { field -> + def m = removeQuote.matcher(field) + m.find() ? m.replaceFirst('$1') : field + } + } + row++ + } + assert header != null : "CSV file should contain a header" + + while ((line = br.readLine()) != null) { + row++ + if (!line.startsWith("#")) { + def predata = splitRegex.split(line, -1) + def data = predata.collect { field -> + if (field == "") { + return null + } + def m = removeQuote.matcher(field) + if (m.find()) { + return m.replaceFirst('$1') + } else { + return field + } + } + assert header.size() == data.size() : "Row $row should contain the same number as fields as the header" + + def dataMap = [header, data].transpose().collectEntries().findAll { it.value != null } + output.add(dataMap) + } + } + } + + output +} + +// helper file: 'src/main/resources/io/viash/runners/nextflow/readwrite/readJson.nf' +def readJson(file_path) { + def inputFile = file_path !instanceof Path ? file(file_path, hidden: true) : file_path + def jsonSlurper = new groovy.json.JsonSlurper() + jsonSlurper.parse(inputFile) +} + +// helper file: 'src/main/resources/io/viash/runners/nextflow/readwrite/readJsonBlob.nf' +def readJsonBlob(str) { + def jsonSlurper = new groovy.json.JsonSlurper() + jsonSlurper.parseText(str) +} + +// helper file: 'src/main/resources/io/viash/runners/nextflow/readwrite/readTaggedYaml.nf' +// Custom constructor to modify how certain objects are parsed from YAML +class CustomConstructor extends org.yaml.snakeyaml.constructor.Constructor { + Path root + + class ConstructPath extends org.yaml.snakeyaml.constructor.AbstractConstruct { + public Object construct(org.yaml.snakeyaml.nodes.Node node) { + String filename = (String) constructScalar(node); + if (root != null) { + return root.resolve(filename); + } + return java.nio.file.Paths.get(filename); + } + } + + CustomConstructor(org.yaml.snakeyaml.LoaderOptions options, Path root) { + super(options) + this.root = root + // Handling !file tag and parse it back to a File type + this.yamlConstructors.put(new org.yaml.snakeyaml.nodes.Tag("!file"), new ConstructPath()) + } +} + +def readTaggedYaml(Path path) { + def options = new org.yaml.snakeyaml.LoaderOptions() + def constructor = new CustomConstructor(options, path.getParent()) + def yaml = new org.yaml.snakeyaml.Yaml(constructor) + return yaml.load(path.text) +} + +// helper file: 'src/main/resources/io/viash/runners/nextflow/readwrite/readYaml.nf' +def readYaml(file_path) { + def inputFile = file_path !instanceof Path ? file(file_path, hidden: true) : file_path + def yamlSlurper = new org.yaml.snakeyaml.Yaml() + yamlSlurper.load(inputFile) +} + +// helper file: 'src/main/resources/io/viash/runners/nextflow/readwrite/readYamlBlob.nf' +def readYamlBlob(str) { + def yamlSlurper = new org.yaml.snakeyaml.Yaml() + yamlSlurper.load(str) +} + +// helper file: 'src/main/resources/io/viash/runners/nextflow/readwrite/toJsonBlob.nf' +String toJsonBlob(data) { + return groovy.json.JsonOutput.toJson(data) +} + +// helper file: 'src/main/resources/io/viash/runners/nextflow/readwrite/toTaggedYamlBlob.nf' +// Custom representer to modify how certain objects are represented in YAML +class CustomRepresenter extends org.yaml.snakeyaml.representer.Representer { + Path relativizer + + class RepresentPath implements org.yaml.snakeyaml.representer.Represent { + public String getFileName(Object obj) { + if (obj instanceof File) { + obj = ((File) obj).toPath(); + } + if (obj !instanceof Path) { + throw new IllegalArgumentException("Object: " + obj + " is not a Path or File"); + } + def path = (Path) obj; + + if (relativizer != null) { + return relativizer.relativize(path).toString() + } else { + return path.toString() + } + } + + public org.yaml.snakeyaml.nodes.Node representData(Object data) { + String filename = getFileName(data); + def tag = new org.yaml.snakeyaml.nodes.Tag("!file"); + return representScalar(tag, filename); + } + } + CustomRepresenter(org.yaml.snakeyaml.DumperOptions options, Path relativizer) { + super(options) + this.relativizer = relativizer + this.representers.put(sun.nio.fs.UnixPath, new RepresentPath()) + this.representers.put(Path, new RepresentPath()) + this.representers.put(File, new RepresentPath()) + } +} + +String toTaggedYamlBlob(data) { + return toRelativeTaggedYamlBlob(data, null) +} +String toRelativeTaggedYamlBlob(data, Path relativizer) { + def options = new org.yaml.snakeyaml.DumperOptions() + options.setDefaultFlowStyle(org.yaml.snakeyaml.DumperOptions.FlowStyle.BLOCK) + def representer = new CustomRepresenter(options, relativizer) + def yaml = new org.yaml.snakeyaml.Yaml(representer, options) + return yaml.dump(data) +} + +// helper file: 'src/main/resources/io/viash/runners/nextflow/readwrite/toYamlBlob.nf' +String toYamlBlob(data) { + def options = new org.yaml.snakeyaml.DumperOptions() + options.setDefaultFlowStyle(org.yaml.snakeyaml.DumperOptions.FlowStyle.BLOCK) + options.setPrettyFlow(true) + def yaml = new org.yaml.snakeyaml.Yaml(options) + def cleanData = iterateMap(data, { it instanceof Path ? it.toString() : it }) + return yaml.dump(cleanData) +} + +// helper file: 'src/main/resources/io/viash/runners/nextflow/readwrite/writeJson.nf' +void writeJson(data, file) { + assert data: "writeJson: data should not be null" + assert file: "writeJson: file should not be null" + file.write(toJsonBlob(data)) +} + +// helper file: 'src/main/resources/io/viash/runners/nextflow/readwrite/writeYaml.nf' +void writeYaml(data, file) { + assert data: "writeYaml: data should not be null" + assert file: "writeYaml: file should not be null" + file.write(toYamlBlob(data)) +} + +// helper file: 'src/main/resources/io/viash/runners/nextflow/states/findStates.nf' +def findStates(Map params, Map config) { + def auto_config = deepClone(config) + def auto_params = deepClone(params) + + auto_config = auto_config.clone() + // override arguments + auto_config.argument_groups = [] + auto_config.arguments = [ + [ + type: "string", + name: "--id", + description: "A dummy identifier", + required: false + ], + [ + type: "file", + name: "--input_states", + example: "/path/to/input/directory/**/state.yaml", + description: "Path to input directory containing the datasets to be integrated.", + required: true, + multiple: true, + multiple_sep: ";" + ], + [ + type: "string", + name: "--filter", + example: "foo/.*/state.yaml", + description: "Regex to filter state files by path.", + required: false + ], + // to do: make this a yaml blob? + [ + type: "string", + name: "--rename_keys", + example: ["newKey1:oldKey1", "newKey2:oldKey2"], + description: "Rename keys in the detected input files. This is useful if the input files do not match the set of input arguments of the workflow.", + required: false, + multiple: true, + multiple_sep: ";" + ], + [ + type: "string", + name: "--settings", + example: '{"output_dataset": "dataset.h5ad", "k": 10}', + description: "Global arguments as a JSON glob to be passed to all components.", + required: false + ] + ] + if (!(auto_params.containsKey("id"))) { + auto_params["id"] = "auto" + } + + // run auto config through processConfig once more + auto_config = processConfig(auto_config) + + workflow findStatesWf { + helpMessage(auto_config) + + output_ch = + channelFromParams(auto_params, auto_config) + | flatMap { autoId, args -> + + def globalSettings = args.settings ? readYamlBlob(args.settings) : [:] + + // look for state files in input dir + def stateFiles = args.input_states + + // filter state files by regex + if (args.filter) { + stateFiles = stateFiles.findAll{ stateFile -> + def stateFileStr = stateFile.toString() + def matcher = stateFileStr =~ args.filter + matcher.matches()} + } + + // read in states + def states = stateFiles.collect { stateFile -> + def state_ = readTaggedYaml(stateFile) + [state_.id, state_] + } + + // construct renameMap + if (args.rename_keys) { + def renameMap = args.rename_keys.collectEntries{renameString -> + def split = renameString.split(":") + assert split.size() == 2: "Argument 'rename_keys' should be of the form 'newKey:oldKey', or 'newKey:oldKey;newKey:oldKey' in case of multiple values" + split + } + + // rename keys in state, only let states through which have all keys + // also add global settings + states = states.collectMany{id, state -> + def newState = [:] + + for (key in renameMap.keySet()) { + def origKey = renameMap[key] + if (!(state.containsKey(origKey))) { + return [] + } + newState[key] = state[origKey] + } + + [[id, globalSettings + newState]] + } + } + + states + } + emit: + output_ch + } + + return findStatesWf +} + +// helper file: 'src/main/resources/io/viash/runners/nextflow/states/joinStates.nf' +def joinStates(Closure apply_) { + workflow joinStatesWf { + take: input_ch + main: + output_ch = input_ch + | toSortedList + | filter{ it.size() > 0 } + | map{ tups -> + def ids = tups.collect{it[0]} + def states = tups.collect{it[1]} + apply_(ids, states) + } + + emit: output_ch + } + return joinStatesWf +} +// helper file: 'src/main/resources/io/viash/runners/nextflow/states/publishFiles.nf' +def publishFiles(Map args) { + def key_ = args.get("key") + + assert key_ != null : "publishFiles: key must be specified" + + workflow publishFilesWf { + take: input_ch + main: + input_ch + | map { tup -> + def id_ = tup[0] + def state_ = tup[1] + + // the input files and the target output filenames + def inputoutputFilenames_ = collectInputOutputPaths(state_, id_ + "." + key_).transpose() + def inputFiles_ = inputoutputFilenames_[0] + def outputFilenames_ = inputoutputFilenames_[1] + + [id_, inputFiles_, outputFilenames_] + } + | publishFilesProc + emit: input_ch + } + return publishFilesWf +} + +process publishFilesProc { + // todo: check publishpath? + publishDir path: "${getPublishDir()}/", mode: "copy" + tag "$id" + input: + tuple val(id), path(inputFiles, stageAs: "_inputfile?/*"), val(outputFiles) + output: + tuple val(id), path{outputFiles} + script: + def copyCommands = [ + inputFiles instanceof List ? inputFiles : [inputFiles], + outputFiles instanceof List ? outputFiles : [outputFiles] + ] + .transpose() + .collectMany{infile, outfile -> + def infileString = infile.toString() + def outfileString = outfile.toString() + if (infileString != outfileString) { + /* Trailing slashes are removed from both the source and destination arguments. + From source arguments, this is useful when a source argument may have a trailing slash + and specify a symbolic link to a directory. Without removing the slash, cp will dereference + the symbolic link. + See https://www.gnu.org/software/coreutils/manual/html_node/Trailing-slashes.html#Trailing-slashes-1 + + For the destination path addding a trailing slash is a problem when publishing directories: + it requires the destination directory to exist. This fails because we only create the parent + directories first. + */ + def regexTrailingSlashes = ~/\/+$/ + def infileNoTrailingSlash = infileString - regexTrailingSlashes + def outfileNoTrailingSlash = outfileString - regexTrailingSlashes + [ + "[ -d \"\$(dirname '${outfileNoTrailingSlash}')\" ] || mkdir -p \"\$(dirname '${outfileNoTrailingSlash}')\"", + "cp -a '${infileNoTrailingSlash}' '${outfileNoTrailingSlash}'" + ] + } else { + // no need to copy if infile is the same as outfile + [] + } + } + """ + echo "Copying output files to destination folder" + ${copyCommands.join("\n ")} + """ +} + + +// this assumes that the state contains no other values other than those specified in the config +def publishFilesByConfig(Map args) { + def config = args.get("config") + assert config != null : "publishFilesByConfig: config must be specified" + + def key_ = args.get("key", config.name) + assert key_ != null : "publishFilesByConfig: key must be specified" + + workflow publishFilesSimpleWf { + take: input_ch + main: + input_ch + | map { tup -> + def id_ = tup[0] + def state_ = tup[1] // e.g. [output: new File("myoutput.h5ad"), k: 10] + def origState_ = tup[2] // e.g. [output: '$id.$key.foo.h5ad'] + + + // the processed state is a list of [key, value, inputPath, outputFilename] tuples, where + // - key is a String + // - value is any object that can be serialized to a Yaml (so a String/Integer/Long/Double/Boolean, a List, a Map, or a Path) + // - inputPath is a List[Path] + // - outputFilename is a List[String] + // - (inputPath, outputFilename) are the files that will be copied from src to dest (relative to the state.yaml) + def processedState = + config.allArguments + .findAll { it.direction == "output" } + .collectMany { par -> + def plainName_ = par.plainName + // if the state does not contain the key, it's an + // optional argument for which the component did + // not generate any output OR multiple channels were emitted + // and the output was just not added to using the channel + // that is now being parsed + if (!state_.containsKey(plainName_)) { + return [] + } + def value = state_[plainName_] + // if the parameter is not a file, it should be stored + // in the state as-is, but is not something that needs + // to be copied from the source path to the dest path + if (par.type != "file") { + return [[inputPath: [], outputFilename: []]] + } + // if the orig state does not contain this filename, + // it's an optional argument for which the user specified + // that it should not be returned as a state + if (!origState_.containsKey(plainName_)) { + return [] + } + def filenameTemplate = origState_[plainName_] + // if the pararameter is multiple: true, fetch the template + if (par.multiple && filenameTemplate instanceof List) { + filenameTemplate = filenameTemplate[0] + } + // instantiate the template + def filename = filenameTemplate + .replaceAll('\\$id', id_) + .replaceAll('\\$\\{id\\}', id_) + .replaceAll('\\$key', key_) + .replaceAll('\\$\\{key\\}', key_) + if (par.multiple) { + // if the parameter is multiple: true, the filename + // should contain a wildcard '*' that is replaced with + // the index of the file + assert filename.contains("*") : "Module '${key_}' id '${id_}': Multiple output files specified, but no wildcard '*' in the filename: ${filename}" + def outputPerFile = value.withIndex().collect{ val, ix -> + def filename_ix = filename.replace("*", ix.toString()) + def inputPath = val instanceof File ? val.toPath() : val + [inputPath: inputPath, outputFilename: filename_ix] + } + def transposedOutputs = ["inputPath", "outputFilename"].collectEntries{ key -> + [key, outputPerFile.collect{dic -> dic[key]}] + } + return [[key: plainName_] + transposedOutputs] + } else { + def value_ = java.nio.file.Paths.get(filename) + def inputPath = value instanceof File ? value.toPath() : value + return [[inputPath: [inputPath], outputFilename: [filename]]] + } + } + + def inputPaths = processedState.collectMany{it.inputPath} + def outputFilenames = processedState.collectMany{it.outputFilename} + + + [id_, inputPaths, outputFilenames] + } + | publishFilesProc + emit: input_ch + } + return publishFilesSimpleWf +} + + + + +// helper file: 'src/main/resources/io/viash/runners/nextflow/states/publishStates.nf' +def collectFiles(obj) { + if (obj instanceof java.io.File || obj instanceof Path) { + return [obj] + } else if (obj instanceof List && obj !instanceof String) { + return obj.collectMany{item -> + collectFiles(item) + } + } else if (obj instanceof Map) { + return obj.collectMany{key, item -> + collectFiles(item) + } + } else { + return [] + } +} + +/** + * Recurse through a state and collect all input files and their target output filenames. + * @param obj The state to recurse through. + * @param prefix The prefix to prepend to the output filenames. + */ +def collectInputOutputPaths(obj, prefix) { + if (obj instanceof File || obj instanceof Path) { + def path = obj instanceof Path ? obj : obj.toPath() + def ext = path.getFileName().toString().find("\\.[^\\.]+\$") ?: "" + def newFilename = prefix + ext + return [[obj, newFilename]] + } else if (obj instanceof List && obj !instanceof String) { + return obj.withIndex().collectMany{item, ix -> + collectInputOutputPaths(item, prefix + "_" + ix) + } + } else if (obj instanceof Map) { + return obj.collectMany{key, item -> + collectInputOutputPaths(item, prefix + "." + key) + } + } else { + return [] + } +} + +def publishStates(Map args) { + def key_ = args.get("key") + def yamlTemplate_ = args.get("output_state", args.get("outputState", '$id.$key.state.yaml')) + + assert key_ != null : "publishStates: key must be specified" + + workflow publishStatesWf { + take: input_ch + main: + input_ch + | map { tup -> + def id_ = tup[0] + def state_ = tup[1] + + // the input files and the target output filenames + def inputoutputFilenames_ = collectInputOutputPaths(state_, id_ + "." + key_).transpose() + + def yamlFilename = yamlTemplate_ + .replaceAll('\\$id', id_) + .replaceAll('\\$\\{id\\}', id_) + .replaceAll('\\$key', key_) + .replaceAll('\\$\\{key\\}', key_) + + // TODO: do the pathnames in state_ match up with the outputFilenames_? + + // convert state to yaml blob + def yamlBlob_ = toRelativeTaggedYamlBlob([id: id_] + state_, java.nio.file.Paths.get(yamlFilename)) + + [id_, yamlBlob_, yamlFilename] + } + | publishStatesProc + emit: input_ch + } + return publishStatesWf +} +process publishStatesProc { + // todo: check publishpath? + publishDir path: "${getPublishDir()}/", mode: "copy" + tag "$id" + input: + tuple val(id), val(yamlBlob), val(yamlFile) + output: + tuple val(id), path{[yamlFile]} + script: + """ + mkdir -p "\$(dirname '${yamlFile}')" + echo "Storing state as yaml" + cat > '${yamlFile}' << HERE +${yamlBlob} +HERE + """ +} + + +// this assumes that the state contains no other values other than those specified in the config +def publishStatesByConfig(Map args) { + def config = args.get("config") + assert config != null : "publishStatesByConfig: config must be specified" + + def key_ = args.get("key", config.name) + assert key_ != null : "publishStatesByConfig: key must be specified" + + workflow publishStatesSimpleWf { + take: input_ch + main: + input_ch + | map { tup -> + def id_ = tup[0] + def state_ = tup[1] // e.g. [output: new File("myoutput.h5ad"), k: 10] + def origState_ = tup[2] // e.g. [output: '$id.$key.foo.h5ad'] + + // TODO: allow overriding the state.yaml template + // TODO TODO: if auto.publish == "state", add output_state as an argument + def yamlTemplate = params.containsKey("output_state") ? params.output_state : '$id.$key.state.yaml' + def yamlFilename = yamlTemplate + .replaceAll('\\$id', id_) + .replaceAll('\\$\\{id\\}', id_) + .replaceAll('\\$key', key_) + .replaceAll('\\$\\{key\\}', key_) + def yamlDir = java.nio.file.Paths.get(yamlFilename).getParent() + + // the processed state is a list of [key, value] tuples, where + // - key is a String + // - value is any object that can be serialized to a Yaml (so a String/Integer/Long/Double/Boolean, a List, a Map, or a Path) + // - (key, value) are the tuples that will be saved to the state.yaml file + def processedState = + config.allArguments + .findAll { it.direction == "output" } + .collectMany { par -> + def plainName_ = par.plainName + // if the state does not contain the key, it's an + // optional argument for which the component did + // not generate any output + if (!state_.containsKey(plainName_)) { + return [] + } + def value = state_[plainName_] + // if the parameter is not a file, it should be stored + // in the state as-is, but is not something that needs + // to be copied from the source path to the dest path + if (par.type != "file") { + return [[key: plainName_, value: value]] + } + // if the orig state does not contain this filename, + // it's an optional argument for which the user specified + // that it should not be returned as a state + if (!origState_.containsKey(plainName_)) { + return [] + } + def filenameTemplate = origState_[plainName_] + // if the pararameter is multiple: true, fetch the template + if (par.multiple && filenameTemplate instanceof List) { + filenameTemplate = filenameTemplate[0] + } + // instantiate the template + def filename = filenameTemplate + .replaceAll('\\$id', id_) + .replaceAll('\\$\\{id\\}', id_) + .replaceAll('\\$key', key_) + .replaceAll('\\$\\{key\\}', key_) + if (par.multiple) { + // if the parameter is multiple: true, the filename + // should contain a wildcard '*' that is replaced with + // the index of the file + assert filename.contains("*") : "Module '${key_}' id '${id_}': Multiple output files specified, but no wildcard '*' in the filename: ${filename}" + def outputPerFile = value.withIndex().collect{ val, ix -> + def filename_ix = filename.replace("*", ix.toString()) + def value_ = java.nio.file.Paths.get(filename_ix) + // if id contains a slash + if (yamlDir != null) { + value_ = yamlDir.relativize(value_) + } + return value_ + } + return [["key": plainName_, "value": outputPerFile]] + } else { + def value_ = java.nio.file.Paths.get(filename) + // if id contains a slash + if (yamlDir != null) { + value_ = yamlDir.relativize(value_) + } + def inputPath = value instanceof File ? value.toPath() : value + return [["key": plainName_, value: value_]] + } + } + + + def updatedState_ = processedState.collectEntries{[it.key, it.value]} + + // convert state to yaml blob + def yamlBlob_ = toTaggedYamlBlob([id: id_] + updatedState_) + + [id_, yamlBlob_, yamlFilename] + } + | publishStatesProc + emit: input_ch + } + return publishStatesSimpleWf +} + +// helper file: 'src/main/resources/io/viash/runners/nextflow/states/setState.nf' +def setState(fun) { + assert fun instanceof Closure || fun instanceof Map || fun instanceof List : + "Error in setState: Expected process argument to be a Closure, a Map, or a List. Found: class ${fun.getClass()}" + + // if fun is a List, convert to map + if (fun instanceof List) { + // check whether fun is a list[string] + assert fun.every{it instanceof CharSequence} : "Error in setState: argument is a List, but not all elements are Strings" + fun = fun.collectEntries{[it, it]} + } + + // if fun is a map, convert to closure + if (fun instanceof Map) { + // check whether fun is a map[string, string] + assert fun.values().every{it instanceof CharSequence} : "Error in setState: argument is a Map, but not all values are Strings" + assert fun.keySet().every{it instanceof CharSequence} : "Error in setState: argument is a Map, but not all keys are Strings" + def funMap = fun.clone() + // turn the map into a closure to be used later on + fun = { id_, state_ -> + assert state_ instanceof Map : "Error in setState: the state is not a Map" + funMap.collectMany{newkey, origkey -> + if (state_.containsKey(origkey)) { + [[newkey, state_[origkey]]] + } else { + [] + } + }.collectEntries() + } + } + + map { tup -> + def id = tup[0] + def state = tup[1] + def unfilteredState = fun(id, state) + def newState = unfilteredState.findAll{key, val -> val != null} + [id, newState] + tup.drop(2) + } +} + +// helper file: 'src/main/resources/io/viash/runners/nextflow/workflowFactory/processAuto.nf' +// TODO: unit test processAuto +def processAuto(Map auto) { + // remove null values + auto = auto.findAll{k, v -> v != null} + + // check for unexpected keys + def expectedKeys = ["simplifyInput", "simplifyOutput", "transcript", "publish"] + def unexpectedKeys = auto.keySet() - expectedKeys + assert unexpectedKeys.isEmpty(), "unexpected keys in auto: '${unexpectedKeys.join("', '")}'" + + // check auto.simplifyInput + assert auto.simplifyInput instanceof Boolean, "auto.simplifyInput must be a boolean" + + // check auto.simplifyOutput + assert auto.simplifyOutput instanceof Boolean, "auto.simplifyOutput must be a boolean" + + // check auto.transcript + assert auto.transcript instanceof Boolean, "auto.transcript must be a boolean" + + // check auto.publish + assert auto.publish instanceof Boolean || auto.publish == "state", "auto.publish must be a boolean or 'state'" + + return auto.subMap(expectedKeys) +} + +// helper file: 'src/main/resources/io/viash/runners/nextflow/workflowFactory/processDirectives.nf' +def assertMapKeys(map, expectedKeys, requiredKeys, mapName) { + assert map instanceof Map : "Expected argument '$mapName' to be a Map. Found: class ${map.getClass()}" + map.forEach { key, val -> + assert key in expectedKeys : "Unexpected key '$key' in ${mapName ? mapName + " " : ""}map" + } + requiredKeys.forEach { requiredKey -> + assert map.containsKey(requiredKey) : "Missing required key '$key' in ${mapName ? mapName + " " : ""}map" + } +} + +// TODO: unit test processDirectives +def processDirectives(Map drctv) { + // remove null values + drctv = drctv.findAll{k, v -> v != null} + + // check for unexpected keys + def expectedKeys = [ + "accelerator", "afterScript", "beforeScript", "cache", "conda", "container", "containerOptions", "cpus", "disk", "echo", "errorStrategy", "executor", "machineType", "maxErrors", "maxForks", "maxRetries", "memory", "module", "penv", "pod", "publishDir", "queue", "label", "scratch", "storeDir", "stageInMode", "stageOutMode", "tag", "time" + ] + def unexpectedKeys = drctv.keySet() - expectedKeys + assert unexpectedKeys.isEmpty() : "Unexpected keys in process directive: '${unexpectedKeys.join("', '")}'" + + /* DIRECTIVE accelerator + accepted examples: + - [ limit: 4, type: "nvidia-tesla-k80" ] + */ + if (drctv.containsKey("accelerator")) { + assertMapKeys(drctv["accelerator"], ["type", "limit", "request", "runtime"], [], "accelerator") + } + + /* DIRECTIVE afterScript + accepted examples: + - "source /cluster/bin/cleanup" + */ + if (drctv.containsKey("afterScript")) { + assert drctv["afterScript"] instanceof CharSequence + } + + /* DIRECTIVE beforeScript + accepted examples: + - "source /cluster/bin/setup" + */ + if (drctv.containsKey("beforeScript")) { + assert drctv["beforeScript"] instanceof CharSequence + } + + /* DIRECTIVE cache + accepted examples: + - true + - false + - "deep" + - "lenient" + */ + if (drctv.containsKey("cache")) { + assert drctv["cache"] instanceof CharSequence || drctv["cache"] instanceof Boolean + if (drctv["cache"] instanceof CharSequence) { + assert drctv["cache"] in ["deep", "lenient"] : "Unexpected value for cache" + } + } + + /* DIRECTIVE conda + accepted examples: + - "bwa=0.7.15" + - "bwa=0.7.15 fastqc=0.11.5" + - ["bwa=0.7.15", "fastqc=0.11.5"] + */ + if (drctv.containsKey("conda")) { + if (drctv["conda"] instanceof List) { + drctv["conda"] = drctv["conda"].join(" ") + } + assert drctv["conda"] instanceof CharSequence + } + + /* DIRECTIVE container + accepted examples: + - "foo/bar:tag" + - [ registry: "reg", image: "im", tag: "ta" ] + is transformed to "reg/im:ta" + - [ image: "im" ] + is transformed to "im:latest" + */ + if (drctv.containsKey("container")) { + assert drctv["container"] instanceof Map || drctv["container"] instanceof CharSequence + if (drctv["container"] instanceof Map) { + def m = drctv["container"] + assertMapKeys(m, [ "registry", "image", "tag" ], ["image"], "container") + def part1 = + System.getenv('OVERRIDE_CONTAINER_REGISTRY') ? System.getenv('OVERRIDE_CONTAINER_REGISTRY') + "/" : + params.containsKey("override_container_registry") ? params["override_container_registry"] + "/" : // todo: remove? + m.registry ? m.registry + "/" : + "" + def part2 = m.image + def part3 = m.tag ? ":" + m.tag : ":latest" + drctv["container"] = part1 + part2 + part3 + } + } + + /* DIRECTIVE containerOptions + accepted examples: + - "--foo bar" + - ["--foo bar", "-f b"] + */ + if (drctv.containsKey("containerOptions")) { + if (drctv["containerOptions"] instanceof List) { + drctv["containerOptions"] = drctv["containerOptions"].join(" ") + } + assert drctv["containerOptions"] instanceof CharSequence + } + + /* DIRECTIVE cpus + accepted examples: + - 1 + - 10 + */ + if (drctv.containsKey("cpus")) { + assert drctv["cpus"] instanceof Integer + } + + /* DIRECTIVE disk + accepted examples: + - "1 GB" + - "2TB" + - "3.2KB" + - "10.B" + */ + if (drctv.containsKey("disk")) { + assert drctv["disk"] instanceof CharSequence + // assert drctv["disk"].matches("[0-9]+(\\.[0-9]*)? *[KMGTPEZY]?B") + // ^ does not allow closures + } + + /* DIRECTIVE echo + accepted examples: + - true + - false + */ + if (drctv.containsKey("echo")) { + assert drctv["echo"] instanceof Boolean + } + + /* DIRECTIVE errorStrategy + accepted examples: + - "terminate" + - "finish" + */ + if (drctv.containsKey("errorStrategy")) { + assert drctv["errorStrategy"] instanceof CharSequence + assert drctv["errorStrategy"] in ["terminate", "finish", "ignore", "retry"] : "Unexpected value for errorStrategy" + } + + /* DIRECTIVE executor + accepted examples: + - "local" + - "sge" + */ + if (drctv.containsKey("executor")) { + assert drctv["executor"] instanceof CharSequence + assert drctv["executor"] in ["local", "sge", "uge", "lsf", "slurm", "pbs", "pbspro", "moab", "condor", "nqsii", "ignite", "k8s", "awsbatch", "google-pipelines"] : "Unexpected value for executor" + } + + /* DIRECTIVE machineType + accepted examples: + - "n1-highmem-8" + */ + if (drctv.containsKey("machineType")) { + assert drctv["machineType"] instanceof CharSequence + } + + /* DIRECTIVE maxErrors + accepted examples: + - 1 + - 3 + */ + if (drctv.containsKey("maxErrors")) { + assert drctv["maxErrors"] instanceof Integer + } + + /* DIRECTIVE maxForks + accepted examples: + - 1 + - 3 + */ + if (drctv.containsKey("maxForks")) { + assert drctv["maxForks"] instanceof Integer + } + + /* DIRECTIVE maxRetries + accepted examples: + - 1 + - 3 + */ + if (drctv.containsKey("maxRetries")) { + assert drctv["maxRetries"] instanceof Integer + } + + /* DIRECTIVE memory + accepted examples: + - "1 GB" + - "2TB" + - "3.2KB" + - "10.B" + */ + if (drctv.containsKey("memory")) { + assert drctv["memory"] instanceof CharSequence + // assert drctv["memory"].matches("[0-9]+(\\.[0-9]*)? *[KMGTPEZY]?B") + // ^ does not allow closures + } + + /* DIRECTIVE module + accepted examples: + - "ncbi-blast/2.2.27" + - "ncbi-blast/2.2.27:t_coffee/10.0" + - ["ncbi-blast/2.2.27", "t_coffee/10.0"] + */ + if (drctv.containsKey("module")) { + if (drctv["module"] instanceof List) { + drctv["module"] = drctv["module"].join(":") + } + assert drctv["module"] instanceof CharSequence + } + + /* DIRECTIVE penv + accepted examples: + - "smp" + */ + if (drctv.containsKey("penv")) { + assert drctv["penv"] instanceof CharSequence + } + + /* DIRECTIVE pod + accepted examples: + - [ label: "key", value: "val" ] + - [ annotation: "key", value: "val" ] + - [ env: "key", value: "val" ] + - [ [label: "l", value: "v"], [env: "e", value: "v"]] + */ + if (drctv.containsKey("pod")) { + if (drctv["pod"] instanceof Map) { + drctv["pod"] = [ drctv["pod"] ] + } + assert drctv["pod"] instanceof List + drctv["pod"].forEach { pod -> + assert pod instanceof Map + // TODO: should more checks be added? + // See https://www.nextflow.io/docs/latest/process.html?highlight=directives#pod + // e.g. does it contain 'label' and 'value', or 'annotation' and 'value', or ...? + } + } + + /* DIRECTIVE publishDir + accepted examples: + - [] + - [ [ path: "foo", enabled: true ], [ path: "bar", enabled: false ] ] + - "/path/to/dir" + is transformed to [[ path: "/path/to/dir" ]] + - [ path: "/path/to/dir", mode: "cache" ] + is transformed to [[ path: "/path/to/dir", mode: "cache" ]] + */ + // TODO: should we also look at params["publishDir"]? + if (drctv.containsKey("publishDir")) { + def pblsh = drctv["publishDir"] + + // check different options + assert pblsh instanceof List || pblsh instanceof Map || pblsh instanceof CharSequence + + // turn into list if not already so + // for some reason, 'if (!pblsh instanceof List) pblsh = [ pblsh ]' doesn't work. + pblsh = pblsh instanceof List ? pblsh : [ pblsh ] + + // check elements of publishDir + pblsh = pblsh.collect{ elem -> + // turn into map if not already so + elem = elem instanceof CharSequence ? [ path: elem ] : elem + + // check types and keys + assert elem instanceof Map : "Expected publish argument '$elem' to be a String or a Map. Found: class ${elem.getClass()}" + assertMapKeys(elem, [ "path", "mode", "overwrite", "pattern", "saveAs", "enabled" ], ["path"], "publishDir") + + // check elements in map + assert elem.containsKey("path") + assert elem["path"] instanceof CharSequence + if (elem.containsKey("mode")) { + assert elem["mode"] instanceof CharSequence + assert elem["mode"] in [ "symlink", "rellink", "link", "copy", "copyNoFollow", "move" ] + } + if (elem.containsKey("overwrite")) { + assert elem["overwrite"] instanceof Boolean + } + if (elem.containsKey("pattern")) { + assert elem["pattern"] instanceof CharSequence + } + if (elem.containsKey("saveAs")) { + assert elem["saveAs"] instanceof CharSequence //: "saveAs as a Closure is currently not supported. Surround your closure with single quotes to get the desired effect. Example: '\{ foo \}'" + } + if (elem.containsKey("enabled")) { + assert elem["enabled"] instanceof Boolean + } + + // return final result + elem + } + // store final directive + drctv["publishDir"] = pblsh + } + + /* DIRECTIVE queue + accepted examples: + - "long" + - "short,long" + - ["short", "long"] + */ + if (drctv.containsKey("queue")) { + if (drctv["queue"] instanceof List) { + drctv["queue"] = drctv["queue"].join(",") + } + assert drctv["queue"] instanceof CharSequence + } + + /* DIRECTIVE label + accepted examples: + - "big_mem" + - "big_cpu" + - ["big_mem", "big_cpu"] + */ + if (drctv.containsKey("label")) { + if (drctv["label"] instanceof CharSequence) { + drctv["label"] = [ drctv["label"] ] + } + assert drctv["label"] instanceof List + drctv["label"].forEach { label -> + assert label instanceof CharSequence + // assert label.matches("[a-zA-Z0-9]([a-zA-Z0-9_]*[a-zA-Z0-9])?") + // ^ does not allow closures + } + } + + /* DIRECTIVE scratch + accepted examples: + - true + - "/path/to/scratch" + - '$MY_PATH_TO_SCRATCH' + - "ram-disk" + */ + if (drctv.containsKey("scratch")) { + assert drctv["scratch"] == true || drctv["scratch"] instanceof CharSequence + } + + /* DIRECTIVE storeDir + accepted examples: + - "/path/to/storeDir" + */ + if (drctv.containsKey("storeDir")) { + assert drctv["storeDir"] instanceof CharSequence + } + + /* DIRECTIVE stageInMode + accepted examples: + - "copy" + - "link" + */ + if (drctv.containsKey("stageInMode")) { + assert drctv["stageInMode"] instanceof CharSequence + assert drctv["stageInMode"] in ["copy", "link", "symlink", "rellink"] + } + + /* DIRECTIVE stageOutMode + accepted examples: + - "copy" + - "link" + */ + if (drctv.containsKey("stageOutMode")) { + assert drctv["stageOutMode"] instanceof CharSequence + assert drctv["stageOutMode"] in ["copy", "move", "rsync"] + } + + /* DIRECTIVE tag + accepted examples: + - "foo" + - '$id' + */ + if (drctv.containsKey("tag")) { + assert drctv["tag"] instanceof CharSequence + } + + /* DIRECTIVE time + accepted examples: + - "1h" + - "2days" + - "1day 6hours 3minutes 30seconds" + */ + if (drctv.containsKey("time")) { + assert drctv["time"] instanceof CharSequence + // todo: validation regex? + } + + return drctv +} + +// helper file: 'src/main/resources/io/viash/runners/nextflow/workflowFactory/processWorkflowArgs.nf' +def processWorkflowArgs(Map args, Map defaultWfArgs, Map meta) { + // override defaults with args + def workflowArgs = defaultWfArgs + args + + // check whether 'key' exists + assert workflowArgs.containsKey("key") : "Error in module '${meta.config.name}': key is a required argument" + + // if 'key' is a closure, apply it to the original key + if (workflowArgs["key"] instanceof Closure) { + workflowArgs["key"] = workflowArgs["key"](meta.config.name) + } + def key = workflowArgs["key"] + assert key instanceof CharSequence : "Expected process argument 'key' to be a String. Found: class ${key.getClass()}" + assert key ==~ /^[a-zA-Z_]\w*$/ : "Error in module '$key': Expected process argument 'key' to consist of only letters, digits or underscores. Found: ${key}" + + // check for any unexpected keys + def expectedKeys = ["key", "directives", "auto", "map", "mapId", "mapData", "mapPassthrough", "filter", "runIf", "fromState", "toState", "args", "renameKeys", "debug"] + def unexpectedKeys = workflowArgs.keySet() - expectedKeys + assert unexpectedKeys.isEmpty() : "Error in module '$key': unexpected arguments to the '.run()' function: '${unexpectedKeys.join("', '")}'" + + // check whether directives exists and apply defaults + assert workflowArgs.containsKey("directives") : "Error in module '$key': directives is a required argument" + assert workflowArgs["directives"] instanceof Map : "Error in module '$key': Expected process argument 'directives' to be a Map. Found: class ${workflowArgs['directives'].getClass()}" + workflowArgs["directives"] = processDirectives(defaultWfArgs.directives + workflowArgs["directives"]) + + // check whether directives exists and apply defaults + assert workflowArgs.containsKey("auto") : "Error in module '$key': auto is a required argument" + assert workflowArgs["auto"] instanceof Map : "Error in module '$key': Expected process argument 'auto' to be a Map. Found: class ${workflowArgs['auto'].getClass()}" + workflowArgs["auto"] = processAuto(defaultWfArgs.auto + workflowArgs["auto"]) + + // auto define publish, if so desired + if (workflowArgs.auto.publish == true && (workflowArgs.directives.publishDir != null ? workflowArgs.directives.publishDir : [:]).isEmpty()) { + // can't assert at this level thanks to the no_publish profile + // assert params.containsKey("publishDir") || params.containsKey("publish_dir") : + // "Error in module '${workflowArgs['key']}': if auto.publish is true, params.publish_dir needs to be defined.\n" + + // " Example: params.publish_dir = \"./output/\"" + def publishDir = getPublishDir() + + if (publishDir != null) { + workflowArgs.directives.publishDir = [[ + path: publishDir, + saveAs: "{ it.startsWith('.') ? null : it }", // don't publish hidden files, by default + mode: "copy" + ]] + } + } + + // auto define transcript, if so desired + if (workflowArgs.auto.transcript == true) { + // can't assert at this level thanks to the no_publish profile + // assert params.containsKey("transcriptsDir") || params.containsKey("transcripts_dir") || params.containsKey("publishDir") || params.containsKey("publish_dir") : + // "Error in module '${workflowArgs['key']}': if auto.transcript is true, either params.transcripts_dir or params.publish_dir needs to be defined.\n" + + // " Example: params.transcripts_dir = \"./transcripts/\"" + def transcriptsDir = + params.containsKey("transcripts_dir") ? params.transcripts_dir : + params.containsKey("transcriptsDir") ? params.transcriptsDir : + params.containsKey("publish_dir") ? params.publish_dir + "/_transcripts" : + params.containsKey("publishDir") ? params.publishDir + "/_transcripts" : + null + if (transcriptsDir != null) { + def timestamp = nextflow.Nextflow.getSession().getWorkflowMetadata().start.format('yyyy-MM-dd_HH-mm-ss') + def transcriptsPublishDir = [ + path: "$transcriptsDir/$timestamp/\${task.process.replaceAll(':', '-')}/\${id}/", + saveAs: "{ it.startsWith('.') ? it.replaceAll('^.', '') : null }", + mode: "copy" + ] + def publishDirs = workflowArgs.directives.publishDir != null ? workflowArgs.directives.publishDir : null ? workflowArgs.directives.publishDir : [] + workflowArgs.directives.publishDir = publishDirs + transcriptsPublishDir + } + } + + // if this is a stubrun, remove certain directives? + if (workflow.stubRun) { + workflowArgs.directives.keySet().removeAll(["publishDir", "cpus", "memory", "label"]) + } + + for (nam in ["map", "mapId", "mapData", "mapPassthrough", "filter", "runIf"]) { + if (workflowArgs.containsKey(nam) && workflowArgs[nam]) { + assert workflowArgs[nam] instanceof Closure : "Error in module '$key': Expected process argument '$nam' to be null or a Closure. Found: class ${workflowArgs[nam].getClass()}" + } + } + + // TODO: should functions like 'map', 'mapId', 'mapData', 'mapPassthrough' be deprecated as well? + for (nam in ["map", "mapData", "mapPassthrough", "renameKeys"]) { + if (workflowArgs.containsKey(nam) && workflowArgs[nam] != null) { + log.warn "module '$key': workflow argument '$nam' is deprecated and will be removed in Viash 0.9.0. Please use 'fromState' and 'toState' instead." + } + } + + // check fromState + workflowArgs["fromState"] = _processFromState(workflowArgs.get("fromState"), key, meta.config) + + // check toState + workflowArgs["toState"] = _processToState(workflowArgs.get("toState"), key, meta.config) + + // return output + return workflowArgs +} + +def _processFromState(fromState, key_, config_) { + assert fromState == null || fromState instanceof Closure || fromState instanceof Map || fromState instanceof List : + "Error in module '$key_': Expected process argument 'fromState' to be null, a Closure, a Map, or a List. Found: class ${fromState.getClass()}" + if (fromState == null) { + return null + } + + // if fromState is a List, convert to map + if (fromState instanceof List) { + // check whether fromstate is a list[string] + assert fromState.every{it instanceof CharSequence} : "Error in module '$key_': fromState is a List, but not all elements are Strings" + fromState = fromState.collectEntries{[it, it]} + } + + // if fromState is a map, convert to closure + if (fromState instanceof Map) { + // check whether fromstate is a map[string, string] + assert fromState.values().every{it instanceof CharSequence} : "Error in module '$key_': fromState is a Map, but not all values are Strings" + assert fromState.keySet().every{it instanceof CharSequence} : "Error in module '$key_': fromState is a Map, but not all keys are Strings" + def fromStateMap = fromState.clone() + def requiredInputNames = meta.config.allArguments.findAll{it.required && it.direction == "Input"}.collect{it.plainName} + // turn the map into a closure to be used later on + fromState = { it -> + def state = it[1] + assert state instanceof Map : "Error in module '$key_': the state is not a Map" + def data = fromStateMap.collectMany{newkey, origkey -> + // check whether newkey corresponds to a required argument + if (state.containsKey(origkey)) { + [[newkey, state[origkey]]] + } else if (!requiredInputNames.contains(origkey)) { + [] + } else { + throw new Exception("Error in module '$key_': fromState key '$origkey' not found in current state") + } + }.collectEntries() + data + } + } + + return fromState +} + +def _processToState(toState, key_, config_) { + if (toState == null) { + toState = { tup -> tup[1] } + } + + // toState should be a closure, map[string, string], or list[string] + assert toState instanceof Closure || toState instanceof Map || toState instanceof List : + "Error in module '$key_': Expected process argument 'toState' to be a Closure, a Map, or a List. Found: class ${toState.getClass()}" + + // if toState is a List, convert to map + if (toState instanceof List) { + // check whether toState is a list[string] + assert toState.every{it instanceof CharSequence} : "Error in module '$key_': toState is a List, but not all elements are Strings" + toState = toState.collectEntries{[it, it]} + } + + // if toState is a map, convert to closure + if (toState instanceof Map) { + // check whether toState is a map[string, string] + assert toState.values().every{it instanceof CharSequence} : "Error in module '$key_': toState is a Map, but not all values are Strings" + assert toState.keySet().every{it instanceof CharSequence} : "Error in module '$key_': toState is a Map, but not all keys are Strings" + def toStateMap = toState.clone() + def requiredOutputNames = config_.allArguments.findAll{it.required && it.direction == "Output"}.collect{it.plainName} + // turn the map into a closure to be used later on + toState = { it -> + def output = it[1] + def state = it[2] + assert output instanceof Map : "Error in module '$key_': the output is not a Map" + assert state instanceof Map : "Error in module '$key_': the state is not a Map" + def extraEntries = toStateMap.collectMany{newkey, origkey -> + // check whether newkey corresponds to a required argument + if (output.containsKey(origkey)) { + [[newkey, output[origkey]]] + } else if (!requiredOutputNames.contains(origkey)) { + [] + } else { + throw new Exception("Error in module '$key_': toState key '$origkey' not found in current output") + } + }.collectEntries() + state + extraEntries + } + } + + return toState +} + +// helper file: 'src/main/resources/io/viash/runners/nextflow/workflowFactory/workflowFactory.nf' +def _debug(workflowArgs, debugKey) { + if (workflowArgs.debug) { + view { "process '${workflowArgs.key}' $debugKey tuple: $it" } + } else { + map { it } + } +} + +// depends on: innerWorkflowFactory +def workflowFactory(Map args, Map defaultWfArgs, Map meta) { + def workflowArgs = processWorkflowArgs(args, defaultWfArgs, meta) + def key_ = workflowArgs["key"] + def multipleArgs = meta.config.allArguments.findAll{ it.multiple }.collect{it.plainName} + + workflow workflowInstance { + take: input_ + + main: + def chModified = input_ + | checkUniqueIds([:]) + | _debug(workflowArgs, "input") + | map { tuple -> + tuple = deepClone(tuple) + + if (workflowArgs.map) { + tuple = workflowArgs.map(tuple) + } + if (workflowArgs.mapId) { + tuple[0] = workflowArgs.mapId(tuple[0]) + } + if (workflowArgs.mapData) { + tuple[1] = workflowArgs.mapData(tuple[1]) + } + if (workflowArgs.mapPassthrough) { + tuple = tuple.take(2) + workflowArgs.mapPassthrough(tuple.drop(2)) + } + + // check tuple + assert tuple instanceof List : + "Error in module '${key_}': element in channel should be a tuple [id, data, ...otherargs...]\n" + + " Example: [\"id\", [input: file('foo.txt'), arg: 10]].\n" + + " Expected class: List. Found: tuple.getClass() is ${tuple.getClass()}" + assert tuple.size() >= 2 : + "Error in module '${key_}': expected length of tuple in input channel to be two or greater.\n" + + " Example: [\"id\", [input: file('foo.txt'), arg: 10]].\n" + + " Found: tuple.size() == ${tuple.size()}" + + // check id field + if (tuple[0] instanceof GString) { + tuple[0] = tuple[0].toString() + } + assert tuple[0] instanceof CharSequence : + "Error in module '${key_}': first element of tuple in channel should be a String\n" + + " Example: [\"id\", [input: file('foo.txt'), arg: 10]].\n" + + " Found: ${tuple[0]}" + + // match file to input file + if (workflowArgs.auto.simplifyInput && (tuple[1] instanceof Path || tuple[1] instanceof List)) { + def inputFiles = meta.config.allArguments + .findAll { it.type == "file" && it.direction == "input" } + + assert inputFiles.size() == 1 : + "Error in module '${key_}' id '${tuple[0]}'.\n" + + " Anonymous file inputs are only allowed when the process has exactly one file input.\n" + + " Expected: inputFiles.size() == 1. Found: inputFiles.size() is ${inputFiles.size()}" + + tuple[1] = [[ inputFiles[0].plainName, tuple[1] ]].collectEntries() + } + + // check data field + assert tuple[1] instanceof Map : + "Error in module '${key_}' id '${tuple[0]}': second element of tuple in channel should be a Map\n" + + " Example: [\"id\", [input: file('foo.txt'), arg: 10]].\n" + + " Expected class: Map. Found: tuple[1].getClass() is ${tuple[1].getClass()}" + + // rename keys of data field in tuple + if (workflowArgs.renameKeys) { + assert workflowArgs.renameKeys instanceof Map : + "Error renaming data keys in module '${key_}' id '${tuple[0]}'.\n" + + " Example: renameKeys: ['new_key': 'old_key'].\n" + + " Expected class: Map. Found: renameKeys.getClass() is ${workflowArgs.renameKeys.getClass()}" + assert tuple[1] instanceof Map : + "Error renaming data keys in module '${key_}' id '${tuple[0]}'.\n" + + " Expected class: Map. Found: tuple[1].getClass() is ${tuple[1].getClass()}" + + // TODO: allow renameKeys to be a function? + workflowArgs.renameKeys.each { newKey, oldKey -> + assert newKey instanceof CharSequence : + "Error renaming data keys in module '${key_}' id '${tuple[0]}'.\n" + + " Example: renameKeys: ['new_key': 'old_key'].\n" + + " Expected class of newKey: String. Found: newKey.getClass() is ${newKey.getClass()}" + assert oldKey instanceof CharSequence : + "Error renaming data keys in module '${key_}' id '${tuple[0]}'.\n" + + " Example: renameKeys: ['new_key': 'old_key'].\n" + + " Expected class of oldKey: String. Found: oldKey.getClass() is ${oldKey.getClass()}" + assert tuple[1].containsKey(oldKey) : + "Error renaming data keys in module '${key}' id '${tuple[0]}'.\n" + + " Key '$oldKey' is missing in the data map. tuple[1].keySet() is '${tuple[1].keySet()}'" + tuple[1].put(newKey, tuple[1][oldKey]) + } + tuple[1].keySet().removeAll(workflowArgs.renameKeys.collect{ newKey, oldKey -> oldKey }) + } + tuple + } + + + def chRun = null + def chPassthrough = null + if (workflowArgs.runIf) { + def runIfBranch = chModified.branch{ tup -> + run: workflowArgs.runIf(tup[0], tup[1]) + passthrough: true + } + chRun = runIfBranch.run + chPassthrough = runIfBranch.passthrough + } else { + chRun = chModified + chPassthrough = Channel.empty() + } + + def chRunFiltered = workflowArgs.filter ? + chRun | filter{workflowArgs.filter(it)} : + chRun + + def chArgs = workflowArgs.fromState ? + chRunFiltered | map{ + def new_data = workflowArgs.fromState(it.take(2)) + [it[0], new_data] + } : + chRunFiltered | map {tup -> tup.take(2)} + + // fill in defaults + def chArgsWithDefaults = chArgs + | map { tuple -> + def id_ = tuple[0] + def data_ = tuple[1] + + // TODO: could move fromState to here + + // fetch default params from functionality + def defaultArgs = meta.config.allArguments + .findAll { it.containsKey("default") } + .collectEntries { [ it.plainName, it.default ] } + + // fetch overrides in params + def paramArgs = meta.config.allArguments + .findAll { par -> + def argKey = key_ + "__" + par.plainName + params.containsKey(argKey) + } + .collectEntries { [ it.plainName, params[key_ + "__" + it.plainName] ] } + + // fetch overrides in data + def dataArgs = meta.config.allArguments + .findAll { data_.containsKey(it.plainName) } + .collectEntries { [ it.plainName, data_[it.plainName] ] } + + // combine params + def combinedArgs = defaultArgs + paramArgs + workflowArgs.args + dataArgs + + // remove arguments with explicit null values + combinedArgs + .removeAll{_, val -> val == null || val == "viash_no_value" || val == "force_null"} + + combinedArgs = _processInputValues(combinedArgs, meta.config, id_, key_) + + [id_, combinedArgs] + tuple.drop(2) + } + + // TODO: move some of the _meta.join_id wrangling to the safeJoin() function. + def chInitialOutputMulti = chArgsWithDefaults + | _debug(workflowArgs, "processed") + // run workflow + | innerWorkflowFactory(workflowArgs) + def chInitialOutputList = chInitialOutputMulti instanceof List ? chInitialOutputMulti : [chInitialOutputMulti] + assert chInitialOutputList.size() > 0: "should have emitted at least one output channel" + // Add a channel ID to the events, which designates the channel the event was emitted from as a running number + // This number is used to sort the events later when the events are gathered from across the channels. + def chInitialOutputListWithIndexedEvents = chInitialOutputList.withIndex().collect{channel, channelIndex -> + def newChannel = channel + | map {tuple -> + assert tuple instanceof List : + "Error in module '${key_}': element in output channel should be a tuple [id, data, ...otherargs...]\n" + + " Example: [\"id\", [input: file('foo.txt'), arg: 10]].\n" + + " Expected class: List. Found: tuple.getClass() is ${tuple.getClass()}" + + def newEvent = [channelIndex] + tuple + return newEvent + } + return newChannel + } + // Put the events into 1 channel, cover case where there is only one channel is emitted + def chInitialOutput = chInitialOutputList.size() > 1 ? \ + chInitialOutputListWithIndexedEvents[0].mix(*chInitialOutputListWithIndexedEvents.tail()) : \ + chInitialOutputListWithIndexedEvents[0] + def chInitialOutputProcessed = chInitialOutput + | map { tuple -> + def channelId = tuple[0] + def id_ = tuple[1] + def output_ = tuple[2] + + // see if output map contains metadata + def meta_ = + output_ instanceof Map && output_.containsKey("_meta") ? + output_["_meta"] : + [:] + def join_id = meta_.join_id ?: id_ + + // remove metadata + output_ = output_.findAll{k, v -> k != "_meta"} + + // check value types + output_ = _checkValidOutputArgument(output_, meta.config, id_, key_) + + [join_id, channelId, id_, output_] + } + // | view{"chInitialOutput: ${it.take(3)}"} + + // join the output [prev_id, channel_id, new_id, output] with the previous state [prev_id, state, ...] + def chPublishWithPreviousState = safeJoin(chInitialOutputProcessed, chRunFiltered, key_) + // input tuple format: [join_id, channel_id, id, output, prev_state, ...] + // output tuple format: [join_id, channel_id, id, new_state, ...] + | map{ tup -> + def new_state = workflowArgs.toState(tup.drop(2).take(3)) + tup.take(3) + [new_state] + tup.drop(5) + } + if (workflowArgs.auto.publish == "state") { + def chPublishFiles = chPublishWithPreviousState + // input tuple format: [join_id, channel_id, id, new_state, ...] + // output tuple format: [join_id, channel_id, id, new_state] + | map{ tup -> + tup.take(4) + } + + safeJoin(chPublishFiles, chArgsWithDefaults, key_) + // input tuple format: [join_id, channel_id, id, new_state, orig_state, ...] + // output tuple format: [id, new_state, orig_state] + | map { tup -> + tup.drop(2).take(3) + } + | publishFilesByConfig(key: key_, config: meta.config) + } + // Join the state from the events that were emitted from different channels + def chJoined = chInitialOutputProcessed + | map {tuple -> + def join_id = tuple[0] + def channel_id = tuple[1] + def id = tuple[2] + def other = tuple.drop(3) + // Below, groupTuple is used to join the events. To make sure resuming a workflow + // keeps working, the output state must be deterministic. This means the state needs to be + // sorted with groupTuple's has a 'sort' argument. This argument can be set to 'hash', + // but hashing the state when it is large can be problematic in terms of performance. + // Therefore, a custom comparator function is provided. We add the channel ID to the + // states so that we can use the channel ID to sort the items. + def stateWithChannelID = [[channel_id] * other.size(), other].transpose() + // A comparator that is provided to groupTuple's 'sort' argument is applied + // to all elements of the event tuple (that is not the 'id'). The comparator + // closure that is used below expects the input to be List. So the join_id and + // channel_id must also be wrapped in a list. + [[join_id], [channel_id], id] + stateWithChannelID + } + | groupTuple(by: 2, sort: {a, b -> a[0] <=> b[0]}, size: chInitialOutputList.size(), remainder: true) + | map {join_ids, _, id, statesWithChannelID -> + // Remove the channel IDs from the states + def states = statesWithChannelID.collect{it[1]} + def newJoinId = join_ids.flatten().unique{a, b -> a <=> b} + assert newJoinId.size() == 1: "Multiple events were emitted for '$id'." + def newJoinIdUnique = newJoinId[0] + + // Merge the states from the different channels + def newState = states.inject([:]){ old_state, state_to_add -> + return old_state + state_to_add.collectEntries{k, v -> + if (!multipleArgs.contains(k)) { + // if the key is not a multiple argument, we expect only one value + if (old_state.containsKey(k)) { + assert old_state[k] == v : "ID $id: multiple entries for argument $k were emitted." + } + [k, v] + } else { + // if the key is a multiple argument, append the different values into one list + def prevValue = old_state.getOrDefault(k, []) + def prevValueAsList = prevValue instanceof List ? prevValue : [prevValue] + [k, prevValueAsList + v] + } + } + } + + _checkAllRequiredOuputsPresent(newState, meta.config, id, key_) + + // simplify output if need be + if (workflowArgs.auto.simplifyOutput && newState.size() == 1) { + newState = newState.values()[0] + } + + return [newJoinIdUnique, id, newState] + } + + // join the output [prev_id, new_id, output] with the previous state [prev_id, state, ...] + def chNewState = safeJoin(chJoined, chRunFiltered, key_) + // input tuple format: [join_id, id, output, prev_state, ...] + // output tuple format: [join_id, id, new_state, ...] + | map{ tup -> + def new_state = workflowArgs.toState(tup.drop(1).take(3)) + tup.take(2) + [new_state] + tup.drop(4) + } + + if (workflowArgs.auto.publish == "state") { + def chPublishStates = chNewState + // input tuple format: [join_id, id, new_state, ...] + // output tuple format: [join_id, id, new_state] + | map{ tup -> + tup.take(3) + } + + safeJoin(chPublishStates, chArgsWithDefaults, key_) + // input tuple format: [join_id, id, new_state, orig_state, ...] + // output tuple format: [id, new_state, orig_state] + | map { tup -> + tup.drop(1).take(3) + } + | publishStatesByConfig(key: key_, config: meta.config) + } + chReturn = chNewState + | map { tup -> + // input tuple format: [join_id, id, new_state, ...] + // output tuple format: [id, new_state, ...] + tup.drop(1) + } + | _debug(workflowArgs, "output") + | concat(chPassthrough) + + emit: chReturn + } + + def wf = workflowInstance.cloneWithName(key_) + + // add factory function + wf.metaClass.run = { runArgs -> + workflowFactory(runArgs, workflowArgs, meta) + } + // add config to module for later introspection + wf.metaClass.config = meta.config + + return wf +} + +nextflow.enable.dsl=2 + +// START COMPONENT-SPECIFIC CODE + +// create meta object +meta = [ + "resources_dir": moduleDir.toRealPath().normalize(), + "config": processConfig(readJsonBlob('''{ + "name" : "process_singlesample_base", + "namespace" : "workflows/multiomics", + "version" : "v4.1.0", + "authors" : [ + { + "name" : "Dorien Roosen", + "roles" : [ + "author" + ], + "info" : { + "role" : "Core Team Member", + "links" : { + "email" : "dorien@data-intuitive.com", + "github" : "dorien-er", + "linkedin" : "dorien-roosen" + }, + "organizations" : [ + { + "name" : "Data Intuitive", + "href" : "https://www.data-intuitive.com", + "role" : "Data Scientist" + } + ] + } + } + ], + "argument_groups" : [ + { + "name" : "Output State", + "arguments" : [ + { + "type" : "string", + "name" : "--output_modality", + "required" : false, + "direction" : "output", + "multiple" : false, + "multiple_sep" : ";" + } + ] + }, + { + "name" : "Inputs", + "arguments" : [ + { + "type" : "file", + "name" : "--input", + "alternatives" : [ + "-i" + ], + "description" : "Path to the sample.", + "example" : [ + "input.h5mu" + ], + "must_exist" : true, + "create_parent" : true, + "required" : true, + "direction" : "input", + "multiple" : false, + "multiple_sep" : ";" + }, + { + "type" : "string", + "name" : "--rna_layer", + "description" : "Input layer for the gene expression modality. If not specified, .X is used.", + "required" : false, + "direction" : "input", + "multiple" : false, + "multiple_sep" : ";" + }, + { + "type" : "string", + "name" : "--prot_layer", + "description" : "Input layer for the antibody capture modality. If not specified, .X is used.", + "required" : false, + "direction" : "input", + "multiple" : false, + "multiple_sep" : ";" + }, + { + "type" : "string", + "name" : "--gdo_layer", + "description" : "Input layer for the guide-derived oligonucleotide (GDO) data. If not specified, .X is used.", + "required" : false, + "direction" : "input", + "multiple" : false, + "multiple_sep" : ";" + } + ] + }, + { + "name" : "Outputs", + "arguments" : [ + { + "type" : "file", + "name" : "--output", + "description" : "Destination path to the output.", + "example" : [ + "output.h5mu" + ], + "must_exist" : true, + "create_parent" : true, + "required" : true, + "direction" : "output", + "multiple" : false, + "multiple_sep" : ";" + } + ] + }, + { + "name" : "Sample ID options", + "description" : "Options for adding the id to .obs on the MuData object. Having a sample \nid present in a requirement of several components for this pipeline.\n", + "arguments" : [ + { + "type" : "boolean", + "name" : "--add_id_to_obs", + "description" : "Add the value passed with --id to .obs.", + "default" : [ + true + ], + "required" : false, + "direction" : "input", + "multiple" : false, + "multiple_sep" : ";" + }, + { + "type" : "string", + "name" : "--add_id_obs_output", + "description" : ".Obs column to add the sample IDs to. Required and only used when \n--add_id_to_obs is set to 'true'\n", + "default" : [ + "sample_id" + ], + "required" : false, + "direction" : "input", + "multiple" : false, + "multiple_sep" : ";" + }, + { + "type" : "boolean", + "name" : "--add_id_make_observation_keys_unique", + "description" : "Join the id to the .obs index (.obs_names). \nOnly used when --add_id_to_obs is set to 'true'.\n", + "default" : [ + true + ], + "required" : false, + "direction" : "input", + "multiple" : false, + "multiple_sep" : ";" + } + ] + }, + { + "name" : "RNA filtering options", + "arguments" : [ + { + "type" : "integer", + "name" : "--rna_min_counts", + "description" : "Minimum number of counts captured per cell.", + "example" : [ + 200 + ], + "required" : false, + "direction" : "input", + "multiple" : false, + "multiple_sep" : ";" + }, + { + "type" : "integer", + "name" : "--rna_max_counts", + "description" : "Maximum number of counts captured per cell.", + "example" : [ + 5000000 + ], + "required" : false, + "direction" : "input", + "multiple" : false, + "multiple_sep" : ";" + }, + { + "type" : "integer", + "name" : "--rna_min_genes_per_cell", + "description" : "Minimum of non-zero values per cell.", + "example" : [ + 200 + ], + "required" : false, + "direction" : "input", + "multiple" : false, + "multiple_sep" : ";" + }, + { + "type" : "integer", + "name" : "--rna_max_genes_per_cell", + "description" : "Maximum of non-zero values per cell.", + "example" : [ + 1500000 + ], + "required" : false, + "direction" : "input", + "multiple" : false, + "multiple_sep" : ";" + }, + { + "type" : "integer", + "name" : "--rna_min_cells_per_gene", + "description" : "Minimum of non-zero values per gene.", + "example" : [ + 3 + ], + "required" : false, + "direction" : "input", + "multiple" : false, + "multiple_sep" : ";" + }, + { + "type" : "double", + "name" : "--rna_min_fraction_mito", + "description" : "Minimum fraction of UMIs that are mitochondrial.", + "example" : [ + 0.0 + ], + "required" : false, + "direction" : "input", + "multiple" : false, + "multiple_sep" : ";" + }, + { + "type" : "double", + "name" : "--rna_max_fraction_mito", + "description" : "Maximum fraction of UMIs that are mitochondrial.", + "example" : [ + 0.2 + ], + "required" : false, + "direction" : "input", + "multiple" : false, + "multiple_sep" : ";" + }, + { + "type" : "double", + "name" : "--rna_min_fraction_ribo", + "description" : "Minimum fraction of UMIs that are mitochondrial.", + "example" : [ + 0.0 + ], + "required" : false, + "direction" : "input", + "multiple" : false, + "multiple_sep" : ";" + }, + { + "type" : "double", + "name" : "--rna_max_fraction_ribo", + "description" : "Maximum fraction of UMIs that are mitochondrial.", + "example" : [ + 0.2 + ], + "required" : false, + "direction" : "input", + "multiple" : false, + "multiple_sep" : ";" + }, + { + "type" : "boolean_true", + "name" : "--skip_scrublet_doublet_detection", + "description" : "Skip the scrublet doublet detection step.", + "direction" : "input" + } + ] + }, + { + "name" : "CITE-seq filtering options", + "arguments" : [ + { + "type" : "integer", + "name" : "--prot_min_counts", + "description" : "Minimum number of counts per cell.", + "example" : [ + 3 + ], + "required" : false, + "direction" : "input", + "multiple" : false, + "multiple_sep" : ";" + }, + { + "type" : "integer", + "name" : "--prot_max_counts", + "description" : "Minimum number of counts per cell.", + "example" : [ + 5000000 + ], + "required" : false, + "direction" : "input", + "multiple" : false, + "multiple_sep" : ";" + }, + { + "type" : "integer", + "name" : "--prot_min_proteins_per_cell", + "description" : "Minimum of non-zero values per cell.", + "example" : [ + 200 + ], + "required" : false, + "direction" : "input", + "multiple" : false, + "multiple_sep" : ";" + }, + { + "type" : "integer", + "name" : "--prot_max_proteins_per_cell", + "description" : "Maximum of non-zero values per cell.", + "example" : [ + 100000000 + ], + "required" : false, + "direction" : "input", + "multiple" : false, + "multiple_sep" : ";" + }, + { + "type" : "integer", + "name" : "--prot_min_cells_per_protein", + "description" : "Minimum of non-zero values per protein.", + "example" : [ + 3 + ], + "required" : false, + "direction" : "input", + "multiple" : false, + "multiple_sep" : ";" + } + ] + }, + { + "name" : "GDO filtering options", + "arguments" : [ + { + "type" : "integer", + "name" : "--gdo_min_counts", + "description" : "Minimum number of counts per cell.", + "example" : [ + 3 + ], + "required" : false, + "direction" : "input", + "multiple" : false, + "multiple_sep" : ";" + }, + { + "type" : "integer", + "name" : "--gdo_max_counts", + "description" : "Minimum number of counts per cell.", + "example" : [ + 5000000 + ], + "required" : false, + "direction" : "input", + "multiple" : false, + "multiple_sep" : ";" + }, + { + "type" : "integer", + "name" : "--gdo_min_guides_per_cell", + "description" : "Minimum of non-zero values per cell.", + "example" : [ + 200 + ], + "required" : false, + "direction" : "input", + "multiple" : false, + "multiple_sep" : ";" + }, + { + "type" : "integer", + "name" : "--gdo_max_guides_per_cell", + "description" : "Maximum of non-zero values per cell.", + "example" : [ + 100000000 + ], + "required" : false, + "direction" : "input", + "multiple" : false, + "multiple_sep" : ";" + }, + { + "type" : "integer", + "name" : "--gdo_min_cells_per_guide", + "description" : "Minimum of non-zero values per guide.", + "example" : [ + 3 + ], + "required" : false, + "direction" : "input", + "multiple" : false, + "multiple_sep" : ";" + } + ] + }, + { + "name" : "Cross-modality filtering", + "arguments" : [ + { + "type" : "boolean_true", + "name" : "--intersect_obs", + "description" : "After per-modality filtering, remove observations that are not present\nin all processed modalities so that each modality shares the same set of cells.\n", + "direction" : "input" + } + ] + }, + { + "name" : "Mitochondrial & Ribosomal Gene Detection", + "arguments" : [ + { + "type" : "string", + "name" : "--var_gene_names", + "description" : ".var column name to be used to detect mitochondrial/ribosomal genes instead of .var_names (default if not set).\nGene names matching with the regex value from --mitochondrial_gene_regex or --ribosomal_gene_regex will be \nidentified as mitochondrial or ribosomal genes, respectively. \n", + "example" : [ + "gene_symbol" + ], + "required" : false, + "direction" : "input", + "multiple" : false, + "multiple_sep" : ";" + }, + { + "type" : "string", + "name" : "--var_name_mitochondrial_genes", + "description" : "In which .var slot to store a boolean array corresponding the mitochondrial genes.\n", + "required" : false, + "direction" : "input", + "multiple" : false, + "multiple_sep" : ";" + }, + { + "type" : "string", + "name" : "--obs_name_mitochondrial_fraction", + "description" : "When specified, write the fraction of counts originating from mitochondrial genes \n(based on --mitochondrial_gene_regex) to an .obs column with the specified name.\nRequires --var_name_mitochondrial_genes.\n", + "required" : false, + "direction" : "input", + "multiple" : false, + "multiple_sep" : ";" + }, + { + "type" : "string", + "name" : "--mitochondrial_gene_regex", + "description" : "Regex string that identifies mitochondrial genes from --var_gene_names.\nBy default will detect human and mouse mitochondrial genes from a gene symbol.\n", + "default" : [ + "^[mM][tT]-" + ], + "required" : false, + "direction" : "input", + "multiple" : false, + "multiple_sep" : ";" + }, + { + "type" : "string", + "name" : "--var_name_ribosomal_genes", + "description" : "In which .var slot to store a boolean array corresponding the ribosomal genes.\n", + "required" : false, + "direction" : "input", + "multiple" : false, + "multiple_sep" : ";" + }, + { + "type" : "string", + "name" : "--obs_name_ribosomal_fraction", + "description" : "When specified, write the fraction of counts originating from ribosomal genes \n(based on --ribosomal_gene_regex) to an .obs column with the specified name.\nRequires --var_name_ribosomal_genes.\n", + "required" : false, + "direction" : "input", + "multiple" : false, + "multiple_sep" : ";" + }, + { + "type" : "string", + "name" : "--ribosomal_gene_regex", + "description" : "Regex string that identifies ribosomal genes from --var_gene_names.\nBy default will detect human and mouse ribosomal genes from a gene symbol.\n", + "default" : [ + "^[Mm]?[Rr][Pp][LlSs]" + ], + "required" : false, + "direction" : "input", + "multiple" : false, + "multiple_sep" : ";" + } + ] + } + ], + "resources" : [ + { + "type" : "nextflow_script", + "path" : "main.nf", + "is_executable" : true, + "entrypoint" : "run_wf" + }, + { + "type" : "file", + "path" : "/src/workflows/utils/" + }, + { + "type" : "file", + "path" : "/src/workflows/utils/labels.config", + "dest" : "nextflow_labels.config" + } + ], + "description" : "A pipeline to analyse a single multiomics sample.", + "status" : "enabled", + "scope" : { + "image" : "private", + "target" : "private" + }, + "dependencies" : [ + { + "name" : "metadata/add_id", + "repository" : { + "type" : "local" + } + }, + { + "name" : "workflows/multiomics/split_modalities", + "alias" : "split_modalities_workflow", + "repository" : { + "type" : "local" + } + }, + { + "name" : "workflows/rna/rna_singlesample", + "repository" : { + "type" : "local" + } + }, + { + "name" : "workflows/prot/prot_singlesample", + "repository" : { + "type" : "local" + } + }, + { + "name" : "workflows/gdo/gdo_singlesample", + "repository" : { + "type" : "local" + } + } + ], + "license" : "MIT", + "links" : { + "repository" : "https://github.com/openpipelines-bio/openpipeline", + "docker_registry" : "ghcr.io" + }, + "runners" : [ + { + "type" : "nextflow", + "id" : "nextflow", + "directives" : { + "tag" : "$id" + }, + "auto" : { + "simplifyInput" : true, + "simplifyOutput" : false, + "transcript" : false, + "publish" : false + }, + "config" : { + "labels" : { + "mem1gb" : "memory = 1000000000.B", + "mem2gb" : "memory = 2000000000.B", + "mem5gb" : "memory = 5000000000.B", + "mem10gb" : "memory = 10000000000.B", + "mem20gb" : "memory = 20000000000.B", + "mem50gb" : "memory = 50000000000.B", + "mem100gb" : "memory = 100000000000.B", + "mem200gb" : "memory = 200000000000.B", + "mem500gb" : "memory = 500000000000.B", + "mem1tb" : "memory = 1000000000000.B", + "mem2tb" : "memory = 2000000000000.B", + "mem5tb" : "memory = 5000000000000.B", + "mem10tb" : "memory = 10000000000000.B", + "mem20tb" : "memory = 20000000000000.B", + "mem50tb" : "memory = 50000000000000.B", + "mem100tb" : "memory = 100000000000000.B", + "mem200tb" : "memory = 200000000000000.B", + "mem500tb" : "memory = 500000000000000.B", + "mem1gib" : "memory = 1073741824.B", + "mem2gib" : "memory = 2147483648.B", + "mem4gib" : "memory = 4294967296.B", + "mem8gib" : "memory = 8589934592.B", + "mem16gib" : "memory = 17179869184.B", + "mem32gib" : "memory = 34359738368.B", + "mem64gib" : "memory = 68719476736.B", + "mem128gib" : "memory = 137438953472.B", + "mem256gib" : "memory = 274877906944.B", + "mem512gib" : "memory = 549755813888.B", + "mem1tib" : "memory = 1099511627776.B", + "mem2tib" : "memory = 2199023255552.B", + "mem4tib" : "memory = 4398046511104.B", + "mem8tib" : "memory = 8796093022208.B", + "mem16tib" : "memory = 17592186044416.B", + "mem32tib" : "memory = 35184372088832.B", + "mem64tib" : "memory = 70368744177664.B", + "mem128tib" : "memory = 140737488355328.B", + "mem256tib" : "memory = 281474976710656.B", + "mem512tib" : "memory = 562949953421312.B", + "cpu1" : "cpus = 1", + "cpu2" : "cpus = 2", + "cpu5" : "cpus = 5", + "cpu10" : "cpus = 10", + "cpu20" : "cpus = 20", + "cpu50" : "cpus = 50", + "cpu100" : "cpus = 100", + "cpu200" : "cpus = 200", + "cpu500" : "cpus = 500", + "cpu1000" : "cpus = 1000" + }, + "script" : [ + "includeConfig(\\"nextflow_labels.config\\")" + ] + }, + "debug" : false, + "container" : "docker" + } + ], + "engines" : [ + { + "type" : "native", + "id" : "native" + } + ], + "build_info" : { + "config" : "/workdir/root/repo/src/workflows/multiomics/process_singlesample_base/config.vsh.yaml", + "runner" : "nextflow", + "engine" : "native", + "output" : "/workdir/root/repo/target/_private/nextflow/workflows/multiomics/process_singlesample_base", + "viash_version" : "0.9.7", + "git_commit" : "a6499fddaa8553874585c747370f919f4d7b729c", + "git_remote" : "https://github.com/openpipelines-bio/openpipeline" + }, + "package_config" : { + "name" : "openpipeline", + "version" : "v4.1.0", + "summary" : "Best-practice workflows for single-cell multi-omics analyses.\n", + "description" : "OpenPipelines are extensible single cell analysis pipelines for reproducible and large-scale single cell processing using [Viash](https://viash.io) and [Nextflow](https://www.nextflow.io/).\n\nIn terms of workflows, the following has been made available, but keep in mind that\nindividual tools and functionality can be executed as standalone components as well.\n\n * Demultiplexing: conversion of raw sequencing data to FASTQ objects.\n * Ingestion: Read mapping and generating a count matrix.\n * Single sample processing: cell filtering and doublet detection.\n * Multisample processing: Count transformation, normalization, QC metric calulations.\n * Integration: Clustering, integration and batch correction using single and multimodal methods.\n * Downstream analysis workflows\n", + "info" : { + "test_resources" : [ + { + "type" : "s3", + "path" : "s3://openpipelines-data", + "dest" : "resources_test" + } + ], + "nextflow_labels_ci" : [ + { + "path" : "src/workflows/utils/labels_ci.config", + "description" : "Adds the correct memory and CPU labels when running on the Viash Hub CI." + } + ] + }, + "viash_version" : "0.9.7", + "source" : "/workdir/root/repo/src", + "target" : "/workdir/root/repo/target", + "config_mods" : [ + ".resources += {path: '/src/workflows/utils/labels.config', dest: 'nextflow_labels.config'}\n.runners[.type == 'nextflow'].config.script := 'includeConfig(\\"nextflow_labels.config\\")'", + ".engines += { type: \\"native\\" }", + ".engines[.type == 'docker'].target_registry := 'images.viash-hub.com'", + ".engines[.type == 'docker'].target_tag := 'v4.1.0'" + ], + "keywords" : [ + "single-cell", + "multimodal" + ], + "license" : "MIT", + "organization" : "vsh", + "links" : { + "repository" : "https://github.com/openpipelines-bio/openpipeline", + "docker_registry" : "ghcr.io", + "homepage" : "https://openpipelines.bio", + "documentation" : "https://openpipelines.bio/fundamentals", + "issue_tracker" : "https://github.com/openpipelines-bio/openpipeline/issues" + } + } +}''')) +] + +// resolve dependencies dependencies (if any) +meta["root_dir"] = getRootDir() +include { add_id } from "${meta.resources_dir}/../../../../../nextflow/metadata/add_id/main.nf" +include { split_modalities as split_modalities_workflow_viashalias } from "${meta.resources_dir}/../../../../nextflow/workflows/multiomics/split_modalities/main.nf" +split_modalities_workflow = split_modalities_workflow_viashalias.run(key: "split_modalities_workflow") +include { rna_singlesample } from "${meta.resources_dir}/../../../../../nextflow/workflows/rna/rna_singlesample/main.nf" +include { prot_singlesample } from "${meta.resources_dir}/../../../../../nextflow/workflows/prot/prot_singlesample/main.nf" +include { gdo_singlesample } from "${meta.resources_dir}/../../../../../nextflow/workflows/gdo/gdo_singlesample/main.nf" + +// inner workflow +// user-provided Nextflow code +workflow run_wf { + take: + input_ch + + main: + modalities_ch = input_ch + // Make sure there is not conflict between the output from this workflow + // And the output from any of the components + | map {id, state -> + def new_state = state + ["workflow_output": state.output] + [id, new_state] + } + // If requested to be detected, make sure the mitochondrial and ribosomal genes + // are added to the input of the qc metrics calculation + | map {id, state -> + def var_qc_default = [state.highly_variable_features_var_output] + if (state.var_name_mitochondrial_genes) { + var_qc_default.add(state.var_name_mitochondrial_genes) + } + if (state.var_name_ribosomal_genes) { + var_qc_default.add(state.var_name_ribosomal_genes) + } + def newState = state + ["var_qc_metrics": var_qc_default.join(",")] + [id, newState] + } + // If requested, add the id of the events (samples) a column in .obs. + // Also allows to make .obs_names (the .obs index) unique, by prefixing the values with an unique id per .h5mu file. + // The latter is usefull to avoid duplicate observations during concatenation. + | add_id.run( + filter: {id, state -> state.add_id_to_obs }, + fromState: {id, state -> + def newState = [ + "input": state.input, + "input_id": id, + "make_observation_keys_unique": state.add_id_make_observation_keys_unique, + "obs_output": state.add_id_obs_output, + "add_id_to_obs": state.add_id_to_obs + ] + newState + }, + toState: {id, output, state -> + def keysToRemove = ["add_id_to_obs", "add_id_obs_output", "add_id_make_observation_keys_unique"] + def newState = state.findAll{it.key !in keysToRemove} + newState + ["input": output.output] + } + ) + | split_modalities_workflow.run( + fromState: {id, state -> + def newState = ["input": state.input, "id": id] + }, + toState: ["output": "output", "output_types": "output_types"] + ) + | flatMap {id, state -> + def outputDir = state.output + def csv = state.output_types.splitCsv(strip: true, sep: ",").findAll{!it[0].startsWith("#")} + def header = csv.head() + def types = csv.tail().collect { row -> + [header, row].transpose().collectEntries() + } + + types.collect{ dat -> + // def new_id = id + "_" + dat.name + def new_id = id // it's okay because the channel will get split up anyways + def new_data = outputDir.resolve(dat.filename) + [ new_id, state + ["input": new_data, modality: dat.name]] + } + } + // Remove arguments from split modalities from state + | map {id, state -> + def keysToRemove = ["output_types"] + def newState = state.findAll{it.key !in keysToRemove} + [id, newState] + } + | view {"After splitting modalities: $it"} + + + // + // Singlesample processing + // + def singlesample_arguments = [ + "rna": [ + "min_counts": "rna_min_counts", + "max_counts": "rna_max_counts", + "min_genes_per_cell": "rna_min_genes_per_cell", + "max_genes_per_cell": "rna_max_genes_per_cell", + "min_cells_per_gene": "rna_min_cells_per_gene", + "min_fraction_mito": "rna_min_fraction_mito", + "max_fraction_mito": "rna_max_fraction_mito", + "var_name_mitochondrial_genes": "var_name_mitochondrial_genes", + "obs_name_mitochondrial_fraction": "obs_name_mitochondrial_fraction", + "var_gene_names": "var_gene_names", + "mitochondrial_gene_regex": "mitochondrial_gene_regex", + "min_fraction_ribo": "rna_min_fraction_ribo", + "max_fraction_ribo": "rna_max_fraction_ribo", + "var_name_ribosomal_genes": "var_name_ribosomal_genes", + "obs_name_ribosomal_fraction": "obs_name_ribosomal_fraction", + "ribosomal_gene_regex": "ribosomal_gene_regex", + "layer": "rna_layer", + "skip_scrublet_doublet_detection": "skip_scrublet_doublet_detection" + ], + "prot": [ + "min_counts": "prot_min_counts", + "max_counts": "prot_max_counts", + "min_proteins_per_cell": "prot_min_proteins_per_cell", + "max_proteins_per_cell": "prot_max_proteins_per_cell", + "min_cells_per_protein": "prot_min_cells_per_protein", + "layer": "prot_layer", + ], + "gdo": [ + "min_counts": "gdo_min_counts", + "max_counts": "gdo_max_counts", + "min_guides_per_cell": "gdo_min_guides_per_cell", + "max_guides_per_cell": "gdo_max_guides_per_cell", + "min_cells_per_guide": "gdo_min_cells_per_guide", + "layer": "gdo_layer", + ], + ].asImmutable() + + multisample_ch_known = modalities_ch + // run the singlesample processing + | runEach( + components: [rna_singlesample, prot_singlesample, gdo_singlesample], + filter: { id, state, component -> + state.modality + "_singlesample" == component.config.name + }, + fromState: { id, state, component -> + def newState = singlesample_arguments.get(state.modality).collectEntries{key_, value_ -> + [key_, state[value_]] + } + return newState + ["id": id, "input": state.input] + }, + toState: ["input": "output"], + ) + + multisample_ch_unknown = modalities_ch + | filter{id, state -> state.modality !in singlesample_arguments.keySet()} + + output_ch = multisample_ch_unknown.mix(multisample_ch_known) + | view {"After singlesample processing: $it"} + | setState([ + "output": "input", + "output_modality": "modality" + ]) + + emit: + output_ch +} + +// inner workflow hook +def innerWorkflowFactory(args) { + return run_wf +} + +// defaults +meta["defaults"] = [ + // key to be used to trace the process and determine output names + key: null, + + // fixed arguments to be passed to script + args: [:], + + // default directives + directives: readJsonBlob('''{ + "tag" : "$id" +}'''), + + // auto settings + auto: readJsonBlob('''{ + "simplifyInput" : true, + "simplifyOutput" : false, + "transcript" : false, + "publish" : false +}'''), + + // Apply a map over the incoming tuple + // Example: `{ tup -> [ tup[0], [input: tup[1].output] ] + tup.drop(2) }` + map: null, + + // Apply a map over the ID element of a tuple (i.e. the first element) + // Example: `{ id -> id + "_foo" }` + mapId: null, + + // Apply a map over the data element of a tuple (i.e. the second element) + // Example: `{ data -> [ input: data.output ] }` + mapData: null, + + // Apply a map over the passthrough elements of a tuple (i.e. the tuple excl. the first two elements) + // Example: `{ pt -> pt.drop(1) }` + mapPassthrough: null, + + // Filter the channel + // Example: `{ tup -> tup[0] == "foo" }` + filter: null, + + // Choose whether or not to run the component on the tuple if the condition is true. + // Otherwise, the tuple will be passed through. + // Example: `{ tup -> tup[0] != "skip_this" }` + runIf: null, + + // Rename keys in the data field of the tuple (i.e. the second element) + // Will likely be deprecated in favour of `fromState`. + // Example: `[ "new_key": "old_key" ]` + renameKeys: null, + + // Fetch data from the state and pass it to the module without altering the current state. + // + // `fromState` should be `null`, `List[String]`, `Map[String, String]` or a function. + // + // - If it is `null`, the state will be passed to the module as is. + // - If it is a `List[String]`, the data will be the values of the state at the given keys. + // - If it is a `Map[String, String]`, the data will be the values of the state at the given keys, with the keys renamed according to the map. + // - If it is a function, the tuple (`[id, state]`) in the channel will be passed to the function, and the result will be used as the data. + // + // Example: `{ id, state -> [input: state.fastq_file] }` + // Default: `null` + fromState: null, + + // Determine how the state should be updated after the module has been run. + // + // `toState` should be `null`, `List[String]`, `Map[String, String]` or a function. + // + // - If it is `null`, the state will be replaced with the output of the module. + // - If it is a `List[String]`, the state will be updated with the values of the data at the given keys. + // - If it is a `Map[String, String]`, the state will be updated with the values of the data at the given keys, with the keys renamed according to the map. + // - If it is a function, a tuple (`[id, output, state]`) will be passed to the function, and the result will be used as the new state. + // + // Example: `{ id, output, state -> state + [counts: state.output] }` + // Default: `{ id, output, state -> output }` + toState: null, + + // Whether or not to print debug messages + // Default: `false` + debug: false +] + +// initialise default workflow +meta["workflow"] = workflowFactory([key: meta.config.name], meta.defaults, meta) + +// add workflow to environment +nextflow.script.ScriptMeta.current().addDefinition(meta.workflow) + +// anonymous workflow for running this module as a standalone +workflow { + // add id argument if it's not already in the config + // TODO: deep copy + def newConfig = deepClone(meta.config) + def newParams = deepClone(params) + + def argsContainsId = newConfig.allArguments.any{it.plainName == "id"} + if (!argsContainsId) { + def idArg = [ + 'name': '--id', + 'required': false, + 'type': 'string', + 'description': 'A unique id for every entry.', + 'multiple': false + ] + newConfig.arguments.add(0, idArg) + newConfig = processConfig(newConfig) + } + if (!newParams.containsKey("id")) { + newParams.id = "run" + } + + helpMessage(newConfig) + + channelFromParams(newParams, newConfig) + // make sure id is not in the state if id is not in the args + | map {id, state -> + if (!argsContainsId) { + [id, state.findAll{k, v -> k != "id"}] + } else { + [id, state] + } + } + | meta.workflow.run( + auto: [ publish: "state" ] + ) +} + +// END COMPONENT-SPECIFIC CODE diff --git a/target/dependencies/vsh/vsh/openpipeline/v4.1.0/_private/nextflow/workflows/multiomics/process_singlesample_base/nextflow.config b/target/dependencies/vsh/vsh/openpipeline/v4.1.0/_private/nextflow/workflows/multiomics/process_singlesample_base/nextflow.config new file mode 100644 index 0000000..3ea27ac --- /dev/null +++ b/target/dependencies/vsh/vsh/openpipeline/v4.1.0/_private/nextflow/workflows/multiomics/process_singlesample_base/nextflow.config @@ -0,0 +1,126 @@ +manifest { + name = 'workflows/multiomics/process_singlesample_base' + mainScript = 'main.nf' + nextflowVersion = '!>=20.12.1-edge' + version = 'v4.1.0' + description = 'A pipeline to analyse a single multiomics sample.' + author = 'Dorien Roosen' +} + +process.container = 'nextflow/bash:latest' + +// detect tempdir +tempDir = java.nio.file.Paths.get( + System.getenv('NXF_TEMP') ?: + System.getenv('VIASH_TEMP') ?: + System.getenv('TEMPDIR') ?: + System.getenv('TMPDIR') ?: + '/tmp' +).toAbsolutePath() + +profiles { + no_publish { + process { + withName: '.*' { + publishDir = [ + enabled: false + ] + } + } + } + mount_temp { + docker.temp = tempDir + podman.temp = tempDir + charliecloud.temp = tempDir + } + docker { + docker.enabled = true + // docker.userEmulation = true + singularity.enabled = false + podman.enabled = false + shifter.enabled = false + charliecloud.enabled = false + } + singularity { + singularity.enabled = true + singularity.autoMounts = true + docker.enabled = false + podman.enabled = false + shifter.enabled = false + charliecloud.enabled = false + } + podman { + podman.enabled = true + docker.enabled = false + singularity.enabled = false + shifter.enabled = false + charliecloud.enabled = false + } + shifter { + shifter.enabled = true + docker.enabled = false + singularity.enabled = false + podman.enabled = false + charliecloud.enabled = false + } + charliecloud { + charliecloud.enabled = true + docker.enabled = false + singularity.enabled = false + podman.enabled = false + shifter.enabled = false + } +} + +process{ + withLabel: mem1gb { memory = 1000000000.B } + withLabel: mem2gb { memory = 2000000000.B } + withLabel: mem5gb { memory = 5000000000.B } + withLabel: mem10gb { memory = 10000000000.B } + withLabel: mem20gb { memory = 20000000000.B } + withLabel: mem50gb { memory = 50000000000.B } + withLabel: mem100gb { memory = 100000000000.B } + withLabel: mem200gb { memory = 200000000000.B } + withLabel: mem500gb { memory = 500000000000.B } + withLabel: mem1tb { memory = 1000000000000.B } + withLabel: mem2tb { memory = 2000000000000.B } + withLabel: mem5tb { memory = 5000000000000.B } + withLabel: mem10tb { memory = 10000000000000.B } + withLabel: mem20tb { memory = 20000000000000.B } + withLabel: mem50tb { memory = 50000000000000.B } + withLabel: mem100tb { memory = 100000000000000.B } + withLabel: mem200tb { memory = 200000000000000.B } + withLabel: mem500tb { memory = 500000000000000.B } + withLabel: mem1gib { memory = 1073741824.B } + withLabel: mem2gib { memory = 2147483648.B } + withLabel: mem4gib { memory = 4294967296.B } + withLabel: mem8gib { memory = 8589934592.B } + withLabel: mem16gib { memory = 17179869184.B } + withLabel: mem32gib { memory = 34359738368.B } + withLabel: mem64gib { memory = 68719476736.B } + withLabel: mem128gib { memory = 137438953472.B } + withLabel: mem256gib { memory = 274877906944.B } + withLabel: mem512gib { memory = 549755813888.B } + withLabel: mem1tib { memory = 1099511627776.B } + withLabel: mem2tib { memory = 2199023255552.B } + withLabel: mem4tib { memory = 4398046511104.B } + withLabel: mem8tib { memory = 8796093022208.B } + withLabel: mem16tib { memory = 17592186044416.B } + withLabel: mem32tib { memory = 35184372088832.B } + withLabel: mem64tib { memory = 70368744177664.B } + withLabel: mem128tib { memory = 140737488355328.B } + withLabel: mem256tib { memory = 281474976710656.B } + withLabel: mem512tib { memory = 562949953421312.B } + withLabel: cpu1 { cpus = 1 } + withLabel: cpu2 { cpus = 2 } + withLabel: cpu5 { cpus = 5 } + withLabel: cpu10 { cpus = 10 } + withLabel: cpu20 { cpus = 20 } + withLabel: cpu50 { cpus = 50 } + withLabel: cpu100 { cpus = 100 } + withLabel: cpu200 { cpus = 200 } + withLabel: cpu500 { cpus = 500 } + withLabel: cpu1000 { cpus = 1000 } +} + +includeConfig("nextflow_labels.config") diff --git a/target/dependencies/vsh/vsh/openpipeline/v4.0.3/_private/nextflow/workflows/multiomics/split_modalities/nextflow_labels.config b/target/dependencies/vsh/vsh/openpipeline/v4.1.0/_private/nextflow/workflows/multiomics/process_singlesample_base/nextflow_labels.config similarity index 100% rename from target/dependencies/vsh/vsh/openpipeline/v4.0.3/_private/nextflow/workflows/multiomics/split_modalities/nextflow_labels.config rename to target/dependencies/vsh/vsh/openpipeline/v4.1.0/_private/nextflow/workflows/multiomics/process_singlesample_base/nextflow_labels.config diff --git a/target/dependencies/vsh/vsh/openpipeline/v4.0.3/_private/nextflow/workflows/multiomics/split_modalities/utils/errorstrat_ignore.config b/target/dependencies/vsh/vsh/openpipeline/v4.1.0/_private/nextflow/workflows/multiomics/process_singlesample_base/utils/errorstrat_ignore.config similarity index 100% rename from target/dependencies/vsh/vsh/openpipeline/v4.0.3/_private/nextflow/workflows/multiomics/split_modalities/utils/errorstrat_ignore.config rename to target/dependencies/vsh/vsh/openpipeline/v4.1.0/_private/nextflow/workflows/multiomics/process_singlesample_base/utils/errorstrat_ignore.config diff --git a/target/dependencies/vsh/vsh/openpipeline/v4.0.3/_private/nextflow/workflows/multiomics/split_modalities/utils/integration_tests.config b/target/dependencies/vsh/vsh/openpipeline/v4.1.0/_private/nextflow/workflows/multiomics/process_singlesample_base/utils/integration_tests.config similarity index 100% rename from target/dependencies/vsh/vsh/openpipeline/v4.0.3/_private/nextflow/workflows/multiomics/split_modalities/utils/integration_tests.config rename to target/dependencies/vsh/vsh/openpipeline/v4.1.0/_private/nextflow/workflows/multiomics/process_singlesample_base/utils/integration_tests.config diff --git a/target/dependencies/vsh/vsh/openpipeline/v4.0.3/_private/nextflow/workflows/multiomics/split_modalities/utils/labels.config b/target/dependencies/vsh/vsh/openpipeline/v4.1.0/_private/nextflow/workflows/multiomics/process_singlesample_base/utils/labels.config similarity index 100% rename from target/dependencies/vsh/vsh/openpipeline/v4.0.3/_private/nextflow/workflows/multiomics/split_modalities/utils/labels.config rename to target/dependencies/vsh/vsh/openpipeline/v4.1.0/_private/nextflow/workflows/multiomics/process_singlesample_base/utils/labels.config diff --git a/target/dependencies/vsh/vsh/openpipeline/v4.0.3/_private/nextflow/workflows/multiomics/split_modalities/utils/labels_ci.config b/target/dependencies/vsh/vsh/openpipeline/v4.1.0/_private/nextflow/workflows/multiomics/process_singlesample_base/utils/labels_ci.config similarity index 100% rename from target/dependencies/vsh/vsh/openpipeline/v4.0.3/_private/nextflow/workflows/multiomics/split_modalities/utils/labels_ci.config rename to target/dependencies/vsh/vsh/openpipeline/v4.1.0/_private/nextflow/workflows/multiomics/process_singlesample_base/utils/labels_ci.config diff --git a/target/dependencies/vsh/vsh/openpipeline/v4.0.3/_private/nextflow/workflows/multiomics/split_modalities/.config.vsh.yaml b/target/dependencies/vsh/vsh/openpipeline/v4.1.0/_private/nextflow/workflows/multiomics/split_modalities/.config.vsh.yaml similarity index 97% rename from target/dependencies/vsh/vsh/openpipeline/v4.0.3/_private/nextflow/workflows/multiomics/split_modalities/.config.vsh.yaml rename to target/dependencies/vsh/vsh/openpipeline/v4.1.0/_private/nextflow/workflows/multiomics/split_modalities/.config.vsh.yaml index 3f6fe1d..fb20d4f 100644 --- a/target/dependencies/vsh/vsh/openpipeline/v4.0.3/_private/nextflow/workflows/multiomics/split_modalities/.config.vsh.yaml +++ b/target/dependencies/vsh/vsh/openpipeline/v4.1.0/_private/nextflow/workflows/multiomics/split_modalities/.config.vsh.yaml @@ -1,6 +1,6 @@ name: "split_modalities" namespace: "workflows/multiomics" -version: "v4.0.3" +version: "v4.1.0" authors: - name: "Dries Schaumont" roles: @@ -182,14 +182,14 @@ build_info: engine: "native" output: "target/_private/nextflow/workflows/multiomics/split_modalities" executable: "target/_private/nextflow/workflows/multiomics/split_modalities/main.nf" - viash_version: "0.9.4" - git_commit: "7bfad4ea12f87eca59213be3ab08deff67cc4206" + viash_version: "0.9.7" + git_commit: "a6499fddaa8553874585c747370f919f4d7b729c" git_remote: "https://github.com/openpipelines-bio/openpipeline" dependencies: - "target/nextflow/dataflow/split_modalities" package_config: name: "openpipeline" - version: "v4.0.3" + version: "v4.1.0" summary: "Best-practice workflows for single-cell multi-omics analyses.\n" description: "OpenPipelines are extensible single cell analysis pipelines for reproducible\ \ and large-scale single cell processing using [Viash](https://viash.io) and [Nextflow](https://www.nextflow.io/).\n\ @@ -210,7 +210,7 @@ package_config: - path: "src/workflows/utils/labels_ci.config" description: "Adds the correct memory and CPU labels when running on the Viash\ \ Hub CI." - viash_version: "0.9.4" + viash_version: "0.9.7" source: "src" target: "target" config_mods: @@ -219,7 +219,7 @@ package_config: )'" - ".engines += { type: \"native\" }" - ".engines[.type == 'docker'].target_registry := 'images.viash-hub.com'" - - ".engines[.type == 'docker'].target_tag := 'v4.0.3'" + - ".engines[.type == 'docker'].target_tag := 'v4.1.0'" keywords: - "single-cell" - "multimodal" diff --git a/target/dependencies/vsh/vsh/openpipeline/v4.0.3/_private/nextflow/workflows/multiomics/split_modalities/main.nf b/target/dependencies/vsh/vsh/openpipeline/v4.1.0/_private/nextflow/workflows/multiomics/split_modalities/main.nf similarity index 97% rename from target/dependencies/vsh/vsh/openpipeline/v4.0.3/_private/nextflow/workflows/multiomics/split_modalities/main.nf rename to target/dependencies/vsh/vsh/openpipeline/v4.1.0/_private/nextflow/workflows/multiomics/split_modalities/main.nf index 4734ad5..b4bd322 100644 --- a/target/dependencies/vsh/vsh/openpipeline/v4.0.3/_private/nextflow/workflows/multiomics/split_modalities/main.nf +++ b/target/dependencies/vsh/vsh/openpipeline/v4.1.0/_private/nextflow/workflows/multiomics/split_modalities/main.nf @@ -1,6 +1,6 @@ -// split_modalities v4.0.3 +// split_modalities v4.1.0 // -// This wrapper script is auto-generated by viash 0.9.4 and is thus a derivative +// This wrapper script is auto-generated by viash 0.9.7 and is thus a derivative // work thereof. This software comes with ABSOLUTELY NO WARRANTY from Data // Intuitive. // @@ -1353,47 +1353,42 @@ def readCsv(file_path) { def splitRegex = java.util.regex.Pattern.compile(''',(?=(?:[^"]*"[^"]*")*[^"]*$)''') def removeQuote = java.util.regex.Pattern.compile('''"(.*)"''') - def br = java.nio.file.Files.newBufferedReader(inputFile) + java.nio.file.Files.newBufferedReader(inputFile).withCloseable { br -> + def row = 0 + def header = null + def line - def row = -1 - def header = null - while (br.ready() && header == null) { - def line = br.readLine() - row++ - if (!line.startsWith("#")) { - header = splitRegex.split(line, -1).collect{field -> - m = removeQuote.matcher(field) - m.find() ? m.replaceFirst('$1') : field - } - } - } - assert header != null: "CSV file should contain a header" - - while (br.ready()) { - def line = br.readLine() - row++ - if (line == null) { - br.close() - break - } - - if (!line.startsWith("#")) { - def predata = splitRegex.split(line, -1) - def data = predata.collect{field -> - if (field == "") { - return null - } - def m = removeQuote.matcher(field) - if (m.find()) { - return m.replaceFirst('$1') - } else { - return field + while (header == null && (line = br.readLine()) != null) { + if (!line.startsWith("#")) { + header = splitRegex.split(line, -1).collect { field -> + def m = removeQuote.matcher(field) + m.find() ? m.replaceFirst('$1') : field } } - assert header.size() == data.size(): "Row $row should contain the same number as fields as the header" - - def dataMap = [header, data].transpose().collectEntries().findAll{it.value != null} - output.add(dataMap) + row++ + } + assert header != null : "CSV file should contain a header" + + while ((line = br.readLine()) != null) { + row++ + if (!line.startsWith("#")) { + def predata = splitRegex.split(line, -1) + def data = predata.collect { field -> + if (field == "") { + return null + } + def m = removeQuote.matcher(field) + if (m.find()) { + return m.replaceFirst('$1') + } else { + return field + } + } + assert header.size() == data.size() : "Row $row should contain the same number as fields as the header" + + def dataMap = [header, data].transpose().collectEntries().findAll { it.value != null } + output.add(dataMap) + } } } @@ -1709,10 +1704,25 @@ process publishFilesProc { ] .transpose() .collectMany{infile, outfile -> - if (infile.toString() != outfile.toString()) { + def infileString = infile.toString() + def outfileString = outfile.toString() + if (infileString != outfileString) { + /* Trailing slashes are removed from both the source and destination arguments. + From source arguments, this is useful when a source argument may have a trailing slash + and specify a symbolic link to a directory. Without removing the slash, cp will dereference + the symbolic link. + See https://www.gnu.org/software/coreutils/manual/html_node/Trailing-slashes.html#Trailing-slashes-1 + + For the destination path addding a trailing slash is a problem when publishing directories: + it requires the destination directory to exist. This fails because we only create the parent + directories first. + */ + def regexTrailingSlashes = ~/\/+$/ + def infileNoTrailingSlash = infileString - regexTrailingSlashes + def outfileNoTrailingSlash = outfileString - regexTrailingSlashes [ - "[ -d \"\$(dirname '${outfile.toString()}')\" ] || mkdir -p \"\$(dirname '${outfile.toString()}')\"", - "cp -r '${infile.toString()}' '${outfile.toString()}'" + "[ -d \"\$(dirname '${outfileNoTrailingSlash}')\" ] || mkdir -p \"\$(dirname '${outfileNoTrailingSlash}')\"", + "cp -a '${infileNoTrailingSlash}' '${outfileNoTrailingSlash}'" ] } else { // no need to copy if infile is the same as outfile @@ -3035,7 +3045,7 @@ meta = [ "config": processConfig(readJsonBlob('''{ "name" : "split_modalities", "namespace" : "workflows/multiomics", - "version" : "v4.0.3", + "version" : "v4.1.0", "authors" : [ { "name" : "Dries Schaumont", @@ -3273,13 +3283,13 @@ meta = [ "runner" : "nextflow", "engine" : "native", "output" : "/workdir/root/repo/target/_private/nextflow/workflows/multiomics/split_modalities", - "viash_version" : "0.9.4", - "git_commit" : "7bfad4ea12f87eca59213be3ab08deff67cc4206", + "viash_version" : "0.9.7", + "git_commit" : "a6499fddaa8553874585c747370f919f4d7b729c", "git_remote" : "https://github.com/openpipelines-bio/openpipeline" }, "package_config" : { "name" : "openpipeline", - "version" : "v4.0.3", + "version" : "v4.1.0", "summary" : "Best-practice workflows for single-cell multi-omics analyses.\n", "description" : "OpenPipelines are extensible single cell analysis pipelines for reproducible and large-scale single cell processing using [Viash](https://viash.io) and [Nextflow](https://www.nextflow.io/).\n\nIn terms of workflows, the following has been made available, but keep in mind that\nindividual tools and functionality can be executed as standalone components as well.\n\n * Demultiplexing: conversion of raw sequencing data to FASTQ objects.\n * Ingestion: Read mapping and generating a count matrix.\n * Single sample processing: cell filtering and doublet detection.\n * Multisample processing: Count transformation, normalization, QC metric calulations.\n * Integration: Clustering, integration and batch correction using single and multimodal methods.\n * Downstream analysis workflows\n", "info" : { @@ -3297,14 +3307,14 @@ meta = [ } ] }, - "viash_version" : "0.9.4", + "viash_version" : "0.9.7", "source" : "/workdir/root/repo/src", "target" : "/workdir/root/repo/target", "config_mods" : [ ".resources += {path: '/src/workflows/utils/labels.config', dest: 'nextflow_labels.config'}\n.runners[.type == 'nextflow'].config.script := 'includeConfig(\\"nextflow_labels.config\\")'", ".engines += { type: \\"native\\" }", ".engines[.type == 'docker'].target_registry := 'images.viash-hub.com'", - ".engines[.type == 'docker'].target_tag := 'v4.0.3'" + ".engines[.type == 'docker'].target_tag := 'v4.1.0'" ], "keywords" : [ "single-cell", diff --git a/target/dependencies/vsh/vsh/openpipeline/v4.0.3/_private/nextflow/workflows/multiomics/split_modalities/nextflow.config b/target/dependencies/vsh/vsh/openpipeline/v4.1.0/_private/nextflow/workflows/multiomics/split_modalities/nextflow.config similarity index 99% rename from target/dependencies/vsh/vsh/openpipeline/v4.0.3/_private/nextflow/workflows/multiomics/split_modalities/nextflow.config rename to target/dependencies/vsh/vsh/openpipeline/v4.1.0/_private/nextflow/workflows/multiomics/split_modalities/nextflow.config index 958378b..2535ad3 100644 --- a/target/dependencies/vsh/vsh/openpipeline/v4.0.3/_private/nextflow/workflows/multiomics/split_modalities/nextflow.config +++ b/target/dependencies/vsh/vsh/openpipeline/v4.1.0/_private/nextflow/workflows/multiomics/split_modalities/nextflow.config @@ -2,7 +2,7 @@ manifest { name = 'workflows/multiomics/split_modalities' mainScript = 'main.nf' nextflowVersion = '!>=20.12.1-edge' - version = 'v4.0.3' + version = 'v4.1.0' description = 'A pipeline to split a multimodal mudata files into several unimodal mudata files.' author = 'Dries Schaumont' } diff --git a/target/dependencies/vsh/vsh/openpipeline/v4.0.3/_private/nextflow/workflows/rna/log_normalize/nextflow_labels.config b/target/dependencies/vsh/vsh/openpipeline/v4.1.0/_private/nextflow/workflows/multiomics/split_modalities/nextflow_labels.config similarity index 100% rename from target/dependencies/vsh/vsh/openpipeline/v4.0.3/_private/nextflow/workflows/rna/log_normalize/nextflow_labels.config rename to target/dependencies/vsh/vsh/openpipeline/v4.1.0/_private/nextflow/workflows/multiomics/split_modalities/nextflow_labels.config diff --git a/target/dependencies/vsh/vsh/openpipeline/v4.0.3/_private/nextflow/workflows/rna/log_normalize/utils/errorstrat_ignore.config b/target/dependencies/vsh/vsh/openpipeline/v4.1.0/_private/nextflow/workflows/multiomics/split_modalities/utils/errorstrat_ignore.config similarity index 100% rename from target/dependencies/vsh/vsh/openpipeline/v4.0.3/_private/nextflow/workflows/rna/log_normalize/utils/errorstrat_ignore.config rename to target/dependencies/vsh/vsh/openpipeline/v4.1.0/_private/nextflow/workflows/multiomics/split_modalities/utils/errorstrat_ignore.config diff --git a/target/dependencies/vsh/vsh/openpipeline/v4.0.3/_private/nextflow/workflows/rna/log_normalize/utils/integration_tests.config b/target/dependencies/vsh/vsh/openpipeline/v4.1.0/_private/nextflow/workflows/multiomics/split_modalities/utils/integration_tests.config similarity index 100% rename from target/dependencies/vsh/vsh/openpipeline/v4.0.3/_private/nextflow/workflows/rna/log_normalize/utils/integration_tests.config rename to target/dependencies/vsh/vsh/openpipeline/v4.1.0/_private/nextflow/workflows/multiomics/split_modalities/utils/integration_tests.config diff --git a/target/dependencies/vsh/vsh/openpipeline/v4.0.3/_private/nextflow/workflows/rna/log_normalize/utils/labels.config b/target/dependencies/vsh/vsh/openpipeline/v4.1.0/_private/nextflow/workflows/multiomics/split_modalities/utils/labels.config similarity index 100% rename from target/dependencies/vsh/vsh/openpipeline/v4.0.3/_private/nextflow/workflows/rna/log_normalize/utils/labels.config rename to target/dependencies/vsh/vsh/openpipeline/v4.1.0/_private/nextflow/workflows/multiomics/split_modalities/utils/labels.config diff --git a/target/dependencies/vsh/vsh/openpipeline/v4.0.3/_private/nextflow/workflows/rna/log_normalize/utils/labels_ci.config b/target/dependencies/vsh/vsh/openpipeline/v4.1.0/_private/nextflow/workflows/multiomics/split_modalities/utils/labels_ci.config similarity index 100% rename from target/dependencies/vsh/vsh/openpipeline/v4.0.3/_private/nextflow/workflows/rna/log_normalize/utils/labels_ci.config rename to target/dependencies/vsh/vsh/openpipeline/v4.1.0/_private/nextflow/workflows/multiomics/split_modalities/utils/labels_ci.config diff --git a/target/dependencies/vsh/vsh/openpipeline/v4.0.3/_private/nextflow/workflows/rna/log_normalize/.config.vsh.yaml b/target/dependencies/vsh/vsh/openpipeline/v4.1.0/_private/nextflow/workflows/rna/log_normalize/.config.vsh.yaml similarity index 97% rename from target/dependencies/vsh/vsh/openpipeline/v4.0.3/_private/nextflow/workflows/rna/log_normalize/.config.vsh.yaml rename to target/dependencies/vsh/vsh/openpipeline/v4.1.0/_private/nextflow/workflows/rna/log_normalize/.config.vsh.yaml index 019d7e6..9a648f3 100644 --- a/target/dependencies/vsh/vsh/openpipeline/v4.0.3/_private/nextflow/workflows/rna/log_normalize/.config.vsh.yaml +++ b/target/dependencies/vsh/vsh/openpipeline/v4.1.0/_private/nextflow/workflows/rna/log_normalize/.config.vsh.yaml @@ -1,6 +1,6 @@ name: "log_normalize" namespace: "workflows/rna" -version: "v4.0.3" +version: "v4.1.0" authors: - name: "Dries Schaumont" roles: @@ -197,8 +197,8 @@ build_info: engine: "native" output: "target/_private/nextflow/workflows/rna/log_normalize" executable: "target/_private/nextflow/workflows/rna/log_normalize/main.nf" - viash_version: "0.9.4" - git_commit: "7bfad4ea12f87eca59213be3ab08deff67cc4206" + viash_version: "0.9.7" + git_commit: "a6499fddaa8553874585c747370f919f4d7b729c" git_remote: "https://github.com/openpipelines-bio/openpipeline" dependencies: - "target/nextflow/transform/normalize_total" @@ -206,7 +206,7 @@ build_info: - "target/nextflow/transform/delete_layer" package_config: name: "openpipeline" - version: "v4.0.3" + version: "v4.1.0" summary: "Best-practice workflows for single-cell multi-omics analyses.\n" description: "OpenPipelines are extensible single cell analysis pipelines for reproducible\ \ and large-scale single cell processing using [Viash](https://viash.io) and [Nextflow](https://www.nextflow.io/).\n\ @@ -227,7 +227,7 @@ package_config: - path: "src/workflows/utils/labels_ci.config" description: "Adds the correct memory and CPU labels when running on the Viash\ \ Hub CI." - viash_version: "0.9.4" + viash_version: "0.9.7" source: "src" target: "target" config_mods: @@ -236,7 +236,7 @@ package_config: )'" - ".engines += { type: \"native\" }" - ".engines[.type == 'docker'].target_registry := 'images.viash-hub.com'" - - ".engines[.type == 'docker'].target_tag := 'v4.0.3'" + - ".engines[.type == 'docker'].target_tag := 'v4.1.0'" keywords: - "single-cell" - "multimodal" diff --git a/target/dependencies/vsh/vsh/openpipeline/v4.0.3/_private/nextflow/workflows/rna/log_normalize/main.nf b/target/dependencies/vsh/vsh/openpipeline/v4.1.0/_private/nextflow/workflows/rna/log_normalize/main.nf similarity index 97% rename from target/dependencies/vsh/vsh/openpipeline/v4.0.3/_private/nextflow/workflows/rna/log_normalize/main.nf rename to target/dependencies/vsh/vsh/openpipeline/v4.1.0/_private/nextflow/workflows/rna/log_normalize/main.nf index 348a70b..d51dc28 100644 --- a/target/dependencies/vsh/vsh/openpipeline/v4.0.3/_private/nextflow/workflows/rna/log_normalize/main.nf +++ b/target/dependencies/vsh/vsh/openpipeline/v4.1.0/_private/nextflow/workflows/rna/log_normalize/main.nf @@ -1,6 +1,6 @@ -// log_normalize v4.0.3 +// log_normalize v4.1.0 // -// This wrapper script is auto-generated by viash 0.9.4 and is thus a derivative +// This wrapper script is auto-generated by viash 0.9.7 and is thus a derivative // work thereof. This software comes with ABSOLUTELY NO WARRANTY from Data // Intuitive. // @@ -1353,47 +1353,42 @@ def readCsv(file_path) { def splitRegex = java.util.regex.Pattern.compile(''',(?=(?:[^"]*"[^"]*")*[^"]*$)''') def removeQuote = java.util.regex.Pattern.compile('''"(.*)"''') - def br = java.nio.file.Files.newBufferedReader(inputFile) + java.nio.file.Files.newBufferedReader(inputFile).withCloseable { br -> + def row = 0 + def header = null + def line - def row = -1 - def header = null - while (br.ready() && header == null) { - def line = br.readLine() - row++ - if (!line.startsWith("#")) { - header = splitRegex.split(line, -1).collect{field -> - m = removeQuote.matcher(field) - m.find() ? m.replaceFirst('$1') : field - } - } - } - assert header != null: "CSV file should contain a header" - - while (br.ready()) { - def line = br.readLine() - row++ - if (line == null) { - br.close() - break - } - - if (!line.startsWith("#")) { - def predata = splitRegex.split(line, -1) - def data = predata.collect{field -> - if (field == "") { - return null - } - def m = removeQuote.matcher(field) - if (m.find()) { - return m.replaceFirst('$1') - } else { - return field + while (header == null && (line = br.readLine()) != null) { + if (!line.startsWith("#")) { + header = splitRegex.split(line, -1).collect { field -> + def m = removeQuote.matcher(field) + m.find() ? m.replaceFirst('$1') : field } } - assert header.size() == data.size(): "Row $row should contain the same number as fields as the header" - - def dataMap = [header, data].transpose().collectEntries().findAll{it.value != null} - output.add(dataMap) + row++ + } + assert header != null : "CSV file should contain a header" + + while ((line = br.readLine()) != null) { + row++ + if (!line.startsWith("#")) { + def predata = splitRegex.split(line, -1) + def data = predata.collect { field -> + if (field == "") { + return null + } + def m = removeQuote.matcher(field) + if (m.find()) { + return m.replaceFirst('$1') + } else { + return field + } + } + assert header.size() == data.size() : "Row $row should contain the same number as fields as the header" + + def dataMap = [header, data].transpose().collectEntries().findAll { it.value != null } + output.add(dataMap) + } } } @@ -1709,10 +1704,25 @@ process publishFilesProc { ] .transpose() .collectMany{infile, outfile -> - if (infile.toString() != outfile.toString()) { + def infileString = infile.toString() + def outfileString = outfile.toString() + if (infileString != outfileString) { + /* Trailing slashes are removed from both the source and destination arguments. + From source arguments, this is useful when a source argument may have a trailing slash + and specify a symbolic link to a directory. Without removing the slash, cp will dereference + the symbolic link. + See https://www.gnu.org/software/coreutils/manual/html_node/Trailing-slashes.html#Trailing-slashes-1 + + For the destination path addding a trailing slash is a problem when publishing directories: + it requires the destination directory to exist. This fails because we only create the parent + directories first. + */ + def regexTrailingSlashes = ~/\/+$/ + def infileNoTrailingSlash = infileString - regexTrailingSlashes + def outfileNoTrailingSlash = outfileString - regexTrailingSlashes [ - "[ -d \"\$(dirname '${outfile.toString()}')\" ] || mkdir -p \"\$(dirname '${outfile.toString()}')\"", - "cp -r '${infile.toString()}' '${outfile.toString()}'" + "[ -d \"\$(dirname '${outfileNoTrailingSlash}')\" ] || mkdir -p \"\$(dirname '${outfileNoTrailingSlash}')\"", + "cp -a '${infileNoTrailingSlash}' '${outfileNoTrailingSlash}'" ] } else { // no need to copy if infile is the same as outfile @@ -3035,7 +3045,7 @@ meta = [ "config": processConfig(readJsonBlob('''{ "name" : "log_normalize", "namespace" : "workflows/rna", - "version" : "v4.0.3", + "version" : "v4.1.0", "authors" : [ { "name" : "Dries Schaumont", @@ -3293,13 +3303,13 @@ meta = [ "runner" : "nextflow", "engine" : "native", "output" : "/workdir/root/repo/target/_private/nextflow/workflows/rna/log_normalize", - "viash_version" : "0.9.4", - "git_commit" : "7bfad4ea12f87eca59213be3ab08deff67cc4206", + "viash_version" : "0.9.7", + "git_commit" : "a6499fddaa8553874585c747370f919f4d7b729c", "git_remote" : "https://github.com/openpipelines-bio/openpipeline" }, "package_config" : { "name" : "openpipeline", - "version" : "v4.0.3", + "version" : "v4.1.0", "summary" : "Best-practice workflows for single-cell multi-omics analyses.\n", "description" : "OpenPipelines are extensible single cell analysis pipelines for reproducible and large-scale single cell processing using [Viash](https://viash.io) and [Nextflow](https://www.nextflow.io/).\n\nIn terms of workflows, the following has been made available, but keep in mind that\nindividual tools and functionality can be executed as standalone components as well.\n\n * Demultiplexing: conversion of raw sequencing data to FASTQ objects.\n * Ingestion: Read mapping and generating a count matrix.\n * Single sample processing: cell filtering and doublet detection.\n * Multisample processing: Count transformation, normalization, QC metric calulations.\n * Integration: Clustering, integration and batch correction using single and multimodal methods.\n * Downstream analysis workflows\n", "info" : { @@ -3317,14 +3327,14 @@ meta = [ } ] }, - "viash_version" : "0.9.4", + "viash_version" : "0.9.7", "source" : "/workdir/root/repo/src", "target" : "/workdir/root/repo/target", "config_mods" : [ ".resources += {path: '/src/workflows/utils/labels.config', dest: 'nextflow_labels.config'}\n.runners[.type == 'nextflow'].config.script := 'includeConfig(\\"nextflow_labels.config\\")'", ".engines += { type: \\"native\\" }", ".engines[.type == 'docker'].target_registry := 'images.viash-hub.com'", - ".engines[.type == 'docker'].target_tag := 'v4.0.3'" + ".engines[.type == 'docker'].target_tag := 'v4.1.0'" ], "keywords" : [ "single-cell", diff --git a/target/dependencies/vsh/vsh/openpipeline/v4.0.3/_private/nextflow/workflows/rna/log_normalize/nextflow.config b/target/dependencies/vsh/vsh/openpipeline/v4.1.0/_private/nextflow/workflows/rna/log_normalize/nextflow.config similarity index 99% rename from target/dependencies/vsh/vsh/openpipeline/v4.0.3/_private/nextflow/workflows/rna/log_normalize/nextflow.config rename to target/dependencies/vsh/vsh/openpipeline/v4.1.0/_private/nextflow/workflows/rna/log_normalize/nextflow.config index 51c0bc3..c840b01 100644 --- a/target/dependencies/vsh/vsh/openpipeline/v4.0.3/_private/nextflow/workflows/rna/log_normalize/nextflow.config +++ b/target/dependencies/vsh/vsh/openpipeline/v4.1.0/_private/nextflow/workflows/rna/log_normalize/nextflow.config @@ -2,7 +2,7 @@ manifest { name = 'workflows/rna/log_normalize' mainScript = 'main.nf' nextflowVersion = '!>=20.12.1-edge' - version = 'v4.0.3' + version = 'v4.1.0' description = 'Performs normalization and subsequent log-transformation of raw count data.' author = 'Dries Schaumont' } diff --git a/target/dependencies/vsh/vsh/openpipeline/v4.0.3/nextflow/cluster/leiden/nextflow_labels.config b/target/dependencies/vsh/vsh/openpipeline/v4.1.0/_private/nextflow/workflows/rna/log_normalize/nextflow_labels.config similarity index 100% rename from target/dependencies/vsh/vsh/openpipeline/v4.0.3/nextflow/cluster/leiden/nextflow_labels.config rename to target/dependencies/vsh/vsh/openpipeline/v4.1.0/_private/nextflow/workflows/rna/log_normalize/nextflow_labels.config diff --git a/target/dependencies/vsh/vsh/openpipeline/v4.0.3/nextflow/workflows/gdo/gdo_singlesample/utils/errorstrat_ignore.config b/target/dependencies/vsh/vsh/openpipeline/v4.1.0/_private/nextflow/workflows/rna/log_normalize/utils/errorstrat_ignore.config similarity index 100% rename from target/dependencies/vsh/vsh/openpipeline/v4.0.3/nextflow/workflows/gdo/gdo_singlesample/utils/errorstrat_ignore.config rename to target/dependencies/vsh/vsh/openpipeline/v4.1.0/_private/nextflow/workflows/rna/log_normalize/utils/errorstrat_ignore.config diff --git a/target/dependencies/vsh/vsh/openpipeline/v4.0.3/nextflow/workflows/gdo/gdo_singlesample/utils/integration_tests.config b/target/dependencies/vsh/vsh/openpipeline/v4.1.0/_private/nextflow/workflows/rna/log_normalize/utils/integration_tests.config similarity index 100% rename from target/dependencies/vsh/vsh/openpipeline/v4.0.3/nextflow/workflows/gdo/gdo_singlesample/utils/integration_tests.config rename to target/dependencies/vsh/vsh/openpipeline/v4.1.0/_private/nextflow/workflows/rna/log_normalize/utils/integration_tests.config diff --git a/target/dependencies/vsh/vsh/openpipeline/v4.0.3/nextflow/workflows/gdo/gdo_singlesample/utils/labels.config b/target/dependencies/vsh/vsh/openpipeline/v4.1.0/_private/nextflow/workflows/rna/log_normalize/utils/labels.config similarity index 100% rename from target/dependencies/vsh/vsh/openpipeline/v4.0.3/nextflow/workflows/gdo/gdo_singlesample/utils/labels.config rename to target/dependencies/vsh/vsh/openpipeline/v4.1.0/_private/nextflow/workflows/rna/log_normalize/utils/labels.config diff --git a/target/dependencies/vsh/vsh/openpipeline/v4.0.3/nextflow/workflows/gdo/gdo_singlesample/utils/labels_ci.config b/target/dependencies/vsh/vsh/openpipeline/v4.1.0/_private/nextflow/workflows/rna/log_normalize/utils/labels_ci.config similarity index 100% rename from target/dependencies/vsh/vsh/openpipeline/v4.0.3/nextflow/workflows/gdo/gdo_singlesample/utils/labels_ci.config rename to target/dependencies/vsh/vsh/openpipeline/v4.1.0/_private/nextflow/workflows/rna/log_normalize/utils/labels_ci.config diff --git a/target/dependencies/vsh/vsh/openpipeline/v4.0.3/nextflow/cluster/leiden/.config.vsh.yaml b/target/dependencies/vsh/vsh/openpipeline/v4.1.0/nextflow/cluster/leiden/.config.vsh.yaml similarity index 86% rename from target/dependencies/vsh/vsh/openpipeline/v4.0.3/nextflow/cluster/leiden/.config.vsh.yaml rename to target/dependencies/vsh/vsh/openpipeline/v4.1.0/nextflow/cluster/leiden/.config.vsh.yaml index ee5f27d..74a56b7 100644 --- a/target/dependencies/vsh/vsh/openpipeline/v4.0.3/nextflow/cluster/leiden/.config.vsh.yaml +++ b/target/dependencies/vsh/vsh/openpipeline/v4.1.0/nextflow/cluster/leiden/.config.vsh.yaml @@ -1,6 +1,6 @@ name: "leiden" namespace: "cluster" -version: "v4.0.3" +version: "v4.1.0" authors: - name: "Dries De Maeyer" roles: @@ -77,6 +77,41 @@ argument_groups: direction: "input" multiple: false multiple_sep: ";" + - type: "string" + name: "--flavor" + description: "Which package's implementation to use.\n" + info: null + default: + - "leidenalg" + required: false + choices: + - "leidenalg" + - "igraph" + direction: "input" + multiple: false + multiple_sep: ";" + - type: "integer" + name: "--n_iterations" + description: "How many iterations of the Leiden clustering algorithm to perform.\n\ + When defined, positive values above 2 define the total number of iterations\ + \ to perform.\nWhen not set, the algorithm will run until it reaches its optimal\ + \ clustering.\n" + info: null + required: false + min: 1 + direction: "input" + multiple: false + multiple_sep: ";" + - type: "integer" + name: "--seed" + description: "Fix the initialization of the optimization. Can be used to increase\ + \ reproducibility.\n" + info: null + required: false + min: 0 + direction: "input" + multiple: false + multiple_sep: ";" - type: "double" name: "--resolution" description: "A parameter value controlling the coarseness of the clustering.\ @@ -91,8 +126,8 @@ argument_groups: multiple_sep: ";" - type: "string" name: "--output_compression" - description: "Compression format to use for the output AnnData and/or Mudata objects.\n\ - By default no compression is applied.\n" + description: "Compression format to use for the output AnnData and/or Mudata H5\ + \ files.\nBy default no compression is applied.\n" info: null example: - "gzip" @@ -215,7 +250,7 @@ engines: id: "docker" image: "python:3.13-slim" target_registry: "images.viash-hub.com" - target_tag: "v4.0.3" + target_tag: "v4.1.0" namespace_separator: "/" setup: - type: "apt" @@ -225,11 +260,12 @@ engines: - type: "python" user: false packages: - - "anndata~=0.12.7" + - "anndata~=0.12.16" - "awkward" - - "mudata~=0.3.2" + - "scipy~=1.17.1" + - "mudata~=0.3.8" - "scanpy~=1.11.4" - - "leidenalg~=0.10.0" + - "leidenalg~=0.11.0" script: - "exec(\"try:\\n import zarr; from importlib.metadata import version\\nexcept\ \ ModuleNotFoundError:\\n exit(0)\\nelse: assert int(version(\\\"zarr\\\"\ @@ -243,7 +279,7 @@ engines: - type: "python" user: false packages: - - "viashpy==0.8.0" + - "viashpy==0.10.0" github: - "openpipelines-bio/core#subdirectory=packages/python/openpipeline_testutils" upgrade: true @@ -257,12 +293,12 @@ build_info: engine: "docker|native" output: "target/nextflow/cluster/leiden" executable: "target/nextflow/cluster/leiden/main.nf" - viash_version: "0.9.4" - git_commit: "7bfad4ea12f87eca59213be3ab08deff67cc4206" + viash_version: "0.9.7" + git_commit: "a6499fddaa8553874585c747370f919f4d7b729c" git_remote: "https://github.com/openpipelines-bio/openpipeline" package_config: name: "openpipeline" - version: "v4.0.3" + version: "v4.1.0" summary: "Best-practice workflows for single-cell multi-omics analyses.\n" description: "OpenPipelines are extensible single cell analysis pipelines for reproducible\ \ and large-scale single cell processing using [Viash](https://viash.io) and [Nextflow](https://www.nextflow.io/).\n\ @@ -283,7 +319,7 @@ package_config: - path: "src/workflows/utils/labels_ci.config" description: "Adds the correct memory and CPU labels when running on the Viash\ \ Hub CI." - viash_version: "0.9.4" + viash_version: "0.9.7" source: "src" target: "target" config_mods: @@ -292,7 +328,7 @@ package_config: )'" - ".engines += { type: \"native\" }" - ".engines[.type == 'docker'].target_registry := 'images.viash-hub.com'" - - ".engines[.type == 'docker'].target_tag := 'v4.0.3'" + - ".engines[.type == 'docker'].target_tag := 'v4.1.0'" keywords: - "single-cell" - "multimodal" diff --git a/target/dependencies/vsh/vsh/openpipeline/v4.0.3/nextflow/cluster/leiden/compress_h5mu.py b/target/dependencies/vsh/vsh/openpipeline/v4.1.0/nextflow/cluster/leiden/compress_h5mu.py similarity index 100% rename from target/dependencies/vsh/vsh/openpipeline/v4.0.3/nextflow/cluster/leiden/compress_h5mu.py rename to target/dependencies/vsh/vsh/openpipeline/v4.1.0/nextflow/cluster/leiden/compress_h5mu.py diff --git a/target/dependencies/vsh/vsh/openpipeline/v4.0.3/nextflow/cluster/leiden/main.nf b/target/dependencies/vsh/vsh/openpipeline/v4.1.0/nextflow/cluster/leiden/main.nf similarity index 96% rename from target/dependencies/vsh/vsh/openpipeline/v4.0.3/nextflow/cluster/leiden/main.nf rename to target/dependencies/vsh/vsh/openpipeline/v4.1.0/nextflow/cluster/leiden/main.nf index c2c32f8..6cae82b 100644 --- a/target/dependencies/vsh/vsh/openpipeline/v4.0.3/nextflow/cluster/leiden/main.nf +++ b/target/dependencies/vsh/vsh/openpipeline/v4.1.0/nextflow/cluster/leiden/main.nf @@ -1,6 +1,6 @@ -// leiden v4.0.3 +// leiden v4.1.0 // -// This wrapper script is auto-generated by viash 0.9.4 and is thus a derivative +// This wrapper script is auto-generated by viash 0.9.7 and is thus a derivative // work thereof. This software comes with ABSOLUTELY NO WARRANTY from Data // Intuitive. // @@ -1353,47 +1353,42 @@ def readCsv(file_path) { def splitRegex = java.util.regex.Pattern.compile(''',(?=(?:[^"]*"[^"]*")*[^"]*$)''') def removeQuote = java.util.regex.Pattern.compile('''"(.*)"''') - def br = java.nio.file.Files.newBufferedReader(inputFile) + java.nio.file.Files.newBufferedReader(inputFile).withCloseable { br -> + def row = 0 + def header = null + def line - def row = -1 - def header = null - while (br.ready() && header == null) { - def line = br.readLine() - row++ - if (!line.startsWith("#")) { - header = splitRegex.split(line, -1).collect{field -> - m = removeQuote.matcher(field) - m.find() ? m.replaceFirst('$1') : field - } - } - } - assert header != null: "CSV file should contain a header" - - while (br.ready()) { - def line = br.readLine() - row++ - if (line == null) { - br.close() - break - } - - if (!line.startsWith("#")) { - def predata = splitRegex.split(line, -1) - def data = predata.collect{field -> - if (field == "") { - return null - } - def m = removeQuote.matcher(field) - if (m.find()) { - return m.replaceFirst('$1') - } else { - return field + while (header == null && (line = br.readLine()) != null) { + if (!line.startsWith("#")) { + header = splitRegex.split(line, -1).collect { field -> + def m = removeQuote.matcher(field) + m.find() ? m.replaceFirst('$1') : field } } - assert header.size() == data.size(): "Row $row should contain the same number as fields as the header" - - def dataMap = [header, data].transpose().collectEntries().findAll{it.value != null} - output.add(dataMap) + row++ + } + assert header != null : "CSV file should contain a header" + + while ((line = br.readLine()) != null) { + row++ + if (!line.startsWith("#")) { + def predata = splitRegex.split(line, -1) + def data = predata.collect { field -> + if (field == "") { + return null + } + def m = removeQuote.matcher(field) + if (m.find()) { + return m.replaceFirst('$1') + } else { + return field + } + } + assert header.size() == data.size() : "Row $row should contain the same number as fields as the header" + + def dataMap = [header, data].transpose().collectEntries().findAll { it.value != null } + output.add(dataMap) + } } } @@ -1709,10 +1704,25 @@ process publishFilesProc { ] .transpose() .collectMany{infile, outfile -> - if (infile.toString() != outfile.toString()) { + def infileString = infile.toString() + def outfileString = outfile.toString() + if (infileString != outfileString) { + /* Trailing slashes are removed from both the source and destination arguments. + From source arguments, this is useful when a source argument may have a trailing slash + and specify a symbolic link to a directory. Without removing the slash, cp will dereference + the symbolic link. + See https://www.gnu.org/software/coreutils/manual/html_node/Trailing-slashes.html#Trailing-slashes-1 + + For the destination path addding a trailing slash is a problem when publishing directories: + it requires the destination directory to exist. This fails because we only create the parent + directories first. + */ + def regexTrailingSlashes = ~/\/+$/ + def infileNoTrailingSlash = infileString - regexTrailingSlashes + def outfileNoTrailingSlash = outfileString - regexTrailingSlashes [ - "[ -d \"\$(dirname '${outfile.toString()}')\" ] || mkdir -p \"\$(dirname '${outfile.toString()}')\"", - "cp -r '${infile.toString()}' '${outfile.toString()}'" + "[ -d \"\$(dirname '${outfileNoTrailingSlash}')\" ] || mkdir -p \"\$(dirname '${outfileNoTrailingSlash}')\"", + "cp -a '${infileNoTrailingSlash}' '${outfileNoTrailingSlash}'" ] } else { // no need to copy if infile is the same as outfile @@ -3035,7 +3045,7 @@ meta = [ "config": processConfig(readJsonBlob('''{ "name" : "leiden", "namespace" : "cluster", - "version" : "v4.0.3", + "version" : "v4.1.0", "authors" : [ { "name" : "Dries De Maeyer", @@ -3133,6 +3143,42 @@ meta = [ "multiple" : false, "multiple_sep" : ";" }, + { + "type" : "string", + "name" : "--flavor", + "description" : "Which package's implementation to use.\n", + "default" : [ + "leidenalg" + ], + "required" : false, + "choices" : [ + "leidenalg", + "igraph" + ], + "direction" : "input", + "multiple" : false, + "multiple_sep" : ";" + }, + { + "type" : "integer", + "name" : "--n_iterations", + "description" : "How many iterations of the Leiden clustering algorithm to perform.\nWhen defined, positive values above 2 define the total number of iterations to perform.\nWhen not set, the algorithm will run until it reaches its optimal clustering.\n", + "required" : false, + "min" : 1, + "direction" : "input", + "multiple" : false, + "multiple_sep" : ";" + }, + { + "type" : "integer", + "name" : "--seed", + "description" : "Fix the initialization of the optimization. Can be used to increase reproducibility.\n", + "required" : false, + "min" : 0, + "direction" : "input", + "multiple" : false, + "multiple_sep" : ";" + }, { "type" : "double", "name" : "--resolution", @@ -3148,7 +3194,7 @@ meta = [ { "type" : "string", "name" : "--output_compression", - "description" : "Compression format to use for the output AnnData and/or Mudata objects.\nBy default no compression is applied.\n", + "description" : "Compression format to use for the output AnnData and/or Mudata H5 files.\nBy default no compression is applied.\n", "example" : [ "gzip" ], @@ -3294,7 +3340,7 @@ meta = [ "id" : "docker", "image" : "python:3.13-slim", "target_registry" : "images.viash-hub.com", - "target_tag" : "v4.0.3", + "target_tag" : "v4.1.0", "namespace_separator" : "/", "setup" : [ { @@ -3308,11 +3354,12 @@ meta = [ "type" : "python", "user" : false, "packages" : [ - "anndata~=0.12.7", + "anndata~=0.12.16", "awkward", - "mudata~=0.3.2", + "scipy~=1.17.1", + "mudata~=0.3.8", "scanpy~=1.11.4", - "leidenalg~=0.10.0" + "leidenalg~=0.11.0" ], "script" : [ "exec(\\"try:\\\\n import zarr; from importlib.metadata import version\\\\nexcept ModuleNotFoundError:\\\\n exit(0)\\\\nelse: assert int(version(\\\\\\"zarr\\\\\\").partition(\\\\\\".\\\\\\")[0]) > 2\\")" @@ -3332,7 +3379,7 @@ meta = [ "type" : "python", "user" : false, "packages" : [ - "viashpy==0.8.0" + "viashpy==0.10.0" ], "github" : [ "openpipelines-bio/core#subdirectory=packages/python/openpipeline_testutils" @@ -3351,13 +3398,13 @@ meta = [ "runner" : "nextflow", "engine" : "docker|native", "output" : "/workdir/root/repo/target/nextflow/cluster/leiden", - "viash_version" : "0.9.4", - "git_commit" : "7bfad4ea12f87eca59213be3ab08deff67cc4206", + "viash_version" : "0.9.7", + "git_commit" : "a6499fddaa8553874585c747370f919f4d7b729c", "git_remote" : "https://github.com/openpipelines-bio/openpipeline" }, "package_config" : { "name" : "openpipeline", - "version" : "v4.0.3", + "version" : "v4.1.0", "summary" : "Best-practice workflows for single-cell multi-omics analyses.\n", "description" : "OpenPipelines are extensible single cell analysis pipelines for reproducible and large-scale single cell processing using [Viash](https://viash.io) and [Nextflow](https://www.nextflow.io/).\n\nIn terms of workflows, the following has been made available, but keep in mind that\nindividual tools and functionality can be executed as standalone components as well.\n\n * Demultiplexing: conversion of raw sequencing data to FASTQ objects.\n * Ingestion: Read mapping and generating a count matrix.\n * Single sample processing: cell filtering and doublet detection.\n * Multisample processing: Count transformation, normalization, QC metric calulations.\n * Integration: Clustering, integration and batch correction using single and multimodal methods.\n * Downstream analysis workflows\n", "info" : { @@ -3375,14 +3422,14 @@ meta = [ } ] }, - "viash_version" : "0.9.4", + "viash_version" : "0.9.7", "source" : "/workdir/root/repo/src", "target" : "/workdir/root/repo/target", "config_mods" : [ ".resources += {path: '/src/workflows/utils/labels.config', dest: 'nextflow_labels.config'}\n.runners[.type == 'nextflow'].config.script := 'includeConfig(\\"nextflow_labels.config\\")'", ".engines += { type: \\"native\\" }", ".engines[.type == 'docker'].target_registry := 'images.viash-hub.com'", - ".engines[.type == 'docker'].target_tag := 'v4.0.3'" + ".engines[.type == 'docker'].target_tag := 'v4.1.0'" ], "keywords" : [ "single-cell", @@ -3416,7 +3463,6 @@ import os import time import logging import logging.handlers -import warnings import h5py import mudata as mu import pandas as pd @@ -3438,6 +3484,9 @@ par = { 'obsp_connectivities': $( if [ ! -z ${VIASH_PAR_OBSP_CONNECTIVITIES+x} ]; then echo "r'${VIASH_PAR_OBSP_CONNECTIVITIES//\\'/\\'\\"\\'\\"r\\'}'"; else echo None; fi ), 'output': $( if [ ! -z ${VIASH_PAR_OUTPUT+x} ]; then echo "r'${VIASH_PAR_OUTPUT//\\'/\\'\\"\\'\\"r\\'}'"; else echo None; fi ), 'obsm_name': $( if [ ! -z ${VIASH_PAR_OBSM_NAME+x} ]; then echo "r'${VIASH_PAR_OBSM_NAME//\\'/\\'\\"\\'\\"r\\'}'"; else echo None; fi ), + 'flavor': $( if [ ! -z ${VIASH_PAR_FLAVOR+x} ]; then echo "r'${VIASH_PAR_FLAVOR//\\'/\\'\\"\\'\\"r\\'}'"; else echo None; fi ), + 'n_iterations': $( if [ ! -z ${VIASH_PAR_N_ITERATIONS+x} ]; then echo "int(r'${VIASH_PAR_N_ITERATIONS//\\'/\\'\\"\\'\\"r\\'}')"; else echo None; fi ), + 'seed': $( if [ ! -z ${VIASH_PAR_SEED+x} ]; then echo "int(r'${VIASH_PAR_SEED//\\'/\\'\\"\\'\\"r\\'}')"; else echo None; fi ), 'resolution': $( if [ ! -z ${VIASH_PAR_RESOLUTION+x} ]; then echo "list(map(float, r'${VIASH_PAR_RESOLUTION//\\'/\\'\\"\\'\\"r\\'}'.split(';')))"; else echo None; fi ), 'output_compression': $( if [ ! -z ${VIASH_PAR_OUTPUT_COMPRESSION+x} ]; then echo "r'${VIASH_PAR_OUTPUT_COMPRESSION//\\'/\\'\\"\\'\\"r\\'}'"; else echo None; fi ) } @@ -3473,6 +3522,9 @@ from compress_h5mu import compress_h5mu _shared_logger_name = "leiden" +if not par["n_iterations"]: + par["n_iterations"] = -1 + # Function to check available space in /dev/shm def get_available_shared_memory(): @@ -3571,18 +3623,18 @@ def run_single_resolution(shared_csr_matrix, obs_names, resolution): try: connectivities = shared_csr_matrix.to_csr_matrix() adata = create_empty_anndata_with_connectivities(connectivities, obs_names) - with warnings.catch_warnings(): - # In the future, the default backend for leiden will be igraph instead of leidenalg. - warnings.simplefilter(action="ignore", category=FutureWarning) - adata_out = sc.tl.leiden( - adata, - resolution=resolution, - key_added=str(resolution), - obsp="connectivities", - copy=True, - ) + sc.tl.leiden( + adata, + resolution=resolution, + key_added=str(resolution), + obsp="connectivities", + flavor=par["flavor"], + n_iterations=par["n_iterations"], + random_state=par["seed"], + copy=False, # A copy was already created above + ) logger.info(f"Returning result for resolution {resolution}") - return adata_out.obs[str(resolution)] + return adata.obs[str(resolution)] finally: obs_names.shm.close() shared_csr_matrix.close() @@ -4147,7 +4199,7 @@ meta["defaults"] = [ "container" : { "registry" : "images.viash-hub.com", "image" : "vsh/openpipeline/cluster/leiden", - "tag" : "v4.0.3" + "tag" : "v4.1.0" }, "label" : [ "highcpu", diff --git a/target/dependencies/vsh/vsh/openpipeline/v4.0.3/nextflow/cluster/leiden/nextflow.config b/target/dependencies/vsh/vsh/openpipeline/v4.1.0/nextflow/cluster/leiden/nextflow.config similarity index 99% rename from target/dependencies/vsh/vsh/openpipeline/v4.0.3/nextflow/cluster/leiden/nextflow.config rename to target/dependencies/vsh/vsh/openpipeline/v4.1.0/nextflow/cluster/leiden/nextflow.config index e2ff599..e022a9c 100644 --- a/target/dependencies/vsh/vsh/openpipeline/v4.0.3/nextflow/cluster/leiden/nextflow.config +++ b/target/dependencies/vsh/vsh/openpipeline/v4.1.0/nextflow/cluster/leiden/nextflow.config @@ -2,7 +2,7 @@ manifest { name = 'cluster/leiden' mainScript = 'main.nf' nextflowVersion = '!>=20.12.1-edge' - version = 'v4.0.3' + version = 'v4.1.0' description = 'Cluster cells using the [Leiden algorithm] [Traag18] implemented in the [Scanpy framework] [Wolf18]. \nLeiden is an improved version of the [Louvain algorithm] [Blondel08]. \nIt has been proposed for single-cell analysis by [Levine15] [Levine15]. \nThis requires having ran `neighbors/find_neighbors` or `neighbors/bbknn` first.\n\n[Blondel08]: Blondel et al. (2008), Fast unfolding of communities in large networks, J. Stat. Mech. \n[Levine15]: Levine et al. (2015), Data-Driven Phenotypic Dissection of AML Reveals Progenitor-like Cells that Correlate with Prognosis, Cell. \n[Traag18]: Traag et al. (2018), From Louvain to Leiden: guaranteeing well-connected communities arXiv. \n[Wolf18]: Wolf et al. (2018), Scanpy: large-scale single-cell gene expression data analysis, Genome Biology. \n' author = 'Dries De Maeyer' } diff --git a/target/dependencies/vsh/vsh/openpipeline/v4.0.3/nextflow/dataflow/concatenate_h5mu/nextflow_labels.config b/target/dependencies/vsh/vsh/openpipeline/v4.1.0/nextflow/cluster/leiden/nextflow_labels.config similarity index 100% rename from target/dependencies/vsh/vsh/openpipeline/v4.0.3/nextflow/dataflow/concatenate_h5mu/nextflow_labels.config rename to target/dependencies/vsh/vsh/openpipeline/v4.1.0/nextflow/cluster/leiden/nextflow_labels.config diff --git a/target/dependencies/vsh/vsh/openpipeline/v4.0.3/nextflow/cluster/leiden/nextflow_schema.json b/target/dependencies/vsh/vsh/openpipeline/v4.1.0/nextflow/cluster/leiden/nextflow_schema.json similarity index 79% rename from target/dependencies/vsh/vsh/openpipeline/v4.0.3/nextflow/cluster/leiden/nextflow_schema.json rename to target/dependencies/vsh/vsh/openpipeline/v4.1.0/nextflow/cluster/leiden/nextflow_schema.json index cb2d024..91493e8 100644 --- a/target/dependencies/vsh/vsh/openpipeline/v4.0.3/nextflow/cluster/leiden/nextflow_schema.json +++ b/target/dependencies/vsh/vsh/openpipeline/v4.1.0/nextflow/cluster/leiden/nextflow_schema.json @@ -41,6 +41,26 @@ "help_text": "Type: `string`, multiple: `False`, default: `\"leiden\"`. ", "default": "leiden" }, + "flavor": { + "type": "string", + "description": "Which package's implementation to use.\n", + "help_text": "Type: `string`, multiple: `False`, default: `\"leidenalg\"`, choices: ``leidenalg`, `igraph``. ", + "enum": [ + "leidenalg", + "igraph" + ], + "default": "leidenalg" + }, + "n_iterations": { + "type": "integer", + "description": "How many iterations of the Leiden clustering algorithm to perform.\nWhen defined, positive values above 2 define the total number of iterations to perform.\nWhen not set, the algorithm will run until it reaches its optimal clustering.\n", + "help_text": "Type: `integer`, multiple: `False`. " + }, + "seed": { + "type": "integer", + "description": "Fix the initialization of the optimization", + "help_text": "Type: `integer`, multiple: `False`. " + }, "resolution": { "type": "array", "items": { @@ -54,7 +74,7 @@ }, "output_compression": { "type": "string", - "description": "Compression format to use for the output AnnData and/or Mudata objects.\nBy default no compression is applied.\n", + "description": "Compression format to use for the output AnnData and/or Mudata H5 files.\nBy default no compression is applied.\n", "help_text": "Type: `string`, multiple: `False`, example: `\"gzip\"`, choices: ``gzip`, `lzf``. ", "enum": [ "gzip", diff --git a/target/dependencies/vsh/vsh/openpipeline/v4.0.3/nextflow/cluster/leiden/setup_logger.py b/target/dependencies/vsh/vsh/openpipeline/v4.1.0/nextflow/cluster/leiden/setup_logger.py similarity index 100% rename from target/dependencies/vsh/vsh/openpipeline/v4.0.3/nextflow/cluster/leiden/setup_logger.py rename to target/dependencies/vsh/vsh/openpipeline/v4.1.0/nextflow/cluster/leiden/setup_logger.py diff --git a/target/dependencies/vsh/vsh/openpipeline/v4.0.3/nextflow/dataflow/concatenate_h5mu/.config.vsh.yaml b/target/dependencies/vsh/vsh/openpipeline/v4.1.0/nextflow/dataflow/concatenate_h5mu/.config.vsh.yaml similarity index 96% rename from target/dependencies/vsh/vsh/openpipeline/v4.0.3/nextflow/dataflow/concatenate_h5mu/.config.vsh.yaml rename to target/dependencies/vsh/vsh/openpipeline/v4.1.0/nextflow/dataflow/concatenate_h5mu/.config.vsh.yaml index fc0d331..f32b071 100644 --- a/target/dependencies/vsh/vsh/openpipeline/v4.0.3/nextflow/dataflow/concatenate_h5mu/.config.vsh.yaml +++ b/target/dependencies/vsh/vsh/openpipeline/v4.1.0/nextflow/dataflow/concatenate_h5mu/.config.vsh.yaml @@ -1,6 +1,6 @@ name: "concatenate_h5mu" namespace: "dataflow" -version: "v4.0.3" +version: "v4.1.0" authors: - name: "Dries Schaumont" roles: @@ -136,8 +136,8 @@ argument_groups: multiple_sep: ";" - type: "string" name: "--output_compression" - description: "Compression format to use for the output AnnData and/or Mudata objects.\n\ - By default no compression is applied.\n" + description: "Compression format to use for the output AnnData and/or Mudata H5\ + \ files.\nBy default no compression is applied.\n" info: null example: - "gzip" @@ -253,7 +253,7 @@ engines: id: "docker" image: "python:3.13-slim" target_registry: "images.viash-hub.com" - target_tag: "v4.0.3" + target_tag: "v4.1.0" namespace_separator: "/" setup: - type: "apt" @@ -263,9 +263,10 @@ engines: - type: "python" user: false packages: - - "anndata~=0.12.7" + - "anndata~=0.12.16" - "awkward" - - "mudata~=0.3.2" + - "scipy~=1.17.1" + - "mudata~=0.3.8" script: - "exec(\"try:\\n import zarr; from importlib.metadata import version\\nexcept\ \ ModuleNotFoundError:\\n exit(0)\\nelse: assert int(version(\\\"zarr\\\"\ @@ -279,14 +280,14 @@ engines: - type: "python" user: false packages: - - "viashpy==0.8.0" + - "viashpy==0.10.0" github: - "openpipelines-bio/core#subdirectory=packages/python/openpipeline_testutils" upgrade: true - type: "python" user: false packages: - - "viashpy==0.8.0" + - "viashpy==0.10.0" - "pytest-benchmark" upgrade: true entrypoint: [] @@ -299,12 +300,12 @@ build_info: engine: "docker|native" output: "target/nextflow/dataflow/concatenate_h5mu" executable: "target/nextflow/dataflow/concatenate_h5mu/main.nf" - viash_version: "0.9.4" - git_commit: "7bfad4ea12f87eca59213be3ab08deff67cc4206" + viash_version: "0.9.7" + git_commit: "a6499fddaa8553874585c747370f919f4d7b729c" git_remote: "https://github.com/openpipelines-bio/openpipeline" package_config: name: "openpipeline" - version: "v4.0.3" + version: "v4.1.0" summary: "Best-practice workflows for single-cell multi-omics analyses.\n" description: "OpenPipelines are extensible single cell analysis pipelines for reproducible\ \ and large-scale single cell processing using [Viash](https://viash.io) and [Nextflow](https://www.nextflow.io/).\n\ @@ -325,7 +326,7 @@ package_config: - path: "src/workflows/utils/labels_ci.config" description: "Adds the correct memory and CPU labels when running on the Viash\ \ Hub CI." - viash_version: "0.9.4" + viash_version: "0.9.7" source: "src" target: "target" config_mods: @@ -334,7 +335,7 @@ package_config: )'" - ".engines += { type: \"native\" }" - ".engines[.type == 'docker'].target_registry := 'images.viash-hub.com'" - - ".engines[.type == 'docker'].target_tag := 'v4.0.3'" + - ".engines[.type == 'docker'].target_tag := 'v4.1.0'" keywords: - "single-cell" - "multimodal" diff --git a/target/dependencies/vsh/vsh/openpipeline/v4.0.3/nextflow/dataflow/concatenate_h5mu/compress_h5mu.py b/target/dependencies/vsh/vsh/openpipeline/v4.1.0/nextflow/dataflow/concatenate_h5mu/compress_h5mu.py similarity index 100% rename from target/dependencies/vsh/vsh/openpipeline/v4.0.3/nextflow/dataflow/concatenate_h5mu/compress_h5mu.py rename to target/dependencies/vsh/vsh/openpipeline/v4.1.0/nextflow/dataflow/concatenate_h5mu/compress_h5mu.py diff --git a/target/dependencies/vsh/vsh/openpipeline/v4.0.3/nextflow/dataflow/concatenate_h5mu/main.nf b/target/dependencies/vsh/vsh/openpipeline/v4.1.0/nextflow/dataflow/concatenate_h5mu/main.nf similarity index 98% rename from target/dependencies/vsh/vsh/openpipeline/v4.0.3/nextflow/dataflow/concatenate_h5mu/main.nf rename to target/dependencies/vsh/vsh/openpipeline/v4.1.0/nextflow/dataflow/concatenate_h5mu/main.nf index 18b9dd3..4537d46 100644 --- a/target/dependencies/vsh/vsh/openpipeline/v4.0.3/nextflow/dataflow/concatenate_h5mu/main.nf +++ b/target/dependencies/vsh/vsh/openpipeline/v4.1.0/nextflow/dataflow/concatenate_h5mu/main.nf @@ -1,6 +1,6 @@ -// concatenate_h5mu v4.0.3 +// concatenate_h5mu v4.1.0 // -// This wrapper script is auto-generated by viash 0.9.4 and is thus a derivative +// This wrapper script is auto-generated by viash 0.9.7 and is thus a derivative // work thereof. This software comes with ABSOLUTELY NO WARRANTY from Data // Intuitive. // @@ -1353,47 +1353,42 @@ def readCsv(file_path) { def splitRegex = java.util.regex.Pattern.compile(''',(?=(?:[^"]*"[^"]*")*[^"]*$)''') def removeQuote = java.util.regex.Pattern.compile('''"(.*)"''') - def br = java.nio.file.Files.newBufferedReader(inputFile) + java.nio.file.Files.newBufferedReader(inputFile).withCloseable { br -> + def row = 0 + def header = null + def line - def row = -1 - def header = null - while (br.ready() && header == null) { - def line = br.readLine() - row++ - if (!line.startsWith("#")) { - header = splitRegex.split(line, -1).collect{field -> - m = removeQuote.matcher(field) - m.find() ? m.replaceFirst('$1') : field - } - } - } - assert header != null: "CSV file should contain a header" - - while (br.ready()) { - def line = br.readLine() - row++ - if (line == null) { - br.close() - break - } - - if (!line.startsWith("#")) { - def predata = splitRegex.split(line, -1) - def data = predata.collect{field -> - if (field == "") { - return null - } - def m = removeQuote.matcher(field) - if (m.find()) { - return m.replaceFirst('$1') - } else { - return field + while (header == null && (line = br.readLine()) != null) { + if (!line.startsWith("#")) { + header = splitRegex.split(line, -1).collect { field -> + def m = removeQuote.matcher(field) + m.find() ? m.replaceFirst('$1') : field } } - assert header.size() == data.size(): "Row $row should contain the same number as fields as the header" - - def dataMap = [header, data].transpose().collectEntries().findAll{it.value != null} - output.add(dataMap) + row++ + } + assert header != null : "CSV file should contain a header" + + while ((line = br.readLine()) != null) { + row++ + if (!line.startsWith("#")) { + def predata = splitRegex.split(line, -1) + def data = predata.collect { field -> + if (field == "") { + return null + } + def m = removeQuote.matcher(field) + if (m.find()) { + return m.replaceFirst('$1') + } else { + return field + } + } + assert header.size() == data.size() : "Row $row should contain the same number as fields as the header" + + def dataMap = [header, data].transpose().collectEntries().findAll { it.value != null } + output.add(dataMap) + } } } @@ -1709,10 +1704,25 @@ process publishFilesProc { ] .transpose() .collectMany{infile, outfile -> - if (infile.toString() != outfile.toString()) { + def infileString = infile.toString() + def outfileString = outfile.toString() + if (infileString != outfileString) { + /* Trailing slashes are removed from both the source and destination arguments. + From source arguments, this is useful when a source argument may have a trailing slash + and specify a symbolic link to a directory. Without removing the slash, cp will dereference + the symbolic link. + See https://www.gnu.org/software/coreutils/manual/html_node/Trailing-slashes.html#Trailing-slashes-1 + + For the destination path addding a trailing slash is a problem when publishing directories: + it requires the destination directory to exist. This fails because we only create the parent + directories first. + */ + def regexTrailingSlashes = ~/\/+$/ + def infileNoTrailingSlash = infileString - regexTrailingSlashes + def outfileNoTrailingSlash = outfileString - regexTrailingSlashes [ - "[ -d \"\$(dirname '${outfile.toString()}')\" ] || mkdir -p \"\$(dirname '${outfile.toString()}')\"", - "cp -r '${infile.toString()}' '${outfile.toString()}'" + "[ -d \"\$(dirname '${outfileNoTrailingSlash}')\" ] || mkdir -p \"\$(dirname '${outfileNoTrailingSlash}')\"", + "cp -a '${infileNoTrailingSlash}' '${outfileNoTrailingSlash}'" ] } else { // no need to copy if infile is the same as outfile @@ -3035,7 +3045,7 @@ meta = [ "config": processConfig(readJsonBlob('''{ "name" : "concatenate_h5mu", "namespace" : "dataflow", - "version" : "v4.0.3", + "version" : "v4.1.0", "authors" : [ { "name" : "Dries Schaumont", @@ -3179,7 +3189,7 @@ meta = [ { "type" : "string", "name" : "--output_compression", - "description" : "Compression format to use for the output AnnData and/or Mudata objects.\nBy default no compression is applied.\n", + "description" : "Compression format to use for the output AnnData and/or Mudata H5 files.\nBy default no compression is applied.\n", "example" : [ "gzip" ], @@ -3328,7 +3338,7 @@ meta = [ "id" : "docker", "image" : "python:3.13-slim", "target_registry" : "images.viash-hub.com", - "target_tag" : "v4.0.3", + "target_tag" : "v4.1.0", "namespace_separator" : "/", "setup" : [ { @@ -3342,9 +3352,10 @@ meta = [ "type" : "python", "user" : false, "packages" : [ - "anndata~=0.12.7", + "anndata~=0.12.16", "awkward", - "mudata~=0.3.2" + "scipy~=1.17.1", + "mudata~=0.3.8" ], "script" : [ "exec(\\"try:\\\\n import zarr; from importlib.metadata import version\\\\nexcept ModuleNotFoundError:\\\\n exit(0)\\\\nelse: assert int(version(\\\\\\"zarr\\\\\\").partition(\\\\\\".\\\\\\")[0]) > 2\\")" @@ -3364,7 +3375,7 @@ meta = [ "type" : "python", "user" : false, "packages" : [ - "viashpy==0.8.0" + "viashpy==0.10.0" ], "github" : [ "openpipelines-bio/core#subdirectory=packages/python/openpipeline_testutils" @@ -3375,7 +3386,7 @@ meta = [ "type" : "python", "user" : false, "packages" : [ - "viashpy==0.8.0", + "viashpy==0.10.0", "pytest-benchmark" ], "upgrade" : true @@ -3392,13 +3403,13 @@ meta = [ "runner" : "nextflow", "engine" : "docker|native", "output" : "/workdir/root/repo/target/nextflow/dataflow/concatenate_h5mu", - "viash_version" : "0.9.4", - "git_commit" : "7bfad4ea12f87eca59213be3ab08deff67cc4206", + "viash_version" : "0.9.7", + "git_commit" : "a6499fddaa8553874585c747370f919f4d7b729c", "git_remote" : "https://github.com/openpipelines-bio/openpipeline" }, "package_config" : { "name" : "openpipeline", - "version" : "v4.0.3", + "version" : "v4.1.0", "summary" : "Best-practice workflows for single-cell multi-omics analyses.\n", "description" : "OpenPipelines are extensible single cell analysis pipelines for reproducible and large-scale single cell processing using [Viash](https://viash.io) and [Nextflow](https://www.nextflow.io/).\n\nIn terms of workflows, the following has been made available, but keep in mind that\nindividual tools and functionality can be executed as standalone components as well.\n\n * Demultiplexing: conversion of raw sequencing data to FASTQ objects.\n * Ingestion: Read mapping and generating a count matrix.\n * Single sample processing: cell filtering and doublet detection.\n * Multisample processing: Count transformation, normalization, QC metric calulations.\n * Integration: Clustering, integration and batch correction using single and multimodal methods.\n * Downstream analysis workflows\n", "info" : { @@ -3416,14 +3427,14 @@ meta = [ } ] }, - "viash_version" : "0.9.4", + "viash_version" : "0.9.7", "source" : "/workdir/root/repo/src", "target" : "/workdir/root/repo/target", "config_mods" : [ ".resources += {path: '/src/workflows/utils/labels.config', dest: 'nextflow_labels.config'}\n.runners[.type == 'nextflow'].config.script := 'includeConfig(\\"nextflow_labels.config\\")'", ".engines += { type: \\"native\\" }", ".engines[.type == 'docker'].target_registry := 'images.viash-hub.com'", - ".engines[.type == 'docker'].target_tag := 'v4.0.3'" + ".engines[.type == 'docker'].target_tag := 'v4.1.0'" ], "keywords" : [ "single-cell", @@ -4266,7 +4277,7 @@ meta["defaults"] = [ "container" : { "registry" : "images.viash-hub.com", "image" : "vsh/openpipeline/dataflow/concatenate_h5mu", - "tag" : "v4.0.3" + "tag" : "v4.1.0" }, "label" : [ "midcpu", diff --git a/target/dependencies/vsh/vsh/openpipeline/v4.0.3/nextflow/dataflow/concatenate_h5mu/nextflow.config b/target/dependencies/vsh/vsh/openpipeline/v4.1.0/nextflow/dataflow/concatenate_h5mu/nextflow.config similarity index 99% rename from target/dependencies/vsh/vsh/openpipeline/v4.0.3/nextflow/dataflow/concatenate_h5mu/nextflow.config rename to target/dependencies/vsh/vsh/openpipeline/v4.1.0/nextflow/dataflow/concatenate_h5mu/nextflow.config index 0ba8d92..6801f39 100644 --- a/target/dependencies/vsh/vsh/openpipeline/v4.0.3/nextflow/dataflow/concatenate_h5mu/nextflow.config +++ b/target/dependencies/vsh/vsh/openpipeline/v4.1.0/nextflow/dataflow/concatenate_h5mu/nextflow.config @@ -2,7 +2,7 @@ manifest { name = 'dataflow/concatenate_h5mu' mainScript = 'main.nf' nextflowVersion = '!>=20.12.1-edge' - version = 'v4.0.3' + version = 'v4.1.0' description = 'Concatenate observations from samples in several (uni- and/or multi-modal) MuData files into a single file.\n' author = 'Dries Schaumont' } diff --git a/target/dependencies/vsh/vsh/openpipeline/v4.0.3/nextflow/dataflow/merge/nextflow_labels.config b/target/dependencies/vsh/vsh/openpipeline/v4.1.0/nextflow/dataflow/concatenate_h5mu/nextflow_labels.config similarity index 100% rename from target/dependencies/vsh/vsh/openpipeline/v4.0.3/nextflow/dataflow/merge/nextflow_labels.config rename to target/dependencies/vsh/vsh/openpipeline/v4.1.0/nextflow/dataflow/concatenate_h5mu/nextflow_labels.config diff --git a/target/dependencies/vsh/vsh/openpipeline/v4.0.3/nextflow/dataflow/concatenate_h5mu/nextflow_schema.json b/target/dependencies/vsh/vsh/openpipeline/v4.1.0/nextflow/dataflow/concatenate_h5mu/nextflow_schema.json similarity index 98% rename from target/dependencies/vsh/vsh/openpipeline/v4.0.3/nextflow/dataflow/concatenate_h5mu/nextflow_schema.json rename to target/dependencies/vsh/vsh/openpipeline/v4.1.0/nextflow/dataflow/concatenate_h5mu/nextflow_schema.json index 53237e9..6e541fc 100644 --- a/target/dependencies/vsh/vsh/openpipeline/v4.0.3/nextflow/dataflow/concatenate_h5mu/nextflow_schema.json +++ b/target/dependencies/vsh/vsh/openpipeline/v4.1.0/nextflow/dataflow/concatenate_h5mu/nextflow_schema.json @@ -85,7 +85,7 @@ }, "output_compression": { "type": "string", - "description": "Compression format to use for the output AnnData and/or Mudata objects.\nBy default no compression is applied.\n", + "description": "Compression format to use for the output AnnData and/or Mudata H5 files.\nBy default no compression is applied.\n", "help_text": "Type: `string`, multiple: `False`, example: `\"gzip\"`, choices: ``gzip`, `lzf``. ", "enum": [ "gzip", diff --git a/target/dependencies/vsh/vsh/openpipeline/v4.0.3/nextflow/dataflow/concatenate_h5mu/setup_logger.py b/target/dependencies/vsh/vsh/openpipeline/v4.1.0/nextflow/dataflow/concatenate_h5mu/setup_logger.py similarity index 100% rename from target/dependencies/vsh/vsh/openpipeline/v4.0.3/nextflow/dataflow/concatenate_h5mu/setup_logger.py rename to target/dependencies/vsh/vsh/openpipeline/v4.1.0/nextflow/dataflow/concatenate_h5mu/setup_logger.py diff --git a/target/dependencies/vsh/vsh/openpipeline/v4.0.3/nextflow/dataflow/merge/.config.vsh.yaml b/target/dependencies/vsh/vsh/openpipeline/v4.1.0/nextflow/dataflow/merge/.config.vsh.yaml similarity index 94% rename from target/dependencies/vsh/vsh/openpipeline/v4.0.3/nextflow/dataflow/merge/.config.vsh.yaml rename to target/dependencies/vsh/vsh/openpipeline/v4.1.0/nextflow/dataflow/merge/.config.vsh.yaml index 59fbb19..c0a9be0 100644 --- a/target/dependencies/vsh/vsh/openpipeline/v4.0.3/nextflow/dataflow/merge/.config.vsh.yaml +++ b/target/dependencies/vsh/vsh/openpipeline/v4.1.0/nextflow/dataflow/merge/.config.vsh.yaml @@ -1,6 +1,6 @@ name: "merge" namespace: "dataflow" -version: "v4.0.3" +version: "v4.1.0" authors: - name: "Dries Schaumont" roles: @@ -25,6 +25,9 @@ argument_groups: - "-i" description: "Paths to the single-modality .h5mu files that need to be combined" info: null + example: + - "/path/to/modality_1.h5mu" + - "/path/to/modality_2.h5mu" default: - "sample_paths" must_exist: true @@ -163,7 +166,7 @@ engines: id: "docker" image: "python:3.12-slim" target_registry: "images.viash-hub.com" - target_tag: "v4.0.3" + target_tag: "v4.1.0" namespace_separator: "/" setup: - type: "apt" @@ -173,9 +176,10 @@ engines: - type: "python" user: false packages: - - "anndata~=0.12.7" + - "anndata~=0.12.16" - "awkward" - - "mudata~=0.3.2" + - "scipy~=1.17.1" + - "mudata~=0.3.8" script: - "exec(\"try:\\n import zarr; from importlib.metadata import version\\nexcept\ \ ModuleNotFoundError:\\n exit(0)\\nelse: assert int(version(\\\"zarr\\\"\ @@ -189,7 +193,7 @@ engines: - type: "python" user: false packages: - - "viashpy==0.8.0" + - "viashpy==0.10.0" github: - "openpipelines-bio/core#subdirectory=packages/python/openpipeline_testutils" upgrade: true @@ -203,12 +207,12 @@ build_info: engine: "docker|native" output: "target/nextflow/dataflow/merge" executable: "target/nextflow/dataflow/merge/main.nf" - viash_version: "0.9.4" - git_commit: "7bfad4ea12f87eca59213be3ab08deff67cc4206" + viash_version: "0.9.7" + git_commit: "a6499fddaa8553874585c747370f919f4d7b729c" git_remote: "https://github.com/openpipelines-bio/openpipeline" package_config: name: "openpipeline" - version: "v4.0.3" + version: "v4.1.0" summary: "Best-practice workflows for single-cell multi-omics analyses.\n" description: "OpenPipelines are extensible single cell analysis pipelines for reproducible\ \ and large-scale single cell processing using [Viash](https://viash.io) and [Nextflow](https://www.nextflow.io/).\n\ @@ -229,7 +233,7 @@ package_config: - path: "src/workflows/utils/labels_ci.config" description: "Adds the correct memory and CPU labels when running on the Viash\ \ Hub CI." - viash_version: "0.9.4" + viash_version: "0.9.7" source: "src" target: "target" config_mods: @@ -238,7 +242,7 @@ package_config: )'" - ".engines += { type: \"native\" }" - ".engines[.type == 'docker'].target_registry := 'images.viash-hub.com'" - - ".engines[.type == 'docker'].target_tag := 'v4.0.3'" + - ".engines[.type == 'docker'].target_tag := 'v4.1.0'" keywords: - "single-cell" - "multimodal" diff --git a/target/dependencies/vsh/vsh/openpipeline/v4.0.3/nextflow/dataflow/merge/main.nf b/target/dependencies/vsh/vsh/openpipeline/v4.1.0/nextflow/dataflow/merge/main.nf similarity index 97% rename from target/dependencies/vsh/vsh/openpipeline/v4.0.3/nextflow/dataflow/merge/main.nf rename to target/dependencies/vsh/vsh/openpipeline/v4.1.0/nextflow/dataflow/merge/main.nf index 5524946..f6a3605 100644 --- a/target/dependencies/vsh/vsh/openpipeline/v4.0.3/nextflow/dataflow/merge/main.nf +++ b/target/dependencies/vsh/vsh/openpipeline/v4.1.0/nextflow/dataflow/merge/main.nf @@ -1,6 +1,6 @@ -// merge v4.0.3 +// merge v4.1.0 // -// This wrapper script is auto-generated by viash 0.9.4 and is thus a derivative +// This wrapper script is auto-generated by viash 0.9.7 and is thus a derivative // work thereof. This software comes with ABSOLUTELY NO WARRANTY from Data // Intuitive. // @@ -1353,47 +1353,42 @@ def readCsv(file_path) { def splitRegex = java.util.regex.Pattern.compile(''',(?=(?:[^"]*"[^"]*")*[^"]*$)''') def removeQuote = java.util.regex.Pattern.compile('''"(.*)"''') - def br = java.nio.file.Files.newBufferedReader(inputFile) + java.nio.file.Files.newBufferedReader(inputFile).withCloseable { br -> + def row = 0 + def header = null + def line - def row = -1 - def header = null - while (br.ready() && header == null) { - def line = br.readLine() - row++ - if (!line.startsWith("#")) { - header = splitRegex.split(line, -1).collect{field -> - m = removeQuote.matcher(field) - m.find() ? m.replaceFirst('$1') : field - } - } - } - assert header != null: "CSV file should contain a header" - - while (br.ready()) { - def line = br.readLine() - row++ - if (line == null) { - br.close() - break - } - - if (!line.startsWith("#")) { - def predata = splitRegex.split(line, -1) - def data = predata.collect{field -> - if (field == "") { - return null - } - def m = removeQuote.matcher(field) - if (m.find()) { - return m.replaceFirst('$1') - } else { - return field + while (header == null && (line = br.readLine()) != null) { + if (!line.startsWith("#")) { + header = splitRegex.split(line, -1).collect { field -> + def m = removeQuote.matcher(field) + m.find() ? m.replaceFirst('$1') : field } } - assert header.size() == data.size(): "Row $row should contain the same number as fields as the header" - - def dataMap = [header, data].transpose().collectEntries().findAll{it.value != null} - output.add(dataMap) + row++ + } + assert header != null : "CSV file should contain a header" + + while ((line = br.readLine()) != null) { + row++ + if (!line.startsWith("#")) { + def predata = splitRegex.split(line, -1) + def data = predata.collect { field -> + if (field == "") { + return null + } + def m = removeQuote.matcher(field) + if (m.find()) { + return m.replaceFirst('$1') + } else { + return field + } + } + assert header.size() == data.size() : "Row $row should contain the same number as fields as the header" + + def dataMap = [header, data].transpose().collectEntries().findAll { it.value != null } + output.add(dataMap) + } } } @@ -1709,10 +1704,25 @@ process publishFilesProc { ] .transpose() .collectMany{infile, outfile -> - if (infile.toString() != outfile.toString()) { + def infileString = infile.toString() + def outfileString = outfile.toString() + if (infileString != outfileString) { + /* Trailing slashes are removed from both the source and destination arguments. + From source arguments, this is useful when a source argument may have a trailing slash + and specify a symbolic link to a directory. Without removing the slash, cp will dereference + the symbolic link. + See https://www.gnu.org/software/coreutils/manual/html_node/Trailing-slashes.html#Trailing-slashes-1 + + For the destination path addding a trailing slash is a problem when publishing directories: + it requires the destination directory to exist. This fails because we only create the parent + directories first. + */ + def regexTrailingSlashes = ~/\/+$/ + def infileNoTrailingSlash = infileString - regexTrailingSlashes + def outfileNoTrailingSlash = outfileString - regexTrailingSlashes [ - "[ -d \"\$(dirname '${outfile.toString()}')\" ] || mkdir -p \"\$(dirname '${outfile.toString()}')\"", - "cp -r '${infile.toString()}' '${outfile.toString()}'" + "[ -d \"\$(dirname '${outfileNoTrailingSlash}')\" ] || mkdir -p \"\$(dirname '${outfileNoTrailingSlash}')\"", + "cp -a '${infileNoTrailingSlash}' '${outfileNoTrailingSlash}'" ] } else { // no need to copy if infile is the same as outfile @@ -3035,7 +3045,7 @@ meta = [ "config": processConfig(readJsonBlob('''{ "name" : "merge", "namespace" : "dataflow", - "version" : "v4.0.3", + "version" : "v4.1.0", "authors" : [ { "name" : "Dries Schaumont", @@ -3071,6 +3081,10 @@ meta = [ "-i" ], "description" : "Paths to the single-modality .h5mu files that need to be combined", + "example" : [ + "/path/to/modality_1.h5mu", + "/path/to/modality_2.h5mu" + ], "default" : [ "sample_paths" ], @@ -3246,7 +3260,7 @@ meta = [ "id" : "docker", "image" : "python:3.12-slim", "target_registry" : "images.viash-hub.com", - "target_tag" : "v4.0.3", + "target_tag" : "v4.1.0", "namespace_separator" : "/", "setup" : [ { @@ -3260,9 +3274,10 @@ meta = [ "type" : "python", "user" : false, "packages" : [ - "anndata~=0.12.7", + "anndata~=0.12.16", "awkward", - "mudata~=0.3.2" + "scipy~=1.17.1", + "mudata~=0.3.8" ], "script" : [ "exec(\\"try:\\\\n import zarr; from importlib.metadata import version\\\\nexcept ModuleNotFoundError:\\\\n exit(0)\\\\nelse: assert int(version(\\\\\\"zarr\\\\\\").partition(\\\\\\".\\\\\\")[0]) > 2\\")" @@ -3282,7 +3297,7 @@ meta = [ "type" : "python", "user" : false, "packages" : [ - "viashpy==0.8.0" + "viashpy==0.10.0" ], "github" : [ "openpipelines-bio/core#subdirectory=packages/python/openpipeline_testutils" @@ -3301,13 +3316,13 @@ meta = [ "runner" : "nextflow", "engine" : "docker|native", "output" : "/workdir/root/repo/target/nextflow/dataflow/merge", - "viash_version" : "0.9.4", - "git_commit" : "7bfad4ea12f87eca59213be3ab08deff67cc4206", + "viash_version" : "0.9.7", + "git_commit" : "a6499fddaa8553874585c747370f919f4d7b729c", "git_remote" : "https://github.com/openpipelines-bio/openpipeline" }, "package_config" : { "name" : "openpipeline", - "version" : "v4.0.3", + "version" : "v4.1.0", "summary" : "Best-practice workflows for single-cell multi-omics analyses.\n", "description" : "OpenPipelines are extensible single cell analysis pipelines for reproducible and large-scale single cell processing using [Viash](https://viash.io) and [Nextflow](https://www.nextflow.io/).\n\nIn terms of workflows, the following has been made available, but keep in mind that\nindividual tools and functionality can be executed as standalone components as well.\n\n * Demultiplexing: conversion of raw sequencing data to FASTQ objects.\n * Ingestion: Read mapping and generating a count matrix.\n * Single sample processing: cell filtering and doublet detection.\n * Multisample processing: Count transformation, normalization, QC metric calulations.\n * Integration: Clustering, integration and batch correction using single and multimodal methods.\n * Downstream analysis workflows\n", "info" : { @@ -3325,14 +3340,14 @@ meta = [ } ] }, - "viash_version" : "0.9.4", + "viash_version" : "0.9.7", "source" : "/workdir/root/repo/src", "target" : "/workdir/root/repo/target", "config_mods" : [ ".resources += {path: '/src/workflows/utils/labels.config', dest: 'nextflow_labels.config'}\n.runners[.type == 'nextflow'].config.script := 'includeConfig(\\"nextflow_labels.config\\")'", ".engines += { type: \\"native\\" }", ".engines[.type == 'docker'].target_registry := 'images.viash-hub.com'", - ".engines[.type == 'docker'].target_tag := 'v4.0.3'" + ".engines[.type == 'docker'].target_tag := 'v4.1.0'" ], "keywords" : [ "single-cell", @@ -3847,7 +3862,7 @@ meta["defaults"] = [ "container" : { "registry" : "images.viash-hub.com", "image" : "vsh/openpipeline/dataflow/merge", - "tag" : "v4.0.3" + "tag" : "v4.1.0" }, "label" : [ "singlecpu", diff --git a/target/dependencies/vsh/vsh/openpipeline/v4.0.3/nextflow/dataflow/merge/nextflow.config b/target/dependencies/vsh/vsh/openpipeline/v4.1.0/nextflow/dataflow/merge/nextflow.config similarity index 99% rename from target/dependencies/vsh/vsh/openpipeline/v4.0.3/nextflow/dataflow/merge/nextflow.config rename to target/dependencies/vsh/vsh/openpipeline/v4.1.0/nextflow/dataflow/merge/nextflow.config index 9c85150..e8164cb 100644 --- a/target/dependencies/vsh/vsh/openpipeline/v4.0.3/nextflow/dataflow/merge/nextflow.config +++ b/target/dependencies/vsh/vsh/openpipeline/v4.1.0/nextflow/dataflow/merge/nextflow.config @@ -2,7 +2,7 @@ manifest { name = 'dataflow/merge' mainScript = 'main.nf' nextflowVersion = '!>=20.12.1-edge' - version = 'v4.0.3' + version = 'v4.1.0' description = 'Combine one or more single-modality .h5mu files together into one .h5mu file.\n' author = 'Dries Schaumont' } diff --git a/target/dependencies/vsh/vsh/openpipeline/v4.0.3/nextflow/dataflow/split_modalities/nextflow_labels.config b/target/dependencies/vsh/vsh/openpipeline/v4.1.0/nextflow/dataflow/merge/nextflow_labels.config similarity index 100% rename from target/dependencies/vsh/vsh/openpipeline/v4.0.3/nextflow/dataflow/split_modalities/nextflow_labels.config rename to target/dependencies/vsh/vsh/openpipeline/v4.1.0/nextflow/dataflow/merge/nextflow_labels.config diff --git a/target/dependencies/vsh/vsh/openpipeline/v4.0.3/nextflow/dataflow/merge/nextflow_schema.json b/target/dependencies/vsh/vsh/openpipeline/v4.1.0/nextflow/dataflow/merge/nextflow_schema.json similarity index 94% rename from target/dependencies/vsh/vsh/openpipeline/v4.0.3/nextflow/dataflow/merge/nextflow_schema.json rename to target/dependencies/vsh/vsh/openpipeline/v4.1.0/nextflow/dataflow/merge/nextflow_schema.json index 2f20aa0..5749240 100644 --- a/target/dependencies/vsh/vsh/openpipeline/v4.0.3/nextflow/dataflow/merge/nextflow_schema.json +++ b/target/dependencies/vsh/vsh/openpipeline/v4.1.0/nextflow/dataflow/merge/nextflow_schema.json @@ -17,7 +17,7 @@ "format": "path", "exists": true, "description": "Paths to the single-modality .h5mu files that need to be combined", - "help_text": "Type: `file`, multiple: `True`, required, default: `[\"sample_paths\"]`, direction: `input`. ", + "help_text": "Type: `file`, multiple: `True`, required, default: `[\"sample_paths\"]`, direction: `input`, example: `[\"/path/to/modality_1.h5mu\";\"/path/to/modality_2.h5mu\"]`. ", "default": [ "sample_paths" ] diff --git a/target/dependencies/vsh/vsh/openpipeline/v4.0.3/nextflow/dataflow/merge/setup_logger.py b/target/dependencies/vsh/vsh/openpipeline/v4.1.0/nextflow/dataflow/merge/setup_logger.py similarity index 100% rename from target/dependencies/vsh/vsh/openpipeline/v4.0.3/nextflow/dataflow/merge/setup_logger.py rename to target/dependencies/vsh/vsh/openpipeline/v4.1.0/nextflow/dataflow/merge/setup_logger.py diff --git a/target/dependencies/vsh/vsh/openpipeline/v4.0.3/nextflow/dataflow/split_modalities/.config.vsh.yaml b/target/dependencies/vsh/vsh/openpipeline/v4.1.0/nextflow/dataflow/split_modalities/.config.vsh.yaml similarity index 94% rename from target/dependencies/vsh/vsh/openpipeline/v4.0.3/nextflow/dataflow/split_modalities/.config.vsh.yaml rename to target/dependencies/vsh/vsh/openpipeline/v4.1.0/nextflow/dataflow/split_modalities/.config.vsh.yaml index ea7bd80..274de18 100644 --- a/target/dependencies/vsh/vsh/openpipeline/v4.0.3/nextflow/dataflow/split_modalities/.config.vsh.yaml +++ b/target/dependencies/vsh/vsh/openpipeline/v4.1.0/nextflow/dataflow/split_modalities/.config.vsh.yaml @@ -1,6 +1,6 @@ name: "split_modalities" namespace: "dataflow" -version: "v4.0.3" +version: "v4.1.0" authors: - name: "Dries Schaumont" roles: @@ -42,6 +42,8 @@ argument_groups: - "-i" description: "Path to a single .h5mu file." info: null + example: + - "input.h5mu" default: - "sample_path" must_exist: true @@ -79,8 +81,8 @@ argument_groups: multiple_sep: ";" - type: "string" name: "--output_compression" - description: "Compression format to use for the output AnnData and/or Mudata objects.\n\ - By default no compression is applied.\n" + description: "Compression format to use for the output AnnData and/or Mudata H5\ + \ files.\nBy default no compression is applied.\n" info: null example: - "gzip" @@ -97,6 +99,8 @@ resources: is_executable: true - type: "file" path: "setup_logger.py" +- type: "file" + path: "mudata_opener.py" - type: "file" path: "nextflow_labels.config" dest: "nextflow_labels.config" @@ -190,7 +194,7 @@ engines: id: "docker" image: "python:3.12-slim" target_registry: "images.viash-hub.com" - target_tag: "v4.0.3" + target_tag: "v4.1.0" namespace_separator: "/" setup: - type: "apt" @@ -200,9 +204,10 @@ engines: - type: "python" user: false packages: - - "anndata~=0.12.7" + - "anndata~=0.12.16" - "awkward" - - "mudata~=0.3.2" + - "scipy~=1.17.1" + - "mudata~=0.3.8" script: - "exec(\"try:\\n import zarr; from importlib.metadata import version\\nexcept\ \ ModuleNotFoundError:\\n exit(0)\\nelse: assert int(version(\\\"zarr\\\"\ @@ -216,7 +221,7 @@ engines: - type: "python" user: false packages: - - "viashpy==0.8.0" + - "viashpy==0.10.0" github: - "openpipelines-bio/core#subdirectory=packages/python/openpipeline_testutils" upgrade: true @@ -230,12 +235,12 @@ build_info: engine: "docker|native" output: "target/nextflow/dataflow/split_modalities" executable: "target/nextflow/dataflow/split_modalities/main.nf" - viash_version: "0.9.4" - git_commit: "7bfad4ea12f87eca59213be3ab08deff67cc4206" + viash_version: "0.9.7" + git_commit: "a6499fddaa8553874585c747370f919f4d7b729c" git_remote: "https://github.com/openpipelines-bio/openpipeline" package_config: name: "openpipeline" - version: "v4.0.3" + version: "v4.1.0" summary: "Best-practice workflows for single-cell multi-omics analyses.\n" description: "OpenPipelines are extensible single cell analysis pipelines for reproducible\ \ and large-scale single cell processing using [Viash](https://viash.io) and [Nextflow](https://www.nextflow.io/).\n\ @@ -256,7 +261,7 @@ package_config: - path: "src/workflows/utils/labels_ci.config" description: "Adds the correct memory and CPU labels when running on the Viash\ \ Hub CI." - viash_version: "0.9.4" + viash_version: "0.9.7" source: "src" target: "target" config_mods: @@ -265,7 +270,7 @@ package_config: )'" - ".engines += { type: \"native\" }" - ".engines[.type == 'docker'].target_registry := 'images.viash-hub.com'" - - ".engines[.type == 'docker'].target_tag := 'v4.0.3'" + - ".engines[.type == 'docker'].target_tag := 'v4.1.0'" keywords: - "single-cell" - "multimodal" diff --git a/target/dependencies/vsh/vsh/openpipeline/v4.0.3/nextflow/dataflow/split_modalities/main.nf b/target/dependencies/vsh/vsh/openpipeline/v4.1.0/nextflow/dataflow/split_modalities/main.nf similarity index 96% rename from target/dependencies/vsh/vsh/openpipeline/v4.0.3/nextflow/dataflow/split_modalities/main.nf rename to target/dependencies/vsh/vsh/openpipeline/v4.1.0/nextflow/dataflow/split_modalities/main.nf index 9446a6e..8342acf 100644 --- a/target/dependencies/vsh/vsh/openpipeline/v4.0.3/nextflow/dataflow/split_modalities/main.nf +++ b/target/dependencies/vsh/vsh/openpipeline/v4.1.0/nextflow/dataflow/split_modalities/main.nf @@ -1,6 +1,6 @@ -// split_modalities v4.0.3 +// split_modalities v4.1.0 // -// This wrapper script is auto-generated by viash 0.9.4 and is thus a derivative +// This wrapper script is auto-generated by viash 0.9.7 and is thus a derivative // work thereof. This software comes with ABSOLUTELY NO WARRANTY from Data // Intuitive. // @@ -1354,47 +1354,42 @@ def readCsv(file_path) { def splitRegex = java.util.regex.Pattern.compile(''',(?=(?:[^"]*"[^"]*")*[^"]*$)''') def removeQuote = java.util.regex.Pattern.compile('''"(.*)"''') - def br = java.nio.file.Files.newBufferedReader(inputFile) + java.nio.file.Files.newBufferedReader(inputFile).withCloseable { br -> + def row = 0 + def header = null + def line - def row = -1 - def header = null - while (br.ready() && header == null) { - def line = br.readLine() - row++ - if (!line.startsWith("#")) { - header = splitRegex.split(line, -1).collect{field -> - m = removeQuote.matcher(field) - m.find() ? m.replaceFirst('$1') : field - } - } - } - assert header != null: "CSV file should contain a header" - - while (br.ready()) { - def line = br.readLine() - row++ - if (line == null) { - br.close() - break - } - - if (!line.startsWith("#")) { - def predata = splitRegex.split(line, -1) - def data = predata.collect{field -> - if (field == "") { - return null - } - def m = removeQuote.matcher(field) - if (m.find()) { - return m.replaceFirst('$1') - } else { - return field + while (header == null && (line = br.readLine()) != null) { + if (!line.startsWith("#")) { + header = splitRegex.split(line, -1).collect { field -> + def m = removeQuote.matcher(field) + m.find() ? m.replaceFirst('$1') : field } } - assert header.size() == data.size(): "Row $row should contain the same number as fields as the header" - - def dataMap = [header, data].transpose().collectEntries().findAll{it.value != null} - output.add(dataMap) + row++ + } + assert header != null : "CSV file should contain a header" + + while ((line = br.readLine()) != null) { + row++ + if (!line.startsWith("#")) { + def predata = splitRegex.split(line, -1) + def data = predata.collect { field -> + if (field == "") { + return null + } + def m = removeQuote.matcher(field) + if (m.find()) { + return m.replaceFirst('$1') + } else { + return field + } + } + assert header.size() == data.size() : "Row $row should contain the same number as fields as the header" + + def dataMap = [header, data].transpose().collectEntries().findAll { it.value != null } + output.add(dataMap) + } } } @@ -1710,10 +1705,25 @@ process publishFilesProc { ] .transpose() .collectMany{infile, outfile -> - if (infile.toString() != outfile.toString()) { + def infileString = infile.toString() + def outfileString = outfile.toString() + if (infileString != outfileString) { + /* Trailing slashes are removed from both the source and destination arguments. + From source arguments, this is useful when a source argument may have a trailing slash + and specify a symbolic link to a directory. Without removing the slash, cp will dereference + the symbolic link. + See https://www.gnu.org/software/coreutils/manual/html_node/Trailing-slashes.html#Trailing-slashes-1 + + For the destination path addding a trailing slash is a problem when publishing directories: + it requires the destination directory to exist. This fails because we only create the parent + directories first. + */ + def regexTrailingSlashes = ~/\/+$/ + def infileNoTrailingSlash = infileString - regexTrailingSlashes + def outfileNoTrailingSlash = outfileString - regexTrailingSlashes [ - "[ -d \"\$(dirname '${outfile.toString()}')\" ] || mkdir -p \"\$(dirname '${outfile.toString()}')\"", - "cp -r '${infile.toString()}' '${outfile.toString()}'" + "[ -d \"\$(dirname '${outfileNoTrailingSlash}')\" ] || mkdir -p \"\$(dirname '${outfileNoTrailingSlash}')\"", + "cp -a '${infileNoTrailingSlash}' '${outfileNoTrailingSlash}'" ] } else { // no need to copy if infile is the same as outfile @@ -3036,7 +3046,7 @@ meta = [ "config": processConfig(readJsonBlob('''{ "name" : "split_modalities", "namespace" : "dataflow", - "version" : "v4.0.3", + "version" : "v4.1.0", "authors" : [ { "name" : "Dries Schaumont", @@ -3099,6 +3109,9 @@ meta = [ "-i" ], "description" : "Path to a single .h5mu file.", + "example" : [ + "input.h5mu" + ], "default" : [ "sample_path" ], @@ -3143,7 +3156,7 @@ meta = [ { "type" : "string", "name" : "--output_compression", - "description" : "Compression format to use for the output AnnData and/or Mudata objects.\nBy default no compression is applied.\n", + "description" : "Compression format to use for the output AnnData and/or Mudata H5 files.\nBy default no compression is applied.\n", "example" : [ "gzip" ], @@ -3169,6 +3182,10 @@ meta = [ "type" : "file", "path" : "/src/utils/setup_logger.py" }, + { + "type" : "file", + "path" : "/src/utils/mudata_opener.py" + }, { "type" : "file", "path" : "/src/workflows/utils/labels.config", @@ -3280,7 +3297,7 @@ meta = [ "id" : "docker", "image" : "python:3.12-slim", "target_registry" : "images.viash-hub.com", - "target_tag" : "v4.0.3", + "target_tag" : "v4.1.0", "namespace_separator" : "/", "setup" : [ { @@ -3294,9 +3311,10 @@ meta = [ "type" : "python", "user" : false, "packages" : [ - "anndata~=0.12.7", + "anndata~=0.12.16", "awkward", - "mudata~=0.3.2" + "scipy~=1.17.1", + "mudata~=0.3.8" ], "script" : [ "exec(\\"try:\\\\n import zarr; from importlib.metadata import version\\\\nexcept ModuleNotFoundError:\\\\n exit(0)\\\\nelse: assert int(version(\\\\\\"zarr\\\\\\").partition(\\\\\\".\\\\\\")[0]) > 2\\")" @@ -3316,7 +3334,7 @@ meta = [ "type" : "python", "user" : false, "packages" : [ - "viashpy==0.8.0" + "viashpy==0.10.0" ], "github" : [ "openpipelines-bio/core#subdirectory=packages/python/openpipeline_testutils" @@ -3335,13 +3353,13 @@ meta = [ "runner" : "nextflow", "engine" : "docker|native", "output" : "/workdir/root/repo/target/nextflow/dataflow/split_modalities", - "viash_version" : "0.9.4", - "git_commit" : "7bfad4ea12f87eca59213be3ab08deff67cc4206", + "viash_version" : "0.9.7", + "git_commit" : "a6499fddaa8553874585c747370f919f4d7b729c", "git_remote" : "https://github.com/openpipelines-bio/openpipeline" }, "package_config" : { "name" : "openpipeline", - "version" : "v4.0.3", + "version" : "v4.1.0", "summary" : "Best-practice workflows for single-cell multi-omics analyses.\n", "description" : "OpenPipelines are extensible single cell analysis pipelines for reproducible and large-scale single cell processing using [Viash](https://viash.io) and [Nextflow](https://www.nextflow.io/).\n\nIn terms of workflows, the following has been made available, but keep in mind that\nindividual tools and functionality can be executed as standalone components as well.\n\n * Demultiplexing: conversion of raw sequencing data to FASTQ objects.\n * Ingestion: Read mapping and generating a count matrix.\n * Single sample processing: cell filtering and doublet detection.\n * Multisample processing: Count transformation, normalization, QC metric calulations.\n * Integration: Clustering, integration and batch correction using single and multimodal methods.\n * Downstream analysis workflows\n", "info" : { @@ -3359,14 +3377,14 @@ meta = [ } ] }, - "viash_version" : "0.9.4", + "viash_version" : "0.9.7", "source" : "/workdir/root/repo/src", "target" : "/workdir/root/repo/target", "config_mods" : [ ".resources += {path: '/src/workflows/utils/labels.config', dest: 'nextflow_labels.config'}\n.runners[.type == 'nextflow'].config.script := 'includeConfig(\\"nextflow_labels.config\\")'", ".engines += { type: \\"native\\" }", ".engines[.type == 'docker'].target_registry := 'images.viash-hub.com'", - ".engines[.type == 'docker'].target_tag := 'v4.0.3'" + ".engines[.type == 'docker'].target_tag := 'v4.1.0'" ], "keywords" : [ "single-cell", @@ -3395,11 +3413,14 @@ def innerWorkflowFactory(args) { tempscript=".viash_script.py" cat > "$tempscript" << VIASHMAIN from __future__ import annotations +from functools import partial import sys import mudata as md +import anndata as ad from pathlib import Path import pandas as pd + ### VIASH START # The following code has been auto-generated by Viash. par = { @@ -3436,6 +3457,7 @@ dep = { sys.path.append(meta["resources_dir"]) from setup_logger import setup_logger +from mudata_opener import mudata_opener logger = setup_logger() @@ -3447,36 +3469,54 @@ def main() -> None: logger.info("Creating %s", output_dir) output_dir.mkdir(parents=True) - logger.info("Reading input file '%s'", par["input"]) - input_file = Path(par["input"].strip()) - sample = md.read_h5mu(input_file) - - logger.info("Creating output types CSV.") - modalities = list(sample.mod.keys()) - - logger.info("Found the following modalities:\\\\n%s", "\\\\n".join(modalities)) - names = {mod_name: f"{input_file.stem}_{mod_name}.h5mu" for mod_name in modalities} - output_files = list(names.values()) - logger.info( - "Will be creating the following output .h5mu files:\\\\n%s", - "\\\\n".join(output_files), - ) - df = pd.DataFrame({"name": modalities, "filename": output_files}) - logger.info("Writing output_types CSV file to '%s'.", par["output_types"]) - df.to_csv(par["output_types"], index=False) - - logger.info("Splitting input file into unimodal output files.") - for mod_name, mod in sample.mod.items(): - logger.info("Processing modality '%s'", mod_name) - new_sample = md.MuData({mod_name: mod}) + input_file = Path(par["input"]) + logger.info("Checking which modalities exist for '%s'", par["input"]) + with mudata_opener(input_file, mode="r") as (open_mudata, input_is_zarr): logger.info( - "Writing to '%s', with compression '%s'", - names[mod_name], - par["output_compression"], + "Opened %s in %s format.", par["input"], "zarr" if input_is_zarr else "h5" ) - new_sample.write_h5mu( - output_dir / names[mod_name], compression=par["output_compression"] + + modalities = list(open_mudata["mod"].keys()) + logger.info("Found the following modalities:\\\\n%s", "\\\\n".join(modalities)) + + logger.info("Creating output types CSV.") + output_extension = "zarr" if input_is_zarr else "h5mu" + names = { + mod_name: f"{input_file.stem}_{mod_name}.{output_extension}" + for mod_name in modalities + } + output_files = list(names.values()) + logger.info( + "Will be creating the following output .%s files:\\\\n%s", + output_extension, + "\\\\n".join(output_files), ) + df = pd.DataFrame({"name": modalities, "filename": output_files}) + logger.info("Writing output_types CSV file to '%s'.", par["output_types"]) + df.to_csv(par["output_types"], index=False) + + logger.info("Splitting input file into unimodal output files.") + for mod_name in modalities: + logger.info("Processing modality '%s'", mod_name) + elem_key = f"/mod/{mod_name}" + elem = open_mudata[elem_key] + logger.info("Reading %s", elem_key) + new_ad = ad.io.read_elem(elem) + logger.info("Creating MuData object.") + new_sample = md.MuData({mod_name: new_ad}) + logger.info( + "Writing to '%s', with compression '%s'", + names[mod_name], + par["output_compression"], + ) + writer = ( + partial(md.MuData.write_zarr, zarr_format=3) + if input_is_zarr + else partial( + md.MuData.write_h5mu, compression=par["output_compression"] + ) + ) + writer(new_sample, output_dir / names[mod_name]) logger.info("Done writing output file.") logger.info("Finished") @@ -3865,7 +3905,7 @@ meta["defaults"] = [ "container" : { "registry" : "images.viash-hub.com", "image" : "vsh/openpipeline/dataflow/split_modalities", - "tag" : "v4.0.3" + "tag" : "v4.1.0" }, "label" : [ "singlecpu", diff --git a/target/dependencies/vsh/vsh/openpipeline/v4.1.0/nextflow/dataflow/split_modalities/mudata_opener.py b/target/dependencies/vsh/vsh/openpipeline/v4.1.0/nextflow/dataflow/split_modalities/mudata_opener.py new file mode 100644 index 0000000..4d7286c --- /dev/null +++ b/target/dependencies/vsh/vsh/openpipeline/v4.1.0/nextflow/dataflow/split_modalities/mudata_opener.py @@ -0,0 +1,27 @@ +import zarr +import h5py +from contextlib import contextmanager + + +@contextmanager +def mudata_opener(file_loc, mode=None): + open_mudata = None + input_is_zarr = False + try: + open_mudata = zarr.open(file_loc, zarr_format=3, mode=mode) + input_is_zarr = True + yield open_mudata, input_is_zarr + except (zarr.errors.GroupNotFoundError, NotADirectoryError): + try: + open_mudata = h5py.File(file_loc, mode=mode) + yield open_mudata, input_is_zarr + except (FileNotFoundError, IsADirectoryError, KeyError) as e: + e.add_note(f"Could not open file {file_loc}.") + raise e + finally: + try: + if open_mudata: + open_mudata.close() + del open_mudata + except (AttributeError, UnboundLocalError): + pass diff --git a/target/dependencies/vsh/vsh/openpipeline/v4.0.3/nextflow/dataflow/split_modalities/nextflow.config b/target/dependencies/vsh/vsh/openpipeline/v4.1.0/nextflow/dataflow/split_modalities/nextflow.config similarity index 99% rename from target/dependencies/vsh/vsh/openpipeline/v4.0.3/nextflow/dataflow/split_modalities/nextflow.config rename to target/dependencies/vsh/vsh/openpipeline/v4.1.0/nextflow/dataflow/split_modalities/nextflow.config index 50808ba..4948225 100644 --- a/target/dependencies/vsh/vsh/openpipeline/v4.0.3/nextflow/dataflow/split_modalities/nextflow.config +++ b/target/dependencies/vsh/vsh/openpipeline/v4.1.0/nextflow/dataflow/split_modalities/nextflow.config @@ -2,7 +2,7 @@ manifest { name = 'dataflow/split_modalities' mainScript = 'main.nf' nextflowVersion = '!>=20.12.1-edge' - version = 'v4.0.3' + version = 'v4.1.0' description = 'Split the modalities from a single .h5mu multimodal sample into seperate .h5mu files. \n' author = 'Dries Schaumont, Robrecht Cannoodt' } diff --git a/target/dependencies/vsh/vsh/openpipeline/v4.0.3/nextflow/dimred/pca/nextflow_labels.config b/target/dependencies/vsh/vsh/openpipeline/v4.1.0/nextflow/dataflow/split_modalities/nextflow_labels.config similarity index 100% rename from target/dependencies/vsh/vsh/openpipeline/v4.0.3/nextflow/dimred/pca/nextflow_labels.config rename to target/dependencies/vsh/vsh/openpipeline/v4.1.0/nextflow/dataflow/split_modalities/nextflow_labels.config diff --git a/target/dependencies/vsh/vsh/openpipeline/v4.0.3/nextflow/dataflow/split_modalities/nextflow_schema.json b/target/dependencies/vsh/vsh/openpipeline/v4.1.0/nextflow/dataflow/split_modalities/nextflow_schema.json similarity index 93% rename from target/dependencies/vsh/vsh/openpipeline/v4.0.3/nextflow/dataflow/split_modalities/nextflow_schema.json rename to target/dependencies/vsh/vsh/openpipeline/v4.1.0/nextflow/dataflow/split_modalities/nextflow_schema.json index 7e4a6d1..2807393 100644 --- a/target/dependencies/vsh/vsh/openpipeline/v4.0.3/nextflow/dataflow/split_modalities/nextflow_schema.json +++ b/target/dependencies/vsh/vsh/openpipeline/v4.1.0/nextflow/dataflow/split_modalities/nextflow_schema.json @@ -14,7 +14,7 @@ "format": "path", "exists": true, "description": "Path to a single .h5mu file.", - "help_text": "Type: `file`, multiple: `False`, required, default: `\"sample_path\"`, direction: `input`. ", + "help_text": "Type: `file`, multiple: `False`, required, default: `\"sample_path\"`, direction: `input`, example: `\"input.h5mu\"`. ", "default": "sample_path" }, "output": { @@ -33,7 +33,7 @@ }, "output_compression": { "type": "string", - "description": "Compression format to use for the output AnnData and/or Mudata objects.\nBy default no compression is applied.\n", + "description": "Compression format to use for the output AnnData and/or Mudata H5 files.\nBy default no compression is applied.\n", "help_text": "Type: `string`, multiple: `False`, example: `\"gzip\"`, choices: ``gzip`, `lzf``. ", "enum": [ "gzip", diff --git a/target/dependencies/vsh/vsh/openpipeline/v4.0.3/nextflow/dataflow/split_modalities/setup_logger.py b/target/dependencies/vsh/vsh/openpipeline/v4.1.0/nextflow/dataflow/split_modalities/setup_logger.py similarity index 100% rename from target/dependencies/vsh/vsh/openpipeline/v4.0.3/nextflow/dataflow/split_modalities/setup_logger.py rename to target/dependencies/vsh/vsh/openpipeline/v4.1.0/nextflow/dataflow/split_modalities/setup_logger.py diff --git a/target/dependencies/vsh/vsh/openpipeline/v4.0.3/nextflow/dimred/pca/.config.vsh.yaml b/target/dependencies/vsh/vsh/openpipeline/v4.1.0/nextflow/dimred/pca/.config.vsh.yaml similarity index 85% rename from target/dependencies/vsh/vsh/openpipeline/v4.0.3/nextflow/dimred/pca/.config.vsh.yaml rename to target/dependencies/vsh/vsh/openpipeline/v4.1.0/nextflow/dimred/pca/.config.vsh.yaml index 01250b1..fbbc966 100644 --- a/target/dependencies/vsh/vsh/openpipeline/v4.0.3/nextflow/dimred/pca/.config.vsh.yaml +++ b/target/dependencies/vsh/vsh/openpipeline/v4.1.0/nextflow/dimred/pca/.config.vsh.yaml @@ -1,6 +1,6 @@ name: "pca" namespace: "dimred" -version: "v4.0.3" +version: "v4.1.0" authors: - name: "Dries De Maeyer" roles: @@ -17,6 +17,22 @@ authors: role: "Principal Scientist" argument_groups: - name: "Arguments" + arguments: + - type: "string" + name: "--output_compression" + description: "Compression format to use for the output AnnData and/or Mudata H5\ + \ files.\nBy default no compression is applied.\n" + info: null + example: + - "gzip" + required: false + choices: + - "gzip" + - "lzf" + direction: "input" + multiple: false + multiple_sep: ";" +- name: "inputs" arguments: - type: "file" name: "--input" @@ -62,6 +78,47 @@ argument_groups: direction: "input" multiple: false multiple_sep: ";" +- name: "Options" + arguments: + - type: "integer" + name: "--num_components" + description: "Number of principal components to compute. Defaults to 50, or 1\ + \ - minimum dimension size of selected representation." + info: null + example: + - 25 + required: false + direction: "input" + multiple: false + multiple_sep: ";" + - type: "boolean_true" + name: "--chunked" + description: "If True, perform an incremental PCA on segments of a predefined\ + \ size. Setting this flag automatically implies zero centering.\nMust be specified\ + \ together with --chunk_size.\n" + info: null + direction: "input" + - type: "integer" + name: "--chunk_size" + description: "Number of observations to include in each chunk. Required if chunked=True\ + \ was passed.\n" + info: null + required: false + min: 2 + direction: "input" + multiple: false + multiple_sep: ";" + - type: "integer" + name: "--seed" + description: "Used to set the initial states for the optimization. \n" + info: null + required: false + min: 0 + direction: "input" + multiple: false + multiple_sep: ";" +- name: "Outputs" + arguments: - type: "file" name: "--output" alternatives: @@ -106,36 +163,11 @@ argument_groups: direction: "input" multiple: false multiple_sep: ";" - - type: "integer" - name: "--num_components" - description: "Number of principal components to compute. Defaults to 50, or 1\ - \ - minimum dimension size of selected representation." - info: null - example: - - 25 - required: false - direction: "input" - multiple: false - multiple_sep: ";" - type: "boolean_true" name: "--overwrite" description: "Allow overwriting .obsm, .varm and .uns slots." info: null direction: "input" - - type: "string" - name: "--output_compression" - description: "Compression format to use for the output AnnData and/or Mudata objects.\n\ - By default no compression is applied.\n" - info: null - example: - - "gzip" - required: false - choices: - - "gzip" - - "lzf" - direction: "input" - multiple: false - multiple_sep: ";" resources: - type: "python_script" path: "script.py" @@ -147,8 +179,7 @@ resources: - type: "file" path: "nextflow_labels.config" dest: "nextflow_labels.config" -description: "Computes PCA coordinates, loadings and variance decomposition. Uses\ - \ the implementation of scikit-learn [Pedregosa11].\n" +description: "Computes PCA coordinates, loadings and variance decomposition.\n" test_resources: - type: "python_script" path: "test.py" @@ -238,9 +269,9 @@ runners: engines: - type: "docker" id: "docker" - image: "python:3.12-slim" + image: "python:3.13-slim" target_registry: "images.viash-hub.com" - target_tag: "v4.0.3" + target_tag: "v4.1.0" namespace_separator: "/" setup: - type: "apt" @@ -250,9 +281,10 @@ engines: - type: "python" user: false packages: - - "anndata~=0.12.7" + - "anndata~=0.12.16" - "awkward" - - "mudata~=0.3.2" + - "scipy~=1.17.1" + - "mudata~=0.3.8" - "scanpy~=1.11.4" script: - "exec(\"try:\\n import zarr; from importlib.metadata import version\\nexcept\ @@ -260,10 +292,16 @@ engines: ).partition(\\\".\\\")[0]) > 2\")" upgrade: true test_setup: + - type: "apt" + packages: + - "git" + interactive: false - type: "python" user: false packages: - - "viashpy==0.8.0" + - "viashpy==0.10.0" + github: + - "openpipelines-bio/core#subdirectory=packages/python/openpipeline_testutils" upgrade: true entrypoint: [] cmd: null @@ -275,12 +313,12 @@ build_info: engine: "docker|native" output: "target/nextflow/dimred/pca" executable: "target/nextflow/dimred/pca/main.nf" - viash_version: "0.9.4" - git_commit: "7bfad4ea12f87eca59213be3ab08deff67cc4206" + viash_version: "0.9.7" + git_commit: "a6499fddaa8553874585c747370f919f4d7b729c" git_remote: "https://github.com/openpipelines-bio/openpipeline" package_config: name: "openpipeline" - version: "v4.0.3" + version: "v4.1.0" summary: "Best-practice workflows for single-cell multi-omics analyses.\n" description: "OpenPipelines are extensible single cell analysis pipelines for reproducible\ \ and large-scale single cell processing using [Viash](https://viash.io) and [Nextflow](https://www.nextflow.io/).\n\ @@ -301,7 +339,7 @@ package_config: - path: "src/workflows/utils/labels_ci.config" description: "Adds the correct memory and CPU labels when running on the Viash\ \ Hub CI." - viash_version: "0.9.4" + viash_version: "0.9.7" source: "src" target: "target" config_mods: @@ -310,7 +348,7 @@ package_config: )'" - ".engines += { type: \"native\" }" - ".engines[.type == 'docker'].target_registry := 'images.viash-hub.com'" - - ".engines[.type == 'docker'].target_tag := 'v4.0.3'" + - ".engines[.type == 'docker'].target_tag := 'v4.1.0'" keywords: - "single-cell" - "multimodal" diff --git a/target/dependencies/vsh/vsh/openpipeline/v4.0.3/nextflow/dimred/pca/compress_h5mu.py b/target/dependencies/vsh/vsh/openpipeline/v4.1.0/nextflow/dimred/pca/compress_h5mu.py similarity index 100% rename from target/dependencies/vsh/vsh/openpipeline/v4.0.3/nextflow/dimred/pca/compress_h5mu.py rename to target/dependencies/vsh/vsh/openpipeline/v4.1.0/nextflow/dimred/pca/compress_h5mu.py diff --git a/target/dependencies/vsh/vsh/openpipeline/v4.0.3/nextflow/dimred/pca/main.nf b/target/dependencies/vsh/vsh/openpipeline/v4.1.0/nextflow/dimred/pca/main.nf similarity index 96% rename from target/dependencies/vsh/vsh/openpipeline/v4.0.3/nextflow/dimred/pca/main.nf rename to target/dependencies/vsh/vsh/openpipeline/v4.1.0/nextflow/dimred/pca/main.nf index 51366e4..e1606cd 100644 --- a/target/dependencies/vsh/vsh/openpipeline/v4.0.3/nextflow/dimred/pca/main.nf +++ b/target/dependencies/vsh/vsh/openpipeline/v4.1.0/nextflow/dimred/pca/main.nf @@ -1,6 +1,6 @@ -// pca v4.0.3 +// pca v4.1.0 // -// This wrapper script is auto-generated by viash 0.9.4 and is thus a derivative +// This wrapper script is auto-generated by viash 0.9.7 and is thus a derivative // work thereof. This software comes with ABSOLUTELY NO WARRANTY from Data // Intuitive. // @@ -1353,47 +1353,42 @@ def readCsv(file_path) { def splitRegex = java.util.regex.Pattern.compile(''',(?=(?:[^"]*"[^"]*")*[^"]*$)''') def removeQuote = java.util.regex.Pattern.compile('''"(.*)"''') - def br = java.nio.file.Files.newBufferedReader(inputFile) + java.nio.file.Files.newBufferedReader(inputFile).withCloseable { br -> + def row = 0 + def header = null + def line - def row = -1 - def header = null - while (br.ready() && header == null) { - def line = br.readLine() - row++ - if (!line.startsWith("#")) { - header = splitRegex.split(line, -1).collect{field -> - m = removeQuote.matcher(field) - m.find() ? m.replaceFirst('$1') : field - } - } - } - assert header != null: "CSV file should contain a header" - - while (br.ready()) { - def line = br.readLine() - row++ - if (line == null) { - br.close() - break - } - - if (!line.startsWith("#")) { - def predata = splitRegex.split(line, -1) - def data = predata.collect{field -> - if (field == "") { - return null - } - def m = removeQuote.matcher(field) - if (m.find()) { - return m.replaceFirst('$1') - } else { - return field + while (header == null && (line = br.readLine()) != null) { + if (!line.startsWith("#")) { + header = splitRegex.split(line, -1).collect { field -> + def m = removeQuote.matcher(field) + m.find() ? m.replaceFirst('$1') : field } } - assert header.size() == data.size(): "Row $row should contain the same number as fields as the header" - - def dataMap = [header, data].transpose().collectEntries().findAll{it.value != null} - output.add(dataMap) + row++ + } + assert header != null : "CSV file should contain a header" + + while ((line = br.readLine()) != null) { + row++ + if (!line.startsWith("#")) { + def predata = splitRegex.split(line, -1) + def data = predata.collect { field -> + if (field == "") { + return null + } + def m = removeQuote.matcher(field) + if (m.find()) { + return m.replaceFirst('$1') + } else { + return field + } + } + assert header.size() == data.size() : "Row $row should contain the same number as fields as the header" + + def dataMap = [header, data].transpose().collectEntries().findAll { it.value != null } + output.add(dataMap) + } } } @@ -1709,10 +1704,25 @@ process publishFilesProc { ] .transpose() .collectMany{infile, outfile -> - if (infile.toString() != outfile.toString()) { + def infileString = infile.toString() + def outfileString = outfile.toString() + if (infileString != outfileString) { + /* Trailing slashes are removed from both the source and destination arguments. + From source arguments, this is useful when a source argument may have a trailing slash + and specify a symbolic link to a directory. Without removing the slash, cp will dereference + the symbolic link. + See https://www.gnu.org/software/coreutils/manual/html_node/Trailing-slashes.html#Trailing-slashes-1 + + For the destination path addding a trailing slash is a problem when publishing directories: + it requires the destination directory to exist. This fails because we only create the parent + directories first. + */ + def regexTrailingSlashes = ~/\/+$/ + def infileNoTrailingSlash = infileString - regexTrailingSlashes + def outfileNoTrailingSlash = outfileString - regexTrailingSlashes [ - "[ -d \"\$(dirname '${outfile.toString()}')\" ] || mkdir -p \"\$(dirname '${outfile.toString()}')\"", - "cp -r '${infile.toString()}' '${outfile.toString()}'" + "[ -d \"\$(dirname '${outfileNoTrailingSlash}')\" ] || mkdir -p \"\$(dirname '${outfileNoTrailingSlash}')\"", + "cp -a '${infileNoTrailingSlash}' '${outfileNoTrailingSlash}'" ] } else { // no need to copy if infile is the same as outfile @@ -3035,7 +3045,7 @@ meta = [ "config": processConfig(readJsonBlob('''{ "name" : "pca", "namespace" : "dimred", - "version" : "v4.0.3", + "version" : "v4.1.0", "authors" : [ { "name" : "Dries De Maeyer", @@ -3062,6 +3072,27 @@ meta = [ "argument_groups" : [ { "name" : "Arguments", + "arguments" : [ + { + "type" : "string", + "name" : "--output_compression", + "description" : "Compression format to use for the output AnnData and/or Mudata H5 files.\nBy default no compression is applied.\n", + "example" : [ + "gzip" + ], + "required" : false, + "choices" : [ + "gzip", + "lzf" + ], + "direction" : "input", + "multiple" : false, + "multiple_sep" : ";" + } + ] + }, + { + "name" : "inputs", "arguments" : [ { "type" : "file", @@ -3112,7 +3143,55 @@ meta = [ "direction" : "input", "multiple" : false, "multiple_sep" : ";" + } + ] + }, + { + "name" : "Options", + "arguments" : [ + { + "type" : "integer", + "name" : "--num_components", + "description" : "Number of principal components to compute. Defaults to 50, or 1 - minimum dimension size of selected representation.", + "example" : [ + 25 + ], + "required" : false, + "direction" : "input", + "multiple" : false, + "multiple_sep" : ";" }, + { + "type" : "boolean_true", + "name" : "--chunked", + "description" : "If True, perform an incremental PCA on segments of a predefined size. Setting this flag automatically implies zero centering.\nMust be specified together with --chunk_size.\n", + "direction" : "input" + }, + { + "type" : "integer", + "name" : "--chunk_size", + "description" : "Number of observations to include in each chunk. Required if chunked=True was passed.\n", + "required" : false, + "min" : 2, + "direction" : "input", + "multiple" : false, + "multiple_sep" : ";" + }, + { + "type" : "integer", + "name" : "--seed", + "description" : "Used to set the initial states for the optimization. \n", + "required" : false, + "min" : 0, + "direction" : "input", + "multiple" : false, + "multiple_sep" : ";" + } + ] + }, + { + "name" : "Outputs", + "arguments" : [ { "type" : "file", "name" : "--output", @@ -3166,39 +3245,11 @@ meta = [ "multiple" : false, "multiple_sep" : ";" }, - { - "type" : "integer", - "name" : "--num_components", - "description" : "Number of principal components to compute. Defaults to 50, or 1 - minimum dimension size of selected representation.", - "example" : [ - 25 - ], - "required" : false, - "direction" : "input", - "multiple" : false, - "multiple_sep" : ";" - }, { "type" : "boolean_true", "name" : "--overwrite", "description" : "Allow overwriting .obsm, .varm and .uns slots.", "direction" : "input" - }, - { - "type" : "string", - "name" : "--output_compression", - "description" : "Compression format to use for the output AnnData and/or Mudata objects.\nBy default no compression is applied.\n", - "example" : [ - "gzip" - ], - "required" : false, - "choices" : [ - "gzip", - "lzf" - ], - "direction" : "input", - "multiple" : false, - "multiple_sep" : ";" } ] } @@ -3223,7 +3274,7 @@ meta = [ "dest" : "nextflow_labels.config" } ], - "description" : "Computes PCA coordinates, loadings and variance decomposition. Uses the implementation of scikit-learn [Pedregosa11].\n", + "description" : "Computes PCA coordinates, loadings and variance decomposition.\n", "test_resources" : [ { "type" : "python_script", @@ -3331,9 +3382,9 @@ meta = [ { "type" : "docker", "id" : "docker", - "image" : "python:3.12-slim", + "image" : "python:3.13-slim", "target_registry" : "images.viash-hub.com", - "target_tag" : "v4.0.3", + "target_tag" : "v4.1.0", "namespace_separator" : "/", "setup" : [ { @@ -3347,9 +3398,10 @@ meta = [ "type" : "python", "user" : false, "packages" : [ - "anndata~=0.12.7", + "anndata~=0.12.16", "awkward", - "mudata~=0.3.2", + "scipy~=1.17.1", + "mudata~=0.3.8", "scanpy~=1.11.4" ], "script" : [ @@ -3359,11 +3411,21 @@ meta = [ } ], "test_setup" : [ + { + "type" : "apt", + "packages" : [ + "git" + ], + "interactive" : false + }, { "type" : "python", "user" : false, "packages" : [ - "viashpy==0.8.0" + "viashpy==0.10.0" + ], + "github" : [ + "openpipelines-bio/core#subdirectory=packages/python/openpipeline_testutils" ], "upgrade" : true } @@ -3379,13 +3441,13 @@ meta = [ "runner" : "nextflow", "engine" : "docker|native", "output" : "/workdir/root/repo/target/nextflow/dimred/pca", - "viash_version" : "0.9.4", - "git_commit" : "7bfad4ea12f87eca59213be3ab08deff67cc4206", + "viash_version" : "0.9.7", + "git_commit" : "a6499fddaa8553874585c747370f919f4d7b729c", "git_remote" : "https://github.com/openpipelines-bio/openpipeline" }, "package_config" : { "name" : "openpipeline", - "version" : "v4.0.3", + "version" : "v4.1.0", "summary" : "Best-practice workflows for single-cell multi-omics analyses.\n", "description" : "OpenPipelines are extensible single cell analysis pipelines for reproducible and large-scale single cell processing using [Viash](https://viash.io) and [Nextflow](https://www.nextflow.io/).\n\nIn terms of workflows, the following has been made available, but keep in mind that\nindividual tools and functionality can be executed as standalone components as well.\n\n * Demultiplexing: conversion of raw sequencing data to FASTQ objects.\n * Ingestion: Read mapping and generating a count matrix.\n * Single sample processing: cell filtering and doublet detection.\n * Multisample processing: Count transformation, normalization, QC metric calulations.\n * Integration: Clustering, integration and batch correction using single and multimodal methods.\n * Downstream analysis workflows\n", "info" : { @@ -3403,14 +3465,14 @@ meta = [ } ] }, - "viash_version" : "0.9.4", + "viash_version" : "0.9.7", "source" : "/workdir/root/repo/src", "target" : "/workdir/root/repo/target", "config_mods" : [ ".resources += {path: '/src/workflows/utils/labels.config', dest: 'nextflow_labels.config'}\n.runners[.type == 'nextflow'].config.script := 'includeConfig(\\"nextflow_labels.config\\")'", ".engines += { type: \\"native\\" }", ".engines[.type == 'docker'].target_registry := 'images.viash-hub.com'", - ".engines[.type == 'docker'].target_tag := 'v4.0.3'" + ".engines[.type == 'docker'].target_tag := 'v4.1.0'" ], "keywords" : [ "single-cell", @@ -3441,22 +3503,26 @@ cat > "$tempscript" << VIASHMAIN import scanpy as sc import mudata as mu import sys +import pandas as pd from anndata import AnnData ## VIASH START # The following code has been auto-generated by Viash. par = { + 'output_compression': $( if [ ! -z ${VIASH_PAR_OUTPUT_COMPRESSION+x} ]; then echo "r'${VIASH_PAR_OUTPUT_COMPRESSION//\\'/\\'\\"\\'\\"r\\'}'"; else echo None; fi ), 'input': $( if [ ! -z ${VIASH_PAR_INPUT+x} ]; then echo "r'${VIASH_PAR_INPUT//\\'/\\'\\"\\'\\"r\\'}'"; else echo None; fi ), 'modality': $( if [ ! -z ${VIASH_PAR_MODALITY+x} ]; then echo "r'${VIASH_PAR_MODALITY//\\'/\\'\\"\\'\\"r\\'}'"; else echo None; fi ), 'layer': $( if [ ! -z ${VIASH_PAR_LAYER+x} ]; then echo "r'${VIASH_PAR_LAYER//\\'/\\'\\"\\'\\"r\\'}'"; else echo None; fi ), 'var_input': $( if [ ! -z ${VIASH_PAR_VAR_INPUT+x} ]; then echo "r'${VIASH_PAR_VAR_INPUT//\\'/\\'\\"\\'\\"r\\'}'"; else echo None; fi ), + 'num_components': $( if [ ! -z ${VIASH_PAR_NUM_COMPONENTS+x} ]; then echo "int(r'${VIASH_PAR_NUM_COMPONENTS//\\'/\\'\\"\\'\\"r\\'}')"; else echo None; fi ), + 'chunked': $( if [ ! -z ${VIASH_PAR_CHUNKED+x} ]; then echo "r'${VIASH_PAR_CHUNKED//\\'/\\'\\"\\'\\"r\\'}'.lower() == 'true'"; else echo None; fi ), + 'chunk_size': $( if [ ! -z ${VIASH_PAR_CHUNK_SIZE+x} ]; then echo "int(r'${VIASH_PAR_CHUNK_SIZE//\\'/\\'\\"\\'\\"r\\'}')"; else echo None; fi ), + 'seed': $( if [ ! -z ${VIASH_PAR_SEED+x} ]; then echo "int(r'${VIASH_PAR_SEED//\\'/\\'\\"\\'\\"r\\'}')"; else echo None; fi ), 'output': $( if [ ! -z ${VIASH_PAR_OUTPUT+x} ]; then echo "r'${VIASH_PAR_OUTPUT//\\'/\\'\\"\\'\\"r\\'}'"; else echo None; fi ), 'obsm_output': $( if [ ! -z ${VIASH_PAR_OBSM_OUTPUT+x} ]; then echo "r'${VIASH_PAR_OBSM_OUTPUT//\\'/\\'\\"\\'\\"r\\'}'"; else echo None; fi ), 'varm_output': $( if [ ! -z ${VIASH_PAR_VARM_OUTPUT+x} ]; then echo "r'${VIASH_PAR_VARM_OUTPUT//\\'/\\'\\"\\'\\"r\\'}'"; else echo None; fi ), 'uns_output': $( if [ ! -z ${VIASH_PAR_UNS_OUTPUT+x} ]; then echo "r'${VIASH_PAR_UNS_OUTPUT//\\'/\\'\\"\\'\\"r\\'}'"; else echo None; fi ), - 'num_components': $( if [ ! -z ${VIASH_PAR_NUM_COMPONENTS+x} ]; then echo "int(r'${VIASH_PAR_NUM_COMPONENTS//\\'/\\'\\"\\'\\"r\\'}')"; else echo None; fi ), - 'overwrite': $( if [ ! -z ${VIASH_PAR_OVERWRITE+x} ]; then echo "r'${VIASH_PAR_OVERWRITE//\\'/\\'\\"\\'\\"r\\'}'.lower() == 'true'"; else echo None; fi ), - 'output_compression': $( if [ ! -z ${VIASH_PAR_OUTPUT_COMPRESSION+x} ]; then echo "r'${VIASH_PAR_OUTPUT_COMPRESSION//\\'/\\'\\"\\'\\"r\\'}'"; else echo None; fi ) + 'overwrite': $( if [ ! -z ${VIASH_PAR_OVERWRITE+x} ]; then echo "r'${VIASH_PAR_OVERWRITE//\\'/\\'\\"\\'\\"r\\'}'.lower() == 'true'"; else echo None; fi ) } meta = { 'name': $( if [ ! -z ${VIASH_META_NAME+x} ]; then echo "r'${VIASH_META_NAME//\\'/\\'\\"\\'\\"r\\'}'"; else echo None; fi ), @@ -3496,11 +3562,24 @@ data = mu.read_h5ad(par["input"], mod=par["modality"]) logger.info("Computing PCA components for modality '%s'", par["modality"]) if par["layer"] and par["layer"] not in data.layers: raise ValueError(f"{par['layer']} was not found in modality {par['modality']}.") -layer = data.X if not par["layer"] else data.layers[par["layer"]] -adata_input_layer = AnnData(layer) -adata_input_layer.var.index = data.var.index -use_highly_variable = False +chunked, chunk_size = par["chunked"], par["chunk_size"] +if chunked: + if not chunk_size: + raise ValueError( + "Requested to perform an incremental PCA " + "('chunked'), but the chunk size is not set." + ) + if chunk_size < par["num_components"]: + raise ValueError( + f"The requested chunk size ({chunk_size}) must not be smaller " + f"than the number of components ({par['num_components']})" + ) + +layer = data.X if not par["layer"] else data.layers[par["layer"]] +adata_input_layer = AnnData(layer, var=pd.DataFrame([], index=data.var.index)) + +mask_var = None if par["var_input"]: if par["var_input"] not in data.var.columns: raise ValueError( @@ -3508,15 +3587,18 @@ if par["var_input"]: "as a selection of genes to run the PCA on, " f"but the column is not available for modality {par['modality']}" ) - use_highly_variable = True - adata_input_layer.var["highly_variable"] = data.var[par["var_input"]] + mask_var = data.var[par["var_input"]] # run pca -output_adata = sc.tl.pca( +sc.tl.pca( adata_input_layer, n_comps=par["num_components"], - copy=True, - use_highly_variable=use_highly_variable, + copy=False, # A copy was already created + return_info=True, + mask_var=mask_var, + chunked=chunked, + chunk_size=chunk_size, + random_state=par["seed"], ) # store output in specific objects @@ -3535,11 +3617,11 @@ for parameter_name, field in check_exist_dict.items(): ) del getattr(data, field)[par[parameter_name]] -data.obsm[par["obsm_output"]] = output_adata.obsm["X_pca"] -data.varm[par["varm_output"]] = output_adata.varm["PCs"] +data.obsm[par["obsm_output"]] = adata_input_layer.obsm["X_pca"] +data.varm[par["varm_output"]] = adata_input_layer.varm["PCs"] data.uns[par["uns_output"]] = { - "variance": output_adata.uns["pca"]["variance"], - "variance_ratio": output_adata.uns["pca"]["variance_ratio"], + "variance": adata_input_layer.uns["pca"]["variance"], + "variance_ratio": adata_input_layer.uns["pca"]["variance_ratio"], } @@ -3933,7 +4015,7 @@ meta["defaults"] = [ "container" : { "registry" : "images.viash-hub.com", "image" : "vsh/openpipeline/dimred/pca", - "tag" : "v4.0.3" + "tag" : "v4.1.0" }, "label" : [ "highcpu", diff --git a/target/dependencies/vsh/vsh/openpipeline/v4.0.3/nextflow/dimred/pca/nextflow.config b/target/dependencies/vsh/vsh/openpipeline/v4.1.0/nextflow/dimred/pca/nextflow.config similarity index 97% rename from target/dependencies/vsh/vsh/openpipeline/v4.0.3/nextflow/dimred/pca/nextflow.config rename to target/dependencies/vsh/vsh/openpipeline/v4.1.0/nextflow/dimred/pca/nextflow.config index dfd1032..a0df88a 100644 --- a/target/dependencies/vsh/vsh/openpipeline/v4.0.3/nextflow/dimred/pca/nextflow.config +++ b/target/dependencies/vsh/vsh/openpipeline/v4.1.0/nextflow/dimred/pca/nextflow.config @@ -2,8 +2,8 @@ manifest { name = 'dimred/pca' mainScript = 'main.nf' nextflowVersion = '!>=20.12.1-edge' - version = 'v4.0.3' - description = 'Computes PCA coordinates, loadings and variance decomposition. Uses the implementation of scikit-learn [Pedregosa11].\n' + version = 'v4.1.0' + description = 'Computes PCA coordinates, loadings and variance decomposition.\n' author = 'Dries De Maeyer' } diff --git a/target/dependencies/vsh/vsh/openpipeline/v4.0.3/nextflow/dimred/umap/nextflow_labels.config b/target/dependencies/vsh/vsh/openpipeline/v4.1.0/nextflow/dimred/pca/nextflow_labels.config similarity index 100% rename from target/dependencies/vsh/vsh/openpipeline/v4.0.3/nextflow/dimred/umap/nextflow_labels.config rename to target/dependencies/vsh/vsh/openpipeline/v4.1.0/nextflow/dimred/pca/nextflow_labels.config diff --git a/target/dependencies/vsh/vsh/openpipeline/v4.0.3/nextflow/dimred/pca/nextflow_schema.json b/target/dependencies/vsh/vsh/openpipeline/v4.1.0/nextflow/dimred/pca/nextflow_schema.json similarity index 74% rename from target/dependencies/vsh/vsh/openpipeline/v4.0.3/nextflow/dimred/pca/nextflow_schema.json rename to target/dependencies/vsh/vsh/openpipeline/v4.1.0/nextflow/dimred/pca/nextflow_schema.json index c9eb093..4c54bad 100644 --- a/target/dependencies/vsh/vsh/openpipeline/v4.0.3/nextflow/dimred/pca/nextflow_schema.json +++ b/target/dependencies/vsh/vsh/openpipeline/v4.1.0/nextflow/dimred/pca/nextflow_schema.json @@ -1,37 +1,14 @@ { "$schema": "https://json-schema.org/draft/2020-12/schema", "title": "pca", - "description": "Computes PCA coordinates, loadings and variance decomposition. Uses the implementation of scikit-learn [Pedregosa11].\n", + "description": "Computes PCA coordinates, loadings and variance decomposition.\n", "type": "object", "$defs": { - "arguments": { - "title": "Arguments", + "outputs": { + "title": "Outputs", "type": "object", "description": "No description", "properties": { - "input": { - "type": "string", - "format": "path", - "exists": true, - "description": "Input h5mu file", - "help_text": "Type: `file`, multiple: `False`, required, direction: `input`, example: `\"input.h5mu\"`. " - }, - "modality": { - "type": "string", - "description": "Which modality from the input MuData file to process.\n", - "help_text": "Type: `string`, multiple: `False`, default: `\"rna\"`. ", - "default": "rna" - }, - "layer": { - "type": "string", - "description": "Use specified layer for expression values instead of the .X object from the modality.", - "help_text": "Type: `string`, multiple: `False`. " - }, - "var_input": { - "type": "string", - "description": "Column name in .var matrix that will be used to select which genes to run the PCA on.", - "help_text": "Type: `string`, multiple: `False`, example: `\"filter_with_hvg\"`. " - }, "output": { "type": "string", "format": "path", @@ -57,20 +34,22 @@ "help_text": "Type: `string`, multiple: `False`, default: `\"pca_variance\"`. ", "default": "pca_variance" }, - "num_components": { - "type": "integer", - "description": "Number of principal components to compute", - "help_text": "Type: `integer`, multiple: `False`, example: `25`. " - }, "overwrite": { "type": "boolean", "description": "Allow overwriting .obsm, .varm and .uns slots.", "help_text": "Type: `boolean_true`, multiple: `False`, default: `false`. ", "default": false - }, + } + } + }, + "arguments": { + "title": "Arguments", + "type": "object", + "description": "No description", + "properties": { "output_compression": { "type": "string", - "description": "Compression format to use for the output AnnData and/or Mudata objects.\nBy default no compression is applied.\n", + "description": "Compression format to use for the output AnnData and/or Mudata H5 files.\nBy default no compression is applied.\n", "help_text": "Type: `string`, multiple: `False`, example: `\"gzip\"`, choices: ``gzip`, `lzf``. ", "enum": [ "gzip", @@ -79,6 +58,64 @@ } } }, + "inputs": { + "title": "inputs", + "type": "object", + "description": "No description", + "properties": { + "input": { + "type": "string", + "format": "path", + "exists": true, + "description": "Input h5mu file", + "help_text": "Type: `file`, multiple: `False`, required, direction: `input`, example: `\"input.h5mu\"`. " + }, + "modality": { + "type": "string", + "description": "Which modality from the input MuData file to process.\n", + "help_text": "Type: `string`, multiple: `False`, default: `\"rna\"`. ", + "default": "rna" + }, + "layer": { + "type": "string", + "description": "Use specified layer for expression values instead of the .X object from the modality.", + "help_text": "Type: `string`, multiple: `False`. " + }, + "var_input": { + "type": "string", + "description": "Column name in .var matrix that will be used to select which genes to run the PCA on.", + "help_text": "Type: `string`, multiple: `False`, example: `\"filter_with_hvg\"`. " + } + } + }, + "options": { + "title": "Options", + "type": "object", + "description": "No description", + "properties": { + "num_components": { + "type": "integer", + "description": "Number of principal components to compute", + "help_text": "Type: `integer`, multiple: `False`, example: `25`. " + }, + "chunked": { + "type": "boolean", + "description": "If True, perform an incremental PCA on segments of a predefined size", + "help_text": "Type: `boolean_true`, multiple: `False`, default: `false`. ", + "default": false + }, + "chunk_size": { + "type": "integer", + "description": "Number of observations to include in each chunk", + "help_text": "Type: `integer`, multiple: `False`. " + }, + "seed": { + "type": "integer", + "description": "Used to set the initial states for the optimization", + "help_text": "Type: `integer`, multiple: `False`. " + } + } + }, "nextflow input-output arguments": { "title": "Nextflow input-output arguments", "type": "object", @@ -93,9 +130,18 @@ } }, "allOf": [ + { + "$ref": "#/$defs/outputs" + }, { "$ref": "#/$defs/arguments" }, + { + "$ref": "#/$defs/inputs" + }, + { + "$ref": "#/$defs/options" + }, { "$ref": "#/$defs/nextflow input-output arguments" } diff --git a/target/dependencies/vsh/vsh/openpipeline/v4.0.3/nextflow/dimred/pca/setup_logger.py b/target/dependencies/vsh/vsh/openpipeline/v4.1.0/nextflow/dimred/pca/setup_logger.py similarity index 100% rename from target/dependencies/vsh/vsh/openpipeline/v4.0.3/nextflow/dimred/pca/setup_logger.py rename to target/dependencies/vsh/vsh/openpipeline/v4.1.0/nextflow/dimred/pca/setup_logger.py diff --git a/target/dependencies/vsh/vsh/openpipeline/v4.0.3/nextflow/dimred/umap/.config.vsh.yaml b/target/dependencies/vsh/vsh/openpipeline/v4.1.0/nextflow/dimred/umap/.config.vsh.yaml similarity index 96% rename from target/dependencies/vsh/vsh/openpipeline/v4.0.3/nextflow/dimred/umap/.config.vsh.yaml rename to target/dependencies/vsh/vsh/openpipeline/v4.1.0/nextflow/dimred/umap/.config.vsh.yaml index 8959aa4..84b20a6 100644 --- a/target/dependencies/vsh/vsh/openpipeline/v4.0.3/nextflow/dimred/umap/.config.vsh.yaml +++ b/target/dependencies/vsh/vsh/openpipeline/v4.1.0/nextflow/dimred/umap/.config.vsh.yaml @@ -1,6 +1,6 @@ name: "umap" namespace: "dimred" -version: "v4.0.3" +version: "v4.1.0" authors: - name: "Dries De Maeyer" roles: @@ -78,8 +78,8 @@ argument_groups: multiple_sep: ";" - type: "string" name: "--output_compression" - description: "Compression format to use for the output AnnData and/or Mudata objects.\n\ - By default no compression is applied.\n" + description: "Compression format to use for the output AnnData and/or Mudata H5\ + \ files.\nBy default no compression is applied.\n" info: null example: - "gzip" @@ -294,7 +294,7 @@ engines: id: "docker" image: "python:3.12-slim" target_registry: "images.viash-hub.com" - target_tag: "v4.0.3" + target_tag: "v4.1.0" namespace_separator: "/" setup: - type: "apt" @@ -304,9 +304,10 @@ engines: - type: "python" user: false packages: - - "anndata~=0.12.7" + - "anndata~=0.12.16" - "awkward" - - "mudata~=0.3.2" + - "scipy~=1.17.1" + - "mudata~=0.3.8" - "scanpy~=1.11.4" script: - "exec(\"try:\\n import zarr; from importlib.metadata import version\\nexcept\ @@ -317,7 +318,7 @@ engines: - type: "python" user: false packages: - - "viashpy==0.8.0" + - "viashpy==0.10.0" upgrade: true entrypoint: [] cmd: null @@ -329,12 +330,12 @@ build_info: engine: "docker|native" output: "target/nextflow/dimred/umap" executable: "target/nextflow/dimred/umap/main.nf" - viash_version: "0.9.4" - git_commit: "7bfad4ea12f87eca59213be3ab08deff67cc4206" + viash_version: "0.9.7" + git_commit: "a6499fddaa8553874585c747370f919f4d7b729c" git_remote: "https://github.com/openpipelines-bio/openpipeline" package_config: name: "openpipeline" - version: "v4.0.3" + version: "v4.1.0" summary: "Best-practice workflows for single-cell multi-omics analyses.\n" description: "OpenPipelines are extensible single cell analysis pipelines for reproducible\ \ and large-scale single cell processing using [Viash](https://viash.io) and [Nextflow](https://www.nextflow.io/).\n\ @@ -355,7 +356,7 @@ package_config: - path: "src/workflows/utils/labels_ci.config" description: "Adds the correct memory and CPU labels when running on the Viash\ \ Hub CI." - viash_version: "0.9.4" + viash_version: "0.9.7" source: "src" target: "target" config_mods: @@ -364,7 +365,7 @@ package_config: )'" - ".engines += { type: \"native\" }" - ".engines[.type == 'docker'].target_registry := 'images.viash-hub.com'" - - ".engines[.type == 'docker'].target_tag := 'v4.0.3'" + - ".engines[.type == 'docker'].target_tag := 'v4.1.0'" keywords: - "single-cell" - "multimodal" diff --git a/target/dependencies/vsh/vsh/openpipeline/v4.0.3/nextflow/dimred/umap/compress_h5mu.py b/target/dependencies/vsh/vsh/openpipeline/v4.1.0/nextflow/dimred/umap/compress_h5mu.py similarity index 100% rename from target/dependencies/vsh/vsh/openpipeline/v4.0.3/nextflow/dimred/umap/compress_h5mu.py rename to target/dependencies/vsh/vsh/openpipeline/v4.1.0/nextflow/dimred/umap/compress_h5mu.py diff --git a/target/dependencies/vsh/vsh/openpipeline/v4.0.3/nextflow/dimred/umap/main.nf b/target/dependencies/vsh/vsh/openpipeline/v4.1.0/nextflow/dimred/umap/main.nf similarity index 98% rename from target/dependencies/vsh/vsh/openpipeline/v4.0.3/nextflow/dimred/umap/main.nf rename to target/dependencies/vsh/vsh/openpipeline/v4.1.0/nextflow/dimred/umap/main.nf index 4641b53..23780f7 100644 --- a/target/dependencies/vsh/vsh/openpipeline/v4.0.3/nextflow/dimred/umap/main.nf +++ b/target/dependencies/vsh/vsh/openpipeline/v4.1.0/nextflow/dimred/umap/main.nf @@ -1,6 +1,6 @@ -// umap v4.0.3 +// umap v4.1.0 // -// This wrapper script is auto-generated by viash 0.9.4 and is thus a derivative +// This wrapper script is auto-generated by viash 0.9.7 and is thus a derivative // work thereof. This software comes with ABSOLUTELY NO WARRANTY from Data // Intuitive. // @@ -1353,47 +1353,42 @@ def readCsv(file_path) { def splitRegex = java.util.regex.Pattern.compile(''',(?=(?:[^"]*"[^"]*")*[^"]*$)''') def removeQuote = java.util.regex.Pattern.compile('''"(.*)"''') - def br = java.nio.file.Files.newBufferedReader(inputFile) + java.nio.file.Files.newBufferedReader(inputFile).withCloseable { br -> + def row = 0 + def header = null + def line - def row = -1 - def header = null - while (br.ready() && header == null) { - def line = br.readLine() - row++ - if (!line.startsWith("#")) { - header = splitRegex.split(line, -1).collect{field -> - m = removeQuote.matcher(field) - m.find() ? m.replaceFirst('$1') : field - } - } - } - assert header != null: "CSV file should contain a header" - - while (br.ready()) { - def line = br.readLine() - row++ - if (line == null) { - br.close() - break - } - - if (!line.startsWith("#")) { - def predata = splitRegex.split(line, -1) - def data = predata.collect{field -> - if (field == "") { - return null - } - def m = removeQuote.matcher(field) - if (m.find()) { - return m.replaceFirst('$1') - } else { - return field + while (header == null && (line = br.readLine()) != null) { + if (!line.startsWith("#")) { + header = splitRegex.split(line, -1).collect { field -> + def m = removeQuote.matcher(field) + m.find() ? m.replaceFirst('$1') : field } } - assert header.size() == data.size(): "Row $row should contain the same number as fields as the header" - - def dataMap = [header, data].transpose().collectEntries().findAll{it.value != null} - output.add(dataMap) + row++ + } + assert header != null : "CSV file should contain a header" + + while ((line = br.readLine()) != null) { + row++ + if (!line.startsWith("#")) { + def predata = splitRegex.split(line, -1) + def data = predata.collect { field -> + if (field == "") { + return null + } + def m = removeQuote.matcher(field) + if (m.find()) { + return m.replaceFirst('$1') + } else { + return field + } + } + assert header.size() == data.size() : "Row $row should contain the same number as fields as the header" + + def dataMap = [header, data].transpose().collectEntries().findAll { it.value != null } + output.add(dataMap) + } } } @@ -1709,10 +1704,25 @@ process publishFilesProc { ] .transpose() .collectMany{infile, outfile -> - if (infile.toString() != outfile.toString()) { + def infileString = infile.toString() + def outfileString = outfile.toString() + if (infileString != outfileString) { + /* Trailing slashes are removed from both the source and destination arguments. + From source arguments, this is useful when a source argument may have a trailing slash + and specify a symbolic link to a directory. Without removing the slash, cp will dereference + the symbolic link. + See https://www.gnu.org/software/coreutils/manual/html_node/Trailing-slashes.html#Trailing-slashes-1 + + For the destination path addding a trailing slash is a problem when publishing directories: + it requires the destination directory to exist. This fails because we only create the parent + directories first. + */ + def regexTrailingSlashes = ~/\/+$/ + def infileNoTrailingSlash = infileString - regexTrailingSlashes + def outfileNoTrailingSlash = outfileString - regexTrailingSlashes [ - "[ -d \"\$(dirname '${outfile.toString()}')\" ] || mkdir -p \"\$(dirname '${outfile.toString()}')\"", - "cp -r '${infile.toString()}' '${outfile.toString()}'" + "[ -d \"\$(dirname '${outfileNoTrailingSlash}')\" ] || mkdir -p \"\$(dirname '${outfileNoTrailingSlash}')\"", + "cp -a '${infileNoTrailingSlash}' '${outfileNoTrailingSlash}'" ] } else { // no need to copy if infile is the same as outfile @@ -3035,7 +3045,7 @@ meta = [ "config": processConfig(readJsonBlob('''{ "name" : "umap", "namespace" : "dimred", - "version" : "v4.0.3", + "version" : "v4.1.0", "authors" : [ { "name" : "Dries De Maeyer", @@ -3138,7 +3148,7 @@ meta = [ { "type" : "string", "name" : "--output_compression", - "description" : "Compression format to use for the output AnnData and/or Mudata objects.\nBy default no compression is applied.\n", + "description" : "Compression format to use for the output AnnData and/or Mudata H5 files.\nBy default no compression is applied.\n", "example" : [ "gzip" ], @@ -3382,7 +3392,7 @@ meta = [ "id" : "docker", "image" : "python:3.12-slim", "target_registry" : "images.viash-hub.com", - "target_tag" : "v4.0.3", + "target_tag" : "v4.1.0", "namespace_separator" : "/", "setup" : [ { @@ -3396,9 +3406,10 @@ meta = [ "type" : "python", "user" : false, "packages" : [ - "anndata~=0.12.7", + "anndata~=0.12.16", "awkward", - "mudata~=0.3.2", + "scipy~=1.17.1", + "mudata~=0.3.8", "scanpy~=1.11.4" ], "script" : [ @@ -3412,7 +3423,7 @@ meta = [ "type" : "python", "user" : false, "packages" : [ - "viashpy==0.8.0" + "viashpy==0.10.0" ], "upgrade" : true } @@ -3428,13 +3439,13 @@ meta = [ "runner" : "nextflow", "engine" : "docker|native", "output" : "/workdir/root/repo/target/nextflow/dimred/umap", - "viash_version" : "0.9.4", - "git_commit" : "7bfad4ea12f87eca59213be3ab08deff67cc4206", + "viash_version" : "0.9.7", + "git_commit" : "a6499fddaa8553874585c747370f919f4d7b729c", "git_remote" : "https://github.com/openpipelines-bio/openpipeline" }, "package_config" : { "name" : "openpipeline", - "version" : "v4.0.3", + "version" : "v4.1.0", "summary" : "Best-practice workflows for single-cell multi-omics analyses.\n", "description" : "OpenPipelines are extensible single cell analysis pipelines for reproducible and large-scale single cell processing using [Viash](https://viash.io) and [Nextflow](https://www.nextflow.io/).\n\nIn terms of workflows, the following has been made available, but keep in mind that\nindividual tools and functionality can be executed as standalone components as well.\n\n * Demultiplexing: conversion of raw sequencing data to FASTQ objects.\n * Ingestion: Read mapping and generating a count matrix.\n * Single sample processing: cell filtering and doublet detection.\n * Multisample processing: Count transformation, normalization, QC metric calulations.\n * Integration: Clustering, integration and batch correction using single and multimodal methods.\n * Downstream analysis workflows\n", "info" : { @@ -3452,14 +3463,14 @@ meta = [ } ] }, - "viash_version" : "0.9.4", + "viash_version" : "0.9.7", "source" : "/workdir/root/repo/src", "target" : "/workdir/root/repo/target", "config_mods" : [ ".resources += {path: '/src/workflows/utils/labels.config', dest: 'nextflow_labels.config'}\n.runners[.type == 'nextflow'].config.script := 'includeConfig(\\"nextflow_labels.config\\")'", ".engines += { type: \\"native\\" }", ".engines[.type == 'docker'].target_registry := 'images.viash-hub.com'", - ".engines[.type == 'docker'].target_tag := 'v4.0.3'" + ".engines[.type == 'docker'].target_tag := 'v4.1.0'" ], "keywords" : [ "single-cell", @@ -3971,7 +3982,7 @@ meta["defaults"] = [ "container" : { "registry" : "images.viash-hub.com", "image" : "vsh/openpipeline/dimred/umap", - "tag" : "v4.0.3" + "tag" : "v4.1.0" }, "label" : [ "highcpu", diff --git a/target/dependencies/vsh/vsh/openpipeline/v4.0.3/nextflow/dimred/umap/nextflow.config b/target/dependencies/vsh/vsh/openpipeline/v4.1.0/nextflow/dimred/umap/nextflow.config similarity index 99% rename from target/dependencies/vsh/vsh/openpipeline/v4.0.3/nextflow/dimred/umap/nextflow.config rename to target/dependencies/vsh/vsh/openpipeline/v4.1.0/nextflow/dimred/umap/nextflow.config index 344a788..14827af 100644 --- a/target/dependencies/vsh/vsh/openpipeline/v4.0.3/nextflow/dimred/umap/nextflow.config +++ b/target/dependencies/vsh/vsh/openpipeline/v4.1.0/nextflow/dimred/umap/nextflow.config @@ -2,7 +2,7 @@ manifest { name = 'dimred/umap' mainScript = 'main.nf' nextflowVersion = '!>=20.12.1-edge' - version = 'v4.0.3' + version = 'v4.1.0' description = 'UMAP (Uniform Manifold Approximation and Projection) is a manifold learning technique suitable for visualizing high-dimensional data. Besides tending to be faster than tSNE, it optimizes the embedding such that it best reflects the topology of the data, which we represent throughout Scanpy using a neighborhood graph. tSNE, by contrast, optimizes the distribution of nearest-neighbor distances in the embedding such that these best match the distribution of distances in the high-dimensional space. We use the implementation of umap-learn [McInnes18]. For a few comparisons of UMAP with tSNE, see this preprint.\n' author = 'Dries De Maeyer' } diff --git a/target/dependencies/vsh/vsh/openpipeline/v4.0.3/nextflow/feature_annotation/highly_variable_features_scanpy/nextflow_labels.config b/target/dependencies/vsh/vsh/openpipeline/v4.1.0/nextflow/dimred/umap/nextflow_labels.config similarity index 100% rename from target/dependencies/vsh/vsh/openpipeline/v4.0.3/nextflow/feature_annotation/highly_variable_features_scanpy/nextflow_labels.config rename to target/dependencies/vsh/vsh/openpipeline/v4.1.0/nextflow/dimred/umap/nextflow_labels.config diff --git a/target/dependencies/vsh/vsh/openpipeline/v4.0.3/nextflow/dimred/umap/nextflow_schema.json b/target/dependencies/vsh/vsh/openpipeline/v4.1.0/nextflow/dimred/umap/nextflow_schema.json similarity index 98% rename from target/dependencies/vsh/vsh/openpipeline/v4.0.3/nextflow/dimred/umap/nextflow_schema.json rename to target/dependencies/vsh/vsh/openpipeline/v4.1.0/nextflow/dimred/umap/nextflow_schema.json index d715953..f287639 100644 --- a/target/dependencies/vsh/vsh/openpipeline/v4.0.3/nextflow/dimred/umap/nextflow_schema.json +++ b/target/dependencies/vsh/vsh/openpipeline/v4.1.0/nextflow/dimred/umap/nextflow_schema.json @@ -50,7 +50,7 @@ }, "output_compression": { "type": "string", - "description": "Compression format to use for the output AnnData and/or Mudata objects.\nBy default no compression is applied.\n", + "description": "Compression format to use for the output AnnData and/or Mudata H5 files.\nBy default no compression is applied.\n", "help_text": "Type: `string`, multiple: `False`, example: `\"gzip\"`, choices: ``gzip`, `lzf``. ", "enum": [ "gzip", diff --git a/target/dependencies/vsh/vsh/openpipeline/v4.0.3/nextflow/dimred/umap/setup_logger.py b/target/dependencies/vsh/vsh/openpipeline/v4.1.0/nextflow/dimred/umap/setup_logger.py similarity index 100% rename from target/dependencies/vsh/vsh/openpipeline/v4.0.3/nextflow/dimred/umap/setup_logger.py rename to target/dependencies/vsh/vsh/openpipeline/v4.1.0/nextflow/dimred/umap/setup_logger.py diff --git a/target/dependencies/vsh/vsh/openpipeline/v4.0.3/nextflow/feature_annotation/highly_variable_features_scanpy/.config.vsh.yaml b/target/dependencies/vsh/vsh/openpipeline/v4.1.0/nextflow/feature_annotation/highly_variable_features_scanpy/.config.vsh.yaml similarity index 94% rename from target/dependencies/vsh/vsh/openpipeline/v4.0.3/nextflow/feature_annotation/highly_variable_features_scanpy/.config.vsh.yaml rename to target/dependencies/vsh/vsh/openpipeline/v4.1.0/nextflow/feature_annotation/highly_variable_features_scanpy/.config.vsh.yaml index ffd21ae..4329e41 100644 --- a/target/dependencies/vsh/vsh/openpipeline/v4.0.3/nextflow/feature_annotation/highly_variable_features_scanpy/.config.vsh.yaml +++ b/target/dependencies/vsh/vsh/openpipeline/v4.1.0/nextflow/feature_annotation/highly_variable_features_scanpy/.config.vsh.yaml @@ -1,6 +1,6 @@ name: "highly_variable_features_scanpy" namespace: "feature_annotation" -version: "v4.0.3" +version: "v4.1.0" authors: - name: "Dries De Maeyer" roles: @@ -75,6 +75,20 @@ argument_groups: direction: "input" multiple: false multiple_sep: ";" + - type: "string" + name: "--features_to_exclude" + description: "User-defined list of feature names to exclude before HVG calculation.\ + \ \nThese features will be excluded from HVG selection but will remain in the\ + \ output data.\n" + info: null + example: + - "MT-CO1" + - "MT-CO2" + - "MT-ND1" + required: false + direction: "input" + multiple: true + multiple_sep: ";" - type: "file" name: "--output" description: "Output h5mu file." @@ -214,8 +228,8 @@ argument_groups: multiple_sep: ";" - type: "string" name: "--output_compression" - description: "Compression format to use for the output AnnData and/or Mudata objects.\n\ - By default no compression is applied.\n" + description: "Compression format to use for the output AnnData and/or Mudata H5\ + \ files.\nBy default no compression is applied.\n" info: null example: - "gzip" @@ -342,15 +356,16 @@ engines: id: "docker" image: "python:3.12" target_registry: "images.viash-hub.com" - target_tag: "v4.0.3" + target_tag: "v4.1.0" namespace_separator: "/" setup: - type: "python" user: false packages: - - "anndata~=0.12.7" + - "anndata~=0.12.16" - "awkward" - - "mudata~=0.3.2" + - "scipy~=1.17.1" + - "mudata~=0.3.8" - "scanpy~=1.11.4" - "scikit-misc" script: @@ -366,7 +381,7 @@ engines: - type: "python" user: false packages: - - "viashpy==0.8.0" + - "viashpy==0.10.0" github: - "openpipelines-bio/core#subdirectory=packages/python/openpipeline_testutils" upgrade: true @@ -380,12 +395,12 @@ build_info: engine: "docker|native" output: "target/nextflow/feature_annotation/highly_variable_features_scanpy" executable: "target/nextflow/feature_annotation/highly_variable_features_scanpy/main.nf" - viash_version: "0.9.4" - git_commit: "7bfad4ea12f87eca59213be3ab08deff67cc4206" + viash_version: "0.9.7" + git_commit: "a6499fddaa8553874585c747370f919f4d7b729c" git_remote: "https://github.com/openpipelines-bio/openpipeline" package_config: name: "openpipeline" - version: "v4.0.3" + version: "v4.1.0" summary: "Best-practice workflows for single-cell multi-omics analyses.\n" description: "OpenPipelines are extensible single cell analysis pipelines for reproducible\ \ and large-scale single cell processing using [Viash](https://viash.io) and [Nextflow](https://www.nextflow.io/).\n\ @@ -406,7 +421,7 @@ package_config: - path: "src/workflows/utils/labels_ci.config" description: "Adds the correct memory and CPU labels when running on the Viash\ \ Hub CI." - viash_version: "0.9.4" + viash_version: "0.9.7" source: "src" target: "target" config_mods: @@ -415,7 +430,7 @@ package_config: )'" - ".engines += { type: \"native\" }" - ".engines[.type == 'docker'].target_registry := 'images.viash-hub.com'" - - ".engines[.type == 'docker'].target_tag := 'v4.0.3'" + - ".engines[.type == 'docker'].target_tag := 'v4.1.0'" keywords: - "single-cell" - "multimodal" diff --git a/target/dependencies/vsh/vsh/openpipeline/v4.0.3/nextflow/feature_annotation/highly_variable_features_scanpy/compress_h5mu.py b/target/dependencies/vsh/vsh/openpipeline/v4.1.0/nextflow/feature_annotation/highly_variable_features_scanpy/compress_h5mu.py similarity index 100% rename from target/dependencies/vsh/vsh/openpipeline/v4.0.3/nextflow/feature_annotation/highly_variable_features_scanpy/compress_h5mu.py rename to target/dependencies/vsh/vsh/openpipeline/v4.1.0/nextflow/feature_annotation/highly_variable_features_scanpy/compress_h5mu.py diff --git a/target/dependencies/vsh/vsh/openpipeline/v4.0.3/nextflow/feature_annotation/highly_variable_features_scanpy/main.nf b/target/dependencies/vsh/vsh/openpipeline/v4.1.0/nextflow/feature_annotation/highly_variable_features_scanpy/main.nf similarity index 96% rename from target/dependencies/vsh/vsh/openpipeline/v4.0.3/nextflow/feature_annotation/highly_variable_features_scanpy/main.nf rename to target/dependencies/vsh/vsh/openpipeline/v4.1.0/nextflow/feature_annotation/highly_variable_features_scanpy/main.nf index c9c429f..56bccf0 100644 --- a/target/dependencies/vsh/vsh/openpipeline/v4.0.3/nextflow/feature_annotation/highly_variable_features_scanpy/main.nf +++ b/target/dependencies/vsh/vsh/openpipeline/v4.1.0/nextflow/feature_annotation/highly_variable_features_scanpy/main.nf @@ -1,6 +1,6 @@ -// highly_variable_features_scanpy v4.0.3 +// highly_variable_features_scanpy v4.1.0 // -// This wrapper script is auto-generated by viash 0.9.4 and is thus a derivative +// This wrapper script is auto-generated by viash 0.9.7 and is thus a derivative // work thereof. This software comes with ABSOLUTELY NO WARRANTY from Data // Intuitive. // @@ -1354,47 +1354,42 @@ def readCsv(file_path) { def splitRegex = java.util.regex.Pattern.compile(''',(?=(?:[^"]*"[^"]*")*[^"]*$)''') def removeQuote = java.util.regex.Pattern.compile('''"(.*)"''') - def br = java.nio.file.Files.newBufferedReader(inputFile) + java.nio.file.Files.newBufferedReader(inputFile).withCloseable { br -> + def row = 0 + def header = null + def line - def row = -1 - def header = null - while (br.ready() && header == null) { - def line = br.readLine() - row++ - if (!line.startsWith("#")) { - header = splitRegex.split(line, -1).collect{field -> - m = removeQuote.matcher(field) - m.find() ? m.replaceFirst('$1') : field - } - } - } - assert header != null: "CSV file should contain a header" - - while (br.ready()) { - def line = br.readLine() - row++ - if (line == null) { - br.close() - break - } - - if (!line.startsWith("#")) { - def predata = splitRegex.split(line, -1) - def data = predata.collect{field -> - if (field == "") { - return null - } - def m = removeQuote.matcher(field) - if (m.find()) { - return m.replaceFirst('$1') - } else { - return field + while (header == null && (line = br.readLine()) != null) { + if (!line.startsWith("#")) { + header = splitRegex.split(line, -1).collect { field -> + def m = removeQuote.matcher(field) + m.find() ? m.replaceFirst('$1') : field } } - assert header.size() == data.size(): "Row $row should contain the same number as fields as the header" - - def dataMap = [header, data].transpose().collectEntries().findAll{it.value != null} - output.add(dataMap) + row++ + } + assert header != null : "CSV file should contain a header" + + while ((line = br.readLine()) != null) { + row++ + if (!line.startsWith("#")) { + def predata = splitRegex.split(line, -1) + def data = predata.collect { field -> + if (field == "") { + return null + } + def m = removeQuote.matcher(field) + if (m.find()) { + return m.replaceFirst('$1') + } else { + return field + } + } + assert header.size() == data.size() : "Row $row should contain the same number as fields as the header" + + def dataMap = [header, data].transpose().collectEntries().findAll { it.value != null } + output.add(dataMap) + } } } @@ -1710,10 +1705,25 @@ process publishFilesProc { ] .transpose() .collectMany{infile, outfile -> - if (infile.toString() != outfile.toString()) { + def infileString = infile.toString() + def outfileString = outfile.toString() + if (infileString != outfileString) { + /* Trailing slashes are removed from both the source and destination arguments. + From source arguments, this is useful when a source argument may have a trailing slash + and specify a symbolic link to a directory. Without removing the slash, cp will dereference + the symbolic link. + See https://www.gnu.org/software/coreutils/manual/html_node/Trailing-slashes.html#Trailing-slashes-1 + + For the destination path addding a trailing slash is a problem when publishing directories: + it requires the destination directory to exist. This fails because we only create the parent + directories first. + */ + def regexTrailingSlashes = ~/\/+$/ + def infileNoTrailingSlash = infileString - regexTrailingSlashes + def outfileNoTrailingSlash = outfileString - regexTrailingSlashes [ - "[ -d \"\$(dirname '${outfile.toString()}')\" ] || mkdir -p \"\$(dirname '${outfile.toString()}')\"", - "cp -r '${infile.toString()}' '${outfile.toString()}'" + "[ -d \"\$(dirname '${outfileNoTrailingSlash}')\" ] || mkdir -p \"\$(dirname '${outfileNoTrailingSlash}')\"", + "cp -a '${infileNoTrailingSlash}' '${outfileNoTrailingSlash}'" ] } else { // no need to copy if infile is the same as outfile @@ -3036,7 +3046,7 @@ meta = [ "config": processConfig(readJsonBlob('''{ "name" : "highly_variable_features_scanpy", "namespace" : "feature_annotation", - "version" : "v4.0.3", + "version" : "v4.1.0", "authors" : [ { "name" : "Dries De Maeyer", @@ -3136,6 +3146,20 @@ meta = [ "multiple" : false, "multiple_sep" : ";" }, + { + "type" : "string", + "name" : "--features_to_exclude", + "description" : "User-defined list of feature names to exclude before HVG calculation. \nThese features will be excluded from HVG selection but will remain in the output data.\n", + "example" : [ + "MT-CO1", + "MT-CO2", + "MT-ND1" + ], + "required" : false, + "direction" : "input", + "multiple" : true, + "multiple_sep" : ";" + }, { "type" : "file", "name" : "--output", @@ -3281,7 +3305,7 @@ meta = [ { "type" : "string", "name" : "--output_compression", - "description" : "Compression format to use for the output AnnData and/or Mudata objects.\nBy default no compression is applied.\n", + "description" : "Compression format to use for the output AnnData and/or Mudata H5 files.\nBy default no compression is applied.\n", "example" : [ "gzip" ], @@ -3430,16 +3454,17 @@ meta = [ "id" : "docker", "image" : "python:3.12", "target_registry" : "images.viash-hub.com", - "target_tag" : "v4.0.3", + "target_tag" : "v4.1.0", "namespace_separator" : "/", "setup" : [ { "type" : "python", "user" : false, "packages" : [ - "anndata~=0.12.7", + "anndata~=0.12.16", "awkward", - "mudata~=0.3.2", + "scipy~=1.17.1", + "mudata~=0.3.8", "scanpy~=1.11.4", "scikit-misc" ], @@ -3461,7 +3486,7 @@ meta = [ "type" : "python", "user" : false, "packages" : [ - "viashpy==0.8.0" + "viashpy==0.10.0" ], "github" : [ "openpipelines-bio/core#subdirectory=packages/python/openpipeline_testutils" @@ -3480,13 +3505,13 @@ meta = [ "runner" : "nextflow", "engine" : "docker|native", "output" : "/workdir/root/repo/target/nextflow/feature_annotation/highly_variable_features_scanpy", - "viash_version" : "0.9.4", - "git_commit" : "7bfad4ea12f87eca59213be3ab08deff67cc4206", + "viash_version" : "0.9.7", + "git_commit" : "a6499fddaa8553874585c747370f919f4d7b729c", "git_remote" : "https://github.com/openpipelines-bio/openpipeline" }, "package_config" : { "name" : "openpipeline", - "version" : "v4.0.3", + "version" : "v4.1.0", "summary" : "Best-practice workflows for single-cell multi-omics analyses.\n", "description" : "OpenPipelines are extensible single cell analysis pipelines for reproducible and large-scale single cell processing using [Viash](https://viash.io) and [Nextflow](https://www.nextflow.io/).\n\nIn terms of workflows, the following has been made available, but keep in mind that\nindividual tools and functionality can be executed as standalone components as well.\n\n * Demultiplexing: conversion of raw sequencing data to FASTQ objects.\n * Ingestion: Read mapping and generating a count matrix.\n * Single sample processing: cell filtering and doublet detection.\n * Multisample processing: Count transformation, normalization, QC metric calulations.\n * Integration: Clustering, integration and batch correction using single and multimodal methods.\n * Downstream analysis workflows\n", "info" : { @@ -3504,14 +3529,14 @@ meta = [ } ] }, - "viash_version" : "0.9.4", + "viash_version" : "0.9.7", "source" : "/workdir/root/repo/src", "target" : "/workdir/root/repo/target", "config_mods" : [ ".resources += {path: '/src/workflows/utils/labels.config', dest: 'nextflow_labels.config'}\n.runners[.type == 'nextflow'].config.script := 'includeConfig(\\"nextflow_labels.config\\")'", ".engines += { type: \\"native\\" }", ".engines[.type == 'docker'].target_registry := 'images.viash-hub.com'", - ".engines[.type == 'docker'].target_tag := 'v4.0.3'" + ".engines[.type == 'docker'].target_tag := 'v4.1.0'" ], "keywords" : [ "single-cell", @@ -3553,6 +3578,7 @@ par = { 'modality': $( if [ ! -z ${VIASH_PAR_MODALITY+x} ]; then echo "r'${VIASH_PAR_MODALITY//\\'/\\'\\"\\'\\"r\\'}'"; else echo None; fi ), 'layer': $( if [ ! -z ${VIASH_PAR_LAYER+x} ]; then echo "r'${VIASH_PAR_LAYER//\\'/\\'\\"\\'\\"r\\'}'"; else echo None; fi ), 'var_input': $( if [ ! -z ${VIASH_PAR_VAR_INPUT+x} ]; then echo "r'${VIASH_PAR_VAR_INPUT//\\'/\\'\\"\\'\\"r\\'}'"; else echo None; fi ), + 'features_to_exclude': $( if [ ! -z ${VIASH_PAR_FEATURES_TO_EXCLUDE+x} ]; then echo "r'${VIASH_PAR_FEATURES_TO_EXCLUDE//\\'/\\'\\"\\'\\"r\\'}'.split(';')"; else echo None; fi ), 'output': $( if [ ! -z ${VIASH_PAR_OUTPUT+x} ]; then echo "r'${VIASH_PAR_OUTPUT//\\'/\\'\\"\\'\\"r\\'}'"; else echo None; fi ), 'var_name_filter': $( if [ ! -z ${VIASH_PAR_VAR_NAME_FILTER+x} ]; then echo "r'${VIASH_PAR_VAR_NAME_FILTER//\\'/\\'\\"\\'\\"r\\'}'"; else echo None; fi ), 'varm_name': $( if [ ! -z ${VIASH_PAR_VARM_NAME+x} ]; then echo "r'${VIASH_PAR_VARM_NAME//\\'/\\'\\"\\'\\"r\\'}'"; else echo None; fi ), @@ -3651,6 +3677,38 @@ if par["var_input"]: input_anndata.var[par["var_input"]] = data.var[par["var_input"]] input_anndata = subset_vars(input_anndata, par["var_input"]) +# Exclude user-specified features from HVG calculation +excluded_features_mask = None +if par.get("features_to_exclude"): + features_to_exclude = set(par["features_to_exclude"]) + logger.info( + "\\\\tExcluding %d specified features from HVG calculation", + len(features_to_exclude), + ) + excluded_features_mask = input_anndata.var_names.isin(features_to_exclude) + n_excluded = excluded_features_mask.sum() + n_not_found = len(features_to_exclude) - n_excluded + if n_not_found > 0: + not_found = features_to_exclude - set( + input_anndata.var_names[excluded_features_mask] + ) + logger.warning( + "\\\\t%d features to exclude were not found in the data: %s", + n_not_found, + list(not_found)[:10], + ) + logger.info("\\\\tExcluding %d features from HVG calculation", n_excluded) + if n_excluded == input_anndata.n_vars: + raise ValueError( + f"All features ({n_excluded}) are in the exclusion list. " + "Please check your --features_to_exclude list." + ) + # Store original var_names for later reindexing + original_var_names = input_anndata.var_names.copy() + # Subset to non-excluded features for HVG calculation using subset_vars + input_anndata = subset_vars(input_anndata, ~excluded_features_mask) + logger.info("\\\\t%d features remaining for HVG calculation", input_anndata.n_vars) + logger.info("\\\\tUnfiltered data: %s", data) logger.info("\\\\tComputing hvg") @@ -3695,6 +3753,17 @@ try: assert (out.index == data.var.index).all(), ( "Expected output index values to be equivalent to the input index" ) + elif par.get("features_to_exclude") is not None: + # Reindex to include excluded features, marking them as non-HVG + out.index = input_anndata.var.index + out = out.reindex(index=original_var_names, method=None) + out.highly_variable = out.highly_variable.fillna(False) + # Further reindex to match data.var.index (for consistency with var_input path) + out = out.reindex(index=data.var.index, method=None) + out.highly_variable = out.highly_variable.fillna(False) + assert (out.index == data.var.index).all(), ( + "Expected output index values to be equivalent to the input index" + ) elif par["obs_batch_key"] is not None: out = out.reindex(index=data.var.index, method=None) assert (out.index == data.var.index).all(), ( @@ -4110,7 +4179,7 @@ meta["defaults"] = [ "container" : { "registry" : "images.viash-hub.com", "image" : "vsh/openpipeline/feature_annotation/highly_variable_features_scanpy", - "tag" : "v4.0.3" + "tag" : "v4.1.0" }, "label" : [ "singlecpu", diff --git a/target/dependencies/vsh/vsh/openpipeline/v4.0.3/nextflow/feature_annotation/highly_variable_features_scanpy/nextflow.config b/target/dependencies/vsh/vsh/openpipeline/v4.1.0/nextflow/feature_annotation/highly_variable_features_scanpy/nextflow.config similarity index 99% rename from target/dependencies/vsh/vsh/openpipeline/v4.0.3/nextflow/feature_annotation/highly_variable_features_scanpy/nextflow.config rename to target/dependencies/vsh/vsh/openpipeline/v4.1.0/nextflow/feature_annotation/highly_variable_features_scanpy/nextflow.config index b239120..c7c82a3 100644 --- a/target/dependencies/vsh/vsh/openpipeline/v4.0.3/nextflow/feature_annotation/highly_variable_features_scanpy/nextflow.config +++ b/target/dependencies/vsh/vsh/openpipeline/v4.1.0/nextflow/feature_annotation/highly_variable_features_scanpy/nextflow.config @@ -2,7 +2,7 @@ manifest { name = 'feature_annotation/highly_variable_features_scanpy' mainScript = 'main.nf' nextflowVersion = '!>=20.12.1-edge' - version = 'v4.0.3' + version = 'v4.1.0' description = 'Annotate highly variable features [Satija15] [Zheng17] [Stuart19].\n\nExpects logarithmized data, except when flavor=\'seurat_v3\' in which count data is expected.\n\nDepending on flavor, this reproduces the R-implementations of Seurat [Satija15], Cell Ranger [Zheng17], and Seurat v3 [Stuart19].\n\nFor the dispersion-based methods ([Satija15] and [Zheng17]), the normalized dispersion is obtained by scaling with the mean and standard deviation of the dispersions for features falling into a given bin for mean expression of features. This means that for each bin of mean expression, highly variable features are selected.\n\nFor [Stuart19], a normalized variance for each feature is computed. First, the data are standardized (i.e., z-score normalization per feature) with a regularized standard deviation. Next, the normalized variance is computed as the variance of each feature after the transformation. Features are ranked by the normalized variance.\n' author = 'Dries De Maeyer, Robrecht Cannoodt' } diff --git a/target/dependencies/vsh/vsh/openpipeline/v4.0.3/nextflow/filter/delimit_fraction/nextflow_labels.config b/target/dependencies/vsh/vsh/openpipeline/v4.1.0/nextflow/feature_annotation/highly_variable_features_scanpy/nextflow_labels.config similarity index 100% rename from target/dependencies/vsh/vsh/openpipeline/v4.0.3/nextflow/filter/delimit_fraction/nextflow_labels.config rename to target/dependencies/vsh/vsh/openpipeline/v4.1.0/nextflow/feature_annotation/highly_variable_features_scanpy/nextflow_labels.config diff --git a/target/dependencies/vsh/vsh/openpipeline/v4.0.3/nextflow/feature_annotation/highly_variable_features_scanpy/nextflow_schema.json b/target/dependencies/vsh/vsh/openpipeline/v4.1.0/nextflow/feature_annotation/highly_variable_features_scanpy/nextflow_schema.json similarity index 94% rename from target/dependencies/vsh/vsh/openpipeline/v4.0.3/nextflow/feature_annotation/highly_variable_features_scanpy/nextflow_schema.json rename to target/dependencies/vsh/vsh/openpipeline/v4.1.0/nextflow/feature_annotation/highly_variable_features_scanpy/nextflow_schema.json index 83dab75..a43de92 100644 --- a/target/dependencies/vsh/vsh/openpipeline/v4.0.3/nextflow/feature_annotation/highly_variable_features_scanpy/nextflow_schema.json +++ b/target/dependencies/vsh/vsh/openpipeline/v4.1.0/nextflow/feature_annotation/highly_variable_features_scanpy/nextflow_schema.json @@ -32,6 +32,14 @@ "description": "If specified, use boolean array in adata.var[var_input] to calculate hvg on subset of vars.\n", "help_text": "Type: `string`, multiple: `False`. " }, + "features_to_exclude": { + "type": "array", + "items": { + "type": "string" + }, + "description": "User-defined list of feature names to exclude before HVG calculation", + "help_text": "Type: `string`, multiple: `True`, example: `[\"MT-CO1\";\"MT-CO2\";\"MT-ND1\"]`. " + }, "output": { "type": "string", "format": "path", @@ -109,7 +117,7 @@ }, "output_compression": { "type": "string", - "description": "Compression format to use for the output AnnData and/or Mudata objects.\nBy default no compression is applied.\n", + "description": "Compression format to use for the output AnnData and/or Mudata H5 files.\nBy default no compression is applied.\n", "help_text": "Type: `string`, multiple: `False`, example: `\"gzip\"`, choices: ``gzip`, `lzf``. ", "enum": [ "gzip", diff --git a/target/dependencies/vsh/vsh/openpipeline/v4.0.3/nextflow/feature_annotation/highly_variable_features_scanpy/setup_logger.py b/target/dependencies/vsh/vsh/openpipeline/v4.1.0/nextflow/feature_annotation/highly_variable_features_scanpy/setup_logger.py similarity index 100% rename from target/dependencies/vsh/vsh/openpipeline/v4.0.3/nextflow/feature_annotation/highly_variable_features_scanpy/setup_logger.py rename to target/dependencies/vsh/vsh/openpipeline/v4.1.0/nextflow/feature_annotation/highly_variable_features_scanpy/setup_logger.py diff --git a/target/dependencies/vsh/vsh/openpipeline/v4.1.0/nextflow/feature_annotation/highly_variable_features_scanpy/subset_vars.py b/target/dependencies/vsh/vsh/openpipeline/v4.1.0/nextflow/feature_annotation/highly_variable_features_scanpy/subset_vars.py new file mode 100644 index 0000000..4025000 --- /dev/null +++ b/target/dependencies/vsh/vsh/openpipeline/v4.1.0/nextflow/feature_annotation/highly_variable_features_scanpy/subset_vars.py @@ -0,0 +1,49 @@ +def subset_vars(adata, subset_col): + """ + Subset AnnData object on highly variable genes or a boolean mask. + + Parameters + ---------- + adata : AnnData + Annotated data object + subset_col : str, pd.Series, pd.Index, or np.ndarray + Name of the boolean column in `adata.var` that contains the information if features should be used or not, + or a boolean mask (same length as adata.var) + + Returns + ------- + AnnData + Copy of `adata` with subsetted features + """ + import pandas as pd + import numpy as np + + # Convert all input types to a pandas Series + if isinstance(subset_col, str): + if subset_col not in adata.var.columns: + raise ValueError( + f"Requested to use .var column '{subset_col}' as a selection of genes, but the column is not available." + ) + mask = adata.var[subset_col] + elif isinstance(subset_col, pd.Series): + mask = subset_col + elif isinstance(subset_col, (pd.Index, np.ndarray, list)): + mask = pd.Series(subset_col, index=adata.var.index) + else: + raise TypeError( + "subset_col must be a string (column name) or a boolean mask (Series, Index, ndarray, or list)." + ) + + # Validate mask + if not pd.api.types.is_bool_dtype(mask): + raise ValueError( + f"Expected mask to be boolean, but found {mask.dtype}. Can not subset data." + ) + if mask.isna().sum() > 0: + raise ValueError("Mask contains NaN values. Can not subset data.") + if len(mask) != adata.n_vars: + raise ValueError( + f"Mask length {len(mask)} does not match number of variables {adata.n_vars}." + ) + + return adata[:, mask].copy() diff --git a/target/dependencies/vsh/vsh/openpipeline/v4.0.3/nextflow/filter/delimit_fraction/.config.vsh.yaml b/target/dependencies/vsh/vsh/openpipeline/v4.1.0/nextflow/filter/delimit_fraction/.config.vsh.yaml similarity index 95% rename from target/dependencies/vsh/vsh/openpipeline/v4.0.3/nextflow/filter/delimit_fraction/.config.vsh.yaml rename to target/dependencies/vsh/vsh/openpipeline/v4.1.0/nextflow/filter/delimit_fraction/.config.vsh.yaml index 87ca907..d4751ea 100644 --- a/target/dependencies/vsh/vsh/openpipeline/v4.0.3/nextflow/filter/delimit_fraction/.config.vsh.yaml +++ b/target/dependencies/vsh/vsh/openpipeline/v4.1.0/nextflow/filter/delimit_fraction/.config.vsh.yaml @@ -1,6 +1,6 @@ name: "delimit_fraction" namespace: "filter" -version: "v4.0.3" +version: "v4.1.0" authors: - name: "Dries Schaumont" roles: @@ -78,8 +78,8 @@ argument_groups: multiple_sep: ";" - type: "string" name: "--output_compression" - description: "Compression format to use for the output AnnData and/or Mudata objects.\n\ - By default no compression is applied.\n" + description: "Compression format to use for the output AnnData and/or Mudata H5\ + \ files.\nBy default no compression is applied.\n" info: null example: - "gzip" @@ -219,7 +219,7 @@ engines: id: "docker" image: "python:3.12-slim" target_registry: "images.viash-hub.com" - target_tag: "v4.0.3" + target_tag: "v4.1.0" namespace_separator: "/" setup: - type: "apt" @@ -229,9 +229,10 @@ engines: - type: "python" user: false packages: - - "anndata~=0.12.7" + - "anndata~=0.12.16" - "awkward" - - "mudata~=0.3.2" + - "scipy~=1.17.1" + - "mudata~=0.3.8" script: - "exec(\"try:\\n import zarr; from importlib.metadata import version\\nexcept\ \ ModuleNotFoundError:\\n exit(0)\\nelse: assert int(version(\\\"zarr\\\"\ @@ -245,7 +246,7 @@ engines: - type: "python" user: false packages: - - "viashpy==0.8.0" + - "viashpy==0.10.0" github: - "openpipelines-bio/core#subdirectory=packages/python/openpipeline_testutils" upgrade: true @@ -259,12 +260,12 @@ build_info: engine: "docker|native" output: "target/nextflow/filter/delimit_fraction" executable: "target/nextflow/filter/delimit_fraction/main.nf" - viash_version: "0.9.4" - git_commit: "7bfad4ea12f87eca59213be3ab08deff67cc4206" + viash_version: "0.9.7" + git_commit: "a6499fddaa8553874585c747370f919f4d7b729c" git_remote: "https://github.com/openpipelines-bio/openpipeline" package_config: name: "openpipeline" - version: "v4.0.3" + version: "v4.1.0" summary: "Best-practice workflows for single-cell multi-omics analyses.\n" description: "OpenPipelines are extensible single cell analysis pipelines for reproducible\ \ and large-scale single cell processing using [Viash](https://viash.io) and [Nextflow](https://www.nextflow.io/).\n\ @@ -285,7 +286,7 @@ package_config: - path: "src/workflows/utils/labels_ci.config" description: "Adds the correct memory and CPU labels when running on the Viash\ \ Hub CI." - viash_version: "0.9.4" + viash_version: "0.9.7" source: "src" target: "target" config_mods: @@ -294,7 +295,7 @@ package_config: )'" - ".engines += { type: \"native\" }" - ".engines[.type == 'docker'].target_registry := 'images.viash-hub.com'" - - ".engines[.type == 'docker'].target_tag := 'v4.0.3'" + - ".engines[.type == 'docker'].target_tag := 'v4.1.0'" keywords: - "single-cell" - "multimodal" diff --git a/target/dependencies/vsh/vsh/openpipeline/v4.0.3/nextflow/filter/delimit_fraction/compress_h5mu.py b/target/dependencies/vsh/vsh/openpipeline/v4.1.0/nextflow/filter/delimit_fraction/compress_h5mu.py similarity index 100% rename from target/dependencies/vsh/vsh/openpipeline/v4.0.3/nextflow/filter/delimit_fraction/compress_h5mu.py rename to target/dependencies/vsh/vsh/openpipeline/v4.1.0/nextflow/filter/delimit_fraction/compress_h5mu.py diff --git a/target/dependencies/vsh/vsh/openpipeline/v4.0.3/nextflow/filter/delimit_fraction/main.nf b/target/dependencies/vsh/vsh/openpipeline/v4.1.0/nextflow/filter/delimit_fraction/main.nf similarity index 98% rename from target/dependencies/vsh/vsh/openpipeline/v4.0.3/nextflow/filter/delimit_fraction/main.nf rename to target/dependencies/vsh/vsh/openpipeline/v4.1.0/nextflow/filter/delimit_fraction/main.nf index 24403ac..91c6e77 100644 --- a/target/dependencies/vsh/vsh/openpipeline/v4.0.3/nextflow/filter/delimit_fraction/main.nf +++ b/target/dependencies/vsh/vsh/openpipeline/v4.1.0/nextflow/filter/delimit_fraction/main.nf @@ -1,6 +1,6 @@ -// delimit_fraction v4.0.3 +// delimit_fraction v4.1.0 // -// This wrapper script is auto-generated by viash 0.9.4 and is thus a derivative +// This wrapper script is auto-generated by viash 0.9.7 and is thus a derivative // work thereof. This software comes with ABSOLUTELY NO WARRANTY from Data // Intuitive. // @@ -1353,47 +1353,42 @@ def readCsv(file_path) { def splitRegex = java.util.regex.Pattern.compile(''',(?=(?:[^"]*"[^"]*")*[^"]*$)''') def removeQuote = java.util.regex.Pattern.compile('''"(.*)"''') - def br = java.nio.file.Files.newBufferedReader(inputFile) + java.nio.file.Files.newBufferedReader(inputFile).withCloseable { br -> + def row = 0 + def header = null + def line - def row = -1 - def header = null - while (br.ready() && header == null) { - def line = br.readLine() - row++ - if (!line.startsWith("#")) { - header = splitRegex.split(line, -1).collect{field -> - m = removeQuote.matcher(field) - m.find() ? m.replaceFirst('$1') : field - } - } - } - assert header != null: "CSV file should contain a header" - - while (br.ready()) { - def line = br.readLine() - row++ - if (line == null) { - br.close() - break - } - - if (!line.startsWith("#")) { - def predata = splitRegex.split(line, -1) - def data = predata.collect{field -> - if (field == "") { - return null - } - def m = removeQuote.matcher(field) - if (m.find()) { - return m.replaceFirst('$1') - } else { - return field + while (header == null && (line = br.readLine()) != null) { + if (!line.startsWith("#")) { + header = splitRegex.split(line, -1).collect { field -> + def m = removeQuote.matcher(field) + m.find() ? m.replaceFirst('$1') : field } } - assert header.size() == data.size(): "Row $row should contain the same number as fields as the header" - - def dataMap = [header, data].transpose().collectEntries().findAll{it.value != null} - output.add(dataMap) + row++ + } + assert header != null : "CSV file should contain a header" + + while ((line = br.readLine()) != null) { + row++ + if (!line.startsWith("#")) { + def predata = splitRegex.split(line, -1) + def data = predata.collect { field -> + if (field == "") { + return null + } + def m = removeQuote.matcher(field) + if (m.find()) { + return m.replaceFirst('$1') + } else { + return field + } + } + assert header.size() == data.size() : "Row $row should contain the same number as fields as the header" + + def dataMap = [header, data].transpose().collectEntries().findAll { it.value != null } + output.add(dataMap) + } } } @@ -1709,10 +1704,25 @@ process publishFilesProc { ] .transpose() .collectMany{infile, outfile -> - if (infile.toString() != outfile.toString()) { + def infileString = infile.toString() + def outfileString = outfile.toString() + if (infileString != outfileString) { + /* Trailing slashes are removed from both the source and destination arguments. + From source arguments, this is useful when a source argument may have a trailing slash + and specify a symbolic link to a directory. Without removing the slash, cp will dereference + the symbolic link. + See https://www.gnu.org/software/coreutils/manual/html_node/Trailing-slashes.html#Trailing-slashes-1 + + For the destination path addding a trailing slash is a problem when publishing directories: + it requires the destination directory to exist. This fails because we only create the parent + directories first. + */ + def regexTrailingSlashes = ~/\/+$/ + def infileNoTrailingSlash = infileString - regexTrailingSlashes + def outfileNoTrailingSlash = outfileString - regexTrailingSlashes [ - "[ -d \"\$(dirname '${outfile.toString()}')\" ] || mkdir -p \"\$(dirname '${outfile.toString()}')\"", - "cp -r '${infile.toString()}' '${outfile.toString()}'" + "[ -d \"\$(dirname '${outfileNoTrailingSlash}')\" ] || mkdir -p \"\$(dirname '${outfileNoTrailingSlash}')\"", + "cp -a '${infileNoTrailingSlash}' '${outfileNoTrailingSlash}'" ] } else { // no need to copy if infile is the same as outfile @@ -3035,7 +3045,7 @@ meta = [ "config": processConfig(readJsonBlob('''{ "name" : "delimit_fraction", "namespace" : "filter", - "version" : "v4.0.3", + "version" : "v4.1.0", "authors" : [ { "name" : "Dries Schaumont", @@ -3134,7 +3144,7 @@ meta = [ { "type" : "string", "name" : "--output_compression", - "description" : "Compression format to use for the output AnnData and/or Mudata objects.\nBy default no compression is applied.\n", + "description" : "Compression format to use for the output AnnData and/or Mudata H5 files.\nBy default no compression is applied.\n", "example" : [ "gzip" ], @@ -3312,7 +3322,7 @@ meta = [ "id" : "docker", "image" : "python:3.12-slim", "target_registry" : "images.viash-hub.com", - "target_tag" : "v4.0.3", + "target_tag" : "v4.1.0", "namespace_separator" : "/", "setup" : [ { @@ -3326,9 +3336,10 @@ meta = [ "type" : "python", "user" : false, "packages" : [ - "anndata~=0.12.7", + "anndata~=0.12.16", "awkward", - "mudata~=0.3.2" + "scipy~=1.17.1", + "mudata~=0.3.8" ], "script" : [ "exec(\\"try:\\\\n import zarr; from importlib.metadata import version\\\\nexcept ModuleNotFoundError:\\\\n exit(0)\\\\nelse: assert int(version(\\\\\\"zarr\\\\\\").partition(\\\\\\".\\\\\\")[0]) > 2\\")" @@ -3348,7 +3359,7 @@ meta = [ "type" : "python", "user" : false, "packages" : [ - "viashpy==0.8.0" + "viashpy==0.10.0" ], "github" : [ "openpipelines-bio/core#subdirectory=packages/python/openpipeline_testutils" @@ -3367,13 +3378,13 @@ meta = [ "runner" : "nextflow", "engine" : "docker|native", "output" : "/workdir/root/repo/target/nextflow/filter/delimit_fraction", - "viash_version" : "0.9.4", - "git_commit" : "7bfad4ea12f87eca59213be3ab08deff67cc4206", + "viash_version" : "0.9.7", + "git_commit" : "a6499fddaa8553874585c747370f919f4d7b729c", "git_remote" : "https://github.com/openpipelines-bio/openpipeline" }, "package_config" : { "name" : "openpipeline", - "version" : "v4.0.3", + "version" : "v4.1.0", "summary" : "Best-practice workflows for single-cell multi-omics analyses.\n", "description" : "OpenPipelines are extensible single cell analysis pipelines for reproducible and large-scale single cell processing using [Viash](https://viash.io) and [Nextflow](https://www.nextflow.io/).\n\nIn terms of workflows, the following has been made available, but keep in mind that\nindividual tools and functionality can be executed as standalone components as well.\n\n * Demultiplexing: conversion of raw sequencing data to FASTQ objects.\n * Ingestion: Read mapping and generating a count matrix.\n * Single sample processing: cell filtering and doublet detection.\n * Multisample processing: Count transformation, normalization, QC metric calulations.\n * Integration: Clustering, integration and batch correction using single and multimodal methods.\n * Downstream analysis workflows\n", "info" : { @@ -3391,14 +3402,14 @@ meta = [ } ] }, - "viash_version" : "0.9.4", + "viash_version" : "0.9.7", "source" : "/workdir/root/repo/src", "target" : "/workdir/root/repo/target", "config_mods" : [ ".resources += {path: '/src/workflows/utils/labels.config', dest: 'nextflow_labels.config'}\n.runners[.type == 'nextflow'].config.script := 'includeConfig(\\"nextflow_labels.config\\")'", ".engines += { type: \\"native\\" }", ".engines[.type == 'docker'].target_registry := 'images.viash-hub.com'", - ".engines[.type == 'docker'].target_tag := 'v4.0.3'" + ".engines[.type == 'docker'].target_tag := 'v4.1.0'" ], "keywords" : [ "single-cell", @@ -3928,7 +3939,7 @@ meta["defaults"] = [ "container" : { "registry" : "images.viash-hub.com", "image" : "vsh/openpipeline/filter/delimit_fraction", - "tag" : "v4.0.3" + "tag" : "v4.1.0" }, "label" : [ "singlecpu", diff --git a/target/dependencies/vsh/vsh/openpipeline/v4.0.3/nextflow/filter/delimit_fraction/nextflow.config b/target/dependencies/vsh/vsh/openpipeline/v4.1.0/nextflow/filter/delimit_fraction/nextflow.config similarity index 99% rename from target/dependencies/vsh/vsh/openpipeline/v4.0.3/nextflow/filter/delimit_fraction/nextflow.config rename to target/dependencies/vsh/vsh/openpipeline/v4.1.0/nextflow/filter/delimit_fraction/nextflow.config index c8eb844..8f30e93 100644 --- a/target/dependencies/vsh/vsh/openpipeline/v4.0.3/nextflow/filter/delimit_fraction/nextflow.config +++ b/target/dependencies/vsh/vsh/openpipeline/v4.1.0/nextflow/filter/delimit_fraction/nextflow.config @@ -2,7 +2,7 @@ manifest { name = 'filter/delimit_fraction' mainScript = 'main.nf' nextflowVersion = '!>=20.12.1-edge' - version = 'v4.0.3' + version = 'v4.1.0' description = 'Turns a column containing values between 0 and 1 into a boolean column based on thresholds.\n' author = 'Dries Schaumont' } diff --git a/target/dependencies/vsh/vsh/openpipeline/v4.0.3/nextflow/filter/do_filter/nextflow_labels.config b/target/dependencies/vsh/vsh/openpipeline/v4.1.0/nextflow/filter/delimit_fraction/nextflow_labels.config similarity index 100% rename from target/dependencies/vsh/vsh/openpipeline/v4.0.3/nextflow/filter/do_filter/nextflow_labels.config rename to target/dependencies/vsh/vsh/openpipeline/v4.1.0/nextflow/filter/delimit_fraction/nextflow_labels.config diff --git a/target/dependencies/vsh/vsh/openpipeline/v4.0.3/nextflow/filter/delimit_fraction/nextflow_schema.json b/target/dependencies/vsh/vsh/openpipeline/v4.1.0/nextflow/filter/delimit_fraction/nextflow_schema.json similarity index 97% rename from target/dependencies/vsh/vsh/openpipeline/v4.0.3/nextflow/filter/delimit_fraction/nextflow_schema.json rename to target/dependencies/vsh/vsh/openpipeline/v4.1.0/nextflow/filter/delimit_fraction/nextflow_schema.json index 52b00a1..4b2527a 100644 --- a/target/dependencies/vsh/vsh/openpipeline/v4.0.3/nextflow/filter/delimit_fraction/nextflow_schema.json +++ b/target/dependencies/vsh/vsh/openpipeline/v4.1.0/nextflow/filter/delimit_fraction/nextflow_schema.json @@ -48,7 +48,7 @@ }, "output_compression": { "type": "string", - "description": "Compression format to use for the output AnnData and/or Mudata objects.\nBy default no compression is applied.\n", + "description": "Compression format to use for the output AnnData and/or Mudata H5 files.\nBy default no compression is applied.\n", "help_text": "Type: `string`, multiple: `False`, example: `\"gzip\"`, choices: ``gzip`, `lzf``. ", "enum": [ "gzip", diff --git a/target/dependencies/vsh/vsh/openpipeline/v4.0.3/nextflow/filter/delimit_fraction/setup_logger.py b/target/dependencies/vsh/vsh/openpipeline/v4.1.0/nextflow/filter/delimit_fraction/setup_logger.py similarity index 100% rename from target/dependencies/vsh/vsh/openpipeline/v4.0.3/nextflow/filter/delimit_fraction/setup_logger.py rename to target/dependencies/vsh/vsh/openpipeline/v4.1.0/nextflow/filter/delimit_fraction/setup_logger.py diff --git a/target/dependencies/vsh/vsh/openpipeline/v4.0.3/nextflow/filter/do_filter/.config.vsh.yaml b/target/dependencies/vsh/vsh/openpipeline/v4.1.0/nextflow/filter/do_filter/.config.vsh.yaml similarity index 95% rename from target/dependencies/vsh/vsh/openpipeline/v4.0.3/nextflow/filter/do_filter/.config.vsh.yaml rename to target/dependencies/vsh/vsh/openpipeline/v4.1.0/nextflow/filter/do_filter/.config.vsh.yaml index 46739d7..f6ac270 100644 --- a/target/dependencies/vsh/vsh/openpipeline/v4.0.3/nextflow/filter/do_filter/.config.vsh.yaml +++ b/target/dependencies/vsh/vsh/openpipeline/v4.1.0/nextflow/filter/do_filter/.config.vsh.yaml @@ -1,6 +1,6 @@ name: "do_filter" namespace: "filter" -version: "v4.0.3" +version: "v4.1.0" authors: - name: "Robrecht Cannoodt" roles: @@ -79,8 +79,8 @@ argument_groups: multiple_sep: ";" - type: "string" name: "--output_compression" - description: "Compression format to use for the output AnnData and/or Mudata objects.\n\ - By default no compression is applied.\n" + description: "Compression format to use for the output AnnData and/or Mudata H5\ + \ files.\nBy default no compression is applied.\n" info: null example: - "gzip" @@ -193,7 +193,7 @@ engines: id: "docker" image: "python:3.12-slim" target_registry: "images.viash-hub.com" - target_tag: "v4.0.3" + target_tag: "v4.1.0" namespace_separator: "/" setup: - type: "apt" @@ -203,9 +203,10 @@ engines: - type: "python" user: false packages: - - "anndata~=0.12.7" + - "anndata~=0.12.16" - "awkward" - - "mudata~=0.3.2" + - "scipy~=1.17.1" + - "mudata~=0.3.8" script: - "exec(\"try:\\n import zarr; from importlib.metadata import version\\nexcept\ \ ModuleNotFoundError:\\n exit(0)\\nelse: assert int(version(\\\"zarr\\\"\ @@ -215,7 +216,7 @@ engines: - type: "python" user: false packages: - - "viashpy==0.8.0" + - "viashpy==0.10.0" upgrade: true entrypoint: [] cmd: null @@ -227,12 +228,12 @@ build_info: engine: "docker|native" output: "target/nextflow/filter/do_filter" executable: "target/nextflow/filter/do_filter/main.nf" - viash_version: "0.9.4" - git_commit: "7bfad4ea12f87eca59213be3ab08deff67cc4206" + viash_version: "0.9.7" + git_commit: "a6499fddaa8553874585c747370f919f4d7b729c" git_remote: "https://github.com/openpipelines-bio/openpipeline" package_config: name: "openpipeline" - version: "v4.0.3" + version: "v4.1.0" summary: "Best-practice workflows for single-cell multi-omics analyses.\n" description: "OpenPipelines are extensible single cell analysis pipelines for reproducible\ \ and large-scale single cell processing using [Viash](https://viash.io) and [Nextflow](https://www.nextflow.io/).\n\ @@ -253,7 +254,7 @@ package_config: - path: "src/workflows/utils/labels_ci.config" description: "Adds the correct memory and CPU labels when running on the Viash\ \ Hub CI." - viash_version: "0.9.4" + viash_version: "0.9.7" source: "src" target: "target" config_mods: @@ -262,7 +263,7 @@ package_config: )'" - ".engines += { type: \"native\" }" - ".engines[.type == 'docker'].target_registry := 'images.viash-hub.com'" - - ".engines[.type == 'docker'].target_tag := 'v4.0.3'" + - ".engines[.type == 'docker'].target_tag := 'v4.1.0'" keywords: - "single-cell" - "multimodal" diff --git a/target/dependencies/vsh/vsh/openpipeline/v4.0.3/nextflow/filter/do_filter/compress_h5mu.py b/target/dependencies/vsh/vsh/openpipeline/v4.1.0/nextflow/filter/do_filter/compress_h5mu.py similarity index 100% rename from target/dependencies/vsh/vsh/openpipeline/v4.0.3/nextflow/filter/do_filter/compress_h5mu.py rename to target/dependencies/vsh/vsh/openpipeline/v4.1.0/nextflow/filter/do_filter/compress_h5mu.py diff --git a/target/dependencies/vsh/vsh/openpipeline/v4.0.3/nextflow/filter/do_filter/main.nf b/target/dependencies/vsh/vsh/openpipeline/v4.1.0/nextflow/filter/do_filter/main.nf similarity index 98% rename from target/dependencies/vsh/vsh/openpipeline/v4.0.3/nextflow/filter/do_filter/main.nf rename to target/dependencies/vsh/vsh/openpipeline/v4.1.0/nextflow/filter/do_filter/main.nf index 56666e3..76feca9 100644 --- a/target/dependencies/vsh/vsh/openpipeline/v4.0.3/nextflow/filter/do_filter/main.nf +++ b/target/dependencies/vsh/vsh/openpipeline/v4.1.0/nextflow/filter/do_filter/main.nf @@ -1,6 +1,6 @@ -// do_filter v4.0.3 +// do_filter v4.1.0 // -// This wrapper script is auto-generated by viash 0.9.4 and is thus a derivative +// This wrapper script is auto-generated by viash 0.9.7 and is thus a derivative // work thereof. This software comes with ABSOLUTELY NO WARRANTY from Data // Intuitive. // @@ -1353,47 +1353,42 @@ def readCsv(file_path) { def splitRegex = java.util.regex.Pattern.compile(''',(?=(?:[^"]*"[^"]*")*[^"]*$)''') def removeQuote = java.util.regex.Pattern.compile('''"(.*)"''') - def br = java.nio.file.Files.newBufferedReader(inputFile) + java.nio.file.Files.newBufferedReader(inputFile).withCloseable { br -> + def row = 0 + def header = null + def line - def row = -1 - def header = null - while (br.ready() && header == null) { - def line = br.readLine() - row++ - if (!line.startsWith("#")) { - header = splitRegex.split(line, -1).collect{field -> - m = removeQuote.matcher(field) - m.find() ? m.replaceFirst('$1') : field - } - } - } - assert header != null: "CSV file should contain a header" - - while (br.ready()) { - def line = br.readLine() - row++ - if (line == null) { - br.close() - break - } - - if (!line.startsWith("#")) { - def predata = splitRegex.split(line, -1) - def data = predata.collect{field -> - if (field == "") { - return null - } - def m = removeQuote.matcher(field) - if (m.find()) { - return m.replaceFirst('$1') - } else { - return field + while (header == null && (line = br.readLine()) != null) { + if (!line.startsWith("#")) { + header = splitRegex.split(line, -1).collect { field -> + def m = removeQuote.matcher(field) + m.find() ? m.replaceFirst('$1') : field } } - assert header.size() == data.size(): "Row $row should contain the same number as fields as the header" - - def dataMap = [header, data].transpose().collectEntries().findAll{it.value != null} - output.add(dataMap) + row++ + } + assert header != null : "CSV file should contain a header" + + while ((line = br.readLine()) != null) { + row++ + if (!line.startsWith("#")) { + def predata = splitRegex.split(line, -1) + def data = predata.collect { field -> + if (field == "") { + return null + } + def m = removeQuote.matcher(field) + if (m.find()) { + return m.replaceFirst('$1') + } else { + return field + } + } + assert header.size() == data.size() : "Row $row should contain the same number as fields as the header" + + def dataMap = [header, data].transpose().collectEntries().findAll { it.value != null } + output.add(dataMap) + } } } @@ -1709,10 +1704,25 @@ process publishFilesProc { ] .transpose() .collectMany{infile, outfile -> - if (infile.toString() != outfile.toString()) { + def infileString = infile.toString() + def outfileString = outfile.toString() + if (infileString != outfileString) { + /* Trailing slashes are removed from both the source and destination arguments. + From source arguments, this is useful when a source argument may have a trailing slash + and specify a symbolic link to a directory. Without removing the slash, cp will dereference + the symbolic link. + See https://www.gnu.org/software/coreutils/manual/html_node/Trailing-slashes.html#Trailing-slashes-1 + + For the destination path addding a trailing slash is a problem when publishing directories: + it requires the destination directory to exist. This fails because we only create the parent + directories first. + */ + def regexTrailingSlashes = ~/\/+$/ + def infileNoTrailingSlash = infileString - regexTrailingSlashes + def outfileNoTrailingSlash = outfileString - regexTrailingSlashes [ - "[ -d \"\$(dirname '${outfile.toString()}')\" ] || mkdir -p \"\$(dirname '${outfile.toString()}')\"", - "cp -r '${infile.toString()}' '${outfile.toString()}'" + "[ -d \"\$(dirname '${outfileNoTrailingSlash}')\" ] || mkdir -p \"\$(dirname '${outfileNoTrailingSlash}')\"", + "cp -a '${infileNoTrailingSlash}' '${outfileNoTrailingSlash}'" ] } else { // no need to copy if infile is the same as outfile @@ -3035,7 +3045,7 @@ meta = [ "config": processConfig(readJsonBlob('''{ "name" : "do_filter", "namespace" : "filter", - "version" : "v4.0.3", + "version" : "v4.1.0", "authors" : [ { "name" : "Robrecht Cannoodt", @@ -3137,7 +3147,7 @@ meta = [ { "type" : "string", "name" : "--output_compression", - "description" : "Compression format to use for the output AnnData and/or Mudata objects.\nBy default no compression is applied.\n", + "description" : "Compression format to use for the output AnnData and/or Mudata H5 files.\nBy default no compression is applied.\n", "example" : [ "gzip" ], @@ -3282,7 +3292,7 @@ meta = [ "id" : "docker", "image" : "python:3.12-slim", "target_registry" : "images.viash-hub.com", - "target_tag" : "v4.0.3", + "target_tag" : "v4.1.0", "namespace_separator" : "/", "setup" : [ { @@ -3296,9 +3306,10 @@ meta = [ "type" : "python", "user" : false, "packages" : [ - "anndata~=0.12.7", + "anndata~=0.12.16", "awkward", - "mudata~=0.3.2" + "scipy~=1.17.1", + "mudata~=0.3.8" ], "script" : [ "exec(\\"try:\\\\n import zarr; from importlib.metadata import version\\\\nexcept ModuleNotFoundError:\\\\n exit(0)\\\\nelse: assert int(version(\\\\\\"zarr\\\\\\").partition(\\\\\\".\\\\\\")[0]) > 2\\")" @@ -3311,7 +3322,7 @@ meta = [ "type" : "python", "user" : false, "packages" : [ - "viashpy==0.8.0" + "viashpy==0.10.0" ], "upgrade" : true } @@ -3327,13 +3338,13 @@ meta = [ "runner" : "nextflow", "engine" : "docker|native", "output" : "/workdir/root/repo/target/nextflow/filter/do_filter", - "viash_version" : "0.9.4", - "git_commit" : "7bfad4ea12f87eca59213be3ab08deff67cc4206", + "viash_version" : "0.9.7", + "git_commit" : "a6499fddaa8553874585c747370f919f4d7b729c", "git_remote" : "https://github.com/openpipelines-bio/openpipeline" }, "package_config" : { "name" : "openpipeline", - "version" : "v4.0.3", + "version" : "v4.1.0", "summary" : "Best-practice workflows for single-cell multi-omics analyses.\n", "description" : "OpenPipelines are extensible single cell analysis pipelines for reproducible and large-scale single cell processing using [Viash](https://viash.io) and [Nextflow](https://www.nextflow.io/).\n\nIn terms of workflows, the following has been made available, but keep in mind that\nindividual tools and functionality can be executed as standalone components as well.\n\n * Demultiplexing: conversion of raw sequencing data to FASTQ objects.\n * Ingestion: Read mapping and generating a count matrix.\n * Single sample processing: cell filtering and doublet detection.\n * Multisample processing: Count transformation, normalization, QC metric calulations.\n * Integration: Clustering, integration and batch correction using single and multimodal methods.\n * Downstream analysis workflows\n", "info" : { @@ -3351,14 +3362,14 @@ meta = [ } ] }, - "viash_version" : "0.9.4", + "viash_version" : "0.9.7", "source" : "/workdir/root/repo/src", "target" : "/workdir/root/repo/target", "config_mods" : [ ".resources += {path: '/src/workflows/utils/labels.config', dest: 'nextflow_labels.config'}\n.runners[.type == 'nextflow'].config.script := 'includeConfig(\\"nextflow_labels.config\\")'", ".engines += { type: \\"native\\" }", ".engines[.type == 'docker'].target_registry := 'images.viash-hub.com'", - ".engines[.type == 'docker'].target_tag := 'v4.0.3'" + ".engines[.type == 'docker'].target_tag := 'v4.1.0'" ], "keywords" : [ "single-cell", @@ -3851,7 +3862,7 @@ meta["defaults"] = [ "container" : { "registry" : "images.viash-hub.com", "image" : "vsh/openpipeline/filter/do_filter", - "tag" : "v4.0.3" + "tag" : "v4.1.0" }, "label" : [ "singlecpu", diff --git a/target/dependencies/vsh/vsh/openpipeline/v4.0.3/nextflow/filter/do_filter/nextflow.config b/target/dependencies/vsh/vsh/openpipeline/v4.1.0/nextflow/filter/do_filter/nextflow.config similarity index 99% rename from target/dependencies/vsh/vsh/openpipeline/v4.0.3/nextflow/filter/do_filter/nextflow.config rename to target/dependencies/vsh/vsh/openpipeline/v4.1.0/nextflow/filter/do_filter/nextflow.config index 296eff8..740b569 100644 --- a/target/dependencies/vsh/vsh/openpipeline/v4.0.3/nextflow/filter/do_filter/nextflow.config +++ b/target/dependencies/vsh/vsh/openpipeline/v4.1.0/nextflow/filter/do_filter/nextflow.config @@ -2,7 +2,7 @@ manifest { name = 'filter/do_filter' mainScript = 'main.nf' nextflowVersion = '!>=20.12.1-edge' - version = 'v4.0.3' + version = 'v4.1.0' description = 'Remove observations and variables based on specified .obs and .var columns.\n' author = 'Robrecht Cannoodt' } diff --git a/target/dependencies/vsh/vsh/openpipeline/v4.0.3/nextflow/filter/filter_with_counts/nextflow_labels.config b/target/dependencies/vsh/vsh/openpipeline/v4.1.0/nextflow/filter/do_filter/nextflow_labels.config similarity index 100% rename from target/dependencies/vsh/vsh/openpipeline/v4.0.3/nextflow/filter/filter_with_counts/nextflow_labels.config rename to target/dependencies/vsh/vsh/openpipeline/v4.1.0/nextflow/filter/do_filter/nextflow_labels.config diff --git a/target/dependencies/vsh/vsh/openpipeline/v4.0.3/nextflow/filter/do_filter/nextflow_schema.json b/target/dependencies/vsh/vsh/openpipeline/v4.1.0/nextflow/filter/do_filter/nextflow_schema.json similarity index 97% rename from target/dependencies/vsh/vsh/openpipeline/v4.0.3/nextflow/filter/do_filter/nextflow_schema.json rename to target/dependencies/vsh/vsh/openpipeline/v4.1.0/nextflow/filter/do_filter/nextflow_schema.json index f63c9c3..d0b814e 100644 --- a/target/dependencies/vsh/vsh/openpipeline/v4.0.3/nextflow/filter/do_filter/nextflow_schema.json +++ b/target/dependencies/vsh/vsh/openpipeline/v4.1.0/nextflow/filter/do_filter/nextflow_schema.json @@ -47,7 +47,7 @@ }, "output_compression": { "type": "string", - "description": "Compression format to use for the output AnnData and/or Mudata objects.\nBy default no compression is applied.\n", + "description": "Compression format to use for the output AnnData and/or Mudata H5 files.\nBy default no compression is applied.\n", "help_text": "Type: `string`, multiple: `False`, example: `\"gzip\"`, choices: ``gzip`, `lzf``. ", "enum": [ "gzip", diff --git a/target/dependencies/vsh/vsh/openpipeline/v4.0.3/nextflow/filter/do_filter/setup_logger.py b/target/dependencies/vsh/vsh/openpipeline/v4.1.0/nextflow/filter/do_filter/setup_logger.py similarity index 100% rename from target/dependencies/vsh/vsh/openpipeline/v4.0.3/nextflow/filter/do_filter/setup_logger.py rename to target/dependencies/vsh/vsh/openpipeline/v4.1.0/nextflow/filter/do_filter/setup_logger.py diff --git a/target/dependencies/vsh/vsh/openpipeline/v4.0.3/nextflow/filter/filter_with_counts/.config.vsh.yaml b/target/dependencies/vsh/vsh/openpipeline/v4.1.0/nextflow/filter/filter_with_counts/.config.vsh.yaml similarity index 96% rename from target/dependencies/vsh/vsh/openpipeline/v4.0.3/nextflow/filter/filter_with_counts/.config.vsh.yaml rename to target/dependencies/vsh/vsh/openpipeline/v4.1.0/nextflow/filter/filter_with_counts/.config.vsh.yaml index 43648be..a9efc45 100644 --- a/target/dependencies/vsh/vsh/openpipeline/v4.0.3/nextflow/filter/filter_with_counts/.config.vsh.yaml +++ b/target/dependencies/vsh/vsh/openpipeline/v4.1.0/nextflow/filter/filter_with_counts/.config.vsh.yaml @@ -1,6 +1,6 @@ name: "filter_with_counts" namespace: "filter" -version: "v4.0.3" +version: "v4.1.0" authors: - name: "Dries De Maeyer" roles: @@ -112,8 +112,8 @@ argument_groups: multiple_sep: ";" - type: "string" name: "--output_compression" - description: "Compression format to use for the output AnnData and/or Mudata objects.\n\ - By default no compression is applied.\n" + description: "Compression format to use for the output AnnData and/or Mudata H5\ + \ files.\nBy default no compression is applied.\n" info: null example: - "gzip" @@ -280,7 +280,7 @@ engines: id: "docker" image: "python:3.12-slim" target_registry: "images.viash-hub.com" - target_tag: "v4.0.3" + target_tag: "v4.1.0" namespace_separator: "/" setup: - type: "apt" @@ -290,9 +290,10 @@ engines: - type: "python" user: false packages: - - "anndata~=0.12.7" + - "anndata~=0.12.16" - "awkward" - - "mudata~=0.3.2" + - "scipy~=1.17.1" + - "mudata~=0.3.8" script: - "exec(\"try:\\n import zarr; from importlib.metadata import version\\nexcept\ \ ModuleNotFoundError:\\n exit(0)\\nelse: assert int(version(\\\"zarr\\\"\ @@ -306,7 +307,7 @@ engines: - type: "python" user: false packages: - - "viashpy==0.8.0" + - "viashpy==0.10.0" github: - "openpipelines-bio/core#subdirectory=packages/python/openpipeline_testutils" upgrade: true @@ -320,12 +321,12 @@ build_info: engine: "docker|native" output: "target/nextflow/filter/filter_with_counts" executable: "target/nextflow/filter/filter_with_counts/main.nf" - viash_version: "0.9.4" - git_commit: "7bfad4ea12f87eca59213be3ab08deff67cc4206" + viash_version: "0.9.7" + git_commit: "a6499fddaa8553874585c747370f919f4d7b729c" git_remote: "https://github.com/openpipelines-bio/openpipeline" package_config: name: "openpipeline" - version: "v4.0.3" + version: "v4.1.0" summary: "Best-practice workflows for single-cell multi-omics analyses.\n" description: "OpenPipelines are extensible single cell analysis pipelines for reproducible\ \ and large-scale single cell processing using [Viash](https://viash.io) and [Nextflow](https://www.nextflow.io/).\n\ @@ -346,7 +347,7 @@ package_config: - path: "src/workflows/utils/labels_ci.config" description: "Adds the correct memory and CPU labels when running on the Viash\ \ Hub CI." - viash_version: "0.9.4" + viash_version: "0.9.7" source: "src" target: "target" config_mods: @@ -355,7 +356,7 @@ package_config: )'" - ".engines += { type: \"native\" }" - ".engines[.type == 'docker'].target_registry := 'images.viash-hub.com'" - - ".engines[.type == 'docker'].target_tag := 'v4.0.3'" + - ".engines[.type == 'docker'].target_tag := 'v4.1.0'" keywords: - "single-cell" - "multimodal" diff --git a/target/dependencies/vsh/vsh/openpipeline/v4.0.3/nextflow/filter/filter_with_counts/compress_h5mu.py b/target/dependencies/vsh/vsh/openpipeline/v4.1.0/nextflow/filter/filter_with_counts/compress_h5mu.py similarity index 100% rename from target/dependencies/vsh/vsh/openpipeline/v4.0.3/nextflow/filter/filter_with_counts/compress_h5mu.py rename to target/dependencies/vsh/vsh/openpipeline/v4.1.0/nextflow/filter/filter_with_counts/compress_h5mu.py diff --git a/target/dependencies/vsh/vsh/openpipeline/v4.0.3/nextflow/filter/filter_with_counts/main.nf b/target/dependencies/vsh/vsh/openpipeline/v4.1.0/nextflow/filter/filter_with_counts/main.nf similarity index 98% rename from target/dependencies/vsh/vsh/openpipeline/v4.0.3/nextflow/filter/filter_with_counts/main.nf rename to target/dependencies/vsh/vsh/openpipeline/v4.1.0/nextflow/filter/filter_with_counts/main.nf index 447e900..bec00eb 100644 --- a/target/dependencies/vsh/vsh/openpipeline/v4.0.3/nextflow/filter/filter_with_counts/main.nf +++ b/target/dependencies/vsh/vsh/openpipeline/v4.1.0/nextflow/filter/filter_with_counts/main.nf @@ -1,6 +1,6 @@ -// filter_with_counts v4.0.3 +// filter_with_counts v4.1.0 // -// This wrapper script is auto-generated by viash 0.9.4 and is thus a derivative +// This wrapper script is auto-generated by viash 0.9.7 and is thus a derivative // work thereof. This software comes with ABSOLUTELY NO WARRANTY from Data // Intuitive. // @@ -1354,47 +1354,42 @@ def readCsv(file_path) { def splitRegex = java.util.regex.Pattern.compile(''',(?=(?:[^"]*"[^"]*")*[^"]*$)''') def removeQuote = java.util.regex.Pattern.compile('''"(.*)"''') - def br = java.nio.file.Files.newBufferedReader(inputFile) + java.nio.file.Files.newBufferedReader(inputFile).withCloseable { br -> + def row = 0 + def header = null + def line - def row = -1 - def header = null - while (br.ready() && header == null) { - def line = br.readLine() - row++ - if (!line.startsWith("#")) { - header = splitRegex.split(line, -1).collect{field -> - m = removeQuote.matcher(field) - m.find() ? m.replaceFirst('$1') : field - } - } - } - assert header != null: "CSV file should contain a header" - - while (br.ready()) { - def line = br.readLine() - row++ - if (line == null) { - br.close() - break - } - - if (!line.startsWith("#")) { - def predata = splitRegex.split(line, -1) - def data = predata.collect{field -> - if (field == "") { - return null - } - def m = removeQuote.matcher(field) - if (m.find()) { - return m.replaceFirst('$1') - } else { - return field + while (header == null && (line = br.readLine()) != null) { + if (!line.startsWith("#")) { + header = splitRegex.split(line, -1).collect { field -> + def m = removeQuote.matcher(field) + m.find() ? m.replaceFirst('$1') : field } } - assert header.size() == data.size(): "Row $row should contain the same number as fields as the header" - - def dataMap = [header, data].transpose().collectEntries().findAll{it.value != null} - output.add(dataMap) + row++ + } + assert header != null : "CSV file should contain a header" + + while ((line = br.readLine()) != null) { + row++ + if (!line.startsWith("#")) { + def predata = splitRegex.split(line, -1) + def data = predata.collect { field -> + if (field == "") { + return null + } + def m = removeQuote.matcher(field) + if (m.find()) { + return m.replaceFirst('$1') + } else { + return field + } + } + assert header.size() == data.size() : "Row $row should contain the same number as fields as the header" + + def dataMap = [header, data].transpose().collectEntries().findAll { it.value != null } + output.add(dataMap) + } } } @@ -1710,10 +1705,25 @@ process publishFilesProc { ] .transpose() .collectMany{infile, outfile -> - if (infile.toString() != outfile.toString()) { + def infileString = infile.toString() + def outfileString = outfile.toString() + if (infileString != outfileString) { + /* Trailing slashes are removed from both the source and destination arguments. + From source arguments, this is useful when a source argument may have a trailing slash + and specify a symbolic link to a directory. Without removing the slash, cp will dereference + the symbolic link. + See https://www.gnu.org/software/coreutils/manual/html_node/Trailing-slashes.html#Trailing-slashes-1 + + For the destination path addding a trailing slash is a problem when publishing directories: + it requires the destination directory to exist. This fails because we only create the parent + directories first. + */ + def regexTrailingSlashes = ~/\/+$/ + def infileNoTrailingSlash = infileString - regexTrailingSlashes + def outfileNoTrailingSlash = outfileString - regexTrailingSlashes [ - "[ -d \"\$(dirname '${outfile.toString()}')\" ] || mkdir -p \"\$(dirname '${outfile.toString()}')\"", - "cp -r '${infile.toString()}' '${outfile.toString()}'" + "[ -d \"\$(dirname '${outfileNoTrailingSlash}')\" ] || mkdir -p \"\$(dirname '${outfileNoTrailingSlash}')\"", + "cp -a '${infileNoTrailingSlash}' '${outfileNoTrailingSlash}'" ] } else { // no need to copy if infile is the same as outfile @@ -3036,7 +3046,7 @@ meta = [ "config": processConfig(readJsonBlob('''{ "name" : "filter_with_counts", "namespace" : "filter", - "version" : "v4.0.3", + "version" : "v4.1.0", "authors" : [ { "name" : "Dries De Maeyer", @@ -3182,7 +3192,7 @@ meta = [ { "type" : "string", "name" : "--output_compression", - "description" : "Compression format to use for the output AnnData and/or Mudata objects.\nBy default no compression is applied.\n", + "description" : "Compression format to use for the output AnnData and/or Mudata H5 files.\nBy default no compression is applied.\n", "example" : [ "gzip" ], @@ -3392,7 +3402,7 @@ meta = [ "id" : "docker", "image" : "python:3.12-slim", "target_registry" : "images.viash-hub.com", - "target_tag" : "v4.0.3", + "target_tag" : "v4.1.0", "namespace_separator" : "/", "setup" : [ { @@ -3406,9 +3416,10 @@ meta = [ "type" : "python", "user" : false, "packages" : [ - "anndata~=0.12.7", + "anndata~=0.12.16", "awkward", - "mudata~=0.3.2" + "scipy~=1.17.1", + "mudata~=0.3.8" ], "script" : [ "exec(\\"try:\\\\n import zarr; from importlib.metadata import version\\\\nexcept ModuleNotFoundError:\\\\n exit(0)\\\\nelse: assert int(version(\\\\\\"zarr\\\\\\").partition(\\\\\\".\\\\\\")[0]) > 2\\")" @@ -3428,7 +3439,7 @@ meta = [ "type" : "python", "user" : false, "packages" : [ - "viashpy==0.8.0" + "viashpy==0.10.0" ], "github" : [ "openpipelines-bio/core#subdirectory=packages/python/openpipeline_testutils" @@ -3447,13 +3458,13 @@ meta = [ "runner" : "nextflow", "engine" : "docker|native", "output" : "/workdir/root/repo/target/nextflow/filter/filter_with_counts", - "viash_version" : "0.9.4", - "git_commit" : "7bfad4ea12f87eca59213be3ab08deff67cc4206", + "viash_version" : "0.9.7", + "git_commit" : "a6499fddaa8553874585c747370f919f4d7b729c", "git_remote" : "https://github.com/openpipelines-bio/openpipeline" }, "package_config" : { "name" : "openpipeline", - "version" : "v4.0.3", + "version" : "v4.1.0", "summary" : "Best-practice workflows for single-cell multi-omics analyses.\n", "description" : "OpenPipelines are extensible single cell analysis pipelines for reproducible and large-scale single cell processing using [Viash](https://viash.io) and [Nextflow](https://www.nextflow.io/).\n\nIn terms of workflows, the following has been made available, but keep in mind that\nindividual tools and functionality can be executed as standalone components as well.\n\n * Demultiplexing: conversion of raw sequencing data to FASTQ objects.\n * Ingestion: Read mapping and generating a count matrix.\n * Single sample processing: cell filtering and doublet detection.\n * Multisample processing: Count transformation, normalization, QC metric calulations.\n * Integration: Clustering, integration and batch correction using single and multimodal methods.\n * Downstream analysis workflows\n", "info" : { @@ -3471,14 +3482,14 @@ meta = [ } ] }, - "viash_version" : "0.9.4", + "viash_version" : "0.9.7", "source" : "/workdir/root/repo/src", "target" : "/workdir/root/repo/target", "config_mods" : [ ".resources += {path: '/src/workflows/utils/labels.config', dest: 'nextflow_labels.config'}\n.runners[.type == 'nextflow'].config.script := 'includeConfig(\\"nextflow_labels.config\\")'", ".engines += { type: \\"native\\" }", ".engines[.type == 'docker'].target_registry := 'images.viash-hub.com'", - ".engines[.type == 'docker'].target_tag := 'v4.0.3'" + ".engines[.type == 'docker'].target_tag := 'v4.1.0'" ], "keywords" : [ "single-cell", @@ -4050,7 +4061,7 @@ meta["defaults"] = [ "container" : { "registry" : "images.viash-hub.com", "image" : "vsh/openpipeline/filter/filter_with_counts", - "tag" : "v4.0.3" + "tag" : "v4.1.0" }, "label" : [ "singlecpu", diff --git a/target/dependencies/vsh/vsh/openpipeline/v4.0.3/nextflow/filter/filter_with_counts/nextflow.config b/target/dependencies/vsh/vsh/openpipeline/v4.1.0/nextflow/filter/filter_with_counts/nextflow.config similarity index 99% rename from target/dependencies/vsh/vsh/openpipeline/v4.0.3/nextflow/filter/filter_with_counts/nextflow.config rename to target/dependencies/vsh/vsh/openpipeline/v4.1.0/nextflow/filter/filter_with_counts/nextflow.config index a522643..31a37d7 100644 --- a/target/dependencies/vsh/vsh/openpipeline/v4.0.3/nextflow/filter/filter_with_counts/nextflow.config +++ b/target/dependencies/vsh/vsh/openpipeline/v4.1.0/nextflow/filter/filter_with_counts/nextflow.config @@ -2,7 +2,7 @@ manifest { name = 'filter/filter_with_counts' mainScript = 'main.nf' nextflowVersion = '!>=20.12.1-edge' - version = 'v4.0.3' + version = 'v4.1.0' description = 'Filter scRNA-seq data based on the primary QC metrics. \nThis is based on both the UMI counts, the gene counts \nand the mitochondrial genes (genes starting with mt/MT).\n' author = 'Dries De Maeyer, Robrecht Cannoodt' } diff --git a/target/dependencies/vsh/vsh/openpipeline/v4.0.3/nextflow/filter/filter_with_scrublet/nextflow_labels.config b/target/dependencies/vsh/vsh/openpipeline/v4.1.0/nextflow/filter/filter_with_counts/nextflow_labels.config similarity index 100% rename from target/dependencies/vsh/vsh/openpipeline/v4.0.3/nextflow/filter/filter_with_scrublet/nextflow_labels.config rename to target/dependencies/vsh/vsh/openpipeline/v4.1.0/nextflow/filter/filter_with_counts/nextflow_labels.config diff --git a/target/dependencies/vsh/vsh/openpipeline/v4.0.3/nextflow/filter/filter_with_counts/nextflow_schema.json b/target/dependencies/vsh/vsh/openpipeline/v4.1.0/nextflow/filter/filter_with_counts/nextflow_schema.json similarity index 98% rename from target/dependencies/vsh/vsh/openpipeline/v4.0.3/nextflow/filter/filter_with_counts/nextflow_schema.json rename to target/dependencies/vsh/vsh/openpipeline/v4.1.0/nextflow/filter/filter_with_counts/nextflow_schema.json index 4e586c5..9b7a21b 100644 --- a/target/dependencies/vsh/vsh/openpipeline/v4.0.3/nextflow/filter/filter_with_counts/nextflow_schema.json +++ b/target/dependencies/vsh/vsh/openpipeline/v4.1.0/nextflow/filter/filter_with_counts/nextflow_schema.json @@ -61,7 +61,7 @@ }, "output_compression": { "type": "string", - "description": "Compression format to use for the output AnnData and/or Mudata objects.\nBy default no compression is applied.\n", + "description": "Compression format to use for the output AnnData and/or Mudata H5 files.\nBy default no compression is applied.\n", "help_text": "Type: `string`, multiple: `False`, example: `\"gzip\"`, choices: ``gzip`, `lzf``. ", "enum": [ "gzip", diff --git a/target/dependencies/vsh/vsh/openpipeline/v4.0.3/nextflow/filter/filter_with_counts/setup_logger.py b/target/dependencies/vsh/vsh/openpipeline/v4.1.0/nextflow/filter/filter_with_counts/setup_logger.py similarity index 100% rename from target/dependencies/vsh/vsh/openpipeline/v4.0.3/nextflow/filter/filter_with_counts/setup_logger.py rename to target/dependencies/vsh/vsh/openpipeline/v4.1.0/nextflow/filter/filter_with_counts/setup_logger.py diff --git a/target/dependencies/vsh/vsh/openpipeline/v4.0.3/nextflow/filter/filter_with_scrublet/.config.vsh.yaml b/target/dependencies/vsh/vsh/openpipeline/v4.1.0/nextflow/filter/filter_with_scrublet/.config.vsh.yaml similarity index 96% rename from target/dependencies/vsh/vsh/openpipeline/v4.0.3/nextflow/filter/filter_with_scrublet/.config.vsh.yaml rename to target/dependencies/vsh/vsh/openpipeline/v4.1.0/nextflow/filter/filter_with_scrublet/.config.vsh.yaml index 8aa6b02..00f227e 100644 --- a/target/dependencies/vsh/vsh/openpipeline/v4.0.3/nextflow/filter/filter_with_scrublet/.config.vsh.yaml +++ b/target/dependencies/vsh/vsh/openpipeline/v4.1.0/nextflow/filter/filter_with_scrublet/.config.vsh.yaml @@ -1,6 +1,6 @@ name: "filter_with_scrublet" namespace: "filter" -version: "v4.0.3" +version: "v4.1.0" authors: - name: "Dries De Maeyer" roles: @@ -208,8 +208,8 @@ argument_groups: direction: "input" - type: "string" name: "--output_compression" - description: "Compression format to use for the output AnnData and/or Mudata objects.\n\ - By default no compression is applied.\n" + description: "Compression format to use for the output AnnData and/or Mudata H5\ + \ files.\nBy default no compression is applied.\n" info: null example: - "gzip" @@ -333,7 +333,7 @@ engines: id: "docker" image: "python:3.13-slim" target_registry: "images.viash-hub.com" - target_tag: "v4.0.3" + target_tag: "v4.1.0" namespace_separator: "/" setup: - type: "apt" @@ -344,9 +344,10 @@ engines: - type: "python" user: false packages: - - "anndata~=0.12.7" + - "anndata~=0.12.16" - "awkward" - - "mudata~=0.3.2" + - "scipy~=1.17.1" + - "mudata~=0.3.8" - "scanpy~=1.11.4" - "scrublet" - "annoy==1.17.3" @@ -363,7 +364,7 @@ engines: - type: "python" user: false packages: - - "viashpy==0.8.0" + - "viashpy==0.10.0" github: - "openpipelines-bio/core#subdirectory=packages/python/openpipeline_testutils" upgrade: true @@ -377,12 +378,12 @@ build_info: engine: "docker|native" output: "target/nextflow/filter/filter_with_scrublet" executable: "target/nextflow/filter/filter_with_scrublet/main.nf" - viash_version: "0.9.4" - git_commit: "7bfad4ea12f87eca59213be3ab08deff67cc4206" + viash_version: "0.9.7" + git_commit: "a6499fddaa8553874585c747370f919f4d7b729c" git_remote: "https://github.com/openpipelines-bio/openpipeline" package_config: name: "openpipeline" - version: "v4.0.3" + version: "v4.1.0" summary: "Best-practice workflows for single-cell multi-omics analyses.\n" description: "OpenPipelines are extensible single cell analysis pipelines for reproducible\ \ and large-scale single cell processing using [Viash](https://viash.io) and [Nextflow](https://www.nextflow.io/).\n\ @@ -403,7 +404,7 @@ package_config: - path: "src/workflows/utils/labels_ci.config" description: "Adds the correct memory and CPU labels when running on the Viash\ \ Hub CI." - viash_version: "0.9.4" + viash_version: "0.9.7" source: "src" target: "target" config_mods: @@ -412,7 +413,7 @@ package_config: )'" - ".engines += { type: \"native\" }" - ".engines[.type == 'docker'].target_registry := 'images.viash-hub.com'" - - ".engines[.type == 'docker'].target_tag := 'v4.0.3'" + - ".engines[.type == 'docker'].target_tag := 'v4.1.0'" keywords: - "single-cell" - "multimodal" diff --git a/target/dependencies/vsh/vsh/openpipeline/v4.0.3/nextflow/filter/filter_with_scrublet/compress_h5mu.py b/target/dependencies/vsh/vsh/openpipeline/v4.1.0/nextflow/filter/filter_with_scrublet/compress_h5mu.py similarity index 100% rename from target/dependencies/vsh/vsh/openpipeline/v4.0.3/nextflow/filter/filter_with_scrublet/compress_h5mu.py rename to target/dependencies/vsh/vsh/openpipeline/v4.1.0/nextflow/filter/filter_with_scrublet/compress_h5mu.py diff --git a/target/dependencies/vsh/vsh/openpipeline/v4.0.3/nextflow/filter/filter_with_scrublet/main.nf b/target/dependencies/vsh/vsh/openpipeline/v4.1.0/nextflow/filter/filter_with_scrublet/main.nf similarity index 98% rename from target/dependencies/vsh/vsh/openpipeline/v4.0.3/nextflow/filter/filter_with_scrublet/main.nf rename to target/dependencies/vsh/vsh/openpipeline/v4.1.0/nextflow/filter/filter_with_scrublet/main.nf index 8741a30..5dd621b 100644 --- a/target/dependencies/vsh/vsh/openpipeline/v4.0.3/nextflow/filter/filter_with_scrublet/main.nf +++ b/target/dependencies/vsh/vsh/openpipeline/v4.1.0/nextflow/filter/filter_with_scrublet/main.nf @@ -1,6 +1,6 @@ -// filter_with_scrublet v4.0.3 +// filter_with_scrublet v4.1.0 // -// This wrapper script is auto-generated by viash 0.9.4 and is thus a derivative +// This wrapper script is auto-generated by viash 0.9.7 and is thus a derivative // work thereof. This software comes with ABSOLUTELY NO WARRANTY from Data // Intuitive. // @@ -1354,47 +1354,42 @@ def readCsv(file_path) { def splitRegex = java.util.regex.Pattern.compile(''',(?=(?:[^"]*"[^"]*")*[^"]*$)''') def removeQuote = java.util.regex.Pattern.compile('''"(.*)"''') - def br = java.nio.file.Files.newBufferedReader(inputFile) + java.nio.file.Files.newBufferedReader(inputFile).withCloseable { br -> + def row = 0 + def header = null + def line - def row = -1 - def header = null - while (br.ready() && header == null) { - def line = br.readLine() - row++ - if (!line.startsWith("#")) { - header = splitRegex.split(line, -1).collect{field -> - m = removeQuote.matcher(field) - m.find() ? m.replaceFirst('$1') : field - } - } - } - assert header != null: "CSV file should contain a header" - - while (br.ready()) { - def line = br.readLine() - row++ - if (line == null) { - br.close() - break - } - - if (!line.startsWith("#")) { - def predata = splitRegex.split(line, -1) - def data = predata.collect{field -> - if (field == "") { - return null - } - def m = removeQuote.matcher(field) - if (m.find()) { - return m.replaceFirst('$1') - } else { - return field + while (header == null && (line = br.readLine()) != null) { + if (!line.startsWith("#")) { + header = splitRegex.split(line, -1).collect { field -> + def m = removeQuote.matcher(field) + m.find() ? m.replaceFirst('$1') : field } } - assert header.size() == data.size(): "Row $row should contain the same number as fields as the header" - - def dataMap = [header, data].transpose().collectEntries().findAll{it.value != null} - output.add(dataMap) + row++ + } + assert header != null : "CSV file should contain a header" + + while ((line = br.readLine()) != null) { + row++ + if (!line.startsWith("#")) { + def predata = splitRegex.split(line, -1) + def data = predata.collect { field -> + if (field == "") { + return null + } + def m = removeQuote.matcher(field) + if (m.find()) { + return m.replaceFirst('$1') + } else { + return field + } + } + assert header.size() == data.size() : "Row $row should contain the same number as fields as the header" + + def dataMap = [header, data].transpose().collectEntries().findAll { it.value != null } + output.add(dataMap) + } } } @@ -1710,10 +1705,25 @@ process publishFilesProc { ] .transpose() .collectMany{infile, outfile -> - if (infile.toString() != outfile.toString()) { + def infileString = infile.toString() + def outfileString = outfile.toString() + if (infileString != outfileString) { + /* Trailing slashes are removed from both the source and destination arguments. + From source arguments, this is useful when a source argument may have a trailing slash + and specify a symbolic link to a directory. Without removing the slash, cp will dereference + the symbolic link. + See https://www.gnu.org/software/coreutils/manual/html_node/Trailing-slashes.html#Trailing-slashes-1 + + For the destination path addding a trailing slash is a problem when publishing directories: + it requires the destination directory to exist. This fails because we only create the parent + directories first. + */ + def regexTrailingSlashes = ~/\/+$/ + def infileNoTrailingSlash = infileString - regexTrailingSlashes + def outfileNoTrailingSlash = outfileString - regexTrailingSlashes [ - "[ -d \"\$(dirname '${outfile.toString()}')\" ] || mkdir -p \"\$(dirname '${outfile.toString()}')\"", - "cp -r '${infile.toString()}' '${outfile.toString()}'" + "[ -d \"\$(dirname '${outfileNoTrailingSlash}')\" ] || mkdir -p \"\$(dirname '${outfileNoTrailingSlash}')\"", + "cp -a '${infileNoTrailingSlash}' '${outfileNoTrailingSlash}'" ] } else { // no need to copy if infile is the same as outfile @@ -3036,7 +3046,7 @@ meta = [ "config": processConfig(readJsonBlob('''{ "name" : "filter_with_scrublet", "namespace" : "filter", - "version" : "v4.0.3", + "version" : "v4.1.0", "authors" : [ { "name" : "Dries De Maeyer", @@ -3281,7 +3291,7 @@ meta = [ { "type" : "string", "name" : "--output_compression", - "description" : "Compression format to use for the output AnnData and/or Mudata objects.\nBy default no compression is applied.\n", + "description" : "Compression format to use for the output AnnData and/or Mudata H5 files.\nBy default no compression is applied.\n", "example" : [ "gzip" ], @@ -3429,7 +3439,7 @@ meta = [ "id" : "docker", "image" : "python:3.13-slim", "target_registry" : "images.viash-hub.com", - "target_tag" : "v4.0.3", + "target_tag" : "v4.1.0", "namespace_separator" : "/", "setup" : [ { @@ -3444,9 +3454,10 @@ meta = [ "type" : "python", "user" : false, "packages" : [ - "anndata~=0.12.7", + "anndata~=0.12.16", "awkward", - "mudata~=0.3.2", + "scipy~=1.17.1", + "mudata~=0.3.8", "scanpy~=1.11.4", "scrublet", "annoy==1.17.3" @@ -3469,7 +3480,7 @@ meta = [ "type" : "python", "user" : false, "packages" : [ - "viashpy==0.8.0" + "viashpy==0.10.0" ], "github" : [ "openpipelines-bio/core#subdirectory=packages/python/openpipeline_testutils" @@ -3488,13 +3499,13 @@ meta = [ "runner" : "nextflow", "engine" : "docker|native", "output" : "/workdir/root/repo/target/nextflow/filter/filter_with_scrublet", - "viash_version" : "0.9.4", - "git_commit" : "7bfad4ea12f87eca59213be3ab08deff67cc4206", + "viash_version" : "0.9.7", + "git_commit" : "a6499fddaa8553874585c747370f919f4d7b729c", "git_remote" : "https://github.com/openpipelines-bio/openpipeline" }, "package_config" : { "name" : "openpipeline", - "version" : "v4.0.3", + "version" : "v4.1.0", "summary" : "Best-practice workflows for single-cell multi-omics analyses.\n", "description" : "OpenPipelines are extensible single cell analysis pipelines for reproducible and large-scale single cell processing using [Viash](https://viash.io) and [Nextflow](https://www.nextflow.io/).\n\nIn terms of workflows, the following has been made available, but keep in mind that\nindividual tools and functionality can be executed as standalone components as well.\n\n * Demultiplexing: conversion of raw sequencing data to FASTQ objects.\n * Ingestion: Read mapping and generating a count matrix.\n * Single sample processing: cell filtering and doublet detection.\n * Multisample processing: Count transformation, normalization, QC metric calulations.\n * Integration: Clustering, integration and batch correction using single and multimodal methods.\n * Downstream analysis workflows\n", "info" : { @@ -3512,14 +3523,14 @@ meta = [ } ] }, - "viash_version" : "0.9.4", + "viash_version" : "0.9.7", "source" : "/workdir/root/repo/src", "target" : "/workdir/root/repo/target", "config_mods" : [ ".resources += {path: '/src/workflows/utils/labels.config', dest: 'nextflow_labels.config'}\n.runners[.type == 'nextflow'].config.script := 'includeConfig(\\"nextflow_labels.config\\")'", ".engines += { type: \\"native\\" }", ".engines[.type == 'docker'].target_registry := 'images.viash-hub.com'", - ".engines[.type == 'docker'].target_tag := 'v4.0.3'" + ".engines[.type == 'docker'].target_tag := 'v4.1.0'" ], "keywords" : [ "single-cell", @@ -4065,7 +4076,7 @@ meta["defaults"] = [ "container" : { "registry" : "images.viash-hub.com", "image" : "vsh/openpipeline/filter/filter_with_scrublet", - "tag" : "v4.0.3" + "tag" : "v4.1.0" }, "label" : [ "highcpu", diff --git a/target/dependencies/vsh/vsh/openpipeline/v4.0.3/nextflow/filter/filter_with_scrublet/nextflow.config b/target/dependencies/vsh/vsh/openpipeline/v4.1.0/nextflow/filter/filter_with_scrublet/nextflow.config similarity index 99% rename from target/dependencies/vsh/vsh/openpipeline/v4.0.3/nextflow/filter/filter_with_scrublet/nextflow.config rename to target/dependencies/vsh/vsh/openpipeline/v4.1.0/nextflow/filter/filter_with_scrublet/nextflow.config index 23ab7fe..fc97687 100644 --- a/target/dependencies/vsh/vsh/openpipeline/v4.0.3/nextflow/filter/filter_with_scrublet/nextflow.config +++ b/target/dependencies/vsh/vsh/openpipeline/v4.1.0/nextflow/filter/filter_with_scrublet/nextflow.config @@ -2,7 +2,7 @@ manifest { name = 'filter/filter_with_scrublet' mainScript = 'main.nf' nextflowVersion = '!>=20.12.1-edge' - version = 'v4.0.3' + version = 'v4.1.0' description = 'Doublet detection using the Scrublet method (Wolock, Lopez and Klein, 2019).\nThe method tests for potential doublets by using the expression profiles of\ncells to generate synthetic potential doubles which are tested against cells. \nThe method returns a "doublet score" on which it calls for potential doublets.\n\nFor the source code please visit https://github.com/AllonKleinLab/scrublet.\n\nFor 10x we expect the doublet rates to be:\n Multiplet Rate (%) - # of Cells Loaded - # of Cells Recovered\n ~0.4% ~800 ~500\n ~0.8% ~1,600 ~1,000\n ~1.6% ~3,200 ~2,000\n ~2.3% ~4,800 ~3,000\n ~3.1% ~6,400 ~4,000\n ~3.9% ~8,000 ~5,000\n ~4.6% ~9,600 ~6,000\n ~5.4% ~11,200 ~7,000\n ~6.1% ~12,800 ~8,000\n ~6.9% ~14,400 ~9,000\n ~7.6% ~16,000 ~10,000\n' author = 'Dries De Maeyer, Robrecht Cannoodt' } diff --git a/target/dependencies/vsh/vsh/openpipeline/v4.0.3/nextflow/metadata/add_id/nextflow_labels.config b/target/dependencies/vsh/vsh/openpipeline/v4.1.0/nextflow/filter/filter_with_scrublet/nextflow_labels.config similarity index 100% rename from target/dependencies/vsh/vsh/openpipeline/v4.0.3/nextflow/metadata/add_id/nextflow_labels.config rename to target/dependencies/vsh/vsh/openpipeline/v4.1.0/nextflow/filter/filter_with_scrublet/nextflow_labels.config diff --git a/target/dependencies/vsh/vsh/openpipeline/v4.0.3/nextflow/filter/filter_with_scrublet/nextflow_schema.json b/target/dependencies/vsh/vsh/openpipeline/v4.1.0/nextflow/filter/filter_with_scrublet/nextflow_schema.json similarity index 98% rename from target/dependencies/vsh/vsh/openpipeline/v4.0.3/nextflow/filter/filter_with_scrublet/nextflow_schema.json rename to target/dependencies/vsh/vsh/openpipeline/v4.1.0/nextflow/filter/filter_with_scrublet/nextflow_schema.json index dae9f36..e4876b9 100644 --- a/target/dependencies/vsh/vsh/openpipeline/v4.0.3/nextflow/filter/filter_with_scrublet/nextflow_schema.json +++ b/target/dependencies/vsh/vsh/openpipeline/v4.1.0/nextflow/filter/filter_with_scrublet/nextflow_schema.json @@ -110,7 +110,7 @@ }, "output_compression": { "type": "string", - "description": "Compression format to use for the output AnnData and/or Mudata objects.\nBy default no compression is applied.\n", + "description": "Compression format to use for the output AnnData and/or Mudata H5 files.\nBy default no compression is applied.\n", "help_text": "Type: `string`, multiple: `False`, example: `\"gzip\"`, choices: ``gzip`, `lzf``. ", "enum": [ "gzip", diff --git a/target/dependencies/vsh/vsh/openpipeline/v4.0.3/nextflow/filter/filter_with_scrublet/setup_logger.py b/target/dependencies/vsh/vsh/openpipeline/v4.1.0/nextflow/filter/filter_with_scrublet/setup_logger.py similarity index 100% rename from target/dependencies/vsh/vsh/openpipeline/v4.0.3/nextflow/filter/filter_with_scrublet/setup_logger.py rename to target/dependencies/vsh/vsh/openpipeline/v4.1.0/nextflow/filter/filter_with_scrublet/setup_logger.py diff --git a/target/dependencies/vsh/vsh/openpipeline/v4.1.0/nextflow/filter/intersect_obs/.config.vsh.yaml b/target/dependencies/vsh/vsh/openpipeline/v4.1.0/nextflow/filter/intersect_obs/.config.vsh.yaml new file mode 100644 index 0000000..297feb6 --- /dev/null +++ b/target/dependencies/vsh/vsh/openpipeline/v4.1.0/nextflow/filter/intersect_obs/.config.vsh.yaml @@ -0,0 +1,267 @@ +name: "intersect_obs" +namespace: "filter" +version: "v4.1.0" +authors: +- name: "Dries Schaumont" + roles: + - "maintainer" + info: + role: "Core Team Member" + links: + email: "dries@data-intuitive.com" + github: "DriesSchaumont" + orcid: "0000-0002-4389-0440" + linkedin: "dries-schaumont" + organizations: + - name: "Data Intuitive" + href: "https://www.data-intuitive.com" + role: "Data Scientist" +- name: "Isabelle Bergiers" + roles: + - "contributor" + info: + role: "Contributor" + links: + github: "Isabelle-b" + orcid: "0000-0001-9622-7960" + organizations: + - name: "Janssen Pharmaceuticals" + href: "https://www.janssen.com" + role: "Scientist OMICS Technology" +argument_groups: +- name: "Arguments" + arguments: + - type: "file" + name: "--input" + description: "Input h5mu file" + info: null + example: + - "input.h5mu" + must_exist: true + create_parent: true + required: true + direction: "input" + multiple: false + multiple_sep: ";" + - type: "string" + name: "--modalities" + description: "Which modalities from the input MuData file to process.\n" + info: null + example: + - "rna" + - "prot" + required: true + direction: "input" + multiple: true + multiple_sep: ";" + - type: "file" + name: "--output" + description: "Output h5mu file." + info: null + example: + - "output.h5mu" + must_exist: true + create_parent: true + required: false + direction: "output" + multiple: false + multiple_sep: ";" + - type: "string" + name: "--output_compression" + description: "Compression format to use for the output AnnData and/or Mudata H5\ + \ files.\nBy default no compression is applied.\n" + info: null + example: + - "gzip" + required: false + choices: + - "gzip" + - "lzf" + direction: "input" + multiple: false + multiple_sep: ";" +resources: +- type: "python_script" + path: "script.py" + is_executable: true +- type: "file" + path: "setup_logger.py" +- type: "file" + path: "compress_h5mu.py" +- type: "file" + path: "nextflow_labels.config" + dest: "nextflow_labels.config" +description: "Create an intersection between two or more modalities.\n\nThis component\ + \ removes any observations which are not present in all modalities.\n" +test_resources: +- type: "python_script" + path: "test.py" + is_executable: true +- type: "file" + path: "pbmc_1k_protein_v3" +info: null +status: "enabled" +scope: + image: "public" + target: "public" +license: "MIT" +links: + repository: "https://github.com/openpipelines-bio/openpipeline" + docker_registry: "ghcr.io" +runners: +- type: "executable" + id: "executable" + docker_setup_strategy: "ifneedbepullelsecachedbuild" +- type: "nextflow" + id: "nextflow" + directives: + label: + - "lowcpu" + - "midmem" + tag: "$id" + auto: + simplifyInput: true + simplifyOutput: false + transcript: false + publish: false + config: + labels: + mem1gb: "memory = 1000000000.B" + mem2gb: "memory = 2000000000.B" + mem5gb: "memory = 5000000000.B" + mem10gb: "memory = 10000000000.B" + mem20gb: "memory = 20000000000.B" + mem50gb: "memory = 50000000000.B" + mem100gb: "memory = 100000000000.B" + mem200gb: "memory = 200000000000.B" + mem500gb: "memory = 500000000000.B" + mem1tb: "memory = 1000000000000.B" + mem2tb: "memory = 2000000000000.B" + mem5tb: "memory = 5000000000000.B" + mem10tb: "memory = 10000000000000.B" + mem20tb: "memory = 20000000000000.B" + mem50tb: "memory = 50000000000000.B" + mem100tb: "memory = 100000000000000.B" + mem200tb: "memory = 200000000000000.B" + mem500tb: "memory = 500000000000000.B" + mem1gib: "memory = 1073741824.B" + mem2gib: "memory = 2147483648.B" + mem4gib: "memory = 4294967296.B" + mem8gib: "memory = 8589934592.B" + mem16gib: "memory = 17179869184.B" + mem32gib: "memory = 34359738368.B" + mem64gib: "memory = 68719476736.B" + mem128gib: "memory = 137438953472.B" + mem256gib: "memory = 274877906944.B" + mem512gib: "memory = 549755813888.B" + mem1tib: "memory = 1099511627776.B" + mem2tib: "memory = 2199023255552.B" + mem4tib: "memory = 4398046511104.B" + mem8tib: "memory = 8796093022208.B" + mem16tib: "memory = 17592186044416.B" + mem32tib: "memory = 35184372088832.B" + mem64tib: "memory = 70368744177664.B" + mem128tib: "memory = 140737488355328.B" + mem256tib: "memory = 281474976710656.B" + mem512tib: "memory = 562949953421312.B" + cpu1: "cpus = 1" + cpu2: "cpus = 2" + cpu5: "cpus = 5" + cpu10: "cpus = 10" + cpu20: "cpus = 20" + cpu50: "cpus = 50" + cpu100: "cpus = 100" + cpu200: "cpus = 200" + cpu500: "cpus = 500" + cpu1000: "cpus = 1000" + script: + - "includeConfig(\"nextflow_labels.config\")" + debug: false + container: "docker" +engines: +- type: "docker" + id: "docker" + image: "python:3.13-slim" + target_registry: "images.viash-hub.com" + target_tag: "v4.1.0" + namespace_separator: "/" + setup: + - type: "apt" + packages: + - "procps" + interactive: false + - type: "python" + user: false + packages: + - "anndata~=0.12.16" + - "awkward" + - "scipy~=1.17.1" + - "mudata~=0.3.8" + script: + - "exec(\"try:\\n import zarr; from importlib.metadata import version\\nexcept\ + \ ModuleNotFoundError:\\n exit(0)\\nelse: assert int(version(\\\"zarr\\\"\ + ).partition(\\\".\\\")[0]) > 2\")" + upgrade: true + test_setup: + - type: "python" + user: false + packages: + - "viashpy==0.10.0" + upgrade: true + entrypoint: [] + cmd: null +- type: "native" + id: "native" +build_info: + config: "src/filter/intersect_obs/config.vsh.yaml" + runner: "nextflow" + engine: "docker|native" + output: "target/nextflow/filter/intersect_obs" + executable: "target/nextflow/filter/intersect_obs/main.nf" + viash_version: "0.9.7" + git_commit: "a6499fddaa8553874585c747370f919f4d7b729c" + git_remote: "https://github.com/openpipelines-bio/openpipeline" +package_config: + name: "openpipeline" + version: "v4.1.0" + summary: "Best-practice workflows for single-cell multi-omics analyses.\n" + description: "OpenPipelines are extensible single cell analysis pipelines for reproducible\ + \ and large-scale single cell processing using [Viash](https://viash.io) and [Nextflow](https://www.nextflow.io/).\n\ + \nIn terms of workflows, the following has been made available, but keep in mind\ + \ that\nindividual tools and functionality can be executed as standalone components\ + \ as well.\n\n * Demultiplexing: conversion of raw sequencing data to FASTQ objects.\n\ + \ * Ingestion: Read mapping and generating a count matrix.\n * Single sample\ + \ processing: cell filtering and doublet detection.\n * Multisample processing:\ + \ Count transformation, normalization, QC metric calulations.\n * Integration:\ + \ Clustering, integration and batch correction using single and multimodal methods.\n\ + \ * Downstream analysis workflows\n" + info: + test_resources: + - type: "s3" + path: "s3://openpipelines-data" + dest: "resources_test" + nextflow_labels_ci: + - path: "src/workflows/utils/labels_ci.config" + description: "Adds the correct memory and CPU labels when running on the Viash\ + \ Hub CI." + viash_version: "0.9.7" + source: "src" + target: "target" + config_mods: + - ".resources += {path: '/src/workflows/utils/labels.config', dest: 'nextflow_labels.config'}\n\ + .runners[.type == 'nextflow'].config.script := 'includeConfig(\"nextflow_labels.config\"\ + )'" + - ".engines += { type: \"native\" }" + - ".engines[.type == 'docker'].target_registry := 'images.viash-hub.com'" + - ".engines[.type == 'docker'].target_tag := 'v4.1.0'" + keywords: + - "single-cell" + - "multimodal" + license: "MIT" + organization: "vsh" + links: + repository: "https://github.com/openpipelines-bio/openpipeline" + docker_registry: "ghcr.io" + homepage: "https://openpipelines.bio" + documentation: "https://openpipelines.bio/fundamentals" + issue_tracker: "https://github.com/openpipelines-bio/openpipeline/issues" diff --git a/target/dependencies/vsh/vsh/openpipeline/v4.0.3/nextflow/metadata/grep_annotation_column/compress_h5mu.py b/target/dependencies/vsh/vsh/openpipeline/v4.1.0/nextflow/filter/intersect_obs/compress_h5mu.py similarity index 100% rename from target/dependencies/vsh/vsh/openpipeline/v4.0.3/nextflow/metadata/grep_annotation_column/compress_h5mu.py rename to target/dependencies/vsh/vsh/openpipeline/v4.1.0/nextflow/filter/intersect_obs/compress_h5mu.py diff --git a/target/dependencies/vsh/vsh/openpipeline/v4.1.0/nextflow/filter/intersect_obs/main.nf b/target/dependencies/vsh/vsh/openpipeline/v4.1.0/nextflow/filter/intersect_obs/main.nf new file mode 100644 index 0000000..5002d69 --- /dev/null +++ b/target/dependencies/vsh/vsh/openpipeline/v4.1.0/nextflow/filter/intersect_obs/main.nf @@ -0,0 +1,3994 @@ +// intersect_obs v4.1.0 +// +// This wrapper script is auto-generated by viash 0.9.7 and is thus a derivative +// work thereof. This software comes with ABSOLUTELY NO WARRANTY from Data +// Intuitive. +// +// The component may contain files which fall under a different license. The +// authors of this component should specify the license in the header of such +// files, or include a separate license file detailing the licenses of all included +// files. +// +// Component authors: +// * Dries Schaumont (maintainer) +// * Isabelle Bergiers (contributor) + +//////////////////////////// +// VDSL3 helper functions // +//////////////////////////// + +// helper file: 'src/main/resources/io/viash/runners/nextflow/arguments/_checkArgumentType.nf' +class UnexpectedArgumentTypeException extends Exception { + String errorIdentifier + String stage + String plainName + String expectedClass + String foundClass + + // ${key ? " in module '$key'" : ""}${id ? " id '$id'" : ""} + UnexpectedArgumentTypeException(String errorIdentifier, String stage, String plainName, String expectedClass, String foundClass) { + super("Error${errorIdentifier ? " $errorIdentifier" : ""}:${stage ? " $stage" : "" } argument '${plainName}' has the wrong type. " + + "Expected type: ${expectedClass}. Found type: ${foundClass}") + this.errorIdentifier = errorIdentifier + this.stage = stage + this.plainName = plainName + this.expectedClass = expectedClass + this.foundClass = foundClass + } +} + +/** + * Checks if the given value is of the expected type. If not, an exception is thrown. + * + * @param stage The stage of the argument (input or output) + * @param par The parameter definition + * @param value The value to check + * @param errorIdentifier The identifier to use in the error message + * @return The value, if it is of the expected type + * @throws UnexpectedArgumentTypeException If the value is not of the expected type +*/ +def _checkArgumentType(String stage, Map par, Object value, String errorIdentifier) { + // expectedClass will only be != null if value is not of the expected type + def expectedClass = null + def foundClass = null + + // todo: split if need be + + if (!par.required && value == null) { + expectedClass = null + } else if (par.multiple) { + if (value !instanceof Collection) { + value = [value] + } + + // split strings + value = value.collectMany{ val -> + if (val instanceof String) { + // collect() to ensure that the result is a List and not simply an array + val.split(par.multiple_sep).collect() + } else { + [val] + } + } + + // process globs + if (par.type == "file" && par.direction == "input") { + value = value.collect{ it instanceof String ? file(it, hidden: true) : it }.flatten() + } + + // check types of elements in list + try { + value = value.collect { listVal -> + _checkArgumentType(stage, par + [multiple: false], listVal, errorIdentifier) + } + } catch (UnexpectedArgumentTypeException e) { + expectedClass = "List[${e.expectedClass}]" + foundClass = "List[${e.foundClass}]" + } + } else if (par.type == "string") { + // cast to string if need be. only cast if the value is a GString + if (value instanceof GString) { + value = value as String + } + expectedClass = value instanceof String ? null : "String" + } else if (par.type == "integer") { + // cast to integer if need be + if (value !instanceof Integer) { + try { + value = value as Integer + } catch (NumberFormatException e) { + expectedClass = "Integer" + } + } + } else if (par.type == "long") { + // cast to long if need be + if (value !instanceof Long) { + try { + value = value as Long + } catch (NumberFormatException e) { + expectedClass = "Long" + } + } + } else if (par.type == "double") { + // cast to double if need be + if (value !instanceof Double) { + try { + value = value as Double + } catch (NumberFormatException e) { + expectedClass = "Double" + } + } + } else if (par.type == "float") { + // cast to float if need be + if (value !instanceof Float) { + try { + value = value as Float + } catch (NumberFormatException e) { + expectedClass = "Float" + } + } + } else if (par.type == "boolean" | par.type == "boolean_true" | par.type == "boolean_false") { + // cast to boolean if need be + if (value !instanceof Boolean) { + try { + value = value as Boolean + } catch (Exception e) { + expectedClass = "Boolean" + } + } + } else if (par.type == "file" && (par.direction == "input" || stage == "output")) { + // cast to path if need be + if (value instanceof String) { + value = file(value, hidden: true) + } + if (value instanceof File) { + value = value.toPath() + } + expectedClass = value instanceof Path ? null : "Path" + } else if (par.type == "file" && stage == "input" && par.direction == "output") { + // cast to string if need be + if (value !instanceof String) { + try { + value = value as String + } catch (Exception e) { + expectedClass = "String" + } + } + } else { + // didn't find a match for par.type + expectedClass = par.type + } + + if (expectedClass != null) { + if (foundClass == null) { + foundClass = value.getClass().getName() + } + throw new UnexpectedArgumentTypeException(errorIdentifier, stage, par.plainName, expectedClass, foundClass) + } + + return value +} +// helper file: 'src/main/resources/io/viash/runners/nextflow/arguments/_processInputValues.nf' +Map _processInputValues(Map inputs, Map config, String id, String key) { + if (!workflow.stubRun) { + config.allArguments.each { arg -> + if (arg.required && arg.direction == "input") { + assert inputs.containsKey(arg.plainName) && inputs.get(arg.plainName) != null : + "Error in module '${key}' id '${id}': required input argument '${arg.plainName}' is missing" + } + } + + inputs = inputs.collectEntries { name, value -> + def par = config.allArguments.find { it.plainName == name && (it.direction == "input" || it.type == "file") } + assert par != null : "Error in module '${key}' id '${id}': '${name}' is not a valid input argument" + + value = _checkArgumentType("input", par, value, "in module '$key' id '$id'") + + [ name, value ] + } + } + return inputs +} + +// helper file: 'src/main/resources/io/viash/runners/nextflow/arguments/_processOutputValues.nf' +Map _checkValidOutputArgument(Map outputs, Map config, String id, String key) { + if (!workflow.stubRun) { + outputs = outputs.collectEntries { name, value -> + def par = config.allArguments.find { it.plainName == name && it.direction == "output" } + assert par != null : "Error in module '${key}' id '${id}': '${name}' is not a valid output argument" + + value = _checkArgumentType("output", par, value, "in module '$key' id '$id'") + + [ name, value ] + } + } + return outputs +} + +void _checkAllRequiredOuputsPresent(Map outputs, Map config, String id, String key) { + if (!workflow.stubRun) { + config.allArguments.each { arg -> + if (arg.direction == "output" && arg.required) { + assert outputs.containsKey(arg.plainName) && outputs.get(arg.plainName) != null : + "Error in module '${key}' id '${id}': required output argument '${arg.plainName}' is missing" + } + } + } +} +// helper file: 'src/main/resources/io/viash/runners/nextflow/channel/IDChecker.nf' +class IDChecker { + final def items = [] as Set + + @groovy.transform.WithWriteLock + boolean observe(String item) { + if (items.contains(item)) { + return false + } else { + items << item + return true + } + } + + @groovy.transform.WithReadLock + boolean contains(String item) { + return items.contains(item) + } + + @groovy.transform.WithReadLock + Set getItems() { + return items.clone() + } +} +// helper file: 'src/main/resources/io/viash/runners/nextflow/channel/_checkUniqueIds.nf' + +/** + * Check if the ids are unique across parameter sets + * + * @param parameterSets a list of parameter sets. + */ +private void _checkUniqueIds(List>> parameterSets) { + def ppIds = parameterSets.collect{it[0]} + assert ppIds.size() == ppIds.unique().size() : "All argument sets should have unique ids. Detected ids: $ppIds" +} + +// helper file: 'src/main/resources/io/viash/runners/nextflow/channel/_getChild.nf' + +// helper functions for reading params from file // +def _getChild(parent, child) { + if (child.contains("://") || java.nio.file.Paths.get(child).isAbsolute()) { + child + } else { + def parentAbsolute = java.nio.file.Paths.get(parent).toAbsolutePath().toString() + parentAbsolute.replaceAll('/[^/]*$', "/") + child + } +} + +// helper file: 'src/main/resources/io/viash/runners/nextflow/channel/_parseParamList.nf' +/** + * Figure out the param list format based on the file extension + * + * @param param_list A String containing the path to the parameter list file. + * + * @return A String containing the format of the parameter list file. + */ +def _paramListGuessFormat(param_list) { + if (param_list !instanceof String) { + "asis" + } else if (param_list.endsWith(".csv")) { + "csv" + } else if (param_list.endsWith(".json") || param_list.endsWith(".jsn")) { + "json" + } else if (param_list.endsWith(".yaml") || param_list.endsWith(".yml")) { + "yaml" + } else { + "yaml_blob" + } +} + + +/** + * Read the param list + * + * @param param_list One of the following: + * - A String containing the path to the parameter list file (csv, json or yaml), + * - A yaml blob of a list of maps (yaml_blob), + * - Or a groovy list of maps (asis). + * @param config A Map of the Viash configuration. + * + * @return A List of Maps containing the parameters. + */ +def _parseParamList(param_list, Map config) { + // first determine format by extension + def paramListFormat = _paramListGuessFormat(param_list) + + def paramListPath = (paramListFormat != "asis" && paramListFormat != "yaml_blob") ? + file(param_list, hidden: true) : + null + + // get the correct parser function for the detected params_list format + def paramSets = [] + if (paramListFormat == "asis") { + paramSets = param_list + } else if (paramListFormat == "yaml_blob") { + paramSets = readYamlBlob(param_list) + } else if (paramListFormat == "yaml") { + paramSets = readYaml(paramListPath) + } else if (paramListFormat == "json") { + paramSets = readJson(paramListPath) + } else if (paramListFormat == "csv") { + paramSets = readCsv(paramListPath) + } else { + error "Format of provided --param_list not recognised.\n" + + "Found: '$paramListFormat'.\n" + + "Expected: a csv file, a json file, a yaml file,\n" + + "a yaml blob or a groovy list of maps." + } + + // data checks + assert paramSets instanceof List: "--param_list should contain a list of maps" + for (value in paramSets) { + assert value instanceof Map: "--param_list should contain a list of maps" + } + + // id is argument + def idIsArgument = config.allArguments.any{it.plainName == "id"} + + // Reformat from List to List> by adding the ID as first element of a Tuple2 + paramSets = paramSets.collect({ data -> + def id = data.id + if (!idIsArgument) { + data = data.findAll{k, v -> k != "id"} + } + [id, data] + }) + + // Split parameters with 'multiple: true' + paramSets = paramSets.collect({ id, data -> + data = _splitParams(data, config) + [id, data] + }) + + // The paths of input files inside a param_list file may have been specified relatively to the + // location of the param_list file. These paths must be made absolute. + if (paramListPath) { + paramSets = paramSets.collect({ id, data -> + def new_data = data.collectEntries{ parName, parValue -> + def par = config.allArguments.find{it.plainName == parName} + if (par && par.type == "file" && par.direction == "input") { + if (parValue instanceof Collection) { + parValue = parValue.collectMany{path -> + def x = _resolveSiblingIfNotAbsolute(path, paramListPath) + x instanceof Collection ? x : [x] + } + } else { + parValue = _resolveSiblingIfNotAbsolute(parValue, paramListPath) + } + } + [parName, parValue] + } + [id, new_data] + }) + } + + return paramSets +} + +// helper file: 'src/main/resources/io/viash/runners/nextflow/channel/_splitParams.nf' +/** + * Split parameters for arguments that accept multiple values using their separator + * + * @param paramList A Map containing parameters to split. + * @param config A Map of the Viash configuration. This Map can be generated from the config file + * using the readConfig() function. + * + * @return A Map of parameters where the parameter values have been split into a list using + * their seperator. + */ +Map _splitParams(Map parValues, Map config){ + def parsedParamValues = parValues.collectEntries { parName, parValue -> + def parameterSettings = config.allArguments.find({it.plainName == parName}) + + if (!parameterSettings) { + // if argument is not found, do not alter + return [parName, parValue] + } + if (parameterSettings.multiple) { // Check if parameter can accept multiple values + if (parValue instanceof Collection) { + parValue = parValue.collect{it instanceof String ? it.split(parameterSettings.multiple_sep) : it } + } else if (parValue instanceof String) { + parValue = parValue.split(parameterSettings.multiple_sep) + } else if (parValue == null) { + parValue = [] + } else { + parValue = [ parValue ] + } + parValue = parValue.flatten() + } + // For all parameters check if multiple values are only passed for + // arguments that allow it. Quietly simplify lists of length 1. + if (!parameterSettings.multiple && parValue instanceof Collection) { + assert parValue.size() == 1 : + "Error: argument ${parName} has too many values.\n" + + " Expected amount: 1. Found: ${parValue.size()}" + parValue = parValue[0] + } + [parName, parValue] + } + return parsedParamValues +} + +// helper file: 'src/main/resources/io/viash/runners/nextflow/channel/channelFromParams.nf' +/** + * Parse nextflow parameters based on settings defined in a viash config. + * Return a list of parameter sets, each parameter set corresponding to + * an event in a nextflow channel. The output from this function can be used + * with Channel.fromList to create a nextflow channel with Vdsl3 formatted + * events. + * + * This function performs: + * - A filtering of the params which can be found in the config file. + * - Process the params_list argument which allows a user to to initialise + * a Vsdl3 channel with multiple parameter sets. Possible formats are + * csv, json, yaml, or simply a yaml_blob. A csv should have column names + * which correspond to the different arguments of this pipeline. A json or a yaml + * file should be a list of maps, each of which has keys corresponding to the + * arguments of the pipeline. A yaml blob can also be passed directly as a parameter. + * When passing a csv, json or yaml, relative path names are relativized to the + * location of the parameter file. + * - Combine the parameter sets into a vdsl3 Channel. + * + * @param params Input parameters. Can optionaly contain a 'param_list' key that + * provides a list of arguments that can be split up into multiple events + * in the output channel possible formats of param_lists are: a csv file, + * json file, a yaml file or a yaml blob. Each parameters set (event) must + * have a unique ID. + * @param config A Map of the Viash configuration. This Map can be generated from the config file + * using the readConfig() function. + * + * @return A list of parameters with the first element of the event being + * the event ID and the second element containing a map of the parsed parameters. + */ + +private List>> _paramsToParamSets(Map params, Map config){ + // todo: fetch key from run args + def key_ = config.name + + /* parse regular parameters (not in param_list) */ + /*************************************************/ + def globalParams = config.allArguments + .findAll { params.containsKey(it.plainName) } + .collectEntries { [ it.plainName, params[it.plainName] ] } + def globalID = params.get("id", null) + + /* process params_list arguments */ + /*********************************/ + def paramList = params.containsKey("param_list") && params.param_list != null ? + params.param_list : [] + // if (paramList instanceof String) { + // paramList = [paramList] + // } + // def paramSets = paramList.collectMany{ _parseParamList(it, config) } + // TODO: be able to process param_list when it is a list of strings + def paramSets = _parseParamList(paramList, config) + if (paramSets.isEmpty()) { + paramSets = [[null, [:]]] + } + + /* combine arguments into channel */ + /**********************************/ + def processedParams = paramSets.indexed().collect{ index, tup -> + // Process ID + def id = tup[0] ?: globalID + + if (workflow.stubRun && !id) { + // if stub run, explicitly add an id if missing + id = "stub${index}" + } + assert id != null: "Each parameter set should have at least an 'id'" + + // Process params + def parValues = globalParams + tup[1] + // // Remove parameters which are null, if the default is also null + // parValues = parValues.collectEntries{paramName, paramValue -> + // parameterSettings = config.functionality.allArguments.find({it.plainName == paramName}) + // if ( paramValue != null || parameterSettings.get("default", null) != null ) { + // [paramName, paramValue] + // } + // } + parValues = parValues.collectEntries { name, value -> + def par = config.allArguments.find { it.plainName == name && (it.direction == "input" || it.type == "file") } + assert par != null : "Error in module '${key_}' id '${id}': '${name}' is not a valid input argument" + + if (par == null) { + return [:] + } + value = _checkArgumentType("input", par, value, "in module '$key_' id '$id'") + + [ name, value ] + } + + [id, parValues] + } + + // Check if ids (first element of each list) is unique + _checkUniqueIds(processedParams) + return processedParams +} + +/** + * Parse nextflow parameters based on settings defined in a viash config + * and return a nextflow channel. + * + * @param params Input parameters. Can optionaly contain a 'param_list' key that + * provides a list of arguments that can be split up into multiple events + * in the output channel possible formats of param_lists are: a csv file, + * json file, a yaml file or a yaml blob. Each parameters set (event) must + * have a unique ID. + * @param config A Map of the Viash configuration. This Map can be generated from the config file + * using the readConfig() function. + * + * @return A nextflow Channel with events. Events are formatted as a tuple that contains + * first contains the ID of the event and as second element holds a parameter map. + * + * + */ +def channelFromParams(Map params, Map config) { + def processedParams = _paramsToParamSets(params, config) + return Channel.fromList(processedParams) +} + +// helper file: 'src/main/resources/io/viash/runners/nextflow/channel/checkUniqueIds.nf' +def checkUniqueIds(Map args) { + def stopOnError = args.stopOnError == null ? args.stopOnError : true + + def idChecker = new IDChecker() + + return filter { tup -> + if (!idChecker.observe(tup[0])) { + if (stopOnError) { + error "Duplicate id: ${tup[0]}" + } else { + log.warn "Duplicate id: ${tup[0]}, removing duplicate entry" + return false + } + } + return true + } +} +// helper file: 'src/main/resources/io/viash/runners/nextflow/channel/preprocessInputs.nf' +// This helper file will be deprecated soon +preprocessInputsDeprecationWarningPrinted = false + +def preprocessInputsDeprecationWarning() { + if (!preprocessInputsDeprecationWarningPrinted) { + preprocessInputsDeprecationWarningPrinted = true + System.err.println("Warning: preprocessInputs() is deprecated and will be removed in Viash 0.9.0.") + } +} + +/** + * Generate a nextflow Workflow that allows processing a channel of + * Vdsl3 formatted events and apply a Viash config to them: + * - Gather default parameters from the Viash config and make + * sure that they are correctly formatted (see applyConfig method). + * - Format the input parameters (also using the applyConfig method). + * - Apply the default parameter to the input parameters. + * - Do some assertions: + * ~ Check if the event IDs in the channel are unique. + * + * The events in the channel are formatted as tuples, with the + * first element of the tuples being a unique id of the parameter set, + * and the second element containg the the parameters themselves. + * Optional extra elements of the tuples will be passed to the output as is. + * + * @param args A map that must contain a 'config' key that points + * to a parsed config (see readConfig()). Optionally, a + * 'key' key can be provided which can be used to create a unique + * name for the workflow process. + * + * @return A workflow that allows processing a channel of Vdsl3 formatted events + * and apply a Viash config to them. + */ +def preprocessInputs(Map args) { + preprocessInputsDeprecationWarning() + + def config = args.config + assert config instanceof Map : + "Error in preprocessInputs: config must be a map. " + + "Expected class: Map. Found: config.getClass() is ${config.getClass()}" + def key_ = args.key ?: config.name + + // Get different parameter types (used throughout this function) + def defaultArgs = config.allArguments + .findAll { it.containsKey("default") } + .collectEntries { [ it.plainName, it.default ] } + + map { tup -> + def id = tup[0] + def data = tup[1] + def passthrough = tup.drop(2) + + def new_data = (defaultArgs + data).collectEntries { name, value -> + def par = config.allArguments.find { it.plainName == name && (it.direction == "input" || it.type == "file") } + + if (par != null) { + value = _checkArgumentType("input", par, value, "in module '$key_' id '$id'") + } + + [ name, value ] + } + + [ id, new_data ] + passthrough + } +} + +// helper file: 'src/main/resources/io/viash/runners/nextflow/channel/runComponents.nf' +/** + * Run a list of components on a stream of data. + * + * @param components: list of Viash VDSL3 modules to run + * @param fromState: a closure, a map or a list of keys to extract from the input data. + * If a closure, it will be called with the id, the data and the component config. + * @param toState: a closure, a map or a list of keys to extract from the output data + * If a closure, it will be called with the id, the output data, the old state and the component config. + * @param filter: filter function to apply to the input. + * It will be called with the id, the data and the component config. + * @param id: id to use for the output data + * If a closure, it will be called with the id, the data and the component config. + * @param auto: auto options to pass to the components + * + * @return: a workflow that runs the components + **/ +def runComponents(Map args) { + log.warn("runComponents is deprecated, use runEach instead") + assert args.components: "runComponents should be passed a list of components to run" + + def components_ = args.components + if (components_ !instanceof List) { + components_ = [ components_ ] + } + assert components_.size() > 0: "pass at least one component to runComponents" + + def fromState_ = args.fromState + def toState_ = args.toState + def filter_ = args.filter + def id_ = args.id + + workflow runComponentsWf { + take: input_ch + main: + + // generate one channel per method + out_chs = components_.collect{ comp_ -> + def comp_config = comp_.config + + def filter_ch = filter_ + ? input_ch | filter{tup -> + filter_(tup[0], tup[1], comp_config) + } + : input_ch + def id_ch = id_ + ? filter_ch | map{tup -> + // def new_id = id_(tup[0], tup[1], comp_config) + def new_id = tup[0] + if (id_ instanceof String) { + new_id = id_ + } else if (id_ instanceof Closure) { + new_id = id_(new_id, tup[1], comp_config) + } + [new_id] + tup.drop(1) + } + : filter_ch + def data_ch = id_ch | map{tup -> + def new_data = tup[1] + if (fromState_ instanceof Map) { + new_data = fromState_.collectEntries{ key0, key1 -> + [key0, new_data[key1]] + } + } else if (fromState_ instanceof List) { + new_data = fromState_.collectEntries{ key -> + [key, new_data[key]] + } + } else if (fromState_ instanceof Closure) { + new_data = fromState_(tup[0], new_data, comp_config) + } + tup.take(1) + [new_data] + tup.drop(1) + } + def out_ch = data_ch + | comp_.run( + auto: (args.auto ?: [:]) + [simplifyInput: false, simplifyOutput: false] + ) + def post_ch = toState_ + ? out_ch | map{tup -> + def output = tup[1] + def old_state = tup[2] + def new_state = null + if (toState_ instanceof Map) { + new_state = old_state + toState_.collectEntries{ key0, key1 -> + [key0, output[key1]] + } + } else if (toState_ instanceof List) { + new_state = old_state + toState_.collectEntries{ key -> + [key, output[key]] + } + } else if (toState_ instanceof Closure) { + new_state = toState_(tup[0], output, old_state, comp_config) + } + [tup[0], new_state] + tup.drop(3) + } + : out_ch + + post_ch + } + + // mix all results + output_ch = + (out_chs.size == 1) + ? out_chs[0] + : out_chs[0].mix(*out_chs.drop(1)) + + emit: output_ch + } + + return runComponentsWf +} + +// helper file: 'src/main/resources/io/viash/runners/nextflow/channel/runEach.nf' +/** + * Run a list of components on a stream of data. + * + * @param components: list of Viash VDSL3 modules to run + * @param fromState: a closure, a map or a list of keys to extract from the input data. + * If a closure, it will be called with the id, the data and the component itself. + * @param toState: a closure, a map or a list of keys to extract from the output data + * If a closure, it will be called with the id, the output data, the old state and the component itself. + * @param filter: filter function to apply to the input. + * It will be called with the id, the data and the component itself. + * @param id: id to use for the output data + * If a closure, it will be called with the id, the data and the component itself. + * @param auto: auto options to pass to the components + * + * @return: a workflow that runs the components + **/ +def runEach(Map args) { + assert args.components: "runEach should be passed a list of components to run" + + def components_ = args.components + if (components_ !instanceof List) { + components_ = [ components_ ] + } + assert components_.size() > 0: "pass at least one component to runEach" + + def fromState_ = args.fromState + def toState_ = args.toState + def filter_ = args.filter + def runIf_ = args.runIf + def id_ = args.id + + assert !runIf_ || runIf_ instanceof Closure: "runEach: must pass a Closure to runIf." + + workflow runEachWf { + take: input_ch + main: + + // generate one channel per method + out_chs = components_.collect{ comp_ -> + def filter_ch = filter_ + ? input_ch | filter{tup -> + filter_(tup[0], tup[1], comp_) + } + : input_ch + def id_ch = id_ + ? filter_ch | map{tup -> + def new_id = id_ + if (new_id instanceof Closure) { + new_id = new_id(tup[0], tup[1], comp_) + } + assert new_id instanceof String : "Error in runEach: id should be a String or a Closure that returns a String. Expected: id instanceof String. Found: ${new_id.getClass()}" + [new_id] + tup.drop(1) + } + : filter_ch + def chPassthrough = null + def chRun = null + if (runIf_) { + def idRunIfBranch = id_ch.branch{ tup -> + run: runIf_(tup[0], tup[1], comp_) + passthrough: true + } + chPassthrough = idRunIfBranch.passthrough + chRun = idRunIfBranch.run + } else { + chRun = id_ch + chPassthrough = Channel.empty() + } + def data_ch = chRun | map{tup -> + def new_data = tup[1] + if (fromState_ instanceof Map) { + new_data = fromState_.collectEntries{ key0, key1 -> + [key0, new_data[key1]] + } + } else if (fromState_ instanceof List) { + new_data = fromState_.collectEntries{ key -> + [key, new_data[key]] + } + } else if (fromState_ instanceof Closure) { + new_data = fromState_(tup[0], new_data, comp_) + } + tup.take(1) + [new_data] + tup.drop(1) + } + def out_ch = data_ch + | comp_.run( + auto: (args.auto ?: [:]) + [simplifyInput: false, simplifyOutput: false] + ) + def post_ch = toState_ + ? out_ch | map{tup -> + def output = tup[1] + def old_state = tup[2] + def new_state = null + if (toState_ instanceof Map) { + new_state = old_state + toState_.collectEntries{ key0, key1 -> + [key0, output[key1]] + } + } else if (toState_ instanceof List) { + new_state = old_state + toState_.collectEntries{ key -> + [key, output[key]] + } + } else if (toState_ instanceof Closure) { + new_state = toState_(tup[0], output, old_state, comp_) + } + [tup[0], new_state] + tup.drop(3) + } + : out_ch + + def return_ch = post_ch + | concat(chPassthrough) + + return_ch + } + + // mix all results + output_ch = + (out_chs.size == 1) + ? out_chs[0] + : out_chs[0].mix(*out_chs.drop(1)) + + emit: output_ch + } + + return runEachWf +} + +// helper file: 'src/main/resources/io/viash/runners/nextflow/channel/safeJoin.nf' +/** + * Join sourceChannel to targetChannel + * + * This function joins the sourceChannel to the targetChannel. + * However, each id in the targetChannel must be present in the + * sourceChannel. If _meta.join_id exists in the targetChannel, that is + * used as an id instead. If the id doesn't match any id in the sourceChannel, + * an error is thrown. + */ + +def safeJoin(targetChannel, sourceChannel, key) { + def sourceIDs = new IDChecker() + + def sourceCheck = sourceChannel + | map { tup -> + sourceIDs.observe(tup[0]) + tup + } + def targetCheck = targetChannel + | map { tup -> + def id = tup[0] + + if (!sourceIDs.contains(id)) { + error ( + "Error in module '${key}' when merging output with original state.\n" + + " Reason: output with id '${id}' could not be joined with source channel.\n" + + " If the IDs in the output channel differ from the input channel,\n" + + " please set `tup[1]._meta.join_id to the original ID.\n" + + " Original IDs in input channel: ['${sourceIDs.getItems().join("', '")}'].\n" + + " Unexpected ID in the output channel: '${id}'.\n" + + " Example input event: [\"id\", [input: file(...)]],\n" + + " Example output event: [\"newid\", [output: file(...), _meta: [join_id: \"id\"]]]" + ) + } + // TODO: add link to our documentation on how to fix this + + tup + } + + sourceCheck.cross(targetChannel) + | map{ left, right -> + right + left.drop(1) + } +} + +// helper file: 'src/main/resources/io/viash/runners/nextflow/config/_processArgument.nf' +def _processArgument(arg) { + arg.multiple = arg.multiple != null ? arg.multiple : false + arg.required = arg.required != null ? arg.required : false + arg.direction = arg.direction != null ? arg.direction : "input" + arg.multiple_sep = arg.multiple_sep != null ? arg.multiple_sep : ";" + arg.plainName = arg.name.replaceAll("^-*", "") + + if (arg.type == "file") { + arg.must_exist = arg.must_exist != null ? arg.must_exist : true + arg.create_parent = arg.create_parent != null ? arg.create_parent : true + } + + // add default values to output files which haven't already got a default + if (arg.type == "file" && arg.direction == "output" && arg.default == null) { + def mult = arg.multiple ? "_*" : "" + def extSearch = "" + if (arg.default != null) { + extSearch = arg.default + } else if (arg.example != null) { + extSearch = arg.example + } + if (extSearch instanceof List) { + extSearch = extSearch[0] + } + def extSearchResult = extSearch.find("\\.[^\\.]+\$") + def ext = extSearchResult != null ? extSearchResult : "" + arg.default = "\$id.\$key.${arg.plainName}${mult}${ext}" + if (arg.multiple) { + arg.default = [arg.default] + } + } + + if (!arg.multiple) { + if (arg.default != null && arg.default instanceof List) { + arg.default = arg.default[0] + } + if (arg.example != null && arg.example instanceof List) { + arg.example = arg.example[0] + } + } + + if (arg.type == "boolean_true") { + arg.default = false + } + if (arg.type == "boolean_false") { + arg.default = true + } + + arg +} + +// helper file: 'src/main/resources/io/viash/runners/nextflow/config/addGlobalParams.nf' +def addGlobalArguments(config) { + def localConfig = [ + "argument_groups": [ + [ + "name": "Nextflow input-output arguments", + "description": "Input/output parameters for Nextflow itself. Please note that both publishDir and publish_dir are supported but at least one has to be configured.", + "arguments" : [ + [ + 'name': '--publish_dir', + 'required': true, + 'type': 'string', + 'description': 'Path to an output directory.', + 'example': 'output/', + 'multiple': false + ], + [ + 'name': '--param_list', + 'required': false, + 'type': 'string', + 'description': '''Allows inputting multiple parameter sets to initialise a Nextflow channel. A `param_list` can either be a list of maps, a csv file, a json file, a yaml file, or simply a yaml blob. + | + |* A list of maps (as-is) where the keys of each map corresponds to the arguments of the pipeline. Example: in a `nextflow.config` file: `param_list: [ ['id': 'foo', 'input': 'foo.txt'], ['id': 'bar', 'input': 'bar.txt'] ]`. + |* A csv file should have column names which correspond to the different arguments of this pipeline. Example: `--param_list data.csv` with columns `id,input`. + |* A json or a yaml file should be a list of maps, each of which has keys corresponding to the arguments of the pipeline. Example: `--param_list data.json` with contents `[ {'id': 'foo', 'input': 'foo.txt'}, {'id': 'bar', 'input': 'bar.txt'} ]`. + |* A yaml blob can also be passed directly as a string. Example: `--param_list "[ {'id': 'foo', 'input': 'foo.txt'}, {'id': 'bar', 'input': 'bar.txt'} ]"`. + | + |When passing a csv, json or yaml file, relative path names are relativized to the location of the parameter file. No relativation is performed when `param_list` is a list of maps (as-is) or a yaml blob.'''.stripMargin(), + 'example': 'my_params.yaml', + 'multiple': false, + 'hidden': true + ] + // TODO: allow multiple: true in param_list? + // TODO: allow to specify a --param_list_regex to filter the param_list? + // TODO: allow to specify a --param_list_from_state to remap entries in the param_list? + ] + ] + ] + ] + + return processConfig(_mergeMap(config, localConfig)) +} + +def _mergeMap(Map lhs, Map rhs) { + return rhs.inject(lhs.clone()) { map, entry -> + if (map[entry.key] instanceof Map && entry.value instanceof Map) { + map[entry.key] = _mergeMap(map[entry.key], entry.value) + } else if (map[entry.key] instanceof Collection && entry.value instanceof Collection) { + map[entry.key] += entry.value + } else { + map[entry.key] = entry.value + } + return map + } +} + +// helper file: 'src/main/resources/io/viash/runners/nextflow/config/generateHelp.nf' +def _generateArgumentHelp(param) { + // alternatives are not supported + // def names = param.alternatives ::: List(param.name) + + def unnamedProps = [ + ["required parameter", param.required], + ["multiple values allowed", param.multiple], + ["output", param.direction.toLowerCase() == "output"], + ["file must exist", param.type == "file" && param.must_exist] + ].findAll{it[1]}.collect{it[0]} + + def dflt = null + if (param.default != null) { + if (param.default instanceof List) { + dflt = param.default.join(param.multiple_sep != null ? param.multiple_sep : ", ") + } else { + dflt = param.default.toString() + } + } + def example = null + if (param.example != null) { + if (param.example instanceof List) { + example = param.example.join(param.multiple_sep != null ? param.multiple_sep : ", ") + } else { + example = param.example.toString() + } + } + def min = param.min?.toString() + def max = param.max?.toString() + + def escapeChoice = { choice -> + def s1 = choice.replaceAll("\\n", "\\\\n") + def s2 = s1.replaceAll("\"", """\\\"""") + s2.contains(",") || s2 != choice ? "\"" + s2 + "\"" : s2 + } + def choices = param.choices == null ? + null : + "[ " + param.choices.collect{escapeChoice(it.toString())}.join(", ") + " ]" + + def namedPropsStr = [ + ["type", ([param.type] + unnamedProps).join(", ")], + ["default", dflt], + ["example", example], + ["choices", choices], + ["min", min], + ["max", max] + ] + .findAll{it[1]} + .collect{"\n " + it[0] + ": " + it[1].replaceAll("\n", "\\n")} + .join("") + + def descStr = param.description == null ? + "" : + _paragraphWrap("\n" + param.description.trim(), 80 - 8).join("\n ") + + "\n --" + param.plainName + + namedPropsStr + + descStr +} + +// Based on Helper.generateHelp() in Helper.scala +def _generateHelp(config) { + def fun = config + + // PART 1: NAME AND VERSION + def nameStr = fun.name + + (fun.version == null ? "" : " " + fun.version) + + // PART 2: DESCRIPTION + def descrStr = fun.description == null ? + "" : + "\n\n" + _paragraphWrap(fun.description.trim(), 80).join("\n") + + // PART 3: Usage + def usageStr = fun.usage == null ? + "" : + "\n\nUsage:\n" + fun.usage.trim() + + // PART 4: Options + def argGroupStrs = fun.allArgumentGroups.collect{argGroup -> + def name = argGroup.name + def descriptionStr = argGroup.description == null ? + "" : + "\n " + _paragraphWrap(argGroup.description.trim(), 80-4).join("\n ") + "\n" + def arguments = argGroup.arguments.collect{arg -> + arg instanceof String ? fun.allArguments.find{it.plainName == arg} : arg + }.findAll{it != null} + def argumentStrs = arguments.collect{param -> _generateArgumentHelp(param)} + + "\n\n$name:" + + descriptionStr + + argumentStrs.join("\n") + } + + // FINAL: combine + def out = nameStr + + descrStr + + usageStr + + argGroupStrs.join("") + + return out +} + +// based on Format._paragraphWrap +def _paragraphWrap(str, maxLength) { + def outLines = [] + str.split("\n").each{par -> + def words = par.split("\\s").toList() + + def word = null + def line = words.pop() + while(!words.isEmpty()) { + word = words.pop() + if (line.length() + word.length() + 1 <= maxLength) { + line = line + " " + word + } else { + outLines.add(line) + line = word + } + } + if (words.isEmpty()) { + outLines.add(line) + } + } + return outLines +} + +def helpMessage(config) { + if (params.containsKey("help") && params.help) { + def mergedConfig = addGlobalArguments(config) + def helpStr = _generateHelp(mergedConfig) + println(helpStr) + exit 0 + } +} + +// helper file: 'src/main/resources/io/viash/runners/nextflow/config/processConfig.nf' +def processConfig(config) { + // set defaults for arguments + config.arguments = + (config.arguments ?: []).collect{_processArgument(it)} + + // set defaults for argument_group arguments + config.argument_groups = + (config.argument_groups ?: []).collect{grp -> + grp.arguments = (grp.arguments ?: []).collect{_processArgument(it)} + grp + } + + // create combined arguments list + config.allArguments = + config.arguments + + config.argument_groups.collectMany{it.arguments} + + // add missing argument groups (based on Functionality::allArgumentGroups()) + def argGroups = config.argument_groups + if (argGroups.any{it.name.toLowerCase() == "arguments"}) { + argGroups = argGroups.collect{ grp -> + if (grp.name.toLowerCase() == "arguments") { + grp = grp + [ + arguments: grp.arguments + config.arguments + ] + } + grp + } + } else { + argGroups = argGroups + [ + name: "Arguments", + arguments: config.arguments + ] + } + config.allArgumentGroups = argGroups + + config +} + +// helper file: 'src/main/resources/io/viash/runners/nextflow/config/readConfig.nf' + +def readConfig(file) { + def config = readYaml(file ?: moduleDir.resolve("config.vsh.yaml")) + processConfig(config) +} + +// helper file: 'src/main/resources/io/viash/runners/nextflow/functions/_resolveSiblingIfNotAbsolute.nf' +/** + * Resolve a path relative to the current file. + * + * @param str The path to resolve, as a String. + * @param parentPath The path to resolve relative to, as a Path. + * + * @return The path that may have been resovled, as a Path. + */ +def _resolveSiblingIfNotAbsolute(str, parentPath) { + if (str !instanceof String) { + return str + } + if (!_stringIsAbsolutePath(str)) { + return parentPath.resolveSibling(str) + } else { + return file(str, hidden: true) + } +} + +// helper file: 'src/main/resources/io/viash/runners/nextflow/functions/_stringIsAbsolutePath.nf' +/** + * Check whether a path as a string is absolute. + * + * In the past, we tried using `file(., relative: true).isAbsolute()`, + * but the 'relative' option was added in 22.10.0. + * + * @param path The path to check, as a String. + * + * @return Whether the path is absolute, as a boolean. + */ +def _stringIsAbsolutePath(path) { + def _resolve_URL_PROTOCOL = ~/^([a-zA-Z][a-zA-Z0-9]*:)?\\/.+/ + + assert path instanceof String + return _resolve_URL_PROTOCOL.matcher(path).matches() +} + +// helper file: 'src/main/resources/io/viash/runners/nextflow/functions/collectTraces.nf' +class CustomTraceObserver implements nextflow.trace.TraceObserver { + List traces + + CustomTraceObserver(List traces) { + this.traces = traces + } + + @Override + void onProcessComplete(nextflow.processor.TaskHandler handler, nextflow.trace.TraceRecord trace) { + def trace2 = trace.store.clone() + trace2.script = null + traces.add(trace2) + } + + @Override + void onProcessCached(nextflow.processor.TaskHandler handler, nextflow.trace.TraceRecord trace) { + def trace2 = trace.store.clone() + trace2.script = null + traces.add(trace2) + } +} + +def collectTraces() { + def traces = Collections.synchronizedList([]) + + // add custom trace observer which stores traces in the traces object + session.observers.add(new CustomTraceObserver(traces)) + + traces +} + +// helper file: 'src/main/resources/io/viash/runners/nextflow/functions/deepClone.nf' +/** + * Performs a deep clone of the given object. + * @param x an object + */ +def deepClone(x) { + iterateMap(x, {it instanceof Cloneable ? it.clone() : it}) +} +// helper file: 'src/main/resources/io/viash/runners/nextflow/functions/getPublishDir.nf' +def getPublishDir() { + return params.containsKey("publish_dir") ? params.publish_dir : + params.containsKey("publishDir") ? params.publishDir : + null +} + +// helper file: 'src/main/resources/io/viash/runners/nextflow/functions/getRootDir.nf' + +// Recurse upwards until we find a '.build.yaml' file +def _findBuildYamlFile(pathPossiblySymlink) { + def path = pathPossiblySymlink.toRealPath() + def child = path.resolve(".build.yaml") + if (java.nio.file.Files.isDirectory(path) && java.nio.file.Files.exists(child)) { + return child + } else { + def parent = path.getParent() + if (parent == null) { + return null + } else { + return _findBuildYamlFile(parent) + } + } +} + +// get the root of the target folder +def getRootDir() { + def dir = _findBuildYamlFile(meta.resources_dir) + assert dir != null: "Could not find .build.yaml in the folder structure" + dir.getParent() +} + +// helper file: 'src/main/resources/io/viash/runners/nextflow/functions/iterateMap.nf' +/** + * Recursively apply a function over the leaves of an object. + * @param obj The object to iterate over. + * @param fun The function to apply to each value. + * @return The object with the function applied to each value. + */ +def iterateMap(obj, fun) { + if (obj instanceof List && obj !instanceof String) { + return obj.collect{item -> + iterateMap(item, fun) + } + } else if (obj instanceof Map) { + return obj.collectEntries{key, item -> + [key.toString(), iterateMap(item, fun)] + } + } else { + return fun(obj) + } +} + +// helper file: 'src/main/resources/io/viash/runners/nextflow/functions/niceView.nf' +/** + * A view for printing the event of each channel as a YAML blob. + * This is useful for debugging. + */ +def niceView() { + workflow niceViewWf { + take: input + main: + output = input + | view{toYamlBlob(it)} + emit: output + } + return niceViewWf +} + +// helper file: 'src/main/resources/io/viash/runners/nextflow/readwrite/readCsv.nf' + +def readCsv(file_path) { + def output = [] + def inputFile = file_path !instanceof Path ? file(file_path, hidden: true) : file_path + + // todo: allow escaped quotes in string + // todo: allow single quotes? + def splitRegex = java.util.regex.Pattern.compile(''',(?=(?:[^"]*"[^"]*")*[^"]*$)''') + def removeQuote = java.util.regex.Pattern.compile('''"(.*)"''') + + java.nio.file.Files.newBufferedReader(inputFile).withCloseable { br -> + def row = 0 + def header = null + def line + + while (header == null && (line = br.readLine()) != null) { + if (!line.startsWith("#")) { + header = splitRegex.split(line, -1).collect { field -> + def m = removeQuote.matcher(field) + m.find() ? m.replaceFirst('$1') : field + } + } + row++ + } + assert header != null : "CSV file should contain a header" + + while ((line = br.readLine()) != null) { + row++ + if (!line.startsWith("#")) { + def predata = splitRegex.split(line, -1) + def data = predata.collect { field -> + if (field == "") { + return null + } + def m = removeQuote.matcher(field) + if (m.find()) { + return m.replaceFirst('$1') + } else { + return field + } + } + assert header.size() == data.size() : "Row $row should contain the same number as fields as the header" + + def dataMap = [header, data].transpose().collectEntries().findAll { it.value != null } + output.add(dataMap) + } + } + } + + output +} + +// helper file: 'src/main/resources/io/viash/runners/nextflow/readwrite/readJson.nf' +def readJson(file_path) { + def inputFile = file_path !instanceof Path ? file(file_path, hidden: true) : file_path + def jsonSlurper = new groovy.json.JsonSlurper() + jsonSlurper.parse(inputFile) +} + +// helper file: 'src/main/resources/io/viash/runners/nextflow/readwrite/readJsonBlob.nf' +def readJsonBlob(str) { + def jsonSlurper = new groovy.json.JsonSlurper() + jsonSlurper.parseText(str) +} + +// helper file: 'src/main/resources/io/viash/runners/nextflow/readwrite/readTaggedYaml.nf' +// Custom constructor to modify how certain objects are parsed from YAML +class CustomConstructor extends org.yaml.snakeyaml.constructor.Constructor { + Path root + + class ConstructPath extends org.yaml.snakeyaml.constructor.AbstractConstruct { + public Object construct(org.yaml.snakeyaml.nodes.Node node) { + String filename = (String) constructScalar(node); + if (root != null) { + return root.resolve(filename); + } + return java.nio.file.Paths.get(filename); + } + } + + CustomConstructor(org.yaml.snakeyaml.LoaderOptions options, Path root) { + super(options) + this.root = root + // Handling !file tag and parse it back to a File type + this.yamlConstructors.put(new org.yaml.snakeyaml.nodes.Tag("!file"), new ConstructPath()) + } +} + +def readTaggedYaml(Path path) { + def options = new org.yaml.snakeyaml.LoaderOptions() + def constructor = new CustomConstructor(options, path.getParent()) + def yaml = new org.yaml.snakeyaml.Yaml(constructor) + return yaml.load(path.text) +} + +// helper file: 'src/main/resources/io/viash/runners/nextflow/readwrite/readYaml.nf' +def readYaml(file_path) { + def inputFile = file_path !instanceof Path ? file(file_path, hidden: true) : file_path + def yamlSlurper = new org.yaml.snakeyaml.Yaml() + yamlSlurper.load(inputFile) +} + +// helper file: 'src/main/resources/io/viash/runners/nextflow/readwrite/readYamlBlob.nf' +def readYamlBlob(str) { + def yamlSlurper = new org.yaml.snakeyaml.Yaml() + yamlSlurper.load(str) +} + +// helper file: 'src/main/resources/io/viash/runners/nextflow/readwrite/toJsonBlob.nf' +String toJsonBlob(data) { + return groovy.json.JsonOutput.toJson(data) +} + +// helper file: 'src/main/resources/io/viash/runners/nextflow/readwrite/toTaggedYamlBlob.nf' +// Custom representer to modify how certain objects are represented in YAML +class CustomRepresenter extends org.yaml.snakeyaml.representer.Representer { + Path relativizer + + class RepresentPath implements org.yaml.snakeyaml.representer.Represent { + public String getFileName(Object obj) { + if (obj instanceof File) { + obj = ((File) obj).toPath(); + } + if (obj !instanceof Path) { + throw new IllegalArgumentException("Object: " + obj + " is not a Path or File"); + } + def path = (Path) obj; + + if (relativizer != null) { + return relativizer.relativize(path).toString() + } else { + return path.toString() + } + } + + public org.yaml.snakeyaml.nodes.Node representData(Object data) { + String filename = getFileName(data); + def tag = new org.yaml.snakeyaml.nodes.Tag("!file"); + return representScalar(tag, filename); + } + } + CustomRepresenter(org.yaml.snakeyaml.DumperOptions options, Path relativizer) { + super(options) + this.relativizer = relativizer + this.representers.put(sun.nio.fs.UnixPath, new RepresentPath()) + this.representers.put(Path, new RepresentPath()) + this.representers.put(File, new RepresentPath()) + } +} + +String toTaggedYamlBlob(data) { + return toRelativeTaggedYamlBlob(data, null) +} +String toRelativeTaggedYamlBlob(data, Path relativizer) { + def options = new org.yaml.snakeyaml.DumperOptions() + options.setDefaultFlowStyle(org.yaml.snakeyaml.DumperOptions.FlowStyle.BLOCK) + def representer = new CustomRepresenter(options, relativizer) + def yaml = new org.yaml.snakeyaml.Yaml(representer, options) + return yaml.dump(data) +} + +// helper file: 'src/main/resources/io/viash/runners/nextflow/readwrite/toYamlBlob.nf' +String toYamlBlob(data) { + def options = new org.yaml.snakeyaml.DumperOptions() + options.setDefaultFlowStyle(org.yaml.snakeyaml.DumperOptions.FlowStyle.BLOCK) + options.setPrettyFlow(true) + def yaml = new org.yaml.snakeyaml.Yaml(options) + def cleanData = iterateMap(data, { it instanceof Path ? it.toString() : it }) + return yaml.dump(cleanData) +} + +// helper file: 'src/main/resources/io/viash/runners/nextflow/readwrite/writeJson.nf' +void writeJson(data, file) { + assert data: "writeJson: data should not be null" + assert file: "writeJson: file should not be null" + file.write(toJsonBlob(data)) +} + +// helper file: 'src/main/resources/io/viash/runners/nextflow/readwrite/writeYaml.nf' +void writeYaml(data, file) { + assert data: "writeYaml: data should not be null" + assert file: "writeYaml: file should not be null" + file.write(toYamlBlob(data)) +} + +// helper file: 'src/main/resources/io/viash/runners/nextflow/states/findStates.nf' +def findStates(Map params, Map config) { + def auto_config = deepClone(config) + def auto_params = deepClone(params) + + auto_config = auto_config.clone() + // override arguments + auto_config.argument_groups = [] + auto_config.arguments = [ + [ + type: "string", + name: "--id", + description: "A dummy identifier", + required: false + ], + [ + type: "file", + name: "--input_states", + example: "/path/to/input/directory/**/state.yaml", + description: "Path to input directory containing the datasets to be integrated.", + required: true, + multiple: true, + multiple_sep: ";" + ], + [ + type: "string", + name: "--filter", + example: "foo/.*/state.yaml", + description: "Regex to filter state files by path.", + required: false + ], + // to do: make this a yaml blob? + [ + type: "string", + name: "--rename_keys", + example: ["newKey1:oldKey1", "newKey2:oldKey2"], + description: "Rename keys in the detected input files. This is useful if the input files do not match the set of input arguments of the workflow.", + required: false, + multiple: true, + multiple_sep: ";" + ], + [ + type: "string", + name: "--settings", + example: '{"output_dataset": "dataset.h5ad", "k": 10}', + description: "Global arguments as a JSON glob to be passed to all components.", + required: false + ] + ] + if (!(auto_params.containsKey("id"))) { + auto_params["id"] = "auto" + } + + // run auto config through processConfig once more + auto_config = processConfig(auto_config) + + workflow findStatesWf { + helpMessage(auto_config) + + output_ch = + channelFromParams(auto_params, auto_config) + | flatMap { autoId, args -> + + def globalSettings = args.settings ? readYamlBlob(args.settings) : [:] + + // look for state files in input dir + def stateFiles = args.input_states + + // filter state files by regex + if (args.filter) { + stateFiles = stateFiles.findAll{ stateFile -> + def stateFileStr = stateFile.toString() + def matcher = stateFileStr =~ args.filter + matcher.matches()} + } + + // read in states + def states = stateFiles.collect { stateFile -> + def state_ = readTaggedYaml(stateFile) + [state_.id, state_] + } + + // construct renameMap + if (args.rename_keys) { + def renameMap = args.rename_keys.collectEntries{renameString -> + def split = renameString.split(":") + assert split.size() == 2: "Argument 'rename_keys' should be of the form 'newKey:oldKey', or 'newKey:oldKey;newKey:oldKey' in case of multiple values" + split + } + + // rename keys in state, only let states through which have all keys + // also add global settings + states = states.collectMany{id, state -> + def newState = [:] + + for (key in renameMap.keySet()) { + def origKey = renameMap[key] + if (!(state.containsKey(origKey))) { + return [] + } + newState[key] = state[origKey] + } + + [[id, globalSettings + newState]] + } + } + + states + } + emit: + output_ch + } + + return findStatesWf +} + +// helper file: 'src/main/resources/io/viash/runners/nextflow/states/joinStates.nf' +def joinStates(Closure apply_) { + workflow joinStatesWf { + take: input_ch + main: + output_ch = input_ch + | toSortedList + | filter{ it.size() > 0 } + | map{ tups -> + def ids = tups.collect{it[0]} + def states = tups.collect{it[1]} + apply_(ids, states) + } + + emit: output_ch + } + return joinStatesWf +} +// helper file: 'src/main/resources/io/viash/runners/nextflow/states/publishFiles.nf' +def publishFiles(Map args) { + def key_ = args.get("key") + + assert key_ != null : "publishFiles: key must be specified" + + workflow publishFilesWf { + take: input_ch + main: + input_ch + | map { tup -> + def id_ = tup[0] + def state_ = tup[1] + + // the input files and the target output filenames + def inputoutputFilenames_ = collectInputOutputPaths(state_, id_ + "." + key_).transpose() + def inputFiles_ = inputoutputFilenames_[0] + def outputFilenames_ = inputoutputFilenames_[1] + + [id_, inputFiles_, outputFilenames_] + } + | publishFilesProc + emit: input_ch + } + return publishFilesWf +} + +process publishFilesProc { + // todo: check publishpath? + publishDir path: "${getPublishDir()}/", mode: "copy" + tag "$id" + input: + tuple val(id), path(inputFiles, stageAs: "_inputfile?/*"), val(outputFiles) + output: + tuple val(id), path{outputFiles} + script: + def copyCommands = [ + inputFiles instanceof List ? inputFiles : [inputFiles], + outputFiles instanceof List ? outputFiles : [outputFiles] + ] + .transpose() + .collectMany{infile, outfile -> + def infileString = infile.toString() + def outfileString = outfile.toString() + if (infileString != outfileString) { + /* Trailing slashes are removed from both the source and destination arguments. + From source arguments, this is useful when a source argument may have a trailing slash + and specify a symbolic link to a directory. Without removing the slash, cp will dereference + the symbolic link. + See https://www.gnu.org/software/coreutils/manual/html_node/Trailing-slashes.html#Trailing-slashes-1 + + For the destination path addding a trailing slash is a problem when publishing directories: + it requires the destination directory to exist. This fails because we only create the parent + directories first. + */ + def regexTrailingSlashes = ~/\/+$/ + def infileNoTrailingSlash = infileString - regexTrailingSlashes + def outfileNoTrailingSlash = outfileString - regexTrailingSlashes + [ + "[ -d \"\$(dirname '${outfileNoTrailingSlash}')\" ] || mkdir -p \"\$(dirname '${outfileNoTrailingSlash}')\"", + "cp -a '${infileNoTrailingSlash}' '${outfileNoTrailingSlash}'" + ] + } else { + // no need to copy if infile is the same as outfile + [] + } + } + """ + echo "Copying output files to destination folder" + ${copyCommands.join("\n ")} + """ +} + + +// this assumes that the state contains no other values other than those specified in the config +def publishFilesByConfig(Map args) { + def config = args.get("config") + assert config != null : "publishFilesByConfig: config must be specified" + + def key_ = args.get("key", config.name) + assert key_ != null : "publishFilesByConfig: key must be specified" + + workflow publishFilesSimpleWf { + take: input_ch + main: + input_ch + | map { tup -> + def id_ = tup[0] + def state_ = tup[1] // e.g. [output: new File("myoutput.h5ad"), k: 10] + def origState_ = tup[2] // e.g. [output: '$id.$key.foo.h5ad'] + + + // the processed state is a list of [key, value, inputPath, outputFilename] tuples, where + // - key is a String + // - value is any object that can be serialized to a Yaml (so a String/Integer/Long/Double/Boolean, a List, a Map, or a Path) + // - inputPath is a List[Path] + // - outputFilename is a List[String] + // - (inputPath, outputFilename) are the files that will be copied from src to dest (relative to the state.yaml) + def processedState = + config.allArguments + .findAll { it.direction == "output" } + .collectMany { par -> + def plainName_ = par.plainName + // if the state does not contain the key, it's an + // optional argument for which the component did + // not generate any output OR multiple channels were emitted + // and the output was just not added to using the channel + // that is now being parsed + if (!state_.containsKey(plainName_)) { + return [] + } + def value = state_[plainName_] + // if the parameter is not a file, it should be stored + // in the state as-is, but is not something that needs + // to be copied from the source path to the dest path + if (par.type != "file") { + return [[inputPath: [], outputFilename: []]] + } + // if the orig state does not contain this filename, + // it's an optional argument for which the user specified + // that it should not be returned as a state + if (!origState_.containsKey(plainName_)) { + return [] + } + def filenameTemplate = origState_[plainName_] + // if the pararameter is multiple: true, fetch the template + if (par.multiple && filenameTemplate instanceof List) { + filenameTemplate = filenameTemplate[0] + } + // instantiate the template + def filename = filenameTemplate + .replaceAll('\\$id', id_) + .replaceAll('\\$\\{id\\}', id_) + .replaceAll('\\$key', key_) + .replaceAll('\\$\\{key\\}', key_) + if (par.multiple) { + // if the parameter is multiple: true, the filename + // should contain a wildcard '*' that is replaced with + // the index of the file + assert filename.contains("*") : "Module '${key_}' id '${id_}': Multiple output files specified, but no wildcard '*' in the filename: ${filename}" + def outputPerFile = value.withIndex().collect{ val, ix -> + def filename_ix = filename.replace("*", ix.toString()) + def inputPath = val instanceof File ? val.toPath() : val + [inputPath: inputPath, outputFilename: filename_ix] + } + def transposedOutputs = ["inputPath", "outputFilename"].collectEntries{ key -> + [key, outputPerFile.collect{dic -> dic[key]}] + } + return [[key: plainName_] + transposedOutputs] + } else { + def value_ = java.nio.file.Paths.get(filename) + def inputPath = value instanceof File ? value.toPath() : value + return [[inputPath: [inputPath], outputFilename: [filename]]] + } + } + + def inputPaths = processedState.collectMany{it.inputPath} + def outputFilenames = processedState.collectMany{it.outputFilename} + + + [id_, inputPaths, outputFilenames] + } + | publishFilesProc + emit: input_ch + } + return publishFilesSimpleWf +} + + + + +// helper file: 'src/main/resources/io/viash/runners/nextflow/states/publishStates.nf' +def collectFiles(obj) { + if (obj instanceof java.io.File || obj instanceof Path) { + return [obj] + } else if (obj instanceof List && obj !instanceof String) { + return obj.collectMany{item -> + collectFiles(item) + } + } else if (obj instanceof Map) { + return obj.collectMany{key, item -> + collectFiles(item) + } + } else { + return [] + } +} + +/** + * Recurse through a state and collect all input files and their target output filenames. + * @param obj The state to recurse through. + * @param prefix The prefix to prepend to the output filenames. + */ +def collectInputOutputPaths(obj, prefix) { + if (obj instanceof File || obj instanceof Path) { + def path = obj instanceof Path ? obj : obj.toPath() + def ext = path.getFileName().toString().find("\\.[^\\.]+\$") ?: "" + def newFilename = prefix + ext + return [[obj, newFilename]] + } else if (obj instanceof List && obj !instanceof String) { + return obj.withIndex().collectMany{item, ix -> + collectInputOutputPaths(item, prefix + "_" + ix) + } + } else if (obj instanceof Map) { + return obj.collectMany{key, item -> + collectInputOutputPaths(item, prefix + "." + key) + } + } else { + return [] + } +} + +def publishStates(Map args) { + def key_ = args.get("key") + def yamlTemplate_ = args.get("output_state", args.get("outputState", '$id.$key.state.yaml')) + + assert key_ != null : "publishStates: key must be specified" + + workflow publishStatesWf { + take: input_ch + main: + input_ch + | map { tup -> + def id_ = tup[0] + def state_ = tup[1] + + // the input files and the target output filenames + def inputoutputFilenames_ = collectInputOutputPaths(state_, id_ + "." + key_).transpose() + + def yamlFilename = yamlTemplate_ + .replaceAll('\\$id', id_) + .replaceAll('\\$\\{id\\}', id_) + .replaceAll('\\$key', key_) + .replaceAll('\\$\\{key\\}', key_) + + // TODO: do the pathnames in state_ match up with the outputFilenames_? + + // convert state to yaml blob + def yamlBlob_ = toRelativeTaggedYamlBlob([id: id_] + state_, java.nio.file.Paths.get(yamlFilename)) + + [id_, yamlBlob_, yamlFilename] + } + | publishStatesProc + emit: input_ch + } + return publishStatesWf +} +process publishStatesProc { + // todo: check publishpath? + publishDir path: "${getPublishDir()}/", mode: "copy" + tag "$id" + input: + tuple val(id), val(yamlBlob), val(yamlFile) + output: + tuple val(id), path{[yamlFile]} + script: + """ + mkdir -p "\$(dirname '${yamlFile}')" + echo "Storing state as yaml" + cat > '${yamlFile}' << HERE +${yamlBlob} +HERE + """ +} + + +// this assumes that the state contains no other values other than those specified in the config +def publishStatesByConfig(Map args) { + def config = args.get("config") + assert config != null : "publishStatesByConfig: config must be specified" + + def key_ = args.get("key", config.name) + assert key_ != null : "publishStatesByConfig: key must be specified" + + workflow publishStatesSimpleWf { + take: input_ch + main: + input_ch + | map { tup -> + def id_ = tup[0] + def state_ = tup[1] // e.g. [output: new File("myoutput.h5ad"), k: 10] + def origState_ = tup[2] // e.g. [output: '$id.$key.foo.h5ad'] + + // TODO: allow overriding the state.yaml template + // TODO TODO: if auto.publish == "state", add output_state as an argument + def yamlTemplate = params.containsKey("output_state") ? params.output_state : '$id.$key.state.yaml' + def yamlFilename = yamlTemplate + .replaceAll('\\$id', id_) + .replaceAll('\\$\\{id\\}', id_) + .replaceAll('\\$key', key_) + .replaceAll('\\$\\{key\\}', key_) + def yamlDir = java.nio.file.Paths.get(yamlFilename).getParent() + + // the processed state is a list of [key, value] tuples, where + // - key is a String + // - value is any object that can be serialized to a Yaml (so a String/Integer/Long/Double/Boolean, a List, a Map, or a Path) + // - (key, value) are the tuples that will be saved to the state.yaml file + def processedState = + config.allArguments + .findAll { it.direction == "output" } + .collectMany { par -> + def plainName_ = par.plainName + // if the state does not contain the key, it's an + // optional argument for which the component did + // not generate any output + if (!state_.containsKey(plainName_)) { + return [] + } + def value = state_[plainName_] + // if the parameter is not a file, it should be stored + // in the state as-is, but is not something that needs + // to be copied from the source path to the dest path + if (par.type != "file") { + return [[key: plainName_, value: value]] + } + // if the orig state does not contain this filename, + // it's an optional argument for which the user specified + // that it should not be returned as a state + if (!origState_.containsKey(plainName_)) { + return [] + } + def filenameTemplate = origState_[plainName_] + // if the pararameter is multiple: true, fetch the template + if (par.multiple && filenameTemplate instanceof List) { + filenameTemplate = filenameTemplate[0] + } + // instantiate the template + def filename = filenameTemplate + .replaceAll('\\$id', id_) + .replaceAll('\\$\\{id\\}', id_) + .replaceAll('\\$key', key_) + .replaceAll('\\$\\{key\\}', key_) + if (par.multiple) { + // if the parameter is multiple: true, the filename + // should contain a wildcard '*' that is replaced with + // the index of the file + assert filename.contains("*") : "Module '${key_}' id '${id_}': Multiple output files specified, but no wildcard '*' in the filename: ${filename}" + def outputPerFile = value.withIndex().collect{ val, ix -> + def filename_ix = filename.replace("*", ix.toString()) + def value_ = java.nio.file.Paths.get(filename_ix) + // if id contains a slash + if (yamlDir != null) { + value_ = yamlDir.relativize(value_) + } + return value_ + } + return [["key": plainName_, "value": outputPerFile]] + } else { + def value_ = java.nio.file.Paths.get(filename) + // if id contains a slash + if (yamlDir != null) { + value_ = yamlDir.relativize(value_) + } + def inputPath = value instanceof File ? value.toPath() : value + return [["key": plainName_, value: value_]] + } + } + + + def updatedState_ = processedState.collectEntries{[it.key, it.value]} + + // convert state to yaml blob + def yamlBlob_ = toTaggedYamlBlob([id: id_] + updatedState_) + + [id_, yamlBlob_, yamlFilename] + } + | publishStatesProc + emit: input_ch + } + return publishStatesSimpleWf +} + +// helper file: 'src/main/resources/io/viash/runners/nextflow/states/setState.nf' +def setState(fun) { + assert fun instanceof Closure || fun instanceof Map || fun instanceof List : + "Error in setState: Expected process argument to be a Closure, a Map, or a List. Found: class ${fun.getClass()}" + + // if fun is a List, convert to map + if (fun instanceof List) { + // check whether fun is a list[string] + assert fun.every{it instanceof CharSequence} : "Error in setState: argument is a List, but not all elements are Strings" + fun = fun.collectEntries{[it, it]} + } + + // if fun is a map, convert to closure + if (fun instanceof Map) { + // check whether fun is a map[string, string] + assert fun.values().every{it instanceof CharSequence} : "Error in setState: argument is a Map, but not all values are Strings" + assert fun.keySet().every{it instanceof CharSequence} : "Error in setState: argument is a Map, but not all keys are Strings" + def funMap = fun.clone() + // turn the map into a closure to be used later on + fun = { id_, state_ -> + assert state_ instanceof Map : "Error in setState: the state is not a Map" + funMap.collectMany{newkey, origkey -> + if (state_.containsKey(origkey)) { + [[newkey, state_[origkey]]] + } else { + [] + } + }.collectEntries() + } + } + + map { tup -> + def id = tup[0] + def state = tup[1] + def unfilteredState = fun(id, state) + def newState = unfilteredState.findAll{key, val -> val != null} + [id, newState] + tup.drop(2) + } +} + +// helper file: 'src/main/resources/io/viash/runners/nextflow/workflowFactory/processAuto.nf' +// TODO: unit test processAuto +def processAuto(Map auto) { + // remove null values + auto = auto.findAll{k, v -> v != null} + + // check for unexpected keys + def expectedKeys = ["simplifyInput", "simplifyOutput", "transcript", "publish"] + def unexpectedKeys = auto.keySet() - expectedKeys + assert unexpectedKeys.isEmpty(), "unexpected keys in auto: '${unexpectedKeys.join("', '")}'" + + // check auto.simplifyInput + assert auto.simplifyInput instanceof Boolean, "auto.simplifyInput must be a boolean" + + // check auto.simplifyOutput + assert auto.simplifyOutput instanceof Boolean, "auto.simplifyOutput must be a boolean" + + // check auto.transcript + assert auto.transcript instanceof Boolean, "auto.transcript must be a boolean" + + // check auto.publish + assert auto.publish instanceof Boolean || auto.publish == "state", "auto.publish must be a boolean or 'state'" + + return auto.subMap(expectedKeys) +} + +// helper file: 'src/main/resources/io/viash/runners/nextflow/workflowFactory/processDirectives.nf' +def assertMapKeys(map, expectedKeys, requiredKeys, mapName) { + assert map instanceof Map : "Expected argument '$mapName' to be a Map. Found: class ${map.getClass()}" + map.forEach { key, val -> + assert key in expectedKeys : "Unexpected key '$key' in ${mapName ? mapName + " " : ""}map" + } + requiredKeys.forEach { requiredKey -> + assert map.containsKey(requiredKey) : "Missing required key '$key' in ${mapName ? mapName + " " : ""}map" + } +} + +// TODO: unit test processDirectives +def processDirectives(Map drctv) { + // remove null values + drctv = drctv.findAll{k, v -> v != null} + + // check for unexpected keys + def expectedKeys = [ + "accelerator", "afterScript", "beforeScript", "cache", "conda", "container", "containerOptions", "cpus", "disk", "echo", "errorStrategy", "executor", "machineType", "maxErrors", "maxForks", "maxRetries", "memory", "module", "penv", "pod", "publishDir", "queue", "label", "scratch", "storeDir", "stageInMode", "stageOutMode", "tag", "time" + ] + def unexpectedKeys = drctv.keySet() - expectedKeys + assert unexpectedKeys.isEmpty() : "Unexpected keys in process directive: '${unexpectedKeys.join("', '")}'" + + /* DIRECTIVE accelerator + accepted examples: + - [ limit: 4, type: "nvidia-tesla-k80" ] + */ + if (drctv.containsKey("accelerator")) { + assertMapKeys(drctv["accelerator"], ["type", "limit", "request", "runtime"], [], "accelerator") + } + + /* DIRECTIVE afterScript + accepted examples: + - "source /cluster/bin/cleanup" + */ + if (drctv.containsKey("afterScript")) { + assert drctv["afterScript"] instanceof CharSequence + } + + /* DIRECTIVE beforeScript + accepted examples: + - "source /cluster/bin/setup" + */ + if (drctv.containsKey("beforeScript")) { + assert drctv["beforeScript"] instanceof CharSequence + } + + /* DIRECTIVE cache + accepted examples: + - true + - false + - "deep" + - "lenient" + */ + if (drctv.containsKey("cache")) { + assert drctv["cache"] instanceof CharSequence || drctv["cache"] instanceof Boolean + if (drctv["cache"] instanceof CharSequence) { + assert drctv["cache"] in ["deep", "lenient"] : "Unexpected value for cache" + } + } + + /* DIRECTIVE conda + accepted examples: + - "bwa=0.7.15" + - "bwa=0.7.15 fastqc=0.11.5" + - ["bwa=0.7.15", "fastqc=0.11.5"] + */ + if (drctv.containsKey("conda")) { + if (drctv["conda"] instanceof List) { + drctv["conda"] = drctv["conda"].join(" ") + } + assert drctv["conda"] instanceof CharSequence + } + + /* DIRECTIVE container + accepted examples: + - "foo/bar:tag" + - [ registry: "reg", image: "im", tag: "ta" ] + is transformed to "reg/im:ta" + - [ image: "im" ] + is transformed to "im:latest" + */ + if (drctv.containsKey("container")) { + assert drctv["container"] instanceof Map || drctv["container"] instanceof CharSequence + if (drctv["container"] instanceof Map) { + def m = drctv["container"] + assertMapKeys(m, [ "registry", "image", "tag" ], ["image"], "container") + def part1 = + System.getenv('OVERRIDE_CONTAINER_REGISTRY') ? System.getenv('OVERRIDE_CONTAINER_REGISTRY') + "/" : + params.containsKey("override_container_registry") ? params["override_container_registry"] + "/" : // todo: remove? + m.registry ? m.registry + "/" : + "" + def part2 = m.image + def part3 = m.tag ? ":" + m.tag : ":latest" + drctv["container"] = part1 + part2 + part3 + } + } + + /* DIRECTIVE containerOptions + accepted examples: + - "--foo bar" + - ["--foo bar", "-f b"] + */ + if (drctv.containsKey("containerOptions")) { + if (drctv["containerOptions"] instanceof List) { + drctv["containerOptions"] = drctv["containerOptions"].join(" ") + } + assert drctv["containerOptions"] instanceof CharSequence + } + + /* DIRECTIVE cpus + accepted examples: + - 1 + - 10 + */ + if (drctv.containsKey("cpus")) { + assert drctv["cpus"] instanceof Integer + } + + /* DIRECTIVE disk + accepted examples: + - "1 GB" + - "2TB" + - "3.2KB" + - "10.B" + */ + if (drctv.containsKey("disk")) { + assert drctv["disk"] instanceof CharSequence + // assert drctv["disk"].matches("[0-9]+(\\.[0-9]*)? *[KMGTPEZY]?B") + // ^ does not allow closures + } + + /* DIRECTIVE echo + accepted examples: + - true + - false + */ + if (drctv.containsKey("echo")) { + assert drctv["echo"] instanceof Boolean + } + + /* DIRECTIVE errorStrategy + accepted examples: + - "terminate" + - "finish" + */ + if (drctv.containsKey("errorStrategy")) { + assert drctv["errorStrategy"] instanceof CharSequence + assert drctv["errorStrategy"] in ["terminate", "finish", "ignore", "retry"] : "Unexpected value for errorStrategy" + } + + /* DIRECTIVE executor + accepted examples: + - "local" + - "sge" + */ + if (drctv.containsKey("executor")) { + assert drctv["executor"] instanceof CharSequence + assert drctv["executor"] in ["local", "sge", "uge", "lsf", "slurm", "pbs", "pbspro", "moab", "condor", "nqsii", "ignite", "k8s", "awsbatch", "google-pipelines"] : "Unexpected value for executor" + } + + /* DIRECTIVE machineType + accepted examples: + - "n1-highmem-8" + */ + if (drctv.containsKey("machineType")) { + assert drctv["machineType"] instanceof CharSequence + } + + /* DIRECTIVE maxErrors + accepted examples: + - 1 + - 3 + */ + if (drctv.containsKey("maxErrors")) { + assert drctv["maxErrors"] instanceof Integer + } + + /* DIRECTIVE maxForks + accepted examples: + - 1 + - 3 + */ + if (drctv.containsKey("maxForks")) { + assert drctv["maxForks"] instanceof Integer + } + + /* DIRECTIVE maxRetries + accepted examples: + - 1 + - 3 + */ + if (drctv.containsKey("maxRetries")) { + assert drctv["maxRetries"] instanceof Integer + } + + /* DIRECTIVE memory + accepted examples: + - "1 GB" + - "2TB" + - "3.2KB" + - "10.B" + */ + if (drctv.containsKey("memory")) { + assert drctv["memory"] instanceof CharSequence + // assert drctv["memory"].matches("[0-9]+(\\.[0-9]*)? *[KMGTPEZY]?B") + // ^ does not allow closures + } + + /* DIRECTIVE module + accepted examples: + - "ncbi-blast/2.2.27" + - "ncbi-blast/2.2.27:t_coffee/10.0" + - ["ncbi-blast/2.2.27", "t_coffee/10.0"] + */ + if (drctv.containsKey("module")) { + if (drctv["module"] instanceof List) { + drctv["module"] = drctv["module"].join(":") + } + assert drctv["module"] instanceof CharSequence + } + + /* DIRECTIVE penv + accepted examples: + - "smp" + */ + if (drctv.containsKey("penv")) { + assert drctv["penv"] instanceof CharSequence + } + + /* DIRECTIVE pod + accepted examples: + - [ label: "key", value: "val" ] + - [ annotation: "key", value: "val" ] + - [ env: "key", value: "val" ] + - [ [label: "l", value: "v"], [env: "e", value: "v"]] + */ + if (drctv.containsKey("pod")) { + if (drctv["pod"] instanceof Map) { + drctv["pod"] = [ drctv["pod"] ] + } + assert drctv["pod"] instanceof List + drctv["pod"].forEach { pod -> + assert pod instanceof Map + // TODO: should more checks be added? + // See https://www.nextflow.io/docs/latest/process.html?highlight=directives#pod + // e.g. does it contain 'label' and 'value', or 'annotation' and 'value', or ...? + } + } + + /* DIRECTIVE publishDir + accepted examples: + - [] + - [ [ path: "foo", enabled: true ], [ path: "bar", enabled: false ] ] + - "/path/to/dir" + is transformed to [[ path: "/path/to/dir" ]] + - [ path: "/path/to/dir", mode: "cache" ] + is transformed to [[ path: "/path/to/dir", mode: "cache" ]] + */ + // TODO: should we also look at params["publishDir"]? + if (drctv.containsKey("publishDir")) { + def pblsh = drctv["publishDir"] + + // check different options + assert pblsh instanceof List || pblsh instanceof Map || pblsh instanceof CharSequence + + // turn into list if not already so + // for some reason, 'if (!pblsh instanceof List) pblsh = [ pblsh ]' doesn't work. + pblsh = pblsh instanceof List ? pblsh : [ pblsh ] + + // check elements of publishDir + pblsh = pblsh.collect{ elem -> + // turn into map if not already so + elem = elem instanceof CharSequence ? [ path: elem ] : elem + + // check types and keys + assert elem instanceof Map : "Expected publish argument '$elem' to be a String or a Map. Found: class ${elem.getClass()}" + assertMapKeys(elem, [ "path", "mode", "overwrite", "pattern", "saveAs", "enabled" ], ["path"], "publishDir") + + // check elements in map + assert elem.containsKey("path") + assert elem["path"] instanceof CharSequence + if (elem.containsKey("mode")) { + assert elem["mode"] instanceof CharSequence + assert elem["mode"] in [ "symlink", "rellink", "link", "copy", "copyNoFollow", "move" ] + } + if (elem.containsKey("overwrite")) { + assert elem["overwrite"] instanceof Boolean + } + if (elem.containsKey("pattern")) { + assert elem["pattern"] instanceof CharSequence + } + if (elem.containsKey("saveAs")) { + assert elem["saveAs"] instanceof CharSequence //: "saveAs as a Closure is currently not supported. Surround your closure with single quotes to get the desired effect. Example: '\{ foo \}'" + } + if (elem.containsKey("enabled")) { + assert elem["enabled"] instanceof Boolean + } + + // return final result + elem + } + // store final directive + drctv["publishDir"] = pblsh + } + + /* DIRECTIVE queue + accepted examples: + - "long" + - "short,long" + - ["short", "long"] + */ + if (drctv.containsKey("queue")) { + if (drctv["queue"] instanceof List) { + drctv["queue"] = drctv["queue"].join(",") + } + assert drctv["queue"] instanceof CharSequence + } + + /* DIRECTIVE label + accepted examples: + - "big_mem" + - "big_cpu" + - ["big_mem", "big_cpu"] + */ + if (drctv.containsKey("label")) { + if (drctv["label"] instanceof CharSequence) { + drctv["label"] = [ drctv["label"] ] + } + assert drctv["label"] instanceof List + drctv["label"].forEach { label -> + assert label instanceof CharSequence + // assert label.matches("[a-zA-Z0-9]([a-zA-Z0-9_]*[a-zA-Z0-9])?") + // ^ does not allow closures + } + } + + /* DIRECTIVE scratch + accepted examples: + - true + - "/path/to/scratch" + - '$MY_PATH_TO_SCRATCH' + - "ram-disk" + */ + if (drctv.containsKey("scratch")) { + assert drctv["scratch"] == true || drctv["scratch"] instanceof CharSequence + } + + /* DIRECTIVE storeDir + accepted examples: + - "/path/to/storeDir" + */ + if (drctv.containsKey("storeDir")) { + assert drctv["storeDir"] instanceof CharSequence + } + + /* DIRECTIVE stageInMode + accepted examples: + - "copy" + - "link" + */ + if (drctv.containsKey("stageInMode")) { + assert drctv["stageInMode"] instanceof CharSequence + assert drctv["stageInMode"] in ["copy", "link", "symlink", "rellink"] + } + + /* DIRECTIVE stageOutMode + accepted examples: + - "copy" + - "link" + */ + if (drctv.containsKey("stageOutMode")) { + assert drctv["stageOutMode"] instanceof CharSequence + assert drctv["stageOutMode"] in ["copy", "move", "rsync"] + } + + /* DIRECTIVE tag + accepted examples: + - "foo" + - '$id' + */ + if (drctv.containsKey("tag")) { + assert drctv["tag"] instanceof CharSequence + } + + /* DIRECTIVE time + accepted examples: + - "1h" + - "2days" + - "1day 6hours 3minutes 30seconds" + */ + if (drctv.containsKey("time")) { + assert drctv["time"] instanceof CharSequence + // todo: validation regex? + } + + return drctv +} + +// helper file: 'src/main/resources/io/viash/runners/nextflow/workflowFactory/processWorkflowArgs.nf' +def processWorkflowArgs(Map args, Map defaultWfArgs, Map meta) { + // override defaults with args + def workflowArgs = defaultWfArgs + args + + // check whether 'key' exists + assert workflowArgs.containsKey("key") : "Error in module '${meta.config.name}': key is a required argument" + + // if 'key' is a closure, apply it to the original key + if (workflowArgs["key"] instanceof Closure) { + workflowArgs["key"] = workflowArgs["key"](meta.config.name) + } + def key = workflowArgs["key"] + assert key instanceof CharSequence : "Expected process argument 'key' to be a String. Found: class ${key.getClass()}" + assert key ==~ /^[a-zA-Z_]\w*$/ : "Error in module '$key': Expected process argument 'key' to consist of only letters, digits or underscores. Found: ${key}" + + // check for any unexpected keys + def expectedKeys = ["key", "directives", "auto", "map", "mapId", "mapData", "mapPassthrough", "filter", "runIf", "fromState", "toState", "args", "renameKeys", "debug"] + def unexpectedKeys = workflowArgs.keySet() - expectedKeys + assert unexpectedKeys.isEmpty() : "Error in module '$key': unexpected arguments to the '.run()' function: '${unexpectedKeys.join("', '")}'" + + // check whether directives exists and apply defaults + assert workflowArgs.containsKey("directives") : "Error in module '$key': directives is a required argument" + assert workflowArgs["directives"] instanceof Map : "Error in module '$key': Expected process argument 'directives' to be a Map. Found: class ${workflowArgs['directives'].getClass()}" + workflowArgs["directives"] = processDirectives(defaultWfArgs.directives + workflowArgs["directives"]) + + // check whether directives exists and apply defaults + assert workflowArgs.containsKey("auto") : "Error in module '$key': auto is a required argument" + assert workflowArgs["auto"] instanceof Map : "Error in module '$key': Expected process argument 'auto' to be a Map. Found: class ${workflowArgs['auto'].getClass()}" + workflowArgs["auto"] = processAuto(defaultWfArgs.auto + workflowArgs["auto"]) + + // auto define publish, if so desired + if (workflowArgs.auto.publish == true && (workflowArgs.directives.publishDir != null ? workflowArgs.directives.publishDir : [:]).isEmpty()) { + // can't assert at this level thanks to the no_publish profile + // assert params.containsKey("publishDir") || params.containsKey("publish_dir") : + // "Error in module '${workflowArgs['key']}': if auto.publish is true, params.publish_dir needs to be defined.\n" + + // " Example: params.publish_dir = \"./output/\"" + def publishDir = getPublishDir() + + if (publishDir != null) { + workflowArgs.directives.publishDir = [[ + path: publishDir, + saveAs: "{ it.startsWith('.') ? null : it }", // don't publish hidden files, by default + mode: "copy" + ]] + } + } + + // auto define transcript, if so desired + if (workflowArgs.auto.transcript == true) { + // can't assert at this level thanks to the no_publish profile + // assert params.containsKey("transcriptsDir") || params.containsKey("transcripts_dir") || params.containsKey("publishDir") || params.containsKey("publish_dir") : + // "Error in module '${workflowArgs['key']}': if auto.transcript is true, either params.transcripts_dir or params.publish_dir needs to be defined.\n" + + // " Example: params.transcripts_dir = \"./transcripts/\"" + def transcriptsDir = + params.containsKey("transcripts_dir") ? params.transcripts_dir : + params.containsKey("transcriptsDir") ? params.transcriptsDir : + params.containsKey("publish_dir") ? params.publish_dir + "/_transcripts" : + params.containsKey("publishDir") ? params.publishDir + "/_transcripts" : + null + if (transcriptsDir != null) { + def timestamp = nextflow.Nextflow.getSession().getWorkflowMetadata().start.format('yyyy-MM-dd_HH-mm-ss') + def transcriptsPublishDir = [ + path: "$transcriptsDir/$timestamp/\${task.process.replaceAll(':', '-')}/\${id}/", + saveAs: "{ it.startsWith('.') ? it.replaceAll('^.', '') : null }", + mode: "copy" + ] + def publishDirs = workflowArgs.directives.publishDir != null ? workflowArgs.directives.publishDir : null ? workflowArgs.directives.publishDir : [] + workflowArgs.directives.publishDir = publishDirs + transcriptsPublishDir + } + } + + // if this is a stubrun, remove certain directives? + if (workflow.stubRun) { + workflowArgs.directives.keySet().removeAll(["publishDir", "cpus", "memory", "label"]) + } + + for (nam in ["map", "mapId", "mapData", "mapPassthrough", "filter", "runIf"]) { + if (workflowArgs.containsKey(nam) && workflowArgs[nam]) { + assert workflowArgs[nam] instanceof Closure : "Error in module '$key': Expected process argument '$nam' to be null or a Closure. Found: class ${workflowArgs[nam].getClass()}" + } + } + + // TODO: should functions like 'map', 'mapId', 'mapData', 'mapPassthrough' be deprecated as well? + for (nam in ["map", "mapData", "mapPassthrough", "renameKeys"]) { + if (workflowArgs.containsKey(nam) && workflowArgs[nam] != null) { + log.warn "module '$key': workflow argument '$nam' is deprecated and will be removed in Viash 0.9.0. Please use 'fromState' and 'toState' instead." + } + } + + // check fromState + workflowArgs["fromState"] = _processFromState(workflowArgs.get("fromState"), key, meta.config) + + // check toState + workflowArgs["toState"] = _processToState(workflowArgs.get("toState"), key, meta.config) + + // return output + return workflowArgs +} + +def _processFromState(fromState, key_, config_) { + assert fromState == null || fromState instanceof Closure || fromState instanceof Map || fromState instanceof List : + "Error in module '$key_': Expected process argument 'fromState' to be null, a Closure, a Map, or a List. Found: class ${fromState.getClass()}" + if (fromState == null) { + return null + } + + // if fromState is a List, convert to map + if (fromState instanceof List) { + // check whether fromstate is a list[string] + assert fromState.every{it instanceof CharSequence} : "Error in module '$key_': fromState is a List, but not all elements are Strings" + fromState = fromState.collectEntries{[it, it]} + } + + // if fromState is a map, convert to closure + if (fromState instanceof Map) { + // check whether fromstate is a map[string, string] + assert fromState.values().every{it instanceof CharSequence} : "Error in module '$key_': fromState is a Map, but not all values are Strings" + assert fromState.keySet().every{it instanceof CharSequence} : "Error in module '$key_': fromState is a Map, but not all keys are Strings" + def fromStateMap = fromState.clone() + def requiredInputNames = meta.config.allArguments.findAll{it.required && it.direction == "Input"}.collect{it.plainName} + // turn the map into a closure to be used later on + fromState = { it -> + def state = it[1] + assert state instanceof Map : "Error in module '$key_': the state is not a Map" + def data = fromStateMap.collectMany{newkey, origkey -> + // check whether newkey corresponds to a required argument + if (state.containsKey(origkey)) { + [[newkey, state[origkey]]] + } else if (!requiredInputNames.contains(origkey)) { + [] + } else { + throw new Exception("Error in module '$key_': fromState key '$origkey' not found in current state") + } + }.collectEntries() + data + } + } + + return fromState +} + +def _processToState(toState, key_, config_) { + if (toState == null) { + toState = { tup -> tup[1] } + } + + // toState should be a closure, map[string, string], or list[string] + assert toState instanceof Closure || toState instanceof Map || toState instanceof List : + "Error in module '$key_': Expected process argument 'toState' to be a Closure, a Map, or a List. Found: class ${toState.getClass()}" + + // if toState is a List, convert to map + if (toState instanceof List) { + // check whether toState is a list[string] + assert toState.every{it instanceof CharSequence} : "Error in module '$key_': toState is a List, but not all elements are Strings" + toState = toState.collectEntries{[it, it]} + } + + // if toState is a map, convert to closure + if (toState instanceof Map) { + // check whether toState is a map[string, string] + assert toState.values().every{it instanceof CharSequence} : "Error in module '$key_': toState is a Map, but not all values are Strings" + assert toState.keySet().every{it instanceof CharSequence} : "Error in module '$key_': toState is a Map, but not all keys are Strings" + def toStateMap = toState.clone() + def requiredOutputNames = config_.allArguments.findAll{it.required && it.direction == "Output"}.collect{it.plainName} + // turn the map into a closure to be used later on + toState = { it -> + def output = it[1] + def state = it[2] + assert output instanceof Map : "Error in module '$key_': the output is not a Map" + assert state instanceof Map : "Error in module '$key_': the state is not a Map" + def extraEntries = toStateMap.collectMany{newkey, origkey -> + // check whether newkey corresponds to a required argument + if (output.containsKey(origkey)) { + [[newkey, output[origkey]]] + } else if (!requiredOutputNames.contains(origkey)) { + [] + } else { + throw new Exception("Error in module '$key_': toState key '$origkey' not found in current output") + } + }.collectEntries() + state + extraEntries + } + } + + return toState +} + +// helper file: 'src/main/resources/io/viash/runners/nextflow/workflowFactory/workflowFactory.nf' +def _debug(workflowArgs, debugKey) { + if (workflowArgs.debug) { + view { "process '${workflowArgs.key}' $debugKey tuple: $it" } + } else { + map { it } + } +} + +// depends on: innerWorkflowFactory +def workflowFactory(Map args, Map defaultWfArgs, Map meta) { + def workflowArgs = processWorkflowArgs(args, defaultWfArgs, meta) + def key_ = workflowArgs["key"] + def multipleArgs = meta.config.allArguments.findAll{ it.multiple }.collect{it.plainName} + + workflow workflowInstance { + take: input_ + + main: + def chModified = input_ + | checkUniqueIds([:]) + | _debug(workflowArgs, "input") + | map { tuple -> + tuple = deepClone(tuple) + + if (workflowArgs.map) { + tuple = workflowArgs.map(tuple) + } + if (workflowArgs.mapId) { + tuple[0] = workflowArgs.mapId(tuple[0]) + } + if (workflowArgs.mapData) { + tuple[1] = workflowArgs.mapData(tuple[1]) + } + if (workflowArgs.mapPassthrough) { + tuple = tuple.take(2) + workflowArgs.mapPassthrough(tuple.drop(2)) + } + + // check tuple + assert tuple instanceof List : + "Error in module '${key_}': element in channel should be a tuple [id, data, ...otherargs...]\n" + + " Example: [\"id\", [input: file('foo.txt'), arg: 10]].\n" + + " Expected class: List. Found: tuple.getClass() is ${tuple.getClass()}" + assert tuple.size() >= 2 : + "Error in module '${key_}': expected length of tuple in input channel to be two or greater.\n" + + " Example: [\"id\", [input: file('foo.txt'), arg: 10]].\n" + + " Found: tuple.size() == ${tuple.size()}" + + // check id field + if (tuple[0] instanceof GString) { + tuple[0] = tuple[0].toString() + } + assert tuple[0] instanceof CharSequence : + "Error in module '${key_}': first element of tuple in channel should be a String\n" + + " Example: [\"id\", [input: file('foo.txt'), arg: 10]].\n" + + " Found: ${tuple[0]}" + + // match file to input file + if (workflowArgs.auto.simplifyInput && (tuple[1] instanceof Path || tuple[1] instanceof List)) { + def inputFiles = meta.config.allArguments + .findAll { it.type == "file" && it.direction == "input" } + + assert inputFiles.size() == 1 : + "Error in module '${key_}' id '${tuple[0]}'.\n" + + " Anonymous file inputs are only allowed when the process has exactly one file input.\n" + + " Expected: inputFiles.size() == 1. Found: inputFiles.size() is ${inputFiles.size()}" + + tuple[1] = [[ inputFiles[0].plainName, tuple[1] ]].collectEntries() + } + + // check data field + assert tuple[1] instanceof Map : + "Error in module '${key_}' id '${tuple[0]}': second element of tuple in channel should be a Map\n" + + " Example: [\"id\", [input: file('foo.txt'), arg: 10]].\n" + + " Expected class: Map. Found: tuple[1].getClass() is ${tuple[1].getClass()}" + + // rename keys of data field in tuple + if (workflowArgs.renameKeys) { + assert workflowArgs.renameKeys instanceof Map : + "Error renaming data keys in module '${key_}' id '${tuple[0]}'.\n" + + " Example: renameKeys: ['new_key': 'old_key'].\n" + + " Expected class: Map. Found: renameKeys.getClass() is ${workflowArgs.renameKeys.getClass()}" + assert tuple[1] instanceof Map : + "Error renaming data keys in module '${key_}' id '${tuple[0]}'.\n" + + " Expected class: Map. Found: tuple[1].getClass() is ${tuple[1].getClass()}" + + // TODO: allow renameKeys to be a function? + workflowArgs.renameKeys.each { newKey, oldKey -> + assert newKey instanceof CharSequence : + "Error renaming data keys in module '${key_}' id '${tuple[0]}'.\n" + + " Example: renameKeys: ['new_key': 'old_key'].\n" + + " Expected class of newKey: String. Found: newKey.getClass() is ${newKey.getClass()}" + assert oldKey instanceof CharSequence : + "Error renaming data keys in module '${key_}' id '${tuple[0]}'.\n" + + " Example: renameKeys: ['new_key': 'old_key'].\n" + + " Expected class of oldKey: String. Found: oldKey.getClass() is ${oldKey.getClass()}" + assert tuple[1].containsKey(oldKey) : + "Error renaming data keys in module '${key}' id '${tuple[0]}'.\n" + + " Key '$oldKey' is missing in the data map. tuple[1].keySet() is '${tuple[1].keySet()}'" + tuple[1].put(newKey, tuple[1][oldKey]) + } + tuple[1].keySet().removeAll(workflowArgs.renameKeys.collect{ newKey, oldKey -> oldKey }) + } + tuple + } + + + def chRun = null + def chPassthrough = null + if (workflowArgs.runIf) { + def runIfBranch = chModified.branch{ tup -> + run: workflowArgs.runIf(tup[0], tup[1]) + passthrough: true + } + chRun = runIfBranch.run + chPassthrough = runIfBranch.passthrough + } else { + chRun = chModified + chPassthrough = Channel.empty() + } + + def chRunFiltered = workflowArgs.filter ? + chRun | filter{workflowArgs.filter(it)} : + chRun + + def chArgs = workflowArgs.fromState ? + chRunFiltered | map{ + def new_data = workflowArgs.fromState(it.take(2)) + [it[0], new_data] + } : + chRunFiltered | map {tup -> tup.take(2)} + + // fill in defaults + def chArgsWithDefaults = chArgs + | map { tuple -> + def id_ = tuple[0] + def data_ = tuple[1] + + // TODO: could move fromState to here + + // fetch default params from functionality + def defaultArgs = meta.config.allArguments + .findAll { it.containsKey("default") } + .collectEntries { [ it.plainName, it.default ] } + + // fetch overrides in params + def paramArgs = meta.config.allArguments + .findAll { par -> + def argKey = key_ + "__" + par.plainName + params.containsKey(argKey) + } + .collectEntries { [ it.plainName, params[key_ + "__" + it.plainName] ] } + + // fetch overrides in data + def dataArgs = meta.config.allArguments + .findAll { data_.containsKey(it.plainName) } + .collectEntries { [ it.plainName, data_[it.plainName] ] } + + // combine params + def combinedArgs = defaultArgs + paramArgs + workflowArgs.args + dataArgs + + // remove arguments with explicit null values + combinedArgs + .removeAll{_, val -> val == null || val == "viash_no_value" || val == "force_null"} + + combinedArgs = _processInputValues(combinedArgs, meta.config, id_, key_) + + [id_, combinedArgs] + tuple.drop(2) + } + + // TODO: move some of the _meta.join_id wrangling to the safeJoin() function. + def chInitialOutputMulti = chArgsWithDefaults + | _debug(workflowArgs, "processed") + // run workflow + | innerWorkflowFactory(workflowArgs) + def chInitialOutputList = chInitialOutputMulti instanceof List ? chInitialOutputMulti : [chInitialOutputMulti] + assert chInitialOutputList.size() > 0: "should have emitted at least one output channel" + // Add a channel ID to the events, which designates the channel the event was emitted from as a running number + // This number is used to sort the events later when the events are gathered from across the channels. + def chInitialOutputListWithIndexedEvents = chInitialOutputList.withIndex().collect{channel, channelIndex -> + def newChannel = channel + | map {tuple -> + assert tuple instanceof List : + "Error in module '${key_}': element in output channel should be a tuple [id, data, ...otherargs...]\n" + + " Example: [\"id\", [input: file('foo.txt'), arg: 10]].\n" + + " Expected class: List. Found: tuple.getClass() is ${tuple.getClass()}" + + def newEvent = [channelIndex] + tuple + return newEvent + } + return newChannel + } + // Put the events into 1 channel, cover case where there is only one channel is emitted + def chInitialOutput = chInitialOutputList.size() > 1 ? \ + chInitialOutputListWithIndexedEvents[0].mix(*chInitialOutputListWithIndexedEvents.tail()) : \ + chInitialOutputListWithIndexedEvents[0] + def chInitialOutputProcessed = chInitialOutput + | map { tuple -> + def channelId = tuple[0] + def id_ = tuple[1] + def output_ = tuple[2] + + // see if output map contains metadata + def meta_ = + output_ instanceof Map && output_.containsKey("_meta") ? + output_["_meta"] : + [:] + def join_id = meta_.join_id ?: id_ + + // remove metadata + output_ = output_.findAll{k, v -> k != "_meta"} + + // check value types + output_ = _checkValidOutputArgument(output_, meta.config, id_, key_) + + [join_id, channelId, id_, output_] + } + // | view{"chInitialOutput: ${it.take(3)}"} + + // join the output [prev_id, channel_id, new_id, output] with the previous state [prev_id, state, ...] + def chPublishWithPreviousState = safeJoin(chInitialOutputProcessed, chRunFiltered, key_) + // input tuple format: [join_id, channel_id, id, output, prev_state, ...] + // output tuple format: [join_id, channel_id, id, new_state, ...] + | map{ tup -> + def new_state = workflowArgs.toState(tup.drop(2).take(3)) + tup.take(3) + [new_state] + tup.drop(5) + } + if (workflowArgs.auto.publish == "state") { + def chPublishFiles = chPublishWithPreviousState + // input tuple format: [join_id, channel_id, id, new_state, ...] + // output tuple format: [join_id, channel_id, id, new_state] + | map{ tup -> + tup.take(4) + } + + safeJoin(chPublishFiles, chArgsWithDefaults, key_) + // input tuple format: [join_id, channel_id, id, new_state, orig_state, ...] + // output tuple format: [id, new_state, orig_state] + | map { tup -> + tup.drop(2).take(3) + } + | publishFilesByConfig(key: key_, config: meta.config) + } + // Join the state from the events that were emitted from different channels + def chJoined = chInitialOutputProcessed + | map {tuple -> + def join_id = tuple[0] + def channel_id = tuple[1] + def id = tuple[2] + def other = tuple.drop(3) + // Below, groupTuple is used to join the events. To make sure resuming a workflow + // keeps working, the output state must be deterministic. This means the state needs to be + // sorted with groupTuple's has a 'sort' argument. This argument can be set to 'hash', + // but hashing the state when it is large can be problematic in terms of performance. + // Therefore, a custom comparator function is provided. We add the channel ID to the + // states so that we can use the channel ID to sort the items. + def stateWithChannelID = [[channel_id] * other.size(), other].transpose() + // A comparator that is provided to groupTuple's 'sort' argument is applied + // to all elements of the event tuple (that is not the 'id'). The comparator + // closure that is used below expects the input to be List. So the join_id and + // channel_id must also be wrapped in a list. + [[join_id], [channel_id], id] + stateWithChannelID + } + | groupTuple(by: 2, sort: {a, b -> a[0] <=> b[0]}, size: chInitialOutputList.size(), remainder: true) + | map {join_ids, _, id, statesWithChannelID -> + // Remove the channel IDs from the states + def states = statesWithChannelID.collect{it[1]} + def newJoinId = join_ids.flatten().unique{a, b -> a <=> b} + assert newJoinId.size() == 1: "Multiple events were emitted for '$id'." + def newJoinIdUnique = newJoinId[0] + + // Merge the states from the different channels + def newState = states.inject([:]){ old_state, state_to_add -> + return old_state + state_to_add.collectEntries{k, v -> + if (!multipleArgs.contains(k)) { + // if the key is not a multiple argument, we expect only one value + if (old_state.containsKey(k)) { + assert old_state[k] == v : "ID $id: multiple entries for argument $k were emitted." + } + [k, v] + } else { + // if the key is a multiple argument, append the different values into one list + def prevValue = old_state.getOrDefault(k, []) + def prevValueAsList = prevValue instanceof List ? prevValue : [prevValue] + [k, prevValueAsList + v] + } + } + } + + _checkAllRequiredOuputsPresent(newState, meta.config, id, key_) + + // simplify output if need be + if (workflowArgs.auto.simplifyOutput && newState.size() == 1) { + newState = newState.values()[0] + } + + return [newJoinIdUnique, id, newState] + } + + // join the output [prev_id, new_id, output] with the previous state [prev_id, state, ...] + def chNewState = safeJoin(chJoined, chRunFiltered, key_) + // input tuple format: [join_id, id, output, prev_state, ...] + // output tuple format: [join_id, id, new_state, ...] + | map{ tup -> + def new_state = workflowArgs.toState(tup.drop(1).take(3)) + tup.take(2) + [new_state] + tup.drop(4) + } + + if (workflowArgs.auto.publish == "state") { + def chPublishStates = chNewState + // input tuple format: [join_id, id, new_state, ...] + // output tuple format: [join_id, id, new_state] + | map{ tup -> + tup.take(3) + } + + safeJoin(chPublishStates, chArgsWithDefaults, key_) + // input tuple format: [join_id, id, new_state, orig_state, ...] + // output tuple format: [id, new_state, orig_state] + | map { tup -> + tup.drop(1).take(3) + } + | publishStatesByConfig(key: key_, config: meta.config) + } + chReturn = chNewState + | map { tup -> + // input tuple format: [join_id, id, new_state, ...] + // output tuple format: [id, new_state, ...] + tup.drop(1) + } + | _debug(workflowArgs, "output") + | concat(chPassthrough) + + emit: chReturn + } + + def wf = workflowInstance.cloneWithName(key_) + + // add factory function + wf.metaClass.run = { runArgs -> + workflowFactory(runArgs, workflowArgs, meta) + } + // add config to module for later introspection + wf.metaClass.config = meta.config + + return wf +} + +nextflow.enable.dsl=2 + +// START COMPONENT-SPECIFIC CODE + +// create meta object +meta = [ + "resources_dir": moduleDir.toRealPath().normalize(), + "config": processConfig(readJsonBlob('''{ + "name" : "intersect_obs", + "namespace" : "filter", + "version" : "v4.1.0", + "authors" : [ + { + "name" : "Dries Schaumont", + "roles" : [ + "maintainer" + ], + "info" : { + "role" : "Core Team Member", + "links" : { + "email" : "dries@data-intuitive.com", + "github" : "DriesSchaumont", + "orcid" : "0000-0002-4389-0440", + "linkedin" : "dries-schaumont" + }, + "organizations" : [ + { + "name" : "Data Intuitive", + "href" : "https://www.data-intuitive.com", + "role" : "Data Scientist" + } + ] + } + }, + { + "name" : "Isabelle Bergiers", + "roles" : [ + "contributor" + ], + "info" : { + "role" : "Contributor", + "links" : { + "github" : "Isabelle-b", + "orcid" : "0000-0001-9622-7960" + }, + "organizations" : [ + { + "name" : "Janssen Pharmaceuticals", + "href" : "https://www.janssen.com", + "role" : "Scientist OMICS Technology" + } + ] + } + } + ], + "argument_groups" : [ + { + "name" : "Arguments", + "arguments" : [ + { + "type" : "file", + "name" : "--input", + "description" : "Input h5mu file", + "example" : [ + "input.h5mu" + ], + "must_exist" : true, + "create_parent" : true, + "required" : true, + "direction" : "input", + "multiple" : false, + "multiple_sep" : ";" + }, + { + "type" : "string", + "name" : "--modalities", + "description" : "Which modalities from the input MuData file to process.\n", + "example" : [ + "rna", + "prot" + ], + "required" : true, + "direction" : "input", + "multiple" : true, + "multiple_sep" : ";" + }, + { + "type" : "file", + "name" : "--output", + "description" : "Output h5mu file.", + "example" : [ + "output.h5mu" + ], + "must_exist" : true, + "create_parent" : true, + "required" : false, + "direction" : "output", + "multiple" : false, + "multiple_sep" : ";" + }, + { + "type" : "string", + "name" : "--output_compression", + "description" : "Compression format to use for the output AnnData and/or Mudata H5 files.\nBy default no compression is applied.\n", + "example" : [ + "gzip" + ], + "required" : false, + "choices" : [ + "gzip", + "lzf" + ], + "direction" : "input", + "multiple" : false, + "multiple_sep" : ";" + } + ] + } + ], + "resources" : [ + { + "type" : "python_script", + "path" : "script.py", + "is_executable" : true + }, + { + "type" : "file", + "path" : "/src/utils/setup_logger.py" + }, + { + "type" : "file", + "path" : "/src/utils/compress_h5mu.py" + }, + { + "type" : "file", + "path" : "/src/workflows/utils/labels.config", + "dest" : "nextflow_labels.config" + } + ], + "description" : "Create an intersection between two or more modalities.\n\nThis component removes any observations which are not present in all modalities.\n", + "test_resources" : [ + { + "type" : "python_script", + "path" : "test.py", + "is_executable" : true + }, + { + "type" : "file", + "path" : "/resources_test/pbmc_1k_protein_v3" + } + ], + "status" : "enabled", + "scope" : { + "image" : "public", + "target" : "public" + }, + "license" : "MIT", + "links" : { + "repository" : "https://github.com/openpipelines-bio/openpipeline", + "docker_registry" : "ghcr.io" + }, + "runners" : [ + { + "type" : "executable", + "id" : "executable", + "docker_setup_strategy" : "ifneedbepullelsecachedbuild" + }, + { + "type" : "nextflow", + "id" : "nextflow", + "directives" : { + "label" : [ + "lowcpu", + "midmem" + ], + "tag" : "$id" + }, + "auto" : { + "simplifyInput" : true, + "simplifyOutput" : false, + "transcript" : false, + "publish" : false + }, + "config" : { + "labels" : { + "mem1gb" : "memory = 1000000000.B", + "mem2gb" : "memory = 2000000000.B", + "mem5gb" : "memory = 5000000000.B", + "mem10gb" : "memory = 10000000000.B", + "mem20gb" : "memory = 20000000000.B", + "mem50gb" : "memory = 50000000000.B", + "mem100gb" : "memory = 100000000000.B", + "mem200gb" : "memory = 200000000000.B", + "mem500gb" : "memory = 500000000000.B", + "mem1tb" : "memory = 1000000000000.B", + "mem2tb" : "memory = 2000000000000.B", + "mem5tb" : "memory = 5000000000000.B", + "mem10tb" : "memory = 10000000000000.B", + "mem20tb" : "memory = 20000000000000.B", + "mem50tb" : "memory = 50000000000000.B", + "mem100tb" : "memory = 100000000000000.B", + "mem200tb" : "memory = 200000000000000.B", + "mem500tb" : "memory = 500000000000000.B", + "mem1gib" : "memory = 1073741824.B", + "mem2gib" : "memory = 2147483648.B", + "mem4gib" : "memory = 4294967296.B", + "mem8gib" : "memory = 8589934592.B", + "mem16gib" : "memory = 17179869184.B", + "mem32gib" : "memory = 34359738368.B", + "mem64gib" : "memory = 68719476736.B", + "mem128gib" : "memory = 137438953472.B", + "mem256gib" : "memory = 274877906944.B", + "mem512gib" : "memory = 549755813888.B", + "mem1tib" : "memory = 1099511627776.B", + "mem2tib" : "memory = 2199023255552.B", + "mem4tib" : "memory = 4398046511104.B", + "mem8tib" : "memory = 8796093022208.B", + "mem16tib" : "memory = 17592186044416.B", + "mem32tib" : "memory = 35184372088832.B", + "mem64tib" : "memory = 70368744177664.B", + "mem128tib" : "memory = 140737488355328.B", + "mem256tib" : "memory = 281474976710656.B", + "mem512tib" : "memory = 562949953421312.B", + "cpu1" : "cpus = 1", + "cpu2" : "cpus = 2", + "cpu5" : "cpus = 5", + "cpu10" : "cpus = 10", + "cpu20" : "cpus = 20", + "cpu50" : "cpus = 50", + "cpu100" : "cpus = 100", + "cpu200" : "cpus = 200", + "cpu500" : "cpus = 500", + "cpu1000" : "cpus = 1000" + }, + "script" : [ + "includeConfig(\\"nextflow_labels.config\\")" + ] + }, + "debug" : false, + "container" : "docker" + } + ], + "engines" : [ + { + "type" : "docker", + "id" : "docker", + "image" : "python:3.13-slim", + "target_registry" : "images.viash-hub.com", + "target_tag" : "v4.1.0", + "namespace_separator" : "/", + "setup" : [ + { + "type" : "apt", + "packages" : [ + "procps" + ], + "interactive" : false + }, + { + "type" : "python", + "user" : false, + "packages" : [ + "anndata~=0.12.16", + "awkward", + "scipy~=1.17.1", + "mudata~=0.3.8" + ], + "script" : [ + "exec(\\"try:\\\\n import zarr; from importlib.metadata import version\\\\nexcept ModuleNotFoundError:\\\\n exit(0)\\\\nelse: assert int(version(\\\\\\"zarr\\\\\\").partition(\\\\\\".\\\\\\")[0]) > 2\\")" + ], + "upgrade" : true + } + ], + "test_setup" : [ + { + "type" : "python", + "user" : false, + "packages" : [ + "viashpy==0.10.0" + ], + "upgrade" : true + } + ] + }, + { + "type" : "native", + "id" : "native" + } + ], + "build_info" : { + "config" : "/workdir/root/repo/src/filter/intersect_obs/config.vsh.yaml", + "runner" : "nextflow", + "engine" : "docker|native", + "output" : "/workdir/root/repo/target/nextflow/filter/intersect_obs", + "viash_version" : "0.9.7", + "git_commit" : "a6499fddaa8553874585c747370f919f4d7b729c", + "git_remote" : "https://github.com/openpipelines-bio/openpipeline" + }, + "package_config" : { + "name" : "openpipeline", + "version" : "v4.1.0", + "summary" : "Best-practice workflows for single-cell multi-omics analyses.\n", + "description" : "OpenPipelines are extensible single cell analysis pipelines for reproducible and large-scale single cell processing using [Viash](https://viash.io) and [Nextflow](https://www.nextflow.io/).\n\nIn terms of workflows, the following has been made available, but keep in mind that\nindividual tools and functionality can be executed as standalone components as well.\n\n * Demultiplexing: conversion of raw sequencing data to FASTQ objects.\n * Ingestion: Read mapping and generating a count matrix.\n * Single sample processing: cell filtering and doublet detection.\n * Multisample processing: Count transformation, normalization, QC metric calulations.\n * Integration: Clustering, integration and batch correction using single and multimodal methods.\n * Downstream analysis workflows\n", + "info" : { + "test_resources" : [ + { + "type" : "s3", + "path" : "s3://openpipelines-data", + "dest" : "resources_test" + } + ], + "nextflow_labels_ci" : [ + { + "path" : "src/workflows/utils/labels_ci.config", + "description" : "Adds the correct memory and CPU labels when running on the Viash Hub CI." + } + ] + }, + "viash_version" : "0.9.7", + "source" : "/workdir/root/repo/src", + "target" : "/workdir/root/repo/target", + "config_mods" : [ + ".resources += {path: '/src/workflows/utils/labels.config', dest: 'nextflow_labels.config'}\n.runners[.type == 'nextflow'].config.script := 'includeConfig(\\"nextflow_labels.config\\")'", + ".engines += { type: \\"native\\" }", + ".engines[.type == 'docker'].target_registry := 'images.viash-hub.com'", + ".engines[.type == 'docker'].target_tag := 'v4.1.0'" + ], + "keywords" : [ + "single-cell", + "multimodal" + ], + "license" : "MIT", + "organization" : "vsh", + "links" : { + "repository" : "https://github.com/openpipelines-bio/openpipeline", + "docker_registry" : "ghcr.io", + "homepage" : "https://openpipelines.bio", + "documentation" : "https://openpipelines.bio/fundamentals", + "issue_tracker" : "https://github.com/openpipelines-bio/openpipeline/issues" + } + } +}''')) +] + +// resolve dependencies dependencies (if any) + + +// inner workflow +// inner workflow hook +def innerWorkflowFactory(args) { + def rawScript = '''set -e +tempscript=".viash_script.py" +cat > "$tempscript" << VIASHMAIN +import mudata as mu +import anndata as ad +import sys +from pathlib import Path +import shutil + +## VIASH START +# The following code has been auto-generated by Viash. +par = { + 'input': $( if [ ! -z ${VIASH_PAR_INPUT+x} ]; then echo "r'${VIASH_PAR_INPUT//\\'/\\'\\"\\'\\"r\\'}'"; else echo None; fi ), + 'modalities': $( if [ ! -z ${VIASH_PAR_MODALITIES+x} ]; then echo "r'${VIASH_PAR_MODALITIES//\\'/\\'\\"\\'\\"r\\'}'.split(';')"; else echo None; fi ), + 'output': $( if [ ! -z ${VIASH_PAR_OUTPUT+x} ]; then echo "r'${VIASH_PAR_OUTPUT//\\'/\\'\\"\\'\\"r\\'}'"; else echo None; fi ), + 'output_compression': $( if [ ! -z ${VIASH_PAR_OUTPUT_COMPRESSION+x} ]; then echo "r'${VIASH_PAR_OUTPUT_COMPRESSION//\\'/\\'\\"\\'\\"r\\'}'"; else echo None; fi ) +} +meta = { + 'name': $( if [ ! -z ${VIASH_META_NAME+x} ]; then echo "r'${VIASH_META_NAME//\\'/\\'\\"\\'\\"r\\'}'"; else echo None; fi ), + 'functionality_name': $( if [ ! -z ${VIASH_META_FUNCTIONALITY_NAME+x} ]; then echo "r'${VIASH_META_FUNCTIONALITY_NAME//\\'/\\'\\"\\'\\"r\\'}'"; else echo None; fi ), + 'resources_dir': $( if [ ! -z ${VIASH_META_RESOURCES_DIR+x} ]; then echo "r'${VIASH_META_RESOURCES_DIR//\\'/\\'\\"\\'\\"r\\'}'"; else echo None; fi ), + 'executable': $( if [ ! -z ${VIASH_META_EXECUTABLE+x} ]; then echo "r'${VIASH_META_EXECUTABLE//\\'/\\'\\"\\'\\"r\\'}'"; else echo None; fi ), + 'config': $( if [ ! -z ${VIASH_META_CONFIG+x} ]; then echo "r'${VIASH_META_CONFIG//\\'/\\'\\"\\'\\"r\\'}'"; else echo None; fi ), + 'temp_dir': $( if [ ! -z ${VIASH_META_TEMP_DIR+x} ]; then echo "r'${VIASH_META_TEMP_DIR//\\'/\\'\\"\\'\\"r\\'}'"; else echo None; fi ), + 'cpus': $( if [ ! -z ${VIASH_META_CPUS+x} ]; then echo "int(r'${VIASH_META_CPUS//\\'/\\'\\"\\'\\"r\\'}')"; else echo None; fi ), + 'memory_b': $( if [ ! -z ${VIASH_META_MEMORY_B+x} ]; then echo "int(r'${VIASH_META_MEMORY_B//\\'/\\'\\"\\'\\"r\\'}')"; else echo None; fi ), + 'memory_kb': $( if [ ! -z ${VIASH_META_MEMORY_KB+x} ]; then echo "int(r'${VIASH_META_MEMORY_KB//\\'/\\'\\"\\'\\"r\\'}')"; else echo None; fi ), + 'memory_mb': $( if [ ! -z ${VIASH_META_MEMORY_MB+x} ]; then echo "int(r'${VIASH_META_MEMORY_MB//\\'/\\'\\"\\'\\"r\\'}')"; else echo None; fi ), + 'memory_gb': $( if [ ! -z ${VIASH_META_MEMORY_GB+x} ]; then echo "int(r'${VIASH_META_MEMORY_GB//\\'/\\'\\"\\'\\"r\\'}')"; else echo None; fi ), + 'memory_tb': $( if [ ! -z ${VIASH_META_MEMORY_TB+x} ]; then echo "int(r'${VIASH_META_MEMORY_TB//\\'/\\'\\"\\'\\"r\\'}')"; else echo None; fi ), + 'memory_pb': $( if [ ! -z ${VIASH_META_MEMORY_PB+x} ]; then echo "int(r'${VIASH_META_MEMORY_PB//\\'/\\'\\"\\'\\"r\\'}')"; else echo None; fi ), + 'memory_kib': $( if [ ! -z ${VIASH_META_MEMORY_KIB+x} ]; then echo "int(r'${VIASH_META_MEMORY_KIB//\\'/\\'\\"\\'\\"r\\'}')"; else echo None; fi ), + 'memory_mib': $( if [ ! -z ${VIASH_META_MEMORY_MIB+x} ]; then echo "int(r'${VIASH_META_MEMORY_MIB//\\'/\\'\\"\\'\\"r\\'}')"; else echo None; fi ), + 'memory_gib': $( if [ ! -z ${VIASH_META_MEMORY_GIB+x} ]; then echo "int(r'${VIASH_META_MEMORY_GIB//\\'/\\'\\"\\'\\"r\\'}')"; else echo None; fi ), + 'memory_tib': $( if [ ! -z ${VIASH_META_MEMORY_TIB+x} ]; then echo "int(r'${VIASH_META_MEMORY_TIB//\\'/\\'\\"\\'\\"r\\'}')"; else echo None; fi ), + 'memory_pib': $( if [ ! -z ${VIASH_META_MEMORY_PIB+x} ]; then echo "int(r'${VIASH_META_MEMORY_PIB//\\'/\\'\\"\\'\\"r\\'}')"; else echo None; fi ) +} +dep = { + +} + +## VIASH END + +sys.path.append(meta["resources_dir"]) +from setup_logger import setup_logger +from compress_h5mu import compress_h5mu + +logger = setup_logger() + + +def main(): + modality_names = par["modalities"] + + if len(modality_names) < 2: + raise ValueError("Please provide two more more modalities.") + + obs_names = {} + for mod_name in par["modalities"]: + try: + modality = mu.read_h5ad(filename=par["input"], mod=mod_name) + except KeyError: + raise ValueError( + f"Modality {mod_name} does not exist for file {par['input']}." + ) + + obs_names[mod_name] = modality.obs_names.copy() + del modality + + intersected_index = None + for mod_name, mod_index in obs_names.items(): + if intersected_index is None: + intersected_index = mod_index + continue + intersected_index = intersected_index.intersection(mod_index) + + output_file = Path(par["output"]) + output_file_uncompressed = output_file.with_name( + output_file.stem + "_uncompressed.h5mu" + ) + output_file_uncompressed.touch() + + mdata = mu.MuData({modality: ad.AnnData() for modality in modality_names}) + mdata.write(output_file_uncompressed, compression=par["output_compression"]) + + for mod_name in modality_names: + modality = mu.read_h5ad(filename=par["input"], mod=mod_name) + intersected_modality = modality[intersected_index] + mu.write_h5ad(output_file_uncompressed, data=intersected_modality, mod=mod_name) + + if par["output_compression"]: + compress_h5mu( + output_file_uncompressed, output_file, compression=par["output_compression"] + ) + output_file_uncompressed.unlink() + else: + shutil.move(output_file_uncompressed, output_file) + + +if __name__ == "__main__": + main() +VIASHMAIN +python -B "$tempscript" +''' + + return vdsl3WorkflowFactory(args, meta, rawScript) +} + + + +/** + * Generate a workflow for VDSL3 modules. + * + * This function is called by the workflowFactory() function. + * + * Input channel: [id, input_map] + * Output channel: [id, output_map] + * + * Internally, this workflow will convert the input channel + * to a format which the Nextflow module will be able to handle. + */ +def vdsl3WorkflowFactory(Map args, Map meta, String rawScript) { + def key = args["key"] + def processObj = null + + workflow processWf { + take: input_ + main: + + if (processObj == null) { + processObj = _vdsl3ProcessFactory(args, meta, rawScript) + } + + output_ = input_ + | map { tuple -> + def id = tuple[0] + def data_ = tuple[1] + + if (workflow.stubRun) { + // add id if missing + data_ = [id: 'stub'] + data_ + } + + // process input files separately + def inputPaths = meta.config.allArguments + .findAll { it.type == "file" && it.direction == "input" } + .collect { par -> + def val = data_.containsKey(par.plainName) ? data_[par.plainName] : [] + def inputFiles = [] + if (val == null) { + inputFiles = [] + } else if (val instanceof List) { + inputFiles = val + } else if (val instanceof Path) { + inputFiles = [ val ] + } else { + inputFiles = [] + } + if (!workflow.stubRun) { + // throw error when an input file doesn't exist + inputFiles.each{ file -> + assert file.exists() : + "Error in module '${key}' id '${id}' argument '${par.plainName}'.\n" + + " Required input file does not exist.\n" + + " Path: '$file'.\n" + + " Expected input file to exist" + } + } + inputFiles + } + + // remove input files + def argsExclInputFiles = meta.config.allArguments + .findAll { (it.type != "file" || it.direction != "input") && data_.containsKey(it.plainName) } + .collectEntries { par -> + def parName = par.plainName + def val = data_[parName] + if (par.multiple && val instanceof Collection) { + val = val.join(par.multiple_sep) + } + if (par.direction == "output" && par.type == "file") { + val = val + .replaceAll('\\$id', id) + .replaceAll('\\$\\{id\\}', id) + .replaceAll('\\$key', key) + .replaceAll('\\$\\{key\\}', key) + } + [parName, val] + } + + [ id ] + inputPaths + [ argsExclInputFiles, meta.resources_dir ] + } + | processObj + | map { output -> + def outputFiles = meta.config.allArguments + .findAll { it.type == "file" && it.direction == "output" } + .indexed() + .collectEntries{ index, par -> + def out = output[index + 1] + // strip dummy '.exitcode' file from output (see nextflow-io/nextflow#2678) + if (!out instanceof List || out.size() <= 1) { + if (par.multiple) { + out = [] + } else { + assert !par.required : + "Error in module '${key}' id '${output[0]}' argument '${par.plainName}'.\n" + + " Required output file is missing" + out = null + } + } else if (out.size() == 2 && !par.multiple) { + out = out[1] + } else { + out = out.drop(1) + } + [ par.plainName, out ] + } + + // drop null outputs + outputFiles.removeAll{it.value == null} + + [ output[0], outputFiles ] + } + emit: output_ + } + + return processWf +} + +// depends on: session? +def _vdsl3ProcessFactory(Map workflowArgs, Map meta, String rawScript) { + // autodetect process key + def wfKey = workflowArgs["key"] + def procKeyPrefix = "${wfKey}_process" + def scriptMeta = nextflow.script.ScriptMeta.current() + def existing = scriptMeta.getProcessNames().findAll{it.startsWith(procKeyPrefix)} + def numbers = existing.collect{it.replace(procKeyPrefix, "0").toInteger()} + def newNumber = (numbers + [-1]).max() + 1 + + def procKey = newNumber == 0 ? procKeyPrefix : "$procKeyPrefix$newNumber" + + if (newNumber > 0) { + log.warn "Key for module '${wfKey}' is duplicated.\n", + "If you run a component multiple times in the same workflow,\n" + + "it's recommended you set a unique key for every call,\n" + + "for example: ${wfKey}.run(key: \"foo\")." + } + + // subset directives and convert to list of tuples + def drctv = workflowArgs.directives + + // TODO: unit test the two commands below + // convert publish array into tags + def valueToStr = { val -> + // ignore closures + if (val instanceof CharSequence) { + if (!val.matches('^[{].*[}]$')) { + '"' + val + '"' + } else { + val + } + } else if (val instanceof List) { + "[" + val.collect{valueToStr(it)}.join(", ") + "]" + } else if (val instanceof Map) { + "[" + val.collect{k, v -> k + ": " + valueToStr(v)}.join(", ") + "]" + } else { + val.inspect() + } + } + + // multiple entries allowed: label, publishdir + def drctvStrs = drctv.collect { key, value -> + if (key in ["label", "publishDir"]) { + value.collect{ val -> + if (val instanceof Map) { + "\n$key " + val.collect{ k, v -> k + ": " + valueToStr(v) }.join(", ") + } else if (val == null) { + "" + } else { + "\n$key " + valueToStr(val) + } + }.join() + } else if (value instanceof Map) { + "\n$key " + value.collect{ k, v -> k + ": " + valueToStr(v) }.join(", ") + } else { + "\n$key " + valueToStr(value) + } + }.join() + + def inputPaths = meta.config.allArguments + .findAll { it.type == "file" && it.direction == "input" } + .collect { ', path(viash_par_' + it.plainName + ', stageAs: "_viash_par/' + it.plainName + '_?/*")' } + .join() + + def outputPaths = meta.config.allArguments + .findAll { it.type == "file" && it.direction == "output" } + .collect { par -> + // insert dummy into every output (see nextflow-io/nextflow#2678) + if (!par.multiple) { + ', path{[".exitcode", args.' + par.plainName + ']}' + } else { + ', path{[".exitcode"] + args.' + par.plainName + '}' + } + } + .join() + + // TODO: move this functionality somewhere else? + if (workflowArgs.auto.transcript) { + outputPaths = outputPaths + ', path{[".exitcode", ".command*"]}' + } else { + outputPaths = outputPaths + ', path{[".exitcode"]}' + } + + // create dirs for output files (based on BashWrapper.createParentFiles) + def createParentStr = meta.config.allArguments + .findAll { it.type == "file" && it.direction == "output" && it.create_parent } + .collect { par -> + def contents = "args[\"${par.plainName}\"] instanceof List ? args[\"${par.plainName}\"].join('\" \"') : args[\"${par.plainName}\"]" + "\${ args.containsKey(\"${par.plainName}\") ? \"mkdir_parent '\" + escapeText(${contents}) + \"'\" : \"\" }" + } + .join("\n") + + // construct inputFileExports + def inputFileExports = meta.config.allArguments + .findAll { it.type == "file" && it.direction.toLowerCase() == "input" } + .collect { par -> + def contents = "viash_par_${par.plainName} instanceof List ? viash_par_${par.plainName}.join(\"${par.multiple_sep}\") : viash_par_${par.plainName}" + "\n\${viash_par_${par.plainName}.empty ? \"\" : \"export VIASH_PAR_${par.plainName.toUpperCase()}='\" + escapeText(${contents}) + \"'\"}" + } + + // NOTE: if using docker, use /tmp instead of tmpDir! + def tmpDir = java.nio.file.Paths.get( + System.getenv('NXF_TEMP') ?: + System.getenv('VIASH_TEMP') ?: + System.getenv('VIASH_TMPDIR') ?: + System.getenv('VIASH_TEMPDIR') ?: + System.getenv('VIASH_TMP') ?: + System.getenv('TEMP') ?: + System.getenv('TMPDIR') ?: + System.getenv('TEMPDIR') ?: + System.getenv('TMP') ?: + '/tmp' + ).toAbsolutePath() + + // construct stub + def stub = meta.config.allArguments + .findAll { it.type == "file" && it.direction == "output" } + .collect { par -> + "\${ args.containsKey(\"${par.plainName}\") ? \"touch2 \\\"\" + (args[\"${par.plainName}\"] instanceof String ? args[\"${par.plainName}\"].replace(\"_*\", \"_0\") : args[\"${par.plainName}\"].join('\" \"')) + \"\\\"\" : \"\" }" + } + .join("\n") + + // escape script + def escapedScript = rawScript.replace('\\', '\\\\').replace('$', '\\$').replace('"""', '\\"\\"\\"') + + // publishdir assert + def assertStr = (workflowArgs.auto.publish == true) || workflowArgs.auto.transcript ? + """\nassert task.publishDir.size() > 0: "if auto.publish is true, params.publish_dir needs to be defined.\\n Example: --publish_dir './output/'" """ : + "" + + // generate process string + def procStr = + """nextflow.enable.dsl=2 + | + |def escapeText = { s -> s.toString().replaceAll("'", "'\\\"'\\\"'") } + |process $procKey {$drctvStrs + |input: + | tuple val(id)$inputPaths, val(args), path(resourcesDir, stageAs: ".viash_meta_resources") + |output: + | tuple val("\$id")$outputPaths, optional: true + |stub: + |\"\"\" + |touch2() { mkdir -p "\\\$(dirname "\\\$1")" && touch "\\\$1" ; } + |$stub + |\"\"\" + |script:$assertStr + |def parInject = args + | .findAll{key, value -> value != null} + | .collect{key, value -> "export VIASH_PAR_\${key.toUpperCase()}='\${escapeText(value)}'"} + | .join("\\n") + |\"\"\" + |# meta exports + |export VIASH_META_RESOURCES_DIR="\${resourcesDir}" + |export VIASH_META_TEMP_DIR="${['docker', 'podman', 'charliecloud'].any{ it == workflow.containerEngine } ? '/tmp' : tmpDir}" + |export VIASH_META_NAME="${meta.config.name}" + |# export VIASH_META_EXECUTABLE="\\\$VIASH_META_RESOURCES_DIR/\\\$VIASH_META_NAME" + |export VIASH_META_CONFIG="\\\$VIASH_META_RESOURCES_DIR/.config.vsh.yaml" + |\${task.cpus ? "export VIASH_META_CPUS=\$task.cpus" : "" } + |\${task.memory?.bytes != null ? "export VIASH_META_MEMORY_B=\$task.memory.bytes" : "" } + |if [ ! -z \\\${VIASH_META_MEMORY_B+x} ]; then + | export VIASH_META_MEMORY_KB=\\\$(( (\\\$VIASH_META_MEMORY_B+999) / 1000 )) + | export VIASH_META_MEMORY_MB=\\\$(( (\\\$VIASH_META_MEMORY_KB+999) / 1000 )) + | export VIASH_META_MEMORY_GB=\\\$(( (\\\$VIASH_META_MEMORY_MB+999) / 1000 )) + | export VIASH_META_MEMORY_TB=\\\$(( (\\\$VIASH_META_MEMORY_GB+999) / 1000 )) + | export VIASH_META_MEMORY_PB=\\\$(( (\\\$VIASH_META_MEMORY_TB+999) / 1000 )) + | export VIASH_META_MEMORY_KIB=\\\$(( (\\\$VIASH_META_MEMORY_B+1023) / 1024 )) + | export VIASH_META_MEMORY_MIB=\\\$(( (\\\$VIASH_META_MEMORY_KIB+1023) / 1024 )) + | export VIASH_META_MEMORY_GIB=\\\$(( (\\\$VIASH_META_MEMORY_MIB+1023) / 1024 )) + | export VIASH_META_MEMORY_TIB=\\\$(( (\\\$VIASH_META_MEMORY_GIB+1023) / 1024 )) + | export VIASH_META_MEMORY_PIB=\\\$(( (\\\$VIASH_META_MEMORY_TIB+1023) / 1024 )) + |fi + | + |# meta synonyms + |export VIASH_TEMP="\\\$VIASH_META_TEMP_DIR" + |export TEMP_DIR="\\\$VIASH_META_TEMP_DIR" + | + |# create output dirs if need be + |function mkdir_parent { + | for file in "\\\$@"; do + | mkdir -p "\\\$(dirname "\\\$file")" + | done + |} + |$createParentStr + | + |# argument exports${inputFileExports.join()} + |\$parInject + | + |# process script + |${escapedScript} + |\"\"\" + |} + |""".stripMargin() + + // TODO: print on debug + // if (workflowArgs.debug == true) { + // println("######################\n$procStr\n######################") + // } + + // write process to temp file + def tempFile = java.nio.file.Files.createTempFile("viash-process-${procKey}-", ".nf") + addShutdownHook { java.nio.file.Files.deleteIfExists(tempFile) } + tempFile.text = procStr + + // create process from temp file + def binding = new nextflow.script.ScriptBinding([:]) + def session = nextflow.Nextflow.getSession() + def parser = _getScriptLoader(session) + .setModule(true) + .setBinding(binding) + def moduleScript = parser.runScript(tempFile) + .getScript() + + // register module in meta + def module = new nextflow.script.IncludeDef.Module(name: procKey) + scriptMeta.addModule(moduleScript, module.name, module.alias) + + // retrieve and return process from meta + return scriptMeta.getProcess(procKey) +} + +// use Reflection to get a ScriptParser / ScriptLoader +// <25.02.0-edge: new nextflow.script.ScriptParser(session) +// >=25.02.0-edge: nextflow.script.ScriptLoaderFactory.create(session) +def _getScriptLoader(nextflow.Session session) { + // try using the old method + try { + Class scriptParserClass = Class.forName('nextflow.script.ScriptParser') + return scriptParserClass.getDeclaredConstructor(nextflow.Session).newInstance(session) + } catch (ClassNotFoundException e) { + // else try with the new method + try { + Class scriptLoaderFactoryClass = Class.forName('nextflow.script.ScriptLoaderFactory') + def createMethod = scriptLoaderFactoryClass.getDeclaredMethod('create', nextflow.Session) + return createMethod.invoke(null, session) // null because create is static + } catch (ClassNotFoundException | NoSuchMethodException | IllegalAccessException | java.lang.reflect.InvocationTargetException e2) { + // Handle the case where neither class is found + throw new Exception("Neither nextflow.script.ScriptParser nor nextflow.script.ScriptLoaderFactory could be found. Is this a compatible Nextflow version?", e2) + } + } +} + +// defaults +meta["defaults"] = [ + // key to be used to trace the process and determine output names + key: null, + + // fixed arguments to be passed to script + args: [:], + + // default directives + directives: readJsonBlob('''{ + "container" : { + "registry" : "images.viash-hub.com", + "image" : "vsh/openpipeline/filter/intersect_obs", + "tag" : "v4.1.0" + }, + "label" : [ + "lowcpu", + "midmem" + ], + "tag" : "$id" +}'''), + + // auto settings + auto: readJsonBlob('''{ + "simplifyInput" : true, + "simplifyOutput" : false, + "transcript" : false, + "publish" : false +}'''), + + // Apply a map over the incoming tuple + // Example: `{ tup -> [ tup[0], [input: tup[1].output] ] + tup.drop(2) }` + map: null, + + // Apply a map over the ID element of a tuple (i.e. the first element) + // Example: `{ id -> id + "_foo" }` + mapId: null, + + // Apply a map over the data element of a tuple (i.e. the second element) + // Example: `{ data -> [ input: data.output ] }` + mapData: null, + + // Apply a map over the passthrough elements of a tuple (i.e. the tuple excl. the first two elements) + // Example: `{ pt -> pt.drop(1) }` + mapPassthrough: null, + + // Filter the channel + // Example: `{ tup -> tup[0] == "foo" }` + filter: null, + + // Choose whether or not to run the component on the tuple if the condition is true. + // Otherwise, the tuple will be passed through. + // Example: `{ tup -> tup[0] != "skip_this" }` + runIf: null, + + // Rename keys in the data field of the tuple (i.e. the second element) + // Will likely be deprecated in favour of `fromState`. + // Example: `[ "new_key": "old_key" ]` + renameKeys: null, + + // Fetch data from the state and pass it to the module without altering the current state. + // + // `fromState` should be `null`, `List[String]`, `Map[String, String]` or a function. + // + // - If it is `null`, the state will be passed to the module as is. + // - If it is a `List[String]`, the data will be the values of the state at the given keys. + // - If it is a `Map[String, String]`, the data will be the values of the state at the given keys, with the keys renamed according to the map. + // - If it is a function, the tuple (`[id, state]`) in the channel will be passed to the function, and the result will be used as the data. + // + // Example: `{ id, state -> [input: state.fastq_file] }` + // Default: `null` + fromState: null, + + // Determine how the state should be updated after the module has been run. + // + // `toState` should be `null`, `List[String]`, `Map[String, String]` or a function. + // + // - If it is `null`, the state will be replaced with the output of the module. + // - If it is a `List[String]`, the state will be updated with the values of the data at the given keys. + // - If it is a `Map[String, String]`, the state will be updated with the values of the data at the given keys, with the keys renamed according to the map. + // - If it is a function, a tuple (`[id, output, state]`) will be passed to the function, and the result will be used as the new state. + // + // Example: `{ id, output, state -> state + [counts: state.output] }` + // Default: `{ id, output, state -> output }` + toState: null, + + // Whether or not to print debug messages + // Default: `false` + debug: false +] + +// initialise default workflow +meta["workflow"] = workflowFactory([key: meta.config.name], meta.defaults, meta) + +// add workflow to environment +nextflow.script.ScriptMeta.current().addDefinition(meta.workflow) + +// anonymous workflow for running this module as a standalone +workflow { + // add id argument if it's not already in the config + // TODO: deep copy + def newConfig = deepClone(meta.config) + def newParams = deepClone(params) + + def argsContainsId = newConfig.allArguments.any{it.plainName == "id"} + if (!argsContainsId) { + def idArg = [ + 'name': '--id', + 'required': false, + 'type': 'string', + 'description': 'A unique id for every entry.', + 'multiple': false + ] + newConfig.arguments.add(0, idArg) + newConfig = processConfig(newConfig) + } + if (!newParams.containsKey("id")) { + newParams.id = "run" + } + + helpMessage(newConfig) + + channelFromParams(newParams, newConfig) + // make sure id is not in the state if id is not in the args + | map {id, state -> + if (!argsContainsId) { + [id, state.findAll{k, v -> k != "id"}] + } else { + [id, state] + } + } + | meta.workflow.run( + auto: [ publish: "state" ] + ) +} + +// END COMPONENT-SPECIFIC CODE diff --git a/target/dependencies/vsh/vsh/openpipeline/v4.1.0/nextflow/filter/intersect_obs/nextflow.config b/target/dependencies/vsh/vsh/openpipeline/v4.1.0/nextflow/filter/intersect_obs/nextflow.config new file mode 100644 index 0000000..f29d9d2 --- /dev/null +++ b/target/dependencies/vsh/vsh/openpipeline/v4.1.0/nextflow/filter/intersect_obs/nextflow.config @@ -0,0 +1,126 @@ +manifest { + name = 'filter/intersect_obs' + mainScript = 'main.nf' + nextflowVersion = '!>=20.12.1-edge' + version = 'v4.1.0' + description = 'Create an intersection between two or more modalities.\n\nThis component removes any observations which are not present in all modalities.\n' + author = 'Dries Schaumont, Isabelle Bergiers' +} + +process.container = 'nextflow/bash:latest' + +// detect tempdir +tempDir = java.nio.file.Paths.get( + System.getenv('NXF_TEMP') ?: + System.getenv('VIASH_TEMP') ?: + System.getenv('TEMPDIR') ?: + System.getenv('TMPDIR') ?: + '/tmp' +).toAbsolutePath() + +profiles { + no_publish { + process { + withName: '.*' { + publishDir = [ + enabled: false + ] + } + } + } + mount_temp { + docker.temp = tempDir + podman.temp = tempDir + charliecloud.temp = tempDir + } + docker { + docker.enabled = true + // docker.userEmulation = true + singularity.enabled = false + podman.enabled = false + shifter.enabled = false + charliecloud.enabled = false + } + singularity { + singularity.enabled = true + singularity.autoMounts = true + docker.enabled = false + podman.enabled = false + shifter.enabled = false + charliecloud.enabled = false + } + podman { + podman.enabled = true + docker.enabled = false + singularity.enabled = false + shifter.enabled = false + charliecloud.enabled = false + } + shifter { + shifter.enabled = true + docker.enabled = false + singularity.enabled = false + podman.enabled = false + charliecloud.enabled = false + } + charliecloud { + charliecloud.enabled = true + docker.enabled = false + singularity.enabled = false + podman.enabled = false + shifter.enabled = false + } +} + +process{ + withLabel: mem1gb { memory = 1000000000.B } + withLabel: mem2gb { memory = 2000000000.B } + withLabel: mem5gb { memory = 5000000000.B } + withLabel: mem10gb { memory = 10000000000.B } + withLabel: mem20gb { memory = 20000000000.B } + withLabel: mem50gb { memory = 50000000000.B } + withLabel: mem100gb { memory = 100000000000.B } + withLabel: mem200gb { memory = 200000000000.B } + withLabel: mem500gb { memory = 500000000000.B } + withLabel: mem1tb { memory = 1000000000000.B } + withLabel: mem2tb { memory = 2000000000000.B } + withLabel: mem5tb { memory = 5000000000000.B } + withLabel: mem10tb { memory = 10000000000000.B } + withLabel: mem20tb { memory = 20000000000000.B } + withLabel: mem50tb { memory = 50000000000000.B } + withLabel: mem100tb { memory = 100000000000000.B } + withLabel: mem200tb { memory = 200000000000000.B } + withLabel: mem500tb { memory = 500000000000000.B } + withLabel: mem1gib { memory = 1073741824.B } + withLabel: mem2gib { memory = 2147483648.B } + withLabel: mem4gib { memory = 4294967296.B } + withLabel: mem8gib { memory = 8589934592.B } + withLabel: mem16gib { memory = 17179869184.B } + withLabel: mem32gib { memory = 34359738368.B } + withLabel: mem64gib { memory = 68719476736.B } + withLabel: mem128gib { memory = 137438953472.B } + withLabel: mem256gib { memory = 274877906944.B } + withLabel: mem512gib { memory = 549755813888.B } + withLabel: mem1tib { memory = 1099511627776.B } + withLabel: mem2tib { memory = 2199023255552.B } + withLabel: mem4tib { memory = 4398046511104.B } + withLabel: mem8tib { memory = 8796093022208.B } + withLabel: mem16tib { memory = 17592186044416.B } + withLabel: mem32tib { memory = 35184372088832.B } + withLabel: mem64tib { memory = 70368744177664.B } + withLabel: mem128tib { memory = 140737488355328.B } + withLabel: mem256tib { memory = 281474976710656.B } + withLabel: mem512tib { memory = 562949953421312.B } + withLabel: cpu1 { cpus = 1 } + withLabel: cpu2 { cpus = 2 } + withLabel: cpu5 { cpus = 5 } + withLabel: cpu10 { cpus = 10 } + withLabel: cpu20 { cpus = 20 } + withLabel: cpu50 { cpus = 50 } + withLabel: cpu100 { cpus = 100 } + withLabel: cpu200 { cpus = 200 } + withLabel: cpu500 { cpus = 500 } + withLabel: cpu1000 { cpus = 1000 } +} + +includeConfig("nextflow_labels.config") diff --git a/target/dependencies/vsh/vsh/openpipeline/v4.0.3/nextflow/metadata/grep_annotation_column/nextflow_labels.config b/target/dependencies/vsh/vsh/openpipeline/v4.1.0/nextflow/filter/intersect_obs/nextflow_labels.config similarity index 100% rename from target/dependencies/vsh/vsh/openpipeline/v4.0.3/nextflow/metadata/grep_annotation_column/nextflow_labels.config rename to target/dependencies/vsh/vsh/openpipeline/v4.1.0/nextflow/filter/intersect_obs/nextflow_labels.config diff --git a/target/dependencies/vsh/vsh/openpipeline/v4.1.0/nextflow/filter/intersect_obs/nextflow_schema.json b/target/dependencies/vsh/vsh/openpipeline/v4.1.0/nextflow/filter/intersect_obs/nextflow_schema.json new file mode 100644 index 0000000..d2bac93 --- /dev/null +++ b/target/dependencies/vsh/vsh/openpipeline/v4.1.0/nextflow/filter/intersect_obs/nextflow_schema.json @@ -0,0 +1,66 @@ +{ + "$schema": "https://json-schema.org/draft/2020-12/schema", + "title": "intersect_obs", + "description": "Create an intersection between two or more modalities.\n\nThis component removes any observations which are not present in all modalities.\n", + "type": "object", + "$defs": { + "arguments": { + "title": "Arguments", + "type": "object", + "description": "No description", + "properties": { + "input": { + "type": "string", + "format": "path", + "exists": true, + "description": "Input h5mu file", + "help_text": "Type: `file`, multiple: `False`, required, direction: `input`, example: `\"input.h5mu\"`. " + }, + "modalities": { + "type": "array", + "items": { + "type": "string" + }, + "description": "Which modalities from the input MuData file to process.\n", + "help_text": "Type: `string`, multiple: `True`, required, example: `[\"rna\";\"prot\"]`. " + }, + "output": { + "type": "string", + "format": "path", + "description": "Output h5mu file.", + "help_text": "Type: `file`, multiple: `False`, default: `\"$id.$key.output.h5mu\"`, direction: `output`, example: `\"output.h5mu\"`. ", + "default": "$id.$key.output.h5mu" + }, + "output_compression": { + "type": "string", + "description": "Compression format to use for the output AnnData and/or Mudata H5 files.\nBy default no compression is applied.\n", + "help_text": "Type: `string`, multiple: `False`, example: `\"gzip\"`, choices: ``gzip`, `lzf``. ", + "enum": [ + "gzip", + "lzf" + ] + } + } + }, + "nextflow input-output arguments": { + "title": "Nextflow input-output arguments", + "type": "object", + "description": "Input/output parameters for Nextflow itself. Please note that both publishDir and publish_dir are supported but at least one has to be configured.", + "properties": { + "publish_dir": { + "type": "string", + "description": "Path to an output directory.", + "help_text": "Type: `string`, multiple: `False`, required, example: `\"output/\"`. " + } + } + } + }, + "allOf": [ + { + "$ref": "#/$defs/arguments" + }, + { + "$ref": "#/$defs/nextflow input-output arguments" + } + ] +} diff --git a/target/dependencies/vsh/vsh/openpipeline/v4.0.3/nextflow/metadata/add_id/setup_logger.py b/target/dependencies/vsh/vsh/openpipeline/v4.1.0/nextflow/filter/intersect_obs/setup_logger.py similarity index 100% rename from target/dependencies/vsh/vsh/openpipeline/v4.0.3/nextflow/metadata/add_id/setup_logger.py rename to target/dependencies/vsh/vsh/openpipeline/v4.1.0/nextflow/filter/intersect_obs/setup_logger.py diff --git a/target/dependencies/vsh/vsh/openpipeline/v4.0.3/nextflow/metadata/add_id/.config.vsh.yaml b/target/dependencies/vsh/vsh/openpipeline/v4.1.0/nextflow/metadata/add_id/.config.vsh.yaml similarity index 95% rename from target/dependencies/vsh/vsh/openpipeline/v4.0.3/nextflow/metadata/add_id/.config.vsh.yaml rename to target/dependencies/vsh/vsh/openpipeline/v4.1.0/nextflow/metadata/add_id/.config.vsh.yaml index 1ae5e86..50bf6e6 100644 --- a/target/dependencies/vsh/vsh/openpipeline/v4.0.3/nextflow/metadata/add_id/.config.vsh.yaml +++ b/target/dependencies/vsh/vsh/openpipeline/v4.1.0/nextflow/metadata/add_id/.config.vsh.yaml @@ -1,6 +1,6 @@ name: "add_id" namespace: "metadata" -version: "v4.0.3" +version: "v4.1.0" authors: - name: "Dries Schaumont" roles: @@ -26,7 +26,7 @@ argument_groups: description: "Path to the input .h5mu." info: null example: - - "sample_path" + - "input.h5mu" must_exist: true create_parent: true required: true @@ -72,8 +72,8 @@ argument_groups: direction: "input" - type: "string" name: "--output_compression" - description: "Compression format to use for the output AnnData and/or Mudata objects.\n\ - By default no compression is applied.\n" + description: "Compression format to use for the output AnnData and/or Mudata H5\ + \ files.\nBy default no compression is applied.\n" info: null example: - "gzip" @@ -185,7 +185,7 @@ engines: id: "docker" image: "python:3.11-slim" target_registry: "images.viash-hub.com" - target_tag: "v4.0.3" + target_tag: "v4.1.0" namespace_separator: "/" setup: - type: "apt" @@ -195,9 +195,10 @@ engines: - type: "python" user: false packages: - - "anndata~=0.12.7" + - "anndata~=0.12.16" - "awkward" - - "mudata~=0.3.2" + - "scipy~=1.17.1" + - "mudata~=0.3.8" script: - "exec(\"try:\\n import zarr; from importlib.metadata import version\\nexcept\ \ ModuleNotFoundError:\\n exit(0)\\nelse: assert int(version(\\\"zarr\\\"\ @@ -211,7 +212,7 @@ engines: - type: "python" user: false packages: - - "viashpy==0.8.0" + - "viashpy==0.10.0" github: - "openpipelines-bio/core#subdirectory=packages/python/openpipeline_testutils" upgrade: true @@ -225,12 +226,12 @@ build_info: engine: "docker|native" output: "target/nextflow/metadata/add_id" executable: "target/nextflow/metadata/add_id/main.nf" - viash_version: "0.9.4" - git_commit: "7bfad4ea12f87eca59213be3ab08deff67cc4206" + viash_version: "0.9.7" + git_commit: "a6499fddaa8553874585c747370f919f4d7b729c" git_remote: "https://github.com/openpipelines-bio/openpipeline" package_config: name: "openpipeline" - version: "v4.0.3" + version: "v4.1.0" summary: "Best-practice workflows for single-cell multi-omics analyses.\n" description: "OpenPipelines are extensible single cell analysis pipelines for reproducible\ \ and large-scale single cell processing using [Viash](https://viash.io) and [Nextflow](https://www.nextflow.io/).\n\ @@ -251,7 +252,7 @@ package_config: - path: "src/workflows/utils/labels_ci.config" description: "Adds the correct memory and CPU labels when running on the Viash\ \ Hub CI." - viash_version: "0.9.4" + viash_version: "0.9.7" source: "src" target: "target" config_mods: @@ -260,7 +261,7 @@ package_config: )'" - ".engines += { type: \"native\" }" - ".engines[.type == 'docker'].target_registry := 'images.viash-hub.com'" - - ".engines[.type == 'docker'].target_tag := 'v4.0.3'" + - ".engines[.type == 'docker'].target_tag := 'v4.1.0'" keywords: - "single-cell" - "multimodal" diff --git a/target/dependencies/vsh/vsh/openpipeline/v4.0.3/nextflow/metadata/add_id/main.nf b/target/dependencies/vsh/vsh/openpipeline/v4.1.0/nextflow/metadata/add_id/main.nf similarity index 98% rename from target/dependencies/vsh/vsh/openpipeline/v4.0.3/nextflow/metadata/add_id/main.nf rename to target/dependencies/vsh/vsh/openpipeline/v4.1.0/nextflow/metadata/add_id/main.nf index d280c89..e5b9058 100644 --- a/target/dependencies/vsh/vsh/openpipeline/v4.0.3/nextflow/metadata/add_id/main.nf +++ b/target/dependencies/vsh/vsh/openpipeline/v4.1.0/nextflow/metadata/add_id/main.nf @@ -1,6 +1,6 @@ -// add_id v4.0.3 +// add_id v4.1.0 // -// This wrapper script is auto-generated by viash 0.9.4 and is thus a derivative +// This wrapper script is auto-generated by viash 0.9.7 and is thus a derivative // work thereof. This software comes with ABSOLUTELY NO WARRANTY from Data // Intuitive. // @@ -1353,47 +1353,42 @@ def readCsv(file_path) { def splitRegex = java.util.regex.Pattern.compile(''',(?=(?:[^"]*"[^"]*")*[^"]*$)''') def removeQuote = java.util.regex.Pattern.compile('''"(.*)"''') - def br = java.nio.file.Files.newBufferedReader(inputFile) + java.nio.file.Files.newBufferedReader(inputFile).withCloseable { br -> + def row = 0 + def header = null + def line - def row = -1 - def header = null - while (br.ready() && header == null) { - def line = br.readLine() - row++ - if (!line.startsWith("#")) { - header = splitRegex.split(line, -1).collect{field -> - m = removeQuote.matcher(field) - m.find() ? m.replaceFirst('$1') : field - } - } - } - assert header != null: "CSV file should contain a header" - - while (br.ready()) { - def line = br.readLine() - row++ - if (line == null) { - br.close() - break - } - - if (!line.startsWith("#")) { - def predata = splitRegex.split(line, -1) - def data = predata.collect{field -> - if (field == "") { - return null - } - def m = removeQuote.matcher(field) - if (m.find()) { - return m.replaceFirst('$1') - } else { - return field + while (header == null && (line = br.readLine()) != null) { + if (!line.startsWith("#")) { + header = splitRegex.split(line, -1).collect { field -> + def m = removeQuote.matcher(field) + m.find() ? m.replaceFirst('$1') : field } } - assert header.size() == data.size(): "Row $row should contain the same number as fields as the header" - - def dataMap = [header, data].transpose().collectEntries().findAll{it.value != null} - output.add(dataMap) + row++ + } + assert header != null : "CSV file should contain a header" + + while ((line = br.readLine()) != null) { + row++ + if (!line.startsWith("#")) { + def predata = splitRegex.split(line, -1) + def data = predata.collect { field -> + if (field == "") { + return null + } + def m = removeQuote.matcher(field) + if (m.find()) { + return m.replaceFirst('$1') + } else { + return field + } + } + assert header.size() == data.size() : "Row $row should contain the same number as fields as the header" + + def dataMap = [header, data].transpose().collectEntries().findAll { it.value != null } + output.add(dataMap) + } } } @@ -1709,10 +1704,25 @@ process publishFilesProc { ] .transpose() .collectMany{infile, outfile -> - if (infile.toString() != outfile.toString()) { + def infileString = infile.toString() + def outfileString = outfile.toString() + if (infileString != outfileString) { + /* Trailing slashes are removed from both the source and destination arguments. + From source arguments, this is useful when a source argument may have a trailing slash + and specify a symbolic link to a directory. Without removing the slash, cp will dereference + the symbolic link. + See https://www.gnu.org/software/coreutils/manual/html_node/Trailing-slashes.html#Trailing-slashes-1 + + For the destination path addding a trailing slash is a problem when publishing directories: + it requires the destination directory to exist. This fails because we only create the parent + directories first. + */ + def regexTrailingSlashes = ~/\/+$/ + def infileNoTrailingSlash = infileString - regexTrailingSlashes + def outfileNoTrailingSlash = outfileString - regexTrailingSlashes [ - "[ -d \"\$(dirname '${outfile.toString()}')\" ] || mkdir -p \"\$(dirname '${outfile.toString()}')\"", - "cp -r '${infile.toString()}' '${outfile.toString()}'" + "[ -d \"\$(dirname '${outfileNoTrailingSlash}')\" ] || mkdir -p \"\$(dirname '${outfileNoTrailingSlash}')\"", + "cp -a '${infileNoTrailingSlash}' '${outfileNoTrailingSlash}'" ] } else { // no need to copy if infile is the same as outfile @@ -3035,7 +3045,7 @@ meta = [ "config": processConfig(readJsonBlob('''{ "name" : "add_id", "namespace" : "metadata", - "version" : "v4.0.3", + "version" : "v4.1.0", "authors" : [ { "name" : "Dries Schaumont", @@ -3072,7 +3082,7 @@ meta = [ ], "description" : "Path to the input .h5mu.", "example" : [ - "sample_path" + "input.h5mu" ], "must_exist" : true, "create_parent" : true, @@ -3128,7 +3138,7 @@ meta = [ { "type" : "string", "name" : "--output_compression", - "description" : "Compression format to use for the output AnnData and/or Mudata objects.\nBy default no compression is applied.\n", + "description" : "Compression format to use for the output AnnData and/or Mudata H5 files.\nBy default no compression is applied.\n", "example" : [ "gzip" ], @@ -3269,7 +3279,7 @@ meta = [ "id" : "docker", "image" : "python:3.11-slim", "target_registry" : "images.viash-hub.com", - "target_tag" : "v4.0.3", + "target_tag" : "v4.1.0", "namespace_separator" : "/", "setup" : [ { @@ -3283,9 +3293,10 @@ meta = [ "type" : "python", "user" : false, "packages" : [ - "anndata~=0.12.7", + "anndata~=0.12.16", "awkward", - "mudata~=0.3.2" + "scipy~=1.17.1", + "mudata~=0.3.8" ], "script" : [ "exec(\\"try:\\\\n import zarr; from importlib.metadata import version\\\\nexcept ModuleNotFoundError:\\\\n exit(0)\\\\nelse: assert int(version(\\\\\\"zarr\\\\\\").partition(\\\\\\".\\\\\\")[0]) > 2\\")" @@ -3305,7 +3316,7 @@ meta = [ "type" : "python", "user" : false, "packages" : [ - "viashpy==0.8.0" + "viashpy==0.10.0" ], "github" : [ "openpipelines-bio/core#subdirectory=packages/python/openpipeline_testutils" @@ -3324,13 +3335,13 @@ meta = [ "runner" : "nextflow", "engine" : "docker|native", "output" : "/workdir/root/repo/target/nextflow/metadata/add_id", - "viash_version" : "0.9.4", - "git_commit" : "7bfad4ea12f87eca59213be3ab08deff67cc4206", + "viash_version" : "0.9.7", + "git_commit" : "a6499fddaa8553874585c747370f919f4d7b729c", "git_remote" : "https://github.com/openpipelines-bio/openpipeline" }, "package_config" : { "name" : "openpipeline", - "version" : "v4.0.3", + "version" : "v4.1.0", "summary" : "Best-practice workflows for single-cell multi-omics analyses.\n", "description" : "OpenPipelines are extensible single cell analysis pipelines for reproducible and large-scale single cell processing using [Viash](https://viash.io) and [Nextflow](https://www.nextflow.io/).\n\nIn terms of workflows, the following has been made available, but keep in mind that\nindividual tools and functionality can be executed as standalone components as well.\n\n * Demultiplexing: conversion of raw sequencing data to FASTQ objects.\n * Ingestion: Read mapping and generating a count matrix.\n * Single sample processing: cell filtering and doublet detection.\n * Multisample processing: Count transformation, normalization, QC metric calulations.\n * Integration: Clustering, integration and batch correction using single and multimodal methods.\n * Downstream analysis workflows\n", "info" : { @@ -3348,14 +3359,14 @@ meta = [ } ] }, - "viash_version" : "0.9.4", + "viash_version" : "0.9.7", "source" : "/workdir/root/repo/src", "target" : "/workdir/root/repo/target", "config_mods" : [ ".resources += {path: '/src/workflows/utils/labels.config', dest: 'nextflow_labels.config'}\n.runners[.type == 'nextflow'].config.script := 'includeConfig(\\"nextflow_labels.config\\")'", ".engines += { type: \\"native\\" }", ".engines[.type == 'docker'].target_registry := 'images.viash-hub.com'", - ".engines[.type == 'docker'].target_tag := 'v4.0.3'" + ".engines[.type == 'docker'].target_tag := 'v4.1.0'" ], "keywords" : [ "single-cell", @@ -3871,7 +3882,7 @@ meta["defaults"] = [ "container" : { "registry" : "images.viash-hub.com", "image" : "vsh/openpipeline/metadata/add_id", - "tag" : "v4.0.3" + "tag" : "v4.1.0" }, "label" : [ "singlecpu", diff --git a/target/dependencies/vsh/vsh/openpipeline/v4.0.3/nextflow/metadata/add_id/nextflow.config b/target/dependencies/vsh/vsh/openpipeline/v4.1.0/nextflow/metadata/add_id/nextflow.config similarity index 99% rename from target/dependencies/vsh/vsh/openpipeline/v4.0.3/nextflow/metadata/add_id/nextflow.config rename to target/dependencies/vsh/vsh/openpipeline/v4.1.0/nextflow/metadata/add_id/nextflow.config index 16c4363..d0468b9 100644 --- a/target/dependencies/vsh/vsh/openpipeline/v4.0.3/nextflow/metadata/add_id/nextflow.config +++ b/target/dependencies/vsh/vsh/openpipeline/v4.1.0/nextflow/metadata/add_id/nextflow.config @@ -2,7 +2,7 @@ manifest { name = 'metadata/add_id' mainScript = 'main.nf' nextflowVersion = '!>=20.12.1-edge' - version = 'v4.0.3' + version = 'v4.1.0' description = 'Add id of .obs. Also allows to make .obs_names (the .obs index) unique \nby prefixing the values with an unique id per .h5mu file.\n' author = 'Dries Schaumont' } diff --git a/target/dependencies/vsh/vsh/openpipeline/v4.0.3/nextflow/metadata/move_obsm_to_obs/nextflow_labels.config b/target/dependencies/vsh/vsh/openpipeline/v4.1.0/nextflow/metadata/add_id/nextflow_labels.config similarity index 100% rename from target/dependencies/vsh/vsh/openpipeline/v4.0.3/nextflow/metadata/move_obsm_to_obs/nextflow_labels.config rename to target/dependencies/vsh/vsh/openpipeline/v4.1.0/nextflow/metadata/add_id/nextflow_labels.config diff --git a/target/dependencies/vsh/vsh/openpipeline/v4.0.3/nextflow/metadata/add_id/nextflow_schema.json b/target/dependencies/vsh/vsh/openpipeline/v4.1.0/nextflow/metadata/add_id/nextflow_schema.json similarity index 95% rename from target/dependencies/vsh/vsh/openpipeline/v4.0.3/nextflow/metadata/add_id/nextflow_schema.json rename to target/dependencies/vsh/vsh/openpipeline/v4.1.0/nextflow/metadata/add_id/nextflow_schema.json index 83fcf94..8bf3c91 100644 --- a/target/dependencies/vsh/vsh/openpipeline/v4.0.3/nextflow/metadata/add_id/nextflow_schema.json +++ b/target/dependencies/vsh/vsh/openpipeline/v4.1.0/nextflow/metadata/add_id/nextflow_schema.json @@ -14,7 +14,7 @@ "format": "path", "exists": true, "description": "Path to the input .h5mu.", - "help_text": "Type: `file`, multiple: `False`, required, direction: `input`, example: `\"sample_path\"`. " + "help_text": "Type: `file`, multiple: `False`, required, direction: `input`, example: `\"input.h5mu\"`. " }, "input_id": { "type": "string", @@ -42,7 +42,7 @@ }, "output_compression": { "type": "string", - "description": "Compression format to use for the output AnnData and/or Mudata objects.\nBy default no compression is applied.\n", + "description": "Compression format to use for the output AnnData and/or Mudata H5 files.\nBy default no compression is applied.\n", "help_text": "Type: `string`, multiple: `False`, example: `\"gzip\"`, choices: ``gzip`, `lzf``. ", "enum": [ "gzip", diff --git a/target/dependencies/vsh/vsh/openpipeline/v4.0.3/nextflow/metadata/grep_annotation_column/setup_logger.py b/target/dependencies/vsh/vsh/openpipeline/v4.1.0/nextflow/metadata/add_id/setup_logger.py similarity index 100% rename from target/dependencies/vsh/vsh/openpipeline/v4.0.3/nextflow/metadata/grep_annotation_column/setup_logger.py rename to target/dependencies/vsh/vsh/openpipeline/v4.1.0/nextflow/metadata/add_id/setup_logger.py diff --git a/target/dependencies/vsh/vsh/openpipeline/v4.0.3/nextflow/metadata/grep_annotation_column/.config.vsh.yaml b/target/dependencies/vsh/vsh/openpipeline/v4.1.0/nextflow/metadata/grep_annotation_column/.config.vsh.yaml similarity index 95% rename from target/dependencies/vsh/vsh/openpipeline/v4.0.3/nextflow/metadata/grep_annotation_column/.config.vsh.yaml rename to target/dependencies/vsh/vsh/openpipeline/v4.1.0/nextflow/metadata/grep_annotation_column/.config.vsh.yaml index 2017432..577e69e 100644 --- a/target/dependencies/vsh/vsh/openpipeline/v4.0.3/nextflow/metadata/grep_annotation_column/.config.vsh.yaml +++ b/target/dependencies/vsh/vsh/openpipeline/v4.1.0/nextflow/metadata/grep_annotation_column/.config.vsh.yaml @@ -1,6 +1,6 @@ name: "grep_annotation_column" namespace: "metadata" -version: "v4.0.3" +version: "v4.1.0" authors: - name: "Dries Schaumont" roles: @@ -27,7 +27,7 @@ argument_groups: description: "Path to the input .h5mu." info: null example: - - "sample_path" + - "input.h5mu" must_exist: true create_parent: true required: true @@ -112,8 +112,8 @@ argument_groups: multiple_sep: ";" - type: "string" name: "--output_compression" - description: "Compression format to use for the output AnnData and/or Mudata objects.\n\ - By default no compression is applied.\n" + description: "Compression format to use for the output AnnData and/or Mudata H5\ + \ files.\nBy default no compression is applied.\n" info: null example: - "gzip" @@ -241,7 +241,7 @@ engines: id: "docker" image: "python:3.11-slim" target_registry: "images.viash-hub.com" - target_tag: "v4.0.3" + target_tag: "v4.1.0" namespace_separator: "/" setup: - type: "apt" @@ -251,9 +251,10 @@ engines: - type: "python" user: false packages: - - "anndata~=0.12.7" + - "anndata~=0.12.16" - "awkward" - - "mudata~=0.3.2" + - "scipy~=1.17.1" + - "mudata~=0.3.8" script: - "exec(\"try:\\n import zarr; from importlib.metadata import version\\nexcept\ \ ModuleNotFoundError:\\n exit(0)\\nelse: assert int(version(\\\"zarr\\\"\ @@ -267,7 +268,7 @@ engines: - type: "python" user: false packages: - - "viashpy==0.8.0" + - "viashpy==0.10.0" github: - "openpipelines-bio/core#subdirectory=packages/python/openpipeline_testutils" upgrade: true @@ -281,12 +282,12 @@ build_info: engine: "docker|native" output: "target/nextflow/metadata/grep_annotation_column" executable: "target/nextflow/metadata/grep_annotation_column/main.nf" - viash_version: "0.9.4" - git_commit: "7bfad4ea12f87eca59213be3ab08deff67cc4206" + viash_version: "0.9.7" + git_commit: "a6499fddaa8553874585c747370f919f4d7b729c" git_remote: "https://github.com/openpipelines-bio/openpipeline" package_config: name: "openpipeline" - version: "v4.0.3" + version: "v4.1.0" summary: "Best-practice workflows for single-cell multi-omics analyses.\n" description: "OpenPipelines are extensible single cell analysis pipelines for reproducible\ \ and large-scale single cell processing using [Viash](https://viash.io) and [Nextflow](https://www.nextflow.io/).\n\ @@ -307,7 +308,7 @@ package_config: - path: "src/workflows/utils/labels_ci.config" description: "Adds the correct memory and CPU labels when running on the Viash\ \ Hub CI." - viash_version: "0.9.4" + viash_version: "0.9.7" source: "src" target: "target" config_mods: @@ -316,7 +317,7 @@ package_config: )'" - ".engines += { type: \"native\" }" - ".engines[.type == 'docker'].target_registry := 'images.viash-hub.com'" - - ".engines[.type == 'docker'].target_tag := 'v4.0.3'" + - ".engines[.type == 'docker'].target_tag := 'v4.1.0'" keywords: - "single-cell" - "multimodal" diff --git a/target/dependencies/vsh/vsh/openpipeline/v4.0.3/nextflow/metadata/move_obsm_to_obs/compress_h5mu.py b/target/dependencies/vsh/vsh/openpipeline/v4.1.0/nextflow/metadata/grep_annotation_column/compress_h5mu.py similarity index 100% rename from target/dependencies/vsh/vsh/openpipeline/v4.0.3/nextflow/metadata/move_obsm_to_obs/compress_h5mu.py rename to target/dependencies/vsh/vsh/openpipeline/v4.1.0/nextflow/metadata/grep_annotation_column/compress_h5mu.py diff --git a/target/dependencies/vsh/vsh/openpipeline/v4.0.3/nextflow/metadata/grep_annotation_column/main.nf b/target/dependencies/vsh/vsh/openpipeline/v4.1.0/nextflow/metadata/grep_annotation_column/main.nf similarity index 98% rename from target/dependencies/vsh/vsh/openpipeline/v4.0.3/nextflow/metadata/grep_annotation_column/main.nf rename to target/dependencies/vsh/vsh/openpipeline/v4.1.0/nextflow/metadata/grep_annotation_column/main.nf index 4133cfa..37a8d86 100644 --- a/target/dependencies/vsh/vsh/openpipeline/v4.0.3/nextflow/metadata/grep_annotation_column/main.nf +++ b/target/dependencies/vsh/vsh/openpipeline/v4.1.0/nextflow/metadata/grep_annotation_column/main.nf @@ -1,6 +1,6 @@ -// grep_annotation_column v4.0.3 +// grep_annotation_column v4.1.0 // -// This wrapper script is auto-generated by viash 0.9.4 and is thus a derivative +// This wrapper script is auto-generated by viash 0.9.7 and is thus a derivative // work thereof. This software comes with ABSOLUTELY NO WARRANTY from Data // Intuitive. // @@ -1353,47 +1353,42 @@ def readCsv(file_path) { def splitRegex = java.util.regex.Pattern.compile(''',(?=(?:[^"]*"[^"]*")*[^"]*$)''') def removeQuote = java.util.regex.Pattern.compile('''"(.*)"''') - def br = java.nio.file.Files.newBufferedReader(inputFile) + java.nio.file.Files.newBufferedReader(inputFile).withCloseable { br -> + def row = 0 + def header = null + def line - def row = -1 - def header = null - while (br.ready() && header == null) { - def line = br.readLine() - row++ - if (!line.startsWith("#")) { - header = splitRegex.split(line, -1).collect{field -> - m = removeQuote.matcher(field) - m.find() ? m.replaceFirst('$1') : field - } - } - } - assert header != null: "CSV file should contain a header" - - while (br.ready()) { - def line = br.readLine() - row++ - if (line == null) { - br.close() - break - } - - if (!line.startsWith("#")) { - def predata = splitRegex.split(line, -1) - def data = predata.collect{field -> - if (field == "") { - return null - } - def m = removeQuote.matcher(field) - if (m.find()) { - return m.replaceFirst('$1') - } else { - return field + while (header == null && (line = br.readLine()) != null) { + if (!line.startsWith("#")) { + header = splitRegex.split(line, -1).collect { field -> + def m = removeQuote.matcher(field) + m.find() ? m.replaceFirst('$1') : field } } - assert header.size() == data.size(): "Row $row should contain the same number as fields as the header" - - def dataMap = [header, data].transpose().collectEntries().findAll{it.value != null} - output.add(dataMap) + row++ + } + assert header != null : "CSV file should contain a header" + + while ((line = br.readLine()) != null) { + row++ + if (!line.startsWith("#")) { + def predata = splitRegex.split(line, -1) + def data = predata.collect { field -> + if (field == "") { + return null + } + def m = removeQuote.matcher(field) + if (m.find()) { + return m.replaceFirst('$1') + } else { + return field + } + } + assert header.size() == data.size() : "Row $row should contain the same number as fields as the header" + + def dataMap = [header, data].transpose().collectEntries().findAll { it.value != null } + output.add(dataMap) + } } } @@ -1709,10 +1704,25 @@ process publishFilesProc { ] .transpose() .collectMany{infile, outfile -> - if (infile.toString() != outfile.toString()) { + def infileString = infile.toString() + def outfileString = outfile.toString() + if (infileString != outfileString) { + /* Trailing slashes are removed from both the source and destination arguments. + From source arguments, this is useful when a source argument may have a trailing slash + and specify a symbolic link to a directory. Without removing the slash, cp will dereference + the symbolic link. + See https://www.gnu.org/software/coreutils/manual/html_node/Trailing-slashes.html#Trailing-slashes-1 + + For the destination path addding a trailing slash is a problem when publishing directories: + it requires the destination directory to exist. This fails because we only create the parent + directories first. + */ + def regexTrailingSlashes = ~/\/+$/ + def infileNoTrailingSlash = infileString - regexTrailingSlashes + def outfileNoTrailingSlash = outfileString - regexTrailingSlashes [ - "[ -d \"\$(dirname '${outfile.toString()}')\" ] || mkdir -p \"\$(dirname '${outfile.toString()}')\"", - "cp -r '${infile.toString()}' '${outfile.toString()}'" + "[ -d \"\$(dirname '${outfileNoTrailingSlash}')\" ] || mkdir -p \"\$(dirname '${outfileNoTrailingSlash}')\"", + "cp -a '${infileNoTrailingSlash}' '${outfileNoTrailingSlash}'" ] } else { // no need to copy if infile is the same as outfile @@ -3035,7 +3045,7 @@ meta = [ "config": processConfig(readJsonBlob('''{ "name" : "grep_annotation_column", "namespace" : "metadata", - "version" : "v4.0.3", + "version" : "v4.1.0", "authors" : [ { "name" : "Dries Schaumont", @@ -3073,7 +3083,7 @@ meta = [ ], "description" : "Path to the input .h5mu.", "example" : [ - "sample_path" + "input.h5mu" ], "must_exist" : true, "create_parent" : true, @@ -3172,7 +3182,7 @@ meta = [ { "type" : "string", "name" : "--output_compression", - "description" : "Compression format to use for the output AnnData and/or Mudata objects.\nBy default no compression is applied.\n", + "description" : "Compression format to use for the output AnnData and/or Mudata H5 files.\nBy default no compression is applied.\n", "example" : [ "gzip" ], @@ -3335,7 +3345,7 @@ meta = [ "id" : "docker", "image" : "python:3.11-slim", "target_registry" : "images.viash-hub.com", - "target_tag" : "v4.0.3", + "target_tag" : "v4.1.0", "namespace_separator" : "/", "setup" : [ { @@ -3349,9 +3359,10 @@ meta = [ "type" : "python", "user" : false, "packages" : [ - "anndata~=0.12.7", + "anndata~=0.12.16", "awkward", - "mudata~=0.3.2" + "scipy~=1.17.1", + "mudata~=0.3.8" ], "script" : [ "exec(\\"try:\\\\n import zarr; from importlib.metadata import version\\\\nexcept ModuleNotFoundError:\\\\n exit(0)\\\\nelse: assert int(version(\\\\\\"zarr\\\\\\").partition(\\\\\\".\\\\\\")[0]) > 2\\")" @@ -3371,7 +3382,7 @@ meta = [ "type" : "python", "user" : false, "packages" : [ - "viashpy==0.8.0" + "viashpy==0.10.0" ], "github" : [ "openpipelines-bio/core#subdirectory=packages/python/openpipeline_testutils" @@ -3390,13 +3401,13 @@ meta = [ "runner" : "nextflow", "engine" : "docker|native", "output" : "/workdir/root/repo/target/nextflow/metadata/grep_annotation_column", - "viash_version" : "0.9.4", - "git_commit" : "7bfad4ea12f87eca59213be3ab08deff67cc4206", + "viash_version" : "0.9.7", + "git_commit" : "a6499fddaa8553874585c747370f919f4d7b729c", "git_remote" : "https://github.com/openpipelines-bio/openpipeline" }, "package_config" : { "name" : "openpipeline", - "version" : "v4.0.3", + "version" : "v4.1.0", "summary" : "Best-practice workflows for single-cell multi-omics analyses.\n", "description" : "OpenPipelines are extensible single cell analysis pipelines for reproducible and large-scale single cell processing using [Viash](https://viash.io) and [Nextflow](https://www.nextflow.io/).\n\nIn terms of workflows, the following has been made available, but keep in mind that\nindividual tools and functionality can be executed as standalone components as well.\n\n * Demultiplexing: conversion of raw sequencing data to FASTQ objects.\n * Ingestion: Read mapping and generating a count matrix.\n * Single sample processing: cell filtering and doublet detection.\n * Multisample processing: Count transformation, normalization, QC metric calulations.\n * Integration: Clustering, integration and batch correction using single and multimodal methods.\n * Downstream analysis workflows\n", "info" : { @@ -3414,14 +3425,14 @@ meta = [ } ] }, - "viash_version" : "0.9.4", + "viash_version" : "0.9.7", "source" : "/workdir/root/repo/src", "target" : "/workdir/root/repo/target", "config_mods" : [ ".resources += {path: '/src/workflows/utils/labels.config', dest: 'nextflow_labels.config'}\n.runners[.type == 'nextflow'].config.script := 'includeConfig(\\"nextflow_labels.config\\")'", ".engines += { type: \\"native\\" }", ".engines[.type == 'docker'].target_registry := 'images.viash-hub.com'", - ".engines[.type == 'docker'].target_tag := 'v4.0.3'" + ".engines[.type == 'docker'].target_tag := 'v4.1.0'" ], "keywords" : [ "single-cell", @@ -4010,7 +4021,7 @@ meta["defaults"] = [ "container" : { "registry" : "images.viash-hub.com", "image" : "vsh/openpipeline/metadata/grep_annotation_column", - "tag" : "v4.0.3" + "tag" : "v4.1.0" }, "label" : [ "singlecpu", diff --git a/target/dependencies/vsh/vsh/openpipeline/v4.0.3/nextflow/metadata/grep_annotation_column/nextflow.config b/target/dependencies/vsh/vsh/openpipeline/v4.1.0/nextflow/metadata/grep_annotation_column/nextflow.config similarity index 99% rename from target/dependencies/vsh/vsh/openpipeline/v4.0.3/nextflow/metadata/grep_annotation_column/nextflow.config rename to target/dependencies/vsh/vsh/openpipeline/v4.1.0/nextflow/metadata/grep_annotation_column/nextflow.config index f80179a..9395988 100644 --- a/target/dependencies/vsh/vsh/openpipeline/v4.0.3/nextflow/metadata/grep_annotation_column/nextflow.config +++ b/target/dependencies/vsh/vsh/openpipeline/v4.1.0/nextflow/metadata/grep_annotation_column/nextflow.config @@ -2,7 +2,7 @@ manifest { name = 'metadata/grep_annotation_column' mainScript = 'main.nf' nextflowVersion = '!>=20.12.1-edge' - version = 'v4.0.3' + version = 'v4.1.0' description = 'Perform a regex lookup on a column from the annotation matrices .obs or .var.\nThe annotation matrix can originate from either a modality, or all modalities (global .var or .obs).\n' author = 'Dries Schaumont' } diff --git a/target/dependencies/vsh/vsh/openpipeline/v4.0.3/nextflow/neighbors/find_neighbors/nextflow_labels.config b/target/dependencies/vsh/vsh/openpipeline/v4.1.0/nextflow/metadata/grep_annotation_column/nextflow_labels.config similarity index 100% rename from target/dependencies/vsh/vsh/openpipeline/v4.0.3/nextflow/neighbors/find_neighbors/nextflow_labels.config rename to target/dependencies/vsh/vsh/openpipeline/v4.1.0/nextflow/metadata/grep_annotation_column/nextflow_labels.config diff --git a/target/dependencies/vsh/vsh/openpipeline/v4.0.3/nextflow/metadata/grep_annotation_column/nextflow_schema.json b/target/dependencies/vsh/vsh/openpipeline/v4.1.0/nextflow/metadata/grep_annotation_column/nextflow_schema.json similarity index 96% rename from target/dependencies/vsh/vsh/openpipeline/v4.0.3/nextflow/metadata/grep_annotation_column/nextflow_schema.json rename to target/dependencies/vsh/vsh/openpipeline/v4.1.0/nextflow/metadata/grep_annotation_column/nextflow_schema.json index ff552cb..8268784 100644 --- a/target/dependencies/vsh/vsh/openpipeline/v4.0.3/nextflow/metadata/grep_annotation_column/nextflow_schema.json +++ b/target/dependencies/vsh/vsh/openpipeline/v4.1.0/nextflow/metadata/grep_annotation_column/nextflow_schema.json @@ -14,7 +14,7 @@ "format": "path", "exists": true, "description": "Path to the input .h5mu.", - "help_text": "Type: `file`, multiple: `False`, required, direction: `input`, example: `\"sample_path\"`. " + "help_text": "Type: `file`, multiple: `False`, required, direction: `input`, example: `\"input.h5mu\"`. " }, "input_column": { "type": "string", @@ -66,7 +66,7 @@ }, "output_compression": { "type": "string", - "description": "Compression format to use for the output AnnData and/or Mudata objects.\nBy default no compression is applied.\n", + "description": "Compression format to use for the output AnnData and/or Mudata H5 files.\nBy default no compression is applied.\n", "help_text": "Type: `string`, multiple: `False`, example: `\"gzip\"`, choices: ``gzip`, `lzf``. ", "enum": [ "gzip", diff --git a/target/dependencies/vsh/vsh/openpipeline/v4.0.3/nextflow/metadata/move_obsm_to_obs/setup_logger.py b/target/dependencies/vsh/vsh/openpipeline/v4.1.0/nextflow/metadata/grep_annotation_column/setup_logger.py similarity index 100% rename from target/dependencies/vsh/vsh/openpipeline/v4.0.3/nextflow/metadata/move_obsm_to_obs/setup_logger.py rename to target/dependencies/vsh/vsh/openpipeline/v4.1.0/nextflow/metadata/grep_annotation_column/setup_logger.py diff --git a/target/dependencies/vsh/vsh/openpipeline/v4.0.3/nextflow/metadata/move_obsm_to_obs/.config.vsh.yaml b/target/dependencies/vsh/vsh/openpipeline/v4.1.0/nextflow/metadata/move_obsm_to_obs/.config.vsh.yaml similarity index 95% rename from target/dependencies/vsh/vsh/openpipeline/v4.0.3/nextflow/metadata/move_obsm_to_obs/.config.vsh.yaml rename to target/dependencies/vsh/vsh/openpipeline/v4.1.0/nextflow/metadata/move_obsm_to_obs/.config.vsh.yaml index b04b8ad..d82d6e1 100644 --- a/target/dependencies/vsh/vsh/openpipeline/v4.0.3/nextflow/metadata/move_obsm_to_obs/.config.vsh.yaml +++ b/target/dependencies/vsh/vsh/openpipeline/v4.1.0/nextflow/metadata/move_obsm_to_obs/.config.vsh.yaml @@ -1,6 +1,6 @@ name: "move_obsm_to_obs" namespace: "metadata" -version: "v4.0.3" +version: "v4.1.0" authors: - name: "Dries Schaumont" roles: @@ -69,8 +69,8 @@ argument_groups: multiple_sep: ";" - type: "string" name: "--output_compression" - description: "Compression format to use for the output AnnData and/or Mudata objects.\n\ - By default no compression is applied.\n" + description: "Compression format to use for the output AnnData and/or Mudata H5\ + \ files.\nBy default no compression is applied.\n" info: null example: - "gzip" @@ -183,7 +183,7 @@ engines: id: "docker" image: "python:3.12-slim" target_registry: "images.viash-hub.com" - target_tag: "v4.0.3" + target_tag: "v4.1.0" namespace_separator: "/" setup: - type: "apt" @@ -193,9 +193,10 @@ engines: - type: "python" user: false packages: - - "anndata~=0.12.7" + - "anndata~=0.12.16" - "awkward" - - "mudata~=0.3.2" + - "scipy~=1.17.1" + - "mudata~=0.3.8" script: - "exec(\"try:\\n import zarr; from importlib.metadata import version\\nexcept\ \ ModuleNotFoundError:\\n exit(0)\\nelse: assert int(version(\\\"zarr\\\"\ @@ -209,7 +210,7 @@ engines: - type: "python" user: false packages: - - "viashpy==0.8.0" + - "viashpy==0.10.0" github: - "openpipelines-bio/core#subdirectory=packages/python/openpipeline_testutils" upgrade: true @@ -223,12 +224,12 @@ build_info: engine: "docker|native" output: "target/nextflow/metadata/move_obsm_to_obs" executable: "target/nextflow/metadata/move_obsm_to_obs/main.nf" - viash_version: "0.9.4" - git_commit: "7bfad4ea12f87eca59213be3ab08deff67cc4206" + viash_version: "0.9.7" + git_commit: "a6499fddaa8553874585c747370f919f4d7b729c" git_remote: "https://github.com/openpipelines-bio/openpipeline" package_config: name: "openpipeline" - version: "v4.0.3" + version: "v4.1.0" summary: "Best-practice workflows for single-cell multi-omics analyses.\n" description: "OpenPipelines are extensible single cell analysis pipelines for reproducible\ \ and large-scale single cell processing using [Viash](https://viash.io) and [Nextflow](https://www.nextflow.io/).\n\ @@ -249,7 +250,7 @@ package_config: - path: "src/workflows/utils/labels_ci.config" description: "Adds the correct memory and CPU labels when running on the Viash\ \ Hub CI." - viash_version: "0.9.4" + viash_version: "0.9.7" source: "src" target: "target" config_mods: @@ -258,7 +259,7 @@ package_config: )'" - ".engines += { type: \"native\" }" - ".engines[.type == 'docker'].target_registry := 'images.viash-hub.com'" - - ".engines[.type == 'docker'].target_tag := 'v4.0.3'" + - ".engines[.type == 'docker'].target_tag := 'v4.1.0'" keywords: - "single-cell" - "multimodal" diff --git a/target/dependencies/vsh/vsh/openpipeline/v4.0.3/nextflow/neighbors/find_neighbors/compress_h5mu.py b/target/dependencies/vsh/vsh/openpipeline/v4.1.0/nextflow/metadata/move_obsm_to_obs/compress_h5mu.py similarity index 100% rename from target/dependencies/vsh/vsh/openpipeline/v4.0.3/nextflow/neighbors/find_neighbors/compress_h5mu.py rename to target/dependencies/vsh/vsh/openpipeline/v4.1.0/nextflow/metadata/move_obsm_to_obs/compress_h5mu.py diff --git a/target/dependencies/vsh/vsh/openpipeline/v4.0.3/nextflow/metadata/move_obsm_to_obs/main.nf b/target/dependencies/vsh/vsh/openpipeline/v4.1.0/nextflow/metadata/move_obsm_to_obs/main.nf similarity index 98% rename from target/dependencies/vsh/vsh/openpipeline/v4.0.3/nextflow/metadata/move_obsm_to_obs/main.nf rename to target/dependencies/vsh/vsh/openpipeline/v4.1.0/nextflow/metadata/move_obsm_to_obs/main.nf index a7ec6bf..9259a62 100644 --- a/target/dependencies/vsh/vsh/openpipeline/v4.0.3/nextflow/metadata/move_obsm_to_obs/main.nf +++ b/target/dependencies/vsh/vsh/openpipeline/v4.1.0/nextflow/metadata/move_obsm_to_obs/main.nf @@ -1,6 +1,6 @@ -// move_obsm_to_obs v4.0.3 +// move_obsm_to_obs v4.1.0 // -// This wrapper script is auto-generated by viash 0.9.4 and is thus a derivative +// This wrapper script is auto-generated by viash 0.9.7 and is thus a derivative // work thereof. This software comes with ABSOLUTELY NO WARRANTY from Data // Intuitive. // @@ -1353,47 +1353,42 @@ def readCsv(file_path) { def splitRegex = java.util.regex.Pattern.compile(''',(?=(?:[^"]*"[^"]*")*[^"]*$)''') def removeQuote = java.util.regex.Pattern.compile('''"(.*)"''') - def br = java.nio.file.Files.newBufferedReader(inputFile) + java.nio.file.Files.newBufferedReader(inputFile).withCloseable { br -> + def row = 0 + def header = null + def line - def row = -1 - def header = null - while (br.ready() && header == null) { - def line = br.readLine() - row++ - if (!line.startsWith("#")) { - header = splitRegex.split(line, -1).collect{field -> - m = removeQuote.matcher(field) - m.find() ? m.replaceFirst('$1') : field - } - } - } - assert header != null: "CSV file should contain a header" - - while (br.ready()) { - def line = br.readLine() - row++ - if (line == null) { - br.close() - break - } - - if (!line.startsWith("#")) { - def predata = splitRegex.split(line, -1) - def data = predata.collect{field -> - if (field == "") { - return null - } - def m = removeQuote.matcher(field) - if (m.find()) { - return m.replaceFirst('$1') - } else { - return field + while (header == null && (line = br.readLine()) != null) { + if (!line.startsWith("#")) { + header = splitRegex.split(line, -1).collect { field -> + def m = removeQuote.matcher(field) + m.find() ? m.replaceFirst('$1') : field } } - assert header.size() == data.size(): "Row $row should contain the same number as fields as the header" - - def dataMap = [header, data].transpose().collectEntries().findAll{it.value != null} - output.add(dataMap) + row++ + } + assert header != null : "CSV file should contain a header" + + while ((line = br.readLine()) != null) { + row++ + if (!line.startsWith("#")) { + def predata = splitRegex.split(line, -1) + def data = predata.collect { field -> + if (field == "") { + return null + } + def m = removeQuote.matcher(field) + if (m.find()) { + return m.replaceFirst('$1') + } else { + return field + } + } + assert header.size() == data.size() : "Row $row should contain the same number as fields as the header" + + def dataMap = [header, data].transpose().collectEntries().findAll { it.value != null } + output.add(dataMap) + } } } @@ -1709,10 +1704,25 @@ process publishFilesProc { ] .transpose() .collectMany{infile, outfile -> - if (infile.toString() != outfile.toString()) { + def infileString = infile.toString() + def outfileString = outfile.toString() + if (infileString != outfileString) { + /* Trailing slashes are removed from both the source and destination arguments. + From source arguments, this is useful when a source argument may have a trailing slash + and specify a symbolic link to a directory. Without removing the slash, cp will dereference + the symbolic link. + See https://www.gnu.org/software/coreutils/manual/html_node/Trailing-slashes.html#Trailing-slashes-1 + + For the destination path addding a trailing slash is a problem when publishing directories: + it requires the destination directory to exist. This fails because we only create the parent + directories first. + */ + def regexTrailingSlashes = ~/\/+$/ + def infileNoTrailingSlash = infileString - regexTrailingSlashes + def outfileNoTrailingSlash = outfileString - regexTrailingSlashes [ - "[ -d \"\$(dirname '${outfile.toString()}')\" ] || mkdir -p \"\$(dirname '${outfile.toString()}')\"", - "cp -r '${infile.toString()}' '${outfile.toString()}'" + "[ -d \"\$(dirname '${outfileNoTrailingSlash}')\" ] || mkdir -p \"\$(dirname '${outfileNoTrailingSlash}')\"", + "cp -a '${infileNoTrailingSlash}' '${outfileNoTrailingSlash}'" ] } else { // no need to copy if infile is the same as outfile @@ -3035,7 +3045,7 @@ meta = [ "config": processConfig(readJsonBlob('''{ "name" : "move_obsm_to_obs", "namespace" : "metadata", - "version" : "v4.0.3", + "version" : "v4.1.0", "authors" : [ { "name" : "Dries Schaumont", @@ -3127,7 +3137,7 @@ meta = [ { "type" : "string", "name" : "--output_compression", - "description" : "Compression format to use for the output AnnData and/or Mudata objects.\nBy default no compression is applied.\n", + "description" : "Compression format to use for the output AnnData and/or Mudata H5 files.\nBy default no compression is applied.\n", "example" : [ "gzip" ], @@ -3268,7 +3278,7 @@ meta = [ "id" : "docker", "image" : "python:3.12-slim", "target_registry" : "images.viash-hub.com", - "target_tag" : "v4.0.3", + "target_tag" : "v4.1.0", "namespace_separator" : "/", "setup" : [ { @@ -3282,9 +3292,10 @@ meta = [ "type" : "python", "user" : false, "packages" : [ - "anndata~=0.12.7", + "anndata~=0.12.16", "awkward", - "mudata~=0.3.2" + "scipy~=1.17.1", + "mudata~=0.3.8" ], "script" : [ "exec(\\"try:\\\\n import zarr; from importlib.metadata import version\\\\nexcept ModuleNotFoundError:\\\\n exit(0)\\\\nelse: assert int(version(\\\\\\"zarr\\\\\\").partition(\\\\\\".\\\\\\")[0]) > 2\\")" @@ -3304,7 +3315,7 @@ meta = [ "type" : "python", "user" : false, "packages" : [ - "viashpy==0.8.0" + "viashpy==0.10.0" ], "github" : [ "openpipelines-bio/core#subdirectory=packages/python/openpipeline_testutils" @@ -3323,13 +3334,13 @@ meta = [ "runner" : "nextflow", "engine" : "docker|native", "output" : "/workdir/root/repo/target/nextflow/metadata/move_obsm_to_obs", - "viash_version" : "0.9.4", - "git_commit" : "7bfad4ea12f87eca59213be3ab08deff67cc4206", + "viash_version" : "0.9.7", + "git_commit" : "a6499fddaa8553874585c747370f919f4d7b729c", "git_remote" : "https://github.com/openpipelines-bio/openpipeline" }, "package_config" : { "name" : "openpipeline", - "version" : "v4.0.3", + "version" : "v4.1.0", "summary" : "Best-practice workflows for single-cell multi-omics analyses.\n", "description" : "OpenPipelines are extensible single cell analysis pipelines for reproducible and large-scale single cell processing using [Viash](https://viash.io) and [Nextflow](https://www.nextflow.io/).\n\nIn terms of workflows, the following has been made available, but keep in mind that\nindividual tools and functionality can be executed as standalone components as well.\n\n * Demultiplexing: conversion of raw sequencing data to FASTQ objects.\n * Ingestion: Read mapping and generating a count matrix.\n * Single sample processing: cell filtering and doublet detection.\n * Multisample processing: Count transformation, normalization, QC metric calulations.\n * Integration: Clustering, integration and batch correction using single and multimodal methods.\n * Downstream analysis workflows\n", "info" : { @@ -3347,14 +3358,14 @@ meta = [ } ] }, - "viash_version" : "0.9.4", + "viash_version" : "0.9.7", "source" : "/workdir/root/repo/src", "target" : "/workdir/root/repo/target", "config_mods" : [ ".resources += {path: '/src/workflows/utils/labels.config', dest: 'nextflow_labels.config'}\n.runners[.type == 'nextflow'].config.script := 'includeConfig(\\"nextflow_labels.config\\")'", ".engines += { type: \\"native\\" }", ".engines[.type == 'docker'].target_registry := 'images.viash-hub.com'", - ".engines[.type == 'docker'].target_tag := 'v4.0.3'" + ".engines[.type == 'docker'].target_tag := 'v4.1.0'" ], "keywords" : [ "single-cell", @@ -3860,7 +3871,7 @@ meta["defaults"] = [ "container" : { "registry" : "images.viash-hub.com", "image" : "vsh/openpipeline/metadata/move_obsm_to_obs", - "tag" : "v4.0.3" + "tag" : "v4.1.0" }, "label" : [ "singlecpu", diff --git a/target/dependencies/vsh/vsh/openpipeline/v4.0.3/nextflow/metadata/move_obsm_to_obs/nextflow.config b/target/dependencies/vsh/vsh/openpipeline/v4.1.0/nextflow/metadata/move_obsm_to_obs/nextflow.config similarity index 99% rename from target/dependencies/vsh/vsh/openpipeline/v4.0.3/nextflow/metadata/move_obsm_to_obs/nextflow.config rename to target/dependencies/vsh/vsh/openpipeline/v4.1.0/nextflow/metadata/move_obsm_to_obs/nextflow.config index 0714aad..b2cae00 100644 --- a/target/dependencies/vsh/vsh/openpipeline/v4.0.3/nextflow/metadata/move_obsm_to_obs/nextflow.config +++ b/target/dependencies/vsh/vsh/openpipeline/v4.1.0/nextflow/metadata/move_obsm_to_obs/nextflow.config @@ -2,7 +2,7 @@ manifest { name = 'metadata/move_obsm_to_obs' mainScript = 'main.nf' nextflowVersion = '!>=20.12.1-edge' - version = 'v4.0.3' + version = 'v4.1.0' description = 'Move a matrix from .obsm to .obs. Newly created columns in .obs will \nbe created from the .obsm key suffixed with an underscore and the name of the columns\nof the specified .obsm matrix.\n' author = 'Dries Schaumont' } diff --git a/target/dependencies/vsh/vsh/openpipeline/v4.0.3/nextflow/qc/calculate_qc_metrics/nextflow_labels.config b/target/dependencies/vsh/vsh/openpipeline/v4.1.0/nextflow/metadata/move_obsm_to_obs/nextflow_labels.config similarity index 100% rename from target/dependencies/vsh/vsh/openpipeline/v4.0.3/nextflow/qc/calculate_qc_metrics/nextflow_labels.config rename to target/dependencies/vsh/vsh/openpipeline/v4.1.0/nextflow/metadata/move_obsm_to_obs/nextflow_labels.config diff --git a/target/dependencies/vsh/vsh/openpipeline/v4.0.3/nextflow/metadata/move_obsm_to_obs/nextflow_schema.json b/target/dependencies/vsh/vsh/openpipeline/v4.1.0/nextflow/metadata/move_obsm_to_obs/nextflow_schema.json similarity index 97% rename from target/dependencies/vsh/vsh/openpipeline/v4.0.3/nextflow/metadata/move_obsm_to_obs/nextflow_schema.json rename to target/dependencies/vsh/vsh/openpipeline/v4.1.0/nextflow/metadata/move_obsm_to_obs/nextflow_schema.json index 44f1383..3ac029d 100644 --- a/target/dependencies/vsh/vsh/openpipeline/v4.0.3/nextflow/metadata/move_obsm_to_obs/nextflow_schema.json +++ b/target/dependencies/vsh/vsh/openpipeline/v4.1.0/nextflow/metadata/move_obsm_to_obs/nextflow_schema.json @@ -43,7 +43,7 @@ }, "output_compression": { "type": "string", - "description": "Compression format to use for the output AnnData and/or Mudata objects.\nBy default no compression is applied.\n", + "description": "Compression format to use for the output AnnData and/or Mudata H5 files.\nBy default no compression is applied.\n", "help_text": "Type: `string`, multiple: `False`, example: `\"gzip\"`, choices: ``gzip`, `lzf``. ", "enum": [ "gzip", diff --git a/target/dependencies/vsh/vsh/openpipeline/v4.0.3/nextflow/neighbors/find_neighbors/setup_logger.py b/target/dependencies/vsh/vsh/openpipeline/v4.1.0/nextflow/metadata/move_obsm_to_obs/setup_logger.py similarity index 100% rename from target/dependencies/vsh/vsh/openpipeline/v4.0.3/nextflow/neighbors/find_neighbors/setup_logger.py rename to target/dependencies/vsh/vsh/openpipeline/v4.1.0/nextflow/metadata/move_obsm_to_obs/setup_logger.py diff --git a/target/dependencies/vsh/vsh/openpipeline/v4.0.3/nextflow/neighbors/find_neighbors/.config.vsh.yaml b/target/dependencies/vsh/vsh/openpipeline/v4.1.0/nextflow/neighbors/find_neighbors/.config.vsh.yaml similarity index 96% rename from target/dependencies/vsh/vsh/openpipeline/v4.0.3/nextflow/neighbors/find_neighbors/.config.vsh.yaml rename to target/dependencies/vsh/vsh/openpipeline/v4.1.0/nextflow/neighbors/find_neighbors/.config.vsh.yaml index b700608..a410bca 100644 --- a/target/dependencies/vsh/vsh/openpipeline/v4.0.3/nextflow/neighbors/find_neighbors/.config.vsh.yaml +++ b/target/dependencies/vsh/vsh/openpipeline/v4.1.0/nextflow/neighbors/find_neighbors/.config.vsh.yaml @@ -1,6 +1,6 @@ name: "find_neighbors" namespace: "neighbors" -version: "v4.0.3" +version: "v4.1.0" authors: - name: "Dries De Maeyer" roles: @@ -177,8 +177,8 @@ argument_groups: multiple_sep: ";" - type: "string" name: "--output_compression" - description: "Compression format to use for the output AnnData and/or Mudata objects.\n\ - By default no compression is applied.\n" + description: "Compression format to use for the output AnnData and/or Mudata H5\ + \ files.\nBy default no compression is applied.\n" info: null example: - "gzip" @@ -296,7 +296,7 @@ engines: id: "docker" image: "python:3.12-slim" target_registry: "images.viash-hub.com" - target_tag: "v4.0.3" + target_tag: "v4.1.0" namespace_separator: "/" setup: - type: "apt" @@ -306,9 +306,10 @@ engines: - type: "python" user: false packages: - - "anndata~=0.12.7" + - "anndata~=0.12.16" - "awkward" - - "mudata~=0.3.2" + - "scipy~=1.17.1" + - "mudata~=0.3.8" - "scanpy~=1.11.4" script: - "exec(\"try:\\n import zarr; from importlib.metadata import version\\nexcept\ @@ -323,7 +324,7 @@ engines: - type: "python" user: false packages: - - "viashpy==0.8.0" + - "viashpy==0.10.0" github: - "openpipelines-bio/core#subdirectory=packages/python/openpipeline_testutils" upgrade: true @@ -337,12 +338,12 @@ build_info: engine: "docker|native" output: "target/nextflow/neighbors/find_neighbors" executable: "target/nextflow/neighbors/find_neighbors/main.nf" - viash_version: "0.9.4" - git_commit: "7bfad4ea12f87eca59213be3ab08deff67cc4206" + viash_version: "0.9.7" + git_commit: "a6499fddaa8553874585c747370f919f4d7b729c" git_remote: "https://github.com/openpipelines-bio/openpipeline" package_config: name: "openpipeline" - version: "v4.0.3" + version: "v4.1.0" summary: "Best-practice workflows for single-cell multi-omics analyses.\n" description: "OpenPipelines are extensible single cell analysis pipelines for reproducible\ \ and large-scale single cell processing using [Viash](https://viash.io) and [Nextflow](https://www.nextflow.io/).\n\ @@ -363,7 +364,7 @@ package_config: - path: "src/workflows/utils/labels_ci.config" description: "Adds the correct memory and CPU labels when running on the Viash\ \ Hub CI." - viash_version: "0.9.4" + viash_version: "0.9.7" source: "src" target: "target" config_mods: @@ -372,7 +373,7 @@ package_config: )'" - ".engines += { type: \"native\" }" - ".engines[.type == 'docker'].target_registry := 'images.viash-hub.com'" - - ".engines[.type == 'docker'].target_tag := 'v4.0.3'" + - ".engines[.type == 'docker'].target_tag := 'v4.1.0'" keywords: - "single-cell" - "multimodal" diff --git a/target/dependencies/vsh/vsh/openpipeline/v4.0.3/nextflow/qc/calculate_qc_metrics/compress_h5mu.py b/target/dependencies/vsh/vsh/openpipeline/v4.1.0/nextflow/neighbors/find_neighbors/compress_h5mu.py similarity index 100% rename from target/dependencies/vsh/vsh/openpipeline/v4.0.3/nextflow/qc/calculate_qc_metrics/compress_h5mu.py rename to target/dependencies/vsh/vsh/openpipeline/v4.1.0/nextflow/neighbors/find_neighbors/compress_h5mu.py diff --git a/target/dependencies/vsh/vsh/openpipeline/v4.0.3/nextflow/neighbors/find_neighbors/main.nf b/target/dependencies/vsh/vsh/openpipeline/v4.1.0/nextflow/neighbors/find_neighbors/main.nf similarity index 98% rename from target/dependencies/vsh/vsh/openpipeline/v4.0.3/nextflow/neighbors/find_neighbors/main.nf rename to target/dependencies/vsh/vsh/openpipeline/v4.1.0/nextflow/neighbors/find_neighbors/main.nf index aee4747..7e7cb80 100644 --- a/target/dependencies/vsh/vsh/openpipeline/v4.0.3/nextflow/neighbors/find_neighbors/main.nf +++ b/target/dependencies/vsh/vsh/openpipeline/v4.1.0/nextflow/neighbors/find_neighbors/main.nf @@ -1,6 +1,6 @@ -// find_neighbors v4.0.3 +// find_neighbors v4.1.0 // -// This wrapper script is auto-generated by viash 0.9.4 and is thus a derivative +// This wrapper script is auto-generated by viash 0.9.7 and is thus a derivative // work thereof. This software comes with ABSOLUTELY NO WARRANTY from Data // Intuitive. // @@ -1354,47 +1354,42 @@ def readCsv(file_path) { def splitRegex = java.util.regex.Pattern.compile(''',(?=(?:[^"]*"[^"]*")*[^"]*$)''') def removeQuote = java.util.regex.Pattern.compile('''"(.*)"''') - def br = java.nio.file.Files.newBufferedReader(inputFile) + java.nio.file.Files.newBufferedReader(inputFile).withCloseable { br -> + def row = 0 + def header = null + def line - def row = -1 - def header = null - while (br.ready() && header == null) { - def line = br.readLine() - row++ - if (!line.startsWith("#")) { - header = splitRegex.split(line, -1).collect{field -> - m = removeQuote.matcher(field) - m.find() ? m.replaceFirst('$1') : field - } - } - } - assert header != null: "CSV file should contain a header" - - while (br.ready()) { - def line = br.readLine() - row++ - if (line == null) { - br.close() - break - } - - if (!line.startsWith("#")) { - def predata = splitRegex.split(line, -1) - def data = predata.collect{field -> - if (field == "") { - return null - } - def m = removeQuote.matcher(field) - if (m.find()) { - return m.replaceFirst('$1') - } else { - return field + while (header == null && (line = br.readLine()) != null) { + if (!line.startsWith("#")) { + header = splitRegex.split(line, -1).collect { field -> + def m = removeQuote.matcher(field) + m.find() ? m.replaceFirst('$1') : field } } - assert header.size() == data.size(): "Row $row should contain the same number as fields as the header" - - def dataMap = [header, data].transpose().collectEntries().findAll{it.value != null} - output.add(dataMap) + row++ + } + assert header != null : "CSV file should contain a header" + + while ((line = br.readLine()) != null) { + row++ + if (!line.startsWith("#")) { + def predata = splitRegex.split(line, -1) + def data = predata.collect { field -> + if (field == "") { + return null + } + def m = removeQuote.matcher(field) + if (m.find()) { + return m.replaceFirst('$1') + } else { + return field + } + } + assert header.size() == data.size() : "Row $row should contain the same number as fields as the header" + + def dataMap = [header, data].transpose().collectEntries().findAll { it.value != null } + output.add(dataMap) + } } } @@ -1710,10 +1705,25 @@ process publishFilesProc { ] .transpose() .collectMany{infile, outfile -> - if (infile.toString() != outfile.toString()) { + def infileString = infile.toString() + def outfileString = outfile.toString() + if (infileString != outfileString) { + /* Trailing slashes are removed from both the source and destination arguments. + From source arguments, this is useful when a source argument may have a trailing slash + and specify a symbolic link to a directory. Without removing the slash, cp will dereference + the symbolic link. + See https://www.gnu.org/software/coreutils/manual/html_node/Trailing-slashes.html#Trailing-slashes-1 + + For the destination path addding a trailing slash is a problem when publishing directories: + it requires the destination directory to exist. This fails because we only create the parent + directories first. + */ + def regexTrailingSlashes = ~/\/+$/ + def infileNoTrailingSlash = infileString - regexTrailingSlashes + def outfileNoTrailingSlash = outfileString - regexTrailingSlashes [ - "[ -d \"\$(dirname '${outfile.toString()}')\" ] || mkdir -p \"\$(dirname '${outfile.toString()}')\"", - "cp -r '${infile.toString()}' '${outfile.toString()}'" + "[ -d \"\$(dirname '${outfileNoTrailingSlash}')\" ] || mkdir -p \"\$(dirname '${outfileNoTrailingSlash}')\"", + "cp -a '${infileNoTrailingSlash}' '${outfileNoTrailingSlash}'" ] } else { // no need to copy if infile is the same as outfile @@ -3036,7 +3046,7 @@ meta = [ "config": processConfig(readJsonBlob('''{ "name" : "find_neighbors", "namespace" : "neighbors", - "version" : "v4.0.3", + "version" : "v4.1.0", "authors" : [ { "name" : "Dries De Maeyer", @@ -3249,7 +3259,7 @@ meta = [ { "type" : "string", "name" : "--output_compression", - "description" : "Compression format to use for the output AnnData and/or Mudata objects.\nBy default no compression is applied.\n", + "description" : "Compression format to use for the output AnnData and/or Mudata H5 files.\nBy default no compression is applied.\n", "example" : [ "gzip" ], @@ -3395,7 +3405,7 @@ meta = [ "id" : "docker", "image" : "python:3.12-slim", "target_registry" : "images.viash-hub.com", - "target_tag" : "v4.0.3", + "target_tag" : "v4.1.0", "namespace_separator" : "/", "setup" : [ { @@ -3409,9 +3419,10 @@ meta = [ "type" : "python", "user" : false, "packages" : [ - "anndata~=0.12.7", + "anndata~=0.12.16", "awkward", - "mudata~=0.3.2", + "scipy~=1.17.1", + "mudata~=0.3.8", "scanpy~=1.11.4" ], "script" : [ @@ -3432,7 +3443,7 @@ meta = [ "type" : "python", "user" : false, "packages" : [ - "viashpy==0.8.0" + "viashpy==0.10.0" ], "github" : [ "openpipelines-bio/core#subdirectory=packages/python/openpipeline_testutils" @@ -3451,13 +3462,13 @@ meta = [ "runner" : "nextflow", "engine" : "docker|native", "output" : "/workdir/root/repo/target/nextflow/neighbors/find_neighbors", - "viash_version" : "0.9.4", - "git_commit" : "7bfad4ea12f87eca59213be3ab08deff67cc4206", + "viash_version" : "0.9.7", + "git_commit" : "a6499fddaa8553874585c747370f919f4d7b729c", "git_remote" : "https://github.com/openpipelines-bio/openpipeline" }, "package_config" : { "name" : "openpipeline", - "version" : "v4.0.3", + "version" : "v4.1.0", "summary" : "Best-practice workflows for single-cell multi-omics analyses.\n", "description" : "OpenPipelines are extensible single cell analysis pipelines for reproducible and large-scale single cell processing using [Viash](https://viash.io) and [Nextflow](https://www.nextflow.io/).\n\nIn terms of workflows, the following has been made available, but keep in mind that\nindividual tools and functionality can be executed as standalone components as well.\n\n * Demultiplexing: conversion of raw sequencing data to FASTQ objects.\n * Ingestion: Read mapping and generating a count matrix.\n * Single sample processing: cell filtering and doublet detection.\n * Multisample processing: Count transformation, normalization, QC metric calulations.\n * Integration: Clustering, integration and batch correction using single and multimodal methods.\n * Downstream analysis workflows\n", "info" : { @@ -3475,14 +3486,14 @@ meta = [ } ] }, - "viash_version" : "0.9.4", + "viash_version" : "0.9.7", "source" : "/workdir/root/repo/src", "target" : "/workdir/root/repo/target", "config_mods" : [ ".resources += {path: '/src/workflows/utils/labels.config', dest: 'nextflow_labels.config'}\n.runners[.type == 'nextflow'].config.script := 'includeConfig(\\"nextflow_labels.config\\")'", ".engines += { type: \\"native\\" }", ".engines[.type == 'docker'].target_registry := 'images.viash-hub.com'", - ".engines[.type == 'docker'].target_tag := 'v4.0.3'" + ".engines[.type == 'docker'].target_tag := 'v4.1.0'" ], "keywords" : [ "single-cell", @@ -3983,7 +3994,7 @@ meta["defaults"] = [ "container" : { "registry" : "images.viash-hub.com", "image" : "vsh/openpipeline/neighbors/find_neighbors", - "tag" : "v4.0.3" + "tag" : "v4.1.0" }, "label" : [ "lowcpu", diff --git a/target/dependencies/vsh/vsh/openpipeline/v4.0.3/nextflow/neighbors/find_neighbors/nextflow.config b/target/dependencies/vsh/vsh/openpipeline/v4.1.0/nextflow/neighbors/find_neighbors/nextflow.config similarity index 99% rename from target/dependencies/vsh/vsh/openpipeline/v4.0.3/nextflow/neighbors/find_neighbors/nextflow.config rename to target/dependencies/vsh/vsh/openpipeline/v4.1.0/nextflow/neighbors/find_neighbors/nextflow.config index 4075c4b..1577a48 100644 --- a/target/dependencies/vsh/vsh/openpipeline/v4.0.3/nextflow/neighbors/find_neighbors/nextflow.config +++ b/target/dependencies/vsh/vsh/openpipeline/v4.1.0/nextflow/neighbors/find_neighbors/nextflow.config @@ -2,7 +2,7 @@ manifest { name = 'neighbors/find_neighbors' mainScript = 'main.nf' nextflowVersion = '!>=20.12.1-edge' - version = 'v4.0.3' + version = 'v4.1.0' description = 'Compute a neighborhood graph of observations [McInnes18].\n\nThe neighbor search efficiency of this heavily relies on UMAP [McInnes18], which also provides a method for estimating connectivities of data points - the connectivity of the manifold (method==\'umap\'). If method==\'gauss\', connectivities are computed according to [Coifman05], in the adaption of [Haghverdi16].\n' author = 'Dries De Maeyer, Robrecht Cannoodt' } diff --git a/target/dependencies/vsh/vsh/openpipeline/v4.0.3/nextflow/transform/clr/nextflow_labels.config b/target/dependencies/vsh/vsh/openpipeline/v4.1.0/nextflow/neighbors/find_neighbors/nextflow_labels.config similarity index 100% rename from target/dependencies/vsh/vsh/openpipeline/v4.0.3/nextflow/transform/clr/nextflow_labels.config rename to target/dependencies/vsh/vsh/openpipeline/v4.1.0/nextflow/neighbors/find_neighbors/nextflow_labels.config diff --git a/target/dependencies/vsh/vsh/openpipeline/v4.0.3/nextflow/neighbors/find_neighbors/nextflow_schema.json b/target/dependencies/vsh/vsh/openpipeline/v4.1.0/nextflow/neighbors/find_neighbors/nextflow_schema.json similarity index 98% rename from target/dependencies/vsh/vsh/openpipeline/v4.0.3/nextflow/neighbors/find_neighbors/nextflow_schema.json rename to target/dependencies/vsh/vsh/openpipeline/v4.1.0/nextflow/neighbors/find_neighbors/nextflow_schema.json index 1f81de2..cb563aa 100644 --- a/target/dependencies/vsh/vsh/openpipeline/v4.0.3/nextflow/neighbors/find_neighbors/nextflow_schema.json +++ b/target/dependencies/vsh/vsh/openpipeline/v4.1.0/nextflow/neighbors/find_neighbors/nextflow_schema.json @@ -98,7 +98,7 @@ }, "output_compression": { "type": "string", - "description": "Compression format to use for the output AnnData and/or Mudata objects.\nBy default no compression is applied.\n", + "description": "Compression format to use for the output AnnData and/or Mudata H5 files.\nBy default no compression is applied.\n", "help_text": "Type: `string`, multiple: `False`, example: `\"gzip\"`, choices: ``gzip`, `lzf``. ", "enum": [ "gzip", diff --git a/target/dependencies/vsh/vsh/openpipeline/v4.0.3/nextflow/qc/calculate_qc_metrics/setup_logger.py b/target/dependencies/vsh/vsh/openpipeline/v4.1.0/nextflow/neighbors/find_neighbors/setup_logger.py similarity index 100% rename from target/dependencies/vsh/vsh/openpipeline/v4.0.3/nextflow/qc/calculate_qc_metrics/setup_logger.py rename to target/dependencies/vsh/vsh/openpipeline/v4.1.0/nextflow/neighbors/find_neighbors/setup_logger.py diff --git a/target/dependencies/vsh/vsh/openpipeline/v4.0.3/nextflow/qc/calculate_qc_metrics/.config.vsh.yaml b/target/dependencies/vsh/vsh/openpipeline/v4.1.0/nextflow/qc/calculate_qc_metrics/.config.vsh.yaml similarity index 95% rename from target/dependencies/vsh/vsh/openpipeline/v4.0.3/nextflow/qc/calculate_qc_metrics/.config.vsh.yaml rename to target/dependencies/vsh/vsh/openpipeline/v4.1.0/nextflow/qc/calculate_qc_metrics/.config.vsh.yaml index ad9e266..09e4e0a 100644 --- a/target/dependencies/vsh/vsh/openpipeline/v4.0.3/nextflow/qc/calculate_qc_metrics/.config.vsh.yaml +++ b/target/dependencies/vsh/vsh/openpipeline/v4.1.0/nextflow/qc/calculate_qc_metrics/.config.vsh.yaml @@ -1,6 +1,6 @@ name: "calculate_qc_metrics" namespace: "qc" -version: "v4.0.3" +version: "v4.1.0" authors: - name: "Dries Schaumont" roles: @@ -21,7 +21,7 @@ argument_groups: arguments: - type: "file" name: "--input" - description: "Input h5mu file" + description: "Input data. Can be encoded in H5 or Zarr (v3) format." info: null example: - "input.h5mu" @@ -161,7 +161,8 @@ argument_groups: arguments: - type: "file" name: "--output" - description: "Output h5mu file." + description: "Output data. Can be encoded using H5 or Zarr v3, matching the format\ + \ of the input data." info: null example: - "output.h5mu" @@ -173,8 +174,8 @@ argument_groups: multiple_sep: ";" - type: "string" name: "--output_compression" - description: "Compression format to use for the output AnnData and/or Mudata objects.\n\ - By default no compression is applied.\n" + description: "Compression format to use for the output AnnData and/or Mudata H5\ + \ files.\nBy default no compression is applied.\n" info: null example: - "gzip" @@ -293,9 +294,9 @@ runners: engines: - type: "docker" id: "docker" - image: "python:3.11-slim" + image: "python:3.13-slim" target_registry: "images.viash-hub.com" - target_tag: "v4.0.3" + target_tag: "v4.1.0" namespace_separator: "/" setup: - type: "apt" @@ -305,9 +306,10 @@ engines: - type: "python" user: false packages: - - "anndata~=0.12.7" + - "anndata~=0.12.16" - "awkward" - - "mudata~=0.3.2" + - "scipy~=1.17.1" + - "mudata~=0.3.8" - "scipy" script: - "exec(\"try:\\n import zarr; from importlib.metadata import version\\nexcept\ @@ -322,14 +324,14 @@ engines: - type: "python" user: false packages: - - "viashpy==0.8.0" + - "viashpy==0.10.0" github: - "openpipelines-bio/core#subdirectory=packages/python/openpipeline_testutils" upgrade: true - type: "python" user: false packages: - - "scanpy" + - "scanpy~=1.11.4" upgrade: true entrypoint: [] cmd: null @@ -341,12 +343,12 @@ build_info: engine: "docker|native" output: "target/nextflow/qc/calculate_qc_metrics" executable: "target/nextflow/qc/calculate_qc_metrics/main.nf" - viash_version: "0.9.4" - git_commit: "7bfad4ea12f87eca59213be3ab08deff67cc4206" + viash_version: "0.9.7" + git_commit: "a6499fddaa8553874585c747370f919f4d7b729c" git_remote: "https://github.com/openpipelines-bio/openpipeline" package_config: name: "openpipeline" - version: "v4.0.3" + version: "v4.1.0" summary: "Best-practice workflows for single-cell multi-omics analyses.\n" description: "OpenPipelines are extensible single cell analysis pipelines for reproducible\ \ and large-scale single cell processing using [Viash](https://viash.io) and [Nextflow](https://www.nextflow.io/).\n\ @@ -367,7 +369,7 @@ package_config: - path: "src/workflows/utils/labels_ci.config" description: "Adds the correct memory and CPU labels when running on the Viash\ \ Hub CI." - viash_version: "0.9.4" + viash_version: "0.9.7" source: "src" target: "target" config_mods: @@ -376,7 +378,7 @@ package_config: )'" - ".engines += { type: \"native\" }" - ".engines[.type == 'docker'].target_registry := 'images.viash-hub.com'" - - ".engines[.type == 'docker'].target_tag := 'v4.0.3'" + - ".engines[.type == 'docker'].target_tag := 'v4.1.0'" keywords: - "single-cell" - "multimodal" diff --git a/target/dependencies/vsh/vsh/openpipeline/v4.0.3/nextflow/transform/clr/compress_h5mu.py b/target/dependencies/vsh/vsh/openpipeline/v4.1.0/nextflow/qc/calculate_qc_metrics/compress_h5mu.py similarity index 100% rename from target/dependencies/vsh/vsh/openpipeline/v4.0.3/nextflow/transform/clr/compress_h5mu.py rename to target/dependencies/vsh/vsh/openpipeline/v4.1.0/nextflow/qc/calculate_qc_metrics/compress_h5mu.py diff --git a/target/dependencies/vsh/vsh/openpipeline/v4.0.3/nextflow/qc/calculate_qc_metrics/main.nf b/target/dependencies/vsh/vsh/openpipeline/v4.1.0/nextflow/qc/calculate_qc_metrics/main.nf similarity index 92% rename from target/dependencies/vsh/vsh/openpipeline/v4.0.3/nextflow/qc/calculate_qc_metrics/main.nf rename to target/dependencies/vsh/vsh/openpipeline/v4.1.0/nextflow/qc/calculate_qc_metrics/main.nf index 3955b29..aad3bc6 100644 --- a/target/dependencies/vsh/vsh/openpipeline/v4.0.3/nextflow/qc/calculate_qc_metrics/main.nf +++ b/target/dependencies/vsh/vsh/openpipeline/v4.1.0/nextflow/qc/calculate_qc_metrics/main.nf @@ -1,6 +1,6 @@ -// calculate_qc_metrics v4.0.3 +// calculate_qc_metrics v4.1.0 // -// This wrapper script is auto-generated by viash 0.9.4 and is thus a derivative +// This wrapper script is auto-generated by viash 0.9.7 and is thus a derivative // work thereof. This software comes with ABSOLUTELY NO WARRANTY from Data // Intuitive. // @@ -1353,47 +1353,42 @@ def readCsv(file_path) { def splitRegex = java.util.regex.Pattern.compile(''',(?=(?:[^"]*"[^"]*")*[^"]*$)''') def removeQuote = java.util.regex.Pattern.compile('''"(.*)"''') - def br = java.nio.file.Files.newBufferedReader(inputFile) + java.nio.file.Files.newBufferedReader(inputFile).withCloseable { br -> + def row = 0 + def header = null + def line - def row = -1 - def header = null - while (br.ready() && header == null) { - def line = br.readLine() - row++ - if (!line.startsWith("#")) { - header = splitRegex.split(line, -1).collect{field -> - m = removeQuote.matcher(field) - m.find() ? m.replaceFirst('$1') : field - } - } - } - assert header != null: "CSV file should contain a header" - - while (br.ready()) { - def line = br.readLine() - row++ - if (line == null) { - br.close() - break - } - - if (!line.startsWith("#")) { - def predata = splitRegex.split(line, -1) - def data = predata.collect{field -> - if (field == "") { - return null - } - def m = removeQuote.matcher(field) - if (m.find()) { - return m.replaceFirst('$1') - } else { - return field + while (header == null && (line = br.readLine()) != null) { + if (!line.startsWith("#")) { + header = splitRegex.split(line, -1).collect { field -> + def m = removeQuote.matcher(field) + m.find() ? m.replaceFirst('$1') : field } } - assert header.size() == data.size(): "Row $row should contain the same number as fields as the header" - - def dataMap = [header, data].transpose().collectEntries().findAll{it.value != null} - output.add(dataMap) + row++ + } + assert header != null : "CSV file should contain a header" + + while ((line = br.readLine()) != null) { + row++ + if (!line.startsWith("#")) { + def predata = splitRegex.split(line, -1) + def data = predata.collect { field -> + if (field == "") { + return null + } + def m = removeQuote.matcher(field) + if (m.find()) { + return m.replaceFirst('$1') + } else { + return field + } + } + assert header.size() == data.size() : "Row $row should contain the same number as fields as the header" + + def dataMap = [header, data].transpose().collectEntries().findAll { it.value != null } + output.add(dataMap) + } } } @@ -1709,10 +1704,25 @@ process publishFilesProc { ] .transpose() .collectMany{infile, outfile -> - if (infile.toString() != outfile.toString()) { + def infileString = infile.toString() + def outfileString = outfile.toString() + if (infileString != outfileString) { + /* Trailing slashes are removed from both the source and destination arguments. + From source arguments, this is useful when a source argument may have a trailing slash + and specify a symbolic link to a directory. Without removing the slash, cp will dereference + the symbolic link. + See https://www.gnu.org/software/coreutils/manual/html_node/Trailing-slashes.html#Trailing-slashes-1 + + For the destination path addding a trailing slash is a problem when publishing directories: + it requires the destination directory to exist. This fails because we only create the parent + directories first. + */ + def regexTrailingSlashes = ~/\/+$/ + def infileNoTrailingSlash = infileString - regexTrailingSlashes + def outfileNoTrailingSlash = outfileString - regexTrailingSlashes [ - "[ -d \"\$(dirname '${outfile.toString()}')\" ] || mkdir -p \"\$(dirname '${outfile.toString()}')\"", - "cp -r '${infile.toString()}' '${outfile.toString()}'" + "[ -d \"\$(dirname '${outfileNoTrailingSlash}')\" ] || mkdir -p \"\$(dirname '${outfileNoTrailingSlash}')\"", + "cp -a '${infileNoTrailingSlash}' '${outfileNoTrailingSlash}'" ] } else { // no need to copy if infile is the same as outfile @@ -3035,7 +3045,7 @@ meta = [ "config": processConfig(readJsonBlob('''{ "name" : "calculate_qc_metrics", "namespace" : "qc", - "version" : "v4.0.3", + "version" : "v4.1.0", "authors" : [ { "name" : "Dries Schaumont", @@ -3067,7 +3077,7 @@ meta = [ { "type" : "file", "name" : "--input", - "description" : "Input h5mu file", + "description" : "Input data. Can be encoded in H5 or Zarr (v3) format.", "example" : [ "input.h5mu" ], @@ -3222,7 +3232,7 @@ meta = [ { "type" : "file", "name" : "--output", - "description" : "Output h5mu file.", + "description" : "Output data. Can be encoded using H5 or Zarr v3, matching the format of the input data.", "example" : [ "output.h5mu" ], @@ -3236,7 +3246,7 @@ meta = [ { "type" : "string", "name" : "--output_compression", - "description" : "Compression format to use for the output AnnData and/or Mudata objects.\nBy default no compression is applied.\n", + "description" : "Compression format to use for the output AnnData and/or Mudata H5 files.\nBy default no compression is applied.\n", "example" : [ "gzip" ], @@ -3379,9 +3389,9 @@ meta = [ { "type" : "docker", "id" : "docker", - "image" : "python:3.11-slim", + "image" : "python:3.13-slim", "target_registry" : "images.viash-hub.com", - "target_tag" : "v4.0.3", + "target_tag" : "v4.1.0", "namespace_separator" : "/", "setup" : [ { @@ -3395,9 +3405,10 @@ meta = [ "type" : "python", "user" : false, "packages" : [ - "anndata~=0.12.7", + "anndata~=0.12.16", "awkward", - "mudata~=0.3.2", + "scipy~=1.17.1", + "mudata~=0.3.8", "scipy" ], "script" : [ @@ -3418,7 +3429,7 @@ meta = [ "type" : "python", "user" : false, "packages" : [ - "viashpy==0.8.0" + "viashpy==0.10.0" ], "github" : [ "openpipelines-bio/core#subdirectory=packages/python/openpipeline_testutils" @@ -3429,7 +3440,7 @@ meta = [ "type" : "python", "user" : false, "packages" : [ - "scanpy" + "scanpy~=1.11.4" ], "upgrade" : true } @@ -3445,13 +3456,13 @@ meta = [ "runner" : "nextflow", "engine" : "docker|native", "output" : "/workdir/root/repo/target/nextflow/qc/calculate_qc_metrics", - "viash_version" : "0.9.4", - "git_commit" : "7bfad4ea12f87eca59213be3ab08deff67cc4206", + "viash_version" : "0.9.7", + "git_commit" : "a6499fddaa8553874585c747370f919f4d7b729c", "git_remote" : "https://github.com/openpipelines-bio/openpipeline" }, "package_config" : { "name" : "openpipeline", - "version" : "v4.0.3", + "version" : "v4.1.0", "summary" : "Best-practice workflows for single-cell multi-omics analyses.\n", "description" : "OpenPipelines are extensible single cell analysis pipelines for reproducible and large-scale single cell processing using [Viash](https://viash.io) and [Nextflow](https://www.nextflow.io/).\n\nIn terms of workflows, the following has been made available, but keep in mind that\nindividual tools and functionality can be executed as standalone components as well.\n\n * Demultiplexing: conversion of raw sequencing data to FASTQ objects.\n * Ingestion: Read mapping and generating a count matrix.\n * Single sample processing: cell filtering and doublet detection.\n * Multisample processing: Count transformation, normalization, QC metric calulations.\n * Integration: Clustering, integration and batch correction using single and multimodal methods.\n * Downstream analysis workflows\n", "info" : { @@ -3469,14 +3480,14 @@ meta = [ } ] }, - "viash_version" : "0.9.4", + "viash_version" : "0.9.7", "source" : "/workdir/root/repo/src", "target" : "/workdir/root/repo/target", "config_mods" : [ ".resources += {path: '/src/workflows/utils/labels.config', dest: 'nextflow_labels.config'}\n.runners[.type == 'nextflow'].config.script := 'includeConfig(\\"nextflow_labels.config\\")'", ".engines += { type: \\"native\\" }", ".engines[.type == 'docker'].target_registry := 'images.viash-hub.com'", - ".engines[.type == 'docker'].target_tag := 'v4.0.3'" + ".engines[.type == 'docker'].target_tag := 'v4.1.0'" ], "keywords" : [ "single-cell", @@ -3505,9 +3516,17 @@ def innerWorkflowFactory(args) { tempscript=".viash_script.py" cat > "$tempscript" << VIASHMAIN import sys -from mudata import read_h5ad -from scipy.sparse import issparse, csr_array +import h5py +from anndata.io import read_elem, write_elem +from anndata import AnnData, settings +from scipy.sparse import csr_array import numpy as np +from contextlib import contextmanager, closing, nullcontext +from shutil import copytree, copyfile +from functools import partial +import zarr + +settings.zarr_write_format = 3 ## VIASH START # The following code has been auto-generated by Viash. @@ -3555,78 +3574,101 @@ dep = { sys.path.append(meta["resources_dir"]) from setup_logger import setup_logger -from compress_h5mu import write_h5ad_to_h5mu_with_compression logger = setup_logger() -def count_nonzero(layer, axis): - """ - This method is the functional equivalent of the old .getnnz function from scirpy, - but that function was deprecated. So we use the nonzero function to mimic the old - behavior. - """ - axis ^= 1 - nonzero_counts = dict(zip(*np.unique(layer.nonzero()[axis], return_counts=True))) - nonzero_per_axis_item = { - row_index: nonzero_counts.get(row_index, 0) - for row_index in range(layer.shape[axis]) - } - return np.array(list(nonzero_per_axis_item.values()), dtype="int64") +@contextmanager +def mudata_opener(file_loc, mode=None): + open_mudata = None + input_is_zarr = False + try: + open_mudata = zarr.open(file_loc, zarr_format=3, mode=mode) + input_is_zarr = True + yield open_mudata, input_is_zarr + except (zarr.errors.GroupNotFoundError, NotADirectoryError): + try: + open_mudata = h5py.File(file_loc, mode=mode) + yield open_mudata, input_is_zarr + except (FileNotFoundError, IsADirectoryError, KeyError) as e: + e.add_note(f"Could not open file {file_loc}.") + raise e + finally: + try: + if open_mudata: + open_mudata.close() + del open_mudata + except (AttributeError, UnboundLocalError): + pass -def main(): - modality_data = read_h5ad(par["input"], mod=par["modality"]) - var = modality_data.var - layer = modality_data.X if not par["layer"] else modality_data.layers[par["layer"]] - if not issparse(layer): - raise NotImplementedError("Expected layer to be in sparse format.") - layer = csr_array(layer) - layer.eliminate_zeros() - +def calculate_var_statistics(layer): + logger.info("Calculating statistics to store in .var") var_columns_to_add = {} - - # var statistics if par["output_var_obs_mean"]: - obs_mean = layer.mean(axis=0) + logger.info( + "(var) Calculating mean per observation, which will be stored at %s.", + par["output_var_obs_mean"], + ) + obs_mean = np.ravel(mean_csr_array(layer, axis=0)) var_columns_to_add[par["output_var_obs_mean"]] = obs_mean if par["output_var_total_counts_obs"]: - # from the np.sum documentation: - # Especially when summing a large number of lower precision floating point numbers, - # such as float32, numerical errors can become significant. In such cases it can - # be advisable to use dtype="float64" to use a higher precision for the output. - layer_with_type = layer - if np.issubdtype(layer.dtype, np.floating) and np.can_cast( - layer.dtype, np.float64, casting="safe" - ): - # 'safe' casting makes sure not to cast np.float128 or anything else to a lower precision dtype - layer_with_type = layer.astype(np.float64) - total_counts_obs = np.ravel(layer_with_type.sum(axis=0)) + logger.info( + "(var) Calculating total counts for each observation, to be stored at %s.", + par["output_var_total_counts_obs"], + ) + total_counts_obs = np.ravel(layer.sum(axis=0)) var_columns_to_add[par["output_var_total_counts_obs"]] = total_counts_obs - num_nonzero_obs = count_nonzero(layer, axis=0) + # This is the same as the old .nnz(axis=0), but this new implementation only works for csr_arrays! + # See https://github.com/scipy/scipy/issues/19405#issuecomment-1773553180 + num_nonzero_obs = np.bincount(layer.indices, minlength=layer.shape[1]) if par["output_var_num_nonzero_obs"]: + logger.info( + "(var) Retreiving the number of non-zero elements for each row for result column %s", + par["output_var_num_nonzero_obs"], + ) var_columns_to_add[par["output_var_num_nonzero_obs"]] = num_nonzero_obs if par["output_var_pct_dropout"]: + logger.info( + "(var) Fetching for each feature the percentage of observations missing that feature (column %s)", + par["output_var_pct_dropout"], + ) var_columns_to_add[par["output_var_pct_dropout"]] = ( 1 - num_nonzero_obs / layer.shape[0] ) * 100 + logger.info("Calculating .var statistics finished.") + return var_columns_to_add - modality_data.var = modality_data.var.assign(**var_columns_to_add) - # obs statistics +def calculate_obs_statistics(layer, var): + logger.info("Calculating statistics to store in .obs") obs_columns_to_add = {} total_counts_var = np.ravel(layer.sum(axis=1)) if par["output_obs_num_nonzero_vars"]: - num_nonzero_vars = count_nonzero(layer, axis=1) + logger.info( + "(obs) Retreiving the number of non-zero elements for each feature to be stored in column %s", + par["output_var_num_nonzero_obs"], + ) + # This is the same as the old .nnz(axis=1), but this new implementation only works for csr_arrays! + # See https://github.com/scipy/scipy/issues/19405#issuecomment-1773553180 + num_nonzero_vars = np.diff(layer.indptr) obs_columns_to_add[par["output_obs_num_nonzero_vars"]] = num_nonzero_vars if par["output_obs_total_counts_vars"]: + logger.info( + "(obs) Calculating total counts for each feature, to be stored at %s.", + par["output_obs_total_counts_vars"], + ) obs_columns_to_add[par["output_obs_total_counts_vars"]] = total_counts_var top_metrics = {} if par["top_n_vars"]: + logger.info( + "(obs) Calculating the cumulative proportions to the %s most expressed vars.", + ", ".join([f"{top_n_var}th" for top_n_var in par["top_n_vars"]]), + ) par["top_n_vars"] = sorted(par["top_n_vars"]) distributions = get_top_from_csr_matrix(layer, par["top_n_vars"]) top_metrics = { @@ -3639,48 +3681,92 @@ def main(): f"pct_of_counts_in_top_{n_top}_vars": col for n_top, col in top_metrics.items() } - - if par["var_qc_metrics"]: - print(f"qc_metrics: {par['var_qc_metrics']}") - for qc_metric in par["var_qc_metrics"]: - if qc_metric not in var: + for qc_metric in par.get("var_qc_metrics", []) or []: + logger.info( + "(obs) Retreiving the proportion of total 'True' values in column %s", + qc_metric, + ) + if qc_metric not in var: + raise ValueError( + f"Value for --var_qc_metrics, '{qc_metric}' " + f"not found in .var for modality {par['modality']}" + ) + qc_column = var[qc_metric] + if qc_column.isna().any(): + if par["var_qc_metrics_fill_na_value"] is None: raise ValueError( - f"Value for --var_qc_metrics, '{qc_metric}' " - f"not found in .var for modality {par['modality']}" + f"The .var column '{qc_metric}', selected by '--var_qc_metrics', contains NA values. " + "It is ambiguous whether or not to include these values in the static calulation. " + "You can explicitly map the NA values to 'False' or 'True using '--var_qc_metrics_fill_na_value'" ) - qc_column = var[qc_metric] - if qc_column.isna().any(): - if par["var_qc_metrics_fill_na_value"] is None: - raise ValueError( - f"The .var column '{qc_metric}', selected by '--var_qc_metrics', contains NA values. " - "It is ambiguous whether or not to include these values in the static calulation. " - "You can explicitly map the NA values to 'False' or 'True using '--var_qc_metrics_fill_na_value'" - ) - else: - qc_column = qc_column.fillna( - par["var_qc_metrics_fill_na_value"], inplace=False - ) - qc_column = qc_column.to_list() - if set(np.unique(qc_column)) - {True, False}: - raise ValueError( - f"Column {qc_metric} in .var for modality {par['modality']} " - f"must only contain boolean values" + else: + qc_column = qc_column.fillna( + par["var_qc_metrics_fill_na_value"], inplace=False ) - total_counts_qc_metric = np.ravel(layer[:, qc_column].sum(axis=1)) - obs_columns_to_add |= { - f"total_counts_{qc_metric}": total_counts_qc_metric, - f"pct_{qc_metric}": total_counts_qc_metric / total_counts_var * 100, - } + qc_column = qc_column.to_list() + if set(np.unique(qc_column)) - {True, False}: + raise ValueError( + f"Column {qc_metric} in .var for modality {par['modality']} " + f"must only contain boolean values" + ) + total_counts_qc_metric = np.ravel(layer[:, qc_column].sum(axis=1)) + obs_columns_to_add |= { + f"total_counts_{qc_metric}": total_counts_qc_metric, + f"pct_{qc_metric}": total_counts_qc_metric / total_counts_var * 100, + } + logger.info("Finised calculating obs statistics") + return obs_columns_to_add - modality_data.obs = modality_data.obs.assign(**obs_columns_to_add) - write_h5ad_to_h5mu_with_compression( - par["output"], - par["input"], - par["modality"], - modality_data, - par["output_compression"], + +def cast_layer_dtype(layer): + # from the np.sum documentation: + # Especially when summing a large number of lower precision floating point numbers, + # such as float32, numerical errors can become significant. In such cases it can + # be advisable to use dtype="float64" to use a higher precision for the output. + + # However, the 'dtype' from SciPy's implementation of sum cannot be used for this + # as it does not use an internal accumulator but matrix multiplication for calculating + # the sum. So here we cast explicitly to a higher precision before doing the calcualtions. + # The downside is that this is inefficient. + # See https://github.com/scipy/scipy/issues/23768#issuecomment-3909317463 + original_dtype = layer.dtype + target_dtype = original_dtype + if np.issubdtype(original_dtype, np.floating) and np.can_cast( + original_dtype, np.float64, casting="safe" + ): + # use promote_types in orde to make suresure not to cast np.float128 + # or anything else to a lower precision dtype + target_dtype = np.promote_types(np.float64, original_dtype) + logger.info( + "Using target dtype %s for layer. Casting may be required for higher precision.", + target_dtype, + ) + result = csr_array(layer, dtype=target_dtype, copy=False) + logger.info("Constructed CSR of shape %s and dtype %s", result.shape, result.dtype) + return result + + +def mean_csr_array(input_csr_array, axis): + # TODO: replace this function with the native SciPy version + # when anndata supports SciPy >= 1.17.0 + # We use this version to avoid creating duplicates of the data in memory + # when the \\`astype\\` function is called. + # See https://github.com/scipy/scipy/pull/23797 + sparse_array_dtype = input_csr_array.dtype + integral = np.issubdtype(sparse_array_dtype, np.integer) or np.issubdtype( + sparse_array_dtype, np.bool_ ) + # intermediate dtype for summation + inter_dtype = np.float64 if integral else sparse_array_dtype + inter_cast = input_csr_array.astype(inter_dtype, copy=False) + divided = inter_cast.data * (1.0 / input_csr_array.shape[axis]) + divided_csr = csr_array( + (divided, input_csr_array.indices, input_csr_array.indptr), + shape=input_csr_array.shape, + ) + return divided_csr.sum(axis=axis, dtype=inter_dtype) + def get_top_from_csr_matrix(array, top_n_genes): # csr matrices stores a 3D matrix in a format such that data for individual cells @@ -3723,6 +3809,68 @@ def get_top_from_csr_matrix(array, top_n_genes): return cumulative / np.expand_dims(array.sum(axis=1), 1) +def main(): + logger.info("Started %s.", meta["name"]) + mod_element_loc = f"mod/{par['modality']}" + layer_element_name = ( + f"{mod_element_loc}/X" + if not par["layer"] + else f"{mod_element_loc}/layers/{par['layer']}" + ) + # In order to match the format (zarr or h5) of the input to the output + with mudata_opener(par["input"], mode="r") as (open_mudata, input_is_zarr): + logger.info( + "Openened %s in %s format.", par["input"], "zarr" if input_is_zarr else "h5" + ) + mods = list(open_mudata["mod"].keys()) + logger.info("Found modalities: %s", ", ".join(mods)) + logger.info("Reading metadata frames for modality %s", par["modality"]) + var = read_elem(open_mudata[f"{mod_element_loc}/var"]) + logger.info(".var shape for %s is %s", par["modality"], var.shape) + obs = read_elem(open_mudata[f"{mod_element_loc}/obs"]) + logger.info(".obs shape for %s is %s", par["modality"], obs.shape) + minimal_anndata = AnnData(var=var, obs=obs) + logger.info("Reading layer %s", "X" if not par["layer"] else par["layer"]) + layer = read_elem(open_mudata[layer_element_name]) + logger.info("Found layer with shape %s and dtype %s", layer.shape, layer.dtype) + + layer = cast_layer_dtype(layer) + logger.info("Eliminating explicit zeros from sparse layer.") + layer.eliminate_zeros() + + var_columns_to_add = calculate_var_statistics(layer) + minimal_anndata.var = minimal_anndata.var.assign(**var_columns_to_add) + + # obs statistics + obs_columns_to_add = calculate_obs_statistics(layer, minimal_anndata.var) + minimal_anndata.obs = minimal_anndata.obs.assign(**obs_columns_to_add) + + logger.info("Writing to %s", par["output"]) + try: + copytree(par["input"], par["output"], symlinks=True) + except NotADirectoryError: + copyfile(par["input"], par["output"], follow_symlinks=True) + logger.info("Copied input file %s to %s", par["input"], par["output"]) + else: + logger.info("Copied input directory %s", par["input"], par["output"]) + logger.info("Using a %s writer", "zarr" if input_is_zarr else "H5") + write_opener = ( + partial(zarr.open, zarr_format=3, use_consolidated=False) + if input_is_zarr + else h5py.File + ) + context = ( + nullcontext if input_is_zarr else closing + ) # zarr format does not need to be closed + logger.info("Overwriting slots.") + with context(write_opener(par["output"], mode="a")) as open_output: + write_elem(open_output[mod_element_loc], "obs", minimal_anndata.obs) + write_elem(open_output[mod_element_loc], "var", minimal_anndata.var) + if input_is_zarr: + zarr.consolidate_metadata(open_output.store) + logger.info("Finished!") + + if __name__ == "__main__": main() VIASHMAIN @@ -4107,7 +4255,7 @@ meta["defaults"] = [ "container" : { "registry" : "images.viash-hub.com", "image" : "vsh/openpipeline/qc/calculate_qc_metrics", - "tag" : "v4.0.3" + "tag" : "v4.1.0" }, "label" : [ "singlecpu", diff --git a/target/dependencies/vsh/vsh/openpipeline/v4.0.3/nextflow/qc/calculate_qc_metrics/nextflow.config b/target/dependencies/vsh/vsh/openpipeline/v4.1.0/nextflow/qc/calculate_qc_metrics/nextflow.config similarity index 99% rename from target/dependencies/vsh/vsh/openpipeline/v4.0.3/nextflow/qc/calculate_qc_metrics/nextflow.config rename to target/dependencies/vsh/vsh/openpipeline/v4.1.0/nextflow/qc/calculate_qc_metrics/nextflow.config index 0d6eaae..33f7ace 100644 --- a/target/dependencies/vsh/vsh/openpipeline/v4.0.3/nextflow/qc/calculate_qc_metrics/nextflow.config +++ b/target/dependencies/vsh/vsh/openpipeline/v4.1.0/nextflow/qc/calculate_qc_metrics/nextflow.config @@ -2,7 +2,7 @@ manifest { name = 'qc/calculate_qc_metrics' mainScript = 'main.nf' nextflowVersion = '!>=20.12.1-edge' - version = 'v4.0.3' + version = 'v4.1.0' description = 'Add basic quality control metrics to an .h5mu file.\n\nThe metrics are comparable to what scanpy.pp.calculate_qc_metrics output,\nalthough they have slightly different names:\n\nVar metrics (name in this component -> name in scanpy):\n - pct_dropout -> pct_dropout_by_{expr_type}\n - num_nonzero_obs -> n_cells_by_{expr_type}\n - obs_mean -> mean_{expr_type}\n - total_counts -> total_{expr_type}\n\n Obs metrics:\n - num_nonzero_vars -> n_genes_by_{expr_type}\n - pct_{var_qc_metrics} -> pct_{expr_type}_{qc_var}\n - total_counts_{var_qc_metrics} -> total_{expr_type}_{qc_var}\n - pct_of_counts_in_top_{top_n_vars}_vars -> pct_{expr_type}_in_top_{n}_{var_type}\n - total_counts -> total_{expr_type}\n \n' author = 'Dries Schaumont' } diff --git a/target/dependencies/vsh/vsh/openpipeline/v4.0.3/nextflow/transform/delete_layer/nextflow_labels.config b/target/dependencies/vsh/vsh/openpipeline/v4.1.0/nextflow/qc/calculate_qc_metrics/nextflow_labels.config similarity index 100% rename from target/dependencies/vsh/vsh/openpipeline/v4.0.3/nextflow/transform/delete_layer/nextflow_labels.config rename to target/dependencies/vsh/vsh/openpipeline/v4.1.0/nextflow/qc/calculate_qc_metrics/nextflow_labels.config diff --git a/target/dependencies/vsh/vsh/openpipeline/v4.0.3/nextflow/qc/calculate_qc_metrics/nextflow_schema.json b/target/dependencies/vsh/vsh/openpipeline/v4.1.0/nextflow/qc/calculate_qc_metrics/nextflow_schema.json similarity index 97% rename from target/dependencies/vsh/vsh/openpipeline/v4.0.3/nextflow/qc/calculate_qc_metrics/nextflow_schema.json rename to target/dependencies/vsh/vsh/openpipeline/v4.1.0/nextflow/qc/calculate_qc_metrics/nextflow_schema.json index 83f9504..c5139b2 100644 --- a/target/dependencies/vsh/vsh/openpipeline/v4.0.3/nextflow/qc/calculate_qc_metrics/nextflow_schema.json +++ b/target/dependencies/vsh/vsh/openpipeline/v4.1.0/nextflow/qc/calculate_qc_metrics/nextflow_schema.json @@ -13,7 +13,7 @@ "type": "string", "format": "path", "exists": true, - "description": "Input h5mu file", + "description": "Input data", "help_text": "Type: `file`, multiple: `False`, required, direction: `input`, example: `\"input.h5mu\"`. " }, "modality": { @@ -37,13 +37,13 @@ "output": { "type": "string", "format": "path", - "description": "Output h5mu file.", + "description": "Output data", "help_text": "Type: `file`, multiple: `False`, default: `\"$id.$key.output.h5mu\"`, direction: `output`, example: `\"output.h5mu\"`. ", "default": "$id.$key.output.h5mu" }, "output_compression": { "type": "string", - "description": "Compression format to use for the output AnnData and/or Mudata objects.\nBy default no compression is applied.\n", + "description": "Compression format to use for the output AnnData and/or Mudata H5 files.\nBy default no compression is applied.\n", "help_text": "Type: `string`, multiple: `False`, example: `\"gzip\"`, choices: ``gzip`, `lzf``. ", "enum": [ "gzip", diff --git a/target/dependencies/vsh/vsh/openpipeline/v4.0.3/nextflow/transform/delete_layer/setup_logger.py b/target/dependencies/vsh/vsh/openpipeline/v4.1.0/nextflow/qc/calculate_qc_metrics/setup_logger.py similarity index 100% rename from target/dependencies/vsh/vsh/openpipeline/v4.0.3/nextflow/transform/delete_layer/setup_logger.py rename to target/dependencies/vsh/vsh/openpipeline/v4.1.0/nextflow/qc/calculate_qc_metrics/setup_logger.py diff --git a/target/dependencies/vsh/vsh/openpipeline/v4.0.3/nextflow/transform/clr/.config.vsh.yaml b/target/dependencies/vsh/vsh/openpipeline/v4.1.0/nextflow/transform/clr/.config.vsh.yaml similarity index 95% rename from target/dependencies/vsh/vsh/openpipeline/v4.0.3/nextflow/transform/clr/.config.vsh.yaml rename to target/dependencies/vsh/vsh/openpipeline/v4.1.0/nextflow/transform/clr/.config.vsh.yaml index 0a00e4e..2acd336 100644 --- a/target/dependencies/vsh/vsh/openpipeline/v4.0.3/nextflow/transform/clr/.config.vsh.yaml +++ b/target/dependencies/vsh/vsh/openpipeline/v4.1.0/nextflow/transform/clr/.config.vsh.yaml @@ -1,6 +1,6 @@ name: "clr" namespace: "transform" -version: "v4.0.3" +version: "v4.1.0" authors: - name: "Dries Schaumont" roles: @@ -90,8 +90,8 @@ argument_groups: multiple_sep: ";" - type: "string" name: "--output_compression" - description: "Compression format to use for the output AnnData and/or Mudata objects.\n\ - By default no compression is applied.\n" + description: "Compression format to use for the output AnnData and/or Mudata H5\ + \ files.\nBy default no compression is applied.\n" info: null example: - "gzip" @@ -203,7 +203,7 @@ engines: id: "docker" image: "python:3.13-slim" target_registry: "images.viash-hub.com" - target_tag: "v4.0.3" + target_tag: "v4.1.0" namespace_separator: "/" setup: - type: "apt" @@ -213,9 +213,10 @@ engines: - type: "python" user: false packages: - - "anndata~=0.12.7" + - "anndata~=0.12.16" - "awkward" - - "mudata~=0.3.2" + - "scipy~=1.17.1" + - "mudata~=0.3.8" - "scanpy~=1.11.4" - "muon~=0.1.7" script: @@ -227,7 +228,7 @@ engines: - type: "python" user: false packages: - - "viashpy==0.8.0" + - "viashpy==0.10.0" upgrade: true entrypoint: [] cmd: null @@ -239,12 +240,12 @@ build_info: engine: "docker|native" output: "target/nextflow/transform/clr" executable: "target/nextflow/transform/clr/main.nf" - viash_version: "0.9.4" - git_commit: "7bfad4ea12f87eca59213be3ab08deff67cc4206" + viash_version: "0.9.7" + git_commit: "a6499fddaa8553874585c747370f919f4d7b729c" git_remote: "https://github.com/openpipelines-bio/openpipeline" package_config: name: "openpipeline" - version: "v4.0.3" + version: "v4.1.0" summary: "Best-practice workflows for single-cell multi-omics analyses.\n" description: "OpenPipelines are extensible single cell analysis pipelines for reproducible\ \ and large-scale single cell processing using [Viash](https://viash.io) and [Nextflow](https://www.nextflow.io/).\n\ @@ -265,7 +266,7 @@ package_config: - path: "src/workflows/utils/labels_ci.config" description: "Adds the correct memory and CPU labels when running on the Viash\ \ Hub CI." - viash_version: "0.9.4" + viash_version: "0.9.7" source: "src" target: "target" config_mods: @@ -274,7 +275,7 @@ package_config: )'" - ".engines += { type: \"native\" }" - ".engines[.type == 'docker'].target_registry := 'images.viash-hub.com'" - - ".engines[.type == 'docker'].target_tag := 'v4.0.3'" + - ".engines[.type == 'docker'].target_tag := 'v4.1.0'" keywords: - "single-cell" - "multimodal" diff --git a/target/dependencies/vsh/vsh/openpipeline/v4.0.3/nextflow/transform/delete_layer/compress_h5mu.py b/target/dependencies/vsh/vsh/openpipeline/v4.1.0/nextflow/transform/clr/compress_h5mu.py similarity index 100% rename from target/dependencies/vsh/vsh/openpipeline/v4.0.3/nextflow/transform/delete_layer/compress_h5mu.py rename to target/dependencies/vsh/vsh/openpipeline/v4.1.0/nextflow/transform/clr/compress_h5mu.py diff --git a/target/dependencies/vsh/vsh/openpipeline/v4.0.3/nextflow/transform/clr/main.nf b/target/dependencies/vsh/vsh/openpipeline/v4.1.0/nextflow/transform/clr/main.nf similarity index 97% rename from target/dependencies/vsh/vsh/openpipeline/v4.0.3/nextflow/transform/clr/main.nf rename to target/dependencies/vsh/vsh/openpipeline/v4.1.0/nextflow/transform/clr/main.nf index 8b680cd..4be262f 100644 --- a/target/dependencies/vsh/vsh/openpipeline/v4.0.3/nextflow/transform/clr/main.nf +++ b/target/dependencies/vsh/vsh/openpipeline/v4.1.0/nextflow/transform/clr/main.nf @@ -1,6 +1,6 @@ -// clr v4.0.3 +// clr v4.1.0 // -// This wrapper script is auto-generated by viash 0.9.4 and is thus a derivative +// This wrapper script is auto-generated by viash 0.9.7 and is thus a derivative // work thereof. This software comes with ABSOLUTELY NO WARRANTY from Data // Intuitive. // @@ -1353,47 +1353,42 @@ def readCsv(file_path) { def splitRegex = java.util.regex.Pattern.compile(''',(?=(?:[^"]*"[^"]*")*[^"]*$)''') def removeQuote = java.util.regex.Pattern.compile('''"(.*)"''') - def br = java.nio.file.Files.newBufferedReader(inputFile) + java.nio.file.Files.newBufferedReader(inputFile).withCloseable { br -> + def row = 0 + def header = null + def line - def row = -1 - def header = null - while (br.ready() && header == null) { - def line = br.readLine() - row++ - if (!line.startsWith("#")) { - header = splitRegex.split(line, -1).collect{field -> - m = removeQuote.matcher(field) - m.find() ? m.replaceFirst('$1') : field - } - } - } - assert header != null: "CSV file should contain a header" - - while (br.ready()) { - def line = br.readLine() - row++ - if (line == null) { - br.close() - break - } - - if (!line.startsWith("#")) { - def predata = splitRegex.split(line, -1) - def data = predata.collect{field -> - if (field == "") { - return null - } - def m = removeQuote.matcher(field) - if (m.find()) { - return m.replaceFirst('$1') - } else { - return field + while (header == null && (line = br.readLine()) != null) { + if (!line.startsWith("#")) { + header = splitRegex.split(line, -1).collect { field -> + def m = removeQuote.matcher(field) + m.find() ? m.replaceFirst('$1') : field } } - assert header.size() == data.size(): "Row $row should contain the same number as fields as the header" - - def dataMap = [header, data].transpose().collectEntries().findAll{it.value != null} - output.add(dataMap) + row++ + } + assert header != null : "CSV file should contain a header" + + while ((line = br.readLine()) != null) { + row++ + if (!line.startsWith("#")) { + def predata = splitRegex.split(line, -1) + def data = predata.collect { field -> + if (field == "") { + return null + } + def m = removeQuote.matcher(field) + if (m.find()) { + return m.replaceFirst('$1') + } else { + return field + } + } + assert header.size() == data.size() : "Row $row should contain the same number as fields as the header" + + def dataMap = [header, data].transpose().collectEntries().findAll { it.value != null } + output.add(dataMap) + } } } @@ -1709,10 +1704,25 @@ process publishFilesProc { ] .transpose() .collectMany{infile, outfile -> - if (infile.toString() != outfile.toString()) { + def infileString = infile.toString() + def outfileString = outfile.toString() + if (infileString != outfileString) { + /* Trailing slashes are removed from both the source and destination arguments. + From source arguments, this is useful when a source argument may have a trailing slash + and specify a symbolic link to a directory. Without removing the slash, cp will dereference + the symbolic link. + See https://www.gnu.org/software/coreutils/manual/html_node/Trailing-slashes.html#Trailing-slashes-1 + + For the destination path addding a trailing slash is a problem when publishing directories: + it requires the destination directory to exist. This fails because we only create the parent + directories first. + */ + def regexTrailingSlashes = ~/\/+$/ + def infileNoTrailingSlash = infileString - regexTrailingSlashes + def outfileNoTrailingSlash = outfileString - regexTrailingSlashes [ - "[ -d \"\$(dirname '${outfile.toString()}')\" ] || mkdir -p \"\$(dirname '${outfile.toString()}')\"", - "cp -r '${infile.toString()}' '${outfile.toString()}'" + "[ -d \"\$(dirname '${outfileNoTrailingSlash}')\" ] || mkdir -p \"\$(dirname '${outfileNoTrailingSlash}')\"", + "cp -a '${infileNoTrailingSlash}' '${outfileNoTrailingSlash}'" ] } else { // no need to copy if infile is the same as outfile @@ -3035,7 +3045,7 @@ meta = [ "config": processConfig(readJsonBlob('''{ "name" : "clr", "namespace" : "transform", - "version" : "v4.0.3", + "version" : "v4.1.0", "authors" : [ { "name" : "Dries Schaumont", @@ -3147,7 +3157,7 @@ meta = [ { "type" : "string", "name" : "--output_compression", - "description" : "Compression format to use for the output AnnData and/or Mudata objects.\nBy default no compression is applied.\n", + "description" : "Compression format to use for the output AnnData and/or Mudata H5 files.\nBy default no compression is applied.\n", "example" : [ "gzip" ], @@ -3289,7 +3299,7 @@ meta = [ "id" : "docker", "image" : "python:3.13-slim", "target_registry" : "images.viash-hub.com", - "target_tag" : "v4.0.3", + "target_tag" : "v4.1.0", "namespace_separator" : "/", "setup" : [ { @@ -3303,9 +3313,10 @@ meta = [ "type" : "python", "user" : false, "packages" : [ - "anndata~=0.12.7", + "anndata~=0.12.16", "awkward", - "mudata~=0.3.2", + "scipy~=1.17.1", + "mudata~=0.3.8", "scanpy~=1.11.4", "muon~=0.1.7" ], @@ -3320,7 +3331,7 @@ meta = [ "type" : "python", "user" : false, "packages" : [ - "viashpy==0.8.0" + "viashpy==0.10.0" ], "upgrade" : true } @@ -3336,13 +3347,13 @@ meta = [ "runner" : "nextflow", "engine" : "docker|native", "output" : "/workdir/root/repo/target/nextflow/transform/clr", - "viash_version" : "0.9.4", - "git_commit" : "7bfad4ea12f87eca59213be3ab08deff67cc4206", + "viash_version" : "0.9.7", + "git_commit" : "a6499fddaa8553874585c747370f919f4d7b729c", "git_remote" : "https://github.com/openpipelines-bio/openpipeline" }, "package_config" : { "name" : "openpipeline", - "version" : "v4.0.3", + "version" : "v4.1.0", "summary" : "Best-practice workflows for single-cell multi-omics analyses.\n", "description" : "OpenPipelines are extensible single cell analysis pipelines for reproducible and large-scale single cell processing using [Viash](https://viash.io) and [Nextflow](https://www.nextflow.io/).\n\nIn terms of workflows, the following has been made available, but keep in mind that\nindividual tools and functionality can be executed as standalone components as well.\n\n * Demultiplexing: conversion of raw sequencing data to FASTQ objects.\n * Ingestion: Read mapping and generating a count matrix.\n * Single sample processing: cell filtering and doublet detection.\n * Multisample processing: Count transformation, normalization, QC metric calulations.\n * Integration: Clustering, integration and batch correction using single and multimodal methods.\n * Downstream analysis workflows\n", "info" : { @@ -3360,14 +3371,14 @@ meta = [ } ] }, - "viash_version" : "0.9.4", + "viash_version" : "0.9.7", "source" : "/workdir/root/repo/src", "target" : "/workdir/root/repo/target", "config_mods" : [ ".resources += {path: '/src/workflows/utils/labels.config', dest: 'nextflow_labels.config'}\n.runners[.type == 'nextflow'].config.script := 'includeConfig(\\"nextflow_labels.config\\")'", ".engines += { type: \\"native\\" }", ".engines[.type == 'docker'].target_registry := 'images.viash-hub.com'", - ".engines[.type == 'docker'].target_tag := 'v4.0.3'" + ".engines[.type == 'docker'].target_tag := 'v4.1.0'" ], "keywords" : [ "single-cell", @@ -3448,6 +3459,10 @@ def main(): input_data = read_h5ad(par["input"], mod=par["modality"]) if par["input_layer"]: input_data = AnnData(X=input_data.layers[par["input_layer"]]) + number_of_observations = input_data.n_obs + assert number_of_observations > 1, ( + f"Need at least two observations to perform CLR normalization. Found: {number_of_observations}" + ) # CLR always normalizes the .X layer, so we have to create an AnnData file with # the input layer at .X normalized_counts = pt.pp.clr(input_data, axis=par["axis"], inplace=False) @@ -3853,7 +3868,7 @@ meta["defaults"] = [ "container" : { "registry" : "images.viash-hub.com", "image" : "vsh/openpipeline/transform/clr", - "tag" : "v4.0.3" + "tag" : "v4.1.0" }, "label" : [ "lowmem", diff --git a/target/dependencies/vsh/vsh/openpipeline/v4.0.3/nextflow/transform/clr/nextflow.config b/target/dependencies/vsh/vsh/openpipeline/v4.1.0/nextflow/transform/clr/nextflow.config similarity index 99% rename from target/dependencies/vsh/vsh/openpipeline/v4.0.3/nextflow/transform/clr/nextflow.config rename to target/dependencies/vsh/vsh/openpipeline/v4.1.0/nextflow/transform/clr/nextflow.config index 13c6022..8f439ba 100644 --- a/target/dependencies/vsh/vsh/openpipeline/v4.0.3/nextflow/transform/clr/nextflow.config +++ b/target/dependencies/vsh/vsh/openpipeline/v4.1.0/nextflow/transform/clr/nextflow.config @@ -2,7 +2,7 @@ manifest { name = 'transform/clr' mainScript = 'main.nf' nextflowVersion = '!>=20.12.1-edge' - version = 'v4.0.3' + version = 'v4.1.0' description = 'Perform CLR normalization on CITE-seq data (Stoeckius et al., 2017).\n' author = 'Dries Schaumont' } diff --git a/target/dependencies/vsh/vsh/openpipeline/v4.0.3/nextflow/transform/log1p/nextflow_labels.config b/target/dependencies/vsh/vsh/openpipeline/v4.1.0/nextflow/transform/clr/nextflow_labels.config similarity index 100% rename from target/dependencies/vsh/vsh/openpipeline/v4.0.3/nextflow/transform/log1p/nextflow_labels.config rename to target/dependencies/vsh/vsh/openpipeline/v4.1.0/nextflow/transform/clr/nextflow_labels.config diff --git a/target/dependencies/vsh/vsh/openpipeline/v4.0.3/nextflow/transform/clr/nextflow_schema.json b/target/dependencies/vsh/vsh/openpipeline/v4.1.0/nextflow/transform/clr/nextflow_schema.json similarity index 97% rename from target/dependencies/vsh/vsh/openpipeline/v4.0.3/nextflow/transform/clr/nextflow_schema.json rename to target/dependencies/vsh/vsh/openpipeline/v4.1.0/nextflow/transform/clr/nextflow_schema.json index cf13db6..16115fe 100644 --- a/target/dependencies/vsh/vsh/openpipeline/v4.0.3/nextflow/transform/clr/nextflow_schema.json +++ b/target/dependencies/vsh/vsh/openpipeline/v4.1.0/nextflow/transform/clr/nextflow_schema.json @@ -51,7 +51,7 @@ }, "output_compression": { "type": "string", - "description": "Compression format to use for the output AnnData and/or Mudata objects.\nBy default no compression is applied.\n", + "description": "Compression format to use for the output AnnData and/or Mudata H5 files.\nBy default no compression is applied.\n", "help_text": "Type: `string`, multiple: `False`, example: `\"gzip\"`, choices: ``gzip`, `lzf``. ", "enum": [ "gzip", diff --git a/target/dependencies/vsh/vsh/openpipeline/v4.0.3/nextflow/transform/delete_layer/.config.vsh.yaml b/target/dependencies/vsh/vsh/openpipeline/v4.1.0/nextflow/transform/delete_layer/.config.vsh.yaml similarity index 95% rename from target/dependencies/vsh/vsh/openpipeline/v4.0.3/nextflow/transform/delete_layer/.config.vsh.yaml rename to target/dependencies/vsh/vsh/openpipeline/v4.1.0/nextflow/transform/delete_layer/.config.vsh.yaml index 000e6f1..f231e69 100644 --- a/target/dependencies/vsh/vsh/openpipeline/v4.0.3/nextflow/transform/delete_layer/.config.vsh.yaml +++ b/target/dependencies/vsh/vsh/openpipeline/v4.1.0/nextflow/transform/delete_layer/.config.vsh.yaml @@ -1,6 +1,6 @@ name: "delete_layer" namespace: "transform" -version: "v4.0.3" +version: "v4.1.0" authors: - name: "Dries Schaumont" roles: @@ -72,8 +72,8 @@ argument_groups: direction: "input" - type: "string" name: "--output_compression" - description: "Compression format to use for the output AnnData and/or Mudata objects.\n\ - By default no compression is applied.\n" + description: "Compression format to use for the output AnnData and/or Mudata H5\ + \ files.\nBy default no compression is applied.\n" info: null example: - "gzip" @@ -186,7 +186,7 @@ engines: id: "docker" image: "python:3.12-slim" target_registry: "images.viash-hub.com" - target_tag: "v4.0.3" + target_tag: "v4.1.0" namespace_separator: "/" setup: - type: "apt" @@ -196,9 +196,10 @@ engines: - type: "python" user: false packages: - - "anndata~=0.12.7" + - "anndata~=0.12.16" - "awkward" - - "mudata~=0.3.2" + - "scipy~=1.17.1" + - "mudata~=0.3.8" script: - "exec(\"try:\\n import zarr; from importlib.metadata import version\\nexcept\ \ ModuleNotFoundError:\\n exit(0)\\nelse: assert int(version(\\\"zarr\\\"\ @@ -212,7 +213,7 @@ engines: - type: "python" user: false packages: - - "viashpy==0.8.0" + - "viashpy==0.10.0" github: - "openpipelines-bio/core#subdirectory=packages/python/openpipeline_testutils" upgrade: true @@ -226,12 +227,12 @@ build_info: engine: "docker|native" output: "target/nextflow/transform/delete_layer" executable: "target/nextflow/transform/delete_layer/main.nf" - viash_version: "0.9.4" - git_commit: "7bfad4ea12f87eca59213be3ab08deff67cc4206" + viash_version: "0.9.7" + git_commit: "a6499fddaa8553874585c747370f919f4d7b729c" git_remote: "https://github.com/openpipelines-bio/openpipeline" package_config: name: "openpipeline" - version: "v4.0.3" + version: "v4.1.0" summary: "Best-practice workflows for single-cell multi-omics analyses.\n" description: "OpenPipelines are extensible single cell analysis pipelines for reproducible\ \ and large-scale single cell processing using [Viash](https://viash.io) and [Nextflow](https://www.nextflow.io/).\n\ @@ -252,7 +253,7 @@ package_config: - path: "src/workflows/utils/labels_ci.config" description: "Adds the correct memory and CPU labels when running on the Viash\ \ Hub CI." - viash_version: "0.9.4" + viash_version: "0.9.7" source: "src" target: "target" config_mods: @@ -261,7 +262,7 @@ package_config: )'" - ".engines += { type: \"native\" }" - ".engines[.type == 'docker'].target_registry := 'images.viash-hub.com'" - - ".engines[.type == 'docker'].target_tag := 'v4.0.3'" + - ".engines[.type == 'docker'].target_tag := 'v4.1.0'" keywords: - "single-cell" - "multimodal" diff --git a/target/dependencies/vsh/vsh/openpipeline/v4.0.3/nextflow/transform/log1p/compress_h5mu.py b/target/dependencies/vsh/vsh/openpipeline/v4.1.0/nextflow/transform/delete_layer/compress_h5mu.py similarity index 100% rename from target/dependencies/vsh/vsh/openpipeline/v4.0.3/nextflow/transform/log1p/compress_h5mu.py rename to target/dependencies/vsh/vsh/openpipeline/v4.1.0/nextflow/transform/delete_layer/compress_h5mu.py diff --git a/target/dependencies/vsh/vsh/openpipeline/v4.0.3/nextflow/transform/delete_layer/main.nf b/target/dependencies/vsh/vsh/openpipeline/v4.1.0/nextflow/transform/delete_layer/main.nf similarity index 98% rename from target/dependencies/vsh/vsh/openpipeline/v4.0.3/nextflow/transform/delete_layer/main.nf rename to target/dependencies/vsh/vsh/openpipeline/v4.1.0/nextflow/transform/delete_layer/main.nf index 2c85dc8..3994e0f 100644 --- a/target/dependencies/vsh/vsh/openpipeline/v4.0.3/nextflow/transform/delete_layer/main.nf +++ b/target/dependencies/vsh/vsh/openpipeline/v4.1.0/nextflow/transform/delete_layer/main.nf @@ -1,6 +1,6 @@ -// delete_layer v4.0.3 +// delete_layer v4.1.0 // -// This wrapper script is auto-generated by viash 0.9.4 and is thus a derivative +// This wrapper script is auto-generated by viash 0.9.7 and is thus a derivative // work thereof. This software comes with ABSOLUTELY NO WARRANTY from Data // Intuitive. // @@ -1353,47 +1353,42 @@ def readCsv(file_path) { def splitRegex = java.util.regex.Pattern.compile(''',(?=(?:[^"]*"[^"]*")*[^"]*$)''') def removeQuote = java.util.regex.Pattern.compile('''"(.*)"''') - def br = java.nio.file.Files.newBufferedReader(inputFile) + java.nio.file.Files.newBufferedReader(inputFile).withCloseable { br -> + def row = 0 + def header = null + def line - def row = -1 - def header = null - while (br.ready() && header == null) { - def line = br.readLine() - row++ - if (!line.startsWith("#")) { - header = splitRegex.split(line, -1).collect{field -> - m = removeQuote.matcher(field) - m.find() ? m.replaceFirst('$1') : field - } - } - } - assert header != null: "CSV file should contain a header" - - while (br.ready()) { - def line = br.readLine() - row++ - if (line == null) { - br.close() - break - } - - if (!line.startsWith("#")) { - def predata = splitRegex.split(line, -1) - def data = predata.collect{field -> - if (field == "") { - return null - } - def m = removeQuote.matcher(field) - if (m.find()) { - return m.replaceFirst('$1') - } else { - return field + while (header == null && (line = br.readLine()) != null) { + if (!line.startsWith("#")) { + header = splitRegex.split(line, -1).collect { field -> + def m = removeQuote.matcher(field) + m.find() ? m.replaceFirst('$1') : field } } - assert header.size() == data.size(): "Row $row should contain the same number as fields as the header" - - def dataMap = [header, data].transpose().collectEntries().findAll{it.value != null} - output.add(dataMap) + row++ + } + assert header != null : "CSV file should contain a header" + + while ((line = br.readLine()) != null) { + row++ + if (!line.startsWith("#")) { + def predata = splitRegex.split(line, -1) + def data = predata.collect { field -> + if (field == "") { + return null + } + def m = removeQuote.matcher(field) + if (m.find()) { + return m.replaceFirst('$1') + } else { + return field + } + } + assert header.size() == data.size() : "Row $row should contain the same number as fields as the header" + + def dataMap = [header, data].transpose().collectEntries().findAll { it.value != null } + output.add(dataMap) + } } } @@ -1709,10 +1704,25 @@ process publishFilesProc { ] .transpose() .collectMany{infile, outfile -> - if (infile.toString() != outfile.toString()) { + def infileString = infile.toString() + def outfileString = outfile.toString() + if (infileString != outfileString) { + /* Trailing slashes are removed from both the source and destination arguments. + From source arguments, this is useful when a source argument may have a trailing slash + and specify a symbolic link to a directory. Without removing the slash, cp will dereference + the symbolic link. + See https://www.gnu.org/software/coreutils/manual/html_node/Trailing-slashes.html#Trailing-slashes-1 + + For the destination path addding a trailing slash is a problem when publishing directories: + it requires the destination directory to exist. This fails because we only create the parent + directories first. + */ + def regexTrailingSlashes = ~/\/+$/ + def infileNoTrailingSlash = infileString - regexTrailingSlashes + def outfileNoTrailingSlash = outfileString - regexTrailingSlashes [ - "[ -d \"\$(dirname '${outfile.toString()}')\" ] || mkdir -p \"\$(dirname '${outfile.toString()}')\"", - "cp -r '${infile.toString()}' '${outfile.toString()}'" + "[ -d \"\$(dirname '${outfileNoTrailingSlash}')\" ] || mkdir -p \"\$(dirname '${outfileNoTrailingSlash}')\"", + "cp -a '${infileNoTrailingSlash}' '${outfileNoTrailingSlash}'" ] } else { // no need to copy if infile is the same as outfile @@ -3035,7 +3045,7 @@ meta = [ "config": processConfig(readJsonBlob('''{ "name" : "delete_layer", "namespace" : "transform", - "version" : "v4.0.3", + "version" : "v4.1.0", "authors" : [ { "name" : "Dries Schaumont", @@ -3128,7 +3138,7 @@ meta = [ { "type" : "string", "name" : "--output_compression", - "description" : "Compression format to use for the output AnnData and/or Mudata objects.\nBy default no compression is applied.\n", + "description" : "Compression format to use for the output AnnData and/or Mudata H5 files.\nBy default no compression is applied.\n", "example" : [ "gzip" ], @@ -3273,7 +3283,7 @@ meta = [ "id" : "docker", "image" : "python:3.12-slim", "target_registry" : "images.viash-hub.com", - "target_tag" : "v4.0.3", + "target_tag" : "v4.1.0", "namespace_separator" : "/", "setup" : [ { @@ -3287,9 +3297,10 @@ meta = [ "type" : "python", "user" : false, "packages" : [ - "anndata~=0.12.7", + "anndata~=0.12.16", "awkward", - "mudata~=0.3.2" + "scipy~=1.17.1", + "mudata~=0.3.8" ], "script" : [ "exec(\\"try:\\\\n import zarr; from importlib.metadata import version\\\\nexcept ModuleNotFoundError:\\\\n exit(0)\\\\nelse: assert int(version(\\\\\\"zarr\\\\\\").partition(\\\\\\".\\\\\\")[0]) > 2\\")" @@ -3309,7 +3320,7 @@ meta = [ "type" : "python", "user" : false, "packages" : [ - "viashpy==0.8.0" + "viashpy==0.10.0" ], "github" : [ "openpipelines-bio/core#subdirectory=packages/python/openpipeline_testutils" @@ -3328,13 +3339,13 @@ meta = [ "runner" : "nextflow", "engine" : "docker|native", "output" : "/workdir/root/repo/target/nextflow/transform/delete_layer", - "viash_version" : "0.9.4", - "git_commit" : "7bfad4ea12f87eca59213be3ab08deff67cc4206", + "viash_version" : "0.9.7", + "git_commit" : "a6499fddaa8553874585c747370f919f4d7b729c", "git_remote" : "https://github.com/openpipelines-bio/openpipeline" }, "package_config" : { "name" : "openpipeline", - "version" : "v4.0.3", + "version" : "v4.1.0", "summary" : "Best-practice workflows for single-cell multi-omics analyses.\n", "description" : "OpenPipelines are extensible single cell analysis pipelines for reproducible and large-scale single cell processing using [Viash](https://viash.io) and [Nextflow](https://www.nextflow.io/).\n\nIn terms of workflows, the following has been made available, but keep in mind that\nindividual tools and functionality can be executed as standalone components as well.\n\n * Demultiplexing: conversion of raw sequencing data to FASTQ objects.\n * Ingestion: Read mapping and generating a count matrix.\n * Single sample processing: cell filtering and doublet detection.\n * Multisample processing: Count transformation, normalization, QC metric calulations.\n * Integration: Clustering, integration and batch correction using single and multimodal methods.\n * Downstream analysis workflows\n", "info" : { @@ -3352,14 +3363,14 @@ meta = [ } ] }, - "viash_version" : "0.9.4", + "viash_version" : "0.9.7", "source" : "/workdir/root/repo/src", "target" : "/workdir/root/repo/target", "config_mods" : [ ".resources += {path: '/src/workflows/utils/labels.config', dest: 'nextflow_labels.config'}\n.runners[.type == 'nextflow'].config.script := 'includeConfig(\\"nextflow_labels.config\\")'", ".engines += { type: \\"native\\" }", ".engines[.type == 'docker'].target_registry := 'images.viash-hub.com'", - ".engines[.type == 'docker'].target_tag := 'v4.0.3'" + ".engines[.type == 'docker'].target_tag := 'v4.1.0'" ], "keywords" : [ "single-cell", @@ -3844,7 +3855,7 @@ meta["defaults"] = [ "container" : { "registry" : "images.viash-hub.com", "image" : "vsh/openpipeline/transform/delete_layer", - "tag" : "v4.0.3" + "tag" : "v4.1.0" }, "label" : [ "midmem", diff --git a/target/dependencies/vsh/vsh/openpipeline/v4.0.3/nextflow/transform/delete_layer/nextflow.config b/target/dependencies/vsh/vsh/openpipeline/v4.1.0/nextflow/transform/delete_layer/nextflow.config similarity index 99% rename from target/dependencies/vsh/vsh/openpipeline/v4.0.3/nextflow/transform/delete_layer/nextflow.config rename to target/dependencies/vsh/vsh/openpipeline/v4.1.0/nextflow/transform/delete_layer/nextflow.config index 38424eb..9c82821 100644 --- a/target/dependencies/vsh/vsh/openpipeline/v4.0.3/nextflow/transform/delete_layer/nextflow.config +++ b/target/dependencies/vsh/vsh/openpipeline/v4.1.0/nextflow/transform/delete_layer/nextflow.config @@ -2,7 +2,7 @@ manifest { name = 'transform/delete_layer' mainScript = 'main.nf' nextflowVersion = '!>=20.12.1-edge' - version = 'v4.0.3' + version = 'v4.1.0' description = 'Delete an anndata layer from one or more modalities.\n' author = 'Dries Schaumont' } diff --git a/target/dependencies/vsh/vsh/openpipeline/v4.0.3/nextflow/transform/normalize_total/nextflow_labels.config b/target/dependencies/vsh/vsh/openpipeline/v4.1.0/nextflow/transform/delete_layer/nextflow_labels.config similarity index 100% rename from target/dependencies/vsh/vsh/openpipeline/v4.0.3/nextflow/transform/normalize_total/nextflow_labels.config rename to target/dependencies/vsh/vsh/openpipeline/v4.1.0/nextflow/transform/delete_layer/nextflow_labels.config diff --git a/target/dependencies/vsh/vsh/openpipeline/v4.0.3/nextflow/transform/delete_layer/nextflow_schema.json b/target/dependencies/vsh/vsh/openpipeline/v4.1.0/nextflow/transform/delete_layer/nextflow_schema.json similarity index 97% rename from target/dependencies/vsh/vsh/openpipeline/v4.0.3/nextflow/transform/delete_layer/nextflow_schema.json rename to target/dependencies/vsh/vsh/openpipeline/v4.1.0/nextflow/transform/delete_layer/nextflow_schema.json index c2a74fc..644348c 100644 --- a/target/dependencies/vsh/vsh/openpipeline/v4.0.3/nextflow/transform/delete_layer/nextflow_schema.json +++ b/target/dependencies/vsh/vsh/openpipeline/v4.1.0/nextflow/transform/delete_layer/nextflow_schema.json @@ -45,7 +45,7 @@ }, "output_compression": { "type": "string", - "description": "Compression format to use for the output AnnData and/or Mudata objects.\nBy default no compression is applied.\n", + "description": "Compression format to use for the output AnnData and/or Mudata H5 files.\nBy default no compression is applied.\n", "help_text": "Type: `string`, multiple: `False`, example: `\"gzip\"`, choices: ``gzip`, `lzf``. ", "enum": [ "gzip", diff --git a/target/dependencies/vsh/vsh/openpipeline/v4.0.3/nextflow/transform/log1p/setup_logger.py b/target/dependencies/vsh/vsh/openpipeline/v4.1.0/nextflow/transform/delete_layer/setup_logger.py similarity index 100% rename from target/dependencies/vsh/vsh/openpipeline/v4.0.3/nextflow/transform/log1p/setup_logger.py rename to target/dependencies/vsh/vsh/openpipeline/v4.1.0/nextflow/transform/delete_layer/setup_logger.py diff --git a/target/dependencies/vsh/vsh/openpipeline/v4.0.3/nextflow/transform/log1p/.config.vsh.yaml b/target/dependencies/vsh/vsh/openpipeline/v4.1.0/nextflow/transform/log1p/.config.vsh.yaml similarity index 95% rename from target/dependencies/vsh/vsh/openpipeline/v4.0.3/nextflow/transform/log1p/.config.vsh.yaml rename to target/dependencies/vsh/vsh/openpipeline/v4.1.0/nextflow/transform/log1p/.config.vsh.yaml index 929508b..c83776b 100644 --- a/target/dependencies/vsh/vsh/openpipeline/v4.0.3/nextflow/transform/log1p/.config.vsh.yaml +++ b/target/dependencies/vsh/vsh/openpipeline/v4.1.0/nextflow/transform/log1p/.config.vsh.yaml @@ -1,6 +1,6 @@ name: "log1p" namespace: "transform" -version: "v4.0.3" +version: "v4.1.0" authors: - name: "Dries De Maeyer" roles: @@ -101,8 +101,8 @@ argument_groups: multiple_sep: ";" - type: "string" name: "--output_compression" - description: "Compression format to use for the output AnnData and/or Mudata objects.\n\ - By default no compression is applied.\n" + description: "Compression format to use for the output AnnData and/or Mudata H5\ + \ files.\nBy default no compression is applied.\n" info: null example: - "gzip" @@ -217,7 +217,7 @@ engines: id: "docker" image: "python:3.12-slim" target_registry: "images.viash-hub.com" - target_tag: "v4.0.3" + target_tag: "v4.1.0" namespace_separator: "/" setup: - type: "apt" @@ -227,9 +227,10 @@ engines: - type: "python" user: false packages: - - "anndata~=0.12.7" + - "anndata~=0.12.16" - "awkward" - - "mudata~=0.3.2" + - "scipy~=1.17.1" + - "mudata~=0.3.8" - "scanpy~=1.11.4" script: - "exec(\"try:\\n import zarr; from importlib.metadata import version\\nexcept\ @@ -240,7 +241,7 @@ engines: - type: "python" user: false packages: - - "viashpy==0.8.0" + - "viashpy==0.10.0" upgrade: true entrypoint: [] cmd: null @@ -252,12 +253,12 @@ build_info: engine: "docker|native" output: "target/nextflow/transform/log1p" executable: "target/nextflow/transform/log1p/main.nf" - viash_version: "0.9.4" - git_commit: "7bfad4ea12f87eca59213be3ab08deff67cc4206" + viash_version: "0.9.7" + git_commit: "a6499fddaa8553874585c747370f919f4d7b729c" git_remote: "https://github.com/openpipelines-bio/openpipeline" package_config: name: "openpipeline" - version: "v4.0.3" + version: "v4.1.0" summary: "Best-practice workflows for single-cell multi-omics analyses.\n" description: "OpenPipelines are extensible single cell analysis pipelines for reproducible\ \ and large-scale single cell processing using [Viash](https://viash.io) and [Nextflow](https://www.nextflow.io/).\n\ @@ -278,7 +279,7 @@ package_config: - path: "src/workflows/utils/labels_ci.config" description: "Adds the correct memory and CPU labels when running on the Viash\ \ Hub CI." - viash_version: "0.9.4" + viash_version: "0.9.7" source: "src" target: "target" config_mods: @@ -287,7 +288,7 @@ package_config: )'" - ".engines += { type: \"native\" }" - ".engines[.type == 'docker'].target_registry := 'images.viash-hub.com'" - - ".engines[.type == 'docker'].target_tag := 'v4.0.3'" + - ".engines[.type == 'docker'].target_tag := 'v4.1.0'" keywords: - "single-cell" - "multimodal" diff --git a/target/dependencies/vsh/vsh/openpipeline/v4.0.3/nextflow/transform/normalize_total/compress_h5mu.py b/target/dependencies/vsh/vsh/openpipeline/v4.1.0/nextflow/transform/log1p/compress_h5mu.py similarity index 100% rename from target/dependencies/vsh/vsh/openpipeline/v4.0.3/nextflow/transform/normalize_total/compress_h5mu.py rename to target/dependencies/vsh/vsh/openpipeline/v4.1.0/nextflow/transform/log1p/compress_h5mu.py diff --git a/target/dependencies/vsh/vsh/openpipeline/v4.0.3/nextflow/transform/log1p/main.nf b/target/dependencies/vsh/vsh/openpipeline/v4.1.0/nextflow/transform/log1p/main.nf similarity index 97% rename from target/dependencies/vsh/vsh/openpipeline/v4.0.3/nextflow/transform/log1p/main.nf rename to target/dependencies/vsh/vsh/openpipeline/v4.1.0/nextflow/transform/log1p/main.nf index 92a48d2..6a748ae 100644 --- a/target/dependencies/vsh/vsh/openpipeline/v4.0.3/nextflow/transform/log1p/main.nf +++ b/target/dependencies/vsh/vsh/openpipeline/v4.1.0/nextflow/transform/log1p/main.nf @@ -1,6 +1,6 @@ -// log1p v4.0.3 +// log1p v4.1.0 // -// This wrapper script is auto-generated by viash 0.9.4 and is thus a derivative +// This wrapper script is auto-generated by viash 0.9.7 and is thus a derivative // work thereof. This software comes with ABSOLUTELY NO WARRANTY from Data // Intuitive. // @@ -1354,47 +1354,42 @@ def readCsv(file_path) { def splitRegex = java.util.regex.Pattern.compile(''',(?=(?:[^"]*"[^"]*")*[^"]*$)''') def removeQuote = java.util.regex.Pattern.compile('''"(.*)"''') - def br = java.nio.file.Files.newBufferedReader(inputFile) + java.nio.file.Files.newBufferedReader(inputFile).withCloseable { br -> + def row = 0 + def header = null + def line - def row = -1 - def header = null - while (br.ready() && header == null) { - def line = br.readLine() - row++ - if (!line.startsWith("#")) { - header = splitRegex.split(line, -1).collect{field -> - m = removeQuote.matcher(field) - m.find() ? m.replaceFirst('$1') : field - } - } - } - assert header != null: "CSV file should contain a header" - - while (br.ready()) { - def line = br.readLine() - row++ - if (line == null) { - br.close() - break - } - - if (!line.startsWith("#")) { - def predata = splitRegex.split(line, -1) - def data = predata.collect{field -> - if (field == "") { - return null - } - def m = removeQuote.matcher(field) - if (m.find()) { - return m.replaceFirst('$1') - } else { - return field + while (header == null && (line = br.readLine()) != null) { + if (!line.startsWith("#")) { + header = splitRegex.split(line, -1).collect { field -> + def m = removeQuote.matcher(field) + m.find() ? m.replaceFirst('$1') : field } } - assert header.size() == data.size(): "Row $row should contain the same number as fields as the header" - - def dataMap = [header, data].transpose().collectEntries().findAll{it.value != null} - output.add(dataMap) + row++ + } + assert header != null : "CSV file should contain a header" + + while ((line = br.readLine()) != null) { + row++ + if (!line.startsWith("#")) { + def predata = splitRegex.split(line, -1) + def data = predata.collect { field -> + if (field == "") { + return null + } + def m = removeQuote.matcher(field) + if (m.find()) { + return m.replaceFirst('$1') + } else { + return field + } + } + assert header.size() == data.size() : "Row $row should contain the same number as fields as the header" + + def dataMap = [header, data].transpose().collectEntries().findAll { it.value != null } + output.add(dataMap) + } } } @@ -1710,10 +1705,25 @@ process publishFilesProc { ] .transpose() .collectMany{infile, outfile -> - if (infile.toString() != outfile.toString()) { + def infileString = infile.toString() + def outfileString = outfile.toString() + if (infileString != outfileString) { + /* Trailing slashes are removed from both the source and destination arguments. + From source arguments, this is useful when a source argument may have a trailing slash + and specify a symbolic link to a directory. Without removing the slash, cp will dereference + the symbolic link. + See https://www.gnu.org/software/coreutils/manual/html_node/Trailing-slashes.html#Trailing-slashes-1 + + For the destination path addding a trailing slash is a problem when publishing directories: + it requires the destination directory to exist. This fails because we only create the parent + directories first. + */ + def regexTrailingSlashes = ~/\/+$/ + def infileNoTrailingSlash = infileString - regexTrailingSlashes + def outfileNoTrailingSlash = outfileString - regexTrailingSlashes [ - "[ -d \"\$(dirname '${outfile.toString()}')\" ] || mkdir -p \"\$(dirname '${outfile.toString()}')\"", - "cp -r '${infile.toString()}' '${outfile.toString()}'" + "[ -d \"\$(dirname '${outfileNoTrailingSlash}')\" ] || mkdir -p \"\$(dirname '${outfileNoTrailingSlash}')\"", + "cp -a '${infileNoTrailingSlash}' '${outfileNoTrailingSlash}'" ] } else { // no need to copy if infile is the same as outfile @@ -3036,7 +3046,7 @@ meta = [ "config": processConfig(readJsonBlob('''{ "name" : "log1p", "namespace" : "transform", - "version" : "v4.0.3", + "version" : "v4.1.0", "authors" : [ { "name" : "Dries De Maeyer", @@ -3170,7 +3180,7 @@ meta = [ { "type" : "string", "name" : "--output_compression", - "description" : "Compression format to use for the output AnnData and/or Mudata objects.\nBy default no compression is applied.\n", + "description" : "Compression format to use for the output AnnData and/or Mudata H5 files.\nBy default no compression is applied.\n", "example" : [ "gzip" ], @@ -3316,7 +3326,7 @@ meta = [ "id" : "docker", "image" : "python:3.12-slim", "target_registry" : "images.viash-hub.com", - "target_tag" : "v4.0.3", + "target_tag" : "v4.1.0", "namespace_separator" : "/", "setup" : [ { @@ -3330,9 +3340,10 @@ meta = [ "type" : "python", "user" : false, "packages" : [ - "anndata~=0.12.7", + "anndata~=0.12.16", "awkward", - "mudata~=0.3.2", + "scipy~=1.17.1", + "mudata~=0.3.8", "scanpy~=1.11.4" ], "script" : [ @@ -3346,7 +3357,7 @@ meta = [ "type" : "python", "user" : false, "packages" : [ - "viashpy==0.8.0" + "viashpy==0.10.0" ], "upgrade" : true } @@ -3362,13 +3373,13 @@ meta = [ "runner" : "nextflow", "engine" : "docker|native", "output" : "/workdir/root/repo/target/nextflow/transform/log1p", - "viash_version" : "0.9.4", - "git_commit" : "7bfad4ea12f87eca59213be3ab08deff67cc4206", + "viash_version" : "0.9.7", + "git_commit" : "a6499fddaa8553874585c747370f919f4d7b729c", "git_remote" : "https://github.com/openpipelines-bio/openpipeline" }, "package_config" : { "name" : "openpipeline", - "version" : "v4.0.3", + "version" : "v4.1.0", "summary" : "Best-practice workflows for single-cell multi-omics analyses.\n", "description" : "OpenPipelines are extensible single cell analysis pipelines for reproducible and large-scale single cell processing using [Viash](https://viash.io) and [Nextflow](https://www.nextflow.io/).\n\nIn terms of workflows, the following has been made available, but keep in mind that\nindividual tools and functionality can be executed as standalone components as well.\n\n * Demultiplexing: conversion of raw sequencing data to FASTQ objects.\n * Ingestion: Read mapping and generating a count matrix.\n * Single sample processing: cell filtering and doublet detection.\n * Multisample processing: Count transformation, normalization, QC metric calulations.\n * Integration: Clustering, integration and batch correction using single and multimodal methods.\n * Downstream analysis workflows\n", "info" : { @@ -3386,14 +3397,14 @@ meta = [ } ] }, - "viash_version" : "0.9.4", + "viash_version" : "0.9.7", "source" : "/workdir/root/repo/src", "target" : "/workdir/root/repo/target", "config_mods" : [ ".resources += {path: '/src/workflows/utils/labels.config', dest: 'nextflow_labels.config'}\n.runners[.type == 'nextflow'].config.script := 'includeConfig(\\"nextflow_labels.config\\")'", ".engines += { type: \\"native\\" }", ".engines[.type == 'docker'].target_registry := 'images.viash-hub.com'", - ".engines[.type == 'docker'].target_tag := 'v4.0.3'" + ".engines[.type == 'docker'].target_tag := 'v4.1.0'" ], "keywords" : [ "single-cell", @@ -3423,7 +3434,6 @@ tempscript=".viash_script.py" cat > "$tempscript" << VIASHMAIN import scanpy as sc import mudata as mu -import anndata as ad import sys ## VIASH START @@ -3475,23 +3485,20 @@ assert data.var_names.is_unique, "Expected var_names to be unique." logger.info("Performing log transformation") # Make our own copy with not a lot of data -# this avoid excessive memory usage and accidental overwrites +# this avoid excessive memory usage input_layer = data.layers[par["input_layer"]] if par["input_layer"] else data.X -data_for_scanpy = ad.AnnData(X=input_layer.copy()) -sc.pp.log1p( - data_for_scanpy, - base=par["base"], - layer=None, # use X - copy=False, -) # allow overwrites in the copy that was made -# Scanpy will overwrite the input layer. -# So fetch input layer from the copy and use it to populate the output slot +transformed_matrix = sc.pp.log1p( + input_layer, + base=par["base"], + copy=True, # Avoid accidental overwrites +) + if par["output_layer"]: - data.layers[par["output_layer"]] = data_for_scanpy.X + data.layers[par["output_layer"]] = transformed_matrix else: - data.X = data_for_scanpy.X -data.uns["log1p"] = data_for_scanpy.uns["log1p"].copy() + data.X = transformed_matrix +data.uns["log1p"] = {"base": par["base"]} logger.info("Writing to file %s", par["output"]) write_h5ad_to_h5mu_with_compression( @@ -3879,7 +3886,7 @@ meta["defaults"] = [ "container" : { "registry" : "images.viash-hub.com", "image" : "vsh/openpipeline/transform/log1p", - "tag" : "v4.0.3" + "tag" : "v4.1.0" }, "label" : [ "midmem", diff --git a/target/dependencies/vsh/vsh/openpipeline/v4.0.3/nextflow/transform/log1p/nextflow.config b/target/dependencies/vsh/vsh/openpipeline/v4.1.0/nextflow/transform/log1p/nextflow.config similarity index 99% rename from target/dependencies/vsh/vsh/openpipeline/v4.0.3/nextflow/transform/log1p/nextflow.config rename to target/dependencies/vsh/vsh/openpipeline/v4.1.0/nextflow/transform/log1p/nextflow.config index eadfa35..4885321 100644 --- a/target/dependencies/vsh/vsh/openpipeline/v4.0.3/nextflow/transform/log1p/nextflow.config +++ b/target/dependencies/vsh/vsh/openpipeline/v4.1.0/nextflow/transform/log1p/nextflow.config @@ -2,7 +2,7 @@ manifest { name = 'transform/log1p' mainScript = 'main.nf' nextflowVersion = '!>=20.12.1-edge' - version = 'v4.0.3' + version = 'v4.1.0' description = 'Logarithmize the data matrix. Computes X = log(X + 1), where log denotes the natural logarithm unless a different base is given.\n' author = 'Dries De Maeyer, Robrecht Cannoodt' } diff --git a/target/dependencies/vsh/vsh/openpipeline/v4.0.3/nextflow/transform/scale/nextflow_labels.config b/target/dependencies/vsh/vsh/openpipeline/v4.1.0/nextflow/transform/log1p/nextflow_labels.config similarity index 100% rename from target/dependencies/vsh/vsh/openpipeline/v4.0.3/nextflow/transform/scale/nextflow_labels.config rename to target/dependencies/vsh/vsh/openpipeline/v4.1.0/nextflow/transform/log1p/nextflow_labels.config diff --git a/target/dependencies/vsh/vsh/openpipeline/v4.0.3/nextflow/transform/log1p/nextflow_schema.json b/target/dependencies/vsh/vsh/openpipeline/v4.1.0/nextflow/transform/log1p/nextflow_schema.json similarity index 97% rename from target/dependencies/vsh/vsh/openpipeline/v4.0.3/nextflow/transform/log1p/nextflow_schema.json rename to target/dependencies/vsh/vsh/openpipeline/v4.1.0/nextflow/transform/log1p/nextflow_schema.json index 86612bf..9694fff 100644 --- a/target/dependencies/vsh/vsh/openpipeline/v4.0.3/nextflow/transform/log1p/nextflow_schema.json +++ b/target/dependencies/vsh/vsh/openpipeline/v4.1.0/nextflow/transform/log1p/nextflow_schema.json @@ -46,7 +46,7 @@ }, "output_compression": { "type": "string", - "description": "Compression format to use for the output AnnData and/or Mudata objects.\nBy default no compression is applied.\n", + "description": "Compression format to use for the output AnnData and/or Mudata H5 files.\nBy default no compression is applied.\n", "help_text": "Type: `string`, multiple: `False`, example: `\"gzip\"`, choices: ``gzip`, `lzf``. ", "enum": [ "gzip", diff --git a/target/dependencies/vsh/vsh/openpipeline/v4.0.3/nextflow/transform/normalize_total/setup_logger.py b/target/dependencies/vsh/vsh/openpipeline/v4.1.0/nextflow/transform/log1p/setup_logger.py similarity index 100% rename from target/dependencies/vsh/vsh/openpipeline/v4.0.3/nextflow/transform/normalize_total/setup_logger.py rename to target/dependencies/vsh/vsh/openpipeline/v4.1.0/nextflow/transform/log1p/setup_logger.py diff --git a/target/dependencies/vsh/vsh/openpipeline/v4.0.3/nextflow/transform/normalize_total/.config.vsh.yaml b/target/dependencies/vsh/vsh/openpipeline/v4.1.0/nextflow/transform/normalize_total/.config.vsh.yaml similarity index 96% rename from target/dependencies/vsh/vsh/openpipeline/v4.0.3/nextflow/transform/normalize_total/.config.vsh.yaml rename to target/dependencies/vsh/vsh/openpipeline/v4.1.0/nextflow/transform/normalize_total/.config.vsh.yaml index 3563eb8..e869a9f 100644 --- a/target/dependencies/vsh/vsh/openpipeline/v4.0.3/nextflow/transform/normalize_total/.config.vsh.yaml +++ b/target/dependencies/vsh/vsh/openpipeline/v4.1.0/nextflow/transform/normalize_total/.config.vsh.yaml @@ -1,6 +1,6 @@ name: "normalize_total" namespace: "transform" -version: "v4.0.3" +version: "v4.1.0" authors: - name: "Dries De Maeyer" roles: @@ -109,8 +109,8 @@ argument_groups: direction: "input" - type: "string" name: "--output_compression" - description: "Compression format to use for the output AnnData and/or Mudata objects.\n\ - By default no compression is applied.\n" + description: "Compression format to use for the output AnnData and/or Mudata H5\ + \ files.\nBy default no compression is applied.\n" info: null example: - "gzip" @@ -229,7 +229,7 @@ engines: id: "docker" image: "python:3.12-slim" target_registry: "images.viash-hub.com" - target_tag: "v4.0.3" + target_tag: "v4.1.0" namespace_separator: "/" setup: - type: "apt" @@ -239,9 +239,10 @@ engines: - type: "python" user: false packages: - - "anndata~=0.12.7" + - "anndata~=0.12.16" - "awkward" - - "mudata~=0.3.2" + - "scipy~=1.17.1" + - "mudata~=0.3.8" - "scanpy~=1.11.4" script: - "exec(\"try:\\n import zarr; from importlib.metadata import version\\nexcept\ @@ -256,7 +257,7 @@ engines: - type: "python" user: false packages: - - "viashpy==0.8.0" + - "viashpy==0.10.0" github: - "openpipelines-bio/core#subdirectory=packages/python/openpipeline_testutils" upgrade: true @@ -270,12 +271,12 @@ build_info: engine: "docker|native" output: "target/nextflow/transform/normalize_total" executable: "target/nextflow/transform/normalize_total/main.nf" - viash_version: "0.9.4" - git_commit: "7bfad4ea12f87eca59213be3ab08deff67cc4206" + viash_version: "0.9.7" + git_commit: "a6499fddaa8553874585c747370f919f4d7b729c" git_remote: "https://github.com/openpipelines-bio/openpipeline" package_config: name: "openpipeline" - version: "v4.0.3" + version: "v4.1.0" summary: "Best-practice workflows for single-cell multi-omics analyses.\n" description: "OpenPipelines are extensible single cell analysis pipelines for reproducible\ \ and large-scale single cell processing using [Viash](https://viash.io) and [Nextflow](https://www.nextflow.io/).\n\ @@ -296,7 +297,7 @@ package_config: - path: "src/workflows/utils/labels_ci.config" description: "Adds the correct memory and CPU labels when running on the Viash\ \ Hub CI." - viash_version: "0.9.4" + viash_version: "0.9.7" source: "src" target: "target" config_mods: @@ -305,7 +306,7 @@ package_config: )'" - ".engines += { type: \"native\" }" - ".engines[.type == 'docker'].target_registry := 'images.viash-hub.com'" - - ".engines[.type == 'docker'].target_tag := 'v4.0.3'" + - ".engines[.type == 'docker'].target_tag := 'v4.1.0'" keywords: - "single-cell" - "multimodal" diff --git a/target/dependencies/vsh/vsh/openpipeline/v4.0.3/nextflow/transform/scale/compress_h5mu.py b/target/dependencies/vsh/vsh/openpipeline/v4.1.0/nextflow/transform/normalize_total/compress_h5mu.py similarity index 100% rename from target/dependencies/vsh/vsh/openpipeline/v4.0.3/nextflow/transform/scale/compress_h5mu.py rename to target/dependencies/vsh/vsh/openpipeline/v4.1.0/nextflow/transform/normalize_total/compress_h5mu.py diff --git a/target/dependencies/vsh/vsh/openpipeline/v4.0.3/nextflow/transform/normalize_total/main.nf b/target/dependencies/vsh/vsh/openpipeline/v4.1.0/nextflow/transform/normalize_total/main.nf similarity index 98% rename from target/dependencies/vsh/vsh/openpipeline/v4.0.3/nextflow/transform/normalize_total/main.nf rename to target/dependencies/vsh/vsh/openpipeline/v4.1.0/nextflow/transform/normalize_total/main.nf index 32c29e2..66cdf73 100644 --- a/target/dependencies/vsh/vsh/openpipeline/v4.0.3/nextflow/transform/normalize_total/main.nf +++ b/target/dependencies/vsh/vsh/openpipeline/v4.1.0/nextflow/transform/normalize_total/main.nf @@ -1,6 +1,6 @@ -// normalize_total v4.0.3 +// normalize_total v4.1.0 // -// This wrapper script is auto-generated by viash 0.9.4 and is thus a derivative +// This wrapper script is auto-generated by viash 0.9.7 and is thus a derivative // work thereof. This software comes with ABSOLUTELY NO WARRANTY from Data // Intuitive. // @@ -1354,47 +1354,42 @@ def readCsv(file_path) { def splitRegex = java.util.regex.Pattern.compile(''',(?=(?:[^"]*"[^"]*")*[^"]*$)''') def removeQuote = java.util.regex.Pattern.compile('''"(.*)"''') - def br = java.nio.file.Files.newBufferedReader(inputFile) + java.nio.file.Files.newBufferedReader(inputFile).withCloseable { br -> + def row = 0 + def header = null + def line - def row = -1 - def header = null - while (br.ready() && header == null) { - def line = br.readLine() - row++ - if (!line.startsWith("#")) { - header = splitRegex.split(line, -1).collect{field -> - m = removeQuote.matcher(field) - m.find() ? m.replaceFirst('$1') : field - } - } - } - assert header != null: "CSV file should contain a header" - - while (br.ready()) { - def line = br.readLine() - row++ - if (line == null) { - br.close() - break - } - - if (!line.startsWith("#")) { - def predata = splitRegex.split(line, -1) - def data = predata.collect{field -> - if (field == "") { - return null - } - def m = removeQuote.matcher(field) - if (m.find()) { - return m.replaceFirst('$1') - } else { - return field + while (header == null && (line = br.readLine()) != null) { + if (!line.startsWith("#")) { + header = splitRegex.split(line, -1).collect { field -> + def m = removeQuote.matcher(field) + m.find() ? m.replaceFirst('$1') : field } } - assert header.size() == data.size(): "Row $row should contain the same number as fields as the header" - - def dataMap = [header, data].transpose().collectEntries().findAll{it.value != null} - output.add(dataMap) + row++ + } + assert header != null : "CSV file should contain a header" + + while ((line = br.readLine()) != null) { + row++ + if (!line.startsWith("#")) { + def predata = splitRegex.split(line, -1) + def data = predata.collect { field -> + if (field == "") { + return null + } + def m = removeQuote.matcher(field) + if (m.find()) { + return m.replaceFirst('$1') + } else { + return field + } + } + assert header.size() == data.size() : "Row $row should contain the same number as fields as the header" + + def dataMap = [header, data].transpose().collectEntries().findAll { it.value != null } + output.add(dataMap) + } } } @@ -1710,10 +1705,25 @@ process publishFilesProc { ] .transpose() .collectMany{infile, outfile -> - if (infile.toString() != outfile.toString()) { + def infileString = infile.toString() + def outfileString = outfile.toString() + if (infileString != outfileString) { + /* Trailing slashes are removed from both the source and destination arguments. + From source arguments, this is useful when a source argument may have a trailing slash + and specify a symbolic link to a directory. Without removing the slash, cp will dereference + the symbolic link. + See https://www.gnu.org/software/coreutils/manual/html_node/Trailing-slashes.html#Trailing-slashes-1 + + For the destination path addding a trailing slash is a problem when publishing directories: + it requires the destination directory to exist. This fails because we only create the parent + directories first. + */ + def regexTrailingSlashes = ~/\/+$/ + def infileNoTrailingSlash = infileString - regexTrailingSlashes + def outfileNoTrailingSlash = outfileString - regexTrailingSlashes [ - "[ -d \"\$(dirname '${outfile.toString()}')\" ] || mkdir -p \"\$(dirname '${outfile.toString()}')\"", - "cp -r '${infile.toString()}' '${outfile.toString()}'" + "[ -d \"\$(dirname '${outfileNoTrailingSlash}')\" ] || mkdir -p \"\$(dirname '${outfileNoTrailingSlash}')\"", + "cp -a '${infileNoTrailingSlash}' '${outfileNoTrailingSlash}'" ] } else { // no need to copy if infile is the same as outfile @@ -3036,7 +3046,7 @@ meta = [ "config": processConfig(readJsonBlob('''{ "name" : "normalize_total", "namespace" : "transform", - "version" : "v4.0.3", + "version" : "v4.1.0", "authors" : [ { "name" : "Dries De Maeyer", @@ -3173,7 +3183,7 @@ meta = [ { "type" : "string", "name" : "--output_compression", - "description" : "Compression format to use for the output AnnData and/or Mudata objects.\nBy default no compression is applied.\n", + "description" : "Compression format to use for the output AnnData and/or Mudata H5 files.\nBy default no compression is applied.\n", "example" : [ "gzip" ], @@ -3319,7 +3329,7 @@ meta = [ "id" : "docker", "image" : "python:3.12-slim", "target_registry" : "images.viash-hub.com", - "target_tag" : "v4.0.3", + "target_tag" : "v4.1.0", "namespace_separator" : "/", "setup" : [ { @@ -3333,9 +3343,10 @@ meta = [ "type" : "python", "user" : false, "packages" : [ - "anndata~=0.12.7", + "anndata~=0.12.16", "awkward", - "mudata~=0.3.2", + "scipy~=1.17.1", + "mudata~=0.3.8", "scanpy~=1.11.4" ], "script" : [ @@ -3356,7 +3367,7 @@ meta = [ "type" : "python", "user" : false, "packages" : [ - "viashpy==0.8.0" + "viashpy==0.10.0" ], "github" : [ "openpipelines-bio/core#subdirectory=packages/python/openpipeline_testutils" @@ -3375,13 +3386,13 @@ meta = [ "runner" : "nextflow", "engine" : "docker|native", "output" : "/workdir/root/repo/target/nextflow/transform/normalize_total", - "viash_version" : "0.9.4", - "git_commit" : "7bfad4ea12f87eca59213be3ab08deff67cc4206", + "viash_version" : "0.9.7", + "git_commit" : "a6499fddaa8553874585c747370f919f4d7b729c", "git_remote" : "https://github.com/openpipelines-bio/openpipeline" }, "package_config" : { "name" : "openpipeline", - "version" : "v4.0.3", + "version" : "v4.1.0", "summary" : "Best-practice workflows for single-cell multi-omics analyses.\n", "description" : "OpenPipelines are extensible single cell analysis pipelines for reproducible and large-scale single cell processing using [Viash](https://viash.io) and [Nextflow](https://www.nextflow.io/).\n\nIn terms of workflows, the following has been made available, but keep in mind that\nindividual tools and functionality can be executed as standalone components as well.\n\n * Demultiplexing: conversion of raw sequencing data to FASTQ objects.\n * Ingestion: Read mapping and generating a count matrix.\n * Single sample processing: cell filtering and doublet detection.\n * Multisample processing: Count transformation, normalization, QC metric calulations.\n * Integration: Clustering, integration and batch correction using single and multimodal methods.\n * Downstream analysis workflows\n", "info" : { @@ -3399,14 +3410,14 @@ meta = [ } ] }, - "viash_version" : "0.9.4", + "viash_version" : "0.9.7", "source" : "/workdir/root/repo/src", "target" : "/workdir/root/repo/target", "config_mods" : [ ".resources += {path: '/src/workflows/utils/labels.config', dest: 'nextflow_labels.config'}\n.runners[.type == 'nextflow'].config.script := 'includeConfig(\\"nextflow_labels.config\\")'", ".engines += { type: \\"native\\" }", ".engines[.type == 'docker'].target_registry := 'images.viash-hub.com'", - ".engines[.type == 'docker'].target_tag := 'v4.0.3'" + ".engines[.type == 'docker'].target_tag := 'v4.1.0'" ], "keywords" : [ "single-cell", @@ -3896,7 +3907,7 @@ meta["defaults"] = [ "container" : { "registry" : "images.viash-hub.com", "image" : "vsh/openpipeline/transform/normalize_total", - "tag" : "v4.0.3" + "tag" : "v4.1.0" }, "label" : [ "midmem", diff --git a/target/dependencies/vsh/vsh/openpipeline/v4.0.3/nextflow/transform/normalize_total/nextflow.config b/target/dependencies/vsh/vsh/openpipeline/v4.1.0/nextflow/transform/normalize_total/nextflow.config similarity index 99% rename from target/dependencies/vsh/vsh/openpipeline/v4.0.3/nextflow/transform/normalize_total/nextflow.config rename to target/dependencies/vsh/vsh/openpipeline/v4.1.0/nextflow/transform/normalize_total/nextflow.config index 414222a..0f309b4 100644 --- a/target/dependencies/vsh/vsh/openpipeline/v4.0.3/nextflow/transform/normalize_total/nextflow.config +++ b/target/dependencies/vsh/vsh/openpipeline/v4.1.0/nextflow/transform/normalize_total/nextflow.config @@ -2,7 +2,7 @@ manifest { name = 'transform/normalize_total' mainScript = 'main.nf' nextflowVersion = '!>=20.12.1-edge' - version = 'v4.0.3' + version = 'v4.1.0' description = 'Normalize counts per cell.\n\nNormalize each cell by total counts over all genes, so that every cell has the same total count after normalization. If choosing target_sum=1e6, this is CPM normalization.\n\nIf exclude_highly_expressed=True, very highly expressed genes are excluded from the computation of the normalization factor (size factor) for each cell. This is meaningful as these can strongly influence the resulting normalized values for all other genes [Weinreb17].\n' author = 'Dries De Maeyer, Robrecht Cannoodt' } diff --git a/target/dependencies/vsh/vsh/openpipeline/v4.0.3/nextflow/workflows/gdo/gdo_singlesample/nextflow_labels.config b/target/dependencies/vsh/vsh/openpipeline/v4.1.0/nextflow/transform/normalize_total/nextflow_labels.config similarity index 100% rename from target/dependencies/vsh/vsh/openpipeline/v4.0.3/nextflow/workflows/gdo/gdo_singlesample/nextflow_labels.config rename to target/dependencies/vsh/vsh/openpipeline/v4.1.0/nextflow/transform/normalize_total/nextflow_labels.config diff --git a/target/dependencies/vsh/vsh/openpipeline/v4.0.3/nextflow/transform/normalize_total/nextflow_schema.json b/target/dependencies/vsh/vsh/openpipeline/v4.1.0/nextflow/transform/normalize_total/nextflow_schema.json similarity index 97% rename from target/dependencies/vsh/vsh/openpipeline/v4.0.3/nextflow/transform/normalize_total/nextflow_schema.json rename to target/dependencies/vsh/vsh/openpipeline/v4.1.0/nextflow/transform/normalize_total/nextflow_schema.json index 2592614..96b8545 100644 --- a/target/dependencies/vsh/vsh/openpipeline/v4.0.3/nextflow/transform/normalize_total/nextflow_schema.json +++ b/target/dependencies/vsh/vsh/openpipeline/v4.1.0/nextflow/transform/normalize_total/nextflow_schema.json @@ -52,7 +52,7 @@ }, "output_compression": { "type": "string", - "description": "Compression format to use for the output AnnData and/or Mudata objects.\nBy default no compression is applied.\n", + "description": "Compression format to use for the output AnnData and/or Mudata H5 files.\nBy default no compression is applied.\n", "help_text": "Type: `string`, multiple: `False`, example: `\"gzip\"`, choices: ``gzip`, `lzf``. ", "enum": [ "gzip", diff --git a/target/dependencies/vsh/vsh/openpipeline/v4.0.3/nextflow/transform/scale/setup_logger.py b/target/dependencies/vsh/vsh/openpipeline/v4.1.0/nextflow/transform/normalize_total/setup_logger.py similarity index 100% rename from target/dependencies/vsh/vsh/openpipeline/v4.0.3/nextflow/transform/scale/setup_logger.py rename to target/dependencies/vsh/vsh/openpipeline/v4.1.0/nextflow/transform/normalize_total/setup_logger.py diff --git a/target/dependencies/vsh/vsh/openpipeline/v4.0.3/nextflow/transform/scale/.config.vsh.yaml b/target/dependencies/vsh/vsh/openpipeline/v4.1.0/nextflow/transform/scale/.config.vsh.yaml similarity index 95% rename from target/dependencies/vsh/vsh/openpipeline/v4.0.3/nextflow/transform/scale/.config.vsh.yaml rename to target/dependencies/vsh/vsh/openpipeline/v4.1.0/nextflow/transform/scale/.config.vsh.yaml index 2cf0725..303492c 100644 --- a/target/dependencies/vsh/vsh/openpipeline/v4.0.3/nextflow/transform/scale/.config.vsh.yaml +++ b/target/dependencies/vsh/vsh/openpipeline/v4.1.0/nextflow/transform/scale/.config.vsh.yaml @@ -1,6 +1,6 @@ name: "scale" namespace: "transform" -version: "v4.0.3" +version: "v4.1.0" authors: - name: "Dries Schaumont" roles: @@ -90,8 +90,8 @@ argument_groups: multiple_sep: ";" - type: "string" name: "--output_compression" - description: "Compression format to use for the output AnnData and/or Mudata objects.\n\ - By default no compression is applied.\n" + description: "Compression format to use for the output AnnData and/or Mudata H5\ + \ files.\nBy default no compression is applied.\n" info: null example: - "gzip" @@ -204,7 +204,7 @@ engines: id: "docker" image: "python:3.12-slim" target_registry: "images.viash-hub.com" - target_tag: "v4.0.3" + target_tag: "v4.1.0" namespace_separator: "/" setup: - type: "apt" @@ -214,9 +214,10 @@ engines: - type: "python" user: false packages: - - "anndata~=0.12.7" + - "anndata~=0.12.16" - "awkward" - - "mudata~=0.3.2" + - "scipy~=1.17.1" + - "mudata~=0.3.8" - "scanpy~=1.11.4" script: - "exec(\"try:\\n import zarr; from importlib.metadata import version\\nexcept\ @@ -231,7 +232,7 @@ engines: - type: "python" user: false packages: - - "viashpy==0.8.0" + - "viashpy==0.10.0" github: - "openpipelines-bio/core#subdirectory=packages/python/openpipeline_testutils" upgrade: true @@ -245,12 +246,12 @@ build_info: engine: "docker|native" output: "target/nextflow/transform/scale" executable: "target/nextflow/transform/scale/main.nf" - viash_version: "0.9.4" - git_commit: "7bfad4ea12f87eca59213be3ab08deff67cc4206" + viash_version: "0.9.7" + git_commit: "a6499fddaa8553874585c747370f919f4d7b729c" git_remote: "https://github.com/openpipelines-bio/openpipeline" package_config: name: "openpipeline" - version: "v4.0.3" + version: "v4.1.0" summary: "Best-practice workflows for single-cell multi-omics analyses.\n" description: "OpenPipelines are extensible single cell analysis pipelines for reproducible\ \ and large-scale single cell processing using [Viash](https://viash.io) and [Nextflow](https://www.nextflow.io/).\n\ @@ -271,7 +272,7 @@ package_config: - path: "src/workflows/utils/labels_ci.config" description: "Adds the correct memory and CPU labels when running on the Viash\ \ Hub CI." - viash_version: "0.9.4" + viash_version: "0.9.7" source: "src" target: "target" config_mods: @@ -280,7 +281,7 @@ package_config: )'" - ".engines += { type: \"native\" }" - ".engines[.type == 'docker'].target_registry := 'images.viash-hub.com'" - - ".engines[.type == 'docker'].target_tag := 'v4.0.3'" + - ".engines[.type == 'docker'].target_tag := 'v4.1.0'" keywords: - "single-cell" - "multimodal" diff --git a/target/dependencies/vsh/vsh/openpipeline/v4.1.0/nextflow/transform/scale/compress_h5mu.py b/target/dependencies/vsh/vsh/openpipeline/v4.1.0/nextflow/transform/scale/compress_h5mu.py new file mode 100644 index 0000000..4b363ee --- /dev/null +++ b/target/dependencies/vsh/vsh/openpipeline/v4.1.0/nextflow/transform/scale/compress_h5mu.py @@ -0,0 +1,87 @@ +import shutil +from anndata import AnnData +from mudata import write_h5ad +from h5py import File as H5File +from h5py import Group, Dataset +from pathlib import Path +from typing import Union, Literal +from functools import partial + + +def compress_h5mu( + input_path: Union[str, Path], + output_path: Union[str, Path], + compression: Union[Literal["gzip"], Literal["lzf"]], +): + input_path, output_path = str(input_path), str(output_path) + + def copy_attributes(in_object, out_object): + for key, value in in_object.attrs.items(): + out_object.attrs[key] = value + + def visit_path( + output_h5: H5File, + compression: Union[Literal["gzip"], Literal["lzf"]], + name: str, + object: Union[Group, Dataset], + ): + if isinstance(object, Group): + new_group = output_h5.create_group(name) + copy_attributes(object, new_group) + elif isinstance(object, Dataset): + # Compression only works for non-scalar Dataset objects + # Scalar objects dont have a shape defined + if not object.compression and object.shape not in [None, ()]: + new_dataset = output_h5.create_dataset( + name, data=object, compression=compression + ) + copy_attributes(object, new_dataset) + else: + output_h5.copy(object, name) + else: + raise NotImplementedError( + f"Could not copy element {name}, " + f"type has not been implemented yet: {type(object)}" + ) + + with ( + H5File(input_path, "r") as input_h5, + H5File(output_path, "w", userblock_size=512) as output_h5, + ): + copy_attributes(input_h5, output_h5) + input_h5.visititems(partial(visit_path, output_h5, compression)) + + with open(input_path, "rb") as input_bytes: + # Mudata puts metadata like this in the first 512 bytes: + # MuData (format-version=0.1.0;creator=muon;creator-version=0.2.0) + # See mudata/_core/io.py, read_h5mu() function + starting_metadata = input_bytes.read(100) + # The metadata is padded with extra null bytes up until 512 bytes + truncate_location = starting_metadata.find(b"\x00") + starting_metadata = starting_metadata[:truncate_location] + with open(output_path, "br+") as f: + nbytes = f.write(starting_metadata) + f.write(b"\0" * (512 - nbytes)) + + +def write_h5ad_to_h5mu_with_compression( + output_file: Union[str, Path], + h5mu: Union[str, Path], + modality_name: str, + modality_data: AnnData, + output_compression=None, +): + output_file = Path(output_file) + h5mu = Path(h5mu) + output_file_uncompressed = ( + output_file.with_name(output_file.stem + "_uncompressed.h5mu") + if output_compression + else output_file + ) + shutil.copyfile(h5mu, output_file_uncompressed) + write_h5ad(filename=output_file_uncompressed, mod=modality_name, data=modality_data) + if output_compression: + compress_h5mu( + output_file_uncompressed, output_file, compression=output_compression + ) + output_file_uncompressed.unlink() diff --git a/target/dependencies/vsh/vsh/openpipeline/v4.0.3/nextflow/transform/scale/main.nf b/target/dependencies/vsh/vsh/openpipeline/v4.1.0/nextflow/transform/scale/main.nf similarity index 98% rename from target/dependencies/vsh/vsh/openpipeline/v4.0.3/nextflow/transform/scale/main.nf rename to target/dependencies/vsh/vsh/openpipeline/v4.1.0/nextflow/transform/scale/main.nf index 2c1685d..2568c7b 100644 --- a/target/dependencies/vsh/vsh/openpipeline/v4.0.3/nextflow/transform/scale/main.nf +++ b/target/dependencies/vsh/vsh/openpipeline/v4.1.0/nextflow/transform/scale/main.nf @@ -1,6 +1,6 @@ -// scale v4.0.3 +// scale v4.1.0 // -// This wrapper script is auto-generated by viash 0.9.4 and is thus a derivative +// This wrapper script is auto-generated by viash 0.9.7 and is thus a derivative // work thereof. This software comes with ABSOLUTELY NO WARRANTY from Data // Intuitive. // @@ -1353,47 +1353,42 @@ def readCsv(file_path) { def splitRegex = java.util.regex.Pattern.compile(''',(?=(?:[^"]*"[^"]*")*[^"]*$)''') def removeQuote = java.util.regex.Pattern.compile('''"(.*)"''') - def br = java.nio.file.Files.newBufferedReader(inputFile) + java.nio.file.Files.newBufferedReader(inputFile).withCloseable { br -> + def row = 0 + def header = null + def line - def row = -1 - def header = null - while (br.ready() && header == null) { - def line = br.readLine() - row++ - if (!line.startsWith("#")) { - header = splitRegex.split(line, -1).collect{field -> - m = removeQuote.matcher(field) - m.find() ? m.replaceFirst('$1') : field - } - } - } - assert header != null: "CSV file should contain a header" - - while (br.ready()) { - def line = br.readLine() - row++ - if (line == null) { - br.close() - break - } - - if (!line.startsWith("#")) { - def predata = splitRegex.split(line, -1) - def data = predata.collect{field -> - if (field == "") { - return null - } - def m = removeQuote.matcher(field) - if (m.find()) { - return m.replaceFirst('$1') - } else { - return field + while (header == null && (line = br.readLine()) != null) { + if (!line.startsWith("#")) { + header = splitRegex.split(line, -1).collect { field -> + def m = removeQuote.matcher(field) + m.find() ? m.replaceFirst('$1') : field } } - assert header.size() == data.size(): "Row $row should contain the same number as fields as the header" - - def dataMap = [header, data].transpose().collectEntries().findAll{it.value != null} - output.add(dataMap) + row++ + } + assert header != null : "CSV file should contain a header" + + while ((line = br.readLine()) != null) { + row++ + if (!line.startsWith("#")) { + def predata = splitRegex.split(line, -1) + def data = predata.collect { field -> + if (field == "") { + return null + } + def m = removeQuote.matcher(field) + if (m.find()) { + return m.replaceFirst('$1') + } else { + return field + } + } + assert header.size() == data.size() : "Row $row should contain the same number as fields as the header" + + def dataMap = [header, data].transpose().collectEntries().findAll { it.value != null } + output.add(dataMap) + } } } @@ -1709,10 +1704,25 @@ process publishFilesProc { ] .transpose() .collectMany{infile, outfile -> - if (infile.toString() != outfile.toString()) { + def infileString = infile.toString() + def outfileString = outfile.toString() + if (infileString != outfileString) { + /* Trailing slashes are removed from both the source and destination arguments. + From source arguments, this is useful when a source argument may have a trailing slash + and specify a symbolic link to a directory. Without removing the slash, cp will dereference + the symbolic link. + See https://www.gnu.org/software/coreutils/manual/html_node/Trailing-slashes.html#Trailing-slashes-1 + + For the destination path addding a trailing slash is a problem when publishing directories: + it requires the destination directory to exist. This fails because we only create the parent + directories first. + */ + def regexTrailingSlashes = ~/\/+$/ + def infileNoTrailingSlash = infileString - regexTrailingSlashes + def outfileNoTrailingSlash = outfileString - regexTrailingSlashes [ - "[ -d \"\$(dirname '${outfile.toString()}')\" ] || mkdir -p \"\$(dirname '${outfile.toString()}')\"", - "cp -r '${infile.toString()}' '${outfile.toString()}'" + "[ -d \"\$(dirname '${outfileNoTrailingSlash}')\" ] || mkdir -p \"\$(dirname '${outfileNoTrailingSlash}')\"", + "cp -a '${infileNoTrailingSlash}' '${outfileNoTrailingSlash}'" ] } else { // no need to copy if infile is the same as outfile @@ -3035,7 +3045,7 @@ meta = [ "config": processConfig(readJsonBlob('''{ "name" : "scale", "namespace" : "transform", - "version" : "v4.0.3", + "version" : "v4.1.0", "authors" : [ { "name" : "Dries Schaumont", @@ -3146,7 +3156,7 @@ meta = [ { "type" : "string", "name" : "--output_compression", - "description" : "Compression format to use for the output AnnData and/or Mudata objects.\nBy default no compression is applied.\n", + "description" : "Compression format to use for the output AnnData and/or Mudata H5 files.\nBy default no compression is applied.\n", "example" : [ "gzip" ], @@ -3291,7 +3301,7 @@ meta = [ "id" : "docker", "image" : "python:3.12-slim", "target_registry" : "images.viash-hub.com", - "target_tag" : "v4.0.3", + "target_tag" : "v4.1.0", "namespace_separator" : "/", "setup" : [ { @@ -3305,9 +3315,10 @@ meta = [ "type" : "python", "user" : false, "packages" : [ - "anndata~=0.12.7", + "anndata~=0.12.16", "awkward", - "mudata~=0.3.2", + "scipy~=1.17.1", + "mudata~=0.3.8", "scanpy~=1.11.4" ], "script" : [ @@ -3328,7 +3339,7 @@ meta = [ "type" : "python", "user" : false, "packages" : [ - "viashpy==0.8.0" + "viashpy==0.10.0" ], "github" : [ "openpipelines-bio/core#subdirectory=packages/python/openpipeline_testutils" @@ -3347,13 +3358,13 @@ meta = [ "runner" : "nextflow", "engine" : "docker|native", "output" : "/workdir/root/repo/target/nextflow/transform/scale", - "viash_version" : "0.9.4", - "git_commit" : "7bfad4ea12f87eca59213be3ab08deff67cc4206", + "viash_version" : "0.9.7", + "git_commit" : "a6499fddaa8553874585c747370f919f4d7b729c", "git_remote" : "https://github.com/openpipelines-bio/openpipeline" }, "package_config" : { "name" : "openpipeline", - "version" : "v4.0.3", + "version" : "v4.1.0", "summary" : "Best-practice workflows for single-cell multi-omics analyses.\n", "description" : "OpenPipelines are extensible single cell analysis pipelines for reproducible and large-scale single cell processing using [Viash](https://viash.io) and [Nextflow](https://www.nextflow.io/).\n\nIn terms of workflows, the following has been made available, but keep in mind that\nindividual tools and functionality can be executed as standalone components as well.\n\n * Demultiplexing: conversion of raw sequencing data to FASTQ objects.\n * Ingestion: Read mapping and generating a count matrix.\n * Single sample processing: cell filtering and doublet detection.\n * Multisample processing: Count transformation, normalization, QC metric calulations.\n * Integration: Clustering, integration and batch correction using single and multimodal methods.\n * Downstream analysis workflows\n", "info" : { @@ -3371,14 +3382,14 @@ meta = [ } ] }, - "viash_version" : "0.9.4", + "viash_version" : "0.9.7", "source" : "/workdir/root/repo/src", "target" : "/workdir/root/repo/target", "config_mods" : [ ".resources += {path: '/src/workflows/utils/labels.config', dest: 'nextflow_labels.config'}\n.runners[.type == 'nextflow'].config.script := 'includeConfig(\\"nextflow_labels.config\\")'", ".engines += { type: \\"native\\" }", ".engines[.type == 'docker'].target_registry := 'images.viash-hub.com'", - ".engines[.type == 'docker'].target_tag := 'v4.0.3'" + ".engines[.type == 'docker'].target_tag := 'v4.1.0'" ], "keywords" : [ "single-cell", @@ -3873,7 +3884,7 @@ meta["defaults"] = [ "container" : { "registry" : "images.viash-hub.com", "image" : "vsh/openpipeline/transform/scale", - "tag" : "v4.0.3" + "tag" : "v4.1.0" }, "label" : [ "lowmem", diff --git a/target/dependencies/vsh/vsh/openpipeline/v4.0.3/nextflow/transform/scale/nextflow.config b/target/dependencies/vsh/vsh/openpipeline/v4.1.0/nextflow/transform/scale/nextflow.config similarity index 99% rename from target/dependencies/vsh/vsh/openpipeline/v4.0.3/nextflow/transform/scale/nextflow.config rename to target/dependencies/vsh/vsh/openpipeline/v4.1.0/nextflow/transform/scale/nextflow.config index 26bd36c..094e365 100644 --- a/target/dependencies/vsh/vsh/openpipeline/v4.0.3/nextflow/transform/scale/nextflow.config +++ b/target/dependencies/vsh/vsh/openpipeline/v4.1.0/nextflow/transform/scale/nextflow.config @@ -2,7 +2,7 @@ manifest { name = 'transform/scale' mainScript = 'main.nf' nextflowVersion = '!>=20.12.1-edge' - version = 'v4.0.3' + version = 'v4.1.0' description = 'Scale data to unit variance and zero mean.\n' author = 'Dries Schaumont' } diff --git a/target/dependencies/vsh/vsh/openpipeline/v4.0.3/nextflow/workflows/multiomics/dimensionality_reduction/nextflow_labels.config b/target/dependencies/vsh/vsh/openpipeline/v4.1.0/nextflow/transform/scale/nextflow_labels.config similarity index 100% rename from target/dependencies/vsh/vsh/openpipeline/v4.0.3/nextflow/workflows/multiomics/dimensionality_reduction/nextflow_labels.config rename to target/dependencies/vsh/vsh/openpipeline/v4.1.0/nextflow/transform/scale/nextflow_labels.config diff --git a/target/dependencies/vsh/vsh/openpipeline/v4.0.3/nextflow/transform/scale/nextflow_schema.json b/target/dependencies/vsh/vsh/openpipeline/v4.1.0/nextflow/transform/scale/nextflow_schema.json similarity index 97% rename from target/dependencies/vsh/vsh/openpipeline/v4.0.3/nextflow/transform/scale/nextflow_schema.json rename to target/dependencies/vsh/vsh/openpipeline/v4.1.0/nextflow/transform/scale/nextflow_schema.json index 9d20750..ded361f 100644 --- a/target/dependencies/vsh/vsh/openpipeline/v4.0.3/nextflow/transform/scale/nextflow_schema.json +++ b/target/dependencies/vsh/vsh/openpipeline/v4.1.0/nextflow/transform/scale/nextflow_schema.json @@ -52,7 +52,7 @@ }, "output_compression": { "type": "string", - "description": "Compression format to use for the output AnnData and/or Mudata objects.\nBy default no compression is applied.\n", + "description": "Compression format to use for the output AnnData and/or Mudata H5 files.\nBy default no compression is applied.\n", "help_text": "Type: `string`, multiple: `False`, example: `\"gzip\"`, choices: ``gzip`, `lzf``. ", "enum": [ "gzip", diff --git a/target/dependencies/vsh/vsh/openpipeline/v4.1.0/nextflow/transform/scale/setup_logger.py b/target/dependencies/vsh/vsh/openpipeline/v4.1.0/nextflow/transform/scale/setup_logger.py new file mode 100644 index 0000000..3ca1cdb --- /dev/null +++ b/target/dependencies/vsh/vsh/openpipeline/v4.1.0/nextflow/transform/scale/setup_logger.py @@ -0,0 +1,12 @@ +def setup_logger(): + import logging + from sys import stdout + + logger = logging.getLogger() + logger.setLevel(logging.INFO) + console_handler = logging.StreamHandler(stdout) + logFormatter = logging.Formatter("%(asctime)s %(levelname)-8s %(message)s") + console_handler.setFormatter(logFormatter) + logger.addHandler(console_handler) + + return logger diff --git a/target/dependencies/vsh/vsh/openpipeline/v4.0.3/nextflow/workflows/gdo/gdo_singlesample/.config.vsh.yaml b/target/dependencies/vsh/vsh/openpipeline/v4.1.0/nextflow/workflows/gdo/gdo_singlesample/.config.vsh.yaml similarity index 97% rename from target/dependencies/vsh/vsh/openpipeline/v4.0.3/nextflow/workflows/gdo/gdo_singlesample/.config.vsh.yaml rename to target/dependencies/vsh/vsh/openpipeline/v4.1.0/nextflow/workflows/gdo/gdo_singlesample/.config.vsh.yaml index a26f556..ed15598 100644 --- a/target/dependencies/vsh/vsh/openpipeline/v4.0.3/nextflow/workflows/gdo/gdo_singlesample/.config.vsh.yaml +++ b/target/dependencies/vsh/vsh/openpipeline/v4.1.0/nextflow/workflows/gdo/gdo_singlesample/.config.vsh.yaml @@ -1,6 +1,6 @@ name: "gdo_singlesample" namespace: "workflows/gdo" -version: "v4.0.3" +version: "v4.1.0" authors: - name: "Dries Schaumont" roles: @@ -224,15 +224,15 @@ build_info: engine: "native" output: "target/nextflow/workflows/gdo/gdo_singlesample" executable: "target/nextflow/workflows/gdo/gdo_singlesample/main.nf" - viash_version: "0.9.4" - git_commit: "7bfad4ea12f87eca59213be3ab08deff67cc4206" + viash_version: "0.9.7" + git_commit: "a6499fddaa8553874585c747370f919f4d7b729c" git_remote: "https://github.com/openpipelines-bio/openpipeline" dependencies: - "target/nextflow/filter/filter_with_counts" - "target/nextflow/filter/do_filter" package_config: name: "openpipeline" - version: "v4.0.3" + version: "v4.1.0" summary: "Best-practice workflows for single-cell multi-omics analyses.\n" description: "OpenPipelines are extensible single cell analysis pipelines for reproducible\ \ and large-scale single cell processing using [Viash](https://viash.io) and [Nextflow](https://www.nextflow.io/).\n\ @@ -253,7 +253,7 @@ package_config: - path: "src/workflows/utils/labels_ci.config" description: "Adds the correct memory and CPU labels when running on the Viash\ \ Hub CI." - viash_version: "0.9.4" + viash_version: "0.9.7" source: "src" target: "target" config_mods: @@ -262,7 +262,7 @@ package_config: )'" - ".engines += { type: \"native\" }" - ".engines[.type == 'docker'].target_registry := 'images.viash-hub.com'" - - ".engines[.type == 'docker'].target_tag := 'v4.0.3'" + - ".engines[.type == 'docker'].target_tag := 'v4.1.0'" keywords: - "single-cell" - "multimodal" diff --git a/target/dependencies/vsh/vsh/openpipeline/v4.0.3/nextflow/workflows/gdo/gdo_singlesample/main.nf b/target/dependencies/vsh/vsh/openpipeline/v4.1.0/nextflow/workflows/gdo/gdo_singlesample/main.nf similarity index 97% rename from target/dependencies/vsh/vsh/openpipeline/v4.0.3/nextflow/workflows/gdo/gdo_singlesample/main.nf rename to target/dependencies/vsh/vsh/openpipeline/v4.1.0/nextflow/workflows/gdo/gdo_singlesample/main.nf index ebe11ad..fe14c5a 100644 --- a/target/dependencies/vsh/vsh/openpipeline/v4.0.3/nextflow/workflows/gdo/gdo_singlesample/main.nf +++ b/target/dependencies/vsh/vsh/openpipeline/v4.1.0/nextflow/workflows/gdo/gdo_singlesample/main.nf @@ -1,6 +1,6 @@ -// gdo_singlesample v4.0.3 +// gdo_singlesample v4.1.0 // -// This wrapper script is auto-generated by viash 0.9.4 and is thus a derivative +// This wrapper script is auto-generated by viash 0.9.7 and is thus a derivative // work thereof. This software comes with ABSOLUTELY NO WARRANTY from Data // Intuitive. // @@ -1353,47 +1353,42 @@ def readCsv(file_path) { def splitRegex = java.util.regex.Pattern.compile(''',(?=(?:[^"]*"[^"]*")*[^"]*$)''') def removeQuote = java.util.regex.Pattern.compile('''"(.*)"''') - def br = java.nio.file.Files.newBufferedReader(inputFile) + java.nio.file.Files.newBufferedReader(inputFile).withCloseable { br -> + def row = 0 + def header = null + def line - def row = -1 - def header = null - while (br.ready() && header == null) { - def line = br.readLine() - row++ - if (!line.startsWith("#")) { - header = splitRegex.split(line, -1).collect{field -> - m = removeQuote.matcher(field) - m.find() ? m.replaceFirst('$1') : field - } - } - } - assert header != null: "CSV file should contain a header" - - while (br.ready()) { - def line = br.readLine() - row++ - if (line == null) { - br.close() - break - } - - if (!line.startsWith("#")) { - def predata = splitRegex.split(line, -1) - def data = predata.collect{field -> - if (field == "") { - return null - } - def m = removeQuote.matcher(field) - if (m.find()) { - return m.replaceFirst('$1') - } else { - return field + while (header == null && (line = br.readLine()) != null) { + if (!line.startsWith("#")) { + header = splitRegex.split(line, -1).collect { field -> + def m = removeQuote.matcher(field) + m.find() ? m.replaceFirst('$1') : field } } - assert header.size() == data.size(): "Row $row should contain the same number as fields as the header" - - def dataMap = [header, data].transpose().collectEntries().findAll{it.value != null} - output.add(dataMap) + row++ + } + assert header != null : "CSV file should contain a header" + + while ((line = br.readLine()) != null) { + row++ + if (!line.startsWith("#")) { + def predata = splitRegex.split(line, -1) + def data = predata.collect { field -> + if (field == "") { + return null + } + def m = removeQuote.matcher(field) + if (m.find()) { + return m.replaceFirst('$1') + } else { + return field + } + } + assert header.size() == data.size() : "Row $row should contain the same number as fields as the header" + + def dataMap = [header, data].transpose().collectEntries().findAll { it.value != null } + output.add(dataMap) + } } } @@ -1709,10 +1704,25 @@ process publishFilesProc { ] .transpose() .collectMany{infile, outfile -> - if (infile.toString() != outfile.toString()) { + def infileString = infile.toString() + def outfileString = outfile.toString() + if (infileString != outfileString) { + /* Trailing slashes are removed from both the source and destination arguments. + From source arguments, this is useful when a source argument may have a trailing slash + and specify a symbolic link to a directory. Without removing the slash, cp will dereference + the symbolic link. + See https://www.gnu.org/software/coreutils/manual/html_node/Trailing-slashes.html#Trailing-slashes-1 + + For the destination path addding a trailing slash is a problem when publishing directories: + it requires the destination directory to exist. This fails because we only create the parent + directories first. + */ + def regexTrailingSlashes = ~/\/+$/ + def infileNoTrailingSlash = infileString - regexTrailingSlashes + def outfileNoTrailingSlash = outfileString - regexTrailingSlashes [ - "[ -d \"\$(dirname '${outfile.toString()}')\" ] || mkdir -p \"\$(dirname '${outfile.toString()}')\"", - "cp -r '${infile.toString()}' '${outfile.toString()}'" + "[ -d \"\$(dirname '${outfileNoTrailingSlash}')\" ] || mkdir -p \"\$(dirname '${outfileNoTrailingSlash}')\"", + "cp -a '${infileNoTrailingSlash}' '${outfileNoTrailingSlash}'" ] } else { // no need to copy if infile is the same as outfile @@ -3035,7 +3045,7 @@ meta = [ "config": processConfig(readJsonBlob('''{ "name" : "gdo_singlesample", "namespace" : "workflows/gdo", - "version" : "v4.0.3", + "version" : "v4.1.0", "authors" : [ { "name" : "Dries Schaumont", @@ -3326,13 +3336,13 @@ meta = [ "runner" : "nextflow", "engine" : "native", "output" : "/workdir/root/repo/target/nextflow/workflows/gdo/gdo_singlesample", - "viash_version" : "0.9.4", - "git_commit" : "7bfad4ea12f87eca59213be3ab08deff67cc4206", + "viash_version" : "0.9.7", + "git_commit" : "a6499fddaa8553874585c747370f919f4d7b729c", "git_remote" : "https://github.com/openpipelines-bio/openpipeline" }, "package_config" : { "name" : "openpipeline", - "version" : "v4.0.3", + "version" : "v4.1.0", "summary" : "Best-practice workflows for single-cell multi-omics analyses.\n", "description" : "OpenPipelines are extensible single cell analysis pipelines for reproducible and large-scale single cell processing using [Viash](https://viash.io) and [Nextflow](https://www.nextflow.io/).\n\nIn terms of workflows, the following has been made available, but keep in mind that\nindividual tools and functionality can be executed as standalone components as well.\n\n * Demultiplexing: conversion of raw sequencing data to FASTQ objects.\n * Ingestion: Read mapping and generating a count matrix.\n * Single sample processing: cell filtering and doublet detection.\n * Multisample processing: Count transformation, normalization, QC metric calulations.\n * Integration: Clustering, integration and batch correction using single and multimodal methods.\n * Downstream analysis workflows\n", "info" : { @@ -3350,14 +3360,14 @@ meta = [ } ] }, - "viash_version" : "0.9.4", + "viash_version" : "0.9.7", "source" : "/workdir/root/repo/src", "target" : "/workdir/root/repo/target", "config_mods" : [ ".resources += {path: '/src/workflows/utils/labels.config', dest: 'nextflow_labels.config'}\n.runners[.type == 'nextflow'].config.script := 'includeConfig(\\"nextflow_labels.config\\")'", ".engines += { type: \\"native\\" }", ".engines[.type == 'docker'].target_registry := 'images.viash-hub.com'", - ".engines[.type == 'docker'].target_tag := 'v4.0.3'" + ".engines[.type == 'docker'].target_tag := 'v4.1.0'" ], "keywords" : [ "single-cell", diff --git a/target/dependencies/vsh/vsh/openpipeline/v4.0.3/nextflow/workflows/gdo/gdo_singlesample/nextflow.config b/target/dependencies/vsh/vsh/openpipeline/v4.1.0/nextflow/workflows/gdo/gdo_singlesample/nextflow.config similarity index 99% rename from target/dependencies/vsh/vsh/openpipeline/v4.0.3/nextflow/workflows/gdo/gdo_singlesample/nextflow.config rename to target/dependencies/vsh/vsh/openpipeline/v4.1.0/nextflow/workflows/gdo/gdo_singlesample/nextflow.config index 0941b1e..2b66a3f 100644 --- a/target/dependencies/vsh/vsh/openpipeline/v4.0.3/nextflow/workflows/gdo/gdo_singlesample/nextflow.config +++ b/target/dependencies/vsh/vsh/openpipeline/v4.1.0/nextflow/workflows/gdo/gdo_singlesample/nextflow.config @@ -2,7 +2,7 @@ manifest { name = 'workflows/gdo/gdo_singlesample' mainScript = 'main.nf' nextflowVersion = '!>=20.12.1-edge' - version = 'v4.0.3' + version = 'v4.1.0' description = 'Processing unimodal single-sample guide-derived oligonucleotide (GDO) data.' author = 'Dries Schaumont' } diff --git a/target/dependencies/vsh/vsh/openpipeline/v4.0.3/nextflow/workflows/multiomics/neighbors_leiden_umap/nextflow_labels.config b/target/dependencies/vsh/vsh/openpipeline/v4.1.0/nextflow/workflows/gdo/gdo_singlesample/nextflow_labels.config similarity index 100% rename from target/dependencies/vsh/vsh/openpipeline/v4.0.3/nextflow/workflows/multiomics/neighbors_leiden_umap/nextflow_labels.config rename to target/dependencies/vsh/vsh/openpipeline/v4.1.0/nextflow/workflows/gdo/gdo_singlesample/nextflow_labels.config diff --git a/target/dependencies/vsh/vsh/openpipeline/v4.0.3/nextflow/workflows/gdo/gdo_singlesample/nextflow_schema.json b/target/dependencies/vsh/vsh/openpipeline/v4.1.0/nextflow/workflows/gdo/gdo_singlesample/nextflow_schema.json similarity index 100% rename from target/dependencies/vsh/vsh/openpipeline/v4.0.3/nextflow/workflows/gdo/gdo_singlesample/nextflow_schema.json rename to target/dependencies/vsh/vsh/openpipeline/v4.1.0/nextflow/workflows/gdo/gdo_singlesample/nextflow_schema.json diff --git a/target/dependencies/vsh/vsh/openpipeline/v4.0.3/nextflow/workflows/multiomics/dimensionality_reduction/utils/errorstrat_ignore.config b/target/dependencies/vsh/vsh/openpipeline/v4.1.0/nextflow/workflows/gdo/gdo_singlesample/utils/errorstrat_ignore.config similarity index 100% rename from target/dependencies/vsh/vsh/openpipeline/v4.0.3/nextflow/workflows/multiomics/dimensionality_reduction/utils/errorstrat_ignore.config rename to target/dependencies/vsh/vsh/openpipeline/v4.1.0/nextflow/workflows/gdo/gdo_singlesample/utils/errorstrat_ignore.config diff --git a/target/dependencies/vsh/vsh/openpipeline/v4.0.3/nextflow/workflows/multiomics/dimensionality_reduction/utils/integration_tests.config b/target/dependencies/vsh/vsh/openpipeline/v4.1.0/nextflow/workflows/gdo/gdo_singlesample/utils/integration_tests.config similarity index 100% rename from target/dependencies/vsh/vsh/openpipeline/v4.0.3/nextflow/workflows/multiomics/dimensionality_reduction/utils/integration_tests.config rename to target/dependencies/vsh/vsh/openpipeline/v4.1.0/nextflow/workflows/gdo/gdo_singlesample/utils/integration_tests.config diff --git a/target/dependencies/vsh/vsh/openpipeline/v4.0.3/nextflow/workflows/multiomics/dimensionality_reduction/utils/labels.config b/target/dependencies/vsh/vsh/openpipeline/v4.1.0/nextflow/workflows/gdo/gdo_singlesample/utils/labels.config similarity index 100% rename from target/dependencies/vsh/vsh/openpipeline/v4.0.3/nextflow/workflows/multiomics/dimensionality_reduction/utils/labels.config rename to target/dependencies/vsh/vsh/openpipeline/v4.1.0/nextflow/workflows/gdo/gdo_singlesample/utils/labels.config diff --git a/target/dependencies/vsh/vsh/openpipeline/v4.0.3/nextflow/workflows/multiomics/dimensionality_reduction/utils/labels_ci.config b/target/dependencies/vsh/vsh/openpipeline/v4.1.0/nextflow/workflows/gdo/gdo_singlesample/utils/labels_ci.config similarity index 100% rename from target/dependencies/vsh/vsh/openpipeline/v4.0.3/nextflow/workflows/multiomics/dimensionality_reduction/utils/labels_ci.config rename to target/dependencies/vsh/vsh/openpipeline/v4.1.0/nextflow/workflows/gdo/gdo_singlesample/utils/labels_ci.config diff --git a/target/dependencies/vsh/vsh/openpipeline/v4.0.3/nextflow/workflows/multiomics/dimensionality_reduction/.config.vsh.yaml b/target/dependencies/vsh/vsh/openpipeline/v4.1.0/nextflow/workflows/multiomics/dimensionality_reduction/.config.vsh.yaml similarity index 97% rename from target/dependencies/vsh/vsh/openpipeline/v4.0.3/nextflow/workflows/multiomics/dimensionality_reduction/.config.vsh.yaml rename to target/dependencies/vsh/vsh/openpipeline/v4.1.0/nextflow/workflows/multiomics/dimensionality_reduction/.config.vsh.yaml index 86b2c65..437c66e 100644 --- a/target/dependencies/vsh/vsh/openpipeline/v4.0.3/nextflow/workflows/multiomics/dimensionality_reduction/.config.vsh.yaml +++ b/target/dependencies/vsh/vsh/openpipeline/v4.1.0/nextflow/workflows/multiomics/dimensionality_reduction/.config.vsh.yaml @@ -1,6 +1,6 @@ name: "dimensionality_reduction" namespace: "workflows/multiomics" -version: "v4.0.3" +version: "v4.1.0" authors: - name: "Dries Schaumont" roles: @@ -277,15 +277,15 @@ build_info: engine: "native" output: "target/nextflow/workflows/multiomics/dimensionality_reduction" executable: "target/nextflow/workflows/multiomics/dimensionality_reduction/main.nf" - viash_version: "0.9.4" - git_commit: "7bfad4ea12f87eca59213be3ab08deff67cc4206" + viash_version: "0.9.7" + git_commit: "a6499fddaa8553874585c747370f919f4d7b729c" git_remote: "https://github.com/openpipelines-bio/openpipeline" dependencies: - "target/nextflow/dimred/pca" - "target/nextflow/workflows/multiomics/neighbors_leiden_umap" package_config: name: "openpipeline" - version: "v4.0.3" + version: "v4.1.0" summary: "Best-practice workflows for single-cell multi-omics analyses.\n" description: "OpenPipelines are extensible single cell analysis pipelines for reproducible\ \ and large-scale single cell processing using [Viash](https://viash.io) and [Nextflow](https://www.nextflow.io/).\n\ @@ -306,7 +306,7 @@ package_config: - path: "src/workflows/utils/labels_ci.config" description: "Adds the correct memory and CPU labels when running on the Viash\ \ Hub CI." - viash_version: "0.9.4" + viash_version: "0.9.7" source: "src" target: "target" config_mods: @@ -315,7 +315,7 @@ package_config: )'" - ".engines += { type: \"native\" }" - ".engines[.type == 'docker'].target_registry := 'images.viash-hub.com'" - - ".engines[.type == 'docker'].target_tag := 'v4.0.3'" + - ".engines[.type == 'docker'].target_tag := 'v4.1.0'" keywords: - "single-cell" - "multimodal" diff --git a/target/dependencies/vsh/vsh/openpipeline/v4.0.3/nextflow/workflows/multiomics/dimensionality_reduction/main.nf b/target/dependencies/vsh/vsh/openpipeline/v4.1.0/nextflow/workflows/multiomics/dimensionality_reduction/main.nf similarity index 97% rename from target/dependencies/vsh/vsh/openpipeline/v4.0.3/nextflow/workflows/multiomics/dimensionality_reduction/main.nf rename to target/dependencies/vsh/vsh/openpipeline/v4.1.0/nextflow/workflows/multiomics/dimensionality_reduction/main.nf index a9d10a1..74c30b2 100644 --- a/target/dependencies/vsh/vsh/openpipeline/v4.0.3/nextflow/workflows/multiomics/dimensionality_reduction/main.nf +++ b/target/dependencies/vsh/vsh/openpipeline/v4.1.0/nextflow/workflows/multiomics/dimensionality_reduction/main.nf @@ -1,6 +1,6 @@ -// dimensionality_reduction v4.0.3 +// dimensionality_reduction v4.1.0 // -// This wrapper script is auto-generated by viash 0.9.4 and is thus a derivative +// This wrapper script is auto-generated by viash 0.9.7 and is thus a derivative // work thereof. This software comes with ABSOLUTELY NO WARRANTY from Data // Intuitive. // @@ -1353,47 +1353,42 @@ def readCsv(file_path) { def splitRegex = java.util.regex.Pattern.compile(''',(?=(?:[^"]*"[^"]*")*[^"]*$)''') def removeQuote = java.util.regex.Pattern.compile('''"(.*)"''') - def br = java.nio.file.Files.newBufferedReader(inputFile) + java.nio.file.Files.newBufferedReader(inputFile).withCloseable { br -> + def row = 0 + def header = null + def line - def row = -1 - def header = null - while (br.ready() && header == null) { - def line = br.readLine() - row++ - if (!line.startsWith("#")) { - header = splitRegex.split(line, -1).collect{field -> - m = removeQuote.matcher(field) - m.find() ? m.replaceFirst('$1') : field - } - } - } - assert header != null: "CSV file should contain a header" - - while (br.ready()) { - def line = br.readLine() - row++ - if (line == null) { - br.close() - break - } - - if (!line.startsWith("#")) { - def predata = splitRegex.split(line, -1) - def data = predata.collect{field -> - if (field == "") { - return null - } - def m = removeQuote.matcher(field) - if (m.find()) { - return m.replaceFirst('$1') - } else { - return field + while (header == null && (line = br.readLine()) != null) { + if (!line.startsWith("#")) { + header = splitRegex.split(line, -1).collect { field -> + def m = removeQuote.matcher(field) + m.find() ? m.replaceFirst('$1') : field } } - assert header.size() == data.size(): "Row $row should contain the same number as fields as the header" - - def dataMap = [header, data].transpose().collectEntries().findAll{it.value != null} - output.add(dataMap) + row++ + } + assert header != null : "CSV file should contain a header" + + while ((line = br.readLine()) != null) { + row++ + if (!line.startsWith("#")) { + def predata = splitRegex.split(line, -1) + def data = predata.collect { field -> + if (field == "") { + return null + } + def m = removeQuote.matcher(field) + if (m.find()) { + return m.replaceFirst('$1') + } else { + return field + } + } + assert header.size() == data.size() : "Row $row should contain the same number as fields as the header" + + def dataMap = [header, data].transpose().collectEntries().findAll { it.value != null } + output.add(dataMap) + } } } @@ -1709,10 +1704,25 @@ process publishFilesProc { ] .transpose() .collectMany{infile, outfile -> - if (infile.toString() != outfile.toString()) { + def infileString = infile.toString() + def outfileString = outfile.toString() + if (infileString != outfileString) { + /* Trailing slashes are removed from both the source and destination arguments. + From source arguments, this is useful when a source argument may have a trailing slash + and specify a symbolic link to a directory. Without removing the slash, cp will dereference + the symbolic link. + See https://www.gnu.org/software/coreutils/manual/html_node/Trailing-slashes.html#Trailing-slashes-1 + + For the destination path addding a trailing slash is a problem when publishing directories: + it requires the destination directory to exist. This fails because we only create the parent + directories first. + */ + def regexTrailingSlashes = ~/\/+$/ + def infileNoTrailingSlash = infileString - regexTrailingSlashes + def outfileNoTrailingSlash = outfileString - regexTrailingSlashes [ - "[ -d \"\$(dirname '${outfile.toString()}')\" ] || mkdir -p \"\$(dirname '${outfile.toString()}')\"", - "cp -r '${infile.toString()}' '${outfile.toString()}'" + "[ -d \"\$(dirname '${outfileNoTrailingSlash}')\" ] || mkdir -p \"\$(dirname '${outfileNoTrailingSlash}')\"", + "cp -a '${infileNoTrailingSlash}' '${outfileNoTrailingSlash}'" ] } else { // no need to copy if infile is the same as outfile @@ -3035,7 +3045,7 @@ meta = [ "config": processConfig(readJsonBlob('''{ "name" : "dimensionality_reduction", "namespace" : "workflows/multiomics", - "version" : "v4.0.3", + "version" : "v4.1.0", "authors" : [ { "name" : "Dries Schaumont", @@ -3389,13 +3399,13 @@ meta = [ "runner" : "nextflow", "engine" : "native", "output" : "/workdir/root/repo/target/nextflow/workflows/multiomics/dimensionality_reduction", - "viash_version" : "0.9.4", - "git_commit" : "7bfad4ea12f87eca59213be3ab08deff67cc4206", + "viash_version" : "0.9.7", + "git_commit" : "a6499fddaa8553874585c747370f919f4d7b729c", "git_remote" : "https://github.com/openpipelines-bio/openpipeline" }, "package_config" : { "name" : "openpipeline", - "version" : "v4.0.3", + "version" : "v4.1.0", "summary" : "Best-practice workflows for single-cell multi-omics analyses.\n", "description" : "OpenPipelines are extensible single cell analysis pipelines for reproducible and large-scale single cell processing using [Viash](https://viash.io) and [Nextflow](https://www.nextflow.io/).\n\nIn terms of workflows, the following has been made available, but keep in mind that\nindividual tools and functionality can be executed as standalone components as well.\n\n * Demultiplexing: conversion of raw sequencing data to FASTQ objects.\n * Ingestion: Read mapping and generating a count matrix.\n * Single sample processing: cell filtering and doublet detection.\n * Multisample processing: Count transformation, normalization, QC metric calulations.\n * Integration: Clustering, integration and batch correction using single and multimodal methods.\n * Downstream analysis workflows\n", "info" : { @@ -3413,14 +3423,14 @@ meta = [ } ] }, - "viash_version" : "0.9.4", + "viash_version" : "0.9.7", "source" : "/workdir/root/repo/src", "target" : "/workdir/root/repo/target", "config_mods" : [ ".resources += {path: '/src/workflows/utils/labels.config', dest: 'nextflow_labels.config'}\n.runners[.type == 'nextflow'].config.script := 'includeConfig(\\"nextflow_labels.config\\")'", ".engines += { type: \\"native\\" }", ".engines[.type == 'docker'].target_registry := 'images.viash-hub.com'", - ".engines[.type == 'docker'].target_tag := 'v4.0.3'" + ".engines[.type == 'docker'].target_tag := 'v4.1.0'" ], "keywords" : [ "single-cell", diff --git a/target/dependencies/vsh/vsh/openpipeline/v4.0.3/nextflow/workflows/multiomics/dimensionality_reduction/nextflow.config b/target/dependencies/vsh/vsh/openpipeline/v4.1.0/nextflow/workflows/multiomics/dimensionality_reduction/nextflow.config similarity index 99% rename from target/dependencies/vsh/vsh/openpipeline/v4.0.3/nextflow/workflows/multiomics/dimensionality_reduction/nextflow.config rename to target/dependencies/vsh/vsh/openpipeline/v4.1.0/nextflow/workflows/multiomics/dimensionality_reduction/nextflow.config index 236a52e..90f409e 100644 --- a/target/dependencies/vsh/vsh/openpipeline/v4.0.3/nextflow/workflows/multiomics/dimensionality_reduction/nextflow.config +++ b/target/dependencies/vsh/vsh/openpipeline/v4.1.0/nextflow/workflows/multiomics/dimensionality_reduction/nextflow.config @@ -2,7 +2,7 @@ manifest { name = 'workflows/multiomics/dimensionality_reduction' mainScript = 'main.nf' nextflowVersion = '!>=20.12.1-edge' - version = 'v4.0.3' + version = 'v4.1.0' description = 'Run calculations that output information required for most integration methods: PCA, nearest neighbour and UMAP.' author = 'Dries Schaumont' } diff --git a/target/dependencies/vsh/vsh/openpipeline/v4.0.3/nextflow/workflows/multiomics/process_batches/nextflow_labels.config b/target/dependencies/vsh/vsh/openpipeline/v4.1.0/nextflow/workflows/multiomics/dimensionality_reduction/nextflow_labels.config similarity index 100% rename from target/dependencies/vsh/vsh/openpipeline/v4.0.3/nextflow/workflows/multiomics/process_batches/nextflow_labels.config rename to target/dependencies/vsh/vsh/openpipeline/v4.1.0/nextflow/workflows/multiomics/dimensionality_reduction/nextflow_labels.config diff --git a/target/dependencies/vsh/vsh/openpipeline/v4.0.3/nextflow/workflows/multiomics/dimensionality_reduction/nextflow_schema.json b/target/dependencies/vsh/vsh/openpipeline/v4.1.0/nextflow/workflows/multiomics/dimensionality_reduction/nextflow_schema.json similarity index 100% rename from target/dependencies/vsh/vsh/openpipeline/v4.0.3/nextflow/workflows/multiomics/dimensionality_reduction/nextflow_schema.json rename to target/dependencies/vsh/vsh/openpipeline/v4.1.0/nextflow/workflows/multiomics/dimensionality_reduction/nextflow_schema.json diff --git a/target/dependencies/vsh/vsh/openpipeline/v4.0.3/nextflow/workflows/multiomics/neighbors_leiden_umap/utils/errorstrat_ignore.config b/target/dependencies/vsh/vsh/openpipeline/v4.1.0/nextflow/workflows/multiomics/dimensionality_reduction/utils/errorstrat_ignore.config similarity index 100% rename from target/dependencies/vsh/vsh/openpipeline/v4.0.3/nextflow/workflows/multiomics/neighbors_leiden_umap/utils/errorstrat_ignore.config rename to target/dependencies/vsh/vsh/openpipeline/v4.1.0/nextflow/workflows/multiomics/dimensionality_reduction/utils/errorstrat_ignore.config diff --git a/target/dependencies/vsh/vsh/openpipeline/v4.0.3/nextflow/workflows/multiomics/neighbors_leiden_umap/utils/integration_tests.config b/target/dependencies/vsh/vsh/openpipeline/v4.1.0/nextflow/workflows/multiomics/dimensionality_reduction/utils/integration_tests.config similarity index 100% rename from target/dependencies/vsh/vsh/openpipeline/v4.0.3/nextflow/workflows/multiomics/neighbors_leiden_umap/utils/integration_tests.config rename to target/dependencies/vsh/vsh/openpipeline/v4.1.0/nextflow/workflows/multiomics/dimensionality_reduction/utils/integration_tests.config diff --git a/target/dependencies/vsh/vsh/openpipeline/v4.0.3/nextflow/workflows/multiomics/neighbors_leiden_umap/utils/labels.config b/target/dependencies/vsh/vsh/openpipeline/v4.1.0/nextflow/workflows/multiomics/dimensionality_reduction/utils/labels.config similarity index 100% rename from target/dependencies/vsh/vsh/openpipeline/v4.0.3/nextflow/workflows/multiomics/neighbors_leiden_umap/utils/labels.config rename to target/dependencies/vsh/vsh/openpipeline/v4.1.0/nextflow/workflows/multiomics/dimensionality_reduction/utils/labels.config diff --git a/target/dependencies/vsh/vsh/openpipeline/v4.0.3/nextflow/workflows/multiomics/neighbors_leiden_umap/utils/labels_ci.config b/target/dependencies/vsh/vsh/openpipeline/v4.1.0/nextflow/workflows/multiomics/dimensionality_reduction/utils/labels_ci.config similarity index 100% rename from target/dependencies/vsh/vsh/openpipeline/v4.0.3/nextflow/workflows/multiomics/neighbors_leiden_umap/utils/labels_ci.config rename to target/dependencies/vsh/vsh/openpipeline/v4.1.0/nextflow/workflows/multiomics/dimensionality_reduction/utils/labels_ci.config diff --git a/target/dependencies/vsh/vsh/openpipeline/v4.0.3/nextflow/workflows/multiomics/neighbors_leiden_umap/.config.vsh.yaml b/target/dependencies/vsh/vsh/openpipeline/v4.1.0/nextflow/workflows/multiomics/neighbors_leiden_umap/.config.vsh.yaml similarity index 97% rename from target/dependencies/vsh/vsh/openpipeline/v4.0.3/nextflow/workflows/multiomics/neighbors_leiden_umap/.config.vsh.yaml rename to target/dependencies/vsh/vsh/openpipeline/v4.1.0/nextflow/workflows/multiomics/neighbors_leiden_umap/.config.vsh.yaml index ce88e7d..44f39b4 100644 --- a/target/dependencies/vsh/vsh/openpipeline/v4.0.3/nextflow/workflows/multiomics/neighbors_leiden_umap/.config.vsh.yaml +++ b/target/dependencies/vsh/vsh/openpipeline/v4.1.0/nextflow/workflows/multiomics/neighbors_leiden_umap/.config.vsh.yaml @@ -1,6 +1,6 @@ name: "neighbors_leiden_umap" namespace: "workflows/multiomics" -version: "v4.0.3" +version: "v4.1.0" authors: - name: "Dries Schaumont" roles: @@ -233,8 +233,8 @@ build_info: engine: "native" output: "target/nextflow/workflows/multiomics/neighbors_leiden_umap" executable: "target/nextflow/workflows/multiomics/neighbors_leiden_umap/main.nf" - viash_version: "0.9.4" - git_commit: "7bfad4ea12f87eca59213be3ab08deff67cc4206" + viash_version: "0.9.7" + git_commit: "a6499fddaa8553874585c747370f919f4d7b729c" git_remote: "https://github.com/openpipelines-bio/openpipeline" dependencies: - "target/nextflow/cluster/leiden" @@ -243,7 +243,7 @@ build_info: - "target/nextflow/metadata/move_obsm_to_obs" package_config: name: "openpipeline" - version: "v4.0.3" + version: "v4.1.0" summary: "Best-practice workflows for single-cell multi-omics analyses.\n" description: "OpenPipelines are extensible single cell analysis pipelines for reproducible\ \ and large-scale single cell processing using [Viash](https://viash.io) and [Nextflow](https://www.nextflow.io/).\n\ @@ -264,7 +264,7 @@ package_config: - path: "src/workflows/utils/labels_ci.config" description: "Adds the correct memory and CPU labels when running on the Viash\ \ Hub CI." - viash_version: "0.9.4" + viash_version: "0.9.7" source: "src" target: "target" config_mods: @@ -273,7 +273,7 @@ package_config: )'" - ".engines += { type: \"native\" }" - ".engines[.type == 'docker'].target_registry := 'images.viash-hub.com'" - - ".engines[.type == 'docker'].target_tag := 'v4.0.3'" + - ".engines[.type == 'docker'].target_tag := 'v4.1.0'" keywords: - "single-cell" - "multimodal" diff --git a/target/dependencies/vsh/vsh/openpipeline/v4.0.3/nextflow/workflows/multiomics/neighbors_leiden_umap/main.nf b/target/dependencies/vsh/vsh/openpipeline/v4.1.0/nextflow/workflows/multiomics/neighbors_leiden_umap/main.nf similarity index 97% rename from target/dependencies/vsh/vsh/openpipeline/v4.0.3/nextflow/workflows/multiomics/neighbors_leiden_umap/main.nf rename to target/dependencies/vsh/vsh/openpipeline/v4.1.0/nextflow/workflows/multiomics/neighbors_leiden_umap/main.nf index d9d51b7..11cacab 100644 --- a/target/dependencies/vsh/vsh/openpipeline/v4.0.3/nextflow/workflows/multiomics/neighbors_leiden_umap/main.nf +++ b/target/dependencies/vsh/vsh/openpipeline/v4.1.0/nextflow/workflows/multiomics/neighbors_leiden_umap/main.nf @@ -1,6 +1,6 @@ -// neighbors_leiden_umap v4.0.3 +// neighbors_leiden_umap v4.1.0 // -// This wrapper script is auto-generated by viash 0.9.4 and is thus a derivative +// This wrapper script is auto-generated by viash 0.9.7 and is thus a derivative // work thereof. This software comes with ABSOLUTELY NO WARRANTY from Data // Intuitive. // @@ -1353,47 +1353,42 @@ def readCsv(file_path) { def splitRegex = java.util.regex.Pattern.compile(''',(?=(?:[^"]*"[^"]*")*[^"]*$)''') def removeQuote = java.util.regex.Pattern.compile('''"(.*)"''') - def br = java.nio.file.Files.newBufferedReader(inputFile) + java.nio.file.Files.newBufferedReader(inputFile).withCloseable { br -> + def row = 0 + def header = null + def line - def row = -1 - def header = null - while (br.ready() && header == null) { - def line = br.readLine() - row++ - if (!line.startsWith("#")) { - header = splitRegex.split(line, -1).collect{field -> - m = removeQuote.matcher(field) - m.find() ? m.replaceFirst('$1') : field - } - } - } - assert header != null: "CSV file should contain a header" - - while (br.ready()) { - def line = br.readLine() - row++ - if (line == null) { - br.close() - break - } - - if (!line.startsWith("#")) { - def predata = splitRegex.split(line, -1) - def data = predata.collect{field -> - if (field == "") { - return null - } - def m = removeQuote.matcher(field) - if (m.find()) { - return m.replaceFirst('$1') - } else { - return field + while (header == null && (line = br.readLine()) != null) { + if (!line.startsWith("#")) { + header = splitRegex.split(line, -1).collect { field -> + def m = removeQuote.matcher(field) + m.find() ? m.replaceFirst('$1') : field } } - assert header.size() == data.size(): "Row $row should contain the same number as fields as the header" - - def dataMap = [header, data].transpose().collectEntries().findAll{it.value != null} - output.add(dataMap) + row++ + } + assert header != null : "CSV file should contain a header" + + while ((line = br.readLine()) != null) { + row++ + if (!line.startsWith("#")) { + def predata = splitRegex.split(line, -1) + def data = predata.collect { field -> + if (field == "") { + return null + } + def m = removeQuote.matcher(field) + if (m.find()) { + return m.replaceFirst('$1') + } else { + return field + } + } + assert header.size() == data.size() : "Row $row should contain the same number as fields as the header" + + def dataMap = [header, data].transpose().collectEntries().findAll { it.value != null } + output.add(dataMap) + } } } @@ -1709,10 +1704,25 @@ process publishFilesProc { ] .transpose() .collectMany{infile, outfile -> - if (infile.toString() != outfile.toString()) { + def infileString = infile.toString() + def outfileString = outfile.toString() + if (infileString != outfileString) { + /* Trailing slashes are removed from both the source and destination arguments. + From source arguments, this is useful when a source argument may have a trailing slash + and specify a symbolic link to a directory. Without removing the slash, cp will dereference + the symbolic link. + See https://www.gnu.org/software/coreutils/manual/html_node/Trailing-slashes.html#Trailing-slashes-1 + + For the destination path addding a trailing slash is a problem when publishing directories: + it requires the destination directory to exist. This fails because we only create the parent + directories first. + */ + def regexTrailingSlashes = ~/\/+$/ + def infileNoTrailingSlash = infileString - regexTrailingSlashes + def outfileNoTrailingSlash = outfileString - regexTrailingSlashes [ - "[ -d \"\$(dirname '${outfile.toString()}')\" ] || mkdir -p \"\$(dirname '${outfile.toString()}')\"", - "cp -r '${infile.toString()}' '${outfile.toString()}'" + "[ -d \"\$(dirname '${outfileNoTrailingSlash}')\" ] || mkdir -p \"\$(dirname '${outfileNoTrailingSlash}')\"", + "cp -a '${infileNoTrailingSlash}' '${outfileNoTrailingSlash}'" ] } else { // no need to copy if infile is the same as outfile @@ -3035,7 +3045,7 @@ meta = [ "config": processConfig(readJsonBlob('''{ "name" : "neighbors_leiden_umap", "namespace" : "workflows/multiomics", - "version" : "v4.0.3", + "version" : "v4.1.0", "authors" : [ { "name" : "Dries Schaumont", @@ -3330,13 +3340,13 @@ meta = [ "runner" : "nextflow", "engine" : "native", "output" : "/workdir/root/repo/target/nextflow/workflows/multiomics/neighbors_leiden_umap", - "viash_version" : "0.9.4", - "git_commit" : "7bfad4ea12f87eca59213be3ab08deff67cc4206", + "viash_version" : "0.9.7", + "git_commit" : "a6499fddaa8553874585c747370f919f4d7b729c", "git_remote" : "https://github.com/openpipelines-bio/openpipeline" }, "package_config" : { "name" : "openpipeline", - "version" : "v4.0.3", + "version" : "v4.1.0", "summary" : "Best-practice workflows for single-cell multi-omics analyses.\n", "description" : "OpenPipelines are extensible single cell analysis pipelines for reproducible and large-scale single cell processing using [Viash](https://viash.io) and [Nextflow](https://www.nextflow.io/).\n\nIn terms of workflows, the following has been made available, but keep in mind that\nindividual tools and functionality can be executed as standalone components as well.\n\n * Demultiplexing: conversion of raw sequencing data to FASTQ objects.\n * Ingestion: Read mapping and generating a count matrix.\n * Single sample processing: cell filtering and doublet detection.\n * Multisample processing: Count transformation, normalization, QC metric calulations.\n * Integration: Clustering, integration and batch correction using single and multimodal methods.\n * Downstream analysis workflows\n", "info" : { @@ -3354,14 +3364,14 @@ meta = [ } ] }, - "viash_version" : "0.9.4", + "viash_version" : "0.9.7", "source" : "/workdir/root/repo/src", "target" : "/workdir/root/repo/target", "config_mods" : [ ".resources += {path: '/src/workflows/utils/labels.config', dest: 'nextflow_labels.config'}\n.runners[.type == 'nextflow'].config.script := 'includeConfig(\\"nextflow_labels.config\\")'", ".engines += { type: \\"native\\" }", ".engines[.type == 'docker'].target_registry := 'images.viash-hub.com'", - ".engines[.type == 'docker'].target_tag := 'v4.0.3'" + ".engines[.type == 'docker'].target_tag := 'v4.1.0'" ], "keywords" : [ "single-cell", diff --git a/target/dependencies/vsh/vsh/openpipeline/v4.0.3/nextflow/workflows/multiomics/neighbors_leiden_umap/nextflow.config b/target/dependencies/vsh/vsh/openpipeline/v4.1.0/nextflow/workflows/multiomics/neighbors_leiden_umap/nextflow.config similarity index 99% rename from target/dependencies/vsh/vsh/openpipeline/v4.0.3/nextflow/workflows/multiomics/neighbors_leiden_umap/nextflow.config rename to target/dependencies/vsh/vsh/openpipeline/v4.1.0/nextflow/workflows/multiomics/neighbors_leiden_umap/nextflow.config index 8ea3fc4..cc35151 100644 --- a/target/dependencies/vsh/vsh/openpipeline/v4.0.3/nextflow/workflows/multiomics/neighbors_leiden_umap/nextflow.config +++ b/target/dependencies/vsh/vsh/openpipeline/v4.1.0/nextflow/workflows/multiomics/neighbors_leiden_umap/nextflow.config @@ -2,7 +2,7 @@ manifest { name = 'workflows/multiomics/neighbors_leiden_umap' mainScript = 'main.nf' nextflowVersion = '!>=20.12.1-edge' - version = 'v4.0.3' + version = 'v4.1.0' description = 'Performs neighborhood search, leiden clustering and run umap on an integrated embedding.' author = 'Dries Schaumont' } diff --git a/target/dependencies/vsh/vsh/openpipeline/v4.0.3/nextflow/workflows/multiomics/process_samples/nextflow_labels.config b/target/dependencies/vsh/vsh/openpipeline/v4.1.0/nextflow/workflows/multiomics/neighbors_leiden_umap/nextflow_labels.config similarity index 100% rename from target/dependencies/vsh/vsh/openpipeline/v4.0.3/nextflow/workflows/multiomics/process_samples/nextflow_labels.config rename to target/dependencies/vsh/vsh/openpipeline/v4.1.0/nextflow/workflows/multiomics/neighbors_leiden_umap/nextflow_labels.config diff --git a/target/dependencies/vsh/vsh/openpipeline/v4.0.3/nextflow/workflows/multiomics/neighbors_leiden_umap/nextflow_schema.json b/target/dependencies/vsh/vsh/openpipeline/v4.1.0/nextflow/workflows/multiomics/neighbors_leiden_umap/nextflow_schema.json similarity index 100% rename from target/dependencies/vsh/vsh/openpipeline/v4.0.3/nextflow/workflows/multiomics/neighbors_leiden_umap/nextflow_schema.json rename to target/dependencies/vsh/vsh/openpipeline/v4.1.0/nextflow/workflows/multiomics/neighbors_leiden_umap/nextflow_schema.json diff --git a/target/dependencies/vsh/vsh/openpipeline/v4.0.3/nextflow/workflows/multiomics/process_batches/utils/errorstrat_ignore.config b/target/dependencies/vsh/vsh/openpipeline/v4.1.0/nextflow/workflows/multiomics/neighbors_leiden_umap/utils/errorstrat_ignore.config similarity index 100% rename from target/dependencies/vsh/vsh/openpipeline/v4.0.3/nextflow/workflows/multiomics/process_batches/utils/errorstrat_ignore.config rename to target/dependencies/vsh/vsh/openpipeline/v4.1.0/nextflow/workflows/multiomics/neighbors_leiden_umap/utils/errorstrat_ignore.config diff --git a/target/dependencies/vsh/vsh/openpipeline/v4.0.3/nextflow/workflows/multiomics/process_batches/utils/integration_tests.config b/target/dependencies/vsh/vsh/openpipeline/v4.1.0/nextflow/workflows/multiomics/neighbors_leiden_umap/utils/integration_tests.config similarity index 100% rename from target/dependencies/vsh/vsh/openpipeline/v4.0.3/nextflow/workflows/multiomics/process_batches/utils/integration_tests.config rename to target/dependencies/vsh/vsh/openpipeline/v4.1.0/nextflow/workflows/multiomics/neighbors_leiden_umap/utils/integration_tests.config diff --git a/target/dependencies/vsh/vsh/openpipeline/v4.0.3/nextflow/workflows/multiomics/process_batches/utils/labels.config b/target/dependencies/vsh/vsh/openpipeline/v4.1.0/nextflow/workflows/multiomics/neighbors_leiden_umap/utils/labels.config similarity index 100% rename from target/dependencies/vsh/vsh/openpipeline/v4.0.3/nextflow/workflows/multiomics/process_batches/utils/labels.config rename to target/dependencies/vsh/vsh/openpipeline/v4.1.0/nextflow/workflows/multiomics/neighbors_leiden_umap/utils/labels.config diff --git a/target/dependencies/vsh/vsh/openpipeline/v4.0.3/nextflow/workflows/multiomics/process_batches/utils/labels_ci.config b/target/dependencies/vsh/vsh/openpipeline/v4.1.0/nextflow/workflows/multiomics/neighbors_leiden_umap/utils/labels_ci.config similarity index 100% rename from target/dependencies/vsh/vsh/openpipeline/v4.0.3/nextflow/workflows/multiomics/process_batches/utils/labels_ci.config rename to target/dependencies/vsh/vsh/openpipeline/v4.1.0/nextflow/workflows/multiomics/neighbors_leiden_umap/utils/labels_ci.config diff --git a/target/dependencies/vsh/vsh/openpipeline/v4.0.3/nextflow/workflows/multiomics/process_batches/.config.vsh.yaml b/target/dependencies/vsh/vsh/openpipeline/v4.1.0/nextflow/workflows/multiomics/process_batches/.config.vsh.yaml similarity index 91% rename from target/dependencies/vsh/vsh/openpipeline/v4.0.3/nextflow/workflows/multiomics/process_batches/.config.vsh.yaml rename to target/dependencies/vsh/vsh/openpipeline/v4.1.0/nextflow/workflows/multiomics/process_batches/.config.vsh.yaml index 1ed92f9..531e6fc 100644 --- a/target/dependencies/vsh/vsh/openpipeline/v4.0.3/nextflow/workflows/multiomics/process_batches/.config.vsh.yaml +++ b/target/dependencies/vsh/vsh/openpipeline/v4.1.0/nextflow/workflows/multiomics/process_batches/.config.vsh.yaml @@ -1,6 +1,6 @@ name: "process_batches" namespace: "workflows/multiomics" -version: "v4.0.3" +version: "v4.1.0" authors: - name: "Dries Schaumont" roles: @@ -76,6 +76,15 @@ argument_groups: direction: "output" multiple: false multiple_sep: ";" +- name: "Cross-modality filtering" + arguments: + - type: "boolean_true" + name: "--intersect_obs" + description: "After per-modality multisample processing, remove observations that\ + \ are\nnot present in all processed modalities so that each modality shares\ + \ the\nsame set of cells.\n" + info: null + direction: "input" - name: "Highly variable features detection" arguments: - type: "string" @@ -105,6 +114,20 @@ argument_groups: direction: "input" multiple: false multiple_sep: ";" + - type: "string" + name: "--highly_variable_features_features_to_exclude" + description: "User-defined list of feature names to exclude from HVG calculation.\ + \ These features will be excluded from HVG selection but will remain in the\ + \ output data.\n" + info: null + example: + - "MT-CO1" + - "MT-CO2" + - "MT-ND1" + required: false + direction: "input" + multiple: true + multiple_sep: ";" - name: "QC metrics calculation options" arguments: - type: "string" @@ -262,6 +285,10 @@ test_resources: path: "test.nf" is_executable: true entrypoint: "test_wf2" +- type: "nextflow_script" + path: "test.nf" + is_executable: true + entrypoint: "test_wf3" - type: "file" path: "concat_test_data" - type: "file" @@ -272,6 +299,8 @@ info: namespace: "test_workflows/multiomics/process_batches" - name: "workflow_test2" namespace: "test_workflows/multiomics/process_batches" + - name: "workflow_test3" + namespace: "test_workflows/multiomics/process_batches" status: "enabled" scope: image: "public" @@ -280,6 +309,9 @@ dependencies: - name: "dataflow/merge" repository: type: "local" +- name: "filter/intersect_obs" + repository: + type: "local" - name: "workflows/multiomics/split_modalities" alias: "split_modalities_workflow" repository: @@ -379,11 +411,12 @@ build_info: engine: "native" output: "target/nextflow/workflows/multiomics/process_batches" executable: "target/nextflow/workflows/multiomics/process_batches/main.nf" - viash_version: "0.9.4" - git_commit: "7bfad4ea12f87eca59213be3ab08deff67cc4206" + viash_version: "0.9.7" + git_commit: "a6499fddaa8553874585c747370f919f4d7b729c" git_remote: "https://github.com/openpipelines-bio/openpipeline" dependencies: - "target/nextflow/dataflow/merge" + - "target/nextflow/filter/intersect_obs" - "target/_private/nextflow/workflows/multiomics/split_modalities" - "target/nextflow/workflows/prot/prot_multisample" - "target/nextflow/workflows/rna/rna_multisample" @@ -392,7 +425,7 @@ build_info: - "target/nextflow/workflows/multiomics/dimensionality_reduction" package_config: name: "openpipeline" - version: "v4.0.3" + version: "v4.1.0" summary: "Best-practice workflows for single-cell multi-omics analyses.\n" description: "OpenPipelines are extensible single cell analysis pipelines for reproducible\ \ and large-scale single cell processing using [Viash](https://viash.io) and [Nextflow](https://www.nextflow.io/).\n\ @@ -413,7 +446,7 @@ package_config: - path: "src/workflows/utils/labels_ci.config" description: "Adds the correct memory and CPU labels when running on the Viash\ \ Hub CI." - viash_version: "0.9.4" + viash_version: "0.9.7" source: "src" target: "target" config_mods: @@ -422,7 +455,7 @@ package_config: )'" - ".engines += { type: \"native\" }" - ".engines[.type == 'docker'].target_registry := 'images.viash-hub.com'" - - ".engines[.type == 'docker'].target_tag := 'v4.0.3'" + - ".engines[.type == 'docker'].target_tag := 'v4.1.0'" keywords: - "single-cell" - "multimodal" diff --git a/target/dependencies/vsh/vsh/openpipeline/v4.0.3/nextflow/workflows/multiomics/process_batches/main.nf b/target/dependencies/vsh/vsh/openpipeline/v4.1.0/nextflow/workflows/multiomics/process_batches/main.nf similarity index 97% rename from target/dependencies/vsh/vsh/openpipeline/v4.0.3/nextflow/workflows/multiomics/process_batches/main.nf rename to target/dependencies/vsh/vsh/openpipeline/v4.1.0/nextflow/workflows/multiomics/process_batches/main.nf index c1fc3cf..75375fe 100644 --- a/target/dependencies/vsh/vsh/openpipeline/v4.0.3/nextflow/workflows/multiomics/process_batches/main.nf +++ b/target/dependencies/vsh/vsh/openpipeline/v4.1.0/nextflow/workflows/multiomics/process_batches/main.nf @@ -1,6 +1,6 @@ -// process_batches v4.0.3 +// process_batches v4.1.0 // -// This wrapper script is auto-generated by viash 0.9.4 and is thus a derivative +// This wrapper script is auto-generated by viash 0.9.7 and is thus a derivative // work thereof. This software comes with ABSOLUTELY NO WARRANTY from Data // Intuitive. // @@ -1353,47 +1353,42 @@ def readCsv(file_path) { def splitRegex = java.util.regex.Pattern.compile(''',(?=(?:[^"]*"[^"]*")*[^"]*$)''') def removeQuote = java.util.regex.Pattern.compile('''"(.*)"''') - def br = java.nio.file.Files.newBufferedReader(inputFile) + java.nio.file.Files.newBufferedReader(inputFile).withCloseable { br -> + def row = 0 + def header = null + def line - def row = -1 - def header = null - while (br.ready() && header == null) { - def line = br.readLine() - row++ - if (!line.startsWith("#")) { - header = splitRegex.split(line, -1).collect{field -> - m = removeQuote.matcher(field) - m.find() ? m.replaceFirst('$1') : field - } - } - } - assert header != null: "CSV file should contain a header" - - while (br.ready()) { - def line = br.readLine() - row++ - if (line == null) { - br.close() - break - } - - if (!line.startsWith("#")) { - def predata = splitRegex.split(line, -1) - def data = predata.collect{field -> - if (field == "") { - return null - } - def m = removeQuote.matcher(field) - if (m.find()) { - return m.replaceFirst('$1') - } else { - return field + while (header == null && (line = br.readLine()) != null) { + if (!line.startsWith("#")) { + header = splitRegex.split(line, -1).collect { field -> + def m = removeQuote.matcher(field) + m.find() ? m.replaceFirst('$1') : field } } - assert header.size() == data.size(): "Row $row should contain the same number as fields as the header" - - def dataMap = [header, data].transpose().collectEntries().findAll{it.value != null} - output.add(dataMap) + row++ + } + assert header != null : "CSV file should contain a header" + + while ((line = br.readLine()) != null) { + row++ + if (!line.startsWith("#")) { + def predata = splitRegex.split(line, -1) + def data = predata.collect { field -> + if (field == "") { + return null + } + def m = removeQuote.matcher(field) + if (m.find()) { + return m.replaceFirst('$1') + } else { + return field + } + } + assert header.size() == data.size() : "Row $row should contain the same number as fields as the header" + + def dataMap = [header, data].transpose().collectEntries().findAll { it.value != null } + output.add(dataMap) + } } } @@ -1709,10 +1704,25 @@ process publishFilesProc { ] .transpose() .collectMany{infile, outfile -> - if (infile.toString() != outfile.toString()) { + def infileString = infile.toString() + def outfileString = outfile.toString() + if (infileString != outfileString) { + /* Trailing slashes are removed from both the source and destination arguments. + From source arguments, this is useful when a source argument may have a trailing slash + and specify a symbolic link to a directory. Without removing the slash, cp will dereference + the symbolic link. + See https://www.gnu.org/software/coreutils/manual/html_node/Trailing-slashes.html#Trailing-slashes-1 + + For the destination path addding a trailing slash is a problem when publishing directories: + it requires the destination directory to exist. This fails because we only create the parent + directories first. + */ + def regexTrailingSlashes = ~/\/+$/ + def infileNoTrailingSlash = infileString - regexTrailingSlashes + def outfileNoTrailingSlash = outfileString - regexTrailingSlashes [ - "[ -d \"\$(dirname '${outfile.toString()}')\" ] || mkdir -p \"\$(dirname '${outfile.toString()}')\"", - "cp -r '${infile.toString()}' '${outfile.toString()}'" + "[ -d \"\$(dirname '${outfileNoTrailingSlash}')\" ] || mkdir -p \"\$(dirname '${outfileNoTrailingSlash}')\"", + "cp -a '${infileNoTrailingSlash}' '${outfileNoTrailingSlash}'" ] } else { // no need to copy if infile is the same as outfile @@ -3035,7 +3045,7 @@ meta = [ "config": processConfig(readJsonBlob('''{ "name" : "process_batches", "namespace" : "workflows/multiomics", - "version" : "v4.0.3", + "version" : "v4.1.0", "authors" : [ { "name" : "Dries Schaumont", @@ -3133,6 +3143,17 @@ meta = [ } ] }, + { + "name" : "Cross-modality filtering", + "arguments" : [ + { + "type" : "boolean_true", + "name" : "--intersect_obs", + "description" : "After per-modality multisample processing, remove observations that are\nnot present in all processed modalities so that each modality shares the\nsame set of cells.\n", + "direction" : "input" + } + ] + }, { "name" : "Highly variable features detection", "arguments" : [ @@ -3165,6 +3186,20 @@ meta = [ "direction" : "input", "multiple" : false, "multiple_sep" : ";" + }, + { + "type" : "string", + "name" : "--highly_variable_features_features_to_exclude", + "description" : "User-defined list of feature names to exclude from HVG calculation. These features will be excluded from HVG selection but will remain in the output data.\n", + "example" : [ + "MT-CO1", + "MT-CO2", + "MT-ND1" + ], + "required" : false, + "direction" : "input", + "multiple" : true, + "multiple_sep" : ";" } ] }, @@ -3350,6 +3385,12 @@ meta = [ "is_executable" : true, "entrypoint" : "test_wf2" }, + { + "type" : "nextflow_script", + "path" : "test.nf", + "is_executable" : true, + "entrypoint" : "test_wf3" + }, { "type" : "file", "path" : "/resources_test/concat_test_data" @@ -3368,6 +3409,10 @@ meta = [ { "name" : "workflow_test2", "namespace" : "test_workflows/multiomics/process_batches" + }, + { + "name" : "workflow_test3", + "namespace" : "test_workflows/multiomics/process_batches" } ] }, @@ -3383,6 +3428,12 @@ meta = [ "type" : "local" } }, + { + "name" : "filter/intersect_obs", + "repository" : { + "type" : "local" + } + }, { "name" : "workflows/multiomics/split_modalities", "alias" : "split_modalities_workflow", @@ -3512,13 +3563,13 @@ meta = [ "runner" : "nextflow", "engine" : "native", "output" : "/workdir/root/repo/target/nextflow/workflows/multiomics/process_batches", - "viash_version" : "0.9.4", - "git_commit" : "7bfad4ea12f87eca59213be3ab08deff67cc4206", + "viash_version" : "0.9.7", + "git_commit" : "a6499fddaa8553874585c747370f919f4d7b729c", "git_remote" : "https://github.com/openpipelines-bio/openpipeline" }, "package_config" : { "name" : "openpipeline", - "version" : "v4.0.3", + "version" : "v4.1.0", "summary" : "Best-practice workflows for single-cell multi-omics analyses.\n", "description" : "OpenPipelines are extensible single cell analysis pipelines for reproducible and large-scale single cell processing using [Viash](https://viash.io) and [Nextflow](https://www.nextflow.io/).\n\nIn terms of workflows, the following has been made available, but keep in mind that\nindividual tools and functionality can be executed as standalone components as well.\n\n * Demultiplexing: conversion of raw sequencing data to FASTQ objects.\n * Ingestion: Read mapping and generating a count matrix.\n * Single sample processing: cell filtering and doublet detection.\n * Multisample processing: Count transformation, normalization, QC metric calulations.\n * Integration: Clustering, integration and batch correction using single and multimodal methods.\n * Downstream analysis workflows\n", "info" : { @@ -3536,14 +3587,14 @@ meta = [ } ] }, - "viash_version" : "0.9.4", + "viash_version" : "0.9.7", "source" : "/workdir/root/repo/src", "target" : "/workdir/root/repo/target", "config_mods" : [ ".resources += {path: '/src/workflows/utils/labels.config', dest: 'nextflow_labels.config'}\n.runners[.type == 'nextflow'].config.script := 'includeConfig(\\"nextflow_labels.config\\")'", ".engines += { type: \\"native\\" }", ".engines[.type == 'docker'].target_registry := 'images.viash-hub.com'", - ".engines[.type == 'docker'].target_tag := 'v4.0.3'" + ".engines[.type == 'docker'].target_tag := 'v4.1.0'" ], "keywords" : [ "single-cell", @@ -3565,6 +3616,7 @@ meta = [ // resolve dependencies dependencies (if any) meta["root_dir"] = getRootDir() include { merge } from "${meta.resources_dir}/../../../../nextflow/dataflow/merge/main.nf" +include { intersect_obs } from "${meta.resources_dir}/../../../../nextflow/filter/intersect_obs/main.nf" include { split_modalities as split_modalities_workflow_viashalias } from "${meta.resources_dir}/../../../../_private/nextflow/workflows/multiomics/split_modalities/main.nf" split_modalities_workflow = split_modalities_workflow_viashalias.run(key: "split_modalities_workflow") include { prot_multisample } from "${meta.resources_dir}/../../../../nextflow/workflows/prot/prot_multisample/main.nf" @@ -3656,6 +3708,7 @@ workflow run_wf { "rna": [ "highly_variable_features_var_output": "highly_variable_features_var_output", "highly_variable_features_obs_batch_key": "highly_variable_features_obs_batch_key", + "highly_variable_features_features_to_exclude": "highly_variable_features_features_to_exclude", "var_qc_metrics": "var_qc_metrics", "top_n_vars": "top_n_vars", "layer": "rna_layer", @@ -3741,6 +3794,14 @@ workflow run_wf { toState: ["input": "output"], ) | view {"After merging processing: $it"} + | intersect_obs.run( + runIf: {id, state -> state.intersect_obs}, + fromState: [ + "input": "input", + "modalities": "modalities" + ], + toState: ["input": "output"] + ) // Processing of multi-modal multisample MuData files. // Performs calculations on samples that have *not* been integrated, diff --git a/target/dependencies/vsh/vsh/openpipeline/v4.0.3/nextflow/workflows/multiomics/process_batches/nextflow.config b/target/dependencies/vsh/vsh/openpipeline/v4.1.0/nextflow/workflows/multiomics/process_batches/nextflow.config similarity index 99% rename from target/dependencies/vsh/vsh/openpipeline/v4.0.3/nextflow/workflows/multiomics/process_batches/nextflow.config rename to target/dependencies/vsh/vsh/openpipeline/v4.1.0/nextflow/workflows/multiomics/process_batches/nextflow.config index fdc1f13..28b58d6 100644 --- a/target/dependencies/vsh/vsh/openpipeline/v4.0.3/nextflow/workflows/multiomics/process_batches/nextflow.config +++ b/target/dependencies/vsh/vsh/openpipeline/v4.1.0/nextflow/workflows/multiomics/process_batches/nextflow.config @@ -2,7 +2,7 @@ manifest { name = 'workflows/multiomics/process_batches' mainScript = 'main.nf' nextflowVersion = '!>=20.12.1-edge' - version = 'v4.0.3' + version = 'v4.1.0' description = 'This workflow serves as an entrypoint into the \'full_pipeline\' in order to\nre-run the multisample processing and the integration setup. An input .h5mu file will \nfirst be split in order to run the multisample processing per modality. Next, the modalities\nare merged again and the integration setup pipeline is executed. Please note that this workflow\nassumes that samples from multiple pipelines are already concatenated. \n' author = 'Dries Schaumont' } diff --git a/target/dependencies/vsh/vsh/openpipeline/v4.0.3/nextflow/workflows/prot/prot_multisample/nextflow_labels.config b/target/dependencies/vsh/vsh/openpipeline/v4.1.0/nextflow/workflows/multiomics/process_batches/nextflow_labels.config similarity index 100% rename from target/dependencies/vsh/vsh/openpipeline/v4.0.3/nextflow/workflows/prot/prot_multisample/nextflow_labels.config rename to target/dependencies/vsh/vsh/openpipeline/v4.1.0/nextflow/workflows/multiomics/process_batches/nextflow_labels.config diff --git a/target/dependencies/vsh/vsh/openpipeline/v4.0.3/nextflow/workflows/multiomics/process_batches/nextflow_schema.json b/target/dependencies/vsh/vsh/openpipeline/v4.1.0/nextflow/workflows/multiomics/process_batches/nextflow_schema.json similarity index 90% rename from target/dependencies/vsh/vsh/openpipeline/v4.0.3/nextflow/workflows/multiomics/process_batches/nextflow_schema.json rename to target/dependencies/vsh/vsh/openpipeline/v4.1.0/nextflow/workflows/multiomics/process_batches/nextflow_schema.json index c831375..50bb98a 100644 --- a/target/dependencies/vsh/vsh/openpipeline/v4.0.3/nextflow/workflows/multiomics/process_batches/nextflow_schema.json +++ b/target/dependencies/vsh/vsh/openpipeline/v4.1.0/nextflow/workflows/multiomics/process_batches/nextflow_schema.json @@ -50,6 +50,19 @@ } } }, + "cross-modality filtering": { + "title": "Cross-modality filtering", + "type": "object", + "description": "No description", + "properties": { + "intersect_obs": { + "type": "boolean", + "description": "After per-modality multisample processing, remove observations that are\nnot present in all processed modalities so that each modality shares the\nsame set of cells.\n", + "help_text": "Type: `boolean_true`, multiple: `False`, default: `false`. ", + "default": false + } + } + }, "highly variable features detection": { "title": "Highly variable features detection", "type": "object", @@ -66,6 +79,14 @@ "description": "If specified, highly-variable genes are selected within each batch separately and merged", "help_text": "Type: `string`, multiple: `False`, default: `\"sample_id\"`. ", "default": "sample_id" + }, + "highly_variable_features_features_to_exclude": { + "type": "array", + "items": { + "type": "string" + }, + "description": "User-defined list of feature names to exclude from HVG calculation", + "help_text": "Type: `string`, multiple: `True`, example: `[\"MT-CO1\";\"MT-CO2\";\"MT-ND1\"]`. " } } }, @@ -201,6 +222,9 @@ { "$ref": "#/$defs/outputs" }, + { + "$ref": "#/$defs/cross-modality filtering" + }, { "$ref": "#/$defs/highly variable features detection" }, diff --git a/target/dependencies/vsh/vsh/openpipeline/v4.0.3/nextflow/workflows/multiomics/process_samples/utils/errorstrat_ignore.config b/target/dependencies/vsh/vsh/openpipeline/v4.1.0/nextflow/workflows/multiomics/process_batches/utils/errorstrat_ignore.config similarity index 100% rename from target/dependencies/vsh/vsh/openpipeline/v4.0.3/nextflow/workflows/multiomics/process_samples/utils/errorstrat_ignore.config rename to target/dependencies/vsh/vsh/openpipeline/v4.1.0/nextflow/workflows/multiomics/process_batches/utils/errorstrat_ignore.config diff --git a/target/dependencies/vsh/vsh/openpipeline/v4.0.3/nextflow/workflows/multiomics/process_samples/utils/integration_tests.config b/target/dependencies/vsh/vsh/openpipeline/v4.1.0/nextflow/workflows/multiomics/process_batches/utils/integration_tests.config similarity index 100% rename from target/dependencies/vsh/vsh/openpipeline/v4.0.3/nextflow/workflows/multiomics/process_samples/utils/integration_tests.config rename to target/dependencies/vsh/vsh/openpipeline/v4.1.0/nextflow/workflows/multiomics/process_batches/utils/integration_tests.config diff --git a/target/dependencies/vsh/vsh/openpipeline/v4.0.3/nextflow/workflows/multiomics/process_samples/utils/labels.config b/target/dependencies/vsh/vsh/openpipeline/v4.1.0/nextflow/workflows/multiomics/process_batches/utils/labels.config similarity index 100% rename from target/dependencies/vsh/vsh/openpipeline/v4.0.3/nextflow/workflows/multiomics/process_samples/utils/labels.config rename to target/dependencies/vsh/vsh/openpipeline/v4.1.0/nextflow/workflows/multiomics/process_batches/utils/labels.config diff --git a/target/dependencies/vsh/vsh/openpipeline/v4.0.3/nextflow/workflows/multiomics/process_samples/utils/labels_ci.config b/target/dependencies/vsh/vsh/openpipeline/v4.1.0/nextflow/workflows/multiomics/process_batches/utils/labels_ci.config similarity index 100% rename from target/dependencies/vsh/vsh/openpipeline/v4.0.3/nextflow/workflows/multiomics/process_samples/utils/labels_ci.config rename to target/dependencies/vsh/vsh/openpipeline/v4.1.0/nextflow/workflows/multiomics/process_batches/utils/labels_ci.config diff --git a/target/dependencies/vsh/vsh/openpipeline/v4.0.3/nextflow/workflows/multiomics/process_samples/.config.vsh.yaml b/target/dependencies/vsh/vsh/openpipeline/v4.1.0/nextflow/workflows/multiomics/process_samples/.config.vsh.yaml similarity index 95% rename from target/dependencies/vsh/vsh/openpipeline/v4.0.3/nextflow/workflows/multiomics/process_samples/.config.vsh.yaml rename to target/dependencies/vsh/vsh/openpipeline/v4.1.0/nextflow/workflows/multiomics/process_samples/.config.vsh.yaml index 342273c..0b5b1f6 100644 --- a/target/dependencies/vsh/vsh/openpipeline/v4.0.3/nextflow/workflows/multiomics/process_samples/.config.vsh.yaml +++ b/target/dependencies/vsh/vsh/openpipeline/v4.1.0/nextflow/workflows/multiomics/process_samples/.config.vsh.yaml @@ -1,6 +1,6 @@ name: "process_samples" namespace: "workflows/multiomics" -version: "v4.0.3" +version: "v4.1.0" authors: - name: "Dries Schaumont" roles: @@ -322,6 +322,15 @@ argument_groups: direction: "input" multiple: false multiple_sep: ";" +- name: "Cross-modality filtering" + arguments: + - type: "boolean_true" + name: "--intersect_obs" + description: "After per-modality filtering and multisample processing, remove\ + \ observations\nthat are not present in all processed modalities so that each\ + \ modality shares\nthe same set of cells.\n" + info: null + direction: "input" - name: "Highly variable features detection" arguments: - type: "string" @@ -589,6 +598,10 @@ test_resources: path: "test.nf" is_executable: true entrypoint: "test_wf5" +- type: "nextflow_script" + path: "test.nf" + is_executable: true + entrypoint: "test_wf9" - type: "file" path: "concat_test_data" - type: "file" @@ -603,6 +616,10 @@ info: namespace: "filter" - name: "assert_test_workflow_2_output" namespace: "test_workflows/multiomics/process_samples" + - name: "assert_test_workflow_9_output" + namespace: "test_workflows/multiomics/process_samples" + - name: "assert_test_workflow_10_output" + namespace: "test_workflows/multiomics/process_samples" status: "enabled" scope: image: "public" @@ -621,13 +638,7 @@ dependencies: - name: "dataflow/concatenate_h5mu" repository: type: "local" -- name: "workflows/rna/rna_singlesample" - repository: - type: "local" -- name: "workflows/prot/prot_singlesample" - repository: - type: "local" -- name: "workflows/gdo/gdo_singlesample" +- name: "workflows/multiomics/process_singlesample_base" repository: type: "local" - name: "workflows/multiomics/process_batches" @@ -710,21 +721,19 @@ build_info: engine: "native" output: "target/nextflow/workflows/multiomics/process_samples" executable: "target/nextflow/workflows/multiomics/process_samples/main.nf" - viash_version: "0.9.4" - git_commit: "7bfad4ea12f87eca59213be3ab08deff67cc4206" + viash_version: "0.9.7" + git_commit: "a6499fddaa8553874585c747370f919f4d7b729c" git_remote: "https://github.com/openpipelines-bio/openpipeline" dependencies: - "target/nextflow/metadata/add_id" - "target/_private/nextflow/workflows/multiomics/split_modalities" - "target/nextflow/dataflow/merge" - "target/nextflow/dataflow/concatenate_h5mu" - - "target/nextflow/workflows/rna/rna_singlesample" - - "target/nextflow/workflows/prot/prot_singlesample" - - "target/nextflow/workflows/gdo/gdo_singlesample" + - "target/_private/nextflow/workflows/multiomics/process_singlesample_base" - "target/nextflow/workflows/multiomics/process_batches" package_config: name: "openpipeline" - version: "v4.0.3" + version: "v4.1.0" summary: "Best-practice workflows for single-cell multi-omics analyses.\n" description: "OpenPipelines are extensible single cell analysis pipelines for reproducible\ \ and large-scale single cell processing using [Viash](https://viash.io) and [Nextflow](https://www.nextflow.io/).\n\ @@ -745,7 +754,7 @@ package_config: - path: "src/workflows/utils/labels_ci.config" description: "Adds the correct memory and CPU labels when running on the Viash\ \ Hub CI." - viash_version: "0.9.4" + viash_version: "0.9.7" source: "src" target: "target" config_mods: @@ -754,7 +763,7 @@ package_config: )'" - ".engines += { type: \"native\" }" - ".engines[.type == 'docker'].target_registry := 'images.viash-hub.com'" - - ".engines[.type == 'docker'].target_tag := 'v4.0.3'" + - ".engines[.type == 'docker'].target_tag := 'v4.1.0'" keywords: - "single-cell" - "multimodal" diff --git a/target/dependencies/vsh/vsh/openpipeline/v4.0.3/nextflow/workflows/multiomics/process_samples/main.nf b/target/dependencies/vsh/vsh/openpipeline/v4.1.0/nextflow/workflows/multiomics/process_samples/main.nf similarity index 95% rename from target/dependencies/vsh/vsh/openpipeline/v4.0.3/nextflow/workflows/multiomics/process_samples/main.nf rename to target/dependencies/vsh/vsh/openpipeline/v4.1.0/nextflow/workflows/multiomics/process_samples/main.nf index 90b44f8..ec5ef97 100644 --- a/target/dependencies/vsh/vsh/openpipeline/v4.0.3/nextflow/workflows/multiomics/process_samples/main.nf +++ b/target/dependencies/vsh/vsh/openpipeline/v4.1.0/nextflow/workflows/multiomics/process_samples/main.nf @@ -1,6 +1,6 @@ -// process_samples v4.0.3 +// process_samples v4.1.0 // -// This wrapper script is auto-generated by viash 0.9.4 and is thus a derivative +// This wrapper script is auto-generated by viash 0.9.7 and is thus a derivative // work thereof. This software comes with ABSOLUTELY NO WARRANTY from Data // Intuitive. // @@ -1353,47 +1353,42 @@ def readCsv(file_path) { def splitRegex = java.util.regex.Pattern.compile(''',(?=(?:[^"]*"[^"]*")*[^"]*$)''') def removeQuote = java.util.regex.Pattern.compile('''"(.*)"''') - def br = java.nio.file.Files.newBufferedReader(inputFile) + java.nio.file.Files.newBufferedReader(inputFile).withCloseable { br -> + def row = 0 + def header = null + def line - def row = -1 - def header = null - while (br.ready() && header == null) { - def line = br.readLine() - row++ - if (!line.startsWith("#")) { - header = splitRegex.split(line, -1).collect{field -> - m = removeQuote.matcher(field) - m.find() ? m.replaceFirst('$1') : field - } - } - } - assert header != null: "CSV file should contain a header" - - while (br.ready()) { - def line = br.readLine() - row++ - if (line == null) { - br.close() - break - } - - if (!line.startsWith("#")) { - def predata = splitRegex.split(line, -1) - def data = predata.collect{field -> - if (field == "") { - return null - } - def m = removeQuote.matcher(field) - if (m.find()) { - return m.replaceFirst('$1') - } else { - return field + while (header == null && (line = br.readLine()) != null) { + if (!line.startsWith("#")) { + header = splitRegex.split(line, -1).collect { field -> + def m = removeQuote.matcher(field) + m.find() ? m.replaceFirst('$1') : field } } - assert header.size() == data.size(): "Row $row should contain the same number as fields as the header" - - def dataMap = [header, data].transpose().collectEntries().findAll{it.value != null} - output.add(dataMap) + row++ + } + assert header != null : "CSV file should contain a header" + + while ((line = br.readLine()) != null) { + row++ + if (!line.startsWith("#")) { + def predata = splitRegex.split(line, -1) + def data = predata.collect { field -> + if (field == "") { + return null + } + def m = removeQuote.matcher(field) + if (m.find()) { + return m.replaceFirst('$1') + } else { + return field + } + } + assert header.size() == data.size() : "Row $row should contain the same number as fields as the header" + + def dataMap = [header, data].transpose().collectEntries().findAll { it.value != null } + output.add(dataMap) + } } } @@ -1709,10 +1704,25 @@ process publishFilesProc { ] .transpose() .collectMany{infile, outfile -> - if (infile.toString() != outfile.toString()) { + def infileString = infile.toString() + def outfileString = outfile.toString() + if (infileString != outfileString) { + /* Trailing slashes are removed from both the source and destination arguments. + From source arguments, this is useful when a source argument may have a trailing slash + and specify a symbolic link to a directory. Without removing the slash, cp will dereference + the symbolic link. + See https://www.gnu.org/software/coreutils/manual/html_node/Trailing-slashes.html#Trailing-slashes-1 + + For the destination path addding a trailing slash is a problem when publishing directories: + it requires the destination directory to exist. This fails because we only create the parent + directories first. + */ + def regexTrailingSlashes = ~/\/+$/ + def infileNoTrailingSlash = infileString - regexTrailingSlashes + def outfileNoTrailingSlash = outfileString - regexTrailingSlashes [ - "[ -d \"\$(dirname '${outfile.toString()}')\" ] || mkdir -p \"\$(dirname '${outfile.toString()}')\"", - "cp -r '${infile.toString()}' '${outfile.toString()}'" + "[ -d \"\$(dirname '${outfileNoTrailingSlash}')\" ] || mkdir -p \"\$(dirname '${outfileNoTrailingSlash}')\"", + "cp -a '${infileNoTrailingSlash}' '${outfileNoTrailingSlash}'" ] } else { // no need to copy if infile is the same as outfile @@ -3035,7 +3045,7 @@ meta = [ "config": processConfig(readJsonBlob('''{ "name" : "process_samples", "namespace" : "workflows/multiomics", - "version" : "v4.0.3", + "version" : "v4.1.0", "authors" : [ { "name" : "Dries Schaumont", @@ -3433,6 +3443,17 @@ meta = [ } ] }, + { + "name" : "Cross-modality filtering", + "arguments" : [ + { + "type" : "boolean_true", + "name" : "--intersect_obs", + "description" : "After per-modality filtering and multisample processing, remove observations\nthat are not present in all processed modalities so that each modality shares\nthe same set of cells.\n", + "direction" : "input" + } + ] + }, { "name" : "Highly variable features detection", "arguments" : [ @@ -3742,6 +3763,12 @@ meta = [ "is_executable" : true, "entrypoint" : "test_wf5" }, + { + "type" : "nextflow_script", + "path" : "test.nf", + "is_executable" : true, + "entrypoint" : "test_wf9" + }, { "type" : "file", "path" : "/resources_test/concat_test_data" @@ -3768,6 +3795,14 @@ meta = [ { "name" : "assert_test_workflow_2_output", "namespace" : "test_workflows/multiomics/process_samples" + }, + { + "name" : "assert_test_workflow_9_output", + "namespace" : "test_workflows/multiomics/process_samples" + }, + { + "name" : "assert_test_workflow_10_output", + "namespace" : "test_workflows/multiomics/process_samples" } ] }, @@ -3803,19 +3838,7 @@ meta = [ } }, { - "name" : "workflows/rna/rna_singlesample", - "repository" : { - "type" : "local" - } - }, - { - "name" : "workflows/prot/prot_singlesample", - "repository" : { - "type" : "local" - } - }, - { - "name" : "workflows/gdo/gdo_singlesample", + "name" : "workflows/multiomics/process_singlesample_base", "repository" : { "type" : "local" } @@ -3915,13 +3938,13 @@ meta = [ "runner" : "nextflow", "engine" : "native", "output" : "/workdir/root/repo/target/nextflow/workflows/multiomics/process_samples", - "viash_version" : "0.9.4", - "git_commit" : "7bfad4ea12f87eca59213be3ab08deff67cc4206", + "viash_version" : "0.9.7", + "git_commit" : "a6499fddaa8553874585c747370f919f4d7b729c", "git_remote" : "https://github.com/openpipelines-bio/openpipeline" }, "package_config" : { "name" : "openpipeline", - "version" : "v4.0.3", + "version" : "v4.1.0", "summary" : "Best-practice workflows for single-cell multi-omics analyses.\n", "description" : "OpenPipelines are extensible single cell analysis pipelines for reproducible and large-scale single cell processing using [Viash](https://viash.io) and [Nextflow](https://www.nextflow.io/).\n\nIn terms of workflows, the following has been made available, but keep in mind that\nindividual tools and functionality can be executed as standalone components as well.\n\n * Demultiplexing: conversion of raw sequencing data to FASTQ objects.\n * Ingestion: Read mapping and generating a count matrix.\n * Single sample processing: cell filtering and doublet detection.\n * Multisample processing: Count transformation, normalization, QC metric calulations.\n * Integration: Clustering, integration and batch correction using single and multimodal methods.\n * Downstream analysis workflows\n", "info" : { @@ -3939,14 +3962,14 @@ meta = [ } ] }, - "viash_version" : "0.9.4", + "viash_version" : "0.9.7", "source" : "/workdir/root/repo/src", "target" : "/workdir/root/repo/target", "config_mods" : [ ".resources += {path: '/src/workflows/utils/labels.config', dest: 'nextflow_labels.config'}\n.runners[.type == 'nextflow'].config.script := 'includeConfig(\\"nextflow_labels.config\\")'", ".engines += { type: \\"native\\" }", ".engines[.type == 'docker'].target_registry := 'images.viash-hub.com'", - ".engines[.type == 'docker'].target_tag := 'v4.0.3'" + ".engines[.type == 'docker'].target_tag := 'v4.1.0'" ], "keywords" : [ "single-cell", @@ -3972,9 +3995,7 @@ include { split_modalities as split_modalities_workflow_viashalias } from "${met split_modalities_workflow = split_modalities_workflow_viashalias.run(key: "split_modalities_workflow") include { merge } from "${meta.resources_dir}/../../../../nextflow/dataflow/merge/main.nf" include { concatenate_h5mu } from "${meta.resources_dir}/../../../../nextflow/dataflow/concatenate_h5mu/main.nf" -include { rna_singlesample } from "${meta.resources_dir}/../../../../nextflow/workflows/rna/rna_singlesample/main.nf" -include { prot_singlesample } from "${meta.resources_dir}/../../../../nextflow/workflows/prot/prot_singlesample/main.nf" -include { gdo_singlesample } from "${meta.resources_dir}/../../../../nextflow/workflows/gdo/gdo_singlesample/main.nf" +include { process_singlesample_base } from "${meta.resources_dir}/../../../../_private/nextflow/workflows/multiomics/process_singlesample_base/main.nf" include { process_batches } from "${meta.resources_dir}/../../../../nextflow/workflows/multiomics/process_batches/main.nf" // inner workflow @@ -3984,13 +4005,52 @@ workflow run_wf { input_ch main: - modalities_ch = input_ch + + def singlesample_arguments = [ + "input": "input", + "rna_layer": "rna_layer", + "prot_layer": "prot_layer", + "gdo_layer": "gdo_layer", + "add_id_to_obs": "add_id_to_obs", + "add_id_obs_output": "add_id_obs_output", + "add_id_make_observation_keys_unique": "add_id_make_observation_keys_unique", + "rna_min_counts": "rna_min_counts", + "rna_max_counts": "rna_max_counts", + "rna_min_genes_per_cell": "rna_min_genes_per_cell", + "rna_max_genes_per_cell": "rna_max_genes_per_cell", + "rna_min_cells_per_gene": "rna_min_cells_per_gene", + "rna_min_fraction_mito": "rna_min_fraction_mito", + "rna_max_fraction_mito": "rna_max_fraction_mito", + "rna_min_fraction_ribo": "rna_min_fraction_ribo", + "rna_max_fraction_ribo": "rna_max_fraction_ribo", + "skip_scrublet_doublet_detection": "skip_scrublet_doublet_detection", + "prot_min_counts": "prot_min_counts", + "prot_max_counts": "prot_max_counts", + "prot_min_proteins_per_cell": "prot_min_proteins_per_cell", + "prot_max_proteins_per_cell": "prot_max_proteins_per_cell", + "prot_min_cells_per_protein": "prot_min_cells_per_protein", + "gdo_min_counts": "gdo_min_counts", + "gdo_max_counts": "gdo_max_counts", + "gdo_min_guides_per_cell": "gdo_min_guides_per_cell", + "gdo_max_guides_per_cell": "gdo_max_guides_per_cell", + "gdo_min_cells_per_guide": "gdo_min_cells_per_guide", + "var_gene_names": "var_gene_names", + "var_name_mitochondrial_genes": "var_name_mitochondrial_genes", + "obs_name_mitochondrial_fraction": "obs_name_mitochondrial_fraction", + "mitochondrial_gene_regex": "mitochondrial_gene_regex", + "var_name_ribosomal_genes": "var_name_ribosomal_genes", + "obs_name_ribosomal_fraction": "obs_name_ribosomal_fraction", + "ribosomal_gene_regex": "ribosomal_gene_regex" + ] + + singlesample_ch = input_ch // Make sure there is not conflict between the output from this workflow // And the output from any of the components | map {id, state -> def new_state = state + ["workflow_output": state.output] [id, new_state] } + // If requested to be detected, make sure the mitochondrial and ribosomal genes // are added to the input of the qc metrics calculation | map {id, state -> @@ -4004,129 +4064,21 @@ workflow run_wf { def newState = state + ["var_qc_metrics": var_qc_default.join(",")] [id, newState] } - // If requested, add the id of the events (samples) a column in .obs. - // Also allows to make .obs_names (the .obs index) unique, by prefixing the values with an unique id per .h5mu file. - // The latter is usefull to avoid duplicate observations during concatenation. - | add_id.run( - filter: {id, state -> state.add_id_to_obs }, - fromState: {id, state -> - def newState = [ - "input": state.input, - "input_id": id, - "make_observation_keys_unique": state.add_id_make_observation_keys_unique, - "obs_output": state.add_id_obs_output, - "add_id_to_obs": state.add_id_to_obs - ] - newState - }, - toState: {id, output, state -> - def keysToRemove = ["add_id_to_obs", "add_id_obs_output", "add_id_make_observation_keys_unique"] - def newState = state.findAll{it.key !in keysToRemove} - newState + ["input": output.output] - } + | process_singlesample_base.run( + fromState: singlesample_arguments, + toState: [ + "input": "output", + "modality": "output_modality" + ] ) - | split_modalities_workflow.run( - fromState: {id, state -> - def newState = ["input": state.input, "id": id] - }, - toState: ["output": "output", "output_types": "output_types"] - ) - | flatMap {id, state -> - def outputDir = state.output - def csv = state.output_types.splitCsv(strip: true, sep: ",").findAll{!it[0].startsWith("#")} - def header = csv.head() - def types = csv.tail().collect { row -> - [header, row].transpose().collectEntries() - } - - types.collect{ dat -> - // def new_id = id + "_" + dat.name - def new_id = id // it's okay because the channel will get split up anyways - def new_data = outputDir.resolve(dat.filename) - [ new_id, state + ["input": new_data, modality: dat.name]] - } - } - // Remove arguments from split modalities from state - | map {id, state -> - def keysToRemove = ["output_types"] - def newState = state.findAll{it.key !in keysToRemove} - [id, newState] - } - | view {"After splitting modalities: $it"} - - - // - // Singlesample processing - // - def singlesample_arguments = [ - "rna": [ - "min_counts": "rna_min_counts", - "max_counts": "rna_max_counts", - "min_genes_per_cell": "rna_min_genes_per_cell", - "max_genes_per_cell": "rna_max_genes_per_cell", - "min_cells_per_gene": "rna_min_cells_per_gene", - "min_fraction_mito": "rna_min_fraction_mito", - "max_fraction_mito": "rna_max_fraction_mito", - "var_name_mitochondrial_genes": "var_name_mitochondrial_genes", - "obs_name_mitochondrial_fraction": "obs_name_mitochondrial_fraction", - "var_gene_names": "var_gene_names", - "mitochondrial_gene_regex": "mitochondrial_gene_regex", - "min_fraction_ribo": "rna_min_fraction_ribo", - "max_fraction_ribo": "rna_max_fraction_ribo", - "var_name_ribosomal_genes": "var_name_ribosomal_genes", - "obs_name_ribosomal_fraction": "obs_name_ribosomal_fraction", - "ribosomal_gene_regex": "ribosomal_gene_regex", - "layer": "rna_layer", - "skip_scrublet_doublet_detection": "skip_scrublet_doublet_detection" - ], - "prot": [ - "min_counts": "prot_min_counts", - "max_counts": "prot_max_counts", - "min_proteins_per_cell": "prot_min_proteins_per_cell", - "max_proteins_per_cell": "prot_max_proteins_per_cell", - "min_cells_per_protein": "prot_min_cells_per_protein", - "layer": "prot_layer", - ], - "gdo": [ - "min_counts": "gdo_min_counts", - "max_counts": "gdo_max_counts", - "min_guides_per_cell": "gdo_min_guides_per_cell", - "max_guides_per_cell": "gdo_max_guides_per_cell", - "min_cells_per_guide": "gdo_min_cells_per_guide", - "layer": "gdo_layer", - ], - ].asImmutable() - - multisample_ch_known = modalities_ch - // run the singlesample processing - | runEach( - components: [rna_singlesample, prot_singlesample, gdo_singlesample], - filter: { id, state, component -> - state.modality + "_singlesample" == component.config.name - }, - fromState: { id, state, component -> - def newState = singlesample_arguments.get(state.modality).collectEntries{key_, value_ -> - [key_, state[value_]] - } - return newState + ["id": id, "input": state.input] - }, - toState: ["input": "output"], - ) - - multisample_ch_unknown = modalities_ch - | filter{id, state -> state.modality !in singlesample_arguments.keySet()} - - output_ch = multisample_ch_unknown.mix(multisample_ch_known) + + concat_ch = singlesample_ch // Remove arguments for singlesample processing from state. | map {id, state -> - def keysToRemove = singlesample_arguments.inject([]){currentKeys, modality, stateMapping -> - currentKeys += stateMapping.values() - } - def allwayskeep = ["gdo_layer", "rna_layer", "prot_layer", "workflow_output"] - def newState = state.findAll{(it.key !in keysToRemove + ["id"]) || (it.key in allwayskeep)} + def allwayskeep = ["input", "gdo_layer", "rna_layer", "prot_layer", "workflow_output"] + def newState = state.findAll{(it.key !in singlesample_arguments.values() + ["id"]) || (it.key in allwayskeep)} [id, newState] } - | view {"After singlesample processing: $it"} // // Concatenation: join observations across samples together per modality. @@ -4178,7 +4130,6 @@ workflow run_wf { newState + ["input": output.output] }, ) - | view {"After concatenation: $it"} | toSortedList() | map {modalities_states -> @@ -4201,6 +4152,8 @@ workflow run_wf { } ["merged", new_state + ["input": new_input, "_meta": ["join_id": join_id]]] } + + multisample_ch = concat_ch | process_batches.run( fromState: {id, state -> [ @@ -4215,6 +4168,7 @@ workflow run_wf { "rna_layer": state.rna_layer, "prot_layer": state.prot_layer, "clr_axis": state.clr_axis, + "intersect_obs": state.intersect_obs, "rna_enable_scaling": state.rna_enable_scaling, "rna_scaling_output_layer": state.rna_scaling_output_layer, "rna_scaling_pca_obsm_output": state.rna_scaling_pca_obsm_output, @@ -4235,7 +4189,7 @@ workflow run_wf { | view {"After process_batches: $it"} emit: - output_ch + multisample_ch } // inner workflow hook diff --git a/target/dependencies/vsh/vsh/openpipeline/v4.0.3/nextflow/workflows/multiomics/process_samples/nextflow.config b/target/dependencies/vsh/vsh/openpipeline/v4.1.0/nextflow/workflows/multiomics/process_samples/nextflow.config similarity index 99% rename from target/dependencies/vsh/vsh/openpipeline/v4.0.3/nextflow/workflows/multiomics/process_samples/nextflow.config rename to target/dependencies/vsh/vsh/openpipeline/v4.1.0/nextflow/workflows/multiomics/process_samples/nextflow.config index ce3b7f0..e0a2065 100644 --- a/target/dependencies/vsh/vsh/openpipeline/v4.0.3/nextflow/workflows/multiomics/process_samples/nextflow.config +++ b/target/dependencies/vsh/vsh/openpipeline/v4.1.0/nextflow/workflows/multiomics/process_samples/nextflow.config @@ -2,7 +2,7 @@ manifest { name = 'workflows/multiomics/process_samples' mainScript = 'main.nf' nextflowVersion = '!>=20.12.1-edge' - version = 'v4.0.3' + version = 'v4.1.0' description = 'A pipeline to analyse multiple multiomics samples.' author = 'Dries Schaumont' } diff --git a/target/dependencies/vsh/vsh/openpipeline/v4.0.3/nextflow/workflows/prot/prot_singlesample/nextflow_labels.config b/target/dependencies/vsh/vsh/openpipeline/v4.1.0/nextflow/workflows/multiomics/process_samples/nextflow_labels.config similarity index 100% rename from target/dependencies/vsh/vsh/openpipeline/v4.0.3/nextflow/workflows/prot/prot_singlesample/nextflow_labels.config rename to target/dependencies/vsh/vsh/openpipeline/v4.1.0/nextflow/workflows/multiomics/process_samples/nextflow_labels.config diff --git a/target/dependencies/vsh/vsh/openpipeline/v4.0.3/nextflow/workflows/multiomics/process_samples/nextflow_schema.json b/target/dependencies/vsh/vsh/openpipeline/v4.1.0/nextflow/workflows/multiomics/process_samples/nextflow_schema.json similarity index 96% rename from target/dependencies/vsh/vsh/openpipeline/v4.0.3/nextflow/workflows/multiomics/process_samples/nextflow_schema.json rename to target/dependencies/vsh/vsh/openpipeline/v4.1.0/nextflow/workflows/multiomics/process_samples/nextflow_schema.json index dab191e..df9aca4 100644 --- a/target/dependencies/vsh/vsh/openpipeline/v4.0.3/nextflow/workflows/multiomics/process_samples/nextflow_schema.json +++ b/target/dependencies/vsh/vsh/openpipeline/v4.1.0/nextflow/workflows/multiomics/process_samples/nextflow_schema.json @@ -199,6 +199,19 @@ } } }, + "cross-modality filtering": { + "title": "Cross-modality filtering", + "type": "object", + "description": "No description", + "properties": { + "intersect_obs": { + "type": "boolean", + "description": "After per-modality filtering and multisample processing, remove observations\nthat are not present in all processed modalities so that each modality shares\nthe same set of cells.\n", + "help_text": "Type: `boolean_true`, multiple: `False`, default: `false`. ", + "default": false + } + } + }, "highly variable features detection": { "title": "Highly variable features detection", "type": "object", @@ -403,6 +416,9 @@ { "$ref": "#/$defs/gdo filtering options" }, + { + "$ref": "#/$defs/cross-modality filtering" + }, { "$ref": "#/$defs/highly variable features detection" }, diff --git a/target/dependencies/vsh/vsh/openpipeline/v4.0.3/nextflow/workflows/prot/prot_multisample/utils/errorstrat_ignore.config b/target/dependencies/vsh/vsh/openpipeline/v4.1.0/nextflow/workflows/multiomics/process_samples/utils/errorstrat_ignore.config similarity index 100% rename from target/dependencies/vsh/vsh/openpipeline/v4.0.3/nextflow/workflows/prot/prot_multisample/utils/errorstrat_ignore.config rename to target/dependencies/vsh/vsh/openpipeline/v4.1.0/nextflow/workflows/multiomics/process_samples/utils/errorstrat_ignore.config diff --git a/target/dependencies/vsh/vsh/openpipeline/v4.0.3/nextflow/workflows/prot/prot_multisample/utils/integration_tests.config b/target/dependencies/vsh/vsh/openpipeline/v4.1.0/nextflow/workflows/multiomics/process_samples/utils/integration_tests.config similarity index 100% rename from target/dependencies/vsh/vsh/openpipeline/v4.0.3/nextflow/workflows/prot/prot_multisample/utils/integration_tests.config rename to target/dependencies/vsh/vsh/openpipeline/v4.1.0/nextflow/workflows/multiomics/process_samples/utils/integration_tests.config diff --git a/target/dependencies/vsh/vsh/openpipeline/v4.0.3/nextflow/workflows/prot/prot_multisample/utils/labels.config b/target/dependencies/vsh/vsh/openpipeline/v4.1.0/nextflow/workflows/multiomics/process_samples/utils/labels.config similarity index 100% rename from target/dependencies/vsh/vsh/openpipeline/v4.0.3/nextflow/workflows/prot/prot_multisample/utils/labels.config rename to target/dependencies/vsh/vsh/openpipeline/v4.1.0/nextflow/workflows/multiomics/process_samples/utils/labels.config diff --git a/target/dependencies/vsh/vsh/openpipeline/v4.0.3/nextflow/workflows/prot/prot_multisample/utils/labels_ci.config b/target/dependencies/vsh/vsh/openpipeline/v4.1.0/nextflow/workflows/multiomics/process_samples/utils/labels_ci.config similarity index 100% rename from target/dependencies/vsh/vsh/openpipeline/v4.0.3/nextflow/workflows/prot/prot_multisample/utils/labels_ci.config rename to target/dependencies/vsh/vsh/openpipeline/v4.1.0/nextflow/workflows/multiomics/process_samples/utils/labels_ci.config diff --git a/target/dependencies/vsh/vsh/openpipeline/v4.0.3/nextflow/workflows/prot/prot_multisample/.config.vsh.yaml b/target/dependencies/vsh/vsh/openpipeline/v4.1.0/nextflow/workflows/prot/prot_multisample/.config.vsh.yaml similarity index 98% rename from target/dependencies/vsh/vsh/openpipeline/v4.0.3/nextflow/workflows/prot/prot_multisample/.config.vsh.yaml rename to target/dependencies/vsh/vsh/openpipeline/v4.1.0/nextflow/workflows/prot/prot_multisample/.config.vsh.yaml index 70b8351..ed72c17 100644 --- a/target/dependencies/vsh/vsh/openpipeline/v4.0.3/nextflow/workflows/prot/prot_multisample/.config.vsh.yaml +++ b/target/dependencies/vsh/vsh/openpipeline/v4.1.0/nextflow/workflows/prot/prot_multisample/.config.vsh.yaml @@ -1,6 +1,6 @@ name: "prot_multisample" namespace: "workflows/prot" -version: "v4.0.3" +version: "v4.1.0" authors: - name: "Dries Schaumont" roles: @@ -283,15 +283,15 @@ build_info: engine: "native" output: "target/nextflow/workflows/prot/prot_multisample" executable: "target/nextflow/workflows/prot/prot_multisample/main.nf" - viash_version: "0.9.4" - git_commit: "7bfad4ea12f87eca59213be3ab08deff67cc4206" + viash_version: "0.9.7" + git_commit: "a6499fddaa8553874585c747370f919f4d7b729c" git_remote: "https://github.com/openpipelines-bio/openpipeline" dependencies: - "target/nextflow/transform/clr" - "target/nextflow/workflows/qc/qc" package_config: name: "openpipeline" - version: "v4.0.3" + version: "v4.1.0" summary: "Best-practice workflows for single-cell multi-omics analyses.\n" description: "OpenPipelines are extensible single cell analysis pipelines for reproducible\ \ and large-scale single cell processing using [Viash](https://viash.io) and [Nextflow](https://www.nextflow.io/).\n\ @@ -312,7 +312,7 @@ package_config: - path: "src/workflows/utils/labels_ci.config" description: "Adds the correct memory and CPU labels when running on the Viash\ \ Hub CI." - viash_version: "0.9.4" + viash_version: "0.9.7" source: "src" target: "target" config_mods: @@ -321,7 +321,7 @@ package_config: )'" - ".engines += { type: \"native\" }" - ".engines[.type == 'docker'].target_registry := 'images.viash-hub.com'" - - ".engines[.type == 'docker'].target_tag := 'v4.0.3'" + - ".engines[.type == 'docker'].target_tag := 'v4.1.0'" keywords: - "single-cell" - "multimodal" diff --git a/target/dependencies/vsh/vsh/openpipeline/v4.0.3/nextflow/workflows/prot/prot_multisample/main.nf b/target/dependencies/vsh/vsh/openpipeline/v4.1.0/nextflow/workflows/prot/prot_multisample/main.nf similarity index 97% rename from target/dependencies/vsh/vsh/openpipeline/v4.0.3/nextflow/workflows/prot/prot_multisample/main.nf rename to target/dependencies/vsh/vsh/openpipeline/v4.1.0/nextflow/workflows/prot/prot_multisample/main.nf index e8420d7..1d0c21e 100644 --- a/target/dependencies/vsh/vsh/openpipeline/v4.0.3/nextflow/workflows/prot/prot_multisample/main.nf +++ b/target/dependencies/vsh/vsh/openpipeline/v4.1.0/nextflow/workflows/prot/prot_multisample/main.nf @@ -1,6 +1,6 @@ -// prot_multisample v4.0.3 +// prot_multisample v4.1.0 // -// This wrapper script is auto-generated by viash 0.9.4 and is thus a derivative +// This wrapper script is auto-generated by viash 0.9.7 and is thus a derivative // work thereof. This software comes with ABSOLUTELY NO WARRANTY from Data // Intuitive. // @@ -1353,47 +1353,42 @@ def readCsv(file_path) { def splitRegex = java.util.regex.Pattern.compile(''',(?=(?:[^"]*"[^"]*")*[^"]*$)''') def removeQuote = java.util.regex.Pattern.compile('''"(.*)"''') - def br = java.nio.file.Files.newBufferedReader(inputFile) + java.nio.file.Files.newBufferedReader(inputFile).withCloseable { br -> + def row = 0 + def header = null + def line - def row = -1 - def header = null - while (br.ready() && header == null) { - def line = br.readLine() - row++ - if (!line.startsWith("#")) { - header = splitRegex.split(line, -1).collect{field -> - m = removeQuote.matcher(field) - m.find() ? m.replaceFirst('$1') : field - } - } - } - assert header != null: "CSV file should contain a header" - - while (br.ready()) { - def line = br.readLine() - row++ - if (line == null) { - br.close() - break - } - - if (!line.startsWith("#")) { - def predata = splitRegex.split(line, -1) - def data = predata.collect{field -> - if (field == "") { - return null - } - def m = removeQuote.matcher(field) - if (m.find()) { - return m.replaceFirst('$1') - } else { - return field + while (header == null && (line = br.readLine()) != null) { + if (!line.startsWith("#")) { + header = splitRegex.split(line, -1).collect { field -> + def m = removeQuote.matcher(field) + m.find() ? m.replaceFirst('$1') : field } } - assert header.size() == data.size(): "Row $row should contain the same number as fields as the header" - - def dataMap = [header, data].transpose().collectEntries().findAll{it.value != null} - output.add(dataMap) + row++ + } + assert header != null : "CSV file should contain a header" + + while ((line = br.readLine()) != null) { + row++ + if (!line.startsWith("#")) { + def predata = splitRegex.split(line, -1) + def data = predata.collect { field -> + if (field == "") { + return null + } + def m = removeQuote.matcher(field) + if (m.find()) { + return m.replaceFirst('$1') + } else { + return field + } + } + assert header.size() == data.size() : "Row $row should contain the same number as fields as the header" + + def dataMap = [header, data].transpose().collectEntries().findAll { it.value != null } + output.add(dataMap) + } } } @@ -1709,10 +1704,25 @@ process publishFilesProc { ] .transpose() .collectMany{infile, outfile -> - if (infile.toString() != outfile.toString()) { + def infileString = infile.toString() + def outfileString = outfile.toString() + if (infileString != outfileString) { + /* Trailing slashes are removed from both the source and destination arguments. + From source arguments, this is useful when a source argument may have a trailing slash + and specify a symbolic link to a directory. Without removing the slash, cp will dereference + the symbolic link. + See https://www.gnu.org/software/coreutils/manual/html_node/Trailing-slashes.html#Trailing-slashes-1 + + For the destination path addding a trailing slash is a problem when publishing directories: + it requires the destination directory to exist. This fails because we only create the parent + directories first. + */ + def regexTrailingSlashes = ~/\/+$/ + def infileNoTrailingSlash = infileString - regexTrailingSlashes + def outfileNoTrailingSlash = outfileString - regexTrailingSlashes [ - "[ -d \"\$(dirname '${outfile.toString()}')\" ] || mkdir -p \"\$(dirname '${outfile.toString()}')\"", - "cp -r '${infile.toString()}' '${outfile.toString()}'" + "[ -d \"\$(dirname '${outfileNoTrailingSlash}')\" ] || mkdir -p \"\$(dirname '${outfileNoTrailingSlash}')\"", + "cp -a '${infileNoTrailingSlash}' '${outfileNoTrailingSlash}'" ] } else { // no need to copy if infile is the same as outfile @@ -3035,7 +3045,7 @@ meta = [ "config": processConfig(readJsonBlob('''{ "name" : "prot_multisample", "namespace" : "workflows/prot", - "version" : "v4.0.3", + "version" : "v4.1.0", "authors" : [ { "name" : "Dries Schaumont", @@ -3383,13 +3393,13 @@ meta = [ "runner" : "nextflow", "engine" : "native", "output" : "/workdir/root/repo/target/nextflow/workflows/prot/prot_multisample", - "viash_version" : "0.9.4", - "git_commit" : "7bfad4ea12f87eca59213be3ab08deff67cc4206", + "viash_version" : "0.9.7", + "git_commit" : "a6499fddaa8553874585c747370f919f4d7b729c", "git_remote" : "https://github.com/openpipelines-bio/openpipeline" }, "package_config" : { "name" : "openpipeline", - "version" : "v4.0.3", + "version" : "v4.1.0", "summary" : "Best-practice workflows for single-cell multi-omics analyses.\n", "description" : "OpenPipelines are extensible single cell analysis pipelines for reproducible and large-scale single cell processing using [Viash](https://viash.io) and [Nextflow](https://www.nextflow.io/).\n\nIn terms of workflows, the following has been made available, but keep in mind that\nindividual tools and functionality can be executed as standalone components as well.\n\n * Demultiplexing: conversion of raw sequencing data to FASTQ objects.\n * Ingestion: Read mapping and generating a count matrix.\n * Single sample processing: cell filtering and doublet detection.\n * Multisample processing: Count transformation, normalization, QC metric calulations.\n * Integration: Clustering, integration and batch correction using single and multimodal methods.\n * Downstream analysis workflows\n", "info" : { @@ -3407,14 +3417,14 @@ meta = [ } ] }, - "viash_version" : "0.9.4", + "viash_version" : "0.9.7", "source" : "/workdir/root/repo/src", "target" : "/workdir/root/repo/target", "config_mods" : [ ".resources += {path: '/src/workflows/utils/labels.config', dest: 'nextflow_labels.config'}\n.runners[.type == 'nextflow'].config.script := 'includeConfig(\\"nextflow_labels.config\\")'", ".engines += { type: \\"native\\" }", ".engines[.type == 'docker'].target_registry := 'images.viash-hub.com'", - ".engines[.type == 'docker'].target_tag := 'v4.0.3'" + ".engines[.type == 'docker'].target_tag := 'v4.1.0'" ], "keywords" : [ "single-cell", diff --git a/target/dependencies/vsh/vsh/openpipeline/v4.0.3/nextflow/workflows/prot/prot_multisample/nextflow.config b/target/dependencies/vsh/vsh/openpipeline/v4.1.0/nextflow/workflows/prot/prot_multisample/nextflow.config similarity index 99% rename from target/dependencies/vsh/vsh/openpipeline/v4.0.3/nextflow/workflows/prot/prot_multisample/nextflow.config rename to target/dependencies/vsh/vsh/openpipeline/v4.1.0/nextflow/workflows/prot/prot_multisample/nextflow.config index a3414a9..8eb4c9a 100644 --- a/target/dependencies/vsh/vsh/openpipeline/v4.0.3/nextflow/workflows/prot/prot_multisample/nextflow.config +++ b/target/dependencies/vsh/vsh/openpipeline/v4.1.0/nextflow/workflows/prot/prot_multisample/nextflow.config @@ -2,7 +2,7 @@ manifest { name = 'workflows/prot/prot_multisample' mainScript = 'main.nf' nextflowVersion = '!>=20.12.1-edge' - version = 'v4.0.3' + version = 'v4.1.0' description = 'Processing unimodal multi-sample ADT data.' author = 'Dries Schaumont' } diff --git a/target/dependencies/vsh/vsh/openpipeline/v4.0.3/nextflow/workflows/qc/qc/nextflow_labels.config b/target/dependencies/vsh/vsh/openpipeline/v4.1.0/nextflow/workflows/prot/prot_multisample/nextflow_labels.config similarity index 100% rename from target/dependencies/vsh/vsh/openpipeline/v4.0.3/nextflow/workflows/qc/qc/nextflow_labels.config rename to target/dependencies/vsh/vsh/openpipeline/v4.1.0/nextflow/workflows/prot/prot_multisample/nextflow_labels.config diff --git a/target/dependencies/vsh/vsh/openpipeline/v4.0.3/nextflow/workflows/prot/prot_multisample/nextflow_schema.json b/target/dependencies/vsh/vsh/openpipeline/v4.1.0/nextflow/workflows/prot/prot_multisample/nextflow_schema.json similarity index 100% rename from target/dependencies/vsh/vsh/openpipeline/v4.0.3/nextflow/workflows/prot/prot_multisample/nextflow_schema.json rename to target/dependencies/vsh/vsh/openpipeline/v4.1.0/nextflow/workflows/prot/prot_multisample/nextflow_schema.json diff --git a/target/dependencies/vsh/vsh/openpipeline/v4.0.3/nextflow/workflows/prot/prot_singlesample/utils/errorstrat_ignore.config b/target/dependencies/vsh/vsh/openpipeline/v4.1.0/nextflow/workflows/prot/prot_multisample/utils/errorstrat_ignore.config similarity index 100% rename from target/dependencies/vsh/vsh/openpipeline/v4.0.3/nextflow/workflows/prot/prot_singlesample/utils/errorstrat_ignore.config rename to target/dependencies/vsh/vsh/openpipeline/v4.1.0/nextflow/workflows/prot/prot_multisample/utils/errorstrat_ignore.config diff --git a/target/dependencies/vsh/vsh/openpipeline/v4.0.3/nextflow/workflows/prot/prot_singlesample/utils/integration_tests.config b/target/dependencies/vsh/vsh/openpipeline/v4.1.0/nextflow/workflows/prot/prot_multisample/utils/integration_tests.config similarity index 100% rename from target/dependencies/vsh/vsh/openpipeline/v4.0.3/nextflow/workflows/prot/prot_singlesample/utils/integration_tests.config rename to target/dependencies/vsh/vsh/openpipeline/v4.1.0/nextflow/workflows/prot/prot_multisample/utils/integration_tests.config diff --git a/target/dependencies/vsh/vsh/openpipeline/v4.0.3/nextflow/workflows/prot/prot_singlesample/utils/labels.config b/target/dependencies/vsh/vsh/openpipeline/v4.1.0/nextflow/workflows/prot/prot_multisample/utils/labels.config similarity index 100% rename from target/dependencies/vsh/vsh/openpipeline/v4.0.3/nextflow/workflows/prot/prot_singlesample/utils/labels.config rename to target/dependencies/vsh/vsh/openpipeline/v4.1.0/nextflow/workflows/prot/prot_multisample/utils/labels.config diff --git a/target/dependencies/vsh/vsh/openpipeline/v4.0.3/nextflow/workflows/prot/prot_singlesample/utils/labels_ci.config b/target/dependencies/vsh/vsh/openpipeline/v4.1.0/nextflow/workflows/prot/prot_multisample/utils/labels_ci.config similarity index 100% rename from target/dependencies/vsh/vsh/openpipeline/v4.0.3/nextflow/workflows/prot/prot_singlesample/utils/labels_ci.config rename to target/dependencies/vsh/vsh/openpipeline/v4.1.0/nextflow/workflows/prot/prot_multisample/utils/labels_ci.config diff --git a/target/dependencies/vsh/vsh/openpipeline/v4.0.3/nextflow/workflows/prot/prot_singlesample/.config.vsh.yaml b/target/dependencies/vsh/vsh/openpipeline/v4.1.0/nextflow/workflows/prot/prot_singlesample/.config.vsh.yaml similarity index 97% rename from target/dependencies/vsh/vsh/openpipeline/v4.0.3/nextflow/workflows/prot/prot_singlesample/.config.vsh.yaml rename to target/dependencies/vsh/vsh/openpipeline/v4.1.0/nextflow/workflows/prot/prot_singlesample/.config.vsh.yaml index 8a408b2..7cd12e9 100644 --- a/target/dependencies/vsh/vsh/openpipeline/v4.0.3/nextflow/workflows/prot/prot_singlesample/.config.vsh.yaml +++ b/target/dependencies/vsh/vsh/openpipeline/v4.1.0/nextflow/workflows/prot/prot_singlesample/.config.vsh.yaml @@ -1,6 +1,6 @@ name: "prot_singlesample" namespace: "workflows/prot" -version: "v4.0.3" +version: "v4.1.0" authors: - name: "Dries De Maeyer" roles: @@ -254,15 +254,15 @@ build_info: engine: "native" output: "target/nextflow/workflows/prot/prot_singlesample" executable: "target/nextflow/workflows/prot/prot_singlesample/main.nf" - viash_version: "0.9.4" - git_commit: "7bfad4ea12f87eca59213be3ab08deff67cc4206" + viash_version: "0.9.7" + git_commit: "a6499fddaa8553874585c747370f919f4d7b729c" git_remote: "https://github.com/openpipelines-bio/openpipeline" dependencies: - "target/nextflow/filter/filter_with_counts" - "target/nextflow/filter/do_filter" package_config: name: "openpipeline" - version: "v4.0.3" + version: "v4.1.0" summary: "Best-practice workflows for single-cell multi-omics analyses.\n" description: "OpenPipelines are extensible single cell analysis pipelines for reproducible\ \ and large-scale single cell processing using [Viash](https://viash.io) and [Nextflow](https://www.nextflow.io/).\n\ @@ -283,7 +283,7 @@ package_config: - path: "src/workflows/utils/labels_ci.config" description: "Adds the correct memory and CPU labels when running on the Viash\ \ Hub CI." - viash_version: "0.9.4" + viash_version: "0.9.7" source: "src" target: "target" config_mods: @@ -292,7 +292,7 @@ package_config: )'" - ".engines += { type: \"native\" }" - ".engines[.type == 'docker'].target_registry := 'images.viash-hub.com'" - - ".engines[.type == 'docker'].target_tag := 'v4.0.3'" + - ".engines[.type == 'docker'].target_tag := 'v4.1.0'" keywords: - "single-cell" - "multimodal" diff --git a/target/dependencies/vsh/vsh/openpipeline/v4.0.3/nextflow/workflows/prot/prot_singlesample/main.nf b/target/dependencies/vsh/vsh/openpipeline/v4.1.0/nextflow/workflows/prot/prot_singlesample/main.nf similarity index 97% rename from target/dependencies/vsh/vsh/openpipeline/v4.0.3/nextflow/workflows/prot/prot_singlesample/main.nf rename to target/dependencies/vsh/vsh/openpipeline/v4.1.0/nextflow/workflows/prot/prot_singlesample/main.nf index f18fd6e..be6f180 100644 --- a/target/dependencies/vsh/vsh/openpipeline/v4.0.3/nextflow/workflows/prot/prot_singlesample/main.nf +++ b/target/dependencies/vsh/vsh/openpipeline/v4.1.0/nextflow/workflows/prot/prot_singlesample/main.nf @@ -1,6 +1,6 @@ -// prot_singlesample v4.0.3 +// prot_singlesample v4.1.0 // -// This wrapper script is auto-generated by viash 0.9.4 and is thus a derivative +// This wrapper script is auto-generated by viash 0.9.7 and is thus a derivative // work thereof. This software comes with ABSOLUTELY NO WARRANTY from Data // Intuitive. // @@ -1355,47 +1355,42 @@ def readCsv(file_path) { def splitRegex = java.util.regex.Pattern.compile(''',(?=(?:[^"]*"[^"]*")*[^"]*$)''') def removeQuote = java.util.regex.Pattern.compile('''"(.*)"''') - def br = java.nio.file.Files.newBufferedReader(inputFile) + java.nio.file.Files.newBufferedReader(inputFile).withCloseable { br -> + def row = 0 + def header = null + def line - def row = -1 - def header = null - while (br.ready() && header == null) { - def line = br.readLine() - row++ - if (!line.startsWith("#")) { - header = splitRegex.split(line, -1).collect{field -> - m = removeQuote.matcher(field) - m.find() ? m.replaceFirst('$1') : field - } - } - } - assert header != null: "CSV file should contain a header" - - while (br.ready()) { - def line = br.readLine() - row++ - if (line == null) { - br.close() - break - } - - if (!line.startsWith("#")) { - def predata = splitRegex.split(line, -1) - def data = predata.collect{field -> - if (field == "") { - return null - } - def m = removeQuote.matcher(field) - if (m.find()) { - return m.replaceFirst('$1') - } else { - return field + while (header == null && (line = br.readLine()) != null) { + if (!line.startsWith("#")) { + header = splitRegex.split(line, -1).collect { field -> + def m = removeQuote.matcher(field) + m.find() ? m.replaceFirst('$1') : field } } - assert header.size() == data.size(): "Row $row should contain the same number as fields as the header" - - def dataMap = [header, data].transpose().collectEntries().findAll{it.value != null} - output.add(dataMap) + row++ + } + assert header != null : "CSV file should contain a header" + + while ((line = br.readLine()) != null) { + row++ + if (!line.startsWith("#")) { + def predata = splitRegex.split(line, -1) + def data = predata.collect { field -> + if (field == "") { + return null + } + def m = removeQuote.matcher(field) + if (m.find()) { + return m.replaceFirst('$1') + } else { + return field + } + } + assert header.size() == data.size() : "Row $row should contain the same number as fields as the header" + + def dataMap = [header, data].transpose().collectEntries().findAll { it.value != null } + output.add(dataMap) + } } } @@ -1711,10 +1706,25 @@ process publishFilesProc { ] .transpose() .collectMany{infile, outfile -> - if (infile.toString() != outfile.toString()) { + def infileString = infile.toString() + def outfileString = outfile.toString() + if (infileString != outfileString) { + /* Trailing slashes are removed from both the source and destination arguments. + From source arguments, this is useful when a source argument may have a trailing slash + and specify a symbolic link to a directory. Without removing the slash, cp will dereference + the symbolic link. + See https://www.gnu.org/software/coreutils/manual/html_node/Trailing-slashes.html#Trailing-slashes-1 + + For the destination path addding a trailing slash is a problem when publishing directories: + it requires the destination directory to exist. This fails because we only create the parent + directories first. + */ + def regexTrailingSlashes = ~/\/+$/ + def infileNoTrailingSlash = infileString - regexTrailingSlashes + def outfileNoTrailingSlash = outfileString - regexTrailingSlashes [ - "[ -d \"\$(dirname '${outfile.toString()}')\" ] || mkdir -p \"\$(dirname '${outfile.toString()}')\"", - "cp -r '${infile.toString()}' '${outfile.toString()}'" + "[ -d \"\$(dirname '${outfileNoTrailingSlash}')\" ] || mkdir -p \"\$(dirname '${outfileNoTrailingSlash}')\"", + "cp -a '${infileNoTrailingSlash}' '${outfileNoTrailingSlash}'" ] } else { // no need to copy if infile is the same as outfile @@ -3037,7 +3047,7 @@ meta = [ "config": processConfig(readJsonBlob('''{ "name" : "prot_singlesample", "namespace" : "workflows/prot", - "version" : "v4.0.3", + "version" : "v4.1.0", "authors" : [ { "name" : "Dries De Maeyer", @@ -3377,13 +3387,13 @@ meta = [ "runner" : "nextflow", "engine" : "native", "output" : "/workdir/root/repo/target/nextflow/workflows/prot/prot_singlesample", - "viash_version" : "0.9.4", - "git_commit" : "7bfad4ea12f87eca59213be3ab08deff67cc4206", + "viash_version" : "0.9.7", + "git_commit" : "a6499fddaa8553874585c747370f919f4d7b729c", "git_remote" : "https://github.com/openpipelines-bio/openpipeline" }, "package_config" : { "name" : "openpipeline", - "version" : "v4.0.3", + "version" : "v4.1.0", "summary" : "Best-practice workflows for single-cell multi-omics analyses.\n", "description" : "OpenPipelines are extensible single cell analysis pipelines for reproducible and large-scale single cell processing using [Viash](https://viash.io) and [Nextflow](https://www.nextflow.io/).\n\nIn terms of workflows, the following has been made available, but keep in mind that\nindividual tools and functionality can be executed as standalone components as well.\n\n * Demultiplexing: conversion of raw sequencing data to FASTQ objects.\n * Ingestion: Read mapping and generating a count matrix.\n * Single sample processing: cell filtering and doublet detection.\n * Multisample processing: Count transformation, normalization, QC metric calulations.\n * Integration: Clustering, integration and batch correction using single and multimodal methods.\n * Downstream analysis workflows\n", "info" : { @@ -3401,14 +3411,14 @@ meta = [ } ] }, - "viash_version" : "0.9.4", + "viash_version" : "0.9.7", "source" : "/workdir/root/repo/src", "target" : "/workdir/root/repo/target", "config_mods" : [ ".resources += {path: '/src/workflows/utils/labels.config', dest: 'nextflow_labels.config'}\n.runners[.type == 'nextflow'].config.script := 'includeConfig(\\"nextflow_labels.config\\")'", ".engines += { type: \\"native\\" }", ".engines[.type == 'docker'].target_registry := 'images.viash-hub.com'", - ".engines[.type == 'docker'].target_tag := 'v4.0.3'" + ".engines[.type == 'docker'].target_tag := 'v4.1.0'" ], "keywords" : [ "single-cell", diff --git a/target/dependencies/vsh/vsh/openpipeline/v4.0.3/nextflow/workflows/prot/prot_singlesample/nextflow.config b/target/dependencies/vsh/vsh/openpipeline/v4.1.0/nextflow/workflows/prot/prot_singlesample/nextflow.config similarity index 99% rename from target/dependencies/vsh/vsh/openpipeline/v4.0.3/nextflow/workflows/prot/prot_singlesample/nextflow.config rename to target/dependencies/vsh/vsh/openpipeline/v4.1.0/nextflow/workflows/prot/prot_singlesample/nextflow.config index fd3e866..1867fec 100644 --- a/target/dependencies/vsh/vsh/openpipeline/v4.0.3/nextflow/workflows/prot/prot_singlesample/nextflow.config +++ b/target/dependencies/vsh/vsh/openpipeline/v4.1.0/nextflow/workflows/prot/prot_singlesample/nextflow.config @@ -2,7 +2,7 @@ manifest { name = 'workflows/prot/prot_singlesample' mainScript = 'main.nf' nextflowVersion = '!>=20.12.1-edge' - version = 'v4.0.3' + version = 'v4.1.0' description = 'Processing unimodal single-sample CITE-seq data.' author = 'Dries De Maeyer, Robrecht Cannoodt, Dries Schaumont' } diff --git a/target/dependencies/vsh/vsh/openpipeline/v4.0.3/nextflow/workflows/rna/rna_multisample/nextflow_labels.config b/target/dependencies/vsh/vsh/openpipeline/v4.1.0/nextflow/workflows/prot/prot_singlesample/nextflow_labels.config similarity index 100% rename from target/dependencies/vsh/vsh/openpipeline/v4.0.3/nextflow/workflows/rna/rna_multisample/nextflow_labels.config rename to target/dependencies/vsh/vsh/openpipeline/v4.1.0/nextflow/workflows/prot/prot_singlesample/nextflow_labels.config diff --git a/target/dependencies/vsh/vsh/openpipeline/v4.0.3/nextflow/workflows/prot/prot_singlesample/nextflow_schema.json b/target/dependencies/vsh/vsh/openpipeline/v4.1.0/nextflow/workflows/prot/prot_singlesample/nextflow_schema.json similarity index 100% rename from target/dependencies/vsh/vsh/openpipeline/v4.0.3/nextflow/workflows/prot/prot_singlesample/nextflow_schema.json rename to target/dependencies/vsh/vsh/openpipeline/v4.1.0/nextflow/workflows/prot/prot_singlesample/nextflow_schema.json diff --git a/target/dependencies/vsh/vsh/openpipeline/v4.0.3/nextflow/workflows/qc/qc/utils/errorstrat_ignore.config b/target/dependencies/vsh/vsh/openpipeline/v4.1.0/nextflow/workflows/prot/prot_singlesample/utils/errorstrat_ignore.config similarity index 100% rename from target/dependencies/vsh/vsh/openpipeline/v4.0.3/nextflow/workflows/qc/qc/utils/errorstrat_ignore.config rename to target/dependencies/vsh/vsh/openpipeline/v4.1.0/nextflow/workflows/prot/prot_singlesample/utils/errorstrat_ignore.config diff --git a/target/dependencies/vsh/vsh/openpipeline/v4.0.3/nextflow/workflows/qc/qc/utils/integration_tests.config b/target/dependencies/vsh/vsh/openpipeline/v4.1.0/nextflow/workflows/prot/prot_singlesample/utils/integration_tests.config similarity index 100% rename from target/dependencies/vsh/vsh/openpipeline/v4.0.3/nextflow/workflows/qc/qc/utils/integration_tests.config rename to target/dependencies/vsh/vsh/openpipeline/v4.1.0/nextflow/workflows/prot/prot_singlesample/utils/integration_tests.config diff --git a/target/dependencies/vsh/vsh/openpipeline/v4.0.3/nextflow/workflows/qc/qc/utils/labels.config b/target/dependencies/vsh/vsh/openpipeline/v4.1.0/nextflow/workflows/prot/prot_singlesample/utils/labels.config similarity index 100% rename from target/dependencies/vsh/vsh/openpipeline/v4.0.3/nextflow/workflows/qc/qc/utils/labels.config rename to target/dependencies/vsh/vsh/openpipeline/v4.1.0/nextflow/workflows/prot/prot_singlesample/utils/labels.config diff --git a/target/dependencies/vsh/vsh/openpipeline/v4.0.3/nextflow/workflows/qc/qc/utils/labels_ci.config b/target/dependencies/vsh/vsh/openpipeline/v4.1.0/nextflow/workflows/prot/prot_singlesample/utils/labels_ci.config similarity index 100% rename from target/dependencies/vsh/vsh/openpipeline/v4.0.3/nextflow/workflows/qc/qc/utils/labels_ci.config rename to target/dependencies/vsh/vsh/openpipeline/v4.1.0/nextflow/workflows/prot/prot_singlesample/utils/labels_ci.config diff --git a/target/dependencies/vsh/vsh/openpipeline/v4.0.3/nextflow/workflows/qc/qc/.config.vsh.yaml b/target/dependencies/vsh/vsh/openpipeline/v4.1.0/nextflow/workflows/qc/qc/.config.vsh.yaml similarity index 98% rename from target/dependencies/vsh/vsh/openpipeline/v4.0.3/nextflow/workflows/qc/qc/.config.vsh.yaml rename to target/dependencies/vsh/vsh/openpipeline/v4.1.0/nextflow/workflows/qc/qc/.config.vsh.yaml index 9cebe4b..422deff 100644 --- a/target/dependencies/vsh/vsh/openpipeline/v4.0.3/nextflow/workflows/qc/qc/.config.vsh.yaml +++ b/target/dependencies/vsh/vsh/openpipeline/v4.1.0/nextflow/workflows/qc/qc/.config.vsh.yaml @@ -1,6 +1,6 @@ name: "qc" namespace: "workflows/qc" -version: "v4.0.3" +version: "v4.1.0" authors: - name: "Dries Schaumont" roles: @@ -363,15 +363,15 @@ build_info: engine: "native" output: "target/nextflow/workflows/qc/qc" executable: "target/nextflow/workflows/qc/qc/main.nf" - viash_version: "0.9.4" - git_commit: "7bfad4ea12f87eca59213be3ab08deff67cc4206" + viash_version: "0.9.7" + git_commit: "a6499fddaa8553874585c747370f919f4d7b729c" git_remote: "https://github.com/openpipelines-bio/openpipeline" dependencies: - "target/nextflow/metadata/grep_annotation_column" - "target/nextflow/qc/calculate_qc_metrics" package_config: name: "openpipeline" - version: "v4.0.3" + version: "v4.1.0" summary: "Best-practice workflows for single-cell multi-omics analyses.\n" description: "OpenPipelines are extensible single cell analysis pipelines for reproducible\ \ and large-scale single cell processing using [Viash](https://viash.io) and [Nextflow](https://www.nextflow.io/).\n\ @@ -392,7 +392,7 @@ package_config: - path: "src/workflows/utils/labels_ci.config" description: "Adds the correct memory and CPU labels when running on the Viash\ \ Hub CI." - viash_version: "0.9.4" + viash_version: "0.9.7" source: "src" target: "target" config_mods: @@ -401,7 +401,7 @@ package_config: )'" - ".engines += { type: \"native\" }" - ".engines[.type == 'docker'].target_registry := 'images.viash-hub.com'" - - ".engines[.type == 'docker'].target_tag := 'v4.0.3'" + - ".engines[.type == 'docker'].target_tag := 'v4.1.0'" keywords: - "single-cell" - "multimodal" diff --git a/target/dependencies/vsh/vsh/openpipeline/v4.0.3/nextflow/workflows/qc/qc/main.nf b/target/dependencies/vsh/vsh/openpipeline/v4.1.0/nextflow/workflows/qc/qc/main.nf similarity index 98% rename from target/dependencies/vsh/vsh/openpipeline/v4.0.3/nextflow/workflows/qc/qc/main.nf rename to target/dependencies/vsh/vsh/openpipeline/v4.1.0/nextflow/workflows/qc/qc/main.nf index 6df8306..f418bcd 100644 --- a/target/dependencies/vsh/vsh/openpipeline/v4.0.3/nextflow/workflows/qc/qc/main.nf +++ b/target/dependencies/vsh/vsh/openpipeline/v4.1.0/nextflow/workflows/qc/qc/main.nf @@ -1,6 +1,6 @@ -// qc v4.0.3 +// qc v4.1.0 // -// This wrapper script is auto-generated by viash 0.9.4 and is thus a derivative +// This wrapper script is auto-generated by viash 0.9.7 and is thus a derivative // work thereof. This software comes with ABSOLUTELY NO WARRANTY from Data // Intuitive. // @@ -1353,47 +1353,42 @@ def readCsv(file_path) { def splitRegex = java.util.regex.Pattern.compile(''',(?=(?:[^"]*"[^"]*")*[^"]*$)''') def removeQuote = java.util.regex.Pattern.compile('''"(.*)"''') - def br = java.nio.file.Files.newBufferedReader(inputFile) + java.nio.file.Files.newBufferedReader(inputFile).withCloseable { br -> + def row = 0 + def header = null + def line - def row = -1 - def header = null - while (br.ready() && header == null) { - def line = br.readLine() - row++ - if (!line.startsWith("#")) { - header = splitRegex.split(line, -1).collect{field -> - m = removeQuote.matcher(field) - m.find() ? m.replaceFirst('$1') : field - } - } - } - assert header != null: "CSV file should contain a header" - - while (br.ready()) { - def line = br.readLine() - row++ - if (line == null) { - br.close() - break - } - - if (!line.startsWith("#")) { - def predata = splitRegex.split(line, -1) - def data = predata.collect{field -> - if (field == "") { - return null - } - def m = removeQuote.matcher(field) - if (m.find()) { - return m.replaceFirst('$1') - } else { - return field + while (header == null && (line = br.readLine()) != null) { + if (!line.startsWith("#")) { + header = splitRegex.split(line, -1).collect { field -> + def m = removeQuote.matcher(field) + m.find() ? m.replaceFirst('$1') : field } } - assert header.size() == data.size(): "Row $row should contain the same number as fields as the header" - - def dataMap = [header, data].transpose().collectEntries().findAll{it.value != null} - output.add(dataMap) + row++ + } + assert header != null : "CSV file should contain a header" + + while ((line = br.readLine()) != null) { + row++ + if (!line.startsWith("#")) { + def predata = splitRegex.split(line, -1) + def data = predata.collect { field -> + if (field == "") { + return null + } + def m = removeQuote.matcher(field) + if (m.find()) { + return m.replaceFirst('$1') + } else { + return field + } + } + assert header.size() == data.size() : "Row $row should contain the same number as fields as the header" + + def dataMap = [header, data].transpose().collectEntries().findAll { it.value != null } + output.add(dataMap) + } } } @@ -1709,10 +1704,25 @@ process publishFilesProc { ] .transpose() .collectMany{infile, outfile -> - if (infile.toString() != outfile.toString()) { + def infileString = infile.toString() + def outfileString = outfile.toString() + if (infileString != outfileString) { + /* Trailing slashes are removed from both the source and destination arguments. + From source arguments, this is useful when a source argument may have a trailing slash + and specify a symbolic link to a directory. Without removing the slash, cp will dereference + the symbolic link. + See https://www.gnu.org/software/coreutils/manual/html_node/Trailing-slashes.html#Trailing-slashes-1 + + For the destination path addding a trailing slash is a problem when publishing directories: + it requires the destination directory to exist. This fails because we only create the parent + directories first. + */ + def regexTrailingSlashes = ~/\/+$/ + def infileNoTrailingSlash = infileString - regexTrailingSlashes + def outfileNoTrailingSlash = outfileString - regexTrailingSlashes [ - "[ -d \"\$(dirname '${outfile.toString()}')\" ] || mkdir -p \"\$(dirname '${outfile.toString()}')\"", - "cp -r '${infile.toString()}' '${outfile.toString()}'" + "[ -d \"\$(dirname '${outfileNoTrailingSlash}')\" ] || mkdir -p \"\$(dirname '${outfileNoTrailingSlash}')\"", + "cp -a '${infileNoTrailingSlash}' '${outfileNoTrailingSlash}'" ] } else { // no need to copy if infile is the same as outfile @@ -3035,7 +3045,7 @@ meta = [ "config": processConfig(readJsonBlob('''{ "name" : "qc", "namespace" : "workflows/qc", - "version" : "v4.0.3", + "version" : "v4.1.0", "authors" : [ { "name" : "Dries Schaumont", @@ -3470,13 +3480,13 @@ meta = [ "runner" : "nextflow", "engine" : "native", "output" : "/workdir/root/repo/target/nextflow/workflows/qc/qc", - "viash_version" : "0.9.4", - "git_commit" : "7bfad4ea12f87eca59213be3ab08deff67cc4206", + "viash_version" : "0.9.7", + "git_commit" : "a6499fddaa8553874585c747370f919f4d7b729c", "git_remote" : "https://github.com/openpipelines-bio/openpipeline" }, "package_config" : { "name" : "openpipeline", - "version" : "v4.0.3", + "version" : "v4.1.0", "summary" : "Best-practice workflows for single-cell multi-omics analyses.\n", "description" : "OpenPipelines are extensible single cell analysis pipelines for reproducible and large-scale single cell processing using [Viash](https://viash.io) and [Nextflow](https://www.nextflow.io/).\n\nIn terms of workflows, the following has been made available, but keep in mind that\nindividual tools and functionality can be executed as standalone components as well.\n\n * Demultiplexing: conversion of raw sequencing data to FASTQ objects.\n * Ingestion: Read mapping and generating a count matrix.\n * Single sample processing: cell filtering and doublet detection.\n * Multisample processing: Count transformation, normalization, QC metric calulations.\n * Integration: Clustering, integration and batch correction using single and multimodal methods.\n * Downstream analysis workflows\n", "info" : { @@ -3494,14 +3504,14 @@ meta = [ } ] }, - "viash_version" : "0.9.4", + "viash_version" : "0.9.7", "source" : "/workdir/root/repo/src", "target" : "/workdir/root/repo/target", "config_mods" : [ ".resources += {path: '/src/workflows/utils/labels.config', dest: 'nextflow_labels.config'}\n.runners[.type == 'nextflow'].config.script := 'includeConfig(\\"nextflow_labels.config\\")'", ".engines += { type: \\"native\\" }", ".engines[.type == 'docker'].target_registry := 'images.viash-hub.com'", - ".engines[.type == 'docker'].target_tag := 'v4.0.3'" + ".engines[.type == 'docker'].target_tag := 'v4.1.0'" ], "keywords" : [ "single-cell", diff --git a/target/dependencies/vsh/vsh/openpipeline/v4.0.3/nextflow/workflows/qc/qc/nextflow.config b/target/dependencies/vsh/vsh/openpipeline/v4.1.0/nextflow/workflows/qc/qc/nextflow.config similarity index 99% rename from target/dependencies/vsh/vsh/openpipeline/v4.0.3/nextflow/workflows/qc/qc/nextflow.config rename to target/dependencies/vsh/vsh/openpipeline/v4.1.0/nextflow/workflows/qc/qc/nextflow.config index 5659ff2..8ed87d0 100644 --- a/target/dependencies/vsh/vsh/openpipeline/v4.0.3/nextflow/workflows/qc/qc/nextflow.config +++ b/target/dependencies/vsh/vsh/openpipeline/v4.1.0/nextflow/workflows/qc/qc/nextflow.config @@ -2,7 +2,7 @@ manifest { name = 'workflows/qc/qc' mainScript = 'main.nf' nextflowVersion = '!>=20.12.1-edge' - version = 'v4.0.3' + version = 'v4.1.0' description = 'A pipeline to add basic qc statistics to a MuData ' author = 'Dries Schaumont' } diff --git a/target/dependencies/vsh/vsh/openpipeline/v4.0.3/nextflow/workflows/rna/rna_singlesample/nextflow_labels.config b/target/dependencies/vsh/vsh/openpipeline/v4.1.0/nextflow/workflows/qc/qc/nextflow_labels.config similarity index 100% rename from target/dependencies/vsh/vsh/openpipeline/v4.0.3/nextflow/workflows/rna/rna_singlesample/nextflow_labels.config rename to target/dependencies/vsh/vsh/openpipeline/v4.1.0/nextflow/workflows/qc/qc/nextflow_labels.config diff --git a/target/dependencies/vsh/vsh/openpipeline/v4.0.3/nextflow/workflows/qc/qc/nextflow_schema.json b/target/dependencies/vsh/vsh/openpipeline/v4.1.0/nextflow/workflows/qc/qc/nextflow_schema.json similarity index 100% rename from target/dependencies/vsh/vsh/openpipeline/v4.0.3/nextflow/workflows/qc/qc/nextflow_schema.json rename to target/dependencies/vsh/vsh/openpipeline/v4.1.0/nextflow/workflows/qc/qc/nextflow_schema.json diff --git a/target/dependencies/vsh/vsh/openpipeline/v4.0.3/nextflow/workflows/rna/rna_multisample/utils/errorstrat_ignore.config b/target/dependencies/vsh/vsh/openpipeline/v4.1.0/nextflow/workflows/qc/qc/utils/errorstrat_ignore.config similarity index 100% rename from target/dependencies/vsh/vsh/openpipeline/v4.0.3/nextflow/workflows/rna/rna_multisample/utils/errorstrat_ignore.config rename to target/dependencies/vsh/vsh/openpipeline/v4.1.0/nextflow/workflows/qc/qc/utils/errorstrat_ignore.config diff --git a/target/dependencies/vsh/vsh/openpipeline/v4.0.3/nextflow/workflows/rna/rna_multisample/utils/integration_tests.config b/target/dependencies/vsh/vsh/openpipeline/v4.1.0/nextflow/workflows/qc/qc/utils/integration_tests.config similarity index 100% rename from target/dependencies/vsh/vsh/openpipeline/v4.0.3/nextflow/workflows/rna/rna_multisample/utils/integration_tests.config rename to target/dependencies/vsh/vsh/openpipeline/v4.1.0/nextflow/workflows/qc/qc/utils/integration_tests.config diff --git a/target/dependencies/vsh/vsh/openpipeline/v4.0.3/nextflow/workflows/rna/rna_multisample/utils/labels.config b/target/dependencies/vsh/vsh/openpipeline/v4.1.0/nextflow/workflows/qc/qc/utils/labels.config similarity index 100% rename from target/dependencies/vsh/vsh/openpipeline/v4.0.3/nextflow/workflows/rna/rna_multisample/utils/labels.config rename to target/dependencies/vsh/vsh/openpipeline/v4.1.0/nextflow/workflows/qc/qc/utils/labels.config diff --git a/target/dependencies/vsh/vsh/openpipeline/v4.0.3/nextflow/workflows/rna/rna_multisample/utils/labels_ci.config b/target/dependencies/vsh/vsh/openpipeline/v4.1.0/nextflow/workflows/qc/qc/utils/labels_ci.config similarity index 100% rename from target/dependencies/vsh/vsh/openpipeline/v4.0.3/nextflow/workflows/rna/rna_multisample/utils/labels_ci.config rename to target/dependencies/vsh/vsh/openpipeline/v4.1.0/nextflow/workflows/qc/qc/utils/labels_ci.config diff --git a/target/dependencies/vsh/vsh/openpipeline/v4.0.3/nextflow/workflows/rna/rna_multisample/.config.vsh.yaml b/target/dependencies/vsh/vsh/openpipeline/v4.1.0/nextflow/workflows/rna/rna_multisample/.config.vsh.yaml similarity index 92% rename from target/dependencies/vsh/vsh/openpipeline/v4.0.3/nextflow/workflows/rna/rna_multisample/.config.vsh.yaml rename to target/dependencies/vsh/vsh/openpipeline/v4.1.0/nextflow/workflows/rna/rna_multisample/.config.vsh.yaml index 090a424..b42f01b 100644 --- a/target/dependencies/vsh/vsh/openpipeline/v4.0.3/nextflow/workflows/rna/rna_multisample/.config.vsh.yaml +++ b/target/dependencies/vsh/vsh/openpipeline/v4.1.0/nextflow/workflows/rna/rna_multisample/.config.vsh.yaml @@ -1,6 +1,6 @@ name: "rna_multisample" namespace: "workflows/rna" -version: "v4.0.3" +version: "v4.1.0" authors: - name: "Dries De Maeyer" roles: @@ -166,6 +166,36 @@ argument_groups: direction: "input" multiple: false multiple_sep: ";" + - type: "string" + name: "--highly_variable_features_var_name_filter_to_exclude" + description: "List of feature names to exclude from HVG calculation.\nCommon use\ + \ cases include excluding mitochondrial genes, ribosomal genes,\nor cell cycle\ + \ genes that may dominate variance but are not biologically\ninformative for\ + \ clustering. Features in this list will be excluded from\nHVG selection but\ + \ remain in the output data.\n" + info: null + example: + - "MT-CO1" + - "MT-CO2" + - "MT-ND1" + required: false + direction: "input" + multiple: true + multiple_sep: ";" + - type: "string" + name: "--highly_variable_features_features_to_exclude" + description: "User-defined list of feature names to exclude from HVG calculation.\ + \ \nThese features will be excluded from HVG selection but will remain in the\ + \ output data.\n" + info: null + example: + - "MT-CO1" + - "MT-CO2" + - "MT-ND1" + required: false + direction: "input" + multiple: true + multiple_sep: ";" - name: "QC metrics calculation options" arguments: - type: "string" @@ -421,8 +451,8 @@ build_info: engine: "native" output: "target/nextflow/workflows/rna/rna_multisample" executable: "target/nextflow/workflows/rna/rna_multisample/main.nf" - viash_version: "0.9.4" - git_commit: "7bfad4ea12f87eca59213be3ab08deff67cc4206" + viash_version: "0.9.7" + git_commit: "a6499fddaa8553874585c747370f919f4d7b729c" git_remote: "https://github.com/openpipelines-bio/openpipeline" dependencies: - "target/nextflow/feature_annotation/highly_variable_features_scanpy" @@ -432,7 +462,7 @@ build_info: - "target/_private/nextflow/workflows/rna/log_normalize" package_config: name: "openpipeline" - version: "v4.0.3" + version: "v4.1.0" summary: "Best-practice workflows for single-cell multi-omics analyses.\n" description: "OpenPipelines are extensible single cell analysis pipelines for reproducible\ \ and large-scale single cell processing using [Viash](https://viash.io) and [Nextflow](https://www.nextflow.io/).\n\ @@ -453,7 +483,7 @@ package_config: - path: "src/workflows/utils/labels_ci.config" description: "Adds the correct memory and CPU labels when running on the Viash\ \ Hub CI." - viash_version: "0.9.4" + viash_version: "0.9.7" source: "src" target: "target" config_mods: @@ -462,7 +492,7 @@ package_config: )'" - ".engines += { type: \"native\" }" - ".engines[.type == 'docker'].target_registry := 'images.viash-hub.com'" - - ".engines[.type == 'docker'].target_tag := 'v4.0.3'" + - ".engines[.type == 'docker'].target_tag := 'v4.1.0'" keywords: - "single-cell" - "multimodal" diff --git a/target/dependencies/vsh/vsh/openpipeline/v4.0.3/nextflow/workflows/rna/rna_multisample/main.nf b/target/dependencies/vsh/vsh/openpipeline/v4.1.0/nextflow/workflows/rna/rna_multisample/main.nf similarity index 97% rename from target/dependencies/vsh/vsh/openpipeline/v4.0.3/nextflow/workflows/rna/rna_multisample/main.nf rename to target/dependencies/vsh/vsh/openpipeline/v4.1.0/nextflow/workflows/rna/rna_multisample/main.nf index 4918a02..ca938e8 100644 --- a/target/dependencies/vsh/vsh/openpipeline/v4.0.3/nextflow/workflows/rna/rna_multisample/main.nf +++ b/target/dependencies/vsh/vsh/openpipeline/v4.1.0/nextflow/workflows/rna/rna_multisample/main.nf @@ -1,6 +1,6 @@ -// rna_multisample v4.0.3 +// rna_multisample v4.1.0 // -// This wrapper script is auto-generated by viash 0.9.4 and is thus a derivative +// This wrapper script is auto-generated by viash 0.9.7 and is thus a derivative // work thereof. This software comes with ABSOLUTELY NO WARRANTY from Data // Intuitive. // @@ -1355,47 +1355,42 @@ def readCsv(file_path) { def splitRegex = java.util.regex.Pattern.compile(''',(?=(?:[^"]*"[^"]*")*[^"]*$)''') def removeQuote = java.util.regex.Pattern.compile('''"(.*)"''') - def br = java.nio.file.Files.newBufferedReader(inputFile) + java.nio.file.Files.newBufferedReader(inputFile).withCloseable { br -> + def row = 0 + def header = null + def line - def row = -1 - def header = null - while (br.ready() && header == null) { - def line = br.readLine() - row++ - if (!line.startsWith("#")) { - header = splitRegex.split(line, -1).collect{field -> - m = removeQuote.matcher(field) - m.find() ? m.replaceFirst('$1') : field - } - } - } - assert header != null: "CSV file should contain a header" - - while (br.ready()) { - def line = br.readLine() - row++ - if (line == null) { - br.close() - break - } - - if (!line.startsWith("#")) { - def predata = splitRegex.split(line, -1) - def data = predata.collect{field -> - if (field == "") { - return null - } - def m = removeQuote.matcher(field) - if (m.find()) { - return m.replaceFirst('$1') - } else { - return field + while (header == null && (line = br.readLine()) != null) { + if (!line.startsWith("#")) { + header = splitRegex.split(line, -1).collect { field -> + def m = removeQuote.matcher(field) + m.find() ? m.replaceFirst('$1') : field } } - assert header.size() == data.size(): "Row $row should contain the same number as fields as the header" - - def dataMap = [header, data].transpose().collectEntries().findAll{it.value != null} - output.add(dataMap) + row++ + } + assert header != null : "CSV file should contain a header" + + while ((line = br.readLine()) != null) { + row++ + if (!line.startsWith("#")) { + def predata = splitRegex.split(line, -1) + def data = predata.collect { field -> + if (field == "") { + return null + } + def m = removeQuote.matcher(field) + if (m.find()) { + return m.replaceFirst('$1') + } else { + return field + } + } + assert header.size() == data.size() : "Row $row should contain the same number as fields as the header" + + def dataMap = [header, data].transpose().collectEntries().findAll { it.value != null } + output.add(dataMap) + } } } @@ -1711,10 +1706,25 @@ process publishFilesProc { ] .transpose() .collectMany{infile, outfile -> - if (infile.toString() != outfile.toString()) { + def infileString = infile.toString() + def outfileString = outfile.toString() + if (infileString != outfileString) { + /* Trailing slashes are removed from both the source and destination arguments. + From source arguments, this is useful when a source argument may have a trailing slash + and specify a symbolic link to a directory. Without removing the slash, cp will dereference + the symbolic link. + See https://www.gnu.org/software/coreutils/manual/html_node/Trailing-slashes.html#Trailing-slashes-1 + + For the destination path addding a trailing slash is a problem when publishing directories: + it requires the destination directory to exist. This fails because we only create the parent + directories first. + */ + def regexTrailingSlashes = ~/\/+$/ + def infileNoTrailingSlash = infileString - regexTrailingSlashes + def outfileNoTrailingSlash = outfileString - regexTrailingSlashes [ - "[ -d \"\$(dirname '${outfile.toString()}')\" ] || mkdir -p \"\$(dirname '${outfile.toString()}')\"", - "cp -r '${infile.toString()}' '${outfile.toString()}'" + "[ -d \"\$(dirname '${outfileNoTrailingSlash}')\" ] || mkdir -p \"\$(dirname '${outfileNoTrailingSlash}')\"", + "cp -a '${infileNoTrailingSlash}' '${outfileNoTrailingSlash}'" ] } else { // no need to copy if infile is the same as outfile @@ -3037,7 +3047,7 @@ meta = [ "config": processConfig(readJsonBlob('''{ "name" : "rna_multisample", "namespace" : "workflows/rna", - "version" : "v4.0.3", + "version" : "v4.1.0", "authors" : [ { "name" : "Dries De Maeyer", @@ -3247,6 +3257,34 @@ meta = [ "direction" : "input", "multiple" : false, "multiple_sep" : ";" + }, + { + "type" : "string", + "name" : "--highly_variable_features_var_name_filter_to_exclude", + "description" : "List of feature names to exclude from HVG calculation.\nCommon use cases include excluding mitochondrial genes, ribosomal genes,\nor cell cycle genes that may dominate variance but are not biologically\ninformative for clustering. Features in this list will be excluded from\nHVG selection but remain in the output data.\n", + "example" : [ + "MT-CO1", + "MT-CO2", + "MT-ND1" + ], + "required" : false, + "direction" : "input", + "multiple" : true, + "multiple_sep" : ";" + }, + { + "type" : "string", + "name" : "--highly_variable_features_features_to_exclude", + "description" : "User-defined list of feature names to exclude from HVG calculation. \nThese features will be excluded from HVG selection but will remain in the output data.\n", + "example" : [ + "MT-CO1", + "MT-CO2", + "MT-ND1" + ], + "required" : false, + "direction" : "input", + "multiple" : true, + "multiple_sep" : ";" } ] }, @@ -3556,13 +3594,13 @@ meta = [ "runner" : "nextflow", "engine" : "native", "output" : "/workdir/root/repo/target/nextflow/workflows/rna/rna_multisample", - "viash_version" : "0.9.4", - "git_commit" : "7bfad4ea12f87eca59213be3ab08deff67cc4206", + "viash_version" : "0.9.7", + "git_commit" : "a6499fddaa8553874585c747370f919f4d7b729c", "git_remote" : "https://github.com/openpipelines-bio/openpipeline" }, "package_config" : { "name" : "openpipeline", - "version" : "v4.0.3", + "version" : "v4.1.0", "summary" : "Best-practice workflows for single-cell multi-omics analyses.\n", "description" : "OpenPipelines are extensible single cell analysis pipelines for reproducible and large-scale single cell processing using [Viash](https://viash.io) and [Nextflow](https://www.nextflow.io/).\n\nIn terms of workflows, the following has been made available, but keep in mind that\nindividual tools and functionality can be executed as standalone components as well.\n\n * Demultiplexing: conversion of raw sequencing data to FASTQ objects.\n * Ingestion: Read mapping and generating a count matrix.\n * Single sample processing: cell filtering and doublet detection.\n * Multisample processing: Count transformation, normalization, QC metric calulations.\n * Integration: Clustering, integration and batch correction using single and multimodal methods.\n * Downstream analysis workflows\n", "info" : { @@ -3580,14 +3618,14 @@ meta = [ } ] }, - "viash_version" : "0.9.4", + "viash_version" : "0.9.7", "source" : "/workdir/root/repo/src", "target" : "/workdir/root/repo/target", "config_mods" : [ ".resources += {path: '/src/workflows/utils/labels.config', dest: 'nextflow_labels.config'}\n.runners[.type == 'nextflow'].config.script := 'includeConfig(\\"nextflow_labels.config\\")'", ".engines += { type: \\"native\\" }", ".engines[.type == 'docker'].target_registry := 'images.viash-hub.com'", - ".engines[.type == 'docker'].target_tag := 'v4.0.3'" + ".engines[.type == 'docker'].target_tag := 'v4.1.0'" ], "keywords" : [ "single-cell", @@ -3661,7 +3699,8 @@ workflow run_wf { "var_name_filter": state.highly_variable_features_var_output, "n_top_features": state.highly_variable_features_n_top_features, "flavor": state.highly_variable_features_flavor, - "obs_batch_key": state.highly_variable_features_obs_batch_key + "obs_batch_key": state.highly_variable_features_obs_batch_key, + "features_to_exclude": state.highly_variable_features_features_to_exclude ] }, toState: ["input": "output"], diff --git a/target/dependencies/vsh/vsh/openpipeline/v4.0.3/nextflow/workflows/rna/rna_multisample/nextflow.config b/target/dependencies/vsh/vsh/openpipeline/v4.1.0/nextflow/workflows/rna/rna_multisample/nextflow.config similarity index 99% rename from target/dependencies/vsh/vsh/openpipeline/v4.0.3/nextflow/workflows/rna/rna_multisample/nextflow.config rename to target/dependencies/vsh/vsh/openpipeline/v4.1.0/nextflow/workflows/rna/rna_multisample/nextflow.config index 4ea7c61..a5bb83c 100644 --- a/target/dependencies/vsh/vsh/openpipeline/v4.0.3/nextflow/workflows/rna/rna_multisample/nextflow.config +++ b/target/dependencies/vsh/vsh/openpipeline/v4.1.0/nextflow/workflows/rna/rna_multisample/nextflow.config @@ -2,7 +2,7 @@ manifest { name = 'workflows/rna/rna_multisample' mainScript = 'main.nf' nextflowVersion = '!>=20.12.1-edge' - version = 'v4.0.3' + version = 'v4.1.0' description = 'Processing unimodal multi-sample RNA transcriptomics data.' author = 'Dries De Maeyer, Robrecht Cannoodt, Dries Schaumont' } diff --git a/target/dependencies/vsh/vsh/openpipeline/v4.0.3/nextflow/workflows/rna/rna_singlesample/utils/labels.config b/target/dependencies/vsh/vsh/openpipeline/v4.1.0/nextflow/workflows/rna/rna_multisample/nextflow_labels.config similarity index 100% rename from target/dependencies/vsh/vsh/openpipeline/v4.0.3/nextflow/workflows/rna/rna_singlesample/utils/labels.config rename to target/dependencies/vsh/vsh/openpipeline/v4.1.0/nextflow/workflows/rna/rna_multisample/nextflow_labels.config diff --git a/target/dependencies/vsh/vsh/openpipeline/v4.0.3/nextflow/workflows/rna/rna_multisample/nextflow_schema.json b/target/dependencies/vsh/vsh/openpipeline/v4.1.0/nextflow/workflows/rna/rna_multisample/nextflow_schema.json similarity index 90% rename from target/dependencies/vsh/vsh/openpipeline/v4.0.3/nextflow/workflows/rna/rna_multisample/nextflow_schema.json rename to target/dependencies/vsh/vsh/openpipeline/v4.1.0/nextflow/workflows/rna/rna_multisample/nextflow_schema.json index 8d790f5..cc3be09 100644 --- a/target/dependencies/vsh/vsh/openpipeline/v4.0.3/nextflow/workflows/rna/rna_multisample/nextflow_schema.json +++ b/target/dependencies/vsh/vsh/openpipeline/v4.1.0/nextflow/workflows/rna/rna_multisample/nextflow_schema.json @@ -80,6 +80,22 @@ "type": "integer", "description": "Number of highly-variable features to keep", "help_text": "Type: `integer`, multiple: `False`. " + }, + "highly_variable_features_var_name_filter_to_exclude": { + "type": "array", + "items": { + "type": "string" + }, + "description": "List of feature names to exclude from HVG calculation.\nCommon use cases include excluding mitochondrial genes, ribosomal genes,\nor cell cycle genes that may dominate variance but are not biologically\ninformative for clustering", + "help_text": "Type: `string`, multiple: `True`, example: `[\"MT-CO1\";\"MT-CO2\";\"MT-ND1\"]`. " + }, + "highly_variable_features_features_to_exclude": { + "type": "array", + "items": { + "type": "string" + }, + "description": "User-defined list of feature names to exclude from HVG calculation", + "help_text": "Type: `string`, multiple: `True`, example: `[\"MT-CO1\";\"MT-CO2\";\"MT-ND1\"]`. " } } }, diff --git a/target/dependencies/vsh/vsh/openpipeline/v4.0.3/nextflow/workflows/rna/rna_singlesample/utils/errorstrat_ignore.config b/target/dependencies/vsh/vsh/openpipeline/v4.1.0/nextflow/workflows/rna/rna_multisample/utils/errorstrat_ignore.config similarity index 100% rename from target/dependencies/vsh/vsh/openpipeline/v4.0.3/nextflow/workflows/rna/rna_singlesample/utils/errorstrat_ignore.config rename to target/dependencies/vsh/vsh/openpipeline/v4.1.0/nextflow/workflows/rna/rna_multisample/utils/errorstrat_ignore.config diff --git a/target/dependencies/vsh/vsh/openpipeline/v4.0.3/nextflow/workflows/rna/rna_singlesample/utils/integration_tests.config b/target/dependencies/vsh/vsh/openpipeline/v4.1.0/nextflow/workflows/rna/rna_multisample/utils/integration_tests.config similarity index 100% rename from target/dependencies/vsh/vsh/openpipeline/v4.0.3/nextflow/workflows/rna/rna_singlesample/utils/integration_tests.config rename to target/dependencies/vsh/vsh/openpipeline/v4.1.0/nextflow/workflows/rna/rna_multisample/utils/integration_tests.config diff --git a/target/dependencies/vsh/vsh/openpipeline/v4.1.0/nextflow/workflows/rna/rna_multisample/utils/labels.config b/target/dependencies/vsh/vsh/openpipeline/v4.1.0/nextflow/workflows/rna/rna_multisample/utils/labels.config new file mode 100644 index 0000000..94570ec --- /dev/null +++ b/target/dependencies/vsh/vsh/openpipeline/v4.1.0/nextflow/workflows/rna/rna_multisample/utils/labels.config @@ -0,0 +1,48 @@ +process { + // Default resources for components that hardly do any processing + memory = { 2.GB * task.attempt } + cpus = 1 + + // Retry for exit codes that have something to do with memory issues + errorStrategy = { task.exitStatus in 137..140 ? 'retry' : 'terminate' } + maxRetries = 3 + + // The memory a task is assinged increases with each attempt + // uncomment the line below and adjust the value to set a global upper limit on the memory. + // resourceLimits = [ memory: 240.Gb ] + + // CPU resources + withLabel: singlecpu { cpus = 1 } + withLabel: lowcpu { cpus = 4 } + withLabel: midcpu { cpus = 10 } + withLabel: highcpu { cpus = 20 } + + // Memory resources + withLabel: lowmem { memory = { task?.resourceLimits?.memory && task?.maxRetries && task.attempt >= task.maxRetries ? task.resourceLimits.memory : 4.GB * task.attempt } } + withLabel: midmem { memory = { task?.resourceLimits?.memory && task?.maxRetries && task.attempt >= task.maxRetries ? task.resourceLimits.memory : 25.GB * task.attempt } } + withLabel: highmem { memory = { task?.resourceLimits?.memory && task?.maxRetries && task.attempt >= task.maxRetries ? task.resourceLimits.memory : 50.GB * task.attempt } } + withLabel: veryhighmem { memory = { task?.resourceLimits?.memory && task?.maxRetries && task.attempt >= task.maxRetries ? task.resourceLimits.memory : 75.GB * task.attempt } } + + // Disk space + withLabel: lowdisk { + disk = {process.disk ? process.disk : null} + } + withLabel: middisk { + disk = {process.disk ? process.disk : null} + } + withLabel: highdisk { + disk = {process.disk ? process.disk : null} + } + withLabel: veryhighdisk { + disk = {process.disk ? process.disk : null} + } + + // NOTE: The above labels intentionally do not have an effect by default. + // The user should set the disk space requirements by adding the following + // to the compute environment: + // + // withLabel: lowdisk { disk = { 20.GB * task.attempt } } + // withLabel: middisk { disk = { 100.GB * task.attempt } } + // withLabel: highdisk { disk = { 200.GB * task.attempt } } + // withLabel: veryhighdisk { disk = { 500.GB * task.attempt } } +} diff --git a/target/dependencies/vsh/vsh/openpipeline/v4.0.3/nextflow/workflows/rna/rna_singlesample/utils/labels_ci.config b/target/dependencies/vsh/vsh/openpipeline/v4.1.0/nextflow/workflows/rna/rna_multisample/utils/labels_ci.config similarity index 100% rename from target/dependencies/vsh/vsh/openpipeline/v4.0.3/nextflow/workflows/rna/rna_singlesample/utils/labels_ci.config rename to target/dependencies/vsh/vsh/openpipeline/v4.1.0/nextflow/workflows/rna/rna_multisample/utils/labels_ci.config diff --git a/target/dependencies/vsh/vsh/openpipeline/v4.0.3/nextflow/workflows/rna/rna_singlesample/.config.vsh.yaml b/target/dependencies/vsh/vsh/openpipeline/v4.1.0/nextflow/workflows/rna/rna_singlesample/.config.vsh.yaml similarity index 98% rename from target/dependencies/vsh/vsh/openpipeline/v4.0.3/nextflow/workflows/rna/rna_singlesample/.config.vsh.yaml rename to target/dependencies/vsh/vsh/openpipeline/v4.1.0/nextflow/workflows/rna/rna_singlesample/.config.vsh.yaml index 63e73e2..2e8f5fa 100644 --- a/target/dependencies/vsh/vsh/openpipeline/v4.0.3/nextflow/workflows/rna/rna_singlesample/.config.vsh.yaml +++ b/target/dependencies/vsh/vsh/openpipeline/v4.1.0/nextflow/workflows/rna/rna_singlesample/.config.vsh.yaml @@ -1,6 +1,6 @@ name: "rna_singlesample" namespace: "workflows/rna" -version: "v4.0.3" +version: "v4.1.0" authors: - name: "Dries De Maeyer" roles: @@ -395,8 +395,8 @@ build_info: engine: "native" output: "target/nextflow/workflows/rna/rna_singlesample" executable: "target/nextflow/workflows/rna/rna_singlesample/main.nf" - viash_version: "0.9.4" - git_commit: "7bfad4ea12f87eca59213be3ab08deff67cc4206" + viash_version: "0.9.7" + git_commit: "a6499fddaa8553874585c747370f919f4d7b729c" git_remote: "https://github.com/openpipelines-bio/openpipeline" dependencies: - "target/nextflow/filter/filter_with_counts" @@ -406,7 +406,7 @@ build_info: - "target/nextflow/workflows/qc/qc" package_config: name: "openpipeline" - version: "v4.0.3" + version: "v4.1.0" summary: "Best-practice workflows for single-cell multi-omics analyses.\n" description: "OpenPipelines are extensible single cell analysis pipelines for reproducible\ \ and large-scale single cell processing using [Viash](https://viash.io) and [Nextflow](https://www.nextflow.io/).\n\ @@ -427,7 +427,7 @@ package_config: - path: "src/workflows/utils/labels_ci.config" description: "Adds the correct memory and CPU labels when running on the Viash\ \ Hub CI." - viash_version: "0.9.4" + viash_version: "0.9.7" source: "src" target: "target" config_mods: @@ -436,7 +436,7 @@ package_config: )'" - ".engines += { type: \"native\" }" - ".engines[.type == 'docker'].target_registry := 'images.viash-hub.com'" - - ".engines[.type == 'docker'].target_tag := 'v4.0.3'" + - ".engines[.type == 'docker'].target_tag := 'v4.1.0'" keywords: - "single-cell" - "multimodal" diff --git a/target/dependencies/vsh/vsh/openpipeline/v4.0.3/nextflow/workflows/rna/rna_singlesample/main.nf b/target/dependencies/vsh/vsh/openpipeline/v4.1.0/nextflow/workflows/rna/rna_singlesample/main.nf similarity index 98% rename from target/dependencies/vsh/vsh/openpipeline/v4.0.3/nextflow/workflows/rna/rna_singlesample/main.nf rename to target/dependencies/vsh/vsh/openpipeline/v4.1.0/nextflow/workflows/rna/rna_singlesample/main.nf index cde5ca1..fcbdb40 100644 --- a/target/dependencies/vsh/vsh/openpipeline/v4.0.3/nextflow/workflows/rna/rna_singlesample/main.nf +++ b/target/dependencies/vsh/vsh/openpipeline/v4.1.0/nextflow/workflows/rna/rna_singlesample/main.nf @@ -1,6 +1,6 @@ -// rna_singlesample v4.0.3 +// rna_singlesample v4.1.0 // -// This wrapper script is auto-generated by viash 0.9.4 and is thus a derivative +// This wrapper script is auto-generated by viash 0.9.7 and is thus a derivative // work thereof. This software comes with ABSOLUTELY NO WARRANTY from Data // Intuitive. // @@ -1355,47 +1355,42 @@ def readCsv(file_path) { def splitRegex = java.util.regex.Pattern.compile(''',(?=(?:[^"]*"[^"]*")*[^"]*$)''') def removeQuote = java.util.regex.Pattern.compile('''"(.*)"''') - def br = java.nio.file.Files.newBufferedReader(inputFile) + java.nio.file.Files.newBufferedReader(inputFile).withCloseable { br -> + def row = 0 + def header = null + def line - def row = -1 - def header = null - while (br.ready() && header == null) { - def line = br.readLine() - row++ - if (!line.startsWith("#")) { - header = splitRegex.split(line, -1).collect{field -> - m = removeQuote.matcher(field) - m.find() ? m.replaceFirst('$1') : field - } - } - } - assert header != null: "CSV file should contain a header" - - while (br.ready()) { - def line = br.readLine() - row++ - if (line == null) { - br.close() - break - } - - if (!line.startsWith("#")) { - def predata = splitRegex.split(line, -1) - def data = predata.collect{field -> - if (field == "") { - return null - } - def m = removeQuote.matcher(field) - if (m.find()) { - return m.replaceFirst('$1') - } else { - return field + while (header == null && (line = br.readLine()) != null) { + if (!line.startsWith("#")) { + header = splitRegex.split(line, -1).collect { field -> + def m = removeQuote.matcher(field) + m.find() ? m.replaceFirst('$1') : field } } - assert header.size() == data.size(): "Row $row should contain the same number as fields as the header" - - def dataMap = [header, data].transpose().collectEntries().findAll{it.value != null} - output.add(dataMap) + row++ + } + assert header != null : "CSV file should contain a header" + + while ((line = br.readLine()) != null) { + row++ + if (!line.startsWith("#")) { + def predata = splitRegex.split(line, -1) + def data = predata.collect { field -> + if (field == "") { + return null + } + def m = removeQuote.matcher(field) + if (m.find()) { + return m.replaceFirst('$1') + } else { + return field + } + } + assert header.size() == data.size() : "Row $row should contain the same number as fields as the header" + + def dataMap = [header, data].transpose().collectEntries().findAll { it.value != null } + output.add(dataMap) + } } } @@ -1711,10 +1706,25 @@ process publishFilesProc { ] .transpose() .collectMany{infile, outfile -> - if (infile.toString() != outfile.toString()) { + def infileString = infile.toString() + def outfileString = outfile.toString() + if (infileString != outfileString) { + /* Trailing slashes are removed from both the source and destination arguments. + From source arguments, this is useful when a source argument may have a trailing slash + and specify a symbolic link to a directory. Without removing the slash, cp will dereference + the symbolic link. + See https://www.gnu.org/software/coreutils/manual/html_node/Trailing-slashes.html#Trailing-slashes-1 + + For the destination path addding a trailing slash is a problem when publishing directories: + it requires the destination directory to exist. This fails because we only create the parent + directories first. + */ + def regexTrailingSlashes = ~/\/+$/ + def infileNoTrailingSlash = infileString - regexTrailingSlashes + def outfileNoTrailingSlash = outfileString - regexTrailingSlashes [ - "[ -d \"\$(dirname '${outfile.toString()}')\" ] || mkdir -p \"\$(dirname '${outfile.toString()}')\"", - "cp -r '${infile.toString()}' '${outfile.toString()}'" + "[ -d \"\$(dirname '${outfileNoTrailingSlash}')\" ] || mkdir -p \"\$(dirname '${outfileNoTrailingSlash}')\"", + "cp -a '${infileNoTrailingSlash}' '${outfileNoTrailingSlash}'" ] } else { // no need to copy if infile is the same as outfile @@ -3037,7 +3047,7 @@ meta = [ "config": processConfig(readJsonBlob('''{ "name" : "rna_singlesample", "namespace" : "workflows/rna", - "version" : "v4.0.3", + "version" : "v4.1.0", "authors" : [ { "name" : "Dries De Maeyer", @@ -3540,13 +3550,13 @@ meta = [ "runner" : "nextflow", "engine" : "native", "output" : "/workdir/root/repo/target/nextflow/workflows/rna/rna_singlesample", - "viash_version" : "0.9.4", - "git_commit" : "7bfad4ea12f87eca59213be3ab08deff67cc4206", + "viash_version" : "0.9.7", + "git_commit" : "a6499fddaa8553874585c747370f919f4d7b729c", "git_remote" : "https://github.com/openpipelines-bio/openpipeline" }, "package_config" : { "name" : "openpipeline", - "version" : "v4.0.3", + "version" : "v4.1.0", "summary" : "Best-practice workflows for single-cell multi-omics analyses.\n", "description" : "OpenPipelines are extensible single cell analysis pipelines for reproducible and large-scale single cell processing using [Viash](https://viash.io) and [Nextflow](https://www.nextflow.io/).\n\nIn terms of workflows, the following has been made available, but keep in mind that\nindividual tools and functionality can be executed as standalone components as well.\n\n * Demultiplexing: conversion of raw sequencing data to FASTQ objects.\n * Ingestion: Read mapping and generating a count matrix.\n * Single sample processing: cell filtering and doublet detection.\n * Multisample processing: Count transformation, normalization, QC metric calulations.\n * Integration: Clustering, integration and batch correction using single and multimodal methods.\n * Downstream analysis workflows\n", "info" : { @@ -3564,14 +3574,14 @@ meta = [ } ] }, - "viash_version" : "0.9.4", + "viash_version" : "0.9.7", "source" : "/workdir/root/repo/src", "target" : "/workdir/root/repo/target", "config_mods" : [ ".resources += {path: '/src/workflows/utils/labels.config', dest: 'nextflow_labels.config'}\n.runners[.type == 'nextflow'].config.script := 'includeConfig(\\"nextflow_labels.config\\")'", ".engines += { type: \\"native\\" }", ".engines[.type == 'docker'].target_registry := 'images.viash-hub.com'", - ".engines[.type == 'docker'].target_tag := 'v4.0.3'" + ".engines[.type == 'docker'].target_tag := 'v4.1.0'" ], "keywords" : [ "single-cell", diff --git a/target/dependencies/vsh/vsh/openpipeline/v4.0.3/nextflow/workflows/rna/rna_singlesample/nextflow.config b/target/dependencies/vsh/vsh/openpipeline/v4.1.0/nextflow/workflows/rna/rna_singlesample/nextflow.config similarity index 99% rename from target/dependencies/vsh/vsh/openpipeline/v4.0.3/nextflow/workflows/rna/rna_singlesample/nextflow.config rename to target/dependencies/vsh/vsh/openpipeline/v4.1.0/nextflow/workflows/rna/rna_singlesample/nextflow.config index 150305c..ba0c744 100644 --- a/target/dependencies/vsh/vsh/openpipeline/v4.0.3/nextflow/workflows/rna/rna_singlesample/nextflow.config +++ b/target/dependencies/vsh/vsh/openpipeline/v4.1.0/nextflow/workflows/rna/rna_singlesample/nextflow.config @@ -2,7 +2,7 @@ manifest { name = 'workflows/rna/rna_singlesample' mainScript = 'main.nf' nextflowVersion = '!>=20.12.1-edge' - version = 'v4.0.3' + version = 'v4.1.0' description = 'Processing unimodal single-sample RNA transcriptomics data.' author = 'Dries De Maeyer, Robrecht Cannoodt, Dries Schaumont' } diff --git a/target/dependencies/vsh/vsh/openpipeline/v4.1.0/nextflow/workflows/rna/rna_singlesample/nextflow_labels.config b/target/dependencies/vsh/vsh/openpipeline/v4.1.0/nextflow/workflows/rna/rna_singlesample/nextflow_labels.config new file mode 100644 index 0000000..94570ec --- /dev/null +++ b/target/dependencies/vsh/vsh/openpipeline/v4.1.0/nextflow/workflows/rna/rna_singlesample/nextflow_labels.config @@ -0,0 +1,48 @@ +process { + // Default resources for components that hardly do any processing + memory = { 2.GB * task.attempt } + cpus = 1 + + // Retry for exit codes that have something to do with memory issues + errorStrategy = { task.exitStatus in 137..140 ? 'retry' : 'terminate' } + maxRetries = 3 + + // The memory a task is assinged increases with each attempt + // uncomment the line below and adjust the value to set a global upper limit on the memory. + // resourceLimits = [ memory: 240.Gb ] + + // CPU resources + withLabel: singlecpu { cpus = 1 } + withLabel: lowcpu { cpus = 4 } + withLabel: midcpu { cpus = 10 } + withLabel: highcpu { cpus = 20 } + + // Memory resources + withLabel: lowmem { memory = { task?.resourceLimits?.memory && task?.maxRetries && task.attempt >= task.maxRetries ? task.resourceLimits.memory : 4.GB * task.attempt } } + withLabel: midmem { memory = { task?.resourceLimits?.memory && task?.maxRetries && task.attempt >= task.maxRetries ? task.resourceLimits.memory : 25.GB * task.attempt } } + withLabel: highmem { memory = { task?.resourceLimits?.memory && task?.maxRetries && task.attempt >= task.maxRetries ? task.resourceLimits.memory : 50.GB * task.attempt } } + withLabel: veryhighmem { memory = { task?.resourceLimits?.memory && task?.maxRetries && task.attempt >= task.maxRetries ? task.resourceLimits.memory : 75.GB * task.attempt } } + + // Disk space + withLabel: lowdisk { + disk = {process.disk ? process.disk : null} + } + withLabel: middisk { + disk = {process.disk ? process.disk : null} + } + withLabel: highdisk { + disk = {process.disk ? process.disk : null} + } + withLabel: veryhighdisk { + disk = {process.disk ? process.disk : null} + } + + // NOTE: The above labels intentionally do not have an effect by default. + // The user should set the disk space requirements by adding the following + // to the compute environment: + // + // withLabel: lowdisk { disk = { 20.GB * task.attempt } } + // withLabel: middisk { disk = { 100.GB * task.attempt } } + // withLabel: highdisk { disk = { 200.GB * task.attempt } } + // withLabel: veryhighdisk { disk = { 500.GB * task.attempt } } +} diff --git a/target/dependencies/vsh/vsh/openpipeline/v4.0.3/nextflow/workflows/rna/rna_singlesample/nextflow_schema.json b/target/dependencies/vsh/vsh/openpipeline/v4.1.0/nextflow/workflows/rna/rna_singlesample/nextflow_schema.json similarity index 100% rename from target/dependencies/vsh/vsh/openpipeline/v4.0.3/nextflow/workflows/rna/rna_singlesample/nextflow_schema.json rename to target/dependencies/vsh/vsh/openpipeline/v4.1.0/nextflow/workflows/rna/rna_singlesample/nextflow_schema.json diff --git a/target/dependencies/vsh/vsh/openpipeline/v4.1.0/nextflow/workflows/rna/rna_singlesample/utils/errorstrat_ignore.config b/target/dependencies/vsh/vsh/openpipeline/v4.1.0/nextflow/workflows/rna/rna_singlesample/utils/errorstrat_ignore.config new file mode 100644 index 0000000..6b4b029 --- /dev/null +++ b/target/dependencies/vsh/vsh/openpipeline/v4.1.0/nextflow/workflows/rna/rna_singlesample/utils/errorstrat_ignore.config @@ -0,0 +1 @@ +process.errorStrategy = 'ignore' \ No newline at end of file diff --git a/target/dependencies/vsh/vsh/openpipeline/v4.1.0/nextflow/workflows/rna/rna_singlesample/utils/integration_tests.config b/target/dependencies/vsh/vsh/openpipeline/v4.1.0/nextflow/workflows/rna/rna_singlesample/utils/integration_tests.config new file mode 100644 index 0000000..59d5b09 --- /dev/null +++ b/target/dependencies/vsh/vsh/openpipeline/v4.1.0/nextflow/workflows/rna/rna_singlesample/utils/integration_tests.config @@ -0,0 +1,36 @@ +profiles { + + // detect tempdir + tempDir = java.nio.file.Paths.get( + System.getenv('NXF_TEMP') ?: + System.getenv('VIASH_TEMP') ?: + System.getenv('TEMPDIR') ?: + System.getenv('TMPDIR') ?: + '/tmp' + ).toAbsolutePath() + + mount_temp { + docker.temp = tempDir + podman.temp = tempDir + charliecloud.temp = tempDir + } + + no_publish { + process { + withName: '.*' { + publishDir = [ + enabled: false + ] + } + } + } + + docker { + docker.enabled = true + // docker.userEmulation = true + singularity.enabled = false + podman.enabled = false + shifter.enabled = false + charliecloud.enabled = false + } +} \ No newline at end of file diff --git a/target/dependencies/vsh/vsh/openpipeline/v4.1.0/nextflow/workflows/rna/rna_singlesample/utils/labels.config b/target/dependencies/vsh/vsh/openpipeline/v4.1.0/nextflow/workflows/rna/rna_singlesample/utils/labels.config new file mode 100644 index 0000000..94570ec --- /dev/null +++ b/target/dependencies/vsh/vsh/openpipeline/v4.1.0/nextflow/workflows/rna/rna_singlesample/utils/labels.config @@ -0,0 +1,48 @@ +process { + // Default resources for components that hardly do any processing + memory = { 2.GB * task.attempt } + cpus = 1 + + // Retry for exit codes that have something to do with memory issues + errorStrategy = { task.exitStatus in 137..140 ? 'retry' : 'terminate' } + maxRetries = 3 + + // The memory a task is assinged increases with each attempt + // uncomment the line below and adjust the value to set a global upper limit on the memory. + // resourceLimits = [ memory: 240.Gb ] + + // CPU resources + withLabel: singlecpu { cpus = 1 } + withLabel: lowcpu { cpus = 4 } + withLabel: midcpu { cpus = 10 } + withLabel: highcpu { cpus = 20 } + + // Memory resources + withLabel: lowmem { memory = { task?.resourceLimits?.memory && task?.maxRetries && task.attempt >= task.maxRetries ? task.resourceLimits.memory : 4.GB * task.attempt } } + withLabel: midmem { memory = { task?.resourceLimits?.memory && task?.maxRetries && task.attempt >= task.maxRetries ? task.resourceLimits.memory : 25.GB * task.attempt } } + withLabel: highmem { memory = { task?.resourceLimits?.memory && task?.maxRetries && task.attempt >= task.maxRetries ? task.resourceLimits.memory : 50.GB * task.attempt } } + withLabel: veryhighmem { memory = { task?.resourceLimits?.memory && task?.maxRetries && task.attempt >= task.maxRetries ? task.resourceLimits.memory : 75.GB * task.attempt } } + + // Disk space + withLabel: lowdisk { + disk = {process.disk ? process.disk : null} + } + withLabel: middisk { + disk = {process.disk ? process.disk : null} + } + withLabel: highdisk { + disk = {process.disk ? process.disk : null} + } + withLabel: veryhighdisk { + disk = {process.disk ? process.disk : null} + } + + // NOTE: The above labels intentionally do not have an effect by default. + // The user should set the disk space requirements by adding the following + // to the compute environment: + // + // withLabel: lowdisk { disk = { 20.GB * task.attempt } } + // withLabel: middisk { disk = { 100.GB * task.attempt } } + // withLabel: highdisk { disk = { 200.GB * task.attempt } } + // withLabel: veryhighdisk { disk = { 500.GB * task.attempt } } +} diff --git a/target/dependencies/vsh/vsh/openpipeline/v4.1.0/nextflow/workflows/rna/rna_singlesample/utils/labels_ci.config b/target/dependencies/vsh/vsh/openpipeline/v4.1.0/nextflow/workflows/rna/rna_singlesample/utils/labels_ci.config new file mode 100644 index 0000000..aee866d --- /dev/null +++ b/target/dependencies/vsh/vsh/openpipeline/v4.1.0/nextflow/workflows/rna/rna_singlesample/utils/labels_ci.config @@ -0,0 +1,33 @@ +process { + withLabel: lowmem { memory = 13.Gb } + withLabel: lowcpu { cpus = 4 } + withLabel: midmem { memory = 13.Gb } + withLabel: midcpu { cpus = 4 } + withLabel: highmem { memory = 13.Gb } + withLabel: highcpu { cpus = 4 } + withLabel: veryhighmem { memory = 13.Gb } + withLabel: lowdisk { + disk = {process.disk ? process.disk : null} + } + withLabel: middisk { + disk = {process.disk ? process.disk : null} + } + withLabel: highdisk { + disk = {process.disk ? process.disk : null} + } + withLabel: veryhighdisk { + disk = {process.disk ? process.disk : null} + } +} + +env.NUMBA_CACHE_DIR = '/tmp' + +trace { + enabled = true + overwrite = true +} +dag { + overwrite = true +} + +process.maxForks = 1 diff --git a/target/executable/convert/from_cells2stats_to_h5mu/.config.vsh.yaml b/target/executable/convert/from_cells2stats_to_h5mu/.config.vsh.yaml index 658ef02..eda8ba1 100644 --- a/target/executable/convert/from_cells2stats_to_h5mu/.config.vsh.yaml +++ b/target/executable/convert/from_cells2stats_to_h5mu/.config.vsh.yaml @@ -179,7 +179,7 @@ repositories: - type: "vsh" name: "openpipeline" repo: "openpipeline" - tag: "v4.0.3" + tag: "v4.1.0" links: repository: "https://github.com/openpipelines-bio/openpipeline_spatial" docker_registry: "ghcr.io" @@ -271,9 +271,10 @@ engines: - type: "python" user: false packages: - - "anndata~=0.12.7" + - "anndata~=0.12.16" - "awkward" - - "mudata~=0.3.2" + - "scipy~=1.17.1" + - "mudata~=0.3.8" - "pyarrow" git: - "https://codeberg.org/miurahr/zipfile-inflate64.git@v0.2" @@ -290,7 +291,7 @@ engines: - type: "python" user: false packages: - - "viashpy==0.9.0" + - "viashpy==0.10.0" upgrade: true entrypoint: [] cmd: null @@ -302,8 +303,8 @@ build_info: engine: "docker|native" output: "target/executable/convert/from_cells2stats_to_h5mu" executable: "target/executable/convert/from_cells2stats_to_h5mu/from_cells2stats_to_h5mu" - viash_version: "0.9.4" - git_commit: "e087099616271bd0f11e825b7817ec14ebef62d7" + viash_version: "0.9.7" + git_commit: "4449aa6094a686af0a5fbe99b9aaafd01ae75aff" git_remote: "https://github.com/openpipelines-bio/openpipeline_spatial" package_config: name: "openpipeline_spatial" @@ -317,8 +318,8 @@ package_config: - type: "vsh" name: "openpipeline" repo: "openpipeline" - tag: "v4.0.3" - viash_version: "0.9.4" + tag: "v4.1.0" + viash_version: "0.9.7" source: "src" target: "target" config_mods: diff --git a/target/executable/convert/from_cells2stats_to_h5mu/from_cells2stats_to_h5mu b/target/executable/convert/from_cells2stats_to_h5mu/from_cells2stats_to_h5mu index a2f250c..09036bc 100755 --- a/target/executable/convert/from_cells2stats_to_h5mu/from_cells2stats_to_h5mu +++ b/target/executable/convert/from_cells2stats_to_h5mu/from_cells2stats_to_h5mu @@ -2,7 +2,7 @@ # from_cells2stats_to_h5mu main # -# This wrapper script is auto-generated by viash 0.9.4 and is thus a derivative +# This wrapper script is auto-generated by viash 0.9.7 and is thus a derivative # work thereof. This software comes with ABSOLUTELY NO WARRANTY from Data # Intuitive. # @@ -453,15 +453,15 @@ RUN apt-get update && \ rm -rf /var/lib/apt/lists/* RUN pip install --upgrade pip && \ - pip install --upgrade --no-cache-dir "anndata~=0.12.7" "awkward" "mudata~=0.3.2" "pyarrow" && \ + pip install --upgrade --no-cache-dir "anndata~=0.12.16" "awkward" "scipy~=1.17.1" "mudata~=0.3.8" "pyarrow" && \ pip install --upgrade --no-cache-dir "git+https://codeberg.org/miurahr/zipfile-inflate64.git@v0.2" && \ python -c 'exec("try:\n import zarr; from importlib.metadata import version\nexcept ModuleNotFoundError:\n exit(0)\nelse: assert int(version(\"zarr\").partition(\".\")[0]) > 2")' LABEL org.opencontainers.image.authors="Dorien Roosen" LABEL org.opencontainers.image.description="Companion container for running component convert from_cells2stats_to_h5mu" -LABEL org.opencontainers.image.created="2026-05-22T11:53:11Z" +LABEL org.opencontainers.image.created="2026-06-01T12:50:41Z" LABEL org.opencontainers.image.source="https://github.com/openpipelines-bio/openpipeline_spatial" -LABEL org.opencontainers.image.revision="e087099616271bd0f11e825b7817ec14ebef62d7" +LABEL org.opencontainers.image.revision="4449aa6094a686af0a5fbe99b9aaafd01ae75aff" LABEL org.opencontainers.image.version="main" VIASHDOCKER diff --git a/target/executable/convert/from_cosmx_to_h5mu/.config.vsh.yaml b/target/executable/convert/from_cosmx_to_h5mu/.config.vsh.yaml index b5097a8..8690fb0 100644 --- a/target/executable/convert/from_cosmx_to_h5mu/.config.vsh.yaml +++ b/target/executable/convert/from_cosmx_to_h5mu/.config.vsh.yaml @@ -107,7 +107,7 @@ repositories: - type: "vsh" name: "openpipeline" repo: "openpipeline" - tag: "v4.0.3" + tag: "v4.1.0" links: repository: "https://github.com/openpipelines-bio/openpipeline_spatial" docker_registry: "ghcr.io" @@ -199,10 +199,11 @@ engines: - type: "python" user: false packages: - - "anndata~=0.12.7" + - "anndata~=0.12.16" - "awkward" - - "mudata~=0.3.2" - - "scanpy~=1.10.4" + - "scipy~=1.17.1" + - "mudata~=0.3.8" + - "scanpy~=1.11.4" - "squidpy~=1.8.1" - "pyarrow" git: @@ -220,7 +221,7 @@ engines: - type: "python" user: false packages: - - "viashpy==0.9.0" + - "viashpy==0.10.0" github: - "openpipelines-bio/core#subdirectory=packages/python/openpipeline_testutils" upgrade: true @@ -238,8 +239,8 @@ build_info: engine: "docker|native" output: "target/executable/convert/from_cosmx_to_h5mu" executable: "target/executable/convert/from_cosmx_to_h5mu/from_cosmx_to_h5mu" - viash_version: "0.9.4" - git_commit: "e087099616271bd0f11e825b7817ec14ebef62d7" + viash_version: "0.9.7" + git_commit: "4449aa6094a686af0a5fbe99b9aaafd01ae75aff" git_remote: "https://github.com/openpipelines-bio/openpipeline_spatial" package_config: name: "openpipeline_spatial" @@ -253,8 +254,8 @@ package_config: - type: "vsh" name: "openpipeline" repo: "openpipeline" - tag: "v4.0.3" - viash_version: "0.9.4" + tag: "v4.1.0" + viash_version: "0.9.7" source: "src" target: "target" config_mods: diff --git a/target/executable/convert/from_cosmx_to_h5mu/from_cosmx_to_h5mu b/target/executable/convert/from_cosmx_to_h5mu/from_cosmx_to_h5mu index cb1b86f..cdc1c6a 100755 --- a/target/executable/convert/from_cosmx_to_h5mu/from_cosmx_to_h5mu +++ b/target/executable/convert/from_cosmx_to_h5mu/from_cosmx_to_h5mu @@ -2,7 +2,7 @@ # from_cosmx_to_h5mu main # -# This wrapper script is auto-generated by viash 0.9.4 and is thus a derivative +# This wrapper script is auto-generated by viash 0.9.7 and is thus a derivative # work thereof. This software comes with ABSOLUTELY NO WARRANTY from Data # Intuitive. # @@ -454,15 +454,15 @@ RUN apt-get update && \ rm -rf /var/lib/apt/lists/* RUN pip install --upgrade pip && \ - pip install --upgrade --no-cache-dir "anndata~=0.12.7" "awkward" "mudata~=0.3.2" "scanpy~=1.10.4" "squidpy~=1.8.1" "pyarrow" && \ + pip install --upgrade --no-cache-dir "anndata~=0.12.16" "awkward" "scipy~=1.17.1" "mudata~=0.3.8" "scanpy~=1.11.4" "squidpy~=1.8.1" "pyarrow" && \ pip install --upgrade --no-cache-dir "git+https://codeberg.org/miurahr/zipfile-inflate64.git@v0.2" && \ python -c 'exec("try:\n import zarr; from importlib.metadata import version\nexcept ModuleNotFoundError:\n exit(0)\nelse: assert int(version(\"zarr\").partition(\".\")[0]) > 2")' LABEL org.opencontainers.image.authors="Dorien Roosen, Weiwei Schultz" LABEL org.opencontainers.image.description="Companion container for running component convert from_cosmx_to_h5mu" -LABEL org.opencontainers.image.created="2026-05-22T11:53:11Z" +LABEL org.opencontainers.image.created="2026-06-01T12:50:41Z" LABEL org.opencontainers.image.source="https://github.com/openpipelines-bio/openpipeline_spatial" -LABEL org.opencontainers.image.revision="e087099616271bd0f11e825b7817ec14ebef62d7" +LABEL org.opencontainers.image.revision="4449aa6094a686af0a5fbe99b9aaafd01ae75aff" LABEL org.opencontainers.image.version="main" VIASHDOCKER diff --git a/target/executable/convert/from_cosmx_to_spatialexperiment/.config.vsh.yaml b/target/executable/convert/from_cosmx_to_spatialexperiment/.config.vsh.yaml index e0c17c4..b284027 100644 --- a/target/executable/convert/from_cosmx_to_spatialexperiment/.config.vsh.yaml +++ b/target/executable/convert/from_cosmx_to_spatialexperiment/.config.vsh.yaml @@ -125,7 +125,7 @@ repositories: - type: "vsh" name: "openpipeline" repo: "openpipeline" - tag: "v4.0.3" + tag: "v4.1.0" links: repository: "https://github.com/openpipelines-bio/openpipeline_spatial" docker_registry: "ghcr.io" @@ -233,8 +233,8 @@ build_info: engine: "docker|native" output: "target/executable/convert/from_cosmx_to_spatialexperiment" executable: "target/executable/convert/from_cosmx_to_spatialexperiment/from_cosmx_to_spatialexperiment" - viash_version: "0.9.4" - git_commit: "e087099616271bd0f11e825b7817ec14ebef62d7" + viash_version: "0.9.7" + git_commit: "4449aa6094a686af0a5fbe99b9aaafd01ae75aff" git_remote: "https://github.com/openpipelines-bio/openpipeline_spatial" package_config: name: "openpipeline_spatial" @@ -248,8 +248,8 @@ package_config: - type: "vsh" name: "openpipeline" repo: "openpipeline" - tag: "v4.0.3" - viash_version: "0.9.4" + tag: "v4.1.0" + viash_version: "0.9.7" source: "src" target: "target" config_mods: diff --git a/target/executable/convert/from_cosmx_to_spatialexperiment/from_cosmx_to_spatialexperiment b/target/executable/convert/from_cosmx_to_spatialexperiment/from_cosmx_to_spatialexperiment index cdec9d4..1c33fd3 100755 --- a/target/executable/convert/from_cosmx_to_spatialexperiment/from_cosmx_to_spatialexperiment +++ b/target/executable/convert/from_cosmx_to_spatialexperiment/from_cosmx_to_spatialexperiment @@ -2,7 +2,7 @@ # from_cosmx_to_spatialexperiment main # -# This wrapper script is auto-generated by viash 0.9.4 and is thus a derivative +# This wrapper script is auto-generated by viash 0.9.7 and is thus a derivative # work thereof. This software comes with ABSOLUTELY NO WARRANTY from Data # Intuitive. # @@ -457,9 +457,9 @@ RUN Rscript -e 'options(warn = 2); if (!requireNamespace("BiocManager", quietly LABEL org.opencontainers.image.authors="Dorien Roosen" LABEL org.opencontainers.image.description="Companion container for running component convert from_cosmx_to_spatialexperiment" -LABEL org.opencontainers.image.created="2026-05-22T11:53:11Z" +LABEL org.opencontainers.image.created="2026-06-01T12:50:41Z" LABEL org.opencontainers.image.source="https://github.com/openpipelines-bio/openpipeline_spatial" -LABEL org.opencontainers.image.revision="e087099616271bd0f11e825b7817ec14ebef62d7" +LABEL org.opencontainers.image.revision="4449aa6094a686af0a5fbe99b9aaafd01ae75aff" LABEL org.opencontainers.image.version="main" VIASHDOCKER diff --git a/target/executable/convert/from_h5mu_to_seurat_with_fov/.config.vsh.yaml b/target/executable/convert/from_h5mu_to_seurat_with_fov/.config.vsh.yaml index 2d03728..f90dc1e 100644 --- a/target/executable/convert/from_h5mu_to_seurat_with_fov/.config.vsh.yaml +++ b/target/executable/convert/from_h5mu_to_seurat_with_fov/.config.vsh.yaml @@ -138,7 +138,7 @@ repositories: - type: "vsh" name: "openpipeline" repo: "openpipeline" - tag: "v4.0.3" + tag: "v4.1.0" links: repository: "https://github.com/openpipelines-bio/openpipeline_spatial" docker_registry: "ghcr.io" @@ -252,8 +252,8 @@ build_info: engine: "docker|native" output: "target/executable/convert/from_h5mu_to_seurat_with_fov" executable: "target/executable/convert/from_h5mu_to_seurat_with_fov/from_h5mu_to_seurat_with_fov" - viash_version: "0.9.4" - git_commit: "e087099616271bd0f11e825b7817ec14ebef62d7" + viash_version: "0.9.7" + git_commit: "4449aa6094a686af0a5fbe99b9aaafd01ae75aff" git_remote: "https://github.com/openpipelines-bio/openpipeline_spatial" package_config: name: "openpipeline_spatial" @@ -267,8 +267,8 @@ package_config: - type: "vsh" name: "openpipeline" repo: "openpipeline" - tag: "v4.0.3" - viash_version: "0.9.4" + tag: "v4.1.0" + viash_version: "0.9.7" source: "src" target: "target" config_mods: diff --git a/target/executable/convert/from_h5mu_to_seurat_with_fov/from_h5mu_to_seurat_with_fov b/target/executable/convert/from_h5mu_to_seurat_with_fov/from_h5mu_to_seurat_with_fov index 295daaa..e439565 100755 --- a/target/executable/convert/from_h5mu_to_seurat_with_fov/from_h5mu_to_seurat_with_fov +++ b/target/executable/convert/from_h5mu_to_seurat_with_fov/from_h5mu_to_seurat_with_fov @@ -2,7 +2,7 @@ # from_h5mu_to_seurat_with_fov main # -# This wrapper script is auto-generated by viash 0.9.4 and is thus a derivative +# This wrapper script is auto-generated by viash 0.9.7 and is thus a derivative # work thereof. This software comes with ABSOLUTELY NO WARRANTY from Data # Intuitive. # @@ -458,9 +458,9 @@ RUN Rscript -e 'options(warn = 2); if (!requireNamespace("remotes", quietly = TR LABEL org.opencontainers.image.authors="Dorien Roosen" LABEL org.opencontainers.image.description="Companion container for running component convert from_h5mu_to_seurat_with_fov" -LABEL org.opencontainers.image.created="2026-05-22T11:53:09Z" +LABEL org.opencontainers.image.created="2026-06-01T12:50:39Z" LABEL org.opencontainers.image.source="https://github.com/openpipelines-bio/openpipeline_spatial" -LABEL org.opencontainers.image.revision="e087099616271bd0f11e825b7817ec14ebef62d7" +LABEL org.opencontainers.image.revision="4449aa6094a686af0a5fbe99b9aaafd01ae75aff" LABEL org.opencontainers.image.version="main" VIASHDOCKER diff --git a/target/executable/convert/from_h5mu_to_spatialdata/.config.vsh.yaml b/target/executable/convert/from_h5mu_to_spatialdata/.config.vsh.yaml index 85a70ab..80eb49d 100644 --- a/target/executable/convert/from_h5mu_to_spatialdata/.config.vsh.yaml +++ b/target/executable/convert/from_h5mu_to_spatialdata/.config.vsh.yaml @@ -114,7 +114,7 @@ repositories: - type: "vsh" name: "openpipeline" repo: "openpipeline" - tag: "v4.0.3" + tag: "v4.1.0" links: repository: "https://github.com/openpipelines-bio/openpipeline_spatial" docker_registry: "ghcr.io" @@ -203,9 +203,10 @@ engines: - type: "python" user: false packages: - - "anndata~=0.12.7" + - "anndata~=0.12.16" - "awkward" - - "mudata~=0.3.2" + - "scipy~=1.17.1" + - "mudata~=0.3.8" - "spatialdata~=0.7.2" - "pyarrow~=18.0.0" - "ome-zarr~=0.13.0" @@ -222,7 +223,7 @@ engines: - type: "python" user: false packages: - - "viashpy==0.9.0" + - "viashpy==0.10.0" github: - "openpipelines-bio/core#subdirectory=packages/python/openpipeline_testutils" upgrade: true @@ -236,8 +237,8 @@ build_info: engine: "docker|native" output: "target/executable/convert/from_h5mu_to_spatialdata" executable: "target/executable/convert/from_h5mu_to_spatialdata/from_h5mu_to_spatialdata" - viash_version: "0.9.4" - git_commit: "e087099616271bd0f11e825b7817ec14ebef62d7" + viash_version: "0.9.7" + git_commit: "4449aa6094a686af0a5fbe99b9aaafd01ae75aff" git_remote: "https://github.com/openpipelines-bio/openpipeline_spatial" package_config: name: "openpipeline_spatial" @@ -251,8 +252,8 @@ package_config: - type: "vsh" name: "openpipeline" repo: "openpipeline" - tag: "v4.0.3" - viash_version: "0.9.4" + tag: "v4.1.0" + viash_version: "0.9.7" source: "src" target: "target" config_mods: diff --git a/target/executable/convert/from_h5mu_to_spatialdata/from_h5mu_to_spatialdata b/target/executable/convert/from_h5mu_to_spatialdata/from_h5mu_to_spatialdata index 0d98a9a..e07b608 100755 --- a/target/executable/convert/from_h5mu_to_spatialdata/from_h5mu_to_spatialdata +++ b/target/executable/convert/from_h5mu_to_spatialdata/from_h5mu_to_spatialdata @@ -2,7 +2,7 @@ # from_h5mu_to_spatialdata main # -# This wrapper script is auto-generated by viash 0.9.4 and is thus a derivative +# This wrapper script is auto-generated by viash 0.9.7 and is thus a derivative # work thereof. This software comes with ABSOLUTELY NO WARRANTY from Data # Intuitive. # @@ -454,14 +454,14 @@ RUN apt-get update && \ rm -rf /var/lib/apt/lists/* RUN pip install --upgrade pip && \ - pip install --upgrade --no-cache-dir "anndata~=0.12.7" "awkward" "mudata~=0.3.2" "spatialdata~=0.7.2" "pyarrow~=18.0.0" "ome-zarr~=0.13.0" && \ + pip install --upgrade --no-cache-dir "anndata~=0.12.16" "awkward" "scipy~=1.17.1" "mudata~=0.3.8" "spatialdata~=0.7.2" "pyarrow~=18.0.0" "ome-zarr~=0.13.0" && \ python -c 'exec("try:\n import zarr; from importlib.metadata import version\nexcept ModuleNotFoundError:\n exit(0)\nelse: assert int(version(\"zarr\").partition(\".\")[0]) > 2")' LABEL org.opencontainers.image.authors="Dorien Roosen, Luke Zappia" LABEL org.opencontainers.image.description="Companion container for running component convert from_h5mu_to_spatialdata" -LABEL org.opencontainers.image.created="2026-05-22T11:53:10Z" +LABEL org.opencontainers.image.created="2026-06-01T12:50:40Z" LABEL org.opencontainers.image.source="https://github.com/openpipelines-bio/openpipeline_spatial" -LABEL org.opencontainers.image.revision="e087099616271bd0f11e825b7817ec14ebef62d7" +LABEL org.opencontainers.image.revision="4449aa6094a686af0a5fbe99b9aaafd01ae75aff" LABEL org.opencontainers.image.version="main" VIASHDOCKER diff --git a/target/executable/convert/from_h5mu_to_spatialexperiment/.config.vsh.yaml b/target/executable/convert/from_h5mu_to_spatialexperiment/.config.vsh.yaml index 1dc78cd..01ef273 100644 --- a/target/executable/convert/from_h5mu_to_spatialexperiment/.config.vsh.yaml +++ b/target/executable/convert/from_h5mu_to_spatialexperiment/.config.vsh.yaml @@ -92,7 +92,7 @@ repositories: - type: "vsh" name: "openpipeline" repo: "openpipeline" - tag: "v4.0.3" + tag: "v4.1.0" links: repository: "https://github.com/openpipelines-bio/openpipeline_spatial" docker_registry: "ghcr.io" @@ -209,9 +209,10 @@ engines: - type: "python" user: true packages: - - "anndata~=0.12.7" + - "anndata~=0.12.16" - "awkward" - - "mudata~=0.3.2" + - "scipy~=1.17.1" + - "mudata~=0.3.8" script: - "exec(\"try:\\n import zarr; from importlib.metadata import version\\nexcept\ \ ModuleNotFoundError:\\n exit(0)\\nelse: assert int(version(\\\"zarr\\\"\ @@ -227,8 +228,8 @@ build_info: engine: "docker|native" output: "target/executable/convert/from_h5mu_to_spatialexperiment" executable: "target/executable/convert/from_h5mu_to_spatialexperiment/from_h5mu_to_spatialexperiment" - viash_version: "0.9.4" - git_commit: "e087099616271bd0f11e825b7817ec14ebef62d7" + viash_version: "0.9.7" + git_commit: "4449aa6094a686af0a5fbe99b9aaafd01ae75aff" git_remote: "https://github.com/openpipelines-bio/openpipeline_spatial" package_config: name: "openpipeline_spatial" @@ -242,8 +243,8 @@ package_config: - type: "vsh" name: "openpipeline" repo: "openpipeline" - tag: "v4.0.3" - viash_version: "0.9.4" + tag: "v4.1.0" + viash_version: "0.9.7" source: "src" target: "target" config_mods: diff --git a/target/executable/convert/from_h5mu_to_spatialexperiment/from_h5mu_to_spatialexperiment b/target/executable/convert/from_h5mu_to_spatialexperiment/from_h5mu_to_spatialexperiment index 52cfae5..90c992d 100755 --- a/target/executable/convert/from_h5mu_to_spatialexperiment/from_h5mu_to_spatialexperiment +++ b/target/executable/convert/from_h5mu_to_spatialexperiment/from_h5mu_to_spatialexperiment @@ -2,7 +2,7 @@ # from_h5mu_to_spatialexperiment main # -# This wrapper script is auto-generated by viash 0.9.4 and is thus a derivative +# This wrapper script is auto-generated by viash 0.9.7 and is thus a derivative # work thereof. This software comes with ABSOLUTELY NO WARRANTY from Data # Intuitive. # @@ -458,9 +458,9 @@ RUN Rscript -e 'options(warn = 2); if (!requireNamespace("remotes", quietly = TR LABEL org.opencontainers.image.authors="Dorien Roosen" LABEL org.opencontainers.image.description="Companion container for running component convert from_h5mu_to_spatialexperiment" -LABEL org.opencontainers.image.created="2026-05-22T11:53:09Z" +LABEL org.opencontainers.image.created="2026-06-01T12:50:39Z" LABEL org.opencontainers.image.source="https://github.com/openpipelines-bio/openpipeline_spatial" -LABEL org.opencontainers.image.revision="e087099616271bd0f11e825b7817ec14ebef62d7" +LABEL org.opencontainers.image.revision="4449aa6094a686af0a5fbe99b9aaafd01ae75aff" LABEL org.opencontainers.image.version="main" VIASHDOCKER diff --git a/target/executable/convert/from_spaceranger_to_h5mu/.config.vsh.yaml b/target/executable/convert/from_spaceranger_to_h5mu/.config.vsh.yaml index e789837..42b4d15 100644 --- a/target/executable/convert/from_spaceranger_to_h5mu/.config.vsh.yaml +++ b/target/executable/convert/from_spaceranger_to_h5mu/.config.vsh.yaml @@ -144,7 +144,7 @@ repositories: - type: "vsh" name: "openpipeline" repo: "openpipeline" - tag: "v4.0.3" + tag: "v4.1.0" links: repository: "https://github.com/openpipelines-bio/openpipeline_spatial" docker_registry: "ghcr.io" @@ -233,10 +233,11 @@ engines: - type: "python" user: false packages: - - "anndata~=0.12.7" + - "anndata~=0.12.16" - "awkward" - - "mudata~=0.3.2" - - "scanpy~=1.10.4" + - "scipy~=1.17.1" + - "mudata~=0.3.8" + - "scanpy~=1.11.4" script: - "exec(\"try:\\n import zarr; from importlib.metadata import version\\nexcept\ \ ModuleNotFoundError:\\n exit(0)\\nelse: assert int(version(\\\"zarr\\\"\ @@ -250,7 +251,7 @@ engines: - type: "python" user: false packages: - - "viashpy==0.9.0" + - "viashpy==0.10.0" github: - "openpipelines-bio/core#subdirectory=packages/python/openpipeline_testutils" upgrade: true @@ -264,8 +265,8 @@ build_info: engine: "docker|native" output: "target/executable/convert/from_spaceranger_to_h5mu" executable: "target/executable/convert/from_spaceranger_to_h5mu/from_spaceranger_to_h5mu" - viash_version: "0.9.4" - git_commit: "e087099616271bd0f11e825b7817ec14ebef62d7" + viash_version: "0.9.7" + git_commit: "4449aa6094a686af0a5fbe99b9aaafd01ae75aff" git_remote: "https://github.com/openpipelines-bio/openpipeline_spatial" package_config: name: "openpipeline_spatial" @@ -279,8 +280,8 @@ package_config: - type: "vsh" name: "openpipeline" repo: "openpipeline" - tag: "v4.0.3" - viash_version: "0.9.4" + tag: "v4.1.0" + viash_version: "0.9.7" source: "src" target: "target" config_mods: diff --git a/target/executable/convert/from_spaceranger_to_h5mu/from_spaceranger_to_h5mu b/target/executable/convert/from_spaceranger_to_h5mu/from_spaceranger_to_h5mu index 5a92d2e..2b087f3 100755 --- a/target/executable/convert/from_spaceranger_to_h5mu/from_spaceranger_to_h5mu +++ b/target/executable/convert/from_spaceranger_to_h5mu/from_spaceranger_to_h5mu @@ -2,7 +2,7 @@ # from_spaceranger_to_h5mu main # -# This wrapper script is auto-generated by viash 0.9.4 and is thus a derivative +# This wrapper script is auto-generated by viash 0.9.7 and is thus a derivative # work thereof. This software comes with ABSOLUTELY NO WARRANTY from Data # Intuitive. # @@ -453,14 +453,14 @@ RUN apt-get update && \ rm -rf /var/lib/apt/lists/* RUN pip install --upgrade pip && \ - pip install --upgrade --no-cache-dir "anndata~=0.12.7" "awkward" "mudata~=0.3.2" "scanpy~=1.10.4" && \ + pip install --upgrade --no-cache-dir "anndata~=0.12.16" "awkward" "scipy~=1.17.1" "mudata~=0.3.8" "scanpy~=1.11.4" && \ python -c 'exec("try:\n import zarr; from importlib.metadata import version\nexcept ModuleNotFoundError:\n exit(0)\nelse: assert int(version(\"zarr\").partition(\".\")[0]) > 2")' LABEL org.opencontainers.image.authors="Dorien Roosen" LABEL org.opencontainers.image.description="Companion container for running component convert from_spaceranger_to_h5mu" -LABEL org.opencontainers.image.created="2026-05-22T11:53:09Z" +LABEL org.opencontainers.image.created="2026-06-01T12:50:39Z" LABEL org.opencontainers.image.source="https://github.com/openpipelines-bio/openpipeline_spatial" -LABEL org.opencontainers.image.revision="e087099616271bd0f11e825b7817ec14ebef62d7" +LABEL org.opencontainers.image.revision="4449aa6094a686af0a5fbe99b9aaafd01ae75aff" LABEL org.opencontainers.image.version="main" VIASHDOCKER diff --git a/target/executable/convert/from_spatialdata_to_h5mu/.config.vsh.yaml b/target/executable/convert/from_spatialdata_to_h5mu/.config.vsh.yaml index 37587ea..ce38e91 100644 --- a/target/executable/convert/from_spatialdata_to_h5mu/.config.vsh.yaml +++ b/target/executable/convert/from_spatialdata_to_h5mu/.config.vsh.yaml @@ -101,7 +101,7 @@ repositories: - type: "vsh" name: "openpipeline" repo: "openpipeline" - tag: "v4.0.3" + tag: "v4.1.0" links: repository: "https://github.com/openpipelines-bio/openpipeline_spatial" docker_registry: "ghcr.io" @@ -190,9 +190,10 @@ engines: - type: "python" user: false packages: - - "anndata~=0.12.7" + - "anndata~=0.12.16" - "awkward" - - "mudata~=0.3.2" + - "scipy~=1.17.1" + - "mudata~=0.3.8" - "spatialdata~=0.7.2" - "pyarrow~=18.0.0" - "ome-zarr~=0.13.0" @@ -209,7 +210,7 @@ engines: - type: "python" user: false packages: - - "viashpy==0.9.0" + - "viashpy==0.10.0" github: - "openpipelines-bio/core#subdirectory=packages/python/openpipeline_testutils" upgrade: true @@ -223,8 +224,8 @@ build_info: engine: "docker|native" output: "target/executable/convert/from_spatialdata_to_h5mu" executable: "target/executable/convert/from_spatialdata_to_h5mu/from_spatialdata_to_h5mu" - viash_version: "0.9.4" - git_commit: "e087099616271bd0f11e825b7817ec14ebef62d7" + viash_version: "0.9.7" + git_commit: "4449aa6094a686af0a5fbe99b9aaafd01ae75aff" git_remote: "https://github.com/openpipelines-bio/openpipeline_spatial" package_config: name: "openpipeline_spatial" @@ -238,8 +239,8 @@ package_config: - type: "vsh" name: "openpipeline" repo: "openpipeline" - tag: "v4.0.3" - viash_version: "0.9.4" + tag: "v4.1.0" + viash_version: "0.9.7" source: "src" target: "target" config_mods: diff --git a/target/executable/convert/from_spatialdata_to_h5mu/from_spatialdata_to_h5mu b/target/executable/convert/from_spatialdata_to_h5mu/from_spatialdata_to_h5mu index 9dc356f..84bca3d 100755 --- a/target/executable/convert/from_spatialdata_to_h5mu/from_spatialdata_to_h5mu +++ b/target/executable/convert/from_spatialdata_to_h5mu/from_spatialdata_to_h5mu @@ -2,7 +2,7 @@ # from_spatialdata_to_h5mu main # -# This wrapper script is auto-generated by viash 0.9.4 and is thus a derivative +# This wrapper script is auto-generated by viash 0.9.7 and is thus a derivative # work thereof. This software comes with ABSOLUTELY NO WARRANTY from Data # Intuitive. # @@ -454,14 +454,14 @@ RUN apt-get update && \ rm -rf /var/lib/apt/lists/* RUN pip install --upgrade pip && \ - pip install --upgrade --no-cache-dir "anndata~=0.12.7" "awkward" "mudata~=0.3.2" "spatialdata~=0.7.2" "pyarrow~=18.0.0" "ome-zarr~=0.13.0" && \ + pip install --upgrade --no-cache-dir "anndata~=0.12.16" "awkward" "scipy~=1.17.1" "mudata~=0.3.8" "spatialdata~=0.7.2" "pyarrow~=18.0.0" "ome-zarr~=0.13.0" && \ python -c 'exec("try:\n import zarr; from importlib.metadata import version\nexcept ModuleNotFoundError:\n exit(0)\nelse: assert int(version(\"zarr\").partition(\".\")[0]) > 2")' LABEL org.opencontainers.image.authors="Dorien Roosen, Weiwei Schultz" LABEL org.opencontainers.image.description="Companion container for running component convert from_spatialdata_to_h5mu" -LABEL org.opencontainers.image.created="2026-05-22T11:53:10Z" +LABEL org.opencontainers.image.created="2026-06-01T12:50:40Z" LABEL org.opencontainers.image.source="https://github.com/openpipelines-bio/openpipeline_spatial" -LABEL org.opencontainers.image.revision="e087099616271bd0f11e825b7817ec14ebef62d7" +LABEL org.opencontainers.image.revision="4449aa6094a686af0a5fbe99b9aaafd01ae75aff" LABEL org.opencontainers.image.version="main" VIASHDOCKER diff --git a/target/executable/convert/from_xenium_to_h5mu/.config.vsh.yaml b/target/executable/convert/from_xenium_to_h5mu/.config.vsh.yaml index 2248375..1a6abd3 100644 --- a/target/executable/convert/from_xenium_to_h5mu/.config.vsh.yaml +++ b/target/executable/convert/from_xenium_to_h5mu/.config.vsh.yaml @@ -121,7 +121,7 @@ repositories: - type: "vsh" name: "openpipeline" repo: "openpipeline" - tag: "v4.0.3" + tag: "v4.1.0" links: repository: "https://github.com/openpipelines-bio/openpipeline_spatial" docker_registry: "ghcr.io" @@ -213,10 +213,11 @@ engines: - type: "python" user: false packages: - - "anndata~=0.12.7" + - "anndata~=0.12.16" - "awkward" - - "mudata~=0.3.2" - - "scanpy~=1.10.4" + - "scipy~=1.17.1" + - "mudata~=0.3.8" + - "scanpy~=1.11.4" - "pyarrow" git: - "https://codeberg.org/miurahr/zipfile-inflate64.git@v0.2" @@ -233,7 +234,7 @@ engines: - type: "python" user: false packages: - - "viashpy==0.9.0" + - "viashpy==0.10.0" upgrade: true entrypoint: [] cmd: null @@ -245,8 +246,8 @@ build_info: engine: "docker|native" output: "target/executable/convert/from_xenium_to_h5mu" executable: "target/executable/convert/from_xenium_to_h5mu/from_xenium_to_h5mu" - viash_version: "0.9.4" - git_commit: "e087099616271bd0f11e825b7817ec14ebef62d7" + viash_version: "0.9.7" + git_commit: "4449aa6094a686af0a5fbe99b9aaafd01ae75aff" git_remote: "https://github.com/openpipelines-bio/openpipeline_spatial" package_config: name: "openpipeline_spatial" @@ -260,8 +261,8 @@ package_config: - type: "vsh" name: "openpipeline" repo: "openpipeline" - tag: "v4.0.3" - viash_version: "0.9.4" + tag: "v4.1.0" + viash_version: "0.9.7" source: "src" target: "target" config_mods: diff --git a/target/executable/convert/from_xenium_to_h5mu/from_xenium_to_h5mu b/target/executable/convert/from_xenium_to_h5mu/from_xenium_to_h5mu index 9a2ee55..2418035 100755 --- a/target/executable/convert/from_xenium_to_h5mu/from_xenium_to_h5mu +++ b/target/executable/convert/from_xenium_to_h5mu/from_xenium_to_h5mu @@ -2,7 +2,7 @@ # from_xenium_to_h5mu main # -# This wrapper script is auto-generated by viash 0.9.4 and is thus a derivative +# This wrapper script is auto-generated by viash 0.9.7 and is thus a derivative # work thereof. This software comes with ABSOLUTELY NO WARRANTY from Data # Intuitive. # @@ -453,15 +453,15 @@ RUN apt-get update && \ rm -rf /var/lib/apt/lists/* RUN pip install --upgrade pip && \ - pip install --upgrade --no-cache-dir "anndata~=0.12.7" "awkward" "mudata~=0.3.2" "scanpy~=1.10.4" "pyarrow" && \ + pip install --upgrade --no-cache-dir "anndata~=0.12.16" "awkward" "scipy~=1.17.1" "mudata~=0.3.8" "scanpy~=1.11.4" "pyarrow" && \ pip install --upgrade --no-cache-dir "git+https://codeberg.org/miurahr/zipfile-inflate64.git@v0.2" && \ python -c 'exec("try:\n import zarr; from importlib.metadata import version\nexcept ModuleNotFoundError:\n exit(0)\nelse: assert int(version(\"zarr\").partition(\".\")[0]) > 2")' LABEL org.opencontainers.image.authors="Dorien Roosen" LABEL org.opencontainers.image.description="Companion container for running component convert from_xenium_to_h5mu" -LABEL org.opencontainers.image.created="2026-05-22T11:53:10Z" +LABEL org.opencontainers.image.created="2026-06-01T12:50:40Z" LABEL org.opencontainers.image.source="https://github.com/openpipelines-bio/openpipeline_spatial" -LABEL org.opencontainers.image.revision="e087099616271bd0f11e825b7817ec14ebef62d7" +LABEL org.opencontainers.image.revision="4449aa6094a686af0a5fbe99b9aaafd01ae75aff" LABEL org.opencontainers.image.version="main" VIASHDOCKER diff --git a/target/executable/convert/from_xenium_to_spatialdata/.config.vsh.yaml b/target/executable/convert/from_xenium_to_spatialdata/.config.vsh.yaml index 61cec7d..e601470 100644 --- a/target/executable/convert/from_xenium_to_spatialdata/.config.vsh.yaml +++ b/target/executable/convert/from_xenium_to_spatialdata/.config.vsh.yaml @@ -201,7 +201,7 @@ repositories: - type: "vsh" name: "openpipeline" repo: "openpipeline" - tag: "v4.0.3" + tag: "v4.1.0" links: repository: "https://github.com/openpipelines-bio/openpipeline_spatial" docker_registry: "ghcr.io" @@ -308,7 +308,7 @@ engines: - type: "python" user: false packages: - - "viashpy==0.9.0" + - "viashpy==0.10.0" github: - "openpipelines-bio/core#subdirectory=packages/python/openpipeline_testutils" upgrade: true @@ -326,8 +326,8 @@ build_info: engine: "docker|native" output: "target/executable/convert/from_xenium_to_spatialdata" executable: "target/executable/convert/from_xenium_to_spatialdata/from_xenium_to_spatialdata" - viash_version: "0.9.4" - git_commit: "e087099616271bd0f11e825b7817ec14ebef62d7" + viash_version: "0.9.7" + git_commit: "4449aa6094a686af0a5fbe99b9aaafd01ae75aff" git_remote: "https://github.com/openpipelines-bio/openpipeline_spatial" package_config: name: "openpipeline_spatial" @@ -341,8 +341,8 @@ package_config: - type: "vsh" name: "openpipeline" repo: "openpipeline" - tag: "v4.0.3" - viash_version: "0.9.4" + tag: "v4.1.0" + viash_version: "0.9.7" source: "src" target: "target" config_mods: diff --git a/target/executable/convert/from_xenium_to_spatialdata/from_xenium_to_spatialdata b/target/executable/convert/from_xenium_to_spatialdata/from_xenium_to_spatialdata index 94e2ab9..6edddfc 100755 --- a/target/executable/convert/from_xenium_to_spatialdata/from_xenium_to_spatialdata +++ b/target/executable/convert/from_xenium_to_spatialdata/from_xenium_to_spatialdata @@ -2,7 +2,7 @@ # from_xenium_to_spatialdata main # -# This wrapper script is auto-generated by viash 0.9.4 and is thus a derivative +# This wrapper script is auto-generated by viash 0.9.7 and is thus a derivative # work thereof. This software comes with ABSOLUTELY NO WARRANTY from Data # Intuitive. # @@ -459,9 +459,9 @@ RUN pip install --upgrade pip && \ LABEL org.opencontainers.image.authors="Dorien Roosen, Weiwei Schultz" LABEL org.opencontainers.image.description="Companion container for running component convert from_xenium_to_spatialdata" -LABEL org.opencontainers.image.created="2026-05-22T11:53:11Z" +LABEL org.opencontainers.image.created="2026-06-01T12:50:40Z" LABEL org.opencontainers.image.source="https://github.com/openpipelines-bio/openpipeline_spatial" -LABEL org.opencontainers.image.revision="e087099616271bd0f11e825b7817ec14ebef62d7" +LABEL org.opencontainers.image.revision="4449aa6094a686af0a5fbe99b9aaafd01ae75aff" LABEL org.opencontainers.image.version="main" VIASHDOCKER diff --git a/target/executable/convert/from_xenium_to_spatialexperiment/.config.vsh.yaml b/target/executable/convert/from_xenium_to_spatialexperiment/.config.vsh.yaml index bc7bb35..328f14e 100644 --- a/target/executable/convert/from_xenium_to_spatialexperiment/.config.vsh.yaml +++ b/target/executable/convert/from_xenium_to_spatialexperiment/.config.vsh.yaml @@ -115,7 +115,7 @@ repositories: - type: "vsh" name: "openpipeline" repo: "openpipeline" - tag: "v4.0.3" + tag: "v4.1.0" links: repository: "https://github.com/openpipelines-bio/openpipeline_spatial" docker_registry: "ghcr.io" @@ -231,8 +231,8 @@ build_info: engine: "docker|native" output: "target/executable/convert/from_xenium_to_spatialexperiment" executable: "target/executable/convert/from_xenium_to_spatialexperiment/from_xenium_to_spatialexperiment" - viash_version: "0.9.4" - git_commit: "e087099616271bd0f11e825b7817ec14ebef62d7" + viash_version: "0.9.7" + git_commit: "4449aa6094a686af0a5fbe99b9aaafd01ae75aff" git_remote: "https://github.com/openpipelines-bio/openpipeline_spatial" package_config: name: "openpipeline_spatial" @@ -246,8 +246,8 @@ package_config: - type: "vsh" name: "openpipeline" repo: "openpipeline" - tag: "v4.0.3" - viash_version: "0.9.4" + tag: "v4.1.0" + viash_version: "0.9.7" source: "src" target: "target" config_mods: diff --git a/target/executable/convert/from_xenium_to_spatialexperiment/from_xenium_to_spatialexperiment b/target/executable/convert/from_xenium_to_spatialexperiment/from_xenium_to_spatialexperiment index 65c7488..41ccfa0 100755 --- a/target/executable/convert/from_xenium_to_spatialexperiment/from_xenium_to_spatialexperiment +++ b/target/executable/convert/from_xenium_to_spatialexperiment/from_xenium_to_spatialexperiment @@ -2,7 +2,7 @@ # from_xenium_to_spatialexperiment main # -# This wrapper script is auto-generated by viash 0.9.4 and is thus a derivative +# This wrapper script is auto-generated by viash 0.9.7 and is thus a derivative # work thereof. This software comes with ABSOLUTELY NO WARRANTY from Data # Intuitive. # @@ -460,9 +460,9 @@ RUN Rscript -e 'options(warn = 2); if (!requireNamespace("BiocManager", quietly LABEL org.opencontainers.image.authors="Dorien Roosen" LABEL org.opencontainers.image.description="Companion container for running component convert from_xenium_to_spatialexperiment" -LABEL org.opencontainers.image.created="2026-05-22T11:53:10Z" +LABEL org.opencontainers.image.created="2026-06-01T12:50:39Z" LABEL org.opencontainers.image.source="https://github.com/openpipelines-bio/openpipeline_spatial" -LABEL org.opencontainers.image.revision="e087099616271bd0f11e825b7817ec14ebef62d7" +LABEL org.opencontainers.image.revision="4449aa6094a686af0a5fbe99b9aaafd01ae75aff" LABEL org.opencontainers.image.version="main" VIASHDOCKER diff --git a/target/executable/dataflow/concatenate_spatialdata/.config.vsh.yaml b/target/executable/dataflow/concatenate_spatialdata/.config.vsh.yaml index d090abf..0535efc 100644 --- a/target/executable/dataflow/concatenate_spatialdata/.config.vsh.yaml +++ b/target/executable/dataflow/concatenate_spatialdata/.config.vsh.yaml @@ -176,7 +176,7 @@ repositories: - type: "vsh" name: "openpipeline" repo: "openpipeline" - tag: "v4.0.3" + tag: "v4.1.0" links: repository: "https://github.com/openpipelines-bio/openpipeline_spatial" docker_registry: "ghcr.io" @@ -269,8 +269,9 @@ engines: - "spatialdata~=0.7.2" - "pyarrow~=18.0.0" - "ome-zarr~=0.13.0" - - "anndata~=0.12.7" + - "anndata~=0.12.16" - "awkward" + - "scipy~=1.17.1" upgrade: true test_setup: - type: "apt" @@ -280,7 +281,7 @@ engines: - type: "python" user: false packages: - - "viashpy==0.9.0" + - "viashpy==0.10.0" github: - "openpipelines-bio/core#subdirectory=packages/python/openpipeline_testutils" upgrade: true @@ -296,8 +297,8 @@ build_info: engine: "docker|native|native" output: "target/executable/dataflow/concatenate_spatialdata" executable: "target/executable/dataflow/concatenate_spatialdata/concatenate_spatialdata" - viash_version: "0.9.4" - git_commit: "e087099616271bd0f11e825b7817ec14ebef62d7" + viash_version: "0.9.7" + git_commit: "4449aa6094a686af0a5fbe99b9aaafd01ae75aff" git_remote: "https://github.com/openpipelines-bio/openpipeline_spatial" package_config: name: "openpipeline_spatial" @@ -311,8 +312,8 @@ package_config: - type: "vsh" name: "openpipeline" repo: "openpipeline" - tag: "v4.0.3" - viash_version: "0.9.4" + tag: "v4.1.0" + viash_version: "0.9.7" source: "src" target: "target" config_mods: diff --git a/target/executable/dataflow/concatenate_spatialdata/concatenate_spatialdata b/target/executable/dataflow/concatenate_spatialdata/concatenate_spatialdata index ad3305d..86cc5d8 100755 --- a/target/executable/dataflow/concatenate_spatialdata/concatenate_spatialdata +++ b/target/executable/dataflow/concatenate_spatialdata/concatenate_spatialdata @@ -2,7 +2,7 @@ # concatenate_spatialdata main # -# This wrapper script is auto-generated by viash 0.9.4 and is thus a derivative +# This wrapper script is auto-generated by viash 0.9.7 and is thus a derivative # work thereof. This software comes with ABSOLUTELY NO WARRANTY from Data # Intuitive. # @@ -454,13 +454,13 @@ RUN apt-get update && \ rm -rf /var/lib/apt/lists/* RUN pip install --upgrade pip && \ - pip install --upgrade --no-cache-dir "spatialdata~=0.7.2" "pyarrow~=18.0.0" "ome-zarr~=0.13.0" "anndata~=0.12.7" "awkward" + pip install --upgrade --no-cache-dir "spatialdata~=0.7.2" "pyarrow~=18.0.0" "ome-zarr~=0.13.0" "anndata~=0.12.16" "awkward" "scipy~=1.17.1" LABEL org.opencontainers.image.authors="Dorien Roosen, Luke Zappia" LABEL org.opencontainers.image.description="Companion container for running component dataflow concatenate_spatialdata" -LABEL org.opencontainers.image.created="2026-05-22T11:53:09Z" +LABEL org.opencontainers.image.created="2026-06-01T12:50:39Z" LABEL org.opencontainers.image.source="https://github.com/openpipelines-bio/openpipeline_spatial" -LABEL org.opencontainers.image.revision="e087099616271bd0f11e825b7817ec14ebef62d7" +LABEL org.opencontainers.image.revision="4449aa6094a686af0a5fbe99b9aaafd01ae75aff" LABEL org.opencontainers.image.version="main" VIASHDOCKER diff --git a/target/executable/dataflow/move_layer_spatialdata/.config.vsh.yaml b/target/executable/dataflow/move_layer_spatialdata/.config.vsh.yaml index 1fd64e9..6caefa6 100644 --- a/target/executable/dataflow/move_layer_spatialdata/.config.vsh.yaml +++ b/target/executable/dataflow/move_layer_spatialdata/.config.vsh.yaml @@ -123,7 +123,7 @@ repositories: - type: "vsh" name: "openpipeline" repo: "openpipeline" - tag: "v4.0.3" + tag: "v4.1.0" links: repository: "https://github.com/openpipelines-bio/openpipeline_spatial" docker_registry: "ghcr.io" @@ -225,7 +225,7 @@ engines: - type: "python" user: false packages: - - "viashpy==0.9.0" + - "viashpy==0.10.0" github: - "openpipelines-bio/core#subdirectory=packages/python/openpipeline_testutils" upgrade: true @@ -241,8 +241,8 @@ build_info: engine: "docker|native|native" output: "target/executable/dataflow/move_layer_spatialdata" executable: "target/executable/dataflow/move_layer_spatialdata/move_layer_spatialdata" - viash_version: "0.9.4" - git_commit: "e087099616271bd0f11e825b7817ec14ebef62d7" + viash_version: "0.9.7" + git_commit: "4449aa6094a686af0a5fbe99b9aaafd01ae75aff" git_remote: "https://github.com/openpipelines-bio/openpipeline_spatial" package_config: name: "openpipeline_spatial" @@ -256,8 +256,8 @@ package_config: - type: "vsh" name: "openpipeline" repo: "openpipeline" - tag: "v4.0.3" - viash_version: "0.9.4" + tag: "v4.1.0" + viash_version: "0.9.7" source: "src" target: "target" config_mods: diff --git a/target/executable/dataflow/move_layer_spatialdata/move_layer_spatialdata b/target/executable/dataflow/move_layer_spatialdata/move_layer_spatialdata index 0330040..5ebeb61 100755 --- a/target/executable/dataflow/move_layer_spatialdata/move_layer_spatialdata +++ b/target/executable/dataflow/move_layer_spatialdata/move_layer_spatialdata @@ -2,7 +2,7 @@ # move_layer_spatialdata main # -# This wrapper script is auto-generated by viash 0.9.4 and is thus a derivative +# This wrapper script is auto-generated by viash 0.9.7 and is thus a derivative # work thereof. This software comes with ABSOLUTELY NO WARRANTY from Data # Intuitive. # @@ -458,9 +458,9 @@ RUN pip install --upgrade pip && \ LABEL org.opencontainers.image.authors="Dorien Roosen, Luke Zappia" LABEL org.opencontainers.image.description="Companion container for running component dataflow move_layer_spatialdata" -LABEL org.opencontainers.image.created="2026-05-22T11:53:08Z" +LABEL org.opencontainers.image.created="2026-06-01T12:50:38Z" LABEL org.opencontainers.image.source="https://github.com/openpipelines-bio/openpipeline_spatial" -LABEL org.opencontainers.image.revision="e087099616271bd0f11e825b7817ec14ebef62d7" +LABEL org.opencontainers.image.revision="4449aa6094a686af0a5fbe99b9aaafd01ae75aff" LABEL org.opencontainers.image.version="main" VIASHDOCKER diff --git a/target/executable/feature_annotation/spatial_autocorr/.config.vsh.yaml b/target/executable/feature_annotation/spatial_autocorr/.config.vsh.yaml index 0f26a14..f743b05 100644 --- a/target/executable/feature_annotation/spatial_autocorr/.config.vsh.yaml +++ b/target/executable/feature_annotation/spatial_autocorr/.config.vsh.yaml @@ -158,7 +158,7 @@ repositories: - type: "vsh" name: "openpipeline" repo: "openpipeline" - tag: "v4.0.3" + tag: "v4.1.0" links: repository: "https://github.com/openpipelines-bio/openpipeline_spatial" docker_registry: "ghcr.io" @@ -247,11 +247,12 @@ engines: - type: "python" user: false packages: - - "anndata~=0.12.7" + - "anndata~=0.12.16" - "awkward" - - "mudata~=0.3.2" - - "scanpy~=1.10.4" - - "scanpy~=1.10.4" + - "scipy~=1.17.1" + - "mudata~=0.3.8" + - "scanpy~=1.11.4" + - "scanpy~=1.11.4" - "squidpy~=1.8.1" script: - "exec(\"try:\\n import zarr; from importlib.metadata import version\\nexcept\ @@ -277,8 +278,8 @@ build_info: engine: "docker|native|native" output: "target/executable/feature_annotation/spatial_autocorr" executable: "target/executable/feature_annotation/spatial_autocorr/spatial_autocorr" - viash_version: "0.9.4" - git_commit: "e087099616271bd0f11e825b7817ec14ebef62d7" + viash_version: "0.9.7" + git_commit: "4449aa6094a686af0a5fbe99b9aaafd01ae75aff" git_remote: "https://github.com/openpipelines-bio/openpipeline_spatial" package_config: name: "openpipeline_spatial" @@ -292,8 +293,8 @@ package_config: - type: "vsh" name: "openpipeline" repo: "openpipeline" - tag: "v4.0.3" - viash_version: "0.9.4" + tag: "v4.1.0" + viash_version: "0.9.7" source: "src" target: "target" config_mods: diff --git a/target/executable/feature_annotation/spatial_autocorr/spatial_autocorr b/target/executable/feature_annotation/spatial_autocorr/spatial_autocorr index 1eef8e0..ace4f2d 100755 --- a/target/executable/feature_annotation/spatial_autocorr/spatial_autocorr +++ b/target/executable/feature_annotation/spatial_autocorr/spatial_autocorr @@ -2,7 +2,7 @@ # spatial_autocorr main # -# This wrapper script is auto-generated by viash 0.9.4 and is thus a derivative +# This wrapper script is auto-generated by viash 0.9.7 and is thus a derivative # work thereof. This software comes with ABSOLUTELY NO WARRANTY from Data # Intuitive. # @@ -450,13 +450,13 @@ RUN apt-get update && \ rm -rf /var/lib/apt/lists/* RUN pip install --upgrade pip && \ - pip install --upgrade --no-cache-dir "anndata~=0.12.7" "awkward" "mudata~=0.3.2" "scanpy~=1.10.4" "scanpy~=1.10.4" "squidpy~=1.8.1" && \ + pip install --upgrade --no-cache-dir "anndata~=0.12.16" "awkward" "scipy~=1.17.1" "mudata~=0.3.8" "scanpy~=1.11.4" "scanpy~=1.11.4" "squidpy~=1.8.1" && \ python -c 'exec("try:\n import zarr; from importlib.metadata import version\nexcept ModuleNotFoundError:\n exit(0)\nelse: assert int(version(\"zarr\").partition(\".\")[0]) > 2")' LABEL org.opencontainers.image.description="Companion container for running component feature_annotation spatial_autocorr" -LABEL org.opencontainers.image.created="2026-05-22T11:53:11Z" +LABEL org.opencontainers.image.created="2026-06-01T12:50:41Z" LABEL org.opencontainers.image.source="https://github.com/openpipelines-bio/openpipeline_spatial" -LABEL org.opencontainers.image.revision="e087099616271bd0f11e825b7817ec14ebef62d7" +LABEL org.opencontainers.image.revision="4449aa6094a686af0a5fbe99b9aaafd01ae75aff" LABEL org.opencontainers.image.version="main" VIASHDOCKER diff --git a/target/executable/feature_annotation/xenium_spatial_statistics/.config.vsh.yaml b/target/executable/feature_annotation/xenium_spatial_statistics/.config.vsh.yaml index 6856790..b77d621 100644 --- a/target/executable/feature_annotation/xenium_spatial_statistics/.config.vsh.yaml +++ b/target/executable/feature_annotation/xenium_spatial_statistics/.config.vsh.yaml @@ -126,7 +126,7 @@ repositories: - type: "vsh" name: "openpipeline" repo: "openpipeline" - tag: "v4.0.3" + tag: "v4.1.0" links: repository: "https://github.com/openpipelines-bio/openpipeline_spatial" docker_registry: "ghcr.io" @@ -216,11 +216,12 @@ engines: - type: "python" user: false packages: - - "anndata~=0.12.7" + - "anndata~=0.12.16" - "awkward" - - "mudata~=0.3.2" - - "scanpy~=1.10.4" - - "scanpy~=1.10.4" + - "scipy~=1.17.1" + - "mudata~=0.3.8" + - "scanpy~=1.11.4" + - "scanpy~=1.11.4" - "squidpy~=1.8.1" - "scikit-learn" script: @@ -247,8 +248,8 @@ build_info: engine: "docker|native|native" output: "target/executable/feature_annotation/xenium_spatial_statistics" executable: "target/executable/feature_annotation/xenium_spatial_statistics/xenium_spatial_statistics" - viash_version: "0.9.4" - git_commit: "e087099616271bd0f11e825b7817ec14ebef62d7" + viash_version: "0.9.7" + git_commit: "4449aa6094a686af0a5fbe99b9aaafd01ae75aff" git_remote: "https://github.com/openpipelines-bio/openpipeline_spatial" package_config: name: "openpipeline_spatial" @@ -262,8 +263,8 @@ package_config: - type: "vsh" name: "openpipeline" repo: "openpipeline" - tag: "v4.0.3" - viash_version: "0.9.4" + tag: "v4.1.0" + viash_version: "0.9.7" source: "src" target: "target" config_mods: diff --git a/target/executable/feature_annotation/xenium_spatial_statistics/xenium_spatial_statistics b/target/executable/feature_annotation/xenium_spatial_statistics/xenium_spatial_statistics index e2fa8d4..f5a2884 100755 --- a/target/executable/feature_annotation/xenium_spatial_statistics/xenium_spatial_statistics +++ b/target/executable/feature_annotation/xenium_spatial_statistics/xenium_spatial_statistics @@ -2,7 +2,7 @@ # xenium_spatial_statistics main # -# This wrapper script is auto-generated by viash 0.9.4 and is thus a derivative +# This wrapper script is auto-generated by viash 0.9.7 and is thus a derivative # work thereof. This software comes with ABSOLUTELY NO WARRANTY from Data # Intuitive. # @@ -450,13 +450,13 @@ RUN apt-get update && \ rm -rf /var/lib/apt/lists/* RUN pip install --upgrade pip && \ - pip install --upgrade --no-cache-dir "anndata~=0.12.7" "awkward" "mudata~=0.3.2" "scanpy~=1.10.4" "scanpy~=1.10.4" "squidpy~=1.8.1" "scikit-learn" && \ + pip install --upgrade --no-cache-dir "anndata~=0.12.16" "awkward" "scipy~=1.17.1" "mudata~=0.3.8" "scanpy~=1.11.4" "scanpy~=1.11.4" "squidpy~=1.8.1" "scikit-learn" && \ python -c 'exec("try:\n import zarr; from importlib.metadata import version\nexcept ModuleNotFoundError:\n exit(0)\nelse: assert int(version(\"zarr\").partition(\".\")[0]) > 2")' LABEL org.opencontainers.image.description="Companion container for running component feature_annotation xenium_spatial_statistics" -LABEL org.opencontainers.image.created="2026-05-22T11:53:11Z" +LABEL org.opencontainers.image.created="2026-06-01T12:50:41Z" LABEL org.opencontainers.image.source="https://github.com/openpipelines-bio/openpipeline_spatial" -LABEL org.opencontainers.image.revision="e087099616271bd0f11e825b7817ec14ebef62d7" +LABEL org.opencontainers.image.revision="4449aa6094a686af0a5fbe99b9aaafd01ae75aff" LABEL org.opencontainers.image.version="main" VIASHDOCKER diff --git a/target/executable/mapping/spaceranger_count/.config.vsh.yaml b/target/executable/mapping/spaceranger_count/.config.vsh.yaml index f8eb560..a032ee4 100644 --- a/target/executable/mapping/spaceranger_count/.config.vsh.yaml +++ b/target/executable/mapping/spaceranger_count/.config.vsh.yaml @@ -330,7 +330,7 @@ repositories: - type: "vsh" name: "openpipeline" repo: "openpipeline" - tag: "v4.0.3" + tag: "v4.1.0" keywords: - "spaceranger" links: @@ -424,7 +424,7 @@ engines: - type: "python" user: false packages: - - "viashpy==0.9.0" + - "viashpy==0.10.0" github: - "openpipelines-bio/core#subdirectory=packages/python/openpipeline_testutils" upgrade: true @@ -438,8 +438,8 @@ build_info: engine: "docker|native" output: "target/executable/mapping/spaceranger_count" executable: "target/executable/mapping/spaceranger_count/spaceranger_count" - viash_version: "0.9.4" - git_commit: "e087099616271bd0f11e825b7817ec14ebef62d7" + viash_version: "0.9.7" + git_commit: "4449aa6094a686af0a5fbe99b9aaafd01ae75aff" git_remote: "https://github.com/openpipelines-bio/openpipeline_spatial" package_config: name: "openpipeline_spatial" @@ -453,8 +453,8 @@ package_config: - type: "vsh" name: "openpipeline" repo: "openpipeline" - tag: "v4.0.3" - viash_version: "0.9.4" + tag: "v4.1.0" + viash_version: "0.9.7" source: "src" target: "target" config_mods: diff --git a/target/executable/mapping/spaceranger_count/spaceranger_count b/target/executable/mapping/spaceranger_count/spaceranger_count index 1ff7cd6..082e49c 100755 --- a/target/executable/mapping/spaceranger_count/spaceranger_count +++ b/target/executable/mapping/spaceranger_count/spaceranger_count @@ -2,7 +2,7 @@ # spaceranger_count main # -# This wrapper script is auto-generated by viash 0.9.4 and is thus a derivative +# This wrapper script is auto-generated by viash 0.9.7 and is thus a derivative # work thereof. This software comes with ABSOLUTELY NO WARRANTY from Data # Intuitive. # @@ -453,9 +453,9 @@ apt upgrade -y && apt install -y procps && rm -rf /var/lib/apt/lists/* LABEL org.opencontainers.image.authors="Jakub Majercik" LABEL org.opencontainers.image.description="Companion container for running component mapping spaceranger_count" -LABEL org.opencontainers.image.created="2026-05-22T11:53:11Z" +LABEL org.opencontainers.image.created="2026-06-01T12:50:41Z" LABEL org.opencontainers.image.source="https://github.com/openpipelines-bio/openpipeline_spatial" -LABEL org.opencontainers.image.revision="e087099616271bd0f11e825b7817ec14ebef62d7" +LABEL org.opencontainers.image.revision="4449aa6094a686af0a5fbe99b9aaafd01ae75aff" LABEL org.opencontainers.image.version="main" VIASHDOCKER diff --git a/target/executable/neighbors/join_graphs/.config.vsh.yaml b/target/executable/neighbors/join_graphs/.config.vsh.yaml index 1bba27a..b35627b 100644 --- a/target/executable/neighbors/join_graphs/.config.vsh.yaml +++ b/target/executable/neighbors/join_graphs/.config.vsh.yaml @@ -142,7 +142,7 @@ repositories: - type: "vsh" name: "openpipeline" repo: "openpipeline" - tag: "v4.0.3" + tag: "v4.1.0" links: repository: "https://github.com/openpipelines-bio/openpipeline_spatial" docker_registry: "ghcr.io" @@ -232,10 +232,11 @@ engines: - type: "python" user: false packages: - - "scanpy~=1.10.4" - - "anndata~=0.12.7" + - "scanpy~=1.11.4" + - "anndata~=0.12.16" - "awkward" - - "mudata~=0.3.2" + - "scipy~=1.17.1" + - "mudata~=0.3.8" script: - "exec(\"try:\\n import zarr; from importlib.metadata import version\\nexcept\ \ ModuleNotFoundError:\\n exit(0)\\nelse: assert int(version(\\\"zarr\\\"\ @@ -249,7 +250,7 @@ engines: - type: "python" user: false packages: - - "viashpy==0.9.0" + - "viashpy==0.10.0" github: - "openpipelines-bio/core#subdirectory=packages/python/openpipeline_testutils" upgrade: true @@ -263,8 +264,8 @@ build_info: engine: "docker|native" output: "target/executable/neighbors/join_graphs" executable: "target/executable/neighbors/join_graphs/join_graphs" - viash_version: "0.9.4" - git_commit: "e087099616271bd0f11e825b7817ec14ebef62d7" + viash_version: "0.9.7" + git_commit: "4449aa6094a686af0a5fbe99b9aaafd01ae75aff" git_remote: "https://github.com/openpipelines-bio/openpipeline_spatial" package_config: name: "openpipeline_spatial" @@ -278,8 +279,8 @@ package_config: - type: "vsh" name: "openpipeline" repo: "openpipeline" - tag: "v4.0.3" - viash_version: "0.9.4" + tag: "v4.1.0" + viash_version: "0.9.7" source: "src" target: "target" config_mods: diff --git a/target/executable/neighbors/join_graphs/join_graphs b/target/executable/neighbors/join_graphs/join_graphs index e04be61..6b63099 100755 --- a/target/executable/neighbors/join_graphs/join_graphs +++ b/target/executable/neighbors/join_graphs/join_graphs @@ -2,7 +2,7 @@ # join_graphs main # -# This wrapper script is auto-generated by viash 0.9.4 and is thus a derivative +# This wrapper script is auto-generated by viash 0.9.7 and is thus a derivative # work thereof. This software comes with ABSOLUTELY NO WARRANTY from Data # Intuitive. # @@ -453,14 +453,14 @@ RUN apt-get update && \ rm -rf /var/lib/apt/lists/* RUN pip install --upgrade pip && \ - pip install --upgrade --no-cache-dir "scanpy~=1.10.4" "anndata~=0.12.7" "awkward" "mudata~=0.3.2" && \ + pip install --upgrade --no-cache-dir "scanpy~=1.11.4" "anndata~=0.12.16" "awkward" "scipy~=1.17.1" "mudata~=0.3.8" && \ python -c 'exec("try:\n import zarr; from importlib.metadata import version\nexcept ModuleNotFoundError:\n exit(0)\nelse: assert int(version(\"zarr\").partition(\".\")[0]) > 2")' LABEL org.opencontainers.image.authors="Jakub Majercik" LABEL org.opencontainers.image.description="Companion container for running component neighbors join_graphs" -LABEL org.opencontainers.image.created="2026-05-22T11:53:10Z" +LABEL org.opencontainers.image.created="2026-06-01T12:50:40Z" LABEL org.opencontainers.image.source="https://github.com/openpipelines-bio/openpipeline_spatial" -LABEL org.opencontainers.image.revision="e087099616271bd0f11e825b7817ec14ebef62d7" +LABEL org.opencontainers.image.revision="4449aa6094a686af0a5fbe99b9aaafd01ae75aff" LABEL org.opencontainers.image.version="main" VIASHDOCKER diff --git a/target/executable/neighbors/spatial_neighborhood_graph/.config.vsh.yaml b/target/executable/neighbors/spatial_neighborhood_graph/.config.vsh.yaml index 863af8b..e707bae 100644 --- a/target/executable/neighbors/spatial_neighborhood_graph/.config.vsh.yaml +++ b/target/executable/neighbors/spatial_neighborhood_graph/.config.vsh.yaml @@ -147,7 +147,7 @@ repositories: - type: "vsh" name: "openpipeline" repo: "openpipeline" - tag: "v4.0.3" + tag: "v4.1.0" links: repository: "https://github.com/openpipelines-bio/openpipeline_spatial" docker_registry: "ghcr.io" @@ -237,11 +237,12 @@ engines: - type: "python" user: false packages: - - "scanpy~=1.10.4" + - "scanpy~=1.11.4" - "squidpy~=1.8.1" - - "anndata~=0.12.7" + - "anndata~=0.12.16" - "awkward" - - "mudata~=0.3.2" + - "scipy~=1.17.1" + - "mudata~=0.3.8" script: - "exec(\"try:\\n import zarr; from importlib.metadata import version\\nexcept\ \ ModuleNotFoundError:\\n exit(0)\\nelse: assert int(version(\\\"zarr\\\"\ @@ -255,7 +256,7 @@ engines: - type: "python" user: false packages: - - "viashpy==0.9.0" + - "viashpy==0.10.0" github: - "openpipelines-bio/core#subdirectory=packages/python/openpipeline_testutils" upgrade: true @@ -269,8 +270,8 @@ build_info: engine: "docker|native" output: "target/executable/neighbors/spatial_neighborhood_graph" executable: "target/executable/neighbors/spatial_neighborhood_graph/spatial_neighborhood_graph" - viash_version: "0.9.4" - git_commit: "e087099616271bd0f11e825b7817ec14ebef62d7" + viash_version: "0.9.7" + git_commit: "4449aa6094a686af0a5fbe99b9aaafd01ae75aff" git_remote: "https://github.com/openpipelines-bio/openpipeline_spatial" package_config: name: "openpipeline_spatial" @@ -284,8 +285,8 @@ package_config: - type: "vsh" name: "openpipeline" repo: "openpipeline" - tag: "v4.0.3" - viash_version: "0.9.4" + tag: "v4.1.0" + viash_version: "0.9.7" source: "src" target: "target" config_mods: diff --git a/target/executable/neighbors/spatial_neighborhood_graph/spatial_neighborhood_graph b/target/executable/neighbors/spatial_neighborhood_graph/spatial_neighborhood_graph index f1638d5..69149aa 100755 --- a/target/executable/neighbors/spatial_neighborhood_graph/spatial_neighborhood_graph +++ b/target/executable/neighbors/spatial_neighborhood_graph/spatial_neighborhood_graph @@ -2,7 +2,7 @@ # spatial_neighborhood_graph main # -# This wrapper script is auto-generated by viash 0.9.4 and is thus a derivative +# This wrapper script is auto-generated by viash 0.9.7 and is thus a derivative # work thereof. This software comes with ABSOLUTELY NO WARRANTY from Data # Intuitive. # @@ -453,14 +453,14 @@ RUN apt-get update && \ rm -rf /var/lib/apt/lists/* RUN pip install --upgrade pip && \ - pip install --upgrade --no-cache-dir "scanpy~=1.10.4" "squidpy~=1.8.1" "anndata~=0.12.7" "awkward" "mudata~=0.3.2" && \ + pip install --upgrade --no-cache-dir "scanpy~=1.11.4" "squidpy~=1.8.1" "anndata~=0.12.16" "awkward" "scipy~=1.17.1" "mudata~=0.3.8" && \ python -c 'exec("try:\n import zarr; from importlib.metadata import version\nexcept ModuleNotFoundError:\n exit(0)\nelse: assert int(version(\"zarr\").partition(\".\")[0]) > 2")' LABEL org.opencontainers.image.authors="Dorien Roosen" LABEL org.opencontainers.image.description="Companion container for running component neighbors spatial_neighborhood_graph" -LABEL org.opencontainers.image.created="2026-05-22T11:53:10Z" +LABEL org.opencontainers.image.created="2026-06-01T12:50:40Z" LABEL org.opencontainers.image.source="https://github.com/openpipelines-bio/openpipeline_spatial" -LABEL org.opencontainers.image.revision="e087099616271bd0f11e825b7817ec14ebef62d7" +LABEL org.opencontainers.image.revision="4449aa6094a686af0a5fbe99b9aaafd01ae75aff" LABEL org.opencontainers.image.version="main" VIASHDOCKER diff --git a/target/executable/nichecompass/gene_program_mask/.config.vsh.yaml b/target/executable/nichecompass/gene_program_mask/.config.vsh.yaml index 11cfb28..33fbd60 100644 --- a/target/executable/nichecompass/gene_program_mask/.config.vsh.yaml +++ b/target/executable/nichecompass/gene_program_mask/.config.vsh.yaml @@ -397,7 +397,7 @@ repositories: - type: "vsh" name: "openpipeline" repo: "openpipeline" - tag: "v4.0.3" + tag: "v4.1.0" links: repository: "https://github.com/openpipelines-bio/openpipeline_spatial" docker_registry: "ghcr.io" @@ -516,7 +516,7 @@ engines: - type: "python" user: false packages: - - "viashpy==0.9.0" + - "viashpy==0.10.0" github: - "openpipelines-bio/core#subdirectory=packages/python/openpipeline_testutils" upgrade: true @@ -530,8 +530,8 @@ build_info: engine: "docker|native" output: "target/executable/nichecompass/gene_program_mask" executable: "target/executable/nichecompass/gene_program_mask/gene_program_mask" - viash_version: "0.9.4" - git_commit: "e087099616271bd0f11e825b7817ec14ebef62d7" + viash_version: "0.9.7" + git_commit: "4449aa6094a686af0a5fbe99b9aaafd01ae75aff" git_remote: "https://github.com/openpipelines-bio/openpipeline_spatial" package_config: name: "openpipeline_spatial" @@ -545,8 +545,8 @@ package_config: - type: "vsh" name: "openpipeline" repo: "openpipeline" - tag: "v4.0.3" - viash_version: "0.9.4" + tag: "v4.1.0" + viash_version: "0.9.7" source: "src" target: "target" config_mods: diff --git a/target/executable/nichecompass/gene_program_mask/gene_program_mask b/target/executable/nichecompass/gene_program_mask/gene_program_mask index a0703c9..3c3636e 100755 --- a/target/executable/nichecompass/gene_program_mask/gene_program_mask +++ b/target/executable/nichecompass/gene_program_mask/gene_program_mask @@ -2,7 +2,7 @@ # gene_program_mask main # -# This wrapper script is auto-generated by viash 0.9.4 and is thus a derivative +# This wrapper script is auto-generated by viash 0.9.7 and is thus a derivative # work thereof. This software comes with ABSOLUTELY NO WARRANTY from Data # Intuitive. # @@ -473,9 +473,9 @@ EOF LABEL org.opencontainers.image.authors="Dorien Roosen, Jakub Majercik, Weiwei Schultz" LABEL org.opencontainers.image.description="Companion container for running component nichecompass gene_program_mask" -LABEL org.opencontainers.image.created="2026-05-22T11:53:10Z" +LABEL org.opencontainers.image.created="2026-06-01T12:50:40Z" LABEL org.opencontainers.image.source="https://github.com/openpipelines-bio/openpipeline_spatial" -LABEL org.opencontainers.image.revision="e087099616271bd0f11e825b7817ec14ebef62d7" +LABEL org.opencontainers.image.revision="4449aa6094a686af0a5fbe99b9aaafd01ae75aff" LABEL org.opencontainers.image.version="main" VIASHDOCKER diff --git a/target/nextflow/convert/from_cells2stats_to_h5mu/.config.vsh.yaml b/target/nextflow/convert/from_cells2stats_to_h5mu/.config.vsh.yaml index 4e554a5..7d4e060 100644 --- a/target/nextflow/convert/from_cells2stats_to_h5mu/.config.vsh.yaml +++ b/target/nextflow/convert/from_cells2stats_to_h5mu/.config.vsh.yaml @@ -179,7 +179,7 @@ repositories: - type: "vsh" name: "openpipeline" repo: "openpipeline" - tag: "v4.0.3" + tag: "v4.1.0" links: repository: "https://github.com/openpipelines-bio/openpipeline_spatial" docker_registry: "ghcr.io" @@ -271,9 +271,10 @@ engines: - type: "python" user: false packages: - - "anndata~=0.12.7" + - "anndata~=0.12.16" - "awkward" - - "mudata~=0.3.2" + - "scipy~=1.17.1" + - "mudata~=0.3.8" - "pyarrow" git: - "https://codeberg.org/miurahr/zipfile-inflate64.git@v0.2" @@ -290,7 +291,7 @@ engines: - type: "python" user: false packages: - - "viashpy==0.9.0" + - "viashpy==0.10.0" upgrade: true entrypoint: [] cmd: null @@ -302,8 +303,8 @@ build_info: engine: "docker|native" output: "target/nextflow/convert/from_cells2stats_to_h5mu" executable: "target/nextflow/convert/from_cells2stats_to_h5mu/main.nf" - viash_version: "0.9.4" - git_commit: "e087099616271bd0f11e825b7817ec14ebef62d7" + viash_version: "0.9.7" + git_commit: "4449aa6094a686af0a5fbe99b9aaafd01ae75aff" git_remote: "https://github.com/openpipelines-bio/openpipeline_spatial" package_config: name: "openpipeline_spatial" @@ -317,8 +318,8 @@ package_config: - type: "vsh" name: "openpipeline" repo: "openpipeline" - tag: "v4.0.3" - viash_version: "0.9.4" + tag: "v4.1.0" + viash_version: "0.9.7" source: "src" target: "target" config_mods: diff --git a/target/nextflow/convert/from_cells2stats_to_h5mu/main.nf b/target/nextflow/convert/from_cells2stats_to_h5mu/main.nf index 322a059..d9e886f 100644 --- a/target/nextflow/convert/from_cells2stats_to_h5mu/main.nf +++ b/target/nextflow/convert/from_cells2stats_to_h5mu/main.nf @@ -1,6 +1,6 @@ // from_cells2stats_to_h5mu main // -// This wrapper script is auto-generated by viash 0.9.4 and is thus a derivative +// This wrapper script is auto-generated by viash 0.9.7 and is thus a derivative // work thereof. This software comes with ABSOLUTELY NO WARRANTY from Data // Intuitive. // @@ -1353,47 +1353,42 @@ def readCsv(file_path) { def splitRegex = java.util.regex.Pattern.compile(''',(?=(?:[^"]*"[^"]*")*[^"]*$)''') def removeQuote = java.util.regex.Pattern.compile('''"(.*)"''') - def br = java.nio.file.Files.newBufferedReader(inputFile) + java.nio.file.Files.newBufferedReader(inputFile).withCloseable { br -> + def row = 0 + def header = null + def line - def row = -1 - def header = null - while (br.ready() && header == null) { - def line = br.readLine() - row++ - if (!line.startsWith("#")) { - header = splitRegex.split(line, -1).collect{field -> - m = removeQuote.matcher(field) - m.find() ? m.replaceFirst('$1') : field - } - } - } - assert header != null: "CSV file should contain a header" - - while (br.ready()) { - def line = br.readLine() - row++ - if (line == null) { - br.close() - break - } - - if (!line.startsWith("#")) { - def predata = splitRegex.split(line, -1) - def data = predata.collect{field -> - if (field == "") { - return null - } - def m = removeQuote.matcher(field) - if (m.find()) { - return m.replaceFirst('$1') - } else { - return field + while (header == null && (line = br.readLine()) != null) { + if (!line.startsWith("#")) { + header = splitRegex.split(line, -1).collect { field -> + def m = removeQuote.matcher(field) + m.find() ? m.replaceFirst('$1') : field } } - assert header.size() == data.size(): "Row $row should contain the same number as fields as the header" - - def dataMap = [header, data].transpose().collectEntries().findAll{it.value != null} - output.add(dataMap) + row++ + } + assert header != null : "CSV file should contain a header" + + while ((line = br.readLine()) != null) { + row++ + if (!line.startsWith("#")) { + def predata = splitRegex.split(line, -1) + def data = predata.collect { field -> + if (field == "") { + return null + } + def m = removeQuote.matcher(field) + if (m.find()) { + return m.replaceFirst('$1') + } else { + return field + } + } + assert header.size() == data.size() : "Row $row should contain the same number as fields as the header" + + def dataMap = [header, data].transpose().collectEntries().findAll { it.value != null } + output.add(dataMap) + } } } @@ -1709,10 +1704,25 @@ process publishFilesProc { ] .transpose() .collectMany{infile, outfile -> - if (infile.toString() != outfile.toString()) { + def infileString = infile.toString() + def outfileString = outfile.toString() + if (infileString != outfileString) { + /* Trailing slashes are removed from both the source and destination arguments. + From source arguments, this is useful when a source argument may have a trailing slash + and specify a symbolic link to a directory. Without removing the slash, cp will dereference + the symbolic link. + See https://www.gnu.org/software/coreutils/manual/html_node/Trailing-slashes.html#Trailing-slashes-1 + + For the destination path addding a trailing slash is a problem when publishing directories: + it requires the destination directory to exist. This fails because we only create the parent + directories first. + */ + def regexTrailingSlashes = ~/\/+$/ + def infileNoTrailingSlash = infileString - regexTrailingSlashes + def outfileNoTrailingSlash = outfileString - regexTrailingSlashes [ - "[ -d \"\$(dirname '${outfile.toString()}')\" ] || mkdir -p \"\$(dirname '${outfile.toString()}')\"", - "cp -r '${infile.toString()}' '${outfile.toString()}'" + "[ -d \"\$(dirname '${outfileNoTrailingSlash}')\" ] || mkdir -p \"\$(dirname '${outfileNoTrailingSlash}')\"", + "cp -a '${infileNoTrailingSlash}' '${outfileNoTrailingSlash}'" ] } else { // no need to copy if infile is the same as outfile @@ -3246,7 +3256,7 @@ meta = [ "type" : "vsh", "name" : "openpipeline", "repo" : "openpipeline", - "tag" : "v4.0.3" + "tag" : "v4.1.0" } ], "links" : { @@ -3357,9 +3367,10 @@ meta = [ "type" : "python", "user" : false, "packages" : [ - "anndata~=0.12.7", + "anndata~=0.12.16", "awkward", - "mudata~=0.3.2", + "scipy~=1.17.1", + "mudata~=0.3.8", "pyarrow" ], "git" : [ @@ -3383,7 +3394,7 @@ meta = [ "type" : "python", "user" : false, "packages" : [ - "viashpy==0.9.0" + "viashpy==0.10.0" ], "upgrade" : true } @@ -3399,8 +3410,8 @@ meta = [ "runner" : "nextflow", "engine" : "docker|native", "output" : "/workdir/root/repo/target/nextflow/convert/from_cells2stats_to_h5mu", - "viash_version" : "0.9.4", - "git_commit" : "e087099616271bd0f11e825b7817ec14ebef62d7", + "viash_version" : "0.9.7", + "git_commit" : "4449aa6094a686af0a5fbe99b9aaafd01ae75aff", "git_remote" : "https://github.com/openpipelines-bio/openpipeline_spatial" }, "package_config" : { @@ -3420,10 +3431,10 @@ meta = [ "type" : "vsh", "name" : "openpipeline", "repo" : "openpipeline", - "tag" : "v4.0.3" + "tag" : "v4.1.0" } ], - "viash_version" : "0.9.4", + "viash_version" : "0.9.7", "source" : "/workdir/root/repo/src", "target" : "/workdir/root/repo/target", "config_mods" : [ diff --git a/target/nextflow/convert/from_cosmx_to_h5mu/.config.vsh.yaml b/target/nextflow/convert/from_cosmx_to_h5mu/.config.vsh.yaml index 6fa0329..3bb2248 100644 --- a/target/nextflow/convert/from_cosmx_to_h5mu/.config.vsh.yaml +++ b/target/nextflow/convert/from_cosmx_to_h5mu/.config.vsh.yaml @@ -107,7 +107,7 @@ repositories: - type: "vsh" name: "openpipeline" repo: "openpipeline" - tag: "v4.0.3" + tag: "v4.1.0" links: repository: "https://github.com/openpipelines-bio/openpipeline_spatial" docker_registry: "ghcr.io" @@ -199,10 +199,11 @@ engines: - type: "python" user: false packages: - - "anndata~=0.12.7" + - "anndata~=0.12.16" - "awkward" - - "mudata~=0.3.2" - - "scanpy~=1.10.4" + - "scipy~=1.17.1" + - "mudata~=0.3.8" + - "scanpy~=1.11.4" - "squidpy~=1.8.1" - "pyarrow" git: @@ -220,7 +221,7 @@ engines: - type: "python" user: false packages: - - "viashpy==0.9.0" + - "viashpy==0.10.0" github: - "openpipelines-bio/core#subdirectory=packages/python/openpipeline_testutils" upgrade: true @@ -238,8 +239,8 @@ build_info: engine: "docker|native" output: "target/nextflow/convert/from_cosmx_to_h5mu" executable: "target/nextflow/convert/from_cosmx_to_h5mu/main.nf" - viash_version: "0.9.4" - git_commit: "e087099616271bd0f11e825b7817ec14ebef62d7" + viash_version: "0.9.7" + git_commit: "4449aa6094a686af0a5fbe99b9aaafd01ae75aff" git_remote: "https://github.com/openpipelines-bio/openpipeline_spatial" package_config: name: "openpipeline_spatial" @@ -253,8 +254,8 @@ package_config: - type: "vsh" name: "openpipeline" repo: "openpipeline" - tag: "v4.0.3" - viash_version: "0.9.4" + tag: "v4.1.0" + viash_version: "0.9.7" source: "src" target: "target" config_mods: diff --git a/target/nextflow/convert/from_cosmx_to_h5mu/main.nf b/target/nextflow/convert/from_cosmx_to_h5mu/main.nf index 4958d7c..ba6dc48 100644 --- a/target/nextflow/convert/from_cosmx_to_h5mu/main.nf +++ b/target/nextflow/convert/from_cosmx_to_h5mu/main.nf @@ -1,6 +1,6 @@ // from_cosmx_to_h5mu main // -// This wrapper script is auto-generated by viash 0.9.4 and is thus a derivative +// This wrapper script is auto-generated by viash 0.9.7 and is thus a derivative // work thereof. This software comes with ABSOLUTELY NO WARRANTY from Data // Intuitive. // @@ -1354,47 +1354,42 @@ def readCsv(file_path) { def splitRegex = java.util.regex.Pattern.compile(''',(?=(?:[^"]*"[^"]*")*[^"]*$)''') def removeQuote = java.util.regex.Pattern.compile('''"(.*)"''') - def br = java.nio.file.Files.newBufferedReader(inputFile) + java.nio.file.Files.newBufferedReader(inputFile).withCloseable { br -> + def row = 0 + def header = null + def line - def row = -1 - def header = null - while (br.ready() && header == null) { - def line = br.readLine() - row++ - if (!line.startsWith("#")) { - header = splitRegex.split(line, -1).collect{field -> - m = removeQuote.matcher(field) - m.find() ? m.replaceFirst('$1') : field - } - } - } - assert header != null: "CSV file should contain a header" - - while (br.ready()) { - def line = br.readLine() - row++ - if (line == null) { - br.close() - break - } - - if (!line.startsWith("#")) { - def predata = splitRegex.split(line, -1) - def data = predata.collect{field -> - if (field == "") { - return null - } - def m = removeQuote.matcher(field) - if (m.find()) { - return m.replaceFirst('$1') - } else { - return field + while (header == null && (line = br.readLine()) != null) { + if (!line.startsWith("#")) { + header = splitRegex.split(line, -1).collect { field -> + def m = removeQuote.matcher(field) + m.find() ? m.replaceFirst('$1') : field } } - assert header.size() == data.size(): "Row $row should contain the same number as fields as the header" - - def dataMap = [header, data].transpose().collectEntries().findAll{it.value != null} - output.add(dataMap) + row++ + } + assert header != null : "CSV file should contain a header" + + while ((line = br.readLine()) != null) { + row++ + if (!line.startsWith("#")) { + def predata = splitRegex.split(line, -1) + def data = predata.collect { field -> + if (field == "") { + return null + } + def m = removeQuote.matcher(field) + if (m.find()) { + return m.replaceFirst('$1') + } else { + return field + } + } + assert header.size() == data.size() : "Row $row should contain the same number as fields as the header" + + def dataMap = [header, data].transpose().collectEntries().findAll { it.value != null } + output.add(dataMap) + } } } @@ -1710,10 +1705,25 @@ process publishFilesProc { ] .transpose() .collectMany{infile, outfile -> - if (infile.toString() != outfile.toString()) { + def infileString = infile.toString() + def outfileString = outfile.toString() + if (infileString != outfileString) { + /* Trailing slashes are removed from both the source and destination arguments. + From source arguments, this is useful when a source argument may have a trailing slash + and specify a symbolic link to a directory. Without removing the slash, cp will dereference + the symbolic link. + See https://www.gnu.org/software/coreutils/manual/html_node/Trailing-slashes.html#Trailing-slashes-1 + + For the destination path addding a trailing slash is a problem when publishing directories: + it requires the destination directory to exist. This fails because we only create the parent + directories first. + */ + def regexTrailingSlashes = ~/\/+$/ + def infileNoTrailingSlash = infileString - regexTrailingSlashes + def outfileNoTrailingSlash = outfileString - regexTrailingSlashes [ - "[ -d \"\$(dirname '${outfile.toString()}')\" ] || mkdir -p \"\$(dirname '${outfile.toString()}')\"", - "cp -r '${infile.toString()}' '${outfile.toString()}'" + "[ -d \"\$(dirname '${outfileNoTrailingSlash}')\" ] || mkdir -p \"\$(dirname '${outfileNoTrailingSlash}')\"", + "cp -a '${infileNoTrailingSlash}' '${outfileNoTrailingSlash}'" ] } else { // no need to copy if infile is the same as outfile @@ -3184,7 +3194,7 @@ meta = [ "type" : "vsh", "name" : "openpipeline", "repo" : "openpipeline", - "tag" : "v4.0.3" + "tag" : "v4.1.0" } ], "links" : { @@ -3295,10 +3305,11 @@ meta = [ "type" : "python", "user" : false, "packages" : [ - "anndata~=0.12.7", + "anndata~=0.12.16", "awkward", - "mudata~=0.3.2", - "scanpy~=1.10.4", + "scipy~=1.17.1", + "mudata~=0.3.8", + "scanpy~=1.11.4", "squidpy~=1.8.1", "pyarrow" ], @@ -3323,7 +3334,7 @@ meta = [ "type" : "python", "user" : false, "packages" : [ - "viashpy==0.9.0" + "viashpy==0.10.0" ], "github" : [ "openpipelines-bio/core#subdirectory=packages/python/openpipeline_testutils" @@ -3349,8 +3360,8 @@ meta = [ "runner" : "nextflow", "engine" : "docker|native", "output" : "/workdir/root/repo/target/nextflow/convert/from_cosmx_to_h5mu", - "viash_version" : "0.9.4", - "git_commit" : "e087099616271bd0f11e825b7817ec14ebef62d7", + "viash_version" : "0.9.7", + "git_commit" : "4449aa6094a686af0a5fbe99b9aaafd01ae75aff", "git_remote" : "https://github.com/openpipelines-bio/openpipeline_spatial" }, "package_config" : { @@ -3370,10 +3381,10 @@ meta = [ "type" : "vsh", "name" : "openpipeline", "repo" : "openpipeline", - "tag" : "v4.0.3" + "tag" : "v4.1.0" } ], - "viash_version" : "0.9.4", + "viash_version" : "0.9.7", "source" : "/workdir/root/repo/src", "target" : "/workdir/root/repo/target", "config_mods" : [ diff --git a/target/nextflow/convert/from_cosmx_to_spatialexperiment/.config.vsh.yaml b/target/nextflow/convert/from_cosmx_to_spatialexperiment/.config.vsh.yaml index 2401e2b..9eb72bf 100644 --- a/target/nextflow/convert/from_cosmx_to_spatialexperiment/.config.vsh.yaml +++ b/target/nextflow/convert/from_cosmx_to_spatialexperiment/.config.vsh.yaml @@ -125,7 +125,7 @@ repositories: - type: "vsh" name: "openpipeline" repo: "openpipeline" - tag: "v4.0.3" + tag: "v4.1.0" links: repository: "https://github.com/openpipelines-bio/openpipeline_spatial" docker_registry: "ghcr.io" @@ -233,8 +233,8 @@ build_info: engine: "docker|native" output: "target/nextflow/convert/from_cosmx_to_spatialexperiment" executable: "target/nextflow/convert/from_cosmx_to_spatialexperiment/main.nf" - viash_version: "0.9.4" - git_commit: "e087099616271bd0f11e825b7817ec14ebef62d7" + viash_version: "0.9.7" + git_commit: "4449aa6094a686af0a5fbe99b9aaafd01ae75aff" git_remote: "https://github.com/openpipelines-bio/openpipeline_spatial" package_config: name: "openpipeline_spatial" @@ -248,8 +248,8 @@ package_config: - type: "vsh" name: "openpipeline" repo: "openpipeline" - tag: "v4.0.3" - viash_version: "0.9.4" + tag: "v4.1.0" + viash_version: "0.9.7" source: "src" target: "target" config_mods: diff --git a/target/nextflow/convert/from_cosmx_to_spatialexperiment/main.nf b/target/nextflow/convert/from_cosmx_to_spatialexperiment/main.nf index a03ce8f..fe99ad0 100644 --- a/target/nextflow/convert/from_cosmx_to_spatialexperiment/main.nf +++ b/target/nextflow/convert/from_cosmx_to_spatialexperiment/main.nf @@ -1,6 +1,6 @@ // from_cosmx_to_spatialexperiment main // -// This wrapper script is auto-generated by viash 0.9.4 and is thus a derivative +// This wrapper script is auto-generated by viash 0.9.7 and is thus a derivative // work thereof. This software comes with ABSOLUTELY NO WARRANTY from Data // Intuitive. // @@ -1353,47 +1353,42 @@ def readCsv(file_path) { def splitRegex = java.util.regex.Pattern.compile(''',(?=(?:[^"]*"[^"]*")*[^"]*$)''') def removeQuote = java.util.regex.Pattern.compile('''"(.*)"''') - def br = java.nio.file.Files.newBufferedReader(inputFile) + java.nio.file.Files.newBufferedReader(inputFile).withCloseable { br -> + def row = 0 + def header = null + def line - def row = -1 - def header = null - while (br.ready() && header == null) { - def line = br.readLine() - row++ - if (!line.startsWith("#")) { - header = splitRegex.split(line, -1).collect{field -> - m = removeQuote.matcher(field) - m.find() ? m.replaceFirst('$1') : field - } - } - } - assert header != null: "CSV file should contain a header" - - while (br.ready()) { - def line = br.readLine() - row++ - if (line == null) { - br.close() - break - } - - if (!line.startsWith("#")) { - def predata = splitRegex.split(line, -1) - def data = predata.collect{field -> - if (field == "") { - return null - } - def m = removeQuote.matcher(field) - if (m.find()) { - return m.replaceFirst('$1') - } else { - return field + while (header == null && (line = br.readLine()) != null) { + if (!line.startsWith("#")) { + header = splitRegex.split(line, -1).collect { field -> + def m = removeQuote.matcher(field) + m.find() ? m.replaceFirst('$1') : field } } - assert header.size() == data.size(): "Row $row should contain the same number as fields as the header" - - def dataMap = [header, data].transpose().collectEntries().findAll{it.value != null} - output.add(dataMap) + row++ + } + assert header != null : "CSV file should contain a header" + + while ((line = br.readLine()) != null) { + row++ + if (!line.startsWith("#")) { + def predata = splitRegex.split(line, -1) + def data = predata.collect { field -> + if (field == "") { + return null + } + def m = removeQuote.matcher(field) + if (m.find()) { + return m.replaceFirst('$1') + } else { + return field + } + } + assert header.size() == data.size() : "Row $row should contain the same number as fields as the header" + + def dataMap = [header, data].transpose().collectEntries().findAll { it.value != null } + output.add(dataMap) + } } } @@ -1709,10 +1704,25 @@ process publishFilesProc { ] .transpose() .collectMany{infile, outfile -> - if (infile.toString() != outfile.toString()) { + def infileString = infile.toString() + def outfileString = outfile.toString() + if (infileString != outfileString) { + /* Trailing slashes are removed from both the source and destination arguments. + From source arguments, this is useful when a source argument may have a trailing slash + and specify a symbolic link to a directory. Without removing the slash, cp will dereference + the symbolic link. + See https://www.gnu.org/software/coreutils/manual/html_node/Trailing-slashes.html#Trailing-slashes-1 + + For the destination path addding a trailing slash is a problem when publishing directories: + it requires the destination directory to exist. This fails because we only create the parent + directories first. + */ + def regexTrailingSlashes = ~/\/+$/ + def infileNoTrailingSlash = infileString - regexTrailingSlashes + def outfileNoTrailingSlash = outfileString - regexTrailingSlashes [ - "[ -d \"\$(dirname '${outfile.toString()}')\" ] || mkdir -p \"\$(dirname '${outfile.toString()}')\"", - "cp -r '${infile.toString()}' '${outfile.toString()}'" + "[ -d \"\$(dirname '${outfileNoTrailingSlash}')\" ] || mkdir -p \"\$(dirname '${outfileNoTrailingSlash}')\"", + "cp -a '${infileNoTrailingSlash}' '${outfileNoTrailingSlash}'" ] } else { // no need to copy if infile is the same as outfile @@ -3190,7 +3200,7 @@ meta = [ "type" : "vsh", "name" : "openpipeline", "repo" : "openpipeline", - "tag" : "v4.0.3" + "tag" : "v4.1.0" } ], "links" : { @@ -3325,8 +3335,8 @@ meta = [ "runner" : "nextflow", "engine" : "docker|native", "output" : "/workdir/root/repo/target/nextflow/convert/from_cosmx_to_spatialexperiment", - "viash_version" : "0.9.4", - "git_commit" : "e087099616271bd0f11e825b7817ec14ebef62d7", + "viash_version" : "0.9.7", + "git_commit" : "4449aa6094a686af0a5fbe99b9aaafd01ae75aff", "git_remote" : "https://github.com/openpipelines-bio/openpipeline_spatial" }, "package_config" : { @@ -3346,10 +3356,10 @@ meta = [ "type" : "vsh", "name" : "openpipeline", "repo" : "openpipeline", - "tag" : "v4.0.3" + "tag" : "v4.1.0" } ], - "viash_version" : "0.9.4", + "viash_version" : "0.9.7", "source" : "/workdir/root/repo/src", "target" : "/workdir/root/repo/target", "config_mods" : [ diff --git a/target/nextflow/convert/from_h5mu_to_seurat_with_fov/.config.vsh.yaml b/target/nextflow/convert/from_h5mu_to_seurat_with_fov/.config.vsh.yaml index 4c8ae0a..d49f168 100644 --- a/target/nextflow/convert/from_h5mu_to_seurat_with_fov/.config.vsh.yaml +++ b/target/nextflow/convert/from_h5mu_to_seurat_with_fov/.config.vsh.yaml @@ -138,7 +138,7 @@ repositories: - type: "vsh" name: "openpipeline" repo: "openpipeline" - tag: "v4.0.3" + tag: "v4.1.0" links: repository: "https://github.com/openpipelines-bio/openpipeline_spatial" docker_registry: "ghcr.io" @@ -252,8 +252,8 @@ build_info: engine: "docker|native" output: "target/nextflow/convert/from_h5mu_to_seurat_with_fov" executable: "target/nextflow/convert/from_h5mu_to_seurat_with_fov/main.nf" - viash_version: "0.9.4" - git_commit: "e087099616271bd0f11e825b7817ec14ebef62d7" + viash_version: "0.9.7" + git_commit: "4449aa6094a686af0a5fbe99b9aaafd01ae75aff" git_remote: "https://github.com/openpipelines-bio/openpipeline_spatial" package_config: name: "openpipeline_spatial" @@ -267,8 +267,8 @@ package_config: - type: "vsh" name: "openpipeline" repo: "openpipeline" - tag: "v4.0.3" - viash_version: "0.9.4" + tag: "v4.1.0" + viash_version: "0.9.7" source: "src" target: "target" config_mods: diff --git a/target/nextflow/convert/from_h5mu_to_seurat_with_fov/main.nf b/target/nextflow/convert/from_h5mu_to_seurat_with_fov/main.nf index ef2c2e0..45ae07f 100644 --- a/target/nextflow/convert/from_h5mu_to_seurat_with_fov/main.nf +++ b/target/nextflow/convert/from_h5mu_to_seurat_with_fov/main.nf @@ -1,6 +1,6 @@ // from_h5mu_to_seurat_with_fov main // -// This wrapper script is auto-generated by viash 0.9.4 and is thus a derivative +// This wrapper script is auto-generated by viash 0.9.7 and is thus a derivative // work thereof. This software comes with ABSOLUTELY NO WARRANTY from Data // Intuitive. // @@ -1353,47 +1353,42 @@ def readCsv(file_path) { def splitRegex = java.util.regex.Pattern.compile(''',(?=(?:[^"]*"[^"]*")*[^"]*$)''') def removeQuote = java.util.regex.Pattern.compile('''"(.*)"''') - def br = java.nio.file.Files.newBufferedReader(inputFile) + java.nio.file.Files.newBufferedReader(inputFile).withCloseable { br -> + def row = 0 + def header = null + def line - def row = -1 - def header = null - while (br.ready() && header == null) { - def line = br.readLine() - row++ - if (!line.startsWith("#")) { - header = splitRegex.split(line, -1).collect{field -> - m = removeQuote.matcher(field) - m.find() ? m.replaceFirst('$1') : field - } - } - } - assert header != null: "CSV file should contain a header" - - while (br.ready()) { - def line = br.readLine() - row++ - if (line == null) { - br.close() - break - } - - if (!line.startsWith("#")) { - def predata = splitRegex.split(line, -1) - def data = predata.collect{field -> - if (field == "") { - return null - } - def m = removeQuote.matcher(field) - if (m.find()) { - return m.replaceFirst('$1') - } else { - return field + while (header == null && (line = br.readLine()) != null) { + if (!line.startsWith("#")) { + header = splitRegex.split(line, -1).collect { field -> + def m = removeQuote.matcher(field) + m.find() ? m.replaceFirst('$1') : field } } - assert header.size() == data.size(): "Row $row should contain the same number as fields as the header" - - def dataMap = [header, data].transpose().collectEntries().findAll{it.value != null} - output.add(dataMap) + row++ + } + assert header != null : "CSV file should contain a header" + + while ((line = br.readLine()) != null) { + row++ + if (!line.startsWith("#")) { + def predata = splitRegex.split(line, -1) + def data = predata.collect { field -> + if (field == "") { + return null + } + def m = removeQuote.matcher(field) + if (m.find()) { + return m.replaceFirst('$1') + } else { + return field + } + } + assert header.size() == data.size() : "Row $row should contain the same number as fields as the header" + + def dataMap = [header, data].transpose().collectEntries().findAll { it.value != null } + output.add(dataMap) + } } } @@ -1709,10 +1704,25 @@ process publishFilesProc { ] .transpose() .collectMany{infile, outfile -> - if (infile.toString() != outfile.toString()) { + def infileString = infile.toString() + def outfileString = outfile.toString() + if (infileString != outfileString) { + /* Trailing slashes are removed from both the source and destination arguments. + From source arguments, this is useful when a source argument may have a trailing slash + and specify a symbolic link to a directory. Without removing the slash, cp will dereference + the symbolic link. + See https://www.gnu.org/software/coreutils/manual/html_node/Trailing-slashes.html#Trailing-slashes-1 + + For the destination path addding a trailing slash is a problem when publishing directories: + it requires the destination directory to exist. This fails because we only create the parent + directories first. + */ + def regexTrailingSlashes = ~/\/+$/ + def infileNoTrailingSlash = infileString - regexTrailingSlashes + def outfileNoTrailingSlash = outfileString - regexTrailingSlashes [ - "[ -d \"\$(dirname '${outfile.toString()}')\" ] || mkdir -p \"\$(dirname '${outfile.toString()}')\"", - "cp -r '${infile.toString()}' '${outfile.toString()}'" + "[ -d \"\$(dirname '${outfileNoTrailingSlash}')\" ] || mkdir -p \"\$(dirname '${outfileNoTrailingSlash}')\"", + "cp -a '${infileNoTrailingSlash}' '${outfileNoTrailingSlash}'" ] } else { // no need to copy if infile is the same as outfile @@ -3212,7 +3222,7 @@ meta = [ "type" : "vsh", "name" : "openpipeline", "repo" : "openpipeline", - "tag" : "v4.0.3" + "tag" : "v4.1.0" } ], "links" : { @@ -3354,8 +3364,8 @@ meta = [ "runner" : "nextflow", "engine" : "docker|native", "output" : "/workdir/root/repo/target/nextflow/convert/from_h5mu_to_seurat_with_fov", - "viash_version" : "0.9.4", - "git_commit" : "e087099616271bd0f11e825b7817ec14ebef62d7", + "viash_version" : "0.9.7", + "git_commit" : "4449aa6094a686af0a5fbe99b9aaafd01ae75aff", "git_remote" : "https://github.com/openpipelines-bio/openpipeline_spatial" }, "package_config" : { @@ -3375,10 +3385,10 @@ meta = [ "type" : "vsh", "name" : "openpipeline", "repo" : "openpipeline", - "tag" : "v4.0.3" + "tag" : "v4.1.0" } ], - "viash_version" : "0.9.4", + "viash_version" : "0.9.7", "source" : "/workdir/root/repo/src", "target" : "/workdir/root/repo/target", "config_mods" : [ diff --git a/target/nextflow/convert/from_h5mu_to_spatialdata/.config.vsh.yaml b/target/nextflow/convert/from_h5mu_to_spatialdata/.config.vsh.yaml index 0703abf..258af4c 100644 --- a/target/nextflow/convert/from_h5mu_to_spatialdata/.config.vsh.yaml +++ b/target/nextflow/convert/from_h5mu_to_spatialdata/.config.vsh.yaml @@ -114,7 +114,7 @@ repositories: - type: "vsh" name: "openpipeline" repo: "openpipeline" - tag: "v4.0.3" + tag: "v4.1.0" links: repository: "https://github.com/openpipelines-bio/openpipeline_spatial" docker_registry: "ghcr.io" @@ -203,9 +203,10 @@ engines: - type: "python" user: false packages: - - "anndata~=0.12.7" + - "anndata~=0.12.16" - "awkward" - - "mudata~=0.3.2" + - "scipy~=1.17.1" + - "mudata~=0.3.8" - "spatialdata~=0.7.2" - "pyarrow~=18.0.0" - "ome-zarr~=0.13.0" @@ -222,7 +223,7 @@ engines: - type: "python" user: false packages: - - "viashpy==0.9.0" + - "viashpy==0.10.0" github: - "openpipelines-bio/core#subdirectory=packages/python/openpipeline_testutils" upgrade: true @@ -236,8 +237,8 @@ build_info: engine: "docker|native" output: "target/nextflow/convert/from_h5mu_to_spatialdata" executable: "target/nextflow/convert/from_h5mu_to_spatialdata/main.nf" - viash_version: "0.9.4" - git_commit: "e087099616271bd0f11e825b7817ec14ebef62d7" + viash_version: "0.9.7" + git_commit: "4449aa6094a686af0a5fbe99b9aaafd01ae75aff" git_remote: "https://github.com/openpipelines-bio/openpipeline_spatial" package_config: name: "openpipeline_spatial" @@ -251,8 +252,8 @@ package_config: - type: "vsh" name: "openpipeline" repo: "openpipeline" - tag: "v4.0.3" - viash_version: "0.9.4" + tag: "v4.1.0" + viash_version: "0.9.7" source: "src" target: "target" config_mods: diff --git a/target/nextflow/convert/from_h5mu_to_spatialdata/main.nf b/target/nextflow/convert/from_h5mu_to_spatialdata/main.nf index 57bd936..7e37f50 100644 --- a/target/nextflow/convert/from_h5mu_to_spatialdata/main.nf +++ b/target/nextflow/convert/from_h5mu_to_spatialdata/main.nf @@ -1,6 +1,6 @@ // from_h5mu_to_spatialdata main // -// This wrapper script is auto-generated by viash 0.9.4 and is thus a derivative +// This wrapper script is auto-generated by viash 0.9.7 and is thus a derivative // work thereof. This software comes with ABSOLUTELY NO WARRANTY from Data // Intuitive. // @@ -1354,47 +1354,42 @@ def readCsv(file_path) { def splitRegex = java.util.regex.Pattern.compile(''',(?=(?:[^"]*"[^"]*")*[^"]*$)''') def removeQuote = java.util.regex.Pattern.compile('''"(.*)"''') - def br = java.nio.file.Files.newBufferedReader(inputFile) + java.nio.file.Files.newBufferedReader(inputFile).withCloseable { br -> + def row = 0 + def header = null + def line - def row = -1 - def header = null - while (br.ready() && header == null) { - def line = br.readLine() - row++ - if (!line.startsWith("#")) { - header = splitRegex.split(line, -1).collect{field -> - m = removeQuote.matcher(field) - m.find() ? m.replaceFirst('$1') : field - } - } - } - assert header != null: "CSV file should contain a header" - - while (br.ready()) { - def line = br.readLine() - row++ - if (line == null) { - br.close() - break - } - - if (!line.startsWith("#")) { - def predata = splitRegex.split(line, -1) - def data = predata.collect{field -> - if (field == "") { - return null - } - def m = removeQuote.matcher(field) - if (m.find()) { - return m.replaceFirst('$1') - } else { - return field + while (header == null && (line = br.readLine()) != null) { + if (!line.startsWith("#")) { + header = splitRegex.split(line, -1).collect { field -> + def m = removeQuote.matcher(field) + m.find() ? m.replaceFirst('$1') : field } } - assert header.size() == data.size(): "Row $row should contain the same number as fields as the header" - - def dataMap = [header, data].transpose().collectEntries().findAll{it.value != null} - output.add(dataMap) + row++ + } + assert header != null : "CSV file should contain a header" + + while ((line = br.readLine()) != null) { + row++ + if (!line.startsWith("#")) { + def predata = splitRegex.split(line, -1) + def data = predata.collect { field -> + if (field == "") { + return null + } + def m = removeQuote.matcher(field) + if (m.find()) { + return m.replaceFirst('$1') + } else { + return field + } + } + assert header.size() == data.size() : "Row $row should contain the same number as fields as the header" + + def dataMap = [header, data].transpose().collectEntries().findAll { it.value != null } + output.add(dataMap) + } } } @@ -1710,10 +1705,25 @@ process publishFilesProc { ] .transpose() .collectMany{infile, outfile -> - if (infile.toString() != outfile.toString()) { + def infileString = infile.toString() + def outfileString = outfile.toString() + if (infileString != outfileString) { + /* Trailing slashes are removed from both the source and destination arguments. + From source arguments, this is useful when a source argument may have a trailing slash + and specify a symbolic link to a directory. Without removing the slash, cp will dereference + the symbolic link. + See https://www.gnu.org/software/coreutils/manual/html_node/Trailing-slashes.html#Trailing-slashes-1 + + For the destination path addding a trailing slash is a problem when publishing directories: + it requires the destination directory to exist. This fails because we only create the parent + directories first. + */ + def regexTrailingSlashes = ~/\/+$/ + def infileNoTrailingSlash = infileString - regexTrailingSlashes + def outfileNoTrailingSlash = outfileString - regexTrailingSlashes [ - "[ -d \"\$(dirname '${outfile.toString()}')\" ] || mkdir -p \"\$(dirname '${outfile.toString()}')\"", - "cp -r '${infile.toString()}' '${outfile.toString()}'" + "[ -d \"\$(dirname '${outfileNoTrailingSlash}')\" ] || mkdir -p \"\$(dirname '${outfileNoTrailingSlash}')\"", + "cp -a '${infileNoTrailingSlash}' '${outfileNoTrailingSlash}'" ] } else { // no need to copy if infile is the same as outfile @@ -3191,7 +3201,7 @@ meta = [ "type" : "vsh", "name" : "openpipeline", "repo" : "openpipeline", - "tag" : "v4.0.3" + "tag" : "v4.1.0" } ], "links" : { @@ -3299,9 +3309,10 @@ meta = [ "type" : "python", "user" : false, "packages" : [ - "anndata~=0.12.7", + "anndata~=0.12.16", "awkward", - "mudata~=0.3.2", + "scipy~=1.17.1", + "mudata~=0.3.8", "spatialdata~=0.7.2", "pyarrow~=18.0.0", "ome-zarr~=0.13.0" @@ -3324,7 +3335,7 @@ meta = [ "type" : "python", "user" : false, "packages" : [ - "viashpy==0.9.0" + "viashpy==0.10.0" ], "github" : [ "openpipelines-bio/core#subdirectory=packages/python/openpipeline_testutils" @@ -3343,8 +3354,8 @@ meta = [ "runner" : "nextflow", "engine" : "docker|native", "output" : "/workdir/root/repo/target/nextflow/convert/from_h5mu_to_spatialdata", - "viash_version" : "0.9.4", - "git_commit" : "e087099616271bd0f11e825b7817ec14ebef62d7", + "viash_version" : "0.9.7", + "git_commit" : "4449aa6094a686af0a5fbe99b9aaafd01ae75aff", "git_remote" : "https://github.com/openpipelines-bio/openpipeline_spatial" }, "package_config" : { @@ -3364,10 +3375,10 @@ meta = [ "type" : "vsh", "name" : "openpipeline", "repo" : "openpipeline", - "tag" : "v4.0.3" + "tag" : "v4.1.0" } ], - "viash_version" : "0.9.4", + "viash_version" : "0.9.7", "source" : "/workdir/root/repo/src", "target" : "/workdir/root/repo/target", "config_mods" : [ diff --git a/target/nextflow/convert/from_h5mu_to_spatialexperiment/.config.vsh.yaml b/target/nextflow/convert/from_h5mu_to_spatialexperiment/.config.vsh.yaml index 78ebbfc..fd29ffe 100644 --- a/target/nextflow/convert/from_h5mu_to_spatialexperiment/.config.vsh.yaml +++ b/target/nextflow/convert/from_h5mu_to_spatialexperiment/.config.vsh.yaml @@ -92,7 +92,7 @@ repositories: - type: "vsh" name: "openpipeline" repo: "openpipeline" - tag: "v4.0.3" + tag: "v4.1.0" links: repository: "https://github.com/openpipelines-bio/openpipeline_spatial" docker_registry: "ghcr.io" @@ -209,9 +209,10 @@ engines: - type: "python" user: true packages: - - "anndata~=0.12.7" + - "anndata~=0.12.16" - "awkward" - - "mudata~=0.3.2" + - "scipy~=1.17.1" + - "mudata~=0.3.8" script: - "exec(\"try:\\n import zarr; from importlib.metadata import version\\nexcept\ \ ModuleNotFoundError:\\n exit(0)\\nelse: assert int(version(\\\"zarr\\\"\ @@ -227,8 +228,8 @@ build_info: engine: "docker|native" output: "target/nextflow/convert/from_h5mu_to_spatialexperiment" executable: "target/nextflow/convert/from_h5mu_to_spatialexperiment/main.nf" - viash_version: "0.9.4" - git_commit: "e087099616271bd0f11e825b7817ec14ebef62d7" + viash_version: "0.9.7" + git_commit: "4449aa6094a686af0a5fbe99b9aaafd01ae75aff" git_remote: "https://github.com/openpipelines-bio/openpipeline_spatial" package_config: name: "openpipeline_spatial" @@ -242,8 +243,8 @@ package_config: - type: "vsh" name: "openpipeline" repo: "openpipeline" - tag: "v4.0.3" - viash_version: "0.9.4" + tag: "v4.1.0" + viash_version: "0.9.7" source: "src" target: "target" config_mods: diff --git a/target/nextflow/convert/from_h5mu_to_spatialexperiment/main.nf b/target/nextflow/convert/from_h5mu_to_spatialexperiment/main.nf index 707edbd..eef61f1 100644 --- a/target/nextflow/convert/from_h5mu_to_spatialexperiment/main.nf +++ b/target/nextflow/convert/from_h5mu_to_spatialexperiment/main.nf @@ -1,6 +1,6 @@ // from_h5mu_to_spatialexperiment main // -// This wrapper script is auto-generated by viash 0.9.4 and is thus a derivative +// This wrapper script is auto-generated by viash 0.9.7 and is thus a derivative // work thereof. This software comes with ABSOLUTELY NO WARRANTY from Data // Intuitive. // @@ -1353,47 +1353,42 @@ def readCsv(file_path) { def splitRegex = java.util.regex.Pattern.compile(''',(?=(?:[^"]*"[^"]*")*[^"]*$)''') def removeQuote = java.util.regex.Pattern.compile('''"(.*)"''') - def br = java.nio.file.Files.newBufferedReader(inputFile) + java.nio.file.Files.newBufferedReader(inputFile).withCloseable { br -> + def row = 0 + def header = null + def line - def row = -1 - def header = null - while (br.ready() && header == null) { - def line = br.readLine() - row++ - if (!line.startsWith("#")) { - header = splitRegex.split(line, -1).collect{field -> - m = removeQuote.matcher(field) - m.find() ? m.replaceFirst('$1') : field - } - } - } - assert header != null: "CSV file should contain a header" - - while (br.ready()) { - def line = br.readLine() - row++ - if (line == null) { - br.close() - break - } - - if (!line.startsWith("#")) { - def predata = splitRegex.split(line, -1) - def data = predata.collect{field -> - if (field == "") { - return null - } - def m = removeQuote.matcher(field) - if (m.find()) { - return m.replaceFirst('$1') - } else { - return field + while (header == null && (line = br.readLine()) != null) { + if (!line.startsWith("#")) { + header = splitRegex.split(line, -1).collect { field -> + def m = removeQuote.matcher(field) + m.find() ? m.replaceFirst('$1') : field } } - assert header.size() == data.size(): "Row $row should contain the same number as fields as the header" - - def dataMap = [header, data].transpose().collectEntries().findAll{it.value != null} - output.add(dataMap) + row++ + } + assert header != null : "CSV file should contain a header" + + while ((line = br.readLine()) != null) { + row++ + if (!line.startsWith("#")) { + def predata = splitRegex.split(line, -1) + def data = predata.collect { field -> + if (field == "") { + return null + } + def m = removeQuote.matcher(field) + if (m.find()) { + return m.replaceFirst('$1') + } else { + return field + } + } + assert header.size() == data.size() : "Row $row should contain the same number as fields as the header" + + def dataMap = [header, data].transpose().collectEntries().findAll { it.value != null } + output.add(dataMap) + } } } @@ -1709,10 +1704,25 @@ process publishFilesProc { ] .transpose() .collectMany{infile, outfile -> - if (infile.toString() != outfile.toString()) { + def infileString = infile.toString() + def outfileString = outfile.toString() + if (infileString != outfileString) { + /* Trailing slashes are removed from both the source and destination arguments. + From source arguments, this is useful when a source argument may have a trailing slash + and specify a symbolic link to a directory. Without removing the slash, cp will dereference + the symbolic link. + See https://www.gnu.org/software/coreutils/manual/html_node/Trailing-slashes.html#Trailing-slashes-1 + + For the destination path addding a trailing slash is a problem when publishing directories: + it requires the destination directory to exist. This fails because we only create the parent + directories first. + */ + def regexTrailingSlashes = ~/\/+$/ + def infileNoTrailingSlash = infileString - regexTrailingSlashes + def outfileNoTrailingSlash = outfileString - regexTrailingSlashes [ - "[ -d \"\$(dirname '${outfile.toString()}')\" ] || mkdir -p \"\$(dirname '${outfile.toString()}')\"", - "cp -r '${infile.toString()}' '${outfile.toString()}'" + "[ -d \"\$(dirname '${outfileNoTrailingSlash}')\" ] || mkdir -p \"\$(dirname '${outfileNoTrailingSlash}')\"", + "cp -a '${infileNoTrailingSlash}' '${outfileNoTrailingSlash}'" ] } else { // no need to copy if infile is the same as outfile @@ -3163,7 +3173,7 @@ meta = [ "type" : "vsh", "name" : "openpipeline", "repo" : "openpipeline", - "tag" : "v4.0.3" + "tag" : "v4.1.0" } ], "links" : { @@ -3313,9 +3323,10 @@ meta = [ "type" : "python", "user" : true, "packages" : [ - "anndata~=0.12.7", + "anndata~=0.12.16", "awkward", - "mudata~=0.3.2" + "scipy~=1.17.1", + "mudata~=0.3.8" ], "script" : [ "exec(\\"try:\\\\n import zarr; from importlib.metadata import version\\\\nexcept ModuleNotFoundError:\\\\n exit(0)\\\\nelse: assert int(version(\\\\\\"zarr\\\\\\").partition(\\\\\\".\\\\\\")[0]) > 2\\")" @@ -3334,8 +3345,8 @@ meta = [ "runner" : "nextflow", "engine" : "docker|native", "output" : "/workdir/root/repo/target/nextflow/convert/from_h5mu_to_spatialexperiment", - "viash_version" : "0.9.4", - "git_commit" : "e087099616271bd0f11e825b7817ec14ebef62d7", + "viash_version" : "0.9.7", + "git_commit" : "4449aa6094a686af0a5fbe99b9aaafd01ae75aff", "git_remote" : "https://github.com/openpipelines-bio/openpipeline_spatial" }, "package_config" : { @@ -3355,10 +3366,10 @@ meta = [ "type" : "vsh", "name" : "openpipeline", "repo" : "openpipeline", - "tag" : "v4.0.3" + "tag" : "v4.1.0" } ], - "viash_version" : "0.9.4", + "viash_version" : "0.9.7", "source" : "/workdir/root/repo/src", "target" : "/workdir/root/repo/target", "config_mods" : [ diff --git a/target/nextflow/convert/from_spaceranger_to_h5mu/.config.vsh.yaml b/target/nextflow/convert/from_spaceranger_to_h5mu/.config.vsh.yaml index 2217e39..54b851a 100644 --- a/target/nextflow/convert/from_spaceranger_to_h5mu/.config.vsh.yaml +++ b/target/nextflow/convert/from_spaceranger_to_h5mu/.config.vsh.yaml @@ -144,7 +144,7 @@ repositories: - type: "vsh" name: "openpipeline" repo: "openpipeline" - tag: "v4.0.3" + tag: "v4.1.0" links: repository: "https://github.com/openpipelines-bio/openpipeline_spatial" docker_registry: "ghcr.io" @@ -233,10 +233,11 @@ engines: - type: "python" user: false packages: - - "anndata~=0.12.7" + - "anndata~=0.12.16" - "awkward" - - "mudata~=0.3.2" - - "scanpy~=1.10.4" + - "scipy~=1.17.1" + - "mudata~=0.3.8" + - "scanpy~=1.11.4" script: - "exec(\"try:\\n import zarr; from importlib.metadata import version\\nexcept\ \ ModuleNotFoundError:\\n exit(0)\\nelse: assert int(version(\\\"zarr\\\"\ @@ -250,7 +251,7 @@ engines: - type: "python" user: false packages: - - "viashpy==0.9.0" + - "viashpy==0.10.0" github: - "openpipelines-bio/core#subdirectory=packages/python/openpipeline_testutils" upgrade: true @@ -264,8 +265,8 @@ build_info: engine: "docker|native" output: "target/nextflow/convert/from_spaceranger_to_h5mu" executable: "target/nextflow/convert/from_spaceranger_to_h5mu/main.nf" - viash_version: "0.9.4" - git_commit: "e087099616271bd0f11e825b7817ec14ebef62d7" + viash_version: "0.9.7" + git_commit: "4449aa6094a686af0a5fbe99b9aaafd01ae75aff" git_remote: "https://github.com/openpipelines-bio/openpipeline_spatial" package_config: name: "openpipeline_spatial" @@ -279,8 +280,8 @@ package_config: - type: "vsh" name: "openpipeline" repo: "openpipeline" - tag: "v4.0.3" - viash_version: "0.9.4" + tag: "v4.1.0" + viash_version: "0.9.7" source: "src" target: "target" config_mods: diff --git a/target/nextflow/convert/from_spaceranger_to_h5mu/main.nf b/target/nextflow/convert/from_spaceranger_to_h5mu/main.nf index 5487958..5b7f21a 100644 --- a/target/nextflow/convert/from_spaceranger_to_h5mu/main.nf +++ b/target/nextflow/convert/from_spaceranger_to_h5mu/main.nf @@ -1,6 +1,6 @@ // from_spaceranger_to_h5mu main // -// This wrapper script is auto-generated by viash 0.9.4 and is thus a derivative +// This wrapper script is auto-generated by viash 0.9.7 and is thus a derivative // work thereof. This software comes with ABSOLUTELY NO WARRANTY from Data // Intuitive. // @@ -1353,47 +1353,42 @@ def readCsv(file_path) { def splitRegex = java.util.regex.Pattern.compile(''',(?=(?:[^"]*"[^"]*")*[^"]*$)''') def removeQuote = java.util.regex.Pattern.compile('''"(.*)"''') - def br = java.nio.file.Files.newBufferedReader(inputFile) + java.nio.file.Files.newBufferedReader(inputFile).withCloseable { br -> + def row = 0 + def header = null + def line - def row = -1 - def header = null - while (br.ready() && header == null) { - def line = br.readLine() - row++ - if (!line.startsWith("#")) { - header = splitRegex.split(line, -1).collect{field -> - m = removeQuote.matcher(field) - m.find() ? m.replaceFirst('$1') : field - } - } - } - assert header != null: "CSV file should contain a header" - - while (br.ready()) { - def line = br.readLine() - row++ - if (line == null) { - br.close() - break - } - - if (!line.startsWith("#")) { - def predata = splitRegex.split(line, -1) - def data = predata.collect{field -> - if (field == "") { - return null - } - def m = removeQuote.matcher(field) - if (m.find()) { - return m.replaceFirst('$1') - } else { - return field + while (header == null && (line = br.readLine()) != null) { + if (!line.startsWith("#")) { + header = splitRegex.split(line, -1).collect { field -> + def m = removeQuote.matcher(field) + m.find() ? m.replaceFirst('$1') : field } } - assert header.size() == data.size(): "Row $row should contain the same number as fields as the header" - - def dataMap = [header, data].transpose().collectEntries().findAll{it.value != null} - output.add(dataMap) + row++ + } + assert header != null : "CSV file should contain a header" + + while ((line = br.readLine()) != null) { + row++ + if (!line.startsWith("#")) { + def predata = splitRegex.split(line, -1) + def data = predata.collect { field -> + if (field == "") { + return null + } + def m = removeQuote.matcher(field) + if (m.find()) { + return m.replaceFirst('$1') + } else { + return field + } + } + assert header.size() == data.size() : "Row $row should contain the same number as fields as the header" + + def dataMap = [header, data].transpose().collectEntries().findAll { it.value != null } + output.add(dataMap) + } } } @@ -1709,10 +1704,25 @@ process publishFilesProc { ] .transpose() .collectMany{infile, outfile -> - if (infile.toString() != outfile.toString()) { + def infileString = infile.toString() + def outfileString = outfile.toString() + if (infileString != outfileString) { + /* Trailing slashes are removed from both the source and destination arguments. + From source arguments, this is useful when a source argument may have a trailing slash + and specify a symbolic link to a directory. Without removing the slash, cp will dereference + the symbolic link. + See https://www.gnu.org/software/coreutils/manual/html_node/Trailing-slashes.html#Trailing-slashes-1 + + For the destination path addding a trailing slash is a problem when publishing directories: + it requires the destination directory to exist. This fails because we only create the parent + directories first. + */ + def regexTrailingSlashes = ~/\/+$/ + def infileNoTrailingSlash = infileString - regexTrailingSlashes + def outfileNoTrailingSlash = outfileString - regexTrailingSlashes [ - "[ -d \"\$(dirname '${outfile.toString()}')\" ] || mkdir -p \"\$(dirname '${outfile.toString()}')\"", - "cp -r '${infile.toString()}' '${outfile.toString()}'" + "[ -d \"\$(dirname '${outfileNoTrailingSlash}')\" ] || mkdir -p \"\$(dirname '${outfileNoTrailingSlash}')\"", + "cp -a '${infileNoTrailingSlash}' '${outfileNoTrailingSlash}'" ] } else { // no need to copy if infile is the same as outfile @@ -3217,7 +3227,7 @@ meta = [ "type" : "vsh", "name" : "openpipeline", "repo" : "openpipeline", - "tag" : "v4.0.3" + "tag" : "v4.1.0" } ], "links" : { @@ -3325,10 +3335,11 @@ meta = [ "type" : "python", "user" : false, "packages" : [ - "anndata~=0.12.7", + "anndata~=0.12.16", "awkward", - "mudata~=0.3.2", - "scanpy~=1.10.4" + "scipy~=1.17.1", + "mudata~=0.3.8", + "scanpy~=1.11.4" ], "script" : [ "exec(\\"try:\\\\n import zarr; from importlib.metadata import version\\\\nexcept ModuleNotFoundError:\\\\n exit(0)\\\\nelse: assert int(version(\\\\\\"zarr\\\\\\").partition(\\\\\\".\\\\\\")[0]) > 2\\")" @@ -3348,7 +3359,7 @@ meta = [ "type" : "python", "user" : false, "packages" : [ - "viashpy==0.9.0" + "viashpy==0.10.0" ], "github" : [ "openpipelines-bio/core#subdirectory=packages/python/openpipeline_testutils" @@ -3367,8 +3378,8 @@ meta = [ "runner" : "nextflow", "engine" : "docker|native", "output" : "/workdir/root/repo/target/nextflow/convert/from_spaceranger_to_h5mu", - "viash_version" : "0.9.4", - "git_commit" : "e087099616271bd0f11e825b7817ec14ebef62d7", + "viash_version" : "0.9.7", + "git_commit" : "4449aa6094a686af0a5fbe99b9aaafd01ae75aff", "git_remote" : "https://github.com/openpipelines-bio/openpipeline_spatial" }, "package_config" : { @@ -3388,10 +3399,10 @@ meta = [ "type" : "vsh", "name" : "openpipeline", "repo" : "openpipeline", - "tag" : "v4.0.3" + "tag" : "v4.1.0" } ], - "viash_version" : "0.9.4", + "viash_version" : "0.9.7", "source" : "/workdir/root/repo/src", "target" : "/workdir/root/repo/target", "config_mods" : [ diff --git a/target/nextflow/convert/from_spatialdata_to_h5mu/.config.vsh.yaml b/target/nextflow/convert/from_spatialdata_to_h5mu/.config.vsh.yaml index c9cff86..18af1eb 100644 --- a/target/nextflow/convert/from_spatialdata_to_h5mu/.config.vsh.yaml +++ b/target/nextflow/convert/from_spatialdata_to_h5mu/.config.vsh.yaml @@ -101,7 +101,7 @@ repositories: - type: "vsh" name: "openpipeline" repo: "openpipeline" - tag: "v4.0.3" + tag: "v4.1.0" links: repository: "https://github.com/openpipelines-bio/openpipeline_spatial" docker_registry: "ghcr.io" @@ -190,9 +190,10 @@ engines: - type: "python" user: false packages: - - "anndata~=0.12.7" + - "anndata~=0.12.16" - "awkward" - - "mudata~=0.3.2" + - "scipy~=1.17.1" + - "mudata~=0.3.8" - "spatialdata~=0.7.2" - "pyarrow~=18.0.0" - "ome-zarr~=0.13.0" @@ -209,7 +210,7 @@ engines: - type: "python" user: false packages: - - "viashpy==0.9.0" + - "viashpy==0.10.0" github: - "openpipelines-bio/core#subdirectory=packages/python/openpipeline_testutils" upgrade: true @@ -223,8 +224,8 @@ build_info: engine: "docker|native" output: "target/nextflow/convert/from_spatialdata_to_h5mu" executable: "target/nextflow/convert/from_spatialdata_to_h5mu/main.nf" - viash_version: "0.9.4" - git_commit: "e087099616271bd0f11e825b7817ec14ebef62d7" + viash_version: "0.9.7" + git_commit: "4449aa6094a686af0a5fbe99b9aaafd01ae75aff" git_remote: "https://github.com/openpipelines-bio/openpipeline_spatial" package_config: name: "openpipeline_spatial" @@ -238,8 +239,8 @@ package_config: - type: "vsh" name: "openpipeline" repo: "openpipeline" - tag: "v4.0.3" - viash_version: "0.9.4" + tag: "v4.1.0" + viash_version: "0.9.7" source: "src" target: "target" config_mods: diff --git a/target/nextflow/convert/from_spatialdata_to_h5mu/main.nf b/target/nextflow/convert/from_spatialdata_to_h5mu/main.nf index 360bd33..d638812 100644 --- a/target/nextflow/convert/from_spatialdata_to_h5mu/main.nf +++ b/target/nextflow/convert/from_spatialdata_to_h5mu/main.nf @@ -1,6 +1,6 @@ // from_spatialdata_to_h5mu main // -// This wrapper script is auto-generated by viash 0.9.4 and is thus a derivative +// This wrapper script is auto-generated by viash 0.9.7 and is thus a derivative // work thereof. This software comes with ABSOLUTELY NO WARRANTY from Data // Intuitive. // @@ -1354,47 +1354,42 @@ def readCsv(file_path) { def splitRegex = java.util.regex.Pattern.compile(''',(?=(?:[^"]*"[^"]*")*[^"]*$)''') def removeQuote = java.util.regex.Pattern.compile('''"(.*)"''') - def br = java.nio.file.Files.newBufferedReader(inputFile) + java.nio.file.Files.newBufferedReader(inputFile).withCloseable { br -> + def row = 0 + def header = null + def line - def row = -1 - def header = null - while (br.ready() && header == null) { - def line = br.readLine() - row++ - if (!line.startsWith("#")) { - header = splitRegex.split(line, -1).collect{field -> - m = removeQuote.matcher(field) - m.find() ? m.replaceFirst('$1') : field - } - } - } - assert header != null: "CSV file should contain a header" - - while (br.ready()) { - def line = br.readLine() - row++ - if (line == null) { - br.close() - break - } - - if (!line.startsWith("#")) { - def predata = splitRegex.split(line, -1) - def data = predata.collect{field -> - if (field == "") { - return null - } - def m = removeQuote.matcher(field) - if (m.find()) { - return m.replaceFirst('$1') - } else { - return field + while (header == null && (line = br.readLine()) != null) { + if (!line.startsWith("#")) { + header = splitRegex.split(line, -1).collect { field -> + def m = removeQuote.matcher(field) + m.find() ? m.replaceFirst('$1') : field } } - assert header.size() == data.size(): "Row $row should contain the same number as fields as the header" - - def dataMap = [header, data].transpose().collectEntries().findAll{it.value != null} - output.add(dataMap) + row++ + } + assert header != null : "CSV file should contain a header" + + while ((line = br.readLine()) != null) { + row++ + if (!line.startsWith("#")) { + def predata = splitRegex.split(line, -1) + def data = predata.collect { field -> + if (field == "") { + return null + } + def m = removeQuote.matcher(field) + if (m.find()) { + return m.replaceFirst('$1') + } else { + return field + } + } + assert header.size() == data.size() : "Row $row should contain the same number as fields as the header" + + def dataMap = [header, data].transpose().collectEntries().findAll { it.value != null } + output.add(dataMap) + } } } @@ -1710,10 +1705,25 @@ process publishFilesProc { ] .transpose() .collectMany{infile, outfile -> - if (infile.toString() != outfile.toString()) { + def infileString = infile.toString() + def outfileString = outfile.toString() + if (infileString != outfileString) { + /* Trailing slashes are removed from both the source and destination arguments. + From source arguments, this is useful when a source argument may have a trailing slash + and specify a symbolic link to a directory. Without removing the slash, cp will dereference + the symbolic link. + See https://www.gnu.org/software/coreutils/manual/html_node/Trailing-slashes.html#Trailing-slashes-1 + + For the destination path addding a trailing slash is a problem when publishing directories: + it requires the destination directory to exist. This fails because we only create the parent + directories first. + */ + def regexTrailingSlashes = ~/\/+$/ + def infileNoTrailingSlash = infileString - regexTrailingSlashes + def outfileNoTrailingSlash = outfileString - regexTrailingSlashes [ - "[ -d \"\$(dirname '${outfile.toString()}')\" ] || mkdir -p \"\$(dirname '${outfile.toString()}')\"", - "cp -r '${infile.toString()}' '${outfile.toString()}'" + "[ -d \"\$(dirname '${outfileNoTrailingSlash}')\" ] || mkdir -p \"\$(dirname '${outfileNoTrailingSlash}')\"", + "cp -a '${infileNoTrailingSlash}' '${outfileNoTrailingSlash}'" ] } else { // no need to copy if infile is the same as outfile @@ -3180,7 +3190,7 @@ meta = [ "type" : "vsh", "name" : "openpipeline", "repo" : "openpipeline", - "tag" : "v4.0.3" + "tag" : "v4.1.0" } ], "links" : { @@ -3288,9 +3298,10 @@ meta = [ "type" : "python", "user" : false, "packages" : [ - "anndata~=0.12.7", + "anndata~=0.12.16", "awkward", - "mudata~=0.3.2", + "scipy~=1.17.1", + "mudata~=0.3.8", "spatialdata~=0.7.2", "pyarrow~=18.0.0", "ome-zarr~=0.13.0" @@ -3313,7 +3324,7 @@ meta = [ "type" : "python", "user" : false, "packages" : [ - "viashpy==0.9.0" + "viashpy==0.10.0" ], "github" : [ "openpipelines-bio/core#subdirectory=packages/python/openpipeline_testutils" @@ -3332,8 +3343,8 @@ meta = [ "runner" : "nextflow", "engine" : "docker|native", "output" : "/workdir/root/repo/target/nextflow/convert/from_spatialdata_to_h5mu", - "viash_version" : "0.9.4", - "git_commit" : "e087099616271bd0f11e825b7817ec14ebef62d7", + "viash_version" : "0.9.7", + "git_commit" : "4449aa6094a686af0a5fbe99b9aaafd01ae75aff", "git_remote" : "https://github.com/openpipelines-bio/openpipeline_spatial" }, "package_config" : { @@ -3353,10 +3364,10 @@ meta = [ "type" : "vsh", "name" : "openpipeline", "repo" : "openpipeline", - "tag" : "v4.0.3" + "tag" : "v4.1.0" } ], - "viash_version" : "0.9.4", + "viash_version" : "0.9.7", "source" : "/workdir/root/repo/src", "target" : "/workdir/root/repo/target", "config_mods" : [ diff --git a/target/nextflow/convert/from_xenium_to_h5mu/.config.vsh.yaml b/target/nextflow/convert/from_xenium_to_h5mu/.config.vsh.yaml index f0a09a0..e9f510b 100644 --- a/target/nextflow/convert/from_xenium_to_h5mu/.config.vsh.yaml +++ b/target/nextflow/convert/from_xenium_to_h5mu/.config.vsh.yaml @@ -121,7 +121,7 @@ repositories: - type: "vsh" name: "openpipeline" repo: "openpipeline" - tag: "v4.0.3" + tag: "v4.1.0" links: repository: "https://github.com/openpipelines-bio/openpipeline_spatial" docker_registry: "ghcr.io" @@ -213,10 +213,11 @@ engines: - type: "python" user: false packages: - - "anndata~=0.12.7" + - "anndata~=0.12.16" - "awkward" - - "mudata~=0.3.2" - - "scanpy~=1.10.4" + - "scipy~=1.17.1" + - "mudata~=0.3.8" + - "scanpy~=1.11.4" - "pyarrow" git: - "https://codeberg.org/miurahr/zipfile-inflate64.git@v0.2" @@ -233,7 +234,7 @@ engines: - type: "python" user: false packages: - - "viashpy==0.9.0" + - "viashpy==0.10.0" upgrade: true entrypoint: [] cmd: null @@ -245,8 +246,8 @@ build_info: engine: "docker|native" output: "target/nextflow/convert/from_xenium_to_h5mu" executable: "target/nextflow/convert/from_xenium_to_h5mu/main.nf" - viash_version: "0.9.4" - git_commit: "e087099616271bd0f11e825b7817ec14ebef62d7" + viash_version: "0.9.7" + git_commit: "4449aa6094a686af0a5fbe99b9aaafd01ae75aff" git_remote: "https://github.com/openpipelines-bio/openpipeline_spatial" package_config: name: "openpipeline_spatial" @@ -260,8 +261,8 @@ package_config: - type: "vsh" name: "openpipeline" repo: "openpipeline" - tag: "v4.0.3" - viash_version: "0.9.4" + tag: "v4.1.0" + viash_version: "0.9.7" source: "src" target: "target" config_mods: diff --git a/target/nextflow/convert/from_xenium_to_h5mu/main.nf b/target/nextflow/convert/from_xenium_to_h5mu/main.nf index 7cd4ce4..33271ef 100644 --- a/target/nextflow/convert/from_xenium_to_h5mu/main.nf +++ b/target/nextflow/convert/from_xenium_to_h5mu/main.nf @@ -1,6 +1,6 @@ // from_xenium_to_h5mu main // -// This wrapper script is auto-generated by viash 0.9.4 and is thus a derivative +// This wrapper script is auto-generated by viash 0.9.7 and is thus a derivative // work thereof. This software comes with ABSOLUTELY NO WARRANTY from Data // Intuitive. // @@ -1353,47 +1353,42 @@ def readCsv(file_path) { def splitRegex = java.util.regex.Pattern.compile(''',(?=(?:[^"]*"[^"]*")*[^"]*$)''') def removeQuote = java.util.regex.Pattern.compile('''"(.*)"''') - def br = java.nio.file.Files.newBufferedReader(inputFile) + java.nio.file.Files.newBufferedReader(inputFile).withCloseable { br -> + def row = 0 + def header = null + def line - def row = -1 - def header = null - while (br.ready() && header == null) { - def line = br.readLine() - row++ - if (!line.startsWith("#")) { - header = splitRegex.split(line, -1).collect{field -> - m = removeQuote.matcher(field) - m.find() ? m.replaceFirst('$1') : field - } - } - } - assert header != null: "CSV file should contain a header" - - while (br.ready()) { - def line = br.readLine() - row++ - if (line == null) { - br.close() - break - } - - if (!line.startsWith("#")) { - def predata = splitRegex.split(line, -1) - def data = predata.collect{field -> - if (field == "") { - return null - } - def m = removeQuote.matcher(field) - if (m.find()) { - return m.replaceFirst('$1') - } else { - return field + while (header == null && (line = br.readLine()) != null) { + if (!line.startsWith("#")) { + header = splitRegex.split(line, -1).collect { field -> + def m = removeQuote.matcher(field) + m.find() ? m.replaceFirst('$1') : field } } - assert header.size() == data.size(): "Row $row should contain the same number as fields as the header" - - def dataMap = [header, data].transpose().collectEntries().findAll{it.value != null} - output.add(dataMap) + row++ + } + assert header != null : "CSV file should contain a header" + + while ((line = br.readLine()) != null) { + row++ + if (!line.startsWith("#")) { + def predata = splitRegex.split(line, -1) + def data = predata.collect { field -> + if (field == "") { + return null + } + def m = removeQuote.matcher(field) + if (m.find()) { + return m.replaceFirst('$1') + } else { + return field + } + } + assert header.size() == data.size() : "Row $row should contain the same number as fields as the header" + + def dataMap = [header, data].transpose().collectEntries().findAll { it.value != null } + output.add(dataMap) + } } } @@ -1709,10 +1704,25 @@ process publishFilesProc { ] .transpose() .collectMany{infile, outfile -> - if (infile.toString() != outfile.toString()) { + def infileString = infile.toString() + def outfileString = outfile.toString() + if (infileString != outfileString) { + /* Trailing slashes are removed from both the source and destination arguments. + From source arguments, this is useful when a source argument may have a trailing slash + and specify a symbolic link to a directory. Without removing the slash, cp will dereference + the symbolic link. + See https://www.gnu.org/software/coreutils/manual/html_node/Trailing-slashes.html#Trailing-slashes-1 + + For the destination path addding a trailing slash is a problem when publishing directories: + it requires the destination directory to exist. This fails because we only create the parent + directories first. + */ + def regexTrailingSlashes = ~/\/+$/ + def infileNoTrailingSlash = infileString - regexTrailingSlashes + def outfileNoTrailingSlash = outfileString - regexTrailingSlashes [ - "[ -d \"\$(dirname '${outfile.toString()}')\" ] || mkdir -p \"\$(dirname '${outfile.toString()}')\"", - "cp -r '${infile.toString()}' '${outfile.toString()}'" + "[ -d \"\$(dirname '${outfileNoTrailingSlash}')\" ] || mkdir -p \"\$(dirname '${outfileNoTrailingSlash}')\"", + "cp -a '${infileNoTrailingSlash}' '${outfileNoTrailingSlash}'" ] } else { // no need to copy if infile is the same as outfile @@ -3194,7 +3204,7 @@ meta = [ "type" : "vsh", "name" : "openpipeline", "repo" : "openpipeline", - "tag" : "v4.0.3" + "tag" : "v4.1.0" } ], "links" : { @@ -3305,10 +3315,11 @@ meta = [ "type" : "python", "user" : false, "packages" : [ - "anndata~=0.12.7", + "anndata~=0.12.16", "awkward", - "mudata~=0.3.2", - "scanpy~=1.10.4", + "scipy~=1.17.1", + "mudata~=0.3.8", + "scanpy~=1.11.4", "pyarrow" ], "git" : [ @@ -3332,7 +3343,7 @@ meta = [ "type" : "python", "user" : false, "packages" : [ - "viashpy==0.9.0" + "viashpy==0.10.0" ], "upgrade" : true } @@ -3348,8 +3359,8 @@ meta = [ "runner" : "nextflow", "engine" : "docker|native", "output" : "/workdir/root/repo/target/nextflow/convert/from_xenium_to_h5mu", - "viash_version" : "0.9.4", - "git_commit" : "e087099616271bd0f11e825b7817ec14ebef62d7", + "viash_version" : "0.9.7", + "git_commit" : "4449aa6094a686af0a5fbe99b9aaafd01ae75aff", "git_remote" : "https://github.com/openpipelines-bio/openpipeline_spatial" }, "package_config" : { @@ -3369,10 +3380,10 @@ meta = [ "type" : "vsh", "name" : "openpipeline", "repo" : "openpipeline", - "tag" : "v4.0.3" + "tag" : "v4.1.0" } ], - "viash_version" : "0.9.4", + "viash_version" : "0.9.7", "source" : "/workdir/root/repo/src", "target" : "/workdir/root/repo/target", "config_mods" : [ diff --git a/target/nextflow/convert/from_xenium_to_spatialdata/.config.vsh.yaml b/target/nextflow/convert/from_xenium_to_spatialdata/.config.vsh.yaml index 8d00181..dcb26c9 100644 --- a/target/nextflow/convert/from_xenium_to_spatialdata/.config.vsh.yaml +++ b/target/nextflow/convert/from_xenium_to_spatialdata/.config.vsh.yaml @@ -201,7 +201,7 @@ repositories: - type: "vsh" name: "openpipeline" repo: "openpipeline" - tag: "v4.0.3" + tag: "v4.1.0" links: repository: "https://github.com/openpipelines-bio/openpipeline_spatial" docker_registry: "ghcr.io" @@ -308,7 +308,7 @@ engines: - type: "python" user: false packages: - - "viashpy==0.9.0" + - "viashpy==0.10.0" github: - "openpipelines-bio/core#subdirectory=packages/python/openpipeline_testutils" upgrade: true @@ -326,8 +326,8 @@ build_info: engine: "docker|native" output: "target/nextflow/convert/from_xenium_to_spatialdata" executable: "target/nextflow/convert/from_xenium_to_spatialdata/main.nf" - viash_version: "0.9.4" - git_commit: "e087099616271bd0f11e825b7817ec14ebef62d7" + viash_version: "0.9.7" + git_commit: "4449aa6094a686af0a5fbe99b9aaafd01ae75aff" git_remote: "https://github.com/openpipelines-bio/openpipeline_spatial" package_config: name: "openpipeline_spatial" @@ -341,8 +341,8 @@ package_config: - type: "vsh" name: "openpipeline" repo: "openpipeline" - tag: "v4.0.3" - viash_version: "0.9.4" + tag: "v4.1.0" + viash_version: "0.9.7" source: "src" target: "target" config_mods: diff --git a/target/nextflow/convert/from_xenium_to_spatialdata/main.nf b/target/nextflow/convert/from_xenium_to_spatialdata/main.nf index fe918b9..0a20eeb 100644 --- a/target/nextflow/convert/from_xenium_to_spatialdata/main.nf +++ b/target/nextflow/convert/from_xenium_to_spatialdata/main.nf @@ -1,6 +1,6 @@ // from_xenium_to_spatialdata main // -// This wrapper script is auto-generated by viash 0.9.4 and is thus a derivative +// This wrapper script is auto-generated by viash 0.9.7 and is thus a derivative // work thereof. This software comes with ABSOLUTELY NO WARRANTY from Data // Intuitive. // @@ -1354,47 +1354,42 @@ def readCsv(file_path) { def splitRegex = java.util.regex.Pattern.compile(''',(?=(?:[^"]*"[^"]*")*[^"]*$)''') def removeQuote = java.util.regex.Pattern.compile('''"(.*)"''') - def br = java.nio.file.Files.newBufferedReader(inputFile) + java.nio.file.Files.newBufferedReader(inputFile).withCloseable { br -> + def row = 0 + def header = null + def line - def row = -1 - def header = null - while (br.ready() && header == null) { - def line = br.readLine() - row++ - if (!line.startsWith("#")) { - header = splitRegex.split(line, -1).collect{field -> - m = removeQuote.matcher(field) - m.find() ? m.replaceFirst('$1') : field - } - } - } - assert header != null: "CSV file should contain a header" - - while (br.ready()) { - def line = br.readLine() - row++ - if (line == null) { - br.close() - break - } - - if (!line.startsWith("#")) { - def predata = splitRegex.split(line, -1) - def data = predata.collect{field -> - if (field == "") { - return null - } - def m = removeQuote.matcher(field) - if (m.find()) { - return m.replaceFirst('$1') - } else { - return field + while (header == null && (line = br.readLine()) != null) { + if (!line.startsWith("#")) { + header = splitRegex.split(line, -1).collect { field -> + def m = removeQuote.matcher(field) + m.find() ? m.replaceFirst('$1') : field } } - assert header.size() == data.size(): "Row $row should contain the same number as fields as the header" - - def dataMap = [header, data].transpose().collectEntries().findAll{it.value != null} - output.add(dataMap) + row++ + } + assert header != null : "CSV file should contain a header" + + while ((line = br.readLine()) != null) { + row++ + if (!line.startsWith("#")) { + def predata = splitRegex.split(line, -1) + def data = predata.collect { field -> + if (field == "") { + return null + } + def m = removeQuote.matcher(field) + if (m.find()) { + return m.replaceFirst('$1') + } else { + return field + } + } + assert header.size() == data.size() : "Row $row should contain the same number as fields as the header" + + def dataMap = [header, data].transpose().collectEntries().findAll { it.value != null } + output.add(dataMap) + } } } @@ -1710,10 +1705,25 @@ process publishFilesProc { ] .transpose() .collectMany{infile, outfile -> - if (infile.toString() != outfile.toString()) { + def infileString = infile.toString() + def outfileString = outfile.toString() + if (infileString != outfileString) { + /* Trailing slashes are removed from both the source and destination arguments. + From source arguments, this is useful when a source argument may have a trailing slash + and specify a symbolic link to a directory. Without removing the slash, cp will dereference + the symbolic link. + See https://www.gnu.org/software/coreutils/manual/html_node/Trailing-slashes.html#Trailing-slashes-1 + + For the destination path addding a trailing slash is a problem when publishing directories: + it requires the destination directory to exist. This fails because we only create the parent + directories first. + */ + def regexTrailingSlashes = ~/\/+$/ + def infileNoTrailingSlash = infileString - regexTrailingSlashes + def outfileNoTrailingSlash = outfileString - regexTrailingSlashes [ - "[ -d \"\$(dirname '${outfile.toString()}')\" ] || mkdir -p \"\$(dirname '${outfile.toString()}')\"", - "cp -r '${infile.toString()}' '${outfile.toString()}'" + "[ -d \"\$(dirname '${outfileNoTrailingSlash}')\" ] || mkdir -p \"\$(dirname '${outfileNoTrailingSlash}')\"", + "cp -a '${infileNoTrailingSlash}' '${outfileNoTrailingSlash}'" ] } else { // no need to copy if infile is the same as outfile @@ -3283,7 +3293,7 @@ meta = [ "type" : "vsh", "name" : "openpipeline", "repo" : "openpipeline", - "tag" : "v4.0.3" + "tag" : "v4.1.0" } ], "links" : { @@ -3417,7 +3427,7 @@ meta = [ "type" : "python", "user" : false, "packages" : [ - "viashpy==0.9.0" + "viashpy==0.10.0" ], "github" : [ "openpipelines-bio/core#subdirectory=packages/python/openpipeline_testutils" @@ -3443,8 +3453,8 @@ meta = [ "runner" : "nextflow", "engine" : "docker|native", "output" : "/workdir/root/repo/target/nextflow/convert/from_xenium_to_spatialdata", - "viash_version" : "0.9.4", - "git_commit" : "e087099616271bd0f11e825b7817ec14ebef62d7", + "viash_version" : "0.9.7", + "git_commit" : "4449aa6094a686af0a5fbe99b9aaafd01ae75aff", "git_remote" : "https://github.com/openpipelines-bio/openpipeline_spatial" }, "package_config" : { @@ -3464,10 +3474,10 @@ meta = [ "type" : "vsh", "name" : "openpipeline", "repo" : "openpipeline", - "tag" : "v4.0.3" + "tag" : "v4.1.0" } ], - "viash_version" : "0.9.4", + "viash_version" : "0.9.7", "source" : "/workdir/root/repo/src", "target" : "/workdir/root/repo/target", "config_mods" : [ diff --git a/target/nextflow/convert/from_xenium_to_spatialexperiment/.config.vsh.yaml b/target/nextflow/convert/from_xenium_to_spatialexperiment/.config.vsh.yaml index 65fa922..f79ae85 100644 --- a/target/nextflow/convert/from_xenium_to_spatialexperiment/.config.vsh.yaml +++ b/target/nextflow/convert/from_xenium_to_spatialexperiment/.config.vsh.yaml @@ -115,7 +115,7 @@ repositories: - type: "vsh" name: "openpipeline" repo: "openpipeline" - tag: "v4.0.3" + tag: "v4.1.0" links: repository: "https://github.com/openpipelines-bio/openpipeline_spatial" docker_registry: "ghcr.io" @@ -231,8 +231,8 @@ build_info: engine: "docker|native" output: "target/nextflow/convert/from_xenium_to_spatialexperiment" executable: "target/nextflow/convert/from_xenium_to_spatialexperiment/main.nf" - viash_version: "0.9.4" - git_commit: "e087099616271bd0f11e825b7817ec14ebef62d7" + viash_version: "0.9.7" + git_commit: "4449aa6094a686af0a5fbe99b9aaafd01ae75aff" git_remote: "https://github.com/openpipelines-bio/openpipeline_spatial" package_config: name: "openpipeline_spatial" @@ -246,8 +246,8 @@ package_config: - type: "vsh" name: "openpipeline" repo: "openpipeline" - tag: "v4.0.3" - viash_version: "0.9.4" + tag: "v4.1.0" + viash_version: "0.9.7" source: "src" target: "target" config_mods: diff --git a/target/nextflow/convert/from_xenium_to_spatialexperiment/main.nf b/target/nextflow/convert/from_xenium_to_spatialexperiment/main.nf index 4a74895..721c9e4 100644 --- a/target/nextflow/convert/from_xenium_to_spatialexperiment/main.nf +++ b/target/nextflow/convert/from_xenium_to_spatialexperiment/main.nf @@ -1,6 +1,6 @@ // from_xenium_to_spatialexperiment main // -// This wrapper script is auto-generated by viash 0.9.4 and is thus a derivative +// This wrapper script is auto-generated by viash 0.9.7 and is thus a derivative // work thereof. This software comes with ABSOLUTELY NO WARRANTY from Data // Intuitive. // @@ -1353,47 +1353,42 @@ def readCsv(file_path) { def splitRegex = java.util.regex.Pattern.compile(''',(?=(?:[^"]*"[^"]*")*[^"]*$)''') def removeQuote = java.util.regex.Pattern.compile('''"(.*)"''') - def br = java.nio.file.Files.newBufferedReader(inputFile) + java.nio.file.Files.newBufferedReader(inputFile).withCloseable { br -> + def row = 0 + def header = null + def line - def row = -1 - def header = null - while (br.ready() && header == null) { - def line = br.readLine() - row++ - if (!line.startsWith("#")) { - header = splitRegex.split(line, -1).collect{field -> - m = removeQuote.matcher(field) - m.find() ? m.replaceFirst('$1') : field - } - } - } - assert header != null: "CSV file should contain a header" - - while (br.ready()) { - def line = br.readLine() - row++ - if (line == null) { - br.close() - break - } - - if (!line.startsWith("#")) { - def predata = splitRegex.split(line, -1) - def data = predata.collect{field -> - if (field == "") { - return null - } - def m = removeQuote.matcher(field) - if (m.find()) { - return m.replaceFirst('$1') - } else { - return field + while (header == null && (line = br.readLine()) != null) { + if (!line.startsWith("#")) { + header = splitRegex.split(line, -1).collect { field -> + def m = removeQuote.matcher(field) + m.find() ? m.replaceFirst('$1') : field } } - assert header.size() == data.size(): "Row $row should contain the same number as fields as the header" - - def dataMap = [header, data].transpose().collectEntries().findAll{it.value != null} - output.add(dataMap) + row++ + } + assert header != null : "CSV file should contain a header" + + while ((line = br.readLine()) != null) { + row++ + if (!line.startsWith("#")) { + def predata = splitRegex.split(line, -1) + def data = predata.collect { field -> + if (field == "") { + return null + } + def m = removeQuote.matcher(field) + if (m.find()) { + return m.replaceFirst('$1') + } else { + return field + } + } + assert header.size() == data.size() : "Row $row should contain the same number as fields as the header" + + def dataMap = [header, data].transpose().collectEntries().findAll { it.value != null } + output.add(dataMap) + } } } @@ -1709,10 +1704,25 @@ process publishFilesProc { ] .transpose() .collectMany{infile, outfile -> - if (infile.toString() != outfile.toString()) { + def infileString = infile.toString() + def outfileString = outfile.toString() + if (infileString != outfileString) { + /* Trailing slashes are removed from both the source and destination arguments. + From source arguments, this is useful when a source argument may have a trailing slash + and specify a symbolic link to a directory. Without removing the slash, cp will dereference + the symbolic link. + See https://www.gnu.org/software/coreutils/manual/html_node/Trailing-slashes.html#Trailing-slashes-1 + + For the destination path addding a trailing slash is a problem when publishing directories: + it requires the destination directory to exist. This fails because we only create the parent + directories first. + */ + def regexTrailingSlashes = ~/\/+$/ + def infileNoTrailingSlash = infileString - regexTrailingSlashes + def outfileNoTrailingSlash = outfileString - regexTrailingSlashes [ - "[ -d \"\$(dirname '${outfile.toString()}')\" ] || mkdir -p \"\$(dirname '${outfile.toString()}')\"", - "cp -r '${infile.toString()}' '${outfile.toString()}'" + "[ -d \"\$(dirname '${outfileNoTrailingSlash}')\" ] || mkdir -p \"\$(dirname '${outfileNoTrailingSlash}')\"", + "cp -a '${infileNoTrailingSlash}' '${outfileNoTrailingSlash}'" ] } else { // no need to copy if infile is the same as outfile @@ -3179,7 +3189,7 @@ meta = [ "type" : "vsh", "name" : "openpipeline", "repo" : "openpipeline", - "tag" : "v4.0.3" + "tag" : "v4.1.0" } ], "links" : { @@ -3328,8 +3338,8 @@ meta = [ "runner" : "nextflow", "engine" : "docker|native", "output" : "/workdir/root/repo/target/nextflow/convert/from_xenium_to_spatialexperiment", - "viash_version" : "0.9.4", - "git_commit" : "e087099616271bd0f11e825b7817ec14ebef62d7", + "viash_version" : "0.9.7", + "git_commit" : "4449aa6094a686af0a5fbe99b9aaafd01ae75aff", "git_remote" : "https://github.com/openpipelines-bio/openpipeline_spatial" }, "package_config" : { @@ -3349,10 +3359,10 @@ meta = [ "type" : "vsh", "name" : "openpipeline", "repo" : "openpipeline", - "tag" : "v4.0.3" + "tag" : "v4.1.0" } ], - "viash_version" : "0.9.4", + "viash_version" : "0.9.7", "source" : "/workdir/root/repo/src", "target" : "/workdir/root/repo/target", "config_mods" : [ diff --git a/target/nextflow/dataflow/concatenate_spatialdata/.config.vsh.yaml b/target/nextflow/dataflow/concatenate_spatialdata/.config.vsh.yaml index 1913c92..fc5bbad 100644 --- a/target/nextflow/dataflow/concatenate_spatialdata/.config.vsh.yaml +++ b/target/nextflow/dataflow/concatenate_spatialdata/.config.vsh.yaml @@ -176,7 +176,7 @@ repositories: - type: "vsh" name: "openpipeline" repo: "openpipeline" - tag: "v4.0.3" + tag: "v4.1.0" links: repository: "https://github.com/openpipelines-bio/openpipeline_spatial" docker_registry: "ghcr.io" @@ -269,8 +269,9 @@ engines: - "spatialdata~=0.7.2" - "pyarrow~=18.0.0" - "ome-zarr~=0.13.0" - - "anndata~=0.12.7" + - "anndata~=0.12.16" - "awkward" + - "scipy~=1.17.1" upgrade: true test_setup: - type: "apt" @@ -280,7 +281,7 @@ engines: - type: "python" user: false packages: - - "viashpy==0.9.0" + - "viashpy==0.10.0" github: - "openpipelines-bio/core#subdirectory=packages/python/openpipeline_testutils" upgrade: true @@ -296,8 +297,8 @@ build_info: engine: "docker|native|native" output: "target/nextflow/dataflow/concatenate_spatialdata" executable: "target/nextflow/dataflow/concatenate_spatialdata/main.nf" - viash_version: "0.9.4" - git_commit: "e087099616271bd0f11e825b7817ec14ebef62d7" + viash_version: "0.9.7" + git_commit: "4449aa6094a686af0a5fbe99b9aaafd01ae75aff" git_remote: "https://github.com/openpipelines-bio/openpipeline_spatial" package_config: name: "openpipeline_spatial" @@ -311,8 +312,8 @@ package_config: - type: "vsh" name: "openpipeline" repo: "openpipeline" - tag: "v4.0.3" - viash_version: "0.9.4" + tag: "v4.1.0" + viash_version: "0.9.7" source: "src" target: "target" config_mods: diff --git a/target/nextflow/dataflow/concatenate_spatialdata/main.nf b/target/nextflow/dataflow/concatenate_spatialdata/main.nf index 23832d6..59f5c7e 100644 --- a/target/nextflow/dataflow/concatenate_spatialdata/main.nf +++ b/target/nextflow/dataflow/concatenate_spatialdata/main.nf @@ -1,6 +1,6 @@ // concatenate_spatialdata main // -// This wrapper script is auto-generated by viash 0.9.4 and is thus a derivative +// This wrapper script is auto-generated by viash 0.9.7 and is thus a derivative // work thereof. This software comes with ABSOLUTELY NO WARRANTY from Data // Intuitive. // @@ -1354,47 +1354,42 @@ def readCsv(file_path) { def splitRegex = java.util.regex.Pattern.compile(''',(?=(?:[^"]*"[^"]*")*[^"]*$)''') def removeQuote = java.util.regex.Pattern.compile('''"(.*)"''') - def br = java.nio.file.Files.newBufferedReader(inputFile) + java.nio.file.Files.newBufferedReader(inputFile).withCloseable { br -> + def row = 0 + def header = null + def line - def row = -1 - def header = null - while (br.ready() && header == null) { - def line = br.readLine() - row++ - if (!line.startsWith("#")) { - header = splitRegex.split(line, -1).collect{field -> - m = removeQuote.matcher(field) - m.find() ? m.replaceFirst('$1') : field - } - } - } - assert header != null: "CSV file should contain a header" - - while (br.ready()) { - def line = br.readLine() - row++ - if (line == null) { - br.close() - break - } - - if (!line.startsWith("#")) { - def predata = splitRegex.split(line, -1) - def data = predata.collect{field -> - if (field == "") { - return null - } - def m = removeQuote.matcher(field) - if (m.find()) { - return m.replaceFirst('$1') - } else { - return field + while (header == null && (line = br.readLine()) != null) { + if (!line.startsWith("#")) { + header = splitRegex.split(line, -1).collect { field -> + def m = removeQuote.matcher(field) + m.find() ? m.replaceFirst('$1') : field } } - assert header.size() == data.size(): "Row $row should contain the same number as fields as the header" - - def dataMap = [header, data].transpose().collectEntries().findAll{it.value != null} - output.add(dataMap) + row++ + } + assert header != null : "CSV file should contain a header" + + while ((line = br.readLine()) != null) { + row++ + if (!line.startsWith("#")) { + def predata = splitRegex.split(line, -1) + def data = predata.collect { field -> + if (field == "") { + return null + } + def m = removeQuote.matcher(field) + if (m.find()) { + return m.replaceFirst('$1') + } else { + return field + } + } + assert header.size() == data.size() : "Row $row should contain the same number as fields as the header" + + def dataMap = [header, data].transpose().collectEntries().findAll { it.value != null } + output.add(dataMap) + } } } @@ -1710,10 +1705,25 @@ process publishFilesProc { ] .transpose() .collectMany{infile, outfile -> - if (infile.toString() != outfile.toString()) { + def infileString = infile.toString() + def outfileString = outfile.toString() + if (infileString != outfileString) { + /* Trailing slashes are removed from both the source and destination arguments. + From source arguments, this is useful when a source argument may have a trailing slash + and specify a symbolic link to a directory. Without removing the slash, cp will dereference + the symbolic link. + See https://www.gnu.org/software/coreutils/manual/html_node/Trailing-slashes.html#Trailing-slashes-1 + + For the destination path addding a trailing slash is a problem when publishing directories: + it requires the destination directory to exist. This fails because we only create the parent + directories first. + */ + def regexTrailingSlashes = ~/\/+$/ + def infileNoTrailingSlash = infileString - regexTrailingSlashes + def outfileNoTrailingSlash = outfileString - regexTrailingSlashes [ - "[ -d \"\$(dirname '${outfile.toString()}')\" ] || mkdir -p \"\$(dirname '${outfile.toString()}')\"", - "cp -r '${infile.toString()}' '${outfile.toString()}'" + "[ -d \"\$(dirname '${outfileNoTrailingSlash}')\" ] || mkdir -p \"\$(dirname '${outfileNoTrailingSlash}')\"", + "cp -a '${infileNoTrailingSlash}' '${outfileNoTrailingSlash}'" ] } else { // no need to copy if infile is the same as outfile @@ -3254,7 +3264,7 @@ meta = [ "type" : "vsh", "name" : "openpipeline", "repo" : "openpipeline", - "tag" : "v4.0.3" + "tag" : "v4.1.0" } ], "links" : { @@ -3366,8 +3376,9 @@ meta = [ "spatialdata~=0.7.2", "pyarrow~=18.0.0", "ome-zarr~=0.13.0", - "anndata~=0.12.7", - "awkward" + "anndata~=0.12.16", + "awkward", + "scipy~=1.17.1" ], "upgrade" : true } @@ -3384,7 +3395,7 @@ meta = [ "type" : "python", "user" : false, "packages" : [ - "viashpy==0.9.0" + "viashpy==0.10.0" ], "github" : [ "openpipelines-bio/core#subdirectory=packages/python/openpipeline_testutils" @@ -3407,8 +3418,8 @@ meta = [ "runner" : "nextflow", "engine" : "docker|native|native", "output" : "/workdir/root/repo/target/nextflow/dataflow/concatenate_spatialdata", - "viash_version" : "0.9.4", - "git_commit" : "e087099616271bd0f11e825b7817ec14ebef62d7", + "viash_version" : "0.9.7", + "git_commit" : "4449aa6094a686af0a5fbe99b9aaafd01ae75aff", "git_remote" : "https://github.com/openpipelines-bio/openpipeline_spatial" }, "package_config" : { @@ -3428,10 +3439,10 @@ meta = [ "type" : "vsh", "name" : "openpipeline", "repo" : "openpipeline", - "tag" : "v4.0.3" + "tag" : "v4.1.0" } ], - "viash_version" : "0.9.4", + "viash_version" : "0.9.7", "source" : "/workdir/root/repo/src", "target" : "/workdir/root/repo/target", "config_mods" : [ diff --git a/target/nextflow/dataflow/move_layer_spatialdata/.config.vsh.yaml b/target/nextflow/dataflow/move_layer_spatialdata/.config.vsh.yaml index a700082..6a3b192 100644 --- a/target/nextflow/dataflow/move_layer_spatialdata/.config.vsh.yaml +++ b/target/nextflow/dataflow/move_layer_spatialdata/.config.vsh.yaml @@ -123,7 +123,7 @@ repositories: - type: "vsh" name: "openpipeline" repo: "openpipeline" - tag: "v4.0.3" + tag: "v4.1.0" links: repository: "https://github.com/openpipelines-bio/openpipeline_spatial" docker_registry: "ghcr.io" @@ -225,7 +225,7 @@ engines: - type: "python" user: false packages: - - "viashpy==0.9.0" + - "viashpy==0.10.0" github: - "openpipelines-bio/core#subdirectory=packages/python/openpipeline_testutils" upgrade: true @@ -241,8 +241,8 @@ build_info: engine: "docker|native|native" output: "target/nextflow/dataflow/move_layer_spatialdata" executable: "target/nextflow/dataflow/move_layer_spatialdata/main.nf" - viash_version: "0.9.4" - git_commit: "e087099616271bd0f11e825b7817ec14ebef62d7" + viash_version: "0.9.7" + git_commit: "4449aa6094a686af0a5fbe99b9aaafd01ae75aff" git_remote: "https://github.com/openpipelines-bio/openpipeline_spatial" package_config: name: "openpipeline_spatial" @@ -256,8 +256,8 @@ package_config: - type: "vsh" name: "openpipeline" repo: "openpipeline" - tag: "v4.0.3" - viash_version: "0.9.4" + tag: "v4.1.0" + viash_version: "0.9.7" source: "src" target: "target" config_mods: diff --git a/target/nextflow/dataflow/move_layer_spatialdata/main.nf b/target/nextflow/dataflow/move_layer_spatialdata/main.nf index 5fa7c30..429405a 100644 --- a/target/nextflow/dataflow/move_layer_spatialdata/main.nf +++ b/target/nextflow/dataflow/move_layer_spatialdata/main.nf @@ -1,6 +1,6 @@ // move_layer_spatialdata main // -// This wrapper script is auto-generated by viash 0.9.4 and is thus a derivative +// This wrapper script is auto-generated by viash 0.9.7 and is thus a derivative // work thereof. This software comes with ABSOLUTELY NO WARRANTY from Data // Intuitive. // @@ -1354,47 +1354,42 @@ def readCsv(file_path) { def splitRegex = java.util.regex.Pattern.compile(''',(?=(?:[^"]*"[^"]*")*[^"]*$)''') def removeQuote = java.util.regex.Pattern.compile('''"(.*)"''') - def br = java.nio.file.Files.newBufferedReader(inputFile) + java.nio.file.Files.newBufferedReader(inputFile).withCloseable { br -> + def row = 0 + def header = null + def line - def row = -1 - def header = null - while (br.ready() && header == null) { - def line = br.readLine() - row++ - if (!line.startsWith("#")) { - header = splitRegex.split(line, -1).collect{field -> - m = removeQuote.matcher(field) - m.find() ? m.replaceFirst('$1') : field - } - } - } - assert header != null: "CSV file should contain a header" - - while (br.ready()) { - def line = br.readLine() - row++ - if (line == null) { - br.close() - break - } - - if (!line.startsWith("#")) { - def predata = splitRegex.split(line, -1) - def data = predata.collect{field -> - if (field == "") { - return null - } - def m = removeQuote.matcher(field) - if (m.find()) { - return m.replaceFirst('$1') - } else { - return field + while (header == null && (line = br.readLine()) != null) { + if (!line.startsWith("#")) { + header = splitRegex.split(line, -1).collect { field -> + def m = removeQuote.matcher(field) + m.find() ? m.replaceFirst('$1') : field } } - assert header.size() == data.size(): "Row $row should contain the same number as fields as the header" - - def dataMap = [header, data].transpose().collectEntries().findAll{it.value != null} - output.add(dataMap) + row++ + } + assert header != null : "CSV file should contain a header" + + while ((line = br.readLine()) != null) { + row++ + if (!line.startsWith("#")) { + def predata = splitRegex.split(line, -1) + def data = predata.collect { field -> + if (field == "") { + return null + } + def m = removeQuote.matcher(field) + if (m.find()) { + return m.replaceFirst('$1') + } else { + return field + } + } + assert header.size() == data.size() : "Row $row should contain the same number as fields as the header" + + def dataMap = [header, data].transpose().collectEntries().findAll { it.value != null } + output.add(dataMap) + } } } @@ -1710,10 +1705,25 @@ process publishFilesProc { ] .transpose() .collectMany{infile, outfile -> - if (infile.toString() != outfile.toString()) { + def infileString = infile.toString() + def outfileString = outfile.toString() + if (infileString != outfileString) { + /* Trailing slashes are removed from both the source and destination arguments. + From source arguments, this is useful when a source argument may have a trailing slash + and specify a symbolic link to a directory. Without removing the slash, cp will dereference + the symbolic link. + See https://www.gnu.org/software/coreutils/manual/html_node/Trailing-slashes.html#Trailing-slashes-1 + + For the destination path addding a trailing slash is a problem when publishing directories: + it requires the destination directory to exist. This fails because we only create the parent + directories first. + */ + def regexTrailingSlashes = ~/\/+$/ + def infileNoTrailingSlash = infileString - regexTrailingSlashes + def outfileNoTrailingSlash = outfileString - regexTrailingSlashes [ - "[ -d \"\$(dirname '${outfile.toString()}')\" ] || mkdir -p \"\$(dirname '${outfile.toString()}')\"", - "cp -r '${infile.toString()}' '${outfile.toString()}'" + "[ -d \"\$(dirname '${outfileNoTrailingSlash}')\" ] || mkdir -p \"\$(dirname '${outfileNoTrailingSlash}')\"", + "cp -a '${infileNoTrailingSlash}' '${outfileNoTrailingSlash}'" ] } else { // no need to copy if infile is the same as outfile @@ -3206,7 +3216,7 @@ meta = [ "type" : "vsh", "name" : "openpipeline", "repo" : "openpipeline", - "tag" : "v4.0.3" + "tag" : "v4.1.0" } ], "links" : { @@ -3334,7 +3344,7 @@ meta = [ "type" : "python", "user" : false, "packages" : [ - "viashpy==0.9.0" + "viashpy==0.10.0" ], "github" : [ "openpipelines-bio/core#subdirectory=packages/python/openpipeline_testutils" @@ -3357,8 +3367,8 @@ meta = [ "runner" : "nextflow", "engine" : "docker|native|native", "output" : "/workdir/root/repo/target/nextflow/dataflow/move_layer_spatialdata", - "viash_version" : "0.9.4", - "git_commit" : "e087099616271bd0f11e825b7817ec14ebef62d7", + "viash_version" : "0.9.7", + "git_commit" : "4449aa6094a686af0a5fbe99b9aaafd01ae75aff", "git_remote" : "https://github.com/openpipelines-bio/openpipeline_spatial" }, "package_config" : { @@ -3378,10 +3388,10 @@ meta = [ "type" : "vsh", "name" : "openpipeline", "repo" : "openpipeline", - "tag" : "v4.0.3" + "tag" : "v4.1.0" } ], - "viash_version" : "0.9.4", + "viash_version" : "0.9.7", "source" : "/workdir/root/repo/src", "target" : "/workdir/root/repo/target", "config_mods" : [ diff --git a/target/nextflow/feature_annotation/spatial_autocorr/.config.vsh.yaml b/target/nextflow/feature_annotation/spatial_autocorr/.config.vsh.yaml index e0faa6e..e578248 100644 --- a/target/nextflow/feature_annotation/spatial_autocorr/.config.vsh.yaml +++ b/target/nextflow/feature_annotation/spatial_autocorr/.config.vsh.yaml @@ -158,7 +158,7 @@ repositories: - type: "vsh" name: "openpipeline" repo: "openpipeline" - tag: "v4.0.3" + tag: "v4.1.0" links: repository: "https://github.com/openpipelines-bio/openpipeline_spatial" docker_registry: "ghcr.io" @@ -247,11 +247,12 @@ engines: - type: "python" user: false packages: - - "anndata~=0.12.7" + - "anndata~=0.12.16" - "awkward" - - "mudata~=0.3.2" - - "scanpy~=1.10.4" - - "scanpy~=1.10.4" + - "scipy~=1.17.1" + - "mudata~=0.3.8" + - "scanpy~=1.11.4" + - "scanpy~=1.11.4" - "squidpy~=1.8.1" script: - "exec(\"try:\\n import zarr; from importlib.metadata import version\\nexcept\ @@ -277,8 +278,8 @@ build_info: engine: "docker|native|native" output: "target/nextflow/feature_annotation/spatial_autocorr" executable: "target/nextflow/feature_annotation/spatial_autocorr/main.nf" - viash_version: "0.9.4" - git_commit: "e087099616271bd0f11e825b7817ec14ebef62d7" + viash_version: "0.9.7" + git_commit: "4449aa6094a686af0a5fbe99b9aaafd01ae75aff" git_remote: "https://github.com/openpipelines-bio/openpipeline_spatial" package_config: name: "openpipeline_spatial" @@ -292,8 +293,8 @@ package_config: - type: "vsh" name: "openpipeline" repo: "openpipeline" - tag: "v4.0.3" - viash_version: "0.9.4" + tag: "v4.1.0" + viash_version: "0.9.7" source: "src" target: "target" config_mods: diff --git a/target/nextflow/feature_annotation/spatial_autocorr/main.nf b/target/nextflow/feature_annotation/spatial_autocorr/main.nf index dcff309..eab74da 100644 --- a/target/nextflow/feature_annotation/spatial_autocorr/main.nf +++ b/target/nextflow/feature_annotation/spatial_autocorr/main.nf @@ -1,6 +1,6 @@ // spatial_autocorr main // -// This wrapper script is auto-generated by viash 0.9.4 and is thus a derivative +// This wrapper script is auto-generated by viash 0.9.7 and is thus a derivative // work thereof. This software comes with ABSOLUTELY NO WARRANTY from Data // Intuitive. // @@ -1350,47 +1350,42 @@ def readCsv(file_path) { def splitRegex = java.util.regex.Pattern.compile(''',(?=(?:[^"]*"[^"]*")*[^"]*$)''') def removeQuote = java.util.regex.Pattern.compile('''"(.*)"''') - def br = java.nio.file.Files.newBufferedReader(inputFile) + java.nio.file.Files.newBufferedReader(inputFile).withCloseable { br -> + def row = 0 + def header = null + def line - def row = -1 - def header = null - while (br.ready() && header == null) { - def line = br.readLine() - row++ - if (!line.startsWith("#")) { - header = splitRegex.split(line, -1).collect{field -> - m = removeQuote.matcher(field) - m.find() ? m.replaceFirst('$1') : field - } - } - } - assert header != null: "CSV file should contain a header" - - while (br.ready()) { - def line = br.readLine() - row++ - if (line == null) { - br.close() - break - } - - if (!line.startsWith("#")) { - def predata = splitRegex.split(line, -1) - def data = predata.collect{field -> - if (field == "") { - return null - } - def m = removeQuote.matcher(field) - if (m.find()) { - return m.replaceFirst('$1') - } else { - return field + while (header == null && (line = br.readLine()) != null) { + if (!line.startsWith("#")) { + header = splitRegex.split(line, -1).collect { field -> + def m = removeQuote.matcher(field) + m.find() ? m.replaceFirst('$1') : field } } - assert header.size() == data.size(): "Row $row should contain the same number as fields as the header" - - def dataMap = [header, data].transpose().collectEntries().findAll{it.value != null} - output.add(dataMap) + row++ + } + assert header != null : "CSV file should contain a header" + + while ((line = br.readLine()) != null) { + row++ + if (!line.startsWith("#")) { + def predata = splitRegex.split(line, -1) + def data = predata.collect { field -> + if (field == "") { + return null + } + def m = removeQuote.matcher(field) + if (m.find()) { + return m.replaceFirst('$1') + } else { + return field + } + } + assert header.size() == data.size() : "Row $row should contain the same number as fields as the header" + + def dataMap = [header, data].transpose().collectEntries().findAll { it.value != null } + output.add(dataMap) + } } } @@ -1706,10 +1701,25 @@ process publishFilesProc { ] .transpose() .collectMany{infile, outfile -> - if (infile.toString() != outfile.toString()) { + def infileString = infile.toString() + def outfileString = outfile.toString() + if (infileString != outfileString) { + /* Trailing slashes are removed from both the source and destination arguments. + From source arguments, this is useful when a source argument may have a trailing slash + and specify a symbolic link to a directory. Without removing the slash, cp will dereference + the symbolic link. + See https://www.gnu.org/software/coreutils/manual/html_node/Trailing-slashes.html#Trailing-slashes-1 + + For the destination path addding a trailing slash is a problem when publishing directories: + it requires the destination directory to exist. This fails because we only create the parent + directories first. + */ + def regexTrailingSlashes = ~/\/+$/ + def infileNoTrailingSlash = infileString - regexTrailingSlashes + def outfileNoTrailingSlash = outfileString - regexTrailingSlashes [ - "[ -d \"\$(dirname '${outfile.toString()}')\" ] || mkdir -p \"\$(dirname '${outfile.toString()}')\"", - "cp -r '${infile.toString()}' '${outfile.toString()}'" + "[ -d \"\$(dirname '${outfileNoTrailingSlash}')\" ] || mkdir -p \"\$(dirname '${outfileNoTrailingSlash}')\"", + "cp -a '${infileNoTrailingSlash}' '${outfileNoTrailingSlash}'" ] } else { // no need to copy if infile is the same as outfile @@ -3219,7 +3229,7 @@ meta = [ "type" : "vsh", "name" : "openpipeline", "repo" : "openpipeline", - "tag" : "v4.0.3" + "tag" : "v4.1.0" } ], "links" : { @@ -3327,11 +3337,12 @@ meta = [ "type" : "python", "user" : false, "packages" : [ - "anndata~=0.12.7", + "anndata~=0.12.16", "awkward", - "mudata~=0.3.2", - "scanpy~=1.10.4", - "scanpy~=1.10.4", + "scipy~=1.17.1", + "mudata~=0.3.8", + "scanpy~=1.11.4", + "scanpy~=1.11.4", "squidpy~=1.8.1" ], "script" : [ @@ -3366,8 +3377,8 @@ meta = [ "runner" : "nextflow", "engine" : "docker|native|native", "output" : "/workdir/root/repo/target/nextflow/feature_annotation/spatial_autocorr", - "viash_version" : "0.9.4", - "git_commit" : "e087099616271bd0f11e825b7817ec14ebef62d7", + "viash_version" : "0.9.7", + "git_commit" : "4449aa6094a686af0a5fbe99b9aaafd01ae75aff", "git_remote" : "https://github.com/openpipelines-bio/openpipeline_spatial" }, "package_config" : { @@ -3387,10 +3398,10 @@ meta = [ "type" : "vsh", "name" : "openpipeline", "repo" : "openpipeline", - "tag" : "v4.0.3" + "tag" : "v4.1.0" } ], - "viash_version" : "0.9.4", + "viash_version" : "0.9.7", "source" : "/workdir/root/repo/src", "target" : "/workdir/root/repo/target", "config_mods" : [ diff --git a/target/nextflow/feature_annotation/xenium_spatial_statistics/.config.vsh.yaml b/target/nextflow/feature_annotation/xenium_spatial_statistics/.config.vsh.yaml index 4120aab..ca3ef2e 100644 --- a/target/nextflow/feature_annotation/xenium_spatial_statistics/.config.vsh.yaml +++ b/target/nextflow/feature_annotation/xenium_spatial_statistics/.config.vsh.yaml @@ -126,7 +126,7 @@ repositories: - type: "vsh" name: "openpipeline" repo: "openpipeline" - tag: "v4.0.3" + tag: "v4.1.0" links: repository: "https://github.com/openpipelines-bio/openpipeline_spatial" docker_registry: "ghcr.io" @@ -216,11 +216,12 @@ engines: - type: "python" user: false packages: - - "anndata~=0.12.7" + - "anndata~=0.12.16" - "awkward" - - "mudata~=0.3.2" - - "scanpy~=1.10.4" - - "scanpy~=1.10.4" + - "scipy~=1.17.1" + - "mudata~=0.3.8" + - "scanpy~=1.11.4" + - "scanpy~=1.11.4" - "squidpy~=1.8.1" - "scikit-learn" script: @@ -247,8 +248,8 @@ build_info: engine: "docker|native|native" output: "target/nextflow/feature_annotation/xenium_spatial_statistics" executable: "target/nextflow/feature_annotation/xenium_spatial_statistics/main.nf" - viash_version: "0.9.4" - git_commit: "e087099616271bd0f11e825b7817ec14ebef62d7" + viash_version: "0.9.7" + git_commit: "4449aa6094a686af0a5fbe99b9aaafd01ae75aff" git_remote: "https://github.com/openpipelines-bio/openpipeline_spatial" package_config: name: "openpipeline_spatial" @@ -262,8 +263,8 @@ package_config: - type: "vsh" name: "openpipeline" repo: "openpipeline" - tag: "v4.0.3" - viash_version: "0.9.4" + tag: "v4.1.0" + viash_version: "0.9.7" source: "src" target: "target" config_mods: diff --git a/target/nextflow/feature_annotation/xenium_spatial_statistics/main.nf b/target/nextflow/feature_annotation/xenium_spatial_statistics/main.nf index 252bcf2..7737879 100644 --- a/target/nextflow/feature_annotation/xenium_spatial_statistics/main.nf +++ b/target/nextflow/feature_annotation/xenium_spatial_statistics/main.nf @@ -1,6 +1,6 @@ // xenium_spatial_statistics main // -// This wrapper script is auto-generated by viash 0.9.4 and is thus a derivative +// This wrapper script is auto-generated by viash 0.9.7 and is thus a derivative // work thereof. This software comes with ABSOLUTELY NO WARRANTY from Data // Intuitive. // @@ -1350,47 +1350,42 @@ def readCsv(file_path) { def splitRegex = java.util.regex.Pattern.compile(''',(?=(?:[^"]*"[^"]*")*[^"]*$)''') def removeQuote = java.util.regex.Pattern.compile('''"(.*)"''') - def br = java.nio.file.Files.newBufferedReader(inputFile) + java.nio.file.Files.newBufferedReader(inputFile).withCloseable { br -> + def row = 0 + def header = null + def line - def row = -1 - def header = null - while (br.ready() && header == null) { - def line = br.readLine() - row++ - if (!line.startsWith("#")) { - header = splitRegex.split(line, -1).collect{field -> - m = removeQuote.matcher(field) - m.find() ? m.replaceFirst('$1') : field - } - } - } - assert header != null: "CSV file should contain a header" - - while (br.ready()) { - def line = br.readLine() - row++ - if (line == null) { - br.close() - break - } - - if (!line.startsWith("#")) { - def predata = splitRegex.split(line, -1) - def data = predata.collect{field -> - if (field == "") { - return null - } - def m = removeQuote.matcher(field) - if (m.find()) { - return m.replaceFirst('$1') - } else { - return field + while (header == null && (line = br.readLine()) != null) { + if (!line.startsWith("#")) { + header = splitRegex.split(line, -1).collect { field -> + def m = removeQuote.matcher(field) + m.find() ? m.replaceFirst('$1') : field } } - assert header.size() == data.size(): "Row $row should contain the same number as fields as the header" - - def dataMap = [header, data].transpose().collectEntries().findAll{it.value != null} - output.add(dataMap) + row++ + } + assert header != null : "CSV file should contain a header" + + while ((line = br.readLine()) != null) { + row++ + if (!line.startsWith("#")) { + def predata = splitRegex.split(line, -1) + def data = predata.collect { field -> + if (field == "") { + return null + } + def m = removeQuote.matcher(field) + if (m.find()) { + return m.replaceFirst('$1') + } else { + return field + } + } + assert header.size() == data.size() : "Row $row should contain the same number as fields as the header" + + def dataMap = [header, data].transpose().collectEntries().findAll { it.value != null } + output.add(dataMap) + } } } @@ -1706,10 +1701,25 @@ process publishFilesProc { ] .transpose() .collectMany{infile, outfile -> - if (infile.toString() != outfile.toString()) { + def infileString = infile.toString() + def outfileString = outfile.toString() + if (infileString != outfileString) { + /* Trailing slashes are removed from both the source and destination arguments. + From source arguments, this is useful when a source argument may have a trailing slash + and specify a symbolic link to a directory. Without removing the slash, cp will dereference + the symbolic link. + See https://www.gnu.org/software/coreutils/manual/html_node/Trailing-slashes.html#Trailing-slashes-1 + + For the destination path addding a trailing slash is a problem when publishing directories: + it requires the destination directory to exist. This fails because we only create the parent + directories first. + */ + def regexTrailingSlashes = ~/\/+$/ + def infileNoTrailingSlash = infileString - regexTrailingSlashes + def outfileNoTrailingSlash = outfileString - regexTrailingSlashes [ - "[ -d \"\$(dirname '${outfile.toString()}')\" ] || mkdir -p \"\$(dirname '${outfile.toString()}')\"", - "cp -r '${infile.toString()}' '${outfile.toString()}'" + "[ -d \"\$(dirname '${outfileNoTrailingSlash}')\" ] || mkdir -p \"\$(dirname '${outfileNoTrailingSlash}')\"", + "cp -a '${infileNoTrailingSlash}' '${outfileNoTrailingSlash}'" ] } else { // no need to copy if infile is the same as outfile @@ -3185,7 +3195,7 @@ meta = [ "type" : "vsh", "name" : "openpipeline", "repo" : "openpipeline", - "tag" : "v4.0.3" + "tag" : "v4.1.0" } ], "links" : { @@ -3294,11 +3304,12 @@ meta = [ "type" : "python", "user" : false, "packages" : [ - "anndata~=0.12.7", + "anndata~=0.12.16", "awkward", - "mudata~=0.3.2", - "scanpy~=1.10.4", - "scanpy~=1.10.4", + "scipy~=1.17.1", + "mudata~=0.3.8", + "scanpy~=1.11.4", + "scanpy~=1.11.4", "squidpy~=1.8.1", "scikit-learn" ], @@ -3334,8 +3345,8 @@ meta = [ "runner" : "nextflow", "engine" : "docker|native|native", "output" : "/workdir/root/repo/target/nextflow/feature_annotation/xenium_spatial_statistics", - "viash_version" : "0.9.4", - "git_commit" : "e087099616271bd0f11e825b7817ec14ebef62d7", + "viash_version" : "0.9.7", + "git_commit" : "4449aa6094a686af0a5fbe99b9aaafd01ae75aff", "git_remote" : "https://github.com/openpipelines-bio/openpipeline_spatial" }, "package_config" : { @@ -3355,10 +3366,10 @@ meta = [ "type" : "vsh", "name" : "openpipeline", "repo" : "openpipeline", - "tag" : "v4.0.3" + "tag" : "v4.1.0" } ], - "viash_version" : "0.9.4", + "viash_version" : "0.9.7", "source" : "/workdir/root/repo/src", "target" : "/workdir/root/repo/target", "config_mods" : [ diff --git a/target/nextflow/mapping/spaceranger_count/.config.vsh.yaml b/target/nextflow/mapping/spaceranger_count/.config.vsh.yaml index c7179b5..e5db746 100644 --- a/target/nextflow/mapping/spaceranger_count/.config.vsh.yaml +++ b/target/nextflow/mapping/spaceranger_count/.config.vsh.yaml @@ -330,7 +330,7 @@ repositories: - type: "vsh" name: "openpipeline" repo: "openpipeline" - tag: "v4.0.3" + tag: "v4.1.0" keywords: - "spaceranger" links: @@ -424,7 +424,7 @@ engines: - type: "python" user: false packages: - - "viashpy==0.9.0" + - "viashpy==0.10.0" github: - "openpipelines-bio/core#subdirectory=packages/python/openpipeline_testutils" upgrade: true @@ -438,8 +438,8 @@ build_info: engine: "docker|native" output: "target/nextflow/mapping/spaceranger_count" executable: "target/nextflow/mapping/spaceranger_count/main.nf" - viash_version: "0.9.4" - git_commit: "e087099616271bd0f11e825b7817ec14ebef62d7" + viash_version: "0.9.7" + git_commit: "4449aa6094a686af0a5fbe99b9aaafd01ae75aff" git_remote: "https://github.com/openpipelines-bio/openpipeline_spatial" package_config: name: "openpipeline_spatial" @@ -453,8 +453,8 @@ package_config: - type: "vsh" name: "openpipeline" repo: "openpipeline" - tag: "v4.0.3" - viash_version: "0.9.4" + tag: "v4.1.0" + viash_version: "0.9.7" source: "src" target: "target" config_mods: diff --git a/target/nextflow/mapping/spaceranger_count/main.nf b/target/nextflow/mapping/spaceranger_count/main.nf index 99b5d62..75cd843 100644 --- a/target/nextflow/mapping/spaceranger_count/main.nf +++ b/target/nextflow/mapping/spaceranger_count/main.nf @@ -1,6 +1,6 @@ // spaceranger_count main // -// This wrapper script is auto-generated by viash 0.9.4 and is thus a derivative +// This wrapper script is auto-generated by viash 0.9.7 and is thus a derivative // work thereof. This software comes with ABSOLUTELY NO WARRANTY from Data // Intuitive. // @@ -1353,47 +1353,42 @@ def readCsv(file_path) { def splitRegex = java.util.regex.Pattern.compile(''',(?=(?:[^"]*"[^"]*")*[^"]*$)''') def removeQuote = java.util.regex.Pattern.compile('''"(.*)"''') - def br = java.nio.file.Files.newBufferedReader(inputFile) + java.nio.file.Files.newBufferedReader(inputFile).withCloseable { br -> + def row = 0 + def header = null + def line - def row = -1 - def header = null - while (br.ready() && header == null) { - def line = br.readLine() - row++ - if (!line.startsWith("#")) { - header = splitRegex.split(line, -1).collect{field -> - m = removeQuote.matcher(field) - m.find() ? m.replaceFirst('$1') : field - } - } - } - assert header != null: "CSV file should contain a header" - - while (br.ready()) { - def line = br.readLine() - row++ - if (line == null) { - br.close() - break - } - - if (!line.startsWith("#")) { - def predata = splitRegex.split(line, -1) - def data = predata.collect{field -> - if (field == "") { - return null - } - def m = removeQuote.matcher(field) - if (m.find()) { - return m.replaceFirst('$1') - } else { - return field + while (header == null && (line = br.readLine()) != null) { + if (!line.startsWith("#")) { + header = splitRegex.split(line, -1).collect { field -> + def m = removeQuote.matcher(field) + m.find() ? m.replaceFirst('$1') : field } } - assert header.size() == data.size(): "Row $row should contain the same number as fields as the header" - - def dataMap = [header, data].transpose().collectEntries().findAll{it.value != null} - output.add(dataMap) + row++ + } + assert header != null : "CSV file should contain a header" + + while ((line = br.readLine()) != null) { + row++ + if (!line.startsWith("#")) { + def predata = splitRegex.split(line, -1) + def data = predata.collect { field -> + if (field == "") { + return null + } + def m = removeQuote.matcher(field) + if (m.find()) { + return m.replaceFirst('$1') + } else { + return field + } + } + assert header.size() == data.size() : "Row $row should contain the same number as fields as the header" + + def dataMap = [header, data].transpose().collectEntries().findAll { it.value != null } + output.add(dataMap) + } } } @@ -1709,10 +1704,25 @@ process publishFilesProc { ] .transpose() .collectMany{infile, outfile -> - if (infile.toString() != outfile.toString()) { + def infileString = infile.toString() + def outfileString = outfile.toString() + if (infileString != outfileString) { + /* Trailing slashes are removed from both the source and destination arguments. + From source arguments, this is useful when a source argument may have a trailing slash + and specify a symbolic link to a directory. Without removing the slash, cp will dereference + the symbolic link. + See https://www.gnu.org/software/coreutils/manual/html_node/Trailing-slashes.html#Trailing-slashes-1 + + For the destination path addding a trailing slash is a problem when publishing directories: + it requires the destination directory to exist. This fails because we only create the parent + directories first. + */ + def regexTrailingSlashes = ~/\/+$/ + def infileNoTrailingSlash = infileString - regexTrailingSlashes + def outfileNoTrailingSlash = outfileString - regexTrailingSlashes [ - "[ -d \"\$(dirname '${outfile.toString()}')\" ] || mkdir -p \"\$(dirname '${outfile.toString()}')\"", - "cp -r '${infile.toString()}' '${outfile.toString()}'" + "[ -d \"\$(dirname '${outfileNoTrailingSlash}')\" ] || mkdir -p \"\$(dirname '${outfileNoTrailingSlash}')\"", + "cp -a '${infileNoTrailingSlash}' '${outfileNoTrailingSlash}'" ] } else { // no need to copy if infile is the same as outfile @@ -3433,7 +3443,7 @@ meta = [ "type" : "vsh", "name" : "openpipeline", "repo" : "openpipeline", - "tag" : "v4.0.3" + "tag" : "v4.1.0" } ], "keywords" : [ @@ -3549,7 +3559,7 @@ meta = [ "type" : "python", "user" : false, "packages" : [ - "viashpy==0.9.0" + "viashpy==0.10.0" ], "github" : [ "openpipelines-bio/core#subdirectory=packages/python/openpipeline_testutils" @@ -3568,8 +3578,8 @@ meta = [ "runner" : "nextflow", "engine" : "docker|native", "output" : "/workdir/root/repo/target/nextflow/mapping/spaceranger_count", - "viash_version" : "0.9.4", - "git_commit" : "e087099616271bd0f11e825b7817ec14ebef62d7", + "viash_version" : "0.9.7", + "git_commit" : "4449aa6094a686af0a5fbe99b9aaafd01ae75aff", "git_remote" : "https://github.com/openpipelines-bio/openpipeline_spatial" }, "package_config" : { @@ -3589,10 +3599,10 @@ meta = [ "type" : "vsh", "name" : "openpipeline", "repo" : "openpipeline", - "tag" : "v4.0.3" + "tag" : "v4.1.0" } ], - "viash_version" : "0.9.4", + "viash_version" : "0.9.7", "source" : "/workdir/root/repo/src", "target" : "/workdir/root/repo/target", "config_mods" : [ diff --git a/target/nextflow/neighbors/join_graphs/.config.vsh.yaml b/target/nextflow/neighbors/join_graphs/.config.vsh.yaml index f63dc8b..a1dd507 100644 --- a/target/nextflow/neighbors/join_graphs/.config.vsh.yaml +++ b/target/nextflow/neighbors/join_graphs/.config.vsh.yaml @@ -142,7 +142,7 @@ repositories: - type: "vsh" name: "openpipeline" repo: "openpipeline" - tag: "v4.0.3" + tag: "v4.1.0" links: repository: "https://github.com/openpipelines-bio/openpipeline_spatial" docker_registry: "ghcr.io" @@ -232,10 +232,11 @@ engines: - type: "python" user: false packages: - - "scanpy~=1.10.4" - - "anndata~=0.12.7" + - "scanpy~=1.11.4" + - "anndata~=0.12.16" - "awkward" - - "mudata~=0.3.2" + - "scipy~=1.17.1" + - "mudata~=0.3.8" script: - "exec(\"try:\\n import zarr; from importlib.metadata import version\\nexcept\ \ ModuleNotFoundError:\\n exit(0)\\nelse: assert int(version(\\\"zarr\\\"\ @@ -249,7 +250,7 @@ engines: - type: "python" user: false packages: - - "viashpy==0.9.0" + - "viashpy==0.10.0" github: - "openpipelines-bio/core#subdirectory=packages/python/openpipeline_testutils" upgrade: true @@ -263,8 +264,8 @@ build_info: engine: "docker|native" output: "target/nextflow/neighbors/join_graphs" executable: "target/nextflow/neighbors/join_graphs/main.nf" - viash_version: "0.9.4" - git_commit: "e087099616271bd0f11e825b7817ec14ebef62d7" + viash_version: "0.9.7" + git_commit: "4449aa6094a686af0a5fbe99b9aaafd01ae75aff" git_remote: "https://github.com/openpipelines-bio/openpipeline_spatial" package_config: name: "openpipeline_spatial" @@ -278,8 +279,8 @@ package_config: - type: "vsh" name: "openpipeline" repo: "openpipeline" - tag: "v4.0.3" - viash_version: "0.9.4" + tag: "v4.1.0" + viash_version: "0.9.7" source: "src" target: "target" config_mods: diff --git a/target/nextflow/neighbors/join_graphs/main.nf b/target/nextflow/neighbors/join_graphs/main.nf index fca7169..9bffd02 100644 --- a/target/nextflow/neighbors/join_graphs/main.nf +++ b/target/nextflow/neighbors/join_graphs/main.nf @@ -1,6 +1,6 @@ // join_graphs main // -// This wrapper script is auto-generated by viash 0.9.4 and is thus a derivative +// This wrapper script is auto-generated by viash 0.9.7 and is thus a derivative // work thereof. This software comes with ABSOLUTELY NO WARRANTY from Data // Intuitive. // @@ -1353,47 +1353,42 @@ def readCsv(file_path) { def splitRegex = java.util.regex.Pattern.compile(''',(?=(?:[^"]*"[^"]*")*[^"]*$)''') def removeQuote = java.util.regex.Pattern.compile('''"(.*)"''') - def br = java.nio.file.Files.newBufferedReader(inputFile) + java.nio.file.Files.newBufferedReader(inputFile).withCloseable { br -> + def row = 0 + def header = null + def line - def row = -1 - def header = null - while (br.ready() && header == null) { - def line = br.readLine() - row++ - if (!line.startsWith("#")) { - header = splitRegex.split(line, -1).collect{field -> - m = removeQuote.matcher(field) - m.find() ? m.replaceFirst('$1') : field - } - } - } - assert header != null: "CSV file should contain a header" - - while (br.ready()) { - def line = br.readLine() - row++ - if (line == null) { - br.close() - break - } - - if (!line.startsWith("#")) { - def predata = splitRegex.split(line, -1) - def data = predata.collect{field -> - if (field == "") { - return null - } - def m = removeQuote.matcher(field) - if (m.find()) { - return m.replaceFirst('$1') - } else { - return field + while (header == null && (line = br.readLine()) != null) { + if (!line.startsWith("#")) { + header = splitRegex.split(line, -1).collect { field -> + def m = removeQuote.matcher(field) + m.find() ? m.replaceFirst('$1') : field } } - assert header.size() == data.size(): "Row $row should contain the same number as fields as the header" - - def dataMap = [header, data].transpose().collectEntries().findAll{it.value != null} - output.add(dataMap) + row++ + } + assert header != null : "CSV file should contain a header" + + while ((line = br.readLine()) != null) { + row++ + if (!line.startsWith("#")) { + def predata = splitRegex.split(line, -1) + def data = predata.collect { field -> + if (field == "") { + return null + } + def m = removeQuote.matcher(field) + if (m.find()) { + return m.replaceFirst('$1') + } else { + return field + } + } + assert header.size() == data.size() : "Row $row should contain the same number as fields as the header" + + def dataMap = [header, data].transpose().collectEntries().findAll { it.value != null } + output.add(dataMap) + } } } @@ -1709,10 +1704,25 @@ process publishFilesProc { ] .transpose() .collectMany{infile, outfile -> - if (infile.toString() != outfile.toString()) { + def infileString = infile.toString() + def outfileString = outfile.toString() + if (infileString != outfileString) { + /* Trailing slashes are removed from both the source and destination arguments. + From source arguments, this is useful when a source argument may have a trailing slash + and specify a symbolic link to a directory. Without removing the slash, cp will dereference + the symbolic link. + See https://www.gnu.org/software/coreutils/manual/html_node/Trailing-slashes.html#Trailing-slashes-1 + + For the destination path addding a trailing slash is a problem when publishing directories: + it requires the destination directory to exist. This fails because we only create the parent + directories first. + */ + def regexTrailingSlashes = ~/\/+$/ + def infileNoTrailingSlash = infileString - regexTrailingSlashes + def outfileNoTrailingSlash = outfileString - regexTrailingSlashes [ - "[ -d \"\$(dirname '${outfile.toString()}')\" ] || mkdir -p \"\$(dirname '${outfile.toString()}')\"", - "cp -r '${infile.toString()}' '${outfile.toString()}'" + "[ -d \"\$(dirname '${outfileNoTrailingSlash}')\" ] || mkdir -p \"\$(dirname '${outfileNoTrailingSlash}')\"", + "cp -a '${infileNoTrailingSlash}' '${outfileNoTrailingSlash}'" ] } else { // no need to copy if infile is the same as outfile @@ -3217,7 +3227,7 @@ meta = [ "type" : "vsh", "name" : "openpipeline", "repo" : "openpipeline", - "tag" : "v4.0.3" + "tag" : "v4.1.0" } ], "links" : { @@ -3326,10 +3336,11 @@ meta = [ "type" : "python", "user" : false, "packages" : [ - "scanpy~=1.10.4", - "anndata~=0.12.7", + "scanpy~=1.11.4", + "anndata~=0.12.16", "awkward", - "mudata~=0.3.2" + "scipy~=1.17.1", + "mudata~=0.3.8" ], "script" : [ "exec(\\"try:\\\\n import zarr; from importlib.metadata import version\\\\nexcept ModuleNotFoundError:\\\\n exit(0)\\\\nelse: assert int(version(\\\\\\"zarr\\\\\\").partition(\\\\\\".\\\\\\")[0]) > 2\\")" @@ -3349,7 +3360,7 @@ meta = [ "type" : "python", "user" : false, "packages" : [ - "viashpy==0.9.0" + "viashpy==0.10.0" ], "github" : [ "openpipelines-bio/core#subdirectory=packages/python/openpipeline_testutils" @@ -3368,8 +3379,8 @@ meta = [ "runner" : "nextflow", "engine" : "docker|native", "output" : "/workdir/root/repo/target/nextflow/neighbors/join_graphs", - "viash_version" : "0.9.4", - "git_commit" : "e087099616271bd0f11e825b7817ec14ebef62d7", + "viash_version" : "0.9.7", + "git_commit" : "4449aa6094a686af0a5fbe99b9aaafd01ae75aff", "git_remote" : "https://github.com/openpipelines-bio/openpipeline_spatial" }, "package_config" : { @@ -3389,10 +3400,10 @@ meta = [ "type" : "vsh", "name" : "openpipeline", "repo" : "openpipeline", - "tag" : "v4.0.3" + "tag" : "v4.1.0" } ], - "viash_version" : "0.9.4", + "viash_version" : "0.9.7", "source" : "/workdir/root/repo/src", "target" : "/workdir/root/repo/target", "config_mods" : [ diff --git a/target/nextflow/neighbors/spatial_neighborhood_graph/.config.vsh.yaml b/target/nextflow/neighbors/spatial_neighborhood_graph/.config.vsh.yaml index 6a67ab8..adf5d19 100644 --- a/target/nextflow/neighbors/spatial_neighborhood_graph/.config.vsh.yaml +++ b/target/nextflow/neighbors/spatial_neighborhood_graph/.config.vsh.yaml @@ -147,7 +147,7 @@ repositories: - type: "vsh" name: "openpipeline" repo: "openpipeline" - tag: "v4.0.3" + tag: "v4.1.0" links: repository: "https://github.com/openpipelines-bio/openpipeline_spatial" docker_registry: "ghcr.io" @@ -237,11 +237,12 @@ engines: - type: "python" user: false packages: - - "scanpy~=1.10.4" + - "scanpy~=1.11.4" - "squidpy~=1.8.1" - - "anndata~=0.12.7" + - "anndata~=0.12.16" - "awkward" - - "mudata~=0.3.2" + - "scipy~=1.17.1" + - "mudata~=0.3.8" script: - "exec(\"try:\\n import zarr; from importlib.metadata import version\\nexcept\ \ ModuleNotFoundError:\\n exit(0)\\nelse: assert int(version(\\\"zarr\\\"\ @@ -255,7 +256,7 @@ engines: - type: "python" user: false packages: - - "viashpy==0.9.0" + - "viashpy==0.10.0" github: - "openpipelines-bio/core#subdirectory=packages/python/openpipeline_testutils" upgrade: true @@ -269,8 +270,8 @@ build_info: engine: "docker|native" output: "target/nextflow/neighbors/spatial_neighborhood_graph" executable: "target/nextflow/neighbors/spatial_neighborhood_graph/main.nf" - viash_version: "0.9.4" - git_commit: "e087099616271bd0f11e825b7817ec14ebef62d7" + viash_version: "0.9.7" + git_commit: "4449aa6094a686af0a5fbe99b9aaafd01ae75aff" git_remote: "https://github.com/openpipelines-bio/openpipeline_spatial" package_config: name: "openpipeline_spatial" @@ -284,8 +285,8 @@ package_config: - type: "vsh" name: "openpipeline" repo: "openpipeline" - tag: "v4.0.3" - viash_version: "0.9.4" + tag: "v4.1.0" + viash_version: "0.9.7" source: "src" target: "target" config_mods: diff --git a/target/nextflow/neighbors/spatial_neighborhood_graph/main.nf b/target/nextflow/neighbors/spatial_neighborhood_graph/main.nf index d20a4cd..7c40eef 100644 --- a/target/nextflow/neighbors/spatial_neighborhood_graph/main.nf +++ b/target/nextflow/neighbors/spatial_neighborhood_graph/main.nf @@ -1,6 +1,6 @@ // spatial_neighborhood_graph main // -// This wrapper script is auto-generated by viash 0.9.4 and is thus a derivative +// This wrapper script is auto-generated by viash 0.9.7 and is thus a derivative // work thereof. This software comes with ABSOLUTELY NO WARRANTY from Data // Intuitive. // @@ -1353,47 +1353,42 @@ def readCsv(file_path) { def splitRegex = java.util.regex.Pattern.compile(''',(?=(?:[^"]*"[^"]*")*[^"]*$)''') def removeQuote = java.util.regex.Pattern.compile('''"(.*)"''') - def br = java.nio.file.Files.newBufferedReader(inputFile) + java.nio.file.Files.newBufferedReader(inputFile).withCloseable { br -> + def row = 0 + def header = null + def line - def row = -1 - def header = null - while (br.ready() && header == null) { - def line = br.readLine() - row++ - if (!line.startsWith("#")) { - header = splitRegex.split(line, -1).collect{field -> - m = removeQuote.matcher(field) - m.find() ? m.replaceFirst('$1') : field - } - } - } - assert header != null: "CSV file should contain a header" - - while (br.ready()) { - def line = br.readLine() - row++ - if (line == null) { - br.close() - break - } - - if (!line.startsWith("#")) { - def predata = splitRegex.split(line, -1) - def data = predata.collect{field -> - if (field == "") { - return null - } - def m = removeQuote.matcher(field) - if (m.find()) { - return m.replaceFirst('$1') - } else { - return field + while (header == null && (line = br.readLine()) != null) { + if (!line.startsWith("#")) { + header = splitRegex.split(line, -1).collect { field -> + def m = removeQuote.matcher(field) + m.find() ? m.replaceFirst('$1') : field } } - assert header.size() == data.size(): "Row $row should contain the same number as fields as the header" - - def dataMap = [header, data].transpose().collectEntries().findAll{it.value != null} - output.add(dataMap) + row++ + } + assert header != null : "CSV file should contain a header" + + while ((line = br.readLine()) != null) { + row++ + if (!line.startsWith("#")) { + def predata = splitRegex.split(line, -1) + def data = predata.collect { field -> + if (field == "") { + return null + } + def m = removeQuote.matcher(field) + if (m.find()) { + return m.replaceFirst('$1') + } else { + return field + } + } + assert header.size() == data.size() : "Row $row should contain the same number as fields as the header" + + def dataMap = [header, data].transpose().collectEntries().findAll { it.value != null } + output.add(dataMap) + } } } @@ -1709,10 +1704,25 @@ process publishFilesProc { ] .transpose() .collectMany{infile, outfile -> - if (infile.toString() != outfile.toString()) { + def infileString = infile.toString() + def outfileString = outfile.toString() + if (infileString != outfileString) { + /* Trailing slashes are removed from both the source and destination arguments. + From source arguments, this is useful when a source argument may have a trailing slash + and specify a symbolic link to a directory. Without removing the slash, cp will dereference + the symbolic link. + See https://www.gnu.org/software/coreutils/manual/html_node/Trailing-slashes.html#Trailing-slashes-1 + + For the destination path addding a trailing slash is a problem when publishing directories: + it requires the destination directory to exist. This fails because we only create the parent + directories first. + */ + def regexTrailingSlashes = ~/\/+$/ + def infileNoTrailingSlash = infileString - regexTrailingSlashes + def outfileNoTrailingSlash = outfileString - regexTrailingSlashes [ - "[ -d \"\$(dirname '${outfile.toString()}')\" ] || mkdir -p \"\$(dirname '${outfile.toString()}')\"", - "cp -r '${infile.toString()}' '${outfile.toString()}'" + "[ -d \"\$(dirname '${outfileNoTrailingSlash}')\" ] || mkdir -p \"\$(dirname '${outfileNoTrailingSlash}')\"", + "cp -a '${infileNoTrailingSlash}' '${outfileNoTrailingSlash}'" ] } else { // no need to copy if infile is the same as outfile @@ -3220,7 +3230,7 @@ meta = [ "type" : "vsh", "name" : "openpipeline", "repo" : "openpipeline", - "tag" : "v4.0.3" + "tag" : "v4.1.0" } ], "links" : { @@ -3329,11 +3339,12 @@ meta = [ "type" : "python", "user" : false, "packages" : [ - "scanpy~=1.10.4", + "scanpy~=1.11.4", "squidpy~=1.8.1", - "anndata~=0.12.7", + "anndata~=0.12.16", "awkward", - "mudata~=0.3.2" + "scipy~=1.17.1", + "mudata~=0.3.8" ], "script" : [ "exec(\\"try:\\\\n import zarr; from importlib.metadata import version\\\\nexcept ModuleNotFoundError:\\\\n exit(0)\\\\nelse: assert int(version(\\\\\\"zarr\\\\\\").partition(\\\\\\".\\\\\\")[0]) > 2\\")" @@ -3353,7 +3364,7 @@ meta = [ "type" : "python", "user" : false, "packages" : [ - "viashpy==0.9.0" + "viashpy==0.10.0" ], "github" : [ "openpipelines-bio/core#subdirectory=packages/python/openpipeline_testutils" @@ -3372,8 +3383,8 @@ meta = [ "runner" : "nextflow", "engine" : "docker|native", "output" : "/workdir/root/repo/target/nextflow/neighbors/spatial_neighborhood_graph", - "viash_version" : "0.9.4", - "git_commit" : "e087099616271bd0f11e825b7817ec14ebef62d7", + "viash_version" : "0.9.7", + "git_commit" : "4449aa6094a686af0a5fbe99b9aaafd01ae75aff", "git_remote" : "https://github.com/openpipelines-bio/openpipeline_spatial" }, "package_config" : { @@ -3393,10 +3404,10 @@ meta = [ "type" : "vsh", "name" : "openpipeline", "repo" : "openpipeline", - "tag" : "v4.0.3" + "tag" : "v4.1.0" } ], - "viash_version" : "0.9.4", + "viash_version" : "0.9.7", "source" : "/workdir/root/repo/src", "target" : "/workdir/root/repo/target", "config_mods" : [ diff --git a/target/nextflow/nichecompass/gene_program_mask/.config.vsh.yaml b/target/nextflow/nichecompass/gene_program_mask/.config.vsh.yaml index 74a2b39..e75e9be 100644 --- a/target/nextflow/nichecompass/gene_program_mask/.config.vsh.yaml +++ b/target/nextflow/nichecompass/gene_program_mask/.config.vsh.yaml @@ -397,7 +397,7 @@ repositories: - type: "vsh" name: "openpipeline" repo: "openpipeline" - tag: "v4.0.3" + tag: "v4.1.0" links: repository: "https://github.com/openpipelines-bio/openpipeline_spatial" docker_registry: "ghcr.io" @@ -516,7 +516,7 @@ engines: - type: "python" user: false packages: - - "viashpy==0.9.0" + - "viashpy==0.10.0" github: - "openpipelines-bio/core#subdirectory=packages/python/openpipeline_testutils" upgrade: true @@ -530,8 +530,8 @@ build_info: engine: "docker|native" output: "target/nextflow/nichecompass/gene_program_mask" executable: "target/nextflow/nichecompass/gene_program_mask/main.nf" - viash_version: "0.9.4" - git_commit: "e087099616271bd0f11e825b7817ec14ebef62d7" + viash_version: "0.9.7" + git_commit: "4449aa6094a686af0a5fbe99b9aaafd01ae75aff" git_remote: "https://github.com/openpipelines-bio/openpipeline_spatial" package_config: name: "openpipeline_spatial" @@ -545,8 +545,8 @@ package_config: - type: "vsh" name: "openpipeline" repo: "openpipeline" - tag: "v4.0.3" - viash_version: "0.9.4" + tag: "v4.1.0" + viash_version: "0.9.7" source: "src" target: "target" config_mods: diff --git a/target/nextflow/nichecompass/gene_program_mask/main.nf b/target/nextflow/nichecompass/gene_program_mask/main.nf index 1de827a..280e31b 100644 --- a/target/nextflow/nichecompass/gene_program_mask/main.nf +++ b/target/nextflow/nichecompass/gene_program_mask/main.nf @@ -1,6 +1,6 @@ // gene_program_mask main // -// This wrapper script is auto-generated by viash 0.9.4 and is thus a derivative +// This wrapper script is auto-generated by viash 0.9.7 and is thus a derivative // work thereof. This software comes with ABSOLUTELY NO WARRANTY from Data // Intuitive. // @@ -1355,47 +1355,42 @@ def readCsv(file_path) { def splitRegex = java.util.regex.Pattern.compile(''',(?=(?:[^"]*"[^"]*")*[^"]*$)''') def removeQuote = java.util.regex.Pattern.compile('''"(.*)"''') - def br = java.nio.file.Files.newBufferedReader(inputFile) + java.nio.file.Files.newBufferedReader(inputFile).withCloseable { br -> + def row = 0 + def header = null + def line - def row = -1 - def header = null - while (br.ready() && header == null) { - def line = br.readLine() - row++ - if (!line.startsWith("#")) { - header = splitRegex.split(line, -1).collect{field -> - m = removeQuote.matcher(field) - m.find() ? m.replaceFirst('$1') : field - } - } - } - assert header != null: "CSV file should contain a header" - - while (br.ready()) { - def line = br.readLine() - row++ - if (line == null) { - br.close() - break - } - - if (!line.startsWith("#")) { - def predata = splitRegex.split(line, -1) - def data = predata.collect{field -> - if (field == "") { - return null - } - def m = removeQuote.matcher(field) - if (m.find()) { - return m.replaceFirst('$1') - } else { - return field + while (header == null && (line = br.readLine()) != null) { + if (!line.startsWith("#")) { + header = splitRegex.split(line, -1).collect { field -> + def m = removeQuote.matcher(field) + m.find() ? m.replaceFirst('$1') : field } } - assert header.size() == data.size(): "Row $row should contain the same number as fields as the header" - - def dataMap = [header, data].transpose().collectEntries().findAll{it.value != null} - output.add(dataMap) + row++ + } + assert header != null : "CSV file should contain a header" + + while ((line = br.readLine()) != null) { + row++ + if (!line.startsWith("#")) { + def predata = splitRegex.split(line, -1) + def data = predata.collect { field -> + if (field == "") { + return null + } + def m = removeQuote.matcher(field) + if (m.find()) { + return m.replaceFirst('$1') + } else { + return field + } + } + assert header.size() == data.size() : "Row $row should contain the same number as fields as the header" + + def dataMap = [header, data].transpose().collectEntries().findAll { it.value != null } + output.add(dataMap) + } } } @@ -1711,10 +1706,25 @@ process publishFilesProc { ] .transpose() .collectMany{infile, outfile -> - if (infile.toString() != outfile.toString()) { + def infileString = infile.toString() + def outfileString = outfile.toString() + if (infileString != outfileString) { + /* Trailing slashes are removed from both the source and destination arguments. + From source arguments, this is useful when a source argument may have a trailing slash + and specify a symbolic link to a directory. Without removing the slash, cp will dereference + the symbolic link. + See https://www.gnu.org/software/coreutils/manual/html_node/Trailing-slashes.html#Trailing-slashes-1 + + For the destination path addding a trailing slash is a problem when publishing directories: + it requires the destination directory to exist. This fails because we only create the parent + directories first. + */ + def regexTrailingSlashes = ~/\/+$/ + def infileNoTrailingSlash = infileString - regexTrailingSlashes + def outfileNoTrailingSlash = outfileString - regexTrailingSlashes [ - "[ -d \"\$(dirname '${outfile.toString()}')\" ] || mkdir -p \"\$(dirname '${outfile.toString()}')\"", - "cp -r '${infile.toString()}' '${outfile.toString()}'" + "[ -d \"\$(dirname '${outfileNoTrailingSlash}')\" ] || mkdir -p \"\$(dirname '${outfileNoTrailingSlash}')\"", + "cp -a '${infileNoTrailingSlash}' '${outfileNoTrailingSlash}'" ] } else { // no need to copy if infile is the same as outfile @@ -3498,7 +3508,7 @@ meta = [ "type" : "vsh", "name" : "openpipeline", "repo" : "openpipeline", - "tag" : "v4.0.3" + "tag" : "v4.1.0" } ], "links" : { @@ -3651,7 +3661,7 @@ meta = [ "type" : "python", "user" : false, "packages" : [ - "viashpy==0.9.0" + "viashpy==0.10.0" ], "github" : [ "openpipelines-bio/core#subdirectory=packages/python/openpipeline_testutils" @@ -3670,8 +3680,8 @@ meta = [ "runner" : "nextflow", "engine" : "docker|native", "output" : "/workdir/root/repo/target/nextflow/nichecompass/gene_program_mask", - "viash_version" : "0.9.4", - "git_commit" : "e087099616271bd0f11e825b7817ec14ebef62d7", + "viash_version" : "0.9.7", + "git_commit" : "4449aa6094a686af0a5fbe99b9aaafd01ae75aff", "git_remote" : "https://github.com/openpipelines-bio/openpipeline_spatial" }, "package_config" : { @@ -3691,10 +3701,10 @@ meta = [ "type" : "vsh", "name" : "openpipeline", "repo" : "openpipeline", - "tag" : "v4.0.3" + "tag" : "v4.1.0" } ], - "viash_version" : "0.9.4", + "viash_version" : "0.9.7", "source" : "/workdir/root/repo/src", "target" : "/workdir/root/repo/target", "config_mods" : [ diff --git a/target/nextflow/workflows/ingestion/spaceranger_mapping/.config.vsh.yaml b/target/nextflow/workflows/ingestion/spaceranger_mapping/.config.vsh.yaml index 1f1d846..b0c6dee 100644 --- a/target/nextflow/workflows/ingestion/spaceranger_mapping/.config.vsh.yaml +++ b/target/nextflow/workflows/ingestion/spaceranger_mapping/.config.vsh.yaml @@ -399,7 +399,7 @@ repositories: - type: "vsh" name: "openpipeline" repo: "openpipeline" - tag: "v4.0.3" + tag: "v4.1.0" links: repository: "https://github.com/openpipelines-bio/openpipeline_spatial" docker_registry: "ghcr.io" @@ -476,8 +476,8 @@ build_info: engine: "native" output: "target/nextflow/workflows/ingestion/spaceranger_mapping" executable: "target/nextflow/workflows/ingestion/spaceranger_mapping/main.nf" - viash_version: "0.9.4" - git_commit: "e087099616271bd0f11e825b7817ec14ebef62d7" + viash_version: "0.9.7" + git_commit: "4449aa6094a686af0a5fbe99b9aaafd01ae75aff" git_remote: "https://github.com/openpipelines-bio/openpipeline_spatial" dependencies: - "target/nextflow/mapping/spaceranger_count" @@ -494,8 +494,8 @@ package_config: - type: "vsh" name: "openpipeline" repo: "openpipeline" - tag: "v4.0.3" - viash_version: "0.9.4" + tag: "v4.1.0" + viash_version: "0.9.7" source: "src" target: "target" config_mods: diff --git a/target/nextflow/workflows/ingestion/spaceranger_mapping/main.nf b/target/nextflow/workflows/ingestion/spaceranger_mapping/main.nf index 96aa8e2..d8d1f95 100644 --- a/target/nextflow/workflows/ingestion/spaceranger_mapping/main.nf +++ b/target/nextflow/workflows/ingestion/spaceranger_mapping/main.nf @@ -1,6 +1,6 @@ // spaceranger_mapping main // -// This wrapper script is auto-generated by viash 0.9.4 and is thus a derivative +// This wrapper script is auto-generated by viash 0.9.7 and is thus a derivative // work thereof. This software comes with ABSOLUTELY NO WARRANTY from Data // Intuitive. // @@ -1354,47 +1354,42 @@ def readCsv(file_path) { def splitRegex = java.util.regex.Pattern.compile(''',(?=(?:[^"]*"[^"]*")*[^"]*$)''') def removeQuote = java.util.regex.Pattern.compile('''"(.*)"''') - def br = java.nio.file.Files.newBufferedReader(inputFile) + java.nio.file.Files.newBufferedReader(inputFile).withCloseable { br -> + def row = 0 + def header = null + def line - def row = -1 - def header = null - while (br.ready() && header == null) { - def line = br.readLine() - row++ - if (!line.startsWith("#")) { - header = splitRegex.split(line, -1).collect{field -> - m = removeQuote.matcher(field) - m.find() ? m.replaceFirst('$1') : field - } - } - } - assert header != null: "CSV file should contain a header" - - while (br.ready()) { - def line = br.readLine() - row++ - if (line == null) { - br.close() - break - } - - if (!line.startsWith("#")) { - def predata = splitRegex.split(line, -1) - def data = predata.collect{field -> - if (field == "") { - return null - } - def m = removeQuote.matcher(field) - if (m.find()) { - return m.replaceFirst('$1') - } else { - return field + while (header == null && (line = br.readLine()) != null) { + if (!line.startsWith("#")) { + header = splitRegex.split(line, -1).collect { field -> + def m = removeQuote.matcher(field) + m.find() ? m.replaceFirst('$1') : field } } - assert header.size() == data.size(): "Row $row should contain the same number as fields as the header" - - def dataMap = [header, data].transpose().collectEntries().findAll{it.value != null} - output.add(dataMap) + row++ + } + assert header != null : "CSV file should contain a header" + + while ((line = br.readLine()) != null) { + row++ + if (!line.startsWith("#")) { + def predata = splitRegex.split(line, -1) + def data = predata.collect { field -> + if (field == "") { + return null + } + def m = removeQuote.matcher(field) + if (m.find()) { + return m.replaceFirst('$1') + } else { + return field + } + } + assert header.size() == data.size() : "Row $row should contain the same number as fields as the header" + + def dataMap = [header, data].transpose().collectEntries().findAll { it.value != null } + output.add(dataMap) + } } } @@ -1710,10 +1705,25 @@ process publishFilesProc { ] .transpose() .collectMany{infile, outfile -> - if (infile.toString() != outfile.toString()) { + def infileString = infile.toString() + def outfileString = outfile.toString() + if (infileString != outfileString) { + /* Trailing slashes are removed from both the source and destination arguments. + From source arguments, this is useful when a source argument may have a trailing slash + and specify a symbolic link to a directory. Without removing the slash, cp will dereference + the symbolic link. + See https://www.gnu.org/software/coreutils/manual/html_node/Trailing-slashes.html#Trailing-slashes-1 + + For the destination path addding a trailing slash is a problem when publishing directories: + it requires the destination directory to exist. This fails because we only create the parent + directories first. + */ + def regexTrailingSlashes = ~/\/+$/ + def infileNoTrailingSlash = infileString - regexTrailingSlashes + def outfileNoTrailingSlash = outfileString - regexTrailingSlashes [ - "[ -d \"\$(dirname '${outfile.toString()}')\" ] || mkdir -p \"\$(dirname '${outfile.toString()}')\"", - "cp -r '${infile.toString()}' '${outfile.toString()}'" + "[ -d \"\$(dirname '${outfileNoTrailingSlash}')\" ] || mkdir -p \"\$(dirname '${outfileNoTrailingSlash}')\"", + "cp -a '${infileNoTrailingSlash}' '${outfileNoTrailingSlash}'" ] } else { // no need to copy if infile is the same as outfile @@ -3532,7 +3542,7 @@ meta = [ "type" : "vsh", "name" : "openpipeline", "repo" : "openpipeline", - "tag" : "v4.0.3" + "tag" : "v4.1.0" } ], "links" : { @@ -3622,8 +3632,8 @@ meta = [ "runner" : "nextflow", "engine" : "native", "output" : "/workdir/root/repo/target/nextflow/workflows/ingestion/spaceranger_mapping", - "viash_version" : "0.9.4", - "git_commit" : "e087099616271bd0f11e825b7817ec14ebef62d7", + "viash_version" : "0.9.7", + "git_commit" : "4449aa6094a686af0a5fbe99b9aaafd01ae75aff", "git_remote" : "https://github.com/openpipelines-bio/openpipeline_spatial" }, "package_config" : { @@ -3643,10 +3653,10 @@ meta = [ "type" : "vsh", "name" : "openpipeline", "repo" : "openpipeline", - "tag" : "v4.0.3" + "tag" : "v4.1.0" } ], - "viash_version" : "0.9.4", + "viash_version" : "0.9.7", "source" : "/workdir/root/repo/src", "target" : "/workdir/root/repo/target", "config_mods" : [ diff --git a/target/nextflow/workflows/multiomics/spatial_process_samples/.config.vsh.yaml b/target/nextflow/workflows/multiomics/spatial_process_samples/.config.vsh.yaml index 4927e7e..7b15ac8 100644 --- a/target/nextflow/workflows/multiomics/spatial_process_samples/.config.vsh.yaml +++ b/target/nextflow/workflows/multiomics/spatial_process_samples/.config.vsh.yaml @@ -295,6 +295,15 @@ argument_groups: direction: "input" multiple: false multiple_sep: ";" +- name: "Cross-modality filtering" + arguments: + - type: "boolean_true" + name: "--intersect_obs" + description: "After per-modality filtering and multisample processing, remove\ + \ observations\nthat are not present in all processed modalities so that each\ + \ modality shares\nthe same set of cells.\n" + info: null + direction: "input" - name: "Highly variable features detection" arguments: - type: "string" @@ -557,12 +566,12 @@ dependencies: repository: type: "vsh" repo: "openpipeline" - tag: "v4.0.3" + tag: "v4.1.0" repositories: - type: "vsh" name: "openpipeline" repo: "openpipeline" - tag: "v4.0.3" + tag: "v4.1.0" links: repository: "https://github.com/openpipelines-bio/openpipeline_spatial" docker_registry: "ghcr.io" @@ -639,11 +648,11 @@ build_info: engine: "native" output: "target/nextflow/workflows/multiomics/spatial_process_samples" executable: "target/nextflow/workflows/multiomics/spatial_process_samples/main.nf" - viash_version: "0.9.4" - git_commit: "e087099616271bd0f11e825b7817ec14ebef62d7" + viash_version: "0.9.7" + git_commit: "4449aa6094a686af0a5fbe99b9aaafd01ae75aff" git_remote: "https://github.com/openpipelines-bio/openpipeline_spatial" dependencies: - - "target/dependencies/vsh/vsh/openpipeline/v4.0.3/nextflow/workflows/multiomics/process_samples" + - "target/dependencies/vsh/vsh/openpipeline/v4.1.0/nextflow/workflows/multiomics/process_samples" package_config: name: "openpipeline_spatial" version: "main" @@ -656,8 +665,8 @@ package_config: - type: "vsh" name: "openpipeline" repo: "openpipeline" - tag: "v4.0.3" - viash_version: "0.9.4" + tag: "v4.1.0" + viash_version: "0.9.7" source: "src" target: "target" config_mods: diff --git a/target/nextflow/workflows/multiomics/spatial_process_samples/main.nf b/target/nextflow/workflows/multiomics/spatial_process_samples/main.nf index 2aee605..092bc7f 100644 --- a/target/nextflow/workflows/multiomics/spatial_process_samples/main.nf +++ b/target/nextflow/workflows/multiomics/spatial_process_samples/main.nf @@ -1,6 +1,6 @@ // spatial_process_samples main // -// This wrapper script is auto-generated by viash 0.9.4 and is thus a derivative +// This wrapper script is auto-generated by viash 0.9.7 and is thus a derivative // work thereof. This software comes with ABSOLUTELY NO WARRANTY from Data // Intuitive. // @@ -1355,47 +1355,42 @@ def readCsv(file_path) { def splitRegex = java.util.regex.Pattern.compile(''',(?=(?:[^"]*"[^"]*")*[^"]*$)''') def removeQuote = java.util.regex.Pattern.compile('''"(.*)"''') - def br = java.nio.file.Files.newBufferedReader(inputFile) + java.nio.file.Files.newBufferedReader(inputFile).withCloseable { br -> + def row = 0 + def header = null + def line - def row = -1 - def header = null - while (br.ready() && header == null) { - def line = br.readLine() - row++ - if (!line.startsWith("#")) { - header = splitRegex.split(line, -1).collect{field -> - m = removeQuote.matcher(field) - m.find() ? m.replaceFirst('$1') : field - } - } - } - assert header != null: "CSV file should contain a header" - - while (br.ready()) { - def line = br.readLine() - row++ - if (line == null) { - br.close() - break - } - - if (!line.startsWith("#")) { - def predata = splitRegex.split(line, -1) - def data = predata.collect{field -> - if (field == "") { - return null - } - def m = removeQuote.matcher(field) - if (m.find()) { - return m.replaceFirst('$1') - } else { - return field + while (header == null && (line = br.readLine()) != null) { + if (!line.startsWith("#")) { + header = splitRegex.split(line, -1).collect { field -> + def m = removeQuote.matcher(field) + m.find() ? m.replaceFirst('$1') : field } } - assert header.size() == data.size(): "Row $row should contain the same number as fields as the header" - - def dataMap = [header, data].transpose().collectEntries().findAll{it.value != null} - output.add(dataMap) + row++ + } + assert header != null : "CSV file should contain a header" + + while ((line = br.readLine()) != null) { + row++ + if (!line.startsWith("#")) { + def predata = splitRegex.split(line, -1) + def data = predata.collect { field -> + if (field == "") { + return null + } + def m = removeQuote.matcher(field) + if (m.find()) { + return m.replaceFirst('$1') + } else { + return field + } + } + assert header.size() == data.size() : "Row $row should contain the same number as fields as the header" + + def dataMap = [header, data].transpose().collectEntries().findAll { it.value != null } + output.add(dataMap) + } } } @@ -1711,10 +1706,25 @@ process publishFilesProc { ] .transpose() .collectMany{infile, outfile -> - if (infile.toString() != outfile.toString()) { + def infileString = infile.toString() + def outfileString = outfile.toString() + if (infileString != outfileString) { + /* Trailing slashes are removed from both the source and destination arguments. + From source arguments, this is useful when a source argument may have a trailing slash + and specify a symbolic link to a directory. Without removing the slash, cp will dereference + the symbolic link. + See https://www.gnu.org/software/coreutils/manual/html_node/Trailing-slashes.html#Trailing-slashes-1 + + For the destination path addding a trailing slash is a problem when publishing directories: + it requires the destination directory to exist. This fails because we only create the parent + directories first. + */ + def regexTrailingSlashes = ~/\/+$/ + def infileNoTrailingSlash = infileString - regexTrailingSlashes + def outfileNoTrailingSlash = outfileString - regexTrailingSlashes [ - "[ -d \"\$(dirname '${outfile.toString()}')\" ] || mkdir -p \"\$(dirname '${outfile.toString()}')\"", - "cp -r '${infile.toString()}' '${outfile.toString()}'" + "[ -d \"\$(dirname '${outfileNoTrailingSlash}')\" ] || mkdir -p \"\$(dirname '${outfileNoTrailingSlash}')\"", + "cp -a '${infileNoTrailingSlash}' '${outfileNoTrailingSlash}'" ] } else { // no need to copy if infile is the same as outfile @@ -3409,6 +3419,17 @@ meta = [ } ] }, + { + "name" : "Cross-modality filtering", + "arguments" : [ + { + "type" : "boolean_true", + "name" : "--intersect_obs", + "description" : "After per-modality filtering and multisample processing, remove observations\nthat are not present in all processed modalities so that each modality shares\nthe same set of cells.\n", + "direction" : "input" + } + ] + }, { "name" : "Highly variable features detection", "arguments" : [ @@ -3707,7 +3728,7 @@ meta = [ "repository" : { "type" : "vsh", "repo" : "openpipeline", - "tag" : "v4.0.3" + "tag" : "v4.1.0" } } ], @@ -3716,7 +3737,7 @@ meta = [ "type" : "vsh", "name" : "openpipeline", "repo" : "openpipeline", - "tag" : "v4.0.3" + "tag" : "v4.1.0" } ], "links" : { @@ -3806,8 +3827,8 @@ meta = [ "runner" : "nextflow", "engine" : "native", "output" : "/workdir/root/repo/target/nextflow/workflows/multiomics/spatial_process_samples", - "viash_version" : "0.9.4", - "git_commit" : "e087099616271bd0f11e825b7817ec14ebef62d7", + "viash_version" : "0.9.7", + "git_commit" : "4449aa6094a686af0a5fbe99b9aaafd01ae75aff", "git_remote" : "https://github.com/openpipelines-bio/openpipeline_spatial" }, "package_config" : { @@ -3827,10 +3848,10 @@ meta = [ "type" : "vsh", "name" : "openpipeline", "repo" : "openpipeline", - "tag" : "v4.0.3" + "tag" : "v4.1.0" } ], - "viash_version" : "0.9.4", + "viash_version" : "0.9.7", "source" : "/workdir/root/repo/src", "target" : "/workdir/root/repo/target", "config_mods" : [ @@ -3850,7 +3871,7 @@ meta = [ // resolve dependencies dependencies (if any) meta["root_dir"] = getRootDir() -include { process_samples as spatial_sample_processing_viashalias } from "${meta.root_dir}/dependencies/vsh/vsh/openpipeline/v4.0.3/nextflow/workflows/multiomics/process_samples/main.nf" +include { process_samples as spatial_sample_processing_viashalias } from "${meta.root_dir}/dependencies/vsh/vsh/openpipeline/v4.1.0/nextflow/workflows/multiomics/process_samples/main.nf" spatial_sample_processing = spatial_sample_processing_viashalias.run(key: "spatial_sample_processing") // inner workflow @@ -3891,6 +3912,7 @@ workflow run_wf { "prot_min_proteins_per_cell": state.prot_min_proteins_per_cell, "prot_max_proteins_per_cell": state.prot_max_proteins_per_cell, "prot_min_cells_per_protein": state.prot_min_cells_per_protein, + "intersect_obs": state.intersect_obs, "highly_variable_features_var_output": state.highly_variable_features_var_output, "highly_variable_features_obs_batch_key": state.highly_variable_features_obs_batch_key, "var_gene_names": state.var_gene_names, diff --git a/target/nextflow/workflows/multiomics/spatial_process_samples/nextflow_schema.json b/target/nextflow/workflows/multiomics/spatial_process_samples/nextflow_schema.json index bd8221e..916b6d3 100644 --- a/target/nextflow/workflows/multiomics/spatial_process_samples/nextflow_schema.json +++ b/target/nextflow/workflows/multiomics/spatial_process_samples/nextflow_schema.json @@ -156,6 +156,19 @@ } } }, + "cross-modality filtering": { + "title": "Cross-modality filtering", + "type": "object", + "description": "No description", + "properties": { + "intersect_obs": { + "type": "boolean", + "description": "After per-modality filtering and multisample processing, remove observations\nthat are not present in all processed modalities so that each modality shares\nthe same set of cells.\n", + "help_text": "Type: `boolean_true`, multiple: `False`, default: `false`. ", + "default": false + } + } + }, "highly variable features detection": { "title": "Highly variable features detection", "type": "object", @@ -357,6 +370,9 @@ { "$ref": "#/$defs/protein filtering options" }, + { + "$ref": "#/$defs/cross-modality filtering" + }, { "$ref": "#/$defs/highly variable features detection" }, diff --git a/target/nextflow/workflows/qc/spatial_qc/.config.vsh.yaml b/target/nextflow/workflows/qc/spatial_qc/.config.vsh.yaml index 94a0e5b..f7e55e6 100644 --- a/target/nextflow/workflows/qc/spatial_qc/.config.vsh.yaml +++ b/target/nextflow/workflows/qc/spatial_qc/.config.vsh.yaml @@ -304,12 +304,12 @@ dependencies: repository: type: "vsh" repo: "openpipeline" - tag: "v4.0.3" + tag: "v4.1.0" repositories: - type: "vsh" name: "openpipeline" repo: "openpipeline" - tag: "v4.0.3" + tag: "v4.1.0" links: repository: "https://github.com/openpipelines-bio/openpipeline_spatial" docker_registry: "ghcr.io" @@ -386,11 +386,11 @@ build_info: engine: "native" output: "target/nextflow/workflows/qc/spatial_qc" executable: "target/nextflow/workflows/qc/spatial_qc/main.nf" - viash_version: "0.9.4" - git_commit: "e087099616271bd0f11e825b7817ec14ebef62d7" + viash_version: "0.9.7" + git_commit: "4449aa6094a686af0a5fbe99b9aaafd01ae75aff" git_remote: "https://github.com/openpipelines-bio/openpipeline_spatial" dependencies: - - "target/dependencies/vsh/vsh/openpipeline/v4.0.3/nextflow/workflows/qc/qc" + - "target/dependencies/vsh/vsh/openpipeline/v4.1.0/nextflow/workflows/qc/qc" package_config: name: "openpipeline_spatial" version: "main" @@ -403,8 +403,8 @@ package_config: - type: "vsh" name: "openpipeline" repo: "openpipeline" - tag: "v4.0.3" - viash_version: "0.9.4" + tag: "v4.1.0" + viash_version: "0.9.7" source: "src" target: "target" config_mods: diff --git a/target/nextflow/workflows/qc/spatial_qc/main.nf b/target/nextflow/workflows/qc/spatial_qc/main.nf index 67a3112..865965d 100644 --- a/target/nextflow/workflows/qc/spatial_qc/main.nf +++ b/target/nextflow/workflows/qc/spatial_qc/main.nf @@ -1,6 +1,6 @@ // spatial_qc main // -// This wrapper script is auto-generated by viash 0.9.4 and is thus a derivative +// This wrapper script is auto-generated by viash 0.9.7 and is thus a derivative // work thereof. This software comes with ABSOLUTELY NO WARRANTY from Data // Intuitive. // @@ -1355,47 +1355,42 @@ def readCsv(file_path) { def splitRegex = java.util.regex.Pattern.compile(''',(?=(?:[^"]*"[^"]*")*[^"]*$)''') def removeQuote = java.util.regex.Pattern.compile('''"(.*)"''') - def br = java.nio.file.Files.newBufferedReader(inputFile) + java.nio.file.Files.newBufferedReader(inputFile).withCloseable { br -> + def row = 0 + def header = null + def line - def row = -1 - def header = null - while (br.ready() && header == null) { - def line = br.readLine() - row++ - if (!line.startsWith("#")) { - header = splitRegex.split(line, -1).collect{field -> - m = removeQuote.matcher(field) - m.find() ? m.replaceFirst('$1') : field - } - } - } - assert header != null: "CSV file should contain a header" - - while (br.ready()) { - def line = br.readLine() - row++ - if (line == null) { - br.close() - break - } - - if (!line.startsWith("#")) { - def predata = splitRegex.split(line, -1) - def data = predata.collect{field -> - if (field == "") { - return null - } - def m = removeQuote.matcher(field) - if (m.find()) { - return m.replaceFirst('$1') - } else { - return field + while (header == null && (line = br.readLine()) != null) { + if (!line.startsWith("#")) { + header = splitRegex.split(line, -1).collect { field -> + def m = removeQuote.matcher(field) + m.find() ? m.replaceFirst('$1') : field } } - assert header.size() == data.size(): "Row $row should contain the same number as fields as the header" - - def dataMap = [header, data].transpose().collectEntries().findAll{it.value != null} - output.add(dataMap) + row++ + } + assert header != null : "CSV file should contain a header" + + while ((line = br.readLine()) != null) { + row++ + if (!line.startsWith("#")) { + def predata = splitRegex.split(line, -1) + def data = predata.collect { field -> + if (field == "") { + return null + } + def m = removeQuote.matcher(field) + if (m.find()) { + return m.replaceFirst('$1') + } else { + return field + } + } + assert header.size() == data.size() : "Row $row should contain the same number as fields as the header" + + def dataMap = [header, data].transpose().collectEntries().findAll { it.value != null } + output.add(dataMap) + } } } @@ -1711,10 +1706,25 @@ process publishFilesProc { ] .transpose() .collectMany{infile, outfile -> - if (infile.toString() != outfile.toString()) { + def infileString = infile.toString() + def outfileString = outfile.toString() + if (infileString != outfileString) { + /* Trailing slashes are removed from both the source and destination arguments. + From source arguments, this is useful when a source argument may have a trailing slash + and specify a symbolic link to a directory. Without removing the slash, cp will dereference + the symbolic link. + See https://www.gnu.org/software/coreutils/manual/html_node/Trailing-slashes.html#Trailing-slashes-1 + + For the destination path addding a trailing slash is a problem when publishing directories: + it requires the destination directory to exist. This fails because we only create the parent + directories first. + */ + def regexTrailingSlashes = ~/\/+$/ + def infileNoTrailingSlash = infileString - regexTrailingSlashes + def outfileNoTrailingSlash = outfileString - regexTrailingSlashes [ - "[ -d \"\$(dirname '${outfile.toString()}')\" ] || mkdir -p \"\$(dirname '${outfile.toString()}')\"", - "cp -r '${infile.toString()}' '${outfile.toString()}'" + "[ -d \"\$(dirname '${outfileNoTrailingSlash}')\" ] || mkdir -p \"\$(dirname '${outfileNoTrailingSlash}')\"", + "cp -a '${infileNoTrailingSlash}' '${outfileNoTrailingSlash}'" ] } else { // no need to copy if infile is the same as outfile @@ -3405,7 +3415,7 @@ meta = [ "repository" : { "type" : "vsh", "repo" : "openpipeline", - "tag" : "v4.0.3" + "tag" : "v4.1.0" } } ], @@ -3414,7 +3424,7 @@ meta = [ "type" : "vsh", "name" : "openpipeline", "repo" : "openpipeline", - "tag" : "v4.0.3" + "tag" : "v4.1.0" } ], "links" : { @@ -3504,8 +3514,8 @@ meta = [ "runner" : "nextflow", "engine" : "native", "output" : "/workdir/root/repo/target/nextflow/workflows/qc/spatial_qc", - "viash_version" : "0.9.4", - "git_commit" : "e087099616271bd0f11e825b7817ec14ebef62d7", + "viash_version" : "0.9.7", + "git_commit" : "4449aa6094a686af0a5fbe99b9aaafd01ae75aff", "git_remote" : "https://github.com/openpipelines-bio/openpipeline_spatial" }, "package_config" : { @@ -3525,10 +3535,10 @@ meta = [ "type" : "vsh", "name" : "openpipeline", "repo" : "openpipeline", - "tag" : "v4.0.3" + "tag" : "v4.1.0" } ], - "viash_version" : "0.9.4", + "viash_version" : "0.9.7", "source" : "/workdir/root/repo/src", "target" : "/workdir/root/repo/target", "config_mods" : [ @@ -3548,7 +3558,7 @@ meta = [ // resolve dependencies dependencies (if any) meta["root_dir"] = getRootDir() -include { qc as spatial_qc_workflow_viashalias } from "${meta.root_dir}/dependencies/vsh/vsh/openpipeline/v4.0.3/nextflow/workflows/qc/qc/main.nf" +include { qc as spatial_qc_workflow_viashalias } from "${meta.root_dir}/dependencies/vsh/vsh/openpipeline/v4.1.0/nextflow/workflows/qc/qc/main.nf" spatial_qc_workflow = spatial_qc_workflow_viashalias.run(key: "spatial_qc_workflow") // inner workflow