Class: Chemicalml::Convention::Molecular::Constraints::BondStereoWedgeHashMustHaveAtomRefs2
- Inherits:
-
Constraint::NodeConstraint
- Object
- Constraint
- Constraint::NodeConstraint
- Chemicalml::Convention::Molecular::Constraints::BondStereoWedgeHashMustHaveAtomRefs2
- Defined in:
- lib/chemicalml/convention/molecular/constraints/bond_stereo_wedge_hash_must_have_atom_refs2.rb
Overview
Molecular convention: <bondStereo> value W (wedge) or H
(hatch) MUST have atomRefs2 and MUST NOT have atomRefs4.
Constant Summary collapse
- WEDGE_HASH_VALUES =
%w[W H].freeze
Instance Method Summary collapse
Methods inherited from Constraint::NodeConstraint
Instance Method Details
#check_node(node, path) ⇒ Object
13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 |
# File 'lib/chemicalml/convention/molecular/constraints/bond_stereo_wedge_hash_must_have_atom_refs2.rb', line 13 def check_node(node, path) value = node.content.to_s.upcase return [] unless WEDGE_HASH_VALUES.include?(value) violations = [] if node.atom_refs2.to_s.strip.empty? violations << violation( path: (path + [describe(node)]).join('/'), message: "bondStereo value #{value.inspect} must have atomRefs2 " \ '(first atom = sharp end, second = blunt end)' ) end unless node.atom_refs4.to_s.strip.empty? violations << violation( path: (path + [describe(node)]).join('/'), message: "bondStereo value #{value.inspect} must not have atomRefs4 " \ '(only C/T cis-trans values use atomRefs4)' ) end violations end |