Class: Chem::Sybyl::SybylMolecule
- Inherits:
-
Object
- Object
- Chem::Sybyl::SybylMolecule
- Includes:
- Molecule, Enumerable
- Defined in:
- lib/chem/db/sybyl.rb
Constant Summary
Constants included from Molecule
Molecule::EpsHeader, Molecule::MDLCountLineFormat
Instance Attribute Summary
Attributes included from Molecule
Attributes included from Graph
Instance Method Summary collapse
-
#initialize(filename) ⇒ SybylMolecule
constructor
def charge?.
- #n_atoms ⇒ Object
- #n_bonds ⇒ 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(filename) ⇒ SybylMolecule
def charge?
120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 |
# File 'lib/chem/db/sybyl.rb', line 120 def initialize filename @nodes = [] @edges = [] File.open(filename) do |input| input.read.split("\n@").each do |line| ary = line.split("\n") case ary[0] when /<TRIPOS>MOLECULE/ parse_mol ary when /<TRIPOS>ATOM/ ary[1..-1].each{|line| @nodes.push(SybylAtom.new(line))} when /<TRIPOS>BOND/ ary[1..-1].each do |line| bond = SybylBond.new(line) @edges.push([bond, @nodes[bond.e - 1], @nodes[bond.b - 1]]) end end end end end |
Instance Method Details
#n_atoms ⇒ Object
117 |
# File 'lib/chem/db/sybyl.rb', line 117 def n_atoms ; @n_atoms ||= @count_line[0..4].to_i ; end |
#n_bonds ⇒ Object
118 |
# File 'lib/chem/db/sybyl.rb', line 118 def n_bonds ; @n_bonds ||= @count_line[5..10].to_i ; end |