Ejemplo n.º 1
0
 def test_writeLimit(self):
     db = setupDB()
     data_scheme = registration.MolDocScheme()
     assert 10 == write.WriteFromSDF(db.molecules,
                                     'data/test_data/first_200.props.sdf',
                                     data_scheme,
                                     limit=10)
Ejemplo n.º 2
0
 def test_WriteMolListCount(self):
     db = setupDB()
     data_scheme = registration.MolDocScheme()
     f = open('data/zinc.frags.500.q.smi')
     frags = [Chem.MolFromSmiles(line.split()[0]) for line in f]
     f.close()
     write.WriteFromMolList(db.molecules, frags, data_scheme)
     assert 499 == db.molecules.count_documents({})
Ejemplo n.º 3
0
 def test_uniqueInsertion(self):
     db = setupDB()
     data_scheme = registration.MolDocScheme()
     assert 200 == write.WriteFromSDF(db.molecules,
                                      'data/test_data/first_200.props.sdf',
                                      data_scheme)
     assert 0 == write.WriteFromSDF(db.molecules,
                                    'data/test_data/first_200.props.sdf',
                                    data_scheme)
Ejemplo n.º 4
0
 def test_hashes(self):
     db = setupDB()
     data_scheme = registration.MolDocScheme()
     data_scheme.set_index("CanonicalSmiles")
     assert 200 == write.WriteFromSDF(db.molecules,
                                      'data/test_data/first_200.props.sdf',
                                      data_scheme)
     data_scheme.set_index("inchikey_standard")
     assert 200 == write.WriteFromSDF(db.molecules,
                                      'data/test_data/first_200.props.sdf',
                                      data_scheme)
Ejemplo n.º 5
0
 def test_invalidIndex(self):
     db = setupDB()
     data_scheme = registration.MolDocScheme()
     with pytest.raises(Exception):
         data_scheme.set_index('moo')