ContentMine / phylotree

A repository for ami-phylotree development
0 stars 0 forks source link

Singleton nodes in Newick #21

Open petermr opened 9 years ago

petermr commented 9 years ago

Ross Mounce: I have discovered that some programs don't like "singleton nodes" p4 may also be having this problem so trees like this:

((X76436:483.0,((X60646:436.0,(ABOZ1185:296.0,(D16268:208.0,(AJ542512:21.0,AJ542509:31.0)NT1.13:245.0)NT1.6:13.0)NT1.5:56.0)NT1.4:103.0,(AJ551329:342.0,(AJ422145:163.0,(EU046268:80.0,AY373018:217.0)NT1.9:88.0)NT1.8:60.0)NT1.7:185.0)NT1.3:64.0)NT1.2:244.0);

must be converted to:

(X76436:483,((X60646:436,(ABOZ1185:296,(D16268:208,(AJ542512:21,AJ542509:31)NT1.13:245)NT1.6:13)NT1.5:56)NT1.4:103,(AJ551329:342,(AJ422145:163,(EU046268:80,AY373018:217)NT1.9:88)NT1.8:60)NT1.7:185)NT1.3:64)NT1.2;

(aside from removing the decimal .0 the significant difference is removing the outermost parentheses) for trees like the above R ape package for phylogenetics will give this error message:

MyTree <- read.tree("tree3.tre") #fail
Error in read.tree("tree3.tre") : 
  The tree has apparently singleton node(s): cannot read tree file.
  Reading Newick file aborted at tree no. 1

there is an R script linked from here that I've tried and appears to succeed in removing these singleton nodes: https://stat.ethz.ch/pipermail/r-sig-phylo/2013-June/002783.html

PMR: If you describe the problem precisely I can edit ami-phylo to avoid this problem. Can the singleton node be anywhere? If so I can alter:

A-
  B
  C-
    D

to

A- 
  B
  D

as C has only one child. Is that what is required? Universally elide all single-node children with their child.

rossmounce commented 9 years ago

R reports finding this problem in 143 / 297 newick files I fed it:

Error in read.tree("ijs.0.000745-0-000.pbm.nwk") : 
  The tree has apparently singleton node(s): cannot read tree file.
  Reading Newick file aborted at tree no. 1
Warning message:
In rm(MyTree) : object 'MyTree' not found
Error in read.tree("ijs.0.002337-0-000.pbm.nwk") : 
  The tree has apparently singleton node(s): cannot read tree file.
  Reading Newick file aborted at tree no. 1
Warning message:
In rm(MyTree) : object 'MyTree' not found
Error in read.tree("ijs.0.002899-0-000.pbm.nwk") : 
  The tree has apparently singleton node(s): cannot read tree file.
  Reading Newick file aborted at tree no. 1
Warning message:
In rm(MyTree) : object 'MyTree' not found
Error in read.tree("ijs.0.003145-0-000.pbm.nwk") : 
  The tree has apparently singleton node(s): cannot read tree file.
  Reading Newick file aborted at tree no. 1
Warning message:
In rm(MyTree) : object 'MyTree' not found
Error in read.tree("ijs.0.003368-0-000.pbm.nwk") : 
  The tree has apparently singleton node(s): cannot read tree file.
  Reading Newick file aborted at tree no. 1
Warning message:
In rm(MyTree) : object 'MyTree' not found
Error in read.tree("ijs.0.005843-0-000.pbm.nwk") : 
  The tree has apparently singleton node(s): cannot read tree file.
  Reading Newick file aborted at tree no. 1
Warning message:
In rm(MyTree) : object 'MyTree' not found
Error in read.tree("ijs.0.006643-0-000.pbm.nwk") : 
  The tree has apparently singleton node(s): cannot read tree file.
  Reading Newick file aborted at tree no. 1
Warning message:
In rm(MyTree) : object 'MyTree' not found
Error in read.tree("ijs.0.006890-0-001.pbm.nwk") : 
  The tree has apparently singleton node(s): cannot read tree file.
  Reading Newick file aborted at tree no. 1
Warning message:
In rm(MyTree) : object 'MyTree' not found
Error in read.tree("ijs.0.007286-0-000.pbm.nwk") : 
  The tree has apparently singleton node(s): cannot read tree file.
  Reading Newick file aborted at tree no. 1
Warning message:
In rm(MyTree) : object 'MyTree' not found
Error in read.tree("ijs.0.007336-0-000.pbm.nwk") : 
  The tree has apparently singleton node(s): cannot read tree file.
  Reading Newick file aborted at tree no. 1
Warning message:
In rm(MyTree) : object 'MyTree' not found
Error in read.tree("ijs.0.007401-0-001.pbm.nwk") : 
  The tree has apparently singleton node(s): cannot read tree file.
  Reading Newick file aborted at tree no. 1
Warning message:
In rm(MyTree) : object 'MyTree' not found
Error in read.tree("ijs.0.007419-0-000.pbm.nwk") : 
  The tree has apparently singleton node(s): cannot read tree file.
  Reading Newick file aborted at tree no. 1
Warning message:
In rm(MyTree) : object 'MyTree' not found
Error in read.tree("ijs.0.007591-0-000.pbm.nwk") : 
  The tree has apparently singleton node(s): cannot read tree file.
  Reading Newick file aborted at tree no. 1
