Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 5 additions & 2 deletions src/picor/isotope_correction.py
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,8 @@ def calc_isotopologue_correction(
)
if res_corr_info.do_correction:
rc.warn_direct_overlap(subset, res_corr_info)
data = correct_data(raw_data, subset, res_corr_info)
clean_data = raw_data.fillna(0)
data = correct_data(clean_data, subset, res_corr_info)
return data


Expand All @@ -119,7 +120,9 @@ def correct_data(uncorrected_data, subset, res_corr_info):
data[label2.as_string] - trans_prob * data[label1.as_string]
)
# Ensure no negative values after correction, but preserve dtype and avoid inplace modification issues
data[label2.as_string] = data[label2.as_string].clip(lower=0)
col_name = label2.as_string
data.loc[:, col_name] = data[col_name].clip(lower=0)
#data[label2.as_string] = data[label2.as_string].clip(lower=0)
_logger.info(
f"Transition prob {label1.as_string} -> {label2.as_string}: {trans_prob}"
)
Expand Down
50 changes: 24 additions & 26 deletions src/picor/metabolites.csv
Original file line number Diff line number Diff line change
@@ -1,31 +1,29 @@
name formula charge
Suc C4H4O3 -1
Fum C4H3O4 -1
Mal C4H5O5 -1
Cit C6H7O7 -1
aKG C5H5O5 -1
OA C4H3O5 -1
Asp C4H6NO4 -1
Aco C6HO3 -1
2/3PG C3H6O3 -1
G3P C3H7O3 -1
PEP C3H4O3 -1
E4P C4H8O4 -1
R1P C5H8O4 -1
R5P C5H8O4 -1
G1P C6H10O5 -1
G6P C6H10O5 -1
F1P C6H10O5 -1
F6P C6H10O5 -1
M6P C6H10O5 -1
6PG C6H10O6 -1
S7P C7H11O6 -1
FBP C6H11O8P -1
AMP C10H14N5O4 -1
ADP C10H14N5O4 -1
ATP C10H16N5O10 -1
CDP C9H15N3O7P -1
AcetylCoA C23H38N7O17P3S +1
AcCoA C23H38N7O17P3S +1
ADP C10H15N5O10P2 +1
AMP C10H14N5O7P +1
ATP C10H16N5O13P3 +1
NAD C21H28N7O14P2 +1
AMP C10H14N5O7P +1
NADP C21H29N7O17P3 +1
NADPH C21H30N7O17P3 +1
NMN C11H15N2O8P +1
CoA C21H36N7O16P3S +1
FMN C17H21N4O9P +1
cFMN C17H19N4O8P +1
NADH C21H29N7O14P2 +1
FAD C27H33N9O15P2 +1
ADPr C15H23N5O14P2 +1
NAM C6H6N2O +1
PRPP C5H13O14P3 +1
Pantothenic_acid O5N1H17C9 +1
SAH S1O5N6H20C14 +1
SAM S1O5N6H22C15 +1
NMNH P1O8N2H16C11 +1
Pantetheine C11H22N2O4S +1
DephosphoCoA C21H35N7O13P2S +1

NADH C21H29N7O14P2 +1
NAM C6H6N2O +1
NA C6H5NO2 +1
Expand Down
2 changes: 2 additions & 0 deletions src/picor/resolution_correction.py
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,8 @@ def calc_min_mass_diff(mass, charge, mz_cal, resolution):
"""
if mass < 0:
raise ValueError("'mass' must be positive.")
if charge == 0:
raise ValueError("'charge' cannot be 0, change in metabolites.csv file is required.")
mz = abs(mass / charge)
return (
1.66 * abs(charge) * ResolutionCorrectionInfo.fwhm(mz_cal, mz, resolution)
Expand Down