Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merge changes #1

Merged
merged 2 commits into from
Jul 7, 2022
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
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
4 changes: 2 additions & 2 deletions graphein/utils/config_parser.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ def config_constructor(

:param loader: Given yaml loader
:param type: yaml.FullLoader
:param loader: A mapping node
:param node: A mapping node
:param type: yaml.nodes.MappingNode
"""
arg_map = loader.construct_mapping(node, deep=True) if node.value else {}
Expand All @@ -42,7 +42,7 @@ def function_constructor(
:param type: yaml.FullLoader
:param tag_suffix: The name after the !func: tag
:param type: str
:param loader: A mapping node if function parameters are given, a scalar node if not
:param node: A mapping node if function parameters are given, a scalar node if not
:param type: Union[yaml.nodes.MappingNode, yaml.nodes.ScalarNode]
"""
arg_map = None
Expand Down