TreeAnnotator: Exception in thread "main" java.lang.NumberFormatException

331 views
Skip to first unread message

Michael

unread,
Sep 12, 2018, 7:47:45 PM9/12/18
to beast-users
Hi all,

I am using BEAST package v1.10.1. I ran the same xml file for 5 times and got 5 replicates. The chain length of each MCMC run is 500,000,000. I used LogCombiner to combine these 5 log and tree files. The state of the combined file is 2,250,250,000. (My another question: Why is it not 500,000,000 * 5 = 2,500,000,000?)

Then I used TreeAnnotator for the combined tree files. My commend was as follows: 

treeannotator -heights median -burnin 225025000 combined.trees MCC.trees

However, I got an error in the first step “Reading trees.“ The error message was:

Reading trees (bar assumes 10,000 trees)...
0              25             50             75            100
|--------------|--------------|--------------|--------------|
******************************************************************************************************************************************************************************************************************************************************************Exception in thread "main" java.lang.NumberFormatException: For input string: "2147500000"
at java.base/java.lang.NumberFormatException.forInputString(NumberFormatException.java:65)
at java.base/java.lang.Integer.parseInt(Integer.java:652)
at java.base/java.lang.Integer.parseInt(Integer.java:770)
at dr.app.tools.TreeAnnotator.<init>(Unknown Source)
at dr.app.tools.TreeAnnotator.main(Unknown Source)

If I set the burnin to 0, then TreeAnnotator worked well. (So, I do not think it was due to not enough memory.) I also tried to set the burnin to different numbers (50000, 214750000, 250000000), but I got the same error message.

Dose anyone know what the problem is and how I can solve this issue?

Best wishes,
Michael

Alexei Drummond

unread,
Sep 12, 2018, 9:10:16 PM9/12/18
to beast...@googlegroups.com
Hey Michael,

(1) You have reached the maximum 32 bit signed integer. Numbers greater than 2,147,483,647 can not be represented by a 32 bit signed integer.

(2) I believe the combined file is 2.25 billion because 10% is removed from each replicate when they are being combined.

(3) I think you can ask LogCombiner to renumber your states so that you don’t have this problem of numerical overflow, but I am not sure about the exact options in BEAST 1.

Cheers
Alexei
> --
> You received this message because you are subscribed to the Google Groups "beast-users" group.
> To unsubscribe from this group and stop receiving emails from it, send an email to beast-users...@googlegroups.com.
> To post to this group, send email to beast...@googlegroups.com.
> Visit this group at https://groups.google.com/group/beast-users.
> For more options, visit https://groups.google.com/d/optout.

Michael

unread,
Sep 13, 2018, 5:45:45 AM9/13/18
to beast-users
Hi Alexei,

Thanks for your swift reply. However, I have some follow-up questions.

(1) You have reached the maximum 32 bit signed integer. Numbers greater than 2,147,483,647 can not be represented by a 32 bit signed integer. 

This makes sense to me, but why did it work if I set burnin to 0 (i.e., not remove burnin)?
However, according to your second command, I think I do not need to remove burnin again because LogCombiner has already done that.

(2) I believe the combined file is 2.25 billion because 10% is removed from each replicate when they are being combined. 

(3) I think you can ask LogCombiner to renumber your states so that you don’t have this problem of numerical overflow, but I am not sure about the exact options in BEAST 1. 

When I used LogCombiner -renumber flag to combine these 5 log/tree files, I got an error message as follows.

My command: logcombiner -renumber 1.log 2.log 3.log 4.log 5.log combined.log

Creating combined log file: 'combined.log'
Renumbering output.

Combining file: '1.log' without removing burnin
Exception in thread "main" java.lang.ArithmeticException: / by zero
at dr.app.tools.LogCombiner.<init>(Unknown Source)
at dr.app.tools.LogCombiner.main(Unknown Source)

I think the error is because LogCombiner tries to divide a number by zero. I suppose this is a bug?
When I changed the first STATE of the first log/tree files from 0 to 1, then it seemed to work well, and I could get the combined log/tree files.

Best wishes,
Michael

Nick Fountain-Jones

unread,
Sep 15, 2018, 9:56:45 AM9/15/18
to beast-users
Hi all,

I'm having the similar problem - anyone any thoughts?

Best,

Nick Fountain-Jones

Michael

unread,
Sep 15, 2018, 11:02:11 AM9/15/18
to beast-users
Hi Nick,

What's the problem you encountered and are you also using BEAST v1.10.1? I kind of know how to deal with it. For LogCombiner, just change the first state of the first log/tree file to 1, then "renumber" works for me. Once the STATE of the tree file doesn't exceed 2,147,483,647, then TreeAnnotator works fine as well.

Best wishes,
Michael

Andrew Rambaut

unread,
Sep 17, 2018, 3:27:22 AM9/17/18
to beast...@googlegroups.com
This bug (not being able to parse state numbers in the trees file if > 2,147,483,647) has been fixed and will be in the next release. If you need to try it out, you can download the GitHub repository and build the executables:

Nick Fountain-Jones

unread,
Sep 18, 2018, 12:12:03 PM9/18/18
to beast-users
Thanks Andrew and Michael - worked fine.

Best,

Nick

Numering didn't 
Reply all
Reply to author
Forward
0 new messages