Seurat 单细胞转录组测序数据分析教程(二)——python(scanpy)
文章参考至scanpy官网,做了一个更详细的解读。
数据由来自健康捐赠者的 3k PBMC组成,可从 10x Genomics 免费获得。在 unix 系统上,您可以取消注释并运行以下命令来下载和解压数据。最后一行创建一个用于写入已处理数据的目录。
# !mkdir data
# !wget http://cf.10xgenomics.com/samples/cell-exp/1.1.0/pbmc3k/pbmc3k_filtered_gene_bc_matrices.tar.gz -O data/pbmc3k_filtered_gene_bc_matrices.tar.gz
# !cd data; tar -xzf pbmc3k_filtered_gene_bc_matrices.tar.gz
# !mkdir write
导入数据
import numpy as np
import pandas as pd
import scanpy as sc
sc.settings.verbosity = 3 # verbosity: errors (0), warnings (1), info (2), hints (3)
sc.logging.print_header()
sc.settings.set_figure_params(dpi=80, facecolor='white')
将计数矩阵读入AnnData对象,该对象包含许多用于注释和不同数据表示的插槽。它还带有自己的基于 HDF5 的文件格式。
adata = sc.read_10x_mtx(
'data/filtered_gene_bc_matrices/hg19/', # the directory with the `.mtx` file
var_names='gene_symbols', # use gene symbols for the variable names (variables-axis index)
cache=True) # wr
adata.var_names_make_unique() # this is unnecessary if using `var_names='gene_ids'` in `sc.read_10x_mtx`
预处理
显示在所有细胞中每个细胞中产生最高计数分数的那些基因。
sc.pl.highest_expr_genes(adata, n_top=20, )

基本过滤:
sc.pp.filter_cells(adata, min_genes=200)
sc.pp.filter_genes(adata, min_cells=3)
1万+



被折叠的 条评论
为什么被折叠?



