mxnorm
mxnorm: An R Package to Normalize Multiplexed Imaging Data - Published in JOSS (2022)
Science Score: 95.0%
This score indicates how likely this project is to be science-related based on various indicators:
-
○CITATION.cff file
-
✓codemeta.json file
Found codemeta.json file -
✓.zenodo.json file
Found .zenodo.json file -
✓DOI references
Found 4 DOI reference(s) in README and JOSS metadata -
✓Academic publication links
Links to: joss.theoj.org -
✓Committers with academic emails
1 of 1 committers (100.0%) from academic institutions -
○Institutional organization owner
-
✓JOSS paper metadata
Published in Journal of Open Source Software
Keywords
cran
package
r
Scientific Fields
Engineering
Computer Science -
80% confidence
Last synced: 6 months ago
·
JSON representation
Repository
R package to normalize multiplexed imaging data.
Basic Info
Statistics
- Stars: 7
- Watchers: 1
- Forks: 3
- Open Issues: 1
- Releases: 2
Topics
cran
package
r
Created over 4 years ago
· Last pushed over 2 years ago
Metadata Files
Readme
License
README.Rmd
---
output: github_document
---
```{r, include = FALSE}
knitr::opts_chunk$set(
collapse = TRUE,
comment = "#>",
fig.path = "man/figures/README-",
out.width = "100%"
)
```
# mxnorm: An R package to normalize multiplexed imaging data.
[](https://cran.r-project.org/package=mxnorm)
[](https://cran.r-project.org/package=mxnorm)
[](https://joss.theoj.org/papers/10.21105/joss.04180)
[](https://github.com/ColemanRHarris/mxnorm/actions)
[](https://app.codecov.io/gh/ColemanRHarris/mxnorm?branch=main)
A package designed to handle multiplexed imaging data in R, implementing normalization methods and quality metrics detailed in our paper [here](https://doi.org/10.1101/2021.07.16.452359). Further information about the package, usage, the vignettes, and more can be found on [CRAN](https://cran.r-project.org/package=mxnorm).
# Installation
To install from `CRAN`, use:
``` r
install.packages("mxnorm")
```
You can install the development version from [GitHub](https://github.com/) with:
``` r
# install.packages("devtools")
devtools::install_github("ColemanRHarris/mxnorm")
```
## Dependencies
This package imports `lme4` (and its dependency `nloptr`) which use `CMake` to build the packages. To install `CMake`, please see [here](https://cmake.org/install/) or select from the following:
```
- yum install cmake (Fedora/CentOS; inside a terminal)
- apt install cmake (Debian/Ubuntu; inside a terminal).
- pacman -S cmake (Arch Linux; inside a terminal).
- brew install cmake (MacOS; inside a terminal with Homebrew)
- port install cmake (MacOS; inside a terminal with MacPorts)
```
This package also uses the `reticulate` package to interface with the `scikit-learn` Python package. Depending on the user's environment, sometimes Python/`conda`/`Miniconda` is not detected, producing an option like the following:
```
No non-system installation of Python could be found.
Would you like to download and install Miniconda?
Miniconda is an open source environment management system for Python.
See https://docs.conda.io/en/latest/miniconda.html for more details.
Would you like to install Miniconda? [Y/n]:
```
In this case, installing Miniconda within the R environment will ensure that both Python and the `scikit-image` package are properly installed. However, if you want to use a separate Python installation, please respond `N` to this prompt and use `reticulate::py_config()` to setup your Python environment. Please also ensure that `scikit-image` is installed in your desired Python environment via `pip install scikit-image`.
# Community Guidelines
Please report any issues, bugs, or problems with the software here: https://github.com/ColemanRHarris/mxnorm/issues. For any contributions, feel free to fork the package repository on GitHub or submit pull requests. Any other contribution questions and requests for support can be directed to the package maintainer Coleman Harris (coleman.r.harris@vanderbilt.edu).
# Analysis Example
This is a basic example using the `mx_sample` dataset, which is simulated data to demonstrate the package's functionality with slide effects.
```{r sample}
library(mxnorm)
head(mx_sample)
```
## `mx_dataset` objects
How to build the `mx_dataset` object with `mx_sample` data in the `mxnorm` package:
```{r example}
mx_dataset = mx_dataset(data=mx_sample,
slide_id="slide_id",
image_id="image_id",
marker_cols=c("marker1_vals","marker2_vals","marker3_vals"),
metadata_cols=c("metadata1_vals"))
```
We can use the built-in `summary()` function to observe `mx_dataset` object:
```{r ex_str}
summary(mx_dataset)
```
## Normalization with `mx_normalize()`
And now we can normalize this data using the `mx_normalize()` function:
```{r norm}
mx_norm = mx_normalize(mx_data = mx_dataset,
transform = "log10_mean_divide",
method="None")
```
And we again use `summary()` to capture the following attributes for the `mx_dataset` object:
```{r norm_str, warning=FALSE}
summary(mx_norm)
```
## Otsu discordance scores with `run_otsu_discordance()`
Using the above normalized data, we can run an Otsu discordance score analysis to determine how well our normalization method performs (here, we look for lower discordance scores to distinguish better performing methods):
```{r otsu}
mx_otsu = run_otsu_discordance(mx_norm,
table="both",
threshold_override = NULL,
plot_out = FALSE)
```
We can also begin to visualize these results using some of `mxnorm`'s plotting features built using `ggplot2`.
First, we can visualize the densities of the marker values as follows:
```{r mx_dens}
plot_mx_density(mx_otsu)
```
We can also visualize the results of the Otsu misclassification analysis stratified by slide and marker:
```{r mx_misc}
plot_mx_discordance(mx_otsu)
```
## UMAP dimension reduction with `run_reduce_umap()`
We can also use the UMAP algorithm to reduce the dimensions of our markers in the dataset as follows, using the `metadata_col` parameter for later (e.g., similar to a tissue type in practice with multiplexed data):
```{r umap}
mx_umap = run_reduce_umap(mx_otsu,
table="both",
marker_list = c("marker1_vals","marker2_vals","marker3_vals"),
downsample_pct = 0.8,
metadata_col = "metadata1_vals")
```
We can further visualize the results of the UMAP dimension reduction as follows:
```{r mx_umap}
plot_mx_umap(mx_umap,metadata_col = "metadata1_vals")
```
Note that since the sample data is simulated, we don't see separation of the groups like we would expect with biological samples that have some underlying correlation. What we can observe, however, is the separation of slides in the `raw` data and subsequent mixing of these slides in the `normalized` data:
```{r mx_umap_slide}
plot_mx_umap(mx_umap,metadata_col = "slide_id")
```
## Variance components analysis with `run_var_proportions()`
We can also leverage `lmer()` from the `lme4` package to perform random effect modeling on the data to determine how much variance is present at the slide level, as follows:
```{r var,warnings=FALSE,message=FALSE}
mx_var = run_var_proportions(mx_umap,
table="both",
metadata_cols = "metadata1_vals")
```
And we can use `summary()` to capture the following attributes for the `mx_dataset` object:
```{r var_str}
summary(mx_var)
```
And we can also visualize the results of the variance proportions after normalization:
```{r mx_var}
plot_mx_proportions(mx_var)
```
JOSS Publication
mxnorm: An R Package to Normalize Multiplexed Imaging Data
Published
March 30, 2022
Volume 7, Issue 71, Page 4180
Authors
Coleman Harris
Department of Biostatistics, Vanderbilt University Medical Center, Nashville, TN, USA
Department of Biostatistics, Vanderbilt University Medical Center, Nashville, TN, USA
Julia Wrobel
Department of Biostatistics & Informatics, Colorado School of Public Health, Aurora, CO, USA
Department of Biostatistics & Informatics, Colorado School of Public Health, Aurora, CO, USA
Simon Vandekar
Department of Biostatistics, Vanderbilt University Medical Center, Nashville, TN, USA
Department of Biostatistics, Vanderbilt University Medical Center, Nashville, TN, USA
Tags
multiplexed imaging normalization statisticsGitHub Events
Total
- Fork event: 1
Last Year
- Fork event: 1
Committers
Last synced: 7 months ago
Top Committers
| Name | Commits | |
|---|---|---|
| Cole | c****s@v****u | 133 |
Committer Domains (Top 20 + Academic)
Issues and Pull Requests
Last synced: 6 months ago
All Time
- Total issues: 10
- Total pull requests: 3
- Average time to close issues: 5 days
- Average time to close pull requests: less than a minute
- Total issue authors: 5
- Total pull request authors: 1
- Average comments per issue: 1.6
- Average comments per pull request: 0.0
- Merged pull requests: 3
- 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
- smith6jt-cop (4)
- tijeco (3)
- askerdb (1)
- ColemanRHarris (1)
- ansonkn (1)
Pull Request Authors
- ColemanRHarris (3)
Top Labels
Issue Labels
Pull Request Labels
Dependencies
DESCRIPTION
cran
- R >= 3.5.0 depends
- KernSmooth * imports
- caret * imports
- data.table * imports
- dplyr * imports
- e1071 * imports
- fda * imports
- fossil * imports
- ggplot2 * imports
- glue * imports
- kSamples * imports
- lme4 * imports
- magrittr * imports
- methods * imports
- psych * imports
- reticulate * imports
- rlang * imports
- stats * imports
- stringr * imports
- tidyr * imports
- uwot * imports
- covr * suggests
- janitor >= 2.1.0 suggests
- knitr * suggests
- markdown * suggests
- rmarkdown * suggests
- testthat >= 3.0.0 suggests
.github/workflows/R-CMD-check.yaml
actions
- actions/checkout v2 composite
- actions/upload-artifact main composite
- r-lib/actions/check-r-package v1 composite
- r-lib/actions/setup-r v1 composite
- r-lib/actions/setup-r-dependencies v1 composite
.github/workflows/test-coverage.yaml
actions
- actions/checkout v3 composite
- actions/upload-artifact v3 composite
- r-lib/actions/setup-r v2 composite
- r-lib/actions/setup-r-dependencies v2 composite