Warning message:
In rm(MyTree) : object 'MyTree' not found
Error in read.tree("ijs.0.008268-0-001.pbm.nwk") : 
  The tree has apparently singleton node(s): cannot read tree file.
  Reading Newick file aborted at tree no. 1
Warning message:
In rm(MyTree) : object 'MyTree' not found
Error in read.tree("ijs.0.008607-0-000.pbm.nwk") : 
  The tree has apparently singleton node(s): cannot read tree file.
  Reading Newick file aborted at tree no. 1
Warning message:
In rm(MyTree) : object 'MyTree' not found
Error in read.tree("ijs.0.009175-0-000.pbm.nwk") : 
  The tree has apparently singleton node(s): cannot read tree file.
  Reading Newick file aborted at tree no. 1
Warning message:
In rm(MyTree) : object 'MyTree' not found
Error in read.tree("ijs.0.009605-0-000.pbm.nwk") : 
  The tree has apparently singleton node(s): cannot read tree file.
  Reading Newick file aborted at tree no. 1
Warning message:
In rm(MyTree) : object 'MyTree' not found
Error in read.tree("ijs.0.010074-0-001.pbm.nwk") : 
  The tree has apparently singleton node(s): cannot read tree file.
  Reading Newick file aborted at tree no. 1
Warning message:
In rm(MyTree) : object 'MyTree' not found
Error in read.tree("ijs.0.010470-0-000.pbm.nwk") : 
  The tree has apparently singleton node(s): cannot read tree file.
  Reading Newick file aborted at tree no. 1
Warning message:
In rm(MyTree) : object 'MyTree' not found
Error in read.tree("ijs.0.011569-0-000.pbm.nwk") : 
  The tree has apparently singleton node(s): cannot read tree file.
  Reading Newick file aborted at tree no. 1
Warning message:
In rm(MyTree) : object 'MyTree' not found
Error in read.tree("ijs.0.011957-0-000.pbm.nwk") : 
  The tree has apparently singleton node(s): cannot read tree file.
  Reading Newick file aborted at tree no. 1
Warning message:
In rm(MyTree) : object 'MyTree' not found
Error in read.tree("ijs.0.013250-0-001.pbm.nwk") : 
  The tree has apparently singleton node(s): cannot read tree file.
  Reading Newick file aborted at tree no. 1
Warning message:
In rm(MyTree) : object 'MyTree' not found
Error in read.tree("ijs.0.013276-0-000.pbm.nwk") : 
  The tree has apparently singleton node(s): cannot read tree file.
  Reading Newick file aborted at tree no. 1
Warning message:
In rm(MyTree) : object 'MyTree' not found
Error in read.tree("ijs.0.015594-0-000.pbm.nwk") : 
  The tree has apparently singleton node(s): cannot read tree file.
  Reading Newick file aborted at tree no. 1
Warning message:
In rm(MyTree) : object 'MyTree' not found
Error in read.tree("ijs.0.015594-0-001.pbm.nwk") : 
  The tree has apparently singleton node(s): cannot read tree file.
  Reading Newick file aborted at tree no. 1
Warning message:
In rm(MyTree) : object 'MyTree' not found
Error in read.tree("ijs.0.015602-0-000.pbm.nwk") : 
  The tree has apparently singleton node(s): cannot read tree file.
  Reading Newick file aborted at tree no. 1
Warning message:
In rm(MyTree) : object 'MyTree' not found
Error in read.tree("ijs.0.016055-0-001.pbm.nwk") : 
  The tree has apparently singleton node(s): cannot read tree file.
  Reading Newick file aborted at tree no. 1
Warning message:
In rm(MyTree) : object 'MyTree' not found
Error in read.tree("ijs.0.016287-0-000.pbm.nwk") : 
  The tree has apparently singleton node(s): cannot read tree file.
  Reading Newick file aborted at tree no. 1
Warning message:
In rm(MyTree) : object 'MyTree' not found
Error in read.tree("ijs.0.016600-0-001.pbm.nwk") : 
  The tree has apparently singleton node(s): cannot read tree file.
  Reading Newick file aborted at tree no. 1
Warning message:
In rm(MyTree) : object 'MyTree' not found
Error in read.tree("ijs.0.016725-0-000.pbm.nwk") : 
  The tree has apparently singleton node(s): cannot read tree file.
  Reading Newick file aborted at tree no. 1
Warning message:
In rm(MyTree) : object 'MyTree' not found
Error in read.tree("ijs.0.017848-0-001.pbm.nwk") : 
  The tree has apparently singleton node(s): cannot read tree file.
  Reading Newick file aborted at tree no. 1
Warning message:
In rm(MyTree) : object 'MyTree' not found
Error in read.tree("ijs.0.018333-0-002.pbm.nwk") : 
  The tree has apparently singleton node(s): cannot read tree file.
  Reading Newick file aborted at tree no. 1
Warning message:
In rm(MyTree) : object 'MyTree' not found
Error in read.tree("ijs.0.018713-0-000.pbm.nwk") : 
  The tree has apparently singleton node(s): cannot read tree file.
  Reading Newick file aborted at tree no. 1
