
Convert proximity score table to an Assay or Assay5
ProximityScoresToAssay.RdConvert proximity score table to an Assay or Assay5
Usage
ProximityScoresToAssay(object, ...)
# S3 method for class 'tbl_lazy'
ProximityScoresToAssay(
object,
values_from = "log2_ratio",
separator = ":",
...
)
# S3 method for class 'data.frame'
ProximityScoresToAssay(
object,
values_from = "log2_ratio",
separator = ":",
...
)
# S3 method for class 'PNAAssay'
ProximityScoresToAssay(
object,
values_from = "log2_ratio",
separator = ":",
lazy = FALSE,
...
)
# S3 method for class 'PNAAssay5'
ProximityScoresToAssay(
object,
values_from = "log2_ratio",
separator = ":",
lazy = FALSE,
...
)
# S3 method for class 'Seurat'
ProximityScoresToAssay(
object,
assay = NULL,
new_assay = NULL,
values_from = "log2_ratio",
separator = ":",
lazy = FALSE,
...
)Arguments
- object
An object with proximity scores
- ...
Not yet implemented
- values_from
A single string defining what column in the proximity score table to pick values from. Default is "log2_ratio".
- separator
A character to separate marker names in the row names of the output. Default is ":". Must be a single character and must not appear in any marker name.
- lazy
Whether to look for proximity scores in the PXL file instead of the
Assay/Assay5object.- assay
Name of the
PNAAssayorPNAAssay5to pull proximity scores from- new_assay
Name of the
AssayorAssay5to store the wide formatted spatial metric in
Behavior
Takes an object with PNA proximity scores in long format and returns an object with proximity scores in a wide format. The proximity score table must contain the following columns:
"marker_1": the name of the first marker in the pair
"marker_2": the name of the second marker in the pair
"component": the name of the component
a column with the proximity scores to be used as values in the wide format (defined by the
values_fromparameter)
The wide format is an array-like object with dimensions pair x components,
where pair is defined as the combination of "marker_1" and "marker_2" separated by the separator,
and where each element in the array is filled with a value for a selected spatial metric.
Note that observations that are missing from the proximity score table are replaced with 0's. Proximity scores can also be 0 (no deviation from random expectations), and it will not be possible to distinguish between these two cases in the output.
Different outputs are returned depending on the input object type:
tibble/data.frame: returns adgCMatrixwith marker pairs in rows and components in columns. The components are not ordered in any particular way and should therefore be ordered before placing them in e.g. a Seurat object.PNAAssay/PNAAssay5: returns anAssayorAssay5with marker pairs in rows and components in columns. Columns are ordered according to the order of the components in thePNAAssay/PNAAssay5.Seuratobject: returns theSeuratobject with a newAssayorAssay5with marker pairs in rows and components in columns. Columns are ordered according to the order of the components in theSeuratobject.
As many methods provided in Seurat operates on Assay/Assay5
objects, it can sometimes be convenient to make this conversion if you
wish to use these methods on spatial metrics in the proximity score table.
For instance, if we want to compute a UMAP on the proximity scores with
RunUMAP, we need the values to be formatted in an Assay/Assay5.
This also makes it possible to use various visualization functions such as
VlnPlot or FeaturePlot to show the distribution of proximity scores.
See also
Other Spatial metrics conversion methods:
ColocalizationScoresToAssay(),
PolarizationScoresToAssay()