Learn R Programming

CHNOSZ (version 0.9-7)

util.misc: Functions for Miscellaneous Tasks

Description

Calculate $dP/dT$ and temperature of phase transitions, calculate heat capacities of unfolded proteins using an equation from the literature, calculate non-ideal contributions to apparent standard molal properties, identify a conserved basis species, execute multicore calculations, scale logarithms of activity to a desired total activity, get name of calling function.

Usage

protein.length(protein)
  MP90.cp(T, protein)
  dPdTtr(x)
  Ttr(x, P = 1, dPdT = NULL)
  describe(x = NULL, T = NULL, P = NULL, use.name = FALSE, 
    as.reaction = NULL, digits = 1)
  basis.comp(basis)
  nonideal(species, proptable, IS, T)
  which.balance(species)
  unitize(logact = NULL, length = NULL, logact.tot = 0)
  caller.name(n)

Arguments

protein
character, name of protein species; numeric, species index of protein.
T
numeric, temperature (K) (lines.water, describe, MP90.cp, nonideal).
x
numeric index of a mineral phase (dPdTtr, Ttr), or dataframe, definition of basis species or reaction (describe).
P
numeric, pressure (bar).
dPdT
numeric, values of ($dP/dT$) of phase transitions (Ttr).
use.name
logical, write names instead of formulas? (describe).
as.reaction
logical, interpret input as a reaction?
digits
numeric, how many digits to round logarithms of activities.
basis
numeric or character, species number or formula.
species
Names or indices of species for which to calculate nonideal properties (nonideal), or dataframe, species definition such as that in thermo$species (which.balance).
proptable
list of dataframes of species properties.
IS
numeric, ionic strength(s) used in nonideal calculations, mol kg$^{-1}$.
logact
numeric, logarithms of activity.
length
numeric, numbers of residues.
logact.tot
numeric, logarithm of total activity.
n
numeric, number of frame to go up.

Value

  • Numeric returns are made by, protein.length, dPdTtr, Ttr, MP90.cp, spearman, mod.obigt Functions with no (or unspecified) returns are thermo.plot.new, thermo.postscript, label.plot and water.lines.

Details

The argument of protein.length, if it is character, refers to the name of protein(s) (e.g., LYSC_CHICK) for which to calculate the length (number of amino acid residues). If the argument is numeric, it refers to the species index of a protein (value in thermo$species$ispecies). For a positive numeric argument to work, the protein information must have been previously loaded into the species list (using info). If the numeric value is negative, it refers to the rownumber of the protein in thermo$protein. MP90.cp takes T (one or more temperatures in $^{\circ}$C) and protein (name of protein) and returns the heat capacity of the unfolded protein using values of heat capacities of the residues taken from Makhatadze and Privalov, 1990. Those authors provided values of heat capacity at six points between 5 and 125 $^{\circ}$C; this function interpolates (using splinefun) values at other temperatures.

dPdTtr returns values of $(dP/dT)_{Ttr}$, where $Ttr$ represents the transition temperature, of the phase transition at the high-$T$ stability limit of the xth species in thermo$obigt (no checking is done to verify that the species represents in fact one phase of a mineral with phase transitions). dPdTtr takes account of the Clapeyron equation, $(dP/dT)_{Ttr}$=${\Delta}S/{\Delta}V$, where ${\Delta}S$ and ${\Delta}V$ represent the changes in entropy and volume of phase transition, and are calculated using subcrt at Ttr from the standard molal entropies and volumes of the two phases involved. Using values of dPdT calculated using dPdTtr or supplied in the arguments, Ttr returns as a function of P values of the upper transition temperature of the mineral phase represented by the xth species.

describe generates a textual representation of the temperature, pressure, and logarithms of activities of the basis species, given in the arguments by x (i.e. the dataframe in thermo$basis) and T and P (given in Kelvin and bar and converted by the function to those specified by nuts). The digits argument tells to what decimal place the logarithms of activities should be rounded. If any of the supplied arguments is NULL its specification is not printed in the output; T and P, if present, are prepended to the basis summary. If x instead is a dataframe representing a chemical reaction (as output by subcrt and identified by having a column named coeff), the function returns a textual summary of that reaction (i.e., showing reactants on the left, an equal sign, and products on the right; reactants and products are preceded by their reaction coefficient unless it is $1$). However, if only reactants or products can be found, or as.reaction is set to FALSE, the names or formulas of the species are printed with their coefficients and interceding plus or minus signs, as appropriate. Whether the names or formulas are printed is controlled by use.name (FALSE by default), a logical vector the length of which corresponds to the number of rows in x (but is expanded to the right length if needed).

