diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index e0ce3c398..3958c7c36 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -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 diff --git a/graphein/cli.py b/graphein/cli.py index b02784beb..4d7e6f644 100644 --- a/graphein/cli.py +++ b/graphein/cli.py @@ -1,4 +1,5 @@ """Command line interface for graphein.""" + import pathlib import pickle diff --git a/graphein/grn/edges.py b/graphein/grn/edges.py index 936ab61ad..bc9d04bfd 100644 --- a/graphein/grn/edges.py +++ b/graphein/grn/edges.py @@ -1,4 +1,5 @@ """Functions for adding edges to Gene Regulatory Networks from various sources.""" + # %% # Graphein # Author: Arian Jamasb , Ramon Vinas diff --git a/graphein/grn/features/node_features.py b/graphein/grn/features/node_features.py index 290a075a0..7eff33ac0 100644 --- a/graphein/grn/features/node_features.py +++ b/graphein/grn/features/node_features.py @@ -1,4 +1,5 @@ """Node featurisation utilities for Gene Regulatory Networks.""" + from typing import Any, Dict from bioservices import HGNC, UniProt diff --git a/graphein/grn/graphs.py b/graphein/grn/graphs.py index 0fb18d54f..1bbf214e8 100644 --- a/graphein/grn/graphs.py +++ b/graphein/grn/graphs.py @@ -1,4 +1,5 @@ """Graph construction utilities for Gene Regulatory Networks.""" + # %% # Graphein # Author: Arian Jamasb , Ramon Vinas @@ -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() ] diff --git a/graphein/grn/parse_regnetwork.py b/graphein/grn/parse_regnetwork.py index 6f0d797e8..0d7e57877 100644 --- a/graphein/grn/parse_regnetwork.py +++ b/graphein/grn/parse_regnetwork.py @@ -1,4 +1,5 @@ """Functions for parsing GRNs from RegNetwork.""" + # %% # Graphein # Author: Ramon Vinas, Arian Jamasb diff --git a/graphein/grn/parse_trrust.py b/graphein/grn/parse_trrust.py index c4751c44c..42b0c23a9 100644 --- a/graphein/grn/parse_trrust.py +++ b/graphein/grn/parse_trrust.py @@ -1,4 +1,5 @@ """Utilities for parsing the TRRUST database.""" + # %% # Graphein # Author: Ramon Vinas, Arian Jamasb diff --git a/graphein/ml/conversion.py b/graphein/ml/conversion.py index 58dcf4160..2cb013d04 100644 --- a/graphein/ml/conversion.py +++ b/graphein/ml/conversion.py @@ -1,5 +1,6 @@ """Utilities for converting Graphein Networks to Geometric Deep Learning formats. """ + # %% # Graphein # Author: Kexin Huang, Arian Jamasb diff --git a/graphein/ml/datasets/foldcomp_dataset.py b/graphein/ml/datasets/foldcomp_dataset.py index e6f4693f7..8d0335184 100644 --- a/graphein/ml/datasets/foldcomp_dataset.py +++ b/graphein/ml/datasets/foldcomp_dataset.py @@ -1,4 +1,5 @@ """Utilities for loading FoldComp databases for deep learning.""" + # Graphein # Author: Arian Jamasb # License: MIT diff --git a/graphein/ml/datasets/torch_geometric_dataset.py b/graphein/ml/datasets/torch_geometric_dataset.py index e9e8b030b..b29a5dde9 100644 --- a/graphein/ml/datasets/torch_geometric_dataset.py +++ b/graphein/ml/datasets/torch_geometric_dataset.py @@ -1,4 +1,5 @@ """Pytorch Geometric Dataset classes for Protein Graphs.""" + # Graphein # Author: Arian Jamasb # License: MIT @@ -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 @@ -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: diff --git a/graphein/ml/diffusion.py b/graphein/ml/diffusion.py index 5357dbbe5..a3fea253f 100644 --- a/graphein/ml/diffusion.py +++ b/graphein/ml/diffusion.py @@ -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 diff --git a/graphein/ml/utils.py b/graphein/ml/utils.py index feb1c11ef..834bdae67 100644 --- a/graphein/ml/utils.py +++ b/graphein/ml/utils.py @@ -1,4 +1,5 @@ """ML utility Functions for working with graphs.""" + # Graphein # Author: Arian Jamasb # License: MIT diff --git a/graphein/ml/visualisation.py b/graphein/ml/visualisation.py index 1099c7d80..b79746453 100644 --- a/graphein/ml/visualisation.py +++ b/graphein/ml/visualisation.py @@ -1,4 +1,5 @@ """Visualisation utils for ML.""" + from __future__ import annotations import itertools diff --git a/graphein/molecule/atoms.py b/graphein/molecule/atoms.py index 313d8afd6..47202d533 100644 --- a/graphein/molecule/atoms.py +++ b/graphein/molecule/atoms.py @@ -5,6 +5,7 @@ These include various collections of standard atom types used molecule-focussed ML """ + # Graphein # Author: Eric J. Ma, Arian Jamasb # License: MIT diff --git a/graphein/molecule/chembl.py b/graphein/molecule/chembl.py index d16ef11d6..c5efb0cfa 100644 --- a/graphein/molecule/chembl.py +++ b/graphein/molecule/chembl.py @@ -1,4 +1,5 @@ """Functions for retrieving molecular data from ChEMBL.""" + from typing import Any, Dict import networkx as nx diff --git a/graphein/molecule/config.py b/graphein/molecule/config.py index dcb4f75e1..6eab99d82 100644 --- a/graphein/molecule/config.py +++ b/graphein/molecule/config.py @@ -1,4 +1,5 @@ """Base Config object for use with Molecule Graph Construction.""" + # Graphein # Author: Arian Jamasb # License: MIT diff --git a/graphein/molecule/edges/atomic.py b/graphein/molecule/edges/atomic.py index 677234bd9..4571fd7a3 100644 --- a/graphein/molecule/edges/atomic.py +++ b/graphein/molecule/edges/atomic.py @@ -1,4 +1,5 @@ """Functions for computing atomic structure of molecules.""" + import networkx as nx # %% diff --git a/graphein/molecule/features/edges/bonds.py b/graphein/molecule/features/edges/bonds.py index 4f78396e7..3ad8d645e 100644 --- a/graphein/molecule/features/edges/bonds.py +++ b/graphein/molecule/features/edges/bonds.py @@ -1,4 +1,5 @@ """Functions for computing atomic features for molecules.""" + # %% # Graphein # Author: Arian Jamasb diff --git a/graphein/molecule/features/graph/molecule.py b/graphein/molecule/features/graph/molecule.py index 04f3eebb0..8e6f086da 100644 --- a/graphein/molecule/features/graph/molecule.py +++ b/graphein/molecule/features/graph/molecule.py @@ -1,4 +1,5 @@ """Functions for featurising Small Molecule Graphs.""" + # %% # Graphein # Author: Arian Jamasb diff --git a/graphein/molecule/features/nodes/atom_type.py b/graphein/molecule/features/nodes/atom_type.py index 008f06ea8..911e60540 100644 --- a/graphein/molecule/features/nodes/atom_type.py +++ b/graphein/molecule/features/nodes/atom_type.py @@ -1,4 +1,5 @@ """Functions for featurising Small Molecule Graphs.""" + # %% # Graphein # Author: Arian Jamasb , Yuanqi Du diff --git a/graphein/molecule/graphs.py b/graphein/molecule/graphs.py index bf2c7dcf9..7f61e2f78 100644 --- a/graphein/molecule/graphs.py +++ b/graphein/molecule/graphs.py @@ -1,4 +1,5 @@ """Functions for working with Small Molecule Graphs.""" + # %% # Graphein # Author: Arian Jamasb , Eric Ma, Charlie Harris diff --git a/graphein/molecule/utils.py b/graphein/molecule/utils.py index 876e901f0..dfb38e2d4 100644 --- a/graphein/molecule/utils.py +++ b/graphein/molecule/utils.py @@ -4,6 +4,7 @@ Junction tree code adapted from Wengong Jin https://github.com/wengong-jin/icml18-jtnn """ + # Graphein # Author: Arian Jamasb # License: MIT diff --git a/graphein/molecule/visualisation.py b/graphein/molecule/visualisation.py index 9ccbfda2a..da2d497c2 100644 --- a/graphein/molecule/visualisation.py +++ b/graphein/molecule/visualisation.py @@ -2,6 +2,7 @@ Plotting functions for molecules wrap the methods defined on protein graphs and provide sane defaults. """ + # %% # Graphein # Author: Arian Jamasb diff --git a/graphein/molecule/zinc.py b/graphein/molecule/zinc.py index 93dabd6d9..dee6b7670 100644 --- a/graphein/molecule/zinc.py +++ b/graphein/molecule/zinc.py @@ -2,6 +2,7 @@ Adapted from smilite (https://github.com/rasbt/smilite) by Sebastian Raschka. """ + # Graphein # Author: Arian Jamasb # License: MIT diff --git a/graphein/ppi/config.py b/graphein/ppi/config.py index 1ab43f40b..426110503 100644 --- a/graphein/ppi/config.py +++ b/graphein/ppi/config.py @@ -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): @@ -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): diff --git a/graphein/ppi/edges.py b/graphein/ppi/edges.py index 2001e21af..6158ab18c 100644 --- a/graphein/ppi/edges.py +++ b/graphein/ppi/edges.py @@ -1,4 +1,5 @@ """Functions for adding edges to a PPI Graph from parsed STRING & BIOGRID API call outputs.""" + # %% # Graphein # Author: Arian Jamasb , Ramon Vinas diff --git a/graphein/ppi/features/node_features.py b/graphein/ppi/features/node_features.py index 9df9647c0..ee8779c03 100644 --- a/graphein/ppi/features/node_features.py +++ b/graphein/ppi/features/node_features.py @@ -1,4 +1,5 @@ """Functions for adding nodes features to a PPI Graph.""" + # %% # Graphein # Author: Ramon Vinas, Arian Jamasb @@ -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() ] diff --git a/graphein/ppi/graph_metadata.py b/graphein/ppi/graph_metadata.py index c4b93d00c..35710973d 100644 --- a/graphein/ppi/graph_metadata.py +++ b/graphein/ppi/graph_metadata.py @@ -1,4 +1,5 @@ """Functions for adding metadata to PPI Graphs from STRING and BIOGRID.""" + # %% # Graphein # Author: Arian Jamasb , Ramon Vinas diff --git a/graphein/ppi/graphs.py b/graphein/ppi/graphs.py index ac619d284..db8489f04 100644 --- a/graphein/ppi/graphs.py +++ b/graphein/ppi/graphs.py @@ -1,4 +1,5 @@ """Functions for constructing a PPI PPIGraphConfig from STRINGdb and BIOGRID.""" + # %% # Graphein # Author: Arian Jamasb , Ramon Vinas @@ -150,11 +151,11 @@ def compute_ppi_graph( ) 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() ] diff --git a/graphein/ppi/parse_biogrid.py b/graphein/ppi/parse_biogrid.py index 6b84fd553..a1f979b59 100644 --- a/graphein/ppi/parse_biogrid.py +++ b/graphein/ppi/parse_biogrid.py @@ -1,4 +1,5 @@ """Functions for making and parsing API calls to BIOGRID.""" + # %% # Graphein # Author: Ramon Vinas, Arian Jamasb @@ -68,7 +69,7 @@ def params_BIOGRID( "htpThreshold", # Interactions whose Pubmed ID has more than this # number of interactions will be excluded from the results. Ignored if # excludePubmeds is ‘false’. - "throughputTag" # If set to 'low or 'high', only interactions with + "throughputTag", # If set to 'low or 'high', only interactions with # 'Low throughput' or 'High throughput' in the 'throughput' field # will be returned. ] diff --git a/graphein/ppi/parse_stringdb.py b/graphein/ppi/parse_stringdb.py index 392ee4f46..e31c2c5b7 100644 --- a/graphein/ppi/parse_stringdb.py +++ b/graphein/ppi/parse_stringdb.py @@ -1,4 +1,5 @@ """Functions for making and parsing API calls to STRINGdb.""" + # %% # Graphein # Author: Ramon Vinas, Arian Jamasb @@ -37,7 +38,7 @@ def params_STRING( "add_nodes", # 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" # when available use submitted names in the + "show_query_node_labels", # when available use submitted names in the # preferredName column when # (0 or 1) (default:0) ] diff --git a/graphein/ppi/visualisation.py b/graphein/ppi/visualisation.py index 4ac44ebd2..e8c354286 100644 --- a/graphein/ppi/visualisation.py +++ b/graphein/ppi/visualisation.py @@ -1,4 +1,5 @@ """Contains utilities for plotting PPI NetworkX graphs.""" + # %% # Graphein # Author: Arian Jamasb @@ -29,11 +30,11 @@ def plot_ppi_graph( """ if colour_edges_by == "kind": 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() ] else: diff --git a/graphein/protein/__init__.py b/graphein/protein/__init__.py index cbc8e50dc..294f6850a 100644 --- a/graphein/protein/__init__.py +++ b/graphein/protein/__init__.py @@ -1,4 +1,5 @@ """Protein graph construction module.""" + from .config import * from .edges import * from .features import * diff --git a/graphein/protein/analysis.py b/graphein/protein/analysis.py index 398973899..c6f68128f 100644 --- a/graphein/protein/analysis.py +++ b/graphein/protein/analysis.py @@ -1,4 +1,5 @@ """Contains utilities for computing analytics on and plotting summaries of Protein Structure Graphs.""" + # %% # Graphein # Author: Arian Jamasb diff --git a/graphein/protein/config.py b/graphein/protein/config.py index 3c9c7917a..cf1e66c39 100644 --- a/graphein/protein/config.py +++ b/graphein/protein/config.py @@ -1,4 +1,5 @@ """Base Config object for use with Protein Graph Construction.""" + # Graphein # Author: Arian Jamasb # License: MIT diff --git a/graphein/protein/edges/atomic.py b/graphein/protein/edges/atomic.py index 68f453ada..a51b56696 100644 --- a/graphein/protein/edges/atomic.py +++ b/graphein/protein/edges/atomic.py @@ -1,4 +1,5 @@ """Functions for computing atomic structure of proteins.""" + # %% # Graphein # Author: Arian Jamasb diff --git a/graphein/protein/edges/distance.py b/graphein/protein/edges/distance.py index eae90c04e..e22df57d6 100644 --- a/graphein/protein/edges/distance.py +++ b/graphein/protein/edges/distance.py @@ -1,4 +1,5 @@ """Functions for computing biochemical edges of graphs.""" + # Graphein # Author: Eric Ma, Arian Jamasb # License: MIT diff --git a/graphein/protein/edges/intramolecular.py b/graphein/protein/edges/intramolecular.py index 168c7e847..89e6ce6bf 100644 --- a/graphein/protein/edges/intramolecular.py +++ b/graphein/protein/edges/intramolecular.py @@ -1,4 +1,5 @@ """Featurization functions for graph edges.""" + # Graphein # Author: Arian Jamasb , Eric Ma, Charlie Harris # License: MIT diff --git a/graphein/protein/features/graph/structure.py b/graphein/protein/features/graph/structure.py index 2b3b980fa..aec300110 100644 --- a/graphein/protein/features/graph/structure.py +++ b/graphein/protein/features/graph/structure.py @@ -1,4 +1,5 @@ """Functions for computing graph-level features based on structure.""" + # %% # Graphein # Author: Arian Jamasb diff --git a/graphein/protein/features/nodes/aaindex.py b/graphein/protein/features/nodes/aaindex.py index 34f12711a..c8871542c 100644 --- a/graphein/protein/features/nodes/aaindex.py +++ b/graphein/protein/features/nodes/aaindex.py @@ -1,4 +1,5 @@ """Functions for adding node features from AAIndex.""" + from typing import Dict, Tuple import networkx as nx diff --git a/graphein/protein/features/nodes/amino_acid.py b/graphein/protein/features/nodes/amino_acid.py index 0c0eaca65..b32dbbdbc 100644 --- a/graphein/protein/features/nodes/amino_acid.py +++ b/graphein/protein/features/nodes/amino_acid.py @@ -1,4 +1,5 @@ """Featurization functions for amino acids.""" + # Graphein # Author: Arian Jamasb , Eric Ma # License: MIT diff --git a/graphein/protein/features/nodes/dssp.py b/graphein/protein/features/nodes/dssp.py index d68615b2f..b73f26c9f 100644 --- a/graphein/protein/features/nodes/dssp.py +++ b/graphein/protein/features/nodes/dssp.py @@ -1,4 +1,5 @@ """Featurization functions for graph nodes using DSSP predicted features.""" + # Graphein # Author: Arian Jamasb , Charlie Harris # License: MIT diff --git a/graphein/protein/features/nodes/geometry.py b/graphein/protein/features/nodes/geometry.py index b24c0880a..2e7b04f10 100644 --- a/graphein/protein/features/nodes/geometry.py +++ b/graphein/protein/features/nodes/geometry.py @@ -1,4 +1,5 @@ """Provides geometry-based featurisation functions.""" + # Graphein # Author: Arian Jamasb # License: MIT diff --git a/graphein/protein/features/sequence/embeddings.py b/graphein/protein/features/sequence/embeddings.py index 543237a47..914bcf850 100644 --- a/graphein/protein/features/sequence/embeddings.py +++ b/graphein/protein/features/sequence/embeddings.py @@ -1,5 +1,6 @@ """Functions to add embeddings from pre-trained language models protein structure graphs.""" + # Graphein # Author: Arian Jamasb # License: MIT diff --git a/graphein/protein/features/sequence/propy.py b/graphein/protein/features/sequence/propy.py index 01a869df7..5f6460900 100644 --- a/graphein/protein/features/sequence/propy.py +++ b/graphein/protein/features/sequence/propy.py @@ -1,4 +1,5 @@ """Sequence featurisation functions wrapping ProPy.""" + # %% # Graphein # Author: Arian Jamasb , Eric Ma diff --git a/graphein/protein/features/sequence/sequence.py b/graphein/protein/features/sequence/sequence.py index 323f0c580..7a1961137 100644 --- a/graphein/protein/features/sequence/sequence.py +++ b/graphein/protein/features/sequence/sequence.py @@ -1,5 +1,6 @@ """Functions for graph-level featurization of the sequence of a protein. This submodule is focussed on physicochemical proporties of the sequence.""" + # %% # Graphein # Author: Arian Jamasb , Eric Ma diff --git a/graphein/protein/features/sequence/utils.py b/graphein/protein/features/sequence/utils.py index d64204296..92b8c3c15 100644 --- a/graphein/protein/features/sequence/utils.py +++ b/graphein/protein/features/sequence/utils.py @@ -1,4 +1,5 @@ """Utility functions for sequence-based featurisation.""" + # Graphein # Author: Arian Jamasb # License: MIT diff --git a/graphein/protein/features/utils.py b/graphein/protein/features/utils.py index 5020a7a86..8aaf0da83 100644 --- a/graphein/protein/features/utils.py +++ b/graphein/protein/features/utils.py @@ -1,4 +1,5 @@ """Utility functions to work with graph-level features.""" + # Graphein # Author: Arian Jamasb # License: MIT diff --git a/graphein/protein/folding_utils.py b/graphein/protein/folding_utils.py index 54f579a0c..e2c12cc0f 100644 --- a/graphein/protein/folding_utils.py +++ b/graphein/protein/folding_utils.py @@ -9,6 +9,7 @@ pip install 'openfold @ git+https://github.com/aqlaboratory/openfold.git@4b41059694619831a7db195b7e0988fc4ff3a307' """ + import os import subprocess from functools import lru_cache diff --git a/graphein/protein/graphs.py b/graphein/protein/graphs.py index bd09578e4..5ab97bcc7 100644 --- a/graphein/protein/graphs.py +++ b/graphein/protein/graphs.py @@ -1,4 +1,5 @@ """Functions for working with Protein Structure Graphs.""" + # %% # Graphein # Author: Arian Jamasb , Eric Ma, Charlie Harris diff --git a/graphein/protein/meshes.py b/graphein/protein/meshes.py index 167e1523e..a37d2b0f5 100644 --- a/graphein/protein/meshes.py +++ b/graphein/protein/meshes.py @@ -1,4 +1,5 @@ """Functions to create protein meshes via pymol.""" + # Graphein # Author: Arian Jamasb # License: MIT diff --git a/graphein/protein/resi_atoms.py b/graphein/protein/resi_atoms.py index 3bb74d089..65251ee58 100644 --- a/graphein/protein/resi_atoms.py +++ b/graphein/protein/resi_atoms.py @@ -7,6 +7,7 @@ We also include mappings of covalent radii and bond lengths for the amino acids used in assembling atomic protein graphs. """ + # Graphein # Author: Eric J. Ma, Arian Jamasb # License: MIT diff --git a/graphein/protein/subgraphs.py b/graphein/protein/subgraphs.py index f532a3673..bd042064e 100644 --- a/graphein/protein/subgraphs.py +++ b/graphein/protein/subgraphs.py @@ -1,4 +1,5 @@ """Provides functions for extracting subgraphs from protein graphs.""" + # Graphein # Author: Arian Jamasb # License: MIT diff --git a/graphein/protein/tensor/__init__.py b/graphein/protein/tensor/__init__.py index 16ddc5352..4a25e99dc 100644 --- a/graphein/protein/tensor/__init__.py +++ b/graphein/protein/tensor/__init__.py @@ -1,4 +1,5 @@ """Utilities for manipulating tensor representations of proteins.""" + # Graphein # Author: Arian Jamasb # License: MIT diff --git a/graphein/protein/tensor/angles.py b/graphein/protein/tensor/angles.py index 499d1bade..e587cfb40 100644 --- a/graphein/protein/tensor/angles.py +++ b/graphein/protein/tensor/angles.py @@ -1,4 +1,5 @@ """Utilities for computing various protein angles.""" + # Graphein # Author: Arian Jamasb # License: MIT diff --git a/graphein/protein/tensor/data.py b/graphein/protein/tensor/data.py index 43d460fba..2a1697b44 100644 --- a/graphein/protein/tensor/data.py +++ b/graphein/protein/tensor/data.py @@ -1,4 +1,5 @@ """Data and Batch Objects for working proteins in PyTorch Geometric""" + import itertools import random import traceback @@ -901,20 +902,22 @@ def from_pdb_codes( proteins = [ Protein().from_pdb_code( pdb_code=pdb, - chain_selection=chain_selection[i] - if chain_selection is not None - else "all", + chain_selection=( + chain_selection[i] + if chain_selection is not None + else "all" + ), deprotonate=deprotonate, keep_insertions=keep_insertions, keep_hets=keep_hets, model_index=model_index[i] if model_index is not None else 1, atom_types=atom_types, - node_labels=node_labels[i] - if node_labels is not None - else None, - graph_labels=graph_labels[i] - if graph_labels is not None - else None, + node_labels=( + node_labels[i] if node_labels is not None else None + ), + graph_labels=( + graph_labels[i] if graph_labels is not None else None + ), ) for i, pdb in enumerate(pdb_codes) ] @@ -937,20 +940,22 @@ def from_pdb_files( proteins = [ Protein().from_pdb_file( path=pdb, - chain_selection=chain_selection[i] - if chain_selection is not None - else "all", + chain_selection=( + chain_selection[i] + if chain_selection is not None + else "all" + ), deprotonate=deprotonate, keep_insertions=keep_insertions, keep_hets=keep_hets, model_index=model_index[i] if model_index is not None else 1, atom_types=atom_types, - node_labels=node_labels[i] - if node_labels is not None - else None, - graph_labels=graph_labels[i] - if graph_labels is not None - else None, + node_labels=( + node_labels[i] if node_labels is not None else None + ), + graph_labels=( + graph_labels[i] if graph_labels is not None else None + ), ) for i, pdb in enumerate(paths) ] diff --git a/graphein/protein/tensor/dataset.py b/graphein/protein/tensor/dataset.py index e32bd4862..584e41c71 100644 --- a/graphein/protein/tensor/dataset.py +++ b/graphein/protein/tensor/dataset.py @@ -1,4 +1,5 @@ """Pytorch Geometric Dataset classes for Protein Graphs.""" + # Graphein # Author: Arian Jamasb # License: MIT diff --git a/graphein/protein/tensor/edges.py b/graphein/protein/tensor/edges.py index 91d62d3c9..269e872c6 100644 --- a/graphein/protein/tensor/edges.py +++ b/graphein/protein/tensor/edges.py @@ -1,4 +1,5 @@ """Utilities for computing edges.""" + from typing import Optional from loguru import logger as log diff --git a/graphein/protein/tensor/geometry.py b/graphein/protein/tensor/geometry.py index d39849034..6d252ca0b 100644 --- a/graphein/protein/tensor/geometry.py +++ b/graphein/protein/tensor/geometry.py @@ -1,4 +1,5 @@ """Utilities for manipulating protein geometry.""" + import copy # Graphein diff --git a/graphein/protein/tensor/io.py b/graphein/protein/tensor/io.py index 567e8c5fd..eeaa93e45 100644 --- a/graphein/protein/tensor/io.py +++ b/graphein/protein/tensor/io.py @@ -1,4 +1,5 @@ """Utilities for parsing proteins into and out of tensors.""" + # Graphein # Author: Arian Jamasb # License: MIT diff --git a/graphein/protein/tensor/plot.py b/graphein/protein/tensor/plot.py index e83064ff4..dc07bfb45 100644 --- a/graphein/protein/tensor/plot.py +++ b/graphein/protein/tensor/plot.py @@ -2,6 +2,7 @@ All plots are produced with Plotly and so are loggable to Weights and Biases. """ + # Graphein # Author: Arian Jamasb # License: MIT diff --git a/graphein/protein/tensor/pnerf.py b/graphein/protein/tensor/pnerf.py index 1f5706ce8..3ca911212 100644 --- a/graphein/protein/tensor/pnerf.py +++ b/graphein/protein/tensor/pnerf.py @@ -10,6 +10,7 @@ PyTorch implementation modifield from the implementation by Felix Opolka: https://github.com/FelixOpolka/pnerf-pytorch """ + import collections import math from typing import Optional diff --git a/graphein/protein/tensor/representation.py b/graphein/protein/tensor/representation.py index b4cd4ece1..5bbf1426c 100644 --- a/graphein/protein/tensor/representation.py +++ b/graphein/protein/tensor/representation.py @@ -1,4 +1,5 @@ """Utility functions for converting between representations of protein structures.""" + # Graphein # Author: Arian Jamasb # License: MIT diff --git a/graphein/protein/tensor/sequence.py b/graphein/protein/tensor/sequence.py index 2491497d0..5f53c0e7a 100644 --- a/graphein/protein/tensor/sequence.py +++ b/graphein/protein/tensor/sequence.py @@ -1,4 +1,5 @@ """Utilities for working with protein sequences.""" + # Graphein # Author: Arian Jamasb # License: MIT diff --git a/graphein/protein/tensor/testing.py b/graphein/protein/tensor/testing.py index 2a04212f9..9bb62f73f 100644 --- a/graphein/protein/tensor/testing.py +++ b/graphein/protein/tensor/testing.py @@ -1,4 +1,5 @@ """Utilities for sanity checking protein tensors.""" + from functools import partial from typing import List, Tuple, Union diff --git a/graphein/protein/tensor/types.py b/graphein/protein/tensor/types.py index 4559d3ca7..82fd7663e 100644 --- a/graphein/protein/tensor/types.py +++ b/graphein/protein/tensor/types.py @@ -2,6 +2,7 @@ Graphein provides many types for commonly used tensors of specific shapes. """ + # Graphein # Author: Arian Jamasb # License: MIT diff --git a/graphein/protein/utils.py b/graphein/protein/utils.py index eef07ab64..5277ea80d 100644 --- a/graphein/protein/utils.py +++ b/graphein/protein/utils.py @@ -1,4 +1,5 @@ """Provides utility functions for use across Graphein.""" + # Graphein # Author: Arian Jamasb # License: MIT diff --git a/graphein/protein/visualisation.py b/graphein/protein/visualisation.py index b77b32ebd..d02bd8dd6 100644 --- a/graphein/protein/visualisation.py +++ b/graphein/protein/visualisation.py @@ -1,4 +1,5 @@ """Functions for plotting protein graphs and meshes.""" + # Graphein # Author: Arian Jamasb # License: MIT diff --git a/graphein/rna/config.py b/graphein/rna/config.py index 0c2960451..1b5c01474 100644 --- a/graphein/rna/config.py +++ b/graphein/rna/config.py @@ -1,4 +1,5 @@ """Base Config object for use with RNA Graph Construction.""" + # Graphein # Author: Arian Jamasb # License: MIT diff --git a/graphein/rna/constants.py b/graphein/rna/constants.py index b95b490ed..9211d5f3c 100644 --- a/graphein/rna/constants.py +++ b/graphein/rna/constants.py @@ -1,4 +1,5 @@ """Constants for working with RNA Secondary Structure Graphs.""" + # %% # Graphein # Author: Arian Jamasb diff --git a/graphein/rna/edges/atomic.py b/graphein/rna/edges/atomic.py index ad36dff6a..6947b54c2 100644 --- a/graphein/rna/edges/atomic.py +++ b/graphein/rna/edges/atomic.py @@ -1,4 +1,5 @@ """Functions for computing atomic structure of proteins.""" + # %% # Graphein # Author: Arian Jamasb diff --git a/graphein/rna/edges/base_pairing.py b/graphein/rna/edges/base_pairing.py index b75dab83e..c51c7e18e 100644 --- a/graphein/rna/edges/base_pairing.py +++ b/graphein/rna/edges/base_pairing.py @@ -1,4 +1,5 @@ """Functions to compute edges for an RNA secondary structure graph.""" + # %% # Graphein # Author: Arian Jamasb , Emmanuele Rossi, Eric Ma diff --git a/graphein/rna/features/atom.py b/graphein/rna/features/atom.py index 6e51ab7e4..92d654dba 100644 --- a/graphein/rna/features/atom.py +++ b/graphein/rna/features/atom.py @@ -1,4 +1,5 @@ """Functions for featurising RNA Structure Graphs.""" + # %% # Graphein # Author: Arian Jamasb diff --git a/graphein/rna/graphs.py b/graphein/rna/graphs.py index c81604ee7..ce590e563 100644 --- a/graphein/rna/graphs.py +++ b/graphein/rna/graphs.py @@ -1,4 +1,5 @@ """Functions for working with RNA Secondary Structure Graphs.""" + # %% # Graphein # Author: Arian Jamasb , Emmanuele Rossi, Eric Ma diff --git a/graphein/rna/nussinov.py b/graphein/rna/nussinov.py index d1b7548fd..73d95d5f5 100644 --- a/graphein/rna/nussinov.py +++ b/graphein/rna/nussinov.py @@ -1,5 +1,6 @@ """Nussinov algorithm for computing RNA secondary structure adopted from adopted from https://github.com/cgoliver/Nussinov/blob/master/nussinov.py """ + # %% # Graphein # Author: Arian Jamasb , Ryan Greenhalgh diff --git a/graphein/rna/subgraphs.py b/graphein/rna/subgraphs.py index 94fa5cb80..acb1cab5f 100644 --- a/graphein/rna/subgraphs.py +++ b/graphein/rna/subgraphs.py @@ -1,4 +1,5 @@ """Provides functions for extracting subgraphs from RNA graphs.""" + # Graphein # Author: Arian Jamasb # License: MIT diff --git a/graphein/rna/utils.py b/graphein/rna/utils.py index b0f60c1f8..042f5021f 100644 --- a/graphein/rna/utils.py +++ b/graphein/rna/utils.py @@ -1,4 +1,5 @@ """Utility Functions for working with RNA Secondary Structure Graphs.""" + import os import shutil from typing import Tuple diff --git a/graphein/rna/visualisation.py b/graphein/rna/visualisation.py index 77b4b0af9..3aa3b8852 100644 --- a/graphein/rna/visualisation.py +++ b/graphein/rna/visualisation.py @@ -1,4 +1,5 @@ """Visualisation utilities for RNA Secondary Structure Graphs.""" + # %% # Graphein # Author: Arian Jamasb diff --git a/graphein/testing/utils.py b/graphein/testing/utils.py index 821422f8f..bea5e0b10 100644 --- a/graphein/testing/utils.py +++ b/graphein/testing/utils.py @@ -1,4 +1,5 @@ """Testing utilities for the Graphein library.""" + # %% # Graphein # Author: Arian Jamasb diff --git a/graphein/utils/config.py b/graphein/utils/config.py index 155531879..813873788 100644 --- a/graphein/utils/config.py +++ b/graphein/utils/config.py @@ -1,4 +1,5 @@ """Yaml parser for config objects""" + from functools import partial from deepdiff.operator import BaseOperator diff --git a/graphein/utils/config_parser.py b/graphein/utils/config_parser.py index 1d3973b4a..bcb4ef0c7 100644 --- a/graphein/utils/config_parser.py +++ b/graphein/utils/config_parser.py @@ -1,4 +1,5 @@ """Yaml parser for config objects""" + from functools import partial from pathlib import Path from typing import Callable, Union diff --git a/graphein/utils/utils.py b/graphein/utils/utils.py index 069889527..9448d25fa 100644 --- a/graphein/utils/utils.py +++ b/graphein/utils/utils.py @@ -1,4 +1,5 @@ """Utilities for working with graph objects.""" + # Graphein # Author: Arian Jamasb , Eric Ma # License: MIT diff --git a/tests/ml/test_conversion.py b/tests/ml/test_conversion.py index 484381614..60f212bd2 100644 --- a/tests/ml/test_conversion.py +++ b/tests/ml/test_conversion.py @@ -1,4 +1,5 @@ """Tests for graph format conversion procedures.""" + from functools import partial import pytest diff --git a/tests/ml/test_torch_geometric_dataset.py b/tests/ml/test_torch_geometric_dataset.py index 68c9f99f8..a5ff76757 100644 --- a/tests/ml/test_torch_geometric_dataset.py +++ b/tests/ml/test_torch_geometric_dataset.py @@ -1,4 +1,5 @@ """Tests for PyTorch Geometric Dataset constructors.""" + import os import shutil from pathlib import Path diff --git a/tests/ppi/test_graphs.py b/tests/ppi/test_graphs.py index 1526e4db0..10b3390cc 100644 --- a/tests/ppi/test_graphs.py +++ b/tests/ppi/test_graphs.py @@ -1,4 +1,5 @@ """Tests for graphein.ppi.graphs""" + import bioservices import pytest diff --git a/tests/protein/edges/test_distance.py b/tests/protein/edges/test_distance.py index 141224a98..c3be2c6de 100644 --- a/tests/protein/edges/test_distance.py +++ b/tests/protein/edges/test_distance.py @@ -1,4 +1,5 @@ """Functions for working with Protein Structure Graphs. Based on tests written by Eric Ma in PIN Library""" + import copy from functools import partial diff --git a/tests/protein/nodes/features/test_amino_acid.py b/tests/protein/nodes/features/test_amino_acid.py index 15b9794a2..276c73e9d 100644 --- a/tests/protein/nodes/features/test_amino_acid.py +++ b/tests/protein/nodes/features/test_amino_acid.py @@ -1,4 +1,5 @@ """Tests for graphein.protein.features.nodes.amino_acids""" + # Graphein # Author: Arian Jamasb , Eric Ma # License: MIT diff --git a/tests/protein/nodes/features/test_geometry.py b/tests/protein/nodes/features/test_geometry.py index b23eb4314..216287a4b 100644 --- a/tests/protein/nodes/features/test_geometry.py +++ b/tests/protein/nodes/features/test_geometry.py @@ -1,4 +1,5 @@ """Tests for graphein.protein.features.nodes.geometry""" + # Graphein # Author: Arian Jamasb , Eric Ma # License: MIT diff --git a/tests/protein/tensor/test_angles.py b/tests/protein/tensor/test_angles.py index a9118fab0..45fa7ad2e 100644 --- a/tests/protein/tensor/test_angles.py +++ b/tests/protein/tensor/test_angles.py @@ -1,4 +1,5 @@ """Tests for graphein.protein.tensor.angles.""" + import math import numpy as np diff --git a/tests/protein/tensor/test_geometry.py b/tests/protein/tensor/test_geometry.py index 5aa37c29f..b499663bf 100644 --- a/tests/protein/tensor/test_geometry.py +++ b/tests/protein/tensor/test_geometry.py @@ -1,4 +1,5 @@ """Tests for graphein.protein.tensor.geometry.""" + # Graphein # Author: Arian Jamasb # License: MIT diff --git a/tests/protein/tensor/test_io.py b/tests/protein/tensor/test_io.py index 485692c82..bb1806e0a 100644 --- a/tests/protein/tensor/test_io.py +++ b/tests/protein/tensor/test_io.py @@ -1,4 +1,5 @@ """Tests for graphein.protein.tensor.io""" + # Graphein # Author: Arian Jamasb # License: MIT diff --git a/tests/protein/tensor/test_reconstruction.py b/tests/protein/tensor/test_reconstruction.py index cebff41b8..e9e7f2f1a 100644 --- a/tests/protein/tensor/test_reconstruction.py +++ b/tests/protein/tensor/test_reconstruction.py @@ -1,4 +1,5 @@ """Tests for graphein.protein.tensor.reconstruction.""" + # Graphein # Author: Arian Jamasb # License: MIT diff --git a/tests/protein/tensor/test_representation.py b/tests/protein/tensor/test_representation.py index 2b8a2e2c4..1968a6587 100644 --- a/tests/protein/tensor/test_representation.py +++ b/tests/protein/tensor/test_representation.py @@ -1,4 +1,5 @@ """Tests for graphein.protein.tensor.representation.""" + # Graphein # Author: Arian Jamasb # License: MIT diff --git a/tests/protein/tensor/test_sequence.py b/tests/protein/tensor/test_sequence.py index 45738b651..3b077f482 100644 --- a/tests/protein/tensor/test_sequence.py +++ b/tests/protein/tensor/test_sequence.py @@ -1,4 +1,5 @@ """Tests for graphein.protein.tensor.sequence.""" + # Graphein # Author: Arian Jamasb # License: MIT diff --git a/tests/protein/test_subgraphs.py b/tests/protein/test_subgraphs.py index a293ad75d..e9ee3fae8 100644 --- a/tests/protein/test_subgraphs.py +++ b/tests/protein/test_subgraphs.py @@ -1,4 +1,5 @@ """Tests for graphein.protein.subgraphs""" + # Graphein # Author: Arian Jamasb # License: MIT diff --git a/tests/rna/test_subgraphs.py b/tests/rna/test_subgraphs.py index 7b4f43180..8e779efdf 100644 --- a/tests/rna/test_subgraphs.py +++ b/tests/rna/test_subgraphs.py @@ -1,4 +1,5 @@ """Tests for graphein.rna.subgraphs""" + # Graphein # Author: Arian Jamasb # License: MIT diff --git a/tests/testing/utils.py b/tests/testing/utils.py index 3d1cd0347..ab95656d5 100644 --- a/tests/testing/utils.py +++ b/tests/testing/utils.py @@ -1,4 +1,5 @@ """Tests for graphein.testing.utils""" + # Graphein # Author: Arian Jamasb # License: MIT diff --git a/tests/utils/test_cli.py b/tests/utils/test_cli.py index 091efb34c..0f3b56163 100644 --- a/tests/utils/test_cli.py +++ b/tests/utils/test_cli.py @@ -1,4 +1,5 @@ """Tests for graphein.cli""" + import pickle import tempfile from pathlib import Path diff --git a/tests/utils/test_yml_parser.py b/tests/utils/test_yml_parser.py index ace44d29b..e9592405e 100644 --- a/tests/utils/test_yml_parser.py +++ b/tests/utils/test_yml_parser.py @@ -1,4 +1,5 @@ """Tests for graphein.utils.config""" + from functools import partial from pathlib import Path