Skip to content

Commit

Permalink
Merge branch 'master' into master
Browse files Browse the repository at this point in the history
  • Loading branch information
LaurenGonsalves authored Mar 25, 2024
2 parents cd79b71 + 624ecdc commit b2d342c
Show file tree
Hide file tree
Showing 133 changed files with 6,560 additions and 896 deletions.
71 changes: 71 additions & 0 deletions modules/nf-core/decoupler/decoupler/main.nf
Original file line number Diff line number Diff line change
@@ -0,0 +1,71 @@
process DECOUPLER {
tag "$meta.id"
label 'process_medium'

conda "conda-forge::decoupler-py=1.6.0"
container = "ghcr.io/saezlab/publish-packages/decoupler:sha-5838309"

input:
tuple val(meta), path(mat)
path(net)

output:
tuple val(meta), path("*estimate__decoupler.tsv"), emit: dc_estimate
tuple val(meta), path("*pvals__decoupler.tsv"), emit: dc_pvals
path("versions.yml"), emit: versions

when:
task.ext.when == null || task.ext.when

script:
def args = task.ext.args ?: "{}"
"""
#!/usr/bin/env python3
import os
import pandas as pd
os.environ["NUMBA_CACHE_DIR"] = "./tmp"
import decoupler as dc
methods = ['aucell', 'gsea', 'gsva', 'mdt', 'mlm', 'ora', 'udt',
'ulm', 'viper', 'wmean', 'wsum']
mat = pd.read_csv("${mat}", sep="\t", index_col=0)
net = pd.read_csv("${net}", sep="\t", index_col=0)
# Parsing arguments
args = ${args}
parsedargs = {'args': {}}
for k, v in args.items():
# Specific method argument
if k.split('_')[0] in methods:
meth = k.split('_')[0]
arg = '_'.join(k.split('_')[1:])
if meth not in args['args'].keys():
parsedargs['args'][meth] = {arg: v}
else:
parsedargs['args'][meth].update({arg: v})
# Generic argument
else:
parsedargs[k] = v
results = dc.decouple(
mat=mat,
net=net,
**parsedargs
)
for result in results:
results[result].to_csv(result + "__decoupler.tsv", sep="\t")
## VERSIONS FILE
with open('versions.yml', 'a') as version_file:
version_file.write('"${task.process}":' + "\\n")
version_file.write("\tdecoupler-py: " + dc.__version__ + "\\n")
"""
}
83 changes: 83 additions & 0 deletions modules/nf-core/decoupler/decoupler/meta.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,83 @@
name: "decoupler"

description: |
decoupler is a package containing different statistical methods
to extract biological activities from omics data within a unified framework.
It allows to flexibly test any enrichment method with any prior knowledge
resource and incorporates methods that take into account the sign and weight.
It can be used with any omic, as long as its features can be linked to a
biological process based on prior knowledge. For example, in transcriptomics
gene sets regulated by a transcription factor, or in phospho-proteomics
phosphosites that are targeted by a kinase.
keywords:
- enrichment
- omics
- biological activity
- functional analysis
- prior knowledge

tools:
- "decoupler":
description: "Ensemble of methods to infer biological activities from omics data"
homepage: "https://github.com/saezlab/decoupler-py"
documentation: "https://decoupler-py.readthedocs.io/en/latest/api.html"
tool_dev_url: "https://decoupler-py.readthedocs.io"
doi: "10.1093/bioadv/vbac016"
licence: ["GPL v3"]

