Skip to content

Commit

Permalink
various tidying/fixes pre-CRAN submission (#13)
Browse files Browse the repository at this point in the history
  • Loading branch information
rmgpanw committed Sep 18, 2024
1 parent b91341f commit 3aef357
Show file tree
Hide file tree
Showing 11 changed files with 173 additions and 93 deletions.
1 change: 1 addition & 0 deletions .Rbuildignore
Original file line number Diff line number Diff line change
Expand Up @@ -12,3 +12,4 @@
^.vscode$
^doc$
^Meta$
^cran-comments\.md$
19 changes: 15 additions & 4 deletions DESCRIPTION
Original file line number Diff line number Diff line change
@@ -1,13 +1,24 @@
Package: gtexr
Title: Query the GTEx Portal API
Version: 0.0.0.9000
Authors@R:
Authors@R: c(
person(given = "Alasdair",
family = "Warwick",
role = c("aut", "cre", "cph"),
email = "alasdair.warwick06@gmail.com",
comment = c(ORCID = "0000-0002-0800-2890"))
Description: A convenient R interface to the GTEx Portal API.
email = "alasdair.warwick.19@ucl.ac.uk",
comment = c(ORCID = "0000-0002-0800-2890")),
person("Benjamin", "Zuckerman", role = "aut",
comment = c(ORCID = "0000-0002-0077-6074")),
person("Abraham", "Olvera-Barrios", role = "aut",
comment = c(ORCID = "0000-0002-3305-4465")),
person("Chuin Ying", "Ung", role = "aut",
comment = c(ORCID = "0000-0001-8487-4589")),
person("Robert", "Luben", role = "aut",
comment = c(ORCID = "0000-0002-5088-6343"))
)
Description: A convenient R interface to the Genotype-Tissue Expression (GTEx)
Portal API. For more information on the API, see
<https://gtexportal.org/api/v2/redoc>.
License: MIT + file LICENSE
URL: https://rmgpanw.github.io/gtexr/,
https://github.com/rmgpanw/gtexr
Expand Down
File renamed without changes.
68 changes: 51 additions & 17 deletions R/gtexr_arguments.R
Original file line number Diff line number Diff line change
Expand Up @@ -81,35 +81,69 @@
#' @param sortDirection String. Options: "asc", "desc". Default = "asc".
#' @param start Integer.
#' @param subjectIds Character vector. GTEx subject ID.
#' @param tissueSampleId String. A Tissue Sample ID.
#' @param tissueSampleIds Array of strings. A list of Tissue Sample ID(s).
#' @param tissueSiteDetailId String. The ID of the tissue of interest. Can be a
#' GTEx specific ID (e.g. "Whole_Blood"; use [get_tissue_site_detail()]
#' to see valid values) or an Ontology ID.
#' @param tissueSiteDetailIds Character vector of IDs for tissues of interest.
#' Can be GTEx specific IDs (e.g. "Whole_Blood"; use
#' [get_tissue_site_detail()] to see valid values) or Ontology IDs.
#' @param uberonIds Character vector. A list of Uberon ID(s) of interest.
#' Options: "UBERON:EFO_0000572", "UBERON:EFO_0002009", "UBERON:0000007",
#' "UBERON:0000458", "UBERON:0000473", "UBERON:0000945", "UBERON:0000992",
#' "UBERON:0000995", "UBERON:0000996", "UBERON:0001114", "UBERON:0001150",
#' "UBERON:0001157", "UBERON:0001159", "UBERON:0001211", "UBERON:0001225",
#' "UBERON:0001255", "UBERON:0001293", "UBERON:0001323", "UBERON:0001496",
#' "UBERON:0001621", "UBERON:0001870", "UBERON:0001873", "UBERON:0001874",
#' "UBERON:0001876", "UBERON:0001882", "UBERON:0001898", "UBERON:0001954",
#' "UBERON:0002037", "UBERON:0002038", "UBERON:0002046", "UBERON:0002106",
#' "UBERON:0002190", "UBERON:0002367", "UBERON:0002369", "UBERON:0003889",
#' "UBERON:0004264", "UBERON:0004550", "UBERON:0004648", "UBERON:0006330",
#' "UBERON:0006469", "UBERON:0006566", "UBERON:0006631", "UBERON:0006920",
#' "UBERON:0007610", "UBERON:0008367", "UBERON:0008952", "UBERON:0009834",
#' "UBERON:0009835", "UBERON:0010414", "UBERON:0011907", "UBERON:0012249",
#' "UBERON:0013756", "UBERON:0036149".
#' @param uberonIds Character vector of Uberon IDs (e.g. "UBERON:EFO_0000572";
#' use [get_tissue_site_detail()] to see valid values).
#' @param variantId String. A gtex variant ID.
#' @param variantIds Character vector. Gtex variant IDs.
#'
#' @keywords internal
#' @return Returns `NULL` invisibly. Used for documentation only.
gtexr_arguments <- function() {
gtexr_arguments <- function(ageBrackets = NULL,
aliquotIds = NULL,
attributeSubset = NULL,
autolysisScores = NULL,
cellType = NULL,
bp_window = NULL,
chromosome = NULL,
datasetId = NULL,
dataTypes = NULL,
draw = NULL,
end = NULL,
excludeDataArray = NULL,
.featureId = NULL,
filterMtGene = NULL,
gencodeId = NULL,
gencodeIds = NULL,
gencodeVersion = NULL,
geneId = NULL,
geneIds = NULL,
genomeBuild = NULL,
hardyScales = NULL,
hasExpressionData = NULL,
hasGenotype = NULL,
itemsPerPage = NULL,
ischemicTime = NULL,
ischemicTimeGroups = NULL,
materialTypes = NULL,
organizationName = NULL,
page = NULL,
pathCategory = NULL,
phenotypeId = NULL,
pos = NULL,
project_id = NULL,
rin = NULL,
sampleId = NULL,
sampleIds = NULL,
searchTerm = NULL,
sex = NULL,
snpId = NULL,
sortBy = NULL,
sortDirection = NULL,
start = NULL,
subjectIds = NULL,
tissueSampleIds = NULL,
tissueSiteDetailId = NULL,
tissueSiteDetailIds = NULL,
uberonIds = NULL,
variantId = NULL,
variantIds = NULL) {
tibble::tribble(
~arg, ~type, ~scalar, ~pluralised, ~shinyinput, ~choices,
"ageBrackets", "character", FALSE, TRUE, "selectInput", c("20-29", "30-39", "40-49", "50-59", "60-69", "70-79"),
Expand Down
8 changes: 7 additions & 1 deletion README.Rmd
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,13 @@ New to R? Try out the ⭐[shiny app](https://7hocgq-rmgpanw.shinyapps.io/gtexr/)

## Installation

You can install the development version of gtexr from [GitHub](https://github.com/) with:
You can install this package from CRAN:

``` r
install.packages("gtexr")
```

Or you can install the development version of gtexr from [GitHub](https://github.com/rmgpanw/gtexr) with:

``` r
# install.packages("devtools")
Expand Down
10 changes: 8 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,14 @@ app](https://7hocgq-rmgpanw.shinyapps.io/gtexr/)⭐.

## Installation

You can install the development version of gtexr from
[GitHub](https://github.com/) with:
You can install this package from CRAN:

``` r
install.packages("gtexr")
```

Or you can install the development version of gtexr from
[GitHub](https://github.com/rmgpanw/gtexr) with:

``` r
# install.packages("devtools")
Expand Down
5 changes: 5 additions & 0 deletions cran-comments.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
## R CMD check results

0 errors | 0 warnings | 1 note

* This is a new release.
19 changes: 3 additions & 16 deletions man/get_sample_datasets_endpoints.Rd

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

12 changes: 10 additions & 2 deletions man/gtexr-package.Rd

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

79 changes: 57 additions & 22 deletions man/gtexr_arguments.Rd

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

45 changes: 16 additions & 29 deletions vignettes/developer_guide.Rmd
Original file line number Diff line number Diff line change
Expand Up @@ -14,34 +14,21 @@ knitr::opts_chunk$set(
)
```

```{r setup}
library(gtexr)
```

**WIP**

## Functions

- [ ] Function name is title of endpoint in lower case, with words separated by underscores
- [ ] `@description` section is copied verbatim from API documentation site and ends with a link to the corresponding API endpoint documentation.
- [ ] Further notes may be added under `@details`
- [ ] Arguments

- [ ] Names match those for API endpoint, except where the argument accepts an array (vector in R) of values, in which case it is pluralised
- [ ] Note that the [Get Genomic Features] endpoint takes a path parameter "featureId". The corresponding gtexr argument is prefixed with "." (`.featureId`).
- [ ] Default values also match those for API endpoint
- [ ] Query parameters flagged as "required" in the GTEx Portal API documentation do not have default values. Note however that while `variantId` is not flagged as "required" for [Get Linkage Disequilibrium By Variant Data](https://gtexportal.org/api/v2/redoc#tag/Datasets-Endpoints/operation/get_linkage_disequilibrium_by_variant_data_api_v2_dataset_ldByVariant_get), no default value is provided in `get_linkage_disequilibrium_by_variant_data()` as providing `NULL` or an unrecognised variant ID returns an empty response.
- [ ] Are all documented in `gtexr_arguments.R`. Rules...see also link to separate section(?) (**TO DO**)
- [ ] All functions therefore use `@inheritParams gtexr_arguments` for documentation

- [ ] Use `@family` roxygen tag to match categories on API documentation e.g. ... . This is used to categorise functions on pkgdown site reference page.
- [ ] All return a tibble
- [ ] The first example in `@examples` must produce output, where possible, and be a single function call without assignment (e.g. `get_news_items()`, not `x <- get_news_items()`). This is used to pre-populate argument values in the gtexr shiny app with a working example.
- [ ] All examples should be surrounded by `\dontrun{}`.
- [ ] `gtexr_arguments()` metadata ... (*new section*)

## TODO

- [ ] Complete above documentation
- [ ] Add unit test(s) to enforce above (e.g. check that URL to )

- Function name is title of API endpoint in lower case, with words separated by underscores.
- `@description` section is copied verbatim from the API documentation site and ends with a link to the corresponding API endpoint documentation.
- Further notes may be added under `@details`.
- Arguments
- Names match those for API endpoint, except where the argument accepts an array (vector in R) of values, in which case it is pluralised.[^1]
- Default values also match those for API endpoint.
- Query parameters flagged as "required" in the GTEx Portal API documentation do not have default values.[^2]
- Are all documented in `gtexr_arguments.R`. All functions therefore use `@inheritParams gtexr_arguments` for documentation.
- Use `@family` roxygen tag to match categories on API documentation. This is used to categorise functions on pkgdown site reference page.
- Return a tibble.
- The first example in `@examples` must produce output and be a single function call without assignment (e.g. `get_news_items()`, not `x <- get_news_items()`). This is used to pre-populate argument values in the gtexr shiny app with a working example.
- All examples should be surrounded by `\dontrun{}`.

[^1]: Note that the [Get Genomic Features](https://gtexportal.org/api/v2/redoc#tag/Reference-Genome-Endpoints/operation/get_genomic_features_api_v2_reference_features__featureId__get) endpoint takes a path parameter "featureId". The corresponding gtexr argument is prefixed with "." (`.featureId`).

[^2]: Note however that while `variantId` is not flagged as "required" for [Get Linkage Disequilibrium By Variant Data](https://gtexportal.org/api/v2/redoc#tag/Datasets-Endpoints/operation/get_linkage_disequilibrium_by_variant_data_api_v2_dataset_ldByVariant_get), no default value is provided in `get_linkage_disequilibrium_by_variant_data()` as providing `NULL` or an unrecognised variant ID returns an empty response.

0 comments on commit 3aef357

Please sign in to comment.