KlausVigo / ggnetworx

phylogenetic networks using ggplot2 and ggtree
11 stars 4 forks source link

NAs introduced by coercion #1

Open hewebb1 opened 5 years ago

hewebb1 commented 5 years ago

Hello! I am trying to use ggnetworx to visualize and mark up a SplitsTree generated network. I’ve exported a nexus file from SplitsTree (version 4.14.4), but I receive the following error and warning messages when I run the following commands:

SplitsTree <- read.nexus.networx(file="parsnpLCB-abstractmakeup.aln.nex", splits = TRUE) Warning message: In read.nexus.networx(file = "parsnpLCB-abstractmakeup.aln.nex", : NAs introduced by coercion Tree <- ggnetworx(SplitsTree) + geom_tiplab2() Error in label[ind] <- model$translate$label : NAs are not allowed in subscripted assignments

I suspect this has to do with the formatting of my nexus file which I’ve convert to text file in order to upload here. Any feedback on what might be the issue here would be greatly appreciated.

parsnpLCB-abstractmakeup.txt

R version 3.5.1 ggnetworx version 0.1.0 Phangorn version 2.4.0

Thank you in advance, Hattie

KlausVigo commented 5 years ago

Hi @hewebb1,

the problem is that your data set contains identical sequences. Therefore Splitstree has several labels for nodes. Currently the functions in phangorn and ggnetworx cannot handle this.

There are potentially several ways to handle this. One could only use unique sequences or add edge connecting the labels of length 0.
For example in phangorn there is a generic function unique for phyDat objects (alignments) to generate unique sequences.

Regards, Klaus