Skip to content

Commit

Permalink
Remove tests related to mitochondrial gene detection from filter_with…
Browse files Browse the repository at this point in the history
…_counts
  • Loading branch information
DriesSchaumont committed Oct 16, 2023
1 parent 1836e92 commit 17180b6
Showing 1 changed file with 0 additions and 83 deletions.
83 changes: 0 additions & 83 deletions src/filter/filter_with_counts/test.py
Original file line number Diff line number Diff line change
Expand Up @@ -90,9 +90,6 @@ def test_filtering_a_little(run_component, input_path,
"--min_genes_per_cell", "200",
"--max_genes_per_cell", "1500000",
"--min_cells_per_gene", "10",
"--min_fraction_mito", "0",
"--max_fraction_mito", "0.2",
"--var_gene_names", "gene_symbol",
"--do_subset"])
assert Path("output-2.h5mu").is_file()
mu_out = mu.read_h5mu("output-2.h5mu")
Expand Down Expand Up @@ -122,85 +119,5 @@ def test_filter_cells_without_counts(run_component, input_h5mu, tmp_path):
assert "mitochondrial" not in mu_out.mod['rna'].var


def test_filter_mitochondrial(run_component, input_path,
input_n_rna_obs, input_n_prot_obs,
input_n_rna_vars, input_n_prot_vars):
run_component([
"--input", input_path,
"--output", "output-4.h5mu",
"--var_gene_names", "gene_symbol",
"--max_fraction_mito", "0.2",
"--do_subset"
])
assert Path("output-4.h5mu").is_file()
mu_out = mu.read_h5mu("output-4.h5mu")
new_obs = mu_out.mod['rna'].n_obs
new_vars = mu_out.mod['rna'].n_vars
assert new_obs < input_n_rna_obs
assert new_vars == input_n_rna_vars
assert mu_out.mod['prot'].n_obs == input_n_prot_obs
assert mu_out.mod['prot'].n_vars == input_n_prot_vars
assert list(mu_out.mod['rna'].var['feature_types'].cat.categories) == ["Gene Expression"]
assert list(mu_out.mod['prot'].var['feature_types'].cat.categories) == ["Antibody Capture"]
assert "mitochondrial" not in mu_out.mod['rna'].var

def test_filter_mitochondrial_regex(run_component, input_path,
input_n_rna_obs, input_n_prot_obs,
input_n_rna_vars, input_n_prot_vars):
run_component([
"--input", input_path,
"--output", "output-5.h5mu",
"--var_gene_names", "gene_symbol",
"--max_fraction_mito", "0.2",
"--mitochondrial_gene_regex", "^[M][T]-",
"--do_subset"
])
assert Path("output-5.h5mu").is_file()
mu_out = mu.read_h5mu("output-5.h5mu")
new_obs = mu_out.mod['rna'].n_obs
new_vars = mu_out.mod['rna'].n_vars
assert new_obs < input_n_rna_obs
assert new_vars == input_n_rna_vars
assert mu_out.mod['prot'].n_obs == input_n_prot_obs
assert mu_out.mod['prot'].n_vars == input_n_prot_vars
assert list(mu_out.mod['rna'].var['feature_types'].cat.categories) == ["Gene Expression"]
assert list(mu_out.mod['prot'].var['feature_types'].cat.categories) == ["Antibody Capture"]
assert "mitochondrial" not in mu_out.mod['rna'].var


def test_filter_mitochondrial_column_not_set(run_component, input_path,
input_n_rna_obs, input_n_prot_obs,
input_n_rna_vars, input_n_prot_vars):
run_component([
"--input", input_path,
"--output", "output-6.h5mu",
"--max_fraction_mito", "0.2",
"--mitochondrial_gene_regex", "^[mM][tT]-",
"--do_subset"
])
assert Path("output-6.h5mu").is_file()
mu_out = mu.read_h5mu("output-6.h5mu")
new_obs = mu_out.mod['rna'].n_obs
new_vars = mu_out.mod['rna'].n_vars
assert new_obs == input_n_rna_obs # Stays the same because filtering on the wrong column
assert new_vars == input_n_rna_vars
assert mu_out.mod['prot'].n_obs == input_n_prot_obs
assert mu_out.mod['prot'].n_vars == input_n_prot_vars
assert list(mu_out.mod['rna'].var['feature_types'].cat.categories) == ["Gene Expression"]
assert list(mu_out.mod['prot'].var['feature_types'].cat.categories) == ["Antibody Capture"]
assert "mitochondrial" not in mu_out.mod['rna'].var.columns

def test_var_name_mitochondrial_genes(run_component, input_path):
run_component([
"--input", input_path,
"--output", "output-4.h5mu",
"--var_gene_names", "gene_symbol",
"--max_fraction_mito", "0.2",
"--var_name_mitochondrial_genes", "mitochondrial"
])
assert Path("output-6.h5mu").is_file()
mu_out = mu.read_h5mu("output-4.h5mu")
assert "mitochondrial" in mu_out.mod['rna'].var.columns

if __name__ == "__main__":
exit(pytest.main([__file__]))

0 comments on commit 17180b6

Please sign in to comment.