-
Notifications
You must be signed in to change notification settings - Fork 18
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
add lane concatenation to theiaproks
- Loading branch information
1 parent
b8d7d96
commit ad0b3d9
Showing
5 changed files
with
175 additions
and
13 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,69 @@ | ||
version 1.0 | ||
|
||
task cat_lanes { | ||
input { | ||
String samplename | ||
|
||
File read1_lane1 | ||
File read1_lane2 | ||
File? read1_lane3 | ||
File? read1_lane4 | ||
|
||
File? read2_lane1 | ||
File? read2_lane2 | ||
File? read2_lane3 | ||
File? read2_lane4 | ||
|
||
Int cpu = 2 | ||
Int disk_size = 50 | ||
String docker = "us-docker.pkg.dev/general-theiagen/theiagen/utility:1.2" | ||
Int memory = 4 | ||
} | ||
meta { | ||
volatile: true | ||
} | ||
command <<< | ||
# exit task if anything throws an error (important for proper gzip format) | ||
set -euo pipefail | ||
|
||
# move reads into single directory | ||
mkdir -v reads | ||
mv -v ~{read1_lane1} \ | ||
~{read2_lane1} \ | ||
~{read1_lane2} \ | ||
~{read2_lane2} \ | ||
~{read1_lane3} \ | ||
~{read2_lane3} \ | ||
~{read1_lane4} \ | ||
~{read2_lane4} \ | ||
reads/ | ||
|
||
# check for valid gzipped format (this task assumes FASTQ files are gzipped - they should be coming from ILMN instruments) | ||
gzip -t reads/*.gz | ||
|
||
# run concatenate script and send STDOUT/ERR to STDOUT | ||
# reminder: script will skip over samples that only have R1 file present | ||
# reminder: script REQUIRES standard illumina file endings like: _L001_R1_001.fastq.gz and _L002_R2_001.fastq.gz | ||
# see script here: https://github.com/theiagen/utilities/blob/main/scripts/concatenate-across-lanes.sh | ||
concatenate-across-lanes.sh reads/ | ||
|
||
# ensure newly merged FASTQs are valid gzipped format | ||
gzip -t reads/*merged*.gz | ||
|
||
# determine output filenames for outputs | ||
mv -v reads/*_merged_R1.fastq.gz reads/~{samplename}_merged_R1.fastq.gz | ||
mv -v reads/*_merged_R2.fastq.gz reads/~{samplename}_merged_R2.fastq.gz | ||
>>> | ||
output { | ||
File read1_concatenated = "reads/~{samplename}_merged_R1.fastq.gz" | ||
File? read2_concatenated = "reads/~{samplename}_merged_R2.fastq.gz" | ||
} | ||
runtime { | ||
docker: "~{docker}" | ||
memory: memory + " GB" | ||
cpu: cpu | ||
disks: "local-disk " + disk_size + " HDD" | ||
disk: disk_size + " GB" | ||
preemptible: 1 | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
42 changes: 42 additions & 0 deletions
42
workflows/utilities/file_handling/wf_concatenate_illumina_lanes.wdl
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
version 1.0 | ||
|
||
import "../../../tasks/utilities/file_handling/task_cat_lanes.wdl" as concatenate_lanes | ||
import "../../../tasks/task_versioning.wdl" as versioning | ||
|
||
workflow concatenate_illumina_lanes { | ||
input { | ||
String samplename | ||
|
||
File read1_lane1 | ||
File read1_lane2 | ||
File? read1_lane3 | ||
File? read1_lane4 | ||
|
||
File? read2_lane1 | ||
File? read2_lane2 | ||
File? read2_lane3 | ||
File? read2_lane4 | ||
} | ||
call concatenate_lanes.cat_lanes { | ||
input: | ||
samplename = samplename, | ||
read1_lane1 = read1_lane1, | ||
read2_lane1 = read2_lane1, | ||
read1_lane2 = read1_lane2, | ||
read2_lane2 = read2_lane2, | ||
read1_lane3 = read1_lane3, | ||
read2_lane3 = read2_lane3, | ||
read1_lane4 = read1_lane4, | ||
read2_lane4 = read2_lane4 | ||
} | ||
call versioning.version_capture { | ||
input: | ||
} | ||
output { | ||
String concatenate_illumina_lanes_version = version_capture.phb_version | ||
String concatenate_illumina_lanes_analysis_date = version_capture.date | ||
|
||
File read1_concatenated = cat_lanes.read1_concatenated | ||
File? read2_concatenated = cat_lanes.read2_concatenated | ||
} | ||
} |