Reading Genotyper documents
import "@skiffyard/genotf/genotyper.j" as genotyper;
def doc as genotyper.Document init genotyper.open("Trisomy Template & Samples.gta");A document has no fixed extension: Genotyperâ„¢ on classic Mac OS did not use one, so a file may be called GTU000019M as well as run.gta. genotyper.isDocument (or genotf.formatOf) tells by the first bytes.
Categories
A category is a size range in one or more dyes: a marker (D21S11) or an allele bin (D21S11 29). dyeMask has bit 1 << dye set for each dye it covers, so a blue (dye 1) category has mask 2.
Lanes
A lane is one dye of one sample. name is what Genotyper showed, number the lane or capillary on the run, dye the dye from 1. The sample itself is not in the document: sourceFile and sourcePath name the file it came from, taken from the Mac alias Genotyper stored (sourceType FSAm for a sample file, RSLT for a GeneScanâ„¢ results file holding several lanes).
peaks is the lane's peak table as GeneScan sized it: scan range, height, area and size in base pairs.
Labels and calls
Genotyper labels peaks: with their size, their height, or the name of the category they fall in. labels lists every label; calls groups them by peak, one per labelled peak, with the peak's height and area and the categories of the lane's dye that hold its size:
for (def lane in $doc.lanes) {
for (def c in $lane.calls) {
io.printf("%s %v %f|prec=2 %d %v\n", $lane.name, $c.categories, $c.sizeBp, $c.height, $c.labels);
}
}Categories may overlap on purpose (a marker and its allele bins, a strand and its variants), so a call can be in several.
The results table
table is the table Genotyper's macros built, as text, header row first:
for (def row in $doc.table) {
io.printf("%s\n", strings.join($row, "\t"));
}Cells are what was displayed: 0 is how many macros mark "no allele".
Issues
A lane whose fields do not hold together, or a label naming a peak that is not there, is reported in issues and skipped; the rest of the document is read.