Warning message:
In rm(MyTree) : object 'MyTree' not found
Error in read.tree("ijs.0.019273-0-001.pbm.nwk") : 
  The tree has apparently singleton node(s): cannot read tree file.
  Reading Newick file aborted at tree no. 1
Warning message:
In rm(MyTree) : object 'MyTree' not found
Error in read.tree("ijs.0.019752-0-001.pbm.nwk") : 
  The tree has apparently singleton node(s): cannot read tree file.
  Reading Newick file aborted at tree no. 1
Warning message:
In rm(MyTree) : object 'MyTree' not found
Error in read.tree("ijs.0.020149-0-002.pbm.nwk") : 
  The tree has apparently singleton node(s): cannot read tree file.
  Reading Newick file aborted at tree no. 1
Warning message:
In rm(MyTree) : object 'MyTree' not found
Error in read.tree("ijs.0.020370-0-001.pbm.nwk") : 
  The tree has apparently singleton node(s): cannot read tree file.
  Reading Newick file aborted at tree no. 1
Warning message:
In rm(MyTree) : object 'MyTree' not found
Error in read.tree("ijs.0.020610-0-001.pbm.nwk") : 
  The tree has apparently singleton node(s): cannot read tree file.
  Reading Newick file aborted at tree no. 1
Warning message:
In rm(MyTree) : object 'MyTree' not found
Error in read.tree("ijs.0.02108-0-001.pbm.nwk") : 
  The tree has apparently singleton node(s): cannot read tree file.
  Reading Newick file aborted at tree no. 1
Warning message:
In rm(MyTree) : object 'MyTree' not found
Error in read.tree("ijs.0.021642-0-000.pbm.nwk") : 
  The tree has apparently singleton node(s): cannot read tree file.
  Reading Newick file aborted at tree no. 1
Warning message:
In rm(MyTree) : object 'MyTree' not found
Error in read.tree("ijs.0.021709-0-000.pbm.nwk") : 
  The tree has apparently singleton node(s): cannot read tree file.
  Reading Newick file aborted at tree no. 1
Warning message:
In rm(MyTree) : object 'MyTree' not found
Error in read.tree("ijs.0.021964-0-001.pbm.nwk") : 
  The tree has apparently singleton node(s): cannot read tree file.
  Reading Newick file aborted at tree no. 1
Warning message:
In rm(MyTree) : object 'MyTree' not found
Error in read.tree("ijs.0.022046-0-000.pbm.nwk") : 
  The tree has apparently singleton node(s): cannot read tree file.
  Reading Newick file aborted at tree no. 1
Warning message:
In rm(MyTree) : object 'MyTree' not found
Error in read.tree("ijs.0.023176-0-000.pbm.nwk") : 
  The tree has apparently singleton node(s): cannot read tree file.
  Reading Newick file aborted at tree no. 1
Warning message:
In rm(MyTree) : object 'MyTree' not found
Error in read.tree("ijs.0.023192-0-000.pbm.nwk") : 
  The tree has apparently singleton node(s): cannot read tree file.
  Reading Newick file aborted at tree no. 1
Warning message:
In rm(MyTree) : object 'MyTree' not found
Error in read.tree("ijs.0.023317-0-000.pbm.nwk") : 
  The tree has apparently singleton node(s): cannot read tree file.
  Reading Newick file aborted at tree no. 1
Warning message:
In rm(MyTree) : object 'MyTree' not found
Error in read.tree("ijs.0.023655-0-000.pbm.nwk") : 
  The tree has apparently singleton node(s): cannot read tree file.
  Reading Newick file aborted at tree no. 1
Warning message:
In rm(MyTree) : object 'MyTree' not found
Error in read.tree("ijs.0.023663-0-000.pbm.nwk") : 
  The tree has apparently singleton node(s): cannot read tree file.
  Reading Newick file aborted at tree no. 1
Warning message:
In rm(MyTree) : object 'MyTree' not found
Error in read.tree("ijs.0.02423-0-001.pbm.nwk") : 
  The tree has apparently singleton node(s): cannot read tree file.
  Reading Newick file aborted at tree no. 1
Warning message:
In rm(MyTree) : object 'MyTree' not found
Error in read.tree("ijs.0.024232-0-000.pbm.nwk") : 
  The tree has apparently singleton node(s): cannot read tree file.
  Reading Newick file aborted at tree no. 1
Warning message:
In rm(MyTree) : object 'MyTree' not found
Error in read.tree("ijs.0.024620-0-001.pbm.nwk") : 
  The tree has apparently singleton node(s): cannot read tree file.
  Reading Newick file aborted at tree no. 1
Warning message:
In rm(MyTree) : object 'MyTree' not found
Error in read.tree("ijs.0.024885-0-000.pbm.nwk") : 
  The tree has apparently singleton node(s): cannot read tree file.
  Reading Newick file aborted at tree no. 1
Warning message:
In rm(MyTree) : object 'MyTree' not found
Error in read.tree("ijs.0.025056-0-001.pbm.nwk") : 
  The tree has apparently singleton node(s): cannot read tree file.
  Reading Newick file aborted at tree no. 1
Warning message:
In rm(MyTree) : object 'MyTree' not found
Error in read.tree("ijs.0.025064-0-000.pbm.nwk") : 
  The tree has apparently singleton node(s): cannot read tree file.
  Reading Newick file aborted at tree no. 1
