> I've been trying to generate molecules programatically in Python when I found 
> a buggy behavior.

When you're creating molecules programmatically, you need to make sure you set 
the perception flags.

In your case, OBAtom calls:

OBResidue *OBAtom::GetResidue()
  {
    OBMol *mol = this->GetParent();
    if (!mol->HasChainsPerceived())
      chainsparser.PerceiveChains(*mol);

    return _residue;
  }

Since you didn't set OBMol::SetChainsPerceived(true) it's going to throw away 
your perception, attempt to find the backbone, etc.

It's in the documentation, but generating molecules programmatically definitely 
has some touch points:
> Residue information is preserved if the original OBMol is marked as having 
> its residues perceived. If this is not desired, either call 
> OBMol::SetChainsPerceived(false) in advance on the original OBMol to avoid 
> copying the residues (and then reset it afterwards), or else call it on the 
> new OBMol so that residue information will be reperceived (when requested).


Hope that helps,
-Geoff

_______________________________________________
OpenBabel-discuss mailing list
OpenBabel-discuss@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/openbabel-discuss

Reply via email to