2929/* this block is auto-generated based on info from pkg.json where */
3030/* changes can be made if needed, do NOT modify this block manually */
3131nextflow. enable. dsl = 2
32- version = ' 0.2.5.1 '
32+ version = ' 0.3.0 '
3333
3434container = [
3535 ' ghcr.io' : ' ghcr.io/icgc-argo-workflows/icgc-argo-sv-copy-number.seqz-preprocess'
@@ -45,15 +45,18 @@ params.container = ""
4545
4646params. cpus = 1
4747params. mem = 1 // GB
48- params. publish_dir = " output_dir/ " // set to empty string will disable publishDir
48+ params. publish_dir = " " // set to empty string will disable publishDir
4949
5050
5151// tool specific parmas go here, add / change as needed
5252params. tumor_bam = " "
5353params. normal_bam = " "
5454params. fasta = " "
5555params. gcwiggle = " ${ baseDir} /resources/hg38.gc50Base.wig.gz"
56- params. output_pattern = " *bin50.seqz.gz" // output file name pattern
56+ params. chromosomes = [" chr1" , " chr2" , " chr3" , " chr4" , " chr5" , " chr6" , " chr7" , " chr8" , " chr9" , " chr10" , " chr11" , " chr12" , " chr13" , " chr14" , " chr15" , " chr16" , " chr17" , " chr18" , " chr19" , " chr20" , " chr21" , " chr22" , " chrX" , " chrY" ]
57+ params. output_pattern = " *.seqz.gz" // output file name pattern
58+
59+ include { getSecondaryFiles } from ' ./wfpr_modules/github.com/icgc-argo-workflows/data-processing-utility-tools/helper-functions@1.0.1.1/main.nf'
5760
5861process seqzPreprocess {
5962 container " ${ params.container ?: container[params.container_registry ?: default_container_registry]} :${ params.container_version ?: version} "
@@ -64,20 +67,49 @@ process seqzPreprocess {
6467
6568 input: // input, make update as needed
6669 path tumor_bam
70+ path tumour_bai
6771 path normal_bam
72+ path normal_bai
6873 path fasta
74+ path fasta_fai
6975 path gcwiggle
76+ each chrom
7077
7178 output: // output, make update as needed
72- path " ${ params.output_pattern} " , emit: seqz
79+ path " ${ params.output_pattern} " , emit: seqzperchromosome
80+
81+ shell:
82+ // add and initialize variables here as needed
83+ '''
84+ sequenza-utils bam2seqz --chromosome !{chrom} -n !{normal_bam} -t !{tumor_bam} --fasta !{fasta} -gc !{gcwiggle} -o "!{chrom}.seqz.gz"
85+ '''
86+
87+
88+ }
89+
90+ process seqzPreprocessMerge {
91+ container " ${ params.container ?: container[params.container_registry ?: default_container_registry]} :${ params.container_version ?: version} "
92+ publishDir " ${ params.publish_dir} /${ task.process.replaceAll(':', '_')} " , mode: " copy" , enabled: params. publish_dir
93+
94+ cpus params. cpus
95+ memory " ${ params.mem} GB"
96+
97+ input: // input, make update as needed
98+ file seqzperchromosome
99+
100+ output: // output, make update as needed
101+ path " sample_bin50.seqz.gz" , emit: seqz
102+
103+ shell:
104+ // add and initialize variables here as needed
105+ seqzfiles = params. chromosomes. join(' .seqz.gz ' )
106+ '''
107+ zcat !{seqzfiles}.seqz.gz | awk '{if (NR!=1 && $1 != "chromosome") {print $0}}' | bgzip > sample.seqz.gz
108+ tabix -f -s 1 -b 2 -e 2 -S 1 sample.seqz.gz
109+ sequenza-utils seqz_binning --seqz sample.seqz.gz --window 50 -o sample_bin50.seqz.gz
110+ '''
73111
74- script:
75- // add and initialize variables here as needed
76112
77- """
78- sequenza-utils bam2seqz --normal ${ normal_bam} --tumor ${ tumor_bam} --fasta ${ fasta} -gc ${ gcwiggle} --output sample.seqz.gz;
79- sequenza-utils seqz_binning --seqz sample.seqz.gz --window 50 -o sample_bin50.seqz.gz
80- """
81113}
82114
83115
@@ -86,8 +118,15 @@ process seqzPreprocess {
86118workflow {
87119 seqzPreprocess(
88120 file(params. tumor_bam),
121+ Channel . fromPath(getSecondaryFiles(params. tumor_bam,[' {b,cr}ai' ]), checkIfExists : true ). collect(),
89122 file(params. normal_bam),
123+ Channel . fromPath(getSecondaryFiles(params. normal_bam,[' {b,cr}ai' ]), checkIfExists : true ). collect(),
90124 file(params. fasta),
91- file(params. gcwiggle)
125+ Channel . fromPath(getSecondaryFiles(params. fasta,[' fai' ]), checkIfExists : true ). collect(),
126+ file(params. gcwiggle),
127+ params. chromosomes. flatten()
128+ )
129+ seqzPreprocessMerge(
130+ seqzPreprocess. out. seqzperchromosome. collect()
92131 )
93132}
0 commit comments