Body: <p>I am pretty new to R. So I apologize for asking maybe a very basic question.
  Let's say I have a fasta file with sequence below:</p>
  <pre><code>&gt;sequence_1
  ACCTGC--A
  &gt;sequence_2
  ACC-GCTTA
  &gt;sequence_3
  ACCTGCTTA
  </code></pre>
  <p>Is there a function or method to calculate entropy for each column in R?
  I did some research and found a function that calculate entropy for Amino Acids but not for DNA nucleotides.</p>
  <p>I would like to have the output be stored in a vector or in a list.</p>
  <p>Thanks for the help in advance!</p>
  
Comments.ContentLicense: CC BY-SA 4.0
Comments.CreationDate: 2020-06-27T05:57:06.603Z
Comments.Text: Hi what is the goal of your research? Entropy is a function of a given allele since you have variation, particularly indels this is not possible. With an indel position e.g. 4 now becomes position 3 (sequence_2) within an entropy calculation, so which column are you referirng to? I think you are confusing this with phylogenetic methods.
Comments.UserDisplayName: M__
Comments.ContentLicense: CC BY-SA 4.0
Comments.CreationDate: 2020-06-27T15:26:24.230Z
Comments.Text: Hi Michael, I was able to get it to with some other people's help. But to answer your question, The MolecularEntropy function in R did exactly what wanted to. It calculated the entropy at each nucleotide position with aligned sequences.
Comments.UserDisplayName: Xiaoxixi
Comments.ContentLicense: CC BY-SA 4.0
Comments.CreationDate: 2020-06-27T15:29:07.883Z
Comments.Text: okay, the blurb does say "Gaps are ignored on a site by site basis so the entropy values may have different number of observations among sites." It also needs sequences to be the same length ... I personally don't think it works with indels
Comments.UserDisplayName: M__
Tags: <r><phylogenetics>
Title: Calculate Entropy for DNA Multiple Sequence Alignment in R
ThreadText: # Calculate Entropy for DNA Multiple Sequence Alignment in R
  
  (Asked by: username_0 on 2020-06-27)
  
  I am pretty new to R. So I apologize for asking maybe a very basic question.
  Let's say I have a fasta file with sequence below:
  
  ```
  >sequence_1
  ACCTGC--A
  >sequence_2
  ACC-GCTTA
  >sequence_3
  ACCTGCTTA
  
  ```
  
  Is there a function or method to calculate entropy for each column in R?
  I did some research and found a function that calculate entropy for Amino Acids but not for DNA nucleotides.
  
  I would like to have the output be stored in a vector or in a list.
  
  Thanks for the help in advance!
  
  **Tags:** r, phylogenetics
  
  > **Comments:**
  > **username_1**: Hi what is the goal of your research? Entropy is a function of a given allele since you have variation, particularly indels this is not possible. With an indel position e.g. 4 now becomes position 3 (sequence_2) within an entropy calculation, so which column are you referirng to? I think you are confusing this with phylogenetic methods.  
  > **username_0**: Hi Michael, I was able to get it to with some other people's help. But to answer your question, The MolecularEntropy function in R did exactly what wanted to. It calculated the entropy at each nucleotide position with aligned sequences.  
  > **username_1**: okay, the blurb does say "Gaps are ignored on a site by site basis so the entropy values may have different number of observations among sites." It also needs sequences to be the same length ... I personally don't think it works with indels  
  
  ---
  
  ## 0 answers
  
  