SCA-IRCM / SingleCellSignalR

R package for Bioconductor submission
30 stars 12 forks source link

How to use previous clustering #18

Closed sylvia-science closed 2 years ago

sylvia-science commented 3 years ago

Hi,

I have data that I've already clustered and annotated. How do I input this info into the cluster_analysis and cell_signaling functions?

From my understanding the cluster and c.names variables are unique vectors of the cluster names, not a vector of each cluster name corresponding to each cell. So right now it doesn't looks like I'm giving enough info to the function to tell it which cell has which cluster name.

Currently when I run the line below, I get the following error. Here, cell_type is a variable that has the cluster names of each cell.

clust.ana <- cluster_analysis(data = data, genes = rownames(data), cluster = 1:length(unique(cell_type)), c.names = unique(cell_type), write = FALSE)

Error in glmFit.default(sely, design, offset = seloffset, dispersion = 0.05, : nrow(design) disagrees with ncol(y)

SCA-IRCM commented 3 years ago

Hi, The cluster parameter is a numeric vector of length the number of columns of data. For example if your dataset has 10 columns and columns 1, 3 and 7 belong to cluster 1 and columns 2, 4, 5, 6, 8, 9 and 10 belong to cluster 2, the cluster vector will be : cluster = c(1, 2, 1, 2, 2, 2, 1, 2, 2, 2) and c.names = c("cluster 1", "cluster 2"). I hope this is clear and helps you out.

Thanks for using SingleCellSignalR !

SCA