Skip to content

Commit b297151

Browse files
authored
Added exception for label atom count
The testing of potential overlap can lead to physically impossible label states (more nitrogen are in the label than in the molecule) and the error "too many atoms in label" is called. This is not necessary, as the test of this overlap is not possible or necessary and stops the program to work with certain labels. Introducing an exception for it allows the program to continue running.
1 parent 7f313fc commit b297151

1 file changed

Lines changed: 7 additions & 1 deletion

File tree

src/picor/resolution_correction.py

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -169,7 +169,13 @@ def calc_indirect_overlap_prob(label1, label2, res_corr_info):
169169

170170
probs = []
171171
for label_trans in generate_labels(coarse_mass_difference, res_corr_info):
172-
label1_mod = label1.add(label_trans)
172+
try:
173+
label1_mod = label1.add(label_trans)
174+
except ValueError as e:
175+
if "Too many atoms in label." in str(e):
176+
continue
177+
else:
178+
raise e
173179
if is_isotologue_overlap(label1_mod, label2, res_corr_info):
174180
prob = calc_label_diff_prob(label1, label_trans)
175181
_logger.debug(f"For trans label {label_trans}: {prob}")

0 commit comments

Comments
 (0)