Skip to content

Commit

Permalink
Sort chunks in chunk_pe_fastq.wdl
Browse files Browse the repository at this point in the history
  • Loading branch information
martinaryee committed Mar 17, 2024
1 parent dc81959 commit 02213d0
Showing 1 changed file with 31 additions and 2 deletions.
33 changes: 31 additions & 2 deletions chunk_pe_fastq.wdl
Original file line number Diff line number Diff line change
Expand Up @@ -28,9 +28,17 @@ workflow chunk_pe_fastq {
}
}

call sort_chunks as sort_chunks1 { input:
chunks = flatten(chunk_fastq1.chunks)
}

call sort_chunks as sort_chunks2 { input:
chunks = flatten(chunk_fastq2.chunks)
}

output {
Array[File] fastq1_chunks = flatten(chunk_fastq1.chunks)
Array[File] fastq2_chunks = flatten(chunk_fastq2.chunks)
Array[File] fastq1_chunks = sort_chunks1.sorted_chunks
Array[File] fastq2_chunks = sort_chunks2.sorted_chunks
}
}

Expand Down Expand Up @@ -58,3 +66,24 @@ task chunk_fastq_file {
Array[File] chunks = glob("*.fastq.gz")
}
}

task sort_chunks {
input {
Array[String] chunks
}

command {
echo ${sep=" " chunks} | tr " " "\n" | sort
}

runtime {
continueOnReturnCode: false
docker: "ubuntu"
cpu: 1
}

output {
Array[String] sorted_chunks = read_lines(stdout())
}

}

0 comments on commit 02213d0

Please sign in to comment.