예제 #1
0
파일: chem.py 프로젝트: zidarsk8/orange-bio
 def ToCannonicalSmiles(self):
     atomCache={}
     mol=OBMol()
     for sourceAtom in self.atoms:
         atom=mol.NewAtom()
         atom.SetAtomicNum(sourceAtom.GetAtomicNum())
         if sourceAtom.IsAromatic():
             atom.SetAromatic()
             atom.SetSpinMultiplicity(2)
         atomCache[sourceAtom]=atom
     for sourceBond in self.bonds:
         mol.AddBond(atomCache[sourceBond.atom1].GetIdx(), atomCache[sourceBond.atom2].GetIdx(), sourceBond.GetBondOrder())
     writer=OBConversion()
     writer.SetInAndOutFormats("smi", "can")
     return writer.WriteString(mol).strip()
예제 #2
0
파일: chem.py 프로젝트: zidarsk8/orange-bio
    def ToOBMol(self):
        atomCache={}
        mol=OBMol()
        mol.BeginModify()
        for sourceAtom in self.atoms:
            atom=mol.NewAtom()
            atom.SetAtomicNum(sourceAtom.GetAtomicNum())
            if sourceAtom.IsAromatic():
                atom.SetAromatic()
##                atom.SetSpinMultiplicity(2)
            atomCache[sourceAtom]=atom
        for sourceBond in self.bonds:
            mol.AddBond(atomCache[sourceBond.atom1].GetIdx(), atomCache[sourceBond.atom2].GetIdx(), sourceBond.GetBondOrder())
##        mol.SetAromaticPerceived()
        mol.AssignSpinMultiplicity()
##        mol.UnsetAromaticPerceived()
        mol.EndModify()
        return mol