Skip to content

Commit

Permalink
more flake8 fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
sarahbeenie committed Nov 14, 2019
1 parent 97005f0 commit e9858ca
Show file tree
Hide file tree
Showing 6 changed files with 11 additions and 13 deletions.
2 changes: 1 addition & 1 deletion src/pathme/normalize_names.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@

from pathme.constants import REACTOME, WIKIPATHWAYS
from pathme.pybel_utils import multi_relabel
from pybel import BELGraph

from pybel import BELGraph
from pybel.dsl import Abundance, BiologicalProcess, CentralDogma, ListAbundance, Reaction, MicroRna, Protein

logger = logging.getLogger(__name__)
Expand Down
3 changes: 1 addition & 2 deletions src/pathme/pybel_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,14 +7,13 @@

from pybel import BELGraph
from pybel.dsl import BaseEntity

from pybel_tools.node_utils import list_abundance_cartesian_expansion, reaction_cartesian_expansion

logger = logging.getLogger(__name__)


def flatten_complex_nodes(graph: BELGraph) -> None:
"""Flatten complex nodes"""
"""Flatten complex nodes."""
logger.info("Flat complexes and composites")
list_abundance_cartesian_expansion(graph)
reaction_cartesian_expansion(graph)
Expand Down
8 changes: 4 additions & 4 deletions src/pathme/reactome/rdf_sparql.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,10 @@
from pathme.constants import REACTOME_BEL
from pathme.reactome.convert_to_bel import convert_to_bel
from pathme.utils import get_pathway_statitics, parse_rdf, query_result_to_dict

from pybel import to_pickle
from rdflib import URIRef
from rdflib.namespace import DC, DCTERMS, Namespace, OWL, RDF, RDFS, SKOS, XSD

from tqdm import tqdm

log = logging.getLogger(__name__)
Expand Down Expand Up @@ -232,9 +232,9 @@ def _get_pathway_components(pathway_uri: rdflib.URIRef, rdf_graph: rdflib.Graph)
Dict[str, Dict[str, Union[str, Set[str]]]], List[Dict[str, Union[str, Set[str]]]]]:
"""Get components (nodes and interactions) for a given pathway.
:param pathway_uri: URI reference of the queried pathway
:param rdf_graph: RDF Reactome Universe graph object
:return: returns the pathway components as entities (Proteins, Complex, SmallMolecule...) and proteins (their links)
:param pathway_uri: URI reference of the queried pathway
:param rdf_graph: RDF Reactome Universe graph object
:return: returns the pathway components as entities (Proteins, Complex, SmallMolecule...) and proteins (their links)
"""
interactions = {}
nodes = {}
Expand Down
4 changes: 2 additions & 2 deletions src/pathme/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -195,7 +195,7 @@ def query_result_to_dict(entries, **kwargs) -> Dict[str, Dict[str, Dict[str, str
else:
entries_dict[id_key][label] = new_value

if len(entries_dict) == 1 and kwargs.get('id_dict') == False:
if len(entries_dict) == 1 and kwargs.get('id_dict') is False:
return list(entries_dict.values())[0]

elif not entries and 'attr_empty' in kwargs:
Expand All @@ -206,7 +206,7 @@ def query_result_to_dict(entries, **kwargs) -> Dict[str, Dict[str, Dict[str, str
for attr in attr_empty
}

if kwargs.get('ids_argument') == True:
if kwargs.get('ids_argument') is True:
return entries_dict_ids_argument(entries_dict)

else:
Expand Down
1 change: 1 addition & 0 deletions src/pathme/wikipathways/convert_to_bel.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
from bio2bel_hgnc import Manager
from pybel import BELGraph
from pybel.dsl import BaseEntity, abundance, activity, bioprocess, complex_abundance, gene, protein, rna

from .utils import check_multiple, evaluate_wikipathways_metadata, get_valid_gene_identifier
from ..constants import ACTIVITY_ALLOWED_MODIFIERS, HGNC
from ..utils import add_bel_metadata, parse_id_uri
Expand Down
6 changes: 2 additions & 4 deletions src/pathme/wikipathways/rdf_sparql.py
Original file line number Diff line number Diff line change
Expand Up @@ -76,12 +76,10 @@
?uri_id rdf:type ?uri_type .
optional {?uri_id dcterms:identifier ?dc_identifier .}
optional {?uri_id wp:bdbHgncSymbol ?hgnc_uri .}
optional {?uri_id wp:bdbEnsembl ?ensembl_uri .}
optional {?uri_id wp:bdbEntrezGene ?ncbigene_uri .}
optional {?uri_id wp:bdbUniprot ?uniprot_uri .}
optional {?uri_id wp:bdbChEBI ?chebi_uri .}
optional {?uri_id wp:bdbChemspider ?chemspider_uri .}
optional {?uri_id wp:bdbPubChem ?pubchem_uri .}
Expand Down Expand Up @@ -202,7 +200,7 @@ def _get_interactions(rdf_graph: rdflib.Graph) -> Dict[str, Dict]:


def _get_pathway_components(graph) -> Tuple[
Dict[str, Dict[str, Dict[str, str]]], Dict[str, Dict[str, Dict[str, str]]], Dict[str, Dict[str, Dict[str, str]]]]:
Dict[str, Dict[str, Dict[str, str]]], Dict[str, Dict[str, Dict[str, str]]], Dict[str, Dict[str, Dict[str, str]]]]:
"""Get all components in data structures from a RDF pathway network.
:param graph: RDF graph object
Expand All @@ -215,7 +213,7 @@ def _get_pathway_components(graph) -> Tuple[


def get_wp_statistics(resource_files, resource_folder, hgnc_manager) -> Tuple[
Dict[str, Dict[str, int]], Dict[str, Dict[str, Dict[str, int]]]]:
Dict[str, Dict[str, int]], Dict[str, Dict[str, Dict[str, int]]]]:
"""Load WikiPathways RDF to BELGraph.
:param iter[str] resource_files: RDF file path
Expand Down

0 comments on commit e9858ca

Please sign in to comment.