Re: [Rdkit-discuss] Stereo information lost

2017-12-14 Thread Marina Garcia de Lomana
Thanks! It works great!


> El 13 dic 2017, a las 12:15, Paolo Tosco  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 
> #include 
> #include 
> #include 
> #include 
> 
> 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


Re: [Rdkit-discuss] Stereo information lost

2017-12-13 Thread Paolo Tosco

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 
#include 
#include 
#include 
#include 

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.

On 13/12/2017 09:39, Marina Garcia de Lomana wrote:

Thanks for your answer Paolo!
But I would need to read in the stereochemistry information from the 
SD file (7th column in the atom block) and not calculate the chirality 
from the coordinates, since this way the information about racemates 
would get lost.


Is there a way to do that?


El 13 dic 2017, a las 10:27, Paolo Tosco > escribió:


Hi Marina,

I assume you are using this SDF file:

http://zinc11.docking.org/fget.pl?l=0=57393683=d

which contains 3D coordinates and no wedge bond information. If this 
is the case, you will need to call 
MolOps::assignStereochemistryFrom3D() 
 
to assign the chiral tags before accessing them.


If you are also interested in E/Z double bond stereochemistry you 
will need the following three calls before accessing stereochemistry 
descriptors:


MolOps:: 
detectBondStereochemistry 
 
(*mol)
MolOps:: 
assignStereochemistryFrom3D 
 
(*mol)
MolOps:: 
assignStereochemistry 
 
(*mol);


Hope that helps, cheers
p.

On 12/12/17 18:18, Marina Garcia de Lomana wrote:


Hi,
I am using the following C++ script to read a molecule from a SD 
file (with defined stereochemistry), but the information about the 
stereochemistry gets lost. The file I am using is from glucose 
(ZINC03833800; http://zinc.docking.org/substance/3833800)
When I check the chiral information of the atoms, all of them have 
the chiral tag 0.


How can I keep the stereo information?

SCRIPT:

|std::fstream infilestr; infilestr.open(in_file_name.c_str( )); 
RDKit::SDMolSupplier mol_supplier( in_file_name , true ); for 
(unsigned 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); std::cout << "Chirality atom " << j+1 << ": 
" << atom->getChiralTag() << std::endl; } std::string usmiles = 
RDKit::MolToSmiles (*mol); std::cout << "Mol: " << usmiles << 
std::endl; } |



OUTPUT FOR GLUCOSE (ZINC03833800):

Chirality atom 1: 0
Chirality atom 2: 0
Chirality atom 3: 0
Chirality atom 4: 0
Chirality atom 5: 0
Chirality atom 6: 0
Chirality atom 7: 0
Chirality atom 8: 0
Chirality atom 9: 0
Chirality atom 10: 0
Chirality atom 11: 0
Chirality atom 12: 0
Mol: OCC1OC(O)C(O)C(O)C1O



--
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

Re: [Rdkit-discuss] Stereo information lost

2017-12-13 Thread Marina Garcia de Lomana
Ok thank you for the help!

Marina

> El 13 dic 2017, a las 11:22, Greg Landrum  escribió:
> 
> 
> On Wed, Dec 13, 2017 at 10:39 AM, Marina Garcia de Lomana 
> > wrote:
> Thanks for your answer Paolo!
> But I would need to read in the stereochemistry information from the SD file 
> (7th column in the atom block) and not calculate the chirality from the 
> coordinates, since this way the information about racemates would get lost.
> 
> Is there a way to do that?
> 
> There is not. In this case the RDKit follows the recommendation of the 
> documentation for Mol files and ignores that field when reading structures.
> A standard way to indicate that you don't know the stereochemistry of a 
> center despite there being 3D coordinates is to make one of the bonds from it 
> a "squiggly" bond (i.e. bond type 4). The RDKit will recognize this and avoid 
> assigning stereochemistry there.
> 
> A request: please do not post questions both to the mailing list and to 
> github. It's ok to use either one, but if you pick both it just makes more 
> work and confusion for those of us who are trying to answer things.
> 
> Thanks,
> greg
> 

--
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


Re: [Rdkit-discuss] Stereo information lost

2017-12-13 Thread Paolo Tosco

Hi Marina,

I assume you are using this SDF file:

http://zinc11.docking.org/fget.pl?l=0=57393683=d

which contains 3D coordinates and no wedge bond information. If this is 
the case, you will need to call MolOps::assignStereochemistryFrom3D() 
 
to assign the chiral tags before accessing them.


If you are also interested in E/Z double bond stereochemistry you will 
need the following three calls before accessing stereochemistry descriptors:


MolOps:: 
detectBondStereochemistry 
 
(*mol)
MolOps:: 
assignStereochemistryFrom3D 
 
(*mol)
MolOps:: 
assignStereochemistry 
 
(*mol);


Hope that helps, cheers
p.

On 12/12/17 18:18, Marina Garcia de Lomana wrote:


Hi,
I am using the following C++ script to read a molecule from a SD file 
(with defined stereochemistry), but the information about the 
stereochemistry gets lost. The file I am using is from glucose 
(ZINC03833800; http://zinc.docking.org/substance/3833800)
When I check the chiral information of the atoms, all of them have the 
chiral tag 0.


How can I keep the stereo information?

SCRIPT:

|std::fstream infilestr; infilestr.open(in_file_name.c_str( )); 
RDKit::SDMolSupplier mol_supplier( in_file_name , true ); for 
(unsigned 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); 
std::cout << "Chirality atom " << j+1 << ": " << atom->getChiralTag() 
<< std::endl; } std::string usmiles = RDKit::MolToSmiles (*mol); 
std::cout << "Mol: " << usmiles << std::endl; } |



OUTPUT FOR GLUCOSE (ZINC03833800):

Chirality atom 1: 0
Chirality atom 2: 0
Chirality atom 3: 0
Chirality atom 4: 0
Chirality atom 5: 0
Chirality atom 6: 0
Chirality atom 7: 0
Chirality atom 8: 0
Chirality atom 9: 0
Chirality atom 10: 0
Chirality atom 11: 0
Chirality atom 12: 0
Mol: OCC1OC(O)C(O)C(O)C1O



--
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


--
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