Skip to content

Commit

Permalink
Merge pull request #4 from oliviaAB/main
Browse files Browse the repository at this point in the history
CRAN submission
  • Loading branch information
oliviaAB committed Feb 15, 2023
2 parents 4326e2f + d910944 commit 0788cf1
Show file tree
Hide file tree
Showing 29 changed files with 241 additions and 121 deletions.
2 changes: 2 additions & 0 deletions .Rbuildignore
Original file line number Diff line number Diff line change
Expand Up @@ -10,3 +10,5 @@
^\.github$
^README\.Rmd$
^README.html$
^cran-comments\.md$
^CRAN-SUBMISSION$
3 changes: 2 additions & 1 deletion .github/workflows/pkgdown.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,8 @@ jobs:

- uses: r-lib/actions/setup-r-dependencies@v2
with:
extra-packages: any::pkgdown, local::.
extra-packages: any::pkgdown, local::., github::jendelman/GWASpoly

needs: website

- name: Build site
Expand Down
3 changes: 3 additions & 0 deletions CRAN-SUBMISSION
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
Version: 1.1.0
Date: 2023-02-09 02:07:37 UTC
SHA: f009eb969d5eba81478b12f374e1547f7fd98bc4
20 changes: 10 additions & 10 deletions DESCRIPTION
Original file line number Diff line number Diff line change
@@ -1,18 +1,19 @@
Package: hidecan
Title: Hidecan plots generator
Version: 1.0.0
Title: Create HIDECAN Plots for Visualising Genome-Wide Association Studies and Differential Expression Results
Version: 1.1.0
Authors@R:
person("Olivia", "Angelin-Bonnet", , "olivia.angelin-bonnet@plantandfood.co.nz", role = c("aut", "cre"),
comment = c(ORCID = "0000-0002-7708-2919"))
Description: A package for generating hidecan plots that summarise and combine
the results of GWAS and transcriptomics differential expression analyses,
along candidate genes of interest.
Description: Generates HIDECAN plots that summarise and combine
the results of genome-wide association studies (GWAS) and transcriptomics
differential expression analyses (DE), along with manually curated candidate genes of interest. The HIDECAN plot
is presented in Angelin-Bonnet et al. (2023) (currently in review).
License: MIT + file LICENSE
URL: https://shiny-adventure-acfe02d1.pages.github.io/, https://github.com/PlantandFoodResearch/hidecan
URL: https://plantandfoodresearch.github.io/hidecan/, https://github.com/PlantandFoodResearch/hidecan
BugReports: https://github.com/PlantandFoodResearch/hidecan/issues
Encoding: UTF-8
Roxygen: list(markdown = TRUE)
RoxygenNote: 7.2.2
RoxygenNote: 7.2.3
Depends:
R (>= 2.10)
Imports:
Expand All @@ -26,12 +27,11 @@ Imports:
tidyr,
viridis,
vroom
Suggests:
GWASpoly,
Suggests:
knitr,
rmarkdown,
stringr,
testthat (>= 3.0.0)
Remotes: jendelman/GWASpoly
Config/testthat/edition: 3
VignetteBuilder: knitr
Language: en-GB
1 change: 0 additions & 1 deletion NAMESPACE
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@ export(combine_chrom_length)
export(compute_chrom_length)
export(create_hidecan_plot)
export(get_example_data)
export(get_gwaspoly_example_data)
export(hidecan_plot)
export(hidecan_plot_from_gwaspoly)
export(run_hidecan_shiny)
5 changes: 5 additions & 0 deletions NEWS.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
# hidecan 1.1.0

* Removed `get_gwaspoly_example_data()` function so that the package doesn't depend on GWASpoly (for CRAN submission)

