xinhe-lab / RSSp

Polygenic RSS
GNU General Public License v3.0
0 stars 0 forks source link

Compute genomic control factor #3

Open xiangzhu opened 6 years ago

xiangzhu commented 6 years ago

I wonder if we could let the program compute and display the genomic control factor for the input summary dataset.

Genomic control factor paper: https://www.ncbi.nlm.nih.gov/pubmed/11315092

The following code may be useful.

# SOURCE: http://genometoolbox.blogspot.com/2014/08/how-to-calculate-genomic-inflation.html
# compute genomic control factor
calc_gc <- function(pval) {
  if (all(is.na(pval))) {
    lambda_gc <- NA
    return(lambda_gc)
  } else {
    pval <- pval[!is.na(pval)]
    chisq <- qchisq(1-pval, 1)
    lambda_gc <- median(chisq)/qchisq(0.5,1)
    return(lambda_gc)
  }
}

Displaying this factor can help us understand why sometimes the estimated PVE is large when the true PVE is close to zero (maybe the input summary data were not corrected for population stratification?)