Warning message:
In rm(MyTree) : object 'MyTree' not found
Error in read.tree("ijs.0.025585-0-000.pbm.nwk") : 
  The tree has apparently singleton node(s): cannot read tree file.
  Reading Newick file aborted at tree no. 1
Warning message:
In rm(MyTree) : object 'MyTree' not found
Error in read.tree("ijs.0.025817-0-000.pbm.nwk") : 
  The tree has apparently singleton node(s): cannot read tree file.
  Reading Newick file aborted at tree no. 1
Warning message:
In rm(MyTree) : object 'MyTree' not found
Error in read.tree("ijs.0.025999-0-001.pbm.nwk") : 
  The tree has apparently singleton node(s): cannot read tree file.
  Reading Newick file aborted at tree no. 1
Warning message:
In rm(MyTree) : object 'MyTree' not found
Error in read.tree("ijs.0.026047-0-000.pbm.nwk") : 
  The tree has apparently singleton node(s): cannot read tree file.
  Reading Newick file aborted at tree no. 1
Warning message:
In rm(MyTree) : object 'MyTree' not found
Error in read.tree("ijs.0.02635-0-000.pbm.nwk") : 
  The tree has apparently singleton node(s): cannot read tree file.
  Reading Newick file aborted at tree no. 1
Warning message:
In rm(MyTree) : object 'MyTree' not found
Error in read.tree("ijs.0.026484-0-000.pbm.nwk") : 
  The tree has apparently singleton node(s): cannot read tree file.
  Reading Newick file aborted at tree no. 1
Warning message:
In rm(MyTree) : object 'MyTree' not found
Error in read.tree("ijs.0.026484-0-001.pbm.nwk") : 
  The tree has apparently singleton node(s): cannot read tree file.
  Reading Newick file aborted at tree no. 1
Warning message:
In rm(MyTree) : object 'MyTree' not found
Error in read.tree("ijs.0.026518-0-000.pbm.nwk") : 
  The tree has apparently singleton node(s): cannot read tree file.
  Reading Newick file aborted at tree no. 1
Warning message:
In rm(MyTree) : object 'MyTree' not found
Error in read.tree("ijs.0.026666-0-000.pbm.nwk") : 
  The tree has apparently singleton node(s): cannot read tree file.
  Reading Newick file aborted at tree no. 1
Warning message:
In rm(MyTree) : object 'MyTree' not found
Error in read.tree("ijs.0.026666-0-001.pbm.nwk") : 
  The tree has apparently singleton node(s): cannot read tree file.
  Reading Newick file aborted at tree no. 1
Warning message:
In rm(MyTree) : object 'MyTree' not found
Error in read.tree("ijs.0.026971-0-000.pbm.nwk") : 
  The tree has apparently singleton node(s): cannot read tree file.
  Reading Newick file aborted at tree no. 1
Warning message:
In rm(MyTree) : object 'MyTree' not found
Error in read.tree("ijs.0.027110-0-000.pbm.nwk") : 
  The tree has apparently singleton node(s): cannot read tree file.
  Reading Newick file aborted at tree no. 1
Warning message:
In rm(MyTree) : object 'MyTree' not found
Error in read.tree("ijs.0.027128-0-000.pbm.nwk") : 
  The tree has apparently singleton node(s): cannot read tree file.
  Reading Newick file aborted at tree no. 1
Warning message:
In rm(MyTree) : object 'MyTree' not found
Error in read.tree("ijs.0.02731-0-000.pbm.nwk") : 
  The tree has apparently singleton node(s): cannot read tree file.
  Reading Newick file aborted at tree no. 1
Warning message:
In rm(MyTree) : object 'MyTree' not found
Error in read.tree("ijs.0.027383-0-001.pbm.nwk") : 
  The tree has apparently singleton node(s): cannot read tree file.
  Reading Newick file aborted at tree no. 1
Warning message:
In rm(MyTree) : object 'MyTree' not found
Error in read.tree("ijs.0.027474-0-002.pbm.nwk") : 
  The tree has apparently singleton node(s): cannot read tree file.
  Reading Newick file aborted at tree no. 1
Warning message:
In rm(MyTree) : object 'MyTree' not found
Error in read.tree("ijs.0.02756-0-000.pbm.nwk") : 
  The tree has apparently singleton node(s): cannot read tree file.
  Reading Newick file aborted at tree no. 1
Warning message:
In rm(MyTree) : object 'MyTree' not found
Error in read.tree("ijs.0.02758-0-000.pbm.nwk") : 
  The tree has apparently singleton node(s): cannot read tree file.
  Reading Newick file aborted at tree no. 1
Warning message:
In rm(MyTree) : object 'MyTree' not found
Error in read.tree("ijs.0.02804-0-000.pbm.nwk") : 
  The tree has apparently singleton node(s): cannot read tree file.
  Reading Newick file aborted at tree no. 1
Warning message:
In rm(MyTree) : object 'MyTree' not found
Error in read.tree("ijs.0.02903-0-000.pbm.nwk") : 
  The tree has apparently singleton node(s): cannot read tree file.
  Reading Newick file aborted at tree no. 1
