Skip to content

Commit

Permalink
fixing brapi con replacement of argument in functions
Browse files Browse the repository at this point in the history
  • Loading branch information
c5sire committed Feb 6, 2018
1 parent c1b1fb1 commit 209c50b
Show file tree
Hide file tree
Showing 35 changed files with 41 additions and 42 deletions.
2 changes: 1 addition & 1 deletion R/ba_locations.R
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ ba_locations <- function(con = NULL,
check_paging(pageSize = pageSize, page = page)
check_rclass(rclass = rclass)
# fetch the url of the brapi implementation of the database
brp <- get_brapi(brapi = con)
brp <- get_brapi(con = con)
# generate the brapi call specific url
# locations_list <- paste0(brp, "locations/?") # TO BE CONSIDERED FOR VERSION 2
locations_list <- paste0(brp, "locations?")
Expand Down
2 changes: 1 addition & 1 deletion R/ba_markerprofiles_allelematrix_search.R
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ ba_markerprofiles_allelematrix_search <- function(con = NULL,
check_paging(pageSize = pageSize, page = page)
check_rclass(rclass = rclass)
# fetch the url of the brapi implementation of the database
brp <- get_brapi(brapi = con)
brp <- get_brapi(con = con)
# generate the brapi call specific url
pallelematrix_search <- paste0(brp, "allelematrix-search/?")
pmarkerprofileDbId <- paste0("markerprofileDbId=", markerprofileDbId, "&") %>% paste(collapse = "")
Expand Down
2 changes: 1 addition & 1 deletion R/ba_markerprofiles_details.R
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ ba_markerprofiles_details <- function(con = NULL,
stopifnot(is.character(sepUnphased))
check_paging(pageSize = pageSize, page = page)
check_rclass(rclass = rclass)
brp <- get_brapi(brapi = con)
brp <- get_brapi(con = con)
markerprofiles_alleles <- paste0(brp, "markerprofiles/", markerprofilesDbId, "/?")
expandHomozygotes <- ifelse(expandHomozygotes != "", paste0("expandHomozygotes=", expandHomozygotes, "&"), "")
sepPhased <- ifelse(sepPhased != "", paste0("sepPhased=", sepPhased, "&"), "")
Expand Down
2 changes: 1 addition & 1 deletion R/ba_markerprofiles_search.R
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ ba_markerprofiles_search <- function(con = NULL,
stopifnot(is.character(methodDbId))
check_paging(pageSize = pageSize, page = page)
check_rclass(rclass = rclass)
brp <- get_brapi(brapi = con)
brp <- get_brapi(con = con)
pmarkerprofiles <- paste0(brp, "markerprofiles/?")
pgermplasmDbId <- paste0("germplasm=", germplasmDbId, "&") %>% paste(collapse = "")
pextractDbId <- paste0("extract=", extractDbId, "&") %>% paste(collapse = "")
Expand Down
2 changes: 1 addition & 1 deletion R/ba_markers_details.R
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ ba_markers_details <- function(con = NULL,
ba_check(con = con, verbose = FALSE, brapi_calls = "markers/id")
stopifnot(is.character(markerDbId))
check_rclass(rclass = rclass)
brp <- get_brapi(brapi = con)
brp <- get_brapi(con = con)
markers <- paste0(brp, "markers/", markerDbId)
try({
res <- brapiGET(url = markers, con = con)
Expand Down
2 changes: 1 addition & 1 deletion R/ba_markers_search.R
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ ba_markers_search <- function(con = NULL,
stopifnot(include == "synonyms")
check_paging(pageSize = pageSize, page = page)
check_rclass(rclass = rclass)
brp <- get_brapi(brapi = con)
brp <- get_brapi(con = con)
marker_search <- paste0(brp, "markers/?")
page <- ifelse(is.numeric(page), paste0("page=", page, "&"), "")
pageSize <- ifelse(is.numeric(pageSize), paste0("pageSize=", pageSize, "&"), "")
Expand Down
2 changes: 1 addition & 1 deletion R/ba_observationvariables.R
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ ba_observationvariables <- function(con = NULL,
stopifnot(is.character(traitClass))
check_paging(pageSize = pageSize, page = page)
check_rclass(rclass = rclass)
brp <- get_brapi(brapi = con)
brp <- get_brapi(con = con)
brapi_variables <- paste0(brp, "variables/?")
ptraitClass <- paste0("traitClass=", traitClass, "&")
ppage <- paste0("page=", page, "")
Expand Down
2 changes: 1 addition & 1 deletion R/ba_observationvariables_datatypes.R
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ ba_observationvariables_datatypes <- function(con = NULL,
rclass = "tibble") {
ba_check(con = con, verbose = FALSE, brapi_calls = "variables/datatypes")
check_rclass(rclass = rclass)
brp <- get_brapi(brapi = con)
brp <- get_brapi(con = con)
variables_datatypes_list <- paste0(brp, "variables/datatypes/")
try({
res <- brapiGET(url = variables_datatypes_list, con = con)
Expand Down
2 changes: 1 addition & 1 deletion R/ba_observationvariables_details.R
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ ba_observationvariables_details <- function(con = NULL,
ba_check(con = con, verbose = FALSE, brapi_calls = "variables/id")
stopifnot(is.character(observationVariableDbId))
check_rclass(rclass = rclass)
brp <- get_brapi(brapi = con)
brp <- get_brapi(con = con)
brapi_variables_details <- paste0(brp, "variables/", observationVariableDbId)
try({
res <- brapiGET(url = brapi_variables_details, con = con)
Expand Down
2 changes: 1 addition & 1 deletion R/ba_observationvariables_ontologies.R
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ ba_observationvariables_ontologies <- function(con = NULL,
ba_check(con = con, verbose = FALSE, brapi_calls = "ontologies")
check_paging(pageSize = pageSize, page = page)
check_rclass(rclass = rclass)
brp <- get_brapi(brapi = con)
brp <- get_brapi(con = con)
variables_ontologies <- paste0(brp, "ontologies/?")
ppage <- paste0("page=", page, "")
ppageSize <- paste0("pageSize=", pageSize, "&")
Expand Down
2 changes: 1 addition & 1 deletion R/ba_observationvariables_search.R
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ ba_observationvariables_search <- function(con = NULL,
stopifnot(is.character(datatypes))
stopifnot(is.character(traitClasses))
check_rclass(rclass = rclass)
brp <- get_brapi(brapi = con)
brp <- get_brapi(con = con)
pvariables <- paste0(brp, "variables-search/")
try({
res <- brapiPOST(pvariables, body, con = con)
Expand Down
2 changes: 1 addition & 1 deletion R/ba_phenotypes_search.R
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ ba_phenotypes_search <- function(con = NULL,
stopifnot(is.character(observationLevel))
check_paging(pageSize = pageSize, page = page)
check_rclass(rclass = rclass)
brp <- get_brapi(brapi = con)
brp <- get_brapi(con = con)
pvariables <- paste0(brp, "phenotypes-search/")
try({
body <- list(germplasmDbIds = germplasmDbIds,
Expand Down
2 changes: 1 addition & 1 deletion R/ba_programs.R
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ ba_programs <- function(con = NULL,
stopifnot(is.character(abbreviation))
check_paging(pageSize = pageSize, page = page)
check_rclass(rclass = rclass)
brp <- get_brapi(brapi = con)
brp <- get_brapi(con = con)
# pprograms <- paste0(brp, "programs/?") # TO BE CONSIDERED v2
pprograms <- paste0(brp, "programs?")
pprogramName <- ifelse(programName != "any", paste0("programName=", gsub(" ", "%20", programName), "&"), "")
Expand Down
2 changes: 1 addition & 1 deletion R/ba_programs_search.R
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ ba_programs_search <- function(con = NULL,
stopifnot(is.character(leadPerson))
check_rclass(rclass)
# fetch url of the brapi implementation of the database
brp <- get_brapi(brapi = con)
brp <- get_brapi(con = con)
# generate specific brapi call url
pprograms <- paste0(brp, "programs-search/")
try({
Expand Down
2 changes: 1 addition & 1 deletion R/ba_samples.R
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ ba_samples <- function(con = NULL,
stopifnot(is.character(sampleId))
stopifnot(sampleId != "")
check_rclass(rclass = rclass)
brp <- get_brapi(brapi = con)
brp <- get_brapi(con = con)
call_samples <- paste0(brp, "samples/", sampleId)
tryCatch({
res <- brapiGET(url = call_samples, con = con)
Expand Down
2 changes: 1 addition & 1 deletion R/ba_samples_save.R
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ ba_samples_save <- function(con = NULL,
ba_check(con = con, verbose = FALSE, brapi_calls = "samples")
stopifnot(is.list(sampleData))
stopifnot(all(c("plotId", "plantId", "takenBy", "sampleDate", "sampleType", "tissueType", "notes") %in% names(sampleData)))
brp <- get_brapi(brapi = con)
brp <- get_brapi(con = con)
call_samples <- paste0(brp, "samples/")
try({
res <- brapiPUT(url = call_samples, body = sampleData, con = con)
Expand Down
2 changes: 1 addition & 1 deletion R/ba_studies_details.R
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ ba_studies_details <- function(con = NULL,
ba_check(con = con, verbose = FALSE, brapi_calls = "studies/id")
stopifnot(is.character(studiesDbId))
check_rclass(rclass = rclass)
studies <- paste0(get_brapi(brapi = con), "studies/", studiesDbId, "/")
studies <- paste0(get_brapi(con = con), "studies/", studiesDbId, "/")
try({
res <- brapiGET(url = studies, con = con)
out <- NULL
Expand Down
2 changes: 1 addition & 1 deletion R/ba_studies_layout.R
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ ba_studies_layout <- function(con = NULL,
ba_check(con = con, verbose = FALSE, brapi_calls = "studies/id/layout")
stopifnot(is.character(studyDbId))
check_rclass(rclass = rclass)
brp <- get_brapi(brapi = con)
brp <- get_brapi(con = con)
studies_layout_list <- paste0(brp, "studies/", studyDbId, "/layout/")
try({
res <- brapiGET(url = studies_layout_list, con = con)
Expand Down
2 changes: 1 addition & 1 deletion R/ba_studies_observationVariables.R
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ ba_studies_observationvariables <- function(con = NULL,
ba_check(con = con, verbose = FALSE, brapi_calls = "studies/id/observationVariables")
stopifnot(is.character(studyDbId))
check_rclass(rclass = rclass)
brp <- get_brapi(brapi = con)
brp <- get_brapi(con = con)
studies_observationVariables_list <- paste0(brp, "studies/", studyDbId, "/observationVariables/?")
try({
res <- brapiGET(url = studies_observationVariables_list, con = con)
Expand Down
2 changes: 1 addition & 1 deletion R/ba_studies_observationlevels.R
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ ba_studies_observationlevels <- function(con = NULL,
rclass = "vector") {
ba_check(con = con, verbose = FALSE, brapi_calls = "observationLevels")
check_rclass(rclass = rclass)
observationLevels_List <- paste0(get_brapi(brapi = con), "observationLevels")
observationLevels_List <- paste0(get_brapi(con = con), "observationLevels")
try({
res <- brapiGET(url = observationLevels_List, con = con)
res <- httr::content(x = res, as = "text", encoding = "UTF-8")
Expand Down
2 changes: 1 addition & 1 deletion R/ba_studies_observations.R
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ ba_studies_observations <- function(con = NULL,
stopifnot(is.character(observationVariableDbId))
check_paging(pageSize = pageSize, page = page)
check_rclass(rclass = rclass)
brp <- get_brapi(brapi = con)
brp <- get_brapi(con = con)
studies_observations_list <- paste0(brp, "studies/", studyDbId, "/observations/?")
observationVariableDbId <- paste0("observationVariableDbIds=", paste(observationVariableDbId, collapse = ","), "&")
page <- ifelse(is.numeric(page), paste0("page=", page), "")
Expand Down
2 changes: 1 addition & 1 deletion R/ba_studies_observationunits.R
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ ba_studies_observationunits <- function(con = NULL,
stopifnot(is.character(studyDbId))
stopifnot(observationLevel %in% c("plot", "plant"))
check_rclass(rclass = rclass)
brp <- get_brapi(brapi = con)
brp <- get_brapi(con = con)
studies_observationunits_list <- paste0(brp, "studies/", studyDbId, "/observationunits/?")
observationLevel <- ifelse(observationLevel == "plant", "observationLevel=plant", "observationLevel=plot")
studies_observationunits_list <- paste0(studies_observationunits_list, observationLevel)
Expand Down
2 changes: 1 addition & 1 deletion R/ba_studies_observationunits_save.R
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ ba_studies_observationunits_save <- function(con = NULL,
result = list(transactionDbId = transactionDbId,
commit = tolower(as.character(commit)),
data = obs))
brp <- get_brapi(brapi = con)
brp <- get_brapi(con = con)
call_samples <- paste0(brp, "studies/", studyDbId, "/observationunits?observationLevel=", observationLevel)
try({
brapiPOST(url = call_samples, body = dat, con = con)
Expand Down
2 changes: 1 addition & 1 deletion R/ba_studies_search.R
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ ba_studies_search <- function(con = NULL,
pageSize = 1000,
rclass = "tibble") {
ba_check(con = con, verbose = FALSE, brapi_calls = "studies-search")
brp <- get_brapi(brapi = con)
brp <- get_brapi(con = con)
stopifnot(is.character(studyType))
stopifnot(is.character(programDbId))
stopifnot(is.character(locationDbId))
Expand Down
2 changes: 1 addition & 1 deletion R/ba_studies_seasons.R
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ ba_studies_seasons <- function(con = NULL,
pageSize = 1000,
rclass = "tibble") {
ba_check(con = con, verbose = FALSE, brapi_calls = "seasons")
brp <- get_brapi(brapi = con)
brp <- get_brapi(con = con)
stopifnot(is.numeric(year))
check_paging(pageSize = pageSize, page = page)
check_rclass(rclass = rclass)
Expand Down
2 changes: 1 addition & 1 deletion R/ba_studies_studytypes.R
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ ba_studies_studytypes <- function(con = NULL,
ba_check(con = con, verbose = FALSE, brapi_calls = "studyTypes")
check_paging(pageSize = pageSize, page = page)
check_rclass(rclass = rclass)
brp <- get_brapi(brapi = con)
brp <- get_brapi(con = con)
pstudyTypes <- paste0(brp, "studyTypes/?")
page <- ifelse(is.numeric(page), paste0("page=", page, "&"), "")
pageSize <- ifelse(is.numeric(pageSize), paste0("pageSize=", pageSize, "&"), "")
Expand Down
2 changes: 1 addition & 1 deletion R/ba_studies_table.R
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ ba_studies_table <- function(con = NULL,
stopifnot(is.character(studyDbId))
stopifnot(format %in% c("json", "tsv", "csv"))
check_rclass(rclass = rclass)
brp <- get_brapi(brapi = con)
brp <- get_brapi(con = con)
# studies_table <- paste0(brp, "studies/", studyDbId, "/table/?") # TO BE CONSIDERED FOR VERSION 2
studies_table <- paste0(brp, "studies/", studyDbId, "/table?")
if (rclass %in% c("data.frame", "tibble") & format == "json") {
Expand Down
2 changes: 1 addition & 1 deletion R/ba_studies_table_save.R
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ ba_studies_table_save <- function(con = NULL,
ba_check(con = con, verbose = FALSE, brapi_calls = "studies/id/table")
stopifnot(is.character(studyDbId))
stopifnot(is.data.frame(study_table))
brp <- get_brapi(brapi = con)
brp <- get_brapi(con = con)
studies_table <- paste0(brp, "studies/", studyDbId, "/table/")
try({
metadata <- list(pagination = list(pageSize = 0, currentPage = 0, totalCount = 0, totalPages = 0),
Expand Down
2 changes: 1 addition & 1 deletion R/ba_traits.R
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ ba_traits <- function(con = NULL,
ba_check(con = con, verbose = FALSE, brapi_calls = "traits")
check_paging(pageSize = pageSize, page = page)
check_rclass(rclass = rclass)
brp <- get_brapi(brapi = con)
brp <- get_brapi(con = con)
traits <- paste0(brp, "traits/?")
ppage <- paste0("page=", page, "")
ppageSize <- paste0("pageSize=", pageSize, "&")
Expand Down
2 changes: 1 addition & 1 deletion R/ba_traits_details.R
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ ba_traits_details <- function(con = NULL,
ba_check(con = con, verbose = FALSE, brapi_calls = "traits")
stopifnot(is.character(traitDbId))
check_rclass(rclass = rclass)
brp <- get_brapi(brapi = con)
brp <- get_brapi(con = con)
traits <- paste0(brp, "traits/", traitDbId)
try({
res <- brapiGET(url = traits, con = con)
Expand Down
2 changes: 1 addition & 1 deletion R/ba_trials.R
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ ba_trials <- function(con = NULL,
stopifnot(is.character(sortOrder))
check_paging(pageSize = pageSize, page = page)
check_rclass(rclass = rclass)
brp <- get_brapi(brapi = con)
brp <- get_brapi(con = con)
# ptrials <- paste0(brp, "trials/?") # TO BE CONSIDERED FOR VERSION 2
ptrials <- paste0(brp, "trials?")
pprogramDbId <- ifelse(programDbId != "any", paste0("programDbId=", programDbId, "&"), "")
Expand Down
2 changes: 1 addition & 1 deletion R/ba_trials_details.R
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ ba_trials_details <- function(con = NULL,
trialDbId = "any",
rclass = "tibble") {
ba_check(con = con, verbose = FALSE, brapi_calls = "trials/id")
brp <- get_brapi(brapi = con)
brp <- get_brapi(con = con)
stopifnot(is.character(trialDbId))
check_rclass(rclass = rclass)
ptrials <- paste0(brp, "trials/", trialDbId)
Expand Down
10 changes: 5 additions & 5 deletions R/zzz.R
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
.onAttach <- function(libname, pkgname) {
library(magrittr)
paste("This is the development version of the 'brapi' package!\nYou are using version ",
utils::packageVersion("brapi"), "\n\n") %>%
paste("Please register any issues at: https://github.com/c5sire/brapi/issues\n") %>%
packageStartupMessage()

txt <- paste("This is the development version of the 'brapi' package!\nYou are using version ",
utils::packageVersion("brapi"), "\n\n")
txt <- paste(txt, "Please register any issues at: https://github.com/c5sire/brapi/issues\n")
packageStartupMessage(txt)
}

.onLoad <- function(libname, pkgname) {
Expand Down
2 changes: 1 addition & 1 deletion vignettes/tutorial.R
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
## ---- message=TRUE, warning=TRUE-----------------------------------------
#library(DT)

library(brapi)

white_list <- ba_db()
Expand Down
Loading

0 comments on commit 209c50b

Please sign in to comment.