Skip to content

Commit 509f87b

Browse files
committed
Correct sorting of files
1 parent 15f9155 commit 509f87b

File tree

1 file changed

+8
-3
lines changed

1 file changed

+8
-3
lines changed

main.nf

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -203,10 +203,14 @@ process mask_beds {
203203

204204

205205
// To make intersect files we need to combine them into one channel with
206-
// toSortedList() (fermi is before manta in alphabet).
206+
// toList() and then sort in the map so that fermi is before manta in the
207+
// channel. We can't use toSortedList here since the full pathname is used
208+
// which includes the work directory (`3a/7c63f4...`).
207209
masked_vcfs.tap { masked_vcfs }
208210
.filter( ~/.*(manta|fermikit).*/ )
209-
.toSortedList().set { intersect_input }
211+
.toList()
212+
.map { n -> n[0] =~ /fermikit/ ? n : [n[1], n[0]] }
213+
.set { intersect_input }
210214

211215
process intersect_files {
212216
input:
@@ -238,7 +242,8 @@ process intersect_files {
238242
| cut -f 1-8 \
239243
| sort -k1,1V -k2,2n > combined_masked_OTHER.vcf
240244
241-
sort -k1,1V -k2,2n combined_masked_*.vcf >> combined_masked.vcf
245+
( grep '^#' $fermi_vcf; \
246+
sort -k1,1V -k2,2n combined_masked_*.vcf ) >> combined_masked.vcf
242247
"""
243248
}
244249

0 commit comments

Comments
 (0)