Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

Expand
titleSolution
Code Block
languagebash
titlesolution
# if needed... cd $SCRATCH/core_ngs/alignment/samtools module load samtools 
samtools view -F 0x04 -f 0x2 -q 20 -o yeast_pe.sort.filt.bam yeast_pe.sort.bam

Exercise: How many records are in the filtered BAM compared to the original? How many read pairs does this represent?

Expand
titleHint

samtools view -c

...

Expand
titleAnswer
Code Block
languagebash
titlesolution
samtools view -c yeast_pe.sort.bam
samtools view -c yeast_pe.sort.filt.bam

There were 1184360 alignment records in the original BAM, and only 456890 in the quality-filtered BAM, around 38% of our starting reads.

Since we have only properly paired reads, the filtered BAM will contain equal numbers of both R1s and R2s. So the number of read pairs is 456890/2 or 228451.

Exercise: If our original BAM contained secondary reads, (0x100 = 1) how would we exclude those also?

...