"disable_adapter_trimming": "0", | "disable_adapter_trimming": "0", | ||||
"length_required": "50", | "length_required": "50", | ||||
"length_required1": "20", | "length_required1": "20", | ||||
"UMI": "0", | |||||
"umi_len": "0", | "umi_len": "0", | ||||
"umi_loc": "umi_loc", | "umi_loc": "umi_loc", | ||||
"qualified_quality_phred": "20", | "qualified_quality_phred": "20", | ||||
"disable_quality_filtering": "1", | |||||
"hisat2_docker": "registry.cn-shanghai.aliyuncs.com/pgx-docker-registry/hisat2:v2.1.0-2", | "hisat2_docker": "registry.cn-shanghai.aliyuncs.com/pgx-docker-registry/hisat2:v2.1.0-2", | ||||
"hisat2_cluster": "OnDemand bcs.a2.3xlarge img-ubuntu-vpc", | "hisat2_cluster": "OnDemand bcs.a2.3xlarge img-ubuntu-vpc", | ||||
"samtools_docker": "registry.cn-shanghai.aliyuncs.com/pgx-docker-registry/samtools:v1.3.1", | "samtools_docker": "registry.cn-shanghai.aliyuncs.com/pgx-docker-registry/samtools:v1.3.1", |
"{{ project_name }}.count_docker": "{{ count_docker }}", | "{{ project_name }}.count_docker": "{{ count_docker }}", | ||||
"{{ project_name }}.count_cluster": "{{ count_cluster }}", | "{{ project_name }}.count_cluster": "{{ count_cluster }}", | ||||
"{{ project_name }}.count_length": "{{ count_length }}", | "{{ project_name }}.count_length": "{{ count_length }}", | ||||
"{{ project_name }}.fastp_run": "{{ fastp_run }}", | |||||
"{{ project_name }}.trim_adapter": "{{ trim_adapter }}", | |||||
"{{ project_name }}.pre_alignment_qc": "{{ pre_alignment_qc }}", | "{{ project_name }}.pre_alignment_qc": "{{ pre_alignment_qc }}", | ||||
"{{ project_name }}.qualimap_qc": "{{ qualimap_qc }}" | "{{ project_name }}.qualimap_qc": "{{ qualimap_qc }}" | ||||
} | } |
String cluster | String cluster | ||||
String disk_size | String disk_size | ||||
String umi_loc | String umi_loc | ||||
String trim_adapter | |||||
Int trim_front1 | Int trim_front1 | ||||
Int trim_tail1 | Int trim_tail1 | ||||
Int max_len1 | Int max_len1 | ||||
Int trim_front2 | Int trim_front2 | ||||
Int trim_tail2 | Int trim_tail2 | ||||
Int max_len2 | Int max_len2 | ||||
Int disable_adapter_trimming | |||||
Int length_required | Int length_required | ||||
Int umi_len | Int umi_len | ||||
Int UMI | |||||
Int qualified_quality_phred | Int qualified_quality_phred | ||||
Int length_required1 | Int length_required1 | ||||
Int disable_quality_filtering | |||||
command <<< | command <<< | ||||
nt=$(nproc) | nt=$(nproc) | ||||
mkdir -p /cromwell_root/tmp/fastp/ | |||||
## 1.Disable_quality_filtering | |||||
if [ "${disable_quality_filtering}" == 0 ] | |||||
then | |||||
cp ${read1} /cromwell_root/tmp/fastp/{sample_id}_R1.fastq.tmp1.gz | |||||
cp ${read2} /cromwell_root/tmp/fastp/{sample_id}_R2.fastq.tmp1.gz | |||||
else | |||||
fastp --thread $nt --trim_front1 ${trim_front1} --trim_tail1 ${trim_tail1} --max_len1 ${max_len1} --trim_front2 ${trim_front2} --trim_tail2 ${trim_tail2} --max_len2 ${max_len2} -i ${read1} -I ${read2} -o /cromwell_root/tmp/fastp/${sample_id}_R1.fastq.tmp1.gz -O /cromwell_root/tmp/fastp/${sample_id}_R2.fastq.tmp1.gz -j ${sample_id}.json -h ${sample_id}.html | |||||
fi | |||||
## 2.UMI | |||||
if [ "${UMI}" == 0 ] | |||||
then | |||||
cp /cromwell_root/tmp/fastp/${sample_id}_R1.fastq.tmp1.gz /cromwell_root/tmp/fastp/${sample_id}_R1.fastq.tmp2.gz | |||||
cp /cromwell_root/tmp/fastp/${sample_id}_R2.fastq.tmp1.gz /cromwell_root/tmp/fastp/${sample_id}_R2.fastq.tmp2.gz | |||||
else | |||||
fastp --thread $nt -U --umi_loc=${umi_loc} --umi_len=${umi_len} --trim_front1 ${trim_front1} --trim_tail1 ${trim_tail1} --max_len1 ${max_len1} --trim_front2 ${trim_front2} --trim_tail2 ${trim_tail2} --max_len2 ${max_len2} -i /cromwell_root/tmp/fastp/${sample_id}_R1.fastq.tmp1.gz -I /cromwell_root/tmp/fastp/${sample_id}_R2.fastq.tmp1.gz -o /cromwell_root/tmp/fastp/${sample_id}_R1.fastq.tmp2.gz -O /cromwell_root/tmp/fastp/${sample_id}_R2.fastq.tmp2.gz -j ${sample_id}.json -h ${sample_id}.html | |||||
fi | |||||
## 3.Trim | |||||
if [ "${disable_adapter_trimming}" == 0 ] | |||||
then | |||||
fastp --thread $nt -l ${length_required} -q ${qualified_quality_phred} -u ${length_required1} --adapter_sequence ${adapter_sequence} --adapter_sequence_r2 ${adapter_sequence_r2} --detect_adapter_for_pe --trim_front1 ${trim_front1} --trim_tail1 ${trim_tail1} --max_len1 ${max_len1} --trim_front2 ${trim_front2} --trim_tail2 ${trim_tail2} --max_len2 ${max_len2} -i /cromwell_root/tmp/fastp/${sample_id}_R1.fastq.tmp2.gz -I /cromwell_root/tmp/fastp/${sample_id}_R2.fastq.tmp2.gz -o ${sample_id}_R1.fastq.gz -O ${sample_id}_R2.fastq.gz -j ${sample_id}.json -h ${sample_id}.html | |||||
## Trim | |||||
if [ "${trim_adapter}" != 'true' ]; then | |||||
cp ${read1} ${sample_id}_R1.fq.gz | |||||
cp ${read2} ${sample_id}_R2.fq.gz | |||||
else | else | ||||
cp /cromwell_root/tmp/fastp/${sample_id}_R1.fastq.tmp2.gz ${sample_id}_R1.fastq.gz | |||||
cp /cromwell_root/tmp/fastp/${sample_id}_R2.fastq.tmp2.gz ${sample_id}_R2.fastq.gz | |||||
fastp --thread $nt -l ${length_required} -q ${qualified_quality_phred} -u ${length_required1} --adapter_sequence ${adapter_sequence} --adapter_sequence_r2 ${adapter_sequence_r2} --detect_adapter_for_pe --trim_front1 ${trim_front1} --trim_tail1 ${trim_tail1} --max_len1 ${max_len1} --trim_front2 ${trim_front2} --trim_tail2 ${trim_tail2} --max_len2 ${max_len2} -i ${read1} -I ${read2} -o ${sample_id}_R1.fq.gz -O ${sample_id}_R2.fq.gz -j ${sample_id}.json -h ${sample_id}.html | |||||
fi | fi | ||||
>>> | >>> | ||||
output { | output { | ||||
File json = "${sample_id}.json" | File json = "${sample_id}.json" | ||||
File report = "${sample_id}.html" | File report = "${sample_id}.html" | ||||
File Trim_R1 = "${sample_id}_R1.fastq.gz" | |||||
File Trim_R2 = "${sample_id}_R2.fastq.gz" | |||||
File trim_R1 = "${sample_id}_R1.fq.gz" | |||||
File trim_R2 = "${sample_id}_R2.fq.gz" | |||||
} | } | ||||
} | } |
task hisat2_fp { | |||||
File idx | |||||
File read_1P | |||||
File read_2P | |||||
String idx_prefix | |||||
String sample_id | |||||
String docker | |||||
String cluster | |||||
String disk_size | |||||
command { | |||||
nt=$(nproc) | |||||
hisat2 -t -p $nt -x ${idx}/${idx_prefix} -1 ${read_1P} -2 ${read_2P} -S ${sample_id}.sam --un-conc-gz ${sample_id}_un.fq.gz | |||||
} | |||||
runtime { | |||||
docker: docker | |||||
cluster: cluster | |||||
systemDisk: "cloud_ssd 40" | |||||
dataDisk: "cloud_ssd " + disk_size + " /cromwell_root/" | |||||
} | |||||
output { | |||||
File sam=sample_id + ".sam" | |||||
File unmapread_1p=sample_id + "_un.fq.1.gz" | |||||
File unmapread_2p=sample_id + "_un.fq.2.gz" | |||||
} | |||||
} |
Int disable_adapter_trimming | Int disable_adapter_trimming | ||||
Int length_required | Int length_required | ||||
Int umi_len | Int umi_len | ||||
Int UMI | |||||
Int qualified_quality_phred | Int qualified_quality_phred | ||||
Int length_required1 | Int length_required1 | ||||
Int disable_quality_filtering | |||||
Int insert_size | Int insert_size | ||||
Boolean pre_alignment_qc | Boolean pre_alignment_qc | ||||
Boolean qualimap_qc | Boolean qualimap_qc | ||||
Boolean fastp_run | |||||
Boolean trim_adapter | |||||
if (pre_alignment_qc) { | if (pre_alignment_qc) { | ||||
call fastqc.fastqc as fastqc { | call fastqc.fastqc as fastqc { | ||||
disk_size=disk_size | disk_size=disk_size | ||||
} | } | ||||
} | } | ||||
if (fastp_run){ | |||||
call fastp.fastp as fastp { | |||||
input: | |||||
sample_id=sample_id, | |||||
read1=read1, | |||||
read2=read2, | |||||
docker=fastp_docker, | |||||
cluster=fastp_cluster, | |||||
disk_size=disk_size, | |||||
adapter_sequence=adapter_sequence, | |||||
adapter_sequence_r2=adapter_sequence_r2, | |||||
umi_loc=umi_loc, | |||||
trim_front1=trim_front1, | |||||
trim_tail1=trim_tail1, | |||||
max_len1=max_len1, | |||||
trim_front2=trim_front2, | |||||
trim_tail2=trim_tail2, | |||||
max_len2=max_len2, | |||||
disable_adapter_trimming=disable_adapter_trimming, | |||||
length_required=length_required, | |||||
umi_len=umi_len, | |||||
UMI=UMI, | |||||
qualified_quality_phred=qualified_quality_phred, | |||||
length_required1=length_required1, | |||||
disable_quality_filtering=disable_quality_filtering | |||||
} | |||||
call hisat2_fp.hisat2_fp as hisat2_fp { | |||||
input: | |||||
sample_id=sample_id, | |||||
idx=idx, | |||||
idx_prefix=idx_prefix, | |||||
read_1P=fastp.Trim_R1, | |||||
read_2P=fastp.Trim_R2, | |||||
docker=hisat2_docker, | |||||
cluster=hisat2_cluster, | |||||
disk_size=disk_size | |||||
} | |||||
} | |||||
if (!fastp_run){ | |||||
call hisat2.hisat2 as hisat2 { | |||||
input: | |||||
sample_id=sample_id, | |||||
docker=hisat2_docker, | |||||
cluster=hisat2_cluster, | |||||
idx=idx, | |||||
idx_prefix=idx_prefix, | |||||
read_1P=read1, | |||||
read_2P=read2, | |||||
disk_size=disk_size | |||||
} | |||||
} | |||||
call fastp.fastp as fastp { | |||||
input: | |||||
sample_id=sample_id, | |||||
read1=read1, | |||||
read2=read2, | |||||
docker=fastp_docker, | |||||
cluster=fastp_cluster, | |||||
disk_size=disk_size, | |||||
adapter_sequence=adapter_sequence, | |||||
adapter_sequence_r2=adapter_sequence_r2, | |||||
umi_loc=umi_loc, | |||||
trim_front1=trim_front1, | |||||
trim_tail1=trim_tail1, | |||||
max_len1=max_len1, | |||||
trim_front2=trim_front2, | |||||
trim_tail2=trim_tail2, | |||||
max_len2=max_len2, | |||||
disable_adapter_trimming=disable_adapter_trimming, | |||||
length_required=length_required, | |||||
umi_len=umi_len, | |||||
qualified_quality_phred=qualified_quality_phred, | |||||
length_required1=length_required1 | |||||
trim_adapter=trim_adapter | |||||
} | |||||
call hisat2.hisat2 as hisat2 { | |||||
input: | |||||
sample_id=sample_id, | |||||
docker=hisat2_docker, | |||||
cluster=hisat2_cluster, | |||||
idx=idx, | |||||
idx_prefix=idx_prefix, | |||||
read_1P=fastp.trim_R1, | |||||
read_2P=fastp.trim_R2, | |||||
disk_size=disk_size | |||||
} | |||||
} | |||||
call samtools.samtools as samtools { | call samtools.samtools as samtools { | ||||
input: | input: |