A script that validates that data inputs are correct, and returns a X distance and Y distance matrix for MGC.
mgc.validator(
X,
Y,
is.dist.X = FALSE,
dist.xfm.X = mgc.distance,
dist.params.X = list(method = "euclidean"),
dist.return.X = NULL,
is.dist.Y = FALSE,
dist.xfm.Y = mgc.distance,
dist.params.Y = list(method = "euclidean"),
dist.return.Y = NULL
)is interpreted as:
[n x d] data matrixX is a data matrix with n samples in d dimensions, if flag is.dist=FALSE.
[n x n] distance matrixX is a distance matrix. Use flag is.dist=TRUE.
[n] a vector containing the sample ids for our n samples.
a boolean indicating whether your X input is a distance matrix or not. Defaults to FALSE.
if is.dist == FALSE, a distance function to transform X. If a distance function is passed,
it should accept an [n x d] matrix of n samples in d dimensions and return a [n x n] distance matrix
as the $D return argument. See mgc.distance for details.
a list of trailing arguments to pass to the distance function specified in dist.xfm.X.
Defaults to list(method='euclidean').
the return argument for the specified dist.xfm.X containing the distance matrix. Defaults to FALSE.
is.null(dist.return)use the return argument directly from dist.xfm as the distance matrix. Should be a [n x n] matrix.
is.character(dist.return) | is.integer(dist.return)use dist.xfm.X[[dist.return]] as the distance matrix. Should be a [n x n] matrix.
a boolean indicating whether your Y input is a distance matrix or not. Defaults to FALSE.
if is.dist == FALSE, a distance function to transform Y. If a distance function is passed,
it should accept an [n x d] matrix of n samples in d dimensions and return a [n x n] distance matrix
as the dist.return.Y return argument. See mgc.distance for details.
a list of trailing arguments to pass to the distance function specified in dist.xfm.Y.
Defaults to list(method='euclidean').
the return argument for the specified dist.xfm.Y containing the distance matrix. Defaults to FALSE.
is.null(dist.return)use the return argument directly from dist.xfm.Y(Y) as the distance matrix. Should be a [n x n] matrix.
is.character(dist.return) | is.integer(dist.return)use dist.xfm.Y(Y)[[dist.return]] as the distance matrix. Should be a [n x n] matrix.
A list containing the following:
DThe distance matrix, as a [n x n] matrix.
Ythe sample ids, as a [n] vector.