Giter Site home page Giter Site logo

dsilvestro / pyrate Goto Github PK

View Code? Open in Web Editor NEW
74.0 17.0 32.0 57.21 MB

PyRate is a program to estimate speciation, extinction, and preservation rates from fossil occurrence data using a Bayesian framework.

License: GNU Affero General Public License v3.0

Python 97.41% R 1.72% C++ 0.71% Shell 0.09% SWIG 0.06%
macroevolution paleontology extinction bayesian-inference

pyrate's People

Contributors

bmchorse avatar buffan3369 avatar carlosp420 avatar dsilvestro avatar meyerx avatar ohagen avatar schnitzler-j avatar thauffe avatar xavmeyer avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  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  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

pyrate's Issues

Error in compiling FastPyRateC library

Hello!

I am trying to compile and install the FastPyRateC library on a Mac (M1 chip).
At the "compile the library" step, I get the following errors:

FastPyRateC.cpp:8:10: fatal error: 'boost/math/distributions.hpp' file not found #include <boost/math/distributions.hpp> ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 1 error generated. error: command '/usr/bin/clang' failed with exit code 1 Lauras-MacBook-Pro-6:ModulePyrateC lauravanholstein$ python3 setup.py build FastPyRateC.cpp:8:10: fatal error: 'boost/math/distributions.hpp' file not found #include <boost/math/distributions.hpp> ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 1 error generated. error: command '/usr/bin/clang' failed with exit code 1 Lauras-MacBook-Pro-6:ModulePyrateC lauravanholstein$ cd /Users/lauravanholstein/PyRate/PyRate-master/pyrate_lib/fastPyRateC/ModulePyrateC Lauras-MacBook-Pro-6:ModulePyrateC lauravanholstein$ mv boost_1_77_0/boost usage: mv [-f | -i | -n] [-hv] source target mv [-f | -i | -n] [-v] source ... directory Lauras-MacBook-Pro-6:ModulePyrateC lauravanholstein$ rm -r boost_1_77_0 Lauras-MacBook-Pro-6:ModulePyrateC lauravanholstein$ swig -c++ -python FastPyRateC.i Lauras-MacBook-Pro-6:ModulePyrateC lauravanholstein$ xcode-select --install xcode-select: error: command line tools are already installed, use "Software Update" in System Settings to install updates Lauras-MacBook-Pro-6:ModulePyrateC lauravanholstein$ python setup.py build -bash: python: command not found Lauras-MacBook-Pro-6:ModulePyrateC lauravanholstein$ python3 setup.py build In file included from FastPyRateC.cpp:8: In file included from ./boost/math/distributions.hpp:15: In file included from ./boost/math/distributions/arcsine.hpp:35: In file included from ./boost/math/constants/constants.hpp:14: In file included from ./boost/math/tools/convert_from_string.hpp:14: In file included from ./boost/math/tools/lexical_cast.hpp:12: In file included from ./boost/lexical_cast.hpp:32: In file included from ./boost/lexical_cast/try_lexical_convert.hpp:44: In file included from ./boost/lexical_cast/detail/converter_lexical.hpp:54: ./boost/lexical_cast/detail/converter_lexical_streams.hpp:285:21: warning: 'sprintf' is deprecated: This function is provided for compatibility reasons only. Due to security concerns inherent in the design of sprintf(3), it is highly recommended that you use snprintf(3) instead. [-Wdeprecated-declarations] sprintf(begin, ^ /Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include/stdio.h:188:1: note: 'sprintf' has been explicitly marked deprecated here __deprecated_msg("This function is provided for compatibility reasons only. Due to security concerns inherent in the design of sprintf(3), it is highly recommended that you use snprintf(3) instead.") ^ /Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include/sys/cdefs.h:215:48: note: expanded from macro '__deprecated_msg' #define __deprecated_msg(_msg) __attribute__((__deprecated__(_msg))) ^ In file included from FastPyRateC.cpp:8: In file included from ./boost/math/distributions.hpp:15: In file included from ./boost/math/distributions/arcsine.hpp:35: In file included from ./boost/math/constants/constants.hpp:14: In file included from ./boost/math/tools/convert_from_string.hpp:14: In file included from ./boost/math/tools/lexical_cast.hpp:12: In file included from ./boost/lexical_cast.hpp:32: In file included from ./boost/lexical_cast/try_lexical_convert.hpp:44: In file included from ./boost/lexical_cast/detail/converter_lexical.hpp:54: ./boost/lexical_cast/detail/converter_lexical_streams.hpp:297:21: warning: 'sprintf' is deprecated: This function is provided for compatibility reasons only. Due to security concerns inherent in the design of sprintf(3), it is highly recommended that you use snprintf(3) instead. [-Wdeprecated-declarations] sprintf(begin, ^ /Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include/stdio.h:188:1: note: 'sprintf' has been explicitly marked deprecated here __deprecated_msg("This function is provided for compatibility reasons only. Due to security concerns inherent in the design of sprintf(3), it is highly recommended that you use snprintf(3) instead.") ^ /Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include/sys/cdefs.h:215:48: note: expanded from macro '__deprecated_msg' #define __deprecated_msg(_msg) __attribute__((__deprecated__(_msg))) ^ In file included from FastPyRateC.cpp:8: In file included from ./boost/math/distributions.hpp:15: In file included from ./boost/math/distributions/arcsine.hpp:35: In file included from ./boost/math/constants/constants.hpp:14: In file included from ./boost/math/tools/convert_from_string.hpp:14: In file included from ./boost/math/tools/lexical_cast.hpp:12: In file included from ./boost/lexical_cast.hpp:32: In file included from ./boost/lexical_cast/try_lexical_convert.hpp:44: In file included from ./boost/lexical_cast/detail/converter_lexical.hpp:54: ./boost/lexical_cast/detail/converter_lexical_streams.hpp:310:21: warning: 'sprintf' is deprecated: This function is provided for compatibility reasons only. Due to security concerns inherent in the design of sprintf(3), it is highly recommended that you use snprintf(3) instead. [-Wdeprecated-declarations] sprintf(begin, ^ /Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include/stdio.h:188:1: note: 'sprintf' has been explicitly marked deprecated here __deprecated_msg("This function is provided for compatibility reasons only. Due to security concerns inherent in the design of sprintf(3), it is highly recommended that you use snprintf(3) instead.") ^ /Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include/sys/cdefs.h:215:48: note: expanded from macro '__deprecated_msg' #define __deprecated_msg(_msg) __attribute__((__deprecated__(_msg))) ^ 3 warnings generated. FastPyRateC_wrap.cxx:4177:11: warning: 'sprintf' is deprecated: This function is provided for compatibility reasons only. Due to security concerns inherent in the design of sprintf(3), it is highly recommended that you use snprintf(3) instead. [-Wdeprecated-declarations] sprintf(msg, "attempt to assign sequence of size %lu to extended slice of size %lu", (unsigned long)is.size(), (unsigned long)replacecount); ^ /Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include/stdio.h:188:1: note: 'sprintf' has been explicitly marked deprecated here __deprecated_msg("This function is provided for compatibility reasons only. Due to security concerns inherent in the design of sprintf(3), it is highly recommended that you use snprintf(3) instead.") ^ /Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include/sys/cdefs.h:215:48: note: expanded from macro '__deprecated_msg' #define __deprecated_msg(_msg) __attribute__((__deprecated__(_msg))) ^ FastPyRateC_wrap.cxx:4193:9: warning: 'sprintf' is deprecated: This function is provided for compatibility reasons only. Due to security concerns inherent in the design of sprintf(3), it is highly recommended that you use snprintf(3) instead. [-Wdeprecated-declarations] sprintf(msg, "attempt to assign sequence of size %lu to extended slice of size %lu", (unsigned long)is.size(), (unsigned long)replacecount); ^ /Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include/stdio.h:188:1: note: 'sprintf' has been explicitly marked deprecated here __deprecated_msg("This function is provided for compatibility reasons only. Due to security concerns inherent in the design of sprintf(3), it is highly recommended that you use snprintf(3) instead.") ^ /Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include/sys/cdefs.h:215:48: note: expanded from macro '__deprecated_msg' #define __deprecated_msg(_msg) __attribute__((__deprecated__(_msg))) ^ FastPyRateC_wrap.cxx:4533:2: warning: 'sprintf' is deprecated: This function is provided for compatibility reasons only. Due to security concerns inherent in the design of sprintf(3), it is highly recommended that you use snprintf(3) instead. [-Wdeprecated-declarations] sprintf(msg, "in sequence element %d ", (int)_index); ^ /Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include/stdio.h:188:1: note: 'sprintf' has been explicitly marked deprecated here __deprecated_msg("This function is provided for compatibility reasons only. Due to security concerns inherent in the design of sprintf(3), it is highly recommended that you use snprintf(3) instead.") ^ /Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include/sys/cdefs.h:215:48: note: expanded from macro '__deprecated_msg' #define __deprecated_msg(_msg) __attribute__((__deprecated__(_msg))) ^ 3 warnings generated.

