R/visuals_kegg.R

#' Modify visual style for KEGG pathways
#'
#' Apply default changes to KEGG pathways in Cytoscape.
#' Since KGML files for KEGG pathways have the same format and properties, same visual modifications can be applied to all KEGG networks in Cytoscape.
#'
#' @return Modified Cytoscape network of KEGG pathways.
#' @export
#'
#' @examples
visuals_kegg <- function ()
{
    #select unwanted nodes
    selectNodes(
    c("map"),
    by.col = "KEGG_NODE_TYPE",
    preserve.current.selection = TRUE,
    network = NULL)

    #delete unwanted nodes
    deleteSelectedNodes()

    #select the column for node lables
    setNodeLabelMapping(
    'KEGG_NODE_LABEL_LIST_FIRST',
    style.name = "default",
    network = NULL)

    #change node width
    setNodeWidthMapping(
    'KEGG_NODE_TYPE',
    table.column.values = c("ortholog","compound","map"),
    widths = c(5,30,100),
    mapping.type = "d",
    default.width = 1,
    style.name = "default",
    network = NULL)

    #change node height
    setNodeHeightMapping(
    'KEGG_NODE_TYPE',
    table.column.values = c("ortholog","compound","map"),
    heights = c(5,30,30),
    mapping.type = "d",
    default.height = 1,
    style.name = "default",
    network = NULL)

    #change node font size
    setNodeFontSizeMapping(
    'KEGG_NODE_TYPE',
    table.column.values = c("ortholog","compound","map"),
    sizes = c(0,12,15),
    mapping.type = "d",
    default.size = 1,
    style.name = "default",
    network = NULL)

    #change node shape
    setNodeShapeMapping(
    'KEGG_NODE_TYPE',
    table.column.values = c("ortholog","compound","map"),
    c('Rectangle','Circle','Rectangle'),
    default.shape = NULL,
    style.name = "default",
    network = NULL)

    #modify other visual properties
    setNodeColorDefault("#FFFFFF", style.name = "default")
    setNodeBorderColorDefault("#000000", style.name = "default")
    setNodeBorderWidthDefault(1.5, style.name = "default")
    setEdgeColorDefault("#000000", style.name = "default")
    setEdgeLineWidthDefault(1, style.name = "default")
    setNodeFontFaceDefault("Arial,plain,10", style.name = "default")
    setEdgeSourceArrowShapeDefault('ARROW_SHORT', style.name = "default")
    setEdgeTargetArrowShapeDefault('ARROW_SHORT', style.name = "default")
    setNodeBorderWidthDefault(1, style.name = "default")
}
delfarahalireza/calcyt documentation built on April 28, 2022, 12:05 a.m.