Try   HackMD

7. Calculate coverage from SAM or BAM file

tags: 2. Main Steps coverage

Program required: Samtools

samtools coverage aligned_merged_mdup_L19.bam

The code above will only print out the values for you, but do not keep them in a file.

If you want, you can just save the standard out in .out file using Slurm job submission.

#!/bin/bash
#SBATCH -e errs/L%a_coverage-%A.err 
#SBATCH -o outs/L%a_coverage-%A.out 
#SBATCH --mem-per-cpu=20G 
#SBATCH -p scavenger
#SBATCH --cpus-per-task=4 
#SBATCH --mail-type=ALL --mail-user=sbm34@duke.edu
#SBATCH -a 19,30,34,45,59,73

LL=${SLURM_ARRAY_TASK_ID}

module load samtools/1.12-rhel8

samtools coverage ../data/2021_09_21_fastq/aligned_merged_mdup_BAMs/aligned_merged_mdup_L${LL}.bam 

L19_chr2.haplotagged.bam

#!/bin/bash
#SBATCH -e errs/L%a_coverage-%A.err 
#SBATCH -o outs/L%a_coverage-%A.out 
#SBATCH --mem-per-cpu=20G 
#SBATCH -p scavenger
#SBATCH --cpus-per-task=4 
#SBATCH --mail-type=ALL --mail-user=sbm34@duke.edu
#SBATCH -a 19,256,59,96

LL=${SLURM_ARRAY_TASK_ID}

module load samtools/1.12-rhel8

samtools coverage L${LL}_chr2.haplotagged.bam