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.
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%
2 answers
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).
@Angel have you tried increasing your initial memory size ? that might help
Please see new post as I could not fit everything as a comment to this post:
Hi Sudeep, could you recommend how to increase memory you are referring to?
Edited my original answer to include information about increasing initial memory available to a java app.
Log in to answer this question.
http://biostar.stackexchange.com/questions/9552/basic-bam-file-annotation