Search
Question: How to write a preprocess.reads function for summarizeOverlaps that requires different logic for paired and single end reads?
0
gravatar for Ryan C. Thompson
5 months ago by
The Scripps Research Institute, La Jolla, CA
Ryan C. Thompson6.8k wrote:

I want to write a function that I can use as the preprocess.reads argument to summarizeOverlaps that will reduce each read to just the midpoint of the fragment represented by the read. For paired-end reads, this involves taking the midpoint of the outer ends of the two reads, while for single-end reads, this involves specifying the fragment length and then taking the point half that distance downstream of the 5-prime end of the read. What is the best way for me to write a function that can handle both? Should the function simply check if its argument is an instance of GAlignmentPairs in order to decide between the paired-end and single-end logic, or is there a better way?

ADD COMMENTlink modified 5 months ago by Valerie Obenchain ♦♦ 6.6k • written 5 months ago by Ryan C. Thompson6.8k
2
gravatar for Valerie Obenchain
5 months ago by
Valerie Obenchain ♦♦ 6.6k
United States
Valerie Obenchain ♦♦ 6.6k wrote:

If you're calling summarizedOverlaps with the reads in a GAlignmentsPairs then yes, this would be the way to go. If instead the reads are in a BAM file they will be read into different classes depending on the value of the fragments argument.

When you provide a BAM file of paired-end reads with fragments=TRUE the reads go in a GAlignmentsList before counting. If fragments=FALSE (default) they go into a GAlignmentPairs class.

Valerie

ADD COMMENTlink written 5 months ago by Valerie Obenchain ♦♦ 6.6k

Ok, good to know. So basically, my preprocessing function should be prepared to handle any one of GAlignments, GAlignmentPairs, and GAlignmentsList. And furthermore it should be prepared to distinguish between mated and un-mated reads within a GAlignmentsList.

ADD REPLYlink modified 5 months ago • written 5 months ago by Ryan C. Thompson6.8k
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.2.0
Traffic: 333 users visited in the last hour