Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
86 changes: 43 additions & 43 deletions R/utils_dataProcessPlots.R
Original file line number Diff line number Diff line change
Expand Up @@ -293,12 +293,12 @@

yaxis.name = 'Log2-intensities'
## 1st plot for Protein plot
protein_temp = ggplot(aes_string(x = 'xorder', y = 'ABUNDANCE',
color = 'PSM', linetype = 'PSM'),
protein_temp = ggplot(aes(x = .data$xorder, y = .data$ABUNDANCE,
color = .data$PSM, linetype = .data$PSM),
data = sub) +
facet_grid(~RUN) +
geom_point(data = sub, aes(shape=CENSORED), size=dot.size.profile, na.rm=TRUE) +
geom_line(size = 0.5, na.rm=TRUE) +
geom_point(data = sub, aes(shape=.data$CENSORED), size=dot.size.profile, na.rm=TRUE) +
geom_line(linewidth = 0.5, na.rm=TRUE) +
scale_colour_manual(values=cbp[s]) +
scale_linetype_manual(values = ss) +
scale_shape_manual(values = c(16, 1),labels = c("Detected data", "Censored missing data")) +
Expand All @@ -307,10 +307,10 @@
scale_y_continuous(yaxis.name, limits = c(y.limdown, y.limup)) +
scale_x_continuous('MS runs') +
geom_vline(data = groupline.tmp,
aes(xintercept = cumGroupAxis),
aes(xintercept = .data$cumGroupAxis),
colour = "grey", linetype = "longdash") +
geom_text(data = groupline.all.tmp,
aes(x = xorder, y = abundance, label = CONDITION),
aes(x = .data$xorder, y = .data$abundance, label = .data$CONDITION),
size = text.size,
angle = text.angle, hjust = .9,
color = "black") +
Expand Down Expand Up @@ -418,13 +418,13 @@
yaxis.name = 'Log2-intensities'

## Draw summarized ptm plot
ptempall = ggplot(aes_string(x = 'xorder', y = 'ABUNDANCE',
color = 'analysis', linetype = 'PSM',
size = 'analysis'), data = final) +
ptempall = ggplot(aes(x = .data$xorder, y = .data$ABUNDANCE,
color = .data$analysis, linetype = .data$PSM,
size = .data$analysis), data = final) +
facet_grid(~RUN) +
# geom_point(size = dot.size.profile, na.rm=TRUE) +
geom_point(data = final, aes(shape=CENSORED), size=dot.size.profile, na.rm=TRUE) +
geom_line(size = 0.5, na.rm=TRUE) +
geom_point(data = final, aes(shape=.data$CENSORED), size=dot.size.profile, na.rm=TRUE) +
geom_line(linewidth = 0.5, na.rm=TRUE) +
scale_colour_manual(values = c("lightgray", "darkred")) +
scale_shape_manual(values = c(16, 1),labels = c("Detected data", "Censored missing data")) +
scale_size_manual(values = c(1.7, 2), guide = "none") +
Expand All @@ -434,10 +434,10 @@
x = 'MS runs') +
scale_y_continuous(yaxis.name, limits = c(y.limdown, y.limup)) +
geom_vline(data = groupline.tmp,
aes(xintercept = cumGroupAxis),
aes(xintercept = .data$cumGroupAxis),
colour = "grey", linetype = "longdash") +
geom_text(data = groupline.all.tmp,
aes(x = xorder, y = abundance, label = CONDITION),
aes(x = .data$xorder, y = .data$abundance, label = .data$CONDITION),
size = text.size,
angle = text.angle, hjust = .9,
color = "black") +
Expand All @@ -450,7 +450,7 @@

## draw point again because some red summary dots could be hiden
ptempall = ptempall + geom_point(data = final, aes(
x = xorder, y = ABUNDANCE, size = analysis, color = analysis)
x = .data$xorder, y = .data$ABUNDANCE, size = .data$analysis, color = .data$analysis)
)

return(ptempall)
Expand Down Expand Up @@ -717,18 +717,18 @@
## y-axis labeling
yaxis.name = 'Log2-intensities'

