Samtools

Last updated November 04, 2023

Samtools is a suite of programs for interacting with high-throughput sequencing data. When working on a CARC cluster, you need to interact with Samtools in a slightly different manner compared to a standard computer due to the distributed nature of the cluster. This guide will walk you through the basic steps of running Samtools commands on a SLURM cluster.

0.0.1 Load Samtools Module to use it in interactive mode

Before using Samtools, you might need to load the appropriate module. This can vary based on the cluster’s configuration, but generally it looks like:

module purge
module load usc
module load samtools

0.0.2 or write a SLURM batch script and submit it to the cluster

To run Samtools on SLURM, you’ll typically use a script. Below is a basic script template for running Samtools:

#!/bin/bash
#SBATCH --job-name=samtools_job
#SBATCH --nodes=1
#SBATCH --ntasks-per-node=1
#SBATCH --time=01:00:00
#SBATCH --mem=10G
#SBATCH --output=samtools_output.%j.out
#SBATCH --error=samtools_error.%j.err
#SBATCH --partition=main
#SBATCH --account=ttrojan_123

module purge
module load usc
module load samtools

# Your Samtools command here, for example:
samtools view -bS input.sam > output.bam

Make sure to adjust parameters like –time, –mem, and any Samtools command options accordingly.

0.0.3 Submitting the SLURM Script

Once you have your SLURM script ready (let’s say you named it samtools_slurm.sh), submit it with:

sbatch samtools_slurm.sh

0.0.4 Retrieving the results

Please use our CARC OnDemand service, navigate to your output directory and download your output file.