Skip to content

Commit

Permalink
commented out broken line in biogeo script (see issue 127 in main repo)
Browse files Browse the repository at this point in the history
  • Loading branch information
bjoelle committed Apr 10, 2024
1 parent d87510d commit 3a1e274
Show file tree
Hide file tree
Showing 11 changed files with 642 additions and 288 deletions.
757 changes: 565 additions & 192 deletions assets/css/main.css

Large diffs are not rendered by default.

33 changes: 1 addition & 32 deletions assets/css/main.css.map

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion developer/implementation/implement_distributions.html
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,7 @@ <h2 id="steps">Steps</h2>

<p>For the Beta Binomial distribution, we navigate to the section in the file with the header ‘Distributions’ and then look for the sub-header dealing with ‘math distributions’. Then, add the following line of code:</p>

<div class="language-cpp highlighter-rouge"><div class="highlight"><pre class="highlight"><code><span class="cp">#include "Dist_betaBinomial.h"
<div class="language-cpp highlighter-rouge"><div class="highlight"><pre class="highlight"><code><span class="cp">#include</span> <span class="cpf">"Dist_betaBinomial.h"</span><span class="cp">
</span></code></pre></div> </div>

<p>This step registers the header file for the beta binomial distribution, effectively adding it to RevBayes.</p>
Expand Down
26 changes: 13 additions & 13 deletions developer/implementation/implement_functions.html
Original file line number Diff line number Diff line change
Expand Up @@ -67,9 +67,9 @@ <h5>Last modified on August 15, 2018</h5>
<div class="language-cpp highlighter-rouge"><div class="highlight"><pre class="highlight"><code><span class="cp">#ifndef HyperbolicCosineFunction_h
#define HyperbolicCosineFunction_h
</span>
<span class="cp">#include "ContinuousFunction.h"
#include "TypedDagNode.h"
#include &lt;cmath&gt;
<span class="cp">#include</span> <span class="cpf">"ContinuousFunction.h"</span><span class="cp">
#include</span> <span class="cpf">"TypedDagNode.h"</span><span class="cp">
#include</span> <span class="cpf">&lt;cmath&gt;</span><span class="cp">
</span>
<span class="k">namespace</span> <span class="n">RevBayesCore</span> <span class="p">{</span>
<span class="cm">/**
Expand Down Expand Up @@ -106,7 +106,7 @@ <h5>Last modified on August 15, 2018</h5>
Next, after including the necessary header files, we have to ensure that our new function is included within the <code class="language-plaintext highlighter-rouge">RevBayesCore</code> namespace.
Here we are implementing our hyperbolic cosine function as its own class that is derived from the continuous function class that is derived from the typed function class. This class stores the hyperbolic cosine of a value that is held in a DAG node. We have also defined a clone method which can create a clone of our class, and an update method which will update the value of our Hyperbolic Cosine class whenever the value of the DAG node changes. Now we will move on to the <code class="language-plaintext highlighter-rouge">HyperbolicCosineFunction.cpp</code> file.</p>

<div class="language-cpp highlighter-rouge"><div class="highlight"><pre class="highlight"><code><span class="cp">#include "HyperbolicCosineFunction.h"
<div class="language-cpp highlighter-rouge"><div class="highlight"><pre class="highlight"><code><span class="cp">#include</span> <span class="cpf">"HyperbolicCosineFunction.h"</span><span class="cp">
</span>
<span class="k">using</span> <span class="k">namespace</span> <span class="n">RevBayesCore</span><span class="p">;</span>

Expand Down Expand Up @@ -152,10 +152,10 @@ <h5>Last modified on August 15, 2018</h5>
<span class="cp">#ifndef Func_hyperbolicCosine_h
#define Func_hyperbolicCosine_h
</span>
<span class="cp">#include "Real.h"
#include "RlTypedFunction.h"
<span class="cp">#include</span> <span class="cpf">"Real.h"</span><span class="cp">
#include</span> <span class="cpf">"RlTypedFunction.h"</span><span class="cp">
</span>
<span class="cp">#include &lt;string&gt;
<span class="cp">#include</span> <span class="cpf">&lt;string&gt;</span><span class="cp">
</span>
<span class="k">namespace</span> <span class="n">RevLanguage</span> <span class="p">{</span>

Expand Down Expand Up @@ -199,12 +199,12 @@ <h5>Last modified on August 15, 2018</h5>

<p>And the <code class="language-plaintext highlighter-rouge">Func_hyperbolicCosine.cpp</code> should look like this:</p>

<div class="language-cpp highlighter-rouge"><div class="highlight"><pre class="highlight"><code><span class="cp">#include "Func_hyperbolicCosine.h"
#include "HyperbolicCosineFunction.h"
#include "Probability.h"
#include "Real.h"
#include "RlDeterministicNode.h"
#include "TypedDagNode.h"
<div class="language-cpp highlighter-rouge"><div class="highlight"><pre class="highlight"><code><span class="cp">#include</span> <span class="cpf">"Func_hyperbolicCosine.h"</span><span class="cp">
#include</span> <span class="cpf">"HyperbolicCosineFunction.h"</span><span class="cp">
#include</span> <span class="cpf">"Probability.h"</span><span class="cp">
#include</span> <span class="cpf">"Real.h"</span><span class="cp">
#include</span> <span class="cpf">"RlDeterministicNode.h"</span><span class="cp">
#include</span> <span class="cpf">"TypedDagNode.h"</span><span class="cp">
</span>
<span class="k">using</span> <span class="k">namespace</span> <span class="n">RevLanguage</span><span class="p">;</span>

Expand Down
38 changes: 19 additions & 19 deletions developer/implementation/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -77,9 +77,9 @@ <h2>Overview</h2>
<div class="language-cpp highlighter-rouge"><div class="highlight"><pre class="highlight"><code><span class="cp">#ifndef HyperbolicCosineFunction_h
#define HyperbolicCosineFunction_h
</span>
<span class="cp">#include "ContinuousFunction.h"
#include "TypedDagNode.h"
#include &lt;cmath&gt;
<span class="cp">#include</span> <span class="cpf">"ContinuousFunction.h"</span><span class="cp">
#include</span> <span class="cpf">"TypedDagNode.h"</span><span class="cp">
#include</span> <span class="cpf">&lt;cmath&gt;</span><span class="cp">
</span>
<span class="k">namespace</span> <span class="n">RevBayesCore</span> <span class="p">{</span>
<span class="cm">/**
Expand Down Expand Up @@ -116,7 +116,7 @@ <h2>Overview</h2>
Next, after including the necessary header files, we have to ensure that our new function is included within the <code class="language-plaintext highlighter-rouge">RevBayesCore</code> namespace.
Here we are implementing our hyperbolic cosine function as its own class that is derived from the continuous function class that is derived from the typed function class. This class stores the hyperbolic cosine of a value that is held in a DAG node. We have also defined a clone method which can create a clone of our class, and an update method which will update the value of our Hyperbolic Cosine class whenever the value of the DAG node changes. Now we will move on to the <code class="language-plaintext highlighter-rouge">HyperbolicCosineFunction.cpp</code> file.</p>

<div class="language-cpp highlighter-rouge"><div class="highlight"><pre class="highlight"><code><span class="cp">#include "HyperbolicCosineFunction.h"
<div class="language-cpp highlighter-rouge"><div class="highlight"><pre class="highlight"><code><span class="cp">#include</span> <span class="cpf">"HyperbolicCosineFunction.h"</span><span class="cp">
</span>
<span class="k">using</span> <span class="k">namespace</span> <span class="n">RevBayesCore</span><span class="p">;</span>

Expand Down Expand Up @@ -162,10 +162,10 @@ <h2>Overview</h2>
<span class="cp">#ifndef Func_hyperbolicCosine_h
#define Func_hyperbolicCosine_h
</span>
<span class="cp">#include "Real.h"
#include "RlTypedFunction.h"
<span class="cp">#include</span> <span class="cpf">"Real.h"</span><span class="cp">
#include</span> <span class="cpf">"RlTypedFunction.h"</span><span class="cp">
</span>
<span class="cp">#include &lt;string&gt;
<span class="cp">#include</span> <span class="cpf">&lt;string&gt;</span><span class="cp">
</span>
<span class="k">namespace</span> <span class="n">RevLanguage</span> <span class="p">{</span>

Expand Down Expand Up @@ -209,12 +209,12 @@ <h2>Overview</h2>

<p>And the <code class="language-plaintext highlighter-rouge">Func_hyperbolicCosine.cpp</code> should look like this:</p>

<div class="language-cpp highlighter-rouge"><div class="highlight"><pre class="highlight"><code><span class="cp">#include "Func_hyperbolicCosine.h"
#include "HyperbolicCosineFunction.h"
#include "Probability.h"
#include "Real.h"
#include "RlDeterministicNode.h"
#include "TypedDagNode.h"
<div class="language-cpp highlighter-rouge"><div class="highlight"><pre class="highlight"><code><span class="cp">#include</span> <span class="cpf">"Func_hyperbolicCosine.h"</span><span class="cp">
#include</span> <span class="cpf">"HyperbolicCosineFunction.h"</span><span class="cp">
#include</span> <span class="cpf">"Probability.h"</span><span class="cp">
#include</span> <span class="cpf">"Real.h"</span><span class="cp">
#include</span> <span class="cpf">"RlDeterministicNode.h"</span><span class="cp">
#include</span> <span class="cpf">"TypedDagNode.h"</span><span class="cp">
</span>
<span class="k">using</span> <span class="k">namespace</span> <span class="n">RevLanguage</span><span class="p">;</span>

Expand Down Expand Up @@ -317,7 +317,7 @@ <h2 id="general-info-before-getting-started">General info before getting started
All mathematical distributions that have been implemented exist in <code class="language-plaintext highlighter-rouge">core/distributions/math</code>.</p>
</li>
<li>
<p>Note that when implementing a new distribution, you will need to create <code class="language-plaintext highlighter-rouge">.cpp</code> and <code class="language-plaintext highlighter-rouge">.h</code> files in both the <strong>revlanguage</strong> directory and the <strong>core</strong> directory. (For a refresher on the difference between these two directories, refer to the {% page_ref architecture %} section of this Developer’s guide).
<p>Note that when implementing a new distribution, you will need to create <code class="language-plaintext highlighter-rouge">.cpp</code> and <code class="language-plaintext highlighter-rouge">.h</code> files in both the <strong>revlanguage</strong> directory and the <strong>core</strong> directory. (For a refresher on the difference between these two directories, refer to the <a href="/developer/architecture/">Getting familiar with the code</a> section of this Developer’s guide).
The overall naming format remains the same for every distribution in RevBayes. In the Beta Binomial Distribution example provided below, I specify what naming convention to use when creating each file.</p>
</li>
<li>
Expand All @@ -332,7 +332,7 @@ <h2 id="general-info-before-getting-started">General info before getting started
<p>Within every new distribution, you will need to include some functions. For example, each new distribution must have: the get class type, name, and help functions. You may not need to implement these from scratch (if they’re dictated by the parent class &amp; are already present), but you will need to implement other functions within your distribution (e.g. cdf, rv, quantile).</p>
</li>
<li>
<p>Distributions have a prefix <code class="language-plaintext highlighter-rouge">DN</code> (dag node), and all moves have a prefix <code class="language-plaintext highlighter-rouge">MV</code>. RevBayes takes the name within &amp; creates the <code class="language-plaintext highlighter-rouge">DN</code> automatically, so be aware of this. For a refresher on DAG nodes, refer to {% page_ref architecture %}.</p>
<p>Distributions have a prefix <code class="language-plaintext highlighter-rouge">DN</code> (dag node), and all moves have a prefix <code class="language-plaintext highlighter-rouge">MV</code>. RevBayes takes the name within &amp; creates the <code class="language-plaintext highlighter-rouge">DN</code> automatically, so be aware of this. For a refresher on DAG nodes, refer to <a href="/developer/architecture/">Getting familiar with the code</a>.</p>
</li>
</ul>

Expand Down Expand Up @@ -376,7 +376,7 @@ <h2 id="steps">Steps</h2>

<p>For the Beta Binomial distribution, we navigate to the section in the file with the header ‘Distributions’ and then look for the sub-header dealing with ‘math distributions’. Then, add the following line of code:</p>

<div class="language-cpp highlighter-rouge"><div class="highlight"><pre class="highlight"><code><span class="cp">#include "Dist_betaBinomial.h"
<div class="language-cpp highlighter-rouge"><div class="highlight"><pre class="highlight"><code><span class="cp">#include</span> <span class="cpf">"Dist_betaBinomial.h"</span><span class="cp">
</span></code></pre></div> </div>

<p>This step registers the header file for the beta binomial distribution, effectively adding it to RevBayes.</p>
Expand All @@ -397,18 +397,18 @@ <h2 id="steps">Steps</h2>

<p>There are multiple ways to do this. As a best practice, you should first compile it to ensure there are no errors. Once it compiles with no problems, you can test in various ways (e.g. run each individual function within the new Beta Binomial distribution in R, then run the Binomial distribution with a Beta prior in Rev and see if the output matches). For more information, see the developer tutorials on <a href="../validation/">validation</a> and testing. (TODO)</p>

<p>After ensuring your code runs properly, you are ready to add it to the git repo. We recommend reading through the {% page_ref git-flow %} section of the Developer’s guide before pushing.</p>
<p>After ensuring your code runs properly, you are ready to add it to the git repo. We recommend reading through the <a href="/developer/git-flow.html">RevBayes Git Workflow</a> section of the Developer’s guide before pushing.</p>
</li>
</ol>

<p class="section maintitle" id="implement_moves">Implementing a Metropolis-Hastings Move</p>
<h2 id="general-info-before-getting-started-1">General info before getting started</h2>
<h2 id="general-info-before-getting-started">General info before getting started</h2>

<p>The steps to implementing a new move vary slightly, depending on the move’s type (e.g., Metropolis-Hastings versus Gibbs). For the purpose of this guide, we will focus on a Metropolis-Hastings move.</p>

<p>In general, the fastest and easiest way to get help is to find the most similar move already implemented in RevBayes and use it as a guide. Remember that, as with implementing a new distribution or function, you’ll need to add relevant code to both the core of RevBayes and the language. Also remember that you’ll need to work out the math appropriate for your move (e.g., the Hastings ratio) ahead of time.</p>

<h2 id="steps-1">Steps</h2>
<h2 id="steps">Steps</h2>

<ol>
<li>
Expand Down
4 changes: 2 additions & 2 deletions developer/setup/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ <h2 id="getting-revbayes-working">Getting RevBayes working</h2>
<p class="section maintitle" id="eclipse">Setting up Eclipse for RevBayes development</p>
<p>Eclipse is a Java-based, cross-platform IDE with lots of nice features that make it convenient for RevBayes development. First, it’s cross-platform, and unlike Xcode, you can use any compiler you like (not just <code class="language-plaintext highlighter-rouge">clang</code>).</p>

<h2 id="prerequisites-1">Prerequisites</h2>
<h2 id="prerequisites">Prerequisites</h2>
<ul>
<li>To compile RevBayes using Eclipse, you must install <a href="https://cmake.org/install/">CMake</a> and its <a href="https://stackoverflow.com/questions/30668601/installing-cmake-command-line-tools-on-a-mac">command line tools</a>. This is very easy if you have <a href="https://brew.sh/">homebrew</a> installed (<code class="language-plaintext highlighter-rouge">brew install cmake</code>)</li>
<li>You must also have a C++ compiler. If you are using a Mac, you can use <code class="language-plaintext highlighter-rouge">clang</code> (included with <a href="https://developer.apple.com/xcode/">XCode</a>), or you can install <a href="https://gcc.gnu.org/"><code class="language-plaintext highlighter-rouge">gcc</code></a> (e.g. via homebrew <code class="language-plaintext highlighter-rouge">brew install gcc</code>).</li>
Expand Down Expand Up @@ -264,7 +264,7 @@ <h3 id="check-c-language-options">Check C++ language options</h3>

<h2 id="set-up-the-xcode-project-with-an-external-build-system">Set up the XCode Project with an external build system</h2>

<h3 id="prerequisites-2">Prerequisites</h3>
<h3 id="prerequisites-1">Prerequisites</h3>

<ul>
<li>To compile RevBayes using Xcode, first install <a href="CMake">https://cmake.org/</a> and its <a href="command line tools">https://stackoverflow.com/questions/30668601/installing-cmake-command-line-tools-on-a-mac</a>. This is easily done using <a href="homebrew">https://brew.sh/</a> by running <code class="language-plaintext highlighter-rouge">brew install cmake</code> in terminal.</li>
Expand Down
13 changes: 6 additions & 7 deletions tutorials/biogeo/scripts/make_anc_state.Rev
Original file line number Diff line number Diff line change
Expand Up @@ -42,13 +42,12 @@ anc_states_stoch_map = readAncestralStateTrace(out_stoch_fn)


# make summary tree
char_map_tree = characterMapTree(tree=mcc_tree,
ancestral_state_trace_vector=anc_states_stoch_map,
character_file=out_str+".char.map.tre",
posterior_file=out_str+".pp.map.tre",
burnin=0.25,
num_time_slices=500)

# char_map_tree = characterMapTree(tree=mcc_tree,
# ancestral_state_trace_vector=anc_states_stoch_map,
# character_file=out_str+".char.map.tre",
# posterior_file=out_str+".pp.map.tre",
# burnin=0.25,
# num_time_slices=500)

# exit RevBayes
quit()
5 changes: 3 additions & 2 deletions tutorials/model_selection_bayes_factors/bf_intro.html
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@
<h1 class="maintitle">General Introduction to Model selection</h1>
<h3 class="subtitle">Comparing relative model fit with Bayes factors</h3>
<h4 class="authors">Sebastian Höhna, Michael J Landis, Tracy A Heath and Brian R Moore</h4>
<h5>Last modified on September 12, 2019</h5>
<h5>Last modified on April 5, 2024</h5>
</div>


Expand Down Expand Up @@ -328,7 +328,8 @@ <h2 class="section" id="estimating-the-marginal-likelihood">Estimating the Margi
model here. Our main motivation is to show that the marginal likelihood
estimation algorithms are independent of the model. Thus, you can apply
these algorithms to any model, <em>e.g.</em>, relaxed
clock models and birth-death models, as well.</p>
clock models and birth-death models, as well.
For a more concrete example including data and Rev script, please see the follow-up tutorial <a href="/tutorials/model_selection_bayes_factors/bf_subst_model.html">Model selection of common substitution models for one locus</a>.</p>

<h2 class="section" id="computing-bayes-factors-and-model-selection">Computing Bayes Factors and Model Selection</h2>
<hr class="section" />
Expand Down
12 changes: 1 addition & 11 deletions tutorials/model_selection_bayes_factors/bf_partition_model.html
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@
<h1 class="maintitle">Model selection of partition models</h1>
<h3 class="subtitle">Comparing relative model fit with Bayes factors</h3>
<h4 class="authors">Mike May and Sebastian Höhna</h4>
<h5>Last modified on September 12, 2019</h5>
<h5>Last modified on April 9, 2024</h5>
</div>


Expand Down Expand Up @@ -103,14 +103,6 @@ <h2>Data files and scripts</h2>

<li><a href="/tutorials/model_selection_bayes_factors/data/fagus_rbcL.nex">fagus_rbcL.nex</a></li>

<li><a href="/tutorials/model_selection_bayes_factors/data/sim_locus1.nex">sim_locus1.nex</a></li>

<li><a href="/tutorials/model_selection_bayes_factors/data/sim_locus2.nex">sim_locus2.nex</a></li>

<li><a href="/tutorials/model_selection_bayes_factors/data/sim_locus3.nex">sim_locus3.nex</a></li>

<li><a href="/tutorials/model_selection_bayes_factors/data/sim_locus4.nex">sim_locus4.nex</a></li>

</ul>


Expand All @@ -129,8 +121,6 @@ <h2>Data files and scripts</h2>

<li><a href="/tutorials/model_selection_bayes_factors/scripts/marginal_likelihood_partition_5.Rev">marginal_likelihood_partition_5.Rev</a></li>

<li><a href="/tutorials/model_selection_bayes_factors/scripts/ml_Partition_model.Bodega.Rev">ml_Partition_model.Bodega.Rev</a></li>

</ul>

</blockquote>
Expand Down
Loading

0 comments on commit 3a1e274

Please sign in to comment.