def test_get_data_loader(self): self.assertIsInstance(get_data_loader("matrix.mtx"), MtxLoader) self.assertIsInstance(get_data_loader("lib.cell.count"), CountLoader) loader = get_data_loader("DATA_MATRIX_LOG_TPM.txt") self.assertIsInstance(loader, Loader) self.assertIsInstance(get_data_loader("data.xls"), ExcelLoader) self.assertIsInstance(get_data_loader("data.loom"), LoomLoader)
def test_n_genes_n_cells(self): file_name = os.path.join(os.path.dirname(__file__), "data/10x/hg19/matrix.mtx") loader = get_data_loader(file_name) self.assertEqual(loader.n_genes, loader.n_rows) self.assertEqual(loader.n_cells, loader.n_cols) file_name = os.path.join(os.path.dirname(__file__), "DATA_MATRIX_LOG_TPM.txt") loader = get_data_loader(file_name) self.assertEqual(loader.n_genes, loader.n_rows) self.assertEqual(loader.n_cells, loader.n_cols)
def set_current_path(self, path): if samepath(self._current_path, path): return model = self.recent_model index = -1 pathitem = None for i in range(model.rowCount()): item = model.item(i) data = item.data(Qt.UserRole) if item is not None else None if isinstance(data, RecentPath) and samepath(path, data.abspath): index, pathitem = i, data break rpaths = [] if pathitem is None: assert index == -1 pathitem = RecentPath.create(path, rpaths) if index != -1: item = model.takeRow(index) else: item = RecentPath_asqstandarditem(pathitem) model.insertRow(0, item) self._current_path = path self.recent_combo.setCurrentIndex(0) self._data_loader = get_data_loader(path) self._update_summary() self.setup_gui() self._invalidate()
def test_get_data_loader_compressed_file(self): loader = get_data_loader("lib.cell.count.gz") self.assertIsInstance(loader, CountLoader)
def test_get_data_loader_pickle(self): self.assertIsInstance(get_data_loader("data.pkl"), PickleLoader) self.assertIsInstance(get_data_loader("data.pickle"), PickleLoader)