Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add plot saving examples #202

Merged
merged 1 commit into from
Apr 27, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading