How to count the number of reads in each chromosome in a bam file? The bam file is already sorted by the chromosome names. If the bam file is indexed, you may quickly get these info from the index: samtools idxstats in.bam | awk ‘{print $1″ “$3}’ If the bam file is not indexed, you
Read more
Tag: bam
How to merge sam files on Linux?
Posted onThe samtools merge can merge bam files while it can not work for sam files. How to merge sam files on Linux? According to the sam format specification, header lines start with @, while alignment lines do not. So you can use grep to merge sam files as follows efficiently. Assume the header is from
Read more