Error coercing to `dgCMatrix`
Opened this issue · 2 comments
mjz1 commented
I think the recent commits might have done something to break matrix coercion in certain cases. Apologies I don't have a reproducible example, but reverting back to commit 919983d solved the issue.
Running
counts <- as(srt[,run_metadata$cell_id][["RNA"]]$counts, "dgCMatrix")
> Error in h(simpleError(msg, call)): error in evaluating the argument 'x' in selecting a method for function 'iterate_matrix': no slot of name "type" for this object of class "10xMatrixH5"
If it helps my object is as follows:
33538 x 34415 IterableMatrix object with class RenameDims
Row names: MIR1302-2HG, FAM138A ... FAM231C
Col names: sd_1640_bm_c_cd3minus_AAAGATGTCAGGCAAG-1, sd_1640_bm_c_cd3minus_AAAGCAACACTTAACG-1 ... sd_2391_hd62_113_myeloid_TTTGGTTTCAGGCAAG-1
Data type: uint32_t
Storage order: column major
Queued Operations:
1. Concatenate cols of 21 matrix objects with classes: RenameDims, RenameDims ... RenameDims (threads=0)
2. Reset dimnames
mjz1 commented
I've just noticed you mention this in the changelog:
- New slots have been added to 10x matrix objects, so any saved RDS files may need to have
their 10x matrix inputs re-opened and replaced by callingall_matrix_inputs()
. Outside of
loading old RDS files no changes should be needed.
I'll close the issue
bnprks commented
Hi @mjz1, sorry about the breakage. Is it clear to you how to update your RDS file to work with the new version? In short, I think it would be something like this:
mat <- readRDS("some_file.rds")
inputs <- all_matrix_inputs(mat)
for (i in seq_along(inputs)) {
if (is(inputs[[i]], "10xMatrixH5")) {
inputs[[i]] <- open_matrix_10x_hdf5(inputs[[i]]@path)
}
}
all_matrix_inputs(mat) <- inputs
I apologize for the inconvenience of this breaking change -- I couldn't see a way to add the intended features without introducing some breakage, but I can look into improving the error message