dosreislab / mcmc3r

mcmc3r: an R package for MCMCTree
MIT License
2 stars 2 forks source link

Possible issue with PAML version #6

Closed jferrerobiol closed 5 years ago

jferrerobiol commented 5 years ago

Hi Mario,

I am really excited to use your mcmc3r package for marginal likelihood estimation with MCMCTree but I am having issues to run MCMCTree when the line BayesFactorBeta = 1e-300 (or other values) is added by the function mcmc3r::make.bfctlf(b, ctlf="mcmc3r_UCE_sel1.ctl", betaf="beta.txt"). When taking this line out the program runs fine. I guess that the version of PAML that I am using is too old (paml version 4.9, March 2015 installed through conda). I also tried to install the latest version available for mac in http://abacus.gene.ucl.ac.uk/software/paml.html#download but it was still older.

Which version of PAML and from where should I install it from to be able to run the marginal likelihood estimation properly?

Thank you very much for your help and apologize for the inconvenience. Joan

mariodosreis commented 5 years ago

Dear Joan,

The mcmc3r package was tested with MCMCTree 4.9f. It should also work with later versions (i.e. 4.9g, 4.9h, etc.).

Best,

Mario dos Reis

Lecturer @ QMUL dosreis.github.io

On 3 Jun 2019, at 20:46, jferrerobiol notifications@github.com wrote:

Hi Mario,

I am really excited to use your mcmc3r package for marginal likelihood estimation with MCMCTree but I am having issues to run MCMCTree when the line BayesFactorBeta = 1e-300 (or other values) is added by the function mcmc3r::make.bfctlf(b, ctlf="mcmc3r_UCE_sel1.ctl", betaf="beta.txt"). When taking this line out the program runs fine. I guess that the version of PAML that I am using is too old (paml version 4.9, March 2015 installed through conda). I also tried to install the latest version available for mac in http://abacus.gene.ucl.ac.uk/software/paml.html#download http://abacus.gene.ucl.ac.uk/software/paml.html#download but it was still older.

Which version of PAML and from where should I install it from to be able to run the marginal likelihood estimation properly?

Thank you very much for your help and apologize for the inconvenience. Joan

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/dosreislab/mcmc3r/issues/6?email_source=notifications&email_token=ACWTQEZFGNFTDPSWWYHM5ETPYVYKRA5CNFSM4HSQC2EKYY3PNVWWK3TUL52HS4DFUVEXG43VMWVGG33NNVSW45C7NFSM4GXLX4ZQ, or mute the thread https://github.com/notifications/unsubscribe-auth/ACWTQE6UGMWSLD4O4Y3CC4TPYVYKRANCNFSM4HSQC2EA.

jferrerobiol commented 5 years ago

Dear Mario,

Thanks for your fast answer. I have now installed the version 4.9i in both my mac laptop and my cluster and I am still not able to run it due to a segmentation fault:

MCMCTREE in paml version 4.9i, September 2018

Reading options from mcmc3r_UCE_sel1.ctl.. Reading master tree. (((((((ACar1, ACre1), AGra1), AGri1), ATen1), (ABul1, APac1)), (CLeu1, (CEdw1, (CDio1, CBor1)))), (PNat1, ((PHut1, PGav1), ((PEle1, ((POpi1, PNNe1), ((PBDi1, PBNi1), PBBa1))), ((PPuf1, (PMau1, PYel1)), (PLLh1, (PLBo1, PLBa1))))))); Segmentation fault: 11

Do you have any thoughts about what may be wrong?

I also tried with the example ape4s data and I get the same error.

Thank you very much for your help.

Joan

mariodosreis commented 5 years ago

Dear Joan,

