Close Menu
    Facebook X (Twitter) Instagram
    Articles Stock
    • Home
    • Technology
    • AI
    • Pages
      • About us
      • Contact us
      • Disclaimer For Articles Stock
      • Privacy Policy
      • Terms and Conditions
    Facebook X (Twitter) Instagram
    Articles Stock
    AI

    Construct a Multi-Agent System for Built-in Transcriptomic, Proteomic, and Metabolomic Knowledge Interpretation with Pathway Reasoning

    Naveed AhmadBy Naveed Ahmad07/11/2025No Comments11 Mins Read
    blog banner 18


    On this tutorial, we construct a complicated multi-agent pipeline that interprets built-in omics information, together with transcriptomics, proteomics, and metabolomics, to uncover key organic insights. We start by producing coherent artificial datasets that mimic life like organic traits after which transfer step-by-step by means of brokers designed for statistical evaluation, community inference, pathway enrichment, and drug repurposing. Every element contributes to a cumulative interpretation course of that permits us to establish important genes, infer causal hyperlinks, and generate biologically sound hypotheses supported by information patterns. Take a look at the FULL CODES here.

    Copy CodeCopiedUse a distinct Browser
    import numpy as np
    import pandas as pd
    from collections import defaultdict, deque
    from dataclasses import dataclass
    from typing import Dict, Record, Tuple
    import warnings
    warnings.filterwarnings('ignore')
    
    
    PATHWAY_DB = {
       'Glycolysis': {'genes': ['HK2', 'PFKM', 'PKM', 'LDHA', 'GAPDH', 'ENO1'],
                      'metabolites': ['Glucose', 'G6P', 'F16BP', 'Pyruvate', 'Lactate'], 'rating': 0},
       'TCA_Cycle': {'genes': ['CS', 'IDH1', 'IDH2', 'OGDH', 'SDHA', 'MDH2'],
                     'metabolites': ['Citrate', 'Isocitrate', 'α-KG', 'Succinate', 'Malate'], 'rating': 0},
       'Oxidative_Phosphorylation': {'genes': ['NDUFA1', 'NDUFB5', 'COX5A', 'COX7A1', 'ATP5A1', 'ATP5B'],
                                      'metabolites': ['ATP', 'ADP', 'NAD+', 'NADH'], 'rating': 0},
       'Fatty_Acid_Synthesis': {'genes': ['ACACA', 'FASN', 'SCD1', 'ACLY'],
                                'metabolites': ['Malonyl-CoA', 'Palmitate', 'Oleate'], 'rating': 0},
       'Fatty_Acid_Oxidation': {'genes': ['CPT1A', 'ACOX1', 'HADHA', 'ACADM'],
                                'metabolites': ['Acyl-CoA', 'Acetyl-CoA'], 'rating': 0},
       'Amino_Acid_Metabolism': {'genes': ['GOT1', 'GOT2', 'GLUD1', 'BCAT1', 'BCAT2'],
                                 'metabolites': ['Glutamate', 'Glutamine', 'Alanine', 'Aspartate'], 'rating': 0},
       'Pentose_Phosphate': {'genes': ['G6PD', 'PGD', 'TKTL1'],
                             'metabolites': ['R5P', 'NADPH'], 'rating': 0},
       'Cell_Cycle_G1S': {'genes': ['CCND1', 'CDK4', 'CDK6', 'RB1', 'E2F1'], 'metabolites': [], 'rating': 0},
       'Cell_Cycle_G2M': {'genes': ['CCNB1', 'CDK1', 'CDC25C', 'WEE1'], 'metabolites': [], 'rating': 0},
       'Apoptosis': {'genes': ['BCL2', 'BAX', 'BID', 'CASP3', 'CASP8', 'CASP9'], 'metabolites': [], 'rating': 0},
       'mTOR_Signaling': {'genes': ['MTOR', 'RPTOR', 'RICTOR', 'AKT1', 'TSC1', 'TSC2'],
                          'metabolites': ['Leucine', 'ATP'], 'rating': 0},
       'HIF1_Signaling': {'genes': ['HIF1A', 'EPAS1', 'VEGFA', 'SLC2A1'], 'metabolites': ['Lactate'], 'rating': 0},
       'p53_Signaling': {'genes': ['TP53', 'MDM2', 'CDKN1A', 'BAX'], 'metabolites': [], 'rating': 0},
       'PI3K_AKT': {'genes': ['PIK3CA', 'AKT1', 'AKT2', 'PTEN', 'PDK1'], 'metabolites': [], 'rating': 0},
    }
    
    
    GENE_INTERACTIONS = {
       'HK2': ['PFKM', 'HIF1A', 'MTOR'], 'PFKM': ['PKM', 'HK2'], 'PKM': ['LDHA', 'HIF1A'],
       'MTOR': ['AKT1', 'HIF1A', 'TSC2'], 'HIF1A': ['VEGFA', 'SLC2A1', 'PKM', 'LDHA'],
       'TP53': ['MDM2', 'CDKN1A', 'BAX', 'CASP3'], 'AKT1': ['MTOR', 'TSC2', 'MDM2'],
       'CCND1': ['CDK4', 'RB1'], 'CDK4': ['RB1'], 'RB1': ['E2F1'],
    }
    
    
    DRUG_TARGETS = {
       'Metformin': ['NDUFA1'], 'Rapamycin': ['MTOR'], '2-DG': ['HK2'],
       'Bevacizumab': ['VEGFA'], 'Palbociclib': ['CDK4', 'CDK6'], 'Nutlin-3': ['MDM2']
    }
    
    
    @dataclass
    class OmicsProfile:
       transcriptomics: pd.DataFrame
       proteomics: pd.DataFrame
       metabolomics: pd.DataFrame
       metadata: Dict

    We arrange the organic foundations of our system. We outline pathway databases, gene–gene interactions, and drug–goal mappings that function the reference community for all downstream analyses. We additionally import important libraries and create an information class to retailer the multi-omics datasets in an organized format. Take a look at the FULL CODES here.

    Copy CodeCopiedUse a distinct Browser
    class AdvancedOmicsGenerator:
       @staticmethod
       def generate_coherent_omics(n_samples=30, n_timepoints=4, noise=0.2):
           genes = record(set(g for p in PATHWAY_DB.values() for g in p['genes']))
           metabolites = record(set(m for p in PATHWAY_DB.values() for m in p['metabolites'] if m))
           proteins = [f"P_{g}" for g in genes]
           n_control = n_samples // 2
           samples_per_tp = n_samples // n_timepoints
           trans = np.random.randn(len(genes), n_samples) * noise + 10
           metab = np.random.randn(len(metabolites), n_samples) * noise + 5
           for tp in vary(n_timepoints):
               start_idx = n_control + tp * samples_per_tp
               end_idx = start_idx + samples_per_tp
               development = (tp + 1) / n_timepoints
               for i, gene in enumerate(genes):
                   if gene in PATHWAY_DB['Glycolysis']['genes']:
                       trans[i, start_idx:end_idx] += np.random.uniform(1.5, 3.5) * development
                   elif gene in PATHWAY_DB['Oxidative_Phosphorylation']['genes']:
                       trans[i, start_idx:end_idx] -= np.random.uniform(1, 2.5) * development
                   elif gene in PATHWAY_DB['Cell_Cycle_G1S']['genes'] + PATHWAY_DB['Cell_Cycle_G2M']['genes']:
                       trans[i, start_idx:end_idx] += np.random.uniform(1, 2) * development
                   elif gene in PATHWAY_DB['HIF1_Signaling']['genes']:
                       trans[i, start_idx:end_idx] += np.random.uniform(2, 4) * development
                   elif gene in PATHWAY_DB['p53_Signaling']['genes']:
                       trans[i, start_idx:end_idx] -= np.random.uniform(0.5, 1.5) * development
               for i, met in enumerate(metabolites):
                   if met in ['Lactate', 'Pyruvate', 'G6P']:
                       metab[i, start_idx:end_idx] += np.random.uniform(1.5, 3) * development
                   elif met in ['ATP', 'Citrate', 'Malate']:
                       metab[i, start_idx:end_idx] -= np.random.uniform(1, 2) * development
                   elif met in ['NADPH']:
                       metab[i, start_idx:end_idx] += np.random.uniform(1, 2) * development
           prot = trans * 0.8 + np.random.randn(*trans.form) * (noise * 2)
           situations = ['Control'] * n_control + [f'Disease_T{i//samples_per_tp}' for i in range(n_samples - n_control)]
           trans_df = pd.DataFrame(trans, index=genes, columns=[f"S{i}_{c}" for i, c in enumerate(conditions)])
           prot_df = pd.DataFrame(prot, index=proteins, columns=trans_df.columns)
           metab_df = pd.DataFrame(metab, index=metabolites, columns=trans_df.columns)
           metadata = {'situations': situations, 'n_timepoints': n_timepoints}
           return OmicsProfile(trans_df, prot_df, metab_df, metadata)
    
    
    class StatisticalAgent:
       @staticmethod
       def differential_analysis(data_df, control_samples, disease_samples):
           management = data_df[control_samples]
           illness = data_df[disease_samples]
           fc = (illness.imply(axis=1) - management.imply(axis=1))
           pooled_std = np.sqrt((management.var(axis=1) + illness.var(axis=1)) / 2)
           t_stat = fc / (pooled_std + 1e-6)
           p_values = 2 * (1 - np.minimal(np.abs(t_stat) / (np.abs(t_stat).max() + 1e-6), 0.999))
           sorted_pvals = np.type(p_values)
           ranks = np.searchsorted(sorted_pvals, p_values) + 1
           fdr = p_values * len(p_values) / ranks
           return pd.DataFrame({'log2FC': fc, 't_stat': t_stat, 'p_value': p_values,
               'FDR': np.minimal(fdr, 1.0), 'important': (np.abs(fc) > 1.0) & (fdr < 0.05)}).sort_values('log2FC', ascending=False)
    
    
       @staticmethod
       def temporal_analysis(data_df, metadata):
           timepoints = metadata['n_timepoints']
           samples_per_tp = data_df.form[1] // (timepoints + 1)
           traits = {}
           for gene in data_df.index:
               means = []
               for tp in vary(timepoints):
                   begin = samples_per_tp + tp * samples_per_tp
                   finish = begin + samples_per_tp
                   means.append(data_df.iloc[:, start:end].loc[gene].imply())
               if len(means) > 1:
                   x = np.arange(len(means))
                   coeffs = np.polyfit(x, means, deg=min(2, len(means)-1))
                   traits[gene] = {'slope': coeffs[0] if len(coeffs) > 1 else 0, 'trajectory': means}
           return traits

    We deal with producing artificial however biologically coherent multi-omics information and performing the preliminary statistical evaluation. We simulate illness development throughout timepoints and compute fold adjustments, p-values, and FDR-corrected significance ranges for genes, proteins, and metabolites. We additionally look at temporal traits to seize how expression values evolve over time. Take a look at the FULL CODES here.

    Copy CodeCopiedUse a distinct Browser
    class NetworkAnalysisAgent:
       def __init__(self, interactions):
           self.graph = interactions
       def find_master_regulators(self, diff_genes):
           sig_genes = diff_genes[diff_genes['significant']].index.tolist()
           impact_scores = {}
           for gene in sig_genes:
               if gene in self.graph:
                   downstream = self._bfs_downstream(gene, max_depth=2)
                   sig_downstream = [g for g in downstream if g in sig_genes]
                   impact_scores[gene] = {
                       'downstream_count': len(downstream),
                       'sig_downstream': len(sig_downstream),
                       'rating': len(sig_downstream) / (len(downstream) + 1),
                       'fc': diff_genes.loc[gene, 'log2FC']
                   }
           return sorted(impact_scores.gadgets(), key=lambda x: x[1]['score'], reverse=True)
       def _bfs_downstream(self, begin, max_depth=2):
           visited, queue = set(), deque([(start, 0)])
           downstream = []
           whereas queue:
               node, depth = queue.popleft()
               if depth >= max_depth or node in visited:
                   proceed
               visited.add(node)
               if node in self.graph:
                   for neighbor in self.graph[node]:
                       if neighbor not in visited:
                           downstream.append(neighbor)
                           queue.append((neighbor, depth + 1))
           return downstream
       def causal_inference(self, diff_trans, diff_prot, diff_metab):
           causal_links = []
           for gene in diff_trans[diff_trans['significant']].index:
               gene_fc = diff_trans.loc[gene, 'log2FC']
               protein = f"P_{gene}"
               if protein in diff_prot.index:
                   prot_fc = diff_prot.loc[protein, 'log2FC']
                   correlation = np.signal(gene_fc) == np.signal(prot_fc)
                   if correlation and abs(prot_fc) > 0.5:
                       causal_links.append(('transcription', gene, protein, gene_fc, prot_fc))
               for pathway, content material in PATHWAY_DB.gadgets():
                   if gene in content material['genes']:
                       for metab in content material['metabolites']:
                           if metab in diff_metab.index and diff_metab.loc[metab, 'significant']:
                               metab_fc = diff_metab.loc[metab, 'log2FC']
                               causal_links.append(('enzymatic', gene, metab, gene_fc, metab_fc))
           return causal_links

    We implement the community evaluation agent that identifies grasp regulators and infers causal relationships. We make the most of graph traversal to evaluate the influence of every gene on others and to establish connections between transcriptional, proteomic, and metabolic layers. This helps us perceive which nodes have the best downstream influence on organic processes. Take a look at the FULL CODES here.

    Copy CodeCopiedUse a distinct Browser
    class PathwayEnrichmentAgent:
       def __init__(self, pathway_db, interactions):
           self.pathway_db = pathway_db
           self.interactions = interactions
       def topology_weighted_enrichment(self, diff_genes, diff_metab, network_agent):
           enriched = {}
           for pathway, content material in self.pathway_db.gadgets():
               sig_genes = [g for g in content['genes'] if g in diff_genes.index and diff_genes.loc[g, 'significant']]
               weighted_score = 0
               for gene in sig_genes:
                   base_score = abs(diff_genes.loc[gene, 'log2FC'])
                   downstream = network_agent._bfs_downstream(gene, max_depth=1)
                   centrality = len(downstream) / 10
                   weighted_score += base_score * (1 + centrality)
               sig_metabs = [m for m in content['metabolites'] if m in diff_metab.index and diff_metab.loc[m, 'significant']]
               metab_score = sum(abs(diff_metab.loc[m, 'log2FC']) for m in sig_metabs)
               total_score = (weighted_score + metab_score * 2) / max(len(content material['genes']) + len(content material['metabolites']), 1)
               if total_score > 0.5:
                   enriched[pathway] = {'rating': total_score, 'genes': sig_genes, 'metabolites': sig_metabs,
                       'gene_fc': {g: diff_genes.loc[g, 'log2FC'] for g in sig_genes},
                       'metab_fc': {m: diff_metab.loc[m, 'log2FC'] for m in sig_metabs},
                       'coherence': self._pathway_coherence(sig_genes, diff_genes)}
           return enriched
       def _pathway_coherence(self, genes, diff_genes):
           if len(genes) < 2:
               return 0
           fcs = [diff_genes.loc[g, 'log2FC'] for g in genes]
           same_direction = sum(1 for fc in fcs if np.signal(fc) == np.signal(fcs[0]))
           return same_direction / len(genes)

    We add pathway-level reasoning by incorporating topology-weighted enrichment evaluation. We assess which organic pathways exhibit important activation or suppression and weight them in accordance with community centrality to mirror their broader affect. The agent additionally evaluates pathway coherence, indicating whether or not genes in a pathway exhibit constant directional motion. Take a look at the FULL CODES here.

    Copy CodeCopiedUse a distinct Browser
    class DrugRepurposingAgent:
       def __init__(self, drug_db):
           self.drug_db = drug_db
    
    
       def predict_drug_response(self, diff_genes, master_regulators):
           predictions = []
           for drug, targets in self.drug_db.gadgets():
               rating = 0
               affected_targets = []
               for goal in targets:
                   if goal in diff_genes.index:
                       fc = diff_genes.loc[target, 'log2FC']
                       is_sig = diff_genes.loc[target, 'significant']
                       if is_sig:
                           drug_benefit = -fc if fc > 0 else 0
                           rating += drug_benefit
                           affected_targets.append((goal, fc))
                       if goal in [mr[0] for mr in master_regulators[:5]]:
                           rating += 2
               if rating > 0:
                   predictions.append({
                       'drug': drug,
                       'rating': rating,
                       'targets': affected_targets,
                       'mechanism': 'Inhibition of upregulated pathway'
                   })
           return sorted(predictions, key=lambda x: x['score'], reverse=True)
    
    
    class AIHypothesisEngine:
       def generate_comprehensive_report(self, omics_data, analysis_results):
           report = ["="*80, "ADVANCED MULTI-OMICS INTERPRETATION REPORT", "="*80, ""]
           traits = analysis_results['temporal']
           top_trends = sorted(traits.gadgets(), key=lambda x: abs(x[1]['slope']), reverse=True)[:5]
           report.append("  TEMPORAL DYNAMICS ANALYSIS:")
           for gene, information in top_trends:
               course = "↑ Rising" if information['slope'] > 0 else "↓ Lowering"
               report.append(f"  {gene}: {course} (slope: {information['slope']:.3f})")
           report.append("n  MASTER REGULATORS (High 5):")
           for gene, information in analysis_results['master_regs'][:5]:
               report.append(f"  • {gene}: Controls {information['sig_downstream']} dysregulated genes (FC: {information['fc']:+.2f}, Affect: {information['score']:.3f})")
           report.append("n ENRICHED PATHWAYS:")
           for pathway, information in sorted(analysis_results['pathways'].gadgets(), key=lambda x: x[1]['score'], reverse=True):
               report.append(f"n  ► {pathway} (Rating: {information['score']:.3f}, Coherence: {information['coherence']:.2f})")
               report.append(f"    Genes: {', '.be part of(information['genes'][:6])}")
               if information['metabolites']:
                   report.append(f"    Metabolites: {', '.be part of(information['metabolites'][:4])}")
           report.append("n CAUSAL RELATIONSHIPS (High 10):")
           for link_type, supply, goal, fc1, fc2 in analysis_results['causal'][:10]:
               report.append(f"  {supply} →[{link_type}]→ {goal} (FC: {fc1:+.2f} → {fc2:+.2f})")
           report.append("n DRUG REPURPOSING PREDICTIONS:")
           for pred in analysis_results['drugs'][:5]:
               report.append(f"  • {pred['drug']} (Rating: {pred['score']:.2f})")
               report.append(f"    Targets: {', '.be part of([f'{t[0]}({t[1]:+.1f})' for t in pred['targets']])}")
           report.append("n AI-GENERATED BIOLOGICAL HYPOTHESES:n")
           for i, hyp in enumerate(self._generate_advanced_hypotheses(analysis_results), 1):
               report.append(f"{i}. {hyp}n")
           report.append("="*80)
           return "n".be part of(report)
    
    
       def _generate_advanced_hypotheses(self, outcomes):
           hypotheses = []
           pathways = outcomes['pathways']
           if 'Glycolysis' in pathways and 'Oxidative_Phosphorylation' in pathways:
               glyc = pathways['Glycolysis']['score']
               oxphos = pathways['Oxidative_Phosphorylation']['score']
               if glyc > oxphos * 1.5:
                   hypotheses.append(
                       "WARBURG EFFECT DETECTED: Cardio glycolysis upregulation with oxidative phosphorylation suppression suggests metabolic reprogramming pushed by HIF1A."
                   )
           if 'Cell_Cycle_G1S' in pathways and 'mTOR_Signaling' in pathways:
               hypotheses.append(
                   "PROLIFERATIVE SIGNATURE: Cell-cycle activation with mTOR signaling signifies anabolic reprogramming; twin CDK4/6 and mTOR inhibition could also be efficient."
               )
           if outcomes['master_regs']:
               top_mr = outcomes['master_regs'][0]
               hypotheses.append(
                   f"UPSTREAM REGULATOR: {top_mr[0]} controls {top_mr[1]['sig_downstream']} dysregulated genes; concentrating on this node can propagate network-wide correction."
               )
           traits = outcomes['temporal']
           progressive = [g for g, d in trends.items() if abs(d['slope']) > 0.5]
           if len(progressive) > 5:
               hypotheses.append(
                   f"PROGRESSIVE DYSREGULATION: {len(progressive)} genes present robust temporal shifts, indicating evolving pathology and profit from early pathway intervention."
               )
           if 'HIF1_Signaling' in pathways:
               hypotheses.append(
                   "HYPOXIA RESPONSE: HIF1 signaling suggests oxygen-poor microenvironment; anti-angiogenic methods could normalize perfusion."
               )
           if 'p53_Signaling' in pathways:
               hypotheses.append(
                   "TUMOR SUPPRESSOR LOSS: p53 pathway suppression suggests profit from MDM2 inhibition if TP53 is wild-type."
               )
           return hypotheses if hypotheses else ["Complex multi-factorial dysregulation detected."]

    We introduce drug repurposing and speculation era brokers. We rating potential medicine primarily based on the dysregulation of their targets and the community significance of affected genes, then compile interpretative hypotheses that hyperlink pathway exercise to attainable interventions. The report era engine summarizes these findings in a structured, readable format. Take a look at the FULL CODES here.

    Copy CodeCopiedUse a distinct Browser
    def run_advanced_omics_interpretation():
       print(" Initializing Superior Multi-Agent Omics System...n")
       omics = AdvancedOmicsGenerator.generate_coherent_omics()
       print(" Generated multi-omics dataset")
       stat_agent = StatisticalAgent()
       control_samples = [c for c in omics.transcriptomics.columns if 'Control' in c]
       disease_samples = [c for c in omics.transcriptomics.columns if 'Disease' in c]
       diff_trans = stat_agent.differential_analysis(omics.transcriptomics, control_samples, disease_samples)
       diff_prot = stat_agent.differential_analysis(omics.proteomics, control_samples, disease_samples)
       diff_metab = stat_agent.differential_analysis(omics.metabolomics, control_samples, disease_samples)
       temporal = stat_agent.temporal_analysis(omics.transcriptomics, omics.metadata)
       network_agent = NetworkAnalysisAgent(GENE_INTERACTIONS)
       master_regs = network_agent.find_master_regulators(diff_trans)
       causal_links = network_agent.causal_inference(diff_trans, diff_prot, diff_metab)
       pathway_agent = PathwayEnrichmentAgent(PATHWAY_DB, GENE_INTERACTIONS)
       enriched = pathway_agent.topology_weighted_enrichment(diff_trans, diff_metab, network_agent)
       drug_agent = DrugRepurposingAgent(DRUG_TARGETS)
       drug_predictions = drug_agent.predict_drug_response(diff_trans, master_regs)
       outcomes = {
           'temporal': temporal,
           'master_regs': master_regs,
           'causal': causal_links,
           'pathways': enriched,
           'medicine': drug_predictions
       }
       hypothesis_engine = AIHypothesisEngine()
       report = hypothesis_engine.generate_comprehensive_report(omics, outcomes)
       print(report)
       return omics, outcomes
    
    
    if __name__ == "__main__":
       omics_data, evaluation = run_advanced_omics_interpretation()

    We orchestrate the complete workflow, working all brokers sequentially and aggregating their outcomes right into a complete report. We execute the pipeline end-to-end, from information era to perception era, verifying that every element contributes to the general interpretation. The ultimate output gives an built-in multi-omics view with actionable insights.

    In conclusion, this tutorial demonstrated how a structured, modular workflow can join completely different layers of omics information into an interpretable analytical framework. By combining statistical reasoning, community topology, and organic context, we produced a complete abstract that highlights potential regulatory mechanisms and candidate therapeutic instructions. The strategy stays clear, data-driven, and adaptable for each simulated and actual multi-omics datasets.


    Take a look at the FULL CODES here. Be at liberty to take a look at our GitHub Page for Tutorials, Codes and Notebooks. Additionally, be at liberty to comply with us on Twitter and don’t overlook to hitch our 100k+ ML SubReddit and Subscribe to our Newsletter. Wait! are you on telegram? now you can join us on telegram as well.

    The put up Construct a Multi-Agent System for Built-in Transcriptomic, Proteomic, and Metabolomic Knowledge Interpretation with Pathway Reasoning appeared first on MarkTechPost.



    Source link

    Naveed Ahmad

    Related Posts

    The way to Construct a Privateness-Preserving Federated Pipeline to Tremendous-Tune Massive Language Fashions with LoRA Utilizing Flower and PEFT

    10/02/2026

    India makes Aadhaar extra ubiquitous, however critics say safety and privateness issues stay

    10/02/2026

    Tem raises $75M to remake electrical energy markets utilizing AI

    10/02/2026
    Leave A Reply Cancel Reply

    Categories
    • AI
    Recent Comments
      Facebook X (Twitter) Instagram Pinterest
      © 2026 ThemeSphere. Designed by ThemeSphere.

      Type above and press Enter to search. Press Esc to cancel.