Commit Graph

107 Commits

Author SHA1 Message Date
Greg Landrum
f7fb104e6e Correct unbranched alkane SMARTS to match the description given (#7255)
* Correct unbranched alkane SMARTS to match the description: must restrict to only carbon and allow for terminal alkanes

* Add backwards incompatible change notes

* move and edit incompatible changes note

---------

Co-authored-by: Daniel Levine <levineds@meta.com>
Co-authored-by: levineds-meta <159849019+levineds-meta@users.noreply.github.com>
Co-authored-by: greg landrum <greg.landrum@gmail.com>
2024-04-12 08:25:00 +02:00
levineds-meta
0ff4399f1f Remove duplicate entry (#7249) 2024-03-16 06:20:20 +01:00
Greg Landrum
f1d4c2bf2e remove deprecated packages from rdkit.ML (#7107) 2024-01-30 16:57:59 +01:00
Ric
880a8e5725 Reformat Python code for 2023.03 release (#6294)
* run yapf

* run isort

---------

Co-authored-by: Greg Landrum <greg.landrum@gmail.com>
2023-04-28 06:53:56 +02:00
David Cosgrove
f9932ffbda Add info about mergeHs to README. (#5910)
Co-authored-by: David Cosgrove <david@cozchemix.co.uk>
2023-01-03 05:47:01 +00:00
Paolo Tosco
d75d3e6b1c - update AvalonTools to version 2.0.4a (#5796)
- update config files in Data to the same version as in AvalonTools
- fix a bug in AvalonTools.cpp causing the last character of the optString bassed to initCheckMol() to be deleted
- add a test to confirm the bug is fixed

Co-authored-by: Tosco, Paolo <paolo.tosco@novartis.com>
2022-12-01 16:48:09 +01:00
David Cosgrove
f9b47d907f Add ACS1996 drawing style (#5425)
* Started on ACS 1996 drawing mode.
Significant change (not by itself, sadly) is that MolDrawOptions::lineWidth has changed from int to double to allow for ACS requirement of 0.6px bond widths.

* Wavy lines and dashed wedges.

* Better dashed wedges.

* Rounder wavy bonds, same as SVG.

* Added FreeSans font for ACS1996 mode.

* Add help functions to write enum classes to ostream.

* Dashed wedge separation now 2.5px between line edges rather than line middles.  Therefore wider gap between lines.

* Increase offset for wavy bond.  Get classes for atoms and bonds in wavy bond correct.

* For SMILES input, option to force wavy and crossed bonds for unspecified stereochem.

* Tidy debugging.

* Extra space round atom labels.

* Extra space between chars in freetype string.

* Reformats.

* Change double bond offset.

* Improve ring double bonds.

* Simple non-ring double bonds all working.

* Tidy.

* All double bonds seem good.

* Remove redundant function.
Move calcTripleBondLines into DrawMol for consistency with calcDoubleBondLines.
Use doubleBondOffset for wavy lines.

* Correct spacing between FT chars.

* Tidying.

* Use MolBlock wedging if there is any.  Needs to be made an option.

* If dashed wedge thick end has bonds of it, stop one dash short.

* Adjust solid wedge ends to line with attached bonds.

* Width of wedge ends now based on double bond separation.

* Change catch_tests.cpp

* Rounder waves in wavy lines.

* Dashed wedges same width even if one dash less..

* Embedded Roboto-Regular font in code.

* Fix docstrings.

* doubleBondTerminal swapped ends.
Deal with O2 - 2 terminal atoms of degree 1.

* Fix terminal double bonds.

* Slightly fatter truncated wedge bonds.

* Fix crash on complicated double bonds.

* Control more assert tests with DO_TEST_ASSERT.

* Fix 2 colour solid wedges.
Fix slanted wedge for morphine (test1_5).

* Change definittion of multipleBondOffset to fraction of mean bond length.

* Don't slant end of solid wedge to atom symbol.

* Fix wiggle separation.

* Fix 2-colour terminal double bonds.

* Fix colours on triple bonds.

* Don't attempt to draw non-existent points in triangle..

* Symmetric bond for P=O and like.

* Fix query bonds.

* Reformatting.

* Tidy up use of font.

* Add FreeSans font and license to $RDBASE/Data/Fonts.

* Draw unspecified stereo as unknown.

* Add check_file_hash.

* Tidying.

* Tidying.

* Start Python wrappers.

* Fix solid wedges for 3-connected atoms.

* Docstrings.

* Tidying.

* Alter width of bond highlights in ACS 1996 mode.

* Expose setACS1996Options and mean BondLength in Python.

* Expose drawMolACS1996Cairo in Python.
Docstrings.

* Extra padding between legend and picture in flexicanvas.

* Python tests.

* Tidy catch tests.

* Tidying.

* Fix catch tests.

* Fix no Freetype tests.

* Draw solid wedge more sensibly..

* Fix bond end at solid wedge.

* Tidy.

* Fix Python Cairo build issues.

* Fix wedge end shape for terminal double bonds.

* Hide the joins at the bond ends.

* Fix gcc pickiness.

* Extra test for no atom labels.

* Change where it looks for FreeSans.ttf for ACS1996 drawings.

* Same number of waves for wavy bonds in SVG and Cairo.

* Same number of waves for wavy bonds in SVG and Cairo.

* rename unspecifiedStereoIsUnknown to markUnspecifiedStereoAsUnknown and move to MolFileStereochem.h

* refactor use of iterators

* py docs update

* undo a bunch of bad formatting changes

* remove FreeSans

* get windows builds working

* Fix problem with Windows build.

* Changes in response to review.

* Align description of unspecifiedStereoIsUnknown in C++ to match Python.

* Still working on file open modes.

* Took out extraneous functions for drawing in ACS1996 mode, including the one that was breaking the windows build.

* Add RDKIT_MOLDRAW2D_EXPORT.

* Fix expected test results.

* Clarified warning.

* RDKIT_MOLDRAW2D_EXPORT missing.

* Windows!

* Update Code/GraphMol/MolDraw2D/rxn_test1.cpp

Co-authored-by: David Cosgrove <david@cozchemix.co.uk>
Co-authored-by: greg landrum <greg.landrum@gmail.com>
2022-07-21 18:11:33 +02:00
Guy Rosin
135dfc59b5 Fix typo: quarternary --> quaternary (#5243) 2022-04-29 08:09:34 +02:00
Greg Landrum
f5a54af475 A collection of MolStandardize improvements (#4118)
* Swap to using a data structure for default normalization parameters

* bring the default fragment data into the code too

* cleanup

* add reionizer parameters via data

change fragment parse failures to ValueErrorExceptions

* tautomer parameters in the code

* got a little over-enthusiastic in that last cleanup

* use boost::flyweight to cache normalization and charge data params

* a bit more cleanup

* support reading params from JSON

* fragments from JSON
single-call for fragment removal

* add a one-liner for the canonical tautomer

* quick refactor

* Fixes #4115

* complete the parents

* docs

* move the definitions to a namespace and make them const

* see if switching to c++14 fixes the CI compile problems with g++ 5.5

* somewhat uglier way of solving the initalizer list problem
2021-05-19 09:11:23 +02:00
Brian Kelley
f5fab0485e Fixes Amine.Tertiary.Aromatic definition (#3883) 2021-03-05 10:27:57 +01:00
Greg Landrum
f3afc3ebc8 Fixes #3460 (#3461)
* Fixes #3460

* add a test for #3460
2020-10-04 05:13:37 +02:00
Paolo Tosco
527a7adf99 Some work on TautomerEnumerator (#3327)
* - Added a TautomerEnumerator constructor which allows passing CleanupParameters
- Added three configurable parameters to CleanupParameters
- Added a callback to TautomerEnumerator
- Fixed a bug where the same tautomer could be mapped by both isomeric and non-isomeric SMILES
- TautomerEnumerator::enumerate() now returns a TautomerEnumeratorResult and does not take
  dynamic_bitset pointers as optional parameters
- Added a missing transform from the Sitzmann paper
- General code cleanup and optimization

* - TautomerEnumeratorResult is now iterable in both C++ and Python
- further optimizations
- implemented a TautomerEnumerator.PickCanonical() Python wrapper
- added C++ and Python accessors to SMILES and SmilesTautomerMap

* - make sure the number of tautomers reported by rdLogger is correct and definitive

* make sure that if N maxTautomers are requested, N tautomers are returned if the theoretical number of tautomers is M>N

* avoid that sulfonic acids hit the formamidinesulfinic acid tautomerisation rule

* offer an option to allow the old API to still be used.

* Changes in response to review and following discussion with Gareth and Greg

* - made TautomerEnumeratorResult an enum class (was a plain C enum)
- made TautomerEnumeratorResult::const_iterator a bidirectional_iterator
- added tests to fully probe the TautomerEnumeratorResult::const_iterator functionality

* - change the difference_type definition
- added tests for the above

* - cosmetic change to improve code readability

Co-authored-by: greg landrum <greg.landrum@gmail.com>
2020-09-24 17:00:03 -04:00
David Cosgrove
bc9e4d6478 Support using FreeType for text rendering (#3237)
* First working version with DrawText classes, original functionality only.  No font scaling.

* Added font scaling.

* Added atom colours.

* First stab at freetype text drawing.  A stash prior to major surgery.

* Freetype seems to be working.  On to whack-a-mole.

* Added class flag to atom labels and annotations.

* Another intermim commit whilst re-factoring all string drawing code from MolDraw2D.

* Fixed scaling and implemented max font size.

* Fixed bugs in non-FT Cairo and SVG drawing.

* More re-factoring of drawStrings - now creates StringRwct for each char in all strings.

* More re-factoring of string drawing - all mentions removed from MolDraw2D, I think..

* Working native Cairo, simple tests.

* Working native Cairo, simple tests.

* Padding roumd rectangles.

* Working FT Cairo, FT SVG, native SVG, simple tests.

* Two line labels mostly sorted. Native SVG wrong.

* Two line SVG labels sorted.

* Two line SVG labels sorted.

* Tidied out debug writes.

* Tweaked merge.

* Annotations working, radicals now failing.

* Fixed radicals crash.

* All tests passed for freetype drawings.  Grid drawings not right.

* Fixed bug in grid drawings.

* Better font size.

* Fixed legends in grids.

* Fixed rect intersection bug.

* Tidied up font sizes.

* moldraw2DTest1 all passing.

* All catch tests pass.

* Few rixes, and reactions look ok.

* Added minimum font size.

* Fixed radical drawing when max/min font size hit.

* Interim cmmmit, most test1.cpp working.

* Fixed uninitialised min_font_size_ in DrawText.  Took out use of MolDraw2D::setFontSize() which probably needs to go back in at some point.

* More test1.cpp passing.

* test1.cpp all pass, freetype and non-freetype

* Fixed superscripts hitting min font size in test860.  Made superscripts and subscripts same size.

* testc.pp all pass.

* Fixed bug in freetype text. All testt1.cpp pass.

* All tests passed.d

* Added option for different font.

* Added option for explicit terminal methyls.

* Added option to explicitly not use Freetype in drawers.  Used same in catch_tests.cpp.

* Got sense of NO_FREETYPE wrong in catch_tests.cpp.  D'oh!

* Fixed Python draw tests.

* Added new options to JSON interpreter.

* Fixed scale of text in contoured plots.

* Added optional molecule to grid drawer to help set scale.

* Fixed Python wrappers  for drawing 2D grids .

* Added Greg's CMakeLists.txt

* Moved fonts out of code tree.
Improved handling of font files not found, including logging to rdWarningLog.

* Interim commit.

* Tidied up some namespace std issues.

* Reverted to previous version.
Took out 'using namespace std;'

* update expected java results

* Added multi-line legends.  Also carves out a reserved bit for the legend, and sets the font size so the legend will fit.

* enable annotations on windows with freetype

* Removed stray font file.

* Removed stray font file.

* Re-instanted fontSize() and setFontSize(), though with change of units.

* Added RDK_BUILD_FREETYPE_SUPPORT to cmake.

* re-expose the fontsize controls to python.
document API change w.r.t. font size

* Update ReleaseNotes.md

Co-authored-by: David Cosgrove <david@cozchemix.co.uk>
Co-authored-by: greg landrum <greg.landrum@gmail.com>
2020-06-23 17:31:50 +02:00
Greg Landrum
915471a079 Fix a problem with aromatic heteroatom tautomer enumeration (#2952)
* update transforms to enforce neutral nitrogens when doing the aromatic neteroatom transforms

* formatting, add a test

* remove unused #include
2020-02-13 06:35:01 +01:00
Eisuke Kawashima
7c6d9cf4e9 Unset executable flag (#2833) 2019-12-19 08:29:32 +01:00
Eisuke Kawashima
185ec927ab Unset executable flag 2019-10-10 20:18:43 +09:00
Greg Landrum
9f103a9913 Allow components of the MolStandardize code to be initialized from streams (#2385)
* Fixes #2383 (tests coming in the next commit)
Minor typo fix
Fixes a "bug" in one of the default transforms

* Adds support for directly providing normalization parameter data
instead of requiring the use of a text file.

* allow fragment removers to be initialized with string data

* remove unicode

* allow the reionizer to be initialized from a stream
2019-04-03 04:48:05 +02:00
John Mayfield
da60d20aca Patch/pains updates (#2272)
* Correct typo in thiophene_E pattern, !H0,!H1 is "always true" should be !H0!H1

* Errors in ring closure translation from original SLN.

* Make queries agnostic to aromaticity model.

* Redundant recursive SMARTS

* More queries that benefit from optional aromaticity.

* Update the (.in) files from previous commit.

* Update thiaz_ene_A inline with CSV file.
2019-03-18 13:42:31 -04:00
Greg Landrum
24f1737839 Remove a bunch of Python2-related warts (#2315)
* remove all of the "from __future__" imports

* remove the first batch of rdkit.six imports/uses

* next step of rdkit.six removal

* removing xrange, range, and some maps

* next round of removals

* next round of cleanups

* fix inchi test

* last bits of "from rdkit.six" are gone

* and the last of the six stuff is gone

* strange importlib problem
2019-03-06 20:43:49 -05:00
Greg Landrum
0aff90751a change bogus "3D" to "2D" in a test file (#2319)
we raise a warning about this now
2019-03-06 16:06:15 -05:00
Susan Leung
956fdf268c Dev/GSOC2018_MolVS_Integration (#2002)
* short test file for MolVS standardize_sm

* short test file for MolVS fragment

* short test file for MolVS metals

* short test file for MolVS normalize

* short test file for MolVS reionize

* short test file for MolVS tautomer

* short test file for MolVS validate

* long test file for MolVS standardize smiles

* long test file for MolVS fragment

* long test file for MolVS metals

* long test file for MolVS normalize

* long test file for MolVS reionize

* long test file for MolVS tautomer

* long test file for MolVS validate

* Unit tests for MolVS steps

* dropping support for Python2

* molvs/__init__.py

* molvs/charge.py

* molvs/errors.py

* molvs/fragment.py

* molvs/metal.py

* molvs/normalize.py

* molvs/resonance.py

* molvs/standardize.py

* molvs/tautomer.py

* molvs/utils.py

* molvs/validate.py

* molvs/validations.py

* molvs/cli.py

* adapted and renamed molvs/cli.py to work within $RDBASE/Contrib/MolVS/

* setup MolStandardize directories, source with empty cleanup function, header, CMake files

* corrections to empty source, header and test1.cpp

* adding empty functions and initializers to MolStandardize

* empty Metal source, header and added test

* added most of Metal.cpp functionality and made some more tests

* empty functions and initializers to Normalize

* empty functions and initializers to Validate

* added most code for RDKitDefault mode, along with some tests

* restructure for abstract base class ValidateMethod

* written in isNoneValidation for MolVSValidation

* took out isNoneValidation, put in noAtomValidation, neutralValidation, isotopeValidation for MolVSValidation

* added in AllowedAtoms

* added in disallowedAtoms

* corrections to Validate

* added code for FragmentRemover

* extended fragment functionality to include choose largest fragment, added in tests for fragment catalog, fragment remover. Also added fragmentValidation method in MolStandardize

* added another test to testValidate test_fragment

* corrections to fragment

* corrections to Metal

* added code for Normalize

* added normalize member function to MolStandardize and added tests

* added multi fragment functionality to Normalize.cpp and additional tests

* TransformCatalog

* tests for Normalize.cpp

* first bit of cleanup

* added most of Charge functionality and some tests

* some corrections to Charge.cpp and some more tests to testCharge.cpp

* corrections to Charge.cpp

* start of Tautomer Enumerate with some tests

* added BondType option to Tautomer Enumeration

* correcting for some memory leakage

* a few alterations to formatting

* sorting out some memory leaks

* sorting out some memory leaks

* some corrections for PCS test set

* redo tests with updated RDKit

* fixing memory leak

* more fixes after 100kPCS set testing

* using tab as delimiter in CSVs rather than comma

* tutorial for MolStandardize

* still working on Tautomer enumeration

* deleted some empty tests

* starting writing tautomer canonicalize

* rename test_data -> data (the source still needs to be updated)

* automatic source reformatting

* adjust to directory rename

* move the fragment catalog test into the MolStandardize directory
do not create separate library for FragmentCatalog

* stop building separate libraries for the catalogs

* move the CleanupParameters into the MolStandardize namespace

* first pass at python wrapper

* move the py module to the correct dir;
add some python tests;
add standardizeSmiles to python wrapper

* disabling the compareMolVSTest since that requires command line arguments to run

* get this building on windows

* put the python lib in the right place

* further work on python wrapper for rdMolStandardize

* added get and set functions to Metal and wrapped them

* added get and set functions to Metal and wrapped them

* changed construstor of Reionizer class and input args for reionize, wrapped this default

* overload Reionizer constructor so user can input own AcidBaseFile from python

* added Uncharger class to Charge and added test for Uncharger

* wrapped Fragment, fixed some memory leakage, changed some args and return types, added some tests

* wrapped Normalized and changed how Normalizer class is initiated

* changing MolVSValidation structure so user can choose which MolVS submethod they want

* starting to write Wrap for Validate

* now it compiles with Wrap/Validate.cpp

* a couple refactorings around validate

* move the validate code into the rdMolStandardize module

* make sure a valid pointer is returned for standardizeSmiles

* rdMolStandardize.MolVSValidation done and tests added

* half way through AllowedAtomsValidation

* finished AllowedAtomsValidation and DisallowedAtomsValidation

* moved charge, fragment, metal, normalize into the rdMolStandardize module

* changed tutorial to use wrapped code

* added copyrights

* added copyrights

* move the data files

* modify source files to adjust to the move

* added validateSmiles functionality

* removed std::cout

* redid some of the 100k PCS tests

* working on the tutorial

* adding some documentation

* deleting some comment lines

* some changes after pull review

* More changes after pull review

* start of trying to make java wrap

* remove some warnings, add some questions

* additional warning removals, a bit more reporting

* some test cleanups

* enable testing of the java code
2018-09-28 11:24:25 +02:00
gedeck
e9af48ffd7 Issue1071/yapf (#1078)
* Issue #1071: add yapf configuration file

* yapf formatting of Code directory

* yapf formatting of Contrib directory

* yapf formatting of Data directory

* yapf formatting of Docs directory

* yapf formatting of External directory

* yapf formatting of Projects directory

* yapf formatting of Regress directory

* yapf formatting of Scripts directory

* yapf formatting of Web directory

* yapf formatting of rdkit directory
2016-09-23 04:58:46 +02:00
Greg Landrum
1692914b6e Fixes #525 2015-10-28 06:01:46 +01:00
Greg Landrum
14558020c2 get the DbCLI tests working on windows 2015-10-26 07:25:11 +01:00
Paolo Tosco
076831aa31 - removed d_ceMapTmp and d_ceMap from ResonanceMolSupplier
(they both were temporary data structures and there was
  no real reason for them to be there, especially in view
  of a possible code parallelization)
- converted most uint64_t to unsigned int since they weren't
  really necessary
- fixed a couple of compilation warnings
2015-10-25 21:50:20 +00:00
Paolo Tosco
517de5b5d8 - Fixed a few glitches which caused the build to fail on Windows
- added a few tests for ResonanceMolSupplier
2015-10-24 01:18:10 +01:00
Paolo Tosco
72de596280 - implemented correct resonance structure sorting for degenerate cases
- moved classes that do not need being exposed in Resonance.h to Resonance.cpp
- added the ALLOW_CHARGE_SEPARATION flag: now by default charge
  separation structures are not displayed if there's at least one
  structure with no charge separation
- TODO
  * add SWIG wrappers
  * add a few test tp resMolSupplierTest.cpp
2015-10-23 18:41:53 +01:00
Paolo Tosco
6ccda75d77 - fixed a problem when selecting maxStructs = 0 2015-10-21 20:27:02 +01:00
Greg Landrum
ec62708484 fix NodeLib 2015-10-20 06:40:45 -04:00
Greg Landrum
9f0fb8f688 fix VLib (not yet NodeLib) 2015-10-20 05:00:54 -04:00
Greg Landrum
6e65e2c46c get Dbase tests running 2015-10-20 04:39:40 -04:00
Greg Landrum
b8eef71598 get the DataStructs tests running 2015-10-20 04:36:06 -04:00
Greg Landrum
35a99ac0c5 typo 2015-09-21 18:01:51 +02:00
Greg Landrum
e2487ffe79 update a PAINS based on input from Simon Saubern 2015-08-26 04:59:52 +02:00
Greg Landrum
0a16b3ad32 Merge branch 'master' into Sheridan_fps 2015-08-22 17:49:24 +02:00
Greg Landrum
9f4e543f9c add some tests 2015-08-06 13:36:42 +02:00
Greg Landrum
e52ae4902d update the docs a bit 2015-08-06 13:36:34 +02:00
Greg Landrum
e916171537 fix a few more SMARTS based on the pubchem tests 2015-08-06 13:13:57 +02:00
Greg Landrum
bae063d050 lost a quotation mark somewhere along the way 2015-08-06 13:13:32 +02:00
Greg Landrum
3af4039127 update another PAINS 2015-08-04 13:26:48 +02:00
Greg Landrum
b4151e421c update another PAINS 2015-08-04 13:24:55 +02:00
Greg Landrum
bf74c50716 update another PAINS 2015-08-04 10:10:53 +02:00
Greg Landrum
4cbafab058 update another PAINS 2015-08-04 10:09:36 +02:00
Greg Landrum
6f27bce9e6 update another PAINS 2015-08-04 10:07:59 +02:00
Greg Landrum
3de6700171 update another PAINS 2015-08-04 10:06:03 +02:00
Greg Landrum
75abf1153e update another PAINS 2015-08-04 10:02:54 +02:00
Greg Landrum
f4d59d4b5c update another PAINS 2015-08-04 10:00:20 +02:00
Greg Landrum
2ab9c3ceb0 update another PAINS 2015-08-04 09:59:31 +02:00
Greg Landrum
a3cb636fcd update another PAINS 2015-08-04 09:54:35 +02:00
Greg Landrum
adc95dc691 update another PAINS 2015-08-04 09:52:03 +02:00