Skip to content

Commit

Permalink
Add plot saving examples (#202)
Browse files Browse the repository at this point in the history
  • Loading branch information
egeulgen committed Apr 27, 2024
1 parent 9d2d51a commit fb21312
Show file tree
Hide file tree
Showing 4 changed files with 72 additions and 8 deletions.
20 changes: 18 additions & 2 deletions README.Rmd
Original file line number Diff line number Diff line change
Expand Up @@ -172,9 +172,17 @@ gg_list <- visualize_terms(
input_processed = input_processed,
is_KEGG_result = TRUE
) # this function returns a list of ggraph objects (named by Term ID)
# save one of the plots as PDF image
ggplot2::ggsave(
"hsa04911_diagram.pdf", # path to output, format is determined by extension
gg_list$hsa04911, # what to plot
width = 5 # adjust width
height = 5 # adjust height
)
```

![KEGG Pathway Diagram](https://github.com/egeulgen/pathfindR/blob/master/vignettes/example_kegg_pathway_diagram.png?raw=true "KEGG Pathway Diagram")
![KEGG Pathway Diagram](https://github.com/egeulgen/pathfindR/blob/master/vignettes/example_kegg_pathway_diagram.png?raw=true)

Alternatively (i.e., for other types of (non-KEGG) enrichment analyses), an interaction diagram per enriched term can be generated again via `visualize_terms()`. These diagrams are also returned as `ggraph` objects:

Expand All @@ -186,9 +194,17 @@ gg_list <- visualize_terms(
is_KEGG_result = FALSE,
pin_name_path = "Biogrid"
) # this function returns a list of ggraph objects (named by Term ID)
# save one of the plots as PDF image
ggplot2::ggsave(
"diabetic_cardiomyopathy_interactions.pdf", # path to output, format is determined by extension
gg_list$hsa04911, # what to plot
width = 10 # adjust width
height = 6 # adjust height
)
```

![Interaction Diagram](https://github.com/egeulgen/pathfindR/blob/master/vignettes/example_interaction_vis.png?raw=true "Interaction Diagram")
![Interaction Diagram](https://github.com/egeulgen/pathfindR/blob/master/vignettes/example_interaction_vis.png?raw=true)

## Term-Gene Heatmap

Expand Down
20 changes: 18 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -230,12 +230,20 @@ gg_list <- visualize_terms(
input_processed = input_processed,
is_KEGG_result = TRUE
) # this function returns a list of ggraph objects (named by Term ID)

# save one of the plots as PDF image
ggplot2::ggsave(
"hsa04911_diagram.pdf", # path to output, format is determined by extension
gg_list$hsa04911, # what to plot
width = 5 # adjust width
height = 5 # adjust height
)
```

<figure>
<img
src="https://github.com/egeulgen/pathfindR/blob/master/vignettes/example_kegg_pathway_diagram.png?raw=true"
title="KEGG Pathway Diagram" alt="KEGG Pathway Diagram" />
alt="KEGG Pathway Diagram" />
<figcaption aria-hidden="true">KEGG Pathway Diagram</figcaption>
</figure>

Expand All @@ -252,12 +260,20 @@ gg_list <- visualize_terms(
is_KEGG_result = FALSE,
pin_name_path = "Biogrid"
) # this function returns a list of ggraph objects (named by Term ID)

# save one of the plots as PDF image
ggplot2::ggsave(
"diabetic_cardiomyopathy_interactions.pdf", # path to output, format is determined by extension
gg_list$hsa04911, # what to plot
width = 10 # adjust width
height = 6 # adjust height
)
```

<figure>
<img
src="https://github.com/egeulgen/pathfindR/blob/master/vignettes/example_interaction_vis.png?raw=true"
title="Interaction Diagram" alt="Interaction Diagram" />
alt="Interaction Diagram" />
<figcaption aria-hidden="true">Interaction Diagram</figcaption>
</figure>

Expand Down
20 changes: 18 additions & 2 deletions vignettes/intro_vignette.Rmd
Original file line number Diff line number Diff line change
Expand Up @@ -231,11 +231,19 @@ For KEGG enrichment analyses, `visualize_terms()` can be used to generate KEGG p

```{r KEGG_vis, eval=FALSE}
input_processed <- input_processing(example_pathfindR_input)
visualize_terms(
gg_list <- visualize_terms(
result_df = example_pathfindR_output,
input_processed = input_processed,
is_KEGG_result = TRUE
) # this function returns a list of ggraph objects (named by Term ID)
# save one of the plots as PDF image
ggplot2::ggsave(
"hsa04911_diagram.pdf", # path to output, format is determined by extension
gg_list$hsa04911, # what to plot
width = 5 # adjust width
height = 5 # adjust height
)
```

<img src="./example_kegg_pathway_diagram.png" style="max-width:100%;" />
Expand All @@ -244,12 +252,20 @@ Alternatively (i.e., for other types of non-KEGG enrichment analyses), an intera

```{r nonKEGG_viss, eval=FALSE}
input_processed <- input_processing(example_pathfindR_input)
visualize_terms(
gg_list <- visualize_terms(
result_df = example_pathfindR_output,
input_processed = input_processed,
is_KEGG_result = FALSE,
pin_name_path = "Biogrid"
) # this function returns a list of ggraph objects (named by Term ID)
# save one of the plots as PDF image
ggplot2::ggsave(
"diabetic_cardiomyopathy_interactions.pdf", # path to output, format is determined by extension
gg_list$hsa04911, # what to plot
width = 10 # adjust width
height = 6 # adjust height
)
```

<img src="./example_interaction_vis.png" style="max-width:100%;" />
Expand Down
20 changes: 18 additions & 2 deletions vignettes/visualization_vignette.Rmd
Original file line number Diff line number Diff line change
Expand Up @@ -55,11 +55,19 @@ For KEGG enrichment analyses, `visualize_terms()` can be used to generate KEGG p

```{r KEGG_vis, eval=FALSE}
input_processed <- input_processing(example_pathfindR_input)
visualize_terms(
gg_list <- visualize_terms(
result_df = example_pathfindR_output,
input_processed = input_processed,
is_KEGG_result = TRUE
) # this function returns a list of ggraph objects (named by Term ID)
# save one of the plots as PDF image
ggplot2::ggsave(
"hsa04911_diagram.pdf", # path to output, format is determined by extension
gg_list$hsa04911, # what to plot
width = 5 # adjust width
height = 5 # adjust height
)
```

<img src="./example_kegg_pathway_diagram.png" style="max-width:100%;" />
Expand All @@ -68,12 +76,20 @@ Alternatively (i.e., for other types of non-KEGG enrichment analyses), an intera

```{r nonKEGG_viss, eval=FALSE}
input_processed <- input_processing(example_pathfindR_input)
visualize_terms(
gg_list <- visualize_terms(
result_df = example_pathfindR_output,
input_processed = input_processed,
is_KEGG_result = FALSE,
pin_name_path = "Biogrid"
) # this function returns a list of ggraph objects (named by Term ID)
# save one of the plots as PDF image
ggplot2::ggsave(
"diabetic_cardiomyopathy_interactions.pdf", # path to output, format is determined by extension
gg_list$hsa04911, # what to plot
width = 10 # adjust width
height = 6 # adjust height
)
```

<img src="./example_interaction_vis.png" style="max-width:100%;" />
Expand Down

0 comments on commit fb21312

Please sign in to comment.