Skip to content

Commit

Permalink
finalize tests
Browse files Browse the repository at this point in the history
  • Loading branch information
michabirklbauer committed Jan 11, 2024
1 parent 0a95b61 commit 720d069
Showing 1 changed file with 102 additions and 0 deletions.
102 changes: 102 additions & 0 deletions tests/tests.py
Original file line number Diff line number Diff line change
Expand Up @@ -74,3 +74,105 @@ def test5_msannika_fdr():

# check nr of grouped crosslinks
assert result[0].shape[0] == 3192

# csms file with fdr should validate
def test6_msannika_fdr():

import pandas as pd
from msannika_fdr import main
from msannika_fdr import MSAnnika_CSM_Validator as csm_val

result = main(["DSSO_CSMs.xlsx", "-fdr", "0.01"])

# check nr of results
assert len(result) == 3

#### crosslinks ####

# check nr of grouped crosslinks
assert result[0].shape[0] == 3192

#### validated crosslinks ####

# check nr of validated crosslinks
assert result[2].shape[0] == 714

# check fdr of validated crosslinks
assert result[2][result[2]["Decoy"] == True].shape[0] / result[2][result[2]["Decoy"] == False].shape[0] < 0.01

#### validated csms ####

# check nr of validated csms
assert result[1].shape[0] == 3021

# check fdr of validated csms
results[1]["Class"] = pd.apply(lambda row: csm_val.get_class(row), axis = 1)
assert result[1][result[1]["Class"] == "Decoy"].shape[0] / result[1][result[1]["Class"] == "Target"].shape[0] < 0.01

# csms file with fdr should validate
def test7_msannika_fdr():

import pandas as pd
from msannika_fdr import main
from msannika_fdr import MSAnnika_CSM_Validator as csm_val

result = main(["DSSO_CSMs.xlsx", "-fdr", "1"])

# check nr of results
assert len(result) == 3

#### crosslinks ####

# check nr of grouped crosslinks
assert result[0].shape[0] == 3192

#### validated crosslinks ####

# check nr of validated crosslinks
assert result[2].shape[0] == 714

# check fdr of validated crosslinks
assert result[2][result[2]["Decoy"] == True].shape[0] / result[2][result[2]["Decoy"] == False].shape[0] < 0.01

#### validated csms ####

# check nr of validated csms
assert result[1].shape[0] == 3021

# check fdr of validated csms
results[1]["Class"] = pd.apply(lambda row: csm_val.get_class(row), axis = 1)
assert result[1][result[1]["Class"] == "Decoy"].shape[0] / result[1][result[1]["Class"] == "Target"].shape[0] < 0.01

# csms file with fdr should validate
def test8_msannika_fdr():

import pandas as pd
from msannika_fdr import main
from msannika_fdr import MSAnnika_CSM_Validator as csm_val

result = main(["DSSO_CSMs.xlsx", "-fdr", "0.05"])

# check nr of results
assert len(result) == 3

#### crosslinks ####

# check nr of grouped crosslinks
assert result[0].shape[0] == 3192

#### validated crosslinks ####

# check nr of validated crosslinks
assert result[2].shape[0] == 807

# check fdr of validated crosslinks
assert result[2][result[2]["Decoy"] == True].shape[0] / result[2][result[2]["Decoy"] == False].shape[0] < 0.01

#### validated csms ####

# check nr of validated csms
assert result[1].shape[0] == 3331

# check fdr of validated csms
results[1]["Class"] = pd.apply(lambda row: csm_val.get_class(row), axis = 1)
assert result[1][result[1]["Class"] == "Decoy"].shape[0] / result[1][result[1]["Class"] == "Target"].shape[0] < 0.01

0 comments on commit 720d069

Please sign in to comment.