mojaie / MolecularGraph.jl_notebook

Notebook tutorials for MolecularGraph.jl
Creative Commons Attribution 4.0 International
11 stars 3 forks source link

Reactions #4

Closed hhaensel closed 3 years ago

hhaensel commented 3 years ago

It would be a great thing to also cover reactions in your package.

I've written a very simple parser to decompose a V2000 reaction file into its reactands and products for the beginning

function parserxn(rxn::AbstractString)
    parts = split(rxn, r"\$MOL\r?\n")
    (ne, np) = parse.(Int, split(split(first(parts), r"\r?\n")[end-1]))
    ee = parts[2:1 + ne]
    pp = parts[(2 + ne):(1 + ne + np)]
    ee, pp
end

For a correct implementation, one would need, of course, to define a reaction type and also cover the V3000 format.

hhaensel commented 3 years ago

was meant to go into the MolecularGraph.jl. Sorry!