Generating pileup from .bam file
What is a tool with which I can generate pileups form .bam file for every positions on reference (I want to find out all bases for every position ('A', 'C', 'T', 'G') and indels (separately insertion and deletion))?
I have used pysam, but wasn't able to get indels.
• 7,052 views
•
link
3 answers
After the research of tools, I have found this tool to fit my usecase: pysamstats.
It gives me what I need: for every pileup position, I can get the number of A, C, G, T, insertions and deletions.
import pysam
import pysamstats
bamfile = pysam.AlignmentFile(bam_file_path)
for record in pysamstats.stat_variation(bamfile, chrom=chrom, fafile=ref_path):
print(record['pos'])
print(record['A'])
print(record['C'])
print(record['G'])
print(record['T'])
print(record['insertions'])
print(record['deletions'])
Thanks for your answers.
• 1 views
•
link
Hmmm have you looked at samtools mpileup? http://samtools.sourceforge.net/mpileup.shtml
• 1 views
•
link
You can also look at gatk Pileup which is similar to samtool's mpileup.
• 1 views
•
link
Log in to answer this question.