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

function ssa_data failing #21

Open
konkam opened this issue Mar 30, 2022 · 3 comments
Open

function ssa_data failing #21

konkam opened this issue Mar 30, 2022 · 3 comments

Comments

@konkam
Copy link

konkam commented Mar 30, 2022

Hello,

the code in the instructions at https://sdwfrost.github.io/Gillespie.jl/latest/ seems to be failing.

The error message is:

ERROR: MethodError: Cannot `convert` an object of type Matrix{Int64} to an object of type DataFrames.DataFrame
Closest candidates are:
  convert(::Type{DataFrames.DataFrame}, ::DataFrames.SubDataFrame) at ~/.julia/packages/DataFrames/MA4YO/src/subdataframe/subdataframe.jl:304
  convert(::Type{T}, ::T) where T at ~/julia-1.7.2/share/julia/base/essentials.jl:218
  DataFrames.DataFrame(::Matrix) at ~/.julia/packages/DataFrames/MA4YO/src/dataframe/dataframe.jl:381
  ...
Stacktrace:
 [1] ssa_data(s::SSAResult)
   @ Gillespie ~/.julia/packages/Gillespie/FC1zW/src/SSA.jl:341
 [2] top-level scope
   @ REPL[9]:1

All lines up to this run fine. This behaviour is obtained on julia 1.7.2 (2022-02-06), the repo version of Gillespie.jl and DataFrames v1.3.2

A minor comment is that the installation command needs to be updated, with something along Pkg.add(url="https://github.com/sdwfrost/Gillespie")

@martacunial
Copy link

I have the same error with Julia 1.9.1. Have you solved this?

@konkam
Copy link
Author

konkam commented Jun 28, 2023

Hello Marta,

I ended up coding my own Gillespie algorithm and not using the package

@martacunial
Copy link

I solved this issue not using the function ssa_data (that still gives me error), but I extracted the data I needed from SSAResult returned from the function ssa.
**result=ssa(x0,F,nu,parms,tf)
sim=result.data;
time=result.time
df= DataFrame(sim,:auto); ** #convert Matrix{Int64} into a Dataframe.

I converted the Matrix into a Dataframe so that I could use it to easily plot the data.

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

2 participants