def test_errors(self): usi_str = "mzspec:MSV000085202:210320_SARS_CoV_2_T:scan:131256" with self.assertRaises(TypeError, msg='Unrecognized backend type: NoneType'): proxi(usi_str, backend=None) with self.assertRaises(PyteomicsError, msg='Unknown PROXI backend name: BackendName'): proxi(usi_str, backend='BackendName')
def test_request(self): usi_str = "mzspec:MSV000085202:210320_SARS_CoV_2_T:scan:131256" response = proxi(usi_str, backend=AGGREGATOR_KEY) assert set(usi_proxi_data.keys()) <= set(response.keys()) for a, b in zip(response['m/z array'], usi_proxi_data['m/z array']): self.assertAlmostEqual(a, b, 3) for a, b in zip(response['intensity array'], usi_proxi_data['intensity array']): self.assertAlmostEqual(a, b, 3)
def get_scan_by_id(self, scan_id): '''Get a spectrum by USI from the server. Parameters ---------- scan_id : str The USI to fetch. Returns ------- Scan ''' payload = proxi(scan_id, self.backend) payload[USI_KEY] = scan_id return self._make_scan(payload)