Repository navigation
add reticulate-based tests for the hdf5 backend - #69
Conversation
|
I think you're right this is the only way to test stuff but I'm not entirely sure doing it as a normal test will work in practice. I'm not sure you can guarantee that Python/anndata will be available without using something like {basilisk}. It may be we need a separate CI or something that does this round trip (I think @ivirshup was interested in that anyway). Happy to have this for now though if it works. |
|
It should be just a matter of making sure that Happy to give basilisk a shot as well :) |
|
If the tests succeed, this test could be merged to the |
|
@lazappi Ok to merge? |
|
I think it's probably fine for now. I think we will want to tidy up the tests at some point but probably better to wait until we have more stuff there. |
| X <- Matrix::rsparsematrix(nrow = 10, ncol = 20, density = .1) | ||
|
|
||
| # construct dummy obs | ||
| obs <- data.frame( | ||
| cell_type = sample(c("tcell", "bcell"), 10, replace = TRUE), | ||
| cluster = sample.int(3, 10, replace = TRUE) | ||
| ) | ||
|
|
||
| # construct dummy obs names | ||
| obs_names <- paste0("cell_", seq_len(10)) | ||
|
|
||
| # construct dummy var | ||
| var <- data.frame( | ||
| geneinfo = sample(c("a", "b", "c"), 20, replace = TRUE) | ||
| ) | ||
|
|
||
| # construct dummy var names | ||
| var_names <- paste0("gene", seq_len(20)) | ||
|
|
||
| layers <- list( | ||
| X2 = X * 2, | ||
| X3 = X * 3 | ||
| ) |
There was a problem hiding this comment.
We might want some kind of "mock" function to use across tests but this is probably fine for now.
* origin/main: (74 commits) make sure path is printed ignore complexity fix typo in docs update roxygen implement get_generator class improve test redesign HDF5AnnData constructor based on #51 rename write h5ad encoding function move validation functions move check fix tests improve roundtrip test wip fix write functions fix read functions check data frame first fix write_encoding_attribute function refactor tests using helper functions fix abstract method error fix issues add reticulate-based tests for the hdf5 backend (#69) ...
In discussing with @LouiseDck yesterday, I'm thinking that the only way to properly make sure that anndataR is able to read files created by anndata and vice versa, is to use reticulate to implement tests with data going back and forth.
Even without the extra checks, seeing if the python anndata is able to read files produced by anndataR is already very valuable.
These tests won't work yet since some of the functions it calls don't exist yet