Closed:problem in visualization of Gene names instead of Gene ids in annotated Seurat object
0
0
Entering edit mode
3.4 years ago
Maria17 ▴ 40

Greetings,

I'm working with ScRNA seq data, and in my count files, I had the Gene ids in rows and cells in columns. I annotated the ids .

#libraries

library(biomaRt)
Library(AnnotationDbi)
library(org.Hs.eg.db)
library(EnsDb.Hsapiens.v86)
 and created a Seurat object.
this is my codes relate to annotation:

biolist <- as.data.frame(listMarts())

ensembl = useMart("ensembl")

esemblist <- as.data.frame(listDatasets(ensembl))

ensembl = useDataset("hsapiens_gene_ensembl",mart=ensembl)

filters = listFilters(ensembl)
biolist <- as.data.frame(listMarts())

ensembl = useMart("ensembl")

esemblist <- as.data.frame(listDatasets(ensembl))

ensembl = useDataset("hsapiens_gene_ensembl",mart=ensembl)

attributes = listAttributes(ensembl)
t2g <- getBM(attributes=c('ensembl_gene_id', 'ensembl_peptide_id', 'chromosome_name','start_position','end_position'), mart = ensembl)
ann <- select(org.Hs.eg.db, keys = as.character(row.names(S.mat)), keytype = 'ENSEMBL', columns = c("ENTREZID", "SYMBOL", "GENENAME", "ALIAS", "MAP"))
ann <- merge(x=ann, y=t2g, by.x="ENSEMBL", by.y="ensembl_gene_id", all.x=TRUE)
S.ann <- ann[!duplicated(ann["ENSEMBL"]),]
S.ann <- S.ann[c("ENSEMBL", "SYMBOL", "MAP", "chromosome_name")]
S.ann$SYMBOL <- ifelseis.na(S.ann$SYMBOL), S.ann$ENSEMBL, S.ann$SYMBOL)
# set ENSEMBL as rownames
rownames(S.ann) <- S.ann[,1]
S.ann <- S.ann[-1]
colnames(S.mat) <- gsub(".replicate", "", colnames(S.mat))

Finally make the seurat object:

S19.seurat <- CreateSeuratObject(S.mat, project = "S19", min.cells = 10, names.field = 1, names.delim = "_")
# Add library info:
S19.seurat$library <- as.factor(c(gsub("(.+_)rep(.).+", "\\1\\2", colnames(S.mat)))) #this is related to my data 
S19.seurat@assays$RNA <- AddMetaData(S19.seurat@assays$RNA, S19.ann, col.name = "SYMBOL")`

so my gene symbols(names) STORED in metafeatures here with symbol colname: View(S19.seurat@assays[["RNA"]]@meta.features)

problem:

In the visualization step for example for in hvgs FindVariableFeatures plot showed the gene ids, not the gene names, or FeaturePlot with gene names shows an error and requires the Gene ids(in FeaturePlot i want to show the gene names not ids)

I don't know how to fix this problem, because most of the libraries (cell type annotation ) required gene names rather than ids.

Any solution and recommendation would be appreciated.

THANKS Maria

RNA-Seq R Seurat Annotation • 158 views
ADD COMMENT
This thread is not open. No new answers may be added
Traffic: 1457 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