Skip to content

Commit

Permalink
[pre-commit.ci] pre-commit autoupdate (#363)
Browse files Browse the repository at this point in the history
  • Loading branch information
pre-commit-ci[bot] authored Jan 30, 2024
1 parent 40fd0d4 commit 6e0be18
Show file tree
Hide file tree
Showing 99 changed files with 213 additions and 110 deletions.
2 changes: 1 addition & 1 deletion .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ repos:
- id: check-yaml
- id: check-added-large-files
- repo: https://github.com/psf/black
rev: 23.12.1
rev: 24.1.1
hooks:
- id: black
- repo: https://github.com/pre-commit/pre-commit-hooks
Expand Down
1 change: 1 addition & 0 deletions graphein/cli.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Command line interface for graphein."""

import pathlib
import pickle

Expand Down
1 change: 1 addition & 0 deletions graphein/grn/edges.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Functions for adding edges to Gene Regulatory Networks from various sources."""

# %%
# Graphein
# Author: Arian Jamasb <arian@jamasb.io>, Ramon Vinas
Expand Down
1 change: 1 addition & 0 deletions graphein/grn/features/node_features.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Node featurisation utilities for Gene Regulatory Networks."""

from typing import Any, Dict

from bioservices import HGNC, UniProt
Expand Down
11 changes: 6 additions & 5 deletions graphein/grn/graphs.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Graph construction utilities for Gene Regulatory Networks."""

# %%
# Graphein
# Author: Arian Jamasb <arian@jamasb.io>, Ramon Vinas
Expand Down Expand Up @@ -152,11 +153,11 @@ def edge_ann_fn(u, v, d):
print(g.edges(data=True))

edge_colors = [
"r"
if g[u][v]["kind"] == {"trrust"}
else "b"
if g[u][v]["kind"] == {"regnetwork"}
else "y"
(
"r"
if g[u][v]["kind"] == {"trrust"}
else "b" if g[u][v]["kind"] == {"regnetwork"} else "y"
)
for u, v in g.edges()
]

Expand Down
1 change: 1 addition & 0 deletions graphein/grn/parse_regnetwork.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Functions for parsing GRNs from RegNetwork."""

# %%
# Graphein
# Author: Ramon Vinas, Arian Jamasb <arian@jamasb.io>
Expand Down
1 change: 1 addition & 0 deletions graphein/grn/parse_trrust.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Utilities for parsing the TRRUST database."""

# %%
# Graphein
# Author: Ramon Vinas, Arian Jamasb <arian@jamasb.io>
Expand Down
1 change: 1 addition & 0 deletions graphein/ml/conversion.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
"""Utilities for converting Graphein Networks to Geometric Deep Learning formats.
"""

# %%
# Graphein
# Author: Kexin Huang, Arian Jamasb <arian@jamasb.io>
Expand Down
1 change: 1 addition & 0 deletions graphein/ml/datasets/foldcomp_dataset.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Utilities for loading FoldComp databases for deep learning."""

# Graphein
# Author: Arian Jamasb <arian@jamasb.io>
# License: MIT
Expand Down
15 changes: 9 additions & 6 deletions graphein/ml/datasets/torch_geometric_dataset.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Pytorch Geometric Dataset classes for Protein Graphs."""

# Graphein
# Author: Arian Jamasb <arian@jamasb.io>
# License: MIT
Expand Down Expand Up @@ -164,9 +165,9 @@ def __init__(
elif self.uniprot_ids:
self.structures = uniprot_ids
self.af_version = af_version
self.bad_pdbs: List[
str
] = [] # list of pdb codes that failed to download
self.bad_pdbs: List[str] = (
[]
) # list of pdb codes that failed to download

# Labels & Chains
self.graph_label_map = graph_label_map
Expand Down Expand Up @@ -265,9 +266,11 @@ def process(self):

if self.chain_selection_map:
chain_selections = [
self.chain_selection_map[pdb]
if pdb in self.chain_selection_map.keys()
else "all"
(
self.chain_selection_map[pdb]
if pdb in self.chain_selection_map.keys()
else "all"
)
for pdb in self.structures
]
else:
Expand Down
1 change: 1 addition & 0 deletions graphein/ml/diffusion.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
and returns a 2D xarray.
These arrays can then be stacked to generate a diffusion tensor.
"""

from typing import Dict

import networkx as nx
Expand Down
1 change: 1 addition & 0 deletions graphein/ml/utils.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""ML utility Functions for working with graphs."""

# Graphein
# Author: Arian Jamasb <arian@jamasb.io>
# License: MIT
Expand Down
1 change: 1 addition & 0 deletions graphein/ml/visualisation.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Visualisation utils for ML."""

from __future__ import annotations

import itertools
Expand Down
1 change: 1 addition & 0 deletions graphein/molecule/atoms.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
These include various collections of standard atom types used molecule-focussed ML
"""

# Graphein
# Author: Eric J. Ma, Arian Jamasb <arian@jamasb.io>
# License: MIT
Expand Down
1 change: 1 addition & 0 deletions graphein/molecule/chembl.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Functions for retrieving molecular data from ChEMBL."""

from typing import Any, Dict

import networkx as nx
Expand Down
1 change: 1 addition & 0 deletions graphein/molecule/config.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Base Config object for use with Molecule Graph Construction."""

# Graphein
# Author: Arian Jamasb <arian@jamasb.io>
# License: MIT
Expand Down
1 change: 1 addition & 0 deletions graphein/molecule/edges/atomic.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Functions for computing atomic structure of molecules."""

import networkx as nx

# %%
Expand Down
1 change: 1 addition & 0 deletions graphein/molecule/features/edges/bonds.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Functions for computing atomic features for molecules."""

# %%
# Graphein
# Author: Arian Jamasb <arian@jamasb.io>
Expand Down
1 change: 1 addition & 0 deletions graphein/molecule/features/graph/molecule.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Functions for featurising Small Molecule Graphs."""

# %%
# Graphein
# Author: Arian Jamasb <arian@jamasb.io>
Expand Down
1 change: 1 addition & 0 deletions graphein/molecule/features/nodes/atom_type.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Functions for featurising Small Molecule Graphs."""

# %%
# Graphein
# Author: Arian Jamasb <arian@jamasb.io>, Yuanqi Du
Expand Down
1 change: 1 addition & 0 deletions graphein/molecule/graphs.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Functions for working with Small Molecule Graphs."""

# %%
# Graphein
# Author: Arian Jamasb <arian@jamasb.io>, Eric Ma, Charlie Harris
Expand Down
1 change: 1 addition & 0 deletions graphein/molecule/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
Junction tree code adapted from Wengong Jin https://github.com/wengong-jin/icml18-jtnn
"""

# Graphein
# Author: Arian Jamasb <arian@jamasb.io>
# License: MIT
Expand Down
1 change: 1 addition & 0 deletions graphein/molecule/visualisation.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
Plotting functions for molecules wrap the methods defined on protein graphs and provide sane defaults.
"""

# %%
# Graphein
# Author: Arian Jamasb <arian@jamasb.io>
Expand Down
1 change: 1 addition & 0 deletions graphein/molecule/zinc.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
Adapted from smilite (https://github.com/rasbt/smilite) by Sebastian Raschka.
"""

# Graphein
# Author: Arian Jamasb <arian@jamasb.io>
# License: MIT
Expand Down
126 changes: 63 additions & 63 deletions graphein/ppi/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,18 +26,18 @@ class STRINGConfig(BaseModel):
"""

species: Optional[int] = 9606 # NCBI taxon identifiers
required_score: Optional[
int
] = 50 # threshold of significance to include a interaction, a number between 0 and 1000 (default depends on the network)
network_type: Optional[
str
] = "functional" # network type: functional (default), physical
add_nodes: Optional[
int
] = 0 # adds a number of proteins to the network based on their confidence score, e.g., extends the interaction neighborhood of selected proteins to desired value
show_query_node_labels: Optional[
bool
] = 0 # when available use submitted names in the preferredName column when (0 or 1) (default:0)
required_score: Optional[int] = (
50 # threshold of significance to include a interaction, a number between 0 and 1000 (default depends on the network)
)
network_type: Optional[str] = (
"functional" # network type: functional (default), physical
)
add_nodes: Optional[int] = (
0 # adds a number of proteins to the network based on their confidence score, e.g., extends the interaction neighborhood of selected proteins to desired value
)
show_query_node_labels: Optional[bool] = (
0 # when available use submitted names in the preferredName column when (0 or 1) (default:0)
)


class BioGridConfig(BaseModel):
Expand Down Expand Up @@ -82,58 +82,58 @@ class BioGridConfig(BaseModel):
:type throughputTag: str, optional
"""

searchNames: Optional[
bool
] = True # If ‘true’, the interactor OFFICIAL_SYMBOL will be examined for a match with the geneList.
searchNames: Optional[bool] = (
True # If ‘true’, the interactor OFFICIAL_SYMBOL will be examined for a match with the geneList.
)
max: Optional[int] = 10000 # Number of results to fetch
interSpeciesExcluded: Optional[
bool
] = True # If ‘true’, interactions with interactors from different species will be excluded.
selfInteractionsExcluded: Optional[
bool
] = False # If ‘true’, interactions with one interactor will be excluded.
evidenceList: Optional[
str
] = "" # Any interaction evidence with its Experimental System in the list will be excluded from the results unless includeEvidence is set to true.
includeEvidence: Optional[
bool
] = False # If set to true, any interaction evidence with its Experimental System in the evidenceList will be included in the result
searchIds: Optional[
bool
] = True # If ‘true’, the interactor ENTREZ_GENE, ORDERED LOCUS and SYSTEMATIC_NAME (orf) will be examined for a match with the geneList.
searchNames: Optional[
bool
] = True # If ‘true’, the interactor OFFICIAL_SYMBOL will be examined for a match with the geneList.
searchSynonyms: Optional[
bool
] = True # If ‘true’, the interactor SYNONYMS will be examined for a match with the geneList.
searchBiogridIds: Optional[
bool
] = True # If ‘true’, the entries in 'GENELIST' will be compared to BIOGRID internal IDS which are provided in all Tab2 formatted files.
additionalIdentifierTypes: Optional[
str
] = "" # Identifier types on this list are examined for a match with the geneList.
excludeGenes: Optional[
bool
] = False # If ‘true’, interactions containing genes in the geneList will be excluded from the results.
includeInteractors: Optional[
bool
] = True # If ‘true’, in addition to interactions between genes on the geneList, interactions will also be fetched which have only one interactor on the geneList
includeInteractorInteractions: Optional[
bool
] = False # If ‘true’ interactions between the geneList’s first order interactors will be included.
pubmedList: Optional[
str
] = "" # Interactions will be fetched whose Pubmed Id is/ is not in this list, depending on the value of excludePubmeds.
excludePubmeds: Optional[
bool
] = False # If ‘false’, interactions with Pubmed ID in pubmedList will be included in the results; if ‘true’ they will be excluded.
htpThreshold: Optional[
int
] = 20 # Interactions whose Pubmed ID has more than this number of interactions will be excluded from the results. Ignored if excludePubmeds is ‘false’.
throughputTag: Optional[
str
] = "any" # If set to 'low or 'high', only interactions with 'Low throughput' or 'High throughput' in the 'throughput' field will be returned.
interSpeciesExcluded: Optional[bool] = (
True # If ‘true’, interactions with interactors from different species will be excluded.
)
selfInteractionsExcluded: Optional[bool] = (
False # If ‘true’, interactions with one interactor will be excluded.
)
evidenceList: Optional[str] = (
"" # Any interaction evidence with its Experimental System in the list will be excluded from the results unless includeEvidence is set to true.
)
includeEvidence: Optional[bool] = (
False # If set to true, any interaction evidence with its Experimental System in the evidenceList will be included in the result
)
searchIds: Optional[bool] = (
True # If ‘true’, the interactor ENTREZ_GENE, ORDERED LOCUS and SYSTEMATIC_NAME (orf) will be examined for a match with the geneList.
)
searchNames: Optional[bool] = (
True # If ‘true’, the interactor OFFICIAL_SYMBOL will be examined for a match with the geneList.
)
searchSynonyms: Optional[bool] = (
True # If ‘true’, the interactor SYNONYMS will be examined for a match with the geneList.
)
searchBiogridIds: Optional[bool] = (
True # If ‘true’, the entries in 'GENELIST' will be compared to BIOGRID internal IDS which are provided in all Tab2 formatted files.
)
additionalIdentifierTypes: Optional[str] = (
"" # Identifier types on this list are examined for a match with the geneList.
)
excludeGenes: Optional[bool] = (
False # If ‘true’, interactions containing genes in the geneList will be excluded from the results.
)
includeInteractors: Optional[bool] = (
True # If ‘true’, in addition to interactions between genes on the geneList, interactions will also be fetched which have only one interactor on the geneList
)
includeInteractorInteractions: Optional[bool] = (
False # If ‘true’ interactions between the geneList’s first order interactors will be included.
)
pubmedList: Optional[str] = (
"" # Interactions will be fetched whose Pubmed Id is/ is not in this list, depending on the value of excludePubmeds.
)
excludePubmeds: Optional[bool] = (
False # If ‘false’, interactions with Pubmed ID in pubmedList will be included in the results; if ‘true’ they will be excluded.
)
htpThreshold: Optional[int] = (
20 # Interactions whose Pubmed ID has more than this number of interactions will be excluded from the results. Ignored if excludePubmeds is ‘false’.
)
throughputTag: Optional[str] = (
"any" # If set to 'low or 'high', only interactions with 'Low throughput' or 'High throughput' in the 'throughput' field will be returned.
)


class PPIGraphConfig(BaseModel):
Expand Down
1 change: 1 addition & 0 deletions graphein/ppi/edges.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Functions for adding edges to a PPI Graph from parsed STRING & BIOGRID API call outputs."""

# %%
# Graphein
# Author: Arian Jamasb <arian@jamasb.io>, Ramon Vinas
Expand Down
11 changes: 6 additions & 5 deletions graphein/ppi/features/node_features.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Functions for adding nodes features to a PPI Graph."""

# %%
# Graphein
# Author: Ramon Vinas, Arian Jamasb <arian@jamasb.io>
Expand Down Expand Up @@ -71,11 +72,11 @@ def add_sequence_to_nodes(n: str, d: Dict[str, Any]):

print(nx.get_node_attributes(g, "sequence"))
edge_colors = [
"r"
if g[u][v]["kind"] == {"string"}
else "b"
if g[u][v]["kind"] == {"biogrid"}
else "y"
(
"r"
if g[u][v]["kind"] == {"string"}
else "b" if g[u][v]["kind"] == {"biogrid"} else "y"
)
for u, v in g.edges()
]

Expand Down
1 change: 1 addition & 0 deletions graphein/ppi/graph_metadata.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Functions for adding metadata to PPI Graphs from STRING and BIOGRID."""

# %%
# Graphein
# Author: Arian Jamasb <arian@jamasb.io>, Ramon Vinas
Expand Down
Loading

0 comments on commit 6e0be18

Please sign in to comment.