Exemple #1
0
def calibrate_and_search(out_put_file_name, jobs):

    import csv

    ref_dict, cal_file_path = get_reference_dict()

    if ref_dict:

        file_dialog = QFileDialog()
        file_dialog.setWindowFlags(Qt.WindowStaysOnTopHint)

        if file_dialog:

            file_locations = file_dialog.getOpenFileNames(
                None, "Standard Compounds Files", filter="*.cdf")
            file_dialog.close()

            # run in multiprocessing mode
            pool = Pool(jobs)
            args = [(file_path, ref_dict, cal_file_path)
                    for file_path in file_locations[0]]
            gcmss = pool.map(run, args)
            pool.close()
            pool.join()
            for gcms in gcmss:

                #gcms.to_csv(out_put_file_name, highest_score=False)
                #gcms.to_excel(out_put_file_name, highest_score=False)
                #gcms.to_pandas(out_put_file_name)
                gcms.to_hdf(highest_score=False)
Exemple #2
0
def get_reference_dict(calibration_file_path=False):

    if not calibration_file_path:
        app = QApplication(sys.argv)
        file_dialog = QFileDialog()
        file_dialog.setWindowFlags(Qt.WindowStaysOnTopHint)
        file_path = file_dialog.getOpenFileName(None,
                                                "FAMES REF FILE",
                                                filter="*.cdf")[0]
        file_dialog.close()
        app.exit()
    else:
        file_path = calibration_file_path

    if not file_path: return None

    else:

        gcms_ref_obj = get_gcms(file_path)
        sql_obj = start_sql_from_file()
        rt_ri_pairs = get_rt_ri_pairs(gcms_ref_obj, sql_obj=sql_obj)
        # !!!!!! READ !!!!! use the previous two lines if db/pnnl_lowres_gcms_compounds.sqlite does not exist
        # and comment the next line
        #rt_ri_pairs = get_rt_ri_pairs(gcms_ref_obj)

        return rt_ri_pairs, file_path
Exemple #3
0
def calibrate_and_search(out_put_file_name, jobs):

    from PySide2.QtWidgets import QFileDialog
    from PySide2.QtCore import Qt

    ref_dict, cal_file_path = get_reference_dict()
    if ref_dict:

        file_dialog = QFileDialog()
        file_dialog.setWindowFlags(Qt.WindowStaysOnTopHint)

        if file_dialog:

            file_locations = file_dialog.getOpenFileNames(None, "Standard Compounds Files", filter="*.cdf")
            file_dialog.close()

            # run in multiprocessing mode
            pool = Pool(jobs)
            args = [(file_path, ref_dict, cal_file_path) for file_path in file_locations[0]]
            gcmss = pool.map(run, args)
            pool.close()
            pool.join()

            for file_index, gcms in enumerate(gcmss):

                file_path = Path(file_locations[0][file_index])
                # print(out_put_file_name)

                gcms.to_csv(out_put_file_name, write_metadata=True, id_label="emsl:")

                # gcms.to_excel(out_put_file_name)
                # gcms.to_pandas(out_put_file_name)
                gcms.to_hdf()