function ssa_data failing
konkam opened this issue · 3 comments
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")
I have the same error with Julia 1.9.1. Have you solved this?
Hello Marta,
I ended up coding my own Gillespie algorithm and not using the package
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.