apclusterfc: Affinity propagation clustering of FlyCircuit neurons

View source: R/clustering.R

apclusterfcR Documentation

Affinity propagation clustering of FlyCircuit neurons

Description

Affinity propagation clustering of FlyCircuit neurons

Usage

apclusterfc(
  gns,
  p = 0,
  ...,
  scoremat = getOption("flycircuit.scoremat"),
  FUN = NULL,
  maxneurons = 4000
)

Arguments

gns

flycircuit identifiers (passed to fc_gene_name).

p

input preference (default 0).

...

additional parameters passed to apcluster.

scoremat

name of a file backed matrix containing raw scores.

FUN

an (optional) function to apply to the mean normalised scores returned by fc_subscoremat. Default NULL.

maxneurons

error out if we have more than this many neurons.

Details

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.

Value

An object of class APResult.

See Also

apcluster,fc_gene_name

Examples

## 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')

## End(Not run)

natverse/flycircuit documentation built on Jan. 26, 2023, 6:46 p.m.