input:
- meta:
type: map
description: |
Groovy Map containing sample information
e.g. [ id:‘test’, single_end ]
- mat:
type: file
description: |
Path to the matrix file (e.g. gene/protein expression, etc.).
Should be in in tab-separated format (`*.tab`)
pattern: "*.tsv"
- net:
type: file
description: |
The prior knowledge network linking the features of the
expression matrix to a process/component (e.g. gene set,
transcription factor, kinase, etc.)
pattern: "*.tsv"
- args:
type: string
description: |
Keyword arguments passed to `decoupler.decouple()` (see
documentation for more information here:
https://decoupler-py.readthedocs.io/en/latest/generated/decoupler.decouple.html#decoupler.decouple).
Arguments specific for a method must be specified with
the method name as a prefix e.g. `'gsea_batch_size'`
pattern: "{arg: val, ..., method_arg: val}"

output:
- meta:
type: map
description: |
Groovy Map containing sample information
e.g. [ id:‘test’, single_end ]
- dc_estimate:
type: file
description: |
The file containing the estimation results of the enrichment(s)
pattern: "*estimate__decoupler.tsv"
- dc_pvals:
type: file
description: |
The file containing the p-value associated to the estimation
results of the enrichment(s)
pattern: "*pvals__decoupler.tsv"
- versions:
type: file
description: File containing software versions
pattern: "versions.yml"

authors:
- "@gabora"
- "@vicpaton"
- "@Nic-Nic"
38 changes: 38 additions & 0 deletions modules/nf-core/decoupler/decoupler/tests/main.nf.test
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
nextflow_process {

name "Test Process DECOUPLER"
script "../main.nf"
config "./nextflow.config"
process "DECOUPLER"

tag "modules"
tag "modules_nfcore"
tag "decoupler"
tag "decoupler/decoupler"

test("decoupler_test") {

when {
process {
"""
input[0] = [
[ id: 'test' ],
file(params.test_data['generic']['tsv']['expression'], checkIfExists: true)
]
input[1] = [
file(params.test_data['generic']['tsv']['network'], checkIfExists: true)
]
"""
}
}

then {
assertAll(
{ assert process.success },
{ assert snapshot(process.out).match() }
)
}

}

}
71 changes: 71 additions & 0 deletions modules/nf-core/decoupler/decoupler/tests/main.nf.test.snap

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 6 additions & 0 deletions modules/nf-core/decoupler/decoupler/tests/nextflow.config
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
process {
withName: "DECOUPLER" {
ext.prefix = 'test'
ext.args = "{'min_n': 1}"
}
}
2 changes: 2 additions & 0 deletions modules/nf-core/decoupler/decoupler/tests/tags.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
decoupler/decoupler:
- "modules/nf-core/decoupler/decoupler/**"
117 changes: 117 additions & 0 deletions modules/nf-core/deepvariant/tests/main.nf.test
Original file line number Diff line number Diff line change
@@ -0,0 +1,117 @@
nextflow_process {

name "Test Process DEEPVARIANT"
script "../main.nf"
process "DEEPVARIANT"

tag "deepvariant"
tag "modules"
tag "modules_nfcore"

test("homo_sapiens - [bam, bai] - fasta - fai") {
when {
config "./nextflow.config"

process {
"""
input[0] = [
[ id:'test', single_end:false ], // meta map
file(params.modules_testdata_base_path + '/genomics/homo_sapiens/illumina/bam/test.paired_end.sorted.bam', checkIfExists: true),
file(params.modules_testdata_base_path + '/genomics/homo_sapiens/illumina/bam/test.paired_end.sorted.bam.bai', checkIfExists: true),
[]
]
input[1] = [
[ id:'genome'],
file(params.modules_testdata_base_path + '/genomics/homo_sapiens/genome/genome.fasta', checkIfExists: true)
]
input[2] = [
[ id:'genome'],
file(params.modules_testdata_base_path + '/genomics/homo_sapiens/genome/genome.fasta.fai', checkIfExists: true)
]
input[3] = [
[],[]
]
"""
}
}

then {
assertAll(
{ assert process.success },
{ assert snapshot(process.out).match() }
)
}
}

test("homo_sapiens - [cram, crai, genome_bed] - fasta - fai") {
config "./nextflow-intervals.config"

when {
process {
"""
input[0] = [
[ id:'test', single_end:false ], // meta map
file(params.modules_testdata_base_path + '/genomics/homo_sapiens/illumina/cram/test.paired_end.sorted.cram', checkIfExists: true),
file(params.modules_testdata_base_path + '/genomics/homo_sapiens/illumina/cram/test.paired_end.sorted.cram.crai', checkIfExists: true),
file(params.modules_testdata_base_path + '/genomics/homo_sapiens/genome/genome.bed', checkIfExists: true)
]
input[1] = [
[ id:'genome'],
file(params.modules_testdata_base_path + '/genomics/homo_sapiens/genome/genome.fasta', checkIfExists: true)
]
input[2] = [
[ id:'genome'],
file(params.modules_testdata_base_path + '/genomics/homo_sapiens/genome/genome.fasta.fai', checkIfExists: true)
]
input[3] = [
[],[]
]
"""
}
}

then {
assertAll(
{ assert process.success },
{ assert snapshot(process.out).match() }
)
}
}

test("homo_sapiens - [bam, bai] - fasta_gz - fasta_gz_fai") {
when {
config "./nextflow.config"

process {
"""
input[0] = [
[ id:'test', single_end:false ], // meta map
file(params.modules_testdata_base_path + '/genomics/homo_sapiens/illumina/bam/test.paired_end.sorted.bam', checkIfExists: true),
file(params.modules_testdata_base_path + '/genomics/homo_sapiens/illumina/bam/test.paired_end.sorted.bam.bai', checkIfExists: true),
[]
]
input[1] = [
[ id:'genome'],
file(params.modules_testdata_base_path + '/genomics/homo_sapiens/genome/genome.fasta.gz', checkIfExists: true)
]
input[2] = [
[ id:'genome'],
file(params.modules_testdata_base_path + '/genomics/homo_sapiens/genome/genome.fasta.gz.fai', checkIfExists: true)
]
input[3] = [
[ id:'genome'],
file(params.modules_testdata_base_path + '/genomics/homo_sapiens/genome/genome.fasta.gz.gzi', checkIfExists: true)
]
"""
}
}

then {
assertAll(
{ assert process.success },
{ assert snapshot(process.out).match() }
)
}
}

}
Loading

0 comments on commit b2d342c

Please sign in to comment.