Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
64 changes: 46 additions & 18 deletions docs/src/content/docs/rna/qualimap.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,7 @@ Alignment-level statistics for all primary reads:

| Field | Description |
| --------------------- | ---------------------------------------------------------------------- |
| reads aligned | Total primary alignments (excluding secondary, supplementary, QC-fail) |
| reads aligned | Primary alignments: mapped records not flagged secondary (SE) |
| total alignments | All mapped reads (primary + secondary) |
| secondary alignments | Alignments flagged as secondary (0x100) |
| non-unique alignments | Multi-mappers (NH tag > 1) |
Expand All @@ -125,7 +125,7 @@ against the annotation:
exonic = 122,500,822 (76.45%)
intronic = 29,504,572 (18.37%)
intergenic = 8,344,022 (5.19%)
overlapping exon = 6,754,726 (4.20%)
overlapping exon = 6,754,726 (4.2%)
```

| Field | Description |
Expand All @@ -146,11 +146,18 @@ Coverage bias metrics computed from the gene body coverage profile:
5'-3' bias = 1.11
```

| Metric | Description |
| ---------- | --------------------------------------------------------------------------------------- |
| 5' bias | Ratio of median coverage in the 5' region (first 100bp) to the median of the middle 80% |
| 3' bias | Ratio of median coverage in the 3' region (last 100bp) to the median of the middle 80% |
| 5'-3' bias | Ratio of 5' median to 3' median |
| Metric | Description |
| ---------- | ----------------------------------------------------------------------------------- |
| 5' bias | Median over transcripts of mean coverage of the first 100 bases / mean coverage |
| 3' bias | Median over transcripts of mean coverage of the last 100 bases / mean coverage |
| 5'-3' bias | Median over transcripts of mean coverage of the first 100 / of the last 100 bases |

As in Qualimap, the transcripts are the best-covered transcript of each gene (at
least 500 bp long, mean coverage at least 1), limited to those at or above the
1001st highest mean coverage. The medians are Commons Math 2.0 percentiles: a
transcript with no coverage at either end gives a 5'/3' ratio of NaN, which is
kept and sorted last, so it raises the 5'-3' bias median rather than being
dropped.

Bias values close to 1.0 indicate uniform coverage. Values significantly above
1.0 for 5' bias or below 1.0 for 3' bias suggest degradation or protocol issues.
Expand Down Expand Up @@ -323,6 +330,27 @@ eliminating the separate name-sort and Qualimap run required by the original Jav

</details>

Every number is printed the way Qualimap prints it. Qualimap formats counts,
ratios and percentages with Java's `DecimalFormat` (at most two decimals,
trailing zeros dropped, half-even rounding), so a whole percentage is `60%`,
not `60.0%`, and a ratio of exactly one half is `0.5`. The coverage profile
files use Java's `Double.toString` (`0.0`, `1.0E-4`). Reads on a sequence with
no annotated exon are left out of the counts, as in Qualimap, and reported in
the HTML report as "Missing chromosome in annotation".

Reads are selected as Qualimap selects them. Secondary, supplementary and
QC-fail records are not skipped: every mapped record with an NH tag of at most
1 (or none) is counted. Proper pairs are grouped by read name, as Qualimap does
with its name-sorted input. A group of exactly two records is one fragment, and
Qualimap skips any other group, for example a pair plus a supplementary record.

<Aside type="note" title="Junction motifs with the same count">
Qualimap lists tied junction motifs in the order of its internal `HashMap`,
which depends on the order it first saw each motif in the (name-sorted)
input. RustQC cannot reproduce that order, so it lists tied motifs
alphabetically. The motifs and their percentages are the same.
</Aside>

<details>
<summary>Small dataset (~52K reads, chr6)</summary>

Expand All @@ -345,11 +373,10 @@ Both tools were run on the same BAM file with matching parameters
are from the AWS benchmark run (2026-03-09).

<Aside type="tip" title="Deterministic output">
Qualimap uses `HashMap` internally, whose iteration order
is not guaranteed across JVM versions. This means bias metrics (especially
5'-3' bias) can vary slightly between runs or environments in the Java
version. RustQC avoids this by using a stable tie-breaking rule when
multiple transcripts of the same gene have identical mean coverage.
Qualimap uses `HashMap` internally. When several transcripts of a gene have
the same mean coverage, the one it visits first is used for the bias metrics.
RustQC reproduces Java's `HashMap` iteration order for these ties, so its output
does not depend on thread count or run.
</Aside>

<details>
Expand Down Expand Up @@ -384,10 +411,10 @@ multiple transcripts of the same gene have identical mean coverage.
| ---------- | --------------- | ------ | -------- |
| 5' bias | 0.71 | 0.71 | Yes |
| 3' bias | 0.57 | 0.57 | Yes |
| 5'-3' bias | 1.30 | 1.19 | Minor diff |
| 5'-3' bias | 1.3 | 1.3 | Yes |

The 5'-3' bias shows a minor difference (1.30 vs 1.19) on this small dataset.
All other values are identical.
All values are identical (`rnaseq_qc_results.txt` matches apart from the input
paths).

</details>

Expand Down Expand Up @@ -416,7 +443,7 @@ All other values are identical.
| exonic fraction | 76.45% | 76.45% | Yes |
| intronic fraction | 18.37% | 18.37% | Yes |
| intergenic fraction | 5.19% | 5.19% | Yes |
| overlapping exon | 4.20% | 4.20% | Yes |
| overlapping exon | 4.2% | 4.2% | Yes |

##### Transcript coverage profile

Expand All @@ -432,8 +459,9 @@ All other values are identical.
| ------------------ | --------------- | ---------- | ------ |
| reads at junctions | 56,119,719 | 56,119,719 | Yes |

Junction motif type percentages match with rounding differences less than 0.05
percentage points. The underlying read counts are identical.
Junction motif counts and percentages are identical. Motifs with the same
count are listed alphabetically, which can differ from Qualimap's order (see the note on
junction motifs above).

</details>

Expand Down
Loading
Loading