File Info

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

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

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

    mv A549_FFPE_01_RNA_0001_B23LG7FLT4_3.Chimeric.out.junction.tmp A549_FFPE_01_RNA_0001_B23LG7FLT4_3.Chimeric.out.junction
fi

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