ptemp = ggplot(aes_string(x = 'xorder', y = 'ABUNDANCE'),
ptemp = ggplot(aes(x = .data$xorder, y = .data$ABUNDANCE),
data = datafeature) +
facet_grid(~RUN) +
geom_boxplot(aes_string(fill = 'CONDITION'), outlier.shape = 1,
geom_boxplot(aes(fill = .data$CONDITION), outlier.shape = 1,
outlier.size = 1.5) +
labs(title = title, x = 'MS runs') +
scale_y_continuous(yaxis.name, limits = c(ylimdown, ylimup)) +
geom_vline(data = groupline.tmp,
aes(xintercept = cumGroupAxis),
aes(xintercept = .data$cumGroupAxis),
colour = "grey", linetype = "longdash") +
geom_text(data = groupline.all.tmp,
aes(x = xorder, y = abundance, label = CONDITION),
aes(x = .data$xorder, y = .data$abundance, label = .data$CONDITION),
size = text.size,
angle = text.angle, hjust = .9,
color = "black") +
Expand Down Expand Up @@ -786,18 +786,18 @@
sub$xorder = factor(sub$xorder)
yaxis.name = 'Log2-intensities'

ptemp = ggplot(aes_string(x = 'xorder', y = 'ABUNDANCE'),
ptemp = ggplot(aes(x = .data$xorder, y = .data$ABUNDANCE),
data = sub) +
facet_grid(~RUN) +
geom_boxplot(aes_string(fill = 'CONDITION'), outlier.shape = 1,
geom_boxplot(aes(fill = .data$CONDITION), outlier.shape = 1,
outlier.size = 1.5) +
labs(title = protein, x = 'MS runs') +
scale_y_continuous(yaxis.name, limits = c(ylimdown, ylimup)) +
geom_vline(data = groupline.tmp,
aes(xintercept = cumGroupAxis),
aes(xintercept = .data$cumGroupAxis),
colour = "grey", linetype = "longdash") +
geom_text(data = groupline.all.tmp,
aes(x = xorder, y = abundance, label = CONDITION),
aes(x = .data$xorder, y = .data$abundance, label = .data$CONDITION),
size = text.size,
angle = text.angle, hjust = .9,
color = "black") +
Expand Down Expand Up @@ -1141,12 +1141,12 @@
sub$group_aes = paste(sub$CONDITION, sub$FEATURE, sep = "_")
## 1st plot for Protein plot
protein_temp = ggplot(data=sub) + facet_grid(~LABEL) +
geom_point(aes_string(x='RUN', y='ABUNDANCE',
color='FEATURE', shape='CENSORED'), #
geom_point(aes(x=.data$RUN, y=.data$ABUNDANCE,
color=.data$FEATURE, shape=.data$CENSORED), #
size=dot.size.profile, na.rm=TRUE) +
geom_line(aes_string(x='RUN', y='ABUNDANCE',
color='FEATURE', linetype='FEATURE'), #
size = 0.5, na.rm=TRUE) +
geom_line(aes(x=.data$RUN, y=.data$ABUNDANCE,
color=.data$FEATURE, linetype=.data$FEATURE), #
linewidth = 0.5, na.rm=TRUE) +
scale_colour_manual(values=cbp[s]) +
scale_linetype_manual(values = ss) +
scale_shape_manual(values = c(16, 1),labels = c("Detected data", "Censored missing data")) +
Expand All @@ -1155,10 +1155,10 @@
scale_y_continuous(yaxis.name, limits = c(y.limdown, y.limup)) +
scale_x_continuous('MS runs', breaks=groupNametemp$lineNameAxis) +
geom_vline(data = groupNametemp[lineNameAxis != 0],
aes(xintercept = lineNameAxis + 0.5),
aes(xintercept = .data$lineNameAxis + 0.5),
colour = "grey", linetype = "longdash") +
geom_text(data = groupNametemp,
aes_string(x = "RUN", y = "ABUNDANCE", label = "Name"),
aes(x = .data$RUN, y = .data$ABUNDANCE, label = .data$Name),
size = text.size,
angle = text.angle, hjust = .9,
color = "black") +
Expand Down Expand Up @@ -1247,10 +1247,10 @@

## Draw summarized ptm plot
ptempall = ggplot(data=final) +
geom_point(aes_string(x='RUN', y='ABUNDANCE',
color='analysis', shape='CENSORED'), size = dot.size.profile, na.rm=TRUE) +
geom_line(aes_string(x='RUN', y='ABUNDANCE',
color='analysis', linetype='FEATURE'), size = 0.5, na.rm=TRUE) +
geom_point(aes(x=.data$RUN, y=.data$ABUNDANCE,
color=.data$analysis, shape=.data$CENSORED), size = dot.size.profile, na.rm=TRUE) +
geom_line(aes(x=.data$RUN, y=.data$ABUNDANCE,
color=.data$analysis, linetype=.data$FEATURE), linewidth = 0.5, na.rm=TRUE) +
scale_colour_manual(values = c("lightgray", "darkred")) +
scale_shape_manual(values = c(16, 1),labels = c("Detected data", "Censored missing data")) +
scale_size_manual(values = c(1.7, 2), guide = "none") +
Expand All @@ -1260,10 +1260,10 @@
x = 'MS runs') +
scale_y_continuous(yaxis.name, limits = c(y.limdown, y.limup)) +
geom_vline(data = groupNametemp[lineNameAxis != 0],
aes(xintercept = lineNameAxis + 0.5),
aes(xintercept = .data$lineNameAxis + 0.5),
colour = "grey", linetype = "longdash") +
geom_text(data = groupNametemp,
aes(x = RUN, y = ABUNDANCE, label = Name),
aes(x = .data$RUN, y = .data$ABUNDANCE, label = .data$Name),
size = text.size,
angle = text.angle, hjust = .9,
color = "black") +
Expand Down Expand Up @@ -1528,17 +1528,17 @@
## y-axis labeling
yaxis.name = 'Log-intensities'

ptemp = ggplot(aes_string(x = 'RUN', y = 'ABUNDANCE'),
ptemp = ggplot(aes(x = .data$RUN, y = .data$ABUNDANCE),
data = datafeature) +
geom_boxplot(aes_string(fill = 'CONDITION'), outlier.shape = 1,
geom_boxplot(aes(fill = .data$CONDITION), outlier.shape = 1,
outlier.size = 1.5) +
labs(title = title, x = 'MS runs') +
scale_y_continuous(yaxis.name, y.limdown, y.limup) +
Comment on lines +1531 to 1536
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue

QC (all, LF): fix limits arg and undefined text.angle

  • scale_y_continuous is using positional args; limits isn’t set.
  • text_angle = text.angle references an undefined symbol in this scope.

Apply:

-    scale_y_continuous(yaxis.name, y.limdown, y.limup) +
+    scale_y_continuous(yaxis.name, limits = c(y.limdown, y.limup)) +
@@
-    theme_msstats(type = "PROFILEPLOT", x.axis.size, y.axis.size,
-                  13, 
-                  element_rect(fill = "gray95"),
-                  element_text(colour = c("#00B0F6"), size = 14),
-                  "none", text_angle = text.angle)
+    theme_msstats(type = "PROFILEPLOT", x.axis.size, y.axis.size,
+                  13, 
+                  element_rect(fill = "gray95"),
+                  element_text(colour = c("#00B0F6"), size = 14),
+                  "none", text_angle = 0)

Also applies to: 1539-1542, 1549-1549

🤖 Prompt for AI Agents
R/utils_dataProcessPlots.R lines ~1531-1536 (also apply same fixes at 1539-1542
and 1549): scale_y_continuous currently uses positional args so limits are not
set — change it to scale_y_continuous(limits = c(y.limdown, y.limup), name =
yaxis.name) to explicitly set limits and axis label; also replace the invalid
text_angle = text.angle usage with angle = text_angle (or use a defined variable
name consistently), ensuring text_angle is defined/passed into the function or
given a default so theme(element_text(angle = text_angle)) uses a valid symbol.

geom_vline(data = groupName.tmp[lineNameAxis != 0],
aes(xintercept = lineNameAxis + 0.5),
aes(xintercept = .data$lineNameAxis + 0.5),
colour = "grey", linetype = "longdash") +
geom_text(data = groupName.tmp,
aes(x = RUN, y = ABUNDANCE - 1, label = Name),
aes(x = .data$RUN, y = .data$ABUNDANCE - 1, label = .data$Name),
size = text.size,
angle = 0,color = "black") +
theme_msstats(type = "PROFILEPLOT", x.axis.size, y.axis.size,
Expand Down Expand Up @@ -1587,17 +1587,17 @@
## for boxplot, x-axis, xorder should be factor
yaxis.name = 'Log-intensities'

ptemp = ggplot(aes_string(x = 'RUN', y = 'ABUNDANCE'),
ptemp = ggplot(aes(x = .data$RUN, y = .data$ABUNDANCE),
data = sub) +
geom_boxplot(aes_string(fill = 'CONDITION'), outlier.shape = 1,
geom_boxplot(aes(fill = .data$CONDITION), outlier.shape = 1,
outlier.size = 1.5) +
labs(title = protein, x = 'MS runs') +
scale_y_continuous(yaxis.name, limits = c(y.limdown, y.limup)) +
geom_vline(data = groupname.tmp[lineNameAxis != 0],
Comment on lines +1590 to 1596
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue

QC (single, LF): fix undefined text.angle

Same issue as above: text.angle isn’t defined in this function.

Apply:

-    theme_msstats(type = "PROFILEPLOT", x.axis.size, y.axis.size,
-                  13, 
-                  element_rect(fill = "gray95"),
-                  element_text(colour = c("#00B0F6"), size = 14),
-                  "none", text_angle = text.angle)
+    theme_msstats(type = "PROFILEPLOT", x.axis.size, y.axis.size,
+                  13, 
+                  element_rect(fill = "gray95"),
+                  element_text(colour = c("#00B0F6"), size = 14),
+                  "none", text_angle = 0)

Also applies to: 1598-1603

aes(xintercept = lineNameAxis + .5),
aes(xintercept = .data$lineNameAxis + .5),
colour = "grey", linetype = "longdash") +
geom_text(data = groupname.tmp,
aes(x = RUN, y = ABUNDANCE, label = Name),
aes(x = .data$RUN, y = .data$ABUNDANCE, label = .data$Name),
size = text.size,
color = "black") +
theme_msstats(type = "PROFILEPLOT", x.axis.size, y.axis.size,
Expand Down
28 changes: 14 additions & 14 deletions R/utils_groupComparisonPlots.R
Original file line number Diff line number Diff line change
Expand Up @@ -302,7 +302,7 @@

limits = c(-1,1)*max(abs(temp_obj$sign_adj_pval[
is.finite(temp_obj$sign_adj_pval)]))
temp_heatmap = ggplot(temp_obj, aes(Label, Protein, fill = sign_adj_pval)
temp_heatmap = ggplot(temp_obj, aes(.data$Label, .data$Protein, fill = .data$sign_adj_pval)
) + geom_tile() + scale_fill_distiller(
palette = "RdBu", name = "(sign) Adj pvalue",
limits = limits) + labs(
Expand Down Expand Up @@ -528,9 +528,9 @@
log_title = 'Log10'
}

ptemp = ggplot(aes_string(x='logFC', y='logadjp',
color='colgroup',
label='Protein'),
ptemp = ggplot(aes(x = .data$logFC, y = .data$logadjp,
color = .data$colgroup,
label = .data$Protein),
data=subtemp) +
geom_point(size=dot.size) +
scale_colour_manual(values=c("gray65", "blue", "red"),
Expand All @@ -553,7 +553,7 @@
} else {
ptemp = ptemp +
geom_text_repel(data=subtemp[subtemp$colgroup != "black", ],
aes(label=Protein),
aes(label = .data$Protein),
size=text.size,
col='black')
}
Expand All @@ -579,9 +579,9 @@

pfinal = ptemp +
geom_line(data=sigcut,
aes_string(x='logFC', y='logadjp', linetype='line'),
aes(x = .data$logFC, y = .data$logadjp, linetype = .data$line),
colour="darkgrey",
size=0.6,
linewidth=0.6,
show.legend=TRUE) +
scale_linetype_manual(values=c('twodash'=6),
labels=c(paste0("Adj p-value cutoff (", sig, ")"))
Expand Down Expand Up @@ -622,19 +622,19 @@
## three lines, with order color first and then assign linetype manual
pfinal = ptemp +
geom_line(data=sigcut,
aes_string(x='logFC', y='logadjp', linetype='line'),
aes(x = .data$logFC, y = .data$logadjp, linetype = .data$line),
colour="darkgrey",
size=0.6,
linewidth=0.6,
show.legend=TRUE) +
geom_line(data=FCcutpos,
aes_string(x='logFC', y='logadjp', linetype='line'),
aes(x = .data$logFC, y = .data$logadjp, linetype = .data$line),
colour="darkgrey",
size=0.6,
linewidth=0.6,
show.legend=TRUE) +
geom_line(data=FCcutneg,
aes_string(x='logFC', y='logadjp', linetype='line'),
aes(x = .data$logFC, y = .data$logadjp, linetype = .data$line),
colour="darkgrey",
size=0.6) +
linewidth=0.6) +
scale_linetype_manual(values=c('dotted'=3, 'twodash'=6),
labels=c(paste0("Fold change cutoff (", FCcutoff,
")"),
Expand Down Expand Up @@ -671,4 +671,4 @@
if (isPlotly) {
plots
}
}
}
Loading