Skip to content

Commit 8aef905

Browse files
author
Pablo Riesgo Ferreiro
committed
Merge branch 'develop' into 'master'
Release v1.5.0 See merge request tron/tron-bam-preprocessing!19
2 parents 2a6e306 + 4fcdcfb commit 8aef905

File tree

4 files changed

+58
-41
lines changed

4 files changed

+58
-41
lines changed

Makefile

Lines changed: 35 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -11,41 +11,44 @@ test:
1111
nextflow main.nf -profile test,conda --skip_bqsr --output output/test2
1212
nextflow main.nf -profile test,conda --skip_realignment --output output/test3
1313
nextflow main.nf -profile test,conda --skip_deduplication --output output/test4
14-
nextflow main.nf -profile test,conda --output output/test5 --skip_metrics --known_indels1 false --known_indels2 false
15-
nextflow main.nf -profile test,conda --output output/test6 --intervals false
16-
nextflow main.nf -profile test,conda --output output/test7 --hs_metrics_target_coverage target_coverage.txt --hs_metrics_per_base_coverage per_base_coverage.txt
17-
nextflow main.nf -profile test,conda --output output/test8 --hs_metrics_target_coverage target_coverage.txt --hs_metrics_per_base_coverage per_base_coverage.txt --collect_hs_metrics_min_base_quality 10 --collect_hs_metrics_min_mapping_quality 10 --remove_duplicates false
14+
nextflow main.nf -profile test,conda --output output/test5 --skip_deduplication --skip_bqsr --skip_metrics --known_indels1 false --known_indels2 false
15+
nextflow main.nf -profile test,conda --output output/test6 --intervals false --skip_deduplication --skip_bqsr --skip_realignment
16+
nextflow main.nf -profile test,conda --output output/test7 --hs_metrics_target_coverage target_coverage.txt --hs_metrics_per_base_coverage per_base_coverage.txt --skip_bqsr --skip_realignment
17+
nextflow main.nf -profile test,conda --output output/test8 --hs_metrics_target_coverage target_coverage.txt --hs_metrics_per_base_coverage per_base_coverage.txt --collect_hs_metrics_min_base_quality 10 --collect_hs_metrics_min_mapping_quality 10 --remove_duplicates false --skip_bqsr --skip_realignment
18+
nextflow main.nf -profile test,conda --output output/test9 --skip_deduplication --skip_bqsr --skip_realignment --input_files false --input_bam test_data/TESTX_S1_L001.bam
1819

