Skip to content

Commit

Permalink
Fix compatability with pyteomics Unimod
Browse files Browse the repository at this point in the history
  • Loading branch information
mobiusklein committed Dec 1, 2023
1 parent 9169b19 commit 75a37c0
Show file tree
Hide file tree
Showing 11 changed files with 31 additions and 11 deletions.
16 changes: 16 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,22 @@ All notable changes to this project will be documented in this file.

The format is based on [Keep a Changelog][Keep a Changelog] and this project adheres to [Semantic Versioning][Semantic Versioning].

## [Unreleased]

| Name | Version | Checksum |
| :---: | :---: | :---: |
| XLMOD.obo.gz | release/2019-10-28 | 4e577044551d277e4bbd62753fa15e08 |
| gno.obo.gz | 2023-11-09 | 078de92750ee4956b705684253a66f97 |
| go.obo.gz | releases/2023-11-15 | 1130d315870d82c1624f87b37305777b |
| pato.obo.gz | releases/2023-05-18/pato.obo | 8a14f0e3b3318c13d029d84d693a01e3 |
| psi-mod.obo.gz | - | 713e6dd17632d0388802f1b0e06800f0 |
| psi-ms.obo.gz | 4.1.136 | 1d5aa08ea57762000d00a9300734a78c |
| unimod_tables.xml.gz | - | efc94f333458012a77203d09a64d7d38 |
| unit.obo.gz | releases/2023-05-25 | 5a04e9d871730a1ee04764055e841785 |

### Added
1. Add `by_id` method to `Unimod` for parity with `pyteomics`

## [v1.3.1]

### Changed
Expand Down
14 changes: 9 additions & 5 deletions psims/controlled_vocabulary/unimod.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
from typing import Union
import warnings
import re

Expand Down Expand Up @@ -760,7 +761,13 @@ def version(self):
except Exception:
return self.default_version

def get(self, identifier, strict=True):
def by_id(self, identifier: int):
mod = self.session.query(Modification).get(identifier)
if mod is None:
raise KeyError(identifier)
return mod

def get(self, identifier: Union[str, int], strict=True):
is_explicit_accession = isinstance(identifier, basestring) and identifier.startswith("UNIMOD")
try:
# At least one Modification has an empty string code_name or ex_code_name, causing
Expand All @@ -772,10 +779,7 @@ def get(self, identifier, strict=True):
if isinstance(identifier, int) or is_explicit_accession:
if is_explicit_accession:
identifier = int(identifier.replace("UNIMOD:", ''))
mod = self.session.query(Modification).get(identifier)
if mod is None:
raise KeyError(identifier)
return mod
return self.by_id(identifier)
elif isinstance(identifier, basestring):
if strict:
mod = self.session.query(Modification).filter(
Expand Down
Binary file modified psims/controlled_vocabulary/vendor/XLMOD.obo.gz
Binary file not shown.
Binary file modified psims/controlled_vocabulary/vendor/gno.obo.gz
Binary file not shown.
Binary file modified psims/controlled_vocabulary/vendor/go.obo.gz
Binary file not shown.
Binary file modified psims/controlled_vocabulary/vendor/pato.obo.gz
Binary file not shown.
Binary file modified psims/controlled_vocabulary/vendor/psi-mod.obo.gz
Binary file not shown.
Binary file modified psims/controlled_vocabulary/vendor/psi-ms.obo.gz
Binary file not shown.
12 changes: 6 additions & 6 deletions psims/controlled_vocabulary/vendor/record.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,12 @@
"version": "release/2019-10-28"
},
"gno.obo.gz": {
"checksum": "6178d787e38a8a1b5d7506e3c1a880d0",
"version": "2023-08-09"
"checksum": "078de92750ee4956b705684253a66f97",
"version": "2023-11-09"
},
"go.obo.gz": {
"checksum": "a827a54e43185170c973afe1add92941",
"version": "releases/2023-10-09"
"checksum": "1130d315870d82c1624f87b37305777b",
"version": "releases/2023-11-15"
},
"pato.obo.gz": {
"checksum": "8a14f0e3b3318c13d029d84d693a01e3",
Expand All @@ -20,8 +20,8 @@
"version": null
},
"psi-ms.obo.gz": {
"checksum": "3f58f845ef728dc3225a5a2df32fff3a",
"version": "4.1.135"
"checksum": "1d5aa08ea57762000d00a9300734a78c",
"version": "4.1.136"
},
"unimod_tables.xml.gz": {
"checksum": "efc94f333458012a77203d09a64d7d38",
Expand Down
Binary file modified psims/controlled_vocabulary/vendor/unimod_tables.xml.gz
Binary file not shown.
Binary file modified psims/controlled_vocabulary/vendor/unit.obo.gz
Binary file not shown.

0 comments on commit 75a37c0

Please sign in to comment.