This function detects the valley locations either between every two peak landmarks or cut at the right heavy tails. If the specified positive uni-peak, the valley location will be set at the left side of the uni-peak.
get_valley_location(
cell_x_adt = NULL,
cell_x_feature = NULL,
adt_marker_select = NULL,
peak_mode_res = NULL,
shoulder_valley = TRUE,
positive_peak = NULL,
multi_sample_per_batch = FALSE,
adjust = 1.5,
min_fc = 20,
shoulder_valley_slope = -1,
lower_peak_thres = 0.01,
neg_candidate_thres = asinh(10/5 + 1),
arcsinh_transform_flag = TRUE
)
Matrix of ADT raw counts in cells (rows) by ADT markers (columns) format.
Matrix of cells (rows) by cell features (columns) such as cell type, sample, and batch-related information.
Markers to normalize. Leaving empty to process all the ADT markers in the cell_x_adt matrix.
The peak landmark results coming out of get_peak_mode
or get_peak_midpoint
function.
Indictor to specify whether a shoulder valley is expected in case of the heavy right tail where the population of cells should be considered as positive population.
A list variable containing a vector of ADT marker(s) and a corresponding vector of sample name(s) in matching order to specify that the uni-peak detected should be aligned to positive peaks. For example, for samples that only contain T cells. The only CD3 peak should be aligned with the positive peaks of other samples.
Set it to TRUE to discard the positive peak that only appears in one sample per batch (sample number is >=3 per batch).
Parameter for density
function: bandwidth used is actually adjust*bw. This makes it easy to specify values like 'half the default' bandwidth.
Mimimal fold change between the highest peak density height and candidate valley density height. The default is 20.
The slope on the ADT marker density distribution to call shoulder valley.
The minimal ADT marker density height to call it a real peak. Set it to 0.01 to avoid suspicious positive peaks. Set it to 0.001 or smaller to include some small but tend to be real positive peaks, especially for markers like CD19.
The upper bound for the negative peak. Users can refer to their IgG samples to obtain the minimal upper bound of the IgG sample peak. It can be one of the values of asinh(4/5+1), asinh(6/5+1), or asinh(8/5+1) if the right 95% quantile of IgG samples is large.
The flag indicates if the input is raw count and arcsinh transformation is implemented.
if (FALSE) {
get_valley_location(cell_x_adt, cell_x_feature, peak_mode_res)
}