Warning message:
In rm(MyTree) : object 'MyTree' not found
Error in read.tree("ijs.0.029223-0-003.pbm.nwk") : 
  The tree has apparently singleton node(s): cannot read tree file.
  Reading Newick file aborted at tree no. 1
Warning message:
In rm(MyTree) : object 'MyTree' not found
Error in read.tree("ijs.0.029231-0-000.pbm.nwk") : 
  The tree has apparently singleton node(s): cannot read tree file.
  Reading Newick file aborted at tree no. 1
Warning message:
In rm(MyTree) : object 'MyTree' not found
Error in read.tree("ijs.0.02950-0-000.pbm.nwk") : 
  The tree has apparently singleton node(s): cannot read tree file.
  Reading Newick file aborted at tree no. 1
Warning message:
In rm(MyTree) : object 'MyTree' not found
Error in read.tree("ijs.0.02953-0-000.pbm.nwk") : 
  The tree has apparently singleton node(s): cannot read tree file.
  Reading Newick file aborted at tree no. 1
Warning message:
In rm(MyTree) : object 'MyTree' not found
Error in read.tree("ijs.0.2008_001206-0-001.pbm.nwk") : 
  The tree has apparently singleton node(s): cannot read tree file.
  Reading Newick file aborted at tree no. 1
Warning message:
In rm(MyTree) : object 'MyTree' not found
Error in read.tree("ijs.0.63094-0-006.pbm.nwk") : 
  The tree has apparently singleton node(s): cannot read tree file.
  Reading Newick file aborted at tree no. 1
Warning message:
In rm(MyTree) : object 'MyTree' not found
Error in read.tree("ijs.0.63126-0-001.pbm.nwk") : 
  The tree has apparently singleton node(s): cannot read tree file.
  Reading Newick file aborted at tree no. 1
Warning message:
In rm(MyTree) : object 'MyTree' not found
Error in read.tree("ijs.0.63168-0-000.pbm.nwk") : 
  The tree has apparently singleton node(s): cannot read tree file.
  Reading Newick file aborted at tree no. 1
Warning message:
In rm(MyTree) : object 'MyTree' not found
Error in read.tree("ijs.0.63230-0-001.pbm.nwk") : 
  The tree has apparently singleton node(s): cannot read tree file.
  Reading Newick file aborted at tree no. 1
Warning message:
In rm(MyTree) : object 'MyTree' not found
Error in read.tree("ijs.0.63259-0-001.pbm.nwk") : 
  The tree has apparently singleton node(s): cannot read tree file.
  Reading Newick file aborted at tree no. 1
Warning message:
In rm(MyTree) : object 'MyTree' not found
Error in read.tree("ijs.0.63280-0-000.pbm.nwk") : 
  The tree has apparently singleton node(s): cannot read tree file.
  Reading Newick file aborted at tree no. 1
Warning message:
In rm(MyTree) : object 'MyTree' not found
Error in read.tree("ijs.0.63303-0-000.pbm.nwk") : 
  The tree has apparently singleton node(s): cannot read tree file.
  Reading Newick file aborted at tree no. 1
Warning message:
In rm(MyTree) : object 'MyTree' not found
Error in read.tree("ijs.0.63356-0-001.pbm.nwk") : 
  The tree has apparently singleton node(s): cannot read tree file.
  Reading Newick file aborted at tree no. 1
Warning message:
In rm(MyTree) : object 'MyTree' not found
Error in read.tree("ijs.0.63372-0-000.pbm.nwk") : 
  The tree has apparently singleton node(s): cannot read tree file.
  Reading Newick file aborted at tree no. 1
Warning message:
In rm(MyTree) : object 'MyTree' not found
Error in read.tree("ijs.0.63376-0-000.pbm.nwk") : 
  The tree has apparently singleton node(s): cannot read tree file.
  Reading Newick file aborted at tree no. 1
Warning message:
In rm(MyTree) : object 'MyTree' not found
Error in read.tree("ijs.0.63399-0-001.pbm.nwk") : 
  The tree has apparently singleton node(s): cannot read tree file.
  Reading Newick file aborted at tree no. 1
Warning message:
In rm(MyTree) : object 'MyTree' not found
Error in read.tree("ijs.0.63475-0-001.pbm.nwk") : 
  The tree has apparently singleton node(s): cannot read tree file.
  Reading Newick file aborted at tree no. 1
Warning message:
In rm(MyTree) : object 'MyTree' not found
Error in read.tree("ijs.0.63521-0-000.pbm.nwk") : 
  The tree has apparently singleton node(s): cannot read tree file.
  Reading Newick file aborted at tree no. 1
Warning message:
In rm(MyTree) : object 'MyTree' not found
Error in read.tree("ijs.0.63552-0-001.pbm.nwk") : 
  The tree has apparently singleton node(s): cannot read tree file.
  Reading Newick file aborted at tree no. 1
Warning message:
In rm(MyTree) : object 'MyTree' not found
Error in read.tree("ijs.0.63581-0-001.pbm.nwk") : 
  The tree has apparently singleton node(s): cannot read tree file.
  Reading Newick file aborted at tree no. 1
Warning message:
In rm(MyTree) : object 'MyTree' not found
Error in read.tree("ijs.0.63615-0-001.pbm.nwk") : 
  The tree has apparently singleton node(s): cannot read tree file.
  Reading Newick file aborted at tree no. 1
