quantiles_matrix: Quantile Matrix Function

View source: R/quantile_matrix.R

quantiles_matrixR Documentation

Quantile Matrix Function

Description

This function is used for get the neighborhood quantile matrix for the raw spatial omics dataset.

Usage

quantiles_matrix(
  data,
  coordinate,
  index,
  distance = NULL,
  NN = NULL,
  min_percentile = 0.1,
  max_percentile = 0.9,
  quantile_number = 21,
  method = pca_,
  ...
)

Arguments

data

a data frame containing the expression information for each cell, like proteins, genes.
This data frame doesn't contains any other columns except expressions, like indices of cells or coordinates of cells.

coordinate

the coordinates of the corresponding cells in the data argument.
It includes two columns with specific names, the first of which is x coordinates of cells,
and the second of which is the y coordinates of cells.

index

the indices of the corresponding cells in the data argument.

distance

the maximal radius of the neighborbood from the center cell.
When we try to find a neighborhood for a particular cell, this cell is called the center cell.
The cells that are more than the given raidus from the center cell are not be included in the center cell's neighborhood.
At least one of NN and dustance arguments should be specified.

NN

the number of the nearest neighbors. The default value is NULL.
It the value is not NULL, the nearest neighborhood method will be applied when we determine the neighborhood for each cell
Only the given number of the closest cells will be included in the center cell's neighborhood.
At least one of NN and dustance arguments should be specified.

min_percentile

the minimal percentile. The default value is 0.1.

max_percentile

the maximal percentile. The default value is 0.9.

quantile_number

the number of quantiles for each variable.
It is used in the function seq(min_percentile, max_percentile, length.out = quantile_numbers) to get the given number of quantiles.

method

the dimension reduction function for the data argument.
The default method is Principal Component Analysis using pca_ function in this package.

...

other parameters passed to the method argument.

Details

The spatial omics dataset could be divided into two parts, the expression matrix and the coordinates.
Firstly, the dimension reduction method like Principle Component Analysis will be applied to the expression matrix.
Then, the neighborhood for each cell will be extracted according to the distance between them.
Next, in each neighborhood, tens of quantiles of each principal component are calculated, which are treated as
neighborhood information vector for each cell.
The final output is a neighborhood quantile matrix, each row of which is the neighborhood quantile vector of
principal components for each cell.

Value

a neighborhood quantile matrix. Each row represents quantiles of reduced features in the neighborhood of one cell.
The first is the number of cells in the corresponding neighborhood, which is used to check whether there are some abnormal neighborhoods.


XTH1114/NBFvis documentation built on Sept. 14, 2022, 1:13 p.m.