Skip to content

Commit

Permalink
Merge branch '21-fix-if-empty-response-in-get_phenotypes_matrix' into…
Browse files Browse the repository at this point in the history
… 'master'

Resolve "fix if empty response in get_phenotypes_matrix"

Closes #21

See merge request wuxi-nextcode/wxnc-plat/gorr!46
  • Loading branch information
[email protected] committed Sep 10, 2021
2 parents ae94269 + 8e8674e commit b5d33cd
Show file tree
Hide file tree
Showing 77 changed files with 220 additions and 213 deletions.
2 changes: 1 addition & 1 deletion DESCRIPTION
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
Type: Package
Package: gorr
Title: GOR Direct Query API for R
Version: 1.4.3
Version: 1.4.4
Authors@R: c(
person("Genuity", "Science", role = c("aut", "cre","cph"), email = "[email protected]"),
person("Edvald", "Gislason", role = "aut", email = ""),
Expand Down
8 changes: 6 additions & 2 deletions R/phenotype_services.R
Original file line number Diff line number Diff line change
Expand Up @@ -130,7 +130,7 @@ query__phenotypes <- function(conn, all_tags, any_tags, pn_count, categories, li
#' api_key <- Sys.getenv("GOR_API_KEY")
#' project <- Sys.getenv("GOR_PROJECT")
#' conn <- platform_connect(api_key, project)
#' phenotypes <- get_phenotypes(conn)
#' phenotypes <- get_phenotypes(conn, limit=5)
#' }
get_phenotypes <- function(conn,
tags = list(),
Expand Down Expand Up @@ -218,7 +218,7 @@ print.phenotype_list <- function(x, ...) {
#' api_key <- Sys.getenv("GOR_API_KEY")
#' project <- Sys.getenv("GOR_PROJECT")
#' conn <- platform_connect(api_key, project)
#' phenotypes <- get_phenotypes(conn)
#' phenotypes <- get_phenotypes_dataframe(conn, limit=5)
#' }
get_phenotypes_dataframe <- function(conn = conn,
pheno_names=list(),
Expand Down Expand Up @@ -262,6 +262,10 @@ get_phenotypes_dataframe <- function(conn = conn,
do.call(rbind, .) %>%
as.data.frame()

if (nrow(phenotypes_dataframe) == 0) {
return(phenotypes_dataframe)
}

if (filtered) {
cols <- c("name", "description", "result_type", "tag_list", "pn_count")
phenotypes_dataframe <- phenotypes_dataframe %>% dplyr::select(tidyselect::all_of(cols))
Expand Down
2 changes: 1 addition & 1 deletion docs/404.html

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

2 changes: 1 addition & 1 deletion docs/LICENSE.html

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

8 changes: 4 additions & 4 deletions docs/articles/basic-query.html

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

8 changes: 4 additions & 4 deletions docs/articles/covariate-services.html

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

4 changes: 2 additions & 2 deletions docs/articles/gor-create.html

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

2 changes: 1 addition & 1 deletion docs/articles/index.html

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

4 changes: 2 additions & 2 deletions docs/articles/persistance-of-results.html

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

18 changes: 9 additions & 9 deletions docs/articles/phenotype-categories.html

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

Loading

0 comments on commit b5d33cd

Please sign in to comment.