Skip to content

Commit

Permalink
Merge pull request #65 from HumanCellAtlas/ajc-fix-hisat2-naming
Browse files Browse the repository at this point in the history
Update hisat2 to work with blue box naming conventions
  • Loading branch information
ambrosejcarr authored Jan 5, 2018
2 parents f68ab35 + 8f0de8d commit 55feb62
Showing 1 changed file with 43 additions and 8 deletions.
51 changes: 43 additions & 8 deletions pipelines/tasks/hisat2.wdl
Original file line number Diff line number Diff line change
Expand Up @@ -4,19 +4,38 @@
## -k --secondary to output multiple mapping reads. --keep 10 will output up to 10 multiple mapping reads, which is default in HISAT2
task HISAT2PE {
File hisat2_ref
File fq1
File fq2
File fq1 # gz forward fastq file
File fq2 # gz reverse fastq file
String ref_name
String output_name
String sample_name
Int disk_size
command {
# Note that files MUST be gzipped or the module will not function properly
# This will be addressed in the future either by a change in how Hisat2 functions or a more
# robust test for compression type.

set -e
tar -zxvf "${hisat2_ref}"

# fix names if necessary.
if [ "${fq1}" != *.fastq.gz ]; then
FQ1=${fq1}.fastq.gz
mv ${fq1} ${fq1}.fastq.gz
else
FQ1=${fq1}
fi
if [ "${fq2}" != *.fastq.gz ]; then
FQ2=${fq2}.fastq.gz
mv ${fq2} ${fq2}.fastq.gz
else
FQ2=${fq2}
fi

tar -zxvf "${hisat2_ref}"
hisat2 -t \
-x ${ref_name}/${ref_name} \
-1 ${fq1} \
-2 ${fq2} \
-1 $FQ1 \
-2 $FQ2 \
--rg-id=${sample_name} --rg SM:${sample_name} --rg LB:${sample_name} \
--rg PL:ILLUMINA --rg PU:${sample_name} \
--new-summary --summary-file ${output_name}.log \
Expand Down Expand Up @@ -58,11 +77,27 @@ task HISAT2rsem {
Int disk_size
command {
set -e
tar -zxvf "${hisat2_ref}"

# fix names if necessary.
if [ "${fq1}" != *.fastq.gz ]; then
FQ1=${fq1}.fastq.gz
mv ${fq1} ${fq1}.fastq.gz
else
FQ1=${fq1}
fi

if [ "${fq2}" != *.fastq.gz ]; then
FQ2=${fq2}.fastq.gz
mv ${fq2} ${fq2}.fastq.gz
else
FQ2=${fq2}
fi

tar -zxvf "${hisat2_ref}"
hisat2 -t \
-x ${ref_name}/${ref_name} \
-1 ${fq1} \
-2 ${fq2} \
-1 $FQ1 \
-2 $FQ2 \
--rg-id=${sample_name} --rg SM:${sample_name} --rg LB:${sample_name} \
--rg PL:ILLUMINA --rg PU:${sample_name} \
--new-summary --summary-file ${output_name}.log \
Expand Down

0 comments on commit 55feb62

Please sign in to comment.