Question: Best way of creating a large RleMatrix
0
gravatar for maltethodberg
5 months ago by
maltethodberg110
UCPH
maltethodberg110 wrote:

What's the preferred way of creating a large RleMatrix?

The documentation page ?RleMatrix only covers how make an RleMatrix from a single Rle (which doesn't work for very large RleMatrix objects)

First creating a normal matrix and then coercing to RleMatrix, requires keeping the original matrix in memory which is not possible.

I'm currently using the approach of first creating a DataFrame of Rle's, and then coercing that to an RleMatrix, but that seems a bit slow. Is there a smarter way? 

delayedarray rlematrix • 188 views
ADD COMMENTlink modified 3 months ago by Hervé Pagès ♦♦ 13k • written 5 months ago by maltethodberg110
Answer: Best way of creating a large RleMatrix
3
gravatar for Hervé Pagès
3 months ago by
Hervé Pagès ♦♦ 13k
United States
Hervé Pagès ♦♦ 13k wrote:

Hi,

Sorry for the late answer. I've been doing some work on the RleArray() constructor to improve support for long RleArray/RleMatrix objects. One of them is that calling the RleArray() constructor directly on a DataFrame with Rle columns now is supported and fast. I've also added plenty of examples to the man page so make sure to check them (see ?RleArray, in particular the D. CONSTRUCTING A LARGE RleArray OBJECT section).

These improvements are in the devel version of DelayedArray (v 0.9.5), which should become available to BioC 3.9 users via BiocManager::install() in the next 24h. Let me know if you run into problems with this.

Happy new year,

H.

ADD COMMENTlink written 3 months ago by Hervé Pagès ♦♦ 13k

Thank you! Does the new constructor affect how the chunks are structured? If you construct an RleMatrix from a DataFrame of Rle's, is the RleMatrix then chunked by column?

ADD REPLYlink written 3 months ago by maltethodberg110
1

The change to the constructor is that it now accepts a list-like object of Rle objects (e.g. RleList object or DataFrame of Rle's). Each list element in this list-like object becomes a chunk. So yes, if the input to the constructor is a DataFrame of Rle's then each column of the DataFrame becomes a chunk.

H.

ADD REPLYlink written 3 months ago by Hervé Pagès ♦♦ 13k
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 16.09
Traffic: 275 users visited in the last hour