just_dna_enricher.mitomap_draft¶
just_dna_enricher.mitomap_draft ¶
Draft variants.csv + studies.csv rows from the MITOMAP-miss increment (RM171).
Only the rated misses are written, and each of the other three buckets is refused for its own reason rather than filtered out silently:
- a photocopy is an allele ClinVar already publishes, and on the measured vintage every matched
bracketed row carried
reviewed_by_expert_panel. Drafting it would attribute the ClinGen mtDNA VCEP's call to the wrong publisher, and it would give a ClinVar concordance check a copy of ClinVar to disagree with — a check that cannot fail (@tautology-zero). - an unrated miss is a real identity increment with no class this tier may map: no bracket at
all, a bare confirmation token, or
[VUS*]. Counted, and no class is invented for it. - an unmintable row publishes no VCF-spellable allele. Counted, with the reason.
genotype is stubbed, and the reason is not the one the contig would give. ClinVar's drafter
fills the ALT on chrMT through sole_expressible_genotype, on the argument that a haploid contig
leaves no zygosity open — a correct argument about ClinVar, whose record is a claim about an allele.
It is not called here, because MITOMAP's row is a claim about a literature corpus: its homo and
hetero columns say the variant has been reported homoplasmic, heteroplasmic, or not recorded, and a
large share of these rows are reported only heteroplasmically. Writing genotype=<ALT> on one of
those states the homoplasmic reading — which is precisely the claim reference_examples/mt_heteroplasmy
keeps in variants.csv and separates from its heteroplasmy.csv bins. So the cell is left for the
author, and the flags MITOMAP did publish are put in front of them, per row, as the worklist.
state and conclusion are required too. state is folded from clin_sig through the shared
STATE_BY_CLIN_SIG wherever that fold exists and stubbed where it does not; conclusion is always
stubbed, because it is the sentence a reader is shown when a measurement lands here and MITOMAP
publishes a disease name, which is a different claim at a different grain.
Appends, never mutates (@draft-appends), matched on the coordinate identity — MITOMAP publishes
no rsID column at all, so there is no second identity for a row to arrive under.
MitomapDraftResult
dataclass
¶
MitomapDraftResult(
reports: list[DraftReport] = list(),
warnings: list[str] = list(),
skipped: bool = False,
candidates: int = 0,
withheld: dict[str, int] = dict(),
withheld_brackets: dict[str, int] = dict(),
indel_keys: int = 0,
indefinite_alleles: list[str] = list(),
stale: dict[str, tuple[dict, dict]] = dict(),
dataset: str | None = None,
)
What was drafted, and an account of every row in the increment that was not.
MitomapDraftError ¶
Bases: RuntimeError
A draft could not be attempted — no miss snapshot, or an unwritable spec directory.
draft_panel_from_mitomap_miss ¶
draft_panel_from_mitomap_miss(
spec_dir: Path,
genes: Sequence[str] = (),
*,
snapshot: Path | None = None,
declared_use: str = "unstated",
dry_run: bool = False,
) -> MitomapDraftResult
Append the rated half of the MITOMAP increment into a module's variants.csv/studies.csv.
genes filters on the gene MITOMAP's locus names, and the filter runs first: "the increment
has nothing for this gene" and "it has something and this provider would not write it" are
different answers and are counted apart. A locus naming two genes, or the control region, carries
no gene and is therefore never selected by a filter — which is the honest consequence of
withholding the attribution rather than guessing it.
Source code in enricher/src/just_dna_enricher/mitomap_draft.py
217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 | |