glmSparseNet
An R :package: for network-based and sparse generalized linear models (GLM)
Science Score: 13.0%
This score indicates how likely this project is to be science-related based on various indicators:
-
○CITATION.cff file
-
○codemeta.json file
-
○.zenodo.json file
-
✓DOI references
Found 4 DOI reference(s) in README -
○Academic publication links
-
○Committers with academic emails
-
○Institutional organization owner
-
○JOSS paper metadata
-
○Scientific vocabulary similarity
Low similarity (17.6%) to scientific vocabulary
Keywords from Contributors
bioconductor-package
gene
hitchip-atlas
hitchip
rpackage
data-access
rna-seq
outlier-detection
mendelian-genetics
expression-analysis
Last synced: 11 months ago
·
JSON representation
Repository
An R :package: for network-based and sparse generalized linear models (GLM)
Basic Info
- Host: GitHub
- Owner: sysbiomed
- Language: R
- Default Branch: devel
- Homepage: http://www.sound-biomed.eu
- Size: 16.9 MB
Statistics
- Stars: 6
- Watchers: 4
- Forks: 3
- Open Issues: 1
- Releases: 0
Created about 8 years ago
· Last pushed over 2 years ago
Metadata Files
Readme
README.Rmd
---
title: "glmSparseNet"
output:
rmarkdown::html_vignette:
toc: TRUE
github_document:
toc: TRUE
vignette: >
%\VignetteIndexEntry{Vignette Title}
%\VignetteEncoding{UTF-8}
%\VignetteEngine{knitr::rmarkdown}
---
```{r setup, include=FALSE, results='hide'}
knitr::opts_chunk$set(
echo = TRUE,
fig.width = 7,
fig.height = 6
)
library(futile.logger)
library(ggplot2)
flog.layout(layout.format("[~l] ~m"))
flog.appender(appender.tee("logger.txt"))
theme_set(theme_minimal())
```
```{r generate_md, eval=FALSE, include=FALSE}
rmarkdown::render("README.Rmd", output_format = "all")
```
> Elastic-Net models with additional regularization based on network centrality metrics
[](https://travis-ci.org/sysbiomed/glmSparseNet)
[](https://codecov.io/github/sysbiomed/glmSparseNet?branch=master)
## Overview
`glmSparseNet` is a R package that generalizes sparse regression models when the features *(e.g. genes)* have a graph structure *(e.g. protein-protein interactions)*, by including network-based regularizers. `glmSparseNet` uses the `glmnet` R-package, by including centrality measures of the network as penalty weights in the regularization. The current version implements regularization based on node degree, i.e. the strength and/or number of its associated edges, either by promoting hubs in the solution or orphan genes in the solution.
All the `glmnet` distribution families are supported, namely *"gaussian"*, *"poisson"*, *"binomial"*, *"multinomial"*, *"cox"*, and *"mgaussian"*.
It adds two new main functions called `glmSparseNet` and `cv.glmSparseNet` that extend both model inference and model selection via cross-validation with network-based regularization. These functions are very flexible and allow to transform the penalty weights after the centrality metric is calculated, thus allowing to change how it affects the regularization. To facilitate users, we made available a function that will penalize low connected nodes in the network - `glmHub` or `glmDegree` - and another that will penalize hubs - `glmOrphan`.

Below, we provide one example for survival analysis using transcriptomic data from the TCGA Adrenocortical Carcinoma project. More information and Rmd files are available in the vignettes folder where more extensive and complete examples are provided for logistic regresson and Cox's regression for different types of cancer data.
## Citation
Veríssimo, A., Carrasquinha E., Lopes, M.B., Oliveira, A.L., Sagot, M.-F. & Vinga, S. (2018), Sparse network-based regularization for the analysis of patientomics high-dimensional survival data. bioRxiv 403402; doi: https://doi.org/10.1101/403402
Veríssimo, A., Oliveira, A.L., Sagot, M.-F., & Vinga, S. (2016). DegreeCox – a network-based regularization method for survival analysis. BMC Bioinformatics. 17(16): 449. https://doi.org/10.1186/s12859-016-1310-4
This package was developed by André Veríssimo, Eunice Carrasquinha, Marta B. Lopes and Susana Vinga under the project SOUND, funded from the European Union Horizon 2020 research and innovation program under grant agreement No. 633974.
## Instalation
Bioconductor is necessary for the installation of this package.
```{r install, eval=FALSE}
if (!require("BiocManager")) {
install.packages("BiocManager")
}
BiocManager::install("glmSparseNet")
```
## Details
This package extends the `glmnet` r-package with network-based regularization based on features relations. This network can be calculated from the data itself or using external networks to enrich the model.
There are 2 methods available to use data-dependant methods to generate the network:
1. Correlation matrix with cutoff;
1. Covariance matrix with cutoff;
Alternatively, the network can be passed as an adjancency matrix or an already calculate metric for each node.
### Function definition
The main functions from this packages are the `glmSparseNet` and `cv.glmSparseNet` and the arguments for the functions are defined as:
* `xdata`: A MultiAssayExperiment object or an input matrix of dimension `Observations x Features`
* `ydata`: Response object that can take different forms depending on the model family that is used
* `family`: Model type that can take: *"gaussian"*, *"poisson"*, *"binomial"*, *"multinomial"*, *"cox"*, and *"mgaussian"*
* `network`: Network to use in penalization, it can take as input: "correlation", "covariance", a matrix object with p.vars x p.vars representing the network, a weighted vector of penalties
* `experiment.name`: Optional parameter used with a "MultiAssayExperiment" object as input
* `network.options`: Optional parameter defining the options to process the network, such as:
* `cutoff`: A real number to use to remove edges from the network
* `minDegree`: Minimum value that the weight should have, this is useful as when the weight is 0, there is no regularization on that feature, which may lead to convergence problems
* `transFun`: Transformation function to the vector of penalty weights after these are calculated from the network
*note:* These functions can take any additional arguments that `glmnet` or `cv.glmnet` accept (e.g. number of folds in cross validation)
```{r, eval=FALSE}
cv.glmSparseNet(
xdata,
ydata,
family = "cox",
network = "correlation",
options = networkOptions(
cutoff = .6,
minDegree = 0.2
)
)
```
## Example for survival analysis using RNA-seq data
This example uses an adrenal cancer dataset using the correlation to calculate the network and cross-validation to find the optimal model. The network itself if filtered using a cutoff value of 0.6, i.e. all edges that have a correlation between the two features *(genes)* below the cutoff value are discarded.
The data was retrieved from TCGA database and the Adrenocortical Carcinoma project with 92 patients and a reduced RNASeq data. See Bioconductor package `MultiAssayExperiment` for more information on the `miniACC` dataset.
To run the following examples, the next libraries are also needed:
```{r, include=FALSE}
library(futile.logger)
library(dplyr)
library(ggplot2)
library(reshape2)
library(MultiAssayExperiment)
library(survival)
library(glmnet)
library(glmSparseNet)
```
```{r, eval=FALSE}
library(futile.logger)
library(dplyr)
library(ggplot2)
library(reshape2)
library(MultiAssayExperiment)
library(survival)
library(glmnet)
library(glmSparseNet)
```
There is some pre-processing needed to remove patients with invalid follow-up date or death date:
```{r multi.assay}
# load data
data("miniACC", package = "MultiAssayExperiment")
xdata <- miniACC
# build valid data with days of last follow up or to event
eventIx <- which(!is.na(xdata$days_to_death))
censIx <- which(!is.na(xdata$days_to_last_followup))
survEventTime <- array(NA, nrow(colData(xdata)))
survEventTime[eventIx] <- xdata$days_to_death[eventIx]
survEventTime[censIx] <- xdata$days_to_last_followup[censIx]
# Keep only valid individuals
#
# they are valid if they have:
# - either a follow_up time or event time
# - a valid vital_status (i.e. not missing)
# - folloup_time or event_time > 0
validIx <- as.vector(!is.na(survEventTime) & !is.na(xdata$vital_status) & survEventTime > 0)
ydata <- data.frame(
time = survEventTime[validIx],
status = xdata$vital_status[validIx],
row.names = xdata$patientID[validIx]
)
```
The function `cv.glmSparseNet` fits the survival data using 10-fold cross validation and using a cutoff value of 0.6 to reduce the size of the network.
```{r fit.surv}
# build response object for glmnet
fit3 <- cv.glmSparseNet(
xdata,
ydata,
family = "cox",
network = "correlation",
experiment = "RNASeq2GeneNorm",
alpha = .7,
nlambda = 1000,
options = networkOptions(
cutoff = .6,
minDegree = 0.2,
transFun = hubHeuristic
)
)
plot(fit3)
```
*Cross validation plot, showing all 1000 lambdas tested and the error for each, vertical lines show best model and another with fewer variables selected within one standard error of the best.*
## Visualization and Analytical tools
### Survival curves with `separate2groupsCox`
This function generates Kaplan-Meier survival model based on the estimated coefficients of the Cox model. It creates two groups based on the relative risk and displays both survival curves *(high vs. low-risk patients, as defined by the median)* and the corresponding results of log-rank tests.
```{r separate2groups.cox}
# Data to use in draw.kaplan function
# * it takes the input data, response and coefficients
# * calculates the relative risk
# * separates individuals based on relative risk into High/Low risk groups
xdataReduced <- as(xdata[, , "RNASeq2GeneNorm"], "MatchedAssayExperiment")
ydataKM <- ydata[rownames(colData(xdataReduced)), ]
bestModelCoef <- coef(fit3, s = "lambda.min")[, 1]
```
Kaplan-Meier plot
```{r call.kaplan}
separate2GroupsCox(
bestModelCoef, t(assay(xdata[["RNASeq2GeneNorm"]])), ydataKM,
ylim = c(0, 1)
)
```
```{r glmnet.classic, include=FALSE, eval=FALSE}
library(glmnet)
# Comparing against a classical GLMNET call
xdataReduced <- as(xdata[, , "RNASeq2GeneNorm"], "MatchedAssayExperiment")
xdataSurv <- t(assay(xdataReduced[["RNASeq2GeneNorm"]]))
ydataReduced <- ydata[xdataReduced$patientID, ]
ydataSurv <- Surv(ydataReduced$time, ydataReduced$status)
fit4 <- cv.glmnet(
xdataSurv, ydataSurv,
family = "cox", alpha = .7, nlambda = 1000
)
bestModelCoefG <- Filter(function(.x) .x != 0, coef(fit4, s = "lambda.min")[, 1])
separate2groupsCox(
bestModelCoefG,
t(assay(xdata[["RNASeq2GeneNorm"]]))[, names(bestModelCoefG)],
ydataKM,
ylim = c(0, 1)
)$plot
```
Owner
- Name: SysBioMed - INESC-ID, IT, IST, ULisboa
- Login: sysbiomed
- Kind: organization
- Email: susanavinga@tecnico.ulisboa.pt
- Website: https://sels.tecnico.ulisboa.pt/
- Repositories: 2
- Profile: https://github.com/sysbiomed
GitHub Events
Total
- Watch event: 1
Last Year
- Watch event: 1
Committers
Last synced: almost 3 years ago
Top Committers
| Name | Commits | |
|---|---|---|
| André Veríssimo | a****o@g****m | 303 |
| eunicecarrasquinha | e****a@g****m | 20 |
| Nitesh Turaga | n****a@g****m | 14 |
| Eunice Trigueirao | e****o@t****t | 11 |
| Susana Vinga | s****a@g****m | 6 |
| Susana Vinga | s****a@t****t | 3 |
| vobencha | v****a@g****m | 2 |
| LiNk-NY | m****9@g****m | 1 |
| Marta Lopes | m****s@t****t | 1 |
Committer Domains (Top 20 + Academic)
Issues and Pull Requests
Last synced: 11 months ago
All Time
- Total issues: 5
- Total pull requests: 1
- Average time to close issues: 3 months
- Average time to close pull requests: about 15 hours
- Total issue authors: 5
- Total pull request authors: 1
- Average comments per issue: 1.2
- Average comments per pull request: 0.0
- Merged pull requests: 1
- Bot issues: 0
- Bot pull requests: 0
Past Year
- Issues: 0
- Pull requests: 0
- Average time to close issues: N/A
- Average time to close pull requests: N/A
- Issue authors: 0
- Pull request authors: 0
- Average comments per issue: 0
- Average comments per pull request: 0
- Merged pull requests: 0
- Bot issues: 0
- Bot pull requests: 0
Top Authors
Issue Authors
- LiNk-NY (1)
- ggautreau (1)
- Kayla-Morrell (1)
- liufuyan2016 (1)
- KingJuliusss (1)
Pull Request Authors
- LiNk-NY (1)
Top Labels
Issue Labels
Pull Request Labels
Packages
- Total packages: 1
-
Total downloads:
- bioconductor 104,996 total
- Total dependent packages: 0
- Total dependent repositories: 0
- Total versions: 6
- Total maintainers: 1
bioconductor.org: glmSparseNet
Network Centrality Metrics for Elastic-Net Regularized Models
- Homepage: https://www.github.com/sysbiomed/glmSparseNet
- Documentation: https://bioconductor.org/packages/release/bioc/vignettes/glmSparseNet/inst/doc/glmSparseNet.pdf
- License: GPL-3
-
Latest release: 1.26.0
published over 1 year ago
Rankings
Dependent repos count: 0.0%
Dependent packages count: 0.0%
Average: 21.7%
Downloads: 65.1%
Maintainers (1)
Last synced:
11 months ago
Dependencies
DESCRIPTION
cran
- Matrix * depends
- MultiAssayExperiment * depends
- R >= 4.1 depends
- glmnet * depends
- SummarizedExperiment * imports
- biomaRt * imports
- digest * imports
- dplyr * imports
- forcats * imports
- futile.logger * imports
- futile.options * imports
- ggplot2 * imports
- glue * imports
- httr * imports
- methods * imports
- parallel * imports
- readr * imports
- reshape2 * imports
- stringr * imports
- survminer * imports
- utils * imports
- BiocStyle * suggests
- TCGAutils * suggests
- VennDiagram * suggests
- curatedTCGAData * suggests
- knitr * suggests
- pROC * suggests
- rmarkdown * suggests
- survcomp * suggests
- survival * suggests
- testthat * suggests