Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

revgadget issue for "Environmental-dependent Speciation & Extinction Rates" #31

Open
claudiavaga opened this issue Sep 26, 2024 · 0 comments

Comments

@claudiavaga
Copy link

claudiavaga commented Sep 26, 2024

Dear all,

I am trying to use RevGadget to plot the results of the Environmental-dependent Speciation & Extinction Rates analyses.
The original code in the tutorial is the following:

library(RevGadgets)
tree <- read.tree("data/primates.tre")

the CO2 values as a reference in our plot
co2 <- c(297.6, 301.36, 304.84, 307.86, 310.36, 312.53, 314.48, 316.31, 317.42, 317.63, 317.74, 318.51, 318.29, 316.5, 315.49, 317.64, 318.61, 316.6, 317.77, 328.27, 351.12, 381.87, 415.47, 446.86, 478.31, 513.77, 550.74, 586.68, 631.48, 684.13, 725.83, 757.81, 789.39, 813.79, 824.25, 812.6, 784.79, 755.25, 738.41, 727.53, 710.48, 693.55, 683.04, 683.99, 690.93, 694.44, 701.62, 718.05, 731.95, 731.56, 717.76)

MAX_VAR_AGE = 50
NUM_INTERVALS = length(co2)
co2_age <- MAX_VAR_AGE * (1:NUM_INTERVALS) / NUM_INTERVALS
predictor.ages <- co2_age
predictor.var <- co2

rev_out <- rev.process.div.rates(speciation_times_file = "output/primates_EBD_Corr_speciation_times.log",
speciation_rates_file = "output/primates_EBD_Corr_speciation_rates.log",
extinction_times_file = "output/primates_EBD_Corr_extinction_times.log",
extinction_rates_file = "output/primates_EBD_Corr_extinction_rates.log",
tree=tree,
burnin=0.25,numIntervals=100)
pdf("EBD_Corr.pdf")
par(mfrow=c(2,2))
rev.plot.div.rates(rev_out, predictor.ages=co2_age, predictor.var=co2, use.geoscale=TRUE)
dev.off()

Which I tried to modify (following the current version of the RevGadget function to plot branch data) into this:

library(RevGadgets)
tree <- read.tree("291species-50p-sclera.newick.tre")

temp <- c(11.44, 16.94, 20.62, 23.60, 23.78, 24.06, 22.07, 23.44, 23.40, 26.08, 28.03, 26.99, 32.28, 33.59, 25.60, 28.85, 24.51, 28.13, 31.42, 32.26, 35.56, 34.14, 26.01, 32.00, 30.52, 27.27, 28.25, 27.00, 27.27, 24.47, 23.88, 20.11, 17.77, 21.39, 23.20, 26.37, 24.10, 25.06, 22.32, 25.02, 23.43, 19.18, 25.82, 28.50, 18.02, 22.19, 18.68, 13.50, 18.70, 20.76, 20.80, 20.25, 16.55, 14.46, 18.09, 14.08, 12.02, 12.83, 21.75, 23.76, 27.91, 25.67, 22.49, 25.29, 28.81, 33.25, 34.05, 25.60, 20.97, 19.90, 24.36, 19.48, 20.80, 27.85, 27.31, 31.00, 30.90, 31.53, 32.10)

MAX_VAR_AGE = 482
NUM_INTERVALS = length(temp)
temp_age <- MAX_VAR_AGE * (1:NUM_INTERVALS) / NUM_INTERVALS
predictor.ages <- temp_age
predictor.var <- temp

speciation_time_file <- "scleractinia_temp_corr_speciation_times.log"
speciation_rate_file <- "scleractinia_temp_corr_speciation_rates.log"
extinction_time_file <- "scleractinia_temp_corr_extinction_times.log"
extinction_rate_file <- "scleractinia_temp_corr_extinction_rates.log"

rates <- processDivRates(speciation_time_log = speciation_time_file,
speciation_rate_log = speciation_rate_file,
extinction_time_log = extinction_time_file,
extinction_rate_log = extinction_rate_file,
tree=tree,
burnin=0.25,numIntervals=100)

pdf("sclera_temp_corr.pdf")
par(mfrow=c(2,2))
plotDivRates(rates, predictor.ages=temp_age, predictor.var=temp, use.geoscale=TRUE)
dev.off()

However, I am running into this error:

plotDivRates(rates, predictor.ages=temp_age, predictor.var=temp, use.geoscale=TRUE)
Error in plotDivRates(rates, predictor.ages = temp_age, predictor.var = temp, :
unused arguments (predictor.ages = temp_age, predictor.var = temp, use.geoscale = TRUE)

Error in processDivRates(speciation_time_log = speciation_time_file, speciation_rate_log = speciation_rate_file, :
unused argument (tree = tree)

Can anyone help me figure out how to troubleshoot this code?

Thanks in advance for the help!
Claudia

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant