tmcgrath325 / MolecularGaussians.jl

Alignment and comparison of small molecules read from .sdf files represented as Gaussian Mixture Models.
MIT License
7 stars 0 forks source link

Help with error? #15

Closed Nick-Mul closed 4 months ago

Nick-Mul commented 5 months ago

Hi Tom, Great work on this 👍 , it looks really useful.

I could get your read me example working, but when I've been trying to apply it to my work flow I running into a issue and I am not bright enough to easily understand where I am going wrong.

I've got two xyz files, I convert these to two sdf files, I read these in and get two molecular graphs, the PharmacophoreGMM set seems to go fine and I can run

println(overlap(pgmm1, pgmm2))

However I having a problem trying to align the objects

vol_res = tiv_gogma_align(pgmm1, pgmm2, 1, 1; maxstagnant=10000);

or

res = gogma_align(pgmm1, pgmm2; nextblockfun=GMA.randomblock, maxsplits=10000);

and I get this error, any idea where I am going wrong? Best regards, Nick

ERROR: LoadError: DimensionMismatch: number of rows of each array must match (got (3, 0, 3, 3))
Stacktrace:
  [1] _typed_hcat(::Type{Any}, A::Tuple{StaticArraysCore.SMatrix{3, 5, Float64, 15}, Vector{Any}, StaticArraysCore.SMatrix{3, 1, Float64, 3}, StaticArraysCore.SMatrix{3, 2, Float64, 6}})
    @ Base ./abstractarray.jl:1667
  [2] typed_hcat(::Type{Any}, ::StaticArraysCore.SMatrix{3, 5, Float64, 15}, ::Vector{Any}, ::StaticArraysCore.SMatrix{3, 1, Float64, 3}, ::Vararg{AbstractVecOrMat})
    @ Base ./abstractarray.jl:1646
  [3] hcat(::StaticArraysCore.SMatrix{3, 5, Float64, 15}, ::Vector{Any}, ::StaticArraysCore.SMatrix{3, 1, Float64, 3}, ::Vararg{AbstractVecOrMat})
    @ Base ./abstractarray.jl:1656
  [4] coords
    @ ~/.julia/packages/GaussianMixtureAlignment/QPXB6/src/gogma/gmm.jl:72 [inlined]
  [5] translation_limit(x::PharmacophoreGMM{3, Float64, Symbol, SDFMolGraph}, y::PharmacophoreGMM{3, Float64, Symbol, SDFMolGraph})
    @ GaussianMixtureAlignment ~/.julia/packages/GaussianMixtureAlignment/QPXB6/src/utils.jl:31
  [6] GaussianMixtureAlignment.TranslationRegion(x::PharmacophoreGMM{3, Float64, Symbol, SDFMolGraph}, y::PharmacophoreGMM{3, Float64, Symbol, SDFMolGraph}, R::Rotations.RotationVec{Float64}, T::StaticArraysCore.SVector{3, Float64})
    @ GaussianMixtureAlignment ~/.julia/packages/GaussianMixtureAlignment/QPXB6/src/uncertaintyregion.jl:203
  [7] branchbound(xinput::PharmacophoreGMM{3, Float64, Symbol, SDFMolGraph}, yinput::PharmacophoreGMM{3, Float64, Symbol, SDFMolGraph}; nsplits::Int64, searchspace::Nothing, blockfun::Type{GaussianMixtureAlignment.TranslationRegion}, R::Rotations.RotationVec{Float64}, T::StaticArraysCore.SVector{3, Float64}, nextblockfun::typeof(GaussianMixtureAlignment.lowestlbblock), centerinputs::Bool, boundsfun::GaussianMixtureAlignment.var"#boundsfun#143"{Dict{Symbol, Dict{Symbol, Matrix{Float64}}}, Dict{Symbol, Dict{Symbol, Matrix{Float64}}}}, localfun::GaussianMixtureAlignment.var"#localfun#145"{Dict{Symbol, Dict{Symbol, Matrix{Float64}}}, Dict{Symbol, Dict{Symbol, Matrix{Float64}}}}, tformfun::Type, atol::Float64, rtol::Int64, maxblocks::Float64, maxsplits::Float64, maxevals::Float64, maxstagnant::Int64, separatesplit::Bool)
    @ GaussianMixtureAlignment ~/.julia/packages/GaussianMixtureAlignment/QPXB6/src/branchbound.jl:113
  [8] #trl_branchbound#129
    @ ~/.julia/packages/GaussianMixtureAlignment/QPXB6/src/branchbound.jl:263 [inlined]
  [9] tiv_branchbound(x::PharmacophoreGMM{3, Float64, Symbol, SDFMolGraph}, y::PharmacophoreGMM{3, Float64, Symbol, SDFMolGraph}, tivx::IsotropicMultiGMM{3, Float64, Symbol}, tivy::IsotropicMultiGMM{3, Float64, Symbol}; boundsfun::Function, rot_boundsfun::Function, trl_boundsfun::Function, localfun::GaussianMixtureAlignment.var"#localfun#145"{Dict{Symbol, Dict{Symbol, Matrix{Float64}}}, Dict{Symbol, Dict{Symbol, Matrix{Float64}}}}, rot_localfun::GaussianMixtureAlignment.var"#rot_localfun#146"{Dict{Symbol, Dict{Symbol, Matrix{Float64}}}, Dict{Symbol, Dict{Symbol, Matrix{Float64}}}}, trl_localfun::Function, kwargs::@Kwargs{maxstagnant::Int64})
    @ GaussianMixtureAlignment ~/.julia/packages/GaussianMixtureAlignment/QPXB6/src/branchbound.jl:331
 [10] tiv_branchbound
    @ ~/.julia/packages/GaussianMixtureAlignment/QPXB6/src/branchbound.jl:299 [inlined]
 [11] tiv_gogma_align(gmmx::PharmacophoreGMM{3, Float64, Symbol, SDFMolGraph}, gmmy::PharmacophoreGMM{3, Float64, Symbol, SDFMolGraph}, cx::Int64, cy::Int64; kwargs::@Kwargs{maxstagnant::Int64})
    @ GaussianMixtureAlignment ~/.julia/packages/GaussianMixtureAlignment/QPXB6/src/gogma/align.jl:27
 [12] top-level scope
tmcgrath325 commented 4 months ago

Hi Nick,

Thanks for the opening this issue, and apologies for not responding sooner. I believe this error occurs when you have a list of features (e.g. :Donor, :NegIonizable, etc.) that is empty in one of your PharmacophoreGMMs.

This is something that, ideally, should be handled automatically by the GaussianMixtureAlignment package. I'll put up a fix there soon, but for now, you can manually delete the offending entries in the gmms dictionary of PharmacophoreGMM using delete!().

Nick-Mul commented 4 months ago

Awesome thanks for the reply Tom!