Skip to content
Merged
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
2 changes: 1 addition & 1 deletion modules/nf-core/viber/environment.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ channels:
- bioconda

dependencies:
- bioconda::r-cnaqc=1.1.2
- bioconda::r-cnaqc=1.1.3
- bioconda::r-viber=1.0.0
- conda-forge::r-cli=3.6.5
- conda-forge::r-dplyr=1.1.4
Expand Down
4 changes: 2 additions & 2 deletions modules/nf-core/viber/main.nf
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@ process VIBER {

conda "${moduleDir}/environment.yml"
container "${ workflow.containerEngine == 'singularity' && !task.ext.singularity_pull_docker_container ?
'oras://community.wave.seqera.io/library/r-cnaqc_r-viber:014077a3164189d5':
'community.wave.seqera.io/library/r-cnaqc_r-viber:2314592f7d2f9abe'}"
'https://community-cr-prod.seqera.io/docker/registry/v2/blobs/sha256/21/21e21fc0c84576a262f02779cb091dbe2734a12e3b9a2c41e08cb8393bd3953f/data':
'community.wave.seqera.io/library/r-cnaqc_r-viber_r-cli_r-dplyr_pruned:f00a3b14d68a7bac'}"

input:
tuple val(meta), path(rds_join), val(tumour_samples)
Expand Down
35 changes: 22 additions & 13 deletions modules/nf-core/viber/templates/viber_main_script.R
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
#!/usr/bin/env Rscript

options(easypar.parallel=FALSE)

parse_args = function(x) {
x = gsub("\\\\[","",x)
x = gsub("\\\\]","",x)
Expand Down Expand Up @@ -37,22 +39,25 @@ library(ggpubr)

samples = substr("$tumour_samples", 2, nchar("$tumour_samples")-1)
samples = strsplit(samples, ", ")[[1]]
print("$meta.patient")
print("$tumour_samples")
print("$rds_join")
print(samples)

cli::cli_text("Patient $meta.patient with samples $tumour_samples.")
cli::cli_text("Input file: $rds_join.")

if ( grepl(".rds\$", tolower("$rds_join")) ) {
input_obj = readRDS("$rds_join")
if (class(input_obj) == "m_cnaqc") {
shared = input_obj %>% get_sample(sample=samples, which_obj="shared")
joint_table = lapply(names(shared),
function(sample_name)
shared[[sample_name]] %>%
CNAqc::subset_by_segment_karyotype("1:1") %>%
CNAqc::Mutations() %>%
dplyr::mutate(sample_id=sample_name)
) %>% dplyr::bind_rows()
function(sample_name) {
table_s = shared[[sample_name]] %>%
CNAqc::subset_by_segment_karyotype("1:1") %>%
CNAqc::Mutations() %>%
dplyr::mutate(sample_id=sample_name)
if (nrow(table_s) == 0) {
cli::cli_alert_warning("Sample {sample_name} has no diploid mutations!")
}
return(table_s)
}) %>% dplyr::bind_rows()
} else {
cli::cli_alert_warning("Object of class {class(input_obj)} not supported.")
return()
Expand All @@ -61,7 +66,11 @@ if ( grepl(".rds\$", tolower("$rds_join")) ) {
joint_table = read.csv("$rds_join")
}

print("Subset joint done")
if (nrow(joint_table) == 0) {
cli::cli_alert_warning("No samples contain diploid mutations!")
}

cli::cli_text("Joint table created.")

## Read input joint table
input_tab = joint_table %>%
Expand All @@ -88,12 +97,12 @@ nv = reads_data %>%
# Standard fit
viber_K = as.integer(opt[["K"]])

message("Starting standard fit")
cli::cli_text("Starting standard fit")
st_fit = VIBER::variational_fit(nv, dp,
K=viber_K,
data=reads_data)
st_fit[["description"]]="$meta.patient"
message("End standard fit")
cli::cli_text("End standard fit")
best_fit = best_fit_heuristic = st_fit

# If all clusters are removed -> keep the origianl best fit
Expand Down
16 changes: 8 additions & 8 deletions modules/nf-core/viber/tests/main.nf.test.snap
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,14 @@
"viber - csv": {
"content": [
[
"versions.yml:md5,d27db9579ed0b91c5131d11f037ec121"
"versions.yml:md5,0aff4c2ae3de260cbef5870e5f4f0374"
]
],
"meta": {
"nf-test": "0.9.3",
"nextflow": "25.04.7"
"nf-test": "0.9.2",
"nextflow": "25.10.2"
},
"timestamp": "2025-10-10T17:31:00.066038"
"timestamp": "2026-01-21T18:29:55.951523"
},
"viber - csv - stub": {
"content": [
Expand Down Expand Up @@ -171,14 +171,14 @@
"viber - rds": {
"content": [
[
"versions.yml:md5,d27db9579ed0b91c5131d11f037ec121"
"versions.yml:md5,0aff4c2ae3de260cbef5870e5f4f0374"
]
],
"meta": {
"nf-test": "0.9.3",
"nextflow": "25.04.7"
"nf-test": "0.9.2",
"nextflow": "25.10.2"
},
"timestamp": "2025-10-10T17:27:18.630026"
"timestamp": "2026-01-21T18:34:41.655887"
},
"viber - rds - stub": {
"content": [
Expand Down