1

After using drop.tip command from the APE package on a phylogenetic tree, I plotted my tree using R and everything looked ok. After exporting the newick file, I found that the tips I dropped ended up dropping just the labels and were replaced by this character,:0. The tips I dropped were duplicates and had a branch length of zero, but I do not know how to fix it to where it drops the edge as well. I am relatively new to R, so any advice is appreciated!

I used this workflow based on the documentation provided by the APE creators. I have used the same command with other trees and this is the first time I ran into an issue where I get this :0 character when I export the tree. I honestly don't know which parameters I can adjust that will fix this issue.

L9_CRESS <-  read.tree(file = "L9_CRESS.nwk" )

dropped_tip_b9 <- drop.tip(L9_CRESS, tip= c(232,260,261), trim.internal = TRUE, subtree = TRUE,
                          root.edge = 2, rooted = is.rooted(L9_CRESS), collapse.singles = FALSE,
                          interactive = FALSE)

write.tree(L9_CRESS, file = "L9_CRESS_V2.nwk", append = FALSE,
           digits = 5, tree.names = FALSE)


  • It looks like you're new to SO; welcome to the community! If you want great answers quickly, it's best to make your question reproducible. This includes sample data like the output from `dput()` or `reprex::reprex()` and any libraries you are using. Check it out: [making R reproducible questions](https://stackoverflow.com/q/5963269). – Kat Nov 18 '22 at 16:46
  • Hard to say without seeing your data, but you might find that `TreeTools::DropTip()` provides the desired behaviour. – Martin Smith Apr 20 '23 at 09:52

0 Answers0