Skip to content

Commit

Permalink
no output vcf if mpileup produces an empty file
Browse files Browse the repository at this point in the history
We manage the case when `samtools_mpileup` produces an empty file.
This appears when the coverage is null for all calling regions.
Before, in this case the pipeline crashed (no needed output `sample*.txt` from `pileup2table`).
  • Loading branch information
tdelhomme committed Apr 7, 2016
1 parent 0df7b4e commit e7da6fb
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions needlestack.nf
Original file line number Diff line number Diff line change
Expand Up @@ -244,7 +244,7 @@ process mpileup2table {
tag { region_tag }

input:
set val(region_tag), file("${region_tag}.pileup") from pileup
set val(region_tag), file("${region_tag}.pileup") from pileup.filter { tag, file -> !file.isEmpty() }
file bam
val sample_names

Expand Down Expand Up @@ -309,14 +309,18 @@ process R_regression {
//PDF.flatten().filter { it.size() == 0 }.subscribe { it.delete() }

// merge all vcf files in one big file
vcf_list = vcf.toList()
process collect_vcf_result {

publishDir params.out_folder, mode: 'move'

input:
val out_vcf
file '*.vcf' from vcf.toList()
file fasta_ref_fai
file '*.vcf' from vcf_list
file fasta_ref_fai

when:
vcf_list.val.size()>0

output:
file "$out_vcf" into big_vcf
Expand Down

1 comment on commit e7da6fb

@tdelhomme
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

fixes #99

Please sign in to comment.