pycompound 0.0.8__py3-none-any.whl → 0.0.9__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- app.py +62 -21
- pycompound/plot_spectra.py +4 -4
- pycompound/spec_lib_matching.py +20 -12
- {pycompound-0.0.8.dist-info → pycompound-0.0.9.dist-info}/METADATA +2 -3
- {pycompound-0.0.8.dist-info → pycompound-0.0.9.dist-info}/RECORD +8 -8
- {pycompound-0.0.8.dist-info → pycompound-0.0.9.dist-info}/WHEEL +0 -0
- {pycompound-0.0.8.dist-info → pycompound-0.0.9.dist-info}/licenses/LICENSE +0 -0
- {pycompound-0.0.8.dist-info → pycompound-0.0.9.dist-info}/top_level.txt +0 -0
app.py
CHANGED
|
@@ -11,7 +11,10 @@ import subprocess
|
|
|
11
11
|
import traceback
|
|
12
12
|
import asyncio
|
|
13
13
|
import io
|
|
14
|
+
#import matplotlib
|
|
15
|
+
#matplotlib.use('agg')
|
|
14
16
|
import matplotlib.pyplot as plt
|
|
17
|
+
#from matplotlib.figure import Figure
|
|
15
18
|
|
|
16
19
|
|
|
17
20
|
def plot_spectra_ui(platform: str):
|
|
@@ -71,7 +74,7 @@ def plot_spectra_ui(platform: str):
|
|
|
71
74
|
)
|
|
72
75
|
|
|
73
76
|
# Run and Back buttons
|
|
74
|
-
|
|
77
|
+
run_button_plot_spectra = ui.download_button("run_btn_plot_spectra", "Run", style="font-size:16px; padding:15px 30px; width:200px; height:80px")
|
|
75
78
|
back_button = ui.input_action_button("back", "Back to main menu", style="font-size:16px; padding:15px 30px; width:200px; height:80px")
|
|
76
79
|
|
|
77
80
|
#print(len(extra_inputs))
|
|
@@ -98,7 +101,7 @@ def plot_spectra_ui(platform: str):
|
|
|
98
101
|
ui.TagList(
|
|
99
102
|
ui.h2("Plot Spectra"),
|
|
100
103
|
inputs_columns,
|
|
101
|
-
|
|
104
|
+
run_button_plot_spectra,
|
|
102
105
|
back_button
|
|
103
106
|
),
|
|
104
107
|
)
|
|
@@ -155,10 +158,9 @@ def run_spec_lib_matching_ui(platform: str):
|
|
|
155
158
|
|
|
156
159
|
|
|
157
160
|
# Run and Back buttons
|
|
158
|
-
|
|
161
|
+
run_button_spec_lib_matching = ui.download_button("run_btn_spec_lib_matching", "Run", style="font-size:16px; padding:15px 30px; width:200px; height:80px")
|
|
159
162
|
back_button = ui.input_action_button("back", "Back to main menu", style="font-size:16px; padding:15px 30px; width:200px; height:80px")
|
|
160
163
|
|
|
161
|
-
#print(len(extra_inputs))
|
|
162
164
|
# Layout base_inputs and extra_inputs in columns
|
|
163
165
|
if platform == "HRMS":
|
|
164
166
|
inputs_columns = ui.layout_columns(
|
|
@@ -182,7 +184,7 @@ def run_spec_lib_matching_ui(platform: str):
|
|
|
182
184
|
ui.TagList(
|
|
183
185
|
ui.h2("Run Spectral Library Matching"),
|
|
184
186
|
inputs_columns,
|
|
185
|
-
|
|
187
|
+
run_button_spec_lib_matching,
|
|
186
188
|
back_button
|
|
187
189
|
),
|
|
188
190
|
)
|
|
@@ -197,15 +199,15 @@ app_ui = ui.page_fluid(
|
|
|
197
199
|
|
|
198
200
|
def server(input, output, session):
|
|
199
201
|
|
|
200
|
-
# Track which page to show
|
|
201
202
|
current_page = reactive.Value("main_menu")
|
|
202
203
|
|
|
203
|
-
# Track button clicks
|
|
204
204
|
plot_clicks = reactive.Value(0)
|
|
205
205
|
match_clicks = reactive.Value(0)
|
|
206
206
|
back_clicks = reactive.Value(0)
|
|
207
207
|
|
|
208
|
-
|
|
208
|
+
run_status_plot_spectra = reactive.Value("")
|
|
209
|
+
run_status_spec_lib_matching = reactive.Value("")
|
|
210
|
+
|
|
209
211
|
|
|
210
212
|
@reactive.Effect
|
|
211
213
|
def _():
|
|
@@ -220,6 +222,7 @@ def server(input, output, session):
|
|
|
220
222
|
current_page.set("main_menu")
|
|
221
223
|
back_clicks.set(input.back())
|
|
222
224
|
|
|
225
|
+
|
|
223
226
|
@render.image
|
|
224
227
|
def image():
|
|
225
228
|
from pathlib import Path
|
|
@@ -228,6 +231,7 @@ def server(input, output, session):
|
|
|
228
231
|
img: ImgData = {"src": str(dir / "www/emblem.png"), "width": "320px", "height": "250px"}
|
|
229
232
|
return img
|
|
230
233
|
|
|
234
|
+
|
|
231
235
|
@output
|
|
232
236
|
@render.ui
|
|
233
237
|
def main_ui():
|
|
@@ -310,8 +314,10 @@ def server(input, output, session):
|
|
|
310
314
|
elif current_page() == "run_spec_lib_matching":
|
|
311
315
|
return run_spec_lib_matching_ui(input.chromatography_platform())
|
|
312
316
|
|
|
317
|
+
|
|
318
|
+
'''
|
|
313
319
|
@reactive.effect
|
|
314
|
-
@reactive.event(input.
|
|
320
|
+
@reactive.event(input.run_btn_plot_spectra)
|
|
315
321
|
def _():
|
|
316
322
|
if current_page() == "plot_spectra":
|
|
317
323
|
if len(input.spectrum_ID1())==0:
|
|
@@ -326,36 +332,71 @@ def server(input, output, session):
|
|
|
326
332
|
if input.chromatography_platform() == "HRMS":
|
|
327
333
|
try:
|
|
328
334
|
fig = generate_plots_on_HRMS_data(query_data=input.query_data()[0]['datapath'], reference_data=input.reference_data()[0]['datapath'], spectrum_ID1=spectrum_ID1, spectrum_ID2=spectrum_ID2, similarity_measure=input.similarity_measure(), spectrum_preprocessing_order=input.spectrum_preprocessing_order(), high_quality_reference_library=input.high_quality_reference_library(), mz_min=input.mz_min(), mz_max=input.mz_max(), int_min=input.int_min(), int_max=input.int_max(), window_size_centroiding=input.window_size_centroiding(), window_size_matching=input.window_size_matching(), noise_threshold=input.noise_threshold(), wf_mz=input.wf_mz(), wf_intensity=input.wf_int(), LET_threshold=input.LET_threshold(), entropy_dimension=input.entropy_dimension(), y_axis_transformation=input.y_axis_transformation(), return_plot=True)
|
|
329
|
-
plt.show()
|
|
330
|
-
|
|
335
|
+
#plt.show()
|
|
336
|
+
with io.BytesIO() as buf:
|
|
337
|
+
plt.savefig(buf, format="png", dpi=150, bbox_inches="tight")
|
|
338
|
+
yield buf.getvalue()
|
|
339
|
+
run_status_plot_spectra.set(f"✅ Plotting has finished.")
|
|
331
340
|
except Exception as e:
|
|
332
|
-
|
|
341
|
+
run_status_plot_spectra.set(f"❌ Error: {traceback.format_exc()}")
|
|
333
342
|
elif input.chromatography_platform() == "NRMS":
|
|
334
343
|
try:
|
|
335
344
|
generate_plots_on_NRMS_data(query_data=input.query_data()[0]['datapath'], reference_data=input.reference_data()[0]['datapath'], spectrum_ID1=spectrum_ID1, spectrum_ID2=spectrum_ID2, similarity_measure=input.similarity_measure(), spectrum_preprocessing_order=input.spectrum_preprocessing_order(), high_quality_reference_library=input.high_quality_reference_library(), mz_min=input.mz_min(), mz_max=input.mz_max(), int_min=input.int_min(), int_max=input.int_max(), noise_threshold=input.noise_threshold(), wf_mz=input.wf_mz(), wf_intensity=input.wf_int(), LET_threshold=input.LET_threshold(), entropy_dimension=input.entropy_dimension(), y_axis_transformation=input.y_axis_transformation(), return_plot=True)
|
|
336
|
-
plt.show()
|
|
337
|
-
|
|
345
|
+
#plt.show()
|
|
346
|
+
run_status_plot_spectra.set(f"✅ Plotting has finished.")
|
|
338
347
|
except Exception as e:
|
|
339
|
-
|
|
348
|
+
run_status_plot_spectra.set(f"❌ Error: {traceback.format_exc()}")
|
|
349
|
+
|
|
340
350
|
|
|
341
|
-
|
|
351
|
+
@reactive.effect
|
|
352
|
+
@reactive.event(input.run_btn_run_spec_lib_matching)
|
|
353
|
+
def _():
|
|
354
|
+
if current_page() == 'run_spec_lib_matching':
|
|
342
355
|
if input.chromatography_platform() == 'HRMS':
|
|
343
356
|
try:
|
|
344
357
|
run_spec_lib_matching_on_HRMS_data(query_data=input.query_data()[0]['datapath'], reference_data=input.reference_data()[0]['datapath'], likely_reference_ids=None, similarity_measure=input.similarity_measure(), spectrum_preprocessing_order=input.spectrum_preprocessing_order(), high_quality_reference_library=input.high_quality_reference_library(), mz_min=input.mz_min(), mz_max=input.mz_max(), int_min=input.int_min(), int_max=input.int_max(), window_size_centroiding=input.window_size_centroiding(), window_size_matching=input.window_size_matching(), noise_threshold=input.noise_threshold(), wf_mz=input.wf_mz(), wf_intensity=input.wf_int(), LET_threshold=input.LET_threshold(), entropy_dimension=input.entropy_dimension(), n_top_matches_to_save=input.n_top_matches_to_save(), print_id_results=False, output_identification=f'{Path.cwd()}/output_identification.csv', output_similarity_scores=f'{Path.cwd()}/')
|
|
345
|
-
|
|
358
|
+
run_status_spec_lib_matching.set(f"✅ Spectral library matching has finished.")
|
|
346
359
|
except Exception as e:
|
|
347
|
-
|
|
360
|
+
run_status_spec_lib_matching.set(f"❌ Error: {traceback.format_exc()}")
|
|
348
361
|
elif input.chromatography_platform() == 'NRMS':
|
|
349
362
|
try:
|
|
350
363
|
run_spec_lib_matching_on_NRMS_data(query_data=input.query_data()[0]['datapath'], reference_data=input.reference_data()[0]['datapath'], likely_reference_ids=None, similarity_measure=input.similarity_measure(), spectrum_preprocessing_order=input.spectrum_preprocessing_order(), high_quality_reference_library=input.high_quality_reference_library(), mz_min=input.mz_min(), mz_max=input.mz_max(), int_min=input.int_min(), int_max=input.int_max(), noise_threshold=input.noise_threshold(), wf_mz=input.wf_mz(), wf_intensity=input.wf_int(), LET_threshold=input.LET_threshold(), entropy_dimension=input.entropy_dimension(), n_top_matches_to_save=input.n_top_matches_to_save(), print_id_results=False, output_identification=f'{Path.cwd()}/output_identification.csv', output_similarity_scores=f'{Path.cwd()}/output_similarity_scores.csv')
|
|
351
|
-
|
|
364
|
+
run_status_spec_lib_matching.set(f"✅ Spectral library matching has finished.")
|
|
352
365
|
except Exception as e:
|
|
353
|
-
|
|
366
|
+
run_status_spec_lib_matching.set(f"❌ Error: {traceback.format_exc()}")
|
|
367
|
+
'''
|
|
368
|
+
|
|
369
|
+
|
|
370
|
+
@render.download(filename=lambda: f"plot.png")
|
|
371
|
+
def run_btn_plot_spectra():
|
|
372
|
+
spectrum_ID1 = input.spectrum_ID1() or None
|
|
373
|
+
spectrum_ID2 = input.spectrum_ID2() or None
|
|
374
|
+
|
|
375
|
+
if input.chromatography_platform() == "HRMS":
|
|
376
|
+
fig = generate_plots_on_HRMS_data(query_data=input.query_data()[0]['datapath'], reference_data=input.reference_data()[0]['datapath'], spectrum_ID1=spectrum_ID1, spectrum_ID2=spectrum_ID2, similarity_measure=input.similarity_measure(), spectrum_preprocessing_order=input.spectrum_preprocessing_order(), high_quality_reference_library=input.high_quality_reference_library(), mz_min=input.mz_min(), mz_max=input.mz_max(), int_min=input.int_min(), int_max=input.int_max(), window_size_centroiding=input.window_size_centroiding(), window_size_matching=input.window_size_matching(), noise_threshold=input.noise_threshold(), wf_mz=input.wf_mz(), wf_intensity=input.wf_int(), LET_threshold=input.LET_threshold(), entropy_dimension=input.entropy_dimension(), y_axis_transformation=input.y_axis_transformation(), return_plot=True)
|
|
377
|
+
#run_status_plot_spectra.set("✅ Plotting has finished.")
|
|
378
|
+
elif input.chromatography_platform() == "NRMS":
|
|
379
|
+
fig = generate_plots_on_NRMS_data(query_data=input.query_data()[0]['datapath'], reference_data=input.reference_data()[0]['datapath'], spectrum_ID1=spectrum_ID1, spectrum_ID2=spectrum_ID2, similarity_measure=input.similarity_measure(), spectrum_preprocessing_order=input.spectrum_preprocessing_order(), high_quality_reference_library=input.high_quality_reference_library(), mz_min=input.mz_min(), mz_max=input.mz_max(), int_min=input.int_min(), int_max=input.int_max(), noise_threshold=input.noise_threshold(), wf_mz=input.wf_mz(), wf_intensity=input.wf_int(), LET_threshold=input.LET_threshold(), entropy_dimension=input.entropy_dimension(), y_axis_transformation=input.y_axis_transformation(), return_plot=True)
|
|
380
|
+
with io.BytesIO() as buf:
|
|
381
|
+
fig.savefig(buf, format="png", dpi=150, bbox_inches="tight")
|
|
382
|
+
yield buf.getvalue()
|
|
383
|
+
|
|
384
|
+
|
|
385
|
+
@render.download(filename=lambda: f"plot.png")
|
|
386
|
+
def run_btn_spec_lib_matching():
|
|
387
|
+
if input.chromatography_platform() == "HRMS":
|
|
388
|
+
df_out = run_spec_lib_matching_on_HRMS_data(query_data=input.query_data()[0]['datapath'], reference_data=input.reference_data()[0]['datapath'], likely_reference_ids=None, similarity_measure=input.similarity_measure(), spectrum_preprocessing_order=input.spectrum_preprocessing_order(), high_quality_reference_library=input.high_quality_reference_library(), mz_min=input.mz_min(), mz_max=input.mz_max(), int_min=input.int_min(), int_max=input.int_max(), window_size_centroiding=input.window_size_centroiding(), window_size_matching=input.window_size_matching(), noise_threshold=input.noise_threshold(), wf_mz=input.wf_mz(), wf_intensity=input.wf_int(), LET_threshold=input.LET_threshold(), entropy_dimension=input.entropy_dimension(), n_top_matches_to_save=input.n_top_matches_to_save(), print_id_results=False, output_identification=f'{Path.cwd()}/output_identification.csv', output_similarity_scores=f'{Path.cwd()}/', return_ID_output=True)
|
|
389
|
+
elif input.chromatography_platform() == "NRMS":
|
|
390
|
+
df_out = run_spec_lib_matching_on_NRMS_data(query_data=input.query_data()[0]['datapath'], reference_data=input.reference_data()[0]['datapath'], likely_reference_ids=None, similarity_measure=input.similarity_measure(), spectrum_preprocessing_order=input.spectrum_preprocessing_order(), high_quality_reference_library=input.high_quality_reference_library(), mz_min=input.mz_min(), mz_max=input.mz_max(), int_min=input.int_min(), int_max=input.int_max(), noise_threshold=input.noise_threshold(), wf_mz=input.wf_mz(), wf_intensity=input.wf_int(), LET_threshold=input.LET_threshold(), entropy_dimension=input.entropy_dimension(), n_top_matches_to_save=input.n_top_matches_to_save(), print_id_results=False, output_identification=f'{Path.cwd()}/output_identification.csv', output_similarity_scores=f'{Path.cwd()}/output_similarity_scores.csv', return_ID_output=True)
|
|
391
|
+
|
|
392
|
+
df_out.to_csv(io.StringIO(), index=False)
|
|
393
|
+
return buf.getvalue().encode('utf-8')
|
|
354
394
|
|
|
355
395
|
|
|
356
396
|
@render.text
|
|
357
397
|
def status_output():
|
|
358
|
-
return
|
|
398
|
+
return run_status_plot_spectra.get()
|
|
399
|
+
return run_status_spec_lib_matching.get()
|
|
359
400
|
|
|
360
401
|
|
|
361
402
|
|
pycompound/plot_spectra.py
CHANGED
|
@@ -96,8 +96,8 @@ def generate_plots_on_HRMS_data(query_data=None, reference_data=None, spectrum_I
|
|
|
96
96
|
print(f'Error: spectrum_preprocessing_order must contain only \'C\', \'F\', \'M\', \'N\', \'L\', \'W\'.')
|
|
97
97
|
sys.exit()
|
|
98
98
|
|
|
99
|
-
if similarity_measure not in ['cosine','shannon','renyi','tsallis','mixture','jaccard','dice','3w_jaccard','sokal_sneath','binary_cosine','mountford','mcconnaughey','driver_kroeber','simpson','braun_banquet','fager_mcgowan','kulczynski','
|
|
100
|
-
print('\nError: similarity_measure must be either cosine, shannon, renyi, tsallis, mixture, jaccard, dice, 3w_jaccard, sokal_sneath, binary_cosine, mountford, mcconnaughey, driver_kroeber, simpson, braun_banquet, fager_mcgowan, kulczynski,
|
|
99
|
+
if similarity_measure not in ['cosine','shannon','renyi','tsallis','mixture','jaccard','dice','3w_jaccard','sokal_sneath','binary_cosine','mountford','mcconnaughey','driver_kroeber','simpson','braun_banquet','fager_mcgowan','kulczynski','interection','hamming','hellinger']:
|
|
100
|
+
print('\nError: similarity_measure must be either cosine, shannon, renyi, tsallis, mixture, jaccard, dice, 3w_jaccard, sokal_sneath, binary_cosine, mountford, mcconnaughey, driver_kroeber, simpson, braun_banquet, fager_mcgowan, kulczynski, interection, hamming, or hellinger.')
|
|
101
101
|
sys.exit()
|
|
102
102
|
|
|
103
103
|
if isinstance(int_min,int) is True:
|
|
@@ -400,8 +400,8 @@ def generate_plots_on_NRMS_data(query_data=None, reference_data=None, spectrum_I
|
|
|
400
400
|
print(f'Error: spectrum_preprocessing_order must contain only \'F\', \'N\', \'W\', \'L\'.')
|
|
401
401
|
sys.exit()
|
|
402
402
|
|
|
403
|
-
if similarity_measure not in ['cosine','shannon','renyi','tsallis','mixture','jaccard','dice','3w_jaccard','sokal_sneath','binary_cosine','mountford','mcconnaughey','driver_kroeber','simpson','braun_banquet','fager_mcgowan','kulczynski','
|
|
404
|
-
print('\nError: similarity_measure must be either cosine, shannon, renyi, tsallis, mixture, jaccard, dice, 3w_jaccard, sokal_sneath, binary_cosine, mountford, mcconnaughey, driver_kroeber, simpson, braun_banquet, fager_mcgowan, kulczynski,
|
|
403
|
+
if similarity_measure not in ['cosine','shannon','renyi','tsallis','mixture','jaccard','dice','3w_jaccard','sokal_sneath','binary_cosine','mountford','mcconnaughey','driver_kroeber','simpson','braun_banquet','fager_mcgowan','kulczynski','interection','hamming','hellinger']:
|
|
404
|
+
print('\nError: similarity_measure must be either cosine, shannon, renyi, tsallis, mixture, jaccard, dice, 3w_jaccard, sokal_sneath, binary_cosine, mountford, mcconnaughey, driver_kroeber, simpson, braun_banquet, fager_mcgowan, kulczynski, interection, hamming, or hellinger.')
|
|
405
405
|
sys.exit()
|
|
406
406
|
|
|
407
407
|
if isinstance(int_min,int) is True:
|
pycompound/spec_lib_matching.py
CHANGED
|
@@ -389,7 +389,7 @@ def get_acc_NRMS(df_query, df_reference, unique_query_ids, unique_reference_ids,
|
|
|
389
389
|
|
|
390
390
|
|
|
391
391
|
|
|
392
|
-
def run_spec_lib_matching_on_HRMS_data(query_data=None, reference_data=None, likely_reference_ids=None, similarity_measure='cosine', weights={'Cosine':0.25,'Shannon':0.25,'Renyi':0.25,'Tsallis':0.25}, spectrum_preprocessing_order='FCNMWL', high_quality_reference_library=False, mz_min=0, mz_max=9999999, int_min=0, int_max=9999999, window_size_centroiding=0.5, window_size_matching=0.5, noise_threshold=0.0, wf_mz=0.0, wf_intensity=1.0, LET_threshold=0.0, entropy_dimension=1.1, n_top_matches_to_save=1, print_id_results=False, output_identification=None, output_similarity_scores=None):
|
|
392
|
+
def run_spec_lib_matching_on_HRMS_data(query_data=None, reference_data=None, likely_reference_ids=None, similarity_measure='cosine', weights={'Cosine':0.25,'Shannon':0.25,'Renyi':0.25,'Tsallis':0.25}, spectrum_preprocessing_order='FCNMWL', high_quality_reference_library=False, mz_min=0, mz_max=9999999, int_min=0, int_max=9999999, window_size_centroiding=0.5, window_size_matching=0.5, noise_threshold=0.0, wf_mz=0.0, wf_intensity=1.0, LET_threshold=0.0, entropy_dimension=1.1, n_top_matches_to_save=1, print_id_results=False, output_identification=None, output_similarity_scores=None, return_ID_output=False):
|
|
393
393
|
'''
|
|
394
394
|
runs spectral library matching on high-resolution mass spectrometry (HRMS) data
|
|
395
395
|
|
|
@@ -636,22 +636,26 @@ def run_spec_lib_matching_on_HRMS_data(query_data=None, reference_data=None, lik
|
|
|
636
636
|
df_top_ref_specs.index = unique_query_ids
|
|
637
637
|
df_top_ref_specs.index.names = ['Query Spectrum ID']
|
|
638
638
|
|
|
639
|
+
df_scores.columns = ['Reference Spectrum ID: ' + col for col in list(map(str,df_scores.columns.tolist()))]
|
|
640
|
+
|
|
639
641
|
# print the identification results if the user desires
|
|
640
642
|
if print_id_results == True:
|
|
641
643
|
print(df_top_ref_specs.to_string())
|
|
642
644
|
|
|
643
|
-
|
|
644
|
-
|
|
645
|
+
if return_ID_output is False:
|
|
646
|
+
# write spectral library matching results to disk
|
|
647
|
+
df_top_ref_specs.to_csv(output_identification)
|
|
645
648
|
|
|
646
|
-
|
|
647
|
-
|
|
648
|
-
|
|
649
|
+
# write all similarity scores to disk
|
|
650
|
+
df_scores.to_csv(output_similarity_scores)
|
|
651
|
+
else:
|
|
652
|
+
return df_top_ref_specs
|
|
649
653
|
|
|
650
654
|
|
|
651
655
|
|
|
652
656
|
|
|
653
657
|
|
|
654
|
-
def run_spec_lib_matching_on_NRMS_data(query_data=None, reference_data=None, likely_reference_ids=None, spectrum_preprocessing_order='FNLW', similarity_measure='cosine', weights={'Cosine':0.25,'Shannon':0.25,'Renyi':0.25,'Tsallis':0.25}, high_quality_reference_library=False, mz_min=0, mz_max=9999999, int_min=0, int_max=9999999, noise_threshold=0.0, wf_mz=0.0, wf_intensity=1.0, LET_threshold=0.0, entropy_dimension=1.1, n_top_matches_to_save=1, print_id_results=False, output_identification=None, output_similarity_scores=None):
|
|
658
|
+
def run_spec_lib_matching_on_NRMS_data(query_data=None, reference_data=None, likely_reference_ids=None, spectrum_preprocessing_order='FNLW', similarity_measure='cosine', weights={'Cosine':0.25,'Shannon':0.25,'Renyi':0.25,'Tsallis':0.25}, high_quality_reference_library=False, mz_min=0, mz_max=9999999, int_min=0, int_max=9999999, noise_threshold=0.0, wf_mz=0.0, wf_intensity=1.0, LET_threshold=0.0, entropy_dimension=1.1, n_top_matches_to_save=1, print_id_results=False, output_identification=None, output_similarity_scores=None, return_ID_output=False):
|
|
655
659
|
'''
|
|
656
660
|
runs spectral library matching on nominal-resolution mass spectrometry (NRMS) data
|
|
657
661
|
|
|
@@ -886,11 +890,15 @@ def run_spec_lib_matching_on_NRMS_data(query_data=None, reference_data=None, lik
|
|
|
886
890
|
if print_id_results == True:
|
|
887
891
|
print(df_top_ref_specs.to_string())
|
|
888
892
|
|
|
889
|
-
# write spectral library matching results to disk
|
|
890
|
-
df_top_ref_specs.to_csv(output_identification)
|
|
891
|
-
|
|
892
|
-
# write all similarity scores to disk
|
|
893
893
|
df_scores.columns = ['Reference Spectrum ID: ' + col for col in list(map(str,df_scores.columns.tolist()))]
|
|
894
|
-
df_scores.to_csv(output_similarity_scores)
|
|
895
894
|
|
|
895
|
+
if return_ID_output is False:
|
|
896
|
+
# write spectral library matching results to disk
|
|
897
|
+
df_top_ref_specs.to_csv(output_identification)
|
|
898
|
+
|
|
899
|
+
# write all similarity scores to disk
|
|
900
|
+
df_scores.columns = ['Reference Spectrum ID: ' + col for col in list(map(str,df_scores.columns.tolist()))]
|
|
901
|
+
df_scores.to_csv(output_similarity_scores)
|
|
902
|
+
else:
|
|
903
|
+
return df_top_ref_specs
|
|
896
904
|
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: pycompound
|
|
3
|
-
Version: 0.0.
|
|
3
|
+
Version: 0.0.9
|
|
4
4
|
Summary: Python package to perform compound identification in mass spectrometry via spectral library matching.
|
|
5
5
|
Author-email: Hunter Dlugas <fy7392@wayne.edu>
|
|
6
6
|
License-Expression: MIT
|
|
@@ -19,10 +19,9 @@ Requires-Dist: pyteomics==4.7.2
|
|
|
19
19
|
Requires-Dist: netCDF4==1.6.5
|
|
20
20
|
Requires-Dist: lxml>=5.1.0
|
|
21
21
|
Requires-Dist: orjson==3.11.0
|
|
22
|
+
Requires-Dist: shiny==1.4.0
|
|
22
23
|
Requires-Dist: joblib==1.5.2
|
|
23
24
|
Dynamic: license-file
|
|
24
25
|
|
|
25
26
|
# PyCompound
|
|
26
|
-
|
|
27
27
|
A Python-based tool for spectral library matching, PyCompound is available as a Python package with a command-line interface (CLI) available and as a GUI application build with Python/Shiny. It performs spectral library matching to identify chemical compounds, offering a range of spectrum preprocessing transformations and similarity measures, including Cosine, three entropy-based similarity measures, and a plethora of binary similarity measures. PyCompound also includes functionality to tune parameters commonly used in a compound identification workflow given a query library of spectra with known ID. PyCompound supports both high-resolution mass spectrometry (HRMS) data (e.g., LC-MS/MS) and nominal-resolution mass spectrometry (NRMS) data (e.g., GC-MS). For the full documentation, see the GitHub repository https://github.com/hdlugas/pycompound.
|
|
28
|
-
|
|
@@ -1,14 +1,14 @@
|
|
|
1
|
-
app.py,sha256=
|
|
1
|
+
app.py,sha256=eJmAAdCDWS7-3jjCkp8gueBtBkefh8oIbyr45Snh8C0,26187
|
|
2
2
|
pycompound/build_library.py,sha256=8ghpX8wfj6u-3V5X2IdJ-e8G_FRSla1lO0pzLj7hOtI,5373
|
|
3
|
-
pycompound/plot_spectra.py,sha256=
|
|
3
|
+
pycompound/plot_spectra.py,sha256=wOnf2oOAfifj7FYkTZAcIeD7dHW1aRHzmsspPpySDcY,42023
|
|
4
4
|
pycompound/plot_spectra_CLI.py,sha256=ObaLad5Z5DmfQB-j0HSCg1mLORbYj2BM3hb5Yd0ZdDI,8395
|
|
5
5
|
pycompound/processing.py,sha256=vqtKaZ6vot6wlnKNTYUQFX7ccPpnCAl0L6bN289vZoM,11068
|
|
6
6
|
pycompound/similarity_measures.py,sha256=TuvtEXWwyxE6dfpmuAqRC6gOHvHg3Jf21099pVaNBAs,10702
|
|
7
|
-
pycompound/spec_lib_matching.py,sha256=
|
|
7
|
+
pycompound/spec_lib_matching.py,sha256=p8gj-72fjkf0p7XrqEl9hnYUGNSbyr7BXugvRT7Y5OA,60311
|
|
8
8
|
pycompound/spec_lib_matching_CLI.py,sha256=EdXM0dRQfwGQAK4OKxhcVytuUnX9pRyJROwC6rloZ9s,9915
|
|
9
9
|
pycompound/tuning_CLI.py,sha256=lkFBRZ5VxCBteIh_KTkQFdUBVZA0dL-BLiyMZce1vzE,8539
|
|
10
|
-
pycompound-0.0.
|
|
11
|
-
pycompound-0.0.
|
|
12
|
-
pycompound-0.0.
|
|
13
|
-
pycompound-0.0.
|
|
14
|
-
pycompound-0.0.
|
|
10
|
+
pycompound-0.0.9.dist-info/licenses/LICENSE,sha256=fPFFlkSGg60VQWyWqTSv8yoJnpLzppzdihVWY5NKom8,1064
|
|
11
|
+
pycompound-0.0.9.dist-info/METADATA,sha256=--hu6G380jnsb6J7XvGFiwXJ_lZ6of0stydeLWYjp6U,1732
|
|
12
|
+
pycompound-0.0.9.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
|
|
13
|
+
pycompound-0.0.9.dist-info/top_level.txt,sha256=wFBLVrqpC07HghIU8tsEdgdvgkdOE3GN_1Gfjk-uEUc,15
|
|
14
|
+
pycompound-0.0.9.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|
|
File without changes
|