-
Notifications
You must be signed in to change notification settings - Fork 16
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fixed grouped scores and added test (#65)
* Fixed grouped scores and added test * Updated changelog
- Loading branch information
Showing
3 changed files
with
48 additions
and
5 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
"""Test that Confidence classes are working correctly""" | ||
import pytest | ||
import numpy as np | ||
import pandas as pd | ||
from mokapot import LinearPsmDataset | ||
|
||
|
||
def test_one_group(psm_df_1000): | ||
"""Test that one group is equivalent to no group.""" | ||
psm_data, _ = psm_df_1000 | ||
psm_data["group"] = 0 | ||
|
||
psms = LinearPsmDataset( | ||
psms=psm_data, | ||
target_column="target", | ||
spectrum_columns="spectrum", | ||
peptide_column="peptide", | ||
feature_columns="score", | ||
filename_column="filename", | ||
scan_column="spectrum", | ||
calcmass_column="calcmass", | ||
expmass_column="expmass", | ||
rt_column="ret_time", | ||
charge_column="charge", | ||
group_column="group", | ||
copy_data=True, | ||
) | ||
|
||
np.random.seed(42) | ||
grouped = psms.assign_confidence() | ||
scores1 = grouped.group_confidence_estimates[0].psms["mokapot score"] | ||
|
||
np.random.seed(42) | ||
psms._group_column = None | ||
ungrouped = psms.assign_confidence() | ||
scores2 = ungrouped.psms["mokapot score"] | ||
|
||
pd.testing.assert_series_equal(scores1, scores2) |