#!/bin/bash -euo pipefail STAR \ --genomeDir ref_genome.fa.star.idx \ --readFilesIn input1/659_bNS-T1-TRNA-1_B23WHTKLT4_1_1.fastp.fastq.gz input2/659_bNS-T1-TRNA-1_B23WHTKLT4_1_2.fastp.fastq.gz \ --runThreadN 24 \ --outFileNamePrefix 659_bNS-T1-TRNA-1_B23WHTKLT4_1. \ \ --sjdbGTFfile ref_annot.gtf \ --outSAMattrRGline 'ID:659_bNS-T1-TRNA-1_B23WHTKLT4_1' 'SM:659_bNS-T1-TRNA-1_B23WHTKLT4_1' \ --twopassMode None --chimSegmentMin 12 --chimJunctionOverhangMin 5 --chimMultimapNmax 50 --chimScoreJunctionNonGTAG -4 --chimScoreSeparation 1 --alignIntronMax 140000 --outReadsUnmapped None --readFilesCommand zcat --outSAMtype BAM SortedByCoordinate --outSAMstrandField intronMotif --outSAMunmapped Within --chimOutJunctionFormat 1 --alignSJDBoverhangMin 10 --alignMatesGapMax 100000 --alignSJstitchMismatchNmax 5 -1 5 5 --chimMultimapScoreRange 3 --chimNonchimScoreDropMin 10 --peOverlapNbasesMin 12 --peOverlapMMp 0.1 --alignInsertionFlush Right --alignSplicedMateMapLmin 30 --alignSplicedMateMapLminOverLmate 0.5 --quantMode GeneCounts --runRNGseed 1 --chimOutType Junctions WithinBAM --limitBAMsortRAM 38654705664 # Sort Chimeric.out.junction file for consistent output between runs # Preserve header (first line) and comments (lines starting with #) at the end if [ -f 659_bNS-T1-TRNA-1_B23WHTKLT4_1.Chimeric.out.junction ]; then head -n 1 659_bNS-T1-TRNA-1_B23WHTKLT4_1.Chimeric.out.junction > 659_bNS-T1-TRNA-1_B23WHTKLT4_1.Chimeric.out.junction.tmp tail -n +2 659_bNS-T1-TRNA-1_B23WHTKLT4_1.Chimeric.out.junction | grep -v '^#' | LC_ALL=C sort -k1,1 -k2,2n -k3,3 -k4,4 -k5,5n -k6,6 >> 659_bNS-T1-TRNA-1_B23WHTKLT4_1.Chimeric.out.junction.tmp || true tail -n +2 659_bNS-T1-TRNA-1_B23WHTKLT4_1.Chimeric.out.junction | grep '^#' >> 659_bNS-T1-TRNA-1_B23WHTKLT4_1.Chimeric.out.junction.tmp || true mv 659_bNS-T1-TRNA-1_B23WHTKLT4_1.Chimeric.out.junction.tmp 659_bNS-T1-TRNA-1_B23WHTKLT4_1.Chimeric.out.junction fi if [ -f 659_bNS-T1-TRNA-1_B23WHTKLT4_1.Unmapped.out.mate1 ]; then mv 659_bNS-T1-TRNA-1_B23WHTKLT4_1.Unmapped.out.mate1 659_bNS-T1-TRNA-1_B23WHTKLT4_1.unmapped_1.fastq gzip 659_bNS-T1-TRNA-1_B23WHTKLT4_1.unmapped_1.fastq fi if [ -f 659_bNS-T1-TRNA-1_B23WHTKLT4_1.Unmapped.out.mate2 ]; then mv 659_bNS-T1-TRNA-1_B23WHTKLT4_1.Unmapped.out.mate2 659_bNS-T1-TRNA-1_B23WHTKLT4_1.unmapped_2.fastq gzip 659_bNS-T1-TRNA-1_B23WHTKLT4_1.unmapped_2.fastq fi cat <<-END_VERSIONS > versions.yml "NFCORE_RNAFUSION:RNAFUSION:FASTQ_ALIGN_STAR:STAR_ALIGNMENT": star: $(STAR --version | sed -e "s/STAR_//g") samtools: $(echo $(samtools --version 2>&1) | sed 's/^.*samtools //; s/Using.*$//') gawk: $(echo $(gawk --version 2>&1) | sed 's/^.*GNU Awk //; s/, .*$//') END_VERSIONS