Any help would be appreciated!
Many thanks,
Laura

IndexError when parsing predictor variables for PyRateMBD

I previously ran PyRateMBD with the time column counting down (e.g. 55, 54, 53...), but it appears from the tutorial and the variable trajectories obtained by plotting that time should instead be counting up (0, 1, 2...).

However, when I corrected my predictor files to do so (very small -n for testing), I get the following error:

error

Here is the example format of one of the predictor files, with middle data stripped out for brevity:

time	artiodactyla
0	130
1	121
2	124
3	115
...	...
51	10.5
52	11

Module FastPyRateC is not found on Linux (was working previously)

On Linux, FastPyRateC is not found upon using python PyRate/PyRate.py -v.

Version info:
PyRate v2.0 - 20170811
Linux 2.6.32-696.18.7.e16.x86_64
Python version 2.7.13 (Anaconda distribution)

This is on a high-performance computing cluster. The PyRate folder I am using is up-to-date with master on this repository, and is a submodule of my own project's repository. Previously, using the same project repository and on the same cluster, FastPyRateC was found without issues.

In contrast, the same command successfully loads FastPyRateC on my local machine (Windows 10). Again, this is the exact same file structure since the same project repository is synced to my computer.

I will look into the parts of PyRate.py where FastPyRateC is checked for and loaded to see if I can figure out why it's currently not working but wanted to raise an issue in case anyone else has the chance first.

