just_dna_enricher.strchive_draft¶
just_dna_enricher.strchive_draft ¶
Draft repeat_alleles.csv identity rows from the STRchive catalogue (RM165, the other half).
The band half of this source is checked and never written (strchive.check_repeat_bands). This is the
half that is written: the facts the catalogue owns and an author would otherwise transcribe by hand.
And it is a much thinner row than the item expected, which is the finding this module carries.
The proposal listed chrom/start_hg38/stop_hg38, locus_structure, ref_copies and the disease
identifiers as the identity half — and RepeatAlleleRow has no column for any of them except the
trait. That is not an oversight in the model: repeat coordinates are RM65, deferred, and the motif
structure is RM66, parked. So what a drafted row can actually carry is the gene, the motif, the trait
CURIE and the fixed measure_kind, with conclusion left as a placeholder for the human. The rest of
the catalogue's identity half is reported and counted rather than silently dropped — a number this
pass computes and discards is one every reader has to recompute.
What that thin row is still worth: the motif orientation is a real trap (a minus-strand locus is published in two spellings), the MONDO id is a real transcription task, and the list of loci is itself the thing an author starting a repeat module does not have. A drafted row is a locus the author has been told exists, with its identity spelled the way the catalogue spells it and every interpretive cell left blank.
Never drafted: the bands. measure_min/measure_max/measure_tiling, and the per-band
direction/clin_sig/phenotype that go with them. Measured against both corpus modules and wrong
in both: STRchive is a band coarser than fmr1_cgg_repeat at the premutation threshold, and its
pathogenic_max would invent a ceiling htt_repeat_expansion deliberately leaves open. The withheld
set is derived from the drafted one rather than listed beside it, so a column added to the model
lands on the withheld side by default.
Appends, never mutates (@draft-appends). A locus already in the table is reported
already_present and nothing is rewritten — matched on (gene, repeat_unit), which is the identity
that survives the human filling in the bands and splitting one drafted row into four.
StrchiveDraftError ¶
Bases: RuntimeError
A draft could not be attempted — an unreadable catalogue, or an unwritable spec directory.
StrchiveDraftResult
dataclass
¶
StrchiveDraftResult(
report: DraftReport | None = None,
candidates: int = 0,
withheld: dict[str, int] = dict(),
contested: list[tuple[str, str]] = list(),
fractional_ref_copies: int = 0,
with_locus_structure: int = 0,
warnings: list[str] = list(),
dataset: str | None = None,
skipped: bool = False,
)
What was drafted, and an account of every catalogue locus that was not.
accounts_for_every_candidate ¶
Every admitted locus is either a partial row this run offered, or a counted withholding.
Source code in enricher/src/just_dna_enricher/strchive_draft.py
draft_repeat_loci ¶
draft_repeat_loci(
spec_dir: Path,
genes: Sequence[str] = (),
*,
catalogue: Path | StrchiveCatalogue | None = None,
declared_use: str = "unstated",
dry_run: bool = False,
) -> StrchiveDraftResult
Append one identity row per STRchive locus into the module's repeat_alleles.csv.
genes filters; empty drafts every locus in the catalogue. The filter runs first and is
counted separately from the withholding, because "the catalogue has nothing for this gene" and
"it has something and this provider would not write it" are different answers.
Contestation is decided over the whole admitted set before any row is built, so a filter cannot
remove the second claimant and leave the first reading as uncontested
(@filter-before-the-group-picks-a-winner).
Source code in enricher/src/just_dna_enricher/strchive_draft.py
193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 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 | |