Mercurial > repos > pieterlukasse > prims_metabolomics
comparison test/test_export_to_metexp_tabular.py @ 21:19d8fd10248e
* Added interface to METEXP data store, including tool to fire queries in batch mode
* Improved quantification output files of MsClust, a.o. sorting
mass list based on intensity (last two columns of quantification
files)
* Added Molecular Mass calculation method
author | pieter.lukasse@wur.nl |
---|---|
date | Wed, 05 Mar 2014 17:20:11 +0100 |
parents | 9d5f4f5f764b |
children |
comparison
equal
deleted
inserted
replaced
20:24fb75fedee0 | 21:19d8fd10248e |
---|---|
7 import unittest | 7 import unittest |
8 | 8 |
9 | 9 |
10 class IntegrationTest(unittest.TestCase): | 10 class IntegrationTest(unittest.TestCase): |
11 | 11 |
12 | |
13 def test_MM_calculations(self): | |
14 ''' | |
15 test the implemented method for MM calculations for | |
16 given chemical formulas | |
17 ''' | |
18 export_to_metexp_tabular.init_elements_and_masses_map() | |
19 | |
20 formula = "C8H18O3" | |
21 # should be = 12.01*8 + 1.01*18 + 16*3 = 162.26 | |
22 result = export_to_metexp_tabular.get_molecular_mass(formula) | |
23 self.assertEqual(162.26, result) | |
24 | |
25 formula = "CH2O3Fe2Ni" | |
26 # should be = 12.01*1 + 1.01*2 + 16*3 + 55.85*2 + 58.71 = 232.44 | |
27 result = export_to_metexp_tabular.get_molecular_mass(formula) | |
28 self.assertAlmostEqual(232.44, result, 2) | |
29 | |
30 | |
31 | |
32 | |
12 | 33 |
13 def test_combine_output_simple(self): | 34 def test_combine_output_simple(self): |
14 ''' | 35 ''' |
15 comment me | 36 comment me |
16 ''' | 37 ''' |
26 output_csv = resource_filename(__name__, outdir + "metexp_tabular.txt") | 47 output_csv = resource_filename(__name__, outdir + "metexp_tabular.txt") |
27 | 48 |
28 sys.argv = ['test', | 49 sys.argv = ['test', |
29 rankfilter_and_caslookup_combined_file, | 50 rankfilter_and_caslookup_combined_file, |
30 msclust_quantification_and_spectra_file, | 51 msclust_quantification_and_spectra_file, |
31 output_csv] | 52 output_csv, |
53 'tomato', | |
54 'leafs', | |
55 'test experiment', | |
56 'pieter', | |
57 'DB5 column'] | |
58 | |
32 # Execute main function with arguments provided through sys.argv | 59 # Execute main function with arguments provided through sys.argv |
33 export_to_metexp_tabular.main() | 60 export_to_metexp_tabular.main() |
34 | 61 |
35 ''' | 62 ''' |
36 # Asserts are based on reading in with process_data and comparing values of | 63 # Asserts are based on reading in with process_data and comparing values of |