GithubHelp home page GithubHelp logo

Comments (2)

ChuanXu1 avatar ChuanXu1 commented on June 20, 2024 1

@Tripfantasy, this model is available in CellTypist as "Mouse_Isocortex_Hippocampus.pkl".

For processing these files into a h5ad object, I am not sure of a standard way, but below is the code I usually used to do this:

import pandas as pd
import h5py
import scanpy as sc
from scipy.sparse import csr_matrix

f = h5py.File('expression_matrix.hdf5', 'r')

adata = sc.AnnData(csr_matrix(f['data']['counts'][()])).T
adata.var_names = [g.decode('utf-8') for g in f['data']['gene'][()]]
adata.obs_names = [c.decode('utf-8') for c in f['data']['samples'][()]]

coor = pd.read_csv('tsne.csv', index_col = 0)
assert coor.shape[0] == coor.index.intersection(adata.obs_names).size
assert coor.shape[0] == len(adata.obs_names)
adata.obsm['X_umap'] = coor.loc[adata.obs_names].values

meta = pd.read_csv('metadata.csv', index_col = 0)
assert meta.shape[0] == meta.index.intersection(adata.obs_names).size
assert meta.shape[0] < len(adata.obs_names)
adata = adata[meta.index].copy()
adata.obs = meta

adata.write('Yao_2021.h5ad')

from celltypist.

Tripfantasy avatar Tripfantasy commented on June 20, 2024

Oh neat! Thank you for the clarification, this helps a lot.

from celltypist.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.