Error when running PPModelTest

Hi!

I'm getting an error when running the PPModelTest command from the PyRate tutorial. The full command and the resulting error is below. It looks like it might be a small issue with a deprecated numpy command?

Best,
Mareike

python ~/software/PyRate/PyRate.py ~/software/PyRate/example_files/Canis_example/Canis_pbdb_data_PyRate.py -qShift ~/software/PyRate/example_files/epochs_q.txt -PPmodeltest

             PyRate - v3.0 - 20201021

      Bayesian estimation of origination,
       extinction and preservation rates
          from fossil occurrence data

             [email protected]

Module FastPyRateC was loaded.

Canis_pbdb_data_PyRate ['/home/users/mjaniak/software/PyRate/example_files/Canis_example/Canis_pbdb_data_PyRate.py']

The analysis includes 18 species (0 were excluded)
[5.333, 2.58, 0.0117] 10.193827 0.0
Using Gamma priors on the birth-death rates (G_l[1.1,1.1], G_m[1.1,1.1]).

('Using', 5, 'species for model testing')
('HPP* max likelihood:', -352.1902730582955, 'q rate:', array([5.945]))
('TPP* max likelihood:', -271.04259368721006, 'q rates:', array([ 0.761, 4.542, 14.06 , 0.914]))
('NHPP* max likelihood:', array([-563.947]), 'q rate:', array([5.447]), '\n')
/home/users/mjaniak/software/PyRate/pyrate_lib/PPmodeltest.py:244: VisibleDeprecationWarning: Creating an ndarray from ragged nested sequences (which is a list-or-tuple of lists-or-tuples-or ndarrays with different lengths or shapes) is deprecated. If you meant to do this, you must specify 'dtype=object' when creating the ndarray
Liks = np.array([resHPPm[0],liknhpp_Exp,resTPPm[0]])
/home/users/mjaniak/software/PyRate/pyrate_lib/PPmodeltest.py:158: RuntimeWarning: divide by zero encountered in true_divide
return (2df-2lik + abs(2df(df+1)/(s-df-1.)))
('models:', array(['HPP', 'NHPP', 'TPP'], dtype='<U4'))
('AICc scores:', array([707.7138794499243, array([1131.227]), inf], dtype=object))
Traceback (most recent call last):
File "/home/users/mjaniak/software/PyRate/PyRate.py", line 4817, in
PPmodeltest.run_model_testing(fossil,q_shift=times_q_shift,min_n_fossils=2,verbose=1)
File "/home/users/mjaniak/software/PyRate/pyrate_lib/PPmodeltest.py", line 286, in run_model_testing
""" % (best_model[0], other_models[0], round(deltaAICs_[0],3), sig[0],
TypeError: type numpy.ndarray doesn't define round method

IndexError (index out of bounds)

Hi Daniele,

Command
"python PyRate.py -ginput .../Canidae_1_G_mcmc.log -b 100 -resample 10"
in tutorial 2, section "Multiple samples of times of origination and extinction",
generates an error of "IndexError: index 955 is out of bounds for axis 0 with size 899".

I think it is due to line 130-131 in pyrate_lib/lib_utilities.py:
TS= list(t_file[burnin:shape_f[0],i].astype(float)[indx])
TE= list(t_file[burnin:shape_f[0],ind_te0+j].astype(float)[indx])

and should be fixed with:
TS= list(t_file[0:shape_f[0],i].astype(float)[indx])
TE= list(t_file[0:shape_f[0],ind_te0+j].astype(float)[indx]

Chi

NameError: free variable 'L_tbl' referenced before assignment in enclosing scope

Hi,

I am new to PyRate, and I am rerunning an analysis by Fabien Condamine: https://www.nature.com/articles/s41467-021-23754-0.pdf

I am running some commands with the latest version of PyRate, and I get the following error:

python3 PyRate.py -plot2 ../pyrate_mcmc_logs/ -tag Hadrosauridae -b 100

Module FastPyRateC was loaded.
0
FILE STEM: Hadrosauridae Hadrosauridae
found 1 log files...

determining min age... .Min root age: 90
89 0

combining all files... Hadrosauridae_2_BDMCMC_G_marginal_rates
.skipping file: ../pyrate_mcmc_logs/Hadrosauridae_2_BDMCMC_G_marginal_rates.log

calculating HPDs... .Traceback (most recent call last):
  File "/home/jkloosterman/project_dino_decline/condamine_paper/PyRate/PyRate.py", line 5054, in <module>
    plot_RTT(path_dir_log_files, burnin, file_stem,one_file,root_plot,plot_type)
  File "/home/jkloosterman/project_dino_decline/condamine_paper/PyRate/PyRate.py", line 481, in plot_RTT
    hpds95 =  np.array(get_HPD(threshold=.95))
  File "/home/jkloosterman/project_dino_decline/condamine_paper/PyRate/PyRate.py", line 440, in get_HPD
    for time_ind in range(shape(L_tbl)[1]):
NameError: free variable 'L_tbl' referenced before assignment in enclosing scope

Any idea what the error means and how I can fix it?

plotRJ can produce rate shift frequencies > 1

The -plotRJ command can yield rate shift frequencies greater than 1 depending on the number of time bins for which the frequencies are evaluated. I found this to be a problem under the default setting of 99 time bins:

counts=c(0.0, 0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0007407407407407407,0.009777777777777778,0.013481481481481481,0.03807407407407407,0.06444444444444444,0.010814814814814815,0.002074074074074074,0.0026666666666666666,0.049185185185185186,1.277925925925926,0.542962962962963,0.13896296296296295,0.006074074074074074,0.015703703703703702,0.007703703703703704,0.005037037037037037,0.009925925925925927,0.044444444444444446,0.07466666666666667,0.058222222222222224,0.19274074074074074,0.10503703703703704,0.19111111111111112,0.1325925925925926,0.025777777777777778,0.006666666666666667,0.002962962962962963,0.003111111111111111,0.0025185185185185185,0.005037037037037037,0.020296296296296295,0.037037037037037035,0.032740740740740744,0.028148148148148148,0.00874074074074074,0.005629629629629629,0.0026666666666666666,0.0023703703703703703,0.002962962962962963,0.0025185185185185185,0.0057777777777777775,0.003703703703703704,0.003111111111111111,0.0025185185185185185,0.08222222222222222,0.2068148148148148,0.1448888888888889,0.2825185185185185,0.20962962962962964,0.15259259259259259,0.3465185185185185,0.025333333333333333,0.024148148148148148,0.04725925925925926,0.056,0.0597037037037037,0.060444444444444446,0.09037037037037036,0.27985185185185185,0.29214814814814816,0.10577777777777778,0.028592592592592593,0.007851851851851851,0.013481481481481481,0.02074074074074074,0.07703703703703704,0.3552592592592593)

(Note the value of element 42.) But refining the plot resolution to 1 Myr, which increased the number of time bins to 132, fixed the issue:

counts=c(0.0, 0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0007407407407407407,0.007703703703703704,0.005629629629629629,0.018962962962962963,0.02903703703703704,0.056296296296296296,0.015851851851851853,0.004148148148148148,0.001037037037037037,0.0014814814814814814,0.0026666666666666666,0.48814814814814816,0.8374814814814815,0.45022222222222225,0.21555555555555556,0.017777777777777778,0.0044444444444444444,0.012148148148148148,0.009185185185185185,0.0026666666666666666,0.0044444444444444444,0.006962962962962963,0.012592592592592593,0.05274074074074074,0.05674074074074074,0.04237037037037037,0.10251851851851852,0.13437037037037036,0.07674074074074073,0.12711111111111112,0.14562962962962964,0.06222222222222222,0.01451851851851852,0.005037037037037037,0.003111111111111111,0.002962962962962963,0.0016296296296296295,0.001925925925925926,0.001925925925925926,0.007703703703703704,0.016296296296296295,0.03111111111111111,0.021777777777777778,0.026222222222222223,0.018814814814814815,0.006666666666666667,0.0044444444444444444,0.004,0.001925925925925926,0.0014814814814814814,0.002074074074074074,0.0025185185185185185,0.0017777777777777779,0.004,0.0034074074074074076,0.003111111111111111,0.002074074074074074,0.0016296296296296295,0.010518518518518519,0.12029629629629629,0.15911111111111112,0.10681481481481482,0.15288888888888888,0.23777777777777778,0.13955555555555554,0.10844444444444444,0.2348148148148148,0.16503703703703704,0.016148148148148148,0.015259259259259259,0.02903703703703704,0.04044444444444444,0.042666666666666665,0.04622222222222222,0.040740740740740744,0.05140740740740741,0.07214814814814814,0.13955555555555554,0.31866666666666665,0.1445925925925926,0.07496296296296297,0.026074074074074072,0.006962962962962963,0.006074074074074074,0.010814814814814815,0.015407407407407408,0.01762962962962963,0.1497777777777778,0.2702222222222222)

The problem affects both PyRate v2.0 - 20190211 and PyRate v3.0 - 20200623.

Error message when trying to download FastPyrateC using curl

I am attempting to download the FastPyrateC library for Windows 10. I have made sure to have SWIG and curl installed beforehand. After changing the directory to ModulePyrateC, when I attempt to download the boost C++ library using the following command...

curl -fsSL (https://boostorg.jfrog.io/artifactory/main/release/1.66.0/source/boost_1_66_0.zip)

I get the following error message.

curl: (3) URL using bad/illegal format or missing URL

I tried replacing the parenthesis with quotation marks, but that also does not seem to work.

pyrate.py "'float' object cannot be interpreted as an integer"

Hi there,

When I try to run anything with PyRate.py (including trying to check the PyRate input file with the Canis example from the tutorial), I get the following error:

Module FastPyRateC was loaded. Traceback (most recent call last): File "/Users/lauravanholstein/PyRate/PyRate/PyRate.py", line 4469, in <module> d3 = max(args.tR,1.01) # avoid win size < 1 File "/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/site-packages/numpy/core/fromnumeric.py", line 2810, in max return _wrapreduction(a, np.maximum, 'max', axis, None, out, File "/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/site-packages/numpy/core/fromnumeric.py", line 88, in _wrapreduction return ufunc.reduce(obj, axis, dtype, out, **passkwargs) TypeError: 'float' object cannot be interpreted as an integer

Seems to have something to do with how Python 3 does integer division. I'm running PyRate on a Mac (M1, 13.3.1) and have Python 3 installed. Any help would be appreciated!
Best wishes,
Laura

How to do multithreading for PyRate?

Dear Expert,

I'm new in PyRate and after the first 10 million run with the mG model the ESS values are very small. I think at least 100 million runs with multiple replicates may give some satisfactory outome. However, the first 10 million runs took more than 65 hrs. Therefore, I wonder to know that is it possible to do multithreading of PyRate.

Thanks a bunch,
Debajyoti

Error combining log files

Hi again!

Here I am with another error... again, on a Mac M1, and with PyRate and numpy fully up-to-date. When combining log files across 10 replicates (with preservation prior TPP), I run into the following error:

Screenshot 2023-08-07 at 10 10 27

Any ideas would be appreciated!

Best wishes,
Laura

Error plotting MBD results: numpy.exceptions.AxisError: axis 1 is out of bounds for array of dimension 0

Hi!

Final question for now (I hope!). I got the following error while trying to plot the results of a MBD analysis:

Screenshot 2023-07-24 at 13 57 22

I'm running PyRate on a Mac M1, and these are the data (although I got the same error with a different dataset, so unlikely this is the consequence of weird data input).

Also, just to check my sanity, in Tracer the Gl0_0 estimate refers to the correlation parameter for self diversity dependence of speciation (and Wl0_0 to the shrinkage factor for self diversity dependence of speciation, etc), right? With the ...0_1, ...0_2, etc, estimates referring to parameters for supplied predictors 1, 2, etc?

The reason I ask is that, when I ran MBD with a single predictor, the LTT output of the whole clade, I got very different correlation parameters for Gl0_0 and Gl0_1 (-8.31 and 1.62, respectively). I assumed that these would be the same or similar, as GI0_1 would essentially be self diversity dependence in this case, right? I must be understanding it wrong!

Many thanks,
Laura

Two potential fixes in PyRateContinuous.py

  1. line 401:
    age = all_events_temp2[0,i] --> age = all_events[i]
  2. line 424:
    t=np.loadtxt(summary_file, skiprows=np.max(1,int(args.b))) -->
    t=np.loadtxt(summary_file, skiprows=np.max([1,int(args.b)]))

Compiling and Installing FastPyRateC Library Requires Depricated 'distutils' Module

I have been attempting to compile and install FastPyRateC to run analyses using python 3.12 on a Macbook with an intel processor. I have followed the tutorial and entered the line: python3 setup.py build. I keep receiving an error that states "ModuleNotFoundError: No module named 'distutils'". I looked into manually installing distutils but it seems that it is now deprecated and removed as of python 3.12. Is there a workaround at this time? I will look into using an earlier version of python 3.x to see if that helps in the meantime.

Thanks in advance

Using -plot on PyRateMBD without having to run the MBD analysis?

I'd like to run PyRateMBD in a variety of places (e.g. doing linear and exponential model, for a handful of different subclades, etc) and then come back later to run the -plot flag.

However, when you run the command python PyRateMBD.py -plot path_to_MBD_logfile.log , you wind up getting a ValueError on the attempted np.loadtxt() because PyRateMBD will try to read in a dataset on line 64. If you provide the dataset, you must provide an MBD predictors folder, and if you provide these it simply will run a fresh MBD analysis.

Am I missing a way to come back later to run the plot flag on an output of PyRateMBD? If not, I have some ideas. It seems that PyRate.py gets around plot vs. analysis issue by 1) having almost everything abstracted out to functions and 2) checking to see if any arguments that require an input file are not empty and then going for a try/except.

Here are my suggestions for a fairly simple way to do this:

  1. Move the MBD modeling functionality to a function, run_MBD() or similar.
  2. If neither -d nor -plot is provided, warn the user and exit.
  3. If -d is provided, run the modeling function as normal. If not, we should be able to skip that section without penalty.
  4. If -plot is provided, run the plotting code. If not, no plot is attempted. (already implemented in code as written with an if-statement)

If you're interested I am happy to draft this out and make a PR.

Module FastPyRateC is not found on mac M1

Dear expert,

I got "Module FastPyRateC was not found" when I run analysis on Mac M1 Pro. I choose to install FastPyRateC library atuomatically, it failed and got error:

Could not find suitable distribution for Requirement.parse('FastPyRateC==1.0')
_FastPyRateC.cpython-310-darwin.so
done
############################
############################
Cleaning up.
done
############################
An error must avec occured during the installation.
Try to install the library manually.

then I install it manually, at the step Compilethe library : it got error like:

FastPyRateC.cpp:8:10: fatal error: 'boost/math/distributions.hpp' file not found
#include <boost/math/distributions.hpp>
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
1 error generated.
error: command '/usr/bin/clang' failed with exit code 1

so how could I solve this problem? is this a M1 chip issue? because it works fine with my old computer with Inter core.

Thanks for you help!

Best regarads,
Yue

(plotRJ) Time bins for rate shift calculations inconsistent with time bins for speciation and extinction rates

Hi!

Thanks for all the hard work you've put into this program! I've been having a lot of success using PyRate so far, but have hit a snag when trying to determine the timing of significant extinction and speciation rate shifts within the interval I am studying. The interval is very short, spanning only 1.4 Ma, and the resolution of the time bins I sampled being roughly 0.1 Ma.

When I run the -plotRJ function with a root_plot (308.2 Ma) and min_age_plot (306.8 Ma) set to bound my data, with a grid_plot of 0.01, I get useful results for speciation rates and extinction rates that fall within the ages I specified. However, the rate shift frequencies are checking much wider time bins with intervals of roughly 2.4 Ma, still starting at 0 Ma (assuming that's what "mids" array in the RTT rscript output represents), one of which encompasses my entire dataset. I've tried reducing the grid_plot value to 0.001, which does reduce the length of the rate shift bin intervals, but makes the arrays used in the RTT rscript too long for R to read properly (R for some reason starts treating the arrays as open-ended and adds a + at the end of the c() function in console instead of making the vector object).

Is there something I'm doing wrong, or another way I could determine the timing of significant rate shifts within the interval I'm studying? Is my interval simply too short for rate shifts to be calculable in PyRate?

Thanks in advance,
Misha

Plotting creates wrong filepath in R for Windows

When I run plotting commands for PyRate, the R script saved to generate the PDF contains path formatting that does not work because of backslashes.

Platform: Windows 10
Python v2.7
R v3.4.0
Rstudio v1.0.143

Example: after running a trait covariance analysis, I call:
> python "./PyRate/PyRate.py" -plot2 "./Results/pyrate_mcmc_logs/occ_1_G_COV_marginal_rates.log"
This successfully creates a _RTT.R script. The call to pdf is written as follows (with the '...' representing a longer path of folders):

pdf(file='C:\...\Results\pyrate_mcmc_logs\occ_1_G_COV_marginal_rates_RTT.pdf',width=10.8, height=8.4)

In both base R and RStudio, this line gives the error:
Error: '\U' used without hex digits in character string starting "'C:\U"

Escaping by using \\ instead of \ did not seem to work, but replacing with / does work:

pdf(file='C:/.../Results/pyrate_mcmc_logs/occ_1_G_COV_marginal_rates_RTT.pdf',width=10.8, height=8.4)

The PyRate plot methods seem to intentionally use the backslash in this pdf() call when the system platform is Windows (or Microsoft), but it needs a little more of a workaround as the working directory will also use \ when called.

I solved the problem locally by modifying the code in PyRate.py at line 427 with the following:

    if platform.system() == "Windows" or platform.system() == "Microsoft":
        modpath = wd.replace('\\', '/')
        Rfile+= "\n\npdf(file='%s/%s_RTT.pdf',width=10.8, height=8.4)\npar(mfrow=c(2,2))" % (modpath,name_file)
    else: 
        Rfile+= "\n\npdf(file='%s/%s_RTT.pdf',width=10.8, height=8.4)\npar(mfrow=c(2,2))" % (wd,name_file)

But I am not sure if this is broadly applicable. Similar fixes are necessary for, e.g., PyRateContinuous.py.

Thanks!

LTT plot shows a wrong number of replicates

PyRate's LTT plot function, called with the -ltt 3 option, draws an incorrect number of diversity trajectories. Instead of showing all replicates (e.g. 20 replicates and 10 resampled models from each, 200 lines in total), it draws the number of lines which is equal to the number of age subdivisions provided by the -grid_plot parameter.

I think the issue is with this loop:

plot2 += """\nlines(time,tbl$rep%s, type="l",lwd = 1,col = alpha("#504A4B",0.5))""" % (i)

10rj_se_est_ltt.pdf

"inconsistent use of tabs and spaces in indentation" in MCDD

Hi there,

I've tried running an MCDD analysis with these data and I get the following error:
File "/Users/lauravanholstein/Python_coding/PyRate/PyRate/PyRateMCDD.py", line 270 m0A=m0 TabError: inconsistent use of tabs and spaces in indentation.

I've tried to run the MCDD analysis with the canid example file, and get the same error. I'm running PyRate on a Mac M1. Any help would be appreciated!

Cheers,
Laura

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.