Skip to content

Commit c26e822

Browse files
committed
add optional input table for clonalities
1 parent a4001c3 commit c26e822

8 files changed

Lines changed: 1141 additions & 17 deletions

File tree

Makefile

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,3 +27,4 @@ test:
2727
bash test/scripts/run_test_8.sh
2828
bash test/scripts/run_test_10.sh
2929
bash test/scripts/run_test_11.sh
30+
bash test/scripts/run_test_12.sh

README.md

Lines changed: 20 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -74,14 +74,14 @@ Output:
7474

7575
### Input tables
7676

77-
The table with VCF files expects two tab-separated columns without a header
77+
The table with **VCF files** expects two tab-separated columns without a header
7878

7979
| Patient name | VCF |
8080
|-------------------|----------------------------------------|
8181
| patient_1 | /path/to/patient_1.vcf |
8282
| patient_2 | /path/to/patient_2.vcf |
8383

84-
The optional table with BAM files expects two tab-separated columns without a header.
84+
The optional table with **BAM files** expects two tab-separated columns without a header.
8585

8686
| Patient name | Sample name:BAM |
8787
|--------------------|---------------------------------------------------|
@@ -93,8 +93,13 @@ The optional table with BAM files expects two tab-separated columns without a he
9393
| patient_2 | metastasis_tumor:/path/to/sample_1.metastasis.bam |
9494
| patient_2 | normal:/path/to/sample_1.normal.bam |
9595

96-
The optional table with tumor purities expects two tab-separated columns without a header.
97-
Normal samples are not expected to have a purity value, the default purity is 1.0.
96+
Each patient can have any number of samples. Any sample can have any number of BAM files, annotations from the
97+
different BAM files of the same sample will be provided with suffixes _1, _2, etc.
98+
The aggregated vafator annotations on each sample will also be provided without a suffix.
99+
100+
101+
The optional table with **tumor purities** expects two tab-separated columns without a header.
102+
The default purity is 1.0.
98103
Purity values are in the range 0.0 to 1.0.
99104
The purity values are used to adjust the expected VAF which is then used to calculate the power to detect a
100105
somatic mutation and the probability of an undetected somatic mutation.
@@ -106,9 +111,17 @@ somatic mutation and the probability of an undetected somatic mutation.
106111
| patient_2 | primary_tumor:0.6 |
107112
| patient_2 | metastasis_tumor:0.7 |
108113

109-
Each patient can have any number of samples. Any sample can have any number of BAM files, annotations from the
110-
different BAM files of the same sample will be provided with suffixes _1, _2, etc.
111-
The aggregated vafator annotations on each sample will also be provided without a suffix.
114+
The optional table with **local clonality** values expects two tab-separated columns without a header.
115+
The local clonalities are provided in a Bedgraph file as described in VAFator documentation or as a genome-wide
116+
numeric parameter.
117+
118+
| Patient name | Sample name:local clonalities |
119+
|--------------------|----------------------------------------------------------------------|
120+
| patient_1 | primary_tumor:/path/to/patient_1.primary.local_clonalities.bed |
121+
| patient_1 | metastasis_tumor:/path/to/patient_1.metastasis.local_clonalities.bed |
122+
| patient_2 | primary_tumor:3 |
123+
| patient_2 | metastasis_tumor:2 |
124+
112125

113126
## Variant filtering
114127

main.nf

Lines changed: 35 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -10,9 +10,14 @@ include { VARIANT_ANNOTATION } from './modules/05_variant_annotation'
1010

1111
params.help= false
1212
params.input_vcfs = false
13+
14+
// optional VAFator inputs
1315
params.input_bams = false
14-
params.input_purities = false
1516
params.input_vcf = false
17+
params.input_purities = false
18+
params.input_clonalities = false
19+
20+
1621
params.reference = false
1722
params.output = "output"
1823
params.skip_normalization = false
@@ -21,6 +26,8 @@ params.filter = false
2126
params.cpus = 1
2227
params.memory = "4g"
2328
params.skip_multiallelic_filter = false
29+
30+
// SnpEff input
2431
params.snpeff_organism = false
2532
params.snpeff_datadir = false
2633