basis.comp calculates the composition of the given

nonideal takes a list of dataframes (in proptable) containing the standard molal properties of the identified species. For those species whose charge (determined by the number of Z in their makeup) is not equal to zero, the values of IS are combined with Alberty's (2003) equation 3.6-1 (Debye-Huckel equation) and its derivatives, to calculate apparent molal properties at the specified ionic strength(s) and temperature(s). The lengths of IS and T supplied in the arguments should be equal to the number of rows of each dataframe in proptable, or one to use single values throughout. The apparent molal properties that can be calculated include G, H, S and Cp; any columns in the dataframes of proptable with other names are left untouched. A column named loggam (logarithm of gamma, the activity coefficient) is appended to the output dataframe of species properties.

which.balance returns, in order, which column(s) of species all have non-zero values. It is used by diagram and transfer to determine a conservant (i.e. basis species that are conserved in transformation reactions) if none is supplied by the user.

spearman calculates Spearman's rank correlation coefficient for a and b.

unitize scales the logarithms of activities given in logact so that the logarithm of total activity of residues is equal to zero (i.e. total activity of residues is one), or to some other value set in logact.tot. length indicates the number of residues in each species. If logact is NULL, the function takes the logarithms of activities from the current species definition. If any of those species are proteins, the function gets their lengths using protein.length.

caller.name returns the name of the calling function n frames up (i.e., for n equal to 2, the caller of the function that calls this one). If called interactively, returns character().

References

Alberty, R. A. (2003) Thermodynamics of Biochemical Reactions, John Wiley & Sons, Hoboken, New Jersey, 397 p. http://www.worldcat.org/oclc/51242181

Makhatadze, G. I. and Privalov, P. L. (1990) Heat capacity of proteins. 1. Partial molar heat capacity of individual amino acid residues in aqueous solution: Hydration effect J. Mol. Biol. 213, 375--384. http://dx.doi.org/10.1016/S0022-2836(05)80197-4

See Also

For some of the functions on which these utilities depend or were modeled, see paste, substr, tolower, par and text.

Examples

Run this code
data(thermo)
  ## calculate protein length
  protein.length("LYSC_CHICK")
  # another way to do it
  basis("CHNOS")
  species("LYSC_CHICK")
  protein.length(species()$ispecies)
  # another way to do it
  ip <- protein("LYSC","CHICK")
  protein.length(-ip)

  ## heat capacity as a function of temperature
  ## (Makhatadze & Privalov, 1990) units: J mol-1
  MP90.cp(c(5,25,50,75,100,125),"LYSC_CHICK")

  ## properties of phase transitions
  si <- info("enstatite")
  # (dP/dT) of transitions
  dPdTtr(si)  # first transition
  dPdTtr(si+1) # second transition
  # temperature of transitions (Ttr) as a function of P
  Ttr(si,P=c(1,10,100,1000))
  Ttr(si,P=c(1,10,100,1000))
  
  ## the basis stoichiometry of a made-up species
  # warns because P isn't in our basis
  basis("CHNOS")
  basis.comp("SPONCH")

  ## describing the basis species
  basis("CHNOSe")
  describe(thermo$basis)
  describe(thermo$basis,T=NULL,P=NULL)

  ## scale logarithms of activity
  # suppose we have two proteins whose lengths are 100 and 
  # 200; what are the logarithms of activity of the proteins 
  # that are equal to each other and that give a total 
  # activity of residues equal to unity?
  logact <- c(-3,-3)  # could be any two equal numbers
  length <- c(100,200)
  logact.tot <- 0
  loga <- unitize(logact,length,logact.tot)
  # the proteins have equal activity
  stopifnot(identical(loga[1],loga[2]))
  # the sum of activity of the residues is unity
  stopifnot(isTRUE(all.equal(sum(10^loga * length),1)))
  ## now, what if the activity of protein 2 is ten
  ## times that of protein 1?
  logact <- c(-3,-2)
  loga <- unitize(logact,length,logact.tot)
  # the proteins have unequal activity
  stopifnot(isTRUE(all.equal(loga[2]-loga[1],1)))
  # but the activities of residues still add up to one
  stopifnot(isTRUE(all.equal(sum(10^loga * length),1)))

Run the code above in your browser using DataLab