Learn R Programming

The propr package implements two analyses: proportionality and differential proportionality.

Proportionality is a compositional alternative to correlation. It is introduced by Lovell et al., expounded by Erb & Notredame, and implemented by Quinn et al. (2017). Differential proportionality is a compositional alternative to differential abundance. It is introduced by Erb et al. (2017), and discussed further by Quinn et al. (2019). Compositional data analysis for genomics is reviewed by Quinn et al. (2018).

If you use this software, please cite our work. We don't get paid to make software, but your citations allow us to negotiate time allocation for software maintence and development.

citation("propr")
## 
## To cite propr in publications use:
## 
##   Quinn TP, Erb I, Gloor G, Notredame C, Richardson MF, Crowley TM
##   (2019) A field guide for the compositional analysis of any-omics
##   data. GigaScience 8(9). doi:10.1093/gigascience/giz107
## 
##   Quinn T, Erb I, Richardson MF, Crowley T (2018) Understanding
##   sequencing data as compositions: an outlook and review.
##   Bioinformatics 34(16): doi:10.1093/bioinformatics/bty175
## 
##   Erb I, Quinn T, Lovell D, Notredame C (2017) Differential
##   Proportionality - A Normalization-Free Approach To Differential
##   Gene Expression. Proceedings of CoDaWork 2017, The 7th
##   Compositional Data Analysis Workshop; available under bioRxiv
##   134536: doi:10.1101/134536
## 
##   Quinn T, Richardson MF, Lovell D, Crowley T (2017) propr: An
##   R-package for Identifying Proportionally Abundant Features Using
##   Compositional Data Analysis. Scientific Reports 7(16252):
##   doi:10.1038/s41598-017-16520-0
## 
##   Erb I, Notredame C (2016) How should we measure proportionality
##   on relative gene expression data? Theory in Biosciences 135(1):
##   doi:10.1007/s12064-015-0220-8
## 
##   Lovell D, Pawlowsky-Glahn V, Egozcue JJ, Marguerat S, Bahler J
##   (2015) Proportionality: A Valid Alternative to Correlation for
##   Relative Data. PLoS Computational Biology 11(3):
##   doi:10.1371/journal.pcbi.1004075
## 
## To see these entries in BibTeX format, use 'print(<citation>,
## bibtex=TRUE)', 'toBibtex(.)', or set
## 'options(citation.bibtex.max=999)'.

OK, now let's get started.

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.

pr <- propr(counts, # rows as samples, like it should be
            metric = "rho", # or "phi", "phs", "cor", "vlr"
            ivar = "clr", # or can use "iqlr" instead
            alpha = NA, # use to handle zeros
            p = 100) # used by updateCutoffs

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

updateCutoffs(pr,
              cutoff = seq(0, 1, .05), # cutoffs at which to estimate FDR
              ncores = 1) # parallelize here

Choose the largest cutoff with an acceptable FDR.

Differential Proportionality

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

pd <- propd(counts,
            group, # a vector of 2 or more groups
            alpha = NA, # whether to handle zeros
            weighted = TRUE, # whether to weigh log-ratios
            p = 100) # used by updateCutoffs

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

setDisjointed(pd)
setEmergent(pd)

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

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. Most of the time, you would want to use getResults. This method only selects pairs beyond a certain size, chosen by the 'cutoff' argument.

?getResults # get results in long-format
?getMatrix # get results as a square matrix
?getAdj # get an adjacency matrix

The vignettes describe some custom visualization methods.

Copy Link

Version

Install

install.packages('propr')

Monthly Downloads

166

Version

4.2.6

License

GPL-2

Issues

Pull Requests

Stars

Forks

Maintainer

Thomas Quinn

Last Published

December 16th, 2019

Functions in propr (4.2.6)

getColours

Label propd Pairs by DE Results
lr2glm

Build a Generalized Linear Model from CLR Data
caneToad.groups

Example Cane Toad Group Data
mail

Mock Mail Count Data
all

A list of most parameters.
dendroCheck

Dendrogram Plot Check
pd.e

Example propd Object
permuteTheta

Permute Theta
getNormTheta

Get Per-Feature Theta
getRatios

Get (Log-)ratios from Object
promptCheck

Feature Check
getNetwork

Get Network from Object
slate

Build propr Results Table
propd

The propd Method
top.counts

Example propr Object
permuteTheta_old

Permute Theta
getReference

Get Reference to Approximate CLR
getMatrix

Get Object as Symmetric Matrix
ivar2index

Build Index from ivar Argument
posthoc

Perform Post-Hoc Testing
qtheta

Calculate a theta Cutoff
permuteTheta_prime

Permute Theta
plotCheck

Plot Check
proprVLR

Calculates the variance of the log of the ratios.
permuteTheta_false

Permute Theta
pra

Principal Ratio Analysis
permuteTheta_naive

Permute Theta
lr2cor

Correlate CLR Data with a Continuous Measurement
calculateTheta_old

Calculate Theta
progress

Make Progress Bar
marg.abs

Example Absolute mRNA
pals

Calculate PALs for Pairs
migraph

igraph Helper Functions
caneToad.counts

Example Cane Toad Count Data
proprPairs

Recasts proportionality matrix as a table of feature pairs.
proprPerb

Calculate proportionality metric rho (Erb 2016).
pd.d

Example propd Object
proprPhit

Calculate proportionality metric phi (Lovell 2015).
proprCLR

Calculates the centered log-ratio transformation.
ratios

Recast Matrix as Feature (Log-)Ratios
getAdj

Get Object as Adjacency Matrix
shale

Build propd Results Table
getResults

Get Results from Object
ggdend

Dendrogram Plot Wrapper
getAdjacency

Get Object as Adjacency Matrix
wide2long

Make Long Data from Wide Data
visualize

Visualize Proportionality
packageCheck

Package Check
propr

The propr Package
multiplot

Plot Multiple Graphs
proprALR

Calculates the additive log-ratio transformation.
proprSym

Symmetrizes a proportionality matrix.
proprTri

Retrieve the lower left triangle of a proportionality matrix.
top.lr

Example propr Object
updateCutoffs

Update FDR by Permutation
alphaTheta_old

Calculate alpha Theta
calculateFDR_old

Calculate FDR Cutoffs
aldex2propr

Import ALDEx2 Object
alphaThetaW_old

Calculate Weighted Theta
calculateFDR

Calculate FDR Cutoffs
aldex.cor

Correlate CLR Data with a Continuous Measurement
aldex.glm

Build a Generalized Linear Model from CLR Data
calculateThetaW_old

Calculate Weighted Theta
calculateTheta

Calculate Theta