Closed Leticia-maria closed 1 year ago
Thank you for your interest. Maybe you can use MolecularGraph.jl in Pluto.jl. Any problems? Or do you have any ideas about dynamic use?
Thank you for replying me :) I had problems running the example in Pluto.jl with the "display("image/svg+xml", molsvg)" called method. The error message is below.
`
...
display(::TextDisplay, ::MIME{Symbol("image/svg+xml")}, ::Any)@multimedia.jl:249
display(::MIME{Symbol("image/svg+xml")}, ::Any)@multimedia.jl:342
display(::String, ::Any)@multimedia.jl:217
top-level scope@Local: 1[inlined]
`
And I have also ideias for interactive using. I am trying to integrate MolecularGraph and Gtk. And I would like to contribute to this package at this point, if you are interested.
any word on whether we can display the svg's in Pluto somehow?
any word on whether we can display the svg's in Pluto somehow?
Hey, are you having problems by displaying a molecule svg image in Pluto? Could you show me the error?
yes. have you found a way to make this display in Pluto.jl?
mol2 = smilestomol("O=C3N2/C(=C(/C=C\\c1scnc1C)CS[C@@H]2[C@@H]3NC(=O)C(=N\\OC)/c4nc(sc4)N)C(=O)O")
molsvg2 = drawsvg(mol2, 300, 300)
display("image/svg+xml", molsvg2)
for me gives:
MethodError: no method matching show(::IOContext{Base.PipeEndpoint}, ::MIME{Symbol("image/svg+xml")}, ::String)
Closest candidates are:
show(::IO, ::M, !Matched::PlutoUI.ExperimentalLayout.Show{M}) where M<:MIME at ~/.julia/packages/PlutoUI/WK1nR/src/Layout.jl:487
show(::IO, ::M, !Matched::PlutoUI.Show{M}) where M<:MIME at ~/.julia/packages/PlutoUI/WK1nR/src/DisplayTricks.jl:89
show(::IO, ::M, !Matched::PlutoUI.AsMIME{M}) where M<:MIME at ~/.julia/packages/PlutoUI/WK1nR/src/DisplayTricks.jl:12
...
display(::TextDisplay, ::MIME{Symbol("image/svg+xml")}, ::Any)@multimedia.jl:249
display(::MIME{Symbol("image/svg+xml")}, ::Any)@multimedia.jl:342
display(::String, ::Any)@multimedia.jl:217
top-level scope@Local: 5[inlined]
Thank you for replying me :) I had problems running the example in Pluto.jl with the "display("image/svg+xml", molsvg)" called method. The error message is below.
`
...
display(::TextDisplay, ::MIME{Symbol("image/svg+xml")}, ::Any)@multimedia.jl:249 display(::MIME{Symbol("image/svg+xml")}, ::Any)@multimedia.jl:342 display(::String, ::Any)@multimedia.jl:217 top-level scope@Local: 1[inlined]
`
Had the same issue, have you got some ways to display it in Pluto.jl?
Sorry for very late response. I used Pluto.jl for the first time today, and looks really promissing...
Anyway, display
may not work with Pluto.jl.
MolecularGraph.jl does not have Base.Multimedia.display
methods (see https://docs.julialang.org/en/v1/base/io-network/#Multimedia-I/O), so this is not a problem specific to this library, but to the Pluto.jl specification.
HTML
seems to work, but I don't know whether this is the intended way to do so.
awesome, thanks, we are in business with Pluto now and MolecularGraph.jl now!
one thing I couldn't figure out is how to write the SVG to file.
canvas = SvgCanvas()
draw2d!(canvas, mol)
drawatomindex!(canvas, mol, bgcolor=MolecularGraph.Color(255, 255, 255))
d = tosvg(canvas, 300, 300)
f = open("molecule.svg", "w")
write(f, d)
close(f)
for others looking for how to do this :)
Base.multimedia.display(mol) implemented. See #77.
I think one good alternative for more dynamic use of the package is to implement it on Pluto.jl, as a reactive tool.