rank.affinity function

Average Ranks of Chemical Affinities

Average Ranks of Chemical Affinities

Affinity rankings for groups of species. UTF-8

rank.affinity(aout, groups, percent = TRUE)

Arguments

  • aout: list, output of affinity
  • groups: named list of indices (integer or numeric) for species in each group
  • percent: return average rank percentage for each group

Details

The affinities for all species are ranked, then the mean ranking for the species in each group is calculated. The mean rankings of groups are converted to a percentage, or returned as-is if percent is FALSE. Note that the calculations are applied to each set of conditions individually (i.e., each grid point in the affinity affinity calculation).

Returns

The average rankings 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 make line plots or predominance diagrams (the predominance fields correspond to the groups with highest average ranking of affinity).

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 average rankings are used without further modification.

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")
  • Maintainer: Jeffrey Dick
  • License: GPL-3
  • Last published: 2024-02-11