forked from CIP-RIU/brapi
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathba_markerprofiles_search.R
64 lines (61 loc) · 2.21 KB
/
ba_markerprofiles_search.R
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
#' ba_markerprofiles_search
#'
#' Lists markers as result of a search.
#'
#' @param con brapi connection object
#' @param germplasmDbId character; default ''
#' @param studyDbId character; default ''
#' @param sampleDbId character; default: ''
#' @param extractDbId character; default: ''
#' @param methodDbId character; default: ''
#' @param page integer; default: 0
#' @param pageSize integer; default 1000
#' @param rclass character; default: tibble
#'
#' @return rclass as requested
#'
#' @author Reinhard Simon
#' @references \href{https://github.com/plantbreeding/API/blob/V1.2/Specification/MarkerProfiles/MarkerProfiles_GET.md}{github}
#'
#' @family markerprofiles
#' @family genotyping
#'
#' @example inst/examples/ex-ba_markerprofiles_search.R
#'
#' @import httr
#' @import progress
#' @export
ba_markerprofiles_search <- function(con = NULL,
germplasmDbId = "",
studyDbId = "",
sampleDbId = "",
extractDbId = "",
methodDbId = "",
page = 0,
pageSize = 10000,
rclass = c("tibble", "data.frame",
"list", "json")) {
ba_check(con = con, verbose = FALSE)
check_character(germplasmDbId, studyDbId, sampleDbId, extractDbId,
methodDbId )
rclass <- match.arg(rclass)
brp <- get_brapi(con = con) %>% paste0("markerprofiles")
callurl <- get_endpoint(brp,
germplasmDbId = germplasmDbId,
studyDbId = studyDbId,
sampleDbId = sampleDbId,
extractDbId = extractDbId,
methodDbId = methodDbId,
pageSize = pageSize,
page = page
)
out <- NULL
out <- try({
res <- brapiGET(url = callurl, con = con)
res2 <- httr::content(x = res, as = "text", encoding = "UTF-8")
dat2tbl(res = res2, rclass = rclass)
})
class(out) <- c(class(out), "ba_markerprofiles_search")
show_metadata(res)
return(out)
}