Download tasks/cell_geometry/environment/methods/main/method.py from Tokenwave-AI/REE: direct link, hf CLI and curl.
- Browser
- Download file 522 Bytes
-
https://huggingface.co/datasets/Tokenwave-AI/REE/resolve/refs%2Fpr%2F1/tasks/cell_geometry/environment/methods/main/method.py
- Command line
-
hf download hf://datasets/Tokenwave-AI/REE@refs/pr/1/tasks/cell_geometry/environment/methods/main/method.py
-
curl -L -o method.py https://huggingface.co/datasets/Tokenwave-AI/REE/resolve/refs%2Fpr%2F1/tasks/cell_geometry/environment/methods/main/method.py
522 Bytes
| import os,sys | |
| from pathlib import Path | |
| from importlib.util import spec_from_file_location,module_from_spec | |
| import numpy as np | |
| core=Path(os.environ["CORE_DIR"]) | |
| spec=spec_from_file_location("embedding_io",core/"interface/io.py") | |
| io=module_from_spec(spec);spec.loader.exec_module(io) | |
| a=io.read_data(sys.argv[1]) | |
| import scanpy as sc | |
| sc.pp.highly_variable_genes(a, n_top_genes=1000, flavor="cell_ranger") | |
| y = sc.tl.pca(a[:, a.var["highly_variable"]].copy().X, n_comps=2, svd_solver="arpack") | |
| io.write_embedding(sys.argv[2],y) | |