Answers.Body: <p>You haven't provided any example input files or code, but calculating the 99th percentile in R is a fairly simple process using the <code>quantile</code> function:</p>
  <pre><code>&gt; data &lt;- rnorm(1000)
  &gt; quantile(data, 0.99)
       99% 
  2.261149 
  </code></pre>
  <p>If you want to filter out negative or zero Fst values, this can be done using logical filters:</p>
  <pre><code>&gt; quantile(data[data &gt; 0], 0.99)
       99% 
  2.435389 
  </code></pre>
  <p>Whether or not it makes sense to do this filtering will be dataset specific, and you haven't provided any additional context about your data, so there's no way to appropriately answer that. This is why we put the recommendations into the help for asking questions; it makes answers better.</p>
  
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2024-05-28T22:18:31.137Z
Answers.LastActivityDate: 2024-05-28T22:18:31.137Z
Answers.UserDisplayName: gringer
Body: <p>I used SNP data and calculated Fst using the Popgenome R package to identify SNPs that have diverged between bacterial populations.</p>
  <p>Afterwards, I want to calculate the 99th percentile (P99) of Fst values for SNPs within a single gene and further investigate SNPs that exceed the P99 threshold.</p>
  <p>Should zero and negative Fst values be included when calculating P99?</p>
  
Tags: <fst>
Title: Calculating 99th Percentile of Fst values for SNPs within gene
ThreadText: # Calculating 99th Percentile of Fst values for SNPs within gene
  
  (Asked by: username_0 on 2024-05-28)
  
  I used SNP data and calculated Fst using the Popgenome R package to identify SNPs that have diverged between bacterial populations.
  
  Afterwards, I want to calculate the 99th percentile (P99) of Fst values for SNPs within a single gene and further investigate SNPs that exceed the P99 threshold.
  
  Should zero and negative Fst values be included when calculating P99?
  
  **Tags:** fst
  
  
  ---
  
  ## 1 answers
  
  ### Answer by username_1 on 2024-05-28. Score: 0
  
  You haven't provided any example input files or code, but calculating the 99th percentile in R is a fairly simple process using the `quantile` function:
  
  ```
  > data <- rnorm(1000)
  > quantile(data, 0.99)
       99% 
  2.261149 
  
  ```
  
  If you want to filter out negative or zero Fst values, this can be done using logical filters:
  
  ```
  > quantile(data[data > 0], 0.99)
       99% 
  2.435389 
  
  ```
  
  Whether or not it makes sense to do this filtering will be dataset specific, and you haven't provided any additional context about your data, so there's no way to appropriately answer that. This is why we put the recommendations into the help for asking questions; it makes answers better.
  
  
  ---
  
  