ggkegg

Analyzing and visualizing KEGG information using the grammar of graphics

https://github.com/noriakis/ggkegg

Science Score: 13.0%

This score indicates how likely this project is to be science-related based on various indicators:

  • CITATION.cff file
  • codemeta.json file
    Found codemeta.json file
  • .zenodo.json file
  • DOI references
  • Academic publication links
  • Academic email domains
  • Institutional organization owner
  • JOSS paper metadata
  • Scientific vocabulary similarity
    Low similarity (12.8%) to scientific vocabulary

Keywords

ggplot2 ggraph kegg pathway r tidygraph visualization
Last synced: 6 months ago · JSON representation

Repository

Analyzing and visualizing KEGG information using the grammar of graphics

Basic Info
Statistics
  • Stars: 232
  • Watchers: 7
  • Forks: 16
  • Open Issues: 11
  • Releases: 0
Topics
ggplot2 ggraph kegg pathway r tidygraph visualization
Created almost 3 years ago · Last pushed 11 months ago
Metadata Files
Readme Changelog License

README.Rmd

---
output: github_document
---



```{r setup, include = FALSE}
knitr::opts_chunk$set(
  collapse = TRUE,
  comment = "#>",
  fig.path = "man/figures/README-",
  fig.dev = "grDevices::png",
  dpi = 300L,
  dev.args = list(),
  fig.ext = "png",
  fig.height=8,
  fig.width=12,
  fig.retina = 2L,
  fig.align = "center"
)
```

# ggkegg


