Skip to content

🐍 add aracne3 and viper modules #8402

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Draft
wants to merge 16 commits into
base: master
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions modules/nf-core/aracne3/environment.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
channels:
- conda-forge
- bioconda
dependencies:
- conda-forge::r-base=4.3.1
44 changes: 44 additions & 0 deletions modules/nf-core/aracne3/main.nf
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
process ARACNE3 {
tag "$meta.id"
label 'process_medium'

container "docker.io/papaemmelab/aracne3:v1.0.1"

input:
tuple val(meta), path(expression_matrix)
path regulators

output:
tuple val(meta), path("*${meta.id}.tsv"), emit: consensus_network
tuple val(meta), path("subnets"), emit: subnets

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

script:
def args = task.ext.args ?: ''

"""
/ARACNe3/build/src/app/ARACNe3_app_release \\
-e $expression_matrix \\
-r $regulators \\
-o . \\
--runid $meta.id \\
$args
"""

stub:
def args = task.ext.args ?: ''

"""
cat <<-END_VERSIONS > versions.yml
/ARACNe3/build/src/app/ARACNe3_app_release \\
-e $expression_matrix \\
-r $regulators \\
-o . \\
--runid $meta.id \\
$args

END_VERSIONS
"""
}
75 changes: 75 additions & 0 deletions modules/nf-core/aracne3/meta.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,75 @@
name: aracne3
description: Run ARACNe3 for protein regulatory interactions inference tool
keywords:
- ARACNe3
- RNA-seq
- Protein Activity
- Networks
tools:
- aracne3:
description: >
ARACNe3 is an implementation of ARACNe which presents computational improvements
and theoretical changes to the recent ARACNe-AP implementation. Given a list of
regulators and a gene expression profile, ARACNe3 is used to infer irreducibly
dependent regulatory interactions and output a Gene Regulatory Network (GRN).
The mainstream analysis generates many GRNs of subsamples of the profile (called
"subnetworks") and then consolidates the subnetworks into a robust GRN. The
consolidated output is a GRN whose edge strengths can be quantified by several
statistical metrics.
homepage: https://github.com/califano-lab/ARACNe3
documentation: https://github.com/califano-lab/ARACNe3/blob/main/README.md
tool_dev_url: https://github.com/califano-lab/ARACNe3/tree/main
doi: 10.1093/bioinformatics/btw21

input:
- - meta:
type: map
description: |
Groovy Map containing sample information
e.g. `[ id:'test' ]`
- expression_matrix:
type: file
description: Normalized (TPM, CPM etc) gene expression matrix with genes as rows and samples as columns.
pattern: "*.tsv"
- - regulators:
type: file
description: List of genes (regulators) to be used for interactions network inference.
pattern: "*.txt"

output:
- consensus_network:
- meta:
type: map
description: |
Groovy Map containing sample information
e.g. [ id:'test' ]
- "consolidated-net_<runid>.tsv":
type: file
description: Consolidated Mutual Information estimation and significance per regulator/gene pair.
pattern: "consolidated-net_<runid>.tsv"

- subnets:
- meta:
type: map
description: |
Groovy Map containing sample information
e.g. [ id:'test' ]
- "subnets":
type: directory
description: Mutual Information estimation per regulator/gene pair, per subnetwork generated.
pattern: "consolidated-net_<runid>.tsv"

- versions:
- "versions.yml":
type: file
description: File containing software versions
pattern: "versions.yml"

authors:
- "@stikos"
- "@ddomenico"
- "@juanesarango"
maintainers:
- "@stikos"
- "@ddomenico"
- "@juanesarango"
40 changes: 40 additions & 0 deletions modules/nf-core/aracne3/tests/main.nf.test
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
nextflow_process {

name "Test module ARACNE3"
script "../main.nf"
process "ARACNE3"

tag "modules"
tag "modules_nfcore"
tag "aracne3"

test("aracne3_5samples_100regulators_5threads") {
config "./nextflow.config"

when {
params {
outdir = "./output"
aracne3_args = "--threads 5 --alpha 1 --seed 9001"
}
process {
"""
input[0] = [
[ id:'test'], // meta map
file("https://github.com/nf-core/test-datasets/raw/modules/data/delete_me/aracne3/expression_matrix.tsv", checkIfExists: true),
]
input[1] = file("https://github.com/nf-core/test-datasets/raw/modules/data/delete_me/aracne3/regulators.txt", checkIfExists: true)
"""
}
}

then {
assertAll(
{ assert process.success },
{ assert snapshot(process.out.consensus_network.get(0).get(1)).match("tsv") },
{ assert snapshot(process.out.subnets.get(0).get(1)).match(".tsv") },
{ assert snapshot(process.out.versions).match("versions") },
)
}

}
}
32 changes: 32 additions & 0 deletions modules/nf-core/aracne3/tests/main.nf.test.snap
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
{
"versions": {
"content": null,
"meta": {
"nf-test": "0.9.0",
"nextflow": "24.04.4"
},
"timestamp": "2025-05-06T14:58:18.838692"
},
"tsv": {
"content": [
"consolidated-net_test.tsv:md5,6221a5778044ce418e893e1d62ca3da2"
],
"meta": {
"nf-test": "0.9.0",
"nextflow": "24.04.4"
},
"timestamp": "2025-05-06T14:58:18.308379"
},
".tsv": {
"content": [
[
"subnet1_test.tsv:md5,ebbae6bae8792a2d073735e1d86da69c"
]
],
"meta": {
"nf-test": "0.9.0",
"nextflow": "24.04.4"
},
"timestamp": "2025-05-06T14:58:18.519708"
}
}
9 changes: 9 additions & 0 deletions modules/nf-core/aracne3/tests/nextflow.config
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
docker.runOptions = '--entrypoint ""'
docker.enabled = true

