Closed lgeistlinger closed 5 years ago
Hi Ludwig, @lgeistlinger
If you do debugonce(qreduceAssay)
and then
qreduceAssay(x, query, weightedmean)
, you'll see that they
are all the same length:
Browse[2]> group
[1] 1 1 2 3 4
Browse[2]> ranges
GRanges object with 5 ranges and 0 metadata columns:
seqnames ranges strand
<Rle> <IRanges> <Rle>
[1] chr1 1-10 -
[2] chr1 8-14 -
[3] chr1 1-10 -
[4] chr2 15-18 +
[5] chr2 11-18 +
-------
seqinfo: 2 sequences from an unspecified genome; no seqlengths
Browse[2]> score
[1] 3 4 1 5 2
Browse[2]> qranges
GRanges object with 5 ranges and 0 metadata columns:
seqnames ranges strand
<Rle> <IRanges> <Rle>
[1] chr1 1-14 -
[2] chr1 1-14 -
[3] chr1 1-14 -
[4] chr2 11-18 +
[5] chr2 11-18 +
-------
seqinfo: 2 sequences from an unspecified genome; no seqlengths
Perhaps it was fixed after the issue was filed and we didn't close the issue?
Thanks!
-MR
I think the problem still exists.
It is true that group
, ranges
, score
, and qranges
have all the same length in the body of qreduceAssay
.
However, I'm talking here about the arguments of simplifyReduce
in line 20/21 of the above definition of qreduceAssay
, where
score
[1st arg of simplifyReduce
] takes unname(splitAsList(score, group))
range
[2nd arg of simplifyReduce
] takes unname(splitAsList(ranges, group))
qrange
[3rd arg of simplifyReduce
] takes unname(qranges))
If you accordingly evalutate the right hand sides during debugonce(qreduceAssay)
, you note the described length inconsistency of the args of simplifyReduce
- in particular between args score
(length 4) and qrange
(length 5).
I suppose it should say:
with the same length as
unlist(score)
because we use some tricks to group score values and calculate a mean (for example)..
I think there is a small bug in
qreduceAssay
concerning thesimplifyReduce
argument.Following the corresponding
Arguments
section in?qreduceAssay
, thesimplifyReduce
argument is afunction
/ functional accepting argumentsscore
,range
, andqrange
.Where
qrange
However, when following through the code of
qreduceAssay
:using the example
RaggedExperiment
from?qreduceAssay
and plug that into lines 1-19 of the above code of
qreduceAssay
, you end up (in line 20) with the three arguments ofsimplifyReduce
be set to:and thus with
which is inconsistent with the description above
which is the actual desired behavior.
Closer inspecting this case, you find that by collecting all
queryHits
in line 11 and 15 above,qranges
contains also duplicated query hits within a group of subject ranges belonging to the same query range.These groups are defined in
group
, line 19:A fix could thus look like this:
I can open a PR if needed.