diff --git a/CHANGELOG.md b/CHANGELOG.md index b4d7fcd81..076175f2a 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,6 +4,7 @@ Each release's notes. From 1.0.0 on, a major or minor release has hand-written n ## Unreleased +- The CPIC report no longer calls a gene normal when PharmCAT never read a position that defines one of its alleles. PharmCAT calls a gene from the positions it read, so an exome that misses CYP2C19 \*2's site got `*1/*1`, Normal Metabolizer, and step 27 (`og pgx cpic-report`) gave the normal-function answer. Step 27 now reads the positions PharmCAT's `report.json` lists with no call. Such a gene gets the status `incomplete` in step 27's phenotypes table, with the mark `[incomplete: positions not read: ...]` on its phenotype. It is listed in a new section, "Genes Called With Positions Not Read", with every unread position, and it gets no drug guidance. A non-normal call with an unread position keeps its drug list and gets the same mark. `summary.json` counts these genes under `sections.cpic.data.incomplete`, a key written only when there is one. A whole genome where PharmCAT read every position gets the same report as before. - The E2E run dispatched on a batch of pull requests finishes sooner, with every case and check it ran before. The shard split now weighs `prs-3-panel-measure` at its measured 2900 seconds on a run dispatched on a branch (`E2E_SECONDS`), where it measures the 1000 Genomes panel, so its shard no longer gets a full share of other cases on top. The base leg sets up while `og` builds, and the job `og` builds only the Linux x86_64 binary the legs run (`OG_ARCHES`, `OG_DARWIN_ARCHES` in `rust/og.sh`); Guard's `rust` job still builds all four on every pull request, as does the Rust `images` job when it runs. The nightly Rust run, which is the `streams` job only, now builds only `og-linux-x86_64`, the binary it runs. Container Test runs at most 8 smoke rows at once, so a change to every image no longer takes the runners the E2E legs wait for. The jobs that only build `og --release` lose their Rust cache, which did not speed them up, and Guard's `rust` job saves its cache on main only, so the E2E image and data caches fit the 10 GB budget. - The carrier list in `summary.json` keeps each hit's call quality and zygosity. It judged every hit at GQ 30 and DP 10, whatever floor the hits file states (`##PGP_CALL_FLOOR`), and it dropped the low-confidence mark the ClinVar section shows for the same hit. Each row of `sections.carrier.data` now has `zygosity` (`het`, `hom`, `hemizygous` or `unknown`), `gq`, `dp` and `low_confidence`, judged against the file's own floor. A homozygous or hemizygous P/LP row has no unchanged copy, so it is no carrier finding: it moves from `carriers` to a new list, `hom_or_hemizygous`. Both reports still print it in the carrier list, on a line of its own that says it is not the pattern of a carrier, and the list's first line counts it apart (`2 with no unchanged copy`); the live page keeps its finding for it, and its carrier headline (the Python server's and `og live serve`'s) asks for attention. Two different heterozygous hits in one recessive gene are now counted as copies, with the phase rule of the secondary-findings card: each row gets `pair` (`two hits` when read-backed phase puts them on different copies, `possible two hits` when the phase is unknown; none when they sit on one copy) and `phase`, which says why. The carrier list and the secondary-findings card now count a gene's hits the same way, twice: with every call, and with the confident calls alone. A pair that the confident calls prove stays `two hits` on the list and `biallelic` on the card, even when another hit of the gene is a low-confidence call; so does a confident homozygous call or a confident deletion pair. When the confident hits count two copies of unknown phase, the pair is `possible two hits` on the list and `possibly biallelic` on the card, even when a low-confidence call would prove it. Any other pair that needs a low-confidence call is `possible two hits (low-confidence call)` on the list and `possibly biallelic (low-confidence call)` on the card. On the card a low-confidence call is one below step 06's call floor or a weak HIGH-impact call (`weak_call`). A deletion plus a low-confidence call reads `possibly biallelic (low-confidence call)` under `two_hits` and on the card's two-hit line. A combined allele counts as confident when any call of it is, and it then counts with the copies, GT and phase set of that confident call, beside a deletion too. The list's `pair` counts heterozygous hits only. For a recessive gene that the card counts by two copies (MUTYH, ATP7B, CYP27A1, GAA, RPE65, CASQ2, TRDN, and BTD apart from its hypomorph), the two give the gene the same answer, apart from rare deletion shapes where the card is more cautious (a combined allele across a deletion's end) and from a call the card judges by its HIGH-impact record (a lower call floor in the clinical VCF, or a HIGH-impact call of a part of a combined allele): on the list, that answer is the best of `pair`, the gene's `two_hits` verdict and its `hom_or_hemizygous` rows. Output change: rows move from `carriers` to `hom_or_hemizygous`, and fields are added; no field is renamed or removed. `tests/schema/summary.schema.json` now describes the carrier section. Part of #411 (clin-15, clin-19). - A step you selected that produced nothing now says so. A report-only Nextflow step (TelomereHunter, VNtyper, the CHIP genes and the others in `nextflow.config`) is dropped when it fails, after one retry when the exit was a memory kill. Its section had no file, so the report listed it as not run, the same as a step nobody asked for. `HTML_REPORT` now records the run's `--tools` list, and `og summary collect` lists selected sections with no file under Steps Not Run as "(selected, no result)", with a note naming the tool and the step. Y haplogroup, Y tree placement, and Y-STR markers get this label only for samples declared male. `summary.json` gets a new top-level list, `selected_no_result`, with those section keys. It is present only when the run recorded its tool list, so a bash run's summary is unchanged. The section's state stays `missing`. diff --git a/docs/07-pharmacogenomics.md b/docs/07-pharmacogenomics.md index 07577033c..12b40fb8d 100644 --- a/docs/07-pharmacogenomics.md +++ b/docs/07-pharmacogenomics.md @@ -124,7 +124,7 @@ docker run --rm \ - **HLA-A, HLA-B and CYP2D6** are not called from a VCF: PharmCAT 3.4.0 reports them with no result (`callSource` `NONE`). [Step 36](36-pgx-consensus.md) gives PharmCAT T1K's HLA types (step 8) and a CYP2D6 call only when pypgx (step 32) and Cyrius (step 21, opt-in) agree on depth that passed its check; PharmCAT reads them with `-po` (`callSource` `OUTSIDE`). Run step 36 before this step, or run this step again after it. A disagreement, or one caller alone, leaves CYP2D6 without a result, on purpose. - **MT-RNR1** is an outside call from step 20's chrM calls (see above): PharmCAT 3.4.0 does not call it from a VCF. A heteroplasmic named allele, such as m.1555A>G at AF 0.4, is passed and gets the aminoglycoside recommendation; the PharmCAT report does not show its AF, the step log does. A named allele below AF 0.05 is not passed. With no other named allele called, the gene stays No Result and the step log names the allele and its AF as below the detection floor. At that level the call cannot be told from noise or NuMT reads, so it is not called absent either. - **CYP4F2 can come out No Result** when unphased heterozygous calls elsewhere in the gene, a weak one among them, leave no diplotype that matches. CPIC's warfarin guidance needs only the \*3 position (rs2108622). Step 27 then reads the genotype PharmCAT itself lists at that position in `report.json` (the gene's `variants`) and prints it in a section headed "Single-Position Fallback (not a PharmCAT call)", with the CPIC warfarin rule when you carry the variant. It does the same for VKORC1 at rs9923231 (-1639G>A). PharmCAT's own result for the gene stays No Result in the phenotypes table. A position with no genotype is reported as not callable. The report carries no GQ or read depth for the position: check it in your VCF before acting on it. -- **Exome input.** An exome reads the coding exons and little else, and some defining variants sit outside them: CYP2C19 \*17 in the promoter, CYP3A5 \*3 and CYP3A4 \*22 in introns, UGT1A1 \*80 and \*28 in the promoter, and others. PharmCAT drops a position it has no call for, so it cannot call an allele defined there. When the positions it did read match the reference, the gene can come out as a normal-function call such as \*1/\*1, and step 27 gives the normal-function recommendation. Step 27's CPIC report does not mark such a gene as incomplete. The positions PharmCAT had no call for are in `${SAMPLE}.missing_pgx_var.vcf`: check it before you act on a call from an exome. The [WES guide](wes-guide.md#drug-gene-answers-on-an-exome) lists the positions a typical capture misses, gene by gene. +- **Exome input.** An exome reads the coding exons and little else, and some defining variants sit outside them: CYP2C19 \*17 in the promoter, CYP3A5 \*3 and CYP3A4 \*22 in introns, UGT1A1 \*80 and \*28 in the promoter, and others. PharmCAT drops a position it has no call for, so it cannot call an allele defined there. When the positions it did read match the reference, the gene can come out as a normal-function call such as \*1/\*1. Step 27 reads the positions PharmCAT lists with no call and marks such a gene `incomplete`, not `normal`: it names the unread positions and gives no drug guidance for it ([step 27](27-cpic-lookup.md#what-the-script-does-internally), point 4). A non-normal call with an unread position keeps its drug list and gets the same mark. The positions PharmCAT had no call for are also in `${SAMPLE}.missing_pgx_var.vcf`: check it before you act on a call from an exome. The [WES guide](wes-guide.md#drug-gene-answers-on-an-exome) lists the positions a typical capture misses, gene by gene. - PharmCAT may disagree with lab reports on complex haplotypes (e.g., NAT2). Discrepancies can arise from different genome builds (hg19 vs hg38), different star allele definitions, or different variant calling pipelines. When a discrepancy matters clinically, compare both sets of raw variant calls and consult the PharmVar database for the current allele definitions — do not blindly trust either source. - PharmCAT output structure changes across releases. If you upgrade PharmCAT, re-test step 27 (`27-cpic-lookup.sh`) because it parses the JSON output directly. diff --git a/docs/27-cpic-lookup.md b/docs/27-cpic-lookup.md index 362748bb7..e932cbeec 100644 --- a/docs/27-cpic-lookup.md +++ b/docs/27-cpic-lookup.md @@ -40,7 +40,7 @@ MEDICATIONS=/path/to/medications.txt ./scripts/27-cpic-lookup.sh your_name 1. Locates the PharmCAT JSON report. 2. Runs `og pgx cpic-report` in the Python image. It reads the gene calls (PharmCAT 3.x flat `genes` map, the 2.x map nested by source, and the older list are all read) and writes the phenotype table. 3. A gene counts as non-normal only when its phenotype names a changed metabolism or function (poor, intermediate, rapid or ultrarapid metabolizer; decreased, increased, poor or no function), a positive HLA test, a G6PD deficiency, malignant hyperthermia susceptibility, an increased MT-RNR1 risk, an ivacaftor-responsive CFTR, or a VKORC1 `-1639` genotype with the A allele (`-1639 GA` or `-1639 AA`, the warfarin dose-reduction case). A called gene whose phenotype is anything else (`n/a`, `no phenotype assigned`, the reference VKORC1 genotype `-1639 GG`, `Uncertain Susceptibility`, `Indeterminate`) is `unclassified`: it is listed in the section "Called Genes Without a Function Phenotype", is not counted, and gets no drug list. One exception: PharmCAT can leave a gene `Indeterminate` at gene level while the annotations of its drugs assign it a phenotype (for example a gene with unphased heterozygous positions plus positions missing from the VCF). When the drug annotations PharmCAT gives that gene (those for any of its possible diplotypes when there are any) all name the same phenotype, other than `Indeterminate`, `No Result` or `n/a`, the gene takes it, with the note `[gene level Indeterminate; phenotype from PharmCAT's drug annotations]` in the phenotype table and the text, and its status follows that phenotype. An annotation with no phenotype for the gene is not counted. Several possible diplotypes must also get the same drug guidance, because the drug list shows the first one's. With no annotation that names a phenotype, with annotations that disagree (one that says `Indeterminate` disagrees too), or with possible diplotypes whose guidance differs, it stays `Indeterminate` and `unclassified`. PharmCAT's own example report has 3 non-normal genes and 7 unclassified ones. For each gene with a non-normal phenotype it lists the drugs from the report's `drugs` section: CPIC's recommendation for the called diplotype per drug first, then the drugs DPWG or the FDA name. PharmCAT lists an annotation for every diplotype the sample may have, so only the ones for the called diplotype (or, without diplotype labels, its phenotype) are shown. When the report names no drug for the gene, it falls back to the gene's `relatedDrugs`, then to a small static table, and finally prints a line saying the gene is not in the drug table, so a gene is never skipped silently. -4. When PharmCAT lists more than one possible diplotype for a gene and their phenotypes differ (positions missing from the VCF leave it unable to choose), the gene is `ambiguous`: it is listed in its own section with the possible phenotypes and no drug guidance, never as its first diplotype. +4. When PharmCAT lists more than one possible diplotype for a gene and their phenotypes differ (positions missing from the VCF leave it unable to choose), the gene is `ambiguous`: it is listed in its own section with the possible phenotypes and no drug guidance, never as its first diplotype. A gene with one result can still rest on positions PharmCAT never read. PharmCAT calls a gene from the positions it read, and an allele defined at a position with no call cannot be called, so on an exome that never read CYP2C19 \*2's site (rs4244285) the gene comes out `*1/*1`, Normal Metabolizer. PharmCAT's report lists every position of the gene in `variants`: one it never read has no `call`, and its `alleles` name the alleles defined there. When a called gene (not an outside call) has such a position, its phenotype gets the mark `[incomplete: positions not read: rs4244285]` (the first three, then `and N more`) and it is listed in the section "Genes Called With Positions Not Read" with every unread position. If its phenotype names no changed function, its status is `incomplete`, not `normal` or `unclassified`, and it gets no drug guidance. A non-normal gene stays `non-normal` with its drug list and the mark, because its true result can differ. A whole genome where PharmCAT read every position gets exactly the report it got before. 5. With the pypgx summary it writes the comparison table and, for a gene PharmCAT reports as not called or ambiguous but pypgx called (CYP2D6 is the usual one; a pypgx `Indeterminate`, in any case or as one allele such as `*1/Indeterminate`, is no call), a warning in the recommendations naming every drug PharmCAT links to that gene. When pypgx's call is normal the line is a note instead. 6. With step 36's consensus table it writes a section "Calls From Other Tools": each gene passed to PharmCAT as an outside call, from which tool, and whether PharmCAT's report shows it as one (`callSource` `OUTSIDE`); and each gene held back, with the reason and what each caller said. For a held-back CYP2D6 it names the drugs CYP2D6 affects and says no guidance is given for them, and the pypgx-only warning of point 5 is not printed for it: one caller's call is what the consensus refused. Genes PharmCAT reports as outside calls carry `[outside call]` in the gene results. An outside call of CYP2D6, HLA-A or HLA-B in PharmCAT's report that the table does not pass on, with the same diplotype, comes from an earlier step 36 run that step 07 has not replaced: it gets no drug guidance, is listed as not called, and a warning says to rerun step 07. When the table is missing (a caller step ran again since) but PharmCAT's report has outside calls of those genes, the step passes the missing table, so none of them is confirmed. MT-RNR1's outside call comes from step 20's chrM calls through step 07, never from step 36: the table never lists it, so it is not checked against it and keeps its drug guidance. 7. With a medication list, every drug a line names is matched (whitespace, commas, semicolons, slashes, pluses and brackets split a line, and punctuation at either end of a word is dropped; the word `and` is dropped, and so are doses, units and frequencies such as `20`, `mg` and `daily`; a word with a hyphen is checked whole and then by each part that starts with a letter, has three or more characters and is no dose word, so a hyphenated name in a table still matches and a prefix, a lone letter or a number is never taken for a drug; so `olanzapine/fluoxetine` and `olanzapine-fluoxetine` are checked for olanzapine and for fluoxetine, `Contrave (naltrexone/bupropion) 8/90 mg` for contrave, naltrexone and bupropion, `co-trimoxazole` for co-trimoxazole and trimoxazole but never `co`, `L-dopa` for l-dopa and dopa, and a line of only separators is skipped) against `assets/pgx_inhibitors.tsv`: the FDA's strong and moderate inhibitors of CYP2D6 and CYP2C19, its moderate CYP2C9 inhibitors (it lists no strong one) and its strong CYP3A inhibitors, one row each for CYP3A4 and CYP3A5, as the FDA's table of clinical CYP inhibitors classes them, each row with its source. A ritonavir-boosted combination the FDA classes as one (`lopinavir and ritonavir`) has a row under ritonavir and one under its partner. For CYP2D6 the step applies CPIC's rule from its opioid guideline: "for patients on strong CYP2D6 inhibitors, the CYP2D6 activity score is adjusted to 0 and the predicted phenotype is a poor metabolizer", and for a moderate inhibitor "the activity score is multiplied by 0.5 and then converted to the predicted phenotype" (CPIC's bands: 0 poor, under 1.25 intermediate, 1.25 to 2.25 normal, above 2.25 ultrarapid). The activity score is the one PharmCAT gives the called diplotype. With several inhibitors of one gene, from several lines or from the drugs of one combination product, the strongest counts. The result is written as `Poor Metabolizer (phenoconverted by paroxetine)` beside the genotype phenotype, never in its place, with a `WARNING:` line in the section "Medications and Phenoconversion", so the summary carries it. Nothing is converted for a gene that is not called, ambiguous or unclassified, or for a moderate inhibitor when the report gives no activity score: the line says why. CPIC has no activity score for CYP2C19, and gives no rule that converts the phenotype of CYP2C9, CYP3A4 or CYP3A5, so an inhibitor of one of these genes gets a note and a `not computed: ...` value, with no converted phenotype. For a poor metabolizer of these genes (the most common CYP3A5 result) the note does not say the inhibitor can lower the activity further. A line none of whose drugs is in the table is listed as "Not in the inhibitor table", never dropped. A list that names no drug converts nothing and leaves the phenotype table as it is without a list. An unreadable list or table is reported in that section; the rest of the report is written as usual. The FDA's table lists no strong or moderate CYP2B6 inhibitor, so CYP2B6 has no rows. @@ -54,8 +54,8 @@ The comparison used to be written by step 32. It moved here because `run-all.sh` | File | Contents | |---|---| -| `cpic/${SAMPLE}_cpic_recommendations.txt` | Gene results, the medications for each non-normal gene, the drug contraindications from disease variants, the called genes without a function phenotype, the calls from other tools (step 36), uncallable genes, and the pypgx warnings | -| `cpic/${SAMPLE}_phenotypes.tsv` | One row per gene: `Gene`, `Diplotype`, `Phenotype`, `Status` (`normal`, `non-normal`, `unclassified`, `ambiguous` or `not called`). With a medication list that names a drug, a fifth column `Phenoconverted_phenotype`: the converted phenotype, `not converted: `, `not computed: ...` (CYP2C19, CYP2C9, CYP3A4, CYP3A5), or `-` when no drug on the list inhibits the gene. `Phenotype` and `Status` stay the genotype's | +| `cpic/${SAMPLE}_cpic_recommendations.txt` | Gene results, the medications for each non-normal gene, the drug contraindications from disease variants, the called genes with positions PharmCAT never read, the called genes without a function phenotype, the calls from other tools (step 36), uncallable genes, and the pypgx warnings | +| `cpic/${SAMPLE}_phenotypes.tsv` | One row per gene: `Gene`, `Diplotype`, `Phenotype`, `Status` (`normal`, `non-normal`, `unclassified`, `ambiguous`, `incomplete` or `not called`). With a medication list that names a drug, a fifth column `Phenoconverted_phenotype`: the converted phenotype, `not converted: `, `not computed: ...` (CYP2C19, CYP2C9, CYP3A4, CYP3A5), or `-` when no drug on the list inhibits the gene. `Phenotype` and `Status` stay the genotype's | | `pypgx/${SAMPLE}_pharmcat_comparison.tsv` | PharmCAT and pypgx diplotypes side by side (only when step 32 ran) |
@@ -81,7 +81,7 @@ CYP2D6 *x/*y ### Affected Medications -Only genes with a non-normal phenotype (point 3 above) appear here, each with the drugs and the CPIC recommendation PharmCAT matched to your result. A called gene whose phenotype names no changed function (`n/a`, `no phenotype assigned`, the reference VKORC1 genotype `-1639 GG`, `Uncertain Susceptibility`) is `unclassified`: it gets no drug list and is listed under "Called Genes Without a Function Phenotype". A variant allele in such a gene can still matter, so check PharmCAT's HTML report for it. Genes that could not be called are listed separately at the end. Their absence from the medications section does NOT mean normal function. +Only genes with a non-normal phenotype (point 3 above) appear here, each with the drugs and the CPIC recommendation PharmCAT matched to your result. A called gene whose phenotype names no changed function (`n/a`, `no phenotype assigned`, the reference VKORC1 genotype `-1639 GG`, `Uncertain Susceptibility`) is `unclassified`: it gets no drug list and is listed under "Called Genes Without a Function Phenotype". A variant allele in such a gene can still matter, so check PharmCAT's HTML report for it. A gene whose result rests on positions PharmCAT never read is `incomplete` (point 4 above): it is listed under "Genes Called With Positions Not Read" with those positions, and gets no drug list here, because a normal call there is not proof of normal function. Genes that could not be called are listed separately at the end. Their absence from the medications section does NOT mean normal function. ### Calls From Other Tools diff --git a/rust/crates/og-pgx/src/cli.rs b/rust/crates/og-pgx/src/cli.rs index eb729f57e..69bb4d90c 100644 --- a/rust/crates/og-pgx/src/cli.rs +++ b/rust/crates/og-pgx/src/cli.rs @@ -647,6 +647,43 @@ pub fn cpic_report(a: &CpicArgs) -> u8 { ); } + let unread: Vec<&GeneCall> = calls.iter().filter(|c| c.incomplete()).collect(); + if !unread.is_empty() { + lines.extend([ + "Genes Called With Positions Not Read:".to_owned(), + rule(), + String::new(), + ]); + for c in &unread { + let n = c.unread.len(); + let mark = if c.status() == Status::Incomplete { + "incomplete, " + } else { + "" + }; + lines.push(format!( + " {} -- {}, {}: {mark}{n} defining position{} not read ({}).", + c.gene, + c.diplotype, + c.phenotype, + if n == 1 { "" } else { "s" }, + c.unread.join(", ") + )); + } + lines.extend( + [ + " PharmCAT calls a gene from the positions it read. An allele defined at a", + " position it never read cannot be called, so the gene can come out normal", + " when it is not (an exome misses many such positions). A gene marked", + " incomplete gets no drug guidance here. A non-normal gene keeps its drug", + " list above, but its true result can differ. Step 07's missing_pgx_var.vcf", + " and the PharmCAT HTML report list the positions it could not read.", + "", + ] + .map(str::to_owned), + ); + } + let unclassified: Vec<&GeneCall> = by_status(Status::Unclassified).collect(); if !unclassified.is_empty() { lines.extend([ @@ -809,8 +846,16 @@ pub fn cpic_report(a: &CpicArgs) -> u8 { ); } } + // The count of incomplete genes is printed only when there is one, so + // the line stays the same for every report that has none. + let incomplete = by_status(Status::Incomplete).count(); + let incomplete = if incomplete > 0 { + format!("; incomplete: {incomplete}") + } else { + String::new() + }; println!( - "Genes parsed: {}; non-normal: {}; ambiguous: {}; unclassified: {}; not called: {}", + "Genes parsed: {}; non-normal: {}; ambiguous: {}; unclassified: {}; not called: {}{incomplete}", calls.len(), listed.len(), ambiguous.len(), diff --git a/rust/crates/og-pgx/src/report.rs b/rust/crates/og-pgx/src/report.rs index a0179df6b..6fff72ae8 100644 --- a/rust/crates/og-pgx/src/report.rs +++ b/rust/crates/og-pgx/src/report.rs @@ -70,8 +70,15 @@ pub struct GeneCall { /// PharmCAT's `activityScore` of each possible diplotype, when it is a /// finite number. pub scores: Vec>, + /// The positions of a called gene that PharmCAT never read and that + /// define an allele (see [`unread_positions`]). An allele defined there + /// could not be called, so the call may hide it. + pub unread: Vec, } +/// How many unread positions the phenotype's mark names before `and N more`. +const UNREAD_SHOWN: usize = 3; + impl GeneCall { /// A call with one possible diplotype. pub fn single(gene: String, diplotype: String, phenotype: String, called: bool) -> Self { @@ -85,15 +92,27 @@ impl GeneCall { called, note: None, scores: Vec::new(), + unread: Vec::new(), } } - /// The phenotype as the table and the text show it, with its note. + /// The phenotype as the table and the text show it, with its note, and + /// `[incomplete: positions not read: ...]` when it is [`incomplete`]. + /// + /// [`incomplete`]: GeneCall::incomplete pub fn shown(&self) -> String { - match self.note { + let mut s = match self.note { Some(note) => format!("{} [{note}]", self.phenotype), None => self.phenotype.clone(), + }; + if self.incomplete() { + let mut names = self.unread[..self.unread.len().min(UNREAD_SHOWN)].join(", "); + if self.unread.len() > UNREAD_SHOWN { + names.push_str(&format!(" and {} more", self.unread.len() - UNREAD_SHOWN)); + } + s.push_str(&format!(" [incomplete: positions not read: {names}]")); } + s } /// Called, with possible diplotypes of different phenotypes. @@ -101,11 +120,20 @@ impl GeneCall { self.called && self.phenotypes.len() > 1 } + /// Called with one result that rests on positions PharmCAT never read. + /// It is [`Status::Incomplete`] unless its phenotype names a changed + /// function, which stays non-normal with its drug list. + pub fn incomplete(&self) -> bool { + self.called && !self.ambiguous() && !self.unread.is_empty() + } + pub fn status(&self) -> Status { if !self.called { Status::NotCalled } else if self.ambiguous() { Status::Ambiguous + } else if self.incomplete() && !is_non_normal(&self.phenotype) { + Status::Incomplete } else if is_normal(&self.phenotype) { Status::Normal } else if is_non_normal(&self.phenotype) { @@ -195,6 +223,41 @@ fn one_diplotype(dip: &Value) -> (String, String, bool) { (label, phenotype, called) } +/// The positions of a gene object's `variants` that PharmCAT never read and +/// that define an allele: no `call` (PharmCAT leaves a null out, so a missing +/// field, a null and a blank string all count) and a non-empty `alleles`, +/// the alleles PharmCAT's definitions place there. Each is named by its +/// rsID, else `chromosome:position`, else its position, once, in the +/// report's order. +pub fn unread_positions(g: &Value) -> Vec { + let mut out: Vec = Vec::new(); + for v in list(g, "variants") { + if !matches!(v, Value::Object(_)) { + continue; + } + let call = truthy_field(v, "call").map(text).unwrap_or_default(); + let defines = list(v, "alleles").iter().any(truthy); + if !strip(&call, None).is_empty() || !defines { + continue; + } + let pos = truthy_field(v, "position").map(text); + let name = match ( + truthy_field(v, "dbSnpId"), + truthy_field(v, "chromosome"), + pos, + ) { + (Some(id), _, _) => text(id), + (None, Some(chr), Some(pos)) => format!("{}:{pos}", text(chr)), + (None, _, Some(pos)) => pos, + (None, _, None) => "a position with no name".to_owned(), + }; + if !out.contains(&name) { + out.push(name); + } + } + out +} + /// The call of a gene object with a diplotype array, else `None`. fn diplotype_call(name: String, g: &Value) -> Option { if !matches!(g, Value::Object(_)) { @@ -226,9 +289,18 @@ fn diplotype_call(name: String, g: &Value) -> Option { ); } } + let outside = matches!(field(g, "callSource"), Some(Value::Str(s)) if s == "OUTSIDE"); + // An outside call reads no position; PharmCAT marks none of its + // positions missing either. + let unread = if called && !outside { + unread_positions(g) + } else { + Vec::new() + }; Some(GeneCall { gene: name, - outside: matches!(field(g, "callSource"), Some(Value::Str(s)) if s == "OUTSIDE"), + outside, + unread, diplotype: label, phenotype, called, diff --git a/rust/crates/og-pgx/src/status.rs b/rust/crates/og-pgx/src/status.rs index d4b2d0a44..10a4ceab5 100644 --- a/rust/crates/og-pgx/src/status.rs +++ b/rust/crates/og-pgx/src/status.rs @@ -4,13 +4,16 @@ use pycompat::text::{lower, split, strip}; use std::fmt; /// What a gene's call means for the report, checked in this order: not -/// called, ambiguous, normal, non-normal (listed with its drugs), and -/// unclassified (called, with no phenotype that says normal or changed -/// function: not counted, no drug guidance). +/// called, ambiguous, incomplete (a call that rests on positions PharmCAT +/// never read and whose phenotype names no changed function: no drug +/// guidance), normal, non-normal (listed with its drugs), and unclassified +/// (called, with no phenotype that says normal or changed function: not +/// counted, no drug guidance). #[derive(Debug, Clone, Copy, PartialEq, Eq)] pub enum Status { NotCalled, Ambiguous, + Incomplete, Normal, NonNormal, Unclassified, @@ -22,6 +25,7 @@ impl Status { match self { Status::NotCalled => "not called", Status::Ambiguous => "ambiguous", + Status::Incomplete => "incomplete", Status::Normal => "normal", Status::NonNormal => "non-normal", Status::Unclassified => "unclassified", diff --git a/rust/crates/og-pgx/tests/i411_pgx_incomplete.rs b/rust/crates/og-pgx/tests/i411_pgx_incomplete.rs new file mode 100644 index 000000000..ce2c396ad --- /dev/null +++ b/rust/crates/og-pgx/tests/i411_pgx_incomplete.rs @@ -0,0 +1,317 @@ +//! `og pgx cpic-report` on a gene whose call rests on a position PharmCAT +//! never read (issue #411, plat-49). +//! +//! PharmCAT calls a gene from the positions it read. An allele defined at a +//! position with no call cannot be called, so on an exome, which misses +//! CYP2C19 *2's site when the capture does, the gene comes out `*1/*1`, +//! Normal Metabolizer. PharmCAT's report lists every position of the gene in +//! `variants`, a position it never read with no `call`, and with `alleles` +//! the alleles defined there. Such a gene is now `incomplete`, never +//! `normal`: the phenotypes table says so, the text lists the unread +//! positions and gives no drug guidance for it. A non-normal call keeps its +//! status and drug list, marked the same way. +//! +//! The control: the same report with every position read (a whole genome) +//! writes what it wrote before, byte for byte the report without `variants`. + +use std::fs; +use std::path::PathBuf; + +const FIXTURES: &str = concat!( + env!("CARGO_MANIFEST_DIR"), + "/../../../tests/fixtures/pharmcat/" +); + +struct Scratch(PathBuf); + +impl Scratch { + fn new(name: &str) -> Scratch { + let d = std::env::temp_dir().join(format!( + "og-pgx-i411-incomplete-{name}-{}", + std::process::id() + )); + let _ = fs::remove_dir_all(&d); + fs::create_dir_all(&d).unwrap(); + Scratch(d) + } + + fn read(&self, name: &str) -> String { + fs::read_to_string(self.0.join(name)).unwrap_or_default() + } +} + +impl Drop for Scratch { + fn drop(&mut self) { + let _ = fs::remove_dir_all(&self.0); + } +} + +/// `og pgx cpic-report` on the report text: (exit code, recommendations +/// text, phenotypes table). +fn run(name: &str, report: &str) -> (u8, String, String) { + let s = Scratch::new(name); + let rep = s.0.join("report.json"); + fs::write(&rep, report).unwrap(); + let out = s.0.join("out"); + let args: Vec = [ + "cpic-report", + "--sample", + "S", + "--report", + &rep.to_string_lossy(), + "--outdir", + &out.to_string_lossy(), + "--date", + "2026-01-01", + ] + .map(str::to_owned) + .to_vec(); + let rc = og_pgx::main(&args); + ( + rc, + s.read("out/S_cpic_recommendations.txt"), + s.read("out/S_phenotypes.tsv"), + ) +} + +fn fixture(name: &str) -> String { + fs::read_to_string(format!("{FIXTURES}{name}")).unwrap() +} + +fn row<'a>(table: &'a str, gene: &str) -> Vec<&'a str> { + table + .lines() + .map(|l| l.split('\t').collect::>()) + .find(|r| r[0] == gene) + .unwrap_or_else(|| panic!("no {gene} row in {table}")) +} + +/// One section of the recommendations: its head line and every line up to +/// the next head (a line that is not blank, not indented and not a rule). +fn section(text: &str, head: &str) -> Option { + let mut lines = text.lines().skip_while(|l| *l != head); + let first = lines.next()?; + let body = lines.take_while(|l| { + l.is_empty() || l.starts_with(' ') || l.starts_with('-') || l.starts_with('=') + }); + Some( + std::iter::once(first) + .chain(body) + .collect::>() + .join("\n"), + ) +} + +const UNREAD: &str = "Genes Called With Positions Not Read:"; + +#[test] +fn an_exome_missing_the_cyp2c19_star2_site_reads_incomplete_not_normal() { + let (rc, text, table) = run("exome", &fixture("exome-cyp2c19-unread.json")); + assert_eq!(rc, 0); + assert_eq!( + row(&table, "CYP2C19"), + [ + "CYP2C19", + "*1/*1", + "Normal Metabolizer [incomplete: positions not read: rs4244285]", + "incomplete" + ], + "the gene whose *2 site was never read is incomplete, not normal" + ); + let sec = section(&text, UNREAD).expect("a section lists the unread positions"); + assert!( + sec.contains( + " CYP2C19 -- *1/*1, Normal Metabolizer: incomplete, 1 defining position not read (rs4244285)." + ), + "{sec}" + ); + assert!( + sec.contains("no drug guidance"), + "the section says an incomplete gene gets no drug guidance: {sec}" + ); + let meds = section(&text, "Affected Medications:").unwrap(); + assert!(!meds.contains("CYP2C19"), "{meds}"); + assert!( + text.contains("CYP2C19 *1/*1 Normal Metabolizer [incomplete: positions not read: rs4244285]\n"), + "the gene results line carries the mark: {text}" + ); +} + +#[test] +fn a_non_normal_call_with_an_unread_position_keeps_its_drugs_and_the_mark() { + let (_, text, table) = run("exome-nn", &fixture("exome-cyp2c19-unread.json")); + assert_eq!( + row(&table, "CYP2C9"), + [ + "CYP2C9", + "*1/*2", + "Intermediate Metabolizer [incomplete: positions not read: rs1057910]", + "non-normal" + ] + ); + let meds = section(&text, "Affected Medications:").unwrap(); + assert!( + meds.contains( + " CYP2C9 -- Intermediate Metabolizer [incomplete: positions not read: rs1057910]:" + ), + "{meds}" + ); + let sec = section(&text, UNREAD).unwrap(); + assert!( + sec.contains( + " CYP2C9 -- *1/*2, Intermediate Metabolizer: 1 defining position not read (rs1057910)." + ), + "{sec}" + ); + assert_eq!( + row(&table, "CYP3A5"), + ["CYP3A5", "*3/*3", "Poor Metabolizer", "non-normal"], + "a gene with every position read is unmarked" + ); + assert!(!sec.contains("CYP3A5"), "{sec}"); +} + +/// The report with every `"variants"` list removed: what the parser read +/// before it looked at positions. +fn without_variants(report: &str) -> String { + report + .lines() + .filter(|l| !l.trim_start().starts_with("{\"gene\": ")) + .collect::>() + .join("\n") + .replace(",\n \"variants\": [\n ]", "") +} + +#[test] +fn a_whole_genome_with_every_position_read_is_unchanged() { + let full = fixture("wgs-cyp2c19-complete.json"); + let stripped = without_variants(&full); + assert!( + !stripped.contains("variants") && stripped.contains("CYP3A5"), + "the control removes the positions and keeps the genes: {stripped}" + ); + let (rc, text, table) = run("wgs", &full); + assert_eq!(rc, 0); + assert_eq!( + row(&table, "CYP2C19"), + ["CYP2C19", "*1/*1", "Normal Metabolizer", "normal"] + ); + assert_eq!( + row(&table, "CYP2C9"), + ["CYP2C9", "*1/*2", "Intermediate Metabolizer", "non-normal"] + ); + assert!( + !text.contains("incomplete") && !text.contains(UNREAD), + "{text}" + ); + let (_, text0, table0) = run("wgs-control", &stripped); + assert_eq!( + (text, table), + (text0, table0), + "every position read: the same report as without positions" + ); +} + +/// A one-gene PharmCAT 3.x report with these diplotypes and positions. +fn one_gene(source: &str, dips: &[(&str, &str)], variants: &[&str]) -> String { + let dips: Vec = dips + .iter() + .map(|(label, phen)| { + let (a1, a2) = label.split_once('/').unwrap(); + format!( + r#"{{"allele1": {{"name": "{a1}"}}, "allele2": {{"name": "{a2}"}}, "label": "{label}", "phenotypes": ["{phen}"]}}"# + ) + }) + .collect(); + format!( + r#"{{"pharmcatVersion": "3.4.0", "genes": {{"CYP2C19": {{"callSource": "{source}", "sourceDiplotypes": [{}], "variants": [{}]}}}}}}"#, + dips.join(", "), + variants.join(", ") + ) +} + +fn status(report: &str, name: &str) -> (String, String) { + let (rc, _, table) = run(name, report); + assert_eq!(rc, 0, "{report}"); + let r = row(&table, "CYP2C19"); + (r[2].to_owned(), r[3].to_owned()) +} + +const NM: (&str, &str) = ("*1/*1", "Normal Metabolizer"); +const READ: &str = r#"{"position": 1, "dbSnpId": "rs12248560", "call": "C/C", "alleles": ["*17"]}"#; + +#[test] +fn only_an_unread_position_that_defines_an_allele_counts() { + let unread = |call: &str| { + format!(r#"{{"position": 94781859, "dbSnpId": "rs4244285"{call}, "alleles": ["*2"]}}"#) + }; + for (call, why) in [ + ("", "no call field (PharmCAT leaves a null out)"), + (r#", "call": null"#, "a null call"), + (r#", "call": " ""#, "a blank call"), + ] { + assert_eq!( + status(&one_gene("MATCHER", &[NM], &[READ, &unread(call)]), "blank").1, + "incomplete", + "{why}" + ); + } + let no_alleles = + r#"{"position": 94781859, "dbSnpId": "rs4244285", "call": null, "alleles": []}"#; + assert_eq!( + status(&one_gene("MATCHER", &[NM], &[READ, no_alleles]), "noall"), + ("Normal Metabolizer".to_owned(), "normal".to_owned()), + "a position that defines no allele cannot hide one" + ); + let no_rsid = r#"{"chromosome": "chr10", "position": 94781859, "alleles": ["*2"]}"#; + assert_eq!( + status(&one_gene("MATCHER", &[NM], &[no_rsid]), "norsid").0, + "Normal Metabolizer [incomplete: positions not read: chr10:94781859]", + "a position without an rsID is named by its place" + ); + let many: Vec = (1..=5) + .map(|i| format!(r#"{{"position": {i}, "dbSnpId": "rs{i}", "alleles": ["*{i}"]}}"#)) + .collect(); + let many: Vec<&str> = many.iter().map(String::as_str).collect(); + let (rc, text, table) = run("many", &one_gene("MATCHER", &[NM], &many)); + assert_eq!(rc, 0); + assert_eq!( + row(&table, "CYP2C19")[2], + "Normal Metabolizer [incomplete: positions not read: rs1, rs2, rs3 and 2 more]" + ); + assert!( + text.contains("5 defining positions not read (rs1, rs2, rs3, rs4, rs5)."), + "the section names every unread position: {text}" + ); +} + +#[test] +fn not_called_ambiguous_and_outside_genes_are_left_as_they_were() { + let unread = r#"{"position": 94781859, "dbSnpId": "rs4244285", "alleles": ["*2"]}"#; + assert_eq!( + status(&one_gene("OUTSIDE", &[NM], &[unread]), "outside"), + ("Normal Metabolizer".to_owned(), "normal".to_owned()), + "an outside call reads no position (PharmCAT marks none missing)" + ); + assert_eq!( + status( + &one_gene("MATCHER", &[("Unknown/Unknown", "No Result")], &[unread]), + "nocall" + ) + .1, + "not called" + ); + assert_eq!( + status( + &one_gene( + "MATCHER", + &[NM, ("*1/*2", "Intermediate Metabolizer")], + &[unread] + ), + "ambig" + ) + .1, + "ambiguous", + "several possible results stay ambiguous" + ); +} diff --git a/rust/crates/og-summary/src/collect/pgx.rs b/rust/crates/og-summary/src/collect/pgx.rs index 0445bbd35..c7a8c45f8 100644 --- a/rust/crates/og-summary/src/collect/pgx.rs +++ b/rust/crates/og-summary/src/collect/pgx.rs @@ -174,7 +174,7 @@ impl Cpic { } pub fn to_json(&self) -> Value { - obj([ + let mut pairs = vec![ ( "genes", Value::Array( @@ -195,12 +195,23 @@ impl Cpic { ("ambiguous", self.count("ambiguous")), ("not_called", self.count("not called")), ("unclassified", self.count("unclassified")), + ]; + // The genes whose call rests on positions PharmCAT never read + // (step 27's `incomplete`). Written only when there is one, so a + // summary without such a gene stays as it was; a reader takes a + // missing count as 0. + let incomplete = self.count("incomplete"); + if incomplete != Value::Int(0) { + pairs.push(("incomplete", incomplete)); + } + pairs.extend([ ("parse_failed", Value::Bool(self.parse_failed)), ( "warnings", Value::Array(self.warnings.iter().cloned().map(Value::Str).collect()), ), - ]) + ]); + obj(pairs) } } @@ -561,7 +572,10 @@ impl Cyp2d6 { let pharmcat = match pc { Some(g) => { let st = &g.status; - if matches!(st, Value::Str(s) if s == "not called" || s == "ambiguous") { + // A call that is not one result, or that rests on positions + // PharmCAT never read, shows as its status. + if matches!(st, Value::Str(s) if s == "not called" || s == "ambiguous" || s == "incomplete") + { st.clone() } else { g.diplotype.clone() @@ -723,4 +737,53 @@ mod tests { ); assert!(probable("None", ev("PASS", "ok").as_ref(), None, None).is_none()); } + + /// Step 27's phenotypes table with these rows, read as the summary reads + /// it. + fn cpic(rows: &str) -> Value { + let dir = std::env::temp_dir().join(format!( + "og-summary-pgx-incomplete-{}-{}", + std::process::id(), + rows.len() + )); + let _ = std::fs::remove_dir_all(&dir); + std::fs::create_dir_all(&dir).unwrap(); + let tsv = dir.join("S_phenotypes.tsv"); + std::fs::write(&tsv, format!("Gene\tDiplotype\tPhenotype\tStatus\n{rows}")).unwrap(); + let c = Cpic::read(&tsv.to_string_lossy(), "S").unwrap(); + let _ = std::fs::remove_dir_all(&dir); + c.to_json() + } + + /// Issue #411, plat-49: a gene step 27 marks `incomplete` (its call rests + /// on positions PharmCAT never read) is counted apart, never as normal or + /// unclassified; a table with none writes no count, as before. + #[test] + fn a_gene_whose_call_rests_on_unread_positions_is_counted_as_incomplete() { + let Value::Object(j) = cpic( + "CYP2C19\t*1/*1\tNormal Metabolizer [incomplete: positions not read: rs4244285]\tincomplete\n\ + CYP2C9\t*1/*2\tIntermediate Metabolizer\tnon-normal\n\ + CYP3A5\t*1/*1\tNormal Metabolizer\tnormal\n", + ) else { + panic!("not an object") + }; + assert_eq!(j.get("incomplete"), Some(&Value::Int(1)), "{j:?}"); + assert_eq!(j.get("non_normal"), Some(&Value::Int(1))); + assert_eq!(j.get("unclassified"), Some(&Value::Int(0))); + let Some(Value::Array(genes)) = j.get("genes") else { + panic!("no genes") + }; + assert!( + matches!(&genes[0], Value::Object(g) + if g.get("status") == Some(&Value::Str("incomplete".into()))), + "{genes:?}" + ); + let Value::Object(j) = cpic("CYP3A5\t*1/*1\tNormal Metabolizer\tnormal\n") else { + panic!("not an object") + }; + assert!( + !j.contains_key("incomplete"), + "no incomplete gene: the summary is as it was: {j:?}" + ); + } } diff --git a/tests/fixtures/pharmcat/README.md b/tests/fixtures/pharmcat/README.md index 6c0efa56c..2dede549e 100644 --- a/tests/fixtures/pharmcat/README.md +++ b/tests/fixtures/pharmcat/README.md @@ -19,6 +19,15 @@ the release to `REAL_REPORTS` in `rust/crates/og-pgx/tests/port_tests_pgx_cpic.r bin/og dev fixture trim-pharmcat report.json tests/fixtures/pharmcat/report-VERSION.json ``` +## Positions PharmCAT never read + +For `rust/crates/og-pgx/tests/i411_pgx_incomplete.rs`. Both files are invented PharmCAT 3.4.0 reports written by hand in its layout: each gene with one diplotype and its `variants`, the positions with their GRCh38 place, rsID and the alleles PharmCAT defines there. A position PharmCAT never read has no `call`: PharmCAT leaves a null out, as in `exome-cyp2c19-unread.json`'s CYP2C19 rs4244285, or writes `null`, as in its CYP2C9 rs1057910. + +| File | What it holds | +|---|---| +| `exome-cyp2c19-unread.json` | An exome that never read CYP2C19 \*2's site (rs4244285), so PharmCAT called `*1/*1`, Normal Metabolizer; CYP2C9 `*1/*2`, Intermediate Metabolizer, with its \*3 site (rs1057910) unread; and CYP3A5 `*3/*3` with its one position read. | +| `wgs-cyp2c19-complete.json` | The same three genes with every position read, as on a whole genome. | + ## Reference blocks over PharmCAT's positions longer than one base For `rust/crates/og-filters/tests/port_tests_pgx_refblock.rs` and the e2e case `tests/e2e/pharmcat-indel-refblocks-1.sh`. diff --git a/tests/fixtures/pharmcat/exome-cyp2c19-unread.json b/tests/fixtures/pharmcat/exome-cyp2c19-unread.json new file mode 100644 index 000000000..d7e9ac96c --- /dev/null +++ b/tests/fixtures/pharmcat/exome-cyp2c19-unread.json @@ -0,0 +1,59 @@ +{ + "pharmcatVersion": "3.4.0", + "genes": { + "CYP2C19": { + "geneSymbol": "CYP2C19", + "chr": "chr10", + "callSource": "MATCHER", + "sourceDiplotypes": [ + { + "allele1": {"name": "*1"}, + "allele2": {"name": "*1"}, + "label": "*1/*1", + "phenotypes": ["Normal Metabolizer"] + } + ], + "relatedDrugs": [{"name": "clopidogrel"}], + "variants": [ + {"gene": "CYP2C19", "chromosome": "chr10", "position": 94761900, "dbSnpId": "rs12248560", "call": "C/C", "alleles": ["*17"], "phased": false, "referenceAllele": "C", "hasUndocumentedVariations": false, "warnings": []}, + {"gene": "CYP2C19", "chromosome": "chr10", "position": 94780653, "dbSnpId": "rs4986893", "call": "G/G", "alleles": ["*3"], "phased": false, "referenceAllele": "G", "hasUndocumentedVariations": false, "warnings": []}, + {"gene": "CYP2C19", "chromosome": "chr10", "position": 94781859, "dbSnpId": "rs4244285", "alleles": ["*2"], "phased": false, "referenceAllele": "G", "hasUndocumentedVariations": false, "warnings": []} + ] + }, + "CYP2C9": { + "geneSymbol": "CYP2C9", + "chr": "chr10", + "callSource": "MATCHER", + "sourceDiplotypes": [ + { + "allele1": {"name": "*1"}, + "allele2": {"name": "*2"}, + "label": "*1/*2", + "phenotypes": ["Intermediate Metabolizer"] + } + ], + "relatedDrugs": [{"name": "warfarin"}], + "variants": [ + {"gene": "CYP2C9", "chromosome": "chr10", "position": 94942290, "dbSnpId": "rs1799853", "call": "C/T", "alleles": ["*2"], "phased": false, "referenceAllele": "C", "hasUndocumentedVariations": false, "warnings": []}, + {"gene": "CYP2C9", "chromosome": "chr10", "position": 94981296, "dbSnpId": "rs1057910", "call": null, "alleles": ["*3"], "phased": false, "referenceAllele": "A", "hasUndocumentedVariations": false, "warnings": []} + ] + }, + "CYP3A5": { + "geneSymbol": "CYP3A5", + "chr": "chr7", + "callSource": "MATCHER", + "sourceDiplotypes": [ + { + "allele1": {"name": "*3"}, + "allele2": {"name": "*3"}, + "label": "*3/*3", + "phenotypes": ["Poor Metabolizer"] + } + ], + "relatedDrugs": [{"name": "tacrolimus"}], + "variants": [ + {"gene": "CYP3A5", "chromosome": "chr7", "position": 99672916, "dbSnpId": "rs776746", "call": "C/C", "alleles": ["*3"], "phased": false, "referenceAllele": "T", "hasUndocumentedVariations": false, "warnings": []} + ] + } + } +} diff --git a/tests/fixtures/pharmcat/wgs-cyp2c19-complete.json b/tests/fixtures/pharmcat/wgs-cyp2c19-complete.json new file mode 100644 index 000000000..891dbaed9 --- /dev/null +++ b/tests/fixtures/pharmcat/wgs-cyp2c19-complete.json @@ -0,0 +1,59 @@ +{ + "pharmcatVersion": "3.4.0", + "genes": { + "CYP2C19": { + "geneSymbol": "CYP2C19", + "chr": "chr10", + "callSource": "MATCHER", + "sourceDiplotypes": [ + { + "allele1": {"name": "*1"}, + "allele2": {"name": "*1"}, + "label": "*1/*1", + "phenotypes": ["Normal Metabolizer"] + } + ], + "relatedDrugs": [{"name": "clopidogrel"}], + "variants": [ + {"gene": "CYP2C19", "chromosome": "chr10", "position": 94761900, "dbSnpId": "rs12248560", "call": "C/C", "alleles": ["*17"], "phased": false, "referenceAllele": "C", "hasUndocumentedVariations": false, "warnings": []}, + {"gene": "CYP2C19", "chromosome": "chr10", "position": 94780653, "dbSnpId": "rs4986893", "call": "G/G", "alleles": ["*3"], "phased": false, "referenceAllele": "G", "hasUndocumentedVariations": false, "warnings": []}, + {"gene": "CYP2C19", "chromosome": "chr10", "position": 94781859, "dbSnpId": "rs4244285", "call": "G/G", "alleles": ["*2"], "phased": false, "referenceAllele": "G", "hasUndocumentedVariations": false, "warnings": []} + ] + }, + "CYP2C9": { + "geneSymbol": "CYP2C9", + "chr": "chr10", + "callSource": "MATCHER", + "sourceDiplotypes": [ + { + "allele1": {"name": "*1"}, + "allele2": {"name": "*2"}, + "label": "*1/*2", + "phenotypes": ["Intermediate Metabolizer"] + } + ], + "relatedDrugs": [{"name": "warfarin"}], + "variants": [ + {"gene": "CYP2C9", "chromosome": "chr10", "position": 94942290, "dbSnpId": "rs1799853", "call": "C/T", "alleles": ["*2"], "phased": false, "referenceAllele": "C", "hasUndocumentedVariations": false, "warnings": []}, + {"gene": "CYP2C9", "chromosome": "chr10", "position": 94981296, "dbSnpId": "rs1057910", "call": "A/A", "alleles": ["*3"], "phased": false, "referenceAllele": "A", "hasUndocumentedVariations": false, "warnings": []} + ] + }, + "CYP3A5": { + "geneSymbol": "CYP3A5", + "chr": "chr7", + "callSource": "MATCHER", + "sourceDiplotypes": [ + { + "allele1": {"name": "*3"}, + "allele2": {"name": "*3"}, + "label": "*3/*3", + "phenotypes": ["Poor Metabolizer"] + } + ], + "relatedDrugs": [{"name": "tacrolimus"}], + "variants": [ + {"gene": "CYP3A5", "chromosome": "chr7", "position": 99672916, "dbSnpId": "rs776746", "call": "C/C", "alleles": ["*3"], "phased": false, "referenceAllele": "T", "hasUndocumentedVariations": false, "warnings": []} + ] + } + } +} diff --git a/tests/schema/summary.schema.json b/tests/schema/summary.schema.json index b31d06c63..ca563104c 100644 --- a/tests/schema/summary.schema.json +++ b/tests/schema/summary.schema.json @@ -491,6 +491,7 @@ "ambiguous", "not called", "unclassified", + "incomplete", "" ] } @@ -521,6 +522,11 @@ "unclassified": { "type": "integer", "minimum": 0 + }, + "incomplete": { + "description": "Genes whose call rests on positions PharmCAT never read; written only when there is one.", + "type": "integer", + "minimum": 1 } } }