-
Notifications
You must be signed in to change notification settings - Fork 12
Write Annotations to AnnData
#303
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
base: main
Are you sure you want to change the base?
Conversation
Is it easy to include a converter from the old format? |
Co-authored-by: Ziwen Liu <[email protected]>
Yes it's pretty straightforward. I'll add a function to do so. |
I suggest adding a simple script that shows how to use this for plotting the PCs or wrangling the new format. Once we have that converter, then we should be good to go. |
@edyoshikun Ready for re-review |
Im getting an error when loading the annotations. There is a mismatch in the embedding xarray annotations_path = "/hpc/websites/public.czbiohub.org/comp.micro/viscy/DynaCLR_data/DENV/test/20240204_A549_DENV_ZIKV_timelapse/extracted_inf_state.csv"
embeddings_path = "/hpc/websites/public.czbiohub.org/comp.micro/viscy/DynaCLR_data/DENV/test/20240204_A549_DENV_ZIKV_timelapse/precomputed_embeddings/infection_160patch_94ckpt_rev6_dynaclr.zarr" |
Can we have tests for these functions? |
if __name__ == "__main__": | ||
from jsonargparse import CLI | ||
|
||
CLI(main) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you add a test for the CLI?
from viscy.representation.embedding_writer import get_available_index_columns | ||
|
||
|
||
def convert_xarray_annotation_to_anndata( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Test is failing because the function has the same name as the module (generally a thing to avoid).
Annotations are saved in an
AnnData
object and then written to zarr.Here is an example of this, annotation-specific AnnData object.
You can access the observations Pandas DataFrame with
adata.obs
.Embeddings are saved in
obsm
which is a Key-value store. For example you can accessX_pca
by runningadata.obsm["X_pca"]
The feature matrix is saved as the main data array of the AnnData object, saved to$\rightarrow$
.X
.Removes the
/
in FOV names, ("/B/1/000000"
"B/1/000000"
)I tried using it with the current implementation of UMAP, but ran into some errors with
n_neighbors
so I added a quickkwarg
fix.Todos:
tracking.csv
from add percentiles to preprocessing #274? (I'm not entirely sure on this) - from this comment