Skip to content

Commit

Permalink
Merge pull request #128 from FertigLab/126-nextflow-module
Browse files Browse the repository at this point in the history
126 nextflow module
  • Loading branch information
dimalvovs authored Nov 27, 2024
2 parents b96cc5c + f56eeb0 commit 6129c28
Showing 1 changed file with 43 additions and 0 deletions.
43 changes: 43 additions & 0 deletions nextflow/main.nf
Original file line number Diff line number Diff line change
Expand Up @@ -53,3 +53,46 @@ process COGAPS {
END_VERSIONS
"""
}

process PREPROCESS {
tag "$meta.id"
label 'process_low'
container 'docker.io/satijalab/seurat:5.0.0'

input:
tuple val(meta), path(data)
output:
tuple val(meta), path("${prefix}/dgCMatrix.rds"), emit: dgCMatrix
path "versions.yml" , emit: versions

stub:
def args = task.ext.args ?: ''
prefix = task.ext.prefix ?: "${meta.id}"

"""
mkdir "${prefix}"
touch "${prefix}/dgCMatrix.rds"
cat <<-END_VERSIONS > versions.yml
"${task.process}":
seurat: \$(Rscript -e 'print(packageVersion("Seurat"))' | awk '{print \$2}')
R: \$(Rscript -e 'print(packageVersion("base"))' | awk '{print \$2}')
END_VERSIONS
"""

script:
def args = task.ext.args ?: ''
prefix = task.ext.prefix ?: "${meta.id}"
"""
mkdir "${prefix}"
Rscript -e 'res <- Seurat::Read10X("$data/raw_feature_bc_matrix/");
res <- Seurat::NormalizeData(res);
saveRDS(res, file="${prefix}/dgCMatrix.rds")';
cat <<-END_VERSIONS > versions.yml
"${task.process}":
seurat: \$(Rscript -e 'print(packageVersion("Seurat"))' | awk '{print \$2}')
R: \$(Rscript -e 'print(packageVersion("base"))' | awk '{print \$2}')
END_VERSIONS
"""
}

0 comments on commit 6129c28

Please sign in to comment.