Skip to content

Commit 5409054

Browse files
committed
Updated documentation
1 parent d70c087 commit 5409054

1 file changed

Lines changed: 70 additions & 2 deletions

File tree

README.md

Lines changed: 70 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,74 @@ gcnvplot plot \
4646
--output plot.svg
4747
```
4848

49-
## Example data
49+
## Synthetic example
5050

51-
A tiny synthetic BRCA1 transcript example is available in [`examples/brca1_synthetic`](examples/brca1_synthetic). It demonstrates a highlighted multi-exon deletion, open dots for intervals outside exons, and an uncovered-exon marker.
51+
A tiny synthetic BRCA1 transcript example is available in [`examples/brca1_synthetic`](examples/brca1_synthetic). It demonstrates a highlighted multi-exon deletion, filled and open sample dots, and an uncovered-exon marker.
52+
53+
![Synthetic BRCA1 transcript plot](examples/brca1_synthetic/brca1_synthetic.svg)
54+
55+
You can render it directly from the repository root:
56+
57+
```bash
58+
gcnvplot plot \
59+
--read-counts examples/brca1_synthetic/sample_deletion.tsv \
60+
--background examples/brca1_synthetic/background.tsv \
61+
--transcript NM_007294.4 \
62+
--gtf examples/brca1_synthetic/brca1_mane_minimal.gtf \
63+
--sample-name "Synthetic BRCA1 exon 13-15 deletion" \
64+
--highlight chr17:43070928-43076614 \
65+
--output examples/brca1_synthetic/brca1_synthetic.svg
66+
```
67+
68+
This example is designed to show:
69+
70+
- a depressed log2 signal across BRCA1 exons 13-15,
71+
- an intronic interval inside the deletion rendered as an open but still depressed dot,
72+
- an intronic interval outside the deletion rendered as an open near-baseline dot,
73+
- an uncovered exon marked with a triangle in the transcript track.
74+
75+
## Details
76+
77+
`gcnvplot` uses a median-of-ratios normalization. For `create-background`, let `c_ij` be the raw count for interval `i` in background sample `j`.
78+
79+
1. Interval baseline:
80+
81+
`b_i = median_j(c_ij)` using only positive counts.
82+
83+
2. Background-sample size factor:
84+
85+
`s_j = median_i(c_ij / b_i)` over intervals with `c_ij > 0` and `b_i > 0`.
86+
87+
3. Normalized background count:
88+
89+
`n_ij = c_ij / s_j`
90+
91+
The background TSV then stores interval-wise summary statistics across the normalized values `n_ij`, including:
92+
93+
- `BG_NORM_MEAN`
94+
- `BG_NORM_MEDIAN`
95+
- `BG_NORM_SD`
96+
- `BG_NORM_P5`
97+
- `BG_NORM_P95`
98+
99+
For `plot`, let `c_i` be the raw count for the plotted sample at interval `i`.
100+
101+
1. The sample is normalized against the background baselines with the same rule:
102+
103+
`s = median_i(c_i / b_i)`
104+
105+
`n_i = c_i / s`
106+
107+
2. The plotted signal is the stabilized log2 ratio against the background median:
108+
109+
`signal_i = log2((n_i + 0.01) / (m_i + 0.01))`
110+
111+
where `m_i = BG_NORM_MEDIAN`.
112+
113+
3. The background ribbon is drawn by transforming the stored background percentiles in the same way:
114+
115+
`lower_i = log2((p5_i + 0.01) / (m_i + 0.01))`
116+
117+
`upper_i = log2((p95_i + 0.01) / (m_i + 0.01))`
118+
119+
This means the plotted curve shows relative dosage after library-size normalization, while the ribbon shows where the central background cohort typically lies for each interval.

0 commit comments

Comments
 (0)