Skip to content

Commit 3b0447d

Browse files
committed
Switch parsing to PythonCall and PythonPlot
1 parent 9163eed commit 3b0447d

File tree

1 file changed

+7
-7
lines changed

1 file changed

+7
-7
lines changed

src/Parse.jl

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
using Unitful
22
using YAML
3-
using PyCall
3+
using PythonCall
44
using StaticArrays
55

66
module Calc
@@ -131,7 +131,7 @@ function getatomdictfromrdkit(mol)
131131
atmD = Dict{String,Int64}()
132132
molecularweight = 0.0
133133
for atm in mol.GetAtoms()
134-
v = elementdict[atm.GetAtomicNum()]
134+
v = elementdict[PythonCall.pyconvert(Int64, atm.GetAtomicNum())]
135135
if v in keys(atmD)
136136
atmD[v] += 1
137137
else
@@ -140,9 +140,9 @@ function getatomdictfromrdkit(mol)
140140
end
141141
nbonds = length(mol.GetBonds())
142142
try
143-
molecularweight = Desc.MolWt(mol)/1000.0
144-
catch
145-
@warn("unable to compute molecular weight")
143+
molecularweight = PythonCall.pyconvert(Float64, Desc.MolWt(mol)) / 1000.0
144+
catch e
145+
@warn("unable to compute molecular weight: $e")
146146
end
147147
return atmD,nbonds,molecularweight
148148
end
@@ -151,15 +151,15 @@ export getatomdictfromrdkit
151151
function getatomdictfromrmg(mol)
152152
atmD = Dict{String,Int64}()
153153
for atm in mol.atoms
154-
v = elementdict[atm.element.number]
154+
v = elementdict[PythonCall.pyconvert(Int64, atm.element.number)]
155155
if v in keys(atmD)
156156
atmD[v] += 1
157157
else
158158
atmD[v] = 1
159159
end
160160
end
161161
nbonds = length(mol.get_all_edges())
162-
molecularweight = mol.get_molecular_weight()
162+
molecularweight = PythonCall.pyconvert(Float64, mol.get_molecular_weight())
163163
return atmD,nbonds,molecularweight
164164
end
165165
function getatomdictsmiles(smiles)

0 commit comments

Comments
 (0)