def single_eng(self, path): eng = unidec.UniDec() eng.open_file(path) eng.unidec_imports(everything=True, efficiency=True) eng.pick_peaks() # eng.dscore() return eng
def navia_import(path): # Create a UniDec engine to help with things eng = unidec.UniDec() config_obj = eng.config try: # Where to find NaViA session and where to save UniDEC stuff with open(path, "r") as myfile: data = myfile.readlines() json_dict = json.loads(data[0]) mz_raw = np.transpose( [json_dict['raw_data']['mz'], json_dict['raw_data']['Intensity']]) rawfile = os.path.splitext(path)[0] + ".txt" np.savetxt(rawfile, mz_raw) eng.open_file(rawfile) navia2config(config_obj, json_dict) config_obj.manuallist = navia2manualfile(json_dict, config_obj.manualfile) config_obj.oligomerlist = navia2ofile(json_dict, config_obj.ofile) if len(config_obj.manuallist) > 0: eng.config.manualfileflag = True eng.export_config() #eng.load_config(eng.config.confname) return rawfile except IOError: print("Cannot open file '%s'." % path) return None
def init(self, *args, **kwargs): """ Initialize Engine and View. :param args: :param kwargs: :return: """ self.eng = unidec.UniDec() self.view = UniListWindow(self, "UniDec List Viewer", self.eng.config) # pub.subscribe(self.on_integrate, 'integrate') # pub.subscribe(self.on_smash, 'smash') # pub.subscribe(self.on_get_mzlimits, 'mzlimits') # pub.subscribe(self.on_left_click, 'left_click') if False: p1 = "C:\\Users\\margo\\Desktop\\Marty\\wanglabsample_protease_3.txt" p2 = "C:\\Users\\margo\\Desktop\\Marty\\wanglabsample_protease_3.txt" p3 = "C:\\Users\\margo\\Desktop\\Marty\\wanglabsample_protease_3.txt" paths = [[p1], [p2], [p3]] self.populate_list(paths)
importmass = np.loadtxt(mfilename) if importmass[0] > 0: self.masslistbox.list.populate(importmass) def on_import_oligos(self, e): """ Open a file dialog to import oligomer files. :param e: Unused event :return: None """ # TODO: This fails when the output ofile isn't square (some are unnamed and other are named) ofilename = FileDialogs.open_file_dialog("Open Oligomer File (ofile)", file_types="*.*") if ofilename is not None: importolig = np.genfromtxt(ofilename, dtype='str') if np.shape(importolig) == (5, ) or np.shape(importolig) == (4, ): importolig = [importolig] self.oligomerlistbox.list.populate(importolig) # Main App Execution if __name__ == "__main__": import unidec eng = unidec.UniDec() app = wx.App(False) frame = MassSelection(None) frame.init_dialog(eng.config, eng.pks, massdat=None) frame.ShowModal() app.MainLoop()