Skip to content
Snippets Groups Projects
Verified Commit d5cf091f authored by Laurent Modolo's avatar Laurent Modolo
Browse files

src/nf_modules/hisat2/main.nf

parent a4e87410
No related branches found
No related tags found
No related merge requests found
#!/bin/sh #!/bin/sh
docker pull lbmc/hisat2:2.2.1 docker pull lbmc/hisat2:2.2.1
# docker build src/.docker_modules/hisat2/2.1.1 -t 'lbmc/hisat2:2.2.1' docker build src/.docker_modules/hisat2/2.2.1 -t 'lbmc/hisat2:2.2.1'
# docker push lbmc/hisat2:2.2.1 docker push lbmc/hisat2:2.2.1
docker buildx build --platform linux/amd64,linux/arm64 -t "lbmc/hisat2:2.2.1" --push src/.docker_modules/hisat2/2.2.1 docker buildx build --platform linux/amd64,linux/arm64 -t "lbmc/hisat2:2.2.1" --push src/.docker_modules/hisat2/2.2.1
version = "2.2.1" version = "2.2.1"
container_url = "lbmc/histat2:${version}" container_url = "lbmc/hisat2:${version}"
params.index_fasta = "" params.index_fasta = ""
params.index_fasta_out = "" params.index_fasta_out = ""
...@@ -20,12 +20,13 @@ process index_fasta { ...@@ -20,12 +20,13 @@ process index_fasta {
script: script:
""" """
gunzip ${fasta}
hisat2-build -p ${task.cpus} \ hisat2-build -p ${task.cpus} \
${fasta} \ ${fasta.baseName} \
${fasta.simpleName} &> \ ${fasta.simpleName} &> \
${fasta.simpleName}_hisat2_index_report.txt ${fasta.simpleName}_hisat2_index_report.txt
if grep -q "Error" ${fasta.simpleName}_bowtie2_index_report.txt; then if grep -q "Error" ${fasta.simpleName}_hisat2_index_report.txt; then
exit 1 exit 1
fi fi
""" """
...@@ -70,30 +71,34 @@ process mapping_fastq { ...@@ -70,30 +71,34 @@ process mapping_fastq {
if (reads.size() == 2) if (reads.size() == 2)
""" """
histat2 ${params.mapping_fastq} \ hisat2 ${params.mapping_fastq} \
-p ${task.cpus} \ -p ${task.cpus} \
-x ${index_id} \ -x ${index_id} \
-1 ${reads[0]} \ -1 ${reads[0]} \
-2 ${reads[1]} 2> \ -2 ${reads[1]} 2> \
${file_prefix}_ht2_mapping_report_tmp.txt \ ${file_prefix}_ht2_mapping_report_tmp.txt \
| samtools view -@ ${task.cpus} -bS - \ | samtools view -@ ${task.cpus} -bS - 2>> \
| samtools sort -@ ${task.cpus} -o ${file_prefix}.bam - ${file_prefix}_ht2_mapping_report_tmp.txt \
| samtools sort -@ ${task.cpus} -o ${file_prefix}.bam - 2>> \
${file_prefix}_ht2_mapping_report.txt
if grep -q "Error" ${file_prefix}_ht2_mapping_report_tmp.txt; then if grep -q "Error" ${file_prefix}_ht2_mapping_report.txt; then
exit 1 exit 1
fi fi
""" """
else else
""" """
histat2 ${params.mapping_fastq} \ hisat2 ${params.mapping_fastq} \
-p ${task.cpus} \ -p ${task.cpus} \
-x ${index_id} \ -x ${index_id} \
-U ${reads} 2> \ -U ${reads} 2> \
${file_prefix}_ht2_mapping_report_tmp.txt \ ${file_prefix}_ht2_mapping_report_tmp.txt \
| samtools view -@ ${task.cpus} -bS - \ | samtools view -@ ${task.cpus} -bS - 2>> \
| samtools sort -@ ${task.cpus} -o ${file_prefix}.bam - ${file_prefix}_ht2_mapping_report.txt \
| samtools sort -@ ${task.cpus} -o ${file_prefix}.bam - 2>> \
${file_prefix}_ht2_mapping_report.txt
if grep -q "Error" ${file_prefix}_ht2_mapping_report_tmp.txt; then if grep -q "Error" ${file_prefix}_ht2_mapping_report.txt; then
exit 1 exit 1
fi fi
""" """
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment