Mercurial > repos > pieterlukasse > prims_metabolomics
annotate rankfilter_GCMS/test/test_pdfread.py @ 26:637830ac8bcd
added validation in metexp to tabular tool; added workaround/fix for L and D compound types
author | pieter.lukasse@wur.nl |
---|---|
date | Thu, 24 Apr 2014 11:28:38 +0200 |
parents | 53e1eee93430 |
children | d685210eef3e |
rev | line source |
---|---|
0 | 1 ''' |
2 Created on Mar 13, 2012 | |
3 | |
4 @author: marcelk | |
5 ''' | |
6 from GCMS.rankfilter_GCMS import pdfread # @UnresolvedImport | |
7 from pkg_resources import resource_filename # @UnresolvedImport # pylint: disable=E0611 | |
8 import unittest | |
9 | |
10 | |
11 class Test(unittest.TestCase): | |
12 | |
13 def setUp(self): | |
14 self.nist_pdf = resource_filename(__name__, "data/NIST_test_PDF.txt") | |
15 | |
16 def test_getPDF(self): | |
17 ''' | |
18 Tests the reading and parsing of a NIST PDF file | |
19 ''' | |
16 | 20 [hitlist, hitlist_missed] = pdfread.getPDF(self.nist_pdf, True) |
0 | 21 rows = [hitlist[row] for row in hitlist.keys()] |
22 data = [set(row) for row in zip(*rows)] | |
23 expected_element = set(('12.3', ' Sucrose ', '14', 'undef', ' standards 2009', ' 660', 'not_def', | |
24 '18495-0.142537-21284-2.26544e+07-135', '22.6544', ' 714')) | |
25 self.failUnless(expected_element in data) | |
26 self.failUnless(len(hitlist_missed) != 0) | |
26
637830ac8bcd
added validation in metexp to tabular tool; added workaround/fix for L and D compound types
pieter.lukasse@wur.nl
parents:
16
diff
changeset
|
27 ''' |
637830ac8bcd
added validation in metexp to tabular tool; added workaround/fix for L and D compound types
pieter.lukasse@wur.nl
parents:
16
diff
changeset
|
28 Check for last (dummy) hit: |
637830ac8bcd
added validation in metexp to tabular tool; added workaround/fix for L and D compound types
pieter.lukasse@wur.nl
parents:
16
diff
changeset
|
29 Hit 6 : (dummy hit)Sorbopyranose, 1,2,3,4,5-pentakis-O-(trimethylsilyl)-, LC21H52O6Si5;MF: 658; RMF: 658; Prob 15.6%; CAS: 30645-02-4; Lib: mainlib; ID: 37062. |
637830ac8bcd
added validation in metexp to tabular tool; added workaround/fix for L and D compound types
pieter.lukasse@wur.nl
parents:
16
diff
changeset
|
30 ''' |
637830ac8bcd
added validation in metexp to tabular tool; added workaround/fix for L and D compound types
pieter.lukasse@wur.nl
parents:
16
diff
changeset
|
31 expected_element = set(['C21H52O6Si5', ' 30645-02-4', ' mainlib', '15.6', ' (dummy hit)Sorbopyranose, 1,2,3,4,5-pentakis-O-(trimethylsilyl)-, L C21H52O6Si5', '7298-1-9580-1.29014e+07-9', ' 658', '12.9014', '37062']) |
637830ac8bcd
added validation in metexp to tabular tool; added workaround/fix for L and D compound types
pieter.lukasse@wur.nl
parents:
16
diff
changeset
|
32 self.failUnless(expected_element in data) |
637830ac8bcd
added validation in metexp to tabular tool; added workaround/fix for L and D compound types
pieter.lukasse@wur.nl
parents:
16
diff
changeset
|
33 |
0 | 34 |
35 if __name__ == "__main__": | |
36 #import sys;sys.argv = ['', 'Test.test_getPDF'] | |
37 unittest.main() |