Skip to content
Merged
Changes from 2 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
5 changes: 4 additions & 1 deletion src/chembl_downloader/queries.py
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,7 @@ def get_target_sql(
standard_relation: Optional[str] = None,
standard_type: Optional[str] = None,
tax_id: Optional[str] = None,
max_phase: bool = False,
) -> str:
"""Get the SQL for all chemicals inhibiting the target."""
ar = (
Expand All @@ -106,6 +107,7 @@ def get_target_sql(
st = "" if standard_relation is None else f"AND ACTIVITIES.standard_type = '{standard_type}'"
tt = "" if target_type is None else f"AND TARGET_DICTIONARY.target_type = '{target_type}'"
tax = "" if tax_id is None else f"AND TARGET_DICTIONARY.tax_id = '{tax_id}'"
mp = "" if max_phase is False else f"MOLECULE_DICTIONARY.max_phase"
return dedent(
f"""\
SELECT
Expand All @@ -115,7 +117,8 @@ def get_target_sql(
COMPOUND_STRUCTURES.canonical_smiles,
MOLECULE_DICTIONARY.chembl_id AS molecule_chembl_id,
ACTIVITIES.standard_type,
ACTIVITIES.pchembl_value
ACTIVITIES.pchembl_value,
{mp}
FROM TARGET_DICTIONARY
JOIN ASSAYS ON TARGET_DICTIONARY.tid == ASSAYS.tid
JOIN ACTIVITIES ON ASSAYS.assay_id == ACTIVITIES.assay_id
Expand Down