Getting Started with BSML

Listing 2.1 The SARS virus, encoded in BSML

<?xml version="1.0" encoding="UTF-8"?>

<!-- SARS Coronavirus Urbani, complete genome. -->

<Definitions> <Sequences>

<Sequence id="AY278741" length="29727"> <Seq-data>

atattaggtttttacctacccaggaaaagccaaccaacctcgatctcttgtagatctgttct ctaaacgaactttaaaatctgtgtagctgtcgctcggctgcatgcctagtgcacctacgcagt ataaacaataataaattttactgtcgttgacaagaaacgagtaactcgtccctcttctgcaga ctgcttacggtttcgtccgtgttgcagtcgatcatcagcatacctaggtttcgtccgggtgt gaccgaaaggtaagatggagagccttgttcttggtgtcaacgagaaaacacacgtccaactca gtttgcctgtcc

[For brevity, sequence is truncated.] </Seq-data> </Sequence> </Sequences> </Definitions> </Bsml>

inspect and interact with BSML documents. This makes for much more exciting and interactive examples.

Listing 2.1 shows our first XML example, a bare bones BSML document. The document represents the raw sequence data for the coronavirus responsible for severe acute respiratory syndrome (SARS). The virus sequence is 29,727 base pairs in length, and we have taken the liberty of only displaying the first few hundred base pairs. Let us now examine Listing 2.1, and we will continue with a high-level overview of the document structure.

There is a lot going on in our first example. For now, note the following items of interest:

• Our document begins with the characters "<?xml" This is formally known as the XML prolog and is used to indicate the version of XML and the character encoding.

• The second and third lines of the document are XML comments. Comments begin with the characters "<!- -" and end with the characters "- ->".

• Every XML document must have a root element. In our case, Bsml is the root element, and all other elements are descendants of the root. For example, the Definitions element is a child of the root Bsml element.

• XML elements are defined with start and end tags. For example, this tag: <Seq-data> signals the start of the Seq-data element. Likewise, this tag: </Seq-data> indicates the end of the element.

• Attributes appear within start element tags, and provide additional information about that element. For example, our document includes two attributes: id and length. Within BSML, the id attribute is used to uniquely identify an element within a document, and the length attribute is used to denote the number of base pairs or residues in a sequence.

Every XML document explicitly defines a document structure or element hierarchy. The element hierarchy for our sample document is shown in Figure 2.1. As you can see, Bsml is the roots element. The root element contains a Definitions element, which in turn contains a [Sequences] element. This element then contains a [Sequence] element, which in turn contains a [Seq-data]

Was this article helpful?

0 0
Swine Influenza

Swine Influenza

SWINE INFLUENZA frightening you? CONCERNED about the health implications? Coughs and Sneezes Spread Diseases! Stop The Swine Flu from Spreading. Follow the advice to keep your family and friends safe from this virus and not become another victim. These simple cost free guidelines will help you to protect yourself from the swine flu.

Get My Free Ebook

Post a comment