pycompound 0.0.6__py3-none-any.whl → 0.0.7__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.
- pycompound/plot_spectra_CLI.py +2 -2
- pycompound/processing.py +1 -1
- pycompound/spec_lib_matching.py +1 -1
- pycompound/spec_lib_matching_CLI.py +2 -2
- pycompound/tuning_CLI.py +2 -2
- {pycompound-0.0.6.dist-info → pycompound-0.0.7.dist-info}/METADATA +1 -1
- pycompound-0.0.7.dist-info/RECORD +14 -0
- pycompound/pycompound_shiny.py +0 -299
- pycompound-0.0.6.dist-info/RECORD +0 -15
- {pycompound-0.0.6.dist-info → pycompound-0.0.7.dist-info}/WHEEL +0 -0
- {pycompound-0.0.6.dist-info → pycompound-0.0.7.dist-info}/licenses/LICENSE +0 -0
- {pycompound-0.0.6.dist-info → pycompound-0.0.7.dist-info}/top_level.txt +0 -0
pycompound/plot_spectra_CLI.py
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
|
|
2
|
-
from
|
|
3
|
-
from
|
|
2
|
+
from pycompound.plot_spectra import generate_plots_on_HRMS_data
|
|
3
|
+
from pycompound.plot_spectra import generate_plots_on_NRMS_data
|
|
4
4
|
import pandas as pd
|
|
5
5
|
import argparse
|
|
6
6
|
import json
|
pycompound/processing.py
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
|
|
2
2
|
# This script contains the functions used to transform spectra prior to computing similarity scores
|
|
3
3
|
|
|
4
|
-
from
|
|
4
|
+
from pycompound.build_library import build_library_from_raw_data
|
|
5
5
|
import scipy.stats
|
|
6
6
|
import numpy as np
|
|
7
7
|
import pandas as pd
|
pycompound/spec_lib_matching.py
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
|
|
2
2
|
# this script's function runs spectral library matching to identify unknown query compound(s)
|
|
3
3
|
|
|
4
|
-
from
|
|
4
|
+
from pycompound.build_library import build_library_from_raw_data
|
|
5
5
|
from .processing import *
|
|
6
6
|
from .similarity_measures import *
|
|
7
7
|
import pandas as pd
|
|
@@ -2,8 +2,8 @@
|
|
|
2
2
|
# this script performs spectral library matching to identify unknown query compound(s) from GC-MS data
|
|
3
3
|
|
|
4
4
|
# load libraries
|
|
5
|
-
from
|
|
6
|
-
from
|
|
5
|
+
from pycompound.spec_lib_matching import run_spec_lib_matching_on_HRMS_data
|
|
6
|
+
from pycompound.spec_lib_matching import run_spec_lib_matching_on_NRMS_data
|
|
7
7
|
from pathlib import Path
|
|
8
8
|
import pandas as pd
|
|
9
9
|
import argparse
|
pycompound/tuning_CLI.py
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
|
|
2
|
-
from
|
|
3
|
-
from
|
|
2
|
+
from pycompound.spec_lib_matching import tune_params_on_HRMS_data
|
|
3
|
+
from pycompound.spec_lib_matching import tune_params_on_NRMS_data
|
|
4
4
|
import argparse
|
|
5
5
|
import json
|
|
6
6
|
from pathlib import Path
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
app.py,sha256=PKiCJe_18EJIHvs0R7pl_Yf-XakZn5J0AAfI-AnGsX0,21535
|
|
2
|
+
pycompound/build_library.py,sha256=8ghpX8wfj6u-3V5X2IdJ-e8G_FRSla1lO0pzLj7hOtI,5373
|
|
3
|
+
pycompound/plot_spectra.py,sha256=wOnf2oOAfifj7FYkTZAcIeD7dHW1aRHzmsspPpySDcY,42023
|
|
4
|
+
pycompound/plot_spectra_CLI.py,sha256=ObaLad5Z5DmfQB-j0HSCg1mLORbYj2BM3hb5Yd0ZdDI,8395
|
|
5
|
+
pycompound/processing.py,sha256=vqtKaZ6vot6wlnKNTYUQFX7ccPpnCAl0L6bN289vZoM,11068
|
|
6
|
+
pycompound/similarity_measures.py,sha256=TuvtEXWwyxE6dfpmuAqRC6gOHvHg3Jf21099pVaNBAs,10702
|
|
7
|
+
pycompound/spec_lib_matching.py,sha256=pfDPmH1aQ11_25T80U9i0OUbgjCvvkzNEcDeBrDWNtA,59962
|
|
8
|
+
pycompound/spec_lib_matching_CLI.py,sha256=EdXM0dRQfwGQAK4OKxhcVytuUnX9pRyJROwC6rloZ9s,9915
|
|
9
|
+
pycompound/tuning_CLI.py,sha256=lkFBRZ5VxCBteIh_KTkQFdUBVZA0dL-BLiyMZce1vzE,8539
|
|
10
|
+
pycompound-0.0.7.dist-info/licenses/LICENSE,sha256=fPFFlkSGg60VQWyWqTSv8yoJnpLzppzdihVWY5NKom8,1064
|
|
11
|
+
pycompound-0.0.7.dist-info/METADATA,sha256=naSYyQcQRUvWSHkmi0lg9ETBOb3sch3oKfVLQSvkwAc,1704
|
|
12
|
+
pycompound-0.0.7.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
|
|
13
|
+
pycompound-0.0.7.dist-info/top_level.txt,sha256=wFBLVrqpC07HghIU8tsEdgdvgkdOE3GN_1Gfjk-uEUc,15
|
|
14
|
+
pycompound-0.0.7.dist-info/RECORD,,
|
pycompound/pycompound_shiny.py
DELETED
|
@@ -1,299 +0,0 @@
|
|
|
1
|
-
|
|
2
|
-
from shiny import App, ui, render, reactive
|
|
3
|
-
from pycompound_fy7392.spec_lib_matching import run_spec_lib_matching_on_HRMS_data
|
|
4
|
-
from pycompound_fy7392.spec_lib_matching import run_spec_lib_matching_on_NRMS_data
|
|
5
|
-
from pycompound_fy7392.plot_spectra import generate_plots_on_HRMS_data
|
|
6
|
-
from pycompound_fy7392.plot_spectra import generate_plots_on_NRMS_data
|
|
7
|
-
from pycompound_fy7392.spec_lib_matching import tune_params_on_HRMS_data
|
|
8
|
-
from pycompound_fy7392.spec_lib_matching import tune_params_on_NRMS_data
|
|
9
|
-
import subprocess
|
|
10
|
-
import traceback
|
|
11
|
-
from pathlib import Path
|
|
12
|
-
import pandas as pd
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
def split_or_wrap(s):
|
|
16
|
-
s = str(s)
|
|
17
|
-
def parse(x):
|
|
18
|
-
x = x.strip()
|
|
19
|
-
if x.lower() == 'true':
|
|
20
|
-
return True
|
|
21
|
-
elif x.lower() == 'false':
|
|
22
|
-
return False
|
|
23
|
-
try:
|
|
24
|
-
return int(x)
|
|
25
|
-
except ValueError:
|
|
26
|
-
try:
|
|
27
|
-
return float(x)
|
|
28
|
-
except ValueError:
|
|
29
|
-
return x
|
|
30
|
-
|
|
31
|
-
if ',' not in s:
|
|
32
|
-
return [parse(s)]
|
|
33
|
-
else:
|
|
34
|
-
return [parse(item) for item in s.split(',')]
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
def custom_on_off_to_bool(lst):
|
|
38
|
-
if lst == ['no']:
|
|
39
|
-
return [False]
|
|
40
|
-
elif lst == ['yes']:
|
|
41
|
-
return [True]
|
|
42
|
-
elif lst == ['no','yes']:
|
|
43
|
-
return [False,True]
|
|
44
|
-
elif lst == ['yes','no']:
|
|
45
|
-
return [False,True]
|
|
46
|
-
elif not lst:
|
|
47
|
-
return [False]
|
|
48
|
-
else:
|
|
49
|
-
raise ValueError(f"Unhandled input: {lst}")
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
app_ui = ui.page_fluid(
|
|
54
|
-
ui.div(
|
|
55
|
-
ui.input_select("choice", "Choose an option:", ["Run spectral library matching to identify unknown compounds", "Tune parameters with a query library with known compound IDs", "Plot two spectra"]),
|
|
56
|
-
ui.input_radio_buttons("chromatography_platform", "Choose chromatography platform:", ["HRMS","NRMS"]),
|
|
57
|
-
style="width: 2000px; max-width: none;"),
|
|
58
|
-
ui.output_ui("dynamic_inputs"),
|
|
59
|
-
ui.output_text("status_output")
|
|
60
|
-
)
|
|
61
|
-
|
|
62
|
-
def server(input, output, session):
|
|
63
|
-
run_status = reactive.Value("Waiting for input...")
|
|
64
|
-
|
|
65
|
-
@output
|
|
66
|
-
@render.ui
|
|
67
|
-
def dynamic_inputs():
|
|
68
|
-
if input.choice() == "Run spectral library matching to identify unknown compounds":
|
|
69
|
-
if input.chromatography_platform() == "HRMS":
|
|
70
|
-
return ui.TagList(
|
|
71
|
-
ui.input_file("query_data", "Upload query dataset (mgf, mzML, cdf, msp, or csv):"),
|
|
72
|
-
ui.input_file("reference_data", "Upload reference dataset (mgf, mzML, cdf, msp, or csv):"),
|
|
73
|
-
ui.input_select("similarity_measure", "Select similarity measure:", ["cosine", "shannon", "renyi", "tsallis"]),
|
|
74
|
-
ui.input_select("high_quality_reference_library", "Indicate whether the reference library is considered to be of high quality. If true, then the spectrum preprocessing transformations of filtering and noise removal are performed only on the query spectrum/spectra.", [False,True]),
|
|
75
|
-
ui.input_text("spectrum_preprocessing_order", "Input a sequence of characters denoting the order in which spectrum preprocessing transformations should be applied. Available characters/transformations are C (centroiding), F (filtering), M (matching), N (noise removal), L (low-entropy transformation), and W (weight factor transformation. M must be in sequence, and if C is performed, then C must be performed before M.", "FCNMWL"),
|
|
76
|
-
ui.input_numeric("mz_min", "Enter numeric value for minimum mass/charge ratio for filtering:", 0),
|
|
77
|
-
ui.input_numeric("mz_max", "Enter numeric value for minimum mass/charge ratio for filtering:", 99999999),
|
|
78
|
-
ui.input_numeric("int_min", "Enter numeric value for minimum intensity for filtering:", 0),
|
|
79
|
-
ui.input_numeric("int_max", "Enter numeric value for maximum intensity for filtering:", 999999999),
|
|
80
|
-
ui.input_numeric("window_size_centroiding", "Enter numeric value for the centroiding window-size:", 0.5),
|
|
81
|
-
ui.input_numeric("window_size_matching", "Enter numeric value for the matching window-size:", 0.5),
|
|
82
|
-
ui.input_numeric("noise_threshold", "Enter numeric value for the noise removal threshold:", 0.0),
|
|
83
|
-
ui.input_numeric("wf_mz", "Enter numeric value for the mass/charge weight factor:", 0.0),
|
|
84
|
-
ui.input_numeric("wf_int", "Enter numeric value for the intensity weight factor:", 1.0),
|
|
85
|
-
ui.input_numeric("LET_threshold", "Enter non-negative numeric value for the low-entropy threshold:", 0.0),
|
|
86
|
-
ui.input_numeric("entropy_dimension", "Enter non-negative, non-unity numeric value for the entropy dimension (only applicable to Renyi and Tsallis):", 1.1),
|
|
87
|
-
ui.input_numeric("n_top_matches_to_save", "Enter positive integer for the number of top matches to save:", 1),
|
|
88
|
-
ui.input_text("output_identification", "Path to identification output:", f'{Path.cwd()}/output_identification.csv'),
|
|
89
|
-
ui.input_text("output_similarity_scores", "Path to output file of similarity scores:", f'{Path.cwd()}/output_similarity_scores.csv'),
|
|
90
|
-
ui.input_action_button("run_btn", "Run"))
|
|
91
|
-
else:
|
|
92
|
-
return ui.TagList(
|
|
93
|
-
ui.input_file("query_data", "Upload query dataset (mgf, mzML, cdf, msp, or csv):"),
|
|
94
|
-
ui.input_file("reference_data", "Upload reference dataset (mgf, mzML, cdf, msp, or csv):"),
|
|
95
|
-
ui.input_select("similarity_measure", "Select similarity measure:", ["cosine", "shannon", "renyi", "tsallis"]),
|
|
96
|
-
ui.input_select("high_quality_reference_library", "Indicate whether the reference library is considered to be of high quality. If true, then the spectrum preprocessing transformations of filtering and noise removal are performed only on the query spectrum/spectra.", [False,True]),
|
|
97
|
-
ui.input_text("spectrum_preprocessing_order", "Input a sequence of characters denoting the order in which spectrum preprocessing transformations should be applied. Available characters/transformations are F (filtering), N (noise removal), L (low-entropy transformation), and W (weight factor transformation).", "FNLW"),
|
|
98
|
-
ui.input_numeric("mz_min", "Enter numeric value for minimum mass/charge ratio for filtering:", 0),
|
|
99
|
-
ui.input_numeric("mz_max", "Enter numeric value for minimum mass/charge ratio for filtering:", 99999999),
|
|
100
|
-
ui.input_numeric("int_min", "Enter numeric value for minimum intensity for filtering:", 0),
|
|
101
|
-
ui.input_numeric("int_max", "Enter numeric value for maximum intensity for filtering:", 999999999),
|
|
102
|
-
ui.input_numeric("noise_threshold", "Enter numeric value for the noise removal threshold:", 0.0),
|
|
103
|
-
ui.input_numeric("wf_mz", "Enter numeric value for the mass/charge weight factor:", 0.0),
|
|
104
|
-
ui.input_numeric("wf_int", "Enter numeric value for the intensity weight factor:", 1.0),
|
|
105
|
-
ui.input_numeric("LET_threshold", "Enter non-negative numeric value for the low-entropy threshold:", 0.0),
|
|
106
|
-
ui.input_numeric("entropy_dimension", "Enter non-negative, non-unity numeric value for the entropy dimension (only applicable to Renyi and Tsallis):", 1.1),
|
|
107
|
-
ui.input_numeric("n_top_matches_to_save", "Enter positive integer for the number of top matches to save:", 1),
|
|
108
|
-
ui.input_text("output_identification", "Path to identification output:", f'{Path.cwd()}/output_identification.csv'),
|
|
109
|
-
ui.input_text("output_similarity_scores", "Path to output file of similarity scores:", f'{Path.cwd()}/output_similarity_scores.csv'),
|
|
110
|
-
ui.input_action_button("run_btn", "Run"))
|
|
111
|
-
|
|
112
|
-
elif input.choice() == "Tune parameters with a query library with known compound IDs":
|
|
113
|
-
if input.chromatography_platform() == "HRMS":
|
|
114
|
-
return ui.TagList(
|
|
115
|
-
ui.input_file("query_data", "Upload query dataset (mgf, mzML, cdf, msp, or csv):"),
|
|
116
|
-
ui.input_file("reference_data", "Upload reference dataset (mgf, mzML, cdf, msp, or csv):"),
|
|
117
|
-
ui.input_checkbox_group("similarity_measure", "Select similarity measure(s):", ["cosine", "shannon", "renyi", "tsallis"]),
|
|
118
|
-
ui.input_checkbox_group("high_quality_reference_library", "Indicate whether the reference library is considered to be of high quality. If True, then the spectrum preprocessing transformations of filtering and noise removal are performed only on the query spectrum/spectra.", ["no","yes"]),
|
|
119
|
-
ui.input_text("spectrum_preprocessing_order", "Input a sequence of characters denoting the order in which spectrum preprocessing transformations should be applied. Available characters/transformations are C (centroiding), F (filtering), M (matching), N (noise removal), L (low-entropy transformation), and W (weight factor transformation. M must be in sequence, and if C is performed, then C must be performed before M. If multiple spectrum preprocessing orders are to be tried, separate by comma.", "FCNMWL"),
|
|
120
|
-
ui.input_text("mz_min", "Enter numeric value(s) for minimum mass/charge ratio for filtering. Separate multiple entries with comma.", 0),
|
|
121
|
-
ui.input_text("mz_max", "Enter numeric value(s) for minimum mass/charge ratio for filtering. Separate multiple entries with comma.", 99999999),
|
|
122
|
-
ui.input_text("int_min", "Enter numeric value(s) for minimum intensity for filtering. Separate multiple entries with comma.", 0),
|
|
123
|
-
ui.input_text("int_max", "Enter numeric value(s) for maximum intensity for filtering. Separate multiple entries with comma.", 999999999),
|
|
124
|
-
ui.input_text("window_size_centroiding", "Enter numeric value(s) for the centroiding window-size. Separate multiple entries with comma.", 0.5),
|
|
125
|
-
ui.input_text("window_size_matching", "Enter numeric value(s) for the matching window-size. Separate multiple entries with comma.", 0.5),
|
|
126
|
-
ui.input_text("noise_threshold", "Enter numeric value(s) for the noise removal threshold. Separate multiple entries with comma.", 0.0),
|
|
127
|
-
ui.input_text("wf_mz", "Enter numeric value(s) for the mass/charge weight factor. Separate multiple entries with comma.", 0.0),
|
|
128
|
-
ui.input_text("wf_int", "Enter numeric value(s) for the intensity weight factor. Separate multiple entries with comma.", 1.0),
|
|
129
|
-
ui.input_text("LET_threshold", "Enter non-negative numeric value(s) for the low-entropy threshold. Separate multiple entries with comma.", 0.0),
|
|
130
|
-
ui.input_text("entropy_dimension", "Enter non-negative, non-unity numeric value(s) for the entropy dimension (only applicable to Renyi and Tsallis). Separate multiple entries with comma.", 1.1),
|
|
131
|
-
ui.input_text("output_path", "Path to parameter tuning output:", f'{Path.cwd()}/output_parameter_tuning.csv'),
|
|
132
|
-
ui.input_action_button("run_btn", "Run"))
|
|
133
|
-
else:
|
|
134
|
-
return ui.TagList(
|
|
135
|
-
ui.input_file("query_data", "Upload query dataset (mgf, mzML, cdf, msp, or csv):"),
|
|
136
|
-
ui.input_file("reference_data", "Upload reference dataset (mgf, mzML, cdf, msp, or csv):"),
|
|
137
|
-
ui.input_checkbox_group("similarity_measure", "Select similarity measure(s):", ["cosine", "shannon", "renyi", "tsallis"]),
|
|
138
|
-
ui.input_checkbox_group("high_quality_reference_library", "Indicate whether the reference library is considered to be of high quality. If True, then the spectrum preprocessing transformations of filtering and noise removal are performed only on the query spectrum/spectra.", ["no","yes"]),
|
|
139
|
-
ui.input_text("spectrum_preprocessing_order", "Input a sequence of characters denoting the order in which spectrum preprocessing transformations should be applied. Available characters/transformations are F (filtering), N (noise removal), L (low-entropy transformation), and W (weight factor transformation).", "FNLW"),
|
|
140
|
-
ui.input_text("mz_min", "Enter numeric value(s) for minimum mass/charge ratio for filtering. Separate multiple entries with comma.", 0),
|
|
141
|
-
ui.input_text("mz_max", "Enter numeric value(s) for minimum mass/charge ratio for filtering. Separate multiple entries with comma.", 99999999),
|
|
142
|
-
ui.input_text("int_min", "Enter numeric value(s) for minimum intensity for filtering. Separate multiple entries with comma.", 0),
|
|
143
|
-
ui.input_text("int_max", "Enter numeric value(s) for maximum intensity for filtering. Separate multiple entries with comma.", 999999999),
|
|
144
|
-
ui.input_text("noise_threshold", "Enter numeric value(s) for the noise removal threshold. Separate multiple entries with comma.", 0.0),
|
|
145
|
-
ui.input_text("wf_mz", "Enter numeric value(s) for the mass/charge weight factor. Separate multiple entries with comma.", 0.0),
|
|
146
|
-
ui.input_text("wf_int", "Enter numeric value(s) for the intensity weight factor. Separate multiple entries with comma.", 1.0),
|
|
147
|
-
ui.input_text("LET_threshold", "Enter non-negative numeric value(s) for the low-entropy threshold. Separate multiple entries with comma.", 0.0),
|
|
148
|
-
ui.input_text("entropy_dimension", "Enter non-negative, non-unity numeric value(s) for the entropy dimension (only applicable to Renyi and Tsallis). Separate multiple entries with comma.", 1.1),
|
|
149
|
-
ui.input_text("output_path", "Path to parameter tuning output:", f'{Path.cwd()}/output_parameter_tuning.csv'),
|
|
150
|
-
ui.input_action_button("run_btn", "Run"))
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
elif input.choice() == "Plot two spectra":
|
|
154
|
-
if input.chromatography_platform() == "HRMS":
|
|
155
|
-
return ui.TagList(
|
|
156
|
-
ui.input_file("query_data", "Upload query dataset (mgf, mzML, cdf, msp, or csv):"),
|
|
157
|
-
ui.input_file("reference_data", "Upload reference dataset (mgf, mzML, cdf, msp, or csv):"),
|
|
158
|
-
ui.input_text("spectrum_ID1", "Input ID of one spectrum to be plotted:", None),
|
|
159
|
-
ui.input_text("spectrum_ID2", "Input ID of another spectrum to be plotted:", None),
|
|
160
|
-
ui.input_select("similarity_measure", "Select similarity measure:", ["cosine", "shannon", "renyi", "tsallis"]),
|
|
161
|
-
ui.input_select("high_quality_reference_library", "Indicate whether the reference library is considered to be of high quality. If True, then the spectrum preprocessing transformations of filtering and noise removal are performed only on the query spectrum/spectra.", [False,True]),
|
|
162
|
-
ui.input_text("spectrum_preprocessing_order", "Input a sequence of characters denoting the order in which spectrum preprocessing transformations should be applied. Available characters/transformations are C (centroiding), F (filtering), M (matching), N (noise removal), L (low-entropy transformation), and W (weight factor transformation. M must be in sequence, and if C is performed, then C must be performed before M. If multiple spectrum preprocessing orders are to be tried, separate by comma.", "FCNMWL"),
|
|
163
|
-
ui.input_numeric("mz_min", "Enter numeric value for minimum mass/charge ratio for filtering. Separate multiple entries with comma.", 0),
|
|
164
|
-
ui.input_numeric("mz_max", "Enter numeric value for minimum mass/charge ratio for filtering. Separate multiple entries with comma.", 99999999),
|
|
165
|
-
ui.input_numeric("int_min", "Enter numeric value for minimum intensity for filtering. Separate multiple entries with comma.", 0),
|
|
166
|
-
ui.input_numeric("int_max", "Enter numeric value for maximum intensity for filtering. Separate multiple entries with comma.", 999999999),
|
|
167
|
-
ui.input_numeric("window_size_centroiding", "Enter numeric value for the centroiding window-size. Separate multiple entries with comma.", 0.5),
|
|
168
|
-
ui.input_numeric("window_size_matching", "Enter numeric value for the matching window-size. Separate multiple entries with comma.", 0.5),
|
|
169
|
-
ui.input_numeric("noise_threshold", "Enter numeric value for the noise removal threshold. Separate multiple entries with comma.", 0.0),
|
|
170
|
-
ui.input_numeric("wf_mz", "Enter numeric value for the mass/charge weight factor. Separate multiple entries with comma.", 0.0),
|
|
171
|
-
ui.input_numeric("wf_int", "Enter numeric value for the intensity weight factor. Separate multiple entries with comma.", 1.0),
|
|
172
|
-
ui.input_numeric("LET_threshold", "Enter non-negative numeric value for the low-entropy threshold. Separate multiple entries with comma.", 0.0),
|
|
173
|
-
ui.input_numeric("entropy_dimension", "Enter non-negative, non-unity numeric value for the entropy dimension (only applicable to Renyi and Tsallis). Separate multiple entries with comma.", 1.1),
|
|
174
|
-
ui.input_select("y_axis_transformation", "Select the transformation to apply to the intensity axis of the generated plots:", ["normalized", "none", "log10", "sqrt"]),
|
|
175
|
-
ui.input_text("output_path", "Path to parameter tuning output:", f'{Path.cwd()}/output_plots.pdf'),
|
|
176
|
-
ui.input_action_button("run_btn", "Run"))
|
|
177
|
-
else:
|
|
178
|
-
return ui.TagList(
|
|
179
|
-
ui.input_file("query_data", "Upload query dataset (mgf, mzML, cdf, msp, or csv):"),
|
|
180
|
-
ui.input_file("reference_data", "Upload reference dataset (mgf, mzML, cdf, msp, or csv):"),
|
|
181
|
-
ui.input_text("spectrum_ID1", "Input ID of one spectrum to be plotted:", None),
|
|
182
|
-
ui.input_text("spectrum_ID2", "Input ID of another spectrum to be plotted:", None),
|
|
183
|
-
ui.input_select("similarity_measure", "Select similarity measure:", ["cosine", "shannon", "renyi", "tsallis"]),
|
|
184
|
-
ui.input_select("high_quality_reference_library", "Indicate whether the reference library is considered to be of high quality. If True, then the spectrum preprocessing transformations of filtering and noise removal are performed only on the query spectrum/spectra.", [False,True]),
|
|
185
|
-
ui.input_text("spectrum_preprocessing_order", "Input a sequence of characters denoting the order in which spectrum preprocessing transformations should be applied. Available characters/transformations are F (filtering), N (noise removal), L (low-entropy transformation), and W (weight factor transformation).", "FNLW"),
|
|
186
|
-
ui.input_numeric("mz_min", "Enter numeric value for minimum mass/charge ratio for filtering. Separate multiple entries with comma.", 0),
|
|
187
|
-
ui.input_numeric("mz_max", "Enter numeric value for minimum mass/charge ratio for filtering. Separate multiple entries with comma.", 99999999),
|
|
188
|
-
ui.input_numeric("int_min", "Enter numeric value for minimum intensity for filtering. Separate multiple entries with comma.", 0),
|
|
189
|
-
ui.input_numeric("int_max", "Enter numeric value for maximum intensity for filtering. Separate multiple entries with comma.", 999999999),
|
|
190
|
-
ui.input_numeric("noise_threshold", "Enter numeric value for the noise removal threshold. Separate multiple entries with comma.", 0.0),
|
|
191
|
-
ui.input_numeric("wf_mz", "Enter numeric value for the mass/charge weight factor. Separate multiple entries with comma.", 0.0),
|
|
192
|
-
ui.input_numeric("wf_int", "Enter numeric value for the intensity weight factor. Separate multiple entries with comma.", 1.0),
|
|
193
|
-
ui.input_numeric("LET_threshold", "Enter non-negative numeric value for the low-entropy threshold. Separate multiple entries with comma.", 0.0),
|
|
194
|
-
ui.input_numeric("entropy_dimension", "Enter non-negative, non-unity numeric value for the entropy dimension (only applicable to Renyi and Tsallis). Separate multiple entries with comma.", 1.1),
|
|
195
|
-
ui.input_select("y_axis_transformation", "Select the transformation to apply to the intensity axis of the generated plots:", ["normalized", "none", "log10", "sqrt"]),
|
|
196
|
-
ui.input_text("output_path", "Path to parameter tuning output:", f'{Path.cwd()}/output_plot.pdf'),
|
|
197
|
-
ui.input_action_button("run_btn", "Run"))
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
@reactive.effect
|
|
201
|
-
@reactive.event(input.run_btn)
|
|
202
|
-
def _():
|
|
203
|
-
choice = input.choice()
|
|
204
|
-
|
|
205
|
-
if choice == "Run spectral library matching to identify unknown compounds":
|
|
206
|
-
if input.chromatography_platform() == "HRMS":
|
|
207
|
-
try:
|
|
208
|
-
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()}/output_similarity_scores.csv')
|
|
209
|
-
df_identification_tmp = pd.read_csv(f'{Path.cwd()}/output_identification.csv')
|
|
210
|
-
df_similarity_scores_tmp = pd.read_csv(f'{Path.cwd()}/output_similarity_scores.csv')
|
|
211
|
-
df_identification_tmp.to_csv(input.output_identification(), index=False)
|
|
212
|
-
df_similarity_scores_tmp.to_csv(input.output_similarity_scores(), index=False)
|
|
213
|
-
run_status.set(f"✅ Spectral library matching has finished.")
|
|
214
|
-
except Exception as e:
|
|
215
|
-
run_status.set(f"❌ Error: {traceback.format_exc()}")
|
|
216
|
-
elif input.chromatography_platform == "NRMS":
|
|
217
|
-
try:
|
|
218
|
-
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')
|
|
219
|
-
df_identification_tmp = pd.read_csv(f'{Path.cwd()}/output_identification.csv')
|
|
220
|
-
df_similarity_scores_tmp = pd.read_csv(f'{Path.cwd()}/output_similarity_scores.csv')
|
|
221
|
-
df_identification_tmp.to_csv(input.output_identification(), index=False)
|
|
222
|
-
df_similarity_scores_tmp.to_csv(input.output_similarity_scores(), index=False)
|
|
223
|
-
run_status.set(f"✅ Spectral library matching has finished.")
|
|
224
|
-
except Exception as e:
|
|
225
|
-
run_status.set(f"❌ Error: {traceback.format_exc()}")
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
elif choice == "Tune parameters with a query library with known compound IDs":
|
|
230
|
-
high_quality_reference_library_tmp = custom_on_off_to_bool(list(input.high_quality_reference_library()))
|
|
231
|
-
if input.chromatography_platform() == "HRMS":
|
|
232
|
-
try:
|
|
233
|
-
grid = {'similarity_measure':list(input.similarity_measure()),
|
|
234
|
-
'high_quality_reference_library':high_quality_reference_library_tmp,
|
|
235
|
-
'spectrum_preprocessing_order':split_or_wrap(input.spectrum_preprocessing_order()),
|
|
236
|
-
'mz_min':split_or_wrap(input.mz_min()),
|
|
237
|
-
'mz_max':split_or_wrap(input.mz_max()),
|
|
238
|
-
'int_min':split_or_wrap(input.int_min()),
|
|
239
|
-
'int_max':split_or_wrap(input.int_max()),
|
|
240
|
-
'window_size_centroiding':split_or_wrap(input.window_size_centroiding()),
|
|
241
|
-
'window_size_matching':split_or_wrap(input.window_size_matching()),
|
|
242
|
-
'noise_threshold':split_or_wrap(input.noise_threshold()),
|
|
243
|
-
'wf_mz':split_or_wrap(input.wf_mz()),
|
|
244
|
-
'wf_int':split_or_wrap(input.wf_int()),
|
|
245
|
-
'LET_threshold':split_or_wrap(input.LET_threshold()),
|
|
246
|
-
'entropy_dimension':split_or_wrap(input.entropy_dimension())}
|
|
247
|
-
tune_params_on_HRMS_data(query_data=input.query_data()[0]['datapath'], reference_data=input.reference_data()[0]['datapath'], grid=grid, output_path=input.output_path())
|
|
248
|
-
run_status.set(f"✅ Parameter tuning has finished.")
|
|
249
|
-
except Exception as e:
|
|
250
|
-
run_status.set(f"❌ Error: {traceback.format_exc()}")
|
|
251
|
-
elif input.chromatography_platform() == "NRMS":
|
|
252
|
-
try:
|
|
253
|
-
grid = {'similarity_measure':list(input.similarity_measure()),
|
|
254
|
-
'high_quality_reference_library':high_quality_reference_library_tmp,
|
|
255
|
-
'spectrum_preprocessing_order':split_or_wrap(input.spectrum_preprocessing_order()),
|
|
256
|
-
'mz_min':split_or_wrap(input.mz_min()),
|
|
257
|
-
'mz_max':split_or_wrap(input.mz_max()),
|
|
258
|
-
'int_min':split_or_wrap(input.int_min()),
|
|
259
|
-
'int_max':split_or_wrap(input.int_max()),
|
|
260
|
-
'noise_threshold':split_or_wrap(input.noise_threshold()),
|
|
261
|
-
'wf_mz':split_or_wrap(input.wf_mz()),
|
|
262
|
-
'wf_int':split_or_wrap(input.wf_int()),
|
|
263
|
-
'LET_threshold':split_or_wrap(input.LET_threshold()),
|
|
264
|
-
'entropy_dimension':split_or_wrap(input.entropy_dimension())}
|
|
265
|
-
tune_params_on_NRMS_data(query_data=input.query_data()[0]['datapath'], reference_data=input.reference_data()[0]['datapath'], grid=grid, output_path=input.output_path())
|
|
266
|
-
run_status.set(f"✅ Parameter tuning has finished.")
|
|
267
|
-
except Exception as e:
|
|
268
|
-
run_status.set(f"❌ Error: {traceback.format_exc()}")
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
elif choice == "Plot two spectra":
|
|
274
|
-
if len(input.spectrum_ID1())==0:
|
|
275
|
-
spectrum_ID1 = None
|
|
276
|
-
if len(input.spectrum_ID2())==0:
|
|
277
|
-
spectrum_ID2 = None
|
|
278
|
-
|
|
279
|
-
if input.chromatography_platform() == "HRMS":
|
|
280
|
-
try:
|
|
281
|
-
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(), output_path=input.output_path())
|
|
282
|
-
run_status.set(f"✅ Plotting has finished.")
|
|
283
|
-
except Exception as e:
|
|
284
|
-
run_status.set(f"❌ Error: {traceback.format_exc()}")
|
|
285
|
-
elif input.chromatography_platform == "NRMS":
|
|
286
|
-
try:
|
|
287
|
-
generate_plots_on_NRMS_data(query_data=input.query_data()[0]['datapath'], reference_data=input.reference_data()[0]['datapath'], spectrum_ID1=input.spectrum_ID1(), spectrum_ID2=input.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(), output_path=input.output_path())
|
|
288
|
-
run_status.set(f"✅ Plotting has finished.")
|
|
289
|
-
except Exception as e:
|
|
290
|
-
run_status.set(f"❌ Error: {traceback.format_exc()}")
|
|
291
|
-
|
|
292
|
-
@output
|
|
293
|
-
@render.text
|
|
294
|
-
def status_output():
|
|
295
|
-
return run_status.get()
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
app = App(app_ui, server)
|
|
299
|
-
|
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
app.py,sha256=PKiCJe_18EJIHvs0R7pl_Yf-XakZn5J0AAfI-AnGsX0,21535
|
|
2
|
-
pycompound/build_library.py,sha256=8ghpX8wfj6u-3V5X2IdJ-e8G_FRSla1lO0pzLj7hOtI,5373
|
|
3
|
-
pycompound/plot_spectra.py,sha256=wOnf2oOAfifj7FYkTZAcIeD7dHW1aRHzmsspPpySDcY,42023
|
|
4
|
-
pycompound/plot_spectra_CLI.py,sha256=fo0nUmbuy2qE6d9HgVdASn2CNUG8seg2mUCPrUU-rao,8409
|
|
5
|
-
pycompound/processing.py,sha256=7cKMX7PQ4Q-I4c8lRo5qXbOVGr8CeRdgNPURJx8DBV0,11075
|
|
6
|
-
pycompound/pycompound_shiny.py,sha256=uYfeIuR5j1UK_KE8RbDPaQxqMIU1qykVJ2L-zgaSkY0,30154
|
|
7
|
-
pycompound/similarity_measures.py,sha256=TuvtEXWwyxE6dfpmuAqRC6gOHvHg3Jf21099pVaNBAs,10702
|
|
8
|
-
pycompound/spec_lib_matching.py,sha256=jtUpG5OBDtIaHIpCNc62a3y-wQ_SmIgXZ9Q_p8xKZu4,59969
|
|
9
|
-
pycompound/spec_lib_matching_CLI.py,sha256=TAafJ3DGPorBTDzmXLQaaSH3giKn6q3GrRJPWh03yyo,9929
|
|
10
|
-
pycompound/tuning_CLI.py,sha256=qLglxqq-y6EXCDk0P3CkWn6cTFCmWDeKz0-SZBXcwCA,8553
|
|
11
|
-
pycompound-0.0.6.dist-info/licenses/LICENSE,sha256=fPFFlkSGg60VQWyWqTSv8yoJnpLzppzdihVWY5NKom8,1064
|
|
12
|
-
pycompound-0.0.6.dist-info/METADATA,sha256=tFDhlgKMiQO14QV09WOF1v1YMrSTDeRkgHm42-l4Ki0,1704
|
|
13
|
-
pycompound-0.0.6.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
|
|
14
|
-
pycompound-0.0.6.dist-info/top_level.txt,sha256=wFBLVrqpC07HghIU8tsEdgdvgkdOE3GN_1Gfjk-uEUc,15
|
|
15
|
-
pycompound-0.0.6.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|
|
File without changes
|