I suggest you first try running the tutorial (https://dosreislab.github.io/2017/10/24/marginal-likelihood-mcmc3r.html) exactly as given. If you still get segmentation faults with MCMCTree, then you will need to report this to Ziheng Yang, as this is an MCMCTree rather than an mcmc3r issue.

If you submit a bug report to Ziheng Yang please send him a full set of files so that he can reproduce the error, together with a description of the computer hardware and operating system where you got the crash. See for example,

https://www.softwaretestinghelp.com/how-to-write-good-bug-report/

Best, M.

sabifo4 commented 5 years ago

Dear Joan,

I would like to first double check the file architecture that you have, so maybe we can spot the issue and see if it has to do with the directories set up by mcmc3r or when running MCMCtree.

Let's assume that your working directory is called mcmctree_BF. Inside this directory, you should have the control file for MCMCtree, e.g., mcmctree.ctl. Note that this file does not contain the BayesFactorBeta line. Also, you should have specified in your control file RootAge = 'B(0.999,1.001)'. This is because, as detailed in the tutorial "Estimating the marginal likelihood of a relaxed-clock model with MCMCTree", "our interest is to select the relaxed-clock model and not to estimate absolute divergence times". Therefore, we fix the age of the root to one and this is the notation used in MCMCtree for that purpose. Now, your directory before running mcmc3r should look like this:

mcmctree_BF
          |- mcmctree.ctl

Then, in your R script, you should run the code detailed in the tutorial. For instance:

# Set working directory
wd <- "path_to_wd/mcmctree_BF"
setwd( wd )

# Create directories with mcmc3r 
b = mcmc3r::make.beta( n = 16, method = c( "step-stones" ), a = 5 )
mcmc3r::make.bfctlf( b, ctlf = "mcmctree.ctl", betaf = "betaweights.txt" )

Now, your directory should like this:

mcmctree_BF
          |- 1
      |  |- mcmctree.ctl 
          |- 2
      |  |- mcmctree.ctl 
          |- 3
      |  |- mcmctree.ctl 
          |- 4
      |  |- mcmctree.ctl 
          |- 5
      |  |- mcmctree.ctl 
          |- 6
      |  |- mcmctree.ctl 
          |- 7
      |  |- mcmctree.ctl 
          |- 8
      |  |- mcmctree.ctl 
          |- 9
      |  |- mcmctree.ctl 
          |- 10
      |  |- mcmctree.ctl 
          |- 11
      |  |- mcmctree.ctl 
          |- 12 
      |  |- mcmctree.ctl 
          |- 13
      |  |- mcmctree.ctl 
          |- 14
      |  |- mcmctree.ctl 
          |- 15           
      |  |- mcmctree.ctl 
          |- 16 
      |  |- mcmctree.ctl 
      |
          |- mcmctree.ctl
          |- betaweights.txt 

Make sure that now you link or copy your alignment files and tree files to each of the [1-16] directories and you set the correct path to these files in each of the control files that now you will see inside each of the [1-16] directories.

Then, if you are running MCMCtree in the cluster, you can run everything as a job array. You might have a flag to set how many times the script should run (e.g., for this example, there are 16 beta values, so a flag like this #$ -t 1-16. Note that this might be different in your cluster). Let's suppose that the variable that will take values from 1 to 16 is called $SGE_TASK_ID (as mentioned before, you might have a different name for this variable in your cluster). Then, you can just set your working directory to mcmctree_BF and run the dating software as:

# Move to directory 1-16 inside your working directory. 
# $SGE_TASK_ID will take values from 1 to 16
cd mcmctree_BF/$SGE_TASK_ID 

# Assuming you have previously set the path to where you have 
# MCMCtree in the cluster as a variable you call $bin...
$bin/paml4.9i/bin/mcmctree *.ctl

If this is not working, then you should submit a bug report to Ziheng Yang as previously stated by Mario.

Hope this works!

Sandra

jferrerobiol commented 5 years ago

Dear Mario and Sandra,

Thank you very much for your rapid answers and suggestions!

Finally, I could find out what mcmctree was not happy with. It was the way to specify the root age. When I changed the treefile from:

4 1 (((Hsap, Hnea), Ptro), Ggor)'B(0.999,1.001)'; to 4 1 (((Hsap, Hnea), Ptro), Ggor)'>.999<1.001';

it worked just fine, I could go through the whole mcmc3r tutorial and it worked also fine with my data.

Thank you very much for your help! All the best,

Joan I guess the newest version of mcmctree doesn't accept the 'B(0.999,1.001)' anymore?

sabifo4 commented 5 years ago

Dear Joan,

glad to see you could find where the error was and that you can run now MCMCtree without problems! :) I will now close this issue as the problem had to do with the newest version of MCMCtree and not with the mcmc3r R package. Nevertheless, I would suggest you send a bug report to Ziheng Yang about MCMCtree not being able to deal with the notation for soft bounds in the newest version. You can also post this issue at the google group "PAML discussion group" :)

Best wishes, Sandra