Skip to content

Commit

Permalink
Bugfix atomic isotopes
Browse files Browse the repository at this point in the history
  • Loading branch information
RobbinBouwmeester committed Jun 23, 2023
1 parent e7e6ca3 commit 4d46071
Show file tree
Hide file tree
Showing 3 changed files with 24 additions and 6 deletions.
5 changes: 5 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,11 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
and this project adheres to
[Semantic Versioning](https://semver.org/spec/v2.0.0.html).

# [2.2.2] - 2023-06-23

### Changed
- Fixed a bug where isotopes are incorrectly parsed

# [2.2.1] - 2023-06-18

### Changed
Expand Down
23 changes: 18 additions & 5 deletions deeplc/feat_extractor.py
Original file line number Diff line number Diff line change
Expand Up @@ -546,11 +546,24 @@ def rolling_sum(a, n=2):
continue

for atom_position_composition,atom_change in modification_composition.items():
matrix[i, dict_index[atom_position_composition]] += atom_change
if i in positions:
matrix_pos[i, dict_index_pos[atom_position_composition]] += atom_change
elif i - seq_len in positions:
matrix_pos[i - seq_len, dict_index_pos[atom_position_composition]] += atom_change
try:
matrix[i, dict_index[atom_position_composition]] += atom_change
if i in positions:
matrix_pos[i, dict_index_pos[atom_position_composition]] += atom_change
elif i - seq_len in positions:
matrix_pos[i - seq_len, dict_index_pos[atom_position_composition]] += atom_change
except KeyError:
try:
logger.debug(f"Could not add the following atom: {atom_position_composition}, attempting to replace the [] part")
atom_position_composition = sub("\[.*?\]", "", atom_position_composition)
matrix[i, dict_index[atom_position_composition]] += atom_change
if i in positions:
matrix_pos[i, dict_index_pos[atom_position_composition]] += atom_change
elif i - seq_len in positions:
matrix_pos[i - seq_len, dict_index_pos[atom_position_composition]] += atom_change
except KeyError:
logger.debug(f"Could not add the following atom: {atom_position_composition}, second attempt, now ignored")
continue

#logger.debug(
# "Peptide onehot+mod: %s seconds" %
Expand Down
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

setup(
name='deeplc',
version='2.2.1',
version='2.2.2',
license='apache-2.0',
description='DeepLC: Retention time prediction for (modified) peptides using Deep Learning.',
long_description=LONG_DESCRIPTION,
Expand Down

0 comments on commit 4d46071

Please sign in to comment.