Path: blob/main/latex-templates/templates/biomedical/pharmacokinetics.tex
51 views
unlisted
\documentclass[11pt,a4paper]{article}1\usepackage[utf8]{inputenc}2\usepackage[T1]{fontenc}3\usepackage{amsmath,amssymb}4\usepackage{graphicx}5\usepackage{booktabs}6\usepackage{siunitx}7\usepackage{geometry}8\geometry{margin=1in}9\usepackage{pythontex}10\usepackage{hyperref}11\usepackage{float}1213\title{Pharmacokinetics\\Compartment Models and Drug Concentration}14\author{Clinical Pharmacology Division}15\date{\today}1617\begin{document}18\maketitle1920\begin{abstract}21Computational modeling of drug absorption, distribution, metabolism, and elimination using compartment models.22\end{abstract}232425\section{Introduction}2627Pharmacokinetics describes the time course of drug concentration in the body.2829\begin{pycode}30import numpy as np31import matplotlib.pyplot as plt32from scipy.integrate import odeint33plt.rcParams['text.usetex'] = True34plt.rcParams['font.family'] = 'serif'35\end{pycode}3637\section{One-Compartment Model}3839$\frac{dC}{dt} = -k_e C$4041\begin{pycode}42# IV bolus43C0 = 100 # Initial concentration (mg/L)44k_e = 0.1 # Elimination rate constant (1/h)45t = np.linspace(0, 48, 200)4647C = C0 * np.exp(-k_e * t)48t_half = np.log(2) / k_e4950fig, ax = plt.subplots(figsize=(10, 6))51ax.semilogy(t, C, 'b-', linewidth=2)52ax.axhline(y=C0/2, color='r', linestyle='--', label=f'$t_{{1/2}}$ = {t_half:.1f} h')53ax.axvline(x=t_half, color='r', linestyle='--')54ax.set_xlabel('Time (h)')55ax.set_ylabel('Concentration (mg/L)')56ax.set_title('One-Compartment Model: IV Bolus')57ax.legend()58ax.grid(True, alpha=0.3, which='both')59plt.tight_layout()60plt.savefig('one_compartment.pdf', dpi=150, bbox_inches='tight')61plt.close()62\end{pycode}6364\begin{figure}[H]65\centering66\includegraphics[width=0.85\textwidth]{one_compartment.pdf}67\caption{Drug concentration after IV bolus administration.}68\end{figure}6970\section{Oral Administration}7172\begin{pycode}73k_a = 1.0 # Absorption rate constant74F = 0.8 # Bioavailability75D = 500 # Dose (mg)76V = 50 # Volume of distribution (L)7778C_oral = (F * D * k_a / (V * (k_a - k_e))) * (np.exp(-k_e * t) - np.exp(-k_a * t))7980fig, ax = plt.subplots(figsize=(10, 6))81ax.plot(t, C_oral, 'b-', linewidth=2)82t_max = np.log(k_a / k_e) / (k_a - k_e)83C_max = (F * D * k_a / (V * (k_a - k_e))) * (np.exp(-k_e * t_max) - np.exp(-k_a * t_max))84ax.plot(t_max, C_max, 'ro', markersize=10)85ax.annotate(f'$C_{{max}}$ = {C_max:.1f} mg/L\n$t_{{max}}$ = {t_max:.1f} h',86xy=(t_max, C_max), xytext=(t_max + 5, C_max))87ax.set_xlabel('Time (h)')88ax.set_ylabel('Concentration (mg/L)')89ax.set_title('Oral Administration')90ax.grid(True, alpha=0.3)91plt.tight_layout()92plt.savefig('oral_admin.pdf', dpi=150, bbox_inches='tight')93plt.close()94\end{pycode}9596\begin{figure}[H]97\centering98\includegraphics[width=0.85\textwidth]{oral_admin.pdf}99\caption{Drug concentration after oral administration.}100\end{figure}101102\section{Two-Compartment Model}103104\begin{pycode}105def two_compartment(y, t, k12, k21, k10):106C1, C2 = y107dC1dt = -k12 * C1 + k21 * C2 - k10 * C1108dC2dt = k12 * C1 - k21 * C2109return [dC1dt, dC2dt]110111k12 = 0.5112k21 = 0.2113k10 = 0.1114y0 = [100, 0]115116sol = odeint(two_compartment, y0, t, args=(k12, k21, k10))117118fig, ax = plt.subplots(figsize=(10, 6))119ax.semilogy(t, sol[:, 0], 'b-', linewidth=2, label='Central')120ax.semilogy(t, sol[:, 1], 'r-', linewidth=2, label='Peripheral')121ax.set_xlabel('Time (h)')122ax.set_ylabel('Concentration (mg/L)')123ax.set_title('Two-Compartment Model')124ax.legend()125ax.grid(True, alpha=0.3, which='both')126plt.tight_layout()127plt.savefig('two_compartment.pdf', dpi=150, bbox_inches='tight')128plt.close()129\end{pycode}130131\begin{figure}[H]132\centering133\includegraphics[width=0.85\textwidth]{two_compartment.pdf}134\caption{Two-compartment model showing distribution phase.}135\end{figure}136137\section{Multiple Dosing}138139\begin{pycode}140tau = 8 # Dosing interval (h)141n_doses = 6142t_multi = np.linspace(0, n_doses * tau, 500)143C_multi = np.zeros_like(t_multi)144145for i in range(n_doses):146t_dose = i * tau147mask = t_multi >= t_dose148C_multi[mask] += C0 * np.exp(-k_e * (t_multi[mask] - t_dose))149150fig, ax = plt.subplots(figsize=(10, 6))151ax.plot(t_multi, C_multi, 'b-', linewidth=2)152ax.set_xlabel('Time (h)')153ax.set_ylabel('Concentration (mg/L)')154ax.set_title('Multiple Dosing Regimen')155ax.grid(True, alpha=0.3)156157# Steady state158C_ss_max = C0 / (1 - np.exp(-k_e * tau))159C_ss_min = C0 * np.exp(-k_e * tau) / (1 - np.exp(-k_e * tau))160ax.axhline(y=C_ss_max, color='r', linestyle='--', alpha=0.5)161ax.axhline(y=C_ss_min, color='g', linestyle='--', alpha=0.5)162plt.tight_layout()163plt.savefig('multiple_dosing.pdf', dpi=150, bbox_inches='tight')164plt.close()165\end{pycode}166167\begin{figure}[H]168\centering169\includegraphics[width=0.85\textwidth]{multiple_dosing.pdf}170\caption{Drug accumulation with repeated dosing.}171\end{figure}172173\section{Continuous Infusion}174175\begin{pycode}176R = 50 # Infusion rate (mg/h)177CL = k_e * V # Clearance178179C_infusion = (R / CL) * (1 - np.exp(-k_e * t))180C_ss = R / CL181182fig, ax = plt.subplots(figsize=(10, 6))183ax.plot(t, C_infusion, 'b-', linewidth=2)184ax.axhline(y=C_ss, color='r', linestyle='--', label=f'$C_{{ss}}$ = {C_ss:.1f} mg/L')185ax.set_xlabel('Time (h)')186ax.set_ylabel('Concentration (mg/L)')187ax.set_title('Continuous IV Infusion')188ax.legend()189ax.grid(True, alpha=0.3)190plt.tight_layout()191plt.savefig('infusion.pdf', dpi=150, bbox_inches='tight')192plt.close()193\end{pycode}194195\begin{figure}[H]196\centering197\includegraphics[width=0.85\textwidth]{infusion.pdf}198\caption{Drug concentration during continuous infusion.}199\end{figure}200201\section{Loading Dose}202203\begin{pycode}204D_loading = C_ss * V205t_loading = np.linspace(0, 24, 200)206207# With loading dose208C_with_load = C_ss + (D_loading/V - C_ss) * np.exp(-k_e * t_loading)209# Without loading dose210C_without_load = (R / CL) * (1 - np.exp(-k_e * t_loading))211212fig, ax = plt.subplots(figsize=(10, 6))213ax.plot(t_loading, C_with_load, 'b-', linewidth=2, label='With loading dose')214ax.plot(t_loading, C_without_load, 'r--', linewidth=2, label='Without loading dose')215ax.axhline(y=C_ss, color='k', linestyle=':', alpha=0.5)216ax.set_xlabel('Time (h)')217ax.set_ylabel('Concentration (mg/L)')218ax.set_title('Effect of Loading Dose')219ax.legend()220ax.grid(True, alpha=0.3)221plt.tight_layout()222plt.savefig('loading_dose.pdf', dpi=150, bbox_inches='tight')223plt.close()224\end{pycode}225226\begin{figure}[H]227\centering228\includegraphics[width=0.85\textwidth]{loading_dose.pdf}229\caption{Comparison with and without loading dose.}230\end{figure}231232\section{Results}233234\begin{pycode}235print(r'\begin{table}[H]')236print(r'\centering')237print(r'\caption{Pharmacokinetic Parameters}')238print(r'\begin{tabular}{@{}lc@{}}')239print(r'\toprule')240print(r'Parameter & Value \\')241print(r'\midrule')242print(f'Half-life & {t_half:.1f} h \\\\')243print(f'Volume of distribution & {V} L \\\\')244print(f'Clearance & {CL:.1f} L/h \\\\')245print(f'Steady-state concentration & {C_ss:.1f} mg/L \\\\')246print(r'\bottomrule')247print(r'\end{tabular}')248print(r'\end{table}')249\end{pycode}250251\section{Conclusions}252253Compartment models provide essential tools for drug dosing optimization and therapeutic monitoring.254255256\end{document}257258259