File Info

Filename
.command.sh
Full Path
s3://natera-rnd-pltf-dev-nextflow-scratch-01/work/f7/22c1c312a741a59ca8bd3cbc27edb6/.command.sh
Size
2.8 KB
Attempt
#!/bin/bash -euo pipefail
STAR \
    --genomeDir ref_genome.fa.star.idx \
    --readFilesIn input1/aih-tih-sc-3377ac-R1_A23YTGFLT4_1_1.fastp.fastq.gz input2/aih-tih-sc-3377ac-R1_A23YTGFLT4_1_2.fastp.fastq.gz \
    --runThreadN 24 \
    --outFileNamePrefix aih-tih-sc-3377ac-R1_A23YTGFLT4_1. \
     \
    --sjdbGTFfile ref_annot.gtf \
    --outSAMattrRGline 'ID:aih-tih-sc-3377ac-R1_A23YTGFLT4_1'  'SM:aih-tih-sc-3377ac-R1_A23YTGFLT4_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 aih-tih-sc-3377ac-R1_A23YTGFLT4_1.Chimeric.out.junction ]; then
    head -n 1 aih-tih-sc-3377ac-R1_A23YTGFLT4_1.Chimeric.out.junction > aih-tih-sc-3377ac-R1_A23YTGFLT4_1.Chimeric.out.junction.tmp

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

    tail -n +2 aih-tih-sc-3377ac-R1_A23YTGFLT4_1.Chimeric.out.junction | grep '^#' >> aih-tih-sc-3377ac-R1_A23YTGFLT4_1.Chimeric.out.junction.tmp || true

    mv aih-tih-sc-3377ac-R1_A23YTGFLT4_1.Chimeric.out.junction.tmp aih-tih-sc-3377ac-R1_A23YTGFLT4_1.Chimeric.out.junction
fi

if [ -f aih-tih-sc-3377ac-R1_A23YTGFLT4_1.Unmapped.out.mate1 ]; then
    mv aih-tih-sc-3377ac-R1_A23YTGFLT4_1.Unmapped.out.mate1 aih-tih-sc-3377ac-R1_A23YTGFLT4_1.unmapped_1.fastq
    gzip aih-tih-sc-3377ac-R1_A23YTGFLT4_1.unmapped_1.fastq
fi
if [ -f aih-tih-sc-3377ac-R1_A23YTGFLT4_1.Unmapped.out.mate2 ]; then
    mv aih-tih-sc-3377ac-R1_A23YTGFLT4_1.Unmapped.out.mate2 aih-tih-sc-3377ac-R1_A23YTGFLT4_1.unmapped_2.fastq
    gzip aih-tih-sc-3377ac-R1_A23YTGFLT4_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