def test_subtract_blank(self): res = False with app.app_context(): la = self.get_inst_from_step('filter_expected.csv') expected = self.csv_to_row_dict(self.sample_data_dir + 'subtract_expected.csv') la.subtract_blank('c', form.MULT_FACTOR_DEFAULT) res, msg = self.diff_dicts(expected, la.rows) self.assertTrue(res, msg)
def test_normalize(self): res = False with app.app_context(): la = self.get_inst_from_step('remove_expected.csv') expected = self.csv_to_row_dict(self.sample_data_dir + 'normalize_expected.csv') la.normalize({'normalize': 'intensity'}) res, msg = self.diff_dicts(expected, la.rows) self.assertTrue(res, msg)
def test_group_ions_diff(self): res = False with app.app_context(): la = self.get_inst_from_step('init_expected.csv') expected = self.csv_to_row_dict(self.sample_data_dir + 'group_ions_expected.csv') la.group_ions(form.ION_GROUP_WITHIN_DEFAULT) res, msg = self.diff_dicts(expected, la.rows) self.assertTrue(res, msg)
def test_class_stats(self): res = False with app.app_context(): # no normalization is the default, use remove_expected to init rows la = self.get_inst_from_step('remove_expected.csv') expected = self.csv_to_row_dict( self.sample_data_dir + 'class_stats_expected.csv', 'class') la.calc_class_stats({'class_stats': 'y'}) res, msg = self.diff_dicts(expected, la.class_dict) self.assertTrue(res, msg)
def test_lipid_analysis_init_cnt(self): res = False with app.app_context(): la = LipidAnalysis([ self.sample_data_dir + 'neg_short.txt', self.sample_data_dir + 'pos_short.txt' ]) # check that rows have expected count res = (len(la.rows) == 64) assert res
def test_remove_columns(self): res = False with app.app_context(): la = self.get_inst_from_step('subtract_expected.csv') expected = self.csv_to_row_dict(self.sample_data_dir + 'remove_expected.csv') la.remove_columns(', '.join(form.COLS_TO_REMOVE)) test_cols = la.rows[next(iter(la.rows))].keys() expected_cols = expected[next(iter(expected))].keys() same, msg = self.diff_keys(expected_cols, test_cols) self.assertTrue(same, msg)
def test_filter_rows_default(self): res = False with app.app_context(): la = self.get_inst_from_step('group_ions_expected.csv') expected = self.csv_to_row_dict(self.sample_data_dir + 'filter_expected.csv') la.filter_rows(form.RET_TIME_DEFAULT, form.GROUP_PQ_DEFAULT, form.GROUP_SN_DEFAULT, form.GROUP_AREA_DEFAULT, form.GROUP_HEIGHT_DEFAULT) res, msg = self.diff_dicts(expected, la.rows) self.assertTrue(res, msg)
def test_lipid_analysis_init_diff(self): res = False with app.app_context(): la = LipidAnalysis([ self.sample_data_dir + 'neg_short.txt', self.sample_data_dir + 'pos_short.txt' ]) expected = self.csv_to_row_dict(self.sample_data_dir + 'init_expected.csv') res, msg = self.diff_dicts(expected, la.rows) self.assertTrue(res, msg)