Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

reduceByRanges summarize behavior with vector-returning MAP #3

Open
vjcitn opened this issue Mar 14, 2020 · 2 comments
Open

reduceByRanges summarize behavior with vector-returning MAP #3

vjcitn opened this issue Mar 14, 2020 · 2 comments

Comments

@vjcitn
Copy link
Contributor

vjcitn commented Mar 14, 2020

Suppose the MAP returns a 2-vector and summarise=TRUE

The resulting assay looks like

assay(rr2)
[,1] [,2] [,3]
ENSG00000111424 Numeric,2 Numeric,2 Numeric,2
ENSG00000172216 Numeric,2 Numeric,2 Numeric,2
ENSG00000124731 Numeric,2 Numeric,2 Numeric,2

which is quite useful ... the [i,j] element is a 2-vector. But it might be more
useful to have a pair of flat matrices in the assay slot. Do you think that would
take a lot of work?

@mtmorgan
Copy link
Contributor

mtmorgan commented Mar 16, 2020

Can you provide a reproducible example, maybe building off example(reduceByRange)?

@vjcitn
Copy link
Contributor Author

vjcitn commented Mar 16, 2020

let

MAP2 = function (range, file, ...) 
{
    requireNamespace("GenomicFiles", quietly = TRUE)
    param = Rsamtools::ScanBamParam(which = range)
    rep(sum(runValue(GenomicFiles::coverage(file, param = param)[range][[1]])), 
        2)
}

then

rr2 = reduceByRange(grl, fls, MAP2, summarize=TRUE)
> assay(rr2)
          ERR127306 ERR127307 ERR127308 ERR127309 ERR127302 ERR127303 ERR127304
ERR127306 Integer,2 Integer,2 Integer,2 Integer,2 Integer,2 Integer,2 Integer,2
ERR127306 Integer,2 Integer,2 Integer,2 Integer,2 Integer,2 Integer,2 Integer,2
          ERR127305
ERR127306 Integer,2
ERR127306 Integer,2

This just illustrates the situation. The current behavior is useful, but, for example,
tweaking the example just a little bit,

> reduceByRange(grl, fls, MAP, summarize=TRUE) -> rr3
> assay(rr3)
          ERR127306 ERR127307 ERR127308 ERR127309 ERR127302 ERR127303 ERR127304
ERR127306 ?         ?         ?         ?         ?         ?         ?        
ERR127306 ?         ?         ?         ?         ?         ?         ?        
          ERR127305
ERR127306 ?        
ERR127306 ?        

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants