Indexed Molecule |
indexed_molecule<Molecule>
There are two possible mappings from the fragment of Figure 1 to the molecule of Figure 2:
Figure 1 indices | Figure 2 indices ----------------------------------------- 0 -------------> 10 1 -------------> 11 2 -------------> 12 3 -------------> 13 4 -------------> 14 5 -------------> 15 andThese two mappings are stored in a member variable in the indexed_molecule class.
Figure 1 indices | Figure 2 indices ----------------------------------------- 0 -------------> 10 1 -------------> 15 2 -------------> 14 3 -------------> 13 4 -------------> 12 5 -------------> 11
As will be explained later, the indexed_molecule<> is the result type of the
application of a substructure search operator to a plain molecule.
indexed_molecule<> inherits from a plain molecule<>. Following
is a synopsis for the new members:
namespace morpho { namespace cdl { template <class Molecule> class indexed_molecule : public Molecule { // //-------- Types // typedef Molecule Base; typedef std::pair<vertex_descriptor,vertex_descriptor> vertex_pair_t; typedef std::vector<std::vector<vertex_pair_t> > vertex_mapping_t; enum dissociation_character_type { NOT_YET_KNOWN = 0 , WAS_CONNECTED = 1 , WAS_FUSED = 2 }; typedef std::pair<size_t,dissociation_character_type> dissociation_pair_t; typedef std::vector<dissociation_pair_t> dissociations_t; // //-------- Functions // //------------- constructors indexed_molecule(); indexed_molecule(const nail_juice<self>&,bool,bool); indexed_molecule(const Base&); indexed_molecule(const graph_type&, bool); indexed_molecule(const indexed_molecule<Molecule>&); //------------- utilities // --- for dissociation_character_type dissociation_character_type diss_not_known(); dissociation_character_type diss_connected(); dissociation_character_type diss_fused(); // --- for dissociations --- const dissociations_t& get_dissociations() const; void put_dissociation(dissociation_pair_t); // --- for the mapping --- const vertex_mapping_t& get_mapping() const; void set_mapping(const vertex_mapping_t&); bool empty() const; std::vector<size_t> get_vertex(size_t) const; std::vector<std::pair<size_t,size_t> > get_vertex_and_map_index(size_t) const; size_t size() const; void delete_mapping(vertex_map_it_t); void delete_mapping(size_t); // //-------- Variables // protected : vertex_mapping_t m_mapping; dissociations_t m_dissociations; }; } // namespace cdl } // namespace morpho
Parameter | Description | Default | Model of / Requirements |
---|---|---|---|
Molecule | Plain molecule<> class | No defaults | morpho::cdl::molecule<> |
All the types of Molecule are injected in this class.
vertex_mapping_tThe type of the mapping. This type will provide all vertex index -> vertex index mappings from a query molecule to this molecule.
dissociation_pair_tType of the dissociation of a vertex. The pair represents: <vertex index, dissociation character>.
dissociations_t;Container that stores the dissociations of the mapping.
All member functions of Molecule are inherited.
indexed_molecule()Constructs an empty indexed_molecule.
indexed_molecule(const nail_juice<self> j;&,bool add_implicit_h = false, bool initialize = true);Constructs an indexed_molecule with the information provided in the nail_juice. The two defaulted boolean arguments indicates to add implicit hydrogens and to initialize the molecule respectively.
indexed_molecule(const Base& b);Constructs an indexed_molecule out of a plain molecule. All maps are empty initialized.
indexed_molecule(const graph_type& g, bool add_implicit_h = false);Constructs an indexed_molecule out of a graph. All the properties of the graph are copied.
indexed_molecule(const indexed_molecule<Molecule>&);Copy constructor.
dissociation_character_type diss_not_known(); dissociation_character_type diss_connected(); dissociation_character_type diss_fused();Returns the dissociation types.
const dissociations_t& get_dissociations() const;Returns a constant reference to the dissociation container.
void put_dissociation(dissociation_pair_t);Puts a dissociation to the dissociations container.
const vertex_mapping_t& get_mapping() const;Returns a constant reference to the mapping container.
void set_mapping(const vertex_mapping_t& map);Sets the mapping container.
bool empty() const;Returns if the mapping container is empty.
std::vector<size_t> get_vertex(size_t v) const;Returns the vertices of this molecule that are mapped to vertex 'v' of the query molecule.
std::vector<std::pair<size_t,size_t> > get_vertex_and_map_index(size_t v) const;Returns a container of pairs: the vertices of this molecule that are mapped to vertex 'v' of the query molecule, and also returns the index of the map container where that mapping is present. The pair elements represents these respectively.
size_t size() const;Returns the size of the map container.
void delete_mapping(vertex_map_it_t pos);Deletes the mapping pointed to by pos.
void delete_mapping(size_t pos);Deletes the mapping of position pos.