Skip to content
Snippets Groups Projects
hsx_format.html 35.1 KiB
Newer Older
Diego Rubert's avatar
Diego Rubert committed
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 722 723 724 725 726 727 728 729 730 731 732 733 734 735 736 737 738 739 740 741 742 743 744 745 746 747 748 749 750 751 752 753 754 755 756 757 758 759 760 761 762 763 764 765 766 767 768 769 770 771 772 773 774 775 776 777 778 779 780 781 782 783 784 785 786 787 788 789 790 791 792 793 794 795 796 797 798 799 800 801 802 803 804 805 806 807 808 809 810 811 812 813 814 815 816 817 818 819 820 821 822 823 824 825 826 827 828 829 830 831 832 833 834 835 836 837 838 839 840 841 842 843 844 845 846 847 848 849 850 851 852 853 854 855 856 857 858 859 860 861 862 863 864 865 866 867 868 869 870 871 872 873 874 875 876 877 878 879 880 881 882 883 884 885 886 887 888 889 890 891 892 893 894 895 896 897 898 899 900 901 902 903 904 905 906 907 908 909 910 911 912 913 914 915 916 917 918 919 920 921 922 923 924 925 926 927 928 929 930 931 932 933 934 935 936 937 938 939 940 941 942 943 944 945 946 947 948 949 950 951 952 953 954 955 956 957 958 959 960 961 962 963 964 965 966 967 968 969 970 971 972 973 974 975 976 977 978 979 980 981 982 983 984 985 986 987 988 989 990 991 992 993 994 995 996 997 998 999 1000
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
	"http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<title>HSX Format</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<meta http-equiv="Content-Style-Type" content="text/css">
