/src/openbabel/src/ops/opisomorph.h
Line | Count | Source |
1 | | /********************************************************************** |
2 | | opisomorph.cpp - Enhanced -s option |
3 | | Copyright (C) 2010 by Chris Morley |
4 | | |
5 | | This program is free software; you can redistribute it and/or modify |
6 | | it under the terms of the GNU General Public License as published by |
7 | | the Free Software Foundation version 2 of the License. |
8 | | |
9 | | This program is distributed in the hope that it will be useful, |
10 | | but WITHOUT ANY WARRANTY; without even the implied warranty of |
11 | | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
12 | | GNU General Public License for more details. |
13 | | ***********************************************************************/ |
14 | | #include <openbabel/babelconfig.h> |
15 | | #include <openbabel/op.h> |
16 | | #include <openbabel/mol.h> |
17 | | #include <openbabel/obconversion.h> |
18 | | #include <openbabel/query.h> |
19 | | #include <vector> |
20 | | #include <string> |
21 | | |
22 | | namespace OpenBabel |
23 | | { |
24 | | /** |
25 | | @since version 2.3 |
26 | | Adds an OBPairData object to each atom and bond in a substructure. |
27 | | The substructure's atoms are specified in an input parameter, a |
28 | | vector of atom indx; the bonds are those in the molecule that join |
29 | | these atoms. The attribute and value of the OBPairObject (the same |
30 | | for all the added objects) are specified as parameters. |
31 | | **/ |
32 | | extern bool AddDataToSubstruct(OBMol* pmol, const std::vector<int>& atomIdxs, |
33 | | const std::string& attribute, const std::string& value); |
34 | | |
35 | | /** |
36 | | @since version 2.3 |
37 | | Deletes all atoms except those in @p atomIndxs |
38 | | **/ |
39 | | extern bool ExtractSubstruct(OBMol* pmol, const std::vector<int>& atomIdxs); |
40 | | |
41 | | extern bool MakeQueriesFromMolInFile(std::vector<OBQuery*>& queries |
42 | | , const std::string& filename, int* pnAtoms, bool noH); |
43 | | |
44 | | //***************************************************** |
45 | | class OpNewS : public OBOp |
46 | | { |
47 | | public: |
48 | 24 | OpNewS(const char* ID) : OBOp(ID, false){} |
49 | | const char* Description() override; |
50 | 0 | bool WorksWith(OBBase* pOb) const override { return dynamic_cast<OBMol*>(pOb) != nullptr; } |
51 | | bool Do(OBBase* pOb, const char* OptionText, OpMap* pmap, OBConversion*) override; |
52 | 0 | std::vector<int> GetMatchAtoms(){ return firstmatch; } |
53 | | bool ProcessVec(std::vector<OBBase*>& vec) override; //Extra target mols |
54 | | |
55 | | private: |
56 | | std::vector<std::string> vec; //parsed parameter text |
57 | | std::vector<OBBase*> ExtraMols; //extra OBMols passed in via ProcessVec() (FastSearchFormat) |
58 | | OBSmartsPattern sp; //if SMARTS (and not a filename) supplied |
59 | | std::string xsmarts; //extra SMARTS provided externally via ProcessVec() |
60 | | bool addHydrogens; //The SMARTS contained one or more #1 to explicitly find hydrogen |
61 | | bool inv; |
62 | | int nPatternAtoms; //non-zero for exact matches |
63 | | std::vector<OBQuery*> queries; //populated if a filename was supplied |
64 | | OBQuery* query; |
65 | | std::vector<int> firstmatch; //Idxes of first match by SMARTS or OBIsomorphismMapper |
66 | | bool showAll; |
67 | | int nmatches; |
68 | | char comparechar; |
69 | | }; |
70 | | |
71 | | } //namespace |
72 | | |