Skip to content
This repository was archived by the owner on Dec 3, 2019. It is now read-only.

Commit 2f101a9

Browse files
committed
Merge branch 'development' of https://github.com/revbayes/revbayes into development
2 parents d351525 + 7014414 commit 2f101a9

File tree

7 files changed

+63
-74
lines changed

7 files changed

+63
-74
lines changed

src/core/io/NclReader.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -322,7 +322,7 @@ HomologousDiscreteCharacterData<AminoAcidState>* NclReader::createAminoAcidMatri
322322
aaState.setGapState(true);
323323
// aaState.setState("-");
324324
}
325-
else if (charblock->IsMissingState(origTaxIndex, *cit) == true)
325+
else if ( charblock->IsMissingState(origTaxIndex, *cit) == true || charblock->GetNumStates(origTaxIndex, *cit) >= 20 )
326326
{
327327
// aaState.setState("?");
328328
aaState.setMissingState(true);

src/gui/Source/Window Controllers/WindowControllerTreeViewer.mm

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,9 @@ - (void)awakeFromNib {
4444
//configure carousel
4545
[self.window makeFirstResponder:self.carousel];
4646
[carousel reloadData];
47+
48+
if ([self activeTree] != nil)
49+
[carousel scrollToItemAtIndex:(NSInteger)(0) duration:0.5];
4750

4851
[infoLabel setHidden:YES];
4952
}

src/revlanguage/distributions/phylogenetics/Dist_MPEST.h

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -46,9 +46,9 @@ namespace RevLanguage {
4646

4747
private:
4848

49-
RevPtr<const RevVariable> geneTrees; //!< The population size
50-
RevPtr<const RevVariable> speciesTree; //!< The species tree
51-
RevPtr<const RevVariable> useSpecies; //!< The taxons
49+
RevPtr<const RevVariable> geneTrees; //!< The population size
50+
RevPtr<const RevVariable> speciesTree; //!< The species tree
51+
RevPtr<const RevVariable> useSpecies; //!< The taxons
5252

5353

5454
};

src/revlanguage/distributions/phylogenetics/tree/Dist_BirthDeathMultiRate.h

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -49,12 +49,12 @@ namespace RevLanguage {
4949
RevPtr<const RevVariable> rootAge; //!< The time of the process since the origin
5050
RevPtr<const RevVariable> rho; //!< The sampling probability of a species at present
5151
RevPtr<const RevVariable> condition; //!< The condition of the process (none/survival/#Taxa)
52-
RevPtr<const RevVariable> taxa; //!< The taxon names that will be applied to the initally simulated tree
52+
RevPtr<const RevVariable> taxa; //!< The taxon names that will be applied to the initally simulated tree
5353
RevPtr<const RevVariable> lambda; //!< The speciation rate
5454
RevPtr<const RevVariable> mu; //!< The extinction rate
55-
RevPtr<const RevVariable> Q; //!< The speciation rate
56-
RevPtr<const RevVariable> event_rate; //!< The speciation rate
57-
RevPtr<const RevVariable> pi; //!< The speciation rate
55+
RevPtr<const RevVariable> Q; //!< The rate matrix
56+
RevPtr<const RevVariable> event_rate; //!< The speciation rate
57+
RevPtr<const RevVariable> pi; //!< The stationary frequenies
5858

5959
};
6060

src/revlanguage/distributions/phylogenetics/tree/Dist_ConstrainedNodeOrder.h

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ namespace RevLanguage {
2323
class Dist_ConstrainedNodeOrder : public TypedDistribution<TimeTree> {
2424

2525
public:
26-
Dist_ConstrainedNodeOrder( void );
26+
Dist_ConstrainedNodeOrder(void);
2727

2828
// Basic utility functions
2929
Dist_ConstrainedNodeOrder* clone(void) const; //!< Clone the object
@@ -36,20 +36,16 @@ namespace RevLanguage {
3636

3737

3838
// Distribution functions you have to override
39-
RevBayesCore::NodeOrderConstrainedTreeDistribution* createDistribution(void) const;
39+
RevBayesCore::NodeOrderConstrainedTreeDistribution* createDistribution(void) const;
4040

4141
protected:
42-
4342
void setConstParameter(const std::string& name, const RevPtr<const RevVariable> &var); //!< Set member variable
4443

45-
4644
private:
4745

4846
RevPtr<const RevVariable> baseDistribution;
49-
RevPtr<const RevVariable> constraints; //!< The base tree distribution
50-
47+
RevPtr<const RevVariable> constraints; //!< The base tree distribution
5148
};
52-
5349
}
5450

5551
#endif

src/revlanguage/distributions/phylogenetics/tree/Dist_ConstrainedTopology.cpp

Lines changed: 46 additions & 52 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
#include "Probability.h"
99
#include "Real.h"
1010
#include "RealPos.h"
11+
#include "RlBoolean.h"
1112
#include "RlClade.h"
1213
#include "RlString.h"
1314
#include "RlTaxon.h"
@@ -20,8 +21,7 @@ using namespace RevLanguage;
2021
*
2122
* The default constructor does nothing except allocating the object.
2223
*/
23-
Dist_ConstrainedTopology::Dist_ConstrainedTopology() : TypedDistribution<TimeTree>()
24-
{
24+
Dist_ConstrainedTopology::Dist_ConstrainedTopology() : TypedDistribution<TimeTree>() {
2525

2626
}
2727

@@ -32,8 +32,8 @@ Dist_ConstrainedTopology::Dist_ConstrainedTopology() : TypedDistribution<TimeTre
3232
*
3333
* \return A new copy of the process.
3434
*/
35-
Dist_ConstrainedTopology* Dist_ConstrainedTopology::clone( void ) const
36-
{
35+
Dist_ConstrainedTopology* Dist_ConstrainedTopology::clone( void ) const {
36+
3737
return new Dist_ConstrainedTopology(*this);
3838
}
3939

@@ -48,19 +48,27 @@ Dist_ConstrainedTopology* Dist_ConstrainedTopology::clone( void ) const
4848
*
4949
* \return A new internal distribution object.
5050
*/
51-
RevBayesCore::TopologyConstrainedTreeDistribution* Dist_ConstrainedTopology::createDistribution( void ) const
52-
{
51+
RevBayesCore::TopologyConstrainedTreeDistribution* Dist_ConstrainedTopology::createDistribution( void ) const {
5352

53+
std::cout << "baseDistribution=" << baseDistribution << std::endl;
54+
std::cout << "constraints=" << constraints << std::endl;
55+
std::cout << "backbone=" << backbone << std::endl;
56+
std::cout << "invertConstraint=" << invertConstraint << std::endl;
57+
5458
// get the parameters
55-
const RevBayesCore::RbVector<RevBayesCore::Clade>& c = static_cast<const ModelVector<Clade> &>( constraints->getRevObject() ).getValue();
56-
const Distribution& rlDistribution = static_cast<const Distribution &>( baseDistribution->getRevObject() );
57-
RevBayesCore::TypedDistribution<RevBayesCore::Tree>* base = static_cast<RevBayesCore::TypedDistribution<RevBayesCore::Tree>* >( rlDistribution.createDistribution() );
58-
RevBayesCore::TypedDagNode<RevBayesCore::Tree>* bb = NULL;
59+
const RevBayesCore::RbVector<RevBayesCore::Clade>& c = static_cast<const ModelVector<Clade> &>( constraints->getRevObject() ).getValue();
60+
const Distribution& rlDistribution = static_cast<const Distribution &>( baseDistribution->getRevObject() );
61+
RevBayesCore::TypedDistribution<RevBayesCore::Tree>* base = static_cast<RevBayesCore::TypedDistribution<RevBayesCore::Tree>* >( rlDistribution.createDistribution() );
62+
RevBayesCore::TypedDagNode<RevBayesCore::Tree>* bb = NULL;
5963
if ( backbone != NULL && backbone->getRevObject() != RevNullObject::getInstance() )
60-
{
64+
{
6165
bb = static_cast<const TimeTree &>( backbone->getRevObject() ).getDagNode();
62-
}
66+
}
6367

68+
// SEBASTIAN: Uncomment tne next two lines to see the problem. Because invertConstraint is NULL, we have a problem. Unfortunately, I don't understand
69+
// why invertConstraint is NULL.
70+
//const bool inv = static_cast<const RlBoolean &>( invertConstraint->getRevObject() ).getValue();
71+
//std::cout << "inverse=" << inv << std::endl;
6472

6573
// create the internal distribution object
6674
RevBayesCore::TopologyConstrainedTreeDistribution* d = new RevBayesCore::TopologyConstrainedTreeDistribution(base, c, bb);
@@ -74,11 +82,9 @@ RevBayesCore::TopologyConstrainedTreeDistribution* Dist_ConstrainedTopology::cre
7482
*
7583
* \return The class' name.
7684
*/
77-
const std::string& Dist_ConstrainedTopology::getClassType( void )
78-
{
85+
const std::string& Dist_ConstrainedTopology::getClassType( void ) {
7986

8087
static std::string rev_type = "Dist_ConstrainedTopology";
81-
8288
return rev_type;
8389
}
8490

@@ -88,11 +94,9 @@ const std::string& Dist_ConstrainedTopology::getClassType( void )
8894
*
8995
* \return TypeSpec of this class.
9096
*/
91-
const TypeSpec& Dist_ConstrainedTopology::getClassTypeSpec( void )
92-
{
97+
const TypeSpec& Dist_ConstrainedTopology::getClassTypeSpec( void ) {
9398

9499
static TypeSpec rev_type_spec = TypeSpec( getClassType(), new TypeSpec( TypedDistribution<TimeTree>::getClassTypeSpec() ) );
95-
96100
return rev_type_spec;
97101
}
98102

@@ -102,11 +106,10 @@ const TypeSpec& Dist_ConstrainedTopology::getClassTypeSpec( void )
102106
*
103107
* \return Rev aliases of constructor function.
104108
*/
105-
std::vector<std::string> Dist_ConstrainedTopology::getDistributionFunctionAliases( void ) const
106-
{
109+
std::vector<std::string> Dist_ConstrainedTopology::getDistributionFunctionAliases( void ) const {
110+
107111
// create alternative constructor function names variable that is the same for all instance of this class
108112
std::vector<std::string> a_names;
109-
110113
return a_names;
111114
}
112115

@@ -118,11 +121,10 @@ std::vector<std::string> Dist_ConstrainedTopology::getDistributionFunctionAliase
118121
*
119122
* \return Rev name of constructor function.
120123
*/
121-
std::string Dist_ConstrainedTopology::getDistributionFunctionName( void ) const
122-
{
124+
std::string Dist_ConstrainedTopology::getDistributionFunctionName( void ) const {
125+
123126
// create a distribution name variable that is the same for all instance of this class
124127
std::string d_name = "ConstrainedTopology";
125-
126128
return d_name;
127129
}
128130

@@ -137,26 +139,18 @@ std::string Dist_ConstrainedTopology::getDistributionFunctionName( void ) const
137139
*
138140
* \return The member rules.
139141
*/
140-
const MemberRules& Dist_ConstrainedTopology::getParameterRules(void) const
141-
{
142+
const MemberRules& Dist_ConstrainedTopology::getParameterRules(void) const {
142143

143144
static MemberRules memberRules;
144145
static bool rules_set = false;
145-
146146
if ( !rules_set )
147-
{
148-
147+
{
149148
memberRules.push_back( new ArgumentRule( "treeDistribution", TypedDistribution<TimeTree>::getClassTypeSpec(), "The base distribution for the tree.", ArgumentRule::BY_VALUE, ArgumentRule::ANY ) );
150-
memberRules.push_back( new ArgumentRule( "constraints", ModelVector<Clade>::getClassTypeSpec(), "The topological constraints.", ArgumentRule::BY_VALUE, ArgumentRule::ANY, new ModelVector<Clade>() ) );
151-
152-
// RevBayesCore::Tree* backbonePtr = NULL;
153-
// AbstractModelObject* nullPtr;
154-
// memberRules.push_back( new ArgumentRule( "backbone", TimeTree::getClassTypeSpec(), "The backbone topology.", ArgumentRule::BY_VALUE, ArgumentRule::ANY, new TimeTree(nullPtr) ) );
155-
memberRules.push_back( new ArgumentRule( "backbone", TimeTree::getClassTypeSpec(), "The backbone topology.", ArgumentRule::BY_VALUE, ArgumentRule::ANY, NULL) );
156-
149+
memberRules.push_back( new ArgumentRule( "constraints", ModelVector<Clade>::getClassTypeSpec(), "The topological constraints.", ArgumentRule::BY_VALUE, ArgumentRule::ANY, new ModelVector<Clade>() ) );
150+
memberRules.push_back( new ArgumentRule( "backbone", TimeTree::getClassTypeSpec(), "The backbone topology.", ArgumentRule::BY_VALUE, ArgumentRule::ANY, NULL) );
151+
memberRules.push_back( new ArgumentRule( "inverse", RlBoolean::getClassTypeSpec(), "Should the constraint be inverted?", ArgumentRule::BY_VALUE, ArgumentRule::ANY, new RlBoolean( false ) ) );
157152
rules_set = true;
158-
}
159-
153+
}
160154
return memberRules;
161155
}
162156

@@ -166,11 +160,9 @@ const MemberRules& Dist_ConstrainedTopology::getParameterRules(void) const
166160
*
167161
* \return The type spec of this object.
168162
*/
169-
const TypeSpec& Dist_ConstrainedTopology::getTypeSpec( void ) const
170-
{
163+
const TypeSpec& Dist_ConstrainedTopology::getTypeSpec( void ) const {
171164

172165
static TypeSpec ts = getClassTypeSpec();
173-
174166
return ts;
175167
}
176168

@@ -185,24 +177,26 @@ const TypeSpec& Dist_ConstrainedTopology::getTypeSpec( void ) const
185177
* \param[in] name Name of the member variable.
186178
* \param[in] var Pointer to the variable.
187179
*/
188-
void Dist_ConstrainedTopology::setConstParameter(const std::string& name, const RevPtr<const RevVariable> &var)
189-
{
180+
void Dist_ConstrainedTopology::setConstParameter(const std::string& name, const RevPtr<const RevVariable>& var) {
190181

191182
if ( name == "constraints" )
192-
{
183+
{
193184
constraints = var;
194-
}
185+
}
195186
else if ( name == "treeDistribution" )
196-
{
187+
{
197188
baseDistribution = var;
198-
}
189+
}
199190
else if ( name == "backbone" )
200-
{
191+
{
192+
backbone = var;
193+
}
194+
else if ( name == "inverse" )
195+
{
201196
backbone = var;
202-
}
197+
}
203198
else
204-
{
199+
{
205200
TypedDistribution<TimeTree>::setConstParameter(name, var);
206-
}
207-
201+
}
208202
}

src/revlanguage/distributions/phylogenetics/tree/Dist_ConstrainedTopology.h

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ namespace RevLanguage {
2323
class Dist_ConstrainedTopology : public TypedDistribution<TimeTree> {
2424

2525
public:
26-
Dist_ConstrainedTopology( void );
26+
Dist_ConstrainedTopology(void);
2727

2828
// Basic utility functions
2929
Dist_ConstrainedTopology* clone(void) const; //!< Clone the object
@@ -34,22 +34,18 @@ namespace RevLanguage {
3434
const TypeSpec& getTypeSpec(void) const; //!< Get the type spec of the instance
3535
const MemberRules& getParameterRules(void) const; //!< Get member rules (const)
3636

37-
3837
// Distribution functions you have to override
3938
RevBayesCore::TopologyConstrainedTreeDistribution* createDistribution(void) const;
4039

4140
protected:
42-
43-
void setConstParameter(const std::string& name, const RevPtr<const RevVariable> &var); //!< Set member variable
44-
41+
void setConstParameter(const std::string& name, const RevPtr<const RevVariable>& var); //!< Set member variable
4542

4643
private:
47-
4844
RevPtr<const RevVariable> baseDistribution;
4945
RevPtr<const RevVariable> constraints;
5046
RevPtr<const RevVariable> backbone;
47+
RevPtr<const RevVariable> invertConstraint; //!< Boolean indicating whether topologies are rooted
5148
};
52-
5349
}
5450

5551
#endif

0 commit comments

Comments
 (0)