if one offsprinng has gilbert syndrome can all offsprings have it ?
Gilbert syndrome inheritance pattern autosomal recessive UGT1A1 offspring risk
| Parent 1 | Parent 2 | Chance each child is AFFECTED |
|---|---|---|
| Affected (homozygous) | Affected (homozygous) | 100% - ALL offspring affected |
| Affected (homozygous) | Carrier (heterozygous) | 50% affected, 50% carriers |
| Carrier x Carrier | Carrier x Carrier | 25% affected, 50% carriers, 25% unaffected |
| Affected (homozygous) | No variant (normal) | 0% affected - all will be carriers |
Create a genetic inheritance calculator for Gilbert syndromegirl child noo problem
mkdir -p /home/daytona/workspace/gilbert-calculator
~/gilbert-calculator/index.html
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0"/>
<title>Gilbert Syndrome Inheritance Calculator</title>
<style>
* { box-sizing: border-box; margin: 0; padding: 0; }
body {
font-family: 'Segoe UI', system-ui, sans-serif;
background: linear-gradient(135deg, #f0f4ff 0%, #fdf0fa 100%);
min-height: 100vh;
padding: 24px 16px;
color: #1a1a2e;
}
.container {
max-width: 800px;
margin: 0 auto;
}
header {
text-align: center;
margin-bottom: 32px;
}
header h1 {
font-size: 1.8rem;
font-weight: 700;
color: #3d2c8d;
margin-bottom: 6px;
}
header p {
font-size: 0.95rem;
color: #666;
max-width: 520px;
margin: 0 auto;
line-height: 1.5;
}
.gene-badge {
display: inline-block;
background: #e8e0ff;
color: #3d2c8d;
font-size: 0.78rem;
font-weight: 600;
padding: 3px 10px;
border-radius: 20px;
margin-top: 8px;
letter-spacing: 0.5px;
}
.card {
background: white;
border-radius: 16px;
padding: 24px;
box-shadow: 0 4px 20px rgba(61,44,141,0.08);
margin-bottom: 20px;
}
.card h2 {
font-size: 1rem;
font-weight: 700;
color: #3d2c8d;
margin-bottom: 16px;
display: flex;
align-items: center;
gap: 8px;
}
.parent-grid {
display: grid;
grid-template-columns: 1fr 1fr;
gap: 20px;
}
@media (max-width: 560px) {
.parent-grid { grid-template-columns: 1fr; }
}
.parent-box {
border: 2px solid #e8e0ff;
border-radius: 12px;
padding: 16px;
transition: border-color 0.2s;
}
.parent-box:hover { border-color: #9b72cf; }
.parent-box h3 {
font-size: 0.9rem;
font-weight: 700;
margin-bottom: 12px;
display: flex;
align-items: center;
gap: 8px;
}
.parent-box h3 .icon {
width: 28px; height: 28px;
border-radius: 50%;
display: flex; align-items: center; justify-content: center;
font-size: 14px;
}
.father .icon { background: #dbeafe; }
.mother .icon { background: #fce7f3; }
.radio-group {
display: flex;
flex-direction: column;
gap: 8px;
}
.radio-option {
display: flex;
align-items: center;
gap: 10px;
padding: 8px 10px;
border-radius: 8px;
cursor: pointer;
transition: background 0.15s;
font-size: 0.88rem;
}
.radio-option:hover { background: #f5f0ff; }
.radio-option input[type=radio] { accent-color: #3d2c8d; width: 16px; height: 16px; cursor: pointer; }
.genotype-tag {
font-family: 'Courier New', monospace;
font-size: 0.82rem;
font-weight: 700;
padding: 2px 7px;
border-radius: 5px;
margin-left: auto;
}
.tag-normal { background: #d1fae5; color: #065f46; }
.tag-carrier { background: #fef9c3; color: #713f12; }
.tag-affected { background: #fee2e2; color: #991b1b; }
.calc-btn {
width: 100%;
background: linear-gradient(135deg, #3d2c8d, #7c3aed);
color: white;
border: none;
border-radius: 10px;
padding: 14px;
font-size: 1rem;
font-weight: 700;
cursor: pointer;
transition: opacity 0.2s, transform 0.1s;
letter-spacing: 0.3px;
}
.calc-btn:hover { opacity: 0.92; transform: translateY(-1px); }
.calc-btn:active { transform: translateY(0); }
/* Results */
#results { display: none; }
.results-header {
display: flex;
align-items: center;
justify-content: space-between;
margin-bottom: 18px;
flex-wrap: wrap;
gap: 8px;
}
.results-header h2 {
font-size: 1rem;
font-weight: 700;
color: #3d2c8d;
}
.cross-label {
font-family: 'Courier New', monospace;
font-size: 0.85rem;
background: #f5f0ff;
color: #3d2c8d;
padding: 4px 12px;
border-radius: 20px;
font-weight: 700;
}
/* Punnett Square */
.punnett-wrap {
overflow-x: auto;
margin-bottom: 20px;
}
.punnett-table {
border-collapse: collapse;
margin: 0 auto;
min-width: 240px;
}
.punnett-table th, .punnett-table td {
width: 80px; height: 70px;
text-align: center;
vertical-align: middle;
border: 2px solid #e8e0ff;
font-size: 0.9rem;
padding: 6px;
}
.punnett-table th {
background: #f5f0ff;
color: #3d2c8d;
font-weight: 700;
font-family: 'Courier New', monospace;
font-size: 1rem;
}
.punnett-table th.corner { background: white; border: none; }
.cell-normal { background: #d1fae5; }
.cell-carrier { background: #fef9c3; }
.cell-affected { background: #fee2e2; }
.cell-genotype {
font-family: 'Courier New', monospace;
font-weight: 700;
font-size: 0.95rem;
display: block;
margin-bottom: 4px;
}
.cell-label {
font-size: 0.7rem;
color: #555;
line-height: 1.2;
}
/* Probability bars */
.prob-list { display: flex; flex-direction: column; gap: 12px; }
.prob-item { }
.prob-header {
display: flex;
align-items: center;
justify-content: space-between;
margin-bottom: 5px;
}
.prob-name {
font-size: 0.88rem;
font-weight: 600;
display: flex;
align-items: center;
gap: 8px;
}
.dot {
width: 10px; height: 10px;
border-radius: 50%;
flex-shrink: 0;
}
.dot-normal { background: #10b981; }
.dot-carrier { background: #f59e0b; }
.dot-affected { background: #ef4444; }
.prob-pct {
font-size: 0.88rem;
font-weight: 700;
color: #3d2c8d;
}
.bar-bg {
background: #f0f0f0;
border-radius: 6px;
height: 10px;
overflow: hidden;
}
.bar-fill {
height: 100%;
border-radius: 6px;
transition: width 0.8s cubic-bezier(0.34,1.56,0.64,1);
}
.bar-normal { background: #10b981; }
.bar-carrier { background: #f59e0b; }
.bar-affected { background: #ef4444; }
/* Summary box */
.summary-box {
border-radius: 10px;
padding: 14px 16px;
margin-top: 18px;
font-size: 0.88rem;
line-height: 1.6;
}
.summary-box.risk-none { background: #d1fae5; border-left: 4px solid #10b981; color: #065f46; }
.summary-box.risk-low { background: #fef9c3; border-left: 4px solid #f59e0b; color: #713f12; }
.summary-box.risk-medium { background: #ffedd5; border-left: 4px solid #f97316; color: #7c2d12; }
.summary-box.risk-high { background: #fee2e2; border-left: 4px solid #ef4444; color: #991b1b; }
.summary-box.risk-certain { background: #ede9fe; border-left: 4px solid #7c3aed; color: #3d2c8d; }
/* Legend */
.legend {
display: flex;
flex-wrap: wrap;
gap: 12px;
margin-bottom: 18px;
font-size: 0.8rem;
}
.legend-item {
display: flex;
align-items: center;
gap: 6px;
}
.legend-swatch {
width: 16px; height: 16px;
border-radius: 4px;
}
/* Info note */
.info-note {
font-size: 0.8rem;
color: #777;
text-align: center;
margin-top: 8px;
line-height: 1.5;
}
/* Fraction display */
.fraction {
font-family: 'Courier New', monospace;
font-size: 0.82rem;
color: #888;
}
/* Disclaimer */
.disclaimer {
font-size: 0.75rem;
color: #999;
text-align: center;
margin-top: 24px;
line-height: 1.6;
padding: 0 8px;
}
</style>
</head>
<body>
<div class="container">
<header>
<h1>Gilbert Syndrome Inheritance Calculator</h1>
<p>Calculate the probability of Gilbert syndrome in offspring based on parental genotypes.</p>
<span class="gene-badge">UGT1A1 Gene · Autosomal Recessive · UGT1A1*28</span>
</header>
<!-- Input Card -->
<div class="card">
<h2>⚙️ Select Parental Genotypes</h2>
<div class="parent-grid">
<!-- Father -->
<div class="parent-box father">
<h3>
<span class="icon">👨</span>
Father
</h3>
<div class="radio-group" id="father-group">
<label class="radio-option">
<input type="radio" name="father" value="NN" checked />
<span>Normal (unaffected)</span>
<span class="genotype-tag tag-normal">N/N</span>
</label>
<label class="radio-option">
<input type="radio" name="father" value="NG" />
<span>Carrier</span>
<span class="genotype-tag tag-carrier">N/g</span>
</label>
<label class="radio-option">
<input type="radio" name="father" value="GG" />
<span>Affected (Gilbert's)</span>
<span class="genotype-tag tag-affected">g/g</span>
</label>
</div>
</div>
<!-- Mother -->
<div class="parent-box mother">
<h3>
<span class="icon">👩</span>
Mother
</h3>
<div class="radio-group" id="mother-group">
<label class="radio-option">
<input type="radio" name="mother" value="NN" checked />
<span>Normal (unaffected)</span>
<span class="genotype-tag tag-normal">N/N</span>
</label>
<label class="radio-option">
<input type="radio" name="mother" value="NG" />
<span>Carrier</span>
<span class="genotype-tag tag-carrier">N/g</span>
</label>
<label class="radio-option">
<input type="radio" name="mother" value="GG" />
<span>Affected (Gilbert's)</span>
<span class="genotype-tag tag-affected">g/g</span>
</label>
</div>
</div>
</div>
<br/>
<button class="calc-btn" onclick="calculate()">Calculate Offspring Risk</button>
</div>
<!-- Results Card -->
<div class="card" id="results">
<div class="results-header">
<h2>📊 Results</h2>
<span class="cross-label" id="cross-label"></span>
</div>
<!-- Legend -->
<div class="legend">
<div class="legend-item">
<div class="legend-swatch" style="background:#d1fae5; border:1px solid #10b981;"></div>
<span>Normal (N/N) - No variant</span>
</div>
<div class="legend-item">
<div class="legend-swatch" style="background:#fef9c3; border:1px solid #f59e0b;"></div>
<span>Carrier (N/g) - Unaffected but carries variant</span>
</div>
<div class="legend-item">
<div class="legend-swatch" style="background:#fee2e2; border:1px solid #ef4444;"></div>
<span>Affected (g/g) - Has Gilbert Syndrome</span>
</div>
</div>
<!-- Punnett Square -->
<div class="punnett-wrap">
<table class="punnett-table" id="punnett-table"></table>
</div>
<!-- Probability Bars -->
<div class="prob-list" id="prob-list"></div>
<!-- Summary -->
<div class="summary-box" id="summary-box"></div>
<p class="info-note">Gilbert syndrome is <strong>autosomal recessive</strong>. The condition is <strong>not sex-linked</strong> - sons and daughters have equal risk. Carriers (N/g) are unaffected but can pass the variant to their children.</p>
</div>
<p class="disclaimer">For educational purposes only. Genetic counselling by a qualified professional is recommended for family planning decisions. Gilbert syndrome is benign - it causes intermittent mild jaundice and has no serious health consequences.</p>
</div>
<script>
// Gametes each genotype produces
const gametes = {
NN: ['N', 'N'],
NG: ['N', 'g'],
GG: ['g', 'g']
};
const genotypeOf = (a, b) => {
const pair = [a, b].sort().join('');
if (pair === 'NN') return 'NN';
if (pair === 'Ng') return 'NG';
if (pair === 'gg') return 'GG';
return 'NG';
};
const labels = {
NN: { text: 'Normal', cls: 'cell-normal', tag: 'N/N', desc: 'Unaffected,\nno variant' },
NG: { text: 'Carrier', cls: 'cell-carrier', tag: 'N/g', desc: 'Unaffected,\ncarrier' },
GG: { text: 'Affected', cls: 'cell-affected', tag: 'g/g', desc: 'Gilbert\nSyndrome' }
};
const displayGeno = { NN: 'N/N', NG: 'N/g', GG: 'g/g' };
function calculate() {
const fVal = document.querySelector('input[name="father"]:checked').value;
const mVal = document.querySelector('input[name="mother"]:checked').value;
const fG = gametes[fVal];
const mG = gametes[mVal];
// Build all 4 outcomes
const outcomes = [];
for (let f of fG) {
for (let m of mG) {
outcomes.push(genotypeOf(f, m));
}
}
// Count
const counts = { NN: 0, NG: 0, GG: 0 };
outcomes.forEach(o => counts[o]++);
const total = outcomes.length; // always 4
// Cross label
document.getElementById('cross-label').textContent =
displayGeno[fVal] + ' × ' + displayGeno[mVal];
// Punnett Table
const table = document.getElementById('punnett-table');
table.innerHTML = '';
// Header row
const headRow = document.createElement('tr');
const corner = document.createElement('th');
corner.className = 'corner';
corner.innerHTML = `<small style="color:#aaa;font-size:0.7rem">♂ / ♀</small>`;
headRow.appendChild(corner);
for (let m of mG) {
const th = document.createElement('th');
th.textContent = m;
headRow.appendChild(th);
}
table.appendChild(headRow);
// Data rows
for (let f of fG) {
const tr = document.createElement('tr');
const rowHead = document.createElement('th');
rowHead.textContent = f;
tr.appendChild(rowHead);
for (let m of mG) {
const geno = genotypeOf(f, m);
const info = labels[geno];
const td = document.createElement('td');
td.className = info.cls;
td.innerHTML = `<span class="cell-genotype">${info.tag}</span><span class="cell-label">${info.desc.replace('\n','<br/>')}</span>`;
tr.appendChild(td);
}
table.appendChild(tr);
}
// Probability bars
const probList = document.getElementById('prob-list');
probList.innerHTML = '';
const types = [
{ key: 'GG', label: 'Affected (Gilbert Syndrome)', dotCls: 'dot-affected', barCls: 'bar-affected' },
{ key: 'NG', label: 'Carrier (Unaffected)', dotCls: 'dot-carrier', barCls: 'bar-carrier' },
{ key: 'NN', label: 'Normal (No variant)', dotCls: 'dot-normal', barCls: 'bar-normal' },
];
types.forEach(t => {
const pct = Math.round((counts[t.key] / total) * 100);
const frac = counts[t.key] + ' / ' + total;
const div = document.createElement('div');
div.className = 'prob-item';
div.innerHTML = `
<div class="prob-header">
<span class="prob-name">
<span class="dot ${t.dotCls}"></span>
${t.label}
</span>
<span class="prob-pct">${pct}% <span class="fraction">(${frac})</span></span>
</div>
<div class="bar-bg">
<div class="bar-fill ${t.barCls}" style="width: 0%" data-target="${pct}%"></div>
</div>
`;
probList.appendChild(div);
});
// Animate bars after paint
requestAnimationFrame(() => {
requestAnimationFrame(() => {
document.querySelectorAll('.bar-fill').forEach(bar => {
bar.style.width = bar.dataset.target;
});
});
});
// Summary
const affectedPct = Math.round((counts.GG / total) * 100);
const box = document.getElementById('summary-box');
box.className = 'summary-box';
let riskClass, msg;
if (affectedPct === 0) {
riskClass = 'risk-none';
msg = `<strong>No risk of Gilbert syndrome</strong> in offspring with this parental combination. However, ${counts.NG > 0 ? 'children may become carriers of the UGT1A1 variant and could pass it to future generations.' : 'children will have no UGT1A1 variant at all.'}`;
} else if (affectedPct === 25) {
riskClass = 'risk-low';
msg = `<strong>25% chance</strong> (1 in 4) each child will have Gilbert syndrome. On average, 1 in 4 children will be affected, 2 in 4 will be unaffected carriers, and 1 in 4 will have no variant. This is the classic autosomal recessive carrier cross.`;
} else if (affectedPct === 50) {
riskClass = 'risk-medium';
msg = `<strong>50% chance</strong> (1 in 2) each child will have Gilbert syndrome. The other 50% will be unaffected carriers.`;
} else if (affectedPct === 100) {
riskClass = 'risk-certain';
msg = `<strong>100% of offspring</strong> will have Gilbert syndrome. Both parents are homozygous for the UGT1A1*28 variant, so every child will inherit two copies. Remember: Gilbert syndrome is benign - symptoms (mild jaundice) are typically intermittent and triggered by fasting, stress, or illness.`;
} else {
riskClass = 'risk-low';
msg = `Affected offspring probability: <strong>${affectedPct}%</strong>.`;
}
box.classList.add(riskClass);
box.innerHTML = msg;
// Show results
const resEl = document.getElementById('results');
resEl.style.display = 'block';
resEl.scrollIntoView({ behavior: 'smooth', block: 'start' });
}
// Auto-calculate on page load with defaults
window.onload = () => calculate();
</script>
</body>
</html>
ls -lh /home/daytona/workspace/gilbert-calculator/
index
HTML File · HTML