neuprint_cosine_plot: Plot cosine clustering of neuprint/hemibrain neurons

View source: R/cosine.R

neuprint_cosine_plotR Documentation

Plot cosine clustering of neuprint/hemibrain neurons

Description

Plot cosine clustering of neuprint/hemibrain neurons

Usage

neuprint_cosine_plot(
  x,
  partners = c("inputs", "outputs"),
  threshold = 5,
  method = c("ward.D", "single", "complete", "average", "mcquitty", "median", "centroid",
    "ward.D2"),
  group = FALSE,
  labRow = "{type}",
  heatmap = FALSE,
  interactive = FALSE,
  nas = c("zero", "drop"),
  conn = NULL,
  ...
)

Arguments

x

Query ids. May including searches in the style of neuprint_ids

partners

Whether to cluster based on connections to input or output partner neurons (default both).

threshold

An integer threshold (connections >= this will be returned)

method

The cluster method to use (see hclust)

group

Whether to group by cell type or another named column.

labRow

A vector defining the row labels. If it is a character vector length 1 containing any curly braces it will be interpreted as a glue string for interpolation, using the data.frame returned by neuprint_get_meta as a source of information.

heatmap

A logical indicating whether or not to plot the heatmap OR a function to plot the heatmap whose argument names are compatible with stats::heatmap. gplots::heatmap.2 is a good example. Defaults to TRUE therefore plotting the full heatmap with stats::heatmap.

interactive

Whether to plot an interactive heatmap (allowing zooming and id selection). See details.

nas

What to do with entries that have NAs. Default is to set them to 0 similarity.

conn

optional, a neuprintr connection object, which also specifies the neuPrint server. If NULL, the defaults set in your .Rprofile or .Renviron are used. See neuprint_login for details.

...

Additional arguments passed to heatmap

Details

Note that when interactive=TRUE you must have external packages including InteractiveComplexHeatmap installed with the coconat package. If you are using Rstudio, we recommend using an external browser (e.g. Chrome) rather than the built-in browser, especially for larger heatmaps.

Value

The result of heatmap invisibly including the row and column dendrograms or, when heatmap=FALSE, a stats::hclust object.

See Also

neuprint_cosine_matrix, heatmap, hclust

Examples


neuprint_cosine_plot("/DA[1-3].*PN", partners='in')

## Not run: 
# Considering all partners
neuprint_cosine_matrix("/lLN2.+", partners='in') %>% neuprint_cosine_plot()
# excluding the PN partners from the cosine distance score
neuprint_cosine_matrix("/lLN2.+", !grepl("PN",type), partners='in') %>% neuprint_cosine_plot()
# just use PN partners for cosine distance score
neuprint_cosine_matrix("/lLN2.+", grepl("PN",type), partners='in') %>% neuprint_cosine_plot()

# interactive heatmap allowing zooming and id selection
neuprint_cosine_plot("/lLN2.+",  partners='out', interactive=TRUE)

## End(Not run)

natverse/neuprintr documentation built on Sept. 15, 2023, 6:59 a.m.