create_peptide_plot | R Documentation |
This function generates a peptide plot using the provided data and allows for customization of the plot layout.
create_peptide_plot(
data,
y_axis_vars,
x_axis_vars,
y_expand = c(0.1, 0.15),
x_expand = c(0.6, 0.6),
theme_options = NULL,
labs_options = NULL,
color_fill_column,
fill_gradient_options = list(),
label_size = 3,
add_domain = TRUE,
domain = NULL,
domain_start_column = "domain_start",
domain_end_column = "domain_end",
domain_type_column = "domain_type",
domain_color = NULL,
PTM = FALSE,
PTM_type_column = "PTM_type",
PTM_color = NULL,
add_label = TRUE,
label_column = "Character",
label_value = NULL,
column_order = NULL
)
data |
A dataframe containing the PSM data or Area data got from peptide_cluster_quantification. |
y_axis_vars |
A list of variables for the donor and type facets. |
x_axis_vars |
A list of variables for the region facets. |
y_expand |
A numeric vector of length 2 specifying the expansion for the y-axis. Default is |
x_expand |
A numeric vector of length 2 specifying the expansion for the x-axis. Default is |
theme_options |
A list of additional theme options to customize the plot. Default is an empty list. |
labs_options |
A list of additional labs options to customize the plot labels. Default is an empty list. |
color_fill_column |
The name of the column in |
fill_gradient_options |
A list of options for |
label_size |
The size of the labels in the plot. Default is 3. |
add_domain |
A logical value indicating whether to add domain like CDR (Complementarity-Determining Region) to the plot. Default is TRUE. |
domain |
A dataframe containing the domain data with columns including 'domain_start', 'domain_end', and 'domain_type'. |
domain_start_column |
The name of the column in |
domain_end_column |
The name of the column in |
domain_type_column |
The name of the column in |
domain_color |
A list of colors for the domain types. Default is NULL. |
PTM |
A logical value indicating whether to include PTM (Post-Translational Modification) data in the plot. Default is FALSE. |
PTM_type_column |
The name of the column in |
PTM_color |
A list of colors for the PTM types. Default is NULL. |
add_label |
A logical value indicating whether to add labels to the plot. Default is TRUE. |
label_column |
The name of the column in |
label_value |
A list of column names and their values to filter the data for the labels. Default is NULL. |
column_order |
A list of column names and their order for the plot. Default is NULL. |
This function returns a ggplot object representing the PSM plot.
data <- data.frame(
Character = c("X", "Y", "Z", "A", "A", "A"),
Position = 1:6,
Condition_1 = rep("Drug1", 6),
Region_2 = rep("Arm_1", 6),
Area = c(0.000000, 0.000000, 0.000000, 6.643856, 6.643856, 6.643856),
Condition_2 = rep("Donor1", 6),
Region_1 = rep("VH", 6),
PTM = c(FALSE, TRUE, FALSE, FALSE, FALSE, FALSE),
PTM_type = c(NA, "O", NA, NA, NA, NA)
)
domain <- data.frame(
domain_type = c("CDR H1", "CDR H2", "CDR H3"),
Region_1 = c("VH", "VH", "VH"),
Region_2 = c("Arm_1", "Arm_1", "Arm_1"),
Condition_1 = c("Drug1", "Drug1", "Drug1"),
domain_start = c(1, 3, 5),
domain_end = c(2, 4, 6)
)
x_axis_vars <- c("Region_2", "Region_1")
y_axis_vars <- c("Condition_2")
domain_color <- c(
"CDR H1" = "#F8766D",
"CDR H2" = "#B79F00",
"CDR H3" = "#00BA38",
"CDR L1" = "#00BFC4",
"CDR L2" = "#619CFF",
"CDR L3" = "#F564E3"
)
PTM_color <- c(
"Ox" = "red",
"Deamid" = "cyan",
"Cam" = "blue",
"Acetyl" = "magenta"
)
p <- create_peptide_plot(
data,
y_axis_vars,
x_axis_vars,
y_expand = c(0.2, 0.2),
x_expand = c(0.5, 0.5),
theme_options = list(),
labs_options = list(title = "PSM Plot", x = "Position", fill = "PSM"),
color_fill_column = 'Area',
fill_gradient_options = list(),
label_size = 5,
add_domain = TRUE,
domain = domain,
domain_start_column = "domain_start",
domain_end_column = "domain_end",
domain_type_column = "domain_type",
domain_color = domain_color,
PTM = FALSE,
PTM_type_column = "PTM_type",
PTM_color = PTM_color,
add_label = TRUE,
label_column = "Character",
label_value = NULL,
column_order = list(Region_1 = 'VH,VL')
)
print(p)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.