R/hail_entries.R

Defines functions hail_entries

Documented in hail_entries

#' Get Entries Field
#'
#' This function retrieves the entries fields from a hail dataframe and explodes the
#' columns call, dp and gq.
#' 
#' @param df A hail dataframe.
#' 
#' @return A spark dataframe.
#'
#' @examples
#' \dontrun{
#' library(sparklyr)
#' 
#' sc <- spark_connect(master = "local", version = "2.4", config = hail_config())
#' 
#' hail_context(sc) %>% 
#'   hail_read_matrix(system.file("extdata/1kg.mt", package = "sparkhail")) %>% 
#'   hail_dataframe() %>% 
#'   hail_entries()
#' }
#' 
#' @export
hail_entries <- function(df){
  df %>% 
    sparklyr.nested::sdf_select(call = entries.Call,
                                ad = entries.AD,
                                dp = entries.DP,
                                gq = entries.GQ,
                                pl = entries.PL) %>% 
    sparklyr.nested::sdf_explode("call") %>% 
    sparklyr.nested::sdf_explode("dp") %>% 
    sparklyr.nested::sdf_explode("gq") 
}

Try the sparkhail package in your browser

Any scripts or data that you put into this service are public.

sparkhail documentation built on Dec. 24, 2019, 1:06 a.m.