| 1 |
//========= |
| 2 |
// Author: Alex Reynolds & Shane Neph |
| 3 |
// Project: starch |
| 4 |
// File: README (test) |
| 5 |
//========= |
| 6 |
|
| 7 |
|
| 8 |
|
| 9 |
Running Tests |
| 10 |
==================================================================================== |
| 11 |
To run all tests, type: |
| 12 |
|
| 13 |
$ make all |
| 14 |
|
| 15 |
Names of individual tests refer to specific test categories and are described below. |
| 16 |
|
| 17 |
NOTE! The /tmp folder is used to store intermediate results. If you are running all |
| 18 |
the tests, please have ~1.7 GB of free space available in your /tmp folder (there |
| 19 |
are several tests performed here, with variations on version and compression formats |
| 20 |
that will result in many copies of the same data -- further, some tests are |
| 21 |
dependent on intermediate results of other tests). |
| 22 |
|
| 23 |
|
| 24 |
|
| 25 |
Clean-up |
| 26 |
==================================================================================== |
| 27 |
To clean the results of all tests, type: |
| 28 |
|
| 29 |
$ make clean |
| 30 |
|
| 31 |
This calls each individual test's clean-up process and removes the parent folder |
| 32 |
that stores test results. |
| 33 |
|
| 34 |
|
| 35 |
|
| 36 |
Overview |
| 37 |
==================================================================================== |
| 38 |
This directory contains the following subdirectories: |
| 39 |
|
| 40 |
. / binaries |
| 41 |
/ compression_and_extraction |
| 42 |
/ concatenation |
| 43 |
/ metadata_integrity |
| 44 |
/ nesteds_and_duplicates |
| 45 |
/ original_data |
| 46 |
/ timing |
| 47 |
/ updating |
| 48 |
|
| 49 |
|
| 50 |
|
| 51 |
Binaries |
| 52 |
==================================================================================== |
| 53 |
To explain the version numbering applied to starch/starchcat/unstarch binaries, we make the |
| 54 |
distinction between "archive version" and "binary version". |
| 55 |
|
| 56 |
The "binary version" value will always be concurrent with the rest of the BEDOPS toolkit. |
| 57 |
As of Nov 20 2017, this is v2.4.30. |
| 58 |
|
| 59 |
The "archive version" value refers to the version of metadata contained within a Starch archive |
| 60 |
file. Different archive versions provide access to different metadata. As of Nov 20 2017, the |
| 61 |
current archive version is v2.2.0. |
| 62 |
|
| 63 |
Starch binaries that can open archives containing v2.2 and older metadata are also called |
| 64 |
"v2.2-metadata" binaries. Similarly, binaries that can open and access v2.1 and older metadata |
| 65 |
properties are called "v2.1-metadata" binaries, and so on. |
| 66 |
|
| 67 |
The "binaries" folder in this test suite contains platform-specific starch binaries. The |
| 68 |
v1.2-metadata binaries are sourced from our old Google Code site. The v1.5-metadata binaries |
| 69 |
were compiled from a private source repository through version edits to starchMetadataHelpers.h. |
| 70 |
The archive-v2.0 binaries were sourced from our Github site (generally the latest version |
| 71 |
that creates a v2.0 Starch archive; on April 30 2014 this would be a v2.4.2 binary release). |
| 72 |
As of Nov 20, 2017 we support v2.2-metadata archives with v2.4.30 binaries. |
| 73 |
|
| 74 |
For architecture, we currently offer tests of 64-bit binaries for Linux and universal ("fat") |
| 75 |
binaries on the OS X platforms. We do not offer Cygwin tests at this time. |
| 76 |
|
| 77 |
|
| 78 |
|
| 79 |
Original Data |
| 80 |
==================================================================================== |
| 81 |
The "original_data" folder contains the "original" BED data that goes into testing the |
| 82 |
functionality of starch, unstarch and starchcat. This consists of a 1M-element BED file |
| 83 |
created from randomly-selected hg19 chromosomes from data obtained via the UCSC Genome |
| 84 |
Browser MySQL service. |
| 85 |
|
| 86 |
This file is roughly 45 Mb in size and should do a decent job in testing how we handle |
| 87 |
streaming input on a typical workstation, because that file size will easily cut across |
| 88 |
the size of the buffers used when handling input, compressing, and extracting data (the |
| 89 |
intermediate buffers used in starch, unstarch and starchcat are "delicate" areas where |
| 90 |
compression, extraction and concatenation can easily go wrong -- having input data go |
| 91 |
over the size of these buffers is a good stress test). |
| 92 |
|
| 93 |
To create a sorted, random BED input file only, without running tests, run: |
| 94 |
|
| 95 |
$ make random_bed_file |
| 96 |
|
| 97 |
Results are in "/tmp/${username}/starch_regression_test/data/random.bed". See the |
| 98 |
"./original_data/src/make_unsorted_random_bed_file.sh" script for more details. |
| 99 |
|
| 100 |
The remaining folders are described below and represent test categories. |
| 101 |
|
| 102 |
|
| 103 |
|
| 104 |
Compression and Extraction |
| 105 |
==================================================================================== |
| 106 |
To ensure backwards compatibility, this tests whether data compressed with (at this |
| 107 |
time, Nov 20 2017, archive version v1.2, v1.5, v2.0, v2.1, and v2.2) starch binaries can |
| 108 |
each be extracted with the versions of unstarch: the version that created the archive, |
| 109 |
and the current version of unstarch (binary v2.4.30). Finally, we use 'diff' to ensure |
| 110 |
that the BED input and extracted output are identical. |
| 111 |
|
| 112 |
To run these tests directly: |
| 113 |
|
| 114 |
$ make compression_and_extraction_tests |
| 115 |
|
| 116 |
|
| 117 |
|
| 118 |
Concatenation |
| 119 |
==================================================================================== |
| 120 |
To ensure that starchcat can concatenate Starch archives, we test the following |
| 121 |
use cases: |
| 122 |
|
| 123 |
* joining two or more Starch files of different versions |
| 124 |
* joining two or more Starch files with disjoint chromosome streams |
| 125 |
* joining two or more Starch files with mixed chromosome streams |
| 126 |
|
| 127 |
For the first test, we start with the different versions of archives created in the |
| 128 |
"compression-and-extraction" test category. The original BED file has 1M elements, so |
| 129 |
we take, say, 200K elements from the first v1.2 archive and recompress them. We take |
| 130 |
the next 200K elements from the next v1.5 archive and recompress those. We take the |
| 131 |
remaining 600K elements from the third, fourth, and fifth archives (v2.0-v2.2, resp.) |
| 132 |
and recompress them. |
| 133 |
|
| 134 |
If we concatenate these smaller archives, we expect that the final archive will |
| 135 |
contain all 1M original elements and in the same sort order. (If there are more, fewer |
| 136 |
or different elements, or if elements are out of order, then this test fails.) |
| 137 |
|
| 138 |
For the second test, we take the random bed file and split it by chromosome into |
| 139 |
separate BED files. We then compress these disjoint BED files into Starch archives |
| 140 |
and concatenate the disjoint archives into one result. We then diff-test the final |
| 141 |
result with the random bed file. |
| 142 |
|
| 143 |
The third test is similar to the first, except that we work within one version of an |
| 144 |
archive. We split the original file into 100K-element subfiles, compress them, and |
| 145 |
attempt to concatenate them. We expect that the final archive will have all 1M original |
| 146 |
elements in preserved order. This test shows that a set of starch files that contain |
| 147 |
records that span multiple chromosomes can be reconstructed correctly. |
| 148 |
|
| 149 |
To run these tests directly: |
| 150 |
|
| 151 |
$ make concatenation_tests |
| 152 |
|
| 153 |
|
| 154 |
|
| 155 |
Metadata Integrity |
| 156 |
==================================================================================== |
| 157 |
We extract the JSON-formatted metadata (with --list-json-no-trailing-newline) from a |
| 158 |
v2.2 archive and create a Base64-encoded SHA-1 hash of that data, using OpenSSL, xxd, |
| 159 |
and base64 command-line utilities. This is compared with the result stored in the |
| 160 |
archive via --sha1-signature. If the hashes are identical, this provides assurance of |
| 161 |
the integrity of the metadata. |
| 162 |
|
| 163 |
Secondly, we review the metadata contents, specifically the per-chromosome element |
| 164 |
count and the overall and unique base counts. We grab a chromosome at random and |
| 165 |
use awk statements to generate "expected" results, which are compared to values |
| 166 |
obtained through per-chromosome <chr> --elements, <chr> --bases and <chr> --bases-uniq |
| 167 |
calls to the Starch archive. We also test all-chromosome results. |
| 168 |
|
| 169 |
To run these tests directly: |
| 170 |
|
| 171 |
$ make metadata_integrity_tests |
| 172 |
|
| 173 |
|
| 174 |
|
| 175 |
Nested and Duplicate Elements |
| 176 |
==================================================================================== |
| 177 |
Starch v2.2 metadata (written by starch/starchcat v2.4.26 or greater, and read by unstarch |
| 178 |
v2.4.26 or greater) include flags that indicate if a nested or duplicate element is located |
| 179 |
in a specified chromosome (or if the chromosome is omitted, if the condition is present |
| 180 |
in any chromosome contained within the archive). Here, we test if a given BED file |
| 181 |
compressed and extracted with v2.4.30 or greater tools display condition flags with |
| 182 |
expected values. |
| 183 |
|
| 184 |
To run these tests directly: |
| 185 |
|
| 186 |
$ make nested_and_duplicate_element_tests |
| 187 |
|
| 188 |
|
| 189 |
|
| 190 |
|
| 191 |
Updating |
| 192 |
==================================================================================== |
| 193 |
Starchcat can also update older archives to current archive version, writing fresh |
| 194 |
metadata in the process. We test whether v1.2, v1.5, v2.0, and v2.1 archives can be |
| 195 |
updated to v2.2 Starch archives. Additionally, we compare extracted BED streams. |
| 196 |
|
| 197 |
To run these tests directly: |
| 198 |
|
| 199 |
$ make updating_tests |
| 200 |
|
| 201 |
|
| 202 |
|
| 203 |
Timing (TBD) |
| 204 |
==================================================================================== |
| 205 |
Here we will provide tests for the amount of time it takes to compress and extract |
| 206 |
archives using the three versions of starch and unstarch. This should give us an idea |
| 207 |
of relative performance improvements (or areas where improvements are needed). The details |
| 208 |
of this test will be available when written. |