使用samtools來看特定區域的alignments狀況

samtools的功能非常強大,也有很多用法這篇有概略介紹而這邊仔細講解一下比較細緻關於alignment檔案的extraction,就是檢視特定區域的alignment狀況。

看特定區域的alignment狀況

在position-sorted和indexed過的bam file,我們可以擷取特定區域的alignment狀況使用samtools view這指令。

首先,先將想要使用的bam file用samtools index過

$samtools index sample.bam

接下來可以看指定的區域

$samtools view sample.bam 12:7788426-7796061

是將這段區域儲存成另一個bam 檔

$samtools view sample.bam 12:7788426-7796061 > Nanog_region.bam

或是有使用BED file儲存多的region,也可直接用samtools來看這些區域

$samtools view -L cancer_exons.bed sample.bam