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

feat: exclude observation join id from standard and author categories #674

Merged
merged 5 commits into from
Oct 31, 2023

Conversation

joyceyan
Copy link
Contributor

@joyceyan joyceyan commented Oct 30, 2023

https://app.zenhub.com/workspaces/single-cell-5e2a191dad828d52cc78b028/issues/gh/chanzuckerberg/single-cell/597

I was able to produce a CXG with observation_joinid in it: liver_observation_joinid.cxg. The first step was to process liver.h5ad (this is just the smallest dataset we have in prod, downloaded as h5ad) with the schema 4 CLI, to annotate it with observation_joinid:

import anndata
import numpy as np
import pandas as pd
from backend.layers.processing.h5ad_data_file import H5ADDataFile

# Pull h5ad into AnnData
h5ad = H5ADDataFile("liver.h5ad")
adata = anndata.read_h5ad('liver.h5ad')

# Manipulate adata. We need to remove all of the labels we add as part of CXG conversion
del adata.uns["schema_version"]
del adata.var["feature_name"]
del adata.var["feature_reference"]
del adata.var["feature_biotype"]
del adata.raw.var["feature_name"]
del adata.raw.var["feature_reference"]
del adata.raw.var["feature_biotype"]
del adata.obs["cell_type"]
del adata.obs["assay"]
del adata.obs["disease"]
del adata.obs["organism"]
del adata.obs["sex"]
del adata.obs["tissue"]
del adata.obs["self_reported_ethnicity"]
del adata.obs["development_stage"]
adata.obs["CNA_value"] = "test-string"
adata.obs["tissue_type"] = pd.Categorical(["tissue"] * len(adata.obs))
adata.obs["tissue_type"] = adata.obs["tissue_type"].astype("category")

# Write to new h5ad
adata.write_h5ad("liver_fixed.h5ad")

Then, I validate it with the main version of cellxgene-schema, which will add the schema 4 labels.

cellxgene-schema validate liver_fixed.h5ad -a liver_output.h5ad

Next, we just need to convert it to a CXG:

# Pull h5ad into AnnData
h5ad = H5ADDataFile("liver_output.h5ad")
adata = anndata.read_h5ad('liver_output.h5ad')
# Verify that this has observation_joinid on it
print(adata.obs["observation_joinid"])
h5ad.to_cxg(output_cxg_directory="liver_observation_joinid.cxg", sparse_threshold=100)

Then, I just added liver_observation_joinid.cxg to single-cell-explorer/example-dataset.

This is what Explorer shows in main, which has observation_joinid as the 5th author category:

image

And after it's filtered on this branch:

image

@joyceyan joyceyan changed the title feat: exclude observation join id from standard and author categories feat: exclude observation join id from standard and author categories [wip] Oct 30, 2023
@codecov
Copy link

codecov bot commented Oct 30, 2023

Codecov Report

Merging #674 (9b161b9) into main (64316e0) will not change coverage.
The diff coverage is n/a.

❗ Current head 9b161b9 differs from pull request most recent head 904adcf. Consider uploading reports for the commit 904adcf to get more accurate results

@@           Coverage Diff           @@
##             main     #674   +/-   ##
=======================================
  Coverage   77.67%   77.67%           
=======================================
  Files          88       88           
  Lines        6772     6772           
=======================================
  Hits         5260     5260           
  Misses       1512     1512           
Flag Coverage Δ
frontend 77.67% <ø> (ø)
javascript 77.67% <ø> (ø)
smokeTest ?
unitTest 77.67% <ø> (ø)

Flags with carried forward coverage won't be shown. Click here to find out more.

📣 We’re building smart automated test selection to slash your CI/CD build times. Learn more

@joyceyan joyceyan changed the title feat: exclude observation join id from standard and author categories [wip] feat: exclude observation join id from standard and author categories Oct 30, 2023
@joyceyan joyceyan changed the title feat: exclude observation join id from standard and author categories feat: exclude observation join id from standard and author categories [wip] Oct 30, 2023
@joyceyan joyceyan changed the title feat: exclude observation join id from standard and author categories [wip] feat: exclude observation join id from standard and author categories Oct 30, 2023
Copy link
Contributor

