Closed choinc615 closed 4 years ago
Hi, Yes I think you can do it, you must merge the data from the two Seurat objects:
cluster.1 = as.numeric(Idents(seurat.1))
data.1 = data.frame(seurat.1[["RNA"]]@data)
cluster.2 = as.numeric(Idents(seurat.2)) + max(cluster.1)
data.2 = data.frame(seurat.2[["RNA"]]@data)
cluster = c(cluster.1, cluster.2)
data = cbind(data.1, data.2)
Then you can use data
and cluster
in the cell_signaling
function of SCSR.
I advise you to create a c.names
vector (see documentation) to keep a good track of your different clusters.
Thank you for using SingleCellSignalR.
SCA
Thanks for the fast response. Will give this a try and let you know if it would work :)
Hi,
Thank you for your response.
I have attempted to follow your advice and updated my script as below:
cluster.treg = as.numeric(Idents(kal9Subset)) cnames.treg <- paste0("treg", cluster.treg)
data.treg = data.frame(kal9Subset[["RNA"]]@data) all.genes.treg <- rownames(kal9Subset) nrow(data.treg) # 14461
cluster.skin = as.numeric(Idents(kasp9)) cnames.skin <- paste0("skin", cluster.skin) data.skin = data.frame(kasp9[["RNA"]]@data) all.genes.skin <- rownames(kasp9) nrow(data.skin) #13834
data.treg = subset(data.treg, rownames(data.treg)%in%rownames(data.skin)) # After this, the number in data.treg is reduced to 12686, which is less than that of skin. data.skin = subset(data.skin, rownames(data.skin)%in%rownames(data.treg)) # I will therefore also shrink the skin data. After this, I am left with also 12686 genes. I can now combine the two tables.
data.combined = cbind(data.treg,data.skin) all.genes.combined = rownames(data.combined) cluster.combined = c(cluster.treg,cluster.skin) cnames.combined = c(cnames.treg,cnames.skin)
length(cluster.combined) # 8961 length(cnames.combined) #8961
signal = cell_signaling(data=data.combined,genes=all.genes.combined,cluster=cluster.combined, species = "mus musculus") signal
After running all the analysis, the signal gives me the interactions between clusters 1 to 13. My understanding is that the function is unable to discriminate between cluster 1 from the Treg data and cluster 1 from Skin data.
I have tried to get around the problem by adding the c.names vector as you suggested. How I compiled the c.vector is written above, where I use the paste function.
Upon running the analysis with the c.names argument as below: signal = cell_signaling(data=data.combined,genes=all.genes.combined,cluster=cluster.combined, c.names=cnames, species = "mus musculus")
I get the following error message: The length of c.names must be equal to the number of clusters and must contain no duplicates. The cluster names must not include special characters
I have attempted several different ways to address this error: 1) made the length of c.names and the number of clusters the same 2) Manually defined a list of cluster names to c.names 3) removed all the special characters and spaces. But none of them worked.
I am assuming at this stage that the problem is maybe because of the cluster variable. It seems that the function recognises cluster 1 from Treg and cluster 2 from Tregs in the same way. In other words, it recognises the two different clusters as 1 cluster. Therefore, the function sees that the number of clusters are actually less than what they really are.
Is there a way to address this? It seems to me that the clusters have to be in numerics.
Thanks,
Inchul
Hi,
As I told you, you need to add max(cluster.1) to cluster 2:
cluster.skin = as.numeric(Idents(kasp9)) + max(cluster.treg)
For the c.names vectors:
cnames.treg <- paste0("treg", unique(cluster.treg))
cnames.skin <- paste0("skin", unique(cluster.skin))
should work.
SCA
Thanks. This has worked :). For those interested, to make the distinction between Tregs and skin clusters a little easier, I have used: cluster.skin = as.numeric(Idents(kasp9)) + 100
instead of the suggested: cluster.skin = as.numeric(Idents(kasp9)) + max(cluster.treg)
Skin clusters then have 3 digits, which makes them easier to distinguish. But this is personal preference.
Hi,
Thank you for the very interesting tool.
In the demo files, you have provided ways to load up one Seurat object and process it further for this package.
I want to determine whether there is interaction between the immune cells and the skin cells. To that end, I have performed some clustering using Seurat. To that end, I have generated two different Seurat objects and want to know study the interaction between the clusters found within the different Seurat objects.
Is there a way to integrate the two objects after the clustering analysis and use it for your SCSR?
Many thanks!
Inchul