How To Generate Alignment Statistics Report?
2
9
Entering edit mode
12.2 years ago
Angel ▴ 220

Hey Huys,

How can I generate an alignment statistics report from bwa or samtools? I used bwa for alignment and samtools for the rest. Any other tool to be used once I generate the bam file? I basically want fields like below generated from a commercial software.

MeanInsertSize

Total read#

Uniquely paired read#

Non-uniquely paired read#

Uniquely mapped read1#

Non-uniquely mapped read1#

Uniquely mapped read2#

Non-uniquely mapped read2#

Unmapped read1#

Unmapped read2#

Uniquely paired read%

Non-uniquely paired read%

Uniquely mapped read1%

Non-uniquely mapped read1%

Uniquely mapped read2%

Non-uniquely mapped read2%

Unmapped read1%

Unmapped read2%

bwa exome • 20k views
ADD COMMENT
0
Entering edit mode
ADD REPLY
7
Entering edit mode
12.2 years ago

I think what you want can be achieved using Picard, which is an implementation of Samtools, but in Java. There are also a few tools in Picard which are absent in Samtools. Namely, you want to use CollectAlignmentSummaryMetrics. http://picard.sourceforge.net/javadoc/net/sf/picard/analysis/CollectAlignmentSummaryMetrics.html

You can run this on your SAM/BAM, and you will have most of what you describe above.

EDIT: If you have memory issues, you can increase / decrease the amount of memory available to the program using these flags: "-vmargs -Xms###[mg] -Xmx###[mg]"

java jvm-args -jar PicardCommand.jar

becomes

java -vmargs -Xms64m -Xmx4000m -jar PicardCommand.jar

The first Xms is the minimum amount of memory available to the program when it starts, and the second Xmx is the max memory limit. You can specify the amount of memory using either megabytes (m) or gigabytes (g).

ADD COMMENT
0
Entering edit mode

Thanks so much for your reply. I tried Picard for something else, and it just keeps complaining about the memory. Not happy with the program. But I will try again as you suggested for metrics, may be will work.

ADD REPLY
0
Entering edit mode

@Angel have you tried increasing your initial memory size ? that might help

ADD REPLY
0
Entering edit mode
ADD REPLY
0
Entering edit mode

Hi Sudeep, could you recommend how to increase memory you are referring to?

ADD REPLY
0
Entering edit mode

Edited my original answer to include information about increasing initial memory available to a java app.

ADD REPLY
3
Entering edit mode
12.2 years ago

You can use samtools flagstat command to generate some of those statistics. Here is an old BioStar question about how to interpret the flagstat output.

ADD COMMENT
0
Entering edit mode

Thanks very much, will try it today.

ADD REPLY

Login before adding your answer.

Traffic: 1826 users visited in the last hour
Help About
FAQ
Access RSS
API
Stats

Use of this site constitutes acceptance of our User Agreement and Privacy Policy.

Powered by the version 2.3.6