inst/doc/transformation.R

## ----setup, include=FALSE, message = FALSE------------------------------------
knitr::opts_chunk$set(echo = FALSE)
knitr::opts_chunk$set(dev = "png", dev.args = list(type = "cairo-png"))

## ----echo=FALSE, message=FALSE, warning=FALSE---------------------------------
library(HaDeX2)
library(dplyr) 
library(ggplot2)

tmp_seq <- "GFGDLKSPAGL"
tmp_state <- "Alpha_KSCN"
tmp_time <- "1 min"
time_t <- 1
proton_mass <- 1.00727647

dat <- filter(alpha_dat, Exposure == time_t, State == tmp_state, Sequence == tmp_seq) 

## -----------------------------------------------------------------------------
dat

## ----echo=FALSE---------------------------------------------------------------
dat %>%
  filter(File == "Tania_161108_1eEF1Ba_KSCN_1min") %>%
ggplot() +
  geom_segment(aes(x = Start, xend = End, y = Center, yend = Center, colour = as.factor(z))) +
  # coord_cartesian( xlim = c(30, 75)) +
  labs(title = paste0("Measurements for sequence in ", tmp_state, " state"),
       x = "Position in the sequence",
       color = "z")

## ----echo=FALSE---------------------------------------------------------------
dat %>%
  filter(File == "Tania_161108_1eEF1Ba_KSCN_1min") %>%
mutate(exp_mass = z*(Center - proton_mass)) %>%
  ggplot() +
  geom_segment(aes(x = Start, xend = End, y = exp_mass, yend = exp_mass, colour = as.factor(z))) +
  # coord_cartesian( xlim = c(30, 75)) +
  labs(title = "", # paste0("Measurements for sequence in ", tmp_state, " state"),
       x = "Position in the sequence",
       y = "Measured mass [Da]",
       color = "z")

## ----echo=FALSE---------------------------------------------------------------
dat %>%
mutate(exp_mass = z*(Center - proton_mass)) %>%
  ggplot() +
  geom_segment(aes(x = Start, xend = End, y = exp_mass, yend = exp_mass, colour = as.factor(z), linetype = File)) +
  # coord_cartesian( xlim = c(30, 75)) +
  labs(title = "", # paste0("Measurements for sequence in ", tmp_state, " state"),
       x = "Position in the sequence",
       y = "Measured mass [Da]",
       colour = "z")

## ----echo=FALSE, warning=FALSE, message=FALSE---------------------------------
dat %>%
  mutate(exp_mass = z*(Center - proton_mass)) %>%
  group_by(Sequence, Start, End, File) %>%
  summarize(avg_exp_mass = weighted.mean(exp_mass, Inten, na.rm = TRUE)) %>%
  ungroup(.) %>%
  ggplot() +
  geom_segment(aes(x = Start, xend = End, y = avg_exp_mass, yend = avg_exp_mass, linetype = File)) +
  # coord_cartesian( xlim = c(30, 75), ylim = c(3920.3, 3920.6)) +
  labs(title = "", # paste0("Measurements for sequence in ", tmp_state, " state"),
       x = "Position in the sequence",
       y = "Measured mass [Da]")

## ----echo=FALSE, warning=FALSE, message=FALSE---------------------------------
dat %>%
  mutate(exp_mass = z*(Center - proton_mass)) %>%
  group_by(Sequence, Start, End, File) %>%
  summarize(avg_exp_mass = weighted.mean(exp_mass, Inten, na.rm = TRUE)) %>%
  ungroup(.) %>%
  group_by(Sequence, Start, End) %>%
  summarize(aggMass = mean(avg_exp_mass),
            err_aggMass = sd(avg_exp_mass)) %>%
  ggplot() +
  geom_segment(aes(x = Start, xend = End, y = aggMass, yend = aggMass)) +
  geom_errorbar(aes(x = 6, ymin = aggMass - err_aggMass, ymax = aggMass + err_aggMass)) + 
  # coord_cartesian( xlim = c(30, 75), ylim = c(3920.3, 3920.6)) +
  labs(title = paste0("Measurements for sequence in ", tmp_state, " state"),
       x = "Position in the sequence",
       y = "Measured mass [Da]")

Try the HaDeX2 package in your browser

Any scripts or data that you put into this service are public.

HaDeX2 documentation built on Feb. 9, 2026, 5:07 p.m.