GithubHelp home page GithubHelp logo

bayou's Introduction

This is the development version of the R package bayou. bayou fits Bayesian reversible-jump multi-optima OU models to phylogenetic comparative data.

Please report any bugs or issues, as this package is currently under development.

Install using the devtools package.

install.packages("devtools")
require(devtools)
install_github("uyedaj/bayou")
require(bayou)

A tutorial is available at:

https://github.com/uyedaj/bayou/blob/master/tutorial.md

The manuscript describing the method can be found at:

https://doi.org/10.1093/sysbio/syu057

Click for logo inspiration

bayou's People

Contributors

caetanods avatar jeroen avatar macroevolab avatar uyedaj avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

bayou's Issues

ERROR IN BAYOU.MCMC: error: matrix multiplication: incompatible matrix dimensions: 74x15 and 1x1 Error in C_weightmatrix(cache, pars) : matrix multiplication: incompatible matrix dimensions: 74x15 and 1x1

Hello,

Thanks in advance for any help and thank you for your awesome tutorial on using this package.

I was using an older version of bayou (1.1.0) earlier today and I got it to run smoothly with no problems. I then realized I was missing a lot of the functions in the documentation so I updated to the most recent version on GitHub (v 2.1). Now I am unable to get the bayou.mcmc function to work like I did earlier.

Using my data and following along with the tutorial you provided, I keep getting this error message when running bayou.mcmc:

fit1 <- bayou.mcmc(bulb_size_tree, bulb_size.vector, SE = SE, model = "OU", prior, new.dir=getwd(), ngen = 10000)
error: matrix multiplication: incompatible matrix dimensions: 74x15 and 1x1
Error in C_weightmatrix(cache, pars) :
matrix multiplication: incompatible matrix dimensions: 74x15 and 1x1

The prior and SE are the same as in the tutorial.

Any suggestions would be appreciated. Thanks for your time.

Thanks
Cody Coyotee

Convergent evolution

Hi,

Is there a way to fit a model where the same theta has multiple origins?

As far as I know It is posible to have two different theta (two different parameters) that have approximately the same value.
But I would like to know where or not it is possible that the same theta (one parameter) with multiple origins in the phylogeny.

Thanks!
Marcial

Error is thrown with zero length branches

If zero length branches are used then the following error gets thrown when executing a slide move on the zero length branch:

