class JobDbEmptyDatasetTestCase(unittest.TestCase): def setUp(self): # mock job session self.session = initTestingDB(dataset=None) self.job = JobDb(self.session) def test_runInfo(self): runInfo = self.job.runInfo() self.assertIsNone(runInfo) def test_maxMSLevel(self): maxmslevel = self.job.maxMSLevel() self.assertEqual(maxmslevel, 0) def test_chromatogram(self): expected_chromatogram = {"scans": [], "cutoff": None} self.assertEqual(self.job.chromatogram(), expected_chromatogram) def test_moleculesTotalCount(self): self.assertEqual(self.job.moleculesTotalCount(), 0)
class JobDbEmptyDatasetTestCase(unittest.TestCase): def setUp(self): # mock job session self.session = initTestingDB(dataset=None) self.job = JobDb(self.session) def test_runInfo(self): runInfo = self.job.runInfo() self.assertIsNone(runInfo) def test_maxMSLevel(self): maxmslevel = self.job.maxMSLevel() self.assertEqual(maxmslevel, 0) def test_chromatogram(self): expected_chromatogram = {'scans': [], 'cutoff': None} self.assertEqual(self.job.chromatogram(), expected_chromatogram) def test_moleculesTotalCount(self): self.assertEqual(self.job.moleculesTotalCount(), 0)
def setUp(self): self.job = JobDb(initTestingDB(dataset="useallpeaks"))
class JobWithAllPeaksTestCase(unittest.TestCase): def setUp(self): self.job = JobDb(initTestingDB(dataset="useallpeaks")) def test_default(self): response = self.job.molecules() self.assertEquals( response, { "total": 1, "page": 1, "molid": None, "rows": [ { "molid": 12, "predicted": True, "mol": u"Molfile", "formula": u"C11H12O7S", "nhits": 1, "name": u"5-(3,4)-dihydroxyphenyl-g-valerolactone (F)", "refscore": 0.119004, "reactionsequence": [u"sulfation_(aromatic_hydroxyl)"], "smiles": u"Oc1ccc(CC2OC(=O)CC2)cc1OS(O)(=O)=O", "inchikey14": u"YAXFVDUJDAQPTJ", "mim": 288.0303734299, "logp": 1.9027, "assigned": False, "reference": u"", } ], }, ) def test_lvl1fragments(self): response = self.job.fragments(molid=12, scanid=1, node="root") self.assertEqual( response, { "children": [ { "atoms": u"0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18", "children": [], "deltah": -1.0, "deltappm": -7.046696487857745e-09, "expanded": True, "fragid": 17, "leaf": True, "mass": 288.0303734299, "molid": 12, "mol": u"Molfile", "mslevel": 1, "mz": 287.015686035156, "scanid": 1, "score": 0.0, "isAssigned": False, "formula": "C4H6O2", }, { "atoms": u"0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18", "deltah": -1.0, "deltappm": -7.020570507205176e-09, "expanded": True, "fragid": 18, "leaf": False, "mz": 287.023132324219, "molid": 12, "mol": u"Molfile", "mslevel": 1, "mass": 288.0303734299, "scanid": 1, "score": 0.5, "isAssigned": False, "formula": "C4H6O2", "children": [ { "fragid": 19, "molid": 12, "scanid": 2, "mz": 207.066223144531, "mass": 207.0657338415, "score": 0.5, "mol": u"Molfile", "atoms": u"0,1,2,3,4,5,6,7,8,9,10,11,12,13,14", "expanded": True, "leaf": True, "mslevel": 2, "deltah": 0.0, "deltappm": 2.3630267823129625e-12, "formula": "C4H6O2", }, { "fragid": 20, "molid": 12, "scanid": 2, "mz": 287.022827148438, "mass": 288.0303734299, "score": 0.0, "mol": u"Molfile", "atoms": u"0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18", "expanded": True, "leaf": True, "mslevel": 2, "deltah": -1.0, "deltappm": -7.021641217476223e-09, "formula": "C4H6O2", }, ], }, ], "expanded": True, }, )
def setUp(self): # mock job session self.session = initTestingDB(dataset=None) self.job = JobDb(self.session)
def setUp(self): # mock job session self.session = initTestingDB() self.job = JobDb(self.session)
def setUp(self): self.job = JobDb(initTestingDB(dataset='useallpeaks'))
class JobWithAllPeaksTestCase(unittest.TestCase): def setUp(self): self.job = JobDb(initTestingDB(dataset='useallpeaks')) def test_default(self): response = self.job.molecules() self.assertEquals( response, { 'total': 1, 'page': 1, 'molid': None, 'rows': [{ 'molid': 12, 'predicted': True, 'mol': u'Molfile', 'formula': u'C11H12O7S', 'nhits': 1, 'name': u'5-(3,4)-dihydroxyphenyl-g-valerolactone (F)', 'refscore': 0.119004, 'reactionsequence': [u'sulfation_(aromatic_hydroxyl)'], 'smiles': u'Oc1ccc(CC2OC(=O)CC2)cc1OS(O)(=O)=O', 'inchikey14': u'YAXFVDUJDAQPTJ', 'mim': 288.0303734299, 'logp':1.9027, 'assigned': False, 'reference': u'' }] } ) def test_lvl1fragments(self): response = self.job.fragments(molid=12, scanid=1, node='root') self.assertEqual(response, { 'children': [{ 'atoms': u'0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18', 'children': [], 'deltah': -1.0, 'deltappm': -7.046696487857745e-09, 'expanded': True, 'fragid': 17, 'leaf': True, 'mass': 288.0303734299, 'molid': 12, 'mol': u'Molfile', 'mslevel': 1, 'mz': 287.015686035156, 'scanid': 1, 'score': 0.0, 'isAssigned': False, 'formula': "C4H6O2", }, { 'atoms': u'0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18', 'deltah': -1.0, 'deltappm': -7.020570507205176e-09, 'expanded': True, 'fragid': 18, 'leaf': False, 'mz': 287.023132324219, 'molid': 12, 'mol': u'Molfile', 'mslevel': 1, 'mass': 288.0303734299, 'scanid': 1, 'score': 0.5, 'isAssigned': False, 'formula': "C4H6O2", 'children': [{ 'fragid': 19, 'molid': 12, 'scanid': 2, 'mz': 207.066223144531, 'mass': 207.0657338415, 'score': 0.5, 'mol': u'Molfile', 'atoms': u'0,1,2,3,4,5,6,7,8,9,10,11,12,13,14', 'expanded': True, 'leaf': True, 'mslevel': 2, 'deltah': 0.0, 'deltappm': 2.3630267823129625e-12, 'formula': "C4H6O2", }, { 'fragid': 20, 'molid': 12, 'scanid': 2, 'mz': 287.022827148438, 'mass': 288.0303734299, 'score': 0.0, 'mol': u'Molfile', 'atoms': u'0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18', 'expanded': True, 'leaf': True, 'mslevel': 2, 'deltah': -1.0, 'deltappm': -7.021641217476223e-09, 'formula': "C4H6O2", }] }], 'expanded': True })