Warning message:
In rm(MyTree) : object 'MyTree' not found
Error in read.tree("ijs.0.63617-0-000.pbm.nwk") : 
  The tree has apparently singleton node(s): cannot read tree file.
  Reading Newick file aborted at tree no. 1
Warning message:
In rm(MyTree) : object 'MyTree' not found
Error in read.tree("ijs.0.63706-0-000.pbm.nwk") : 
  The tree has apparently singleton node(s): cannot read tree file.
  Reading Newick file aborted at tree no. 1
Warning message:
In rm(MyTree) : object 'MyTree' not found
Error in read.tree("ijs.0.63784-0-000.pbm.nwk") : 
  The tree has apparently singleton node(s): cannot read tree file.
  Reading Newick file aborted at tree no. 1
Warning message:
In rm(MyTree) : object 'MyTree' not found
Error in read.tree("ijs.0.63869-0-000.pbm.nwk") : 
  The tree has apparently singleton node(s): cannot read tree file.
  Reading Newick file aborted at tree no. 1
Warning message:
In rm(MyTree) : object 'MyTree' not found
Error in read.tree("ijs.0.63888-0-000.pbm.nwk") : 
  The tree has apparently singleton node(s): cannot read tree file.
  Reading Newick file aborted at tree no. 1
Warning message:
In rm(MyTree) : object 'MyTree' not found
Error in read.tree("ijs.0.63895-0-000.pbm.nwk") : 
  The tree has apparently singleton node(s): cannot read tree file.
  Reading Newick file aborted at tree no. 1
Warning message:
In rm(MyTree) : object 'MyTree' not found
Error in read.tree("ijs.0.64032-0-000.pbm.nwk") : 
  The tree has apparently singleton node(s): cannot read tree file.
  Reading Newick file aborted at tree no. 1
Warning message:
In rm(MyTree) : object 'MyTree' not found
Error in read.tree("ijs.0.64032-0-001.pbm.nwk") : 
  The tree has apparently singleton node(s): cannot read tree file.
  Reading Newick file aborted at tree no. 1
Warning message:
In rm(MyTree) : object 'MyTree' not found
Error in read.tree("ijs.0.64041-0-000.pbm.nwk") : 
  The tree has apparently singleton node(s): cannot read tree file.
  Reading Newick file aborted at tree no. 1
Warning message:
In rm(MyTree) : object 'MyTree' not found
Error in read.tree("ijs.0.64097-0-000.pbm.nwk") : 
  The tree has apparently singleton node(s): cannot read tree file.
  Reading Newick file aborted at tree no. 1
Warning message:
In rm(MyTree) : object 'MyTree' not found
Error in read.tree("ijs.0.64106-0-001.pbm.nwk") : 
  The tree has apparently singleton node(s): cannot read tree file.
  Reading Newick file aborted at tree no. 1
Warning message:
In rm(MyTree) : object 'MyTree' not found
Error in read.tree("ijs.0.64126-0-001.pbm.nwk") : 
  The tree has apparently singleton node(s): cannot read tree file.
  Reading Newick file aborted at tree no. 1
Warning message:
In rm(MyTree) : object 'MyTree' not found
Error in read.tree("ijs.0.64194-0-001.pbm.nwk") : 
  The tree has apparently singleton node(s): cannot read tree file.
  Reading Newick file aborted at tree no. 1
Warning message:
In rm(MyTree) : object 'MyTree' not found
Error in read.tree("ijs.0.64299-0-000.pbm.nwk") : 
  The tree has apparently singleton node(s): cannot read tree file.
  Reading Newick file aborted at tree no. 1
Warning message:
In rm(MyTree) : object 'MyTree' not found
Error in read.tree("ijs.0.64398-0-001.pbm.nwk") : 
  The tree has apparently singleton node(s): cannot read tree file.
  Reading Newick file aborted at tree no. 1
Warning message:
In rm(MyTree) : object 'MyTree' not found
Error in read.tree("ijs.0.64487-0-000.pbm.nwk") : 
  The tree has apparently singleton node(s): cannot read tree file.
  Reading Newick file aborted at tree no. 1
Warning message:
In rm(MyTree) : object 'MyTree' not found
Error in read.tree("ijs.0.64532-0-000.pbm.nwk") : 
  The tree has apparently singleton node(s): cannot read tree file.
  Reading Newick file aborted at tree no. 1
Warning message:
In rm(MyTree) : object 'MyTree' not found
Error in read.tree("ijs.0.64580-0-000.pbm.nwk") : 
  The tree has apparently singleton node(s): cannot read tree file.
  Reading Newick file aborted at tree no. 1
Warning message:
In rm(MyTree) : object 'MyTree' not found
Error in read.tree("ijs.0.64591-0-001.pbm.nwk") : 
  The tree has apparently singleton node(s): cannot read tree file.
  Reading Newick file aborted at tree no. 1
Warning message:
In rm(MyTree) : object 'MyTree' not found
Error in read.tree("ijs.0.64633-0-001.pbm.nwk") : 
  The tree has apparently singleton node(s): cannot read tree file.
  Reading Newick file aborted at tree no. 1
