Hi everyone :wave: I am using the nf-core/rnaseq p...
# rnaseq
m
Hi everyone 👋 I am using the nf-core/rnaseq pipeline pre-installed on the BIANCA UPPMAX server. Is there any way I could save the "out.junction" output file, that the STAR module is capable producing, but then the ALIGN_STAR subworkflow does not output. Since I am using a shared resource, from a write protected folder, I cannot/wouldn't modify the source code. Is there a way to do it through extra config files?
j
The
Chimeric.out.junction
file is only produced by STAR when chimeric detection is enabled via specific args (like
--chimOutType Junctions
). The pipeline doesn't pass those by default, so the file won't exist in the working directory to publish. You need two things in a custom config, and neither requires modifying the pipeline source: 1. Tell STAR to produce the file using the
extra_star_align_args
param:
Copy code
params {
    extra_star_align_args = '--chimOutType Junctions --chimSegmentMin 10'
}
(Adjust the chimeric args to your needs -
--chimSegmentMin
is required to activate chimeric detection.) 2. Tell Nextflow to publish it by extending the existing publishDir. This will depend on what version you have, but for example, for latest dev:
Copy code
process {
    withName: '.*ALIGN_STAR:STAR_ALIGN' {
        publishDir = [
            [
                path: { "${params.outdir}/${params.aligner}/log" },
                mode: params.publish_dir_mode,
                pattern: '*.{out,tab}'
            ],
            [
                path: { "${params.outdir}/${params.aligner}/chimeric" },
                mode: params.publish_dir_mode,
                pattern: '*.out.junction'
            ],
            [
                path: { params.save_align_intermeds ? "${params.outdir}/${params.aligner}" : params.outdir },
                mode: params.publish_dir_mode,
                pattern: '*.bam',
                saveAs: { filename -> params.save_align_intermeds ? filename : null }
            ],
            [
                path: { params.save_unaligned ? "${params.outdir}/${params.aligner}/unmapped" : params.outdir },
                mode: params.publish_dir_mode,
                pattern: '*.fastq.gz',
                saveAs: { filename -> params.save_unaligned ? filename : null }
            ]
        ]
    }
}
Note that
publishDir
is set as a whole (not appended), so you need to repeat the existing entries from the pipeline to avoid losing the log/bam/fastq publishing. The block above is a copy of the pipeline's existing config with the
*.out.junction
entry added. Save this as e.g.
custom.config
and pass it with
-c custom.config
. If you're actually after the splice junction file (
SJ.out.tab
) rather than the chimeric junction file, that's already published by default to
<outdir>/<aligner>/log/
in the current dev.
m
Thank you, Jonathan! I will try running with this custom config. 😊 I have added the required extra arguments to STAR, to be precise this set of them:
Copy code
module load bioinfo-tools Nextflow/latest nf-core-pipelines/latest

export NXF_HOME="/proj/..."


nextflow run $NF_CORE_PIPELINES/rnaseq/3.22.2/workflow -resume \
    --input samplesheet.csv \
    --outdir results \
    -profile uppmax \
    --project '...' \
    --fasta refs/ctat/ref_genome.fa \
    --gtf refs/ctat/ref_annot.gtf \
    --gff refs/ctat/ref_annot.gff \
    --bed refs/ctat/ref_annot.bed \
    --transcript_fasta refs/ctat/ref_annot.cdna.fa \
    --star_index refs/ctat/ref_genome.fa.star.idx \
    --salmon_index refs/ctat/ref_genome.fa.salmon.idx \
    --gencode \
    --trimmer trimgalore \
    --extra_trimgalore_args "-q 20 --length 36 --illumina" \
    --skip_bbsplit \
    --skip_umi_extract \
    --aligner star_salmon \
    --speudo_aligner salmon \
    --star_ignore_sjdbgtf \
    --extra_star_align_args "--twopassMode Basic --chimOutType Junctions --chimSegmentMin 12 --chimJunctionOverhangMin 8 --chimOutJunctionFormat 1 --outSAMtype BAM SortedByCoordinate --outBAMcompression 6 --outSAMstrandField intronMotif --outSAMunmapped Within --outReadsUnmapped None --outFilterScoreMinOverLread 0 --outFilterMatchNminOverLread 0 --outFilterMatchNmin 0 --outFilterMismatchNmax 2 --alignIntronMin 10 --alignIntronMax 100000 --alignMatesGapMax 100000" \
    --salmon_quant_libtype 'ISR' \
    --skip_bigwig \
    --skip_stringtie
I have also noticed that SJ.out file in the log output folder. My idea initially was to run the rnavar, rnafusion and rnasplice pipelines next, skipping the same STAR alignment every time, but I am still figuring out if it is feasible.
j
@Rike Hanssen might have some insights on this, i think she's worked with combinations of these
r
yep. We have implemented a bit of pipeline chaining with using Seqera Platform in the middle. It depends a bit on each tool on what you want to do exactly and if it is feasible to skip, but most of the downstream pipelines have bam entry points or run on the unaligned reads
m
Thank you for the insights, Rike! I don't think the Seqera platform is an option on the HPC, since BIANCA does not have an internet access, but I will look into how the bam files and unaligned reads can be inputted to the downstream pipelines.
Just saw this incredibly timely podcast episode on the earlier pipeline-chaining concept I was looking for. Great job from everyone included! 🎉