Body: <p>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.</p>
  <pre><code>snps &lt;- data.frame(
    snp_id = c(&quot;rs1&quot;, &quot;rs2&quot;, &quot;rs3&quot;, &quot;rs4&quot;, &quot;rs5&quot;, &quot;rs6&quot;, &quot;rs7&quot;, &quot;rs8&quot;),
    Gene.refGene_ANNOVAR = c(&quot;gene1&quot;, &quot;gene1&quot;, &quot;gene1&quot;, &quot;gene1&quot;, &quot;gene2&quot;, &quot;gene2&quot;, &quot;gene2&quot;, &quot;gene2&quot;),
    p.value = c(0.7703884, 0.9648540, 0.9648540, 0.9648540, 0.54, 0.03, 0.03, 0.8)
  )
  </code></pre>
  <p>above an example of the data .
  I read about the SKAT method -&gt; <a href="https://www.hsph.harvard.edu/skat/" rel="nofollow noreferrer">https://www.hsph.harvard.edu/skat/</a><br />
  and figured it might do the work .
  I read about the package here:<a href="https://rdrr.io/cran/SKAT/man/SKAT.html" rel="nofollow noreferrer">https://rdrr.io/cran/SKAT/man/SKAT.html</a>
  tried to implement it on my data , but got lost as how to perform it correctly:</p>
  <pre><code>gene_pvals &lt;- aggregate(p.value ~ Gene.refGene_ANNOVAR, data = df, FUN = function(x) SKAT::SKAT_Null(x)$p.value)
  </code></pre>
  <p>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).</p>
  
Comments.ContentLicense: CC BY-SA 4.0
Comments.CreationDate: 2023-03-24T15:48:41.500Z
Comments.Text: cross posted: https://www.biostars.org/p/9558525
Comments.UserDisplayName: Pierre
Comments.ContentLicense: CC BY-SA 4.0
Comments.CreationDate: 2023-04-01T10:32:40.907Z
Comments.Text: Unfortunately i didn't recive any  helpful reply in BIOSTARS would be happy for help here
Comments.UserDisplayName: liza
Tags: <r><gene><snp><p-values>
Title: SKAT method in R
ThreadText: # SKAT method in R
  
  (Asked by: username_0 on 2023-03-24)
  
  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).
  
  **Tags:** r, gene, snp, p-values
  
  > **Comments:**
  > **username_1**: cross posted: https://www.biostars.org/p/9558525  
  > **username_0**: Unfortunately i didn't recive any  helpful reply in BIOSTARS would be happy for help here  
  
  ---
  
  ## 0 answers
  
  