sparse_score_mat: Convert a subset of a square score matrix to a sparse...

View source: R/scoremats.r

sparse_score_matR Documentation

Convert a subset of a square score matrix to a sparse representation

Description

This can be useful for storing raw forwards and reverse NBLAST scores for a set of neurons without having to store all the uncomputed elements in the full score matrix.

Usage

sparse_score_mat(neuron_names, dense_matrix)

Arguments

neuron_names

a character vector of neuron names to save scores for.

dense_matrix

the original, dense version of the full score matrix.

Value

A spare matrix, in compressed, column-oriented form, as an R object inheriting from both CsparseMatrix-class and generalMatrix-class.

See Also

fill_in_sparse_score_mat

Examples

data(kcs20, package = "nat")
scores=nblast_allbyall(kcs20)
scores.3.sparse=sparse_score_mat(names(kcs20)[3], scores)
scores.3.sparse
# can also add additional submatrices
fill_in_sparse_score_mat(scores.3.sparse,scores[3:6,3:4])

nat.nblast documentation built on July 9, 2023, 6:12 p.m.