Skip to content

Commit

Permalink
Initial commit
Browse files Browse the repository at this point in the history
  • Loading branch information
jbengler committed Dec 8, 2023
1 parent 3061e35 commit a0781fc
Show file tree
Hide file tree
Showing 15 changed files with 876 additions and 826 deletions.
1 change: 1 addition & 0 deletions NAMESPACE
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,7 @@ export(adjust_flip)
export(adjust_fontsize)
export(adjust_labels)
export(adjust_legend)
export(adjust_padding)
export(adjust_size)
export(adjust_x_axis)
export(adjust_y_axis)
Expand Down
14 changes: 14 additions & 0 deletions R/adjust.R
Original file line number Diff line number Diff line change
Expand Up @@ -326,6 +326,20 @@ adjust_legend <- function(gg, title = ggplot2::waiver(), position = "right") {
ggplot2::theme(legend.position = position)
}

#' Adjust padding
#' @param gg bla
#' @param top bla
#' @param right bla
#' @param bottom bla
#' @param left bla
#' @param force_y_continuous bla
#' @export
adjust_padding <- function(gg, top = NULL, right = NULL, bottom = NULL, left = NULL, force_y_continuous = FALSE) {
gg %>%
adjust_x_axis(padding_left = left, padding_right = right) %>%
adjust_y_axis(padding_bottom = bottom, padding_top = top, force_y_continuous = force_y_continuous)
}

#' Flip plot
#' @param gg bla
#' @param ... bla
Expand Down
4 changes: 2 additions & 2 deletions R/data.R
Original file line number Diff line number Diff line change
Expand Up @@ -12,11 +12,11 @@
#' `tidyplots` package
"gene_statistics"

#' Disease course data
#' Time course data
#' @format A data frame with 800 rows and 9 variables.
#' @source
#' `tidyplots` package
"disease_course"
"time_course"

#' Energy data
#' @format A data frame with 242 rows and 4 variables.
Expand Down
8 changes: 0 additions & 8 deletions R/todo.R
Original file line number Diff line number Diff line change
@@ -1,12 +1,4 @@

# heatmap have no color legend

# adjust_padding(tlbr)

# data set "de_analysis" for volcano plots

# data set "disease_course" for plotting

# work on check_pipeline()
# enforce "sequence of funs", with warnings and errors

Expand Down
3 changes: 2 additions & 1 deletion _pkgdown.yml
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,7 @@ reference:
- starts_with("adjust_size")
- starts_with("adjust_fontsize")
- starts_with("adjust_legend")
- starts_with("adjust_padding")
- starts_with("adjust_flip")
- starts_with("adjust_annotation")
- title: Themes
Expand Down Expand Up @@ -99,4 +100,4 @@ reference:
- starts_with("study")
- gene_expression
- gene_statistics
- disease_course
- time_course
10 changes: 10 additions & 0 deletions data-raw/gene_expression.R
Original file line number Diff line number Diff line change
Expand Up @@ -5,3 +5,13 @@ library(tidyverse)
gene_expression <- read_csv(file = "data-raw/gene_expression.csv")

usethis::use_data(gene_expression, overwrite = TRUE)

library(tidyplots)
library(tidyverse)

gene_expression %>%
tidyplot(sample, external_gene_name, color = expression, width = 100) %>%
add_heatmap(scale = "row") %>%
adjust_labels(var = external_gene_name, sort_by = -padj) %>%
adjust_labels(var = direction, reverse = TRUE)+
facet_wrap(vars(direction), scales = "free")
1,602 changes: 801 additions & 801 deletions data-raw/gene_expression.csv

Large diffs are not rendered by default.

19 changes: 10 additions & 9 deletions data-raw/disease_course.R → data-raw/time_course.R
Original file line number Diff line number Diff line change
@@ -1,29 +1,30 @@
## code to prepare `disease_course` dataset goes here
## code to prepare `time_course` dataset goes here

library(tidyverse)

disease_course <-
read_tsv("data-raw/tidy_disease_course.txt")
time_course <-
read_tsv("data-raw/time_course.txt")

usethis::use_data(disease_course, overwrite = TRUE)
usethis::use_data(time_course, overwrite = TRUE)

library(tidyplots)

disease_course %>%
time_course %>%
tidyplot(x = day, y = score, color = treatment, dodge_width = 0) %>%
add_mean_line() %>%
add_mean_dot() %>%
add_error_ribbon()

disease_course %>%
library(tidyverse)

time_course %>%
tidyplot(x = day, y = subject, color = score, height = 80) %>%
add_heatmap(rotate_labels = FALSE) +
facet_grid(vars(treatment), scales = "free")

disease_course %>%
time_course %>%
tidyplot(x = day, y = subject, color = score, height = 80) %>%
add_heatmap(rotate_labels = FALSE) %>%
adjust_colors(new_colors = rev(RColorBrewer::brewer.pal(n = 7, name = "RdYlBu")),
as_palette = TRUE,
na.value = "#DDDDDD") +
facet_grid(vars(treatment), scales = "free")

File renamed without changes.
Binary file removed data/disease_course.rda
Binary file not shown.
Binary file modified data/gene_expression.rda
Binary file not shown.
Binary file added data/time_course.rda
Binary file not shown.
31 changes: 31 additions & 0 deletions man/adjust_padding.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Binary file modified man/figures/README-example-1.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
10 changes: 5 additions & 5 deletions man/disease_course.Rd → man/time_course.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit a0781fc

Please sign in to comment.