Re: [Rdkit-devel] drawing amino acids
Greg, I figured out what the problem is: getStringSize() calculates the pixel height/width of a given atom label. For labels such as NH3+ the argument this function is getting is NH3+ which makes for a very long sting, which throws off the scale calculation. I am not sure why it works correctly with the drawers other than SVG but for wxWidgets I need to clean from the label , , , and before computing the string width. Hope this helps to someone who might have the same problem. Best regards, Igor On Fri, Sep 8, 2017 at 8:29 AM, Igor Filippov <igor.v.filip...@gmail.com> wrote: > Great - thanks, I'll try it! > > Igor > > On Fri, Sep 8, 2017 at 8:27 AM, Greg Landrum <greg.land...@gmail.com> > wrote: > >> >> On Fri, Sep 8, 2017 at 2:10 PM, Igor Filippov <igor.v.filip...@gmail.com> >> wrote: >> >>> >>>> >>>> Could it be that you didn't generate coordinates for the molecule? >>>> >>>> The result is the same for me whether I load the molecule from an SD >>> file with coordinates, or generate 2D or 3D coordinates on the fly. >>> Does it display correctly for you? >>> >> >> Yeah, This snippet: >> >> In [21]: m = Chem.MolFromSmiles('NC(=O)C(N)[NH3+]') >> >> In [22]: nm = Draw.PrepareMolForDrawing(m) >> >> In [23]: d = Draw.MolDraw2DCairo(200,200) >> >> In [24]: d.DrawMolecule(nm) >> >> In [25]: d.FinishDrawing() >> >> In [26]: open('blah.png','wb+').write(d.GetDrawingText()) >> Out[26]: 2730 >> >> >> Produces the png file that's attached. >> >> >>> BTW: rdMolDraw2D.PrepareMolForDrawing() is a useful function to know >>>> about. >>>> >>> I am doing it from c++, is there an equivalent there? >>> >> >> Sure, here's some testing code that uses it: >> https://github.com/rdkit/rdkit/blob/9af90524a41825b67ffb19cd >> bff9b363d5a7ca7e/Code/GraphMol/MolDraw2D/test1.cpp#L987 >> >> There are a bunch of other examples in that file too. >> >> -greg >> >> > -- Check out the vibrant tech community on one of the world's most engaging tech sites, Slashdot.org! http://sdm.link/slashdot___ Rdkit-devel mailing list Rdkit-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/rdkit-devel
Re: [Rdkit-devel] drawing amino acids
Great - thanks, I'll try it! Igor On Fri, Sep 8, 2017 at 8:27 AM, Greg Landrum <greg.land...@gmail.com> wrote: > > On Fri, Sep 8, 2017 at 2:10 PM, Igor Filippov <igor.v.filip...@gmail.com> > wrote: > >> >>> >>> Could it be that you didn't generate coordinates for the molecule? >>> >>> The result is the same for me whether I load the molecule from an SD >> file with coordinates, or generate 2D or 3D coordinates on the fly. >> Does it display correctly for you? >> > > Yeah, This snippet: > > In [21]: m = Chem.MolFromSmiles('NC(=O)C(N)[NH3+]') > > In [22]: nm = Draw.PrepareMolForDrawing(m) > > In [23]: d = Draw.MolDraw2DCairo(200,200) > > In [24]: d.DrawMolecule(nm) > > In [25]: d.FinishDrawing() > > In [26]: open('blah.png','wb+').write(d.GetDrawingText()) > Out[26]: 2730 > > > Produces the png file that's attached. > > >> BTW: rdMolDraw2D.PrepareMolForDrawing() is a useful function to know >>> about. >>> >> I am doing it from c++, is there an equivalent there? >> > > Sure, here's some testing code that uses it: > https://github.com/rdkit/rdkit/blob/9af90524a41825b67ffb19cdbff9b3 > 63d5a7ca7e/Code/GraphMol/MolDraw2D/test1.cpp#L987 > > There are a bunch of other examples in that file too. > > -greg > > -- Check out the vibrant tech community on one of the world's most engaging tech sites, Slashdot.org! http://sdm.link/slashdot___ Rdkit-devel mailing list Rdkit-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/rdkit-devel
[Rdkit-devel] MolDraw2Dwx
Greg, I just noticed that stock MolDraw2Dwx.h will not build because of the line: setColour(drawOptions.backgroundColour); should be drawOptions() as it is a function call. Also, I would recommend adding the following lines into setFontSize(): if (font_size_in_points < 1.0) font_size_in_points = 1; I noticed that if font height is less than 1 it gets rounded to zero and wxWidgets has a problem with that. Warmest regards, Igor -- Check out the vibrant tech community on one of the world's most engaging tech sites, Slashdot.org! http://sdm.link/slashdot___ Rdkit-devel mailing list Rdkit-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/rdkit-devel
Re: [Rdkit-devel] InChI 1.05
Greg, Thank you for the kind words! I should note that I am using a slightly older version of rdkit (half a year to a year old), but I don't think it makes a difference as far as InChI is concerned. Best regards, Igor On Fri, Feb 24, 2017 at 8:43 AM, Greg Landrum <greg.land...@gmail.com> wrote: > Thanks Igor! I was not looking forward to getting this working, so it's > great that someone else managed to. > > I need to do a bit more tweaking in order to get the download to work > using the cmake code instead of the download_inchi.sh script, but I should > be done with that pretty quickly. > > I'll have a branch up for review soon (assuming that nothing goes wrong) > > -greg > > > On Thu, Feb 23, 2017 at 4:55 AM, Igor Filippov <igor.v.filip...@gmail.com> > wrote: > >> As InChI 1.05 is officially out I've tinkered with RDKit build system a >> bit >> to include the new version. Two updated files - CMakeLists.txt and >> download-inchi.sh >> from External/INCHI-API/ are attached in case it may be useful to others. >> >> Best regards, >> Igor >> >> >> >> -- >> Check out the vibrant tech community on one of the world's most >> engaging tech sites, SlashDot.org! http://sdm.link/slashdot >> ___ >> Rdkit-devel mailing list >> Rdkit-devel@lists.sourceforge.net >> https://lists.sourceforge.net/lists/listinfo/rdkit-devel >> >> > -- Check out the vibrant tech community on one of the world's most engaging tech sites, SlashDot.org! http://sdm.link/slashdot___ Rdkit-devel mailing list Rdkit-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/rdkit-devel
Re: [Rdkit-devel] InChI 1.05
I did run the tests and they went through just fine. Igor On Thu, Feb 23, 2017 at 8:47 AM, Gianluca Sforna <gia...@gmail.com> wrote: > On Thu, Feb 23, 2017 at 4:55 AM, Igor Filippov > <igor.v.filip...@gmail.com> wrote: > > As InChI 1.05 is officially out I've tinkered with RDKit build system a > bit > > to include the new version. Two updated files - CMakeLists.txt and > > download-inchi.sh > > from External/INCHI-API/ are attached in case it may be useful to others. > > Did you try and run the tests after compiling rdkit against 1.05? IIRC > I had failing tests with prereleases > > > -- > Gianluca Sforna > > http://plus.google.com/+gianlucasforna - http://twitter.com/giallu > Tinker Garage - http://tinkergarage.it > -- Check out the vibrant tech community on one of the world's most engaging tech sites, SlashDot.org! http://sdm.link/slashdot___ Rdkit-devel mailing list Rdkit-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/rdkit-devel
[Rdkit-devel] InChI 1.05
As InChI 1.05 is officially out I've tinkered with RDKit build system a bit to include the new version. Two updated files - CMakeLists.txt and download-inchi.sh from External/INCHI-API/ are attached in case it may be useful to others. Best regards, Igor add_custom_target(inchi_support ALL) if(RDK_BUILD_INCHI_SUPPORT) # search system InChI find_package(Inchi) # check whether we have custom InChI source if(EXISTS ${CMAKE_CURRENT_SOURCE_DIR}/src/INCHI_BASE/src/ichican2.c) message(STATUS "Found InChI software locally") if(INCHI_FOUND) message(WARNING "** Local InChI software takes precedence when both system InChI and local InChI are found") endif(INCHI_FOUND) # cp --parents -auf INCHI_API/libinchi/src/ ~/polymer/rdkit-master/External/INCHI-API/src/ # cp --parents -auf INCHI_BASE/src ~/polymer/rdkit-master/External/INCHI-API/src/ rdkit_library(Inchi src/INCHI_BASE/src/ichican2.c src/INCHI_BASE/src/ichicano.c src/INCHI_BASE/src/ichi_io.c src/INCHI_BASE/src/ichierr.c src/INCHI_BASE/src/ichicans.c src/INCHI_BASE/src/ichiisot.c src/INCHI_API/libinchi/src/ichilnct.c src/INCHI_BASE/src/ichimak2.c src/INCHI_BASE/src/ichimake.c src/INCHI_BASE/src/ichimap1.c src/INCHI_BASE/src/ichimap2.c src/INCHI_BASE/src/ichimap4.c src/INCHI_BASE/src/ichinorm.c src/INCHI_BASE/src/ichiparm.c src/INCHI_BASE/src/ichiprt1.c src/INCHI_BASE/src/ichiprt2.c src/INCHI_BASE/src/ichiprt3.c src/INCHI_BASE/src/ichiqueu.c src/INCHI_BASE/src/ichiring.c src/INCHI_BASE/src/ichisort.c src/INCHI_BASE/src/ichister.c src/INCHI_BASE/src/ichitaut.c src/INCHI_BASE/src/ichi_bns.c src/INCHI_API/libinchi/src/inchi_dll.c src/INCHI_BASE/src/ichiread.c src/INCHI_BASE/src/ichirvr1.c src/INCHI_BASE/src/ichirvr2.c src/INCHI_BASE/src/ichirvr3.c src/INCHI_BASE/src/ichirvr4.c src/INCHI_BASE/src/ichirvr5.c src/INCHI_BASE/src/ichirvr6.c src/INCHI_BASE/src/ichirvr7.c src/INCHI_BASE/src/ikey_dll.c src/INCHI_BASE/src/ikey_base26.c src/INCHI_API/libinchi/src/inchi_dll_main.c src/INCHI_API/libinchi/src/inchi_dll_a.c src/INCHI_API/libinchi/src/inchi_dll_a2.c src/INCHI_API/libinchi/src/inchi_dll_b.c src/INCHI_API/libinchi/src/ixa/ixa_inchikey_builder.c src/INCHI_API/libinchi/src/ixa/ixa_read_mol.c src/INCHI_API/libinchi/src/ixa/ixa_status.c src/INCHI_API/libinchi/src/ixa/ixa_builder.c src/INCHI_API/libinchi/src/ixa/ixa_mol.c src/INCHI_API/libinchi/src/ixa/ixa_read_inchi.c src/INCHI_BASE/src/mol_fmt1.c src/INCHI_BASE/src/mol_fmt2.c src/INCHI_BASE/src/mol_fmt3.c src/INCHI_BASE/src/mol2atom.c src/INCHI_BASE/src/mol_fmt4.c src/INCHI_BASE/src/readinch.c src/INCHI_BASE/src/runichi.c src/INCHI_BASE/src/runichi2.c src/INCHI_BASE/src/runichi3.c src/INCHI_BASE/src/runichi4.c src/INCHI_BASE/src/sha2.c src/INCHI_BASE/src/strutil.c src/INCHI_BASE/src/util.c SHARED) install(TARGETS Inchi DESTINATION ${RDKit_LibDir}) set(INCHI_LIBRARIES Inchi) include_directories(${CMAKE_CURRENT_SOURCE_DIR}/src/INCHI_BASE/src/) ADD_DEFINITIONS("-DTARGET_API_LIB") else(EXISTS ${CMAKE_CURRENT_SOURCE_DIR}/src/INCHI_BASE/src/ichican2.c) if (INCHI_FOUND) include_directories(${INCHI_INCLUDE_DIR}) ADD_DEFINITIONS("-DTARGET_API_LIB") else (INCHI_FOUND) # system InChI is missing message(WARNING "** NO INCHI SOFTWARE FOUND\n" "InChI support will be turned off. If you want to add InChI support, please follow the instructions inside $RDBASE/External/INCHI-API/README to download a copy of InChI software and then rerun cmake.") set(RDK_BUILD_INCHI_SUPPORT OFF) endif(INCHI_FOUND) endif(EXISTS ${CMAKE_CURRENT_SOURCE_DIR}/src/INCHI_BASE/src/ichican2.c) endif(RDK_BUILD_INCHI_SUPPORT) # check whether InChI support is ON after the search if(RDK_BUILD_INCHI_SUPPORT) rdkit_library(RDInchiLib inchi.cpp SHARED LINK_LIBRARIES ${INCHI_LIBRARIES} GraphMol RDGeneral Depictor SubstructMatch SmilesParse ${Boost_THREAD_LIBRARY} ${CMAKE_THREAD_LIBS_INIT}) rdkit_headers(inchi.h DEST GraphMol) if(RDK_BUILD_PYTHON_WRAPPERS) add_subdirectory(Wrap) endif(RDK_BUILD_PYTHON_WRAPPERS) add_definitions(-DBUILD_INCHI_SUPPORT) rdkit_test(testInchi test.cpp LINK_LIBRARIES ${INCHI_LIBRARIES} RDInchiLib ${INCHI_LIBRARIES} FileParsers SmilesParse Descriptors Depictor SubstructMatch GraphMol RDGeneral DataStructs RDGeneral RDGeometryLib ${Boost_THREAD_LIBRARY} ${CMAKE_THREAD_LIBS_INIT}) endif(RDK_BUILD_INCHI_SUPPORT) if(RDK_BUILD_PYTHON_WRAPPERS) # we need an inchi.py... copy in the appropriate one if(RDK_BUILD_INCHI_SUPPORT) add_custom_command(TARGET inchi_support COMMAND ${CMAKE_COMMAND} -E copy ${CMAKE_CURRENT_SOURCE_DIR}/python/inchi.py ${CMAKE_SOURCE_DIR}/rdkit/Chem/inchi.py) else(RDK_BUILD_INCHI_SUPPORT) add_custom_command(TARGET inchi_support COMMAND ${CMAKE_COMMAND} -E copy ${CMAKE_CURRENT_SOURCE_DIR}/python/noinchi.py