ImmuneDynamics / Spectre

A computational toolkit in R for the integration, exploration, and analysis of high-dimensional single-cell cytometry and imaging data.
https://immunedynamics.github.io/spectre/
MIT License
56 stars 21 forks source link

Error when running run.flowsom with meta.k set to 2 #166

Closed jamesboot closed 1 year ago

jamesboot commented 1 year ago

Hello,

Thanks for a great package and documentation. Ran into an interesting problem. We are playing around with our clustering. When I set meta.k to 2 in the run.flowsom() function I get the following error:

Preparing data
Starting FlowSOM
Building SOM

Mapping data to SOM

Building MST

Error in 1:nrow(m) : argument of length 0

I don't get this error if I set the value greater than 2. Is there a reason for this? Any work around?

Cheers!

ghar1821 commented 1 year ago

Hi there,

I think this is because the consensus hierarchical clustering algorithm used by FlowSOM by default try to cluster the data into 2 to maxK clusters. By setting meta.k to 2, you are indirectly also setting maxK to 2, which causes the consensus hierarchical clustering algorithm to raise an error as it expects maxK to be greater than 2.

I don't think there is any work around this unfortunately.

tomashhurst commented 1 year ago

@ghar1821 I might add a more specific error message to run.flowsom to flag this if meta.k is set to 2.