How to split grouping information in a single expression matrix?
1
0
Entering edit mode
15 months ago
Xuhao • 0

Hello everyone,

I am a rookie in single-cell RNA seq analysis. Currently, I am learning to analyze the data (GSE150703) in R. The colname is like NORM_P14_WR_Mccarrol_r3_CGGTAATTGCCC and OIR_P17_WR_Joyal_r1_TCGCGCCACTAG. When I read the table and created a Seuratobject I found the orig.ident only contains NORM. How can I split the grouping information into four groups such as NORM P14, NORM P17, OIR P14, OIR P17?

Thank you tons.

scRNA-seq GEO Seurat • 595 views
ADD COMMENT
2
Entering edit mode
15 months ago
bk11 ★ 3.0k

Please do this to create Seurat object from GSE150703 data-

library(data.table)
ftp="https://ftp.ncbi.nlm.nih.gov/geo/series/GSE150nnn/GSE150703/suppl/GSE150703_retina_NORM_OIR_P14_P17_C57_WR_CD73FT_noamg_normalizedUMI_Count_DGEmatrix.txt.gz"
counts <-data.table::fread(ftp)

rownames(counts)=counts$V1
counts[1:5,1:5]


              V1 NORM_P14_WR_Mccarrol_r3_CGGTAATTGCCC NORM_P14_WR_Mccarrol_r5_AGTACCGTAAGG NORM_P14_WR_Mccarrol_r5_CTAATAAAGCTC NORM_P14_WR_Mccarrol_r2_CGCCGATAGATG
1: 0610005C13RIK                                    0                                    0                                    0                             0.000000
2: 0610007N19RIK                                    0                                    0                                    0                             0.000000
3: 0610007P14RIK                                    0                                    0                                    0                             3.267762
4: 0610009B14RIK                                    0                                    0                                    0                             0.000000
5: 0610009B22RIK                                    0                                    0                                    0                             0.000000

counts$V1 <- NULL
seurat_obj=CreateSeuratObject(counts)
seurat_obj
An object of class Seurat 
21408 features across 31271 samples within 1 assay 
Active assay: RNA (21408 features, 0 variable features)
 1 layer present: counts

head(seurat_obj@meta.data)
                                     orig.ident nCount_RNA nFeature_RNA
NORM_P14_WR_Mccarrol_r3_CGGTAATTGCCC       NORM   1040.047          301
NORM_P14_WR_Mccarrol_r5_AGTACCGTAAGG       NORM   1002.495          296
NORM_P14_WR_Mccarrol_r5_CTAATAAAGCTC       NORM   1079.672          326
NORM_P14_WR_Mccarrol_r2_CGCCGATAGATG       NORM   1023.541          299
NORM_P14_WR_Mccarrol_r6_TAGAGTCGAGCC       NORM   1117.872          362
NORM_P14_WR_Mccarrol_r3_CCGACTCCCCAA       NORM   1579.136          567

#changing orig.ident in the following steps
seurat_obj@meta.data$Idents=rownames(seurat_obj@meta.data)
seurat_obj@meta.data$Idents=stringr::str_extract(seurat_obj@meta.data$Idents, "[^_]*_[^_]*")

seurat_obj@meta.data$orig.ident <- NULL
seurat_obj@meta.data$orig.ident <- seurat_obj@meta.data$Idents
seurat_obj@meta.data$Idents <- NULL
head(seurat_obj@meta.data)
                                     nCount_RNA nFeature_RNA orig.ident
NORM_P14_WR_Mccarrol_r3_CGGTAATTGCCC   1040.047          301   NORM_P14
NORM_P14_WR_Mccarrol_r5_AGTACCGTAAGG   1002.495          296   NORM_P14
NORM_P14_WR_Mccarrol_r5_CTAATAAAGCTC   1079.672          326   NORM_P14
NORM_P14_WR_Mccarrol_r2_CGCCGATAGATG   1023.541          299   NORM_P14
NORM_P14_WR_Mccarrol_r6_TAGAGTCGAGCC   1117.872          362   NORM_P14
NORM_P14_WR_Mccarrol_r3_CCGACTCCCCAA   1579.136          567   NORM_P14

table(seurat_obj@meta.data$orig.ident)
NORM_P14 NORM_P17  OIR_P14  OIR_P17 
   10332     3450     9590     7899 
ADD COMMENT
0
Entering edit mode

Thanks a million for your support.

ADD REPLY

Login before adding your answer.

Traffic: 1565 users visited in the last hour
Help About
FAQ
Access RSS
API
Stats

Use of this site constitutes acceptance of our User Agreement and Privacy Policy.

Powered by the version 2.3.6