propr

[OFFICIAL] [CoDA] An R package to calculate proportionality and other measures for compositional data

https://github.com/tpq/propr

Science Score: 26.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
  • Academic publication links
  • Committers with academic emails
  • Institutional organization owner
  • JOSS paper metadata
  • Scientific vocabulary similarity
    Low similarity (16.4%) to scientific vocabulary
Last synced: 11 months ago · JSON representation

Repository

[OFFICIAL] [CoDA] An R package to calculate proportionality and other measures for compositional data

Basic Info
  • Host: GitHub
  • Owner: tpq
  • Language: R
  • Default Branch: master
  • Homepage:
  • Size: 24.9 MB
Statistics
  • Stars: 71
  • Watchers: 2
  • Forks: 12
  • Open Issues: 28
  • Releases: 17
Created over 10 years ago · Last pushed about 1 year ago
Metadata Files
Readme Changelog

README.Rmd

---
output:
  md_document:
    variant: markdown_github
---



```{r setup, include=FALSE}
knitr::opts_chunk$set(echo = TRUE)
```

## Attention!!

If you have used `propr` previously, you will notice some changes. In version 5.0.0, I have completed a major revision of the code base to simplify the maintenance of `propr` going forward, including a restructure of back-end and front-end functionality. From the user's perspective, you will notice a few changes. First, all supporting visualization functions are gone. They were poorly implemented and not backwards compatible. Instead, you can use the unified `getResults` wrapper to pull data from `propr` and `propd` objects to pipe to `ggplot2` for visualization. Second, many experimental functions have been removed, with the remaining ones all sharing the prefix `run`. The core routines called by the `propr` and `propd` functions remain unchanged.

## Introduction

The `propr` package provides an interface for 4 distinct approaches to compositional data analysis (CoDA): proportionality, differential proportionality, logratio partial correlation with basis shrinkage, and ratio analysis.

If you use this software, please cite our work. We don't get paid to make software, but your citations help us to negotiate support for software maintenance and development.

```{r}
citation("propr")
```

OK, now let's get started.

```{r, eval = FALSE}
counts <- matrix(rpois(20*50, 100), 20, 50)
group <- sample(c("A", "B"), size = 20, replace = TRUE)
devtools::install_github("tpq/propr")
library(propr)
```

## Proportionality

There are a few proportionality statistics available. Select one with the 'metric' argument.

```{r, eval = FALSE}
pr <- propr(
        counts,  # rows as samples, like it should be
        metric = "rho",  # or "phi", "phs", "vlr"
        ivar = "clr",  # or can use another gene as reference, by giving the name or index
        alpha = NA,  # use to handle zeros
        p = 100  # used for permutation tests
      ) 
```

You can determine the "signficance" of proportionality using a built-in permutation procedure. It estimates the false discovery rate (FDR) for any cutoff. This method can take a while to run, but is parallelizable.

```{r, eval = FALSE}
pr <- updateCutoffs(
        pr,
        number_of_cutoffs = 100,  # number of cutoffs to estimate FDR
        custom_cutoffs = NULL,  # or specify custom cutoffs
        tails = 'right',  # consider only the positive values ('right') or both sides ('both')
        ncores = 4  # parallelize here
      ) 
```

Choose the largest cutoff with an acceptable FDR.

## Logratio partial correlation with basis shrinkage

There are many ways to calculate partial correlations, with or without shrinkage. The recommended one for datasets with p>>n and influenced by compositional bias is "pcor.bshrink".

```{r, eval = FALSE}
pr <- propr(
        counts,  # rows as samples, like it should be
        metric = "pcor.bshrink",  # partial correlation without shrinkage "pcor" is also available
        ivar = "clr",  # "clr" is recommended
        p = 100  # used for permutation tests
      ) 
```

You can also determine the "significance" of logratio partial correlations with the built-in permutation approach.

```{r, eval = FALSE}
pr <- updateCutoffs(
        pr,
        number_of_cutoffs = 100,  # number of cutoffs to estimate FDR
        custom_cutoffs = NULL,  # or specify custom cutoffs
        tails = 'right',  # consider only the positive values ('right') or both sides ('both')
        ncores = 4  # parallelize here
      ) 
```


## Differential Proportionality

There are also a few differential proportionality statistics, but they all get calculated at once.

```{r, eval = FALSE}
pd <- propd(
        counts,
        group,  # a vector of 2 or more groups
        alpha = NA,  # whether to handle zeros
        p = 100,  # used for permutation tests
        weighted = TRUE  # whether to weight log-ratios
      )
```

You can switch between the "disjointed" and "emergent" statistics.

```{r, eval = FALSE}
setDisjointed(pd)
```

```{r, eval = FALSE}
setEmergent(pd)
```

You can again permute an FDR with the `updateCutoffs` method. Alternatively, you can calculate an exact p-value for $\theta$ based on a F-test. This is handled by the `updateF` method.

```{r, eval = FALSE}
pd <- updateF(
        pd,
        moderated = FALSE,  # moderate stats with limma-voom
        ivar = "clr"  # used for moderation
      ) 
```

## Getters

Both functions return S4 objects. This package includes several helper functions that work for both the `propr` and `propd` output.

