I got it, thank you, igor.
Hi all,
I'm studying some documents about countOverlaps() (I never work with this tool), and come across with the below sentence: "The first run of the countOverlaps()marks the individual reads with running numbers. The reads with the flag one map to a single gene only and these are mapped to the genes they map to during the second run of the function countOverlaps()." I got confused with the bold sentence. Could you please kindly to explain a bit what's its concept and meaning?
Many thanks in advance
2 answers
The first run of the countOverlaps()marks the individual reads with running numbers.
First run marks how many genes the reads overlap ...
The reads with the flag one map to a single gene only
... then takes the reads overlapping only one gene (excluding multi-mappers or overlapping genes) ...
these are mapped to the genes they map to during the second run of the function countOverlaps().
... then the second run associates these reads with the corresponding genes.
If an answer was helpful you should upvote it, if the answer resolved your question you should mark it as accepted.

Actually, these sentences refer specifically to the following two commands:
hits <- countOverlaps(h1b, txdb)
ol <- countOverlaps(txdb, h1b[hits==1])
The first command counts overlaps with txdb elements (e.g. genes) per each read in h1b.
In the second command, only h1b items characterized by one hit: h1b[hits==1] are applied to countOverlaps. The output of the second command is a named integer vector reporting, per each gene, the number of reads which overlap that gene.
Log in to answer this question.
Can you link to that documentation, so we know which package you're referring to?