Hey guys, in this video I wanted to do another tutorial on how to analyze single cell RNA seq
data. I'm going to go over how you can get a gene signatures plot, which is basically just a dot
plot like you can see on the right hand side here. On the left hand side, I have a UMAP of different
cell clusters that have their cell type labels on them and if you have this type of seurat object,
then you can create a plot like this on the right hand side where you get the gene signatures for
the different cell types or clusters that you have in your data. This is a dot plot with four
clusters--just showing the gene signatures of four clusters as an example. I have the gene signature
for plasma one, two, three, and four. That corresponds to the different labels that I have
for one, two, three, four. This is just a subset of the clusters that I have on the left hand side
but I'm going to go over an R demo for how you can create this type of plot and I will also put the
code in the description box below. For this type of gene signature plot, it's going to show you
which genes are differentially expressed in each cell type or cluster that you have. For
example for plasma 1, JCHAIN is a gene that is differentially expressed, so it's more highly
expressed in plasma 1 compared to plasma 2, 3, and 4. For example in plasma 4, the gene CD81
is more differentially expressed or more highly expressed in plasma 4 compared to clusters 1, 2,
3. That's how you would read this type of plot and then in the next part of the video I'll
go over how you can create this type of data visualization and I'm going to assume that you
already have a seurat object with the different clusters labeled. Okay so I switched over to an R
window and I'm just going to go over this short line of code to produce the dot plots or gene
signature plots and again I will put the code in the description box below. The first three lines
of code will load in three different R packages. I'm going to load in seurat, ggplot2, and dplyr.
Next in the first two lines of code, I'm going to load in a seurat object. I'm first loading in the
plasma seurat object that has all the different plasma cell types that I showed in the previous
part of the video. And then this second line of code is going to subset just for plasma one, two,
three, four because that's what I used to produce the sample dot plot. And again this is a seurat
object that already has the labels. So when I try to find the differentially expressed genes,
it's going to find the differentially expressed genes for the cluster labels that I've already
created and saved in my seurat object. This next line of code is just going to plot a UMAP of
my seurat object that I'm trying to find the differentially expressed genes for. Like I
mentioned before, it's just going to find the differentially expressed genes for plasma one,
two, and three and four. This next line of code is what's going to find the differentially expressed
genes per cell type or per cluster. That will take a minute to run and the function is a
function from seurat called FindAllMarkers. Once that finishes running, it produces a dataframe
that has the differentially expressed genes, which cluster they are differentially expressed in,
the p value, adjusted p value, and also the average log fold change. From that original
dataframe, the next line of code is going to subset for the top five most differentially
expressed genes per cluster. So I group by cluster and then I just want the top five and the weight
I'm using in this case is average log fold change but you can change that to p value, for example.
I'm going to run that next line of code and then the top five object that I save is what I actually
want to plot in my dot plot. In the next line of code, I say to create a dot plot from the seurat
object plasma, then I just want to plot the top five differentially expressed genes per cluster
and then the second line of code uses a function from ggplot2 called coordinate underscore flip
and that's used to flip the X and Y axis of the plot. If I run this final line of code,
it's going to produce the desired dot plot that has the differentially expressed genes,
the top five in each cluster. And that's all I wanted to show in this video.
*chiptune music*