A Pleasant Tonic For Parallel Correlation Analysis In R
Computes pairwise Pearson's correlations of a dataset, or specified targets simultaneously in parallel. Additionally, fits a linear model. Conveniently includes the ability to filter the input dataset and select a subset of columns to compute correlations. Outputs Pearson's product moment correlation coefficients, p-values, adjusted p-values, linear model slope and observation counts in long-format.
- Download the Package Archive File (cordial_x.x.x.tar.gz) of the latest release.
- Not the Source code
- In RStudio, click: Tools menu
- Select: Install Packages...
- In the Install from list box, select: Package Archive File (.zip; .tar.gz)
- Click: Browse to select the downloaded
cordialPackage Archive File - Select: Install
Run:
devtools::install_url(
"https://github.com/CutillasLab/cordial/releases/download/v0.1.10/cordial_0.1.10.tar.gz"
)
- You may first need to install
devtools:install.packages("devtools")
- Download the Package Archive File (cordial_x.x.x.tar.gz) of the latest release.
- Not the Source code
- Run:
devtools::install_local(path = "C:/path/to/cordial_x.x.x.tar.gz")- Replace the string argument to
pathwith the actual location - You may first need to install
devtools:install.packages("devtools")
- Replace the string argument to
- The source files in
cordial/data/does NOT contain thecrispr_DTdata, as it exceeds the GitHub file size limit. - The
.tar.gzin the assets of the latest release DOES contain the data. - Due to the excessive size of included datasets, Git Large File Storage (LFS) has been implemented. This causes known issues when installing packages directly from GitHub (
bad restore file magic number (file may be corrupted) -- no data loaded); therefore, installations must use the Package Archive File (cordial_x.x.x.tar.gz) from the latest release. - If installation error occurs stating that certain required packages are missing, try manually installing the missing packages listed prior to reattempting to install
cordial, e.g.:
devtools::install_cran(c("ggplot2", "ggrepel", "magrittr", "tidyr", "purrr", "future", "furrr", "collapse", "data.table"))
- If error persists, it may also be required to install additional build tools specific to your operating system (OS) and R version:
- To load
cordial:library(cordial)
- After loading the package, explore the help documentation by entering into the console the name of the package or function prefixed with a question mark, e.g.:
?cordial?cor_map
To get pairwise correlations for all target (column) permutations.
- Parameters:
dataset: A wide-formatdata.table.select_cols: Avectorof column names (character), or indices (numeric) to select; must omit non-numeric columns.filter_rows: A namedlist. Values specify which rows to subset. Names correspond to column names indataset, ormetadataif supplied.metadata: An optionaldata.tablewith values corresponding to rows matching indataset.self: Acharacterstring."yes"includes self-correlations;"no"omits.method: Acharacterstring. Correction method for p-value adjustment, passed tostats::p.adjust().
To get all correlations for a selection of key targets.
- Supply the key targets as a vector (e.g.,
c("COLUMN1", "COLUMN2")) to the additionaltargetparameter. - Other parameters are shared with
cor_map().
To get all correlations for a single key target.
- Supply a character string of the key target (e.g.,
"COLUMN1") to the additionaltargetparameter. - Other parameters are shared with
cor_map().
Correlations for all columns will be calculated, unless a subset is supplied to select_cols, i.e.:
- corr(X, Y) = corr(
select_cols,select_cols)
The additional target parameter (cor_target_map(), cor_target()) allows further subsetting of the pairwise correlations to make, i.e.:
- corr(X, Y) = corr(
target,select_cols)
Badshah II, Cutillas PR. Systematic identification of biochemical networks in cancer cells by functional pathway inference analysis. Bioinformatics. 2023 Jan 1;39(1):btac769. PMID: 36448701; PMCID: PMC9805595. https://doi.org/10.1093/bioinformatics/btac769