Generating pileup from .bam file
3
0
Entering edit mode
6.6 years ago
ajuric101 ▴ 30

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.

genome pileup indels • 6.1k views
ADD COMMENT
4
Entering edit mode
6.6 years ago
ajuric101 ▴ 30

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.

ADD COMMENT
2
Entering edit mode
6.6 years ago
Hussain Ather ▴ 990

Hmmm have you looked at samtools mpileup? http://samtools.sourceforge.net/mpileup.shtml

ADD COMMENT
2
Entering edit mode
6.6 years ago
Tm ★ 1.1k

You can also look at gatk Pileup which is similar to samtool's mpileup.

ADD COMMENT

Login before adding your answer.

Traffic: 1890 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