# Build a large "drawn" mind map as a vector SVG (zoomable) for # "Trascrizione negli eucarioti", fully in Italian, based on the user's text. import math from textwrap import wrap W, H = 2400, 1600 # canvas size (px) # Basic SVG helpers def svg_header(w, h): return f''' ''' def svg_footer(): return '\n' def draw_box(x, y, w, h, title, body_lines, rx=20, ry=20): # Rounded rect + title + body # Apply a subtle shadow rect = f'\n' # Title tx = x + 18 ty = y + 38 t = f'{title}\n' # Body lines = [] cur_y = ty + 24 for line in body_lines: lines.append(f'• {line}') cur_y += 26 return rect + t + "\n".join(lines) + "\n" def multiline(text, width=54): # Wrap preserving short bullets out = [] for paragraph in text.split("\n"): paragraph = paragraph.strip() if not paragraph: out.append("") else: out.extend(wrap(paragraph, width=width)) return out def draw_connector(x1, y1, x2, y2): # Smooth cubic bezier between (x1,y1) and (x2,y2) dx = (x2 - x1) * 0.5 c1x, c1y = x1 + dx, y1 c2x, c2y = x2 - dx, y2 return f'\n' svg = [svg_header(W, H)] # Center node cx, cy = W//2, H//2 center_w, center_h = 520, 160 center_x, center_y = cx - center_w//2, cy - center_h//2 svg.append(f'') svg.append(f'Trascrizione negli eucarioti') svg.append(f'maggior complessità: polimerasi, fattori, promotori, regolazione') # Predefine nodes (title, body lines, target position) nodes = [] # 1. RNA Polimerasi nodes.append({ "title":"RNA polimerasi (Pol I, II, III)", "body": multiline( "Pol I — nucleolo; precursore 45S → 18S, 28S, 5,8S; promotore: core (-35→+15), upstream (-150→-50), variabile tra specie.\n" "Pol II — mRNA; snRNA (magg.); miRNA (18–25 nt). GTF: TFIIA, TFIIB, TFIID, TFIIE, TFIIF, TFIIH, TFIIJ. Promotori: TATA (−30/−25), spesso CAAT (~−80), enhancer (50–100 nt; fino a >−1000; fino a ~100×). Promotori TATA-less: riconosciuti da TFIID.\n" "Pol III — rRNA 5S, tRNA, alcuni snRNA, scRNA SRP; promotori intragenici; assenti TATA/CAAT." , 62), "x": 140, "y": 120, "w": 700, "h": 360 }) # 2. Piccoli RNA nodes.append({ "title":"Piccoli RNA (sRNA)", "body": multiline( "snRNA — splicing; formano snRNP con proteine; per lo più da Pol II, alcuni da Pol III.\n" "snoRNA — maturazione rRNA; generati da Pol II come risultato dello splicing.\n" "scRNA — SRP (Signal Recognition Particle), trascritto da Pol III.\n" "miRNA — 18–25 nt; regolazione dell’espressione genica (degradazione/traslazione); trascritti soprattutto da Pol II." , 60), "x": 1560, "y": 110, "w": 680, "h": 300 }) # 3. Fattori generali di trascrizione / Assemblaggio nodes.append({ "title":"GTF & Assemblaggio Pol II", "body": multiline( "TFIID = TBP + 8–12 TAF; TBP riconosce TATA box.\n" "Sequenza classica: TFIID → TFIIA → TFIIB (lega attivatori/coattivatori; DNA bending) → TFIIE/F, TFIIH, TFIIJ + core Pol II → apertura DNA + inizio con idrolisi di ATP.\n" "Modello alternativo: TFIID–TFIIA + il resto della Pol II in un’unica tappa." , 62), "x": 130, "y": 540, "w": 740, "h": 280 }) # 4. Promotori e sequenze nodes.append({ "title":"Promotori & sequenze regolatrici", "body": multiline( "Pol I — elemento core (-35→+15) + upstream (-150→-50).\n" "Pol II — TATA (−30/−25), spesso CAAT (~−80); enhancer 50–100 nt fino a >−1000 basi; ↑ efficienza fino a ~100×; esistono TATA-less (riconosciuti da TFIID).\n" "Pol III — promotori intragenici (interni), senza TATA/CAAT." , 64), "x": 980, "y": 120, "w": 500, "h": 300 }) # 5. Regolazione combinatoria nodes.append({ "title":"Regolazione combinatoria", "body": multiline( "Attivatori: recettori steroidei su SRE; fattore AP1.\n" "Coattivatori: CBP (CREB-binding protein) collega TFIIB all’attivatore.\n" "Via cAMP: stimolo → ↑ cAMP → CREB → CRE su DNA → recluta CBP → induzione trascrizionale.\n" "Esempio: gene GnRH con elementi SRE + AP1 a monte del promotore." , 62), "x": 1560, "y": 460, "w": 680, "h": 280 }) # 6. Allungamento nodes.append({ "title":"Elongazione", "body": multiline( "Dopo l’avvio, le RNA polimerasi eucariotiche procedono senza interruzione aggiungendo ribonucleosidi trifosfati (rNTP) al trascritto nascente." , 68), "x": 980, "y": 470, "w": 500, "h": 160 }) # 7. Terminazione Pol II nodes.append({ "title":"Terminazione (Pol II)", "body": multiline( "Avviene a valle del sito di poliadenilazione. Il CTD della Pol II coordina fattori di taglio (cleavage) e poliadenilazione → rilascio dell’mRNA poliadenilato (maturo). La porzione residua è degradata da Rat1. In alcuni casi: ipotesi di ruolo catalitico dell’RNA stesso (ribozima)." , 62), "x": 980, "y": 670, "w": 500, "h": 220 }) # 8. Confronto procarioti nodes.append({ "title":"Procarioti vs Eucarioti", "body": multiline( "Procarioti: una sola RNA polimerasi; mRNA spesso policistronici (più geni, unica funzione). " "Eucarioti: tre polimerasi; promotori complessi (TATA, CAAT, enhancer); regolazione combinatoria; trascritti in genere monocistronici (un gene → un prodotto)." , 64), "x": 1560, "y": 770, "w": 680, "h": 220 }) # 9. Glossario / Terminologia essenziale nodes.append({ "title":"Glossario essenziale", "body": multiline( "TATA box — sequenza ricca in A/T a −30/−25 per Pol II; riconosciuta da TBP.\n" "CAAT box — regione regolatrice tipica (~−80).\n" "Enhancer — 50–100 nt; anche molto distanti (>−1000); ↑ fino a ~100×.\n" "TFIID — complesso TBP + 8–12 TAF.\n" "snRNP — complessi snRNA+proteine per lo splicing.\n" "CTD — coda C-terminale di Pol II, piattaforma per taglio/poliA.\n" "Rat1 — esonucleasi che degrada l’RNA residuo dopo il rilascio dell’mRNA.\n" "CRE/CREB/CBP — elementi, fattore e coattivatore nella risposta al cAMP.\n" "SRE/AP1 — elementi per recettori steroidei e per il fattore AP1." , 62), "x": 130, "y": 860, "w": 740, "h": 360 }) # Draw connectors from center to each box (using approximate anchor points) def anchor_to_center(box): # Choose a side of the box closer to the center x, y, w, h = box["x"], box["y"], box["w"], box["h"] # Determine which side is nearest in terms of Euclidean distance from center candidates = [ (x+w/2, y, "top"), (x+w/2, y+h, "bottom"), (x, y+h/2, "left"), (x+w, y+h/2, "right") ] # pick the closest point to the center px, py, _ = min(candidates, key=lambda p: (p[0]-cx)**2 + (p[1]-cy)**2) # choose center box anchor: nearest side # center anchors around the edge of the central rectangle # We'll connect from central edge towards the node direction vx, vy = px - cx, py - cy # select edge on center rect (compute intersection with central rect bounds) left, right = center_x, center_x + center_w top, bottom = center_y, center_y + center_h tx, ty = cx, cy # default if abs(vx) > abs(vy): # connect horizontally if vx > 0: # to the right tx, ty = right, cy else: # to the left tx, ty = left, cy else: # connect vertically if vy > 0: # to the bottom tx, ty = cx, bottom else: tx, ty = cx, top return tx, ty, px, py # Add nodes and connectors for node in nodes: # box drawing svg.append(draw_box(node["x"], node["y"], node["w"], node["h"], node["title"], node["body"])) # connector x1, y1, x2, y2 = anchor_to_center(node) svg.append(draw_connector(x1, y1, x2, y2)) # Footer note svg.append(f'Mappa (SVG) — zooma per leggere tutti i dettagli. Basata sul testo fornito.') svg.append(svg_footer()) out_path = "/mnt/data/Mappa_Trascrizione_Eucarioti_disegnata.svg" with open(out_path, "w", encoding="utf-8") as f: f.write("".join(svg)) out_path