View source: R/unique_subformula_masses.R
unique_subformula_masses | R Documentation |
unique_subformula_masses
will generate a numeric vector of
potential sub formula masses regarding a chemical formula as input.
unique_subformula_masses(fml, names = TRUE, check_validity = FALSE)
fml |
Chemical formula. |
names |
Return respective sub formulas as vector names. |
check_validity |
Filter for chemically valid formulas. |
In mass spectrometry precursor masses are often fragmented and these
fragments are recorded as MS^2 spectra. A frequent task is then to compute
potential chemical formulas for the obtained MS^2 masses. The function
unique_subformula_masses
follows the reverse approach. It allows to
calculate all masses that could be potential breakdown products of a precursor
formula
A named numeric vector. The names are the sub formulas for the calculated exact masses given as numeric.
# specify a formula and calculate all potential combinatorial masses
fml <- c("C6H12O6", "C11H16NO4PS", "C24H51O4P")[1]
tmp <- unique_subformula_masses(fml = fml)
length(tmp); any(duplicated(tmp))
hist(tmp, breaks=seq(floor(min(tmp))-1, ceiling(max(tmp))), main=fml)
# do the same as above but check for chemical plausibility
tmp2 <- unique_subformula_masses(fml = fml, check_validity=TRUE)
length(tmp2)
hist(tmp2, breaks=seq(floor(min(tmp2))-1, ceiling(max(tmp2))), main=fml)
mz <- 147
tmp[abs(tmp-mz)<0.5]
tmp2[abs(tmp2-mz)<0.5]
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.