Closed TiamHeydari closed 2 years ago
Hi @TiamHeydari ,
Based on your code, I'm guessing that adata_ent
is a SingleCellExperiment
object? If that's true, you should be able to use any of the dimensionality reductions it contains when you run Slingshot. For example, if you had a UMAP matrix in the reducedDims
slot, you could run Slingshot exactly as you have, but with "UMAP" in place of "PCA". And it doesn't have to be UMAP, any matrix with the right number of cells can be added as a dimensionality reduction via reducedDim(adata_ent, "name") <- x
(where x
is the matrix).
Hope this helps! Kelly
Thanks, @kstreet13! It worked.
Hi, I want to perform the dimensional reduction in another platform and then use that coordinate in my slingshot. I don't know how to do so and I really appreciate your help. Thanks!
I use a code like this, adata_ent also have my arbitrary coordinates in it, but this code uses the PCA that slingshot infers:
colour_map = brewer.pal(20,'Set1') par(xpd=TRUE) par(mar=c(4.5,5.5,2,7)) plot(reducedDims(adata_ent)$PCA[,1], reducedDims(adata_ent)$PCA[,2], col=colour_map[colData(adata_ent)$louvain2], bty='L', xlab='PC1', ylab='PC2') legend(x=12, y=12, legend=unique(colData(adata_ent)$louvain2), fill=colour_map[as.integer(unique(colData(adata_ent)$louvain2))])
print("1:") adata_ent_start <- slingshot(adata_ent, clusterLabels = Cluster_labels, reducedDim = 'PCA', start.clus=traj_1_s) print(SlingshotDataSet(adata_ent_start))