File Info

Filename
.command.sh
Full Path
s3://natera-rnd-pltf-dev-nextflow-scratch-01/work/56/27c91f0b684312a4f8644d8dae4475/.command.sh
Size
2.8 KB
Attempt
#!/bin/bash -euo pipefail
STAR \
    --genomeDir ref_genome.fa.star.idx \
    --readFilesIn input1/1173_FM_T1_RNA_SLD_01_A23T55JLT4_2_1.fastp.fastq.gz input2/1173_FM_T1_RNA_SLD_01_A23T55JLT4_2_2.fastp.fastq.gz \
    --runThreadN 24 \
    --outFileNamePrefix 1173_FM_T1_RNA_SLD_01_A23T55JLT4_2. \
     \
    --sjdbGTFfile ref_annot.gtf \
    --outSAMattrRGline 'ID:1173_FM_T1_RNA_SLD_01_A23T55JLT4_2'  'SM:1173_FM_T1_RNA_SLD_01_A23T55JLT4_2'  \
    --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 1173_FM_T1_RNA_SLD_01_A23T55JLT4_2.Chimeric.out.junction ]; then
    head -n 1 1173_FM_T1_RNA_SLD_01_A23T55JLT4_2.Chimeric.out.junction > 1173_FM_T1_RNA_SLD_01_A23T55JLT4_2.Chimeric.out.junction.tmp

    tail -n +2 1173_FM_T1_RNA_SLD_01_A23T55JLT4_2.Chimeric.out.junction | grep -v '^#' |             LC_ALL=C sort -k1,1 -k2,2n -k3,3 -k4,4 -k5,5n -k6,6             >> 1173_FM_T1_RNA_SLD_01_A23T55JLT4_2.Chimeric.out.junction.tmp || true

    tail -n +2 1173_FM_T1_RNA_SLD_01_A23T55JLT4_2.Chimeric.out.junction | grep '^#' >> 1173_FM_T1_RNA_SLD_01_A23T55JLT4_2.Chimeric.out.junction.tmp || true

    mv 1173_FM_T1_RNA_SLD_01_A23T55JLT4_2.Chimeric.out.junction.tmp 1173_FM_T1_RNA_SLD_01_A23T55JLT4_2.Chimeric.out.junction
fi

if [ -f 1173_FM_T1_RNA_SLD_01_A23T55JLT4_2.Unmapped.out.mate1 ]; then
    mv 1173_FM_T1_RNA_SLD_01_A23T55JLT4_2.Unmapped.out.mate1 1173_FM_T1_RNA_SLD_01_A23T55JLT4_2.unmapped_1.fastq
    gzip 1173_FM_T1_RNA_SLD_01_A23T55JLT4_2.unmapped_1.fastq
fi
if [ -f 1173_FM_T1_RNA_SLD_01_A23T55JLT4_2.Unmapped.out.mate2 ]; then
    mv 1173_FM_T1_RNA_SLD_01_A23T55JLT4_2.Unmapped.out.mate2 1173_FM_T1_RNA_SLD_01_A23T55JLT4_2.unmapped_2.fastq
    gzip 1173_FM_T1_RNA_SLD_01_A23T55JLT4_2.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