Skip to content

Commit

Permalink
Add metrics Zcg, nO2g, and nH2Og
Browse files Browse the repository at this point in the history
  • Loading branch information
jedick committed Mar 22, 2024
1 parent 8ae9ea6 commit 45a1097
Show file tree
Hide file tree
Showing 7 changed files with 59 additions and 25 deletions.
4 changes: 2 additions & 2 deletions DESCRIPTION
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
Date: 2024-03-16
Date: 2024-03-22
Package: canprot
Version: 1.1.2-40
Version: 1.1.2-41
Title: Chemical Analysis of Proteins
Authors@R: c(
person("Jeffrey", "Dick", email = "[email protected]", role = c("aut", "cre"),
Expand Down
4 changes: 3 additions & 1 deletion NAMESPACE
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,9 @@ export(
# 20240309
"SV",
# 20240310 moved from chem16S
"add_hull"
"add_hull",
# 20240317
"Zcg", "nO2g", "nH2Og"
)

# Imports from default packages
Expand Down
5 changes: 4 additions & 1 deletion R/cplab.R
Original file line number Diff line number Diff line change
Expand Up @@ -15,11 +15,14 @@ cplab <- list(
V0 = quote("Volume per residue (cm" ^ 3 ~ "mol" ^ -1 * ")"),
pV0 = quote("Volume per protein (cm" ^ 3 ~ "mol" ^ -1 * ")"),
V0g = quote("Specific volume (cm" ^ 3 ~ "g" ^ -1 * ")"),
Density = quote("Density (g" ^ -1 ~ "cm" ^ -3 * ")"),
Density = quote("Density (g" ~ "cm" ^ -3 * ")"),
S0 = quote("Entropy per residue (J K" ^ -1 ~ "mol" ^ -1 * ")"),
pS0 = quote("Entropy per protein (J K" ^ -1 ~ "mol" ^ -1 * ")"),
S0g = quote("Specific entropy (J K" ^ -1 ~ "g" ^ -1 * ")"),
SV = quote("Entropy density (J K" ^ -1 ~ "cm" ^ -3 * ")"),
Zcg = quote("Specific" ~ italic(Z)[C]),
nH2Og = quote("Specific" ~ italic(n)[H[2]*O]),
nO2g = quote("Specific" ~ italic(n)[O[2]]),
HC = "H/C",
NC = "N/C",
OC = "O/C",
Expand Down
32 changes: 24 additions & 8 deletions R/metrics.R
Original file line number Diff line number Diff line change
Expand Up @@ -402,25 +402,41 @@ SC <- function(AAcomp, ...) {
}

# Density 20240304
Density <- function(AAcomp, terminal_H2O = 0, ...) {
MW(AAcomp, terminal_H2O = 0, ...) / V0(AAcomp, terminal_H2O = 0, ...)
Density <- function(AAcomp, ...) {
MW(AAcomp, ...) / V0(AAcomp, ...)
}

# Specific volume 20240308
V0g <- function(AAcomp, terminal_H2O = 0, ...) {
V0(AAcomp, terminal_H2O = 0, ...) / MW(AAcomp, terminal_H2O = 0, ...)
V0g <- function(AAcomp, ...) {
V0(AAcomp, ...) / MW(AAcomp, ...)
}

# Specific entropy 20240308
S0g <- function(AAcomp, terminal_H2O = 0, ...) {
S0(AAcomp, terminal_H2O = 0, ...) / MW(AAcomp, terminal_H2O = 0, ...)
S0g <- function(AAcomp, ...) {
S0(AAcomp, ...) / MW(AAcomp, ...)
}

# Entropy density 20240309
SV <- function(AAcomp, terminal_H2O = 0, ...) {
S0(AAcomp, terminal_H2O = 0, ...) / V0(AAcomp, terminal_H2O = 0, ...)
SV <- function(AAcomp, ...) {
S0(AAcomp, ...) / V0(AAcomp, ...)
}

# Specific Zc 20240317
Zcg <- function(AAcomp, ...) {
Zc(AAcomp, ...) / MW(AAcomp, ...)
}

# Specific nO2 20240317
nO2g <- function(AAcomp, ...) {
nO2(AAcomp, ...) / MW(AAcomp, ...)
}

# Specific nH2O 20240317
nH2Og <- function(AAcomp, ...) {
nH2O(AAcomp, ...) / MW(AAcomp, ...)
}


# Metabolic cost 20211220
# Moved from JMDplots/evdevH2O.R to canprot 20240304
Cost <- function(AAcomp, ...) {
Expand Down
14 changes: 10 additions & 4 deletions inst/tinytest/test-metrics.R
Original file line number Diff line number Diff line change
Expand Up @@ -75,9 +75,15 @@ info <- "Metrics don't change"
AA <- structure(list(Ala = 1, Cys = 1, Asp = 1, Glu = 1, Phe = 1, Gly = 1, His = 1, Ile = 1, Lys = 1, Leu = 1,
Met = 1, Asn = 1, Pro = 1, Gln = 1, Arg = 1, Ser = 1, Thr = 1, Val = 1, Trp = 1, Tyr = 1), row.names = 6L, class = "data.frame")
metrics <- names(cplab)
ref_values <- c(-0.074766, -1.14, -0.655, -0.49, 6.74, 118.886024, 2395.73576,
86.785, 1742.989, 0.729985, 1.369891, 35.511, 729.19, 0.298698,
0.409184, 1.46729, 0.271028, 0.271028, 0.018692, 20, 27.36, 29.075,
7.75, 221.25, 228.05, 47.175)
ref_values <- c(
-0.074766, -1.14, -0.655, -0.49, # Zc, nH2O, nO2, GRAVY
6.74, 118.886024, 2395.73576, # pI, MW, pMW
86.785, 1742.989, 0.729985, 1.369891, # V0, pV0, V0g, Density
35.511, 729.19, 0.298698, 0.409184, # S0, pS0, S0g, SV
-0.000629, -0.009589, -0.005509, # ZCg, nH2Og, nO2g
1.46729, 0.271028, 0.271028, 0.018692, # HC, NC, OC, SC
20, 27.36, 29.075, 7.75, # plength, Cost, RespiratoryCost, FermentativeCost
221.25, 228.05, 47.175 # B20Cost, Y20Cost, H11Cost
)
calc_values <- as.numeric(round(sapply(metrics, function(metric) get(metric)(AA)), 6))
expect_equal(calc_values, ref_values)
19 changes: 13 additions & 6 deletions man/metrics.Rd
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,9 @@
\alias{pS0}
\alias{S0g}
\alias{SV}
\alias{Zcg}
\alias{nH2Og}
\alias{nO2g}
\alias{HC}
\alias{NC}
\alias{OC}
Expand Down Expand Up @@ -43,12 +46,14 @@ Calculate chemical metrics for proteins from their amino acid compositions.
pMW(AAcomp, terminal_H2O = 1, ...)
V0(AAcomp, terminal_H2O = 0, ...)
pV0(AAcomp, terminal_H2O = 1, ...)
V0g(AAcomp, terminal_H2O = 0, ...)
Density(AAcomp, terminal_H2O = 0, ...)
V0g(AAcomp, ...)
Density(AAcomp, ...)
S0(AAcomp, terminal_H2O = 0, ...)
pS0(AAcomp, terminal_H2O = 1, ...)
S0g(AAcomp, terminal_H2O = 0, ...)
SV(AAcomp, terminal_H2O = 0, ...)
S0g(AAcomp, ...)
SV(AAcomp, ...)
nH2Og(AAcomp, ...)
nO2g(AAcomp, ...)
HC(AAcomp, ...)
NC(AAcomp, ...)
OC(AAcomp, ...)
Expand Down Expand Up @@ -85,14 +90,14 @@ The metrics are described below:
This metric is independent of the choice of basis species.
Note that \Zc is normalized by number of carbon atoms, not by number of residues.
}
\item{\code{nH2O}}{Stoichiometric hydration state (\nH2O).
\item{\code{nH2O}}{Stoichiometric hydration state (\nH2O per residue).
The available \code{basis} species are:
\itemize{
\item{\samp{QEC} - glutamine, glutamic acid, cysteine, \H2O, \O2 (Dick et al., 2020)}
\item{\samp{QCa} - glutamine, cysteine, acetic acid, \H2O, \O2}
}
}
\item{\code{nO2}}{Stoichiometric oxidation state (\nO2).
\item{\code{nO2}}{Stoichiometric oxidation state (\nO2 per residue).
The basis species also affect this calculation.
}
\item{\code{GRAVY}}{Grand average of hydropathy.
Expand All @@ -118,6 +123,8 @@ The metrics are described below:
\item{\code{pS0}}{Standard molal entropy per protein.}
\item{\code{S0g}}{Specific entropy.}
\item{\code{SV}}{Entropy density.}
\item{\code{nH2Og}}{\nH2O per gram.}
\item{\code{nO2g}}{\nO2 per gram.}
\item{\code{HC}}{H/C ratio (not counting terminal -H and -OH groups).}
\item{\code{NC}}{N/C ratio.}
\item{\code{OC}}{O/C ratio (not counting terminal -H and -OH groups).}
Expand Down
6 changes: 3 additions & 3 deletions vignettes/demos.Rmd
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ The **canprot** functions used are:
knitr::read_chunk("../demo/thermophiles.R")
```

```{r thermophiles_demo_body, out.width = "100%", fig.align = "center", fig.width = 8, fig.height = 6, echo = FALSE, message = FALSE}
```{r thermophiles_demo_body, out.width = "100%", fig.align = "center", fig.width = 8, fig.height = 6, echo = FALSE, message = FALSE, dpi = 150}
```

The data are from @DBCS23 for methanogen genomes (amino acid composition and optimal growth temperature) and from @LLX+24 for *Nitrososphaeria* MAGs (genome assemblies and habitat and respiration types).
Expand All @@ -71,7 +71,7 @@ knitr::read_chunk("../demo/locations.R")
```{r locations_demo_setup, echo = FALSE}
```

```{r locations_demo_body, out.width = "100%", fig.align = "center", fig.width = 8, fig.height = 4.5}
```{r locations_demo_body, out.width = "100%", fig.align = "center", fig.width = 8, fig.height = 4.5, dpi = 150}
```

The plots show carbon oxidation state (`r Zc`) and isoelectric point (pI) for human proteins in different subcellular locations.
Expand All @@ -94,7 +94,7 @@ The **canprot** functions used are:
knitr::read_chunk("../demo/redoxins.R")
```

```{r redoxins_demo_body, out.width = "75%", fig.align = "center", fig.width = 6, fig.height = 5, echo = FALSE, message = FALSE}
```{r redoxins_demo_body, out.width = "75%", fig.align = "center", fig.width = 6, fig.height = 5, echo = FALSE, message = FALSE, dpi = 100}
```

This is an *exploratory analysis* for hypothesis generation about evolutionary links between midpoint reduction potential and `r Zc` of proteins.
Expand Down

0 comments on commit 45a1097

Please sign in to comment.