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

Error coercing to dgCMatrix #79

Open
mjz1 opened this issue Mar 12, 2024 · 2 comments
Open

Error coercing to dgCMatrix #79

mjz1 opened this issue Mar 12, 2024 · 2 comments

Comments

@mjz1
Copy link

mjz1 commented Mar 12, 2024

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
Copy link
Author

mjz1 commented Mar 12, 2024

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 calling all_matrix_inputs(). Outside of
    loading old RDS files no changes should be needed.

I'll close the issue

@mjz1 mjz1 closed this as completed Mar 12, 2024
@bnprks
Copy link
Owner

bnprks commented Mar 12, 2024

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

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