clustTrend | R Documentation |
This function clusters the genes dynamics of one gene sets into different
dominant trends. The optimal number of clusters is computed thanks to the gap
statistics. See clusGap
.
clustTrend( tcgs, expr, Subject_ID, TimePoint, threshold = 0.05, myproc = "BY", nbsimu_pval = 1e+06, baseline = NULL, only.signif = TRUE, group.var = NULL, Group_ID_paired = NULL, ref = NULL, group_of_interest = NULL, FUNcluster = NULL, clustering_metric = "euclidian", clustering_method = "ward", B = 100, max_trends = 4, aggreg.fun = "median", na.rm.aggreg = TRUE, trend.fun = "median", methodOptiClust = "firstSEmax", indiv = "genes", verbose = TRUE ) ## S3 method for class 'ClusteredTrends' print(x, ...) ## S3 method for class 'ClusteredTrends' plot(x, ...)
tcgs |
a tcgsa object for |
expr |
either a matrix or dataframe of gene expression upon which
dynamics are to be calculated, or a list of gene sets estimation of gene
expression. In the case of a matrix or dataframe, its dimension are n
x p, with the p sample in column and the n genes in row.
In the case of a list, its length should correspond to the number of gene
sets under scrutiny and each element should be an 3 dimension array of
estimated gene expression, such as for the list returned in the
|
Subject_ID |
a factor of length p that is in the same order as the
columns of |
TimePoint |
a numeric vector or a factor of length p that is in
the same order as |
threshold |
the threshold at which the FDR or the FWER should be controlled. |
myproc |
a vector of character strings containing the names of the
multiple testing procedures for which adjusted p-values are to be computed.
This vector should include any of the following: " |
nbsimu_pval |
the number of observations under the null distribution to
be generated in order to compute the p-values. Default is |
baseline |
a character string which is the value of |
only.signif |
logical flag for analyzing the trends in only the
significant gene sets. If |
group.var |
in the case of several treatment groups, this is a factor of
length p that is in the same order as |
Group_ID_paired |
a character vector of length p that is in the
same order as |
ref |
the group which is used as reference in the case of several
treatment groups. Default is |
group_of_interest |
the group of interest, for which dynamics are to be
computed in the case of several treatment groups. Default is |
FUNcluster |
the clustering function used to agglomerate genes in
trends. Default is |
clustering_metric |
character string specifying the metric to be used
for calculating dissimilarities between observations in the hierarchical
clustering when |
clustering_method |
character string defining the agglomerative method
to be used in the hierarchical clustering when |
B |
integer specifying the number of Monte Carlo ("bootstrap") samples
used to compute the gap statistics. Default is |
max_trends |
integer specifying the maximum number of different clusters
to be tested. Default is |
aggreg.fun |
a character string such as |
na.rm.aggreg |
a logical flag indicating whether |
trend.fun |
a character string such as |
methodOptiClust |
character string indicating how the "optimal" number
of clusters is computed from the gap statistics and their standard
deviations. Possible values are |
indiv |
a character string indicating by which unit observations are
aggregated (through |
verbose |
logical flag enabling verbose messages to track the computing
status of the function. Default is |
x |
an object of class ' |
... |
further arguments passed to or from other methods. |
If expr
is a matrix or a dataframe, then the genes dynamics are
clustered on the "original" data. On the other hand, if expr
is a
list returned in the 'Estimations'
element of TcGSA.LR
,
then the dynamics are computed on the estimations made by the
TcGSA.LR
function.
This function uses the Gap statistics to determine the optimal number of
clusters in the plotted gene set. See
clusGap
.
An object of class ClusteredTrends which is a list with the 4 following components:
NbClust
a vector that contains the optimal number of clusters for
each analyzed gene sets.
ClustsMeds
a list of the same length as NsClust
(the
number of analyzed gene sets). Each element of the list is a data frame, in
which there is as many column as the optimal number of clusters for the
corresponding gene sets for each cluster. Each column of the data frame
contains the median trend values for the corresponding cluster.
GenesPartition
a list of the same length as NsClust
(the
number of analyzed gene sets). Each element of the list is a vector which
gives the partition of the genes inside the corresponding gene set.
MaxNbClust
an integer storing the maximum number of different
clusters tested, as given by the argument 'max_trends'
.
Boris P. Hejblum
Tibshirani, R., Walther, G. and Hastie, T., 2001, Estimating the number of data clusters via the Gap statistic, Journal of the Royal Statistical Society, Series B (Statistical Methodology), 63, 2: 41–423.
plot1GS
, TcGSA.LR
,
clusGap
if(interactive()){ data(data_simu_TcGSA) tcgsa_sim_1grp <- TcGSA.LR(expr=expr_1grp, gmt=gmt_sim, design=design, subject_name="Patient_ID", time_name="TimePoint", time_func="linear", crossedRandom=FALSE) CT <- clustTrend(tcgsa_sim_1grp, expr=expr_1grp, Subject_ID=design$Subject_ID, TimePoint=design$TimePoint) CT plot(CT) CT$NbClust CT$NbClust["Gene set 5"] CT$ClustMeds[["Gene set 4"]] CT$ClustMeds[["Gene set 5"]] }
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.