process {
withName: ARACNE3 {
container = "papaemmelab/aracne3:v1.0.0"
ext.args = params.aracne3_args
}
}
7 changes: 7 additions & 0 deletions modules/nf-core/viper/environment.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
---
# yaml-language-server: $schema=https://raw.githubusercontent.com/nf-core/modules/master/modules/environment-schema.json
channels:
- conda-forge
- bioconda
dependencies:
- "bioconda::bioconductor-viper=1.40.0"
32 changes: 32 additions & 0 deletions modules/nf-core/viper/main.nf
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
process VIPER {
tag "$meta_exp.id vs $meta_net.id"
label 'process_single'

conda "${moduleDir}/environment.yml"
container 'papaemmelab/viper'

input:
tuple val(meta_net), path(network)
tuple val(meta_exp), path(expression_matrix)

output:
path "${meta_exp.id}_vs_${meta_net.id}.viper_matrix.tsv", emit: viper_matrix
path "versions.yml", emit: versions

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

script:
template 'viper.R'

stub:
prefix = task.ext.prefix ?: "${meta_exp.id}_vs_${meta_net.id}"
"""
touch ${prefix}.viper_matrix.tsv

cat <<-END_VERSIONS > versions.yml
"${task.process}":
viper: \$(Rscript -e "cat(as.character(packageVersion('viper')))"
END_VERSIONS
"""
}
50 changes: 50 additions & 0 deletions modules/nf-core/viper/meta.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
name: viper
description: Run Virtual Inference of Protein-activity by Enriched Regulon analysis.
keywords:
- Viper
- Regulators
- Protein Activity
- RNA-seq
tools:
- viper:
description: |
The viper R package infers protein activity from gene expression data,
and includes the VIPER and msVIPER algorithms developed by the Califano lab.
homepage: https://www.bioconductor.org/packages/release/bioc/html/viper.html
documentation: https://www.bioconductor.org/packages/release/bioc/vignettes/viper/inst/doc/viper.pdf
doi: 10.1038/ng.3593
input:
- meta_net:
type: map
description: |
Groovy Map containing network information
e.g. `[ id:'network1' ]`
- network:
type: file
description: 3 column ARACNe network file.
pattern: "*.tsv"
- meta_exp:
type: map
description: |
Groovy Map containing expression matrix information
e.g. `[ id:'expression1' ]`
- expression_matrix:
type: file
description: Expression matrix with samples as columns and genes as rows.
pattern: "*.tsv"
output:
- viper_matrix:
type: file
description: Viper output matrix of inferred protein activity.
- versions:
type: file
description: File containing software versions
pattern: "versions.yml"
authors:
- "@ddomenico"
- "@juanesarango"
- "@stikos"
maintainers:
- "@ddomenico"
- "@juanesarango"
- "@stikos"
38 changes: 38 additions & 0 deletions modules/nf-core/viper/templates/viper.R
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
#!/usr/bin/env Rscript

library(viper)

# Inject variables
exp_mat_file <- "${expression_matrix}"
network_file <- "${network}"

# Load regulon and expression matrix
exp_mat <- as.matrix(read.table(exp_mat_file, header=TRUE))
regul <- aracne2regulon(network_file, exp_mat)

# Run VIPER
vpres <- viper(exp_mat, regul, verbose = FALSE)

# Output result
output_file <- file.path("${meta_exp.id}_vs_${meta_net.id}.viper_matrix.tsv")
write.table(vpres, file = output_file, sep = "\t", quote = FALSE)

################################################
################################################
## VERSIONS FILE ##
################################################
################################################

viper_version <- as.character(packageVersion('viper'))

writeLines(
c(
'"${task.process}":',
paste(' viper:', viper_version)
),
'versions.yml')

################################################
################################################
################################################
################################################
48 changes: 48 additions & 0 deletions modules/nf-core/viper/tests/main.nf.test
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
nextflow_process {

name "Test Process VIPER"
script "../main.nf"
process "VIPER"
tag "modules"
tag "modules_nfcore"
tag "viper"

test("test_viper") {

setup {
run("ARACNE3") {
script "../../aracne3/main.nf"
process {
"""
input[0] = [ [id:"testexp"], file('https://github.com/nf-core/test-datasets/raw/modules/data/delete_me/aracne3/expression_matrix.tsv', checkIfExists: true) ]
input[1] = file('https://github.com/nf-core/test-datasets/raw/modules/data/delete_me/aracne3/regulators.txt', checkIfExists: true)
"""
}
}
}

when {
params {
aracne3_args = "--threads 5 --alpha 1 --seed 9001"
}
process {
"""
input[0] = ARACNE3.out.consensus_network.collect{ meta, consensus_network -> consensus_network }.map{ consensus_network -> [[ id: 'testnet'], consensus_network]}
input[1] = [ [id:"testexp"], file('https://github.com/nf-core/test-datasets/raw/modules/data/delete_me/aracne3/expression_matrix.tsv', checkIfExists: true) ]
"""
}
}

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

}
}
Loading
Loading