# Get the latest release source files for samtools, unzip, compile and install:
wget https://github.com/samtools/samtools/releases/download/1.9/samtools-1.9.tar.bz2
tar -vxjf samtools-1.9.tar.bz2
cd samtools-1.9
make
sudo make install
# Converting SAM file into BAM file:
samtools view -b -@ [insert number of threads] INPUT.sam -o INPUT.bam
# Sorting BAM files by coordinate
samtools sort -@ [insert number of threads] INPUT.bam -o INPUT_sorted.bam
# Converting SAM file into BAM file sorted by coordinate
samtools sort -@ [insert number of threads] -o INPUT_sorted.bam INPUT.sam