Summing data from 3 different parts of an R object at once
1
1
Entering edit mode
5.1 years ago
cook.675 ▴ 230

I have 3 replicate samples from a scRNA seq experiment; call them V1, V2, V3. I merged them into one large object "Object". When I merged them I appended the replicate name to the column barcodes, for example V2_ATGGAGTGGAT etc...

Object has a meta data column for cell cycle state located at Object$"Phase" . These are either "G1", "G2M", or "S; The Object also has cluster information that is located at Object$"seurat_clusters"

What I want to do is; for each replicate sum the number of cells in cluster x that are in cell phase "y"

So for example: For V1, sum the number of cells in G1 that are in cluster 1. Then I will repeat this for all clusters and cell phases and replicates to plot some data.

I can get the cluster and phase cell sum here: V.G1 <- sum(Object$"Phase" == "G1" & Object$"seurat_clusters" == 0)

But its not clear how to specify the replicate identifier for this operation?

Thanks!

R seurat scRNA seq • 800 views
ADD COMMENT
0
Entering edit mode
5.1 years ago
cook.675 ▴ 230

guys I got it!!!

X <- sum(Object$orig.ident == "V1" & Object$"Phase" == "G1" & 
          Object$"seurat_clusters" == 0)
ADD COMMENT

Login before adding your answer.

Traffic: 1736 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