Question: Get All Alleles Of 1 Column In Bam File
0
gravatar for Manon Delahaye
7.7 years ago by
Manon Delahaye10 wrote:

Hi all, I have bam files from which I would like to extract 1 specific column (ie chr:position). I won't to have all alleles, even if they come from low quality reads. And even if the position is not a SNP (ie all alleles are the same or almost).

I tried to use "samtools view" giving the position but then the output is all reads that overlap the position so it's not exactly what I am looking for.

Does anyone has any idea how I could solve my problem ?

Thanks a lot. M.D

read extraction bam position • 3.1k views
ADD COMMENTlink modified 5.3 years ago by guns.guru50 • written 7.7 years ago by Manon Delahaye10
1
gravatar for Manon Delahaye
7.7 years ago by
Manon Delahaye10 wrote:

I managed to do what I was hoping for.

samtools mpileup -Bf myReference.fasta -r chr9:myPos-myPos [?]

-B allows for all location (not only SNPs)

Then with some combination of grep and others I could count my alleles.

Thank you for your help ! M.D

ADD COMMENTlink written 7.7 years ago by Manon Delahaye10
0
gravatar for Sean Davis
7.7 years ago by
Sean Davis25k
National Institutes of Health, Bethesda, MD
Sean Davis25k wrote:

I think you are looking for:

samtools mpileup ....

There are a number of flags that you may want to tweak to get exactly the output you want.

ADD COMMENTlink written 7.7 years ago by Sean Davis25k
0
gravatar for Manon Delahaye
7.7 years ago by
Manon Delahaye10 wrote:

Hi, Thanks I will have a look. However, I thought that this command is for SNP calling. And I want the alleles at the position even if there is no variant at that position.

Do you think that is included in one of the option ?

I will have a better and closer look tomorrow.

Thanks. MD

ADD COMMENTlink written 7.7 years ago by Manon Delahaye10

samtools pileup -cf reference.fasta Input.bam

ADD REPLYlink written 7.7 years ago by Rm7.9k

Just a note that pileup is deprecated (or not even available) in newer samtools versions. Mpileup is the replacement.

ADD REPLYlink written 7.7 years ago by Sean Davis25k
0
gravatar for guns.guru
5.3 years ago by
guns.guru50
guns.guru50 wrote:

Hi M.D

It's been a long time, since you posted this but I have the exact same problem i.e., to extract the allele at particular positions, whether they are SNPs or not.

How did you achieve this?

Thanks

ADD COMMENTlink written 5.3 years ago by guns.guru50

Please start a new thread. Also, the answer is samtools mpileup, as the others mentioned above.

ADD REPLYlink written 5.3 years ago by Devon Ryan91k

Thanks for looking into this dpryan! I did start a new thread here: Extract allele at particular positions from BAM files I did infer that "samtools mpileup" is the way to go... however, I couldn't make it work! I'll post more details on that thread. Hope you could take a look there again...

ADD REPLYlink written 5.3 years ago by guns.guru50
Please log in to add an answer.

Help
Access

Use of this site constitutes acceptance of our User Agreement and Privacy Policy.
Powered by Biostar version 2.3.0
Traffic: 1596 users visited in the last hour