Combine kNN graphs to large cell-gene adjecency matrix
create_bigraph.Rd
Builds a single adjacency matrix consisting of cells and genes from 4 seperate sub kNN-graphs.
Usage
create_bigraph(
caobj,
k_c,
k_g,
k_cg,
k_gc,
loops = FALSE,
select_genes = TRUE,
prune_overlap = TRUE,
overlap = 0.2,
calc_gene_cell_kNN = FALSE,
marker_genes = NULL,
method = BiocNeighbors::KmknnParam(),
BPPARAM = BiocParallel::SerialParam()
)
Arguments
- caobj
A cacomp object with standard and principal coordinates calculated.
- k_c
k for cell-cell kNN, integer.
- k_g
k for gene-gene kNN, integer.
- k_cg
k for cell-gene kNN, integer.
- k_gc
k for gene-cell kNN, interger.
- loops
TRUE/FALSE. If TRUE self-loops are allowed, otherwise not.
- select_genes
TRUE/FALSE. Should genes be selected by whether they have an edge in the cell-gene kNN graph?
- prune_overlap
TRUE/FALSE. If TRUE edges to genes that share less than
overlap
of genes with the nearest neighbours of the cell are removed. Pruning is only performed if select_genes = TRUE.- overlap
Numeric between 0 and 1. Overlap cutoff applied if prune_overlap = TRUE.
- calc_gene_cell_kNN
TRUE/FALSE. If TRUE a cell-gene graph is calculated by choosing the
k_gc
nearest cells for each gene. If FALSE the cell-gene graph is transposed.- marker_genes
character. Optional. Names of known marker genes that should be excempt from any pruning on the graph and be kept.
- method
BiocNeighbors::BiocNeighborParam object specifying the algorithm to use. see Details.
- BPPARAM
BiocParallel settings parameter. By default single core
BiocParallel::SerialParam()
but other parameters can be passed.
Value
Adjacency matrix of type dgCMatrix
.
The combined adjacency matrix consists of the cell-cell graph, gene-gene
graph and cell-gene/gene-cell graph.
Details
method
should be a kNN algorithm defined by
BiocNeighbors::BiocNeighborParam. For exact kNN search use
BiocNeighbors::KmknnParam()
or BiocNeighbors::VptreeParam()
.