Skip to content

Commit

Permalink
update between tester with min_r and max_p
Browse files Browse the repository at this point in the history
  • Loading branch information
sterrettJD committed Sep 5, 2024
1 parent 40fcf97 commit d809027
Showing 1 changed file with 10 additions and 2 deletions.
12 changes: 10 additions & 2 deletions tests/test_between_correls.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
from SCNIC.general import simulate_correls
from SCNIC.between_correls import between_correls
from biom.util import biom_open
import pytest


def test_between_correls(tmpdir):
Expand All @@ -13,7 +14,14 @@ def test_between_correls(tmpdir):
with biom_open(str(loc.join("table2.biom")), 'w') as f:
table2.to_hdf5(f, 'madebyme')
os.chdir(str(loc))
between_correls('table1.biom', 'table2.biom', 'out_dir', correl_method='pearson', max_p=.1)
files = os.listdir(str(loc)+'/out_dir')

# P value based module making is not yet implemented, check this
with pytest.raises(Exception) as exc_info:
between_correls('table1.biom', 'table2.biom', 'out_dir', correl_method='pearson', max_p=.1)
assert exc_info.value.args[0] == "SCNIC does not currently support module making based on p-values."

# Run with min r threshold and check that files exist
between_correls('table1.biom', 'table2.biom', 'out_dir_2', correl_method='pearson', min_r=.2)
files = os.listdir(str(loc)+'/out_dir_2')
assert "correls.txt" in files
assert "crossnet.gml" in files

0 comments on commit d809027

Please sign in to comment.