Affinity propagation clustering of FlyCircuit neurons
apclusterfc(gns, p = 0, ..., scoremat = getOption("flycircuit.scoremat"), FUN = NULL, maxneurons = 4000)
gns | flycircuit identifiers (passed to |
---|---|
p | input preference (default 0). |
... | additional parameters passed to |
scoremat | name of a file backed matrix containing raw scores. |
FUN | an (optional) function to apply to the mean normalised scores
returned by |
maxneurons | error out if we have more than this many neurons. |
An object of class APResult
.
Given a vector of gene_names/neuron names or neuronids use apcluster to carry out a hierarchical clustering. The default value of FUN will handle square distance matrices and R.
The default input preference of 0 has been chosen because an nblast2 score greater than 0 indicates that pair of neurons show some similarity.
Note that the distance matrix will be converted to a similarity matrix before use with apcluster by calculating 1-d.
maxneurons of 4000 has been chosen to prevent inadvertent clustering of huge numbers of neurons. 4000 is reasonable on a decent laptop.
# NOT RUN { apres <- apclusterfc(names(kcs20)) # Plot cluster exemplars plot3d(apres, db=kcs20) # compare affinity propagation clusters with manually defined types apdf=as.data.frame(apres) type_comparison=cbind(apdf['cluster'], kcs20[apdf$item,'type', drop=F]) table(type_comparison$cluster, type_comparison$type) # Interactively step through clusters, with the examplar plotted in black clear3d() plot3d(apres, db=kcs20, plot='bycluster') # }