neuprint_cosine_matrix: Calculate a cosine similarity matrix for neuprint neurons

View source: R/cosine.R

neuprint_cosine_matrixR Documentation

Calculate a cosine similarity matrix for neuprint neurons

Description

Calculate a cosine similarity matrix for neuprint neurons

Usage

neuprint_cosine_matrix(
  ids,
  ...,
  threshold = 5,
  partners = c("outputs", "inputs"),
  group = FALSE,
  groupfun = NULL,
  details = NULL,
  conn = NULL
)

Arguments

ids

Passed to neuprint_ids

...

Optional filter expression defining which partners to include

threshold

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

partners

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

group

Whether to group by cell type or another named column.

groupfun

A function which receives the metadata for all partner neurons and returns a single grouping vector (see the details section).

details

Optional character vector naming metadata columns to fetch for partner neurons.

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.

Details

For most purposes you can use neuprint_cosine_plot directly, but it can sometimes be useful to use neuprint_cosine_matrix to have more control over how partner neurons are grouped (see e.g. groupfun) or which partner neurons are included in the results (.

The groupfun argument can be a powerful way to construct flexible grouping strategies for partner neurons. It was added in order to use information present in fields such as the group, serial or instance/name columns in the male VNC/CNS datasets. It will receive as input a dataframe and expects to receive a single vector of length matching the number of rows in the input dataframe. The input dataframe will contain the standard columns returned by neuprint_connection_table but you can request extra columns if necessary by naming them in the group argument.

Value

matrix or list of two matrices (input and output)

See Also

neuprint_cosine_plot

Examples


# NB the second (unnamed argument) filters the partner neurons
# so that only those with type containing the regular expression ORN are used
neuprint_cosine_matrix("/DA[1-3].*PN", grepl("ORN",type), partners='in')


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