Skip to content
50 changes: 50 additions & 0 deletions library/tasks/FastQC.wdl
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
task FastQC {
Array[File] fastq_files
File? limits_file
Int startRead = 250000
Int nRead = 250000
String docker = "quay.io/biocontainers/fastqc:0.11.8--1"
Int machine_mem_mb = 3850
Int disk = 100
Int preemptible = 3

String dollar = "$"
parameter_meta {
fastq_files: "input fastq files"
limits_file: "(optional) limits file to use with fastqc"
startRead: "(optional) start fastqc at the nth read of the file"
nRead: "(optional) use (at most) n reads for fastqc"
docker: "(optional) the docker image containing the runtime environment for this task"
disk: "(optional) the amount of disk space (GiB) to provision for this task"
preemptible: "(optional) if non-zero, request a pre-emptible instance and allow for this number of preemptions before running the task on a non preemptible machine"
machine_mem_mb: "(optional) the amount of memory (MiB) to provision for this task"

}

command <<<
set -e

mkdir outputs
declare -a fastqs=()
for fastq in ${sep=' ' fastq_files}
do
outname=`basename ${dollar}fastq .fastq.gz`_skip${startRead}_read${nRead}.fastq
zcat ${dollar}fastq | head -n ${4*(startRead + nRead)} | tail -n ${4*nRead} > ${dollar}outname
fastqs+=(${dollar}outname)
done

fastqc ${dollar}{fastqs[@]} -o outputs ${"--limits " + limits_file}
>>>

runtime {
docker: docker
memory: "${machine_mem_mb} MiB"
disks: "local-disk ${disk} HDD"
preemptible: preemptible
}

output {
Array[File] fastqc_htmls = glob("outputs/*.html")
Array[File] fastqc_zips = glob("outputs/*.zip")
}
}
19 changes: 19 additions & 0 deletions pipelines/optimus/Optimus.wdl
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ import "RunEmptyDrops.wdl" as RunEmptyDrops
import "ZarrUtils.wdl" as ZarrUtils
import "Picard.wdl" as Picard
import "UmiCorrection.wdl" as UmiCorrection
import "FastQC.wdl" as FastQC

workflow Optimus {
meta {
Expand All @@ -25,6 +26,9 @@ workflow Optimus {
Array[File]? i1_fastq
String sample_id

# fastqc input
File? fastqc_limits

# organism reference parameters
File tar_star_reference
File annotations_gtf
Expand All @@ -51,6 +55,7 @@ workflow Optimus {
r2_fastq: "reverse read, contains cDNA fragment generated from captured mRNA"
i1_fastq: "(optional) index read, for demultiplexing of multiple samples on one flow cell."
sample_id: "name of sample matching this file, inserted into read group header"
fastqc_limits: "(optional) limits file for fastqc"
tar_star_reference: "star genome reference"
annotations_gtf: "gtf containing annotations for gene tagging (must match star reference)"
ref_genome_fasta: "genome fasta file (must match star reference)"
Expand All @@ -77,6 +82,13 @@ workflow Optimus {
r2_unmapped_bam = FastqToUBam.bam_output,
whitelist = whitelist
}

call FastQC.FastQC as FastQC {
input:
fastq_files = [r1_fastq[index], r2_fastq[index], non_optional_i1_fastq[index]],
limits_file = fastqc_limits,
disk = ceil((size(r1_fastq[index], "GiB") + size(r2_fastq[index], "GiB") + size(non_optional_i1_fastq[index], "GiB")) * 1.2 + 10)
}
}

# if the index is not passed, proceed without it.
Expand All @@ -87,6 +99,13 @@ workflow Optimus {
r2_unmapped_bam = FastqToUBam.bam_output,
whitelist = whitelist
}

call FastQC.FastQC as FastQCNoIndex {
input:
fastq_files = [r1_fastq[index], r2_fastq[index]],
limits_file = fastqc_limits,
disk = ceil((size(r1_fastq[index], "GiB") + size(r2_fastq[index], "GiB")) * 1.2 + 10)
}
}

File barcoded_bam = select_first([AttachBarcodes.bam_output, AttachBarcodesNoIndex.bam_output])
Expand Down
11 changes: 11 additions & 0 deletions pipelines/smartseq2_single_sample/SmartSeq2SingleSample.wdl
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ import "Picard.wdl" as Picard
import "RSEM.wdl" as RSEM
import "GroupMetricsOutputs.wdl" as GroupQCs
import "ZarrUtils.wdl" as ZarrUtils
import "FastQC.wdl" as FastQC

workflow SmartSeq2SingleCell {
meta {
Expand All @@ -28,6 +29,8 @@ workflow SmartSeq2SingleCell {
String output_name
File fastq1
File fastq2
# fastqc
File? fastqc_limits
Int max_retries = 0

# whether to convert the outputs to Zarr format, by default it's set to true
Expand All @@ -48,12 +51,20 @@ workflow SmartSeq2SingleCell {
output_name: "Output name, can include path"
fastq1: "R1 in paired end reads"
fastq2: "R2 in paired end reads"
fastqc_limits: "(optional) limits file for fastqc"
max_retries: "(optional) retry this number of times if task fails -- use with caution, see skylab README for details"
output_zarr: "whether to run the taks that converts the outputs to Zarr format, by default it's true"
}

String quality_control_output_basename = output_name + "_qc"

call FastQC.FastQC {
input:
fastq_files = [fastq1, fastq2],
limits_file = fastqc_limits,
disk = ceil((size(fastq1, "GiB") + size(fastq2, "GiB")) * 1.2 + 10)
}

call HISAT2.HISAT2PairedEnd {
input:
hisat2_ref = hisat2_ref_index,
Expand Down
3 changes: 2 additions & 1 deletion test/optimus/pr/dependencies.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,5 +14,6 @@
"RunEmptyDrops.wdl": "library/tasks/RunEmptyDrops.wdl",
"ZarrUtils.wdl": "library/tasks/ZarrUtils.wdl",
"Picard.wdl": "library/tasks/Picard.wdl",
"UmiCorrection.wdl": "library/tasks/UmiCorrection.wdl"
"UmiCorrection.wdl": "library/tasks/UmiCorrection.wdl",
"FastQC.wdl": "library/tasks/FastQC.wdl"
}
3 changes: 2 additions & 1 deletion test/optimus/scientific/dependencies.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,5 +12,6 @@
"SequenceDataWithMoleculeTagMetrics.wdl": "library/tasks/SequenceDataWithMoleculeTagMetrics.wdl",
"TagSortBam.wdl": "library/tasks/TagSortBam.wdl",
"Picard.wdl": "library/tasks/Picard.wdl",
"UmiCorrection.wdl": "library/tasks/UmiCorrection.wdl"
"UmiCorrection.wdl": "library/tasks/UmiCorrection.wdl",
"FastQC.wdl": "library/tasks/FastQC.wdl"
}
3 changes: 2 additions & 1 deletion test/smartseq2_single_sample/pr/dependencies.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,5 +5,6 @@
"Picard.wdl": "library/tasks/Picard.wdl",
"RSEM.wdl": "library/tasks/RSEM.wdl",
"GroupMetricsOutputs.wdl": "library/tasks/GroupMetricsOutputs.wdl",
"ZarrUtils.wdl": "library/tasks/ZarrUtils.wdl"
"ZarrUtils.wdl": "library/tasks/ZarrUtils.wdl",
"FastQC.wdl": "library/tasks/FastQC.wdl"
}