MRCIEU / ieugwasr
Showing 1 of 7 files from the diff.
Other files ignored by Codecov

@@ -92,7 +92,12 @@
Loading
92 92
{
93 93
	if(httr::status_code(response) >= 200 & httr::status_code(response) < 300)
94 94
	{
95 -
		return(jsonlite::fromJSON(httr::content(response, "text", encoding='UTF-8')))
95 +
		o <- jsonlite::fromJSON(httr::content(response, "text", encoding='UTF-8'))
96 +
		if('eaf' %in% names(o)) 
97 +
		{
98 +
			o[["eaf"]] <- as.numeric(o[["eaf"]])
99 +
		}
100 +
		return(o)
96 101
	} else {
97 102
		return(response)
98 103
		# stop("error code: ", httr::status_code(response), "\n  message: ", jsonlite::fromJSON(httr::content(response, "text", encoding='UTF-8')))
@@ -150,6 +155,24 @@
Loading
150 155
	dplyr::glimpse(x)
151 156
}
152 157
158 +
batch <- function(x) UseMethod("batch", x)
159 +
batch.GwasInfo <- function(x)
160 +
{
161 +
	sapply(strsplit(x[["id"]], "-"), function(x) paste(x[1], x[2], sep="-"))
162 +
}
163 +
164 +
165 +
#' Get list of data batches in IEU GWAS database
166 +
#'
167 +
#'
168 +
#' @param access_token Google OAuth2 access token. Used to authenticate level of access to data
169 +
#'
170 +
#' @export
171 +
#' @return data frame
172 +
batches <- function(access_token = check_access_token())
173 +
{
174 +
	api_query('batches', access_token=access_token) %>% get_query_content()
175 +
}
153 176
154 177
#' Query specific variants from specific GWAS
155 178
#'
@@ -196,15 +219,17 @@
Loading
196 219
#'
197 220
#' @param variants Array of variants e.g. c("rs234", "7:105561135-105563135")
198 221
#' @param pval p-value threshold. Default = 0.00001
222 +
#' @param batch Vector of batch IDs to search across. If c() (default) then returns all batches
199 223
#' @param access_token Google OAuth2 access token. Used to authenticate level of access to data. By default, checks if already authenticated through \code{get_access_token} and if not then does not perform authentication
200 224
#'
201 225
#' @export
202 226
#' @return Dataframe
203 -
phewas <- function(variants, pval = 0.00001, access_token=check_access_token())
227 +
phewas <- function(variants, pval = 0.00001, batch=c(), access_token=check_access_token())
204 228
{
205 229
	out <- api_query("phewas", query=list(
206 230
		variant=variants,
207 -
		pval=pval
231 +
		pval=pval,
232 +
		index_list=batch
208 233
	), access_token=access_token) %>% get_query_content()
209 234
	if(class(out) != "response")
210 235
	{
Files Coverage
R 60.30%
Project Totals (7 files) 60.30%
Sunburst
The inner-most circle is the entire project, moving away from the center are folders then, finally, a single file. The size and color of each slice is representing the number of statements and the coverage, respectively.
Icicle
The top section represents the entire project. Proceeding with folders and finally individual files. The size and color of each slice is representing the number of statements and the coverage, respectively.
Grid
Each block represents a single file in the project. The size and color of each block is represented by the number of statements and the coverage, respectively.
Loading