Skip to article frontmatterSkip to article content
Site not loading correctly?

This may be due to an incorrect BASE_URL configuration. See the MyST Documentation for reference.

Conventions

Where a community format is well specified, betula follows it. Where it isn’t, betula decides and documents the decision here.

Coordinates

Intervals are 1-based and inclusive, following GFF3 (columns 4 and 5): a feature covering the first ten bases of a sequence has start: 1 and end: 10, and its length is end - start + 1. This applies to annotation and to the location primitive.

Differences from other formats

FormatConventionConvert to betula
GFF3, GTF, VCF1-based, inclusivestart, end unchanged
BED0-based, half-openstart + 1, end unchanged
Python / Rust ranges, slicing0-based, half-openstart + 1, end unchanged

Converting from betula to BED or to a slice is the reverse: start - 1, end unchanged. The usual mistake is forgetting the shift on start only, which silently moves every feature one base.

Zero-length intervals

betula does not represent zero-length intervals (a point between two bases, such as an insertion site or a cut site): every interval covers at least one base. GFF3 writes such a site as start equal to end, meaning the point to the right of that base. betula reads the same numbers as a one-base feature, so copying them changes their meaning. None of the current consumers need zero-length intervals; supporting them would be a schema change.

BLAST coordinates

blast-result follows BLAST’s XML2 output (-outfmt 16), with keys in camelCase, for blastn, blastp, blastx, tblastn and tblastx. Coordinates are 1-based and inclusive, in nucleotides for a nucleotide sequence (also when translated) and amino acids for a protein. The start <= end rule does not apply. Checked against BLAST+ 2.16.0:

ProgramStrand fieldsMinus strand
blastnqueryStrand, hitStrand (Plus or Minus)hitStrand: "Minus", and hitFrom > hitTo
blastpnone
blastxqueryFramequeryFrame is negative; queryFrom <= queryTo
tblastnhitFramehitFrame is negative; hitFrom <= hitTo
tblastxqueryFrame, hitFramethe frame is negative; from <= to on both

The fields in the second column are required for that program, and a required frame can’t be 0. Other programs have no strand rule. When converting from other output formats:

When there are no hits, XML2 gives a message (“No hits found”) and hits is absent or empty. stat and params are XML2’s Statistics and Parameters elements, without the wrapper. XML holds only text, so a parser must convert numbers.

Tree branch lengths

length is optional, as in Newick. Leave it out when it is unknown or doesn’t apply, such as at the root or in a topology-only tree; don’t write 0, which means a branch of zero length. Negative lengths are allowed, because neighbor-joining can produce them.

Absent values

No betula schema allows null. Leave an optional field out instead.

Extra data

Unknown fields are rejected. Put application-specific data in the optional metadata field, whose values are strings or lists of strings:

Keys that turn out to be common can become fields of the schema.

Conformance

A document conforms to betula if it passes its JSON Schema and the rules below, which JSON Schema can’t express. The bindings check both. If you validate with the schema alone, in any language, you must also implement the rules.

SchemasRule
annotation (every node, including children), core/locationstart <= end
blast-result (every HSP)the strand fields its program requires are present, and required frames are not 0

To test an implementation, run the fixtures in examples/<name>/:

DirectorySchema aloneConforming implementation
validacceptsaccepts
invalidrejectsrejects
invalid-rulesacceptsrejects