Thanks Devon, I already had a look at that function, but it just provide a table of counts. I need to identify which reads support a given variant. This is relatively easy with pysam but I find no way to do this in Rsamtools. Maybe I missed something from the documentation?
How to get a list of reads supporting a variant in R?
For a given position, in which there is a variant called by some algorithm, I want to get the pileup and analyse the reads supporting that variant. Any idea on how to do this in R? I know how to do this in Python using pysam but I need an R implementation.
Thanks!
• 3,379 views
•
link
1 answer
You're looking for the Rsamtools package, particularly the pileup() command. This and Rhtslib combine to form the R equivalent to pysam in python.
• 0 views
•
link
• 0 views
•
link
It looks like Rsamtools isn't exposing this, which is unfortunate. You can get around this by fetching all reads overlapping a position, but of course that puts a fair bit of the programmatic burden on you.
• 0 views
•
link
Log in to answer this question.
What is the pysam functionality you want to reproduce, specifically? A few lines of code would help.
For a given position, I want to read the pileup and when there is a match to the variant, I want to get the mapping coordinates of the read matching the variant. I do not have the exact code yet, but it would imply something like:
By doing that I can access information about each read and relate that to the presence/absence of a variant match