Reading OSIRIS reports
OSIRIS is NCBI's public-domain STR fragment analysis program. Its analysis of a folder of sample files writes an XML report, .oar; its review window saves edits as .oer, the same schema with the replaced values kept. osiris reads both with the core xml library.
import "@skiffyard/genotf/osiris.j" as osiris;
def r as osiris.Report init osiris.open("run1.oar");
io.printf("%s, kit %s, %d samples\n", $r.fullVersion, $r.kit, len($r.samples));The report
| Part | Read into |
|---|---|
Version, FullVersion, Heading (file name, creation time, MarkerSet, ILS, channels and their loci) | Report fields, Report.dyes |
Table/Sample | Report.samples: name, sample name, type, notices, channels, loci, notes |
Sample/Locus | Sample.loci: the calls (Allele), the calls edits replaced (OldAllele), notices, notes |
Sample/ChannelAlerts/Channel | Sample.channels: channel notices and flagged peaks (Artifact) |
DirectoryAlerts | Report.notices |
Messages/Message | Report.messages, by number |
Not read: lab and standard settings, sample QC values (Info), reviews, acceptances, interlocus alerts, export specifications. isReport tells a report from other XML by its root element.
Calls
for (def s in $r.samples) {
for (def l in $s.loci) {
for (def a in $l.alleles) {
io.printf("%s\t%s\t%s\t%f|prec=2\t%d\t%s\n", $s.name, $l.name, $a.name, $a.sizeBp, $a.height, $a.offLadder);
}
}
}| Field | OSIRIS |
|---|---|
offLadder | "true", "false", or "accepted": off-ladder, but listed as accepted in the lab settings |
count | 2 for the single peak of a homozygote, else 1 |
disabled | a user disabled the call in review |
interLocus | the adjacent locus, for a call between two loci |
id | the peak's id; the artifact entry of a call with notices has the same id |
Sample types are "Sample", "Ladder", "+Control", "-Control", and "Unknown" for a file OSIRIS could not analyse.
Notices and artifacts
OSIRIS's notices (alerts) are message numbers on samples, the ILS, channels, loci, calls and artifacts; texts turns them into text:
for (def s in $r.samples) {
io.printf("%s: %v\n", $s.name, osiris.texts($r, $s.notices));
for (def c in $s.channels) {
for (def a in $c.artifacts) {
io.printf(" channel %d, %f|prec=2 bp, level %d: %s\n", $c.number, $a.meanBp, $a.level, $a.label);
}
}
}An artifact is a peak OSIRIS flagged: pull-up, stutter, a spike, an off-ladder signal. level is its notices' highest priority (1 the most severe), label their texts one per line, calls the allele it is or resembles. Message.hidden and enabled say whether OSIRIS shows a notice and whether a user disabled it.
To forensicgenetics profiles
typings lists each sample's alleles per locus, as gmtable.typings does for GeneMapper tables: ladders, disabled calls and off-ladder calls (offLadder "true") are left out. The conversion to @deckyard/forensicgenetics is in the GeneMapper tables guide.
for (def ty in osiris.typings($r)) {
io.printf("%s %v\n", $ty.sample, $ty.loci);
}Errors
Error{kind: "genotf"} for bytes that are no UTF-8 XML, a root other than OsirisAnalysisReport, a required element missing (Version, Heading and its FileName, CreationTime, MarkerSet, ILSchannelNr, Table; a sample's Name and Type; a call's Id, Name, BPS, RFU), a number or boolean that does not parse, an OffLadder other than true, false, accepted, a message number twice, and a notice whose message is missing (except on replaced calls, whose notices may name old messages). A document too large or deep for xml throws its "limit".
Where the layout comes from
The element names and their order are OSIRIS's schema (OsirisXML/OsirisAnalysisReport-2.0.xsd) and the code that writes the report (OsirisLib2.01/STRLCAnalysisSM.cpp, CoreBioComponentSM.cpp, GeneticsSM.cpp, ChannelDataSM.cpp, DataSignalSM.cpp) and reads it in the review window (OsirisAnalysis/COAR*.cpp), OSIRIS 2.16. No report file is published with OSIRIS; the tests use reports laid out as that code writes them, with invented values.