Error in if (m.i - 1 == 1) { : argument is of length zero

Error in if (runif(1) < exp(nll - oll + pr2 - pr1 + hr)) { :
missing value where TRUE/FALSE needed

Error with plot functions bayou package

Hi,

I have the following error when using plotSimmap.mcmc(), plotBranchHeatMap() and phenogram.density(). This is my code:

plotSimmap.mcmc(chainOU, burnin = 0.3, lwd = 2, edge.type = "theta", pal = rainbow, pp.cutoff = 0.3)
plotBranchHeatMap(formTree, chainOU, "theta", burnin = 0.3, pal = cm.colors)
phenogram.density(formTree, p50, burnin = 0.3, chainOU, pp.cutoff = 0.3)

And the error:

Error in plotSimmap(x, ...) : unused arguments (edge.color = .colorRamp(allbranches, pal, 100), use.edge.length = F)

I am not sure where is the cause, could you be so kind to help me?

Thank you in advance,

Pablo

bayou2OUwie error

Hello,

I have successfully run bayou and now would like to export that information into an acceptable OUwie format. I am using the bayou2OUwie function. I have pars directed to the saved bayou run so that it can locate sb, loc and t2. I have the tree I used for the bayou run, and the tip data are in a named vector sorted in the same order at the tree labels.

I receive the following error:

> bayou2OUwie(chain.fit, fit.tree, fit.sorted2)
Error in table(pars$sb) : all arguments must have the same length

I have checked and all lists have 150001 items.

> length(chain.fit$sb)
[1] 150001
> length(chain.fit$loc)
[1] 150001
> length(chain.fit$t2)
[1] 150001

The number of tips in the tree match the number of rows for the tip data.

I cannot figure out why I am getting this error.

I am using bayou v2.1.1, R version 3.5.2.

Any advice appreciated. Thanks for this package!

Cody Coyotee

Prob of shift proportional to branch length maybe broke on dev version?

Runs that previously worked on the CRAN version of bayou are no longer working for me on the dev version. These runs use the probability of a shift proportional branch length prior outlined in some of the documentation. The runs work for a few generations, but ultimately crash. For instance,

prior2 <- make.prior(prunedMBC, dists=list(dalpha="dhalfcauchy", dsig2="dhalfcauchy",dsb="dsb", dk="cdpois", dtheta="dnorm"), param=list(dalpha=list(scale=1), dsig2=list(scale=1), dk=list(lambda=15, kmax=200), dsb=list(bmax=Inf,prob=prunedMBC$edge.length), dtheta=list(mean=mean(avMBC), sd=2)))

mcmc2 <- bayou.makeMCMC(prunedMBC, avMBC, SE=cvMBC, model="OU", prior=prior2, new.dir=TRUE, samp=10^2, chunk=10^3, ticker.freq=10^4, plot.freq=NULL)

system.time(mcmc2$run(ngen=10^7))

returns

Error in sample.int(x, size, replace, prob) : NA in probability vector
Calls: system.time ... .proposalFn -> .moveFn -> .sample -> sample -> sample.int
Timing stopped at: 2099.404 15.264 2117.245

Perhaps something needs to get fixed with this model on the dev version? Or, perhaps I've misspecified something in the code (entirely possible).

Can not install on mac

I tried to install it using devtools but was not able to get it.
Loading required package: bayou
Warning message:
In library(package, lib.loc = lib.loc, character.only = TRUE, logical.return = TRUE, :
there is no package called ‘bayou’

Loading a saved BAYOU run

Hello,

I have to run a large number of runs to reach sufficient ES values. However, when I try to save the data either as an Rdata file or with 'saveRDS = T', I cannot reload the data for later analysis. It would be nice to be able to run these analyses and analyze them at a later time. Perhaps this is already implemented but I cannot figure out how if it is possible.

The errors I receive.
`

test <- load.bayou(file = "BAYOU/bayou.chain.rds")
Error in load.bayou(file = "BAYOU/bayou.chain.rds") :
argument "bayouFit" is missing, with no default

test2 <- load("BAYOU/bayou.chain.rds")
Error: bad restore file magic number (file may be corrupted) -- no data loaded
In addition: Warning message:
file ‘bayou.chain.rds’ has magic number 'X'
Use of save versions prior to 2 is deprecated
`

Thanks for any advice on this.

Thanks,
Cody

Tutorial does not reflect updates

Currently, it looks like the tutorial does not function, because the package was updated to use a new 'bayou.makeMCMC'.

From what I can tell, this function does not actually start the MCMC sampler, nor is there any obvious documentation on how to do so.

Closing unused connections

If a bayou run is interrupted, these warnings show up. I need to make a way so that runs that are interrupted still produce a fit object that can be loaded, even if the run didn't finish, and the file connections get closed (like diversitree does)

After read the bayou/tutorial.md, i still don't know how to set the parameters?

I hope I can follow the pipeline of the Current Biology paper "Tempo and Pattern of Avian Brain Size Evolution" to analyze my data, but after reading the tutorial.md and methods in the paper, I still don't know how to set the parameters. The methods in paper are as follows,
"We implemented this approach by combining 10 parallel chains of 2 million iterations each with a burn-in proportion of 0.3. We allowed only one shift per branch and the total number of shifts was constrained by means of a conditional Poisson prior with a mean equal to 2.5% of the total number of branches in the tree and a maximum number of shifts equal to 5%. Starting points for MCMC chains were set by randomly drawing a number of shifts from the prior distribution and assigning these shifts to branches randomly drawn from the phylogeny with a probability proportional to the size of the clade descended from that branch. The MCMC was initialized without any birth-death proposals for the first 10,000 generations to improve the fit of the model."

I don't know how to run "combining 10 parallel chains of 2 million iterations with a burin-in proportion of 0.3", and don't know how to set the parameters "We allowed only one shift per branch", also don't how to run "The MCMC was initialized without any birth-death proposals for the first 10,000 generations to improve the fit of the model." Could you me?

Quick fix: parallel for steppingstone

I could pull, fix, merge, etc., but it's two lines of code:
Add
if(parallel){
doParallel::registerDoParallel()
}

to the start of the steppingstone function. Should re-enable parallelization, which otherwise doesn't work on my machine.

Error in mcmcOU$run:Error in summary.connection(x) : invalid connection

Hi!
I am using bayou for my dataset, and thanks for providing such a nice tutorial. Till the following step everything is running well.

mcmcOU <- bayou.makeMCMC(WGDTree, WGDdata, SE=0, prior=priorOU,
new.dir="modelOU/", outname="modelOU_r001", plot.freq=NULL)

However, I am getting error when I am trying to run mcmcOU$run(10000). It is throwing an error like the follows.

Error in summary.connection(x) : invalid connection
In addition: Warning messages:
1: In .Internal(gc(verbose, reset, full)) :
closing unused connection 7 (modelOU//modelOU_r001.rjpars)
2: In .Internal(gc(verbose, reset, full)) :
closing unused connection 6 (modelOU//modelOU_r001.pars)
3: In .Internal(gc(verbose, reset, full)) :
closing unused connection 5 (modelOU//modelOU_r001.t2)
4: In .Internal(gc(verbose, reset, full)) :
closing unused connection 4 (modelOU//modelOU_r001.loc)
5: In .Internal(gc(verbose, reset, full)) :
closing unused connection 3 (modelOU//modelOU_r001.sb)

Any help in this regard is highly appreciated. Thanks in advance for your help and time.

Regards,
Tina

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.