<p>You have to perform an alignment first. Phangorn use phylogenetic estimation and this requires a precise alignment position to track homologous nucleotide mutation. Maximum likelihood theory will assess the probability of a given tree for each homologous nucleotide site, if they are not alignment it can't do it and will violate the assumptions of phylogeny. </p>

<p>If the sequences are different lengths, which it means both nucleotide and indel ('-') sites, it means there hasn't been or there is an error with the alignment. I use <code>muscle</code> these days having previously used <code>clustalo</code>. Its really easy to use and easily configures on a linux server and its super quick. If you get stuck let me know.</p>

<p>I had a look at your alignment and can verify it hasn't been aligned.</p>

CC BY-SA 4.0
2020-05-20T07:14:51.947Z
Once you've run your alignment, you may additionnally think about remove poorly conserved regions, e.g. with Gblocks. It might refine your phylogeny.
thomas duge de bernonville
CC BY-SA 4.0
2020-05-21T09:27:30.767Z
damn I was using the raw fasta file..got my error I have to use the alignment file
kcm
CC BY-SA 4.0
2020-05-19T23:52:48.930Z
2020-05-19T23:52:48.930Z
M__
<p>Im trying to read a multifasta sequence file into phangorn I get the following error </p>

<pre><code>tipseqfile &lt;- ("abhi_seq/clean_dup_rem.fasta")
tipseq &lt;- read.phyDat(tipseqfile,format="fasta")
</code></pre>

<p><a href="https://drive.google.com/open?id=1kTXfnRVjpl3xjZFQUpGaJck9M4d5NSnu" rel="nofollow noreferrer">my file</a></p>

<blockquote>
  <p>Error in read.phyDat(tipseqfile, format = "fasta") : 
        sequences have different length</p>
</blockquote>

<p>Now is it necessary to have same length of each fasta sequence? or Im doing something wrong </p>

<r><phylogenetics><fasta><phylogeny><phangorn>
phangorn fasta file read error
# phangorn fasta file read error

(Asked by: username_0 on 2020-05-19)

Im trying to read a multifasta sequence file into phangorn I get the following error 
tipseqfile <- ("abhi_seq/clean_dup_rem.fasta")
tipseq <- read.phyDat(tipseqfile,format="fasta")

my file

Error in read.phyDat(tipseqfile, format = "fasta") : 
        sequences have different length

Now is it necessary to have same length of each fasta sequence? or Im doing something wrong

**Tags:** r, phylogenetics, fasta, phylogeny, phangorn

---

## 1 answers

### Answer by username_1 on 2020-05-19. Score: 3 | Accepted answer

You have to perform an alignment first. Phangorn use phylogenetic estimation and this requires a precise alignment position to track homologous nucleotide mutation. Maximum likelihood theory will assess the probability of a given tree for each homologous nucleotide site, if they are not alignment it can't do it and will violate the assumptions of phylogeny.

If the sequences are different lengths, which it means both nucleotide and indel ('-') sites, it means there hasn't been or there is an error with the alignment. I use `muscle` these days having previously used `clustalo`. Its really easy to use and easily configures on a linux server and its super quick. If you get stuck let me know.

I had a look at your alignment and can verify it hasn't been aligned.

> **Comments:**
> **username_2**: Once you've run your alignment, you may additionnally think about remove poorly conserved regions, e.g. with Gblocks. It might refine your phylogeny.  
> **username_0**: damn I was using the raw fasta file..got my error I have to use the alignment file  

---