[![R-CMD-check](https://github.com/noriakis/ggkegg/actions/workflows/R-CMD-check.yaml/badge.svg)](https://github.com/noriakis/ggkegg/actions/workflows/R-CMD-check.yaml)


A set of functions to analyse and plot the KEGG information using `tidygraph`, `ggraph` and `ggplot2`.

The detailed documentation is [here](https://noriakis.github.io/software/ggkegg) using `bookdown`.

## Installation

Using `BiocManager`:

```{r, eval=FALSE}
BiocManager::install("ggkegg")
```

Using `devtools`:

```{r, eval=FALSE}
devtools::install_github("noriakis/ggkegg")
```

## Examples

```{r message=FALSE, warning=FALSE, fig.width=8, fig.height=5}
library(ggkegg)
library(ggfx)
library(igraph)
library(tidygraph)
library(dplyr)

pathway("ko01100") |>
    process_line() |>
    highlight_module(module("M00021")) |>
    highlight_module(module("M00338")) |>
    ggraph(x=x, y=y) +
        geom_node_point(size=1, aes(color=I(fgcolor),
            filter=fgcolor!="none" & type!="line")) +
        geom_edge_link0(width=0.1, aes(color=I(fgcolor),
            filter=type=="line"& fgcolor!="none")) +
        with_outer_glow(
            geom_edge_link0(width=1,
                aes(color=I(fgcolor),
                    filter=(M00021 | M00338))),
            colour="red", expand=5
        ) +
        with_outer_glow(
            geom_node_point(size=1.5,
                aes(color=I(fgcolor),
                    filter=(M00021 | M00338))),
            colour="red", expand=5
        ) +
        geom_node_text(size=2,
            aes(x=x, y=y,
                label=graphics_name,
                filter=name=="path:ko00270"),
            repel=TRUE, family="sans", bg.colour="white") +
        theme_void()
```

You can use your favorite geoms to annotate raw KEGG map combining the functions.

```{r, message=FALSE, warning=FALSE, fig.width=8, fig.height=5}
compounds <- c("cpd:C00100", "cpd:C00894", "cpd:C00894", "cpd:C05668",
    "cpd:C05668", "cpd:C01013", "cpd:C01013", "cpd:C00222",
    "cpd:C00222", "cpd:C00024")
g <- pathway("ko00640") |> mutate(mod=highlight_set_nodes(compounds, how="all"))
ggraph(g, layout="manual", x=x, y=y)+
    geom_node_rect(fill="grey",aes(filter=type == "ortholog"))+
    overlay_raw_map("ko00640")+
    geom_node_point(aes(filter=type == "compound"),
        shape=21, fill="blue", color="black", size=2)+
    ggfx::with_outer_glow(
        geom_node_point(aes(filter=mod, x=x, y=y), color="red",size=2),
        colour="yellow",expand=5
    )+
    theme_void()
```

Or customize graphics based on `ggraph`.

```{r, message=FALSE, warning=FALSE}
g <- pathway("hsa04110")
pseudo_lfc <- sample(seq(0,3,0.1), length(V(g)), replace=TRUE)
names(pseudo_lfc) <- V(g)$name

ggkegg("hsa04110",
    convert_org = c("pathway","hsa","ko"),
    numeric_attribute = pseudo_lfc)+
    geom_edge_parallel2(
        aes(color=subtype_name),
        arrow = arrow(length = unit(1, 'mm')), 
        start_cap = square(1, 'cm'),
        end_cap = square(1.5, 'cm')) + 
    geom_node_rect(aes(filter=.data$type == "group"),
        fill="transparent", color="red") +
    geom_node_rect(aes(fill=numeric_attribute,
        filter=.data$type == "gene")) +
    geom_node_text(aes(label=converted_name,
        filter=.data$type == "gene"),
        size=2.5,
        color="black") +
    with_outer_glow(
        geom_node_text(aes(label=converted_name,
            filter=converted_name=="PCNA"),
            size=2.5, color="red"),
        colour="white", expand=4
    ) +
    scale_edge_color_manual(values=viridis::plasma(11)) +
    scale_fill_viridis(name="LFC") +
    theme_void()
```

Owner

  • Login: noriakis
  • Kind: user
  • Location: Japan

GitHub Events

Total
  • Issues event: 13
  • Watch event: 21
  • Issue comment event: 13
  • Push event: 6
  • Fork event: 1
Last Year
  • Issues event: 13
  • Watch event: 21
  • Issue comment event: 13
  • Push event: 6
  • Fork event: 1

Issues and Pull Requests

Last synced: 6 months ago

All Time
  • Total issues: 44
  • Total pull requests: 0
  • Average time to close issues: 28 days
  • Average time to close pull requests: N/A
  • Total issue authors: 26
  • Total pull request authors: 0
  • Average comments per issue: 2.45
  • Average comments per pull request: 0
  • Merged pull requests: 0
  • Bot issues: 0
  • Bot pull requests: 0
Past Year
  • Issues: 9
  • Pull requests: 0
  • Average time to close issues: 7 days
  • Average time to close pull requests: N/A
  • Issue authors: 7
  • Pull request authors: 0
  • Average comments per issue: 1.67
  • Average comments per pull request: 0
  • Merged pull requests: 0
  • Bot issues: 0
  • Bot pull requests: 0
Top Authors
Issue Authors
  • Ramirj (9)
  • noriakis (5)
  • wangshiming (3)
  • TimothyStephens (2)
  • hanguojun007 (2)
  • sunliangxing (2)
  • w2felix (2)
  • joe-jhou2 (1)
  • BioLaoXu (1)
  • ucabuk (1)
  • SZhengP (1)
  • WANGchuang715 (1)
  • ag1805x (1)
  • jijitoutou (1)
  • ccgallen (1)
Pull Request Authors
Top Labels
Issue Labels
Pull Request Labels

Packages

  • Total packages: 1
  • Total downloads:
    • bioconductor 15,741 total
  • Total dependent packages: 0
  • Total dependent repositories: 0
  • Total versions: 14
  • Total maintainers: 1
bioconductor.org: ggkegg

Analyzing and visualizing KEGG information using the grammar of graphics

  • Versions: 14
  • Dependent Packages: 0
  • Dependent Repositories: 0
  • Downloads: 15,741 Total
Rankings
Dependent repos count: 0.0%
Stargazers count: 8.5%
Forks count: 17.6%
Average: 30.9%
Dependent packages count: 31.7%
Downloads: 96.7%
Maintainers (1)
Last synced: 6 months ago

Dependencies

.github/workflows/R-CMD-check.yaml actions
  • actions/checkout v3 composite
  • r-lib/actions/check-r-package v2 composite
  • r-lib/actions/setup-r v2 composite
  • r-lib/actions/setup-r-dependencies v2 composite
DESCRIPTION cran
  • R >= 4.2.0 depends
  • XML * depends
  • ggplot2 * depends
  • ggraph * depends
  • igraph * depends
  • tidygraph * depends
  • AnnotationDbi * imports
  • BiocFileCache * imports
  • GetoptLong * imports
  • data.table * imports
  • dplyr * imports
  • grDevices * imports
  • magick * imports
  • methods * imports
  • org.Hs.eg.db * imports
  • patchwork * imports
  • shadowtext * imports
  • stats * imports
  • stringr * imports
  • tibble * imports
  • utils * imports
  • BiocStyle * suggests
  • bnlearn * suggests
  • clusterProfiler * suggests
  • knitr * suggests
  • rmarkdown * suggests