AnnData.var
store the metadata of genes (features)
Data type:
>>> type(scanpy_object_used.var) anndata._core.views.DataFrameView
Note:
.var
的格式是DataFrameView
而不是DataFrame
,采用以下方式进行 转换kk=pd.DataFrame(scanpy_object_used.var) '# 将 DataFrameView 转换为 DataFrame type(kk) kk.iloc[:3, :3] #查看 前3行 和 前3列 的信息
Shape:
>>> scanpy_object_used.var.shape (13714, 7)
AnnData.var.highly_variable
the highly variable gene names
>>> type(scanpy_object.var.highly_variable) type(scanpy_object.var.highly_variable) >>> scanpy_object.var.highly_variable[3:8] # view the 3:8 top variable genes
AnnData.obs_names
the name of cells (barcodes)
Data type:
>>> type(scanpy_object_used.obs_names) pandas.core.indexes.base.Index
Length:
>>> len(scanpy_object_used.obs_names) 2643 '# 细胞数量为 2643
取值:
>>> scanpy_object_used.obs_names[:3] Index(['AAACATACAACCAC-1', 'AAACATTGAGCTAC-1', 'AAACATTGATCAGC-1'], dtype='object')
AnnData.var_names
the name of genes (features)
Data type:
>>> type(scanpy_object_used.var_names) pandas.core.indexes.base.Index
Length:
>>> len(scanpy_object_used.var_names) 13714 '# 基因数量为 13714
取值:
>>> scanpy_object_used.var_names[5:9] Index(['NOC2L', 'KLHL17', 'PLEKHN1', 'RP11-54O7.17'], dtype='object')