diff --git a/.travis.yml b/.travis.yml index 61177ad..144193d 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,7 +1,7 @@ language: python python: -- 3.6 +- 3.7 matrix: include: @@ -9,7 +9,7 @@ matrix: dist: bionic sudo: required language: python - python: 3.6 + python: 3.7 install: - wget https://repo.anaconda.com/miniconda/Miniconda3-latest-Linux-x86_64.sh -O miniconda.sh - bash miniconda.sh -b -p $HOME/miniconda @@ -18,10 +18,10 @@ matrix: - conda config --set always_yes yes --set changeps1 no - conda update -q conda - conda info -a - - conda config --add channels conda-forge - - conda config --set channel_priority strict - - conda env create -f conda_env_linux.yml + - conda create -n envlipidhunter python=3.7.6 - source activate envlipidhunter + - pip install numpy + - pip install -r requirements.txt - conda env export > env.yml - ls - cat env.yml @@ -29,11 +29,14 @@ matrix: - travis_wait pytest --cov=./ after_success: - travis_wait codecov + - conda env export > env.yml + - ls + - cat env.yml - os: osx sudo: required language: sh - python: 3.6 + python: 3.7 install: - wget https://repo.anaconda.com/miniconda/Miniconda3-latest-MacOSX-x86_64.sh -O miniconda.sh - bash miniconda.sh -b -p $HOME/miniconda @@ -42,12 +45,11 @@ matrix: - conda config --set always_yes yes --set changeps1 no - conda update -q conda - conda info -a - - conda config --add channels conda-forge - - conda config --set channel_priority strict - - conda env create -f conda_env_mac.yml + - conda create -n envlipidhunter python=3.7.6 - source activate envlipidhunter - ls - - pip install cython pandas matplotlib natsort numba numpy numexpr scipy six pymzml codecov pytest pytest-cov xlwt xlrd openpyxl + - pip install numpy + - pip install -r requirements.txt - conda env export > env.yml - ls - cat env.yml @@ -55,14 +57,13 @@ matrix: - travis_wait pytest --cov=./ after_success: - travis_wait codecov - - conda install -c conda-forge pyside=1.2.4 - conda env export > env.yml - ls - cat env.yml - os: windows language: sh - python: 3.6 + python: 3.7 env: PATH="/c/tools/miniconda3/:/c/tools/miniconda3/Scripts:/c/tools/miniconda3/bin:$PATH" before_install: - choco install openssl.light @@ -71,12 +72,11 @@ matrix: - hash -r - conda config --set always_yes yes --set changeps1 no - conda update -q conda - - conda config --add channels conda-forge - - conda config --set channel_priority strict - source activate base - - conda create -c conda-forge -n envlipidhunter python=3.6.7 + - conda create -n envlipidhunter python=3.7.6 - source activate envlipidhunter - - pip install cython pandas matplotlib natsort numba numpy numexpr scipy six pymzml codecov pytest pytest-cov xlwt xlrd openpyxl + - pip install numpy + - pip install -r requirements.txt - conda env export > env.yml - conda list - echo $PATH @@ -84,5 +84,4 @@ matrix: - travis_wait pytest --cov=./ after_success: - travis_wait codecov - - conda install -c conda-forge pyside=1.2.4 - conda list diff --git a/ConfigurationFiles/3-Specific_ions.xlsx b/ConfigurationFiles/3-Specific_ions.xlsx index f56a9d9..766a647 100644 Binary files a/ConfigurationFiles/3-Specific_ions.xlsx and b/ConfigurationFiles/3-Specific_ions.xlsx differ diff --git a/LibLipidHunter/AbbrElemCalc.py b/LibLipidHunter/AbbrElemCalc.py index 8e1f134..21a4330 100644 --- a/LibLipidHunter/AbbrElemCalc.py +++ b/LibLipidHunter/AbbrElemCalc.py @@ -23,58 +23,85 @@ class ElemCalc: def __init__(self): - pa_hg_elem = {'C': 0, 'H': 3, 'O': 4, 'P': 1, 'N': 0} - pc_hg_elem = {'C': 5, 'H': 14, 'O': 4, 'P': 1, 'N': 1} - pe_hg_elem = {'C': 2, 'H': 8, 'O': 4, 'P': 1, 'N': 1} - pg_hg_elem = {'C': 3, 'H': 9, 'O': 6, 'P': 1, 'N': 0} - pi_hg_elem = {'C': 6, 'H': 13, 'O': 9, 'P': 1, 'N': 0} - pip_hg_elem = {'C': 6, 'H': 14, 'O': 12, 'P': 2, 'N': 0} - ps_hg_elem = {'C': 3, 'H': 8, 'O': 6, 'P': 1, 'N': 1} - tg_hg_elem = {'C': 0, 'H': 0, 'O': 0, 'P': 0, 'N': 0} - fa_hg_elem = {'C': 0, 'H': 0, 'O': 0, 'P': 0, 'N': 0} - - self.lipid_hg_elem_dct = {'PA': pa_hg_elem, 'PC': pc_hg_elem, 'PE': pe_hg_elem, 'PG': pg_hg_elem, - 'PI': pi_hg_elem, 'PS': ps_hg_elem, 'PIP': pip_hg_elem, - 'LPA': pa_hg_elem, 'LPC': pc_hg_elem, 'LPE': pe_hg_elem, 'LPG': pg_hg_elem, - 'LPI': pi_hg_elem, 'LPS': ps_hg_elem, 'LPIP': pip_hg_elem, - 'TG': tg_hg_elem,'FA': fa_hg_elem, 'DG': tg_hg_elem} - - self.glycerol_bone_elem_dct = {'C': 3, 'H': 2} - self.link_o_elem_dct = {'O': -1, 'H': 2} - self.link_p_elem_dct = {'O': -1} - - self.periodic_table_dct = {'H': [(1.0078250321, 0.999885), (2.0141017780, 0.0001157)], - 'D': [(2.0141017780, 0.0001157)], - 'C': [(12.0, 0.9893), (13.0033548378, 0.0107)], - 'N': [(14.0030740052, 0.99632), (15.0001088984, 0.00368)], - 'O': [(15.9949146221, 0.99757), (16.99913150, 0.00038), (17.9991604, 0.00205)], - 'Na': [(22.98976967, 1.0)], - 'P': [(30.97376151, 1.0)], - 'S': [(31.97207069, 0.9493), (32.97145850, 0.0076), - (33.96786683, 0.0429), (35.96708088, 0.0002)], - 'K': [(38.9637069, 0.932581), (39.96399867, 0.000117), (40.96182597, 0.067302)], - } + pa_hg_elem = {"C": 0, "H": 3, "O": 4, "P": 1, "N": 0} + pc_hg_elem = {"C": 5, "H": 14, "O": 4, "P": 1, "N": 1} + pe_hg_elem = {"C": 2, "H": 8, "O": 4, "P": 1, "N": 1} + pg_hg_elem = {"C": 3, "H": 9, "O": 6, "P": 1, "N": 0} + pi_hg_elem = {"C": 6, "H": 13, "O": 9, "P": 1, "N": 0} + pip_hg_elem = {"C": 6, "H": 14, "O": 12, "P": 2, "N": 0} + ps_hg_elem = {"C": 3, "H": 8, "O": 6, "P": 1, "N": 1} + tg_hg_elem = {"C": 0, "H": 0, "O": 0, "P": 0, "N": 0} + fa_hg_elem = {"C": 0, "H": 0, "O": 0, "P": 0, "N": 0} + + self.lipid_hg_elem_dct = { + "PA": pa_hg_elem, + "PC": pc_hg_elem, + "PE": pe_hg_elem, + "PG": pg_hg_elem, + "PI": pi_hg_elem, + "PS": ps_hg_elem, + "PIP": pip_hg_elem, + "LPA": pa_hg_elem, + "LPC": pc_hg_elem, + "LPE": pe_hg_elem, + "LPG": pg_hg_elem, + "LPI": pi_hg_elem, + "LPS": ps_hg_elem, + "LPIP": pip_hg_elem, + "TG": tg_hg_elem, + "FA": fa_hg_elem, + "DG": tg_hg_elem, + } + + self.glycerol_bone_elem_dct = {"C": 3, "H": 2} + self.link_o_elem_dct = {"O": -1, "H": 2} + self.link_p_elem_dct = {"O": -1} + + self.periodic_table_dct = { + "H": [(1.0078250321, 0.999885), (2.0141017780, 0.0001157)], + "D": [(2.0141017780, 0.0001157)], + "C": [(12.0, 0.9893), (13.0033548378, 0.0107)], + "N": [(14.0030740052, 0.99632), (15.0001088984, 0.00368)], + "O": [ + (15.9949146221, 0.99757), + (16.99913150, 0.00038), + (17.9991604, 0.00205), + ], + "Na": [(22.98976967, 1.0)], + "P": [(30.97376151, 1.0)], + "S": [ + (31.97207069, 0.9493), + (32.97145850, 0.0076), + (33.96786683, 0.0429), + (35.96708088, 0.0002), + ], + "K": [ + (38.9637069, 0.932581), + (39.96399867, 0.000117), + (40.96182597, 0.067302), + ], + } @staticmethod def decode_abbr(abbr): - pl_checker = re.compile(r'(P[ACEGSI])([(])(.*)([)])') - lpl_checker = re.compile(r'(LP[ACEGSI])([(])(.*)([)])') - pip_checker = re.compile(r'(PIP)([(])(.*)([)])') - tg_checker = re.compile(r'(TG)([(])(.*)([)])') - dg_checker = re.compile(r'(DG)([(])(.*)([)])') - fa_checker = re.compile(r'(FA)(\d{1,2})([:])(\d{1,2})') - fa_short_checker = re.compile(r'(\d{1,2})([:])(\d{1,2})') - fa_o_checker = re.compile(r'(O-)(\d{1,2})([:])(\d)') - fa_p_checker = re.compile(r'(P-)(\d{1,2})([:])(\d)') + pl_checker = re.compile(r"(P[ACEGSI])([(])(.*)([)])") + lpl_checker = re.compile(r"(LP[ACEGSI])([(])(.*)([)])") + pip_checker = re.compile(r"(PIP)([(])(.*)([)])") + tg_checker = re.compile(r"(TG)([(])(.*)([)])") + dg_checker = re.compile(r"(DG)([(])(.*)([)])") + fa_checker = re.compile(r"(FA)(\d{1,2})([:])(\d{1,2})") + fa_short_checker = re.compile(r"(\d{1,2})([:])(\d{1,2})") + fa_o_checker = re.compile(r"(O-)(\d{1,2})([:])(\d)") + fa_p_checker = re.compile(r"(P-)(\d{1,2})([:])(\d)") # Check PL Type - _pl_typ = '' - bulk_fa_typ = '' - bulk_fa_linker = '' + _pl_typ = "" + bulk_fa_typ = "" + bulk_fa_linker = "" bulk_fa_c = 0 bulk_fa_db = 0 - lyso_fa_linker_dct = {'fa1': '', 'fa2': ''} + lyso_fa_linker_dct = {"fa1": "", "fa2": ""} # TODO(georgia.angelidou@uni-leipzig.de): consideration to put se elif statement if pl_checker.match(abbr): @@ -108,49 +135,49 @@ def decode_abbr(abbr): bulk_fa_typ = dg_typ_lst[2] if fa_checker.match(abbr): # print('FA') - _pl_typ = 'FA' + _pl_typ = "FA" bulk_fa_typ = abbr fa_chk = fa_checker.match(abbr) bulk_fa_lst = fa_chk.groups() bulk_fa_c = bulk_fa_lst[1] bulk_fa_db = bulk_fa_lst[3] - bulk_fa_linker = 'A-' - lyso_fa_linker_dct = {'A': ''} + bulk_fa_linker = "A-" + lyso_fa_linker_dct = {"A": ""} if fa_short_checker.match(abbr): # print('FA') - _pl_typ = 'FA' + _pl_typ = "FA" bulk_fa_typ = abbr fa_chk = fa_checker.match(abbr) bulk_fa_lst = fa_chk.groups() bulk_fa_c = bulk_fa_lst[0] bulk_fa_db = bulk_fa_lst[2] - bulk_fa_linker = 'A-' - lyso_fa_linker_dct = {'A': ''} + bulk_fa_linker = "A-" + lyso_fa_linker_dct = {"A": ""} if fa_o_checker.match(abbr): # print('FA') - _pl_typ = 'FA' + _pl_typ = "FA" bulk_fa_typ = abbr fa_chk = fa_o_checker.match(abbr) bulk_fa_lst = fa_chk.groups() bulk_fa_c = bulk_fa_lst[1] bulk_fa_db = bulk_fa_lst[3] - bulk_fa_linker = 'O-' - lyso_fa_linker_dct = {'O': ''} + bulk_fa_linker = "O-" + lyso_fa_linker_dct = {"O": ""} if fa_p_checker.match(abbr): # print('FA') - _pl_typ = 'FA' + _pl_typ = "FA" bulk_fa_typ = abbr fa_chk = fa_p_checker.match(abbr) bulk_fa_lst = fa_chk.groups() bulk_fa_c = bulk_fa_lst[1] bulk_fa_db = bulk_fa_lst[3] - bulk_fa_linker = 'P-' - lyso_fa_linker_dct = {'P': ''} + bulk_fa_linker = "P-" + lyso_fa_linker_dct = {"P": ""} - if _pl_typ in ['PL', 'PA', 'PC', 'PE', 'PG', 'PI', 'PIP', 'PS']: + if _pl_typ in ["PL", "PA", "PC", "PE", "PG", "PI", "PIP", "PS"]: if fa_short_checker.match(bulk_fa_typ): - bulk_fa_linker = 'A-A-' - lyso_fa_linker_dct = {'A': ''} + bulk_fa_linker = "A-A-" + lyso_fa_linker_dct = {"A": ""} fa_chk = fa_short_checker.match(bulk_fa_typ) bulk_fa_lst = fa_chk.groups() bulk_fa_c = bulk_fa_lst[0] @@ -163,83 +190,105 @@ def decode_abbr(abbr): # bulk_fa_c = bulk_fa_lst[0] # bulk_fa_db = bulk_fa_lst[2] elif fa_o_checker.match(bulk_fa_typ): - bulk_fa_linker = 'O-A-' - lyso_fa_linker_dct = {'O': '', 'A': 'O-'} # link of the other sn after NL of this sn + bulk_fa_linker = "O-A-" + lyso_fa_linker_dct = { + "O": "", + "A": "O-", + } # link of the other sn after NL of this sn fa_chk = fa_o_checker.match(bulk_fa_typ) bulk_fa_lst = fa_chk.groups() bulk_fa_c = bulk_fa_lst[1] bulk_fa_db = bulk_fa_lst[3] elif fa_p_checker.match(bulk_fa_typ): - bulk_fa_linker = 'P-A-' - lyso_fa_linker_dct = {'P': '', 'A': 'P-'} # link of the other sn after NL of this sn + bulk_fa_linker = "P-A-" + lyso_fa_linker_dct = { + "P": "", + "A": "P-", + } # link of the other sn after NL of this sn fa_chk = fa_p_checker.match(bulk_fa_typ) bulk_fa_lst = fa_chk.groups() bulk_fa_c = bulk_fa_lst[1] bulk_fa_db = bulk_fa_lst[3] - elif _pl_typ in ['LPL', 'LPA', 'LPC', 'LPE', 'LPG', 'LPI', 'LPIP', 'LPS']: + elif _pl_typ in ["LPL", "LPA", "LPC", "LPE", "LPG", "LPI", "LPIP", "LPS"]: if fa_short_checker.match(bulk_fa_typ): - bulk_fa_linker = 'A-' - lyso_fa_linker_dct = {'A': ''} + bulk_fa_linker = "A-" + lyso_fa_linker_dct = {"A": ""} fa_chk = fa_short_checker.match(bulk_fa_typ) bulk_fa_lst = fa_chk.groups() bulk_fa_c = bulk_fa_lst[0] bulk_fa_db = bulk_fa_lst[2] elif fa_o_checker.match(bulk_fa_typ): - bulk_fa_linker = 'O-' - lyso_fa_linker_dct = {'O': ''} # link of the other sn after NL of this sn + bulk_fa_linker = "O-" + lyso_fa_linker_dct = { + "O": "" + } # link of the other sn after NL of this sn fa_chk = fa_o_checker.match(bulk_fa_typ) bulk_fa_lst = fa_chk.groups() bulk_fa_c = bulk_fa_lst[1] bulk_fa_db = bulk_fa_lst[3] elif fa_p_checker.match(bulk_fa_typ): - bulk_fa_linker = 'P-' - lyso_fa_linker_dct = {'P': ''} # link of the other sn after NL of this sn + bulk_fa_linker = "P-" + lyso_fa_linker_dct = { + "P": "" + } # link of the other sn after NL of this sn fa_chk = fa_p_checker.match(bulk_fa_typ) bulk_fa_lst = fa_chk.groups() bulk_fa_c = bulk_fa_lst[1] bulk_fa_db = bulk_fa_lst[3] - elif _pl_typ in ['TG']: + elif _pl_typ in ["TG"]: if fa_short_checker.match(bulk_fa_typ): - bulk_fa_linker = 'A-A-A-' - lyso_fa_linker_dct = {'A': ''} + bulk_fa_linker = "A-A-A-" + lyso_fa_linker_dct = {"A": ""} fa_chk = fa_short_checker.match(bulk_fa_typ) bulk_fa_lst = fa_chk.groups() bulk_fa_c = bulk_fa_lst[0] bulk_fa_db = bulk_fa_lst[2] elif fa_o_checker.match(bulk_fa_typ): - bulk_fa_linker = 'O-A-A-' - lyso_fa_linker_dct = {'O': '', 'A': 'O-'} # link of the other sn after NL of this sn + bulk_fa_linker = "O-A-A-" + lyso_fa_linker_dct = { + "O": "", + "A": "O-", + } # link of the other sn after NL of this sn fa_chk = fa_o_checker.match(bulk_fa_typ) bulk_fa_lst = fa_chk.groups() bulk_fa_c = bulk_fa_lst[1] bulk_fa_db = bulk_fa_lst[3] elif fa_p_checker.match(bulk_fa_typ): - bulk_fa_linker = 'P-A-A-' - lyso_fa_linker_dct = {'P': '', 'A': 'P-'} # link of the other sn after NL of this sn + bulk_fa_linker = "P-A-A-" + lyso_fa_linker_dct = { + "P": "", + "A": "P-", + } # link of the other sn after NL of this sn fa_chk = fa_p_checker.match(bulk_fa_typ) bulk_fa_lst = fa_chk.groups() bulk_fa_c = bulk_fa_lst[1] bulk_fa_db = bulk_fa_lst[3] - elif _pl_typ in ['DG']: + elif _pl_typ in ["DG"]: if fa_short_checker.match(bulk_fa_typ): - bulk_fa_linker = 'A-A-' - lyso_fa_linker_dct = {'A': ''} + bulk_fa_linker = "A-A-" + lyso_fa_linker_dct = {"A": ""} fa_chk = fa_short_checker.match(bulk_fa_typ) bulk_fa_lst = fa_chk.groups() bulk_fa_c = bulk_fa_lst[0] bulk_fa_db = bulk_fa_lst[2] elif fa_o_checker.match(bulk_fa_typ): - bulk_fa_linker = 'O-A-' - lyso_fa_linker_dct = {'O': '', 'A': 'O-'} # link of the other sn after NL of this sn + bulk_fa_linker = "O-A-" + lyso_fa_linker_dct = { + "O": "", + "A": "O-", + } # link of the other sn after NL of this sn fa_chk = fa_o_checker.match(bulk_fa_typ) bulk_fa_lst = fa_chk.groups() bulk_fa_c = bulk_fa_lst[1] bulk_fa_db = bulk_fa_lst[3] elif fa_p_checker.match(bulk_fa_typ): - bulk_fa_linker = 'P-A-' - lyso_fa_linker_dct = {'P': '', 'A': 'P-'} # link of the other sn after NL of this sn + bulk_fa_linker = "P-A-" + lyso_fa_linker_dct = { + "P": "", + "A": "P-", + } # link of the other sn after NL of this sn fa_chk = fa_p_checker.match(bulk_fa_typ) bulk_fa_lst = fa_chk.groups() bulk_fa_c = bulk_fa_lst[1] @@ -248,8 +297,13 @@ def decode_abbr(abbr): bulk_fa_c = int(bulk_fa_c) bulk_fa_db = int(bulk_fa_db) - lipid_info_dct = {'TYPE': _pl_typ, 'LINK': bulk_fa_linker, 'C': bulk_fa_c, 'DB': bulk_fa_db, - 'LYSO_LINK': lyso_fa_linker_dct} + lipid_info_dct = { + "TYPE": _pl_typ, + "LINK": bulk_fa_linker, + "C": bulk_fa_c, + "DB": bulk_fa_db, + "LYSO_LINK": lyso_fa_linker_dct, + } return lipid_info_dct @@ -257,164 +311,196 @@ def get_neutral_elem(self, abbr): usr_lipid_info_dct = self.decode_abbr(abbr) - lipid_type = usr_lipid_info_dct['TYPE'] + lipid_type = usr_lipid_info_dct["TYPE"] if lipid_type in list(self.lipid_hg_elem_dct.keys()): - if lipid_type in ['FA']: + if lipid_type in ["FA"]: # print(abbr) - tmp_lipid_elem_dct = {'C': usr_lipid_info_dct['C'], 'O': 2, - 'H': (usr_lipid_info_dct['C'] * 2 - usr_lipid_info_dct['DB'] * 2)} - if usr_lipid_info_dct['LINK'] == '': + tmp_lipid_elem_dct = { + "C": usr_lipid_info_dct["C"], + "O": 2, + "H": (usr_lipid_info_dct["C"] * 2 - usr_lipid_info_dct["DB"] * 2), + } + if usr_lipid_info_dct["LINK"] == "": pass - elif usr_lipid_info_dct['LINK'] == 'O-': - tmp_lipid_elem_dct['O'] += -1 - tmp_lipid_elem_dct['H'] += 2 - elif usr_lipid_info_dct['LINK'] == 'P-': - tmp_lipid_elem_dct['O'] += -1 + elif usr_lipid_info_dct["LINK"] == "O-": + tmp_lipid_elem_dct["O"] += -1 + tmp_lipid_elem_dct["H"] += 2 + elif usr_lipid_info_dct["LINK"] == "P-": + tmp_lipid_elem_dct["O"] += -1 else: pass return tmp_lipid_elem_dct - if lipid_type in ['PA', 'PC', 'PE', 'PG', 'PI', 'PIP', 'PS']: - tmp_lipid_elem_dct = self.lipid_hg_elem_dct[usr_lipid_info_dct['TYPE']].copy() - tmp_lipid_elem_dct['O'] += 4 - tmp_lipid_elem_dct['C'] += self.glycerol_bone_elem_dct['C'] + usr_lipid_info_dct['C'] - tmp_lipid_elem_dct['H'] += (self.glycerol_bone_elem_dct['H'] + usr_lipid_info_dct['C'] * 2 - - usr_lipid_info_dct['DB'] * 2) # DBE = DB + 2xC=O from FA - if usr_lipid_info_dct['LINK'] == 'O-A-': - tmp_lipid_elem_dct['O'] += -1 - tmp_lipid_elem_dct['H'] += 2 - elif usr_lipid_info_dct['LINK'] == 'P-A-': - tmp_lipid_elem_dct['O'] += -1 + if lipid_type in ["PA", "PC", "PE", "PG", "PI", "PIP", "PS"]: + tmp_lipid_elem_dct = self.lipid_hg_elem_dct[ + usr_lipid_info_dct["TYPE"] + ].copy() + tmp_lipid_elem_dct["O"] += 4 + tmp_lipid_elem_dct["C"] += ( + self.glycerol_bone_elem_dct["C"] + usr_lipid_info_dct["C"] + ) + tmp_lipid_elem_dct["H"] += ( + self.glycerol_bone_elem_dct["H"] + + usr_lipid_info_dct["C"] * 2 + - usr_lipid_info_dct["DB"] * 2 + ) # DBE = DB + 2xC=O from FA + if usr_lipid_info_dct["LINK"] == "O-A-": + tmp_lipid_elem_dct["O"] += -1 + tmp_lipid_elem_dct["H"] += 2 + elif usr_lipid_info_dct["LINK"] == "P-A-": + tmp_lipid_elem_dct["O"] += -1 else: pass return tmp_lipid_elem_dct - elif lipid_type in ['LPA', 'LPC', 'LPE', 'LPG', 'LPI', 'LPIP', 'LPS']: - tmp_lipid_elem_dct = self.lipid_hg_elem_dct[usr_lipid_info_dct['TYPE']].copy() - tmp_lipid_elem_dct['O'] += 3 - tmp_lipid_elem_dct['C'] += self.glycerol_bone_elem_dct['C'] + usr_lipid_info_dct['C'] - tmp_lipid_elem_dct['H'] += (self.glycerol_bone_elem_dct['H'] + 2 + usr_lipid_info_dct['C'] * 2 - - usr_lipid_info_dct['DB'] * 2) # DBE = DB + 2xC=O from FA - - if usr_lipid_info_dct['LINK'] == 'O-': - tmp_lipid_elem_dct['O'] += -1 - tmp_lipid_elem_dct['H'] += 2 - elif usr_lipid_info_dct['LINK'] == 'P-': - tmp_lipid_elem_dct['O'] += -1 + elif lipid_type in ["LPA", "LPC", "LPE", "LPG", "LPI", "LPIP", "LPS"]: + tmp_lipid_elem_dct = self.lipid_hg_elem_dct[ + usr_lipid_info_dct["TYPE"] + ].copy() + tmp_lipid_elem_dct["O"] += 3 + tmp_lipid_elem_dct["C"] += ( + self.glycerol_bone_elem_dct["C"] + usr_lipid_info_dct["C"] + ) + tmp_lipid_elem_dct["H"] += ( + self.glycerol_bone_elem_dct["H"] + + 2 + + usr_lipid_info_dct["C"] * 2 + - usr_lipid_info_dct["DB"] * 2 + ) # DBE = DB + 2xC=O from FA + + if usr_lipid_info_dct["LINK"] == "O-": + tmp_lipid_elem_dct["O"] += -1 + tmp_lipid_elem_dct["H"] += 2 + elif usr_lipid_info_dct["LINK"] == "P-": + tmp_lipid_elem_dct["O"] += -1 else: pass return tmp_lipid_elem_dct - elif lipid_type in ['TG']: - tmp_lipid_elem_dct = self.lipid_hg_elem_dct[usr_lipid_info_dct['TYPE']].copy() - tmp_lipid_elem_dct['O'] += 6 - tmp_lipid_elem_dct['C'] += self.glycerol_bone_elem_dct['C'] + usr_lipid_info_dct['C'] - tmp_lipid_elem_dct['H'] += (self.glycerol_bone_elem_dct['H'] + usr_lipid_info_dct['C'] * 2 - - usr_lipid_info_dct['DB'] * 2) # DBE = DB + 2xC=O from FA - if usr_lipid_info_dct['LINK'] == 'O-A-A-': - tmp_lipid_elem_dct['O'] += -1 - tmp_lipid_elem_dct['H'] += 2 - elif usr_lipid_info_dct['LINK'] == 'P-A-A-': - tmp_lipid_elem_dct['O'] += -1 + elif lipid_type in ["TG"]: + tmp_lipid_elem_dct = self.lipid_hg_elem_dct[ + usr_lipid_info_dct["TYPE"] + ].copy() + tmp_lipid_elem_dct["O"] += 6 + tmp_lipid_elem_dct["C"] += ( + self.glycerol_bone_elem_dct["C"] + usr_lipid_info_dct["C"] + ) + tmp_lipid_elem_dct["H"] += ( + self.glycerol_bone_elem_dct["H"] + + usr_lipid_info_dct["C"] * 2 + - usr_lipid_info_dct["DB"] * 2 + ) # DBE = DB + 2xC=O from FA + if usr_lipid_info_dct["LINK"] == "O-A-A-": + tmp_lipid_elem_dct["O"] += -1 + tmp_lipid_elem_dct["H"] += 2 + elif usr_lipid_info_dct["LINK"] == "P-A-A-": + tmp_lipid_elem_dct["O"] += -1 else: pass return tmp_lipid_elem_dct - elif lipid_type in ['DG']: - tmp_lipid_elem_dct = self.lipid_hg_elem_dct[usr_lipid_info_dct['TYPE']].copy() - tmp_lipid_elem_dct['O'] += 5 - tmp_lipid_elem_dct['C'] += self.glycerol_bone_elem_dct['C'] + usr_lipid_info_dct['C'] - tmp_lipid_elem_dct['H'] += ( - self.glycerol_bone_elem_dct['H'] + usr_lipid_info_dct['C'] * 2 - usr_lipid_info_dct[ - 'DB'] * 2 + 2) + elif lipid_type in ["DG"]: + tmp_lipid_elem_dct = self.lipid_hg_elem_dct[ + usr_lipid_info_dct["TYPE"] + ].copy() + tmp_lipid_elem_dct["O"] += 5 + tmp_lipid_elem_dct["C"] += ( + self.glycerol_bone_elem_dct["C"] + usr_lipid_info_dct["C"] + ) + tmp_lipid_elem_dct["H"] += ( + self.glycerol_bone_elem_dct["H"] + + usr_lipid_info_dct["C"] * 2 + - usr_lipid_info_dct["DB"] * 2 + + 2 + ) return tmp_lipid_elem_dct else: - return {'C': 0, 'H': 0, 'O': 0, 'P': 0} + return {"C": 0, "H": 0, "O": 0, "P": 0} else: - return {'C': 0, 'H': 0, 'O': 0, 'P': 0} + return {"C": 0, "H": 0, "O": 0, "P": 0} - def get_charged_elem(self, abbr, charge='[M-H]-'): + def get_charged_elem(self, abbr, charge="[M-H]-"): lipid_elem_dct = self.get_neutral_elem(abbr) - if charge == '[M-H]-': - lipid_elem_dct['H'] += -1 - elif charge == '[M+HCOO]-' or charge == '[M+FA-H]-': - lipid_elem_dct['H'] += 1 - lipid_elem_dct['C'] += 1 - lipid_elem_dct['O'] += 2 - elif charge == '[M+CH3COO]-': - lipid_elem_dct['H'] += 3 - lipid_elem_dct['C'] += 2 - lipid_elem_dct['O'] += 2 - elif charge == '[M+OAc]-': - lipid_elem_dct['H'] += 3 - lipid_elem_dct['C'] += 2 - lipid_elem_dct['O'] += 2 - elif charge == '[M+H]+': - lipid_elem_dct['H'] += 1 - elif charge == '[M+NH4]+': - if 'N' in list(lipid_elem_dct.keys()): - lipid_elem_dct['N'] += 1 + if charge == "[M-H]-": + lipid_elem_dct["H"] += -1 + elif charge == "[M+HCOO]-" or charge == "[M+FA-H]-": + lipid_elem_dct["H"] += 1 + lipid_elem_dct["C"] += 1 + lipid_elem_dct["O"] += 2 + elif charge == "[M+CH3COO]-": + lipid_elem_dct["H"] += 3 + lipid_elem_dct["C"] += 2 + lipid_elem_dct["O"] += 2 + elif charge == "[M+OAc]-": + lipid_elem_dct["H"] += 3 + lipid_elem_dct["C"] += 2 + lipid_elem_dct["O"] += 2 + elif charge == "[M+H]+": + lipid_elem_dct["H"] += 1 + elif charge == "[M+NH4]+": + if "N" in list(lipid_elem_dct.keys()): + lipid_elem_dct["N"] += 1 else: - lipid_elem_dct['N'] = 1 - lipid_elem_dct['H'] += 4 - elif charge == '[M+Na]+': - lipid_elem_dct['Na'] = 1 + lipid_elem_dct["N"] = 1 + lipid_elem_dct["H"] += 4 + elif charge == "[M+Na]+": + lipid_elem_dct["Na"] = 1 return lipid_elem_dct - def get_formula(self, abbr, charge=''): + def get_formula(self, abbr, charge=""): - if charge in ['neutral', 'Neutral', '', None]: + if charge in ["neutral", "Neutral", "", None]: elem_dct = self.get_neutral_elem(abbr) else: elem_dct = self.get_charged_elem(abbr, charge=charge) - formula_str = 'C{c}H{h}'.format(c=elem_dct['C'], h=elem_dct['H']) - - if 'N' in list(elem_dct.keys()): - if elem_dct['N'] == 1: - formula_str += 'N' - elif elem_dct['N'] > 1: - formula_str += 'N%i' % elem_dct['N'] - - if 'O' in list(elem_dct.keys()): - if elem_dct['O'] == 1: - formula_str += 'O' - elif elem_dct['O'] > 1: - formula_str += 'O%i' % elem_dct['O'] - - if 'P' in list(elem_dct.keys()): - if elem_dct['P'] == 1: - formula_str += 'P' - elif elem_dct['P'] > 1: - formula_str += 'P%i' % elem_dct['P'] - - if 'Na' in list(elem_dct.keys()): - if elem_dct['Na'] == 1: - formula_str += 'Na' - elif elem_dct['Na'] > 1: - formula_str += 'Na%i' % elem_dct['Na'] - - if 'K' in list(elem_dct.keys()): - if elem_dct['K'] == 1: - formula_str += 'K' - elif elem_dct['K'] > 1: - formula_str += 'K%i' % elem_dct['K'] - - if charge in ['neutral', 'Neutral', '', None]: + formula_str = "C{c}H{h}".format(c=elem_dct["C"], h=elem_dct["H"]) + + if "N" in list(elem_dct.keys()): + if elem_dct["N"] == 1: + formula_str += "N" + elif elem_dct["N"] > 1: + formula_str += "N%i" % elem_dct["N"] + + if "O" in list(elem_dct.keys()): + if elem_dct["O"] == 1: + formula_str += "O" + elif elem_dct["O"] > 1: + formula_str += "O%i" % elem_dct["O"] + + if "P" in list(elem_dct.keys()): + if elem_dct["P"] == 1: + formula_str += "P" + elif elem_dct["P"] > 1: + formula_str += "P%i" % elem_dct["P"] + + if "Na" in list(elem_dct.keys()): + if elem_dct["Na"] == 1: + formula_str += "Na" + elif elem_dct["Na"] > 1: + formula_str += "Na%i" % elem_dct["Na"] + + if "K" in list(elem_dct.keys()): + if elem_dct["K"] == 1: + formula_str += "K" + elif elem_dct["K"] > 1: + formula_str += "K%i" % elem_dct["K"] + + if charge in ["neutral", "Neutral", "", None]: pass - elif charge in ['[M-H]-', '[M+HCOO]-']: - formula_str += '-' - elif charge in ['[M+H]+', '[M+NH4]+', '[M+Na]+']: - formula_str += '+' + elif charge in ["[M-H]-", "[M+HCOO]-"]: + formula_str += "-" + elif charge in ["[M+H]+", "[M+NH4]+", "[M+Na]+"]: + formula_str += "+" # print ('lets see if you manage to get out from this one') return formula_str, elem_dct @@ -430,37 +516,57 @@ def get_exactmass(self, elem_dct): # Current step is working for TG # This is needed to understand if the precursors is true [M+H]+ or [M+Na]+ (given the users option) def get_NH3_pos_mode(self, charge, mz_pr, amm_elem_dct): - mz_NH3_pr_H = '' # The corespond mz of [M+NH4]+ if the given precursor corresponds to the [M+H]+ - mz_NH3_pr_Na = '' # The corespond mz of [M+NH4]+ if the given precursor corresponds to the [M+Na]+ - if charge in ['[M+H]+']: + mz_NH3_pr_H = ( + "" + ) # The corespond mz of [M+NH4]+ if the given precursor corresponds to the [M+H]+ + mz_NH3_pr_Na = ( + "" + ) # The corespond mz of [M+NH4]+ if the given precursor corresponds to the [M+Na]+ + if charge in ["[M+H]+"]: # Problem need to calculate the theoritical one and not according to the experimental identification # mz_NH3_pr_H = mz_pr - self.periodic_table_dct['H'][0][0] + (4 * self.periodic_table_dct['H'][0][0]) + \ # self.periodic_table_dct['N'][0][0] - mz_NH3_pr_H = amm_elem_dct['C'] * self.periodic_table_dct['C'][0][0] + amm_elem_dct['H'] * \ - self.periodic_table_dct['H'][0][0] + amm_elem_dct['O'] * self.periodic_table_dct['O'][0][0] + \ - self.periodic_table_dct['N'][0][0] + mz_NH3_pr_H = ( + amm_elem_dct["C"] * self.periodic_table_dct["C"][0][0] + + amm_elem_dct["H"] * self.periodic_table_dct["H"][0][0] + + amm_elem_dct["O"] * self.periodic_table_dct["O"][0][0] + + self.periodic_table_dct["N"][0][0] + ) # If this precursor corresponds to the [M+Na]+ then to calculate the bulk identification which it will be different from the above # We do the following calculations # First remove the charge and the atoms which form the glycerol bond (Na, C3, H5) # C3H5Na = 64.028895 - mz_pr_Na = mz_pr - self.periodic_table_dct['Na'][0][0] - (self.periodic_table_dct['C'][0][0] * 3) - ( - self.periodic_table_dct['H'][0][0] * 5) + mz_pr_Na = ( + mz_pr + - self.periodic_table_dct["Na"][0][0] + - (self.periodic_table_dct["C"][0][0] * 3) + - (self.periodic_table_dct["H"][0][0] * 5) + ) # Second Step: For TG Remove the 6O and the first C from the 3 FA and the last C with the 3 H from each # O = 15.994915, C = 12, CH3 = 15.023475 # 6O, 3xC, 3xCH3 => C6H9O6 = 177.039915 - mz_pr_Na = mz_pr_Na - (self.periodic_table_dct['O'][0][0] * 6) - ( - self.periodic_table_dct['C'][0][0] * 6) - (self.periodic_table_dct['H'][0][0] * 9) + mz_pr_Na = ( + mz_pr_Na + - (self.periodic_table_dct["O"][0][0] * 6) + - (self.periodic_table_dct["C"][0][0] * 6) + - (self.periodic_table_dct["H"][0][0] * 9) + ) mz_pr_Na = int(mz_pr_Na) db_count_Na = 0 - while (mz_pr_Na % 14 > 1): + while mz_pr_Na % 14 > 1: db_count_Na = db_count_Na + 1 mz_pr_Na = mz_pr_Na - 26 c_count_Na = int(mz_pr_Na / 14) + 6 + db_count_Na * 2 - tg_abbt_bulk_Na = 'TG(' + str(c_count_Na) + ':' + str(db_count_Na) + ')' - _mz_Na_formula, _mz_Na_elemdct = self.get_formula(tg_abbt_bulk_Na, '[M+Na]+') - mz_NH3_pr_Na = _mz_Na_elemdct['C'] * self.periodic_table_dct['C'][0][0] + ( - (_mz_Na_elemdct['H'] + 4) * self.periodic_table_dct['H'][0][0]) + _mz_Na_elemdct['O'] * \ - self.periodic_table_dct['O'][0][0] + self.periodic_table_dct['N'][0][0] + tg_abbt_bulk_Na = "TG(" + str(c_count_Na) + ":" + str(db_count_Na) + ")" + _mz_Na_formula, _mz_Na_elemdct = self.get_formula( + tg_abbt_bulk_Na, "[M+Na]+" + ) + mz_NH3_pr_Na = ( + _mz_Na_elemdct["C"] * self.periodic_table_dct["C"][0][0] + + ((_mz_Na_elemdct["H"] + 4) * self.periodic_table_dct["H"][0][0]) + + _mz_Na_elemdct["O"] * self.periodic_table_dct["O"][0][0] + + self.periodic_table_dct["N"][0][0] + ) # Third step: the rest of the elements correspond to the CH2 * x and if DB to the (CHx2) * y (For 1DB == 2xCH) # CH2 = 14.015650, CH = 13.007825 # Need to create a loop and make all the numbers integers @@ -471,47 +577,75 @@ def get_NH3_pos_mode(self, charge, mz_pr, amm_elem_dct): # TODO(georgia.angelidou@uni-leipzig.de): _mz_H_formula is used before ref, fix here! # Temp add - mz_NH4_H_form = 'C' + str(amm_elem_dct['C']) + 'H' + str(amm_elem_dct['H']) + 'O6N' + mz_NH4_H_form = ( + "C" + str(amm_elem_dct["C"]) + "H" + str(amm_elem_dct["H"]) + "O6N" + ) # mz_NH4_Na_form = _mz_H_formula - mz_NH4_Na_form = 'C' + str(_mz_Na_elemdct['C']) + 'H' + str((_mz_Na_elemdct['H'] + 3)) + 'O6N' - - elif charge in ['[M+Na]+']: - mz_NH3_pr_Na = amm_elem_dct['C'] * self.periodic_table_dct['C'][0][0] + amm_elem_dct['H'] * \ - self.periodic_table_dct['H'][0][0] + amm_elem_dct['O'] * self.periodic_table_dct['O'][0][0] + \ - self.periodic_table_dct['N'][0][0] - print (mz_pr) - C5H3= self.periodic_table_dct['H'][0][0] * 6 + self.periodic_table_dct['C'][0][0] *3 - rest_sampl = self.periodic_table_dct['O'][0][0] *6 + self.periodic_table_dct['H'][0][0] *9 + self.periodic_table_dct['C'][0][0] * 6 + mz_NH4_Na_form = ( + "C" + + str(_mz_Na_elemdct["C"]) + + "H" + + str((_mz_Na_elemdct["H"] + 3)) + + "O6N" + ) + + elif charge in ["[M+Na]+"]: + mz_NH3_pr_Na = ( + amm_elem_dct["C"] * self.periodic_table_dct["C"][0][0] + + amm_elem_dct["H"] * self.periodic_table_dct["H"][0][0] + + amm_elem_dct["O"] * self.periodic_table_dct["O"][0][0] + + self.periodic_table_dct["N"][0][0] + ) + print(mz_pr) + C5H3 = ( + self.periodic_table_dct["H"][0][0] * 6 + + self.periodic_table_dct["C"][0][0] * 3 + ) + rest_sampl = ( + self.periodic_table_dct["O"][0][0] * 6 + + self.periodic_table_dct["H"][0][0] * 9 + + self.periodic_table_dct["C"][0][0] * 6 + ) mz_pr_H = mz_pr - C5H3 - rest_sampl mz_pr_H = int(mz_pr_H) db_count_H = 0 - while (mz_pr_H % 14 > 1): + while mz_pr_H % 14 > 1: db_count_H = db_count_H + 1 mz_pr_H = mz_pr_H - 26 c_count_H = int(mz_pr_H / 14) + 6 + db_count_H * 2 - tg_abbt_bulk_H = 'TG(' + str(c_count_H) + ':' + str(db_count_H) + ')' - _mz_H_formula, _mz_H_elemdct = self.get_formula(tg_abbt_bulk_H, '[M+H]+') - mz_NH3_pr_H = _mz_H_elemdct['C'] * self.periodic_table_dct['C'][0][0] + (_mz_H_elemdct['H'] + 3) * \ - self.periodic_table_dct['H'][0][0] + _mz_H_elemdct['O'] * self.periodic_table_dct['O'][0][0] + self.periodic_table_dct['N'][0][0] - mz_NH4_Na_form = 'C' + str(amm_elem_dct['C']) + 'H' + str(amm_elem_dct['H']) + 'O6N' - mz_NH4_H_form = 'C' + str(_mz_H_elemdct['C']) + 'H' + str((_mz_H_elemdct['H'] + 3)) + 'O6N' - - + tg_abbt_bulk_H = "TG(" + str(c_count_H) + ":" + str(db_count_H) + ")" + _mz_H_formula, _mz_H_elemdct = self.get_formula(tg_abbt_bulk_H, "[M+H]+") + mz_NH3_pr_H = ( + _mz_H_elemdct["C"] * self.periodic_table_dct["C"][0][0] + + (_mz_H_elemdct["H"] + 3) * self.periodic_table_dct["H"][0][0] + + _mz_H_elemdct["O"] * self.periodic_table_dct["O"][0][0] + + self.periodic_table_dct["N"][0][0] + ) + mz_NH4_Na_form = ( + "C" + str(amm_elem_dct["C"]) + "H" + str(amm_elem_dct["H"]) + "O6N" + ) + mz_NH4_H_form = ( + "C" + + str(_mz_H_elemdct["C"]) + + "H" + + str((_mz_H_elemdct["H"] + 3)) + + "O6N" + ) return (mz_NH3_pr_H, mz_NH4_H_form, mz_NH3_pr_Na, mz_NH4_Na_form) -if __name__ == '__main__': +if __name__ == "__main__": usr_bulk_abbr_lst = [ # 'TG(P-48:2)', # 'PC(O-36:3)', # 'PC(P-36:3)', # 'PC(36:3)', - 'LPC(20:3)' + "LPC(20:3)" ] - charge_lst = ['[M+NH4]+', '[M-H]-', '[M+HCOO]-', '[M+OAc]-'] + charge_lst = ["[M+NH4]+", "[M-H]-", "[M+HCOO]-", "[M+OAc]-"] # usr_bulk_abbr_lst = ['PC(36:3)', 'PC(O-36:3)', 'PC(P-36:3)'] # charge_lst = ['', '[M-H]-', '[M+HCOO]-', '[M+OAc]-'] @@ -519,7 +653,9 @@ def get_NH3_pos_mode(self, charge, mz_pr, amm_elem_dct): for usr_abbr in usr_bulk_abbr_lst: for _charge in charge_lst: - usr_formula, usr_elem_dct = abbr2formula.get_formula(usr_abbr, charge=_charge) + usr_formula, usr_elem_dct = abbr2formula.get_formula( + usr_abbr, charge=_charge + ) print((usr_abbr, _charge)) print(usr_elem_dct) print(usr_formula) diff --git a/LibLipidHunter/HuntManager.py b/LibLipidHunter/HuntManager.py index 895f07f..6eb7860 100644 --- a/LibLipidHunter/HuntManager.py +++ b/LibLipidHunter/HuntManager.py @@ -31,14 +31,14 @@ def save_hunt(results_pickle_dct, hunt_save_path): - for key in ['lipid_info_img_lst', 'param_dct', 'output_df', 'final_output_df']: + for key in ["lipid_info_img_lst", "param_dct", "output_df", "final_output_df"]: if key in list(results_pickle_dct.keys()): pass else: - print('Key %s is missing' % key) + print("Key %s is missing" % key) raise KeyError - with open(hunt_save_path, 'wb') as results_pickle: + with open(hunt_save_path, "wb") as results_pickle: pickle.dump(results_pickle_dct, results_pickle) @@ -47,32 +47,34 @@ def recover_hunt(hunter_data): hunt_pickle_dct = pickle.load(hunter_data) print(list(hunt_pickle_dct.keys())) - param_dct = hunt_pickle_dct['param_dct'] - output_df = hunt_pickle_dct['output_df'] - lipid_info_img_lst = hunt_pickle_dct['lipid_info_img_lst'] - final_output_df = hunt_pickle_dct['final_output_df'] - - usr_vendor = param_dct['vendor'] - output_folder = param_dct['img_output_folder_str'] - output_sum_xlsx = param_dct['xlsx_output_path_str'] - usr_ms1_ppm = param_dct['ms_ppm'] - usr_ms2_ppm = param_dct['ms2_ppm'] + param_dct = hunt_pickle_dct["param_dct"] + output_df = hunt_pickle_dct["output_df"] + lipid_info_img_lst = hunt_pickle_dct["lipid_info_img_lst"] + final_output_df = hunt_pickle_dct["final_output_df"] + + usr_vendor = param_dct["vendor"] + output_folder = param_dct["img_output_folder_str"] + output_sum_xlsx = param_dct["xlsx_output_path_str"] + usr_ms1_ppm = param_dct["ms_ppm"] + usr_ms2_ppm = param_dct["ms2_ppm"] usr_ms1_precision = usr_ms1_ppm * 1e-6 - hunter_start_time_str = param_dct['hunter_start_time'] - usr_core_num = param_dct['core_number'] - usr_dpi = param_dct['img_dpi'] - usr_img_type = param_dct['img_type'] + hunter_start_time_str = param_dct["hunter_start_time"] + usr_core_num = param_dct["core_number"] + usr_dpi = param_dct["img_dpi"] + usr_img_type = param_dct["img_type"] output_sum_xlsx_directory = os.path.dirname(output_sum_xlsx) if not os.path.exists(output_sum_xlsx_directory): os.makedirs(output_sum_xlsx_directory) try: final_output_df.to_excel(output_sum_xlsx, index=False) - print('[OUTPUT] ==> Prepare to save output as: ', output_sum_xlsx) + print("[OUTPUT] ==> Prepare to save output as: ", output_sum_xlsx) except IOError: - final_output_df.to_excel('%s-%i%s' % (output_sum_xlsx[:-5], int(time.time()), '.xlsx'), index=False) + final_output_df.to_excel( + "%s-%i%s" % (output_sum_xlsx[:-5], int(time.time()), ".xlsx"), index=False + ) print(output_sum_xlsx) - print('[OUTPUT] ==> File saved ...') + print("[OUTPUT] ==> File saved ...") if lipid_info_img_lst: gen_html_report(param_dct, output_df, lipid_info_img_lst) @@ -80,31 +82,31 @@ def recover_hunt(hunter_data): def gen_html_report(param_dct, output_df, lipid_info_img_lst): - usr_vendor = param_dct['vendor'] - output_folder = param_dct['img_output_folder_str'] - usr_ms1_ppm = param_dct['ms_ppm'] - usr_ms2_ppm = param_dct['ms2_ppm'] + usr_vendor = param_dct["vendor"] + output_folder = param_dct["img_output_folder_str"] + usr_ms1_ppm = param_dct["ms_ppm"] + usr_ms2_ppm = param_dct["ms2_ppm"] usr_ms1_precision = usr_ms1_ppm * 1e-6 usr_ms2_precision = usr_ms2_ppm * 1e-6 - usr_core_num = param_dct['core_number'] - usr_dpi = param_dct['img_dpi'] - usr_img_type = param_dct['img_type'] - hunter_start_time_str = param_dct['hunter_start_time'] + usr_core_num = param_dct["core_number"] + usr_dpi = param_dct["img_dpi"] + usr_img_type = param_dct["img_type"] + hunter_start_time_str = param_dct["hunter_start_time"] # keep stay in current working directory current_path = os.getcwd() if os.path.isdir(output_folder): os.chdir(output_folder) - if os.path.isdir('LipidHunter_Results_Figures_%s' % hunter_start_time_str): - print('[INFO] --> Output folder existed...') + if os.path.isdir("LipidHunter_Results_Figures_%s" % hunter_start_time_str): + print("[INFO] --> Output folder existed...") else: - os.mkdir('LipidHunter_Results_Figures_%s' % hunter_start_time_str) - print('[INFO] --> Output folder created...') + os.mkdir("LipidHunter_Results_Figures_%s" % hunter_start_time_str) + print("[INFO] --> Output folder created...") else: os.mkdir(output_folder) os.chdir(output_folder) - os.mkdir('LipidHunter_Results_Figures_%s' % hunter_start_time_str) - print('[INFO] --> Output folder created...') + os.mkdir("LipidHunter_Results_Figures_%s" % hunter_start_time_str) + print("[INFO] --> Output folder created...") os.chdir(current_path) # generate html files @@ -112,13 +114,19 @@ def gen_html_report(param_dct, output_df, lipid_info_img_lst): log_pager.add_all_info(output_df) log_pager.close_page() # del log_pager - print('[STATUS] >>> start to generate images: image count %i' % len(lipid_info_img_lst)) + print( + "[STATUS] >>> start to generate images: image count %i" + % len(lipid_info_img_lst) + ) if usr_core_num > 1: parallel_pool = Pool(usr_core_num) img_num = len(lipid_info_img_lst) img_sub_len = int(math.ceil(img_num / usr_core_num)) - img_sub_key_lst = [lipid_info_img_lst[k: k + img_sub_len] for k in range(0, img_num, img_sub_len)] + img_sub_key_lst = [ + lipid_info_img_lst[k : k + img_sub_len] + for k in range(0, img_num, img_sub_len) + ] worker_count = 1 for img_sub_lst in img_sub_key_lst: @@ -132,14 +140,25 @@ def gen_html_report(param_dct, output_df, lipid_info_img_lst): # 'usr_ms1_precision': usr_ms1_precision, 'worker_count': worker_count} if len(img_sub_lst) > 0: - print('[STATUS] >>> Core #%i ==> Generating output images ... image count: %i' - % (worker_count, len(img_sub_lst))) - if 'debug_mode' in list(param_dct.keys()): - if param_dct['debug_mode'] == 'ON': + print( + "[STATUS] >>> Core #%i ==> Generating output images ... image count: %i" + % (worker_count, len(img_sub_lst)) + ) + if "debug_mode" in list(param_dct.keys()): + if param_dct["debug_mode"] == "ON": for img_param_dct in img_sub_lst: - print(img_param_dct['save_img_as']) - parallel_pool.apply_async(gen_plot, args=(img_sub_lst, worker_count, usr_img_type, - usr_dpi, usr_vendor, usr_ms1_precision)) + print(img_param_dct["save_img_as"]) + parallel_pool.apply_async( + gen_plot, + args=( + img_sub_lst, + worker_count, + usr_img_type, + usr_dpi, + usr_vendor, + usr_ms1_precision, + ), + ) worker_count += 1 # del img_sub_key_lst # del img_sub_lst @@ -148,18 +167,26 @@ def gen_html_report(param_dct, output_df, lipid_info_img_lst): else: worker_count = 1 - print('[INFO] --> Using single core mode...') - if isinstance(lipid_info_img_lst, tuple) or isinstance(lipid_info_img_lst, list): + print("[INFO] --> Using single core mode...") + if isinstance(lipid_info_img_lst, tuple) or isinstance( + lipid_info_img_lst, list + ): if None in lipid_info_img_lst: lipid_info_img_lst = [x for x in lipid_info_img_lst if x is not None] else: pass if len(lipid_info_img_lst) > 0: - gen_plot(lipid_info_img_lst, worker_count, usr_img_type, usr_dpi, - usr_vendor, usr_ms1_precision) + gen_plot( + lipid_info_img_lst, + worker_count, + usr_img_type, + usr_dpi, + usr_vendor, + usr_ms1_precision, + ) -if __name__ == '__main__': +if __name__ == "__main__": from test.test_HuntManager import test_recover_hunt diff --git a/LibLipidHunter/Hunter_Core.py b/LibLipidHunter/Hunter_Core.py index 2aa6750..2e9acc1 100644 --- a/LibLipidHunter/Hunter_Core.py +++ b/LibLipidHunter/Hunter_Core.py @@ -42,7 +42,7 @@ from LibLipidHunter.HuntManager import gen_html_report -def save_output(output_path: str, output_df: pd.DataFrame, output_name: str = 'output'): +def save_output(output_path: str, output_df: pd.DataFrame, output_name: str = "output"): """ function to save output in a safer way with few checks. @@ -57,33 +57,45 @@ def save_output(output_path: str, output_df: pd.DataFrame, output_name: str = 'o if not os.path.exists(output_directory): os.makedirs(output_directory) - if output_path.endswith('.xlsx'): + if output_path.endswith(".xlsx"): try: output_df.to_excel(output_path, index=False) - print(f'[OUTPUT] ==> Prepare to save {output_name} as: ', output_path) + print(f"[OUTPUT] ==> Prepare to save {output_name} as: ", output_path) except IOError: - output_df.to_excel('{0}-{1}{2}'.format(output_path[:-5], int(time.time()), '.xlsx'), index=False) + output_df.to_excel( + "{0}-{1}{2}".format(output_path[:-5], int(time.time()), ".xlsx"), + index=False, + ) print(output_path) - elif output_path.endswith('.csv'): + elif output_path.endswith(".csv"): try: output_df.to_csv(output_path, index=False) - print(f'[OUTPUT] ==> Prepare to save {output_name} as: ', output_path) + print(f"[OUTPUT] ==> Prepare to save {output_name} as: ", output_path) except IOError: - output_df.to_csv('{0}-{1}{2}'.format(output_path[:-5], int(time.time()), '.csv'), index=False) + output_df.to_csv( + "{0}-{1}{2}".format(output_path[:-5], int(time.time()), ".csv"), + index=False, + ) print(output_path) else: try: - output_df.to_excel(f'{output_path}.xlsx', index=False) - print(f'[OUTPUT] ==> Prepare to save {output_name} as: ', f'{output_path}.xlsx') + output_df.to_excel(f"{output_path}.xlsx", index=False) + print( + f"[OUTPUT] ==> Prepare to save {output_name} as: ", + f"{output_path}.xlsx", + ) except IOError: - output_df.to_excel('{0}-{1}{2}'.format(output_path[:-5], int(time.time()), '.xlsx'), index=False) + output_df.to_excel( + "{0}-{1}{2}".format(output_path[:-5], int(time.time()), ".xlsx"), + index=False, + ) print(output_path) - print('[OUTPUT] ==> {output_name} saved ...') + print("[OUTPUT] ==> {output_name} saved ...") -def huntlipids(param_dct: dict, error_lst: list, - save_fig: bool = True, save_session: bool = False) \ - -> Tuple[Union[float, bool], list, Union[pd.DataFrame, bool]]: +def huntlipids( + param_dct: dict, error_lst: list, save_fig: bool = True, save_session: bool = False +) -> Tuple[Union[float, bool], list, Union[pd.DataFrame, bool]]: """ This is the core workflow of lipidhunter. The cmd_lipidhunter and LipidHunter GUI transfer the parsed Lipidhunter configurations as param_dct. @@ -119,34 +131,34 @@ def huntlipids(param_dct: dict, error_lst: list, """ - print('[INFO] --> Hunter Core Start...') + print("[INFO] --> Hunter Core Start...") # initialization of all parameters start_time = time.clock() lipidcomposer = LipidComposer() - usr_lipid_class = param_dct['lipid_class'] - usr_charge = param_dct['charge_mode'] - usr_vendor = param_dct['vendor'] - usr_fa_xlsx = param_dct['fawhitelist_path_str'] - usr_mzml = param_dct['mzml_path_str'] - output_folder = param_dct['img_output_folder_str'] - output_sum_xlsx = param_dct['xlsx_output_path_str'] + usr_lipid_class = param_dct["lipid_class"] + usr_charge = param_dct["charge_mode"] + usr_vendor = param_dct["vendor"] + usr_fa_xlsx = param_dct["fawhitelist_path_str"] + usr_mzml = param_dct["mzml_path_str"] + output_folder = param_dct["img_output_folder_str"] + output_sum_xlsx = param_dct["xlsx_output_path_str"] - key_frag_cfg = param_dct['lipid_specific_cfg'] - score_cfg = param_dct['score_cfg'] + key_frag_cfg = param_dct["lipid_specific_cfg"] + score_cfg = param_dct["score_cfg"] - usr_rt_range = [param_dct['rt_start'], param_dct['rt_end']] + usr_rt_range = [param_dct["rt_start"], param_dct["rt_end"]] # usr_pr_mz_range = [param_dct['mz_start'], param_dct['mz_end']] - mz_start = param_dct['mz_start'] - mz_end = param_dct['mz_end'] - usr_dda_top = param_dct['dda_top'] - usr_ms1_threshold = param_dct['ms_th'] - usr_ms1_max = param_dct['ms_max'] - usr_ms2_threshold = param_dct['ms2_th'] - usr_ms1_ppm = param_dct['ms_ppm'] - usr_ms2_ppm = param_dct['ms2_ppm'] + mz_start = param_dct["mz_start"] + mz_end = param_dct["mz_end"] + usr_dda_top = param_dct["dda_top"] + usr_ms1_threshold = param_dct["ms_th"] + usr_ms1_max = param_dct["ms_max"] + usr_ms2_threshold = param_dct["ms2_th"] + usr_ms1_ppm = param_dct["ms_ppm"] + usr_ms2_ppm = param_dct["ms2_ppm"] usr_ms1_precision = usr_ms1_ppm * 1e-6 usr_ms2_precision = usr_ms2_ppm * 1e-6 # usr_rank_score_filter = param_dct['rank_score_filter'] @@ -155,71 +167,90 @@ def huntlipids(param_dct: dict, error_lst: list, # usr_ms2_info_th = param_dct['ms2_infopeak_threshold'] # usr_rank_mode = param_dct['rank_score'] # usr_fast_isotope = param_dct['fast_isotope'] - if 'xic_ppm' in list(param_dct.keys()): - usr_xic_ppm = int(param_dct['xic_ppm']) + if "xic_ppm" in list(param_dct.keys()): + usr_xic_ppm = int(param_dct["xic_ppm"]) else: usr_xic_ppm = usr_ms1_ppm # parameters from settings tab - usr_core_num = param_dct['core_number'] - usr_max_ram = param_dct['max_ram'] + usr_core_num = param_dct["core_number"] + usr_max_ram = param_dct["max_ram"] # usr_dpi = param_dct['img_dpi'] # usr_img_type = param_dct['img_type'] - hunter_start_time_str = param_dct['hunter_start_time'] + hunter_start_time_str = param_dct["hunter_start_time"] try: - if param_dct['debug_mode'] == 'ON': + if param_dct["debug_mode"] == "ON": save_session = True else: pass except (KeyError, AttributeError): - print('Debug mode == off') + print("Debug mode == off") # Check platform for multiprocessing settings if platform == "linux" or platform == "linux2": # linux if usr_core_num > 1: - os_typ = 'linux_multi' - print('[INFO] --> LipidHunter Running on >>> Linux with multiprocessing mode ...') + os_typ = "linux_multi" + print( + "[INFO] --> LipidHunter Running on >>> Linux with multiprocessing mode ..." + ) else: - os_typ = 'linux_single' - print('[INFO] --> LipidHunter Running on >>> Linux with single core mode ...') + os_typ = "linux_single" + print( + "[INFO] --> LipidHunter Running on >>> Linux with single core mode ..." + ) elif platform == "win32": # Windows - os_typ = 'windows' - print('[INFO] --> LipidHunter Running on >>> Windows ...') + os_typ = "windows" + print("[INFO] --> LipidHunter Running on >>> Windows ...") elif platform == "darwin": # macOS if usr_core_num > 1: - os_typ = 'linux_multi' - print('[INFO] --> LipidHunter Running on >>> macOS with multiprocessing mode ...') + os_typ = "linux_multi" + print( + "[INFO] --> LipidHunter Running on >>> macOS with multiprocessing mode ..." + ) else: - os_typ = 'linux_single' - print('[INFO] --> LipidHunter Running on >>> macOS with single core mode ...') + os_typ = "linux_single" + print( + "[INFO] --> LipidHunter Running on >>> macOS with single core mode ..." + ) else: usr_core_num = 1 - param_dct['core_number'] = 1 - os_typ = 'linux_single' - print('[INFO] --> LipidHunter Running on >>> unoptimized system ... %s' % platform) - print('[WARNING] !!! Force to use single core mode !!') - - print('[INFO] --> Start to process >>>') - print('[INFO] --> Lipid class: %s >>>' % usr_lipid_class) - - composer_param_dct = {'fa_whitelist': usr_fa_xlsx, 'lipid_class': usr_lipid_class, - 'charge_mode': usr_charge, 'exact_position': 'FALSE'} - - existed_lipid_master_path = '' # reserved to load existing lipid master table for later development + param_dct["core_number"] = 1 + os_typ = "linux_single" + print( + "[INFO] --> LipidHunter Running on >>> unoptimized system ... %s" % platform + ) + print("[WARNING] !!! Force to use single core mode !!") + + print("[INFO] --> Start to process >>>") + print("[INFO] --> Lipid class: %s >>>" % usr_lipid_class) + + composer_param_dct = { + "fa_whitelist": usr_fa_xlsx, + "lipid_class": usr_lipid_class, + "charge_mode": usr_charge, + "exact_position": "FALSE", + } + + existed_lipid_master_path = ( + "" + ) # reserved to load existing lipid master table for later development use_existed_lipid_master = False # reserved to re-use lipid master table save_lipid_master_table = False - if 'debug_mode' in list(param_dct.keys()): - if param_dct['debug_mode'] == 'ON': - if 'lipid_master_table' in list(param_dct.keys()): - existed_lipid_master_path = param_dct['lipid_master_table'] + if "debug_mode" in list(param_dct.keys()): + if param_dct["debug_mode"] == "ON": + if "lipid_master_table" in list(param_dct.keys()): + existed_lipid_master_path = param_dct["lipid_master_table"] if os.path.isfile(existed_lipid_master_path): use_existed_lipid_master = True else: - print('[ERROR] !!! Failed to load existed Lipid Master table: %s', existed_lipid_master_path) + print( + "[ERROR] !!! Failed to load existed Lipid Master table: %s", + existed_lipid_master_path, + ) else: save_lipid_master_table = True @@ -230,22 +261,34 @@ def huntlipids(param_dct: dict, error_lst: list, if use_existed_lipid_master is False: try: - print('[INFO] --> Start to generate Lipid Master Table ...') + print("[INFO] --> Start to generate Lipid Master Table ...") t_lm_0 = time.time() - usr_lipid_master_df = lipidcomposer.compose_lipid(param_dct=composer_param_dct, ms2_ppm=usr_ms2_ppm) - print('[INFO] --> Lipid Master Table generated >>> in %.2f sec' % (time.time() - t_lm_0)) + usr_lipid_master_df = lipidcomposer.compose_lipid( + param_dct=composer_param_dct, ms2_ppm=usr_ms2_ppm + ) + print( + "[INFO] --> Lipid Master Table generated >>> in %.2f sec" + % (time.time() - t_lm_0) + ) except Exception as e: - print('[ERROR] !!! Failed to predict Lipid structures...', e) + print("[ERROR] !!! Failed to predict Lipid structures...", e) error_lst.append(e) - error_lst.append('[ERROR] !!! Some files missing...') - error_lst.append('... ... Please check your settings in the configuration file ...') + error_lst.append("[ERROR] !!! Some files missing...") + error_lst.append( + "... ... Please check your settings in the configuration file ..." + ) return False, error_lst, False else: try: - print('[INFO] --> Try to use existed Lipid Master table: %s' % existed_lipid_master_path) + print( + "[INFO] --> Try to use existed Lipid Master table: %s" + % existed_lipid_master_path + ) usr_lipid_master_df = pd.read_csv(existed_lipid_master_path) - print('[INFO] --> Lipid Master table loaded >>>', usr_lipid_master_df.shape[0]) + print( + "[INFO] --> Lipid Master table loaded >>>", usr_lipid_master_df.shape[0] + ) except Exception as e: print(e) error_lst.append(e) @@ -256,73 +299,103 @@ def huntlipids(param_dct: dict, error_lst: list, if not usr_lipid_master_df.empty: pass else: - print('[ERROR] !!! Failed to generate LipidMaster Table...') - error_lst.append('[ERROR] !!! Failed to generate LipidMaster Table...') - error_lst.append('... ... Please check if Lipid Class and FA are marked in FA whitelist...') + print("[ERROR] !!! Failed to generate LipidMaster Table...") + error_lst.append("[ERROR] !!! Failed to generate LipidMaster Table...") + error_lst.append( + "... ... Please check if Lipid Class and FA are marked in FA whitelist..." + ) return False, error_lst, False else: - print('[ERROR] !!! Failed to generate LipidMaster Table...') - error_lst.append('[ERROR] !!! Failed to generate LipidMaster Table...') - error_lst.append('... ... Please check if Lipid Class and FA are marked in FA whitelist...') + print("[ERROR] !!! Failed to generate LipidMaster Table...") + error_lst.append("[ERROR] !!! Failed to generate LipidMaster Table...") + error_lst.append( + "... ... Please check if Lipid Class and FA are marked in FA whitelist..." + ) return False, error_lst, False if save_lipid_master_table is True: - log_master_name = 'Lipid_Master_%s.csv' % hunter_start_time_str + log_master_name = "Lipid_Master_%s.csv" % hunter_start_time_str log_master_name = os.path.join(output_folder, log_master_name) - print('[OUTPUT] ==> Lipid Master table Saved as: ', log_master_name) - save_output(log_master_name, usr_lipid_master_df, output_name='Lipid Master table') + print("[OUTPUT] ==> Lipid Master table Saved as: ", log_master_name) + save_output( + log_master_name, usr_lipid_master_df, output_name="Lipid Master table" + ) else: pass # for TG has the fragment of neutral loss of the FA and the fragments for the MG - usr_fa_df = lipidcomposer.calc_fa_query(usr_lipid_class, usr_fa_xlsx, ms2_ppm=usr_ms2_ppm) + usr_fa_df = lipidcomposer.calc_fa_query( + usr_lipid_class, usr_fa_xlsx, ms2_ppm=usr_ms2_ppm + ) # del lipidcomposer if usr_fa_df is False: - print('[ERROR] !!! Failed to generate FA info table ...\n') - error_lst.append('[ERROR] !!! Failed to generate FA info table ...\n') + print("[ERROR] !!! Failed to generate FA info table ...\n") + error_lst.append("[ERROR] !!! Failed to generate FA info table ...\n") return False, error_lst, False - lipid_info_df = usr_lipid_master_df # make a copy to avoid pandas warning when modify it later + lipid_info_df = ( + usr_lipid_master_df + ) # make a copy to avoid pandas warning when modify it later # cut lib info to the user defined m/z range # TODO (georgia.angelidou@uni-leipzig.de): support for the sphingomyelins and ceramides - pos_charge_lst = ['[M+H]+', '[M+Na]+', '[M+NH4]+'] - neg_charge_lst = ['[M-H]-', '[M+HCOO]-', '[M+CH3COO]-'] + pos_charge_lst = ["[M+H]+", "[M+Na]+", "[M+NH4]+"] + neg_charge_lst = ["[M-H]-", "[M+HCOO]-", "[M+CH3COO]-"] if usr_charge in neg_charge_lst: - if usr_lipid_class in ['PC', 'LPC']: - if usr_charge == '[M+HCOO]-': - lipid_info_df = lipid_info_df[(mz_start <= lipid_info_df['[M+HCOO]-_MZ']) - & (lipid_info_df['[M+HCOO]-_MZ'] <= mz_end)] - elif usr_charge == '[M+CH3COO]-': - lipid_info_df = lipid_info_df[(mz_start <= lipid_info_df['[M+CH3COO]-_MZ']) - & (lipid_info_df['[M+CH3COO]-_MZ'] <= mz_end)] + if usr_lipid_class in ["PC", "LPC"]: + if usr_charge == "[M+HCOO]-": + lipid_info_df = lipid_info_df[ + (mz_start <= lipid_info_df["[M+HCOO]-_MZ"]) + & (lipid_info_df["[M+HCOO]-_MZ"] <= mz_end) + ] + elif usr_charge == "[M+CH3COO]-": + lipid_info_df = lipid_info_df[ + (mz_start <= lipid_info_df["[M+CH3COO]-_MZ"]) + & (lipid_info_df["[M+CH3COO]-_MZ"] <= mz_end) + ] else: - error_lst.append('PC charge not supported. User input charge = %s. ' - 'LipidHunter support [M+HCOO]- and [M+CH3COO]-.' % usr_charge) + error_lst.append( + "PC charge not supported. User input charge = %s. " + "LipidHunter support [M+HCOO]- and [M+CH3COO]-." % usr_charge + ) else: lipid_info_df = lipid_info_df[ - (mz_start <= lipid_info_df['[M-H]-_MZ']) & (lipid_info_df['[M-H]-_MZ'] <= mz_end)] + (mz_start <= lipid_info_df["[M-H]-_MZ"]) + & (lipid_info_df["[M-H]-_MZ"] <= mz_end) + ] elif usr_charge in pos_charge_lst: - if usr_lipid_class == 'TG': - if usr_charge == '[M+NH4]+': + if usr_lipid_class == "TG": + if usr_charge == "[M+NH4]+": lipid_info_df = lipid_info_df[ - (mz_start <= lipid_info_df['[M+NH4]+_MZ']) & (lipid_info_df['[M+NH4]+_MZ'] <= mz_end)] - elif usr_charge == '[M+H]+': + (mz_start <= lipid_info_df["[M+NH4]+_MZ"]) + & (lipid_info_df["[M+NH4]+_MZ"] <= mz_end) + ] + elif usr_charge == "[M+H]+": lipid_info_df = lipid_info_df[ - (mz_start <= lipid_info_df['[M+H]+_MZ']) & (lipid_info_df['[M+H]+_MZ'] <= mz_end)] - elif usr_charge == '[M+Na]+': + (mz_start <= lipid_info_df["[M+H]+_MZ"]) + & (lipid_info_df["[M+H]+_MZ"] <= mz_end) + ] + elif usr_charge == "[M+Na]+": lipid_info_df = lipid_info_df[ - (mz_start <= lipid_info_df['[M+Na]+_MZ']) & (lipid_info_df['[M+Na]+_MZ'] <= mz_end)] - if usr_lipid_class == 'DG': - if usr_charge == '[M+NH4]+': + (mz_start <= lipid_info_df["[M+Na]+_MZ"]) + & (lipid_info_df["[M+Na]+_MZ"] <= mz_end) + ] + if usr_lipid_class == "DG": + if usr_charge == "[M+NH4]+": lipid_info_df = lipid_info_df[ - (mz_start <= lipid_info_df['[M+NH4]+_MZ']) & (lipid_info_df['[M+NH4]+_MZ'] <= mz_end)] - elif usr_charge == '[M+H]+': + (mz_start <= lipid_info_df["[M+NH4]+_MZ"]) + & (lipid_info_df["[M+NH4]+_MZ"] <= mz_end) + ] + elif usr_charge == "[M+H]+": lipid_info_df = lipid_info_df[ - (mz_start <= lipid_info_df['[M+H]+_MZ']) & (lipid_info_df['[M+H]+_MZ'] <= mz_end)] + (mz_start <= lipid_info_df["[M+H]+_MZ"]) + & (lipid_info_df["[M+H]+_MZ"] <= mz_end) + ] else: - error_lst.append('Lipid class or charge NOT supported. User input lipid class = %s, charge = %s. ' - % (usr_lipid_class, usr_charge)) + error_lst.append( + "Lipid class or charge NOT supported. User input lipid class = %s, charge = %s. " + % (usr_lipid_class, usr_charge) + ) # TODO(zhixu.ni@uni-leipzig.de): Add more error to the error_lst. @@ -330,48 +403,77 @@ def huntlipids(param_dct: dict, error_lst: list, output_df = pd.DataFrame() - print('[INFO] --> Start to process data ...') - print('[INFO] --> Lipid class: %s' % usr_lipid_class) + print("[INFO] --> Start to process data ...") + print("[INFO] --> Lipid class: %s" % usr_lipid_class) # generate the Weight factor df - usr_weight_df = pd.read_excel(score_cfg, index_col='Type') + usr_weight_df = pd.read_excel(score_cfg, index_col="Type") - print('[INFO] --> Start to parse mzML') + print("[INFO] --> Start to parse mzML") # Preparation finished. # Lipid identification workflow start. + if os.path.isfile(usr_mzml): + print("[STATUS] >>> Start to process file: %s" % usr_mzml) + else: + print("[ERROR] !!! FileNotFoundError: %s" % usr_mzml) + error_lst.append("[ERROR] !!! FileNotFoundError: %s" % usr_mzml) + return False, error_lst, False # Extract all spectra from mzML to pandas DataFrame - usr_scan_info_df, usr_spectra_pl, ms1_xic_df = extract_mzml(usr_mzml, usr_rt_range, dda_top=usr_dda_top, - ms1_threshold=usr_ms1_threshold, - ms2_threshold=usr_ms2_threshold, - ms1_precision=usr_ms1_precision, - ms2_precision=usr_ms2_precision, - vendor=usr_vendor, ms1_max=usr_ms1_max) - - print('[INFO] --> MS1_XIC_df.shape', ms1_xic_df.shape) + usr_scan_info_df, usr_spectra_pl, ms1_xic_df = extract_mzml( + usr_mzml, + usr_rt_range, + dda_top=usr_dda_top, + ms1_threshold=usr_ms1_threshold, + ms2_threshold=usr_ms2_threshold, + ms1_precision=usr_ms1_precision, + ms2_precision=usr_ms2_precision, + vendor=usr_vendor, + ms1_max=usr_ms1_max, + ) + + print("[INFO] --> MS1_XIC_df.shape", ms1_xic_df.shape) # Find all possible precursor according to lipid master table - ms1_obs_pr_df = pr_hunter.get_matched_pr(usr_scan_info_df, usr_spectra_pl, ms1_max=usr_ms1_max, - core_num=usr_core_num, max_ram=usr_max_ram) + ms1_obs_pr_df = pr_hunter.get_matched_pr( + usr_scan_info_df, + usr_spectra_pl, + ms1_max=usr_ms1_max, + core_num=usr_core_num, + max_ram=usr_max_ram, + ) if ms1_obs_pr_df is False: - print('[WARNING] !!! NO suitable precursor --> Check settings!!\n') - error_lst.append('[WARNING] !! NO suitable precursor --> Check settings!!\n') + print("[WARNING] !!! NO suitable precursor --> Check settings!!\n") + error_lst.append("[WARNING] !! NO suitable precursor --> Check settings!!\n") return False, error_lst, False - print('[INFO] --> ms1 precursor matched') + print("[INFO] --> ms1 precursor matched") # Remove bad precursors, keep the matched scans by DDA_rank and scan number # Build unique str identifier for each scan with scan_number00dda_rank use numpy.int64 to avoid large scan_number # The unique identifier is important to index scans - usr_scan_info_df['scan_checker'] = (usr_scan_info_df['scan_number'].astype(int64).astype(str).str. - cat(usr_scan_info_df['DDA_rank'].astype(int64).astype(str), sep='_')) - ms1_obs_pr_df['scan_checker'] = (ms1_obs_pr_df['scan_number'].astype(int64).astype(str).str. - cat(ms1_obs_pr_df['DDA_rank'].astype(int64).astype(str).astype(str), sep='_')) - - checked_info_df = ms1_obs_pr_df[ms1_obs_pr_df['scan_checker'].isin(usr_scan_info_df['scan_checker'] - .tolist())].copy() - checked_info_df.sort_values(by=['scan_checker', 'Lib_mz'], ascending=[True, True], inplace=True) + usr_scan_info_df["scan_checker"] = ( + usr_scan_info_df["scan_number"] + .astype(int64) + .astype(str) + .str.cat(usr_scan_info_df["DDA_rank"].astype(int64).astype(str), sep="_") + ) + ms1_obs_pr_df["scan_checker"] = ( + ms1_obs_pr_df["scan_number"] + .astype(int64) + .astype(str) + .str.cat( + ms1_obs_pr_df["DDA_rank"].astype(int64).astype(str).astype(str), sep="_" + ) + ) + + checked_info_df = ms1_obs_pr_df[ + ms1_obs_pr_df["scan_checker"].isin(usr_scan_info_df["scan_checker"].tolist()) + ].copy() + checked_info_df.sort_values( + by=["scan_checker", "Lib_mz"], ascending=[True, True], inplace=True + ) # # reserved for further debug_mode options # if 'debug_mode' in list(param_dct.keys()): @@ -381,34 +483,43 @@ def huntlipids(param_dct: dict, error_lst: list, # checked_info_df.to_csv(os.path.join(output_folder, 'checked_info_df.csv')) if checked_info_df.empty: - print('[ERROR] !!! No identification in pre-match steps !!') - error_lst.append('!! No identification in pre-match steps !!\n') + print("[ERROR] !!! No identification in pre-match steps !!") + error_lst.append("!! No identification in pre-match steps !!\n") return False, error_lst, False else: - print('[INFO] --> features identified in the pre-match: ', checked_info_df.shape[0]) + print( + "[INFO] --> features identified in the pre-match: ", + checked_info_df.shape[0], + ) - ms1_xic_mz_lst = sorted(set(ms1_obs_pr_df['MS1_XIC_mz'].values.tolist())) - print('ms1_xic_mz_lst', len(ms1_xic_mz_lst)) + ms1_xic_mz_lst = sorted(set(ms1_obs_pr_df["MS1_XIC_mz"].values.tolist())) + print("ms1_xic_mz_lst", len(ms1_xic_mz_lst)) print(ms1_xic_mz_lst) - print('[INFO] --> Start to extract XIC') + print("[INFO] --> Start to extract XIC") # Distribute task according to core numbers if len(ms1_xic_mz_lst) >= 3 * usr_core_num: sub_len = int(math.ceil(len(ms1_xic_mz_lst) / usr_core_num)) - core_key_list = [ms1_xic_mz_lst[k: k + sub_len] for k in range(0, len(ms1_xic_mz_lst), sub_len)] + core_key_list = [ + ms1_xic_mz_lst[k : k + sub_len] + for k in range(0, len(ms1_xic_mz_lst), sub_len) + ] else: core_key_list = [ms1_xic_mz_lst] # Start multiprocessing to get XIC according to precursor m/z found above - print('[STATUS] >>> Start multiprocessing to get XIC ==> ==> ==> Number of Cores: %i' % usr_core_num) + print( + "[STATUS] >>> Start multiprocessing to get XIC ==> ==> ==> Number of Cores: %i" + % usr_core_num + ) xic_dct = {} if usr_core_num > 1: xic_results_lst = [] - if os_typ == 'windows': + if os_typ == "windows": parallel_pool = Pool(usr_core_num) - queue = '' + queue = "" worker_count = 1 for core_list in core_key_list: if isinstance(core_list, tuple) or isinstance(core_list, list): @@ -416,11 +527,16 @@ def huntlipids(param_dct: dict, error_lst: list, core_list = [x for x in core_list if x is not None] else: pass - print('[STATUS] >>> Core #%i ==> ...... processing ......' % worker_count) + print( + "[STATUS] >>> Core #%i ==> ...... processing ......" + % worker_count + ) print(core_list) # TODO (georgia.angelidou@uni-leipzig.de): maybe can be combine or stay like this???? - xic_result = parallel_pool.apply_async(get_xic_from_pl, args=(core_list, ms1_xic_df, usr_xic_ppm, - os_typ, queue)) + xic_result = parallel_pool.apply_async( + get_xic_from_pl, + args=(core_list, ms1_xic_df, usr_xic_ppm, os_typ, queue), + ) worker_count += 1 xic_results_lst.append(xic_result) @@ -448,10 +564,15 @@ def huntlipids(param_dct: dict, error_lst: list, core_list = [x for x in core_list if x is not None] else: pass - print('[STATUS] >>> Core #%i ==> ...... processing ......' % worker_count) + print( + "[STATUS] >>> Core #%i ==> ...... processing ......" + % worker_count + ) print(core_list) - job = multiprocessing.Process(target=get_xic_from_pl, args=(core_list, ms1_xic_df, usr_xic_ppm, - os_typ, queue)) + job = multiprocessing.Process( + target=get_xic_from_pl, + args=(core_list, ms1_xic_df, usr_xic_ppm, os_typ, queue), + ) worker_count += 1 jobs.append(job) job.start() @@ -471,8 +592,8 @@ def huntlipids(param_dct: dict, error_lst: list, pass del xic_results_lst else: - print('[INFO] --> Using single core mode...') - queue = '' + print("[INFO] --> Using single core mode...") + queue = "" worker_count = 1 for core_list in core_key_list: if isinstance(core_list, tuple) or isinstance(core_list, list): @@ -480,9 +601,14 @@ def huntlipids(param_dct: dict, error_lst: list, core_list = [x for x in core_list if x is not None] else: pass - print('[STATUS] >>> Core #1 Part %i ==> ...... processing ......' % worker_count) + print( + "[STATUS] >>> Core #1 Part %i ==> ...... processing ......" + % worker_count + ) print(core_list) - sub_xic_dct = get_xic_from_pl(core_list, ms1_xic_df, usr_xic_ppm, os_typ, queue) + sub_xic_dct = get_xic_from_pl( + core_list, ms1_xic_df, usr_xic_ppm, os_typ, queue + ) worker_count += 1 if len(list(sub_xic_dct.keys())) > 0: @@ -490,13 +616,13 @@ def huntlipids(param_dct: dict, error_lst: list, del ms1_xic_df if len(list(xic_dct.keys())) == 0: - print('[ERROR] !!! No precursor for XIC found !!') - error_lst.append('!! No precursor for XIC found !!\n') + print("[ERROR] !!! No precursor for XIC found !!") + error_lst.append("!! No precursor for XIC found !!\n") return False, error_lst, False else: - print('[INFO] --> Number of XIC extracted: %i' % len(list(xic_dct.keys()))) + print("[INFO] --> Number of XIC extracted: %i" % len(list(xic_dct.keys()))) - print('[STATUS] >>> Start to Hunt for Lipids !!') + print("[STATUS] >>> Start to Hunt for Lipids !!") # All XIC extracted # Start to process further identification and scoring # Stat to use get_spec_info to match MS2 to precursor and XIC with multiprocessing @@ -507,14 +633,16 @@ def huntlipids(param_dct: dict, error_lst: list, lipid_spec_info_dct = {} spec_part_key_lst = [] split_seg = 1 - lipid_all_scan_num = checked_info_df['scan_checker'].nunique() + lipid_all_scan_num = checked_info_df["scan_checker"].nunique() # Checked_info_df may become very large for TG in Thermo files, need to be divided for Multiprocessing - checked_info_df_groups = checked_info_df.groupby(['Formula', 'scan_checker']) + checked_info_df_groups = checked_info_df.groupby(["Formula", "scan_checker"]) checked_info_key_lst = list(checked_info_df_groups.groups.keys()) checked_info_key_num = len(checked_info_key_lst) - print('[INFO] --> Total number of spectra features: %i | Number of proposed Formula: %i' - % (lipid_all_scan_num, checked_info_key_num)) + print( + "[INFO] --> Total number of spectra features: %i | Number of proposed Formula: %i" + % (lipid_all_scan_num, checked_info_key_num) + ) if lipid_all_scan_num > (usr_core_num * 100): @@ -526,43 +654,60 @@ def huntlipids(param_dct: dict, error_lst: list, else: split_seg = 2 - spec_part_len = int(math.ceil(lipid_all_scan_num / split_seg)) # Number of scan in each part + spec_part_len = int( + math.ceil(lipid_all_scan_num / split_seg) + ) # Number of scan in each part if spec_part_len > 200: spec_part_len = 200 - spec_part_lst = [list(checked_info_df['scan_checker'].unique())[k: k + spec_part_len] - for k in range(0, lipid_all_scan_num, spec_part_len)] + spec_part_lst = [ + list(checked_info_df["scan_checker"].unique())[k : k + spec_part_len] + for k in range(0, lipid_all_scan_num, spec_part_len) + ] for part_lst in spec_part_lst: if None in part_lst: part_lst = [x for x in part_lst if x is not None] spec_sub_len = int(math.ceil(len(part_lst) / usr_core_num)) - scan_sub_lst = [part_lst[k: k + spec_sub_len] for k in range(0, len(part_lst), spec_sub_len)] + scan_sub_lst = [ + part_lst[k : k + spec_sub_len] + for k in range(0, len(part_lst), spec_sub_len) + ] for scan_lst in scan_sub_lst: - _tmp_lipid_info_df = checked_info_df[checked_info_df['scan_checker'].isin(scan_lst)] - _tmp_info_groups = _tmp_lipid_info_df.groupby(['Formula', 'scan_checker']) + _tmp_lipid_info_df = checked_info_df[ + checked_info_df["scan_checker"].isin(scan_lst) + ] + _tmp_info_groups = _tmp_lipid_info_df.groupby( + ["Formula", "scan_checker"] + ) _tmp_group_key_lst = list(_tmp_info_groups.groups.keys()) _tmp_group_key_num = len(_tmp_group_key_lst) # chk_info_df_lst.append([_tmp_lipid_info_df, _tmp_info_groups]) - spec_sub_key_lst = [_tmp_group_key_lst[k: k + spec_sub_len] - for k in range(0, _tmp_group_key_num, spec_sub_len)] + spec_sub_key_lst = [ + _tmp_group_key_lst[k : k + spec_sub_len] + for k in range(0, _tmp_group_key_num, spec_sub_len) + ] spec_part_key_lst.append((spec_sub_key_lst, _tmp_info_groups)) print( - '[INFO] --> Distributed tasks into %i parts with max %i features ...' % (len(spec_part_lst), spec_part_len)) + "[INFO] --> Distributed tasks into %i parts with max %i features ..." + % (len(spec_part_lst), spec_part_len) + ) else: spec_sub_len = int(math.ceil(checked_info_key_num / usr_core_num)) - spec_sub_key_lst = [checked_info_key_lst[k: k + spec_sub_len] for k in - range(0, checked_info_key_num, spec_sub_len)] + spec_sub_key_lst = [ + checked_info_key_lst[k : k + spec_sub_len] + for k in range(0, checked_info_key_num, spec_sub_len) + ] spec_part_key_lst.append((spec_sub_key_lst, checked_info_df_groups)) del checked_info_df_groups if usr_core_num > 1: part_tot = len(spec_part_key_lst) part_counter = 1 - queue = '' + queue = "" for spec_sub_lst in spec_part_key_lst: @@ -570,16 +715,20 @@ def huntlipids(param_dct: dict, error_lst: list, sub_info_groups = spec_sub_lst[1] if part_tot == 1: - print('[STATUS] >>> Start multiprocessing to get Spectra info ==> Max Number of Cores: %i' - % usr_core_num) + print( + "[STATUS] >>> Start multiprocessing to get Spectra info ==> Max Number of Cores: %i" + % usr_core_num + ) else: - print('[STATUS] >>> Start multiprocessing to get Spectra info ==> Part %i / %i ' - '--> Max Number of Cores: %i' - % (part_counter, part_tot, usr_core_num)) + print( + "[STATUS] >>> Start multiprocessing to get Spectra info ==> Part %i / %i " + "--> Max Number of Cores: %i" + % (part_counter, part_tot, usr_core_num) + ) spec_results_lst = [] - if os_typ == 'windows': + if os_typ == "windows": parallel_pool = Pool(usr_core_num) # usr_queue = '' worker_count = 1 @@ -589,9 +738,20 @@ def huntlipids(param_dct: dict, error_lst: list, _sub_lst = [x for x in _sub_lst if x is not None] else: pass - print('[STATUS] >>> Core #%i ==> ...... processing ......' % worker_count) - spec_result = parallel_pool.apply_async(get_spec_info, args=(_sub_lst, sub_info_groups, - usr_scan_info_df, os_typ, queue)) + print( + "[STATUS] >>> Core #%i ==> ...... processing ......" + % worker_count + ) + spec_result = parallel_pool.apply_async( + get_spec_info, + args=( + _sub_lst, + sub_info_groups, + usr_scan_info_df, + os_typ, + queue, + ), + ) worker_count += 1 if worker_count > usr_core_num: worker_count = 1 @@ -610,9 +770,20 @@ def huntlipids(param_dct: dict, error_lst: list, _sub_lst = [x for x in _sub_lst if x is not None] else: pass - print('[STATUS] >>> Core #%i ==> ...... processing ......' % worker_count) - job = multiprocessing.Process(target=get_spec_info, args=(_sub_lst, sub_info_groups, - usr_scan_info_df, os_typ, queue_spec)) + print( + "[STATUS] >>> Core #%i ==> ...... processing ......" + % worker_count + ) + job = multiprocessing.Process( + target=get_spec_info, + args=( + _sub_lst, + sub_info_groups, + usr_scan_info_df, + os_typ, + queue_spec, + ), + ) worker_count += 1 jobs.append(job) job.start() @@ -623,31 +794,37 @@ def huntlipids(param_dct: dict, error_lst: list, # Merge multiprocessing results for spec_result in spec_results_lst: - if os_typ == 'windows': + if os_typ == "windows": try: sub_spec_dct = spec_result.get() # print(sub_spec_dct) if len(list(sub_spec_dct.keys())) > 0: lipid_spec_info_dct.update(sub_spec_dct) except (KeyError, SystemError, ValueError): - print('[ValueError] !!! must supply a tuple to get_group with multiple grouping keys ...') + print( + "[ValueError] !!! must supply a tuple to get_group with multiple grouping keys ..." + ) else: # for linux try: if len(list(spec_result.keys())) > 0: lipid_spec_info_dct.update(spec_result) except (KeyError, SystemError, ValueError): - print('[ValueError] !!! must supply a tuple to get_group with multiple grouping keys ...') + print( + "[ValueError] !!! must supply a tuple to get_group with multiple grouping keys ..." + ) # del spec_result # del spec_results_lst if part_tot == 1: - print('[STATUS] >>> multiprocessing results merged') + print("[STATUS] >>> multiprocessing results merged") else: - print('[STATUS] >>> multiprocessing results merged ==> Part %i / %i ' - % (part_counter, part_tot)) + print( + "[STATUS] >>> multiprocessing results merged ==> Part %i / %i " + % (part_counter, part_tot) + ) part_counter += 1 else: - print('[INFO] --> Using single core mode...') - queue = '' + print("[INFO] --> Using single core mode...") + queue = "" worker_count = 1 for spec_sub_lst in spec_part_key_lst: spec_sub_key_lst = spec_sub_lst[0] @@ -662,8 +839,13 @@ def huntlipids(param_dct: dict, error_lst: list, _sub_lst3 = _sub_lst3 + (_sub_lst,) _sub_lst = _sub_lst3 - print('[STATUS] >>> Core #%i ==> ...... processing ......' % worker_count) - sub_spec_dct = get_spec_info(_sub_lst, sub_info_groups, usr_scan_info_df, os_typ, queue) + print( + "[STATUS] >>> Core #%i ==> ...... processing ......" + % worker_count + ) + sub_spec_dct = get_spec_info( + _sub_lst, sub_info_groups, usr_scan_info_df, os_typ, queue + ) if len(list(sub_spec_dct.keys())) > 0: lipid_spec_info_dct.update(sub_spec_dct) @@ -671,7 +853,7 @@ def huntlipids(param_dct: dict, error_lst: list, else: pass - print('lipid_spec_info_dct', len(list(lipid_spec_info_dct.keys()))) + print("lipid_spec_info_dct", len(list(lipid_spec_info_dct.keys()))) # Single process ONLY. usr_spectra_pl is too big in RAM --> RAM leaking during copy lipid_spec_dct = {} @@ -685,14 +867,23 @@ def huntlipids(param_dct: dict, error_lst: list, for _spec_group_key in spec_info_key_lst: _spec_info_dct = lipid_spec_info_dct[_spec_group_key] - _usr_ms2_pr_mz = _spec_info_dct['MS2_PR_mz'] - _usr_ms2_dda_rank = _spec_info_dct['DDA_rank'] - _usr_ms2_scan_id = _spec_info_dct['scan_number'] - _usr_mz_lib = _spec_info_dct['Lib_mz'] - - usr_spec_info_dct = get_spectra(_usr_ms2_pr_mz, _usr_mz_lib, _usr_ms2_dda_rank, _usr_ms2_scan_id, - ms1_xic_mz_lst, usr_scan_info_df, usr_spectra_pl, - dda_top=usr_dda_top, ms1_precision=usr_ms1_precision, vendor=usr_vendor) + _usr_ms2_pr_mz = _spec_info_dct["MS2_PR_mz"] + _usr_ms2_dda_rank = _spec_info_dct["DDA_rank"] + _usr_ms2_scan_id = _spec_info_dct["scan_number"] + _usr_mz_lib = _spec_info_dct["Lib_mz"] + + usr_spec_info_dct = get_spectra( + _usr_ms2_pr_mz, + _usr_mz_lib, + _usr_ms2_dda_rank, + _usr_ms2_scan_id, + ms1_xic_mz_lst, + usr_scan_info_df, + usr_spectra_pl, + dda_top=usr_dda_top, + ms1_precision=usr_ms1_precision, + vendor=usr_vendor, + ) lipid_spec_dct[_spec_group_key] = usr_spec_info_dct found_spec_key_lst = list(lipid_spec_dct.keys()) @@ -703,90 +894,159 @@ def huntlipids(param_dct: dict, error_lst: list, # Parse specific peak info # Lipid class specific triggers - pl_class_lst = ['PA', 'PC', 'PE', 'PG', 'PI', 'PS', 'PIP'] - lpl_class_lst = ['LPA', 'LPC', 'LPE', 'LPG', 'LPI', 'LPS', 'LPIP'] - pl_neg_chg_lst = ['[M-H]-', '[M+HCOO]-', '[M+CH3COO]-'] - tg_class_lst = ['TG', 'DG'] - tg_pos_chg_lst = ['[M+NH4]+', '[M+H]+', '[M+Na]+'] + pl_class_lst = ["PA", "PC", "PE", "PG", "PI", "PS", "PIP"] + lpl_class_lst = ["LPA", "LPC", "LPE", "LPG", "LPI", "LPS", "LPIP"] + pl_neg_chg_lst = ["[M-H]-", "[M+HCOO]-", "[M+CH3COO]-"] + tg_class_lst = ["TG", "DG"] + tg_pos_chg_lst = ["[M+NH4]+", "[M+H]+", "[M+Na]+"] # Todo(zhixu.ni@uni-leipzig.de): Other classes such as SM, Cer and CL here. if usr_lipid_class in pl_class_lst and usr_charge in pl_neg_chg_lst: - charge_mode = 'NEG' + charge_mode = "NEG" usr_key_frag_df = pd.read_excel(key_frag_cfg) - usr_key_frag_df = usr_key_frag_df.query('EXACTMASS > 0') + usr_key_frag_df = usr_key_frag_df.query("EXACTMASS > 0") # get the information from the following columns - usr_key_frag_df = usr_key_frag_df[['CLASS', 'TYPE', 'EXACTMASS', 'PR_CHARGE', 'LABEL', 'CHARGE_MODE']] + usr_key_frag_df = usr_key_frag_df[ + ["CLASS", "TYPE", "EXACTMASS", "PR_CHARGE", "LABEL", "CHARGE_MODE"] + ] # find key peaks for the target PL class - target_frag_df = usr_key_frag_df.query(r'CLASS == "%s" and TYPE == "FRAG" and PR_CHARGE == "%s"' - % (usr_lipid_class, usr_charge)) - target_nl_df = usr_key_frag_df.query(r'CLASS == "%s" and TYPE == "NL" and PR_CHARGE == "%s"' - % (usr_lipid_class, usr_charge)) + target_frag_df = usr_key_frag_df.query( + r'CLASS == "%s" and TYPE == "FRAG" and PR_CHARGE == "%s"' + % (usr_lipid_class, usr_charge) + ) + target_nl_df = usr_key_frag_df.query( + r'CLASS == "%s" and TYPE == "NL" and PR_CHARGE == "%s"' + % (usr_lipid_class, usr_charge) + ) # add precursor to the list - target_pr_df = pd.DataFrame(data={'CLASS': usr_lipid_class, 'TYPE': 'NL', 'EXACTMASS': 0.0, - 'PR_CHARGE': usr_charge, 'LABEL': 'PR', 'CHARGE_MODE': 'NEG'}, index=['PR']) + target_pr_df = pd.DataFrame( + data={ + "CLASS": usr_lipid_class, + "TYPE": "NL", + "EXACTMASS": 0.0, + "PR_CHARGE": usr_charge, + "LABEL": "PR", + "CHARGE_MODE": "NEG", + }, + index=["PR"], + ) target_nl_df = target_nl_df.append(target_pr_df) target_nl_df.reset_index(drop=True, inplace=True) # extract info for other classes - other_frag_df = usr_key_frag_df.query('CLASS != "%s" and TYPE == "FRAG" and CHARGE_MODE == "%s"' - % (usr_lipid_class, charge_mode)) - other_nl_df = usr_key_frag_df.query('CLASS != "%s" and TYPE == "NL" and CHARGE_MODE == "%s"' - % (usr_lipid_class, charge_mode)) - key_frag_dct = {'target_frag_df': target_frag_df, 'target_nl_df': target_nl_df, - 'other_frag_df': other_frag_df, 'other_nl_df': other_nl_df} + other_frag_df = usr_key_frag_df.query( + 'CLASS != "%s" and TYPE == "FRAG" and CHARGE_MODE == "%s"' + % (usr_lipid_class, charge_mode) + ) + other_nl_df = usr_key_frag_df.query( + 'CLASS != "%s" and TYPE == "NL" and CHARGE_MODE == "%s"' + % (usr_lipid_class, charge_mode) + ) + key_frag_dct = { + "target_frag_df": target_frag_df, + "target_nl_df": target_nl_df, + "other_frag_df": other_frag_df, + "other_nl_df": other_nl_df, + } elif usr_lipid_class in lpl_class_lst and usr_charge in pl_neg_chg_lst: - charge_mode = 'NEG' + charge_mode = "NEG" usr_key_frag_df = pd.read_excel(key_frag_cfg) - usr_key_frag_df = usr_key_frag_df.query('EXACTMASS > 0') + usr_key_frag_df = usr_key_frag_df.query("EXACTMASS > 0") # get the information from the following columns - usr_key_frag_df = usr_key_frag_df[['CLASS', 'TYPE', 'EXACTMASS', 'PR_CHARGE', 'LABEL', 'CHARGE_MODE']] + usr_key_frag_df = usr_key_frag_df[ + ["CLASS", "TYPE", "EXACTMASS", "PR_CHARGE", "LABEL", "CHARGE_MODE"] + ] # find key peaks for the target PL class - target_frag_df = usr_key_frag_df.query(r'CLASS == "%s" and TYPE == "FRAG" and PR_CHARGE == "%s"' - % (usr_lipid_class[1:], usr_charge)) - target_nl_df = usr_key_frag_df.query(r'CLASS == "%s" and TYPE == "NL" and PR_CHARGE == "%s"' - % (usr_lipid_class[1:], usr_charge)) + target_frag_df = usr_key_frag_df.query( + r'CLASS == "%s" and TYPE == "FRAG" and PR_CHARGE == "%s"' + % (usr_lipid_class[1:], usr_charge) + ) + target_nl_df = usr_key_frag_df.query( + r'CLASS == "%s" and TYPE == "NL" and PR_CHARGE == "%s"' + % (usr_lipid_class[1:], usr_charge) + ) # add precursor to the list - target_pr_df = pd.DataFrame(data={'CLASS': usr_lipid_class, 'TYPE': 'NL', 'EXACTMASS': 0.0, - 'PR_CHARGE': usr_charge, 'LABEL': 'PR', 'CHARGE_MODE': 'NEG'}, index=['PR']) + target_pr_df = pd.DataFrame( + data={ + "CLASS": usr_lipid_class, + "TYPE": "NL", + "EXACTMASS": 0.0, + "PR_CHARGE": usr_charge, + "LABEL": "PR", + "CHARGE_MODE": "NEG", + }, + index=["PR"], + ) target_nl_df = target_nl_df.append(target_pr_df) target_nl_df.reset_index(drop=True, inplace=True) # extract info for other classes - other_frag_df = usr_key_frag_df.query('CLASS != "%s" and TYPE == "FRAG" and CHARGE_MODE == "%s"' - % (usr_lipid_class[1:], charge_mode)) - other_nl_df = usr_key_frag_df.query('CLASS != "%s" and TYPE == "NL" and CHARGE_MODE == "%s"' - % (usr_lipid_class[1:], charge_mode)) - key_frag_dct = {'target_frag_df': target_frag_df, 'target_nl_df': target_nl_df, - 'other_frag_df': other_frag_df, 'other_nl_df': other_nl_df} + other_frag_df = usr_key_frag_df.query( + 'CLASS != "%s" and TYPE == "FRAG" and CHARGE_MODE == "%s"' + % (usr_lipid_class[1:], charge_mode) + ) + other_nl_df = usr_key_frag_df.query( + 'CLASS != "%s" and TYPE == "NL" and CHARGE_MODE == "%s"' + % (usr_lipid_class[1:], charge_mode) + ) + key_frag_dct = { + "target_frag_df": target_frag_df, + "target_nl_df": target_nl_df, + "other_frag_df": other_frag_df, + "other_nl_df": other_nl_df, + } elif usr_lipid_class in tg_class_lst and usr_charge in tg_pos_chg_lst: - charge_mode = 'POS' + charge_mode = "POS" usr_key_frag_df = pd.read_excel(key_frag_cfg) - usr_key_frag_df = usr_key_frag_df.query('EXACTMASS > 0') + usr_key_frag_df = usr_key_frag_df.query("EXACTMASS > 0") # get the information from the following columns - usr_key_frag_df = usr_key_frag_df[['CLASS', 'TYPE', 'EXACTMASS', 'PR_CHARGE', 'LABEL', 'CHARGE_MODE']] + usr_key_frag_df = usr_key_frag_df[ + ["CLASS", "TYPE", "EXACTMASS", "PR_CHARGE", "LABEL", "CHARGE_MODE"] + ] # find key peaks for the target PL class - target_frag_df = usr_key_frag_df.query(r'CLASS == "%s" and TYPE == "FRAG" and PR_CHARGE == "%s"' - % (usr_lipid_class, usr_charge)) - target_nl_df = usr_key_frag_df.query(r'CLASS == "%s" and TYPE == "NL" and PR_CHARGE == "%s"' - % (usr_lipid_class, usr_charge)) + target_frag_df = usr_key_frag_df.query( + r'CLASS == "%s" and TYPE == "FRAG" and PR_CHARGE == "%s"' + % (usr_lipid_class, usr_charge) + ) + target_nl_df = usr_key_frag_df.query( + r'CLASS == "%s" and TYPE == "NL" and PR_CHARGE == "%s"' + % (usr_lipid_class, usr_charge) + ) # add precursor to the list - target_pr_df = pd.DataFrame(data={'CLASS': usr_lipid_class, 'TYPE': 'NL', 'EXACTMASS': 0.0, - 'PR_CHARGE': usr_charge, 'LABEL': 'PR', 'CHARGE_MODE': 'NEG'}, index=['PR']) + target_pr_df = pd.DataFrame( + data={ + "CLASS": usr_lipid_class, + "TYPE": "NL", + "EXACTMASS": 0.0, + "PR_CHARGE": usr_charge, + "LABEL": "PR", + "CHARGE_MODE": "NEG", + }, + index=["PR"], + ) target_nl_df = target_nl_df.append(target_pr_df) target_nl_df.reset_index(drop=True, inplace=True) # extract info for other classes - other_frag_df = usr_key_frag_df.query('CLASS != "%s" and TYPE == "FRAG" and CHARGE_MODE == "%s"' - % (usr_lipid_class, charge_mode)) - other_nl_df = usr_key_frag_df.query('CLASS != "%s" and TYPE == "NL" and CHARGE_MODE == "%s"' - % (usr_lipid_class, charge_mode)) - key_frag_dct = {'target_frag_df': target_frag_df, 'target_nl_df': target_nl_df, - 'other_frag_df': other_frag_df, 'other_nl_df': other_nl_df} + other_frag_df = usr_key_frag_df.query( + 'CLASS != "%s" and TYPE == "FRAG" and CHARGE_MODE == "%s"' + % (usr_lipid_class, charge_mode) + ) + other_nl_df = usr_key_frag_df.query( + 'CLASS != "%s" and TYPE == "NL" and CHARGE_MODE == "%s"' + % (usr_lipid_class, charge_mode) + ) + key_frag_dct = { + "target_frag_df": target_frag_df, + "target_nl_df": target_nl_df, + "other_frag_df": other_frag_df, + "other_nl_df": other_nl_df, + } else: key_frag_dct = {} - print('[INFO] --> Key FRAG Dict Generated ...') + print("[INFO] --> Key FRAG Dict Generated ...") # Start to get rank score using get_lipid_info with multiprocessing @@ -800,55 +1060,83 @@ def huntlipids(param_dct: dict, error_lst: list, # Problem with the 1 Core run. Temporary solution if usr_core_num * 24 < spec_key_num <= usr_core_num * 48 and usr_core_num != 1: split_seg = 2 - elif usr_core_num * 48 < spec_key_num <= usr_core_num * 96 and usr_core_num != 1: + elif ( + usr_core_num * 48 < spec_key_num <= usr_core_num * 96 and usr_core_num != 1 + ): split_seg = 3 elif usr_core_num * 96 < spec_key_num and usr_core_num != 1: split_seg = 4 else: split_seg = 1 lipid_part_len = int(math.ceil(spec_key_num / split_seg)) - lipid_part_lst = [found_spec_key_lst[k: k + lipid_part_len] for k in range(0, spec_key_num, - lipid_part_len)] - print('[INFO] --> lipid_part_number: ', len(lipid_part_lst), ' lipid_part_len:', lipid_part_len) + lipid_part_lst = [ + found_spec_key_lst[k : k + lipid_part_len] + for k in range(0, spec_key_num, lipid_part_len) + ] + print( + "[INFO] --> lipid_part_number: ", + len(lipid_part_lst), + " lipid_part_len:", + lipid_part_len, + ) for part_lst in lipid_part_lst: if None in part_lst: part_lst = [x for x in part_lst if x is not None] lipid_sub_len = int(math.ceil(len(part_lst) / usr_core_num)) # print('lipid_sub_len', lipid_sub_len) - pre_lipid_sub_key_lst = [part_lst[k: k + lipid_sub_len] for k in range(0, len(part_lst), lipid_sub_len)] + pre_lipid_sub_key_lst = [ + part_lst[k : k + lipid_sub_len] + for k in range(0, len(part_lst), lipid_sub_len) + ] lipid_sub_key_lst = [] for _core_key_lst in pre_lipid_sub_key_lst: - _core_key_df = pd.DataFrame(_core_key_lst, columns=['Formula', 'scan_checker']) - _core_scan_lst = _core_key_df['scan_checker'].tolist() - _core_chk_info_df = checked_info_df[checked_info_df['scan_checker'].isin(_core_scan_lst)] - _core_chk_groups = _core_chk_info_df.groupby(['Formula', 'scan_checker']) - - lipid_sub_key_lst.append((_core_key_lst, _core_chk_info_df, _core_chk_groups)) + _core_key_df = pd.DataFrame( + _core_key_lst, columns=["Formula", "scan_checker"] + ) + _core_scan_lst = _core_key_df["scan_checker"].tolist() + _core_chk_info_df = checked_info_df[ + checked_info_df["scan_checker"].isin(_core_scan_lst) + ] + _core_chk_groups = _core_chk_info_df.groupby( + ["Formula", "scan_checker"] + ) + + lipid_sub_key_lst.append( + (_core_key_lst, _core_chk_info_df, _core_chk_groups) + ) lipid_part_key_lst.append(lipid_sub_key_lst) else: lipid_sub_len = int(math.ceil(spec_key_num / usr_core_num)) - pre_lipid_sub_key_lst = [found_spec_key_lst[k: k + lipid_sub_len] for k in - range(0, spec_key_num, lipid_sub_len)] + pre_lipid_sub_key_lst = [ + found_spec_key_lst[k : k + lipid_sub_len] + for k in range(0, spec_key_num, lipid_sub_len) + ] lipid_sub_key_lst = [] for _core_key_lst in pre_lipid_sub_key_lst: - _core_key_df = pd.DataFrame(_core_key_lst, columns=['Formula', 'scan_checker']) - _core_scan_lst = _core_key_df['scan_checker'].tolist() - _core_chk_info_df = checked_info_df[checked_info_df['scan_checker'].isin(_core_scan_lst)] - _core_chk_groups = _core_chk_info_df.groupby(['Formula', 'scan_checker']) + _core_key_df = pd.DataFrame( + _core_key_lst, columns=["Formula", "scan_checker"] + ) + _core_scan_lst = _core_key_df["scan_checker"].tolist() + _core_chk_info_df = checked_info_df[ + checked_info_df["scan_checker"].isin(_core_scan_lst) + ] + _core_chk_groups = _core_chk_info_df.groupby(["Formula", "scan_checker"]) # TODO (georgia.angelidou@uni-leipzig.de): unnecesary decleration of new parameter # It can directly be save in the destination parameter: # lipid_part_key_lst.append((_core_key_lst, _core_chk_info_df, _core_chk_groups)) - lipid_sub_key_lst.append((_core_key_lst, _core_chk_info_df, _core_chk_groups)) + lipid_sub_key_lst.append( + (_core_key_lst, _core_chk_info_df, _core_chk_groups) + ) lipid_part_key_lst.append(lipid_sub_key_lst) part_tot = len(lipid_part_key_lst) part_counter = 1 - queue = '' + queue = "" if usr_core_num > 1: @@ -857,27 +1145,44 @@ def huntlipids(param_dct: dict, error_lst: list, lipid_info_results_lst = [] if part_tot == 1: - print('[STATUS] >>> Start multiprocessing to get Score ==> Max Number of Cores: %i' % usr_core_num) + print( + "[STATUS] >>> Start multiprocessing to get Score ==> Max Number of Cores: %i" + % usr_core_num + ) try: worker_feature_count = len(lipid_sub_key_lst[0][0]) - print('[STATUS] >>> Start multiprocessing to get Score ==> Max Number of Cores: %i | ' - 'x%i Features each' - % (usr_core_num, worker_feature_count)) + print( + "[STATUS] >>> Start multiprocessing to get Score ==> Max Number of Cores: %i | " + "x%i Features each" % (usr_core_num, worker_feature_count) + ) except Exception as _e: - print('[STATUS] >>> Start multiprocessing to get Score ==> Max Number of Cores: %i' % usr_core_num) - print('[Exception] Can not get the number of features distributed to each core...', _e) + print( + "[STATUS] >>> Start multiprocessing to get Score ==> Max Number of Cores: %i" + % usr_core_num + ) + print( + "[Exception] Can not get the number of features distributed to each core...", + _e, + ) else: try: worker_feature_count = len(lipid_sub_key_lst[0][0]) - print('[STATUS] >>> Start multiprocessing to get Score ==> Part %i / %i ' - '--> Max Number of Cores: %i | x%i Features each' - % (part_counter, part_tot, usr_core_num, worker_feature_count)) + print( + "[STATUS] >>> Start multiprocessing to get Score ==> Part %i / %i " + "--> Max Number of Cores: %i | x%i Features each" + % (part_counter, part_tot, usr_core_num, worker_feature_count) + ) except Exception as _e: - print('[STATUS] >>> Start multiprocessing to get Score ==> Part %i / %i --> Max Number of Cores: %i' - % (part_counter, part_tot, usr_core_num)) - print('[Exception] ... Can not get the number of features distributed to each core...', _e) - - if os_typ == 'windows': + print( + "[STATUS] >>> Start multiprocessing to get Score ==> Part %i / %i --> Max Number of Cores: %i" + % (part_counter, part_tot, usr_core_num) + ) + print( + "[Exception] ... Can not get the number of features distributed to each core...", + _e, + ) + + if os_typ == "windows": parallel_pool = Pool(usr_core_num) worker_count = 1 @@ -892,20 +1197,40 @@ def huntlipids(param_dct: dict, error_lst: list, lipid_sub_lst = [x for x in lipid_sub_lst if x is not None] else: pass - if isinstance(lipid_sub_lst[0], tuple) or isinstance(lipid_sub_lst[0], list): - lipid_sub_dct = {k: lipid_spec_dct[k] for k in lipid_sub_lst} + if isinstance(lipid_sub_lst[0], tuple) or isinstance( + lipid_sub_lst[0], list + ): + lipid_sub_dct = { + k: lipid_spec_dct[k] for k in lipid_sub_lst + } else: - lipid_sub_dct = {lipid_sub_lst: lipid_spec_dct[lipid_sub_lst]} + lipid_sub_dct = { + lipid_sub_lst: lipid_spec_dct[lipid_sub_lst] + } lipid_sub_lst = tuple([lipid_sub_lst]) - print('[STATUS] >>> Core #%i ==> ...... processing ......' % worker_count) + print( + "[STATUS] >>> Core #%i ==> ...... processing ......" + % worker_count + ) if len(list(lipid_sub_dct.keys())) > 0: - lipid_info_result = parallel_pool.apply_async(get_lipid_info, - args=(param_dct, usr_fa_df, _chk_info_df, - _chk_info_gp, lipid_sub_lst, - usr_weight_df, key_frag_dct, - lipid_sub_dct, xic_dct, - worker_count, - save_fig, os_typ, queue)) + lipid_info_result = parallel_pool.apply_async( + get_lipid_info, + args=( + param_dct, + usr_fa_df, + _chk_info_df, + _chk_info_gp, + lipid_sub_lst, + usr_weight_df, + key_frag_dct, + lipid_sub_dct, + xic_dct, + worker_count, + save_fig, + os_typ, + queue, + ), + ) lipid_info_results_lst.append(lipid_info_result) worker_count += 1 @@ -927,19 +1252,39 @@ def huntlipids(param_dct: dict, error_lst: list, lipid_sub_lst = [x for x in lipid_sub_lst if x is not None] else: pass - if isinstance(lipid_sub_lst[0], tuple) or isinstance(lipid_sub_lst[0], list): - lipid_sub_dct = {k: lipid_spec_dct[k] for k in lipid_sub_lst} + if isinstance(lipid_sub_lst[0], tuple) or isinstance( + lipid_sub_lst[0], list + ): + lipid_sub_dct = { + k: lipid_spec_dct[k] for k in lipid_sub_lst + } else: - lipid_sub_dct = {lipid_sub_lst: lipid_spec_dct[lipid_sub_lst]} + lipid_sub_dct = { + lipid_sub_lst: lipid_spec_dct[lipid_sub_lst] + } lipid_sub_lst = tuple([lipid_sub_lst]) - print('[STATUS] >>> Core #%i ==> ...... processing ......' % worker_count) - job = multiprocessing.Process(target=get_lipid_info, args=(param_dct, usr_fa_df, - _chk_info_df, - _chk_info_gp, lipid_sub_lst, - usr_weight_df, key_frag_dct, - lipid_sub_dct, xic_dct, - worker_count, - save_fig, os_typ, queue)) + print( + "[STATUS] >>> Core #%i ==> ...... processing ......" + % worker_count + ) + job = multiprocessing.Process( + target=get_lipid_info, + args=( + param_dct, + usr_fa_df, + _chk_info_df, + _chk_info_gp, + lipid_sub_lst, + usr_weight_df, + key_frag_dct, + lipid_sub_dct, + xic_dct, + worker_count, + save_fig, + os_typ, + queue, + ), + ) worker_count += 1 jobs.append(job) @@ -954,7 +1299,7 @@ def huntlipids(param_dct: dict, error_lst: list, # TODO (georgia.angelidou@uni-leipzig.de): # need to change the following part. The differnt sections can be combine - if os_typ == 'windows': + if os_typ == "windows": try: tmp_lipid_info = lipid_info_result.get() # TODO (georgia.angelidou@uni-leipzig.de): can be avoided @@ -967,9 +1312,9 @@ def huntlipids(param_dct: dict, error_lst: list, # output_df = output_df.append(tmp_lipid_info[0]) # lipid_info_img_lst.extend(tmp_lipid_info[1]) except (KeyError, SystemError, ValueError, TypeError): - tmp_lipid_info_df = 'error' + tmp_lipid_info_df = "error" tmp_lipid_img_lst = [] - print('[ERROR] !!! This segment receive no Lipid identified.') + print("[ERROR] !!! This segment receive no Lipid identified.") else: # for linux try: tmp_lipid_info_df = lipid_info_result[0] @@ -982,9 +1327,9 @@ def huntlipids(param_dct: dict, error_lst: list, # lipid_info_img_lst.extend(lipid_info_result[1]) except (KeyError, SystemError, ValueError, TypeError): - tmp_lipid_info_df = 'error' + tmp_lipid_info_df = "error" tmp_lipid_img_lst = [] - print('[ERROR] !!! This segment receive no Lipid identified.') + print("[ERROR] !!! This segment receive no Lipid identified.") # TODO (georgia.angelidou@uni-leipzig.de): # when new section are activate all the below if/else statement cant go away @@ -996,14 +1341,16 @@ def huntlipids(param_dct: dict, error_lst: list, output_df = output_df.append(tmp_lipid_info_df) lipid_info_img_lst.extend(tmp_lipid_img_lst) if part_tot == 1: - print('[STATUS] >>> multiprocessing results merged') + print("[STATUS] >>> multiprocessing results merged") else: - print('[STATUS] >>> multiprocessing results merged ==> Part %i / %i ' - % (part_counter, part_tot)) + print( + "[STATUS] >>> multiprocessing results merged ==> Part %i / %i " + % (part_counter, part_tot) + ) part_counter += 1 else: - print('[INFO] --> Using single core mode...') + print("[INFO] --> Using single core mode...") for lipid_sub_key_lst in lipid_part_key_lst: for lipid_sub in lipid_sub_key_lst: if isinstance(lipid_sub, tuple) or isinstance(lipid_sub, list): @@ -1013,9 +1360,18 @@ def huntlipids(param_dct: dict, error_lst: list, _chk_info_gp = lipid_sub[2] worker_count = 1 - lipid_info_results_lst = get_lipid_info(param_dct, usr_fa_df, _chk_info_df, - _chk_info_gp, found_spec_key_lst, usr_weight_df, - key_frag_dct, lipid_spec_dct, xic_dct, worker_count) + lipid_info_results_lst = get_lipid_info( + param_dct, + usr_fa_df, + _chk_info_df, + _chk_info_gp, + found_spec_key_lst, + usr_weight_df, + key_frag_dct, + lipid_spec_dct, + xic_dct, + worker_count, + ) # TODO (georgia.angelidou@uni-leipzig.de): unnecessary declaration of values can be avoided tmp_lipid_info_df = lipid_info_results_lst[0] @@ -1026,65 +1382,160 @@ def huntlipids(param_dct: dict, error_lst: list, lipid_info_img_lst = tmp_lipid_img_lst # TODO (georgia.angelidou@uni-leipzig.de): code can change as below - print('[OUTPUT] ==> Generate the output table') + print("[OUTPUT] ==> Generate the output table") if isinstance(output_df, pd.DataFrame): - print('[INFO] --> Total number of records', output_df.shape[0]) + print("[INFO] --> Total number of records", output_df.shape[0]) if not output_df.empty: try: - output_df = output_df.sort_values(by=['Lib_mz', 'Bulk_identification', 'MS2_scan_time', 'RANK_SCORE'], - ascending=[True, True, True, False]) + output_df = output_df.sort_values( + by=["Lib_mz", "Bulk_identification", "MS2_scan_time", "RANK_SCORE"], + ascending=[True, True, True, False], + ) except KeyError: pass output_df.reset_index(drop=True, inplace=True) output_df.index += 1 - output_df.drop_duplicates(keep='first', inplace=True) + output_df.drop_duplicates(keep="first", inplace=True) output_header_lst = output_df.columns.values.tolist() # TODO (georgia.angeldou@uni-leipzig.de): Add the info for the DG - if usr_lipid_class in ['PA', 'PC', 'PE', 'PG', 'PI', 'PIP', 'PS']: - output_list = ['FA1_[FA-H]-_i', 'FA2_[FA-H]-_i', '[LPL(FA1)-H]-_i', '[LPL(FA2)-H]-_i', - '[LPL(FA1)-H2O-H]-_i', '[LPL(FA2)-H2O-H]-_i'] - output_round_dct = {r'MS1_obs_mz': 4, r'Lib_mz': 4, 'ppm': 2, 'MS2_scan_time': 3, - 'i_fa1': 2, 'i_fa2': 2, 'i_[M-H]-fa1': 2, 'i_[M-H]-fa2': 2, - 'i_[M-H]-fa1-H2O': 2, 'i_[M-H]-fa2-H2O': 2 - } - - elif usr_lipid_class in ['LPA', 'LPC', 'LPE', 'LPG', 'LPI', 'LPIP', 'LPS']: - output_list = ['FA1_[FA-H]-_i'] - output_round_dct = {r'MS1_obs_mz': 4, r'Lib_mz': 4, 'ppm': 2, 'MS2_scan_time': 3, - 'i_fa1': 2, 'i_fa2': 2, 'i_[M-H]-fa1': 2, 'i_[M-H]-fa2': 2, - 'i_[M-H]-fa1-H2O': 2, 'i_[M-H]-fa2-H2O': 2 - } - - elif usr_lipid_class in ['TG'] and usr_charge in ['[M+NH4]+', '[M+H]+']: - output_list = ['FA1_[FA-H2O+H]+_i', 'FA2_[FA-H2O+H]+_i', 'FA3_[FA-H2O+H]+_i', '[MG(FA1)-H2O+H]+_i', - '[MG(FA2)-H2O+H]+_i', '[MG(FA3)-H2O+H]+_i', '[M-(FA1)+H]+_i', '[M-(FA2)+H]+_i', - '[M-(FA3)+H]+_i'] - output_round_dct = {r'MS1_obs_mz': 4, r'Lib_mz': 4, 'ppm': 2, 'MS2_scan_time': 3, - 'i_fa1': 2, 'i_fa2': 2, 'i_fa3': 2, 'i_[M+H]-fa1': 2, 'i_[M+H]-fa2': 2, - 'i_[M+H]-fa3': 2, 'i_[MG(fa1)+H]-H2O': 2, 'i_[MG(fa2)+H]-H2O': 2, - 'i_[MG(fa3)+H]-H2O': 2} - elif usr_lipid_class in ['TG'] and usr_charge in ['[M+Na]+']: + if usr_lipid_class in ["PA", "PC", "PE", "PG", "PI", "PIP", "PS"]: + output_list = [ + "FA1_[FA-H]-_i", + "FA2_[FA-H]-_i", + "[LPL(FA1)-H]-_i", + "[LPL(FA2)-H]-_i", + "[LPL(FA1)-H2O-H]-_i", + "[LPL(FA2)-H2O-H]-_i", + ] + output_round_dct = { + r"MS1_obs_mz": 4, + r"Lib_mz": 4, + "ppm": 2, + "MS2_scan_time": 3, + "i_fa1": 2, + "i_fa2": 2, + "i_[M-H]-fa1": 2, + "i_[M-H]-fa2": 2, + "i_[M-H]-fa1-H2O": 2, + "i_[M-H]-fa2-H2O": 2, + } + + elif usr_lipid_class in ["LPA", "LPC", "LPE", "LPG", "LPI", "LPIP", "LPS"]: + output_list = ["FA1_[FA-H]-_i"] + output_round_dct = { + r"MS1_obs_mz": 4, + r"Lib_mz": 4, + "ppm": 2, + "MS2_scan_time": 3, + "i_fa1": 2, + "i_fa2": 2, + "i_[M-H]-fa1": 2, + "i_[M-H]-fa2": 2, + "i_[M-H]-fa1-H2O": 2, + "i_[M-H]-fa2-H2O": 2, + } + + elif usr_lipid_class in ["TG"] and usr_charge in ["[M+NH4]+", "[M+H]+"]: + output_list = [ + "FA1_[FA-H2O+H]+_i", + "FA2_[FA-H2O+H]+_i", + "FA3_[FA-H2O+H]+_i", + "[MG(FA1)-H2O+H]+_i", + "[MG(FA2)-H2O+H]+_i", + "[MG(FA3)-H2O+H]+_i", + "[M-(FA1)+H]+_i", + "[M-(FA2)+H]+_i", + "[M-(FA3)+H]+_i", + ] + output_round_dct = { + r"MS1_obs_mz": 4, + r"Lib_mz": 4, + "ppm": 2, + "MS2_scan_time": 3, + "i_fa1": 2, + "i_fa2": 2, + "i_fa3": 2, + "i_[M+H]-fa1": 2, + "i_[M+H]-fa2": 2, + "i_[M+H]-fa3": 2, + "i_[MG(fa1)+H]-H2O": 2, + "i_[MG(fa2)+H]-H2O": 2, + "i_[MG(fa3)+H]-H2O": 2, + } + elif usr_lipid_class in ["TG"] and usr_charge in ["[M+Na]+"]: # TODO (georgia.angelidou@uni-leipzig.de): check why this can cause some problems with [MGSN1-H2O+H]+ - output_list = ['FA1_[FA-H2O+H]+_i', 'FA2_[FA-H2O+H]+_i', 'FA3_[FA-H2O+H]+_i', '[MG(FA1)-H2O+H]+_i', - '[MG(FA2)-H2O+H]+_i', '[MG(FA3)-H2O+H]+_i', '[M-(FA1)+Na]+_i', '[M-(FA2)+Na]+_i', - '[M-(FA3)+Na]+_i', '[M-(FA1-H+Na)+N]+_i', '[M-(FA2-H+Na)+H]+_i'] - output_round_dct = {r'MS1_obs_mz': 4, r'lib_mz': 4, 'ppm': 2, 'MS2_scan_time': 3, 'i_fa1': 2, 'i_fa2': 2, - 'i_fa3': 2, 'i_[M+Na]-fa1': 2, 'i_[M+Na]-fa2': 2, 'i_[M+Na]-fa3': 2, - 'i_[M+H]-fa1-H+Na': 2, 'i_[M+H]-fa2-H+Na': 2, 'i_[M+H]-fa3-H+Na': 2} - elif usr_lipid_class in ['DG'] and usr_charge in ['[M+H]+', '[M+NH4]+', '[M+Na]+']: - output_list = ['FA1_[FA-H2O+H]+_i', 'FA2_[FA-H2O+H]+_i', '[MG(FA1)-H2O+H]+_i', - '[MG(FA2)-H2O+H]+_i'] - output_round_dct = {r'MS1_obs_mz': 4, r'Lib_mz': 4, 'ppm': 2, 'MS2_scan_time': 3, 'i_fa1': 2, 'i_fa2': 2, - 'i_[MG(fa1)+H]-H2O': 2, 'i_[MG(fa2)+H]-H2O': 2} + output_list = [ + "FA1_[FA-H2O+H]+_i", + "FA2_[FA-H2O+H]+_i", + "FA3_[FA-H2O+H]+_i", + "[MG(FA1)-H2O+H]+_i", + "[MG(FA2)-H2O+H]+_i", + "[MG(FA3)-H2O+H]+_i", + "[M-(FA1)+Na]+_i", + "[M-(FA2)+Na]+_i", + "[M-(FA3)+Na]+_i", + "[M-(FA1-H+Na)+N]+_i", + "[M-(FA2-H+Na)+H]+_i", + ] + output_round_dct = { + r"MS1_obs_mz": 4, + r"lib_mz": 4, + "ppm": 2, + "MS2_scan_time": 3, + "i_fa1": 2, + "i_fa2": 2, + "i_fa3": 2, + "i_[M+Na]-fa1": 2, + "i_[M+Na]-fa2": 2, + "i_[M+Na]-fa3": 2, + "i_[M+H]-fa1-H+Na": 2, + "i_[M+H]-fa2-H+Na": 2, + "i_[M+H]-fa3-H+Na": 2, + } + elif usr_lipid_class in ["DG"] and usr_charge in [ + "[M+H]+", + "[M+NH4]+", + "[M+Na]+", + ]: + output_list = [ + "FA1_[FA-H2O+H]+_i", + "FA2_[FA-H2O+H]+_i", + "[MG(FA1)-H2O+H]+_i", + "[MG(FA2)-H2O+H]+_i", + ] + output_round_dct = { + r"MS1_obs_mz": 4, + r"Lib_mz": 4, + "ppm": 2, + "MS2_scan_time": 3, + "i_fa1": 2, + "i_fa2": 2, + "i_[MG(fa1)+H]-H2O": 2, + "i_[MG(fa2)+H]-H2O": 2, + } else: - output_list = ['FA1_[FA-H]-_i', 'FA2_[FA-H]-_i', '[LPL(FA1)-H]-_i', '[LPL(FA2)-H]-_i', - '[LPL(FA1)-H2O-H]-_i', '[LPL(FA2)-H2O-H]-_i'] - output_round_dct = {r'MS1_obs_mz': 4, r'Lib_mz': 4, 'ppm': 2, 'MS2_scan_time': 3, - 'i_fa1': 2, 'i_fa2': 2, 'i_[M-H]-fa1': 2, 'i_[M-H]-fa2': 2, - 'i_[M-H]-fa1-H2O': 2, 'i_[M-H]-fa2-H2O': 2 - } + output_list = [ + "FA1_[FA-H]-_i", + "FA2_[FA-H]-_i", + "[LPL(FA1)-H]-_i", + "[LPL(FA2)-H]-_i", + "[LPL(FA1)-H2O-H]-_i", + "[LPL(FA2)-H2O-H]-_i", + ] + output_round_dct = { + r"MS1_obs_mz": 4, + r"Lib_mz": 4, + "ppm": 2, + "MS2_scan_time": 3, + "i_fa1": 2, + "i_fa2": 2, + "i_[M-H]-fa1": 2, + "i_[M-H]-fa2": 2, + "i_[M-H]-fa1-H2O": 2, + "i_[M-H]-fa2-H2O": 2, + } for _i_check in output_list: if _i_check not in output_header_lst: output_df[_i_check] = 0.0 @@ -1094,79 +1545,191 @@ def huntlipids(param_dct: dict, error_lst: list, output_round_dct[_t] = 2 output_df = output_df.round(output_round_dct) - output_df.rename(columns={'OBS_RESIDUES': '#Observed_FA'}, - inplace=True) - if usr_lipid_class in ['PA', 'PC', 'PE', 'PG', 'PI', 'PIP', 'PS']: - output_short_lst = ['Proposed_structures', 'DISCRETE_ABBR', 'Formula_neutral', 'Formula_ion', 'Charge', - 'Lib_mz', 'ppm', 'ISOTOPE_SCORE', 'RANK_SCORE', - 'MS1_obs_mz', 'MS1_obs_i', r'MS2_PR_mz', 'MS2_scan_time', - 'DDA#', 'Scan#', '#Observed_FA', '#Specific_peaks', '#Unspecific_peaks', - 'FA1_[FA-H]-_i', 'FA2_[FA-H]-_i', - '[LPL(FA1)-H]-_i', '[LPL(FA2)-H]-_i', - '[LPL(FA1)-H2O-H]-_i', '[LPL(FA2)-H2O-H]-_i' - ] - elif usr_lipid_class in ['LPA', 'LPC', 'LPE', 'LPG', 'LPI', 'LPIP', 'LPS']: - output_short_lst = ['Proposed_structures', 'DISCRETE_ABBR', 'Formula_neutral', 'Formula_ion', 'Charge', - 'Lib_mz', 'ppm', 'ISOTOPE_SCORE', 'RANK_SCORE', - 'MS1_obs_mz', 'MS1_obs_i', r'MS2_PR_mz', 'MS2_scan_time', - 'DDA#', 'Scan#', '#Observed_FA', '#Specific_peaks', '#Unspecific_peaks', - 'FA1_[FA-H]-_i', - ] - elif usr_lipid_class in ['TG'] and usr_charge in ['[M+H]+', '[M+NH4]+']: - output_short_lst = ['Proposed_structures', 'DISCRETE_ABBR', 'Formula_neutral', 'Formula_ion', 'Charge', - 'Lib_mz', 'ppm', 'ISOTOPE_SCORE', 'RANK_SCORE', - 'MS1_obs_mz', 'MS1_obs_i', r'MS2_PR_mz', 'MS2_scan_time', - 'DDA#', 'Scan#', '#Observed_FA', - '[M-(FA1)+H]+_i', '[M-(FA2)+H]+_i', '[M-(FA3)+H]+_i', - '[MG(FA1)-H2O+H]+_i', '[MG(FA2)-H2O+H]+_i', '[MG(FA3)-H2O+H]+_i', - 'FA1_[FA-H2O+H]+_i', 'FA2_[FA-H2O+H]+_i', 'FA3_[FA-H2O+H]+_i', - ] - elif usr_lipid_class in ['TG'] and usr_charge in ['[M+Na]+']: - output_short_lst = ['Proposed_structures', 'DISCRETE_ABBR', 'Formula_neutral', 'Formula_ion', 'Charge', - 'Lib_mz', 'ppm', 'ISOTOPE_SCORE', 'RANK_SCORE', - 'MS1_obs_mz', 'MS1_obs_i', r'MS2_PR_mz', 'MS2_scan_time', - 'DDA#', 'Scan#', '#Observed_FA', - '[M-(FA1)+Na]+_i', '[M-(FA2)+Na]+_i', '[M-(FA3)+Na]+_i', - '[MG(FA1)-H2O+H]+_i', '[MG(FA2)-H2O+H]+_i', '[MG(FA3)-H2O+H]+_i', - 'FA1_[FA-H2O+H]+_i', 'FA2_[FA-H2O+H]+_i', 'FA3_[FA-H2O+H]+_i' - ] - elif usr_lipid_class in ['DG'] and usr_charge in ['[M+H]+', '[M+NH4]+', '[M+Na]+']: - output_short_lst = ['Proposed_structures', 'DISCRETE_ABBR', 'Formula_neutral', 'Formula_ion', 'Charge', - 'Lib_mz', 'ppm', 'ISOTOPE_SCORE', 'RANK_SCORE', - 'MS1_obs_mz', 'MS1_obs_i', r'MS2_PR_mz', 'MS2_scan_time', - 'DDA#', 'Scan#', '#Observed_FA', - '[MG(FA1)-H2O+H]+_i', '[MG(FA2)-H2O+H]+_i', - 'FA1_[FA-H2O+H]+_i', 'FA2_[FA-H2O+H]+_i', - ] + output_df.rename(columns={"OBS_RESIDUES": "#Observed_FA"}, inplace=True) + if usr_lipid_class in ["PA", "PC", "PE", "PG", "PI", "PIP", "PS"]: + output_short_lst = [ + "Proposed_structures", + "DISCRETE_ABBR", + "Formula_neutral", + "Formula_ion", + "Charge", + "Lib_mz", + "ppm", + "ISOTOPE_SCORE", + "RANK_SCORE", + "MS1_obs_mz", + "MS1_obs_i", + r"MS2_PR_mz", + "MS2_scan_time", + "DDA#", + "Scan#", + "#Observed_FA", + "#Specific_peaks", + "#Unspecific_peaks", + "FA1_[FA-H]-_i", + "FA2_[FA-H]-_i", + "[LPL(FA1)-H]-_i", + "[LPL(FA2)-H]-_i", + "[LPL(FA1)-H2O-H]-_i", + "[LPL(FA2)-H2O-H]-_i", + ] + elif usr_lipid_class in ["LPA", "LPC", "LPE", "LPG", "LPI", "LPIP", "LPS"]: + output_short_lst = [ + "Proposed_structures", + "DISCRETE_ABBR", + "Formula_neutral", + "Formula_ion", + "Charge", + "Lib_mz", + "ppm", + "ISOTOPE_SCORE", + "RANK_SCORE", + "MS1_obs_mz", + "MS1_obs_i", + r"MS2_PR_mz", + "MS2_scan_time", + "DDA#", + "Scan#", + "#Observed_FA", + "#Specific_peaks", + "#Unspecific_peaks", + "FA1_[FA-H]-_i", + ] + elif usr_lipid_class in ["TG"] and usr_charge in ["[M+H]+", "[M+NH4]+"]: + output_short_lst = [ + "Proposed_structures", + "DISCRETE_ABBR", + "Formula_neutral", + "Formula_ion", + "Charge", + "Lib_mz", + "ppm", + "ISOTOPE_SCORE", + "RANK_SCORE", + "MS1_obs_mz", + "MS1_obs_i", + r"MS2_PR_mz", + "MS2_scan_time", + "DDA#", + "Scan#", + "#Observed_FA", + "[M-(FA1)+H]+_i", + "[M-(FA2)+H]+_i", + "[M-(FA3)+H]+_i", + "[MG(FA1)-H2O+H]+_i", + "[MG(FA2)-H2O+H]+_i", + "[MG(FA3)-H2O+H]+_i", + "FA1_[FA-H2O+H]+_i", + "FA2_[FA-H2O+H]+_i", + "FA3_[FA-H2O+H]+_i", + ] + elif usr_lipid_class in ["TG"] and usr_charge in ["[M+Na]+"]: + output_short_lst = [ + "Proposed_structures", + "DISCRETE_ABBR", + "Formula_neutral", + "Formula_ion", + "Charge", + "Lib_mz", + "ppm", + "ISOTOPE_SCORE", + "RANK_SCORE", + "MS1_obs_mz", + "MS1_obs_i", + r"MS2_PR_mz", + "MS2_scan_time", + "DDA#", + "Scan#", + "#Observed_FA", + "[M-(FA1)+Na]+_i", + "[M-(FA2)+Na]+_i", + "[M-(FA3)+Na]+_i", + "[MG(FA1)-H2O+H]+_i", + "[MG(FA2)-H2O+H]+_i", + "[MG(FA3)-H2O+H]+_i", + "FA1_[FA-H2O+H]+_i", + "FA2_[FA-H2O+H]+_i", + "FA3_[FA-H2O+H]+_i", + ] + elif usr_lipid_class in ["DG"] and usr_charge in [ + "[M+H]+", + "[M+NH4]+", + "[M+Na]+", + ]: + output_short_lst = [ + "Proposed_structures", + "DISCRETE_ABBR", + "Formula_neutral", + "Formula_ion", + "Charge", + "Lib_mz", + "ppm", + "ISOTOPE_SCORE", + "RANK_SCORE", + "MS1_obs_mz", + "MS1_obs_i", + r"MS2_PR_mz", + "MS2_scan_time", + "DDA#", + "Scan#", + "#Observed_FA", + "[MG(FA1)-H2O+H]+_i", + "[MG(FA2)-H2O+H]+_i", + "FA1_[FA-H2O+H]+_i", + "FA2_[FA-H2O+H]+_i", + ] else: - output_short_lst = ['Proposed_structures', 'DISCRETE_ABBR', 'Formula_neutral', 'Formula_ion', 'Charge', - 'Lib_mz', 'ppm', 'ISOTOPE_SCORE', 'RANK_SCORE', - 'MS1_obs_mz', 'MS1_obs_i', r'MS2_PR_mz', 'MS2_scan_time', - 'DDA#', 'Scan#', '#Observed_FA', - ] + output_short_lst = [ + "Proposed_structures", + "DISCRETE_ABBR", + "Formula_neutral", + "Formula_ion", + "Charge", + "Lib_mz", + "ppm", + "ISOTOPE_SCORE", + "RANK_SCORE", + "MS1_obs_mz", + "MS1_obs_i", + r"MS2_PR_mz", + "MS2_scan_time", + "DDA#", + "Scan#", + "#Observed_FA", + ] # Make copy of selected list of columns from output_df to avoid pandas warnings final_output_df = output_df[output_short_lst] - final_output_df = final_output_df.sort_values(by=['MS1_obs_mz', 'MS2_scan_time', 'RANK_SCORE'], - ascending=[True, True, False]) + final_output_df = final_output_df.sort_values( + by=["MS1_obs_mz", "MS2_scan_time", "RANK_SCORE"], + ascending=[True, True, False], + ) final_output_df = final_output_df.reset_index(drop=True) final_output_df.index += 1 save_output(output_sum_xlsx, final_output_df) else: - error_lst.append('[Warning] NO Lipid identified in this file.\n!! Please check your settings !!') + error_lst.append( + "[Warning] NO Lipid identified in this file.\n!! Please check your settings !!" + ) tot_run_time = time.clock() - start_time - print('[WARNING] !!! This file got no Lipid identified.') - print('[STATUS] >>> Identification finished in %s sec <<<' % tot_run_time) + print("[WARNING] !!! This file got no Lipid identified.") + print("[STATUS] >>> Identification finished in %s sec <<<" % tot_run_time) return tot_run_time, error_lst, output_df # Reserved for the development to re-use the session if save_session is True: - hunt_save_path = os.path.join(output_folder, 'HunterData_%s.hunt' % hunter_start_time_str) - results_pickle_dct = {'param_dct': param_dct, 'output_df': output_df, - 'final_output_df': final_output_df, 'lipid_info_img_lst': lipid_info_img_lst} + hunt_save_path = os.path.join( + output_folder, "HunterData_%s.hunt" % hunter_start_time_str + ) + results_pickle_dct = { + "param_dct": param_dct, + "output_df": output_df, + "final_output_df": final_output_df, + "lipid_info_img_lst": lipid_info_img_lst, + } save_hunt(results_pickle_dct, hunt_save_path) - print('Hunter session saved as:', hunt_save_path) + print("Hunter session saved as:", hunt_save_path) else: pass @@ -1174,10 +1737,10 @@ def huntlipids(param_dct: dict, error_lst: list, if save_fig is True: gen_html_report(param_dct, output_df, lipid_info_img_lst) else: - print('[WARNING] !!! User skip image generation !!!!!!') - print('Time', time.clock(), start_time) + print("[WARNING] !!! User skip image generation !!!!!!") + print("Time", time.clock(), start_time) tot_run_time = time.clock() - start_time - print('[STATUS] >>> >>> >>> FINISHED in %s sec <<< <<< <<<' % tot_run_time) + print("[STATUS] >>> >>> >>> FINISHED in %s sec <<< <<< <<<" % tot_run_time) return tot_run_time, error_lst, output_df diff --git a/LibLipidHunter/IsotopeHunter.py b/LibLipidHunter/IsotopeHunter.py index 47bdd3c..efc0107 100644 --- a/LibLipidHunter/IsotopeHunter.py +++ b/LibLipidHunter/IsotopeHunter.py @@ -27,29 +27,42 @@ class IsotopeHunter(object): def __init__(self): # iupac '97 - self.periodic_table_dct = {'H': [(1.0078250321, 0.999885), (2.0141017780, 0.0001157)], - 'D': [(2.0141017780, 0.0001157)], - 'C': [(12.0, 0.9893), (13.0033548378, 0.0107)], - 'N': [(14.0030740052, 0.99632), (15.0001088984, 0.00368)], - 'O': [(15.9949146221, 0.99757), (16.99913150, 0.00038), (17.9991604, 0.00205)], - 'Na': [(22.98976967, 1.0)], - 'P': [(30.97376151, 1.0)], - 'S': [(31.97207069, 0.9493), (32.97145850, 0.0076), - (33.96786683, 0.0429), (35.96708088, 0.0002)], - 'K': [(38.9637069, 0.932581), (39.96399867, 0.000117), (40.96182597, 0.067302)], - } + self.periodic_table_dct = { + "H": [(1.0078250321, 0.999885), (2.0141017780, 0.0001157)], + "D": [(2.0141017780, 0.0001157)], + "C": [(12.0, 0.9893), (13.0033548378, 0.0107)], + "N": [(14.0030740052, 0.99632), (15.0001088984, 0.00368)], + "O": [ + (15.9949146221, 0.99757), + (16.99913150, 0.00038), + (17.9991604, 0.00205), + ], + "Na": [(22.98976967, 1.0)], + "P": [(30.97376151, 1.0)], + "S": [ + (31.97207069, 0.9493), + (32.97145850, 0.0076), + (33.96786683, 0.0429), + (35.96708088, 0.0002), + ], + "K": [ + (38.9637069, 0.932581), + (39.96399867, 0.000117), + (40.96182597, 0.067302), + ], + } def get_elements(self, formula): elem_dct = {} elem_key_lst = list(self.periodic_table_dct.keys()) - tmp_formula = formula.strip('+') - tmp_formula = tmp_formula.strip('-') + tmp_formula = formula.strip("+") + tmp_formula = tmp_formula.strip("-") - elem_lst = re.findall('[A-Z][a-z]*[0-9]*', formula) + elem_lst = re.findall("[A-Z][a-z]*[0-9]*", formula) for _e in range(0, len(elem_lst)): - _elem = re.findall('[A-Z][a-z]*', elem_lst[_e]) - _elem_count = re.findall('[0-9]+', elem_lst[_e]) + _elem = re.findall("[A-Z][a-z]*", elem_lst[_e]) + _elem_count = re.findall("[0-9]+", elem_lst[_e]) if len(_elem_count) == 0: _elem_count = 1 else: @@ -80,7 +93,7 @@ def get_isotope_mz(self, elem_dct, only_c=False, isotope_number=2): mono_mz = self.get_mono_mz(elem_dct) # consider C only - c_count = elem_dct['C'] + c_count = elem_dct["C"] delta_13c = 1.0033548378 ration_13c12c = 0.011 @@ -92,50 +105,60 @@ def get_isotope_mz(self, elem_dct, only_c=False, isotope_number=2): # calc distribution by selected algorithms if only_c is True: # consider C only --> binomial expansion 3x faster - isotope_pattern = stats.binom.pmf(list(range(0, isotope_number + 1)), c_count, ration_13c12c) + isotope_pattern = stats.binom.pmf( + list(range(0, isotope_number + 1)), c_count, ration_13c12c + ) else: try: # consider more elements --> binomial/polynomial and McLaurin expansion [doi:10.1038/nmeth.3393] - h_count = elem_dct['H'] - o_count = elem_dct['O'] + h_count = elem_dct["H"] + o_count = elem_dct["O"] c_ploy = Polynomial((0.9893, 0.0107)) h_ploy = Polynomial((0.999885, 0.0001157)) o_ploy = Polynomial((0.99757, 0.00038, 0.00205)) - isotope_pattern_calc = c_ploy ** c_count * h_ploy ** h_count * o_ploy ** o_count + isotope_pattern_calc = ( + c_ploy ** c_count * h_ploy ** h_count * o_ploy ** o_count + ) - if 'N' in list(elem_dct.keys()): - n_count = elem_dct['N'] + if "N" in list(elem_dct.keys()): + n_count = elem_dct["N"] if n_count > 0: n_ploy = Polynomial((0.99632, 0.00368)) isotope_pattern_calc *= n_ploy - if 'S' in list(elem_dct.keys()): - s_count = elem_dct['S'] + if "S" in list(elem_dct.keys()): + s_count = elem_dct["S"] if s_count > 0: s_ploy = Polynomial((0.9493, 0.0076, 0.0429, 0.0002)) isotope_pattern_calc *= s_ploy - if 'K' in list(elem_dct.keys()): - k_count = elem_dct['K'] + if "K" in list(elem_dct.keys()): + k_count = elem_dct["K"] if k_count > 0: k_ploy = Polynomial((0.932581, 0.000117, 0.067302)) isotope_pattern_calc *= k_ploy - isotope_pattern = list(isotope_pattern_calc.coef)[:isotope_number + 1] + isotope_pattern = list(isotope_pattern_calc.coef)[: isotope_number + 1] except ValueError: # print(_e) - print('[INFO] --> Too large to use full elements for isotope pattern ... ' - 'use 13C only mode for this compound...') + print( + "[INFO] --> Too large to use full elements for isotope pattern ... " + "use 13C only mode for this compound..." + ) # consider C only --> binomial expansion 3x faster - isotope_pattern = stats.binom.pmf(list(range(0, isotope_number + 1)), c_count, ration_13c12c) + isotope_pattern = stats.binom.pmf( + list(range(0, isotope_number + 1)), c_count, ration_13c12c + ) m0_i = isotope_pattern[0] isotope_pattern = [x / m0_i for x in isotope_pattern] - isotope_distribution_df = pd.DataFrame(data={'mz': isotope_mz_lst, 'ratio': isotope_pattern}) - isotope_distribution_df = isotope_distribution_df.round({'ratio': 2}) + isotope_distribution_df = pd.DataFrame( + data={"mz": isotope_mz_lst, "ratio": isotope_pattern} + ) + isotope_distribution_df = isotope_distribution_df.round({"ratio": 2}) return isotope_distribution_df @@ -153,14 +176,18 @@ def peak_top_checker(ms1_pr_mz, spec_df, core_count=1, ms1_precision=50e-6): top_precision = min(ms1_precision * 2, 500e-6) pr_delta = ms1_pr_mz * ms1_precision - ms_pr_df = spec_df.query('%f <= mz <= %f' % (ms1_pr_mz - pr_delta, ms1_pr_mz + pr_delta)) + ms_pr_df = spec_df.query( + "%f <= mz <= %f" % (ms1_pr_mz - pr_delta, ms1_pr_mz + pr_delta) + ) if not ms_pr_df.empty: - _i_df = ms_pr_df.sort_values(by='i', ascending=False) - pr_obs_i = _i_df['i'].values.tolist()[0] - pr_obs_mz = _i_df['mz'].values.tolist()[0] + _i_df = ms_pr_df.sort_values(by="i", ascending=False) + pr_obs_i = _i_df["i"].values.tolist()[0] + pr_obs_mz = _i_df["mz"].values.tolist()[0] top_delta = pr_obs_mz * top_precision - peak_top_df = spec_df.query('%f <= mz <= %f' % (ms1_pr_mz - top_delta, ms1_pr_mz + top_delta)) - top_obs_i = max(peak_top_df['i'].values.tolist()) + peak_top_df = spec_df.query( + "%f <= mz <= %f" % (ms1_pr_mz - top_delta, ms1_pr_mz + top_delta) + ) + top_obs_i = max(peak_top_df["i"].values.tolist()) else: pr_obs_i = 0 pr_obs_mz = 0 @@ -173,13 +200,25 @@ def peak_top_checker(ms1_pr_mz, spec_df, core_count=1, ms1_precision=50e-6): # '[PASSED]MS1 PR m/z {pr} is peak top in +/- {delta} m/z, PR i {obs_i}, max i {max_i}' # .format(pr=pr_obs_mz, delta=top_delta, obs_i=pr_obs_i, max_i=top_obs_i)) else: - print(core_count, - '[Warning] MS1 PR m/z {pr} is not peak top in +/- {delta} m/z, PR i {obs_i}, max i {max_i}' - .format(pr=pr_obs_mz, delta=top_delta, obs_i=pr_obs_i, max_i=top_obs_i)) + print( + core_count, + "[Warning] MS1 PR m/z {pr} is not peak top in +/- {delta} m/z, PR i {obs_i}, max i {max_i}".format( + pr=pr_obs_mz, delta=top_delta, obs_i=pr_obs_i, max_i=top_obs_i + ), + ) return peak_top, top_obs_i - def calc_isotope_score(self, isotope_pattern_df, spec_df, ms1_precision, ms1_pr_i, - core_count=1, deconv=[], mode='m', score_filter=75): + def calc_isotope_score( + self, + isotope_pattern_df, + spec_df, + ms1_precision, + ms1_pr_i, + core_count=1, + deconv=[], + mode="m", + score_filter=75, + ): isotope_checker_dct = {} isotope_score_delta = 0 @@ -200,32 +239,34 @@ def calc_isotope_score(self, isotope_pattern_df, spec_df, ms1_precision, ms1_pr_ _base_i = 0 # [M+0] has _i == 0 - _mz = _se['mz'] - _ratio = _se['ratio'] + _mz = _se["mz"] + _ratio = _se["ratio"] _mz_delta = _mz * ms1_precision - _i_df = spec_df.query('%f <= mz <= %f' % (_mz - _mz_delta, _mz + _mz_delta)) + _i_df = spec_df.query( + "%f <= mz <= %f" % (_mz - _mz_delta, _mz + _mz_delta) + ) if _i < 2: theo_i = ms1_pr_i * _ratio + _base_i else: theo_i = ms1_pr_i * _ratio - _i_info_dct = {'theo_mz': _mz, 'theo_i': theo_i, 'theo_ratio': _ratio} + _i_info_dct = {"theo_mz": _mz, "theo_i": theo_i, "theo_ratio": _ratio} if not _i_df.empty: - _i_df = _i_df.sort_values(by='i', ascending=False).head(1) - _i_max = _i_df['i'].max() - _mz_max = _i_df['mz'].max() - _i_info_dct['obs_i'] = _i_max - _i_info_dct['obs_mz'] = _mz_max + _i_df = _i_df.sort_values(by="i", ascending=False).head(1) + _i_max = _i_df["i"].max() + _mz_max = _i_df["mz"].max() + _i_info_dct["obs_i"] = _i_max + _i_info_dct["obs_mz"] = _mz_max else: _i_max = 0.0 - _i_info_dct['obs_i'] = 0 - _i_info_dct['obs_mz'] = 0 + _i_info_dct["obs_i"] = 0 + _i_info_dct["obs_mz"] = 0 theo_i_lst.append(theo_i) _i_r = _i_max / ms1_pr_i - _i_info_dct['obs_ratio'] = _i_r + _i_info_dct["obs_ratio"] = _i_r isotope_checker_dct[_i] = _i_info_dct if _i > 0: @@ -242,38 +283,70 @@ def calc_isotope_score(self, isotope_pattern_df, spec_df, ms1_precision, ms1_pr_ isotope_m1_score = 100 * (1 - isotope_m1_score_delta) try: - theo_pr_mz = isotope_checker_dct[0]['theo_mz'] - obs_pr_mz = isotope_checker_dct[0]['obs_mz'] - obs_pr_i = isotope_checker_dct[0]['obs_i'] + theo_pr_mz = isotope_checker_dct[0]["theo_mz"] + obs_pr_mz = isotope_checker_dct[0]["obs_mz"] + obs_pr_i = isotope_checker_dct[0]["obs_i"] except Exception as _e: - if mode == 'm': - print(core_count, '[Exception] !!! Cannot get Theoretical or observed PR m/z ...', _e) + if mode == "m": + print( + core_count, + "[Exception] !!! Cannot get Theoretical or observed PR m/z ...", + _e, + ) else: - print(core_count, '[Exception] !!! M+2 is NOT potential M+0 of M+2H ...', _e) + print( + core_count, + "[Exception] !!! M+2 is NOT potential M+0 of M+2H ...", + _e, + ) theo_pr_mz = 0 obs_pr_mz = 0 obs_pr_i = 0 - if mode == 'm': + if mode == "m": if score_filter > 0: - peak_top, top_obs_i = self.peak_top_checker(theo_pr_mz, spec_df, - core_count=core_count, ms1_precision=ms1_precision) + peak_top, top_obs_i = self.peak_top_checker( + theo_pr_mz, + spec_df, + core_count=core_count, + ms1_precision=ms1_precision, + ) if peak_top is True: - isotope_calc_dct = {'isotope_checker_dct': isotope_checker_dct, 'isotope_score': isotope_score, - 'isotope_m1_score': isotope_m1_score, 'theo_i_lst': theo_i_lst, - 'obs_pr_mz': obs_pr_mz, 'obs_pr_i': obs_pr_i} + isotope_calc_dct = { + "isotope_checker_dct": isotope_checker_dct, + "isotope_score": isotope_score, + "isotope_m1_score": isotope_m1_score, + "theo_i_lst": theo_i_lst, + "obs_pr_mz": obs_pr_mz, + "obs_pr_i": obs_pr_i, + } else: - isotope_calc_dct = {'isotope_checker_dct': {}, 'isotope_score': 0, - 'isotope_m1_score': 0, 'theo_i_lst': [], - 'obs_pr_mz': 0, 'obs_pr_i': 0} + isotope_calc_dct = { + "isotope_checker_dct": {}, + "isotope_score": 0, + "isotope_m1_score": 0, + "theo_i_lst": [], + "obs_pr_mz": 0, + "obs_pr_i": 0, + } else: - isotope_calc_dct = {'isotope_checker_dct': isotope_checker_dct, 'isotope_score': isotope_score, - 'isotope_m1_score': isotope_m1_score, 'theo_i_lst': theo_i_lst, - 'obs_pr_mz': obs_pr_mz, 'obs_pr_i': obs_pr_i} + isotope_calc_dct = { + "isotope_checker_dct": isotope_checker_dct, + "isotope_score": isotope_score, + "isotope_m1_score": isotope_m1_score, + "theo_i_lst": theo_i_lst, + "obs_pr_mz": obs_pr_mz, + "obs_pr_i": obs_pr_i, + } else: - isotope_calc_dct = {'isotope_checker_dct': isotope_checker_dct, 'isotope_score': isotope_score, - 'isotope_m1_score': isotope_m1_score, 'theo_i_lst': theo_i_lst, - 'obs_pr_mz': obs_pr_mz, 'obs_pr_i': obs_pr_i} + isotope_calc_dct = { + "isotope_checker_dct": isotope_checker_dct, + "isotope_score": isotope_score, + "isotope_m1_score": isotope_m1_score, + "theo_i_lst": theo_i_lst, + "obs_pr_mz": obs_pr_mz, + "obs_pr_i": obs_pr_i, + } # print('mode', mode) # print(isotope_calc_dct) @@ -295,31 +368,46 @@ def get_deconvolution(self, spec_df, mz_delta, base_i, elem_dct={}, only_c=False base_m2_i = 0 base_m3_i = 0 - m_pre1_isotope_pattern_df = self.get_isotope_mz(elem_dct, only_c=only_c, isotope_number=3) - m_pre1_mz = m_pre1_isotope_pattern_df.at[0, 'mz'] - pre_i_df = spec_df.query('%f <= mz <= %f' % - (m_pre1_mz - mz_delta, m_pre1_mz + mz_delta)) + m_pre1_isotope_pattern_df = self.get_isotope_mz( + elem_dct, only_c=only_c, isotope_number=3 + ) + m_pre1_mz = m_pre1_isotope_pattern_df.at[0, "mz"] + pre_i_df = spec_df.query( + "%f <= mz <= %f" % (m_pre1_mz - mz_delta, m_pre1_mz + mz_delta) + ) if not pre_i_df.empty: - max_m_pre1_i = pre_i_df['i'].max() + max_m_pre1_i = pre_i_df["i"].max() max_m_pre1_i -= base_i if max_m_pre1_i > 0: - base_m1_i += max_m_pre1_i * m_pre1_isotope_pattern_df.at[1, 'ratio'] - base_m2_i += max_m_pre1_i * m_pre1_isotope_pattern_df.at[2, 'ratio'] - base_m3_i += max_m_pre1_i * m_pre1_isotope_pattern_df.at[3, 'ratio'] + base_m1_i += max_m_pre1_i * m_pre1_isotope_pattern_df.at[1, "ratio"] + base_m2_i += max_m_pre1_i * m_pre1_isotope_pattern_df.at[2, "ratio"] + base_m3_i += max_m_pre1_i * m_pre1_isotope_pattern_df.at[3, "ratio"] return base_m1_i, base_m2_i, base_m3_i - def get_isotope_score(self, ms1_pr_mz, ms1_pr_i, formula, spec_df, core_count, - ms1_precision=50e-6, only_c=False, score_filter=75, decon=True, exp_mode='LC-MS', - isotope_number=2, pattern_tolerance=5): + def get_isotope_score( + self, + ms1_pr_mz, + ms1_pr_i, + formula, + spec_df, + core_count, + ms1_precision=50e-6, + only_c=False, + score_filter=75, + decon=True, + exp_mode="LC-MS", + isotope_number=2, + pattern_tolerance=5, + ): mz_delta = ms1_pr_mz * ms1_precision delta_13c = 1.0033548378 obs_pr_mz = 0 obs_pr_i = 0 - if exp_mode == 'Shotgun': + if exp_mode == "Shotgun": pseudo_pr_check = 0 else: pseudo_pr_check = 1 @@ -327,16 +415,22 @@ def get_isotope_score(self, ms1_pr_mz, ms1_pr_i, formula, spec_df, core_count, if decon is True: deconv_elem_dct = self.get_elements(formula) # M-2 - deconv_elem_dct['H'] += -2 + deconv_elem_dct["H"] += -2 base_i = 0 - pre2_base_m1_i, pre2_base_m2_i, pre2_base_m3_i = self.get_deconvolution(spec_df, mz_delta, base_i, - deconv_elem_dct, only_c=only_c) + pre2_base_m1_i, pre2_base_m2_i, pre2_base_m3_i = self.get_deconvolution( + spec_df, mz_delta, base_i, deconv_elem_dct, only_c=only_c + ) # M+0 # m0_base_abs = pre2_base_m2_i + pre1_base_m1_i m0_base_abs = pre2_base_m2_i - base_m1_i, base_m2_i, base_m3_i = self.get_deconvolution(spec_df, mz_delta, m0_base_abs, - self.get_elements(formula), only_c=only_c) + base_m1_i, base_m2_i, base_m3_i = self.get_deconvolution( + spec_df, + mz_delta, + m0_base_abs, + self.get_elements(formula), + only_c=only_c, + ) # M+1 m1_base_abs = pre2_base_m3_i @@ -357,12 +451,19 @@ def get_isotope_score(self, ms1_pr_mz, ms1_pr_i, formula, spec_df, core_count, deconv_lst = [m0_base_abs, m1_base_abs, m2_base_abs, m3_base_abs] - i_df = spec_df.query('%f <= mz <= %f' % (ms1_pr_mz - delta_13c - mz_delta, ms1_pr_mz - delta_13c + mz_delta)) + i_df = spec_df.query( + "%f <= mz <= %f" + % (ms1_pr_mz - delta_13c - mz_delta, ms1_pr_mz - delta_13c + mz_delta) + ) if not i_df.empty: - max_pre_m_i = i_df['i'].max() - peak_top, top_obs_i = self.peak_top_checker(ms1_pr_mz - delta_13c, spec_df, - core_count=core_count, ms1_precision=ms1_precision) + max_pre_m_i = i_df["i"].max() + peak_top, top_obs_i = self.peak_top_checker( + ms1_pr_mz - delta_13c, + spec_df, + core_count=core_count, + ms1_precision=ms1_precision, + ) if peak_top is True: pass else: @@ -374,50 +475,75 @@ def get_isotope_score(self, ms1_pr_mz, ms1_pr_i, formula, spec_df, core_count, if ms1_pr_i > max_pre_m_i or pseudo_pr_check == 0: elem_dct = self.get_elements(formula) mono_mz = self.get_mono_mz(elem_dct) - pr_range_top, range_top_obs_i = self.peak_top_checker(ms1_pr_mz, spec_df, core_count=core_count, - ms1_precision=ms1_precision * 2.5) + pr_range_top, range_top_obs_i = self.peak_top_checker( + ms1_pr_mz, + spec_df, + core_count=core_count, + ms1_precision=ms1_precision * 2.5, + ) if pr_range_top and abs((ms1_pr_mz - mono_mz)) <= ms1_precision * ms1_pr_mz: isotope_pattern_df = self.get_isotope_mz(elem_dct, only_c=only_c) # print(isotope_pattern_df) ms1_pr_i -= m0_base_abs m0_deconv_lst = [m0_base_abs, m1_base_abs, m2_base_abs] - isotope_calc_dct = self.calc_isotope_score(isotope_pattern_df, spec_df, ms1_precision, ms1_pr_i, - core_count=core_count, deconv=m0_deconv_lst, mode='m', - score_filter=score_filter) - - isotope_checker_dct = isotope_calc_dct['isotope_checker_dct'] - isotope_score = isotope_calc_dct['isotope_score'] - isotope_m1_score = isotope_calc_dct['isotope_m1_score'] + isotope_calc_dct = self.calc_isotope_score( + isotope_pattern_df, + spec_df, + ms1_precision, + ms1_pr_i, + core_count=core_count, + deconv=m0_deconv_lst, + mode="m", + score_filter=score_filter, + ) + + isotope_checker_dct = isotope_calc_dct["isotope_checker_dct"] + isotope_score = isotope_calc_dct["isotope_score"] + isotope_m1_score = isotope_calc_dct["isotope_m1_score"] # m2_i = isotope_calc_dct['m2_i'] m2_checker_dct = {} m2_score = 0 - obs_pr_mz = isotope_calc_dct['obs_pr_mz'] - obs_pr_i = isotope_calc_dct['obs_pr_i'] + obs_pr_mz = isotope_calc_dct["obs_pr_mz"] + obs_pr_i = isotope_calc_dct["obs_pr_i"] if isotope_score <= score_filter <= isotope_m1_score: - print(core_count, '[INFO] --> check if M+2 is potential M+0 of M+2H ...') + print( + core_count, + "[INFO] --> check if M+2 is potential M+0 of M+2H ...", + ) # check if M+2 is potential M+0 of M+2H # M+H2 elements - m2_elem_dct = self.get_elements(formula + 'H2') - m2_isotope_pattern_df = self.get_isotope_mz(m2_elem_dct, only_c=only_c) + m2_elem_dct = self.get_elements(formula + "H2") + m2_isotope_pattern_df = self.get_isotope_mz( + m2_elem_dct, only_c=only_c + ) # get exact M+2 pr i, especially for ppm < 10 m2_mz_df = m2_isotope_pattern_df.head(1) - m2_mz = m2_mz_df['mz'].tolist()[0] - m2_i_df = spec_df.query('%f <= mz <= %f' % (m2_mz * (1 - ms1_precision), - m2_mz * (1 + ms1_precision))) - m2_i = m2_i_df['i'].max() + m2_mz = m2_mz_df["mz"].tolist()[0] + m2_i_df = spec_df.query( + "%f <= mz <= %f" + % (m2_mz * (1 - ms1_precision), m2_mz * (1 + ms1_precision)) + ) + m2_i = m2_i_df["i"].max() m2_i -= m2_base_abs m2_deconv_lst = [m2_base_abs, m3_base_abs, 0] - m2_calc_dct = self.calc_isotope_score(m2_isotope_pattern_df, spec_df, ms1_precision, m2_i, - core_count=core_count, deconv=m2_deconv_lst, mode='m+2', - score_filter=score_filter) - - m2_checker_dct = m2_calc_dct['isotope_checker_dct'] + m2_calc_dct = self.calc_isotope_score( + m2_isotope_pattern_df, + spec_df, + ms1_precision, + m2_i, + core_count=core_count, + deconv=m2_deconv_lst, + mode="m+2", + score_filter=score_filter, + ) + + m2_checker_dct = m2_calc_dct["isotope_checker_dct"] # use M+1 only - m2_score = m2_calc_dct['isotope_m1_score'] + m2_score = m2_calc_dct["isotope_m1_score"] # m2_m2i = m2_calc_dct['m2_i'] if m2_score > 0: @@ -428,60 +554,94 @@ def get_isotope_score(self, ms1_pr_mz, ms1_pr_i, formula, spec_df, core_count, if 2 in list(m2_checker_dct.keys()): del m2_checker_dct[2] - if m2_score >= max(score_filter * 0.75, 60): # set lower filter for M+2H - print(core_count, '[INFO] --> M+2 ~ M+4 has isotope score for [M+H2]: %.1f' % m2_score) + if m2_score >= max( + score_filter * 0.75, 60 + ): # set lower filter for M+2H + print( + core_count, + "[INFO] --> M+2 ~ M+4 has isotope score for [M+H2]: %.1f" + % m2_score, + ) isotope_score = isotope_m1_score - del isotope_checker_dct[2]['obs_i'] - del isotope_checker_dct[2]['obs_mz'] + del isotope_checker_dct[2]["obs_i"] + del isotope_checker_dct[2]["obs_mz"] else: - print(core_count, '[WARNING] !!! M+2 ~ M+4 has isotope score for [M+H2]: %.1f' % m2_score) + print( + core_count, + "[WARNING] !!! M+2 ~ M+4 has isotope score for [M+H2]: %.1f" + % m2_score, + ) isotope_score = isotope_m1_score m2_checker_dct = {} m2_score = 0 - del isotope_checker_dct[2]['obs_i'] - del isotope_checker_dct[2]['obs_mz'] + del isotope_checker_dct[2]["obs_i"] + del isotope_checker_dct[2]["obs_mz"] else: - print(core_count, '[WARNING] !!! MS1 PR m/z not fit to Formula check bulk identification !!!') + print( + core_count, + "[WARNING] !!! MS1 PR m/z not fit to Formula check bulk identification !!!", + ) isotope_score = 0 isotope_checker_dct = {} m2_checker_dct = {} m2_score = 0 else: - print(core_count, '[WARNING] !!! MS1 PR is an isotope !!!') + print(core_count, "[WARNING] !!! MS1 PR is an isotope !!!") isotope_score = 0 isotope_checker_dct = {} m2_checker_dct = {} m2_score = 0 - isotope_score_info_dct = {'isotope_score': isotope_score, 'isotope_checker_dct': isotope_checker_dct, - 'm2_score': m2_score, 'm2_checker_dct': m2_checker_dct, - 'deconv_lst': deconv_lst, 'obs_pr_mz': obs_pr_mz, 'obs_pr_i': obs_pr_i} + isotope_score_info_dct = { + "isotope_score": isotope_score, + "isotope_checker_dct": isotope_checker_dct, + "m2_score": m2_score, + "m2_checker_dct": m2_checker_dct, + "deconv_lst": deconv_lst, + "obs_pr_mz": obs_pr_mz, + "obs_pr_i": obs_pr_i, + } return isotope_score_info_dct - def get_isotope_fragments(self, ms1_pr_mz, ms1_pr_i, formula, spec_df, core_count, - ms1_precision=50e-6, only_c=False, - decon=True, exp_mode='LC-MS'): + def get_isotope_fragments( + self, + ms1_pr_mz, + ms1_pr_i, + formula, + spec_df, + core_count, + ms1_precision=50e-6, + only_c=False, + decon=True, + exp_mode="LC-MS", + ): # TODO (georgia.angelidou@uni-leipzig.de): Need to check the reason why we do not get any output mz_delta = ms1_pr_mz * ms1_precision delta_13c = 1.0033548378 - if exp_mode == 'Shotgun': + if exp_mode == "Shotgun": pseudo_pr_check = 0 else: pseudo_pr_check = 1 if decon is True: deconv_elem_dct = self.get_elements(formula) - deconv_elem_dct['H'] += -2 + deconv_elem_dct["H"] += -2 base_i = 0 - pre2_base_m1_i, pre2_base_m2_i, pre2_base_m3_i = self.get_deconvolution(spec_df, mz_delta, base_i, - deconv_elem_dct, only_c=only_c) + pre2_base_m1_i, pre2_base_m2_i, pre2_base_m3_i = self.get_deconvolution( + spec_df, mz_delta, base_i, deconv_elem_dct, only_c=only_c + ) m0_base_abs = pre2_base_m2_i - base_m1_i, base_m2_i, base_m3_i = self.get_deconvolution(spec_df, mz_delta, m0_base_abs, - self.get_elements(formula), only_c=only_c) + base_m1_i, base_m2_i, base_m3_i = self.get_deconvolution( + spec_df, + mz_delta, + m0_base_abs, + self.get_elements(formula), + only_c=only_c, + ) m1_base_abs = pre2_base_m3_i @@ -491,9 +651,12 @@ def get_isotope_fragments(self, ms1_pr_mz, ms1_pr_i, formula, spec_df, core_coun # M+3 m3_base_abs = base_m3_i - print(core_count, '[INFO] --> Deconvolution_i_abs_corrections: ' - '[M+0] %.1f, [M+1] %.1f, [M+2] %.1f, [M+3] %.1f' - % (m0_base_abs, m1_base_abs, m2_base_abs, m3_base_abs)) + print( + core_count, + "[INFO] --> Deconvolution_i_abs_corrections: " + "[M+0] %.1f, [M+1] %.1f, [M+2] %.1f, [M+3] %.1f" + % (m0_base_abs, m1_base_abs, m2_base_abs, m3_base_abs), + ) deconv_lst = [m0_base_abs, m1_base_abs, m2_base_abs, m3_base_abs] else: @@ -504,10 +667,13 @@ def get_isotope_fragments(self, ms1_pr_mz, ms1_pr_i, formula, spec_df, core_coun deconv_lst = [m0_base_abs, m1_base_abs, m2_base_abs, m3_base_abs] - i_df = spec_df.query('%f <= mz <= %f' % (ms1_pr_mz - delta_13c - mz_delta, ms1_pr_mz - delta_13c + mz_delta)) + i_df = spec_df.query( + "%f <= mz <= %f" + % (ms1_pr_mz - delta_13c - mz_delta, ms1_pr_mz - delta_13c + mz_delta) + ) isotope_flag = 0 if not i_df.empty: - max_pre_m_i = i_df['i'].max() + max_pre_m_i = i_df["i"].max() if ms1_pr_i > max_pre_m_i or pseudo_pr_check == 0: elem_dct = self.get_elements(formula) @@ -515,34 +681,52 @@ def get_isotope_fragments(self, ms1_pr_mz, ms1_pr_i, formula, spec_df, core_coun if abs((ms1_pr_mz - mono_mz)) <= ms1_precision * ms1_pr_mz: isotope_flag = 0 else: - print('[WARNING] !!! MS1 PR m/z not fit to Formula check bulk identification !!!') + print( + "[WARNING] !!! MS1 PR m/z not fit to Formula check bulk identification !!!" + ) else: - print('[WARNING] !!! MS1 PR is an isotope !!!') + print("[WARNING] !!! MS1 PR is an isotope !!!") isotope_flag = 1 else: pass return isotope_flag - def get_isotope_fragments_sec(self, ms1_pr_mz, ms1_pr_i, formula, spec_df, core_count, ms1_precision=50e-6, - only_c=False, decon=True, exp_mode='LC-MS'): + def get_isotope_fragments_sec( + self, + ms1_pr_mz, + ms1_pr_i, + formula, + spec_df, + core_count, + ms1_precision=50e-6, + only_c=False, + decon=True, + exp_mode="LC-MS", + ): mz_delta = ms1_pr_mz * ms1_precision delta_13c = 1.0033548378 - if exp_mode == 'Shotgun': + if exp_mode == "Shotgun": pseudo_pr_check = 0 else: pseudo_pr_check = 1 if decon is True: deconv_elem_dct = self.get_elements(formula) - deconv_elem_dct['H'] += -2 + deconv_elem_dct["H"] += -2 base_i = 0 - pre2_base_m1_i, pre2_base_m2_i, pre2_base_m3_i = self.get_deconvolution(spec_df, mz_delta, base_i, - deconv_elem_dct, only_c=only_c) + pre2_base_m1_i, pre2_base_m2_i, pre2_base_m3_i = self.get_deconvolution( + spec_df, mz_delta, base_i, deconv_elem_dct, only_c=only_c + ) m0_base_abs = pre2_base_m2_i - base_m1_i, base_m2_i, base_m3_i = self.get_deconvolution(spec_df, mz_delta, m0_base_abs, - self.get_elements(formula), only_c=only_c) + base_m1_i, base_m2_i, base_m3_i = self.get_deconvolution( + spec_df, + mz_delta, + m0_base_abs, + self.get_elements(formula), + only_c=only_c, + ) m1_base_abs = pre2_base_m3_i @@ -552,9 +736,12 @@ def get_isotope_fragments_sec(self, ms1_pr_mz, ms1_pr_i, formula, spec_df, core_ # M+3 m3_base_abs = base_m3_i - print(core_count, '[INFO] --> Deconvolution_i_abs_corrections: ' - '[M+0] %.1f, [M+1] %.1f, [M+2] %.1f, [M+3] %.1f' - % (m0_base_abs, m1_base_abs, m2_base_abs, m3_base_abs)) + print( + core_count, + "[INFO] --> Deconvolution_i_abs_corrections: " + "[M+0] %.1f, [M+1] %.1f, [M+2] %.1f, [M+3] %.1f" + % (m0_base_abs, m1_base_abs, m2_base_abs, m3_base_abs), + ) deconv_lst = [m0_base_abs, m1_base_abs, m2_base_abs, m3_base_abs] else: @@ -565,10 +752,13 @@ def get_isotope_fragments_sec(self, ms1_pr_mz, ms1_pr_i, formula, spec_df, core_ deconv_lst = [m0_base_abs, m1_base_abs, m2_base_abs, m3_base_abs] - i_df = spec_df.query('%f <= mz <= %f' % (ms1_pr_mz - delta_13c - mz_delta, ms1_pr_mz - delta_13c + mz_delta)) + i_df = spec_df.query( + "%f <= mz <= %f" + % (ms1_pr_mz - delta_13c - mz_delta, ms1_pr_mz - delta_13c + mz_delta) + ) isotope_flag = 0 if not i_df.empty: - max_pre_m_i = i_df['i'].max() + max_pre_m_i = i_df["i"].max() if ms1_pr_i > max_pre_m_i or pseudo_pr_check == 0: elem_dct = self.get_elements(formula) @@ -576,16 +766,19 @@ def get_isotope_fragments_sec(self, ms1_pr_mz, ms1_pr_i, formula, spec_df, core_ if abs((ms1_pr_mz - mono_mz)) <= ms1_precision * ms1_pr_mz: isotope_flag = 0 else: - print(core_count, '[WARNING] !!! MS1 PR m/z not fit to Formula check bulk identification !!!') + print( + core_count, + "[WARNING] !!! MS1 PR m/z not fit to Formula check bulk identification !!!", + ) else: - print(core_count, '[WARNING] !!! MS1 PR is an isotope !!!') + print(core_count, "[WARNING] !!! MS1 PR is an isotope !!!") isotope_flag = 1 else: pass return isotope_flag -if __name__ == '__main__': +if __name__ == "__main__": # f = 'C39H67NO8P' # PE(34:5) # f_lst = [f, f + 'K', f + 'Na', f + 'NH4', f + 'S', f + 'D'] # usr_spec_df = pd.DataFrame() @@ -597,7 +790,7 @@ def get_isotope_fragments_sec(self, ms1_pr_mz, ms1_pr_i, formula, spec_df, core_ # print(isotope_pattern_dct) # f = 'C41H71NO7P' # PE - f = 'C51H92O6Na' + f = "C51H92O6Na" # f_lst = [f, f + 'H+'] f_lst = [f] usr_spec_df = pd.DataFrame() @@ -605,9 +798,11 @@ def get_isotope_fragments_sec(self, ms1_pr_mz, ms1_pr_i, formula, spec_df, core_ for _f in f_lst: print(_f) isotope_pattern_dct = iso_hunter.get_elements(_f) - isotope_distribute = iso_hunter.get_isotope_mz(isotope_pattern_dct, only_c=False) + isotope_distribute = iso_hunter.get_isotope_mz( + isotope_pattern_dct, only_c=False + ) print(isotope_distribute) isotope_distribute = iso_hunter.get_isotope_mz(isotope_pattern_dct, only_c=True) isotope_distribute = isotope_distribute.head(3) print(isotope_distribute) - print(isotope_distribute.at[0, 'mz']) + print(isotope_distribute.at[0, "mz"]) diff --git a/LibLipidHunter/LipidComposer.py b/LibLipidHunter/LipidComposer.py index 05b5fc2..24bd6f4 100644 --- a/LibLipidHunter/LipidComposer.py +++ b/LibLipidHunter/LipidComposer.py @@ -18,9 +18,9 @@ # Developer Georgia Angelidou georgia.angelidou@uni-leipzig.de import itertools +from typing import List import pandas as pd -from natsort import natsorted, ns from LibLipidHunter.LipidNomenclature import NameParserFA from LibLipidHunter.AbbrElemCalc import ElemCalc @@ -28,121 +28,163 @@ class LipidComposer: + """ + Lipid composer is designed to generate all possible combinations of given lipid class based on the + FA white list from user settings. and calculate all information required for MS/MS identification + including elemental composition, m/z of precursor and fragments ion under selected charge status + as fragment or from neutral losses. + """ def __init__(self): - pa_hg_elem = {'C': 0, 'H': 3, 'O': 4, 'P': 1, 'N': 0} - pc_hg_elem = {'C': 5, 'H': 14, 'O': 4, 'P': 1, 'N': 1} - pe_hg_elem = {'C': 2, 'H': 8, 'O': 4, 'P': 1, 'N': 1} - pg_hg_elem = {'C': 3, 'H': 9, 'O': 6, 'P': 1, 'N': 0} - pi_hg_elem = {'C': 6, 'H': 13, 'O': 9, 'P': 1, 'N': 0} - pip_hg_elem = {'C': 6, 'H': 14, 'O': 12, 'P': 2, 'N': 0} - ps_hg_elem = {'C': 3, 'H': 8, 'O': 6, 'P': 1, 'N': 1} - tg_hg_elem = {'C': 0, 'H': 0, 'O': 0, 'P': 0, 'N': 0} - - self.lipid_hg_lst = ['PA', 'PC', 'PE', 'PG', 'PI', 'PS', 'PIP', 'TG'] - - self.lipid_hg_elem_dct = {'PA': pa_hg_elem, 'PC': pc_hg_elem, 'PE': pe_hg_elem, 'PG': pg_hg_elem, - 'PI': pi_hg_elem, 'PS': ps_hg_elem, 'PIP': pip_hg_elem, 'TG': tg_hg_elem, - 'DG': tg_hg_elem} - - self.glycerol_bone_elem_dct = {'C': 3, 'H': 2} - self.link_o_elem_dct = {'O': -1, 'H': 2} - self.link_p_elem_dct = {'O': -1} - self.elem_dct = {'H': [1.0078250321, 0.999885], - 'D': [2.0141017780, 0.0001157], - 'C': [12.0, 0.9893], - 'N': [14.0030740052, 0.99632], - 'O': [15.9949146221, 0.99757], - 'Na': [22.98976967, 1.0], - 'P': [30.97376151, 1.0], - 'S': [31.97207069, 0.9493], - 'K': [38.9637069, 0.932581]} + """ + Default parameters for the elemental compositions + """ + pa_hg_elem = {"C": 0, "H": 3, "O": 4, "P": 1, "N": 0} + pc_hg_elem = {"C": 5, "H": 14, "O": 4, "P": 1, "N": 1} + pe_hg_elem = {"C": 2, "H": 8, "O": 4, "P": 1, "N": 1} + pg_hg_elem = {"C": 3, "H": 9, "O": 6, "P": 1, "N": 0} + pi_hg_elem = {"C": 6, "H": 13, "O": 9, "P": 1, "N": 0} + pip_hg_elem = {"C": 6, "H": 14, "O": 12, "P": 2, "N": 0} + ps_hg_elem = {"C": 3, "H": 8, "O": 6, "P": 1, "N": 1} + tg_hg_elem = {"C": 0, "H": 0, "O": 0, "P": 0, "N": 0} + # Todo: add SM corresponding HG sections around here + + self.lipid_hg_lst = ["PA", "PC", "PE", "PG", "PI", "PS", "PIP", "TG"] + + self.lipid_hg_elem_dct = { + "PA": pa_hg_elem, + "PC": pc_hg_elem, + "PE": pe_hg_elem, + "PG": pg_hg_elem, + "PI": pi_hg_elem, + "PS": ps_hg_elem, + "PIP": pip_hg_elem, + "TG": tg_hg_elem, + "DG": tg_hg_elem, + } + + self.glycerol_bone_elem_dct = {"C": 3, "H": 2} + self.link_o_elem_dct = {"O": -1, "H": 2} + self.link_p_elem_dct = {"O": -1} + self.elem_dct = { + "H": [1.0078250321, 0.999885], + "D": [2.0141017780, 0.0001157], + "C": [12.0, 0.9893], + "N": [14.0030740052, 0.99632], + "O": [15.9949146221, 0.99757], + "Na": [22.98976967, 1.0], + "P": [30.97376151, 1.0], + "S": [31.97207069, 0.9493], + "K": [38.9637069, 0.932581], + } @staticmethod - def calc_fa_df(lipid_class, fa_df): + def calc_fa_df(lipid_class: str, fa_df: pd.DataFrame) -> List[List[str]]: + """ + Read list of FA abbreviations from FA white list for lipid enumeration later + Args: + lipid_class(str): lipid class abbreviation + fa_df(pd.DataFrame): FA white list in pd.DataFrame + + Returns: + sn_units_lst(List[List[str]]): list of FA for each FA position + """ sn_units_lst = [] header_lst = fa_df.columns.values.tolist() - if lipid_class in ['PA', 'PC', 'PE', 'PG', 'PI', 'PS']: - if 'PL' in header_lst and 'FATTYACID' in header_lst: + if lipid_class in ["PA", "PC", "PE", "PG", "PI", "PS"]: + if "PL" in header_lst and "FATTYACID" in header_lst: pl_fa1_df = fa_df.query('PL == "T" and FA1 == "T"') pl_fa2_df = fa_df.query('PL == "T" and FA2 == "T"') - pl_fa1_lst = pl_fa1_df['FATTYACID'].tolist() - pl_fa2_lst = pl_fa2_df['FATTYACID'].tolist() + pl_fa1_lst = pl_fa1_df["FATTYACID"].tolist() + pl_fa2_lst = pl_fa2_df["FATTYACID"].tolist() sn_units_lst = [pl_fa1_lst, pl_fa2_lst] - elif lipid_class in ['LPA', 'LPC', 'LPE', 'LPG', 'LPI', 'LPS']: - if 'LPL' in header_lst and 'FATTYACID' in header_lst: + elif lipid_class in ["LPA", "LPC", "LPE", "LPG", "LPI", "LPS"]: + if "LPL" in header_lst and "FATTYACID" in header_lst: pl_fa1_df = fa_df.query('LPL == "T" and FA1 == "T"') - pl_fa1_lst = pl_fa1_df['FATTYACID'].tolist() - sn_units_lst = [pl_fa1_lst, ['']] - elif 'PL' in header_lst and 'FATTYACID' in header_lst: + pl_fa1_lst = pl_fa1_df["FATTYACID"].tolist() + sn_units_lst = [pl_fa1_lst, [""]] + elif "PL" in header_lst and "FATTYACID" in header_lst: pl_fa1_df = fa_df.query('PL == "T" and FA1 == "T"') - pl_fa1_lst = pl_fa1_df['FATTYACID'].tolist() - sn_units_lst = [pl_fa1_lst, ['']] + pl_fa1_lst = pl_fa1_df["FATTYACID"].tolist() + sn_units_lst = [pl_fa1_lst, [""]] - elif lipid_class in ['TG']: - if 'TG' in header_lst and 'FATTYACID' in header_lst: + elif lipid_class in ["TG"]: + if "TG" in header_lst and "FATTYACID" in header_lst: tg_fa1_df = fa_df.query('TG == "T" and FA1 == "T"') tg_fa2_df = fa_df.query('TG == "T" and FA2 == "T"') tg_fa3_df = fa_df.query('TG == "T" and FA3 == "T"') - tg_fa1_lst = tg_fa1_df['FATTYACID'].tolist() - tg_fa2_lst = tg_fa2_df['FATTYACID'].tolist() - tg_fa3_lst = tg_fa3_df['FATTYACID'].tolist() + tg_fa1_lst = tg_fa1_df["FATTYACID"].tolist() + tg_fa2_lst = tg_fa2_df["FATTYACID"].tolist() + tg_fa3_lst = tg_fa3_df["FATTYACID"].tolist() sn_units_lst = [tg_fa1_lst, tg_fa2_lst, tg_fa3_lst] - elif lipid_class in ['DG']: - if 'DG' in header_lst and 'FATTYACID' in header_lst: + elif lipid_class in ["DG"]: + if "DG" in header_lst and "FATTYACID" in header_lst: dg_fa1_df = fa_df.query('TG == "T" and FA1 == "T"') dg_fa2_df = fa_df.query('TG == "T" and FA2 == "T"') - dg_fa1_lst = dg_fa1_df['FATTYACID'].tolist() - dg_fa2_lst = dg_fa2_df['FATTYACID'].tolist() + dg_fa1_lst = dg_fa1_df["FATTYACID"].tolist() + dg_fa2_lst = dg_fa2_df["FATTYACID"].tolist() sn_units_lst = [dg_fa1_lst, dg_fa2_lst] - elif lipid_class in ['CL']: - if 'CL' in header_lst and 'FATTYACID' in header_lst: + elif lipid_class in ["CL"]: + if "CL" in header_lst and "FATTYACID" in header_lst: cl_fa1_df = fa_df.query('CL == "T" and FA1 == "T"') cl_fa2_df = fa_df.query('CL == "T" and FA2 == "T"') cl_fa3_df = fa_df.query('CL == "T" and FA3 == "T"') cl_fa4_df = fa_df.query('CL == "T" and FA4 == "T"') - cl_fa1_lst = cl_fa1_df['FATTYACID'].tolist() - cl_fa2_lst = cl_fa2_df['FATTYACID'].tolist() - cl_fa3_lst = cl_fa3_df['FATTYACID'].tolist() - cl_fa4_lst = cl_fa4_df['FATTYACID'].tolist() + cl_fa1_lst = cl_fa1_df["FATTYACID"].tolist() + cl_fa2_lst = cl_fa2_df["FATTYACID"].tolist() + cl_fa3_lst = cl_fa3_df["FATTYACID"].tolist() + cl_fa4_lst = cl_fa4_df["FATTYACID"].tolist() sn_units_lst = [cl_fa1_lst, cl_fa2_lst, cl_fa3_lst, cl_fa4_lst] return sn_units_lst - def calc_fa_query(self, lipid_class, fa_whitelist, ms2_ppm=100): + def calc_fa_query( + self, lipid_class: str, fa_whitelist: str, ms2_ppm: int = 100 + ) -> pd.DataFrame: + """ + Prepare all query strings for the MS/MS identification + build all pandas query code in advance to save the time during identification + Args: + lipid_class(str): Lipid class abbreviation + fa_whitelist(str): the ile path to FA white list + ms2_ppm(int): ppm at MS/MS level, set default to 100 for some qTOF instrument + + Returns (pd.DataFrame): The calculated information including m/z and query code in DataFrame + + """ usr_fa_df = pd.read_excel(fa_whitelist) - usr_fa_df = usr_fa_df.fillna(value='F') + usr_fa_df = usr_fa_df.fillna(value="F") tmp_columns = usr_fa_df.columns.tolist() usr_fa_df.columns = usr_fa_df.columns.str.upper() - if lipid_class in ['PL', 'PA', 'PC', 'PE', 'PG', 'PI', 'PS', 'SM']: + if lipid_class in ["PL", "PA", "PC", "PE", "PG", "PI", "PS", "SM"]: if lipid_class in tmp_columns: pass - elif 'PL' in tmp_columns: + elif "PL" in tmp_columns: pass else: return False - elif lipid_class in ['LPL', 'LPA', 'LPC', 'LPE', 'LPG', 'LPI', 'LPS']: + elif lipid_class in ["LPL", "LPA", "LPC", "LPE", "LPG", "LPI", "LPS"]: if lipid_class in tmp_columns: pass - elif 'LPL' in tmp_columns or 'PL' in tmp_columns: + elif "LPL" in tmp_columns or "PL" in tmp_columns: pass else: return False - elif lipid_class in ['TG', 'DG']: + elif lipid_class in ["TG", "DG"]: if lipid_class in tmp_columns: pass else: @@ -150,7 +192,9 @@ def calc_fa_query(self, lipid_class, fa_whitelist, ms2_ppm=100): else: return False - sn_units_lst = self.calc_fa_df(lipid_class, usr_fa_df) # Return a list with list of the FA for each sn position + sn_units_lst = self.calc_fa_df( + lipid_class, usr_fa_df + ) # Return a list with list of the FA for each sn position fa_abbr_lst = [] # For PL lem(sn_units_lst) = 2 and for TG len(sn_units_lst) = 3 for _s in sn_units_lst: @@ -162,33 +206,50 @@ def calc_fa_query(self, lipid_class, fa_whitelist, ms2_ppm=100): usr_fa_dct = {} for _fa_abbr in fa_abbr_lst: if _fa_abbr: - _fa_info_dct = abbr_parser.get_fa_info(_fa_abbr) # Calculate all the information for each FA - _lipid_formula, _lipid_elem_dct = elem_calc.get_formula(_fa_abbr) # get the elemental composition of FA + _fa_info_dct = abbr_parser.get_fa_info( + _fa_abbr + ) # Calculate all the information for each FA + _lipid_formula, _lipid_elem_dct = elem_calc.get_formula( + _fa_abbr + ) # get the elemental composition of FA # add the Abbr, formula and the exact mass in the dictionary - _fa_info_dct['ABBR'] = _fa_abbr - _fa_info_dct['FORMULA'] = _lipid_formula - _fa_info_dct['EXACTMASS'] = elem_calc.get_exactmass(_lipid_elem_dct) # Calc. the exact mass for each FA + _fa_info_dct["ABBR"] = _fa_abbr + _fa_info_dct["FORMULA"] = _lipid_formula + _fa_info_dct["EXACTMASS"] = elem_calc.get_exactmass( + _lipid_elem_dct + ) # Calc. the exact mass for each FA usr_fa_dct[_fa_abbr] = _fa_info_dct - usr_fa_df = pd.DataFrame(usr_fa_dct).T.copy() # put all the info for the FA in a dataframe + usr_fa_df = pd.DataFrame( + usr_fa_dct + ).T.copy() # put all the info for the FA in a dataframe # usr_fa_df.is_copy = False # create the queries for the FA fragments and MG - for _fa_ion in ['[FA-H]-', '[FA-H2O-H]-', '[FA-H2O+H]+']: - usr_fa_df['%s_MZ_LOW' % _fa_ion] = ppm_window_para(usr_fa_df['%s_MZ' % _fa_ion].values.tolist(), - ms2_ppm * -1) - usr_fa_df['%s_MZ_HIGH' % _fa_ion] = ppm_window_para(usr_fa_df['%s_MZ' % _fa_ion].values.tolist(), ms2_ppm) - usr_fa_df['%s_Q' % _fa_ion] = (usr_fa_df['%s_MZ_LOW' % _fa_ion].astype(str) + ' <= mz <= ' - + usr_fa_df['%s_MZ_HIGH' % _fa_ion].astype(str)) + for _fa_ion in ["[FA-H]-", "[FA-H2O-H]-", "[FA-H2O+H]+"]: + usr_fa_df["%s_MZ_LOW" % _fa_ion] = ppm_window_para( + usr_fa_df["%s_MZ" % _fa_ion].values.tolist(), ms2_ppm * -1 + ) + usr_fa_df["%s_MZ_HIGH" % _fa_ion] = ppm_window_para( + usr_fa_df["%s_MZ" % _fa_ion].values.tolist(), ms2_ppm + ) + usr_fa_df["%s_Q" % _fa_ion] = ( + usr_fa_df["%s_MZ_LOW" % _fa_ion].astype(str) + + " <= mz <= " + + usr_fa_df["%s_MZ_HIGH" % _fa_ion].astype(str) + ) # More specific fragments for PL - if lipid_class in ['PA', 'PC', 'PE', 'PG', 'PI', 'PS', 'PIP']: + if lipid_class in ["PA", "PC", "PE", "PG", "PI", "PS", "PIP"]: # there alreadz the backbone of the stucture eg. for PE C5H10NO4P # for the [LPE(16:0)-H]- missing the exact mass of the FA # for the [LPE(16:0)-H2O-H]- we have the loss of water which already calculated in the structure # thats why addition of the FA but without of the water - lyso_type_dct = {'[L%s-H]-' % lipid_class: 'EXACTMASS', '[L%s-H2O-H]-' % lipid_class: '[FA-H2O]_MZ'} + lyso_type_dct = { + "[L%s-H]-" % lipid_class: "EXACTMASS", + "[L%s-H2O-H]-" % lipid_class: "[FA-H2O]_MZ", + } # backbone creation for the different PL lyso_base_elem_dct = self.lipid_hg_elem_dct[lipid_class] @@ -196,177 +257,237 @@ def calc_fa_query(self, lipid_class, fa_whitelist, ms2_ppm=100): lyso_base_elem_dct[_e] += self.glycerol_bone_elem_dct[_e] # the element here is with no Hydroxyl on fa1 and fa2, here a [M-H]- is already considered - lyso_base_mz = elem_calc.get_exactmass(lyso_base_elem_dct) + 1.0078250321 + 15.9949146221 - - if lipid_class in ['PC', 'SM']: - lyso_base_mz -= (12.0 + 2 * 1.0078250321) # LPC loss one -CH3 from HG (one H already remove above) + lyso_base_mz = ( + elem_calc.get_exactmass(lyso_base_elem_dct) + + 1.0078250321 + + 15.9949146221 + ) + # Todo: SM section + if lipid_class in ["PC", "SM"]: + lyso_base_mz -= ( + 12.0 + 2 * 1.0078250321 + ) # LPC loss one -CH3 from HG (one H already remove above) for _lyso_ion in list(lyso_type_dct.keys()): - if lipid_class in ['PC', 'SM']: - - if lyso_type_dct[_lyso_ion] == 'EXACTMASS': - usr_fa_df['%s_ABBR' % _lyso_ion] = ('[L' + lipid_class + '(' + usr_fa_df['ABBR'].str.strip('FA') - + ')-CH3]-') - elif lyso_type_dct[_lyso_ion] == '[FA-H2O]_MZ': - usr_fa_df['%s_ABBR' % _lyso_ion] = ('[L' + lipid_class + '(' + usr_fa_df['ABBR'].str.strip('FA') - + ')-H2O-CH3]-') + + if lipid_class in ["PC", "SM"]: + + if lyso_type_dct[_lyso_ion] == "EXACTMASS": + usr_fa_df["%s_ABBR" % _lyso_ion] = ( + "[L" + + lipid_class + + "(" + + usr_fa_df["ABBR"].str.strip("FA") + + ")-CH3]-" + ) + elif lyso_type_dct[_lyso_ion] == "[FA-H2O]_MZ": + usr_fa_df["%s_ABBR" % _lyso_ion] = ( + "[L" + + lipid_class + + "(" + + usr_fa_df["ABBR"].str.strip("FA") + + ")-H2O-CH3]-" + ) else: - usr_fa_df['%s_ABBR' % _lyso_ion] = 'ERROR' + usr_fa_df["%s_ABBR" % _lyso_ion] = "ERROR" else: - if lyso_type_dct[_lyso_ion] == 'EXACTMASS': - usr_fa_df['%s_ABBR' % _lyso_ion] = ('[L' + lipid_class + '(' + usr_fa_df['ABBR'].str.strip('FA') - + ')-H]-') - elif lyso_type_dct[_lyso_ion] == '[FA-H2O]_MZ': - usr_fa_df['%s_ABBR' % _lyso_ion] = ('[L' + lipid_class + '(' + usr_fa_df['ABBR'].str.strip('FA') - + ')-H2O-H]-') + if lyso_type_dct[_lyso_ion] == "EXACTMASS": + usr_fa_df["%s_ABBR" % _lyso_ion] = ( + "[L" + + lipid_class + + "(" + + usr_fa_df["ABBR"].str.strip("FA") + + ")-H]-" + ) + elif lyso_type_dct[_lyso_ion] == "[FA-H2O]_MZ": + usr_fa_df["%s_ABBR" % _lyso_ion] = ( + "[L" + + lipid_class + + "(" + + usr_fa_df["ABBR"].str.strip("FA") + + ")-H2O-H]-" + ) else: - usr_fa_df['%s_ABBR' % _lyso_ion] = 'ERROR' - - usr_fa_df['%s_MZ' % _lyso_ion] = lyso_base_mz + usr_fa_df[lyso_type_dct[_lyso_ion]] - usr_fa_df['%s_MZ_LOW' % _lyso_ion] = ppm_window_para(usr_fa_df['%s_MZ' % _lyso_ion].values.tolist(), - ms2_ppm * -1) - usr_fa_df['%s_MZ_HIGH' % _lyso_ion] = ppm_window_para(usr_fa_df['%s_MZ' % _lyso_ion].values.tolist(), - ms2_ppm) - usr_fa_df['%s_Q' % _lyso_ion] = (usr_fa_df['%s_MZ_LOW' % _lyso_ion].astype(str) + ' <= mz <= ' - + usr_fa_df['%s_MZ_HIGH' % _lyso_ion].astype(str)) - elif lipid_class in ['TG']: + usr_fa_df["%s_ABBR" % _lyso_ion] = "ERROR" + + usr_fa_df["%s_MZ" % _lyso_ion] = ( + lyso_base_mz + usr_fa_df[lyso_type_dct[_lyso_ion]] + ) + usr_fa_df["%s_MZ_LOW" % _lyso_ion] = ppm_window_para( + usr_fa_df["%s_MZ" % _lyso_ion].values.tolist(), ms2_ppm * -1 + ) + usr_fa_df["%s_MZ_HIGH" % _lyso_ion] = ppm_window_para( + usr_fa_df["%s_MZ" % _lyso_ion].values.tolist(), ms2_ppm + ) + usr_fa_df["%s_Q" % _lyso_ion] = ( + usr_fa_df["%s_MZ_LOW" % _lyso_ion].astype(str) + + " <= mz <= " + + usr_fa_df["%s_MZ_HIGH" % _lyso_ion].astype(str) + ) + elif lipid_class in ["TG"]: # Cannot calculate the theoritical m/z values of the DG fragments sinc we calculate the loss of a FA # and we dont know the cobination of the remaining 2 # TODO(georgia.angelidou@uni-leipzig.de): create the section for theuniue fragments when there is TG - mg_type_dct = {'[MG-H2O+H]+': 'EXACTMASS'} + mg_type_dct = {"[MG-H2O+H]+": "EXACTMASS"} mg_base_elem_dct = self.lipid_hg_elem_dct[lipid_class] for _e in self.glycerol_bone_elem_dct.keys(): mg_base_elem_dct[_e] += self.glycerol_bone_elem_dct[_e] # Calculate the rest of monoglycerol after the neutral loss of 2 FA in protonated form (one without Water) - mg_base_elem_dct = elem_calc.get_exactmass(mg_base_elem_dct) + 15.9949146221 + (3 * 1.0078250321) + mg_base_elem_dct = ( + elem_calc.get_exactmass(mg_base_elem_dct) + + 15.9949146221 + + (3 * 1.0078250321) + ) for _mg_ion in mg_type_dct.keys(): - usr_fa_df['%s_ABBR' % _mg_ion] = ('[MG(' + usr_fa_df['ABBR'].str.strip('FA') + ')-H2O+H]+') - usr_fa_df['%s_MZ' % _mg_ion] = mg_base_elem_dct + usr_fa_df[mg_type_dct[_mg_ion]] - usr_fa_df['%s_MZ_LOW' % _mg_ion] = ppm_window_para(usr_fa_df['%s_MZ' % _mg_ion].values.tolist(), - ms2_ppm * -1) - usr_fa_df['%s_MZ_HIGH' % _mg_ion] = ppm_window_para(usr_fa_df['%s_MZ' % _mg_ion].values.tolist(), - ms2_ppm) - usr_fa_df['%s_Q' % _mg_ion] = (usr_fa_df['%s_MZ_LOW' % _mg_ion].astype(str) + ' <= mz <= ' + usr_fa_df[ - '%s_MZ_HIGH' % _mg_ion].astype(str)) - elif lipid_class in ['DG']: - mg_type_dct = {'[MG-H2O+H]+': 'EXACTMASS'} + usr_fa_df["%s_ABBR" % _mg_ion] = ( + "[MG(" + usr_fa_df["ABBR"].str.strip("FA") + ")-H2O+H]+" + ) + usr_fa_df["%s_MZ" % _mg_ion] = ( + mg_base_elem_dct + usr_fa_df[mg_type_dct[_mg_ion]] + ) + usr_fa_df["%s_MZ_LOW" % _mg_ion] = ppm_window_para( + usr_fa_df["%s_MZ" % _mg_ion].values.tolist(), ms2_ppm * -1 + ) + usr_fa_df["%s_MZ_HIGH" % _mg_ion] = ppm_window_para( + usr_fa_df["%s_MZ" % _mg_ion].values.tolist(), ms2_ppm + ) + usr_fa_df["%s_Q" % _mg_ion] = ( + usr_fa_df["%s_MZ_LOW" % _mg_ion].astype(str) + + " <= mz <= " + + usr_fa_df["%s_MZ_HIGH" % _mg_ion].astype(str) + ) + + elif lipid_class in ["DG"]: + mg_type_dct = {"[MG-H2O+H]+": "EXACTMASS"} mg_base_elem_dct = self.lipid_hg_elem_dct[lipid_class] for _e in self.glycerol_bone_elem_dct.keys(): mg_base_elem_dct[_e] += self.glycerol_bone_elem_dct[_e] # Calculate the rest of monoglycerol after the neutral loss of 2 FA in protonated form (one without Water) - mg_base_elem_dct = elem_calc.get_exactmass(mg_base_elem_dct) + 15.9949146221 + (3 * 1.0078250321) + mg_base_elem_dct = ( + elem_calc.get_exactmass(mg_base_elem_dct) + + 15.9949146221 + + (3 * 1.0078250321) + ) for _mg_ion in mg_type_dct.keys(): - usr_fa_df['%s_ABBR' % _mg_ion] = ('[MG(' + usr_fa_df['ABBR'].str.strip('FA') + ')-H2O+H]+') - usr_fa_df['%s_MZ' % _mg_ion] = mg_base_elem_dct + usr_fa_df[mg_type_dct[_mg_ion]] - usr_fa_df['%s_MZ_LOW' % _mg_ion] = ppm_window_para(usr_fa_df['%s_MZ' % _mg_ion].values.tolist(), - ms2_ppm * -1) - usr_fa_df['%s_MZ_HIGH' % _mg_ion] = ppm_window_para(usr_fa_df['%s_MZ' % _mg_ion].values.tolist(), - ms2_ppm) - usr_fa_df['%s_Q' % _mg_ion] = (usr_fa_df['%s_MZ_LOW' % _mg_ion].astype(str) + ' <= mz <= ' + usr_fa_df[ - '%s_MZ_HIGH' % _mg_ion].astype(str)) + usr_fa_df["%s_ABBR" % _mg_ion] = ( + "[MG(" + usr_fa_df["ABBR"].str.strip("FA") + ")-H2O+H]+" + ) + usr_fa_df["%s_MZ" % _mg_ion] = ( + mg_base_elem_dct + usr_fa_df[mg_type_dct[_mg_ion]] + ) + usr_fa_df["%s_MZ_LOW" % _mg_ion] = ppm_window_para( + usr_fa_df["%s_MZ" % _mg_ion].values.tolist(), ms2_ppm * -1 + ) + usr_fa_df["%s_MZ_HIGH" % _mg_ion] = ppm_window_para( + usr_fa_df["%s_MZ" % _mg_ion].values.tolist(), ms2_ppm + ) + usr_fa_df["%s_Q" % _mg_ion] = ( + usr_fa_df["%s_MZ_LOW" % _mg_ion].astype(str) + + " <= mz <= " + + usr_fa_df["%s_MZ_HIGH" % _mg_ion].astype(str) + ) else: - # TODO (georgia.angelidou@uni-leipzig.de): SM + # Todo: SM section like above pass return usr_fa_df - def gen_all_comb(self, lipid_class, usr_fa_df, position=False): + def gen_all_comb( + self, lipid_class: str, usr_fa_df: pd.DataFrame, position: bool = False + ) -> dict: + + """ + Generate all possible FA combination of selected lipid class in discrete form without mirrored duplicates + + Args: + lipid_class(str): Lipid class abbreviation + usr_fa_df(pd.DataFrame): FA white list in DataFrame + position(bool): set as False by default to consider discrete form without position specific isomers + + Returns(dict): all combinations stored in dict + + """ fa_units_lst = self.calc_fa_df(lipid_class, usr_fa_df) - if lipid_class in ['PA', 'PC', 'PE', 'PG', 'PI', 'PS', 'DG', 'SM'] and len(fa_units_lst) == 2: + if ( + lipid_class in ["PA", "PC", "PE", "PG", "PI", "PS", "DG", "SM"] + and len(fa_units_lst) == 2 + ): fa_comb_lst = list(itertools.product(fa_units_lst[0], fa_units_lst[1])) - fa_df_header_lst = ['FA1', 'FA2'] + fa_df_header_lst = ["FA1", "FA2"] # lipid_template = '{}' - elif lipid_class in ['LPA', 'LPC', 'LPE', 'LPG', 'LPI', 'LPS'] and len(fa_units_lst) == 2: + elif ( + lipid_class in ["LPA", "LPC", "LPE", "LPG", "LPI", "LPS"] + and len(fa_units_lst) == 2 + ): fa_comb_lst = list(itertools.product(fa_units_lst[0], fa_units_lst[1])) - fa_df_header_lst = ['FA1', 'FA2'] + fa_df_header_lst = ["FA1", "FA2"] # lipid_template = '{}' - elif lipid_class == 'TG' and len(fa_units_lst) == 3: - fa_comb_lst = list(itertools.product(fa_units_lst[0], fa_units_lst[1], fa_units_lst[2])) - fa_df_header_lst = ['FA1', 'FA2', 'FA3'] - elif lipid_class == 'CL' and len(fa_units_lst) == 4: - fa_comb_lst = list(itertools.product(fa_units_lst[0], fa_units_lst[1], fa_units_lst[2], fa_units_lst[3])) - fa_df_header_lst = ['FA1', 'FA2', 'FA3', 'FA4'] + elif lipid_class == "TG" and len(fa_units_lst) == 3: + fa_comb_lst = list( + itertools.product(fa_units_lst[0], fa_units_lst[1], fa_units_lst[2]) + ) + fa_df_header_lst = ["FA1", "FA2", "FA3"] + elif lipid_class == "CL" and len(fa_units_lst) == 4: + fa_comb_lst = list( + itertools.product( + fa_units_lst[0], fa_units_lst[1], fa_units_lst[2], fa_units_lst[3] + ) + ) + fa_df_header_lst = ["FA1", "FA2", "FA3", "FA4"] else: fa_comb_lst = [] fa_df_header_lst = [] - # fa_comb_lite_lst = [] - # # sn_comb_rm_lst = [] - # - # print('fa_comb_lst count', len(fa_comb_lst)) - # - # if position is False: - # for _comb in fa_comb_lst: - # # _rev_comb = tuple(sorted(list(_comb))) - # _rev_comb = tuple(natsorted(list(_comb))) - # if _comb not in fa_comb_lite_lst and _rev_comb not in fa_comb_lite_lst: - # fa_comb_lite_lst.append(_comb) - # else: - # pass - # # sn_comb_rm_lst.append(_comb) - # # sn_comb_rm_lst.append(_rev_comb) - # else: - # fa_comb_lite_lst = fa_comb_lst - # - # print('unique fa_comb_lite_lst count', len(fa_comb_lite_lst)) - # - # lipid_comb_dct = {} - # - # if lipid_class in ['PA', 'PC', 'PE', 'PG', 'PI', 'PS', 'DG'] and len(fa_comb_lite_lst) > 0: - # for _comb_lite in fa_comb_lite_lst: - # _lipid_abbr = '{lt}({fa1}_{fa2})'.format(lt=lipid_class, fa1=_comb_lite[0].strip('FA'), - # fa2=_comb_lite[1].strip('FA')) - # lipid_comb_dct[_lipid_abbr] = {'CLASS': lipid_class, 'FA1': _comb_lite[0], 'FA2': _comb_lite[1], - # 'DISCRETE_ABBR': _lipid_abbr} - # elif lipid_class in ['TG'] and len(fa_comb_lite_lst) > 0: - # for _comb_lite in fa_comb_lite_lst: - # _lipid_abbr = '{pl}({fa1}_{fa2}_{fa3})'.format(pl=lipid_class, fa1=_comb_lite[0].strip('FA'), - # fa2=_comb_lite[1].strip('FA'), - # fa3=_comb_lite[2].strip('FA')) - # - # lipid_comb_dct[_lipid_abbr] = {'CLASS': lipid_class, 'FA1': _comb_lite[0], 'FA2': _comb_lite[1], - # 'FA3': _comb_lite[2], 'DISCRETE_ABBR': _lipid_abbr} - # else: - # # TODO (georgia.angelidou@uni-leipzig.de): SM posible composition - # pass - fa_combo_df = pd.DataFrame(data=fa_comb_lst, columns=fa_df_header_lst) - fa_combo_df['CLASS'] = lipid_class + fa_combo_df["CLASS"] = lipid_class - if lipid_class in ['PA', 'PC', 'PE', 'PG', 'PI', 'PS', 'DG', 'SM']: + # Todo: check SM section below: + if lipid_class in ["PA", "PC", "PE", "PG", "PI", "PS", "DG", "SM"]: fa_combo_link_df = fa_combo_df.copy() # fa_combo_link_df.is_copy = False - fa_combo_link_df['LINK'] = fa_combo_link_df['FA1'].str[0:2] - fa_link_df = fa_combo_link_df[fa_combo_link_df['LINK'] == 'FA'].copy() + fa_combo_link_df["LINK"] = fa_combo_link_df["FA1"].str[0:2] + fa_link_df = fa_combo_link_df[fa_combo_link_df["LINK"] == "FA"].copy() # fa_link_df.is_copy = False - fa_link_df.drop(['LINK', 'CLASS'], axis=1, inplace=True) + fa_link_df.drop(["LINK", "CLASS"], axis=1, inplace=True) # fa_link_df.values.argsort(kind='mergesort') # fa_link_df.drop(columns=['CLASS'], inplace=True) - fa_link_df.values.sort(kind='mergesort') # safe sort by numpy - fa_link_df['CLASS'] = lipid_class - fa_link_df['DISCRETE_ABBR'] = (fa_link_df['CLASS'] + '(' + - fa_link_df['FA1'].str.strip('FA') + '_' + - fa_link_df['FA2'].str.strip('FA') + ')') - fa_link_df.sort_values(by='DISCRETE_ABBR', inplace=True) - - if lipid_class in ['PC', 'PE']: - op_link_df = fa_combo_link_df[(fa_combo_link_df['LINK'] == 'O-') - | (fa_combo_link_df['LINK'] == 'P-')].copy() + fa_link_df.values.sort(kind="mergesort") # safe sort by numpy + fa_link_df["CLASS"] = lipid_class + fa_link_df["DISCRETE_ABBR"] = ( + fa_link_df["CLASS"] + + "(" + + fa_link_df["FA1"].str.strip("FA") + + "_" + + fa_link_df["FA2"].str.strip("FA") + + ")" + ) + fa_link_df.sort_values(by="DISCRETE_ABBR", inplace=True) + + if lipid_class in ["PC", "PE"]: + op_link_df = fa_combo_link_df[ + (fa_combo_link_df["LINK"] == "O-") + | (fa_combo_link_df["LINK"] == "P-") + ].copy() if not op_link_df.empty: # op_link_df.is_copy = False - op_link_df.drop(['LINK'], axis=1, inplace=True) - op_link_df['DISCRETE_ABBR'] = (op_link_df['CLASS'] + '(' + - op_link_df['FA1'].str.strip('FA') + '_' + - op_link_df['FA2'].str.strip('FA') + ')') - op_link_df.sort_values(by='DISCRETE_ABBR', inplace=True) + op_link_df.drop(["LINK"], axis=1, inplace=True) + op_link_df["DISCRETE_ABBR"] = ( + op_link_df["CLASS"] + + "(" + + op_link_df["FA1"].str.strip("FA") + + "_" + + op_link_df["FA2"].str.strip("FA") + + ")" + ) + op_link_df.sort_values(by="DISCRETE_ABBR", inplace=True) fa_combo_df = fa_link_df.append(op_link_df) del op_link_df @@ -375,36 +496,46 @@ def gen_all_comb(self, lipid_class, usr_fa_df, position=False): del fa_combo_link_df del fa_link_df - print('[INFO] --> Number of predicted lipids (exact position): ', fa_combo_df.shape[0]) + print( + "[INFO] --> Number of predicted lipids (exact position): ", + fa_combo_df.shape[0], + ) - elif lipid_class in ['LPA', 'LPC', 'LPE', 'LPG', 'LPI', 'LPS']: + elif lipid_class in ["LPA", "LPC", "LPE", "LPG", "LPI", "LPS"]: fa_combo_link_df = fa_combo_df.copy() # fa_combo_link_df.is_copy = False - fa_combo_link_df['LINK'] = fa_combo_link_df['FA1'].str[0:2] - fa_link_df = fa_combo_link_df[fa_combo_link_df['LINK'] == 'FA'].copy() + fa_combo_link_df["LINK"] = fa_combo_link_df["FA1"].str[0:2] + fa_link_df = fa_combo_link_df[fa_combo_link_df["LINK"] == "FA"].copy() # fa_link_df.is_copy = False - fa_link_df.drop(['LINK', 'CLASS'], axis=1, inplace=True) + fa_link_df.drop(["LINK", "CLASS"], axis=1, inplace=True) # fa_link_df.values.argsort(kind='mergesort') # fa_link_df.drop(columns=['CLASS'], inplace=True) # fa_link_df.values.sort(kind='mergesort') # safe sort by numpy - fa_link_df['CLASS'] = lipid_class - - fa_link_df['DISCRETE_ABBR'] = (fa_link_df['CLASS'] + '(' + - fa_link_df['FA1'].str.strip('FA') + ')') - fa_link_df.sort_values(by='DISCRETE_ABBR', inplace=True) - - if lipid_class in ['LPC', 'LPE']: - op_link_df = fa_combo_link_df[(fa_combo_link_df['LINK'] == 'O-') - | (fa_combo_link_df['LINK'] == 'P-')].copy() + fa_link_df["CLASS"] = lipid_class + + fa_link_df["DISCRETE_ABBR"] = ( + fa_link_df["CLASS"] + "(" + fa_link_df["FA1"].str.strip("FA") + ")" + ) + fa_link_df.sort_values(by="DISCRETE_ABBR", inplace=True) + + if lipid_class in ["LPC", "LPE"]: + op_link_df = fa_combo_link_df[ + (fa_combo_link_df["LINK"] == "O-") + | (fa_combo_link_df["LINK"] == "P-") + ].copy() if not op_link_df.empty: # op_link_df.is_copy = False - op_link_df.drop(['LINK'], axis=1, inplace=True) - op_link_df['DISCRETE_ABBR'] = (op_link_df['CLASS'] + '(' + - op_link_df['FA1'].str.strip('FA') + ')') - op_link_df.sort_values(by='DISCRETE_ABBR', inplace=True) + op_link_df.drop(["LINK"], axis=1, inplace=True) + op_link_df["DISCRETE_ABBR"] = ( + op_link_df["CLASS"] + + "(" + + op_link_df["FA1"].str.strip("FA") + + ")" + ) + op_link_df.sort_values(by="DISCRETE_ABBR", inplace=True) fa_combo_df = fa_link_df.append(op_link_df) del op_link_df @@ -413,32 +544,48 @@ def gen_all_comb(self, lipid_class, usr_fa_df, position=False): del fa_combo_link_df del fa_link_df - print('[INFO] --> Number of predicted lipids (exact position): ', fa_combo_df.shape[0]) + print( + "[INFO] --> Number of predicted lipids (exact position): ", + fa_combo_df.shape[0], + ) - elif lipid_class in ['TG']: + elif lipid_class in ["TG"]: fa_combo_link_df = fa_combo_df.copy() # fa_combo_link_df.is_copy = False - fa_combo_link_df['LINK'] = fa_combo_link_df['FA1'].str[0:2] - fa_link_df = fa_combo_link_df[fa_combo_link_df['LINK'] == 'FA'] + fa_combo_link_df["LINK"] = fa_combo_link_df["FA1"].str[0:2] + fa_link_df = fa_combo_link_df[fa_combo_link_df["LINK"] == "FA"] # fa_link_df.is_copy = False - fa_link_df.drop(['LINK'], axis=1, inplace=True) - fa_link_df.values.sort(kind='mergesort') # safe sort by numpy - fa_link_df['DISCRETE_ABBR'] = (fa_link_df['CLASS'] + '(' + - fa_link_df['FA1'].str.strip('FA') + '_' + - fa_link_df['FA2'].str.strip('FA') + '_' + - fa_link_df['FA3'].str.strip('FA') + ')') - fa_link_df.sort_values(by='DISCRETE_ABBR', inplace=True) - op_link_df = fa_combo_link_df[(fa_combo_link_df['LINK'] == 'O-') - | (fa_combo_link_df['LINK'] == 'P-')].copy() + fa_link_df.drop(["LINK"], axis=1, inplace=True) + fa_link_df.values.sort(kind="mergesort") # safe sort by numpy + fa_link_df["DISCRETE_ABBR"] = ( + fa_link_df["CLASS"] + + "(" + + fa_link_df["FA1"].str.strip("FA") + + "_" + + fa_link_df["FA2"].str.strip("FA") + + "_" + + fa_link_df["FA3"].str.strip("FA") + + ")" + ) + fa_link_df.sort_values(by="DISCRETE_ABBR", inplace=True) + op_link_df = fa_combo_link_df[ + (fa_combo_link_df["LINK"] == "O-") | (fa_combo_link_df["LINK"] == "P-") + ].copy() if not op_link_df.empty: # op_link_df.is_copy = False - op_link_df.drop(['LINK'], axis=1, inplace=True) - op_link_df['DISCRETE_ABBR'] = (op_link_df['CLASS'] + '(' + - op_link_df['FA1'].str.strip('FA') + '_' + - op_link_df['FA2'].str.strip('FA') + '_' + - op_link_df['FA3'].str.strip('FA') + ')') - op_link_df.sort_values(by='DISCRETE_ABBR', inplace=True) + op_link_df.drop(["LINK"], axis=1, inplace=True) + op_link_df["DISCRETE_ABBR"] = ( + op_link_df["CLASS"] + + "(" + + op_link_df["FA1"].str.strip("FA") + + "_" + + op_link_df["FA2"].str.strip("FA") + + "_" + + op_link_df["FA3"].str.strip("FA") + + ")" + ) + op_link_df.sort_values(by="DISCRETE_ABBR", inplace=True) fa_combo_df = fa_link_df.append(op_link_df) del op_link_df else: @@ -446,43 +593,64 @@ def gen_all_comb(self, lipid_class, usr_fa_df, position=False): del fa_link_df del fa_combo_link_df - print('[INFO] --> Number of predicted lipids (exact position): ', fa_combo_df.shape[0]) - - elif lipid_class in ['CL']: - fa_combo_df.values.sort(kind='mergesort') # safe sort by numpy - print('[INFO] --> Number of predicted lipids (exact position): ', fa_combo_df.shape[0]) - fa_combo_df['DISCRETE_ABBR'] = (fa_combo_df['CLASS'] + '(' + - fa_combo_df['FA1'].str.strip('FA') + '_' + - fa_combo_df['FA2'].str.strip('FA') + '_' + - fa_combo_df['FA3'].str.strip('FA') + '_' + - fa_combo_df['FA4'].str.strip('FA') + ')') - fa_combo_df.sort_values(by='DISCRETE_ABBR', inplace=True) - print('[INFO] --> Number of predicted lipids (exact position): ', fa_combo_df.shape[0]) + print( + "[INFO] --> Number of predicted lipids (exact position): ", + fa_combo_df.shape[0], + ) + + elif lipid_class in ["CL"]: + fa_combo_df.values.sort(kind="mergesort") # safe sort by numpy + print( + "[INFO] --> Number of predicted lipids (exact position): ", + fa_combo_df.shape[0], + ) + fa_combo_df["DISCRETE_ABBR"] = ( + fa_combo_df["CLASS"] + + "(" + + fa_combo_df["FA1"].str.strip("FA") + + "_" + + fa_combo_df["FA2"].str.strip("FA") + + "_" + + fa_combo_df["FA3"].str.strip("FA") + + "_" + + fa_combo_df["FA4"].str.strip("FA") + + ")" + ) + fa_combo_df.sort_values(by="DISCRETE_ABBR", inplace=True) + print( + "[INFO] --> Number of predicted lipids (exact position): ", + fa_combo_df.shape[0], + ) else: - fa_combo_df['DISCRETE_ABBR'] = '' - print('[WARNING] !!! Number of predicted lipids (exact position): 0') + fa_combo_df["DISCRETE_ABBR"] = "" + print("[WARNING] !!! Number of predicted lipids (exact position): 0") if position is False: - print('[INFO] --> Use discrete form for identification ...') - fa_combo_lite_df = fa_combo_df.drop_duplicates(subset=['DISCRETE_ABBR'], keep='first').copy() - print('[INFO] --> Number of predicted lipids (discrete form): ', fa_combo_lite_df.shape[0]) + print("[INFO] --> Use discrete form for identification ...") + fa_combo_lite_df = fa_combo_df.drop_duplicates( + subset=["DISCRETE_ABBR"], keep="first" + ).copy() + print( + "[INFO] --> Number of predicted lipids (discrete form): ", + fa_combo_lite_df.shape[0], + ) else: fa_combo_lite_df = fa_combo_df.copy() # fa_combo_lite_df.is_copy = False - fa_combo_lite_df['idx'] = fa_combo_lite_df['DISCRETE_ABBR'] - fa_combo_lite_df.set_index('idx', drop=True, inplace=True) + fa_combo_lite_df["idx"] = fa_combo_lite_df["DISCRETE_ABBR"] + fa_combo_lite_df.set_index("idx", drop=True, inplace=True) - lipid_comb_dct = fa_combo_lite_df.to_dict(orient='index') + lipid_comb_dct = fa_combo_lite_df.to_dict(orient="index") return lipid_comb_dct @staticmethod - def calc_fragments(lipid_dct, charge='', ms2_ppm=100): + def calc_fragments(lipid_dct, charge="", ms2_ppm=100): # m_formula = lipid_dct['FORMULA'] - m_exactmass = lipid_dct['EXACTMASS'] - m_class = lipid_dct['CLASS'] + m_exactmass = lipid_dct["EXACTMASS"] + m_class = lipid_dct["CLASS"] h_exactmass = 1.0078250321 na_exactmass = 22.98976967 @@ -490,249 +658,405 @@ def calc_fragments(lipid_dct, charge='', ms2_ppm=100): ch3_exactmass = 12.0 + 3 * 1.0078250321 nl_water = 2 * 1.0078250321 + 15.9949146221 gly_mg_base_exactmass = 3 * 12.0 + 5 * 1.0078250321 + 15.9949146221 - fa1_abbr = lipid_dct['FA1'].strip('FA') - fa2_abbr = lipid_dct['FA2'].strip('FA') - - fa1_exactmass = lipid_dct['FA1_EXACTMASS'] - if 'FA2_EXACTMASS' in list(lipid_dct.keys()): - fa2_exactmass = lipid_dct['FA2_EXACTMASS'] + fa1_abbr = lipid_dct["FA1"].strip("FA") + fa2_abbr = lipid_dct["FA2"].strip("FA") - if m_class in ['PA', 'PE', 'PG', 'PI', 'PS', 'PIP', 'PL']: + fa1_exactmass = lipid_dct["FA1_EXACTMASS"] + if "FA2_EXACTMASS" in list(lipid_dct.keys()): + fa2_exactmass = lipid_dct["FA2_EXACTMASS"] - lyso_str = 'L' + m_class + if m_class in ["PA", "PE", "PG", "PI", "PS", "PIP", "PL"]: + lyso_str = "L" + m_class # create the abbreviation name for the Lyso fragments eg. LPE(18:0)-H]-_ABBR # without the loss of water - lipid_dct['[LPL(FA1)-H]-_ABBR'] = '[%s(%s)-H]-' % (lyso_str, fa1_abbr) - lipid_dct['[LPL(FA2)-H]-_ABBR'] = '[%s(%s)-H]-' % (lyso_str, fa2_abbr) + lipid_dct["[LPL(FA1)-H]-_ABBR"] = "[%s(%s)-H]-" % (lyso_str, fa1_abbr) + lipid_dct["[LPL(FA2)-H]-_ABBR"] = "[%s(%s)-H]-" % (lyso_str, fa2_abbr) # with the loss of water - lipid_dct['[LPL(FA1)-H2O-H]-_ABBR'] = '[%s(%s)-H2O-H]-' % (lyso_str, fa1_abbr) - lipid_dct['[LPL(FA2)-H2O-H]-_ABBR'] = '[%s(%s)-H2O-H]-' % (lyso_str, fa2_abbr) + lipid_dct["[LPL(FA1)-H2O-H]-_ABBR"] = "[%s(%s)-H2O-H]-" % ( + lyso_str, + fa1_abbr, + ) + lipid_dct["[LPL(FA2)-H2O-H]-_ABBR"] = "[%s(%s)-H2O-H]-" % ( + lyso_str, + fa2_abbr, + ) # calculation of the exact mass for the different lyso fragments - lipid_dct['[LPL(FA1)-H]-_MZ'] = round(m_exactmass - (fa2_exactmass - nl_water) - h_exactmass, 6) - lipid_dct['[LPL(FA2)-H]-_MZ'] = round(m_exactmass - (fa1_exactmass - nl_water) - h_exactmass, 6) - lipid_dct['[LPL(FA1)-H2O-H]-_MZ'] = round(m_exactmass - fa2_exactmass - h_exactmass, 6) - lipid_dct['[LPL(FA2)-H2O-H]-_MZ'] = round(m_exactmass - fa1_exactmass - h_exactmass, 6) - - elif m_class in ['PC']: - - lyso_str = 'L' + m_class + lipid_dct["[LPL(FA1)-H]-_MZ"] = round( + m_exactmass - (fa2_exactmass - nl_water) - h_exactmass, 6 + ) + lipid_dct["[LPL(FA2)-H]-_MZ"] = round( + m_exactmass - (fa1_exactmass - nl_water) - h_exactmass, 6 + ) + lipid_dct["[LPL(FA1)-H2O-H]-_MZ"] = round( + m_exactmass - fa2_exactmass - h_exactmass, 6 + ) + lipid_dct["[LPL(FA2)-H2O-H]-_MZ"] = round( + m_exactmass - fa1_exactmass - h_exactmass, 6 + ) + + # Todo: Add SM section here and check + elif m_class in ["PC", "SM"]: + + lyso_str = "L" + m_class # The abbr. here is not exactly correct due to the compatibility issues with ranks core calc functions - lipid_dct['[LPL(FA1)-H]-_ABBR'] = '[%s(%s)-CH3]-' % (lyso_str, fa1_abbr) - lipid_dct['[LPL(FA2)-H]-_ABBR'] = '[%s(%s)-CH3]-' % (lyso_str, fa2_abbr) - lipid_dct['[LPL(FA1)-H2O-H]-_ABBR'] = '[%s(%s)-H2O-CH3]-' % (lyso_str, fa1_abbr) - lipid_dct['[LPL(FA2)-H2O-H]-_ABBR'] = '[%s(%s)-H2O-CH3]-' % (lyso_str, fa2_abbr) - - lipid_dct['[LPL(FA1)-H]-_MZ'] = round(m_exactmass - (fa2_exactmass - nl_water) - ch3_exactmass, 6) - lipid_dct['[LPL(FA2)-H]-_MZ'] = round(m_exactmass - (fa1_exactmass - nl_water) - ch3_exactmass, 6) - lipid_dct['[LPL(FA1)-H2O-H]-_MZ'] = round(m_exactmass - fa2_exactmass - ch3_exactmass, 6) - lipid_dct['[LPL(FA2)-H2O-H]-_MZ'] = round(m_exactmass - fa1_exactmass - ch3_exactmass, 6) - - elif m_class in ['LPA', 'LPE', 'LPG', 'LPI', 'LPS', 'LPIP', 'LPL']: + lipid_dct["[LPL(FA1)-H]-_ABBR"] = "[%s(%s)-CH3]-" % (lyso_str, fa1_abbr) + lipid_dct["[LPL(FA2)-H]-_ABBR"] = "[%s(%s)-CH3]-" % (lyso_str, fa2_abbr) + lipid_dct["[LPL(FA1)-H2O-H]-_ABBR"] = "[%s(%s)-H2O-CH3]-" % ( + lyso_str, + fa1_abbr, + ) + lipid_dct["[LPL(FA2)-H2O-H]-_ABBR"] = "[%s(%s)-H2O-CH3]-" % ( + lyso_str, + fa2_abbr, + ) + + lipid_dct["[LPL(FA1)-H]-_MZ"] = round( + m_exactmass - (fa2_exactmass - nl_water) - ch3_exactmass, 6 + ) + lipid_dct["[LPL(FA2)-H]-_MZ"] = round( + m_exactmass - (fa1_exactmass - nl_water) - ch3_exactmass, 6 + ) + lipid_dct["[LPL(FA1)-H2O-H]-_MZ"] = round( + m_exactmass - fa2_exactmass - ch3_exactmass, 6 + ) + lipid_dct["[LPL(FA2)-H2O-H]-_MZ"] = round( + m_exactmass - fa1_exactmass - ch3_exactmass, 6 + ) + + elif m_class in ["LPA", "LPE", "LPG", "LPI", "LPS", "LPIP", "LPL"]: pass - elif m_class in ['LPC']: + elif m_class in ["LPC"]: pass - elif m_class in ['TG']: + elif m_class in ["TG"]: # Here maybe should get the DG fragments # TODO(georgia.angelidou@uni-leipzig.de): create the section for theuniue fragments when there is TG # Missing the fragments for the sodium adduct # The different frgments for triacylglycerol names when neutral loss of the FA # Take the correspond information of the 3 FA - fa3_abbr = lipid_dct['FA3'].strip('FA') - fa3_exactmass = lipid_dct['FA3_EXACTMASS'] - dg_str = 'M' - if charge in ['[M+Na]+']: - fa1_Na_exactmass = lipid_dct['FA1_[FA-H+Na]_MZ'] - fa2_Na_exactmass = lipid_dct['FA2_[FA-H+Na]_MZ'] - fa3_Na_exactmass = lipid_dct['FA3_[FA-H+Na]_MZ'] - - lipid_dct['[M-(FA1)+Na]+_ABBR'] = '[%s-FA%s+Na]+' % (dg_str, fa1_abbr) - lipid_dct['[M-(FA2)+Na]+_ABBR'] = '[%s-FA%s+Na]+' % (dg_str, fa2_abbr) - lipid_dct['[M-(FA3)+Na]+_ABBR'] = '[%s-FA%s+Na]+' % (dg_str, fa3_abbr) - - lipid_dct['[M-(FA1-H+Na)+H]+_ABBR'] = '[%s-(FA%s-H+Na)+H]+' % (dg_str, fa1_abbr) - lipid_dct['[M-(FA2-H+Na)+H]+_ABBR'] = '[%s-(FA%s-H+Na)+H]+' % (dg_str, fa2_abbr) - lipid_dct['[M-(FA3-H+Na)+H]+_ABBR'] = '[%s-(FA%s-H+Na)+H]+' % (dg_str, fa3_abbr) - - lipid_dct['[M-(FA1)+Na]+_MZ'] = round(m_exactmass - fa1_exactmass + na_exactmass, 6) - lipid_dct['[M-(FA2)+Na]+_MZ'] = round(m_exactmass - fa2_exactmass + na_exactmass, 6) - lipid_dct['[M-(FA3)+Na]+_MZ'] = round(m_exactmass - fa3_exactmass + na_exactmass, 6) - - lipid_dct['[M-(FA1-H+Na)+H]+_MZ'] = round(m_exactmass - fa1_Na_exactmass + na_exactmass, 6) - lipid_dct['[M-(FA2-H+Na)+H]+_MZ'] = round(m_exactmass - fa2_Na_exactmass + na_exactmass, 6) - lipid_dct['[M-(FA3-H+Na)+H]+_MZ'] = round(m_exactmass - fa3_Na_exactmass + na_exactmass, 6) - - lipid_dct['[M-(FA1)+Na]+_MZ_LOW'] = ppm_window_para((m_exactmass - (fa1_exactmass) + na_exactmass), - ms2_ppm * -1) - lipid_dct['[M-(FA1)+Na]+_MZ_HIGH'] = ppm_window_para((m_exactmass - (fa1_exactmass) + na_exactmass), - ms2_ppm) - lipid_dct['[M-(FA1)+Na]+_Q'] = ( - lipid_dct['[M-(FA1)+Na]+_MZ_LOW'].astype(str) + ' <= mz <= ' + lipid_dct[ - '[M-(FA1)+Na]+_MZ_HIGH'].astype(str)) - - lipid_dct['[M-(FA2)+Na]+_MZ_LOW'] = ppm_window_para((m_exactmass - (fa2_exactmass) + na_exactmass), - ms2_ppm * -1) - lipid_dct['[M-(FA2)+Na]+_MZ_HIGH'] = ppm_window_para((m_exactmass - (fa2_exactmass) + na_exactmass), - ms2_ppm) - lipid_dct['[M-(FA2)+Na]+_Q'] = ( - lipid_dct['[M-(FA2)+Na]+_MZ_LOW'].astype(str) + ' <= mz <= ' + lipid_dct[ - '[M-(FA2)+Na]+_MZ_HIGH'].astype(str)) - - lipid_dct['[M-(FA3)+Na]+_MZ_LOW'] = ppm_window_para((m_exactmass - (fa3_exactmass) + na_exactmass), - ms2_ppm * -1) - lipid_dct['[M-(FA3)+Na]+_MZ_HIGH'] = ppm_window_para((m_exactmass - (fa3_exactmass) + na_exactmass), - ms2_ppm) - lipid_dct['[M-(FA3)+Na]+_Q'] = ( - lipid_dct['[M-(FA3)+Na]+_MZ_LOW'].astype(str) + ' <= mz <= ' + lipid_dct[ - '[M-(FA3)+Na]+_MZ_HIGH'].astype(str)) - - lipid_dct['[M-(FA1-H+Na)+H]+_MZ_LOW'] = ppm_window_para( - (m_exactmass - (fa1_Na_exactmass) + na_exactmass), ms2_ppm * -1) - lipid_dct['[M-(FA1-H+Na)+H]+_MZ_HIGH'] = ppm_window_para( - (m_exactmass - (fa1_Na_exactmass) + na_exactmass), ms2_ppm) - lipid_dct['[M-(FA1-H+Na)+H]+_Q'] = ( - lipid_dct['[M-(FA1-H+Na)+H]+_MZ_LOW'].astype(str) + ' <= mz <= ' + lipid_dct[ - '[M-(FA1-H+Na)+H]+_MZ_HIGH'].astype(str)) - - lipid_dct['[M-(FA2-H+Na)+H]+_MZ_LOW'] = ppm_window_para( - (m_exactmass - (fa2_Na_exactmass) + na_exactmass), ms2_ppm * -1) - lipid_dct['[M-(FA2-H+Na)+H]+_MZ_HIGH'] = ppm_window_para( - (m_exactmass - (fa2_Na_exactmass) + na_exactmass), ms2_ppm) - lipid_dct['[M-(FA2-H+Na)+H]+_Q'] = ( - lipid_dct['[M-(FA2-H+Na)+H]+_MZ_LOW'].astype(str) + ' <= mz <= ' + lipid_dct[ - '[M-(FA2-H+Na)+H]+_MZ_HIGH'].astype(str)) - - lipid_dct['[M-(FA3-H+Na)+H]+_MZ_LOW'] = ppm_window_para( - (m_exactmass - (fa3_Na_exactmass) + na_exactmass), ms2_ppm * -1) - lipid_dct['[M-(FA3-H+Na)+H]+_MZ_HIGH'] = ppm_window_para( - (m_exactmass - (fa3_Na_exactmass) + na_exactmass), ms2_ppm) - lipid_dct['[M-(FA3-H+Na)+H]+_Q'] = ( - lipid_dct['[M-(FA3-H+Na)+H]+_MZ_LOW'].astype(str) + ' <= mz <= ' + lipid_dct[ - '[M-(FA3-H+Na)+H]+_MZ_HIGH'].astype(str)) + fa3_abbr = lipid_dct["FA3"].strip("FA") + fa3_exactmass = lipid_dct["FA3_EXACTMASS"] + dg_str = "M" + if charge in ["[M+Na]+"]: + fa1_Na_exactmass = lipid_dct["FA1_[FA-H+Na]_MZ"] + fa2_Na_exactmass = lipid_dct["FA2_[FA-H+Na]_MZ"] + fa3_Na_exactmass = lipid_dct["FA3_[FA-H+Na]_MZ"] + + lipid_dct["[M-(FA1)+Na]+_ABBR"] = "[%s-FA%s+Na]+" % (dg_str, fa1_abbr) + lipid_dct["[M-(FA2)+Na]+_ABBR"] = "[%s-FA%s+Na]+" % (dg_str, fa2_abbr) + lipid_dct["[M-(FA3)+Na]+_ABBR"] = "[%s-FA%s+Na]+" % (dg_str, fa3_abbr) + + lipid_dct["[M-(FA1-H+Na)+H]+_ABBR"] = "[%s-(FA%s-H+Na)+H]+" % ( + dg_str, + fa1_abbr, + ) + lipid_dct["[M-(FA2-H+Na)+H]+_ABBR"] = "[%s-(FA%s-H+Na)+H]+" % ( + dg_str, + fa2_abbr, + ) + lipid_dct["[M-(FA3-H+Na)+H]+_ABBR"] = "[%s-(FA%s-H+Na)+H]+" % ( + dg_str, + fa3_abbr, + ) + + lipid_dct["[M-(FA1)+Na]+_MZ"] = round( + m_exactmass - fa1_exactmass + na_exactmass, 6 + ) + lipid_dct["[M-(FA2)+Na]+_MZ"] = round( + m_exactmass - fa2_exactmass + na_exactmass, 6 + ) + lipid_dct["[M-(FA3)+Na]+_MZ"] = round( + m_exactmass - fa3_exactmass + na_exactmass, 6 + ) + + lipid_dct["[M-(FA1-H+Na)+H]+_MZ"] = round( + m_exactmass - fa1_Na_exactmass + na_exactmass, 6 + ) + lipid_dct["[M-(FA2-H+Na)+H]+_MZ"] = round( + m_exactmass - fa2_Na_exactmass + na_exactmass, 6 + ) + lipid_dct["[M-(FA3-H+Na)+H]+_MZ"] = round( + m_exactmass - fa3_Na_exactmass + na_exactmass, 6 + ) + + lipid_dct["[M-(FA1)+Na]+_MZ_LOW"] = ppm_window_para( + (m_exactmass - (fa1_exactmass) + na_exactmass), ms2_ppm * -1 + ) + lipid_dct["[M-(FA1)+Na]+_MZ_HIGH"] = ppm_window_para( + (m_exactmass - (fa1_exactmass) + na_exactmass), ms2_ppm + ) + lipid_dct["[M-(FA1)+Na]+_Q"] = ( + lipid_dct["[M-(FA1)+Na]+_MZ_LOW"].astype(str) + + " <= mz <= " + + lipid_dct["[M-(FA1)+Na]+_MZ_HIGH"].astype(str) + ) + + lipid_dct["[M-(FA2)+Na]+_MZ_LOW"] = ppm_window_para( + (m_exactmass - (fa2_exactmass) + na_exactmass), ms2_ppm * -1 + ) + lipid_dct["[M-(FA2)+Na]+_MZ_HIGH"] = ppm_window_para( + (m_exactmass - (fa2_exactmass) + na_exactmass), ms2_ppm + ) + lipid_dct["[M-(FA2)+Na]+_Q"] = ( + lipid_dct["[M-(FA2)+Na]+_MZ_LOW"].astype(str) + + " <= mz <= " + + lipid_dct["[M-(FA2)+Na]+_MZ_HIGH"].astype(str) + ) + + lipid_dct["[M-(FA3)+Na]+_MZ_LOW"] = ppm_window_para( + (m_exactmass - (fa3_exactmass) + na_exactmass), ms2_ppm * -1 + ) + lipid_dct["[M-(FA3)+Na]+_MZ_HIGH"] = ppm_window_para( + (m_exactmass - (fa3_exactmass) + na_exactmass), ms2_ppm + ) + lipid_dct["[M-(FA3)+Na]+_Q"] = ( + lipid_dct["[M-(FA3)+Na]+_MZ_LOW"].astype(str) + + " <= mz <= " + + lipid_dct["[M-(FA3)+Na]+_MZ_HIGH"].astype(str) + ) + + lipid_dct["[M-(FA1-H+Na)+H]+_MZ_LOW"] = ppm_window_para( + (m_exactmass - (fa1_Na_exactmass) + na_exactmass), ms2_ppm * -1 + ) + lipid_dct["[M-(FA1-H+Na)+H]+_MZ_HIGH"] = ppm_window_para( + (m_exactmass - (fa1_Na_exactmass) + na_exactmass), ms2_ppm + ) + lipid_dct["[M-(FA1-H+Na)+H]+_Q"] = ( + lipid_dct["[M-(FA1-H+Na)+H]+_MZ_LOW"].astype(str) + + " <= mz <= " + + lipid_dct["[M-(FA1-H+Na)+H]+_MZ_HIGH"].astype(str) + ) + + lipid_dct["[M-(FA2-H+Na)+H]+_MZ_LOW"] = ppm_window_para( + (m_exactmass - (fa2_Na_exactmass) + na_exactmass), ms2_ppm * -1 + ) + lipid_dct["[M-(FA2-H+Na)+H]+_MZ_HIGH"] = ppm_window_para( + (m_exactmass - (fa2_Na_exactmass) + na_exactmass), ms2_ppm + ) + lipid_dct["[M-(FA2-H+Na)+H]+_Q"] = ( + lipid_dct["[M-(FA2-H+Na)+H]+_MZ_LOW"].astype(str) + + " <= mz <= " + + lipid_dct["[M-(FA2-H+Na)+H]+_MZ_HIGH"].astype(str) + ) + + lipid_dct["[M-(FA3-H+Na)+H]+_MZ_LOW"] = ppm_window_para( + (m_exactmass - (fa3_Na_exactmass) + na_exactmass), ms2_ppm * -1 + ) + lipid_dct["[M-(FA3-H+Na)+H]+_MZ_HIGH"] = ppm_window_para( + (m_exactmass - (fa3_Na_exactmass) + na_exactmass), ms2_ppm + ) + lipid_dct["[M-(FA3-H+Na)+H]+_Q"] = ( + lipid_dct["[M-(FA3-H+Na)+H]+_MZ_LOW"].astype(str) + + " <= mz <= " + + lipid_dct["[M-(FA3-H+Na)+H]+_MZ_HIGH"].astype(str) + ) else: # Neutral loss of a FA with a water - lipid_dct['[M-(FA1)+H]+_ABBR'] = '[%s-FA%s+H]+' % (dg_str, fa1_abbr) - lipid_dct['[M-(FA2)+H]+_ABBR'] = '[%s-FA%s+H]+' % (dg_str, fa2_abbr) - lipid_dct['[M-(FA3)+H]+_ABBR'] = '[%s-FA%s+H]+' % (dg_str, fa3_abbr) + lipid_dct["[M-(FA1)+H]+_ABBR"] = "[%s-FA%s+H]+" % (dg_str, fa1_abbr) + lipid_dct["[M-(FA2)+H]+_ABBR"] = "[%s-FA%s+H]+" % (dg_str, fa2_abbr) + lipid_dct["[M-(FA3)+H]+_ABBR"] = "[%s-FA%s+H]+" % (dg_str, fa3_abbr) # Neutral loss of a FA minus a water - lipid_dct['[M-(FA1-H2O)+H]+_ABBR'] = '[%s-(FA%s-H2O)+H]+' % (dg_str, fa1_abbr) - lipid_dct['[M-(FA2-H2O)+H]+_ABBR'] = '[%s-(FA%s-H2O)+H]+' % (dg_str, fa2_abbr) - lipid_dct['[M-(FA3-H2O)+H]+_ABBR'] = '[%s-(FA%s-H2O)+H]+' % (dg_str, fa3_abbr) - - lipid_dct['[M-(FA1)+H]+_MZ'] = round(m_exactmass - fa1_exactmass + h_exactmass, 6) - lipid_dct['[M-(FA2)+H]+_MZ'] = round(m_exactmass - fa2_exactmass + h_exactmass, 6) - lipid_dct['[M-(FA3)+H]+_MZ'] = round(m_exactmass - fa3_exactmass + h_exactmass, 6) - - lipid_dct['[M-(FA1-H2O)+H]+_MZ'] = round(m_exactmass - (fa1_exactmass - nl_water) + h_exactmass, 6) - lipid_dct['[M-(FA2-H2O)+H]+_MZ'] = round(m_exactmass - (fa2_exactmass - nl_water) + h_exactmass, 6) - lipid_dct['[M-(FA3-H2O)+H]+_MZ'] = round(m_exactmass - (fa3_exactmass - nl_water) + h_exactmass, 6) - - lipid_dct['[MG(FA1)-H2O+H]+_MZ_LOW'] = ppm_window_para((fa1_exactmass + gly_mg_base_exactmass), - ms2_ppm * -1) - lipid_dct['[MG(FA1)-H2O+H]+_MZ_HIGH'] = ppm_window_para((fa1_exactmass + gly_mg_base_exactmass), - ms2_ppm) - lipid_dct['[MG(FA1)-H2O+H]+_Q'] = ( - lipid_dct['[MG(FA1)-H2O+H]+_MZ_LOW'].astype(str) + ' <= mz <= ' + - lipid_dct['[MG(FA1)-H2O+H]+_MZ_HIGH'].astype(str)) - - lipid_dct['[MG(FA2)-H2O+H]+_MZ_LOW'] = ppm_window_para((fa2_exactmass + gly_mg_base_exactmass), - ms2_ppm * -1) - lipid_dct['[MG(FA2)-H2O+H]+_MZ_HIGH'] = ppm_window_para((fa2_exactmass + gly_mg_base_exactmass), - ms2_ppm) - lipid_dct['[MG(FA2)-H2O+H]+_Q'] = ( - lipid_dct['[MG(FA2)-H2O+H]+_MZ_LOW'].astype(str) + ' <= mz <= ' + - lipid_dct['[MG(FA2)-H2O+H]+_MZ_HIGH'].astype(str)) - - lipid_dct['[MG(FA3)-H2O+H]+_MZ_LOW'] = ppm_window_para((fa3_exactmass + gly_mg_base_exactmass), - ms2_ppm * -1) - lipid_dct['[MG(FA3)-H2O+H]+_MZ_HIGH'] = ppm_window_para((fa3_exactmass + gly_mg_base_exactmass), - ms2_ppm) - lipid_dct['[MG(FA3)-H2O+H]+_Q'] = ( - lipid_dct['[MG(FA3)-H2O+H]+_MZ_LOW'].astype(str) + ' <= mz <= ' + - lipid_dct['[MG(FA3)-H2O+H]+_MZ_HIGH'].astype(str)) - - lipid_dct['[M-(FA1)+H]+_MZ_LOW'] = ppm_window_para((m_exactmass - fa1_exactmass + h_exactmass), - ms2_ppm * -1) - lipid_dct['[M-(FA1)+H]+_MZ_HIGH'] = ppm_window_para((m_exactmass - fa1_exactmass + h_exactmass), - ms2_ppm) - lipid_dct['[M-(FA1)+H]+_Q'] = (lipid_dct['[M-(FA1)+H]+_MZ_LOW'].astype(str) + ' <= mz <= ' + lipid_dct[ - '[M-(FA1)+H]+_MZ_HIGH'].astype(str)) - - lipid_dct['[M-(FA2)+H]+_MZ_LOW'] = ppm_window_para((m_exactmass - fa2_exactmass + h_exactmass), - ms2_ppm * -1) - lipid_dct['[M-(FA2)+H]+_MZ_HIGH'] = ppm_window_para((m_exactmass - fa2_exactmass + h_exactmass), - ms2_ppm) - lipid_dct['[M-(FA2)+H]+_Q'] = (lipid_dct['[M-(FA2)+H]+_MZ_LOW'].astype(str) + ' <= mz <= ' + lipid_dct[ - '[M-(FA2)+H]+_MZ_HIGH'].astype(str)) - - lipid_dct['[M-(FA3)+H]+_MZ_LOW'] = ppm_window_para((m_exactmass - fa3_exactmass + h_exactmass), - ms2_ppm * -1) - lipid_dct['[M-(FA3)+H]+_MZ_HIGH'] = ppm_window_para((m_exactmass - fa3_exactmass + h_exactmass), - ms2_ppm) - lipid_dct['[M-(FA3)+H]+_Q'] = (lipid_dct['[M-(FA3)+H]+_MZ_LOW'].astype(str) + ' <= mz <= ' + lipid_dct[ - '[M-(FA3)+H]+_MZ_HIGH'].astype(str)) - - lipid_dct['[M-(FA1-H2O)+H]+_MZ_LOW'] = ppm_window_para( - (m_exactmass - (fa1_exactmass - nl_water) + h_exactmass), ms2_ppm * -1) - lipid_dct['[M-(FA1-H2O)+H]+_MZ_HIGH'] = ppm_window_para( - (m_exactmass - (fa1_exactmass - nl_water) + h_exactmass), ms2_ppm) - lipid_dct['[M-(FA1-H2O)+H]+_Q'] = ( - lipid_dct['[M-(FA1-H2O)+H]+_MZ_LOW'].astype(str) + ' <= mz <= ' + lipid_dct[ - '[M-(FA1-H2O)+H]+_MZ_HIGH'].astype(str)) - - lipid_dct['[M-(FA2-H2O)+H]+_MZ_LOW'] = ppm_window_para( - (m_exactmass - (fa2_exactmass - nl_water) + h_exactmass), ms2_ppm * -1) - lipid_dct['[M-(FA2-H2O)+H]+_MZ_HIGH'] = ppm_window_para( - (m_exactmass - (fa2_exactmass - nl_water) + h_exactmass), ms2_ppm) - lipid_dct['[M-(FA2-H2O)+H]+_Q'] = ( - lipid_dct['[M-(FA2-H2O)+H]+_MZ_LOW'].astype(str) + ' <= mz <= ' + lipid_dct[ - '[M-(FA2-H2O)+H]+_MZ_HIGH'].astype(str)) - - lipid_dct['[M-(FA3-H2O)+H]+_MZ_LOW'] = ppm_window_para( - (m_exactmass - (fa3_exactmass - nl_water) + h_exactmass), ms2_ppm * -1) - lipid_dct['[M-(FA3-H2O)+H]+_MZ_HIGH'] = ppm_window_para( - (m_exactmass - (fa3_exactmass - nl_water) + h_exactmass), ms2_ppm) - lipid_dct['[M-(FA3-H2O)+H]+_Q'] = ( - lipid_dct['[M-(FA3-H2O)+H]+_MZ_LOW'].astype(str) + ' <= mz <= ' + lipid_dct[ - '[M-(FA3-H2O)+H]+_MZ_HIGH'].astype(str)) + lipid_dct["[M-(FA1-H2O)+H]+_ABBR"] = "[%s-(FA%s-H2O)+H]+" % ( + dg_str, + fa1_abbr, + ) + lipid_dct["[M-(FA2-H2O)+H]+_ABBR"] = "[%s-(FA%s-H2O)+H]+" % ( + dg_str, + fa2_abbr, + ) + lipid_dct["[M-(FA3-H2O)+H]+_ABBR"] = "[%s-(FA%s-H2O)+H]+" % ( + dg_str, + fa3_abbr, + ) + + lipid_dct["[M-(FA1)+H]+_MZ"] = round( + m_exactmass - fa1_exactmass + h_exactmass, 6 + ) + lipid_dct["[M-(FA2)+H]+_MZ"] = round( + m_exactmass - fa2_exactmass + h_exactmass, 6 + ) + lipid_dct["[M-(FA3)+H]+_MZ"] = round( + m_exactmass - fa3_exactmass + h_exactmass, 6 + ) + + lipid_dct["[M-(FA1-H2O)+H]+_MZ"] = round( + m_exactmass - (fa1_exactmass - nl_water) + h_exactmass, 6 + ) + lipid_dct["[M-(FA2-H2O)+H]+_MZ"] = round( + m_exactmass - (fa2_exactmass - nl_water) + h_exactmass, 6 + ) + lipid_dct["[M-(FA3-H2O)+H]+_MZ"] = round( + m_exactmass - (fa3_exactmass - nl_water) + h_exactmass, 6 + ) + + lipid_dct["[MG(FA1)-H2O+H]+_MZ_LOW"] = ppm_window_para( + (fa1_exactmass + gly_mg_base_exactmass), ms2_ppm * -1 + ) + lipid_dct["[MG(FA1)-H2O+H]+_MZ_HIGH"] = ppm_window_para( + (fa1_exactmass + gly_mg_base_exactmass), ms2_ppm + ) + lipid_dct["[MG(FA1)-H2O+H]+_Q"] = ( + lipid_dct["[MG(FA1)-H2O+H]+_MZ_LOW"].astype(str) + + " <= mz <= " + + lipid_dct["[MG(FA1)-H2O+H]+_MZ_HIGH"].astype(str) + ) + + lipid_dct["[MG(FA2)-H2O+H]+_MZ_LOW"] = ppm_window_para( + (fa2_exactmass + gly_mg_base_exactmass), ms2_ppm * -1 + ) + lipid_dct["[MG(FA2)-H2O+H]+_MZ_HIGH"] = ppm_window_para( + (fa2_exactmass + gly_mg_base_exactmass), ms2_ppm + ) + lipid_dct["[MG(FA2)-H2O+H]+_Q"] = ( + lipid_dct["[MG(FA2)-H2O+H]+_MZ_LOW"].astype(str) + + " <= mz <= " + + lipid_dct["[MG(FA2)-H2O+H]+_MZ_HIGH"].astype(str) + ) + + lipid_dct["[MG(FA3)-H2O+H]+_MZ_LOW"] = ppm_window_para( + (fa3_exactmass + gly_mg_base_exactmass), ms2_ppm * -1 + ) + lipid_dct["[MG(FA3)-H2O+H]+_MZ_HIGH"] = ppm_window_para( + (fa3_exactmass + gly_mg_base_exactmass), ms2_ppm + ) + lipid_dct["[MG(FA3)-H2O+H]+_Q"] = ( + lipid_dct["[MG(FA3)-H2O+H]+_MZ_LOW"].astype(str) + + " <= mz <= " + + lipid_dct["[MG(FA3)-H2O+H]+_MZ_HIGH"].astype(str) + ) + + lipid_dct["[M-(FA1)+H]+_MZ_LOW"] = ppm_window_para( + (m_exactmass - fa1_exactmass + h_exactmass), ms2_ppm * -1 + ) + lipid_dct["[M-(FA1)+H]+_MZ_HIGH"] = ppm_window_para( + (m_exactmass - fa1_exactmass + h_exactmass), ms2_ppm + ) + lipid_dct["[M-(FA1)+H]+_Q"] = ( + lipid_dct["[M-(FA1)+H]+_MZ_LOW"].astype(str) + + " <= mz <= " + + lipid_dct["[M-(FA1)+H]+_MZ_HIGH"].astype(str) + ) + + lipid_dct["[M-(FA2)+H]+_MZ_LOW"] = ppm_window_para( + (m_exactmass - fa2_exactmass + h_exactmass), ms2_ppm * -1 + ) + lipid_dct["[M-(FA2)+H]+_MZ_HIGH"] = ppm_window_para( + (m_exactmass - fa2_exactmass + h_exactmass), ms2_ppm + ) + lipid_dct["[M-(FA2)+H]+_Q"] = ( + lipid_dct["[M-(FA2)+H]+_MZ_LOW"].astype(str) + + " <= mz <= " + + lipid_dct["[M-(FA2)+H]+_MZ_HIGH"].astype(str) + ) + + lipid_dct["[M-(FA3)+H]+_MZ_LOW"] = ppm_window_para( + (m_exactmass - fa3_exactmass + h_exactmass), ms2_ppm * -1 + ) + lipid_dct["[M-(FA3)+H]+_MZ_HIGH"] = ppm_window_para( + (m_exactmass - fa3_exactmass + h_exactmass), ms2_ppm + ) + lipid_dct["[M-(FA3)+H]+_Q"] = ( + lipid_dct["[M-(FA3)+H]+_MZ_LOW"].astype(str) + + " <= mz <= " + + lipid_dct["[M-(FA3)+H]+_MZ_HIGH"].astype(str) + ) + + lipid_dct["[M-(FA1-H2O)+H]+_MZ_LOW"] = ppm_window_para( + (m_exactmass - (fa1_exactmass - nl_water) + h_exactmass), + ms2_ppm * -1, + ) + lipid_dct["[M-(FA1-H2O)+H]+_MZ_HIGH"] = ppm_window_para( + (m_exactmass - (fa1_exactmass - nl_water) + h_exactmass), ms2_ppm + ) + lipid_dct["[M-(FA1-H2O)+H]+_Q"] = ( + lipid_dct["[M-(FA1-H2O)+H]+_MZ_LOW"].astype(str) + + " <= mz <= " + + lipid_dct["[M-(FA1-H2O)+H]+_MZ_HIGH"].astype(str) + ) + + lipid_dct["[M-(FA2-H2O)+H]+_MZ_LOW"] = ppm_window_para( + (m_exactmass - (fa2_exactmass - nl_water) + h_exactmass), + ms2_ppm * -1, + ) + lipid_dct["[M-(FA2-H2O)+H]+_MZ_HIGH"] = ppm_window_para( + (m_exactmass - (fa2_exactmass - nl_water) + h_exactmass), ms2_ppm + ) + lipid_dct["[M-(FA2-H2O)+H]+_Q"] = ( + lipid_dct["[M-(FA2-H2O)+H]+_MZ_LOW"].astype(str) + + " <= mz <= " + + lipid_dct["[M-(FA2-H2O)+H]+_MZ_HIGH"].astype(str) + ) + + lipid_dct["[M-(FA3-H2O)+H]+_MZ_LOW"] = ppm_window_para( + (m_exactmass - (fa3_exactmass - nl_water) + h_exactmass), + ms2_ppm * -1, + ) + lipid_dct["[M-(FA3-H2O)+H]+_MZ_HIGH"] = ppm_window_para( + (m_exactmass - (fa3_exactmass - nl_water) + h_exactmass), ms2_ppm + ) + lipid_dct["[M-(FA3-H2O)+H]+_Q"] = ( + lipid_dct["[M-(FA3-H2O)+H]+_MZ_LOW"].astype(str) + + " <= mz <= " + + lipid_dct["[M-(FA3-H2O)+H]+_MZ_HIGH"].astype(str) + ) # Fragments names when can occur 2 neutral losses of FA. 1 FA with the water and other without - mg_str = 'MG' - lipid_dct['[MG(FA1)-H2O+H]+_ABBR'] = '[%s(%s)-H2O+H]+' % (mg_str, fa1_abbr) - lipid_dct['[MG(FA2)-H2O+H]+_ABBR'] = '[%s(%s)-H2O+H]+' % (mg_str, fa2_abbr) - lipid_dct['[MG(FA3)-H2O+H]+_ABBR'] = '[%s(%s)-H2O+H]+' % (mg_str, fa3_abbr) - - lipid_dct['[MG(FA1)-H2O+H]+_MZ'] = round(fa1_exactmass + gly_mg_base_exactmass, 6) - lipid_dct['[MG(FA2)-H2O+H]+_MZ'] = round(fa2_exactmass + gly_mg_base_exactmass, 6) - lipid_dct['[MG(FA3)-H2O+H]+_MZ'] = round(fa3_exactmass + gly_mg_base_exactmass, 6) + mg_str = "MG" + lipid_dct["[MG(FA1)-H2O+H]+_ABBR"] = "[%s(%s)-H2O+H]+" % (mg_str, fa1_abbr) + lipid_dct["[MG(FA2)-H2O+H]+_ABBR"] = "[%s(%s)-H2O+H]+" % (mg_str, fa2_abbr) + lipid_dct["[MG(FA3)-H2O+H]+_ABBR"] = "[%s(%s)-H2O+H]+" % (mg_str, fa3_abbr) + + lipid_dct["[MG(FA1)-H2O+H]+_MZ"] = round( + fa1_exactmass + gly_mg_base_exactmass, 6 + ) + lipid_dct["[MG(FA2)-H2O+H]+_MZ"] = round( + fa2_exactmass + gly_mg_base_exactmass, 6 + ) + lipid_dct["[MG(FA3)-H2O+H]+_MZ"] = round( + fa3_exactmass + gly_mg_base_exactmass, 6 + ) # TODO (georgia.angelidou@uni-leipzig.de): add the fragments of Na [sodium] # Fragments when there only 1 neutral loss from the TG. - elif m_class in ['DG']: - mg_str = 'MG' - lipid_dct['[MG(FA1)-H2O+H]+_ABBR'] = '[%s(%s)-H2O+H]+' % (mg_str, fa1_abbr) - lipid_dct['[MG(FA2)-H2O+H]+_ABBR'] = '[%s(%s)-H2O+H]+' % (mg_str, fa2_abbr) - - lipid_dct['[MG(FA1)-H2O+H]+_MZ'] = round(fa1_exactmass + gly_mg_base_exactmass, 6) - lipid_dct['[MG(FA2)-H2O+H]+_MZ'] = round(fa2_exactmass + gly_mg_base_exactmass, 6) - - lipid_dct['[MG(FA1)-H2O+H]+_MZ_LOW'] = ppm_window_para((fa1_exactmass + gly_mg_base_exactmass), - ms2_ppm * -1) - lipid_dct['[MG(FA1)-H2O+H]+_MZ_HIGH'] = ppm_window_para((fa1_exactmass + gly_mg_base_exactmass), ms2_ppm) - lipid_dct['[MG(FA1)-H2O+H]+_Q'] = ( - lipid_dct['[MG(FA1)-H2O+H]+_MZ_LOW'].astype(str) + ' <= mz <= ' + - lipid_dct['[MG(FA1)-H2O+H]+_MZ_HIGH'].astype(str)) - - lipid_dct['[MG(FA2)-H2O+H]+_MZ_LOW'] = ppm_window_para((fa2_exactmass + gly_mg_base_exactmass), - ms2_ppm * -1) - lipid_dct['[MG(FA2)-H2O+H]+_MZ_HIGH'] = ppm_window_para((fa2_exactmass + gly_mg_base_exactmass), ms2_ppm) - lipid_dct['[MG(FA2)-H2O+H]+_Q'] = ( - lipid_dct['[MG(FA2)-H2O+H]+_MZ_LOW'].astype(str) + ' <= mz <= ' + - lipid_dct['[MG(FA2)-H2O+H]+_MZ_HIGH'].astype(str)) + elif m_class in ["DG"]: + mg_str = "MG" + lipid_dct["[MG(FA1)-H2O+H]+_ABBR"] = "[%s(%s)-H2O+H]+" % (mg_str, fa1_abbr) + lipid_dct["[MG(FA2)-H2O+H]+_ABBR"] = "[%s(%s)-H2O+H]+" % (mg_str, fa2_abbr) + + lipid_dct["[MG(FA1)-H2O+H]+_MZ"] = round( + fa1_exactmass + gly_mg_base_exactmass, 6 + ) + lipid_dct["[MG(FA2)-H2O+H]+_MZ"] = round( + fa2_exactmass + gly_mg_base_exactmass, 6 + ) + + lipid_dct["[MG(FA1)-H2O+H]+_MZ_LOW"] = ppm_window_para( + (fa1_exactmass + gly_mg_base_exactmass), ms2_ppm * -1 + ) + lipid_dct["[MG(FA1)-H2O+H]+_MZ_HIGH"] = ppm_window_para( + (fa1_exactmass + gly_mg_base_exactmass), ms2_ppm + ) + lipid_dct["[MG(FA1)-H2O+H]+_Q"] = ( + lipid_dct["[MG(FA1)-H2O+H]+_MZ_LOW"].astype(str) + + " <= mz <= " + + lipid_dct["[MG(FA1)-H2O+H]+_MZ_HIGH"].astype(str) + ) + + lipid_dct["[MG(FA2)-H2O+H]+_MZ_LOW"] = ppm_window_para( + (fa2_exactmass + gly_mg_base_exactmass), ms2_ppm * -1 + ) + lipid_dct["[MG(FA2)-H2O+H]+_MZ_HIGH"] = ppm_window_para( + (fa2_exactmass + gly_mg_base_exactmass), ms2_ppm + ) + lipid_dct["[MG(FA2)-H2O+H]+_Q"] = ( + lipid_dct["[MG(FA2)-H2O+H]+_MZ_LOW"].astype(str) + + " <= mz <= " + + lipid_dct["[MG(FA2)-H2O+H]+_MZ_HIGH"].astype(str) + ) else: # TODO (georgia.angelidou@uni-leipzig.de: Info for sphingomyelins @@ -740,46 +1064,59 @@ def calc_fragments(lipid_dct, charge='', ms2_ppm=100): return lipid_dct - def compose_lipid(self, param_dct, ms2_ppm=100): + def compose_lipid(self, param_dct: dict, ms2_ppm: int = 100) -> pd.DataFrame: + """ + Main function to generate the combination of lipids. + Control all functions above. + Args: + param_dct (dict): parameter load from GUI or config file + ms2_ppm (int): The MS/MS tolerance for the calculation of MS/MS query window - lipid_class = param_dct['lipid_class'] - lipid_charge = param_dct['charge_mode'] - if param_dct['exact_position'] == 'TRUE': + Returns: + + """ + + lipid_class = param_dct["lipid_class"] + lipid_charge = param_dct["charge_mode"] + if param_dct["exact_position"] == "TRUE": position_set = True else: position_set = False - usr_fa_df = pd.read_excel(param_dct['fa_whitelist']) - usr_fa_df = usr_fa_df.fillna(value='F') + usr_fa_df = pd.read_excel(param_dct["fa_whitelist"]) + usr_fa_df = usr_fa_df.fillna(value="F") tmp_columns = usr_fa_df.columns.tolist() usr_fa_df.columns = usr_fa_df.columns.str.upper() - if lipid_class in ['PL', 'PA', 'PC', 'PE', 'PG', 'PI', 'PS', 'SM']: + # Todo: check SM section below: + if lipid_class in ["PL", "PA", "PC", "PE", "PG", "PI", "PS", "SM"]: if lipid_class in tmp_columns: pass - elif 'PL' in tmp_columns: + elif "PL" in tmp_columns: pass else: return False - elif lipid_class in ['LPL', 'LPA', 'LPC', 'LPE', 'LPG', 'LPI', 'LPS']: + elif lipid_class in ["LPL", "LPA", "LPC", "LPE", "LPG", "LPI", "LPS"]: if lipid_class in tmp_columns: pass - elif 'LPL' in tmp_columns or 'PL' in tmp_columns: + elif "LPL" in tmp_columns or "PL" in tmp_columns: pass else: return False - elif lipid_class in ['TG', 'DG']: + elif lipid_class in ["TG", "DG"]: if lipid_class in tmp_columns: pass else: return False else: return False - print('[INFO] --> FA white list loaded ...') - lipid_comb_dct = self.gen_all_comb(lipid_class, usr_fa_df, position=position_set) + print("[INFO] --> FA white list loaded ...") + lipid_comb_dct = self.gen_all_comb( + lipid_class, usr_fa_df, position=position_set + ) lipid_info_dct = {} @@ -788,104 +1125,134 @@ def compose_lipid(self, param_dct, ms2_ppm=100): for _lipid in list(lipid_comb_dct.keys()): _lipid_dct = lipid_comb_dct[_lipid] - _fa1_abbr = _lipid_dct['FA1'] + _fa1_abbr = _lipid_dct["FA1"] if _fa1_abbr: _fa1_info_dct = abbr_parser.get_fa_info(_fa1_abbr) for _fa1_k in list(_fa1_info_dct.keys()): - _lipid_dct['FA1_' + _fa1_k] = _fa1_info_dct[_fa1_k] + _lipid_dct["FA1_" + _fa1_k] = _fa1_info_dct[_fa1_k] else: - if 'FA2' in list(_lipid_dct.keys()): - if _lipid_dct['FA2']: - _lipid_dct['FA1'], _lipid_dct['FA2'] = _lipid_dct['FA2'], _lipid_dct['FA1'] - _fa1_abbr = _lipid_dct['FA1'] + if "FA2" in list(_lipid_dct.keys()): + if _lipid_dct["FA2"]: + _lipid_dct["FA1"], _lipid_dct["FA2"] = ( + _lipid_dct["FA2"], + _lipid_dct["FA1"], + ) + _fa1_abbr = _lipid_dct["FA1"] _fa1_info_dct = abbr_parser.get_fa_info(_fa1_abbr) for _fa1_k in list(_fa1_info_dct.keys()): - _lipid_dct['FA1_' + _fa1_k] = _fa1_info_dct[_fa1_k] + _lipid_dct["FA1_" + _fa1_k] = _fa1_info_dct[_fa1_k] else: _fa1_info_dct = {} - if 'FA2' in list(_lipid_dct.keys()): - _fa2_abbr = _lipid_dct['FA2'] + if "FA2" in list(_lipid_dct.keys()): + _fa2_abbr = _lipid_dct["FA2"] if _fa2_abbr: _fa2_info_dct = abbr_parser.get_fa_info(_fa2_abbr) for _fa2_k in list(_fa2_info_dct.keys()): - _lipid_dct['FA2_' + _fa2_k] = _fa2_info_dct[_fa2_k] + _lipid_dct["FA2_" + _fa2_k] = _fa2_info_dct[_fa2_k] else: - _fa2_abbr = '' + _fa2_abbr = "" _fa2_info_dct = {} - # TODO (georgia.angelidou@uni-leipzig.de): SM, Cer - if lipid_class in ['PA', 'PC', 'PE', 'PG', 'PI', 'PS', 'DG']: - _lipid_dct['M_DB'] = _fa1_info_dct['DB'] + _fa2_info_dct['DB'] + # Todo: add and check SM, Cer below + if lipid_class in ["PA", "PC", "PE", "PG", "PI", "PS", "DG"]: + _lipid_dct["M_DB"] = _fa1_info_dct["DB"] + _fa2_info_dct["DB"] # TODO(georgia.angelidou@uni-leipzig.de): not important (just keep in mind for future correction) # consideration the case if the user choose the fa2 position for the different link types # or in that they may mistype something - if _fa1_info_dct['LINK'] in ['FA', 'A']: - lipid_bulk_str = '{pl}({c}:{db})'.format(pl=lipid_class, - c=_fa1_info_dct['C'] + _fa2_info_dct['C'], - db=lipid_comb_dct[_lipid]['M_DB']) + if _fa1_info_dct["LINK"] in ["FA", "A"]: + lipid_bulk_str = "{pl}({c}:{db})".format( + pl=lipid_class, + c=_fa1_info_dct["C"] + _fa2_info_dct["C"], + db=lipid_comb_dct[_lipid]["M_DB"], + ) else: - lipid_bulk_str = '{pl}({lk}{c}:{db})'.format(pl=lipid_class, lk=_fa1_info_dct['LINK'], - c=_fa1_info_dct['C'] + _fa2_info_dct['C'], - db=lipid_comb_dct[_lipid]['M_DB']) - elif lipid_class in ['LPA', 'LPC', 'LPE', 'LPG', 'LPI', 'LPS']: - _lipid_dct['M_DB'] = _fa1_info_dct['DB'] + lipid_bulk_str = "{pl}({lk}{c}:{db})".format( + pl=lipid_class, + lk=_fa1_info_dct["LINK"], + c=_fa1_info_dct["C"] + _fa2_info_dct["C"], + db=lipid_comb_dct[_lipid]["M_DB"], + ) + elif lipid_class in ["LPA", "LPC", "LPE", "LPG", "LPI", "LPS"]: + _lipid_dct["M_DB"] = _fa1_info_dct["DB"] # TODO(georgia.angelidou@uni-leipzig.de): not important (just keep in mind for future correction) # consideration the case if the user choose the fa2 position for the different link types # or in that they may mistype something - if _fa1_info_dct['LINK'] in ['FA', 'A']: - lipid_bulk_str = '{pl}({c}:{db})'.format(pl=lipid_class, - c=_fa1_info_dct['C'], - db=lipid_comb_dct[_lipid]['M_DB']) + if _fa1_info_dct["LINK"] in ["FA", "A"]: + lipid_bulk_str = "{pl}({c}:{db})".format( + pl=lipid_class, + c=_fa1_info_dct["C"], + db=lipid_comb_dct[_lipid]["M_DB"], + ) else: - lipid_bulk_str = '{pl}({lk}{c}:{db})'.format(pl=lipid_class, lk=_fa1_info_dct['LINK'], - c=_fa1_info_dct['C'], - db=lipid_comb_dct[_lipid]['M_DB']) - elif lipid_class in ['TG']: - _fa3_abbr = _lipid_dct['FA3'] + lipid_bulk_str = "{pl}({lk}{c}:{db})".format( + pl=lipid_class, + lk=_fa1_info_dct["LINK"], + c=_fa1_info_dct["C"], + db=lipid_comb_dct[_lipid]["M_DB"], + ) + elif lipid_class in ["TG"]: + _fa3_abbr = _lipid_dct["FA3"] _fa3_info_dct = abbr_parser.get_fa_info(_fa3_abbr) for _fa3_k in _fa3_info_dct.keys(): - _lipid_dct['FA3_' + _fa3_k] = _fa3_info_dct[_fa3_k] + _lipid_dct["FA3_" + _fa3_k] = _fa3_info_dct[_fa3_k] - _lipid_dct['M_DB'] = _fa3_info_dct['DB'] + _fa2_info_dct['DB'] + _fa1_info_dct['DB'] + _lipid_dct["M_DB"] = ( + _fa3_info_dct["DB"] + _fa2_info_dct["DB"] + _fa1_info_dct["DB"] + ) # Note: For TG in the current default not consider the different lipids with other type of bond # If stay like this need to be mention in somewhere for the user - if _fa1_info_dct['LINK'] in ['FA', 'A']: - lipid_bulk_str = '{tg}({c}:{db})'.format(tg=lipid_class, - c=(_fa1_info_dct['C'] + _fa2_info_dct['C'] - + _fa3_info_dct['C']), - db=lipid_comb_dct[_lipid]['M_DB']) + if _fa1_info_dct["LINK"] in ["FA", "A"]: + lipid_bulk_str = "{tg}({c}:{db})".format( + tg=lipid_class, + c=( + _fa1_info_dct["C"] + _fa2_info_dct["C"] + _fa3_info_dct["C"] + ), + db=lipid_comb_dct[_lipid]["M_DB"], + ) else: - lipid_bulk_str = '{tg}({lk}{c}:{db})'.format(tg=lipid_class, lk=_fa1_info_dct['LINK'], - c=(_fa1_info_dct['C'] + _fa2_info_dct['C'] - + _fa3_info_dct['C']), - db=lipid_comb_dct[_lipid]['M_DB']) - elif lipid_class in ['SM']: - # TODO(georgia.angelidou@uni-leipzi.de): sphingomyelin support - lipid_bulk_str = '{sm}({c}:{db})'.format(sm=lipid_class, - c=_fa1_info_dct['C'] + _fa2_info_dct['C'], - db=lipid_comb_dct[_lipid]['M_DB']) + lipid_bulk_str = "{tg}({lk}{c}:{db})".format( + tg=lipid_class, + lk=_fa1_info_dct["LINK"], + c=( + _fa1_info_dct["C"] + _fa2_info_dct["C"] + _fa3_info_dct["C"] + ), + db=lipid_comb_dct[_lipid]["M_DB"], + ) + # Todo: check SM section below: + elif lipid_class in ["SM"]: + lipid_bulk_str = "{sm}({c}:{db})".format( + sm=lipid_class, + c=_fa1_info_dct["C"] + _fa2_info_dct["C"], + db=lipid_comb_dct[_lipid]["M_DB"], + ) else: - lipid_bulk_str = '' + lipid_bulk_str = "" - _lipid_dct['BULK_ABBR'] = lipid_bulk_str + _lipid_dct["BULK_ABBR"] = lipid_bulk_str _lipid_formula, _lipid_elem_dct = elem_calc.get_formula(lipid_bulk_str) - _lipid_dct['FORMULA'] = _lipid_formula - _lipid_dct['EXACTMASS'] = elem_calc.get_exactmass(_lipid_elem_dct) + _lipid_dct["FORMULA"] = _lipid_formula + _lipid_dct["EXACTMASS"] = elem_calc.get_exactmass(_lipid_elem_dct) for _elem_k in list(_lipid_elem_dct.keys()): - _lipid_dct['M_' + _elem_k] = _lipid_elem_dct[_elem_k] + _lipid_dct["M_" + _elem_k] = _lipid_elem_dct[_elem_k] # charged - _chg_lipid_formula, _chg_lipid_elem_dct = elem_calc.get_formula(lipid_bulk_str, charge=lipid_charge) - _lipid_dct[lipid_charge + '_FORMULA'] = _chg_lipid_formula - _lipid_dct[lipid_charge + '_MZ'] = elem_calc.get_exactmass(_chg_lipid_elem_dct) + _chg_lipid_formula, _chg_lipid_elem_dct = elem_calc.get_formula( + lipid_bulk_str, charge=lipid_charge + ) + _lipid_dct[lipid_charge + "_FORMULA"] = _chg_lipid_formula + _lipid_dct[lipid_charge + "_MZ"] = elem_calc.get_exactmass( + _chg_lipid_elem_dct + ) # fragments - _lipid_dct = self.calc_fragments(_lipid_dct, charge=lipid_charge, ms2_ppm=ms2_ppm) + _lipid_dct = self.calc_fragments( + _lipid_dct, charge=lipid_charge, ms2_ppm=ms2_ppm + ) lipid_info_dct[_lipid] = _lipid_dct del _lipid_dct @@ -894,10 +1261,3 @@ def compose_lipid(self, param_dct, ms2_ppm=100): lipid_master_df.reset_index(drop=True, inplace=True) return lipid_master_df - - -if __name__ == '__main__': - - from test.test_LipidComposer import TestCaseLipidComposer - - TestCaseLipidComposer() diff --git a/LibLipidHunter/LipidHunter_Main.py b/LibLipidHunter/LipidHunter_Main.py index c099034..e0068f2 100644 --- a/LibLipidHunter/LipidHunter_Main.py +++ b/LibLipidHunter/LipidHunter_Main.py @@ -26,7 +26,7 @@ import time import pandas as pd -from PySide import QtCore, QtGui +from PySide2 import QtCore, QtWidgets import configparser from LibLipidHunter.LipidHunter_UI import Ui_MainWindow @@ -34,62 +34,49 @@ from LibLipidHunter.LipidComposer import LipidComposer -class LipidHunterMain(QtGui.QMainWindow, Ui_MainWindow): +class LipidHunterMain(QtWidgets.QMainWindow, Ui_MainWindow): def __init__(self, parent=None, cwd=None): - scale = 1 config = configparser.ConfigParser() - config.read('config.ini') - if config.has_section('settings'): - user_cfg = 'settings' + config.read("config.ini") + if config.has_section("settings"): + user_cfg = "settings" else: - if config.has_section('default'): - user_cfg = 'default' + if config.has_section("default"): + user_cfg = "default" else: - user_cfg = '' - if len(user_cfg) > 2: - options = config.options(user_cfg) - if 'gui_scale' in options: - try: - scale = float(config.get(user_cfg, 'gui_scale')) - except (ValueError, TypeError): - pass - if scale != 1: - if scale > 2.75: - scale = 2.75 - elif scale < 0.75: - scale = 0.75 - print('[INFO] Using GUI scale x{0}'.format(scale)) - QtGui.QMainWindow.__init__(self, parent) + user_cfg = "" + QtWidgets.QMainWindow.__init__(self, parent) self.ui = Ui_MainWindow() - self.ui.setupUi(self, scale=scale) + self.ui.setupUi(self) # set version - version_date = r'06, August, 2019' - version_html = (r'
' - r'LipidHunter 2 (RC2) # Released Date: {version_date}' - r'
').format(version_date=version_date) - self.ui.version_lb.setText(QtGui.QApplication.translate("MainWindow", version_html, None, - QtGui.QApplication.UnicodeUTF8)) + version_date = r"21-January-2020" + version_html = ( + r'' + r"LipidHunter 2 (RC2) # Released Date: {version_date}" + r"
" + ).format(version_date=version_date) + self.ui.version_lb.setText(version_html) # current folder: if cwd is not None: - print('User LipidHunter folder', cwd) + print("User LipidHunter folder", cwd) self.lipidhunter_cwd = cwd else: auto_cwd = os.getcwd() - print('User LipidHunter folder', auto_cwd) + print("User LipidHunter folder", auto_cwd) self.lipidhunter_cwd = auto_cwd self.load_cfg() self.a_max_ms() # disable un necessary UI elements - q_pgb_style = ''' + q_pgb_style = """ QProgressBar:horizontal { border: 1px #CCCCCC; border-radius: 0px; background: #CCCCCC; padding: 1px;} QProgressBar::chunk:horizontal { background: qlineargradient(x1: 0, y1: 0.5, x2: 0, y2: 0.5, stop: 0 #FF8C00, stop: 1 white);} - ''' + """ self.ui.tab_a_runhunter_pgb.setStyleSheet(q_pgb_style) self.ui.tab_a_runhunter_pgb.hide() @@ -141,176 +128,311 @@ def __init__(self, parent=None, cwd=None): self.lm_worker.info_update.connect(self.lm_worker_info_update) # slots for tab a - QtCore.QObject.connect(self.ui.tab_a_lipidclass_cmb, QtCore.SIGNAL("currentIndexChanged(const QString&)"), - self.a_lipid_class_fa_list) - QtCore.QObject.connect(self.ui.mode_lcms_rb, QtCore.SIGNAL("clicked()"), self.a_set_lc_mode) - QtCore.QObject.connect(self.ui.mode_static_rb, QtCore.SIGNAL("clicked()"), self.a_set_static_mode) - QtCore.QObject.connect(self.ui.tab_a_loadfalist_pb, QtCore.SIGNAL("clicked()"), self.a_load_xlsx) - QtCore.QObject.connect(self.ui.tab_a_loadscorecfg_pb, QtCore.SIGNAL("clicked()"), self.a_loadscore_xlsx) + QtCore.QObject.connect( + self.ui.tab_a_lipidclass_cmb, + QtCore.SIGNAL("currentIndexChanged(const QString&)"), + self.a_lipid_class_fa_list, + ) + QtCore.QObject.connect( + self.ui.mode_lcms_rb, QtCore.SIGNAL("clicked()"), self.a_set_lc_mode + ) + QtCore.QObject.connect( + self.ui.mode_static_rb, QtCore.SIGNAL("clicked()"), self.a_set_static_mode + ) + QtCore.QObject.connect( + self.ui.tab_a_loadfalist_pb, QtCore.SIGNAL("clicked()"), self.a_load_xlsx + ) + QtCore.QObject.connect( + self.ui.tab_a_loadscorecfg_pb, + QtCore.SIGNAL("clicked()"), + self.a_loadscore_xlsx, + ) # QtCore.QObject.connect(self.ui.tab_a_launchgen_pb, QtCore.SIGNAL("clicked()"), self.a_go_generator) - QtCore.QObject.connect(self.ui.tab_a_mzml_pb, QtCore.SIGNAL("clicked()"), self.a_load_mzml) - QtCore.QObject.connect(self.ui.tab_a_saveimgfolder_pb, QtCore.SIGNAL("clicked()"), self.a_save_img2folder) - QtCore.QObject.connect(self.ui.tab_a_msmax_chb, QtCore.SIGNAL("clicked()"), self.a_max_ms) - QtCore.QObject.connect(self.ui.tab_a_sumxlsxpath_pb, QtCore.SIGNAL("clicked()"), self.a_save_output) + QtCore.QObject.connect( + self.ui.tab_a_mzml_pb, QtCore.SIGNAL("clicked()"), self.a_load_mzml + ) + QtCore.QObject.connect( + self.ui.tab_a_saveimgfolder_pb, + QtCore.SIGNAL("clicked()"), + self.a_save_img2folder, + ) + QtCore.QObject.connect( + self.ui.tab_a_msmax_chb, QtCore.SIGNAL("clicked()"), self.a_max_ms + ) + QtCore.QObject.connect( + self.ui.tab_a_sumxlsxpath_pb, QtCore.SIGNAL("clicked()"), self.a_save_output + ) # QtCore.QObject.connect(self.ui.tab_a_runhunter_pb, QtCore.SIGNAL("clicked()"), self.a_run_hunter) - QtCore.QObject.connect(self.ui.tab_a_runhunter_pb, QtCore.SIGNAL("clicked()"), self.single_worker_hunter) - QtCore.QObject.connect(self.ui.tab_a_cfgpath_pb, QtCore.SIGNAL("clicked()"), self.a_save_cfg) - QtCore.QObject.connect(self.ui.tab_a_gencfg_pb, QtCore.SIGNAL("clicked()"), self.a_create_cfg) + QtCore.QObject.connect( + self.ui.tab_a_runhunter_pb, + QtCore.SIGNAL("clicked()"), + self.single_worker_hunter, + ) + QtCore.QObject.connect( + self.ui.tab_a_cfgpath_pb, QtCore.SIGNAL("clicked()"), self.a_save_cfg + ) + QtCore.QObject.connect( + self.ui.tab_a_gencfg_pb, QtCore.SIGNAL("clicked()"), self.a_create_cfg + ) # # slots for tab b - self.ui.tab_b_mutlimode_cmb.currentIndexChanged['QString'].connect(self.b_set_multi_mode) - QtCore.QObject.connect(self.ui.tab_b_addcfg_pb, QtCore.SIGNAL("clicked()"), self.b_load_batchcfg) - QtCore.QObject.connect(self.ui.tab_b_addcfgfolder_pb, QtCore.SIGNAL("clicked()"), self.b_load_batchcfgfolder) - QtCore.QObject.connect(self.ui.tab_b_clearall_pb, QtCore.SIGNAL("clicked()"), self.ui.tab_b_infiles_pte.clear) + self.ui.tab_b_mutlimode_cmb.currentIndexChanged["QString"].connect( + self.b_set_multi_mode + ) + QtCore.QObject.connect( + self.ui.tab_b_addcfg_pb, QtCore.SIGNAL("clicked()"), self.b_load_batchcfg + ) + QtCore.QObject.connect( + self.ui.tab_b_addcfgfolder_pb, + QtCore.SIGNAL("clicked()"), + self.b_load_batchcfgfolder, + ) + QtCore.QObject.connect( + self.ui.tab_b_clearall_pb, + QtCore.SIGNAL("clicked()"), + self.ui.tab_b_infiles_pte.clear, + ) # QtCore.QObject.connect(self.ui.tab_b_runbatch_pb, QtCore.SIGNAL("clicked()"), self.b_run_batchmode) - QtCore.QObject.connect(self.ui.tab_b_runbatch_pb, QtCore.SIGNAL("clicked()"), self.batch_worker_hunter) + QtCore.QObject.connect( + self.ui.tab_b_runbatch_pb, + QtCore.SIGNAL("clicked()"), + self.batch_worker_hunter, + ) # # slots for tab c - QtCore.QObject.connect(self.ui.tab_c_falistpl_pb, QtCore.SIGNAL("clicked()"), self.c_load_falist_pl) - QtCore.QObject.connect(self.ui.tab_c_falisttg_pb, QtCore.SIGNAL("clicked()"), self.c_load_falist_tg) - QtCore.QObject.connect(self.ui.tab_c_lmcalcfalist_pb, QtCore.SIGNAL("clicked()"), self.c_load_falist_dg) - QtCore.QObject.connect(self.ui.tab_c_hgcfg_pb, QtCore.SIGNAL("clicked()"), self.c_load_hgcfg) - QtCore.QObject.connect(self.ui.tab_c_scorecfgpl_pb, QtCore.SIGNAL("clicked()"), self.c_load_scorecfg_pl) - QtCore.QObject.connect(self.ui.tab_c_scorecfgtg_pb, QtCore.SIGNAL("clicked()"), self.c_load_scorecfg_tg) - QtCore.QObject.connect(self.ui.tab_c_scorecfgdg_pb, QtCore.SIGNAL("clicked()"), self.c_load_scorecfg_dg) - QtCore.QObject.connect(self.ui.tab_c_savesettings_pb, QtCore.SIGNAL("clicked()"), self.c_set_default_cfg) - QtCore.QObject.connect(self.ui.tab_c_lmexport_pb, QtCore.SIGNAL("clicked()"), self.c_lmexport) - QtCore.QObject.connect(self.ui.tab_c_lmrun_pb, QtCore.SIGNAL("clicked()"), self.lm_worker_hunter) + QtCore.QObject.connect( + self.ui.tab_c_falistpl_pb, QtCore.SIGNAL("clicked()"), self.c_load_falist_pl + ) + QtCore.QObject.connect( + self.ui.tab_c_falisttg_pb, QtCore.SIGNAL("clicked()"), self.c_load_falist_tg + ) + QtCore.QObject.connect( + self.ui.tab_c_lmcalcfalist_pb, + QtCore.SIGNAL("clicked()"), + self.c_load_falist_dg, + ) + QtCore.QObject.connect( + self.ui.tab_c_hgcfg_pb, QtCore.SIGNAL("clicked()"), self.c_load_hgcfg + ) + QtCore.QObject.connect( + self.ui.tab_c_scorecfgpl_pb, + QtCore.SIGNAL("clicked()"), + self.c_load_scorecfg_pl, + ) + QtCore.QObject.connect( + self.ui.tab_c_scorecfgtg_pb, + QtCore.SIGNAL("clicked()"), + self.c_load_scorecfg_tg, + ) + QtCore.QObject.connect( + self.ui.tab_c_scorecfgdg_pb, + QtCore.SIGNAL("clicked()"), + self.c_load_scorecfg_dg, + ) + QtCore.QObject.connect( + self.ui.tab_c_savesettings_pb, + QtCore.SIGNAL("clicked()"), + self.c_set_default_cfg, + ) + QtCore.QObject.connect( + self.ui.tab_c_lmexport_pb, QtCore.SIGNAL("clicked()"), self.c_lmexport + ) + QtCore.QObject.connect( + self.ui.tab_c_lmrun_pb, QtCore.SIGNAL("clicked()"), self.lm_worker_hunter + ) # load configurations def load_cfg(self): # set click able external links - for _link_lb in (self.ui.link_gplv2_lb, self.ui.link_source_lb, self.ui.link_tutorial_lb, - self.ui.link_paper_lb, self.ui.link_otherprojects_lb, self.ui.link_matplotlib_lb, - self.ui.link_numpy_lb, self.ui.link_pandas_lb, self.ui.link_pymzml_lb, self.ui.link_pyside_lb, - self.ui.link_bmbf_lb, self.ui.link_emed_lb, self.ui.link_sysmedos_lb, self.ui.link_uni_lb): + for _link_lb in ( + self.ui.link_gplv2_lb, + self.ui.link_source_lb, + self.ui.link_tutorial_lb, + self.ui.link_paper_lb, + self.ui.link_otherprojects_lb, + self.ui.link_matplotlib_lb, + self.ui.link_numpy_lb, + self.ui.link_pandas_lb, + self.ui.link_pymzml_lb, + self.ui.link_pyside_lb, + self.ui.link_bmbf_lb, + self.ui.link_emed_lb, + self.ui.link_sysmedos_lb, + self.ui.link_uni_lb, + ): _link_lb.setOpenExternalLinks(True) # self.ui.logo_lb.setOpenExternalLinks(True) config = configparser.ConfigParser() - config.read('config.ini') - if config.has_section('settings'): - user_cfg = 'settings' + config.read("config.ini") + if config.has_section("settings"): + user_cfg = "settings" else: - if config.has_section('default'): - user_cfg = 'default' + if config.has_section("default"): + user_cfg = "default" else: - user_cfg = '' + user_cfg = "" if len(user_cfg) > 2: options = config.options(user_cfg) - if 'fa_white_list_cfg_pl' in options: - pl_fawhitelist_path_str = config.get(user_cfg, 'fa_white_list_cfg_pl') - pl_fawhitelist_path_str, error_log = self.check_file(pl_fawhitelist_path_str, 'FA whitelist for PL') + if "fa_white_list_cfg_pl" in options: + pl_fawhitelist_path_str = config.get(user_cfg, "fa_white_list_cfg_pl") + pl_fawhitelist_path_str, error_log = self.check_file( + pl_fawhitelist_path_str, "FA whitelist for PL" + ) if error_log is not None: self.ui.tab_c_falistpl_le.setText(error_log) else: self.ui.tab_c_falistpl_le.setText(pl_fawhitelist_path_str) - if 'lipid_specific_cfg' in options: - lipid_specific_path_str = config.get(user_cfg, 'lipid_specific_cfg') - lipid_specific_path_str, error_log = self.check_file(lipid_specific_path_str, 'lipid_specific_cfg') + if "lipid_specific_cfg" in options: + lipid_specific_path_str = config.get(user_cfg, "lipid_specific_cfg") + lipid_specific_path_str, error_log = self.check_file( + lipid_specific_path_str, "lipid_specific_cfg" + ) if error_log is not None: self.ui.tab_c_hgcfg_le.setText(error_log) else: self.ui.tab_c_hgcfg_le.setText(lipid_specific_path_str) - if 'score_cfg_lpl' in options: - lpl_score_cfg_path_str = config.get(user_cfg, 'score_cfg_lpl') - lpl_score_cfg_path_str, error_log = self.check_file(lpl_score_cfg_path_str, 'Score cfg for LPL') + if "score_cfg_lpl" in options: + lpl_score_cfg_path_str = config.get(user_cfg, "score_cfg_lpl") + lpl_score_cfg_path_str, error_log = self.check_file( + lpl_score_cfg_path_str, "Score cfg for LPL" + ) if error_log is not None: self.ui.tab_c_falisttg_le.setText(error_log) else: self.ui.tab_c_falisttg_le.setText(lpl_score_cfg_path_str) - if 'score_cfg_pl' in options: - self.ui.tab_c_scorecfgpl_le.setText(config.get(user_cfg, 'score_cfg_pl')) - pl_score_cfg_path_str = config.get(user_cfg, 'score_cfg_pl') - pl_score_cfg_path_str, error_log = self.check_file(pl_score_cfg_path_str, 'Score cfg for PL') + if "score_cfg_pl" in options: + self.ui.tab_c_scorecfgpl_le.setText( + config.get(user_cfg, "score_cfg_pl") + ) + pl_score_cfg_path_str = config.get(user_cfg, "score_cfg_pl") + pl_score_cfg_path_str, error_log = self.check_file( + pl_score_cfg_path_str, "Score cfg for PL" + ) if error_log is not None: self.ui.tab_c_scorecfgpl_le.setText(error_log) else: self.ui.tab_c_scorecfgpl_le.setText(pl_score_cfg_path_str) - if 'score_cfg_tg' in options: - pl_score_cfg_path_str = config.get(user_cfg, 'score_cfg_tg') - pl_score_cfg_path_str, error_log = self.check_file(pl_score_cfg_path_str, 'Score cfg for TG') + if "score_cfg_tg" in options: + pl_score_cfg_path_str = config.get(user_cfg, "score_cfg_tg") + pl_score_cfg_path_str, error_log = self.check_file( + pl_score_cfg_path_str, "Score cfg for TG" + ) if error_log is not None: self.ui.tab_c_scorecfgtg_le.setText(error_log) else: self.ui.tab_c_scorecfgtg_le.setText(pl_score_cfg_path_str) - if 'score_cfg_dg' in options: - pl_score_cfg_path_str = config.get(user_cfg, 'score_cfg_dg') - pl_score_cfg_path_str, error_log = self.check_file(pl_score_cfg_path_str, 'Score cfg for DG') + if "score_cfg_dg" in options: + pl_score_cfg_path_str = config.get(user_cfg, "score_cfg_dg") + pl_score_cfg_path_str, error_log = self.check_file( + pl_score_cfg_path_str, "Score cfg for DG" + ) if error_log is not None: self.ui.tab_c_scorecfgdg_le.setText(error_log) else: self.ui.tab_c_scorecfgdg_le.setText(pl_score_cfg_path_str) - if 'score_mode' in options: - if config.get(user_cfg, 'score_mode').upper() in ['RANK', '']: + if "score_mode" in options: + if config.get(user_cfg, "score_mode").upper() in ["RANK", ""]: self.ui.tab_c_scoremode_cmb.setCurrentIndex(0) - elif config.get(user_cfg, 'score_mode') is None: + elif config.get(user_cfg, "score_mode") is None: self.ui.tab_c_scoremode_cmb.setCurrentIndex(0) - elif config.get(user_cfg, 'score_mode').upper() == 'INTENSITY': + elif config.get(user_cfg, "score_mode").upper() == "INTENSITY": self.ui.tab_c_scoremode_cmb.setCurrentIndex(1) else: self.ui.tab_c_scoremode_cmb.setCurrentIndex(0) else: self.ui.tab_c_scoremode_cmb.setCurrentIndex(0) - if 'isotope_13c_mode' in options: - if config.get(user_cfg, 'isotope_13c_mode').upper() == 'ON': + if "isotope_13c_mode" in options: + if config.get(user_cfg, "isotope_13c_mode").upper() == "ON": self.ui.tab_c_isotopescoremode_cmb.setCurrentIndex(1) - elif config.get(user_cfg, 'isotope_13c_mode').upper() == 'OFF': + elif config.get(user_cfg, "isotope_13c_mode").upper() == "OFF": self.ui.tab_c_isotopescoremode_cmb.setCurrentIndex(0) else: self.ui.tab_c_isotopescoremode_cmb.setCurrentIndex(0) else: self.ui.tab_c_isotopescoremode_cmb.setCurrentIndex(0) - if 'parallel_target' in options: - if config.get(user_cfg, 'parallel_target').upper() == 'CPU': + if "parallel_target" in options: + if config.get(user_cfg, "parallel_target").upper() == "CPU": self.ui.tab_c_parallization_cmb.setCurrentIndex(0) - elif config.get(user_cfg, 'parallel_target') in ['CPU_and_GPU', 'GPU', 'CPUandGPU', 'CPUGPU', - 'parallel']: + elif config.get(user_cfg, "parallel_target") in [ + "CPU_and_GPU", + "GPU", + "CPUandGPU", + "CPUGPU", + "parallel", + ]: self.ui.tab_c_parallization_cmb.setCurrentIndex(1) else: self.ui.tab_c_parallization_cmb.setCurrentIndex(0) - if 'max_cpu_core' in options: - self.ui.tab_c_cores_spb.setValue(int(config.get(user_cfg, 'max_cpu_core'))) - if 'max_ram' in options: - self.ui.tab_c_ram_spb.setValue(int(config.get(user_cfg, 'max_ram'))) - if 'img_type' in options: - if config.get(user_cfg, 'img_type').upper() == 'PNG': + if "max_cpu_core" in options: + self.ui.tab_c_cores_spb.setValue( + int(config.get(user_cfg, "max_cpu_core")) + ) + if "max_ram" in options: + self.ui.tab_c_ram_spb.setValue(int(config.get(user_cfg, "max_ram"))) + if "img_type" in options: + if config.get(user_cfg, "img_type").upper() == "PNG": self.ui.tab_c_imagetype_cmb.setCurrentIndex(0) - elif config.get(user_cfg, 'img_type').upper() == 'SVG': + elif config.get(user_cfg, "img_type").upper() == "SVG": self.ui.tab_c_imagetype_cmb.setCurrentIndex(1) else: self.ui.tab_c_imagetype_cmb.setCurrentIndex(0) - if 'img_dpi' in options: - self.ui.tab_c_dpi_spb.setValue(int(config.get(user_cfg, 'img_dpi'))) + if "img_dpi" in options: + self.ui.tab_c_dpi_spb.setValue(int(config.get(user_cfg, "img_dpi"))) else: self.ui.tab_c_dpi_spb.setValue(300) - if 'tag_all_fa_check' in options: - if config.get(user_cfg, 'tag_all_fa_check').upper() == 'ON': + if "tag_all_fa_check" in options: + if config.get(user_cfg, "tag_all_fa_check").upper() == "ON": self.ui.tab_c_tag_all_fa_chb.setChecked(True) else: self.ui.tab_c_tag_all_fa_chb.setChecked(False) else: self.ui.tab_c_tag_all_fa_chb.setChecked(True) # UI settings - if 'main_tab' in options and 1 <= int(config.get(user_cfg, 'main_tab')) <= 5: - self.ui.tabframe.setCurrentIndex(int(config.get(user_cfg, 'main_tab')) - 1) + if ( + "main_tab" in options + and 1 <= int(config.get(user_cfg, "main_tab")) <= 5 + ): + self.ui.tabframe.setCurrentIndex( + int(config.get(user_cfg, "main_tab")) - 1 + ) else: self.ui.tabframe.setCurrentIndex(0) - if 'runhunter_tab' in options and 1 <= int(config.get(user_cfg, 'runhunter_tab')) <= 2: - self.ui.runhunter_tabframe.setCurrentIndex(int(config.get(user_cfg, 'runhunter_tab')) - 1) + if ( + "runhunter_tab" in options + and 1 <= int(config.get(user_cfg, "runhunter_tab")) <= 2 + ): + self.ui.runhunter_tabframe.setCurrentIndex( + int(config.get(user_cfg, "runhunter_tab")) - 1 + ) else: self.ui.runhunter_tabframe.setCurrentIndex(0) - if 'lipidgen_tab' in options and 1 <= int(config.get(user_cfg, 'lipidgen_tab')) <= 2: - self.ui.lipidgen_tabframe.setCurrentIndex(int(config.get(user_cfg, 'lipidgen_tab')) - 1) + if ( + "lipidgen_tab" in options + and 1 <= int(config.get(user_cfg, "lipidgen_tab")) <= 2 + ): + self.ui.lipidgen_tabframe.setCurrentIndex( + int(config.get(user_cfg, "lipidgen_tab")) - 1 + ) else: self.ui.lipidgen_tabframe.setCurrentIndex(0) - if 'default_vendor' in options and 0 <= int(config.get(user_cfg, 'default_vendor')) <= 4: - self.ui.vendor_cmb.setCurrentIndex(int(config.get(user_cfg, 'default_vendor'))) + if ( + "default_vendor" in options + and 0 <= int(config.get(user_cfg, "default_vendor")) <= 4 + ): + self.ui.vendor_cmb.setCurrentIndex( + int(config.get(user_cfg, "default_vendor")) + ) else: self.ui.vendor_cmb.setCurrentIndex(0) - if 'default_lipid' in options and 0 <= int(config.get(user_cfg, 'default_lipid')) <= 9: - self.ui.tab_a_lipidclass_cmb.setCurrentIndex(int(config.get(user_cfg, 'default_lipid'))) + if ( + "default_lipid" in options + and 0 <= int(config.get(user_cfg, "default_lipid")) <= 9 + ): + self.ui.tab_a_lipidclass_cmb.setCurrentIndex( + int(config.get(user_cfg, "default_lipid")) + ) else: self.ui.tab_a_lipidclass_cmb.setCurrentIndex(0) @@ -323,7 +445,7 @@ def get_same_files(folder, filetype_lst): :return: a list of absolute file path :rtype: list """ - if folder is not '': + if folder is not "": os.chdir(folder) _pre_found_lst = [] for _filetype in filetype_lst: @@ -339,7 +461,7 @@ def get_same_files(folder, filetype_lst): return filename_lst, abs_path_lst def open_file(self, info_str, lb_obj): - open_file_dialog = QtGui.QFileDialog(self) + open_file_dialog = QtWidgets.QFileDialog(self) open_file_dialog.setNameFilters([info_str]) open_file_dialog.selectNameFilter(info_str) if open_file_dialog.exec_(): @@ -350,84 +472,66 @@ def open_file(self, info_str, lb_obj): @staticmethod def check_file(usr_path, info_str): - file_abs_path = '' + file_abs_path = "" try: if os.path.isfile(usr_path): error_log = None file_abs_path = os.path.abspath(usr_path) else: - error_log = '!! Failed to load {_file} !!'.format(_file=info_str) + error_log = "!! Failed to load {_file} !!".format(_file=info_str) except IOError: - error_log = '!! Failed to load {_file} !!'.format(_file=info_str) + error_log = "!! Failed to load {_file} !!".format(_file=info_str) return file_abs_path, error_log @staticmethod def check_folder(usr_path, info_str): - folder_abs_path = '' + folder_abs_path = "" try: if os.path.isdir(usr_path): - print('Folder existed...\n', usr_path) + print("Folder existed...\n", usr_path) error_log = None folder_abs_path = os.path.abspath(usr_path) - print('abs path of folder\n', folder_abs_path) - # else: - # if platform == "linux" or platform == "linux2": - # l_cwd = os.getcwd() - # os.chdir('/') - # if os.path.isdir(usr_path): - # print('Folder existed...\n', usr_path) - # error_log = None - # folder_abs_path = os.path.abspath(usr_path) - # print('abs path of folder\n', folder_abs_path) - # else: - # if os.path.isdir('/' + usr_path): - # print('Folder existed...\n', usr_path) - # error_log = None - # folder_abs_path = os.path.abspath(usr_path) - # print('abs path of folder\n', folder_abs_path) - # else: - # print('No folder...\n', usr_path) - # os.makedirs(usr_path) - # print('Folder created... %s' % usr_path) - # error_log = '' - # os.chdir(l_cwd) + print("abs path of folder\n", folder_abs_path) else: - print('No folder...\n', usr_path) + print("No folder...\n", usr_path) os.makedirs(usr_path) - print('Folder created... %s' % usr_path) - error_log = '' + print("Folder created... %s" % usr_path) + folder_abs_path = os.path.abspath(usr_path) + error_log = None except IOError: - error_log = '!! Failed to open folder {_file} !!'.format(_file=info_str) + error_log = "!! Failed to open folder {_file} !!".format(_file=info_str) return folder_abs_path, error_log def a_load_xlsx(self): - file_info_str = 'FA white list files (*.xlsx *.XLSX)' + file_info_str = "FA white list files (*.xlsx *.XLSX)" self.open_file(file_info_str, self.ui.tab_a_loadfalist_le) def a_loadscore_xlsx(self): - file_info_str = 'Weight list files (*.xlsx *.XLSX)' + file_info_str = "Weight list files (*.xlsx *.XLSX)" self.open_file(file_info_str, self.ui.tab_a_loadscorecfg_le) # def a_go_generator(self): # self.ui.tabframe.setCurrentIndex(3) def a_load_mzml(self): - file_info_str = 'mzML spectra files (*.mzML *.mzml)' + file_info_str = "mzML spectra files (*.mzML *.mzml)" self.open_file(file_info_str, self.ui.tab_a_mzml_le) def a_save_img2folder(self): - a_save_img2folder_str = QtGui.QFileDialog.getExistingDirectory() + a_save_img2folder_str = QtWidgets.QFileDialog.getExistingDirectory() self.ui.tab_a_saveimgfolder_le.clear() self.ui.tab_a_saveimgfolder_le.setText(a_save_img2folder_str) def a_save_output(self): - a_save_output_path = QtGui.QFileDialog.getSaveFileName(caption='Save file', filter='.xlsx') + a_save_output_path = QtWidgets.QFileDialog.getSaveFileName( + caption="Save file", filter=".xlsx" + ) self.ui.tab_a_savexlsxpath_le.clear() usr_output_path = a_save_output_path[0] - if usr_output_path[-5:] != '.xlsx': - usr_output_path += '.xlsx' + if usr_output_path[-5:] != ".xlsx": + usr_output_path += ".xlsx" a_save_output_str = os.path.abspath(usr_output_path) self.ui.tab_a_savexlsxpath_le.setText(a_save_output_str) @@ -435,7 +539,9 @@ def a_save_output(self): def a_max_ms(self): if self.ui.tab_a_msmax_chb.isChecked(): self.ui.tab_a_msmax_spb.show() - self.ui.tab_a_msmax_spb.setValue(100 * self.ui.tab_a_msthreshold_spb.value()) + self.ui.tab_a_msmax_spb.setValue( + 100 * self.ui.tab_a_msthreshold_spb.value() + ) else: self.ui.tab_a_msmax_spb.hide() self.ui.tab_a_msmax_spb.setValue(0) @@ -450,7 +556,7 @@ def a_set_static_mode(self): def a_lipid_class_fa_list(self): _lipid_class_info = str(self.ui.tab_a_lipidclass_cmb.currentText()) - lipid_class_checker = re.compile(r'(.*)( [(])(\w{2,3})([)] )(.*)') + lipid_class_checker = re.compile(r"(.*)( [(])(\w{2,3})([)] )(.*)") lipid_class_match = lipid_class_checker.match(_lipid_class_info) if lipid_class_match: @@ -458,8 +564,8 @@ def a_lipid_class_fa_list(self): _lipid_class = lipid_class_info_lst[2] _lipid_charge = lipid_class_info_lst[4] else: - _lipid_class = '' - _lipid_charge = '' + _lipid_class = "" + _lipid_charge = "" pl_fa_cfg = self.ui.tab_c_falistpl_le.text() lpl_score_cfg = self.ui.tab_c_falisttg_le.text() @@ -469,82 +575,82 @@ def a_lipid_class_fa_list(self): usr_fa_cfg = self.ui.tab_a_loadfalist_le.text() usr_score_cfg = self.ui.tab_a_loadscorecfg_le.text() - if _lipid_class in ['PA', 'PC', 'PE', 'PG', 'PI', 'PIP', 'PS']: - # if usr_fa_cfg in ['', tg_fa_cfg]: + if _lipid_class in ["PA", "PC", "PE", "PG", "PI", "PIP", "PS"]: self.ui.tab_a_loadfalist_le.setText(pl_fa_cfg) - # if usr_score_cfg in ['', dg_score_cfg, tg_score_cfg]: self.ui.tab_a_loadscorecfg_le.setText(pl_score_cfg) - self.ui.tab_a_mzstart_dspb.setValue(600) - self.ui.tab_a_mzend_dspb.setValue(1000) - self.ui.tab_a_score_spb.setValue(40) - if self.ui.mode_lcms_rb.isChecked(): - self.ui.tab_a_rtstart_dspb.setValue(10.0) - self.ui.tab_a_rtend_dspb.setValue(25.0) - elif _lipid_class in ['LPA', 'LPC', 'LPE', 'LPG', 'LPI', 'LPIP', 'LPS']: - # if usr_fa_cfg in ['', tg_fa_cfg]: + # self.ui.tab_a_mzstart_dspb.setValue(600) + # self.ui.tab_a_mzend_dspb.setValue(1000) + # self.ui.tab_a_score_spb.setValue(40) + # if self.ui.mode_lcms_rb.isChecked(): + # self.ui.tab_a_rtstart_dspb.setValue(10.0) + # self.ui.tab_a_rtend_dspb.setValue(25.0) + elif _lipid_class in ["LPA", "LPC", "LPE", "LPG", "LPI", "LPIP", "LPS"]: self.ui.tab_a_loadfalist_le.setText(pl_fa_cfg) - # if usr_score_cfg in ['', dg_score_cfg, tg_score_cfg]: self.ui.tab_a_loadscorecfg_le.setText(lpl_score_cfg) - self.ui.tab_a_mzstart_dspb.setValue(300) - self.ui.tab_a_mzend_dspb.setValue(800) - self.ui.tab_a_score_spb.setValue(25) - if self.ui.mode_lcms_rb.isChecked(): - self.ui.tab_a_rtstart_dspb.setValue(3.0) - self.ui.tab_a_rtend_dspb.setValue(15.0) - elif _lipid_class in ['TG', 'DG', 'MG']: - # if usr_fa_cfg in ['', pl_fa_cfg]: + # self.ui.tab_a_mzstart_dspb.setValue(300) + # self.ui.tab_a_mzend_dspb.setValue(800) + # self.ui.tab_a_score_spb.setValue(25) + # if self.ui.mode_lcms_rb.isChecked(): + # self.ui.tab_a_rtstart_dspb.setValue(3.0) + # self.ui.tab_a_rtend_dspb.setValue(15.0) + elif _lipid_class in ["TG", "DG", "MG"]: self.ui.tab_a_loadfalist_le.setText(pl_fa_cfg) - self.ui.tab_a_mzstart_dspb.setValue(600) - self.ui.tab_a_mzend_dspb.setValue(1200) - self.ui.tab_a_score_spb.setValue(50) - if self.ui.mode_lcms_rb.isChecked(): - self.ui.tab_a_rtstart_dspb.setValue(20.0) - self.ui.tab_a_rtend_dspb.setValue(30.0) - if _lipid_class in ['TG'] and _lipid_charge not in ['[M+Na]+']: - # if usr_score_cfg in ['', pl_score_cfg, dg_score_cfg]: + # self.ui.tab_a_mzstart_dspb.setValue(600) + # self.ui.tab_a_mzend_dspb.setValue(1200) + # self.ui.tab_a_score_spb.setValue(50) + # if self.ui.mode_lcms_rb.isChecked(): + # self.ui.tab_a_rtstart_dspb.setValue(20.0) + # self.ui.tab_a_rtend_dspb.setValue(30.0) + if _lipid_class in ["TG"] and _lipid_charge not in ["[M+Na]+"]: self.ui.tab_a_loadscorecfg_le.setText(tg_score_cfg) - elif _lipid_class in ['TG'] and _lipid_charge in ['[M+Na]+']: - tg_na_abs_path, error_log = self.check_file('.\ConfigurationFiles\\2-Score_weight_TG_Na.xlsx', - 'TG [M+Na]+ Weight factor' - ) + elif _lipid_class in ["TG"] and _lipid_charge in ["[M+Na]+"]: + tg_na_abs_path, error_log = self.check_file( + "./ConfigurationFiles/2-Score_weight_TG_Na.xlsx", + "TG [M+Na]+ Weight factor", + ) self.ui.tab_a_loadscorecfg_le.setText(tg_na_abs_path) - elif _lipid_class in ['DG']: - # if usr_score_cfg in ['', pl_score_cfg, tg_score_cfg]: + elif _lipid_class in ["DG"]: self.ui.tab_a_loadscorecfg_le.setText(dg_score_cfg) - self.ui.tab_a_mzstart_dspb.setValue(300) - self.ui.tab_a_mzend_dspb.setValue(900) - self.ui.tab_a_score_spb.setValue(40) - if self.ui.mode_lcms_rb.isChecked(): - self.ui.tab_a_rtstart_dspb.setValue(10.0) - self.ui.tab_a_rtend_dspb.setValue(20.0) + # self.ui.tab_a_mzstart_dspb.setValue(300) + # self.ui.tab_a_mzend_dspb.setValue(900) + # self.ui.tab_a_score_spb.setValue(40) + # if self.ui.mode_lcms_rb.isChecked(): + # self.ui.tab_a_rtstart_dspb.setValue(10.0) + # self.ui.tab_a_rtend_dspb.setValue(20.0) else: - self.ui.tab_a_loadscorecfg_le.setText('') + self.ui.tab_a_loadscorecfg_le.setText("") else: - self.ui.tab_a_loadfalist_le.setText('') - self.ui.tab_a_loadscorecfg_le.setText('') + self.ui.tab_a_loadfalist_le.setText("") + self.ui.tab_a_loadscorecfg_le.setText("") def a_get_params(self): error_log_lst = [] usr_vendor_str = self.ui.vendor_cmb.currentText().lower() - vendors_dct = {'therm': 'thermo', 'water': 'waters', 'sciex': 'sciex', 'agile': 'agilent'} + vendors_dct = { + "therm": "thermo", + "water": "waters", + "sciex": "sciex", + "bruke": "bruker", + "agile": "agilent", + } if usr_vendor_str[0:5] in list(vendors_dct.keys()): usr_vendor = vendors_dct[usr_vendor_str[0:5]] else: - usr_vendor = '' - error_log_lst.append('!! Please select an instrument vendor!!') + usr_vendor = "" + error_log_lst.append("!! Please select an instrument vendor!!") if self.ui.mode_lcms_rb.isChecked(): - usr_exp_mode = 'LC-MS' + usr_exp_mode = "LC-MS" elif self.ui.mode_static_rb.isChecked(): - usr_exp_mode = 'Shotgun' + usr_exp_mode = "Shotgun" else: - usr_exp_mode = 'LC-MS' + usr_exp_mode = "LC-MS" _lipid_class_info = str(self.ui.tab_a_lipidclass_cmb.currentText()) - lipid_class_checker = re.compile(r'(.*)( [(])(\w{2,3})([)] )(.*)') + lipid_class_checker = re.compile(r"(.*)( [(])(\w{2,3})([)] )(.*)") lipid_class_match = lipid_class_checker.match(_lipid_class_info) @@ -553,9 +659,9 @@ def a_get_params(self): _lipid_class = lipid_class_info_lst[2] _lipid_charge = lipid_class_info_lst[4] else: - _lipid_class = '' - _lipid_charge = '' - error_log_lst.append('!! Please select a lipid class!!') + _lipid_class = "" + _lipid_charge = "" + error_log_lst.append("!! Please select a lipid class!!") # if _lipid_class in ['PA', 'PC', 'PE', 'PG', 'PI', 'PIP', 'PS']: # score_cfg = self.ui.tab_a_loadscorecfg_le.text() @@ -569,15 +675,15 @@ def a_get_params(self): fawhitelist_path_str = str(self.ui.tab_a_loadfalist_le.text()) mzml_path_str = str(self.ui.tab_a_mzml_le.text()) img_output_folder_str = str(self.ui.tab_a_saveimgfolder_le.text()) - if img_output_folder_str[-1] in ['\\', '/']: + if img_output_folder_str[-1] in ["\\", "/"]: img_output_folder_str = img_output_folder_str[:-1] self.ui.tab_a_saveimgfolder_le.clear() self.ui.tab_a_saveimgfolder_le.setText(img_output_folder_str) else: pass xlsx_output_path_str = str(self.ui.tab_a_savexlsxpath_le.text()) - if xlsx_output_path_str[-5:] != '.xlsx': - xlsx_output_path_str += '.xlsx' + if xlsx_output_path_str[-5:] != ".xlsx": + xlsx_output_path_str += ".xlsx" self.ui.tab_a_savexlsxpath_le.clear() self.ui.tab_a_savexlsxpath_le.setText(xlsx_output_path_str) @@ -596,7 +702,10 @@ def a_get_params(self): ms2_info_threshold = self.ui.tab_a_ms2infoth_dspb.value() * 0.01 ms_max = 0 - if self.ui.tab_a_msmax_chb.isChecked() and self.ui.tab_a_msmax_spb.value() > ms_th + 1: + if ( + self.ui.tab_a_msmax_chb.isChecked() + and self.ui.tab_a_msmax_spb.value() > ms_th + 1 + ): ms_max = self.ui.tab_a_msmax_spb.value() lipid_specific_cfg = self.ui.tab_c_hgcfg_le.text() @@ -605,37 +714,40 @@ def a_get_params(self): img_typ = self.ui.tab_c_imagetype_cmb.currentText()[1:] img_dpi = self.ui.tab_c_dpi_spb.value() - fawhitelist_path_str, error_log = self.check_file(fawhitelist_path_str, 'FA whitelist') + fawhitelist_path_str, error_log = self.check_file( + fawhitelist_path_str, "FA whitelist" + ) if error_log is not None: error_log_lst.append(error_log) - lipid_specific_cfg, error_log = self.check_file(lipid_specific_cfg, 'configuration for Phospholipids') + lipid_specific_cfg, error_log = self.check_file( + lipid_specific_cfg, "configuration for Phospholipids" + ) if error_log is not None: error_log_lst.append(error_log) - score_cfg, error_log = self.check_file(score_cfg, 'W_frag score configuration') + score_cfg, error_log = self.check_file(score_cfg, "W_frag score configuration") if error_log is not None: error_log_lst.append(error_log) - abs_img_output_folder_str, error_log = self.check_folder(img_output_folder_str, 'Output folder') + abs_img_output_folder_str, error_log = self.check_folder( + img_output_folder_str, "Output folder" + ) if error_log is not None: error_log_lst.append(error_log) - self.ui.tab_a_saveimgfolder_le.setText(error_log) else: - # if platform == "linux" or platform == "linux2": - # pass - # else: if abs_img_output_folder_str != img_output_folder_str: - self.ui.tab_a_saveimgfolder_le.clear() + # self.ui.tab_a_saveimgfolder_le.clear() self.ui.tab_a_saveimgfolder_le.setText(abs_img_output_folder_str) - print('!! Image output folder not correct !!') - print('>> Propose to save in folder: %s' % abs_img_output_folder_str) + print("!! Image output folder not correct !!") + print(">> Propose to save in the folder: %s" % abs_img_output_folder_str) + img_output_folder_str = abs_img_output_folder_str - if xlsx_output_path_str[-5:] == '.xlsx': + if xlsx_output_path_str[-5:] == ".xlsx": pass else: - xlsx_output_path_str = '%s.xlsx' % xlsx_output_path_str + xlsx_output_path_str = "%s.xlsx" % xlsx_output_path_str self.ui.tab_a_savexlsxpath_le.setText(xlsx_output_path_str) - error_log_lst.append('!! Excel output path not correct !!') - error_log_lst.append('>> Propose to save as: %s' % xlsx_output_path_str) + error_log_lst.append("!! Excel output path not correct !!") + error_log_lst.append(">> Propose to save as: %s" % xlsx_output_path_str) usr_score_mode = self.ui.tab_c_scoremode_cmb.currentIndex() if usr_score_mode == 0: @@ -658,46 +770,60 @@ def a_get_params(self): score_filter = rank_score_filter - hunter_param_dct = {'vendor': usr_vendor, 'experiment_mode': usr_exp_mode, - 'lipid_class': _lipid_class, 'charge_mode': _lipid_charge, - 'fawhitelist_path_str': fawhitelist_path_str, - 'score_cfg': score_cfg, - 'mzml_path_str': mzml_path_str, - 'img_output_folder_str': img_output_folder_str, - 'xlsx_output_path_str': xlsx_output_path_str, - 'rt_start': rt_start, 'rt_end': rt_end, - 'mz_start': mz_start, 'mz_end': mz_end, - 'dda_top': dda_top, 'pr_window': pr_window, - 'ms_th': ms_th, 'ms_ppm': ms_ppm, - 'ms2_th': ms2_th, 'ms2_ppm': ms2_ppm, 'ms2_infopeak_threshold': ms2_info_threshold, - 'rank_score_filter': rank_score_filter, 'score_filter': score_filter, - 'isotope_score_filter': isotope_score_filter, - 'lipid_specific_cfg': lipid_specific_cfg, - 'core_number': core_num, 'max_ram': max_ram, - 'img_type': img_typ, 'img_dpi': img_dpi, - 'hunter_folder': self.lipidhunter_cwd, - 'hunter_start_time': start_time_str, - } - debug_mode = 'OFF' - if debug_mode == 'ON': - hunter_param_dct['rank_score'] = rank_score - hunter_param_dct['tag_all_sn'] = tag_all_sn - hunter_param_dct['fast_isotope'] = fast_isotope - hunter_param_dct['ms_max'] = ms_max + hunter_param_dct = { + "vendor": usr_vendor, + "experiment_mode": usr_exp_mode, + "lipid_class": _lipid_class, + "charge_mode": _lipid_charge, + "fawhitelist_path_str": fawhitelist_path_str, + "score_cfg": score_cfg, + "mzml_path_str": mzml_path_str, + "img_output_folder_str": img_output_folder_str, + "xlsx_output_path_str": xlsx_output_path_str, + "rt_start": rt_start, + "rt_end": rt_end, + "mz_start": mz_start, + "mz_end": mz_end, + "dda_top": dda_top, + "pr_window": pr_window, + "ms_th": ms_th, + "ms_ppm": ms_ppm, + "ms2_th": ms2_th, + "ms2_ppm": ms2_ppm, + "ms2_infopeak_threshold": ms2_info_threshold, + "rank_score_filter": rank_score_filter, + "score_filter": score_filter, + "isotope_score_filter": isotope_score_filter, + "lipid_specific_cfg": lipid_specific_cfg, + "core_number": core_num, + "max_ram": max_ram, + "img_type": img_typ, + "img_dpi": img_dpi, + "hunter_folder": self.lipidhunter_cwd, + "hunter_start_time": start_time_str, + } + debug_mode = "OFF" + if debug_mode == "ON": + hunter_param_dct["rank_score"] = rank_score + hunter_param_dct["tag_all_sn"] = tag_all_sn + hunter_param_dct["fast_isotope"] = fast_isotope + hunter_param_dct["ms_max"] = ms_max else: - hunter_param_dct['rank_score'] = True - hunter_param_dct['tag_all_sn'] = True - hunter_param_dct['fast_isotope'] = False - hunter_param_dct['ms_max'] = 0 + hunter_param_dct["rank_score"] = True + hunter_param_dct["tag_all_sn"] = True + hunter_param_dct["fast_isotope"] = False + hunter_param_dct["ms_max"] = 0 return hunter_param_dct, error_log_lst def a_save_cfg(self): - a_save_cfg_path = QtGui.QFileDialog.getSaveFileName(caption='Save file', filter='.txt') + a_save_cfg_path = QtWidgets.QFileDialog.getSaveFileName( + caption="Save file", filter=".txt" + ) self.ui.tab_a_cfgpath_le.clear() usr_cfg_path = a_save_cfg_path[0] - if usr_cfg_path[-4:] != '.txt': - usr_cfg_path += '.txt' + if usr_cfg_path[-4:] != ".txt": + usr_cfg_path += ".txt" a_save_cfg_str = os.path.abspath(usr_cfg_path) self.ui.tab_a_cfgpath_le.setText(a_save_cfg_str) @@ -705,50 +831,65 @@ def a_create_cfg(self): param_cfg_path_str = str(self.ui.tab_a_cfgpath_le.text()) try: - if param_cfg_path_str[-4:] == '.txt': + if param_cfg_path_str[-4:] == ".txt": pass else: - param_cfg_path_str = '%s.txt' % param_cfg_path_str + param_cfg_path_str = "%s.txt" % param_cfg_path_str self.ui.tab_a_cfgpath_le.clear() self.ui.tab_a_cfgpath_le.setText(param_cfg_path_str) param_cfg_directory = os.path.dirname(param_cfg_path_str) if not os.path.exists(param_cfg_directory): os.makedirs(param_cfg_directory) - abs_param_cfg_directory_str, error_log = self.check_folder(param_cfg_directory, 'Settings for batch mode') + abs_param_cfg_directory_str, error_log = self.check_folder( + param_cfg_directory, "Settings for batch mode" + ) if error_log is not None: self.ui.tab_a_gencfg_pte.insertPlainText(error_log) if abs_param_cfg_directory_str != param_cfg_directory: param_cfg_path = os.path.split(param_cfg_path_str) - param_cfg_path_str = os.path.join(abs_param_cfg_directory_str, param_cfg_path[1]) - self.ui.tab_a_gencfg_pte.insertPlainText('>>> try to save as: %s\n' % param_cfg_path_str) + param_cfg_path_str = os.path.join( + abs_param_cfg_directory_str, param_cfg_path[1] + ) + self.ui.tab_a_gencfg_pte.insertPlainText( + ">>> try to save as: %s\n" % param_cfg_path_str + ) except Exception as _err: print(_err) - self.ui.tab_a_gencfg_pte.insertPlainText('!!! Failed to save settings for batch mode !!!\n') - self.ui.tab_a_gencfg_pte.insertPlainText('!! Can not save settings to file !!\n') + self.ui.tab_a_gencfg_pte.insertPlainText( + "!!! Failed to save settings for batch mode !!!\n" + ) + self.ui.tab_a_gencfg_pte.insertPlainText( + "!! Can not save settings to file !!\n" + ) self.ui.tab_a_gencfg_pte.insertPlainText(str(_err)) hunter_param_dct, error_log_lst = self.a_get_params() error_log_lst = [_f for _f in error_log_lst if _f] if len(error_log_lst) > 0: - print('Parameter error:', error_log_lst) - error_log_lst.append('!!! Failed to save settings for batch mode !!!') - error_log_lst.append('>>> Please check your settings, and try to save again ...\n') - self.ui.tab_a_gencfg_pte.appendPlainText('\n'.join(error_log_lst) + '\n') + print("Parameter error:", error_log_lst) + error_log_lst.append("!!! Failed to save settings for batch mode !!!") + error_log_lst.append( + ">>> Please check your settings, and try to save again ...\n" + ) + self.ui.tab_a_gencfg_pte.appendPlainText("\n".join(error_log_lst) + "\n") else: try: - config = configparser.ConfigParser() - with open(param_cfg_path_str, 'w') as usr_param_cfg: - config.add_section('parameters') + with open(param_cfg_path_str, "w") as usr_param_cfg: + config.add_section("parameters") for param in list(hunter_param_dct.keys()): - config.set('parameters', str(param), str(hunter_param_dct[param])) + config.set( + "parameters", str(param), str(hunter_param_dct[param]) + ) config.write(usr_param_cfg) - self.ui.tab_a_gencfg_pte.insertPlainText('>>> Successfully saved as: \n') + self.ui.tab_a_gencfg_pte.insertPlainText( + ">>> Successfully saved as: \n" + ) self.ui.tab_a_gencfg_pte.insertPlainText(param_cfg_path_str) - self.ui.tab_a_gencfg_pte.insertPlainText('\n') + self.ui.tab_a_gencfg_pte.insertPlainText("\n") except Exception as _err: print(_err) self.ui.tab_a_gencfg_pte.insertPlainText(str(_err)) @@ -758,7 +899,7 @@ def b_set_multi_mode(self): multi_mode_idx = self.ui.tab_b_mutlimode_cmb.currentIndex() if multi_mode_idx == 1: - print('Set Batch mode to: Multi processing mode') + print("Set Batch mode to: Multi processing mode") self.ui.tab_b_maxbatch_lb.show() self.ui.tab_b_maxbatch_spb.show() self.ui.tab_b_maxsubcore_lb.show() @@ -766,7 +907,7 @@ def b_set_multi_mode(self): self.ui.tab_b_maxsubram_lb.show() self.ui.tab_b_maxsubram_spb.show() elif multi_mode_idx == 0: - print('Set Batch mode to: Single processing mode') + print("Set Batch mode to: Single processing mode") self.ui.tab_b_maxbatch_lb.hide() self.ui.tab_b_maxbatch_spb.hide() self.ui.tab_b_maxsubcore_lb.hide() @@ -777,7 +918,7 @@ def b_set_multi_mode(self): @staticmethod def b_get_same_files(folder, filetype_lst): - if folder is not '': + if folder is not "": os.chdir(folder) _pre_found_lst = [] for _filetype in filetype_lst: @@ -795,53 +936,76 @@ def b_get_same_files(folder, filetype_lst): def b_load_batchcfg(self): # check existed files _loaded_files = str(self.ui.tab_b_infiles_pte.toPlainText()) - _loaded_lst = _loaded_files.split('\n') + _loaded_lst = _loaded_files.split("\n") - b_load_cfg_dialog = QtGui.QFileDialog(self) - b_load_cfg_dialog.setNameFilters(['LipidHunter batch mode files (*.txt)']) - b_load_cfg_dialog.selectNameFilter('LipidHunter batch mode files (*.txt)') + b_load_cfg_dialog = QtWidgets.QFileDialog(self) + b_load_cfg_dialog.setNameFilters(["LipidHunter batch mode files (*.txt)"]) + b_load_cfg_dialog.selectNameFilter("LipidHunter batch mode files (*.txt)") if b_load_cfg_dialog.exec_(): b_load_cfg_str = b_load_cfg_dialog.selectedFiles()[0] b_load_cfg_str = os.path.abspath(b_load_cfg_str) if b_load_cfg_str not in _loaded_lst: - self.ui.tab_b_infiles_pte.insertPlainText(b_load_cfg_str) # take unicode only - self.ui.tab_b_infiles_pte.insertPlainText('\n') + self.ui.tab_b_infiles_pte.insertPlainText( + b_load_cfg_str + ) # take unicode only + self.ui.tab_b_infiles_pte.insertPlainText("\n") else: - _msgBox = QtGui.QMessageBox() - _msgBox.setText('Batch config file has been chosen already.') + _msgBox = QtWidgets.QMessageBox() + _msgBox.setText("Batch config file has been chosen already.") _msgBox.exec_() def b_load_batchcfgfolder(self): # check existed files _loaded_files = str(self.ui.tab_b_infiles_pte.toPlainText()) - _loaded_lst = _loaded_files.split('\n') + _loaded_lst = _loaded_files.split("\n") - b_load_cfgfolder_str = QtGui.QFileDialog.getExistingDirectory() - _cfg_name_lst, _cfg_path_lst = self.b_get_same_files(b_load_cfgfolder_str, filetype_lst=['*.txt', '*.txt']) - _duplicated_str = '' + b_load_cfgfolder_str = QtWidgets.QFileDialog.getExistingDirectory() + _cfg_name_lst, _cfg_path_lst = self.b_get_same_files( + b_load_cfgfolder_str, filetype_lst=["*.txt", "*.txt"] + ) + _duplicated_str = "" for _cfg in _cfg_path_lst: if _cfg not in _loaded_lst: self.ui.tab_b_infiles_pte.insertPlainText(_cfg) - self.ui.tab_b_infiles_pte.insertPlainText('\n') + self.ui.tab_b_infiles_pte.insertPlainText("\n") else: - _duplicated_str = _duplicated_str + _cfg + '\n' + _duplicated_str = _duplicated_str + _cfg + "\n" if len(_duplicated_str) > 0: - _msgBox = QtGui.QMessageBox() - _msgBox.setText(_duplicated_str + 'Already chosen. \n Skipped') + _msgBox = QtWidgets.QMessageBox() + _msgBox.setText(_duplicated_str + "Already chosen. \n Skipped") _msgBox.exec_() @staticmethod def b_read_cfg(batch_cfg): cfg_params_dct = {} - cfg_error = '' - - i_type_key_lst = ['ms_th', 'ms2_th', 'ms_ppm', 'ms2_ppm', 'dda_top', 'sn_ratio', - 'core_number', 'max_ram', 'img_dpi', 'ms_max'] - f_type_key_lst = ['rt_start', 'rt_end', 'mz_start', 'mz_end', 'pr_window', 'ms2_infopeak_threshold', - 'score_filter', 'isotope_score_filter', 'rank_score_filter'] - b_type_key_lst = ['rank_score', 'fast_isotope', 'tag_all_sn'] - - print('Input LipidHunter configuration file : ', batch_cfg) + cfg_error = "" + + i_type_key_lst = [ + "ms_th", + "ms2_th", + "ms_ppm", + "ms2_ppm", + "dda_top", + "sn_ratio", + "core_number", + "max_ram", + "img_dpi", + "ms_max", + ] + f_type_key_lst = [ + "rt_start", + "rt_end", + "mz_start", + "mz_end", + "pr_window", + "ms2_infopeak_threshold", + "score_filter", + "isotope_score_filter", + "rank_score_filter", + ] + b_type_key_lst = ["rank_score", "fast_isotope", "tag_all_sn"] + + print("Input LipidHunter configuration file : ", batch_cfg) if os.path.isfile(batch_cfg): with open(batch_cfg) as _cfg_obj: config = configparser.ConfigParser() @@ -850,8 +1014,8 @@ def b_read_cfg(batch_cfg): config.read_file(_cfg_obj) except AttributeError: # for python 2.7.14 config.readfp(_cfg_obj) - if config.has_section('parameters'): - usr_cfg = 'parameters' + if config.has_section("parameters"): + usr_cfg = "parameters" options = config.options(usr_cfg) for param in options: _val = config.get(usr_cfg, param) @@ -863,113 +1027,125 @@ def b_read_cfg(batch_cfg): elif param in f_type_key_lst: cfg_params_dct[param] = float(_val) elif param in b_type_key_lst: - if _val.lower() == 'true': + if _val.lower() == "true": cfg_params_dct[param] = True - if _val.lower() == 'false': + if _val.lower() == "false": cfg_params_dct[param] = False else: cfg_params_dct[param] = _val except Exception as _cfg_e: - print('ERROR', _cfg_e) + print("ERROR", _cfg_e) cfg_error += str(_cfg_e) - cfg_error += '\n' + cfg_error += "\n" return cfg_params_dct, cfg_error def c_set_default_cfg(self): config = configparser.ConfigParser() - with open('config.ini', 'w') as default_cfg: - config.add_section('settings') - config.set('settings', 'fa_white_list_cfg_pl', self.ui.tab_c_falistpl_le.text()) - config.set('settings', 'fa_white_list_cfg_tg', self.ui.tab_c_falisttg_le.text()) - config.set('settings', 'score_cfg_pl', self.ui.tab_c_scorecfgpl_le.text()) - config.set('settings', 'score_cfg_tg', self.ui.tab_c_scorecfgtg_le.text()) - config.set('settings', 'score_cfg_dg', self.ui.tab_c_scorecfgdg_le.text()) - config.set('settings', 'lipid_specific_cfg', self.ui.tab_c_hgcfg_le.text()) + with open("config.ini", "w") as default_cfg: + config.add_section("settings") + config.set( + "settings", "fa_white_list_cfg_pl", self.ui.tab_c_falistpl_le.text() + ) + config.set( + "settings", "fa_white_list_cfg_tg", self.ui.tab_c_falisttg_le.text() + ) + config.set("settings", "score_cfg_pl", self.ui.tab_c_scorecfgpl_le.text()) + config.set("settings", "score_cfg_tg", self.ui.tab_c_scorecfgtg_le.text()) + config.set("settings", "score_cfg_dg", self.ui.tab_c_scorecfgdg_le.text()) + config.set("settings", "lipid_specific_cfg", self.ui.tab_c_hgcfg_le.text()) if self.ui.tab_c_scoremode_cmb.currentIndex() == 0: - config.set('settings', 'score_mode', 'RANK') + config.set("settings", "score_mode", "RANK") elif self.ui.tab_c_scoremode_cmb.currentIndex() == 1: - config.set('settings', 'score_mode', 'INTENSITY') + config.set("settings", "score_mode", "INTENSITY") else: - config.set('settings', 'score_mode', 'RANK') + config.set("settings", "score_mode", "RANK") if self.ui.tab_c_isotopescoremode_cmb.currentIndex() == 1: - config.set('settings', 'isotope_13c_mode', 'ON') + config.set("settings", "isotope_13c_mode", "ON") else: - config.set('settings', 'isotope_13c_mode', 'OFF') + config.set("settings", "isotope_13c_mode", "OFF") # parallel processing settings if self.ui.tab_c_parallization_cmb.currentIndex() == 0: - config.set('settings', 'parallel_target', 'CPU') + config.set("settings", "parallel_target", "CPU") elif self.ui.tab_c_parallization_cmb.currentIndex() == 1: - config.set('settings', 'parallel_target', 'CPU_and_GPU') + config.set("settings", "parallel_target", "CPU_and_GPU") else: - config.set('settings', 'parallel_target', 'CPU') - config.set('settings', 'max_cpu_core', str(self.ui.tab_c_cores_spb.value())) - config.set('settings', 'max_ram', str(self.ui.tab_c_ram_spb.value())) + config.set("settings", "parallel_target", "CPU") + config.set("settings", "max_cpu_core", str(self.ui.tab_c_cores_spb.value())) + config.set("settings", "max_ram", str(self.ui.tab_c_ram_spb.value())) # other settings - config.set('settings', 'img_type', str(self.ui.tab_c_imagetype_cmb.currentText()).upper()[1:]) - config.set('settings', 'img_dpi', str(self.ui.tab_c_dpi_spb.value())) + config.set( + "settings", + "img_type", + str(self.ui.tab_c_imagetype_cmb.currentText()).upper()[1:], + ) + config.set("settings", "img_dpi", str(self.ui.tab_c_dpi_spb.value())) if self.ui.tab_c_tag_all_fa_chb.isChecked(): - config.set('settings', 'tag_all_fa_check', 'ON') + config.set("settings", "tag_all_fa_check", "ON") else: - config.set('settings', 'tag_all_fa_check', 'OFF') + config.set("settings", "tag_all_fa_check", "OFF") - config.set('settings', 'main_tab', '1') - config.set('settings', 'runhunter_tab', '1') - config.set('settings', 'lipidgen_tab', '1') - config.set('settings', 'default_vendor', '0') - config.set('settings', 'default_lipid', '0') + config.set("settings", "main_tab", "1") + config.set("settings", "runhunter_tab", "1") + config.set("settings", "lipidgen_tab", "1") + config.set("settings", "default_vendor", "0") + config.set("settings", "default_lipid", "0") config.write(default_cfg) def c_load_falist_pl(self): - file_info_str = 'FA white list files (*.xlsx *.XLSX)' + file_info_str = "FA white list files (*.xlsx *.XLSX)" self.open_file(file_info_str, self.ui.tab_c_falistpl_le) def c_load_falist_tg(self): - file_info_str = 'FA white list files (*.xlsx *.XLSX)' + file_info_str = "FA white list files (*.xlsx *.XLSX)" self.open_file(file_info_str, self.ui.tab_c_falisttg_le) def c_load_falist_dg(self): - file_info_str = 'FA white list files (*.xlsx *.XLSX)' + file_info_str = "FA white list files (*.xlsx *.XLSX)" self.open_file(file_info_str, self.ui.tab_c_lmcalcfalist_le) def c_load_hgcfg(self): - file_info_str = 'MS Excel files (*.xlsx *.XLSX)' + file_info_str = "MS Excel files (*.xlsx *.XLSX)" self.open_file(file_info_str, self.ui.tab_c_hgcfg_le) def c_load_scorecfg_pl(self): - file_info_str = 'MS Excel files (*.xlsx *.XLSX)' + file_info_str = "MS Excel files (*.xlsx *.XLSX)" self.open_file(file_info_str, self.ui.tab_c_scorecfgpl_le) def c_load_scorecfg_tg(self): - file_info_str = 'MS Excel files (*.xlsx *.XLSX)' + file_info_str = "MS Excel files (*.xlsx *.XLSX)" self.open_file(file_info_str, self.ui.tab_c_scorecfgtg_le) def c_load_scorecfg_dg(self): - file_info_str = 'MS Excel files (*.xlsx *.XLSX)' + file_info_str = "MS Excel files (*.xlsx *.XLSX)" self.open_file(file_info_str, self.ui.tab_c_scorecfgdg_le) def c_lmexport(self): - c_lmexport_path = QtGui.QFileDialog.getSaveFileName(caption='Save file', filter='.csv') + c_lmexport_path = QtWidgets.QFileDialog.getSaveFileName( + caption="Save file", filter=".csv" + ) self.ui.tab_c_lmexport_le.clear() usr_lm_path = c_lmexport_path[0] - if usr_lm_path[-4:] != '.csv': - usr_lm_path += '.csv' + if usr_lm_path[-4:] != ".csv": + usr_lm_path += ".csv" c_lmexport_str = os.path.abspath(usr_lm_path) self.ui.tab_c_lmexport_le.setText(c_lmexport_str) def single_worker_on_finish(self): self.single_thread.quit() - print('!! single_worker stopped !!') - self.ui.tab_a_runhunter_pb.setText(QtGui.QApplication.translate('MainWindow', 'Hunt for lipids!', None, - QtGui.QApplication.UnicodeUTF8)) + print("!! single_worker stopped !!") + self.ui.tab_a_runhunter_pb.setText("Hunt for lipids!") self.ui.tab_a_runhunter_pgb.setMinimum(0) self.ui.tab_a_runhunter_pgb.setMaximum(100) + fin_msg_box = QtWidgets.QMessageBox() + fin_msg_box.setText("LipidHunter Finished!") + fin_msg_box.exec_() self.ui.tab_a_runhunter_pgb.hide() self.ui.tab_a_runhunter_pb.setEnabled(True) self.ui.tab_b_runbatch_pb.setEnabled(True) @@ -978,77 +1154,89 @@ def single_worker_on_finish(self): def single_worker_hunter(self): self.ui.tab_a_statusrun_pte.clear() - self.ui.tab_a_statusrun_pte.setPlainText('') + self.ui.tab_a_statusrun_pte.setPlainText("") ready_to_run = False hunter_param_dct, error_log_lst = self.a_get_params() - print('Vendor mode = %s, Experiment mode = %s' % (hunter_param_dct['vendor'], - hunter_param_dct['experiment_mode'])) - print('Isotope score mode = %s' % (hunter_param_dct['fast_isotope'])) - print('Rankscore mode = %s' % (hunter_param_dct['rank_score'])) - print('Hunter started!') + print( + "Vendor mode = %s, Experiment mode = %s" + % (hunter_param_dct["vendor"], hunter_param_dct["experiment_mode"]) + ) + print("Isotope score mode = %s" % (hunter_param_dct["fast_isotope"])) + print("Rankscore mode = %s" % (hunter_param_dct["rank_score"])) + print("Hunter started!") - output_folder_path = hunter_param_dct['img_output_folder_str'] + output_folder_path = hunter_param_dct["img_output_folder_str"] if platform == "linux" or platform == "linux2": l_cwd = os.getcwd() - os.chdir('/') + os.chdir("/") if os.path.isdir(output_folder_path): - print('Folder existed...\n', output_folder_path) + print("Folder existed...\n", output_folder_path) error_log = None folder_abs_path = os.path.abspath(output_folder_path) - print('abs path of folder\n', folder_abs_path) + print("abs path of folder\n", folder_abs_path) else: - if os.path.isdir('/' + output_folder_path): - print('Folder existed...\n', output_folder_path) + if os.path.isdir("/" + output_folder_path): + print("Folder existed...\n", output_folder_path) error_log = None folder_abs_path = os.path.abspath(output_folder_path) - print('abs path of folder\n', folder_abs_path) + print("abs path of folder\n", folder_abs_path) else: - print('No folder...\n', output_folder_path) + print("No folder...\n", output_folder_path) os.makedirs(output_folder_path) - print('Folder created... %s' % output_folder_path) - error_log = '' + print("Folder created... %s" % output_folder_path) + self.ui.tab_a_statusrun_pte.appendPlainText( + "Folder created... %s" % output_folder_path + ) + error_log = "" os.chdir(l_cwd) else: if os.path.isdir(output_folder_path): - print('Output folder path... %s' % output_folder_path) + print("Output folder path... %s" % output_folder_path) else: try: os.mkdir(output_folder_path) - print('Output folder created... %s' % output_folder_path) + print("Output folder created... %s" % output_folder_path) + self.ui.tab_a_statusrun_pte.appendPlainText( + "Folder created... %s" % output_folder_path + ) except IOError: - error_log_lst.append('!! Failed to create output folder !!') + error_log_lst.append("!! Failed to create output folder !!") - param_log_output_path_str = os.path.join(output_folder_path + '/LipidHunter_Params-Log_%s.txt' - % hunter_param_dct['hunter_start_time']) - print('param_log_output_path_str', param_log_output_path_str) + param_log_output_path_str = os.path.join( + output_folder_path + + "/LipidHunter_Params-Log_%s.txt" % hunter_param_dct["hunter_start_time"] + ) + print("param_log_output_path_str", param_log_output_path_str) try: config = configparser.ConfigParser() - with open(param_log_output_path_str, 'w') as usr_param_cfg: - config.add_section('parameters') + with open(param_log_output_path_str, "w") as usr_param_cfg: + config.add_section("parameters") for param in list(hunter_param_dct.keys()): - config.set('parameters', str(param), str(hunter_param_dct[param])) + config.set("parameters", str(param), str(hunter_param_dct[param])) config.write(usr_param_cfg) ready_to_run = True except IOError: - error_log_lst.append('!! Failed to save parameter log files !!\n%s' % param_log_output_path_str) + error_log_lst.append( + "!! Failed to save parameter log files !!\n%s" + % param_log_output_path_str + ) print(hunter_param_dct) error_log_lst = [_f for _f in error_log_lst if _f] if len(error_log_lst) > 0: - print('Parameter error:', error_log_lst) - error_log_lst.append('!!! Please check your settings !!!') - self.ui.tab_a_statusrun_pte.appendPlainText('\n'.join(error_log_lst)) + print("Parameter error:", error_log_lst) + error_log_lst.append("!!! Please check your settings !!!") + self.ui.tab_a_statusrun_pte.appendPlainText("\n".join(error_log_lst)) else: if ready_to_run is True: - self.ui.tab_a_runhunter_pb.setText(QtGui.QApplication.translate('MainWindow', 'Hunting ...', None, - QtGui.QApplication.UnicodeUTF8)) + self.ui.tab_a_runhunter_pb.setText("Hunting ...") self.ui.tab_a_runhunter_pb.setEnabled(False) self.ui.tab_b_runbatch_pb.setEnabled(False) self.ui.tab_c_lmrun_pb.setEnabled(False) @@ -1065,13 +1253,14 @@ def single_worker_info_update(self): def batch_worker_on_finish(self): self.batch_thread.quit() - print('!! batch_worker stopped !!') - self.ui.tab_b_runbatch_pb.setText(QtGui.QApplication.translate('MainWindow', - 'Run batch mode identification >>>', None, - QtGui.QApplication.UnicodeUTF8)) + print("!! batch_worker stopped !!") self.ui.tab_b_runbatch_pgb.setMinimum(0) self.ui.tab_b_runbatch_pgb.setMaximum(100) self.ui.tab_b_runbatch_pgb.hide() + fin_msg_box = QtWidgets.QMessageBox() + fin_msg_box.setText("LipidHunter Batch Mode Finished!") + fin_msg_box.exec_() + self.ui.tab_b_runbatch_pb.setText("Run batch mode identification >>>") self.ui.tab_b_runbatch_pb.setEnabled(True) self.ui.tab_a_runhunter_pb.setEnabled(True) self.ui.tab_c_lmrun_pb.setEnabled(True) @@ -1082,7 +1271,7 @@ def batch_worker_hunter(self): ready_to_run = False loaded_cfg_files = str(self.ui.tab_b_infiles_pte.toPlainText()) - pre_loaded_cfg_lst = loaded_cfg_files.split('\n') + pre_loaded_cfg_lst = loaded_cfg_files.split("\n") # max_process = self.ui.tab_b_maxbatch_spb.value() sub_max_core = self.ui.tab_b_maxsubcore_spb.value() @@ -1099,26 +1288,29 @@ def batch_worker_hunter(self): os.chdir(self.lipidhunter_cwd) cfg_params_dct = {} - self.ui.tab_b_statusrun_pte.appendPlainText('>>> Hunter started ... Total run number: %i \n\n' % tot_num) + self.ui.tab_b_statusrun_pte.appendPlainText( + ">>> Hunter started ... Total run number: %i \n\n" % tot_num + ) for _cfg in loaded_cfg_lst: hunter_param_dct, cfg_error = self.b_read_cfg(_cfg) if len(cfg_error) > 0: self.ui.tab_b_statusrun_pte.appendPlainText(str(cfg_error)) - if 'vendor' in list(hunter_param_dct.keys()): - hunter_param_dct['batch_cfg_file'] = _cfg - hunter_param_dct['core_number'] = sub_max_core - hunter_param_dct['max_ram'] = sub_max_ram + if "vendor" in list(hunter_param_dct.keys()): + hunter_param_dct["batch_cfg_file"] = _cfg + hunter_param_dct["core_number"] = sub_max_core + hunter_param_dct["max_ram"] = sub_max_ram # capability issues to old batch mode files - if 'lipid_class' in list(hunter_param_dct.keys()): - hunter_param_dct['lipid_type'] = hunter_param_dct['lipid_class'] + if "lipid_class" in list(hunter_param_dct.keys()): + hunter_param_dct["lipid_type"] = hunter_param_dct["lipid_class"] ready_to_run = True - elif 'lipid_type' in list(hunter_param_dct.keys()): - hunter_param_dct['lipid_class'] = hunter_param_dct['lipid_type'] + elif "lipid_type" in list(hunter_param_dct.keys()): + hunter_param_dct["lipid_class"] = hunter_param_dct["lipid_type"] self.ui.tab_b_statusrun_pte.appendPlainText( - '[WARNING] Please use "lipid_class" instead of "lipid_type" in your batch config file...\n') + '[WARNING] Please use "lipid_class" instead of "lipid_type" in your batch config file...\n' + ) ready_to_run = True else: ready_to_run = False @@ -1128,13 +1320,14 @@ def batch_worker_hunter(self): else: run_counter += 1 - self.ui.tab_b_statusrun_pte.appendPlainText('!! Failed to read batch mode configure files: # %i / %i\n' - '%s\n!! Please check your settings ' - '... skip this one ...\n' % (run_counter, tot_num, _cfg)) + self.ui.tab_b_statusrun_pte.appendPlainText( + "!! Failed to read batch mode configure files: # %i / %i\n" + "%s\n!! Please check your settings " + "... skip this one ...\n" % (run_counter, tot_num, _cfg) + ) if ready_to_run is True: - self.ui.tab_b_runbatch_pb.setText(QtGui.QApplication.translate('MainWindow', 'Hunting in batch mode ...', - None, QtGui.QApplication.UnicodeUTF8)) + self.ui.tab_b_runbatch_pb.setText("Hunting in batch mode ...") self.ui.tab_b_runbatch_pb.setEnabled(False) self.ui.tab_a_runhunter_pb.setEnabled(False) self.ui.tab_c_lmrun_pb.setEnabled(False) @@ -1144,20 +1337,20 @@ def batch_worker_hunter(self): self.batch_worker.request_work(cfg_params_dct, tot_num) else: - self.ui.tab_b_statusrun_pte.appendPlainText('!! Failed to read ALL batch mode configure files ...') + self.ui.tab_b_statusrun_pte.appendPlainText( + "!! Failed to read ALL batch mode configure files ..." + ) def batch_worker_info_update(self): back_info_str = self.batch_worker.infoback() - print('Got info: ', back_info_str) + print("Got info: ", back_info_str) self.ui.tab_b_statusrun_pte.appendPlainText(back_info_str) def lm_worker_on_finish(self): self.lm_thread.quit() - print('!! LipidMaster table export worker stopped !!') - self.ui.tab_c_lmrun_pb.setText(QtGui.QApplication.translate('MainWindow', - 'Generate Lipid Master table >>>', None, - QtGui.QApplication.UnicodeUTF8)) + print("!! LipidMaster table export worker stopped !!") + self.ui.tab_c_lmrun_pb.setText("Generate Lipid Master table >>>") self.ui.tab_b_runbatch_pb.setEnabled(True) self.ui.tab_a_runhunter_pb.setEnabled(True) self.ui.tab_c_lmrun_pb.setEnabled(True) @@ -1170,7 +1363,7 @@ def lm_worker_hunter(self): self.ui.tab_c_lmstatus_pte.clear() _lipid_class_info = str(self.ui.tab_c_lipidclass_cmb.currentText()) - lipid_class_checker = re.compile(r'(.*)( [(])(\w{2,3})([)] )(.*)') + lipid_class_checker = re.compile(r"(.*)( [(])(\w{2,3})([)] )(.*)") lipid_class_match = lipid_class_checker.match(_lipid_class_info) lipid_class_chosen = False @@ -1182,44 +1375,54 @@ def lm_worker_hunter(self): usr_lipid_charge = lipid_class_info_lst[4] lipid_class_chosen = True else: - usr_lipid_class = '' - usr_lipid_charge = '' - self.ui.tab_c_lmstatus_pte.appendPlainText('\n!! Please select a lipid class!!') + usr_lipid_class = "" + usr_lipid_charge = "" + self.ui.tab_c_lmstatus_pte.appendPlainText( + "\n!! Please select a lipid class!!" + ) usr_ms2_ppm = self.ui.tab_c_lmms2ppm_spb.value() fawhitelist_path_str = str(self.ui.tab_c_lmcalcfalist_le.text()) lm_export_path_str = str(self.ui.tab_c_lmexport_le.text()) - if lm_export_path_str[-4:] != '.csv': - lm_export_path_str += '.csv' + if lm_export_path_str[-4:] != ".csv": + lm_export_path_str += ".csv" self.ui.tab_c_lmexport_le.clear() self.ui.tab_c_lmexport_le.setText(lm_export_path_str) if os.path.isfile(fawhitelist_path_str): fa_list_chosen = True else: - self.ui.tab_c_lmstatus_pte.appendPlainText('\n!! Please select a FA list!!') + self.ui.tab_c_lmstatus_pte.appendPlainText("\n!! Please select a FA list!!") if len(lm_export_path_str) > 0: lm_export_chosen = True else: - self.ui.tab_c_lmstatus_pte.appendPlainText('\n!! Please select a location to save the LipidMaster table!!') + self.ui.tab_c_lmstatus_pte.appendPlainText( + "\n!! Please select a location to save the LipidMaster table!!" + ) - if lipid_class_chosen is True and fa_list_chosen is True and lm_export_chosen is True: + if ( + lipid_class_chosen is True + and fa_list_chosen is True + and lm_export_chosen is True + ): os.chdir(self.lipidhunter_cwd) - composer_param_dct = {'lipid_class': usr_lipid_class, - 'charge_mode': usr_lipid_charge, - 'exact_position': 'FALSE', - 'ms2ppm': usr_ms2_ppm, - 'fa_whitelist': fawhitelist_path_str, - 'export_path': lm_export_path_str, - } + composer_param_dct = { + "lipid_class": usr_lipid_class, + "charge_mode": usr_lipid_charge, + "exact_position": "FALSE", + "ms2ppm": usr_ms2_ppm, + "fa_whitelist": fawhitelist_path_str, + "export_path": lm_export_path_str, + } print(composer_param_dct) - self.ui.tab_c_lmstatus_pte.appendPlainText('>>> Start to generate LipidMaster table...') + self.ui.tab_c_lmstatus_pte.appendPlainText( + ">>> Start to generate LipidMaster table..." + ) - self.ui.tab_c_lmrun_pb.setText(QtGui.QApplication.translate('MainWindow', '... Generating ...', - None, QtGui.QApplication.UnicodeUTF8)) + self.ui.tab_c_lmrun_pb.setText("... Generating ...") self.ui.tab_b_runbatch_pb.setEnabled(False) self.ui.tab_a_runhunter_pb.setEnabled(False) self.ui.tab_c_lmrun_pb.setEnabled(False) @@ -1230,12 +1433,14 @@ def lm_worker_hunter(self): self.lm_worker.request_work(composer_param_dct) else: - self.ui.tab_c_lmstatus_pte.appendPlainText('!! Please check your settings and try again !!\n') + self.ui.tab_c_lmstatus_pte.appendPlainText( + "!! Please check your settings and try again !!\n" + ) def lm_worker_info_update(self): back_info_str = self.lm_worker.infoback() - print('Got info: ', back_info_str) + print("Got info: ", back_info_str) self.ui.tab_c_lmstatus_pte.appendPlainText(back_info_str) @@ -1249,7 +1454,7 @@ def __init__(self, parent=None): self.params_dct = {} self.run_count = 0 self.total_count = 0 - self.info_str = '' + self.info_str = "" def request_work(self, params_dct): """ @@ -1266,31 +1471,33 @@ def infoback(self): def run_hunter(self): log_lst = [] - print('>>> Hunter single worker started ...') + print(">>> Hunter single worker started ...") time.sleep(1) # Wait for 3 sec to avoid overwriting the self.info_str - self.info_str = '>>> Hunter started ... Please wait ...\n' + self.info_str = ">>> Hunter started ... Please wait ...\n" self.infoback() self.info_update.emit(self.info_str) - hunter_time, log_lst, output_df2 = huntlipids(self.params_dct, error_lst=log_lst) - - # try: - # hunter_time, log_lst, output_df2 = huntlipids(self.params_dct, error_lst=log_lst) - # except Exception as _e: - # print(_e) - # hunter_time = False - # log_lst = False - # export_df = False - # time.sleep(1) - # self.info_str = '!! Sorry, an error has occurred, please check your settings !!' - # self.infoback() - # self.info_update.emit(self.info_str) - # time.sleep(1) - # self.finished.emit() - - err_info = '' + # hunter_time, log_lst, output_df2 = huntlipids( + # self.params_dct, error_lst=log_lst + # ) + + try: + hunter_time, log_lst, output_df2 = huntlipids(self.params_dct, error_lst=log_lst) + except Exception as _e: + print(_e) + hunter_time = False + log_lst = False + export_df = False + time.sleep(1) + self.info_str = '!! Sorry, an error has occurred, please check your settings !!' + self.infoback() + self.info_update.emit(self.info_str) + time.sleep(1) + self.finished.emit() + + err_info = "" if isinstance(log_lst, list): - err_info = '\n'.join(log_lst) + err_info = "\n".join(log_lst) else: pass @@ -1298,24 +1505,36 @@ def run_hunter(self): if isinstance(hunter_time, float): time.sleep(1) - self.info_str = '%s\n>>> >>> >>> FINISHED in %.3f Sec <<< <<< <<<\n' % (err_info, hunter_time) + self.info_str = "%s\n>>> >>> >>> FINISHED in %.3f Sec <<< <<< <<<\n" % ( + err_info, + hunter_time, + ) self.infoback() self.info_update.emit(self.info_str) else: if isinstance(hunter_time, str): time.sleep(1) - self.info_str = '%s\n>>> >>> >>> FINISHED in %s Sec <<< <<< <<<\n' % (err_info, hunter_time) + self.info_str = ( + "%s\n>>> >>> >>> FINISHED in %s Sec <<< <<< <<<\n" + % (err_info, hunter_time) + ) self.infoback() self.info_update.emit(self.info_str) else: time.sleep(1) - self.info_str = '%s\n!! Sorry, an error has occurred, please check your settings !!\n\n' % err_info + self.info_str = ( + "%s\n!! Sorry, an error has occurred, please check your settings !!\n\n" + % err_info + ) self.infoback() self.info_update.emit(self.info_str) else: time.sleep(1) - self.info_str = '%s\n!! Sorry, an error has occurred, please check your settings !!\n\n' % err_info + self.info_str = ( + "%s\n!! Sorry, an error has occurred, please check your settings !!\n\n" + % err_info + ) self.infoback() self.info_update.emit(self.info_str) time.sleep(1) @@ -1335,7 +1554,7 @@ def __init__(self, parent=None): self.cfg_params_dct = {} self.run_count = 0 self.total_count = 0 - self.info_str = '' + self.info_str = "" def request_work(self, cfg_params_dct, total_count): """ @@ -1364,63 +1583,77 @@ def run_hunter(self): _param_dct = self.cfg_params_dct[cfg_idx][0] _cfg_path = self.cfg_params_dct[cfg_idx][1] self.run_count = int(cfg_idx) - print('>>> Hunter batch_worker started ...') + print(">>> Hunter batch_worker started ...") time.sleep(1) - self.info_str = 'Start processing file: # %i / %i\n%s\n' % (cfg_idx, self.total_count, _cfg_path) + self.info_str = "Start processing file: # %i / %i\n%s\n" % ( + cfg_idx, + self.total_count, + _cfg_path, + ) self.infoback() self.info_update.emit(self.info_str) start_time_str = time.strftime("%Y-%m-%d_%H-%M-%S", time.localtime()) - _param_dct['hunter_start_time'] = start_time_str + _param_dct["hunter_start_time"] = start_time_str - if not os.path.isdir(_param_dct['img_output_folder_str']): - os.makedirs(_param_dct['img_output_folder_str']) - self.info_str = 'Output folder created...\n\n' + if not os.path.isdir(_param_dct["img_output_folder_str"]): + os.makedirs(_param_dct["img_output_folder_str"]) + self.info_str = "Output folder created...\n\n" self.infoback() self.info_update.emit(self.info_str) - print('Output folder created...') - output_folder_path = os.path.abspath(_param_dct['img_output_folder_str']) - log_file_name = 'LipidHunter_Params-Log_%s.txt' % _param_dct['hunter_start_time'] + print("Output folder created...") + output_folder_path = os.path.abspath(_param_dct["img_output_folder_str"]) + log_file_name = ( + "LipidHunter_Params-Log_%s.txt" % _param_dct["hunter_start_time"] + ) param_log_output_path_str = os.path.join(output_folder_path, log_file_name) try: config = configparser.ConfigParser() - with open(param_log_output_path_str, 'w') as usr_param_cfg: - config.add_section('parameters') + with open(param_log_output_path_str, "w") as usr_param_cfg: + config.add_section("parameters") for param in list(_param_dct.keys()): - config.set('parameters', str(param), str(_param_dct[param])) + config.set("parameters", str(param), str(_param_dct[param])) config.write(usr_param_cfg) try: - os.chdir(_param_dct['hunter_folder']) - hunter_py_path = os.path.join(_param_dct['hunter_folder'], 'LipidHunter.py') - hunter_exe_path = os.path.join(_param_dct['hunter_folder'], 'LipidHunter.exe') + os.chdir(_param_dct["hunter_folder"]) + hunter_py_path = os.path.join( + _param_dct["hunter_folder"], "LipidHunter.py" + ) + hunter_exe_path = os.path.join( + _param_dct["hunter_folder"], "LipidHunter.exe" + ) if os.path.isfile(hunter_py_path): - print('>>> Running LipidHunter source code version ...') + print(">>> Running LipidHunter source code version ...") ready_to_run = True elif os.path.isfile(hunter_exe_path): - print('>>> Running LipidHunter .exe version ...') + print(">>> Running LipidHunter .exe version ...") ready_to_run = True else: ready_to_run = False time.sleep(1) - self.info_str = '!! LipidHunter folder path in configuration is not correct!!\n' + self.info_str = "!! LipidHunter folder path in configuration is not correct!!\n" self.infoback() self.info_update.emit(self.info_str) except IOError: ready_to_run = False time.sleep(1) - self.info_str = '!! LipidHunter folder path in configuration is not correct!!\n' + self.info_str = ( + "!! LipidHunter folder path in configuration is not correct!!\n" + ) self.infoback() self.info_update.emit(self.info_str) except IOError: ready_to_run = False time.sleep(1) - self.info_str = '!! Failed to save parameter log files ...\n' + self.info_str = "!! Failed to save parameter log files ...\n" self.infoback() self.info_update.emit(self.info_str) if ready_to_run is True: - hunter_time, log_lst, output_df2 = huntlipids(_param_dct, error_lst=log_lst) + hunter_time, log_lst, output_df2 = huntlipids( + _param_dct, error_lst=log_lst + ) # try: # hunter_time, log_lst, output_df2 = huntlipids(_param_dct, error_lst=log_lst) # except Exception as _e: @@ -1429,57 +1662,67 @@ def run_hunter(self): # log_lst = False # export_df = False - err_info = '' + err_info = "" if isinstance(log_lst, list): - err_info = '\n'.join(log_lst) + err_info = "\n".join(log_lst) else: pass if hunter_time is not False: - print('Hunter finished successfully ...') + print("Hunter finished successfully ...") if isinstance(hunter_time, float): - run_time = '%.3f' % hunter_time + run_time = "%.3f" % hunter_time time.sleep(1) - self.info_str = ('%s\n>>> FINISHED with file # %i / %i in %s Sec ...\n\n' - % (err_info, cfg_idx, self.total_count, run_time)) + self.info_str = ( + "%s\n>>> FINISHED with file # %i / %i in %s Sec ...\n\n" + % (err_info, cfg_idx, self.total_count, run_time) + ) self.infoback() self.info_update.emit(self.info_str) elif isinstance(hunter_time, str): time.sleep(1) - self.info_str = ('%s\n>>>FINISHED with file # %i / %i in %s Sec ...\n\n' - % (err_info, cfg_idx, self.total_count, hunter_time)) + self.info_str = ( + "%s\n>>>FINISHED with file # %i / %i in %s Sec ...\n\n" + % (err_info, cfg_idx, self.total_count, hunter_time) + ) self.infoback() self.info_update.emit(self.info_str) else: - err_info = '' + err_info = "" for err in log_lst: err_info += err time.sleep(1) - self.info_str = ('%s\n!! Failed to process batch mode configuration file ... ' - 'skip this one ...\n\n' % err_info) + self.info_str = ( + "%s\n!! Failed to process batch mode configuration file ... " + "skip this one ...\n\n" % err_info + ) self.infoback() self.info_update.emit(self.info_str) else: time.sleep(1) - self.info_str = ('%s\n!! Failed to process batch mode configuration file ... skip this one ...\n\n' - % err_info) + self.info_str = ( + "%s\n!! Failed to process batch mode configuration file ... skip this one ...\n\n" + % err_info + ) self.infoback() self.info_update.emit(self.info_str) else: time.sleep(1) - self.info_str = ('!! Failed to save parameter log files ...\n' - '!! Failed to process batch mode configuration file ... skip this one ...\n\n') + self.info_str = ( + "!! Failed to save parameter log files ...\n" + "!! Failed to process batch mode configuration file ... skip this one ...\n\n" + ) self.infoback() self.info_update.emit(self.info_str) t_end = time.time() - t_start time.sleep(3) - self.info_str = '\n>>> ALL FINISHED in %.3f Sec <<<' % t_end + self.info_str = "\n>>> ALL FINISHED in %.3f Sec <<<" % t_end self.infoback() self.info_update.emit(self.info_str) self.finished.emit() @@ -1493,7 +1736,7 @@ class LMWorker(QtCore.QObject): def __init__(self, parent=None): super(LMWorker, self).__init__(parent) self.lm_params_dct = {} - self.info_str = '' + self.info_str = "" def request_work(self, lm_params_dct): """ @@ -1511,16 +1754,20 @@ def run_lm_generator(self): t_start = time.time() lipidcomposer = LipidComposer() - usr_lipid_master_df = lipidcomposer.compose_lipid(param_dct=self.lm_params_dct, - ms2_ppm=self.lm_params_dct['ms2ppm']) + usr_lipid_master_df = lipidcomposer.compose_lipid( + param_dct=self.lm_params_dct, ms2_ppm=self.lm_params_dct["ms2ppm"] + ) if isinstance(usr_lipid_master_df, pd.DataFrame): if not usr_lipid_master_df.empty: - self.info_str = ('==> Number of predicted lipids (discrete form): %i' % usr_lipid_master_df.shape[0]) + self.info_str = ( + "==> Number of predicted lipids (discrete form): %i" + % usr_lipid_master_df.shape[0] + ) self.infoback() self.info_update.emit(self.info_str) - abs_export_path = os.path.abspath(self.lm_params_dct['export_path']) + abs_export_path = os.path.abspath(self.lm_params_dct["export_path"]) abs_export_folder = os.path.dirname(abs_export_path) if os.path.isdir(abs_export_folder): pass @@ -1528,28 +1775,38 @@ def run_lm_generator(self): os.mkdir(os.path.abspath(abs_export_folder)) try: usr_lipid_master_df.to_csv(abs_export_path) - self.info_str = ('==> --> Lipid Master table Saved as: \n %s' % abs_export_path) + self.info_str = ( + "==> --> Lipid Master table Saved as: \n %s" % abs_export_path + ) self.infoback() self.info_update.emit(self.info_str) except Exception as _err: print(_err) - self.info_str = '\n %s \n' % _err + self.info_str = "\n %s \n" % _err self.infoback() self.info_update.emit(self.info_str) else: - print('[ERROR] Failed to generate LipidMaster Table...\n' - '... ... Check if Lipid Class and FA are marked in FA whitelist...') - self.info_str = ('[ERROR] Failed to generate LipidMaster Table...\n' - ' ... ... Please check if Lipid Class and FA are marked in FA whitelist...') + print( + "[ERROR] Failed to generate LipidMaster Table...\n" + "... ... Check if Lipid Class and FA are marked in FA whitelist..." + ) + self.info_str = ( + "[ERROR] Failed to generate LipidMaster Table...\n" + " ... ... Please check if Lipid Class and FA are marked in FA whitelist..." + ) self.infoback() self.info_update.emit(self.info_str) else: - print('[ERROR] Failed to generate LipidMaster Table...\n' - '... ... Check if Lipid Class and FA are marked in FA whitelist...') - self.info_str = ('[ERROR] Failed to generate LipidMaster Table...\n' - '... ... Please check if Lipid Class and FA are marked in FA whitelist...') + print( + "[ERROR] Failed to generate LipidMaster Table...\n" + "... ... Check if Lipid Class and FA are marked in FA whitelist..." + ) + self.info_str = ( + "[ERROR] Failed to generate LipidMaster Table...\n" + "... ... Please check if Lipid Class and FA are marked in FA whitelist..." + ) self.infoback() self.info_update.emit(self.info_str) @@ -1557,17 +1814,22 @@ def run_lm_generator(self): time.sleep(0.25) self.lm_params_dct = {} - self.info_str = '\n>>> FINISHED in %.3f Sec <<<' % t_end + self.info_str = "\n>>> FINISHED in %.3f Sec <<<" % t_end self.infoback() self.info_update.emit(self.info_str) self.finished.emit() -if __name__ == '__main__': +if __name__ == "__main__": import sys multiprocessing.freeze_support() - app = QtGui.QApplication(sys.argv) + + # Scale GUI on HiDPI monitors e.g. 2k, 4k resolution + QtCore.QCoreApplication.setAttribute(QtCore.Qt.AA_EnableHighDpiScaling) + QtCore.QCoreApplication.setAttribute(QtCore.Qt.AA_UseHighDpiPixmaps) + + app = QtWidgets.QApplication(sys.argv) window = LipidHunterMain() window.show() sys.exit(app.exec_()) diff --git a/LibLipidHunter/LipidHunter_UI.py b/LibLipidHunter/LipidHunter_UI.py index c6ea00a..41bbe2e 100644 --- a/LibLipidHunter/LipidHunter_UI.py +++ b/LibLipidHunter/LipidHunter_UI.py @@ -21,149 +21,162 @@ # # Created: Fri May 11 16:51:42 2018 # by: pyside-uic 0.2.15 running on PySide 1.2.4 +# Modified: Tue Jan 21 2020 # # WARNING! All changes made in this file will be lost! -from PySide import QtCore, QtGui +from PySide2 import QtCore, QtGui, QtWidgets class Ui_MainWindow(object): - def setupUi(self, MainWindow, scale=1): + def setupUi(self, MainWindow): MainWindow.setObjectName("MainWindow") - MainWindow.resize(960 * scale, 720 * scale) + MainWindow.resize(960, 720) icon = QtGui.QIcon() - icon.addPixmap(QtGui.QPixmap(":/LipidHunter.png"), QtGui.QIcon.Normal, QtGui.QIcon.Off) + icon.addPixmap( + QtGui.QPixmap(":/LipidHunter.png"), QtGui.QIcon.Normal, QtGui.QIcon.Off + ) MainWindow.setWindowIcon(icon) - self.centralwidget = QtGui.QWidget(MainWindow) + self.centralwidget = QtWidgets.QWidget(MainWindow) self.centralwidget.setObjectName("centralwidget") - self.tabframe = QtGui.QTabWidget(self.centralwidget) - self.tabframe.setGeometry(QtCore.QRect(10, 10, 931 * scale, 641 * scale)) + self.tabframe = QtWidgets.QTabWidget(self.centralwidget) + self.tabframe.setGeometry(QtCore.QRect(10, 10, 931, 641)) self.tabframe.setObjectName("tabframe") - self.hunter_tab = QtGui.QWidget() + self.hunter_tab = QtWidgets.QWidget() self.hunter_tab.setObjectName("hunter_tab") - self.gridLayoutWidget_5 = QtGui.QWidget(self.hunter_tab) - self.gridLayoutWidget_5.setGeometry(QtCore.QRect(10, 50 * scale, 901 * scale, 341 * scale)) + self.gridLayoutWidget_5 = QtWidgets.QWidget(self.hunter_tab) + self.gridLayoutWidget_5.setGeometry( + QtCore.QRect(10, 50, 901, 341) + ) self.gridLayoutWidget_5.setObjectName("gridLayoutWidget_5") - self.gridLayout_5 = QtGui.QGridLayout(self.gridLayoutWidget_5) + self.gridLayout_5 = QtWidgets.QGridLayout(self.gridLayoutWidget_5) self.gridLayout_5.setContentsMargins(0, 0, 0, 0) self.gridLayout_5.setObjectName("gridLayout_5") - self.tab_a_saveimgfolder_le = QtGui.QLineEdit(self.gridLayoutWidget_5) + self.tab_a_saveimgfolder_le = QtWidgets.QLineEdit(self.gridLayoutWidget_5) self.tab_a_saveimgfolder_le.setObjectName("tab_a_saveimgfolder_le") self.gridLayout_5.addWidget(self.tab_a_saveimgfolder_le, 5, 1, 1, 1) - self.label_50 = QtGui.QLabel(self.gridLayoutWidget_5) + self.label_50 = QtWidgets.QLabel(self.gridLayoutWidget_5) self.label_50.setObjectName("label_50") self.gridLayout_5.addWidget(self.label_50, 2, 0, 1, 1) - self.tab_a_mzml_le = QtGui.QLineEdit(self.gridLayoutWidget_5) + self.tab_a_mzml_le = QtWidgets.QLineEdit(self.gridLayoutWidget_5) self.tab_a_mzml_le.setObjectName("tab_a_mzml_le") self.gridLayout_5.addWidget(self.tab_a_mzml_le, 3, 1, 1, 1) - self.line_6 = QtGui.QFrame(self.gridLayoutWidget_5) - self.line_6.setFrameShape(QtGui.QFrame.HLine) - self.line_6.setFrameShadow(QtGui.QFrame.Sunken) + self.line_6 = QtWidgets.QFrame(self.gridLayoutWidget_5) + self.line_6.setFrameShape(QtWidgets.QFrame.HLine) + self.line_6.setFrameShadow(QtWidgets.QFrame.Sunken) self.line_6.setObjectName("line_6") self.gridLayout_5.addWidget(self.line_6, 7, 1, 1, 1) - self.tab_a_mzml_pb = QtGui.QPushButton(self.gridLayoutWidget_5) + self.tab_a_mzml_pb = QtWidgets.QPushButton(self.gridLayoutWidget_5) self.tab_a_mzml_pb.setObjectName("tab_a_mzml_pb") self.gridLayout_5.addWidget(self.tab_a_mzml_pb, 3, 2, 1, 1) - self.tab_a_savexlsxpath_le = QtGui.QLineEdit(self.gridLayoutWidget_5) + self.tab_a_savexlsxpath_le = QtWidgets.QLineEdit(self.gridLayoutWidget_5) self.tab_a_savexlsxpath_le.setObjectName("tab_a_savexlsxpath_le") self.gridLayout_5.addWidget(self.tab_a_savexlsxpath_le, 6, 1, 1, 1) - self.label_3 = QtGui.QLabel(self.gridLayoutWidget_5) + self.label_3 = QtWidgets.QLabel(self.gridLayoutWidget_5) self.label_3.setObjectName("label_3") self.gridLayout_5.addWidget(self.label_3, 0, 0, 1, 1) - self.horizontalLayout_11 = QtGui.QHBoxLayout() + self.horizontalLayout_11 = QtWidgets.QHBoxLayout() self.horizontalLayout_11.setObjectName("horizontalLayout_11") - self.label_4 = QtGui.QLabel(self.gridLayoutWidget_5) + self.label_4 = QtWidgets.QLabel(self.gridLayoutWidget_5) self.label_4.setObjectName("label_4") self.horizontalLayout_11.addWidget(self.label_4) - self.tab_a_rtstart_dspb = QtGui.QDoubleSpinBox(self.gridLayoutWidget_5) + self.tab_a_rtstart_dspb = QtWidgets.QDoubleSpinBox(self.gridLayoutWidget_5) self.tab_a_rtstart_dspb.setProperty("value", 10.0) self.tab_a_rtstart_dspb.setObjectName("tab_a_rtstart_dspb") self.horizontalLayout_11.addWidget(self.tab_a_rtstart_dspb) - self.label_9 = QtGui.QLabel(self.gridLayoutWidget_5) + self.label_9 = QtWidgets.QLabel(self.gridLayoutWidget_5) self.label_9.setObjectName("label_9") self.horizontalLayout_11.addWidget(self.label_9) - self.tab_a_rtend_dspb = QtGui.QDoubleSpinBox(self.gridLayoutWidget_5) + self.tab_a_rtend_dspb = QtWidgets.QDoubleSpinBox(self.gridLayoutWidget_5) self.tab_a_rtend_dspb.setProperty("value", 25.0) self.tab_a_rtend_dspb.setObjectName("tab_a_rtend_dspb") self.horizontalLayout_11.addWidget(self.tab_a_rtend_dspb) - spacerItem = QtGui.QSpacerItem(20, 20, QtGui.QSizePolicy.Fixed, QtGui.QSizePolicy.Minimum) + spacerItem = QtWidgets.QSpacerItem( + 20, 20, QtWidgets.QSizePolicy.Fixed, QtWidgets.QSizePolicy.Minimum + ) self.horizontalLayout_11.addItem(spacerItem) - self.label_10 = QtGui.QLabel(self.gridLayoutWidget_5) + self.label_10 = QtWidgets.QLabel(self.gridLayoutWidget_5) self.label_10.setObjectName("label_10") self.horizontalLayout_11.addWidget(self.label_10) - self.tab_a_mzstart_dspb = QtGui.QDoubleSpinBox(self.gridLayoutWidget_5) + self.tab_a_mzstart_dspb = QtWidgets.QDoubleSpinBox(self.gridLayoutWidget_5) self.tab_a_mzstart_dspb.setDecimals(4) self.tab_a_mzstart_dspb.setMaximum(1200.0) self.tab_a_mzstart_dspb.setProperty("value", 600.0) self.tab_a_mzstart_dspb.setObjectName("tab_a_mzstart_dspb") self.horizontalLayout_11.addWidget(self.tab_a_mzstart_dspb) - self.label_11 = QtGui.QLabel(self.gridLayoutWidget_5) + self.label_11 = QtWidgets.QLabel(self.gridLayoutWidget_5) self.label_11.setObjectName("label_11") self.horizontalLayout_11.addWidget(self.label_11) - self.tab_a_mzend_dspb = QtGui.QDoubleSpinBox(self.gridLayoutWidget_5) + self.tab_a_mzend_dspb = QtWidgets.QDoubleSpinBox(self.gridLayoutWidget_5) self.tab_a_mzend_dspb.setDecimals(4) self.tab_a_mzend_dspb.setMaximum(2000.0) self.tab_a_mzend_dspb.setProperty("value", 1000.0) self.tab_a_mzend_dspb.setObjectName("tab_a_mzend_dspb") self.horizontalLayout_11.addWidget(self.tab_a_mzend_dspb) - spacerItem1 = QtGui.QSpacerItem(40, 20, QtGui.QSizePolicy.Expanding, QtGui.QSizePolicy.Minimum) + spacerItem1 = QtWidgets.QSpacerItem( + 40, 20, QtWidgets.QSizePolicy.Expanding, QtWidgets.QSizePolicy.Minimum + ) self.horizontalLayout_11.addItem(spacerItem1) self.gridLayout_5.addLayout(self.horizontalLayout_11, 8, 1, 1, 1) - self.label_6 = QtGui.QLabel(self.gridLayoutWidget_5) + self.label_6 = QtWidgets.QLabel(self.gridLayoutWidget_5) self.label_6.setObjectName("label_6") self.gridLayout_5.addWidget(self.label_6, 3, 0, 1, 1) - self.tab_a_loadfalist_pb = QtGui.QPushButton(self.gridLayoutWidget_5) + self.tab_a_loadfalist_pb = QtWidgets.QPushButton(self.gridLayoutWidget_5) self.tab_a_loadfalist_pb.setObjectName("tab_a_loadfalist_pb") self.gridLayout_5.addWidget(self.tab_a_loadfalist_pb, 1, 2, 1, 1) - self.label_7 = QtGui.QLabel(self.gridLayoutWidget_5) + self.label_7 = QtWidgets.QLabel(self.gridLayoutWidget_5) self.label_7.setObjectName("label_7") self.gridLayout_5.addWidget(self.label_7, 5, 0, 1, 1) - self.tab_a_loadscorecfg_pb = QtGui.QPushButton(self.gridLayoutWidget_5) + self.tab_a_loadscorecfg_pb = QtWidgets.QPushButton(self.gridLayoutWidget_5) self.tab_a_loadscorecfg_pb.setObjectName("tab_a_loadscorecfg_pb") self.gridLayout_5.addWidget(self.tab_a_loadscorecfg_pb, 2, 2, 1, 1) - self.tab_a_sumxlsxpath_pb = QtGui.QPushButton(self.gridLayoutWidget_5) + self.tab_a_sumxlsxpath_pb = QtWidgets.QPushButton(self.gridLayoutWidget_5) self.tab_a_sumxlsxpath_pb.setObjectName("tab_a_sumxlsxpath_pb") self.gridLayout_5.addWidget(self.tab_a_sumxlsxpath_pb, 6, 2, 1, 1) - self.tab_a_loadscorecfg_le = QtGui.QLineEdit(self.gridLayoutWidget_5) + self.tab_a_loadscorecfg_le = QtWidgets.QLineEdit(self.gridLayoutWidget_5) self.tab_a_loadscorecfg_le.setObjectName("tab_a_loadscorecfg_le") self.gridLayout_5.addWidget(self.tab_a_loadscorecfg_le, 2, 1, 1, 1) - self.tab_a_saveimgfolder_pb = QtGui.QPushButton(self.gridLayoutWidget_5) + self.tab_a_saveimgfolder_pb = QtWidgets.QPushButton(self.gridLayoutWidget_5) self.tab_a_saveimgfolder_pb.setObjectName("tab_a_saveimgfolder_pb") self.gridLayout_5.addWidget(self.tab_a_saveimgfolder_pb, 5, 2, 1, 1) - self.label_8 = QtGui.QLabel(self.gridLayoutWidget_5) + self.label_8 = QtWidgets.QLabel(self.gridLayoutWidget_5) self.label_8.setObjectName("label_8") self.gridLayout_5.addWidget(self.label_8, 6, 0, 1, 1) - self.line_5 = QtGui.QFrame(self.gridLayoutWidget_5) - self.line_5.setFrameShape(QtGui.QFrame.HLine) - self.line_5.setFrameShadow(QtGui.QFrame.Sunken) + self.line_5 = QtWidgets.QFrame(self.gridLayoutWidget_5) + self.line_5.setFrameShape(QtWidgets.QFrame.HLine) + self.line_5.setFrameShadow(QtWidgets.QFrame.Sunken) self.line_5.setObjectName("line_5") self.gridLayout_5.addWidget(self.line_5, 4, 1, 1, 1) - self.horizontalLayout_15 = QtGui.QHBoxLayout() + self.horizontalLayout_15 = QtWidgets.QHBoxLayout() self.horizontalLayout_15.setObjectName("horizontalLayout_15") - self.label_16 = QtGui.QLabel(self.gridLayoutWidget_5) + self.label_16 = QtWidgets.QLabel(self.gridLayoutWidget_5) self.label_16.setObjectName("label_16") self.horizontalLayout_15.addWidget(self.label_16) - self.tab_a_ms2ppm_spb = QtGui.QSpinBox(self.gridLayoutWidget_5) + self.tab_a_ms2ppm_spb = QtWidgets.QSpinBox(self.gridLayoutWidget_5) self.tab_a_ms2ppm_spb.setMaximum(9999) self.tab_a_ms2ppm_spb.setProperty("value", 50) self.tab_a_ms2ppm_spb.setObjectName("tab_a_ms2ppm_spb") self.horizontalLayout_15.addWidget(self.tab_a_ms2ppm_spb) - spacerItem2 = QtGui.QSpacerItem(20, 20, QtGui.QSizePolicy.Fixed, QtGui.QSizePolicy.Minimum) + spacerItem2 = QtWidgets.QSpacerItem( + 20, 20, QtWidgets.QSizePolicy.Fixed, QtWidgets.QSizePolicy.Minimum + ) self.horizontalLayout_15.addItem(spacerItem2) - self.tab_d_ms2threshold_spb_2 = QtGui.QLabel(self.gridLayoutWidget_5) + self.tab_d_ms2threshold_spb_2 = QtWidgets.QLabel(self.gridLayoutWidget_5) self.tab_d_ms2threshold_spb_2.setObjectName("tab_d_ms2threshold_spb_2") self.horizontalLayout_15.addWidget(self.tab_d_ms2threshold_spb_2) - self.tab_a_ms2threshold_spb = QtGui.QSpinBox(self.gridLayoutWidget_5) + self.tab_a_ms2threshold_spb = QtWidgets.QSpinBox(self.gridLayoutWidget_5) self.tab_a_ms2threshold_spb.setMaximum(999999) self.tab_a_ms2threshold_spb.setProperty("value", 10) self.tab_a_ms2threshold_spb.setObjectName("tab_a_ms2threshold_spb") self.horizontalLayout_15.addWidget(self.tab_a_ms2threshold_spb) - spacerItem3 = QtGui.QSpacerItem(40, 20, QtGui.QSizePolicy.Expanding, QtGui.QSizePolicy.Minimum) + spacerItem3 = QtWidgets.QSpacerItem( + 40, 20, QtWidgets.QSizePolicy.Expanding, QtWidgets.QSizePolicy.Minimum + ) self.horizontalLayout_15.addItem(spacerItem3) self.gridLayout_5.addLayout(self.horizontalLayout_15, 11, 1, 1, 1) - self.horizontalLayout_7 = QtGui.QHBoxLayout() + self.horizontalLayout_7 = QtWidgets.QHBoxLayout() self.horizontalLayout_7.setObjectName("horizontalLayout_7") - self.tab_a_lipidclass_cmb = QtGui.QComboBox(self.gridLayoutWidget_5) + self.tab_a_lipidclass_cmb = QtWidgets.QComboBox(self.gridLayoutWidget_5) self.tab_a_lipidclass_cmb.setMinimumSize(QtCore.QSize(220, 0)) self.tab_a_lipidclass_cmb.setMaxVisibleItems(14) self.tab_a_lipidclass_cmb.setObjectName("tab_a_lipidclass_cmb") @@ -188,197 +201,235 @@ def setupUi(self, MainWindow, scale=1): self.tab_a_lipidclass_cmb.addItem("") # self.tab_a_lipidclass_cmb.addItem("") self.horizontalLayout_7.addWidget(self.tab_a_lipidclass_cmb) - spacerItem4 = QtGui.QSpacerItem(40, 20, QtGui.QSizePolicy.Expanding, QtGui.QSizePolicy.Minimum) + spacerItem4 = QtWidgets.QSpacerItem( + 40, 20, QtWidgets.QSizePolicy.Expanding, QtWidgets.QSizePolicy.Minimum + ) self.horizontalLayout_7.addItem(spacerItem4) self.gridLayout_5.addLayout(self.horizontalLayout_7, 0, 1, 1, 1) - self.label_5 = QtGui.QLabel(self.gridLayoutWidget_5) + self.label_5 = QtWidgets.QLabel(self.gridLayoutWidget_5) self.label_5.setObjectName("label_5") self.gridLayout_5.addWidget(self.label_5, 1, 0, 1, 1) - self.horizontalLayout_28 = QtGui.QHBoxLayout() + self.horizontalLayout_28 = QtWidgets.QHBoxLayout() self.horizontalLayout_28.setObjectName("horizontalLayout_28") - self.tab_a_loadfalist_le = QtGui.QLineEdit(self.gridLayoutWidget_5) + self.tab_a_loadfalist_le = QtWidgets.QLineEdit(self.gridLayoutWidget_5) self.tab_a_loadfalist_le.setObjectName("tab_a_loadfalist_le") self.horizontalLayout_28.addWidget(self.tab_a_loadfalist_le) self.gridLayout_5.addLayout(self.horizontalLayout_28, 1, 1, 1, 1) - self.horizontalLayout_13 = QtGui.QHBoxLayout() + self.horizontalLayout_13 = QtWidgets.QHBoxLayout() self.horizontalLayout_13.setObjectName("horizontalLayout_13") - self.label_19 = QtGui.QLabel(self.gridLayoutWidget_5) + self.label_19 = QtWidgets.QLabel(self.gridLayoutWidget_5) self.label_19.setObjectName("label_19") self.horizontalLayout_13.addWidget(self.label_19) - self.tab_a_isotopescore_spb = QtGui.QDoubleSpinBox(self.gridLayoutWidget_5) + self.tab_a_isotopescore_spb = QtWidgets.QDoubleSpinBox(self.gridLayoutWidget_5) self.tab_a_isotopescore_spb.setMinimumSize(QtCore.QSize(0, 0)) self.tab_a_isotopescore_spb.setPrefix("") self.tab_a_isotopescore_spb.setDecimals(1) self.tab_a_isotopescore_spb.setProperty("value", 80.0) self.tab_a_isotopescore_spb.setObjectName("tab_a_isotopescore_spb") self.horizontalLayout_13.addWidget(self.tab_a_isotopescore_spb) - spacerItem5 = QtGui.QSpacerItem(20, 20, QtGui.QSizePolicy.Fixed, QtGui.QSizePolicy.Minimum) + spacerItem5 = QtWidgets.QSpacerItem( + 20, 20, QtWidgets.QSizePolicy.Fixed, QtWidgets.QSizePolicy.Minimum + ) self.horizontalLayout_13.addItem(spacerItem5) - self.label_20 = QtGui.QLabel(self.gridLayoutWidget_5) + self.label_20 = QtWidgets.QLabel(self.gridLayoutWidget_5) self.label_20.setObjectName("label_20") self.horizontalLayout_13.addWidget(self.label_20) - self.tab_a_score_spb = QtGui.QDoubleSpinBox(self.gridLayoutWidget_5) + self.tab_a_score_spb = QtWidgets.QDoubleSpinBox(self.gridLayoutWidget_5) self.tab_a_score_spb.setMinimumSize(QtCore.QSize(0, 0)) self.tab_a_score_spb.setPrefix("") self.tab_a_score_spb.setDecimals(1) self.tab_a_score_spb.setProperty("value", 40.0) self.tab_a_score_spb.setObjectName("tab_a_score_spb") self.horizontalLayout_13.addWidget(self.tab_a_score_spb) - spacerItem6 = QtGui.QSpacerItem(20, 20, QtGui.QSizePolicy.Fixed, QtGui.QSizePolicy.Minimum) + spacerItem6 = QtWidgets.QSpacerItem( + 20, 20, QtWidgets.QSizePolicy.Fixed, QtWidgets.QSizePolicy.Minimum + ) self.horizontalLayout_13.addItem(spacerItem6) - self.label_38 = QtGui.QLabel(self.gridLayoutWidget_5) + self.label_38 = QtWidgets.QLabel(self.gridLayoutWidget_5) self.label_38.setObjectName("label_38") self.horizontalLayout_13.addWidget(self.label_38) - self.tab_a_ms2infoth_dspb = QtGui.QDoubleSpinBox(self.gridLayoutWidget_5) + self.tab_a_ms2infoth_dspb = QtWidgets.QDoubleSpinBox(self.gridLayoutWidget_5) self.tab_a_ms2infoth_dspb.setMaximumSize(QtCore.QSize(75, 16777215)) self.tab_a_ms2infoth_dspb.setProperty("value", 0.1) self.tab_a_ms2infoth_dspb.setObjectName("tab_a_ms2infoth_dspb") self.horizontalLayout_13.addWidget(self.tab_a_ms2infoth_dspb) - spacerItem7 = QtGui.QSpacerItem(40, 20, QtGui.QSizePolicy.Expanding, QtGui.QSizePolicy.Minimum) + spacerItem7 = QtWidgets.QSpacerItem( + 40, 20, QtWidgets.QSizePolicy.Expanding, QtWidgets.QSizePolicy.Minimum + ) self.horizontalLayout_13.addItem(spacerItem7) self.gridLayout_5.addLayout(self.horizontalLayout_13, 12, 1, 1, 1) - self.horizontalLayout_12 = QtGui.QHBoxLayout() + self.horizontalLayout_12 = QtWidgets.QHBoxLayout() self.horizontalLayout_12.setObjectName("horizontalLayout_12") - self.label_15 = QtGui.QLabel(self.gridLayoutWidget_5) + self.label_15 = QtWidgets.QLabel(self.gridLayoutWidget_5) self.label_15.setObjectName("label_15") self.horizontalLayout_12.addWidget(self.label_15) - self.tab_a_msppm_spb = QtGui.QSpinBox(self.gridLayoutWidget_5) + self.tab_a_msppm_spb = QtWidgets.QSpinBox(self.gridLayoutWidget_5) self.tab_a_msppm_spb.setMaximum(9999) self.tab_a_msppm_spb.setProperty("value", 20) self.tab_a_msppm_spb.setObjectName("tab_a_msppm_spb") self.horizontalLayout_12.addWidget(self.tab_a_msppm_spb) - spacerItem8 = QtGui.QSpacerItem(20, 20, QtGui.QSizePolicy.Fixed, QtGui.QSizePolicy.Minimum) + spacerItem8 = QtWidgets.QSpacerItem( + 20, 20, QtWidgets.QSizePolicy.Fixed, QtWidgets.QSizePolicy.Minimum + ) self.horizontalLayout_12.addItem(spacerItem8) - self.label_13 = QtGui.QLabel(self.gridLayoutWidget_5) + self.label_13 = QtWidgets.QLabel(self.gridLayoutWidget_5) self.label_13.setObjectName("label_13") self.horizontalLayout_12.addWidget(self.label_13) - self.tab_a_msthreshold_spb = QtGui.QSpinBox(self.gridLayoutWidget_5) + self.tab_a_msthreshold_spb = QtWidgets.QSpinBox(self.gridLayoutWidget_5) self.tab_a_msthreshold_spb.setMaximum(999999) self.tab_a_msthreshold_spb.setProperty("value", 1000) self.tab_a_msthreshold_spb.setObjectName("tab_a_msthreshold_spb") self.horizontalLayout_12.addWidget(self.tab_a_msthreshold_spb) - spacerItem9 = QtGui.QSpacerItem(40, 20, QtGui.QSizePolicy.Expanding, QtGui.QSizePolicy.Minimum) + spacerItem9 = QtWidgets.QSpacerItem( + 40, 20, QtWidgets.QSizePolicy.Expanding, QtWidgets.QSizePolicy.Minimum + ) self.horizontalLayout_12.addItem(spacerItem9) - self.tab_a_msmax_chb = QtGui.QCheckBox(self.gridLayoutWidget_5) + self.tab_a_msmax_chb = QtWidgets.QCheckBox(self.gridLayoutWidget_5) self.tab_a_msmax_chb.setObjectName("tab_a_msmax_chb") self.horizontalLayout_12.addWidget(self.tab_a_msmax_chb) self.gridLayout_5.addLayout(self.horizontalLayout_12, 10, 1, 1, 1) - self.horizontalLayout_16 = QtGui.QHBoxLayout() + self.horizontalLayout_16 = QtWidgets.QHBoxLayout() self.horizontalLayout_16.setObjectName("horizontalLayout_16") - self.label_25 = QtGui.QLabel(self.gridLayoutWidget_5) + self.label_25 = QtWidgets.QLabel(self.gridLayoutWidget_5) self.label_25.setObjectName("label_25") self.horizontalLayout_16.addWidget(self.label_25) - self.tab_a_prwindow_spb = QtGui.QDoubleSpinBox(self.gridLayoutWidget_5) + self.tab_a_prwindow_spb = QtWidgets.QDoubleSpinBox(self.gridLayoutWidget_5) self.tab_a_prwindow_spb.setMinimumSize(QtCore.QSize(70, 0)) self.tab_a_prwindow_spb.setMaximum(2.0) self.tab_a_prwindow_spb.setSingleStep(0.01) self.tab_a_prwindow_spb.setProperty("value", 0.75) self.tab_a_prwindow_spb.setObjectName("tab_a_prwindow_spb") self.horizontalLayout_16.addWidget(self.tab_a_prwindow_spb) - spacerItem10 = QtGui.QSpacerItem(20, 20, QtGui.QSizePolicy.Fixed, QtGui.QSizePolicy.Minimum) + spacerItem10 = QtWidgets.QSpacerItem( + 20, 20, QtWidgets.QSizePolicy.Fixed, QtWidgets.QSizePolicy.Minimum + ) self.horizontalLayout_16.addItem(spacerItem10) - self.x = QtGui.QLabel(self.gridLayoutWidget_5) + self.x = QtWidgets.QLabel(self.gridLayoutWidget_5) self.x.setObjectName("x") self.horizontalLayout_16.addWidget(self.x) - self.tab_a_dda_spb = QtGui.QSpinBox(self.gridLayoutWidget_5) + self.tab_a_dda_spb = QtWidgets.QSpinBox(self.gridLayoutWidget_5) self.tab_a_dda_spb.setMaximum(20) self.tab_a_dda_spb.setProperty("value", 6) self.tab_a_dda_spb.setObjectName("tab_a_dda_spb") self.horizontalLayout_16.addWidget(self.tab_a_dda_spb) - spacerItem11 = QtGui.QSpacerItem(40, 20, QtGui.QSizePolicy.Expanding, QtGui.QSizePolicy.Minimum) + spacerItem11 = QtWidgets.QSpacerItem( + 40, 20, QtWidgets.QSizePolicy.Expanding, QtWidgets.QSizePolicy.Minimum + ) self.horizontalLayout_16.addItem(spacerItem11) self.gridLayout_5.addLayout(self.horizontalLayout_16, 9, 1, 1, 1) - self.tab_a_msmax_spb = QtGui.QSpinBox(self.gridLayoutWidget_5) + self.tab_a_msmax_spb = QtWidgets.QSpinBox(self.gridLayoutWidget_5) self.tab_a_msmax_spb.setMaximum(999999) self.tab_a_msmax_spb.setProperty("value", 1000) self.tab_a_msmax_spb.setObjectName("tab_a_msmax_spb") self.gridLayout_5.addWidget(self.tab_a_msmax_spb, 10, 2, 1, 1) - spacerItem12 = QtGui.QSpacerItem(10, 10, QtGui.QSizePolicy.Minimum, QtGui.QSizePolicy.Expanding) + spacerItem12 = QtWidgets.QSpacerItem( + 10, 10, QtWidgets.QSizePolicy.Minimum, QtWidgets.QSizePolicy.Expanding + ) self.gridLayout_5.addItem(spacerItem12, 8, 0, 1, 1) - spacerItem13 = QtGui.QSpacerItem(10, 10, QtGui.QSizePolicy.Minimum, QtGui.QSizePolicy.Expanding) + spacerItem13 = QtWidgets.QSpacerItem( + 10, 10, QtWidgets.QSizePolicy.Minimum, QtWidgets.QSizePolicy.Expanding + ) self.gridLayout_5.addItem(spacerItem13, 10, 0, 1, 1) - spacerItem14 = QtGui.QSpacerItem(10, 10, QtGui.QSizePolicy.Minimum, QtGui.QSizePolicy.Expanding) + spacerItem14 = QtWidgets.QSpacerItem( + 10, 10, QtWidgets.QSizePolicy.Minimum, QtWidgets.QSizePolicy.Expanding + ) self.gridLayout_5.addItem(spacerItem14, 9, 0, 1, 1) - spacerItem15 = QtGui.QSpacerItem(10, 10, QtGui.QSizePolicy.Minimum, QtGui.QSizePolicy.Expanding) + spacerItem15 = QtWidgets.QSpacerItem( + 10, 10, QtWidgets.QSizePolicy.Minimum, QtWidgets.QSizePolicy.Expanding + ) self.gridLayout_5.addItem(spacerItem15, 11, 0, 1, 1) - spacerItem16 = QtGui.QSpacerItem(10, 10, QtGui.QSizePolicy.Minimum, QtGui.QSizePolicy.Expanding) + spacerItem16 = QtWidgets.QSpacerItem( + 10, 10, QtWidgets.QSizePolicy.Minimum, QtWidgets.QSizePolicy.Expanding + ) self.gridLayout_5.addItem(spacerItem16, 12, 0, 1, 1) - self.runhunter_tabframe = QtGui.QTabWidget(self.hunter_tab) - self.runhunter_tabframe.setGeometry(QtCore.QRect(10, 420 * scale, 901 * scale, 181 * scale)) + self.runhunter_tabframe = QtWidgets.QTabWidget(self.hunter_tab) + self.runhunter_tabframe.setGeometry( + QtCore.QRect(10, 420, 901, 181) + ) self.runhunter_tabframe.setObjectName("runhunter_tabframe") - self.singlerun_tab = QtGui.QWidget() + self.singlerun_tab = QtWidgets.QWidget() self.singlerun_tab.setObjectName("singlerun_tab") - self.horizontalLayoutWidget_3 = QtGui.QWidget(self.singlerun_tab) - self.horizontalLayoutWidget_3.setGeometry(QtCore.QRect(169 * scale, 9, 721 * scale, 131 * scale)) + self.horizontalLayoutWidget_3 = QtWidgets.QWidget(self.singlerun_tab) + self.horizontalLayoutWidget_3.setGeometry( + QtCore.QRect(169, 9, 721, 131) + ) self.horizontalLayoutWidget_3.setObjectName("horizontalLayoutWidget_3") - self.horizontalLayout = QtGui.QHBoxLayout(self.horizontalLayoutWidget_3) + self.horizontalLayout = QtWidgets.QHBoxLayout(self.horizontalLayoutWidget_3) self.horizontalLayout.setContentsMargins(0, 0, 0, 0) self.horizontalLayout.setObjectName("horizontalLayout") - self.tab_a_statusrun_pte = QtGui.QPlainTextEdit(self.horizontalLayoutWidget_3) + self.tab_a_statusrun_pte = QtWidgets.QPlainTextEdit( + self.horizontalLayoutWidget_3 + ) self.tab_a_statusrun_pte.setObjectName("tab_a_statusrun_pte") self.horizontalLayout.addWidget(self.tab_a_statusrun_pte) - self.verticalLayoutWidget_8 = QtGui.QWidget(self.singlerun_tab) - self.verticalLayoutWidget_8.setGeometry(QtCore.QRect(10, 10, 152 * scale, 129 * scale)) + self.verticalLayoutWidget_8 = QtWidgets.QWidget(self.singlerun_tab) + self.verticalLayoutWidget_8.setGeometry( + QtCore.QRect(10, 10, 152, 129) + ) self.verticalLayoutWidget_8.setObjectName("verticalLayoutWidget_8") - self.verticalLayout_5 = QtGui.QVBoxLayout(self.verticalLayoutWidget_8) - self.verticalLayout_5.setSizeConstraint(QtGui.QLayout.SetNoConstraint) + self.verticalLayout_5 = QtWidgets.QVBoxLayout(self.verticalLayoutWidget_8) + self.verticalLayout_5.setSizeConstraint(QtWidgets.QLayout.SetNoConstraint) self.verticalLayout_5.setContentsMargins(0, 0, 0, 0) self.verticalLayout_5.setObjectName("verticalLayout_5") - self.tab_a_runhunter_pb = QtGui.QPushButton(self.verticalLayoutWidget_8) + self.tab_a_runhunter_pb = QtWidgets.QPushButton(self.verticalLayoutWidget_8) self.tab_a_runhunter_pb.setMinimumSize(QtCore.QSize(150, 0)) self.tab_a_runhunter_pb.setMaximumSize(QtCore.QSize(170, 16777215)) self.tab_a_runhunter_pb.setObjectName("tab_a_runhunter_pb") self.verticalLayout_5.addWidget(self.tab_a_runhunter_pb) - self.tab_a_runhunter_pgb = QtGui.QProgressBar(self.verticalLayoutWidget_8) + self.tab_a_runhunter_pgb = QtWidgets.QProgressBar(self.verticalLayoutWidget_8) self.tab_a_runhunter_pgb.setMaximumSize(QtCore.QSize(150, 16777215)) self.tab_a_runhunter_pgb.setProperty("value", 5) self.tab_a_runhunter_pgb.setTextVisible(False) self.tab_a_runhunter_pgb.setObjectName("tab_a_runhunter_pgb") self.verticalLayout_5.addWidget(self.tab_a_runhunter_pgb) self.runhunter_tabframe.addTab(self.singlerun_tab, "") - self.savecfg_tab = QtGui.QWidget() + self.savecfg_tab = QtWidgets.QWidget() self.savecfg_tab.setObjectName("savecfg_tab") - self.verticalLayoutWidget_2 = QtGui.QWidget(self.savecfg_tab) - self.verticalLayoutWidget_2.setGeometry(QtCore.QRect(10, 5, 881 * scale, 131 * scale)) + self.verticalLayoutWidget_2 = QtWidgets.QWidget(self.savecfg_tab) + self.verticalLayoutWidget_2.setGeometry( + QtCore.QRect(10, 5, 881, 131) + ) self.verticalLayoutWidget_2.setObjectName("verticalLayoutWidget_2") - self.verticalLayout = QtGui.QVBoxLayout(self.verticalLayoutWidget_2) + self.verticalLayout = QtWidgets.QVBoxLayout(self.verticalLayoutWidget_2) self.verticalLayout.setContentsMargins(0, 0, 0, 0) self.verticalLayout.setObjectName("verticalLayout") - self.horizontalLayout_2 = QtGui.QHBoxLayout() + self.horizontalLayout_2 = QtWidgets.QHBoxLayout() self.horizontalLayout_2.setObjectName("horizontalLayout_2") - self.label = QtGui.QLabel(self.verticalLayoutWidget_2) + self.label = QtWidgets.QLabel(self.verticalLayoutWidget_2) self.label.setObjectName("label") self.horizontalLayout_2.addWidget(self.label) - self.tab_a_cfgpath_le = QtGui.QLineEdit(self.verticalLayoutWidget_2) + self.tab_a_cfgpath_le = QtWidgets.QLineEdit(self.verticalLayoutWidget_2) self.tab_a_cfgpath_le.setObjectName("tab_a_cfgpath_le") self.horizontalLayout_2.addWidget(self.tab_a_cfgpath_le) - self.tab_a_cfgpath_pb = QtGui.QPushButton(self.verticalLayoutWidget_2) + self.tab_a_cfgpath_pb = QtWidgets.QPushButton(self.verticalLayoutWidget_2) self.tab_a_cfgpath_pb.setObjectName("tab_a_cfgpath_pb") self.horizontalLayout_2.addWidget(self.tab_a_cfgpath_pb) self.verticalLayout.addLayout(self.horizontalLayout_2) - self.horizontalLayout_3 = QtGui.QHBoxLayout() + self.horizontalLayout_3 = QtWidgets.QHBoxLayout() self.horizontalLayout_3.setObjectName("horizontalLayout_3") - self.tab_a_gencfg_pb = QtGui.QPushButton(self.verticalLayoutWidget_2) + self.tab_a_gencfg_pb = QtWidgets.QPushButton(self.verticalLayoutWidget_2) self.tab_a_gencfg_pb.setObjectName("tab_a_gencfg_pb") self.horizontalLayout_3.addWidget(self.tab_a_gencfg_pb) - self.tab_a_gencfg_pte = QtGui.QPlainTextEdit(self.verticalLayoutWidget_2) + self.tab_a_gencfg_pte = QtWidgets.QPlainTextEdit(self.verticalLayoutWidget_2) self.tab_a_gencfg_pte.setObjectName("tab_a_gencfg_pte") self.horizontalLayout_3.addWidget(self.tab_a_gencfg_pte) self.verticalLayout.addLayout(self.horizontalLayout_3) self.runhunter_tabframe.addTab(self.savecfg_tab, "") - self.horizontalLayoutWidget_19 = QtGui.QWidget(self.hunter_tab) - self.horizontalLayoutWidget_19.setGeometry(QtCore.QRect(10, 10, 901 * scale, 31 * scale)) + self.horizontalLayoutWidget_19 = QtWidgets.QWidget(self.hunter_tab) + self.horizontalLayoutWidget_19.setGeometry( + QtCore.QRect(10, 10, 901, 31) + ) self.horizontalLayoutWidget_19.setObjectName("horizontalLayoutWidget_19") - self.horizontalLayout_31 = QtGui.QHBoxLayout(self.horizontalLayoutWidget_19) + self.horizontalLayout_31 = QtWidgets.QHBoxLayout(self.horizontalLayoutWidget_19) self.horizontalLayout_31.setContentsMargins(0, 0, 0, 0) self.horizontalLayout_31.setObjectName("horizontalLayout_31") - self.horizontalLayout_14 = QtGui.QHBoxLayout() + self.horizontalLayout_14 = QtWidgets.QHBoxLayout() self.horizontalLayout_14.setObjectName("horizontalLayout_14") - self.label_23 = QtGui.QLabel(self.horizontalLayoutWidget_19) + self.label_23 = QtWidgets.QLabel(self.horizontalLayoutWidget_19) self.label_23.setMaximumSize(QtCore.QSize(120, 16777215)) self.label_23.setObjectName("label_23") self.horizontalLayout_14.addWidget(self.label_23) - self.vendor_cmb = QtGui.QComboBox(self.horizontalLayoutWidget_19) + self.vendor_cmb = QtWidgets.QComboBox(self.horizontalLayoutWidget_19) self.vendor_cmb.setMinimumSize(QtCore.QSize(250, 0)) self.vendor_cmb.setMaxVisibleItems(15) self.vendor_cmb.setObjectName("vendor_cmb") @@ -387,93 +438,108 @@ def setupUi(self, MainWindow, scale=1): self.vendor_cmb.addItem("") self.vendor_cmb.addItem("") self.vendor_cmb.addItem("") + self.vendor_cmb.addItem("") self.horizontalLayout_14.addWidget(self.vendor_cmb) - self.line_9 = QtGui.QFrame(self.horizontalLayoutWidget_19) - self.line_9.setFrameShape(QtGui.QFrame.VLine) - self.line_9.setFrameShadow(QtGui.QFrame.Sunken) + self.line_9 = QtWidgets.QFrame(self.horizontalLayoutWidget_19) + self.line_9.setFrameShape(QtWidgets.QFrame.VLine) + self.line_9.setFrameShadow(QtWidgets.QFrame.Sunken) self.line_9.setObjectName("line_9") self.horizontalLayout_14.addWidget(self.line_9) - self.horizontalLayout_18 = QtGui.QHBoxLayout() + self.horizontalLayout_18 = QtWidgets.QHBoxLayout() self.horizontalLayout_18.setObjectName("horizontalLayout_18") - self.label_24 = QtGui.QLabel(self.horizontalLayoutWidget_19) + self.label_24 = QtWidgets.QLabel(self.horizontalLayoutWidget_19) self.label_24.setObjectName("label_24") self.horizontalLayout_18.addWidget(self.label_24) - self.mode_lcms_rb = QtGui.QRadioButton(self.horizontalLayoutWidget_19) + self.mode_lcms_rb = QtWidgets.QRadioButton(self.horizontalLayoutWidget_19) self.mode_lcms_rb.setChecked(True) self.mode_lcms_rb.setAutoExclusive(True) self.mode_lcms_rb.setObjectName("mode_lcms_rb") self.horizontalLayout_18.addWidget(self.mode_lcms_rb) - self.mode_static_rb = QtGui.QRadioButton(self.horizontalLayoutWidget_19) + self.mode_static_rb = QtWidgets.QRadioButton(self.horizontalLayoutWidget_19) self.mode_static_rb.setChecked(False) self.mode_static_rb.setObjectName("mode_static_rb") self.horizontalLayout_18.addWidget(self.mode_static_rb) self.horizontalLayout_14.addLayout(self.horizontalLayout_18) self.horizontalLayout_31.addLayout(self.horizontalLayout_14) - spacerItem17 = QtGui.QSpacerItem(40, 20, QtGui.QSizePolicy.Expanding, QtGui.QSizePolicy.Minimum) + spacerItem17 = QtWidgets.QSpacerItem( + 40, 20, QtWidgets.QSizePolicy.Expanding, QtWidgets.QSizePolicy.Minimum + ) self.horizontalLayout_31.addItem(spacerItem17) self.tabframe.addTab(self.hunter_tab, "") - self.batch_tab = QtGui.QWidget() + self.batch_tab = QtWidgets.QWidget() self.batch_tab.setObjectName("batch_tab") - self.gridLayoutWidget_7 = QtGui.QWidget(self.batch_tab) - self.gridLayoutWidget_7.setGeometry(QtCore.QRect(10, 10, 901 * scale, 581 * scale)) + self.gridLayoutWidget_7 = QtWidgets.QWidget(self.batch_tab) + self.gridLayoutWidget_7.setGeometry( + QtCore.QRect(10, 10, 901, 581) + ) self.gridLayoutWidget_7.setObjectName("gridLayoutWidget_7") - self.gridLayout_9 = QtGui.QGridLayout(self.gridLayoutWidget_7) + self.gridLayout_9 = QtWidgets.QGridLayout(self.gridLayoutWidget_7) self.gridLayout_9.setContentsMargins(0, 0, 0, 0) self.gridLayout_9.setObjectName("gridLayout_9") - self.line_23 = QtGui.QFrame(self.gridLayoutWidget_7) - self.line_23.setFrameShape(QtGui.QFrame.HLine) - self.line_23.setFrameShadow(QtGui.QFrame.Sunken) + self.line_23 = QtWidgets.QFrame(self.gridLayoutWidget_7) + self.line_23.setFrameShape(QtWidgets.QFrame.HLine) + self.line_23.setFrameShadow(QtWidgets.QFrame.Sunken) self.line_23.setObjectName("line_23") self.gridLayout_9.addWidget(self.line_23, 2, 1, 1, 1) - self.tab_b_statusrun_pte = QtGui.QPlainTextEdit(self.gridLayoutWidget_7) + self.tab_b_statusrun_pte = QtWidgets.QPlainTextEdit(self.gridLayoutWidget_7) self.tab_b_statusrun_pte.setMaximumSize(QtCore.QSize(16777215, 400)) self.tab_b_statusrun_pte.setObjectName("tab_b_statusrun_pte") self.gridLayout_9.addWidget(self.tab_b_statusrun_pte, 6, 1, 1, 1) - self.label_98 = QtGui.QLabel(self.gridLayoutWidget_7) + self.label_98 = QtWidgets.QLabel(self.gridLayoutWidget_7) self.label_98.setObjectName("label_98") self.gridLayout_9.addWidget(self.label_98, 0, 0, 1, 1) - self.horizontalLayout_26 = QtGui.QHBoxLayout() + self.horizontalLayout_26 = QtWidgets.QHBoxLayout() self.horizontalLayout_26.setObjectName("horizontalLayout_26") - self.tab_b_1_lb = QtGui.QLabel(self.gridLayoutWidget_7) + self.tab_b_1_lb = QtWidgets.QLabel(self.gridLayoutWidget_7) self.tab_b_1_lb.setObjectName("tab_b_1_lb") self.horizontalLayout_26.addWidget(self.tab_b_1_lb) - self.tab_b_addcfg_pb = QtGui.QPushButton(self.gridLayoutWidget_7) + self.tab_b_addcfg_pb = QtWidgets.QPushButton(self.gridLayoutWidget_7) self.tab_b_addcfg_pb.setObjectName("tab_b_addcfg_pb") self.horizontalLayout_26.addWidget(self.tab_b_addcfg_pb) - spacerItem18 = QtGui.QSpacerItem(40, 20, QtGui.QSizePolicy.Expanding, QtGui.QSizePolicy.Minimum) + spacerItem18 = QtWidgets.QSpacerItem( + 40, 20, QtWidgets.QSizePolicy.Expanding, QtWidgets.QSizePolicy.Minimum + ) self.horizontalLayout_26.addItem(spacerItem18) - self.tab_b_2_lb = QtGui.QLabel(self.gridLayoutWidget_7) + self.tab_b_2_lb = QtWidgets.QLabel(self.gridLayoutWidget_7) self.tab_b_2_lb.setObjectName("tab_b_2_lb") self.horizontalLayout_26.addWidget(self.tab_b_2_lb) - self.tab_b_addcfgfolder_pb = QtGui.QPushButton(self.gridLayoutWidget_7) + self.tab_b_addcfgfolder_pb = QtWidgets.QPushButton(self.gridLayoutWidget_7) self.tab_b_addcfgfolder_pb.setObjectName("tab_b_addcfgfolder_pb") self.horizontalLayout_26.addWidget(self.tab_b_addcfgfolder_pb) self.gridLayout_9.addLayout(self.horizontalLayout_26, 0, 1, 1, 1) - self.verticalLayout_2 = QtGui.QVBoxLayout() + self.verticalLayout_2 = QtWidgets.QVBoxLayout() self.verticalLayout_2.setObjectName("verticalLayout_2") - spacerItem19 = QtGui.QSpacerItem(20, 40, QtGui.QSizePolicy.Minimum, QtGui.QSizePolicy.Expanding) + spacerItem19 = QtWidgets.QSpacerItem( + 20, 40, QtWidgets.QSizePolicy.Minimum, QtWidgets.QSizePolicy.Expanding + ) self.verticalLayout_2.addItem(spacerItem19) - self.tab_b_clearall_pb = QtGui.QPushButton(self.gridLayoutWidget_7) + self.tab_b_clearall_pb = QtWidgets.QPushButton(self.gridLayoutWidget_7) self.tab_b_clearall_pb.setObjectName("tab_b_clearall_pb") self.verticalLayout_2.addWidget(self.tab_b_clearall_pb) - spacerItem20 = QtGui.QSpacerItem(20, 40, QtGui.QSizePolicy.Minimum, QtGui.QSizePolicy.Expanding) + spacerItem20 = QtWidgets.QSpacerItem( + 20, 40, QtWidgets.QSizePolicy.Minimum, QtWidgets.QSizePolicy.Expanding + ) self.verticalLayout_2.addItem(spacerItem20) self.gridLayout_9.addLayout(self.verticalLayout_2, 1, 2, 1, 1) - self.line_22 = QtGui.QFrame(self.gridLayoutWidget_7) - self.line_22.setFrameShape(QtGui.QFrame.HLine) - self.line_22.setFrameShadow(QtGui.QFrame.Sunken) + self.line_22 = QtWidgets.QFrame(self.gridLayoutWidget_7) + self.line_22.setFrameShape(QtWidgets.QFrame.HLine) + self.line_22.setFrameShadow(QtWidgets.QFrame.Sunken) self.line_22.setObjectName("line_22") self.gridLayout_9.addWidget(self.line_22, 5, 1, 1, 1) - self.verticalLayout_3 = QtGui.QVBoxLayout() + self.verticalLayout_3 = QtWidgets.QVBoxLayout() self.verticalLayout_3.setObjectName("verticalLayout_3") - self.tab_b_runbatch_pb = QtGui.QPushButton(self.gridLayoutWidget_7) + self.tab_b_runbatch_pb = QtWidgets.QPushButton(self.gridLayoutWidget_7) self.tab_b_runbatch_pb.setObjectName("tab_b_runbatch_pb") self.verticalLayout_3.addWidget(self.tab_b_runbatch_pb) - self.tab_b_runbatch_pgb = QtGui.QProgressBar(self.gridLayoutWidget_7) - sizePolicy = QtGui.QSizePolicy(QtGui.QSizePolicy.Fixed, QtGui.QSizePolicy.Fixed) + self.tab_b_runbatch_pgb = QtWidgets.QProgressBar(self.gridLayoutWidget_7) + sizePolicy = QtWidgets.QSizePolicy( + QtWidgets.QSizePolicy.Fixed, QtWidgets.QSizePolicy.Fixed + ) sizePolicy.setHorizontalStretch(0) sizePolicy.setVerticalStretch(0) - sizePolicy.setHeightForWidth(self.tab_b_runbatch_pgb.sizePolicy().hasHeightForWidth()) + sizePolicy.setHeightForWidth( + self.tab_b_runbatch_pgb.sizePolicy().hasHeightForWidth() + ) self.tab_b_runbatch_pgb.setSizePolicy(sizePolicy) self.tab_b_runbatch_pgb.setMaximumSize(QtCore.QSize(160, 16777215)) self.tab_b_runbatch_pgb.setProperty("value", 5) @@ -482,281 +548,301 @@ def setupUi(self, MainWindow, scale=1): self.tab_b_runbatch_pgb.setObjectName("tab_b_runbatch_pgb") self.verticalLayout_3.addWidget(self.tab_b_runbatch_pgb) self.gridLayout_9.addLayout(self.verticalLayout_3, 6, 0, 1, 1) - self.horizontalLayout_25 = QtGui.QHBoxLayout() + self.horizontalLayout_25 = QtWidgets.QHBoxLayout() self.horizontalLayout_25.setObjectName("horizontalLayout_25") - self.tab_b_maxsubcore_lb = QtGui.QLabel(self.gridLayoutWidget_7) + self.tab_b_maxsubcore_lb = QtWidgets.QLabel(self.gridLayoutWidget_7) self.tab_b_maxsubcore_lb.setObjectName("tab_b_maxsubcore_lb") self.horizontalLayout_25.addWidget(self.tab_b_maxsubcore_lb) - self.tab_b_maxsubcore_spb = QtGui.QSpinBox(self.gridLayoutWidget_7) + self.tab_b_maxsubcore_spb = QtWidgets.QSpinBox(self.gridLayoutWidget_7) self.tab_b_maxsubcore_spb.setMaximum(16) self.tab_b_maxsubcore_spb.setProperty("value", 4) self.tab_b_maxsubcore_spb.setObjectName("tab_b_maxsubcore_spb") self.horizontalLayout_25.addWidget(self.tab_b_maxsubcore_spb) - spacerItem21 = QtGui.QSpacerItem(20, 20, QtGui.QSizePolicy.Fixed, QtGui.QSizePolicy.Minimum) + spacerItem21 = QtWidgets.QSpacerItem( + 20, 20, QtWidgets.QSizePolicy.Fixed, QtWidgets.QSizePolicy.Minimum + ) self.horizontalLayout_25.addItem(spacerItem21) - self.tab_b_maxsubram_lb = QtGui.QLabel(self.gridLayoutWidget_7) + self.tab_b_maxsubram_lb = QtWidgets.QLabel(self.gridLayoutWidget_7) self.tab_b_maxsubram_lb.setObjectName("tab_b_maxsubram_lb") self.horizontalLayout_25.addWidget(self.tab_b_maxsubram_lb) - self.tab_b_maxsubram_spb = QtGui.QSpinBox(self.gridLayoutWidget_7) + self.tab_b_maxsubram_spb = QtWidgets.QSpinBox(self.gridLayoutWidget_7) self.tab_b_maxsubram_spb.setMinimum(1) self.tab_b_maxsubram_spb.setMaximum(64) self.tab_b_maxsubram_spb.setProperty("value", 6) self.tab_b_maxsubram_spb.setObjectName("tab_b_maxsubram_spb") self.horizontalLayout_25.addWidget(self.tab_b_maxsubram_spb) - spacerItem22 = QtGui.QSpacerItem(40, 20, QtGui.QSizePolicy.Expanding, QtGui.QSizePolicy.Minimum) + spacerItem22 = QtWidgets.QSpacerItem( + 40, 20, QtWidgets.QSizePolicy.Expanding, QtWidgets.QSizePolicy.Minimum + ) self.horizontalLayout_25.addItem(spacerItem22) self.gridLayout_9.addLayout(self.horizontalLayout_25, 3, 1, 1, 1) - self.horizontalLayout_27 = QtGui.QHBoxLayout() + self.horizontalLayout_27 = QtWidgets.QHBoxLayout() self.horizontalLayout_27.setObjectName("horizontalLayout_27") - self.tab_b_mutlimode_cmb = QtGui.QComboBox(self.gridLayoutWidget_7) + self.tab_b_mutlimode_cmb = QtWidgets.QComboBox(self.gridLayoutWidget_7) self.tab_b_mutlimode_cmb.setMinimumSize(QtCore.QSize(250, 0)) self.tab_b_mutlimode_cmb.setObjectName("tab_b_mutlimode_cmb") self.tab_b_mutlimode_cmb.addItem("") self.tab_b_mutlimode_cmb.addItem("") self.horizontalLayout_27.addWidget(self.tab_b_mutlimode_cmb) - self.tab_b_maxbatch_lb = QtGui.QLabel(self.gridLayoutWidget_7) + self.tab_b_maxbatch_lb = QtWidgets.QLabel(self.gridLayoutWidget_7) self.tab_b_maxbatch_lb.setObjectName("tab_b_maxbatch_lb") self.horizontalLayout_27.addWidget(self.tab_b_maxbatch_lb) - self.tab_b_maxbatch_spb = QtGui.QSpinBox(self.gridLayoutWidget_7) + self.tab_b_maxbatch_spb = QtWidgets.QSpinBox(self.gridLayoutWidget_7) self.tab_b_maxbatch_spb.setMaximum(16) self.tab_b_maxbatch_spb.setProperty("value", 3) self.tab_b_maxbatch_spb.setObjectName("tab_b_maxbatch_spb") self.horizontalLayout_27.addWidget(self.tab_b_maxbatch_spb) - spacerItem23 = QtGui.QSpacerItem(40, 20, QtGui.QSizePolicy.Expanding, QtGui.QSizePolicy.Minimum) + spacerItem23 = QtWidgets.QSpacerItem( + 40, 20, QtWidgets.QSizePolicy.Expanding, QtWidgets.QSizePolicy.Minimum + ) self.horizontalLayout_27.addItem(spacerItem23) self.gridLayout_9.addLayout(self.horizontalLayout_27, 4, 1, 1, 1) - self.tab_b_infiles_pte = QtGui.QPlainTextEdit(self.gridLayoutWidget_7) + self.tab_b_infiles_pte = QtWidgets.QPlainTextEdit(self.gridLayoutWidget_7) self.tab_b_infiles_pte.setObjectName("tab_b_infiles_pte") self.gridLayout_9.addWidget(self.tab_b_infiles_pte, 1, 1, 1, 1) - self.label_99 = QtGui.QLabel(self.gridLayoutWidget_7) + self.label_99 = QtWidgets.QLabel(self.gridLayoutWidget_7) self.label_99.setObjectName("label_99") self.gridLayout_9.addWidget(self.label_99, 3, 0, 1, 1) self.tabframe.addTab(self.batch_tab, "") - self.cfg_tab = QtGui.QWidget() + self.cfg_tab = QtWidgets.QWidget() self.cfg_tab.setObjectName("cfg_tab") - self.gridLayoutWidget_6 = QtGui.QWidget(self.cfg_tab) - self.gridLayoutWidget_6.setGeometry(QtCore.QRect(10, 10, 901 * scale, 320 * scale)) + self.gridLayoutWidget_6 = QtWidgets.QWidget(self.cfg_tab) + self.gridLayoutWidget_6.setGeometry( + QtCore.QRect(10, 10, 901, 320) + ) self.gridLayoutWidget_6.setObjectName("gridLayoutWidget_6") - self.gridLayout_6 = QtGui.QGridLayout(self.gridLayoutWidget_6) + self.gridLayout_6 = QtWidgets.QGridLayout(self.gridLayoutWidget_6) self.gridLayout_6.setContentsMargins(0, 0, 0, 0) self.gridLayout_6.setObjectName("gridLayout_6") - self.tab_c_hgcfg_le = QtGui.QLineEdit(self.gridLayoutWidget_6) + self.tab_c_hgcfg_le = QtWidgets.QLineEdit(self.gridLayoutWidget_6) self.tab_c_hgcfg_le.setObjectName("tab_c_hgcfg_le") self.gridLayout_6.addWidget(self.tab_c_hgcfg_le, 5, 1, 1, 1) - self.horizontalLayout_23 = QtGui.QHBoxLayout() + self.horizontalLayout_23 = QtWidgets.QHBoxLayout() self.horizontalLayout_23.setObjectName("horizontalLayout_23") - self.label_93 = QtGui.QLabel(self.gridLayoutWidget_6) + self.label_93 = QtWidgets.QLabel(self.gridLayoutWidget_6) self.label_93.setObjectName("label_93") self.horizontalLayout_23.addWidget(self.label_93) - self.tab_c_imagetype_cmb = QtGui.QComboBox(self.gridLayoutWidget_6) + self.tab_c_imagetype_cmb = QtWidgets.QComboBox(self.gridLayoutWidget_6) self.tab_c_imagetype_cmb.setObjectName("tab_c_imagetype_cmb") self.tab_c_imagetype_cmb.addItem("") self.tab_c_imagetype_cmb.addItem("") self.horizontalLayout_23.addWidget(self.tab_c_imagetype_cmb) - self.label_94 = QtGui.QLabel(self.gridLayoutWidget_6) + self.label_94 = QtWidgets.QLabel(self.gridLayoutWidget_6) self.label_94.setObjectName("label_94") self.horizontalLayout_23.addWidget(self.label_94) - self.tab_c_dpi_spb = QtGui.QSpinBox(self.gridLayoutWidget_6) + self.tab_c_dpi_spb = QtWidgets.QSpinBox(self.gridLayoutWidget_6) self.tab_c_dpi_spb.setMinimum(50) self.tab_c_dpi_spb.setMaximum(1000) self.tab_c_dpi_spb.setSingleStep(100) self.tab_c_dpi_spb.setProperty("value", 300) self.tab_c_dpi_spb.setObjectName("tab_c_dpi_spb") self.horizontalLayout_23.addWidget(self.tab_c_dpi_spb) - spacerItem24 = QtGui.QSpacerItem(40, 20, QtGui.QSizePolicy.Expanding, QtGui.QSizePolicy.Minimum) + spacerItem24 = QtWidgets.QSpacerItem( + 40, 20, QtWidgets.QSizePolicy.Expanding, QtWidgets.QSizePolicy.Minimum + ) self.horizontalLayout_23.addItem(spacerItem24) self.gridLayout_6.addLayout(self.horizontalLayout_23, 8, 1, 1, 1) - self.line_12 = QtGui.QFrame(self.gridLayoutWidget_6) - self.line_12.setFrameShape(QtGui.QFrame.HLine) - self.line_12.setFrameShadow(QtGui.QFrame.Sunken) + self.line_12 = QtWidgets.QFrame(self.gridLayoutWidget_6) + self.line_12.setFrameShape(QtWidgets.QFrame.HLine) + self.line_12.setFrameShadow(QtWidgets.QFrame.Sunken) self.line_12.setObjectName("line_12") self.gridLayout_6.addWidget(self.line_12, 6, 1, 1, 1) - self.horizontalLayout_36 = QtGui.QHBoxLayout() + self.horizontalLayout_36 = QtWidgets.QHBoxLayout() self.horizontalLayout_36.setObjectName("horizontalLayout_36") - self.tab_c_scorecfgtg_lb = QtGui.QLabel(self.gridLayoutWidget_6) + self.tab_c_scorecfgtg_lb = QtWidgets.QLabel(self.gridLayoutWidget_6) self.tab_c_scorecfgtg_lb.setMinimumSize(QtCore.QSize(80, 0)) self.tab_c_scorecfgtg_lb.setObjectName("tab_c_scorecfgtg_lb") self.horizontalLayout_36.addWidget(self.tab_c_scorecfgtg_lb) - self.tab_c_scorecfgtg_le = QtGui.QLineEdit(self.gridLayoutWidget_6) + self.tab_c_scorecfgtg_le = QtWidgets.QLineEdit(self.gridLayoutWidget_6) self.tab_c_scorecfgtg_le.setObjectName("tab_c_scorecfgtg_le") self.horizontalLayout_36.addWidget(self.tab_c_scorecfgtg_le) self.gridLayout_6.addLayout(self.horizontalLayout_36, 3, 1, 1, 1) - self.horizontalLayout_43 = QtGui.QHBoxLayout() + self.horizontalLayout_43 = QtWidgets.QHBoxLayout() self.horizontalLayout_43.setObjectName("horizontalLayout_43") - self.tab_c_scorecfgdg_lb = QtGui.QLabel(self.gridLayoutWidget_6) + self.tab_c_scorecfgdg_lb = QtWidgets.QLabel(self.gridLayoutWidget_6) self.tab_c_scorecfgdg_lb.setMinimumSize(QtCore.QSize(80, 0)) self.tab_c_scorecfgdg_lb.setObjectName("tab_c_scorecfgdg_lb") self.horizontalLayout_43.addWidget(self.tab_c_scorecfgdg_lb) - self.tab_c_scorecfgdg_le = QtGui.QLineEdit(self.gridLayoutWidget_6) + self.tab_c_scorecfgdg_le = QtWidgets.QLineEdit(self.gridLayoutWidget_6) self.tab_c_scorecfgdg_le.setObjectName("tab_c_scorecfgdg_le") self.horizontalLayout_43.addWidget(self.tab_c_scorecfgdg_le) self.gridLayout_6.addLayout(self.horizontalLayout_43, 4, 1, 1, 1) - self.tab_c_isotopescoremode_lb = QtGui.QLabel(self.gridLayoutWidget_6) + self.tab_c_isotopescoremode_lb = QtWidgets.QLabel(self.gridLayoutWidget_6) self.tab_c_isotopescoremode_lb.setObjectName("tab_c_isotopescoremode_lb") self.gridLayout_6.addWidget(self.tab_c_isotopescoremode_lb, 10, 0, 1, 1) - self.label_14 = QtGui.QLabel(self.gridLayoutWidget_6) + self.label_14 = QtWidgets.QLabel(self.gridLayoutWidget_6) self.label_14.setObjectName("label_14") self.gridLayout_6.addWidget(self.label_14, 5, 0, 1, 1) - self.tab_c_scorecfgdg_pb = QtGui.QPushButton(self.gridLayoutWidget_6) + self.tab_c_scorecfgdg_pb = QtWidgets.QPushButton(self.gridLayoutWidget_6) self.tab_c_scorecfgdg_pb.setObjectName("tab_c_scorecfgdg_pb") self.gridLayout_6.addWidget(self.tab_c_scorecfgdg_pb, 4, 2, 1, 1) - self.horizontalLayout_37 = QtGui.QHBoxLayout() + self.horizontalLayout_37 = QtWidgets.QHBoxLayout() self.horizontalLayout_37.setObjectName("horizontalLayout_37") - self.tab_c_scorecfgpl_lb = QtGui.QLabel(self.gridLayoutWidget_6) + self.tab_c_scorecfgpl_lb = QtWidgets.QLabel(self.gridLayoutWidget_6) self.tab_c_scorecfgpl_lb.setMinimumSize(QtCore.QSize(80, 0)) self.tab_c_scorecfgpl_lb.setObjectName("tab_c_scorecfgpl_lb") self.horizontalLayout_37.addWidget(self.tab_c_scorecfgpl_lb) - self.tab_c_scorecfgpl_le = QtGui.QLineEdit(self.gridLayoutWidget_6) + self.tab_c_scorecfgpl_le = QtWidgets.QLineEdit(self.gridLayoutWidget_6) self.tab_c_scorecfgpl_le.setObjectName("tab_c_scorecfgpl_le") self.horizontalLayout_37.addWidget(self.tab_c_scorecfgpl_le) self.gridLayout_6.addLayout(self.horizontalLayout_37, 2, 1, 1, 1) - self.tab_c_scorecfgpl_pb = QtGui.QPushButton(self.gridLayoutWidget_6) + self.tab_c_scorecfgpl_pb = QtWidgets.QPushButton(self.gridLayoutWidget_6) self.tab_c_scorecfgpl_pb.setObjectName("tab_c_scorecfgpl_pb") self.gridLayout_6.addWidget(self.tab_c_scorecfgpl_pb, 2, 2, 1, 1) - self.tab_c_scorecfgtg_pb = QtGui.QPushButton(self.gridLayoutWidget_6) + self.tab_c_scorecfgtg_pb = QtWidgets.QPushButton(self.gridLayoutWidget_6) self.tab_c_scorecfgtg_pb.setObjectName("tab_c_scorecfgtg_pb") self.gridLayout_6.addWidget(self.tab_c_scorecfgtg_pb, 3, 2, 1, 1) - self.tab_c_hgcfg_pb = QtGui.QPushButton(self.gridLayoutWidget_6) + self.tab_c_hgcfg_pb = QtWidgets.QPushButton(self.gridLayoutWidget_6) self.tab_c_hgcfg_pb.setObjectName("tab_c_hgcfg_pb") self.gridLayout_6.addWidget(self.tab_c_hgcfg_pb, 5, 2, 1, 1) - self.label_21 = QtGui.QLabel(self.gridLayoutWidget_6) + self.label_21 = QtWidgets.QLabel(self.gridLayoutWidget_6) self.label_21.setObjectName("label_21") self.gridLayout_6.addWidget(self.label_21, 2, 0, 1, 1) - self.horizontalLayout_22 = QtGui.QHBoxLayout() + self.horizontalLayout_22 = QtWidgets.QHBoxLayout() self.horizontalLayout_22.setObjectName("horizontalLayout_22") - self.tab_c_parallization_cmb = QtGui.QComboBox(self.gridLayoutWidget_6) + self.tab_c_parallization_cmb = QtWidgets.QComboBox(self.gridLayoutWidget_6) self.tab_c_parallization_cmb.setMinimumSize(QtCore.QSize(200, 0)) self.tab_c_parallization_cmb.setObjectName("tab_c_parallization_cmb") self.tab_c_parallization_cmb.addItem("") self.tab_c_parallization_cmb.addItem("") self.horizontalLayout_22.addWidget(self.tab_c_parallization_cmb) - self.label_63 = QtGui.QLabel(self.gridLayoutWidget_6) + self.label_63 = QtWidgets.QLabel(self.gridLayoutWidget_6) self.label_63.setObjectName("label_63") self.horizontalLayout_22.addWidget(self.label_63) - self.tab_c_cores_spb = QtGui.QSpinBox(self.gridLayoutWidget_6) + self.tab_c_cores_spb = QtWidgets.QSpinBox(self.gridLayoutWidget_6) self.tab_c_cores_spb.setMinimum(1) self.tab_c_cores_spb.setProperty("value", 3) self.tab_c_cores_spb.setObjectName("tab_c_cores_spb") self.horizontalLayout_22.addWidget(self.tab_c_cores_spb) - self.label_64 = QtGui.QLabel(self.gridLayoutWidget_6) + self.label_64 = QtWidgets.QLabel(self.gridLayoutWidget_6) self.label_64.setObjectName("label_64") self.horizontalLayout_22.addWidget(self.label_64) - self.tab_c_ram_spb = QtGui.QSpinBox(self.gridLayoutWidget_6) + self.tab_c_ram_spb = QtWidgets.QSpinBox(self.gridLayoutWidget_6) self.tab_c_ram_spb.setMinimum(5) self.tab_c_ram_spb.setProperty("value", 5) self.tab_c_ram_spb.setObjectName("tab_c_ram_spb") self.horizontalLayout_22.addWidget(self.tab_c_ram_spb) - spacerItem25 = QtGui.QSpacerItem(40, 20, QtGui.QSizePolicy.Expanding, QtGui.QSizePolicy.Minimum) + spacerItem25 = QtWidgets.QSpacerItem( + 40, 20, QtWidgets.QSizePolicy.Expanding, QtWidgets.QSizePolicy.Minimum + ) self.horizontalLayout_22.addItem(spacerItem25) self.gridLayout_6.addLayout(self.horizontalLayout_22, 7, 1, 1, 1) - self.horizontalLayout_30 = QtGui.QHBoxLayout() + self.horizontalLayout_30 = QtWidgets.QHBoxLayout() self.horizontalLayout_30.setObjectName("horizontalLayout_30") - self.tab_c_tag_all_fa_chb = QtGui.QCheckBox(self.gridLayoutWidget_6) + self.tab_c_tag_all_fa_chb = QtWidgets.QCheckBox(self.gridLayoutWidget_6) self.tab_c_tag_all_fa_chb.setChecked(True) self.tab_c_tag_all_fa_chb.setObjectName("tab_c_tag_all_fa_chb") self.horizontalLayout_30.addWidget(self.tab_c_tag_all_fa_chb) - spacerItem26 = QtGui.QSpacerItem(40, 20, QtGui.QSizePolicy.Expanding, QtGui.QSizePolicy.Minimum) + spacerItem26 = QtWidgets.QSpacerItem( + 40, 20, QtWidgets.QSizePolicy.Expanding, QtWidgets.QSizePolicy.Minimum + ) self.horizontalLayout_30.addItem(spacerItem26) self.gridLayout_6.addLayout(self.horizontalLayout_30, 9, 1, 1, 1) - self.label_12 = QtGui.QLabel(self.gridLayoutWidget_6) + self.label_12 = QtWidgets.QLabel(self.gridLayoutWidget_6) self.label_12.setObjectName("label_12") self.gridLayout_6.addWidget(self.label_12, 0, 0, 1, 1) - self.tab_c_falistpl_pb = QtGui.QPushButton(self.gridLayoutWidget_6) + self.tab_c_falistpl_pb = QtWidgets.QPushButton(self.gridLayoutWidget_6) self.tab_c_falistpl_pb.setObjectName("tab_c_falistpl_pb") self.gridLayout_6.addWidget(self.tab_c_falistpl_pb, 0, 2, 1, 1) - self.tab_c_savesettings_pb = QtGui.QPushButton(self.gridLayoutWidget_6) + self.tab_c_savesettings_pb = QtWidgets.QPushButton(self.gridLayoutWidget_6) self.tab_c_savesettings_pb.setObjectName("tab_c_savesettings_pb") self.gridLayout_6.addWidget(self.tab_c_savesettings_pb, 11, 1, 1, 1) - spacerItem27 = QtGui.QSpacerItem(190, 20, QtGui.QSizePolicy.Fixed, QtGui.QSizePolicy.Minimum) + spacerItem27 = QtWidgets.QSpacerItem( + 190, 20, QtWidgets.QSizePolicy.Fixed, QtWidgets.QSizePolicy.Minimum + ) self.gridLayout_6.addItem(spacerItem27, 11, 0, 1, 1) - self.horizontalLayout_38 = QtGui.QHBoxLayout() + self.horizontalLayout_38 = QtWidgets.QHBoxLayout() self.horizontalLayout_38.setObjectName("horizontalLayout_38") - self.tab_c_falisttg_lb = QtGui.QLabel(self.gridLayoutWidget_6) + self.tab_c_falisttg_lb = QtWidgets.QLabel(self.gridLayoutWidget_6) self.tab_c_falisttg_lb.setMinimumSize(QtCore.QSize(80, 0)) self.tab_c_falisttg_lb.setObjectName("tab_c_falisttg_lb") self.horizontalLayout_38.addWidget(self.tab_c_falisttg_lb) - self.tab_c_falisttg_le = QtGui.QLineEdit(self.gridLayoutWidget_6) + self.tab_c_falisttg_le = QtWidgets.QLineEdit(self.gridLayoutWidget_6) self.tab_c_falisttg_le.setObjectName("tab_c_falisttg_le") self.horizontalLayout_38.addWidget(self.tab_c_falisttg_le) self.gridLayout_6.addLayout(self.horizontalLayout_38, 1, 1, 1, 1) - self.horizontalLayout_39 = QtGui.QHBoxLayout() + self.horizontalLayout_39 = QtWidgets.QHBoxLayout() self.horizontalLayout_39.setObjectName("horizontalLayout_39") - self.tab_c_falistpl_lb = QtGui.QLabel(self.gridLayoutWidget_6) + self.tab_c_falistpl_lb = QtWidgets.QLabel(self.gridLayoutWidget_6) self.tab_c_falistpl_lb.setMinimumSize(QtCore.QSize(80, 0)) self.tab_c_falistpl_lb.setObjectName("tab_c_falistpl_lb") self.horizontalLayout_39.addWidget(self.tab_c_falistpl_lb) - self.tab_c_falistpl_le = QtGui.QLineEdit(self.gridLayoutWidget_6) + self.tab_c_falistpl_le = QtWidgets.QLineEdit(self.gridLayoutWidget_6) self.tab_c_falistpl_le.setObjectName("tab_c_falistpl_le") self.horizontalLayout_39.addWidget(self.tab_c_falistpl_le) self.gridLayout_6.addLayout(self.horizontalLayout_39, 0, 1, 1, 1) - self.tab_c_falisttg_pb = QtGui.QPushButton(self.gridLayoutWidget_6) + self.tab_c_falisttg_pb = QtWidgets.QPushButton(self.gridLayoutWidget_6) self.tab_c_falisttg_pb.setObjectName("tab_c_falisttg_pb") self.gridLayout_6.addWidget(self.tab_c_falisttg_pb, 1, 2, 1, 1) - self.horizontalLayout_24 = QtGui.QHBoxLayout() + self.horizontalLayout_24 = QtWidgets.QHBoxLayout() self.horizontalLayout_24.setObjectName("horizontalLayout_24") - self.tab_c_isotopescoremode_cmb = QtGui.QComboBox(self.gridLayoutWidget_6) + self.tab_c_isotopescoremode_cmb = QtWidgets.QComboBox(self.gridLayoutWidget_6) self.tab_c_isotopescoremode_cmb.setMinimumSize(QtCore.QSize(150, 0)) self.tab_c_isotopescoremode_cmb.setObjectName("tab_c_isotopescoremode_cmb") self.tab_c_isotopescoremode_cmb.addItem("") self.tab_c_isotopescoremode_cmb.addItem("") self.horizontalLayout_24.addWidget(self.tab_c_isotopescoremode_cmb) - self.tab_c_scoremode_lb = QtGui.QLabel(self.gridLayoutWidget_6) + self.tab_c_scoremode_lb = QtWidgets.QLabel(self.gridLayoutWidget_6) self.tab_c_scoremode_lb.setObjectName("tab_c_scoremode_lb") self.horizontalLayout_24.addWidget(self.tab_c_scoremode_lb) - self.tab_c_scoremode_cmb = QtGui.QComboBox(self.gridLayoutWidget_6) + self.tab_c_scoremode_cmb = QtWidgets.QComboBox(self.gridLayoutWidget_6) self.tab_c_scoremode_cmb.setMinimumSize(QtCore.QSize(150, 0)) self.tab_c_scoremode_cmb.setObjectName("tab_c_scoremode_cmb") self.tab_c_scoremode_cmb.addItem("") self.tab_c_scoremode_cmb.addItem("") self.horizontalLayout_24.addWidget(self.tab_c_scoremode_cmb) - spacerItem28 = QtGui.QSpacerItem(40, 20, QtGui.QSizePolicy.Expanding, QtGui.QSizePolicy.Minimum) + spacerItem28 = QtWidgets.QSpacerItem( + 40, 20, QtWidgets.QSizePolicy.Expanding, QtWidgets.QSizePolicy.Minimum + ) self.horizontalLayout_24.addItem(spacerItem28) self.gridLayout_6.addLayout(self.horizontalLayout_24, 10, 1, 1, 1) - self.label_35 = QtGui.QLabel(self.gridLayoutWidget_6) + self.label_35 = QtWidgets.QLabel(self.gridLayoutWidget_6) self.label_35.setObjectName("label_35") self.gridLayout_6.addWidget(self.label_35, 7, 0, 1, 1) - self.label_54 = QtGui.QLabel(self.gridLayoutWidget_6) + self.label_54 = QtWidgets.QLabel(self.gridLayoutWidget_6) self.label_54.setObjectName("label_54") self.gridLayout_6.addWidget(self.label_54, 8, 0, 1, 1) - self.gridLayoutWidget = QtGui.QWidget(self.cfg_tab) - self.gridLayoutWidget.setGeometry(QtCore.QRect(10, 360 * scale, 901 * scale, 251 * scale)) + self.gridLayoutWidget = QtWidgets.QWidget(self.cfg_tab) + self.gridLayoutWidget.setGeometry( + QtCore.QRect(10, 360, 901, 251) + ) self.gridLayoutWidget.setObjectName("gridLayoutWidget") - self.gridLayout_2 = QtGui.QGridLayout(self.gridLayoutWidget) + self.gridLayout_2 = QtWidgets.QGridLayout(self.gridLayoutWidget) self.gridLayout_2.setContentsMargins(0, 0, 0, 0) self.gridLayout_2.setObjectName("gridLayout_2") - self.tab_c_lmcalcfalist_le = QtGui.QLineEdit(self.gridLayoutWidget) + self.tab_c_lmcalcfalist_le = QtWidgets.QLineEdit(self.gridLayoutWidget) self.tab_c_lmcalcfalist_le.setObjectName("tab_c_lmcalcfalist_le") self.gridLayout_2.addWidget(self.tab_c_lmcalcfalist_le, 2, 1, 1, 1) - self.tab_c_lmexport_le = QtGui.QLineEdit(self.gridLayoutWidget) + self.tab_c_lmexport_le = QtWidgets.QLineEdit(self.gridLayoutWidget) self.tab_c_lmexport_le.setObjectName("tab_c_lmexport_le") self.gridLayout_2.addWidget(self.tab_c_lmexport_le, 3, 1, 1, 1) - self.tab_c_lmstatus_pte = QtGui.QPlainTextEdit(self.gridLayoutWidget) + self.tab_c_lmstatus_pte = QtWidgets.QPlainTextEdit(self.gridLayoutWidget) self.tab_c_lmstatus_pte.setObjectName("tab_c_lmstatus_pte") self.gridLayout_2.addWidget(self.tab_c_lmstatus_pte, 4, 1, 1, 1) - self.label_28 = QtGui.QLabel(self.gridLayoutWidget) + self.label_28 = QtWidgets.QLabel(self.gridLayoutWidget) self.label_28.setMaximumSize(QtCore.QSize(16777215, 16777215)) self.label_28.setObjectName("label_28") self.gridLayout_2.addWidget(self.label_28, 2, 0, 1, 1) - self.tab_c_lmcalcfalist_pb = QtGui.QPushButton(self.gridLayoutWidget) + self.tab_c_lmcalcfalist_pb = QtWidgets.QPushButton(self.gridLayoutWidget) self.tab_c_lmcalcfalist_pb.setObjectName("tab_c_lmcalcfalist_pb") self.gridLayout_2.addWidget(self.tab_c_lmcalcfalist_pb, 2, 2, 1, 1) - self.tab_c_lmexport_pb = QtGui.QPushButton(self.gridLayoutWidget) + self.tab_c_lmexport_pb = QtWidgets.QPushButton(self.gridLayoutWidget) self.tab_c_lmexport_pb.setObjectName("tab_c_lmexport_pb") self.gridLayout_2.addWidget(self.tab_c_lmexport_pb, 3, 2, 1, 1) - self.label_29 = QtGui.QLabel(self.gridLayoutWidget) + self.label_29 = QtWidgets.QLabel(self.gridLayoutWidget) self.label_29.setObjectName("label_29") self.gridLayout_2.addWidget(self.label_29, 0, 1, 1, 1) - self.label_27 = QtGui.QLabel(self.gridLayoutWidget) + self.label_27 = QtWidgets.QLabel(self.gridLayoutWidget) self.label_27.setMaximumSize(QtCore.QSize(16777215, 16777215)) self.label_27.setObjectName("label_27") self.gridLayout_2.addWidget(self.label_27, 3, 0, 1, 1) - self.label_48 = QtGui.QLabel(self.gridLayoutWidget) + self.label_48 = QtWidgets.QLabel(self.gridLayoutWidget) self.label_48.setMaximumSize(QtCore.QSize(16777215, 16777215)) self.label_48.setObjectName("label_48") self.gridLayout_2.addWidget(self.label_48, 1, 0, 1, 1) - self.horizontalLayout_44 = QtGui.QHBoxLayout() + self.horizontalLayout_44 = QtWidgets.QHBoxLayout() self.horizontalLayout_44.setObjectName("horizontalLayout_44") - self.tab_c_lipidclass_cmb = QtGui.QComboBox(self.gridLayoutWidget) + self.tab_c_lipidclass_cmb = QtWidgets.QComboBox(self.gridLayoutWidget) self.tab_c_lipidclass_cmb.setMinimumSize(QtCore.QSize(220, 0)) self.tab_c_lipidclass_cmb.setMaxVisibleItems(15) self.tab_c_lipidclass_cmb.setObjectName("tab_c_lipidclass_cmb") @@ -780,29 +866,35 @@ def setupUi(self, MainWindow, scale=1): self.tab_c_lipidclass_cmb.addItem("") self.tab_c_lipidclass_cmb.addItem("") self.horizontalLayout_44.addWidget(self.tab_c_lipidclass_cmb) - self.label_17 = QtGui.QLabel(self.gridLayoutWidget) + self.label_17 = QtWidgets.QLabel(self.gridLayoutWidget) self.label_17.setObjectName("label_17") self.horizontalLayout_44.addWidget(self.label_17) - self.tab_c_lmms2ppm_spb = QtGui.QSpinBox(self.gridLayoutWidget) + self.tab_c_lmms2ppm_spb = QtWidgets.QSpinBox(self.gridLayoutWidget) self.tab_c_lmms2ppm_spb.setMaximum(999) self.tab_c_lmms2ppm_spb.setProperty("value", 50) self.tab_c_lmms2ppm_spb.setObjectName("tab_c_lmms2ppm_spb") self.horizontalLayout_44.addWidget(self.tab_c_lmms2ppm_spb) - spacerItem29 = QtGui.QSpacerItem(40, 20, QtGui.QSizePolicy.Expanding, QtGui.QSizePolicy.Minimum) + spacerItem29 = QtWidgets.QSpacerItem( + 40, 20, QtWidgets.QSizePolicy.Expanding, QtWidgets.QSizePolicy.Minimum + ) self.horizontalLayout_44.addItem(spacerItem29) self.gridLayout_2.addLayout(self.horizontalLayout_44, 1, 1, 1, 1) - self.verticalLayout_6 = QtGui.QVBoxLayout() - self.verticalLayout_6.setSizeConstraint(QtGui.QLayout.SetDefaultConstraint) + self.verticalLayout_6 = QtWidgets.QVBoxLayout() + self.verticalLayout_6.setSizeConstraint(QtWidgets.QLayout.SetDefaultConstraint) self.verticalLayout_6.setObjectName("verticalLayout_6") - self.tab_c_lmrun_pb = QtGui.QPushButton(self.gridLayoutWidget) + self.tab_c_lmrun_pb = QtWidgets.QPushButton(self.gridLayoutWidget) self.tab_c_lmrun_pb.setMaximumSize(QtCore.QSize(16777215, 16777215)) self.tab_c_lmrun_pb.setObjectName("tab_c_lmrun_pb") self.verticalLayout_6.addWidget(self.tab_c_lmrun_pb) - self.tab_c_runlm_pgb = QtGui.QProgressBar(self.gridLayoutWidget) - sizePolicy = QtGui.QSizePolicy(QtGui.QSizePolicy.Fixed, QtGui.QSizePolicy.Fixed) + self.tab_c_runlm_pgb = QtWidgets.QProgressBar(self.gridLayoutWidget) + sizePolicy = QtWidgets.QSizePolicy( + QtWidgets.QSizePolicy.Fixed, QtWidgets.QSizePolicy.Fixed + ) sizePolicy.setHorizontalStretch(0) sizePolicy.setVerticalStretch(0) - sizePolicy.setHeightForWidth(self.tab_c_runlm_pgb.sizePolicy().hasHeightForWidth()) + sizePolicy.setHeightForWidth( + self.tab_c_runlm_pgb.sizePolicy().hasHeightForWidth() + ) self.tab_c_runlm_pgb.setSizePolicy(sizePolicy) self.tab_c_runlm_pgb.setMaximumSize(QtCore.QSize(190, 16777215)) self.tab_c_runlm_pgb.setProperty("value", 5) @@ -811,29 +903,35 @@ def setupUi(self, MainWindow, scale=1): self.tab_c_runlm_pgb.setObjectName("tab_c_runlm_pgb") self.verticalLayout_6.addWidget(self.tab_c_runlm_pgb) self.gridLayout_2.addLayout(self.verticalLayout_6, 4, 0, 1, 1) - self.line = QtGui.QFrame(self.cfg_tab) - self.line.setGeometry(QtCore.QRect(10, 340 * scale, 901 * scale, 20 * scale)) - self.line.setFrameShape(QtGui.QFrame.HLine) - self.line.setFrameShadow(QtGui.QFrame.Sunken) + self.line = QtWidgets.QFrame(self.cfg_tab) + self.line.setGeometry(QtCore.QRect(10, 340, 901, 20)) + self.line.setFrameShape(QtWidgets.QFrame.HLine) + self.line.setFrameShadow(QtWidgets.QFrame.Sunken) self.line.setObjectName("line") self.tabframe.addTab(self.cfg_tab, "") - self.generator_tab = QtGui.QWidget() + self.generator_tab = QtWidgets.QWidget() self.generator_tab.setObjectName("generator_tab") - self.lipidgen_tabframe = QtGui.QTabWidget(self.generator_tab) - self.lipidgen_tabframe.setGeometry(QtCore.QRect(10, 0, 911 * scale, 611 * scale)) + self.lipidgen_tabframe = QtWidgets.QTabWidget(self.generator_tab) + self.lipidgen_tabframe.setGeometry( + QtCore.QRect(10, 0, 911, 611) + ) self.lipidgen_tabframe.setObjectName("lipidgen_tabframe") - self.lipidgen_tab1 = QtGui.QWidget() + self.lipidgen_tab1 = QtWidgets.QWidget() self.lipidgen_tab1.setObjectName("lipidgen_tab1") - self.horizontalLayoutWidget_7 = QtGui.QWidget(self.lipidgen_tab1) - self.horizontalLayoutWidget_7.setGeometry(QtCore.QRect(20, 0, 861 * scale, 31 * scale)) + self.horizontalLayoutWidget_7 = QtWidgets.QWidget(self.lipidgen_tab1) + self.horizontalLayoutWidget_7.setGeometry( + QtCore.QRect(20, 0, 861, 31) + ) self.horizontalLayoutWidget_7.setObjectName("horizontalLayoutWidget_7") - self.horizontalLayout_5 = QtGui.QHBoxLayout(self.horizontalLayoutWidget_7) + self.horizontalLayout_5 = QtWidgets.QHBoxLayout(self.horizontalLayoutWidget_7) self.horizontalLayout_5.setContentsMargins(0, 0, 0, 0) self.horizontalLayout_5.setObjectName("horizontalLayout_5") - self.label_2 = QtGui.QLabel(self.horizontalLayoutWidget_7) + self.label_2 = QtWidgets.QLabel(self.horizontalLayoutWidget_7) self.label_2.setObjectName("label_2") self.horizontalLayout_5.addWidget(self.label_2) - self.lipidgen_tab1_lipidclass_cmb = QtGui.QComboBox(self.horizontalLayoutWidget_7) + self.lipidgen_tab1_lipidclass_cmb = QtWidgets.QComboBox( + self.horizontalLayoutWidget_7 + ) self.lipidgen_tab1_lipidclass_cmb.setMinimumSize(QtCore.QSize(250, 0)) self.lipidgen_tab1_lipidclass_cmb.setObjectName("lipidgen_tab1_lipidclass_cmb") self.lipidgen_tab1_lipidclass_cmb.addItem("") @@ -843,637 +941,769 @@ def setupUi(self, MainWindow, scale=1): self.lipidgen_tab1_lipidclass_cmb.addItem("") self.lipidgen_tab1_lipidclass_cmb.addItem("") self.horizontalLayout_5.addWidget(self.lipidgen_tab1_lipidclass_cmb) - self.lipidgen_tab1_all_sn_chb = QtGui.QCheckBox(self.horizontalLayoutWidget_7) + self.lipidgen_tab1_all_sn_chb = QtWidgets.QCheckBox( + self.horizontalLayoutWidget_7 + ) self.lipidgen_tab1_all_sn_chb.setObjectName("lipidgen_tab1_all_sn_chb") self.horizontalLayout_5.addWidget(self.lipidgen_tab1_all_sn_chb) - spacerItem30 = QtGui.QSpacerItem(40, 20, QtGui.QSizePolicy.Expanding, QtGui.QSizePolicy.Minimum) + spacerItem30 = QtWidgets.QSpacerItem( + 40, 20, QtWidgets.QSizePolicy.Expanding, QtWidgets.QSizePolicy.Minimum + ) self.horizontalLayout_5.addItem(spacerItem30) - self.horizontalLayoutWidget_9 = QtGui.QWidget(self.lipidgen_tab1) - self.horizontalLayoutWidget_9.setGeometry(QtCore.QRect(20, 510 * scale, 861 * scale, 31 * scale)) + self.horizontalLayoutWidget_9 = QtWidgets.QWidget(self.lipidgen_tab1) + self.horizontalLayoutWidget_9.setGeometry( + QtCore.QRect(20, 510, 861, 31) + ) self.horizontalLayoutWidget_9.setObjectName("horizontalLayoutWidget_9") - self.horizontalLayout_8 = QtGui.QHBoxLayout(self.horizontalLayoutWidget_9) + self.horizontalLayout_8 = QtWidgets.QHBoxLayout(self.horizontalLayoutWidget_9) self.horizontalLayout_8.setContentsMargins(0, 0, 0, 0) self.horizontalLayout_8.setObjectName("horizontalLayout_8") - self.label_59 = QtGui.QLabel(self.horizontalLayoutWidget_9) + self.label_59 = QtWidgets.QLabel(self.horizontalLayoutWidget_9) self.label_59.setMinimumSize(QtCore.QSize(120, 0)) self.label_59.setObjectName("label_59") self.horizontalLayout_8.addWidget(self.label_59) - self.lipidgen_tab1_savelist_le = QtGui.QLineEdit(self.horizontalLayoutWidget_9) + self.lipidgen_tab1_savelist_le = QtWidgets.QLineEdit( + self.horizontalLayoutWidget_9 + ) self.lipidgen_tab1_savelist_le.setObjectName("lipidgen_tab1_savelist_le") self.horizontalLayout_8.addWidget(self.lipidgen_tab1_savelist_le) - self.lipidgen_tab1_savelist_pb = QtGui.QPushButton(self.horizontalLayoutWidget_9) + self.lipidgen_tab1_savelist_pb = QtWidgets.QPushButton( + self.horizontalLayoutWidget_9 + ) self.lipidgen_tab1_savelist_pb.setObjectName("lipidgen_tab1_savelist_pb") self.horizontalLayout_8.addWidget(self.lipidgen_tab1_savelist_pb) - self.verticalLayoutWidget_3 = QtGui.QWidget(self.lipidgen_tab1) - self.verticalLayoutWidget_3.setGeometry(QtCore.QRect(20, 30 * scale, 861 * scale, 146 * scale)) + self.verticalLayoutWidget_3 = QtWidgets.QWidget(self.lipidgen_tab1) + self.verticalLayoutWidget_3.setGeometry( + QtCore.QRect(20, 30, 861, 146) + ) self.verticalLayoutWidget_3.setObjectName("verticalLayoutWidget_3") - self.lipidgen_tab1_sn1_verticalLayout = QtGui.QVBoxLayout(self.verticalLayoutWidget_3) + self.lipidgen_tab1_sn1_verticalLayout = QtWidgets.QVBoxLayout( + self.verticalLayoutWidget_3 + ) self.lipidgen_tab1_sn1_verticalLayout.setContentsMargins(0, 0, 0, 0) - self.lipidgen_tab1_sn1_verticalLayout.setObjectName("lipidgen_tab1_sn1_verticalLayout") - self.horizontalLayout_19 = QtGui.QHBoxLayout() + self.lipidgen_tab1_sn1_verticalLayout.setObjectName( + "lipidgen_tab1_sn1_verticalLayout" + ) + self.horizontalLayout_19 = QtWidgets.QHBoxLayout() self.horizontalLayout_19.setObjectName("horizontalLayout_19") - self.lipidgen_tab1_sn1_lb = QtGui.QLabel(self.verticalLayoutWidget_3) + self.lipidgen_tab1_sn1_lb = QtWidgets.QLabel(self.verticalLayoutWidget_3) self.lipidgen_tab1_sn1_lb.setObjectName("lipidgen_tab1_sn1_lb") self.horizontalLayout_19.addWidget(self.lipidgen_tab1_sn1_lb) - spacerItem31 = QtGui.QSpacerItem(40, 20, QtGui.QSizePolicy.Expanding, QtGui.QSizePolicy.Minimum) + spacerItem31 = QtWidgets.QSpacerItem( + 40, 20, QtWidgets.QSizePolicy.Expanding, QtWidgets.QSizePolicy.Minimum + ) self.horizontalLayout_19.addItem(spacerItem31) - self.lipidgen_tab1_sn1allfa_chb = QtGui.QCheckBox(self.verticalLayoutWidget_3) + self.lipidgen_tab1_sn1allfa_chb = QtWidgets.QCheckBox( + self.verticalLayoutWidget_3 + ) self.lipidgen_tab1_sn1allfa_chb.setObjectName("lipidgen_tab1_sn1allfa_chb") self.horizontalLayout_19.addWidget(self.lipidgen_tab1_sn1allfa_chb) self.lipidgen_tab1_sn1_verticalLayout.addLayout(self.horizontalLayout_19) - self.gridLayout = QtGui.QGridLayout() + self.gridLayout = QtWidgets.QGridLayout() self.gridLayout.setObjectName("gridLayout") - self.sn1_fa12x0_chb = QtGui.QCheckBox(self.verticalLayoutWidget_3) + self.sn1_fa12x0_chb = QtWidgets.QCheckBox(self.verticalLayoutWidget_3) self.sn1_fa12x0_chb.setObjectName("sn1_fa12x0_chb") self.gridLayout.addWidget(self.sn1_fa12x0_chb, 1, 0, 1, 1) - self.sn1_fa22x5_chb = QtGui.QCheckBox(self.verticalLayoutWidget_3) + self.sn1_fa22x5_chb = QtWidgets.QCheckBox(self.verticalLayoutWidget_3) self.sn1_fa22x5_chb.setObjectName("sn1_fa22x5_chb") self.gridLayout.addWidget(self.sn1_fa22x5_chb, 2, 5, 1, 1) - self.sn1_fa18x2_chb = QtGui.QCheckBox(self.verticalLayoutWidget_3) + self.sn1_fa18x2_chb = QtWidgets.QCheckBox(self.verticalLayoutWidget_3) self.sn1_fa18x2_chb.setChecked(True) self.sn1_fa18x2_chb.setObjectName("sn1_fa18x2_chb") self.gridLayout.addWidget(self.sn1_fa18x2_chb, 1, 6, 1, 1) - self.sn1_fa18x1_chb = QtGui.QCheckBox(self.verticalLayoutWidget_3) + self.sn1_fa18x1_chb = QtWidgets.QCheckBox(self.verticalLayoutWidget_3) self.sn1_fa18x1_chb.setChecked(True) self.sn1_fa18x1_chb.setObjectName("sn1_fa18x1_chb") self.gridLayout.addWidget(self.sn1_fa18x1_chb, 1, 5, 1, 1) - self.sn1_fa22x4_chb = QtGui.QCheckBox(self.verticalLayoutWidget_3) + self.sn1_fa22x4_chb = QtWidgets.QCheckBox(self.verticalLayoutWidget_3) self.sn1_fa22x4_chb.setObjectName("sn1_fa22x4_chb") self.gridLayout.addWidget(self.sn1_fa22x4_chb, 2, 4, 1, 1) - self.sn1_fa20x5_chb = QtGui.QCheckBox(self.verticalLayoutWidget_3) + self.sn1_fa20x5_chb = QtWidgets.QCheckBox(self.verticalLayoutWidget_3) self.sn1_fa20x5_chb.setObjectName("sn1_fa20x5_chb") self.gridLayout.addWidget(self.sn1_fa20x5_chb, 2, 3, 1, 1) - self.sn1_fa18x0_chb = QtGui.QCheckBox(self.verticalLayoutWidget_3) + self.sn1_fa18x0_chb = QtWidgets.QCheckBox(self.verticalLayoutWidget_3) self.sn1_fa18x0_chb.setChecked(True) self.sn1_fa18x0_chb.setObjectName("sn1_fa18x0_chb") self.gridLayout.addWidget(self.sn1_fa18x0_chb, 1, 4, 1, 1) - self.sn1_fa22x6_chb = QtGui.QCheckBox(self.verticalLayoutWidget_3) + self.sn1_fa22x6_chb = QtWidgets.QCheckBox(self.verticalLayoutWidget_3) self.sn1_fa22x6_chb.setObjectName("sn1_fa22x6_chb") self.gridLayout.addWidget(self.sn1_fa22x6_chb, 2, 6, 1, 1) - self.sn1_fa16x1_chb = QtGui.QCheckBox(self.verticalLayoutWidget_3) + self.sn1_fa16x1_chb = QtWidgets.QCheckBox(self.verticalLayoutWidget_3) self.sn1_fa16x1_chb.setObjectName("sn1_fa16x1_chb") self.gridLayout.addWidget(self.sn1_fa16x1_chb, 1, 3, 1, 1) - self.sn1_fa14x0_chb = QtGui.QCheckBox(self.verticalLayoutWidget_3) + self.sn1_fa14x0_chb = QtWidgets.QCheckBox(self.verticalLayoutWidget_3) self.sn1_fa14x0_chb.setObjectName("sn1_fa14x0_chb") self.gridLayout.addWidget(self.sn1_fa14x0_chb, 1, 1, 1, 1) - self.sn1_fa20x3_chb = QtGui.QCheckBox(self.verticalLayoutWidget_3) + self.sn1_fa20x3_chb = QtWidgets.QCheckBox(self.verticalLayoutWidget_3) self.sn1_fa20x3_chb.setObjectName("sn1_fa20x3_chb") self.gridLayout.addWidget(self.sn1_fa20x3_chb, 2, 1, 1, 1) - self.sn1_fa16x0_chb = QtGui.QCheckBox(self.verticalLayoutWidget_3) + self.sn1_fa16x0_chb = QtWidgets.QCheckBox(self.verticalLayoutWidget_3) self.sn1_fa16x0_chb.setChecked(True) self.sn1_fa16x0_chb.setObjectName("sn1_fa16x0_chb") self.gridLayout.addWidget(self.sn1_fa16x0_chb, 1, 2, 1, 1) - self.sn1_fa18x3_chb = QtGui.QCheckBox(self.verticalLayoutWidget_3) + self.sn1_fa18x3_chb = QtWidgets.QCheckBox(self.verticalLayoutWidget_3) self.sn1_fa18x3_chb.setObjectName("sn1_fa18x3_chb") self.gridLayout.addWidget(self.sn1_fa18x3_chb, 2, 0, 1, 1) - self.sn1_fa20x4_chb = QtGui.QCheckBox(self.verticalLayoutWidget_3) + self.sn1_fa20x4_chb = QtWidgets.QCheckBox(self.verticalLayoutWidget_3) self.sn1_fa20x4_chb.setObjectName("sn1_fa20x4_chb") self.gridLayout.addWidget(self.sn1_fa20x4_chb, 2, 2, 1, 1) self.lipidgen_tab1_sn1_verticalLayout.addLayout(self.gridLayout) - self.horizontalLayout_4 = QtGui.QHBoxLayout() + self.horizontalLayout_4 = QtWidgets.QHBoxLayout() self.horizontalLayout_4.setObjectName("horizontalLayout_4") - self.sn1_showop_chb = QtGui.QCheckBox(self.verticalLayoutWidget_3) + self.sn1_showop_chb = QtWidgets.QCheckBox(self.verticalLayoutWidget_3) self.sn1_showop_chb.setMaximumSize(QtCore.QSize(180, 16777215)) self.sn1_showop_chb.setObjectName("sn1_showop_chb") self.horizontalLayout_4.addWidget(self.sn1_showop_chb) - self.horizontalLayout_6 = QtGui.QHBoxLayout() + self.horizontalLayout_6 = QtWidgets.QHBoxLayout() self.horizontalLayout_6.setObjectName("horizontalLayout_6") - self.sn1_o16x0_chb = QtGui.QCheckBox(self.verticalLayoutWidget_3) + self.sn1_o16x0_chb = QtWidgets.QCheckBox(self.verticalLayoutWidget_3) self.sn1_o16x0_chb.setObjectName("sn1_o16x0_chb") self.horizontalLayout_6.addWidget(self.sn1_o16x0_chb) - self.sn1_o18x0_chb = QtGui.QCheckBox(self.verticalLayoutWidget_3) + self.sn1_o18x0_chb = QtWidgets.QCheckBox(self.verticalLayoutWidget_3) self.sn1_o18x0_chb.setObjectName("sn1_o18x0_chb") self.horizontalLayout_6.addWidget(self.sn1_o18x0_chb) - self.sn1_o20x0_chb = QtGui.QCheckBox(self.verticalLayoutWidget_3) + self.sn1_o20x0_chb = QtWidgets.QCheckBox(self.verticalLayoutWidget_3) self.sn1_o20x0_chb.setObjectName("sn1_o20x0_chb") self.horizontalLayout_6.addWidget(self.sn1_o20x0_chb) - self.sn1_p16x0_chb = QtGui.QCheckBox(self.verticalLayoutWidget_3) + self.sn1_p16x0_chb = QtWidgets.QCheckBox(self.verticalLayoutWidget_3) self.sn1_p16x0_chb.setObjectName("sn1_p16x0_chb") self.horizontalLayout_6.addWidget(self.sn1_p16x0_chb) - self.sn1_p18x0_chb = QtGui.QCheckBox(self.verticalLayoutWidget_3) + self.sn1_p18x0_chb = QtWidgets.QCheckBox(self.verticalLayoutWidget_3) self.sn1_p18x0_chb.setObjectName("sn1_p18x0_chb") self.horizontalLayout_6.addWidget(self.sn1_p18x0_chb) - self.sn1_p20x0_chb = QtGui.QCheckBox(self.verticalLayoutWidget_3) + self.sn1_p20x0_chb = QtWidgets.QCheckBox(self.verticalLayoutWidget_3) self.sn1_p20x0_chb.setObjectName("sn1_p20x0_chb") self.horizontalLayout_6.addWidget(self.sn1_p20x0_chb) self.horizontalLayout_4.addLayout(self.horizontalLayout_6) self.lipidgen_tab1_sn1_verticalLayout.addLayout(self.horizontalLayout_4) - self.horizontalLayout_10 = QtGui.QHBoxLayout() + self.horizontalLayout_10 = QtWidgets.QHBoxLayout() self.horizontalLayout_10.setObjectName("horizontalLayout_10") - self.label_22 = QtGui.QLabel(self.verticalLayoutWidget_3) + self.label_22 = QtWidgets.QLabel(self.verticalLayoutWidget_3) self.label_22.setObjectName("label_22") self.horizontalLayout_10.addWidget(self.label_22) - self.sn1_otherfa_lb = QtGui.QLineEdit(self.verticalLayoutWidget_3) + self.sn1_otherfa_lb = QtWidgets.QLineEdit(self.verticalLayoutWidget_3) self.sn1_otherfa_lb.setObjectName("sn1_otherfa_lb") self.horizontalLayout_10.addWidget(self.sn1_otherfa_lb) self.lipidgen_tab1_sn1_verticalLayout.addLayout(self.horizontalLayout_10) - self.label_62 = QtGui.QLabel(self.verticalLayoutWidget_3) + self.label_62 = QtWidgets.QLabel(self.verticalLayoutWidget_3) self.label_62.setObjectName("label_62") self.lipidgen_tab1_sn1_verticalLayout.addWidget(self.label_62) - self.verticalLayoutWidget_4 = QtGui.QWidget(self.lipidgen_tab1) - self.verticalLayoutWidget_4.setGeometry(QtCore.QRect(20, 180 * scale, 861 * scale, 100 * scale)) + self.verticalLayoutWidget_4 = QtWidgets.QWidget(self.lipidgen_tab1) + self.verticalLayoutWidget_4.setGeometry( + QtCore.QRect(20, 180, 861, 100) + ) self.verticalLayoutWidget_4.setObjectName("verticalLayoutWidget_4") - self.lipidgen_tab1_sn2_verticalLayout = QtGui.QVBoxLayout(self.verticalLayoutWidget_4) + self.lipidgen_tab1_sn2_verticalLayout = QtWidgets.QVBoxLayout( + self.verticalLayoutWidget_4 + ) self.lipidgen_tab1_sn2_verticalLayout.setContentsMargins(0, 0, 0, 0) - self.lipidgen_tab1_sn2_verticalLayout.setObjectName("lipidgen_tab1_sn2_verticalLayout") - self.horizontalLayout_20 = QtGui.QHBoxLayout() + self.lipidgen_tab1_sn2_verticalLayout.setObjectName( + "lipidgen_tab1_sn2_verticalLayout" + ) + self.horizontalLayout_20 = QtWidgets.QHBoxLayout() self.horizontalLayout_20.setObjectName("horizontalLayout_20") - self.lipidgen_tab1_sn2_lb = QtGui.QLabel(self.verticalLayoutWidget_4) + self.lipidgen_tab1_sn2_lb = QtWidgets.QLabel(self.verticalLayoutWidget_4) self.lipidgen_tab1_sn2_lb.setObjectName("lipidgen_tab1_sn2_lb") self.horizontalLayout_20.addWidget(self.lipidgen_tab1_sn2_lb) - spacerItem32 = QtGui.QSpacerItem(40, 20, QtGui.QSizePolicy.Expanding, QtGui.QSizePolicy.Minimum) + spacerItem32 = QtWidgets.QSpacerItem( + 40, 20, QtWidgets.QSizePolicy.Expanding, QtWidgets.QSizePolicy.Minimum + ) self.horizontalLayout_20.addItem(spacerItem32) - self.lipidgen_tab1_sn2allfa_chb = QtGui.QCheckBox(self.verticalLayoutWidget_4) + self.lipidgen_tab1_sn2allfa_chb = QtWidgets.QCheckBox( + self.verticalLayoutWidget_4 + ) self.lipidgen_tab1_sn2allfa_chb.setObjectName("lipidgen_tab1_sn2allfa_chb") self.horizontalLayout_20.addWidget(self.lipidgen_tab1_sn2allfa_chb) self.lipidgen_tab1_sn2_verticalLayout.addLayout(self.horizontalLayout_20) - self.gridLayout_7 = QtGui.QGridLayout() + self.gridLayout_7 = QtWidgets.QGridLayout() self.gridLayout_7.setObjectName("gridLayout_7") - self.sn2_fa22x5_chb = QtGui.QCheckBox(self.verticalLayoutWidget_4) + self.sn2_fa22x5_chb = QtWidgets.QCheckBox(self.verticalLayoutWidget_4) self.sn2_fa22x5_chb.setChecked(True) self.sn2_fa22x5_chb.setObjectName("sn2_fa22x5_chb") self.gridLayout_7.addWidget(self.sn2_fa22x5_chb, 1, 5, 1, 1) - self.sn2_fa22x4_chb = QtGui.QCheckBox(self.verticalLayoutWidget_4) + self.sn2_fa22x4_chb = QtWidgets.QCheckBox(self.verticalLayoutWidget_4) self.sn2_fa22x4_chb.setChecked(True) self.sn2_fa22x4_chb.setObjectName("sn2_fa22x4_chb") self.gridLayout_7.addWidget(self.sn2_fa22x4_chb, 1, 4, 1, 1) - self.sn2_fa20x5_chb = QtGui.QCheckBox(self.verticalLayoutWidget_4) + self.sn2_fa20x5_chb = QtWidgets.QCheckBox(self.verticalLayoutWidget_4) self.sn2_fa20x5_chb.setChecked(True) self.sn2_fa20x5_chb.setObjectName("sn2_fa20x5_chb") self.gridLayout_7.addWidget(self.sn2_fa20x5_chb, 1, 3, 1, 1) - self.sn2_fa22x6_chb = QtGui.QCheckBox(self.verticalLayoutWidget_4) + self.sn2_fa22x6_chb = QtWidgets.QCheckBox(self.verticalLayoutWidget_4) self.sn2_fa22x6_chb.setChecked(True) self.sn2_fa22x6_chb.setObjectName("sn2_fa22x6_chb") self.gridLayout_7.addWidget(self.sn2_fa22x6_chb, 1, 6, 1, 1) - self.sn2_fa18x1_chb = QtGui.QCheckBox(self.verticalLayoutWidget_4) + self.sn2_fa18x1_chb = QtWidgets.QCheckBox(self.verticalLayoutWidget_4) self.sn2_fa18x1_chb.setChecked(True) self.sn2_fa18x1_chb.setObjectName("sn2_fa18x1_chb") self.gridLayout_7.addWidget(self.sn2_fa18x1_chb, 0, 5, 1, 1) - self.sn2_fa14x0_chb = QtGui.QCheckBox(self.verticalLayoutWidget_4) + self.sn2_fa14x0_chb = QtWidgets.QCheckBox(self.verticalLayoutWidget_4) self.sn2_fa14x0_chb.setObjectName("sn2_fa14x0_chb") self.gridLayout_7.addWidget(self.sn2_fa14x0_chb, 0, 1, 1, 1) - self.sn2_fa16x0_chb = QtGui.QCheckBox(self.verticalLayoutWidget_4) + self.sn2_fa16x0_chb = QtWidgets.QCheckBox(self.verticalLayoutWidget_4) self.sn2_fa16x0_chb.setChecked(True) self.sn2_fa16x0_chb.setObjectName("sn2_fa16x0_chb") self.gridLayout_7.addWidget(self.sn2_fa16x0_chb, 0, 2, 1, 1) - self.sn2_fa18x3_chb = QtGui.QCheckBox(self.verticalLayoutWidget_4) + self.sn2_fa18x3_chb = QtWidgets.QCheckBox(self.verticalLayoutWidget_4) self.sn2_fa18x3_chb.setChecked(True) self.sn2_fa18x3_chb.setObjectName("sn2_fa18x3_chb") self.gridLayout_7.addWidget(self.sn2_fa18x3_chb, 1, 0, 1, 1) - self.sn2_fa18x2_chb = QtGui.QCheckBox(self.verticalLayoutWidget_4) + self.sn2_fa18x2_chb = QtWidgets.QCheckBox(self.verticalLayoutWidget_4) self.sn2_fa18x2_chb.setChecked(True) self.sn2_fa18x2_chb.setObjectName("sn2_fa18x2_chb") self.gridLayout_7.addWidget(self.sn2_fa18x2_chb, 0, 6, 1, 1) - self.sn2_fa18x0_chb = QtGui.QCheckBox(self.verticalLayoutWidget_4) + self.sn2_fa18x0_chb = QtWidgets.QCheckBox(self.verticalLayoutWidget_4) self.sn2_fa18x0_chb.setChecked(True) self.sn2_fa18x0_chb.setObjectName("sn2_fa18x0_chb") self.gridLayout_7.addWidget(self.sn2_fa18x0_chb, 0, 4, 1, 1) - self.sn2_fa16x1_chb = QtGui.QCheckBox(self.verticalLayoutWidget_4) + self.sn2_fa16x1_chb = QtWidgets.QCheckBox(self.verticalLayoutWidget_4) self.sn2_fa16x1_chb.setObjectName("sn2_fa16x1_chb") self.gridLayout_7.addWidget(self.sn2_fa16x1_chb, 0, 3, 1, 1) - self.sn2_fa20x4_chb = QtGui.QCheckBox(self.verticalLayoutWidget_4) + self.sn2_fa20x4_chb = QtWidgets.QCheckBox(self.verticalLayoutWidget_4) self.sn2_fa20x4_chb.setChecked(True) self.sn2_fa20x4_chb.setObjectName("sn2_fa20x4_chb") self.gridLayout_7.addWidget(self.sn2_fa20x4_chb, 1, 2, 1, 1) - self.sn2_fa20x3_chb = QtGui.QCheckBox(self.verticalLayoutWidget_4) + self.sn2_fa20x3_chb = QtWidgets.QCheckBox(self.verticalLayoutWidget_4) self.sn2_fa20x3_chb.setChecked(True) self.sn2_fa20x3_chb.setObjectName("sn2_fa20x3_chb") self.gridLayout_7.addWidget(self.sn2_fa20x3_chb, 1, 1, 1, 1) - self.sn2_fa12x0_chb = QtGui.QCheckBox(self.verticalLayoutWidget_4) + self.sn2_fa12x0_chb = QtWidgets.QCheckBox(self.verticalLayoutWidget_4) self.sn2_fa12x0_chb.setObjectName("sn2_fa12x0_chb") self.gridLayout_7.addWidget(self.sn2_fa12x0_chb, 0, 0, 1, 1) self.lipidgen_tab1_sn2_verticalLayout.addLayout(self.gridLayout_7) - self.horizontalLayout_32 = QtGui.QHBoxLayout() + self.horizontalLayout_32 = QtWidgets.QHBoxLayout() self.horizontalLayout_32.setObjectName("horizontalLayout_32") - self.label_41 = QtGui.QLabel(self.verticalLayoutWidget_4) + self.label_41 = QtWidgets.QLabel(self.verticalLayoutWidget_4) self.label_41.setObjectName("label_41") self.horizontalLayout_32.addWidget(self.label_41) - self.sn2_otherfa_lb = QtGui.QLineEdit(self.verticalLayoutWidget_4) + self.sn2_otherfa_lb = QtWidgets.QLineEdit(self.verticalLayoutWidget_4) self.sn2_otherfa_lb.setObjectName("sn2_otherfa_lb") self.horizontalLayout_32.addWidget(self.sn2_otherfa_lb) self.lipidgen_tab1_sn2_verticalLayout.addLayout(self.horizontalLayout_32) - self.verticalLayoutWidget_5 = QtGui.QWidget(self.lipidgen_tab1) - self.verticalLayoutWidget_5.setGeometry(QtCore.QRect(20, 290 * scale, 861 * scale, 101 * scale)) + self.verticalLayoutWidget_5 = QtWidgets.QWidget(self.lipidgen_tab1) + self.verticalLayoutWidget_5.setGeometry( + QtCore.QRect(20, 290, 861, 101) + ) self.verticalLayoutWidget_5.setObjectName("verticalLayoutWidget_5") - self.lipidgen_tab1_sn3_verticalLayout = QtGui.QVBoxLayout(self.verticalLayoutWidget_5) + self.lipidgen_tab1_sn3_verticalLayout = QtWidgets.QVBoxLayout( + self.verticalLayoutWidget_5 + ) self.lipidgen_tab1_sn3_verticalLayout.setContentsMargins(0, 0, 0, 0) - self.lipidgen_tab1_sn3_verticalLayout.setObjectName("lipidgen_tab1_sn3_verticalLayout") - self.horizontalLayout_21 = QtGui.QHBoxLayout() + self.lipidgen_tab1_sn3_verticalLayout.setObjectName( + "lipidgen_tab1_sn3_verticalLayout" + ) + self.horizontalLayout_21 = QtWidgets.QHBoxLayout() self.horizontalLayout_21.setObjectName("horizontalLayout_21") - self.lipidgen_tab1_sn3_lb = QtGui.QLabel(self.verticalLayoutWidget_5) + self.lipidgen_tab1_sn3_lb = QtWidgets.QLabel(self.verticalLayoutWidget_5) self.lipidgen_tab1_sn3_lb.setObjectName("lipidgen_tab1_sn3_lb") self.horizontalLayout_21.addWidget(self.lipidgen_tab1_sn3_lb) - spacerItem33 = QtGui.QSpacerItem(40, 20, QtGui.QSizePolicy.Expanding, QtGui.QSizePolicy.Minimum) + spacerItem33 = QtWidgets.QSpacerItem( + 40, 20, QtWidgets.QSizePolicy.Expanding, QtWidgets.QSizePolicy.Minimum + ) self.horizontalLayout_21.addItem(spacerItem33) - self.lipidgen_tab1_sn3allfa_chb = QtGui.QCheckBox(self.verticalLayoutWidget_5) + self.lipidgen_tab1_sn3allfa_chb = QtWidgets.QCheckBox( + self.verticalLayoutWidget_5 + ) self.lipidgen_tab1_sn3allfa_chb.setObjectName("lipidgen_tab1_sn3allfa_chb") self.horizontalLayout_21.addWidget(self.lipidgen_tab1_sn3allfa_chb) self.lipidgen_tab1_sn3_verticalLayout.addLayout(self.horizontalLayout_21) - self.gridLayout_8 = QtGui.QGridLayout() + self.gridLayout_8 = QtWidgets.QGridLayout() self.gridLayout_8.setObjectName("gridLayout_8") - self.sn3_fa14x0_chb = QtGui.QCheckBox(self.verticalLayoutWidget_5) + self.sn3_fa14x0_chb = QtWidgets.QCheckBox(self.verticalLayoutWidget_5) self.sn3_fa14x0_chb.setObjectName("sn3_fa14x0_chb") self.gridLayout_8.addWidget(self.sn3_fa14x0_chb, 0, 1, 1, 1) - self.sn3_fa22x4_chb = QtGui.QCheckBox(self.verticalLayoutWidget_5) + self.sn3_fa22x4_chb = QtWidgets.QCheckBox(self.verticalLayoutWidget_5) self.sn3_fa22x4_chb.setChecked(True) self.sn3_fa22x4_chb.setObjectName("sn3_fa22x4_chb") self.gridLayout_8.addWidget(self.sn3_fa22x4_chb, 1, 4, 1, 1) - self.sn3_fa18x1_chb = QtGui.QCheckBox(self.verticalLayoutWidget_5) + self.sn3_fa18x1_chb = QtWidgets.QCheckBox(self.verticalLayoutWidget_5) self.sn3_fa18x1_chb.setChecked(True) self.sn3_fa18x1_chb.setObjectName("sn3_fa18x1_chb") self.gridLayout_8.addWidget(self.sn3_fa18x1_chb, 0, 5, 1, 1) - self.sn3_fa22x5_chb = QtGui.QCheckBox(self.verticalLayoutWidget_5) + self.sn3_fa22x5_chb = QtWidgets.QCheckBox(self.verticalLayoutWidget_5) self.sn3_fa22x5_chb.setChecked(True) self.sn3_fa22x5_chb.setObjectName("sn3_fa22x5_chb") self.gridLayout_8.addWidget(self.sn3_fa22x5_chb, 1, 5, 1, 1) - self.sn3_fa22x6_chb = QtGui.QCheckBox(self.verticalLayoutWidget_5) + self.sn3_fa22x6_chb = QtWidgets.QCheckBox(self.verticalLayoutWidget_5) self.sn3_fa22x6_chb.setChecked(True) self.sn3_fa22x6_chb.setObjectName("sn3_fa22x6_chb") self.gridLayout_8.addWidget(self.sn3_fa22x6_chb, 1, 6, 1, 1) - self.sn3_fa18x3_chb = QtGui.QCheckBox(self.verticalLayoutWidget_5) + self.sn3_fa18x3_chb = QtWidgets.QCheckBox(self.verticalLayoutWidget_5) self.sn3_fa18x3_chb.setChecked(True) self.sn3_fa18x3_chb.setObjectName("sn3_fa18x3_chb") self.gridLayout_8.addWidget(self.sn3_fa18x3_chb, 1, 0, 1, 1) - self.sn3_fa16x1_chb = QtGui.QCheckBox(self.verticalLayoutWidget_5) + self.sn3_fa16x1_chb = QtWidgets.QCheckBox(self.verticalLayoutWidget_5) self.sn3_fa16x1_chb.setChecked(False) self.sn3_fa16x1_chb.setObjectName("sn3_fa16x1_chb") self.gridLayout_8.addWidget(self.sn3_fa16x1_chb, 0, 3, 1, 1) - self.sn3_fa20x4_chb = QtGui.QCheckBox(self.verticalLayoutWidget_5) + self.sn3_fa20x4_chb = QtWidgets.QCheckBox(self.verticalLayoutWidget_5) self.sn3_fa20x4_chb.setChecked(True) self.sn3_fa20x4_chb.setObjectName("sn3_fa20x4_chb") self.gridLayout_8.addWidget(self.sn3_fa20x4_chb, 1, 2, 1, 1) - self.sn3_fa18x0_chb = QtGui.QCheckBox(self.verticalLayoutWidget_5) + self.sn3_fa18x0_chb = QtWidgets.QCheckBox(self.verticalLayoutWidget_5) self.sn3_fa18x0_chb.setChecked(True) self.sn3_fa18x0_chb.setObjectName("sn3_fa18x0_chb") self.gridLayout_8.addWidget(self.sn3_fa18x0_chb, 0, 4, 1, 1) - self.sn3_fa20x5_chb = QtGui.QCheckBox(self.verticalLayoutWidget_5) + self.sn3_fa20x5_chb = QtWidgets.QCheckBox(self.verticalLayoutWidget_5) self.sn3_fa20x5_chb.setChecked(True) self.sn3_fa20x5_chb.setObjectName("sn3_fa20x5_chb") self.gridLayout_8.addWidget(self.sn3_fa20x5_chb, 1, 3, 1, 1) - self.sn3_fa18x2_chb = QtGui.QCheckBox(self.verticalLayoutWidget_5) + self.sn3_fa18x2_chb = QtWidgets.QCheckBox(self.verticalLayoutWidget_5) self.sn3_fa18x2_chb.setChecked(True) self.sn3_fa18x2_chb.setObjectName("sn3_fa18x2_chb") self.gridLayout_8.addWidget(self.sn3_fa18x2_chb, 0, 6, 1, 1) - self.sn3_fa16x0_chb = QtGui.QCheckBox(self.verticalLayoutWidget_5) + self.sn3_fa16x0_chb = QtWidgets.QCheckBox(self.verticalLayoutWidget_5) self.sn3_fa16x0_chb.setChecked(True) self.sn3_fa16x0_chb.setObjectName("sn3_fa16x0_chb") self.gridLayout_8.addWidget(self.sn3_fa16x0_chb, 0, 2, 1, 1) - self.sn3_fa12x0_chb = QtGui.QCheckBox(self.verticalLayoutWidget_5) + self.sn3_fa12x0_chb = QtWidgets.QCheckBox(self.verticalLayoutWidget_5) self.sn3_fa12x0_chb.setObjectName("sn3_fa12x0_chb") self.gridLayout_8.addWidget(self.sn3_fa12x0_chb, 0, 0, 1, 1) - self.sn3_fa20x3_chb = QtGui.QCheckBox(self.verticalLayoutWidget_5) + self.sn3_fa20x3_chb = QtWidgets.QCheckBox(self.verticalLayoutWidget_5) self.sn3_fa20x3_chb.setChecked(True) self.sn3_fa20x3_chb.setObjectName("sn3_fa20x3_chb") self.gridLayout_8.addWidget(self.sn3_fa20x3_chb, 1, 1, 1, 1) self.lipidgen_tab1_sn3_verticalLayout.addLayout(self.gridLayout_8) - self.horizontalLayout_33 = QtGui.QHBoxLayout() + self.horizontalLayout_33 = QtWidgets.QHBoxLayout() self.horizontalLayout_33.setObjectName("horizontalLayout_33") - self.label_61 = QtGui.QLabel(self.verticalLayoutWidget_5) + self.label_61 = QtWidgets.QLabel(self.verticalLayoutWidget_5) self.label_61.setObjectName("label_61") self.horizontalLayout_33.addWidget(self.label_61) - self.sn3_otherfa_lb = QtGui.QLineEdit(self.verticalLayoutWidget_5) + self.sn3_otherfa_lb = QtWidgets.QLineEdit(self.verticalLayoutWidget_5) self.sn3_otherfa_lb.setObjectName("sn3_otherfa_lb") self.horizontalLayout_33.addWidget(self.sn3_otherfa_lb) self.lipidgen_tab1_sn3_verticalLayout.addLayout(self.horizontalLayout_33) - self.line_2 = QtGui.QFrame(self.lipidgen_tab1) - self.line_2.setGeometry(QtCore.QRect(20, 280 * scale, 861 * scale, 16 * scale)) - self.line_2.setFrameShape(QtGui.QFrame.HLine) - self.line_2.setFrameShadow(QtGui.QFrame.Sunken) + self.line_2 = QtWidgets.QFrame(self.lipidgen_tab1) + self.line_2.setGeometry(QtCore.QRect(20, 280, 861, 16)) + self.line_2.setFrameShape(QtWidgets.QFrame.HLine) + self.line_2.setFrameShadow(QtWidgets.QFrame.Sunken) self.line_2.setObjectName("line_2") - self.line_3 = QtGui.QFrame(self.lipidgen_tab1) - self.line_3.setGeometry(QtCore.QRect(20, 170 * scale, 861 * scale, 16 * scale)) - self.line_3.setFrameShape(QtGui.QFrame.HLine) - self.line_3.setFrameShadow(QtGui.QFrame.Sunken) + self.line_3 = QtWidgets.QFrame(self.lipidgen_tab1) + self.line_3.setGeometry(QtCore.QRect(20, 170, 861, 16)) + self.line_3.setFrameShape(QtWidgets.QFrame.HLine) + self.line_3.setFrameShadow(QtWidgets.QFrame.Sunken) self.line_3.setObjectName("line_3") - self.line_4 = QtGui.QFrame(self.lipidgen_tab1) - self.line_4.setGeometry(QtCore.QRect(20, 20, 861 * scale, 16 * scale)) - self.line_4.setFrameShape(QtGui.QFrame.HLine) - self.line_4.setFrameShadow(QtGui.QFrame.Sunken) + self.line_4 = QtWidgets.QFrame(self.lipidgen_tab1) + self.line_4.setGeometry(QtCore.QRect(20, 20, 861, 16)) + self.line_4.setFrameShape(QtWidgets.QFrame.HLine) + self.line_4.setFrameShadow(QtWidgets.QFrame.Sunken) self.line_4.setObjectName("line_4") - self.verticalLayoutWidget_6 = QtGui.QWidget(self.lipidgen_tab1) - self.verticalLayoutWidget_6.setGeometry(QtCore.QRect(20, 400 * scale, 859 * scale, 100 * scale)) + self.verticalLayoutWidget_6 = QtWidgets.QWidget(self.lipidgen_tab1) + self.verticalLayoutWidget_6.setGeometry( + QtCore.QRect(20, 400, 859, 100) + ) self.verticalLayoutWidget_6.setObjectName("verticalLayoutWidget_6") - self.lipidgen_tab1_sn4_verticalLayout = QtGui.QVBoxLayout(self.verticalLayoutWidget_6) + self.lipidgen_tab1_sn4_verticalLayout = QtWidgets.QVBoxLayout( + self.verticalLayoutWidget_6 + ) self.lipidgen_tab1_sn4_verticalLayout.setContentsMargins(0, 0, 0, 0) - self.lipidgen_tab1_sn4_verticalLayout.setObjectName("lipidgen_tab1_sn4_verticalLayout") - self.horizontalLayout_34 = QtGui.QHBoxLayout() + self.lipidgen_tab1_sn4_verticalLayout.setObjectName( + "lipidgen_tab1_sn4_verticalLayout" + ) + self.horizontalLayout_34 = QtWidgets.QHBoxLayout() self.horizontalLayout_34.setObjectName("horizontalLayout_34") - self.lipidgen_tab1_sn4_lb = QtGui.QLabel(self.verticalLayoutWidget_6) + self.lipidgen_tab1_sn4_lb = QtWidgets.QLabel(self.verticalLayoutWidget_6) self.lipidgen_tab1_sn4_lb.setObjectName("lipidgen_tab1_sn4_lb") self.horizontalLayout_34.addWidget(self.lipidgen_tab1_sn4_lb) - spacerItem34 = QtGui.QSpacerItem(40, 20, QtGui.QSizePolicy.Expanding, QtGui.QSizePolicy.Minimum) + spacerItem34 = QtWidgets.QSpacerItem( + 40, 20, QtWidgets.QSizePolicy.Expanding, QtWidgets.QSizePolicy.Minimum + ) self.horizontalLayout_34.addItem(spacerItem34) - self.lipidgen_tab1_sn3allfa_chb_2 = QtGui.QCheckBox(self.verticalLayoutWidget_6) + self.lipidgen_tab1_sn3allfa_chb_2 = QtWidgets.QCheckBox( + self.verticalLayoutWidget_6 + ) self.lipidgen_tab1_sn3allfa_chb_2.setObjectName("lipidgen_tab1_sn3allfa_chb_2") self.horizontalLayout_34.addWidget(self.lipidgen_tab1_sn3allfa_chb_2) self.lipidgen_tab1_sn4_verticalLayout.addLayout(self.horizontalLayout_34) - self.gridLayout_10 = QtGui.QGridLayout() + self.gridLayout_10 = QtWidgets.QGridLayout() self.gridLayout_10.setObjectName("gridLayout_10") - self.sn4_fa22x6_chb = QtGui.QCheckBox(self.verticalLayoutWidget_6) + self.sn4_fa22x6_chb = QtWidgets.QCheckBox(self.verticalLayoutWidget_6) self.sn4_fa22x6_chb.setChecked(True) self.sn4_fa22x6_chb.setObjectName("sn4_fa22x6_chb") self.gridLayout_10.addWidget(self.sn4_fa22x6_chb, 1, 6, 1, 1) - self.sn4_fa22x5_chb = QtGui.QCheckBox(self.verticalLayoutWidget_6) + self.sn4_fa22x5_chb = QtWidgets.QCheckBox(self.verticalLayoutWidget_6) self.sn4_fa22x5_chb.setChecked(True) self.sn4_fa22x5_chb.setObjectName("sn4_fa22x5_chb") self.gridLayout_10.addWidget(self.sn4_fa22x5_chb, 1, 5, 1, 1) - self.sn4_fa22x4_chb = QtGui.QCheckBox(self.verticalLayoutWidget_6) + self.sn4_fa22x4_chb = QtWidgets.QCheckBox(self.verticalLayoutWidget_6) self.sn4_fa22x4_chb.setChecked(True) self.sn4_fa22x4_chb.setObjectName("sn4_fa22x4_chb") self.gridLayout_10.addWidget(self.sn4_fa22x4_chb, 1, 4, 1, 1) - self.sn4_fa20x5_chb = QtGui.QCheckBox(self.verticalLayoutWidget_6) + self.sn4_fa20x5_chb = QtWidgets.QCheckBox(self.verticalLayoutWidget_6) self.sn4_fa20x5_chb.setChecked(True) self.sn4_fa20x5_chb.setObjectName("sn4_fa20x5_chb") self.gridLayout_10.addWidget(self.sn4_fa20x5_chb, 1, 3, 1, 1) - self.sn4_fa20x4_chb = QtGui.QCheckBox(self.verticalLayoutWidget_6) + self.sn4_fa20x4_chb = QtWidgets.QCheckBox(self.verticalLayoutWidget_6) self.sn4_fa20x4_chb.setChecked(True) self.sn4_fa20x4_chb.setObjectName("sn4_fa20x4_chb") self.gridLayout_10.addWidget(self.sn4_fa20x4_chb, 1, 2, 1, 1) - self.sn4_fa20x3_chb = QtGui.QCheckBox(self.verticalLayoutWidget_6) + self.sn4_fa20x3_chb = QtWidgets.QCheckBox(self.verticalLayoutWidget_6) self.sn4_fa20x3_chb.setChecked(True) self.sn4_fa20x3_chb.setObjectName("sn4_fa20x3_chb") self.gridLayout_10.addWidget(self.sn4_fa20x3_chb, 1, 1, 1, 1) - self.sn4_fa18x3_chb = QtGui.QCheckBox(self.verticalLayoutWidget_6) + self.sn4_fa18x3_chb = QtWidgets.QCheckBox(self.verticalLayoutWidget_6) self.sn4_fa18x3_chb.setChecked(True) self.sn4_fa18x3_chb.setObjectName("sn4_fa18x3_chb") self.gridLayout_10.addWidget(self.sn4_fa18x3_chb, 1, 0, 1, 1) - self.sn4_fa18x2_chb = QtGui.QCheckBox(self.verticalLayoutWidget_6) + self.sn4_fa18x2_chb = QtWidgets.QCheckBox(self.verticalLayoutWidget_6) self.sn4_fa18x2_chb.setChecked(True) self.sn4_fa18x2_chb.setObjectName("sn4_fa18x2_chb") self.gridLayout_10.addWidget(self.sn4_fa18x2_chb, 0, 6, 1, 1) - self.sn4_fa18x1_chb = QtGui.QCheckBox(self.verticalLayoutWidget_6) + self.sn4_fa18x1_chb = QtWidgets.QCheckBox(self.verticalLayoutWidget_6) self.sn4_fa18x1_chb.setChecked(True) self.sn4_fa18x1_chb.setObjectName("sn4_fa18x1_chb") self.gridLayout_10.addWidget(self.sn4_fa18x1_chb, 0, 5, 1, 1) - self.sn4_fa18x0_chb = QtGui.QCheckBox(self.verticalLayoutWidget_6) + self.sn4_fa18x0_chb = QtWidgets.QCheckBox(self.verticalLayoutWidget_6) self.sn4_fa18x0_chb.setChecked(True) self.sn4_fa18x0_chb.setObjectName("sn4_fa18x0_chb") self.gridLayout_10.addWidget(self.sn4_fa18x0_chb, 0, 4, 1, 1) - self.sn4_fa16x1_chb = QtGui.QCheckBox(self.verticalLayoutWidget_6) + self.sn4_fa16x1_chb = QtWidgets.QCheckBox(self.verticalLayoutWidget_6) self.sn4_fa16x1_chb.setChecked(False) self.sn4_fa16x1_chb.setObjectName("sn4_fa16x1_chb") self.gridLayout_10.addWidget(self.sn4_fa16x1_chb, 0, 3, 1, 1) - self.sn4_fa16x0_chb = QtGui.QCheckBox(self.verticalLayoutWidget_6) + self.sn4_fa16x0_chb = QtWidgets.QCheckBox(self.verticalLayoutWidget_6) self.sn4_fa16x0_chb.setChecked(True) self.sn4_fa16x0_chb.setObjectName("sn4_fa16x0_chb") self.gridLayout_10.addWidget(self.sn4_fa16x0_chb, 0, 2, 1, 1) - self.sn4_fa14x0_chb = QtGui.QCheckBox(self.verticalLayoutWidget_6) + self.sn4_fa14x0_chb = QtWidgets.QCheckBox(self.verticalLayoutWidget_6) self.sn4_fa14x0_chb.setObjectName("sn4_fa14x0_chb") self.gridLayout_10.addWidget(self.sn4_fa14x0_chb, 0, 1, 1, 1) - self.sn4_fa12x0_chb = QtGui.QCheckBox(self.verticalLayoutWidget_6) + self.sn4_fa12x0_chb = QtWidgets.QCheckBox(self.verticalLayoutWidget_6) self.sn4_fa12x0_chb.setObjectName("sn4_fa12x0_chb") self.gridLayout_10.addWidget(self.sn4_fa12x0_chb, 0, 0, 1, 1) self.lipidgen_tab1_sn4_verticalLayout.addLayout(self.gridLayout_10) - self.horizontalLayout_35 = QtGui.QHBoxLayout() + self.horizontalLayout_35 = QtWidgets.QHBoxLayout() self.horizontalLayout_35.setObjectName("horizontalLayout_35") - self.label_66 = QtGui.QLabel(self.verticalLayoutWidget_6) + self.label_66 = QtWidgets.QLabel(self.verticalLayoutWidget_6) self.label_66.setObjectName("label_66") self.horizontalLayout_35.addWidget(self.label_66) - self.sn4_otherfa_lb = QtGui.QLineEdit(self.verticalLayoutWidget_6) + self.sn4_otherfa_lb = QtWidgets.QLineEdit(self.verticalLayoutWidget_6) self.sn4_otherfa_lb.setObjectName("sn4_otherfa_lb") self.horizontalLayout_35.addWidget(self.sn4_otherfa_lb) self.lipidgen_tab1_sn4_verticalLayout.addLayout(self.horizontalLayout_35) - self.line_7 = QtGui.QFrame(self.lipidgen_tab1) - self.line_7.setGeometry(QtCore.QRect(20, 390 * scale, 861 * scale, 16 * scale)) - self.line_7.setFrameShape(QtGui.QFrame.HLine) - self.line_7.setFrameShadow(QtGui.QFrame.Sunken) + self.line_7 = QtWidgets.QFrame(self.lipidgen_tab1) + self.line_7.setGeometry(QtCore.QRect(20, 390, 861, 16)) + self.line_7.setFrameShape(QtWidgets.QFrame.HLine) + self.line_7.setFrameShadow(QtWidgets.QFrame.Sunken) self.line_7.setObjectName("line_7") - self.line_11 = QtGui.QFrame(self.lipidgen_tab1) - self.line_11.setGeometry(QtCore.QRect(20, 500 * scale, 861 * scale, 16 * scale)) - self.line_11.setFrameShape(QtGui.QFrame.HLine) - self.line_11.setFrameShadow(QtGui.QFrame.Sunken) + self.line_11 = QtWidgets.QFrame(self.lipidgen_tab1) + self.line_11.setGeometry(QtCore.QRect(20, 500, 861, 16)) + self.line_11.setFrameShape(QtWidgets.QFrame.HLine) + self.line_11.setFrameShadow(QtWidgets.QFrame.Sunken) self.line_11.setObjectName("line_11") - self.horizontalLayoutWidget_6 = QtGui.QWidget(self.lipidgen_tab1) - self.horizontalLayoutWidget_6.setGeometry(QtCore.QRect(20, 540 * scale, 781 * scale, 31 * scale)) + self.horizontalLayoutWidget_6 = QtWidgets.QWidget(self.lipidgen_tab1) + self.horizontalLayoutWidget_6.setGeometry( + QtCore.QRect(20, 540, 781, 31) + ) self.horizontalLayoutWidget_6.setObjectName("horizontalLayoutWidget_6") - self.horizontalLayout_40 = QtGui.QHBoxLayout(self.horizontalLayoutWidget_6) + self.horizontalLayout_40 = QtWidgets.QHBoxLayout(self.horizontalLayoutWidget_6) self.horizontalLayout_40.setContentsMargins(0, 0, 0, 0) self.horizontalLayout_40.setObjectName("horizontalLayout_40") - self.lipidgen_tab1_genlist_pb = QtGui.QPushButton(self.horizontalLayoutWidget_6) + self.lipidgen_tab1_genlist_pb = QtWidgets.QPushButton( + self.horizontalLayoutWidget_6 + ) self.lipidgen_tab1_genlist_pb.setMinimumSize(QtCore.QSize(120, 0)) self.lipidgen_tab1_genlist_pb.setObjectName("lipidgen_tab1_genlist_pb") self.horizontalLayout_40.addWidget(self.lipidgen_tab1_genlist_pb) - self.lipidgen_tab1_genlist_le = QtGui.QLineEdit(self.horizontalLayoutWidget_6) + self.lipidgen_tab1_genlist_le = QtWidgets.QLineEdit( + self.horizontalLayoutWidget_6 + ) self.lipidgen_tab1_genlist_le.setObjectName("lipidgen_tab1_genlist_le") self.horizontalLayout_40.addWidget(self.lipidgen_tab1_genlist_le) self.lipidgen_tabframe.addTab(self.lipidgen_tab1, "") - self.lipidgen_tab2 = QtGui.QWidget() + self.lipidgen_tab2 = QtWidgets.QWidget() self.lipidgen_tab2.setObjectName("lipidgen_tab2") - self.horizontalLayoutWidget_10 = QtGui.QWidget(self.lipidgen_tab2) - self.horizontalLayoutWidget_10.setGeometry(QtCore.QRect(10, 10, 881 * scale, 31 * scale)) + self.horizontalLayoutWidget_10 = QtWidgets.QWidget(self.lipidgen_tab2) + self.horizontalLayoutWidget_10.setGeometry( + QtCore.QRect(10, 10, 881, 31) + ) self.horizontalLayoutWidget_10.setObjectName("horizontalLayoutWidget_10") - self.horizontalLayout_9 = QtGui.QHBoxLayout(self.horizontalLayoutWidget_10) + self.horizontalLayout_9 = QtWidgets.QHBoxLayout(self.horizontalLayoutWidget_10) self.horizontalLayout_9.setContentsMargins(0, 0, 0, 0) self.horizontalLayout_9.setObjectName("horizontalLayout_9") - self.label_60 = QtGui.QLabel(self.horizontalLayoutWidget_10) + self.label_60 = QtWidgets.QLabel(self.horizontalLayoutWidget_10) self.label_60.setObjectName("label_60") self.horizontalLayout_9.addWidget(self.label_60) - self.lipidgen_tab2_loadlist_le = QtGui.QLineEdit(self.horizontalLayoutWidget_10) + self.lipidgen_tab2_loadlist_le = QtWidgets.QLineEdit( + self.horizontalLayoutWidget_10 + ) self.lipidgen_tab2_loadlist_le.setObjectName("lipidgen_tab2_loadlist_le") self.horizontalLayout_9.addWidget(self.lipidgen_tab2_loadlist_le) - self.lipidgen_tab2_loadlist_pb = QtGui.QPushButton(self.horizontalLayoutWidget_10) + self.lipidgen_tab2_loadlist_pb = QtWidgets.QPushButton( + self.horizontalLayoutWidget_10 + ) self.lipidgen_tab2_loadlist_pb.setObjectName("lipidgen_tab2_loadlist_pb") self.horizontalLayout_9.addWidget(self.lipidgen_tab2_loadlist_pb) - self.lipidgen_tab2_loadlist_lb = QtGui.QLabel(self.lipidgen_tab2) - self.lipidgen_tab2_loadlist_lb.setGeometry(QtCore.QRect(10, 50 * scale, 881 * scale, 16 * scale)) + self.lipidgen_tab2_loadlist_lb = QtWidgets.QLabel(self.lipidgen_tab2) + self.lipidgen_tab2_loadlist_lb.setGeometry( + QtCore.QRect(10, 50, 881, 16) + ) self.lipidgen_tab2_loadlist_lb.setObjectName("lipidgen_tab2_loadlist_lb") - self.horizontalLayoutWidget_11 = QtGui.QWidget(self.lipidgen_tab2) - self.horizontalLayoutWidget_11.setGeometry(QtCore.QRect(10, 70 * scale, 881 * scale, 31 * scale)) + self.horizontalLayoutWidget_11 = QtWidgets.QWidget(self.lipidgen_tab2) + self.horizontalLayoutWidget_11.setGeometry( + QtCore.QRect(10, 70, 881, 31) + ) self.horizontalLayoutWidget_11.setObjectName("horizontalLayoutWidget_11") - self.horizontalLayout_41 = QtGui.QHBoxLayout(self.horizontalLayoutWidget_11) + self.horizontalLayout_41 = QtWidgets.QHBoxLayout(self.horizontalLayoutWidget_11) self.horizontalLayout_41.setContentsMargins(0, 0, 0, 0) self.horizontalLayout_41.setObjectName("horizontalLayout_41") - self.lipidgen_tab2_savemasterlist_lb = QtGui.QLabel(self.horizontalLayoutWidget_11) - self.lipidgen_tab2_savemasterlist_lb.setObjectName("lipidgen_tab2_savemasterlist_lb") + self.lipidgen_tab2_savemasterlist_lb = QtWidgets.QLabel( + self.horizontalLayoutWidget_11 + ) + self.lipidgen_tab2_savemasterlist_lb.setObjectName( + "lipidgen_tab2_savemasterlist_lb" + ) self.horizontalLayout_41.addWidget(self.lipidgen_tab2_savemasterlist_lb) - self.lipidgen_tab2_savemasterlist_le = QtGui.QLineEdit(self.horizontalLayoutWidget_11) - self.lipidgen_tab2_savemasterlist_le.setObjectName("lipidgen_tab2_savemasterlist_le") + self.lipidgen_tab2_savemasterlist_le = QtWidgets.QLineEdit( + self.horizontalLayoutWidget_11 + ) + self.lipidgen_tab2_savemasterlist_le.setObjectName( + "lipidgen_tab2_savemasterlist_le" + ) self.horizontalLayout_41.addWidget(self.lipidgen_tab2_savemasterlist_le) - self.lipidgen_tab2_savemasterlist_pb = QtGui.QPushButton(self.horizontalLayoutWidget_11) - self.lipidgen_tab2_savemasterlist_pb.setObjectName("lipidgen_tab2_savemasterlist_pb") + self.lipidgen_tab2_savemasterlist_pb = QtWidgets.QPushButton( + self.horizontalLayoutWidget_11 + ) + self.lipidgen_tab2_savemasterlist_pb.setObjectName( + "lipidgen_tab2_savemasterlist_pb" + ) self.horizontalLayout_41.addWidget(self.lipidgen_tab2_savemasterlist_pb) - self.horizontalLayoutWidget_8 = QtGui.QWidget(self.lipidgen_tab2) - self.horizontalLayoutWidget_8.setGeometry(QtCore.QRect(10, 110 * scale, 881 * scale, 231 * scale)) + self.horizontalLayoutWidget_8 = QtWidgets.QWidget(self.lipidgen_tab2) + self.horizontalLayoutWidget_8.setGeometry( + QtCore.QRect(10, 110, 881, 231) + ) self.horizontalLayoutWidget_8.setObjectName("horizontalLayoutWidget_8") - self.horizontalLayout_42 = QtGui.QHBoxLayout(self.horizontalLayoutWidget_8) + self.horizontalLayout_42 = QtWidgets.QHBoxLayout(self.horizontalLayoutWidget_8) self.horizontalLayout_42.setContentsMargins(0, 0, 0, 0) self.horizontalLayout_42.setObjectName("horizontalLayout_42") - self.lipidgen_tab1_genmasterlist_pb = QtGui.QPushButton(self.horizontalLayoutWidget_8) + self.lipidgen_tab1_genmasterlist_pb = QtWidgets.QPushButton( + self.horizontalLayoutWidget_8 + ) self.lipidgen_tab1_genmasterlist_pb.setMinimumSize(QtCore.QSize(120, 0)) - self.lipidgen_tab1_genmasterlist_pb.setObjectName("lipidgen_tab1_genmasterlist_pb") + self.lipidgen_tab1_genmasterlist_pb.setObjectName( + "lipidgen_tab1_genmasterlist_pb" + ) self.horizontalLayout_42.addWidget(self.lipidgen_tab1_genmasterlist_pb) - self.lipidgen_tab1_genmasterlist_pte = QtGui.QPlainTextEdit(self.horizontalLayoutWidget_8) - self.lipidgen_tab1_genmasterlist_pte.setObjectName("lipidgen_tab1_genmasterlist_pte") + self.lipidgen_tab1_genmasterlist_pte = QtWidgets.QPlainTextEdit( + self.horizontalLayoutWidget_8 + ) + self.lipidgen_tab1_genmasterlist_pte.setObjectName( + "lipidgen_tab1_genmasterlist_pte" + ) self.horizontalLayout_42.addWidget(self.lipidgen_tab1_genmasterlist_pte) self.lipidgen_tabframe.addTab(self.lipidgen_tab2, "") self.tabframe.addTab(self.generator_tab, "") - self.tab = QtGui.QWidget() + self.tab = QtWidgets.QWidget() self.tab.setObjectName("tab") - self.verticalLayoutWidget = QtGui.QWidget(self.tab) - self.verticalLayoutWidget.setGeometry(QtCore.QRect(210 * scale, 10, 701 * scale, 201 * scale)) + self.verticalLayoutWidget = QtWidgets.QWidget(self.tab) + self.verticalLayoutWidget.setGeometry( + QtCore.QRect(210, 10, 701, 201) + ) self.verticalLayoutWidget.setObjectName("verticalLayoutWidget") - self.verticalLayout_4 = QtGui.QVBoxLayout(self.verticalLayoutWidget) + self.verticalLayout_4 = QtWidgets.QVBoxLayout(self.verticalLayoutWidget) self.verticalLayout_4.setContentsMargins(0, 0, 0, 0) self.verticalLayout_4.setObjectName("verticalLayout_4") - self.version_lb = QtGui.QLabel(self.verticalLayoutWidget) + self.version_lb = QtWidgets.QLabel(self.verticalLayoutWidget) self.version_lb.setObjectName("version_lb") self.verticalLayout_4.addWidget(self.version_lb) - self.label_26 = QtGui.QLabel(self.verticalLayoutWidget) + self.label_26 = QtWidgets.QLabel(self.verticalLayoutWidget) self.label_26.setObjectName("label_26") self.verticalLayout_4.addWidget(self.label_26) - self.label_43 = QtGui.QLabel(self.verticalLayoutWidget) + self.label_43 = QtWidgets.QLabel(self.verticalLayoutWidget) self.label_43.setObjectName("label_43") self.verticalLayout_4.addWidget(self.label_43) - self.formLayout = QtGui.QFormLayout() + self.formLayout = QtWidgets.QFormLayout() self.formLayout.setObjectName("formLayout") - self.label_42 = QtGui.QLabel(self.verticalLayoutWidget) + self.label_42 = QtWidgets.QLabel(self.verticalLayoutWidget) self.label_42.setObjectName("label_42") - self.formLayout.setWidget(0, QtGui.QFormLayout.LabelRole, self.label_42) - self.label_44 = QtGui.QLabel(self.verticalLayoutWidget) + self.formLayout.setWidget(0, QtWidgets.QFormLayout.LabelRole, self.label_42) + self.label_44 = QtWidgets.QLabel(self.verticalLayoutWidget) self.label_44.setObjectName("label_44") - self.formLayout.setWidget(1, QtGui.QFormLayout.LabelRole, self.label_44) - self.link_gplv2_lb = QtGui.QLabel(self.verticalLayoutWidget) + self.formLayout.setWidget(1, QtWidgets.QFormLayout.LabelRole, self.label_44) + self.link_gplv2_lb = QtWidgets.QLabel(self.verticalLayoutWidget) self.link_gplv2_lb.setObjectName("link_gplv2_lb") - self.formLayout.setWidget(0, QtGui.QFormLayout.FieldRole, self.link_gplv2_lb) - self.label_45 = QtGui.QLabel(self.verticalLayoutWidget) + self.formLayout.setWidget( + 0, QtWidgets.QFormLayout.FieldRole, self.link_gplv2_lb + ) + self.label_45 = QtWidgets.QLabel(self.verticalLayoutWidget) self.label_45.setTextFormat(QtCore.Qt.RichText) self.label_45.setObjectName("label_45") - self.formLayout.setWidget(1, QtGui.QFormLayout.FieldRole, self.label_45) + self.formLayout.setWidget(1, QtWidgets.QFormLayout.FieldRole, self.label_45) self.verticalLayout_4.addLayout(self.formLayout) - self.link_source_lb = QtGui.QLabel(self.verticalLayoutWidget) + self.link_source_lb = QtWidgets.QLabel(self.verticalLayoutWidget) self.link_source_lb.setObjectName("link_source_lb") self.verticalLayout_4.addWidget(self.link_source_lb) - self.link_tutorial_lb = QtGui.QLabel(self.verticalLayoutWidget) + self.link_tutorial_lb = QtWidgets.QLabel(self.verticalLayoutWidget) self.link_tutorial_lb.setObjectName("link_tutorial_lb") self.verticalLayout_4.addWidget(self.link_tutorial_lb) - self.link_paper_lb = QtGui.QLabel(self.verticalLayoutWidget) + self.link_paper_lb = QtWidgets.QLabel(self.verticalLayoutWidget) self.link_paper_lb.setWordWrap(True) self.link_paper_lb.setObjectName("link_paper_lb") self.verticalLayout_4.addWidget(self.link_paper_lb) - self.link_otherprojects_lb = QtGui.QLabel(self.verticalLayoutWidget) + self.link_otherprojects_lb = QtWidgets.QLabel(self.verticalLayoutWidget) self.link_otherprojects_lb.setObjectName("link_otherprojects_lb") self.verticalLayout_4.addWidget(self.link_otherprojects_lb) - self.line_8 = QtGui.QFrame(self.tab) - self.line_8.setGeometry(QtCore.QRect(10, 210 * scale, 901 * scale, 16 * scale)) - self.line_8.setFrameShape(QtGui.QFrame.HLine) - self.line_8.setFrameShadow(QtGui.QFrame.Sunken) + self.line_8 = QtWidgets.QFrame(self.tab) + self.line_8.setGeometry(QtCore.QRect(10, 210, 901, 16)) + self.line_8.setFrameShape(QtWidgets.QFrame.HLine) + self.line_8.setFrameShadow(QtWidgets.QFrame.Sunken) self.line_8.setObjectName("line_8") - self.label_30 = QtGui.QLabel(self.tab) - self.label_30.setGeometry(QtCore.QRect(20, 228 * scale, 881 * scale, 16 * scale)) + self.label_30 = QtWidgets.QLabel(self.tab) + self.label_30.setGeometry( + QtCore.QRect(20, 228, 881, 16) + ) self.label_30.setObjectName("label_30") - self.logo_pb = QtGui.QPushButton(self.tab) - self.logo_pb.setGeometry(QtCore.QRect(40, 40, 128 * scale, 128 * scale)) + self.logo_pb = QtWidgets.QPushButton(self.tab) + self.logo_pb.setGeometry(QtCore.QRect(40, 40, 128, 128)) self.logo_pb.setMinimumSize(QtCore.QSize(128, 128)) self.logo_pb.setMaximumSize(QtCore.QSize(128, 128)) self.logo_pb.setText("") icon1 = QtGui.QIcon() - icon1.addPixmap(QtGui.QPixmap("LipidHunter.png"), QtGui.QIcon.Normal, QtGui.QIcon.Off) + icon1.addPixmap( + QtGui.QPixmap(":/LipidHunter.png"), QtGui.QIcon.Normal, QtGui.QIcon.Off + ) self.logo_pb.setIcon(icon1) self.logo_pb.setIconSize(QtCore.QSize(128, 128)) self.logo_pb.setObjectName("logo_pb") - self.formLayoutWidget_3 = QtGui.QWidget(self.tab) - self.formLayoutWidget_3.setGeometry(QtCore.QRect(20, 250 * scale, 881 * scale, 261 * scale)) + self.formLayoutWidget_3 = QtWidgets.QWidget(self.tab) + self.formLayoutWidget_3.setGeometry( + QtCore.QRect(20, 250, 881, 261) + ) self.formLayoutWidget_3.setObjectName("formLayoutWidget_3") - self.formLayout_3 = QtGui.QFormLayout(self.formLayoutWidget_3) - self.formLayout_3.setFieldGrowthPolicy(QtGui.QFormLayout.AllNonFixedFieldsGrow) - self.formLayout_3.setFormAlignment(QtCore.Qt.AlignLeading|QtCore.Qt.AlignLeft|QtCore.Qt.AlignTop) + self.formLayout_3 = QtWidgets.QFormLayout(self.formLayoutWidget_3) + self.formLayout_3.setFieldGrowthPolicy( + QtWidgets.QFormLayout.AllNonFixedFieldsGrow + ) + self.formLayout_3.setFormAlignment( + QtCore.Qt.AlignLeading | QtCore.Qt.AlignLeft | QtCore.Qt.AlignTop + ) self.formLayout_3.setContentsMargins(0, 0, 0, 0) self.formLayout_3.setObjectName("formLayout_3") - self.label_31 = QtGui.QLabel(self.formLayoutWidget_3) + self.label_31 = QtWidgets.QLabel(self.formLayoutWidget_3) self.label_31.setObjectName("label_31") - self.formLayout_3.setWidget(0, QtGui.QFormLayout.LabelRole, self.label_31) - self.link_matplotlib_lb = QtGui.QLabel(self.formLayoutWidget_3) + self.formLayout_3.setWidget(0, QtWidgets.QFormLayout.LabelRole, self.label_31) + self.link_matplotlib_lb = QtWidgets.QLabel(self.formLayoutWidget_3) self.link_matplotlib_lb.setObjectName("link_matplotlib_lb") - self.formLayout_3.setWidget(0, QtGui.QFormLayout.FieldRole, self.link_matplotlib_lb) - self.label_36 = QtGui.QLabel(self.formLayoutWidget_3) + self.formLayout_3.setWidget( + 0, QtWidgets.QFormLayout.FieldRole, self.link_matplotlib_lb + ) + self.label_36 = QtWidgets.QLabel(self.formLayoutWidget_3) self.label_36.setObjectName("label_36") - self.formLayout_3.setWidget(2, QtGui.QFormLayout.LabelRole, self.label_36) - self.link_numpy_lb = QtGui.QLabel(self.formLayoutWidget_3) + self.formLayout_3.setWidget(2, QtWidgets.QFormLayout.LabelRole, self.label_36) + self.link_numpy_lb = QtWidgets.QLabel(self.formLayoutWidget_3) self.link_numpy_lb.setMinimumSize(QtCore.QSize(0, 15)) self.link_numpy_lb.setMaximumSize(QtCore.QSize(800, 16777215)) self.link_numpy_lb.setTextFormat(QtCore.Qt.RichText) self.link_numpy_lb.setWordWrap(True) self.link_numpy_lb.setObjectName("link_numpy_lb") - self.formLayout_3.setWidget(2, QtGui.QFormLayout.FieldRole, self.link_numpy_lb) - self.label_32 = QtGui.QLabel(self.formLayoutWidget_3) + self.formLayout_3.setWidget( + 2, QtWidgets.QFormLayout.FieldRole, self.link_numpy_lb + ) + self.label_32 = QtWidgets.QLabel(self.formLayoutWidget_3) self.label_32.setObjectName("label_32") - self.formLayout_3.setWidget(3, QtGui.QFormLayout.LabelRole, self.label_32) - self.link_pandas_lb = QtGui.QLabel(self.formLayoutWidget_3) + self.formLayout_3.setWidget(3, QtWidgets.QFormLayout.LabelRole, self.label_32) + self.link_pandas_lb = QtWidgets.QLabel(self.formLayoutWidget_3) self.link_pandas_lb.setObjectName("link_pandas_lb") - self.formLayout_3.setWidget(3, QtGui.QFormLayout.FieldRole, self.link_pandas_lb) - self.label_33 = QtGui.QLabel(self.formLayoutWidget_3) + self.formLayout_3.setWidget( + 3, QtWidgets.QFormLayout.FieldRole, self.link_pandas_lb + ) + self.label_33 = QtWidgets.QLabel(self.formLayoutWidget_3) self.label_33.setObjectName("label_33") - self.formLayout_3.setWidget(4, QtGui.QFormLayout.LabelRole, self.label_33) - self.link_pymzml_lb = QtGui.QLabel(self.formLayoutWidget_3) + self.formLayout_3.setWidget(4, QtWidgets.QFormLayout.LabelRole, self.label_33) + self.link_pymzml_lb = QtWidgets.QLabel(self.formLayoutWidget_3) self.link_pymzml_lb.setMinimumSize(QtCore.QSize(0, 15)) self.link_pymzml_lb.setMaximumSize(QtCore.QSize(800, 16777215)) self.link_pymzml_lb.setTextFormat(QtCore.Qt.RichText) self.link_pymzml_lb.setWordWrap(True) self.link_pymzml_lb.setObjectName("link_pymzml_lb") - self.formLayout_3.setWidget(4, QtGui.QFormLayout.FieldRole, self.link_pymzml_lb) - self.label_34 = QtGui.QLabel(self.formLayoutWidget_3) + self.formLayout_3.setWidget( + 4, QtWidgets.QFormLayout.FieldRole, self.link_pymzml_lb + ) + self.label_34 = QtWidgets.QLabel(self.formLayoutWidget_3) self.label_34.setObjectName("label_34") - self.formLayout_3.setWidget(5, QtGui.QFormLayout.LabelRole, self.label_34) - self.link_pyside_lb = QtGui.QLabel(self.formLayoutWidget_3) + self.formLayout_3.setWidget(5, QtWidgets.QFormLayout.LabelRole, self.label_34) + self.link_pyside_lb = QtWidgets.QLabel(self.formLayoutWidget_3) self.link_pyside_lb.setObjectName("link_pyside_lb") - self.formLayout_3.setWidget(5, QtGui.QFormLayout.FieldRole, self.link_pyside_lb) - self.label_37 = QtGui.QLabel(self.formLayoutWidget_3) + self.formLayout_3.setWidget( + 5, QtWidgets.QFormLayout.FieldRole, self.link_pyside_lb + ) + self.label_37 = QtWidgets.QLabel(self.formLayoutWidget_3) self.label_37.setObjectName("label_37") - self.formLayout_3.setWidget(1, QtGui.QFormLayout.LabelRole, self.label_37) - self.label_97 = QtGui.QLabel(self.formLayoutWidget_3) + self.formLayout_3.setWidget(1, QtWidgets.QFormLayout.LabelRole, self.label_37) + self.label_97 = QtWidgets.QLabel(self.formLayoutWidget_3) self.label_97.setObjectName("label_97") - self.formLayout_3.setWidget(1, QtGui.QFormLayout.FieldRole, self.label_97) - self.line_10 = QtGui.QFrame(self.tab) - self.line_10.setGeometry(QtCore.QRect(10, 510 * scale, 901 * scale, 16 * scale)) - self.line_10.setFrameShape(QtGui.QFrame.HLine) - self.line_10.setFrameShadow(QtGui.QFrame.Sunken) + self.formLayout_3.setWidget(1, QtWidgets.QFormLayout.FieldRole, self.label_97) + self.line_10 = QtWidgets.QFrame(self.tab) + self.line_10.setGeometry(QtCore.QRect(10, 510, 901, 16)) + self.line_10.setFrameShape(QtWidgets.QFrame.HLine) + self.line_10.setFrameShadow(QtWidgets.QFrame.Sunken) self.line_10.setObjectName("line_10") - self.label_46 = QtGui.QLabel(self.tab) - self.label_46.setGeometry(QtCore.QRect(20 * scale, 520 * scale, 881 * scale, 16 * scale)) + self.label_46 = QtWidgets.QLabel(self.tab) + self.label_46.setGeometry( + QtCore.QRect(20, 520, 881, 16) + ) self.label_46.setObjectName("label_46") - self.formLayoutWidget_2 = QtGui.QWidget(self.tab) - self.formLayoutWidget_2.setGeometry(QtCore.QRect(20 * scale, 540 * scale, 881 * scale, 71 * scale)) + self.formLayoutWidget_2 = QtWidgets.QWidget(self.tab) + self.formLayoutWidget_2.setGeometry( + QtCore.QRect(20, 540, 881, 71) + ) self.formLayoutWidget_2.setObjectName("formLayoutWidget_2") - self.formLayout_2 = QtGui.QFormLayout(self.formLayoutWidget_2) - self.formLayout_2.setFormAlignment(QtCore.Qt.AlignLeading|QtCore.Qt.AlignLeft|QtCore.Qt.AlignTop) + self.formLayout_2 = QtWidgets.QFormLayout(self.formLayoutWidget_2) + self.formLayout_2.setFormAlignment( + QtCore.Qt.AlignLeading | QtCore.Qt.AlignLeft | QtCore.Qt.AlignTop + ) self.formLayout_2.setContentsMargins(0, 0, 0, 0) self.formLayout_2.setObjectName("formLayout_2") - self.label_47 = QtGui.QLabel(self.formLayoutWidget_2) + self.label_47 = QtWidgets.QLabel(self.formLayoutWidget_2) self.label_47.setObjectName("label_47") - self.formLayout_2.setWidget(0, QtGui.QFormLayout.LabelRole, self.label_47) - self.label_49 = QtGui.QLabel(self.formLayoutWidget_2) - self.label_49.setAlignment(QtCore.Qt.AlignRight|QtCore.Qt.AlignTrailing|QtCore.Qt.AlignVCenter) + self.formLayout_2.setWidget(0, QtWidgets.QFormLayout.LabelRole, self.label_47) + self.label_49 = QtWidgets.QLabel(self.formLayoutWidget_2) + self.label_49.setAlignment( + QtCore.Qt.AlignRight | QtCore.Qt.AlignTrailing | QtCore.Qt.AlignVCenter + ) self.label_49.setObjectName("label_49") - self.formLayout_2.setWidget(1, QtGui.QFormLayout.LabelRole, self.label_49) - self.link_bmbf_lb = QtGui.QLabel(self.formLayoutWidget_2) + self.formLayout_2.setWidget(1, QtWidgets.QFormLayout.LabelRole, self.label_49) + self.link_bmbf_lb = QtWidgets.QLabel(self.formLayoutWidget_2) self.link_bmbf_lb.setObjectName("link_bmbf_lb") - self.formLayout_2.setWidget(0, QtGui.QFormLayout.FieldRole, self.link_bmbf_lb) - self.link_emed_lb = QtGui.QLabel(self.formLayoutWidget_2) + self.formLayout_2.setWidget( + 0, QtWidgets.QFormLayout.FieldRole, self.link_bmbf_lb + ) + self.link_emed_lb = QtWidgets.QLabel(self.formLayoutWidget_2) self.link_emed_lb.setObjectName("link_emed_lb") - self.formLayout_2.setWidget(1, QtGui.QFormLayout.FieldRole, self.link_emed_lb) - self.link_sysmedos_lb = QtGui.QLabel(self.formLayoutWidget_2) + self.formLayout_2.setWidget( + 1, QtWidgets.QFormLayout.FieldRole, self.link_emed_lb + ) + self.link_sysmedos_lb = QtWidgets.QLabel(self.formLayoutWidget_2) self.link_sysmedos_lb.setObjectName("link_sysmedos_lb") - self.formLayout_2.setWidget(2, QtGui.QFormLayout.FieldRole, self.link_sysmedos_lb) - self.label_58 = QtGui.QLabel(self.formLayoutWidget_2) - sizePolicy = QtGui.QSizePolicy(QtGui.QSizePolicy.MinimumExpanding, QtGui.QSizePolicy.Fixed) + self.formLayout_2.setWidget( + 2, QtWidgets.QFormLayout.FieldRole, self.link_sysmedos_lb + ) + self.label_58 = QtWidgets.QLabel(self.formLayoutWidget_2) + sizePolicy = QtWidgets.QSizePolicy( + QtWidgets.QSizePolicy.MinimumExpanding, QtWidgets.QSizePolicy.Fixed + ) sizePolicy.setHorizontalStretch(0) sizePolicy.setVerticalStretch(0) sizePolicy.setHeightForWidth(self.label_58.sizePolicy().hasHeightForWidth()) self.label_58.setSizePolicy(sizePolicy) - self.label_58.setAlignment(QtCore.Qt.AlignRight|QtCore.Qt.AlignTrailing|QtCore.Qt.AlignVCenter) + self.label_58.setAlignment( + QtCore.Qt.AlignRight | QtCore.Qt.AlignTrailing | QtCore.Qt.AlignVCenter + ) self.label_58.setObjectName("label_58") - self.formLayout_2.setWidget(2, QtGui.QFormLayout.LabelRole, self.label_58) + self.formLayout_2.setWidget(2, QtWidgets.QFormLayout.LabelRole, self.label_58) self.tabframe.addTab(self.tab, "") - self.link_uni_lb = QtGui.QLabel(self.centralwidget) - self.link_uni_lb.setGeometry(QtCore.QRect(20 * scale, 650 * scale, 901 * scale, 16 * scale)) + self.link_uni_lb = QtWidgets.QLabel(self.centralwidget) + self.link_uni_lb.setGeometry( + QtCore.QRect(20, 650, 901, 16) + ) self.link_uni_lb.setContextMenuPolicy(QtCore.Qt.NoContextMenu) self.link_uni_lb.setObjectName("link_uni_lb") MainWindow.setCentralWidget(self.centralwidget) - self.menubar = QtGui.QMenuBar(MainWindow) - self.menubar.setGeometry(QtCore.QRect(0, 0, 960 * scale, 21 * scale)) + self.menubar = QtWidgets.QMenuBar(MainWindow) + self.menubar.setGeometry(QtCore.QRect(0, 0, 960, 21)) self.menubar.setObjectName("menubar") MainWindow.setMenuBar(self.menubar) - self.statusbar = QtGui.QStatusBar(MainWindow) + self.statusbar = QtWidgets.QStatusBar(MainWindow) self.statusbar.setObjectName("statusbar") MainWindow.setStatusBar(self.statusbar) @@ -1486,284 +1716,366 @@ def setupUi(self, MainWindow, scale=1): QtCore.QMetaObject.connectSlotsByName(MainWindow) def retranslateUi(self, MainWindow): - MainWindow.setWindowTitle(QtGui.QApplication.translate("MainWindow", "LipidHunter 2 (RC2) | University of Leipzig ", None, QtGui.QApplication.UnicodeUTF8)) - self.label_50.setText(QtGui.QApplication.translate("MainWindow", "Score weight factor settings:", None, QtGui.QApplication.UnicodeUTF8)) - self.tab_a_mzml_pb.setText(QtGui.QApplication.translate("MainWindow", "Open", None, QtGui.QApplication.UnicodeUTF8)) - self.label_3.setText(QtGui.QApplication.translate("MainWindow", "Select lipid class:", None, QtGui.QApplication.UnicodeUTF8)) - self.label_4.setText(QtGui.QApplication.translate("MainWindow", "Scan time range (min):", None, QtGui.QApplication.UnicodeUTF8)) - self.label_9.setText(QtGui.QApplication.translate("MainWindow", "to", None, QtGui.QApplication.UnicodeUTF8)) - self.label_10.setText(QtGui.QApplication.translate("MainWindow", "m/z range:
", None, QtGui.QApplication.UnicodeUTF8)) - self.label_11.setText(QtGui.QApplication.translate("MainWindow", "to", None, QtGui.QApplication.UnicodeUTF8)) - self.label_6.setText(QtGui.QApplication.translate("MainWindow", "Input .mzML file:", None, QtGui.QApplication.UnicodeUTF8)) - self.tab_a_loadfalist_pb.setText(QtGui.QApplication.translate("MainWindow", "Open", None, QtGui.QApplication.UnicodeUTF8)) - self.label_7.setText(QtGui.QApplication.translate("MainWindow", "Save report to folder:", None, QtGui.QApplication.UnicodeUTF8)) - self.tab_a_loadscorecfg_pb.setText(QtGui.QApplication.translate("MainWindow", "Open", None, QtGui.QApplication.UnicodeUTF8)) - self.tab_a_sumxlsxpath_pb.setText(QtGui.QApplication.translate("MainWindow", "Save as", None, QtGui.QApplication.UnicodeUTF8)) - self.tab_a_saveimgfolder_pb.setText(QtGui.QApplication.translate("MainWindow", "Save as", None, QtGui.QApplication.UnicodeUTF8)) - self.label_8.setText(QtGui.QApplication.translate("MainWindow", "Export summary .xlsx table:", None, QtGui.QApplication.UnicodeUTF8)) - self.label_16.setText(QtGui.QApplication.translate("MainWindow", "MS/MS level tolerance:", None, QtGui.QApplication.UnicodeUTF8)) - self.tab_a_ms2ppm_spb.setSuffix(QtGui.QApplication.translate("MainWindow", " ppm", None, QtGui.QApplication.UnicodeUTF8)) - self.tab_a_ms2ppm_spb.setPrefix(QtGui.QApplication.translate("MainWindow", "+/- ", None, QtGui.QApplication.UnicodeUTF8)) - self.tab_d_ms2threshold_spb_2.setText(QtGui.QApplication.translate("MainWindow", "MS/MS level threshold (absolute intensity):", None, QtGui.QApplication.UnicodeUTF8)) - self.tab_a_lipidclass_cmb.setItemText(0, QtGui.QApplication.translate("MainWindow", "--- Please select ---", None, QtGui.QApplication.UnicodeUTF8)) - self.tab_a_lipidclass_cmb.setItemText(1, QtGui.QApplication.translate("MainWindow", "Phosphatidic acid (PA) [M-H]-", None, QtGui.QApplication.UnicodeUTF8)) - self.tab_a_lipidclass_cmb.setItemText(2, QtGui.QApplication.translate("MainWindow", "Phosphatidylcholine (PC) [M+HCOO]-", None, QtGui.QApplication.UnicodeUTF8)) - self.tab_a_lipidclass_cmb.setItemText(3, QtGui.QApplication.translate("MainWindow", "Phosphatidylcholine (PC) [M+CH3COO]-", None, QtGui.QApplication.UnicodeUTF8)) - self.tab_a_lipidclass_cmb.setItemText(4, QtGui.QApplication.translate("MainWindow", "Phosphatidylethanolamine (PE) [M-H]-", None, QtGui.QApplication.UnicodeUTF8)) - self.tab_a_lipidclass_cmb.setItemText(5, QtGui.QApplication.translate("MainWindow", "Phosphatidylglycerol (PG) [M-H]-", None, QtGui.QApplication.UnicodeUTF8)) - self.tab_a_lipidclass_cmb.setItemText(6, QtGui.QApplication.translate("MainWindow", "Phosphatidylinositol (PI) [M-H]-", None, QtGui.QApplication.UnicodeUTF8)) - self.tab_a_lipidclass_cmb.setItemText(7, QtGui.QApplication.translate("MainWindow", "Phosphatidylserine (PS) [M-H]-", None, QtGui.QApplication.UnicodeUTF8)) - self.tab_a_lipidclass_cmb.setItemText(8, QtGui.QApplication.translate("MainWindow", "Triacylglycerol (TG) [M+NH4]+", None, QtGui.QApplication.UnicodeUTF8)) - self.tab_a_lipidclass_cmb.setItemText(9, QtGui.QApplication.translate("MainWindow", "Triacylglycerol (TG) [M+H]+", None, QtGui.QApplication.UnicodeUTF8)) - self.tab_a_lipidclass_cmb.setItemText(10, QtGui.QApplication.translate("MainWindow", "Triacylglycerol (TG) [M+Na]+", None, QtGui.QApplication.UnicodeUTF8)) - self.tab_a_lipidclass_cmb.setItemText(11, QtGui.QApplication.translate("MainWindow", "Diacylglycerol (DG) [M+NH4]+", None, QtGui.QApplication.UnicodeUTF8)) - # self.tab_a_lipidclass_cmb.setItemText(12, QtGui.QApplication.translate("MainWindow", "Diacylglycerol (DG) [M+H]+", None, QtGui.QApplication.UnicodeUTF8)) - self.tab_a_lipidclass_cmb.setItemText(13-1, QtGui.QApplication.translate("MainWindow", "Lyso PA (LPA) [M-H]-", None, QtGui.QApplication.UnicodeUTF8)) - self.tab_a_lipidclass_cmb.setItemText(14-1, QtGui.QApplication.translate("MainWindow", "Lyso PC (LPC) [M+HCOO]-", None, QtGui.QApplication.UnicodeUTF8)) - self.tab_a_lipidclass_cmb.setItemText(15-1, QtGui.QApplication.translate("MainWindow", "Lyso PC (LPC) [M+CH3COO]-", None, QtGui.QApplication.UnicodeUTF8)) - self.tab_a_lipidclass_cmb.setItemText(16-1, QtGui.QApplication.translate("MainWindow", "Lyso PE (LPE) [M-H]-", None, QtGui.QApplication.UnicodeUTF8)) - self.tab_a_lipidclass_cmb.setItemText(17-1, QtGui.QApplication.translate("MainWindow", "Lyso PG (LPG) [M-H]-", None, QtGui.QApplication.UnicodeUTF8)) - self.tab_a_lipidclass_cmb.setItemText(18-1, QtGui.QApplication.translate("MainWindow", "Lyso PI (LPI) [M-H]-", None, QtGui.QApplication.UnicodeUTF8)) - self.tab_a_lipidclass_cmb.setItemText(19-1, QtGui.QApplication.translate("MainWindow", "Lyso PS (LPS) [M-H]-", None, QtGui.QApplication.UnicodeUTF8)) - self.label_5.setText(QtGui.QApplication.translate("MainWindow", "FA white list:", None, QtGui.QApplication.UnicodeUTF8)) - self.label_19.setText(QtGui.QApplication.translate("MainWindow", "Isotope score ≥
", None, QtGui.QApplication.UnicodeUTF8)) - self.label_20.setText(QtGui.QApplication.translate("MainWindow", "Rank score ≥
", None, QtGui.QApplication.UnicodeUTF8)) - self.label_38.setText(QtGui.QApplication.translate("MainWindow", "Minimum relative intensity for scoring:", None, QtGui.QApplication.UnicodeUTF8)) - self.tab_a_ms2infoth_dspb.setSuffix(QtGui.QApplication.translate("MainWindow", " %", None, QtGui.QApplication.UnicodeUTF8)) - self.label_15.setText(QtGui.QApplication.translate("MainWindow", "MS level tolerance:", None, QtGui.QApplication.UnicodeUTF8)) - self.tab_a_msppm_spb.setSuffix(QtGui.QApplication.translate("MainWindow", " ppm", None, QtGui.QApplication.UnicodeUTF8)) - self.tab_a_msppm_spb.setPrefix(QtGui.QApplication.translate("MainWindow", "+/- ", None, QtGui.QApplication.UnicodeUTF8)) - self.label_13.setText(QtGui.QApplication.translate("MainWindow", "MS level threshold (absolute intensity):", None, QtGui.QApplication.UnicodeUTF8)) - self.tab_a_msmax_chb.setText(QtGui.QApplication.translate("MainWindow", "Set MS max inetnsity", None, QtGui.QApplication.UnicodeUTF8)) - self.label_25.setText(QtGui.QApplication.translate("MainWindow", "Precursor window:", None, QtGui.QApplication.UnicodeUTF8)) - self.tab_a_prwindow_spb.setPrefix(QtGui.QApplication.translate("MainWindow", "+/- ", None, QtGui.QApplication.UnicodeUTF8)) - self.tab_a_prwindow_spb.setSuffix(QtGui.QApplication.translate("MainWindow", " m/z", None, QtGui.QApplication.UnicodeUTF8)) - self.x.setText(QtGui.QApplication.translate("MainWindow", "DDA Top:", None, QtGui.QApplication.UnicodeUTF8)) - self.tab_a_runhunter_pb.setText(QtGui.QApplication.translate("MainWindow", "Hunt for lipids !", None, QtGui.QApplication.UnicodeUTF8)) - self.runhunter_tabframe.setTabText(self.runhunter_tabframe.indexOf(self.singlerun_tab), QtGui.QApplication.translate("MainWindow", "Run LipidHunter identification directly", None, QtGui.QApplication.UnicodeUTF8)) - self.label.setText(QtGui.QApplication.translate("MainWindow", "Save configuration file as:", None, QtGui.QApplication.UnicodeUTF8)) - self.tab_a_cfgpath_pb.setText(QtGui.QApplication.translate("MainWindow", "Save As", None, QtGui.QApplication.UnicodeUTF8)) - self.tab_a_gencfg_pb.setText(QtGui.QApplication.translate("MainWindow", "Generate configuration file for batch mode >>>", None, QtGui.QApplication.UnicodeUTF8)) - self.runhunter_tabframe.setTabText(self.runhunter_tabframe.indexOf(self.savecfg_tab), QtGui.QApplication.translate("MainWindow", "Save parameters for Batch Mode Hunter", None, QtGui.QApplication.UnicodeUTF8)) - self.label_23.setText(QtGui.QApplication.translate("MainWindow", "Instrument vendor:", None, QtGui.QApplication.UnicodeUTF8)) - self.vendor_cmb.setItemText(0, QtGui.QApplication.translate("MainWindow", "--- Please select ---", None, QtGui.QApplication.UnicodeUTF8)) - self.vendor_cmb.setItemText(1, QtGui.QApplication.translate("MainWindow", "Agilent", None, QtGui.QApplication.UnicodeUTF8)) - self.vendor_cmb.setItemText(2, QtGui.QApplication.translate("MainWindow", "SCIEX", None, QtGui.QApplication.UnicodeUTF8)) - self.vendor_cmb.setItemText(3, QtGui.QApplication.translate("MainWindow", "Thermo", None, QtGui.QApplication.UnicodeUTF8)) - self.vendor_cmb.setItemText(4, QtGui.QApplication.translate("MainWindow", "Waters", None, QtGui.QApplication.UnicodeUTF8)) - self.label_24.setText(QtGui.QApplication.translate("MainWindow", "Mode:", None, QtGui.QApplication.UnicodeUTF8)) - self.mode_lcms_rb.setText(QtGui.QApplication.translate("MainWindow", "LC-MS/MS", None, QtGui.QApplication.UnicodeUTF8)) - self.mode_static_rb.setText(QtGui.QApplication.translate("MainWindow", "Shotgun", None, QtGui.QApplication.UnicodeUTF8)) - self.tabframe.setTabText(self.tabframe.indexOf(self.hunter_tab), QtGui.QApplication.translate("MainWindow", "Hunt for Lipids", None, QtGui.QApplication.UnicodeUTF8)) - self.label_98.setText(QtGui.QApplication.translate("MainWindow", "Load batch configurations files (.txt):", None, QtGui.QApplication.UnicodeUTF8)) - self.tab_b_1_lb.setText(QtGui.QApplication.translate("MainWindow", "Input batch configuration file:", None, QtGui.QApplication.UnicodeUTF8)) - self.tab_b_addcfg_pb.setText(QtGui.QApplication.translate("MainWindow", "Add a single file", None, QtGui.QApplication.UnicodeUTF8)) - self.tab_b_2_lb.setText(QtGui.QApplication.translate("MainWindow", "Add all batch configurations in a folder:", None, QtGui.QApplication.UnicodeUTF8)) - self.tab_b_addcfgfolder_pb.setText(QtGui.QApplication.translate("MainWindow", "Select a folder", None, QtGui.QApplication.UnicodeUTF8)) - self.tab_b_clearall_pb.setText(QtGui.QApplication.translate("MainWindow", "Clear all", None, QtGui.QApplication.UnicodeUTF8)) - self.tab_b_runbatch_pb.setText(QtGui.QApplication.translate("MainWindow", "Run batch mode identification >>>", None, QtGui.QApplication.UnicodeUTF8)) - self.tab_b_maxsubcore_lb.setText(QtGui.QApplication.translate("MainWindow", "Max cores for each task:", None, QtGui.QApplication.UnicodeUTF8)) - self.tab_b_maxsubram_lb.setText(QtGui.QApplication.translate("MainWindow", "Max RAM for each task:", None, QtGui.QApplication.UnicodeUTF8)) - self.tab_b_maxsubram_spb.setSuffix(QtGui.QApplication.translate("MainWindow", " GB", None, QtGui.QApplication.UnicodeUTF8)) - self.tab_b_mutlimode_cmb.setItemText(0, QtGui.QApplication.translate("MainWindow", "Process as a sequence", None, QtGui.QApplication.UnicodeUTF8)) - self.tab_b_mutlimode_cmb.setItemText(1, QtGui.QApplication.translate("MainWindow", "Process multiple files in parallel", None, QtGui.QApplication.UnicodeUTF8)) - self.tab_b_maxbatch_lb.setText(QtGui.QApplication.translate("MainWindow", "Max number of files in parallel:", None, QtGui.QApplication.UnicodeUTF8)) - self.label_99.setText(QtGui.QApplication.translate("MainWindow", "Batch mode settings:", None, QtGui.QApplication.UnicodeUTF8)) - self.tabframe.setTabText(self.tabframe.indexOf(self.batch_tab), QtGui.QApplication.translate("MainWindow", "Batch Mode Hunter", None, QtGui.QApplication.UnicodeUTF8)) - self.label_93.setText(QtGui.QApplication.translate("MainWindow", "Image format:", None, QtGui.QApplication.UnicodeUTF8)) - self.tab_c_imagetype_cmb.setItemText(0, QtGui.QApplication.translate("MainWindow", ".png", None, QtGui.QApplication.UnicodeUTF8)) - self.tab_c_imagetype_cmb.setItemText(1, QtGui.QApplication.translate("MainWindow", ".svg", None, QtGui.QApplication.UnicodeUTF8)) - self.label_94.setText(QtGui.QApplication.translate("MainWindow", "dpi:", None, QtGui.QApplication.UnicodeUTF8)) - self.tab_c_scorecfgtg_lb.setText(QtGui.QApplication.translate("MainWindow", ""Wfrag" for TG:
", None, QtGui.QApplication.UnicodeUTF8)) - self.tab_c_scorecfgdg_lb.setText(QtGui.QApplication.translate("MainWindow", ""Wfrag" for DG:
", None, QtGui.QApplication.UnicodeUTF8)) - self.tab_c_isotopescoremode_lb.setText(QtGui.QApplication.translate("MainWindow", "Isotope Score mode:", None, QtGui.QApplication.UnicodeUTF8)) - self.label_14.setText(QtGui.QApplication.translate("MainWindow", "Lipid specific FRAG & NL list:", None, QtGui.QApplication.UnicodeUTF8)) - self.tab_c_scorecfgdg_pb.setText(QtGui.QApplication.translate("MainWindow", "Open", None, QtGui.QApplication.UnicodeUTF8)) - self.tab_c_scorecfgpl_lb.setText(QtGui.QApplication.translate("MainWindow", ""Wfrag" for PL:
", None, QtGui.QApplication.UnicodeUTF8)) - self.tab_c_scorecfgpl_pb.setText(QtGui.QApplication.translate("MainWindow", "Open", None, QtGui.QApplication.UnicodeUTF8)) - self.tab_c_scorecfgtg_pb.setText(QtGui.QApplication.translate("MainWindow", "Open", None, QtGui.QApplication.UnicodeUTF8)) - self.tab_c_hgcfg_pb.setText(QtGui.QApplication.translate("MainWindow", "Open", None, QtGui.QApplication.UnicodeUTF8)) - self.label_21.setText(QtGui.QApplication.translate("MainWindow", "Score weight factor settings:
", None, QtGui.QApplication.UnicodeUTF8)) - self.tab_c_parallization_cmb.setItemText(0, QtGui.QApplication.translate("MainWindow", "CPU prarallization mode", None, QtGui.QApplication.UnicodeUTF8)) - self.tab_c_parallization_cmb.setItemText(1, QtGui.QApplication.translate("MainWindow", "CPU +GPU mode (experimental)", None, QtGui.QApplication.UnicodeUTF8)) - self.label_63.setText(QtGui.QApplication.translate("MainWindow", "Max CPU cores to use:", None, QtGui.QApplication.UnicodeUTF8)) - self.label_64.setText(QtGui.QApplication.translate("MainWindow", "Max RAM to use:", None, QtGui.QApplication.UnicodeUTF8)) - self.tab_c_ram_spb.setSuffix(QtGui.QApplication.translate("MainWindow", " GB", None, QtGui.QApplication.UnicodeUTF8)) - self.tab_c_tag_all_fa_chb.setText(QtGui.QApplication.translate("MainWindow", "Favoured for TG with all three FA residues identified", None, QtGui.QApplication.UnicodeUTF8)) - self.label_12.setText(QtGui.QApplication.translate("MainWindow", "Default Fatty acid white list:", None, QtGui.QApplication.UnicodeUTF8)) - self.tab_c_falistpl_pb.setText(QtGui.QApplication.translate("MainWindow", "Open", None, QtGui.QApplication.UnicodeUTF8)) - self.tab_c_savesettings_pb.setText(QtGui.QApplication.translate("MainWindow", "Save above settings as defaullt", None, QtGui.QApplication.UnicodeUTF8)) - self.tab_c_falisttg_lb.setText(QtGui.QApplication.translate("MainWindow", ""Wfrag" for LPL:
", None, QtGui.QApplication.UnicodeUTF8)) - self.tab_c_falistpl_lb.setText(QtGui.QApplication.translate("MainWindow", "Default FA list:", None, QtGui.QApplication.UnicodeUTF8)) - self.tab_c_falisttg_pb.setText(QtGui.QApplication.translate("MainWindow", "Open", None, QtGui.QApplication.UnicodeUTF8)) - self.tab_c_isotopescoremode_cmb.setItemText(0, QtGui.QApplication.translate("MainWindow", "All elements", None, QtGui.QApplication.UnicodeUTF8)) - self.tab_c_isotopescoremode_cmb.setItemText(1, QtGui.QApplication.translate("MainWindow", "Fast (only 13C)", None, QtGui.QApplication.UnicodeUTF8)) - self.tab_c_scoremode_lb.setText(QtGui.QApplication.translate("MainWindow", "Score mode:", None, QtGui.QApplication.UnicodeUTF8)) - self.tab_c_scoremode_cmb.setItemText(0, QtGui.QApplication.translate("MainWindow", "Signal rank mode", None, QtGui.QApplication.UnicodeUTF8)) - self.tab_c_scoremode_cmb.setItemText(1, QtGui.QApplication.translate("MainWindow", "Relative Intensity mode", None, QtGui.QApplication.UnicodeUTF8)) - self.label_35.setText(QtGui.QApplication.translate("MainWindow", "Prarallel processing settings:", None, QtGui.QApplication.UnicodeUTF8)) - self.label_54.setText(QtGui.QApplication.translate("MainWindow", "Output image settings:", None, QtGui.QApplication.UnicodeUTF8)) - self.label_28.setText(QtGui.QApplication.translate("MainWindow", "FA white list:", None, QtGui.QApplication.UnicodeUTF8)) - self.tab_c_lmcalcfalist_pb.setText(QtGui.QApplication.translate("MainWindow", "Open", None, QtGui.QApplication.UnicodeUTF8)) - self.tab_c_lmexport_pb.setText(QtGui.QApplication.translate("MainWindow", "Save as", None, QtGui.QApplication.UnicodeUTF8)) - self.label_29.setText(QtGui.QApplication.translate("MainWindow", "Lipid Composer: Generate Lipid Master table from selected FA white list
", None, QtGui.QApplication.UnicodeUTF8)) - self.label_27.setText(QtGui.QApplication.translate("MainWindow", "Export Lipid Master table as (.csv): ", None, QtGui.QApplication.UnicodeUTF8)) - self.label_48.setText(QtGui.QApplication.translate("MainWindow", "Select lipid class:", None, QtGui.QApplication.UnicodeUTF8)) - self.tab_c_lipidclass_cmb.setItemText(0, QtGui.QApplication.translate("MainWindow", "--- Please select ---", None, QtGui.QApplication.UnicodeUTF8)) - self.tab_c_lipidclass_cmb.setItemText(1, QtGui.QApplication.translate("MainWindow", "Phosphatidic acid (PA) [M-H]-", None, QtGui.QApplication.UnicodeUTF8)) - self.tab_c_lipidclass_cmb.setItemText(2, QtGui.QApplication.translate("MainWindow", "Phosphatidylcholine (PC) [M+HCOO]-", None, QtGui.QApplication.UnicodeUTF8)) - self.tab_c_lipidclass_cmb.setItemText(3, QtGui.QApplication.translate("MainWindow", "Phosphatidylcholine (PC) [M+CH3COO]-", None, QtGui.QApplication.UnicodeUTF8)) - self.tab_c_lipidclass_cmb.setItemText(4, QtGui.QApplication.translate("MainWindow", "Phosphatidylethanolamine (PE) [M-H]-", None, QtGui.QApplication.UnicodeUTF8)) - self.tab_c_lipidclass_cmb.setItemText(5, QtGui.QApplication.translate("MainWindow", "Phosphatidylglycerol (PG) [M-H]-", None, QtGui.QApplication.UnicodeUTF8)) - self.tab_c_lipidclass_cmb.setItemText(6, QtGui.QApplication.translate("MainWindow", "Phosphatidylinositol (PI) [M-H]-", None, QtGui.QApplication.UnicodeUTF8)) - self.tab_c_lipidclass_cmb.setItemText(7, QtGui.QApplication.translate("MainWindow", "Phosphatidylserine (PS) [M-H]-", None, QtGui.QApplication.UnicodeUTF8)) - self.tab_c_lipidclass_cmb.setItemText(8, QtGui.QApplication.translate("MainWindow", "Triacylglycerol (TG) [M+NH4]+", None, QtGui.QApplication.UnicodeUTF8)) - self.tab_c_lipidclass_cmb.setItemText(9, QtGui.QApplication.translate("MainWindow", "Triacylglycerol (TG) [M+H]+", None, QtGui.QApplication.UnicodeUTF8)) - self.tab_c_lipidclass_cmb.setItemText(10, QtGui.QApplication.translate("MainWindow", "Triacylglycerol (TG) [M+Na]+", None, QtGui.QApplication.UnicodeUTF8)) - self.tab_c_lipidclass_cmb.setItemText(11, QtGui.QApplication.translate("MainWindow", "Diacylglycerol (DG) [M+NH4]+", None, QtGui.QApplication.UnicodeUTF8)) - # self.tab_c_lipidclass_cmb.setItemText(12, QtGui.QApplication.translate("MainWindow", "Diacylglycerol (DG) [M+H]+", None, QtGui.QApplication.UnicodeUTF8)) - self.tab_c_lipidclass_cmb.setItemText(13-1, QtGui.QApplication.translate("MainWindow", "Lyso PA (LPA) [M-H]-", None, QtGui.QApplication.UnicodeUTF8)) - self.tab_c_lipidclass_cmb.setItemText(14-1, QtGui.QApplication.translate("MainWindow", "Lyso PC (LPC) [M+HCOO]-", None, QtGui.QApplication.UnicodeUTF8)) - self.tab_c_lipidclass_cmb.setItemText(15-1, QtGui.QApplication.translate("MainWindow", "Lyso PC (LPC) [M+CH3COO]-", None, QtGui.QApplication.UnicodeUTF8)) - self.tab_c_lipidclass_cmb.setItemText(16-1, QtGui.QApplication.translate("MainWindow", "Lyso PE (LPE) [M-H]-", None, QtGui.QApplication.UnicodeUTF8)) - self.tab_c_lipidclass_cmb.setItemText(17-1, QtGui.QApplication.translate("MainWindow", "Lyso PG (LPG) [M-H]-", None, QtGui.QApplication.UnicodeUTF8)) - self.tab_c_lipidclass_cmb.setItemText(18-1, QtGui.QApplication.translate("MainWindow", "Lyso PI (LPI) [M-H]-", None, QtGui.QApplication.UnicodeUTF8)) - self.tab_c_lipidclass_cmb.setItemText(19-1, QtGui.QApplication.translate("MainWindow", "Lyso PS (LPS) [M-H]-", None, QtGui.QApplication.UnicodeUTF8)) - self.label_17.setText(QtGui.QApplication.translate("MainWindow", "MS/MS level query window:", None, QtGui.QApplication.UnicodeUTF8)) - self.tab_c_lmms2ppm_spb.setSuffix(QtGui.QApplication.translate("MainWindow", " ppm", None, QtGui.QApplication.UnicodeUTF8)) - self.tab_c_lmms2ppm_spb.setPrefix(QtGui.QApplication.translate("MainWindow", "+/- ", None, QtGui.QApplication.UnicodeUTF8)) - self.tab_c_lmrun_pb.setText(QtGui.QApplication.translate("MainWindow", "Generate Lipid Master table >>>", None, QtGui.QApplication.UnicodeUTF8)) - self.tabframe.setTabText(self.tabframe.indexOf(self.cfg_tab), QtGui.QApplication.translate("MainWindow", "Settings", None, QtGui.QApplication.UnicodeUTF8)) - self.label_2.setText(QtGui.QApplication.translate("MainWindow", "Lipid Class", None, QtGui.QApplication.UnicodeUTF8)) - self.lipidgen_tab1_lipidclass_cmb.setItemText(0, QtGui.QApplication.translate("MainWindow", "Phospholipid", None, QtGui.QApplication.UnicodeUTF8)) - self.lipidgen_tab1_lipidclass_cmb.setItemText(1, QtGui.QApplication.translate("MainWindow", "Triacylglycerol", None, QtGui.QApplication.UnicodeUTF8)) - self.lipidgen_tab1_lipidclass_cmb.setItemText(2, QtGui.QApplication.translate("MainWindow", "Sphingolipid", None, QtGui.QApplication.UnicodeUTF8)) - self.lipidgen_tab1_lipidclass_cmb.setItemText(3, QtGui.QApplication.translate("MainWindow", "Ceramide", None, QtGui.QApplication.UnicodeUTF8)) - self.lipidgen_tab1_lipidclass_cmb.setItemText(4, QtGui.QApplication.translate("MainWindow", "Cardiolipin", None, QtGui.QApplication.UnicodeUTF8)) - self.lipidgen_tab1_lipidclass_cmb.setItemText(5, QtGui.QApplication.translate("MainWindow", "Diacylglycerol", None, QtGui.QApplication.UnicodeUTF8)) - self.lipidgen_tab1_all_sn_chb.setText(QtGui.QApplication.translate("MainWindow", "Apply settings to all sn positions", None, QtGui.QApplication.UnicodeUTF8)) - self.label_59.setText(QtGui.QApplication.translate("MainWindow", "Save FA whitelist as .xlsx:", None, QtGui.QApplication.UnicodeUTF8)) - self.lipidgen_tab1_savelist_pb.setText(QtGui.QApplication.translate("MainWindow", "Save as", None, QtGui.QApplication.UnicodeUTF8)) - self.lipidgen_tab1_sn1_lb.setText(QtGui.QApplication.translate("MainWindow", "sn1", None, QtGui.QApplication.UnicodeUTF8)) - self.lipidgen_tab1_sn1allfa_chb.setText(QtGui.QApplication.translate("MainWindow", "Select all", None, QtGui.QApplication.UnicodeUTF8)) - self.sn1_fa12x0_chb.setText(QtGui.QApplication.translate("MainWindow", "FA12:0", None, QtGui.QApplication.UnicodeUTF8)) - self.sn1_fa22x5_chb.setText(QtGui.QApplication.translate("MainWindow", "FA22:5", None, QtGui.QApplication.UnicodeUTF8)) - self.sn1_fa18x2_chb.setText(QtGui.QApplication.translate("MainWindow", "FA18:2", None, QtGui.QApplication.UnicodeUTF8)) - self.sn1_fa18x1_chb.setText(QtGui.QApplication.translate("MainWindow", "FA18:1", None, QtGui.QApplication.UnicodeUTF8)) - self.sn1_fa22x4_chb.setText(QtGui.QApplication.translate("MainWindow", "FA22:4", None, QtGui.QApplication.UnicodeUTF8)) - self.sn1_fa20x5_chb.setText(QtGui.QApplication.translate("MainWindow", "FA20:5", None, QtGui.QApplication.UnicodeUTF8)) - self.sn1_fa18x0_chb.setText(QtGui.QApplication.translate("MainWindow", "FA18:0", None, QtGui.QApplication.UnicodeUTF8)) - self.sn1_fa22x6_chb.setText(QtGui.QApplication.translate("MainWindow", "FA22:6", None, QtGui.QApplication.UnicodeUTF8)) - self.sn1_fa16x1_chb.setText(QtGui.QApplication.translate("MainWindow", "FA16:1", None, QtGui.QApplication.UnicodeUTF8)) - self.sn1_fa14x0_chb.setText(QtGui.QApplication.translate("MainWindow", "FA14:0", None, QtGui.QApplication.UnicodeUTF8)) - self.sn1_fa20x3_chb.setText(QtGui.QApplication.translate("MainWindow", "FA20:3", None, QtGui.QApplication.UnicodeUTF8)) - self.sn1_fa16x0_chb.setText(QtGui.QApplication.translate("MainWindow", "FA16:0", None, QtGui.QApplication.UnicodeUTF8)) - self.sn1_fa18x3_chb.setText(QtGui.QApplication.translate("MainWindow", "FA18:3", None, QtGui.QApplication.UnicodeUTF8)) - self.sn1_fa20x4_chb.setText(QtGui.QApplication.translate("MainWindow", "FA20:4", None, QtGui.QApplication.UnicodeUTF8)) - self.sn1_showop_chb.setText(QtGui.QApplication.translate("MainWindow", "Consider O- & P- (PC,PE only)", None, QtGui.QApplication.UnicodeUTF8)) - self.sn1_o16x0_chb.setText(QtGui.QApplication.translate("MainWindow", "O-16:0", None, QtGui.QApplication.UnicodeUTF8)) - self.sn1_o18x0_chb.setText(QtGui.QApplication.translate("MainWindow", "O-18:0", None, QtGui.QApplication.UnicodeUTF8)) - self.sn1_o20x0_chb.setText(QtGui.QApplication.translate("MainWindow", "O-20:0", None, QtGui.QApplication.UnicodeUTF8)) - self.sn1_p16x0_chb.setText(QtGui.QApplication.translate("MainWindow", "P-16:0", None, QtGui.QApplication.UnicodeUTF8)) - self.sn1_p18x0_chb.setText(QtGui.QApplication.translate("MainWindow", "P-18:0", None, QtGui.QApplication.UnicodeUTF8)) - self.sn1_p20x0_chb.setText(QtGui.QApplication.translate("MainWindow", "P-20:0", None, QtGui.QApplication.UnicodeUTF8)) - self.label_22.setText(QtGui.QApplication.translate("MainWindow", "Other residues*:", None, QtGui.QApplication.UnicodeUTF8)) - self.label_62.setText(QtGui.QApplication.translate("MainWindow", "*: Add additional FA residue(s) using corresponging abbreviation(s) and put \", \" in between e.g. FA17:0, FA14:1", None, QtGui.QApplication.UnicodeUTF8)) - self.lipidgen_tab1_sn2_lb.setText(QtGui.QApplication.translate("MainWindow", "sn2", None, QtGui.QApplication.UnicodeUTF8)) - self.lipidgen_tab1_sn2allfa_chb.setText(QtGui.QApplication.translate("MainWindow", "Select all", None, QtGui.QApplication.UnicodeUTF8)) - self.sn2_fa22x5_chb.setText(QtGui.QApplication.translate("MainWindow", "FA22:5", None, QtGui.QApplication.UnicodeUTF8)) - self.sn2_fa22x4_chb.setText(QtGui.QApplication.translate("MainWindow", "FA22:4", None, QtGui.QApplication.UnicodeUTF8)) - self.sn2_fa20x5_chb.setText(QtGui.QApplication.translate("MainWindow", "FA20:5", None, QtGui.QApplication.UnicodeUTF8)) - self.sn2_fa22x6_chb.setText(QtGui.QApplication.translate("MainWindow", "FA22:6", None, QtGui.QApplication.UnicodeUTF8)) - self.sn2_fa18x1_chb.setText(QtGui.QApplication.translate("MainWindow", "FA18:1", None, QtGui.QApplication.UnicodeUTF8)) - self.sn2_fa14x0_chb.setText(QtGui.QApplication.translate("MainWindow", "FA14:0", None, QtGui.QApplication.UnicodeUTF8)) - self.sn2_fa16x0_chb.setText(QtGui.QApplication.translate("MainWindow", "FA16:0", None, QtGui.QApplication.UnicodeUTF8)) - self.sn2_fa18x3_chb.setText(QtGui.QApplication.translate("MainWindow", "FA18:3", None, QtGui.QApplication.UnicodeUTF8)) - self.sn2_fa18x2_chb.setText(QtGui.QApplication.translate("MainWindow", "FA18:2", None, QtGui.QApplication.UnicodeUTF8)) - self.sn2_fa18x0_chb.setText(QtGui.QApplication.translate("MainWindow", "FA18:0", None, QtGui.QApplication.UnicodeUTF8)) - self.sn2_fa16x1_chb.setText(QtGui.QApplication.translate("MainWindow", "FA16:1", None, QtGui.QApplication.UnicodeUTF8)) - self.sn2_fa20x4_chb.setText(QtGui.QApplication.translate("MainWindow", "FA20:4", None, QtGui.QApplication.UnicodeUTF8)) - self.sn2_fa20x3_chb.setText(QtGui.QApplication.translate("MainWindow", "FA20:3", None, QtGui.QApplication.UnicodeUTF8)) - self.sn2_fa12x0_chb.setText(QtGui.QApplication.translate("MainWindow", "FA12:0", None, QtGui.QApplication.UnicodeUTF8)) - self.label_41.setText(QtGui.QApplication.translate("MainWindow", "Other residues*:", None, QtGui.QApplication.UnicodeUTF8)) - self.lipidgen_tab1_sn3_lb.setText(QtGui.QApplication.translate("MainWindow", "sn3", None, QtGui.QApplication.UnicodeUTF8)) - self.lipidgen_tab1_sn3allfa_chb.setText(QtGui.QApplication.translate("MainWindow", "Select all", None, QtGui.QApplication.UnicodeUTF8)) - self.sn3_fa14x0_chb.setText(QtGui.QApplication.translate("MainWindow", "FA14:0", None, QtGui.QApplication.UnicodeUTF8)) - self.sn3_fa22x4_chb.setText(QtGui.QApplication.translate("MainWindow", "FA22:4", None, QtGui.QApplication.UnicodeUTF8)) - self.sn3_fa18x1_chb.setText(QtGui.QApplication.translate("MainWindow", "FA18:1", None, QtGui.QApplication.UnicodeUTF8)) - self.sn3_fa22x5_chb.setText(QtGui.QApplication.translate("MainWindow", "FA22:5", None, QtGui.QApplication.UnicodeUTF8)) - self.sn3_fa22x6_chb.setText(QtGui.QApplication.translate("MainWindow", "FA22:6", None, QtGui.QApplication.UnicodeUTF8)) - self.sn3_fa18x3_chb.setText(QtGui.QApplication.translate("MainWindow", "FA18:3", None, QtGui.QApplication.UnicodeUTF8)) - self.sn3_fa16x1_chb.setText(QtGui.QApplication.translate("MainWindow", "FA16:1", None, QtGui.QApplication.UnicodeUTF8)) - self.sn3_fa20x4_chb.setText(QtGui.QApplication.translate("MainWindow", "FA20:4", None, QtGui.QApplication.UnicodeUTF8)) - self.sn3_fa18x0_chb.setText(QtGui.QApplication.translate("MainWindow", "FA18:0", None, QtGui.QApplication.UnicodeUTF8)) - self.sn3_fa20x5_chb.setText(QtGui.QApplication.translate("MainWindow", "FA20:5", None, QtGui.QApplication.UnicodeUTF8)) - self.sn3_fa18x2_chb.setText(QtGui.QApplication.translate("MainWindow", "FA18:2", None, QtGui.QApplication.UnicodeUTF8)) - self.sn3_fa16x0_chb.setText(QtGui.QApplication.translate("MainWindow", "FA16:0", None, QtGui.QApplication.UnicodeUTF8)) - self.sn3_fa12x0_chb.setText(QtGui.QApplication.translate("MainWindow", "FA12:0", None, QtGui.QApplication.UnicodeUTF8)) - self.sn3_fa20x3_chb.setText(QtGui.QApplication.translate("MainWindow", "FA20:3", None, QtGui.QApplication.UnicodeUTF8)) - self.label_61.setText(QtGui.QApplication.translate("MainWindow", "Other residues*:", None, QtGui.QApplication.UnicodeUTF8)) - self.lipidgen_tab1_sn4_lb.setText(QtGui.QApplication.translate("MainWindow", "sn4", None, QtGui.QApplication.UnicodeUTF8)) - self.lipidgen_tab1_sn3allfa_chb_2.setText(QtGui.QApplication.translate("MainWindow", "Select all", None, QtGui.QApplication.UnicodeUTF8)) - self.sn4_fa22x6_chb.setText(QtGui.QApplication.translate("MainWindow", "FA22:6", None, QtGui.QApplication.UnicodeUTF8)) - self.sn4_fa22x5_chb.setText(QtGui.QApplication.translate("MainWindow", "FA22:5", None, QtGui.QApplication.UnicodeUTF8)) - self.sn4_fa22x4_chb.setText(QtGui.QApplication.translate("MainWindow", "FA22:4", None, QtGui.QApplication.UnicodeUTF8)) - self.sn4_fa20x5_chb.setText(QtGui.QApplication.translate("MainWindow", "FA20:5", None, QtGui.QApplication.UnicodeUTF8)) - self.sn4_fa20x4_chb.setText(QtGui.QApplication.translate("MainWindow", "FA20:4", None, QtGui.QApplication.UnicodeUTF8)) - self.sn4_fa20x3_chb.setText(QtGui.QApplication.translate("MainWindow", "FA20:3", None, QtGui.QApplication.UnicodeUTF8)) - self.sn4_fa18x3_chb.setText(QtGui.QApplication.translate("MainWindow", "FA18:3", None, QtGui.QApplication.UnicodeUTF8)) - self.sn4_fa18x2_chb.setText(QtGui.QApplication.translate("MainWindow", "FA18:2", None, QtGui.QApplication.UnicodeUTF8)) - self.sn4_fa18x1_chb.setText(QtGui.QApplication.translate("MainWindow", "FA18:1", None, QtGui.QApplication.UnicodeUTF8)) - self.sn4_fa18x0_chb.setText(QtGui.QApplication.translate("MainWindow", "FA18:0", None, QtGui.QApplication.UnicodeUTF8)) - self.sn4_fa16x1_chb.setText(QtGui.QApplication.translate("MainWindow", "FA16:1", None, QtGui.QApplication.UnicodeUTF8)) - self.sn4_fa16x0_chb.setText(QtGui.QApplication.translate("MainWindow", "FA16:0", None, QtGui.QApplication.UnicodeUTF8)) - self.sn4_fa14x0_chb.setText(QtGui.QApplication.translate("MainWindow", "FA14:0", None, QtGui.QApplication.UnicodeUTF8)) - self.sn4_fa12x0_chb.setText(QtGui.QApplication.translate("MainWindow", "FA12:0", None, QtGui.QApplication.UnicodeUTF8)) - self.label_66.setText(QtGui.QApplication.translate("MainWindow", "Other residues*:", None, QtGui.QApplication.UnicodeUTF8)) - self.lipidgen_tab1_genlist_pb.setText(QtGui.QApplication.translate("MainWindow", "Generate FA whitelist ", None, QtGui.QApplication.UnicodeUTF8)) - self.lipidgen_tabframe.setTabText(self.lipidgen_tabframe.indexOf(self.lipidgen_tab1), QtGui.QApplication.translate("MainWindow", "Lipid Generator Wizard", None, QtGui.QApplication.UnicodeUTF8)) - self.label_60.setText(QtGui.QApplication.translate("MainWindow", "Load FA white list from .xlsx:", None, QtGui.QApplication.UnicodeUTF8)) - self.lipidgen_tab2_loadlist_pb.setText(QtGui.QApplication.translate("MainWindow", "Open", None, QtGui.QApplication.UnicodeUTF8)) - self.lipidgen_tab2_loadlist_lb.setText(QtGui.QApplication.translate("MainWindow", "Sucessfully loaded!", None, QtGui.QApplication.UnicodeUTF8)) - self.lipidgen_tab2_savemasterlist_lb.setText(QtGui.QApplication.translate("MainWindow", "Save lipid master list as .xlsx:", None, QtGui.QApplication.UnicodeUTF8)) - self.lipidgen_tab2_savemasterlist_pb.setText(QtGui.QApplication.translate("MainWindow", "Save as", None, QtGui.QApplication.UnicodeUTF8)) - self.lipidgen_tab1_genmasterlist_pb.setText(QtGui.QApplication.translate("MainWindow", "Generate lipid master list >>> ", None, QtGui.QApplication.UnicodeUTF8)) - self.lipidgen_tabframe.setTabText(self.lipidgen_tabframe.indexOf(self.lipidgen_tab2), QtGui.QApplication.translate("MainWindow", "Create lipid master list from FA white list", None, QtGui.QApplication.UnicodeUTF8)) - self.tabframe.setTabText(self.tabframe.indexOf(self.generator_tab), QtGui.QApplication.translate("MainWindow", "FA White List Generator", None, QtGui.QApplication.UnicodeUTF8)) - self.version_lb.setText(QtGui.QApplication.translate("MainWindow", "LipidHunter 2 RC [Relased Date: 27, April, 2018]
", None, QtGui.QApplication.UnicodeUTF8)) - self.label_26.setText(QtGui.QApplication.translate("MainWindow", "Developed by: SysMedOs team", None, QtGui.QApplication.UnicodeUTF8)) - self.label_43.setText(QtGui.QApplication.translate("MainWindow", "LipidHunter is Dual-Licensed:
", None, QtGui.QApplication.UnicodeUTF8)) - self.label_42.setText(QtGui.QApplication.translate("MainWindow", " For academic & non-commercial use:", None, QtGui.QApplication.UnicodeUTF8)) - self.label_44.setText(QtGui.QApplication.translate("MainWindow", " For commercial use please contact the developers:", None, QtGui.QApplication.UnicodeUTF8)) - self.link_gplv2_lb.setText(QtGui.QApplication.translate("MainWindow", "Under GPL v2 License: https://www.gnu.org/licenses/old-licenses/gpl-2.0.en.html
", None, QtGui.QApplication.UnicodeUTF8)) - self.label_45.setText(QtGui.QApplication.translate("MainWindow", "oxlpp@bbz.uni-leipzig.de
", None, QtGui.QApplication.UnicodeUTF8)) - self.link_source_lb.setText(QtGui.QApplication.translate("MainWindow", "Project page: https://bitbucket.org/SysMedOs/lipidhunter
", None, QtGui.QApplication.UnicodeUTF8)) - self.link_tutorial_lb.setText(QtGui.QApplication.translate("MainWindow", "Online tutorial: https://bitbucket.org/SysMedOs/lipidhunter/wiki/
", None, QtGui.QApplication.UnicodeUTF8)) - self.link_paper_lb.setText(QtGui.QApplication.translate("MainWindow", "Please cite our publication: Ni, Z., Angelidou, G., Lange, M., Hoffmann, R., & Fedorova, M. (2017). LipidHunter identifies phospholipids by high-throughput processing of LC-MS and shotgun lipidomics datasets. Analytical chemistry, 89(17), 8800-8807.
", None, QtGui.QApplication.UnicodeUTF8)) - self.link_otherprojects_lb.setText(QtGui.QApplication.translate("MainWindow", "Other SysMedOs software Projects: https://home.uni-leipzig.de/fedorova/software/
", None, QtGui.QApplication.UnicodeUTF8)) - self.label_30.setText(QtGui.QApplication.translate("MainWindow", "We acknowlege all open source libraries used in LipidHunter:", None, QtGui.QApplication.UnicodeUTF8)) - self.label_31.setText(QtGui.QApplication.translate("MainWindow", "matplotlib", None, QtGui.QApplication.UnicodeUTF8)) - self.link_matplotlib_lb.setText(QtGui.QApplication.translate("MainWindow", "http://www.matplotlib.org
John D. Hunter. Matplotlib: A 2D Graphics Environment,
Computing in Science & Engineering, 9, 90-95 (2007), DOI:10.1109/MCSE.2007.55
https://www.numpy.org & https://www.scipy.org
Stéfan van der Walt, S. Chris Colbert and Gaël Varoquaux. The NumPy Array: A Structure for Efficient Numerical Computation,
Computing in Science & Engineering, 13, 22-30 (2011), DOI:10.1109/MCSE.2011.37
http://pandas.pydata.org
Wes McKinney. Data Structures for Statistical Computing in Python,
Proceedings of the 9th Python in Science Conference, 51-56 (2010)
https://pymzml.github.io
Bald, T., Barth, J., Niehues, A., Specht, M., Hippler, M., and Fufezan, C. (2012)
pymzML - Python module for high throughput bioinformatics on mass spectrometry data,
Bioinformatics, DOI: 10.1093/bioinformatics/bts066
http://numba.pydata.org
Siu Kwan Lam, Antoine Pitrou, and Stanley Seibert. Numba: a LLVM-based Python JIT compiler,
DOI:10.1145/2833157.2833162
https://home.uni-leipzig.de/fedorova/sysmedos/
", None, QtGui.QApplication.UnicodeUTF8)) - self.label_58.setText(QtGui.QApplication.translate("MainWindow", "SysMedOS Project : ", None, QtGui.QApplication.UnicodeUTF8)) - self.tabframe.setTabText(self.tabframe.indexOf(self.tab), QtGui.QApplication.translate("MainWindow", "About LipidHunter 2", None, QtGui.QApplication.UnicodeUTF8)) - self.link_uni_lb.setText(QtGui.QApplication.translate("MainWindow", "LipidHunter (C) 2016-2018 | University of Leipzig | AG Bioanalytik | Fedorova Research Group
", None, QtGui.QApplication.UnicodeUTF8)) - + MainWindow.setWindowTitle("LipidHunter 2 (RC2) | University of Leipzig ") + self.label_50.setText("Score weight factor settings:") + self.tab_a_mzml_pb.setText("Open") + self.label_3.setText("Select lipid class:") + self.label_4.setText("Scan time range (min):") + self.label_9.setText("to") + self.label_10.setText( + 'm/z range:
' + ) + self.label_11.setText("to") + self.label_6.setText("Input .mzML file:") + self.tab_a_loadfalist_pb.setText("Open") + self.label_7.setText("Save report to folder:") + self.tab_a_loadscorecfg_pb.setText("Open") + self.tab_a_sumxlsxpath_pb.setText("Save as") + self.tab_a_saveimgfolder_pb.setText("Save as") + self.label_8.setText("Export summary .xlsx table:") + self.label_16.setText("MS/MS level tolerance:") + self.tab_a_ms2ppm_spb.setSuffix(" ppm") + self.tab_a_ms2ppm_spb.setPrefix("+/- ") + self.tab_d_ms2threshold_spb_2.setText( + "MS/MS level threshold (absolute intensity):" + ) + self.tab_a_lipidclass_cmb.setItemText(0, "--- Please select ---") + self.tab_a_lipidclass_cmb.setItemText(1, "Phosphatidic acid (PA) [M-H]-") + self.tab_a_lipidclass_cmb.setItemText(2, "Phosphatidylcholine (PC) [M+HCOO]-") + self.tab_a_lipidclass_cmb.setItemText(3, "Phosphatidylcholine (PC) [M+CH3COO]-") + self.tab_a_lipidclass_cmb.setItemText(4, "Phosphatidylethanolamine (PE) [M-H]-") + self.tab_a_lipidclass_cmb.setItemText(5, "Phosphatidylglycerol (PG) [M-H]-") + self.tab_a_lipidclass_cmb.setItemText(6, "Phosphatidylinositol (PI) [M-H]-") + self.tab_a_lipidclass_cmb.setItemText(7, "Phosphatidylserine (PS) [M-H]-") + self.tab_a_lipidclass_cmb.setItemText(8, "Triacylglycerol (TG) [M+NH4]+") + self.tab_a_lipidclass_cmb.setItemText(9, "Triacylglycerol (TG) [M+H]+") + self.tab_a_lipidclass_cmb.setItemText(10, "Triacylglycerol (TG) [M+Na]+") + self.tab_a_lipidclass_cmb.setItemText(11, "Diacylglycerol (DG) [M+NH4]+") + # self.tab_a_lipidclass_cmb.setItemText(12, "Diacylglycerol (DG) [M+H]+", )) + self.tab_a_lipidclass_cmb.setItemText(13 - 1, "Lyso PA (LPA) [M-H]-") + self.tab_a_lipidclass_cmb.setItemText(14 - 1, "Lyso PC (LPC) [M+HCOO]-") + self.tab_a_lipidclass_cmb.setItemText(15 - 1, "Lyso PC (LPC) [M+CH3COO]-") + self.tab_a_lipidclass_cmb.setItemText(16 - 1, "Lyso PE (LPE) [M-H]-") + self.tab_a_lipidclass_cmb.setItemText(17 - 1, "Lyso PG (LPG) [M-H]-") + self.tab_a_lipidclass_cmb.setItemText(18 - 1, "Lyso PI (LPI) [M-H]-") + self.tab_a_lipidclass_cmb.setItemText(19 - 1, "Lyso PS (LPS) [M-H]-") + self.label_5.setText("FA white list:") + self.label_19.setText( + "Isotope score ≥
" + ) + self.label_20.setText("Rank score ≥
") + self.label_38.setText("Minimum relative intensity for scoring:") + self.tab_a_ms2infoth_dspb.setSuffix(" %") + self.label_15.setText("MS level tolerance:") + self.tab_a_msppm_spb.setSuffix(" ppm") + self.tab_a_msppm_spb.setPrefix("+/- ") + self.label_13.setText("MS level threshold (absolute intensity):") + self.tab_a_msmax_chb.setText("Set MS max inetnsity") + self.label_25.setText("Precursor window:") + self.tab_a_prwindow_spb.setPrefix("+/- ") + self.tab_a_prwindow_spb.setSuffix(" m/z") + self.x.setText("DDA Top:") + self.tab_a_runhunter_pb.setText("Hunt for lipids !") + self.runhunter_tabframe.setTabText( + self.runhunter_tabframe.indexOf(self.singlerun_tab), + "Run LipidHunter identification directly", + ) + self.label.setText("Save configuration file as:") + self.tab_a_cfgpath_pb.setText("Save As") + self.tab_a_gencfg_pb.setText("Generate configuration file for batch mode >>>") + self.runhunter_tabframe.setTabText( + self.runhunter_tabframe.indexOf(self.savecfg_tab), + "Save parameters for Batch Mode Hunter", + ) + self.label_23.setText("Instrument vendor:") + self.vendor_cmb.setItemText(0, "--- Please select ---") + self.vendor_cmb.setItemText(1, "Agilent") + self.vendor_cmb.setItemText(2, "Bruker") + self.vendor_cmb.setItemText(3, "SCIEX") + self.vendor_cmb.setItemText(4, "Thermo") + self.vendor_cmb.setItemText(5, "Waters") + self.label_24.setText("Mode:") + self.mode_lcms_rb.setText("LC-MS/MS") + self.mode_static_rb.setText("Shotgun") + self.tabframe.setTabText( + self.tabframe.indexOf(self.hunter_tab), "Hunt for Lipids" + ) + self.label_98.setText("Load batch configurations files (.txt):") + self.tab_b_1_lb.setText("Input batch configuration file:") + self.tab_b_addcfg_pb.setText("Add a single file") + self.tab_b_2_lb.setText("Add all batch configurations in a folder:") + self.tab_b_addcfgfolder_pb.setText("Select a folder") + self.tab_b_clearall_pb.setText("Clear all") + self.tab_b_runbatch_pb.setText("Run batch mode identification >>>") + self.tab_b_maxsubcore_lb.setText("Max cores for each task:") + self.tab_b_maxsubram_lb.setText("Max RAM for each task:") + self.tab_b_maxsubram_spb.setSuffix(" GB") + self.tab_b_mutlimode_cmb.setItemText(0, "Process as a sequence") + self.tab_b_mutlimode_cmb.setItemText(1, "Process multiple files in parallel") + self.tab_b_maxbatch_lb.setText("Max number of files in parallel:") + self.label_99.setText("Batch mode settings:") + self.tabframe.setTabText( + self.tabframe.indexOf(self.batch_tab), "Batch Mode Hunter" + ) + self.label_93.setText("Image format:") + self.tab_c_imagetype_cmb.setItemText(0, ".png") + self.tab_c_imagetype_cmb.setItemText(1, ".svg") + self.label_94.setText("dpi:") + self.tab_c_scorecfgtg_lb.setText( + '"Wfrag" for TG:
' + ) + self.tab_c_scorecfgdg_lb.setText( + '"Wfrag" for DG:
' + ) + self.tab_c_isotopescoremode_lb.setText("Isotope Score mode:") + self.label_14.setText("Lipid specific FRAG & NL list:") + self.tab_c_scorecfgdg_pb.setText("Open") + self.tab_c_scorecfgpl_lb.setText( + '"Wfrag" for PL:
' + ) + self.tab_c_scorecfgpl_pb.setText("Open") + self.tab_c_scorecfgtg_pb.setText("Open") + self.tab_c_hgcfg_pb.setText("Open") + self.label_21.setText( + "Score weight factor settings:
" + ) + self.tab_c_parallization_cmb.setItemText(0, "CPU prarallization mode") + self.tab_c_parallization_cmb.setItemText(1, "CPU +GPU mode (experimental)") + self.label_63.setText("Max CPU cores to use:") + self.label_64.setText("Max RAM to use:") + self.tab_c_ram_spb.setSuffix(" GB") + self.tab_c_tag_all_fa_chb.setText( + "Favoured for TG with all three FA residues identified" + ) + self.label_12.setText("Default Fatty acid white list:") + self.tab_c_falistpl_pb.setText("Open") + self.tab_c_savesettings_pb.setText("Save above settings as defaullt") + self.tab_c_falisttg_lb.setText( + '"Wfrag" for LPL:
' + ) + self.tab_c_falistpl_lb.setText("Default FA list:") + self.tab_c_falisttg_pb.setText("Open") + self.tab_c_isotopescoremode_cmb.setItemText(0, "All elements") + self.tab_c_isotopescoremode_cmb.setItemText(1, "Fast (only 13C)") + self.tab_c_scoremode_lb.setText("Score mode:") + self.tab_c_scoremode_cmb.setItemText(0, "Signal rank mode") + self.tab_c_scoremode_cmb.setItemText(1, "Relative Intensity mode") + self.label_35.setText("Prarallel processing settings:") + self.label_54.setText("Output image settings:") + self.label_28.setText("FA white list:") + self.tab_c_lmcalcfalist_pb.setText("Open") + self.tab_c_lmexport_pb.setText("Save as") + self.label_29.setText( + 'Lipid Composer: Generate Lipid Master table from selected FA white list
' + ) + self.label_27.setText("Export Lipid Master table as (.csv): ") + self.label_48.setText("Select lipid class:") + self.tab_c_lipidclass_cmb.setItemText(0, "--- Please select ---") + self.tab_c_lipidclass_cmb.setItemText(1, "Phosphatidic acid (PA) [M-H]-") + self.tab_c_lipidclass_cmb.setItemText(2, "Phosphatidylcholine (PC) [M+HCOO]-") + self.tab_c_lipidclass_cmb.setItemText(3, "Phosphatidylcholine (PC) [M+CH3COO]-") + self.tab_c_lipidclass_cmb.setItemText(4, "Phosphatidylethanolamine (PE) [M-H]-") + self.tab_c_lipidclass_cmb.setItemText(5, "Phosphatidylglycerol (PG) [M-H]-") + self.tab_c_lipidclass_cmb.setItemText(6, "Phosphatidylinositol (PI) [M-H]-") + self.tab_c_lipidclass_cmb.setItemText(7, "Phosphatidylserine (PS) [M-H]-") + self.tab_c_lipidclass_cmb.setItemText(8, "Triacylglycerol (TG) [M+NH4]+") + self.tab_c_lipidclass_cmb.setItemText(9, "Triacylglycerol (TG) [M+H]+") + self.tab_c_lipidclass_cmb.setItemText(10, "Triacylglycerol (TG) [M+Na]+") + self.tab_c_lipidclass_cmb.setItemText(11, "Diacylglycerol (DG) [M+NH4]+") + # self.tab_c_lipidclass_cmb.setItemText(12, "Diacylglycerol (DG) [M+H]+", )) + self.tab_c_lipidclass_cmb.setItemText(13 - 1, "Lyso PA (LPA) [M-H]-") + self.tab_c_lipidclass_cmb.setItemText(14 - 1, "Lyso PC (LPC) [M+HCOO]-") + self.tab_c_lipidclass_cmb.setItemText(15 - 1, "Lyso PC (LPC) [M+CH3COO]-") + self.tab_c_lipidclass_cmb.setItemText(16 - 1, "Lyso PE (LPE) [M-H]-") + self.tab_c_lipidclass_cmb.setItemText(17 - 1, "Lyso PG (LPG) [M-H]-") + self.tab_c_lipidclass_cmb.setItemText(18 - 1, "Lyso PI (LPI) [M-H]-") + self.tab_c_lipidclass_cmb.setItemText(19 - 1, "Lyso PS (LPS) [M-H]-") + self.label_17.setText("MS/MS level query window:") + self.tab_c_lmms2ppm_spb.setSuffix(" ppm") + self.tab_c_lmms2ppm_spb.setPrefix("+/- ") + self.tab_c_lmrun_pb.setText("Generate Lipid Master table >>>") + self.tabframe.setTabText(self.tabframe.indexOf(self.cfg_tab), "Settings") + self.label_2.setText("Lipid Class") + self.lipidgen_tab1_lipidclass_cmb.setItemText(0, "Phospholipid") + self.lipidgen_tab1_lipidclass_cmb.setItemText(1, "Triacylglycerol") + self.lipidgen_tab1_lipidclass_cmb.setItemText(2, "Sphingolipid") + self.lipidgen_tab1_lipidclass_cmb.setItemText(3, "Ceramide") + self.lipidgen_tab1_lipidclass_cmb.setItemText(4, "Cardiolipin") + self.lipidgen_tab1_lipidclass_cmb.setItemText(5, "Diacylglycerol") + self.lipidgen_tab1_all_sn_chb.setText("Apply settings to all sn positions") + self.label_59.setText("Save FA whitelist as .xlsx:") + self.lipidgen_tab1_savelist_pb.setText("Save as") + self.lipidgen_tab1_sn1_lb.setText("sn1") + self.lipidgen_tab1_sn1allfa_chb.setText("Select all") + self.sn1_fa12x0_chb.setText("FA12:0") + self.sn1_fa22x5_chb.setText("FA22:5") + self.sn1_fa18x2_chb.setText("FA18:2") + self.sn1_fa18x1_chb.setText("FA18:1") + self.sn1_fa22x4_chb.setText("FA22:4") + self.sn1_fa20x5_chb.setText("FA20:5") + self.sn1_fa18x0_chb.setText("FA18:0") + self.sn1_fa22x6_chb.setText("FA22:6") + self.sn1_fa16x1_chb.setText("FA16:1") + self.sn1_fa14x0_chb.setText("FA14:0") + self.sn1_fa20x3_chb.setText("FA20:3") + self.sn1_fa16x0_chb.setText("FA16:0") + self.sn1_fa18x3_chb.setText("FA18:3") + self.sn1_fa20x4_chb.setText("FA20:4") + self.sn1_showop_chb.setText("Consider O- & P- (PC,PE only)") + self.sn1_o16x0_chb.setText("O-16:0") + self.sn1_o18x0_chb.setText("O-18:0") + self.sn1_o20x0_chb.setText("O-20:0") + self.sn1_p16x0_chb.setText("P-16:0") + self.sn1_p18x0_chb.setText("P-18:0") + self.sn1_p20x0_chb.setText("P-20:0") + self.label_22.setText("Other residues*:") + self.label_62.setText( + '*: Add additional FA residue(s) using corresponging abbreviation(s) and put ", " in between e.g. FA17:0, FA14:1' + ) + self.lipidgen_tab1_sn2_lb.setText("sn2") + self.lipidgen_tab1_sn2allfa_chb.setText("Select all") + self.sn2_fa22x5_chb.setText("FA22:5") + self.sn2_fa22x4_chb.setText("FA22:4") + self.sn2_fa20x5_chb.setText("FA20:5") + self.sn2_fa22x6_chb.setText("FA22:6") + self.sn2_fa18x1_chb.setText("FA18:1") + self.sn2_fa14x0_chb.setText("FA14:0") + self.sn2_fa16x0_chb.setText("FA16:0") + self.sn2_fa18x3_chb.setText("FA18:3") + self.sn2_fa18x2_chb.setText("FA18:2") + self.sn2_fa18x0_chb.setText("FA18:0") + self.sn2_fa16x1_chb.setText("FA16:1") + self.sn2_fa20x4_chb.setText("FA20:4") + self.sn2_fa20x3_chb.setText("FA20:3") + self.sn2_fa12x0_chb.setText("FA12:0") + self.label_41.setText("Other residues*:") + self.lipidgen_tab1_sn3_lb.setText("sn3") + self.lipidgen_tab1_sn3allfa_chb.setText("Select all") + self.sn3_fa14x0_chb.setText("FA14:0") + self.sn3_fa22x4_chb.setText("FA22:4") + self.sn3_fa18x1_chb.setText("FA18:1") + self.sn3_fa22x5_chb.setText("FA22:5") + self.sn3_fa22x6_chb.setText("FA22:6") + self.sn3_fa18x3_chb.setText("FA18:3") + self.sn3_fa16x1_chb.setText("FA16:1") + self.sn3_fa20x4_chb.setText("FA20:4") + self.sn3_fa18x0_chb.setText("FA18:0") + self.sn3_fa20x5_chb.setText("FA20:5") + self.sn3_fa18x2_chb.setText("FA18:2") + self.sn3_fa16x0_chb.setText("FA16:0") + self.sn3_fa12x0_chb.setText("FA12:0") + self.sn3_fa20x3_chb.setText("FA20:3") + self.label_61.setText("Other residues*:") + self.lipidgen_tab1_sn4_lb.setText("sn4") + self.lipidgen_tab1_sn3allfa_chb_2.setText("Select all") + self.sn4_fa22x6_chb.setText("FA22:6") + self.sn4_fa22x5_chb.setText("FA22:5") + self.sn4_fa22x4_chb.setText("FA22:4") + self.sn4_fa20x5_chb.setText("FA20:5") + self.sn4_fa20x4_chb.setText("FA20:4") + self.sn4_fa20x3_chb.setText("FA20:3") + self.sn4_fa18x3_chb.setText("FA18:3") + self.sn4_fa18x2_chb.setText("FA18:2") + self.sn4_fa18x1_chb.setText("FA18:1") + self.sn4_fa18x0_chb.setText("FA18:0") + self.sn4_fa16x1_chb.setText("FA16:1") + self.sn4_fa16x0_chb.setText("FA16:0") + self.sn4_fa14x0_chb.setText("FA14:0") + self.sn4_fa12x0_chb.setText("FA12:0") + self.label_66.setText("Other residues*:") + self.lipidgen_tab1_genlist_pb.setText("Generate FA whitelist ") + self.lipidgen_tabframe.setTabText( + self.lipidgen_tabframe.indexOf(self.lipidgen_tab1), "Lipid Generator Wizard" + ) + self.label_60.setText("Load FA white list from .xlsx:") + self.lipidgen_tab2_loadlist_pb.setText("Open") + self.lipidgen_tab2_loadlist_lb.setText("Sucessfully loaded!") + self.lipidgen_tab2_savemasterlist_lb.setText("Save lipid master list as .xlsx:") + self.lipidgen_tab2_savemasterlist_pb.setText("Save as") + self.lipidgen_tab1_genmasterlist_pb.setText("Generate lipid master list >>> ") + self.lipidgen_tabframe.setTabText( + self.lipidgen_tabframe.indexOf(self.lipidgen_tab2), + "Create lipid master list from FA white list", + ) + self.tabframe.setTabText( + self.tabframe.indexOf(self.generator_tab), "FA White List Generator" + ) + self.version_lb.setText( + 'LipidHunter 2 RC2 [Relased Date: 21, Jan, 2020]
' + ) + self.label_26.setText("Developed by: SysMedOs team") + self.label_43.setText( + 'LipidHunter is Dual-Licensed:
' + ) + self.label_42.setText(" For academic & non-commercial use:") + self.label_44.setText( + " For commercial use please contact the developers:" + ) + self.link_gplv2_lb.setText( + 'Under GPL v2 License: https://www.gnu.org/licenses/old-licenses/gpl-2.0.en.html
' + ) + self.label_45.setText( + "oxlpp@bbz.uni-leipzig.de
" + ) + self.link_source_lb.setText( + 'Project page: https://github.com/SysMedOs/lipidhunter
' + ) + self.link_tutorial_lb.setText( + 'Online tutorial: https://github.com/SysMedOs/lipidhunter/wiki
' + ) + self.link_paper_lb.setText( + 'Please cite our publication: Ni, Z., Angelidou, G., Lange, M., Hoffmann, R., & Fedorova, M. (2017). LipidHunter identifies phospholipids by high-throughput processing of LC-MS and shotgun lipidomics datasets. Analytical chemistry, 89(17), 8800-8807.
' + ) + self.link_otherprojects_lb.setText( + 'Other SysMedOs software Projects: https://home.uni-leipzig.de/fedorova/software/
' + ) + self.label_30.setText( + "We acknowlege all open source libraries used in LipidHunter:" + ) + self.label_31.setText("matplotlib") + self.link_matplotlib_lb.setText( + 'http://www.matplotlib.org
John D. Hunter. Matplotlib: A 2D Graphics Environment,
Computing in Science & Engineering, 9, 90-95 (2007), DOI:10.1109/MCSE.2007.55
https://www.numpy.org & https://www.scipy.org
Stéfan van der Walt, S. Chris Colbert and Gaël Varoquaux. The NumPy Array: A Structure for Efficient Numerical Computation,
Computing in Science & Engineering, 13, 22-30 (2011), DOI:10.1109/MCSE.2011.37
http://pandas.pydata.org
Wes McKinney. Data Structures for Statistical Computing in Python,
Proceedings of the 9th Python in Science Conference, 51-56 (2010)
https://github.com/pymzml/pymzML
Bald, T., Barth, J., Niehues, A., Specht, M., Hippler, M., and Fufezan, C. (2012)
pymzML - Python module for high throughput bioinformatics on mass spectrometry data,
Bioinformatics, DOI: 10.1093/bioinformatics/bts066
https://wiki.qt.io/Qt_for_Python
' + ) + self.label_37.setText("numba") + self.label_97.setText( + 'http://numba.pydata.org
Siu Kwan Lam, Antoine Pitrou, and Stanley Seibert. Numba: a LLVM-based Python JIT compiler,
DOI:10.1145/2833157.2833162
https://home.uni-leipzig.de/fedorova/sysmedos/
' + ) + self.label_58.setText("SysMedOS Project : ") + self.tabframe.setTabText(self.tabframe.indexOf(self.tab), "About LipidHunter 2") + self.link_uni_lb.setText( + 'LipidHunter (C) 2016-2020 | University of Leipzig | AG Bioanalytik | Fedorova Research Group
' + ) import LibLipidHunter.LipidHunter_rcc - diff --git a/LibLipidHunter/LipidHunter_rcc.py b/LibLipidHunter/LipidHunter_rcc.py index 0da56ab..f7ee622 100644 --- a/LibLipidHunter/LipidHunter_rcc.py +++ b/LibLipidHunter/LipidHunter_rcc.py @@ -24,15 +24,23 @@ # # WARNING! All changes made in this file will be lost! -from PySide import QtCore +from PySide2 import QtCore qt_resource_data = b"\x00\x00\xc9\x16\x00\x00\x01\x00\x0c\x00 \x10\x00\x01\x00\x04\x00\xe8\x02\x00\x00\xc6\x00\x00\x00\x10\x10\x10\x00\x01\x00\x04\x00(\x01\x00\x00\xae\x03\x00\x0000\x00\x00\x01\x00\x08\x00\xa8\x0e\x00\x00\xd6\x04\x00\x00 \x00\x00\x01\x00\x08\x00\xa8\x08\x00\x00~\x13\x00\x00\x10\x10\x00\x00\x01\x00\x08\x00h\x05\x00\x00&\x1c\x00\x00@@\x00\x00\x01\x00 \x00(B\x00\x00\x8e!\x00\x0000\x00\x00\x01\x00 \x00\xa8%\x00\x00\xb6c\x00\x00((\x00\x00\x01\x00 \x00h\x1a\x00\x00^\x89\x00\x00 \x00\x00\x01\x00 \x00\xa8\x10\x00\x00\xc6\xa3\x00\x00\x18\x18\x00\x00\x01\x00 \x00\x88\x09\x00\x00n\xb4\x00\x00\x14\x14\x00\x00\x01\x00 \x00\xb8\x06\x00\x00\xf6\xbd\x00\x00\x10\x10\x00\x00\x01\x00 \x00h\x04\x00\x00\xae\xc4\x00\x00(\x00\x00\x00 \x00\x00\x00@\x00\x00\x00\x01\x00\x04\x00\x00\x00\x00\x00\x80\x02\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x10\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x80\x00\x00\x80\x00\x00\x00\x80\x80\x00\x80\x00\x00\x00\x80\x00\x80\x00\x80\x80\x00\x00\x80\x80\x80\x00\xc0\xc0\xc0\x00\x00\x00\xff\x00\x00\xff\x00\x00\x00\xff\xff\x00\xff\x00\x00\x00\xff\x00\xff\x00\xff\xff\x00\x00\xff\xff\xff\x00\x87\x87\x87\x87x{\x89\x87\x87x{\x89\x87xx\x989\xb9\xb9\xb9\xb9\xb9\x89\xb9\xb9\xb9\xb9\x89\xb9\xb9\xb9\xb8\xb9y\xb9\xb7\x9b\x9by\xb9\xb7\x9b\x9by\xb9\xb7\x9b\x97\x89{y\xb9\xb7\x9b\x9by\xb9\xb7\x9b\x9by\xb9\xb7\x98\x8b\x9b\x8f\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xf8\x9b\x9b9\xb9\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xf8\xb9{\x89\xb9\x8f\xff\x88\x88\xf8\x88\x88\x88\x8f\x88\x88\x88{\x97\x89\xb9\x8f\xf8\x9by\xb9\xb9\xb9\x8b\x9b\x9b\x9b\x9b\x9b\x98\x89\xb9\xbf\xf8\x98\xf8\xf8\xf8\xb8\x8f\x8f\x88\x9b\x9b\x9b\x9b9\xb9\x88\xff\xb8\xff\xff\xf8\x9f\xff\xff\xf8\x9b\x9b\x9b\x98{\x9b\x98\xff\x98\xff\xff\xff\x98\xff\xff\xff\x9b\x9b\x9b\x97\x89w\x98\xff\x8b\xff\xff\xff\xb8\xff\xff\xf8\xb9\xb9\xb9\xb8\x8b\x9b\x9b\xff\x89\x8f\xff\xff\x89\xff\xff\xff\x89\xb9w\x9b9\xb9\xb9\xff\x8b\x88\xf8\x8f\x8b\x8f\x8f\xff\x89\xb9\xb9\xb7\x89\xb9\xb9\x8f\x88\x9b{\x98\x9b\x98\x9b\x9b\x97\x9b\x9b\x97\x89\xb9\xb9\x8f\xf8\xb8\x88\x8f\x8bx\x88\xf8\x8b\x97\xb9\xb7\x89\xb9\xb9\xbf\xf8\xb8\xff\xff\xf8\xbf\xff\xff\x88\xb9w\x9b9\xb9\xb9\xb8\xf8\x98\xff\xff\xf8\xb8\xff\xff\xf8\xb9\xb9\xb8\x89\xb9w\x98\xff\x8b\xff\xff\xff\x98\xff\xff\xff\x9b\x9b\x97\x89\xb9\xb9\xb8\xff\x89\xff\xff\xffw\xff\xff\xf8\x9b\x9b\x98{\x9b\x9b\x9b\xff\x87\x88\xff\xff\x8b\x8f\xff\xff{\x9b\x9b9\xb9\xb9\xb9\xff\x8b\x9b{\x9b\x9bw\x9b\x9b\x9b\x9b\x98{\x9b\x97y\x8f\x88\x98\x88\x88\x89\xb8\x88\x88\x88\x9b\x97\x89w\x9b\x9b\x8f\xf8\xbf\xff\xff\xf7\x7f\xff\xff\xf9\xb9\xb7\x8b\x9b\x9b\x9b\x9f\xf8\xb8\xff\xff\xf8\xbf\xff\xff\x88\xb7\x9b9\xb9\xb9\xb9\xbf\xf8\x98\xff\xff\xf8\xb8\xff\xff\xf8\xb9\xb8\x89\xb9\xb9w\x98\xff\x8b\xff\xff\xff\x98\xff\xff\xff\x9b\x97\x89\xb9\xb9\xb9\xb8\xff\xb9\xff\xff\xf8\xb8\xff\xf8\xf8\x97\x98\x89y\xb9\xb9\xb9\x87\x89\x89\x87\x89\x89\x87\x87\x87\xb7\x9b9\xb7\xb9\xb9\xb9\xb9\xb9\xb9\xb9\xb9\xb9\xb9\xb9\xb9\xb9\xb7\xb3\x97\x97\x97\x97\x97\x97\x97\x97\x97\x97\x97\x97\x97\x9b\x97\x89\x8b{{{{{{{{{{{{{x\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00(\x00\x00\x00\x10\x00\x00\x00 \x00\x00\x00\x01\x00\x04\x00\x00\x00\x00\x00\xc0\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x10\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x80\x00\x00\x80\x00\x00\x00\x80\x80\x00\x80\x00\x00\x00\x80\x00\x80\x00\x80\x80\x00\x00\x80\x80\x80\x00\xc0\xc0\xc0\x00\x00\x00\xff\x00\x00\xff\x00\x00\x00\xff\xff\x00\xff\x00\x00\x00\xff\x00\xff\x00\xff\xff\x00\x00\xff\xff\xff\x00\xb7\xb7\x87\xb7\x87\xb7\xb8\x989\x89\xb9\xb9\xb9\xb9\x89\xb7{\x8f\xf8\xf8\xf8\xf8\xf8\xb7\x89\xf8\x88\x88\x88\x88\x8b\x98\xb9\x88\x7f\x88\x88\xff\x9b\x9b9\x8f\x8f\xff\x8f\xff\x9b\x98\x89\xb8\x88\x88x\x88\x8b\x97\x89\xb8\x8b\x88\xb8\x88\xb9\xb7{\x98\x88\xff\x88\xff\x87\x9b9\x88\xf8\xff\x88\xff\x89\xb8{\x9b\x88\x88\x8b\x88\x8b\x97\x89\xb9\xf8\x88\xf8\x88\xfb\x98\x89\xb9\x88\x8f\xf8\x8f\xff\x9b9\xb9\x8f\xbf\xf8\x8f\xf8\x98{\x99yy\x89y{\x97\x89\x8b{{{{{x\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00(\x00\x00\x000\x00\x00\x00`\x00\x00\x00\x01\x00\x08\x00\x00\x00\x00\x00\x80\x0a\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x01\x00\x00\x00\x00\x00\x001}\xed\x004~\xed\x006\x80\xed\x00:\x82\xed\x00=\x84\xee\x00@\x86\xee\x00B\x88\xee\x00D\x89\xef\x00H\x8b\xef\x00J\x8c\xee\x00L\x8e\xef\x00O\x90\xef\x00P\x91\xef\x00M\x8e\xf0\x00N\x90\xf0\x00Q\x91\xf0\x00T\x93\xf0\x00V\x94\xf0\x00Y\x96\xf0\x00]\x99\xf0\x00`\x9a\xf0\x00b\x9c\xf0\x00f\x9e\xf2\x00i\xa1\xf2\x00l\xa2\xf2\x00o\xa4\xf3\x00q\xa6\xf2\x00t\xa7\xf3\x00v\xa8\xf3\x00y\xaa\xf3\x00{\xac\xf3\x00}\xae\xf3\x00z\xab\xf4\x00{\xac\xf4\x00}\xad\xf4\x00\x80\xaf\xf4\x00\x83\xb1\xf4\x00\x86\xb2\xf5\x00\x8b\xb6\xf5\x00\x8d\xb7\xf5\x00\x8f\xb9\xf6\x00\x90\xb9\xf5\x00\x95\xbc\xf6\x00\x99\xbe\xf6\x00\x9d\xc1\xf6\x00\xa1\xc4\xf7\x00\xa5\xc6\xf7\x00\xa9\xc8\xf7\x00\xa9\xc9\xf8\x00\xae\xcc\xf8\x00\xb0\xcd\xf8\x00\xb4\xd0\xf8\x00\xb9\xd3\xf9\x00\xbb\xd4\xf9\x00\xbd\xd5\xf9\x00\xc0\xd7\xf9\x00\xc1\xd8\xf9\x00\xc5\xdb\xfa\x00\xc7\xdc\xfa\x00\xc8\xdc\xfa\x00\xcc\xdf\xfa\x00\xce\xe0\xfa\x00\xd1\xe1\xfb\x00\xd4\xe4\xfb\x00\xd6\xe5\xfc\x00\xd8\xe7\xfc\x00\xda\xe8\xfc\x00\xdd\xea\xfc\x00\xe0\xeb\xfc\x00\xe1\xec\xfc\x00\xe4\xee\xfd\x00\xe7\xf0\xfd\x00\xe9\xf1\xfd\x00\xec\xf3\xfd\x00\xee\xf4\xfe\x00\xf0\xf6\xfe\x00\xf5\xf9\xfe\x00\xf8\xfa\xfe\x00\xfa\xfc\xfe\x00\xfe\xfe\xff\x00\x00\x00\x00\x00\x02/\x00\x00\x04P\x00\x00\x06p\x00\x00\x08\x90\x00\x00\x0a\xb0\x00\x00\x0b\xcf\x00\x00\x0e\xf0\x00\x00 \xff\x12\x00=\xff1\x00[\xffQ\x00y\xffq\x00\x98\xff\x91\x00\xb5\xff\xb1\x00\xd4\xff\xd1\x00\xff\xff\xff\x00\x00\x00\x00\x00\x14/\x00\x00\x22P\x00\x000p\x00\x00=\x90\x00\x00L\xb0\x00\x00Y\xcf\x00\x00g\xf0\x00\x00x\xff\x11\x00\x8a\xff1\x00\x9c\xffQ\x00\xae\xffq\x00\xc0\xff\x91\x00\xd2\xff\xb1\x00\xe4\xff\xd1\x00\xff\xff\xff\x00\x00\x00\x00\x00&/\x00\x00@P\x00\x00Zp\x00\x00t\x90\x00\x00\x8e\xb0\x00\x00\xa9\xcf\x00\x00\xc2\xf0\x00\x00\xd1\xff\x11\x00\xd8\xff1\x00\xde\xffQ\x00\xe3\xffq\x00\xe9\xff\x91\x00\xef\xff\xb1\x00\xf6\xff\xd1\x00\xff\xff\xff\x00\x00\x00\x00\x00/&\x00\x00PA\x00\x00p[\x00\x00\x90t\x00\x00\xb0\x8e\x00\x00\xcf\xa9\x00\x00\xf0\xc3\x00\x00\xff\xd2\x11\x00\xff\xd81\x00\xff\xddQ\x00\xff\xe4q\x00\xff\xea\x91\x00\xff\xf0\xb1\x00\xff\xf6\xd1\x00\xff\xff\xff\x00\x00\x00\x00\x00/\x14\x00\x00P\x22\x00\x00p0\x00\x00\x90>\x00\x00\xb0M\x00\x00\xcf[\x00\x00\xf0i\x00\x00\xffy\x11\x00\xff\x8a1\x00\xff\x9dQ\x00\xff\xafq\x00\xff\xc1\x91\x00\xff\xd2\xb1\x00\xff\xe5\xd1\x00\xff\xff\xff\x00\x00\x00\x00\x00/\x03\x00\x00P\x04\x00\x00p\x06\x00\x00\x90\x09\x00\x00\xb0\x0a\x00\x00\xcf\x0c\x00\x00\xf0\x0e\x00\x00\xff \x12\x00\xff>1\x00\xff\x5cQ\x00\xffzq\x00\xff\x97\x91\x00\xff\xb6\xb1\x00\xff\xd4\xd1\x00\xff\xff\xff\x00\x00\x00\x00\x00/\x00\x0e\x00P\x00\x17\x00p\x00!\x00\x90\x00+\x00\xb0\x006\x00\xcf\x00@\x00\xf0\x00I\x00\xff\x11Z\x00\xff1p\x00\xffQ\x86\x00\xffq\x9c\x00\xff\x91\xb2\x00\xff\xb1\xc8\x00\xff\xd1\xdf\x00\xff\xff\xff\x00\x00\x00\x00\x00/\x00 \x00P\x006\x00p\x00L\x00\x90\x00b\x00\xb0\x00x\x00\xcf\x00\x8e\x00\xf0\x00\xa4\x00\xff\x11\xb3\x00\xff1\xbe\x00\xffQ\xc7\x00\xffq\xd1\x00\xff\x91\xdc\x00\xff\xb1\xe5\x00\xff\xd1\xf0\x00\xff\xff\xff\x00\x00\x00\x00\x00,\x00/\x00K\x00P\x00i\x00p\x00\x87\x00\x90\x00\xa5\x00\xb0\x00\xc4\x00\xcf\x00\xe1\x00\xf0\x00\xf0\x11\xff\x00\xf21\xff\x00\xf4Q\xff\x00\xf6q\xff\x00\xf7\x91\xff\x00\xf9\xb1\xff\x00\xfb\xd1\xff\x00\xff\xff\xff\x00\x00\x00\x00\x00\x1b\x00/\x00-\x00P\x00?\x00p\x00R\x00\x90\x00c\x00\xb0\x00v\x00\xcf\x00\x88\x00\xf0\x00\x99\x11\xff\x00\xa61\xff\x00\xb4Q\xff\x00\xc2q\xff\x00\xcf\x91\xff\x00\xdc\xb1\xff\x00\xeb\xd1\xff\x00\xff\xff\xff\x00\x00\x00\x00\x00\x08\x00/\x00\x0e\x00P\x00\x15\x00p\x00\x1b\x00\x90\x00!\x00\xb0\x00&\x00\xcf\x00,\x00\xf0\x00>\x11\xff\x00X1\xff\x00qQ\xff\x00\x8cq\xff\x00\xa6\x91\xff\x00\xbf\xb1\xff\x00\xda\xd1\xff\x00\xff\xff\xff\x00\x14\x09\x09\x09\x0a\x0a\x0a\x0a\x0a\x0a\x0a\x0a\x0a\x0a\x0a\x0a\x0a\x0a\x0a\x0a\x0a\x0a\x0a\x0a\x0a\x0a\x0a\x0a\x0a\x0a\x0a\x0a\x0a\x0a\x0a\x0a\x0a\x09\x0a\x0a\x0a\x0a\x0a\x09\x09\x0a\x09\x15\x09\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x0a\x09\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x09\x09\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x0a\x09\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x09\x09\x00\x00\x00\x00\x01\x08\x0a\x0a\x0a\x0a\x0a\x0a\x0a\x0a\x0a\x0a\x0a\x0a\x0a\x0a\x0a\x0a\x0a\x0a\x0a\x0a\x0a\x0a\x0a\x0a\x0a\x0a\x0a\x0a\x0a\x0a\x0a\x0a\x0a\x08\x02\x00\x00\x00\x00\x00\x0a\x09\x00\x00\x00\x00\x056FEEFEFEFEFEFEFFFFFFFFFFFFFFEFFFFF?\x12\x00\x00\x00\x00\x00\x09\x09\x00\x00\x00\x00\x023_________________________________N#\x00\x00\x00\x00\x00\x0a\x09\x00\x00\x00\x00\x00%N________________________________O2\x02\x00\x00\x00\x00\x09\x09\x00\x00\x00\x00\x00\x14K__LBAAAAAAAAAAAAAAAAAAAAAAAAAAAAA3\x05\x00\x00\x00\x00\x0a\x09\x00\x00\x00\x00\x00\x08B__C\x11\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x06\x01\x00\x00\x00\x00\x09\x09\x00\x00\x00\x00\x00\x024__J\x13\x00\x01\x03\x04\x03\x04\x03\x04\x04\x04\x03\x00\x00\x03\x04\x04\x04\x04\x04\x04\x04\x04\x03\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x0a\x09\x00\x00\x00\x00\x00\x00(N_N$\x00\x08399999993\x08\x00\x1d:;;;;;;<(\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x09\x09\x00\x00\x00\x00\x00\x00\x16L_O1\x02\x05>OOOOOOOL\x19\x00\x18LOOOOOOO>\x05\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x0a\x09\x00\x00\x00\x00\x00\x00\x08B__>\x06\x010O_____OO+\x00\x0dD_______I\x12\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x09\x09\x00\x00\x00\x00\x00\x00\x025O_I\x12\x00\x22N______O8\x03\x037_______N\x1f\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x0a\x09\x00\x00\x00\x00\x00\x00\x00(O_N#\x00\x12I_______E\x0e\x01*O_____OO0\x02\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x09\x09\x00\x00\x00\x00\x00\x00\x00\x17LOO0\x02\x05>O______L\x19\x00\x18LO_____O>\x05\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x0a\x09\x00\x00\x00\x00\x00\x00\x00\x0aD__>\x05\x010O______O*\x01\x0aD_______I\x12\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x09\x09\x00\x00\x00\x00\x00\x00\x00\x037__H\x12\x00\x1fNOOOOOOO8\x04\x037OOOOOOON\x22\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x0a\x09\x00\x00\x00\x00\x00\x00\x00\x01*OON!\x00\x0e02222222,\x05\x00 22222222\x1c\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\x09\x09\x00\x00\x00\x00\x00\x00\x00\x00\x19L_O.\x01\x00\x01\x01\x01\x01\x01\x01\x01\x01\x01\x00\x00\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x0a\x09\x00\x00\x00\x00\x00\x00\x00\x00\x0eF__<\x05\x00\x07\x13\x13\x13\x13\x13\x13\x13\x13\x0e\x01\x02\x10\x13\x13\x13\x13\x13\x13\x13\x12\x04\x00\x00\x00\x00\x00\x00\x00\x00\x00\x09\x09\x00\x00\x00\x00\x00\x00\x00\x00\x038__G\x10\x00\x1bHKKKKKKK6\x04\x034KKKKKKKH\x1b\x00\x00\x00\x00\x00\x00\x00\x00\x00\x0a\x09\x00\x00\x00\x00\x00\x00\x00\x00\x01+O_M\x1d\x00\x12H_______F\x0c\x01,O______O-\x01\x00\x00\x00\x00\x00\x00\x00\x00\x09\x09\x00\x00\x00\x00\x00\x00\x00\x00\x00\x1aL_O-\x01\x05=O______L\x1b\x00\x1bL_______;\x05\x00\x00\x00\x00\x00\x00\x00\x00\x0a\x09\x00\x00\x00\x00\x00\x00\x00\x00\x00\x0fF_O;\x04\x01.O______O,\x01\x0fG_______G\x10\x00\x00\x00\x00\x00\x00\x00\x00\x09\x09\x00\x00\x00\x00\x00\x00\x00\x00\x00\x04:__G\x10\x00 N_______9\x04\x04:_______M\x1c\x00\x00\x00\x00\x00\x00\x00\x00\x0a\x09\x00\x00\x00\x00\x00\x00\x00\x00\x00\x01,O_L\x1b\x00\x11H_______F\x0c\x01,O______O-\x01\x00\x00\x00\x00\x00\x00\x00\x09\x09\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x1bM_O,\x01\x05=_______L\x1b\x00\x1bL_______;\x04\x00\x00\x00\x00\x00\x00\x00\x0a\x09\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x10G__:\x04\x01.LMMMMMML*\x01\x0fDMMMMMMMD\x0f\x00\x00\x00\x00\x00\x00\x00\x09\x09\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x04;__F\x0b\x00\x0f\x1b\x1b\x1b\x1c\x1b\x1c\x1b\x1b\x13\x01\x02\x16\x1b\x1b\x1b\x1b\x1b\x1b\x1b\x1a\x06\x00\x00\x00\x00\x00\x00\x00\x0a\x09\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x01.O_L\x1a\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x09\x09\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x1dM_O+\x00\x02\x1c())))))(\x10\x00\x08%&&&&'&'!\x03\x00\x00\x00\x00\x00\x00\x0a\x09\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x11H__8\x03\x02.NNNNNNNN*\x00\x0aDONNNNNNG\x11\x00\x00\x00\x00\x00\x00\x09\x09\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x05=__E\x0e\x00\x1fN______O7\x03\x048O______M \x00\x00\x00\x00\x00\x00\x0a\x09\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x01/O_L\x18\x00\x12I_______E\x0d\x00+O______O.\x01\x00\x00\x00\x00\x00\x09\x09\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x22M_O*\x00\x05>_______L\x18\x00\x19L_______=\x05\x00\x00\x00\x00\x00\x0a\x09\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x12I_O5\x02\x010O______O*\x00\x0eF_______H\x11\x00\x00\x00\x00\x00\x09\x09\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x05>__C\x08\x00\x22M______O7\x03\x049_______M\x1e\x00\x00\x00\x00\x00\x0a\x09\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x010O_K\x16\x00\x12I_______E\x0a\x01+O______O.\x01\x00\x00\x00\x00\x09\x09\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x1eEFE\x1f\x00\x056EEEEEEE@\x14\x00\x17CFFFFFFF3\x04\x00\x00\x00\x00\x0a\x09\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x03\x0a\x0a\x0a\x05\x00\x00\x07\x09\x09\x09\x09\x09\x09\x09\x08\x03\x00\x02\x0a\x0a\x0a\x0a\x0a\x0a\x0a\x0a\x08\x01\x00\x00\x00\x00\x09\x09\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x0a\x09\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x09\x09\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x0a\x09\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x09\x14\x09\x09\x09\x09\x09\x09\x09\x09\x09\x09\x09\x09\x09\x09\x09\x09\x09\x09\x09\x09\x09\x09\x09\x09\x09\x09\x09\x09\x09\x09\x09\x09\x09\x09\x09\x09\x09\x09\x09\x09\x09\x09\x09\x09\x09\x09\x14\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00(\x00\x00\x00 \x00\x00\x00@\x00\x00\x00\x01\x00\x08\x00\x00\x00\x00\x00\x80\x04\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x01\x00\x00\x00\x00\x00\x001}\xed\x004\x7f\xed\x006\x80\xed\x009\x82\xed\x00=\x84\xee\x00@\x86\xee\x00B\x88\xee\x00E\x8a\xef\x00J\x8c\xee\x00N\x8f\xf0\x00R\x91\xf0\x00T\x93\xf0\x00U\x94\xf0\x00Y\x96\xf0\x00[\x98\xf1\x00^\x99\xf1\x00a\x9a\xf0\x00b\x9c\xf1\x00e\x9e\xf2\x00i\xa0\xf2\x00m\xa3\xf2\x00n\xa4\xf2\x00t\xa7\xf3\x00v\xa9\xf3\x00x\xaa\xf3\x00z\xab\xf4\x00{\xac\xf4\x00~\xad\xf4\x00\x80\xaf\xf4\x00\x82\xb0\xf4\x00\x85\xb2\xf5\x00\x8a\xb5\xf5\x00\x8d\xb6\xf5\x00\x8e\xb8\xf5\x00\x93\xbb\xf6\x00\x95\xbc\xf6\x00\x98\xbe\xf6\x00\x9d\xc1\xf6\x00\xa3\xc5\xf7\x00\xa7\xc7\xf7\x00\xa7\xc8\xf7\x00\xa9\xc9\xf7\x00\xa9\xc9\xf8\x00\xac\xcb\xf8\x00\xad\xcc\xf8\x00\xb0\xce\xf8\x00\xb6\xd1\xf8\x00\xb9\xd2\xf9\x00\xbd\xd5\xf9\x00\xc0\xd7\xfa\x00\xc2\xd8\xfa\x00\xc4\xda\xfa\x00\xc7\xdc\xfa\x00\xca\xdd\xfa\x00\xce\xe0\xfb\x00\xd1\xe2\xfb\x00\xd4\xe4\xfb\x00\xd7\xe6\xfc\x00\xd9\xe7\xfc\x00\xda\xe8\xfc\x00\xdd\xe9\xfc\x00\xe0\xeb\xfc\x00\xe2\xed\xfc\x00\xe4\xee\xfd\x00\xe9\xf1\xfd\x00\xec\xf3\xfd\x00\xed\xf4\xfe\x00\xf1\xf6\xfe\x00\xf3\xf8\xfe\x00\xf5\xf8\xfe\x00\xf8\xfb\xff\x00\xfa\xfc\xff\x00\xfe\xfe\xff\x001\xffq\x00Q\xff\x87\x00q\xff\x9d\x00\x91\xff\xb2\x00\xb1\xff\xc9\x00\xd1\xff\xdf\x00\xff\xff\xff\x00\x00\x00\x00\x00\x02/\x00\x00\x04P\x00\x00\x06p\x00\x00\x08\x90\x00\x00\x0a\xb0\x00\x00\x0b\xcf\x00\x00\x0e\xf0\x00\x00 \xff\x12\x00=\xff1\x00[\xffQ\x00y\xffq\x00\x98\xff\x91\x00\xb5\xff\xb1\x00\xd4\xff\xd1\x00\xff\xff\xff\x00\x00\x00\x00\x00\x14/\x00\x00\x22P\x00\x000p\x00\x00=\x90\x00\x00L\xb0\x00\x00Y\xcf\x00\x00g\xf0\x00\x00x\xff\x11\x00\x8a\xff1\x00\x9c\xffQ\x00\xae\xffq\x00\xc0\xff\x91\x00\xd2\xff\xb1\x00\xe4\xff\xd1\x00\xff\xff\xff\x00\x00\x00\x00\x00&/\x00\x00@P\x00\x00Zp\x00\x00t\x90\x00\x00\x8e\xb0\x00\x00\xa9\xcf\x00\x00\xc2\xf0\x00\x00\xd1\xff\x11\x00\xd8\xff1\x00\xde\xffQ\x00\xe3\xffq\x00\xe9\xff\x91\x00\xef\xff\xb1\x00\xf6\xff\xd1\x00\xff\xff\xff\x00\x00\x00\x00\x00/&\x00\x00PA\x00\x00p[\x00\x00\x90t\x00\x00\xb0\x8e\x00\x00\xcf\xa9\x00\x00\xf0\xc3\x00\x00\xff\xd2\x11\x00\xff\xd81\x00\xff\xddQ\x00\xff\xe4q\x00\xff\xea\x91\x00\xff\xf0\xb1\x00\xff\xf6\xd1\x00\xff\xff\xff\x00\x00\x00\x00\x00/\x14\x00\x00P\x22\x00\x00p0\x00\x00\x90>\x00\x00\xb0M\x00\x00\xcf[\x00\x00\xf0i\x00\x00\xffy\x11\x00\xff\x8a1\x00\xff\x9dQ\x00\xff\xafq\x00\xff\xc1\x91\x00\xff\xd2\xb1\x00\xff\xe5\xd1\x00\xff\xff\xff\x00\x00\x00\x00\x00/\x03\x00\x00P\x04\x00\x00p\x06\x00\x00\x90\x09\x00\x00\xb0\x0a\x00\x00\xcf\x0c\x00\x00\xf0\x0e\x00\x00\xff \x12\x00\xff>1\x00\xff\x5cQ\x00\xffzq\x00\xff\x97\x91\x00\xff\xb6\xb1\x00\xff\xd4\xd1\x00\xff\xff\xff\x00\x00\x00\x00\x00/\x00\x0e\x00P\x00\x17\x00p\x00!\x00\x90\x00+\x00\xb0\x006\x00\xcf\x00@\x00\xf0\x00I\x00\xff\x11Z\x00\xff1p\x00\xffQ\x86\x00\xffq\x9c\x00\xff\x91\xb2\x00\xff\xb1\xc8\x00\xff\xd1\xdf\x00\xff\xff\xff\x00\x00\x00\x00\x00/\x00 \x00P\x006\x00p\x00L\x00\x90\x00b\x00\xb0\x00x\x00\xcf\x00\x8e\x00\xf0\x00\xa4\x00\xff\x11\xb3\x00\xff1\xbe\x00\xffQ\xc7\x00\xffq\xd1\x00\xff\x91\xdc\x00\xff\xb1\xe5\x00\xff\xd1\xf0\x00\xff\xff\xff\x00\x00\x00\x00\x00,\x00/\x00K\x00P\x00i\x00p\x00\x87\x00\x90\x00\xa5\x00\xb0\x00\xc4\x00\xcf\x00\xe1\x00\xf0\x00\xf0\x11\xff\x00\xf21\xff\x00\xf4Q\xff\x00\xf6q\xff\x00\xf7\x91\xff\x00\xf9\xb1\xff\x00\xfb\xd1\xff\x00\xff\xff\xff\x00\x00\x00\x00\x00\x1b\x00/\x00-\x00P\x00?\x00p\x00R\x00\x90\x00c\x00\xb0\x00v\x00\xcf\x00\x88\x00\xf0\x00\x99\x11\xff\x00\xa61\xff\x00\xb4Q\xff\x00\xc2q\xff\x00\xcf\x91\xff\x00\xdc\xb1\xff\x00\xeb\xd1\xff\x00\xff\xff\xff\x00\x00\x00\x00\x00\x08\x00/\x00\x0e\x00P\x00\x15\x00p\x00\x1b\x00\x90\x00!\x00\xb0\x00&\x00\xcf\x00,\x00\xf0\x00>\x11\xff\x00X1\xff\x00qQ\xff\x00\x8cq\xff\x00\xa6\x91\xff\x00\xbf\xb1\xff\x00\xda\xd1\xff\x00\xff\xff\xff\x00\x10\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x10\x08\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x08\x08\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x08\x08\x00\x00\x01\x08\x08\x09\x09\x08\x09\x09\x08\x09\x09\x08\x09\x09\x08\x09\x08\x09\x08\x09\x08\x09\x08\x09\x04\x00\x00\x00\x08\x08\x00\x00\x050??????????????????????\x1e\x00\x00\x00\x08\x08\x00\x00\x01-OOOOOOOOOOOOOOOOOOOOOO0\x03\x00\x00\x08\x08\x00\x00\x00\x1eGH3*+*+++*++++++++++**#\x04\x00\x00\x08\x08\x00\x00\x00\x0fCH\x1e\x01\x04\x06\x05\x06\x06\x06\x03\x02\x05\x06\x06\x06\x06\x06\x02\x01\x01\x01\x01\x00\x00\x00\x08\x08\x00\x00\x00\x07:O-\x03$87877\x17\x05.88885\x0c\x00\x00\x00\x00\x00\x00\x00\x08\x08\x00\x00\x00\x02.O8\x06 HOOOO-\x03/OOOOG\x1c\x00\x00\x00\x00\x00\x00\x00\x08\x08\x00\x00\x00\x00\x1fHB\x0e\x11DOOOO8\x06!HOOOO+\x01\x00\x00\x00\x00\x00\x00\x08\x08\x00\x00\x00\x00\x11DG\x1c\x07;OOOOB\x0e\x12DOOOO8\x05\x00\x00\x00\x00\x00\x00\x08\x08\x00\x00\x00\x01\x07