Thank you, that was extremely helpful and fully recapitulates the original graph. I suppose what I'm trying to do is use seurat functionality (ie. FeaturePlot) but with these tSNE.1 and tSNE.2 coordinates. Any suggestions on how I might accomplish that?
I would like to analyze a published scRNAseq dataset by making a new Seurat Object. The authors have published their tSNE.1 and tSNE.2 coordinates in addition to all of their metadata but I cannot find how to create a tSNE reduction using their tSNE coordinates.
I'm assuming that I still do basic pre-processing, runPCA and runTSNE but any information on how to project the provided embeddings would be greatly appreciated.
library(dplyr)
library(Seurat)
library(patchwork)
library(ggplot2)
library(data.table)
library(magrittr)
library(Matrix)
data_dir <- 'path/to/data/'
list.files(data_dir)
expression_matrix <- Read10X(data.dir = data_dir)
fish_LD = CreateSeuratObject(counts = expression_matrix)
metadata <- read.csv('meta.csv') # dataframe I created from barcodes.tsv.gz
Sample <- metadata[1]
Cell.type<- metadata[2]
tSNE.1 <- metadata[3]
tSNE.2 <- metadata[4]
nGene <- metadata[5]
nUMI <- metadata[6]
Percentage.of.mitochondrial.genes <- metadata[7]
Percentage.of.ribosomal.protein.genes <- metadata[8]
fish_LD <- AddMetaData(object = fish_LD, metadata = data.frame(Sample = Sample,
row.names = rownames(fish_LD@meta.data)))
fish_LD <- AddMetaData(object = fish_LD, metadata = data.frame(Cell.type = Cell.type, row.names = rownames(fish_LD@meta.data)))
fish_LD <- AddMetaData(object = fish_LD, metadata = data.frame(tSNE.1 = tSNE.1, row.names = rownames(fish_LD@meta.data)))
fish_LD <- AddMetaData(object = fish_LD, metadata = data.frame(tSNE.2 = tSNE.2, row.names = rownames(fish_LD@meta.data)))
fish_LD <- AddMetaData(object = fish_LD, metadata = data.frame(nGene = nGene, row.names = rownames(fish_LD@meta.data)))
fish_LD <- AddMetaData(object = fish_LD, metadata = data.frame(nUMI = nUMI, row.names = rownames(fish_LD@meta.data)))
fish_LD <- AddMetaData(object = fish_LD, metadata = data.frame(Percentage.of.mitochondrial.genes = Percentage.of.mitochondrial.genes, row.names = rownames(fish_LD@meta.data)))
fish_LD <- AddMetaData(object = fish_LD, metadata = data.frame(Percentage.of.mitochondrial.genes = Percentage.of.mitochondrial.genes, row.names = rownames(fish_LD@meta.data)))
1 answer
If you mean re-run the t-SNE analysis and get exactly the same result? That could be very hard but you should be able to get something similar just by following the standard Seurat pipeline.
To plot the tSNE just use ggplot or something:
ggplot(fish_LD@meta.data,x=tSNE.1,y=tSNE.2,color=Cell.type) + geom_point()
straightforward: add the gene expression as a column in the metadata and change color=Cell.type to color=yourcolumn
there might be some way to do the feature plot normally but i would have to play around with it. you might be able to set dim.1 and dim.2 to fish_LD@meta.data$tSNE.1 etc...
FeaturePlot(object, features.plot, min.cutoff = NA, max.cutoff = NA,
dim.1 = 1, dim.2 = 2, cells.use = NULL, pt.size = 1,
Log in to answer this question.