1920
check:
2021
test -s output/test1/sample1/TESTX_S1_L001.preprocessed.bam || { echo "Missing test 1 output file!"; exit 1; }
2122
test -s output/test1/sample1/TESTX_S1_L001.preprocessed.bai || { echo "Missing test 1 output file!"; exit 1; }
2223
test -s output/test1/sample2/TESTX_S1_L002.preprocessed.bam || { echo "Missing test 1 output file!"; exit 1; }
2324
test -s output/test1/sample2/TESTX_S1_L002.preprocessed.bai || { echo "Missing test 1 output file!"; exit 1; }
24-
test -s output/test2/sample1/TESTX_S1_L001.preprocessed.bam || { echo "Missing test 1 output file!"; exit 1; }
25-
test -s output/test2/sample1/TESTX_S1_L001.preprocessed.bai || { echo "Missing test 1 output file!"; exit 1; }
26-
test -s output/test2/sample2/TESTX_S1_L002.preprocessed.bam || { echo "Missing test 1 output file!"; exit 1; }
27-
test -s output/test2/sample2/TESTX_S1_L002.preprocessed.bai || { echo "Missing test 1 output file!"; exit 1; }
28-
test -s output/test3/sample1/TESTX_S1_L001.preprocessed.bam || { echo "Missing test 1 output file!"; exit 1; }
29-
test -s output/test3/sample1/TESTX_S1_L001.preprocessed.bai || { echo "Missing test 1 output file!"; exit 1; }
30-
test -s output/test3/sample2/TESTX_S1_L002.preprocessed.bam || { echo "Missing test 1 output file!"; exit 1; }
31-
test -s output/test3/sample2/TESTX_S1_L002.preprocessed.bai || { echo "Missing test 1 output file!"; exit 1; }
32-
test -s output/test4/sample1/TESTX_S1_L001.preprocessed.bam || { echo "Missing test 1 output file!"; exit 1; }
33-
test -s output/test4/sample1/TESTX_S1_L001.preprocessed.bai || { echo "Missing test 1 output file!"; exit 1; }
34-
test -s output/test4/sample2/TESTX_S1_L002.preprocessed.bam || { echo "Missing test 1 output file!"; exit 1; }
35-
test -s output/test4/sample2/TESTX_S1_L002.preprocessed.bai || { echo "Missing test 1 output file!"; exit 1; }
36-
test -s output/test5/sample1/TESTX_S1_L001.preprocessed.bam || { echo "Missing test 1 output file!"; exit 1; }
37-
test -s output/test5/sample1/TESTX_S1_L001.preprocessed.bai || { echo "Missing test 1 output file!"; exit 1; }
38-
test -s output/test5/sample2/TESTX_S1_L002.preprocessed.bam || { echo "Missing test 1 output file!"; exit 1; }
39-
test -s output/test5/sample2/TESTX_S1_L002.preprocessed.bai || { echo "Missing test 1 output file!"; exit 1; }
40-
test -s output/test6/sample1/TESTX_S1_L001.preprocessed.bam || { echo "Missing test 1 output file!"; exit 1; }
41-
test -s output/test6/sample1/TESTX_S1_L001.preprocessed.bai || { echo "Missing test 1 output file!"; exit 1; }
42-
test -s output/test6/sample2/TESTX_S1_L002.preprocessed.bam || { echo "Missing test 1 output file!"; exit 1; }
43-
test -s output/test6/sample2/TESTX_S1_L002.preprocessed.bai || { echo "Missing test 1 output file!"; exit 1; }
44-
test -s output/test7/sample1/TESTX_S1_L001.preprocessed.bam || { echo "Missing test 1 output file!"; exit 1; }
45-
test -s output/test7/sample1/TESTX_S1_L001.preprocessed.bai || { echo "Missing test 1 output file!"; exit 1; }
46-
test -s output/test7/sample2/TESTX_S1_L002.preprocessed.bam || { echo "Missing test 1 output file!"; exit 1; }
47-
test -s output/test7/sample2/TESTX_S1_L002.preprocessed.bai || { echo "Missing test 1 output file!"; exit 1; }
48-
test -s output/test8/sample1/TESTX_S1_L001.preprocessed.bam || { echo "Missing test 1 output file!"; exit 1; }
49-
test -s output/test8/sample1/TESTX_S1_L001.preprocessed.bai || { echo "Missing test 1 output file!"; exit 1; }
50-
test -s output/test8/sample2/TESTX_S1_L002.preprocessed.bam || { echo "Missing test 1 output file!"; exit 1; }
51-
test -s output/test8/sample2/TESTX_S1_L002.preprocessed.bai || { echo "Missing test 1 output file!"; exit 1; }
25+
test -s output/test2/sample1/TESTX_S1_L001.preprocessed.bam || { echo "Missing test 2 output file!"; exit 1; }
26+
test -s output/test2/sample1/TESTX_S1_L001.preprocessed.bai || { echo "Missing test 2 output file!"; exit 1; }
27+
test -s output/test2/sample2/TESTX_S1_L002.preprocessed.bam || { echo "Missing test 2 output file!"; exit 1; }
28+
test -s output/test2/sample2/TESTX_S1_L002.preprocessed.bai || { echo "Missing test 2 output file!"; exit 1; }
29+
test -s output/test3/sample1/TESTX_S1_L001.preprocessed.bam || { echo "Missing test 3 output file!"; exit 1; }
30+
test -s output/test3/sample1/TESTX_S1_L001.preprocessed.bai || { echo "Missing test 3 output file!"; exit 1; }
31+
test -s output/test3/sample2/TESTX_S1_L002.preprocessed.bam || { echo "Missing test 3 output file!"; exit 1; }
32+
test -s output/test3/sample2/TESTX_S1_L002.preprocessed.bai || { echo "Missing test 3 output file!"; exit 1; }
33+
test -s output/test4/sample1/TESTX_S1_L001.preprocessed.bam || { echo "Missing test 4 output file!"; exit 1; }
34+
test -s output/test4/sample1/TESTX_S1_L001.preprocessed.bai || { echo "Missing test 4 output file!"; exit 1; }
35+
test -s output/test4/sample2/TESTX_S1_L002.preprocessed.bam || { echo "Missing test 4 output file!"; exit 1; }
36+
test -s output/test4/sample2/TESTX_S1_L002.preprocessed.bai || { echo "Missing test 4 output file!"; exit 1; }
37+
test -s output/test5/sample1/TESTX_S1_L001.preprocessed.bam || { echo "Missing test 5 output file!"; exit 1; }
38+
test -s output/test5/sample1/TESTX_S1_L001.preprocessed.bai || { echo "Missing test 5 output file!"; exit 1; }
39+
test -s output/test5/sample2/TESTX_S1_L002.preprocessed.bam || { echo "Missing test 5 output file!"; exit 1; }
40+
test -s output/test5/sample2/TESTX_S1_L002.preprocessed.bai || { echo "Missing test 5 output file!"; exit 1; }
41+
test -s output/test6/sample1/TESTX_S1_L001.preprocessed.bam || { echo "Missing test 6 output file!"; exit 1; }
42+
test -s output/test6/sample1/TESTX_S1_L001.preprocessed.bai || { echo "Missing test 6 output file!"; exit 1; }
43+
test -s output/test6/sample2/TESTX_S1_L002.preprocessed.bam || { echo "Missing test 6 output file!"; exit 1; }
44+
test -s output/test6/sample2/TESTX_S1_L002.preprocessed.bai || { echo "Missing test 6 output file!"; exit 1; }
45+
test -s output/test7/sample1/TESTX_S1_L001.preprocessed.bam || { echo "Missing test 7 output file!"; exit 1; }
46+
test -s output/test7/sample1/TESTX_S1_L001.preprocessed.bai || { echo "Missing test 7 output file!"; exit 1; }
47+
test -s output/test7/sample2/TESTX_S1_L002.preprocessed.bam || { echo "Missing test 7 output file!"; exit 1; }
48+
test -s output/test7/sample2/TESTX_S1_L002.preprocessed.bai || { echo "Missing test 7 output file!"; exit 1; }
49+
test -s output/test8/sample1/TESTX_S1_L001.preprocessed.bam || { echo "Missing test 8 output file!"; exit 1; }
50+
test -s output/test8/sample1/TESTX_S1_L001.preprocessed.bai || { echo "Missing test 8 output file!"; exit 1; }
51+
test -s output/test8/sample2/TESTX_S1_L002.preprocessed.bam || { echo "Missing test 8 output file!"; exit 1; }
52+
test -s output/test8/sample2/TESTX_S1_L002.preprocessed.bai || { echo "Missing test 8 output file!"; exit 1; }
53+
test -s output/test9/TESTX_S1_L001/TESTX_S1_L001.preprocessed.bam || { echo "Missing test 9 output file!"; exit 1; }
54+
test -s output/test9/TESTX_S1_L001/TESTX_S1_L001.preprocessed.bai || { echo "Missing test 9 output file!"; exit 1; }

