Skip to content

Commit 293e522

Browse files
authored
fix(profile-plot): Fix summaries for profile plots for protein turnover (#196)
1 parent 8ebaa57 commit 293e522

1 file changed

Lines changed: 7 additions & 4 deletions

File tree

R/dataProcessPlots.R

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -291,14 +291,18 @@ dataProcessPlots = function(
291291
ifelse(is_labeled_ref, "Reference", "Endogenous"),
292292
levels = c("Reference", "Endogenous")
293293
)]
294+
raw_label_map = c("H" = "Reference", "L" = "Endogenous")
294295
} else {
295296
label_levels = levels(factor(processed$LABEL))
296297
if (length(label_levels) == 2) {
297298
processed[, LABEL := factor(LABEL, labels = c("Heavy", "Light"))]
299+
raw_label_map = c("H" = "Heavy", "L" = "Light")
298300
} else if ("L" %in% label_levels) {
299301
processed[, LABEL := factor(LABEL, labels = c("Endogenous"))]
302+
raw_label_map = c("L" = "Endogenous")
300303
} else {
301304
processed[, LABEL := factor(LABEL, labels = c("Heavy"))]
305+
raw_label_map = c("H" = "Heavy")
302306
}
303307
}
304308

@@ -362,7 +366,6 @@ dataProcessPlots = function(
362366
RUN = unique(summarized$RUN))
363367
summarized = merge(summarized, protein_by_run, by = c("Protein", "RUN"),
364368
all.x = TRUE, all.y = TRUE)
365-
summary_label = if ("Light" %in% levels(processed$LABEL)) "Light" else "Endogenous"
366369
if(!isPlotly) {
367370
savePlot(address, "ProfilePlot_wSummarization", width, height)
368371
}
@@ -372,21 +375,21 @@ dataProcessPlots = function(
372375
if (all(is.na(single_protein$ABUNDANCE))) {
373376
next()
374377
}
375-
378+
376379
pept_feat = unique(single_protein[, list(PEPTIDE, FEATURE)])
377380
counts = pept_feat[, list(N = .N), by = "PEPTIDE"]$N
378381
s = rep(seq_along(counts), times = counts)
379382
ss = unlist(lapply(counts, function(x) seq(1, x)), FALSE, FALSE)
380383
groupNametemp = data.frame(groupName,
381384
FEATURE = unique(single_protein$FEATURE)[1],
382385
analysis = "Run summary")
383-
386+
384387
single_protein_summ = summarized[Protein == all_proteins[i], ]
385388
quant = single_protein_summ[
386389
Protein == all_proteins[i],
387390
list(PROTEIN = unique(Protein), PEPTIDE = "Run summary",
388391
TRANSITION = "Run summary", FEATURE = "Run summary",
389-
LABEL = summary_label, RUN = RUN,
392+
LABEL = raw_label_map[LABEL], RUN = RUN,
390393
ABUNDANCE = LogIntensities, FRACTION = 1,
391394
UPPERBOUND = if("Variance" %in% names(.SD)) LogIntensities + 1.96 * sqrt(Variance) else NA_real_, # 95% confidence interval
392395
LOWERBOUND = if("Variance" %in% names(.SD)) LogIntensities - 1.96 * sqrt(Variance) else NA_real_

0 commit comments

Comments
 (0)