Class: Chem::SmilesMol
- Inherits:
-
Object
- Object
- Chem::SmilesMol
- Includes:
- Molecule, Enumerable
- Defined in:
- lib/chem/db/smiles/smiparser.rb
Constant Summary
Constants included from Molecule
Molecule::EpsHeader, Molecule::MDLCountLineFormat
Instance Attribute Summary collapse
-
#edges ⇒ Object
readonly
Returns the value of attribute edges.
-
#nodes ⇒ Object
readonly
Returns the value of attribute nodes.
Attributes included from Molecule
Attributes included from Graph
Instance Method Summary collapse
-
#initialize ⇒ SmilesMol
constructor
A new instance of SmilesMol.
- #join(from, to) ⇒ Object
Methods included from Molecule
#-, #assign_2d_geometry, #breadth_first_search, #canonical_ring, #composition, #connected?, #deep_dup, #delete, #delete_bond, #depth_first_search, #divide, #find_smallest_ring, #find_sssr, #induced_sub, #molecular_weight, #n_hydrogen, #oxidation_number, #save, #save_as_mdl, #save_as_pdf, #search_pubchem, #subset_in_composition?, #to_cansmi, #to_eps, #to_sybyl, #trim
Methods included from Graph
#adj_matrix, #adjacency_list, #adjacent_to, #clustering_coefficient, #connection, #each, #match_by_adj_mat, #match_by_ullmann, #match_exhaustively, #matchable, #matchable_old, #morgan
Constructor Details
#initialize ⇒ SmilesMol
Returns a new instance of SmilesMol.
353 354 355 356 |
# File 'lib/chem/db/smiles/smiparser.rb', line 353 def initialize @nodes = [] @edges = [] end |
Instance Attribute Details
#edges ⇒ Object (readonly)
Returns the value of attribute edges.
351 352 353 |
# File 'lib/chem/db/smiles/smiparser.rb', line 351 def edges @edges end |
#nodes ⇒ Object (readonly)
Returns the value of attribute nodes.
351 352 353 |
# File 'lib/chem/db/smiles/smiparser.rb', line 351 def nodes @nodes end |
Instance Method Details
#join(from, to) ⇒ Object
358 359 360 361 362 363 364 365 366 367 368 369 370 371 |
# File 'lib/chem/db/smiles/smiparser.rb', line 358 def join from, to return if to.bond == '.' bond = SmilesBond.new case to.bond when '=' bond.v = 2 when '#' bond.v = 3 else bond.v = 1 end @edges.push([bond, from, to]) end |