This is a test version of Biostars. For the public version, visit https://www.biostars.org.
issue with percent mitochondria from txt file

Dear All,

Hope you are well. I have read the txt file from from single cell data using Seurat. However, when it comes to plotting percent mitochondria, i got zero. Try to fix, but not working. if anyone could have a look, that would be great. thank in advance!

#read raw txt file
ATC_data<- read.delim("Y:/read_txt_file/read-txt/GSM5814583_ATC08_UMI.txt", 
                            header=TRUE, sep="\t")

GENE<- ATC_data[["GENE"]]

rownames(ATC_data)= GENE

ATC_data[["GENE"]]<-NULL

class(ATC_data)

ATC_data <-as.matrix (ATC_data)

class(ATC_data)

#create seurat obj
ACT_seurat_obj<- CreateSeuratObject(counts = ATC_data, 
                                    project = "ACT", min.cells = 3,
                                    min.features = 200)

#mitochondria
ACT_seurat_obj<- PercentageFeatureSet(ACT_seurat_obj, pattern = "^MT-", col.name = "percent.mt")
VlnPlot(ACT_seurat_obj, features = c("nFeature_RNA", "nCount_RNA", "percent.mt"), ncol = 3)

enter image description here

enter image description here

seurat

1 answer

You've removed the rownames from your matrix, which is where the gene names are stored. Because of this, there are not data matching the "^MT-" pattern.

If you just make the Seurat object directly from the matrix you read in:

data <-"./GSM5814583_ATC08_UMI.txt"

ATC_data<- read.delim(data, header=TRUE, sep="\t")


# GENE<- ATC_data[["GENE"]]
# 
# rownames(ATC_data)= GENE
# 
# ATC_data[["GENE"]]<-NULL
# 
# class(ATC_data)
# 
# ATC_data <-as.matrix (ATC_data)
# 
# class(ATC_data)

ACT_seurat_obj<- CreateSeuratObject(counts = ATC_data, 
                                    project = "ACT", min.cells = 3,
                                    min.features = 200)

ACT_seurat_obj<- PercentageFeatureSet(ACT_seurat_obj, pattern = "^MT-", col.name = "percent.mt")

VlnPlot(ACT_seurat_obj, features = c("nFeature_RNA", "nCount_RNA", "percent.mt"), ncol = 3)

Then you'll be able to mark the mito genes:

Seurat plot

Thanks, you very much. it worked well. I really appreciated !

Log in to answer this question.