@prathapsridharan prathapsridharan left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm

@joyceyan joyceyan merged commit 8661a4e into main Oct 31, 2023
@joyceyan joyceyan deleted the joyce/exclude-joinid branch October 31, 2023 17:06
danieljhegeman pushed a commit that referenced this pull request Dec 7, 2023
* feat: exclude observation join id from standard and author categories (#674)

* exclude observation join id

* don't commit package.json changes

* add stuff back in

* reorder

* fix explorer local dev

* chore: add script to patch explorer to find portal rdev stack (#671)

---------

Co-authored-by: Joyce Yan <[email protected]>
Co-authored-by: Andrew Tolopko <[email protected]>
Bento007 added a commit that referenced this pull request Jan 25, 2024
* chore:staging<-main (#652)

* feat: Add a Github Action that automatically closes stale PRs. (#647)

* chore: add to software catalog (#649)

* fix: override default so that issues are not marked as stale (#650)

* chore: update happy config task launch type (#651)

---------

Co-authored-by: maniarathi <[email protected]>
Co-authored-by: Hayden Spitzley <[email protected]>
Co-authored-by: Daniel Hegeman <[email protected]>

* chore: deploy staging <- main (#681)

* feat: exclude observation join id from standard and author categories (#674)

* exclude observation join id

* don't commit package.json changes

* add stuff back in

* reorder

* fix explorer local dev

* chore: add script to patch explorer to find portal rdev stack (#671)

---------

Co-authored-by: Joyce Yan <[email protected]>
Co-authored-by: Andrew Tolopko <[email protected]>

* chore: main->staging (#721)

* chore(deps-dev): bump follow-redirects from 1.15.2 to 1.15.4 in /client (#702)

Bumps [follow-redirects](https://github.com/follow-redirects/follow-redirects) from 1.15.2 to 1.15.4.
- [Release notes](https://github.com/follow-redirects/follow-redirects/releases)
- [Commits](follow-redirects/follow-redirects@v1.15.2...v1.15.4)

---
updated-dependencies:
- dependency-name: follow-redirects
  dependency-type: indirect
...

Signed-off-by: dependabot[bot] <[email protected]>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>

* chore(explorer): enable safari fix browser page (#704)

* Enable Safari
* Fix Supported Browser page

* fix image path (#706)

* fix(explorer): bundle images (#707)

* fix(explorer): bundle images

* fix(explorer): enable Safari and fix bundled image path (#708)

* fix(explorer): enable Safari and fix bundled image path

* test(playwright): Migrate jest + puppeteer to playwright (#714)

* Install and setup playwright, successfully run example test (#701)

* introduce playwright with running example test

* cleanup eslint

* feat(playwright): migrate tests and e2e utils (#709)

* feat(playwright): migrate tests and e2e utils

* remove allure

* install playwright in workflow

* tweak workflow

* fix install command

* fix mocked endpoints

* fix drag and update snapshots

* fix scroll related failures

* fixes to geneset tests

* delete unsued utils

* remove more unused

* address f/b and fix test

* lint

* fix tests failing on gha

* pass new test

* add waits before lasso

* all tests passing

* fix lint

* add new snapshots

* skip failing test

* always wait for no skeletons

* no undo/redo

* remove verbose server while running e2e

* use cache built into setup-node

* skip

* revert change to script

---------

Signed-off-by: dependabot[bot] <[email protected]>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: Ronen <[email protected]>
Co-authored-by: Severiano Badajoz <[email protected]>

---------

Signed-off-by: dependabot[bot] <[email protected]>
Co-authored-by: maniarathi <[email protected]>
Co-authored-by: Hayden Spitzley <[email protected]>
Co-authored-by: Daniel Hegeman <[email protected]>
Co-authored-by: prathap sridharan <[email protected]>
Co-authored-by: Joyce Yan <[email protected]>
Co-authored-by: Andrew Tolopko <[email protected]>
Co-authored-by: Emanuele Bezzi <[email protected]>
Co-authored-by: Nayib Gloria <[email protected]>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: Ronen <[email protected]>
Co-authored-by: Severiano Badajoz <[email protected]>
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

Successfully merging this pull request may close these issues.

2 participants