Make a 2 page summary of this chapter with pictures/charts/table howere maximum data in minimum pages
~/
hormone receptors signal transduction
hormone receptor mechanisms intracellular receptor GPCR cAMP IP3 DAG authoritative physiology
~/attachments
mkdir -p "/tmp/workspace/endocrine-summary/src" "/tmp/workspace/endocrine-summary/output" && python - <<'PY' from PIL import Image from pathlib import Path p=Path('/tmp/workspace/attachments/e4282e52-75ce-4157-b52a-cea39bee66fa') for f in p.glob('*.jpg'): im=Image.open(f) print(f.name, im.size) PY
cat > "/tmp/workspace/endocrine-summary/src/create_summary.py" <<'PY' from reportlab.lib.pagesizes import A4 from reportlab.platypus import SimpleDocTemplate, Paragraph, Spacer, Table, TableStyle, PageBreak, KeepTogether from reportlab.lib import colors from reportlab.lib.styles import getSampleStyleSheet, ParagraphStyle from reportlab.lib.enums import TA_CENTER, TA_LEFT from reportlab.lib.units import mm from reportlab.pdfbase.pdfmetrics import stringWidth from reportlab.pdfgen import canvas from reportlab.lib.colors import HexColor from reportlab.lib import utils OUT='/tmp/workspace/endocrine-summary/output/Integrated_Endocrine_2_Page_Summary.pdf' W,H=A4 NAVY=HexColor('#17365D'); BLUE=HexColor('#2072B8'); PALE=HexColor('#EAF3FA'); LIGHT=HexColor('#F6F9FC'); GOLD=HexColor('#F5B400'); RED=HexColor('#A33131'); GREEN=HexColor('#317A4A'); GRAY=HexColor('#44546A') styles=getSampleStyleSheet() base=ParagraphStyle('base', parent=styles['BodyText'], fontName='Helvetica', fontSize=7.0, leading=8.4, textColor=HexColor('#182535'), spaceAfter=1.5) small=ParagraphStyle('small', parent=base, fontSize=6.25, leading=7.25) head=ParagraphStyle('head', parent=styles['Heading2'], fontName='Helvetica-Bold', fontSize=9, leading=10, textColor='white', alignment=TA_LEFT, spaceBefore=2, spaceAfter=3) title=ParagraphStyle('title', parent=styles['Title'], fontName='Helvetica-Bold', fontSize=17, leading=18, textColor=NAVY, alignment=TA_CENTER, spaceAfter=2) sub=ParagraphStyle('sub', parent=base, fontSize=7.6, leading=9, alignment=TA_CENTER, textColor=GRAY, spaceAfter=4) cell=ParagraphStyle('cell', parent=base, fontSize=6.1, leading=7.15) cellb=ParagraphStyle('cellb', parent=cell, fontName='Helvetica-Bold') mini=ParagraphStyle('mini', parent=base, fontSize=5.6, leading=6.4) def P(x,sty=base): return Paragraph(x,sty) def section(t, content): return [Table([[P(t,head)]],colWidths=[174*mm],style=[('BACKGROUND',(0,0),(-1,-1),NAVY),('LEFTPADDING',(0,0),(-1,-1),4),('RIGHTPADDING',(0,0),(-1,-1),4),('TOPPADDING',(0,0),(-1,-1),2),('BOTTOMPADDING',(0,0),(-1,-1),2)]),Spacer(1,2),content,Spacer(1,3)] def tbl(data,widths, fs='cell', header=True, grid=True): arr=[] for r,row in enumerate(data): arr.append([P(str(x),cellb if header and r==0 else (mini if fs=='mini' else cell)) for x in row]) st=[('VALIGN',(0,0),(-1,-1),'TOP'),('LEFTPADDING',(0,0),(-1,-1),3),('RIGHTPADDING',(0,0),(-1,-1),3),('TOPPADDING',(0,0),(-1,-1),2),('BOTTOMPADDING',(0,0),(-1,-1),2)] if header: st += [('BACKGROUND',(0,0),(-1,0),BLUE),('TEXTCOLOR',(0,0),(-1,0),colors.white)] st += [('BACKGROUND',(0,1),(-1,-1),LIGHT),('ROWBACKGROUNDS',(0,1),(-1,-1),[colors.white,LIGHT])] if grid: st += [('GRID',(0,0),(-1,-1),0.25,HexColor('#B9C9D8'))] return Table(arr,colWidths=widths,repeatRows=1,style=TableStyle(st)) def flow(items, color=BLUE): # fixed compact visual flow data=[] row=[] for i, x in enumerate(items): row.append(P('<b>'+x+'</b>',cellb)) if i<len(items)-1: row.append(P('<font color="#2072B8" size="10">→</font>',cellb)) widths=[] for i in range(len(row)): widths.append((174*mm-(len(items)-1)*5*mm)/len(items) if i%2==0 else 5*mm) return Table([row],colWidths=widths,style=[('VALIGN',(0,0),(-1,-1),'MIDDLE'),('ALIGN',(0,0),(-1,-1),'CENTER'),('BACKGROUND',(0,0),(0,0),PALE),('BOX',(0,0),(0,0),0.5,color),('LEFTPADDING',(0,0),(-1,-1),2),('RIGHTPADDING',(0,0),(-1,-1),2),('TOPPADDING',(0,0),(-1,-1),3),('BOTTOMPADDING',(0,0),(-1,-1),3)] + [('BACKGROUND',(i,0),(i,0),PALE) for i in range(0,len(row),2)] + [('BOX',(i,0),(i,0),0.5,color) for i in range(0,len(row),2)]) def page_num(canv,doc): canv.saveState(); canv.setStrokeColor(HexColor('#B9C9D8')); canv.line(18*mm,12*mm,192*mm,12*mm) canv.setFont('Helvetica',6.5); canv.setFillColor(GRAY) canv.drawString(18*mm,7.5*mm,'Integrated Endocrine | High-yield 2-page revision sheet') canv.drawRightString(192*mm,7.5*mm,f'Page {doc.page}') canv.restoreState() doc=SimpleDocTemplate(OUT,pagesize=A4,rightMargin=18*mm,leftMargin=18*mm,topMargin=12*mm,bottomMargin=16*mm) story=[] story += [P('INTEGRATED ENDOCRINE: HORMONE CLASSIFICATION & SIGNALING',title),P('One-glance revision sheet based on the uploaded chapter. Key: AA = amino acid; TRE/GRE/VDRE = response elements; RXR = retinoid X receptor.',sub)] # PAGE1 content=tbl([ ['Structural class','High-yield examples','Exam anchor'], ['<b>Amino-acid derivatives</b>','<b>Tyrosine:</b> T<sub>3</sub>, T<sub>4</sub>; catecholamines: epinephrine > norepinephrine > dopamine.<br/><b>Tryptophan:</b> serotonin, melatonin.','Catecholamines are adrenal medullary. Serotonin is abundant in GIT enterochromaffin cells. Sunlight: retina → raphe nuclei → ↑ serotonin. Night: serotonin → pineal melatonin; peak around 2-4 am.'], ['<b>Vitamin derivatives</b>','Vitamin A (retinoids), Vitamin D (calcitriol).','Lipophilic, nuclear receptor action.'], ['<b>Peptide/protein</b>','Small (<50 AA): hypothalamic hormones, posterior pituitary hormones, ACTH.<br/>Large (>50 AA): GH, prolactin (199 AA), insulin (51 AA), PTH, renin.','Water-soluble: usually membrane receptor.'], ['<b>Glycoproteins</b>','TSH, FSH, LH. Large proteins with carbohydrate.','Common <b>α</b> subunit; distinctive <b>β</b> subunit.'], ['<b>Steroids</b>','Adrenal cortex: aldosterone, cortisol, DHEAS, androstenedione.<br/>Gonads: estrogen, progesterone, testosterone.','Cholesterol-derived, intracellular receptor.'], ], [33*mm,67*mm,74*mm]) story += section('1. CLASSIFICATION BY STRUCTURE',content) content=tbl([ ['Feature','GROUP 1: intracellular receptor','GROUP 2: cell-surface receptor'], ['Ligand','Lipophilic','Hydrophilic'], ['Transport / half-life','Carrier protein required; long t½','Mostly free; short t½'], ['Main effect','Gene transcription (slow onset, sustained)','Second messengers: protein phosphorylation / channel regulation (rapid)'], ['Main receptor types','<b>Type 1:</b> cytoplasmic, homodimer.<br/><b>Type 2:</b> nuclear, heterodimer.','GPCR, receptor tyrosine kinase, cytokine/JAK-STAT receptor, serine-threonine kinase receptor.'], ['Examples','Type 1: steroids.<br/>Type 2: T<sub>3</sub>/T<sub>4</sub>, vitamin A/D.','Peptides/proteins and catecholamines.'], ], [32*mm,71*mm,71*mm]) story += section('2. CLASSIFICATION BY MECHANISM: GROUP 1 vs GROUP 2',content) story += [flow(['Steroid enters cell','Binds cytosolic receptor + HSP','HSP released; homodimer','Nuclear GRE binding','Gene transcription'],RED),Spacer(1,2), P('<b>Type 1 steroid receptor:</b> inactive receptor is associated with HSP90/chaperones. Ligand binding alters conformation, releases HSP, and permits receptor-hormone complex migration to nucleus and DNA binding at a <b>GRE</b>.',small),Spacer(1,3), flow(['T<sub>3</sub> / calcitriol enters nucleus','Binds nuclear receptor','Heterodimer with RXR','Corepressor off, coactivator on','TRE/VDRE → transcription'],GREEN),Spacer(1,2), P('<b>Type 2 nuclear receptor:</b> receptor is already nuclear. T<sub>3</sub> binds TR, dismisses corepressor, and TR-RXR activates <b>TRE</b>. Calcitriol binds VDR; VDR-RXR activates <b>VDRE</b> → mRNA → protein.',small)] story.append(PageBreak()) # page2 story += [P('INTEGRATED ENDOCRINE: MEMBRANE SIGNALING & EXAM MAP',title),P('Focus sequence: receptor → G protein/enzyme → second messenger → kinase → phosphorylation → physiological response.',sub)] story += section('3. GPCR: THE CORE SWITCH',tbl([ ['Resting','Activation','Result'], ['7-transmembrane receptor + heterotrimeric G protein (αβγ); α carries GDP.','Hormone binds → GDP exchanged for GTP → α-GTP dissociates from βγ and activates effector.','Amplified intracellular signal. α hydrolyses GTP → GDP to terminate signal.'], ], [57*mm,59*mm,58*mm])) story += [flow(['Hormone','7-TM GPCR','Gα: GDP → GTP','Effector enzyme/channel','2nd messenger','Kinase / response']),Spacer(1,3)] story += section('4. SECOND-MESSENGER PATHWAYS',tbl([ ['Pathway','Signal chart','Principal effect / key associations'], ['<b>Gs → cAMP → PKA</b>','Hormone → GPCR → G<sub>s</sub> → <b>adenylyl cyclase</b> → ATP → cAMP → <b>PKA</b> → phosphoprotein → effect.','cAMP is degraded to 5′-AMP by <b>phosphodiesterase</b>. PKA phosphorylates proteins; phosphatases reverse phosphorylation.<br/><b>Think:</b> TSH, ACTH, FSH/LH, PTH, glucagon, ADH-V2, calcitonin.'], ['<b>Gi</b>','Hormone → GPCR → G<sub>i</sub> ⊣ adenylyl cyclase → ↓ cAMP.','Inhibitory G protein.'], ['<b>Gq → IP<sub>3</sub>/DAG</b>','Hormone → G<sub>q</sub> → <b>PLC</b> cleaves PIP<sub>2</sub> → IP<sub>3</sub> + DAG.<br/>IP<sub>3</sub> → ER Ca<sup>2+</sup> release → calmodulin kinases.<br/>DAG + Ca<sup>2+</sup> → <b>PKC</b> → phosphoproteins.','<b>Think:</b> GnRH, TRH, ADH-V1, angiotensin II, oxytocin, gastrin.'], ['<b>cGMP</b>','NO / ANP → guanylyl cyclase → cGMP → PKG / response.','Vasodilator signaling. NO is soluble guanylyl cyclase; ANP uses membrane guanylyl cyclase.'], ], [31*mm,79*mm,64*mm],fs='mini')) story += section('5. MEMBRANE RECEPTORS BEYOND GPCR',tbl([ ['Receptor','Mechanism','Classic hormonal examples'], ['<b>Receptor tyrosine kinase</b>','Ligand-driven receptor autophosphorylation → downstream kinase cascades.','Insulin; IGF-1.'], ['<b>JAK-STAT / cytokine receptor</b>','No intrinsic kinase: receptor activates JAK → STAT dimer enters nucleus.','GH, prolactin, EPO, thrombopoietin, leptin.'], ['<b>Serine-threonine kinase receptor</b>','Receptor phosphorylates Smad proteins → transcriptional effect.','TGF-β family: activin, inhibin, AMH.'], ], [44*mm,75*mm,55*mm])) story += section('6. 30-SECOND LAST LOOK',tbl([ ['If you see...','Answer cue'], ['Lipophilic + carrier protein + long t½','Intracellular receptor → transcription.'], ['Steroid receptor + HSP90','Cytoplasmic type 1 receptor; homodimer; GRE.'], ['T<sub>3</sub> / calcitriol + RXR','Nuclear type 2 receptor; heterodimer; TRE/VDRE.'], ['7 membrane spans + GDP/GTP','GPCR (αβγ).'], ['Adenylyl cyclase','cAMP → PKA; PDE turns cAMP into 5′-AMP.'], ['PIP<sub>2</sub> cleavage','PLC → IP<sub>3</sub> (Ca<sup>2+</sup>) + DAG (PKC).'], ['Common α, unique β','TSH/FSH/LH glycoproteins.'], ], [64*mm,110*mm])) story += [Spacer(1,2),P('<font color="#A33131"><b>Safety note for memorization:</b></font> “Happy hormones” and serotonin timing notes are not core receptor-classification facts. For exams, prioritize receptor location, coupling pathway, response element, and examples.',small)] doc.build(story,onFirstPage=page_num,onLaterPages=page_num) print(OUT) PY python "/tmp/workspace/endocrine-summary/src/create_summary.py" && python - <<'PY' from pypdf import PdfReader p='/tmp/workspace/endocrine-summary/output/Integrated_Endocrine_2_Page_Summary.pdf' r=PdfReader(p); print('pages=',len(r.pages)); print([(i+1,len(x.extract_text() or '')) for i,x in enumerate(r.pages)]) PY
~/endocrine-summary/output
Integrated Endocrine 2 Page Summary
PDF Document · PDF
Add this two as well in tables
~/endocrine-summary
PPAR agonists
PPAR alpha gamma agonists fibrates glitazones saroglitazar lanifibranor official drug information
~/endocrine-summary/src
python - <<'PY' p='/tmp/workspace/endocrine-summary/src/create_summary.py' s=open(p).read() s=s.replace("['<b>Serine-threonine kinase receptor</b>','Receptor phosphorylates Smad proteins → transcriptional effect.','TGF-β family: activin, inhibin, AMH.'],", "['<b>Serine-threonine kinase receptor</b>','Receptor phosphorylates <b>Smad</b> proteins → transcriptional effect.','TGF-β, activin, inhibin, AMH, BMP-7.<br/><b>Contrast:</b> TGF-α and most other growth factors signal via receptor tyrosine kinase.'],") s=s.replace("story += section('6. 30-SECOND LAST LOOK',tbl([", "story += section('6. PPAR: NUCLEAR-RECEPTOR DRUG MAP',tbl([\n['Target','Agonist / drug class','Main use or exam association'],\n['<b>PPAR-α</b>','Fibrates: fenofibrate, gemfibrozil.','↑ Fatty-acid oxidation; ↓ triglycerides.'],\n['<b>PPAR-γ</b>','Thiazolidinediones (glitazones): pioglitazone, rosiglitazone.','↑ Insulin sensitivity in type 2 diabetes.'],\n['<b>Partial PPAR-γ</b>','Telmisartan.','ARB with partial PPAR-γ agonist activity.'],\n['<b>PPAR-α + γ</b>','Saroglitazar.','Dual agonist; metabolic dyslipidemia association.'],\n['<b>Pan-PPAR</b>','Lanifibranor.','Activates α, γ, and δ; investigational/clinical-development association.'],\n], [31*mm,68*mm,75*mm],fs='mini'))\nstory += section('7. 30-SECOND LAST LOOK',tbl([") s=s.replace("story += [Spacer(1,2),P('<font color=\"#A33131\"><b>Safety note for memorization:</b></font> “Happy hormones” and serotonin timing notes are not core receptor-classification facts. For exams, prioritize receptor location, coupling pathway, response element, and examples.',small)]", "story += [Spacer(1,2),P('<font color=\"#A33131\"><b>PPAR mechanism:</b></font> PPARs are ligand-activated <b>nuclear receptors</b>. They heterodimerize with <b>RXR</b>, bind DNA response elements, and regulate transcription.',small)]") open(p,'w').write(s) PY python "/tmp/workspace/endocrine-summary/src/create_summary.py" && python - <<'PY' from pypdf import PdfReader p='/tmp/workspace/endocrine-summary/output/Integrated_Endocrine_2_Page_Summary.pdf' r=PdfReader(p); print('pages=',len(r.pages)); print([(i+1,len(x.extract_text() or '')) for i,x in enumerate(r.pages)]) PY
Integrated Endocrine 2 Page Summary
PDF Document · PDF
Add color-coded diagrams for the signaling pathways
~/endocrine-summary
color diagram GPCR adenylyl cyclase cAMP PKA hormone signaling pathway
hormone signal transduction
NCBI Bookshelf hormone signal transduction GPCR cAMP IP3 DAG diagrams
mkdir -p "/tmp/workspace/endocrine-summary/assets" && cat > "/tmp/workspace/endocrine-summary/src/create_diagrams.py" <<'PY' from PIL import Image, ImageDraw, ImageFont OUT='/tmp/workspace/endocrine-summary/assets/signaling_pathways_color_coded.png' W,H=1800,780 im=Image.new('RGB',(W,H),'white'); d=ImageDraw.Draw(im) try: font=ImageFont.truetype('/usr/share/fonts/truetype/dejavu/DejaVuSans.ttf',24) bold=ImageFont.truetype('/usr/share/fonts/truetype/dejavu/DejaVuSans-Bold.ttf',27) small=ImageFont.truetype('/usr/share/fonts/truetype/dejavu/DejaVuSans.ttf',20) except: font=bold=small=ImageFont.load_default() NAVY='#17365D'; BLUE='#2072B8'; TEAL='#168A8A'; ORANGE='#F29F05'; PURPLE='#7652A8'; GREEN='#3E8E58'; RED='#B74545'; PALE='#EAF3FA'; GRAY='#44546A' def box(xy, text, fill, outline=NAVY, f=small): x1,y1,x2,y2=xy; d.rounded_rectangle(xy, radius=14, fill=fill, outline=outline, width=2) lines=text.split('\n'); ys=(y1+y2-(len(lines)*22))/2 for line in lines: b=d.textbbox((0,0),line,font=f); d.text(((x1+x2-(b[2]-b[0]))/2,ys),line,font=f,fill=NAVY); ys+=24 def arrow(x1,y1,x2,y2,color=GRAY): d.line((x1,y1,x2,y2), fill=color,width=4) import math a=math.atan2(y2-y1,x2-x1); L=12 for t in (a+2.6,a-2.6): d.line((x2,y2,x2+L*math.cos(t),y2+L*math.sin(t)),fill=color,width=4) def title(x,y,t): d.text((x,y),t,font=bold,fill=NAVY) def panel(x,y,w,h): d.rounded_rectangle((x,y,x+w,y+h),radius=20,outline='#B9C9D8',width=3,fill='#FBFDFF') # panels for x in [20,465,910,1355]: panel(x,45,425,690) # 1 cAMP title(45,65,'1 Gs → cAMP → PKA') box((60,130,210,190),'Hormone', '#FFE7AF'); box((255,130,415,190),'7-TM GPCR', PALE) arrow(210,160,255,160,ORANGE); box((155,235,315,300),'Gαs-GTP', '#D9F1EB',TEAL); arrow(235,190,235,235,TEAL) box((100,350,365,420),'Adenylyl cyclase\nATP → cAMP', '#DDE9FB',BLUE); arrow(235,300,235,350,BLUE) box((140,475,330,540),'PKA', '#F3E7FB',PURPLE); arrow(235,420,235,475,PURPLE) box((90,595,380,665),'Protein phosphorylation\nPhysiologic response', '#E3F1E6',GREEN); arrow(235,540,235,595,GREEN) d.text((65,690),'PDE: cAMP → 5′-AMP',font=small,fill=RED) # 2 Gq title(490,65,'2 Gq → IP₃ / DAG') box((505,130,645,190),'Hormone', '#FFE7AF');box((690,130,850,190),'7-TM GPCR', PALE);arrow(645,160,690,160,ORANGE) box((600,235,760,300),'Gαq-GTP', '#D9F1EB',TEAL);arrow(680,190,680,235,TEAL) box((540,350,820,420),'PLC: PIP₂ → IP₃ + DAG','#DDE9FB',BLUE);arrow(680,300,680,350,BLUE) box((495,480,650,545),'IP₃ → ER\nCa²⁺ release','#F3E7FB',PURPLE); box((710,480,865,545),'DAG + Ca²⁺\n→ PKC','#F3E7FB',PURPLE);arrow(620,420,575,480,PURPLE);arrow(740,420,790,480,PURPLE) box((550,600,810,665),'CaM kinases / PKC\n→ response','#E3F1E6',GREEN);arrow(575,545,650,600,GREEN);arrow(790,545,710,600,GREEN) # 3 catalytic title(935,65,'3 Catalytic receptors') box((955,130,1095,190),'Ligand', '#FFE7AF');box((1140,130,1300,190),'Receptor', PALE);arrow(1095,160,1140,160,ORANGE) box((965,250,1290,320),'RTK: autophosphorylation\n(Insulin, IGF-1)', '#DDE9FB',BLUE) box((965,365,1290,435),'JAK → STAT dimer\n(GH, prolactin)', '#D9F1EB',TEAL) box((965,480,1290,550),'Ser/Thr kinase → Smad\n(TGF-β, activin, inhibin)', '#F3E7FB',PURPLE) box((1000,610,1255,675),'Nuclear transcription', '#E3F1E6',GREEN) for yy in [320,435,550]: arrow(1125,yy,1125,610,GREEN) # 4 nuclear title(1380,65,'4 Intracellular receptors') box((1400,130,1535,190),'Lipophilic\nhormone','#FFE7AF'); box((1580,130,1740,190),'Receptor','#F3E7FB',PURPLE);arrow(1535,160,1580,160,ORANGE) box((1430,260,1710,330),'Type 1: HSP release\n→ homodimer → GRE','#DDE9FB',BLUE) box((1430,390,1710,460),'Type 2: RXR heterodimer\nTRE / VDRE / PPRE','#D9F1EB',TEAL) box((1470,550,1670,620),'Gene transcription\n→ protein', '#E3F1E6',GREEN) arrow(1570,330,1570,550,GREEN);arrow(1570,460,1570,550,GREEN) d.text((1410,675),'PPAR: PPRE via RXR',font=small,fill=RED) # legend d.rounded_rectangle((615,748,1185,775),radius=8,fill='#F6F9FC',outline='#B9C9D8'); d.text((630,750),'Color key: ligand receptor / enzyme G protein kinase / nuclear receptor final response',font=small,fill=GRAY) im.save(OUT) PY python "/tmp/workspace/endocrine-summary/src/create_diagrams.py" python - <<'PY' p='/tmp/workspace/endocrine-summary/src/create_summary.py' s=open(p).read() s=s.replace("from reportlab.platypus import SimpleDocTemplate, Paragraph, Spacer, Table, TableStyle, PageBreak, KeepTogether", "from reportlab.platypus import SimpleDocTemplate, Paragraph, Spacer, Table, TableStyle, PageBreak, KeepTogether, Image") needle="story += [P('INTEGRATED ENDOCRINE: MEMBRANE SIGNALING & EXAM MAP',title),P('Focus sequence: receptor → G protein/enzyme → second messenger → kinase → phosphorylation → physiological response.',sub)]\nstory += section('3. GPCR: THE CORE SWITCH',tbl([\n['Resting','Activation','Result'],\n['7-transmembrane receptor + heterotrimeric G protein (αβγ); α carries GDP.','Hormone binds → GDP exchanged for GTP → α-GTP dissociates from βγ and activates effector.','Amplified intracellular signal. α hydrolyses GTP → GDP to terminate signal.'],\n], [57*mm,59*mm,58*mm]))\nstory += [flow(['Hormone','7-TM GPCR','Gα: GDP → GTP','Effector enzyme/channel','2nd messenger','Kinase / response']),Spacer(1,3)]" repl="story += [P('INTEGRATED ENDOCRINE: MEMBRANE SIGNALING & EXAM MAP',title),P('Focus sequence: receptor → G protein/enzyme → second messenger → kinase → phosphorylation → physiological response.',sub)]\nstory += section('3. COLOR-CODED SIGNALING PATHWAY DIAGRAMS',Image('/tmp/workspace/endocrine-summary/assets/signaling_pathways_color_coded.png',width=174*mm,height=75.4*mm))\nstory += [Spacer(1,2)]" if needle not in s: raise Exception('needle not found') s=s.replace(needle,repl) # Tighten section spacers on p2 globally to maintain 2 pages s=s.replace("def section(t, content):\n return [Table([[P(t,head)]],colWidths=[174*mm]", "def section(t, content):\n return [Table([[P(t,head)]],colWidths=[174*mm]") open(p,'w').write(s) PY python "/tmp/workspace/endocrine-summary/src/create_summary.py" && python - <<'PY' from pypdf import PdfReader p='/tmp/workspace/endocrine-summary/output/Integrated_Endocrine_2_Page_Summary.pdf' r=PdfReader(p); print('pages=',len(r.pages)); print([(i+1,len(x.extract_text() or '')) for i,x in enumerate(r.pages)]) PY
~/endocrine-summary/output
Integrated Endocrine 2 Page Summary
PDF Document · PDF
Add clinical examples and drug associations to each pathway
endocrine hormone signal transduction
hormone receptor signaling clinical drug examples cAMP IP3 JAK STAT receptor tyrosine kinase NCBI
python - <<'PY' p='/tmp/workspace/endocrine-summary/src/create_diagrams.py' s=open(p).read() s=s.replace("d.text((65,690),'PDE: cAMP → 5′-AMP',font=small,fill=RED)", "d.text((48,680),'Clinical: endocrine stimulation & water balance',font=small,fill=GRAY)\nd.text((48,707),'Drugs: β₂ agonists, glucagon; PDE inhibitors ↑ cAMP',font=small,fill=RED)") s=s.replace("box((550,600,810,665),'CaM kinases / PKC\\n→ response','#E3F1E6',GREEN);arrow(575,545,650,600,GREEN);arrow(790,545,710,600,GREEN)", "box((550,570,810,630),'CaM kinases / PKC\\n→ response','#E3F1E6',GREEN);arrow(575,545,650,570,GREEN);arrow(790,545,710,570,GREEN)\nd.text((490,660),'Clinical: uterine contraction, vasoconstriction',font=small,fill=GRAY)\nd.text((490,690),'Drugs: oxytocin, vasopressin (V1); ARBs block AT₁',font=small,fill=RED)") s=s.replace("for yy in [320,435,550]: arrow(1125,yy,1125,610,GREEN)", "for yy in [320,435,550]: arrow(1125,yy,1125,610,GREEN)\nd.text((930,685),'Clinical/drugs: insulin (DM); GH therapy; JAK inhibitors',font=small,fill=RED)\nd.text((930,710),'RTK cancer link: HER2/EGFR targeted therapies',font=small,fill=GRAY)") s=s.replace("d.text((1410,675),'PPAR: PPRE via RXR',font=small,fill=RED)", "d.text((1380,670),'Clinical: steroid-responsive inflammation; thyroid/Vit D action',font=small,fill=GRAY)\nd.text((1380,700),'Drugs: glucocorticoids; levothyroxine; PPAR fibrates/TZDs',font=small,fill=RED)") open(p,'w').write(s) PY python "/tmp/workspace/endocrine-summary/src/create_diagrams.py" && python "/tmp/workspace/endocrine-summary/src/create_summary.py" && python - <<'PY' from pypdf import PdfReader p='/tmp/workspace/endocrine-summary/output/Integrated_Endocrine_2_Page_Summary.pdf' r=PdfReader(p) print('pages=',len(r.pages)); print([(i+1,len(x.extract_text() or '')) for i,x in enumerate(r.pages)]) PY
Integrated Endocrine 2 Page Summary
PDF Document · PDF
Also add orphan receptors
orphan nuclear receptors SF-1 DAX-1 HNF4 alpha constitutive activity medical physiology
~/endocrine-summary/src
~/
python - <<'PY' p='/tmp/workspace/endocrine-summary/src/create_summary.py' s=open(p).read() old="P('<b>Type 2 nuclear receptor:</b> receptor is already nuclear. T<sub>3</sub> binds TR, dismisses corepressor, and TR-RXR activates <b>TRE</b>. Calcitriol binds VDR; VDR-RXR activates <b>VDRE</b> → mRNA → protein.',small)]\nstory.append(PageBreak())" new="P('<b>Type 2 nuclear receptor:</b> receptor is already nuclear. T<sub>3</sub> binds TR, dismisses corepressor, and TR-RXR activates <b>TRE</b>. Calcitriol binds VDR; VDR-RXR activates <b>VDRE</b> → mRNA → protein.',small),Spacer(1,3)]\nstory += section('3. ORPHAN NUCLEAR RECEPTORS',tbl([\n['Definition / mechanism','Examples','Clinical exam link'],\n['Nuclear-receptor family members with an endogenous ligand not established (or historically unknown). They regulate transcription; some have ligand-independent, constitutive activity.','<b>SF-1</b> (NR5A1), <b>DAX-1</b> (NR0B1), <b>HNF-4α</b> (NR2A1).','SF-1/DAX-1: adrenal and gonadal development, steroidogenesis. Variants may cause adrenal insufficiency and/or gonadal dysgenesis. HNF-4α: MODY1 association.'],\n], [60*mm,48*mm,66*mm],fs='mini'))\nstory.append(PageBreak())" if old not in s: raise Exception('insertion target missing') s=s.replace(old,new) s=s.replace("story += section('3. COLOR-CODED SIGNALING PATHWAY DIAGRAMS'", "story += section('4. COLOR-CODED SIGNALING PATHWAY DIAGRAMS'") s=s.replace("story += section('4. SECOND-MESSENGER PATHWAYS'", "story += section('5. SECOND-MESSENGER PATHWAYS'") s=s.replace("story += section('5. MEMBRANE RECEPTORS BEYOND GPCR'", "story += section('6. MEMBRANE RECEPTORS BEYOND GPCR'") s=s.replace("story += section('6. PPAR: NUCLEAR-RECEPTOR DRUG MAP'", "story += section('7. PPAR: NUCLEAR-RECEPTOR DRUG MAP'") s=s.replace("story += section('7. 30-SECOND LAST LOOK'", "story += section('8. 30-SECOND LAST LOOK'") open(p,'w').write(s) PY python "/tmp/workspace/endocrine-summary/src/create_summary.py" && python - <<'PY' from pypdf import PdfReader p='/tmp/workspace/endocrine-summary/output/Integrated_Endocrine_2_Page_Summary.pdf' r=PdfReader(p) print('pages=',len(r.pages)) for i,page in enumerate(r.pages): text=page.extract_text() or '' print(i+1,len(text), 'ORPHAN' in text, text[-100:]) PY
~/endocrine-summary/output
Integrated Endocrine 2 Page Summary
PDF Document · PDF