aertslab / scenicplus

SCENIC+ is a python package to build gene regulatory networks (GRNs) using combined or separate single-cell gene expression (scRNA-seq) and single-cell chromatin accessibility (scATAC-seq) data.
Other
167 stars 27 forks source link

load own filtered gene matrix and cell type annotations? #68

Closed sid5427 closed 1 year ago

sid5427 commented 1 year ago

Hi Seppe,

Is there a direct way to use our own filtered scRNAseq data, in the form of a filtered gene matrix along with a csv or similar file containing cellbarcode to cell type mapping, along with two columns for UMAP1 and UMAP2 coordinates?

I created my own adata object and loaded the filtered gene matrix using sc.read_10x_h5. However, can you suggest a way to annotate the cells using my mapping table with umap coordinates?

-- Sid

sid5427 commented 1 year ago

resolved myself -

for adding UMAP embeddings.... umap coordinates go into adata.obsm['X_umap']

sample code -

##read in UMAP coordinates
pd_cell_umap_coord = pd.read_csv('umap_coordinates.txt', sep='\t')
#where you have 3 columns - cell barcode, umap X coordinate, umap y coordinate

#numpy stack
umap_array=np.column_stack((pd_cell_umap_coord.UMAP_1,pd_cell_umap_coord.UMAP_2))

##optional change datatype to float32 for entire array
umap_array = umap_array.astype('float32')

#assign umap coordinates
adata.obsm['X_umap']=umap_array