#' Acidity Landscape
#'
#' Create a depcition of the surface showing by color which coordinates are either basic, acidic, or neutral.
#' You have the option of passing more arguments to a facet_wrap() call in th function.
#' @param mypdb
#' This is an object given processed by pdb_dataframe(). Additionally one can add their own acidity categories as long as the column name is still "Acidity"
#' @param ...
#' This passes parameters to a facet_wrap() call from ggplot
#' @return
#' This function returns a one dimensional color based plot of the acidity category (i.e. acidic, neutral, or basic)
#' @export
#'
#' @examples
#' library(Rpdb)
#' library(tidyverse)
#' library(dplyr)
#' library(ggplot2)
#'
#' y <- pdb_dataframe(CYP)
#' z <- assign_params(y)
#' acidity_landscape(z)
#'
acidity_landscape <- function(mypdb, ...){
if(!(tibble::is.tibble(mypdb))) {
stop('This function can only handle pdb files processed by pdb_dataframe!\n',
'You have provided an object of class:', class(mypdb)[1])
}
if(!(is.character(mypdb$Acidity))) {
stop('This function can only use character based categories!\n',
'You have provided an object of class:', class(mypdb$Acidity)[1])
}
eleid <- Acidity <- NULL
ggplot2::ggplot(mypdb, ggplot2::aes(x = eleid, fill = Acidity)) + ggplot2::geom_bar(position = "dodge", na.rm = TRUE) + ggplot2::facet_wrap(~chainid, scales = "free", ...)+ ggplot2::ggtitle("Acidity Landscape")+ggplot2::labs(x="atom coordinate/Acidity category")
}
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.