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


1 Answer 1


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.

  • 2
    $\begingroup$ Once you've run your alignment, you may additionnally think about remove poorly conserved regions, e.g. with Gblocks. It might refine your phylogeny. $\endgroup$ May 20, 2020 at 7:14
  • 1
    $\begingroup$ damn I was using the raw fasta file..got my error I have to use the alignment file $\endgroup$
    – kcm
    May 21, 2020 at 9:27

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.