Skip to content

Commit 3811646

Browse files
authored
Merge pull request #9 from TRON-Bioinformatics/rna-support
RNA support through STAR two pass mode
2 parents 90e7fe7 + 4ba631e commit 3811646

File tree

11 files changed

+36
-12
lines changed

11 files changed

+36
-12
lines changed

.github/workflows/automated_tests.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,4 +19,5 @@ jobs:
1919
wget -qO- https://get.nextflow.io | bash && cp nextflow /usr/local/bin/nextflow
2020
- name: Run tests
2121
run: |
22+
export NXF_VER=22.04.5
2223
make

Makefile

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,3 +21,4 @@ test:
2121
# STAR indices take over 1 GB and we did not manage to make it work in GitHub actions
2222
#bash tests/run_test_11.sh
2323
#bash tests/run_test_12.sh
24+
#bash tests/run_test_13.sh

README.md

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ somatic variant calling.
1212
Find the documentation here [![Documentation Status](https://readthedocs.org/projects/tronflow-docs/badge/?version=latest)](https://tronflow-docs.readthedocs.io/en/latest/?badge=latest)
1313

1414
This pipeline aligns paired and single end FASTQ files with BWA aln and mem algorithms and with BWA mem 2.
15-
For RNA-seq star is also supported.
15+
For RNA-seq STAR is also supported. To increase sensitivity of novel junctions use `--star_two_pass_mode` (recommended for RNAseq variant calling).
1616
It also includes an initial step of read trimming using FASTP.
1717

1818

@@ -55,6 +55,8 @@ Optional input:
5555
* memory: determines the memory required by each job (default: 32g)
5656
* inception: if enabled it uses an inception, only valid for BWA aln, it requires a fast file system such as flash (default: false)
5757
* skip_trimming: skips the read trimming step
58+
* star_two_pass_mode: activates STAR two-pass mode, increasing sensitivity of novel junction discovery, recommended for RNA variant calling (default: false)
59+
* additional_args: additional alignment arguments, only effective in BWA mem, BWA mem 2 and STAR (default: none)
5860
5961
Output:
6062
* A BAM file \${name}.bam and its index

modules/02_bwa_mem.nf

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ process BWA_MEM {
1616
file("software_versions.${task.process}.txt")
1717

1818
"""
19-
bwa mem -t ${task.cpus} ${params.reference} ${fastq1} ${fastq2} | samtools view -uS - | samtools sort - > ${name}.bam
19+
bwa mem ${params.additional_args} -t ${task.cpus} ${params.reference} ${fastq1} ${fastq2} | samtools view -uS - | samtools sort - > ${name}.bam
2020
2121
echo ${params.manifest} >> software_versions.${task.process}.txt
2222
echo "bwa=0.7.17" >> software_versions.${task.process}.txt
@@ -42,7 +42,7 @@ process BWA_MEM_SE {
4242
file("software_versions.${task.process}.txt")
4343

4444
"""
45-
bwa mem -t ${task.cpus} ${params.reference} ${fastq} | samtools view -uS - | samtools sort - > ${name}.bam
45+
bwa mem ${params.additional_args} -t ${task.cpus} ${params.reference} ${fastq} | samtools view -uS - | samtools sort - > ${name}.bam
4646
4747
echo ${params.manifest} >> software_versions.${task.process}.txt
4848
echo "bwa=0.7.17" >> software_versions.${task.process}.txt

modules/02_bwa_mem_2.nf

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ process BWA_MEM_2 {
1616
file("software_versions.${task.process}.txt")
1717

1818
"""
19-
bwa-mem2 mem -t ${task.cpus} ${params.reference} ${fastq1} ${fastq2} | samtools view -uS - | samtools sort - > ${name}.bam
19+
bwa-mem2 mem ${params.additional_args} -t ${task.cpus} ${params.reference} ${fastq1} ${fastq2} | samtools view -uS - | samtools sort - > ${name}.bam
2020
2121
echo ${params.manifest} >> software_versions.${task.process}.txt
2222
bwa-mem2 version >> software_versions.${task.process}.txt
@@ -42,7 +42,7 @@ process BWA_MEM_2_SE {
4242
file("software_versions.${task.process}.txt")
4343

4444
"""
45-
bwa-mem2 mem -t ${task.cpus} ${params.reference} ${fastq} | samtools view -uS - | samtools sort - > ${name}.bam
45+
bwa-mem2 mem ${params.additional_args} -t ${task.cpus} ${params.reference} ${fastq} | samtools view -uS - | samtools sort - > ${name}.bam
4646
4747
echo ${params.manifest} >> software_versions.${task.process}.txt
4848
bwa-mem2 version >> software_versions.${task.process}.txt

modules/02_star.nf

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,10 @@ process STAR {
1515
tuple val("${name}"), file("${name}.bam"), emit: bams
1616
file("software_versions.${task.process}.txt")
1717

18+
script:
19+
two_pass_mode_param = params.star_two_pass_mode ? "--twopassMode Basic" : ""
1820
"""
19-
STAR --genomeDir ${params.reference} \
21+
STAR --genomeDir ${params.reference} ${two_pass_mode_param} ${params.additional_args} \
2022
--readFilesCommand "gzip -d -c -f" \
2123
--readFilesIn ${fastq1} ${fastq2} \
2224
--outSAMmode Full \
@@ -51,8 +53,10 @@ process STAR_SE {
5153
tuple val("${name}"), file("${name}.bam"), emit: bams
5254
file("software_versions.${task.process}.txt")
5355

56+
script:
57+
two_pass_mode_param = params.star_two_pass_mode ? "--twopassMode Basic" : ""
5458
"""
55-
STAR --genomeDir ${params.reference} \
59+
STAR --genomeDir ${params.reference} ${two_pass_mode_param} ${params.additional_args} \
5660
--readFilesCommand "gzip -d -c -f" \
5761
--readFilesIn ${fastq} \
5862
--outSAMmode Full \

nextflow.config

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,8 @@ params.cpus = 8
1616
params.memory = "32g"
1717
params.inception = false
1818
params.skip_trimming = false
19+
params.star_two_pass_mode = false
20+
params.additional_args = ""
1921

2022
profiles {
2123
conda {
@@ -44,7 +46,7 @@ process.shell = ['/bin/bash', '-euo', 'pipefail']
4446

4547
cleanup = true
4648

47-
VERSION = "1.7.0"
49+
VERSION = "1.8.0"
4850

4951
manifest {
5052
name = 'TRON-Bioinformatics/tronflow-alignment'
@@ -58,7 +60,7 @@ manifest {
5860
params.manifest = manifest
5961

6062
params.help_message = """
61-
TronFlow BWA v${VERSION}
63+
TronFlow alignment v${VERSION}
6264
6365
Usage:
6466
nextflow main.nf --input_files input_files [--reference reference.fasta]
@@ -81,6 +83,8 @@ Optional input:
8183
* memory: determines the memory required by each job (default: 8g)
8284
* inception: if enabled it uses an inception, only valid for BWA aln, it requires a fast file system such as flash (default: false)
8385
* skip_trimming: skips the read trimming step
86+
* star_two_pass_mode: activates STAR two-pass mode, increasing sensitivity of novel junction discovery, recommended for RNA variant calling (default: false)
87+
* additional_args: additional alignment arguments, only effective in BWA mem, BWA mem 2 and STAR (default: none)
8488
8589
Output:
8690
* A BAM file \${name}.bam and its index

tests/run_test_10.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
#!/bin/bash
22

3-
output_folder=output/test3
3+
output_folder=output/test10
44
nextflow main.nf -profile test,conda --library single --algorithm mem2 --output $output_folder
55
test -s $output_folder/TESTX_S1_L001.bam || { echo "Missing test 3 output file!"; exit 1; }
66
test -s $output_folder/TESTX_S1_L001.bam.bai || { echo "Missing test 3 output file!"; exit 1; }

tests/run_test_11.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
#!/bin/bash
22

3-
output_folder=output/test4
3+
output_folder=output/test11
44
nextflow main.nf -profile test,conda --algorithm star --reference `pwd`/test_data --output $output_folder
55
test -s $output_folder/TESTX_S1_L001.bam || { echo "Missing test 4 output file!"; exit 1; }
66
test -s $output_folder/TESTX_S1_L001.bam.bai || { echo "Missing test 4 output file!"; exit 1; }

tests/run_test_12.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
#!/bin/bash
22

3-
output_folder=output/test4
3+
output_folder=output/test12
44
nextflow main.nf -profile test,conda --algorithm star --library single --reference `pwd`/test_data --output $output_folder
55
test -s $output_folder/TESTX_S1_L001.bam || { echo "Missing test 4 output file!"; exit 1; }
66
test -s $output_folder/TESTX_S1_L001.bam.bai || { echo "Missing test 4 output file!"; exit 1; }

0 commit comments

Comments
 (0)