Should GenomicAlignments::mapToAlignments() terminate when no alignments are found for one read?
1
0
Entering edit mode
Shian Su ▴ 40
@shian-su-9869
Last seen 7 days ago
Walter and Eliza Hall Institute of Mediā€¦

When using mapToAlignments() with multiple GAlignments, it appears to terminate if none of the query GRanges map to a GAlignment.

library(GenomicAlignments)
alignments <- GAlignments(
    c("chr1", "chr1"),
    c(20L, 10L),
    c("11M", "11M"),
    strand(c("*", "*")),
    names=c("read_A", "read_B")
)
x <- GRanges("chr1", IRanges(c(12, 12), width=c(6, 20)))
mapToAlignments(x, alignments) ## Empty output

However if we reverse the order

mapToAlignments(x, alignments[c(2, 1)])
# GAlignments object with 1 alignment and 0 metadata columns:
#         seqnames strand       cigar    qwidth     start       end     width     njunc
#             <Rle>  <Rle> <character> <integer> <integer> <integer> <integer> <integer>
# read_B     chr1      *         11M        11        10        20        11         0
# -------
# seqinfo: 1 sequence from an unspecified genome; no seqlengths

The behaviour appears to be that if a GAlignment cannot be mapped to by any of the GRanges, then function terminates and returns the results obtained so far.

Is this the intended behaviour of the function? It makes it very difficult to use as a batch request, because there's no efficient way to figure out ahead of time which reads will cause the function to prematurely terminate. The fact it terminates silently is also dangerous, because if the offending read occurred half way down a large query then it would be very difficult for a user to realise what happened.

EDIT: I found another strange termination issue shown here: Both reads 2 and 3 have can be mapped to from the query, but no results are returned for them unless read 1 is excluded, not sure what is the termination criterion here.

GenomicAlignments • 948 views
ADD COMMENT
0
Entering edit mode

Hi Shian, Thanks for the report and clear example. I'll look into it. Valerie

ADD REPLY
0
Entering edit mode
@valerie-obenchain-4275
Last seen 2.9 years ago
United States

This is fixed in GenomicAlignments 1.22.1 and 1.23.1.

Valerie

ADD COMMENT

Login before adding your answer.

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