# abif cheatsheet
Every export of @deckyard/abif. Guides are listed in the introduction .
jennifer import "@deckyard/abif/" as abif;
Every failure is Error{kind: "abif"}, except that open passes on what fs.readBytes throws. An f argument is a File; a tag is a name (four characters, such as DATA) and a number.
# Constants
Constant Value Meaning MAX_ENTRIES65536the most directory entries parse accepts; real files have 20 to 200
# Files and the directory
Function Returns Does parse(data)Filecheck the header and every directory entry against data, then index them open(path)Fileparse of a file read from disktags(f)list of stringevery tag as NAME + number (DATA9, PBAS2), in file order has(f, name, number)boolwhether the directory lists a tag entries(f)list of Entrythe directory, in file order entry(f, name, number)Entrya tag's directory entry; throws when it is missing raw(f, name, number)bytesa tag's data, whatever its type
# Values
Function Returns Does tag(f, name, number)Valuea tag decoded by its element type text(f, name, number)stringa pString, cString or char tag as UTF-8 text, untrimmed ints(f, name, number)list of inta byte, char (0 to 255), word, short or long tag floats(f, name, number)list of floata float or double tag typeName(elementType)stringshort, pString, user, ...; unknown for a code the specification does not name
# The run
Function Returns Does rawTrace(f, dye)list of intthe raw signal of a dye: DATA 1 to 4, then 105 and up analysedTrace(f, dye)list of intthe analysed signal: DATA 9 to 12, then 205 and up dyes(f)list of Dyethe dyes with names and wavelengths (Dye#, DyeN, DyeW) calls(f)Callsbases, qualities and peak locations as called (PBAS, PCON, PLOC 2) editedCalls(f)Callsthe same as edited by a user (number 1) info(f)Infosample, well, instrument, run times and other metadata
# Types
# File
The directory is one list per Entry field, so a File holds none of the deck's structs and is not rebuilt each time it is passed to the deck; entries and entry return Entry values.
Field Meaning version as intthe format version: 101 in .ab1 and .fsa, 300 in 3500 HID files names as list of stringeach entry's tag name, in file order numbers as list of inteach entry's tag number elementTypes as list of inteach entry's element type elementSizes as list of inteach entry's element size counts as list of inteach entry's element count dataSizes as list of inteach entry's data size offsets as list of inteach entry's data offset index as map of string to intthe position of each tag in those lists, keyed NAME + number data as bytesthe whole file
# Entry
Field Meaning name as stringthe tag name, such as DATA number as intthe tag number elementType as intthe element type code elementSize as intbytes per element count as intthe number of elements dataSize as intbytes of data, count * elementSize offset as intwhere the data starts in the file; 4 bytes or less sit in the entry itself
# Value
Variant Payload Holds Intsvalues (list of int)byte, word, short, long elementsFloatsvalues (list of float)float, double elementsCharsdata (bytes)char elements: text such as PBAS, or numbers such as PCONTextvalue (string)a pString or cString Datesvalues (list of Date)date elementsTimesvalues (list of Time)time elementsThumbsvalues (list of Thumb)thumb elementsBoolsvalues (list of bool)bool elementsRawelementType (int), data (bytes)any other type: user types, obsolete ones, encrypted HID types
# Date
Field Meaning year as intthe year month as intthe month as stored day as intthe day as stored
# Time
Field Meaning hour as intthe hour as stored minute as intthe minute as stored second as intthe second as stored hundredths as inthundredths of a second as stored; some instruments write values above 99
# Thumb
Field Meaning d as intthe first 32-bit field u as intthe second 32-bit field c as intthe first byte field n as intthe second byte field
# Dye
Field Meaning number as intthe dye number, also its trace's name as stringits name, such as 6-FAM; "" when absent or encrypted wavelength as intits emission wavelength in nm; 0 when absent or not one integer
# Calls
Field Meaning bases as stringthe called bases, IUPAC codes qualities as list of intone quality value per base, 0 to 255; empty when the file has none peaks as list of intone peak location (a scan number) per base; empty when the file has none
# Info
Text fields have trailing spaces and NULs removed and are "" when the file does not have them as text.
Field Meaning sample as stringthe sample name (SMPL) well as stringthe well, such as B9 (TUBE) lane as intthe capillary or lane (LANE); 0 when absent or not one integer instrument as stringthe instrument name and serial number (MCHN) model as stringthe instrument model, such as 3730 (MODL) runName as stringthe run name (RunN) runModule as stringthe run module (RMdN) dyeSet as stringthe dye set (DySN) polymer as stringthe polymer (GTyp) sizeStandard as stringthe size standard of a fragment run (StdF) runStart as stringYYYY-MM-DD HH:MM:SS from RUND / RUNT 1runFinish as stringfrom RUND / RUNT 2 collectionStart as stringfrom RUND / RUNT 3 collectionFinish as stringfrom RUND / RUNT 4