"""Open Problems v1.0.0 densMAP PCA (logCP10k), with task I/O.""" import os import sys from importlib.util import module_from_spec, spec_from_file_location from pathlib import Path import scanpy as sc from umap import UMAP spec = spec_from_file_location( "embedding_io", Path(os.environ["CORE_DIR"]) / "interface/io.py" ) io = module_from_spec(spec) spec.loader.exec_module(io) adata = io.read_data(sys.argv[1]) # X already contains the source normalizer's log-CP10k expression. # These calls are the published _umap(adata, densmap=True, n_comps=50). sc.tl.pca(adata, n_comps=50, svd_solver="arpack") embedding = UMAP(densmap=True, random_state=42).fit_transform(adata.obsm["X_pca"]) io.write_embedding(sys.argv[2], embedding)