forked from Al-Murphy/MungeSumstats
-
Notifications
You must be signed in to change notification settings - Fork 0
/
convert_sumstats.R
26 lines (26 loc) · 1012 Bytes
/
convert_sumstats.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
#' Convert summary statistics to desired object type
#'
#' @return Summary statistics in the converted format
#'
#' @inheritParams format_sumstats
#' @param return_format Object type to convert to;
#' \code{"data.table"}, \code{"GenomicRanges"} or
#' \code{"VRanges"}(default is \code{"data.table"}).
#' @keywords internal
convert_sumstats <- function(sumstats_dt,
return_format = c("data.table",
"vranges",
"granges")) {
return_format <- return_format[1]
if (tolower(return_format) %in% c("vr", "vranges")) {
out <- to_vranges(sumstats_dt = sumstats_dt)
return(out)
} else if (tolower(return_format) %in% c("gr",
"granges",
"genomicranges")) {
out <- to_granges(sumstats_dt = sumstats_dt)
return(out)
} else {
return(sumstats_dt)
}
}