-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #59 from Mesnage-Org/test-ftrs
Add test for ftrs files
- Loading branch information
Showing
6 changed files
with
4,045 additions
and
15 deletions.
There are no files selected for viewing
Large diffs are not rendered by default.
Oops, something went wrong.
File renamed without changes.
Binary file not shown.
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 |
---|---|---|
@@ -1,11 +1,18 @@ | ||
import pgfinder.matching as matching | ||
|
||
# Set mass database and modifications | ||
csv_filepath = "data/masses/e_coli_monomer_masses.csv" | ||
mq_file_name = "data/maxquant_test_data.txt" | ||
|
||
raw_data = matching.maxquant_file_reader(mq_file_name) | ||
theo_masses = matching.theo_masses_reader(csv_filepath) | ||
mod_test = ['Sodium','Potassium','Anhydro','DeAc','Deacetyl_Anhydro','Nude','Decay','Amidation','Amidase','Double_Anh','multimers_Glyco'] | ||
results = matching.data_analysis(raw_data, theo_masses, 0.5, mod_test, 10) | ||
|
||
results.to_csv("data/baseline_output.csv") | ||
# Generate maxquant baseline | ||
mq_file_name = "data/maxquant_test_data.txt" | ||
raw_data_mq = matching.maxquant_file_reader(mq_file_name) | ||
results = matching.data_analysis(raw_data_mq, theo_masses, 0.5, mod_test, 10) | ||
results.to_csv("data/baseline_output_mq.csv") | ||
|
||
# Generate ftrs baseline | ||
ftrs_file_name = "data/ftrs_test_data.ftrs" | ||
raw_data_ftrs = matching.ftrs_reader(ftrs_file_name) | ||
results = matching.data_analysis(raw_data_ftrs, theo_masses, 0.5, mod_test, 10) | ||
results.to_csv("data/baseline_output_ftrs.csv") |
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 |
---|---|---|
@@ -1,23 +1,59 @@ | ||
import pandas as pd | ||
import pytest | ||
import pgfinder.matching as matching | ||
import pgfinder.validation as validation | ||
|
||
def test_matching_baseline(): | ||
'''Test that output of the major function in the module is unchanged.''' | ||
masses_file_name = "data/masses/e_coli_monomer_masses.csv" | ||
mq_file_name = "data/maxquant_test_data.txt" | ||
@pytest.fixture | ||
def masses_file_name(): | ||
return "data/masses/e_coli_monomer_masses.csv" | ||
|
||
@pytest.fixture | ||
def mod_test(): | ||
"""Modifications used in regression testing.""" | ||
return ['Sodium','Potassium','Anhydro','DeAc','Deacetyl_Anhydro','Nude','Decay','Amidation','Amidase','Double_Anh','multimers_Glyco'] | ||
|
||
@pytest.fixture | ||
def mq_file_name(): | ||
return "data/maxquant_test_data.txt" | ||
|
||
@pytest.fixture | ||
def mq_baseline_df(): | ||
return pd.read_csv("data/baseline_output_mq.csv", index_col=0) | ||
|
||
@pytest.fixture | ||
def ftrs_file_name(): | ||
return "data/ftrs_test_data.ftrs" | ||
|
||
@pytest.fixture | ||
def ftrs_baseline_df(): | ||
return pd.read_csv("data/baseline_output_ftrs.csv", index_col=0) | ||
|
||
def test_matching_mq_baseline(masses_file_name, mq_file_name, mod_test, mq_baseline_df): | ||
'''Test that output of the major function in the module is unchanged.''' | ||
|
||
raw_data = matching.maxquant_file_reader(mq_file_name) | ||
validation.validate_raw_data_df(raw_data) | ||
|
||
theo_masses = matching.theo_masses_reader(masses_file_name) | ||
validation.validate_theo_masses_df(theo_masses) | ||
|
||
mod_test = ['Sodium','Potassium','Anhydro','DeAc','Deacetyl_Anhydro','Nude','Decay','Amidation','Amidase','Double_Anh','multimers_Glyco'] | ||
|
||
validation.validate_enabled_mod_list(mod_test) | ||
|
||
output_df = matching.data_analysis(raw_data, theo_masses, 0.5, mod_test, 10) | ||
|
||
baseline_df = pd.read_csv("data/baseline_output.csv", index_col=0) | ||
pd.testing.assert_frame_equal(output_df, mq_baseline_df) | ||
|
||
pd.testing.assert_frame_equal(output_df, baseline_df) | ||
def test_matching_ftrs_baseline(masses_file_name, ftrs_file_name, mod_test, ftrs_baseline_df): | ||
"""Test that output of the major function in the module is unchanged.""" | ||
|
||
raw_data = matching.ftrs_reader(ftrs_file_name) | ||
validation.validate_raw_data_df(raw_data) | ||
|
||
theo_masses = matching.theo_masses_reader(masses_file_name) | ||
validation.validate_theo_masses_df(theo_masses) | ||
|
||
validation.validate_enabled_mod_list(mod_test) | ||
|
||
output_df = matching.data_analysis(raw_data, theo_masses, 0.5, mod_test, 10) | ||
|
||
pd.testing.assert_frame_equal(output_df, ftrs_baseline_df) |