File: radiolabelling.R

package info (click to toggle)
isospec 2.3.2-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 12,476 kB
  • sloc: cpp: 9,530; python: 2,095; makefile: 180; ansic: 100; sh: 88
file content (34 lines) | stat: -rw-r--r-- 1,489 bytes parent folder | download | duplicates (4)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
library(IsoSpecR)


# We will model a glucose molecule where one of the carbons has been replaced with 
# (14C) with 95% probability.


# First, we define an alternate isotopic table for elements that contains the readiocarbon: 14C with 95% probability, 
# and either 12C or 13C with their natural relative probabilities otherwise. First, we load up standard isotopic data:
data(isotopicData)
isotopes = isotopicData$IsoSpec

# And we add an artificial element X, with 3 isotopes, that will represent the radiocarbon. 
radiolabel = data.frame(
    element = c('X', 'X', 'X'),
    isotope = c('X12', 'X13', 'X14'),
    # Grab the masses of 12C and 13C from IsoSpec builtin data, provide mass of 14C manually
    mass = c(isotopes[isotopes$isotope == 'C12', 'mass'], isotopes[isotopes$isotope == 'C13', 'mass'], 14.003241989),
    # Isotope abundances are: 95% 14C, and the remaining 5% is split between 12C and 13C proportionally to their natural abundances
    abundance = c(isotopes[isotopes$isotope == 'C12', 'abundance'] * 0.05, isotopes[isotopes$isotope == 'C13', 'abundance'] * 0.05, 0.95),
    # unused parameter, kept for backward compatibility, ignore that
    ratioC = c(NA, NA, NA)
)

isotopes = rbind(isotopes, radiolabel)



radioglucose = c(C=5, H=12, O=6, X=1) # A glucose molecule: one of the carbons is replaced with an artificial element X (the readiocarbon)

p = .99 # joint probability of the output

IsoSpecify(radioglucose, p, isotopes = isotopes, showCounts = TRUE)