Package {wikiprofiler}


Type: Package
Title: Data Integration and Visualization on 'WikiPathways' Graphics
Version: 0.1.7
Description: Retrieves pathway graphics from 'WikiPathways' and maps user-supplied quantitative data, such as gene expression values, onto pathway nodes. Provides a pipe-friendly grammar for building pathway visualizations with layered fills, text highlighting, condition-wise comparisons, data preparation helpers, and batch rendering utilities.
Imports: ggplot2, ggplotify, grDevices, grid, gson, methods, rsvg, yulab.utils (≥ 0.1.7)
Suggests: clusterProfiler, DOSE, knitr, org.Hs.eg.db, quarto, rmarkdown
VignetteBuilder: quarto
ByteCompile: true
License: Artistic-2.0
URL: https://yulab-smu.top/contribution-knowledge-mining/
BugReports: https://github.com/YuLab-SMU/wikiprofiler/issues
Encoding: UTF-8
Config/roxygen2/version: 8.0.0
NeedsCompilation: no
Packaged: 2026-08-25 11:29:42 UTC; HUAWEI
Author: Guangchuang Yu ORCID iD [aut, cre, cph], Yihao Chen [aut]
Maintainer: Guangchuang Yu <guangchuangyu@gmail.com>
Repository: CRAN
Date/Publication: 2026-08-25 12:20:02 UTC

wikiprofiler: Data Integration and Visualization on 'WikiPathways' Graphics

Description

Retrieves pathway graphics from 'WikiPathways' and maps user-supplied quantitative data, such as gene expression values, onto pathway nodes. Provides a pipe-friendly grammar for building pathway visualizations with layered fills, text highlighting, condition-wise comparisons, data preparation helpers, and batch rendering utilities.

Author(s)

Maintainer: Guangchuang Yu guangchuangyu@gmail.com (ORCID) [copyright holder]

Authors:

See Also

Useful links:


read.wp

Description

parse wikipathway gmt file to a gson object

Usage

read.wp(file)

Arguments

file

wikipathway gmt file downloaded from 'https://wikipathways-data.wmcloud.org/current/gmt/'

Value

a 'gson' object

Author(s)

Guangchuang Yu


Objects exported from other packages

Description

These objects are imported from other packages. Follow the links below to see their documentation.

ggplot2

ggsave()


Fill the background of gene with color according to amount of gene expression.

Description

Generate a color array.Fill the gene then generate the legend.

Usage

wp_bgfill(
  p,
  value,
  high = "red",
  low = "blue",
  legend = TRUE,
  legend_x = 0.001,
  legend_y = 0.94
)

Arguments

p

p is

value

value is the amount of expression.

high

The color of highest gene.

low

The color of lowest gene.

legend

Whether you need legend.

legend_x

horizontal position of the legend

legend_y

vertical position of the legend

Value

A 'wpplot' object


Visualize pathway differences between two conditions

Description

Compute pathway-level comparison values from two symbol-keyed numeric vectors and render them through wp_bgfill().

Usage

wp_comparefill(
  p,
  value,
  control,
  mode = c("difference", "log2_ratio"),
  pseudocount = 1,
  high = "red",
  low = "blue",
  legend = TRUE,
  legend_x = 0.001,
  legend_y = 0.94
)

Arguments

p

A wpplot object.

value

Case-condition values.

control

Control-condition values.

mode

Comparison mode: direct difference or log2 ratio.

pseudocount

Added before ratio calculation when mode = "log2_ratio".

high

High-end color passed to wp_bgfill().

low

Low-end color passed to wp_bgfill().

legend

Whether to draw the legend.

legend_x

Horizontal position of the legend.

legend_y

Vertical position of the legend.

Value

A wpplot object.


Map user values to pathway symbols

Description

Normalize a named numeric vector or a data.frame into a symbol-keyed numeric vector that can be used by wp_bgfill().

Usage

wp_map(
  data,
  value_col = NULL,
  symbol_col = NULL,
  id_col = NULL,
  mapping = NULL,
  mapping_from = NULL,
  mapping_to = NULL,
  aggregator = c("mean", "median", "max_abs", "first", "sum"),
  na.rm = TRUE
)

Arguments

data

A named numeric vector or a data.frame.

value_col

Value column name when data is a data.frame.

symbol_col

Symbol column name when data already contains gene symbols.

id_col

Identifier column name when data needs ID mapping.

mapping

Optional ID-to-symbol mapping. It can be a named character vector or a two-column data.frame.

mapping_from

Source ID column in mapping when mapping is a data.frame.

mapping_to

Target symbol column in mapping when mapping is a data.frame.

aggregator

Aggregation rule used when multiple rows map to the same symbol.

na.rm

Whether to remove NA values before aggregation.

Value

A named numeric vector keyed by gene symbol.


Render one or more WikiPathways entries

Description

Render pathway IDs directly from a character vector, a result table, or an enrichment-like S4 object with a result slot.

Usage

wp_render(
  pathway,
  value = NULL,
  control = NULL,
  n = NULL,
  id_col = "ID",
  name_col = NULL,
  dir = NULL,
  file_ext = "png",
  filename_template = "{id}",
  width = NULL,
  height = NULL,
  shadowtext = FALSE,
  bg.r = 2,
  bg.col = "white",
  mode = c("difference", "log2_ratio"),
  pseudocount = 1,
  high = "red",
  low = "blue",
  legend = TRUE,
  legend_x = 0.001,
  legend_y = 0.94
)

Arguments

pathway

Pathway IDs, a data.frame, or an enrichment-like S4 object.

value

Optional symbol-keyed values for single-condition rendering.

control

Optional symbol-keyed control values for comparison rendering.

n

Maximum number of pathway IDs to render.

id_col

Column name that stores pathway IDs.

name_col

Optional column name used for output file naming when pathway is a data.frame or an enrichment-like result table.

dir

Optional output directory. When provided, PNG files are written there.

file_ext

Output file extension(s) passed to wpsave().

filename_template

Output filename template. Supported placeholders: {index}, {id}, and {name}.

width

Width passed to wpsave().

height

Height passed to wpsave().

shadowtext

Whether to add halo text after fill rendering.

bg.r

Halo width passed to wp_shadowtext().

bg.col

Halo color passed to wp_shadowtext().

mode

Comparison mode passed to wp_comparefill().

pseudocount

Pseudocount passed to wp_comparefill().

high

High-end color passed to fill functions.

low

Low-end color passed to fill functions.

legend

Whether to draw the legend.

legend_x

Horizontal position of the legend.

legend_y

Vertical position of the legend.

Value

A named list of wpplot objects.


Add halo above gene name to get a clear view.

Description

Add use svghalo2 function to add halo.

Usage

wp_shadowtext(p, bg.r = 2, bg.col = "white")

Arguments

p

An wpplot class variance.

bg.r

The width of halo.

bg.col

The color of halo.

Value

A 'wpplot' object


Input specific wikipathways ID to get an output in class of wpplot.

Description

Use wikipathways ID to open a local svg file. Then extract related information from svg file and build a wpplot class variance.

Usage

wpplot(ID)

Arguments

ID

ID is wikipathways' ID.

Value

A 'wpplot' object

Examples

## Not run: 
   wpplot('WP179') 

## End(Not run)

Save the 'wpplot' object to a file.

Description

Save the 'wpplot' object to a file.

Usage

wpsave(p, file, width = NULL, height = NULL, ...)

Arguments

p

A 'wpplot' object

file

the file to save the object

width

Width of the figure

height

Height of the figure

...

additional parameter passed to 'ggsave'

Value

output the file and the input 'wpplot' object (invisible)