R/assign_params.R

#' Add the chemical properties to the tibble of coordinates for processing.
#'
#'The parameters used for amino acid assignment are shown below, with the reference given at the bottom. LogP values are calculated.
#'Assign logP, acidic/basic/neutral
#' R,-4.2,Acidic
#' K,-3.05,Basic
#' D,-3.89,Acidic
#' N,-3.82,Neutral
#' E,-3.69,Acidic
#' Q,-3.64,Neutral
#' H,-3.32,Basic
#' P,-2.54,Neutral
#' Y,-2.26,Neutral
#' W,-1.05,Neutral
#' S,-3.07,Neutral
#' T,-2.94,Neutral
#' G,-3.21,Neutral
#' A,-2.85,Neutral
#' M,-1.87,Neutral
#' C,-2.49,Neutral
#' F,-1.38,Neutral
#' L,-1.52,Neutral
#' V,-2.26,Neutral
#' I,-1.70,Neutral
#' http://www2d.biglobe.ne.jp/~chem_env/amino/amino2j_e.html
#' @param mypdb
#' This is an object given by a .pdb file process by both Rpdb and pdb_dataframe()
#' @return
#' This function returns another dataframe with logP and acidity parameters by residue
#' @export
#'
#' @examples
#' library(Rpdb)
#' library(tidyverse)
#' library(dplyr)
#'
#' y <- pdb_dataframe(CYP)
#' z <- assign_params(y)
assign_params <- 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])
  }

  df_assign <-
  "resname,logP,Acidity
  ARG,-4.2,Acidic
  LYS,-3.05,Basic
  ASP,-3.89,Acidic
  ASN,-3.82,Neutral
  GLU,-3.69,Acidic
  GLN,-3.64,Neutral
  HIS,-3.32,Basic
  PRO,-2.54,Neutral
  TYR,-2.26,Neutral
  TRP,-1.05,Neutral
  SER,-3.07,Neutral
  THR,-2.94,Neutral
  GLY,-3.21,Neutral
  ALA,-2.85,Neutral
  MET,-1.87,Neutral
  CYS,-2.49,Neutral
  PHE,-1.38,Neutral
  LEU,-1.52,Neutral
  VAL,-2.26,Neutral
  ILE,-1.70,Neutral"

  df_assign2 <- tibble::as_tibble(readr::read_csv(df_assign,trim_ws = TRUE))

  df_assign3 <- dplyr::left_join(mypdb, df_assign2, by = "resname")
  df_assign4 <- stats::na.omit(df_assign3)
  return(df_assign4)

}
zalperst/visualizeprot documentation built on May 4, 2019, 9:08 p.m.