Skip to content

Commit 80ef00d

Browse files
author
OliverBScott
committed
Added tests for CSE
1 parent 3ef69f9 commit 80ef00d

4 files changed

Lines changed: 37 additions & 0 deletions

File tree

.codecov.yml

Whitespace-only changes.

tests/analysis/__init__.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
"""
2+
scaffoldgraph tests.analysis
3+
"""

tests/analysis/test_cse.py

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
"""
2+
scaffoldgraph tests.analysis.test_cse
3+
"""
4+
5+
import random
6+
7+
import scaffoldgraph as sg
8+
from scaffoldgraph.analysis import CSE
9+
10+
11+
def test_cse(sdf_file):
12+
network = sg.ScaffoldNetwork.from_sdf(sdf_file)
13+
mol_nodes = network.get_molecule_nodes()
14+
15+
mapping = {n: random.random() for n in mol_nodes}
16+
cse = CSE(hypothesis_test='ks')
17+
cse.fit(network, mapping, progress=False)
18+
assert len(cse) == 8
19+
assert 'PVAL' in cse['c1ccccc1'].keys()
20+
assert 'KS' in cse['c1ccccc1'].keys()
21+
22+
df = cse.to_dataframe()
23+
assert 'SCAFFOLD' in df.columns
24+
assert 'PVAL' in df.columns
25+
assert 'CRIT' in df.columns
26+
27+
mapping = {n: random.getrandbits(1) for n in mol_nodes}
28+
cse = CSE(hypothesis_test='binom')
29+
cse.fit(network, mapping, progress=False)
30+
assert len(cse) == 8
31+
assert 'PVAL' in cse['c1ccccc1'].keys()
32+
assert 'CRIT' in df.columns
33+
34+
assert repr(cse) == '<CSE at {}>'.format(hex(id(cse)))

tests/io/test_dataframe.py

Whitespace-only changes.

0 commit comments

Comments
 (0)