美文网首页scRNA-seq单细胞测序
Seurat的subset,数据提取方法

Seurat的subset,数据提取方法

作者: 倪桦 | 来源:发表于2022-04-13 10:04 被阅读0次
    Idents(scRNA) <- scRNA$Majory_type
    subset(x = scRNA, idents = c("CD4 T cells", "CD8 T cells"))
    subset(x = scRNA, subset = nFeatures > 500 & PC1 > 5, idents = "B cells")
    subset(x = scRNA, subset = orig.ident == "Replicate1")
    subset(x = scRNA, downsample = 100)
    subset(x = scRNA, features = VariableFeatures(object = scRNA))
    scRNA= scRNA[,scRNA@meta.data$seurat_clusters %in% c(0,2)]
    scRNA= scRNA[, Idents(scRNA) %in% c( "T cell" ,  "B cell" )] 
    

    矩阵数据提取

    #assay数据提取
    GetAssayData( scRNA, slot = "counts")
    scRNA<- SetAssayData(scRNA, slot = "scale.data", new.data = new.data)
    #embeddings 数据提取
    Embeddings(object = scRNA, reduction = "pca")
    # FetchData can pull anything from expression matrices, cell embeddings, or metadata
    FetchData(object = scRNA, vars = c("PC_1", "percent.mito"))
    exprs <- data.frame(FetchData(object = scRNA, vars =  VariableFeatures(object = scRNA)))
    exprs <- t(exprs)  #行列变换
    write.csv(exprs,file = 'exprs.csv')
    

    相关文章

      网友评论

        本文标题:Seurat的subset,数据提取方法

        本文链接:https://www.haomeiwen.com/subject/ynnosrtx.html