* Saved the example object previously returned by `get_gwaspoly_example_data()` in as an `rda` file in the `extdata` folder
8 changes: 4 additions & 4 deletions R/create_hidecan_plot.R
Original file line number Diff line number Diff line change
Expand Up @@ -38,9 +38,9 @@
#' @param label_padding Numeric, amount of padding around gene labels in the plot,
#' as unit or number. Default value is 0.15
#' (for \link[ggrepel]{geom_label_repel}).
#' @returns A ggplot.
#' @returns A `ggplot`.
#' @examples
#' \dontrun{
#' if (interactive()) {
#' x <- get_example_data()
#' y <- list("GWAS" = GWAS_data(x[["GWAS"]]),
#' "DE" = DE_data(x[["DE"]]),
Expand Down Expand Up @@ -387,9 +387,9 @@ create_hidecan_plot <- function(x,
#' giving for each chromosome its length in bp. If `NULL` (the default), will
#' be inferred from the GWAS, DE and candidate gene data.
#' @inheritParams create_hidecan_plot
#' @returns a ggplot.
#' @returns a `ggplot`.
#' @examples
#' \dontrun{
#' if (interactive()) {
#' x <- get_example_data()
#'
#' ## Typical example with one GWAs result table, one DE result table and
Expand Down
10 changes: 2 additions & 8 deletions R/gwaspoly_helper_functions.R
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#' Extracts information from GWASpoly output
#'
#' Extracts GWAS results and chomosome length from GWASpoly output.
#' Extracts GWAS results and chromosome length from GWASpoly output.
#'
#' @param gwaspoly_output A `GWASpoly.fitted` or `GWASpoly.thresh` object
#' (returned by `GWASpoly::GWASpoly()` or `GWASpoly::set.threshold()` functions).
Expand Down Expand Up @@ -127,13 +127,7 @@ GWAS_data_from_gwaspoly <- function(gwaspoly_output,
#' @inheritParams GWAS_data_from_gwaspoly
#' @param ... Further arguments passed to the \code{\link{create_hidecan_plot}()}
#' function.
#' @returns A ggplot.
#' @examples
#' \dontrun{
#' x <- get_gwaspoly_example_data(with_thresholds = TRUE)
#'
#' hidecan_plot_from_gwaspoly(x)
#' }
#' @returns A `ggplot`.
#' @export
hidecan_plot_from_gwaspoly <- function(gwaspoly_output,
traits = NULL,
Expand Down
7 changes: 7 additions & 0 deletions R/shiny_app.R
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,16 @@
#' Starts the HIDECAN shiny app. The app reads in csv data to produce
#' a HIDECAN plot.
#'
#' @returns No return value, called for side effects (launching the shiny app).
#'
#' @export
run_hidecan_shiny <- function(){
app_dir <- system.file("shiny_apps/hidecan_shiny.R", package = "hidecan")

shiny::runApp(app_dir, display.mode = "normal")
}

## To get rid of the check NOTE
ignore_unused_imports <- function(){
vroom::vroom
}
Binary file modified R/sysdata.rda
Binary file not shown.
42 changes: 23 additions & 19 deletions R/utils.R
Original file line number Diff line number Diff line change
Expand Up @@ -35,22 +35,26 @@ get_example_data <- function(){
)
}

#' GWASpoly example dataset
#'
#' Returns a list of GWASpoly example datasets.
#'
#' @param with_thresholds Logical, should the GWASpoly object returned
#' contain significance threshold? Default value is `TRUE`.
#' @returns
#' * if `with_thresholds` is `TRUE`: a `GWASpoly.thresh` object
#' (returned by the `GWASpoly::set.threshold()` function).
#' if `with_thresholds` is `FALSE`: a `GWASpoly.fitted` object
#' (returned by the `GWASpoly::GWASpoly()` function).
#' @export
get_gwaspoly_example_data <- function(with_thresholds = TRUE){
if(with_thresholds){
return(gwaspoly_res_thr)
} else {
return(gwaspoly_res)
}
}
# #' GWASpoly example dataset
# #'
# #' Returns a list of GWASpoly example datasets. Not exported because otherwise
# #' would load the GWASpoly package which is not on CRAN.
# #'
# #' Install the GWASpoly package with `devtools::install_github('jendelman/GWASpoly', build_vignettes=FALSE)`.
# #'
# #' @param with_thresholds Logical, should the GWASpoly object returned
# #' contain significance threshold? Default value is `TRUE`.
# #' @returns
# #' * if `with_thresholds` is `TRUE`: a `GWASpoly.thresh` object
# #' (returned by the `GWASpoly::set.threshold()` function).
# #' if `with_thresholds` is `FALSE`: a `GWASpoly.fitted` object
# #' (returned by the `GWASpoly::GWASpoly()` function).
# #' @export
# get_gwaspoly_example_data <- function(with_thresholds = TRUE){
#
# if(with_thresholds){
# return(gwaspoly_res_thr)
# } else {
# return(gwaspoly_res)
# }
# }
5 changes: 2 additions & 3 deletions _pkgdown.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,9 @@ navbar:
- text: Step-by-step
href: articles/hidecan-step-by-step.html
- text: GWASpoly output
href: articles/gwaspoly_output.html
href: articles/web_only/gwaspoly_output.html
- text: Shiny app
href: articles/shiny-app.html
href: articles/web_only/shiny-app.html

home:
sidebar:
Expand Down Expand Up @@ -58,7 +58,6 @@ reference:
- title: "Example datasets"
contents:
- get_example_data
- get_gwaspoly_example_data

- title: "Utils"
contents:
Expand Down
47 changes: 47 additions & 0 deletions cran-comments.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
# Resubmission

This is a resubmission. In this version I have:

* Explained acronyms in the description of the package.

* Added the missing \value tag in the run_hidecan_shiny.Rd documentation.s

# Test environments

- local Windows 10, R 4.2.2
- Winbuilder: x86_64-w64-mingw32 (64-bit) R version 4.2.2 (2022-10-31 ucrt)
- Winbuilder: x86_64-w64-mingw32 (64-bit) R Under development (unstable) (2023-01-25 r83685 ucrt)
- Rhub:
- Windows Server 2022, R-devel, 64 bit
- Fedora Linux, R-devel, clang gfortran
- Ubuntu Linux 20.04 LTS, R-release, GCC
- macOS 10.13.6 High Sierra, R-release, brew
- debian-gcc-release: Debian Linux, R-release, GCC

# R CMD check results

There were no ERRORs, WARNINGs.

There was 1 NOTE:

```
* checking CRAN incoming feasibility ... NOTE
Maintainer: 'Olivia Angelin-Bonnet <olivia.angelin-bonnet@plantandfood.co.nz>'
New submission
Possibly misspelled words in DESCRIPTION:
Angelin (11:19)
GWAS (9:51)
HIDECAN (2:15, 8:24, 10:103)
al (11:37)
et (11:34)
transcriptomics (9:61)
```

This is a new submission. Angelin is a family name; GWAS stands for Genome-Wide Association Study (precised in the description); HIDECAN is the name of the package; transcriptomics is correctly spelled; et al. was used for a reference.


# Downstream dependencies

There are currently no downstream dependencies for this package.
37 changes: 37 additions & 0 deletions data-raw/datasets_for_tests.R
Original file line number Diff line number Diff line change
Expand Up @@ -10,3 +10,40 @@ can_res <- hidecan::CAN_data(candidate_data)

save(gwas_res, de_res, can_res, file = "tests/testthat/data-test/test_input.rda")


library(GWASpoly)
library(readr)
library(dplyr)

genofile <- system.file("extdata", "TableS1.csv", package = "GWASpoly")
phenofile <- system.file("extdata", "TableS2.csv", package = "GWASpoly")

set.seed(10)
geno_data <- read_csv(genofile) |>
slice_sample(n = 500)

temp_file <- tempfile()
write_csv(geno_data, temp_file)

data <- read.GWASpoly(ploidy = 4,
pheno.file = phenofile,
geno.file = temp_file,
format = "ACGT",
n.traits = 13,
delim = ",")

data.original <- set.K(data,
LOCO = FALSE,
n.core = 2)


gwaspoly_res <- GWASpoly(data.original,
models = c("general", "additive"),
traits = c("tuber_eye_depth", "tuber_shape"),
n.core = 2)

gwaspoly_res_thr <- set.threshold(gwaspoly_res, method = "M.eff", level = 0.05)

## For users to access the example GWASpoly dataset without having it loaded
saveRDS(gwaspoly_res, file = "tests/testthat/data-test/test_gwaspoly_res.rda")
saveRDS(gwaspoly_res_thr, file = "tests/testthat/data-test/test_gwaspoly_res_thr.rda")
48 changes: 47 additions & 1 deletion data-raw/making_example_data.R
Original file line number Diff line number Diff line change
Expand Up @@ -86,11 +86,57 @@ gwaspoly_res <- GWASpoly(data.original,

gwaspoly_res_thr <- set.threshold(gwaspoly_res, method = "M.eff", level = 0.05)

## For users to access the example GWASpoly dataset without having it loaded
saveRDS(gwaspoly_res_thr, file = "inst/extdata/gwaspoly_res_thr.rda")

#manhattan.plot(gwaspoly_res_thr)


## ----------------- ##
## Saving everything ##
## ----------------- ##

usethis::use_data(gwas_data, de_data, candidate_data, gwaspoly_res, gwaspoly_res_thr, internal = TRUE, overwrite = TRUE)
## To reduce the size of the dataset, removing at random some of the non-significant
## markers and genes

## Preserving the end of each chromosome
gwas_data_ends <- gwas_data |>
group_by(chromosome) |>
slice_max(position, n = 1) |>
ungroup()

de_data_ends <- de_data |>
group_by(chromosome) |>
slice_max(end, n = 1) |>
ungroup()

## Keeping the significant markers/genes
gwas_data_sign <- gwas_data |>
filter(score >= 3.5)

de_data_sign <- de_data |>
filter(padj <= 0.05)

## Randomly subsetting non-significant markers/genes
gwas_data_subset <- gwas_data |>
filter(score < 3.5) |>
slice_sample(prop = 0.5)

de_data_subset <- de_data |>
filter(padj > 0.05) |>
slice_sample(prop = 0.5)

## Combining retained markers/genes
gwas_data <- bind_rows(
gwas_data_ends,
gwas_data_sign,
gwas_data_subset
)

de_data <- bind_rows(
de_data_ends,
de_data_sign,
de_data_subset
)

usethis::use_data(gwas_data, de_data, candidate_data, internal = TRUE, overwrite = TRUE)
Binary file added inst/extdata/gwaspoly_res_thr.rda
Binary file not shown.
2 changes: 1 addition & 1 deletion man/GWAS_data_from_gwaspoly.Rd

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

4 changes: 2 additions & 2 deletions man/create_hidecan_plot.Rd

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

0 comments on commit 0788cf1

Please sign in to comment.