Package 'PinPath'

Title: Visualization of Omics Data on Pathway Diagrams
Description: With PinPath, you can visualize omics data onto pathways diagrams from WikiPathways and KEGG.
Authors: Jarno Koetsier [aut, cre] (ORCID: <https://orcid.org/0000-0002-7981-1345>), Lars Eijssen [aut] (ORCID: <https://orcid.org/0000-0002-6473-2839>), Egon Willighagen [aut] (ORCID: <https://orcid.org/0000-0001-7542-0286>), Stichting Terre - The Dutch Rett Syndrome Foundation [fnd]
Maintainer: Jarno Koetsier <[email protected]>
License: MIT + file LICENSE
Version: 0.99.3
Built: 2026-06-02 23:39:09 UTC
Source: https://github.com/bioc/PinPath

Help Index


Make default colorList

Description

This function makes default list that can be used to set the node colors in the pathway diagram.

Usage

defaultColorList(ColorVar, ColorNames = NULL)

Arguments

ColorVar

vector or data.frame for coloring the nodes in the pathway. This can be for instance a data.frame with the log2FCs and significance in the columns.

ColorNames

(optional) character vector with names of the color variables. These will be used to set the names in the legend. If colorNames is NULL, the column names of the colorVar data.frame will be used.

Details

For both divergent and sequential color scales, values outside the specified range (minVal to maxVal) are clipped and mapped to the colors corresponding to the minimum (minCol) or maximum (maxCol).

Value

A list that can be provided to drawGPML to set the node colors in the pathway diagram.

Examples

# Load example data
 lung_expr <- read.csv(system.file(
     "extdata","data-lung-cancer.csv", package="PinPath"),
     stringsAsFactors = FALSE)

# Set significance as a binary variable
lung_expr$Significant <- ifelse(lung_expr$adj.P.Value < 0.05, "Yes", "No")

# Make default color list
colorList <- PinPath::defaultColorList(
lung_expr[,c("log2FC", "Significant")])

Draw pathway from GPML file

Description

This function draws a pathway from a GPML file with the option to map, e.g., expression data onto the pathway diagram.

Usage

drawGPML(
  infile,
  outdir = getwd(),
  outname = NULL,
  featureIDs = NULL,
  colorVar = NULL,
  annGenes = NULL,
  annMetabolites = NULL,
  inputDB = NULL,
  colorNames = NULL,
  colorList = NULL,
  NAvalue = "#F0F0F0",
  legend = FALSE,
  nodeTable = FALSE,
  pathInfo = FALSE,
  openFile = FALSE
)

Arguments

infile

Input GPML file. This can be a character string of the GPML file location (e.g., "Downloads/WP42500.gpml") or a GPML string provided by [rWikiPathways::getPathway].

outdir

(optional) Output directory. The pathway and legend images will be saved in this directory.

outname

(optional) The file name of the output pathway image. "svg","png",and "pdf" file extensions are accepted. If no file extension is specified, the pathway and legend image will be generated in .svg format. The legend file gets the "legend_" prefix.

featureIDs

(optional) character vector of feature IDs.

colorVar

(optional) vector or data.frame for coloring the nodes in the pathway. This can be for instance a data.frame with the log2FCs and significance in the columns. The (row) order should match featureIDs. The color rules and palettes for the supplied values can be set in the colorList parameter.

annGenes

(optional) character string of the Bioconductor annotation package (e.g., org.Hs.eg.db).

annMetabolites

(optional) tibble or data.frame with metabolite mapping information (see metaboliteIDmapping package).

inputDB

(optional) Input gene ID type (SYMBOL, ENTREZID, ENSEMBL, UNIPROT). This can be a character vector of length = 1 (if all gene IDs are of the same type) or of length = nrow(featureIDs) (if you want to specify the type per gene ID).

colorNames

(optional) character vector with names of the color variables. If colorNames is NULL, the column names of the colorVar data.frame will be used.

colorList

(optional) A list with information about the coloring of the nodes. An example can be generated using the defaultColorList function.

NAvalue

(optional) Node color for NA values.

legend

(optional) Logical (TRUE or FALSE). Should the legend be plotted?

nodeTable

(optional) Logical (TRUE or FALSE). Should a node table be returned?

pathInfo

(optional) Logical (TRUE or FALSE). Should pathway information be returned?

openFile

(optional) Logical (TRUE or FALSE). Should the pathway file be opened after it has been saved? This option only works for Windows users.

Value

A list with the node table and the file location of the pathway and legend image.

Examples

# Load example data
 lung_expr <- read.csv(system.file(
     "extdata","data-lung-cancer.csv", package="PinPath"),
     stringsAsFactors = FALSE)

 # Select pathway
 infile <- rWikiPathways::getPathway("WP4255")

 # Draw pathway
 pathVis <- PinPath::drawGPML(
     infile = infile,
     outdir = tempdir(),
     annGenes = "org.Hs.eg.db",
     inputDB = "ENSEMBL",
     featureIDs = lung_expr$GeneID,
     colorVar = lung_expr[,"log2FC"],
     nodeTable = TRUE,
     legend = TRUE,
     openFile = FALSE) # <-- set to TRUE to open the image automatically

Draw pathway from KGML file

Description

This function draws a pathway from a KGML file with the option to map, e.g., expression data onto the pathway diagram.

Usage

drawKGML(
  infile,
  outdir = getwd(),
  outname = NULL,
  annGenes = NULL,
  annMetabolites = NULL,
  inputDB = NULL,
  featureIDs = NULL,
  colorVar = NULL,
  colorNames = NULL,
  colorList = NULL,
  NAvalue = "#F0F0F0",
  legend = FALSE,
  nodeTable = FALSE,
  pathInfo = FALSE,
  openFile = FALSE
)

Arguments

infile

Input KGML file. This can be a character string of the KGML file location (e.g., "Downloads/WP42500.KGML").

outdir

(optional) Output directory. The pathway and legend images will be saved in this directory.

outname

(optional) The file name of the output pathway image. "svg","png",and "pdf" file extensions are accepted. If no file extension is specified, the pathway and legend image will be generated in .svg format. The legend file gets the "legend_" prefix.

annGenes

(optional) character string of the Bioconductor annotation package (e.g., org.Hs.eg.db).

annMetabolites

(optional) tibble or data.frame with metabolite mapping information (see metaboliteIDmapping package).

inputDB

(optional) Input gene ID type (SYMBOL, ENTREZID, ENSEMBL, UNIPROT). This can be a character vector of length = 1 (if all gene IDs are of the same type) or of length = nrow(featureIDs) (if you want to specify the type per gene ID).

featureIDs

(optional) character vector of gene IDs.

colorVar

(optional) vector or data.frame for coloring the nodes in the pathway. This can be for instance a data.frame with the log2FCs and significance in the columns. The (row) order should match featureIDs. The color rules and palettes for the supplied values can be set in the colorList parameter.

colorNames

(optional) character vector with names of the color variables. If colorNames is NULL, the column names of the colorVar data.frame will be used.

colorList

(optional) A list with information about the coloring of the nodes. An example can be generated using the defaultColorList function.

NAvalue

(optional) Node color for NA values.

legend

(optional) Logical (TRUE or FALSE). Should the legend be plotted?

nodeTable

(optional) Logical (TRUE or FALSE). Should a node table be returned?

pathInfo

(optional) Logical (TRUE or FALSE). Should pathway information be returned?

openFile

(optional) Logical (TRUE or FALSE). Should the pathway file be opened after it has been saved? This option only works for Windows users.

Value

A list with the node table and the file location of the pathway and legend image.

Examples

# Load example data
 lung_expr <- read.csv(system.file(
     "extdata","data-lung-cancer.csv", package="PinPath"),
     stringsAsFactors = FALSE)

 # Select pathway
 pathway_id <- "hsa05223"
 bfc <- BiocFileCache::BiocFileCache()
 infile <- BiocFileCache::bfcrpath(bfc,
 paste0("https://rest.kegg.jp/get/",pathway_id,"/kgml"))

 # Draw pathway
 pathVis <- PinPath::drawKGML(
     infile = infile,
     outdir = tempdir(),
     annGenes = "org.Hs.eg.db",
     inputDB = "ENSEMBL",
     featureIDs = lung_expr$GeneID,
     colorVar = lung_expr[,"log2FC"],
     nodeTable = TRUE,
     legend = TRUE,
     openFile = FALSE) # <-- set to TRUE to open the image automatically

Draw network from GPML file

Description

This function draws a network from a GPML file with the option to map, e.g., expression data onto the network diagram.

Usage

GPML2Network(
  infile,
  outdir = getwd(),
  outname = NULL,
  featureIDs = NULL,
  colorVar = NULL,
  annGenes = NULL,
  annMetabolites = NULL,
  inputDB = NULL,
  colorNames = NULL,
  colorList = NULL,
  NAvalue = "#F0F0F0",
  layout = "nicely",
  unconnectedNodes = FALSE,
  alpha = 0.9,
  nodeSize = 1,
  legend = FALSE,
  nodeTable = FALSE,
  pathInfo = FALSE,
  openFile = FALSE
)

Arguments

infile

Input GPML file. This can be a character string of the GPML file location (e.g., "Downloads/WP42500.gpml") or a GPML string provided by [rWikiPathways::getPathway].

outdir

(optional) Output directory. The pathway and legend images will be saved in this directory.

outname

(optional) The file name of the output pathway image. "svg","png",and "pdf" file extensions are accepted. If no file extension is specified, the pathway and legend image will be generated in .svg format. The legend file gets the "legend_" prefix.

featureIDs

(optional) character vector of gene IDs.

colorVar

(optional) vector or data.frame for coloring the nodes in the pathway. This can be for instance a data.frame with the log2FCs and significance in the columns. The (row) order should match featureIDs. The color rules and palettes for the supplied values can be set in the colorList parameter.

annGenes

(optional) character string of the Bioconductor annotation package (e.g., org.Hs.eg.db).

annMetabolites

(optional) tibble or data.frame with metabolite mapping information (see metaboliteIDmapping package).

inputDB

(optional) Input gene ID type (SYMBOL, ENTREZID, ENSEMBL, UNIPROT). This can be a character vector of length = 1 (if all gene IDs are of the same type) or of length = nrow(featureIDs) (if you want to specify the type per gene ID).

colorNames

(optional) character vector with names of the color variables. If colorNames is NULL, the column names of the colorVar data.frame will be used.

colorList

(optional) A list with information about the coloring of the nodes. An example can be generated using the defaultColorList function.

NAvalue

(optional) Node color for NA values.

layout

(optional) Network layout from igraph.

unconnectedNodes

(optional) Logical (TRUE or FALSE). Should unconnected (isolated) nodes be shown in the network?

alpha

(optional) Transparency of the nodes.

nodeSize

(optional) Size of the nodes.

legend

(optional) Logical (TRUE or FALSE). Should the legend be plotted?

nodeTable

(optional) Logical (TRUE or FALSE). Should a node table be returned?

pathInfo

(optional) Logical (TRUE or FALSE). Should pathway information be returned?

openFile

(optional) Logical (TRUE or FALSE). Should the pathway file be opened after it has been saved? This option only works for Windows users.

Value

A list with the node table and the file location of the pathway and legend image.

Examples

# Load example data
 lung_expr <- read.csv(system.file(
     "extdata","data-lung-cancer.csv", package="PinPath"),
     stringsAsFactors = FALSE)

 # Select pathway
 infile <- rWikiPathways::getPathway("WP4255")

 # Draw pathway
 pathVis <- PinPath::GPML2Network(
     infile = infile,
     outdir = tempdir(),
     annGenes = "org.Hs.eg.db",
     inputDB = "ENSEMBL",
     featureIDs = lung_expr$GeneID,
     colorVar = lung_expr[,"log2FC"],
     nodeTable = TRUE,
     legend = TRUE,
     openFile = FALSE) # <-- set to TRUE to open the image automatically

Draw network from KGML file

Description

This function draws a pathway from a KGML file with the option to map, e.g., expression data onto the pathway diagram.

Usage

KGML2Network(
  infile,
  outdir = getwd(),
  outname = NULL,
  featureIDs = NULL,
  colorVar = NULL,
  annGenes = NULL,
  annMetabolites = NULL,
  inputDB = NULL,
  colorNames = NULL,
  colorList = NULL,
  NAvalue = "#F0F0F0",
  layout = "nicely",
  unconnectedNodes = FALSE,
  alpha = 0.9,
  nodeSize = 1,
  legend = FALSE,
  nodeTable = FALSE,
  pathInfo = FALSE,
  openFile = FALSE
)

Arguments

infile

Input KGML file. This can be a character string of the KGML file location (e.g., "Downloads/WP42500.KGML").

outdir

(optional) Output directory. The pathway and legend images will be saved in this directory.

outname

(optional) The file name of the output pathway image. "svg","png",and "pdf" file extensions are accepted. If no file extension is specified, the pathway and legend image will be generated in .svg format. The legend file gets the "legend_" prefix.

featureIDs

(optional) character vector of gene IDs.

colorVar

(optional) vector or data.frame for coloring the nodes in the pathway. This can be for instance a data.frame with the log2FCs and significance in the columns. The (row) order should match featureIDs. The color rules and palettes for the supplied values can be set in the colorList parameter.

annGenes

(optional) character string of the Bioconductor annotation package (e.g., org.Hs.eg.db).

annMetabolites

(optional) tibble or data.frame with metabolite mapping information (see metaboliteIDmapping package).

inputDB

(optional) Input gene ID type (SYMBOL, ENTREZID, ENSEMBL, UNIPROT). This can be a character vector of length = 1 (if all gene IDs are of the same type) or of length = nrow(featureIDs) (if you want to specify the type per gene ID).

colorNames

(optional) character vector with names of the color variables. If colorNames is NULL, the column names of the colorVar data.frame will be used.

colorList

(optional) A list with information about the coloring of the nodes. An example can be generated using the defaultColorList function.

NAvalue

(optional) Node color for NA values.

layout

(optional) Network layout from igraph.

unconnectedNodes

(optional) Logical (TRUE or FALSE). Should unconnected (isolated) nodes be shown in the network?

alpha

(optional) Transparency of the nodes.

nodeSize

(optional) Size of the nodes.

legend

(optional) Logical (TRUE or FALSE). Should the legend be plotted?

nodeTable

(optional) Logical (TRUE or FALSE). Should a node table be returned?

pathInfo

(optional) Logical (TRUE or FALSE). Should pathway information be returned?

openFile

(optional) Logical (TRUE or FALSE). Should the pathway file be opened after it has been saved? This option only works for Windows users.

Value

A list with the node table and the file location of the pathway and legend image.

Examples

# Load example data
 lung_expr <- read.csv(system.file(
     "extdata","data-lung-cancer.csv", package="PinPath"),
     stringsAsFactors = FALSE)

 # Select pathway
 pathway_id <- "hsa05223"
 bfc <- BiocFileCache::BiocFileCache()
 infile <- BiocFileCache::bfcrpath(bfc,
 paste0("https://rest.kegg.jp/get/",pathway_id,"/kgml"))

 # Draw pathway
 pathVis <- PinPath::KGML2Network(
     infile = infile,
     outdir = tempdir(),
     annGenes = "org.Hs.eg.db",
     inputDB = "ENSEMBL",
     featureIDs = lung_expr$GeneID,
     colorVar = lung_expr[,"log2FC"],
     nodeTable = TRUE,
     legend = TRUE,
     openFile = FALSE) # <-- set to TRUE to open the image automatically