bam文件 查看染色体
How to count the number of reads in each chromosome in a bam file? The bam file is already sorted by the chromosome names.
如何计算bam文件中每个染色体的读取次数? bam文件已按染色体名称排序。
If the bam file is indexed, you may quickly get these info from the index:
如果bam文件已建立索引,则可以从索引中快速获取以下信息:
samtools idxstats in.bam | awk '{print $1" "$3}'
If the bam file is not indexed, you may “count” it by uniq
:
如果bam文件未建立索引,则可以通过uniq
“计数”它:
samtools view in.bam | awk '{print $3}' | uniq -c
(if it is a sam file like in.sam, replace the samtools view in.bam
with cat in.sam
)
(如果它是in.sam之类的sam文件, samtools view in.bam
cat in.sam
替换为samtools view in.bam
cat in.sam
)
In both cases, samtools
provides the tools to parse/show the bam file content.
在这两种情况下, samtools
提供了用于解析/显示bam文件内容的工具 。
翻译自: https://www.systutorials.com/how-to-count-the-number-of-reads-in-each-chromosome-in-a-bam-file/
bam文件 查看染色体