Closed akhst7 closed 3 years ago
Hi @akhst7,
This is an oversight on my part. Could you try running the following? Does this already work for you?
pbmc10k.ad$layers[["unsp"]] <- unsp
pbmc10k.ad$layers[["rna"]] <- rna
If it does, please leave this issue open so that I know to add the functionality mentioned in the first post.
Kind regards, Robrecht
@rcannood,
Thanks for the response. I tired above but this failed as well.
> pbmc10k.ad$layers[["unsp"]]<-unsp
Error in py_call_impl(callable, dots$args, dots$keywords) :
ValueError: Value passed for key 'unsp' is of incorrect shape. Values of layers must match dimensions (0, 1) of parent. Value had shape (10194, 1) while it should have had (10194, 36601).
6.
stop(structure(list(message = "ValueError: Value passed for key 'unsp' is of incorrect shape. Values of layers must match dimensions (0, 1) of parent. Value had shape (10194, 1) while it should have had (10194, 36601).",
call = py_call_impl(callable, dots$args, dots$keywords),
cppstack = structure(list(file = "", line = -1L, stack = c("1 reticulate.so 0x000000010df4a65e _ZN4Rcpp9exceptionC2EPKcb + 222",
"2 reticulate.so 0x000000010df52735 _ZN4Rcpp4stopERKNSt3__112basic_stringIcNS0_11char_traitsIcEENS0_9allocatorIcEEEE + 53", ...
5.
_validate_value at aligned_mapping.py#52
4.
__setitem__ at aligned_mapping.py#151
3.
x$.__enclos_env__$private$.layers$`__setitem__`(name, value)
2.
`[[<-.LayersR6`(`*tmp*`, "unsp", value = structure(list(nCount_unspliced = c(12648,
7323, 10260, 1509, 12001, 6243, 4795, 5154, 15202, 6330, 11564,
8443, 4031, 2754, 4417, 2299, 2514, 3265, 2292, 5548, 4473, 9594,
4167, 5108, 10666, 1961, 1473, 14621, 6071, 8165, 1922, 4738, ...
1.
`[[<-`(`*tmp*`, "unsp", value = structure(list(nCount_unspliced = c(12648,
7323, 10260, 1509, 12001, 6243, 4795, 5154, 15202, 6330, 11564,
8443, 4031, 2754, 4417, 2299, 2514, 3265, 2292, 5548, 4473, 9594,
4167, 5108, 10666, 1961, 1473, 14621, 6071, 8165, 1922, 4738, ...
Hi @akhst7,
This issue is caused by anndata itself, not the R wrapper for it. You can't assign unsp to the layers, because it has a different dimension than the rest of your anndata file.
See the discussion at theislab/anndata#237 for more information.
Kind regards, Robrecht
Hi,
I am trying add some layers to my AnnData file and get an error as follows;
Files in questions are as follows;
Python dict issue ? Anyway, I appreciate any help on this.
Thanks.