README.md

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,8 @@ Usage:
5454
main.nf --input_files input_files
5555
5656
Input:
57-
* --input_files: the path to a tab-separated values file containing in each row the sample name, sample type (eg: tumor or normal) and path to the BAM file
57+
* --input_bam: the path to a single BAM (this option is not compatible with --input_files)
58+
* --input_files: the path to a tab-separated values file containing in each row the sample name, sample type (eg: tumor or normal) and path to the BAM file (this option is not compatible with --input_bam)
5859
Sample type will be added to the BAM header @SN sample name
5960
The input file does not have header!
6061
Example input file:
@@ -64,6 +65,7 @@ Input:
6465
* --reference: path to the FASTA genome reference (indexes expected *.fai, *.dict)
6566
6667
Optional input:
68+
* --input_name: the name of the sample. Only used when --input_bam is provided (default: normal)
6769
* --dbsnp: path to the dbSNP VCF (required to perform BQSR)
6870
* --known_indels1: path to a VCF of known indels (optional to perform realignment around indels)
6971
* --known_indels2: path to a second VCF of known indels (optional to perform realignment around indels)
@@ -86,7 +88,7 @@ Computational resources:
8688
* --mark_duplicates_cpus: (default: 16)
8789
* --mark_duplicates_memory: (default: 64g)
8890
* --realignment_around_indels_cpus: (default: 2)
89-
* --realignment_around_indels_memory: (default: 32g)
91+
* --realignment_around_indels_memory: (default: 31g)
9092
* --bqsr_cpus: (default: 3)
9193
* --bqsr_memory: (default: 4g)
9294
* --metrics_cpus: (default: 1)

