Sparse Partial Least Squares Discriminant Analysis (sPLS-DA) is a dimensionality reduction and classification method that extends PLS-DA by applying LASSO-based penalization to select a subset of the most discriminative variables on each component, in addition to transforming data from a high-dimensional space into a low-dimensional space while retaining the original data's essential properties.
Usage
dr_splsda(
de_se,
ncomp = 2,
scaling = TRUE,
optimize = FALSE,
clustering = "kmeans",
cluster_num = 2,
kmedoids_metric = NULL,
distfun = NULL,
hclustfun = NULL,
eps = NULL,
minPts = NULL
)Arguments
- de_se
The resulting SummarizedExperiment object from the differential expression analysis function, such as
deSp_twoGroup,deSp_multiGroup,deChar_twoGroup, anddeChar_multiGroup.- ncomp
Numeric. The number of components to include in the model. When
optimize=FALSE, this is the exact number of components used to fit the sPLS-DA model. Whenoptimize=TRUE, this value instead sets the upper bound of components to be tested; the best-performing number of components (based on the balanced error rate from cross-validation) is selected automatically and used to fit the final model. Default is2.- scaling
Logical. If scaling=TRUE, each block is standardized to zero means and unit variances. Default is
TRUE.- optimize
Logical. Whether to perform automatic optimization of the sPLS-DA model using cross-validation. If
TRUE, the function usesmixOmics::tune.splsda()to find the optimal number of components (ncomp) and the optimal number of features to keep per component (keepX) based on the balanced error rate (BER). IfFALSE(default), the model is fitted with the specifiedncompand all features are used (no feature selection via keepX). Default isFALSE.- clustering
Character. The method to be used for clustering. Allowed method include "kmeans", "kmedoids", "hclustering", "dbscan", "group_info". Default is
"kmeans". The option"group_info"is currently available only when the input is a SummarizedExperiment object resulting from differential expression analysis (e.g.,deSp_twoGroup(),deSp_multiGroup()); in this case, dimensionality reduction is performed based on the significant features and group information derived from the DE results.- cluster_num
Numeric. The interpretation of
cluster_numdepends on the value ofclustering:"group_info": A positive integer equal to the number of groups."kmeans"or"kmedoids": A positive integer between 2 and (number of samples - 1)."hclustering": A positive integer between 2 and the number of samples."dbscan": Should beNULL.
Default is
2.- kmedoids_metric
Character. The metric to be used for calculating dissimilarities between observations when choosing
"kmedoids"as clustering method. Must be one of "euclidean" and "manhattan". If "kmedoids" is not selected as the clustering method, set the value to NULL.- distfun
Character. The distance measure to be used when choosing
"hclustering"as clustering method. Allow method include "pearson", "kendall", "spearman", "euclidean", "manhattan", "maximum", "canberra", "binary", and "minkowski". If "hclustering" is not selected as the clustering method, set the value to NULL.- hclustfun
Character. The agglomeration method to be used when choosing
"hclustering"as clustering method. This should be (an unambiguous abbreviation of) one of "ward.D", "ward.D2", "single", "complete", "average" (=UPGMA), "mcquitty" (= WPGMA), "median" (= WPGMC), or "centroid" (= UPGMC). If "hclustering" is not selected as the clustering method, set the value to NULL.- eps
Numeric. The size of the epsilon neighborhood when choosing
"dbscan"as clustering method. If "dbscan" is not selected as the clustering method, set the value to NULL.- minPts
number of minimum points in the eps region (for core points) when choosing dbscan as clustering method.
Value
Return a list with 1 data frame, 1 interactive plot, and 1 static plot.
splsda_result: A data frame of sPLS-DA data.
table_splsda_loading: table for plotting sPLS-DA loading plot.
interacitve_splsda & static_splsda: sPLS-DA plot.
interactive_loadingPlot & static_loadingPlot: sPLS-DA loading plot, display the variables that contribute to the definition of each component.
Examples
data("de_data_twoGroup")
processed_se <- data_process(
de_data_twoGroup, exclude_missing=TRUE, exclude_missing_pct=70,
replace_na_method='min', replace_na_method_ref=0.5,
normalization='Percentage', transform='log10')
deSp_se <- deSp_twoGroup(processed_se, ref_group='ctrl', test='t-test',
significant='pval', p_cutoff=0.05, FC_cutoff=1, transform='log10')
result_splsda <- dr_splsda(deSp_se, ncomp=2, scaling=TRUE, optimize=FALSE,
clustering='group_info', cluster_num=2, kmedoids_metric=NULL,
distfun=NULL, hclustfun=NULL, eps=NULL, minPts=NULL)