```{r, eval = FALSE}
?getMatrix # get results as a square matrix
?getResults # get propr or propd results in long-format
?getRatios # get samples by ratios matrix
```

Use `getResults` to pipe to `ggplot2` for visualization.

We also provide accesory functions to get the significant pairs.
```{r, eval = FALSE}
?getSignificantResultsFDR
?getSignificantResultsFstat
?getAdjacencyFDR
?getAdjacencyFstat
?getCutoffFDR
?getCutoffFstat
```

Notice that for the getter functions to work properly on `propd` objects, you have to set the target `theta` value active:

```{r, eval = FALSE}
setActive(pd, "theta_d")
setActive(pd, "theta_e")
setActive(pd, "theta_mod")
```

## Ratio Methods

COMING SOON!!

Owner

  • Name: Thom Quinn
  • Login: tpq
  • Kind: user
  • Location: The Land Down Under

An MD in a love affair with data

GitHub Events

Total
  • Create event: 10
  • Issues event: 5
  • Release event: 7
  • Watch event: 8
  • Delete event: 4
  • Issue comment event: 10
  • Push event: 13
  • Pull request event: 14
  • Fork event: 3
Last Year
  • Create event: 10
  • Issues event: 5
  • Release event: 7
  • Watch event: 8
  • Delete event: 4
  • Issue comment event: 10
  • Push event: 13
  • Pull request event: 14
  • Fork event: 3

Committers

Last synced: over 2 years ago

All Time
  • Total Commits: 653
  • Total Committers: 4
  • Avg Commits per committer: 163.25
  • Development Distribution Score (DDS): 0.006
Past Year
  • Commits: 1
  • Committers: 1
  • Avg Commits per committer: 1.0
  • Development Distribution Score (DDS): 0.0
Top Committers
Name Email Commits
Thom Quinn c****n@g****m 649
Ryan M. Moore r****7@g****m 2
Suzanne Jin s****n@c****l 1
suzannejin s****o@g****m 1

Issues and Pull Requests

Last synced: 11 months ago

All Time
  • Total issues: 34
  • Total pull requests: 11
  • Average time to close issues: 21 days
  • Average time to close pull requests: 22 days
  • Total issue authors: 25
  • Total pull request authors: 4
  • Average comments per issue: 3.12
  • Average comments per pull request: 0.55
  • Merged pull requests: 8
  • Bot issues: 0
  • Bot pull requests: 0
Past Year
  • Issues: 4
  • Pull requests: 4
  • Average time to close issues: N/A
  • Average time to close pull requests: 1 minute
  • Issue authors: 4
  • Pull request authors: 1
  • Average comments per issue: 0.0
  • Average comments per pull request: 0.0
  • Merged pull requests: 4
  • Bot issues: 0
  • Bot pull requests: 0
Top Authors
Issue Authors
  • jolespin (3)
  • suzannejin (3)
  • grayfall (3)
  • tpq (3)
  • JemmaSun (2)
  • mooreryan (2)
  • kmuench (1)
  • maubarsom (1)
  • handibles (1)
  • danfulop (1)
  • taylorreiter (1)
  • adriaaula (1)
  • SilasK (1)
  • HelloWorldLTY (1)
  • li000678 (1)
Pull Request Authors
  • suzannejin (20)
  • mooreryan (3)
  • Jayanth-kumar5566 (1)
  • slowkow (1)
  • grayfall (1)
  • SilasK (1)
Top Labels
Issue Labels
question (12) helpful (12) bug (5) enhancement (2)
Pull Request Labels

Packages

  • Total packages: 2
  • Total downloads: unknown
  • Total docker downloads: 48
  • Total dependent packages: 3
    (may contain duplicates)
  • Total dependent repositories: 8
    (may contain duplicates)
  • Total versions: 24
cran.r-project.org: propr

Calculating Proportionality Between Vectors of Compositional Data

  • Versions: 21
  • Dependent Packages: 2
  • Dependent Repositories: 7
  • Docker Downloads: 48
Rankings
Stargazers count: 6.8%
Forks count: 7.7%
Average: 10.1%
Dependent repos count: 11.8%
Dependent packages count: 14.0%
Last synced: almost 2 years ago
conda-forge.org: r-propr
  • Versions: 3
  • Dependent Packages: 1
  • Dependent Repositories: 1
Rankings
Dependent repos count: 24.4%
Dependent packages count: 29.0%
Average: 35.0%
Stargazers count: 39.1%
Forks count: 47.5%
Last synced: 11 months ago

Dependencies

DESCRIPTION cran
  • R >= 3.2.2 depends
  • methods * depends
  • Rcpp * imports
  • fastcluster * imports
  • ggplot2 * imports
  • grDevices * imports
  • igraph * imports
  • stats * imports
  • utils * imports
  • ALDEx2 * suggests
  • Biobase * suggests
  • SDMTools * suggests
  • cccrm * suggests
  • compositions * suggests
  • corpcor * suggests
  • data.table * suggests
  • datasets * suggests
  • ggdendro * suggests
  • grid * suggests
  • knitr * suggests
  • limma * suggests
  • parallel * suggests
  • plotly * suggests
  • ppcor * suggests
  • reshape2 * suggests
  • rgl * suggests
  • rmarkdown * suggests
  • testthat * suggests
  • vegan * suggests