# \donttest{
# Create example data
data <- data.frame(
sample = c(
rep("S1", 6),
rep("S2", 6),
rep("S1", 2),
rep("S2", 2)
),
protein_id = c(
rep("P1", 12),
rep("P2", 4)
),
precursor = c(
rep(c("A1", "A2", "B1", "B2", "C1", "D1"), 2),
rep(c("E1", "F1"), 2)
),
peptide = c(
rep(c("A", "A", "B", "B", "C", "D"), 2),
rep(c("E", "F"), 2)
),
intensity = c(
rnorm(n = 6, mean = 15, sd = 2),
rnorm(n = 6, mean = 21, sd = 1),
rnorm(n = 2, mean = 15, sd = 1),
rnorm(n = 2, mean = 15, sd = 2)
)
)
data
# Calculate protein abundances
protein_abundance <- calculate_protein_abundance(
data,
sample = sample,
protein_id = protein_id,
precursor = precursor,
peptide = peptide,
intensity_log2 = intensity,
method = "sum",
for_plot = FALSE
)
protein_abundance
# Calculate protein abundances and retain precursor
# abundances that can be used in a peptide profile plot
complete_abundances <- calculate_protein_abundance(
data,
sample = sample,
protein_id = protein_id,
precursor = precursor,
peptide = peptide,
intensity_log2 = intensity,
method = "sum",
for_plot = TRUE
)
complete_abundances
# }
Run the code above in your browser using DataLab