revbayes / revbayes.github.io

https://revbayes.github.io
7 stars 11 forks source link

Error in tutorial #1

Closed dschrempf closed 6 years ago

dschrempf commented 6 years ago

The script revbayes.github.io/tutorials/biogeo/scripts/run_epoch_phy.Rev throws the following error:

RevBayes version (1.0.9)
Build from development (6d8432) on Wed Aug 15 15:17:14 CEST 2018

Visit the website www.RevBayes.com for more information about RevBayes.

RevBayes is free software released under the GPL license, version 3. Type 'license()' for details.

To quit RevBayes type 'quit()' or 'q()'.

> source("run_epoch_phy.Rev")
   Processing file "run_epoch_phy.Rev"
   Successfully read one character matrix from file 'data/n6/silversword.mol.nex'
   Successfully read one character matrix from file 'data/n6/silversword.n6.range.nex'
   Attempting to read the contents of file "silversword.tre"
   Successfully read file Error:    Argument or label mismatch for function call.
   Provided call:
   dnPhyloCTMCClado (TimeTree<stochastic> 'tree',
                     RateGenerator<deterministic> 'Q',
                     CladogeneticProbabilityMatrix<deterministic> 'cladoProbs',
                     RealPos<deterministic> 'branchRates',
                     RealPos[]<constant> 'rootFrequencies',
                     String<constant> 'type',
                     Natural<constant> 'nSites' )

   Correct usage is:
   dnPhyloCTMCClado (Tree<any> tree,
                     RateGenerator|RateGenerator[]<any> Q,
                     CladogeneticProbabilityMatrix|CladogeneticProbabilityMatrix[]<deterministic> cladoProbs,
                     Simplex<any> rootFrequencies,
                     RealPos|RealPos[]<any> branchRates,
                     RealPos[]<any> siteRates,
                     Probability<any> pInv,
                     Natural<any> nSites,
                     String<any> type {valid options: "DNA"|"RNA"|"AA"|"Pomo"|"Protein"|"Standard"|"NaturalNumbers"},
                     Bool<any> treatAmbiguousAsGap,
                     Bool<any> storeInternalNodes,
                     Bool<any> gapMatchClamped)
   Error:   Problem processing line 231 in file "run_epoch_phy.Rev"

EDIT: The exact call triggering the error is:

m_bg ~ dnPhyloCTMCClado(tree=tree,
                           Q=Q_DEC_epoch,
                           cladoProbs=P_DEC,
                           branchRates=rate_bg,
                           rootFrequencies=rf_DEC,
                           type="NaturalNumbers",
                           nSites=1)

It seems that the simplex function is not changing the type of the variable.

> rf_DEC    <- rep(0, n_states)
> str(rf_DEC)

   _variable     = rf_DEC
   _RevType      = Natural[]
   _value        = [ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
   _dagType      = Constant DAG node
   _children     = [  ]

> rf_DEC[n_areas+1] <- 1  # Mainland (Z) is the only possible starting state
> str(rf_DEC)

   _variable     = rf_DEC
   _RevType      = Natural[]
   _value        = [ 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
   _dagNode      = rf_DEC
   _dagType      = Deterministic Rev function node
   _function     = v(Natural<any> , Natural ...)
   _parents      = [ rf_DEC[1], rf_DEC[2], rf_DEC[3], rf_DEC[4],
                     rf_DEC[5], rf_DEC[6], rf_DEC[7], rf_DEC[8],
                     rf_DEC[9], rf_DEC[10], rf_DEC[11], rf_DEC[12],
                     rf_DEC[13], rf_DEC[14], rf_DEC[15], rf_DEC[16],
                     rf_DEC[17], rf_DEC[18], rf_DEC[19], rf_DEC[20],
                     rf_DEC[21], rf_DEC[22] ]
   _children     = [  ]

> rf_DEC    <- simplex(rf_DEC)
> str(rf_DEC)

   _variable     = rf_DEC
   _RevType      = RealPos[]
   _value        = [ 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 1.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000,
   0.000, 0.000 ]
   _dagType      = Constant DAG node
   _children     = [  ]
mlandis commented 6 years ago

Many thanks for reporting the problem and for sharing your efforts debugging. The tutorial file for run_epoch_phy.Rev is now correct. The other three biogeography scripts were not affected.