#!/usr/bin/env bash -C -e -u -o pipefail
STAR \
     \
    --readFilesIn subject_a.tumor.rna.R1.fastq.gz subject_a.tumor.rna.R2.fastq.gz \
    --genomeDir star_index-gencode_38-2.7.3a \
    --runThreadN 12 \
    --readFilesCommand zcat \
    --alignSJstitchMismatchNmax 5 -1 5 5 \
    --alignSplicedMateMapLmin 35 \
    --alignSplicedMateMapLminOverLmate 0.33 \
    --chimJunctionOverhangMin 10 \
    --chimOutType WithinBAM SoftClip \
    --chimScoreDropMax 30 \
    --chimScoreJunctionNonGTAG 0 \
    --chimScoreMin 1 \
    --chimScoreSeparation 1 \
    --chimSegmentMin 10 \
    --chimSegmentReadGapMax 3 \
    --limitOutSJcollapsed 3000000 \
    --outBAMcompression 0 \
    --outFilterMatchNmin 35 \
    --outFilterMatchNminOverLread 0.33 \
    --outFilterMismatchNmax 3 \
    --outFilterMultimapNmax 10 \
    --outFilterScoreMinOverLread 0.33 \
    --outSAMattributes All \
    --outSAMattrRGline ID:subject_a.tumor_rna.library_1.001 SM:subject_a.tumor_rna \
    --outSAMtype BAM Unsorted \
    --outSAMunmapped Within \
    --runRNGseed 0

cat <<-END_VERSIONS > versions.yml
"NFCORE_ONCOANALYSER:WGTS:READ_ALIGNMENT_RNA:STAR_ALIGN":
    star: $(STAR --version | sed -e "s/STAR_//g")
END_VERSIONS
