I am currently using the flowMatch package in order to match clusters from multiple bootstrap runs applied to the same dataset. However, in quite a proportion of the runs, a certain error warning comes up:
Error in if (mdist < 0) mdist = 0 : missing value where TRUE/FALSE needed
This error only shows up if the clustering tool prior to metaclustering is louvain Clustering but not when I use FlowSOM. Still, also with Louvain Clustering I get these error not everytime but only sometimes.
Does somebody here have experience with flowmatch and/or louvain clustering and can help?
I will not post my actual code here because the underlying analysis is quite massive but I used the flowMatch according to the same scheme as described in the flowMatch Documentation (section 7: Computing template from a collection of samples)
`
load data (20 samples in total)
------------------------------------------------
data(hd)
------------------------------------------------
Retrieve each sample, clsuter it and store the
clustered samples in a list
------------------------------------------------
set.seed(1234) # for reproducable clustering cat('Clustering samples: ') Clustering samples: clustSamples = list() for(i in 1:length(hd.flowSet))
- {
- cat(i, ' ')
- sample1 = exprs(hd.flowSet[[i]])
- clust1 = kmeans(sample1, centers=4, nstart=20)
- cluster.labels1 = clust1$cluster
- clustSample1 = ClusteredSample(labels=cluster.labels1, sample=sample1)
- clustSamples = c(clustSamples, clustSample1)
- } 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20
------------------------------------------------
Create a template from the list of clustered samples
the function returns an object of class "Template"
------------------------------------------------
template = create.template(clustSamples `
In this scheme, this line + cluster.labels1 = clust1$cluster inserts the cluster annotation vector, i.e. the results from your clustering. As I said, with FlowSOM no problem at all but with Louvain clustering in some cases the described error warning shows up.