Ejemplo n.º 1
0
 def test_save(self):
     DB_SAVE_TEMP_FILE = join(dirname(__file__), 'temp.db_save_temp.sqlite')
     ramifier = RotatingRamifier.from_file(4, KMER_ROTATION)
     db = GridCoverDB(sqlite3.connect(DB_SAVE_TEMP_FILE),
                      ramifier=ramifier,
                      box_side_len=0.5)
     db.py_add_point_to_cluster(np.array([0., 0., 0., 0.]), KMER_31)
     db.close()
     remove(DB_SAVE_TEMP_FILE)
Ejemplo n.º 2
0
 def test_save_and_reload(self):
     DB_SAVE_TEMP_FILE = join(dirname(__file__), 'temp.db_save_temp.sqlite')
     ramifier = RotatingRamifier.from_file(4, KMER_ROTATION)
     db = GridCoverDB(sqlite3.connect(DB_SAVE_TEMP_FILE),
                      ramifier=ramifier,
                      box_side_len=0.5)
     db.py_add_point_to_cluster(np.array([0., 0., 0., 0.]), KMER_31)
     db.close()
     del db
     db = GridCoverDB.load_from_filepath(DB_SAVE_TEMP_FILE)
     members = db.py_get_cluster_members(0)
     self.assertEqual(len(members), 1)
     self.assertIn(KMER_31,
                   [reverse_convert_kmer(member) for member in members])
     remove(DB_SAVE_TEMP_FILE)