I have data that looks like this: 3 column SNPs their gene based on Annovar and a p-value for every SNP. What I would like is to aggregate the p values for every gene.
snps <- data.frame(
snp_id = c("rs1", "rs2", "rs3", "rs4", "rs5", "rs6", "rs7", "rs8"),
Gene.refGene_ANNOVAR = c("gene1", "gene1", "gene1", "gene1", "gene2", "gene2", "gene2", "gene2"),
p.value = c(0.7703884, 0.9648540, 0.9648540, 0.9648540, 0.54, 0.03, 0.03, 0.8)
)
above an example of the data .
I read about the SKAT method -> https://www.hsph.harvard.edu/skat/
and figured it might do the work .
I read about the package here:https://rdrr.io/cran/SKAT/man/SKAT.html
tried to implement it on my data , but got lost as how to perform it correctly:
gene_pvals <- aggregate(p.value ~ Gene.refGene_ANNOVAR, data = df, FUN = function(x) SKAT::SKAT_Null(x)$p.value)
I would be happy if you could share your knowledge in this situation.I don't have information about the correlations between the SNPs but I know that they are correlated, do I have enough data to complete the SKAT method? also for every SNP i have data on how many patients had the hetro/homozygous encoding(0,1,2).