Commit 91009fa4 authored by letournd's avatar letournd
Browse files

20.04.2022 / v5.17 / Changing live Constellation interface to formulafinding...

20.04.2022 / v5.17 / Changing live Constellation interface to formulafinding branch as it appears to be functional & stable
parent a9e7fa4d
......@@ -198,7 +198,7 @@ def formulafinder(self, datainjson):
set_settings(mass_spectrum_obj)
mass_spectrum_obj.clear_molecular_formulas()
self.update_state(state='PROGRESS', meta={'update': 'Finding formulas', 'ctasks': len(masses)})
self.update_state(state='PROGRESS', meta={'update': 'Searching for molecular formulas', 'ctasks': len(masses)})
SearchMolecularFormulas(mass_spectrum_obj, first_hit=False).run_worker_mass_spectrum()
# Send DataFrame-formatted results back via JSON
......
......@@ -1836,9 +1836,9 @@ def fconfirm(n_clicks):
cancel=[Input('fstop', 'n_clicks')], prevent_initial_call=True)
def formulafinder(set_progress, submit_n_clicks, userid, n_clicks, rawdatain, sminppmerror, smaxppmerror, smindbe,
smaxdbe, smsnoisethreshold, sproradadd, sisotopologuefilter, sminabundanceerror, smaxabundanceerror,
sminpeaksfilter, sminpeaksperclass, sminprominence, newformulasfile, currentrawfile, sfilterlen,
mincin, maxcin, minhin, maxhin, minoin, maxoin, minnin, maxnin, minsin, maxsin, minclin, maxclin,
minbrin, maxbrin, minpin, maxpin, minnain, maxnain, minaddin, maxaddin):
sminpeaksfilter, sminpeaksperclass, sminprominence, newformulasfile, currentrawfile, mincin, maxcin,
minhin, maxhin, minoin, maxoin, minnin, maxnin, minsin, maxsin, minclin, maxclin, minbrin, maxbrin,
minpin, maxpin, minnain, maxnain, minaddin, maxaddin):
# This is the callback controlling formula finding. It takes in all formula finding parameters, manages formula
# finding tasks on the remote server, and finally returns a DataFrame serialized to a JSON string, stored in a
# dcc.Store called 'tempformulasdata', which is then passed onto the load_clear_formulas callback above for saving.
......@@ -1986,20 +1986,24 @@ def formulafinder(set_progress, submit_n_clicks, userid, n_clicks, rawdatain, sm
# FORMULA FINDING BEGINS HERE
blankresolutions = [0 for a in rawdata['m/z'].tolist()]
blanks2n = [0 for b in rawdata['I'].tolist()]
fdatain = {'rawdata': rawdata.to_json(orient='columns'), 'resolution': blankresolutions, 's2n': blanks2n,
'minppmerror': minppmerror, 'maxppmerror': maxppmerror, 'mindbe': mindbe, 'maxdbe': maxdbe,
'msnoisethreshold': msnoisethreshold, 'pro': pro, 'rad': rad, 'add': add,
'isotopologuefilter': isotopologuefilter, 'minabunerror': minabundanceerror,
'maxabunerror': maxabundanceerror, 'minpeaksfilter': minpeaksfilter,
fdatain = {'rawdata': rawdatain, 'resolution': blankresolutions, 's2n': blanks2n, 'minppmerror': minppmerror,
'maxppmerror': maxppmerror, 'mindbe': mindbe, 'maxdbe': maxdbe, 'msnoisethreshold': msnoisethreshold,
'pro': pro, 'rad': rad, 'add': add, 'isotopologuefilter': isotopologuefilter,
'minabunerror': minabundanceerror, 'maxabunerror': maxabundanceerror, 'minpeaksfilter': minpeaksfilter,
'minpeaksperclass': minpeaksperclass, 'minprominence': minprominence, 'minc': minc, 'maxc': maxc,
'minh': minh, 'maxh': maxh, 'mino': mino, 'maxo': maxo, 'minn': minn, 'maxn': maxn, 'mins': mins,
'maxs': maxs, 'mincl': mincl, 'maxcl': maxcl, 'minbr': minbr, 'maxbr': maxbr, 'minp': minp, 'maxp': maxp,
'minna': minna, 'maxna': maxna, 'minadd': minadd, 'maxadd': maxadd}
set_progress([5, True, True, 'Status: Sending request to remote server'])
fdata = remoteprocessing('formulafinder', fdatain, False, 0, 100, 'Calculating formulas - ')
fdata = remoteprocessing('formulafinder', fdatain, False, 0, 100, 'Finding formulas - ')
if not fdata:
return formulasdataout, 0
else:
fdatadf = pd.read_json(fdata['data'], orient='columns')
numformulas = len(fdatadf['Molecular Formulas'])
set_progress([100, True, True, 'Status: Found molecular formulas for ' + numformulas + ' peaks in the dataset'])
time.sleep(5)
# Finish up
formulasdataout = fdata['data']
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment