---
title: "Hyperosmotic Stress in Eukaryotic Cells"
output:
  html_vignette:
    mathjax: null
vignette: >
  %\VignetteIndexEntry{Hyperosmotic Stress in Eukaryotic Cells}
  %\VignetteEngine{knitr::rmarkdown}
  %\VignetteEncoding{UTF-8}
bibliography: cpdat.bib
csl: peerj.csl
---

```{r setup, include=FALSE}
library(canprot)
library(knitr)
## use pngquant to reduce size of PNG images
knit_hooks$set(pngquant = hook_pngquant)
pngquant <- "--speed=1 --quality=0-25"
# in case pngquant isn't available (R-Forge?)
if (!nzchar(Sys.which("pngquant"))) pngquant <- NULL 
# read 'basis' option
basis <- getOption("basis")
```

This vignette from the R package [canprot](https://github.com/jedick/canprot) version `r packageDescription("canprot")$Version` shows chemical metrics for proteins that are differentially expressed in eukaryotic cells exposed to hyperosmotic stress, compared to control conditions.
The analysis is described in more detail in a paper ([<span title="Water as a reactant in the differential expression of proteins in cancer">Dick, 2021</a>](https://doi.org/10.1002/cso2.1007)).
Abbreviations:

  * <i>Z</i><sub>C</sub> &ndash; average oxidation state of carbon.
  * <i>n</i><sub>H<sub>2</sub>O</sub> &ndash; stoichiometric hydration state per residue ([<span title="Uncovering chemical signatures of salinity gradients through compositional analysis of protein sequences">Dick et al., 2020</span>](https://doi.org/10.5194/bg-17-6145-2020)) computed using the **`r basis`** basis species (`r basis.text(basis)`, H~2~O, O~2~).

<style type="text/css">
body {
  max-width: 800px;
  margin-left: auto;
  margin-right: auto;
}
</style>

```{r datasets}
datasets <- pdat_osmotic_euk(2020)
```

```{r comptab, results="hide", message=FALSE, echo = FALSE}
pdat1 <- lapply(datasets, pdat_osmotic_euk)
comptab1 <- lapply(pdat1, get_comptab)
comptab2 <- lapply(pdat1, get_comptab, "nAA", "MW")
```

Differences are calculated as (median value for up-regulated proteins) - (median value for down-regulated proteins).
Dashed lines enclose the 50% confidence region for highest probability density.

```{r diffplot, fig.width=5, fig.height=5, fig.align = "center", echo = FALSE, pngquant = pngquant}
par(mar = c(4, 4, 1, 1))
diffplot(comptab1, labtext = NA)
```

In the table, values of &Delta;<i>Z</i><sub>C</sub> and &Delta;<i>n</i><sub>H<sub>2</sub>O</sub> are multiplied by 1000, values of &Delta;MW are multiplied by 100, and negative values are shown in bold.
Abbreviations:

  * _n_~down~ &ndash; number of down-regulated proteins; _n_~up~ &ndash; number of up-regulated proteins; HTS &ndash; hypertonic saline; Cmx &ndash; cytomix treatment.
  * <i>n</i><sub>AA</sub> &ndash; protein length; MW &ndash; molecular weight per residue.

```{r xsummary, results="asis", echo = FALSE}
library(xtable)
out <- xsummary2(comptab1, comptab2)
# round values and include dataset tags
tags <- sapply(sapply(strsplit(datasets, "="), "[", -1), paste, collapse = ";")
out <- cbind(out[, 1:2], tags = tags, out[, 3:16])
out[, 6:17] <- round(out[, 6:17], 4)
file <- paste0("osmotic_euk_", basis, ".csv")
write.csv(out, file, row.names = FALSE, quote = 2)
```

## Data Sources

__a__. Tables II--III of @DAA+05.
__b__. Table 1 of @MHN+08.
__c__. __d__. __e__. __f__. __g__.  Dataset S3 of @LTH+11, filtered to include proteins with _q_-value < 0.05, same direction of change in all 3 replicates for each condition, and median log fold change > 0.2.
__h__. Supplementary Table 1 of @OBBH11.
__i__. __j__. __k__. __l__. __m__. __n__. Supplementary Table S1 of @LFY+12 (sheet "All proteins"), filtered to include proteins with _q_-value < 0.1.
__o__. Table 2 of @CLG+15.
__p__. __q__. Supplemental Data S1 of @SCG+15 (file "ClusterGroup.AllProteins.051814.csv"), filtered to include proteins in clusters 1--4 (differential expression at all time points (1/4) or after > 20 min delay (2/3)).
__r__. Table 1 of @YDZ+15.
__s__. __t__. Supplementary Table 2 of @GAM+16, filtered to include proteins with fold change > 2 or < 0.5.
__u__. Supplementary Tables 2 and 3 of @RBP+16.
__v__. Supplementary Tables 1 and 2 of @JBG+18.

## References
