Esempio n. 1
0
    def testCarbeneIdentifiers(self):
        """
        Test that singlet carbene molecules, bearing an electron pair rather than unpaired electrons
        are correctly converted into rdkit molecules and identifiers.
        """
        

        ch2_t = '''
        multiplicity 3
        1 C u2 p0 c0 {2,S} {3,S}
        2 H u0 p0 c0 {1,S}
        3 H u0 p0 c0 {1,S}
        '''
        
        mol = Molecule().fromAdjacencyList(ch2_t)
    
        self.assertEqual( mol.toAugmentedInChI(), 'InChI=1S/CH2/h1H2/mult3')
        self.assertEqual( mol.toSMILES(), '[CH2]')
        

        ch2_s = '''
        multiplicity 1
        1 C u0 p1 c0 {2,S} {3,S}
        2 H u0 p0 c0 {1,S}
        3 H u0 p0 c0 {1,S}
        '''
        
        mol = Molecule().fromAdjacencyList(ch2_s)
        self.assertEqual( mol.toAugmentedInChI(), 'InChI=1S/CH2/h1H2/mult1')
        self.assertEqual( mol.toSMILES(), '[CH2]')
Esempio n. 2
0
    def testCarbeneIdentifiers(self):
        """
        Test that singlet carbene molecules, bearing an electron pair rather than unpaired electrons
        are correctly converted into rdkit molecules and identifiers.
        """

        ch2_t = '''
        multiplicity 3
        1 C u2 p0 c0 {2,S} {3,S}
        2 H u0 p0 c0 {1,S}
        3 H u0 p0 c0 {1,S}
        '''

        mol = Molecule().fromAdjacencyList(ch2_t)

        self.assertEqual(mol.toAugmentedInChI(), 'InChI=1S/CH2/h1H2/mult3')
        self.assertEqual(mol.toSMILES(), '[CH2]')

        ch2_s = '''
        multiplicity 1
        1 C u0 p1 c0 {2,S} {3,S}
        2 H u0 p0 c0 {1,S}
        3 H u0 p0 c0 {1,S}
        '''

        mol = Molecule().fromAdjacencyList(ch2_s)
        self.assertEqual(mol.toAugmentedInChI(), 'InChI=1S/CH2/h1H2/mult1')
        self.assertEqual(mol.toSMILES(), '[CH2]')
Esempio n. 3
0
 def testAugmentedInChI(self):
     """
     Test that Augmented InChI generation is printing the /mult layer
     """
     mol = Molecule().fromAdjacencyList("""
         1     C     u1 p0 c0 {2,S}
         2     C     u1 p0 c0 {1,S}
     """, saturateH=True)
     
     self.assertEqual(mol.toAugmentedInChI(), 'InChI=1S/C2H4/c1-2/h1-2H2/mult3')
Esempio n. 4
0
    def testAugmentedInChI(self):
        """
        Test that Augmented InChI generation is printing the /mult layer
        """
        mol = Molecule().fromAdjacencyList("""
            1     C     u1 p0 c0 {2,S}
            2     C     u1 p0 c0 {1,S}
        """,
                                           saturateH=True)

        self.assertEqual(mol.toAugmentedInChI(),
                         'InChI=1S/C2H4/c1-2/h1-2H2/mult3')