def test_read_write_h5ad(self): adata = scc.read_input( "tests/scCloud-test-data/input/hgmm_1k_v3_filtered_feature_bc_matrix/" ) scc.write_output(adata, "test.h5ad") adata2 = scc.read_input("test.h5ad") assert_adata_equal(self, adata, adata2)
def test_read_write_old_5ad_backed_whitelist(self): shutil.copy( "tests/scCloud-test-data/input/test_obsm_compound.h5ad", "test_obsm_compound.h5ad", ) adata = scc.read_input("test_obsm_compound.h5ad", h5ad_mode="r+") scc.write_output(adata, "test_obsm_compound.h5ad", whitelist=['obs']) adata2 = scc.read_input("test_obsm_compound.h5ad") assert_adata_equal(self, adata, adata2)
def test_aggregate_10x_matrices(self): m1 = scc.read_input( "tests/scCloud-test-data/input/heart_1k_v3/filtered_feature_bc_matrix.h5", genome="mm10", ) m2 = scc.read_input( "tests/scCloud-test-data/input/heart_1k_v2/filtered_gene_bc_matrices_h5.h5", genome="mm10", ) scc.aggregate_matrices( "tests/scCloud-test-data/input/aggregate_test.csv", restrictions=[], attributes=["Version"], what_to_return="aggregate_test", google_cloud=False, select_singlets=False, ngene=None, ) result = scc.read_input("aggregate_test.h5sc", genome="mm10") self.assertEqual(m1.shape[0] + m2.shape[0], result.shape[0], "Cell dimension is incorrect") self.assertEqual(m1.shape[1], result.shape[1], "Gene dimension is incorrect") self.assertTrue( result.obs.get("Version") is not None, "Version not added") m1_result = result[list(range(m1.shape[0])), :] m2_result = result[list(range(m1.shape[0], m1.shape[0] + m2.shape[0])), :] self.assertEqual((m1_result.X != m1.X).sum(), 0, "Values differ") self.assertEqual((m2_result.X != m2.X).sum(), 0, "Values differ") self.assertTrue( m1_result.obs.index.values[0].startswith("heart_1k_v3"), "Prefix not added") self.assertTrue( m2_result.obs.index.values[0].startswith("heart_1k_v2"), "Prefix not added")
def test_read_write_old_5ad(self): adata = scc.read_input( "tests/scCloud-test-data/input/test_obsm_compound.h5ad") scc.write_output(adata, "test.h5ad") adata2 = scc.read_input("test.h5ad") assert_adata_equal(self, adata, adata2)
def test_mtx_v3_dir(self): adata = scc.read_input( "tests/scCloud-test-data/input/hgmm_1k_v3_filtered_feature_bc_matrix/" ) self.assertEqual(adata.shape[0], 1046)
def test_mtx_v2_dir(self): adata = scc.read_input( "tests/scCloud-test-data/input/hgmm_1k_filtered_gene_bc_matrices/hg19/" ) self.assertEqual(adata.shape[0], 504)