Okay, I think I'm getting closer. I've edited my PATH global environmental variable to include the proper path the the mrbayes.exe. Additionally, the function specifically calls for the executable to be called "mrbayes" but the newest .zip files comes with "mrbayes_x64" and "mrbayes_x86". I changed the name of "mrbayes_x64" to simply "mrbayes" and tried to run it again. The print is mostly the same as before except mrbayes is definitely called and some additional information is included in the error message:
>Sys.getenv("PATH")
[1] "C:\\Program Files\\R\\R-3.3.2\\bin\\x64;C:\\ProgramData\\Oracle\\Java\\javapath;C:\\WINDOWS\\system32;C:\\WINDOWS;C:\\WINDOWS\\System32\\Wbem;C:\\WINDOWS\\System32\\WindowsPowerShell\\v1.0\\;C:\\Program Files (x86)\\Skype\\Phone\\;C:\\Program Files\\MiKTeX 2.9\\miktex\\bin\\x64\\;C:\\Users\\Gregory\\AppData\\Local\\Microsoft\\WindowsApps;C:\\Users\\Gregory\\Programs\\MrBayes;"
>mrbayes(ips, file = "ips", ngen = 100, run = TRUE)
MrBayes v3.2.6 x64
(Bayesian Analysis of Phylogeny)
Distributed under the GNU General Public License
Type "help" or "help <command>" for information
on the commands that are available.
Type "about" for authorship and general
information about the program.
Executing file "ips.bayes"
Could not open file "ips.bayes"
Error in command "Execute"
Will exit with signal 1 (error) because quitonerror is set to yes
If you want control to be returned to the command line on error,
use 'mb -i <filename>' (i is for interactive) or use 'set quitonerror=no'
Error in file(file, "r") : cannot open the connection
In addition: Warning messages:
1: running command 'mrbayes ips.bayes' had status 1
2: In file(file, "r") :
cannot open file 'ips.con.tre': No such file or directory
The new error is because the file that is written is not named "ips.bayes" but instead is names simply "ips" when written. I manually edited the name of the file to be "ips.bayes" and the MCMCs ran and I got some summary statistics, but there are continued issues with how the written files are named and then called:
Setting sumt filename and outputname to ips
Setting urn-in to 10
Setting sumt contype to Allcompat
Summarizing trees in files "ips.run1.t" and "ips.run2.t"
Using relative burnin ('relburnin=yes'), discarding the first 25 % of sampled trees
Writing statistics to files ips.<parts|tstat|vstat|trprobs|con>
Examining first file ...
Could not open file "ips.run1.t"
Error in command "Sumt"
The error occurred when reading char. 47 on line 41
in the file 'ips.bayes'
Error in command "Execute"
Will exit with signal 1 (error) because quitonerror is set to yes
If you want control to be returned to the command line on error,
use 'mb -i <filename>' (i is for interactive) or use 'set quitonerror=no'
Error in file(file, "r") : cannot open the connection
In addition: Warning messages:
1: running command 'mrbayes ips.bayes' had status 1
2: In file(file, "r") :
cannot open file 'ips.con.tre': No such file or directory
Specifically, the file named "ips.run1.t" cannot be opened because it isn't created, but a file named "ips.bayes.run1.t" is. Again, after manually editing the file names to be what mrbayes expects we can proceed to the end of the analysis without errors:
Calculating tree probabilities...
Credible sets of trees (18 trees sampled):
50 % credible set contains 9 trees
90 % credible set contains 17 trees
95 % credible set contains 18 trees
99 % credible set contains 18 trees
Exiting mrbayes block
Reached end of file
Tasks completed, exiting program because mode is noninteractive
To return control to the command line after completion of file processing,
set mode to interactive with 'mb -i <filename>' (i is for interactive)
or use 'set mode=interactive'
Phylogenetic tree with 26 tips and 24 internal nodes.
Tip labels:
Ips_avulsus, Ips_confusus, Ips_cribricollis, Ips_borealis, Ips_pilifrons, Ips_nitidus, ...
Unrooted; includes branch lengths.
I think the function naming conventions need to be updated so it can write and call files correctly. I've emailed Christoph Heibl regarding this.
I know it is not an answer, but don't run MrBayes on your local machine, except if it is a beast (ho ho). Use CIPRES supercluster which runs MrBayes on 8 cores. It is much faster and cheaper. There is no reason to not use it. The support is excellent and answers within the hour, sometimes.
Those errors look like python code to me. "r" means you open the file for reading. The software cannot find a file
.con.tre, which is a rather strange name. Are you sure that the file argument in this line:mrbayes(ips, file = "", ngen = 100, run = TRUE)has to be empty?UPDATE: the file argument must be included if
run = TRUEbecause the function calls the NEXUS file named viafile =to run the MCMCs.OLD: My understanding is that it does not not have to be empty, but it is empty in the vignette. If I include a
file =name then the block code (parameters and data NEXUS file) are stored as that file name in my directory, which I can successfully view afterwards. However, after the file is written the same error occurs when attempting the MCMCs.Is mrbayes correctly installed = in your PATH variable?
I'm not sure - my suspicion is that R wasn't calling Mr. Bayes properly. How can a check this? And, perhaps more importantly, how can I fix this?