Skip to content

Commit aab0405

Browse files
committed
result display acc to xl fdr
1 parent b83e1d8 commit aab0405

File tree

2 files changed

+21
-10
lines changed

2 files changed

+21
-10
lines changed

content/analyze.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -221,7 +221,7 @@
221221
XLFDR_input = st.text_area(
222222
"XL FDR",
223223
value=str([0.01, 0.1, 1.0]), # Default value
224-
help=NuXL_config['xlFDR']['description'] + "or use single float (e-g 0.01)"
224+
help=NuXL_config['xlFDR']['description'] + " or use single float (e-g 0.01). " + "For protein level reporting important to select (0.01 and 1.0). "
225225
" Default: " + '[0.01, 0.1, 1.0]'
226226
)
227227

content/results.py

Lines changed: 20 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -85,13 +85,12 @@ def get_mz_intensities_from_ms2(MS2_spectras, native_id):
8585
# If the native ID is not found, return None
8686
return None
8787

88-
def remove_substrings(original_string, substrings_to_remove):
89-
modified_string = original_string
90-
for substring in substrings_to_remove:
91-
modified_string = modified_string.replace(substring, "")
92-
return modified_string
88+
import re
9389

94-
nuxl_out_pattern = ["_perc_0.0100_XLs.idXML", "_0.0100_XLs.idXML", "_perc_0.1000_XLs.idXML", "_0.1000_XLs.idXML", "_perc_1.0000_XLs.idXML", "_1.0000_XLs.idXML"]
90+
def clean_filename_with_regex(filename):
91+
# Pattern to match "_perc_X.XXXX_XLs.idXML" or "_X.XXXX_XLs.idXML"
92+
pattern = r"(_perc_\d\.\d{4}_XLs\.idXML|_\d\.\d{4}_XLs\.idXML)"
93+
return re.sub(pattern, "", filename)
9594

9695
########################
9796

@@ -136,8 +135,9 @@ def remove_substrings(original_string, substrings_to_remove):
136135

137136
##TODO setup more better/effiecient
138137
# Remove the out pattern of idxml
139-
file_name_wout_out = remove_substrings(selected_file, nuxl_out_pattern)
140-
138+
#file_name_wout_out = remove_substrings(selected_file, nuxl_out_pattern)
139+
file_name_wout_out = clean_filename_with_regex(selected_file)
140+
141141
if file_name_wout_out == "Example":
142142
file_name_wout_out = "Example_RNA_UV_XL"
143143

@@ -295,7 +295,18 @@ def remove_substrings(original_string, substrings_to_remove):
295295

296296
#if the same protein file not available
297297
else:
298-
st.warning(f"{protein_path.name} file not exist in current workspace")
298+
match = re.search(r"proteins([\d.]+)_XLs", protein_path.name)
299+
value = match.group(1) if match else None
300+
if float(value)>0.1000:
301+
warning_message = f"NuXL not report at {value}, Protein-level reports at 1% and 10% FDR will only be displayed if XL FDR thresholds (0.01 and 0.10) are specified. NuXL generates reports exclusively for these FDR values, so ensure the thresholds are set accordingly."
302+
else:
303+
warning_message = f"{protein_path.name} file not exist in current workspace, please rerun analysis or upload."
304+
305+
# Display the warning message across all tabs
306+
for i, tab in enumerate(tabs_, start=1):
307+
with tab:
308+
if i != 1: # Skip CSM
309+
st.warning(warning_message)
299310

300311
_ ="""
301312
tabs_ = st.tabs(["CSMs", "Proteins"])

0 commit comments

Comments
 (0)