Warning message:
In rm(MyTree) : object 'MyTree' not found
Error in read.tree("ijs.0.64655-0-000.pbm.nwk") : 
  The tree has apparently singleton node(s): cannot read tree file.
  Reading Newick file aborted at tree no. 1
Warning message:
In rm(MyTree) : object 'MyTree' not found
Error in read.tree("ijs.0.64668-0-001.pbm.nwk") : 
  The tree has apparently singleton node(s): cannot read tree file.
  Reading Newick file aborted at tree no. 1
Warning message:
In rm(MyTree) : object 'MyTree' not found
Error in read.tree("ijs.0.64775-0-002.pbm.nwk") : 
  The tree has apparently singleton node(s): cannot read tree file.
  Reading Newick file aborted at tree no. 1
Warning message:
In rm(MyTree) : object 'MyTree' not found
Error in read.tree("ijs.0.64789-0-000.pbm.nwk") : 
  The tree has apparently singleton node(s): cannot read tree file.
  Reading Newick file aborted at tree no. 1
Warning message:
In rm(MyTree) : object 'MyTree' not found
Error in read.tree("ijs.0.64898-0-000.pbm.nwk") : 
  The tree has apparently singleton node(s): cannot read tree file.
  Reading Newick file aborted at tree no. 1
Warning message:
In rm(MyTree) : object 'MyTree' not found
Error in read.tree("ijs.0.64899-0-001.pbm.nwk") : 
  The tree has apparently singleton node(s): cannot read tree file.
  Reading Newick file aborted at tree no. 1
Warning message:
In rm(MyTree) : object 'MyTree' not found
Error in read.tree("ijs.0.64910-0-000.pbm.nwk") : 
  The tree has apparently singleton node(s): cannot read tree file.
  Reading Newick file aborted at tree no. 1
Warning message:
In rm(MyTree) : object 'MyTree' not found
Error in read.tree("ijs.0.64932-0-003.pbm.nwk") : 
  The tree has apparently singleton node(s): cannot read tree file.
  Reading Newick file aborted at tree no. 1
Warning message:
In rm(MyTree) : object 'MyTree' not found
Error in read.tree("ijs.0.64955-0-001.pbm.nwk") : 
  The tree has apparently singleton node(s): cannot read tree file.
  Reading Newick file aborted at tree no. 1
Warning message:
In rm(MyTree) : object 'MyTree' not found
Error in read.tree("ijs.0.64965-0-000.pbm.nwk") : 
  The tree has apparently singleton node(s): cannot read tree file.
  Reading Newick file aborted at tree no. 1
Warning message:
In rm(MyTree) : object 'MyTree' not found
Error in read.tree("ijs.0.64979-0-000.pbm.nwk") : 
  The tree has apparently singleton node(s): cannot read tree file.
  Reading Newick file aborted at tree no. 1
Warning message:
In rm(MyTree) : object 'MyTree' not found
Error in read.tree("ijs.0.64995-0-000.pbm.nwk") : 
  The tree has apparently singleton node(s): cannot read tree file.
  Reading Newick file aborted at tree no. 1
Warning message:
In rm(MyTree) : object 'MyTree' not found
Error in read.tree("ijs.0.65031-0-000.pbm.nwk") : 
  The tree has apparently singleton node(s): cannot read tree file.
  Reading Newick file aborted at tree no. 1
Warning message:
In rm(MyTree) : object 'MyTree' not found
Error in read.tree("ijs.0.65049-0-001.pbm.nwk") : 
  The tree has apparently singleton node(s): cannot read tree file.
  Reading Newick file aborted at tree no. 1
Warning message:
In rm(MyTree) : object 'MyTree' not found
Error in read.tree("ijs.0.65061-0-002.pbm.nwk") : 
  The tree has apparently singleton node(s): cannot read tree file.
  Reading Newick file aborted at tree no. 1
Warning message:
In rm(MyTree) : object 'MyTree' not found
Error in read.tree("ijs.0.65061-0-003.pbm.nwk") : 
  The tree has apparently singleton node(s): cannot read tree file.
  Reading Newick file aborted at tree no. 1
Warning message:
In rm(MyTree) : object 'MyTree' not found
Error in read.tree("ijs.0.65072-0-000.pbm.nwk") : 
  The tree has apparently singleton node(s): cannot read tree file.
  Reading Newick file aborted at tree no. 1
Warning message:
In rm(MyTree) : object 'MyTree' not found
Error in read.tree("ijs.0.65084-0-000.pbm.nwk") : 
  The tree has apparently singleton node(s): cannot read tree file.
  Reading Newick file aborted at tree no. 1
Warning message:
In rm(MyTree) : object 'MyTree' not found
Error in read.tree("ijs.0.65095-0-000.pbm.nwk") : 
  The tree has apparently singleton node(s): cannot read tree file.
  Reading Newick file aborted at tree no. 1
Warning message:
In rm(MyTree) : object 'MyTree' not found
Error in read.tree("ijs.0.65237-0-000.pbm.nwk") : 
  The tree has apparently singleton node(s): cannot read tree file.
  Reading Newick file aborted at tree no. 1
Warning message:
In rm(MyTree) : object 'MyTree' not found
Error in read.tree("ijs.0.65281-0-001.pbm.nwk") : 
  The tree has apparently singleton node(s): cannot read tree file.
  Reading Newick file aborted at tree no. 1