<style type="text/css">
	body            { margin: 0 4% 0 3%;
	                  color: black; background-color: white }

	p.vvlarge       { margin-top: 6ex; margin-bottom: 0 }
	p.vlarge        { margin-top: 4ex; margin-bottom: 0 }
	p.large         { margin-top: 3ex; margin-bottom: 0 }
	p               { margin-top: 2ex; margin-bottom: 0 }
	p.small         { margin-top: 1ex; margin-bottom: 0 }
	p.hdr           { margin-top: 4ex; margin-bottom: 0 }
	p.subhdr        { margin-top: 2.5ex; margin-bottom: 0 }
	p.scrollspace   { margin-top: 100em; margin-bottom: 0 }

	pre             { margin-top: 0.7ex; margin-bottom: 0.7ex }

	ul.sub          { margin-left: -1ex }

	code            { padding-left: 0.3ex; padding-right: 0.3ex }
	.pad            { padding-left: 0.3ex; padding-right: 0.3ex }
	.nopad          { padding-left: 0; padding-right: 0 }
	.ttab           { padding-left: 0.3ex; padding-right: 0 }
	.stab           { padding-left: 1ex; padding-right: 0 }
	.mtab           { padding-left: 4ex; padding-right: 0 }
	.wtab           { padding-left: 6ex; padding-right: 0 }

	.notop          { margin-top: 0 }

	table                            { margin-top: 0; margin-bottom: 0;
	                                   border-collapse: collapse }
	tbody                            { text-align: left; vertical-align: baseline }
	td                               { padding-top: 0.5ex; padding-bottom: 0.5ex;
	                                   padding-left: 0.5ex; padding-right: 0.5ex }
	td.indent                        { padding-left: 1.5ex; padding-right: 0.5ex }
	table.withlines                  { margin-top: 1ex; margin-bottom: 1ex;
	                                   border: 2px solid black }
	table.withlines tr.newsect       { border-top: 2px solid black }
	table.withlines tr.sectend       { border-bottom: 2px solid black }
	table.withlines td               { border: 1px dotted gray }
	table.nolines                    { border: none }
	table.nolines td                 { border: none }
	table.figure                     { border: none }
	table.figure td                  { padding-top: 2ex; padding-bottom: 2ex;
	                                   padding-left: 0; padding-right: 0;
	                                   border: none }
	table.holder                     { border: none }
	table.holder td                  { padding: 0; border: none }
	table.holder td.indent           { padding-left: 5ex }
	table.holder pre                 { margin: 0 }
	table.holder table.withlines     { margin-top: 0.5ex; margin-bottom: 0.5ex;
	                                   border: 1px solid black }
	table.holder table.withlines td  { padding-top: 0.3ex; padding-bottom: 0.3ex;
	                                   padding-left: 0.3ex; padding-right: 0.3ex;
	                                   border: 1px dotted gray }

	.usernote       { font-style: italic; font-weight: bold;
	                  background-color: #FF9900 }
</style>
</head>
<body>

<p class=vvlarge>
<h2>HSX Format</h2>
Format Specification version 1.0.0,
January 12, 2010

<p class=vvlarge>
TABLE OF CONTENTS

<p class=small>
<ul class=notop>
<li><a href="#intro">Introduction</a>
<li><a href="#spec">File Specification</a>
<li><a href="#hash">Hash Function</a>
<li><a href="#example">Example</a>

</ul>

<p class=hdr>
<h3><a name="intro">Introduction</a></h3>
<p>

HSX is a binary file format for indexing (or listing) DNA sequences in other
files, allowing fast random access to those sequences.  The format was created
as part of the <a href="http://www.bx.psu.edu/miller_lab/">LASTZ</a> project,
providing a means to input selected sequences from several short read files
into a single run of LASTZ.

<p>
This document is provided for users interested in creating HSX files with
programs of their own design.

<p>
The HSX file contains a sequence index array and an associated hash table.
Each sequence index entry includes the sequence's name, length, and a reference
to the location of the sequence's data in some other file.  This array can be
accessed either sequentially or via the hash table.  Note that the names in
the index file do not have to match the original names or headers in the
sequence files.

<p>
Sequence entries are ordered by the hashes of their names.  Conceptually, the
hash table groups the sequences into <dfn>buckets</dfn> of sequences with the
same hash.  For each bucket, the table gives the location in the sequence index
of the first sequence in that bucket.  Hash collisions are resolved by scanning
subsequent index entries for the remaining sequences in the bucket.

<p>
There is also a file table, which allows a single index file to cover sequences
from multiple sequence files of varying formats.  However, currently LASTZ only
supports indexing of files in FASTA format.

<p class=hdr>
<h3><a name="spec">File Specification</a></h3>

<p>
The file is stored in a binary format described by the table below. It can be
written on either a big-endian or little-endian machine;  programs reading the
file determine the byte order of multi-byte fields by examining the magic
number at the start of the file.

<p>
<table class=withlines><tbody>
<tr class=sectend><td>File Offset</td><td>Data</td><td>Meaning</td></tr>

<tr>
<td><code>0x00</code></td>
<td><code>D2&nbsp;52&nbsp;70&nbsp;95</code>
<br><span class=stab></span> &mdash;or&mdash;
<br><code>95&nbsp;70&nbsp;52&nbsp;D2</code></td>
<td>Magic number indicating big-endian byte order.
<br>
<br>Magic number indicating little-endian byte order.</td>
</tr>

<tr>
<td><code>0x04</code></td>
<td><code>00&nbsp;00&nbsp;01&nbsp;00</code></td>
<td>File conforms to version 1.0 of the HSX file format.</td>
</tr>

<tr>
<td><code>0x08</code></td>
<td><code>00&nbsp;00&nbsp;00&nbsp;1C</code></td>
<td>Header length in bytes, including this field through the SOFF field.</td>
</tr>

<tr>
<td><code>0x0C</code></td>
<td><code>00&nbsp;00&nbsp;00&nbsp;xx</code></td>
<td><code class=nopad>FLEN</code>:<span class=ttab></span>
number of entries in the file table (limited to 255).</td>
</tr>

<tr>
<td><code>0x10</code></td>
<td><code>xx&nbsp;xx&nbsp;xx&nbsp;xx</code></td>
<td><code class=nopad>FOFF</code>:<span class=ttab></span>
offset (from file start) to the file table.</td>
</tr>

<tr>
<td><code>0x14</code></td>
<td><code>xx&nbsp;xx&nbsp;xx&nbsp;xx</code></td>
<td><code class=nopad>HLEN</code>:<span class=ttab></span>
number of buckets in the hash table.  This also serves as the modulus for
the hash function.
<p class=small>
Typically the number of buckets is set so that the average number of
sequences per bucket (<code>SLEN/HLEN</code>) is reasonably small (e.g. 10).
<p class=small>
The hash table actually includes <code>HLEN+1</code> buckets.  An extra
<dfn>sentinel</dfn> bucket is appended at the end of the table, containing
the offset to just past the end of the sequence index table.</td>
</tr>

<tr>
<td><code>0x18</code></td>
<td><code>xx&nbsp;xx&nbsp;xx&nbsp;xx</code></td>
<td><code class=nopad>HOFF</code>:<span class=ttab></span>
offset (from file start) to the hash table.</td>
</tr>

<tr>
<td><code>0x1C</code></td>
<td><code>xx&nbsp;xx&nbsp;xx&nbsp;xx</code></td>
<td><code class=nopad>SLEN</code>:<span class=ttab></span>
number of entries in the sequence index table.</td>
</tr>

<tr>
<td><code>0x20</code></td>
<td><code>xx&nbsp;xx&nbsp;xx&nbsp;xx</code></td>
<td><code class=nopad>SOFF</code>:<span class=ttab></span>
offset (from file start) to the sequence index table.
<p class=small>
Entries in the sequence index table are necessarily stored in hash order.
Entries with the same hash are stored in alphabetical order (actually, in
lexicographic order over the bytes of their names.)
<p class=small>
See the <a href="#hash">hashing description</a> below this table for
more information.</td>
</tr>

<tr class=newsect>
<td><code>FOFF</code></td>
<td><code>xx&nbsp;xx&nbsp;xx&nbsp;xx</code></td>
<td><code class=nopad>FINFO<sub>0</sub></code>:<span class=ttab></span>
offset (from file start) to the info record for the first sequence file
(file 0).</td>
</tr>

<tr>
<td></td>
<td><span class=pad>&hellip;</span></td>
<td>Offsets to info records for the remaining <code>FLEN-1</code> files.</td>
</tr>

<tr class=newsect>
<td><code>FINFO<sub>0</sub></code></td>
<td><code>xx&nbsp;xx&nbsp;</code>&hellip;</td>
<td><code class=nopad>FTYPE<sub>0</sub></code>:<span class=ttab></span>
file type for file 0, stored as a length byte
<code>FTYPELEN<sub>0</sub></code> followed by <code>FTYPELEN<sub>0</sub></code>
bytes of ASCII text.
<p class=small>
This is equivalent to a file extension (without a leading <code>.</code>) and
will be used as such.  In the current implementation, it must be
<code>fa</code> or <code>fasta</code>.
<p class=small>
Together, this field and the next comprise a single info record in the
file table.</td>
</tr>

<tr>
<td><code>FINFO<sub>0</sub>+1+FTYPELEN<sub>0</sub></code></td>
<td><code>xx&nbsp;xx&nbsp;</code>&hellip;</td>
<td>
<code class=nopad>FNAME<sub>0</sub></code>:<span class=ttab></span>
file name for file 0, stored as a length byte
<code>FNAMELEN<sub>0</sub></code> followed by <code>FNAMELEN<sub>0</sub></code>
bytes of ASCII text.
<p class=small>
This is used as the base file name for the corresponding sequence file,
including path.
However, it is usually an empty string, in which case the
base name and path are copied from the name and path of the HSX file itself.
This allows files to be renamed without rebuilding the index.</td>
</tr>

<tr>
<td></td>
<td><span class=pad>&hellip;</span></td>
<td>Info records for the remaining <code>FLEN-1</code> files.</td>
</tr>

<tr class=newsect>
<td><code>HOFF</code></td>
<td><code>xx&nbsp;xx&nbsp;xx&nbsp;xx&nbsp;xx</code></td>
<td><code class=nopad>SOFF<sub>H(0)</sub></code>:<span class=ttab></span>
offset (from file start) into the sequence index table, pointing to the first
sequence in the first hash bucket (bucket 0).
<p class=small>
<code>SOFF<sub>n</sub></code> is the file offset for the
<code class=nopad>n</code>-th entry in the sequence index table.
<code>H(k)</code> is the number of sequences that have a hash code less than
that of bucket <code>k</code> (i.e. the number of sequences assigned to buckets
before bucket <code>k</code>).
Therefore <code class=nopad>SOFF<sub>H(k)</sub></code> points to the first
sequence in the <code>k</code>th hash bucket.
<p class=small>
The most significant bit in a bucket's <code>SOFF<sub>H(k)</sub></code> value
is used to indicate whether the bucket is empty or not.  If a bucket is empty,
this bit is set (1), otherwise it is clear (0).  The end of the sequences for
bucket <code>k</code> can be determined from <code>SOFF<sub>H(k+1)</sub></code>
(the entry for the start of the next bucket).
</td>
</tr>

<tr>
<td></td>
<td><span class=pad>&hellip;</span></td>
<td>Offsets for the first sequences in the remaining <code>HLEN-1</code>
buckets.</td>
</tr>

<tr>
<td><code>HOFF+5*HLEN</code></td>
<td><code>xx&nbsp;xx&nbsp;xx&nbsp;xx&nbsp;xx</code></td>
<td>Sentinel hash bucket.  This contains an offset to the end of the
sequence index table (i.e., to the byte just beyond the last entry).
</td>
</tr>

<tr class=newsect>
<td><code>SOFF</code></td>
<td><code>xx&nbsp;xx&nbsp;xx&nbsp;xx&nbsp;xx</code></td>
<td><code class=nopad>IXLEN<sub>0</sub></code>:<span class=ttab></span>
length (in nucleotides) of the first sequence.
<p class=small>
A sequence may be empty, so zero is a legitimate value for the sequence length.
<p class=small>
Together, this field and the next three comprise a single entry in the
sequence index table.</td>
</tr>

<tr>
<td><code>SOFF+5</code></td>
<td><code>xx</code></td>
<td><code class=nopad>IXFILE<sub>0</sub></code>:<span class=ttab></span>
index into the file table for the file containing the first sequence.</td>
</tr>

<tr>
<td><code>SOFF+6</code></td>
<td><code>xx&nbsp;xx&nbsp;xx&nbsp;xx&nbsp;xx&nbsp;xx</code></td>
<td><code class=nopad>IXOFF<sub>0</sub></code>:<span class=ttab></span>
offset (from the start of the appropriate sequence file) pointing to the first
sequence.</td>
</tr>

<tr>
<td><code>SOFF+12</code></td>
<td><code>xx&nbsp;xx&nbsp;</code>&hellip;</td>
<td><code class=nopad>IXNAME<sub>0</sub></code>:<span class=ttab></span>
name of the first sequence, stored as a length byte
<code>IXNAMELEN<sub>0</sub></code> followed by
<code>IXNAMELEN<sub>0</sub></code> bytes of ASCII text.</td>
</tr>

<tr>
<td></td>
<td><span class=pad>&hellip;</span></td>
<td>Sequence index entries for the remaining <!-- <code>SLEN-2</code> -->
<code>SLEN-1</code> sequences.</td>
</tr>

</tbody></table>

<p class=hdr>
<h3><a name="hash">Hash Function</a></h3>
<p>

The code for the underlying hash function is shown below, written in C.
The hash bucket for sequence name <code>NAME</code> is computed by
<pre>
    bucket = hassock_hash(NAME,strlen(NAME)) % HLEN;
</pre>

<p>
This hash function is a variant of Austin Appleby's
<a href="http://murmurhash.googlepages.com/">MurmurHash2</a>.
The primary differences are that it has the seed hardwired and scans the input
data in the reverse order (this is not structly true, since the
non-multiple-of-four leftover bytes are handled slightly differently).  It is
also endian-neutral.

<p>
<pre>
    #include &lt;stdint.h&gt;

    uint32_t hassock_hash (const void* key, uint32_t len)
        {
        const uint32_t seed = 0x5C3FC4D3;
        const uint32_t m    = 0x87C10417;
        const uint8_t* data = ((const uint8_t*) key) + len;
        const uint8_t* stop = ((const uint8_t*) key) + 4;
        uint32_t       h, k;

        h = seed ^ len;
        while (data &gt;= stop)
            {
            k  = *(--data);
            k |= *(--data) &lt;&lt; 8;
            k |= *(--data) &lt;&lt; 16;
            k |= *(--data) &lt;&lt; 24;
            k *= m;
            k ^= k &gt;&gt; 24;
            k *= m;
            h *= m;
            h ^= k;
            len -= 4;
            }
        switch (len)
            {
            case 3: h ^= *(--data) &lt;&lt; 16;
            case 2: h ^= *(--data) &lt;&lt; 8;
            case 1: h ^= *(--data);
                    h *= m;
            }
        h ^= h &gt;&gt; 13;
        h *= m;
        h ^= h &gt;&gt; 15;
        return h;
        }
</pre>

<p class=hdr>
<h3><a name="example">Example</a></h3>
<p>


In this example, we have 10 sequences from 3 fasta files, indexed by a single
HSX file.  We first show the fasta files, then show a field-by-field hex dump
of the corresponding HSX file.  For demonstration purposes, the HSX file was
created with only 5 buckets. Typical HSX files will deal with more sequences,
more files, and have more buckets.

<p>
hsxexA.fa contains five sequences:
<p>
<pre>
    >HSXEXA_785
    TAACGGCAATCTTTGGTAGACCTATTGGTCATATCATGAAATTGAAGGAT
    AATTATTGCCATAAAGTTTTTCACGTTACTATCTTTGCCTCGCAATGAAT
    AAAATATTCTTAGGGCTACTTTGTAACCTTGCAGAC
    >HSXEXA_88K
    TTAATTACTCGCATGATCTTTCAAGATCTTTACCGTTCACACAATTTCTC
    GAACACTCAGTA
    >HSXEXA_DNQ
    CAGTGTACAAAATAAACTATTAACTATATGTAGATAGATACATAGAGACA
    AAACGGGTAGCATCTAGTATCCTGACTGCGCATTGTGGGGTGTCGCTTCT
    AAGTACCCGAAATGAGCGT
    >HSXEXA_LRW
    TTAAGTACATTCAGATCCATCATGGTTTCGGAAGCTAATGGGAAAAGGGG
    TACAGAATACAACACCTAGTTGATACGATAGTTAGTTTTTTA
    >HSXEXA_R9V
    TATAGTGCGTGTATGACCAATATTACGATGATCGTGACGCCATAGGGTCA
    TATTCCTTAATATGTAAATATGAAGGTA
</pre>

<p>
hsxexB.fa contains four sequences:
<p>
<pre>
    >HSXEXB_6YF
    AAGAGTTCTTACGGCAATAACAAAATGATGCTGTATCCTAGTAACAGGAA
    CGAACCATTCGCTTCTGTGTTCTATACAGAAGAAACCAGACTCGCTAAAC
    A
    >HSXEXB_WCV
    AATTAGTCTATTAAGGACTATATGTTTACAAGGATGGTAGTCCTAACGGA
    ATTGATACCAATAGGTGGCACTTACCGTAGCTAGGTAGATCGCCCTACTA
    CACCAGCTCAGCCATCTTGCCCCGCCAACT
    >HSXEXB_YKU
    GTCAACAGGTTTTCGGACTGGTGGCTTTCCTGATTTGATATTCAAAGGAA
    ATTAGGGTAAGGACTTTGAGTTGTCATAGAATTCAATTTCGGGCTCCGTC
    CATCACCTCGT
    >HSXEXB_YV1
    GGTGATGTTGTGAATATCACTGTCATGAAGGTCTCCTTCGGCCGCCTTAA
    TCATCATCATAAGTTTCACCATGGTAAAATGAATTAGCCCCAAGCT
</pre>

<p>
hsxexC.fa contains three sequences:
<p>
<pre>
    >HSXEXC_4ZL
    CACATCACATTGGTTGTTCATCCATATAATTATTTCCCATAAACTTTAAG
    AGCTCGGCTGGCCATACGTACTGACTAGCTTAGCCCCTAACTAATCGGCC
    ACAGCGATAGTACA
    >HSXEXC_936
    TGGTTTTTAGAGTCCGTGGAGCCTCTCAGCCACACTGGGTTCGGGAAGTT
    TCAGGCAAGTCCTACCTGTAA
    >HSXEXC_GWD
    CTAATCTGGGCTTGGGTCTGAACTCGCCCATGAGGAGGTAAGCAAACCAA
    TAAATTCGGGTATGGCGGTCTTTATTATGCTTAAGGAACGGAACAA
</pre>

<p>
The twelve sequence names are hashed into separate buckets, and sorted within
buckets, like this:

<p>
<table class=withlines><tbody>
<tr class=sectend><td>Hash Code/Bucket</td>
<td>Sequence Name</td>
<td>Fasta file</td>
<td>Offset to sequence, in fasta file</td></tr>

<tr>
<td><code>0</code></td>
<td>HSXEXB_6YF</td>
<td>hsxexB.fa</td>
<td><code>0x0000 00000000</code></td>
</tr>

<tr>
<td><code>1</code></td>
<td>HSXEXA_785
<br>HSXEXA_DNQ</td>
<td>hsxexA.fa
<br>hsxexA.fa</td>
<td><code>0x0000 00000000</code>
<br><code>0x0000 000000E3</code></td>
</tr>

<tr>
<td><code>2</code></td>
<td>HSXEXA_88K
<br>HSXEXA_LRW
<br>HSXEXB_YV1
<br>HSXEXC_4ZL</td>
<td>hsxexA.fa
<br>hsxexA.fa
<br>hsxexB.fa
<br>hsxexC.fa</td>
<td><code>0x0000 00000097</code>
<br><code>0x0000 00000169</code>
<br><code>0x0000 00000183</code>
<br><code>0x0000 00000000</code></td>
</tr>

<tr>
<td><code>3</code></td>
<td>HSXEXB_YKU</td>
<td>hsxexA.fa</td>
<td><code>0x0000 00000105</code></td>
</tr>

<tr>
<td><code>4</code></td>
<td>HSXEXA_R9V
<br>HSXEXB_WCV
<br>HSXEXC_936
<br>HSXEXC_GWD</td>
<td>hsxexA.fa
<br>hsxexB.fa
<br>hsxexC.fa
<br>hsxexC.fa</td>
<td><code>0x0000 000001D3</code>
<br><code>0x0000 00000074</code>
<br><code>0x0000 00000081</code>
<br><code>0x0000 000000D6</code></td>
</tr>

</tbody></table>

<p>
Here is the complete HSX file, byte-by-byte:

<p>
<table class=withlines><tbody>
<tr class=sectend><td>File Offset</td><td>Data</td><td>Field</td><td>Meaning</td></tr>

<tr>
<td><code>0x00000000</code></td>
<td><code>D2&nbsp;52&nbsp;70&nbsp;95</code>
<td>Magic number</td>
<td>Big-endian.</td>
</tr>

<tr>
<td><code>0x00000004</code></td>
<td><code>00&nbsp;00&nbsp;01&nbsp;00</code></td>
<td>HSX version</td>
<td>1.0.</td>
</tr>

<tr>
<td><code>0x00000008</code></td>
<td><code>00&nbsp;00&nbsp;00&nbsp;1C</code></td>
<td>Header length</td>
<td>28 bytes.</td>
</tr>

<tr>
<td><code>0x0000000C</code></td>
<td><code>00&nbsp;00&nbsp;00&nbsp;03</code></td>
<td><code class=nopad>FLEN=3</code><span class=ttab></span></td>
<td>3 entries in file table.</td>
</tr>

<tr>
<td><code>0x00000010</code></td>
<td><code>00&nbsp;00&nbsp;00&nbsp;30</code></td>
<td><code class=nopad>FOFF=30</code><span class=ttab></span></td>
<td>File table is at 0x00000030.</td>
</tr>

<tr>
<td><code>0x00000014</code></td>
<td><code>00&nbsp;00&nbsp;00&nbsp;05</code></td>
<td><code class=nopad>HLEN=5</code><span class=ttab></span></td>
<td>5 buckets in the hash table.
</tr>

<tr>
<td><code>0x00000018</code></td>
<td><code>00&nbsp;00&nbsp;00&nbsp;60</code></td>
<td><code class=nopad>HOFF=60</code><span class=ttab></span></td>
<td>Hash table is at 0x00000060.</td>
</tr>

<tr>
<td><code>0x0000001C</code></td>
<td><code>00&nbsp;00&nbsp;00&nbsp;0C</code></td>
<td><code class=nopad>SLEN=0C</code><span class=ttab></span></td>
<td>12 entries in the sequence index table.</td>
</tr>

<tr>
<td><code>0x00000020</code></td>
<td><code>00&nbsp;00&nbsp;00&nbsp;60</code></td>
<td><code class=nopad>SOFF=80</code><span class=ttab></span></td>
<td>Sequence index table is at 0x00000080.</td>
</tr>

<tr>
<td><code>0x00000024</code></td>
<td><code>00&nbsp;00&nbsp;00&nbsp;00</code>
<br><code>00&nbsp;00&nbsp;00&nbsp;00</code>
<br><code>00&nbsp;00&nbsp;00&nbsp;00</code></td>
<td><code class=nopad>Padding</code><span class=ttab></span></td>
<td>The creating program can insert padding here, at its descretion.</td>
</tr>

<tr class=newsect>
<td><code>0x00000030</code></td>
<td><code>00&nbsp;00&nbsp;00&nbsp;40</code></td>
<td><code class=nopad>FINFO<sub>0</sub>=40</code><span class=ttab></span></td>
<td>Info record for file 0 is at 0x00000040.</td>
</tr>

<tr>
<td><code>0x00000034</code></td>
<td><code>00&nbsp;00&nbsp;00&nbsp;4A</code></td>
<td><code class=nopad>FINFO<sub>1</sub>=4A</code><span class=ttab></span></td>
<td>Info record for file 1 is at 0x0000004A.</td>
</tr>

<tr>
<td><code>0x00000038</code></td>
<td><code>00&nbsp;00&nbsp;00&nbsp;54</code></td>
<td><code class=nopad>FINFO<sub>2</sub>=54</code><span class=ttab></span></td>
<td>Info record for file 2 is at 0x00000054.</td>
</tr>

<tr>
<td><code>0x0000003C</code></td>
<td><code>00&nbsp;00&nbsp;00&nbsp;00</code>
<td><code class=nopad>Padding</code><span class=ttab></span></td>
<td></td>
</tr>

<tr class=newsect>
<td><code>0x00000040</code></td>
<td><code>00&nbsp;66&nbsp;61</code></td>
<td><code class=nopad>FTYPE<sub>0</sub></code><span class=ttab></span></td>
<td>File type for file 0 is "fa".</td>
</tr>

<tr>
<td><code>0x00000043</code></td>
<td><code>06&nbsp;68&nbsp;73&nbsp;78</code>
<br><code>65&nbsp;78&nbsp;41</code></td>
<td><code class=nopad>FNAME<sub>0</sub></code><span class=ttab></span></td>
<td>Base name for file 0 is "hsxexA".  File name is hsxexA.fa.</td>
</tr>

<tr>
<td><code>0x0000004A</code></td>
<td><code>00&nbsp;66&nbsp;61</code></td>
<td><code class=nopad>FTYPE<sub>1</sub></code><span class=ttab></span></td>
<td>File type for file 1 is "fa".</td>
</tr>

<tr>
<td><code>0x0000004D</code></td>
<td><code>06&nbsp;68&nbsp;73&nbsp;78</code>
<br><code>65&nbsp;78&nbsp;42</code></td>
<td><code class=nopad>FNAME<sub>1</sub></code><span class=ttab></span></td>
<td>Base name for file 1 is "hsxexB".  File name is hsxexB.fa.</td>
</tr>

<tr>
<td><code>0x00000054</code></td>
<td><code>00&nbsp;66&nbsp;61</code></td>
<td><code class=nopad>FTYPE<sub>2</sub></code><span class=ttab></span></td>
<td>File type for file 2 is "fa".</td>
</tr>

<tr>
<td><code>0x00000057</code></td>
<td><code>06&nbsp;68&nbsp;73&nbsp;78</code>
<br><code>65&nbsp;78&nbsp;43</code></td>
<td><code class=nopad>FNAME<sub>2</sub></code><span class=ttab></span></td>
<td>Base name for file 2 is "hsxexC".  File name is hsxexC.fa.</td>
</tr>

<tr>
<td><code>0x0000005E</code></td>
<td><code>00&nbsp;00</code>
<td><code class=nopad>Padding</code><span class=ttab></span></td>
<td></td>
</tr>

<tr class=newsect>
<td><code>0x00000060</code></td>
<td><code>00&nbsp;00&nbsp;00&nbsp;00&nbsp;80</code></td>
<td><code class=nopad>SOFF<sub>H(0)</sub>=80</code><span class=ttab></span></td>
<td>Sequence entries for hash bucket 0 start at 0x00000080.</td>
</tr>

<tr>
<td><code>0x00000060</code></td>
<td><code>00&nbsp;00&nbsp;00&nbsp;00&nbsp;97</code></td>
<td><code class=nopad>SOFF<sub>H(1)</sub>=97</code><span class=ttab></span></td>
<td>Sequence entries for hash bucket 1 start at 0x00000097.</td>
</tr>

<tr>
<td><code>0x00000060</code></td>
<td><code>00&nbsp;00&nbsp;00&nbsp;00&nbsp;C5</code></td>
<td><code class=nopad>SOFF<sub>H(2)</sub>=C5</code><span class=ttab></span></td>
<td>Sequence entries for hash bucket 2 start at 0x000000C5.</td>
</tr>

<tr>
<td><code>0x00000060</code></td>
<td><code>00&nbsp;00&nbsp;00&nbsp;01&nbsp;21</code></td>
<td><code class=nopad>SOFF<sub>H(3)</sub>=121</code><span class=ttab></span></td>
<td>Sequence entries for hash bucket 3 start at 0x00000121.</td>
</tr>

<tr>
<td><code>0x00000060</code></td>
<td><code>00&nbsp;00&nbsp;00&nbsp;01&nbsp;38</code></td>
<td><code class=nopad>SOFF<sub>H(4)</sub>=138</code><span class=ttab></span></td>
<td>Sequence entries for hash bucket 4 start at 0x00000138.</td>
</tr>

<tr>
<td><code>0x00000060</code></td>
<td><code>80&nbsp;00&nbsp;00&nbsp;01&nbsp;94</code></td>
<td><code class=nopad>SOFF<sub>H(5)</sub>=194</code><span class=ttab></span></td>
<td>Sentinel bucket indicates end of sequence entries is at 0x00000194.
<p class=small>The most significant bit of <code class=nopad>SOFF<sub>H(5)</sub></code>
is a 1, indicating the bucket is empty.</td>
</tr>

<tr>
<td><code>0x0000007E</code></td>
<td><code>00&nbsp;00</code>
<td><code class=nopad>Padding</code><span class=ttab></span></td>
<td></td>
</tr>

<tr class=newsect>
<td><code>0x00000080</code></td>
<td><code>00&nbsp;00&nbsp;00&nbsp;00&nbsp;65</code></td>
<td><code class=nopad>IXLEN<sub>0</sub>=65</code><span class=ttab></span></td>
<td>(Start of hash bucket 0)
<br>Sequence 0 is 101 bp.</td>
</tr>

<tr>
<td><code>0x00000085</code></td>
<td><code>01</code></td>
<td><code class=nopad>IXFILE<sub>0</sub>=1</code><span class=ttab></span></td>
<td>Sequence 0 is in file 1 (hsxexB.fa).</td>
</tr>

<tr>
<td><code>0x00000086</code></td>
<td><code>00&nbsp;00&nbsp;00&nbsp;00&nbsp;00&nbsp;00</code></td>
<td><code class=nopad>IXOFF<sub>0</sub>=00</code><span class=ttab></span></td>
<td>Sequence 0 is at file offset 0x0000 00000000.</td>
</tr>

<tr>
<td><code>0x0000008C</code></td>
<td><code>0A&nbsp;48&nbsp;53&nbsp;58</code>
<br><code>45&nbsp;58&nbsp;42&nbsp;5F</code>
<br><code>36&nbsp;59&nbsp;46</code></td>
<td><code class=nopad>IXNAME<sub>0</sub></code><span class=ttab></span></td>
<td>Sequence 0 is named "HSXEXB_6YF".</td>
</tr>





<tr>
<td><code>00000097</code></td>
<td><code>00&nbsp;00&nbsp;00&nbsp;00&nbsp;88</code></td>
<td><code class=nopad>IXLEN<sub>1</sub>=88</code><span class=ttab></span></td>
<td>(Start of hash bucket 1)
<br>Sequence 1 is 136 bp.</td>
</tr>

<tr>
<td><code>0000009C</code></td>
<td><code>00</code></td>
<td><code class=nopad>IXFILE<sub>1</sub>=0</code><span class=ttab></span></td>
<td>Sequence 1 is in file 0 (hsxexA.fa).</td>
</tr>

<tr>
<td><code>0000009D</code></td>
<td><code>00&nbsp;00&nbsp;00&nbsp;00&nbsp;00&nbsp;00</code></td>
<td><code class=nopad>IXOFF<sub>1</sub>=00</code><span class=ttab></span></td>
<td>Sequence 1 is at file offset 0x0000 00000000.</td>
</tr>

<tr>
<td><code>000000A3</code></td>
<td><code>0A&nbsp;48&nbsp;53&nbsp;58</code>
<br><code>45&nbsp;58&nbsp;41&nbsp;5F</code>
<br><code>37&nbsp;38&nbsp;35</code></td>
<td><code class=nopad>IXNAME<sub>1</sub></code><span class=ttab></span></td>
<td>Sequence 1 is named "HSXEXA_785".</td>
</tr>





<tr>
<td><code>000000AE</code></td>
<td><code>00&nbsp;00&nbsp;00&nbsp;00&nbsp;77</code></td>
<td><code class=nopad>IXLEN<sub>2</sub>=77</code><span class=ttab></span></td>
<td>Sequence 2 is 119 bp.</td>
</tr>

<tr>
<td><code>000000B3</code></td>
<td><code>00</code></td>
<td><code class=nopad>IXFILE<sub>2</sub>=0</code><span class=ttab></span></td>
<td>Sequence 2 is in file 0 (hsxexA.fa).</td>
</tr>

<tr>
<td><code>000000B4</code></td>
<td><code>00&nbsp;00&nbsp;00&nbsp;00&nbsp;00&nbsp;E3</code></td>
<td><code class=nopad>IXOFF<sub>2</sub>=E3</code><span class=ttab></span></td>
<td>Sequence 2 is at file offset 0x0000 000000E3.</td>
</tr>

<tr>
<td><code>000000BA</code></td>
<td><code>0A&nbsp;48&nbsp;53&nbsp;58</code>
<br><code>45&nbsp;58&nbsp;41&nbsp;5F</code>
<br><code>44&nbsp;4E&nbsp;51</code></td>
<td><code class=nopad>IXNAME<sub>2</sub></code><span class=ttab></span></td>
<td>Sequence 2 is named "HSXEXA_DNQ".</td>
</tr>





<tr>
<td><code>000000C5</code></td>
<td><code>00&nbsp;00&nbsp;00&nbsp;00&nbsp;3E</code></td>
<td><code class=nopad>IXLEN<sub>3</sub>=3E</code><span class=ttab></span></td>
<td>(Start of hash bucket 2)
<br>Sequence 3 is 62 bp.</td>
</tr>

<tr>
<td><code>000000CA</code></td>
<td><code>00</code></td>
<td><code class=nopad>IXFILE<sub>3</sub>=0</code><span class=ttab></span></td>
<td>Sequence 3 is in file 0 (hsxexA.fa).</td>
</tr>

<tr>
<td><code>000000CB</code></td>
<td><code>00&nbsp;00&nbsp;00&nbsp;00&nbsp;00&nbsp;97</code></td>
<td><code class=nopad>IXOFF<sub>3</sub>=97</code><span class=ttab></span></td>
<td>Sequence 3 is at file offset 0x0000 00000097.</td>
</tr>

<tr>
<td><code>000000D1</code></td>
<td><code>0A&nbsp;48&nbsp;53&nbsp;58</code>
<br><code>45&nbsp;58&nbsp;41&nbsp;5F</code>
<br><code>38&nbsp;38&nbsp;4B</code></td>
<td><code class=nopad>IXNAME<sub>3</sub></code><span class=ttab></span></td>
<td>Sequence 3 is named "HSXEXA_88K".</td>
</tr>





<tr>
<td><code>000000DC</code></td>
<td><code>00&nbsp;00&nbsp;00&nbsp;00&nbsp;5C</code></td>
<td><code class=nopad>IXLEN<sub>4</sub>=5C</code><span class=ttab></span></td>
<td>Sequence 4 is 92 bp.</td>
</tr>

<tr>
<td><code>000000E1</code></td>
<td><code>00</code></td>
<td><code class=nopad>IXFILE<sub>4</sub>=0</code><span class=ttab></span></td>
<td>Sequence 4 is in file 0 (hsxexA.fa).</td>
</tr>

<tr>
<td><code>000000E2</code></td>
<td><code>00&nbsp;00&nbsp;00&nbsp;00&nbsp;01&nbsp;69</code></td>
<td><code class=nopad>IXOFF<sub>4</sub>=169</code><span class=ttab></span></td>
<td>Sequence 4 is at file offset 0x0000 00000169.</td>
</tr>

<tr>
<td><code>000000E8</code></td>
<td><code>0A&nbsp;48&nbsp;53&nbsp;58</code>
<br><code>45&nbsp;58&nbsp;41&nbsp;5F</code>
<br><code>4C&nbsp;52&nbsp;57</code></td>
<td><code class=nopad>IXNAME<sub>4</sub></code><span class=ttab></span></td>
<td>Sequence 4 is named "HSXEXA_LRW".</td>
</tr>





<tr>
<td><code>000000F3</code></td>
<td><code>00&nbsp;00&nbsp;00&nbsp;00&nbsp;60</code></td>
<td><code class=nopad>IXLEN<sub>5</sub>=60</code><span class=ttab></span></td>
<td>Sequence 5 is 96 bp.</td>
</tr>

<tr>
<td><code>000000F8</code></td>
<td><code>01</code></td>
<td><code class=nopad>IXFILE<sub>5</sub>=1</code><span class=ttab></span></td>
<td>Sequence 5 is in file 1 (hsxexB.fa).</td>
</tr>

<tr>
<td><code>000000F9</code></td>
<td><code>00&nbsp;00&nbsp;00&nbsp;00&nbsp;01&nbsp;83</code></td>
<td><code class=nopad>IXOFF<sub>5</sub>=183</code><span class=ttab></span></td>
<td>Sequence 5 is at file offset 0x0000 00000183.</td>
</tr>

<tr>
<td><code>000000FF</code></td>
<td><code>0A&nbsp;48&nbsp;53&nbsp;58</code>
<br><code>45&nbsp;58&nbsp;42&nbsp;5F</code>
<br><code>59&nbsp;56&nbsp;31</code></td>
<td><code class=nopad>IXNAME<sub>5</sub></code><span class=ttab></span></td>
<td>Sequence 5 is named "HSXEXB_YV1".</td>
</tr>





<tr>
<td><code>0000010A</code></td>
<td><code>00&nbsp;00&nbsp;00&nbsp;00&nbsp;72</code></td>
<td><code class=nopad>IXLEN<sub>6</sub>=72</code><span class=ttab></span></td>
<td>Sequence 6 is 130 bp.</td>
</tr>

<tr>
<td><code>0000010F</code></td>
<td><code>02</code></td>
<td><code class=nopad>IXFILE<sub>6</sub>=2</code><span class=ttab></span></td>
<td>Sequence 6 is in file 2 (hsxexC.fa).</td>
</tr>

<tr>
<td><code>00000110</code></td>
<td><code>00&nbsp;00&nbsp;00&nbsp;00&nbsp;00&nbsp;00</code></td>
<td><code class=nopad>IXOFF<sub>6</sub>=0</code><span class=ttab></span></td>
<td>Sequence 6 is at file offset 0x0000 00000000.</td>
</tr>

<tr>
<td><code>00000116</code></td>
<td><code>0A&nbsp;48&nbsp;53&nbsp;58</code>
<br><code>45&nbsp;58&nbsp;43&nbsp;5F</code>
<br><code>34&nbsp;5A&nbsp;4C</code></td>
<td><code class=nopad>IXNAME<sub>6</sub></code><span class=ttab></span></td>
<td>Sequence 6 is named "HSXEXC_4ZL".</td>
</tr>





<tr>
<td><code>00000121</code></td>
<td><code>00&nbsp;00&nbsp;00&nbsp;00&nbsp;6F</code></td>
<td><code class=nopad>IXLEN<sub>7</sub>=6F</code><span class=ttab></span></td>
<td>(Start of hash bucket 3)
<br>Sequence 7 is 111 bp.</td>