Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion requirements/requirements_loose.txt
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
numpy
numba
statsmodels
pandas<3
pandas<3 # test: tolerate_version
scipy
matplotlib
seaborn
Expand Down
14 changes: 5 additions & 9 deletions tests/unit_tests/test_cluster_missingval.py
Original file line number Diff line number Diff line change
Expand Up @@ -62,29 +62,25 @@ def setup_method(self):

def test_mod_seq_charge_tree(self):
root = _tree_with_mod_seq_charge()
aq_missingval.determine_missingval_test_level(root)
assert aq_missingval.MISSINGVAL_TEST_LEVEL == "mod_seq_charge"
assert aq_missingval._determine_missingval_test_level(root) == "mod_seq_charge"

def test_mod_seq_above_leaves(self):
root = _tree_mod_seq_above_leaves()
aq_missingval.determine_missingval_test_level(root)
assert aq_missingval.MISSINGVAL_TEST_LEVEL == "base"
assert aq_missingval._determine_missingval_test_level(root) == "base"

def test_seq_above_leaves(self):
root = _tree_seq_above_leaves()
aq_missingval.determine_missingval_test_level(root)
assert aq_missingval.MISSINGVAL_TEST_LEVEL == "base"
assert aq_missingval._determine_missingval_test_level(root) == "base"

def test_gene_above_leaves(self):
root = _tree_gene_above_leaves()
aq_missingval.determine_missingval_test_level(root)
assert aq_missingval.MISSINGVAL_TEST_LEVEL == "base"
assert aq_missingval._determine_missingval_test_level(root) == "base"

def test_unexpected_structure_raises(self):
root = anytree.Node("root", type="unknown_top")
anytree.Node("leaf", parent=root, type="base")
with pytest.raises(ValueError, match="Unexpected tree structure"):
aq_missingval.determine_missingval_test_level(root)
aq_missingval._determine_missingval_test_level(root)


class TestGetNodesToTest:
Expand Down
5 changes: 3 additions & 2 deletions tests/unit_tests/test_diff_analysis.py
Original file line number Diff line number Diff line change
Expand Up @@ -39,8 +39,9 @@ def test_noreg_pepdist(condbg):
assert ks_stat > 0.01

def perform_peptide_difftest(condbg, noNanvals_from, bg_idx1, noNanvals_to, bg_idx2):
bgdist_from = condbg.backgrounds[bg_idx1]
bgdist_to = condbg.backgrounds[bg_idx2]
ions = list(condbg.ion2background.keys())
bgdist_from = condbg.ion2background[ions[bg_idx1]]
bgdist_to = condbg.ion2background[ions[bg_idx2]]
p2z = {}
diffbg = aq_diff_bg.SubtractedBackgrounds(bgdist_from, bgdist_to, p2z)
diffion = aq_diff_diff.DifferentialIon(noNanvals_from, noNanvals_to, diffbg, "", outlier_correction=False)
Expand Down
6 changes: 3 additions & 3 deletions tests/unit_tests/test_intensity_summarization.py
Original file line number Diff line number Diff line change
Expand Up @@ -257,14 +257,14 @@ def test_frgion_and_ms1(self, condition_dfs):
assert len(r1) == 3

def test_asymmetric_conditions(self):
"""Ion present in c1 but not c2 — group is skipped in c2."""
"""Ion present in c1 but not c2 — only ions in both conditions are summed."""
df_c1 = _make_df([FRGION_Y3, FRGION_Y4], {"s1": np.log2([100.0, 50.0])})
df_c2 = _make_df([FRGION_Y3], {"s2": np.log2([90.0])})
pep2prot = {FRGION_Y3: PROT, FRGION_Y4: PROT}

r1, r2, rp = aq_summ.apply_summarization(df_c1, df_c2, pep2prot, ["frgion"])
# c1: y3+y4 summed; c2: only y3 present -> partial sum
# Y4 is absent from c2, so only Y3 (present in both) is used for the sum
assert len(r1) == 1
assert len(r2) == 1
assert np.isclose(r1.iloc[0, 0], np.log2(150.0))
assert np.isclose(r1.iloc[0, 0], np.log2(100.0))
assert np.isclose(r2.iloc[0, 0], np.log2(90.0))
4 changes: 4 additions & 0 deletions tests/unit_tests/test_residual_decorrelation.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@
from pathlib import Path
import sys

import pytest

import anytree
import numpy as np
import pandas as pd
Expand All @@ -13,6 +15,8 @@

def _load_reference_module():
path = Path("sandbox/analyses_revision_v3/paper_nbs_revision/10_alphaquant_mouse_aq/residual_correlation/auto_decorrelation.py")
if not path.exists():
pytest.skip("Reference sandbox file not available in this environment")
spec = importlib.util.spec_from_file_location("auto_decorrelation_ref", path)
module = importlib.util.module_from_spec(spec)
assert spec.loader is not None
Expand Down
Loading