0
$\begingroup$

Im trying to find the out-group in the alignment my data files file a and file b both the case i'm getting NA when i run this pars.a$tip.label[pars.a$edge[which.max(pars.a$edge.length),2]]

I tried NJ instead of upgma i do still get NA not sure what is the issue ,but at the same time when i used other alignment file with 50 sequence works fine.

a<-read.alignment("abhi_seq/final_abhi_tempa1.fas", format="fasta")
a.phydat<-as.phyDat(a)
dist.a.phydat<-dist.dna(as.DNAbin(a.phydat))
upgma.a<-upgma(dist.a.phydat)
parsimony(upgma.a,a.phydat)
pars.a <- optim.parsimony(upgma.a, a.phydat)
pars.a<-acctran(pars.a, a.phydat)
pars.a$tip.label[pars.a$edge[which.max(pars.a$edge.length),2]]
$\endgroup$
1
$\begingroup$

the fact is that the present upgma tree as a midpoint rooting here, corresponding to node 46.

getRoot(upgma.a)

so for this kind of tree, I recommend you to use the midpoint() rooting function.

pars.a <- optim.parsimony(upgma.a, a.phydat)
pars.a<-acctran(pars.a, a.phydat)
plot(midpoint(pars.a))
$\endgroup$
9
  • $\begingroup$ let me try it out and how do we decide which rooting to use? based on observation after plotting $\endgroup$
    – kcm
    Jun 15 '20 at 8:33
  • 1
    $\begingroup$ yes visual inspection seems relevant. It totally depends of your input data, whether your sequences are strongly conserved (without evident outgroup) or more divergent. I think you may write a control loop after constructing the upgma tree, by checking if the ouptput of getRoot(upgma.a) returns a node or a tip. If it is a node, then it might proceed with the midpoint() version. $\endgroup$ Jun 15 '20 at 8:39
  • 1
    $\begingroup$ yes, probably! it is probably a more universal solution, but not the necessarily the best one! $\endgroup$ Jun 15 '20 at 8:52
  • 1
    $\begingroup$ It won't work because you have only 45 tip labels, if I remember well. I think you may run: pars.a.rooted.dd<-as.dendrogram(force.ultrametric(midpoint(pars.a))) $\endgroup$ Jun 15 '20 at 9:15
  • 1
    $\begingroup$ seems ok. It is true that in the previous code, we used root(midpoint(fit$tree), outgroup="AAA64460", resolve.root=T) to force using a given tip as root. Using force.ultrametric(midpoint(pars.a)) should work too indeed. $\endgroup$ Jun 15 '20 at 9:26

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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