library(SPEAR)
This vignette will highlight the main plotting functions in the SPEAR package.
Plots depend on the family
parameter (gaussian
, binomial
,
ordinal
, or multinomial
).
Current Plotting Functions:
plot.factor.scores
plot.embedding
plot.contributions
plot.feature.expression
plot.features
plot.cv.loss
plot.predictions
plot.circos
plot.network
plot.coefficients
plot.probabilities
plot.factor.scores
Plot factor scores from a SPEARobject for a particular dataset data
.
Parameters:
data
- Which dataset to use? Can be any dataset listed under
SPEARobj$data$____
. Defaults to "train"
.
cv
- If data = "train"
, get factor scores generated from
$run.cv.spear(...)
? If $run.spear(...)
was used or if
data != "train"
this parameter is ignored. Defaults to FALSE
.
NOTE: There is an element of randomness if the factor scores are not
correlated with the response, so it is recommended to view the
factor scores with cv = FALSE
group
- What to plot on the x.axis? Defaults to “response”
(indicated by SPEARobj$options$current.response.idx
), but can be
any feature name found in colnames(SPEARobj$data$train$X)
factors
Which factors to show? Defaults to NULL
(all factors).
Use a vector of integers (i.e. c(1, 2, 4)
) to specify fewer
factors.
show.legend
Show the legend of the plot (for group
)? Defaults to
TRUE
Examples:
# Default Parameters:
# Plot CV factor scores vs. Response:
SPEARobj$plot.factor.scores()
# Use a feature name found in colnames(SPEARobj$data$train$X):
feature.name <- "OmicsData4_feat194"
SPEARobj$plot.factor.scores(group = feature.name)
plot.embedding
Plot factor scores on x and y axis from a SPEARobject for a particular
dataset data
.
Parameters:
data
- Which dataset to use? Can be any dataset listed under
SPEARobj$data$____
. Defaults to "train"
.
cv
- If data = "train"
, get factor scores generated from
$run.cv.spear(...)
? If $run.spear(...)
was used or if
data != "train"
this parameter is ignored. Defaults to FALSE
.
NOTE: There is an element of randomness if the factor scores are not
correlated with the response, so it is recommended to view the
factor scores with cv = FALSE
group
- How to color points? Defaults to “response” (indicated by
SPEARobj$options$current.response.idx
), but can be any feature
name found in colnames(SPEARobj$data$train$X)
x
Which factor to show on the x axis? Defaults to 1
.
y
Which factor to show on the y axis? Defaults to 2
.
show.legend
Show the legend of the plot (for group
)? Defaults to
TRUE
Examples:
# Default Parameters:
# Factor 1 vs. Factor 2, colored by response
SPEARobj$plot.embedding()
# Different factors
SPEARobj$plot.embedding(x = 3, y = 4)
# Color by a feature:
# Get the top contributing feature for Factor 1:
feature.name <- SPEARobj$get.features(factors = 1)$Feature[1]
# Color by the top contributing feature ('OmicsData4_feat194')
SPEARobj$plot.embedding(group = "OmicsData4_feat194")
plot.contributions
Plot factor contributions for a SPEARobject.
Parameters:
do.X
Calculate contributions for X? Defaults to TRUE
do.Y
Calculate contributions for Y? Defaults to TRUE
Examples:
SPEARobj$plot.contributions()
SPEARobj$plot.contributions(do.X = FALSE)
plot.feature.expression
Plot features from a SPEARobject.
Parameters:
factor
Which factor to return features for? Accepts a single
integer or factors = 1
) Defaults to 1
(factor 1).
datasets
Which datasets? Check names via
names(SPEARobject$data$train$Xlist)
. Defaults to NULL
(all)
order.by.factor.score
Order the samples by factor score? Defaults
to TRUE
order.by.sign
Order the samples by projection.coefficient sign?
Defaults to TRUE
show.factor.scores
Should the factor scores be plotted on top of
the heatmap? Defaults to TRUE
data
Which data? Defaults to "train"
.
cv
Use CV factor scores
rank
How to rank features? Defaults to "probability"
(joint.probability) followed by projection.coefficient. Can also be
+cent
” (only projection.coefficient magnitude) .
coefficient.cutoff
What projection.coefficient value to use as the
cutoff? Defaults to 0
probability.cutoff
What joint.probability value to use as the
cutoff? Defaults to .95
plot.by.dataset
Should the features be separated by dataset?
Defaults to TRUE
show.top.n
Stop showing features after the top stop.by.n
features. Defaults to 50. Set to a number higher than the total
features to plot all of them .
show.all.names
Should all feature names be shown? Defaults to
FALSE (if num.features > 100, can be very crowded).
abbrev.names
Abbreviate long feature names to 20 characters?
Defaults to TRUE.
dark
Use dark theme? Defaults to TRUE
# Defaults to Factor 1:
SPEARobj$plot.feature.expression()
# Show different factor:
# Set different probability cutoff:
SPEARobj$plot.feature.expression(factor = 2, probability.cutoff = .975)
# Hide the factor scores:
SPEARobj$plot.feature.expression(show.factor.scores = FALSE)
# Disable the dark color scheme
SPEARobj$plot.feature.expression(dark = FALSE)
plot.features
Plot features from a SPEARobject.
Parameters:
rank
How to rank features? Defaults to "probability"
(joint.probability
) followed by projection.coefficient.
Can also
be “coefficient
” (only projection.coefficient
magnitude).
factor
Which factors to return features for? Accepts integers
(i.e. factors = c(1,2,4)
or factors = 1
) Defaults to NULL
(all).
datasets
Which datasets? Check names via
names(SPEARobject$data$train$Xlist)
. Defaults to NULL
(all)
coefficient.cutoff
What projection.coefficient
value to use as
the cutoff? Defaults to 0
probability.cutoff
What joint.probability
value to use as the
cutoff? Defaults to .95
plot.by.dataset
Should the features be separated by dataset?
Defaults to TRUE
show.top.n
Stop showing features after the top stop.by.n
features. Defaults to 100.
Set to a number higher than the total
number of features to plot all of them.
abbrev.names
Abbreviate long feature names to 20 characters?
Defaults to TRUE.
Examples:
# Default: Get top features > .95 joint.probability for Factor 1 (for current w.idx model):
SPEARobj$plot.features()
# Loosen the cutoffs: (set probability.cutoff to .5 instead of .95, default)
SPEARobj$plot.features(probability.cutoff = .75)
SPEARobj$plot.features(factor = 4)
# Plot features by their order, ignoring dataset grouping:
SPEARobj$plot.features(plot.by.dataset = FALSE)
plot.cv.loss
Plot the mean cross validated error for a SPEAR model trained with
run.cv.spear()
and cv.evaluate()
.
Parameters:
show.labels
Show the mean cv error labels? Defaults to TRUE
Examples:
SPEARobj$plot.cv.loss()
SPEARobj$plot.cv.loss(show.labels = FALSE)
plot.factor.correlations
Plot factor score correlations for various SPEAR models (w.idxs)
Parameters:
factors
Which factors to return features for? Accepts integers
(i.e. factors = c(1,2,4)
or factors = 1
) Defaults to NULL
w.idxs Which w.idxs (models) to use? Accepts integers (i.e.
w.idxs
= c(1,2,4)or
w.idxs = 1) Defaults to
NULL` (all).
data
Which dataset to use? Can be any dataset listed under
$data$____
. Defaults to "train"
.
cv
If data = "train"
, get factor scores generated from
$run.cv.spear
? If $run.spear
was used or if data != "train"
this is ignored. Defaults to TRUE
.
method
Which correlation method to use? Defaults to spearman
.
Accepts spearman
, pearson
, and kendall
.
label
How to label/distinguish factors per model? Defaults to x
(label with w.x). Accepts x
, y
, xy
, idx
, all
.
sig.cutoff
When to plot an asterisk (*)? Will plot if p.value
from cor.test
is <= sig.cutoff
. Defaults to .05
Examples:
SPEARobj$plot.factor.correlations()
# Choose specific SPEAR models (via w.idx)
SPEARobj$plot.factor.correlations(w.idxs = c(1, 2, 3))
# Choose specific factors:
SPEARobj$plot.factor.correlations(factors = c(1, 2))
# Choose specific factors:
SPEARobj$plot.factor.correlations(factors = c(1, 2))
plot.predictions
Plot predictions from a SPEARobject and a dataset data
.
Parameters:
data
Which dataset to use? Can be any dataset listed under
$data$____
. Defaults to "train"
.
cv
If data = "train"
, get factor scores generated from
$run.cv.spear
? If $run.spear
was used or if data != "train"
this parameter is ignored. Defaults to TRUE
.
color.by.error
Should gaussian data be colored by squared residual
error? Defaults to TRUE
Examples:
SPEARobj$plot.predictions()
SPEARobj$plot.predictions(color.by.error = FALSE)
plot.circos
Plot a circos plot (chord diagram) for a correlation matrix supplied.
Rows and columns need to be found in colnames(SPEARobj$data$train$X)
.
Parameters:
correlation.matrix
Which factors to return features for? Accepts
integers (i.e. factors = c(1,2,4)
or factors = 1
) Defaults to
NULL
(all).
correlation.cutoff
What is the correlation cutoff to be included
in the plot? Defaults to 0.5
allow.same.dataset
Should connections within the same dataset be
plotted? Defaults to FALSE
sign
Which direction of correlations to show? Can be "both"
(default), "pos"
(positive), or "negative"
(negative).
highlight.feature
Should one feature be highlighted in the plot?
Can be a string (the feature name). Feature must be found in the
final plot to be highlighted. Defaults to NULL
(no highlighting)
highlight.color
What color to highlight the highlight.feature
connections? Defaults to "black"
highlight.emphasis
How much should the highlight.feature
connections be emphasized? 1
will put the same size as other
connections. Defaults to 2.5
Examples:
# If no correlation.matrix argument is supplied, will automatically make
# one for Factor 1 with SPEARobj$get.correlation.matrix()
SPEARobj$plot.circos(correlation.cutoff = .3)
## No argument passed for correlation.matrix, getting correlation matrix default (for Factor 1)...
## Getting correlation matrix for Factor 1
## Found 32 features for Factor 1
## Beginning pearson correlation tests for 32 features
## 0----------50--------100%
## ====================
## Plotting the following correlations with magnitude > 0.3:
## - OmicsData1 | 0
## - OmicsData2 | 0
## - OmicsData3 | 11
## - OmicsData4 | 6
## Warning in par(c(0, 0, 0, 0)): argument 1 does not name a graphical parameter
# Use the get.correlation.matrix function to get a correlation matrix:
correlation.matrix <- SPEARobj$get.correlation.matrix(factor = 4)
## Getting correlation matrix for Factor 4
## Found 34 features for Factor 4
## Beginning pearson correlation tests for 34 features
## 0----------50--------100%
## ======================
SPEARobj$plot.circos(correlation.matrix, correlation.cutoff = .1)
## Plotting the following correlations with magnitude > 0.1:
## - OmicsData1 | 15
## - OmicsData2 | 19
## - OmicsData3 | 0
## - OmicsData4 | 0
## Warning in par(c(0, 0, 0, 0)): argument 1 does not name a graphical parameter
# Highlight a particular feature:
SPEARobj$plot.circos(correlation.matrix,
correlation.cutoff = .1,
highlight.feature = "OmicsData2_feat192",
highlight.color = "black")
## Plotting the following correlations with magnitude > 0.1:
## - OmicsData1 | 15
## - OmicsData2 | 19
## - OmicsData3 | 0
## - OmicsData4 | 0
## Warning in par(c(0, 0, 0, 0)): argument 1 does not name a graphical parameter
# Allow features from the same dataset to connect to one another
SPEARobj$plot.circos(correlation.matrix,
correlation.cutoff = .3,
allow.same.dataset = TRUE)
## Plotting the following correlations with magnitude > 0.3:
## - OmicsData1 | 3
## - OmicsData2 | 2
## - OmicsData3 | 0
## - OmicsData4 | 0
## Warning in par(c(0, 0, 0, 0)): argument 1 does not name a graphical parameter
plot.network
Plot a network (using the visNetwork package) from a correlation matrix
supplied. Rows and columns need to be found in
colnames(SPEARobj$data$train$X)
.
Parameters:
correlation.matrix
Which factors to return features for? Accepts
integers (i.e. factors = c(1,2,4)
or factors = 1
) Defaults to
NULL
(all).
correlation.cutoff
What is the correlation cutoff to be included
in the plot? Defaults to 0.5
allow.same.dataset
Should connections within the same dataset be
plotted? Defaults to FALSE
sign
Which direction of correlations to show? Can be "both"
(default), "pos"
(positive), or "negative"
(negative).
Examples:
# If no correlation.matrix argument is supplied, will automatically make
# one for Factor 1 with SPEARobj$get.correlation.matrix()
SPEARobj$plot.network()
## No argument passed for correlation.matrix, getting correlation matrix default (for Factor 1)...
## Getting correlation matrix for Factor 1
## Found 32 features for Factor 1
## Beginning pearson correlation tests for 32 features
## 0----------50--------100%
## ====================
{"x":{"nodes":{"id":["OmicsData3_feat21","OmicsData3_feat78","OmicsData4_feat194"],"label":["OmicsData3_feat21","OmicsData3_feat78","OmicsData4_feat194"],"color":["#DB5B68","#DB5B68","#FAA138"],"Dataset":["OmicsData3","OmicsData3","OmicsData4"],"shadow":[true,true,true],"borderWidth":[1,1,1],"value":[1,1,2],"x":[-1,1,-0.00365929106042595],"y":[-0.590077360199939,-1,1]},"edges":{"from":["OmicsData3_feat21","OmicsData3_feat78"],"to":["OmicsData4_feat194","OmicsData4_feat194"],"width":[-2.66150985311116,2.42701521898015],"color":["blue","red"],"smooth":[false,false],"shadow":[false,false]},"nodesToDataframe":true,"edgesToDataframe":true,"options":{"width":"100%","height":"100%","nodes":{"shape":"dot","physics":false},"manipulation":{"enabled":false},"edges":{"smooth":false},"physics":{"stabilization":false}},"groups":null,"width":null,"height":null,"idselection":{"enabled":true,"style":"width: 150px; height: 26px","useLabels":true,"main":"Select by id"},"byselection":{"enabled":true,"style":"width: 150px; height: 26px","multiple":false,"hideColor":"rgba(200,200,200,0.5)","highlight":false,"variable":"Dataset","main":"Select by Dataset","values":["OmicsData3","OmicsData4"]},"main":null,"submain":null,"footer":null,"background":"rgba(0, 0, 0, 0)","highlight":{"enabled":true,"hoverNearest":false,"degree":1,"algorithm":"all","hideColor":"rgba(200,200,200,0.5)","labelOnly":true},"collapse":{"enabled":false,"fit":false,"resetHighlight":true,"clusterOptions":null,"keepCoord":true,"labelSuffix":"(cluster)"},"igraphlayout":{"type":"square"}},"evals":[],"jsHooks":[]}
# Use the get.correlation.matrix function to get a correlation matrix:
correlation.matrix <- SPEARobj$get.correlation.matrix(factor = 4)
## Getting correlation matrix for Factor 4
## Found 34 features for Factor 4
## Beginning pearson correlation tests for 34 features
## 0----------50--------100%
## ======================
SPEARobj$plot.network(correlation.matrix, correlation.cutoff = .2)
{"x":{"nodes":{"id":["OmicsData1_feat95","OmicsData2_feat105","OmicsData2_feat112","OmicsData2_feat113","OmicsData2_feat139","OmicsData2_feat165","OmicsData2_feat185","OmicsData2_feat192"],"label":["OmicsData1_feat95","OmicsData2_feat105","OmicsData2_feat112","OmicsData2_feat113","OmicsData2_feat139","OmicsData2_feat165","OmicsData2_feat185","OmicsData2_feat192"],"color":["#3C0F71","#932B80","#932B80","#932B80","#932B80","#932B80","#932B80","#932B80"],"Dataset":["OmicsData1","OmicsData2","OmicsData2","OmicsData2","OmicsData2","OmicsData2","OmicsData2","OmicsData2"],"shadow":[true,true,true,true,true,true,true,true],"borderWidth":[1,1,1,1,1,1,1,1],"value":[7,1,1,1,1,1,1,1],"x":[-0.0357079167870175,-1,-0.331813144247507,-0.93159564760773,-0.1910311561671,1,0.665892952277266,0.554441218893547],"y":[0.0165915722297145,0.39883085474345,1,-0.493729165282298,-1,0.0891261697062371,-0.737517232511534,0.861809559979005]},"edges":{"from":["OmicsData2_feat192","OmicsData2_feat165","OmicsData2_feat113","OmicsData2_feat139","OmicsData2_feat185","OmicsData2_feat112","OmicsData2_feat105"],"to":["OmicsData1_feat95","OmicsData1_feat95","OmicsData1_feat95","OmicsData1_feat95","OmicsData1_feat95","OmicsData1_feat95","OmicsData1_feat95"],"width":[1.78344006976728,-1.47815198343782,-1.43848198410314,1.51542586667335,-1.10699685831388,-1.27453771707519,-1.03681736408471],"color":["red","blue","blue","red","blue","blue","blue"],"smooth":[false,false,false,false,false,false,false],"shadow":[false,false,false,false,false,false,false]},"nodesToDataframe":true,"edgesToDataframe":true,"options":{"width":"100%","height":"100%","nodes":{"shape":"dot","physics":false},"manipulation":{"enabled":false},"edges":{"smooth":false},"physics":{"stabilization":false}},"groups":null,"width":null,"height":null,"idselection":{"enabled":true,"style":"width: 150px; height: 26px","useLabels":true,"main":"Select by id"},"byselection":{"enabled":true,"style":"width: 150px; height: 26px","multiple":false,"hideColor":"rgba(200,200,200,0.5)","highlight":false,"variable":"Dataset","main":"Select by Dataset","values":["OmicsData1","OmicsData2"]},"main":null,"submain":null,"footer":null,"background":"rgba(0, 0, 0, 0)","highlight":{"enabled":true,"hoverNearest":false,"degree":1,"algorithm":"all","hideColor":"rgba(200,200,200,0.5)","labelOnly":true},"collapse":{"enabled":false,"fit":false,"resetHighlight":true,"clusterOptions":null,"keepCoord":true,"labelSuffix":"(cluster)"},"igraphlayout":{"type":"square"}},"evals":[],"jsHooks":[]}
# Set a lower threshold for the correlations to be shown as edges:
SPEARobj$plot.network(correlation.cutoff = .2)
## No argument passed for correlation.matrix, getting correlation matrix default (for Factor 1)...
## Getting correlation matrix for Factor 1
## Found 32 features for Factor 1
## Beginning pearson correlation tests for 32 features
## 0----------50--------100%
## ====================
{"x":{"nodes":{"id":["OmicsData3_feat120","OmicsData3_feat124","OmicsData3_feat165","OmicsData3_feat182","OmicsData3_feat190","OmicsData3_feat194","OmicsData3_feat21","OmicsData3_feat3","OmicsData3_feat31","OmicsData3_feat4","OmicsData3_feat44","OmicsData3_feat45","OmicsData3_feat55","OmicsData3_feat57","OmicsData3_feat70","OmicsData3_feat76","OmicsData3_feat78","OmicsData3_feat81","OmicsData3_feat89","OmicsData4_feat194"],"label":["OmicsData3_feat120","OmicsData3_feat124","OmicsData3_feat165","OmicsData3_feat182","OmicsData3_feat190","OmicsData3_feat194","OmicsData3_feat21","OmicsData3_feat3","OmicsData3_feat31","OmicsData3_feat4","OmicsData3_feat44","OmicsData3_feat45","OmicsData3_feat55","OmicsData3_feat57","OmicsData3_feat70","OmicsData3_feat76","OmicsData3_feat78","OmicsData3_feat81","OmicsData3_feat89","OmicsData4_feat194"],"color":["#DB5B68","#DB5B68","#DB5B68","#DB5B68","#DB5B68","#DB5B68","#DB5B68","#DB5B68","#DB5B68","#DB5B68","#DB5B68","#DB5B68","#DB5B68","#DB5B68","#DB5B68","#DB5B68","#DB5B68","#DB5B68","#DB5B68","#FAA138"],"Dataset":["OmicsData3","OmicsData3","OmicsData3","OmicsData3","OmicsData3","OmicsData3","OmicsData3","OmicsData3","OmicsData3","OmicsData3","OmicsData3","OmicsData3","OmicsData3","OmicsData3","OmicsData3","OmicsData3","OmicsData3","OmicsData3","OmicsData3","OmicsData4"],"shadow":[true,true,true,true,true,true,true,true,true,true,true,true,true,true,true,true,true,true,true,true],"borderWidth":[1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1],"value":[1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,19],"x":[-0.893959979165184,0.369393988677904,0.691901376606987,0.530801742693682,-0.436405598521044,0.276502950056997,-0.64338167017101,-1,-0.355042031548313,0.0178792591568195,0.232177170678546,0.947667671485088,1,0.680379617507033,-0.45776451119804,-0.607472418501997,-0.189250972596505,-0.878095644996283,0.783555943139232,0.00404290075818325],"y":[0.421325167746887,-0.951002875004965,0.764890074957689,-0.274378577948643,0.461318901002356,0.583990086895584,-0.178365539368371,-0.00243377196416572,-1,-0.858987198813082,1,-0.35457719586949,0.0759738991941723,-0.717876970614695,-0.641757609008323,0.828931648950046,0.948057308460095,-0.550840602013884,0.37482441528044,-0.00638547870985262]},"edges":{"from":["OmicsData3_feat21","OmicsData3_feat57","OmicsData3_feat45","OmicsData3_feat78","OmicsData3_feat124","OmicsData3_feat89","OmicsData3_feat190","OmicsData3_feat120","OmicsData3_feat70","OmicsData3_feat81","OmicsData3_feat44","OmicsData3_feat182","OmicsData3_feat3","OmicsData3_feat76","OmicsData3_feat55","OmicsData3_feat165","OmicsData3_feat31","OmicsData3_feat4","OmicsData3_feat194"],"to":["OmicsData4_feat194","OmicsData4_feat194","OmicsData4_feat194","OmicsData4_feat194","OmicsData4_feat194","OmicsData4_feat194","OmicsData4_feat194","OmicsData4_feat194","OmicsData4_feat194","OmicsData4_feat194","OmicsData4_feat194","OmicsData4_feat194","OmicsData4_feat194","OmicsData4_feat194","OmicsData4_feat194","OmicsData4_feat194","OmicsData4_feat194","OmicsData4_feat194","OmicsData4_feat194"],"width":[-2.66150985311116,2.42701521898015,-2.37623365206968,-2.60176895564453,1.98382375719108,2.1027020372372,-1.64356121334489,-2.09898670627621,1.80372046638989,-1.89558954567791,1.28848574084743,-1.32887262727877,1.40590459511814,-1.16653639083559,1.33027311476299,1.27985087276994,-1.04732560675774,1.38195768730488,1.00870510423169],"color":["blue","red","blue","blue","red","red","blue","blue","red","blue","red","blue","red","blue","red","red","blue","red","red"],"smooth":[false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false],"shadow":[false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false]},"nodesToDataframe":true,"edgesToDataframe":true,"options":{"width":"100%","height":"100%","nodes":{"shape":"dot","physics":false},"manipulation":{"enabled":false},"edges":{"smooth":false},"physics":{"stabilization":false}},"groups":null,"width":null,"height":null,"idselection":{"enabled":true,"style":"width: 150px; height: 26px","useLabels":true,"main":"Select by id"},"byselection":{"enabled":true,"style":"width: 150px; height: 26px","multiple":false,"hideColor":"rgba(200,200,200,0.5)","highlight":false,"variable":"Dataset","main":"Select by Dataset","values":["OmicsData3","OmicsData4"]},"main":null,"submain":null,"footer":null,"background":"rgba(0, 0, 0, 0)","highlight":{"enabled":true,"hoverNearest":false,"degree":1,"algorithm":"all","hideColor":"rgba(200,200,200,0.5)","labelOnly":true},"collapse":{"enabled":false,"fit":false,"resetHighlight":true,"clusterOptions":null,"keepCoord":true,"labelSuffix":"(cluster)"},"igraphlayout":{"type":"square"}},"evals":[],"jsHooks":[]}
# Allow connections between the same dataset (omic)
SPEARobj$plot.network(allow.same.dataset = TRUE,
correlation.cutoff = .4)
## No argument passed for correlation.matrix, getting correlation matrix default (for Factor 1)...
## Getting correlation matrix for Factor 1
## Found 32 features for Factor 1
## Beginning pearson correlation tests for 32 features
## 0----------50--------100%
## ====================
{"x":{"nodes":{"id":["OmicsData3_feat120","OmicsData3_feat124","OmicsData3_feat21","OmicsData3_feat45","OmicsData3_feat57","OmicsData3_feat78","OmicsData3_feat89","OmicsData4_feat117","OmicsData4_feat170","OmicsData4_feat171","OmicsData4_feat194"],"label":["OmicsData3_feat120","OmicsData3_feat124","OmicsData3_feat21","OmicsData3_feat45","OmicsData3_feat57","OmicsData3_feat78","OmicsData3_feat89","OmicsData4_feat117","OmicsData4_feat170","OmicsData4_feat171","OmicsData4_feat194"],"color":["#DB5B68","#DB5B68","#DB5B68","#DB5B68","#DB5B68","#DB5B68","#DB5B68","#FAA138","#FAA138","#FAA138","#FAA138"],"Dataset":["OmicsData3","OmicsData3","OmicsData3","OmicsData3","OmicsData3","OmicsData3","OmicsData3","OmicsData4","OmicsData4","OmicsData4","OmicsData4"],"shadow":[true,true,true,true,true,true,true,true,true,true,true],"borderWidth":[1,1,1,1,1,1,1,1,1,1,1],"value":[2,1,3,2,2,2,1,1,1,1,8],"x":[-0.709187272203205,-1,-0.520411269475154,0.289764620503925,-0.494922565085773,-0.105824106405565,0.781309301630175,0.441162833775818,1,0.675113015423402,0.111180690583415],"y":[-0.00121017116217703,1,0.607381017363191,-0.540833533506206,-0.210647532365248,0.488436786383891,-0.175048825736814,-1,0.157305167490733,0.465971059159656,0.0893223396480152]},"edges":{"from":["OmicsData3_feat21","OmicsData3_feat57","OmicsData3_feat45","OmicsData3_feat78","OmicsData3_feat78","OmicsData4_feat170","OmicsData3_feat124","OmicsData3_feat89","OmicsData3_feat120","OmicsData3_feat120","OmicsData4_feat117","OmicsData4_feat171"],"to":["OmicsData4_feat194","OmicsData4_feat194","OmicsData4_feat194","OmicsData4_feat194","OmicsData3_feat21","OmicsData4_feat194","OmicsData3_feat21","OmicsData4_feat194","OmicsData4_feat194","OmicsData3_feat57","OmicsData3_feat45","OmicsData4_feat194"],"width":[-2.66150985311116,2.42701521898015,-2.37623365206968,-2.60176895564453,2.30657291758065,-2.11497853721,-2.08321723614541,2.1027020372372,-1.64356121334489,-1.39997893260334,1.52773274234317,1.43200921065679],"color":["blue","red","blue","blue","red","blue","blue","red","blue","blue","red","red"],"smooth":[false,false,false,false,false,false,false,false,false,false,false,false],"shadow":[false,false,false,false,false,false,false,false,false,false,false,false]},"nodesToDataframe":true,"edgesToDataframe":true,"options":{"width":"100%","height":"100%","nodes":{"shape":"dot","physics":false},"manipulation":{"enabled":false},"edges":{"smooth":false},"physics":{"stabilization":false}},"groups":null,"width":null,"height":null,"idselection":{"enabled":true,"style":"width: 150px; height: 26px","useLabels":true,"main":"Select by id"},"byselection":{"enabled":true,"style":"width: 150px; height: 26px","multiple":false,"hideColor":"rgba(200,200,200,0.5)","highlight":false,"variable":"Dataset","main":"Select by Dataset","values":["OmicsData3","OmicsData4"]},"main":null,"submain":null,"footer":null,"background":"rgba(0, 0, 0, 0)","highlight":{"enabled":true,"hoverNearest":false,"degree":1,"algorithm":"all","hideColor":"rgba(200,200,200,0.5)","labelOnly":true},"collapse":{"enabled":false,"fit":false,"resetHighlight":true,"clusterOptions":null,"keepCoord":true,"labelSuffix":"(cluster)"},"igraphlayout":{"type":"square"}},"evals":[],"jsHooks":[]}
plot.coefficients
Plot the coefficients of a SPEAR model.
Parameters:
coef.type
Which coefficients to plot? Can be "projection"
(default) or "regression"
plot.type
Which type of plot? Defaults to "heatmap"
. (currently
working on other plot.types)
factors
Which factors to return features for? Accepts integers
(i.e. factors = c(1,2,4)
or factors = 1
) Defaults to NULL
(all).
datasets
Which datasets? Check names via
names(SPEARobject$data$train$Xlist)
. Defaults to NULL
(all)
cluster
Should features be clustered? Defaults to TRUE
dendrogram.scale
How large should the dendrogram from cluster
be
compared to each factor? Defaults to 1
(make > 1 for larger
dendrogram).
show.all.names
Should all feature names be shown? Defaults to
FALSE
(if num.features > 100, can be very crowded).
abbrev.names
Should feature names be abbreviated to 20 characters?
Defaults to TRUE
dark
Use the dark theme? Defaults to FALSE
Examples:
SPEARobj$plot.coefficients()
SPEARobj$plot.coefficients(cluster = FALSE)
SPEARobj$plot.coefficients(cluster = FALSE, dark = TRUE)
SPEARobj$plot.coefficients(coef.type = "regression")
plot.probabilities
Plot the probabilities of a SPEAR model.
Parameters:
prob.type
Which probabilities to plot? Can be "joint"
(default),
"nonzero"
, "marginal"
, or "projection"
plot.type
Which type of plot? Defaults to "heatmap"
. (currently
working on other plot.types)
factors
Which factors to return features for? Accepts integers
(i.e. factors = c(1,2,4)
or factors = 1
) Defaults to NULL
(all).
datasets
Which datasets? Check names via
names(SPEARobject$data$train$Xlist)
. Defaults to NULL
(all)
cluster
Should features be clustered? Defaults to TRUE
dendrogram.scale
How large should the dendrogram from cluster
be
compared to each factor? Defaults to 1
(make > 1 for larger
dendrogram).
show.all.names
Should all feature names be shown? Defaults to
FALSE
(if num.features > 100, can be very crowded).
abbrev.names
Should feature names be abbreviated to 20 characters?
Defaults to TRUE
log.probabilities
Should the probabilites return the
-log10(probabilities)
? Defaults to TRUE
dark
Use the dark theme? Defaults to FALSE
Examples:
SPEARobj$plot.probabilities()
SPEARobj$plot.probabilities(cluster = FALSE)
SPEARobj$plot.probabilities(log.probabilities = FALSE)
SPEARobj$plot.probabilities(prob.type = "nonzero")
To return to the main SPEAR vignette, click here
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.