rank.affinity: Normalized Sums of Ranks of Chemical Affinities

View source: R/rank.affinity.R

rank.affinityR Documentation

Normalized Sums of Ranks of Chemical Affinities

Description

Affinity ranking for groups of species.

Usage

  rank.affinity(aout, groups)

Arguments

aout

list, output of affinity

groups

named list of indices (integer or numeric) for species in each group

Details

The following calculations are applied to each set of conditions (i.e., grid point if affinity was called with two variables). The ranks of affinities for all species are first computed. Then, the ranks for the species in each group are summed and divided by the number of species in that group (this is the normalization step).

Value

The normalized sum of ranks are inserted into the values element of aout, and the names of the groups are inserted into the species element. The result can be used by diagram to show the groups with the highest normalized sum of ranks.

Note

The reaction coefficients in the species element of the returned value of aout are not valid. Because balancing on a basis species (i.e., dividing by its reaction coefficient) would be incorrect, diagram enforces balance = 1 so that that the normalized sums of ranks are used as-is.

See Also

demo("rank.affinity")

Examples

# Compare Rubisco proteins from three domains
datfile <- system.file("extdata/cpetc/rubisco.csv", package = "CHNOSZ")
fastafile <- system.file("extdata/protein/rubisco.fasta", package = "CHNOSZ")
dat <- read.csv(datfile)
aa <- read.fasta(fastafile)
groups <- sapply(c("A", "B", "E"), "==", dat$domain, simplify = FALSE)
names(groups) <- c("Archaea", "Bacteria", "Eukaryota")
ip <- add.protein(aa, as.residue = TRUE)
basis("QEC")
aout <- affinity(O2 = c(-74, -66, 100), H2O = c(-4, 4, 100), iprotein = ip)
arank <- rank.affinity(aout, groups = groups)
nspecies <- sapply(groups, sum)
names <- paste0(names(groups), " (", nspecies, ")")
diagram(arank, fill = "terrain", font = 2, names = names, format.names = FALSE)
title("Average affinity ranking of Rubisco proteins")

CHNOSZ documentation built on March 31, 2023, 7:54 p.m.