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

Commit

Permalink
Merge branch 'development' of https://github.com/revbayes/revbayes in…
Browse files Browse the repository at this point in the history
…to development
  • Loading branch information
hoehna committed Mar 7, 2017
2 parents d351525 + 7014414 commit 2f101a9
Show file tree
Hide file tree
Showing 7 changed files with 63 additions and 74 deletions.
2 changes: 1 addition & 1 deletion src/core/io/NclReader.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -322,7 +322,7 @@ HomologousDiscreteCharacterData<AminoAcidState>* NclReader::createAminoAcidMatri
aaState.setGapState(true);
// aaState.setState("-");
}
else if (charblock->IsMissingState(origTaxIndex, *cit) == true)
else if ( charblock->IsMissingState(origTaxIndex, *cit) == true || charblock->GetNumStates(origTaxIndex, *cit) >= 20 )
{
// aaState.setState("?");
aaState.setMissingState(true);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,9 @@ - (void)awakeFromNib {
//configure carousel
[self.window makeFirstResponder:self.carousel];
[carousel reloadData];

if ([self activeTree] != nil)
[carousel scrollToItemAtIndex:(NSInteger)(0) duration:0.5];

[infoLabel setHidden:YES];
}
Expand Down
6 changes: 3 additions & 3 deletions src/revlanguage/distributions/phylogenetics/Dist_MPEST.h
Original file line number Diff line number Diff line change
Expand Up @@ -46,9 +46,9 @@ namespace RevLanguage {

private:

RevPtr<const RevVariable> geneTrees; //!< The population size
RevPtr<const RevVariable> speciesTree; //!< The species tree
RevPtr<const RevVariable> useSpecies; //!< The taxons
RevPtr<const RevVariable> geneTrees; //!< The population size
RevPtr<const RevVariable> speciesTree; //!< The species tree
RevPtr<const RevVariable> useSpecies; //!< The taxons


};
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -49,12 +49,12 @@ namespace RevLanguage {
RevPtr<const RevVariable> rootAge; //!< The time of the process since the origin
RevPtr<const RevVariable> rho; //!< The sampling probability of a species at present
RevPtr<const RevVariable> condition; //!< The condition of the process (none/survival/#Taxa)
RevPtr<const RevVariable> taxa; //!< The taxon names that will be applied to the initally simulated tree
RevPtr<const RevVariable> taxa; //!< The taxon names that will be applied to the initally simulated tree
RevPtr<const RevVariable> lambda; //!< The speciation rate
RevPtr<const RevVariable> mu; //!< The extinction rate
RevPtr<const RevVariable> Q; //!< The speciation rate
RevPtr<const RevVariable> event_rate; //!< The speciation rate
RevPtr<const RevVariable> pi; //!< The speciation rate
RevPtr<const RevVariable> Q; //!< The rate matrix
RevPtr<const RevVariable> event_rate; //!< The speciation rate
RevPtr<const RevVariable> pi; //!< The stationary frequenies

};

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ namespace RevLanguage {
class Dist_ConstrainedNodeOrder : public TypedDistribution<TimeTree> {

public:
Dist_ConstrainedNodeOrder( void );
Dist_ConstrainedNodeOrder(void);

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


// Distribution functions you have to override
RevBayesCore::NodeOrderConstrainedTreeDistribution* createDistribution(void) const;
RevBayesCore::NodeOrderConstrainedTreeDistribution* createDistribution(void) const;

protected:

void setConstParameter(const std::string& name, const RevPtr<const RevVariable> &var); //!< Set member variable


private:

RevPtr<const RevVariable> baseDistribution;
RevPtr<const RevVariable> constraints; //!< The base tree distribution

RevPtr<const RevVariable> constraints; //!< The base tree distribution
};

}

#endif
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
#include "Probability.h"
#include "Real.h"
#include "RealPos.h"
#include "RlBoolean.h"
#include "RlClade.h"
#include "RlString.h"
#include "RlTaxon.h"
Expand All @@ -20,8 +21,7 @@ using namespace RevLanguage;
*
* The default constructor does nothing except allocating the object.
*/
Dist_ConstrainedTopology::Dist_ConstrainedTopology() : TypedDistribution<TimeTree>()
{
Dist_ConstrainedTopology::Dist_ConstrainedTopology() : TypedDistribution<TimeTree>() {

}

Expand All @@ -32,8 +32,8 @@ Dist_ConstrainedTopology::Dist_ConstrainedTopology() : TypedDistribution<TimeTre
*
* \return A new copy of the process.
*/
Dist_ConstrainedTopology* Dist_ConstrainedTopology::clone( void ) const
{
Dist_ConstrainedTopology* Dist_ConstrainedTopology::clone( void ) const {

return new Dist_ConstrainedTopology(*this);
}

Expand All @@ -48,19 +48,27 @@ Dist_ConstrainedTopology* Dist_ConstrainedTopology::clone( void ) const
*
* \return A new internal distribution object.
*/
RevBayesCore::TopologyConstrainedTreeDistribution* Dist_ConstrainedTopology::createDistribution( void ) const
{
RevBayesCore::TopologyConstrainedTreeDistribution* Dist_ConstrainedTopology::createDistribution( void ) const {

std::cout << "baseDistribution=" << baseDistribution << std::endl;
std::cout << "constraints=" << constraints << std::endl;
std::cout << "backbone=" << backbone << std::endl;
std::cout << "invertConstraint=" << invertConstraint << std::endl;

// get the parameters
const RevBayesCore::RbVector<RevBayesCore::Clade>& c = static_cast<const ModelVector<Clade> &>( constraints->getRevObject() ).getValue();
const Distribution& rlDistribution = static_cast<const Distribution &>( baseDistribution->getRevObject() );
RevBayesCore::TypedDistribution<RevBayesCore::Tree>* base = static_cast<RevBayesCore::TypedDistribution<RevBayesCore::Tree>* >( rlDistribution.createDistribution() );
RevBayesCore::TypedDagNode<RevBayesCore::Tree>* bb = NULL;
const RevBayesCore::RbVector<RevBayesCore::Clade>& c = static_cast<const ModelVector<Clade> &>( constraints->getRevObject() ).getValue();
const Distribution& rlDistribution = static_cast<const Distribution &>( baseDistribution->getRevObject() );
RevBayesCore::TypedDistribution<RevBayesCore::Tree>* base = static_cast<RevBayesCore::TypedDistribution<RevBayesCore::Tree>* >( rlDistribution.createDistribution() );
RevBayesCore::TypedDagNode<RevBayesCore::Tree>* bb = NULL;
if ( backbone != NULL && backbone->getRevObject() != RevNullObject::getInstance() )
{
{
bb = static_cast<const TimeTree &>( backbone->getRevObject() ).getDagNode();
}
}

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

// create the internal distribution object
RevBayesCore::TopologyConstrainedTreeDistribution* d = new RevBayesCore::TopologyConstrainedTreeDistribution(base, c, bb);
Expand All @@ -74,11 +82,9 @@ RevBayesCore::TopologyConstrainedTreeDistribution* Dist_ConstrainedTopology::cre
*
* \return The class' name.
*/
const std::string& Dist_ConstrainedTopology::getClassType( void )
{
const std::string& Dist_ConstrainedTopology::getClassType( void ) {

static std::string rev_type = "Dist_ConstrainedTopology";

return rev_type;
}

Expand All @@ -88,11 +94,9 @@ const std::string& Dist_ConstrainedTopology::getClassType( void )
*
* \return TypeSpec of this class.
*/
const TypeSpec& Dist_ConstrainedTopology::getClassTypeSpec( void )
{
const TypeSpec& Dist_ConstrainedTopology::getClassTypeSpec( void ) {

static TypeSpec rev_type_spec = TypeSpec( getClassType(), new TypeSpec( TypedDistribution<TimeTree>::getClassTypeSpec() ) );

return rev_type_spec;
}

Expand All @@ -102,11 +106,10 @@ const TypeSpec& Dist_ConstrainedTopology::getClassTypeSpec( void )
*
* \return Rev aliases of constructor function.
*/
std::vector<std::string> Dist_ConstrainedTopology::getDistributionFunctionAliases( void ) const
{
std::vector<std::string> Dist_ConstrainedTopology::getDistributionFunctionAliases( void ) const {

// create alternative constructor function names variable that is the same for all instance of this class
std::vector<std::string> a_names;

return a_names;
}

Expand All @@ -118,11 +121,10 @@ std::vector<std::string> Dist_ConstrainedTopology::getDistributionFunctionAliase
*
* \return Rev name of constructor function.
*/
std::string Dist_ConstrainedTopology::getDistributionFunctionName( void ) const
{
std::string Dist_ConstrainedTopology::getDistributionFunctionName( void ) const {

// create a distribution name variable that is the same for all instance of this class
std::string d_name = "ConstrainedTopology";

return d_name;
}

Expand All @@ -137,26 +139,18 @@ std::string Dist_ConstrainedTopology::getDistributionFunctionName( void ) const
*
* \return The member rules.
*/
const MemberRules& Dist_ConstrainedTopology::getParameterRules(void) const
{
const MemberRules& Dist_ConstrainedTopology::getParameterRules(void) const {

static MemberRules memberRules;
static bool rules_set = false;

if ( !rules_set )
{

{
memberRules.push_back( new ArgumentRule( "treeDistribution", TypedDistribution<TimeTree>::getClassTypeSpec(), "The base distribution for the tree.", ArgumentRule::BY_VALUE, ArgumentRule::ANY ) );
memberRules.push_back( new ArgumentRule( "constraints", ModelVector<Clade>::getClassTypeSpec(), "The topological constraints.", ArgumentRule::BY_VALUE, ArgumentRule::ANY, new ModelVector<Clade>() ) );

// RevBayesCore::Tree* backbonePtr = NULL;
// AbstractModelObject* nullPtr;
// memberRules.push_back( new ArgumentRule( "backbone", TimeTree::getClassTypeSpec(), "The backbone topology.", ArgumentRule::BY_VALUE, ArgumentRule::ANY, new TimeTree(nullPtr) ) );
memberRules.push_back( new ArgumentRule( "backbone", TimeTree::getClassTypeSpec(), "The backbone topology.", ArgumentRule::BY_VALUE, ArgumentRule::ANY, NULL) );

memberRules.push_back( new ArgumentRule( "constraints", ModelVector<Clade>::getClassTypeSpec(), "The topological constraints.", ArgumentRule::BY_VALUE, ArgumentRule::ANY, new ModelVector<Clade>() ) );
memberRules.push_back( new ArgumentRule( "backbone", TimeTree::getClassTypeSpec(), "The backbone topology.", ArgumentRule::BY_VALUE, ArgumentRule::ANY, NULL) );
memberRules.push_back( new ArgumentRule( "inverse", RlBoolean::getClassTypeSpec(), "Should the constraint be inverted?", ArgumentRule::BY_VALUE, ArgumentRule::ANY, new RlBoolean( false ) ) );
rules_set = true;
}

}
return memberRules;
}

Expand All @@ -166,11 +160,9 @@ const MemberRules& Dist_ConstrainedTopology::getParameterRules(void) const
*
* \return The type spec of this object.
*/
const TypeSpec& Dist_ConstrainedTopology::getTypeSpec( void ) const
{
const TypeSpec& Dist_ConstrainedTopology::getTypeSpec( void ) const {

static TypeSpec ts = getClassTypeSpec();

return ts;
}

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

if ( name == "constraints" )
{
{
constraints = var;
}
}
else if ( name == "treeDistribution" )
{
{
baseDistribution = var;
}
}
else if ( name == "backbone" )
{
{
backbone = var;
}
else if ( name == "inverse" )
{
backbone = var;
}
}
else
{
{
TypedDistribution<TimeTree>::setConstParameter(name, var);
}

}
}
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ namespace RevLanguage {
class Dist_ConstrainedTopology : public TypedDistribution<TimeTree> {

public:
Dist_ConstrainedTopology( void );
Dist_ConstrainedTopology(void);

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


// Distribution functions you have to override
RevBayesCore::TopologyConstrainedTreeDistribution* createDistribution(void) const;

protected:

void setConstParameter(const std::string& name, const RevPtr<const RevVariable> &var); //!< Set member variable

void setConstParameter(const std::string& name, const RevPtr<const RevVariable>& var); //!< Set member variable

private:

RevPtr<const RevVariable> baseDistribution;
RevPtr<const RevVariable> constraints;
RevPtr<const RevVariable> backbone;
RevPtr<const RevVariable> invertConstraint; //!< Boolean indicating whether topologies are rooted
};

}

#endif

0 comments on commit 2f101a9

Please sign in to comment.