R/effect_size_ref_make.R

Defines functions effect_size_ref_make

effect_size_ref_make <- function(dataset, db_path)
{
  if ('PVALUE' %in% names(dataset))
  {
    savedFile <- tryCatch({
      dataset <-  dataset[PVALUE <= 0.001, list(hID, EFFECT_ALL, OTHER_ALL, EFFECT, PVALUE)]
      names(dataset) <-  c("hID", "EFF_ALL", "NON_EFF_ALL", "EFFECT", "PVALUE")

      saveRDS(object = dataset,
              file = db_path,
              version = '2')

      print_and_log(
        sprintf('Effect-size reference file saved with %s rows.', nrow(dataset)),
        'info',
        display = .QC$config$debug$verbose
      )
    }, error = function(err)
    {
      print_and_log(paste( 'Error occured when saving the effect-size reference!', err$message),
        'warning')
    })

  } else{
    print_and_log('PVALUE not found in dataset to save as effect-size reference file!','warning',
                  display = .QC$config$debug$verbose)
  }
}

Try the GWASinspector package in your browser

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

GWASinspector documentation built on Sept. 28, 2023, 1:06 a.m.