Thanks! It works great!

> El 13 dic 2017, a las 12:15, Paolo Tosco <paolo.to...@unito.it> escribió:
> 
> Hi Marina,
> 
> If you wish to assign stereochemistry from the atom block parity flag rather 
> than from 3D coordinates you might try the following:
> 
> #include <GraphMol/RDKitBase.h>
> #include <GraphMol/FileParsers/MolSupplier.h>
> #include <GraphMol/SmilesParse/SmilesWrite.h>
> #include <string>
> #include <iostream>
> 
> int main(int argc, char **argv) {
>     std::string in_file_name = "zinc_3833800.sdf";
> 
>     RDKit::SDMolSupplier mol_supplier( in_file_name , true );
> 
>     for (unsigned int i = 0; i < mol_supplier.length(); ++i) {
>             RDKit::ROMOL_SPTR mol(mol_supplier[i]);
> 
>             if (!mol){
>                 std::cout << "Error, molecule not found!" << std::endl;
>                 continue;
>             }
> 
> 
>             for (unsigned int j = 0; j < mol->getNumAtoms(); j++){
>                 RDKit::Atom* atom = mol->getAtomWithIdx(j);
>                 if (atom->hasProp(RDKit::common_properties::molParity)) {
>                     int parity;
>                     atom->getProp(RDKit::common_properties::molParity, 
> parity);
>                     switch (parity) {
>                     case 1:
>                         atom->setChiralTag(RDKit::Atom::CHI_TETRAHEDRAL_CW);
>                         break;
>                     case 2:
>                         atom->setChiralTag(RDKit::Atom::CHI_TETRAHEDRAL_CCW);
>                         break;
>                     default:
>                         atom->setChiralTag(RDKit::Atom::CHI_UNSPECIFIED);
>                         break;
>                     }
>                 }
>                 std::cout << "Chirality atom " << j+1  << ": " << 
> atom->getChiralTag() << std::endl;
>             }
> 
>             std::string usmiles = RDKit::MolToSmiles (*mol, true);
>             std::cout << "Mol: " << usmiles << std::endl;
>     }
> }
> 
> Cheers,
> p.
> 

------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
_______________________________________________
Rdkit-discuss mailing list
Rdkit-discuss@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/rdkit-discuss

Reply via email to