Next: util.seq
Up: CHNOSZ examples
Previous: util.formula
utl.ms> ## Don't show:
utl.ms> data(thermo)
thermo$obigt has 1800 aqueous, 2925 total species
utl.ms> ## End Don't show
utl.ms> ## calculate protein length
utl.ms> protein.length("LYSC_CHICK")
[1] 129
utl.ms> # another way to do it
utl.ms> basis("CHNOS")
C H N O S ispecies logact state
CO2 1 0 0 2 0 69 -3 aq
H2O 0 2 0 1 0 1 0 liq
NH3 0 3 1 0 0 68 -4 aq
H2S 0 2 0 0 1 70 -7 aq
O2 0 0 0 2 0 2691 -80 gas
utl.ms> species("LYSC_CHICK")
protein: found LYSC_CHICK (C613H959N193O185S10, 129 residues)
CO2 H2O NH3 H2S O2 ispecies logact state name
1 613 180 193 10 -610.5 2926 -3 aq LYSC_CHICK
utl.ms> protein.length(species()$ispecies)
[1] 129
utl.ms> # another way to do it
utl.ms> ip <- protein("LYSC","CHICK")
utl.ms> protein.length(-ip)
[1] 129
utl.ms> ## heat capacity as a function of temperature
utl.ms> ## (Makhatadze & Privalov, 1990) units: J mol-1
utl.ms> MP90.cp(c(5,25,50,75,100,125),"LYSC_CHICK")
[1] 27536.9 29714.4 31570.3 32239.3 32967.6 33114.8
utl.ms> ## properties of phase transitions
utl.ms> si <- info("enstatite")
info: enstatite (MgSiO3) available in cr1, cr2, cr3.
info: 1897 refers to enstatite, MgSiO3 cr1 (HDN+78, 5.May.78)
utl.ms> # (dP/dT) of transitions
utl.ms> dPdTtr(si) # first transition
[1] 384.5063
utl.ms> dPdTtr(si+1) # second transition
[1] 11.90108
utl.ms> # temperature of transitions (Ttr) as a function of P
utl.ms> Ttr(si,P=c(1,10,100,1000))
[1] 903.0026 903.0260 903.2601 905.6007
utl.ms> Ttr(si,P=c(1,10,100,1000))
[1] 903.0026 903.0260 903.2601 905.6007
utl.ms> ## the basis stoichiometry of a made-up species
utl.ms> # warns because P isn't in our basis
utl.ms> basis("CHNOS")
C H N O S ispecies logact state
CO2 1 0 0 2 0 69 -3 aq
H2O 0 2 0 1 0 1 0 liq
NH3 0 3 1 0 0 68 -4 aq
H2S 0 2 0 0 1 70 -7 aq
O2 0 0 0 2 0 2691 -80 gas
utl.ms> basis.comp("SPONCH")
basis.comp: missing element P from species SPONCH.
CO2 H2O NH3 H2S O2
missing 1 -2 1 1 0.5
utl.ms> ## describing the basis species
utl.ms> basis("CHNOSe")
C H N O S Z ispecies logact state
CO2 1 0 0 2 0 0 69 -3 aq
H2O 0 2 0 1 0 0 1 0 liq
NH3 0 3 1 0 0 0 68 -4 aq
H2S 0 2 0 0 1 0 70 -7 aq
e- 0 0 0 0 0 -1 2 -7 aq
H+ 0 1 0 0 0 1 3 -7 aq
utl.ms> describe(thermo$basis)
[1] "25 C, 1 bar, aCO2(-3), aH2O(0), aNH3(-4), aH2S(-7), ae-(-7), aH+(-7)"
utl.ms> describe(thermo$basis,T=NULL,P=NULL)
[1] "aCO2(-3), aH2O(0), aNH3(-4), aH2S(-7), ae-(-7), aH+(-7)"
utl.ms> ## scale logarithms of activity
utl.ms> ## suppose we have two proteins whose lengths
utl.ms> ## are 100 and 200; what are the logarithms
utl.ms> ## of activity of the proteins that are equal to
utl.ms> ## each other and that give a total activity of
utl.ms> ## residues equal to unity?
utl.ms> logact <- c(-3,-3) # could be any two equal numbers
utl.ms> length <- c(100,200)
utl.ms> logact.tot <- 0
utl.ms> loga <- unitize(logact,length,logact.tot)
utl.ms> # the proteins have equal activity
utl.ms> stopifnot(identical(loga[1],loga[2]))
utl.ms> # the sum of activity of the residues is unity
utl.ms> stopifnot(isTRUE(all.equal(sum(10^loga * length),1)))
utl.ms> ## now, what if the activity of protein 2 is ten
utl.ms> ## times that of protein 1?
utl.ms> logact <- c(-3,-2)
utl.ms> loga <- unitize(logact,length,logact.tot)
utl.ms> # the proteins have unequal activity
utl.ms> stopifnot(isTRUE(all.equal(loga[2]-loga[1],1)))
utl.ms> # but the activities of residues still add up to one
utl.ms> stopifnot(isTRUE(all.equal(sum(10^loga * length),1)))
Next: util.seq
Up: CHNOSZ examples
Previous: util.formula