Warning message:
In rm(MyTree) : object 'MyTree' not found
Error in read.tree("ijs.0.65366-0-000.pbm.nwk") : 
  The tree has apparently singleton node(s): cannot read tree file.
  Reading Newick file aborted at tree no. 1
Warning message:
In rm(MyTree) : object 'MyTree' not found
Error in read.tree("ijs.0.65368-0-000.pbm.nwk") : 
  The tree has apparently singleton node(s): cannot read tree file.
  Reading Newick file aborted at tree no. 1
Warning message:
In rm(MyTree) : object 'MyTree' not found
Error in read.tree("ijs.0.65504-0-000.pbm.nwk") : 
  The tree has apparently singleton node(s): cannot read tree file.
  Reading Newick file aborted at tree no. 1
Warning message:
In rm(MyTree) : object 'MyTree' not found
Error in read.tree("ijs.0.65524-0-000.pbm.nwk") : 
  The tree has apparently singleton node(s): cannot read tree file.
  Reading Newick file aborted at tree no. 1
Warning message:
In rm(MyTree) : object 'MyTree' not found
Error in read.tree("ijs.0.65684-0-000.pbm.nwk") : 
  The tree has apparently singleton node(s): cannot read tree file.
  Reading Newick file aborted at tree no. 1
Warning message:
In rm(MyTree) : object 'MyTree' not found
Error in read.tree("ijs.0.65776-0-001.pbm.nwk") : 
  The tree has apparently singleton node(s): cannot read tree file.
  Reading Newick file aborted at tree no. 1
Warning message:
In rm(MyTree) : object 'MyTree' not found
Error in read.tree("ijs.0.65830-0-000.pbm.nwk") : 
  The tree has apparently singleton node(s): cannot read tree file.
  Reading Newick file aborted at tree no. 1
petermr commented 9 years ago

Should all corrupted or missing tips be pruned from the tree? This should be straightforward - if we don't know what the tip is, there is a case for deleting it. The process is recursive - deleting these nodes may lead to new singleton nodes which are also deleted. (A tree with no labels would condense to a single root - a valid mathematical tree but not a valid Newick one).

rossmounce commented 9 years ago

This is another example: (source) https://github.com/ContentMine/phylotree/blob/master/errors/TreeGraph2-validation-tests/ijs.0.000745-0-000.pbm.nwk

((AB188124:307.0,(L33975:213.0,(D16213:114.0,X72724:124.0)NT1.4:33.0)NT1.3:71.0)NT1.2:265.0);

TreeGraph2 is obviously less fussy and can interpret and render this Newick no problemo: https://github.com/ContentMine/phylotree/blob/master/errors/TreeGraph2-validation-tests/ijs.0.000745-0-000.pbm.nwk.svg

R (ape package) throws singleton error. I suspect p4 might be stumbling on this too.

rossmounce commented 9 years ago

Incidentally, the reason I was exploring R is that is one of the obvious alternative options for creating the supertree matrix if STK2/p4 can't do the job. http://www.inside-r.org/packages/cran/phytools/docs/mrp.supertree

rossmounce commented 9 years ago

List so far of options to create MRP matrix:

rossmounce commented 9 years ago

PAUP also thinks there is one too many nodes in these 'singleton node' trees:

paup> gettrees file=pauptree3.tre

Processing TREES block from file "pauptree3.tre":
   Keeping: trees from file (replacing trees in memory)

Error(#616): Tree description invalid (too many nodes).
Error occurred at line 4 of file pauptree3.tre

   *** Error reading treefile
rossmounce commented 9 years ago

Specific description of problem:

It seems like this one will be easy to fix. In all that I've examined so far it's simply a case of one too many parentheses at the deepest root level.

too many parentheses.

e.g. problem: ((A,(B(C,D)))) solution: (A,(B(C,D)))

petermr commented 9 years ago

Do all trees have redundant brackets?

rossmounce commented 9 years ago

No. Just 143 / 297 that I looked at. ...and just to add, the complement of that are valid trees. As validated by R / ape package (fussier than TreeGraph2.

petermr commented 9 years ago

Ross Mounce: Newick 'singleton' problem not a problem now, I think. Seems to just be caused by too many parentheses at the outermost (root) level: https://github.com/ContentMine/phylotree/issues/21#issuecomment-129945961 GitHub Singleton nodes in Newick · Issue #21 · ContentMine/phylotree · GitHub Ross Mounce: I have discovered that some programs don't like "singleton nodes" p4 may also be having this problem so trees like this: ((X76436:483.0,((X60646:436.0,(ABOZ1185:296.0,(D16268:208.0,(A... 5:00 I can easily systematically correct this after it is detected

PMR: Much better for me to edit the code. we should avoid emitting this even though it may be correct Newick. (note the tree has garbled tip label for ABOZ1185), presumably Z->2.

rossmounce commented 9 years ago

yes, better to make sure the program doesn't generate such Newick if possible. In the meantime to test STK and or R I shall correct those 143 with a little bash find replace loop:

while read i ; do sed -i 's/);$/;/g' $i ; sed -i 's/^(//g' $i ; done <listofsingletonnodefiles.txt