Skip to content

Commit

Permalink
Merge pull request #1 from a-r-j/master
Browse files Browse the repository at this point in the history
Merge changes
  • Loading branch information
kamurani authored Jul 7, 2022
2 parents 622d7b8 + 011d880 commit 920e14e
Show file tree
Hide file tree
Showing 4 changed files with 18 additions and 8 deletions.
4 changes: 2 additions & 2 deletions .requirements/base.in
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
biopandas>=0.4.1
biopython
bioservices
bioservices>=1.10.0
deepdiff
loguru
matplotlib>=3.4.3
Expand All @@ -15,7 +15,7 @@ rich-click
seaborn
pyyaml>=5.1,<6.*
scikit-learn
scipy
scipy
tqdm
typing_extensions
wget
Expand Down
8 changes: 7 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,10 @@
### 1.5.0 - UNRELEASED
### 1.5.1

#### Changes

* #187 updates sequence retrieval due to UniProt API changes.

### 1.5.0

#### Protein

Expand Down
12 changes: 8 additions & 4 deletions graphein/grn/features/node_features.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import logging
from typing import Any, Dict

from graphein.utils.utils import import_message

Expand All @@ -16,12 +17,15 @@
log.warning(message)


def add_sequence_to_nodes(n, d):
def add_sequence_to_nodes(n: str, d: Dict[str, Any]):
"""
Maps UniProt ACC to UniProt ID. Retrieves sequence from UniProt and adds it to the node
Maps UniProt ACC to UniProt ID. Retrieves sequence from UniProt and adds
it to the node
:param n: Graph node.
:param n: Graph node. Unused (retained for a consistent function signature).
:type n: str
:param d: Graph attribute dictionary.
:type d: Dict[str, Any]
"""

h = HGNC(verbose=False)
Expand All @@ -35,4 +39,4 @@ def add_sequence_to_nodes(n, d):
# Todo mapping with bioservices to support other protein IDs?

for id in d["uniprot_ids"]:
d[f"sequence_{id}"] = u.get_fasta_sequence(id)
d[f"sequence_{id}"] = u.search(id, columns="sequence").split("\n")[1]
2 changes: 1 addition & 1 deletion graphein/ppi/features/node_features.py
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ def add_sequence_to_nodes(n: str, d: Dict[str, Any]):
# Todo mapping with bioservices to support other protein IDs?

for id in d["uniprot_ids"]:
d[f"sequence_{id}"] = u.get_fasta_sequence(id)
d[f"sequence_{id}"] = u.search(id, columns="sequence").split("\n")[1]


if __name__ == "__main__":
Expand Down

0 comments on commit 920e14e

Please sign in to comment.