Skip to content

Commit

Permalink
Change warnings to debug
Browse files Browse the repository at this point in the history
  • Loading branch information
ddomingof committed Oct 7, 2018
1 parent bd108ed commit 60ad2fe
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 16 deletions.
4 changes: 2 additions & 2 deletions src/pathme/cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -136,7 +136,7 @@ def to_bel(connection, debug, only_canonical):
if debug:
log.setLevel(logging.DEBUG)

logging.warning = CallCounted(logging.warning)
logging.debug = CallCounted(logging.debug)

log.info('Initiating HGNC Manager')
hgnc_manager = HgncManager()
Expand All @@ -153,7 +153,7 @@ def to_bel(connection, debug, only_canonical):
log.info(
'WikiPathways exported in %.2f seconds. A total of {} warnings regarding entities that could not be converted '
'to standard identifiers were found.',
time.time() - t, logging.warning.counter
time.time() - t, logging.debug.counter
)


Expand Down
8 changes: 4 additions & 4 deletions src/pathme/wikipathways/convert_to_bel.py
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,7 @@ def node_to_bel(node: Dict, hgnc_manager: Manager) -> BaseEntity:
return abundance(namespace=namespace, name=name, identifier=identifier)

else:
log.warning('Unknown %s', node_types)
log.debug('Unknown %s', node_types)


def complexes_to_bel(complexes: Dict[str, Dict], nodes: Dict[str, BaseEntity], graph: BELGraph) -> Dict[
Expand Down Expand Up @@ -136,7 +136,7 @@ def get_node(node, nodes):
_, _, namespace, identifier = parse_id_uri(node)
return abundance(namespace=namespace, name=identifier, identifier=identifier)
else:
log.warning('No valid id for node %s', node)
log.debug('No valid id for node %s', node)
return None
else:
return nodes[node]
Expand Down Expand Up @@ -197,8 +197,8 @@ def add_simple_edge(graph: BELGraph, u, v, edge_types, uri_id):
graph.add_association(u, v, citation=uri_id, evidence='', annotations={'EdgeTypes': edge_types})

elif 'Interaction' in edge_types:
log.warning('No interaction subtype for %s', str(uri_id))
log.debug('No interaction subtype for %s', str(uri_id))

else:
log.warning('No handled edge type %s', str(uri_id))
log.debug('No handled edge type %s', str(uri_id))

20 changes: 10 additions & 10 deletions src/pathme/wikipathways/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ def _get_update_alias_symbol(hgnc_manager, original_identifier, original_namespa
query_result = hgnc_manager.get_hgnc_from_alias_symbol(original_identifier)

if not query_result:
log.warning('No found HGNC Symbol for id %s in (%s)', original_identifier, original_namespace)
log.debug('No found HGNC Symbol for id %s in (%s)', original_identifier, original_namespace)
return original_namespace, original_identifier, original_identifier

return HGNC, query_result.symbol, query_result.identifier
Expand All @@ -62,13 +62,13 @@ def _validate_query(hgnc_manager, query_result, original_identifier, original_na

# Invalid entry, proceed with invalid identifier
if not query_result:
log.warning('No found HGNC Symbol for id %s in (%s)', original_identifier, original_namespace)
log.debug('No found HGNC Symbol for id %s in (%s)', original_identifier, original_namespace)
return original_namespace, original_identifier, original_identifier

# Multiple entries are returned, for UniProt identifiers
if isinstance(query_result, list):
if len(query_result) > 1:
log.warning('UniProt identifier with multiple HGNC:s %s', query_result)
log.debug('UniProt identifier with multiple HGNC:s %s', query_result)
query_result = query_result[0]

# Correct entry, use HGNC identifier
Expand Down Expand Up @@ -136,50 +136,50 @@ def get_valid_gene_identifier(node_ids_dict, hgnc_manager):
if hgnc_entry:
return HGNC, hgnc_entry.symbol, hgnc_entry.identifier

log.warning('Adding WikiPathways node %s (%s)', name, WIKIPATHWAYS)
log.debug('Adding WikiPathways node %s (%s)', name, WIKIPATHWAYS)
return WIKIPATHWAYS, name, name

elif WIKIPEDIA.lower() in node_ids_dict['uri_id']:
wiki_name = check_multiple(node_ids_dict['identifier'], 'wikipedia_id')
wiki_id = check_multiple(node_ids_dict['name'], 'wikipedia_name')

log.warning('Adding Wikipedia node %s (%s)', wiki_name, WIKIPATHWAYS)
log.debug('Adding Wikipedia node %s (%s)', wiki_name, WIKIPATHWAYS)

return WIKIPEDIA, wiki_name, wiki_id

elif KEGG.lower() in node_ids_dict['uri_id']:
kegg_id = check_multiple(node_ids_dict['identifier'], 'kegg_id')
kegg_name = check_multiple(node_ids_dict['name'], 'kegg_name')

log.warning('Adding KEGG node %s ', kegg_id)
log.debug('Adding KEGG node %s ', kegg_id)

return KEGG, kegg_name, kegg_id

elif INTERPRO.lower() in node_ids_dict['uri_id']:
interpro_id = check_multiple(node_ids_dict['identifier'], 'interpro_id')
interpro_name = check_multiple(node_ids_dict['name'], 'interpro_name')
log.warning('Adding INTERPRO node %s ', interpro_id)
log.debug('Adding INTERPRO node %s ', interpro_id)

return INTERPRO, interpro_name, interpro_id

elif PFAM.lower() in node_ids_dict['uri_id']:
pfam_id = check_multiple(node_ids_dict['identifier'], 'pfam_id')
pfam_name = check_multiple(node_ids_dict['name'], 'pfam_name')
log.warning('Adding PFAM node %s ', pfam_id)
log.debug('Adding PFAM node %s ', pfam_id)

return PFAM, pfam_name, pfam_id

elif 'mirbase.mature' in node_ids_dict['uri_id']:
mirbase_id = check_multiple(node_ids_dict['identifier'], 'mirbase_id')
mirbase_name = check_multiple(node_ids_dict['name'], 'mirbase_name')
log.warning('Adding MIRBASE node %s ', mirbase_id)
log.debug('Adding MIRBASE node %s ', mirbase_id)

return PFAM, mirbase_name, mirbase_id

elif 'chembl.compound' in node_ids_dict['uri_id']:
chembl_id = check_multiple(node_ids_dict['identifier'], 'chembl_id')
chembl_name = check_multiple(node_ids_dict['name'], 'chembl_name')
log.warning('Adding MIRBASE node %s ', chembl_id)
log.debug('Adding MIRBASE node %s ', chembl_id)

return PFAM, chembl_name, chembl_id

Expand Down

0 comments on commit 60ad2fe

Please sign in to comment.