Comprehensive patient stratification for precision medicine by integrating genomic, clinical, and therapeutic data. Given a disease/condition, genomic data (germline variants, somatic mutations, expression), and optional clinical parameters, performs multi-phase analysis across 9 phases covering disease disambiguation, genetic risk assessment, disease-specific molecular stratification, pharmacogenomic profiling, comorbidity/DDI risk, pathway analysis, clinical evidence and guideline mapping, clinical trial matching, and integrated outcome prediction. Generates a quantitative Precision Medicine Risk Score (0-100) with risk tier assignment (Low/Intermediate/High/Very High), treatment algorithm (1st/2nd/3rd line), pharmacogenomic guidance, clinical trial matches, and monitoring plan. Use when clinicians ask about patient risk stratification, treatment selection, prognosis prediction, or personalized therapeutic strategy across cancer, metabolic, cardiovascular, neurological, or rare diseases.
FreedomIntelligence2,097 スター2026/03/08
職業
カテゴリ
科学計算
スキル内容
Transform patient genomic and clinical profiles into actionable risk stratification, treatment recommendations, and personalized therapeutic strategies. Integrates germline genetics, somatic alterations, pharmacogenomics, pathway biology, and clinical evidence to produce a quantitative risk score with tiered management recommendations.
KEY PRINCIPLES:
Report-first approach - Create report file FIRST, then populate progressively
Disease-specific logic - Cancer vs metabolic vs rare disease pipelines diverge at Phase 2
# For each gene in profile
result = tu.tools.MyGene_query_genes(query='BRCA1')
# -> hits[0]: {_id: '672', symbol: 'BRCA1', ensembl: {gene: 'ENSG00000012048'}}
ensembl_id = result['hits'][0]['ensembl']['gene']
entrez_id = result['hits'][0]['_id']
Critical Gene IDs (pre-resolved):
Gene
Ensembl ID
Entrez ID
Category
BRCA1
ENSG00000012048
672
Cancer predisposition
BRCA2
ENSG00000139618
675
Cancer predisposition
TP53
ENSG00000141510
7157
Tumor suppressor
EGFR
ENSG00000146648
1956
Cancer driver
BRAF
ENSG00000157764
673
Cancer driver
KRAS
ENSG00000133703
3845
Cancer driver
CYP2D6
ENSG00000100197
1565
Pharmacogenomics
CYP2C19
ENSG00000165841
1557
Pharmacogenomics
SLCO1B1
ENSG00000134538
10599
Pharmacogenomics
VKORC1
ENSG00000167397
79001
Pharmacogenomics
DPYD
ENSG00000188641
1806
Pharmacogenomics
APOE
ENSG00000130203
348
Neurological risk
LDLR
ENSG00000130164
3949
CVD risk
PCSK9
ENSG00000169174
255738
CVD risk
FBN1
ENSG00000166147
2200
Marfan syndrome
CFTR
ENSG00000001626
1080
Cystic fibrosis
Phase 2: Genetic Risk Assessment
Step 2.1: Germline Variant Pathogenicity
For each germline variant provided:
# Search ClinVar for variant pathogenicity
result = tu.tools.clinvar_search_variants(gene='BRCA1', significance='pathogenic', limit=50)
# Check if patient's specific variant is in ClinVar
# For rsID variants, get VEP annotation
result = tu.tools.EnsemblVEP_annotate_rsid(variant_id='rs80357906')
# Returns SIFT, PolyPhen predictions, consequence type
# For HGVS variants
result = tu.tools.EnsemblVEP_annotate_hgvs(hgvs_notation='ENST00000357654.9:c.5266dupC', species='homo_sapiens')
Pathogenicity Classification (ACMG-aligned):
Classification
ClinVar Term
Risk Score Points
Pathogenic
Pathogenic
25 (molecular component)
Likely pathogenic
Likely pathogenic
20
VUS
Uncertain significance
10 (conservative)
Likely benign
Likely benign
2
Benign
Benign
0
Step 2.2: Gene-Disease Association Strength
# Get genetic evidence for gene-disease pair
result = tu.tools.OpenTargets_target_disease_evidence(
ensemblId='ENSG00000012048', # BRCA1
efoId='EFO_0000305', # breast cancer
size=20
)
# Returns evidence items with scores
Step 2.3: GWAS-Based Polygenic Risk
# Search GWAS associations for disease
result = tu.tools.gwas_get_associations_for_trait(trait='breast cancer')
# Returns associated SNPs with effect sizes
# Search GWAS studies via OpenTargets
result = tu.tools.OpenTargets_search_gwas_studies_by_disease(
diseaseIds=['EFO_0000305'], size=25
)
# For specific genes, check GWAS hits
result = tu.tools.GWAS_search_associations_by_gene(gene_name='BRCA1')
PRS Estimation (from available GWAS data):
PRS Percentile
Risk Category
Score Points (0-35)
>95th percentile
Very high genetic risk
35
90-95th
High genetic risk
30
75-90th
Elevated genetic risk
25
50-75th
Average-high
18
25-50th
Average-low
12
10-25th
Below average
8
<10th
Low genetic risk
5
Note: With user-provided variants only (not full genotype), estimate approximate PRS by counting known risk alleles and their effect sizes from GWAS catalog. Flag as "estimated - full genotyping recommended for precise PRS."
Step 2.4: Population Frequency
# Check variant frequency in gnomAD
result = tu.tools.gnomad_get_variant(variant_id='1-55505647-G-T')
# Returns allele frequency across populations
Step 2.5: Gene Constraint
# Gene intolerance to loss of function
result = tu.tools.gnomad_get_gene_constraints(gene_symbol='BRCA1')
# Returns pLI, LOEUF scores - high pLI/low LOEUF = haploinsufficiency
Genetic Risk Score Component (0-35 points):
Combine pathogenicity + gene-disease association + PRS:
Pathogenic variant in disease gene: 25+ points
Strong GWAS associations (multiple risk alleles): up to 35 points
VUS in relevant gene: 10-15 points
No known pathogenic variants but some risk alleles: 5-15 points
# Get somatic mutation landscape from cBioPortal
result = tu.tools.cBioPortal_get_mutations(
study_id='brca_tcga_pub', # breast cancer TCGA
gene_list='BRCA1 BRCA2 TP53 PIK3CA ESR1 ERBB2' # STRING, not array
)
# Returns mutation frequencies, types
# Check cancer prognostic markers
result = tu.tools.HPA_get_cancer_prognostics_by_gene(gene_name='ESR1')
# Returns prognostic data for breast cancer
Cancer-Specific Subtype Definitions:
Cancer
Subtype System
Key Markers
High-Risk Features
Breast
Luminal A/B, HER2+, TNBC
ER, PR, HER2, Ki67
TNBC, high Ki67, TP53 mut
NSCLC
Adenocarcinoma, squamous
EGFR, ALK, ROS1, KRAS, PD-L1
KRAS G12C, no driver = chemoIO
CRC
MSI-H vs MSS, CMS1-4
KRAS, BRAF, MSI, CMS
BRAF V600E, MSS
Melanoma
BRAF-mut, NRAS-mut, wild-type
BRAF, NRAS, KIT, NF1
NRAS, uveal
Prostate
Luminal vs basal, BRCA status
AR, BRCA1/2, SPOP, TMPRSS2:ERG
BRCA2, neuroendocrine
Step 3C.2: TMB/MSI/HRD Assessment
If TMB provided:
# Check FDA TMB-H approvals
result = tu.tools.fda_pharmacogenomic_biomarkers(drug_name='pembrolizumab', limit=100)
# Look for "Tumor Mutational Burden" in Biomarker field
Biomarker
High-Risk Threshold
Clinical Significance
TMB
>= 10 mut/Mb (FDA cutoff)
Pembrolizumab eligible (tissue-agnostic)
MSI-H
MSI-high or dMMR
Pembrolizumab/nivolumab eligible
HRD
HRD-positive
PARP inhibitor eligible
Step 3C.3: Prognostic Stratification
Combine stage + molecular features:
Stage
Low-Risk Molecular
High-Risk Molecular
Score (0-30 clinical)
I
Favorable subtype
Unfavorable subtype
5-10
II
Favorable subtype
Unfavorable subtype
10-18
III
Any
Any
18-25
IV
Any
Any
25-30
METABOLIC PATH (Phase 3M)
Step 3M.1: Clinical Risk Integration
# Check genetic risk factors for T2D
result = tu.tools.GWAS_search_associations_by_gene(gene_name='TCF7L2')
# TCF7L2 is strongest T2D risk gene
# Check monogenic diabetes genes
result = tu.tools.OpenTargets_target_disease_evidence(
ensemblId='ENSG00000148737', # TCF7L2
efoId='EFO_0001360', # T2D
size=20
)
T2D Stratification:
Risk Factor
Low Risk
Moderate Risk
High Risk
Score Points
HbA1c
<6.5%
6.5-8.0%
>8.0%
5-30
Genetic risk
No risk alleles
1-3 risk alleles
MODY gene/many risk alleles
5-25
Complications
None
Microalbuminuria
Retinopathy, neuropathy
0-20
Duration
<5 years
5-15 years
>15 years
0-10
CVD PATH (Phase 3V)
# Check PCSK9 and LDLR variants
result = tu.tools.clinvar_search_variants(gene='LDLR', significance='pathogenic', limit=20)
# Familial hypercholesterolemia check
# Check statin-relevant PGx
result = tu.tools.PharmGKB_get_clinical_annotations(query='SLCO1B1')
# SLCO1B1 *5 -> increased statin myopathy risk
CVD Risk Integration:
Factor
Score Points
LDL >190 mg/dL
15
FH gene mutation (LDLR/APOB/PCSK9)
20
ASCVD >20% 10-year risk
30
Family hx premature CVD
10
Lipoprotein(a) elevated
8
Multiple GWAS risk alleles
5-15
RARE DISEASE PATH (Phase 3R)
# Check causal variant in disease gene
result = tu.tools.clinvar_search_variants(gene='FBN1', significance='pathogenic', limit=50)
# Marfan syndrome - FBN1 pathogenic variants
# Genotype-phenotype correlation
result = tu.tools.UniProt_get_disease_variants_by_accession(accession='P35555') # FBN1 UniProt
# Known disease variants and their phenotypes
Rare Disease Risk Assessment:
Finding
Risk Level
Score Points
Pathogenic variant in causal gene
Definitive
30
Likely pathogenic in causal gene
Strong
25
VUS in causal gene
Moderate
15
Family history + partial phenotype
Suggestive
10
Single phenotype feature only
Low
5
Phase 4: Pharmacogenomic Profiling
Step 4.1: Drug-Metabolizing Enzyme Genotypes
# PharmGKB clinical annotations for CYP2C19
result = tu.tools.PharmGKB_get_clinical_annotations(query='CYP2C19')
# Returns drug-gene pairs with clinical annotation levels
# FDA pharmacogenomic biomarkers
result = tu.tools.fda_pharmacogenomic_biomarkers(drug_name='clopidogrel', limit=50)
# CYP2C19 poor metabolizer -> reduced clopidogrel efficacy
# PharmGKB dosing guidelines
result = tu.tools.PharmGKB_get_dosing_guidelines(query='CYP2C19')
# CPIC dosing guidelines
Key Pharmacogenes and Clinical Impact:
Gene
Star Alleles
Metabolizer Status
Clinical Impact
Score Points
CYP2D6
*4/*4, *5/*5
Poor metabolizer
Codeine, tamoxifen, many antidepressants
8
CYP2C19
*2/*2, *2/*3
Poor metabolizer
Clopidogrel, voriconazole, PPIs
8
CYP2C9
*2/*3, *3/*3
Poor metabolizer
Warfarin, NSAIDs, phenytoin
5
SLCO1B1
*5/*5
Decreased function
Statin myopathy (simvastatin)
5
DPYD
*2A
DPD deficient
5-FU/capecitabine severe toxicity
10
VKORC1
-1639G>A
Warfarin sensitive
Lower warfarin dose needed
5
UGT1A1
*28/*28
Poor glucuronidator
Irinotecan toxicity
5
TPMT
*2, *3A, *3C
Poor metabolizer
Thiopurine toxicity
8
HLA-B*5701
Present
N/A
Abacavir hypersensitivity
10
HLA-B*1502
Present
N/A
Carbamazepine SJS/TEN
10
Step 4.2: Treatment-Specific PGx
# For the specific disease, identify relevant drugs and check PGx
# Example: breast cancer -> tamoxifen -> CYP2D6
result = tu.tools.PharmGKB_get_drug_details(query='tamoxifen')
# Returns PGx annotations for tamoxifen
# Get FDA PGx biomarkers for disease area
result = tu.tools.fda_pharmacogenomic_biomarkers(biomarker='CYP2D6', limit=100)
# All drugs with CYP2D6 PGx in FDA labels
Step 4.3: Drug Target Variants
# Check if patient has variants in drug targets
result = tu.tools.PharmGKB_search_variants(query='VKORC1')
# VKORC1 variants affecting warfarin response
Pharmacogenomic Risk Score (0-10 points):
Poor metabolizer for treatment-relevant CYP: 8-10 points
Intermediate metabolizer: 4-5 points
High-risk HLA allele: 8-10 points
Drug target variant: 3-5 points
Normal metabolizer, no actionable PGx: 0 points
Phase 5: Comorbidity & Drug Interaction Risk
Step 5.1: Comorbidity Analysis
# Check disease-disease overlap via shared genetic targets
result = tu.tools.OpenTargets_get_associated_targets_by_disease_efoId(
efoId='EFO_0001360', # T2D
size=50
)
# Compare top targets between primary disease and comorbidities
# Literature on comorbidity
result = tu.tools.PubMed_search_articles(
query='type 2 diabetes cardiovascular comorbidity risk',
max_results=5
)
Step 5.2: Drug-Drug Interaction Risk
# If current medications provided, check DDI
result = tu.tools.drugbank_get_drug_interactions_by_drug_name_or_id(
query='metformin',
case_sensitive=False,
exact_match=False,
limit=20
)
# FDA DDI data
result = tu.tools.FDA_get_drug_interactions_by_drug_name(drug_name='metformin', limit=5)
Step 5.3: PGx-Amplified DDI Risk
If patient is a CYP2D6 poor metabolizer AND taking a CYP2D6 inhibitor -> compounded risk.
Interaction Type
Risk Level
Management
PGx PM + CYP inhibitor
Very high
Alternative drug or dose reduction
PGx IM + CYP inhibitor
High
Monitor closely, possible dose reduction
PGx normal + CYP inhibitor
Moderate
Standard monitoring
No interacting drugs
Low
Standard care
Phase 6: Molecular Pathway Analysis
Step 6.1: Dysregulated Pathways
# Pathway enrichment for affected genes
gene_list = ['BRCA1', 'TP53', 'PIK3CA'] # from patient mutations
result = tu.tools.enrichr_gene_enrichment_analysis(
gene_list=gene_list,
libs=['KEGG_2021_Human', 'Reactome_2022']
)
# Returns enriched pathways with p-values
# Reactome pathway analysis
# First get UniProt IDs, then map to pathways
result = tu.tools.Reactome_map_uniprot_to_pathways(id='P38398') # BRCA1 UniProt
# Returns list of pathways involving BRCA1
Step 6.2: Network Analysis
# Protein-protein interaction network
result = tu.tools.STRING_get_interaction_partners(
protein_ids=['BRCA1', 'TP53'],
species=9606,
limit=20
)
# Functional enrichment of network
result = tu.tools.STRING_functional_enrichment(
protein_ids=['BRCA1', 'TP53', 'PALB2', 'RAD51'],
species=9606
)
Step 6.3: Druggable Pathway Targets
# Check tractability of pathway nodes
for gene in pathway_genes:
result = tu.tools.OpenTargets_get_target_tractability_by_ensemblID(ensemblId=ensembl_id)
# Returns small molecule, antibody, PROTAC tractability
Key Druggable Pathways:
Pathway
Key Nodes
Drug Classes
Cancer Relevance
PI3K/AKT/mTOR
PIK3CA, AKT1, MTOR
PI3K inhibitors, mTOR inhibitors
Breast, endometrial
RAS/MAPK
KRAS, BRAF, MEK1/2
KRAS G12C inhibitors, BRAF inhibitors
Lung, CRC, melanoma
DNA damage repair
BRCA1/2, ATM, PALB2
PARP inhibitors
Breast, ovarian, prostate
Cell cycle
CDK4/6, RB1, CCND1
CDK4/6 inhibitors
Breast
Immunocheckpoint
PD-1, PD-L1, CTLA-4
ICIs
Pan-cancer
Wnt/beta-catenin
APC, CTNNB1, TCF
Wnt inhibitors (investigational)
CRC
Phase 7: Clinical Evidence & Guidelines
Step 7.1: Guideline-Based Risk Categories
# Search clinical guidelines in PubMed
result = tu.tools.PubMed_Guidelines_Search(
query='NCCN breast cancer BRCA1 treatment guidelines',
max_results=5
)
# Search general evidence
result = tu.tools.PubMed_search_articles(
query='BRCA1 breast cancer treatment stratification',
max_results=10
)
Guideline References by Disease:
Disease Category
Guidelines
Key Stratification
Breast cancer
NCCN, ASCO, St. Gallen
Luminal A/B, HER2+, TNBC, BRCA status
NSCLC
NCCN, ESMO
Driver mutation status, PD-L1, TMB
CRC
NCCN
MSI, RAS/BRAF, sidedness
T2D
ADA Standards
HbA1c, CVD risk, CKD stage
CVD
ACC/AHA
ASCVD risk score, LDL goals, PGx
AF
ACC/AHA/HRS
CHA2DS2-VASc, anticoagulant selection
Rare disease
ACMG/AMP
Variant classification, genetic counseling
Step 7.2: FDA-Approved Therapies
# Get approved drugs for disease
result = tu.tools.OpenTargets_get_associated_drugs_by_disease_efoId(
efoId='EFO_0000305', # breast cancer
size=50
)
# Returns all known drugs with clinical status
# Check specific drug FDA info
result = tu.tools.FDA_get_indications_by_drug_name(drug_name='olaparib', limit=5)
# PARP inhibitor for BRCA-mutated breast cancer
# Get drug mechanism
result = tu.tools.FDA_get_mechanism_of_action_by_drug_name(drug_name='olaparib', limit=5)
Step 7.3: Biomarker-Drug Evidence
# CIViC evidence for biomarker-drug pair
result = tu.tools.civic_search_evidence_items(
therapy_name='olaparib',
disease_name='breast cancer'
)
# Returns clinical evidence items with evidence levels
# DrugBank for drug details
result = tu.tools.drugbank_get_drug_basic_info_by_drug_name_or_id(
query='olaparib',
case_sensitive=False,
exact_match=False,
limit=5
)
Phase 8: Clinical Trial Matching
Step 8.1: Biomarker-Driven Trials
# Search trials matching molecular profile
result = tu.tools.clinical_trials_search(
action='search_studies',
condition='breast cancer',
intervention='PARP inhibitor',
limit=10
)
# Returns {total_count, studies: [{nctId, title, status, conditions}]}
# Alternative search
result = tu.tools.search_clinical_trials(
query_term='BRCA1 breast cancer',
condition='breast cancer',
intervention='olaparib',
pageSize=10
)
Step 8.2: Precision Medicine Trials
# Search basket/umbrella trials
result = tu.tools.search_clinical_trials(
query_term='precision medicine biomarker-driven',
condition='breast cancer',
pageSize=10
)
# Search risk-adapted trials
result = tu.tools.search_clinical_trials(
query_term='high risk BRCA1',
condition='breast cancer',
pageSize=10
)
Step 8.3: Trial Details
# Get details for promising trials
result = tu.tools.clinical_trials_get_details(
action='get_study_details',
nct_id='NCT03344965'
)
# Returns full study protocol
Phase 9: Integrated Scoring & Recommendations
Precision Medicine Risk Score (0-100)
Score Components
Genetic Risk Component (0-35 points):
Scenario
Points
Pathogenic variant in high-penetrance disease gene (BRCA1, LDLR, FBN1)
Based on disease type + risk tier + molecular profile + PGx:
Cancer Treatment Algorithm
IF actionable mutation present:
1st line: Targeted therapy (e.g., EGFR TKI, BRAF inhibitor, PARP inhibitor)
2nd line: Immunotherapy (if TMB-H or MSI-H) OR chemotherapy
3rd line: Clinical trial OR alternative targeted therapy
IF no actionable mutation:
IF TMB-H or MSI-H:
1st line: Immunotherapy (pembrolizumab)
2nd line: Chemotherapy
ELSE:
1st line: Standard chemotherapy (disease-specific)
2nd line: Consider clinical trials
PGx adjustments:
- DPYD deficient -> AVOID fluoropyrimidines or reduce dose 50%
- UGT1A1 *28/*28 -> Reduce irinotecan dose
- CYP2D6 PM + tamoxifen -> Switch to aromatase inhibitor
Metabolic/CVD Treatment Algorithm
IF monogenic form (MODY, FH):
Disease-specific therapy (e.g., sulfonylureas for HNF1A-MODY, PCSK9i for FH)
IF polygenic risk:
Standard guidelines (ADA, ACC/AHA)
PGx-guided drug selection:
- CYP2C19 PM -> Alternative to clopidogrel (ticagrelor, prasugrel)
- SLCO1B1 *5 -> Lower statin dose or alternative statin
- VKORC1 variant -> Warfarin dose adjustment or DOAC
Monitoring Plan
Component
Frequency
Method
Molecular biomarkers
Per guideline
Liquid biopsy, tissue biopsy
Clinical markers
3-6 months
Labs, imaging
PGx-guided drug levels
As needed
TDM
Disease progression
Per stage/risk
Imaging, biomarkers
Comorbidity screening
Annually
Labs, risk calculators
Output Report Structure
Generate a comprehensive markdown report saved to: [PATIENT_ID]_precision_medicine_report.md