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

Update 2nd order interact query #288

Merged
merged 2 commits into from
Jul 14, 2020
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
25 changes: 25 additions & 0 deletions queries/sparql/query-04-sars-cov-2-interactors_2nd_order.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
title:
"Get 2nd order interactors"
description:
"Get human proteins that interact human proteins that interact with SARS-CoV-2 proteins"
endpoint:
"http://kg-hub-rdf.berkeleybop.io/blazegraph/sparql"
query: >
PREFIX xsd: <http://www.w3.org/2001/XMLSchema#>
prefix owl: <http://www.w3.org/2002/07/owl#>
prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#>
prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#>
prefix bl: <https://w3id.org/biolink/vocab/>
SELECT ?covp ?covplab ?humanp ?humanplab ?humanp2 ?humanp2lab
WHERE {
VALUES ?covtaxon {"2697049"^^xsd:string }
VALUES ?humantaxon { "9606"^^xsd:string }
?humanp bl:interacts_with ?covp .
?humanp bl:interacts_with ?humanp2 .
?covp bl:category bl:Protein; <https://www.example.org/UNKNOWN/ncbi_taxid> ?covtaxon .
?humanp bl:category bl:Protein; <https://www.example.org/UNKNOWN/ncbi_taxid> ?humantaxon .
?humanp2 bl:category bl:Protein; <https://www.example.org/UNKNOWN/ncbi_taxid> ?humantaxon .
OPTIONAL { ?covp rdfs:label ?covplab } .
OPTIONAL { ?humanp rdfs:label ?humanplab } .
OPTIONAL { ?humanp2 rdfs:label ?humanp2lab } .
}
2 changes: 2 additions & 0 deletions run.py
Original file line number Diff line number Diff line change
Expand Up @@ -102,6 +102,8 @@ def query(yaml: str, output_dir: str,
"""
query = parse_query_yaml(yaml)
result_dict = run_query(query=query[query_key], endpoint=query[endpoint_key])
if not os.path.exists(output_dir):
os.makedirs(output_dir)
outfile = os.path.join(output_dir, os.path.splitext(os.path.basename(yaml))[0] +
outfile_ext)
result_dict_to_tsv(result_dict, outfile)
Expand Down