@@ -71,6 +78,20 @@ if (params.input_purities) {
7178
.map{ row-> tuple(row.name, row.purity) }
7279
.set { input_purities }
7380
}
81+
else {
82+
input_purities = Channel.fromList([])
83+
}
84+
85+
if (params.input_clonalities) {
86+
Channel
87+
.fromPath(params.input_clonalities)
88+
.splitCsv(header: ['name', 'clonality_bed'], sep: "\t")
89+
.map{ row-> tuple(row.name, row.clonality_bed) }
90+
.set { input_clonalities }
91+
}
92+
else {
93+
input_clonalities = Channel.fromList([])
94+
}
7495

7596
workflow {
7697

@@ -97,12 +118,19 @@ workflow {
97118
}
98119

99120
if ( params.input_bams ) {
100-
if (params.input_purities) {
101-
VAFATOR(final_vcfs.join(input_bams.groupTuple()).join(input_purities.groupTuple()))
102-
}
103-
else {
104-
VAFATOR(final_vcfs.join(input_bams.groupTuple()))
105-
}
121+
// prepare input for VAFator and call it
122+
vafator_input = final_vcfs.join(input_bams.groupTuple())
123+
.join(input_purities.groupTuple(), remainder: true)
124+
.join(input_clonalities.groupTuple(), remainder: true)
125+
126+
//if (params.input_purities) {
127+
// vafator_input = vafator_input.join(input_purities.groupTuple())
128+
//}
129+
//if (params.input_clonalities) {
130+
// vafator_input = vafator_input.join(input_clonalities.groupTuple())
131+
//}
132+
VAFATOR(vafator_input)
133+
106134
final_vcfs = VAFATOR.out.annotated_vcf
107135
if ( ! params.skip_multiallelic_filter ) {
108136
final_vcfs = MULTIALLELIC_FILTER(final_vcfs)

modules/04_vafator.nf

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,21 +15,22 @@ process VAFATOR {
1515
conda (params.enable_conda ? "bioconda::vafator=2.0.1" : null)
1616

1717
input:
18-
tuple val(patient_name), file(vcf), val(bams), val(purities)
18+
tuple val(patient_name), file(vcf), val(bams), val(purities), val(clonalities)
1919

2020
output:
2121
tuple val(patient_name), file("${patient_name}.vaf.vcf"), emit: annotated_vcf
2222

2323
script:
2424
bams_param = bams.collect { b -> "--bam " + b.split(":").join(" ") }.join(" ")
2525
purity_param = purities.collect { b -> "--purity " + b.split(":").join(" ") }.join(" ")
26+
clonality_param = clonalities.collect { b -> "--tumor-ploidy " + b.split(":").join(" ") }.join(" ")
2627
"""
2728
vafator \
2829
--input-vcf ${vcf} \
2930
--output-vcf ${patient_name}.vaf.vcf \
3031
--mapping-quality ${params.mapping_quality} \
3132
--base-call-quality ${params.base_call_quality} \
32-
${bams_param} ${purity_param}
33+
${bams_param} ${purity_param} ${clonality_param}
3334
"""
3435
}
3536

@@ -40,7 +41,7 @@ process MULTIALLELIC_FILTER {
4041
tag "${name}"
4142
publishDir "${params.output}/${name}", mode: "copy"
4243

43-
conda (params.enable_conda ? "bioconda::vafator=1.2.5" : null)
44+
conda (params.enable_conda ? "bioconda::vafator=2.0.1" : null)
4445

4546
input:
4647
tuple val(name), file(vcf)
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
chr1 1000000 2000000 2.504923378628667

0 commit comments

Comments
 (0)