{"id":22731026,"url":"https://github.com/genentech/quipcell","last_synced_at":"2025-03-30T01:29:48.658Z","repository":{"id":243287832,"uuid":"811101223","full_name":"Genentech/quipcell","owner":"Genentech","description":"Fine-scale cellular deconvolution based on Generalized Cross Entropy","archived":false,"fork":false,"pushed_at":"2024-06-10T21:36:46.000Z","size":8018,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"main","last_synced_at":"2025-03-29T10:54:36.489Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":"Jupyter Notebook","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/Genentech.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":"CONTRIBUTING.md","funding":null,"license":"LICENSE.txt","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":"AUTHORS.md","dei":null,"publiccode":null,"codemeta":null}},"created_at":"2024-06-05T23:53:44.000Z","updated_at":"2024-06-10T21:34:05.000Z","dependencies_parsed_at":"2024-06-07T20:44:55.047Z","dependency_job_id":"0c4786fa-e5cf-4924-9512-5697976b725d","html_url":"https://github.com/Genentech/quipcell","commit_stats":null,"previous_names":["genentech/quipcell"],"tags_count":8,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Genentech%2Fquipcell","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Genentech%2Fquipcell/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Genentech%2Fquipcell/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Genentech%2Fquipcell/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Genentech","download_url":"https://codeload.github.com/Genentech/quipcell/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":246264476,"owners_count":20749471,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-12-10T19:19:08.874Z","updated_at":"2025-03-30T01:29:48.638Z","avatar_url":"https://github.com/Genentech.png","language":"Jupyter Notebook","funding_links":[],"categories":[],"sub_categories":[],"readme":"\u003c!-- These are examples of badges you might want to add to your README:\n     please update the URLs accordingly\n\n[![Built Status](https://api.cirrus-ci.com/github/\u003cUSER\u003e/quipcell.svg?branch=main)](https://cirrus-ci.com/github/\u003cUSER\u003e/quipcell)\n[![ReadTheDocs](https://readthedocs.org/projects/quipcell/badge/?version=latest)](https://quipcell.readthedocs.io/en/stable/)\n[![PyPI-Server](https://img.shields.io/pypi/v/quipcell.svg)](https://pypi.org/project/quipcell/)\n--\u003e\n\n[![Project generated with PyScaffold](https://img.shields.io/badge/-PyScaffold-005CA0?logo=pyscaffold)](https://pyscaffold.org/)\n\n# quipcell\n\n\u003e Fine-scale cellular deconvolution based on Generalized Cross Entropy\n\nA method to perform cellular deconvolution at a fine-scale\n(i.e. single-cell or neighborhood level), using a generalization of\nmaximum entropy that is also an efficient convex optimization problem.\n\n## Installation\n\nInstallation\n\n```\npip install quipcell\n```\n\n## Method\n\nA preprint describing the method is available on [bioRxiv](https://www.biorxiv.org/content/10.1101/2024.06.07.598010v1).\n\n## Usage\n\nThe [documentation](https://genentech.github.io/quipcell/) includes a\n[vignette](https://genentech.github.io/quipcell/vignette.html) and\n[API reference](https://genentech.github.io/quipcell/api/modules.html).\n\nThe snippet below demonstrates how to obtain weights from two\nAnnData's containing the single cell reference and the bulk samples to\ndeconvolve. Both AnnDatas are assumed to contain the raw counts, and\nto have the same genes. Dimensionality reduction steps (PCA and LDA)\nare run on the single cell reference, then applied to the bulk data,\nand then quipcell estimates single cell weights using a generalized\nmaximum entropy method. The resulting weights represent the\nprobability that a random read from the bulk sample originated from\n\"near\" the reference cell.\n\n```\nimport scanpy as sc\nfrom sklearn.discriminant_analysis import LinearDiscriminantAnalysis\n\n# save the number of UMIs per cell\nadata_ref.obs['n_umi'] = adata_ref.X.sum(axis=1)\n\n# Normalize the single cell reference\nnormalize_sum = 1e3\nsc.pp.normalize_total(adata_ref, target_sum=normalize_sum)\n\n# Compute low dimensional features via PCA and LDA on the single cells\nsc.pp.pca(adata_ref, n_comps=100)\n\nlda = LinearDiscriminantAnalysis(n_components=15)\nlda.fit(adata_ref.obsm['X_pca'], adata_ref.obs['celltype'])\n\nadata_ref.obsm['X_lda'] = lda.transform(adata_ref.obsm['X_pca'])\n\n# Normalize the bulk samples\nsc.pp.normalize_total(adata_bulk, target_sum=normalize_sum)\n\n# Apply PCA rotation to pseudobulks. Note the centers need to be\n# subtracted before rotation\nX = adata_bulk.X - np.squeeze(np.asarray(adata_ref.X.mean(axis=0)))\nX = np.asarray(X @ adata_ref.varm['PCs'])\nadata_bulk.obsm['X_pca'] = X\n# Apply LDA rotation to pseudobulks\nadata_bulk.obsm['X_lda'] = lda.transform(X)\n\n# Compute the weights. Rows are reference single cells, columns are\n# bulk samples. The entries represent the probability that a random\n# read from the bulk sample originated near the respective reference\n# cell.\nw_reads = qpc.estimate_weights_multisample(adata_ref.obsm['X_lda'],\n                                         adata_bulk.obsm['X_lda'])\n```\n\n\u003c!-- pyscaffold-notes --\u003e\n\n## Note\n\nThis project has been set up using PyScaffold 4.5. For details and usage\ninformation on PyScaffold see https://pyscaffold.org/.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fgenentech%2Fquipcell","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fgenentech%2Fquipcell","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fgenentech%2Fquipcell/lists"}