main.nf

Lines changed: 14 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,8 @@
33
publish_dir = 'output'
44
params.help= false
55
params.input_files = false
6+
params.input_name = "normal"
7+
params.input_bam = false
68
params.reference = false
79
params.dbsnp = false
810
params.known_indels1 = false
@@ -59,15 +61,23 @@ if (params.output) {
5961
publish_dir = params.output
6062
}
6163

62-
// checks required inputs
63-
if (params.input_files) {
64+
if (! params.input_files && ! params.input_bam) {
65+
exit 1, "Neither --input_files or --input_bam are provided!"
66+
}
67+
else if (params.input_files && params.input_bam) {
68+
exit 1, "Both --input_files and --input_bam are provided! Please, provide only one."
69+
}
70+
else if (params.input_files) {
6471
Channel
6572
.fromPath(params.input_files)
6673
.splitCsv(header: ['name', 'type', 'bam'], sep: "\t")
6774
.map{ row-> tuple(row.name, row.type, file(row.bam)) }
6875
.set { input_files }
69-
} else {
70-
exit 1, "Input file not specified!"
76+
} else if (params.input_bam && params.input_name) {
77+
input_bam = file(params.input_bam)
78+
Channel
79+
.fromList([tuple(input_bam.name.take(input_bam.name.lastIndexOf('.')), params.input_name, input_bam)])
80+
.set { input_files }
7181
}
7282

7383
/*

nextflow.config

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ process.shell = ['/bin/bash', '-euo', 'pipefail']
4646

4747
cleanup = true
4848

49-
VERSION = '1.4.1'
49+
VERSION = '1.5.0'
5050
DOI = 'https://zenodo.org/badge/latestdoi/358400957'
5151

5252
manifest {
@@ -67,7 +67,8 @@ Usage:
6767
main.nf --input_files input_files
6868
6969
Input:
70-
* --input_files: the path to a tab-separated values file containing in each row the sample name, sample type (eg: tumor or normal) and path to the BAM file
70+
* --input_bam: the path to a single BAM (this option is not compatible with --input_files)
71+
* --input_files: the path to a tab-separated values file containing in each row the sample name, sample type (eg: tumor or normal) and path to the BAM file (this option is not compatible with --input_bam)
7172
Sample type will be added to the BAM header @SN sample name
7273
The input file does not have header!
7374
Example input file:
@@ -77,6 +78,7 @@ Input:
7778
* --reference: path to the FASTA genome reference (indexes expected *.fai, *.dict)
7879
7980
Optional input:
81+
* --input_name: the name of the sample. Only used when --input_bam is provided (default: normal)
8082
* --dbsnp: path to the dbSNP VCF (required to perform BQSR)
8183
* --known_indels1: path to a VCF of known indels (optional to perform realignment around indels)
8284
* --known_indels2: path to a second VCF of known indels (optional to perform realignment around indels)
@@ -99,7 +101,7 @@ Computational resources:
99101
* --mark_duplicates_cpus: (default: 16)
100102
* --mark_duplicates_memory: (default: 64g)
101103
* --realignment_around_indels_cpus: (default: 2)
102-
* --realignment_around_indels_memory: (default: 32g)
104+
* --realignment_around_indels_memory: (default: 31g)
103105
* --bqsr_cpus: (default: 3)
104106
* --bqsr_memory: (default: 4g)
105107
* --metrics_cpus: (default: 1)

0 commit comments

Comments
 (0)