[
  {
    "path": ".gitignore",
    "content": "doc/html/\ninkids_rare.bed.gz\ninkids_rare_smaller.bed.gz\n*.o\n**/*_Runner.c\n*.dSYM/\n*.DS_Store\nbin/\nlib/\nssshtest\ntest/**/*.idx\ntest/**/*.dat\n.direnv\n.DS_STORE\n\n# Ignore test/unit build artifacts (compiled binaries and generated runners)\ntest/unit/test_*\n!test/unit/test_*.c\ntest/unit/test_*_Runner.c\n"
  },
  {
    "path": ".nojekyll",
    "content": ""
  },
  {
    "path": ".travis.yml",
    "content": "language: c\n\nbefore_install:\n    - cd $TRAVIS_BUILD_DIR\n    - git clone https://github.com/arq5x/bedtools2.git\n    - cd bedtools2\n    - make\n    - cd bin\n    - export PATH=$PATH:`pwd`\n    - cd $TRAVIS_BUILD_DIR\n    - git clone https://github.com/samtools/htslib.git\n    - cd htslib\n    - pwd\n    - autoheader\n    - autoconf\n    - ./configure --disable-bz2 --disable-lzma --enable-libcurl\n    - make\n    - cd $TRAVIS_BUILD_DIR\n\nscript:\n    - cd test/unit/\n    - make\n    - cd $TRAVIS_BUILD_DIR\n    - make\n    - cd $TRAVIS_BUILD_DIR\n    - cd test/func/\n    - ./giggle_tests.sh\n"
  },
  {
    "path": "LICENSE",
    "content": "MIT License\n\nCopyright (c) 2021 Ryan Layer\n\nPermission is hereby granted, free of charge, to any person obtaining a copy\nof this software and associated documentation files (the \"Software\"), to deal\nin the Software without restriction, including without limitation the rights\nto use, copy, modify, merge, publish, distribute, sublicense, and/or sell\ncopies of the Software, and to permit persons to whom the Software is\nfurnished to do so, subject to the following conditions:\n\nThe above copyright notice and this permission notice shall be included in all\ncopies or substantial portions of the Software.\n\nTHE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\nIMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\nFITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\nAUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\nLIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\nOUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\nSOFTWARE.\n"
  },
  {
    "path": "Makefile",
    "content": "BIN=bin\nOBJ=obj\n\nall:\n\t@mkdir -p $(OBJ)\n\t@mkdir -p $(BIN)\n\t@mkdir -p lib\n\tcd src; $(MAKE)\n\nserver:\n\t@mkdir -p $(OBJ)\n\t@mkdir -p $(BIN)\n\tcd src; $(MAKE) server\n\nclean:\n\trm -rf $(BIN)/*\n\trm -rf $(OBJ)/*\n\trm -rf lib/*\n"
  },
  {
    "path": "README.md",
    "content": "<img src=\"https://raw.githubusercontent.com/ryanlayer/giggle/master/img/logo.png\" width=\"300\"/>\n\nGIGGLE is a genomics search engine that identifies and ranks the significance of shared genomic loci between query features and thousands of genome interval files.\n\n- [Nature Methods paper](https://www.nature.com/articles/nmeth.4556)\n- [Mailing list](https://groups.google.com/d/forum/giggle-discuss)\n- [Video presentation (14m)](https://www.youtube.com/watch?v=yw8H7PhtZoA)\n\n## Quickstart\n\n### Install\n\nClone,\n\n```bash\ngit clone https://github.com/ryanlayer/giggle.git\ncd giggle\n```\n\nThen choose one of the following methods:\n\n**Conda/Mamba**\n\n```bash\nmamba env create -f environment.yml\nmamba activate giggle-dev\nexport HTS_INC=$CONDA_PREFIX/include\nexport HTS_LIB=$CONDA_PREFIX/lib\n```\n\n**Nix**\n\n```bash\nnix develop\n```\n\n**Ubuntu/Debian**\n\n```bash\nsudo apt-get install gcc make zlib1g-dev libssl-dev libhts-dev\nexport HTS_INC=/usr/include\nexport HTS_LIB=/usr/lib\n```\n\n### Build\n\n```bash\nmake\n```\n\n### Basic Example\n\n```bash\n# Create some test data\nmkdir -p example/beds && cd example\n\n# Download and prepare a small dataset\ncurl -s \"http://hgdownload.soe.ucsc.edu/goldenPath/hg19/database/microsat.txt.gz\" \\\n    | gunzip -c | cut -f 2,3,4 | sort -k1,1 -k2,2n | bgzip > beds/microsat.bed.gz\n\ncurl -s \"http://hgdownload.soe.ucsc.edu/goldenPath/hg19/database/simpleRepeat.txt.gz\" \\\n    | gunzip -c | cut -f 2,3,4 | sort -k1,1 -k2,2n | bgzip > beds/simpleRepeat.bed.gz\n\n# Index the files\ngiggle index -i \"beds/*.bed.gz\" -o my_index -s -f\n\n# Search a region\ngiggle search -i my_index -r chr1:1000000-2000000\n\n# Search with full record output\ngiggle search -i my_index -r chr1:1000000-2000000 -v\n```\n\n## Usage\n\nGIGGLE has two main commands: `index` and `search`.\n\n### Indexing\n\n```\ngiggle index -i <input files> -o <output dir> -f\n    -i  Files to index (e.g. \"data/*.gz\")\n    -o  Index output directory\n    -s  Files are sorted (faster indexing)\n    -f  Force reindex if output directory exists\n    -m  Metadata config file (see experiments/metadata_index_query_filter)\n```\n\n**Note:** Input files must be bgzipped BED or VCF files.\n\n### Searching\n\n```\ngiggle search -i <index directory> [options]\n    -i  GIGGLE index directory\n    -r  Region(s) to search (e.g. \"chr1:1000-2000\" or CSV \"chr1:1-100,chr2:1-100\")\n    -q  Query file (bgzipped BED or VCF)\n    -c  Show counts by indexed file\n    -s  Show significance statistics (requires -q)\n    -v  Show full matching records\n    -o  Group results by query record (use with -v)\n    -f  Filter to files matching pattern (regex CSV)\n    -g  Genome size for significance testing (default: 3095677412)\n    -l  List files in the index\n    -m  Load metadata index\n    -u  Apply query filter\n```\n\n### Search Examples\n\n**Count overlaps per file:**\n\n```bash\ngiggle search -i my_index -r chr1:1000000-2000000\n# Output:\n# #microsat.bed.gz    size:41572  overlaps:5\n# #simpleRepeat.bed.gz    size:962714 overlaps:23\n```\n\n**Get full records:**\n\n```bash\ngiggle search -i my_index -r chr1:1000000-2000000 -v\n```\n\n**Filter to specific files:**\n\n```bash\ngiggle search -i my_index -r chr1:1000000-2000000 -f \"simple\"\n```\n\n**Statistical analysis with query file:**\n\n```bash\ngiggle search -i my_index -q query.bed.gz -s\n# Output includes: odds_ratio, Fisher's tests, combo_score\n```\n\n**Group results by query interval:**\n\n```bash\ngiggle search -i my_index -q query.bed.gz -v -o\n```\n\n## Testing\n\n### Unit Tests\n\n```bash\ncd test/unit && make\n```\n\n### Functional Tests\n\nRequires `bedtools` in PATH.\n\n```bash\n# you may need to up the ulimit on some systems\n# ulimit -n 1300\ncd test/func && ./giggle_tests.sh\n```\n\n## Example Analysis: Roadmap Epigenomics\n\n```bash\n# Download pre-built index\nwget https://s3.amazonaws.com/layerlab/giggle/roadmap/roadmap_sort.tar.gz\ntar -zxvf roadmap_sort.tar.gz\n\n# Build index (if \"Too many open files\": ulimit -Sn 16384)\ngiggle index -s -f -i \"roadmap_sort/*gz\" -o roadmap_sort_b\n\n# Download query data\nwget ftp://ftp.ncbi.nlm.nih.gov/geo/samples/GSM1218nnn/GSM1218850/suppl/GSM1218850_MB135DMMD.peak.txt.gz\n\n# Filter to top peaks\nzcat GSM1218850_MB135DMMD.peak.txt.gz \\\n    | awk '$8>100' \\\n    | cut -f1,2,3 \\\n    | bgzip -c > query.bed.gz\n\n# Search with significance\ngiggle search -s -i roadmap_sort_b/ -q query.bed.gz > results.txt\n```\n\n## Hosted Data\n\nPre-built indexes available for download:\n\n- **Roadmap Epigenomics:** https://s3.amazonaws.com/layerlab/giggle/roadmap/roadmap_sort.tar.gz\n- **UCSC Genome Browser:** https://s3.amazonaws.com/layerlab/giggle/ucsc/ucscweb_sort.tar.gz\n- **FANTOM5:** https://s3.amazonaws.com/layerlab/giggle/fantom/fantom_sort.tar.gz\n\nInteractive heatmap: http://ryanlayer.github.io/giggle/\n\n## Web Server (Optional)\n\nGIGGLE can run as a web service using [libmicrohttpd](http://www.gnu.org/software/libmicrohttpd/).\n\n```bash\n# Install dependencies\nmkdir -p $HOME/usr/local/\n\n# libmicrohttpd\nwget http://ftpmirror.gnu.org/libmicrohttpd/libmicrohttpd-0.9.46.tar.gz\ntar zxvf libmicrohttpd-0.9.46.tar.gz\ncd libmicrohttpd-0.9.46\n./configure --prefix=$HOME/usr/local/ && make && make install\ncd ..\n\n# json-c\nwget https://github.com/json-c/json-c/archive/json-c-0.12.1-20160607.tar.gz\ntar xvf json-c-0.12.1-20160607.tar.gz\ncd json-c-json-c-0.12.1-20160607\n./configure --prefix=$HOME/usr/local/ && make && make install\ncd ..\n\nexport LD_LIBRARY_PATH=$HOME/usr/local/lib/\n\n# Build server\ncd giggle\nmake server\n```\n\n**Run servers:**\n\n```bash\ngiggle/bin/server_enrichment -i roadmap_sort_b/ -u /tmp/ \\\n    -d giggle/examples/rme/data_def.json -p 8080 &\n\ngiggle/bin/server_enrichment -i ucscweb_sort_b/ -u /tmp/ \\\n    -d giggle/examples/ucsc/data_def.json -p 8081 &\n\n# Access at:\n# http://ryanlayer.github.io/giggle/?primary_index=localhost:8080&ucsc_index=localhost:8081\n```\n\n## Language Bindings\n\n> **Note:** These community-maintained bindings may be outdated.\n\n### Python\n\n[python-giggle](https://github.com/brentp/python-giggle) by Brent Pedersen\n\n```python\nfrom giggle import Giggle\n\nindex = Giggle('my-index')  # or Giggle.create('new-index', 'files/*.bed')\nprint(index.files)\n\nresult = index.query('chr1', 9999, 20000)\nprint(result.n_total_hits)\n\nfor hit in result[0]:\n    print(hit)\n```\n\n**Installation:**\n\n```bash\n# Requires: zlib, libcurl, libcrypto, libbz2, liblzma\ngit clone --recursive https://github.com/brentp/python-giggle\ncd python-giggle\npython setup.py install\n```\n\n### Go\n\n[go-giggle](https://github.com/brentp/go-giggle) by Brent Pedersen\n[![GoDoc](https://godoc.org/github.com/brentp/go-giggle?status.png)](https://godoc.org/github.com/brentp/go-giggle)\n\n```go\nimport giggle \"github.com/brentp/go-giggle\"\n\nindex := giggle.Open(\"/path/to/index\")\nres := index.Query(\"1\", 565657, 567999)\n\nindex.Files()      // all files in index\nres.TotalHits()    // total count\nres.Hits()         // []uint32 hits per file\nres.Of(0)          // []string results from first file\n```\n\n## Containers\n\n### Docker\n\n[giggle-docker](https://github.com/kubor/giggle-docker) by Ryuichi Kubo\n\n```bash\ndocker run kubor/giggle-docker giggle -h\n```\n\n### Singularity\n\n[giggle-singularity](https://github.com/HugoGuillen/giggle-singularity) by Hugo Guillen\n\n```bash\ngiggle.sh check   # verify configuration\ngiggle.sh pull    # create container\ngiggle.sh index   # create an index\ngiggle.sh search  # search an index\n```\n"
  },
  {
    "path": "client/app.js",
    "content": "var heatmap = null;\n\nvar giggleUrl            = \"http://localhost:8080/\";\nvar giggleUCSCBrowserUrl = \"http://localhost:8081/\";\nvar ucscBrowserUrl       = \"https://genome.ucsc.edu/cgi-bin/hgTracks?db=hg19\";\n\nvar sourceFileMap = {};\t\nvar coordMap = {};\nvar def = null;\nvar dataForChart = null;\nvar valueField = \"overlaps\";\n\nvar uploadedFileName = null;\n\nvar ucscFileMap = {};\nvar ucscTrackNames = [];\n\n$.urlParam = function(name){\n    var results = new RegExp('[\\?&]' + name + '=([^&#]*)').exec(window.location.href);\n    if (results==null){\n        return null;\n    }else{\n        return results[1] || 0;\n    }\n}\n\n$(document).ready(function() {\n        if (decodeURIComponent($.urlParam('primary_index')) != 'null') {\n           giggleUrl = \"http://\" + decodeURIComponent($.urlParam('primary_index'));\n        } \n\n        if (decodeURIComponent($.urlParam('ucsc_index')) != 'null') {\n           giggleUCSCBrowserUrl = \"http://\" + decodeURIComponent($.urlParam('ucsc_index'));\n        } \n\n\n\t$.material.init();\n\n\t$('#giggle-url').val(giggleUrl);\n\t$('#giggle-tracks-url').val(giggleUCSCBrowserUrl);\n\n\tinitBedUploadForm();\n\n\tpromiseLoadMatrixDefinition().then( function() {\n\t\theatmap = new heatmapD3().cellSize(15)\n\t                             .legendCellSize(20)\n\t                             .margin({top: 10, bottom: 10, left: 10, right: 70})\n\t                             .colors(colorbrewer.YlGnBu[9])\n\t                             //.colors(colorbrewer.Oranges[9]);\n\t                             .cellValue( function(d) { return +d[valueField]; } )\n\t                             .on('d3click', function(d,i) {\n\t                             \tloadOverlapDetail(d.name, d.row, d.col);\n\t                             });\n\n\n\t\tloadHeatmapForRegion();\n\n\t});\n\n        loadUCSCDefinition();\n});\n\nfunction loadUCSCSmartView() {\n\n    \tif ($('#overlaps').val() == null || $('#overlaps').val().trim() == \"\") {\n\t\t$('#no-region-warning').removeClass(\"hide\");\n\t\treturn;\n\t}\n\n\tvar giggleTracksUrl = giggleUCSCBrowserUrl + \"?region=\" + $('#overlaps').val();\n\n\t$.ajax({\n\t    url: giggleTracksUrl,\n\t    type: \"GET\",\n\t    crossDomain: true,\n\t    dataType: \"text\",\n\t    success: function(data) {\n\t    \tvar records = [];\n\t\t\tdata.split(\"\\n\").forEach(function(row) {\n\t\t\t\tif (row == null || row.trim() == \"\") {\n\n\t\t\t\t} else {\n\t\t\t\t\tfields = row.split(\"\\t\");\n\n\t\t\t\t\t\n\t\t\t\t\tvar rec = {};\n\t\t\t\t\trec.name     = fields[0].split(\"/\")[1];\n\t\t\t\t\trec.size     = fields[1];\n\t\t\t\t\trec.overlaps = fields[2];\n\n\t\t\t\t\tvar pos      = ucscFileMap[rec.name];\n\t\t\t\t\trec.pos      = pos;\n\t\t\t\t\trec.trackName = ucscTrackNames[+pos];\n\t\t\t\t\trecords.push(rec);\n\n\t\t\t\t}\n\t\t\t});\n\n\t\t\t//var ucscTracksUrl = ucscBrowserUrl + '&position=' + chr + \":\" + start + '-' + end;\n\t\t\tvar ucscTracksUrl = ucscBrowserUrl + '&position=' + $('#overlaps').val();\n\t\t\trecords.forEach( function(record) {\n                                if (record.trackName) {\n\t\t\t\t    if (+record.overlaps > 0) {\n\t\t\t\t\t    ucscTracksUrl += \"&\" + record.trackName + \"=dense\";\n\t\t\t\t    } else {\n\t\t\t\t\t    ucscTracksUrl += \"&\" + record.trackName + \"=hide\";\n                                    }\n                                }\n\t\t\t});\n\t\t\tvar newTab = window.open(ucscTracksUrl, '_blank');\n\t\t\t//newTab.focus();\n\t    },\n\t    error: function(error) {\n\t    \tconsole.log(\"An error occurred when getting UCSC track info \" + giggleTracksUrl);\n\t    \tconsole.error();\n\t    }\n\t});\n\n//function loadUCSCTracks(chr, start, end) {\n}\n\nfunction loadUCSCDefinition() {\n\n\tvar giggleTracksDefUrl = giggleUCSCBrowserUrl + \"?data\";\n\n\t$.ajax({\n\t    url: giggleTracksDefUrl,\n\t    type: \"GET\",\n\t    crossDomain: true,\n\t    dataType: \"text\",\n\t    success: function(data) {\n\n\t    \tvar def = JSON.parse(data);\n\t\t\tdef.sourceFiles.forEach( function( sourceFile ) {\n\t\t\t\tvar fileName = sourceFile.name.split(\"/\")[1];\n\t\t\t\tucscFileMap[fileName] = sourceFile.position[0];\n\t\t\t});\n\n\t\t\tdef.dimensions[0].elements.forEach( function(trackName) {\n\t\t\t\tucscTrackNames.push(trackName);\n\t\t\t})\n\t\t\t\n\n\t\t},\n\t    error: function(error) {\n\t    \tconsole.error;\n\t    }\n\t});\t\n\n}\n\nfunction loadUCSCTracks(chr, start, end) {\n\tvar giggleTracksUrl = giggleUCSCBrowserUrl + \"?region=\" + chr + \":\" + start + '-' + end;\n\t$.ajax({\n\t    url: giggleTracksUrl,\n\t    type: \"GET\",\n\t    crossDomain: true,\n\t    dataType: \"text\",\n\t    success: function(data) {\n\t    \tvar records = [];\n\t\t\tdata.split(\"\\n\").forEach(function(row) {\n\t\t\t\tif (row == null || row.trim() == \"\") {\n\n\t\t\t\t} else {\n\t\t\t\t\tfields = row.split(\"\\t\");\n\t\t\t\t\t\n\t\t\t\t\tvar rec = {};\n\t\t\t\t\trec.name     = fields[0].split(\"/\")[1];\n\t\t\t\t\trec.size     = fields[1];\n\t\t\t\t\trec.overlaps = fields[2];\n\n\t\t\t\t\tvar pos      = ucscFileMap[rec.name];\n\t\t\t\t\trec.pos      = pos;\n\t\t\t\t\trec.trackName = ucscTrackNames[+pos];\n\t\t\t\t\trecords.push(rec);\n\n\t\t\t\t}\n\t\t\t});\n\n\t\t\tvar ucscTracksUrl = ucscBrowserUrl + '&position=' + chr + \":\" + start + '-' + end;\n\t\t\trecords.forEach( function(record) {\n\t\t\t\tif (+record.overlaps > 0) {\n\t\t\t\t\tucscTracksUrl += \"&\" + record.trackName + \"=dense\";\n\t\t\t\t} else {\n\t\t\t\t\t    ucscTracksUrl += \"&\" + record.trackName + \"=hide\";\n                                }\n\t\t\t});\n\t\t\tvar newTab = window.open(ucscTracksUrl, '_blank');\n\t\t\t//newTab.focus();\n\n\n\n\n\t    },\n\t    error: function(error) {\n\t    \tconsole.log(\"An error occurred when getting UCSC track info \" + giggleTracksUrl);\n\t    \tconsole.error();\n\t    }\n\t});\n}\n\n\nfunction loadOverlapDetail(fileName, row, col) {\n\tvar rowLabel = coordMap[row + '-' + col].rowLabel;\n\tvar colLabel = coordMap[row + '-' + col].colLabel;\n\n\tvar detailUrl = giggleUrl;\n\tif (uploadedFileName) {\n\t\tdetailUrl += \"?query=\" + uploadedFileName;\n\t} else {\n\t\tdetailUrl += \"?region=\" + $('#overlaps').val();\n\t}\n\tdetailUrl += \"&files=\" + fileName + \"&full\";\n\t$.ajax({\n\t    url: detailUrl,\n\t    type: \"GET\",\n\t    crossDomain: true,\n\t    dataType: \"text\",\n\t    success: function(data) {\n\t    \tvar results = [];\n\t    \tvar header = null;\n\t    \tvar records = [];\n\t\t\tdata.split(\"\\n\").forEach(function(row) {\n\t\t\t\tif (row == null || row.trim() == \"\") {\n\n\t\t\t\t} else {\n\t\t\t\t\tfields = row.split(\"\\t\");\n\t\t\t\t\tif (row.indexOf(\"#\") == 0) {\n\t\t\t\t\t\tif (header) {\n\t\t\t\t\t\t\tresults.push({'header': header, 'rows': records});\n\t\t\t\t\t\t\trecs = [];\n\t\t\t\t\t\t}\n\t\t\t\t\t\theader = {};\n\t\t\t\t\t\theader.name = fields[0].split(\"/\")[1];\n\t\t\t\t\t\theader.size = fields[1];\n\t\t\t\t\t\theader.overlaps = fields[2];\n\t\t\t\t\t} else {\n\t\t\t\t\t\tvar rec = {};\n\t\t\t\t\t\trec.chr   = fields[0];\n\t\t\t\t\t\trec.start = fields[1];\n\t\t\t\t\t\trec.end   = fields[2];\n\t\t\t\t\t\trecords.push(rec);\n\t\t\t\t\t}\n\n\t\t\t\t}\n\t\t\t});\n\t\t\tif (header) {\t\t\t\t\n\t\t\t\tresults.push({'header': header, 'rows': records});\n\t\t\t}\n\t\t\t$('#overlaps-modal .modal-header').html(\"<h5>\" + rowLabel + \"  -  \" + colLabel + \"</h5>\");\n\t\t\t$('#overlaps-modal .modal-body').html(\"\");\n\n\t\t\tresults.forEach(function(result) {\n\t\t\t\tvar content = \"\";\n\t\t\t\tcontent += \"<table style='width:100%'>\";\n\t\t\t\t\n\t\t\t\tvar rowNbr = 1;\n\t\t\t\tresult.rows.forEach( function(row) {\n\t\t\t\t\tcontent += \n\t\t\t\t\t\t \"<tr>\" \n\t\t\t\t\t\t+   \"<td>\" + rowNbr++ + \".</td>\"\n\t\t\t\t\t\t+ \"<td>\" + \"<a href='javascript:void(0)' onclick=\\\"loadUCSCTracks(\" + \"'\" + row.chr + \"',\" + row.start + ',' + row.end + \")\\\">\" +row.chr + ' ' + addCommas(row.start) + '-' +  addCommas(row.end) + \"</a></td>\"\n\t\t\t\t\t    + \"</tr>\";\n\t\t\t\t});\n\t\t\t\tcontent += \"</table>\";\n\t\t\t\t$('#overlaps-modal .modal-body').append(content);\n\t\t\t});\n\n\n\n\t\t\t$('#overlaps-modal').modal('show');\n\t\t\t\n\t\t  \n\n\t    },\n\t    error: function(error) {\n\t    \tconsole.log(\"An error occurred when getting overlap detail \" + detailUrl);\n\t    \tconsole.error();\n\t    }\n\t});\t\n\n}\n\n\nfunction promiseLoadMatrixDefinition() {\n\treturn new Promise( function(resolve, reject) {\n\t\tvar defUrl  = giggleUrl + \"?data\";\n\t\tdef = null;\n\t\tsourceFileMap = {};\t\n\n\t\t// Get matrix definition\n\t\t$.ajax({\n\t\t    url: defUrl,\n\t\t    type: \"GET\",\n\t\t    crossDomain: true,\n\t\t    dataType: \"text\",\n\t\t    success: function(data) {\n\t\t    \tdef = JSON.parse(data);\n\t\t\t\tdef.sourceFiles.forEach( function( sourceFile ) {\n\t\t\t\t\tvar cellCoord = {};\n\t\t\t\t\tcellCoord.row = sourceFile.position[0];\n\t\t\t\t\tcellCoord.col = sourceFile.position[1];\n\t\t\t\t\tsourceFileMap[sourceFile.name] = cellCoord;\n\t\t\t\t\tcoordMap[cellCoord.row + \"-\" + cellCoord.col] = {rowLabel: def.dimensions[0].elements[cellCoord.row], colLabel: def.dimensions[1].elements[cellCoord.col]};\n\t\t\t\t});\n\t\t\t\tdef.cells = [];\n\t\t\t\tresolve(def);\n\n\t\t\t},\n\t\t    error: function(error) {\n\t\t    \tconsole.error();\n\t\t    \treject('Unable to get matrix definition ' + error);\n\t\t    }\n\t\t});\n\n\t});\n}\n\nfunction initBedUploadForm() {\n\n\n\t$('#bed-upload-form').submit( function(e){\n\t\te.preventDefault();\n\n\t\t$(\".input-panel\").removeClass(\"selected\");\n\n\t\t// Validate that file was uploaded\n\t\t$('.alert').addClass(\"hide\");\n\t\tif ($('#bed-upload-form input[type=file]')[0].files.length == 0) {\n\t\t\t$('#no-file-warning').removeClass(\"hide\");\t\t\n\t\t\treturn;\t\n\t\t}\n\n\t\tuploadedFileName =  $('#bed-upload-form input[type=file]')[0].files[0].name;\n\n\t\t// Enable odds ratio and default as checked\n\t\t//$(\"#radio-value-ratio\").prop(\"checked\", true);\n\t\t//$(\"#radio-value-ratio-span\").removeClass(\"hide\");\n\t\t$(\"#radio-value-combo\").prop(\"checked\", true);\n\t\t$(\"#radio-value-combo-span\").removeClass(\"hide\");\n\n\t\t// Highlight upload panel\n\t\t$(\"#upload-panel\").addClass(\"selected\");\n\n\t\t// Show loading gif\n\t\t$('.loader').removeClass(\"hide\");\n\n\n\t    \n\t    var formData = new FormData(this);\n\t\t//formData.append(uploadedFileName, $('#bed-upload-form input[type=file]')[0].files[0]);\n\t    \n\t    getGiggleUrls();\n\n\t    var url = giggleUrl + \"filepost\";\n\n\t    $.ajax({\n\t        url         : url,\n\t        data        : formData,\n \t        cache       : false,\n\t        contentType : false,\n\t        processData : false,\n\t        type        : 'POST',\n\t        success     : function(data, textStatus, jqXHR){\n\t            $('.loader').addClass(\"hide\");\n\t            loadHeatmapChart(data, def);\n\t        },\n\t        error       : function(error) {\n                    $('.loader').addClass(\"hide\");\n                    if (error.success().hasOwnProperty(\"responseText\") && error.success().responseText.length > 0) {\n                        loadHeatmapChart( error.success().responseText, def);\n                    }\n                    console.error();      \t\n\t        }\n\t    });\n\t});\t\n}\n\nfunction getGiggleUrls() {\n\tgiggleUrl = $('#giggle-url').val();\n\tgiggleUCSCBrowserUrl = $('#giggle-tracks-url').val();\n\n\tgiggleUrl += '/'\n\tgiggleUCSCBrowserUrl += '/'\n}\n\n\nfunction loadHeatmapForRegion() {\n\t$(\".input-panel\").removeClass(\"selected\");\n\n\t// Validate that region was filled in\n\t$('.alert').addClass(\"hide\");\n\tif ($('#overlaps').val() == null || $('#overlaps').val().trim() == \"\") {\n\t\t$('#no-region-warning').removeClass(\"hide\");\n\t\treturn;\n\t}\n\n\t// Switch to 'overlap' and disable 'odds ratio'\n\t$(\"#radio-value-overlaps\").prop(\"checked\", true);\n\t$(\"#radio-value-ratio-span\").addClass(\"hide\");\n\n\t// Highlight region panel\n\t$(\"#region-panel\").addClass(\"selected\");\n\n\n\t// Show loading animation\n\t$('.loader').removeClass(\"hide\");\n\n\n\tgetGiggleUrls();\n\tvar dataUrl = giggleUrl + \"?region=\" + $('#overlaps').val();\n\n\tuploadedFileName = null;\n\n\t// get matrix data (tab delimited) and fill in heatmap\n\t$.ajax({\n\t    url: dataUrl,\n\t    type: \"GET\",\n\t    crossDomain: true,\n\t    dataType: \"text\",\n\t    success: function(data) {\n\t        $('.loader').addClass(\"hide\");\n\t    \tloadHeatmapChart(data, def);\n\n\t    },\n\t    error: function(error) {\n\t    \t$('.loader').addClass(\"hide\");\n\t    }\n\t});\n\n}\n\nfunction loadHeatmapChart(data, theDef) {\n\tdef = theDef ? theDef : def; \n\tdataForChart = data ? data : dataForChart;\n\tdef.cells = [];\n\n\tif($(\"input[type='radio'].radio-value-field\").is(':checked')) {\n    \tvalueField = $(\"input[type='radio'].radio-value-field:checked\").val();    \t\n\t}\n\n\tdataForChart.split(\"\\n\").forEach(function(row) {\n\t\tfields = row.split(\"\\t\");\n                if (fields[0] == \"QueryFileError\") {\n                    $('#bad-file-warning').removeClass(\"hide\");\t\t\n\t            return;\t\n                }\n\n\t\tif (fields.length == 0 || fields[0] == \"\") {\n                    \n\t\t} else {\n\t\t\tvar rec = {};\n\t\t\trec.name = fields[0].split(\"/\")[1];\n\t\t\trec.size = fields[1];\n\t\t\tvar overlaps = fields[2];\n\t\t\tif (overlaps.indexOf(\":\") > 0) {\n\t\t\t\trec.overlaps = overlaps.split(\":\")[1];\n\t\t\t} else {\n\t\t\t\trec.overlaps = overlaps;\n\t\t\t}\n\t\t\tif (fields.length > 3) {\n\t\t\t\tvar ratio = fields[3];\n\t\t\t\tif (ratio.indexOf(\":\") > 0) {\n\t\t\t\t\trec.ratio = ratio.split(\":\")[1];\n\t\t\t\t} else {\n\t\t\t\t\trec.ratio = ratio;\n\t\t\t\t}\t\t\t\t\n\t\t\t}\n\t\t\tif (fields.length > 4) {\n\t\t\t\tvar sig = fields[4];\n\t\t\t\tif (sig.indexOf(\":\") > 0) {\n\t\t\t\t\trec.sig = sig.split(\":\")[1];\n\t\t\t\t} else {\n\t\t\t\t\trec.sig = sig;\n\t\t\t\t}\t\n\t\t\t\trec.sig = rec.sig * 100;\t\t\t\n\t\t\t}\n\t\t\tif (fields.length > 5) {\n\t\t\t\tvar combo = fields[5];\n\t\t\t\tif (combo.indexOf(\":\") > 0) {\n\t\t\t\t\trec.combo = combo.split(\":\")[1];\n\t\t\t\t} else {\n\t\t\t\t\trec.combo = combo;\n\t\t\t\t}\t\n\t\t\t}\n\n\t\t\trec.row = sourceFileMap[rec.name].row;\n\t\t\trec.col = sourceFileMap[rec.name].col;\n\t\t\tdef.cells.push(rec);\n\t\t}\n\t});\n\n        if ( def.cells.length > 0) {\n            maxValue = d3.max(def.cells, function(d,i) {return d.overlaps});\n            if (maxValue <= 2) {\n                    maxValue = 3;\n            }\n            heatmap.colors(colorbrewer.YlGnBu[Math.min(maxValue, 9)])\n\n            \n            var selection = d3.select(\"#chart\").datum(def);\n            heatmap(selection);\t\n        }\n}\n\nfunction addCommas(nStr)\n{\n\tnStr += '';\n\tx = nStr.split('.');\n\tx1 = x[0];\n\tx2 = x.length > 1 ? '.' + x[1] : '';\n\tvar rgx = /(\\d+)(\\d{3})/;\n\twhile (rgx.test(x1)) {\n\t\tx1 = x1.replace(rgx, '$1' + ',' + '$2');\n\t}\n\treturn x1 + x2;\n}\n"
  },
  {
    "path": "client/assets/css/site.css",
    "content": "body {\n  font-family: 'Open Sans';\n  background-color: white;\n  color:  #757474;\n  font-size: 13px;\n}\nh3 {\n  margin-top: 5px;\n  margin-bottom: 3px;  \n}\nh4 {\n  text-align: center;\n  margin-bottom: 0px;  \n}\n.rowLabel, .colLabel, .legendLabel {\n  font-size:11px;\n  fill: #757474;\n}\nrect.bordered {\n  stroke: #E6E6E6;\n  stroke-width:2px;   \n}\n.checkbox label, .radio label, label {\n  color: #757474;\n  font-size: 13px;\n}\n.radio-value-field.radio label span {\n  left: 25px;\n}\n#go-button {\n  font-size: 13px;\n  padding-bottom: 5px;\n  padding-top: 5px;\n  margin-top: 0px;        \n}\n#upload-button {\n  font-size: 13px;\n  padding-bottom: 5px;\n  padding-top: 5px;\n  margin-top: 0px;        \n}\n#control-panel {\n  margin-top:0px;\n}\n#overlaps {\n  width: 200px;\n}\nlabel {\n  width: 80px !important;\n}\n.radio-value-field label {\n  width: 100% !important;\n}\n.form-control {\n  font-size: 13px !important;\n}\n::-webkit-input-placeholder {\n   font-size: 13px !important;\n} \n.checkbox, .radio {\n  margin-top: 0px;\n}\ninput#giggle-url {\n  width: 300px !important;\n}\ninput#giggle-tracks-url {\n  width: 300px !important;\n}\n#region-panel {\n  padding: 3px;\n}\n#upload-panel {\n  padding: 3px;\n}\n.selected {\n  background-color: #fffad5;\n}\n.alert.alert-info {\n    background-color: #569ca0;\n    color: white;\n    margin-top: 3px;\n}"
  },
  {
    "path": "client/assets/css/tetronimos.css",
    "content": ".cssload-tetrominos {\n  position: absolute;\n  left: 50%;\n  transform: translate(-62px, -53px);\n    -o-transform: translate(-62px, -53px);\n    -ms-transform: translate(-62px, -53px);\n    -webkit-transform: translate(-62px, -53px);\n    -moz-transform: translate(-62px, -53px);\n}\n\n.cssload-tetromino {\n  width: 53px;\n  height: 62px;\n  position: absolute;\n  transition: all ease 0.255s;\n    -o-transition: all ease 0.255s;\n    -ms-transition: all ease 0.255s;\n    -webkit-transition: all ease 0.255s;\n    -moz-transition: all ease 0.255s;\n  background: url('data:image/svg+xml;utf-8,%3Csvg xmlns=\"http://www.w3.org/2000/svg\" viewBox=\"0 0 612 684\"%3E%3Cpath fill=\"rgba(29, 145, 192, .8)\" d=\"M305.7 0L0 170.9v342.3L305.7 684 612 513.2V170.9L305.7 0z\"/%3E%3Cpath fill=\"rgb(127, 205, 187)\" d=\"M305.7 80.1l-233.6 131 233.6 131 234.2-131-234.2-131\"/%3E%3C/svg%3E') no-repeat top center;\n}\n\n.cssload-box1 {\n  animation: cssload-tetromino1 1.275s ease-out infinite;\n    -o-animation: cssload-tetromino1 1.275s ease-out infinite;\n    -ms-animation: cssload-tetromino1 1.275s ease-out infinite;\n    -webkit-animation: cssload-tetromino1 1.275s ease-out infinite;\n    -moz-animation: cssload-tetromino1 1.275s ease-out infinite;\n}\n\n.cssload-box2 {\n  animation: cssload-tetromino2 1.275s ease-out infinite;\n    -o-animation: cssload-tetromino2 1.275s ease-out infinite;\n    -ms-animation: cssload-tetromino2 1.275s ease-out infinite;\n    -webkit-animation: cssload-tetromino2 1.275s ease-out infinite;\n    -moz-animation: cssload-tetromino2 1.275s ease-out infinite;\n}\n\n.cssload-box3 {\n  animation: cssload-tetromino3 1.275s ease-out infinite;\n    -o-animation: cssload-tetromino3 1.275s ease-out infinite;\n    -ms-animation: cssload-tetromino3 1.275s ease-out infinite;\n    -webkit-animation: cssload-tetromino3 1.275s ease-out infinite;\n    -moz-animation: cssload-tetromino3 1.275s ease-out infinite;\n  z-index: 2;\n}\n\n.cssload-box4 {\n  animation: cssload-tetromino4 1.275s ease-out infinite;\n    -o-animation: cssload-tetromino4 1.275s ease-out infinite;\n    -ms-animation: cssload-tetromino4 1.275s ease-out infinite;\n    -webkit-animation: cssload-tetromino4 1.275s ease-out infinite;\n    -moz-animation: cssload-tetromino4 1.275s ease-out infinite;\n}\n\n\n\n\n\n\n\n\n\n@keyframes cssload-tetromino1 {\n  0%, 40% {\n    transform: translate(0, 0);\n  }\n  50% {\n    transform: translate(26px, -15px);\n  }\n  60%, 100% {\n    transform: translate(53px, 0);\n  }\n}\n\n@-o-keyframes cssload-tetromino1 {\n  0%, 40% {\n    -o-transform: translate(0, 0);\n  }\n  50% {\n    -o-transform: translate(26px, -15px);\n  }\n  60%, 100% {\n    -o-transform: translate(53px, 0);\n  }\n}\n\n@-ms-keyframes cssload-tetromino1 {\n  0%, 40% {\n    -ms-transform: translate(0, 0);\n  }\n  50% {\n    -ms-transform: translate(26px, -15px);\n  }\n  60%, 100% {\n    -ms-transform: translate(53px, 0);\n  }\n}\n\n@-webkit-keyframes cssload-tetromino1 {\n  0%, 40% {\n    -webkit-transform: translate(0, 0);\n  }\n  50% {\n    -webkit-transform: translate(26px, -15px);\n  }\n  60%, 100% {\n    -webkit-transform: translate(53px, 0);\n  }\n}\n\n@-moz-keyframes cssload-tetromino1 {\n  0%, 40% {\n    -moz-transform: translate(0, 0);\n  }\n  50% {\n    -moz-transform: translate(26px, -15px);\n  }\n  60%, 100% {\n    -moz-transform: translate(53px, 0);\n  }\n}\n\n@keyframes cssload-tetromino2 {\n  0%, 20% {\n    transform: translate(53px, 0px);\n  }\n  40%, 100% {\n    transform: translate(79px, 15px);\n  }\n}\n\n@-o-keyframes cssload-tetromino2 {\n  0%, 20% {\n    -o-transform: translate(53px, 0px);\n  }\n  40%, 100% {\n    -o-transform: translate(79px, 15px);\n  }\n}\n\n@-ms-keyframes cssload-tetromino2 {\n  0%, 20% {\n    -ms-transform: translate(53px, 0px);\n  }\n  40%, 100% {\n    -ms-transform: translate(79px, 15px);\n  }\n}\n\n@-webkit-keyframes cssload-tetromino2 {\n  0%, 20% {\n    -webkit-transform: translate(53px, 0px);\n  }\n  40%, 100% {\n    -webkit-transform: translate(79px, 15px);\n  }\n}\n\n@-moz-keyframes cssload-tetromino2 {\n  0%, 20% {\n    -moz-transform: translate(53px, 0px);\n  }\n  40%, 100% {\n    -moz-transform: translate(79px, 15px);\n  }\n}\n\n@keyframes cssload-tetromino3 {\n  0% {\n    transform: translate(79px, 15px);\n  }\n  20%, 60% {\n    transform: translate(53px, 30px);\n  }\n  90%, 100% {\n    transform: translate(26px, 15px);\n  }\n}\n\n@-o-keyframes cssload-tetromino3 {\n  0% {\n    -o-transform: translate(79px, 15px);\n  }\n  20%, 60% {\n    -o-transform: translate(53px, 30px);\n  }\n  90%, 100% {\n    -o-transform: translate(26px, 15px);\n  }\n}\n\n@-ms-keyframes cssload-tetromino3 {\n  0% {\n    -ms-transform: translate(79px, 15px);\n  }\n  20%, 60% {\n    -ms-transform: translate(53px, 30px);\n  }\n  90%, 100% {\n    -ms-transform: translate(26px, 15px);\n  }\n}\n\n@-webkit-keyframes cssload-tetromino3 {\n  0% {\n    -webkit-transform: translate(79px, 15px);\n  }\n  20%, 60% {\n    -webkit-transform: translate(53px, 30px);\n  }\n  90%, 100% {\n    -webkit-transform: translate(26px, 15px);\n  }\n}\n\n@-moz-keyframes cssload-tetromino3 {\n  0% {\n    -moz-transform: translate(79px, 15px);\n  }\n  20%, 60% {\n    -moz-transform: translate(53px, 30px);\n  }\n  90%, 100% {\n    -moz-transform: translate(26px, 15px);\n  }\n}\n\n@keyframes cssload-tetromino4 {\n  0%, 60% {\n    transform: translate(26px, 15px);\n  }\n  90%, 100% {\n    transform: translate(0, 0);\n  }\n}\n\n@-o-keyframes cssload-tetromino4 {\n  0%, 60% {\n    -o-transform: translate(26px, 15px);\n  }\n  90%, 100% {\n    -o-transform: translate(0, 0);\n  }\n}\n\n@-ms-keyframes cssload-tetromino4 {\n  0%, 60% {\n    -ms-transform: translate(26px, 15px);\n  }\n  90%, 100% {\n    -ms-transform: translate(0, 0);\n  }\n}\n\n@-webkit-keyframes cssload-tetromino4 {\n  0%, 60% {\n    -webkit-transform: translate(26px, 15px);\n  }\n  90%, 100% {\n    -webkit-transform: translate(0, 0);\n  }\n}\n\n@-moz-keyframes cssload-tetromino4 {\n  0%, 60% {\n    -moz-transform: translate(26px, 15px);\n  }\n  90%, 100% {\n    -moz-transform: translate(0, 0);\n  }\n}      "
  },
  {
    "path": "client/assets/js/colorbrewer.js",
    "content": "// This product includes color specifications and designs developed by Cynthia Brewer (http://colorbrewer.org/).\n// JavaScript specs as packaged in the D3 library (d3js.org). Please see license at http://colorbrewer.org/export/LICENSE.txt\nvar colorbrewer = {YlGn: {\n3: [\"#f7fcb9\",\"#addd8e\",\"#31a354\"],\n4: [\"#ffffcc\",\"#c2e699\",\"#78c679\",\"#238443\"],\n5: [\"#ffffcc\",\"#c2e699\",\"#78c679\",\"#31a354\",\"#006837\"],\n6: [\"#ffffcc\",\"#d9f0a3\",\"#addd8e\",\"#78c679\",\"#31a354\",\"#006837\"],\n7: [\"#ffffcc\",\"#d9f0a3\",\"#addd8e\",\"#78c679\",\"#41ab5d\",\"#238443\",\"#005a32\"],\n8: [\"#ffffe5\",\"#f7fcb9\",\"#d9f0a3\",\"#addd8e\",\"#78c679\",\"#41ab5d\",\"#238443\",\"#005a32\"],\n9: [\"#ffffe5\",\"#f7fcb9\",\"#d9f0a3\",\"#addd8e\",\"#78c679\",\"#41ab5d\",\"#238443\",\"#006837\",\"#004529\"]\n},YlGnBu: {\n3: [\"#edf8b1\",\"#7fcdbb\",\"#2c7fb8\"],\n4: [\"#ffffcc\",\"#a1dab4\",\"#41b6c4\",\"#225ea8\"],\n5: [\"#ffffcc\",\"#a1dab4\",\"#41b6c4\",\"#2c7fb8\",\"#253494\"],\n6: [\"#ffffcc\",\"#c7e9b4\",\"#7fcdbb\",\"#41b6c4\",\"#2c7fb8\",\"#253494\"],\n7: [\"#ffffcc\",\"#c7e9b4\",\"#7fcdbb\",\"#41b6c4\",\"#1d91c0\",\"#225ea8\",\"#0c2c84\"],\n8: [\"#ffffd9\",\"#edf8b1\",\"#c7e9b4\",\"#7fcdbb\",\"#41b6c4\",\"#1d91c0\",\"#225ea8\",\"#0c2c84\"],\n9: [\"#ffffd9\",\"#edf8b1\",\"#c7e9b4\",\"#7fcdbb\",\"#41b6c4\",\"#1d91c0\",\"#225ea8\",\"#253494\",\"#081d58\"]\n},GnBu: {\n3: [\"#e0f3db\",\"#a8ddb5\",\"#43a2ca\"],\n4: [\"#f0f9e8\",\"#bae4bc\",\"#7bccc4\",\"#2b8cbe\"],\n5: [\"#f0f9e8\",\"#bae4bc\",\"#7bccc4\",\"#43a2ca\",\"#0868ac\"],\n6: [\"#f0f9e8\",\"#ccebc5\",\"#a8ddb5\",\"#7bccc4\",\"#43a2ca\",\"#0868ac\"],\n7: [\"#f0f9e8\",\"#ccebc5\",\"#a8ddb5\",\"#7bccc4\",\"#4eb3d3\",\"#2b8cbe\",\"#08589e\"],\n8: [\"#f7fcf0\",\"#e0f3db\",\"#ccebc5\",\"#a8ddb5\",\"#7bccc4\",\"#4eb3d3\",\"#2b8cbe\",\"#08589e\"],\n9: [\"#f7fcf0\",\"#e0f3db\",\"#ccebc5\",\"#a8ddb5\",\"#7bccc4\",\"#4eb3d3\",\"#2b8cbe\",\"#0868ac\",\"#084081\"]\n},BuGn: {\n3: [\"#e5f5f9\",\"#99d8c9\",\"#2ca25f\"],\n4: [\"#edf8fb\",\"#b2e2e2\",\"#66c2a4\",\"#238b45\"],\n5: [\"#edf8fb\",\"#b2e2e2\",\"#66c2a4\",\"#2ca25f\",\"#006d2c\"],\n6: [\"#edf8fb\",\"#ccece6\",\"#99d8c9\",\"#66c2a4\",\"#2ca25f\",\"#006d2c\"],\n7: [\"#edf8fb\",\"#ccece6\",\"#99d8c9\",\"#66c2a4\",\"#41ae76\",\"#238b45\",\"#005824\"],\n8: [\"#f7fcfd\",\"#e5f5f9\",\"#ccece6\",\"#99d8c9\",\"#66c2a4\",\"#41ae76\",\"#238b45\",\"#005824\"],\n9: [\"#f7fcfd\",\"#e5f5f9\",\"#ccece6\",\"#99d8c9\",\"#66c2a4\",\"#41ae76\",\"#238b45\",\"#006d2c\",\"#00441b\"]\n},PuBuGn: {\n3: [\"#ece2f0\",\"#a6bddb\",\"#1c9099\"],\n4: [\"#f6eff7\",\"#bdc9e1\",\"#67a9cf\",\"#02818a\"],\n5: [\"#f6eff7\",\"#bdc9e1\",\"#67a9cf\",\"#1c9099\",\"#016c59\"],\n6: [\"#f6eff7\",\"#d0d1e6\",\"#a6bddb\",\"#67a9cf\",\"#1c9099\",\"#016c59\"],\n7: [\"#f6eff7\",\"#d0d1e6\",\"#a6bddb\",\"#67a9cf\",\"#3690c0\",\"#02818a\",\"#016450\"],\n8: [\"#fff7fb\",\"#ece2f0\",\"#d0d1e6\",\"#a6bddb\",\"#67a9cf\",\"#3690c0\",\"#02818a\",\"#016450\"],\n9: [\"#fff7fb\",\"#ece2f0\",\"#d0d1e6\",\"#a6bddb\",\"#67a9cf\",\"#3690c0\",\"#02818a\",\"#016c59\",\"#014636\"]\n},PuBu: {\n3: [\"#ece7f2\",\"#a6bddb\",\"#2b8cbe\"],\n4: [\"#f1eef6\",\"#bdc9e1\",\"#74a9cf\",\"#0570b0\"],\n5: [\"#f1eef6\",\"#bdc9e1\",\"#74a9cf\",\"#2b8cbe\",\"#045a8d\"],\n6: [\"#f1eef6\",\"#d0d1e6\",\"#a6bddb\",\"#74a9cf\",\"#2b8cbe\",\"#045a8d\"],\n7: [\"#f1eef6\",\"#d0d1e6\",\"#a6bddb\",\"#74a9cf\",\"#3690c0\",\"#0570b0\",\"#034e7b\"],\n8: [\"#fff7fb\",\"#ece7f2\",\"#d0d1e6\",\"#a6bddb\",\"#74a9cf\",\"#3690c0\",\"#0570b0\",\"#034e7b\"],\n9: [\"#fff7fb\",\"#ece7f2\",\"#d0d1e6\",\"#a6bddb\",\"#74a9cf\",\"#3690c0\",\"#0570b0\",\"#045a8d\",\"#023858\"]\n},BuPu: {\n3: [\"#e0ecf4\",\"#9ebcda\",\"#8856a7\"],\n4: [\"#edf8fb\",\"#b3cde3\",\"#8c96c6\",\"#88419d\"],\n5: [\"#edf8fb\",\"#b3cde3\",\"#8c96c6\",\"#8856a7\",\"#810f7c\"],\n6: [\"#edf8fb\",\"#bfd3e6\",\"#9ebcda\",\"#8c96c6\",\"#8856a7\",\"#810f7c\"],\n7: [\"#edf8fb\",\"#bfd3e6\",\"#9ebcda\",\"#8c96c6\",\"#8c6bb1\",\"#88419d\",\"#6e016b\"],\n8: [\"#f7fcfd\",\"#e0ecf4\",\"#bfd3e6\",\"#9ebcda\",\"#8c96c6\",\"#8c6bb1\",\"#88419d\",\"#6e016b\"],\n9: [\"#f7fcfd\",\"#e0ecf4\",\"#bfd3e6\",\"#9ebcda\",\"#8c96c6\",\"#8c6bb1\",\"#88419d\",\"#810f7c\",\"#4d004b\"]\n},RdPu: {\n3: [\"#fde0dd\",\"#fa9fb5\",\"#c51b8a\"],\n4: [\"#feebe2\",\"#fbb4b9\",\"#f768a1\",\"#ae017e\"],\n5: [\"#feebe2\",\"#fbb4b9\",\"#f768a1\",\"#c51b8a\",\"#7a0177\"],\n6: [\"#feebe2\",\"#fcc5c0\",\"#fa9fb5\",\"#f768a1\",\"#c51b8a\",\"#7a0177\"],\n7: [\"#feebe2\",\"#fcc5c0\",\"#fa9fb5\",\"#f768a1\",\"#dd3497\",\"#ae017e\",\"#7a0177\"],\n8: [\"#fff7f3\",\"#fde0dd\",\"#fcc5c0\",\"#fa9fb5\",\"#f768a1\",\"#dd3497\",\"#ae017e\",\"#7a0177\"],\n9: [\"#fff7f3\",\"#fde0dd\",\"#fcc5c0\",\"#fa9fb5\",\"#f768a1\",\"#dd3497\",\"#ae017e\",\"#7a0177\",\"#49006a\"]\n},PuRd: {\n3: [\"#e7e1ef\",\"#c994c7\",\"#dd1c77\"],\n4: [\"#f1eef6\",\"#d7b5d8\",\"#df65b0\",\"#ce1256\"],\n5: [\"#f1eef6\",\"#d7b5d8\",\"#df65b0\",\"#dd1c77\",\"#980043\"],\n6: [\"#f1eef6\",\"#d4b9da\",\"#c994c7\",\"#df65b0\",\"#dd1c77\",\"#980043\"],\n7: [\"#f1eef6\",\"#d4b9da\",\"#c994c7\",\"#df65b0\",\"#e7298a\",\"#ce1256\",\"#91003f\"],\n8: [\"#f7f4f9\",\"#e7e1ef\",\"#d4b9da\",\"#c994c7\",\"#df65b0\",\"#e7298a\",\"#ce1256\",\"#91003f\"],\n9: [\"#f7f4f9\",\"#e7e1ef\",\"#d4b9da\",\"#c994c7\",\"#df65b0\",\"#e7298a\",\"#ce1256\",\"#980043\",\"#67001f\"]\n},OrRd: {\n3: [\"#fee8c8\",\"#fdbb84\",\"#e34a33\"],\n4: [\"#fef0d9\",\"#fdcc8a\",\"#fc8d59\",\"#d7301f\"],\n5: [\"#fef0d9\",\"#fdcc8a\",\"#fc8d59\",\"#e34a33\",\"#b30000\"],\n6: [\"#fef0d9\",\"#fdd49e\",\"#fdbb84\",\"#fc8d59\",\"#e34a33\",\"#b30000\"],\n7: [\"#fef0d9\",\"#fdd49e\",\"#fdbb84\",\"#fc8d59\",\"#ef6548\",\"#d7301f\",\"#990000\"],\n8: [\"#fff7ec\",\"#fee8c8\",\"#fdd49e\",\"#fdbb84\",\"#fc8d59\",\"#ef6548\",\"#d7301f\",\"#990000\"],\n9: [\"#fff7ec\",\"#fee8c8\",\"#fdd49e\",\"#fdbb84\",\"#fc8d59\",\"#ef6548\",\"#d7301f\",\"#b30000\",\"#7f0000\"]\n},YlOrRd: {\n3: [\"#ffeda0\",\"#feb24c\",\"#f03b20\"],\n4: [\"#ffffb2\",\"#fecc5c\",\"#fd8d3c\",\"#e31a1c\"],\n5: [\"#ffffb2\",\"#fecc5c\",\"#fd8d3c\",\"#f03b20\",\"#bd0026\"],\n6: [\"#ffffb2\",\"#fed976\",\"#feb24c\",\"#fd8d3c\",\"#f03b20\",\"#bd0026\"],\n7: [\"#ffffb2\",\"#fed976\",\"#feb24c\",\"#fd8d3c\",\"#fc4e2a\",\"#e31a1c\",\"#b10026\"],\n8: [\"#ffffcc\",\"#ffeda0\",\"#fed976\",\"#feb24c\",\"#fd8d3c\",\"#fc4e2a\",\"#e31a1c\",\"#b10026\"],\n9: [\"#ffffcc\",\"#ffeda0\",\"#fed976\",\"#feb24c\",\"#fd8d3c\",\"#fc4e2a\",\"#e31a1c\",\"#bd0026\",\"#800026\"]\n},YlOrBr: {\n3: [\"#fff7bc\",\"#fec44f\",\"#d95f0e\"],\n4: [\"#ffffd4\",\"#fed98e\",\"#fe9929\",\"#cc4c02\"],\n5: [\"#ffffd4\",\"#fed98e\",\"#fe9929\",\"#d95f0e\",\"#993404\"],\n6: [\"#ffffd4\",\"#fee391\",\"#fec44f\",\"#fe9929\",\"#d95f0e\",\"#993404\"],\n7: [\"#ffffd4\",\"#fee391\",\"#fec44f\",\"#fe9929\",\"#ec7014\",\"#cc4c02\",\"#8c2d04\"],\n8: [\"#ffffe5\",\"#fff7bc\",\"#fee391\",\"#fec44f\",\"#fe9929\",\"#ec7014\",\"#cc4c02\",\"#8c2d04\"],\n9: [\"#ffffe5\",\"#fff7bc\",\"#fee391\",\"#fec44f\",\"#fe9929\",\"#ec7014\",\"#cc4c02\",\"#993404\",\"#662506\"]\n},Purples: {\n3: [\"#efedf5\",\"#bcbddc\",\"#756bb1\"],\n4: [\"#f2f0f7\",\"#cbc9e2\",\"#9e9ac8\",\"#6a51a3\"],\n5: [\"#f2f0f7\",\"#cbc9e2\",\"#9e9ac8\",\"#756bb1\",\"#54278f\"],\n6: [\"#f2f0f7\",\"#dadaeb\",\"#bcbddc\",\"#9e9ac8\",\"#756bb1\",\"#54278f\"],\n7: [\"#f2f0f7\",\"#dadaeb\",\"#bcbddc\",\"#9e9ac8\",\"#807dba\",\"#6a51a3\",\"#4a1486\"],\n8: [\"#fcfbfd\",\"#efedf5\",\"#dadaeb\",\"#bcbddc\",\"#9e9ac8\",\"#807dba\",\"#6a51a3\",\"#4a1486\"],\n9: [\"#fcfbfd\",\"#efedf5\",\"#dadaeb\",\"#bcbddc\",\"#9e9ac8\",\"#807dba\",\"#6a51a3\",\"#54278f\",\"#3f007d\"]\n},Blues: {\n3: [\"#deebf7\",\"#9ecae1\",\"#3182bd\"],\n4: [\"#eff3ff\",\"#bdd7e7\",\"#6baed6\",\"#2171b5\"],\n5: [\"#eff3ff\",\"#bdd7e7\",\"#6baed6\",\"#3182bd\",\"#08519c\"],\n6: [\"#eff3ff\",\"#c6dbef\",\"#9ecae1\",\"#6baed6\",\"#3182bd\",\"#08519c\"],\n7: [\"#eff3ff\",\"#c6dbef\",\"#9ecae1\",\"#6baed6\",\"#4292c6\",\"#2171b5\",\"#084594\"],\n8: [\"#f7fbff\",\"#deebf7\",\"#c6dbef\",\"#9ecae1\",\"#6baed6\",\"#4292c6\",\"#2171b5\",\"#084594\"],\n9: [\"#f7fbff\",\"#deebf7\",\"#c6dbef\",\"#9ecae1\",\"#6baed6\",\"#4292c6\",\"#2171b5\",\"#08519c\",\"#08306b\"]\n},Greens: {\n3: [\"#e5f5e0\",\"#a1d99b\",\"#31a354\"],\n4: [\"#edf8e9\",\"#bae4b3\",\"#74c476\",\"#238b45\"],\n5: [\"#edf8e9\",\"#bae4b3\",\"#74c476\",\"#31a354\",\"#006d2c\"],\n6: [\"#edf8e9\",\"#c7e9c0\",\"#a1d99b\",\"#74c476\",\"#31a354\",\"#006d2c\"],\n7: [\"#edf8e9\",\"#c7e9c0\",\"#a1d99b\",\"#74c476\",\"#41ab5d\",\"#238b45\",\"#005a32\"],\n8: [\"#f7fcf5\",\"#e5f5e0\",\"#c7e9c0\",\"#a1d99b\",\"#74c476\",\"#41ab5d\",\"#238b45\",\"#005a32\"],\n9: [\"#f7fcf5\",\"#e5f5e0\",\"#c7e9c0\",\"#a1d99b\",\"#74c476\",\"#41ab5d\",\"#238b45\",\"#006d2c\",\"#00441b\"]\n},Oranges: {\n3: [\"#fee6ce\",\"#fdae6b\",\"#e6550d\"],\n4: [\"#feedde\",\"#fdbe85\",\"#fd8d3c\",\"#d94701\"],\n5: [\"#feedde\",\"#fdbe85\",\"#fd8d3c\",\"#e6550d\",\"#a63603\"],\n6: [\"#feedde\",\"#fdd0a2\",\"#fdae6b\",\"#fd8d3c\",\"#e6550d\",\"#a63603\"],\n7: [\"#feedde\",\"#fdd0a2\",\"#fdae6b\",\"#fd8d3c\",\"#f16913\",\"#d94801\",\"#8c2d04\"],\n8: [\"#fff5eb\",\"#fee6ce\",\"#fdd0a2\",\"#fdae6b\",\"#fd8d3c\",\"#f16913\",\"#d94801\",\"#8c2d04\"],\n9: [\"#fff5eb\",\"#fee6ce\",\"#fdd0a2\",\"#fdae6b\",\"#fd8d3c\",\"#f16913\",\"#d94801\",\"#a63603\",\"#7f2704\"]\n},Reds: {\n3: [\"#fee0d2\",\"#fc9272\",\"#de2d26\"],\n4: [\"#fee5d9\",\"#fcae91\",\"#fb6a4a\",\"#cb181d\"],\n5: [\"#fee5d9\",\"#fcae91\",\"#fb6a4a\",\"#de2d26\",\"#a50f15\"],\n6: [\"#fee5d9\",\"#fcbba1\",\"#fc9272\",\"#fb6a4a\",\"#de2d26\",\"#a50f15\"],\n7: [\"#fee5d9\",\"#fcbba1\",\"#fc9272\",\"#fb6a4a\",\"#ef3b2c\",\"#cb181d\",\"#99000d\"],\n8: [\"#fff5f0\",\"#fee0d2\",\"#fcbba1\",\"#fc9272\",\"#fb6a4a\",\"#ef3b2c\",\"#cb181d\",\"#99000d\"],\n9: [\"#fff5f0\",\"#fee0d2\",\"#fcbba1\",\"#fc9272\",\"#fb6a4a\",\"#ef3b2c\",\"#cb181d\",\"#a50f15\",\"#67000d\"]\n},Greys: {\n3: [\"#f0f0f0\",\"#bdbdbd\",\"#636363\"],\n4: [\"#f7f7f7\",\"#cccccc\",\"#969696\",\"#525252\"],\n5: [\"#f7f7f7\",\"#cccccc\",\"#969696\",\"#636363\",\"#252525\"],\n6: [\"#f7f7f7\",\"#d9d9d9\",\"#bdbdbd\",\"#969696\",\"#636363\",\"#252525\"],\n7: [\"#f7f7f7\",\"#d9d9d9\",\"#bdbdbd\",\"#969696\",\"#737373\",\"#525252\",\"#252525\"],\n8: [\"#ffffff\",\"#f0f0f0\",\"#d9d9d9\",\"#bdbdbd\",\"#969696\",\"#737373\",\"#525252\",\"#252525\"],\n9: [\"#ffffff\",\"#f0f0f0\",\"#d9d9d9\",\"#bdbdbd\",\"#969696\",\"#737373\",\"#525252\",\"#252525\",\"#000000\"]\n},PuOr: {\n3: [\"#f1a340\",\"#f7f7f7\",\"#998ec3\"],\n4: [\"#e66101\",\"#fdb863\",\"#b2abd2\",\"#5e3c99\"],\n5: [\"#e66101\",\"#fdb863\",\"#f7f7f7\",\"#b2abd2\",\"#5e3c99\"],\n6: [\"#b35806\",\"#f1a340\",\"#fee0b6\",\"#d8daeb\",\"#998ec3\",\"#542788\"],\n7: [\"#b35806\",\"#f1a340\",\"#fee0b6\",\"#f7f7f7\",\"#d8daeb\",\"#998ec3\",\"#542788\"],\n8: [\"#b35806\",\"#e08214\",\"#fdb863\",\"#fee0b6\",\"#d8daeb\",\"#b2abd2\",\"#8073ac\",\"#542788\"],\n9: [\"#b35806\",\"#e08214\",\"#fdb863\",\"#fee0b6\",\"#f7f7f7\",\"#d8daeb\",\"#b2abd2\",\"#8073ac\",\"#542788\"],\n10: [\"#7f3b08\",\"#b35806\",\"#e08214\",\"#fdb863\",\"#fee0b6\",\"#d8daeb\",\"#b2abd2\",\"#8073ac\",\"#542788\",\"#2d004b\"],\n11: [\"#7f3b08\",\"#b35806\",\"#e08214\",\"#fdb863\",\"#fee0b6\",\"#f7f7f7\",\"#d8daeb\",\"#b2abd2\",\"#8073ac\",\"#542788\",\"#2d004b\"]\n},BrBG: {\n3: [\"#d8b365\",\"#f5f5f5\",\"#5ab4ac\"],\n4: [\"#a6611a\",\"#dfc27d\",\"#80cdc1\",\"#018571\"],\n5: [\"#a6611a\",\"#dfc27d\",\"#f5f5f5\",\"#80cdc1\",\"#018571\"],\n6: [\"#8c510a\",\"#d8b365\",\"#f6e8c3\",\"#c7eae5\",\"#5ab4ac\",\"#01665e\"],\n7: [\"#8c510a\",\"#d8b365\",\"#f6e8c3\",\"#f5f5f5\",\"#c7eae5\",\"#5ab4ac\",\"#01665e\"],\n8: [\"#8c510a\",\"#bf812d\",\"#dfc27d\",\"#f6e8c3\",\"#c7eae5\",\"#80cdc1\",\"#35978f\",\"#01665e\"],\n9: [\"#8c510a\",\"#bf812d\",\"#dfc27d\",\"#f6e8c3\",\"#f5f5f5\",\"#c7eae5\",\"#80cdc1\",\"#35978f\",\"#01665e\"],\n10: [\"#543005\",\"#8c510a\",\"#bf812d\",\"#dfc27d\",\"#f6e8c3\",\"#c7eae5\",\"#80cdc1\",\"#35978f\",\"#01665e\",\"#003c30\"],\n11: [\"#543005\",\"#8c510a\",\"#bf812d\",\"#dfc27d\",\"#f6e8c3\",\"#f5f5f5\",\"#c7eae5\",\"#80cdc1\",\"#35978f\",\"#01665e\",\"#003c30\"]\n},PRGn: {\n3: [\"#af8dc3\",\"#f7f7f7\",\"#7fbf7b\"],\n4: [\"#7b3294\",\"#c2a5cf\",\"#a6dba0\",\"#008837\"],\n5: [\"#7b3294\",\"#c2a5cf\",\"#f7f7f7\",\"#a6dba0\",\"#008837\"],\n6: [\"#762a83\",\"#af8dc3\",\"#e7d4e8\",\"#d9f0d3\",\"#7fbf7b\",\"#1b7837\"],\n7: [\"#762a83\",\"#af8dc3\",\"#e7d4e8\",\"#f7f7f7\",\"#d9f0d3\",\"#7fbf7b\",\"#1b7837\"],\n8: [\"#762a83\",\"#9970ab\",\"#c2a5cf\",\"#e7d4e8\",\"#d9f0d3\",\"#a6dba0\",\"#5aae61\",\"#1b7837\"],\n9: [\"#762a83\",\"#9970ab\",\"#c2a5cf\",\"#e7d4e8\",\"#f7f7f7\",\"#d9f0d3\",\"#a6dba0\",\"#5aae61\",\"#1b7837\"],\n10: [\"#40004b\",\"#762a83\",\"#9970ab\",\"#c2a5cf\",\"#e7d4e8\",\"#d9f0d3\",\"#a6dba0\",\"#5aae61\",\"#1b7837\",\"#00441b\"],\n11: [\"#40004b\",\"#762a83\",\"#9970ab\",\"#c2a5cf\",\"#e7d4e8\",\"#f7f7f7\",\"#d9f0d3\",\"#a6dba0\",\"#5aae61\",\"#1b7837\",\"#00441b\"]\n},PiYG: {\n3: [\"#e9a3c9\",\"#f7f7f7\",\"#a1d76a\"],\n4: [\"#d01c8b\",\"#f1b6da\",\"#b8e186\",\"#4dac26\"],\n5: [\"#d01c8b\",\"#f1b6da\",\"#f7f7f7\",\"#b8e186\",\"#4dac26\"],\n6: [\"#c51b7d\",\"#e9a3c9\",\"#fde0ef\",\"#e6f5d0\",\"#a1d76a\",\"#4d9221\"],\n7: [\"#c51b7d\",\"#e9a3c9\",\"#fde0ef\",\"#f7f7f7\",\"#e6f5d0\",\"#a1d76a\",\"#4d9221\"],\n8: [\"#c51b7d\",\"#de77ae\",\"#f1b6da\",\"#fde0ef\",\"#e6f5d0\",\"#b8e186\",\"#7fbc41\",\"#4d9221\"],\n9: [\"#c51b7d\",\"#de77ae\",\"#f1b6da\",\"#fde0ef\",\"#f7f7f7\",\"#e6f5d0\",\"#b8e186\",\"#7fbc41\",\"#4d9221\"],\n10: [\"#8e0152\",\"#c51b7d\",\"#de77ae\",\"#f1b6da\",\"#fde0ef\",\"#e6f5d0\",\"#b8e186\",\"#7fbc41\",\"#4d9221\",\"#276419\"],\n11: [\"#8e0152\",\"#c51b7d\",\"#de77ae\",\"#f1b6da\",\"#fde0ef\",\"#f7f7f7\",\"#e6f5d0\",\"#b8e186\",\"#7fbc41\",\"#4d9221\",\"#276419\"]\n},RdBu: {\n3: [\"#ef8a62\",\"#f7f7f7\",\"#67a9cf\"],\n4: [\"#ca0020\",\"#f4a582\",\"#92c5de\",\"#0571b0\"],\n5: [\"#ca0020\",\"#f4a582\",\"#f7f7f7\",\"#92c5de\",\"#0571b0\"],\n6: [\"#b2182b\",\"#ef8a62\",\"#fddbc7\",\"#d1e5f0\",\"#67a9cf\",\"#2166ac\"],\n7: [\"#b2182b\",\"#ef8a62\",\"#fddbc7\",\"#f7f7f7\",\"#d1e5f0\",\"#67a9cf\",\"#2166ac\"],\n8: [\"#b2182b\",\"#d6604d\",\"#f4a582\",\"#fddbc7\",\"#d1e5f0\",\"#92c5de\",\"#4393c3\",\"#2166ac\"],\n9: [\"#b2182b\",\"#d6604d\",\"#f4a582\",\"#fddbc7\",\"#f7f7f7\",\"#d1e5f0\",\"#92c5de\",\"#4393c3\",\"#2166ac\"],\n10: [\"#67001f\",\"#b2182b\",\"#d6604d\",\"#f4a582\",\"#fddbc7\",\"#d1e5f0\",\"#92c5de\",\"#4393c3\",\"#2166ac\",\"#053061\"],\n11: [\"#67001f\",\"#b2182b\",\"#d6604d\",\"#f4a582\",\"#fddbc7\",\"#f7f7f7\",\"#d1e5f0\",\"#92c5de\",\"#4393c3\",\"#2166ac\",\"#053061\"]\n},RdGy: {\n3: [\"#ef8a62\",\"#ffffff\",\"#999999\"],\n4: [\"#ca0020\",\"#f4a582\",\"#bababa\",\"#404040\"],\n5: [\"#ca0020\",\"#f4a582\",\"#ffffff\",\"#bababa\",\"#404040\"],\n6: [\"#b2182b\",\"#ef8a62\",\"#fddbc7\",\"#e0e0e0\",\"#999999\",\"#4d4d4d\"],\n7: [\"#b2182b\",\"#ef8a62\",\"#fddbc7\",\"#ffffff\",\"#e0e0e0\",\"#999999\",\"#4d4d4d\"],\n8: [\"#b2182b\",\"#d6604d\",\"#f4a582\",\"#fddbc7\",\"#e0e0e0\",\"#bababa\",\"#878787\",\"#4d4d4d\"],\n9: [\"#b2182b\",\"#d6604d\",\"#f4a582\",\"#fddbc7\",\"#ffffff\",\"#e0e0e0\",\"#bababa\",\"#878787\",\"#4d4d4d\"],\n10: [\"#67001f\",\"#b2182b\",\"#d6604d\",\"#f4a582\",\"#fddbc7\",\"#e0e0e0\",\"#bababa\",\"#878787\",\"#4d4d4d\",\"#1a1a1a\"],\n11: [\"#67001f\",\"#b2182b\",\"#d6604d\",\"#f4a582\",\"#fddbc7\",\"#ffffff\",\"#e0e0e0\",\"#bababa\",\"#878787\",\"#4d4d4d\",\"#1a1a1a\"]\n},RdYlBu: {\n3: [\"#fc8d59\",\"#ffffbf\",\"#91bfdb\"],\n4: [\"#d7191c\",\"#fdae61\",\"#abd9e9\",\"#2c7bb6\"],\n5: [\"#d7191c\",\"#fdae61\",\"#ffffbf\",\"#abd9e9\",\"#2c7bb6\"],\n6: [\"#d73027\",\"#fc8d59\",\"#fee090\",\"#e0f3f8\",\"#91bfdb\",\"#4575b4\"],\n7: [\"#d73027\",\"#fc8d59\",\"#fee090\",\"#ffffbf\",\"#e0f3f8\",\"#91bfdb\",\"#4575b4\"],\n8: [\"#d73027\",\"#f46d43\",\"#fdae61\",\"#fee090\",\"#e0f3f8\",\"#abd9e9\",\"#74add1\",\"#4575b4\"],\n9: [\"#d73027\",\"#f46d43\",\"#fdae61\",\"#fee090\",\"#ffffbf\",\"#e0f3f8\",\"#abd9e9\",\"#74add1\",\"#4575b4\"],\n10: [\"#a50026\",\"#d73027\",\"#f46d43\",\"#fdae61\",\"#fee090\",\"#e0f3f8\",\"#abd9e9\",\"#74add1\",\"#4575b4\",\"#313695\"],\n11: [\"#a50026\",\"#d73027\",\"#f46d43\",\"#fdae61\",\"#fee090\",\"#ffffbf\",\"#e0f3f8\",\"#abd9e9\",\"#74add1\",\"#4575b4\",\"#313695\"]\n},Spectral: {\n3: [\"#fc8d59\",\"#ffffbf\",\"#99d594\"],\n4: [\"#d7191c\",\"#fdae61\",\"#abdda4\",\"#2b83ba\"],\n5: [\"#d7191c\",\"#fdae61\",\"#ffffbf\",\"#abdda4\",\"#2b83ba\"],\n6: [\"#d53e4f\",\"#fc8d59\",\"#fee08b\",\"#e6f598\",\"#99d594\",\"#3288bd\"],\n7: [\"#d53e4f\",\"#fc8d59\",\"#fee08b\",\"#ffffbf\",\"#e6f598\",\"#99d594\",\"#3288bd\"],\n8: [\"#d53e4f\",\"#f46d43\",\"#fdae61\",\"#fee08b\",\"#e6f598\",\"#abdda4\",\"#66c2a5\",\"#3288bd\"],\n9: [\"#d53e4f\",\"#f46d43\",\"#fdae61\",\"#fee08b\",\"#ffffbf\",\"#e6f598\",\"#abdda4\",\"#66c2a5\",\"#3288bd\"],\n10: [\"#9e0142\",\"#d53e4f\",\"#f46d43\",\"#fdae61\",\"#fee08b\",\"#e6f598\",\"#abdda4\",\"#66c2a5\",\"#3288bd\",\"#5e4fa2\"],\n11: [\"#9e0142\",\"#d53e4f\",\"#f46d43\",\"#fdae61\",\"#fee08b\",\"#ffffbf\",\"#e6f598\",\"#abdda4\",\"#66c2a5\",\"#3288bd\",\"#5e4fa2\"]\n},RdYlGn: {\n3: [\"#fc8d59\",\"#ffffbf\",\"#91cf60\"],\n4: [\"#d7191c\",\"#fdae61\",\"#a6d96a\",\"#1a9641\"],\n5: [\"#d7191c\",\"#fdae61\",\"#ffffbf\",\"#a6d96a\",\"#1a9641\"],\n6: [\"#d73027\",\"#fc8d59\",\"#fee08b\",\"#d9ef8b\",\"#91cf60\",\"#1a9850\"],\n7: [\"#d73027\",\"#fc8d59\",\"#fee08b\",\"#ffffbf\",\"#d9ef8b\",\"#91cf60\",\"#1a9850\"],\n8: [\"#d73027\",\"#f46d43\",\"#fdae61\",\"#fee08b\",\"#d9ef8b\",\"#a6d96a\",\"#66bd63\",\"#1a9850\"],\n9: [\"#d73027\",\"#f46d43\",\"#fdae61\",\"#fee08b\",\"#ffffbf\",\"#d9ef8b\",\"#a6d96a\",\"#66bd63\",\"#1a9850\"],\n10: [\"#a50026\",\"#d73027\",\"#f46d43\",\"#fdae61\",\"#fee08b\",\"#d9ef8b\",\"#a6d96a\",\"#66bd63\",\"#1a9850\",\"#006837\"],\n11: [\"#a50026\",\"#d73027\",\"#f46d43\",\"#fdae61\",\"#fee08b\",\"#ffffbf\",\"#d9ef8b\",\"#a6d96a\",\"#66bd63\",\"#1a9850\",\"#006837\"]\n},Accent: {\n3: [\"#7fc97f\",\"#beaed4\",\"#fdc086\"],\n4: [\"#7fc97f\",\"#beaed4\",\"#fdc086\",\"#ffff99\"],\n5: [\"#7fc97f\",\"#beaed4\",\"#fdc086\",\"#ffff99\",\"#386cb0\"],\n6: [\"#7fc97f\",\"#beaed4\",\"#fdc086\",\"#ffff99\",\"#386cb0\",\"#f0027f\"],\n7: [\"#7fc97f\",\"#beaed4\",\"#fdc086\",\"#ffff99\",\"#386cb0\",\"#f0027f\",\"#bf5b17\"],\n8: [\"#7fc97f\",\"#beaed4\",\"#fdc086\",\"#ffff99\",\"#386cb0\",\"#f0027f\",\"#bf5b17\",\"#666666\"]\n},Dark2: {\n3: [\"#1b9e77\",\"#d95f02\",\"#7570b3\"],\n4: [\"#1b9e77\",\"#d95f02\",\"#7570b3\",\"#e7298a\"],\n5: [\"#1b9e77\",\"#d95f02\",\"#7570b3\",\"#e7298a\",\"#66a61e\"],\n6: [\"#1b9e77\",\"#d95f02\",\"#7570b3\",\"#e7298a\",\"#66a61e\",\"#e6ab02\"],\n7: [\"#1b9e77\",\"#d95f02\",\"#7570b3\",\"#e7298a\",\"#66a61e\",\"#e6ab02\",\"#a6761d\"],\n8: [\"#1b9e77\",\"#d95f02\",\"#7570b3\",\"#e7298a\",\"#66a61e\",\"#e6ab02\",\"#a6761d\",\"#666666\"]\n},Paired: {\n3: [\"#a6cee3\",\"#1f78b4\",\"#b2df8a\"],\n4: [\"#a6cee3\",\"#1f78b4\",\"#b2df8a\",\"#33a02c\"],\n5: [\"#a6cee3\",\"#1f78b4\",\"#b2df8a\",\"#33a02c\",\"#fb9a99\"],\n6: [\"#a6cee3\",\"#1f78b4\",\"#b2df8a\",\"#33a02c\",\"#fb9a99\",\"#e31a1c\"],\n7: [\"#a6cee3\",\"#1f78b4\",\"#b2df8a\",\"#33a02c\",\"#fb9a99\",\"#e31a1c\",\"#fdbf6f\"],\n8: [\"#a6cee3\",\"#1f78b4\",\"#b2df8a\",\"#33a02c\",\"#fb9a99\",\"#e31a1c\",\"#fdbf6f\",\"#ff7f00\"],\n9: [\"#a6cee3\",\"#1f78b4\",\"#b2df8a\",\"#33a02c\",\"#fb9a99\",\"#e31a1c\",\"#fdbf6f\",\"#ff7f00\",\"#cab2d6\"],\n10: [\"#a6cee3\",\"#1f78b4\",\"#b2df8a\",\"#33a02c\",\"#fb9a99\",\"#e31a1c\",\"#fdbf6f\",\"#ff7f00\",\"#cab2d6\",\"#6a3d9a\"],\n11: [\"#a6cee3\",\"#1f78b4\",\"#b2df8a\",\"#33a02c\",\"#fb9a99\",\"#e31a1c\",\"#fdbf6f\",\"#ff7f00\",\"#cab2d6\",\"#6a3d9a\",\"#ffff99\"],\n12: [\"#a6cee3\",\"#1f78b4\",\"#b2df8a\",\"#33a02c\",\"#fb9a99\",\"#e31a1c\",\"#fdbf6f\",\"#ff7f00\",\"#cab2d6\",\"#6a3d9a\",\"#ffff99\",\"#b15928\"]\n},Pastel1: {\n3: [\"#fbb4ae\",\"#b3cde3\",\"#ccebc5\"],\n4: [\"#fbb4ae\",\"#b3cde3\",\"#ccebc5\",\"#decbe4\"],\n5: [\"#fbb4ae\",\"#b3cde3\",\"#ccebc5\",\"#decbe4\",\"#fed9a6\"],\n6: [\"#fbb4ae\",\"#b3cde3\",\"#ccebc5\",\"#decbe4\",\"#fed9a6\",\"#ffffcc\"],\n7: [\"#fbb4ae\",\"#b3cde3\",\"#ccebc5\",\"#decbe4\",\"#fed9a6\",\"#ffffcc\",\"#e5d8bd\"],\n8: [\"#fbb4ae\",\"#b3cde3\",\"#ccebc5\",\"#decbe4\",\"#fed9a6\",\"#ffffcc\",\"#e5d8bd\",\"#fddaec\"],\n9: [\"#fbb4ae\",\"#b3cde3\",\"#ccebc5\",\"#decbe4\",\"#fed9a6\",\"#ffffcc\",\"#e5d8bd\",\"#fddaec\",\"#f2f2f2\"]\n},Pastel2: {\n3: [\"#b3e2cd\",\"#fdcdac\",\"#cbd5e8\"],\n4: [\"#b3e2cd\",\"#fdcdac\",\"#cbd5e8\",\"#f4cae4\"],\n5: [\"#b3e2cd\",\"#fdcdac\",\"#cbd5e8\",\"#f4cae4\",\"#e6f5c9\"],\n6: [\"#b3e2cd\",\"#fdcdac\",\"#cbd5e8\",\"#f4cae4\",\"#e6f5c9\",\"#fff2ae\"],\n7: [\"#b3e2cd\",\"#fdcdac\",\"#cbd5e8\",\"#f4cae4\",\"#e6f5c9\",\"#fff2ae\",\"#f1e2cc\"],\n8: [\"#b3e2cd\",\"#fdcdac\",\"#cbd5e8\",\"#f4cae4\",\"#e6f5c9\",\"#fff2ae\",\"#f1e2cc\",\"#cccccc\"]\n},Set1: {\n3: [\"#e41a1c\",\"#377eb8\",\"#4daf4a\"],\n4: [\"#e41a1c\",\"#377eb8\",\"#4daf4a\",\"#984ea3\"],\n5: [\"#e41a1c\",\"#377eb8\",\"#4daf4a\",\"#984ea3\",\"#ff7f00\"],\n6: [\"#e41a1c\",\"#377eb8\",\"#4daf4a\",\"#984ea3\",\"#ff7f00\",\"#ffff33\"],\n7: [\"#e41a1c\",\"#377eb8\",\"#4daf4a\",\"#984ea3\",\"#ff7f00\",\"#ffff33\",\"#a65628\"],\n8: [\"#e41a1c\",\"#377eb8\",\"#4daf4a\",\"#984ea3\",\"#ff7f00\",\"#ffff33\",\"#a65628\",\"#f781bf\"],\n9: [\"#e41a1c\",\"#377eb8\",\"#4daf4a\",\"#984ea3\",\"#ff7f00\",\"#ffff33\",\"#a65628\",\"#f781bf\",\"#999999\"]\n},Set2: {\n3: [\"#66c2a5\",\"#fc8d62\",\"#8da0cb\"],\n4: [\"#66c2a5\",\"#fc8d62\",\"#8da0cb\",\"#e78ac3\"],\n5: [\"#66c2a5\",\"#fc8d62\",\"#8da0cb\",\"#e78ac3\",\"#a6d854\"],\n6: [\"#66c2a5\",\"#fc8d62\",\"#8da0cb\",\"#e78ac3\",\"#a6d854\",\"#ffd92f\"],\n7: [\"#66c2a5\",\"#fc8d62\",\"#8da0cb\",\"#e78ac3\",\"#a6d854\",\"#ffd92f\",\"#e5c494\"],\n8: [\"#66c2a5\",\"#fc8d62\",\"#8da0cb\",\"#e78ac3\",\"#a6d854\",\"#ffd92f\",\"#e5c494\",\"#b3b3b3\"]\n},Set3: {\n3: [\"#8dd3c7\",\"#ffffb3\",\"#bebada\"],\n4: [\"#8dd3c7\",\"#ffffb3\",\"#bebada\",\"#fb8072\"],\n5: [\"#8dd3c7\",\"#ffffb3\",\"#bebada\",\"#fb8072\",\"#80b1d3\"],\n6: [\"#8dd3c7\",\"#ffffb3\",\"#bebada\",\"#fb8072\",\"#80b1d3\",\"#fdb462\"],\n7: [\"#8dd3c7\",\"#ffffb3\",\"#bebada\",\"#fb8072\",\"#80b1d3\",\"#fdb462\",\"#b3de69\"],\n8: [\"#8dd3c7\",\"#ffffb3\",\"#bebada\",\"#fb8072\",\"#80b1d3\",\"#fdb462\",\"#b3de69\",\"#fccde5\"],\n9: [\"#8dd3c7\",\"#ffffb3\",\"#bebada\",\"#fb8072\",\"#80b1d3\",\"#fdb462\",\"#b3de69\",\"#fccde5\",\"#d9d9d9\"],\n10: [\"#8dd3c7\",\"#ffffb3\",\"#bebada\",\"#fb8072\",\"#80b1d3\",\"#fdb462\",\"#b3de69\",\"#fccde5\",\"#d9d9d9\",\"#bc80bd\"],\n11: [\"#8dd3c7\",\"#ffffb3\",\"#bebada\",\"#fb8072\",\"#80b1d3\",\"#fdb462\",\"#b3de69\",\"#fccde5\",\"#d9d9d9\",\"#bc80bd\",\"#ccebc5\"],\n12: [\"#8dd3c7\",\"#ffffb3\",\"#bebada\",\"#fb8072\",\"#80b1d3\",\"#fdb462\",\"#b3de69\",\"#fccde5\",\"#d9d9d9\",\"#bc80bd\",\"#ccebc5\",\"#ffed6f\"]\n}};"
  },
  {
    "path": "client/heatmapD3.js",
    "content": "function heatmapD3() {\n\tvar dispatch = d3.dispatch(\"d3click\");\n\n\tvar margin = { top: 10, right: 100, bottom: 100, left: 5 };\n\tvar legendMargin = 30;\n\n\tvar cellSize = 20;\n\tvar legendCellSize = 60;\n\tvar rowLabelWidth = 420;\n\tvar colLabelHeight = 110;\n\n\tvar score    = function(d) { return +d.overlaps; };\n\n\tvar rowLabels  = function(d) { return d.dimensions[0].elements};\n\tvar colLabels  = function(d) { return d.dimensions[1].elements};\n\tvar cellData  = function(d) { return d.cells};\n\tvar cellRow   = function(d) { return +d.row; };\n\tvar cellCol   = function(d) { return +d.col; };\n\tvar cellValue = function(d) { return +d.overlaps; };\n\n\n\tvar buckets = 9;\n\tvar colors = [\"#ffffd9\",\"#edf8b1\",\"#c7e9b4\",\"#7fcdbb\",\"#41b6c4\",\"#1d91c0\",\"#225ea8\",\"#253494\",\"#081d58\"]; // alternatively colorbrewer.YlGnBu[9]\n\n\tvar rowNames = [];\n\tvar colNames = [];\n\n\tvar rowIndex = {};\n\tvar colIndex = {};\n\n\tdefaults = {};\n\n\tfunction chart(selection) {\n\n\t\tselection.each(function(jsonData) {\n\n\t\t\tvar data = cellData(jsonData);\n\t\t\trowNames = rowLabels(jsonData);\n\t\t\tcolNames = colLabels(jsonData);\n\n\t\t\tvar width  = (colNames.length*cellSize);\n\t\t\tvar height = (rowNames.length*cellSize);\n\n\t\t\tvar colorScale = d3.scale\n\t\t\t                   .quantize()\n\t\t\t                   .domain([d3.min(data, function (d) { return cellValue(d); }), buckets - 1, d3.max(data, function (d) { return cellValue(d); })])\n\t\t\t                   .range(colors);\n\n\t\t\td3.select('#chart svg').remove();\n\n\t\t\tvar svg = d3.select(\"#chart\")\n\t\t\t            .append(\"svg\")\n\t\t\t            .attr(\"width\", width + rowLabelWidth + margin.left + legendMargin + margin.right)\n\t\t\t            .attr(\"height\", height + colLabelHeight + margin.top + margin.bottom);\n\n\t\t\tvar rowGroup = svg.append(\"g\")\n\t\t\t                  .attr(\"transform\", \"translate(\" \n\t\t\t                   + (rowLabelWidth + margin.left - 10)\n\t\t\t                   + \",\" \n\t\t\t                   + (+margin.top + (colLabelHeight) + (cellSize/2)) + \")\");\n\n\n\t\t\trowGroup.selectAll(\".rowLabel\")\n\t\t\t        .data(rowNames)\n\t\t\t        .enter().append(\"text\")\n\t\t\t        .text(function (d) { return d; })\n\t\t\t        .attr(\"x\", 0)\n\t\t\t        .attr(\"y\", function (d, i) { return i * cellSize; })\n\t\t\t        .style(\"text-anchor\", \"end\")\n\t\t\t        .attr(\"class\", \"rowLabel\");\n\n\n\t\t\tvar colGroup = svg.append(\"g\")\n\t\t\t                  .attr(\"transform\", \"translate(\" \n\t\t\t\t\t                  + (margin.left + rowLabelWidth + (cellSize/3))\n\t\t\t\t\t                  + \",\" + (+margin.top + colLabelHeight) +\")\");\n\n\t\t\tcolGroup.selectAll(\".colLabel\")\n\t\t\t      .data(colNames)\n\t\t\t      .enter()\n\t\t\t      .append(\"g\")\n\t\t\t      .attr(\"transform\", function(d,i) {\n\t\t\t         return \"translate(\" + (i * cellSize) + \",0)\";\n\t\t\t      })\n\t\t\t      .append(\"text\")\n\t\t\t      .attr(\"dx\", \".8em\")\n\t\t\t      .attr(\"dy\", \".15em\")\n\t\t\t      .style(\"text-anchor\", \"start\")\n\t\t\t      .style(\"transform\", \"rotate(-45deg)\")\n\t\t\t      .attr(\"class\", \"colLabel\")\n\t\t\t      .text(function(d) { return d; });\n\n\t\t\tfor (var i = 0; i < rowNames.length; i++) {\n\t\t\t\tvar slot = rowNames[i];\n\t\t\t\trowIndex[slot] = i;\n\t\t\t}\n\t\t\tfor (var i = 0; i < colNames.length; i++) {\n\t\t\t\tvar slot = colNames[i];\n\t\t\t\tcolIndex[slot] = i;\n\t\t\t}\n\n\t\t\tvar cellGroup = svg.append(\"g\")\n\t\t\t\t               .attr(\"transform\", \"translate(\" + \n\t\t\t\t                     (rowLabelWidth + +margin.left + cellSize) + \",\" + (colLabelHeight + +margin.top + cellSize) + \")\");\n\n\t\t\tvar cells = cellGroup.selectAll(\".score\")\n\t\t\t\t\t             .data(data);\n\n\t\t\t\n\n\t\t\tcells.enter()\n\t\t\t\t .append(\"rect\")\n\t\t\t\t  .attr(\"x\", function(d) { \t\t\t\t    \n\t\t\t\t    return (cellCol(d) - 1) * cellSize; \n\t\t\t\t  })\n\t\t\t\t  .attr(\"y\", function(d) { \n\t\t\t\t    return (cellRow(d) - 1) * cellSize; \n\t\t\t\t  })\n\t\t\t\t  .attr(\"rx\", 0)\n\t\t\t\t  .attr(\"ry\", 0)\n\t\t\t\t  .attr(\"class\", \"score bordered\")\n\t\t\t\t  .attr(\"width\", cellSize)\n\t\t\t\t  .attr(\"height\", cellSize)\n\t\t\t\t  .style(\"fill\", colors[0])\n\t\t\t\t  .on(\"click\", function(d) {\n\t\t\t\t\t  \tvar cellObject = $().extend(d);\n\t\t\t\t\t  \tcellObject.rowLabel = rowNames[cellRow(d)];\n\t\t\t\t\t  \tcellObject.colLabel = colNames[cellCol(d)];\n\t\t\t            dispatch.d3click(cellObject);\n\t\t          });\n\n\t\t\tcells.transition()\n\t\t\t     .duration(1000)\n\t\t\t     .style(\"fill\", function(d) { \n\t\t\t        return colorScale(cellValue(d)); \n\t\t\t     });\n\n\t\t\t\n\n\t\t\tcells.exit().remove();\n\n\t\t\tvar interval = (colorScale.domain()[1] - colorScale.domain()[0]) / colorScale.range().length;\n\t\t\tvar breaks = d3.range(0, colorScale.range().length).map(function(i) { return colorScale.domain()[0] + d3.round(i * interval); });\n\n\t\t\tvar legendGroup = svg.append(\"g\")\n\t\t\t                     .attr(\"transform\", \"translate(\" + \n\t\t\t\t                    (rowLabelWidth + +margin.left + width + legendMargin) \n\t\t\t\t                    + \",\" \n\t\t\t\t                    + (colLabelHeight + margin.top) + \")\");\n\n\t\t\tlegendGroup.selectAll(\".legend\").remove();\n\t\t\tvar legend = legendGroup.selectAll(\".legend\")\n\t\t\t                        .data(breaks);\n\n\t\t\tlegend.enter().append(\"g\")\n\t\t\t  \t\t\t .attr(\"class\", \"legend\");\n\n\t\t\tlegend.append(\"rect\")\n\t\t\t\t\t.attr(\"x\", 0)\n\t\t\t\t\t.attr(\"y\", function(d, i) { return legendCellSize * i; })\n\t\t\t\t\t.attr(\"width\", cellSize / 2)\n\t\t\t\t\t.attr(\"height\", legendCellSize)\n\t\t\t\t\t.style(\"fill\", function(d, i) { return colors[i]; });\n\n\t\t\tlegend.append(\"text\")\n\t\t\t\t\t.attr(\"class\", \"legendLabel\")\n\t\t\t\t\t.text(function(d) { return \"≥ \" + Math.round(d); })\n\t\t\t\t\t.style(\"text-anchor\", \"start\")\n\t\t\t\t\t.attr(\"x\", cellSize)\n\t\t\t\t\t.attr(\"y\",  function(d, i) { \n\t\t\t\t\t  return (legendCellSize * i) + legendCellSize/2; \n\t\t\t\t\t})\n\n\t\t\tlegend.exit().remove();\n\n        }); \t\t\t\t\n\t}\n\tchart.cellValue = function(_) {\n\t\tif (!arguments.length) return cellValue;\n\t\t\tcellValue = _;\n\t\treturn chart;\n\t};\n\tchart.rowLabels = function(_) {\n\t\tif (!arguments.length) return rowLabels;\n\t\t\trowLabels = _;\n\t\treturn chart;\n\t};\n\tchart.colLabels = function(_) {\n\t\tif (!arguments.length) return colLabels;\n\t\t\tcolLabels = _;\n\t\treturn chart;\n\t};\n\tchart.cellData = function(_) {\n\t\tif (!arguments.length) return cellData;\n\t\t\tcellData = _;\n\t\treturn chart;\n\t};\n\tchart.cellRow = function(_) {\n\t\tif (!arguments.length) return cellRow;\n\t\t\tcellRow = _;\n\t\treturn chart;\n\t};\t\n\tchart.cellCol = function(_) {\n\t\tif (!arguments.length) return cellCol;\n\t\t\tcellCol = _;\n\t\treturn chart;\n\t};\t\n\n\tchart.margin = function(_) {\n\t\tif (!arguments.length) return margin;\n\t\t\tmargin = _;\n\t\treturn chart;\n\t};\n\tchart.cellSize = function(_) {\n\t\tif (!arguments.length) return cellSize;\n\t\t\tcellSize = _;\n\t\treturn chart;\n\t};\n\tchart.legendCellSize = function(_) {\n\t\tif (!arguments.length) return legendCellSize;\n\t\t\tlegendCellSize = _;\n\t\treturn chart;\n\t};\n\tchart.rowLabelWidth = function(_) {\n\t\tif (!arguments.length) return rowLabelWidth;\n\t\t\trowLabelWidth = _;\n\t\treturn chart;\n\t};\n\tchart.colLabelHeight = function(_) {\n\t\tif (!arguments.length) return colLabelHeight;\n\t\t\tcolLabelHeight = _;\n\t\treturn chart;\n\t};\n\tchart.buckets = function(_) {\n\t\tif (!arguments.length) return buckets;\n\t\t\tbuckets = _;\n\t\treturn chart;\n\t};\n\tchart.colors = function(_) {\n\t\tif (!arguments.length) return colors;\n\t\t\tcolors = _;\n\t\treturn chart;\n\t};\n\n\n\t// This adds the \"on\" methods to our custom exports\n\td3.rebind(chart, dispatch, \"on\");\n\n\treturn chart;\n}\n"
  },
  {
    "path": "client/index.html",
    "content": "<!DOCTYPE html>\n<meta charset=\"utf-8\">\n<html>\n  <head>\n\n    <link href='https://fonts.googleapis.com/css?family=Open+Sans' rel='stylesheet' type='text/css'>\n    <link rel=\"stylesheet\" href=\"https://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/css/bootstrap.min.css\" integrity=\"sha384-1q8mTJOASx8j1Au+a5WDVnPi2lkFfwwEAa8hDDdjZlpLegxhjVME1fgjWPGmkzs7\" crossorigin=\"anonymous\">\n    <link href=\"assets/css/bootstrap-material-design.min.css\" rel='stylesheet' type='text/css'>\n    <link href=\"assets/css/ripples.min.css\" rel='stylesheet' type='text/css'>\n    <link href=\"assets/css/tetronimos.css\" rel='stylesheet' type='text/css'>\n    <link href=\"assets/css/site.css\" rel='stylesheet' type='text/css'>\n\n  </head>\n  <body>\n    <div class=\"container\">\n      <h3>Giggle</h3>\n\n      <div id=\"control-panel\">\n        <div style=\"display:inline-block\">\n          <div id=\"region-panel\" class=\"input-panel\">\n            <label>Enter Region</label>\n            <input id=\"overlaps\" value=\"chr1:1-5000000\"></input>\n            <button id=\"go-button\" onclick=\"loadHeatmapForRegion()\" style=\"margin-left:32px;\" class=\"btn btn-default btn-raised\">Run</button>\n            <div id=\"no-region-warning\" class=\"hide alert alert-dismissible alert-info\">\n              <button type=\"button\" class=\"close\" data-dismiss=\"alert\">×</button>\n              <strong></strong>\n               Enter a region first\n            </div>          \n\n          </div>\n          <div ><label>OR</label></div>\n          <div id=\"upload-panel\" class=\"input-panel\" style=\"margin-top:0px;clear:both\">\n            <label>Upload file</label>\n            <form id=\"bed-upload-form\" style=\"display:inline-block\"  method=\"post\" enctype=\"multipart/form-data\">\n              <div class=\"form-group\" style=\"padding:0px;display:inline-block;width:230px;margin-top:0px\">\n                 <input style=\"display:inline-block;\"  name=\"file\" type=\"file\">\n                 <input type=\"text\" style=\"display:inline-block\" readonly=\"\" class=\"form-control\" placeholder=\"choose file...\">\n              </div>\n             <input id=\"upload-button\" style=\"clear:both;display:inline-block;\" class=\"btn btn-default btn-raised\" type=\"submit\" value=\"Run\">\n            </form>\n          </div>\n\n          <div id=\"no-file-warning\" class=\"hide alert alert-dismissible alert-info\">\n            <button type=\"button\" class=\"close\" data-dismiss=\"alert\">×</button>\n            <strong></strong>\n             Choose a .bed.gz or vcf.gz file to upload.\n          </div>\n          <div id=\"bad-file-warning\" class=\"hide alert alert-dismissible alert-info\">\n            <button type=\"button\" class=\"close\" data-dismiss=\"alert\">×</button>\n            <strong></strong>\n             Invalid query file. Choose a .bed.gz or vcf.gz file to upload.\n          </div>\n        </div>\n\n        <div class=\"\" style=\"vertical-align:top;display:inline-block;margin-left:40px;width:120px;\">\n          <span  class=\"radio-value-field radio radio-primary\">\n            <label>\n              <input type=\"radio\" class=\"radio-value-field\" name=\"radio-value-field\" id=\"radio-value-overlaps\" onclick=\"loadHeatmapChart()\" checked=\"true\" value=\"overlaps\">\n             Overlaps\n            </label>\n          </span>\n\n          <span id=\"radio-value-combo-span\" class=\"radio-value-field radio radio-primary\">\n            <label>\n              <input type=\"radio\" class=\"radio-value-field\" name=\"radio-value-field\" onclick=\"loadHeatmapChart()\" id=\"radio-value-combo\" value=\"combo\" >\n              Score\n            </label>\n          </span>\n\n        </div>\n\n        <div class=\"\" style=\"vertical-align:top;display:inline-block;margin-left:40px;\">\n          <div>\n            <label style=\"width:100px !important\" >Primary Index</label>\n            <input id=\"giggle-url\"/>\n          </div>\n          <div style=\"margin-top:10px;\">\n            <label style=\"width:100px !important;\">UCSC Index</label>\n            <input id=\"giggle-tracks-url\"/>\n          </div>\n        </div>\n    </div>\n\n\n    <div class=\"loader hide\"  style=\"margin-top:160px;text-align:center;\">                   \n        <div class=\"cssload-tetrominos\">\n          <div class=\"cssload-tetromino cssload-box1\"></div>\n          <div class=\"cssload-tetromino cssload-box2\"></div>\n          <div class=\"cssload-tetromino cssload-box3\"></div>\n          <div class=\"cssload-tetromino cssload-box4\"></div>\n        </div>\n    </div>    \n\n    <div id=\"chart\"></div>\n    </div>\n\n\n<div class=\"modal fade\" id=\"overlaps-modal\" tabindex=\"-1\" role=\"dialog\">\n  <div  class=\"modal-dialog\" style=\"width:350px\" role=\"document\">\n    <div class=\"modal-content\">\n      <div class=\"modal-header\" style=\"padding-top:10px;\">\n       <h3>Overlaps</h3>\n      </div>\n      <div class=\"modal-body\" style=\"height: 450px;overflow-y: scroll;margin-top: 0px;padding-top: 0px;\">\n     \n      </div>\n      <div class=\"modal-footer\" style=\"clear-both\">\n          <button type=\"button\" class=\"btn btn-default icon-button-sm btn btn-default btn-raised\" data-dismiss=\"modal\">Close</button>\n      </div>\n    </div>\n  </div>\n</div>    \n\n    <!-- Latest compiled and minified CSS -->\n    <script   src=\"https://code.jquery.com/jquery-1.12.4.min.js\"   integrity=\"sha256-ZosEbRLbNQzLpnKIkEdrPv7lOy9C27hHQ+Xp8a4MxAQ=\"   crossorigin=\"anonymous\"></script>\n\n    <script src=\"https://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/js/bootstrap.min.js\" integrity=\"sha384-0mSbJDEHialfmuBBQP6A4Qrprq5OVfW37PRR3j5ELqxss1yVqOtnepnHVP9aJ7xS\" crossorigin=\"anonymous\"></script>\n    <script src=\"assets/js/material.min.js\"></script>\n    <script src=\"assets/js/ripples.min.js\"></script>\n    <script src=\"assets/js/colorbrewer.js\"></script>\n    <script src=\"http://d3js.org/d3.v3.js\"></script>\n    <script src=\"heatmapD3.js\"></script>\n    <script src=\"app.js\"></script>\n  \n  </body>\n</html>\n"
  },
  {
    "path": "client/smartview.html",
    "content": "<!DOCTYPE html>\n<meta charset=\"utf-8\">\n<html>\n  <head>\n\n    <link href='https://fonts.googleapis.com/css?family=Open+Sans' rel='stylesheet' type='text/css'>\n    <link rel=\"stylesheet\" href=\"https://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/css/bootstrap.min.css\" integrity=\"sha384-1q8mTJOASx8j1Au+a5WDVnPi2lkFfwwEAa8hDDdjZlpLegxhjVME1fgjWPGmkzs7\" crossorigin=\"anonymous\">\n    <link href=\"assets/css/bootstrap-material-design.min.css\" rel='stylesheet' type='text/css'>\n    <link href=\"assets/css/ripples.min.css\" rel='stylesheet' type='text/css'>\n    <link href=\"assets/css/tetronimos.css\" rel='stylesheet' type='text/css'>\n    <link href=\"assets/css/site.css\" rel='stylesheet' type='text/css'>\n\n  </head>\n  <body>\n    <div class=\"container\">\n      <h3>UCSC SmartView by Giggle</h3>\n\n      <div id=\"smartview-form\">\n          <div style=\"margin-top:10px;\">\n            <label style=\"width:100px !important;\">Index</label>\n            <input id=\"giggle-tracks-url\"/>\n          </div>\n          <div style=\"margin-top:10px;\">\n            <label style=\"width:100px !important;\">Region</label>\n            <input id=\"overlaps\" value=\"chr4:99990000-100010000\"></input>\n          </div>\n\n          <button id=\"go-button\" onclick=\"loadUCSCSmartView()\" style=\"margin-left:0px;\" class=\"btn btn-default btn-raised\">View</button>\n\n      </div>\n\n    <!-- Latest compiled and minified CSS -->\n    <script   src=\"https://code.jquery.com/jquery-1.12.4.min.js\"   integrity=\"sha256-ZosEbRLbNQzLpnKIkEdrPv7lOy9C27hHQ+Xp8a4MxAQ=\"   crossorigin=\"anonymous\"></script>\n\n    <script src=\"https://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/js/bootstrap.min.js\" integrity=\"sha384-0mSbJDEHialfmuBBQP6A4Qrprq5OVfW37PRR3j5ELqxss1yVqOtnepnHVP9aJ7xS\" crossorigin=\"anonymous\"></script>\n    <script src=\"assets/js/material.min.js\"></script>\n    <script src=\"assets/js/ripples.min.js\"></script>\n    <script src=\"assets/js/colorbrewer.js\"></script>\n    <script src=\"http://d3js.org/d3.v3.js\"></script>\n    <script src=\"heatmapD3.js\"></script>\n    <script src=\"app.js\"></script>\n  \n  </body>\n</html>\n"
  },
  {
    "path": "data/human.hg19.genome",
    "content": "chr1\t249250621\nchr2\t243199373\nchr3\t198022430\nchr4\t191154276\nchr5\t180915260\nchr6\t171115067\nchr7\t159138663\nchrX\t155270560\nchr8\t146364022\nchr9\t141213431\nchr10\t135534747\nchr11\t135006516\nchr12\t133851895\nchr13\t115169878\nchr14\t107349540\nchr15\t102531392\nchr16\t90354753\nchr17\t81195210\nchr18\t78077248\nchr20\t63025520\nchrY\t59373566\nchr19\t59128983\nchr22\t51304566\nchr21\t48129895\nchr6_ssto_hap7\t4928567\nchr6_mcf_hap5\t4833398\nchr6_cox_hap2\t4795371\nchr6_mann_hap4\t4683263\nchr6_apd_hap1\t4622290\nchr6_qbl_hap6\t4611984\nchr6_dbb_hap3\t4610396\nchr17_ctg5_hap1\t1680828\nchr4_ctg9_hap1\t590426\nchr1_gl000192_random\t547496\nchrUn_gl000225\t211173\nchr4_gl000194_random\t191469\nchr4_gl000193_random\t189789\nchr9_gl000200_random\t187035\nchrUn_gl000222\t186861\nchrUn_gl000212\t186858\nchr7_gl000195_random\t182896\nchrUn_gl000223\t180455\nchrUn_gl000224\t179693\nchrUn_gl000219\t179198\nchr17_gl000205_random\t174588\nchrUn_gl000215\t172545\nchrUn_gl000216\t172294\nchrUn_gl000217\t172149\nchr9_gl000199_random\t169874\nchrUn_gl000211\t166566\nchrUn_gl000213\t164239\nchrUn_gl000220\t161802\nchrUn_gl000218\t161147\nchr19_gl000209_random\t159169\nchrUn_gl000221\t155397\nchrUn_gl000214\t137718\nchrUn_gl000228\t129120\nchrUn_gl000227\t128374\nchr1_gl000191_random\t106433\nchr19_gl000208_random\t92689\nchr9_gl000198_random\t90085\nchr17_gl000204_random\t81310\nchrUn_gl000233\t45941\nchrUn_gl000237\t45867\nchrUn_gl000230\t43691\nchrUn_gl000242\t43523\nchrUn_gl000243\t43341\nchrUn_gl000241\t42152\nchrUn_gl000236\t41934\nchrUn_gl000240\t41933\nchr17_gl000206_random\t41001\nchrUn_gl000232\t40652\nchrUn_gl000234\t40531\nchr11_gl000202_random\t40103\nchrUn_gl000238\t39939\nchrUn_gl000244\t39929\nchrUn_gl000248\t39786\nchr8_gl000196_random\t38914\nchrUn_gl000249\t38502\nchrUn_gl000246\t38154\nchr17_gl000203_random\t37498\nchr8_gl000197_random\t37175\nchrUn_gl000245\t36651\nchrUn_gl000247\t36422\nchr9_gl000201_random\t36148\nchrUn_gl000235\t34474\nchrUn_gl000239\t33824\nchr21_gl000210_random\t27682\nchrUn_gl000231\t27386\nchrUn_gl000229\t19913\nchrM\t16571\nchrMT\t16571\nchrUn_gl000226\t15008\nchr18_gl000207_random\t4262\n\n"
  },
  {
    "path": "docs/app.js",
    "content": "var heatmap = null;\n\nvar giggleUrl            = \"http://localhost:8080/\";\nvar giggleUCSCBrowserUrl = \"http://localhost:8081/\";\nvar ucscBrowserUrl       = \"https://genome.ucsc.edu/cgi-bin/hgTracks?db=hg19\";\n\nvar sourceFileMap = {};\t\nvar coordMap = {};\nvar def = null;\nvar dataForChart = null;\nvar valueField = \"overlaps\";\n\nvar uploadedFileName = null;\n\nvar ucscFileMap = {};\nvar ucscTrackNames = [];\n\n$.urlParam = function(name){\n    var results = new RegExp('[\\?&]' + name + '=([^&#]*)').exec(window.location.href);\n    if (results==null){\n        return null;\n    }else{\n        return results[1] || 0;\n    }\n}\n\n$(document).ready(function() {\n        if (decodeURIComponent($.urlParam('primary_index')) != 'null') {\n           giggleUrl = \"http://\" + decodeURIComponent($.urlParam('primary_index'));\n        } \n\n        if (decodeURIComponent($.urlParam('ucsc_index')) != 'null') {\n           giggleUCSCBrowserUrl = \"http://\" + decodeURIComponent($.urlParam('ucsc_index'));\n        } \n\n\n\t$.material.init();\n\n\t$('#giggle-url').val(giggleUrl);\n\t$('#giggle-tracks-url').val(giggleUCSCBrowserUrl);\n\n\tinitBedUploadForm();\n\n\tpromiseLoadMatrixDefinition().then( function() {\n\t\theatmap = new heatmapD3().cellSize(15)\n\t                             .legendCellSize(20)\n\t                             .margin({top: 10, bottom: 10, left: 10, right: 70})\n\t                             .colors(colorbrewer.YlGnBu[9])\n\t                             //.colors(colorbrewer.Oranges[9]);\n\t                             .cellValue( function(d) { return +d[valueField]; } )\n\t                             .on('d3click', function(d,i) {\n\t                             \tloadOverlapDetail(d.name, d.row, d.col);\n\t                             });\n\n\n\t\tloadHeatmapForRegion();\n\n\t});\n\n        loadUCSCDefinition();\n});\n\nfunction loadUCSCSmartView() {\n\n    \tif ($('#overlaps').val() == null || $('#overlaps').val().trim() == \"\") {\n\t\t$('#no-region-warning').removeClass(\"hide\");\n\t\treturn;\n\t}\n\n\tvar giggleTracksUrl = giggleUCSCBrowserUrl + \"?region=\" + $('#overlaps').val();\n\n\t$.ajax({\n\t    url: giggleTracksUrl,\n\t    type: \"GET\",\n\t    crossDomain: true,\n\t    dataType: \"text\",\n\t    success: function(data) {\n\t    \tvar records = [];\n\t\t\tdata.split(\"\\n\").forEach(function(row) {\n\t\t\t\tif (row == null || row.trim() == \"\") {\n\n\t\t\t\t} else {\n\t\t\t\t\tfields = row.split(\"\\t\");\n\n\t\t\t\t\t\n\t\t\t\t\tvar rec = {};\n\t\t\t\t\trec.name     = fields[0].split(\"/\")[1];\n\t\t\t\t\trec.size     = fields[1];\n\t\t\t\t\trec.overlaps = fields[2];\n\n\t\t\t\t\tvar pos      = ucscFileMap[rec.name];\n\t\t\t\t\trec.pos      = pos;\n\t\t\t\t\trec.trackName = ucscTrackNames[+pos];\n\t\t\t\t\trecords.push(rec);\n\n\t\t\t\t}\n\t\t\t});\n\n\t\t\t//var ucscTracksUrl = ucscBrowserUrl + '&position=' + chr + \":\" + start + '-' + end;\n\t\t\tvar ucscTracksUrl = ucscBrowserUrl + '&position=' + $('#overlaps').val();\n\t\t\trecords.forEach( function(record) {\n                                if (record.trackName) {\n\t\t\t\t    if (+record.overlaps > 0) {\n\t\t\t\t\t    ucscTracksUrl += \"&\" + record.trackName + \"=dense\";\n\t\t\t\t    } else {\n\t\t\t\t\t    ucscTracksUrl += \"&\" + record.trackName + \"=hide\";\n                                    }\n                                }\n\t\t\t});\n\t\t\tvar newTab = window.open(ucscTracksUrl, '_blank');\n\t\t\t//newTab.focus();\n\t    },\n\t    error: function(error) {\n\t    \tconsole.log(\"An error occurred when getting UCSC track info \" + giggleTracksUrl);\n\t    \tconsole.error();\n\t    }\n\t});\n\n//function loadUCSCTracks(chr, start, end) {\n}\n\nfunction loadUCSCDefinition() {\n\n\tvar giggleTracksDefUrl = giggleUCSCBrowserUrl + \"?data\";\n\n\t$.ajax({\n\t    url: giggleTracksDefUrl,\n\t    type: \"GET\",\n\t    crossDomain: true,\n\t    dataType: \"text\",\n\t    success: function(data) {\n\n\t    \tvar def = JSON.parse(data);\n\t\t\tdef.sourceFiles.forEach( function( sourceFile ) {\n\t\t\t\tvar fileName = sourceFile.name.split(\"/\")[1];\n\t\t\t\tucscFileMap[fileName] = sourceFile.position[0];\n\t\t\t});\n\n\t\t\tdef.dimensions[0].elements.forEach( function(trackName) {\n\t\t\t\tucscTrackNames.push(trackName);\n\t\t\t})\n\t\t\t\n\n\t\t},\n\t    error: function(error) {\n\t    \tconsole.error;\n\t    }\n\t});\t\n\n}\n\nfunction loadUCSCTracks(chr, start, end) {\n\tvar giggleTracksUrl = giggleUCSCBrowserUrl + \"?region=\" + chr + \":\" + start + '-' + end;\n\t$.ajax({\n\t    url: giggleTracksUrl,\n\t    type: \"GET\",\n\t    crossDomain: true,\n\t    dataType: \"text\",\n\t    success: function(data) {\n\t    \tvar records = [];\n\t\t\tdata.split(\"\\n\").forEach(function(row) {\n\t\t\t\tif (row == null || row.trim() == \"\") {\n\n\t\t\t\t} else {\n\t\t\t\t\tfields = row.split(\"\\t\");\n\t\t\t\t\t\n\t\t\t\t\tvar rec = {};\n\t\t\t\t\trec.name     = fields[0].split(\"/\")[1];\n\t\t\t\t\trec.size     = fields[1];\n\t\t\t\t\trec.overlaps = fields[2];\n\n\t\t\t\t\tvar pos      = ucscFileMap[rec.name];\n\t\t\t\t\trec.pos      = pos;\n\t\t\t\t\trec.trackName = ucscTrackNames[+pos];\n\t\t\t\t\trecords.push(rec);\n\n\t\t\t\t}\n\t\t\t});\n\n\t\t\tvar ucscTracksUrl = ucscBrowserUrl + '&position=' + chr + \":\" + start + '-' + end;\n\t\t\trecords.forEach( function(record) {\n\t\t\t\tif (+record.overlaps > 0) {\n\t\t\t\t\tucscTracksUrl += \"&\" + record.trackName + \"=dense\";\n\t\t\t\t} else {\n\t\t\t\t\t    ucscTracksUrl += \"&\" + record.trackName + \"=hide\";\n                                }\n\t\t\t});\n\t\t\tvar newTab = window.open(ucscTracksUrl, '_blank');\n\t\t\t//newTab.focus();\n\n\n\n\n\t    },\n\t    error: function(error) {\n\t    \tconsole.log(\"An error occurred when getting UCSC track info \" + giggleTracksUrl);\n\t    \tconsole.error();\n\t    }\n\t});\n}\n\n\nfunction loadOverlapDetail(fileName, row, col) {\n\tvar rowLabel = coordMap[row + '-' + col].rowLabel;\n\tvar colLabel = coordMap[row + '-' + col].colLabel;\n\n\tvar detailUrl = giggleUrl;\n\tif (uploadedFileName) {\n\t\tdetailUrl += \"?query=\" + uploadedFileName;\n\t} else {\n\t\tdetailUrl += \"?region=\" + $('#overlaps').val();\n\t}\n\tdetailUrl += \"&files=\" + fileName + \"&full\";\n\t$.ajax({\n\t    url: detailUrl,\n\t    type: \"GET\",\n\t    crossDomain: true,\n\t    dataType: \"text\",\n\t    success: function(data) {\n\t    \tvar results = [];\n\t    \tvar header = null;\n\t    \tvar records = [];\n\t\t\tdata.split(\"\\n\").forEach(function(row) {\n\t\t\t\tif (row == null || row.trim() == \"\") {\n\n\t\t\t\t} else {\n\t\t\t\t\tfields = row.split(\"\\t\");\n\t\t\t\t\tif (row.indexOf(\"#\") == 0) {\n\t\t\t\t\t\tif (header) {\n\t\t\t\t\t\t\tresults.push({'header': header, 'rows': records});\n\t\t\t\t\t\t\trecs = [];\n\t\t\t\t\t\t}\n\t\t\t\t\t\theader = {};\n\t\t\t\t\t\theader.name = fields[0].split(\"/\")[1];\n\t\t\t\t\t\theader.size = fields[1];\n\t\t\t\t\t\theader.overlaps = fields[2];\n\t\t\t\t\t} else {\n\t\t\t\t\t\tvar rec = {};\n\t\t\t\t\t\trec.chr   = fields[0];\n\t\t\t\t\t\trec.start = fields[1];\n\t\t\t\t\t\trec.end   = fields[2];\n\t\t\t\t\t\trecords.push(rec);\n\t\t\t\t\t}\n\n\t\t\t\t}\n\t\t\t});\n\t\t\tif (header) {\t\t\t\t\n\t\t\t\tresults.push({'header': header, 'rows': records});\n\t\t\t}\n\t\t\t$('#overlaps-modal .modal-header').html(\"<h5>\" + rowLabel + \"  -  \" + colLabel + \"</h5>\");\n\t\t\t$('#overlaps-modal .modal-body').html(\"\");\n\n\t\t\tresults.forEach(function(result) {\n\t\t\t\tvar content = \"\";\n\t\t\t\tcontent += \"<table style='width:100%'>\";\n\t\t\t\t\n\t\t\t\tvar rowNbr = 1;\n\t\t\t\tresult.rows.forEach( function(row) {\n\t\t\t\t\tcontent += \n\t\t\t\t\t\t \"<tr>\" \n\t\t\t\t\t\t+   \"<td>\" + rowNbr++ + \".</td>\"\n\t\t\t\t\t\t+ \"<td>\" + \"<a href='javascript:void(0)' onclick=\\\"loadUCSCTracks(\" + \"'\" + row.chr + \"',\" + row.start + ',' + row.end + \")\\\">\" +row.chr + ' ' + addCommas(row.start) + '-' +  addCommas(row.end) + \"</a></td>\"\n\t\t\t\t\t    + \"</tr>\";\n\t\t\t\t});\n\t\t\t\tcontent += \"</table>\";\n\t\t\t\t$('#overlaps-modal .modal-body').append(content);\n\t\t\t});\n\n\n\n\t\t\t$('#overlaps-modal').modal('show');\n\t\t\t\n\t\t  \n\n\t    },\n\t    error: function(error) {\n\t    \tconsole.log(\"An error occurred when getting overlap detail \" + detailUrl);\n\t    \tconsole.error();\n\t    }\n\t});\t\n\n}\n\n\nfunction promiseLoadMatrixDefinition() {\n\treturn new Promise( function(resolve, reject) {\n\t\tvar defUrl  = giggleUrl + \"?data\";\n\t\tdef = null;\n\t\tsourceFileMap = {};\t\n\n\t\t// Get matrix definition\n\t\t$.ajax({\n\t\t    url: defUrl,\n\t\t    type: \"GET\",\n\t\t    crossDomain: true,\n\t\t    dataType: \"text\",\n\t\t    success: function(data) {\n\t\t    \tdef = JSON.parse(data);\n\t\t\t\tdef.sourceFiles.forEach( function( sourceFile ) {\n\t\t\t\t\tvar cellCoord = {};\n\t\t\t\t\tcellCoord.row = sourceFile.position[0];\n\t\t\t\t\tcellCoord.col = sourceFile.position[1];\n\t\t\t\t\tsourceFileMap[sourceFile.name] = cellCoord;\n\t\t\t\t\tcoordMap[cellCoord.row + \"-\" + cellCoord.col] = {rowLabel: def.dimensions[0].elements[cellCoord.row], colLabel: def.dimensions[1].elements[cellCoord.col]};\n\t\t\t\t});\n\t\t\t\tdef.cells = [];\n\t\t\t\tresolve(def);\n\n\t\t\t},\n\t\t    error: function(error) {\n\t\t    \tconsole.error();\n\t\t    \treject('Unable to get matrix definition ' + error);\n\t\t    }\n\t\t});\n\n\t});\n}\n\nfunction initBedUploadForm() {\n\n\n\t$('#bed-upload-form').submit( function(e){\n\t\te.preventDefault();\n\n\t\t$(\".input-panel\").removeClass(\"selected\");\n\n\t\t// Validate that file was uploaded\n\t\t$('.alert').addClass(\"hide\");\n\t\tif ($('#bed-upload-form input[type=file]')[0].files.length == 0) {\n\t\t\t$('#no-file-warning').removeClass(\"hide\");\t\t\n\t\t\treturn;\t\n\t\t}\n\n\t\tuploadedFileName =  $('#bed-upload-form input[type=file]')[0].files[0].name;\n\n\t\t// Enable odds ratio and default as checked\n\t\t//$(\"#radio-value-ratio\").prop(\"checked\", true);\n\t\t//$(\"#radio-value-ratio-span\").removeClass(\"hide\");\n\t\t$(\"#radio-value-combo\").prop(\"checked\", true);\n\t\t$(\"#radio-value-combo-span\").removeClass(\"hide\");\n\n\t\t// Highlight upload panel\n\t\t$(\"#upload-panel\").addClass(\"selected\");\n\n\t\t// Show loading gif\n\t\t$('.loader').removeClass(\"hide\");\n\n\n\t    \n\t    var formData = new FormData(this);\n\t\t//formData.append(uploadedFileName, $('#bed-upload-form input[type=file]')[0].files[0]);\n\t    \n\t    getGiggleUrls();\n\n\t    var url = giggleUrl + \"filepost\";\n\n\t    $.ajax({\n\t        url         : url,\n\t        data        : formData,\n \t        cache       : false,\n\t        contentType : false,\n\t        processData : false,\n\t        type        : 'POST',\n\t        success     : function(data, textStatus, jqXHR){\n\t            $('.loader').addClass(\"hide\");\n\t            loadHeatmapChart(data, def);\n\t        },\n\t        error       : function(error) {\n                    $('.loader').addClass(\"hide\");\n                    if (error.success().hasOwnProperty(\"responseText\") && error.success().responseText.length > 0) {\n                        loadHeatmapChart( error.success().responseText, def);\n                    }\n                    console.error();      \t\n\t        }\n\t    });\n\t});\t\n}\n\nfunction getGiggleUrls() {\n\tgiggleUrl = $('#giggle-url').val();\n\tgiggleUCSCBrowserUrl = $('#giggle-tracks-url').val();\n\n\tgiggleUrl += '/'\n\tgiggleUCSCBrowserUrl += '/'\n}\n\n\nfunction loadHeatmapForRegion() {\n\t$(\".input-panel\").removeClass(\"selected\");\n\n\t// Validate that region was filled in\n\t$('.alert').addClass(\"hide\");\n\tif ($('#overlaps').val() == null || $('#overlaps').val().trim() == \"\") {\n\t\t$('#no-region-warning').removeClass(\"hide\");\n\t\treturn;\n\t}\n\n\t// Switch to 'overlap' and disable 'odds ratio'\n\t$(\"#radio-value-overlaps\").prop(\"checked\", true);\n\t$(\"#radio-value-ratio-span\").addClass(\"hide\");\n\n\t// Highlight region panel\n\t$(\"#region-panel\").addClass(\"selected\");\n\n\n\t// Show loading animation\n\t$('.loader').removeClass(\"hide\");\n\n\n\tgetGiggleUrls();\n\tvar dataUrl = giggleUrl + \"?region=\" + $('#overlaps').val();\n\n\tuploadedFileName = null;\n\n\t// get matrix data (tab delimited) and fill in heatmap\n\t$.ajax({\n\t    url: dataUrl,\n\t    type: \"GET\",\n\t    crossDomain: true,\n\t    dataType: \"text\",\n\t    success: function(data) {\n\t        $('.loader').addClass(\"hide\");\n\t    \tloadHeatmapChart(data, def);\n\n\t    },\n\t    error: function(error) {\n\t    \t$('.loader').addClass(\"hide\");\n\t    }\n\t});\n\n}\n\nfunction loadHeatmapChart(data, theDef) {\n\tdef = theDef ? theDef : def; \n\tdataForChart = data ? data : dataForChart;\n\tdef.cells = [];\n\n\tif($(\"input[type='radio'].radio-value-field\").is(':checked')) {\n    \tvalueField = $(\"input[type='radio'].radio-value-field:checked\").val();    \t\n\t}\n\n\tdataForChart.split(\"\\n\").forEach(function(row) {\n\t\tfields = row.split(\"\\t\");\n                if (fields[0] == \"QueryFileError\") {\n                    $('#bad-file-warning').removeClass(\"hide\");\t\t\n\t            return;\t\n                }\n\n\t\tif (fields.length == 0 || fields[0] == \"\") {\n                    \n\t\t} else {\n\t\t\tvar rec = {};\n\t\t\trec.name = fields[0].split(\"/\")[1];\n\t\t\trec.size = fields[1];\n\t\t\tvar overlaps = fields[2];\n\t\t\tif (overlaps.indexOf(\":\") > 0) {\n\t\t\t\trec.overlaps = overlaps.split(\":\")[1];\n\t\t\t} else {\n\t\t\t\trec.overlaps = overlaps;\n\t\t\t}\n\t\t\tif (fields.length > 3) {\n\t\t\t\tvar ratio = fields[3];\n\t\t\t\tif (ratio.indexOf(\":\") > 0) {\n\t\t\t\t\trec.ratio = ratio.split(\":\")[1];\n\t\t\t\t} else {\n\t\t\t\t\trec.ratio = ratio;\n\t\t\t\t}\t\t\t\t\n\t\t\t}\n\t\t\tif (fields.length > 4) {\n\t\t\t\tvar sig = fields[4];\n\t\t\t\tif (sig.indexOf(\":\") > 0) {\n\t\t\t\t\trec.sig = sig.split(\":\")[1];\n\t\t\t\t} else {\n\t\t\t\t\trec.sig = sig;\n\t\t\t\t}\t\n\t\t\t\trec.sig = rec.sig * 100;\t\t\t\n\t\t\t}\n\t\t\tif (fields.length > 5) {\n\t\t\t\tvar combo = fields[5];\n\t\t\t\tif (combo.indexOf(\":\") > 0) {\n\t\t\t\t\trec.combo = combo.split(\":\")[1];\n\t\t\t\t} else {\n\t\t\t\t\trec.combo = combo;\n\t\t\t\t}\t\n\t\t\t}\n\n\t\t\trec.row = sourceFileMap[rec.name].row;\n\t\t\trec.col = sourceFileMap[rec.name].col;\n\t\t\tdef.cells.push(rec);\n\t\t}\n\t});\n\n        if ( def.cells.length > 0) {\n            maxValue = d3.max(def.cells, function(d,i) {return d.overlaps});\n            if (maxValue <= 2) {\n                    maxValue = 3;\n            }\n            heatmap.colors(colorbrewer.YlGnBu[Math.min(maxValue, 9)])\n\n            \n            var selection = d3.select(\"#chart\").datum(def);\n            heatmap(selection);\t\n        }\n}\n\nfunction addCommas(nStr)\n{\n\tnStr += '';\n\tx = nStr.split('.');\n\tx1 = x[0];\n\tx2 = x.length > 1 ? '.' + x[1] : '';\n\tvar rgx = /(\\d+)(\\d{3})/;\n\twhile (rgx.test(x1)) {\n\t\tx1 = x1.replace(rgx, '$1' + ',' + '$2');\n\t}\n\treturn x1 + x2;\n}\n"
  },
  {
    "path": "docs/assets/css/site.css",
    "content": "body {\n  font-family: 'Open Sans';\n  background-color: white;\n  color:  #757474;\n  font-size: 13px;\n}\nh3 {\n  margin-top: 5px;\n  margin-bottom: 3px;  \n}\nh4 {\n  text-align: center;\n  margin-bottom: 0px;  \n}\n.rowLabel, .colLabel, .legendLabel {\n  font-size:11px;\n  fill: #757474;\n}\nrect.bordered {\n  stroke: #E6E6E6;\n  stroke-width:2px;   \n}\n.checkbox label, .radio label, label {\n  color: #757474;\n  font-size: 13px;\n}\n.radio-value-field.radio label span {\n  left: 25px;\n}\n#go-button {\n  font-size: 13px;\n  padding-bottom: 5px;\n  padding-top: 5px;\n  margin-top: 0px;        \n}\n#upload-button {\n  font-size: 13px;\n  padding-bottom: 5px;\n  padding-top: 5px;\n  margin-top: 0px;        \n}\n#control-panel {\n  margin-top:0px;\n}\n#overlaps {\n  width: 200px;\n}\nlabel {\n  width: 80px !important;\n}\n.radio-value-field label {\n  width: 100% !important;\n}\n.form-control {\n  font-size: 13px !important;\n}\n::-webkit-input-placeholder {\n   font-size: 13px !important;\n} \n.checkbox, .radio {\n  margin-top: 0px;\n}\ninput#giggle-url {\n  width: 300px !important;\n}\ninput#giggle-tracks-url {\n  width: 300px !important;\n}\n#region-panel {\n  padding: 3px;\n}\n#upload-panel {\n  padding: 3px;\n}\n.selected {\n  background-color: #fffad5;\n}\n.alert.alert-info {\n    background-color: #569ca0;\n    color: white;\n    margin-top: 3px;\n}"
  },
  {
    "path": "docs/assets/css/tetronimos.css",
    "content": ".cssload-tetrominos {\n  position: absolute;\n  left: 50%;\n  transform: translate(-62px, -53px);\n    -o-transform: translate(-62px, -53px);\n    -ms-transform: translate(-62px, -53px);\n    -webkit-transform: translate(-62px, -53px);\n    -moz-transform: translate(-62px, -53px);\n}\n\n.cssload-tetromino {\n  width: 53px;\n  height: 62px;\n  position: absolute;\n  transition: all ease 0.255s;\n    -o-transition: all ease 0.255s;\n    -ms-transition: all ease 0.255s;\n    -webkit-transition: all ease 0.255s;\n    -moz-transition: all ease 0.255s;\n  background: url('data:image/svg+xml;utf-8,%3Csvg xmlns=\"http://www.w3.org/2000/svg\" viewBox=\"0 0 612 684\"%3E%3Cpath fill=\"rgba(29, 145, 192, .8)\" d=\"M305.7 0L0 170.9v342.3L305.7 684 612 513.2V170.9L305.7 0z\"/%3E%3Cpath fill=\"rgb(127, 205, 187)\" d=\"M305.7 80.1l-233.6 131 233.6 131 234.2-131-234.2-131\"/%3E%3C/svg%3E') no-repeat top center;\n}\n\n.cssload-box1 {\n  animation: cssload-tetromino1 1.275s ease-out infinite;\n    -o-animation: cssload-tetromino1 1.275s ease-out infinite;\n    -ms-animation: cssload-tetromino1 1.275s ease-out infinite;\n    -webkit-animation: cssload-tetromino1 1.275s ease-out infinite;\n    -moz-animation: cssload-tetromino1 1.275s ease-out infinite;\n}\n\n.cssload-box2 {\n  animation: cssload-tetromino2 1.275s ease-out infinite;\n    -o-animation: cssload-tetromino2 1.275s ease-out infinite;\n    -ms-animation: cssload-tetromino2 1.275s ease-out infinite;\n    -webkit-animation: cssload-tetromino2 1.275s ease-out infinite;\n    -moz-animation: cssload-tetromino2 1.275s ease-out infinite;\n}\n\n.cssload-box3 {\n  animation: cssload-tetromino3 1.275s ease-out infinite;\n    -o-animation: cssload-tetromino3 1.275s ease-out infinite;\n    -ms-animation: cssload-tetromino3 1.275s ease-out infinite;\n    -webkit-animation: cssload-tetromino3 1.275s ease-out infinite;\n    -moz-animation: cssload-tetromino3 1.275s ease-out infinite;\n  z-index: 2;\n}\n\n.cssload-box4 {\n  animation: cssload-tetromino4 1.275s ease-out infinite;\n    -o-animation: cssload-tetromino4 1.275s ease-out infinite;\n    -ms-animation: cssload-tetromino4 1.275s ease-out infinite;\n    -webkit-animation: cssload-tetromino4 1.275s ease-out infinite;\n    -moz-animation: cssload-tetromino4 1.275s ease-out infinite;\n}\n\n\n\n\n\n\n\n\n\n@keyframes cssload-tetromino1 {\n  0%, 40% {\n    transform: translate(0, 0);\n  }\n  50% {\n    transform: translate(26px, -15px);\n  }\n  60%, 100% {\n    transform: translate(53px, 0);\n  }\n}\n\n@-o-keyframes cssload-tetromino1 {\n  0%, 40% {\n    -o-transform: translate(0, 0);\n  }\n  50% {\n    -o-transform: translate(26px, -15px);\n  }\n  60%, 100% {\n    -o-transform: translate(53px, 0);\n  }\n}\n\n@-ms-keyframes cssload-tetromino1 {\n  0%, 40% {\n    -ms-transform: translate(0, 0);\n  }\n  50% {\n    -ms-transform: translate(26px, -15px);\n  }\n  60%, 100% {\n    -ms-transform: translate(53px, 0);\n  }\n}\n\n@-webkit-keyframes cssload-tetromino1 {\n  0%, 40% {\n    -webkit-transform: translate(0, 0);\n  }\n  50% {\n    -webkit-transform: translate(26px, -15px);\n  }\n  60%, 100% {\n    -webkit-transform: translate(53px, 0);\n  }\n}\n\n@-moz-keyframes cssload-tetromino1 {\n  0%, 40% {\n    -moz-transform: translate(0, 0);\n  }\n  50% {\n    -moz-transform: translate(26px, -15px);\n  }\n  60%, 100% {\n    -moz-transform: translate(53px, 0);\n  }\n}\n\n@keyframes cssload-tetromino2 {\n  0%, 20% {\n    transform: translate(53px, 0px);\n  }\n  40%, 100% {\n    transform: translate(79px, 15px);\n  }\n}\n\n@-o-keyframes cssload-tetromino2 {\n  0%, 20% {\n    -o-transform: translate(53px, 0px);\n  }\n  40%, 100% {\n    -o-transform: translate(79px, 15px);\n  }\n}\n\n@-ms-keyframes cssload-tetromino2 {\n  0%, 20% {\n    -ms-transform: translate(53px, 0px);\n  }\n  40%, 100% {\n    -ms-transform: translate(79px, 15px);\n  }\n}\n\n@-webkit-keyframes cssload-tetromino2 {\n  0%, 20% {\n    -webkit-transform: translate(53px, 0px);\n  }\n  40%, 100% {\n    -webkit-transform: translate(79px, 15px);\n  }\n}\n\n@-moz-keyframes cssload-tetromino2 {\n  0%, 20% {\n    -moz-transform: translate(53px, 0px);\n  }\n  40%, 100% {\n    -moz-transform: translate(79px, 15px);\n  }\n}\n\n@keyframes cssload-tetromino3 {\n  0% {\n    transform: translate(79px, 15px);\n  }\n  20%, 60% {\n    transform: translate(53px, 30px);\n  }\n  90%, 100% {\n    transform: translate(26px, 15px);\n  }\n}\n\n@-o-keyframes cssload-tetromino3 {\n  0% {\n    -o-transform: translate(79px, 15px);\n  }\n  20%, 60% {\n    -o-transform: translate(53px, 30px);\n  }\n  90%, 100% {\n    -o-transform: translate(26px, 15px);\n  }\n}\n\n@-ms-keyframes cssload-tetromino3 {\n  0% {\n    -ms-transform: translate(79px, 15px);\n  }\n  20%, 60% {\n    -ms-transform: translate(53px, 30px);\n  }\n  90%, 100% {\n    -ms-transform: translate(26px, 15px);\n  }\n}\n\n@-webkit-keyframes cssload-tetromino3 {\n  0% {\n    -webkit-transform: translate(79px, 15px);\n  }\n  20%, 60% {\n    -webkit-transform: translate(53px, 30px);\n  }\n  90%, 100% {\n    -webkit-transform: translate(26px, 15px);\n  }\n}\n\n@-moz-keyframes cssload-tetromino3 {\n  0% {\n    -moz-transform: translate(79px, 15px);\n  }\n  20%, 60% {\n    -moz-transform: translate(53px, 30px);\n  }\n  90%, 100% {\n    -moz-transform: translate(26px, 15px);\n  }\n}\n\n@keyframes cssload-tetromino4 {\n  0%, 60% {\n    transform: translate(26px, 15px);\n  }\n  90%, 100% {\n    transform: translate(0, 0);\n  }\n}\n\n@-o-keyframes cssload-tetromino4 {\n  0%, 60% {\n    -o-transform: translate(26px, 15px);\n  }\n  90%, 100% {\n    -o-transform: translate(0, 0);\n  }\n}\n\n@-ms-keyframes cssload-tetromino4 {\n  0%, 60% {\n    -ms-transform: translate(26px, 15px);\n  }\n  90%, 100% {\n    -ms-transform: translate(0, 0);\n  }\n}\n\n@-webkit-keyframes cssload-tetromino4 {\n  0%, 60% {\n    -webkit-transform: translate(26px, 15px);\n  }\n  90%, 100% {\n    -webkit-transform: translate(0, 0);\n  }\n}\n\n@-moz-keyframes cssload-tetromino4 {\n  0%, 60% {\n    -moz-transform: translate(26px, 15px);\n  }\n  90%, 100% {\n    -moz-transform: translate(0, 0);\n  }\n}      "
  },
  {
    "path": "docs/assets/js/colorbrewer.js",
    "content": "// This product includes color specifications and designs developed by Cynthia Brewer (http://colorbrewer.org/).\n// JavaScript specs as packaged in the D3 library (d3js.org). Please see license at http://colorbrewer.org/export/LICENSE.txt\nvar colorbrewer = {YlGn: {\n3: [\"#f7fcb9\",\"#addd8e\",\"#31a354\"],\n4: [\"#ffffcc\",\"#c2e699\",\"#78c679\",\"#238443\"],\n5: [\"#ffffcc\",\"#c2e699\",\"#78c679\",\"#31a354\",\"#006837\"],\n6: [\"#ffffcc\",\"#d9f0a3\",\"#addd8e\",\"#78c679\",\"#31a354\",\"#006837\"],\n7: [\"#ffffcc\",\"#d9f0a3\",\"#addd8e\",\"#78c679\",\"#41ab5d\",\"#238443\",\"#005a32\"],\n8: [\"#ffffe5\",\"#f7fcb9\",\"#d9f0a3\",\"#addd8e\",\"#78c679\",\"#41ab5d\",\"#238443\",\"#005a32\"],\n9: [\"#ffffe5\",\"#f7fcb9\",\"#d9f0a3\",\"#addd8e\",\"#78c679\",\"#41ab5d\",\"#238443\",\"#006837\",\"#004529\"]\n},YlGnBu: {\n3: [\"#edf8b1\",\"#7fcdbb\",\"#2c7fb8\"],\n4: [\"#ffffcc\",\"#a1dab4\",\"#41b6c4\",\"#225ea8\"],\n5: [\"#ffffcc\",\"#a1dab4\",\"#41b6c4\",\"#2c7fb8\",\"#253494\"],\n6: [\"#ffffcc\",\"#c7e9b4\",\"#7fcdbb\",\"#41b6c4\",\"#2c7fb8\",\"#253494\"],\n7: [\"#ffffcc\",\"#c7e9b4\",\"#7fcdbb\",\"#41b6c4\",\"#1d91c0\",\"#225ea8\",\"#0c2c84\"],\n8: [\"#ffffd9\",\"#edf8b1\",\"#c7e9b4\",\"#7fcdbb\",\"#41b6c4\",\"#1d91c0\",\"#225ea8\",\"#0c2c84\"],\n9: [\"#ffffd9\",\"#edf8b1\",\"#c7e9b4\",\"#7fcdbb\",\"#41b6c4\",\"#1d91c0\",\"#225ea8\",\"#253494\",\"#081d58\"]\n},GnBu: {\n3: [\"#e0f3db\",\"#a8ddb5\",\"#43a2ca\"],\n4: [\"#f0f9e8\",\"#bae4bc\",\"#7bccc4\",\"#2b8cbe\"],\n5: [\"#f0f9e8\",\"#bae4bc\",\"#7bccc4\",\"#43a2ca\",\"#0868ac\"],\n6: [\"#f0f9e8\",\"#ccebc5\",\"#a8ddb5\",\"#7bccc4\",\"#43a2ca\",\"#0868ac\"],\n7: [\"#f0f9e8\",\"#ccebc5\",\"#a8ddb5\",\"#7bccc4\",\"#4eb3d3\",\"#2b8cbe\",\"#08589e\"],\n8: [\"#f7fcf0\",\"#e0f3db\",\"#ccebc5\",\"#a8ddb5\",\"#7bccc4\",\"#4eb3d3\",\"#2b8cbe\",\"#08589e\"],\n9: [\"#f7fcf0\",\"#e0f3db\",\"#ccebc5\",\"#a8ddb5\",\"#7bccc4\",\"#4eb3d3\",\"#2b8cbe\",\"#0868ac\",\"#084081\"]\n},BuGn: {\n3: [\"#e5f5f9\",\"#99d8c9\",\"#2ca25f\"],\n4: [\"#edf8fb\",\"#b2e2e2\",\"#66c2a4\",\"#238b45\"],\n5: [\"#edf8fb\",\"#b2e2e2\",\"#66c2a4\",\"#2ca25f\",\"#006d2c\"],\n6: [\"#edf8fb\",\"#ccece6\",\"#99d8c9\",\"#66c2a4\",\"#2ca25f\",\"#006d2c\"],\n7: [\"#edf8fb\",\"#ccece6\",\"#99d8c9\",\"#66c2a4\",\"#41ae76\",\"#238b45\",\"#005824\"],\n8: [\"#f7fcfd\",\"#e5f5f9\",\"#ccece6\",\"#99d8c9\",\"#66c2a4\",\"#41ae76\",\"#238b45\",\"#005824\"],\n9: [\"#f7fcfd\",\"#e5f5f9\",\"#ccece6\",\"#99d8c9\",\"#66c2a4\",\"#41ae76\",\"#238b45\",\"#006d2c\",\"#00441b\"]\n},PuBuGn: {\n3: [\"#ece2f0\",\"#a6bddb\",\"#1c9099\"],\n4: [\"#f6eff7\",\"#bdc9e1\",\"#67a9cf\",\"#02818a\"],\n5: [\"#f6eff7\",\"#bdc9e1\",\"#67a9cf\",\"#1c9099\",\"#016c59\"],\n6: [\"#f6eff7\",\"#d0d1e6\",\"#a6bddb\",\"#67a9cf\",\"#1c9099\",\"#016c59\"],\n7: [\"#f6eff7\",\"#d0d1e6\",\"#a6bddb\",\"#67a9cf\",\"#3690c0\",\"#02818a\",\"#016450\"],\n8: [\"#fff7fb\",\"#ece2f0\",\"#d0d1e6\",\"#a6bddb\",\"#67a9cf\",\"#3690c0\",\"#02818a\",\"#016450\"],\n9: [\"#fff7fb\",\"#ece2f0\",\"#d0d1e6\",\"#a6bddb\",\"#67a9cf\",\"#3690c0\",\"#02818a\",\"#016c59\",\"#014636\"]\n},PuBu: {\n3: [\"#ece7f2\",\"#a6bddb\",\"#2b8cbe\"],\n4: [\"#f1eef6\",\"#bdc9e1\",\"#74a9cf\",\"#0570b0\"],\n5: [\"#f1eef6\",\"#bdc9e1\",\"#74a9cf\",\"#2b8cbe\",\"#045a8d\"],\n6: [\"#f1eef6\",\"#d0d1e6\",\"#a6bddb\",\"#74a9cf\",\"#2b8cbe\",\"#045a8d\"],\n7: [\"#f1eef6\",\"#d0d1e6\",\"#a6bddb\",\"#74a9cf\",\"#3690c0\",\"#0570b0\",\"#034e7b\"],\n8: [\"#fff7fb\",\"#ece7f2\",\"#d0d1e6\",\"#a6bddb\",\"#74a9cf\",\"#3690c0\",\"#0570b0\",\"#034e7b\"],\n9: [\"#fff7fb\",\"#ece7f2\",\"#d0d1e6\",\"#a6bddb\",\"#74a9cf\",\"#3690c0\",\"#0570b0\",\"#045a8d\",\"#023858\"]\n},BuPu: {\n3: [\"#e0ecf4\",\"#9ebcda\",\"#8856a7\"],\n4: [\"#edf8fb\",\"#b3cde3\",\"#8c96c6\",\"#88419d\"],\n5: [\"#edf8fb\",\"#b3cde3\",\"#8c96c6\",\"#8856a7\",\"#810f7c\"],\n6: [\"#edf8fb\",\"#bfd3e6\",\"#9ebcda\",\"#8c96c6\",\"#8856a7\",\"#810f7c\"],\n7: [\"#edf8fb\",\"#bfd3e6\",\"#9ebcda\",\"#8c96c6\",\"#8c6bb1\",\"#88419d\",\"#6e016b\"],\n8: [\"#f7fcfd\",\"#e0ecf4\",\"#bfd3e6\",\"#9ebcda\",\"#8c96c6\",\"#8c6bb1\",\"#88419d\",\"#6e016b\"],\n9: [\"#f7fcfd\",\"#e0ecf4\",\"#bfd3e6\",\"#9ebcda\",\"#8c96c6\",\"#8c6bb1\",\"#88419d\",\"#810f7c\",\"#4d004b\"]\n},RdPu: {\n3: [\"#fde0dd\",\"#fa9fb5\",\"#c51b8a\"],\n4: [\"#feebe2\",\"#fbb4b9\",\"#f768a1\",\"#ae017e\"],\n5: [\"#feebe2\",\"#fbb4b9\",\"#f768a1\",\"#c51b8a\",\"#7a0177\"],\n6: [\"#feebe2\",\"#fcc5c0\",\"#fa9fb5\",\"#f768a1\",\"#c51b8a\",\"#7a0177\"],\n7: [\"#feebe2\",\"#fcc5c0\",\"#fa9fb5\",\"#f768a1\",\"#dd3497\",\"#ae017e\",\"#7a0177\"],\n8: [\"#fff7f3\",\"#fde0dd\",\"#fcc5c0\",\"#fa9fb5\",\"#f768a1\",\"#dd3497\",\"#ae017e\",\"#7a0177\"],\n9: [\"#fff7f3\",\"#fde0dd\",\"#fcc5c0\",\"#fa9fb5\",\"#f768a1\",\"#dd3497\",\"#ae017e\",\"#7a0177\",\"#49006a\"]\n},PuRd: {\n3: [\"#e7e1ef\",\"#c994c7\",\"#dd1c77\"],\n4: [\"#f1eef6\",\"#d7b5d8\",\"#df65b0\",\"#ce1256\"],\n5: [\"#f1eef6\",\"#d7b5d8\",\"#df65b0\",\"#dd1c77\",\"#980043\"],\n6: [\"#f1eef6\",\"#d4b9da\",\"#c994c7\",\"#df65b0\",\"#dd1c77\",\"#980043\"],\n7: [\"#f1eef6\",\"#d4b9da\",\"#c994c7\",\"#df65b0\",\"#e7298a\",\"#ce1256\",\"#91003f\"],\n8: [\"#f7f4f9\",\"#e7e1ef\",\"#d4b9da\",\"#c994c7\",\"#df65b0\",\"#e7298a\",\"#ce1256\",\"#91003f\"],\n9: [\"#f7f4f9\",\"#e7e1ef\",\"#d4b9da\",\"#c994c7\",\"#df65b0\",\"#e7298a\",\"#ce1256\",\"#980043\",\"#67001f\"]\n},OrRd: {\n3: [\"#fee8c8\",\"#fdbb84\",\"#e34a33\"],\n4: [\"#fef0d9\",\"#fdcc8a\",\"#fc8d59\",\"#d7301f\"],\n5: [\"#fef0d9\",\"#fdcc8a\",\"#fc8d59\",\"#e34a33\",\"#b30000\"],\n6: [\"#fef0d9\",\"#fdd49e\",\"#fdbb84\",\"#fc8d59\",\"#e34a33\",\"#b30000\"],\n7: [\"#fef0d9\",\"#fdd49e\",\"#fdbb84\",\"#fc8d59\",\"#ef6548\",\"#d7301f\",\"#990000\"],\n8: [\"#fff7ec\",\"#fee8c8\",\"#fdd49e\",\"#fdbb84\",\"#fc8d59\",\"#ef6548\",\"#d7301f\",\"#990000\"],\n9: [\"#fff7ec\",\"#fee8c8\",\"#fdd49e\",\"#fdbb84\",\"#fc8d59\",\"#ef6548\",\"#d7301f\",\"#b30000\",\"#7f0000\"]\n},YlOrRd: {\n3: [\"#ffeda0\",\"#feb24c\",\"#f03b20\"],\n4: [\"#ffffb2\",\"#fecc5c\",\"#fd8d3c\",\"#e31a1c\"],\n5: [\"#ffffb2\",\"#fecc5c\",\"#fd8d3c\",\"#f03b20\",\"#bd0026\"],\n6: [\"#ffffb2\",\"#fed976\",\"#feb24c\",\"#fd8d3c\",\"#f03b20\",\"#bd0026\"],\n7: [\"#ffffb2\",\"#fed976\",\"#feb24c\",\"#fd8d3c\",\"#fc4e2a\",\"#e31a1c\",\"#b10026\"],\n8: [\"#ffffcc\",\"#ffeda0\",\"#fed976\",\"#feb24c\",\"#fd8d3c\",\"#fc4e2a\",\"#e31a1c\",\"#b10026\"],\n9: [\"#ffffcc\",\"#ffeda0\",\"#fed976\",\"#feb24c\",\"#fd8d3c\",\"#fc4e2a\",\"#e31a1c\",\"#bd0026\",\"#800026\"]\n},YlOrBr: {\n3: [\"#fff7bc\",\"#fec44f\",\"#d95f0e\"],\n4: [\"#ffffd4\",\"#fed98e\",\"#fe9929\",\"#cc4c02\"],\n5: [\"#ffffd4\",\"#fed98e\",\"#fe9929\",\"#d95f0e\",\"#993404\"],\n6: [\"#ffffd4\",\"#fee391\",\"#fec44f\",\"#fe9929\",\"#d95f0e\",\"#993404\"],\n7: [\"#ffffd4\",\"#fee391\",\"#fec44f\",\"#fe9929\",\"#ec7014\",\"#cc4c02\",\"#8c2d04\"],\n8: [\"#ffffe5\",\"#fff7bc\",\"#fee391\",\"#fec44f\",\"#fe9929\",\"#ec7014\",\"#cc4c02\",\"#8c2d04\"],\n9: [\"#ffffe5\",\"#fff7bc\",\"#fee391\",\"#fec44f\",\"#fe9929\",\"#ec7014\",\"#cc4c02\",\"#993404\",\"#662506\"]\n},Purples: {\n3: [\"#efedf5\",\"#bcbddc\",\"#756bb1\"],\n4: [\"#f2f0f7\",\"#cbc9e2\",\"#9e9ac8\",\"#6a51a3\"],\n5: [\"#f2f0f7\",\"#cbc9e2\",\"#9e9ac8\",\"#756bb1\",\"#54278f\"],\n6: [\"#f2f0f7\",\"#dadaeb\",\"#bcbddc\",\"#9e9ac8\",\"#756bb1\",\"#54278f\"],\n7: [\"#f2f0f7\",\"#dadaeb\",\"#bcbddc\",\"#9e9ac8\",\"#807dba\",\"#6a51a3\",\"#4a1486\"],\n8: [\"#fcfbfd\",\"#efedf5\",\"#dadaeb\",\"#bcbddc\",\"#9e9ac8\",\"#807dba\",\"#6a51a3\",\"#4a1486\"],\n9: [\"#fcfbfd\",\"#efedf5\",\"#dadaeb\",\"#bcbddc\",\"#9e9ac8\",\"#807dba\",\"#6a51a3\",\"#54278f\",\"#3f007d\"]\n},Blues: {\n3: [\"#deebf7\",\"#9ecae1\",\"#3182bd\"],\n4: [\"#eff3ff\",\"#bdd7e7\",\"#6baed6\",\"#2171b5\"],\n5: [\"#eff3ff\",\"#bdd7e7\",\"#6baed6\",\"#3182bd\",\"#08519c\"],\n6: [\"#eff3ff\",\"#c6dbef\",\"#9ecae1\",\"#6baed6\",\"#3182bd\",\"#08519c\"],\n7: [\"#eff3ff\",\"#c6dbef\",\"#9ecae1\",\"#6baed6\",\"#4292c6\",\"#2171b5\",\"#084594\"],\n8: [\"#f7fbff\",\"#deebf7\",\"#c6dbef\",\"#9ecae1\",\"#6baed6\",\"#4292c6\",\"#2171b5\",\"#084594\"],\n9: [\"#f7fbff\",\"#deebf7\",\"#c6dbef\",\"#9ecae1\",\"#6baed6\",\"#4292c6\",\"#2171b5\",\"#08519c\",\"#08306b\"]\n},Greens: {\n3: [\"#e5f5e0\",\"#a1d99b\",\"#31a354\"],\n4: [\"#edf8e9\",\"#bae4b3\",\"#74c476\",\"#238b45\"],\n5: [\"#edf8e9\",\"#bae4b3\",\"#74c476\",\"#31a354\",\"#006d2c\"],\n6: [\"#edf8e9\",\"#c7e9c0\",\"#a1d99b\",\"#74c476\",\"#31a354\",\"#006d2c\"],\n7: [\"#edf8e9\",\"#c7e9c0\",\"#a1d99b\",\"#74c476\",\"#41ab5d\",\"#238b45\",\"#005a32\"],\n8: [\"#f7fcf5\",\"#e5f5e0\",\"#c7e9c0\",\"#a1d99b\",\"#74c476\",\"#41ab5d\",\"#238b45\",\"#005a32\"],\n9: [\"#f7fcf5\",\"#e5f5e0\",\"#c7e9c0\",\"#a1d99b\",\"#74c476\",\"#41ab5d\",\"#238b45\",\"#006d2c\",\"#00441b\"]\n},Oranges: {\n3: [\"#fee6ce\",\"#fdae6b\",\"#e6550d\"],\n4: [\"#feedde\",\"#fdbe85\",\"#fd8d3c\",\"#d94701\"],\n5: [\"#feedde\",\"#fdbe85\",\"#fd8d3c\",\"#e6550d\",\"#a63603\"],\n6: [\"#feedde\",\"#fdd0a2\",\"#fdae6b\",\"#fd8d3c\",\"#e6550d\",\"#a63603\"],\n7: [\"#feedde\",\"#fdd0a2\",\"#fdae6b\",\"#fd8d3c\",\"#f16913\",\"#d94801\",\"#8c2d04\"],\n8: [\"#fff5eb\",\"#fee6ce\",\"#fdd0a2\",\"#fdae6b\",\"#fd8d3c\",\"#f16913\",\"#d94801\",\"#8c2d04\"],\n9: [\"#fff5eb\",\"#fee6ce\",\"#fdd0a2\",\"#fdae6b\",\"#fd8d3c\",\"#f16913\",\"#d94801\",\"#a63603\",\"#7f2704\"]\n},Reds: {\n3: [\"#fee0d2\",\"#fc9272\",\"#de2d26\"],\n4: [\"#fee5d9\",\"#fcae91\",\"#fb6a4a\",\"#cb181d\"],\n5: [\"#fee5d9\",\"#fcae91\",\"#fb6a4a\",\"#de2d26\",\"#a50f15\"],\n6: [\"#fee5d9\",\"#fcbba1\",\"#fc9272\",\"#fb6a4a\",\"#de2d26\",\"#a50f15\"],\n7: [\"#fee5d9\",\"#fcbba1\",\"#fc9272\",\"#fb6a4a\",\"#ef3b2c\",\"#cb181d\",\"#99000d\"],\n8: [\"#fff5f0\",\"#fee0d2\",\"#fcbba1\",\"#fc9272\",\"#fb6a4a\",\"#ef3b2c\",\"#cb181d\",\"#99000d\"],\n9: [\"#fff5f0\",\"#fee0d2\",\"#fcbba1\",\"#fc9272\",\"#fb6a4a\",\"#ef3b2c\",\"#cb181d\",\"#a50f15\",\"#67000d\"]\n},Greys: {\n3: [\"#f0f0f0\",\"#bdbdbd\",\"#636363\"],\n4: [\"#f7f7f7\",\"#cccccc\",\"#969696\",\"#525252\"],\n5: [\"#f7f7f7\",\"#cccccc\",\"#969696\",\"#636363\",\"#252525\"],\n6: [\"#f7f7f7\",\"#d9d9d9\",\"#bdbdbd\",\"#969696\",\"#636363\",\"#252525\"],\n7: [\"#f7f7f7\",\"#d9d9d9\",\"#bdbdbd\",\"#969696\",\"#737373\",\"#525252\",\"#252525\"],\n8: [\"#ffffff\",\"#f0f0f0\",\"#d9d9d9\",\"#bdbdbd\",\"#969696\",\"#737373\",\"#525252\",\"#252525\"],\n9: [\"#ffffff\",\"#f0f0f0\",\"#d9d9d9\",\"#bdbdbd\",\"#969696\",\"#737373\",\"#525252\",\"#252525\",\"#000000\"]\n},PuOr: {\n3: [\"#f1a340\",\"#f7f7f7\",\"#998ec3\"],\n4: [\"#e66101\",\"#fdb863\",\"#b2abd2\",\"#5e3c99\"],\n5: [\"#e66101\",\"#fdb863\",\"#f7f7f7\",\"#b2abd2\",\"#5e3c99\"],\n6: [\"#b35806\",\"#f1a340\",\"#fee0b6\",\"#d8daeb\",\"#998ec3\",\"#542788\"],\n7: [\"#b35806\",\"#f1a340\",\"#fee0b6\",\"#f7f7f7\",\"#d8daeb\",\"#998ec3\",\"#542788\"],\n8: [\"#b35806\",\"#e08214\",\"#fdb863\",\"#fee0b6\",\"#d8daeb\",\"#b2abd2\",\"#8073ac\",\"#542788\"],\n9: [\"#b35806\",\"#e08214\",\"#fdb863\",\"#fee0b6\",\"#f7f7f7\",\"#d8daeb\",\"#b2abd2\",\"#8073ac\",\"#542788\"],\n10: [\"#7f3b08\",\"#b35806\",\"#e08214\",\"#fdb863\",\"#fee0b6\",\"#d8daeb\",\"#b2abd2\",\"#8073ac\",\"#542788\",\"#2d004b\"],\n11: [\"#7f3b08\",\"#b35806\",\"#e08214\",\"#fdb863\",\"#fee0b6\",\"#f7f7f7\",\"#d8daeb\",\"#b2abd2\",\"#8073ac\",\"#542788\",\"#2d004b\"]\n},BrBG: {\n3: [\"#d8b365\",\"#f5f5f5\",\"#5ab4ac\"],\n4: [\"#a6611a\",\"#dfc27d\",\"#80cdc1\",\"#018571\"],\n5: [\"#a6611a\",\"#dfc27d\",\"#f5f5f5\",\"#80cdc1\",\"#018571\"],\n6: [\"#8c510a\",\"#d8b365\",\"#f6e8c3\",\"#c7eae5\",\"#5ab4ac\",\"#01665e\"],\n7: [\"#8c510a\",\"#d8b365\",\"#f6e8c3\",\"#f5f5f5\",\"#c7eae5\",\"#5ab4ac\",\"#01665e\"],\n8: [\"#8c510a\",\"#bf812d\",\"#dfc27d\",\"#f6e8c3\",\"#c7eae5\",\"#80cdc1\",\"#35978f\",\"#01665e\"],\n9: [\"#8c510a\",\"#bf812d\",\"#dfc27d\",\"#f6e8c3\",\"#f5f5f5\",\"#c7eae5\",\"#80cdc1\",\"#35978f\",\"#01665e\"],\n10: [\"#543005\",\"#8c510a\",\"#bf812d\",\"#dfc27d\",\"#f6e8c3\",\"#c7eae5\",\"#80cdc1\",\"#35978f\",\"#01665e\",\"#003c30\"],\n11: [\"#543005\",\"#8c510a\",\"#bf812d\",\"#dfc27d\",\"#f6e8c3\",\"#f5f5f5\",\"#c7eae5\",\"#80cdc1\",\"#35978f\",\"#01665e\",\"#003c30\"]\n},PRGn: {\n3: [\"#af8dc3\",\"#f7f7f7\",\"#7fbf7b\"],\n4: [\"#7b3294\",\"#c2a5cf\",\"#a6dba0\",\"#008837\"],\n5: [\"#7b3294\",\"#c2a5cf\",\"#f7f7f7\",\"#a6dba0\",\"#008837\"],\n6: [\"#762a83\",\"#af8dc3\",\"#e7d4e8\",\"#d9f0d3\",\"#7fbf7b\",\"#1b7837\"],\n7: [\"#762a83\",\"#af8dc3\",\"#e7d4e8\",\"#f7f7f7\",\"#d9f0d3\",\"#7fbf7b\",\"#1b7837\"],\n8: [\"#762a83\",\"#9970ab\",\"#c2a5cf\",\"#e7d4e8\",\"#d9f0d3\",\"#a6dba0\",\"#5aae61\",\"#1b7837\"],\n9: [\"#762a83\",\"#9970ab\",\"#c2a5cf\",\"#e7d4e8\",\"#f7f7f7\",\"#d9f0d3\",\"#a6dba0\",\"#5aae61\",\"#1b7837\"],\n10: [\"#40004b\",\"#762a83\",\"#9970ab\",\"#c2a5cf\",\"#e7d4e8\",\"#d9f0d3\",\"#a6dba0\",\"#5aae61\",\"#1b7837\",\"#00441b\"],\n11: [\"#40004b\",\"#762a83\",\"#9970ab\",\"#c2a5cf\",\"#e7d4e8\",\"#f7f7f7\",\"#d9f0d3\",\"#a6dba0\",\"#5aae61\",\"#1b7837\",\"#00441b\"]\n},PiYG: {\n3: [\"#e9a3c9\",\"#f7f7f7\",\"#a1d76a\"],\n4: [\"#d01c8b\",\"#f1b6da\",\"#b8e186\",\"#4dac26\"],\n5: [\"#d01c8b\",\"#f1b6da\",\"#f7f7f7\",\"#b8e186\",\"#4dac26\"],\n6: [\"#c51b7d\",\"#e9a3c9\",\"#fde0ef\",\"#e6f5d0\",\"#a1d76a\",\"#4d9221\"],\n7: [\"#c51b7d\",\"#e9a3c9\",\"#fde0ef\",\"#f7f7f7\",\"#e6f5d0\",\"#a1d76a\",\"#4d9221\"],\n8: [\"#c51b7d\",\"#de77ae\",\"#f1b6da\",\"#fde0ef\",\"#e6f5d0\",\"#b8e186\",\"#7fbc41\",\"#4d9221\"],\n9: [\"#c51b7d\",\"#de77ae\",\"#f1b6da\",\"#fde0ef\",\"#f7f7f7\",\"#e6f5d0\",\"#b8e186\",\"#7fbc41\",\"#4d9221\"],\n10: [\"#8e0152\",\"#c51b7d\",\"#de77ae\",\"#f1b6da\",\"#fde0ef\",\"#e6f5d0\",\"#b8e186\",\"#7fbc41\",\"#4d9221\",\"#276419\"],\n11: [\"#8e0152\",\"#c51b7d\",\"#de77ae\",\"#f1b6da\",\"#fde0ef\",\"#f7f7f7\",\"#e6f5d0\",\"#b8e186\",\"#7fbc41\",\"#4d9221\",\"#276419\"]\n},RdBu: {\n3: [\"#ef8a62\",\"#f7f7f7\",\"#67a9cf\"],\n4: [\"#ca0020\",\"#f4a582\",\"#92c5de\",\"#0571b0\"],\n5: [\"#ca0020\",\"#f4a582\",\"#f7f7f7\",\"#92c5de\",\"#0571b0\"],\n6: [\"#b2182b\",\"#ef8a62\",\"#fddbc7\",\"#d1e5f0\",\"#67a9cf\",\"#2166ac\"],\n7: [\"#b2182b\",\"#ef8a62\",\"#fddbc7\",\"#f7f7f7\",\"#d1e5f0\",\"#67a9cf\",\"#2166ac\"],\n8: [\"#b2182b\",\"#d6604d\",\"#f4a582\",\"#fddbc7\",\"#d1e5f0\",\"#92c5de\",\"#4393c3\",\"#2166ac\"],\n9: [\"#b2182b\",\"#d6604d\",\"#f4a582\",\"#fddbc7\",\"#f7f7f7\",\"#d1e5f0\",\"#92c5de\",\"#4393c3\",\"#2166ac\"],\n10: [\"#67001f\",\"#b2182b\",\"#d6604d\",\"#f4a582\",\"#fddbc7\",\"#d1e5f0\",\"#92c5de\",\"#4393c3\",\"#2166ac\",\"#053061\"],\n11: [\"#67001f\",\"#b2182b\",\"#d6604d\",\"#f4a582\",\"#fddbc7\",\"#f7f7f7\",\"#d1e5f0\",\"#92c5de\",\"#4393c3\",\"#2166ac\",\"#053061\"]\n},RdGy: {\n3: [\"#ef8a62\",\"#ffffff\",\"#999999\"],\n4: [\"#ca0020\",\"#f4a582\",\"#bababa\",\"#404040\"],\n5: [\"#ca0020\",\"#f4a582\",\"#ffffff\",\"#bababa\",\"#404040\"],\n6: [\"#b2182b\",\"#ef8a62\",\"#fddbc7\",\"#e0e0e0\",\"#999999\",\"#4d4d4d\"],\n7: [\"#b2182b\",\"#ef8a62\",\"#fddbc7\",\"#ffffff\",\"#e0e0e0\",\"#999999\",\"#4d4d4d\"],\n8: [\"#b2182b\",\"#d6604d\",\"#f4a582\",\"#fddbc7\",\"#e0e0e0\",\"#bababa\",\"#878787\",\"#4d4d4d\"],\n9: [\"#b2182b\",\"#d6604d\",\"#f4a582\",\"#fddbc7\",\"#ffffff\",\"#e0e0e0\",\"#bababa\",\"#878787\",\"#4d4d4d\"],\n10: [\"#67001f\",\"#b2182b\",\"#d6604d\",\"#f4a582\",\"#fddbc7\",\"#e0e0e0\",\"#bababa\",\"#878787\",\"#4d4d4d\",\"#1a1a1a\"],\n11: [\"#67001f\",\"#b2182b\",\"#d6604d\",\"#f4a582\",\"#fddbc7\",\"#ffffff\",\"#e0e0e0\",\"#bababa\",\"#878787\",\"#4d4d4d\",\"#1a1a1a\"]\n},RdYlBu: {\n3: [\"#fc8d59\",\"#ffffbf\",\"#91bfdb\"],\n4: [\"#d7191c\",\"#fdae61\",\"#abd9e9\",\"#2c7bb6\"],\n5: [\"#d7191c\",\"#fdae61\",\"#ffffbf\",\"#abd9e9\",\"#2c7bb6\"],\n6: [\"#d73027\",\"#fc8d59\",\"#fee090\",\"#e0f3f8\",\"#91bfdb\",\"#4575b4\"],\n7: [\"#d73027\",\"#fc8d59\",\"#fee090\",\"#ffffbf\",\"#e0f3f8\",\"#91bfdb\",\"#4575b4\"],\n8: [\"#d73027\",\"#f46d43\",\"#fdae61\",\"#fee090\",\"#e0f3f8\",\"#abd9e9\",\"#74add1\",\"#4575b4\"],\n9: [\"#d73027\",\"#f46d43\",\"#fdae61\",\"#fee090\",\"#ffffbf\",\"#e0f3f8\",\"#abd9e9\",\"#74add1\",\"#4575b4\"],\n10: [\"#a50026\",\"#d73027\",\"#f46d43\",\"#fdae61\",\"#fee090\",\"#e0f3f8\",\"#abd9e9\",\"#74add1\",\"#4575b4\",\"#313695\"],\n11: [\"#a50026\",\"#d73027\",\"#f46d43\",\"#fdae61\",\"#fee090\",\"#ffffbf\",\"#e0f3f8\",\"#abd9e9\",\"#74add1\",\"#4575b4\",\"#313695\"]\n},Spectral: {\n3: [\"#fc8d59\",\"#ffffbf\",\"#99d594\"],\n4: [\"#d7191c\",\"#fdae61\",\"#abdda4\",\"#2b83ba\"],\n5: [\"#d7191c\",\"#fdae61\",\"#ffffbf\",\"#abdda4\",\"#2b83ba\"],\n6: [\"#d53e4f\",\"#fc8d59\",\"#fee08b\",\"#e6f598\",\"#99d594\",\"#3288bd\"],\n7: [\"#d53e4f\",\"#fc8d59\",\"#fee08b\",\"#ffffbf\",\"#e6f598\",\"#99d594\",\"#3288bd\"],\n8: [\"#d53e4f\",\"#f46d43\",\"#fdae61\",\"#fee08b\",\"#e6f598\",\"#abdda4\",\"#66c2a5\",\"#3288bd\"],\n9: [\"#d53e4f\",\"#f46d43\",\"#fdae61\",\"#fee08b\",\"#ffffbf\",\"#e6f598\",\"#abdda4\",\"#66c2a5\",\"#3288bd\"],\n10: [\"#9e0142\",\"#d53e4f\",\"#f46d43\",\"#fdae61\",\"#fee08b\",\"#e6f598\",\"#abdda4\",\"#66c2a5\",\"#3288bd\",\"#5e4fa2\"],\n11: [\"#9e0142\",\"#d53e4f\",\"#f46d43\",\"#fdae61\",\"#fee08b\",\"#ffffbf\",\"#e6f598\",\"#abdda4\",\"#66c2a5\",\"#3288bd\",\"#5e4fa2\"]\n},RdYlGn: {\n3: [\"#fc8d59\",\"#ffffbf\",\"#91cf60\"],\n4: [\"#d7191c\",\"#fdae61\",\"#a6d96a\",\"#1a9641\"],\n5: [\"#d7191c\",\"#fdae61\",\"#ffffbf\",\"#a6d96a\",\"#1a9641\"],\n6: [\"#d73027\",\"#fc8d59\",\"#fee08b\",\"#d9ef8b\",\"#91cf60\",\"#1a9850\"],\n7: [\"#d73027\",\"#fc8d59\",\"#fee08b\",\"#ffffbf\",\"#d9ef8b\",\"#91cf60\",\"#1a9850\"],\n8: [\"#d73027\",\"#f46d43\",\"#fdae61\",\"#fee08b\",\"#d9ef8b\",\"#a6d96a\",\"#66bd63\",\"#1a9850\"],\n9: [\"#d73027\",\"#f46d43\",\"#fdae61\",\"#fee08b\",\"#ffffbf\",\"#d9ef8b\",\"#a6d96a\",\"#66bd63\",\"#1a9850\"],\n10: [\"#a50026\",\"#d73027\",\"#f46d43\",\"#fdae61\",\"#fee08b\",\"#d9ef8b\",\"#a6d96a\",\"#66bd63\",\"#1a9850\",\"#006837\"],\n11: [\"#a50026\",\"#d73027\",\"#f46d43\",\"#fdae61\",\"#fee08b\",\"#ffffbf\",\"#d9ef8b\",\"#a6d96a\",\"#66bd63\",\"#1a9850\",\"#006837\"]\n},Accent: {\n3: [\"#7fc97f\",\"#beaed4\",\"#fdc086\"],\n4: [\"#7fc97f\",\"#beaed4\",\"#fdc086\",\"#ffff99\"],\n5: [\"#7fc97f\",\"#beaed4\",\"#fdc086\",\"#ffff99\",\"#386cb0\"],\n6: [\"#7fc97f\",\"#beaed4\",\"#fdc086\",\"#ffff99\",\"#386cb0\",\"#f0027f\"],\n7: [\"#7fc97f\",\"#beaed4\",\"#fdc086\",\"#ffff99\",\"#386cb0\",\"#f0027f\",\"#bf5b17\"],\n8: [\"#7fc97f\",\"#beaed4\",\"#fdc086\",\"#ffff99\",\"#386cb0\",\"#f0027f\",\"#bf5b17\",\"#666666\"]\n},Dark2: {\n3: [\"#1b9e77\",\"#d95f02\",\"#7570b3\"],\n4: [\"#1b9e77\",\"#d95f02\",\"#7570b3\",\"#e7298a\"],\n5: [\"#1b9e77\",\"#d95f02\",\"#7570b3\",\"#e7298a\",\"#66a61e\"],\n6: [\"#1b9e77\",\"#d95f02\",\"#7570b3\",\"#e7298a\",\"#66a61e\",\"#e6ab02\"],\n7: [\"#1b9e77\",\"#d95f02\",\"#7570b3\",\"#e7298a\",\"#66a61e\",\"#e6ab02\",\"#a6761d\"],\n8: [\"#1b9e77\",\"#d95f02\",\"#7570b3\",\"#e7298a\",\"#66a61e\",\"#e6ab02\",\"#a6761d\",\"#666666\"]\n},Paired: {\n3: [\"#a6cee3\",\"#1f78b4\",\"#b2df8a\"],\n4: [\"#a6cee3\",\"#1f78b4\",\"#b2df8a\",\"#33a02c\"],\n5: [\"#a6cee3\",\"#1f78b4\",\"#b2df8a\",\"#33a02c\",\"#fb9a99\"],\n6: [\"#a6cee3\",\"#1f78b4\",\"#b2df8a\",\"#33a02c\",\"#fb9a99\",\"#e31a1c\"],\n7: [\"#a6cee3\",\"#1f78b4\",\"#b2df8a\",\"#33a02c\",\"#fb9a99\",\"#e31a1c\",\"#fdbf6f\"],\n8: [\"#a6cee3\",\"#1f78b4\",\"#b2df8a\",\"#33a02c\",\"#fb9a99\",\"#e31a1c\",\"#fdbf6f\",\"#ff7f00\"],\n9: [\"#a6cee3\",\"#1f78b4\",\"#b2df8a\",\"#33a02c\",\"#fb9a99\",\"#e31a1c\",\"#fdbf6f\",\"#ff7f00\",\"#cab2d6\"],\n10: [\"#a6cee3\",\"#1f78b4\",\"#b2df8a\",\"#33a02c\",\"#fb9a99\",\"#e31a1c\",\"#fdbf6f\",\"#ff7f00\",\"#cab2d6\",\"#6a3d9a\"],\n11: [\"#a6cee3\",\"#1f78b4\",\"#b2df8a\",\"#33a02c\",\"#fb9a99\",\"#e31a1c\",\"#fdbf6f\",\"#ff7f00\",\"#cab2d6\",\"#6a3d9a\",\"#ffff99\"],\n12: [\"#a6cee3\",\"#1f78b4\",\"#b2df8a\",\"#33a02c\",\"#fb9a99\",\"#e31a1c\",\"#fdbf6f\",\"#ff7f00\",\"#cab2d6\",\"#6a3d9a\",\"#ffff99\",\"#b15928\"]\n},Pastel1: {\n3: [\"#fbb4ae\",\"#b3cde3\",\"#ccebc5\"],\n4: [\"#fbb4ae\",\"#b3cde3\",\"#ccebc5\",\"#decbe4\"],\n5: [\"#fbb4ae\",\"#b3cde3\",\"#ccebc5\",\"#decbe4\",\"#fed9a6\"],\n6: [\"#fbb4ae\",\"#b3cde3\",\"#ccebc5\",\"#decbe4\",\"#fed9a6\",\"#ffffcc\"],\n7: [\"#fbb4ae\",\"#b3cde3\",\"#ccebc5\",\"#decbe4\",\"#fed9a6\",\"#ffffcc\",\"#e5d8bd\"],\n8: [\"#fbb4ae\",\"#b3cde3\",\"#ccebc5\",\"#decbe4\",\"#fed9a6\",\"#ffffcc\",\"#e5d8bd\",\"#fddaec\"],\n9: [\"#fbb4ae\",\"#b3cde3\",\"#ccebc5\",\"#decbe4\",\"#fed9a6\",\"#ffffcc\",\"#e5d8bd\",\"#fddaec\",\"#f2f2f2\"]\n},Pastel2: {\n3: [\"#b3e2cd\",\"#fdcdac\",\"#cbd5e8\"],\n4: [\"#b3e2cd\",\"#fdcdac\",\"#cbd5e8\",\"#f4cae4\"],\n5: [\"#b3e2cd\",\"#fdcdac\",\"#cbd5e8\",\"#f4cae4\",\"#e6f5c9\"],\n6: [\"#b3e2cd\",\"#fdcdac\",\"#cbd5e8\",\"#f4cae4\",\"#e6f5c9\",\"#fff2ae\"],\n7: [\"#b3e2cd\",\"#fdcdac\",\"#cbd5e8\",\"#f4cae4\",\"#e6f5c9\",\"#fff2ae\",\"#f1e2cc\"],\n8: [\"#b3e2cd\",\"#fdcdac\",\"#cbd5e8\",\"#f4cae4\",\"#e6f5c9\",\"#fff2ae\",\"#f1e2cc\",\"#cccccc\"]\n},Set1: {\n3: [\"#e41a1c\",\"#377eb8\",\"#4daf4a\"],\n4: [\"#e41a1c\",\"#377eb8\",\"#4daf4a\",\"#984ea3\"],\n5: [\"#e41a1c\",\"#377eb8\",\"#4daf4a\",\"#984ea3\",\"#ff7f00\"],\n6: [\"#e41a1c\",\"#377eb8\",\"#4daf4a\",\"#984ea3\",\"#ff7f00\",\"#ffff33\"],\n7: [\"#e41a1c\",\"#377eb8\",\"#4daf4a\",\"#984ea3\",\"#ff7f00\",\"#ffff33\",\"#a65628\"],\n8: [\"#e41a1c\",\"#377eb8\",\"#4daf4a\",\"#984ea3\",\"#ff7f00\",\"#ffff33\",\"#a65628\",\"#f781bf\"],\n9: [\"#e41a1c\",\"#377eb8\",\"#4daf4a\",\"#984ea3\",\"#ff7f00\",\"#ffff33\",\"#a65628\",\"#f781bf\",\"#999999\"]\n},Set2: {\n3: [\"#66c2a5\",\"#fc8d62\",\"#8da0cb\"],\n4: [\"#66c2a5\",\"#fc8d62\",\"#8da0cb\",\"#e78ac3\"],\n5: [\"#66c2a5\",\"#fc8d62\",\"#8da0cb\",\"#e78ac3\",\"#a6d854\"],\n6: [\"#66c2a5\",\"#fc8d62\",\"#8da0cb\",\"#e78ac3\",\"#a6d854\",\"#ffd92f\"],\n7: [\"#66c2a5\",\"#fc8d62\",\"#8da0cb\",\"#e78ac3\",\"#a6d854\",\"#ffd92f\",\"#e5c494\"],\n8: [\"#66c2a5\",\"#fc8d62\",\"#8da0cb\",\"#e78ac3\",\"#a6d854\",\"#ffd92f\",\"#e5c494\",\"#b3b3b3\"]\n},Set3: {\n3: [\"#8dd3c7\",\"#ffffb3\",\"#bebada\"],\n4: [\"#8dd3c7\",\"#ffffb3\",\"#bebada\",\"#fb8072\"],\n5: [\"#8dd3c7\",\"#ffffb3\",\"#bebada\",\"#fb8072\",\"#80b1d3\"],\n6: [\"#8dd3c7\",\"#ffffb3\",\"#bebada\",\"#fb8072\",\"#80b1d3\",\"#fdb462\"],\n7: [\"#8dd3c7\",\"#ffffb3\",\"#bebada\",\"#fb8072\",\"#80b1d3\",\"#fdb462\",\"#b3de69\"],\n8: [\"#8dd3c7\",\"#ffffb3\",\"#bebada\",\"#fb8072\",\"#80b1d3\",\"#fdb462\",\"#b3de69\",\"#fccde5\"],\n9: [\"#8dd3c7\",\"#ffffb3\",\"#bebada\",\"#fb8072\",\"#80b1d3\",\"#fdb462\",\"#b3de69\",\"#fccde5\",\"#d9d9d9\"],\n10: [\"#8dd3c7\",\"#ffffb3\",\"#bebada\",\"#fb8072\",\"#80b1d3\",\"#fdb462\",\"#b3de69\",\"#fccde5\",\"#d9d9d9\",\"#bc80bd\"],\n11: [\"#8dd3c7\",\"#ffffb3\",\"#bebada\",\"#fb8072\",\"#80b1d3\",\"#fdb462\",\"#b3de69\",\"#fccde5\",\"#d9d9d9\",\"#bc80bd\",\"#ccebc5\"],\n12: [\"#8dd3c7\",\"#ffffb3\",\"#bebada\",\"#fb8072\",\"#80b1d3\",\"#fdb462\",\"#b3de69\",\"#fccde5\",\"#d9d9d9\",\"#bc80bd\",\"#ccebc5\",\"#ffed6f\"]\n}};"
  },
  {
    "path": "docs/doxygen.cfg",
    "content": "# Doxyfile 1.8.6\n\n# This file describes the settings to be used by the documentation system\n# doxygen (www.doxygen.org) for a project.\n#\n# All text after a double hash (##) is considered a comment and is placed in\n# front of the TAG it is preceding.\n#\n# All text after a single hash (#) is considered a comment and will be ignored.\n# The format is:\n# TAG = value [value, ...]\n# For lists, items can also be appended using:\n# TAG += value [value, ...]\n# Values that contain spaces should be placed between quotes (\\\" \\\").\n\n#---------------------------------------------------------------------------\n# Project related configuration options\n#---------------------------------------------------------------------------\n\n# This tag specifies the encoding used for all characters in the config file\n# that follow. The default is UTF-8 which is also the encoding used for all text\n# before the first occurrence of this tag. Doxygen uses libiconv (or the iconv\n# built into libc) for the transcoding. See http://www.gnu.org/software/libiconv\n# for the list of possible encodings.\n# The default value is: UTF-8.\n\nDOXYFILE_ENCODING      = UTF-8\n\n# The PROJECT_NAME tag is a single word (or a sequence of words surrounded by\n# double-quotes, unless you are using Doxywizard) that should identify the\n# project for which the documentation is generated. This name is used in the\n# title of most generated pages and in a few other places.\n# The default value is: My Project.\n\nPROJECT_NAME           = \"Giggle\"\n\n# The PROJECT_NUMBER tag can be used to enter a project or revision number. This\n# could be handy for archiving the generated documentation or if some version\n# control system is used.\n\nPROJECT_NUMBER         =\n\n# Using the PROJECT_BRIEF tag one can provide an optional one line description\n# for a project that appears at the top of each page and should give viewer a\n# quick idea about the purpose of the project. Keep the description short.\n\nPROJECT_BRIEF          =\n\n# With the PROJECT_LOGO tag one can specify an logo or icon that is included in\n# the documentation. The maximum height of the logo should not exceed 55 pixels\n# and the maximum width should not exceed 200 pixels. Doxygen will copy the logo\n# to the output directory.\n\nPROJECT_LOGO           =\n\n# The OUTPUT_DIRECTORY tag is used to specify the (relative or absolute) path\n# into which the generated documentation will be written. If a relative path is\n# entered, it will be relative to the location where doxygen was started. If\n# left blank the current directory will be used.\n\nOUTPUT_DIRECTORY       = ./\n\n# If the CREATE_SUBDIRS tag is set to YES, then doxygen will create 4096 sub-\n# directories (in 2 levels) under the output directory of each output format and\n# will distribute the generated files over these directories. Enabling this\n# option can be useful when feeding doxygen a huge amount of source files, where\n# putting all generated files in the same directory would otherwise causes\n# performance problems for the file system.\n# The default value is: NO.\n\nCREATE_SUBDIRS         = NO\n\n# The OUTPUT_LANGUAGE tag is used to specify the language in which all\n# documentation generated by doxygen is written. Doxygen will use this\n# information to generate all constant output in the proper language.\n# Possible values are: Afrikaans, Arabic, Armenian, Brazilian, Catalan, Chinese,\n# Chinese-Traditional, Croatian, Czech, Danish, Dutch, English (United States),\n# Esperanto, Farsi (Persian), Finnish, French, German, Greek, Hungarian,\n# Indonesian, Italian, Japanese, Japanese-en (Japanese with English messages),\n# Korean, Korean-en (Korean with English messages), Latvian, Lithuanian,\n# Macedonian, Norwegian, Persian (Farsi), Polish, Portuguese, Romanian, Russian,\n# Serbian, Serbian-Cyrillic, Slovak, Slovene, Spanish, Swedish, Turkish,\n# Ukrainian and Vietnamese.\n# The default value is: English.\n\nOUTPUT_LANGUAGE        = English\n\n# If the BRIEF_MEMBER_DESC tag is set to YES doxygen will include brief member\n# descriptions after the members that are listed in the file and class\n# documentation (similar to Javadoc). Set to NO to disable this.\n# The default value is: YES.\n\nBRIEF_MEMBER_DESC      = YES\n\n# If the REPEAT_BRIEF tag is set to YES doxygen will prepend the brief\n# description of a member or function before the detailed description\n#\n# Note: If both HIDE_UNDOC_MEMBERS and BRIEF_MEMBER_DESC are set to NO, the\n# brief descriptions will be completely suppressed.\n# The default value is: YES.\n\nREPEAT_BRIEF           = YES\n\n# This tag implements a quasi-intelligent brief description abbreviator that is\n# used to form the text in various listings. Each string in this list, if found\n# as the leading text of the brief description, will be stripped from the text\n# and the result, after processing the whole list, is used as the annotated\n# text. Otherwise, the brief description is used as-is. If left blank, the\n# following values are used ($name is automatically replaced with the name of\n# the entity):The $name class, The $name widget, The $name file, is, provides,\n# specifies, contains, represents, a, an and the.\n\nABBREVIATE_BRIEF       =\n\n# If the ALWAYS_DETAILED_SEC and REPEAT_BRIEF tags are both set to YES then\n# doxygen will generate a detailed section even if there is only a brief\n# description.\n# The default value is: NO.\n\nALWAYS_DETAILED_SEC    = NO\n\n# If the INLINE_INHERITED_MEMB tag is set to YES, doxygen will show all\n# inherited members of a class in the documentation of that class as if those\n# members were ordinary class members. Constructors, destructors and assignment\n# operators of the base classes will not be shown.\n# The default value is: NO.\n\nINLINE_INHERITED_MEMB  = NO\n\n# If the FULL_PATH_NAMES tag is set to YES doxygen will prepend the full path\n# before files name in the file list and in the header files. If set to NO the\n# shortest path that makes the file name unique will be used\n# The default value is: YES.\n\nFULL_PATH_NAMES        = NO\n\n# The STRIP_FROM_PATH tag can be used to strip a user-defined part of the path.\n# Stripping is only done if one of the specified strings matches the left-hand\n# part of the path. The tag can be used to show relative paths in the file list.\n# If left blank the directory from which doxygen is run is used as the path to\n# strip.\n#\n# Note that you can specify absolute paths here, but also relative paths, which\n# will be relative from the directory where doxygen is started.\n# This tag requires that the tag FULL_PATH_NAMES is set to YES.\n\nSTRIP_FROM_PATH        =\n\n# The STRIP_FROM_INC_PATH tag can be used to strip a user-defined part of the\n# path mentioned in the documentation of a class, which tells the reader which\n# header file to include in order to use a class. If left blank only the name of\n# the header file containing the class definition is used. Otherwise one should\n# specify the list of include paths that are normally passed to the compiler\n# using the -I flag.\n\nSTRIP_FROM_INC_PATH    =\n\n# If the SHORT_NAMES tag is set to YES, doxygen will generate much shorter (but\n# less readable) file names. This can be useful is your file systems doesn't\n# support long names like on DOS, Mac, or CD-ROM.\n# The default value is: NO.\n\nSHORT_NAMES            = NO\n\n# If the JAVADOC_AUTOBRIEF tag is set to YES then doxygen will interpret the\n# first line (until the first dot) of a Javadoc-style comment as the brief\n# description. If set to NO, the Javadoc-style will behave just like regular Qt-\n# style comments (thus requiring an explicit @brief command for a brief\n# description.)\n# The default value is: NO.\n\nJAVADOC_AUTOBRIEF      = NO\n\n# If the QT_AUTOBRIEF tag is set to YES then doxygen will interpret the first\n# line (until the first dot) of a Qt-style comment as the brief description. If\n# set to NO, the Qt-style will behave just like regular Qt-style comments (thus\n# requiring an explicit \\brief command for a brief description.)\n# The default value is: NO.\n\nQT_AUTOBRIEF           = NO\n\n# The MULTILINE_CPP_IS_BRIEF tag can be set to YES to make doxygen treat a\n# multi-line C++ special comment block (i.e. a block of //! or /// comments) as\n# a brief description. This used to be the default behavior. The new default is\n# to treat a multi-line C++ comment block as a detailed description. Set this\n# tag to YES if you prefer the old behavior instead.\n#\n# Note that setting this tag to YES also means that rational rose comments are\n# not recognized any more.\n# The default value is: NO.\n\nMULTILINE_CPP_IS_BRIEF = NO\n\n# If the INHERIT_DOCS tag is set to YES then an undocumented member inherits the\n# documentation from any documented member that it re-implements.\n# The default value is: YES.\n\nINHERIT_DOCS           = YES\n\n# If the SEPARATE_MEMBER_PAGES tag is set to YES, then doxygen will produce a\n# new page for each member. If set to NO, the documentation of a member will be\n# part of the file/class/namespace that contains it.\n# The default value is: NO.\n\nSEPARATE_MEMBER_PAGES  = NO\n\n# The TAB_SIZE tag can be used to set the number of spaces in a tab. Doxygen\n# uses this value to replace tabs by spaces in code fragments.\n# Minimum value: 1, maximum value: 16, default value: 4.\n\nTAB_SIZE               = 4\n\n# This tag can be used to specify a number of aliases that act as commands in\n# the documentation. An alias has the form:\n# name=value\n# For example adding\n# \"sideeffect=@par Side Effects:\\n\"\n# will allow you to put the command \\sideeffect (or @sideeffect) in the\n# documentation, which will result in a user-defined paragraph with heading\n# \"Side Effects:\". You can put \\n's in the value part of an alias to insert\n# newlines.\n\nALIASES                =\n\n# This tag can be used to specify a number of word-keyword mappings (TCL only).\n# A mapping has the form \"name=value\". For example adding \"class=itcl::class\"\n# will allow you to use the command class in the itcl::class meaning.\n\nTCL_SUBST              =\n\n# Set the OPTIMIZE_OUTPUT_FOR_C tag to YES if your project consists of C sources\n# only. Doxygen will then generate output that is more tailored for C. For\n# instance, some of the names that are used will be different. The list of all\n# members will be omitted, etc.\n# The default value is: NO.\n\nOPTIMIZE_OUTPUT_FOR_C  = NO\n\n# Set the OPTIMIZE_OUTPUT_JAVA tag to YES if your project consists of Java or\n# Python sources only. Doxygen will then generate output that is more tailored\n# for that language. For instance, namespaces will be presented as packages,\n# qualified scopes will look different, etc.\n# The default value is: NO.\n\nOPTIMIZE_OUTPUT_JAVA   = NO\n\n# Set the OPTIMIZE_FOR_FORTRAN tag to YES if your project consists of Fortran\n# sources. Doxygen will then generate output that is tailored for Fortran.\n# The default value is: NO.\n\nOPTIMIZE_FOR_FORTRAN   = NO\n\n# Set the OPTIMIZE_OUTPUT_VHDL tag to YES if your project consists of VHDL\n# sources. Doxygen will then generate output that is tailored for VHDL.\n# The default value is: NO.\n\nOPTIMIZE_OUTPUT_VHDL   = NO\n\n# Doxygen selects the parser to use depending on the extension of the files it\n# parses. With this tag you can assign which parser to use for a given\n# extension. Doxygen has a built-in mapping, but you can override or extend it\n# using this tag. The format is ext=language, where ext is a file extension, and\n# language is one of the parsers supported by doxygen: IDL, Java, Javascript,\n# C#, C, C++, D, PHP, Objective-C, Python, Fortran, VHDL. For instance to make\n# doxygen treat .inc files as Fortran files (default is PHP), and .f files as C\n# (default is Fortran), use: inc=Fortran f=C.\n#\n# Note For files without extension you can use no_extension as a placeholder.\n#\n# Note that for custom extensions you also need to set FILE_PATTERNS otherwise\n# the files are not read by doxygen.\n\nEXTENSION_MAPPING      =\n\n# If the MARKDOWN_SUPPORT tag is enabled then doxygen pre-processes all comments\n# according to the Markdown format, which allows for more readable\n# documentation. See http://daringfireball.net/projects/markdown/ for details.\n# The output of markdown processing is further processed by doxygen, so you can\n# mix doxygen, HTML, and XML commands with Markdown formatting. Disable only in\n# case of backward compatibilities issues.\n# The default value is: YES.\n\nMARKDOWN_SUPPORT       = YES\n\n# When enabled doxygen tries to link words that correspond to documented\n# classes, or namespaces to their corresponding documentation. Such a link can\n# be prevented in individual cases by by putting a % sign in front of the word\n# or globally by setting AUTOLINK_SUPPORT to NO.\n# The default value is: YES.\n\nAUTOLINK_SUPPORT       = YES\n\n# If you use STL classes (i.e. std::string, std::vector, etc.) but do not want\n# to include (a tag file for) the STL sources as input, then you should set this\n# tag to YES in order to let doxygen match functions declarations and\n# definitions whose arguments contain STL classes (e.g. func(std::string);\n# versus func(std::string) {}). This also make the inheritance and collaboration\n# diagrams that involve STL classes more complete and accurate.\n# The default value is: NO.\n\nBUILTIN_STL_SUPPORT    = NO\n\n# If you use Microsoft's C++/CLI language, you should set this option to YES to\n# enable parsing support.\n# The default value is: NO.\n\nCPP_CLI_SUPPORT        = NO\n\n# Set the SIP_SUPPORT tag to YES if your project consists of sip (see:\n# http://www.riverbankcomputing.co.uk/software/sip/intro) sources only. Doxygen\n# will parse them like normal C++ but will assume all classes use public instead\n# of private inheritance when no explicit protection keyword is present.\n# The default value is: NO.\n\nSIP_SUPPORT            = NO\n\n# For Microsoft's IDL there are propget and propput attributes to indicate\n# getter and setter methods for a property. Setting this option to YES will make\n# doxygen to replace the get and set methods by a property in the documentation.\n# This will only work if the methods are indeed getting or setting a simple\n# type. If this is not the case, or you want to show the methods anyway, you\n# should set this option to NO.\n# The default value is: YES.\n\nIDL_PROPERTY_SUPPORT   = YES\n\n# If member grouping is used in the documentation and the DISTRIBUTE_GROUP_DOC\n# tag is set to YES, then doxygen will reuse the documentation of the first\n# member in the group (if any) for the other members of the group. By default\n# all members of a group must be documented explicitly.\n# The default value is: NO.\n\nDISTRIBUTE_GROUP_DOC   = NO\n\n# Set the SUBGROUPING tag to YES to allow class member groups of the same type\n# (for instance a group of public functions) to be put as a subgroup of that\n# type (e.g. under the Public Functions section). Set it to NO to prevent\n# subgrouping. Alternatively, this can be done per class using the\n# \\nosubgrouping command.\n# The default value is: YES.\n\nSUBGROUPING            = YES\n\n# When the INLINE_GROUPED_CLASSES tag is set to YES, classes, structs and unions\n# are shown inside the group in which they are included (e.g. using \\ingroup)\n# instead of on a separate page (for HTML and Man pages) or section (for LaTeX\n# and RTF).\n#\n# Note that this feature does not work in combination with\n# SEPARATE_MEMBER_PAGES.\n# The default value is: NO.\n\nINLINE_GROUPED_CLASSES = NO\n\n# When the INLINE_SIMPLE_STRUCTS tag is set to YES, structs, classes, and unions\n# with only public data fields or simple typedef fields will be shown inline in\n# the documentation of the scope in which they are defined (i.e. file,\n# namespace, or group documentation), provided this scope is documented. If set\n# to NO, structs, classes, and unions are shown on a separate page (for HTML and\n# Man pages) or section (for LaTeX and RTF).\n# The default value is: NO.\n\nINLINE_SIMPLE_STRUCTS  = NO\n\n# When TYPEDEF_HIDES_STRUCT tag is enabled, a typedef of a struct, union, or\n# enum is documented as struct, union, or enum with the name of the typedef. So\n# typedef struct TypeS {} TypeT, will appear in the documentation as a struct\n# with name TypeT. When disabled the typedef will appear as a member of a file,\n# namespace, or class. And the struct will be named TypeS. This can typically be\n# useful for C code in case the coding convention dictates that all compound\n# types are typedef'ed and only the typedef is referenced, never the tag name.\n# The default value is: NO.\n\nTYPEDEF_HIDES_STRUCT   = NO\n\n# The size of the symbol lookup cache can be set using LOOKUP_CACHE_SIZE. This\n# cache is used to resolve symbols given their name and scope. Since this can be\n# an expensive process and often the same symbol appears multiple times in the\n# code, doxygen keeps a cache of pre-resolved symbols. If the cache is too small\n# doxygen will become slower. If the cache is too large, memory is wasted. The\n# cache size is given by this formula: 2^(16+LOOKUP_CACHE_SIZE). The valid range\n# is 0..9, the default is 0, corresponding to a cache size of 2^16=65536\n# symbols. At the end of a run doxygen will report the cache usage and suggest\n# the optimal cache size from a speed point of view.\n# Minimum value: 0, maximum value: 9, default value: 0.\n\nLOOKUP_CACHE_SIZE      = 0\n\n#---------------------------------------------------------------------------\n# Build related configuration options\n#---------------------------------------------------------------------------\n\n# If the EXTRACT_ALL tag is set to YES doxygen will assume all entities in\n# documentation are documented, even if no documentation was available. Private\n# class members and static file members will be hidden unless the\n# EXTRACT_PRIVATE respectively EXTRACT_STATIC tags are set to YES.\n# Note: This will also disable the warnings about undocumented members that are\n# normally produced when WARNINGS is set to YES.\n# The default value is: NO.\n\nEXTRACT_ALL            = YES\n\n# If the EXTRACT_PRIVATE tag is set to YES all private members of a class will\n# be included in the documentation.\n# The default value is: NO.\n\nEXTRACT_PRIVATE        = YES\n\n# If the EXTRACT_PACKAGE tag is set to YES all members with package or internal\n# scope will be included in the documentation.\n# The default value is: NO.\n\nEXTRACT_PACKAGE        = NO\n\n# If the EXTRACT_STATIC tag is set to YES all static members of a file will be\n# included in the documentation.\n# The default value is: NO.\n\nEXTRACT_STATIC         = YES\n\n# If the EXTRACT_LOCAL_CLASSES tag is set to YES classes (and structs) defined\n# locally in source files will be included in the documentation. If set to NO\n# only classes defined in header files are included. Does not have any effect\n# for Java sources.\n# The default value is: YES.\n\nEXTRACT_LOCAL_CLASSES  = YES\n\n# This flag is only useful for Objective-C code. When set to YES local methods,\n# which are defined in the implementation section but not in the interface are\n# included in the documentation. If set to NO only methods in the interface are\n# included.\n# The default value is: NO.\n\nEXTRACT_LOCAL_METHODS  = NO\n\n# If this flag is set to YES, the members of anonymous namespaces will be\n# extracted and appear in the documentation as a namespace called\n# 'anonymous_namespace{file}', where file will be replaced with the base name of\n# the file that contains the anonymous namespace. By default anonymous namespace\n# are hidden.\n# The default value is: NO.\n\nEXTRACT_ANON_NSPACES   = NO\n\n# If the HIDE_UNDOC_MEMBERS tag is set to YES, doxygen will hide all\n# undocumented members inside documented classes or files. If set to NO these\n# members will be included in the various overviews, but no documentation\n# section is generated. This option has no effect if EXTRACT_ALL is enabled.\n# The default value is: NO.\n\nHIDE_UNDOC_MEMBERS     = NO\n\n# If the HIDE_UNDOC_CLASSES tag is set to YES, doxygen will hide all\n# undocumented classes that are normally visible in the class hierarchy. If set\n# to NO these classes will be included in the various overviews. This option has\n# no effect if EXTRACT_ALL is enabled.\n# The default value is: NO.\n\nHIDE_UNDOC_CLASSES     = NO\n\n# If the HIDE_FRIEND_COMPOUNDS tag is set to YES, doxygen will hide all friend\n# (class|struct|union) declarations. If set to NO these declarations will be\n# included in the documentation.\n# The default value is: NO.\n\nHIDE_FRIEND_COMPOUNDS  = NO\n\n# If the HIDE_IN_BODY_DOCS tag is set to YES, doxygen will hide any\n# documentation blocks found inside the body of a function. If set to NO these\n# blocks will be appended to the function's detailed documentation block.\n# The default value is: NO.\n\nHIDE_IN_BODY_DOCS      = NO\n\n# The INTERNAL_DOCS tag determines if documentation that is typed after a\n# \\internal command is included. If the tag is set to NO then the documentation\n# will be excluded. Set it to YES to include the internal documentation.\n# The default value is: NO.\n\nINTERNAL_DOCS          = NO\n\n# If the CASE_SENSE_NAMES tag is set to NO then doxygen will only generate file\n# names in lower-case letters. If set to YES upper-case letters are also\n# allowed. This is useful if you have classes or files whose names only differ\n# in case and if your file system supports case sensitive file names. Windows\n# and Mac users are advised to set this option to NO.\n# The default value is: system dependent.\n\nCASE_SENSE_NAMES       = YES\n\n# If the HIDE_SCOPE_NAMES tag is set to NO then doxygen will show members with\n# their full class and namespace scopes in the documentation. If set to YES the\n# scope will be hidden.\n# The default value is: NO.\n\nHIDE_SCOPE_NAMES       = NO\n\n# If the SHOW_INCLUDE_FILES tag is set to YES then doxygen will put a list of\n# the files that are included by a file in the documentation of that file.\n# The default value is: YES.\n\nSHOW_INCLUDE_FILES     = YES\n\n# If the SHOW_GROUPED_MEMB_INC tag is set to YES then Doxygen will add for each\n# grouped member an include statement to the documentation, telling the reader\n# which file to include in order to use the member.\n# The default value is: NO.\n\nSHOW_GROUPED_MEMB_INC  = NO\n\n# If the FORCE_LOCAL_INCLUDES tag is set to YES then doxygen will list include\n# files with double quotes in the documentation rather than with sharp brackets.\n# The default value is: NO.\n\nFORCE_LOCAL_INCLUDES   = NO\n\n# If the INLINE_INFO tag is set to YES then a tag [inline] is inserted in the\n# documentation for inline members.\n# The default value is: YES.\n\nINLINE_INFO            = YES\n\n# If the SORT_MEMBER_DOCS tag is set to YES then doxygen will sort the\n# (detailed) documentation of file and class members alphabetically by member\n# name. If set to NO the members will appear in declaration order.\n# The default value is: YES.\n\nSORT_MEMBER_DOCS       = YES\n\n# If the SORT_BRIEF_DOCS tag is set to YES then doxygen will sort the brief\n# descriptions of file, namespace and class members alphabetically by member\n# name. If set to NO the members will appear in declaration order. Note that\n# this will also influence the order of the classes in the class list.\n# The default value is: NO.\n\nSORT_BRIEF_DOCS        = NO\n\n# If the SORT_MEMBERS_CTORS_1ST tag is set to YES then doxygen will sort the\n# (brief and detailed) documentation of class members so that constructors and\n# destructors are listed first. If set to NO the constructors will appear in the\n# respective orders defined by SORT_BRIEF_DOCS and SORT_MEMBER_DOCS.\n# Note: If SORT_BRIEF_DOCS is set to NO this option is ignored for sorting brief\n# member documentation.\n# Note: If SORT_MEMBER_DOCS is set to NO this option is ignored for sorting\n# detailed member documentation.\n# The default value is: NO.\n\nSORT_MEMBERS_CTORS_1ST = NO\n\n# If the SORT_GROUP_NAMES tag is set to YES then doxygen will sort the hierarchy\n# of group names into alphabetical order. If set to NO the group names will\n# appear in their defined order.\n# The default value is: NO.\n\nSORT_GROUP_NAMES       = NO\n\n# If the SORT_BY_SCOPE_NAME tag is set to YES, the class list will be sorted by\n# fully-qualified names, including namespaces. If set to NO, the class list will\n# be sorted only by class name, not including the namespace part.\n# Note: This option is not very useful if HIDE_SCOPE_NAMES is set to YES.\n# Note: This option applies only to the class list, not to the alphabetical\n# list.\n# The default value is: NO.\n\nSORT_BY_SCOPE_NAME     = NO\n\n# If the STRICT_PROTO_MATCHING option is enabled and doxygen fails to do proper\n# type resolution of all parameters of a function it will reject a match between\n# the prototype and the implementation of a member function even if there is\n# only one candidate or it is obvious which candidate to choose by doing a\n# simple string match. By disabling STRICT_PROTO_MATCHING doxygen will still\n# accept a match between prototype and implementation in such cases.\n# The default value is: NO.\n\nSTRICT_PROTO_MATCHING  = NO\n\n# The GENERATE_TODOLIST tag can be used to enable ( YES) or disable ( NO) the\n# todo list. This list is created by putting \\todo commands in the\n# documentation.\n# The default value is: YES.\n\nGENERATE_TODOLIST      = YES\n\n# The GENERATE_TESTLIST tag can be used to enable ( YES) or disable ( NO) the\n# test list. This list is created by putting \\test commands in the\n# documentation.\n# The default value is: YES.\n\nGENERATE_TESTLIST      = YES\n\n# The GENERATE_BUGLIST tag can be used to enable ( YES) or disable ( NO) the bug\n# list. This list is created by putting \\bug commands in the documentation.\n# The default value is: YES.\n\nGENERATE_BUGLIST       = YES\n\n# The GENERATE_DEPRECATEDLIST tag can be used to enable ( YES) or disable ( NO)\n# the deprecated list. This list is created by putting \\deprecated commands in\n# the documentation.\n# The default value is: YES.\n\nGENERATE_DEPRECATEDLIST= YES\n\n# The ENABLED_SECTIONS tag can be used to enable conditional documentation\n# sections, marked by \\if <section_label> ... \\endif and \\cond <section_label>\n# ... \\endcond blocks.\n\nENABLED_SECTIONS       =\n\n# The MAX_INITIALIZER_LINES tag determines the maximum number of lines that the\n# initial value of a variable or macro / define can have for it to appear in the\n# documentation. If the initializer consists of more lines than specified here\n# it will be hidden. Use a value of 0 to hide initializers completely. The\n# appearance of the value of individual variables and macros / defines can be\n# controlled using \\showinitializer or \\hideinitializer command in the\n# documentation regardless of this setting.\n# Minimum value: 0, maximum value: 10000, default value: 30.\n\nMAX_INITIALIZER_LINES  = 30\n\n# Set the SHOW_USED_FILES tag to NO to disable the list of files generated at\n# the bottom of the documentation of classes and structs. If set to YES the list\n# will mention the files that were used to generate the documentation.\n# The default value is: YES.\n\nSHOW_USED_FILES        = YES\n\n# Set the SHOW_FILES tag to NO to disable the generation of the Files page. This\n# will remove the Files entry from the Quick Index and from the Folder Tree View\n# (if specified).\n# The default value is: YES.\n\nSHOW_FILES             = YES\n\n# Set the SHOW_NAMESPACES tag to NO to disable the generation of the Namespaces\n# page. This will remove the Namespaces entry from the Quick Index and from the\n# Folder Tree View (if specified).\n# The default value is: YES.\n\nSHOW_NAMESPACES        = YES\n\n# The FILE_VERSION_FILTER tag can be used to specify a program or script that\n# doxygen should invoke to get the current version for each file (typically from\n# the version control system). Doxygen will invoke the program by executing (via\n# popen()) the command command input-file, where command is the value of the\n# FILE_VERSION_FILTER tag, and input-file is the name of an input file provided\n# by doxygen. Whatever the program writes to standard output is used as the file\n# version. For an example see the documentation.\n\nFILE_VERSION_FILTER    =\n\n# The LAYOUT_FILE tag can be used to specify a layout file which will be parsed\n# by doxygen. The layout file controls the global structure of the generated\n# output files in an output format independent way. To create the layout file\n# that represents doxygen's defaults, run doxygen with the -l option. You can\n# optionally specify a file name after the option, if omitted DoxygenLayout.xml\n# will be used as the name of the layout file.\n#\n# Note that if you run doxygen from a directory containing a file called\n# DoxygenLayout.xml, doxygen will parse it automatically even if the LAYOUT_FILE\n# tag is left empty.\n\nLAYOUT_FILE            =\n\n# The CITE_BIB_FILES tag can be used to specify one or more bib files containing\n# the reference definitions. This must be a list of .bib files. The .bib\n# extension is automatically appended if omitted. This requires the bibtex tool\n# to be installed. See also http://en.wikipedia.org/wiki/BibTeX for more info.\n# For LaTeX the style of the bibliography can be controlled using\n# LATEX_BIB_STYLE. To use this feature you need bibtex and perl available in the\n# search path. Do not use file names with spaces, bibtex cannot handle them. See\n# also \\cite for info how to create references.\n\nCITE_BIB_FILES         =\n\n#---------------------------------------------------------------------------\n# Configuration options related to warning and progress messages\n#---------------------------------------------------------------------------\n\n# The QUIET tag can be used to turn on/off the messages that are generated to\n# standard output by doxygen. If QUIET is set to YES this implies that the\n# messages are off.\n# The default value is: NO.\n\nQUIET                  = NO\n\n# The WARNINGS tag can be used to turn on/off the warning messages that are\n# generated to standard error ( stderr) by doxygen. If WARNINGS is set to YES\n# this implies that the warnings are on.\n#\n# Tip: Turn warnings on while writing the documentation.\n# The default value is: YES.\n\nWARNINGS               = YES\n\n# If the WARN_IF_UNDOCUMENTED tag is set to YES, then doxygen will generate\n# warnings for undocumented members. If EXTRACT_ALL is set to YES then this flag\n# will automatically be disabled.\n# The default value is: YES.\n\nWARN_IF_UNDOCUMENTED   = YES\n\n# If the WARN_IF_DOC_ERROR tag is set to YES, doxygen will generate warnings for\n# potential errors in the documentation, such as not documenting some parameters\n# in a documented function, or documenting parameters that don't exist or using\n# markup commands wrongly.\n# The default value is: YES.\n\nWARN_IF_DOC_ERROR      = YES\n\n# This WARN_NO_PARAMDOC option can be enabled to get warnings for functions that\n# are documented, but have no documentation for their parameters or return\n# value. If set to NO doxygen will only warn about wrong or incomplete parameter\n# documentation, but not about the absence of documentation.\n# The default value is: NO.\n\nWARN_NO_PARAMDOC       = NO\n\n# The WARN_FORMAT tag determines the format of the warning messages that doxygen\n# can produce. The string should contain the $file, $line, and $text tags, which\n# will be replaced by the file and line number from which the warning originated\n# and the warning text. Optionally the format may contain $version, which will\n# be replaced by the version of the file (if it could be obtained via\n# FILE_VERSION_FILTER)\n# The default value is: $file:$line: $text.\n\nWARN_FORMAT            = \"$file:$line: $text\"\n\n# The WARN_LOGFILE tag can be used to specify a file to which warning and error\n# messages should be written. If left blank the output is written to standard\n# error (stderr).\n\nWARN_LOGFILE           =\n\n#---------------------------------------------------------------------------\n# Configuration options related to the input files\n#---------------------------------------------------------------------------\n\n# The INPUT tag is used to specify the files and/or directories that contain\n# documented source files. You may enter file names like myfile.cpp or\n# directories like /usr/src/myproject. Separate the files or directories with\n# spaces.\n# Note: If this tag is empty the current directory is searched.\n\nINPUT                  = ../README.md \"../src\"\n\n# This tag can be used to specify the character encoding of the source files\n# that doxygen parses. Internally doxygen uses the UTF-8 encoding. Doxygen uses\n# libiconv (or the iconv built into libc) for the transcoding. See the libiconv\n# documentation (see: http://www.gnu.org/software/libiconv) for the list of\n# possible encodings.\n# The default value is: UTF-8.\n\nINPUT_ENCODING         = UTF-8\n\n# If the value of the INPUT tag contains directories, you can use the\n# FILE_PATTERNS tag to specify one or more wildcard patterns (like *.cpp and\n# *.h) to filter out the source-files in the directories. If left blank the\n# following patterns are tested:*.c, *.cc, *.cxx, *.cpp, *.c++, *.java, *.ii,\n# *.ixx, *.ipp, *.i++, *.inl, *.idl, *.ddl, *.odl, *.h, *.hh, *.hxx, *.hpp,\n# *.h++, *.cs, *.d, *.php, *.php4, *.php5, *.phtml, *.inc, *.m, *.markdown,\n# *.md, *.mm, *.dox, *.py, *.f90, *.f, *.for, *.tcl, *.vhd, *.vhdl, *.ucf,\n# *.qsf, *.as and *.js.\n\nFILE_PATTERNS          =\n\n# The RECURSIVE tag can be used to specify whether or not subdirectories should\n# be searched for input files as well.\n# The default value is: NO.\n\nRECURSIVE              = YES\n\n# The EXCLUDE tag can be used to specify files and/or directories that should be\n# excluded from the INPUT source files. This way you can easily exclude a\n# subdirectory from a directory tree whose root is specified with the INPUT tag.\n#\n# Note that relative paths are relative to the directory from which doxygen is\n# run.\n\nEXCLUDE                =\n\n# The EXCLUDE_SYMLINKS tag can be used to select whether or not files or\n# directories that are symbolic links (a Unix file system feature) are excluded\n# from the input.\n# The default value is: NO.\n\nEXCLUDE_SYMLINKS       = NO\n\n# If the value of the INPUT tag contains directories, you can use the\n# EXCLUDE_PATTERNS tag to specify one or more wildcard patterns to exclude\n# certain files from those directories.\n#\n# Note that the wildcards are matched against the file with absolute path, so to\n# exclude all test directories for example use the pattern */test/*\n\nEXCLUDE_PATTERNS       =\n\n# The EXCLUDE_SYMBOLS tag can be used to specify one or more symbol names\n# (namespaces, classes, functions, etc.) that should be excluded from the\n# output. The symbol name can be a fully qualified name, a word, or if the\n# wildcard * is used, a substring. Examples: ANamespace, AClass,\n# AClass::ANamespace, ANamespace::*Test\n#\n# Note that the wildcards are matched against the file with absolute path, so to\n# exclude all test directories use the pattern */test/*\n\nEXCLUDE_SYMBOLS        =\n\n# The EXAMPLE_PATH tag can be used to specify one or more files or directories\n# that contain example code fragments that are included (see the \\include\n# command).\n\nEXAMPLE_PATH           =\n\n# If the value of the EXAMPLE_PATH tag contains directories, you can use the\n# EXAMPLE_PATTERNS tag to specify one or more wildcard pattern (like *.cpp and\n# *.h) to filter out the source-files in the directories. If left blank all\n# files are included.\n\nEXAMPLE_PATTERNS       =\n\n# If the EXAMPLE_RECURSIVE tag is set to YES then subdirectories will be\n# searched for input files to be used with the \\include or \\dontinclude commands\n# irrespective of the value of the RECURSIVE tag.\n# The default value is: NO.\n\nEXAMPLE_RECURSIVE      = NO\n\n# The IMAGE_PATH tag can be used to specify one or more files or directories\n# that contain images that are to be included in the documentation (see the\n# \\image command).\n\nIMAGE_PATH             =\n\n# The INPUT_FILTER tag can be used to specify a program that doxygen should\n# invoke to filter for each input file. Doxygen will invoke the filter program\n# by executing (via popen()) the command:\n#\n# <filter> <input-file>\n#\n# where <filter> is the value of the INPUT_FILTER tag, and <input-file> is the\n# name of an input file. Doxygen will then use the output that the filter\n# program writes to standard output. If FILTER_PATTERNS is specified, this tag\n# will be ignored.\n#\n# Note that the filter must not add or remove lines; it is applied before the\n# code is scanned, but not when the output code is generated. If lines are added\n# or removed, the anchors will not be placed correctly.\n\nINPUT_FILTER           =\n\n# The FILTER_PATTERNS tag can be used to specify filters on a per file pattern\n# basis. Doxygen will compare the file name with each pattern and apply the\n# filter if there is a match. The filters are a list of the form: pattern=filter\n# (like *.cpp=my_cpp_filter). See INPUT_FILTER for further information on how\n# filters are used. If the FILTER_PATTERNS tag is empty or if none of the\n# patterns match the file name, INPUT_FILTER is applied.\n\nFILTER_PATTERNS        =\n\n# If the FILTER_SOURCE_FILES tag is set to YES, the input filter (if set using\n# INPUT_FILTER ) will also be used to filter the input files that are used for\n# producing the source files to browse (i.e. when SOURCE_BROWSER is set to YES).\n# The default value is: NO.\n\nFILTER_SOURCE_FILES    = NO\n\n# The FILTER_SOURCE_PATTERNS tag can be used to specify source filters per file\n# pattern. A pattern will override the setting for FILTER_PATTERN (if any) and\n# it is also possible to disable source filtering for a specific pattern using\n# *.ext= (so without naming a filter).\n# This tag requires that the tag FILTER_SOURCE_FILES is set to YES.\n\nFILTER_SOURCE_PATTERNS =\n\n# If the USE_MDFILE_AS_MAINPAGE tag refers to the name of a markdown file that\n# is part of the input, its contents will be placed on the main page\n# (index.html). This can be useful if you have a project on for instance GitHub\n# and want to reuse the introduction page also for the doxygen output.\n\nUSE_MDFILE_AS_MAINPAGE = README.md\n\n#---------------------------------------------------------------------------\n# Configuration options related to source browsing\n#---------------------------------------------------------------------------\n\n# If the SOURCE_BROWSER tag is set to YES then a list of source files will be\n# generated. Documented entities will be cross-referenced with these sources.\n#\n# Note: To get rid of all source code in the generated output, make sure that\n# also VERBATIM_HEADERS is set to NO.\n# The default value is: NO.\n\nSOURCE_BROWSER         = NO\n\n# Setting the INLINE_SOURCES tag to YES will include the body of functions,\n# classes and enums directly into the documentation.\n# The default value is: NO.\n\nINLINE_SOURCES         = NO\n\n# Setting the STRIP_CODE_COMMENTS tag to YES will instruct doxygen to hide any\n# special comment blocks from generated source code fragments. Normal C, C++ and\n# Fortran comments will always remain visible.\n# The default value is: YES.\n\nSTRIP_CODE_COMMENTS    = YES\n\n# If the REFERENCED_BY_RELATION tag is set to YES then for each documented\n# function all documented functions referencing it will be listed.\n# The default value is: NO.\n\nREFERENCED_BY_RELATION = NO\n\n# If the REFERENCES_RELATION tag is set to YES then for each documented function\n# all documented entities called/used by that function will be listed.\n# The default value is: NO.\n\nREFERENCES_RELATION    = NO\n\n# If the REFERENCES_LINK_SOURCE tag is set to YES and SOURCE_BROWSER tag is set\n# to YES, then the hyperlinks from functions in REFERENCES_RELATION and\n# REFERENCED_BY_RELATION lists will link to the source code. Otherwise they will\n# link to the documentation.\n# The default value is: YES.\n\nREFERENCES_LINK_SOURCE = YES\n\n# If SOURCE_TOOLTIPS is enabled (the default) then hovering a hyperlink in the\n# source code will show a tooltip with additional information such as prototype,\n# brief description and links to the definition and documentation. Since this\n# will make the HTML file larger and loading of large files a bit slower, you\n# can opt to disable this feature.\n# The default value is: YES.\n# This tag requires that the tag SOURCE_BROWSER is set to YES.\n\nSOURCE_TOOLTIPS        = YES\n\n# If the USE_HTAGS tag is set to YES then the references to source code will\n# point to the HTML generated by the htags(1) tool instead of doxygen built-in\n# source browser. The htags tool is part of GNU's global source tagging system\n# (see http://www.gnu.org/software/global/global.html). You will need version\n# 4.8.6 or higher.\n#\n# To use it do the following:\n# - Install the latest version of global\n# - Enable SOURCE_BROWSER and USE_HTAGS in the config file\n# - Make sure the INPUT points to the root of the source tree\n# - Run doxygen as normal\n#\n# Doxygen will invoke htags (and that will in turn invoke gtags), so these\n# tools must be available from the command line (i.e. in the search path).\n#\n# The result: instead of the source browser generated by doxygen, the links to\n# source code will now point to the output of htags.\n# The default value is: NO.\n# This tag requires that the tag SOURCE_BROWSER is set to YES.\n\nUSE_HTAGS              = NO\n\n# If the VERBATIM_HEADERS tag is set the YES then doxygen will generate a\n# verbatim copy of the header file for each class for which an include is\n# specified. Set to NO to disable this.\n# See also: Section \\class.\n# The default value is: YES.\n\nVERBATIM_HEADERS       = YES\n\n#---------------------------------------------------------------------------\n# Configuration options related to the alphabetical class index\n#---------------------------------------------------------------------------\n\n# If the ALPHABETICAL_INDEX tag is set to YES, an alphabetical index of all\n# compounds will be generated. Enable this if the project contains a lot of\n# classes, structs, unions or interfaces.\n# The default value is: YES.\n\nALPHABETICAL_INDEX     = YES\n\n# The COLS_IN_ALPHA_INDEX tag can be used to specify the number of columns in\n# which the alphabetical index list will be split.\n# Minimum value: 1, maximum value: 20, default value: 5.\n# This tag requires that the tag ALPHABETICAL_INDEX is set to YES.\n\nCOLS_IN_ALPHA_INDEX    = 5\n\n# In case all classes in a project start with a common prefix, all classes will\n# be put under the same header in the alphabetical index. The IGNORE_PREFIX tag\n# can be used to specify a prefix (or a list of prefixes) that should be ignored\n# while generating the index headers.\n# This tag requires that the tag ALPHABETICAL_INDEX is set to YES.\n\nIGNORE_PREFIX          =\n\n#---------------------------------------------------------------------------\n# Configuration options related to the HTML output\n#---------------------------------------------------------------------------\n\n# If the GENERATE_HTML tag is set to YES doxygen will generate HTML output\n# The default value is: YES.\n\nGENERATE_HTML          = YES\n\n# The HTML_OUTPUT tag is used to specify where the HTML docs will be put. If a\n# relative path is entered the value of OUTPUT_DIRECTORY will be put in front of\n# it.\n# The default directory is: html.\n# This tag requires that the tag GENERATE_HTML is set to YES.\n\nHTML_OUTPUT            = html\n\n# The HTML_FILE_EXTENSION tag can be used to specify the file extension for each\n# generated HTML page (for example: .htm, .php, .asp).\n# The default value is: .html.\n# This tag requires that the tag GENERATE_HTML is set to YES.\n\nHTML_FILE_EXTENSION    = .html\n\n# The HTML_HEADER tag can be used to specify a user-defined HTML header file for\n# each generated HTML page. If the tag is left blank doxygen will generate a\n# standard header.\n#\n# To get valid HTML the header file that includes any scripts and style sheets\n# that doxygen needs, which is dependent on the configuration options used (e.g.\n# the setting GENERATE_TREEVIEW). It is highly recommended to start with a\n# default header using\n# doxygen -w html new_header.html new_footer.html new_stylesheet.css\n# YourConfigFile\n# and then modify the file new_header.html. See also section \"Doxygen usage\"\n# for information on how to generate the default header that doxygen normally\n# uses.\n# Note: The header is subject to change so you typically have to regenerate the\n# default header when upgrading to a newer version of doxygen. For a description\n# of the possible markers and block names see the documentation.\n# This tag requires that the tag GENERATE_HTML is set to YES.\n\nHTML_HEADER            =\n\n# The HTML_FOOTER tag can be used to specify a user-defined HTML footer for each\n# generated HTML page. If the tag is left blank doxygen will generate a standard\n# footer. See HTML_HEADER for more information on how to generate a default\n# footer and what special commands can be used inside the footer. See also\n# section \"Doxygen usage\" for information on how to generate the default footer\n# that doxygen normally uses.\n# This tag requires that the tag GENERATE_HTML is set to YES.\n\nHTML_FOOTER            =\n\n# The HTML_STYLESHEET tag can be used to specify a user-defined cascading style\n# sheet that is used by each HTML page. It can be used to fine-tune the look of\n# the HTML output. If left blank doxygen will generate a default style sheet.\n# See also section \"Doxygen usage\" for information on how to generate the style\n# sheet that doxygen normally uses.\n# Note: It is recommended to use HTML_EXTRA_STYLESHEET instead of this tag, as\n# it is more robust and this tag (HTML_STYLESHEET) will in the future become\n# obsolete.\n# This tag requires that the tag GENERATE_HTML is set to YES.\n\nHTML_STYLESHEET        =\n\n# The HTML_EXTRA_STYLESHEET tag can be used to specify an additional user-\n# defined cascading style sheet that is included after the standard style sheets\n# created by doxygen. Using this option one can overrule certain style aspects.\n# This is preferred over using HTML_STYLESHEET since it does not replace the\n# standard style sheet and is therefor more robust against future updates.\n# Doxygen will copy the style sheet file to the output directory. For an example\n# see the documentation.\n# This tag requires that the tag GENERATE_HTML is set to YES.\n\nHTML_EXTRA_STYLESHEET  =\n\n# The HTML_EXTRA_FILES tag can be used to specify one or more extra images or\n# other source files which should be copied to the HTML output directory. Note\n# that these files will be copied to the base HTML output directory. Use the\n# $relpath^ marker in the HTML_HEADER and/or HTML_FOOTER files to load these\n# files. In the HTML_STYLESHEET file, use the file name only. Also note that the\n# files will be copied as-is; there are no commands or markers available.\n# This tag requires that the tag GENERATE_HTML is set to YES.\n\nHTML_EXTRA_FILES       =\n\n# The HTML_COLORSTYLE_HUE tag controls the color of the HTML output. Doxygen\n# will adjust the colors in the stylesheet and background images according to\n# this color. Hue is specified as an angle on a colorwheel, see\n# http://en.wikipedia.org/wiki/Hue for more information. For instance the value\n# 0 represents red, 60 is yellow, 120 is green, 180 is cyan, 240 is blue, 300\n# purple, and 360 is red again.\n# Minimum value: 0, maximum value: 359, default value: 220.\n# This tag requires that the tag GENERATE_HTML is set to YES.\n\nHTML_COLORSTYLE_HUE    = 220\n\n# The HTML_COLORSTYLE_SAT tag controls the purity (or saturation) of the colors\n# in the HTML output. For a value of 0 the output will use grayscales only. A\n# value of 255 will produce the most vivid colors.\n# Minimum value: 0, maximum value: 255, default value: 100.\n# This tag requires that the tag GENERATE_HTML is set to YES.\n\nHTML_COLORSTYLE_SAT    = 100\n\n# The HTML_COLORSTYLE_GAMMA tag controls the gamma correction applied to the\n# luminance component of the colors in the HTML output. Values below 100\n# gradually make the output lighter, whereas values above 100 make the output\n# darker. The value divided by 100 is the actual gamma applied, so 80 represents\n# a gamma of 0.8, The value 220 represents a gamma of 2.2, and 100 does not\n# change the gamma.\n# Minimum value: 40, maximum value: 240, default value: 80.\n# This tag requires that the tag GENERATE_HTML is set to YES.\n\nHTML_COLORSTYLE_GAMMA  = 80\n\n# If the HTML_TIMESTAMP tag is set to YES then the footer of each generated HTML\n# page will contain the date and time when the page was generated. Setting this\n# to NO can help when comparing the output of multiple runs.\n# The default value is: YES.\n# This tag requires that the tag GENERATE_HTML is set to YES.\n\nHTML_TIMESTAMP         = YES\n\n# If the HTML_DYNAMIC_SECTIONS tag is set to YES then the generated HTML\n# documentation will contain sections that can be hidden and shown after the\n# page has loaded.\n# The default value is: NO.\n# This tag requires that the tag GENERATE_HTML is set to YES.\n\nHTML_DYNAMIC_SECTIONS  = NO\n\n# With HTML_INDEX_NUM_ENTRIES one can control the preferred number of entries\n# shown in the various tree structured indices initially; the user can expand\n# and collapse entries dynamically later on. Doxygen will expand the tree to\n# such a level that at most the specified number of entries are visible (unless\n# a fully collapsed tree already exceeds this amount). So setting the number of\n# entries 1 will produce a full collapsed tree by default. 0 is a special value\n# representing an infinite number of entries and will result in a full expanded\n# tree by default.\n# Minimum value: 0, maximum value: 9999, default value: 100.\n# This tag requires that the tag GENERATE_HTML is set to YES.\n\nHTML_INDEX_NUM_ENTRIES = 100\n\n# If the GENERATE_DOCSET tag is set to YES, additional index files will be\n# generated that can be used as input for Apple's Xcode 3 integrated development\n# environment (see: http://developer.apple.com/tools/xcode/), introduced with\n# OSX 10.5 (Leopard). To create a documentation set, doxygen will generate a\n# Makefile in the HTML output directory. Running make will produce the docset in\n# that directory and running make install will install the docset in\n# ~/Library/Developer/Shared/Documentation/DocSets so that Xcode will find it at\n# startup. See http://developer.apple.com/tools/creatingdocsetswithdoxygen.html\n# for more information.\n# The default value is: NO.\n# This tag requires that the tag GENERATE_HTML is set to YES.\n\nGENERATE_DOCSET        = NO\n\n# This tag determines the name of the docset feed. A documentation feed provides\n# an umbrella under which multiple documentation sets from a single provider\n# (such as a company or product suite) can be grouped.\n# The default value is: Doxygen generated docs.\n# This tag requires that the tag GENERATE_DOCSET is set to YES.\n\nDOCSET_FEEDNAME        = \"Doxygen generated docs\"\n\n# This tag specifies a string that should uniquely identify the documentation\n# set bundle. This should be a reverse domain-name style string, e.g.\n# com.mycompany.MyDocSet. Doxygen will append .docset to the name.\n# The default value is: org.doxygen.Project.\n# This tag requires that the tag GENERATE_DOCSET is set to YES.\n\nDOCSET_BUNDLE_ID       = org.doxygen.Project\n\n# The DOCSET_PUBLISHER_ID tag specifies a string that should uniquely identify\n# the documentation publisher. This should be a reverse domain-name style\n# string, e.g. com.mycompany.MyDocSet.documentation.\n# The default value is: org.doxygen.Publisher.\n# This tag requires that the tag GENERATE_DOCSET is set to YES.\n\nDOCSET_PUBLISHER_ID    = org.doxygen.Publisher\n\n# The DOCSET_PUBLISHER_NAME tag identifies the documentation publisher.\n# The default value is: Publisher.\n# This tag requires that the tag GENERATE_DOCSET is set to YES.\n\nDOCSET_PUBLISHER_NAME  = Publisher\n\n# If the GENERATE_HTMLHELP tag is set to YES then doxygen generates three\n# additional HTML index files: index.hhp, index.hhc, and index.hhk. The\n# index.hhp is a project file that can be read by Microsoft's HTML Help Workshop\n# (see: http://www.microsoft.com/en-us/download/details.aspx?id=21138) on\n# Windows.\n#\n# The HTML Help Workshop contains a compiler that can convert all HTML output\n# generated by doxygen into a single compiled HTML file (.chm). Compiled HTML\n# files are now used as the Windows 98 help format, and will replace the old\n# Windows help format (.hlp) on all Windows platforms in the future. Compressed\n# HTML files also contain an index, a table of contents, and you can search for\n# words in the documentation. The HTML workshop also contains a viewer for\n# compressed HTML files.\n# The default value is: NO.\n# This tag requires that the tag GENERATE_HTML is set to YES.\n\nGENERATE_HTMLHELP      = NO\n\n# The CHM_FILE tag can be used to specify the file name of the resulting .chm\n# file. You can add a path in front of the file if the result should not be\n# written to the html output directory.\n# This tag requires that the tag GENERATE_HTMLHELP is set to YES.\n\nCHM_FILE               =\n\n# The HHC_LOCATION tag can be used to specify the location (absolute path\n# including file name) of the HTML help compiler ( hhc.exe). If non-empty\n# doxygen will try to run the HTML help compiler on the generated index.hhp.\n# The file has to be specified with full path.\n# This tag requires that the tag GENERATE_HTMLHELP is set to YES.\n\nHHC_LOCATION           =\n\n# The GENERATE_CHI flag controls if a separate .chi index file is generated (\n# YES) or that it should be included in the master .chm file ( NO).\n# The default value is: NO.\n# This tag requires that the tag GENERATE_HTMLHELP is set to YES.\n\nGENERATE_CHI           = NO\n\n# The CHM_INDEX_ENCODING is used to encode HtmlHelp index ( hhk), content ( hhc)\n# and project file content.\n# This tag requires that the tag GENERATE_HTMLHELP is set to YES.\n\nCHM_INDEX_ENCODING     =\n\n# The BINARY_TOC flag controls whether a binary table of contents is generated (\n# YES) or a normal table of contents ( NO) in the .chm file.\n# The default value is: NO.\n# This tag requires that the tag GENERATE_HTMLHELP is set to YES.\n\nBINARY_TOC             = NO\n\n# The TOC_EXPAND flag can be set to YES to add extra items for group members to\n# the table of contents of the HTML help documentation and to the tree view.\n# The default value is: NO.\n# This tag requires that the tag GENERATE_HTMLHELP is set to YES.\n\nTOC_EXPAND             = NO\n\n# If the GENERATE_QHP tag is set to YES and both QHP_NAMESPACE and\n# QHP_VIRTUAL_FOLDER are set, an additional index file will be generated that\n# can be used as input for Qt's qhelpgenerator to generate a Qt Compressed Help\n# (.qch) of the generated HTML documentation.\n# The default value is: NO.\n# This tag requires that the tag GENERATE_HTML is set to YES.\n\nGENERATE_QHP           = NO\n\n# If the QHG_LOCATION tag is specified, the QCH_FILE tag can be used to specify\n# the file name of the resulting .qch file. The path specified is relative to\n# the HTML output folder.\n# This tag requires that the tag GENERATE_QHP is set to YES.\n\nQCH_FILE               =\n\n# The QHP_NAMESPACE tag specifies the namespace to use when generating Qt Help\n# Project output. For more information please see Qt Help Project / Namespace\n# (see: http://qt-project.org/doc/qt-4.8/qthelpproject.html#namespace).\n# The default value is: org.doxygen.Project.\n# This tag requires that the tag GENERATE_QHP is set to YES.\n\nQHP_NAMESPACE          = org.doxygen.Project\n\n# The QHP_VIRTUAL_FOLDER tag specifies the namespace to use when generating Qt\n# Help Project output. For more information please see Qt Help Project / Virtual\n# Folders (see: http://qt-project.org/doc/qt-4.8/qthelpproject.html#virtual-\n# folders).\n# The default value is: doc.\n# This tag requires that the tag GENERATE_QHP is set to YES.\n\nQHP_VIRTUAL_FOLDER     = doc\n\n# If the QHP_CUST_FILTER_NAME tag is set, it specifies the name of a custom\n# filter to add. For more information please see Qt Help Project / Custom\n# Filters (see: http://qt-project.org/doc/qt-4.8/qthelpproject.html#custom-\n# filters).\n# This tag requires that the tag GENERATE_QHP is set to YES.\n\nQHP_CUST_FILTER_NAME   =\n\n# The QHP_CUST_FILTER_ATTRS tag specifies the list of the attributes of the\n# custom filter to add. For more information please see Qt Help Project / Custom\n# Filters (see: http://qt-project.org/doc/qt-4.8/qthelpproject.html#custom-\n# filters).\n# This tag requires that the tag GENERATE_QHP is set to YES.\n\nQHP_CUST_FILTER_ATTRS  =\n\n# The QHP_SECT_FILTER_ATTRS tag specifies the list of the attributes this\n# project's filter section matches. Qt Help Project / Filter Attributes (see:\n# http://qt-project.org/doc/qt-4.8/qthelpproject.html#filter-attributes).\n# This tag requires that the tag GENERATE_QHP is set to YES.\n\nQHP_SECT_FILTER_ATTRS  =\n\n# The QHG_LOCATION tag can be used to specify the location of Qt's\n# qhelpgenerator. If non-empty doxygen will try to run qhelpgenerator on the\n# generated .qhp file.\n# This tag requires that the tag GENERATE_QHP is set to YES.\n\nQHG_LOCATION           =\n\n# If the GENERATE_ECLIPSEHELP tag is set to YES, additional index files will be\n# generated, together with the HTML files, they form an Eclipse help plugin. To\n# install this plugin and make it available under the help contents menu in\n# Eclipse, the contents of the directory containing the HTML and XML files needs\n# to be copied into the plugins directory of eclipse. The name of the directory\n# within the plugins directory should be the same as the ECLIPSE_DOC_ID value.\n# After copying Eclipse needs to be restarted before the help appears.\n# The default value is: NO.\n# This tag requires that the tag GENERATE_HTML is set to YES.\n\nGENERATE_ECLIPSEHELP   = NO\n\n# A unique identifier for the Eclipse help plugin. When installing the plugin\n# the directory name containing the HTML and XML files should also have this\n# name. Each documentation set should have its own identifier.\n# The default value is: org.doxygen.Project.\n# This tag requires that the tag GENERATE_ECLIPSEHELP is set to YES.\n\nECLIPSE_DOC_ID         = org.doxygen.Project\n\n# If you want full control over the layout of the generated HTML pages it might\n# be necessary to disable the index and replace it with your own. The\n# DISABLE_INDEX tag can be used to turn on/off the condensed index (tabs) at top\n# of each HTML page. A value of NO enables the index and the value YES disables\n# it. Since the tabs in the index contain the same information as the navigation\n# tree, you can set this option to YES if you also set GENERATE_TREEVIEW to YES.\n# The default value is: NO.\n# This tag requires that the tag GENERATE_HTML is set to YES.\n\nDISABLE_INDEX          = NO\n\n# The GENERATE_TREEVIEW tag is used to specify whether a tree-like index\n# structure should be generated to display hierarchical information. If the tag\n# value is set to YES, a side panel will be generated containing a tree-like\n# index structure (just like the one that is generated for HTML Help). For this\n# to work a browser that supports JavaScript, DHTML, CSS and frames is required\n# (i.e. any modern browser). Windows users are probably better off using the\n# HTML help feature. Via custom stylesheets (see HTML_EXTRA_STYLESHEET) one can\n# further fine-tune the look of the index. As an example, the default style\n# sheet generated by doxygen has an example that shows how to put an image at\n# the root of the tree instead of the PROJECT_NAME. Since the tree basically has\n# the same information as the tab index, you could consider setting\n# DISABLE_INDEX to YES when enabling this option.\n# The default value is: NO.\n# This tag requires that the tag GENERATE_HTML is set to YES.\n\nGENERATE_TREEVIEW      = NO\n\n# The ENUM_VALUES_PER_LINE tag can be used to set the number of enum values that\n# doxygen will group on one line in the generated HTML documentation.\n#\n# Note that a value of 0 will completely suppress the enum values from appearing\n# in the overview section.\n# Minimum value: 0, maximum value: 20, default value: 4.\n# This tag requires that the tag GENERATE_HTML is set to YES.\n\nENUM_VALUES_PER_LINE   = 4\n\n# If the treeview is enabled (see GENERATE_TREEVIEW) then this tag can be used\n# to set the initial width (in pixels) of the frame in which the tree is shown.\n# Minimum value: 0, maximum value: 1500, default value: 250.\n# This tag requires that the tag GENERATE_HTML is set to YES.\n\nTREEVIEW_WIDTH         = 250\n\n# When the EXT_LINKS_IN_WINDOW option is set to YES doxygen will open links to\n# external symbols imported via tag files in a separate window.\n# The default value is: NO.\n# This tag requires that the tag GENERATE_HTML is set to YES.\n\nEXT_LINKS_IN_WINDOW    = NO\n\n# Use this tag to change the font size of LaTeX formulas included as images in\n# the HTML documentation. When you change the font size after a successful\n# doxygen run you need to manually remove any form_*.png images from the HTML\n# output directory to force them to be regenerated.\n# Minimum value: 8, maximum value: 50, default value: 10.\n# This tag requires that the tag GENERATE_HTML is set to YES.\n\nFORMULA_FONTSIZE       = 10\n\n# Use the FORMULA_TRANPARENT tag to determine whether or not the images\n# generated for formulas are transparent PNGs. Transparent PNGs are not\n# supported properly for IE 6.0, but are supported on all modern browsers.\n#\n# Note that when changing this option you need to delete any form_*.png files in\n# the HTML output directory before the changes have effect.\n# The default value is: YES.\n# This tag requires that the tag GENERATE_HTML is set to YES.\n\nFORMULA_TRANSPARENT    = YES\n\n# Enable the USE_MATHJAX option to render LaTeX formulas using MathJax (see\n# http://www.mathjax.org) which uses client side Javascript for the rendering\n# instead of using prerendered bitmaps. Use this if you do not have LaTeX\n# installed or if you want to formulas look prettier in the HTML output. When\n# enabled you may also need to install MathJax separately and configure the path\n# to it using the MATHJAX_RELPATH option.\n# The default value is: NO.\n# This tag requires that the tag GENERATE_HTML is set to YES.\n\nUSE_MATHJAX            = NO\n\n# When MathJax is enabled you can set the default output format to be used for\n# the MathJax output. See the MathJax site (see:\n# http://docs.mathjax.org/en/latest/output.html) for more details.\n# Possible values are: HTML-CSS (which is slower, but has the best\n# compatibility), NativeMML (i.e. MathML) and SVG.\n# The default value is: HTML-CSS.\n# This tag requires that the tag USE_MATHJAX is set to YES.\n\nMATHJAX_FORMAT         = HTML-CSS\n\n# When MathJax is enabled you need to specify the location relative to the HTML\n# output directory using the MATHJAX_RELPATH option. The destination directory\n# should contain the MathJax.js script. For instance, if the mathjax directory\n# is located at the same level as the HTML output directory, then\n# MATHJAX_RELPATH should be ../mathjax. The default value points to the MathJax\n# Content Delivery Network so you can quickly see the result without installing\n# MathJax. However, it is strongly recommended to install a local copy of\n# MathJax from http://www.mathjax.org before deployment.\n# The default value is: http://cdn.mathjax.org/mathjax/latest.\n# This tag requires that the tag USE_MATHJAX is set to YES.\n\nMATHJAX_RELPATH        = http://cdn.mathjax.org/mathjax/latest\n\n# The MATHJAX_EXTENSIONS tag can be used to specify one or more MathJax\n# extension names that should be enabled during MathJax rendering. For example\n# MATHJAX_EXTENSIONS = TeX/AMSmath TeX/AMSsymbols\n# This tag requires that the tag USE_MATHJAX is set to YES.\n\nMATHJAX_EXTENSIONS     =\n\n# The MATHJAX_CODEFILE tag can be used to specify a file with javascript pieces\n# of code that will be used on startup of the MathJax code. See the MathJax site\n# (see: http://docs.mathjax.org/en/latest/output.html) for more details. For an\n# example see the documentation.\n# This tag requires that the tag USE_MATHJAX is set to YES.\n\nMATHJAX_CODEFILE       =\n\n# When the SEARCHENGINE tag is enabled doxygen will generate a search box for\n# the HTML output. The underlying search engine uses javascript and DHTML and\n# should work on any modern browser. Note that when using HTML help\n# (GENERATE_HTMLHELP), Qt help (GENERATE_QHP), or docsets (GENERATE_DOCSET)\n# there is already a search function so this one should typically be disabled.\n# For large projects the javascript based search engine can be slow, then\n# enabling SERVER_BASED_SEARCH may provide a better solution. It is possible to\n# search using the keyboard; to jump to the search box use <access key> + S\n# (what the <access key> is depends on the OS and browser, but it is typically\n# <CTRL>, <ALT>/<option>, or both). Inside the search box use the <cursor down\n# key> to jump into the search results window, the results can be navigated\n# using the <cursor keys>. Press <Enter> to select an item or <escape> to cancel\n# the search. The filter options can be selected when the cursor is inside the\n# search box by pressing <Shift>+<cursor down>. Also here use the <cursor keys>\n# to select a filter and <Enter> or <escape> to activate or cancel the filter\n# option.\n# The default value is: YES.\n# This tag requires that the tag GENERATE_HTML is set to YES.\n\nSEARCHENGINE           = YES\n\n# When the SERVER_BASED_SEARCH tag is enabled the search engine will be\n# implemented using a web server instead of a web client using Javascript. There\n# are two flavours of web server based searching depending on the\n# EXTERNAL_SEARCH setting. When disabled, doxygen will generate a PHP script for\n# searching and an index file used by the script. When EXTERNAL_SEARCH is\n# enabled the indexing and searching needs to be provided by external tools. See\n# the section \"External Indexing and Searching\" for details.\n# The default value is: NO.\n# This tag requires that the tag SEARCHENGINE is set to YES.\n\nSERVER_BASED_SEARCH    = NO\n\n# When EXTERNAL_SEARCH tag is enabled doxygen will no longer generate the PHP\n# script for searching. Instead the search results are written to an XML file\n# which needs to be processed by an external indexer. Doxygen will invoke an\n# external search engine pointed to by the SEARCHENGINE_URL option to obtain the\n# search results.\n#\n# Doxygen ships with an example indexer ( doxyindexer) and search engine\n# (doxysearch.cgi) which are based on the open source search engine library\n# Xapian (see: http://xapian.org/).\n#\n# See the section \"External Indexing and Searching\" for details.\n# The default value is: NO.\n# This tag requires that the tag SEARCHENGINE is set to YES.\n\nEXTERNAL_SEARCH        = NO\n\n# The SEARCHENGINE_URL should point to a search engine hosted by a web server\n# which will return the search results when EXTERNAL_SEARCH is enabled.\n#\n# Doxygen ships with an example indexer ( doxyindexer) and search engine\n# (doxysearch.cgi) which are based on the open source search engine library\n# Xapian (see: http://xapian.org/). See the section \"External Indexing and\n# Searching\" for details.\n# This tag requires that the tag SEARCHENGINE is set to YES.\n\nSEARCHENGINE_URL       =\n\n# When SERVER_BASED_SEARCH and EXTERNAL_SEARCH are both enabled the unindexed\n# search data is written to a file for indexing by an external tool. With the\n# SEARCHDATA_FILE tag the name of this file can be specified.\n# The default file is: searchdata.xml.\n# This tag requires that the tag SEARCHENGINE is set to YES.\n\nSEARCHDATA_FILE        = searchdata.xml\n\n# When SERVER_BASED_SEARCH and EXTERNAL_SEARCH are both enabled the\n# EXTERNAL_SEARCH_ID tag can be used as an identifier for the project. This is\n# useful in combination with EXTRA_SEARCH_MAPPINGS to search through multiple\n# projects and redirect the results back to the right project.\n# This tag requires that the tag SEARCHENGINE is set to YES.\n\nEXTERNAL_SEARCH_ID     =\n\n# The EXTRA_SEARCH_MAPPINGS tag can be used to enable searching through doxygen\n# projects other than the one defined by this configuration file, but that are\n# all added to the same external search index. Each project needs to have a\n# unique id set via EXTERNAL_SEARCH_ID. The search mapping then maps the id of\n# to a relative location where the documentation can be found. The format is:\n# EXTRA_SEARCH_MAPPINGS = tagname1=loc1 tagname2=loc2 ...\n# This tag requires that the tag SEARCHENGINE is set to YES.\n\nEXTRA_SEARCH_MAPPINGS  =\n\n#---------------------------------------------------------------------------\n# Configuration options related to the LaTeX output\n#---------------------------------------------------------------------------\n\n# If the GENERATE_LATEX tag is set to YES doxygen will generate LaTeX output.\n# The default value is: YES.\n\nGENERATE_LATEX         = NO\n\n# The LATEX_OUTPUT tag is used to specify where the LaTeX docs will be put. If a\n# relative path is entered the value of OUTPUT_DIRECTORY will be put in front of\n# it.\n# The default directory is: latex.\n# This tag requires that the tag GENERATE_LATEX is set to YES.\n\nLATEX_OUTPUT           = latex\n\n# The LATEX_CMD_NAME tag can be used to specify the LaTeX command name to be\n# invoked.\n#\n# Note that when enabling USE_PDFLATEX this option is only used for generating\n# bitmaps for formulas in the HTML output, but not in the Makefile that is\n# written to the output directory.\n# The default file is: latex.\n# This tag requires that the tag GENERATE_LATEX is set to YES.\n\nLATEX_CMD_NAME         = latex\n\n# The MAKEINDEX_CMD_NAME tag can be used to specify the command name to generate\n# index for LaTeX.\n# The default file is: makeindex.\n# This tag requires that the tag GENERATE_LATEX is set to YES.\n\nMAKEINDEX_CMD_NAME     = makeindex\n\n# If the COMPACT_LATEX tag is set to YES doxygen generates more compact LaTeX\n# documents. This may be useful for small projects and may help to save some\n# trees in general.\n# The default value is: NO.\n# This tag requires that the tag GENERATE_LATEX is set to YES.\n\nCOMPACT_LATEX          = NO\n\n# The PAPER_TYPE tag can be used to set the paper type that is used by the\n# printer.\n# Possible values are: a4 (210 x 297 mm), letter (8.5 x 11 inches), legal (8.5 x\n# 14 inches) and executive (7.25 x 10.5 inches).\n# The default value is: a4.\n# This tag requires that the tag GENERATE_LATEX is set to YES.\n\nPAPER_TYPE             = a4\n\n# The EXTRA_PACKAGES tag can be used to specify one or more LaTeX package names\n# that should be included in the LaTeX output. To get the times font for\n# instance you can specify\n# EXTRA_PACKAGES=times\n# If left blank no extra packages will be included.\n# This tag requires that the tag GENERATE_LATEX is set to YES.\n\nEXTRA_PACKAGES         =\n\n# The LATEX_HEADER tag can be used to specify a personal LaTeX header for the\n# generated LaTeX document. The header should contain everything until the first\n# chapter. If it is left blank doxygen will generate a standard header. See\n# section \"Doxygen usage\" for information on how to let doxygen write the\n# default header to a separate file.\n#\n# Note: Only use a user-defined header if you know what you are doing! The\n# following commands have a special meaning inside the header: $title,\n# $datetime, $date, $doxygenversion, $projectname, $projectnumber. Doxygen will\n# replace them by respectively the title of the page, the current date and time,\n# only the current date, the version number of doxygen, the project name (see\n# PROJECT_NAME), or the project number (see PROJECT_NUMBER).\n# This tag requires that the tag GENERATE_LATEX is set to YES.\n\nLATEX_HEADER           =\n\n# The LATEX_FOOTER tag can be used to specify a personal LaTeX footer for the\n# generated LaTeX document. The footer should contain everything after the last\n# chapter. If it is left blank doxygen will generate a standard footer.\n#\n# Note: Only use a user-defined footer if you know what you are doing!\n# This tag requires that the tag GENERATE_LATEX is set to YES.\n\nLATEX_FOOTER           =\n\n# The LATEX_EXTRA_FILES tag can be used to specify one or more extra images or\n# other source files which should be copied to the LATEX_OUTPUT output\n# directory. Note that the files will be copied as-is; there are no commands or\n# markers available.\n# This tag requires that the tag GENERATE_LATEX is set to YES.\n\nLATEX_EXTRA_FILES      =\n\n# If the PDF_HYPERLINKS tag is set to YES, the LaTeX that is generated is\n# prepared for conversion to PDF (using ps2pdf or pdflatex). The PDF file will\n# contain links (just like the HTML output) instead of page references. This\n# makes the output suitable for online browsing using a PDF viewer.\n# The default value is: YES.\n# This tag requires that the tag GENERATE_LATEX is set to YES.\n\nPDF_HYPERLINKS         = YES\n\n# If the LATEX_PDFLATEX tag is set to YES, doxygen will use pdflatex to generate\n# the PDF file directly from the LaTeX files. Set this option to YES to get a\n# higher quality PDF documentation.\n# The default value is: YES.\n# This tag requires that the tag GENERATE_LATEX is set to YES.\n\nUSE_PDFLATEX           = YES\n\n# If the LATEX_BATCHMODE tag is set to YES, doxygen will add the \\batchmode\n# command to the generated LaTeX files. This will instruct LaTeX to keep running\n# if errors occur, instead of asking the user for help. This option is also used\n# when generating formulas in HTML.\n# The default value is: NO.\n# This tag requires that the tag GENERATE_LATEX is set to YES.\n\nLATEX_BATCHMODE        = NO\n\n# If the LATEX_HIDE_INDICES tag is set to YES then doxygen will not include the\n# index chapters (such as File Index, Compound Index, etc.) in the output.\n# The default value is: NO.\n# This tag requires that the tag GENERATE_LATEX is set to YES.\n\nLATEX_HIDE_INDICES     = NO\n\n# If the LATEX_SOURCE_CODE tag is set to YES then doxygen will include source\n# code with syntax highlighting in the LaTeX output.\n#\n# Note that which sources are shown also depends on other settings such as\n# SOURCE_BROWSER.\n# The default value is: NO.\n# This tag requires that the tag GENERATE_LATEX is set to YES.\n\nLATEX_SOURCE_CODE      = NO\n\n# The LATEX_BIB_STYLE tag can be used to specify the style to use for the\n# bibliography, e.g. plainnat, or ieeetr. See\n# http://en.wikipedia.org/wiki/BibTeX and \\cite for more info.\n# The default value is: plain.\n# This tag requires that the tag GENERATE_LATEX is set to YES.\n\nLATEX_BIB_STYLE        = plain\n\n#---------------------------------------------------------------------------\n# Configuration options related to the RTF output\n#---------------------------------------------------------------------------\n\n# If the GENERATE_RTF tag is set to YES doxygen will generate RTF output. The\n# RTF output is optimized for Word 97 and may not look too pretty with other RTF\n# readers/editors.\n# The default value is: NO.\n\nGENERATE_RTF           = NO\n\n# The RTF_OUTPUT tag is used to specify where the RTF docs will be put. If a\n# relative path is entered the value of OUTPUT_DIRECTORY will be put in front of\n# it.\n# The default directory is: rtf.\n# This tag requires that the tag GENERATE_RTF is set to YES.\n\nRTF_OUTPUT             = rtf\n\n# If the COMPACT_RTF tag is set to YES doxygen generates more compact RTF\n# documents. This may be useful for small projects and may help to save some\n# trees in general.\n# The default value is: NO.\n# This tag requires that the tag GENERATE_RTF is set to YES.\n\nCOMPACT_RTF            = NO\n\n# If the RTF_HYPERLINKS tag is set to YES, the RTF that is generated will\n# contain hyperlink fields. The RTF file will contain links (just like the HTML\n# output) instead of page references. This makes the output suitable for online\n# browsing using Word or some other Word compatible readers that support those\n# fields.\n#\n# Note: WordPad (write) and others do not support links.\n# The default value is: NO.\n# This tag requires that the tag GENERATE_RTF is set to YES.\n\nRTF_HYPERLINKS         = NO\n\n# Load stylesheet definitions from file. Syntax is similar to doxygen's config\n# file, i.e. a series of assignments. You only have to provide replacements,\n# missing definitions are set to their default value.\n#\n# See also section \"Doxygen usage\" for information on how to generate the\n# default style sheet that doxygen normally uses.\n# This tag requires that the tag GENERATE_RTF is set to YES.\n\nRTF_STYLESHEET_FILE    =\n\n# Set optional variables used in the generation of an RTF document. Syntax is\n# similar to doxygen's config file. A template extensions file can be generated\n# using doxygen -e rtf extensionFile.\n# This tag requires that the tag GENERATE_RTF is set to YES.\n\nRTF_EXTENSIONS_FILE    =\n\n#---------------------------------------------------------------------------\n# Configuration options related to the man page output\n#---------------------------------------------------------------------------\n\n# If the GENERATE_MAN tag is set to YES doxygen will generate man pages for\n# classes and files.\n# The default value is: NO.\n\nGENERATE_MAN           = NO\n\n# The MAN_OUTPUT tag is used to specify where the man pages will be put. If a\n# relative path is entered the value of OUTPUT_DIRECTORY will be put in front of\n# it. A directory man3 will be created inside the directory specified by\n# MAN_OUTPUT.\n# The default directory is: man.\n# This tag requires that the tag GENERATE_MAN is set to YES.\n\nMAN_OUTPUT             = man\n\n# The MAN_EXTENSION tag determines the extension that is added to the generated\n# man pages. In case the manual section does not start with a number, the number\n# 3 is prepended. The dot (.) at the beginning of the MAN_EXTENSION tag is\n# optional.\n# The default value is: .3.\n# This tag requires that the tag GENERATE_MAN is set to YES.\n\nMAN_EXTENSION          = .3\n\n# If the MAN_LINKS tag is set to YES and doxygen generates man output, then it\n# will generate one additional man file for each entity documented in the real\n# man page(s). These additional files only source the real man page, but without\n# them the man command would be unable to find the correct page.\n# The default value is: NO.\n# This tag requires that the tag GENERATE_MAN is set to YES.\n\nMAN_LINKS              = NO\n\n#---------------------------------------------------------------------------\n# Configuration options related to the XML output\n#---------------------------------------------------------------------------\n\n# If the GENERATE_XML tag is set to YES doxygen will generate an XML file that\n# captures the structure of the code including all documentation.\n# The default value is: NO.\n\nGENERATE_XML           = NO\n\n# The XML_OUTPUT tag is used to specify where the XML pages will be put. If a\n# relative path is entered the value of OUTPUT_DIRECTORY will be put in front of\n# it.\n# The default directory is: xml.\n# This tag requires that the tag GENERATE_XML is set to YES.\n\nXML_OUTPUT             = xml\n\n# The XML_SCHEMA tag can be used to specify a XML schema, which can be used by a\n# validating XML parser to check the syntax of the XML files.\n# This tag requires that the tag GENERATE_XML is set to YES.\n\nXML_SCHEMA             =\n\n# The XML_DTD tag can be used to specify a XML DTD, which can be used by a\n# validating XML parser to check the syntax of the XML files.\n# This tag requires that the tag GENERATE_XML is set to YES.\n\nXML_DTD                =\n\n# If the XML_PROGRAMLISTING tag is set to YES doxygen will dump the program\n# listings (including syntax highlighting and cross-referencing information) to\n# the XML output. Note that enabling this will significantly increase the size\n# of the XML output.\n# The default value is: YES.\n# This tag requires that the tag GENERATE_XML is set to YES.\n\nXML_PROGRAMLISTING     = YES\n\n#---------------------------------------------------------------------------\n# Configuration options related to the DOCBOOK output\n#---------------------------------------------------------------------------\n\n# If the GENERATE_DOCBOOK tag is set to YES doxygen will generate Docbook files\n# that can be used to generate PDF.\n# The default value is: NO.\n\nGENERATE_DOCBOOK       = NO\n\n# The DOCBOOK_OUTPUT tag is used to specify where the Docbook pages will be put.\n# If a relative path is entered the value of OUTPUT_DIRECTORY will be put in\n# front of it.\n# The default directory is: docbook.\n# This tag requires that the tag GENERATE_DOCBOOK is set to YES.\n\nDOCBOOK_OUTPUT         = docbook\n\n#---------------------------------------------------------------------------\n# Configuration options for the AutoGen Definitions output\n#---------------------------------------------------------------------------\n\n# If the GENERATE_AUTOGEN_DEF tag is set to YES doxygen will generate an AutoGen\n# Definitions (see http://autogen.sf.net) file that captures the structure of\n# the code including all documentation. Note that this feature is still\n# experimental and incomplete at the moment.\n# The default value is: NO.\n\nGENERATE_AUTOGEN_DEF   = NO\n\n#---------------------------------------------------------------------------\n# Configuration options related to the Perl module output\n#---------------------------------------------------------------------------\n\n# If the GENERATE_PERLMOD tag is set to YES doxygen will generate a Perl module\n# file that captures the structure of the code including all documentation.\n#\n# Note that this feature is still experimental and incomplete at the moment.\n# The default value is: NO.\n\nGENERATE_PERLMOD       = NO\n\n# If the PERLMOD_LATEX tag is set to YES doxygen will generate the necessary\n# Makefile rules, Perl scripts and LaTeX code to be able to generate PDF and DVI\n# output from the Perl module output.\n# The default value is: NO.\n# This tag requires that the tag GENERATE_PERLMOD is set to YES.\n\nPERLMOD_LATEX          = NO\n\n# If the PERLMOD_PRETTY tag is set to YES the Perl module output will be nicely\n# formatted so it can be parsed by a human reader. This is useful if you want to\n# understand what is going on. On the other hand, if this tag is set to NO the\n# size of the Perl module output will be much smaller and Perl will parse it\n# just the same.\n# The default value is: YES.\n# This tag requires that the tag GENERATE_PERLMOD is set to YES.\n\nPERLMOD_PRETTY         = YES\n\n# The names of the make variables in the generated doxyrules.make file are\n# prefixed with the string contained in PERLMOD_MAKEVAR_PREFIX. This is useful\n# so different doxyrules.make files included by the same Makefile don't\n# overwrite each other's variables.\n# This tag requires that the tag GENERATE_PERLMOD is set to YES.\n\nPERLMOD_MAKEVAR_PREFIX =\n\n#---------------------------------------------------------------------------\n# Configuration options related to the preprocessor\n#---------------------------------------------------------------------------\n\n# If the ENABLE_PREPROCESSING tag is set to YES doxygen will evaluate all\n# C-preprocessor directives found in the sources and include files.\n# The default value is: YES.\n\nENABLE_PREPROCESSING   = YES\n\n# If the MACRO_EXPANSION tag is set to YES doxygen will expand all macro names\n# in the source code. If set to NO only conditional compilation will be\n# performed. Macro expansion can be done in a controlled way by setting\n# EXPAND_ONLY_PREDEF to YES.\n# The default value is: NO.\n# This tag requires that the tag ENABLE_PREPROCESSING is set to YES.\n\nMACRO_EXPANSION        = NO\n\n# If the EXPAND_ONLY_PREDEF and MACRO_EXPANSION tags are both set to YES then\n# the macro expansion is limited to the macros specified with the PREDEFINED and\n# EXPAND_AS_DEFINED tags.\n# The default value is: NO.\n# This tag requires that the tag ENABLE_PREPROCESSING is set to YES.\n\nEXPAND_ONLY_PREDEF     = NO\n\n# If the SEARCH_INCLUDES tag is set to YES the includes files in the\n# INCLUDE_PATH will be searched if a #include is found.\n# The default value is: YES.\n# This tag requires that the tag ENABLE_PREPROCESSING is set to YES.\n\nSEARCH_INCLUDES        = YES\n\n# The INCLUDE_PATH tag can be used to specify one or more directories that\n# contain include files that are not input files but should be processed by the\n# preprocessor.\n# This tag requires that the tag SEARCH_INCLUDES is set to YES.\n\nINCLUDE_PATH           =\n\n# You can use the INCLUDE_FILE_PATTERNS tag to specify one or more wildcard\n# patterns (like *.h and *.hpp) to filter out the header-files in the\n# directories. If left blank, the patterns specified with FILE_PATTERNS will be\n# used.\n# This tag requires that the tag ENABLE_PREPROCESSING is set to YES.\n\nINCLUDE_FILE_PATTERNS  =\n\n# The PREDEFINED tag can be used to specify one or more macro names that are\n# defined before the preprocessor is started (similar to the -D option of e.g.\n# gcc). The argument of the tag is a list of macros of the form: name or\n# name=definition (no spaces). If the definition and the \"=\" are omitted, \"=1\"\n# is assumed. To prevent a macro definition from being undefined via #undef or\n# recursively expanded use the := operator instead of the = operator.\n# This tag requires that the tag ENABLE_PREPROCESSING is set to YES.\n\nPREDEFINED             =\n\n# If the MACRO_EXPANSION and EXPAND_ONLY_PREDEF tags are set to YES then this\n# tag can be used to specify a list of macro names that should be expanded. The\n# macro definition that is found in the sources will be used. Use the PREDEFINED\n# tag if you want to use a different macro definition that overrules the\n# definition found in the source code.\n# This tag requires that the tag ENABLE_PREPROCESSING is set to YES.\n\nEXPAND_AS_DEFINED      =\n\n# If the SKIP_FUNCTION_MACROS tag is set to YES then doxygen's preprocessor will\n# remove all refrences to function-like macros that are alone on a line, have an\n# all uppercase name, and do not end with a semicolon. Such function macros are\n# typically used for boiler-plate code, and will confuse the parser if not\n# removed.\n# The default value is: YES.\n# This tag requires that the tag ENABLE_PREPROCESSING is set to YES.\n\nSKIP_FUNCTION_MACROS   = YES\n\n#---------------------------------------------------------------------------\n# Configuration options related to external references\n#---------------------------------------------------------------------------\n\n# The TAGFILES tag can be used to specify one or more tag files. For each tag\n# file the location of the external documentation should be added. The format of\n# a tag file without this location is as follows:\n# TAGFILES = file1 file2 ...\n# Adding location for the tag files is done as follows:\n# TAGFILES = file1=loc1 \"file2 = loc2\" ...\n# where loc1 and loc2 can be relative or absolute paths or URLs. See the\n# section \"Linking to external documentation\" for more information about the use\n# of tag files.\n# Note: Each tag file must have an unique name (where the name does NOT include\n# the path). If a tag file is not located in the directory in which doxygen is\n# run, you must also specify the path to the tagfile here.\n\nTAGFILES               =\n\n# When a file name is specified after GENERATE_TAGFILE, doxygen will create a\n# tag file that is based on the input files it reads. See section \"Linking to\n# external documentation\" for more information about the usage of tag files.\n\nGENERATE_TAGFILE       =\n\n# If the ALLEXTERNALS tag is set to YES all external class will be listed in the\n# class index. If set to NO only the inherited external classes will be listed.\n# The default value is: NO.\n\nALLEXTERNALS           = NO\n\n# If the EXTERNAL_GROUPS tag is set to YES all external groups will be listed in\n# the modules index. If set to NO, only the current project's groups will be\n# listed.\n# The default value is: YES.\n\nEXTERNAL_GROUPS        = YES\n\n# If the EXTERNAL_PAGES tag is set to YES all external pages will be listed in\n# the related pages index. If set to NO, only the current project's pages will\n# be listed.\n# The default value is: YES.\n\nEXTERNAL_PAGES         = YES\n\n# The PERL_PATH should be the absolute path and name of the perl script\n# interpreter (i.e. the result of 'which perl').\n# The default file (with absolute path) is: /usr/bin/perl.\n\nPERL_PATH              = /usr/bin/perl\n\n#---------------------------------------------------------------------------\n# Configuration options related to the dot tool\n#---------------------------------------------------------------------------\n\n# If the CLASS_DIAGRAMS tag is set to YES doxygen will generate a class diagram\n# (in HTML and LaTeX) for classes with base or super classes. Setting the tag to\n# NO turns the diagrams off. Note that this option also works with HAVE_DOT\n# disabled, but it is recommended to install and use dot, since it yields more\n# powerful graphs.\n# The default value is: YES.\n\nCLASS_DIAGRAMS         = YES\n\n# You can define message sequence charts within doxygen comments using the \\msc\n# command. Doxygen will then run the mscgen tool (see:\n# http://www.mcternan.me.uk/mscgen/)) to produce the chart and insert it in the\n# documentation. The MSCGEN_PATH tag allows you to specify the directory where\n# the mscgen tool resides. If left empty the tool is assumed to be found in the\n# default search path.\n\nMSCGEN_PATH            =\n\n# You can include diagrams made with dia in doxygen documentation. Doxygen will\n# then run dia to produce the diagram and insert it in the documentation. The\n# DIA_PATH tag allows you to specify the directory where the dia binary resides.\n# If left empty dia is assumed to be found in the default search path.\n\nDIA_PATH               =\n\n# If set to YES, the inheritance and collaboration graphs will hide inheritance\n# and usage relations if the target is undocumented or is not a class.\n# The default value is: YES.\n\nHIDE_UNDOC_RELATIONS   = YES\n\n# If you set the HAVE_DOT tag to YES then doxygen will assume the dot tool is\n# available from the path. This tool is part of Graphviz (see:\n# http://www.graphviz.org/), a graph visualization toolkit from AT&T and Lucent\n# Bell Labs. The other options in this section have no effect if this option is\n# set to NO\n# The default value is: NO.\n\nHAVE_DOT               = NO\n\n# The DOT_NUM_THREADS specifies the number of dot invocations doxygen is allowed\n# to run in parallel. When set to 0 doxygen will base this on the number of\n# processors available in the system. You can set it explicitly to a value\n# larger than 0 to get control over the balance between CPU load and processing\n# speed.\n# Minimum value: 0, maximum value: 32, default value: 0.\n# This tag requires that the tag HAVE_DOT is set to YES.\n\nDOT_NUM_THREADS        = 0\n\n# When you want a differently looking font n the dot files that doxygen\n# generates you can specify the font name using DOT_FONTNAME. You need to make\n# sure dot is able to find the font, which can be done by putting it in a\n# standard location or by setting the DOTFONTPATH environment variable or by\n# setting DOT_FONTPATH to the directory containing the font.\n# The default value is: Helvetica.\n# This tag requires that the tag HAVE_DOT is set to YES.\n\nDOT_FONTNAME           = Helvetica\n\n# The DOT_FONTSIZE tag can be used to set the size (in points) of the font of\n# dot graphs.\n# Minimum value: 4, maximum value: 24, default value: 10.\n# This tag requires that the tag HAVE_DOT is set to YES.\n\nDOT_FONTSIZE           = 10\n\n# By default doxygen will tell dot to use the default font as specified with\n# DOT_FONTNAME. If you specify a different font using DOT_FONTNAME you can set\n# the path where dot can find it using this tag.\n# This tag requires that the tag HAVE_DOT is set to YES.\n\nDOT_FONTPATH           =\n\n# If the CLASS_GRAPH tag is set to YES then doxygen will generate a graph for\n# each documented class showing the direct and indirect inheritance relations.\n# Setting this tag to YES will force the CLASS_DIAGRAMS tag to NO.\n# The default value is: YES.\n# This tag requires that the tag HAVE_DOT is set to YES.\n\nCLASS_GRAPH            = YES\n\n# If the COLLABORATION_GRAPH tag is set to YES then doxygen will generate a\n# graph for each documented class showing the direct and indirect implementation\n# dependencies (inheritance, containment, and class references variables) of the\n# class with other documented classes.\n# The default value is: YES.\n# This tag requires that the tag HAVE_DOT is set to YES.\n\nCOLLABORATION_GRAPH    = YES\n\n# If the GROUP_GRAPHS tag is set to YES then doxygen will generate a graph for\n# groups, showing the direct groups dependencies.\n# The default value is: YES.\n# This tag requires that the tag HAVE_DOT is set to YES.\n\nGROUP_GRAPHS           = YES\n\n# If the UML_LOOK tag is set to YES doxygen will generate inheritance and\n# collaboration diagrams in a style similar to the OMG's Unified Modeling\n# Language.\n# The default value is: NO.\n# This tag requires that the tag HAVE_DOT is set to YES.\n\nUML_LOOK               = NO\n\n# If the UML_LOOK tag is enabled, the fields and methods are shown inside the\n# class node. If there are many fields or methods and many nodes the graph may\n# become too big to be useful. The UML_LIMIT_NUM_FIELDS threshold limits the\n# number of items for each type to make the size more manageable. Set this to 0\n# for no limit. Note that the threshold may be exceeded by 50% before the limit\n# is enforced. So when you set the threshold to 10, up to 15 fields may appear,\n# but if the number exceeds 15, the total amount of fields shown is limited to\n# 10.\n# Minimum value: 0, maximum value: 100, default value: 10.\n# This tag requires that the tag HAVE_DOT is set to YES.\n\nUML_LIMIT_NUM_FIELDS   = 10\n\n# If the TEMPLATE_RELATIONS tag is set to YES then the inheritance and\n# collaboration graphs will show the relations between templates and their\n# instances.\n# The default value is: NO.\n# This tag requires that the tag HAVE_DOT is set to YES.\n\nTEMPLATE_RELATIONS     = NO\n\n# If the INCLUDE_GRAPH, ENABLE_PREPROCESSING and SEARCH_INCLUDES tags are set to\n# YES then doxygen will generate a graph for each documented file showing the\n# direct and indirect include dependencies of the file with other documented\n# files.\n# The default value is: YES.\n# This tag requires that the tag HAVE_DOT is set to YES.\n\nINCLUDE_GRAPH          = YES\n\n# If the INCLUDED_BY_GRAPH, ENABLE_PREPROCESSING and SEARCH_INCLUDES tags are\n# set to YES then doxygen will generate a graph for each documented file showing\n# the direct and indirect include dependencies of the file with other documented\n# files.\n# The default value is: YES.\n# This tag requires that the tag HAVE_DOT is set to YES.\n\nINCLUDED_BY_GRAPH      = YES\n\n# If the CALL_GRAPH tag is set to YES then doxygen will generate a call\n# dependency graph for every global function or class method.\n#\n# Note that enabling this option will significantly increase the time of a run.\n# So in most cases it will be better to enable call graphs for selected\n# functions only using the \\callgraph command.\n# The default value is: NO.\n# This tag requires that the tag HAVE_DOT is set to YES.\n\nCALL_GRAPH             = NO\n\n# If the CALLER_GRAPH tag is set to YES then doxygen will generate a caller\n# dependency graph for every global function or class method.\n#\n# Note that enabling this option will significantly increase the time of a run.\n# So in most cases it will be better to enable caller graphs for selected\n# functions only using the \\callergraph command.\n# The default value is: NO.\n# This tag requires that the tag HAVE_DOT is set to YES.\n\nCALLER_GRAPH           = NO\n\n# If the GRAPHICAL_HIERARCHY tag is set to YES then doxygen will graphical\n# hierarchy of all classes instead of a textual one.\n# The default value is: YES.\n# This tag requires that the tag HAVE_DOT is set to YES.\n\nGRAPHICAL_HIERARCHY    = YES\n\n# If the DIRECTORY_GRAPH tag is set to YES then doxygen will show the\n# dependencies a directory has on other directories in a graphical way. The\n# dependency relations are determined by the #include relations between the\n# files in the directories.\n# The default value is: YES.\n# This tag requires that the tag HAVE_DOT is set to YES.\n\nDIRECTORY_GRAPH        = YES\n\n# The DOT_IMAGE_FORMAT tag can be used to set the image format of the images\n# generated by dot.\n# Note: If you choose svg you need to set HTML_FILE_EXTENSION to xhtml in order\n# to make the SVG files visible in IE 9+ (other browsers do not have this\n# requirement).\n# Possible values are: png, jpg, gif and svg.\n# The default value is: png.\n# This tag requires that the tag HAVE_DOT is set to YES.\n\nDOT_IMAGE_FORMAT       = png\n\n# If DOT_IMAGE_FORMAT is set to svg, then this option can be set to YES to\n# enable generation of interactive SVG images that allow zooming and panning.\n#\n# Note that this requires a modern browser other than Internet Explorer. Tested\n# and working are Firefox, Chrome, Safari, and Opera.\n# Note: For IE 9+ you need to set HTML_FILE_EXTENSION to xhtml in order to make\n# the SVG files visible. Older versions of IE do not have SVG support.\n# The default value is: NO.\n# This tag requires that the tag HAVE_DOT is set to YES.\n\nINTERACTIVE_SVG        = NO\n\n# The DOT_PATH tag can be used to specify the path where the dot tool can be\n# found. If left blank, it is assumed the dot tool can be found in the path.\n# This tag requires that the tag HAVE_DOT is set to YES.\n\nDOT_PATH               =\n\n# The DOTFILE_DIRS tag can be used to specify one or more directories that\n# contain dot files that are included in the documentation (see the \\dotfile\n# command).\n# This tag requires that the tag HAVE_DOT is set to YES.\n\nDOTFILE_DIRS           =\n\n# The MSCFILE_DIRS tag can be used to specify one or more directories that\n# contain msc files that are included in the documentation (see the \\mscfile\n# command).\n\nMSCFILE_DIRS           =\n\n# The DIAFILE_DIRS tag can be used to specify one or more directories that\n# contain dia files that are included in the documentation (see the \\diafile\n# command).\n\nDIAFILE_DIRS           =\n\n# The DOT_GRAPH_MAX_NODES tag can be used to set the maximum number of nodes\n# that will be shown in the graph. If the number of nodes in a graph becomes\n# larger than this value, doxygen will truncate the graph, which is visualized\n# by representing a node as a red box. Note that doxygen if the number of direct\n# children of the root node in a graph is already larger than\n# DOT_GRAPH_MAX_NODES then the graph will not be shown at all. Also note that\n# the size of a graph can be further restricted by MAX_DOT_GRAPH_DEPTH.\n# Minimum value: 0, maximum value: 10000, default value: 50.\n# This tag requires that the tag HAVE_DOT is set to YES.\n\nDOT_GRAPH_MAX_NODES    = 50\n\n# The MAX_DOT_GRAPH_DEPTH tag can be used to set the maximum depth of the graphs\n# generated by dot. A depth value of 3 means that only nodes reachable from the\n# root by following a path via at most 3 edges will be shown. Nodes that lay\n# further from the root node will be omitted. Note that setting this option to 1\n# or 2 may greatly reduce the computation time needed for large code bases. Also\n# note that the size of a graph can be further restricted by\n# DOT_GRAPH_MAX_NODES. Using a depth of 0 means no depth restriction.\n# Minimum value: 0, maximum value: 1000, default value: 0.\n# This tag requires that the tag HAVE_DOT is set to YES.\n\nMAX_DOT_GRAPH_DEPTH    = 0\n\n# Set the DOT_TRANSPARENT tag to YES to generate images with a transparent\n# background. This is disabled by default, because dot on Windows does not seem\n# to support this out of the box.\n#\n# Warning: Depending on the platform used, enabling this option may lead to\n# badly anti-aliased labels on the edges of a graph (i.e. they become hard to\n# read).\n# The default value is: NO.\n# This tag requires that the tag HAVE_DOT is set to YES.\n\nDOT_TRANSPARENT        = NO\n\n# Set the DOT_MULTI_TARGETS tag to YES allow dot to generate multiple output\n# files in one run (i.e. multiple -o and -T options on the command line). This\n# makes dot run faster, but since only newer versions of dot (>1.8.10) support\n# this, this feature is disabled by default.\n# The default value is: NO.\n# This tag requires that the tag HAVE_DOT is set to YES.\n\nDOT_MULTI_TARGETS      = NO\n\n# If the GENERATE_LEGEND tag is set to YES doxygen will generate a legend page\n# explaining the meaning of the various boxes and arrows in the dot generated\n# graphs.\n# The default value is: YES.\n# This tag requires that the tag HAVE_DOT is set to YES.\n\nGENERATE_LEGEND        = YES\n\n# If the DOT_CLEANUP tag is set to YES doxygen will remove the intermediate dot\n# files that are used to generate the various graphs.\n# The default value is: YES.\n# This tag requires that the tag HAVE_DOT is set to YES.\n\nDOT_CLEANUP            = YES\n"
  },
  {
    "path": "docs/heatmapD3.js",
    "content": "function heatmapD3() {\n\tvar dispatch = d3.dispatch(\"d3click\");\n\n\tvar margin = { top: 10, right: 100, bottom: 100, left: 5 };\n\tvar legendMargin = 30;\n\n\tvar cellSize = 20;\n\tvar legendCellSize = 60;\n\tvar rowLabelWidth = 420;\n\tvar colLabelHeight = 110;\n\n\tvar score    = function(d) { return +d.overlaps; };\n\n\tvar rowLabels  = function(d) { return d.dimensions[0].elements};\n\tvar colLabels  = function(d) { return d.dimensions[1].elements};\n\tvar cellData  = function(d) { return d.cells};\n\tvar cellRow   = function(d) { return +d.row; };\n\tvar cellCol   = function(d) { return +d.col; };\n\tvar cellValue = function(d) { return +d.overlaps; };\n\n\n\tvar buckets = 9;\n\tvar colors = [\"#ffffd9\",\"#edf8b1\",\"#c7e9b4\",\"#7fcdbb\",\"#41b6c4\",\"#1d91c0\",\"#225ea8\",\"#253494\",\"#081d58\"]; // alternatively colorbrewer.YlGnBu[9]\n\n\tvar rowNames = [];\n\tvar colNames = [];\n\n\tvar rowIndex = {};\n\tvar colIndex = {};\n\n\tdefaults = {};\n\n\tfunction chart(selection) {\n\n\t\tselection.each(function(jsonData) {\n\n\t\t\tvar data = cellData(jsonData);\n\t\t\trowNames = rowLabels(jsonData);\n\t\t\tcolNames = colLabels(jsonData);\n\n\t\t\tvar width  = (colNames.length*cellSize);\n\t\t\tvar height = (rowNames.length*cellSize);\n\n\t\t\tvar colorScale = d3.scale\n\t\t\t                   .quantize()\n\t\t\t                   .domain([d3.min(data, function (d) { return cellValue(d); }), buckets - 1, d3.max(data, function (d) { return cellValue(d); })])\n\t\t\t                   .range(colors);\n\n\t\t\td3.select('#chart svg').remove();\n\n\t\t\tvar svg = d3.select(\"#chart\")\n\t\t\t            .append(\"svg\")\n\t\t\t            .attr(\"width\", width + rowLabelWidth + margin.left + legendMargin + margin.right)\n\t\t\t            .attr(\"height\", height + colLabelHeight + margin.top + margin.bottom);\n\n\t\t\tvar rowGroup = svg.append(\"g\")\n\t\t\t                  .attr(\"transform\", \"translate(\" \n\t\t\t                   + (rowLabelWidth + margin.left - 10)\n\t\t\t                   + \",\" \n\t\t\t                   + (+margin.top + (colLabelHeight) + (cellSize/2)) + \")\");\n\n\n\t\t\trowGroup.selectAll(\".rowLabel\")\n\t\t\t        .data(rowNames)\n\t\t\t        .enter().append(\"text\")\n\t\t\t        .text(function (d) { return d; })\n\t\t\t        .attr(\"x\", 0)\n\t\t\t        .attr(\"y\", function (d, i) { return i * cellSize; })\n\t\t\t        .style(\"text-anchor\", \"end\")\n\t\t\t        .attr(\"class\", \"rowLabel\");\n\n\n\t\t\tvar colGroup = svg.append(\"g\")\n\t\t\t                  .attr(\"transform\", \"translate(\" \n\t\t\t\t\t                  + (margin.left + rowLabelWidth + (cellSize/3))\n\t\t\t\t\t                  + \",\" + (+margin.top + colLabelHeight) +\")\");\n\n\t\t\tcolGroup.selectAll(\".colLabel\")\n\t\t\t      .data(colNames)\n\t\t\t      .enter()\n\t\t\t      .append(\"g\")\n\t\t\t      .attr(\"transform\", function(d,i) {\n\t\t\t         return \"translate(\" + (i * cellSize) + \",0)\";\n\t\t\t      })\n\t\t\t      .append(\"text\")\n\t\t\t      .attr(\"dx\", \".8em\")\n\t\t\t      .attr(\"dy\", \".15em\")\n\t\t\t      .style(\"text-anchor\", \"start\")\n\t\t\t      .style(\"transform\", \"rotate(-45deg)\")\n\t\t\t      .attr(\"class\", \"colLabel\")\n\t\t\t      .text(function(d) { return d; });\n\n\t\t\tfor (var i = 0; i < rowNames.length; i++) {\n\t\t\t\tvar slot = rowNames[i];\n\t\t\t\trowIndex[slot] = i;\n\t\t\t}\n\t\t\tfor (var i = 0; i < colNames.length; i++) {\n\t\t\t\tvar slot = colNames[i];\n\t\t\t\tcolIndex[slot] = i;\n\t\t\t}\n\n\t\t\tvar cellGroup = svg.append(\"g\")\n\t\t\t\t               .attr(\"transform\", \"translate(\" + \n\t\t\t\t                     (rowLabelWidth + +margin.left + cellSize) + \",\" + (colLabelHeight + +margin.top + cellSize) + \")\");\n\n\t\t\tvar cells = cellGroup.selectAll(\".score\")\n\t\t\t\t\t             .data(data);\n\n\t\t\t\n\n\t\t\tcells.enter()\n\t\t\t\t .append(\"rect\")\n\t\t\t\t  .attr(\"x\", function(d) { \t\t\t\t    \n\t\t\t\t    return (cellCol(d) - 1) * cellSize; \n\t\t\t\t  })\n\t\t\t\t  .attr(\"y\", function(d) { \n\t\t\t\t    return (cellRow(d) - 1) * cellSize; \n\t\t\t\t  })\n\t\t\t\t  .attr(\"rx\", 0)\n\t\t\t\t  .attr(\"ry\", 0)\n\t\t\t\t  .attr(\"class\", \"score bordered\")\n\t\t\t\t  .attr(\"width\", cellSize)\n\t\t\t\t  .attr(\"height\", cellSize)\n\t\t\t\t  .style(\"fill\", colors[0])\n\t\t\t\t  .on(\"click\", function(d) {\n\t\t\t\t\t  \tvar cellObject = $().extend(d);\n\t\t\t\t\t  \tcellObject.rowLabel = rowNames[cellRow(d)];\n\t\t\t\t\t  \tcellObject.colLabel = colNames[cellCol(d)];\n\t\t\t            dispatch.d3click(cellObject);\n\t\t          });\n\n\t\t\tcells.transition()\n\t\t\t     .duration(1000)\n\t\t\t     .style(\"fill\", function(d) { \n\t\t\t        return colorScale(cellValue(d)); \n\t\t\t     });\n\n\t\t\t\n\n\t\t\tcells.exit().remove();\n\n\t\t\tvar interval = (colorScale.domain()[1] - colorScale.domain()[0]) / colorScale.range().length;\n\t\t\tvar breaks = d3.range(0, colorScale.range().length).map(function(i) { return colorScale.domain()[0] + d3.round(i * interval); });\n\n\t\t\tvar legendGroup = svg.append(\"g\")\n\t\t\t                     .attr(\"transform\", \"translate(\" + \n\t\t\t\t                    (rowLabelWidth + +margin.left + width + legendMargin) \n\t\t\t\t                    + \",\" \n\t\t\t\t                    + (colLabelHeight + margin.top) + \")\");\n\n\t\t\tlegendGroup.selectAll(\".legend\").remove();\n\t\t\tvar legend = legendGroup.selectAll(\".legend\")\n\t\t\t                        .data(breaks);\n\n\t\t\tlegend.enter().append(\"g\")\n\t\t\t  \t\t\t .attr(\"class\", \"legend\");\n\n\t\t\tlegend.append(\"rect\")\n\t\t\t\t\t.attr(\"x\", 0)\n\t\t\t\t\t.attr(\"y\", function(d, i) { return legendCellSize * i; })\n\t\t\t\t\t.attr(\"width\", cellSize / 2)\n\t\t\t\t\t.attr(\"height\", legendCellSize)\n\t\t\t\t\t.style(\"fill\", function(d, i) { return colors[i]; });\n\n\t\t\tlegend.append(\"text\")\n\t\t\t\t\t.attr(\"class\", \"legendLabel\")\n\t\t\t\t\t.text(function(d) { return \"≥ \" + Math.round(d); })\n\t\t\t\t\t.style(\"text-anchor\", \"start\")\n\t\t\t\t\t.attr(\"x\", cellSize)\n\t\t\t\t\t.attr(\"y\",  function(d, i) { \n\t\t\t\t\t  return (legendCellSize * i) + legendCellSize/2; \n\t\t\t\t\t})\n\n\t\t\tlegend.exit().remove();\n\n        }); \t\t\t\t\n\t}\n\tchart.cellValue = function(_) {\n\t\tif (!arguments.length) return cellValue;\n\t\t\tcellValue = _;\n\t\treturn chart;\n\t};\n\tchart.rowLabels = function(_) {\n\t\tif (!arguments.length) return rowLabels;\n\t\t\trowLabels = _;\n\t\treturn chart;\n\t};\n\tchart.colLabels = function(_) {\n\t\tif (!arguments.length) return colLabels;\n\t\t\tcolLabels = _;\n\t\treturn chart;\n\t};\n\tchart.cellData = function(_) {\n\t\tif (!arguments.length) return cellData;\n\t\t\tcellData = _;\n\t\treturn chart;\n\t};\n\tchart.cellRow = function(_) {\n\t\tif (!arguments.length) return cellRow;\n\t\t\tcellRow = _;\n\t\treturn chart;\n\t};\t\n\tchart.cellCol = function(_) {\n\t\tif (!arguments.length) return cellCol;\n\t\t\tcellCol = _;\n\t\treturn chart;\n\t};\t\n\n\tchart.margin = function(_) {\n\t\tif (!arguments.length) return margin;\n\t\t\tmargin = _;\n\t\treturn chart;\n\t};\n\tchart.cellSize = function(_) {\n\t\tif (!arguments.length) return cellSize;\n\t\t\tcellSize = _;\n\t\treturn chart;\n\t};\n\tchart.legendCellSize = function(_) {\n\t\tif (!arguments.length) return legendCellSize;\n\t\t\tlegendCellSize = _;\n\t\treturn chart;\n\t};\n\tchart.rowLabelWidth = function(_) {\n\t\tif (!arguments.length) return rowLabelWidth;\n\t\t\trowLabelWidth = _;\n\t\treturn chart;\n\t};\n\tchart.colLabelHeight = function(_) {\n\t\tif (!arguments.length) return colLabelHeight;\n\t\t\tcolLabelHeight = _;\n\t\treturn chart;\n\t};\n\tchart.buckets = function(_) {\n\t\tif (!arguments.length) return buckets;\n\t\t\tbuckets = _;\n\t\treturn chart;\n\t};\n\tchart.colors = function(_) {\n\t\tif (!arguments.length) return colors;\n\t\t\tcolors = _;\n\t\treturn chart;\n\t};\n\n\n\t// This adds the \"on\" methods to our custom exports\n\td3.rebind(chart, dispatch, \"on\");\n\n\treturn chart;\n}\n"
  },
  {
    "path": "docs/index.html",
    "content": "<!DOCTYPE html>\n<meta charset=\"utf-8\">\n<html>\n  <head>\n\n    <link href='https://fonts.googleapis.com/css?family=Open+Sans' rel='stylesheet' type='text/css'>\n    <link rel=\"stylesheet\" href=\"https://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/css/bootstrap.min.css\" integrity=\"sha384-1q8mTJOASx8j1Au+a5WDVnPi2lkFfwwEAa8hDDdjZlpLegxhjVME1fgjWPGmkzs7\" crossorigin=\"anonymous\">\n    <link href=\"assets/css/bootstrap-material-design.min.css\" rel='stylesheet' type='text/css'>\n    <link href=\"assets/css/ripples.min.css\" rel='stylesheet' type='text/css'>\n    <link href=\"assets/css/tetronimos.css\" rel='stylesheet' type='text/css'>\n    <link href=\"assets/css/site.css\" rel='stylesheet' type='text/css'>\n\n  </head>\n  <body>\n    <div class=\"container\">\n      <h3>Giggle</h3>\n\n      <div id=\"control-panel\">\n        <div style=\"display:inline-block\">\n          <div id=\"region-panel\" class=\"input-panel\">\n            <label>Enter Region</label>\n            <input id=\"overlaps\" value=\"chr1:1-5000000\"></input>\n            <button id=\"go-button\" onclick=\"loadHeatmapForRegion()\" style=\"margin-left:32px;\" class=\"btn btn-default btn-raised\">Run</button>\n            <div id=\"no-region-warning\" class=\"hide alert alert-dismissible alert-info\">\n              <button type=\"button\" class=\"close\" data-dismiss=\"alert\">×</button>\n              <strong></strong>\n               Enter a region first\n            </div>          \n\n          </div>\n          <div ><label>OR</label></div>\n          <div id=\"upload-panel\" class=\"input-panel\" style=\"margin-top:0px;clear:both\">\n            <label>Upload file</label>\n            <form id=\"bed-upload-form\" style=\"display:inline-block\"  method=\"post\" enctype=\"multipart/form-data\">\n              <div class=\"form-group\" style=\"padding:0px;display:inline-block;width:230px;margin-top:0px\">\n                 <input style=\"display:inline-block;\"  name=\"file\" type=\"file\">\n                 <input type=\"text\" style=\"display:inline-block\" readonly=\"\" class=\"form-control\" placeholder=\"choose file...\">\n              </div>\n             <input id=\"upload-button\" style=\"clear:both;display:inline-block;\" class=\"btn btn-default btn-raised\" type=\"submit\" value=\"Run\">\n            </form>\n          </div>\n\n          <div id=\"no-file-warning\" class=\"hide alert alert-dismissible alert-info\">\n            <button type=\"button\" class=\"close\" data-dismiss=\"alert\">×</button>\n            <strong></strong>\n             Choose a .bed.gz or vcf.gz file to upload.\n          </div>\n          <div id=\"bad-file-warning\" class=\"hide alert alert-dismissible alert-info\">\n            <button type=\"button\" class=\"close\" data-dismiss=\"alert\">×</button>\n            <strong></strong>\n             Invalid query file. Choose a .bed.gz or vcf.gz file to upload.\n          </div>\n        </div>\n\n        <div class=\"\" style=\"vertical-align:top;display:inline-block;margin-left:40px;width:120px;\">\n          <span  class=\"radio-value-field radio radio-primary\">\n            <label>\n              <input type=\"radio\" class=\"radio-value-field\" name=\"radio-value-field\" id=\"radio-value-overlaps\" onclick=\"loadHeatmapChart()\" checked=\"true\" value=\"overlaps\">\n             Overlaps\n            </label>\n          </span>\n\n          <span id=\"radio-value-combo-span\" class=\"radio-value-field radio radio-primary\">\n            <label>\n              <input type=\"radio\" class=\"radio-value-field\" name=\"radio-value-field\" onclick=\"loadHeatmapChart()\" id=\"radio-value-combo\" value=\"combo\" >\n              Score\n            </label>\n          </span>\n\n        </div>\n\n        <div class=\"\" style=\"vertical-align:top;display:inline-block;margin-left:40px;\">\n          <div>\n            <label style=\"width:100px !important\" >Primary Index</label>\n            <input id=\"giggle-url\"/>\n          </div>\n          <div style=\"margin-top:10px;\">\n            <label style=\"width:100px !important;\">UCSC Index</label>\n            <input id=\"giggle-tracks-url\"/>\n          </div>\n        </div>\n    </div>\n\n\n    <div class=\"loader hide\"  style=\"margin-top:160px;text-align:center;\">                   \n        <div class=\"cssload-tetrominos\">\n          <div class=\"cssload-tetromino cssload-box1\"></div>\n          <div class=\"cssload-tetromino cssload-box2\"></div>\n          <div class=\"cssload-tetromino cssload-box3\"></div>\n          <div class=\"cssload-tetromino cssload-box4\"></div>\n        </div>\n    </div>    \n\n    <div id=\"chart\"></div>\n    </div>\n\n\n<div class=\"modal fade\" id=\"overlaps-modal\" tabindex=\"-1\" role=\"dialog\">\n  <div  class=\"modal-dialog\" style=\"width:350px\" role=\"document\">\n    <div class=\"modal-content\">\n      <div class=\"modal-header\" style=\"padding-top:10px;\">\n       <h3>Overlaps</h3>\n      </div>\n      <div class=\"modal-body\" style=\"height: 450px;overflow-y: scroll;margin-top: 0px;padding-top: 0px;\">\n     \n      </div>\n      <div class=\"modal-footer\" style=\"clear-both\">\n          <button type=\"button\" class=\"btn btn-default icon-button-sm btn btn-default btn-raised\" data-dismiss=\"modal\">Close</button>\n      </div>\n    </div>\n  </div>\n</div>    \n\n    <!-- Latest compiled and minified CSS -->\n    <script   src=\"https://code.jquery.com/jquery-1.12.4.min.js\"   integrity=\"sha256-ZosEbRLbNQzLpnKIkEdrPv7lOy9C27hHQ+Xp8a4MxAQ=\"   crossorigin=\"anonymous\"></script>\n\n    <script src=\"https://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/js/bootstrap.min.js\" integrity=\"sha384-0mSbJDEHialfmuBBQP6A4Qrprq5OVfW37PRR3j5ELqxss1yVqOtnepnHVP9aJ7xS\" crossorigin=\"anonymous\"></script>\n    <script src=\"assets/js/material.min.js\"></script>\n    <script src=\"assets/js/ripples.min.js\"></script>\n    <script src=\"assets/js/colorbrewer.js\"></script>\n    <script src=\"http://d3js.org/d3.v3.js\"></script>\n    <script src=\"heatmapD3.js\"></script>\n    <script src=\"app.js\"></script>\n  \n  </body>\n</html>\n"
  },
  {
    "path": "docs/smartview.html",
    "content": "<!DOCTYPE html>\n<meta charset=\"utf-8\">\n<html>\n  <head>\n\n    <link href='https://fonts.googleapis.com/css?family=Open+Sans' rel='stylesheet' type='text/css'>\n    <link rel=\"stylesheet\" href=\"https://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/css/bootstrap.min.css\" integrity=\"sha384-1q8mTJOASx8j1Au+a5WDVnPi2lkFfwwEAa8hDDdjZlpLegxhjVME1fgjWPGmkzs7\" crossorigin=\"anonymous\">\n    <link href=\"assets/css/bootstrap-material-design.min.css\" rel='stylesheet' type='text/css'>\n    <link href=\"assets/css/ripples.min.css\" rel='stylesheet' type='text/css'>\n    <link href=\"assets/css/tetronimos.css\" rel='stylesheet' type='text/css'>\n    <link href=\"assets/css/site.css\" rel='stylesheet' type='text/css'>\n\n  </head>\n  <body>\n    <div class=\"container\">\n      <h3>UCSC SmartView by Giggle</h3>\n\n      <div id=\"smartview-form\">\n          <div style=\"margin-top:10px;\">\n            <label style=\"width:100px !important;\">Index</label>\n            <input id=\"giggle-tracks-url\"/>\n          </div>\n          <div style=\"margin-top:10px;\">\n            <label style=\"width:100px !important;\">Region</label>\n            <input id=\"overlaps\" value=\"chr4:99990000-100010000\"></input>\n          </div>\n\n          <button id=\"go-button\" onclick=\"loadUCSCSmartView()\" style=\"margin-left:0px;\" class=\"btn btn-default btn-raised\">View</button>\n\n      </div>\n\n    <!-- Latest compiled and minified CSS -->\n    <script   src=\"https://code.jquery.com/jquery-1.12.4.min.js\"   integrity=\"sha256-ZosEbRLbNQzLpnKIkEdrPv7lOy9C27hHQ+Xp8a4MxAQ=\"   crossorigin=\"anonymous\"></script>\n\n    <script src=\"https://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/js/bootstrap.min.js\" integrity=\"sha384-0mSbJDEHialfmuBBQP6A4Qrprq5OVfW37PRR3j5ELqxss1yVqOtnepnHVP9aJ7xS\" crossorigin=\"anonymous\"></script>\n    <script src=\"assets/js/material.min.js\"></script>\n    <script src=\"assets/js/ripples.min.js\"></script>\n    <script src=\"assets/js/colorbrewer.js\"></script>\n    <script src=\"http://d3js.org/d3.v3.js\"></script>\n    <script src=\"heatmapD3.js\"></script>\n    <script src=\"app.js\"></script>\n  \n  </body>\n</html>\n"
  },
  {
    "path": "docs/update_doxygen.sh",
    "content": "#!/bin/bash\ndoxygen doxygen.cfg\n"
  },
  {
    "path": "environment.yml",
    "content": "name: giggle-dev\nchannels:\n  - bioconda\n  - conda-forge\n  - defaults\ndependencies:\n  # Build tools\n  - gcc\n  - make\n  - autoconf\n  - automake\n  - libtool\n  - binutils\n\n  # Libraries\n  - zlib\n  - bzip2\n  - xz\n  - curl\n  - openssl\n  - htslib\n\n  # Testing/utilities\n  - bedtools\n  - ruby\n# After creating the environment, set these before building:\n#   export HTS_INC=$CONDA_PREFIX/include\n#   export HTS_LIB=$CONDA_PREFIX/lib\n#   cd giggle && make\n"
  },
  {
    "path": "examples/cistrome/README.md",
    "content": "Get source code\n\n    git clone https://github.com/samtools/htslib.git\n    cd htslib\n    autoheader\n    autoconf\n    ./configure --disable-bz2 --disable-lzma --enable-libcurl\n    make -j 20\n    export HTSLIB_ROOT=`pwd`\n    cd ..\n\n    git clone https://github.com/ryanlayer/giggle.git\n    cd giggle\n    make\n    export GIGGLE_ROOT=`pwd`\n    cd ..\n\n    wget -O gargs https://github.com/brentp/gargs/releases/download/v0.3.6/gargs_linux\n    chmod +x gargs\n\nGet database data and index\n\n    # fill out form on http://cistrome.org/db/interface.html\n    # check Human_TF Human_histone Human_chromatin_accessibility Human_other\n    # get TF_humar.tar.gz\n\n    tar -xvf TF_human.tar.gz -C data/\n    cd data\n    mkdir tmp\n    tar -zxvf TF_human.tar.gz -C tmp/\n    tar -zxvf tmp/TF_human.tar.gz\n    rm -rf tmp/\n    rm TF_human.tar.gz\n    rm ../TF_human.tar.gz\n    mkdir named\n    mkdir named_sort\n\n    cd ..\n\n    $GIGGLE_ROOT/examples/cistrome/get_qc.sh > cistrome_id_qc.txt\n\n    $GIGGLE_ROOT/examples/cistrome/rename.py \\\n        -m data/TF_human_data_information.txt \\\n        -i data/TF_human \\\n        -o data/named \\\n        -n cistrome_id_to_name_map.txt\n        \n\n    $GIGGLE_ROOT/scripts/sort_bed \"data/named/[A-J]*\" data/named_sort/ 10\n    $GIGGLE_ROOT/scripts/sort_bed \"data/named/[K-T]*\" data/named_sort/ 10\n    $GIGGLE_ROOT/scripts/sort_bed \"data/named/[U-Z]*\" data/named_sort/ 10\n\n    mkdir data/named_q100_sort\n    ls data/named_sort/ \\\n    | gargs -p 10 \"$GIGGLE_ROOT/examples/cistrome/get_top.sh data/named_sort/{} data/named_q100_sort 100\"\n\n    time ~/src/giggle/bin/giggle index \\\n        -i \"data/named_q100_sort/*gz\"  \\\n        -o data/named_q100_sort_b \\\n        -s -f\n    Indexed 8716024 intervals.\n\n    real    0m17.843s\n    user    0m15.791s\n    sys     0m1.575s\n"
  },
  {
    "path": "examples/cistrome/get_qc.sh",
    "content": "#!/bin/bash\n\necho -e \"id\\tmap\\tpeaks\\tfastqc\\tfrip\\tpbc\\tmotif_judge\\tdhs\"\n\nfor i in `cat TF_human_data_information.txt | cut -f 1`; do\n    echo -en \"$i\\t\"\n    curl -s http://dc2.cistrome.org/api/inspector?id=$i \\\n    | jq -cr '.qc.judge | [.map, .peaks, .fastqc, .frip, .pbc, .motif_judge, .dhs ]' \\\n    | jq -cr 'map(tostring)' \\\n    | jq -cr 'join(\"\\t\")'\ndone\n"
  },
  {
    "path": "examples/cistrome/get_top.sh",
    "content": "#!/bin/bash\n\nif [ \"$#\" -ne \"3\" ]; then\n    echo -e \"ussage:\\t$0 <in file> <out dir> <min q>\\n\"\n    exit\nfi\n\nIN_FILE=$1\nOUT_DIR=$2\nN=$3\n\nB=`basename $IN_FILE`\nOUT_FILE=\"$OUT_DIR/$B\"\n\necho $OUT_FILE\n\nbgzip -c -d  $IN_FILE \\\n| awk -v N=$N '$9 >= N' \\\n|  LC_ALL=C sort --buffer-size 2G -k1,1 -k2,2n | bgzip -c \\\n> $OUT_FILE\n"
  },
  {
    "path": "examples/cistrome/rename.py",
    "content": "#!/usr/bin/python\nimport sys\nfrom shutil import copyfile\nfrom optparse import OptionParser\n\nparser = OptionParser()\n\n#metadata_file_name = 'data/TF_human_data_information.txt'\n#curr_dir = 'data/TF_human'\n#named_dir = 'data/named'\n#name_map_file_name = 'cistrome_id_to_name_map.txt'\n\n\nparser.add_option(\"-m\",\n                  \"--metadata_file_name\",\n                  dest=\"metadata_file_name\",\n                  help=\"path to TF_human_data_information.txt file\")\n\nparser.add_option(\"-i\",\n                  dest=\"curr_dir\",\n                  help=\"Input data directory\")\n\nparser.add_option(\"-o\",\n                  dest=\"named_dir\",\n                  help=\"Output data directory\")\n\nparser.add_option(\"-n\",\n                  dest=\"name_map_file_name\",\n                  help=\"ID to name mapping file\")\n\n(options, args) = parser.parse_args()\nif not options.metadata_file_name:\n    parser.error('TF_human_data_information.txt file not given')\nif not options.curr_dir:\n    parser.error('Input data directory not given')\nif not options.named_dir:\n    parser.error('Output data directory not given')\nif not options.name_map_file_name:\n    parser.error('ID to name mapping file not given')\n\nmetadata = {}\n\nfor l in open(metadata_file_name, 'r'):\n    A = l.rstrip().split('\\t')\n    metadata[A[7]] = { 'id' : A[0], \\\n                       'gsm' : A[1], \\\n                       'species' : A[2], \\\n                       'cell_line' : A[3], \\\n                       'cell_type' : A[4], \\\n                       'tissue' : A[5], \\\n                       'factor' : A[6], \\\n                       'file_name' : A[7] }\n\nprefixes = {}\n\nfile_name_map = {}\n\nfor f in metadata.keys():\n    prefix = '.'.join( [ metadata[f]['cell_line'], \\\n                         metadata[f]['cell_type'], \\\n                         metadata[f]['tissue'], \\\n                         metadata[f]['factor'] ] ) \\\n             .replace(' ', '_') \\\n             .replace('/', '-')\n\n    if prefix not in prefixes:\n        prefixes[prefix] = 0\n\n    new_file_name = prefix + '.' + str(prefixes[prefix]) + '.bed'\n    file_name_map[f] = new_file_name\n    prefixes[prefix] = prefixes[prefix] + 1\n\n\nname_map_file = open(name_map_file_name, 'w')\n\nfor f in file_name_map:\n    src = curr_dir + '/' + f\n    dst = named_dir + '/' + file_name_map[f]\n    copyfile(src, dst)\n    name_map_file.write(f + '\\t' + file_name_map[f] + '\\n')\n\nname_map_file.close()\n\n"
  },
  {
    "path": "examples/fantom/README.md",
    "content": "Get source code\n\n    git clone https://github.com/samtools/htslib.git\n    cd htslib\n    autoheader\n    autoconf\n    ./configure --disable-bz2 --disable-lzma --enable-libcurl\n    make -j 20\n    export HTSLIB_ROOT=`pwd`\n    cd ..\n\n    git clone https://github.com/ryanlayer/giggle.git\n    cd giggle\n    make\n    export GIGGLE_ROOT=`pwd`\n    cd ..\n\nGet database data and index\n\n    mkdir fantom_data\n    cd fantom_data\n    wget http://fantom.gsc.riken.jp/5/datafiles/latest/extra/Enhancers/Human.sample_name2library_id.txt\n    cat Human.sample_name2library_id.txt \\\n    | sed -e \"s/, */-/g\" \\\n    | sed -e \"s/ /_/g\" \\\n    | sed -e \"s/(/-/g\" \\\n    | sed -e \"s/)/-/g\" \\\n    | sed -e \"s/:/-/g\" \\\n    | sed -e \"s/'//g\" \\\n    | sed -e \"s/\\^//g\" \\\n    | sed -e \"s/\\///g\" \\\n    >  Human.sample_name2library_id.sanitized.txt\n\n    wget http://fantom.gsc.riken.jp/5/datafiles/latest/extra/Enhancers/human_permissive_enhancers_phase_1_and_2_expression_count_matrix.txt.gz\n    zcat human_permissive_enhancers_phase_1_and_2_expression_count_matrix.txt.gz \\\n    > human_permissive_enhancers_phase_1_and_2_expression_count_matrix.txt\n\n    mkdir split\n    python $GIGGLE_ROOT/examples/fantom/rename.py \\\n        Human.sample_name2library_id.sanitized.txt \\\n        human_permissive_enhancers_phase_1_and_2_expression_count_matrix.txt \\\n        split\n    \n    $GIGGLE_ROOT/scripts/sort_bed \"split/*\" split_sort/\n\n    time $GIGGLE_ROOT/bin/giggle index \\\n        -i \"split_sort/*gz\" \\\n        -o split_sort_b \\\n        -f -s\n    Indexed 11284790 intervals.\n\n    real    0m16.771s\n    user    0m15.860s\n    sys     0m0.627s\n\n"
  },
  {
    "path": "examples/fantom/rename.py",
    "content": "import sys\n\nif len(sys.argv) != 4:\n    sys.stderr.write('usage:\\t' + \\\n                     sys.argv[0] + \\\n                     ' <name2library file>' + \\\n                     ' <expression count matrix file>' + \\\n                     ' <out dir>\\n')\n    sys.exit(1)\n\nname2library_file=sys.argv[1]\nexpression_count_matrix_file=sys.argv[2]\nout_dir=sys.argv[3]\n\nfiles={}\n\nnames = {}\nfor l in open(name2library_file, 'r'):\n    A = l.rstrip().split('\\t')\n    names[A[1]] = A[0]\n\nheader = []\nfor l in open(expression_count_matrix_file, 'r'):\n    A = l.rstrip().split()\n    if A[0] == 'Id':\n        header = A[1:]\n        print len(header)\n        0/1\n    else:\n        i = 0\n        for a in A[1:]:\n            if a != '0':\n                if names[header[i]] not in files:\n                    files[names[header[i]]] = \\\n                            open(out_dir + \\\n                                 '/' + \\\n                                 names[header[i]] + \\\n                                 '.bed',\n                                 'w')\n\n                \n                files[names[header[i]]].write( \\\n                        A[0].replace(':','\\t').replace('-','\\t') + \\\n                        '\\t' + a + '\\n')\n            i+=1\n"
  },
  {
    "path": "examples/gtex/bp.py",
    "content": "#!/usr/bin/env python\nimport sys\nimport numpy as np\nimport matplotlib\nmatplotlib.use('Agg')\nimport pylab\nimport random\nfrom optparse import OptionParser\nimport seaborn\n\ndelim = '\\t'\nparser = OptionParser()\n\nparser.add_option(\"-l\",\n                  \"--log_y\",\n                  action=\"store_true\", dest=\"logy\", default=False,\n                  help=\"Use log scale for y-axis\")\n\nparser.add_option(\"-o\",\n                  \"--output_file\",\n                  dest=\"output_file\",\n                  help=\"Data file\")\n\nparser.add_option(\"--y_min\",\n                  dest=\"min_y\",\n                  help=\"Min y value\")\n\nparser.add_option(\"--y_max\",\n                  dest=\"max_y\",\n                  help=\"Max y value\")\n\nparser.add_option(\"--line_style\",\n                  dest=\"line_style\",\n                  default=\".\",\n                  help=\"Line style\")\n\n\n\n(options, args) = parser.parse_args()\nif not options.output_file:\n    parser.error('Output file not given')\n\nY=[]\nrow_names = []\ncol_names = ''\nfor l in sys.stdin:\n    if col_names == '':\n        col_names = l.rstrip().split()\n        continue\n    Y.append([])\n    A = l.rstrip().split()\n    row_names.append(A[0])\n    for y in A[1:]:\n        Y[-1].append([float(x) for x in y.split(',')])\n\nmatplotlib.rcParams.update({'font.size': 12})\nfig = matplotlib.pyplot.figure(figsize=(4,14),dpi=300)\nfig.subplots_adjust(wspace=.05,left=.01,bottom=.01)\nN = len(Y)\ni = 1\nfor y in Y:\n    ax = fig.add_subplot(N,1,i)\n    ax.spines['top'].set_visible(False)\n    ax.spines['right'].set_visible(False)\n    ax.spines['bottom'].set_visible(True)\n    ax.spines['left'].set_visible(False)\n    #ax.plot(range(len(y)),y,options.line_style,color='black', linewidth=1)\n    ax.boxplot(y)\n    ticks = ax.set_yticklabels([])\n    ax.text(0.5,max([max(x) for x in y]), row_names[i-1], fontsize=8, va='top', ha='left')\n\n    if i != 1:\n        ax.set_xticklabels([])\n    else:\n        ax.xaxis.tick_top()\n        ax.set_xticklabels(col_names)\n        matplotlib.pyplot.xticks(rotation=90, fontsize=8)\n\n    i+=1\n\nmatplotlib.pyplot.savefig(options.output_file,bbox_inches='tight')\n"
  },
  {
    "path": "examples/gtex/gtex_to_bp.py",
    "content": "import sys\nimport re\n\nN = int(sys.argv[1])\n\nregion = ''\ntissue = ''\n\nBP = []\ntissues = {}\nregions = []\n\nfor l in sys.stdin:\n    if l[:2] == '##':\n        A = l[2:].rstrip().split('\\t')\n        region = A[0] + ':' + A[1] + '-' + str(int(A[1]) + 1)\n        regions.append(region)\n        BP.append({})\n    elif l[0] == '#':\n        tissue = l.rstrip().split('/')[1].split('.')[0]\n        tissues[tissue] = 1\n    else:\n        A = l.rstrip().split('\\t')\n        BP[-1][tissue] = A[3:]\n\nprint ' '.join(sorted(tissues.keys()))\ni = 0;\nfor bp in BP:\n    if len(bp) == 0:\n        continue\n    O = []\n    for tissue in sorted(tissues.keys()):\n        if tissue in bp:\n            O.append(','.join([str(x) for x in bp[tissue]]))\n        else:\n            O.append(0)\n    print ' '.join([regions[i]] + O)\n    i+=1\n    if i == N:\n        break\n"
  },
  {
    "path": "examples/gtex/one_per_tissue.py",
    "content": "import sys\n\ntrans_to_cord = {}\n\nfor l in open(\"genes.bed\", \"r\"):\n\tA = l.rstrip().split('\\t')\n\ttrans_to_cord[A[3]] = '\\t'.join(A[:3])\n\nsampid_to_smts = {}\nsmts_to_sampid = {}\n\nfor l in open(\"SAMPID_to_SMTS.txt\", \"r\"):\n\tA = l.rstrip().split('\\t')\n\tif len(A) == 2:\n\t\tsampid_to_smts[A[0]] = A[1]\n\t\tif A[1] not in smts_to_sampid:\n\t\t\tsmts_to_sampid[A[1]] = []\n\t\tsmts_to_sampid[A[1]].append(A[0])\n\n\ncols = []\ngo = 0\nfiles = {}\nfor l in sys.stdin:\n\tA = l.rstrip().split('\\t')\n\tif A[0] == 'Name':\n\t\tcols = A[2:]\n\t\tgo = 1\n\telif go == 1:\n\t\tgene = A[0]\t\t\n\t\trpkms = A[2:]\n\t\ttissue_rpkm = {}\n\t\tassert len(rpkms) == len (cols)\n\t\tfor i in range(len(rpkms)):\n\t\t\tsampleid = cols[i]\n\t\t\ttissue = sampid_to_smts[sampleid]\n\t\t\tif tissue not in tissue_rpkm:\n\t\t\t\ttissue_rpkm[tissue] = {}\n\t\t\ttissue_rpkm[tissue][sampleid] = rpkms[i]\n\t\tfor tissue in tissue_rpkm:\n\t\t\tif tissue not in files:\n\t\t\t\tfiles[tissue] = open(tissue + \".bed\", \"w\")\n\t\t\tfiles[tissue].write(trans_to_cord[gene] + '\\t' + \n\t\t\t\t\t    '\\t'.join([tissue_rpkm[tissue][sampleid] for sampleid in tissue_rpkm[tissue]]) +\n\t\t\t\t\t    '\\n')\nfor f in files:\n\tf.close()\n"
  },
  {
    "path": "examples/gwas/README.md",
    "content": "Get data\n\n    wget https://www.nature.com/nature/journal/v518/n7539/extref/nature13835-s1.xls\n    # copy first five columns into a text file named gwas.txt\n\n    for D in `tail -n+2 gwas.txt | awk '{print $1;}'  | sort -u`; do\n        grep $D gwas.txt \\\n        | awk '{OFS=\"\\t\"; print $4,$5,$5+1;}' \\\n        | bgzip -c > $D.bed.gz\n    done\n"
  },
  {
    "path": "examples/myod/README.md",
    "content": "Get data\n\n    wget ftp://ftp.ncbi.nlm.nih.gov/geo/samples/GSM1218nnn/GSM1218850/suppl/GSM1218850_MB135DMMD.peak.txt.gz\n\n    zcat GSM1218850_MB135DMMD.peak.txt.gz \\\n    | awk '$8 >= 100'\n    | $HTSLIB_ROOT/bgzip -c > GSM1218850_MB135DMMD.peak.q100.bed.gz\n"
  },
  {
    "path": "examples/rme/EDACC_NAME.txt",
    "content": "E001\tES_I3_Cell_Line\nE002\tES_WA7_Cell_Line\nE003\tH1_Cell_Line\nE004\tH1_BMP4_Derived_Mesendoderm_Cultured_Cells\nE005\tH1_BMP4_Derived_Trophoblast_Cultured_Cells\nE006\tH1_Derived_Mesenchymal_Stem_Cells\nE007\tH1_Derived_Neuronal_Progenitor_Cultured_Cells\nE008\tH9_Cell_Line\nE009\tH9_Derived_Neuronal_Progenitor_Cultured_Cells\nE010\tH9_Derived_Neuron_Cultured_Cells\nE011\thESC_Derived_CD184pp_Endoderm_Cultured_Cells\nE012\thESC_Derived_CD56pp_Ectoderm_Cultured_Cells\nE013\thESC_Derived_CD56pp_Mesoderm_Cultured_Cells\nE014\tHUES48_Cell_Line\nE015\tHUES6_Cell_Line\nE016\tHUES64_Cell_Line\nE017\tIMR90_Cell_Line\nE018\tiPS_15b_Cell_Line\nE019\tiPS_18_Cell_Line\nE020\tiPS_20b_Cell_Line\nE021\tiPS_DF_6.9_Cell_Line\nE022\tiPS_DF_19.11_Cell_Line\nE023\tMesenchymal_Stem_Cell_Derived_Adipocyte_Cultured_Cells\nE024\t4star\nE025\tAdipose_Derived_Mesenchymal_Stem_Cell_Cultured_Cells\nE026\tBone_Marrow_Derived_Mesenchymal_Stem_Cell_Cultured_Cells\nE027\tBreast_Myoepithelial_Cells\nE028\tBreast_vHMEC\nE029\tCD14_Primary_Cells\nE030\tCD15_Primary_Cells\nE031\tCD19_Primary_Cells_Cord_BI\nE032\tCD19_Primary_Cells_Peripheral_UW\nE033\tCD3_Primary_Cells_Cord_BI\nE034\tCD3_Primary_Cells_Peripheral_UW\nE035\tCD34_Primary_Cells\nE036\tCD34_Cultured_Cells\nE037\tCD4_Memory_Primary_Cells\nE038\tCD4_Naive_Primary_Cells\nE039\tCD4pp_CD25__CD45RApp_Naive_Primary_Cells\nE040\tCD4pp_CD25__CD45ROpp_Memory_Primary_Cells\nE041\tCD4pp_CD25__IL17__PMA_Ionomycin_stimulated_MACS_purified_Th_Primary_Cells\nE042\tCD4pp_CD25__IL17pp_PMA_Ionomcyin_stimulated_Th17_Primary_Cells\nE043\tCD4pp_CD25__Th_Primary_Cells\nE044\tCD4pp_CD25pp_CD127__Treg_Primary_Cells\nE045\tCD4pp_CD25int_CD127pp_Tmem_Primary_Cells\nE046\tCD56_Primary_Cells\nE047\tCD8_Naive_Primary_Cells\nE048\tCD8_Memory_Primary_Cells\nE050\tMobilized_CD34_Primary_Cells_Female\nE051\tMobilized_CD34_Primary_Cells_Male\nE049\tChondrocytes_from_Bone_Marrow_Derived_Mesenchymal_Stem_Cell_Cultured_Cells\nE052\tMuscle_Satellite_Cultured_Cells\nE053\tNeurosphere_Cultured_Cells_Cortex_Derived\nE054\tNeurosphere_Cultured_Cells_Ganglionic_Eminence_Derived\nE055\tPenis_Foreskin_Fibroblast_Primary_Cells_skin01\nE056\tPenis_Foreskin_Fibroblast_Primary_Cells_skin02\nE057\tPenis_Foreskin_Keratinocyte_Primary_Cells_skin02\nE058\tPenis_Foreskin_Keratinocyte_Primary_Cells_skin03\nE059\tPenis_Foreskin_Melanocyte_Primary_Cells_skin01\nE061\tPenis_Foreskin_Melanocyte_Primary_Cells_skin03\nE062\tPeripheral_Blood_Mononuclear_Primary_Cells\nE063\tAdipose_Nuclei\nE065\tAorta\nE066\tAdult_Liver\nE067\tBrain_Angular_Gyrus\nE068\tBrain_Anterior_Caudate\nE069\tBrain_Cingulate_Gyrus\nE070\tBrain_Germinal_Matrix\nE071\tBrain_Hippocampus_Middle\nE072\tBrain_Inferior_Temporal_Lobe\nE073\tBrain_Mid_Frontal_Lobe\nE074\tBrain_Substantia_Nigra\nE075\tColonic_Mucosa\nE076\tColon_Smooth_Muscle\nE077\tDuodenum_Mucosa\nE078\tDuodenum_Smooth_Muscle\nE079\tEsophagus\nE080\tFetal_Adrenal_Gland\nE081\tFetal_Brain_Male\nE082\tFetal_Brain_Female\nE083\tFetal_Heart\nE084\tFetal_Intestine_Large\nE085\tFetal_Intestine_Small\nE086\tFetal_Kidney\nE087\tPancreatic_Islets\nE088\tFetal_Lung\nE089\tFetal_Muscle_Trunk\nE090\tFetal_Muscle_Leg\nE091\tFetal_Placenta\nE092\tFetal_Stomach\nE093\tFetal_Thymus\nE094\tGastric\nE095\tLeft_Ventricle\nE096\tLung\nE097\tOvary\nE098\tPancreas\nE099\tPlacenta_Amnion\nE100\tPsoas_Muscle\nE101\tRectal_Mucosa.Donor_29\nE102\tRectal_Mucosa.Donor_31\nE103\tRectal_Smooth_Muscle\nE104\tRight_Atrium\nE105\tRight_Ventricle\nE106\tSigmoid_Colon\nE107\tSkeletal_Muscle_Male\nE108\tSkeletal_Muscle_Female\nE109\tSmall_Intestine\nE110\tStomach_Mucosa\nE111\tStomach_Smooth_Muscle\nE112\tThymus\nE113\tSpleen\nE114\tA549_EtOH_0.02pct_Lung_Carcinoma\nE115\tDnd41_TCell_Leukemia\nE116\tGM12878_Lymphoblastoid\nE117\tHeLa_S3_Cervical_Carcinoma\nE118\tHepG2_Hepatocellular_Carcinoma\nE119\tHMEC_Mammary_Epithelial\nE120\tHSMM_Skeletal_Muscle_Myoblasts\nE121\tHSMMtube_Skeletal_Muscle_Myotubes_Derived_from_HSMM\nE122\tHUVEC_Umbilical_Vein_Endothelial_Cells\nE123\tK562_Leukemia\nE124\tMonocytes_CD14pp_RO01746\nE125\tNH_A_Astrocytes\nE126\tNHDF_Ad_Adult_Dermal_Fibroblasts\nE127\tNHEK_Epidermal_Keratinocytes\nE128\tNHLF_Lung_Fibroblasts\nE129\tOsteoblasts\n"
  },
  {
    "path": "examples/rme/README.md",
    "content": "Get source code\n\n    git clone https://github.com/samtools/htslib.git\n    cd htslib\n    autoheader\n    autoconf\n    ./configure --disable-bz2 --disable-lzma --enable-libcurl\n    make -j 20\n    export HTSLIB_ROOT=`pwd`\n    cd ..\n\n    git clone https://github.com/ryanlayer/giggle.git\n    cd giggle\n    make\n    export GIGGLE_ROOT=`pwd`\n    cd ..\n\n    wget -O gargs https://github.com/brentp/gargs/releases/download/v0.3.6/gargs_linux\n    chmod +x gargs\n\nGet database data and index\n\n    mkdir rme_data\n    cd rme_data\n    wget http://egg2.wustl.edu/roadmap/data/byFileType/chromhmmSegmentations/ChmmModels/coreMarks/jointModel/final/all.mnemonics.bedFiles.tgz\n    mkdir orig\n    tar zxvf all.mnemonics.bedFiles.tgz -C orig/\n    mkdir split\n\n    pip install toolshed --user\n\n    python $GIGGLE_ROOT/examples/rme/rename.py \\\n        $GIGGLE_ROOT/examples/rme/states.txt \\\n        $GIGGLE_ROOT/examples/rme/EDACC_NAME.txt \\\n        \"orig/*gz\" \\\n        \"split/\"\n\n    cd split\n    ls *.bed | ../gargs -p 30 \"bgzip {}\"\n    cd ..\n\n    mkdir split_sort\n\n    $GIGGLE_ROOT/scripts/sort_bed \"split/*gz\" split_sort/ 30\n\n    mkdir split_sort_raw\n    cd split_sort_raw\n    cp ../split_sort/* .\n    ls *.bed.gz | gargs -p 30 \"bgzip -d {}\"\n    cd ..\n    \n    time $GIGGLE_ROOT/bin/giggle index \\\n        -i \"split_sort/*gz\" \\\n        -o split_sort_b \\\n        -f -s\n    Indexed 55605005 intervals.\n\n    real    1m20.940s\n    user    1m17.933s\n    sys     0m2.969s\n"
  },
  {
    "path": "examples/rme/Standardized_names.txt",
    "content": "E001\tES-I3_Cells\nE002\tES-WA7_Cells\nE003\tH1_Cells\nE004\tH1_BMP4_Derived_Mesendoderm_Cultured_Cells\nE005\tH1_BMP4_Derived_Trophoblast_Cultured_Cells\nE006\tH1_Derived_Mesenchymal_Stem_Cells\nE007\tH1_Derived_Neuronal_Progenitor_Cultured_Cells\nE008\tH9_Cells\nE009\tH9_Derived_Neuronal_Progenitor_Cultured_Cells\nE010\tH9_Derived_Neuron_Cultured_Cells\nE011\thESC_Derived_CD184+_Endoderm_Cultured_Cells\nE012\thESC_Derived_CD56+_Ectoderm_Cultured_Cells\nE013\thESC_Derived_CD56+_Mesoderm_Cultured_Cells\nE014\tHUES48_Cells\nE015\tHUES6_Cells\nE016\tHUES64_Cells\nE017\tIMR90_fetal_lung_fibroblasts_Cell_Line\nE018\tiPS-15b_Cells\nE019\tiPS-18_Cells\nE020\tiPS-20b_Cells\nE021\tiPS_DF_6.9_Cells\nE022\tiPS_DF_19.11_Cells\nE023\tMesenchymal_Stem_Cell_Derived_Adipocyte_Cultured_Cells\nE024\tES-UCSF4__Cells\nE025\tAdipose_Derived_Mesenchymal_Stem_Cell_Cultured_Cells\nE026\tBone_Marrow_Derived_Cultured_Mesenchymal_Stem_Cells\nE027\tBreast_Myoepithelial_Primary_Cells\nE028\tBreast_variant_Human_Mammary_Epithelial_Cells_vHMEC\nE029\tPrimary_monocytes_from peripheral blood\nE030\tPrimary_neutrophils_from peripheral blood\nE031\tPrimary_B_cells_from_cord_blood\nE032\tPrimary_B_cells_from_peripheral_blood\nE033\tPrimary_T_cells_from_cord_blood\nE034\tPrimary_T_cells_from peripheral blood\nE035\tPrimary_hematopoietic_stem_cells\nE036\tPrimary_hematopoietic_stem_cells_short_term_culture\nE037\tPrimary_T_helper_memory_cells_from_peripheral_blood_2\nE038\tPrimary_T_helper_naive_cells_from_peripheral_blood\nE039\tPrimary_T_helper_naive_cells_from peripheral blood\nE040\tPrimary_T_helper_memory_cells_from_peripheral_blood_1\nE041\tPrimary_T_helper_cells_PMA-I_stimulated\nE042\tPrimary_T_helper_17_cells_PMA-I_stimulated\nE043\tPrimary_T_helper_cells_from peripheral blood\nE044\tPrimary_T_regulatory_cells_from peripheral blood\nE045\tPrimary_T_cells_effector/memory_enriched_from_peripheral_blood\nE046\tPrimary_Natural_Killer_cells_from peripheral blood\nE047\tPrimary_T_CD8+_naive_cells_from_peripheral_blood\nE048\tPrimary_T_CD8+_memory_cells_from_peripheral_blood\nE049\tMesenchymal_Stem_Cell_Derived_Chondrocyte_Cultured_Cells\nE050\tPrimary_hematopoietic_stem_cells_G-CSF-mobilized_Female\nE051\tPrimary_hematopoietic_stem_cells_G-CSF-mobilized_Male\nE052\tMuscle_Satellite_Cultured_Cells\nE053\tCortex_derived_primary_cultured_neurospheres\nE054\tGanglion_Eminence_derived_primary_cultured_neurospheres\nE055\tForeskin_Fibroblast_Primary_Cells_skin01\nE056\tForeskin_Fibroblast_Primary_Cells_skin02\nE057\tForeskin_Keratinocyte_Primary_Cells_skin02\nE058\tForeskin_Keratinocyte_Primary_Cells_skin03\nE059\tForeskin_Melanocyte_Primary_Cells_skin01\nE061\tForeskin_Melanocyte_Primary_Cells_skin03\nE062\tPrimary_mononuclear_cells_from peripheral blood\nE063\tAdipose_Nuclei\nE065\tAorta\nE066\tLiver\nE067\tBrain_Angular_Gyrus\nE068\tBrain_Anterior_Caudate\nE069\tBrain_Cingulate_Gyrus\nE070\tBrain_Germinal_Matrix\nE071\tBrain_Hippocampus_Middle\nE072\tBrain_Inferior_Temporal_Lobe\nE073\tBrain_Dorsolateral_Prefrontal_Cortex\nE074\tBrain_Substantia_Nigra\nE075\tColonic_Mucosa\nE076\tColon_Smooth_Muscle\nE077\tDuodenum_Mucosa\nE078\tDuodenum_Smooth_Muscle\nE079\tEsophagus\nE080\tFetal_Adrenal_Gland\nE081\tFetal_Brain_Male\nE082\tFetal_Brain_Female\nE083\tFetal_Heart\nE084\tFetal_Intestine_Large\nE085\tFetal_Intestine_Small\nE086\tFetal_Kidney\nE087\tPancreatic_Islets\nE088\tFetal_Lung\nE089\tFetal_Muscle_Trunk\nE090\tFetal_Muscle_Leg\nE091\tPlacenta\nE092\tFetal_Stomach\nE093\tFetal_Thymus\nE094\tGastric\nE095\tLeft_Ventricle\nE096\tLung\nE097\tOvary\nE098\tPancreas\nE099\tPlacenta_Amnion\nE100\tPsoas_Muscle\nE101\tRectal_Mucosa_Donor_29\nE102\tRectal_Mucosa_Donor_31\nE103\tRectal_Smooth_Muscle\nE104\tRight_Atrium\nE105\tRight_Ventricle\nE106\tSigmoid_Colon\nE107\tSkeletal_Muscle_Male\nE108\tSkeletal_Muscle_Female\nE109\tSmall_Intestine\nE110\tStomach_Mucosa\nE111\tStomach_Smooth_Muscle\nE112\tThymus\nE113\tSpleen\nE114\tA549_EtOH_0.02pct_Lung_Carcinoma_Cell_Line\nE115\tDnd41_TCell_Leukemia_Cell_Line\nE116\tGM12878_Lymphoblastoid_Cells\nE117\tHeLa-S3_Cervical_Carcinoma_Cell_Line\nE118\tHepG2_Hepatocellular_Carcinoma_Cell_Line\nE119\tHMEC_Mammary_Epithelial_Primary_Cells\nE120\tHSMM_Skeletal_Muscle_Myoblasts_Cells\nE121\tHSMM_cell_derived_Skeletal_Muscle_Myotubes_Cells\nE122\tHUVEC_Umbilical_Vein_Endothelial_Primary_Cells\nE123\tK562_Leukemia_Cells\nE124\tMonocytes-CD14+_RO01746_Primary_Cells\nE125\tNH-A_Astrocytes_Primary_Cells\nE126\tNHDF-Ad_Adult_Dermal_Fibroblast_Primary_Cells\nE127\tNHEK-Epidermal_Keratinocyte_Primary_Cells\nE128\tNHLF_Lung_Fibroblast_Primary_Cells\nE129\tOsteoblast_Primary_Cells\n"
  },
  {
    "path": "examples/rme/data_def.json",
    "content": "{\n  \"dimensions\": [\n    {\n      \"elements\": [\n        \"ES I3 Cell Line\", \n        \"ES WA7 Cell Line\", \n        \"H1 Cell Line\", \n        \"H1 BMP4 Derived Mesendoderm Cultured Cells\", \n        \"H1 BMP4 Derived Trophoblast Cultured Cells\", \n        \"H1 Derived Mesenchymal Stem Cells\", \n        \"H1 Derived Neuronal Progenitor Cultured Cells\", \n        \"H9 Cell Line\", \n        \"H9 Derived Neuronal Progenitor Cultured Cells\", \n        \"H9 Derived Neuron Cultured Cells\", \n        \"hESC Derived CD184pp Endoderm Cultured Cells\", \n        \"hESC Derived CD56pp Ectoderm Cultured Cells\", \n        \"hESC Derived CD56pp Mesoderm Cultured Cells\", \n        \"HUES48 Cell Line\", \n        \"HUES6 Cell Line\", \n        \"HUES64 Cell Line\", \n        \"IMR90 Cell Line\", \n        \"iPS 15b Cell Line\", \n        \"iPS 18 Cell Line\", \n        \"iPS 20b Cell Line\", \n        \"iPS DF 6.9 Cell Line\", \n        \"iPS DF 19.11 Cell Line\", \n        \"Mesenchymal Stem Cell Derived Adipocyte Cultured Cells\", \n        \"4star\", \n        \"Adipose Derived Mesenchymal Stem Cell Cultured Cells\", \n        \"Bone Marrow Derived Mesenchymal Stem Cell Cultured Cells\", \n        \"Breast Myoepithelial Cells\", \n        \"Breast vHMEC\", \n        \"CD14 Primary Cells\", \n        \"CD15 Primary Cells\", \n        \"CD19 Primary Cells Cord BI\", \n        \"CD19 Primary Cells Peripheral UW\", \n        \"CD3 Primary Cells Cord BI\", \n        \"CD3 Primary Cells Peripheral UW\", \n        \"CD34 Primary Cells\", \n        \"CD34 Cultured Cells\", \n        \"CD4 Memory Primary Cells\", \n        \"CD4 Naive Primary Cells\", \n        \"CD4pp CD25  CD45RApp Naive Primary Cells\", \n        \"CD4pp CD25  CD45ROpp Memory Primary Cells\", \n        \"CD4pp CD25  IL17  PMA Ionomycin stimulated MACS purified Th Primary Cells\", \n        \"CD4pp CD25  IL17pp PMA Ionomcyin stimulated Th17 Primary Cells\", \n        \"CD4pp CD25  Th Primary Cells\", \n        \"CD4pp CD25pp CD127  Treg Primary Cells\", \n        \"CD4pp CD25int CD127pp Tmem Primary Cells\", \n        \"CD56 Primary Cells\", \n        \"CD8 Naive Primary Cells\", \n        \"CD8 Memory Primary Cells\", \n        \"Chondrocytes from Bone Marrow Derived Mesenchymal Stem Cell Cultured Cells\", \n        \"Mobilized CD34 Primary Cells Female\", \n        \"Mobilized CD34 Primary Cells Male\", \n        \"Muscle Satellite Cultured Cells\", \n        \"Neurosphere Cultured Cells Cortex Derived\", \n        \"Neurosphere Cultured Cells Ganglionic Eminence Derived\", \n        \"Penis Foreskin Fibroblast Primary Cells skin01\", \n        \"Penis Foreskin Fibroblast Primary Cells skin02\", \n        \"Penis Foreskin Keratinocyte Primary Cells skin02\", \n        \"Penis Foreskin Keratinocyte Primary Cells skin03\", \n        \"Penis Foreskin Melanocyte Primary Cells skin01\", \n        \"Penis Foreskin Melanocyte Primary Cells skin03\", \n        \"Peripheral Blood Mononuclear Primary Cells\", \n        \"Adipose Nuclei\", \n        \"Aorta\", \n        \"Adult Liver\", \n        \"Brain Angular Gyrus\", \n        \"Brain Anterior Caudate\", \n        \"Brain Cingulate Gyrus\", \n        \"Brain Germinal Matrix\", \n        \"Brain Hippocampus Middle\", \n        \"Brain Inferior Temporal Lobe\", \n        \"Brain Mid Frontal Lobe\", \n        \"Brain Substantia Nigra\", \n        \"Colonic Mucosa\", \n        \"Colon Smooth Muscle\", \n        \"Duodenum Mucosa\", \n        \"Duodenum Smooth Muscle\", \n        \"Esophagus\", \n        \"Fetal Adrenal Gland\", \n        \"Fetal Brain Male\", \n        \"Fetal Brain Female\", \n        \"Fetal Heart\", \n        \"Fetal Intestine Large\", \n        \"Fetal Intestine Small\", \n        \"Fetal Kidney\", \n        \"Pancreatic Islets\", \n        \"Fetal Lung\", \n        \"Fetal Muscle Trunk\", \n        \"Fetal Muscle Leg\", \n        \"Fetal Placenta\", \n        \"Fetal Stomach\", \n        \"Fetal Thymus\", \n        \"Gastric\", \n        \"Left Ventricle\", \n        \"Lung\", \n        \"Ovary\", \n        \"Pancreas\", \n        \"Placenta Amnion\", \n        \"Psoas Muscle\", \n        \"Rectal Mucosa.Donor 29\", \n        \"Rectal Mucosa.Donor 31\", \n        \"Rectal Smooth Muscle\", \n        \"Right Atrium\", \n        \"Right Ventricle\", \n        \"Sigmoid Colon\", \n        \"Skeletal Muscle Male\", \n        \"Skeletal Muscle Female\", \n        \"Small Intestine\", \n        \"Stomach Mucosa\", \n        \"Stomach Smooth Muscle\", \n        \"Thymus\", \n        \"Spleen\", \n        \"A549 EtOH 0.02pct Lung Carcinoma\", \n        \"Dnd41 TCell Leukemia\", \n        \"GM12878 Lymphoblastoid\", \n        \"HeLa S3 Cervical Carcinoma\", \n        \"HepG2 Hepatocellular Carcinoma\", \n        \"HMEC Mammary Epithelial\", \n        \"HSMM Skeletal Muscle Myoblasts\", \n        \"HSMMtube Skeletal Muscle Myotubes Derived from HSMM\", \n        \"HUVEC Umbilical Vein Endothelial Cells\", \n        \"K562 Leukemia\", \n        \"Monocytes CD14pp RO01746\", \n        \"NH A Astrocytes\", \n        \"NHDF Ad Adult Dermal Fibroblasts\", \n        \"NHEK Epidermal Keratinocytes\", \n        \"NHLF Lung Fibroblasts\", \n        \"Osteoblasts\"\n      ], \n      \"number\": \"127\", \n      \"title\": \"Reference Epigenomes\"\n    }, \n    {\n      \"elements\": [\n        \"Active TSS\", \n        \"Flanking Active TSS\", \n        \"Transcr at gene 5 and 3\", \n        \"Strong transcription\", \n        \"Weak transcription\", \n        \"Genic enhancers\", \n        \"Enhancers\", \n        \"ZNF genes and repeats\", \n        \"Heterochromatin\", \n        \"Bivalent Poised TSS\", \n        \"Flanking Bivalent TSS Enh\", \n        \"Bivalent Enhancer\", \n        \"Repressed PolyComb\", \n        \"Weak Repressed PolyComb\", \n        \"Quiescent Low\"\n      ], \n      \"number\": \"15\", \n      \"title\": \"Genomic States\"\n    }\n  ], \n  \"sourceFiles\": [\n    {\n      \"name\": \"4star_Active_TSS.bed.gz\", \n      \"position\": [\n        23, \n        0\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"4star_Bivalent_Enhancer.bed.gz\", \n      \"position\": [\n        23, \n        11\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"4star_Bivalent_Poised_TSS.bed.gz\", \n      \"position\": [\n        23, \n        9\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"4star_Enhancers.bed.gz\", \n      \"position\": [\n        23, \n        6\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"4star_Flanking_Active_TSS.bed.gz\", \n      \"position\": [\n        23, \n        1\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"4star_Flanking_Bivalent_TSS_Enh.bed.gz\", \n      \"position\": [\n        23, \n        10\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"4star_Genic_enhancers.bed.gz\", \n      \"position\": [\n        23, \n        5\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"4star_Heterochromatin.bed.gz\", \n      \"position\": [\n        23, \n        8\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"4star_Quiescent_Low.bed.gz\", \n      \"position\": [\n        23, \n        14\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"4star_Repressed_PolyComb.bed.gz\", \n      \"position\": [\n        23, \n        12\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"4star_Strong_transcription.bed.gz\", \n      \"position\": [\n        23, \n        3\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"4star_Transcr_at_gene_5_and_3.bed.gz\", \n      \"position\": [\n        23, \n        2\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"4star_Weak_Repressed_PolyComb.bed.gz\", \n      \"position\": [\n        23, \n        13\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"4star_Weak_transcription.bed.gz\", \n      \"position\": [\n        23, \n        4\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"4star_ZNF_genes_and_repeats.bed.gz\", \n      \"position\": [\n        23, \n        7\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"A549_EtOH_0.02pct_Lung_Carcinoma_Active_TSS.bed.gz\", \n      \"position\": [\n        111, \n        0\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"A549_EtOH_0.02pct_Lung_Carcinoma_Bivalent_Enhancer.bed.gz\", \n      \"position\": [\n        111, \n        11\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"A549_EtOH_0.02pct_Lung_Carcinoma_Bivalent_Poised_TSS.bed.gz\", \n      \"position\": [\n        111, \n        9\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"A549_EtOH_0.02pct_Lung_Carcinoma_Enhancers.bed.gz\", \n      \"position\": [\n        111, \n        6\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"A549_EtOH_0.02pct_Lung_Carcinoma_Flanking_Active_TSS.bed.gz\", \n      \"position\": [\n        111, \n        1\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"A549_EtOH_0.02pct_Lung_Carcinoma_Flanking_Bivalent_TSS_Enh.bed.gz\", \n      \"position\": [\n        111, \n        10\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"A549_EtOH_0.02pct_Lung_Carcinoma_Genic_enhancers.bed.gz\", \n      \"position\": [\n        111, \n        5\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"A549_EtOH_0.02pct_Lung_Carcinoma_Heterochromatin.bed.gz\", \n      \"position\": [\n        111, \n        8\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"A549_EtOH_0.02pct_Lung_Carcinoma_Quiescent_Low.bed.gz\", \n      \"position\": [\n        111, \n        14\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"A549_EtOH_0.02pct_Lung_Carcinoma_Repressed_PolyComb.bed.gz\", \n      \"position\": [\n        111, \n        12\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"A549_EtOH_0.02pct_Lung_Carcinoma_Strong_transcription.bed.gz\", \n      \"position\": [\n        111, \n        3\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"A549_EtOH_0.02pct_Lung_Carcinoma_Transcr_at_gene_5_and_3.bed.gz\", \n      \"position\": [\n        111, \n        2\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"A549_EtOH_0.02pct_Lung_Carcinoma_Weak_Repressed_PolyComb.bed.gz\", \n      \"position\": [\n        111, \n        13\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"A549_EtOH_0.02pct_Lung_Carcinoma_Weak_transcription.bed.gz\", \n      \"position\": [\n        111, \n        4\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"A549_EtOH_0.02pct_Lung_Carcinoma_ZNF_genes_and_repeats.bed.gz\", \n      \"position\": [\n        111, \n        7\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"Adipose_Derived_Mesenchymal_Stem_Cell_Cultured_Cells_Active_TSS.bed.gz\", \n      \"position\": [\n        24, \n        0\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"Adipose_Derived_Mesenchymal_Stem_Cell_Cultured_Cells_Bivalent_Enhancer.bed.gz\", \n      \"position\": [\n        24, \n        11\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"Adipose_Derived_Mesenchymal_Stem_Cell_Cultured_Cells_Bivalent_Poised_TSS.bed.gz\", \n      \"position\": [\n        24, \n        9\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"Adipose_Derived_Mesenchymal_Stem_Cell_Cultured_Cells_Enhancers.bed.gz\", \n      \"position\": [\n        24, \n        6\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"Adipose_Derived_Mesenchymal_Stem_Cell_Cultured_Cells_Flanking_Active_TSS.bed.gz\", \n      \"position\": [\n        24, \n        1\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"Adipose_Derived_Mesenchymal_Stem_Cell_Cultured_Cells_Flanking_Bivalent_TSS_Enh.bed.gz\", \n      \"position\": [\n        24, \n        10\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"Adipose_Derived_Mesenchymal_Stem_Cell_Cultured_Cells_Genic_enhancers.bed.gz\", \n      \"position\": [\n        24, \n        5\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"Adipose_Derived_Mesenchymal_Stem_Cell_Cultured_Cells_Heterochromatin.bed.gz\", \n      \"position\": [\n        24, \n        8\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"Adipose_Derived_Mesenchymal_Stem_Cell_Cultured_Cells_Quiescent_Low.bed.gz\", \n      \"position\": [\n        24, \n        14\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"Adipose_Derived_Mesenchymal_Stem_Cell_Cultured_Cells_Repressed_PolyComb.bed.gz\", \n      \"position\": [\n        24, \n        12\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"Adipose_Derived_Mesenchymal_Stem_Cell_Cultured_Cells_Strong_transcription.bed.gz\", \n      \"position\": [\n        24, \n        3\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"Adipose_Derived_Mesenchymal_Stem_Cell_Cultured_Cells_Transcr_at_gene_5_and_3.bed.gz\", \n      \"position\": [\n        24, \n        2\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"Adipose_Derived_Mesenchymal_Stem_Cell_Cultured_Cells_Weak_Repressed_PolyComb.bed.gz\", \n      \"position\": [\n        24, \n        13\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"Adipose_Derived_Mesenchymal_Stem_Cell_Cultured_Cells_Weak_transcription.bed.gz\", \n      \"position\": [\n        24, \n        4\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"Adipose_Derived_Mesenchymal_Stem_Cell_Cultured_Cells_ZNF_genes_and_repeats.bed.gz\", \n      \"position\": [\n        24, \n        7\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"Adipose_Nuclei_Active_TSS.bed.gz\", \n      \"position\": [\n        61, \n        0\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"Adipose_Nuclei_Bivalent_Enhancer.bed.gz\", \n      \"position\": [\n        61, \n        11\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"Adipose_Nuclei_Bivalent_Poised_TSS.bed.gz\", \n      \"position\": [\n        61, \n        9\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"Adipose_Nuclei_Enhancers.bed.gz\", \n      \"position\": [\n        61, \n        6\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"Adipose_Nuclei_Flanking_Active_TSS.bed.gz\", \n      \"position\": [\n        61, \n        1\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"Adipose_Nuclei_Flanking_Bivalent_TSS_Enh.bed.gz\", \n      \"position\": [\n        61, \n        10\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"Adipose_Nuclei_Genic_enhancers.bed.gz\", \n      \"position\": [\n        61, \n        5\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"Adipose_Nuclei_Heterochromatin.bed.gz\", \n      \"position\": [\n        61, \n        8\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"Adipose_Nuclei_Quiescent_Low.bed.gz\", \n      \"position\": [\n        61, \n        14\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"Adipose_Nuclei_Repressed_PolyComb.bed.gz\", \n      \"position\": [\n        61, \n        12\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"Adipose_Nuclei_Strong_transcription.bed.gz\", \n      \"position\": [\n        61, \n        3\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"Adipose_Nuclei_Transcr_at_gene_5_and_3.bed.gz\", \n      \"position\": [\n        61, \n        2\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"Adipose_Nuclei_Weak_Repressed_PolyComb.bed.gz\", \n      \"position\": [\n        61, \n        13\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"Adipose_Nuclei_Weak_transcription.bed.gz\", \n      \"position\": [\n        61, \n        4\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"Adipose_Nuclei_ZNF_genes_and_repeats.bed.gz\", \n      \"position\": [\n        61, \n        7\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"Adult_Liver_Active_TSS.bed.gz\", \n      \"position\": [\n        63, \n        0\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"Adult_Liver_Bivalent_Enhancer.bed.gz\", \n      \"position\": [\n        63, \n        11\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"Adult_Liver_Bivalent_Poised_TSS.bed.gz\", \n      \"position\": [\n        63, \n        9\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"Adult_Liver_Enhancers.bed.gz\", \n      \"position\": [\n        63, \n        6\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"Adult_Liver_Flanking_Active_TSS.bed.gz\", \n      \"position\": [\n        63, \n        1\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"Adult_Liver_Flanking_Bivalent_TSS_Enh.bed.gz\", \n      \"position\": [\n        63, \n        10\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"Adult_Liver_Genic_enhancers.bed.gz\", \n      \"position\": [\n        63, \n        5\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"Adult_Liver_Heterochromatin.bed.gz\", \n      \"position\": [\n        63, \n        8\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"Adult_Liver_Quiescent_Low.bed.gz\", \n      \"position\": [\n        63, \n        14\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"Adult_Liver_Repressed_PolyComb.bed.gz\", \n      \"position\": [\n        63, \n        12\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"Adult_Liver_Strong_transcription.bed.gz\", \n      \"position\": [\n        63, \n        3\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"Adult_Liver_Transcr_at_gene_5_and_3.bed.gz\", \n      \"position\": [\n        63, \n        2\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"Adult_Liver_Weak_Repressed_PolyComb.bed.gz\", \n      \"position\": [\n        63, \n        13\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"Adult_Liver_Weak_transcription.bed.gz\", \n      \"position\": [\n        63, \n        4\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"Adult_Liver_ZNF_genes_and_repeats.bed.gz\", \n      \"position\": [\n        63, \n        7\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"Aorta_Active_TSS.bed.gz\", \n      \"position\": [\n        62, \n        0\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"Aorta_Bivalent_Enhancer.bed.gz\", \n      \"position\": [\n        62, \n        11\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"Aorta_Bivalent_Poised_TSS.bed.gz\", \n      \"position\": [\n        62, \n        9\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"Aorta_Enhancers.bed.gz\", \n      \"position\": [\n        62, \n        6\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"Aorta_Flanking_Active_TSS.bed.gz\", \n      \"position\": [\n        62, \n        1\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"Aorta_Flanking_Bivalent_TSS_Enh.bed.gz\", \n      \"position\": [\n        62, \n        10\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"Aorta_Genic_enhancers.bed.gz\", \n      \"position\": [\n        62, \n        5\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"Aorta_Heterochromatin.bed.gz\", \n      \"position\": [\n        62, \n        8\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"Aorta_Quiescent_Low.bed.gz\", \n      \"position\": [\n        62, \n        14\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"Aorta_Repressed_PolyComb.bed.gz\", \n      \"position\": [\n        62, \n        12\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"Aorta_Strong_transcription.bed.gz\", \n      \"position\": [\n        62, \n        3\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"Aorta_Transcr_at_gene_5_and_3.bed.gz\", \n      \"position\": [\n        62, \n        2\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"Aorta_Weak_Repressed_PolyComb.bed.gz\", \n      \"position\": [\n        62, \n        13\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"Aorta_Weak_transcription.bed.gz\", \n      \"position\": [\n        62, \n        4\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"Aorta_ZNF_genes_and_repeats.bed.gz\", \n      \"position\": [\n        62, \n        7\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"Bone_Marrow_Derived_Mesenchymal_Stem_Cell_Cultured_Cells_Active_TSS.bed.gz\", \n      \"position\": [\n        25, \n        0\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"Bone_Marrow_Derived_Mesenchymal_Stem_Cell_Cultured_Cells_Bivalent_Enhancer.bed.gz\", \n      \"position\": [\n        25, \n        11\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"Bone_Marrow_Derived_Mesenchymal_Stem_Cell_Cultured_Cells_Bivalent_Poised_TSS.bed.gz\", \n      \"position\": [\n        25, \n        9\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"Bone_Marrow_Derived_Mesenchymal_Stem_Cell_Cultured_Cells_Enhancers.bed.gz\", \n      \"position\": [\n        25, \n        6\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"Bone_Marrow_Derived_Mesenchymal_Stem_Cell_Cultured_Cells_Flanking_Active_TSS.bed.gz\", \n      \"position\": [\n        25, \n        1\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"Bone_Marrow_Derived_Mesenchymal_Stem_Cell_Cultured_Cells_Flanking_Bivalent_TSS_Enh.bed.gz\", \n      \"position\": [\n        25, \n        10\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"Bone_Marrow_Derived_Mesenchymal_Stem_Cell_Cultured_Cells_Genic_enhancers.bed.gz\", \n      \"position\": [\n        25, \n        5\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"Bone_Marrow_Derived_Mesenchymal_Stem_Cell_Cultured_Cells_Heterochromatin.bed.gz\", \n      \"position\": [\n        25, \n        8\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"Bone_Marrow_Derived_Mesenchymal_Stem_Cell_Cultured_Cells_Quiescent_Low.bed.gz\", \n      \"position\": [\n        25, \n        14\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"Bone_Marrow_Derived_Mesenchymal_Stem_Cell_Cultured_Cells_Repressed_PolyComb.bed.gz\", \n      \"position\": [\n        25, \n        12\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"Bone_Marrow_Derived_Mesenchymal_Stem_Cell_Cultured_Cells_Strong_transcription.bed.gz\", \n      \"position\": [\n        25, \n        3\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"Bone_Marrow_Derived_Mesenchymal_Stem_Cell_Cultured_Cells_Transcr_at_gene_5_and_3.bed.gz\", \n      \"position\": [\n        25, \n        2\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"Bone_Marrow_Derived_Mesenchymal_Stem_Cell_Cultured_Cells_Weak_Repressed_PolyComb.bed.gz\", \n      \"position\": [\n        25, \n        13\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"Bone_Marrow_Derived_Mesenchymal_Stem_Cell_Cultured_Cells_Weak_transcription.bed.gz\", \n      \"position\": [\n        25, \n        4\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"Bone_Marrow_Derived_Mesenchymal_Stem_Cell_Cultured_Cells_ZNF_genes_and_repeats.bed.gz\", \n      \"position\": [\n        25, \n        7\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"Brain_Angular_Gyrus_Active_TSS.bed.gz\", \n      \"position\": [\n        64, \n        0\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"Brain_Angular_Gyrus_Bivalent_Enhancer.bed.gz\", \n      \"position\": [\n        64, \n        11\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"Brain_Angular_Gyrus_Bivalent_Poised_TSS.bed.gz\", \n      \"position\": [\n        64, \n        9\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"Brain_Angular_Gyrus_Enhancers.bed.gz\", \n      \"position\": [\n        64, \n        6\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"Brain_Angular_Gyrus_Flanking_Active_TSS.bed.gz\", \n      \"position\": [\n        64, \n        1\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"Brain_Angular_Gyrus_Flanking_Bivalent_TSS_Enh.bed.gz\", \n      \"position\": [\n        64, \n        10\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"Brain_Angular_Gyrus_Genic_enhancers.bed.gz\", \n      \"position\": [\n        64, \n        5\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"Brain_Angular_Gyrus_Heterochromatin.bed.gz\", \n      \"position\": [\n        64, \n        8\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"Brain_Angular_Gyrus_Quiescent_Low.bed.gz\", \n      \"position\": [\n        64, \n        14\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"Brain_Angular_Gyrus_Repressed_PolyComb.bed.gz\", \n      \"position\": [\n        64, \n        12\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"Brain_Angular_Gyrus_Strong_transcription.bed.gz\", \n      \"position\": [\n        64, \n        3\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"Brain_Angular_Gyrus_Transcr_at_gene_5_and_3.bed.gz\", \n      \"position\": [\n        64, \n        2\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"Brain_Angular_Gyrus_Weak_Repressed_PolyComb.bed.gz\", \n      \"position\": [\n        64, \n        13\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"Brain_Angular_Gyrus_Weak_transcription.bed.gz\", \n      \"position\": [\n        64, \n        4\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"Brain_Angular_Gyrus_ZNF_genes_and_repeats.bed.gz\", \n      \"position\": [\n        64, \n        7\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"Brain_Anterior_Caudate_Active_TSS.bed.gz\", \n      \"position\": [\n        65, \n        0\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"Brain_Anterior_Caudate_Bivalent_Enhancer.bed.gz\", \n      \"position\": [\n        65, \n        11\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"Brain_Anterior_Caudate_Bivalent_Poised_TSS.bed.gz\", \n      \"position\": [\n        65, \n        9\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"Brain_Anterior_Caudate_Enhancers.bed.gz\", \n      \"position\": [\n        65, \n        6\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"Brain_Anterior_Caudate_Flanking_Active_TSS.bed.gz\", \n      \"position\": [\n        65, \n        1\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"Brain_Anterior_Caudate_Flanking_Bivalent_TSS_Enh.bed.gz\", \n      \"position\": [\n        65, \n        10\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"Brain_Anterior_Caudate_Genic_enhancers.bed.gz\", \n      \"position\": [\n        65, \n        5\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"Brain_Anterior_Caudate_Heterochromatin.bed.gz\", \n      \"position\": [\n        65, \n        8\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"Brain_Anterior_Caudate_Quiescent_Low.bed.gz\", \n      \"position\": [\n        65, \n        14\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"Brain_Anterior_Caudate_Repressed_PolyComb.bed.gz\", \n      \"position\": [\n        65, \n        12\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"Brain_Anterior_Caudate_Strong_transcription.bed.gz\", \n      \"position\": [\n        65, \n        3\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"Brain_Anterior_Caudate_Transcr_at_gene_5_and_3.bed.gz\", \n      \"position\": [\n        65, \n        2\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"Brain_Anterior_Caudate_Weak_Repressed_PolyComb.bed.gz\", \n      \"position\": [\n        65, \n        13\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"Brain_Anterior_Caudate_Weak_transcription.bed.gz\", \n      \"position\": [\n        65, \n        4\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"Brain_Anterior_Caudate_ZNF_genes_and_repeats.bed.gz\", \n      \"position\": [\n        65, \n        7\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"Brain_Cingulate_Gyrus_Active_TSS.bed.gz\", \n      \"position\": [\n        66, \n        0\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"Brain_Cingulate_Gyrus_Bivalent_Enhancer.bed.gz\", \n      \"position\": [\n        66, \n        11\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"Brain_Cingulate_Gyrus_Bivalent_Poised_TSS.bed.gz\", \n      \"position\": [\n        66, \n        9\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"Brain_Cingulate_Gyrus_Enhancers.bed.gz\", \n      \"position\": [\n        66, \n        6\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"Brain_Cingulate_Gyrus_Flanking_Active_TSS.bed.gz\", \n      \"position\": [\n        66, \n        1\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"Brain_Cingulate_Gyrus_Flanking_Bivalent_TSS_Enh.bed.gz\", \n      \"position\": [\n        66, \n        10\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"Brain_Cingulate_Gyrus_Genic_enhancers.bed.gz\", \n      \"position\": [\n        66, \n        5\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"Brain_Cingulate_Gyrus_Heterochromatin.bed.gz\", \n      \"position\": [\n        66, \n        8\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"Brain_Cingulate_Gyrus_Quiescent_Low.bed.gz\", \n      \"position\": [\n        66, \n        14\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"Brain_Cingulate_Gyrus_Repressed_PolyComb.bed.gz\", \n      \"position\": [\n        66, \n        12\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"Brain_Cingulate_Gyrus_Strong_transcription.bed.gz\", \n      \"position\": [\n        66, \n        3\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"Brain_Cingulate_Gyrus_Transcr_at_gene_5_and_3.bed.gz\", \n      \"position\": [\n        66, \n        2\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"Brain_Cingulate_Gyrus_Weak_Repressed_PolyComb.bed.gz\", \n      \"position\": [\n        66, \n        13\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"Brain_Cingulate_Gyrus_Weak_transcription.bed.gz\", \n      \"position\": [\n        66, \n        4\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"Brain_Cingulate_Gyrus_ZNF_genes_and_repeats.bed.gz\", \n      \"position\": [\n        66, \n        7\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"Brain_Germinal_Matrix_Active_TSS.bed.gz\", \n      \"position\": [\n        67, \n        0\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"Brain_Germinal_Matrix_Bivalent_Enhancer.bed.gz\", \n      \"position\": [\n        67, \n        11\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"Brain_Germinal_Matrix_Bivalent_Poised_TSS.bed.gz\", \n      \"position\": [\n        67, \n        9\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"Brain_Germinal_Matrix_Enhancers.bed.gz\", \n      \"position\": [\n        67, \n        6\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"Brain_Germinal_Matrix_Flanking_Active_TSS.bed.gz\", \n      \"position\": [\n        67, \n        1\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"Brain_Germinal_Matrix_Flanking_Bivalent_TSS_Enh.bed.gz\", \n      \"position\": [\n        67, \n        10\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"Brain_Germinal_Matrix_Genic_enhancers.bed.gz\", \n      \"position\": [\n        67, \n        5\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"Brain_Germinal_Matrix_Heterochromatin.bed.gz\", \n      \"position\": [\n        67, \n        8\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"Brain_Germinal_Matrix_Quiescent_Low.bed.gz\", \n      \"position\": [\n        67, \n        14\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"Brain_Germinal_Matrix_Repressed_PolyComb.bed.gz\", \n      \"position\": [\n        67, \n        12\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"Brain_Germinal_Matrix_Strong_transcription.bed.gz\", \n      \"position\": [\n        67, \n        3\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"Brain_Germinal_Matrix_Transcr_at_gene_5_and_3.bed.gz\", \n      \"position\": [\n        67, \n        2\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"Brain_Germinal_Matrix_Weak_Repressed_PolyComb.bed.gz\", \n      \"position\": [\n        67, \n        13\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"Brain_Germinal_Matrix_Weak_transcription.bed.gz\", \n      \"position\": [\n        67, \n        4\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"Brain_Germinal_Matrix_ZNF_genes_and_repeats.bed.gz\", \n      \"position\": [\n        67, \n        7\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"Brain_Hippocampus_Middle_Active_TSS.bed.gz\", \n      \"position\": [\n        68, \n        0\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"Brain_Hippocampus_Middle_Bivalent_Enhancer.bed.gz\", \n      \"position\": [\n        68, \n        11\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"Brain_Hippocampus_Middle_Bivalent_Poised_TSS.bed.gz\", \n      \"position\": [\n        68, \n        9\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"Brain_Hippocampus_Middle_Enhancers.bed.gz\", \n      \"position\": [\n        68, \n        6\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"Brain_Hippocampus_Middle_Flanking_Active_TSS.bed.gz\", \n      \"position\": [\n        68, \n        1\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"Brain_Hippocampus_Middle_Flanking_Bivalent_TSS_Enh.bed.gz\", \n      \"position\": [\n        68, \n        10\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"Brain_Hippocampus_Middle_Genic_enhancers.bed.gz\", \n      \"position\": [\n        68, \n        5\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"Brain_Hippocampus_Middle_Heterochromatin.bed.gz\", \n      \"position\": [\n        68, \n        8\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"Brain_Hippocampus_Middle_Quiescent_Low.bed.gz\", \n      \"position\": [\n        68, \n        14\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"Brain_Hippocampus_Middle_Repressed_PolyComb.bed.gz\", \n      \"position\": [\n        68, \n        12\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"Brain_Hippocampus_Middle_Strong_transcription.bed.gz\", \n      \"position\": [\n        68, \n        3\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"Brain_Hippocampus_Middle_Transcr_at_gene_5_and_3.bed.gz\", \n      \"position\": [\n        68, \n        2\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"Brain_Hippocampus_Middle_Weak_Repressed_PolyComb.bed.gz\", \n      \"position\": [\n        68, \n        13\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"Brain_Hippocampus_Middle_Weak_transcription.bed.gz\", \n      \"position\": [\n        68, \n        4\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"Brain_Hippocampus_Middle_ZNF_genes_and_repeats.bed.gz\", \n      \"position\": [\n        68, \n        7\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"Brain_Inferior_Temporal_Lobe_Active_TSS.bed.gz\", \n      \"position\": [\n        69, \n        0\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"Brain_Inferior_Temporal_Lobe_Bivalent_Enhancer.bed.gz\", \n      \"position\": [\n        69, \n        11\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"Brain_Inferior_Temporal_Lobe_Bivalent_Poised_TSS.bed.gz\", \n      \"position\": [\n        69, \n        9\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"Brain_Inferior_Temporal_Lobe_Enhancers.bed.gz\", \n      \"position\": [\n        69, \n        6\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"Brain_Inferior_Temporal_Lobe_Flanking_Active_TSS.bed.gz\", \n      \"position\": [\n        69, \n        1\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"Brain_Inferior_Temporal_Lobe_Flanking_Bivalent_TSS_Enh.bed.gz\", \n      \"position\": [\n        69, \n        10\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"Brain_Inferior_Temporal_Lobe_Genic_enhancers.bed.gz\", \n      \"position\": [\n        69, \n        5\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"Brain_Inferior_Temporal_Lobe_Heterochromatin.bed.gz\", \n      \"position\": [\n        69, \n        8\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"Brain_Inferior_Temporal_Lobe_Quiescent_Low.bed.gz\", \n      \"position\": [\n        69, \n        14\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"Brain_Inferior_Temporal_Lobe_Repressed_PolyComb.bed.gz\", \n      \"position\": [\n        69, \n        12\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"Brain_Inferior_Temporal_Lobe_Strong_transcription.bed.gz\", \n      \"position\": [\n        69, \n        3\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"Brain_Inferior_Temporal_Lobe_Transcr_at_gene_5_and_3.bed.gz\", \n      \"position\": [\n        69, \n        2\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"Brain_Inferior_Temporal_Lobe_Weak_Repressed_PolyComb.bed.gz\", \n      \"position\": [\n        69, \n        13\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"Brain_Inferior_Temporal_Lobe_Weak_transcription.bed.gz\", \n      \"position\": [\n        69, \n        4\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"Brain_Inferior_Temporal_Lobe_ZNF_genes_and_repeats.bed.gz\", \n      \"position\": [\n        69, \n        7\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"Brain_Mid_Frontal_Lobe_Active_TSS.bed.gz\", \n      \"position\": [\n        70, \n        0\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"Brain_Mid_Frontal_Lobe_Bivalent_Enhancer.bed.gz\", \n      \"position\": [\n        70, \n        11\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"Brain_Mid_Frontal_Lobe_Bivalent_Poised_TSS.bed.gz\", \n      \"position\": [\n        70, \n        9\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"Brain_Mid_Frontal_Lobe_Enhancers.bed.gz\", \n      \"position\": [\n        70, \n        6\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"Brain_Mid_Frontal_Lobe_Flanking_Active_TSS.bed.gz\", \n      \"position\": [\n        70, \n        1\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"Brain_Mid_Frontal_Lobe_Flanking_Bivalent_TSS_Enh.bed.gz\", \n      \"position\": [\n        70, \n        10\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"Brain_Mid_Frontal_Lobe_Genic_enhancers.bed.gz\", \n      \"position\": [\n        70, \n        5\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"Brain_Mid_Frontal_Lobe_Heterochromatin.bed.gz\", \n      \"position\": [\n        70, \n        8\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"Brain_Mid_Frontal_Lobe_Quiescent_Low.bed.gz\", \n      \"position\": [\n        70, \n        14\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"Brain_Mid_Frontal_Lobe_Repressed_PolyComb.bed.gz\", \n      \"position\": [\n        70, \n        12\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"Brain_Mid_Frontal_Lobe_Strong_transcription.bed.gz\", \n      \"position\": [\n        70, \n        3\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"Brain_Mid_Frontal_Lobe_Transcr_at_gene_5_and_3.bed.gz\", \n      \"position\": [\n        70, \n        2\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"Brain_Mid_Frontal_Lobe_Weak_Repressed_PolyComb.bed.gz\", \n      \"position\": [\n        70, \n        13\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"Brain_Mid_Frontal_Lobe_Weak_transcription.bed.gz\", \n      \"position\": [\n        70, \n        4\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"Brain_Mid_Frontal_Lobe_ZNF_genes_and_repeats.bed.gz\", \n      \"position\": [\n        70, \n        7\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"Brain_Substantia_Nigra_Active_TSS.bed.gz\", \n      \"position\": [\n        71, \n        0\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"Brain_Substantia_Nigra_Bivalent_Enhancer.bed.gz\", \n      \"position\": [\n        71, \n        11\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"Brain_Substantia_Nigra_Bivalent_Poised_TSS.bed.gz\", \n      \"position\": [\n        71, \n        9\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"Brain_Substantia_Nigra_Enhancers.bed.gz\", \n      \"position\": [\n        71, \n        6\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"Brain_Substantia_Nigra_Flanking_Active_TSS.bed.gz\", \n      \"position\": [\n        71, \n        1\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"Brain_Substantia_Nigra_Flanking_Bivalent_TSS_Enh.bed.gz\", \n      \"position\": [\n        71, \n        10\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"Brain_Substantia_Nigra_Genic_enhancers.bed.gz\", \n      \"position\": [\n        71, \n        5\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"Brain_Substantia_Nigra_Heterochromatin.bed.gz\", \n      \"position\": [\n        71, \n        8\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"Brain_Substantia_Nigra_Quiescent_Low.bed.gz\", \n      \"position\": [\n        71, \n        14\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"Brain_Substantia_Nigra_Repressed_PolyComb.bed.gz\", \n      \"position\": [\n        71, \n        12\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"Brain_Substantia_Nigra_Strong_transcription.bed.gz\", \n      \"position\": [\n        71, \n        3\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"Brain_Substantia_Nigra_Transcr_at_gene_5_and_3.bed.gz\", \n      \"position\": [\n        71, \n        2\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"Brain_Substantia_Nigra_Weak_Repressed_PolyComb.bed.gz\", \n      \"position\": [\n        71, \n        13\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"Brain_Substantia_Nigra_Weak_transcription.bed.gz\", \n      \"position\": [\n        71, \n        4\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"Brain_Substantia_Nigra_ZNF_genes_and_repeats.bed.gz\", \n      \"position\": [\n        71, \n        7\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"Breast_Myoepithelial_Cells_Active_TSS.bed.gz\", \n      \"position\": [\n        26, \n        0\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"Breast_Myoepithelial_Cells_Bivalent_Enhancer.bed.gz\", \n      \"position\": [\n        26, \n        11\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"Breast_Myoepithelial_Cells_Bivalent_Poised_TSS.bed.gz\", \n      \"position\": [\n        26, \n        9\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"Breast_Myoepithelial_Cells_Enhancers.bed.gz\", \n      \"position\": [\n        26, \n        6\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"Breast_Myoepithelial_Cells_Flanking_Active_TSS.bed.gz\", \n      \"position\": [\n        26, \n        1\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"Breast_Myoepithelial_Cells_Flanking_Bivalent_TSS_Enh.bed.gz\", \n      \"position\": [\n        26, \n        10\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"Breast_Myoepithelial_Cells_Genic_enhancers.bed.gz\", \n      \"position\": [\n        26, \n        5\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"Breast_Myoepithelial_Cells_Heterochromatin.bed.gz\", \n      \"position\": [\n        26, \n        8\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"Breast_Myoepithelial_Cells_Quiescent_Low.bed.gz\", \n      \"position\": [\n        26, \n        14\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"Breast_Myoepithelial_Cells_Repressed_PolyComb.bed.gz\", \n      \"position\": [\n        26, \n        12\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"Breast_Myoepithelial_Cells_Strong_transcription.bed.gz\", \n      \"position\": [\n        26, \n        3\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"Breast_Myoepithelial_Cells_Transcr_at_gene_5_and_3.bed.gz\", \n      \"position\": [\n        26, \n        2\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"Breast_Myoepithelial_Cells_Weak_Repressed_PolyComb.bed.gz\", \n      \"position\": [\n        26, \n        13\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"Breast_Myoepithelial_Cells_Weak_transcription.bed.gz\", \n      \"position\": [\n        26, \n        4\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"Breast_Myoepithelial_Cells_ZNF_genes_and_repeats.bed.gz\", \n      \"position\": [\n        26, \n        7\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"Breast_vHMEC_Active_TSS.bed.gz\", \n      \"position\": [\n        27, \n        0\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"Breast_vHMEC_Bivalent_Enhancer.bed.gz\", \n      \"position\": [\n        27, \n        11\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"Breast_vHMEC_Bivalent_Poised_TSS.bed.gz\", \n      \"position\": [\n        27, \n        9\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"Breast_vHMEC_Enhancers.bed.gz\", \n      \"position\": [\n        27, \n        6\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"Breast_vHMEC_Flanking_Active_TSS.bed.gz\", \n      \"position\": [\n        27, \n        1\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"Breast_vHMEC_Flanking_Bivalent_TSS_Enh.bed.gz\", \n      \"position\": [\n        27, \n        10\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"Breast_vHMEC_Genic_enhancers.bed.gz\", \n      \"position\": [\n        27, \n        5\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"Breast_vHMEC_Heterochromatin.bed.gz\", \n      \"position\": [\n        27, \n        8\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"Breast_vHMEC_Quiescent_Low.bed.gz\", \n      \"position\": [\n        27, \n        14\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"Breast_vHMEC_Repressed_PolyComb.bed.gz\", \n      \"position\": [\n        27, \n        12\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"Breast_vHMEC_Strong_transcription.bed.gz\", \n      \"position\": [\n        27, \n        3\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"Breast_vHMEC_Transcr_at_gene_5_and_3.bed.gz\", \n      \"position\": [\n        27, \n        2\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"Breast_vHMEC_Weak_Repressed_PolyComb.bed.gz\", \n      \"position\": [\n        27, \n        13\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"Breast_vHMEC_Weak_transcription.bed.gz\", \n      \"position\": [\n        27, \n        4\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"Breast_vHMEC_ZNF_genes_and_repeats.bed.gz\", \n      \"position\": [\n        27, \n        7\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"CD14_Primary_Cells_Active_TSS.bed.gz\", \n      \"position\": [\n        28, \n        0\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"CD14_Primary_Cells_Bivalent_Enhancer.bed.gz\", \n      \"position\": [\n        28, \n        11\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"CD14_Primary_Cells_Bivalent_Poised_TSS.bed.gz\", \n      \"position\": [\n        28, \n        9\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"CD14_Primary_Cells_Enhancers.bed.gz\", \n      \"position\": [\n        28, \n        6\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"CD14_Primary_Cells_Flanking_Active_TSS.bed.gz\", \n      \"position\": [\n        28, \n        1\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"CD14_Primary_Cells_Flanking_Bivalent_TSS_Enh.bed.gz\", \n      \"position\": [\n        28, \n        10\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"CD14_Primary_Cells_Genic_enhancers.bed.gz\", \n      \"position\": [\n        28, \n        5\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"CD14_Primary_Cells_Heterochromatin.bed.gz\", \n      \"position\": [\n        28, \n        8\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"CD14_Primary_Cells_Quiescent_Low.bed.gz\", \n      \"position\": [\n        28, \n        14\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"CD14_Primary_Cells_Repressed_PolyComb.bed.gz\", \n      \"position\": [\n        28, \n        12\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"CD14_Primary_Cells_Strong_transcription.bed.gz\", \n      \"position\": [\n        28, \n        3\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"CD14_Primary_Cells_Transcr_at_gene_5_and_3.bed.gz\", \n      \"position\": [\n        28, \n        2\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"CD14_Primary_Cells_Weak_Repressed_PolyComb.bed.gz\", \n      \"position\": [\n        28, \n        13\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"CD14_Primary_Cells_Weak_transcription.bed.gz\", \n      \"position\": [\n        28, \n        4\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"CD14_Primary_Cells_ZNF_genes_and_repeats.bed.gz\", \n      \"position\": [\n        28, \n        7\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"CD15_Primary_Cells_Active_TSS.bed.gz\", \n      \"position\": [\n        29, \n        0\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"CD15_Primary_Cells_Bivalent_Enhancer.bed.gz\", \n      \"position\": [\n        29, \n        11\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"CD15_Primary_Cells_Bivalent_Poised_TSS.bed.gz\", \n      \"position\": [\n        29, \n        9\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"CD15_Primary_Cells_Enhancers.bed.gz\", \n      \"position\": [\n        29, \n        6\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"CD15_Primary_Cells_Flanking_Active_TSS.bed.gz\", \n      \"position\": [\n        29, \n        1\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"CD15_Primary_Cells_Flanking_Bivalent_TSS_Enh.bed.gz\", \n      \"position\": [\n        29, \n        10\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"CD15_Primary_Cells_Genic_enhancers.bed.gz\", \n      \"position\": [\n        29, \n        5\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"CD15_Primary_Cells_Heterochromatin.bed.gz\", \n      \"position\": [\n        29, \n        8\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"CD15_Primary_Cells_Quiescent_Low.bed.gz\", \n      \"position\": [\n        29, \n        14\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"CD15_Primary_Cells_Repressed_PolyComb.bed.gz\", \n      \"position\": [\n        29, \n        12\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"CD15_Primary_Cells_Strong_transcription.bed.gz\", \n      \"position\": [\n        29, \n        3\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"CD15_Primary_Cells_Transcr_at_gene_5_and_3.bed.gz\", \n      \"position\": [\n        29, \n        2\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"CD15_Primary_Cells_Weak_Repressed_PolyComb.bed.gz\", \n      \"position\": [\n        29, \n        13\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"CD15_Primary_Cells_Weak_transcription.bed.gz\", \n      \"position\": [\n        29, \n        4\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"CD15_Primary_Cells_ZNF_genes_and_repeats.bed.gz\", \n      \"position\": [\n        29, \n        7\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"CD19_Primary_Cells_Cord_BI_Active_TSS.bed.gz\", \n      \"position\": [\n        30, \n        0\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"CD19_Primary_Cells_Cord_BI_Bivalent_Enhancer.bed.gz\", \n      \"position\": [\n        30, \n        11\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"CD19_Primary_Cells_Cord_BI_Bivalent_Poised_TSS.bed.gz\", \n      \"position\": [\n        30, \n        9\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"CD19_Primary_Cells_Cord_BI_Enhancers.bed.gz\", \n      \"position\": [\n        30, \n        6\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"CD19_Primary_Cells_Cord_BI_Flanking_Active_TSS.bed.gz\", \n      \"position\": [\n        30, \n        1\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"CD19_Primary_Cells_Cord_BI_Flanking_Bivalent_TSS_Enh.bed.gz\", \n      \"position\": [\n        30, \n        10\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"CD19_Primary_Cells_Cord_BI_Genic_enhancers.bed.gz\", \n      \"position\": [\n        30, \n        5\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"CD19_Primary_Cells_Cord_BI_Heterochromatin.bed.gz\", \n      \"position\": [\n        30, \n        8\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"CD19_Primary_Cells_Cord_BI_Quiescent_Low.bed.gz\", \n      \"position\": [\n        30, \n        14\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"CD19_Primary_Cells_Cord_BI_Repressed_PolyComb.bed.gz\", \n      \"position\": [\n        30, \n        12\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"CD19_Primary_Cells_Cord_BI_Strong_transcription.bed.gz\", \n      \"position\": [\n        30, \n        3\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"CD19_Primary_Cells_Cord_BI_Transcr_at_gene_5_and_3.bed.gz\", \n      \"position\": [\n        30, \n        2\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"CD19_Primary_Cells_Cord_BI_Weak_Repressed_PolyComb.bed.gz\", \n      \"position\": [\n        30, \n        13\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"CD19_Primary_Cells_Cord_BI_Weak_transcription.bed.gz\", \n      \"position\": [\n        30, \n        4\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"CD19_Primary_Cells_Cord_BI_ZNF_genes_and_repeats.bed.gz\", \n      \"position\": [\n        30, \n        7\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"CD19_Primary_Cells_Peripheral_UW_Active_TSS.bed.gz\", \n      \"position\": [\n        31, \n        0\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"CD19_Primary_Cells_Peripheral_UW_Bivalent_Enhancer.bed.gz\", \n      \"position\": [\n        31, \n        11\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"CD19_Primary_Cells_Peripheral_UW_Bivalent_Poised_TSS.bed.gz\", \n      \"position\": [\n        31, \n        9\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"CD19_Primary_Cells_Peripheral_UW_Enhancers.bed.gz\", \n      \"position\": [\n        31, \n        6\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"CD19_Primary_Cells_Peripheral_UW_Flanking_Active_TSS.bed.gz\", \n      \"position\": [\n        31, \n        1\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"CD19_Primary_Cells_Peripheral_UW_Flanking_Bivalent_TSS_Enh.bed.gz\", \n      \"position\": [\n        31, \n        10\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"CD19_Primary_Cells_Peripheral_UW_Genic_enhancers.bed.gz\", \n      \"position\": [\n        31, \n        5\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"CD19_Primary_Cells_Peripheral_UW_Heterochromatin.bed.gz\", \n      \"position\": [\n        31, \n        8\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"CD19_Primary_Cells_Peripheral_UW_Quiescent_Low.bed.gz\", \n      \"position\": [\n        31, \n        14\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"CD19_Primary_Cells_Peripheral_UW_Repressed_PolyComb.bed.gz\", \n      \"position\": [\n        31, \n        12\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"CD19_Primary_Cells_Peripheral_UW_Strong_transcription.bed.gz\", \n      \"position\": [\n        31, \n        3\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"CD19_Primary_Cells_Peripheral_UW_Transcr_at_gene_5_and_3.bed.gz\", \n      \"position\": [\n        31, \n        2\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"CD19_Primary_Cells_Peripheral_UW_Weak_Repressed_PolyComb.bed.gz\", \n      \"position\": [\n        31, \n        13\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"CD19_Primary_Cells_Peripheral_UW_Weak_transcription.bed.gz\", \n      \"position\": [\n        31, \n        4\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"CD19_Primary_Cells_Peripheral_UW_ZNF_genes_and_repeats.bed.gz\", \n      \"position\": [\n        31, \n        7\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"CD34_Cultured_Cells_Active_TSS.bed.gz\", \n      \"position\": [\n        35, \n        0\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"CD34_Cultured_Cells_Bivalent_Enhancer.bed.gz\", \n      \"position\": [\n        35, \n        11\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"CD34_Cultured_Cells_Bivalent_Poised_TSS.bed.gz\", \n      \"position\": [\n        35, \n        9\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"CD34_Cultured_Cells_Enhancers.bed.gz\", \n      \"position\": [\n        35, \n        6\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"CD34_Cultured_Cells_Flanking_Active_TSS.bed.gz\", \n      \"position\": [\n        35, \n        1\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"CD34_Cultured_Cells_Flanking_Bivalent_TSS_Enh.bed.gz\", \n      \"position\": [\n        35, \n        10\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"CD34_Cultured_Cells_Genic_enhancers.bed.gz\", \n      \"position\": [\n        35, \n        5\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"CD34_Cultured_Cells_Heterochromatin.bed.gz\", \n      \"position\": [\n        35, \n        8\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"CD34_Cultured_Cells_Quiescent_Low.bed.gz\", \n      \"position\": [\n        35, \n        14\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"CD34_Cultured_Cells_Repressed_PolyComb.bed.gz\", \n      \"position\": [\n        35, \n        12\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"CD34_Cultured_Cells_Strong_transcription.bed.gz\", \n      \"position\": [\n        35, \n        3\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"CD34_Cultured_Cells_Transcr_at_gene_5_and_3.bed.gz\", \n      \"position\": [\n        35, \n        2\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"CD34_Cultured_Cells_Weak_Repressed_PolyComb.bed.gz\", \n      \"position\": [\n        35, \n        13\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"CD34_Cultured_Cells_Weak_transcription.bed.gz\", \n      \"position\": [\n        35, \n        4\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"CD34_Cultured_Cells_ZNF_genes_and_repeats.bed.gz\", \n      \"position\": [\n        35, \n        7\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"CD34_Primary_Cells_Active_TSS.bed.gz\", \n      \"position\": [\n        34, \n        0\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"CD34_Primary_Cells_Bivalent_Enhancer.bed.gz\", \n      \"position\": [\n        34, \n        11\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"CD34_Primary_Cells_Bivalent_Poised_TSS.bed.gz\", \n      \"position\": [\n        34, \n        9\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"CD34_Primary_Cells_Enhancers.bed.gz\", \n      \"position\": [\n        34, \n        6\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"CD34_Primary_Cells_Flanking_Active_TSS.bed.gz\", \n      \"position\": [\n        34, \n        1\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"CD34_Primary_Cells_Flanking_Bivalent_TSS_Enh.bed.gz\", \n      \"position\": [\n        34, \n        10\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"CD34_Primary_Cells_Genic_enhancers.bed.gz\", \n      \"position\": [\n        34, \n        5\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"CD34_Primary_Cells_Heterochromatin.bed.gz\", \n      \"position\": [\n        34, \n        8\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"CD34_Primary_Cells_Quiescent_Low.bed.gz\", \n      \"position\": [\n        34, \n        14\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"CD34_Primary_Cells_Repressed_PolyComb.bed.gz\", \n      \"position\": [\n        34, \n        12\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"CD34_Primary_Cells_Strong_transcription.bed.gz\", \n      \"position\": [\n        34, \n        3\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"CD34_Primary_Cells_Transcr_at_gene_5_and_3.bed.gz\", \n      \"position\": [\n        34, \n        2\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"CD34_Primary_Cells_Weak_Repressed_PolyComb.bed.gz\", \n      \"position\": [\n        34, \n        13\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"CD34_Primary_Cells_Weak_transcription.bed.gz\", \n      \"position\": [\n        34, \n        4\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"CD34_Primary_Cells_ZNF_genes_and_repeats.bed.gz\", \n      \"position\": [\n        34, \n        7\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"CD3_Primary_Cells_Cord_BI_Active_TSS.bed.gz\", \n      \"position\": [\n        32, \n        0\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"CD3_Primary_Cells_Cord_BI_Bivalent_Enhancer.bed.gz\", \n      \"position\": [\n        32, \n        11\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"CD3_Primary_Cells_Cord_BI_Bivalent_Poised_TSS.bed.gz\", \n      \"position\": [\n        32, \n        9\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"CD3_Primary_Cells_Cord_BI_Enhancers.bed.gz\", \n      \"position\": [\n        32, \n        6\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"CD3_Primary_Cells_Cord_BI_Flanking_Active_TSS.bed.gz\", \n      \"position\": [\n        32, \n        1\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"CD3_Primary_Cells_Cord_BI_Flanking_Bivalent_TSS_Enh.bed.gz\", \n      \"position\": [\n        32, \n        10\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"CD3_Primary_Cells_Cord_BI_Genic_enhancers.bed.gz\", \n      \"position\": [\n        32, \n        5\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"CD3_Primary_Cells_Cord_BI_Heterochromatin.bed.gz\", \n      \"position\": [\n        32, \n        8\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"CD3_Primary_Cells_Cord_BI_Quiescent_Low.bed.gz\", \n      \"position\": [\n        32, \n        14\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"CD3_Primary_Cells_Cord_BI_Repressed_PolyComb.bed.gz\", \n      \"position\": [\n        32, \n        12\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"CD3_Primary_Cells_Cord_BI_Strong_transcription.bed.gz\", \n      \"position\": [\n        32, \n        3\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"CD3_Primary_Cells_Cord_BI_Transcr_at_gene_5_and_3.bed.gz\", \n      \"position\": [\n        32, \n        2\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"CD3_Primary_Cells_Cord_BI_Weak_Repressed_PolyComb.bed.gz\", \n      \"position\": [\n        32, \n        13\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"CD3_Primary_Cells_Cord_BI_Weak_transcription.bed.gz\", \n      \"position\": [\n        32, \n        4\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"CD3_Primary_Cells_Cord_BI_ZNF_genes_and_repeats.bed.gz\", \n      \"position\": [\n        32, \n        7\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"CD3_Primary_Cells_Peripheral_UW_Active_TSS.bed.gz\", \n      \"position\": [\n        33, \n        0\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"CD3_Primary_Cells_Peripheral_UW_Bivalent_Enhancer.bed.gz\", \n      \"position\": [\n        33, \n        11\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"CD3_Primary_Cells_Peripheral_UW_Bivalent_Poised_TSS.bed.gz\", \n      \"position\": [\n        33, \n        9\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"CD3_Primary_Cells_Peripheral_UW_Enhancers.bed.gz\", \n      \"position\": [\n        33, \n        6\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"CD3_Primary_Cells_Peripheral_UW_Flanking_Active_TSS.bed.gz\", \n      \"position\": [\n        33, \n        1\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"CD3_Primary_Cells_Peripheral_UW_Flanking_Bivalent_TSS_Enh.bed.gz\", \n      \"position\": [\n        33, \n        10\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"CD3_Primary_Cells_Peripheral_UW_Genic_enhancers.bed.gz\", \n      \"position\": [\n        33, \n        5\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"CD3_Primary_Cells_Peripheral_UW_Heterochromatin.bed.gz\", \n      \"position\": [\n        33, \n        8\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"CD3_Primary_Cells_Peripheral_UW_Quiescent_Low.bed.gz\", \n      \"position\": [\n        33, \n        14\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"CD3_Primary_Cells_Peripheral_UW_Repressed_PolyComb.bed.gz\", \n      \"position\": [\n        33, \n        12\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"CD3_Primary_Cells_Peripheral_UW_Strong_transcription.bed.gz\", \n      \"position\": [\n        33, \n        3\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"CD3_Primary_Cells_Peripheral_UW_Transcr_at_gene_5_and_3.bed.gz\", \n      \"position\": [\n        33, \n        2\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"CD3_Primary_Cells_Peripheral_UW_Weak_Repressed_PolyComb.bed.gz\", \n      \"position\": [\n        33, \n        13\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"CD3_Primary_Cells_Peripheral_UW_Weak_transcription.bed.gz\", \n      \"position\": [\n        33, \n        4\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"CD3_Primary_Cells_Peripheral_UW_ZNF_genes_and_repeats.bed.gz\", \n      \"position\": [\n        33, \n        7\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"CD4_Memory_Primary_Cells_Active_TSS.bed.gz\", \n      \"position\": [\n        36, \n        0\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"CD4_Memory_Primary_Cells_Bivalent_Enhancer.bed.gz\", \n      \"position\": [\n        36, \n        11\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"CD4_Memory_Primary_Cells_Bivalent_Poised_TSS.bed.gz\", \n      \"position\": [\n        36, \n        9\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"CD4_Memory_Primary_Cells_Enhancers.bed.gz\", \n      \"position\": [\n        36, \n        6\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"CD4_Memory_Primary_Cells_Flanking_Active_TSS.bed.gz\", \n      \"position\": [\n        36, \n        1\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"CD4_Memory_Primary_Cells_Flanking_Bivalent_TSS_Enh.bed.gz\", \n      \"position\": [\n        36, \n        10\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"CD4_Memory_Primary_Cells_Genic_enhancers.bed.gz\", \n      \"position\": [\n        36, \n        5\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"CD4_Memory_Primary_Cells_Heterochromatin.bed.gz\", \n      \"position\": [\n        36, \n        8\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"CD4_Memory_Primary_Cells_Quiescent_Low.bed.gz\", \n      \"position\": [\n        36, \n        14\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"CD4_Memory_Primary_Cells_Repressed_PolyComb.bed.gz\", \n      \"position\": [\n        36, \n        12\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"CD4_Memory_Primary_Cells_Strong_transcription.bed.gz\", \n      \"position\": [\n        36, \n        3\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"CD4_Memory_Primary_Cells_Transcr_at_gene_5_and_3.bed.gz\", \n      \"position\": [\n        36, \n        2\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"CD4_Memory_Primary_Cells_Weak_Repressed_PolyComb.bed.gz\", \n      \"position\": [\n        36, \n        13\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"CD4_Memory_Primary_Cells_Weak_transcription.bed.gz\", \n      \"position\": [\n        36, \n        4\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"CD4_Memory_Primary_Cells_ZNF_genes_and_repeats.bed.gz\", \n      \"position\": [\n        36, \n        7\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"CD4_Naive_Primary_Cells_Active_TSS.bed.gz\", \n      \"position\": [\n        37, \n        0\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"CD4_Naive_Primary_Cells_Bivalent_Enhancer.bed.gz\", \n      \"position\": [\n        37, \n        11\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"CD4_Naive_Primary_Cells_Bivalent_Poised_TSS.bed.gz\", \n      \"position\": [\n        37, \n        9\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"CD4_Naive_Primary_Cells_Enhancers.bed.gz\", \n      \"position\": [\n        37, \n        6\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"CD4_Naive_Primary_Cells_Flanking_Active_TSS.bed.gz\", \n      \"position\": [\n        37, \n        1\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"CD4_Naive_Primary_Cells_Flanking_Bivalent_TSS_Enh.bed.gz\", \n      \"position\": [\n        37, \n        10\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"CD4_Naive_Primary_Cells_Genic_enhancers.bed.gz\", \n      \"position\": [\n        37, \n        5\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"CD4_Naive_Primary_Cells_Heterochromatin.bed.gz\", \n      \"position\": [\n        37, \n        8\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"CD4_Naive_Primary_Cells_Quiescent_Low.bed.gz\", \n      \"position\": [\n        37, \n        14\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"CD4_Naive_Primary_Cells_Repressed_PolyComb.bed.gz\", \n      \"position\": [\n        37, \n        12\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"CD4_Naive_Primary_Cells_Strong_transcription.bed.gz\", \n      \"position\": [\n        37, \n        3\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"CD4_Naive_Primary_Cells_Transcr_at_gene_5_and_3.bed.gz\", \n      \"position\": [\n        37, \n        2\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"CD4_Naive_Primary_Cells_Weak_Repressed_PolyComb.bed.gz\", \n      \"position\": [\n        37, \n        13\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"CD4_Naive_Primary_Cells_Weak_transcription.bed.gz\", \n      \"position\": [\n        37, \n        4\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"CD4_Naive_Primary_Cells_ZNF_genes_and_repeats.bed.gz\", \n      \"position\": [\n        37, \n        7\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"CD4pp_CD25__CD45RApp_Naive_Primary_Cells_Active_TSS.bed.gz\", \n      \"position\": [\n        38, \n        0\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"CD4pp_CD25__CD45RApp_Naive_Primary_Cells_Bivalent_Enhancer.bed.gz\", \n      \"position\": [\n        38, \n        11\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"CD4pp_CD25__CD45RApp_Naive_Primary_Cells_Bivalent_Poised_TSS.bed.gz\", \n      \"position\": [\n        38, \n        9\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"CD4pp_CD25__CD45RApp_Naive_Primary_Cells_Enhancers.bed.gz\", \n      \"position\": [\n        38, \n        6\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"CD4pp_CD25__CD45RApp_Naive_Primary_Cells_Flanking_Active_TSS.bed.gz\", \n      \"position\": [\n        38, \n        1\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"CD4pp_CD25__CD45RApp_Naive_Primary_Cells_Flanking_Bivalent_TSS_Enh.bed.gz\", \n      \"position\": [\n        38, \n        10\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"CD4pp_CD25__CD45RApp_Naive_Primary_Cells_Genic_enhancers.bed.gz\", \n      \"position\": [\n        38, \n        5\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"CD4pp_CD25__CD45RApp_Naive_Primary_Cells_Heterochromatin.bed.gz\", \n      \"position\": [\n        38, \n        8\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"CD4pp_CD25__CD45RApp_Naive_Primary_Cells_Quiescent_Low.bed.gz\", \n      \"position\": [\n        38, \n        14\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"CD4pp_CD25__CD45RApp_Naive_Primary_Cells_Repressed_PolyComb.bed.gz\", \n      \"position\": [\n        38, \n        12\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"CD4pp_CD25__CD45RApp_Naive_Primary_Cells_Strong_transcription.bed.gz\", \n      \"position\": [\n        38, \n        3\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"CD4pp_CD25__CD45RApp_Naive_Primary_Cells_Transcr_at_gene_5_and_3.bed.gz\", \n      \"position\": [\n        38, \n        2\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"CD4pp_CD25__CD45RApp_Naive_Primary_Cells_Weak_Repressed_PolyComb.bed.gz\", \n      \"position\": [\n        38, \n        13\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"CD4pp_CD25__CD45RApp_Naive_Primary_Cells_Weak_transcription.bed.gz\", \n      \"position\": [\n        38, \n        4\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"CD4pp_CD25__CD45RApp_Naive_Primary_Cells_ZNF_genes_and_repeats.bed.gz\", \n      \"position\": [\n        38, \n        7\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"CD4pp_CD25__CD45ROpp_Memory_Primary_Cells_Active_TSS.bed.gz\", \n      \"position\": [\n        39, \n        0\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"CD4pp_CD25__CD45ROpp_Memory_Primary_Cells_Bivalent_Enhancer.bed.gz\", \n      \"position\": [\n        39, \n        11\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"CD4pp_CD25__CD45ROpp_Memory_Primary_Cells_Bivalent_Poised_TSS.bed.gz\", \n      \"position\": [\n        39, \n        9\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"CD4pp_CD25__CD45ROpp_Memory_Primary_Cells_Enhancers.bed.gz\", \n      \"position\": [\n        39, \n        6\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"CD4pp_CD25__CD45ROpp_Memory_Primary_Cells_Flanking_Active_TSS.bed.gz\", \n      \"position\": [\n        39, \n        1\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"CD4pp_CD25__CD45ROpp_Memory_Primary_Cells_Flanking_Bivalent_TSS_Enh.bed.gz\", \n      \"position\": [\n        39, \n        10\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"CD4pp_CD25__CD45ROpp_Memory_Primary_Cells_Genic_enhancers.bed.gz\", \n      \"position\": [\n        39, \n        5\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"CD4pp_CD25__CD45ROpp_Memory_Primary_Cells_Heterochromatin.bed.gz\", \n      \"position\": [\n        39, \n        8\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"CD4pp_CD25__CD45ROpp_Memory_Primary_Cells_Quiescent_Low.bed.gz\", \n      \"position\": [\n        39, \n        14\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"CD4pp_CD25__CD45ROpp_Memory_Primary_Cells_Repressed_PolyComb.bed.gz\", \n      \"position\": [\n        39, \n        12\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"CD4pp_CD25__CD45ROpp_Memory_Primary_Cells_Strong_transcription.bed.gz\", \n      \"position\": [\n        39, \n        3\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"CD4pp_CD25__CD45ROpp_Memory_Primary_Cells_Transcr_at_gene_5_and_3.bed.gz\", \n      \"position\": [\n        39, \n        2\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"CD4pp_CD25__CD45ROpp_Memory_Primary_Cells_Weak_Repressed_PolyComb.bed.gz\", \n      \"position\": [\n        39, \n        13\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"CD4pp_CD25__CD45ROpp_Memory_Primary_Cells_Weak_transcription.bed.gz\", \n      \"position\": [\n        39, \n        4\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"CD4pp_CD25__CD45ROpp_Memory_Primary_Cells_ZNF_genes_and_repeats.bed.gz\", \n      \"position\": [\n        39, \n        7\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"CD4pp_CD25__IL17__PMA_Ionomycin_stimulated_MACS_purified_Th_Primary_Cells_Active_TSS.bed.gz\", \n      \"position\": [\n        40, \n        0\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"CD4pp_CD25__IL17__PMA_Ionomycin_stimulated_MACS_purified_Th_Primary_Cells_Bivalent_Enhancer.bed.gz\", \n      \"position\": [\n        40, \n        11\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"CD4pp_CD25__IL17__PMA_Ionomycin_stimulated_MACS_purified_Th_Primary_Cells_Bivalent_Poised_TSS.bed.gz\", \n      \"position\": [\n        40, \n        9\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"CD4pp_CD25__IL17__PMA_Ionomycin_stimulated_MACS_purified_Th_Primary_Cells_Enhancers.bed.gz\", \n      \"position\": [\n        40, \n        6\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"CD4pp_CD25__IL17__PMA_Ionomycin_stimulated_MACS_purified_Th_Primary_Cells_Flanking_Active_TSS.bed.gz\", \n      \"position\": [\n        40, \n        1\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"CD4pp_CD25__IL17__PMA_Ionomycin_stimulated_MACS_purified_Th_Primary_Cells_Flanking_Bivalent_TSS_Enh.bed.gz\", \n      \"position\": [\n        40, \n        10\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"CD4pp_CD25__IL17__PMA_Ionomycin_stimulated_MACS_purified_Th_Primary_Cells_Genic_enhancers.bed.gz\", \n      \"position\": [\n        40, \n        5\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"CD4pp_CD25__IL17__PMA_Ionomycin_stimulated_MACS_purified_Th_Primary_Cells_Heterochromatin.bed.gz\", \n      \"position\": [\n        40, \n        8\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"CD4pp_CD25__IL17__PMA_Ionomycin_stimulated_MACS_purified_Th_Primary_Cells_Quiescent_Low.bed.gz\", \n      \"position\": [\n        40, \n        14\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"CD4pp_CD25__IL17__PMA_Ionomycin_stimulated_MACS_purified_Th_Primary_Cells_Repressed_PolyComb.bed.gz\", \n      \"position\": [\n        40, \n        12\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"CD4pp_CD25__IL17__PMA_Ionomycin_stimulated_MACS_purified_Th_Primary_Cells_Strong_transcription.bed.gz\", \n      \"position\": [\n        40, \n        3\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"CD4pp_CD25__IL17__PMA_Ionomycin_stimulated_MACS_purified_Th_Primary_Cells_Transcr_at_gene_5_and_3.bed.gz\", \n      \"position\": [\n        40, \n        2\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"CD4pp_CD25__IL17__PMA_Ionomycin_stimulated_MACS_purified_Th_Primary_Cells_Weak_Repressed_PolyComb.bed.gz\", \n      \"position\": [\n        40, \n        13\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"CD4pp_CD25__IL17__PMA_Ionomycin_stimulated_MACS_purified_Th_Primary_Cells_Weak_transcription.bed.gz\", \n      \"position\": [\n        40, \n        4\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"CD4pp_CD25__IL17__PMA_Ionomycin_stimulated_MACS_purified_Th_Primary_Cells_ZNF_genes_and_repeats.bed.gz\", \n      \"position\": [\n        40, \n        7\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"CD4pp_CD25__IL17pp_PMA_Ionomcyin_stimulated_Th17_Primary_Cells_Active_TSS.bed.gz\", \n      \"position\": [\n        41, \n        0\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"CD4pp_CD25__IL17pp_PMA_Ionomcyin_stimulated_Th17_Primary_Cells_Bivalent_Enhancer.bed.gz\", \n      \"position\": [\n        41, \n        11\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"CD4pp_CD25__IL17pp_PMA_Ionomcyin_stimulated_Th17_Primary_Cells_Bivalent_Poised_TSS.bed.gz\", \n      \"position\": [\n        41, \n        9\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"CD4pp_CD25__IL17pp_PMA_Ionomcyin_stimulated_Th17_Primary_Cells_Enhancers.bed.gz\", \n      \"position\": [\n        41, \n        6\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"CD4pp_CD25__IL17pp_PMA_Ionomcyin_stimulated_Th17_Primary_Cells_Flanking_Active_TSS.bed.gz\", \n      \"position\": [\n        41, \n        1\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"CD4pp_CD25__IL17pp_PMA_Ionomcyin_stimulated_Th17_Primary_Cells_Flanking_Bivalent_TSS_Enh.bed.gz\", \n      \"position\": [\n        41, \n        10\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"CD4pp_CD25__IL17pp_PMA_Ionomcyin_stimulated_Th17_Primary_Cells_Genic_enhancers.bed.gz\", \n      \"position\": [\n        41, \n        5\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"CD4pp_CD25__IL17pp_PMA_Ionomcyin_stimulated_Th17_Primary_Cells_Heterochromatin.bed.gz\", \n      \"position\": [\n        41, \n        8\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"CD4pp_CD25__IL17pp_PMA_Ionomcyin_stimulated_Th17_Primary_Cells_Quiescent_Low.bed.gz\", \n      \"position\": [\n        41, \n        14\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"CD4pp_CD25__IL17pp_PMA_Ionomcyin_stimulated_Th17_Primary_Cells_Repressed_PolyComb.bed.gz\", \n      \"position\": [\n        41, \n        12\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"CD4pp_CD25__IL17pp_PMA_Ionomcyin_stimulated_Th17_Primary_Cells_Strong_transcription.bed.gz\", \n      \"position\": [\n        41, \n        3\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"CD4pp_CD25__IL17pp_PMA_Ionomcyin_stimulated_Th17_Primary_Cells_Transcr_at_gene_5_and_3.bed.gz\", \n      \"position\": [\n        41, \n        2\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"CD4pp_CD25__IL17pp_PMA_Ionomcyin_stimulated_Th17_Primary_Cells_Weak_Repressed_PolyComb.bed.gz\", \n      \"position\": [\n        41, \n        13\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"CD4pp_CD25__IL17pp_PMA_Ionomcyin_stimulated_Th17_Primary_Cells_Weak_transcription.bed.gz\", \n      \"position\": [\n        41, \n        4\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"CD4pp_CD25__IL17pp_PMA_Ionomcyin_stimulated_Th17_Primary_Cells_ZNF_genes_and_repeats.bed.gz\", \n      \"position\": [\n        41, \n        7\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"CD4pp_CD25__Th_Primary_Cells_Active_TSS.bed.gz\", \n      \"position\": [\n        42, \n        0\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"CD4pp_CD25__Th_Primary_Cells_Bivalent_Enhancer.bed.gz\", \n      \"position\": [\n        42, \n        11\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"CD4pp_CD25__Th_Primary_Cells_Bivalent_Poised_TSS.bed.gz\", \n      \"position\": [\n        42, \n        9\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"CD4pp_CD25__Th_Primary_Cells_Enhancers.bed.gz\", \n      \"position\": [\n        42, \n        6\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"CD4pp_CD25__Th_Primary_Cells_Flanking_Active_TSS.bed.gz\", \n      \"position\": [\n        42, \n        1\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"CD4pp_CD25__Th_Primary_Cells_Flanking_Bivalent_TSS_Enh.bed.gz\", \n      \"position\": [\n        42, \n        10\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"CD4pp_CD25__Th_Primary_Cells_Genic_enhancers.bed.gz\", \n      \"position\": [\n        42, \n        5\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"CD4pp_CD25__Th_Primary_Cells_Heterochromatin.bed.gz\", \n      \"position\": [\n        42, \n        8\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"CD4pp_CD25__Th_Primary_Cells_Quiescent_Low.bed.gz\", \n      \"position\": [\n        42, \n        14\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"CD4pp_CD25__Th_Primary_Cells_Repressed_PolyComb.bed.gz\", \n      \"position\": [\n        42, \n        12\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"CD4pp_CD25__Th_Primary_Cells_Strong_transcription.bed.gz\", \n      \"position\": [\n        42, \n        3\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"CD4pp_CD25__Th_Primary_Cells_Transcr_at_gene_5_and_3.bed.gz\", \n      \"position\": [\n        42, \n        2\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"CD4pp_CD25__Th_Primary_Cells_Weak_Repressed_PolyComb.bed.gz\", \n      \"position\": [\n        42, \n        13\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"CD4pp_CD25__Th_Primary_Cells_Weak_transcription.bed.gz\", \n      \"position\": [\n        42, \n        4\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"CD4pp_CD25__Th_Primary_Cells_ZNF_genes_and_repeats.bed.gz\", \n      \"position\": [\n        42, \n        7\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"CD4pp_CD25int_CD127pp_Tmem_Primary_Cells_Active_TSS.bed.gz\", \n      \"position\": [\n        44, \n        0\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"CD4pp_CD25int_CD127pp_Tmem_Primary_Cells_Bivalent_Enhancer.bed.gz\", \n      \"position\": [\n        44, \n        11\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"CD4pp_CD25int_CD127pp_Tmem_Primary_Cells_Bivalent_Poised_TSS.bed.gz\", \n      \"position\": [\n        44, \n        9\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"CD4pp_CD25int_CD127pp_Tmem_Primary_Cells_Enhancers.bed.gz\", \n      \"position\": [\n        44, \n        6\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"CD4pp_CD25int_CD127pp_Tmem_Primary_Cells_Flanking_Active_TSS.bed.gz\", \n      \"position\": [\n        44, \n        1\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"CD4pp_CD25int_CD127pp_Tmem_Primary_Cells_Flanking_Bivalent_TSS_Enh.bed.gz\", \n      \"position\": [\n        44, \n        10\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"CD4pp_CD25int_CD127pp_Tmem_Primary_Cells_Genic_enhancers.bed.gz\", \n      \"position\": [\n        44, \n        5\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"CD4pp_CD25int_CD127pp_Tmem_Primary_Cells_Heterochromatin.bed.gz\", \n      \"position\": [\n        44, \n        8\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"CD4pp_CD25int_CD127pp_Tmem_Primary_Cells_Quiescent_Low.bed.gz\", \n      \"position\": [\n        44, \n        14\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"CD4pp_CD25int_CD127pp_Tmem_Primary_Cells_Repressed_PolyComb.bed.gz\", \n      \"position\": [\n        44, \n        12\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"CD4pp_CD25int_CD127pp_Tmem_Primary_Cells_Strong_transcription.bed.gz\", \n      \"position\": [\n        44, \n        3\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"CD4pp_CD25int_CD127pp_Tmem_Primary_Cells_Transcr_at_gene_5_and_3.bed.gz\", \n      \"position\": [\n        44, \n        2\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"CD4pp_CD25int_CD127pp_Tmem_Primary_Cells_Weak_Repressed_PolyComb.bed.gz\", \n      \"position\": [\n        44, \n        13\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"CD4pp_CD25int_CD127pp_Tmem_Primary_Cells_Weak_transcription.bed.gz\", \n      \"position\": [\n        44, \n        4\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"CD4pp_CD25int_CD127pp_Tmem_Primary_Cells_ZNF_genes_and_repeats.bed.gz\", \n      \"position\": [\n        44, \n        7\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"CD4pp_CD25pp_CD127__Treg_Primary_Cells_Active_TSS.bed.gz\", \n      \"position\": [\n        43, \n        0\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"CD4pp_CD25pp_CD127__Treg_Primary_Cells_Bivalent_Enhancer.bed.gz\", \n      \"position\": [\n        43, \n        11\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"CD4pp_CD25pp_CD127__Treg_Primary_Cells_Bivalent_Poised_TSS.bed.gz\", \n      \"position\": [\n        43, \n        9\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"CD4pp_CD25pp_CD127__Treg_Primary_Cells_Enhancers.bed.gz\", \n      \"position\": [\n        43, \n        6\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"CD4pp_CD25pp_CD127__Treg_Primary_Cells_Flanking_Active_TSS.bed.gz\", \n      \"position\": [\n        43, \n        1\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"CD4pp_CD25pp_CD127__Treg_Primary_Cells_Flanking_Bivalent_TSS_Enh.bed.gz\", \n      \"position\": [\n        43, \n        10\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"CD4pp_CD25pp_CD127__Treg_Primary_Cells_Genic_enhancers.bed.gz\", \n      \"position\": [\n        43, \n        5\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"CD4pp_CD25pp_CD127__Treg_Primary_Cells_Heterochromatin.bed.gz\", \n      \"position\": [\n        43, \n        8\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"CD4pp_CD25pp_CD127__Treg_Primary_Cells_Quiescent_Low.bed.gz\", \n      \"position\": [\n        43, \n        14\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"CD4pp_CD25pp_CD127__Treg_Primary_Cells_Repressed_PolyComb.bed.gz\", \n      \"position\": [\n        43, \n        12\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"CD4pp_CD25pp_CD127__Treg_Primary_Cells_Strong_transcription.bed.gz\", \n      \"position\": [\n        43, \n        3\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"CD4pp_CD25pp_CD127__Treg_Primary_Cells_Transcr_at_gene_5_and_3.bed.gz\", \n      \"position\": [\n        43, \n        2\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"CD4pp_CD25pp_CD127__Treg_Primary_Cells_Weak_Repressed_PolyComb.bed.gz\", \n      \"position\": [\n        43, \n        13\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"CD4pp_CD25pp_CD127__Treg_Primary_Cells_Weak_transcription.bed.gz\", \n      \"position\": [\n        43, \n        4\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"CD4pp_CD25pp_CD127__Treg_Primary_Cells_ZNF_genes_and_repeats.bed.gz\", \n      \"position\": [\n        43, \n        7\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"CD56_Primary_Cells_Active_TSS.bed.gz\", \n      \"position\": [\n        45, \n        0\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"CD56_Primary_Cells_Bivalent_Enhancer.bed.gz\", \n      \"position\": [\n        45, \n        11\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"CD56_Primary_Cells_Bivalent_Poised_TSS.bed.gz\", \n      \"position\": [\n        45, \n        9\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"CD56_Primary_Cells_Enhancers.bed.gz\", \n      \"position\": [\n        45, \n        6\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"CD56_Primary_Cells_Flanking_Active_TSS.bed.gz\", \n      \"position\": [\n        45, \n        1\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"CD56_Primary_Cells_Flanking_Bivalent_TSS_Enh.bed.gz\", \n      \"position\": [\n        45, \n        10\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"CD56_Primary_Cells_Genic_enhancers.bed.gz\", \n      \"position\": [\n        45, \n        5\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"CD56_Primary_Cells_Heterochromatin.bed.gz\", \n      \"position\": [\n        45, \n        8\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"CD56_Primary_Cells_Quiescent_Low.bed.gz\", \n      \"position\": [\n        45, \n        14\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"CD56_Primary_Cells_Repressed_PolyComb.bed.gz\", \n      \"position\": [\n        45, \n        12\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"CD56_Primary_Cells_Strong_transcription.bed.gz\", \n      \"position\": [\n        45, \n        3\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"CD56_Primary_Cells_Transcr_at_gene_5_and_3.bed.gz\", \n      \"position\": [\n        45, \n        2\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"CD56_Primary_Cells_Weak_Repressed_PolyComb.bed.gz\", \n      \"position\": [\n        45, \n        13\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"CD56_Primary_Cells_Weak_transcription.bed.gz\", \n      \"position\": [\n        45, \n        4\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"CD56_Primary_Cells_ZNF_genes_and_repeats.bed.gz\", \n      \"position\": [\n        45, \n        7\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"CD8_Memory_Primary_Cells_Active_TSS.bed.gz\", \n      \"position\": [\n        47, \n        0\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"CD8_Memory_Primary_Cells_Bivalent_Enhancer.bed.gz\", \n      \"position\": [\n        47, \n        11\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"CD8_Memory_Primary_Cells_Bivalent_Poised_TSS.bed.gz\", \n      \"position\": [\n        47, \n        9\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"CD8_Memory_Primary_Cells_Enhancers.bed.gz\", \n      \"position\": [\n        47, \n        6\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"CD8_Memory_Primary_Cells_Flanking_Active_TSS.bed.gz\", \n      \"position\": [\n        47, \n        1\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"CD8_Memory_Primary_Cells_Flanking_Bivalent_TSS_Enh.bed.gz\", \n      \"position\": [\n        47, \n        10\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"CD8_Memory_Primary_Cells_Genic_enhancers.bed.gz\", \n      \"position\": [\n        47, \n        5\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"CD8_Memory_Primary_Cells_Heterochromatin.bed.gz\", \n      \"position\": [\n        47, \n        8\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"CD8_Memory_Primary_Cells_Quiescent_Low.bed.gz\", \n      \"position\": [\n        47, \n        14\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"CD8_Memory_Primary_Cells_Repressed_PolyComb.bed.gz\", \n      \"position\": [\n        47, \n        12\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"CD8_Memory_Primary_Cells_Strong_transcription.bed.gz\", \n      \"position\": [\n        47, \n        3\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"CD8_Memory_Primary_Cells_Transcr_at_gene_5_and_3.bed.gz\", \n      \"position\": [\n        47, \n        2\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"CD8_Memory_Primary_Cells_Weak_Repressed_PolyComb.bed.gz\", \n      \"position\": [\n        47, \n        13\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"CD8_Memory_Primary_Cells_Weak_transcription.bed.gz\", \n      \"position\": [\n        47, \n        4\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"CD8_Memory_Primary_Cells_ZNF_genes_and_repeats.bed.gz\", \n      \"position\": [\n        47, \n        7\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"CD8_Naive_Primary_Cells_Active_TSS.bed.gz\", \n      \"position\": [\n        46, \n        0\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"CD8_Naive_Primary_Cells_Bivalent_Enhancer.bed.gz\", \n      \"position\": [\n        46, \n        11\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"CD8_Naive_Primary_Cells_Bivalent_Poised_TSS.bed.gz\", \n      \"position\": [\n        46, \n        9\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"CD8_Naive_Primary_Cells_Enhancers.bed.gz\", \n      \"position\": [\n        46, \n        6\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"CD8_Naive_Primary_Cells_Flanking_Active_TSS.bed.gz\", \n      \"position\": [\n        46, \n        1\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"CD8_Naive_Primary_Cells_Flanking_Bivalent_TSS_Enh.bed.gz\", \n      \"position\": [\n        46, \n        10\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"CD8_Naive_Primary_Cells_Genic_enhancers.bed.gz\", \n      \"position\": [\n        46, \n        5\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"CD8_Naive_Primary_Cells_Heterochromatin.bed.gz\", \n      \"position\": [\n        46, \n        8\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"CD8_Naive_Primary_Cells_Quiescent_Low.bed.gz\", \n      \"position\": [\n        46, \n        14\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"CD8_Naive_Primary_Cells_Repressed_PolyComb.bed.gz\", \n      \"position\": [\n        46, \n        12\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"CD8_Naive_Primary_Cells_Strong_transcription.bed.gz\", \n      \"position\": [\n        46, \n        3\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"CD8_Naive_Primary_Cells_Transcr_at_gene_5_and_3.bed.gz\", \n      \"position\": [\n        46, \n        2\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"CD8_Naive_Primary_Cells_Weak_Repressed_PolyComb.bed.gz\", \n      \"position\": [\n        46, \n        13\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"CD8_Naive_Primary_Cells_Weak_transcription.bed.gz\", \n      \"position\": [\n        46, \n        4\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"CD8_Naive_Primary_Cells_ZNF_genes_and_repeats.bed.gz\", \n      \"position\": [\n        46, \n        7\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"Chondrocytes_from_Bone_Marrow_Derived_Mesenchymal_Stem_Cell_Cultured_Cells_Active_TSS.bed.gz\", \n      \"position\": [\n        48, \n        0\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"Chondrocytes_from_Bone_Marrow_Derived_Mesenchymal_Stem_Cell_Cultured_Cells_Bivalent_Enhancer.bed.gz\", \n      \"position\": [\n        48, \n        11\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"Chondrocytes_from_Bone_Marrow_Derived_Mesenchymal_Stem_Cell_Cultured_Cells_Bivalent_Poised_TSS.bed.gz\", \n      \"position\": [\n        48, \n        9\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"Chondrocytes_from_Bone_Marrow_Derived_Mesenchymal_Stem_Cell_Cultured_Cells_Enhancers.bed.gz\", \n      \"position\": [\n        48, \n        6\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"Chondrocytes_from_Bone_Marrow_Derived_Mesenchymal_Stem_Cell_Cultured_Cells_Flanking_Active_TSS.bed.gz\", \n      \"position\": [\n        48, \n        1\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"Chondrocytes_from_Bone_Marrow_Derived_Mesenchymal_Stem_Cell_Cultured_Cells_Flanking_Bivalent_TSS_Enh.bed.gz\", \n      \"position\": [\n        48, \n        10\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"Chondrocytes_from_Bone_Marrow_Derived_Mesenchymal_Stem_Cell_Cultured_Cells_Genic_enhancers.bed.gz\", \n      \"position\": [\n        48, \n        5\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"Chondrocytes_from_Bone_Marrow_Derived_Mesenchymal_Stem_Cell_Cultured_Cells_Heterochromatin.bed.gz\", \n      \"position\": [\n        48, \n        8\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"Chondrocytes_from_Bone_Marrow_Derived_Mesenchymal_Stem_Cell_Cultured_Cells_Quiescent_Low.bed.gz\", \n      \"position\": [\n        48, \n        14\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"Chondrocytes_from_Bone_Marrow_Derived_Mesenchymal_Stem_Cell_Cultured_Cells_Repressed_PolyComb.bed.gz\", \n      \"position\": [\n        48, \n        12\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"Chondrocytes_from_Bone_Marrow_Derived_Mesenchymal_Stem_Cell_Cultured_Cells_Strong_transcription.bed.gz\", \n      \"position\": [\n        48, \n        3\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"Chondrocytes_from_Bone_Marrow_Derived_Mesenchymal_Stem_Cell_Cultured_Cells_Transcr_at_gene_5_and_3.bed.gz\", \n      \"position\": [\n        48, \n        2\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"Chondrocytes_from_Bone_Marrow_Derived_Mesenchymal_Stem_Cell_Cultured_Cells_Weak_Repressed_PolyComb.bed.gz\", \n      \"position\": [\n        48, \n        13\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"Chondrocytes_from_Bone_Marrow_Derived_Mesenchymal_Stem_Cell_Cultured_Cells_Weak_transcription.bed.gz\", \n      \"position\": [\n        48, \n        4\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"Chondrocytes_from_Bone_Marrow_Derived_Mesenchymal_Stem_Cell_Cultured_Cells_ZNF_genes_and_repeats.bed.gz\", \n      \"position\": [\n        48, \n        7\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"Colon_Smooth_Muscle_Active_TSS.bed.gz\", \n      \"position\": [\n        73, \n        0\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"Colon_Smooth_Muscle_Bivalent_Enhancer.bed.gz\", \n      \"position\": [\n        73, \n        11\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"Colon_Smooth_Muscle_Bivalent_Poised_TSS.bed.gz\", \n      \"position\": [\n        73, \n        9\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"Colon_Smooth_Muscle_Enhancers.bed.gz\", \n      \"position\": [\n        73, \n        6\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"Colon_Smooth_Muscle_Flanking_Active_TSS.bed.gz\", \n      \"position\": [\n        73, \n        1\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"Colon_Smooth_Muscle_Flanking_Bivalent_TSS_Enh.bed.gz\", \n      \"position\": [\n        73, \n        10\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"Colon_Smooth_Muscle_Genic_enhancers.bed.gz\", \n      \"position\": [\n        73, \n        5\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"Colon_Smooth_Muscle_Heterochromatin.bed.gz\", \n      \"position\": [\n        73, \n        8\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"Colon_Smooth_Muscle_Quiescent_Low.bed.gz\", \n      \"position\": [\n        73, \n        14\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"Colon_Smooth_Muscle_Repressed_PolyComb.bed.gz\", \n      \"position\": [\n        73, \n        12\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"Colon_Smooth_Muscle_Strong_transcription.bed.gz\", \n      \"position\": [\n        73, \n        3\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"Colon_Smooth_Muscle_Transcr_at_gene_5_and_3.bed.gz\", \n      \"position\": [\n        73, \n        2\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"Colon_Smooth_Muscle_Weak_Repressed_PolyComb.bed.gz\", \n      \"position\": [\n        73, \n        13\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"Colon_Smooth_Muscle_Weak_transcription.bed.gz\", \n      \"position\": [\n        73, \n        4\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"Colon_Smooth_Muscle_ZNF_genes_and_repeats.bed.gz\", \n      \"position\": [\n        73, \n        7\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"Colonic_Mucosa_Active_TSS.bed.gz\", \n      \"position\": [\n        72, \n        0\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"Colonic_Mucosa_Bivalent_Enhancer.bed.gz\", \n      \"position\": [\n        72, \n        11\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"Colonic_Mucosa_Bivalent_Poised_TSS.bed.gz\", \n      \"position\": [\n        72, \n        9\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"Colonic_Mucosa_Enhancers.bed.gz\", \n      \"position\": [\n        72, \n        6\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"Colonic_Mucosa_Flanking_Active_TSS.bed.gz\", \n      \"position\": [\n        72, \n        1\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"Colonic_Mucosa_Flanking_Bivalent_TSS_Enh.bed.gz\", \n      \"position\": [\n        72, \n        10\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"Colonic_Mucosa_Genic_enhancers.bed.gz\", \n      \"position\": [\n        72, \n        5\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"Colonic_Mucosa_Heterochromatin.bed.gz\", \n      \"position\": [\n        72, \n        8\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"Colonic_Mucosa_Quiescent_Low.bed.gz\", \n      \"position\": [\n        72, \n        14\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"Colonic_Mucosa_Repressed_PolyComb.bed.gz\", \n      \"position\": [\n        72, \n        12\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"Colonic_Mucosa_Strong_transcription.bed.gz\", \n      \"position\": [\n        72, \n        3\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"Colonic_Mucosa_Transcr_at_gene_5_and_3.bed.gz\", \n      \"position\": [\n        72, \n        2\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"Colonic_Mucosa_Weak_Repressed_PolyComb.bed.gz\", \n      \"position\": [\n        72, \n        13\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"Colonic_Mucosa_Weak_transcription.bed.gz\", \n      \"position\": [\n        72, \n        4\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"Colonic_Mucosa_ZNF_genes_and_repeats.bed.gz\", \n      \"position\": [\n        72, \n        7\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"Dnd41_TCell_Leukemia_Active_TSS.bed.gz\", \n      \"position\": [\n        112, \n        0\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"Dnd41_TCell_Leukemia_Bivalent_Enhancer.bed.gz\", \n      \"position\": [\n        112, \n        11\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"Dnd41_TCell_Leukemia_Bivalent_Poised_TSS.bed.gz\", \n      \"position\": [\n        112, \n        9\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"Dnd41_TCell_Leukemia_Enhancers.bed.gz\", \n      \"position\": [\n        112, \n        6\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"Dnd41_TCell_Leukemia_Flanking_Active_TSS.bed.gz\", \n      \"position\": [\n        112, \n        1\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"Dnd41_TCell_Leukemia_Flanking_Bivalent_TSS_Enh.bed.gz\", \n      \"position\": [\n        112, \n        10\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"Dnd41_TCell_Leukemia_Genic_enhancers.bed.gz\", \n      \"position\": [\n        112, \n        5\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"Dnd41_TCell_Leukemia_Heterochromatin.bed.gz\", \n      \"position\": [\n        112, \n        8\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"Dnd41_TCell_Leukemia_Quiescent_Low.bed.gz\", \n      \"position\": [\n        112, \n        14\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"Dnd41_TCell_Leukemia_Repressed_PolyComb.bed.gz\", \n      \"position\": [\n        112, \n        12\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"Dnd41_TCell_Leukemia_Strong_transcription.bed.gz\", \n      \"position\": [\n        112, \n        3\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"Dnd41_TCell_Leukemia_Transcr_at_gene_5_and_3.bed.gz\", \n      \"position\": [\n        112, \n        2\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"Dnd41_TCell_Leukemia_Weak_Repressed_PolyComb.bed.gz\", \n      \"position\": [\n        112, \n        13\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"Dnd41_TCell_Leukemia_Weak_transcription.bed.gz\", \n      \"position\": [\n        112, \n        4\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"Dnd41_TCell_Leukemia_ZNF_genes_and_repeats.bed.gz\", \n      \"position\": [\n        112, \n        7\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"Duodenum_Mucosa_Active_TSS.bed.gz\", \n      \"position\": [\n        74, \n        0\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"Duodenum_Mucosa_Bivalent_Enhancer.bed.gz\", \n      \"position\": [\n        74, \n        11\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"Duodenum_Mucosa_Bivalent_Poised_TSS.bed.gz\", \n      \"position\": [\n        74, \n        9\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"Duodenum_Mucosa_Enhancers.bed.gz\", \n      \"position\": [\n        74, \n        6\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"Duodenum_Mucosa_Flanking_Active_TSS.bed.gz\", \n      \"position\": [\n        74, \n        1\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"Duodenum_Mucosa_Flanking_Bivalent_TSS_Enh.bed.gz\", \n      \"position\": [\n        74, \n        10\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"Duodenum_Mucosa_Genic_enhancers.bed.gz\", \n      \"position\": [\n        74, \n        5\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"Duodenum_Mucosa_Heterochromatin.bed.gz\", \n      \"position\": [\n        74, \n        8\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"Duodenum_Mucosa_Quiescent_Low.bed.gz\", \n      \"position\": [\n        74, \n        14\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"Duodenum_Mucosa_Repressed_PolyComb.bed.gz\", \n      \"position\": [\n        74, \n        12\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"Duodenum_Mucosa_Strong_transcription.bed.gz\", \n      \"position\": [\n        74, \n        3\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"Duodenum_Mucosa_Transcr_at_gene_5_and_3.bed.gz\", \n      \"position\": [\n        74, \n        2\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"Duodenum_Mucosa_Weak_Repressed_PolyComb.bed.gz\", \n      \"position\": [\n        74, \n        13\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"Duodenum_Mucosa_Weak_transcription.bed.gz\", \n      \"position\": [\n        74, \n        4\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"Duodenum_Mucosa_ZNF_genes_and_repeats.bed.gz\", \n      \"position\": [\n        74, \n        7\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"Duodenum_Smooth_Muscle_Active_TSS.bed.gz\", \n      \"position\": [\n        75, \n        0\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"Duodenum_Smooth_Muscle_Bivalent_Enhancer.bed.gz\", \n      \"position\": [\n        75, \n        11\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"Duodenum_Smooth_Muscle_Bivalent_Poised_TSS.bed.gz\", \n      \"position\": [\n        75, \n        9\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"Duodenum_Smooth_Muscle_Enhancers.bed.gz\", \n      \"position\": [\n        75, \n        6\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"Duodenum_Smooth_Muscle_Flanking_Active_TSS.bed.gz\", \n      \"position\": [\n        75, \n        1\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"Duodenum_Smooth_Muscle_Flanking_Bivalent_TSS_Enh.bed.gz\", \n      \"position\": [\n        75, \n        10\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"Duodenum_Smooth_Muscle_Genic_enhancers.bed.gz\", \n      \"position\": [\n        75, \n        5\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"Duodenum_Smooth_Muscle_Heterochromatin.bed.gz\", \n      \"position\": [\n        75, \n        8\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"Duodenum_Smooth_Muscle_Quiescent_Low.bed.gz\", \n      \"position\": [\n        75, \n        14\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"Duodenum_Smooth_Muscle_Repressed_PolyComb.bed.gz\", \n      \"position\": [\n        75, \n        12\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"Duodenum_Smooth_Muscle_Strong_transcription.bed.gz\", \n      \"position\": [\n        75, \n        3\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"Duodenum_Smooth_Muscle_Transcr_at_gene_5_and_3.bed.gz\", \n      \"position\": [\n        75, \n        2\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"Duodenum_Smooth_Muscle_Weak_Repressed_PolyComb.bed.gz\", \n      \"position\": [\n        75, \n        13\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"Duodenum_Smooth_Muscle_Weak_transcription.bed.gz\", \n      \"position\": [\n        75, \n        4\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"Duodenum_Smooth_Muscle_ZNF_genes_and_repeats.bed.gz\", \n      \"position\": [\n        75, \n        7\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"ES_I3_Cell_Line_Active_TSS.bed.gz\", \n      \"position\": [\n        0, \n        0\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"ES_I3_Cell_Line_Bivalent_Enhancer.bed.gz\", \n      \"position\": [\n        0, \n        11\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"ES_I3_Cell_Line_Bivalent_Poised_TSS.bed.gz\", \n      \"position\": [\n        0, \n        9\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"ES_I3_Cell_Line_Enhancers.bed.gz\", \n      \"position\": [\n        0, \n        6\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"ES_I3_Cell_Line_Flanking_Active_TSS.bed.gz\", \n      \"position\": [\n        0, \n        1\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"ES_I3_Cell_Line_Flanking_Bivalent_TSS_Enh.bed.gz\", \n      \"position\": [\n        0, \n        10\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"ES_I3_Cell_Line_Genic_enhancers.bed.gz\", \n      \"position\": [\n        0, \n        5\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"ES_I3_Cell_Line_Heterochromatin.bed.gz\", \n      \"position\": [\n        0, \n        8\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"ES_I3_Cell_Line_Quiescent_Low.bed.gz\", \n      \"position\": [\n        0, \n        14\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"ES_I3_Cell_Line_Repressed_PolyComb.bed.gz\", \n      \"position\": [\n        0, \n        12\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"ES_I3_Cell_Line_Strong_transcription.bed.gz\", \n      \"position\": [\n        0, \n        3\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"ES_I3_Cell_Line_Transcr_at_gene_5_and_3.bed.gz\", \n      \"position\": [\n        0, \n        2\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"ES_I3_Cell_Line_Weak_Repressed_PolyComb.bed.gz\", \n      \"position\": [\n        0, \n        13\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"ES_I3_Cell_Line_Weak_transcription.bed.gz\", \n      \"position\": [\n        0, \n        4\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"ES_I3_Cell_Line_ZNF_genes_and_repeats.bed.gz\", \n      \"position\": [\n        0, \n        7\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"ES_WA7_Cell_Line_Active_TSS.bed.gz\", \n      \"position\": [\n        1, \n        0\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"ES_WA7_Cell_Line_Bivalent_Enhancer.bed.gz\", \n      \"position\": [\n        1, \n        11\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"ES_WA7_Cell_Line_Bivalent_Poised_TSS.bed.gz\", \n      \"position\": [\n        1, \n        9\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"ES_WA7_Cell_Line_Enhancers.bed.gz\", \n      \"position\": [\n        1, \n        6\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"ES_WA7_Cell_Line_Flanking_Active_TSS.bed.gz\", \n      \"position\": [\n        1, \n        1\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"ES_WA7_Cell_Line_Flanking_Bivalent_TSS_Enh.bed.gz\", \n      \"position\": [\n        1, \n        10\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"ES_WA7_Cell_Line_Genic_enhancers.bed.gz\", \n      \"position\": [\n        1, \n        5\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"ES_WA7_Cell_Line_Heterochromatin.bed.gz\", \n      \"position\": [\n        1, \n        8\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"ES_WA7_Cell_Line_Quiescent_Low.bed.gz\", \n      \"position\": [\n        1, \n        14\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"ES_WA7_Cell_Line_Repressed_PolyComb.bed.gz\", \n      \"position\": [\n        1, \n        12\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"ES_WA7_Cell_Line_Strong_transcription.bed.gz\", \n      \"position\": [\n        1, \n        3\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"ES_WA7_Cell_Line_Transcr_at_gene_5_and_3.bed.gz\", \n      \"position\": [\n        1, \n        2\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"ES_WA7_Cell_Line_Weak_Repressed_PolyComb.bed.gz\", \n      \"position\": [\n        1, \n        13\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"ES_WA7_Cell_Line_Weak_transcription.bed.gz\", \n      \"position\": [\n        1, \n        4\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"ES_WA7_Cell_Line_ZNF_genes_and_repeats.bed.gz\", \n      \"position\": [\n        1, \n        7\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"Esophagus_Active_TSS.bed.gz\", \n      \"position\": [\n        76, \n        0\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"Esophagus_Bivalent_Enhancer.bed.gz\", \n      \"position\": [\n        76, \n        11\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"Esophagus_Bivalent_Poised_TSS.bed.gz\", \n      \"position\": [\n        76, \n        9\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"Esophagus_Enhancers.bed.gz\", \n      \"position\": [\n        76, \n        6\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"Esophagus_Flanking_Active_TSS.bed.gz\", \n      \"position\": [\n        76, \n        1\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"Esophagus_Flanking_Bivalent_TSS_Enh.bed.gz\", \n      \"position\": [\n        76, \n        10\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"Esophagus_Genic_enhancers.bed.gz\", \n      \"position\": [\n        76, \n        5\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"Esophagus_Heterochromatin.bed.gz\", \n      \"position\": [\n        76, \n        8\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"Esophagus_Quiescent_Low.bed.gz\", \n      \"position\": [\n        76, \n        14\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"Esophagus_Repressed_PolyComb.bed.gz\", \n      \"position\": [\n        76, \n        12\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"Esophagus_Strong_transcription.bed.gz\", \n      \"position\": [\n        76, \n        3\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"Esophagus_Transcr_at_gene_5_and_3.bed.gz\", \n      \"position\": [\n        76, \n        2\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"Esophagus_Weak_Repressed_PolyComb.bed.gz\", \n      \"position\": [\n        76, \n        13\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"Esophagus_Weak_transcription.bed.gz\", \n      \"position\": [\n        76, \n        4\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"Esophagus_ZNF_genes_and_repeats.bed.gz\", \n      \"position\": [\n        76, \n        7\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"Fetal_Adrenal_Gland_Active_TSS.bed.gz\", \n      \"position\": [\n        77, \n        0\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"Fetal_Adrenal_Gland_Bivalent_Enhancer.bed.gz\", \n      \"position\": [\n        77, \n        11\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"Fetal_Adrenal_Gland_Bivalent_Poised_TSS.bed.gz\", \n      \"position\": [\n        77, \n        9\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"Fetal_Adrenal_Gland_Enhancers.bed.gz\", \n      \"position\": [\n        77, \n        6\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"Fetal_Adrenal_Gland_Flanking_Active_TSS.bed.gz\", \n      \"position\": [\n        77, \n        1\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"Fetal_Adrenal_Gland_Flanking_Bivalent_TSS_Enh.bed.gz\", \n      \"position\": [\n        77, \n        10\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"Fetal_Adrenal_Gland_Genic_enhancers.bed.gz\", \n      \"position\": [\n        77, \n        5\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"Fetal_Adrenal_Gland_Heterochromatin.bed.gz\", \n      \"position\": [\n        77, \n        8\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"Fetal_Adrenal_Gland_Quiescent_Low.bed.gz\", \n      \"position\": [\n        77, \n        14\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"Fetal_Adrenal_Gland_Repressed_PolyComb.bed.gz\", \n      \"position\": [\n        77, \n        12\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"Fetal_Adrenal_Gland_Strong_transcription.bed.gz\", \n      \"position\": [\n        77, \n        3\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"Fetal_Adrenal_Gland_Transcr_at_gene_5_and_3.bed.gz\", \n      \"position\": [\n        77, \n        2\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"Fetal_Adrenal_Gland_Weak_Repressed_PolyComb.bed.gz\", \n      \"position\": [\n        77, \n        13\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"Fetal_Adrenal_Gland_Weak_transcription.bed.gz\", \n      \"position\": [\n        77, \n        4\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"Fetal_Adrenal_Gland_ZNF_genes_and_repeats.bed.gz\", \n      \"position\": [\n        77, \n        7\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"Fetal_Brain_Female_Active_TSS.bed.gz\", \n      \"position\": [\n        79, \n        0\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"Fetal_Brain_Female_Bivalent_Enhancer.bed.gz\", \n      \"position\": [\n        79, \n        11\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"Fetal_Brain_Female_Bivalent_Poised_TSS.bed.gz\", \n      \"position\": [\n        79, \n        9\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"Fetal_Brain_Female_Enhancers.bed.gz\", \n      \"position\": [\n        79, \n        6\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"Fetal_Brain_Female_Flanking_Active_TSS.bed.gz\", \n      \"position\": [\n        79, \n        1\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"Fetal_Brain_Female_Flanking_Bivalent_TSS_Enh.bed.gz\", \n      \"position\": [\n        79, \n        10\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"Fetal_Brain_Female_Genic_enhancers.bed.gz\", \n      \"position\": [\n        79, \n        5\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"Fetal_Brain_Female_Heterochromatin.bed.gz\", \n      \"position\": [\n        79, \n        8\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"Fetal_Brain_Female_Quiescent_Low.bed.gz\", \n      \"position\": [\n        79, \n        14\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"Fetal_Brain_Female_Repressed_PolyComb.bed.gz\", \n      \"position\": [\n        79, \n        12\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"Fetal_Brain_Female_Strong_transcription.bed.gz\", \n      \"position\": [\n        79, \n        3\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"Fetal_Brain_Female_Transcr_at_gene_5_and_3.bed.gz\", \n      \"position\": [\n        79, \n        2\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"Fetal_Brain_Female_Weak_Repressed_PolyComb.bed.gz\", \n      \"position\": [\n        79, \n        13\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"Fetal_Brain_Female_Weak_transcription.bed.gz\", \n      \"position\": [\n        79, \n        4\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"Fetal_Brain_Female_ZNF_genes_and_repeats.bed.gz\", \n      \"position\": [\n        79, \n        7\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"Fetal_Brain_Male_Active_TSS.bed.gz\", \n      \"position\": [\n        78, \n        0\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"Fetal_Brain_Male_Bivalent_Enhancer.bed.gz\", \n      \"position\": [\n        78, \n        11\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"Fetal_Brain_Male_Bivalent_Poised_TSS.bed.gz\", \n      \"position\": [\n        78, \n        9\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"Fetal_Brain_Male_Enhancers.bed.gz\", \n      \"position\": [\n        78, \n        6\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"Fetal_Brain_Male_Flanking_Active_TSS.bed.gz\", \n      \"position\": [\n        78, \n        1\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"Fetal_Brain_Male_Flanking_Bivalent_TSS_Enh.bed.gz\", \n      \"position\": [\n        78, \n        10\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"Fetal_Brain_Male_Genic_enhancers.bed.gz\", \n      \"position\": [\n        78, \n        5\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"Fetal_Brain_Male_Heterochromatin.bed.gz\", \n      \"position\": [\n        78, \n        8\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"Fetal_Brain_Male_Quiescent_Low.bed.gz\", \n      \"position\": [\n        78, \n        14\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"Fetal_Brain_Male_Repressed_PolyComb.bed.gz\", \n      \"position\": [\n        78, \n        12\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"Fetal_Brain_Male_Strong_transcription.bed.gz\", \n      \"position\": [\n        78, \n        3\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"Fetal_Brain_Male_Transcr_at_gene_5_and_3.bed.gz\", \n      \"position\": [\n        78, \n        2\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"Fetal_Brain_Male_Weak_Repressed_PolyComb.bed.gz\", \n      \"position\": [\n        78, \n        13\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"Fetal_Brain_Male_Weak_transcription.bed.gz\", \n      \"position\": [\n        78, \n        4\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"Fetal_Brain_Male_ZNF_genes_and_repeats.bed.gz\", \n      \"position\": [\n        78, \n        7\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"Fetal_Heart_Active_TSS.bed.gz\", \n      \"position\": [\n        80, \n        0\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"Fetal_Heart_Bivalent_Enhancer.bed.gz\", \n      \"position\": [\n        80, \n        11\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"Fetal_Heart_Bivalent_Poised_TSS.bed.gz\", \n      \"position\": [\n        80, \n        9\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"Fetal_Heart_Enhancers.bed.gz\", \n      \"position\": [\n        80, \n        6\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"Fetal_Heart_Flanking_Active_TSS.bed.gz\", \n      \"position\": [\n        80, \n        1\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"Fetal_Heart_Flanking_Bivalent_TSS_Enh.bed.gz\", \n      \"position\": [\n        80, \n        10\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"Fetal_Heart_Genic_enhancers.bed.gz\", \n      \"position\": [\n        80, \n        5\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"Fetal_Heart_Heterochromatin.bed.gz\", \n      \"position\": [\n        80, \n        8\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"Fetal_Heart_Quiescent_Low.bed.gz\", \n      \"position\": [\n        80, \n        14\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"Fetal_Heart_Repressed_PolyComb.bed.gz\", \n      \"position\": [\n        80, \n        12\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"Fetal_Heart_Strong_transcription.bed.gz\", \n      \"position\": [\n        80, \n        3\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"Fetal_Heart_Transcr_at_gene_5_and_3.bed.gz\", \n      \"position\": [\n        80, \n        2\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"Fetal_Heart_Weak_Repressed_PolyComb.bed.gz\", \n      \"position\": [\n        80, \n        13\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"Fetal_Heart_Weak_transcription.bed.gz\", \n      \"position\": [\n        80, \n        4\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"Fetal_Heart_ZNF_genes_and_repeats.bed.gz\", \n      \"position\": [\n        80, \n        7\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"Fetal_Intestine_Large_Active_TSS.bed.gz\", \n      \"position\": [\n        81, \n        0\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"Fetal_Intestine_Large_Bivalent_Enhancer.bed.gz\", \n      \"position\": [\n        81, \n        11\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"Fetal_Intestine_Large_Bivalent_Poised_TSS.bed.gz\", \n      \"position\": [\n        81, \n        9\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"Fetal_Intestine_Large_Enhancers.bed.gz\", \n      \"position\": [\n        81, \n        6\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"Fetal_Intestine_Large_Flanking_Active_TSS.bed.gz\", \n      \"position\": [\n        81, \n        1\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"Fetal_Intestine_Large_Flanking_Bivalent_TSS_Enh.bed.gz\", \n      \"position\": [\n        81, \n        10\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"Fetal_Intestine_Large_Genic_enhancers.bed.gz\", \n      \"position\": [\n        81, \n        5\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"Fetal_Intestine_Large_Heterochromatin.bed.gz\", \n      \"position\": [\n        81, \n        8\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"Fetal_Intestine_Large_Quiescent_Low.bed.gz\", \n      \"position\": [\n        81, \n        14\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"Fetal_Intestine_Large_Repressed_PolyComb.bed.gz\", \n      \"position\": [\n        81, \n        12\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"Fetal_Intestine_Large_Strong_transcription.bed.gz\", \n      \"position\": [\n        81, \n        3\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"Fetal_Intestine_Large_Transcr_at_gene_5_and_3.bed.gz\", \n      \"position\": [\n        81, \n        2\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"Fetal_Intestine_Large_Weak_Repressed_PolyComb.bed.gz\", \n      \"position\": [\n        81, \n        13\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"Fetal_Intestine_Large_Weak_transcription.bed.gz\", \n      \"position\": [\n        81, \n        4\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"Fetal_Intestine_Large_ZNF_genes_and_repeats.bed.gz\", \n      \"position\": [\n        81, \n        7\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"Fetal_Intestine_Small_Active_TSS.bed.gz\", \n      \"position\": [\n        82, \n        0\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"Fetal_Intestine_Small_Bivalent_Enhancer.bed.gz\", \n      \"position\": [\n        82, \n        11\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"Fetal_Intestine_Small_Bivalent_Poised_TSS.bed.gz\", \n      \"position\": [\n        82, \n        9\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"Fetal_Intestine_Small_Enhancers.bed.gz\", \n      \"position\": [\n        82, \n        6\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"Fetal_Intestine_Small_Flanking_Active_TSS.bed.gz\", \n      \"position\": [\n        82, \n        1\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"Fetal_Intestine_Small_Flanking_Bivalent_TSS_Enh.bed.gz\", \n      \"position\": [\n        82, \n        10\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"Fetal_Intestine_Small_Genic_enhancers.bed.gz\", \n      \"position\": [\n        82, \n        5\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"Fetal_Intestine_Small_Heterochromatin.bed.gz\", \n      \"position\": [\n        82, \n        8\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"Fetal_Intestine_Small_Quiescent_Low.bed.gz\", \n      \"position\": [\n        82, \n        14\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"Fetal_Intestine_Small_Repressed_PolyComb.bed.gz\", \n      \"position\": [\n        82, \n        12\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"Fetal_Intestine_Small_Strong_transcription.bed.gz\", \n      \"position\": [\n        82, \n        3\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"Fetal_Intestine_Small_Transcr_at_gene_5_and_3.bed.gz\", \n      \"position\": [\n        82, \n        2\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"Fetal_Intestine_Small_Weak_Repressed_PolyComb.bed.gz\", \n      \"position\": [\n        82, \n        13\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"Fetal_Intestine_Small_Weak_transcription.bed.gz\", \n      \"position\": [\n        82, \n        4\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"Fetal_Intestine_Small_ZNF_genes_and_repeats.bed.gz\", \n      \"position\": [\n        82, \n        7\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"Fetal_Kidney_Active_TSS.bed.gz\", \n      \"position\": [\n        83, \n        0\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"Fetal_Kidney_Bivalent_Enhancer.bed.gz\", \n      \"position\": [\n        83, \n        11\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"Fetal_Kidney_Bivalent_Poised_TSS.bed.gz\", \n      \"position\": [\n        83, \n        9\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"Fetal_Kidney_Enhancers.bed.gz\", \n      \"position\": [\n        83, \n        6\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"Fetal_Kidney_Flanking_Active_TSS.bed.gz\", \n      \"position\": [\n        83, \n        1\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"Fetal_Kidney_Flanking_Bivalent_TSS_Enh.bed.gz\", \n      \"position\": [\n        83, \n        10\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"Fetal_Kidney_Genic_enhancers.bed.gz\", \n      \"position\": [\n        83, \n        5\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"Fetal_Kidney_Heterochromatin.bed.gz\", \n      \"position\": [\n        83, \n        8\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"Fetal_Kidney_Quiescent_Low.bed.gz\", \n      \"position\": [\n        83, \n        14\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"Fetal_Kidney_Repressed_PolyComb.bed.gz\", \n      \"position\": [\n        83, \n        12\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"Fetal_Kidney_Strong_transcription.bed.gz\", \n      \"position\": [\n        83, \n        3\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"Fetal_Kidney_Transcr_at_gene_5_and_3.bed.gz\", \n      \"position\": [\n        83, \n        2\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"Fetal_Kidney_Weak_Repressed_PolyComb.bed.gz\", \n      \"position\": [\n        83, \n        13\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"Fetal_Kidney_Weak_transcription.bed.gz\", \n      \"position\": [\n        83, \n        4\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"Fetal_Kidney_ZNF_genes_and_repeats.bed.gz\", \n      \"position\": [\n        83, \n        7\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"Fetal_Lung_Active_TSS.bed.gz\", \n      \"position\": [\n        85, \n        0\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"Fetal_Lung_Bivalent_Enhancer.bed.gz\", \n      \"position\": [\n        85, \n        11\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"Fetal_Lung_Bivalent_Poised_TSS.bed.gz\", \n      \"position\": [\n        85, \n        9\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"Fetal_Lung_Enhancers.bed.gz\", \n      \"position\": [\n        85, \n        6\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"Fetal_Lung_Flanking_Active_TSS.bed.gz\", \n      \"position\": [\n        85, \n        1\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"Fetal_Lung_Flanking_Bivalent_TSS_Enh.bed.gz\", \n      \"position\": [\n        85, \n        10\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"Fetal_Lung_Genic_enhancers.bed.gz\", \n      \"position\": [\n        85, \n        5\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"Fetal_Lung_Heterochromatin.bed.gz\", \n      \"position\": [\n        85, \n        8\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"Fetal_Lung_Quiescent_Low.bed.gz\", \n      \"position\": [\n        85, \n        14\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"Fetal_Lung_Repressed_PolyComb.bed.gz\", \n      \"position\": [\n        85, \n        12\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"Fetal_Lung_Strong_transcription.bed.gz\", \n      \"position\": [\n        85, \n        3\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"Fetal_Lung_Transcr_at_gene_5_and_3.bed.gz\", \n      \"position\": [\n        85, \n        2\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"Fetal_Lung_Weak_Repressed_PolyComb.bed.gz\", \n      \"position\": [\n        85, \n        13\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"Fetal_Lung_Weak_transcription.bed.gz\", \n      \"position\": [\n        85, \n        4\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"Fetal_Lung_ZNF_genes_and_repeats.bed.gz\", \n      \"position\": [\n        85, \n        7\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"Fetal_Muscle_Leg_Active_TSS.bed.gz\", \n      \"position\": [\n        87, \n        0\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"Fetal_Muscle_Leg_Bivalent_Enhancer.bed.gz\", \n      \"position\": [\n        87, \n        11\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"Fetal_Muscle_Leg_Bivalent_Poised_TSS.bed.gz\", \n      \"position\": [\n        87, \n        9\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"Fetal_Muscle_Leg_Enhancers.bed.gz\", \n      \"position\": [\n        87, \n        6\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"Fetal_Muscle_Leg_Flanking_Active_TSS.bed.gz\", \n      \"position\": [\n        87, \n        1\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"Fetal_Muscle_Leg_Flanking_Bivalent_TSS_Enh.bed.gz\", \n      \"position\": [\n        87, \n        10\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"Fetal_Muscle_Leg_Genic_enhancers.bed.gz\", \n      \"position\": [\n        87, \n        5\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"Fetal_Muscle_Leg_Heterochromatin.bed.gz\", \n      \"position\": [\n        87, \n        8\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"Fetal_Muscle_Leg_Quiescent_Low.bed.gz\", \n      \"position\": [\n        87, \n        14\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"Fetal_Muscle_Leg_Repressed_PolyComb.bed.gz\", \n      \"position\": [\n        87, \n        12\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"Fetal_Muscle_Leg_Strong_transcription.bed.gz\", \n      \"position\": [\n        87, \n        3\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"Fetal_Muscle_Leg_Transcr_at_gene_5_and_3.bed.gz\", \n      \"position\": [\n        87, \n        2\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"Fetal_Muscle_Leg_Weak_Repressed_PolyComb.bed.gz\", \n      \"position\": [\n        87, \n        13\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"Fetal_Muscle_Leg_Weak_transcription.bed.gz\", \n      \"position\": [\n        87, \n        4\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"Fetal_Muscle_Leg_ZNF_genes_and_repeats.bed.gz\", \n      \"position\": [\n        87, \n        7\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"Fetal_Muscle_Trunk_Active_TSS.bed.gz\", \n      \"position\": [\n        86, \n        0\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"Fetal_Muscle_Trunk_Bivalent_Enhancer.bed.gz\", \n      \"position\": [\n        86, \n        11\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"Fetal_Muscle_Trunk_Bivalent_Poised_TSS.bed.gz\", \n      \"position\": [\n        86, \n        9\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"Fetal_Muscle_Trunk_Enhancers.bed.gz\", \n      \"position\": [\n        86, \n        6\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"Fetal_Muscle_Trunk_Flanking_Active_TSS.bed.gz\", \n      \"position\": [\n        86, \n        1\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"Fetal_Muscle_Trunk_Flanking_Bivalent_TSS_Enh.bed.gz\", \n      \"position\": [\n        86, \n        10\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"Fetal_Muscle_Trunk_Genic_enhancers.bed.gz\", \n      \"position\": [\n        86, \n        5\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"Fetal_Muscle_Trunk_Heterochromatin.bed.gz\", \n      \"position\": [\n        86, \n        8\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"Fetal_Muscle_Trunk_Quiescent_Low.bed.gz\", \n      \"position\": [\n        86, \n        14\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"Fetal_Muscle_Trunk_Repressed_PolyComb.bed.gz\", \n      \"position\": [\n        86, \n        12\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"Fetal_Muscle_Trunk_Strong_transcription.bed.gz\", \n      \"position\": [\n        86, \n        3\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"Fetal_Muscle_Trunk_Transcr_at_gene_5_and_3.bed.gz\", \n      \"position\": [\n        86, \n        2\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"Fetal_Muscle_Trunk_Weak_Repressed_PolyComb.bed.gz\", \n      \"position\": [\n        86, \n        13\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"Fetal_Muscle_Trunk_Weak_transcription.bed.gz\", \n      \"position\": [\n        86, \n        4\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"Fetal_Muscle_Trunk_ZNF_genes_and_repeats.bed.gz\", \n      \"position\": [\n        86, \n        7\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"Fetal_Placenta_Active_TSS.bed.gz\", \n      \"position\": [\n        88, \n        0\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"Fetal_Placenta_Bivalent_Enhancer.bed.gz\", \n      \"position\": [\n        88, \n        11\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"Fetal_Placenta_Bivalent_Poised_TSS.bed.gz\", \n      \"position\": [\n        88, \n        9\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"Fetal_Placenta_Enhancers.bed.gz\", \n      \"position\": [\n        88, \n        6\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"Fetal_Placenta_Flanking_Active_TSS.bed.gz\", \n      \"position\": [\n        88, \n        1\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"Fetal_Placenta_Flanking_Bivalent_TSS_Enh.bed.gz\", \n      \"position\": [\n        88, \n        10\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"Fetal_Placenta_Genic_enhancers.bed.gz\", \n      \"position\": [\n        88, \n        5\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"Fetal_Placenta_Heterochromatin.bed.gz\", \n      \"position\": [\n        88, \n        8\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"Fetal_Placenta_Quiescent_Low.bed.gz\", \n      \"position\": [\n        88, \n        14\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"Fetal_Placenta_Repressed_PolyComb.bed.gz\", \n      \"position\": [\n        88, \n        12\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"Fetal_Placenta_Strong_transcription.bed.gz\", \n      \"position\": [\n        88, \n        3\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"Fetal_Placenta_Transcr_at_gene_5_and_3.bed.gz\", \n      \"position\": [\n        88, \n        2\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"Fetal_Placenta_Weak_Repressed_PolyComb.bed.gz\", \n      \"position\": [\n        88, \n        13\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"Fetal_Placenta_Weak_transcription.bed.gz\", \n      \"position\": [\n        88, \n        4\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"Fetal_Placenta_ZNF_genes_and_repeats.bed.gz\", \n      \"position\": [\n        88, \n        7\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"Fetal_Stomach_Active_TSS.bed.gz\", \n      \"position\": [\n        89, \n        0\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"Fetal_Stomach_Bivalent_Enhancer.bed.gz\", \n      \"position\": [\n        89, \n        11\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"Fetal_Stomach_Bivalent_Poised_TSS.bed.gz\", \n      \"position\": [\n        89, \n        9\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"Fetal_Stomach_Enhancers.bed.gz\", \n      \"position\": [\n        89, \n        6\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"Fetal_Stomach_Flanking_Active_TSS.bed.gz\", \n      \"position\": [\n        89, \n        1\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"Fetal_Stomach_Flanking_Bivalent_TSS_Enh.bed.gz\", \n      \"position\": [\n        89, \n        10\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"Fetal_Stomach_Genic_enhancers.bed.gz\", \n      \"position\": [\n        89, \n        5\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"Fetal_Stomach_Heterochromatin.bed.gz\", \n      \"position\": [\n        89, \n        8\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"Fetal_Stomach_Quiescent_Low.bed.gz\", \n      \"position\": [\n        89, \n        14\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"Fetal_Stomach_Repressed_PolyComb.bed.gz\", \n      \"position\": [\n        89, \n        12\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"Fetal_Stomach_Strong_transcription.bed.gz\", \n      \"position\": [\n        89, \n        3\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"Fetal_Stomach_Transcr_at_gene_5_and_3.bed.gz\", \n      \"position\": [\n        89, \n        2\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"Fetal_Stomach_Weak_Repressed_PolyComb.bed.gz\", \n      \"position\": [\n        89, \n        13\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"Fetal_Stomach_Weak_transcription.bed.gz\", \n      \"position\": [\n        89, \n        4\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"Fetal_Stomach_ZNF_genes_and_repeats.bed.gz\", \n      \"position\": [\n        89, \n        7\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"Fetal_Thymus_Active_TSS.bed.gz\", \n      \"position\": [\n        90, \n        0\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"Fetal_Thymus_Bivalent_Enhancer.bed.gz\", \n      \"position\": [\n        90, \n        11\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"Fetal_Thymus_Bivalent_Poised_TSS.bed.gz\", \n      \"position\": [\n        90, \n        9\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"Fetal_Thymus_Enhancers.bed.gz\", \n      \"position\": [\n        90, \n        6\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"Fetal_Thymus_Flanking_Active_TSS.bed.gz\", \n      \"position\": [\n        90, \n        1\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"Fetal_Thymus_Flanking_Bivalent_TSS_Enh.bed.gz\", \n      \"position\": [\n        90, \n        10\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"Fetal_Thymus_Genic_enhancers.bed.gz\", \n      \"position\": [\n        90, \n        5\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"Fetal_Thymus_Heterochromatin.bed.gz\", \n      \"position\": [\n        90, \n        8\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"Fetal_Thymus_Quiescent_Low.bed.gz\", \n      \"position\": [\n        90, \n        14\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"Fetal_Thymus_Repressed_PolyComb.bed.gz\", \n      \"position\": [\n        90, \n        12\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"Fetal_Thymus_Strong_transcription.bed.gz\", \n      \"position\": [\n        90, \n        3\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"Fetal_Thymus_Transcr_at_gene_5_and_3.bed.gz\", \n      \"position\": [\n        90, \n        2\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"Fetal_Thymus_Weak_Repressed_PolyComb.bed.gz\", \n      \"position\": [\n        90, \n        13\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"Fetal_Thymus_Weak_transcription.bed.gz\", \n      \"position\": [\n        90, \n        4\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"Fetal_Thymus_ZNF_genes_and_repeats.bed.gz\", \n      \"position\": [\n        90, \n        7\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"GM12878_Lymphoblastoid_Active_TSS.bed.gz\", \n      \"position\": [\n        113, \n        0\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"GM12878_Lymphoblastoid_Bivalent_Enhancer.bed.gz\", \n      \"position\": [\n        113, \n        11\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"GM12878_Lymphoblastoid_Bivalent_Poised_TSS.bed.gz\", \n      \"position\": [\n        113, \n        9\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"GM12878_Lymphoblastoid_Enhancers.bed.gz\", \n      \"position\": [\n        113, \n        6\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"GM12878_Lymphoblastoid_Flanking_Active_TSS.bed.gz\", \n      \"position\": [\n        113, \n        1\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"GM12878_Lymphoblastoid_Flanking_Bivalent_TSS_Enh.bed.gz\", \n      \"position\": [\n        113, \n        10\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"GM12878_Lymphoblastoid_Genic_enhancers.bed.gz\", \n      \"position\": [\n        113, \n        5\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"GM12878_Lymphoblastoid_Heterochromatin.bed.gz\", \n      \"position\": [\n        113, \n        8\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"GM12878_Lymphoblastoid_Quiescent_Low.bed.gz\", \n      \"position\": [\n        113, \n        14\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"GM12878_Lymphoblastoid_Repressed_PolyComb.bed.gz\", \n      \"position\": [\n        113, \n        12\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"GM12878_Lymphoblastoid_Strong_transcription.bed.gz\", \n      \"position\": [\n        113, \n        3\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"GM12878_Lymphoblastoid_Transcr_at_gene_5_and_3.bed.gz\", \n      \"position\": [\n        113, \n        2\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"GM12878_Lymphoblastoid_Weak_Repressed_PolyComb.bed.gz\", \n      \"position\": [\n        113, \n        13\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"GM12878_Lymphoblastoid_Weak_transcription.bed.gz\", \n      \"position\": [\n        113, \n        4\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"GM12878_Lymphoblastoid_ZNF_genes_and_repeats.bed.gz\", \n      \"position\": [\n        113, \n        7\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"Gastric_Active_TSS.bed.gz\", \n      \"position\": [\n        91, \n        0\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"Gastric_Bivalent_Enhancer.bed.gz\", \n      \"position\": [\n        91, \n        11\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"Gastric_Bivalent_Poised_TSS.bed.gz\", \n      \"position\": [\n        91, \n        9\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"Gastric_Enhancers.bed.gz\", \n      \"position\": [\n        91, \n        6\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"Gastric_Flanking_Active_TSS.bed.gz\", \n      \"position\": [\n        91, \n        1\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"Gastric_Flanking_Bivalent_TSS_Enh.bed.gz\", \n      \"position\": [\n        91, \n        10\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"Gastric_Genic_enhancers.bed.gz\", \n      \"position\": [\n        91, \n        5\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"Gastric_Heterochromatin.bed.gz\", \n      \"position\": [\n        91, \n        8\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"Gastric_Quiescent_Low.bed.gz\", \n      \"position\": [\n        91, \n        14\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"Gastric_Repressed_PolyComb.bed.gz\", \n      \"position\": [\n        91, \n        12\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"Gastric_Strong_transcription.bed.gz\", \n      \"position\": [\n        91, \n        3\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"Gastric_Transcr_at_gene_5_and_3.bed.gz\", \n      \"position\": [\n        91, \n        2\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"Gastric_Weak_Repressed_PolyComb.bed.gz\", \n      \"position\": [\n        91, \n        13\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"Gastric_Weak_transcription.bed.gz\", \n      \"position\": [\n        91, \n        4\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"Gastric_ZNF_genes_and_repeats.bed.gz\", \n      \"position\": [\n        91, \n        7\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"H1_BMP4_Derived_Mesendoderm_Cultured_Cells_Active_TSS.bed.gz\", \n      \"position\": [\n        3, \n        0\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"H1_BMP4_Derived_Mesendoderm_Cultured_Cells_Bivalent_Enhancer.bed.gz\", \n      \"position\": [\n        3, \n        11\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"H1_BMP4_Derived_Mesendoderm_Cultured_Cells_Bivalent_Poised_TSS.bed.gz\", \n      \"position\": [\n        3, \n        9\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"H1_BMP4_Derived_Mesendoderm_Cultured_Cells_Enhancers.bed.gz\", \n      \"position\": [\n        3, \n        6\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"H1_BMP4_Derived_Mesendoderm_Cultured_Cells_Flanking_Active_TSS.bed.gz\", \n      \"position\": [\n        3, \n        1\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"H1_BMP4_Derived_Mesendoderm_Cultured_Cells_Flanking_Bivalent_TSS_Enh.bed.gz\", \n      \"position\": [\n        3, \n        10\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"H1_BMP4_Derived_Mesendoderm_Cultured_Cells_Genic_enhancers.bed.gz\", \n      \"position\": [\n        3, \n        5\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"H1_BMP4_Derived_Mesendoderm_Cultured_Cells_Heterochromatin.bed.gz\", \n      \"position\": [\n        3, \n        8\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"H1_BMP4_Derived_Mesendoderm_Cultured_Cells_Quiescent_Low.bed.gz\", \n      \"position\": [\n        3, \n        14\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"H1_BMP4_Derived_Mesendoderm_Cultured_Cells_Repressed_PolyComb.bed.gz\", \n      \"position\": [\n        3, \n        12\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"H1_BMP4_Derived_Mesendoderm_Cultured_Cells_Strong_transcription.bed.gz\", \n      \"position\": [\n        3, \n        3\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"H1_BMP4_Derived_Mesendoderm_Cultured_Cells_Transcr_at_gene_5_and_3.bed.gz\", \n      \"position\": [\n        3, \n        2\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"H1_BMP4_Derived_Mesendoderm_Cultured_Cells_Weak_Repressed_PolyComb.bed.gz\", \n      \"position\": [\n        3, \n        13\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"H1_BMP4_Derived_Mesendoderm_Cultured_Cells_Weak_transcription.bed.gz\", \n      \"position\": [\n        3, \n        4\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"H1_BMP4_Derived_Mesendoderm_Cultured_Cells_ZNF_genes_and_repeats.bed.gz\", \n      \"position\": [\n        3, \n        7\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"H1_BMP4_Derived_Trophoblast_Cultured_Cells_Active_TSS.bed.gz\", \n      \"position\": [\n        4, \n        0\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"H1_BMP4_Derived_Trophoblast_Cultured_Cells_Bivalent_Enhancer.bed.gz\", \n      \"position\": [\n        4, \n        11\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"H1_BMP4_Derived_Trophoblast_Cultured_Cells_Bivalent_Poised_TSS.bed.gz\", \n      \"position\": [\n        4, \n        9\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"H1_BMP4_Derived_Trophoblast_Cultured_Cells_Enhancers.bed.gz\", \n      \"position\": [\n        4, \n        6\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"H1_BMP4_Derived_Trophoblast_Cultured_Cells_Flanking_Active_TSS.bed.gz\", \n      \"position\": [\n        4, \n        1\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"H1_BMP4_Derived_Trophoblast_Cultured_Cells_Flanking_Bivalent_TSS_Enh.bed.gz\", \n      \"position\": [\n        4, \n        10\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"H1_BMP4_Derived_Trophoblast_Cultured_Cells_Genic_enhancers.bed.gz\", \n      \"position\": [\n        4, \n        5\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"H1_BMP4_Derived_Trophoblast_Cultured_Cells_Heterochromatin.bed.gz\", \n      \"position\": [\n        4, \n        8\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"H1_BMP4_Derived_Trophoblast_Cultured_Cells_Quiescent_Low.bed.gz\", \n      \"position\": [\n        4, \n        14\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"H1_BMP4_Derived_Trophoblast_Cultured_Cells_Repressed_PolyComb.bed.gz\", \n      \"position\": [\n        4, \n        12\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"H1_BMP4_Derived_Trophoblast_Cultured_Cells_Strong_transcription.bed.gz\", \n      \"position\": [\n        4, \n        3\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"H1_BMP4_Derived_Trophoblast_Cultured_Cells_Transcr_at_gene_5_and_3.bed.gz\", \n      \"position\": [\n        4, \n        2\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"H1_BMP4_Derived_Trophoblast_Cultured_Cells_Weak_Repressed_PolyComb.bed.gz\", \n      \"position\": [\n        4, \n        13\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"H1_BMP4_Derived_Trophoblast_Cultured_Cells_Weak_transcription.bed.gz\", \n      \"position\": [\n        4, \n        4\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"H1_BMP4_Derived_Trophoblast_Cultured_Cells_ZNF_genes_and_repeats.bed.gz\", \n      \"position\": [\n        4, \n        7\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"H1_Cell_Line_Active_TSS.bed.gz\", \n      \"position\": [\n        2, \n        0\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"H1_Cell_Line_Bivalent_Enhancer.bed.gz\", \n      \"position\": [\n        2, \n        11\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"H1_Cell_Line_Bivalent_Poised_TSS.bed.gz\", \n      \"position\": [\n        2, \n        9\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"H1_Cell_Line_Enhancers.bed.gz\", \n      \"position\": [\n        2, \n        6\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"H1_Cell_Line_Flanking_Active_TSS.bed.gz\", \n      \"position\": [\n        2, \n        1\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"H1_Cell_Line_Flanking_Bivalent_TSS_Enh.bed.gz\", \n      \"position\": [\n        2, \n        10\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"H1_Cell_Line_Genic_enhancers.bed.gz\", \n      \"position\": [\n        2, \n        5\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"H1_Cell_Line_Heterochromatin.bed.gz\", \n      \"position\": [\n        2, \n        8\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"H1_Cell_Line_Quiescent_Low.bed.gz\", \n      \"position\": [\n        2, \n        14\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"H1_Cell_Line_Repressed_PolyComb.bed.gz\", \n      \"position\": [\n        2, \n        12\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"H1_Cell_Line_Strong_transcription.bed.gz\", \n      \"position\": [\n        2, \n        3\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"H1_Cell_Line_Transcr_at_gene_5_and_3.bed.gz\", \n      \"position\": [\n        2, \n        2\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"H1_Cell_Line_Weak_Repressed_PolyComb.bed.gz\", \n      \"position\": [\n        2, \n        13\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"H1_Cell_Line_Weak_transcription.bed.gz\", \n      \"position\": [\n        2, \n        4\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"H1_Cell_Line_ZNF_genes_and_repeats.bed.gz\", \n      \"position\": [\n        2, \n        7\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"H1_Derived_Mesenchymal_Stem_Cells_Active_TSS.bed.gz\", \n      \"position\": [\n        5, \n        0\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"H1_Derived_Mesenchymal_Stem_Cells_Bivalent_Enhancer.bed.gz\", \n      \"position\": [\n        5, \n        11\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"H1_Derived_Mesenchymal_Stem_Cells_Bivalent_Poised_TSS.bed.gz\", \n      \"position\": [\n        5, \n        9\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"H1_Derived_Mesenchymal_Stem_Cells_Enhancers.bed.gz\", \n      \"position\": [\n        5, \n        6\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"H1_Derived_Mesenchymal_Stem_Cells_Flanking_Active_TSS.bed.gz\", \n      \"position\": [\n        5, \n        1\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"H1_Derived_Mesenchymal_Stem_Cells_Flanking_Bivalent_TSS_Enh.bed.gz\", \n      \"position\": [\n        5, \n        10\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"H1_Derived_Mesenchymal_Stem_Cells_Genic_enhancers.bed.gz\", \n      \"position\": [\n        5, \n        5\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"H1_Derived_Mesenchymal_Stem_Cells_Heterochromatin.bed.gz\", \n      \"position\": [\n        5, \n        8\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"H1_Derived_Mesenchymal_Stem_Cells_Quiescent_Low.bed.gz\", \n      \"position\": [\n        5, \n        14\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"H1_Derived_Mesenchymal_Stem_Cells_Repressed_PolyComb.bed.gz\", \n      \"position\": [\n        5, \n        12\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"H1_Derived_Mesenchymal_Stem_Cells_Strong_transcription.bed.gz\", \n      \"position\": [\n        5, \n        3\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"H1_Derived_Mesenchymal_Stem_Cells_Transcr_at_gene_5_and_3.bed.gz\", \n      \"position\": [\n        5, \n        2\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"H1_Derived_Mesenchymal_Stem_Cells_Weak_Repressed_PolyComb.bed.gz\", \n      \"position\": [\n        5, \n        13\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"H1_Derived_Mesenchymal_Stem_Cells_Weak_transcription.bed.gz\", \n      \"position\": [\n        5, \n        4\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"H1_Derived_Mesenchymal_Stem_Cells_ZNF_genes_and_repeats.bed.gz\", \n      \"position\": [\n        5, \n        7\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"H1_Derived_Neuronal_Progenitor_Cultured_Cells_Active_TSS.bed.gz\", \n      \"position\": [\n        6, \n        0\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"H1_Derived_Neuronal_Progenitor_Cultured_Cells_Bivalent_Enhancer.bed.gz\", \n      \"position\": [\n        6, \n        11\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"H1_Derived_Neuronal_Progenitor_Cultured_Cells_Bivalent_Poised_TSS.bed.gz\", \n      \"position\": [\n        6, \n        9\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"H1_Derived_Neuronal_Progenitor_Cultured_Cells_Enhancers.bed.gz\", \n      \"position\": [\n        6, \n        6\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"H1_Derived_Neuronal_Progenitor_Cultured_Cells_Flanking_Active_TSS.bed.gz\", \n      \"position\": [\n        6, \n        1\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"H1_Derived_Neuronal_Progenitor_Cultured_Cells_Flanking_Bivalent_TSS_Enh.bed.gz\", \n      \"position\": [\n        6, \n        10\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"H1_Derived_Neuronal_Progenitor_Cultured_Cells_Genic_enhancers.bed.gz\", \n      \"position\": [\n        6, \n        5\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"H1_Derived_Neuronal_Progenitor_Cultured_Cells_Heterochromatin.bed.gz\", \n      \"position\": [\n        6, \n        8\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"H1_Derived_Neuronal_Progenitor_Cultured_Cells_Quiescent_Low.bed.gz\", \n      \"position\": [\n        6, \n        14\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"H1_Derived_Neuronal_Progenitor_Cultured_Cells_Repressed_PolyComb.bed.gz\", \n      \"position\": [\n        6, \n        12\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"H1_Derived_Neuronal_Progenitor_Cultured_Cells_Strong_transcription.bed.gz\", \n      \"position\": [\n        6, \n        3\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"H1_Derived_Neuronal_Progenitor_Cultured_Cells_Transcr_at_gene_5_and_3.bed.gz\", \n      \"position\": [\n        6, \n        2\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"H1_Derived_Neuronal_Progenitor_Cultured_Cells_Weak_Repressed_PolyComb.bed.gz\", \n      \"position\": [\n        6, \n        13\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"H1_Derived_Neuronal_Progenitor_Cultured_Cells_Weak_transcription.bed.gz\", \n      \"position\": [\n        6, \n        4\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"H1_Derived_Neuronal_Progenitor_Cultured_Cells_ZNF_genes_and_repeats.bed.gz\", \n      \"position\": [\n        6, \n        7\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"H9_Cell_Line_Active_TSS.bed.gz\", \n      \"position\": [\n        7, \n        0\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"H9_Cell_Line_Bivalent_Enhancer.bed.gz\", \n      \"position\": [\n        7, \n        11\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"H9_Cell_Line_Bivalent_Poised_TSS.bed.gz\", \n      \"position\": [\n        7, \n        9\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"H9_Cell_Line_Enhancers.bed.gz\", \n      \"position\": [\n        7, \n        6\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"H9_Cell_Line_Flanking_Active_TSS.bed.gz\", \n      \"position\": [\n        7, \n        1\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"H9_Cell_Line_Flanking_Bivalent_TSS_Enh.bed.gz\", \n      \"position\": [\n        7, \n        10\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"H9_Cell_Line_Genic_enhancers.bed.gz\", \n      \"position\": [\n        7, \n        5\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"H9_Cell_Line_Heterochromatin.bed.gz\", \n      \"position\": [\n        7, \n        8\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"H9_Cell_Line_Quiescent_Low.bed.gz\", \n      \"position\": [\n        7, \n        14\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"H9_Cell_Line_Repressed_PolyComb.bed.gz\", \n      \"position\": [\n        7, \n        12\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"H9_Cell_Line_Strong_transcription.bed.gz\", \n      \"position\": [\n        7, \n        3\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"H9_Cell_Line_Transcr_at_gene_5_and_3.bed.gz\", \n      \"position\": [\n        7, \n        2\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"H9_Cell_Line_Weak_Repressed_PolyComb.bed.gz\", \n      \"position\": [\n        7, \n        13\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"H9_Cell_Line_Weak_transcription.bed.gz\", \n      \"position\": [\n        7, \n        4\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"H9_Cell_Line_ZNF_genes_and_repeats.bed.gz\", \n      \"position\": [\n        7, \n        7\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"H9_Derived_Neuron_Cultured_Cells_Active_TSS.bed.gz\", \n      \"position\": [\n        9, \n        0\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"H9_Derived_Neuron_Cultured_Cells_Bivalent_Enhancer.bed.gz\", \n      \"position\": [\n        9, \n        11\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"H9_Derived_Neuron_Cultured_Cells_Bivalent_Poised_TSS.bed.gz\", \n      \"position\": [\n        9, \n        9\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"H9_Derived_Neuron_Cultured_Cells_Enhancers.bed.gz\", \n      \"position\": [\n        9, \n        6\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"H9_Derived_Neuron_Cultured_Cells_Flanking_Active_TSS.bed.gz\", \n      \"position\": [\n        9, \n        1\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"H9_Derived_Neuron_Cultured_Cells_Flanking_Bivalent_TSS_Enh.bed.gz\", \n      \"position\": [\n        9, \n        10\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"H9_Derived_Neuron_Cultured_Cells_Genic_enhancers.bed.gz\", \n      \"position\": [\n        9, \n        5\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"H9_Derived_Neuron_Cultured_Cells_Heterochromatin.bed.gz\", \n      \"position\": [\n        9, \n        8\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"H9_Derived_Neuron_Cultured_Cells_Quiescent_Low.bed.gz\", \n      \"position\": [\n        9, \n        14\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"H9_Derived_Neuron_Cultured_Cells_Repressed_PolyComb.bed.gz\", \n      \"position\": [\n        9, \n        12\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"H9_Derived_Neuron_Cultured_Cells_Strong_transcription.bed.gz\", \n      \"position\": [\n        9, \n        3\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"H9_Derived_Neuron_Cultured_Cells_Transcr_at_gene_5_and_3.bed.gz\", \n      \"position\": [\n        9, \n        2\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"H9_Derived_Neuron_Cultured_Cells_Weak_Repressed_PolyComb.bed.gz\", \n      \"position\": [\n        9, \n        13\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"H9_Derived_Neuron_Cultured_Cells_Weak_transcription.bed.gz\", \n      \"position\": [\n        9, \n        4\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"H9_Derived_Neuron_Cultured_Cells_ZNF_genes_and_repeats.bed.gz\", \n      \"position\": [\n        9, \n        7\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"H9_Derived_Neuronal_Progenitor_Cultured_Cells_Active_TSS.bed.gz\", \n      \"position\": [\n        8, \n        0\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"H9_Derived_Neuronal_Progenitor_Cultured_Cells_Bivalent_Enhancer.bed.gz\", \n      \"position\": [\n        8, \n        11\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"H9_Derived_Neuronal_Progenitor_Cultured_Cells_Bivalent_Poised_TSS.bed.gz\", \n      \"position\": [\n        8, \n        9\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"H9_Derived_Neuronal_Progenitor_Cultured_Cells_Enhancers.bed.gz\", \n      \"position\": [\n        8, \n        6\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"H9_Derived_Neuronal_Progenitor_Cultured_Cells_Flanking_Active_TSS.bed.gz\", \n      \"position\": [\n        8, \n        1\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"H9_Derived_Neuronal_Progenitor_Cultured_Cells_Flanking_Bivalent_TSS_Enh.bed.gz\", \n      \"position\": [\n        8, \n        10\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"H9_Derived_Neuronal_Progenitor_Cultured_Cells_Genic_enhancers.bed.gz\", \n      \"position\": [\n        8, \n        5\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"H9_Derived_Neuronal_Progenitor_Cultured_Cells_Heterochromatin.bed.gz\", \n      \"position\": [\n        8, \n        8\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"H9_Derived_Neuronal_Progenitor_Cultured_Cells_Quiescent_Low.bed.gz\", \n      \"position\": [\n        8, \n        14\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"H9_Derived_Neuronal_Progenitor_Cultured_Cells_Repressed_PolyComb.bed.gz\", \n      \"position\": [\n        8, \n        12\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"H9_Derived_Neuronal_Progenitor_Cultured_Cells_Strong_transcription.bed.gz\", \n      \"position\": [\n        8, \n        3\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"H9_Derived_Neuronal_Progenitor_Cultured_Cells_Transcr_at_gene_5_and_3.bed.gz\", \n      \"position\": [\n        8, \n        2\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"H9_Derived_Neuronal_Progenitor_Cultured_Cells_Weak_Repressed_PolyComb.bed.gz\", \n      \"position\": [\n        8, \n        13\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"H9_Derived_Neuronal_Progenitor_Cultured_Cells_Weak_transcription.bed.gz\", \n      \"position\": [\n        8, \n        4\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"H9_Derived_Neuronal_Progenitor_Cultured_Cells_ZNF_genes_and_repeats.bed.gz\", \n      \"position\": [\n        8, \n        7\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"HMEC_Mammary_Epithelial_Active_TSS.bed.gz\", \n      \"position\": [\n        116, \n        0\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"HMEC_Mammary_Epithelial_Bivalent_Enhancer.bed.gz\", \n      \"position\": [\n        116, \n        11\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"HMEC_Mammary_Epithelial_Bivalent_Poised_TSS.bed.gz\", \n      \"position\": [\n        116, \n        9\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"HMEC_Mammary_Epithelial_Enhancers.bed.gz\", \n      \"position\": [\n        116, \n        6\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"HMEC_Mammary_Epithelial_Flanking_Active_TSS.bed.gz\", \n      \"position\": [\n        116, \n        1\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"HMEC_Mammary_Epithelial_Flanking_Bivalent_TSS_Enh.bed.gz\", \n      \"position\": [\n        116, \n        10\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"HMEC_Mammary_Epithelial_Genic_enhancers.bed.gz\", \n      \"position\": [\n        116, \n        5\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"HMEC_Mammary_Epithelial_Heterochromatin.bed.gz\", \n      \"position\": [\n        116, \n        8\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"HMEC_Mammary_Epithelial_Quiescent_Low.bed.gz\", \n      \"position\": [\n        116, \n        14\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"HMEC_Mammary_Epithelial_Repressed_PolyComb.bed.gz\", \n      \"position\": [\n        116, \n        12\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"HMEC_Mammary_Epithelial_Strong_transcription.bed.gz\", \n      \"position\": [\n        116, \n        3\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"HMEC_Mammary_Epithelial_Transcr_at_gene_5_and_3.bed.gz\", \n      \"position\": [\n        116, \n        2\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"HMEC_Mammary_Epithelial_Weak_Repressed_PolyComb.bed.gz\", \n      \"position\": [\n        116, \n        13\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"HMEC_Mammary_Epithelial_Weak_transcription.bed.gz\", \n      \"position\": [\n        116, \n        4\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"HMEC_Mammary_Epithelial_ZNF_genes_and_repeats.bed.gz\", \n      \"position\": [\n        116, \n        7\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"HSMM_Skeletal_Muscle_Myoblasts_Active_TSS.bed.gz\", \n      \"position\": [\n        117, \n        0\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"HSMM_Skeletal_Muscle_Myoblasts_Bivalent_Enhancer.bed.gz\", \n      \"position\": [\n        117, \n        11\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"HSMM_Skeletal_Muscle_Myoblasts_Bivalent_Poised_TSS.bed.gz\", \n      \"position\": [\n        117, \n        9\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"HSMM_Skeletal_Muscle_Myoblasts_Enhancers.bed.gz\", \n      \"position\": [\n        117, \n        6\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"HSMM_Skeletal_Muscle_Myoblasts_Flanking_Active_TSS.bed.gz\", \n      \"position\": [\n        117, \n        1\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"HSMM_Skeletal_Muscle_Myoblasts_Flanking_Bivalent_TSS_Enh.bed.gz\", \n      \"position\": [\n        117, \n        10\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"HSMM_Skeletal_Muscle_Myoblasts_Genic_enhancers.bed.gz\", \n      \"position\": [\n        117, \n        5\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"HSMM_Skeletal_Muscle_Myoblasts_Heterochromatin.bed.gz\", \n      \"position\": [\n        117, \n        8\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"HSMM_Skeletal_Muscle_Myoblasts_Quiescent_Low.bed.gz\", \n      \"position\": [\n        117, \n        14\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"HSMM_Skeletal_Muscle_Myoblasts_Repressed_PolyComb.bed.gz\", \n      \"position\": [\n        117, \n        12\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"HSMM_Skeletal_Muscle_Myoblasts_Strong_transcription.bed.gz\", \n      \"position\": [\n        117, \n        3\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"HSMM_Skeletal_Muscle_Myoblasts_Transcr_at_gene_5_and_3.bed.gz\", \n      \"position\": [\n        117, \n        2\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"HSMM_Skeletal_Muscle_Myoblasts_Weak_Repressed_PolyComb.bed.gz\", \n      \"position\": [\n        117, \n        13\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"HSMM_Skeletal_Muscle_Myoblasts_Weak_transcription.bed.gz\", \n      \"position\": [\n        117, \n        4\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"HSMM_Skeletal_Muscle_Myoblasts_ZNF_genes_and_repeats.bed.gz\", \n      \"position\": [\n        117, \n        7\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"HSMMtube_Skeletal_Muscle_Myotubes_Derived_from_HSMM_Active_TSS.bed.gz\", \n      \"position\": [\n        118, \n        0\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"HSMMtube_Skeletal_Muscle_Myotubes_Derived_from_HSMM_Bivalent_Enhancer.bed.gz\", \n      \"position\": [\n        118, \n        11\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"HSMMtube_Skeletal_Muscle_Myotubes_Derived_from_HSMM_Bivalent_Poised_TSS.bed.gz\", \n      \"position\": [\n        118, \n        9\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"HSMMtube_Skeletal_Muscle_Myotubes_Derived_from_HSMM_Enhancers.bed.gz\", \n      \"position\": [\n        118, \n        6\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"HSMMtube_Skeletal_Muscle_Myotubes_Derived_from_HSMM_Flanking_Active_TSS.bed.gz\", \n      \"position\": [\n        118, \n        1\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"HSMMtube_Skeletal_Muscle_Myotubes_Derived_from_HSMM_Flanking_Bivalent_TSS_Enh.bed.gz\", \n      \"position\": [\n        118, \n        10\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"HSMMtube_Skeletal_Muscle_Myotubes_Derived_from_HSMM_Genic_enhancers.bed.gz\", \n      \"position\": [\n        118, \n        5\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"HSMMtube_Skeletal_Muscle_Myotubes_Derived_from_HSMM_Heterochromatin.bed.gz\", \n      \"position\": [\n        118, \n        8\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"HSMMtube_Skeletal_Muscle_Myotubes_Derived_from_HSMM_Quiescent_Low.bed.gz\", \n      \"position\": [\n        118, \n        14\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"HSMMtube_Skeletal_Muscle_Myotubes_Derived_from_HSMM_Repressed_PolyComb.bed.gz\", \n      \"position\": [\n        118, \n        12\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"HSMMtube_Skeletal_Muscle_Myotubes_Derived_from_HSMM_Strong_transcription.bed.gz\", \n      \"position\": [\n        118, \n        3\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"HSMMtube_Skeletal_Muscle_Myotubes_Derived_from_HSMM_Transcr_at_gene_5_and_3.bed.gz\", \n      \"position\": [\n        118, \n        2\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"HSMMtube_Skeletal_Muscle_Myotubes_Derived_from_HSMM_Weak_Repressed_PolyComb.bed.gz\", \n      \"position\": [\n        118, \n        13\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"HSMMtube_Skeletal_Muscle_Myotubes_Derived_from_HSMM_Weak_transcription.bed.gz\", \n      \"position\": [\n        118, \n        4\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"HSMMtube_Skeletal_Muscle_Myotubes_Derived_from_HSMM_ZNF_genes_and_repeats.bed.gz\", \n      \"position\": [\n        118, \n        7\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"HUES48_Cell_Line_Active_TSS.bed.gz\", \n      \"position\": [\n        13, \n        0\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"HUES48_Cell_Line_Bivalent_Enhancer.bed.gz\", \n      \"position\": [\n        13, \n        11\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"HUES48_Cell_Line_Bivalent_Poised_TSS.bed.gz\", \n      \"position\": [\n        13, \n        9\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"HUES48_Cell_Line_Enhancers.bed.gz\", \n      \"position\": [\n        13, \n        6\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"HUES48_Cell_Line_Flanking_Active_TSS.bed.gz\", \n      \"position\": [\n        13, \n        1\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"HUES48_Cell_Line_Flanking_Bivalent_TSS_Enh.bed.gz\", \n      \"position\": [\n        13, \n        10\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"HUES48_Cell_Line_Genic_enhancers.bed.gz\", \n      \"position\": [\n        13, \n        5\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"HUES48_Cell_Line_Heterochromatin.bed.gz\", \n      \"position\": [\n        13, \n        8\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"HUES48_Cell_Line_Quiescent_Low.bed.gz\", \n      \"position\": [\n        13, \n        14\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"HUES48_Cell_Line_Repressed_PolyComb.bed.gz\", \n      \"position\": [\n        13, \n        12\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"HUES48_Cell_Line_Strong_transcription.bed.gz\", \n      \"position\": [\n        13, \n        3\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"HUES48_Cell_Line_Transcr_at_gene_5_and_3.bed.gz\", \n      \"position\": [\n        13, \n        2\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"HUES48_Cell_Line_Weak_Repressed_PolyComb.bed.gz\", \n      \"position\": [\n        13, \n        13\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"HUES48_Cell_Line_Weak_transcription.bed.gz\", \n      \"position\": [\n        13, \n        4\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"HUES48_Cell_Line_ZNF_genes_and_repeats.bed.gz\", \n      \"position\": [\n        13, \n        7\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"HUES64_Cell_Line_Active_TSS.bed.gz\", \n      \"position\": [\n        15, \n        0\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"HUES64_Cell_Line_Bivalent_Enhancer.bed.gz\", \n      \"position\": [\n        15, \n        11\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"HUES64_Cell_Line_Bivalent_Poised_TSS.bed.gz\", \n      \"position\": [\n        15, \n        9\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"HUES64_Cell_Line_Enhancers.bed.gz\", \n      \"position\": [\n        15, \n        6\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"HUES64_Cell_Line_Flanking_Active_TSS.bed.gz\", \n      \"position\": [\n        15, \n        1\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"HUES64_Cell_Line_Flanking_Bivalent_TSS_Enh.bed.gz\", \n      \"position\": [\n        15, \n        10\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"HUES64_Cell_Line_Genic_enhancers.bed.gz\", \n      \"position\": [\n        15, \n        5\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"HUES64_Cell_Line_Heterochromatin.bed.gz\", \n      \"position\": [\n        15, \n        8\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"HUES64_Cell_Line_Quiescent_Low.bed.gz\", \n      \"position\": [\n        15, \n        14\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"HUES64_Cell_Line_Repressed_PolyComb.bed.gz\", \n      \"position\": [\n        15, \n        12\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"HUES64_Cell_Line_Strong_transcription.bed.gz\", \n      \"position\": [\n        15, \n        3\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"HUES64_Cell_Line_Transcr_at_gene_5_and_3.bed.gz\", \n      \"position\": [\n        15, \n        2\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"HUES64_Cell_Line_Weak_Repressed_PolyComb.bed.gz\", \n      \"position\": [\n        15, \n        13\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"HUES64_Cell_Line_Weak_transcription.bed.gz\", \n      \"position\": [\n        15, \n        4\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"HUES64_Cell_Line_ZNF_genes_and_repeats.bed.gz\", \n      \"position\": [\n        15, \n        7\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"HUES6_Cell_Line_Active_TSS.bed.gz\", \n      \"position\": [\n        14, \n        0\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"HUES6_Cell_Line_Bivalent_Enhancer.bed.gz\", \n      \"position\": [\n        14, \n        11\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"HUES6_Cell_Line_Bivalent_Poised_TSS.bed.gz\", \n      \"position\": [\n        14, \n        9\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"HUES6_Cell_Line_Enhancers.bed.gz\", \n      \"position\": [\n        14, \n        6\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"HUES6_Cell_Line_Flanking_Active_TSS.bed.gz\", \n      \"position\": [\n        14, \n        1\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"HUES6_Cell_Line_Flanking_Bivalent_TSS_Enh.bed.gz\", \n      \"position\": [\n        14, \n        10\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"HUES6_Cell_Line_Genic_enhancers.bed.gz\", \n      \"position\": [\n        14, \n        5\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"HUES6_Cell_Line_Heterochromatin.bed.gz\", \n      \"position\": [\n        14, \n        8\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"HUES6_Cell_Line_Quiescent_Low.bed.gz\", \n      \"position\": [\n        14, \n        14\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"HUES6_Cell_Line_Repressed_PolyComb.bed.gz\", \n      \"position\": [\n        14, \n        12\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"HUES6_Cell_Line_Strong_transcription.bed.gz\", \n      \"position\": [\n        14, \n        3\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"HUES6_Cell_Line_Transcr_at_gene_5_and_3.bed.gz\", \n      \"position\": [\n        14, \n        2\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"HUES6_Cell_Line_Weak_Repressed_PolyComb.bed.gz\", \n      \"position\": [\n        14, \n        13\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"HUES6_Cell_Line_Weak_transcription.bed.gz\", \n      \"position\": [\n        14, \n        4\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"HUES6_Cell_Line_ZNF_genes_and_repeats.bed.gz\", \n      \"position\": [\n        14, \n        7\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"HUVEC_Umbilical_Vein_Endothelial_Cells_Active_TSS.bed.gz\", \n      \"position\": [\n        119, \n        0\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"HUVEC_Umbilical_Vein_Endothelial_Cells_Bivalent_Enhancer.bed.gz\", \n      \"position\": [\n        119, \n        11\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"HUVEC_Umbilical_Vein_Endothelial_Cells_Bivalent_Poised_TSS.bed.gz\", \n      \"position\": [\n        119, \n        9\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"HUVEC_Umbilical_Vein_Endothelial_Cells_Enhancers.bed.gz\", \n      \"position\": [\n        119, \n        6\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"HUVEC_Umbilical_Vein_Endothelial_Cells_Flanking_Active_TSS.bed.gz\", \n      \"position\": [\n        119, \n        1\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"HUVEC_Umbilical_Vein_Endothelial_Cells_Flanking_Bivalent_TSS_Enh.bed.gz\", \n      \"position\": [\n        119, \n        10\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"HUVEC_Umbilical_Vein_Endothelial_Cells_Genic_enhancers.bed.gz\", \n      \"position\": [\n        119, \n        5\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"HUVEC_Umbilical_Vein_Endothelial_Cells_Heterochromatin.bed.gz\", \n      \"position\": [\n        119, \n        8\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"HUVEC_Umbilical_Vein_Endothelial_Cells_Quiescent_Low.bed.gz\", \n      \"position\": [\n        119, \n        14\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"HUVEC_Umbilical_Vein_Endothelial_Cells_Repressed_PolyComb.bed.gz\", \n      \"position\": [\n        119, \n        12\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"HUVEC_Umbilical_Vein_Endothelial_Cells_Strong_transcription.bed.gz\", \n      \"position\": [\n        119, \n        3\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"HUVEC_Umbilical_Vein_Endothelial_Cells_Transcr_at_gene_5_and_3.bed.gz\", \n      \"position\": [\n        119, \n        2\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"HUVEC_Umbilical_Vein_Endothelial_Cells_Weak_Repressed_PolyComb.bed.gz\", \n      \"position\": [\n        119, \n        13\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"HUVEC_Umbilical_Vein_Endothelial_Cells_Weak_transcription.bed.gz\", \n      \"position\": [\n        119, \n        4\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"HUVEC_Umbilical_Vein_Endothelial_Cells_ZNF_genes_and_repeats.bed.gz\", \n      \"position\": [\n        119, \n        7\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"HeLa_S3_Cervical_Carcinoma_Active_TSS.bed.gz\", \n      \"position\": [\n        114, \n        0\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"HeLa_S3_Cervical_Carcinoma_Bivalent_Enhancer.bed.gz\", \n      \"position\": [\n        114, \n        11\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"HeLa_S3_Cervical_Carcinoma_Bivalent_Poised_TSS.bed.gz\", \n      \"position\": [\n        114, \n        9\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"HeLa_S3_Cervical_Carcinoma_Enhancers.bed.gz\", \n      \"position\": [\n        114, \n        6\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"HeLa_S3_Cervical_Carcinoma_Flanking_Active_TSS.bed.gz\", \n      \"position\": [\n        114, \n        1\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"HeLa_S3_Cervical_Carcinoma_Flanking_Bivalent_TSS_Enh.bed.gz\", \n      \"position\": [\n        114, \n        10\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"HeLa_S3_Cervical_Carcinoma_Genic_enhancers.bed.gz\", \n      \"position\": [\n        114, \n        5\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"HeLa_S3_Cervical_Carcinoma_Heterochromatin.bed.gz\", \n      \"position\": [\n        114, \n        8\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"HeLa_S3_Cervical_Carcinoma_Quiescent_Low.bed.gz\", \n      \"position\": [\n        114, \n        14\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"HeLa_S3_Cervical_Carcinoma_Repressed_PolyComb.bed.gz\", \n      \"position\": [\n        114, \n        12\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"HeLa_S3_Cervical_Carcinoma_Strong_transcription.bed.gz\", \n      \"position\": [\n        114, \n        3\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"HeLa_S3_Cervical_Carcinoma_Transcr_at_gene_5_and_3.bed.gz\", \n      \"position\": [\n        114, \n        2\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"HeLa_S3_Cervical_Carcinoma_Weak_Repressed_PolyComb.bed.gz\", \n      \"position\": [\n        114, \n        13\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"HeLa_S3_Cervical_Carcinoma_Weak_transcription.bed.gz\", \n      \"position\": [\n        114, \n        4\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"HeLa_S3_Cervical_Carcinoma_ZNF_genes_and_repeats.bed.gz\", \n      \"position\": [\n        114, \n        7\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"HepG2_Hepatocellular_Carcinoma_Active_TSS.bed.gz\", \n      \"position\": [\n        115, \n        0\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"HepG2_Hepatocellular_Carcinoma_Bivalent_Enhancer.bed.gz\", \n      \"position\": [\n        115, \n        11\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"HepG2_Hepatocellular_Carcinoma_Bivalent_Poised_TSS.bed.gz\", \n      \"position\": [\n        115, \n        9\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"HepG2_Hepatocellular_Carcinoma_Enhancers.bed.gz\", \n      \"position\": [\n        115, \n        6\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"HepG2_Hepatocellular_Carcinoma_Flanking_Active_TSS.bed.gz\", \n      \"position\": [\n        115, \n        1\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"HepG2_Hepatocellular_Carcinoma_Flanking_Bivalent_TSS_Enh.bed.gz\", \n      \"position\": [\n        115, \n        10\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"HepG2_Hepatocellular_Carcinoma_Genic_enhancers.bed.gz\", \n      \"position\": [\n        115, \n        5\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"HepG2_Hepatocellular_Carcinoma_Heterochromatin.bed.gz\", \n      \"position\": [\n        115, \n        8\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"HepG2_Hepatocellular_Carcinoma_Quiescent_Low.bed.gz\", \n      \"position\": [\n        115, \n        14\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"HepG2_Hepatocellular_Carcinoma_Repressed_PolyComb.bed.gz\", \n      \"position\": [\n        115, \n        12\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"HepG2_Hepatocellular_Carcinoma_Strong_transcription.bed.gz\", \n      \"position\": [\n        115, \n        3\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"HepG2_Hepatocellular_Carcinoma_Transcr_at_gene_5_and_3.bed.gz\", \n      \"position\": [\n        115, \n        2\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"HepG2_Hepatocellular_Carcinoma_Weak_Repressed_PolyComb.bed.gz\", \n      \"position\": [\n        115, \n        13\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"HepG2_Hepatocellular_Carcinoma_Weak_transcription.bed.gz\", \n      \"position\": [\n        115, \n        4\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"HepG2_Hepatocellular_Carcinoma_ZNF_genes_and_repeats.bed.gz\", \n      \"position\": [\n        115, \n        7\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"IMR90_Cell_Line_Active_TSS.bed.gz\", \n      \"position\": [\n        16, \n        0\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"IMR90_Cell_Line_Bivalent_Enhancer.bed.gz\", \n      \"position\": [\n        16, \n        11\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"IMR90_Cell_Line_Bivalent_Poised_TSS.bed.gz\", \n      \"position\": [\n        16, \n        9\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"IMR90_Cell_Line_Enhancers.bed.gz\", \n      \"position\": [\n        16, \n        6\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"IMR90_Cell_Line_Flanking_Active_TSS.bed.gz\", \n      \"position\": [\n        16, \n        1\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"IMR90_Cell_Line_Flanking_Bivalent_TSS_Enh.bed.gz\", \n      \"position\": [\n        16, \n        10\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"IMR90_Cell_Line_Genic_enhancers.bed.gz\", \n      \"position\": [\n        16, \n        5\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"IMR90_Cell_Line_Heterochromatin.bed.gz\", \n      \"position\": [\n        16, \n        8\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"IMR90_Cell_Line_Quiescent_Low.bed.gz\", \n      \"position\": [\n        16, \n        14\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"IMR90_Cell_Line_Repressed_PolyComb.bed.gz\", \n      \"position\": [\n        16, \n        12\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"IMR90_Cell_Line_Strong_transcription.bed.gz\", \n      \"position\": [\n        16, \n        3\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"IMR90_Cell_Line_Transcr_at_gene_5_and_3.bed.gz\", \n      \"position\": [\n        16, \n        2\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"IMR90_Cell_Line_Weak_Repressed_PolyComb.bed.gz\", \n      \"position\": [\n        16, \n        13\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"IMR90_Cell_Line_Weak_transcription.bed.gz\", \n      \"position\": [\n        16, \n        4\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"IMR90_Cell_Line_ZNF_genes_and_repeats.bed.gz\", \n      \"position\": [\n        16, \n        7\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"K562_Leukemia_Active_TSS.bed.gz\", \n      \"position\": [\n        120, \n        0\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"K562_Leukemia_Bivalent_Enhancer.bed.gz\", \n      \"position\": [\n        120, \n        11\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"K562_Leukemia_Bivalent_Poised_TSS.bed.gz\", \n      \"position\": [\n        120, \n        9\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"K562_Leukemia_Enhancers.bed.gz\", \n      \"position\": [\n        120, \n        6\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"K562_Leukemia_Flanking_Active_TSS.bed.gz\", \n      \"position\": [\n        120, \n        1\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"K562_Leukemia_Flanking_Bivalent_TSS_Enh.bed.gz\", \n      \"position\": [\n        120, \n        10\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"K562_Leukemia_Genic_enhancers.bed.gz\", \n      \"position\": [\n        120, \n        5\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"K562_Leukemia_Heterochromatin.bed.gz\", \n      \"position\": [\n        120, \n        8\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"K562_Leukemia_Quiescent_Low.bed.gz\", \n      \"position\": [\n        120, \n        14\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"K562_Leukemia_Repressed_PolyComb.bed.gz\", \n      \"position\": [\n        120, \n        12\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"K562_Leukemia_Strong_transcription.bed.gz\", \n      \"position\": [\n        120, \n        3\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"K562_Leukemia_Transcr_at_gene_5_and_3.bed.gz\", \n      \"position\": [\n        120, \n        2\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"K562_Leukemia_Weak_Repressed_PolyComb.bed.gz\", \n      \"position\": [\n        120, \n        13\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"K562_Leukemia_Weak_transcription.bed.gz\", \n      \"position\": [\n        120, \n        4\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"K562_Leukemia_ZNF_genes_and_repeats.bed.gz\", \n      \"position\": [\n        120, \n        7\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"Left_Ventricle_Active_TSS.bed.gz\", \n      \"position\": [\n        92, \n        0\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"Left_Ventricle_Bivalent_Enhancer.bed.gz\", \n      \"position\": [\n        92, \n        11\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"Left_Ventricle_Bivalent_Poised_TSS.bed.gz\", \n      \"position\": [\n        92, \n        9\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"Left_Ventricle_Enhancers.bed.gz\", \n      \"position\": [\n        92, \n        6\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"Left_Ventricle_Flanking_Active_TSS.bed.gz\", \n      \"position\": [\n        92, \n        1\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"Left_Ventricle_Flanking_Bivalent_TSS_Enh.bed.gz\", \n      \"position\": [\n        92, \n        10\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"Left_Ventricle_Genic_enhancers.bed.gz\", \n      \"position\": [\n        92, \n        5\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"Left_Ventricle_Heterochromatin.bed.gz\", \n      \"position\": [\n        92, \n        8\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"Left_Ventricle_Quiescent_Low.bed.gz\", \n      \"position\": [\n        92, \n        14\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"Left_Ventricle_Repressed_PolyComb.bed.gz\", \n      \"position\": [\n        92, \n        12\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"Left_Ventricle_Strong_transcription.bed.gz\", \n      \"position\": [\n        92, \n        3\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"Left_Ventricle_Transcr_at_gene_5_and_3.bed.gz\", \n      \"position\": [\n        92, \n        2\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"Left_Ventricle_Weak_Repressed_PolyComb.bed.gz\", \n      \"position\": [\n        92, \n        13\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"Left_Ventricle_Weak_transcription.bed.gz\", \n      \"position\": [\n        92, \n        4\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"Left_Ventricle_ZNF_genes_and_repeats.bed.gz\", \n      \"position\": [\n        92, \n        7\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"Lung_Active_TSS.bed.gz\", \n      \"position\": [\n        93, \n        0\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"Lung_Bivalent_Enhancer.bed.gz\", \n      \"position\": [\n        93, \n        11\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"Lung_Bivalent_Poised_TSS.bed.gz\", \n      \"position\": [\n        93, \n        9\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"Lung_Enhancers.bed.gz\", \n      \"position\": [\n        93, \n        6\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"Lung_Flanking_Active_TSS.bed.gz\", \n      \"position\": [\n        93, \n        1\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"Lung_Flanking_Bivalent_TSS_Enh.bed.gz\", \n      \"position\": [\n        93, \n        10\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"Lung_Genic_enhancers.bed.gz\", \n      \"position\": [\n        93, \n        5\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"Lung_Heterochromatin.bed.gz\", \n      \"position\": [\n        93, \n        8\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"Lung_Quiescent_Low.bed.gz\", \n      \"position\": [\n        93, \n        14\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"Lung_Repressed_PolyComb.bed.gz\", \n      \"position\": [\n        93, \n        12\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"Lung_Strong_transcription.bed.gz\", \n      \"position\": [\n        93, \n        3\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"Lung_Transcr_at_gene_5_and_3.bed.gz\", \n      \"position\": [\n        93, \n        2\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"Lung_Weak_Repressed_PolyComb.bed.gz\", \n      \"position\": [\n        93, \n        13\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"Lung_Weak_transcription.bed.gz\", \n      \"position\": [\n        93, \n        4\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"Lung_ZNF_genes_and_repeats.bed.gz\", \n      \"position\": [\n        93, \n        7\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"Mesenchymal_Stem_Cell_Derived_Adipocyte_Cultured_Cells_Active_TSS.bed.gz\", \n      \"position\": [\n        22, \n        0\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"Mesenchymal_Stem_Cell_Derived_Adipocyte_Cultured_Cells_Bivalent_Enhancer.bed.gz\", \n      \"position\": [\n        22, \n        11\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"Mesenchymal_Stem_Cell_Derived_Adipocyte_Cultured_Cells_Bivalent_Poised_TSS.bed.gz\", \n      \"position\": [\n        22, \n        9\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"Mesenchymal_Stem_Cell_Derived_Adipocyte_Cultured_Cells_Enhancers.bed.gz\", \n      \"position\": [\n        22, \n        6\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"Mesenchymal_Stem_Cell_Derived_Adipocyte_Cultured_Cells_Flanking_Active_TSS.bed.gz\", \n      \"position\": [\n        22, \n        1\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"Mesenchymal_Stem_Cell_Derived_Adipocyte_Cultured_Cells_Flanking_Bivalent_TSS_Enh.bed.gz\", \n      \"position\": [\n        22, \n        10\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"Mesenchymal_Stem_Cell_Derived_Adipocyte_Cultured_Cells_Genic_enhancers.bed.gz\", \n      \"position\": [\n        22, \n        5\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"Mesenchymal_Stem_Cell_Derived_Adipocyte_Cultured_Cells_Heterochromatin.bed.gz\", \n      \"position\": [\n        22, \n        8\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"Mesenchymal_Stem_Cell_Derived_Adipocyte_Cultured_Cells_Quiescent_Low.bed.gz\", \n      \"position\": [\n        22, \n        14\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"Mesenchymal_Stem_Cell_Derived_Adipocyte_Cultured_Cells_Repressed_PolyComb.bed.gz\", \n      \"position\": [\n        22, \n        12\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"Mesenchymal_Stem_Cell_Derived_Adipocyte_Cultured_Cells_Strong_transcription.bed.gz\", \n      \"position\": [\n        22, \n        3\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"Mesenchymal_Stem_Cell_Derived_Adipocyte_Cultured_Cells_Transcr_at_gene_5_and_3.bed.gz\", \n      \"position\": [\n        22, \n        2\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"Mesenchymal_Stem_Cell_Derived_Adipocyte_Cultured_Cells_Weak_Repressed_PolyComb.bed.gz\", \n      \"position\": [\n        22, \n        13\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"Mesenchymal_Stem_Cell_Derived_Adipocyte_Cultured_Cells_Weak_transcription.bed.gz\", \n      \"position\": [\n        22, \n        4\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"Mesenchymal_Stem_Cell_Derived_Adipocyte_Cultured_Cells_ZNF_genes_and_repeats.bed.gz\", \n      \"position\": [\n        22, \n        7\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"Mobilized_CD34_Primary_Cells_Female_Active_TSS.bed.gz\", \n      \"position\": [\n        49, \n        0\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"Mobilized_CD34_Primary_Cells_Female_Bivalent_Enhancer.bed.gz\", \n      \"position\": [\n        49, \n        11\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"Mobilized_CD34_Primary_Cells_Female_Bivalent_Poised_TSS.bed.gz\", \n      \"position\": [\n        49, \n        9\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"Mobilized_CD34_Primary_Cells_Female_Enhancers.bed.gz\", \n      \"position\": [\n        49, \n        6\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"Mobilized_CD34_Primary_Cells_Female_Flanking_Active_TSS.bed.gz\", \n      \"position\": [\n        49, \n        1\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"Mobilized_CD34_Primary_Cells_Female_Flanking_Bivalent_TSS_Enh.bed.gz\", \n      \"position\": [\n        49, \n        10\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"Mobilized_CD34_Primary_Cells_Female_Genic_enhancers.bed.gz\", \n      \"position\": [\n        49, \n        5\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"Mobilized_CD34_Primary_Cells_Female_Heterochromatin.bed.gz\", \n      \"position\": [\n        49, \n        8\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"Mobilized_CD34_Primary_Cells_Female_Quiescent_Low.bed.gz\", \n      \"position\": [\n        49, \n        14\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"Mobilized_CD34_Primary_Cells_Female_Repressed_PolyComb.bed.gz\", \n      \"position\": [\n        49, \n        12\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"Mobilized_CD34_Primary_Cells_Female_Strong_transcription.bed.gz\", \n      \"position\": [\n        49, \n        3\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"Mobilized_CD34_Primary_Cells_Female_Transcr_at_gene_5_and_3.bed.gz\", \n      \"position\": [\n        49, \n        2\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"Mobilized_CD34_Primary_Cells_Female_Weak_Repressed_PolyComb.bed.gz\", \n      \"position\": [\n        49, \n        13\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"Mobilized_CD34_Primary_Cells_Female_Weak_transcription.bed.gz\", \n      \"position\": [\n        49, \n        4\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"Mobilized_CD34_Primary_Cells_Female_ZNF_genes_and_repeats.bed.gz\", \n      \"position\": [\n        49, \n        7\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"Mobilized_CD34_Primary_Cells_Male_Active_TSS.bed.gz\", \n      \"position\": [\n        50, \n        0\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"Mobilized_CD34_Primary_Cells_Male_Bivalent_Enhancer.bed.gz\", \n      \"position\": [\n        50, \n        11\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"Mobilized_CD34_Primary_Cells_Male_Bivalent_Poised_TSS.bed.gz\", \n      \"position\": [\n        50, \n        9\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"Mobilized_CD34_Primary_Cells_Male_Enhancers.bed.gz\", \n      \"position\": [\n        50, \n        6\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"Mobilized_CD34_Primary_Cells_Male_Flanking_Active_TSS.bed.gz\", \n      \"position\": [\n        50, \n        1\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"Mobilized_CD34_Primary_Cells_Male_Flanking_Bivalent_TSS_Enh.bed.gz\", \n      \"position\": [\n        50, \n        10\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"Mobilized_CD34_Primary_Cells_Male_Genic_enhancers.bed.gz\", \n      \"position\": [\n        50, \n        5\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"Mobilized_CD34_Primary_Cells_Male_Heterochromatin.bed.gz\", \n      \"position\": [\n        50, \n        8\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"Mobilized_CD34_Primary_Cells_Male_Quiescent_Low.bed.gz\", \n      \"position\": [\n        50, \n        14\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"Mobilized_CD34_Primary_Cells_Male_Repressed_PolyComb.bed.gz\", \n      \"position\": [\n        50, \n        12\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"Mobilized_CD34_Primary_Cells_Male_Strong_transcription.bed.gz\", \n      \"position\": [\n        50, \n        3\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"Mobilized_CD34_Primary_Cells_Male_Transcr_at_gene_5_and_3.bed.gz\", \n      \"position\": [\n        50, \n        2\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"Mobilized_CD34_Primary_Cells_Male_Weak_Repressed_PolyComb.bed.gz\", \n      \"position\": [\n        50, \n        13\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"Mobilized_CD34_Primary_Cells_Male_Weak_transcription.bed.gz\", \n      \"position\": [\n        50, \n        4\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"Mobilized_CD34_Primary_Cells_Male_ZNF_genes_and_repeats.bed.gz\", \n      \"position\": [\n        50, \n        7\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"Monocytes_CD14pp_RO01746_Active_TSS.bed.gz\", \n      \"position\": [\n        121, \n        0\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"Monocytes_CD14pp_RO01746_Bivalent_Enhancer.bed.gz\", \n      \"position\": [\n        121, \n        11\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"Monocytes_CD14pp_RO01746_Bivalent_Poised_TSS.bed.gz\", \n      \"position\": [\n        121, \n        9\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"Monocytes_CD14pp_RO01746_Enhancers.bed.gz\", \n      \"position\": [\n        121, \n        6\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"Monocytes_CD14pp_RO01746_Flanking_Active_TSS.bed.gz\", \n      \"position\": [\n        121, \n        1\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"Monocytes_CD14pp_RO01746_Flanking_Bivalent_TSS_Enh.bed.gz\", \n      \"position\": [\n        121, \n        10\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"Monocytes_CD14pp_RO01746_Genic_enhancers.bed.gz\", \n      \"position\": [\n        121, \n        5\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"Monocytes_CD14pp_RO01746_Heterochromatin.bed.gz\", \n      \"position\": [\n        121, \n        8\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"Monocytes_CD14pp_RO01746_Quiescent_Low.bed.gz\", \n      \"position\": [\n        121, \n        14\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"Monocytes_CD14pp_RO01746_Repressed_PolyComb.bed.gz\", \n      \"position\": [\n        121, \n        12\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"Monocytes_CD14pp_RO01746_Strong_transcription.bed.gz\", \n      \"position\": [\n        121, \n        3\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"Monocytes_CD14pp_RO01746_Transcr_at_gene_5_and_3.bed.gz\", \n      \"position\": [\n        121, \n        2\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"Monocytes_CD14pp_RO01746_Weak_Repressed_PolyComb.bed.gz\", \n      \"position\": [\n        121, \n        13\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"Monocytes_CD14pp_RO01746_Weak_transcription.bed.gz\", \n      \"position\": [\n        121, \n        4\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"Monocytes_CD14pp_RO01746_ZNF_genes_and_repeats.bed.gz\", \n      \"position\": [\n        121, \n        7\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"Muscle_Satellite_Cultured_Cells_Active_TSS.bed.gz\", \n      \"position\": [\n        51, \n        0\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"Muscle_Satellite_Cultured_Cells_Bivalent_Enhancer.bed.gz\", \n      \"position\": [\n        51, \n        11\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"Muscle_Satellite_Cultured_Cells_Bivalent_Poised_TSS.bed.gz\", \n      \"position\": [\n        51, \n        9\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"Muscle_Satellite_Cultured_Cells_Enhancers.bed.gz\", \n      \"position\": [\n        51, \n        6\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"Muscle_Satellite_Cultured_Cells_Flanking_Active_TSS.bed.gz\", \n      \"position\": [\n        51, \n        1\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"Muscle_Satellite_Cultured_Cells_Flanking_Bivalent_TSS_Enh.bed.gz\", \n      \"position\": [\n        51, \n        10\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"Muscle_Satellite_Cultured_Cells_Genic_enhancers.bed.gz\", \n      \"position\": [\n        51, \n        5\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"Muscle_Satellite_Cultured_Cells_Heterochromatin.bed.gz\", \n      \"position\": [\n        51, \n        8\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"Muscle_Satellite_Cultured_Cells_Quiescent_Low.bed.gz\", \n      \"position\": [\n        51, \n        14\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"Muscle_Satellite_Cultured_Cells_Repressed_PolyComb.bed.gz\", \n      \"position\": [\n        51, \n        12\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"Muscle_Satellite_Cultured_Cells_Strong_transcription.bed.gz\", \n      \"position\": [\n        51, \n        3\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"Muscle_Satellite_Cultured_Cells_Transcr_at_gene_5_and_3.bed.gz\", \n      \"position\": [\n        51, \n        2\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"Muscle_Satellite_Cultured_Cells_Weak_Repressed_PolyComb.bed.gz\", \n      \"position\": [\n        51, \n        13\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"Muscle_Satellite_Cultured_Cells_Weak_transcription.bed.gz\", \n      \"position\": [\n        51, \n        4\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"Muscle_Satellite_Cultured_Cells_ZNF_genes_and_repeats.bed.gz\", \n      \"position\": [\n        51, \n        7\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"NHDF_Ad_Adult_Dermal_Fibroblasts_Active_TSS.bed.gz\", \n      \"position\": [\n        123, \n        0\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"NHDF_Ad_Adult_Dermal_Fibroblasts_Bivalent_Enhancer.bed.gz\", \n      \"position\": [\n        123, \n        11\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"NHDF_Ad_Adult_Dermal_Fibroblasts_Bivalent_Poised_TSS.bed.gz\", \n      \"position\": [\n        123, \n        9\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"NHDF_Ad_Adult_Dermal_Fibroblasts_Enhancers.bed.gz\", \n      \"position\": [\n        123, \n        6\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"NHDF_Ad_Adult_Dermal_Fibroblasts_Flanking_Active_TSS.bed.gz\", \n      \"position\": [\n        123, \n        1\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"NHDF_Ad_Adult_Dermal_Fibroblasts_Flanking_Bivalent_TSS_Enh.bed.gz\", \n      \"position\": [\n        123, \n        10\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"NHDF_Ad_Adult_Dermal_Fibroblasts_Genic_enhancers.bed.gz\", \n      \"position\": [\n        123, \n        5\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"NHDF_Ad_Adult_Dermal_Fibroblasts_Heterochromatin.bed.gz\", \n      \"position\": [\n        123, \n        8\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"NHDF_Ad_Adult_Dermal_Fibroblasts_Quiescent_Low.bed.gz\", \n      \"position\": [\n        123, \n        14\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"NHDF_Ad_Adult_Dermal_Fibroblasts_Repressed_PolyComb.bed.gz\", \n      \"position\": [\n        123, \n        12\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"NHDF_Ad_Adult_Dermal_Fibroblasts_Strong_transcription.bed.gz\", \n      \"position\": [\n        123, \n        3\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"NHDF_Ad_Adult_Dermal_Fibroblasts_Transcr_at_gene_5_and_3.bed.gz\", \n      \"position\": [\n        123, \n        2\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"NHDF_Ad_Adult_Dermal_Fibroblasts_Weak_Repressed_PolyComb.bed.gz\", \n      \"position\": [\n        123, \n        13\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"NHDF_Ad_Adult_Dermal_Fibroblasts_Weak_transcription.bed.gz\", \n      \"position\": [\n        123, \n        4\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"NHDF_Ad_Adult_Dermal_Fibroblasts_ZNF_genes_and_repeats.bed.gz\", \n      \"position\": [\n        123, \n        7\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"NHEK_Epidermal_Keratinocytes_Active_TSS.bed.gz\", \n      \"position\": [\n        124, \n        0\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"NHEK_Epidermal_Keratinocytes_Bivalent_Enhancer.bed.gz\", \n      \"position\": [\n        124, \n        11\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"NHEK_Epidermal_Keratinocytes_Bivalent_Poised_TSS.bed.gz\", \n      \"position\": [\n        124, \n        9\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"NHEK_Epidermal_Keratinocytes_Enhancers.bed.gz\", \n      \"position\": [\n        124, \n        6\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"NHEK_Epidermal_Keratinocytes_Flanking_Active_TSS.bed.gz\", \n      \"position\": [\n        124, \n        1\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"NHEK_Epidermal_Keratinocytes_Flanking_Bivalent_TSS_Enh.bed.gz\", \n      \"position\": [\n        124, \n        10\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"NHEK_Epidermal_Keratinocytes_Genic_enhancers.bed.gz\", \n      \"position\": [\n        124, \n        5\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"NHEK_Epidermal_Keratinocytes_Heterochromatin.bed.gz\", \n      \"position\": [\n        124, \n        8\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"NHEK_Epidermal_Keratinocytes_Quiescent_Low.bed.gz\", \n      \"position\": [\n        124, \n        14\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"NHEK_Epidermal_Keratinocytes_Repressed_PolyComb.bed.gz\", \n      \"position\": [\n        124, \n        12\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"NHEK_Epidermal_Keratinocytes_Strong_transcription.bed.gz\", \n      \"position\": [\n        124, \n        3\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"NHEK_Epidermal_Keratinocytes_Transcr_at_gene_5_and_3.bed.gz\", \n      \"position\": [\n        124, \n        2\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"NHEK_Epidermal_Keratinocytes_Weak_Repressed_PolyComb.bed.gz\", \n      \"position\": [\n        124, \n        13\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"NHEK_Epidermal_Keratinocytes_Weak_transcription.bed.gz\", \n      \"position\": [\n        124, \n        4\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"NHEK_Epidermal_Keratinocytes_ZNF_genes_and_repeats.bed.gz\", \n      \"position\": [\n        124, \n        7\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"NHLF_Lung_Fibroblasts_Active_TSS.bed.gz\", \n      \"position\": [\n        125, \n        0\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"NHLF_Lung_Fibroblasts_Bivalent_Enhancer.bed.gz\", \n      \"position\": [\n        125, \n        11\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"NHLF_Lung_Fibroblasts_Bivalent_Poised_TSS.bed.gz\", \n      \"position\": [\n        125, \n        9\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"NHLF_Lung_Fibroblasts_Enhancers.bed.gz\", \n      \"position\": [\n        125, \n        6\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"NHLF_Lung_Fibroblasts_Flanking_Active_TSS.bed.gz\", \n      \"position\": [\n        125, \n        1\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"NHLF_Lung_Fibroblasts_Flanking_Bivalent_TSS_Enh.bed.gz\", \n      \"position\": [\n        125, \n        10\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"NHLF_Lung_Fibroblasts_Genic_enhancers.bed.gz\", \n      \"position\": [\n        125, \n        5\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"NHLF_Lung_Fibroblasts_Heterochromatin.bed.gz\", \n      \"position\": [\n        125, \n        8\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"NHLF_Lung_Fibroblasts_Quiescent_Low.bed.gz\", \n      \"position\": [\n        125, \n        14\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"NHLF_Lung_Fibroblasts_Repressed_PolyComb.bed.gz\", \n      \"position\": [\n        125, \n        12\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"NHLF_Lung_Fibroblasts_Strong_transcription.bed.gz\", \n      \"position\": [\n        125, \n        3\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"NHLF_Lung_Fibroblasts_Transcr_at_gene_5_and_3.bed.gz\", \n      \"position\": [\n        125, \n        2\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"NHLF_Lung_Fibroblasts_Weak_Repressed_PolyComb.bed.gz\", \n      \"position\": [\n        125, \n        13\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"NHLF_Lung_Fibroblasts_Weak_transcription.bed.gz\", \n      \"position\": [\n        125, \n        4\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"NHLF_Lung_Fibroblasts_ZNF_genes_and_repeats.bed.gz\", \n      \"position\": [\n        125, \n        7\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"NH_A_Astrocytes_Active_TSS.bed.gz\", \n      \"position\": [\n        122, \n        0\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"NH_A_Astrocytes_Bivalent_Enhancer.bed.gz\", \n      \"position\": [\n        122, \n        11\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"NH_A_Astrocytes_Bivalent_Poised_TSS.bed.gz\", \n      \"position\": [\n        122, \n        9\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"NH_A_Astrocytes_Enhancers.bed.gz\", \n      \"position\": [\n        122, \n        6\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"NH_A_Astrocytes_Flanking_Active_TSS.bed.gz\", \n      \"position\": [\n        122, \n        1\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"NH_A_Astrocytes_Flanking_Bivalent_TSS_Enh.bed.gz\", \n      \"position\": [\n        122, \n        10\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"NH_A_Astrocytes_Genic_enhancers.bed.gz\", \n      \"position\": [\n        122, \n        5\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"NH_A_Astrocytes_Heterochromatin.bed.gz\", \n      \"position\": [\n        122, \n        8\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"NH_A_Astrocytes_Quiescent_Low.bed.gz\", \n      \"position\": [\n        122, \n        14\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"NH_A_Astrocytes_Repressed_PolyComb.bed.gz\", \n      \"position\": [\n        122, \n        12\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"NH_A_Astrocytes_Strong_transcription.bed.gz\", \n      \"position\": [\n        122, \n        3\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"NH_A_Astrocytes_Transcr_at_gene_5_and_3.bed.gz\", \n      \"position\": [\n        122, \n        2\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"NH_A_Astrocytes_Weak_Repressed_PolyComb.bed.gz\", \n      \"position\": [\n        122, \n        13\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"NH_A_Astrocytes_Weak_transcription.bed.gz\", \n      \"position\": [\n        122, \n        4\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"NH_A_Astrocytes_ZNF_genes_and_repeats.bed.gz\", \n      \"position\": [\n        122, \n        7\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"Neurosphere_Cultured_Cells_Cortex_Derived_Active_TSS.bed.gz\", \n      \"position\": [\n        52, \n        0\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"Neurosphere_Cultured_Cells_Cortex_Derived_Bivalent_Enhancer.bed.gz\", \n      \"position\": [\n        52, \n        11\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"Neurosphere_Cultured_Cells_Cortex_Derived_Bivalent_Poised_TSS.bed.gz\", \n      \"position\": [\n        52, \n        9\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"Neurosphere_Cultured_Cells_Cortex_Derived_Enhancers.bed.gz\", \n      \"position\": [\n        52, \n        6\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"Neurosphere_Cultured_Cells_Cortex_Derived_Flanking_Active_TSS.bed.gz\", \n      \"position\": [\n        52, \n        1\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"Neurosphere_Cultured_Cells_Cortex_Derived_Flanking_Bivalent_TSS_Enh.bed.gz\", \n      \"position\": [\n        52, \n        10\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"Neurosphere_Cultured_Cells_Cortex_Derived_Genic_enhancers.bed.gz\", \n      \"position\": [\n        52, \n        5\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"Neurosphere_Cultured_Cells_Cortex_Derived_Heterochromatin.bed.gz\", \n      \"position\": [\n        52, \n        8\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"Neurosphere_Cultured_Cells_Cortex_Derived_Quiescent_Low.bed.gz\", \n      \"position\": [\n        52, \n        14\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"Neurosphere_Cultured_Cells_Cortex_Derived_Repressed_PolyComb.bed.gz\", \n      \"position\": [\n        52, \n        12\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"Neurosphere_Cultured_Cells_Cortex_Derived_Strong_transcription.bed.gz\", \n      \"position\": [\n        52, \n        3\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"Neurosphere_Cultured_Cells_Cortex_Derived_Transcr_at_gene_5_and_3.bed.gz\", \n      \"position\": [\n        52, \n        2\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"Neurosphere_Cultured_Cells_Cortex_Derived_Weak_Repressed_PolyComb.bed.gz\", \n      \"position\": [\n        52, \n        13\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"Neurosphere_Cultured_Cells_Cortex_Derived_Weak_transcription.bed.gz\", \n      \"position\": [\n        52, \n        4\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"Neurosphere_Cultured_Cells_Cortex_Derived_ZNF_genes_and_repeats.bed.gz\", \n      \"position\": [\n        52, \n        7\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"Neurosphere_Cultured_Cells_Ganglionic_Eminence_Derived_Active_TSS.bed.gz\", \n      \"position\": [\n        53, \n        0\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"Neurosphere_Cultured_Cells_Ganglionic_Eminence_Derived_Bivalent_Enhancer.bed.gz\", \n      \"position\": [\n        53, \n        11\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"Neurosphere_Cultured_Cells_Ganglionic_Eminence_Derived_Bivalent_Poised_TSS.bed.gz\", \n      \"position\": [\n        53, \n        9\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"Neurosphere_Cultured_Cells_Ganglionic_Eminence_Derived_Enhancers.bed.gz\", \n      \"position\": [\n        53, \n        6\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"Neurosphere_Cultured_Cells_Ganglionic_Eminence_Derived_Flanking_Active_TSS.bed.gz\", \n      \"position\": [\n        53, \n        1\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"Neurosphere_Cultured_Cells_Ganglionic_Eminence_Derived_Flanking_Bivalent_TSS_Enh.bed.gz\", \n      \"position\": [\n        53, \n        10\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"Neurosphere_Cultured_Cells_Ganglionic_Eminence_Derived_Genic_enhancers.bed.gz\", \n      \"position\": [\n        53, \n        5\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"Neurosphere_Cultured_Cells_Ganglionic_Eminence_Derived_Heterochromatin.bed.gz\", \n      \"position\": [\n        53, \n        8\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"Neurosphere_Cultured_Cells_Ganglionic_Eminence_Derived_Quiescent_Low.bed.gz\", \n      \"position\": [\n        53, \n        14\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"Neurosphere_Cultured_Cells_Ganglionic_Eminence_Derived_Repressed_PolyComb.bed.gz\", \n      \"position\": [\n        53, \n        12\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"Neurosphere_Cultured_Cells_Ganglionic_Eminence_Derived_Strong_transcription.bed.gz\", \n      \"position\": [\n        53, \n        3\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"Neurosphere_Cultured_Cells_Ganglionic_Eminence_Derived_Transcr_at_gene_5_and_3.bed.gz\", \n      \"position\": [\n        53, \n        2\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"Neurosphere_Cultured_Cells_Ganglionic_Eminence_Derived_Weak_Repressed_PolyComb.bed.gz\", \n      \"position\": [\n        53, \n        13\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"Neurosphere_Cultured_Cells_Ganglionic_Eminence_Derived_Weak_transcription.bed.gz\", \n      \"position\": [\n        53, \n        4\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"Neurosphere_Cultured_Cells_Ganglionic_Eminence_Derived_ZNF_genes_and_repeats.bed.gz\", \n      \"position\": [\n        53, \n        7\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"Osteoblasts_Active_TSS.bed.gz\", \n      \"position\": [\n        126, \n        0\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"Osteoblasts_Bivalent_Enhancer.bed.gz\", \n      \"position\": [\n        126, \n        11\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"Osteoblasts_Bivalent_Poised_TSS.bed.gz\", \n      \"position\": [\n        126, \n        9\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"Osteoblasts_Enhancers.bed.gz\", \n      \"position\": [\n        126, \n        6\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"Osteoblasts_Flanking_Active_TSS.bed.gz\", \n      \"position\": [\n        126, \n        1\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"Osteoblasts_Flanking_Bivalent_TSS_Enh.bed.gz\", \n      \"position\": [\n        126, \n        10\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"Osteoblasts_Genic_enhancers.bed.gz\", \n      \"position\": [\n        126, \n        5\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"Osteoblasts_Heterochromatin.bed.gz\", \n      \"position\": [\n        126, \n        8\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"Osteoblasts_Quiescent_Low.bed.gz\", \n      \"position\": [\n        126, \n        14\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"Osteoblasts_Repressed_PolyComb.bed.gz\", \n      \"position\": [\n        126, \n        12\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"Osteoblasts_Strong_transcription.bed.gz\", \n      \"position\": [\n        126, \n        3\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"Osteoblasts_Transcr_at_gene_5_and_3.bed.gz\", \n      \"position\": [\n        126, \n        2\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"Osteoblasts_Weak_Repressed_PolyComb.bed.gz\", \n      \"position\": [\n        126, \n        13\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"Osteoblasts_Weak_transcription.bed.gz\", \n      \"position\": [\n        126, \n        4\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"Osteoblasts_ZNF_genes_and_repeats.bed.gz\", \n      \"position\": [\n        126, \n        7\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"Ovary_Active_TSS.bed.gz\", \n      \"position\": [\n        94, \n        0\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"Ovary_Bivalent_Enhancer.bed.gz\", \n      \"position\": [\n        94, \n        11\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"Ovary_Bivalent_Poised_TSS.bed.gz\", \n      \"position\": [\n        94, \n        9\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"Ovary_Enhancers.bed.gz\", \n      \"position\": [\n        94, \n        6\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"Ovary_Flanking_Active_TSS.bed.gz\", \n      \"position\": [\n        94, \n        1\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"Ovary_Flanking_Bivalent_TSS_Enh.bed.gz\", \n      \"position\": [\n        94, \n        10\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"Ovary_Genic_enhancers.bed.gz\", \n      \"position\": [\n        94, \n        5\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"Ovary_Heterochromatin.bed.gz\", \n      \"position\": [\n        94, \n        8\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"Ovary_Quiescent_Low.bed.gz\", \n      \"position\": [\n        94, \n        14\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"Ovary_Repressed_PolyComb.bed.gz\", \n      \"position\": [\n        94, \n        12\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"Ovary_Strong_transcription.bed.gz\", \n      \"position\": [\n        94, \n        3\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"Ovary_Transcr_at_gene_5_and_3.bed.gz\", \n      \"position\": [\n        94, \n        2\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"Ovary_Weak_Repressed_PolyComb.bed.gz\", \n      \"position\": [\n        94, \n        13\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"Ovary_Weak_transcription.bed.gz\", \n      \"position\": [\n        94, \n        4\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"Ovary_ZNF_genes_and_repeats.bed.gz\", \n      \"position\": [\n        94, \n        7\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"Pancreas_Active_TSS.bed.gz\", \n      \"position\": [\n        95, \n        0\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"Pancreas_Bivalent_Enhancer.bed.gz\", \n      \"position\": [\n        95, \n        11\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"Pancreas_Bivalent_Poised_TSS.bed.gz\", \n      \"position\": [\n        95, \n        9\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"Pancreas_Enhancers.bed.gz\", \n      \"position\": [\n        95, \n        6\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"Pancreas_Flanking_Active_TSS.bed.gz\", \n      \"position\": [\n        95, \n        1\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"Pancreas_Flanking_Bivalent_TSS_Enh.bed.gz\", \n      \"position\": [\n        95, \n        10\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"Pancreas_Genic_enhancers.bed.gz\", \n      \"position\": [\n        95, \n        5\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"Pancreas_Heterochromatin.bed.gz\", \n      \"position\": [\n        95, \n        8\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"Pancreas_Quiescent_Low.bed.gz\", \n      \"position\": [\n        95, \n        14\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"Pancreas_Repressed_PolyComb.bed.gz\", \n      \"position\": [\n        95, \n        12\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"Pancreas_Strong_transcription.bed.gz\", \n      \"position\": [\n        95, \n        3\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"Pancreas_Transcr_at_gene_5_and_3.bed.gz\", \n      \"position\": [\n        95, \n        2\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"Pancreas_Weak_Repressed_PolyComb.bed.gz\", \n      \"position\": [\n        95, \n        13\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"Pancreas_Weak_transcription.bed.gz\", \n      \"position\": [\n        95, \n        4\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"Pancreas_ZNF_genes_and_repeats.bed.gz\", \n      \"position\": [\n        95, \n        7\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"Pancreatic_Islets_Active_TSS.bed.gz\", \n      \"position\": [\n        84, \n        0\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"Pancreatic_Islets_Bivalent_Enhancer.bed.gz\", \n      \"position\": [\n        84, \n        11\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"Pancreatic_Islets_Bivalent_Poised_TSS.bed.gz\", \n      \"position\": [\n        84, \n        9\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"Pancreatic_Islets_Enhancers.bed.gz\", \n      \"position\": [\n        84, \n        6\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"Pancreatic_Islets_Flanking_Active_TSS.bed.gz\", \n      \"position\": [\n        84, \n        1\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"Pancreatic_Islets_Flanking_Bivalent_TSS_Enh.bed.gz\", \n      \"position\": [\n        84, \n        10\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"Pancreatic_Islets_Genic_enhancers.bed.gz\", \n      \"position\": [\n        84, \n        5\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"Pancreatic_Islets_Heterochromatin.bed.gz\", \n      \"position\": [\n        84, \n        8\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"Pancreatic_Islets_Quiescent_Low.bed.gz\", \n      \"position\": [\n        84, \n        14\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"Pancreatic_Islets_Repressed_PolyComb.bed.gz\", \n      \"position\": [\n        84, \n        12\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"Pancreatic_Islets_Strong_transcription.bed.gz\", \n      \"position\": [\n        84, \n        3\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"Pancreatic_Islets_Transcr_at_gene_5_and_3.bed.gz\", \n      \"position\": [\n        84, \n        2\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"Pancreatic_Islets_Weak_Repressed_PolyComb.bed.gz\", \n      \"position\": [\n        84, \n        13\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"Pancreatic_Islets_Weak_transcription.bed.gz\", \n      \"position\": [\n        84, \n        4\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"Pancreatic_Islets_ZNF_genes_and_repeats.bed.gz\", \n      \"position\": [\n        84, \n        7\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"Penis_Foreskin_Fibroblast_Primary_Cells_skin01_Active_TSS.bed.gz\", \n      \"position\": [\n        54, \n        0\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"Penis_Foreskin_Fibroblast_Primary_Cells_skin01_Bivalent_Enhancer.bed.gz\", \n      \"position\": [\n        54, \n        11\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"Penis_Foreskin_Fibroblast_Primary_Cells_skin01_Bivalent_Poised_TSS.bed.gz\", \n      \"position\": [\n        54, \n        9\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"Penis_Foreskin_Fibroblast_Primary_Cells_skin01_Enhancers.bed.gz\", \n      \"position\": [\n        54, \n        6\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"Penis_Foreskin_Fibroblast_Primary_Cells_skin01_Flanking_Active_TSS.bed.gz\", \n      \"position\": [\n        54, \n        1\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"Penis_Foreskin_Fibroblast_Primary_Cells_skin01_Flanking_Bivalent_TSS_Enh.bed.gz\", \n      \"position\": [\n        54, \n        10\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"Penis_Foreskin_Fibroblast_Primary_Cells_skin01_Genic_enhancers.bed.gz\", \n      \"position\": [\n        54, \n        5\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"Penis_Foreskin_Fibroblast_Primary_Cells_skin01_Heterochromatin.bed.gz\", \n      \"position\": [\n        54, \n        8\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"Penis_Foreskin_Fibroblast_Primary_Cells_skin01_Quiescent_Low.bed.gz\", \n      \"position\": [\n        54, \n        14\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"Penis_Foreskin_Fibroblast_Primary_Cells_skin01_Repressed_PolyComb.bed.gz\", \n      \"position\": [\n        54, \n        12\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"Penis_Foreskin_Fibroblast_Primary_Cells_skin01_Strong_transcription.bed.gz\", \n      \"position\": [\n        54, \n        3\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"Penis_Foreskin_Fibroblast_Primary_Cells_skin01_Transcr_at_gene_5_and_3.bed.gz\", \n      \"position\": [\n        54, \n        2\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"Penis_Foreskin_Fibroblast_Primary_Cells_skin01_Weak_Repressed_PolyComb.bed.gz\", \n      \"position\": [\n        54, \n        13\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"Penis_Foreskin_Fibroblast_Primary_Cells_skin01_Weak_transcription.bed.gz\", \n      \"position\": [\n        54, \n        4\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"Penis_Foreskin_Fibroblast_Primary_Cells_skin01_ZNF_genes_and_repeats.bed.gz\", \n      \"position\": [\n        54, \n        7\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"Penis_Foreskin_Fibroblast_Primary_Cells_skin02_Active_TSS.bed.gz\", \n      \"position\": [\n        55, \n        0\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"Penis_Foreskin_Fibroblast_Primary_Cells_skin02_Bivalent_Enhancer.bed.gz\", \n      \"position\": [\n        55, \n        11\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"Penis_Foreskin_Fibroblast_Primary_Cells_skin02_Bivalent_Poised_TSS.bed.gz\", \n      \"position\": [\n        55, \n        9\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"Penis_Foreskin_Fibroblast_Primary_Cells_skin02_Enhancers.bed.gz\", \n      \"position\": [\n        55, \n        6\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"Penis_Foreskin_Fibroblast_Primary_Cells_skin02_Flanking_Active_TSS.bed.gz\", \n      \"position\": [\n        55, \n        1\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"Penis_Foreskin_Fibroblast_Primary_Cells_skin02_Flanking_Bivalent_TSS_Enh.bed.gz\", \n      \"position\": [\n        55, \n        10\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"Penis_Foreskin_Fibroblast_Primary_Cells_skin02_Genic_enhancers.bed.gz\", \n      \"position\": [\n        55, \n        5\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"Penis_Foreskin_Fibroblast_Primary_Cells_skin02_Heterochromatin.bed.gz\", \n      \"position\": [\n        55, \n        8\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"Penis_Foreskin_Fibroblast_Primary_Cells_skin02_Quiescent_Low.bed.gz\", \n      \"position\": [\n        55, \n        14\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"Penis_Foreskin_Fibroblast_Primary_Cells_skin02_Repressed_PolyComb.bed.gz\", \n      \"position\": [\n        55, \n        12\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"Penis_Foreskin_Fibroblast_Primary_Cells_skin02_Strong_transcription.bed.gz\", \n      \"position\": [\n        55, \n        3\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"Penis_Foreskin_Fibroblast_Primary_Cells_skin02_Transcr_at_gene_5_and_3.bed.gz\", \n      \"position\": [\n        55, \n        2\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"Penis_Foreskin_Fibroblast_Primary_Cells_skin02_Weak_Repressed_PolyComb.bed.gz\", \n      \"position\": [\n        55, \n        13\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"Penis_Foreskin_Fibroblast_Primary_Cells_skin02_Weak_transcription.bed.gz\", \n      \"position\": [\n        55, \n        4\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"Penis_Foreskin_Fibroblast_Primary_Cells_skin02_ZNF_genes_and_repeats.bed.gz\", \n      \"position\": [\n        55, \n        7\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"Penis_Foreskin_Keratinocyte_Primary_Cells_skin02_Active_TSS.bed.gz\", \n      \"position\": [\n        56, \n        0\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"Penis_Foreskin_Keratinocyte_Primary_Cells_skin02_Bivalent_Enhancer.bed.gz\", \n      \"position\": [\n        56, \n        11\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"Penis_Foreskin_Keratinocyte_Primary_Cells_skin02_Bivalent_Poised_TSS.bed.gz\", \n      \"position\": [\n        56, \n        9\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"Penis_Foreskin_Keratinocyte_Primary_Cells_skin02_Enhancers.bed.gz\", \n      \"position\": [\n        56, \n        6\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"Penis_Foreskin_Keratinocyte_Primary_Cells_skin02_Flanking_Active_TSS.bed.gz\", \n      \"position\": [\n        56, \n        1\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"Penis_Foreskin_Keratinocyte_Primary_Cells_skin02_Flanking_Bivalent_TSS_Enh.bed.gz\", \n      \"position\": [\n        56, \n        10\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"Penis_Foreskin_Keratinocyte_Primary_Cells_skin02_Genic_enhancers.bed.gz\", \n      \"position\": [\n        56, \n        5\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"Penis_Foreskin_Keratinocyte_Primary_Cells_skin02_Heterochromatin.bed.gz\", \n      \"position\": [\n        56, \n        8\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"Penis_Foreskin_Keratinocyte_Primary_Cells_skin02_Quiescent_Low.bed.gz\", \n      \"position\": [\n        56, \n        14\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"Penis_Foreskin_Keratinocyte_Primary_Cells_skin02_Repressed_PolyComb.bed.gz\", \n      \"position\": [\n        56, \n        12\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"Penis_Foreskin_Keratinocyte_Primary_Cells_skin02_Strong_transcription.bed.gz\", \n      \"position\": [\n        56, \n        3\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"Penis_Foreskin_Keratinocyte_Primary_Cells_skin02_Transcr_at_gene_5_and_3.bed.gz\", \n      \"position\": [\n        56, \n        2\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"Penis_Foreskin_Keratinocyte_Primary_Cells_skin02_Weak_Repressed_PolyComb.bed.gz\", \n      \"position\": [\n        56, \n        13\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"Penis_Foreskin_Keratinocyte_Primary_Cells_skin02_Weak_transcription.bed.gz\", \n      \"position\": [\n        56, \n        4\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"Penis_Foreskin_Keratinocyte_Primary_Cells_skin02_ZNF_genes_and_repeats.bed.gz\", \n      \"position\": [\n        56, \n        7\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"Penis_Foreskin_Keratinocyte_Primary_Cells_skin03_Active_TSS.bed.gz\", \n      \"position\": [\n        57, \n        0\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"Penis_Foreskin_Keratinocyte_Primary_Cells_skin03_Bivalent_Enhancer.bed.gz\", \n      \"position\": [\n        57, \n        11\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"Penis_Foreskin_Keratinocyte_Primary_Cells_skin03_Bivalent_Poised_TSS.bed.gz\", \n      \"position\": [\n        57, \n        9\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"Penis_Foreskin_Keratinocyte_Primary_Cells_skin03_Enhancers.bed.gz\", \n      \"position\": [\n        57, \n        6\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"Penis_Foreskin_Keratinocyte_Primary_Cells_skin03_Flanking_Active_TSS.bed.gz\", \n      \"position\": [\n        57, \n        1\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"Penis_Foreskin_Keratinocyte_Primary_Cells_skin03_Flanking_Bivalent_TSS_Enh.bed.gz\", \n      \"position\": [\n        57, \n        10\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"Penis_Foreskin_Keratinocyte_Primary_Cells_skin03_Genic_enhancers.bed.gz\", \n      \"position\": [\n        57, \n        5\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"Penis_Foreskin_Keratinocyte_Primary_Cells_skin03_Heterochromatin.bed.gz\", \n      \"position\": [\n        57, \n        8\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"Penis_Foreskin_Keratinocyte_Primary_Cells_skin03_Quiescent_Low.bed.gz\", \n      \"position\": [\n        57, \n        14\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"Penis_Foreskin_Keratinocyte_Primary_Cells_skin03_Repressed_PolyComb.bed.gz\", \n      \"position\": [\n        57, \n        12\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"Penis_Foreskin_Keratinocyte_Primary_Cells_skin03_Strong_transcription.bed.gz\", \n      \"position\": [\n        57, \n        3\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"Penis_Foreskin_Keratinocyte_Primary_Cells_skin03_Transcr_at_gene_5_and_3.bed.gz\", \n      \"position\": [\n        57, \n        2\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"Penis_Foreskin_Keratinocyte_Primary_Cells_skin03_Weak_Repressed_PolyComb.bed.gz\", \n      \"position\": [\n        57, \n        13\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"Penis_Foreskin_Keratinocyte_Primary_Cells_skin03_Weak_transcription.bed.gz\", \n      \"position\": [\n        57, \n        4\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"Penis_Foreskin_Keratinocyte_Primary_Cells_skin03_ZNF_genes_and_repeats.bed.gz\", \n      \"position\": [\n        57, \n        7\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"Penis_Foreskin_Melanocyte_Primary_Cells_skin01_Active_TSS.bed.gz\", \n      \"position\": [\n        58, \n        0\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"Penis_Foreskin_Melanocyte_Primary_Cells_skin01_Bivalent_Enhancer.bed.gz\", \n      \"position\": [\n        58, \n        11\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"Penis_Foreskin_Melanocyte_Primary_Cells_skin01_Bivalent_Poised_TSS.bed.gz\", \n      \"position\": [\n        58, \n        9\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"Penis_Foreskin_Melanocyte_Primary_Cells_skin01_Enhancers.bed.gz\", \n      \"position\": [\n        58, \n        6\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"Penis_Foreskin_Melanocyte_Primary_Cells_skin01_Flanking_Active_TSS.bed.gz\", \n      \"position\": [\n        58, \n        1\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"Penis_Foreskin_Melanocyte_Primary_Cells_skin01_Flanking_Bivalent_TSS_Enh.bed.gz\", \n      \"position\": [\n        58, \n        10\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"Penis_Foreskin_Melanocyte_Primary_Cells_skin01_Genic_enhancers.bed.gz\", \n      \"position\": [\n        58, \n        5\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"Penis_Foreskin_Melanocyte_Primary_Cells_skin01_Heterochromatin.bed.gz\", \n      \"position\": [\n        58, \n        8\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"Penis_Foreskin_Melanocyte_Primary_Cells_skin01_Quiescent_Low.bed.gz\", \n      \"position\": [\n        58, \n        14\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"Penis_Foreskin_Melanocyte_Primary_Cells_skin01_Repressed_PolyComb.bed.gz\", \n      \"position\": [\n        58, \n        12\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"Penis_Foreskin_Melanocyte_Primary_Cells_skin01_Strong_transcription.bed.gz\", \n      \"position\": [\n        58, \n        3\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"Penis_Foreskin_Melanocyte_Primary_Cells_skin01_Transcr_at_gene_5_and_3.bed.gz\", \n      \"position\": [\n        58, \n        2\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"Penis_Foreskin_Melanocyte_Primary_Cells_skin01_Weak_Repressed_PolyComb.bed.gz\", \n      \"position\": [\n        58, \n        13\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"Penis_Foreskin_Melanocyte_Primary_Cells_skin01_Weak_transcription.bed.gz\", \n      \"position\": [\n        58, \n        4\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"Penis_Foreskin_Melanocyte_Primary_Cells_skin01_ZNF_genes_and_repeats.bed.gz\", \n      \"position\": [\n        58, \n        7\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"Penis_Foreskin_Melanocyte_Primary_Cells_skin03_Active_TSS.bed.gz\", \n      \"position\": [\n        59, \n        0\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"Penis_Foreskin_Melanocyte_Primary_Cells_skin03_Bivalent_Enhancer.bed.gz\", \n      \"position\": [\n        59, \n        11\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"Penis_Foreskin_Melanocyte_Primary_Cells_skin03_Bivalent_Poised_TSS.bed.gz\", \n      \"position\": [\n        59, \n        9\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"Penis_Foreskin_Melanocyte_Primary_Cells_skin03_Enhancers.bed.gz\", \n      \"position\": [\n        59, \n        6\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"Penis_Foreskin_Melanocyte_Primary_Cells_skin03_Flanking_Active_TSS.bed.gz\", \n      \"position\": [\n        59, \n        1\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"Penis_Foreskin_Melanocyte_Primary_Cells_skin03_Flanking_Bivalent_TSS_Enh.bed.gz\", \n      \"position\": [\n        59, \n        10\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"Penis_Foreskin_Melanocyte_Primary_Cells_skin03_Genic_enhancers.bed.gz\", \n      \"position\": [\n        59, \n        5\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"Penis_Foreskin_Melanocyte_Primary_Cells_skin03_Heterochromatin.bed.gz\", \n      \"position\": [\n        59, \n        8\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"Penis_Foreskin_Melanocyte_Primary_Cells_skin03_Quiescent_Low.bed.gz\", \n      \"position\": [\n        59, \n        14\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"Penis_Foreskin_Melanocyte_Primary_Cells_skin03_Repressed_PolyComb.bed.gz\", \n      \"position\": [\n        59, \n        12\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"Penis_Foreskin_Melanocyte_Primary_Cells_skin03_Strong_transcription.bed.gz\", \n      \"position\": [\n        59, \n        3\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"Penis_Foreskin_Melanocyte_Primary_Cells_skin03_Transcr_at_gene_5_and_3.bed.gz\", \n      \"position\": [\n        59, \n        2\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"Penis_Foreskin_Melanocyte_Primary_Cells_skin03_Weak_Repressed_PolyComb.bed.gz\", \n      \"position\": [\n        59, \n        13\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"Penis_Foreskin_Melanocyte_Primary_Cells_skin03_Weak_transcription.bed.gz\", \n      \"position\": [\n        59, \n        4\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"Penis_Foreskin_Melanocyte_Primary_Cells_skin03_ZNF_genes_and_repeats.bed.gz\", \n      \"position\": [\n        59, \n        7\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"Peripheral_Blood_Mononuclear_Primary_Cells_Active_TSS.bed.gz\", \n      \"position\": [\n        60, \n        0\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"Peripheral_Blood_Mononuclear_Primary_Cells_Bivalent_Enhancer.bed.gz\", \n      \"position\": [\n        60, \n        11\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"Peripheral_Blood_Mononuclear_Primary_Cells_Bivalent_Poised_TSS.bed.gz\", \n      \"position\": [\n        60, \n        9\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"Peripheral_Blood_Mononuclear_Primary_Cells_Enhancers.bed.gz\", \n      \"position\": [\n        60, \n        6\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"Peripheral_Blood_Mononuclear_Primary_Cells_Flanking_Active_TSS.bed.gz\", \n      \"position\": [\n        60, \n        1\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"Peripheral_Blood_Mononuclear_Primary_Cells_Flanking_Bivalent_TSS_Enh.bed.gz\", \n      \"position\": [\n        60, \n        10\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"Peripheral_Blood_Mononuclear_Primary_Cells_Genic_enhancers.bed.gz\", \n      \"position\": [\n        60, \n        5\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"Peripheral_Blood_Mononuclear_Primary_Cells_Heterochromatin.bed.gz\", \n      \"position\": [\n        60, \n        8\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"Peripheral_Blood_Mononuclear_Primary_Cells_Quiescent_Low.bed.gz\", \n      \"position\": [\n        60, \n        14\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"Peripheral_Blood_Mononuclear_Primary_Cells_Repressed_PolyComb.bed.gz\", \n      \"position\": [\n        60, \n        12\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"Peripheral_Blood_Mononuclear_Primary_Cells_Strong_transcription.bed.gz\", \n      \"position\": [\n        60, \n        3\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"Peripheral_Blood_Mononuclear_Primary_Cells_Transcr_at_gene_5_and_3.bed.gz\", \n      \"position\": [\n        60, \n        2\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"Peripheral_Blood_Mononuclear_Primary_Cells_Weak_Repressed_PolyComb.bed.gz\", \n      \"position\": [\n        60, \n        13\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"Peripheral_Blood_Mononuclear_Primary_Cells_Weak_transcription.bed.gz\", \n      \"position\": [\n        60, \n        4\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"Peripheral_Blood_Mononuclear_Primary_Cells_ZNF_genes_and_repeats.bed.gz\", \n      \"position\": [\n        60, \n        7\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"Placenta_Amnion_Active_TSS.bed.gz\", \n      \"position\": [\n        96, \n        0\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"Placenta_Amnion_Bivalent_Enhancer.bed.gz\", \n      \"position\": [\n        96, \n        11\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"Placenta_Amnion_Bivalent_Poised_TSS.bed.gz\", \n      \"position\": [\n        96, \n        9\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"Placenta_Amnion_Enhancers.bed.gz\", \n      \"position\": [\n        96, \n        6\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"Placenta_Amnion_Flanking_Active_TSS.bed.gz\", \n      \"position\": [\n        96, \n        1\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"Placenta_Amnion_Flanking_Bivalent_TSS_Enh.bed.gz\", \n      \"position\": [\n        96, \n        10\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"Placenta_Amnion_Genic_enhancers.bed.gz\", \n      \"position\": [\n        96, \n        5\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"Placenta_Amnion_Heterochromatin.bed.gz\", \n      \"position\": [\n        96, \n        8\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"Placenta_Amnion_Quiescent_Low.bed.gz\", \n      \"position\": [\n        96, \n        14\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"Placenta_Amnion_Repressed_PolyComb.bed.gz\", \n      \"position\": [\n        96, \n        12\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"Placenta_Amnion_Strong_transcription.bed.gz\", \n      \"position\": [\n        96, \n        3\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"Placenta_Amnion_Transcr_at_gene_5_and_3.bed.gz\", \n      \"position\": [\n        96, \n        2\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"Placenta_Amnion_Weak_Repressed_PolyComb.bed.gz\", \n      \"position\": [\n        96, \n        13\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"Placenta_Amnion_Weak_transcription.bed.gz\", \n      \"position\": [\n        96, \n        4\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"Placenta_Amnion_ZNF_genes_and_repeats.bed.gz\", \n      \"position\": [\n        96, \n        7\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"Psoas_Muscle_Active_TSS.bed.gz\", \n      \"position\": [\n        97, \n        0\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"Psoas_Muscle_Bivalent_Enhancer.bed.gz\", \n      \"position\": [\n        97, \n        11\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"Psoas_Muscle_Bivalent_Poised_TSS.bed.gz\", \n      \"position\": [\n        97, \n        9\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"Psoas_Muscle_Enhancers.bed.gz\", \n      \"position\": [\n        97, \n        6\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"Psoas_Muscle_Flanking_Active_TSS.bed.gz\", \n      \"position\": [\n        97, \n        1\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"Psoas_Muscle_Flanking_Bivalent_TSS_Enh.bed.gz\", \n      \"position\": [\n        97, \n        10\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"Psoas_Muscle_Genic_enhancers.bed.gz\", \n      \"position\": [\n        97, \n        5\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"Psoas_Muscle_Heterochromatin.bed.gz\", \n      \"position\": [\n        97, \n        8\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"Psoas_Muscle_Quiescent_Low.bed.gz\", \n      \"position\": [\n        97, \n        14\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"Psoas_Muscle_Repressed_PolyComb.bed.gz\", \n      \"position\": [\n        97, \n        12\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"Psoas_Muscle_Strong_transcription.bed.gz\", \n      \"position\": [\n        97, \n        3\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"Psoas_Muscle_Transcr_at_gene_5_and_3.bed.gz\", \n      \"position\": [\n        97, \n        2\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"Psoas_Muscle_Weak_Repressed_PolyComb.bed.gz\", \n      \"position\": [\n        97, \n        13\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"Psoas_Muscle_Weak_transcription.bed.gz\", \n      \"position\": [\n        97, \n        4\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"Psoas_Muscle_ZNF_genes_and_repeats.bed.gz\", \n      \"position\": [\n        97, \n        7\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"Rectal_Mucosa.Donor_29_Active_TSS.bed.gz\", \n      \"position\": [\n        98, \n        0\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"Rectal_Mucosa.Donor_29_Bivalent_Enhancer.bed.gz\", \n      \"position\": [\n        98, \n        11\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"Rectal_Mucosa.Donor_29_Bivalent_Poised_TSS.bed.gz\", \n      \"position\": [\n        98, \n        9\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"Rectal_Mucosa.Donor_29_Enhancers.bed.gz\", \n      \"position\": [\n        98, \n        6\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"Rectal_Mucosa.Donor_29_Flanking_Active_TSS.bed.gz\", \n      \"position\": [\n        98, \n        1\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"Rectal_Mucosa.Donor_29_Flanking_Bivalent_TSS_Enh.bed.gz\", \n      \"position\": [\n        98, \n        10\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"Rectal_Mucosa.Donor_29_Genic_enhancers.bed.gz\", \n      \"position\": [\n        98, \n        5\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"Rectal_Mucosa.Donor_29_Heterochromatin.bed.gz\", \n      \"position\": [\n        98, \n        8\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"Rectal_Mucosa.Donor_29_Quiescent_Low.bed.gz\", \n      \"position\": [\n        98, \n        14\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"Rectal_Mucosa.Donor_29_Repressed_PolyComb.bed.gz\", \n      \"position\": [\n        98, \n        12\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"Rectal_Mucosa.Donor_29_Strong_transcription.bed.gz\", \n      \"position\": [\n        98, \n        3\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"Rectal_Mucosa.Donor_29_Transcr_at_gene_5_and_3.bed.gz\", \n      \"position\": [\n        98, \n        2\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"Rectal_Mucosa.Donor_29_Weak_Repressed_PolyComb.bed.gz\", \n      \"position\": [\n        98, \n        13\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"Rectal_Mucosa.Donor_29_Weak_transcription.bed.gz\", \n      \"position\": [\n        98, \n        4\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"Rectal_Mucosa.Donor_29_ZNF_genes_and_repeats.bed.gz\", \n      \"position\": [\n        98, \n        7\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"Rectal_Mucosa.Donor_31_Active_TSS.bed.gz\", \n      \"position\": [\n        99, \n        0\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"Rectal_Mucosa.Donor_31_Bivalent_Enhancer.bed.gz\", \n      \"position\": [\n        99, \n        11\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"Rectal_Mucosa.Donor_31_Bivalent_Poised_TSS.bed.gz\", \n      \"position\": [\n        99, \n        9\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"Rectal_Mucosa.Donor_31_Enhancers.bed.gz\", \n      \"position\": [\n        99, \n        6\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"Rectal_Mucosa.Donor_31_Flanking_Active_TSS.bed.gz\", \n      \"position\": [\n        99, \n        1\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"Rectal_Mucosa.Donor_31_Flanking_Bivalent_TSS_Enh.bed.gz\", \n      \"position\": [\n        99, \n        10\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"Rectal_Mucosa.Donor_31_Genic_enhancers.bed.gz\", \n      \"position\": [\n        99, \n        5\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"Rectal_Mucosa.Donor_31_Heterochromatin.bed.gz\", \n      \"position\": [\n        99, \n        8\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"Rectal_Mucosa.Donor_31_Quiescent_Low.bed.gz\", \n      \"position\": [\n        99, \n        14\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"Rectal_Mucosa.Donor_31_Repressed_PolyComb.bed.gz\", \n      \"position\": [\n        99, \n        12\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"Rectal_Mucosa.Donor_31_Strong_transcription.bed.gz\", \n      \"position\": [\n        99, \n        3\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"Rectal_Mucosa.Donor_31_Transcr_at_gene_5_and_3.bed.gz\", \n      \"position\": [\n        99, \n        2\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"Rectal_Mucosa.Donor_31_Weak_Repressed_PolyComb.bed.gz\", \n      \"position\": [\n        99, \n        13\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"Rectal_Mucosa.Donor_31_Weak_transcription.bed.gz\", \n      \"position\": [\n        99, \n        4\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"Rectal_Mucosa.Donor_31_ZNF_genes_and_repeats.bed.gz\", \n      \"position\": [\n        99, \n        7\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"Rectal_Smooth_Muscle_Active_TSS.bed.gz\", \n      \"position\": [\n        100, \n        0\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"Rectal_Smooth_Muscle_Bivalent_Enhancer.bed.gz\", \n      \"position\": [\n        100, \n        11\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"Rectal_Smooth_Muscle_Bivalent_Poised_TSS.bed.gz\", \n      \"position\": [\n        100, \n        9\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"Rectal_Smooth_Muscle_Enhancers.bed.gz\", \n      \"position\": [\n        100, \n        6\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"Rectal_Smooth_Muscle_Flanking_Active_TSS.bed.gz\", \n      \"position\": [\n        100, \n        1\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"Rectal_Smooth_Muscle_Flanking_Bivalent_TSS_Enh.bed.gz\", \n      \"position\": [\n        100, \n        10\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"Rectal_Smooth_Muscle_Genic_enhancers.bed.gz\", \n      \"position\": [\n        100, \n        5\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"Rectal_Smooth_Muscle_Heterochromatin.bed.gz\", \n      \"position\": [\n        100, \n        8\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"Rectal_Smooth_Muscle_Quiescent_Low.bed.gz\", \n      \"position\": [\n        100, \n        14\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"Rectal_Smooth_Muscle_Repressed_PolyComb.bed.gz\", \n      \"position\": [\n        100, \n        12\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"Rectal_Smooth_Muscle_Strong_transcription.bed.gz\", \n      \"position\": [\n        100, \n        3\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"Rectal_Smooth_Muscle_Transcr_at_gene_5_and_3.bed.gz\", \n      \"position\": [\n        100, \n        2\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"Rectal_Smooth_Muscle_Weak_Repressed_PolyComb.bed.gz\", \n      \"position\": [\n        100, \n        13\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"Rectal_Smooth_Muscle_Weak_transcription.bed.gz\", \n      \"position\": [\n        100, \n        4\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"Rectal_Smooth_Muscle_ZNF_genes_and_repeats.bed.gz\", \n      \"position\": [\n        100, \n        7\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"Right_Atrium_Active_TSS.bed.gz\", \n      \"position\": [\n        101, \n        0\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"Right_Atrium_Bivalent_Enhancer.bed.gz\", \n      \"position\": [\n        101, \n        11\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"Right_Atrium_Bivalent_Poised_TSS.bed.gz\", \n      \"position\": [\n        101, \n        9\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"Right_Atrium_Enhancers.bed.gz\", \n      \"position\": [\n        101, \n        6\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"Right_Atrium_Flanking_Active_TSS.bed.gz\", \n      \"position\": [\n        101, \n        1\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"Right_Atrium_Flanking_Bivalent_TSS_Enh.bed.gz\", \n      \"position\": [\n        101, \n        10\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"Right_Atrium_Genic_enhancers.bed.gz\", \n      \"position\": [\n        101, \n        5\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"Right_Atrium_Heterochromatin.bed.gz\", \n      \"position\": [\n        101, \n        8\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"Right_Atrium_Quiescent_Low.bed.gz\", \n      \"position\": [\n        101, \n        14\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"Right_Atrium_Repressed_PolyComb.bed.gz\", \n      \"position\": [\n        101, \n        12\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"Right_Atrium_Strong_transcription.bed.gz\", \n      \"position\": [\n        101, \n        3\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"Right_Atrium_Transcr_at_gene_5_and_3.bed.gz\", \n      \"position\": [\n        101, \n        2\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"Right_Atrium_Weak_Repressed_PolyComb.bed.gz\", \n      \"position\": [\n        101, \n        13\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"Right_Atrium_Weak_transcription.bed.gz\", \n      \"position\": [\n        101, \n        4\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"Right_Atrium_ZNF_genes_and_repeats.bed.gz\", \n      \"position\": [\n        101, \n        7\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"Right_Ventricle_Active_TSS.bed.gz\", \n      \"position\": [\n        102, \n        0\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"Right_Ventricle_Bivalent_Enhancer.bed.gz\", \n      \"position\": [\n        102, \n        11\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"Right_Ventricle_Bivalent_Poised_TSS.bed.gz\", \n      \"position\": [\n        102, \n        9\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"Right_Ventricle_Enhancers.bed.gz\", \n      \"position\": [\n        102, \n        6\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"Right_Ventricle_Flanking_Active_TSS.bed.gz\", \n      \"position\": [\n        102, \n        1\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"Right_Ventricle_Flanking_Bivalent_TSS_Enh.bed.gz\", \n      \"position\": [\n        102, \n        10\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"Right_Ventricle_Genic_enhancers.bed.gz\", \n      \"position\": [\n        102, \n        5\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"Right_Ventricle_Heterochromatin.bed.gz\", \n      \"position\": [\n        102, \n        8\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"Right_Ventricle_Quiescent_Low.bed.gz\", \n      \"position\": [\n        102, \n        14\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"Right_Ventricle_Repressed_PolyComb.bed.gz\", \n      \"position\": [\n        102, \n        12\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"Right_Ventricle_Strong_transcription.bed.gz\", \n      \"position\": [\n        102, \n        3\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"Right_Ventricle_Transcr_at_gene_5_and_3.bed.gz\", \n      \"position\": [\n        102, \n        2\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"Right_Ventricle_Weak_Repressed_PolyComb.bed.gz\", \n      \"position\": [\n        102, \n        13\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"Right_Ventricle_Weak_transcription.bed.gz\", \n      \"position\": [\n        102, \n        4\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"Right_Ventricle_ZNF_genes_and_repeats.bed.gz\", \n      \"position\": [\n        102, \n        7\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"Sigmoid_Colon_Active_TSS.bed.gz\", \n      \"position\": [\n        103, \n        0\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"Sigmoid_Colon_Bivalent_Enhancer.bed.gz\", \n      \"position\": [\n        103, \n        11\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"Sigmoid_Colon_Bivalent_Poised_TSS.bed.gz\", \n      \"position\": [\n        103, \n        9\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"Sigmoid_Colon_Enhancers.bed.gz\", \n      \"position\": [\n        103, \n        6\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"Sigmoid_Colon_Flanking_Active_TSS.bed.gz\", \n      \"position\": [\n        103, \n        1\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"Sigmoid_Colon_Flanking_Bivalent_TSS_Enh.bed.gz\", \n      \"position\": [\n        103, \n        10\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"Sigmoid_Colon_Genic_enhancers.bed.gz\", \n      \"position\": [\n        103, \n        5\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"Sigmoid_Colon_Heterochromatin.bed.gz\", \n      \"position\": [\n        103, \n        8\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"Sigmoid_Colon_Quiescent_Low.bed.gz\", \n      \"position\": [\n        103, \n        14\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"Sigmoid_Colon_Repressed_PolyComb.bed.gz\", \n      \"position\": [\n        103, \n        12\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"Sigmoid_Colon_Strong_transcription.bed.gz\", \n      \"position\": [\n        103, \n        3\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"Sigmoid_Colon_Transcr_at_gene_5_and_3.bed.gz\", \n      \"position\": [\n        103, \n        2\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"Sigmoid_Colon_Weak_Repressed_PolyComb.bed.gz\", \n      \"position\": [\n        103, \n        13\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"Sigmoid_Colon_Weak_transcription.bed.gz\", \n      \"position\": [\n        103, \n        4\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"Sigmoid_Colon_ZNF_genes_and_repeats.bed.gz\", \n      \"position\": [\n        103, \n        7\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"Skeletal_Muscle_Female_Active_TSS.bed.gz\", \n      \"position\": [\n        105, \n        0\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"Skeletal_Muscle_Female_Bivalent_Enhancer.bed.gz\", \n      \"position\": [\n        105, \n        11\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"Skeletal_Muscle_Female_Bivalent_Poised_TSS.bed.gz\", \n      \"position\": [\n        105, \n        9\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"Skeletal_Muscle_Female_Enhancers.bed.gz\", \n      \"position\": [\n        105, \n        6\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"Skeletal_Muscle_Female_Flanking_Active_TSS.bed.gz\", \n      \"position\": [\n        105, \n        1\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"Skeletal_Muscle_Female_Flanking_Bivalent_TSS_Enh.bed.gz\", \n      \"position\": [\n        105, \n        10\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"Skeletal_Muscle_Female_Genic_enhancers.bed.gz\", \n      \"position\": [\n        105, \n        5\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"Skeletal_Muscle_Female_Heterochromatin.bed.gz\", \n      \"position\": [\n        105, \n        8\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"Skeletal_Muscle_Female_Quiescent_Low.bed.gz\", \n      \"position\": [\n        105, \n        14\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"Skeletal_Muscle_Female_Repressed_PolyComb.bed.gz\", \n      \"position\": [\n        105, \n        12\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"Skeletal_Muscle_Female_Strong_transcription.bed.gz\", \n      \"position\": [\n        105, \n        3\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"Skeletal_Muscle_Female_Transcr_at_gene_5_and_3.bed.gz\", \n      \"position\": [\n        105, \n        2\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"Skeletal_Muscle_Female_Weak_Repressed_PolyComb.bed.gz\", \n      \"position\": [\n        105, \n        13\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"Skeletal_Muscle_Female_Weak_transcription.bed.gz\", \n      \"position\": [\n        105, \n        4\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"Skeletal_Muscle_Female_ZNF_genes_and_repeats.bed.gz\", \n      \"position\": [\n        105, \n        7\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"Skeletal_Muscle_Male_Active_TSS.bed.gz\", \n      \"position\": [\n        104, \n        0\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"Skeletal_Muscle_Male_Bivalent_Enhancer.bed.gz\", \n      \"position\": [\n        104, \n        11\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"Skeletal_Muscle_Male_Bivalent_Poised_TSS.bed.gz\", \n      \"position\": [\n        104, \n        9\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"Skeletal_Muscle_Male_Enhancers.bed.gz\", \n      \"position\": [\n        104, \n        6\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"Skeletal_Muscle_Male_Flanking_Active_TSS.bed.gz\", \n      \"position\": [\n        104, \n        1\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"Skeletal_Muscle_Male_Flanking_Bivalent_TSS_Enh.bed.gz\", \n      \"position\": [\n        104, \n        10\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"Skeletal_Muscle_Male_Genic_enhancers.bed.gz\", \n      \"position\": [\n        104, \n        5\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"Skeletal_Muscle_Male_Heterochromatin.bed.gz\", \n      \"position\": [\n        104, \n        8\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"Skeletal_Muscle_Male_Quiescent_Low.bed.gz\", \n      \"position\": [\n        104, \n        14\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"Skeletal_Muscle_Male_Repressed_PolyComb.bed.gz\", \n      \"position\": [\n        104, \n        12\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"Skeletal_Muscle_Male_Strong_transcription.bed.gz\", \n      \"position\": [\n        104, \n        3\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"Skeletal_Muscle_Male_Transcr_at_gene_5_and_3.bed.gz\", \n      \"position\": [\n        104, \n        2\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"Skeletal_Muscle_Male_Weak_Repressed_PolyComb.bed.gz\", \n      \"position\": [\n        104, \n        13\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"Skeletal_Muscle_Male_Weak_transcription.bed.gz\", \n      \"position\": [\n        104, \n        4\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"Skeletal_Muscle_Male_ZNF_genes_and_repeats.bed.gz\", \n      \"position\": [\n        104, \n        7\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"Small_Intestine_Active_TSS.bed.gz\", \n      \"position\": [\n        106, \n        0\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"Small_Intestine_Bivalent_Enhancer.bed.gz\", \n      \"position\": [\n        106, \n        11\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"Small_Intestine_Bivalent_Poised_TSS.bed.gz\", \n      \"position\": [\n        106, \n        9\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"Small_Intestine_Enhancers.bed.gz\", \n      \"position\": [\n        106, \n        6\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"Small_Intestine_Flanking_Active_TSS.bed.gz\", \n      \"position\": [\n        106, \n        1\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"Small_Intestine_Flanking_Bivalent_TSS_Enh.bed.gz\", \n      \"position\": [\n        106, \n        10\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"Small_Intestine_Genic_enhancers.bed.gz\", \n      \"position\": [\n        106, \n        5\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"Small_Intestine_Heterochromatin.bed.gz\", \n      \"position\": [\n        106, \n        8\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"Small_Intestine_Quiescent_Low.bed.gz\", \n      \"position\": [\n        106, \n        14\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"Small_Intestine_Repressed_PolyComb.bed.gz\", \n      \"position\": [\n        106, \n        12\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"Small_Intestine_Strong_transcription.bed.gz\", \n      \"position\": [\n        106, \n        3\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"Small_Intestine_Transcr_at_gene_5_and_3.bed.gz\", \n      \"position\": [\n        106, \n        2\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"Small_Intestine_Weak_Repressed_PolyComb.bed.gz\", \n      \"position\": [\n        106, \n        13\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"Small_Intestine_Weak_transcription.bed.gz\", \n      \"position\": [\n        106, \n        4\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"Small_Intestine_ZNF_genes_and_repeats.bed.gz\", \n      \"position\": [\n        106, \n        7\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"Spleen_Active_TSS.bed.gz\", \n      \"position\": [\n        110, \n        0\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"Spleen_Bivalent_Enhancer.bed.gz\", \n      \"position\": [\n        110, \n        11\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"Spleen_Bivalent_Poised_TSS.bed.gz\", \n      \"position\": [\n        110, \n        9\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"Spleen_Enhancers.bed.gz\", \n      \"position\": [\n        110, \n        6\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"Spleen_Flanking_Active_TSS.bed.gz\", \n      \"position\": [\n        110, \n        1\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"Spleen_Flanking_Bivalent_TSS_Enh.bed.gz\", \n      \"position\": [\n        110, \n        10\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"Spleen_Genic_enhancers.bed.gz\", \n      \"position\": [\n        110, \n        5\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"Spleen_Heterochromatin.bed.gz\", \n      \"position\": [\n        110, \n        8\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"Spleen_Quiescent_Low.bed.gz\", \n      \"position\": [\n        110, \n        14\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"Spleen_Repressed_PolyComb.bed.gz\", \n      \"position\": [\n        110, \n        12\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"Spleen_Strong_transcription.bed.gz\", \n      \"position\": [\n        110, \n        3\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"Spleen_Transcr_at_gene_5_and_3.bed.gz\", \n      \"position\": [\n        110, \n        2\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"Spleen_Weak_Repressed_PolyComb.bed.gz\", \n      \"position\": [\n        110, \n        13\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"Spleen_Weak_transcription.bed.gz\", \n      \"position\": [\n        110, \n        4\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"Spleen_ZNF_genes_and_repeats.bed.gz\", \n      \"position\": [\n        110, \n        7\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"Stomach_Mucosa_Active_TSS.bed.gz\", \n      \"position\": [\n        107, \n        0\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"Stomach_Mucosa_Bivalent_Enhancer.bed.gz\", \n      \"position\": [\n        107, \n        11\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"Stomach_Mucosa_Bivalent_Poised_TSS.bed.gz\", \n      \"position\": [\n        107, \n        9\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"Stomach_Mucosa_Enhancers.bed.gz\", \n      \"position\": [\n        107, \n        6\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"Stomach_Mucosa_Flanking_Active_TSS.bed.gz\", \n      \"position\": [\n        107, \n        1\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"Stomach_Mucosa_Flanking_Bivalent_TSS_Enh.bed.gz\", \n      \"position\": [\n        107, \n        10\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"Stomach_Mucosa_Genic_enhancers.bed.gz\", \n      \"position\": [\n        107, \n        5\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"Stomach_Mucosa_Heterochromatin.bed.gz\", \n      \"position\": [\n        107, \n        8\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"Stomach_Mucosa_Quiescent_Low.bed.gz\", \n      \"position\": [\n        107, \n        14\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"Stomach_Mucosa_Repressed_PolyComb.bed.gz\", \n      \"position\": [\n        107, \n        12\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"Stomach_Mucosa_Strong_transcription.bed.gz\", \n      \"position\": [\n        107, \n        3\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"Stomach_Mucosa_Transcr_at_gene_5_and_3.bed.gz\", \n      \"position\": [\n        107, \n        2\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"Stomach_Mucosa_Weak_Repressed_PolyComb.bed.gz\", \n      \"position\": [\n        107, \n        13\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"Stomach_Mucosa_Weak_transcription.bed.gz\", \n      \"position\": [\n        107, \n        4\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"Stomach_Mucosa_ZNF_genes_and_repeats.bed.gz\", \n      \"position\": [\n        107, \n        7\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"Stomach_Smooth_Muscle_Active_TSS.bed.gz\", \n      \"position\": [\n        108, \n        0\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"Stomach_Smooth_Muscle_Bivalent_Enhancer.bed.gz\", \n      \"position\": [\n        108, \n        11\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"Stomach_Smooth_Muscle_Bivalent_Poised_TSS.bed.gz\", \n      \"position\": [\n        108, \n        9\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"Stomach_Smooth_Muscle_Enhancers.bed.gz\", \n      \"position\": [\n        108, \n        6\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"Stomach_Smooth_Muscle_Flanking_Active_TSS.bed.gz\", \n      \"position\": [\n        108, \n        1\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"Stomach_Smooth_Muscle_Flanking_Bivalent_TSS_Enh.bed.gz\", \n      \"position\": [\n        108, \n        10\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"Stomach_Smooth_Muscle_Genic_enhancers.bed.gz\", \n      \"position\": [\n        108, \n        5\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"Stomach_Smooth_Muscle_Heterochromatin.bed.gz\", \n      \"position\": [\n        108, \n        8\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"Stomach_Smooth_Muscle_Quiescent_Low.bed.gz\", \n      \"position\": [\n        108, \n        14\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"Stomach_Smooth_Muscle_Repressed_PolyComb.bed.gz\", \n      \"position\": [\n        108, \n        12\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"Stomach_Smooth_Muscle_Strong_transcription.bed.gz\", \n      \"position\": [\n        108, \n        3\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"Stomach_Smooth_Muscle_Transcr_at_gene_5_and_3.bed.gz\", \n      \"position\": [\n        108, \n        2\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"Stomach_Smooth_Muscle_Weak_Repressed_PolyComb.bed.gz\", \n      \"position\": [\n        108, \n        13\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"Stomach_Smooth_Muscle_Weak_transcription.bed.gz\", \n      \"position\": [\n        108, \n        4\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"Stomach_Smooth_Muscle_ZNF_genes_and_repeats.bed.gz\", \n      \"position\": [\n        108, \n        7\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"Thymus_Active_TSS.bed.gz\", \n      \"position\": [\n        109, \n        0\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"Thymus_Bivalent_Enhancer.bed.gz\", \n      \"position\": [\n        109, \n        11\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"Thymus_Bivalent_Poised_TSS.bed.gz\", \n      \"position\": [\n        109, \n        9\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"Thymus_Enhancers.bed.gz\", \n      \"position\": [\n        109, \n        6\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"Thymus_Flanking_Active_TSS.bed.gz\", \n      \"position\": [\n        109, \n        1\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"Thymus_Flanking_Bivalent_TSS_Enh.bed.gz\", \n      \"position\": [\n        109, \n        10\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"Thymus_Genic_enhancers.bed.gz\", \n      \"position\": [\n        109, \n        5\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"Thymus_Heterochromatin.bed.gz\", \n      \"position\": [\n        109, \n        8\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"Thymus_Quiescent_Low.bed.gz\", \n      \"position\": [\n        109, \n        14\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"Thymus_Repressed_PolyComb.bed.gz\", \n      \"position\": [\n        109, \n        12\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"Thymus_Strong_transcription.bed.gz\", \n      \"position\": [\n        109, \n        3\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"Thymus_Transcr_at_gene_5_and_3.bed.gz\", \n      \"position\": [\n        109, \n        2\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"Thymus_Weak_Repressed_PolyComb.bed.gz\", \n      \"position\": [\n        109, \n        13\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"Thymus_Weak_transcription.bed.gz\", \n      \"position\": [\n        109, \n        4\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"Thymus_ZNF_genes_and_repeats.bed.gz\", \n      \"position\": [\n        109, \n        7\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"hESC_Derived_CD184pp_Endoderm_Cultured_Cells_Active_TSS.bed.gz\", \n      \"position\": [\n        10, \n        0\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"hESC_Derived_CD184pp_Endoderm_Cultured_Cells_Bivalent_Enhancer.bed.gz\", \n      \"position\": [\n        10, \n        11\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"hESC_Derived_CD184pp_Endoderm_Cultured_Cells_Bivalent_Poised_TSS.bed.gz\", \n      \"position\": [\n        10, \n        9\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"hESC_Derived_CD184pp_Endoderm_Cultured_Cells_Enhancers.bed.gz\", \n      \"position\": [\n        10, \n        6\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"hESC_Derived_CD184pp_Endoderm_Cultured_Cells_Flanking_Active_TSS.bed.gz\", \n      \"position\": [\n        10, \n        1\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"hESC_Derived_CD184pp_Endoderm_Cultured_Cells_Flanking_Bivalent_TSS_Enh.bed.gz\", \n      \"position\": [\n        10, \n        10\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"hESC_Derived_CD184pp_Endoderm_Cultured_Cells_Genic_enhancers.bed.gz\", \n      \"position\": [\n        10, \n        5\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"hESC_Derived_CD184pp_Endoderm_Cultured_Cells_Heterochromatin.bed.gz\", \n      \"position\": [\n        10, \n        8\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"hESC_Derived_CD184pp_Endoderm_Cultured_Cells_Quiescent_Low.bed.gz\", \n      \"position\": [\n        10, \n        14\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"hESC_Derived_CD184pp_Endoderm_Cultured_Cells_Repressed_PolyComb.bed.gz\", \n      \"position\": [\n        10, \n        12\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"hESC_Derived_CD184pp_Endoderm_Cultured_Cells_Strong_transcription.bed.gz\", \n      \"position\": [\n        10, \n        3\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"hESC_Derived_CD184pp_Endoderm_Cultured_Cells_Transcr_at_gene_5_and_3.bed.gz\", \n      \"position\": [\n        10, \n        2\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"hESC_Derived_CD184pp_Endoderm_Cultured_Cells_Weak_Repressed_PolyComb.bed.gz\", \n      \"position\": [\n        10, \n        13\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"hESC_Derived_CD184pp_Endoderm_Cultured_Cells_Weak_transcription.bed.gz\", \n      \"position\": [\n        10, \n        4\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"hESC_Derived_CD184pp_Endoderm_Cultured_Cells_ZNF_genes_and_repeats.bed.gz\", \n      \"position\": [\n        10, \n        7\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"hESC_Derived_CD56pp_Ectoderm_Cultured_Cells_Active_TSS.bed.gz\", \n      \"position\": [\n        11, \n        0\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"hESC_Derived_CD56pp_Ectoderm_Cultured_Cells_Bivalent_Enhancer.bed.gz\", \n      \"position\": [\n        11, \n        11\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"hESC_Derived_CD56pp_Ectoderm_Cultured_Cells_Bivalent_Poised_TSS.bed.gz\", \n      \"position\": [\n        11, \n        9\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"hESC_Derived_CD56pp_Ectoderm_Cultured_Cells_Enhancers.bed.gz\", \n      \"position\": [\n        11, \n        6\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"hESC_Derived_CD56pp_Ectoderm_Cultured_Cells_Flanking_Active_TSS.bed.gz\", \n      \"position\": [\n        11, \n        1\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"hESC_Derived_CD56pp_Ectoderm_Cultured_Cells_Flanking_Bivalent_TSS_Enh.bed.gz\", \n      \"position\": [\n        11, \n        10\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"hESC_Derived_CD56pp_Ectoderm_Cultured_Cells_Genic_enhancers.bed.gz\", \n      \"position\": [\n        11, \n        5\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"hESC_Derived_CD56pp_Ectoderm_Cultured_Cells_Heterochromatin.bed.gz\", \n      \"position\": [\n        11, \n        8\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"hESC_Derived_CD56pp_Ectoderm_Cultured_Cells_Quiescent_Low.bed.gz\", \n      \"position\": [\n        11, \n        14\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"hESC_Derived_CD56pp_Ectoderm_Cultured_Cells_Repressed_PolyComb.bed.gz\", \n      \"position\": [\n        11, \n        12\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"hESC_Derived_CD56pp_Ectoderm_Cultured_Cells_Strong_transcription.bed.gz\", \n      \"position\": [\n        11, \n        3\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"hESC_Derived_CD56pp_Ectoderm_Cultured_Cells_Transcr_at_gene_5_and_3.bed.gz\", \n      \"position\": [\n        11, \n        2\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"hESC_Derived_CD56pp_Ectoderm_Cultured_Cells_Weak_Repressed_PolyComb.bed.gz\", \n      \"position\": [\n        11, \n        13\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"hESC_Derived_CD56pp_Ectoderm_Cultured_Cells_Weak_transcription.bed.gz\", \n      \"position\": [\n        11, \n        4\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"hESC_Derived_CD56pp_Ectoderm_Cultured_Cells_ZNF_genes_and_repeats.bed.gz\", \n      \"position\": [\n        11, \n        7\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"hESC_Derived_CD56pp_Mesoderm_Cultured_Cells_Active_TSS.bed.gz\", \n      \"position\": [\n        12, \n        0\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"hESC_Derived_CD56pp_Mesoderm_Cultured_Cells_Bivalent_Enhancer.bed.gz\", \n      \"position\": [\n        12, \n        11\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"hESC_Derived_CD56pp_Mesoderm_Cultured_Cells_Bivalent_Poised_TSS.bed.gz\", \n      \"position\": [\n        12, \n        9\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"hESC_Derived_CD56pp_Mesoderm_Cultured_Cells_Enhancers.bed.gz\", \n      \"position\": [\n        12, \n        6\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"hESC_Derived_CD56pp_Mesoderm_Cultured_Cells_Flanking_Active_TSS.bed.gz\", \n      \"position\": [\n        12, \n        1\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"hESC_Derived_CD56pp_Mesoderm_Cultured_Cells_Flanking_Bivalent_TSS_Enh.bed.gz\", \n      \"position\": [\n        12, \n        10\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"hESC_Derived_CD56pp_Mesoderm_Cultured_Cells_Genic_enhancers.bed.gz\", \n      \"position\": [\n        12, \n        5\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"hESC_Derived_CD56pp_Mesoderm_Cultured_Cells_Heterochromatin.bed.gz\", \n      \"position\": [\n        12, \n        8\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"hESC_Derived_CD56pp_Mesoderm_Cultured_Cells_Quiescent_Low.bed.gz\", \n      \"position\": [\n        12, \n        14\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"hESC_Derived_CD56pp_Mesoderm_Cultured_Cells_Repressed_PolyComb.bed.gz\", \n      \"position\": [\n        12, \n        12\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"hESC_Derived_CD56pp_Mesoderm_Cultured_Cells_Strong_transcription.bed.gz\", \n      \"position\": [\n        12, \n        3\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"hESC_Derived_CD56pp_Mesoderm_Cultured_Cells_Transcr_at_gene_5_and_3.bed.gz\", \n      \"position\": [\n        12, \n        2\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"hESC_Derived_CD56pp_Mesoderm_Cultured_Cells_Weak_Repressed_PolyComb.bed.gz\", \n      \"position\": [\n        12, \n        13\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"hESC_Derived_CD56pp_Mesoderm_Cultured_Cells_Weak_transcription.bed.gz\", \n      \"position\": [\n        12, \n        4\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"hESC_Derived_CD56pp_Mesoderm_Cultured_Cells_ZNF_genes_and_repeats.bed.gz\", \n      \"position\": [\n        12, \n        7\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"iPS_15b_Cell_Line_Active_TSS.bed.gz\", \n      \"position\": [\n        17, \n        0\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"iPS_15b_Cell_Line_Bivalent_Enhancer.bed.gz\", \n      \"position\": [\n        17, \n        11\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"iPS_15b_Cell_Line_Bivalent_Poised_TSS.bed.gz\", \n      \"position\": [\n        17, \n        9\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"iPS_15b_Cell_Line_Enhancers.bed.gz\", \n      \"position\": [\n        17, \n        6\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"iPS_15b_Cell_Line_Flanking_Active_TSS.bed.gz\", \n      \"position\": [\n        17, \n        1\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"iPS_15b_Cell_Line_Flanking_Bivalent_TSS_Enh.bed.gz\", \n      \"position\": [\n        17, \n        10\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"iPS_15b_Cell_Line_Genic_enhancers.bed.gz\", \n      \"position\": [\n        17, \n        5\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"iPS_15b_Cell_Line_Heterochromatin.bed.gz\", \n      \"position\": [\n        17, \n        8\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"iPS_15b_Cell_Line_Quiescent_Low.bed.gz\", \n      \"position\": [\n        17, \n        14\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"iPS_15b_Cell_Line_Repressed_PolyComb.bed.gz\", \n      \"position\": [\n        17, \n        12\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"iPS_15b_Cell_Line_Strong_transcription.bed.gz\", \n      \"position\": [\n        17, \n        3\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"iPS_15b_Cell_Line_Transcr_at_gene_5_and_3.bed.gz\", \n      \"position\": [\n        17, \n        2\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"iPS_15b_Cell_Line_Weak_Repressed_PolyComb.bed.gz\", \n      \"position\": [\n        17, \n        13\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"iPS_15b_Cell_Line_Weak_transcription.bed.gz\", \n      \"position\": [\n        17, \n        4\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"iPS_15b_Cell_Line_ZNF_genes_and_repeats.bed.gz\", \n      \"position\": [\n        17, \n        7\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"iPS_18_Cell_Line_Active_TSS.bed.gz\", \n      \"position\": [\n        18, \n        0\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"iPS_18_Cell_Line_Bivalent_Enhancer.bed.gz\", \n      \"position\": [\n        18, \n        11\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"iPS_18_Cell_Line_Bivalent_Poised_TSS.bed.gz\", \n      \"position\": [\n        18, \n        9\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"iPS_18_Cell_Line_Enhancers.bed.gz\", \n      \"position\": [\n        18, \n        6\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"iPS_18_Cell_Line_Flanking_Active_TSS.bed.gz\", \n      \"position\": [\n        18, \n        1\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"iPS_18_Cell_Line_Flanking_Bivalent_TSS_Enh.bed.gz\", \n      \"position\": [\n        18, \n        10\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"iPS_18_Cell_Line_Genic_enhancers.bed.gz\", \n      \"position\": [\n        18, \n        5\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"iPS_18_Cell_Line_Heterochromatin.bed.gz\", \n      \"position\": [\n        18, \n        8\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"iPS_18_Cell_Line_Quiescent_Low.bed.gz\", \n      \"position\": [\n        18, \n        14\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"iPS_18_Cell_Line_Repressed_PolyComb.bed.gz\", \n      \"position\": [\n        18, \n        12\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"iPS_18_Cell_Line_Strong_transcription.bed.gz\", \n      \"position\": [\n        18, \n        3\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"iPS_18_Cell_Line_Transcr_at_gene_5_and_3.bed.gz\", \n      \"position\": [\n        18, \n        2\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"iPS_18_Cell_Line_Weak_Repressed_PolyComb.bed.gz\", \n      \"position\": [\n        18, \n        13\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"iPS_18_Cell_Line_Weak_transcription.bed.gz\", \n      \"position\": [\n        18, \n        4\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"iPS_18_Cell_Line_ZNF_genes_and_repeats.bed.gz\", \n      \"position\": [\n        18, \n        7\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"iPS_20b_Cell_Line_Active_TSS.bed.gz\", \n      \"position\": [\n        19, \n        0\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"iPS_20b_Cell_Line_Bivalent_Enhancer.bed.gz\", \n      \"position\": [\n        19, \n        11\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"iPS_20b_Cell_Line_Bivalent_Poised_TSS.bed.gz\", \n      \"position\": [\n        19, \n        9\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"iPS_20b_Cell_Line_Enhancers.bed.gz\", \n      \"position\": [\n        19, \n        6\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"iPS_20b_Cell_Line_Flanking_Active_TSS.bed.gz\", \n      \"position\": [\n        19, \n        1\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"iPS_20b_Cell_Line_Flanking_Bivalent_TSS_Enh.bed.gz\", \n      \"position\": [\n        19, \n        10\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"iPS_20b_Cell_Line_Genic_enhancers.bed.gz\", \n      \"position\": [\n        19, \n        5\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"iPS_20b_Cell_Line_Heterochromatin.bed.gz\", \n      \"position\": [\n        19, \n        8\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"iPS_20b_Cell_Line_Quiescent_Low.bed.gz\", \n      \"position\": [\n        19, \n        14\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"iPS_20b_Cell_Line_Repressed_PolyComb.bed.gz\", \n      \"position\": [\n        19, \n        12\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"iPS_20b_Cell_Line_Strong_transcription.bed.gz\", \n      \"position\": [\n        19, \n        3\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"iPS_20b_Cell_Line_Transcr_at_gene_5_and_3.bed.gz\", \n      \"position\": [\n        19, \n        2\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"iPS_20b_Cell_Line_Weak_Repressed_PolyComb.bed.gz\", \n      \"position\": [\n        19, \n        13\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"iPS_20b_Cell_Line_Weak_transcription.bed.gz\", \n      \"position\": [\n        19, \n        4\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"iPS_20b_Cell_Line_ZNF_genes_and_repeats.bed.gz\", \n      \"position\": [\n        19, \n        7\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"iPS_DF_19.11_Cell_Line_Active_TSS.bed.gz\", \n      \"position\": [\n        21, \n        0\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"iPS_DF_19.11_Cell_Line_Bivalent_Enhancer.bed.gz\", \n      \"position\": [\n        21, \n        11\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"iPS_DF_19.11_Cell_Line_Bivalent_Poised_TSS.bed.gz\", \n      \"position\": [\n        21, \n        9\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"iPS_DF_19.11_Cell_Line_Enhancers.bed.gz\", \n      \"position\": [\n        21, \n        6\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"iPS_DF_19.11_Cell_Line_Flanking_Active_TSS.bed.gz\", \n      \"position\": [\n        21, \n        1\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"iPS_DF_19.11_Cell_Line_Flanking_Bivalent_TSS_Enh.bed.gz\", \n      \"position\": [\n        21, \n        10\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"iPS_DF_19.11_Cell_Line_Genic_enhancers.bed.gz\", \n      \"position\": [\n        21, \n        5\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"iPS_DF_19.11_Cell_Line_Heterochromatin.bed.gz\", \n      \"position\": [\n        21, \n        8\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"iPS_DF_19.11_Cell_Line_Quiescent_Low.bed.gz\", \n      \"position\": [\n        21, \n        14\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"iPS_DF_19.11_Cell_Line_Repressed_PolyComb.bed.gz\", \n      \"position\": [\n        21, \n        12\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"iPS_DF_19.11_Cell_Line_Strong_transcription.bed.gz\", \n      \"position\": [\n        21, \n        3\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"iPS_DF_19.11_Cell_Line_Transcr_at_gene_5_and_3.bed.gz\", \n      \"position\": [\n        21, \n        2\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"iPS_DF_19.11_Cell_Line_Weak_Repressed_PolyComb.bed.gz\", \n      \"position\": [\n        21, \n        13\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"iPS_DF_19.11_Cell_Line_Weak_transcription.bed.gz\", \n      \"position\": [\n        21, \n        4\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"iPS_DF_19.11_Cell_Line_ZNF_genes_and_repeats.bed.gz\", \n      \"position\": [\n        21, \n        7\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"iPS_DF_6.9_Cell_Line_Active_TSS.bed.gz\", \n      \"position\": [\n        20, \n        0\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"iPS_DF_6.9_Cell_Line_Bivalent_Enhancer.bed.gz\", \n      \"position\": [\n        20, \n        11\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"iPS_DF_6.9_Cell_Line_Bivalent_Poised_TSS.bed.gz\", \n      \"position\": [\n        20, \n        9\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"iPS_DF_6.9_Cell_Line_Enhancers.bed.gz\", \n      \"position\": [\n        20, \n        6\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"iPS_DF_6.9_Cell_Line_Flanking_Active_TSS.bed.gz\", \n      \"position\": [\n        20, \n        1\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"iPS_DF_6.9_Cell_Line_Flanking_Bivalent_TSS_Enh.bed.gz\", \n      \"position\": [\n        20, \n        10\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"iPS_DF_6.9_Cell_Line_Genic_enhancers.bed.gz\", \n      \"position\": [\n        20, \n        5\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"iPS_DF_6.9_Cell_Line_Heterochromatin.bed.gz\", \n      \"position\": [\n        20, \n        8\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"iPS_DF_6.9_Cell_Line_Quiescent_Low.bed.gz\", \n      \"position\": [\n        20, \n        14\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"iPS_DF_6.9_Cell_Line_Repressed_PolyComb.bed.gz\", \n      \"position\": [\n        20, \n        12\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"iPS_DF_6.9_Cell_Line_Strong_transcription.bed.gz\", \n      \"position\": [\n        20, \n        3\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"iPS_DF_6.9_Cell_Line_Transcr_at_gene_5_and_3.bed.gz\", \n      \"position\": [\n        20, \n        2\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"iPS_DF_6.9_Cell_Line_Weak_Repressed_PolyComb.bed.gz\", \n      \"position\": [\n        20, \n        13\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"iPS_DF_6.9_Cell_Line_Weak_transcription.bed.gz\", \n      \"position\": [\n        20, \n        4\n      ], \n      \"type\": \"bed\"\n    }, \n    {\n      \"name\": \"iPS_DF_6.9_Cell_Line_ZNF_genes_and_repeats.bed.gz\", \n      \"position\": [\n        20, \n        7\n      ], \n      \"type\": \"bed\"\n    }\n  ]\n}\n"
  },
  {
    "path": "examples/rme/get_data.sh",
    "content": "mkdir data\ncd data\nwget http://egg2.wustl.edu/roadmap/data/byFileType/chromhmmSegmentations/ChmmModels/coreMarks/jointModel/final/all.mnemonics.bedFiles.tgz\ntar zxvf all.mnemonics.bedFiles.tgz\ncd ..\nmkdir split\npython rename.py states.txt EDACC_NAME.txt \"data/*gz\" \"split/\"\n"
  },
  {
    "path": "examples/rme/groups.txt",
    "content": "E001\tESC\nE002\tESC\nE003\tESC\nE004\tES-deriv\nE005\tES-deriv\nE006\tES-deriv\nE007\tES-deriv\nE008\tESC\nE009\tES-deriv\nE010\tES-deriv\nE011\tES-deriv\nE012\tES-deriv\nE013\tES-deriv\nE014\tESC\nE015\tESC\nE016\tESC\nE017\tIMR90\nE018\tiPSC\nE019\tiPSC\nE020\tiPSC\nE021\tiPSC\nE022\tiPSC\nE023\tMesench\nE024\tESC\nE025\tMesench\nE026\tMesench\nE027\tEpithelial\nE028\tEpithelial\nE029\tHSC_&_B-cell\nE030\tHSC_&_B-cell\nE031\tHSC_&_B-cell\nE032\tHSC_&_B-cell\nE033\tBlood_&_T-cell\nE034\tBlood_&_T-cell\nE035\tHSC_&_B-cell\nE036\tHSC_&_B-cell\nE037\tBlood_&_T-cell\nE038\tBlood_&_T-cell\nE039\tBlood_&_T-cell\nE040\tBlood_&_T-cell\nE041\tBlood_&_T-cell\nE042\tBlood_&_T-cell\nE043\tBlood_&_T-cell\nE044\tBlood_&_T-cell\nE045\tBlood_&_T-cell\nE046\tHSC_&_B-cell\nE047\tBlood_&_T-cell\nE048\tBlood_&_T-cell\nE049\tMesench\nE050\tHSC_&_B-cell\nE051\tHSC_&_B-cell\nE052\tMyosat\nE053\tNeurosph\nE054\tNeurosph\nE055\tEpithelial\nE056\tEpithelial\nE057\tEpithelial\nE058\tEpithelial\nE059\tEpithelial\nE061\tEpithelial\nE062\tBlood_&_T-cell\nE063\tAdipose\nE065\tHeart\nE066\tOther\nE067\tBrain\nE068\tBrain\nE069\tBrain\nE070\tBrain\nE071\tBrain\nE072\tBrain\nE073\tBrain\nE074\tBrain\nE075\tDigestive\nE076\tSm._Muscle\nE077\tDigestive\nE078\tSm._Muscle\nE079\tDigestive\nE080\tOther\nE081\tBrain\nE082\tBrain\nE083\tHeart\nE084\tDigestive\nE085\tDigestive\nE086\tOther\nE087\tOther\nE088\tOther\nE089\tMuscle\nE090\tMuscle\nE091\tOther\nE092\tDigestive\nE093\tThymus\nE094\tDigestive\nE095\tHeart\nE096\tOther\nE097\tOther\nE098\tOther\nE099\tOther\nE100\tMuscle\nE101\tDigestive\nE102\tDigestive\nE103\tSm._Muscle\nE104\tHeart\nE105\tHeart\nE106\tDigestive\nE107\tMuscle\nE108\tMuscle\nE109\tDigestive\nE110\tDigestive\nE111\tSm._Muscle\nE112\tThymus\nE113\tOther\nE114\tENCODE2012\nE115\tENCODE2012\nE116\tENCODE2012\nE117\tENCODE2012\nE118\tENCODE2012\nE119\tENCODE2012\nE120\tENCODE2012\nE121\tENCODE2012\nE122\tENCODE2012\nE123\tENCODE2012\nE124\tENCODE2012\nE125\tENCODE2012\nE126\tENCODE2012\nE127\tENCODE2012\nE128\tENCODE2012\nE129\tENCODE2012\n"
  },
  {
    "path": "examples/rme/new_groups.txt",
    "content": "E001\tESC\nE002\tESC\nE003\tESC\nE004\tES-deriv\nE005\tES-deriv\nE006\tES-deriv\nE007\tES-deriv\nE008\tESC\nE009\tES-deriv\nE010\tES-deriv\nE011\tES-deriv\nE012\tES-deriv\nE013\tES-deriv\nE014\tESC\nE015\tESC\nE016\tESC\nE017\tLung\nE018\tiPSC\nE019\tiPSC\nE020\tiPSC\nE021\tiPSC\nE022\tiPSC\nE023\tMesench\nE024\tESC\nE025\tMesench\nE026\tMesench\nE027\tEpithelial\nE028\tEpithelial\nE029\tHSC & B-cell\nE030\tHSC & B-cell\nE031\tHSC & B-cell\nE032\tHSC & B-cell\nE033\tBlood & T-cell\nE034\tBlood & T-cell\nE035\tHSC & B-cell\nE036\tHSC & B-cell\nE037\tBlood & T-cell\nE038\tBlood & T-cell\nE039\tBlood & T-cell\nE040\tBlood & T-cell\nE041\tBlood & T-cell\nE042\tBlood & T-cell\nE043\tBlood & T-cell\nE044\tBlood & T-cell\nE045\tBlood & T-cell\nE046\tHSC & B-cell\nE047\tBlood & T-cell\nE048\tBlood & T-cell\nE049\tMesench\nE050\tHSC & B-cell\nE051\tHSC & B-cell\nE052\tMuscle\nE053\tNeurosph\nE054\tNeurosph\nE055\tEpithelial\nE056\tEpithelial\nE057\tEpithelial\nE058\tEpithelial\nE059\tEpithelial\nE061\tEpithelial\nE062\tBlood & T-cell\nE063\tOther\nE065\tHeart\nE066\tOther\nE067\tBrain\nE068\tBrain\nE069\tBrain\nE070\tBrain\nE071\tBrain\nE072\tBrain\nE073\tBrain\nE074\tBrain\nE075\tDigestive\nE076\tSm Muscle\nE077\tDigestive\nE078\tSm Muscle\nE079\tDigestive\nE080\tOther\nE081\tBrain\nE082\tBrain\nE083\tHeart\nE084\tDigestive\nE085\tDigestive\nE086\tOther\nE087\tOther\nE088\tOther\nE089\tMuscle\nE090\tMuscle\nE091\tOther\nE092\tDigestive\nE093\tThymus\nE094\tDigestive\nE095\tHeart\nE096\tOther\nE097\tOther\nE098\tOther\nE099\tOther\nE100\tMuscle\nE101\tDigestive\nE102\tDigestive\nE103\tSm Muscle\nE104\tHeart\nE105\tHeart\nE106\tDigestive\nE107\tMuscle\nE108\tMuscle\nE109\tDigestive\nE110\tDigestive\nE111\tSm Muscle\nE112\tThymus\nE113\tOther\nE114\tCancer Cell Line\nE115\tCancer Cell Line\nE116\tBlood & T-cell\nE117\tCancer Cell Line\nE118\tCancer Cell Line\nE119\tEpithelial\nE120\tMuscle\nE121\tMuscle\nE122\tEpithelial\nE123\tCancer Cell Line\nE124\tHSC & B-cell\nE125\tBrain\nE126\tEpithelial\nE127\tEpithelial\nE128\tLung\nE129\tOther\n"
  },
  {
    "path": "examples/rme/new_groups_names.txt",
    "content": " \n  \niPSC\n  \n \n \nThymus\n\n\nSm Muscle\n\n\n\n\n\n\nOther\n\n\n\n\n\n\n\n\nNeurosph\n\n\n\nMuscle\n\n\n\n\n\n\nMesench\n\n\nLung\n\n\nHeart\n\n\n\n\n\n\nHSC & B-cell\n\n\n\n\n\n\n\n\n\n\n\nEpithelial\n\n\n\n\n\n\n\n\nESC\n\n\n\n\n\n\n\n\nES-deriv\n\n\n\n\n\n\n\n\n\n\nDigestive\n\n\n\n\n\n\n\nCancer Cell Line\n\n\n\n\n\n\n\nBrain\n\n\n\n\n\n\n\n\n\n\n\n\nBlood & T-cell\n\n\n\n\n\n\n\n"
  },
  {
    "path": "examples/rme/rename.py",
    "content": "import toolshed as ts\nimport os.path as op\nimport gzip\nimport sys\nfrom itertools import imap\n\nif len(sys.argv) != 5:\n    sys.stderr.write('usage:\\t' + \\\n                     sys.argv[0] + \\\n                     ' <states> <EDACC names> <input dir> <output dir>')\n    sys.exit(1)\n\nstates_file_name = sys.argv[1]\nedacc_names_file_name = sys.argv[2]\ninput_dir = sys.argv[3]\noutput_dir = sys.argv[4]\n\nname_lookup = dict(x.strip().split() for x in ts.nopen(states_file_name))\nfile_lookup = dict(x.strip().split() for x in ts.nopen(edacc_names_file_name))\n\ndef process_file(fname):\n    out_files = {}\n    f = op.basename(fname).split(\"_\")[0]\n    fl = file_lookup[f]\n\n    tmpl = output_dir + fl + \"_%s.bed\"\n\n    for l in ts.nopen(fname):\n        toks = l.rstrip().split(\"\\t\", 4)\n        name = name_lookup[toks[3]]\n\n        fname = tmpl % name\n        if not fname in out_files:\n            out_files[fname] = open(fname, 'w')\n            print fname\n        out_files[fname].write(l)\n\n\nimport glob\nfiles = glob.glob(input_dir)\n\nimport multiprocessing\n#multiprocessing.Pool(12).map(process_file, files)\nfor i in imap(process_file, files):\n    pass\n"
  },
  {
    "path": "examples/rme/short_states.txt",
    "content": "TssA\nTssAFlnk\nTxFlnk\nTx\nTxWk\nEnhG\nEnh\nZNF/Rpts\nHet\nTssBiv\nBivFlnk\nEnhBiv\nReprPC\nReprPCWk\nQuies\n"
  },
  {
    "path": "examples/rme/states.txt",
    "content": "1_TssA\tActive_TSS\n2_TssAFlnk\tFlanking_Active_TSS\n3_TxFlnk\tTranscr_at_gene_5_and_3\n4_Tx\tStrong_transcription\n5_TxWk\tWeak_transcription\n6_EnhG\tGenic_enhancers\n7_Enh\tEnhancers\n8_ZNF/Rpts\tZNF_genes_and_repeats\n9_Het\tHeterochromatin\n10_TssBiv\tBivalent_Poised_TSS\n11_BivFlnk\tFlanking_Bivalent_TSS_Enh\n12_EnhBiv\tBivalent_Enhancer\n13_ReprPC\tRepressed_PolyComb\n14_ReprPCWk\tWeak_Repressed_PolyComb\n15_Quies\tQuiescent_Low\n"
  },
  {
    "path": "examples/rme/web/header.txt",
    "content": "\"dim1\":{ \"name\":\"State\",\n      \"num\":15,\n      \"vals\":[\"Active TSS\",\n              \"Bivalent Enhancer\",\n              \"Bivalent Poised TSS\",\n              \"Enhancers\",\n              \"Flanking Active TSS\",\n              \"Flanking Bivalent TSS Enh\",\n              \"Genic enhancers\",\n              \"Heterochromatin\",\n              \"Quiescent Low\",\n              \"Repressed PolyComb\",\n              \"Strong transcription\",\n              \"Transcr at gene 5 and 3\",\n              \"Wea epressed PolyComb\",\n              \"Weak transcription\",\n              \"ZNF genes and repeats\"]},\n\"dim2\":{ \"name\":\"Cell Line\",\n      \"num\":131,\n      \"vals\":[\"4star\",\n              \"A549 EtOH 0.02pct Lung Carcinoma\",\n              \"Adipose Derived Mesenchymal Stem Cell Cultured Cells\",\n              \"Adipose Nuclei\",\n              \"Adult Liver\",\n              \"Aorta\",\n              \"Bone Marrow Derived Mesenchymal Stem Cell Cultured Cells\",\n              \"Brain Angular Gyrus\",\n              \"Brain Anterior Caudate\",\n              \"Brain Cingulate Gyrus\",\n              \"Brain Germinal Matrix\",\n              \"Brain Hippocampus Middle\",\n              \"Brain Inferior Temporal Lobe\",\n              \"Brain Mid Frontal Lobe\",\n              \"Brain Substantia Nigra\",\n              \"Breast Myoepithelial Cells\",\n              \"Breast vHMEC\",\n              \"CD14 Primary Cells\",\n              \"CD15 Primary Cells\",\n              \"CD19 Primary Cells Cord BI\",\n              \"CD19 Primary Cells Peripheral UW\",\n              \"CD34 Cultured Cells\",\n              \"CD34 Primary Cells\",\n              \"CD3 Primary Cells Cord BI\",\n              \"CD3 Primary Cells Peripheral UW\",\n              \"CD4 Memory Primary Cells\",\n              \"CD4 Naive Primary Cells\",\n              \"CD4pp CD25  CD45RApp Naive Primary Cells\",\n              \"CD4pp CD25  CD45ROpp Memory Primary Cells\",\n              \"CD4pp CD25  IL17  PMA Ionomycin stimulated MACS purified Th Primary Cells\",\n              \"CD4pp CD25  IL17pp PMA Ionomcyin stimulated Th17 Primary Cells\",\n              \"CD4pp CD25  Th Primary Cells\",\n              \"CD4pp CD25int CD127pp Tmem Primary Cells\",\n              \"CD4pp CD25pp CD127  Treg Primary Cells\",\n              \"CD56 Primary Cells\",\n              \"CD8 Memory Primary Cells\",\n              \"CD8 Naive Primary Cells\",\n              \"Chondrocytes from Bone Marrow Derived Mesenchymal Stem Cell Cultured Cells\",\n              \"Colon Smooth Muscle\",\n              \"Colonic Mucosa\",\n              \"Dnd41 TCell Leukemia\",\n              \"Duodenum Mucosa\",\n              \"Duodenum Smooth Muscle\",\n              \"ES I3 Cell Line\",\n              \"ES WA7 Cell Line\",\n              \"Esophagus\",\n              \"Fetal Adrenal Gland\",\n              \"Fetal Brain Female\",\n              \"Fetal Brain Male\",\n              \"Fetal Heart\",\n              \"Fetal Intestine Large\",\n              \"Fetal Intestine Small\",\n              \"Fetal Kidney\",\n              \"Fetal Lung\",\n              \"Fetal Lung Active TSS\",\n              \"Fetal Muscle Leg\",\n              \"Fetal Muscle Leg Active TSS\",\n              \"Fetal Muscle Trun epressed PolyComb\",\n              \"Fetal Muscle Trunk\",\n              \"Fetal Placenta\",\n              \"Fetal Stomach\",\n              \"Fetal Thymus\",\n              \"GM12878 Lymphoblastoid\",\n              \"Gastric\",\n              \"H1 BMP4 Derived Mesendoderm Cultured Cells\",\n              \"H1 BMP4 Derived Trophoblast Cultured Cells\",\n              \"H1 Cell Line\",\n              \"H1 Derived Mesenchymal Stem Cells\",\n              \"H1 Derived Neuronal Progenitor Cultured Cells\",\n              \"H9 Cell Line\",\n              \"H9 Derived Neuron Cultured Cells\",\n              \"H9 Derived Neuronal Progenitor Cultured Cells\",\n              \"HMEC Mammary Epithelial\",\n              \"HSMM Skeletal Muscle Myoblasts\",\n              \"HSMMtube Skeletal Muscle Myotubes Derived from HSMM\",\n              \"HUES48 Cell Line\",\n              \"HUES64 Cell Line\",\n              \"HUES6 Cell Line\",\n              \"HUVEC Umbilical Vein Endothelial Cells\",\n              \"HeLa S3 Cervical Carcinoma\",\n              \"HepG2 Hepatocellular Carcinoma\",\n              \"IMR90 Cell Line\",\n              \"K562 Leukemia\",\n              \"Left Ventricle\",\n              \"Lung\",\n              \"Lung Active TSS\",\n              \"Mesenchymal Stem Cell Derived Adipocyte Cultured Cells\",\n              \"Mobilized CD34 Primary Cells Female\",\n              \"Mobilized CD34 Primary Cells Male\",\n              \"Monocytes CD14pp RO01746\",\n              \"Muscle Satellite Cultured Cells\",\n              \"NHDF Ad Adult Dermal Fibroblasts\",\n              \"NHEK Epidermal Keratinocytes\",\n              \"NHLF Lung Fibroblasts\",\n              \"NH A Astrocytes\",\n              \"Neurosphere Cultured Cells Cortex Derived\",\n              \"Neurosphere Cultured Cells Ganglionic Eminence Derived\",\n              \"Osteoblasts\",\n              \"Ovary\",\n              \"Pancreas\",\n              \"Pancreatic Islets\",\n              \"Penis Foreskin Fibroblast Primary Cells skin01\",\n              \"Penis Foreskin Fibroblast Primary Cells skin02\",\n              \"Penis Foreskin Keratinocyte Primary Cells skin02\",\n              \"Penis Foreskin Keratinocyte Primary Cells skin03\",\n              \"Penis Foreskin Melanocyte Primary Cells skin01\",\n              \"Penis Foreskin Melanocyte Primary Cells skin03\",\n              \"Peripheral Blood Mononuclear Primary Cells\",\n              \"Placenta Amnion\",\n              \"Psoas Muscle\",\n              \"Rectal Mucosa.Donor 29\",\n              \"Rectal Mucosa.Donor 31\",\n              \"Rectal Smooth Muscle\",\n              \"Right Atrium\",\n              \"Right Ventricle\",\n              \"Sigmoid Colon\",\n              \"Skeletal Muscle Female\",\n              \"Skeletal Muscle Male\",\n              \"Small Intestine\",\n              \"Spleen\",\n              \"Stomach Mucosa\",\n              \"Stomach Smooth Muscle\",\n              \"Thymus\",\n              \"hESC Derived CD184pp Endoderm Cultured Cells\",\n              \"hESC Derived CD56pp Ectoderm Cultured Cells\",\n              \"hESC Derived CD56pp Mesoderm Cultured Cells\",\n              \"iPS 15b Cell Line\",\n              \"iPS 18 Cell Line\",\n              \"iPS 20b Cell Line\",\n              \"iPS DF 19.11 Cell Line\",\n              \"iPS DF 6.9 Cell Line\"]},\n"
  },
  {
    "path": "examples/rme/web/track_names.txt",
    "content": "\"dim1\":\"4star\",\"dim2\":\"Active TSS\"\n\"dim1\":\"4star\",\"dim2\":\"Bivalent Enhancer\"\n\"dim1\":\"4star\",\"dim2\":\"Bivalent Poised TSS\"\n\"dim1\":\"4star\",\"dim2\":\"Enhancers\"\n\"dim1\":\"4star\",\"dim2\":\"Flanking Active TSS\"\n\"dim1\":\"4star\",\"dim2\":\"Flanking Bivalent TSS Enh\"\n\"dim1\":\"4star\",\"dim2\":\"Genic enhancers\"\n\"dim1\":\"4star\",\"dim2\":\"Heterochromatin\"\n\"dim1\":\"4star\",\"dim2\":\"Quiescent Low\"\n\"dim1\":\"4star\",\"dim2\":\"Repressed PolyComb\"\n\"dim1\":\"4star\",\"dim2\":\"Strong transcription\"\n\"dim1\":\"4star\",\"dim2\":\"Transcr at gene 5 and 3\"\n\"dim1\":\"4star\",\"dim2\":\"Wea epressed PolyComb\"\n\"dim1\":\"4star\",\"dim2\":\"Weak transcription\"\n\"dim1\":\"4star\",\"dim2\":\"ZNF genes and repeats\"\n\"dim1\":\"A549 EtOH 0.02pct Lung Carcinoma\",\"dim2\":\"Active TSS\"\n\"dim1\":\"A549 EtOH 0.02pct Lung Carcinoma\",\"dim2\":\"Bivalent Enhancer\"\n\"dim1\":\"A549 EtOH 0.02pct Lung Carcinoma\",\"dim2\":\"Bivalent Poised TSS\"\n\"dim1\":\"A549 EtOH 0.02pct Lung Carcinoma\",\"dim2\":\"Enhancers\"\n\"dim1\":\"A549 EtOH 0.02pct Lung Carcinoma\",\"dim2\":\"Flanking Active TSS\"\n\"dim1\":\"A549 EtOH 0.02pct Lung Carcinoma\",\"dim2\":\"Flanking Bivalent TSS Enh\"\n\"dim1\":\"A549 EtOH 0.02pct Lung Carcinoma\",\"dim2\":\"Genic enhancers\"\n\"dim1\":\"A549 EtOH 0.02pct Lung Carcinoma\",\"dim2\":\"Heterochromatin\"\n\"dim1\":\"A549 EtOH 0.02pct Lung Carcinoma\",\"dim2\":\"Quiescent Low\"\n\"dim1\":\"A549 EtOH 0.02pct Lung Carcinoma\",\"dim2\":\"Repressed PolyComb\"\n\"dim1\":\"A549 EtOH 0.02pct Lung Carcinoma\",\"dim2\":\"Strong transcription\"\n\"dim1\":\"A549 EtOH 0.02pct Lung Carcinoma\",\"dim2\":\"Transcr at gene 5 and 3\"\n\"dim1\":\"A549 EtOH 0.02pct Lung Carcinoma\",\"dim2\":\"Wea epressed PolyComb\"\n\"dim1\":\"A549 EtOH 0.02pct Lung Carcinoma\",\"dim2\":\"Weak transcription\"\n\"dim1\":\"A549 EtOH 0.02pct Lung Carcinoma\",\"dim2\":\"ZNF genes and repeats\"\n\"dim1\":\"Adipose Derived Mesenchymal Stem Cell Cultured Cells\",\"dim2\":\"Active TSS\"\n\"dim1\":\"Adipose Derived Mesenchymal Stem Cell Cultured Cells\",\"dim2\":\"Bivalent Enhancer\"\n\"dim1\":\"Adipose Derived Mesenchymal Stem Cell Cultured Cells\",\"dim2\":\"Bivalent Poised TSS\"\n\"dim1\":\"Adipose Derived Mesenchymal Stem Cell Cultured Cells\",\"dim2\":\"Enhancers\"\n\"dim1\":\"Adipose Derived Mesenchymal Stem Cell Cultured Cells\",\"dim2\":\"Flanking Active TSS\"\n\"dim1\":\"Adipose Derived Mesenchymal Stem Cell Cultured Cells\",\"dim2\":\"Flanking Bivalent TSS Enh\"\n\"dim1\":\"Adipose Derived Mesenchymal Stem Cell Cultured Cells\",\"dim2\":\"Genic enhancers\"\n\"dim1\":\"Adipose Derived Mesenchymal Stem Cell Cultured Cells\",\"dim2\":\"Heterochromatin\"\n\"dim1\":\"Adipose Derived Mesenchymal Stem Cell Cultured Cells\",\"dim2\":\"Quiescent Low\"\n\"dim1\":\"Adipose Derived Mesenchymal Stem Cell Cultured Cells\",\"dim2\":\"Repressed PolyComb\"\n\"dim1\":\"Adipose Derived Mesenchymal Stem Cell Cultured Cells\",\"dim2\":\"Strong transcription\"\n\"dim1\":\"Adipose Derived Mesenchymal Stem Cell Cultured Cells\",\"dim2\":\"Transcr at gene 5 and 3\"\n\"dim1\":\"Adipose Derived Mesenchymal Stem Cell Cultured Cells\",\"dim2\":\"Wea epressed PolyComb\"\n\"dim1\":\"Adipose Derived Mesenchymal Stem Cell Cultured Cells\",\"dim2\":\"Weak transcription\"\n\"dim1\":\"Adipose Derived Mesenchymal Stem Cell Cultured Cells\",\"dim2\":\"ZNF genes and repeats\"\n\"dim1\":\"Adipose Nuclei\",\"dim2\":\"Active TSS\"\n\"dim1\":\"Adipose Nuclei\",\"dim2\":\"Bivalent Enhancer\"\n\"dim1\":\"Adipose Nuclei\",\"dim2\":\"Bivalent Poised TSS\"\n\"dim1\":\"Adipose Nuclei\",\"dim2\":\"Enhancers\"\n\"dim1\":\"Adipose Nuclei\",\"dim2\":\"Flanking Active TSS\"\n\"dim1\":\"Adipose Nuclei\",\"dim2\":\"Flanking Bivalent TSS Enh\"\n\"dim1\":\"Adipose Nuclei\",\"dim2\":\"Genic enhancers\"\n\"dim1\":\"Adipose Nuclei\",\"dim2\":\"Heterochromatin\"\n\"dim1\":\"Adipose Nuclei\",\"dim2\":\"Quiescent Low\"\n\"dim1\":\"Adipose Nuclei\",\"dim2\":\"Repressed PolyComb\"\n\"dim1\":\"Adipose Nuclei\",\"dim2\":\"Strong transcription\"\n\"dim1\":\"Adipose Nuclei\",\"dim2\":\"Transcr at gene 5 and 3\"\n\"dim1\":\"Adipose Nuclei\",\"dim2\":\"Wea epressed PolyComb\"\n\"dim1\":\"Adipose Nuclei\",\"dim2\":\"Weak transcription\"\n\"dim1\":\"Adipose Nuclei\",\"dim2\":\"ZNF genes and repeats\"\n\"dim1\":\"Adult Liver\",\"dim2\":\"Active TSS\"\n\"dim1\":\"Adult Liver\",\"dim2\":\"Bivalent Enhancer\"\n\"dim1\":\"Adult Liver\",\"dim2\":\"Bivalent Poised TSS\"\n\"dim1\":\"Adult Liver\",\"dim2\":\"Enhancers\"\n\"dim1\":\"Adult Liver\",\"dim2\":\"Flanking Active TSS\"\n\"dim1\":\"Adult Liver\",\"dim2\":\"Flanking Bivalent TSS Enh\"\n\"dim1\":\"Adult Liver\",\"dim2\":\"Genic enhancers\"\n\"dim1\":\"Adult Liver\",\"dim2\":\"Heterochromatin\"\n\"dim1\":\"Adult Liver\",\"dim2\":\"Quiescent Low\"\n\"dim1\":\"Adult Liver\",\"dim2\":\"Repressed PolyComb\"\n\"dim1\":\"Adult Liver\",\"dim2\":\"Strong transcription\"\n\"dim1\":\"Adult Liver\",\"dim2\":\"Transcr at gene 5 and 3\"\n\"dim1\":\"Adult Liver\",\"dim2\":\"Wea epressed PolyComb\"\n\"dim1\":\"Adult Liver\",\"dim2\":\"Weak transcription\"\n\"dim1\":\"Adult Liver\",\"dim2\":\"ZNF genes and repeats\"\n\"dim1\":\"Aorta\",\"dim2\":\"Active TSS\"\n\"dim1\":\"Aorta\",\"dim2\":\"Bivalent Enhancer\"\n\"dim1\":\"Aorta\",\"dim2\":\"Bivalent Poised TSS\"\n\"dim1\":\"Aorta\",\"dim2\":\"Enhancers\"\n\"dim1\":\"Aorta\",\"dim2\":\"Flanking Active TSS\"\n\"dim1\":\"Aorta\",\"dim2\":\"Flanking Bivalent TSS Enh\"\n\"dim1\":\"Aorta\",\"dim2\":\"Genic enhancers\"\n\"dim1\":\"Aorta\",\"dim2\":\"Heterochromatin\"\n\"dim1\":\"Aorta\",\"dim2\":\"Quiescent Low\"\n\"dim1\":\"Aorta\",\"dim2\":\"Repressed PolyComb\"\n\"dim1\":\"Aorta\",\"dim2\":\"Strong transcription\"\n\"dim1\":\"Aorta\",\"dim2\":\"Transcr at gene 5 and 3\"\n\"dim1\":\"Aorta\",\"dim2\":\"Wea epressed PolyComb\"\n\"dim1\":\"Aorta\",\"dim2\":\"Weak transcription\"\n\"dim1\":\"Aorta\",\"dim2\":\"ZNF genes and repeats\"\n\"dim1\":\"Bone Marrow Derived Mesenchymal Stem Cell Cultured Cells\",\"dim2\":\"Active TSS\"\n\"dim1\":\"Bone Marrow Derived Mesenchymal Stem Cell Cultured Cells\",\"dim2\":\"Bivalent Enhancer\"\n\"dim1\":\"Bone Marrow Derived Mesenchymal Stem Cell Cultured Cells\",\"dim2\":\"Bivalent Poised TSS\"\n\"dim1\":\"Bone Marrow Derived Mesenchymal Stem Cell Cultured Cells\",\"dim2\":\"Enhancers\"\n\"dim1\":\"Bone Marrow Derived Mesenchymal Stem Cell Cultured Cells\",\"dim2\":\"Flanking Active TSS\"\n\"dim1\":\"Bone Marrow Derived Mesenchymal Stem Cell Cultured Cells\",\"dim2\":\"Flanking Bivalent TSS Enh\"\n\"dim1\":\"Bone Marrow Derived Mesenchymal Stem Cell Cultured Cells\",\"dim2\":\"Genic enhancers\"\n\"dim1\":\"Bone Marrow Derived Mesenchymal Stem Cell Cultured Cells\",\"dim2\":\"Heterochromatin\"\n\"dim1\":\"Bone Marrow Derived Mesenchymal Stem Cell Cultured Cells\",\"dim2\":\"Quiescent Low\"\n\"dim1\":\"Bone Marrow Derived Mesenchymal Stem Cell Cultured Cells\",\"dim2\":\"Repressed PolyComb\"\n\"dim1\":\"Bone Marrow Derived Mesenchymal Stem Cell Cultured Cells\",\"dim2\":\"Strong transcription\"\n\"dim1\":\"Bone Marrow Derived Mesenchymal Stem Cell Cultured Cells\",\"dim2\":\"Transcr at gene 5 and 3\"\n\"dim1\":\"Bone Marrow Derived Mesenchymal Stem Cell Cultured Cells\",\"dim2\":\"Wea epressed PolyComb\"\n\"dim1\":\"Bone Marrow Derived Mesenchymal Stem Cell Cultured Cells\",\"dim2\":\"Weak transcription\"\n\"dim1\":\"Bone Marrow Derived Mesenchymal Stem Cell Cultured Cells\",\"dim2\":\"ZNF genes and repeats\"\n\"dim1\":\"Brain Angular Gyrus\",\"dim2\":\"Active TSS\"\n\"dim1\":\"Brain Angular Gyrus\",\"dim2\":\"Bivalent Enhancer\"\n\"dim1\":\"Brain Angular Gyrus\",\"dim2\":\"Bivalent Poised TSS\"\n\"dim1\":\"Brain Angular Gyrus\",\"dim2\":\"Enhancers\"\n\"dim1\":\"Brain Angular Gyrus\",\"dim2\":\"Flanking Active TSS\"\n\"dim1\":\"Brain Angular Gyrus\",\"dim2\":\"Flanking Bivalent TSS Enh\"\n\"dim1\":\"Brain Angular Gyrus\",\"dim2\":\"Genic enhancers\"\n\"dim1\":\"Brain Angular Gyrus\",\"dim2\":\"Heterochromatin\"\n\"dim1\":\"Brain Angular Gyrus\",\"dim2\":\"Quiescent Low\"\n\"dim1\":\"Brain Angular Gyrus\",\"dim2\":\"Repressed PolyComb\"\n\"dim1\":\"Brain Angular Gyrus\",\"dim2\":\"Strong transcription\"\n\"dim1\":\"Brain Angular Gyrus\",\"dim2\":\"Transcr at gene 5 and 3\"\n\"dim1\":\"Brain Angular Gyrus\",\"dim2\":\"Wea epressed PolyComb\"\n\"dim1\":\"Brain Angular Gyrus\",\"dim2\":\"Weak transcription\"\n\"dim1\":\"Brain Angular Gyrus\",\"dim2\":\"ZNF genes and repeats\"\n\"dim1\":\"Brain Anterior Caudate\",\"dim2\":\"Active TSS\"\n\"dim1\":\"Brain Anterior Caudate\",\"dim2\":\"Bivalent Enhancer\"\n\"dim1\":\"Brain Anterior Caudate\",\"dim2\":\"Bivalent Poised TSS\"\n\"dim1\":\"Brain Anterior Caudate\",\"dim2\":\"Enhancers\"\n\"dim1\":\"Brain Anterior Caudate\",\"dim2\":\"Flanking Active TSS\"\n\"dim1\":\"Brain Anterior Caudate\",\"dim2\":\"Flanking Bivalent TSS Enh\"\n\"dim1\":\"Brain Anterior Caudate\",\"dim2\":\"Genic enhancers\"\n\"dim1\":\"Brain Anterior Caudate\",\"dim2\":\"Heterochromatin\"\n\"dim1\":\"Brain Anterior Caudate\",\"dim2\":\"Quiescent Low\"\n\"dim1\":\"Brain Anterior Caudate\",\"dim2\":\"Repressed PolyComb\"\n\"dim1\":\"Brain Anterior Caudate\",\"dim2\":\"Strong transcription\"\n\"dim1\":\"Brain Anterior Caudate\",\"dim2\":\"Transcr at gene 5 and 3\"\n\"dim1\":\"Brain Anterior Caudate\",\"dim2\":\"Wea epressed PolyComb\"\n\"dim1\":\"Brain Anterior Caudate\",\"dim2\":\"Weak transcription\"\n\"dim1\":\"Brain Anterior Caudate\",\"dim2\":\"ZNF genes and repeats\"\n\"dim1\":\"Brain Cingulate Gyrus\",\"dim2\":\"Active TSS\"\n\"dim1\":\"Brain Cingulate Gyrus\",\"dim2\":\"Bivalent Enhancer\"\n\"dim1\":\"Brain Cingulate Gyrus\",\"dim2\":\"Bivalent Poised TSS\"\n\"dim1\":\"Brain Cingulate Gyrus\",\"dim2\":\"Enhancers\"\n\"dim1\":\"Brain Cingulate Gyrus\",\"dim2\":\"Flanking Active TSS\"\n\"dim1\":\"Brain Cingulate Gyrus\",\"dim2\":\"Flanking Bivalent TSS Enh\"\n\"dim1\":\"Brain Cingulate Gyrus\",\"dim2\":\"Genic enhancers\"\n\"dim1\":\"Brain Cingulate Gyrus\",\"dim2\":\"Heterochromatin\"\n\"dim1\":\"Brain Cingulate Gyrus\",\"dim2\":\"Quiescent Low\"\n\"dim1\":\"Brain Cingulate Gyrus\",\"dim2\":\"Repressed PolyComb\"\n\"dim1\":\"Brain Cingulate Gyrus\",\"dim2\":\"Strong transcription\"\n\"dim1\":\"Brain Cingulate Gyrus\",\"dim2\":\"Transcr at gene 5 and 3\"\n\"dim1\":\"Brain Cingulate Gyrus\",\"dim2\":\"Wea epressed PolyComb\"\n\"dim1\":\"Brain Cingulate Gyrus\",\"dim2\":\"Weak transcription\"\n\"dim1\":\"Brain Cingulate Gyrus\",\"dim2\":\"ZNF genes and repeats\"\n\"dim1\":\"Brain Germinal Matrix\",\"dim2\":\"Active TSS\"\n\"dim1\":\"Brain Germinal Matrix\",\"dim2\":\"Bivalent Enhancer\"\n\"dim1\":\"Brain Germinal Matrix\",\"dim2\":\"Bivalent Poised TSS\"\n\"dim1\":\"Brain Germinal Matrix\",\"dim2\":\"Enhancers\"\n\"dim1\":\"Brain Germinal Matrix\",\"dim2\":\"Flanking Active TSS\"\n\"dim1\":\"Brain Germinal Matrix\",\"dim2\":\"Flanking Bivalent TSS Enh\"\n\"dim1\":\"Brain Germinal Matrix\",\"dim2\":\"Genic enhancers\"\n\"dim1\":\"Brain Germinal Matrix\",\"dim2\":\"Heterochromatin\"\n\"dim1\":\"Brain Germinal Matrix\",\"dim2\":\"Quiescent Low\"\n\"dim1\":\"Brain Germinal Matrix\",\"dim2\":\"Repressed PolyComb\"\n\"dim1\":\"Brain Germinal Matrix\",\"dim2\":\"Strong transcription\"\n\"dim1\":\"Brain Germinal Matrix\",\"dim2\":\"Transcr at gene 5 and 3\"\n\"dim1\":\"Brain Germinal Matrix\",\"dim2\":\"Wea epressed PolyComb\"\n\"dim1\":\"Brain Germinal Matrix\",\"dim2\":\"Weak transcription\"\n\"dim1\":\"Brain Germinal Matrix\",\"dim2\":\"ZNF genes and repeats\"\n\"dim1\":\"Brain Hippocampus Middle\",\"dim2\":\"Active TSS\"\n\"dim1\":\"Brain Hippocampus Middle\",\"dim2\":\"Bivalent Enhancer\"\n\"dim1\":\"Brain Hippocampus Middle\",\"dim2\":\"Bivalent Poised TSS\"\n\"dim1\":\"Brain Hippocampus Middle\",\"dim2\":\"Enhancers\"\n\"dim1\":\"Brain Hippocampus Middle\",\"dim2\":\"Flanking Active TSS\"\n\"dim1\":\"Brain Hippocampus Middle\",\"dim2\":\"Flanking Bivalent TSS Enh\"\n\"dim1\":\"Brain Hippocampus Middle\",\"dim2\":\"Genic enhancers\"\n\"dim1\":\"Brain Hippocampus Middle\",\"dim2\":\"Heterochromatin\"\n\"dim1\":\"Brain Hippocampus Middle\",\"dim2\":\"Quiescent Low\"\n\"dim1\":\"Brain Hippocampus Middle\",\"dim2\":\"Repressed PolyComb\"\n\"dim1\":\"Brain Hippocampus Middle\",\"dim2\":\"Strong transcription\"\n\"dim1\":\"Brain Hippocampus Middle\",\"dim2\":\"Transcr at gene 5 and 3\"\n\"dim1\":\"Brain Hippocampus Middle\",\"dim2\":\"Wea epressed PolyComb\"\n\"dim1\":\"Brain Hippocampus Middle\",\"dim2\":\"Weak transcription\"\n\"dim1\":\"Brain Hippocampus Middle\",\"dim2\":\"ZNF genes and repeats\"\n\"dim1\":\"Brain Inferior Temporal Lobe\",\"dim2\":\"Active TSS\"\n\"dim1\":\"Brain Inferior Temporal Lobe\",\"dim2\":\"Bivalent Enhancer\"\n\"dim1\":\"Brain Inferior Temporal Lobe\",\"dim2\":\"Bivalent Poised TSS\"\n\"dim1\":\"Brain Inferior Temporal Lobe\",\"dim2\":\"Enhancers\"\n\"dim1\":\"Brain Inferior Temporal Lobe\",\"dim2\":\"Flanking Active TSS\"\n\"dim1\":\"Brain Inferior Temporal Lobe\",\"dim2\":\"Flanking Bivalent TSS Enh\"\n\"dim1\":\"Brain Inferior Temporal Lobe\",\"dim2\":\"Genic enhancers\"\n\"dim1\":\"Brain Inferior Temporal Lobe\",\"dim2\":\"Heterochromatin\"\n\"dim1\":\"Brain Inferior Temporal Lobe\",\"dim2\":\"Quiescent Low\"\n\"dim1\":\"Brain Inferior Temporal Lobe\",\"dim2\":\"Repressed PolyComb\"\n\"dim1\":\"Brain Inferior Temporal Lobe\",\"dim2\":\"Strong transcription\"\n\"dim1\":\"Brain Inferior Temporal Lobe\",\"dim2\":\"Transcr at gene 5 and 3\"\n\"dim1\":\"Brain Inferior Temporal Lobe\",\"dim2\":\"Wea epressed PolyComb\"\n\"dim1\":\"Brain Inferior Temporal Lobe\",\"dim2\":\"Weak transcription\"\n\"dim1\":\"Brain Inferior Temporal Lobe\",\"dim2\":\"ZNF genes and repeats\"\n\"dim1\":\"Brain Mid Frontal Lobe\",\"dim2\":\"Active TSS\"\n\"dim1\":\"Brain Mid Frontal Lobe\",\"dim2\":\"Bivalent Enhancer\"\n\"dim1\":\"Brain Mid Frontal Lobe\",\"dim2\":\"Bivalent Poised TSS\"\n\"dim1\":\"Brain Mid Frontal Lobe\",\"dim2\":\"Enhancers\"\n\"dim1\":\"Brain Mid Frontal Lobe\",\"dim2\":\"Flanking Active TSS\"\n\"dim1\":\"Brain Mid Frontal Lobe\",\"dim2\":\"Flanking Bivalent TSS Enh\"\n\"dim1\":\"Brain Mid Frontal Lobe\",\"dim2\":\"Genic enhancers\"\n\"dim1\":\"Brain Mid Frontal Lobe\",\"dim2\":\"Heterochromatin\"\n\"dim1\":\"Brain Mid Frontal Lobe\",\"dim2\":\"Quiescent Low\"\n\"dim1\":\"Brain Mid Frontal Lobe\",\"dim2\":\"Repressed PolyComb\"\n\"dim1\":\"Brain Mid Frontal Lobe\",\"dim2\":\"Strong transcription\"\n\"dim1\":\"Brain Mid Frontal Lobe\",\"dim2\":\"Transcr at gene 5 and 3\"\n\"dim1\":\"Brain Mid Frontal Lobe\",\"dim2\":\"Wea epressed PolyComb\"\n\"dim1\":\"Brain Mid Frontal Lobe\",\"dim2\":\"Weak transcription\"\n\"dim1\":\"Brain Mid Frontal Lobe\",\"dim2\":\"ZNF genes and repeats\"\n\"dim1\":\"Brain Substantia Nigra\",\"dim2\":\"Active TSS\"\n\"dim1\":\"Brain Substantia Nigra\",\"dim2\":\"Bivalent Enhancer\"\n\"dim1\":\"Brain Substantia Nigra\",\"dim2\":\"Bivalent Poised TSS\"\n\"dim1\":\"Brain Substantia Nigra\",\"dim2\":\"Enhancers\"\n\"dim1\":\"Brain Substantia Nigra\",\"dim2\":\"Flanking Active TSS\"\n\"dim1\":\"Brain Substantia Nigra\",\"dim2\":\"Flanking Bivalent TSS Enh\"\n\"dim1\":\"Brain Substantia Nigra\",\"dim2\":\"Genic enhancers\"\n\"dim1\":\"Brain Substantia Nigra\",\"dim2\":\"Heterochromatin\"\n\"dim1\":\"Brain Substantia Nigra\",\"dim2\":\"Quiescent Low\"\n\"dim1\":\"Brain Substantia Nigra\",\"dim2\":\"Repressed PolyComb\"\n\"dim1\":\"Brain Substantia Nigra\",\"dim2\":\"Strong transcription\"\n\"dim1\":\"Brain Substantia Nigra\",\"dim2\":\"Transcr at gene 5 and 3\"\n\"dim1\":\"Brain Substantia Nigra\",\"dim2\":\"Wea epressed PolyComb\"\n\"dim1\":\"Brain Substantia Nigra\",\"dim2\":\"Weak transcription\"\n\"dim1\":\"Brain Substantia Nigra\",\"dim2\":\"ZNF genes and repeats\"\n\"dim1\":\"Breast Myoepithelial Cells\",\"dim2\":\"Active TSS\"\n\"dim1\":\"Breast Myoepithelial Cells\",\"dim2\":\"Bivalent Enhancer\"\n\"dim1\":\"Breast Myoepithelial Cells\",\"dim2\":\"Bivalent Poised TSS\"\n\"dim1\":\"Breast Myoepithelial Cells\",\"dim2\":\"Enhancers\"\n\"dim1\":\"Breast Myoepithelial Cells\",\"dim2\":\"Flanking Active TSS\"\n\"dim1\":\"Breast Myoepithelial Cells\",\"dim2\":\"Flanking Bivalent TSS Enh\"\n\"dim1\":\"Breast Myoepithelial Cells\",\"dim2\":\"Genic enhancers\"\n\"dim1\":\"Breast Myoepithelial Cells\",\"dim2\":\"Heterochromatin\"\n\"dim1\":\"Breast Myoepithelial Cells\",\"dim2\":\"Quiescent Low\"\n\"dim1\":\"Breast Myoepithelial Cells\",\"dim2\":\"Repressed PolyComb\"\n\"dim1\":\"Breast Myoepithelial Cells\",\"dim2\":\"Strong transcription\"\n\"dim1\":\"Breast Myoepithelial Cells\",\"dim2\":\"Transcr at gene 5 and 3\"\n\"dim1\":\"Breast Myoepithelial Cells\",\"dim2\":\"Wea epressed PolyComb\"\n\"dim1\":\"Breast Myoepithelial Cells\",\"dim2\":\"Weak transcription\"\n\"dim1\":\"Breast Myoepithelial Cells\",\"dim2\":\"ZNF genes and repeats\"\n\"dim1\":\"Breast vHMEC\",\"dim2\":\"Active TSS\"\n\"dim1\":\"Breast vHMEC\",\"dim2\":\"Bivalent Enhancer\"\n\"dim1\":\"Breast vHMEC\",\"dim2\":\"Bivalent Poised TSS\"\n\"dim1\":\"Breast vHMEC\",\"dim2\":\"Enhancers\"\n\"dim1\":\"Breast vHMEC\",\"dim2\":\"Flanking Active TSS\"\n\"dim1\":\"Breast vHMEC\",\"dim2\":\"Flanking Bivalent TSS Enh\"\n\"dim1\":\"Breast vHMEC\",\"dim2\":\"Genic enhancers\"\n\"dim1\":\"Breast vHMEC\",\"dim2\":\"Heterochromatin\"\n\"dim1\":\"Breast vHMEC\",\"dim2\":\"Quiescent Low\"\n\"dim1\":\"Breast vHMEC\",\"dim2\":\"Repressed PolyComb\"\n\"dim1\":\"Breast vHMEC\",\"dim2\":\"Strong transcription\"\n\"dim1\":\"Breast vHMEC\",\"dim2\":\"Transcr at gene 5 and 3\"\n\"dim1\":\"Breast vHMEC\",\"dim2\":\"Wea epressed PolyComb\"\n\"dim1\":\"Breast vHMEC\",\"dim2\":\"Weak transcription\"\n\"dim1\":\"Breast vHMEC\",\"dim2\":\"ZNF genes and repeats\"\n\"dim1\":\"CD14 Primary Cells\",\"dim2\":\"Active TSS\"\n\"dim1\":\"CD14 Primary Cells\",\"dim2\":\"Bivalent Enhancer\"\n\"dim1\":\"CD14 Primary Cells\",\"dim2\":\"Bivalent Poised TSS\"\n\"dim1\":\"CD14 Primary Cells\",\"dim2\":\"Enhancers\"\n\"dim1\":\"CD14 Primary Cells\",\"dim2\":\"Flanking Active TSS\"\n\"dim1\":\"CD14 Primary Cells\",\"dim2\":\"Flanking Bivalent TSS Enh\"\n\"dim1\":\"CD14 Primary Cells\",\"dim2\":\"Genic enhancers\"\n\"dim1\":\"CD14 Primary Cells\",\"dim2\":\"Heterochromatin\"\n\"dim1\":\"CD14 Primary Cells\",\"dim2\":\"Quiescent Low\"\n\"dim1\":\"CD14 Primary Cells\",\"dim2\":\"Repressed PolyComb\"\n\"dim1\":\"CD14 Primary Cells\",\"dim2\":\"Strong transcription\"\n\"dim1\":\"CD14 Primary Cells\",\"dim2\":\"Transcr at gene 5 and 3\"\n\"dim1\":\"CD14 Primary Cells\",\"dim2\":\"Wea epressed PolyComb\"\n\"dim1\":\"CD14 Primary Cells\",\"dim2\":\"Weak transcription\"\n\"dim1\":\"CD14 Primary Cells\",\"dim2\":\"ZNF genes and repeats\"\n\"dim1\":\"CD15 Primary Cells\",\"dim2\":\"Active TSS\"\n\"dim1\":\"CD15 Primary Cells\",\"dim2\":\"Bivalent Enhancer\"\n\"dim1\":\"CD15 Primary Cells\",\"dim2\":\"Bivalent Poised TSS\"\n\"dim1\":\"CD15 Primary Cells\",\"dim2\":\"Enhancers\"\n\"dim1\":\"CD15 Primary Cells\",\"dim2\":\"Flanking Active TSS\"\n\"dim1\":\"CD15 Primary Cells\",\"dim2\":\"Flanking Bivalent TSS Enh\"\n\"dim1\":\"CD15 Primary Cells\",\"dim2\":\"Genic enhancers\"\n\"dim1\":\"CD15 Primary Cells\",\"dim2\":\"Heterochromatin\"\n\"dim1\":\"CD15 Primary Cells\",\"dim2\":\"Quiescent Low\"\n\"dim1\":\"CD15 Primary Cells\",\"dim2\":\"Repressed PolyComb\"\n\"dim1\":\"CD15 Primary Cells\",\"dim2\":\"Strong transcription\"\n\"dim1\":\"CD15 Primary Cells\",\"dim2\":\"Transcr at gene 5 and 3\"\n\"dim1\":\"CD15 Primary Cells\",\"dim2\":\"Wea epressed PolyComb\"\n\"dim1\":\"CD15 Primary Cells\",\"dim2\":\"Weak transcription\"\n\"dim1\":\"CD15 Primary Cells\",\"dim2\":\"ZNF genes and repeats\"\n\"dim1\":\"CD19 Primary Cells Cord BI\",\"dim2\":\"Active TSS\"\n\"dim1\":\"CD19 Primary Cells Cord BI\",\"dim2\":\"Bivalent Enhancer\"\n\"dim1\":\"CD19 Primary Cells Cord BI\",\"dim2\":\"Bivalent Poised TSS\"\n\"dim1\":\"CD19 Primary Cells Cord BI\",\"dim2\":\"Enhancers\"\n\"dim1\":\"CD19 Primary Cells Cord BI\",\"dim2\":\"Flanking Active TSS\"\n\"dim1\":\"CD19 Primary Cells Cord BI\",\"dim2\":\"Flanking Bivalent TSS Enh\"\n\"dim1\":\"CD19 Primary Cells Cord BI\",\"dim2\":\"Genic enhancers\"\n\"dim1\":\"CD19 Primary Cells Cord BI\",\"dim2\":\"Heterochromatin\"\n\"dim1\":\"CD19 Primary Cells Cord BI\",\"dim2\":\"Quiescent Low\"\n\"dim1\":\"CD19 Primary Cells Cord BI\",\"dim2\":\"Repressed PolyComb\"\n\"dim1\":\"CD19 Primary Cells Cord BI\",\"dim2\":\"Strong transcription\"\n\"dim1\":\"CD19 Primary Cells Cord BI\",\"dim2\":\"Transcr at gene 5 and 3\"\n\"dim1\":\"CD19 Primary Cells Cord BI\",\"dim2\":\"Wea epressed PolyComb\"\n\"dim1\":\"CD19 Primary Cells Cord BI\",\"dim2\":\"Weak transcription\"\n\"dim1\":\"CD19 Primary Cells Cord BI\",\"dim2\":\"ZNF genes and repeats\"\n\"dim1\":\"CD19 Primary Cells Peripheral UW\",\"dim2\":\"Active TSS\"\n\"dim1\":\"CD19 Primary Cells Peripheral UW\",\"dim2\":\"Bivalent Enhancer\"\n\"dim1\":\"CD19 Primary Cells Peripheral UW\",\"dim2\":\"Bivalent Poised TSS\"\n\"dim1\":\"CD19 Primary Cells Peripheral UW\",\"dim2\":\"Enhancers\"\n\"dim1\":\"CD19 Primary Cells Peripheral UW\",\"dim2\":\"Flanking Active TSS\"\n\"dim1\":\"CD19 Primary Cells Peripheral UW\",\"dim2\":\"Flanking Bivalent TSS Enh\"\n\"dim1\":\"CD19 Primary Cells Peripheral UW\",\"dim2\":\"Genic enhancers\"\n\"dim1\":\"CD19 Primary Cells Peripheral UW\",\"dim2\":\"Heterochromatin\"\n\"dim1\":\"CD19 Primary Cells Peripheral UW\",\"dim2\":\"Quiescent Low\"\n\"dim1\":\"CD19 Primary Cells Peripheral UW\",\"dim2\":\"Repressed PolyComb\"\n\"dim1\":\"CD19 Primary Cells Peripheral UW\",\"dim2\":\"Strong transcription\"\n\"dim1\":\"CD19 Primary Cells Peripheral UW\",\"dim2\":\"Transcr at gene 5 and 3\"\n\"dim1\":\"CD19 Primary Cells Peripheral UW\",\"dim2\":\"Wea epressed PolyComb\"\n\"dim1\":\"CD19 Primary Cells Peripheral UW\",\"dim2\":\"Weak transcription\"\n\"dim1\":\"CD19 Primary Cells Peripheral UW\",\"dim2\":\"ZNF genes and repeats\"\n\"dim1\":\"CD34 Cultured Cells\",\"dim2\":\"Active TSS\"\n\"dim1\":\"CD34 Cultured Cells\",\"dim2\":\"Bivalent Enhancer\"\n\"dim1\":\"CD34 Cultured Cells\",\"dim2\":\"Bivalent Poised TSS\"\n\"dim1\":\"CD34 Cultured Cells\",\"dim2\":\"Enhancers\"\n\"dim1\":\"CD34 Cultured Cells\",\"dim2\":\"Flanking Active TSS\"\n\"dim1\":\"CD34 Cultured Cells\",\"dim2\":\"Flanking Bivalent TSS Enh\"\n\"dim1\":\"CD34 Cultured Cells\",\"dim2\":\"Genic enhancers\"\n\"dim1\":\"CD34 Cultured Cells\",\"dim2\":\"Heterochromatin\"\n\"dim1\":\"CD34 Cultured Cells\",\"dim2\":\"Quiescent Low\"\n\"dim1\":\"CD34 Cultured Cells\",\"dim2\":\"Repressed PolyComb\"\n\"dim1\":\"CD34 Cultured Cells\",\"dim2\":\"Strong transcription\"\n\"dim1\":\"CD34 Cultured Cells\",\"dim2\":\"Transcr at gene 5 and 3\"\n\"dim1\":\"CD34 Cultured Cells\",\"dim2\":\"Wea epressed PolyComb\"\n\"dim1\":\"CD34 Cultured Cells\",\"dim2\":\"Weak transcription\"\n\"dim1\":\"CD34 Cultured Cells\",\"dim2\":\"ZNF genes and repeats\"\n\"dim1\":\"CD34 Primary Cells\",\"dim2\":\"Active TSS\"\n\"dim1\":\"CD34 Primary Cells\",\"dim2\":\"Bivalent Enhancer\"\n\"dim1\":\"CD34 Primary Cells\",\"dim2\":\"Bivalent Poised TSS\"\n\"dim1\":\"CD34 Primary Cells\",\"dim2\":\"Enhancers\"\n\"dim1\":\"CD34 Primary Cells\",\"dim2\":\"Flanking Active TSS\"\n\"dim1\":\"CD34 Primary Cells\",\"dim2\":\"Flanking Bivalent TSS Enh\"\n\"dim1\":\"CD34 Primary Cells\",\"dim2\":\"Genic enhancers\"\n\"dim1\":\"CD34 Primary Cells\",\"dim2\":\"Heterochromatin\"\n\"dim1\":\"CD34 Primary Cells\",\"dim2\":\"Quiescent Low\"\n\"dim1\":\"CD34 Primary Cells\",\"dim2\":\"Repressed PolyComb\"\n\"dim1\":\"CD34 Primary Cells\",\"dim2\":\"Strong transcription\"\n\"dim1\":\"CD34 Primary Cells\",\"dim2\":\"Transcr at gene 5 and 3\"\n\"dim1\":\"CD34 Primary Cells\",\"dim2\":\"Wea epressed PolyComb\"\n\"dim1\":\"CD34 Primary Cells\",\"dim2\":\"Weak transcription\"\n\"dim1\":\"CD34 Primary Cells\",\"dim2\":\"ZNF genes and repeats\"\n\"dim1\":\"CD3 Primary Cells Cord BI\",\"dim2\":\"Active TSS\"\n\"dim1\":\"CD3 Primary Cells Cord BI\",\"dim2\":\"Bivalent Enhancer\"\n\"dim1\":\"CD3 Primary Cells Cord BI\",\"dim2\":\"Bivalent Poised TSS\"\n\"dim1\":\"CD3 Primary Cells Cord BI\",\"dim2\":\"Enhancers\"\n\"dim1\":\"CD3 Primary Cells Cord BI\",\"dim2\":\"Flanking Active TSS\"\n\"dim1\":\"CD3 Primary Cells Cord BI\",\"dim2\":\"Flanking Bivalent TSS Enh\"\n\"dim1\":\"CD3 Primary Cells Cord BI\",\"dim2\":\"Genic enhancers\"\n\"dim1\":\"CD3 Primary Cells Cord BI\",\"dim2\":\"Heterochromatin\"\n\"dim1\":\"CD3 Primary Cells Cord BI\",\"dim2\":\"Quiescent Low\"\n\"dim1\":\"CD3 Primary Cells Cord BI\",\"dim2\":\"Repressed PolyComb\"\n\"dim1\":\"CD3 Primary Cells Cord BI\",\"dim2\":\"Strong transcription\"\n\"dim1\":\"CD3 Primary Cells Cord BI\",\"dim2\":\"Transcr at gene 5 and 3\"\n\"dim1\":\"CD3 Primary Cells Cord BI\",\"dim2\":\"Wea epressed PolyComb\"\n\"dim1\":\"CD3 Primary Cells Cord BI\",\"dim2\":\"Weak transcription\"\n\"dim1\":\"CD3 Primary Cells Cord BI\",\"dim2\":\"ZNF genes and repeats\"\n\"dim1\":\"CD3 Primary Cells Peripheral UW\",\"dim2\":\"Active TSS\"\n\"dim1\":\"CD3 Primary Cells Peripheral UW\",\"dim2\":\"Bivalent Enhancer\"\n\"dim1\":\"CD3 Primary Cells Peripheral UW\",\"dim2\":\"Bivalent Poised TSS\"\n\"dim1\":\"CD3 Primary Cells Peripheral UW\",\"dim2\":\"Enhancers\"\n\"dim1\":\"CD3 Primary Cells Peripheral UW\",\"dim2\":\"Flanking Active TSS\"\n\"dim1\":\"CD3 Primary Cells Peripheral UW\",\"dim2\":\"Flanking Bivalent TSS Enh\"\n\"dim1\":\"CD3 Primary Cells Peripheral UW\",\"dim2\":\"Genic enhancers\"\n\"dim1\":\"CD3 Primary Cells Peripheral UW\",\"dim2\":\"Heterochromatin\"\n\"dim1\":\"CD3 Primary Cells Peripheral UW\",\"dim2\":\"Quiescent Low\"\n\"dim1\":\"CD3 Primary Cells Peripheral UW\",\"dim2\":\"Repressed PolyComb\"\n\"dim1\":\"CD3 Primary Cells Peripheral UW\",\"dim2\":\"Strong transcription\"\n\"dim1\":\"CD3 Primary Cells Peripheral UW\",\"dim2\":\"Transcr at gene 5 and 3\"\n\"dim1\":\"CD3 Primary Cells Peripheral UW\",\"dim2\":\"Wea epressed PolyComb\"\n\"dim1\":\"CD3 Primary Cells Peripheral UW\",\"dim2\":\"Weak transcription\"\n\"dim1\":\"CD3 Primary Cells Peripheral UW\",\"dim2\":\"ZNF genes and repeats\"\n\"dim1\":\"CD4 Memory Primary Cells\",\"dim2\":\"Active TSS\"\n\"dim1\":\"CD4 Memory Primary Cells\",\"dim2\":\"Bivalent Enhancer\"\n\"dim1\":\"CD4 Memory Primary Cells\",\"dim2\":\"Bivalent Poised TSS\"\n\"dim1\":\"CD4 Memory Primary Cells\",\"dim2\":\"Enhancers\"\n\"dim1\":\"CD4 Memory Primary Cells\",\"dim2\":\"Flanking Active TSS\"\n\"dim1\":\"CD4 Memory Primary Cells\",\"dim2\":\"Flanking Bivalent TSS Enh\"\n\"dim1\":\"CD4 Memory Primary Cells\",\"dim2\":\"Genic enhancers\"\n\"dim1\":\"CD4 Memory Primary Cells\",\"dim2\":\"Heterochromatin\"\n\"dim1\":\"CD4 Memory Primary Cells\",\"dim2\":\"Quiescent Low\"\n\"dim1\":\"CD4 Memory Primary Cells\",\"dim2\":\"Repressed PolyComb\"\n\"dim1\":\"CD4 Memory Primary Cells\",\"dim2\":\"Strong transcription\"\n\"dim1\":\"CD4 Memory Primary Cells\",\"dim2\":\"Transcr at gene 5 and 3\"\n\"dim1\":\"CD4 Memory Primary Cells\",\"dim2\":\"Wea epressed PolyComb\"\n\"dim1\":\"CD4 Memory Primary Cells\",\"dim2\":\"Weak transcription\"\n\"dim1\":\"CD4 Memory Primary Cells\",\"dim2\":\"ZNF genes and repeats\"\n\"dim1\":\"CD4 Naive Primary Cells\",\"dim2\":\"Active TSS\"\n\"dim1\":\"CD4 Naive Primary Cells\",\"dim2\":\"Bivalent Enhancer\"\n\"dim1\":\"CD4 Naive Primary Cells\",\"dim2\":\"Bivalent Poised TSS\"\n\"dim1\":\"CD4 Naive Primary Cells\",\"dim2\":\"Enhancers\"\n\"dim1\":\"CD4 Naive Primary Cells\",\"dim2\":\"Flanking Active TSS\"\n\"dim1\":\"CD4 Naive Primary Cells\",\"dim2\":\"Flanking Bivalent TSS Enh\"\n\"dim1\":\"CD4 Naive Primary Cells\",\"dim2\":\"Genic enhancers\"\n\"dim1\":\"CD4 Naive Primary Cells\",\"dim2\":\"Heterochromatin\"\n\"dim1\":\"CD4 Naive Primary Cells\",\"dim2\":\"Quiescent Low\"\n\"dim1\":\"CD4 Naive Primary Cells\",\"dim2\":\"Repressed PolyComb\"\n\"dim1\":\"CD4 Naive Primary Cells\",\"dim2\":\"Strong transcription\"\n\"dim1\":\"CD4 Naive Primary Cells\",\"dim2\":\"Transcr at gene 5 and 3\"\n\"dim1\":\"CD4 Naive Primary Cells\",\"dim2\":\"Wea epressed PolyComb\"\n\"dim1\":\"CD4 Naive Primary Cells\",\"dim2\":\"Weak transcription\"\n\"dim1\":\"CD4 Naive Primary Cells\",\"dim2\":\"ZNF genes and repeats\"\n\"dim1\":\"CD4pp CD25  CD45RApp Naive Primary Cells\",\"dim2\":\"Active TSS\"\n\"dim1\":\"CD4pp CD25  CD45RApp Naive Primary Cells\",\"dim2\":\"Bivalent Enhancer\"\n\"dim1\":\"CD4pp CD25  CD45RApp Naive Primary Cells\",\"dim2\":\"Bivalent Poised TSS\"\n\"dim1\":\"CD4pp CD25  CD45RApp Naive Primary Cells\",\"dim2\":\"Enhancers\"\n\"dim1\":\"CD4pp CD25  CD45RApp Naive Primary Cells\",\"dim2\":\"Flanking Active TSS\"\n\"dim1\":\"CD4pp CD25  CD45RApp Naive Primary Cells\",\"dim2\":\"Flanking Bivalent TSS Enh\"\n\"dim1\":\"CD4pp CD25  CD45RApp Naive Primary Cells\",\"dim2\":\"Genic enhancers\"\n\"dim1\":\"CD4pp CD25  CD45RApp Naive Primary Cells\",\"dim2\":\"Heterochromatin\"\n\"dim1\":\"CD4pp CD25  CD45RApp Naive Primary Cells\",\"dim2\":\"Quiescent Low\"\n\"dim1\":\"CD4pp CD25  CD45RApp Naive Primary Cells\",\"dim2\":\"Repressed PolyComb\"\n\"dim1\":\"CD4pp CD25  CD45RApp Naive Primary Cells\",\"dim2\":\"Strong transcription\"\n\"dim1\":\"CD4pp CD25  CD45RApp Naive Primary Cells\",\"dim2\":\"Transcr at gene 5 and 3\"\n\"dim1\":\"CD4pp CD25  CD45RApp Naive Primary Cells\",\"dim2\":\"Wea epressed PolyComb\"\n\"dim1\":\"CD4pp CD25  CD45RApp Naive Primary Cells\",\"dim2\":\"Weak transcription\"\n\"dim1\":\"CD4pp CD25  CD45RApp Naive Primary Cells\",\"dim2\":\"ZNF genes and repeats\"\n\"dim1\":\"CD4pp CD25  CD45ROpp Memory Primary Cells\",\"dim2\":\"Active TSS\"\n\"dim1\":\"CD4pp CD25  CD45ROpp Memory Primary Cells\",\"dim2\":\"Bivalent Enhancer\"\n\"dim1\":\"CD4pp CD25  CD45ROpp Memory Primary Cells\",\"dim2\":\"Bivalent Poised TSS\"\n\"dim1\":\"CD4pp CD25  CD45ROpp Memory Primary Cells\",\"dim2\":\"Enhancers\"\n\"dim1\":\"CD4pp CD25  CD45ROpp Memory Primary Cells\",\"dim2\":\"Flanking Active TSS\"\n\"dim1\":\"CD4pp CD25  CD45ROpp Memory Primary Cells\",\"dim2\":\"Flanking Bivalent TSS Enh\"\n\"dim1\":\"CD4pp CD25  CD45ROpp Memory Primary Cells\",\"dim2\":\"Genic enhancers\"\n\"dim1\":\"CD4pp CD25  CD45ROpp Memory Primary Cells\",\"dim2\":\"Heterochromatin\"\n\"dim1\":\"CD4pp CD25  CD45ROpp Memory Primary Cells\",\"dim2\":\"Quiescent Low\"\n\"dim1\":\"CD4pp CD25  CD45ROpp Memory Primary Cells\",\"dim2\":\"Repressed PolyComb\"\n\"dim1\":\"CD4pp CD25  CD45ROpp Memory Primary Cells\",\"dim2\":\"Strong transcription\"\n\"dim1\":\"CD4pp CD25  CD45ROpp Memory Primary Cells\",\"dim2\":\"Transcr at gene 5 and 3\"\n\"dim1\":\"CD4pp CD25  CD45ROpp Memory Primary Cells\",\"dim2\":\"Wea epressed PolyComb\"\n\"dim1\":\"CD4pp CD25  CD45ROpp Memory Primary Cells\",\"dim2\":\"Weak transcription\"\n\"dim1\":\"CD4pp CD25  CD45ROpp Memory Primary Cells\",\"dim2\":\"ZNF genes and repeats\"\n\"dim1\":\"CD4pp CD25  IL17  PMA Ionomycin stimulated MACS purified Th Primary Cells\",\"dim2\":\"Active TSS\"\n\"dim1\":\"CD4pp CD25  IL17  PMA Ionomycin stimulated MACS purified Th Primary Cells\",\"dim2\":\"Bivalent Enhancer\"\n\"dim1\":\"CD4pp CD25  IL17  PMA Ionomycin stimulated MACS purified Th Primary Cells\",\"dim2\":\"Bivalent Poised TSS\"\n\"dim1\":\"CD4pp CD25  IL17  PMA Ionomycin stimulated MACS purified Th Primary Cells\",\"dim2\":\"Enhancers\"\n\"dim1\":\"CD4pp CD25  IL17  PMA Ionomycin stimulated MACS purified Th Primary Cells\",\"dim2\":\"Flanking Active TSS\"\n\"dim1\":\"CD4pp CD25  IL17  PMA Ionomycin stimulated MACS purified Th Primary Cells\",\"dim2\":\"Flanking Bivalent TSS Enh\"\n\"dim1\":\"CD4pp CD25  IL17  PMA Ionomycin stimulated MACS purified Th Primary Cells\",\"dim2\":\"Genic enhancers\"\n\"dim1\":\"CD4pp CD25  IL17  PMA Ionomycin stimulated MACS purified Th Primary Cells\",\"dim2\":\"Heterochromatin\"\n\"dim1\":\"CD4pp CD25  IL17  PMA Ionomycin stimulated MACS purified Th Primary Cells\",\"dim2\":\"Quiescent Low\"\n\"dim1\":\"CD4pp CD25  IL17  PMA Ionomycin stimulated MACS purified Th Primary Cells\",\"dim2\":\"Repressed PolyComb\"\n\"dim1\":\"CD4pp CD25  IL17  PMA Ionomycin stimulated MACS purified Th Primary Cells\",\"dim2\":\"Strong transcription\"\n\"dim1\":\"CD4pp CD25  IL17  PMA Ionomycin stimulated MACS purified Th Primary Cells\",\"dim2\":\"Transcr at gene 5 and 3\"\n\"dim1\":\"CD4pp CD25  IL17  PMA Ionomycin stimulated MACS purified Th Primary Cells\",\"dim2\":\"Wea epressed PolyComb\"\n\"dim1\":\"CD4pp CD25  IL17  PMA Ionomycin stimulated MACS purified Th Primary Cells\",\"dim2\":\"Weak transcription\"\n\"dim1\":\"CD4pp CD25  IL17  PMA Ionomycin stimulated MACS purified Th Primary Cells\",\"dim2\":\"ZNF genes and repeats\"\n\"dim1\":\"CD4pp CD25  IL17pp PMA Ionomcyin stimulated Th17 Primary Cells\",\"dim2\":\"Active TSS\"\n\"dim1\":\"CD4pp CD25  IL17pp PMA Ionomcyin stimulated Th17 Primary Cells\",\"dim2\":\"Bivalent Enhancer\"\n\"dim1\":\"CD4pp CD25  IL17pp PMA Ionomcyin stimulated Th17 Primary Cells\",\"dim2\":\"Bivalent Poised TSS\"\n\"dim1\":\"CD4pp CD25  IL17pp PMA Ionomcyin stimulated Th17 Primary Cells\",\"dim2\":\"Enhancers\"\n\"dim1\":\"CD4pp CD25  IL17pp PMA Ionomcyin stimulated Th17 Primary Cells\",\"dim2\":\"Flanking Active TSS\"\n\"dim1\":\"CD4pp CD25  IL17pp PMA Ionomcyin stimulated Th17 Primary Cells\",\"dim2\":\"Flanking Bivalent TSS Enh\"\n\"dim1\":\"CD4pp CD25  IL17pp PMA Ionomcyin stimulated Th17 Primary Cells\",\"dim2\":\"Genic enhancers\"\n\"dim1\":\"CD4pp CD25  IL17pp PMA Ionomcyin stimulated Th17 Primary Cells\",\"dim2\":\"Heterochromatin\"\n\"dim1\":\"CD4pp CD25  IL17pp PMA Ionomcyin stimulated Th17 Primary Cells\",\"dim2\":\"Quiescent Low\"\n\"dim1\":\"CD4pp CD25  IL17pp PMA Ionomcyin stimulated Th17 Primary Cells\",\"dim2\":\"Repressed PolyComb\"\n\"dim1\":\"CD4pp CD25  IL17pp PMA Ionomcyin stimulated Th17 Primary Cells\",\"dim2\":\"Strong transcription\"\n\"dim1\":\"CD4pp CD25  IL17pp PMA Ionomcyin stimulated Th17 Primary Cells\",\"dim2\":\"Transcr at gene 5 and 3\"\n\"dim1\":\"CD4pp CD25  IL17pp PMA Ionomcyin stimulated Th17 Primary Cells\",\"dim2\":\"Wea epressed PolyComb\"\n\"dim1\":\"CD4pp CD25  IL17pp PMA Ionomcyin stimulated Th17 Primary Cells\",\"dim2\":\"Weak transcription\"\n\"dim1\":\"CD4pp CD25  IL17pp PMA Ionomcyin stimulated Th17 Primary Cells\",\"dim2\":\"ZNF genes and repeats\"\n\"dim1\":\"CD4pp CD25  Th Primary Cells\",\"dim2\":\"Active TSS\"\n\"dim1\":\"CD4pp CD25  Th Primary Cells\",\"dim2\":\"Bivalent Enhancer\"\n\"dim1\":\"CD4pp CD25  Th Primary Cells\",\"dim2\":\"Bivalent Poised TSS\"\n\"dim1\":\"CD4pp CD25  Th Primary Cells\",\"dim2\":\"Enhancers\"\n\"dim1\":\"CD4pp CD25  Th Primary Cells\",\"dim2\":\"Flanking Active TSS\"\n\"dim1\":\"CD4pp CD25  Th Primary Cells\",\"dim2\":\"Flanking Bivalent TSS Enh\"\n\"dim1\":\"CD4pp CD25  Th Primary Cells\",\"dim2\":\"Genic enhancers\"\n\"dim1\":\"CD4pp CD25  Th Primary Cells\",\"dim2\":\"Heterochromatin\"\n\"dim1\":\"CD4pp CD25  Th Primary Cells\",\"dim2\":\"Quiescent Low\"\n\"dim1\":\"CD4pp CD25  Th Primary Cells\",\"dim2\":\"Repressed PolyComb\"\n\"dim1\":\"CD4pp CD25  Th Primary Cells\",\"dim2\":\"Strong transcription\"\n\"dim1\":\"CD4pp CD25  Th Primary Cells\",\"dim2\":\"Transcr at gene 5 and 3\"\n\"dim1\":\"CD4pp CD25  Th Primary Cells\",\"dim2\":\"Wea epressed PolyComb\"\n\"dim1\":\"CD4pp CD25  Th Primary Cells\",\"dim2\":\"Weak transcription\"\n\"dim1\":\"CD4pp CD25  Th Primary Cells\",\"dim2\":\"ZNF genes and repeats\"\n\"dim1\":\"CD4pp CD25int CD127pp Tmem Primary Cells\",\"dim2\":\"Active TSS\"\n\"dim1\":\"CD4pp CD25int CD127pp Tmem Primary Cells\",\"dim2\":\"Bivalent Enhancer\"\n\"dim1\":\"CD4pp CD25int CD127pp Tmem Primary Cells\",\"dim2\":\"Bivalent Poised TSS\"\n\"dim1\":\"CD4pp CD25int CD127pp Tmem Primary Cells\",\"dim2\":\"Enhancers\"\n\"dim1\":\"CD4pp CD25int CD127pp Tmem Primary Cells\",\"dim2\":\"Flanking Active TSS\"\n\"dim1\":\"CD4pp CD25int CD127pp Tmem Primary Cells\",\"dim2\":\"Flanking Bivalent TSS Enh\"\n\"dim1\":\"CD4pp CD25int CD127pp Tmem Primary Cells\",\"dim2\":\"Genic enhancers\"\n\"dim1\":\"CD4pp CD25int CD127pp Tmem Primary Cells\",\"dim2\":\"Heterochromatin\"\n\"dim1\":\"CD4pp CD25int CD127pp Tmem Primary Cells\",\"dim2\":\"Quiescent Low\"\n\"dim1\":\"CD4pp CD25int CD127pp Tmem Primary Cells\",\"dim2\":\"Repressed PolyComb\"\n\"dim1\":\"CD4pp CD25int CD127pp Tmem Primary Cells\",\"dim2\":\"Strong transcription\"\n\"dim1\":\"CD4pp CD25int CD127pp Tmem Primary Cells\",\"dim2\":\"Transcr at gene 5 and 3\"\n\"dim1\":\"CD4pp CD25int CD127pp Tmem Primary Cells\",\"dim2\":\"Wea epressed PolyComb\"\n\"dim1\":\"CD4pp CD25int CD127pp Tmem Primary Cells\",\"dim2\":\"Weak transcription\"\n\"dim1\":\"CD4pp CD25int CD127pp Tmem Primary Cells\",\"dim2\":\"ZNF genes and repeats\"\n\"dim1\":\"CD4pp CD25pp CD127  Treg Primary Cells\",\"dim2\":\"Active TSS\"\n\"dim1\":\"CD4pp CD25pp CD127  Treg Primary Cells\",\"dim2\":\"Bivalent Enhancer\"\n\"dim1\":\"CD4pp CD25pp CD127  Treg Primary Cells\",\"dim2\":\"Bivalent Poised TSS\"\n\"dim1\":\"CD4pp CD25pp CD127  Treg Primary Cells\",\"dim2\":\"Enhancers\"\n\"dim1\":\"CD4pp CD25pp CD127  Treg Primary Cells\",\"dim2\":\"Flanking Active TSS\"\n\"dim1\":\"CD4pp CD25pp CD127  Treg Primary Cells\",\"dim2\":\"Flanking Bivalent TSS Enh\"\n\"dim1\":\"CD4pp CD25pp CD127  Treg Primary Cells\",\"dim2\":\"Genic enhancers\"\n\"dim1\":\"CD4pp CD25pp CD127  Treg Primary Cells\",\"dim2\":\"Heterochromatin\"\n\"dim1\":\"CD4pp CD25pp CD127  Treg Primary Cells\",\"dim2\":\"Quiescent Low\"\n\"dim1\":\"CD4pp CD25pp CD127  Treg Primary Cells\",\"dim2\":\"Repressed PolyComb\"\n\"dim1\":\"CD4pp CD25pp CD127  Treg Primary Cells\",\"dim2\":\"Strong transcription\"\n\"dim1\":\"CD4pp CD25pp CD127  Treg Primary Cells\",\"dim2\":\"Transcr at gene 5 and 3\"\n\"dim1\":\"CD4pp CD25pp CD127  Treg Primary Cells\",\"dim2\":\"Wea epressed PolyComb\"\n\"dim1\":\"CD4pp CD25pp CD127  Treg Primary Cells\",\"dim2\":\"Weak transcription\"\n\"dim1\":\"CD4pp CD25pp CD127  Treg Primary Cells\",\"dim2\":\"ZNF genes and repeats\"\n\"dim1\":\"CD56 Primary Cells\",\"dim2\":\"Active TSS\"\n\"dim1\":\"CD56 Primary Cells\",\"dim2\":\"Bivalent Enhancer\"\n\"dim1\":\"CD56 Primary Cells\",\"dim2\":\"Bivalent Poised TSS\"\n\"dim1\":\"CD56 Primary Cells\",\"dim2\":\"Enhancers\"\n\"dim1\":\"CD56 Primary Cells\",\"dim2\":\"Flanking Active TSS\"\n\"dim1\":\"CD56 Primary Cells\",\"dim2\":\"Flanking Bivalent TSS Enh\"\n\"dim1\":\"CD56 Primary Cells\",\"dim2\":\"Genic enhancers\"\n\"dim1\":\"CD56 Primary Cells\",\"dim2\":\"Heterochromatin\"\n\"dim1\":\"CD56 Primary Cells\",\"dim2\":\"Quiescent Low\"\n\"dim1\":\"CD56 Primary Cells\",\"dim2\":\"Repressed PolyComb\"\n\"dim1\":\"CD56 Primary Cells\",\"dim2\":\"Strong transcription\"\n\"dim1\":\"CD56 Primary Cells\",\"dim2\":\"Transcr at gene 5 and 3\"\n\"dim1\":\"CD56 Primary Cells\",\"dim2\":\"Wea epressed PolyComb\"\n\"dim1\":\"CD56 Primary Cells\",\"dim2\":\"Weak transcription\"\n\"dim1\":\"CD56 Primary Cells\",\"dim2\":\"ZNF genes and repeats\"\n\"dim1\":\"CD8 Memory Primary Cells\",\"dim2\":\"Active TSS\"\n\"dim1\":\"CD8 Memory Primary Cells\",\"dim2\":\"Bivalent Enhancer\"\n\"dim1\":\"CD8 Memory Primary Cells\",\"dim2\":\"Bivalent Poised TSS\"\n\"dim1\":\"CD8 Memory Primary Cells\",\"dim2\":\"Enhancers\"\n\"dim1\":\"CD8 Memory Primary Cells\",\"dim2\":\"Flanking Active TSS\"\n\"dim1\":\"CD8 Memory Primary Cells\",\"dim2\":\"Flanking Bivalent TSS Enh\"\n\"dim1\":\"CD8 Memory Primary Cells\",\"dim2\":\"Genic enhancers\"\n\"dim1\":\"CD8 Memory Primary Cells\",\"dim2\":\"Heterochromatin\"\n\"dim1\":\"CD8 Memory Primary Cells\",\"dim2\":\"Quiescent Low\"\n\"dim1\":\"CD8 Memory Primary Cells\",\"dim2\":\"Repressed PolyComb\"\n\"dim1\":\"CD8 Memory Primary Cells\",\"dim2\":\"Strong transcription\"\n\"dim1\":\"CD8 Memory Primary Cells\",\"dim2\":\"Transcr at gene 5 and 3\"\n\"dim1\":\"CD8 Memory Primary Cells\",\"dim2\":\"Wea epressed PolyComb\"\n\"dim1\":\"CD8 Memory Primary Cells\",\"dim2\":\"Weak transcription\"\n\"dim1\":\"CD8 Memory Primary Cells\",\"dim2\":\"ZNF genes and repeats\"\n\"dim1\":\"CD8 Naive Primary Cells\",\"dim2\":\"Active TSS\"\n\"dim1\":\"CD8 Naive Primary Cells\",\"dim2\":\"Bivalent Enhancer\"\n\"dim1\":\"CD8 Naive Primary Cells\",\"dim2\":\"Bivalent Poised TSS\"\n\"dim1\":\"CD8 Naive Primary Cells\",\"dim2\":\"Enhancers\"\n\"dim1\":\"CD8 Naive Primary Cells\",\"dim2\":\"Flanking Active TSS\"\n\"dim1\":\"CD8 Naive Primary Cells\",\"dim2\":\"Flanking Bivalent TSS Enh\"\n\"dim1\":\"CD8 Naive Primary Cells\",\"dim2\":\"Genic enhancers\"\n\"dim1\":\"CD8 Naive Primary Cells\",\"dim2\":\"Heterochromatin\"\n\"dim1\":\"CD8 Naive Primary Cells\",\"dim2\":\"Quiescent Low\"\n\"dim1\":\"CD8 Naive Primary Cells\",\"dim2\":\"Repressed PolyComb\"\n\"dim1\":\"CD8 Naive Primary Cells\",\"dim2\":\"Strong transcription\"\n\"dim1\":\"CD8 Naive Primary Cells\",\"dim2\":\"Transcr at gene 5 and 3\"\n\"dim1\":\"CD8 Naive Primary Cells\",\"dim2\":\"Wea epressed PolyComb\"\n\"dim1\":\"CD8 Naive Primary Cells\",\"dim2\":\"Weak transcription\"\n\"dim1\":\"CD8 Naive Primary Cells\",\"dim2\":\"ZNF genes and repeats\"\n\"dim1\":\"Chondrocytes from Bone Marrow Derived Mesenchymal Stem Cell Cultured Cells\",\"dim2\":\"Active TSS\"\n\"dim1\":\"Chondrocytes from Bone Marrow Derived Mesenchymal Stem Cell Cultured Cells\",\"dim2\":\"Bivalent Enhancer\"\n\"dim1\":\"Chondrocytes from Bone Marrow Derived Mesenchymal Stem Cell Cultured Cells\",\"dim2\":\"Bivalent Poised TSS\"\n\"dim1\":\"Chondrocytes from Bone Marrow Derived Mesenchymal Stem Cell Cultured Cells\",\"dim2\":\"Enhancers\"\n\"dim1\":\"Chondrocytes from Bone Marrow Derived Mesenchymal Stem Cell Cultured Cells\",\"dim2\":\"Flanking Active TSS\"\n\"dim1\":\"Chondrocytes from Bone Marrow Derived Mesenchymal Stem Cell Cultured Cells\",\"dim2\":\"Flanking Bivalent TSS Enh\"\n\"dim1\":\"Chondrocytes from Bone Marrow Derived Mesenchymal Stem Cell Cultured Cells\",\"dim2\":\"Genic enhancers\"\n\"dim1\":\"Chondrocytes from Bone Marrow Derived Mesenchymal Stem Cell Cultured Cells\",\"dim2\":\"Heterochromatin\"\n\"dim1\":\"Chondrocytes from Bone Marrow Derived Mesenchymal Stem Cell Cultured Cells\",\"dim2\":\"Quiescent Low\"\n\"dim1\":\"Chondrocytes from Bone Marrow Derived Mesenchymal Stem Cell Cultured Cells\",\"dim2\":\"Repressed PolyComb\"\n\"dim1\":\"Chondrocytes from Bone Marrow Derived Mesenchymal Stem Cell Cultured Cells\",\"dim2\":\"Strong transcription\"\n\"dim1\":\"Chondrocytes from Bone Marrow Derived Mesenchymal Stem Cell Cultured Cells\",\"dim2\":\"Transcr at gene 5 and 3\"\n\"dim1\":\"Chondrocytes from Bone Marrow Derived Mesenchymal Stem Cell Cultured Cells\",\"dim2\":\"Wea epressed PolyComb\"\n\"dim1\":\"Chondrocytes from Bone Marrow Derived Mesenchymal Stem Cell Cultured Cells\",\"dim2\":\"Weak transcription\"\n\"dim1\":\"Chondrocytes from Bone Marrow Derived Mesenchymal Stem Cell Cultured Cells\",\"dim2\":\"ZNF genes and repeats\"\n\"dim1\":\"Colon Smooth Muscle\",\"dim2\":\"Active TSS\"\n\"dim1\":\"Colon Smooth Muscle\",\"dim2\":\"Bivalent Enhancer\"\n\"dim1\":\"Colon Smooth Muscle\",\"dim2\":\"Bivalent Poised TSS\"\n\"dim1\":\"Colon Smooth Muscle\",\"dim2\":\"Enhancers\"\n\"dim1\":\"Colon Smooth Muscle\",\"dim2\":\"Flanking Active TSS\"\n\"dim1\":\"Colon Smooth Muscle\",\"dim2\":\"Flanking Bivalent TSS Enh\"\n\"dim1\":\"Colon Smooth Muscle\",\"dim2\":\"Genic enhancers\"\n\"dim1\":\"Colon Smooth Muscle\",\"dim2\":\"Heterochromatin\"\n\"dim1\":\"Colon Smooth Muscle\",\"dim2\":\"Quiescent Low\"\n\"dim1\":\"Colon Smooth Muscle\",\"dim2\":\"Repressed PolyComb\"\n\"dim1\":\"Colon Smooth Muscle\",\"dim2\":\"Strong transcription\"\n\"dim1\":\"Colon Smooth Muscle\",\"dim2\":\"Transcr at gene 5 and 3\"\n\"dim1\":\"Colon Smooth Muscle\",\"dim2\":\"Wea epressed PolyComb\"\n\"dim1\":\"Colon Smooth Muscle\",\"dim2\":\"Weak transcription\"\n\"dim1\":\"Colon Smooth Muscle\",\"dim2\":\"ZNF genes and repeats\"\n\"dim1\":\"Colonic Mucosa\",\"dim2\":\"Active TSS\"\n\"dim1\":\"Colonic Mucosa\",\"dim2\":\"Bivalent Enhancer\"\n\"dim1\":\"Colonic Mucosa\",\"dim2\":\"Bivalent Poised TSS\"\n\"dim1\":\"Colonic Mucosa\",\"dim2\":\"Enhancers\"\n\"dim1\":\"Colonic Mucosa\",\"dim2\":\"Flanking Active TSS\"\n\"dim1\":\"Colonic Mucosa\",\"dim2\":\"Flanking Bivalent TSS Enh\"\n\"dim1\":\"Colonic Mucosa\",\"dim2\":\"Genic enhancers\"\n\"dim1\":\"Colonic Mucosa\",\"dim2\":\"Heterochromatin\"\n\"dim1\":\"Colonic Mucosa\",\"dim2\":\"Quiescent Low\"\n\"dim1\":\"Colonic Mucosa\",\"dim2\":\"Repressed PolyComb\"\n\"dim1\":\"Colonic Mucosa\",\"dim2\":\"Strong transcription\"\n\"dim1\":\"Colonic Mucosa\",\"dim2\":\"Transcr at gene 5 and 3\"\n\"dim1\":\"Colonic Mucosa\",\"dim2\":\"Wea epressed PolyComb\"\n\"dim1\":\"Colonic Mucosa\",\"dim2\":\"Weak transcription\"\n\"dim1\":\"Colonic Mucosa\",\"dim2\":\"ZNF genes and repeats\"\n\"dim1\":\"Dnd41 TCell Leukemia\",\"dim2\":\"Active TSS\"\n\"dim1\":\"Dnd41 TCell Leukemia\",\"dim2\":\"Bivalent Enhancer\"\n\"dim1\":\"Dnd41 TCell Leukemia\",\"dim2\":\"Bivalent Poised TSS\"\n\"dim1\":\"Dnd41 TCell Leukemia\",\"dim2\":\"Enhancers\"\n\"dim1\":\"Dnd41 TCell Leukemia\",\"dim2\":\"Flanking Active TSS\"\n\"dim1\":\"Dnd41 TCell Leukemia\",\"dim2\":\"Flanking Bivalent TSS Enh\"\n\"dim1\":\"Dnd41 TCell Leukemia\",\"dim2\":\"Genic enhancers\"\n\"dim1\":\"Dnd41 TCell Leukemia\",\"dim2\":\"Heterochromatin\"\n\"dim1\":\"Dnd41 TCell Leukemia\",\"dim2\":\"Quiescent Low\"\n\"dim1\":\"Dnd41 TCell Leukemia\",\"dim2\":\"Repressed PolyComb\"\n\"dim1\":\"Dnd41 TCell Leukemia\",\"dim2\":\"Strong transcription\"\n\"dim1\":\"Dnd41 TCell Leukemia\",\"dim2\":\"Transcr at gene 5 and 3\"\n\"dim1\":\"Dnd41 TCell Leukemia\",\"dim2\":\"Wea epressed PolyComb\"\n\"dim1\":\"Dnd41 TCell Leukemia\",\"dim2\":\"Weak transcription\"\n\"dim1\":\"Dnd41 TCell Leukemia\",\"dim2\":\"ZNF genes and repeats\"\n\"dim1\":\"Duodenum Mucosa\",\"dim2\":\"Active TSS\"\n\"dim1\":\"Duodenum Mucosa\",\"dim2\":\"Bivalent Enhancer\"\n\"dim1\":\"Duodenum Mucosa\",\"dim2\":\"Bivalent Poised TSS\"\n\"dim1\":\"Duodenum Mucosa\",\"dim2\":\"Enhancers\"\n\"dim1\":\"Duodenum Mucosa\",\"dim2\":\"Flanking Active TSS\"\n\"dim1\":\"Duodenum Mucosa\",\"dim2\":\"Flanking Bivalent TSS Enh\"\n\"dim1\":\"Duodenum Mucosa\",\"dim2\":\"Genic enhancers\"\n\"dim1\":\"Duodenum Mucosa\",\"dim2\":\"Heterochromatin\"\n\"dim1\":\"Duodenum Mucosa\",\"dim2\":\"Quiescent Low\"\n\"dim1\":\"Duodenum Mucosa\",\"dim2\":\"Repressed PolyComb\"\n\"dim1\":\"Duodenum Mucosa\",\"dim2\":\"Strong transcription\"\n\"dim1\":\"Duodenum Mucosa\",\"dim2\":\"Transcr at gene 5 and 3\"\n\"dim1\":\"Duodenum Mucosa\",\"dim2\":\"Wea epressed PolyComb\"\n\"dim1\":\"Duodenum Mucosa\",\"dim2\":\"Weak transcription\"\n\"dim1\":\"Duodenum Mucosa\",\"dim2\":\"ZNF genes and repeats\"\n\"dim1\":\"Duodenum Smooth Muscle\",\"dim2\":\"Active TSS\"\n\"dim1\":\"Duodenum Smooth Muscle\",\"dim2\":\"Bivalent Enhancer\"\n\"dim1\":\"Duodenum Smooth Muscle\",\"dim2\":\"Bivalent Poised TSS\"\n\"dim1\":\"Duodenum Smooth Muscle\",\"dim2\":\"Enhancers\"\n\"dim1\":\"Duodenum Smooth Muscle\",\"dim2\":\"Flanking Active TSS\"\n\"dim1\":\"Duodenum Smooth Muscle\",\"dim2\":\"Flanking Bivalent TSS Enh\"\n\"dim1\":\"Duodenum Smooth Muscle\",\"dim2\":\"Genic enhancers\"\n\"dim1\":\"Duodenum Smooth Muscle\",\"dim2\":\"Heterochromatin\"\n\"dim1\":\"Duodenum Smooth Muscle\",\"dim2\":\"Quiescent Low\"\n\"dim1\":\"Duodenum Smooth Muscle\",\"dim2\":\"Repressed PolyComb\"\n\"dim1\":\"Duodenum Smooth Muscle\",\"dim2\":\"Strong transcription\"\n\"dim1\":\"Duodenum Smooth Muscle\",\"dim2\":\"Transcr at gene 5 and 3\"\n\"dim1\":\"Duodenum Smooth Muscle\",\"dim2\":\"Wea epressed PolyComb\"\n\"dim1\":\"Duodenum Smooth Muscle\",\"dim2\":\"Weak transcription\"\n\"dim1\":\"Duodenum Smooth Muscle\",\"dim2\":\"ZNF genes and repeats\"\n\"dim1\":\"ES I3 Cell Line\",\"dim2\":\"Active TSS\"\n\"dim1\":\"ES I3 Cell Line\",\"dim2\":\"Bivalent Enhancer\"\n\"dim1\":\"ES I3 Cell Line\",\"dim2\":\"Bivalent Poised TSS\"\n\"dim1\":\"ES I3 Cell Line\",\"dim2\":\"Enhancers\"\n\"dim1\":\"ES I3 Cell Line\",\"dim2\":\"Flanking Active TSS\"\n\"dim1\":\"ES I3 Cell Line\",\"dim2\":\"Flanking Bivalent TSS Enh\"\n\"dim1\":\"ES I3 Cell Line\",\"dim2\":\"Genic enhancers\"\n\"dim1\":\"ES I3 Cell Line\",\"dim2\":\"Heterochromatin\"\n\"dim1\":\"ES I3 Cell Line\",\"dim2\":\"Quiescent Low\"\n\"dim1\":\"ES I3 Cell Line\",\"dim2\":\"Repressed PolyComb\"\n\"dim1\":\"ES I3 Cell Line\",\"dim2\":\"Strong transcription\"\n\"dim1\":\"ES I3 Cell Line\",\"dim2\":\"Transcr at gene 5 and 3\"\n\"dim1\":\"ES I3 Cell Line\",\"dim2\":\"Wea epressed PolyComb\"\n\"dim1\":\"ES I3 Cell Line\",\"dim2\":\"Weak transcription\"\n\"dim1\":\"ES I3 Cell Line\",\"dim2\":\"ZNF genes and repeats\"\n\"dim1\":\"ES WA7 Cell Line\",\"dim2\":\"Active TSS\"\n\"dim1\":\"ES WA7 Cell Line\",\"dim2\":\"Bivalent Enhancer\"\n\"dim1\":\"ES WA7 Cell Line\",\"dim2\":\"Bivalent Poised TSS\"\n\"dim1\":\"ES WA7 Cell Line\",\"dim2\":\"Enhancers\"\n\"dim1\":\"ES WA7 Cell Line\",\"dim2\":\"Flanking Active TSS\"\n\"dim1\":\"ES WA7 Cell Line\",\"dim2\":\"Flanking Bivalent TSS Enh\"\n\"dim1\":\"ES WA7 Cell Line\",\"dim2\":\"Genic enhancers\"\n\"dim1\":\"ES WA7 Cell Line\",\"dim2\":\"Heterochromatin\"\n\"dim1\":\"ES WA7 Cell Line\",\"dim2\":\"Quiescent Low\"\n\"dim1\":\"ES WA7 Cell Line\",\"dim2\":\"Repressed PolyComb\"\n\"dim1\":\"ES WA7 Cell Line\",\"dim2\":\"Strong transcription\"\n\"dim1\":\"ES WA7 Cell Line\",\"dim2\":\"Transcr at gene 5 and 3\"\n\"dim1\":\"ES WA7 Cell Line\",\"dim2\":\"Wea epressed PolyComb\"\n\"dim1\":\"ES WA7 Cell Line\",\"dim2\":\"Weak transcription\"\n\"dim1\":\"ES WA7 Cell Line\",\"dim2\":\"ZNF genes and repeats\"\n\"dim1\":\"Esophagus\",\"dim2\":\"Active TSS\"\n\"dim1\":\"Esophagus\",\"dim2\":\"Bivalent Enhancer\"\n\"dim1\":\"Esophagus\",\"dim2\":\"Bivalent Poised TSS\"\n\"dim1\":\"Esophagus\",\"dim2\":\"Enhancers\"\n\"dim1\":\"Esophagus\",\"dim2\":\"Flanking Active TSS\"\n\"dim1\":\"Esophagus\",\"dim2\":\"Flanking Bivalent TSS Enh\"\n\"dim1\":\"Esophagus\",\"dim2\":\"Genic enhancers\"\n\"dim1\":\"Esophagus\",\"dim2\":\"Heterochromatin\"\n\"dim1\":\"Esophagus\",\"dim2\":\"Quiescent Low\"\n\"dim1\":\"Esophagus\",\"dim2\":\"Repressed PolyComb\"\n\"dim1\":\"Esophagus\",\"dim2\":\"Strong transcription\"\n\"dim1\":\"Esophagus\",\"dim2\":\"Transcr at gene 5 and 3\"\n\"dim1\":\"Esophagus\",\"dim2\":\"Wea epressed PolyComb\"\n\"dim1\":\"Esophagus\",\"dim2\":\"Weak transcription\"\n\"dim1\":\"Esophagus\",\"dim2\":\"ZNF genes and repeats\"\n\"dim1\":\"Fetal Adrenal Gland\",\"dim2\":\"Active TSS\"\n\"dim1\":\"Fetal Adrenal Gland\",\"dim2\":\"Bivalent Enhancer\"\n\"dim1\":\"Fetal Adrenal Gland\",\"dim2\":\"Bivalent Poised TSS\"\n\"dim1\":\"Fetal Adrenal Gland\",\"dim2\":\"Enhancers\"\n\"dim1\":\"Fetal Adrenal Gland\",\"dim2\":\"Flanking Active TSS\"\n\"dim1\":\"Fetal Adrenal Gland\",\"dim2\":\"Flanking Bivalent TSS Enh\"\n\"dim1\":\"Fetal Adrenal Gland\",\"dim2\":\"Genic enhancers\"\n\"dim1\":\"Fetal Adrenal Gland\",\"dim2\":\"Heterochromatin\"\n\"dim1\":\"Fetal Adrenal Gland\",\"dim2\":\"Quiescent Low\"\n\"dim1\":\"Fetal Adrenal Gland\",\"dim2\":\"Repressed PolyComb\"\n\"dim1\":\"Fetal Adrenal Gland\",\"dim2\":\"Strong transcription\"\n\"dim1\":\"Fetal Adrenal Gland\",\"dim2\":\"Transcr at gene 5 and 3\"\n\"dim1\":\"Fetal Adrenal Gland\",\"dim2\":\"Wea epressed PolyComb\"\n\"dim1\":\"Fetal Adrenal Gland\",\"dim2\":\"Weak transcription\"\n\"dim1\":\"Fetal Adrenal Gland\",\"dim2\":\"ZNF genes and repeats\"\n\"dim1\":\"Fetal Brain Female\",\"dim2\":\"Active TSS\"\n\"dim1\":\"Fetal Brain Female\",\"dim2\":\"Bivalent Enhancer\"\n\"dim1\":\"Fetal Brain Female\",\"dim2\":\"Bivalent Poised TSS\"\n\"dim1\":\"Fetal Brain Female\",\"dim2\":\"Enhancers\"\n\"dim1\":\"Fetal Brain Female\",\"dim2\":\"Flanking Active TSS\"\n\"dim1\":\"Fetal Brain Female\",\"dim2\":\"Flanking Bivalent TSS Enh\"\n\"dim1\":\"Fetal Brain Female\",\"dim2\":\"Genic enhancers\"\n\"dim1\":\"Fetal Brain Female\",\"dim2\":\"Heterochromatin\"\n\"dim1\":\"Fetal Brain Female\",\"dim2\":\"Quiescent Low\"\n\"dim1\":\"Fetal Brain Female\",\"dim2\":\"Repressed PolyComb\"\n\"dim1\":\"Fetal Brain Female\",\"dim2\":\"Strong transcription\"\n\"dim1\":\"Fetal Brain Female\",\"dim2\":\"Transcr at gene 5 and 3\"\n\"dim1\":\"Fetal Brain Female\",\"dim2\":\"Wea epressed PolyComb\"\n\"dim1\":\"Fetal Brain Female\",\"dim2\":\"Weak transcription\"\n\"dim1\":\"Fetal Brain Female\",\"dim2\":\"ZNF genes and repeats\"\n\"dim1\":\"Fetal Brain Male\",\"dim2\":\"Active TSS\"\n\"dim1\":\"Fetal Brain Male\",\"dim2\":\"Bivalent Enhancer\"\n\"dim1\":\"Fetal Brain Male\",\"dim2\":\"Bivalent Poised TSS\"\n\"dim1\":\"Fetal Brain Male\",\"dim2\":\"Enhancers\"\n\"dim1\":\"Fetal Brain Male\",\"dim2\":\"Flanking Active TSS\"\n\"dim1\":\"Fetal Brain Male\",\"dim2\":\"Flanking Bivalent TSS Enh\"\n\"dim1\":\"Fetal Brain Male\",\"dim2\":\"Genic enhancers\"\n\"dim1\":\"Fetal Brain Male\",\"dim2\":\"Heterochromatin\"\n\"dim1\":\"Fetal Brain Male\",\"dim2\":\"Quiescent Low\"\n\"dim1\":\"Fetal Brain Male\",\"dim2\":\"Repressed PolyComb\"\n\"dim1\":\"Fetal Brain Male\",\"dim2\":\"Strong transcription\"\n\"dim1\":\"Fetal Brain Male\",\"dim2\":\"Transcr at gene 5 and 3\"\n\"dim1\":\"Fetal Brain Male\",\"dim2\":\"Wea epressed PolyComb\"\n\"dim1\":\"Fetal Brain Male\",\"dim2\":\"Weak transcription\"\n\"dim1\":\"Fetal Brain Male\",\"dim2\":\"ZNF genes and repeats\"\n\"dim1\":\"Fetal Heart\",\"dim2\":\"Active TSS\"\n\"dim1\":\"Fetal Heart\",\"dim2\":\"Bivalent Enhancer\"\n\"dim1\":\"Fetal Heart\",\"dim2\":\"Bivalent Poised TSS\"\n\"dim1\":\"Fetal Heart\",\"dim2\":\"Enhancers\"\n\"dim1\":\"Fetal Heart\",\"dim2\":\"Flanking Active TSS\"\n\"dim1\":\"Fetal Heart\",\"dim2\":\"Flanking Bivalent TSS Enh\"\n\"dim1\":\"Fetal Heart\",\"dim2\":\"Genic enhancers\"\n\"dim1\":\"Fetal Heart\",\"dim2\":\"Heterochromatin\"\n\"dim1\":\"Fetal Heart\",\"dim2\":\"Quiescent Low\"\n\"dim1\":\"Fetal Heart\",\"dim2\":\"Repressed PolyComb\"\n\"dim1\":\"Fetal Heart\",\"dim2\":\"Strong transcription\"\n\"dim1\":\"Fetal Heart\",\"dim2\":\"Transcr at gene 5 and 3\"\n\"dim1\":\"Fetal Heart\",\"dim2\":\"Wea epressed PolyComb\"\n\"dim1\":\"Fetal Heart\",\"dim2\":\"Weak transcription\"\n\"dim1\":\"Fetal Heart\",\"dim2\":\"ZNF genes and repeats\"\n\"dim1\":\"Fetal Intestine Large\",\"dim2\":\"Active TSS\"\n\"dim1\":\"Fetal Intestine Large\",\"dim2\":\"Bivalent Enhancer\"\n\"dim1\":\"Fetal Intestine Large\",\"dim2\":\"Bivalent Poised TSS\"\n\"dim1\":\"Fetal Intestine Large\",\"dim2\":\"Enhancers\"\n\"dim1\":\"Fetal Intestine Large\",\"dim2\":\"Flanking Active TSS\"\n\"dim1\":\"Fetal Intestine Large\",\"dim2\":\"Flanking Bivalent TSS Enh\"\n\"dim1\":\"Fetal Intestine Large\",\"dim2\":\"Genic enhancers\"\n\"dim1\":\"Fetal Intestine Large\",\"dim2\":\"Heterochromatin\"\n\"dim1\":\"Fetal Intestine Large\",\"dim2\":\"Quiescent Low\"\n\"dim1\":\"Fetal Intestine Large\",\"dim2\":\"Repressed PolyComb\"\n\"dim1\":\"Fetal Intestine Large\",\"dim2\":\"Strong transcription\"\n\"dim1\":\"Fetal Intestine Large\",\"dim2\":\"Transcr at gene 5 and 3\"\n\"dim1\":\"Fetal Intestine Large\",\"dim2\":\"Wea epressed PolyComb\"\n\"dim1\":\"Fetal Intestine Large\",\"dim2\":\"Weak transcription\"\n\"dim1\":\"Fetal Intestine Large\",\"dim2\":\"ZNF genes and repeats\"\n\"dim1\":\"Fetal Intestine Small\",\"dim2\":\"Active TSS\"\n\"dim1\":\"Fetal Intestine Small\",\"dim2\":\"Bivalent Enhancer\"\n\"dim1\":\"Fetal Intestine Small\",\"dim2\":\"Bivalent Poised TSS\"\n\"dim1\":\"Fetal Intestine Small\",\"dim2\":\"Enhancers\"\n\"dim1\":\"Fetal Intestine Small\",\"dim2\":\"Flanking Active TSS\"\n\"dim1\":\"Fetal Intestine Small\",\"dim2\":\"Flanking Bivalent TSS Enh\"\n\"dim1\":\"Fetal Intestine Small\",\"dim2\":\"Genic enhancers\"\n\"dim1\":\"Fetal Intestine Small\",\"dim2\":\"Heterochromatin\"\n\"dim1\":\"Fetal Intestine Small\",\"dim2\":\"Quiescent Low\"\n\"dim1\":\"Fetal Intestine Small\",\"dim2\":\"Repressed PolyComb\"\n\"dim1\":\"Fetal Intestine Small\",\"dim2\":\"Strong transcription\"\n\"dim1\":\"Fetal Intestine Small\",\"dim2\":\"Transcr at gene 5 and 3\"\n\"dim1\":\"Fetal Intestine Small\",\"dim2\":\"Wea epressed PolyComb\"\n\"dim1\":\"Fetal Intestine Small\",\"dim2\":\"Weak transcription\"\n\"dim1\":\"Fetal Intestine Small\",\"dim2\":\"ZNF genes and repeats\"\n\"dim1\":\"Fetal Kidney\",\"dim2\":\"Active TSS\"\n\"dim1\":\"Fetal Kidney\",\"dim2\":\"Bivalent Enhancer\"\n\"dim1\":\"Fetal Kidney\",\"dim2\":\"Bivalent Poised TSS\"\n\"dim1\":\"Fetal Kidney\",\"dim2\":\"Enhancers\"\n\"dim1\":\"Fetal Kidney\",\"dim2\":\"Flanking Active TSS\"\n\"dim1\":\"Fetal Kidney\",\"dim2\":\"Flanking Bivalent TSS Enh\"\n\"dim1\":\"Fetal Kidney\",\"dim2\":\"Genic enhancers\"\n\"dim1\":\"Fetal Kidney\",\"dim2\":\"Heterochromatin\"\n\"dim1\":\"Fetal Kidney\",\"dim2\":\"Quiescent Low\"\n\"dim1\":\"Fetal Kidney\",\"dim2\":\"Repressed PolyComb\"\n\"dim1\":\"Fetal Kidney\",\"dim2\":\"Strong transcription\"\n\"dim1\":\"Fetal Kidney\",\"dim2\":\"Transcr at gene 5 and 3\"\n\"dim1\":\"Fetal Kidney\",\"dim2\":\"Wea epressed PolyComb\"\n\"dim1\":\"Fetal Kidney\",\"dim2\":\"Weak transcription\"\n\"dim1\":\"Fetal Kidney\",\"dim2\":\"ZNF genes and repeats\"\n\"dim1\":\"Fetal Lung Active TSS\"\n\"dim1\":\"Fetal Lung\",\"dim2\":\"Bivalent Enhancer\"\n\"dim1\":\"Fetal Lung\",\"dim2\":\"Bivalent Poised TSS\"\n\"dim1\":\"Fetal Lung\",\"dim2\":\"Enhancers\"\n\"dim1\":\"Fetal Lung\",\"dim2\":\"Flanking Active TSS\"\n\"dim1\":\"Fetal Lung\",\"dim2\":\"Flanking Bivalent TSS Enh\"\n\"dim1\":\"Fetal Lung\",\"dim2\":\"Genic enhancers\"\n\"dim1\":\"Fetal Lung\",\"dim2\":\"Heterochromatin\"\n\"dim1\":\"Fetal Lung\",\"dim2\":\"Quiescent Low\"\n\"dim1\":\"Fetal Lung\",\"dim2\":\"Repressed PolyComb\"\n\"dim1\":\"Fetal Lung\",\"dim2\":\"Strong transcription\"\n\"dim1\":\"Fetal Lung\",\"dim2\":\"Transcr at gene 5 and 3\"\n\"dim1\":\"Fetal Lung\",\"dim2\":\"Wea epressed PolyComb\"\n\"dim1\":\"Fetal Lung\",\"dim2\":\"Weak transcription\"\n\"dim1\":\"Fetal Lung\",\"dim2\":\"ZNF genes and repeats\"\n\"dim1\":\"Fetal Muscle Leg Active TSS\"\n\"dim1\":\"Fetal Muscle Leg\",\"dim2\":\"Bivalent Enhancer\"\n\"dim1\":\"Fetal Muscle Leg\",\"dim2\":\"Bivalent Poised TSS\"\n\"dim1\":\"Fetal Muscle Leg\",\"dim2\":\"Enhancers\"\n\"dim1\":\"Fetal Muscle Leg\",\"dim2\":\"Flanking Active TSS\"\n\"dim1\":\"Fetal Muscle Leg\",\"dim2\":\"Flanking Bivalent TSS Enh\"\n\"dim1\":\"Fetal Muscle Leg\",\"dim2\":\"Genic enhancers\"\n\"dim1\":\"Fetal Muscle Leg\",\"dim2\":\"Heterochromatin\"\n\"dim1\":\"Fetal Muscle Leg\",\"dim2\":\"Quiescent Low\"\n\"dim1\":\"Fetal Muscle Leg\",\"dim2\":\"Repressed PolyComb\"\n\"dim1\":\"Fetal Muscle Leg\",\"dim2\":\"Strong transcription\"\n\"dim1\":\"Fetal Muscle Leg\",\"dim2\":\"Transcr at gene 5 and 3\"\n\"dim1\":\"Fetal Muscle Leg\",\"dim2\":\"Wea epressed PolyComb\"\n\"dim1\":\"Fetal Muscle Leg\",\"dim2\":\"Weak transcription\"\n\"dim1\":\"Fetal Muscle Leg\",\"dim2\":\"ZNF genes and repeats\"\n\"dim1\":\"Fetal Muscle Trunk\",\"dim2\":\"Active TSS\"\n\"dim1\":\"Fetal Muscle Trunk\",\"dim2\":\"Bivalent Enhancer\"\n\"dim1\":\"Fetal Muscle Trunk\",\"dim2\":\"Bivalent Poised TSS\"\n\"dim1\":\"Fetal Muscle Trunk\",\"dim2\":\"Enhancers\"\n\"dim1\":\"Fetal Muscle Trunk\",\"dim2\":\"Flanking Active TSS\"\n\"dim1\":\"Fetal Muscle Trunk\",\"dim2\":\"Flanking Bivalent TSS Enh\"\n\"dim1\":\"Fetal Muscle Trunk\",\"dim2\":\"Genic enhancers\"\n\"dim1\":\"Fetal Muscle Trunk\",\"dim2\":\"Heterochromatin\"\n\"dim1\":\"Fetal Muscle Trunk\",\"dim2\":\"Quiescent Low\"\n\"dim1\":\"Fetal Muscle Trun epressed PolyComb\"\n\"dim1\":\"Fetal Muscle Trunk\",\"dim2\":\"Strong transcription\"\n\"dim1\":\"Fetal Muscle Trunk\",\"dim2\":\"Transcr at gene 5 and 3\"\n\"dim1\":\"Fetal Muscle Trunk\",\"dim2\":\"Wea epressed PolyComb\"\n\"dim1\":\"Fetal Muscle Trunk\",\"dim2\":\"Weak transcription\"\n\"dim1\":\"Fetal Muscle Trunk\",\"dim2\":\"ZNF genes and repeats\"\n\"dim1\":\"Fetal Placenta\",\"dim2\":\"Active TSS\"\n\"dim1\":\"Fetal Placenta\",\"dim2\":\"Bivalent Enhancer\"\n\"dim1\":\"Fetal Placenta\",\"dim2\":\"Bivalent Poised TSS\"\n\"dim1\":\"Fetal Placenta\",\"dim2\":\"Enhancers\"\n\"dim1\":\"Fetal Placenta\",\"dim2\":\"Flanking Active TSS\"\n\"dim1\":\"Fetal Placenta\",\"dim2\":\"Flanking Bivalent TSS Enh\"\n\"dim1\":\"Fetal Placenta\",\"dim2\":\"Genic enhancers\"\n\"dim1\":\"Fetal Placenta\",\"dim2\":\"Heterochromatin\"\n\"dim1\":\"Fetal Placenta\",\"dim2\":\"Quiescent Low\"\n\"dim1\":\"Fetal Placenta\",\"dim2\":\"Repressed PolyComb\"\n\"dim1\":\"Fetal Placenta\",\"dim2\":\"Strong transcription\"\n\"dim1\":\"Fetal Placenta\",\"dim2\":\"Transcr at gene 5 and 3\"\n\"dim1\":\"Fetal Placenta\",\"dim2\":\"Wea epressed PolyComb\"\n\"dim1\":\"Fetal Placenta\",\"dim2\":\"Weak transcription\"\n\"dim1\":\"Fetal Placenta\",\"dim2\":\"ZNF genes and repeats\"\n\"dim1\":\"Fetal Stomach\",\"dim2\":\"Active TSS\"\n\"dim1\":\"Fetal Stomach\",\"dim2\":\"Bivalent Enhancer\"\n\"dim1\":\"Fetal Stomach\",\"dim2\":\"Bivalent Poised TSS\"\n\"dim1\":\"Fetal Stomach\",\"dim2\":\"Enhancers\"\n\"dim1\":\"Fetal Stomach\",\"dim2\":\"Flanking Active TSS\"\n\"dim1\":\"Fetal Stomach\",\"dim2\":\"Flanking Bivalent TSS Enh\"\n\"dim1\":\"Fetal Stomach\",\"dim2\":\"Genic enhancers\"\n\"dim1\":\"Fetal Stomach\",\"dim2\":\"Heterochromatin\"\n\"dim1\":\"Fetal Stomach\",\"dim2\":\"Quiescent Low\"\n\"dim1\":\"Fetal Stomach\",\"dim2\":\"Repressed PolyComb\"\n\"dim1\":\"Fetal Stomach\",\"dim2\":\"Strong transcription\"\n\"dim1\":\"Fetal Stomach\",\"dim2\":\"Transcr at gene 5 and 3\"\n\"dim1\":\"Fetal Stomach\",\"dim2\":\"Wea epressed PolyComb\"\n\"dim1\":\"Fetal Stomach\",\"dim2\":\"Weak transcription\"\n\"dim1\":\"Fetal Stomach\",\"dim2\":\"ZNF genes and repeats\"\n\"dim1\":\"Fetal Thymus\",\"dim2\":\"Active TSS\"\n\"dim1\":\"Fetal Thymus\",\"dim2\":\"Bivalent Enhancer\"\n\"dim1\":\"Fetal Thymus\",\"dim2\":\"Bivalent Poised TSS\"\n\"dim1\":\"Fetal Thymus\",\"dim2\":\"Enhancers\"\n\"dim1\":\"Fetal Thymus\",\"dim2\":\"Flanking Active TSS\"\n\"dim1\":\"Fetal Thymus\",\"dim2\":\"Flanking Bivalent TSS Enh\"\n\"dim1\":\"Fetal Thymus\",\"dim2\":\"Genic enhancers\"\n\"dim1\":\"Fetal Thymus\",\"dim2\":\"Heterochromatin\"\n\"dim1\":\"Fetal Thymus\",\"dim2\":\"Quiescent Low\"\n\"dim1\":\"Fetal Thymus\",\"dim2\":\"Repressed PolyComb\"\n\"dim1\":\"Fetal Thymus\",\"dim2\":\"Strong transcription\"\n\"dim1\":\"Fetal Thymus\",\"dim2\":\"Transcr at gene 5 and 3\"\n\"dim1\":\"Fetal Thymus\",\"dim2\":\"Wea epressed PolyComb\"\n\"dim1\":\"Fetal Thymus\",\"dim2\":\"Weak transcription\"\n\"dim1\":\"Fetal Thymus\",\"dim2\":\"ZNF genes and repeats\"\n\"dim1\":\"GM12878 Lymphoblastoid\",\"dim2\":\"Active TSS\"\n\"dim1\":\"GM12878 Lymphoblastoid\",\"dim2\":\"Bivalent Enhancer\"\n\"dim1\":\"GM12878 Lymphoblastoid\",\"dim2\":\"Bivalent Poised TSS\"\n\"dim1\":\"GM12878 Lymphoblastoid\",\"dim2\":\"Enhancers\"\n\"dim1\":\"GM12878 Lymphoblastoid\",\"dim2\":\"Flanking Active TSS\"\n\"dim1\":\"GM12878 Lymphoblastoid\",\"dim2\":\"Flanking Bivalent TSS Enh\"\n\"dim1\":\"GM12878 Lymphoblastoid\",\"dim2\":\"Genic enhancers\"\n\"dim1\":\"GM12878 Lymphoblastoid\",\"dim2\":\"Heterochromatin\"\n\"dim1\":\"GM12878 Lymphoblastoid\",\"dim2\":\"Quiescent Low\"\n\"dim1\":\"GM12878 Lymphoblastoid\",\"dim2\":\"Repressed PolyComb\"\n\"dim1\":\"GM12878 Lymphoblastoid\",\"dim2\":\"Strong transcription\"\n\"dim1\":\"GM12878 Lymphoblastoid\",\"dim2\":\"Transcr at gene 5 and 3\"\n\"dim1\":\"GM12878 Lymphoblastoid\",\"dim2\":\"Wea epressed PolyComb\"\n\"dim1\":\"GM12878 Lymphoblastoid\",\"dim2\":\"Weak transcription\"\n\"dim1\":\"GM12878 Lymphoblastoid\",\"dim2\":\"ZNF genes and repeats\"\n\"dim1\":\"Gastric\",\"dim2\":\"Active TSS\"\n\"dim1\":\"Gastric\",\"dim2\":\"Bivalent Enhancer\"\n\"dim1\":\"Gastric\",\"dim2\":\"Bivalent Poised TSS\"\n\"dim1\":\"Gastric\",\"dim2\":\"Enhancers\"\n\"dim1\":\"Gastric\",\"dim2\":\"Flanking Active TSS\"\n\"dim1\":\"Gastric\",\"dim2\":\"Flanking Bivalent TSS Enh\"\n\"dim1\":\"Gastric\",\"dim2\":\"Genic enhancers\"\n\"dim1\":\"Gastric\",\"dim2\":\"Heterochromatin\"\n\"dim1\":\"Gastric\",\"dim2\":\"Quiescent Low\"\n\"dim1\":\"Gastric\",\"dim2\":\"Repressed PolyComb\"\n\"dim1\":\"Gastric\",\"dim2\":\"Strong transcription\"\n\"dim1\":\"Gastric\",\"dim2\":\"Transcr at gene 5 and 3\"\n\"dim1\":\"Gastric\",\"dim2\":\"Wea epressed PolyComb\"\n\"dim1\":\"Gastric\",\"dim2\":\"Weak transcription\"\n\"dim1\":\"Gastric\",\"dim2\":\"ZNF genes and repeats\"\n\"dim1\":\"H1 BMP4 Derived Mesendoderm Cultured Cells\",\"dim2\":\"Active TSS\"\n\"dim1\":\"H1 BMP4 Derived Mesendoderm Cultured Cells\",\"dim2\":\"Bivalent Enhancer\"\n\"dim1\":\"H1 BMP4 Derived Mesendoderm Cultured Cells\",\"dim2\":\"Bivalent Poised TSS\"\n\"dim1\":\"H1 BMP4 Derived Mesendoderm Cultured Cells\",\"dim2\":\"Enhancers\"\n\"dim1\":\"H1 BMP4 Derived Mesendoderm Cultured Cells\",\"dim2\":\"Flanking Active TSS\"\n\"dim1\":\"H1 BMP4 Derived Mesendoderm Cultured Cells\",\"dim2\":\"Flanking Bivalent TSS Enh\"\n\"dim1\":\"H1 BMP4 Derived Mesendoderm Cultured Cells\",\"dim2\":\"Genic enhancers\"\n\"dim1\":\"H1 BMP4 Derived Mesendoderm Cultured Cells\",\"dim2\":\"Heterochromatin\"\n\"dim1\":\"H1 BMP4 Derived Mesendoderm Cultured Cells\",\"dim2\":\"Quiescent Low\"\n\"dim1\":\"H1 BMP4 Derived Mesendoderm Cultured Cells\",\"dim2\":\"Repressed PolyComb\"\n\"dim1\":\"H1 BMP4 Derived Mesendoderm Cultured Cells\",\"dim2\":\"Strong transcription\"\n\"dim1\":\"H1 BMP4 Derived Mesendoderm Cultured Cells\",\"dim2\":\"Transcr at gene 5 and 3\"\n\"dim1\":\"H1 BMP4 Derived Mesendoderm Cultured Cells\",\"dim2\":\"Wea epressed PolyComb\"\n\"dim1\":\"H1 BMP4 Derived Mesendoderm Cultured Cells\",\"dim2\":\"Weak transcription\"\n\"dim1\":\"H1 BMP4 Derived Mesendoderm Cultured Cells\",\"dim2\":\"ZNF genes and repeats\"\n\"dim1\":\"H1 BMP4 Derived Trophoblast Cultured Cells\",\"dim2\":\"Active TSS\"\n\"dim1\":\"H1 BMP4 Derived Trophoblast Cultured Cells\",\"dim2\":\"Bivalent Enhancer\"\n\"dim1\":\"H1 BMP4 Derived Trophoblast Cultured Cells\",\"dim2\":\"Bivalent Poised TSS\"\n\"dim1\":\"H1 BMP4 Derived Trophoblast Cultured Cells\",\"dim2\":\"Enhancers\"\n\"dim1\":\"H1 BMP4 Derived Trophoblast Cultured Cells\",\"dim2\":\"Flanking Active TSS\"\n\"dim1\":\"H1 BMP4 Derived Trophoblast Cultured Cells\",\"dim2\":\"Flanking Bivalent TSS Enh\"\n\"dim1\":\"H1 BMP4 Derived Trophoblast Cultured Cells\",\"dim2\":\"Genic enhancers\"\n\"dim1\":\"H1 BMP4 Derived Trophoblast Cultured Cells\",\"dim2\":\"Heterochromatin\"\n\"dim1\":\"H1 BMP4 Derived Trophoblast Cultured Cells\",\"dim2\":\"Quiescent Low\"\n\"dim1\":\"H1 BMP4 Derived Trophoblast Cultured Cells\",\"dim2\":\"Repressed PolyComb\"\n\"dim1\":\"H1 BMP4 Derived Trophoblast Cultured Cells\",\"dim2\":\"Strong transcription\"\n\"dim1\":\"H1 BMP4 Derived Trophoblast Cultured Cells\",\"dim2\":\"Transcr at gene 5 and 3\"\n\"dim1\":\"H1 BMP4 Derived Trophoblast Cultured Cells\",\"dim2\":\"Wea epressed PolyComb\"\n\"dim1\":\"H1 BMP4 Derived Trophoblast Cultured Cells\",\"dim2\":\"Weak transcription\"\n\"dim1\":\"H1 BMP4 Derived Trophoblast Cultured Cells\",\"dim2\":\"ZNF genes and repeats\"\n\"dim1\":\"H1 Cell Line\",\"dim2\":\"Active TSS\"\n\"dim1\":\"H1 Cell Line\",\"dim2\":\"Bivalent Enhancer\"\n\"dim1\":\"H1 Cell Line\",\"dim2\":\"Bivalent Poised TSS\"\n\"dim1\":\"H1 Cell Line\",\"dim2\":\"Enhancers\"\n\"dim1\":\"H1 Cell Line\",\"dim2\":\"Flanking Active TSS\"\n\"dim1\":\"H1 Cell Line\",\"dim2\":\"Flanking Bivalent TSS Enh\"\n\"dim1\":\"H1 Cell Line\",\"dim2\":\"Genic enhancers\"\n\"dim1\":\"H1 Cell Line\",\"dim2\":\"Heterochromatin\"\n\"dim1\":\"H1 Cell Line\",\"dim2\":\"Quiescent Low\"\n\"dim1\":\"H1 Cell Line\",\"dim2\":\"Repressed PolyComb\"\n\"dim1\":\"H1 Cell Line\",\"dim2\":\"Strong transcription\"\n\"dim1\":\"H1 Cell Line\",\"dim2\":\"Transcr at gene 5 and 3\"\n\"dim1\":\"H1 Cell Line\",\"dim2\":\"Wea epressed PolyComb\"\n\"dim1\":\"H1 Cell Line\",\"dim2\":\"Weak transcription\"\n\"dim1\":\"H1 Cell Line\",\"dim2\":\"ZNF genes and repeats\"\n\"dim1\":\"H1 Derived Mesenchymal Stem Cells\",\"dim2\":\"Active TSS\"\n\"dim1\":\"H1 Derived Mesenchymal Stem Cells\",\"dim2\":\"Bivalent Enhancer\"\n\"dim1\":\"H1 Derived Mesenchymal Stem Cells\",\"dim2\":\"Bivalent Poised TSS\"\n\"dim1\":\"H1 Derived Mesenchymal Stem Cells\",\"dim2\":\"Enhancers\"\n\"dim1\":\"H1 Derived Mesenchymal Stem Cells\",\"dim2\":\"Flanking Active TSS\"\n\"dim1\":\"H1 Derived Mesenchymal Stem Cells\",\"dim2\":\"Flanking Bivalent TSS Enh\"\n\"dim1\":\"H1 Derived Mesenchymal Stem Cells\",\"dim2\":\"Genic enhancers\"\n\"dim1\":\"H1 Derived Mesenchymal Stem Cells\",\"dim2\":\"Heterochromatin\"\n\"dim1\":\"H1 Derived Mesenchymal Stem Cells\",\"dim2\":\"Quiescent Low\"\n\"dim1\":\"H1 Derived Mesenchymal Stem Cells\",\"dim2\":\"Repressed PolyComb\"\n\"dim1\":\"H1 Derived Mesenchymal Stem Cells\",\"dim2\":\"Strong transcription\"\n\"dim1\":\"H1 Derived Mesenchymal Stem Cells\",\"dim2\":\"Transcr at gene 5 and 3\"\n\"dim1\":\"H1 Derived Mesenchymal Stem Cells\",\"dim2\":\"Wea epressed PolyComb\"\n\"dim1\":\"H1 Derived Mesenchymal Stem Cells\",\"dim2\":\"Weak transcription\"\n\"dim1\":\"H1 Derived Mesenchymal Stem Cells\",\"dim2\":\"ZNF genes and repeats\"\n\"dim1\":\"H1 Derived Neuronal Progenitor Cultured Cells\",\"dim2\":\"Active TSS\"\n\"dim1\":\"H1 Derived Neuronal Progenitor Cultured Cells\",\"dim2\":\"Bivalent Enhancer\"\n\"dim1\":\"H1 Derived Neuronal Progenitor Cultured Cells\",\"dim2\":\"Bivalent Poised TSS\"\n\"dim1\":\"H1 Derived Neuronal Progenitor Cultured Cells\",\"dim2\":\"Enhancers\"\n\"dim1\":\"H1 Derived Neuronal Progenitor Cultured Cells\",\"dim2\":\"Flanking Active TSS\"\n\"dim1\":\"H1 Derived Neuronal Progenitor Cultured Cells\",\"dim2\":\"Flanking Bivalent TSS Enh\"\n\"dim1\":\"H1 Derived Neuronal Progenitor Cultured Cells\",\"dim2\":\"Genic enhancers\"\n\"dim1\":\"H1 Derived Neuronal Progenitor Cultured Cells\",\"dim2\":\"Heterochromatin\"\n\"dim1\":\"H1 Derived Neuronal Progenitor Cultured Cells\",\"dim2\":\"Quiescent Low\"\n\"dim1\":\"H1 Derived Neuronal Progenitor Cultured Cells\",\"dim2\":\"Repressed PolyComb\"\n\"dim1\":\"H1 Derived Neuronal Progenitor Cultured Cells\",\"dim2\":\"Strong transcription\"\n\"dim1\":\"H1 Derived Neuronal Progenitor Cultured Cells\",\"dim2\":\"Transcr at gene 5 and 3\"\n\"dim1\":\"H1 Derived Neuronal Progenitor Cultured Cells\",\"dim2\":\"Wea epressed PolyComb\"\n\"dim1\":\"H1 Derived Neuronal Progenitor Cultured Cells\",\"dim2\":\"Weak transcription\"\n\"dim1\":\"H1 Derived Neuronal Progenitor Cultured Cells\",\"dim2\":\"ZNF genes and repeats\"\n\"dim1\":\"H9 Cell Line\",\"dim2\":\"Active TSS\"\n\"dim1\":\"H9 Cell Line\",\"dim2\":\"Bivalent Enhancer\"\n\"dim1\":\"H9 Cell Line\",\"dim2\":\"Bivalent Poised TSS\"\n\"dim1\":\"H9 Cell Line\",\"dim2\":\"Enhancers\"\n\"dim1\":\"H9 Cell Line\",\"dim2\":\"Flanking Active TSS\"\n\"dim1\":\"H9 Cell Line\",\"dim2\":\"Flanking Bivalent TSS Enh\"\n\"dim1\":\"H9 Cell Line\",\"dim2\":\"Genic enhancers\"\n\"dim1\":\"H9 Cell Line\",\"dim2\":\"Heterochromatin\"\n\"dim1\":\"H9 Cell Line\",\"dim2\":\"Quiescent Low\"\n\"dim1\":\"H9 Cell Line\",\"dim2\":\"Repressed PolyComb\"\n\"dim1\":\"H9 Cell Line\",\"dim2\":\"Strong transcription\"\n\"dim1\":\"H9 Cell Line\",\"dim2\":\"Transcr at gene 5 and 3\"\n\"dim1\":\"H9 Cell Line\",\"dim2\":\"Wea epressed PolyComb\"\n\"dim1\":\"H9 Cell Line\",\"dim2\":\"Weak transcription\"\n\"dim1\":\"H9 Cell Line\",\"dim2\":\"ZNF genes and repeats\"\n\"dim1\":\"H9 Derived Neuron Cultured Cells\",\"dim2\":\"Active TSS\"\n\"dim1\":\"H9 Derived Neuron Cultured Cells\",\"dim2\":\"Bivalent Enhancer\"\n\"dim1\":\"H9 Derived Neuron Cultured Cells\",\"dim2\":\"Bivalent Poised TSS\"\n\"dim1\":\"H9 Derived Neuron Cultured Cells\",\"dim2\":\"Enhancers\"\n\"dim1\":\"H9 Derived Neuron Cultured Cells\",\"dim2\":\"Flanking Active TSS\"\n\"dim1\":\"H9 Derived Neuron Cultured Cells\",\"dim2\":\"Flanking Bivalent TSS Enh\"\n\"dim1\":\"H9 Derived Neuron Cultured Cells\",\"dim2\":\"Genic enhancers\"\n\"dim1\":\"H9 Derived Neuron Cultured Cells\",\"dim2\":\"Heterochromatin\"\n\"dim1\":\"H9 Derived Neuron Cultured Cells\",\"dim2\":\"Quiescent Low\"\n\"dim1\":\"H9 Derived Neuron Cultured Cells\",\"dim2\":\"Repressed PolyComb\"\n\"dim1\":\"H9 Derived Neuron Cultured Cells\",\"dim2\":\"Strong transcription\"\n\"dim1\":\"H9 Derived Neuron Cultured Cells\",\"dim2\":\"Transcr at gene 5 and 3\"\n\"dim1\":\"H9 Derived Neuron Cultured Cells\",\"dim2\":\"Wea epressed PolyComb\"\n\"dim1\":\"H9 Derived Neuron Cultured Cells\",\"dim2\":\"Weak transcription\"\n\"dim1\":\"H9 Derived Neuron Cultured Cells\",\"dim2\":\"ZNF genes and repeats\"\n\"dim1\":\"H9 Derived Neuronal Progenitor Cultured Cells\",\"dim2\":\"Active TSS\"\n\"dim1\":\"H9 Derived Neuronal Progenitor Cultured Cells\",\"dim2\":\"Bivalent Enhancer\"\n\"dim1\":\"H9 Derived Neuronal Progenitor Cultured Cells\",\"dim2\":\"Bivalent Poised TSS\"\n\"dim1\":\"H9 Derived Neuronal Progenitor Cultured Cells\",\"dim2\":\"Enhancers\"\n\"dim1\":\"H9 Derived Neuronal Progenitor Cultured Cells\",\"dim2\":\"Flanking Active TSS\"\n\"dim1\":\"H9 Derived Neuronal Progenitor Cultured Cells\",\"dim2\":\"Flanking Bivalent TSS Enh\"\n\"dim1\":\"H9 Derived Neuronal Progenitor Cultured Cells\",\"dim2\":\"Genic enhancers\"\n\"dim1\":\"H9 Derived Neuronal Progenitor Cultured Cells\",\"dim2\":\"Heterochromatin\"\n\"dim1\":\"H9 Derived Neuronal Progenitor Cultured Cells\",\"dim2\":\"Quiescent Low\"\n\"dim1\":\"H9 Derived Neuronal Progenitor Cultured Cells\",\"dim2\":\"Repressed PolyComb\"\n\"dim1\":\"H9 Derived Neuronal Progenitor Cultured Cells\",\"dim2\":\"Strong transcription\"\n\"dim1\":\"H9 Derived Neuronal Progenitor Cultured Cells\",\"dim2\":\"Transcr at gene 5 and 3\"\n\"dim1\":\"H9 Derived Neuronal Progenitor Cultured Cells\",\"dim2\":\"Wea epressed PolyComb\"\n\"dim1\":\"H9 Derived Neuronal Progenitor Cultured Cells\",\"dim2\":\"Weak transcription\"\n\"dim1\":\"H9 Derived Neuronal Progenitor Cultured Cells\",\"dim2\":\"ZNF genes and repeats\"\n\"dim1\":\"HMEC Mammary Epithelial\",\"dim2\":\"Active TSS\"\n\"dim1\":\"HMEC Mammary Epithelial\",\"dim2\":\"Bivalent Enhancer\"\n\"dim1\":\"HMEC Mammary Epithelial\",\"dim2\":\"Bivalent Poised TSS\"\n\"dim1\":\"HMEC Mammary Epithelial\",\"dim2\":\"Enhancers\"\n\"dim1\":\"HMEC Mammary Epithelial\",\"dim2\":\"Flanking Active TSS\"\n\"dim1\":\"HMEC Mammary Epithelial\",\"dim2\":\"Flanking Bivalent TSS Enh\"\n\"dim1\":\"HMEC Mammary Epithelial\",\"dim2\":\"Genic enhancers\"\n\"dim1\":\"HMEC Mammary Epithelial\",\"dim2\":\"Heterochromatin\"\n\"dim1\":\"HMEC Mammary Epithelial\",\"dim2\":\"Quiescent Low\"\n\"dim1\":\"HMEC Mammary Epithelial\",\"dim2\":\"Repressed PolyComb\"\n\"dim1\":\"HMEC Mammary Epithelial\",\"dim2\":\"Strong transcription\"\n\"dim1\":\"HMEC Mammary Epithelial\",\"dim2\":\"Transcr at gene 5 and 3\"\n\"dim1\":\"HMEC Mammary Epithelial\",\"dim2\":\"Wea epressed PolyComb\"\n\"dim1\":\"HMEC Mammary Epithelial\",\"dim2\":\"Weak transcription\"\n\"dim1\":\"HMEC Mammary Epithelial\",\"dim2\":\"ZNF genes and repeats\"\n\"dim1\":\"HSMM Skeletal Muscle Myoblasts\",\"dim2\":\"Active TSS\"\n\"dim1\":\"HSMM Skeletal Muscle Myoblasts\",\"dim2\":\"Bivalent Enhancer\"\n\"dim1\":\"HSMM Skeletal Muscle Myoblasts\",\"dim2\":\"Bivalent Poised TSS\"\n\"dim1\":\"HSMM Skeletal Muscle Myoblasts\",\"dim2\":\"Enhancers\"\n\"dim1\":\"HSMM Skeletal Muscle Myoblasts\",\"dim2\":\"Flanking Active TSS\"\n\"dim1\":\"HSMM Skeletal Muscle Myoblasts\",\"dim2\":\"Flanking Bivalent TSS Enh\"\n\"dim1\":\"HSMM Skeletal Muscle Myoblasts\",\"dim2\":\"Genic enhancers\"\n\"dim1\":\"HSMM Skeletal Muscle Myoblasts\",\"dim2\":\"Heterochromatin\"\n\"dim1\":\"HSMM Skeletal Muscle Myoblasts\",\"dim2\":\"Quiescent Low\"\n\"dim1\":\"HSMM Skeletal Muscle Myoblasts\",\"dim2\":\"Repressed PolyComb\"\n\"dim1\":\"HSMM Skeletal Muscle Myoblasts\",\"dim2\":\"Strong transcription\"\n\"dim1\":\"HSMM Skeletal Muscle Myoblasts\",\"dim2\":\"Transcr at gene 5 and 3\"\n\"dim1\":\"HSMM Skeletal Muscle Myoblasts\",\"dim2\":\"Wea epressed PolyComb\"\n\"dim1\":\"HSMM Skeletal Muscle Myoblasts\",\"dim2\":\"Weak transcription\"\n\"dim1\":\"HSMM Skeletal Muscle Myoblasts\",\"dim2\":\"ZNF genes and repeats\"\n\"dim1\":\"HSMMtube Skeletal Muscle Myotubes Derived from HSMM\",\"dim2\":\"Active TSS\"\n\"dim1\":\"HSMMtube Skeletal Muscle Myotubes Derived from HSMM\",\"dim2\":\"Bivalent Enhancer\"\n\"dim1\":\"HSMMtube Skeletal Muscle Myotubes Derived from HSMM\",\"dim2\":\"Bivalent Poised TSS\"\n\"dim1\":\"HSMMtube Skeletal Muscle Myotubes Derived from HSMM\",\"dim2\":\"Enhancers\"\n\"dim1\":\"HSMMtube Skeletal Muscle Myotubes Derived from HSMM\",\"dim2\":\"Flanking Active TSS\"\n\"dim1\":\"HSMMtube Skeletal Muscle Myotubes Derived from HSMM\",\"dim2\":\"Flanking Bivalent TSS Enh\"\n\"dim1\":\"HSMMtube Skeletal Muscle Myotubes Derived from HSMM\",\"dim2\":\"Genic enhancers\"\n\"dim1\":\"HSMMtube Skeletal Muscle Myotubes Derived from HSMM\",\"dim2\":\"Heterochromatin\"\n\"dim1\":\"HSMMtube Skeletal Muscle Myotubes Derived from HSMM\",\"dim2\":\"Quiescent Low\"\n\"dim1\":\"HSMMtube Skeletal Muscle Myotubes Derived from HSMM\",\"dim2\":\"Repressed PolyComb\"\n\"dim1\":\"HSMMtube Skeletal Muscle Myotubes Derived from HSMM\",\"dim2\":\"Strong transcription\"\n\"dim1\":\"HSMMtube Skeletal Muscle Myotubes Derived from HSMM\",\"dim2\":\"Transcr at gene 5 and 3\"\n\"dim1\":\"HSMMtube Skeletal Muscle Myotubes Derived from HSMM\",\"dim2\":\"Wea epressed PolyComb\"\n\"dim1\":\"HSMMtube Skeletal Muscle Myotubes Derived from HSMM\",\"dim2\":\"Weak transcription\"\n\"dim1\":\"HSMMtube Skeletal Muscle Myotubes Derived from HSMM\",\"dim2\":\"ZNF genes and repeats\"\n\"dim1\":\"HUES48 Cell Line\",\"dim2\":\"Active TSS\"\n\"dim1\":\"HUES48 Cell Line\",\"dim2\":\"Bivalent Enhancer\"\n\"dim1\":\"HUES48 Cell Line\",\"dim2\":\"Bivalent Poised TSS\"\n\"dim1\":\"HUES48 Cell Line\",\"dim2\":\"Enhancers\"\n\"dim1\":\"HUES48 Cell Line\",\"dim2\":\"Flanking Active TSS\"\n\"dim1\":\"HUES48 Cell Line\",\"dim2\":\"Flanking Bivalent TSS Enh\"\n\"dim1\":\"HUES48 Cell Line\",\"dim2\":\"Genic enhancers\"\n\"dim1\":\"HUES48 Cell Line\",\"dim2\":\"Heterochromatin\"\n\"dim1\":\"HUES48 Cell Line\",\"dim2\":\"Quiescent Low\"\n\"dim1\":\"HUES48 Cell Line\",\"dim2\":\"Repressed PolyComb\"\n\"dim1\":\"HUES48 Cell Line\",\"dim2\":\"Strong transcription\"\n\"dim1\":\"HUES48 Cell Line\",\"dim2\":\"Transcr at gene 5 and 3\"\n\"dim1\":\"HUES48 Cell Line\",\"dim2\":\"Wea epressed PolyComb\"\n\"dim1\":\"HUES48 Cell Line\",\"dim2\":\"Weak transcription\"\n\"dim1\":\"HUES48 Cell Line\",\"dim2\":\"ZNF genes and repeats\"\n\"dim1\":\"HUES64 Cell Line\",\"dim2\":\"Active TSS\"\n\"dim1\":\"HUES64 Cell Line\",\"dim2\":\"Bivalent Enhancer\"\n\"dim1\":\"HUES64 Cell Line\",\"dim2\":\"Bivalent Poised TSS\"\n\"dim1\":\"HUES64 Cell Line\",\"dim2\":\"Enhancers\"\n\"dim1\":\"HUES64 Cell Line\",\"dim2\":\"Flanking Active TSS\"\n\"dim1\":\"HUES64 Cell Line\",\"dim2\":\"Flanking Bivalent TSS Enh\"\n\"dim1\":\"HUES64 Cell Line\",\"dim2\":\"Genic enhancers\"\n\"dim1\":\"HUES64 Cell Line\",\"dim2\":\"Heterochromatin\"\n\"dim1\":\"HUES64 Cell Line\",\"dim2\":\"Quiescent Low\"\n\"dim1\":\"HUES64 Cell Line\",\"dim2\":\"Repressed PolyComb\"\n\"dim1\":\"HUES64 Cell Line\",\"dim2\":\"Strong transcription\"\n\"dim1\":\"HUES64 Cell Line\",\"dim2\":\"Transcr at gene 5 and 3\"\n\"dim1\":\"HUES64 Cell Line\",\"dim2\":\"Wea epressed PolyComb\"\n\"dim1\":\"HUES64 Cell Line\",\"dim2\":\"Weak transcription\"\n\"dim1\":\"HUES64 Cell Line\",\"dim2\":\"ZNF genes and repeats\"\n\"dim1\":\"HUES6 Cell Line\",\"dim2\":\"Active TSS\"\n\"dim1\":\"HUES6 Cell Line\",\"dim2\":\"Bivalent Enhancer\"\n\"dim1\":\"HUES6 Cell Line\",\"dim2\":\"Bivalent Poised TSS\"\n\"dim1\":\"HUES6 Cell Line\",\"dim2\":\"Enhancers\"\n\"dim1\":\"HUES6 Cell Line\",\"dim2\":\"Flanking Active TSS\"\n\"dim1\":\"HUES6 Cell Line\",\"dim2\":\"Flanking Bivalent TSS Enh\"\n\"dim1\":\"HUES6 Cell Line\",\"dim2\":\"Genic enhancers\"\n\"dim1\":\"HUES6 Cell Line\",\"dim2\":\"Heterochromatin\"\n\"dim1\":\"HUES6 Cell Line\",\"dim2\":\"Quiescent Low\"\n\"dim1\":\"HUES6 Cell Line\",\"dim2\":\"Repressed PolyComb\"\n\"dim1\":\"HUES6 Cell Line\",\"dim2\":\"Strong transcription\"\n\"dim1\":\"HUES6 Cell Line\",\"dim2\":\"Transcr at gene 5 and 3\"\n\"dim1\":\"HUES6 Cell Line\",\"dim2\":\"Wea epressed PolyComb\"\n\"dim1\":\"HUES6 Cell Line\",\"dim2\":\"Weak transcription\"\n\"dim1\":\"HUES6 Cell Line\",\"dim2\":\"ZNF genes and repeats\"\n\"dim1\":\"HUVEC Umbilical Vein Endothelial Cells\",\"dim2\":\"Active TSS\"\n\"dim1\":\"HUVEC Umbilical Vein Endothelial Cells\",\"dim2\":\"Bivalent Enhancer\"\n\"dim1\":\"HUVEC Umbilical Vein Endothelial Cells\",\"dim2\":\"Bivalent Poised TSS\"\n\"dim1\":\"HUVEC Umbilical Vein Endothelial Cells\",\"dim2\":\"Enhancers\"\n\"dim1\":\"HUVEC Umbilical Vein Endothelial Cells\",\"dim2\":\"Flanking Active TSS\"\n\"dim1\":\"HUVEC Umbilical Vein Endothelial Cells\",\"dim2\":\"Flanking Bivalent TSS Enh\"\n\"dim1\":\"HUVEC Umbilical Vein Endothelial Cells\",\"dim2\":\"Genic enhancers\"\n\"dim1\":\"HUVEC Umbilical Vein Endothelial Cells\",\"dim2\":\"Heterochromatin\"\n\"dim1\":\"HUVEC Umbilical Vein Endothelial Cells\",\"dim2\":\"Quiescent Low\"\n\"dim1\":\"HUVEC Umbilical Vein Endothelial Cells\",\"dim2\":\"Repressed PolyComb\"\n\"dim1\":\"HUVEC Umbilical Vein Endothelial Cells\",\"dim2\":\"Strong transcription\"\n\"dim1\":\"HUVEC Umbilical Vein Endothelial Cells\",\"dim2\":\"Transcr at gene 5 and 3\"\n\"dim1\":\"HUVEC Umbilical Vein Endothelial Cells\",\"dim2\":\"Wea epressed PolyComb\"\n\"dim1\":\"HUVEC Umbilical Vein Endothelial Cells\",\"dim2\":\"Weak transcription\"\n\"dim1\":\"HUVEC Umbilical Vein Endothelial Cells\",\"dim2\":\"ZNF genes and repeats\"\n\"dim1\":\"HeLa S3 Cervical Carcinoma\",\"dim2\":\"Active TSS\"\n\"dim1\":\"HeLa S3 Cervical Carcinoma\",\"dim2\":\"Bivalent Enhancer\"\n\"dim1\":\"HeLa S3 Cervical Carcinoma\",\"dim2\":\"Bivalent Poised TSS\"\n\"dim1\":\"HeLa S3 Cervical Carcinoma\",\"dim2\":\"Enhancers\"\n\"dim1\":\"HeLa S3 Cervical Carcinoma\",\"dim2\":\"Flanking Active TSS\"\n\"dim1\":\"HeLa S3 Cervical Carcinoma\",\"dim2\":\"Flanking Bivalent TSS Enh\"\n\"dim1\":\"HeLa S3 Cervical Carcinoma\",\"dim2\":\"Genic enhancers\"\n\"dim1\":\"HeLa S3 Cervical Carcinoma\",\"dim2\":\"Heterochromatin\"\n\"dim1\":\"HeLa S3 Cervical Carcinoma\",\"dim2\":\"Quiescent Low\"\n\"dim1\":\"HeLa S3 Cervical Carcinoma\",\"dim2\":\"Repressed PolyComb\"\n\"dim1\":\"HeLa S3 Cervical Carcinoma\",\"dim2\":\"Strong transcription\"\n\"dim1\":\"HeLa S3 Cervical Carcinoma\",\"dim2\":\"Transcr at gene 5 and 3\"\n\"dim1\":\"HeLa S3 Cervical Carcinoma\",\"dim2\":\"Wea epressed PolyComb\"\n\"dim1\":\"HeLa S3 Cervical Carcinoma\",\"dim2\":\"Weak transcription\"\n\"dim1\":\"HeLa S3 Cervical Carcinoma\",\"dim2\":\"ZNF genes and repeats\"\n\"dim1\":\"HepG2 Hepatocellular Carcinoma\",\"dim2\":\"Active TSS\"\n\"dim1\":\"HepG2 Hepatocellular Carcinoma\",\"dim2\":\"Bivalent Enhancer\"\n\"dim1\":\"HepG2 Hepatocellular Carcinoma\",\"dim2\":\"Bivalent Poised TSS\"\n\"dim1\":\"HepG2 Hepatocellular Carcinoma\",\"dim2\":\"Enhancers\"\n\"dim1\":\"HepG2 Hepatocellular Carcinoma\",\"dim2\":\"Flanking Active TSS\"\n\"dim1\":\"HepG2 Hepatocellular Carcinoma\",\"dim2\":\"Flanking Bivalent TSS Enh\"\n\"dim1\":\"HepG2 Hepatocellular Carcinoma\",\"dim2\":\"Genic enhancers\"\n\"dim1\":\"HepG2 Hepatocellular Carcinoma\",\"dim2\":\"Heterochromatin\"\n\"dim1\":\"HepG2 Hepatocellular Carcinoma\",\"dim2\":\"Quiescent Low\"\n\"dim1\":\"HepG2 Hepatocellular Carcinoma\",\"dim2\":\"Repressed PolyComb\"\n\"dim1\":\"HepG2 Hepatocellular Carcinoma\",\"dim2\":\"Strong transcription\"\n\"dim1\":\"HepG2 Hepatocellular Carcinoma\",\"dim2\":\"Transcr at gene 5 and 3\"\n\"dim1\":\"HepG2 Hepatocellular Carcinoma\",\"dim2\":\"Wea epressed PolyComb\"\n\"dim1\":\"HepG2 Hepatocellular Carcinoma\",\"dim2\":\"Weak transcription\"\n\"dim1\":\"HepG2 Hepatocellular Carcinoma\",\"dim2\":\"ZNF genes and repeats\"\n\"dim1\":\"IMR90 Cell Line\",\"dim2\":\"Active TSS\"\n\"dim1\":\"IMR90 Cell Line\",\"dim2\":\"Bivalent Enhancer\"\n\"dim1\":\"IMR90 Cell Line\",\"dim2\":\"Bivalent Poised TSS\"\n\"dim1\":\"IMR90 Cell Line\",\"dim2\":\"Enhancers\"\n\"dim1\":\"IMR90 Cell Line\",\"dim2\":\"Flanking Active TSS\"\n\"dim1\":\"IMR90 Cell Line\",\"dim2\":\"Flanking Bivalent TSS Enh\"\n\"dim1\":\"IMR90 Cell Line\",\"dim2\":\"Genic enhancers\"\n\"dim1\":\"IMR90 Cell Line\",\"dim2\":\"Heterochromatin\"\n\"dim1\":\"IMR90 Cell Line\",\"dim2\":\"Quiescent Low\"\n\"dim1\":\"IMR90 Cell Line\",\"dim2\":\"Repressed PolyComb\"\n\"dim1\":\"IMR90 Cell Line\",\"dim2\":\"Strong transcription\"\n\"dim1\":\"IMR90 Cell Line\",\"dim2\":\"Transcr at gene 5 and 3\"\n\"dim1\":\"IMR90 Cell Line\",\"dim2\":\"Wea epressed PolyComb\"\n\"dim1\":\"IMR90 Cell Line\",\"dim2\":\"Weak transcription\"\n\"dim1\":\"IMR90 Cell Line\",\"dim2\":\"ZNF genes and repeats\"\n\"dim1\":\"K562 Leukemia\",\"dim2\":\"Active TSS\"\n\"dim1\":\"K562 Leukemia\",\"dim2\":\"Bivalent Enhancer\"\n\"dim1\":\"K562 Leukemia\",\"dim2\":\"Bivalent Poised TSS\"\n\"dim1\":\"K562 Leukemia\",\"dim2\":\"Enhancers\"\n\"dim1\":\"K562 Leukemia\",\"dim2\":\"Flanking Active TSS\"\n\"dim1\":\"K562 Leukemia\",\"dim2\":\"Flanking Bivalent TSS Enh\"\n\"dim1\":\"K562 Leukemia\",\"dim2\":\"Genic enhancers\"\n\"dim1\":\"K562 Leukemia\",\"dim2\":\"Heterochromatin\"\n\"dim1\":\"K562 Leukemia\",\"dim2\":\"Quiescent Low\"\n\"dim1\":\"K562 Leukemia\",\"dim2\":\"Repressed PolyComb\"\n\"dim1\":\"K562 Leukemia\",\"dim2\":\"Strong transcription\"\n\"dim1\":\"K562 Leukemia\",\"dim2\":\"Transcr at gene 5 and 3\"\n\"dim1\":\"K562 Leukemia\",\"dim2\":\"Wea epressed PolyComb\"\n\"dim1\":\"K562 Leukemia\",\"dim2\":\"Weak transcription\"\n\"dim1\":\"K562 Leukemia\",\"dim2\":\"ZNF genes and repeats\"\n\"dim1\":\"Left Ventricle\",\"dim2\":\"Active TSS\"\n\"dim1\":\"Left Ventricle\",\"dim2\":\"Bivalent Enhancer\"\n\"dim1\":\"Left Ventricle\",\"dim2\":\"Bivalent Poised TSS\"\n\"dim1\":\"Left Ventricle\",\"dim2\":\"Enhancers\"\n\"dim1\":\"Left Ventricle\",\"dim2\":\"Flanking Active TSS\"\n\"dim1\":\"Left Ventricle\",\"dim2\":\"Flanking Bivalent TSS Enh\"\n\"dim1\":\"Left Ventricle\",\"dim2\":\"Genic enhancers\"\n\"dim1\":\"Left Ventricle\",\"dim2\":\"Heterochromatin\"\n\"dim1\":\"Left Ventricle\",\"dim2\":\"Quiescent Low\"\n\"dim1\":\"Left Ventricle\",\"dim2\":\"Repressed PolyComb\"\n\"dim1\":\"Left Ventricle\",\"dim2\":\"Strong transcription\"\n\"dim1\":\"Left Ventricle\",\"dim2\":\"Transcr at gene 5 and 3\"\n\"dim1\":\"Left Ventricle\",\"dim2\":\"Wea epressed PolyComb\"\n\"dim1\":\"Left Ventricle\",\"dim2\":\"Weak transcription\"\n\"dim1\":\"Left Ventricle\",\"dim2\":\"ZNF genes and repeats\"\n\"dim1\":\"Lung Active TSS\"\n\"dim1\":\"Lung\",\"dim2\":\"Bivalent Enhancer\"\n\"dim1\":\"Lung\",\"dim2\":\"Bivalent Poised TSS\"\n\"dim1\":\"Lung\",\"dim2\":\"Enhancers\"\n\"dim1\":\"Lung\",\"dim2\":\"Flanking Active TSS\"\n\"dim1\":\"Lung\",\"dim2\":\"Flanking Bivalent TSS Enh\"\n\"dim1\":\"Lung\",\"dim2\":\"Genic enhancers\"\n\"dim1\":\"Lung\",\"dim2\":\"Heterochromatin\"\n\"dim1\":\"Lung\",\"dim2\":\"Quiescent Low\"\n\"dim1\":\"Lung\",\"dim2\":\"Repressed PolyComb\"\n\"dim1\":\"Lung\",\"dim2\":\"Strong transcription\"\n\"dim1\":\"Lung\",\"dim2\":\"Transcr at gene 5 and 3\"\n\"dim1\":\"Lung\",\"dim2\":\"Wea epressed PolyComb\"\n\"dim1\":\"Lung\",\"dim2\":\"Weak transcription\"\n\"dim1\":\"Lung\",\"dim2\":\"ZNF genes and repeats\"\n\"dim1\":\"Mesenchymal Stem Cell Derived Adipocyte Cultured Cells\",\"dim2\":\"Active TSS\"\n\"dim1\":\"Mesenchymal Stem Cell Derived Adipocyte Cultured Cells\",\"dim2\":\"Bivalent Enhancer\"\n\"dim1\":\"Mesenchymal Stem Cell Derived Adipocyte Cultured Cells\",\"dim2\":\"Bivalent Poised TSS\"\n\"dim1\":\"Mesenchymal Stem Cell Derived Adipocyte Cultured Cells\",\"dim2\":\"Enhancers\"\n\"dim1\":\"Mesenchymal Stem Cell Derived Adipocyte Cultured Cells\",\"dim2\":\"Flanking Active TSS\"\n\"dim1\":\"Mesenchymal Stem Cell Derived Adipocyte Cultured Cells\",\"dim2\":\"Flanking Bivalent TSS Enh\"\n\"dim1\":\"Mesenchymal Stem Cell Derived Adipocyte Cultured Cells\",\"dim2\":\"Genic enhancers\"\n\"dim1\":\"Mesenchymal Stem Cell Derived Adipocyte Cultured Cells\",\"dim2\":\"Heterochromatin\"\n\"dim1\":\"Mesenchymal Stem Cell Derived Adipocyte Cultured Cells\",\"dim2\":\"Quiescent Low\"\n\"dim1\":\"Mesenchymal Stem Cell Derived Adipocyte Cultured Cells\",\"dim2\":\"Repressed PolyComb\"\n\"dim1\":\"Mesenchymal Stem Cell Derived Adipocyte Cultured Cells\",\"dim2\":\"Strong transcription\"\n\"dim1\":\"Mesenchymal Stem Cell Derived Adipocyte Cultured Cells\",\"dim2\":\"Transcr at gene 5 and 3\"\n\"dim1\":\"Mesenchymal Stem Cell Derived Adipocyte Cultured Cells\",\"dim2\":\"Wea epressed PolyComb\"\n\"dim1\":\"Mesenchymal Stem Cell Derived Adipocyte Cultured Cells\",\"dim2\":\"Weak transcription\"\n\"dim1\":\"Mesenchymal Stem Cell Derived Adipocyte Cultured Cells\",\"dim2\":\"ZNF genes and repeats\"\n\"dim1\":\"Mobilized CD34 Primary Cells Female\",\"dim2\":\"Active TSS\"\n\"dim1\":\"Mobilized CD34 Primary Cells Female\",\"dim2\":\"Bivalent Enhancer\"\n\"dim1\":\"Mobilized CD34 Primary Cells Female\",\"dim2\":\"Bivalent Poised TSS\"\n\"dim1\":\"Mobilized CD34 Primary Cells Female\",\"dim2\":\"Enhancers\"\n\"dim1\":\"Mobilized CD34 Primary Cells Female\",\"dim2\":\"Flanking Active TSS\"\n\"dim1\":\"Mobilized CD34 Primary Cells Female\",\"dim2\":\"Flanking Bivalent TSS Enh\"\n\"dim1\":\"Mobilized CD34 Primary Cells Female\",\"dim2\":\"Genic enhancers\"\n\"dim1\":\"Mobilized CD34 Primary Cells Female\",\"dim2\":\"Heterochromatin\"\n\"dim1\":\"Mobilized CD34 Primary Cells Female\",\"dim2\":\"Quiescent Low\"\n\"dim1\":\"Mobilized CD34 Primary Cells Female\",\"dim2\":\"Repressed PolyComb\"\n\"dim1\":\"Mobilized CD34 Primary Cells Female\",\"dim2\":\"Strong transcription\"\n\"dim1\":\"Mobilized CD34 Primary Cells Female\",\"dim2\":\"Transcr at gene 5 and 3\"\n\"dim1\":\"Mobilized CD34 Primary Cells Female\",\"dim2\":\"Wea epressed PolyComb\"\n\"dim1\":\"Mobilized CD34 Primary Cells Female\",\"dim2\":\"Weak transcription\"\n\"dim1\":\"Mobilized CD34 Primary Cells Female\",\"dim2\":\"ZNF genes and repeats\"\n\"dim1\":\"Mobilized CD34 Primary Cells Male\",\"dim2\":\"Active TSS\"\n\"dim1\":\"Mobilized CD34 Primary Cells Male\",\"dim2\":\"Bivalent Enhancer\"\n\"dim1\":\"Mobilized CD34 Primary Cells Male\",\"dim2\":\"Bivalent Poised TSS\"\n\"dim1\":\"Mobilized CD34 Primary Cells Male\",\"dim2\":\"Enhancers\"\n\"dim1\":\"Mobilized CD34 Primary Cells Male\",\"dim2\":\"Flanking Active TSS\"\n\"dim1\":\"Mobilized CD34 Primary Cells Male\",\"dim2\":\"Flanking Bivalent TSS Enh\"\n\"dim1\":\"Mobilized CD34 Primary Cells Male\",\"dim2\":\"Genic enhancers\"\n\"dim1\":\"Mobilized CD34 Primary Cells Male\",\"dim2\":\"Heterochromatin\"\n\"dim1\":\"Mobilized CD34 Primary Cells Male\",\"dim2\":\"Quiescent Low\"\n\"dim1\":\"Mobilized CD34 Primary Cells Male\",\"dim2\":\"Repressed PolyComb\"\n\"dim1\":\"Mobilized CD34 Primary Cells Male\",\"dim2\":\"Strong transcription\"\n\"dim1\":\"Mobilized CD34 Primary Cells Male\",\"dim2\":\"Transcr at gene 5 and 3\"\n\"dim1\":\"Mobilized CD34 Primary Cells Male\",\"dim2\":\"Wea epressed PolyComb\"\n\"dim1\":\"Mobilized CD34 Primary Cells Male\",\"dim2\":\"Weak transcription\"\n\"dim1\":\"Mobilized CD34 Primary Cells Male\",\"dim2\":\"ZNF genes and repeats\"\n\"dim1\":\"Monocytes CD14pp RO01746\",\"dim2\":\"Active TSS\"\n\"dim1\":\"Monocytes CD14pp RO01746\",\"dim2\":\"Bivalent Enhancer\"\n\"dim1\":\"Monocytes CD14pp RO01746\",\"dim2\":\"Bivalent Poised TSS\"\n\"dim1\":\"Monocytes CD14pp RO01746\",\"dim2\":\"Enhancers\"\n\"dim1\":\"Monocytes CD14pp RO01746\",\"dim2\":\"Flanking Active TSS\"\n\"dim1\":\"Monocytes CD14pp RO01746\",\"dim2\":\"Flanking Bivalent TSS Enh\"\n\"dim1\":\"Monocytes CD14pp RO01746\",\"dim2\":\"Genic enhancers\"\n\"dim1\":\"Monocytes CD14pp RO01746\",\"dim2\":\"Heterochromatin\"\n\"dim1\":\"Monocytes CD14pp RO01746\",\"dim2\":\"Quiescent Low\"\n\"dim1\":\"Monocytes CD14pp RO01746\",\"dim2\":\"Repressed PolyComb\"\n\"dim1\":\"Monocytes CD14pp RO01746\",\"dim2\":\"Strong transcription\"\n\"dim1\":\"Monocytes CD14pp RO01746\",\"dim2\":\"Transcr at gene 5 and 3\"\n\"dim1\":\"Monocytes CD14pp RO01746\",\"dim2\":\"Wea epressed PolyComb\"\n\"dim1\":\"Monocytes CD14pp RO01746\",\"dim2\":\"Weak transcription\"\n\"dim1\":\"Monocytes CD14pp RO01746\",\"dim2\":\"ZNF genes and repeats\"\n\"dim1\":\"Muscle Satellite Cultured Cells\",\"dim2\":\"Active TSS\"\n\"dim1\":\"Muscle Satellite Cultured Cells\",\"dim2\":\"Bivalent Enhancer\"\n\"dim1\":\"Muscle Satellite Cultured Cells\",\"dim2\":\"Bivalent Poised TSS\"\n\"dim1\":\"Muscle Satellite Cultured Cells\",\"dim2\":\"Enhancers\"\n\"dim1\":\"Muscle Satellite Cultured Cells\",\"dim2\":\"Flanking Active TSS\"\n\"dim1\":\"Muscle Satellite Cultured Cells\",\"dim2\":\"Flanking Bivalent TSS Enh\"\n\"dim1\":\"Muscle Satellite Cultured Cells\",\"dim2\":\"Genic enhancers\"\n\"dim1\":\"Muscle Satellite Cultured Cells\",\"dim2\":\"Heterochromatin\"\n\"dim1\":\"Muscle Satellite Cultured Cells\",\"dim2\":\"Quiescent Low\"\n\"dim1\":\"Muscle Satellite Cultured Cells\",\"dim2\":\"Repressed PolyComb\"\n\"dim1\":\"Muscle Satellite Cultured Cells\",\"dim2\":\"Strong transcription\"\n\"dim1\":\"Muscle Satellite Cultured Cells\",\"dim2\":\"Transcr at gene 5 and 3\"\n\"dim1\":\"Muscle Satellite Cultured Cells\",\"dim2\":\"Wea epressed PolyComb\"\n\"dim1\":\"Muscle Satellite Cultured Cells\",\"dim2\":\"Weak transcription\"\n\"dim1\":\"Muscle Satellite Cultured Cells\",\"dim2\":\"ZNF genes and repeats\"\n\"dim1\":\"NHDF Ad Adult Dermal Fibroblasts\",\"dim2\":\"Active TSS\"\n\"dim1\":\"NHDF Ad Adult Dermal Fibroblasts\",\"dim2\":\"Bivalent Enhancer\"\n\"dim1\":\"NHDF Ad Adult Dermal Fibroblasts\",\"dim2\":\"Bivalent Poised TSS\"\n\"dim1\":\"NHDF Ad Adult Dermal Fibroblasts\",\"dim2\":\"Enhancers\"\n\"dim1\":\"NHDF Ad Adult Dermal Fibroblasts\",\"dim2\":\"Flanking Active TSS\"\n\"dim1\":\"NHDF Ad Adult Dermal Fibroblasts\",\"dim2\":\"Flanking Bivalent TSS Enh\"\n\"dim1\":\"NHDF Ad Adult Dermal Fibroblasts\",\"dim2\":\"Genic enhancers\"\n\"dim1\":\"NHDF Ad Adult Dermal Fibroblasts\",\"dim2\":\"Heterochromatin\"\n\"dim1\":\"NHDF Ad Adult Dermal Fibroblasts\",\"dim2\":\"Quiescent Low\"\n\"dim1\":\"NHDF Ad Adult Dermal Fibroblasts\",\"dim2\":\"Repressed PolyComb\"\n\"dim1\":\"NHDF Ad Adult Dermal Fibroblasts\",\"dim2\":\"Strong transcription\"\n\"dim1\":\"NHDF Ad Adult Dermal Fibroblasts\",\"dim2\":\"Transcr at gene 5 and 3\"\n\"dim1\":\"NHDF Ad Adult Dermal Fibroblasts\",\"dim2\":\"Wea epressed PolyComb\"\n\"dim1\":\"NHDF Ad Adult Dermal Fibroblasts\",\"dim2\":\"Weak transcription\"\n\"dim1\":\"NHDF Ad Adult Dermal Fibroblasts\",\"dim2\":\"ZNF genes and repeats\"\n\"dim1\":\"NHEK Epidermal Keratinocytes\",\"dim2\":\"Active TSS\"\n\"dim1\":\"NHEK Epidermal Keratinocytes\",\"dim2\":\"Bivalent Enhancer\"\n\"dim1\":\"NHEK Epidermal Keratinocytes\",\"dim2\":\"Bivalent Poised TSS\"\n\"dim1\":\"NHEK Epidermal Keratinocytes\",\"dim2\":\"Enhancers\"\n\"dim1\":\"NHEK Epidermal Keratinocytes\",\"dim2\":\"Flanking Active TSS\"\n\"dim1\":\"NHEK Epidermal Keratinocytes\",\"dim2\":\"Flanking Bivalent TSS Enh\"\n\"dim1\":\"NHEK Epidermal Keratinocytes\",\"dim2\":\"Genic enhancers\"\n\"dim1\":\"NHEK Epidermal Keratinocytes\",\"dim2\":\"Heterochromatin\"\n\"dim1\":\"NHEK Epidermal Keratinocytes\",\"dim2\":\"Quiescent Low\"\n\"dim1\":\"NHEK Epidermal Keratinocytes\",\"dim2\":\"Repressed PolyComb\"\n\"dim1\":\"NHEK Epidermal Keratinocytes\",\"dim2\":\"Strong transcription\"\n\"dim1\":\"NHEK Epidermal Keratinocytes\",\"dim2\":\"Transcr at gene 5 and 3\"\n\"dim1\":\"NHEK Epidermal Keratinocytes\",\"dim2\":\"Wea epressed PolyComb\"\n\"dim1\":\"NHEK Epidermal Keratinocytes\",\"dim2\":\"Weak transcription\"\n\"dim1\":\"NHEK Epidermal Keratinocytes\",\"dim2\":\"ZNF genes and repeats\"\n\"dim1\":\"NHLF Lung Fibroblasts\",\"dim2\":\"Active TSS\"\n\"dim1\":\"NHLF Lung Fibroblasts\",\"dim2\":\"Bivalent Enhancer\"\n\"dim1\":\"NHLF Lung Fibroblasts\",\"dim2\":\"Bivalent Poised TSS\"\n\"dim1\":\"NHLF Lung Fibroblasts\",\"dim2\":\"Enhancers\"\n\"dim1\":\"NHLF Lung Fibroblasts\",\"dim2\":\"Flanking Active TSS\"\n\"dim1\":\"NHLF Lung Fibroblasts\",\"dim2\":\"Flanking Bivalent TSS Enh\"\n\"dim1\":\"NHLF Lung Fibroblasts\",\"dim2\":\"Genic enhancers\"\n\"dim1\":\"NHLF Lung Fibroblasts\",\"dim2\":\"Heterochromatin\"\n\"dim1\":\"NHLF Lung Fibroblasts\",\"dim2\":\"Quiescent Low\"\n\"dim1\":\"NHLF Lung Fibroblasts\",\"dim2\":\"Repressed PolyComb\"\n\"dim1\":\"NHLF Lung Fibroblasts\",\"dim2\":\"Strong transcription\"\n\"dim1\":\"NHLF Lung Fibroblasts\",\"dim2\":\"Transcr at gene 5 and 3\"\n\"dim1\":\"NHLF Lung Fibroblasts\",\"dim2\":\"Wea epressed PolyComb\"\n\"dim1\":\"NHLF Lung Fibroblasts\",\"dim2\":\"Weak transcription\"\n\"dim1\":\"NHLF Lung Fibroblasts\",\"dim2\":\"ZNF genes and repeats\"\n\"dim1\":\"NH A Astrocytes\",\"dim2\":\"Active TSS\"\n\"dim1\":\"NH A Astrocytes\",\"dim2\":\"Bivalent Enhancer\"\n\"dim1\":\"NH A Astrocytes\",\"dim2\":\"Bivalent Poised TSS\"\n\"dim1\":\"NH A Astrocytes\",\"dim2\":\"Enhancers\"\n\"dim1\":\"NH A Astrocytes\",\"dim2\":\"Flanking Active TSS\"\n\"dim1\":\"NH A Astrocytes\",\"dim2\":\"Flanking Bivalent TSS Enh\"\n\"dim1\":\"NH A Astrocytes\",\"dim2\":\"Genic enhancers\"\n\"dim1\":\"NH A Astrocytes\",\"dim2\":\"Heterochromatin\"\n\"dim1\":\"NH A Astrocytes\",\"dim2\":\"Quiescent Low\"\n\"dim1\":\"NH A Astrocytes\",\"dim2\":\"Repressed PolyComb\"\n\"dim1\":\"NH A Astrocytes\",\"dim2\":\"Strong transcription\"\n\"dim1\":\"NH A Astrocytes\",\"dim2\":\"Transcr at gene 5 and 3\"\n\"dim1\":\"NH A Astrocytes\",\"dim2\":\"Wea epressed PolyComb\"\n\"dim1\":\"NH A Astrocytes\",\"dim2\":\"Weak transcription\"\n\"dim1\":\"NH A Astrocytes\",\"dim2\":\"ZNF genes and repeats\"\n\"dim1\":\"Neurosphere Cultured Cells Cortex Derived\",\"dim2\":\"Active TSS\"\n\"dim1\":\"Neurosphere Cultured Cells Cortex Derived\",\"dim2\":\"Bivalent Enhancer\"\n\"dim1\":\"Neurosphere Cultured Cells Cortex Derived\",\"dim2\":\"Bivalent Poised TSS\"\n\"dim1\":\"Neurosphere Cultured Cells Cortex Derived\",\"dim2\":\"Enhancers\"\n\"dim1\":\"Neurosphere Cultured Cells Cortex Derived\",\"dim2\":\"Flanking Active TSS\"\n\"dim1\":\"Neurosphere Cultured Cells Cortex Derived\",\"dim2\":\"Flanking Bivalent TSS Enh\"\n\"dim1\":\"Neurosphere Cultured Cells Cortex Derived\",\"dim2\":\"Genic enhancers\"\n\"dim1\":\"Neurosphere Cultured Cells Cortex Derived\",\"dim2\":\"Heterochromatin\"\n\"dim1\":\"Neurosphere Cultured Cells Cortex Derived\",\"dim2\":\"Quiescent Low\"\n\"dim1\":\"Neurosphere Cultured Cells Cortex Derived\",\"dim2\":\"Repressed PolyComb\"\n\"dim1\":\"Neurosphere Cultured Cells Cortex Derived\",\"dim2\":\"Strong transcription\"\n\"dim1\":\"Neurosphere Cultured Cells Cortex Derived\",\"dim2\":\"Transcr at gene 5 and 3\"\n\"dim1\":\"Neurosphere Cultured Cells Cortex Derived\",\"dim2\":\"Wea epressed PolyComb\"\n\"dim1\":\"Neurosphere Cultured Cells Cortex Derived\",\"dim2\":\"Weak transcription\"\n\"dim1\":\"Neurosphere Cultured Cells Cortex Derived\",\"dim2\":\"ZNF genes and repeats\"\n\"dim1\":\"Neurosphere Cultured Cells Ganglionic Eminence Derived\",\"dim2\":\"Active TSS\"\n\"dim1\":\"Neurosphere Cultured Cells Ganglionic Eminence Derived\",\"dim2\":\"Bivalent Enhancer\"\n\"dim1\":\"Neurosphere Cultured Cells Ganglionic Eminence Derived\",\"dim2\":\"Bivalent Poised TSS\"\n\"dim1\":\"Neurosphere Cultured Cells Ganglionic Eminence Derived\",\"dim2\":\"Enhancers\"\n\"dim1\":\"Neurosphere Cultured Cells Ganglionic Eminence Derived\",\"dim2\":\"Flanking Active TSS\"\n\"dim1\":\"Neurosphere Cultured Cells Ganglionic Eminence Derived\",\"dim2\":\"Flanking Bivalent TSS Enh\"\n\"dim1\":\"Neurosphere Cultured Cells Ganglionic Eminence Derived\",\"dim2\":\"Genic enhancers\"\n\"dim1\":\"Neurosphere Cultured Cells Ganglionic Eminence Derived\",\"dim2\":\"Heterochromatin\"\n\"dim1\":\"Neurosphere Cultured Cells Ganglionic Eminence Derived\",\"dim2\":\"Quiescent Low\"\n\"dim1\":\"Neurosphere Cultured Cells Ganglionic Eminence Derived\",\"dim2\":\"Repressed PolyComb\"\n\"dim1\":\"Neurosphere Cultured Cells Ganglionic Eminence Derived\",\"dim2\":\"Strong transcription\"\n\"dim1\":\"Neurosphere Cultured Cells Ganglionic Eminence Derived\",\"dim2\":\"Transcr at gene 5 and 3\"\n\"dim1\":\"Neurosphere Cultured Cells Ganglionic Eminence Derived\",\"dim2\":\"Wea epressed PolyComb\"\n\"dim1\":\"Neurosphere Cultured Cells Ganglionic Eminence Derived\",\"dim2\":\"Weak transcription\"\n\"dim1\":\"Neurosphere Cultured Cells Ganglionic Eminence Derived\",\"dim2\":\"ZNF genes and repeats\"\n\"dim1\":\"Osteoblasts\",\"dim2\":\"Active TSS\"\n\"dim1\":\"Osteoblasts\",\"dim2\":\"Bivalent Enhancer\"\n\"dim1\":\"Osteoblasts\",\"dim2\":\"Bivalent Poised TSS\"\n\"dim1\":\"Osteoblasts\",\"dim2\":\"Enhancers\"\n\"dim1\":\"Osteoblasts\",\"dim2\":\"Flanking Active TSS\"\n\"dim1\":\"Osteoblasts\",\"dim2\":\"Flanking Bivalent TSS Enh\"\n\"dim1\":\"Osteoblasts\",\"dim2\":\"Genic enhancers\"\n\"dim1\":\"Osteoblasts\",\"dim2\":\"Heterochromatin\"\n\"dim1\":\"Osteoblasts\",\"dim2\":\"Quiescent Low\"\n\"dim1\":\"Osteoblasts\",\"dim2\":\"Repressed PolyComb\"\n\"dim1\":\"Osteoblasts\",\"dim2\":\"Strong transcription\"\n\"dim1\":\"Osteoblasts\",\"dim2\":\"Transcr at gene 5 and 3\"\n\"dim1\":\"Osteoblasts\",\"dim2\":\"Wea epressed PolyComb\"\n\"dim1\":\"Osteoblasts\",\"dim2\":\"Weak transcription\"\n\"dim1\":\"Osteoblasts\",\"dim2\":\"ZNF genes and repeats\"\n\"dim1\":\"Ovary\",\"dim2\":\"Active TSS\"\n\"dim1\":\"Ovary\",\"dim2\":\"Bivalent Enhancer\"\n\"dim1\":\"Ovary\",\"dim2\":\"Bivalent Poised TSS\"\n\"dim1\":\"Ovary\",\"dim2\":\"Enhancers\"\n\"dim1\":\"Ovary\",\"dim2\":\"Flanking Active TSS\"\n\"dim1\":\"Ovary\",\"dim2\":\"Flanking Bivalent TSS Enh\"\n\"dim1\":\"Ovary\",\"dim2\":\"Genic enhancers\"\n\"dim1\":\"Ovary\",\"dim2\":\"Heterochromatin\"\n\"dim1\":\"Ovary\",\"dim2\":\"Quiescent Low\"\n\"dim1\":\"Ovary\",\"dim2\":\"Repressed PolyComb\"\n\"dim1\":\"Ovary\",\"dim2\":\"Strong transcription\"\n\"dim1\":\"Ovary\",\"dim2\":\"Transcr at gene 5 and 3\"\n\"dim1\":\"Ovary\",\"dim2\":\"Wea epressed PolyComb\"\n\"dim1\":\"Ovary\",\"dim2\":\"Weak transcription\"\n\"dim1\":\"Ovary\",\"dim2\":\"ZNF genes and repeats\"\n\"dim1\":\"Pancreas\",\"dim2\":\"Active TSS\"\n\"dim1\":\"Pancreas\",\"dim2\":\"Bivalent Enhancer\"\n\"dim1\":\"Pancreas\",\"dim2\":\"Bivalent Poised TSS\"\n\"dim1\":\"Pancreas\",\"dim2\":\"Enhancers\"\n\"dim1\":\"Pancreas\",\"dim2\":\"Flanking Active TSS\"\n\"dim1\":\"Pancreas\",\"dim2\":\"Flanking Bivalent TSS Enh\"\n\"dim1\":\"Pancreas\",\"dim2\":\"Genic enhancers\"\n\"dim1\":\"Pancreas\",\"dim2\":\"Heterochromatin\"\n\"dim1\":\"Pancreas\",\"dim2\":\"Quiescent Low\"\n\"dim1\":\"Pancreas\",\"dim2\":\"Repressed PolyComb\"\n\"dim1\":\"Pancreas\",\"dim2\":\"Strong transcription\"\n\"dim1\":\"Pancreas\",\"dim2\":\"Transcr at gene 5 and 3\"\n\"dim1\":\"Pancreas\",\"dim2\":\"Wea epressed PolyComb\"\n\"dim1\":\"Pancreas\",\"dim2\":\"Weak transcription\"\n\"dim1\":\"Pancreas\",\"dim2\":\"ZNF genes and repeats\"\n\"dim1\":\"Pancreatic Islets\",\"dim2\":\"Active TSS\"\n\"dim1\":\"Pancreatic Islets\",\"dim2\":\"Bivalent Enhancer\"\n\"dim1\":\"Pancreatic Islets\",\"dim2\":\"Bivalent Poised TSS\"\n\"dim1\":\"Pancreatic Islets\",\"dim2\":\"Enhancers\"\n\"dim1\":\"Pancreatic Islets\",\"dim2\":\"Flanking Active TSS\"\n\"dim1\":\"Pancreatic Islets\",\"dim2\":\"Flanking Bivalent TSS Enh\"\n\"dim1\":\"Pancreatic Islets\",\"dim2\":\"Genic enhancers\"\n\"dim1\":\"Pancreatic Islets\",\"dim2\":\"Heterochromatin\"\n\"dim1\":\"Pancreatic Islets\",\"dim2\":\"Quiescent Low\"\n\"dim1\":\"Pancreatic Islets\",\"dim2\":\"Repressed PolyComb\"\n\"dim1\":\"Pancreatic Islets\",\"dim2\":\"Strong transcription\"\n\"dim1\":\"Pancreatic Islets\",\"dim2\":\"Transcr at gene 5 and 3\"\n\"dim1\":\"Pancreatic Islets\",\"dim2\":\"Wea epressed PolyComb\"\n\"dim1\":\"Pancreatic Islets\",\"dim2\":\"Weak transcription\"\n\"dim1\":\"Pancreatic Islets\",\"dim2\":\"ZNF genes and repeats\"\n\"dim1\":\"Penis Foreskin Fibroblast Primary Cells skin01\",\"dim2\":\"Active TSS\"\n\"dim1\":\"Penis Foreskin Fibroblast Primary Cells skin01\",\"dim2\":\"Bivalent Enhancer\"\n\"dim1\":\"Penis Foreskin Fibroblast Primary Cells skin01\",\"dim2\":\"Bivalent Poised TSS\"\n\"dim1\":\"Penis Foreskin Fibroblast Primary Cells skin01\",\"dim2\":\"Enhancers\"\n\"dim1\":\"Penis Foreskin Fibroblast Primary Cells skin01\",\"dim2\":\"Flanking Active TSS\"\n\"dim1\":\"Penis Foreskin Fibroblast Primary Cells skin01\",\"dim2\":\"Flanking Bivalent TSS Enh\"\n\"dim1\":\"Penis Foreskin Fibroblast Primary Cells skin01\",\"dim2\":\"Genic enhancers\"\n\"dim1\":\"Penis Foreskin Fibroblast Primary Cells skin01\",\"dim2\":\"Heterochromatin\"\n\"dim1\":\"Penis Foreskin Fibroblast Primary Cells skin01\",\"dim2\":\"Quiescent Low\"\n\"dim1\":\"Penis Foreskin Fibroblast Primary Cells skin01\",\"dim2\":\"Repressed PolyComb\"\n\"dim1\":\"Penis Foreskin Fibroblast Primary Cells skin01\",\"dim2\":\"Strong transcription\"\n\"dim1\":\"Penis Foreskin Fibroblast Primary Cells skin01\",\"dim2\":\"Transcr at gene 5 and 3\"\n\"dim1\":\"Penis Foreskin Fibroblast Primary Cells skin01\",\"dim2\":\"Wea epressed PolyComb\"\n\"dim1\":\"Penis Foreskin Fibroblast Primary Cells skin01\",\"dim2\":\"Weak transcription\"\n\"dim1\":\"Penis Foreskin Fibroblast Primary Cells skin01\",\"dim2\":\"ZNF genes and repeats\"\n\"dim1\":\"Penis Foreskin Fibroblast Primary Cells skin02\",\"dim2\":\"Active TSS\"\n\"dim1\":\"Penis Foreskin Fibroblast Primary Cells skin02\",\"dim2\":\"Bivalent Enhancer\"\n\"dim1\":\"Penis Foreskin Fibroblast Primary Cells skin02\",\"dim2\":\"Bivalent Poised TSS\"\n\"dim1\":\"Penis Foreskin Fibroblast Primary Cells skin02\",\"dim2\":\"Enhancers\"\n\"dim1\":\"Penis Foreskin Fibroblast Primary Cells skin02\",\"dim2\":\"Flanking Active TSS\"\n\"dim1\":\"Penis Foreskin Fibroblast Primary Cells skin02\",\"dim2\":\"Flanking Bivalent TSS Enh\"\n\"dim1\":\"Penis Foreskin Fibroblast Primary Cells skin02\",\"dim2\":\"Genic enhancers\"\n\"dim1\":\"Penis Foreskin Fibroblast Primary Cells skin02\",\"dim2\":\"Heterochromatin\"\n\"dim1\":\"Penis Foreskin Fibroblast Primary Cells skin02\",\"dim2\":\"Quiescent Low\"\n\"dim1\":\"Penis Foreskin Fibroblast Primary Cells skin02\",\"dim2\":\"Repressed PolyComb\"\n\"dim1\":\"Penis Foreskin Fibroblast Primary Cells skin02\",\"dim2\":\"Strong transcription\"\n\"dim1\":\"Penis Foreskin Fibroblast Primary Cells skin02\",\"dim2\":\"Transcr at gene 5 and 3\"\n\"dim1\":\"Penis Foreskin Fibroblast Primary Cells skin02\",\"dim2\":\"Wea epressed PolyComb\"\n\"dim1\":\"Penis Foreskin Fibroblast Primary Cells skin02\",\"dim2\":\"Weak transcription\"\n\"dim1\":\"Penis Foreskin Fibroblast Primary Cells skin02\",\"dim2\":\"ZNF genes and repeats\"\n\"dim1\":\"Penis Foreskin Keratinocyte Primary Cells skin02\",\"dim2\":\"Active TSS\"\n\"dim1\":\"Penis Foreskin Keratinocyte Primary Cells skin02\",\"dim2\":\"Bivalent Enhancer\"\n\"dim1\":\"Penis Foreskin Keratinocyte Primary Cells skin02\",\"dim2\":\"Bivalent Poised TSS\"\n\"dim1\":\"Penis Foreskin Keratinocyte Primary Cells skin02\",\"dim2\":\"Enhancers\"\n\"dim1\":\"Penis Foreskin Keratinocyte Primary Cells skin02\",\"dim2\":\"Flanking Active TSS\"\n\"dim1\":\"Penis Foreskin Keratinocyte Primary Cells skin02\",\"dim2\":\"Flanking Bivalent TSS Enh\"\n\"dim1\":\"Penis Foreskin Keratinocyte Primary Cells skin02\",\"dim2\":\"Genic enhancers\"\n\"dim1\":\"Penis Foreskin Keratinocyte Primary Cells skin02\",\"dim2\":\"Heterochromatin\"\n\"dim1\":\"Penis Foreskin Keratinocyte Primary Cells skin02\",\"dim2\":\"Quiescent Low\"\n\"dim1\":\"Penis Foreskin Keratinocyte Primary Cells skin02\",\"dim2\":\"Repressed PolyComb\"\n\"dim1\":\"Penis Foreskin Keratinocyte Primary Cells skin02\",\"dim2\":\"Strong transcription\"\n\"dim1\":\"Penis Foreskin Keratinocyte Primary Cells skin02\",\"dim2\":\"Transcr at gene 5 and 3\"\n\"dim1\":\"Penis Foreskin Keratinocyte Primary Cells skin02\",\"dim2\":\"Wea epressed PolyComb\"\n\"dim1\":\"Penis Foreskin Keratinocyte Primary Cells skin02\",\"dim2\":\"Weak transcription\"\n\"dim1\":\"Penis Foreskin Keratinocyte Primary Cells skin02\",\"dim2\":\"ZNF genes and repeats\"\n\"dim1\":\"Penis Foreskin Keratinocyte Primary Cells skin03\",\"dim2\":\"Active TSS\"\n\"dim1\":\"Penis Foreskin Keratinocyte Primary Cells skin03\",\"dim2\":\"Bivalent Enhancer\"\n\"dim1\":\"Penis Foreskin Keratinocyte Primary Cells skin03\",\"dim2\":\"Bivalent Poised TSS\"\n\"dim1\":\"Penis Foreskin Keratinocyte Primary Cells skin03\",\"dim2\":\"Enhancers\"\n\"dim1\":\"Penis Foreskin Keratinocyte Primary Cells skin03\",\"dim2\":\"Flanking Active TSS\"\n\"dim1\":\"Penis Foreskin Keratinocyte Primary Cells skin03\",\"dim2\":\"Flanking Bivalent TSS Enh\"\n\"dim1\":\"Penis Foreskin Keratinocyte Primary Cells skin03\",\"dim2\":\"Genic enhancers\"\n\"dim1\":\"Penis Foreskin Keratinocyte Primary Cells skin03\",\"dim2\":\"Heterochromatin\"\n\"dim1\":\"Penis Foreskin Keratinocyte Primary Cells skin03\",\"dim2\":\"Quiescent Low\"\n\"dim1\":\"Penis Foreskin Keratinocyte Primary Cells skin03\",\"dim2\":\"Repressed PolyComb\"\n\"dim1\":\"Penis Foreskin Keratinocyte Primary Cells skin03\",\"dim2\":\"Strong transcription\"\n\"dim1\":\"Penis Foreskin Keratinocyte Primary Cells skin03\",\"dim2\":\"Transcr at gene 5 and 3\"\n\"dim1\":\"Penis Foreskin Keratinocyte Primary Cells skin03\",\"dim2\":\"Wea epressed PolyComb\"\n\"dim1\":\"Penis Foreskin Keratinocyte Primary Cells skin03\",\"dim2\":\"Weak transcription\"\n\"dim1\":\"Penis Foreskin Keratinocyte Primary Cells skin03\",\"dim2\":\"ZNF genes and repeats\"\n\"dim1\":\"Penis Foreskin Melanocyte Primary Cells skin01\",\"dim2\":\"Active TSS\"\n\"dim1\":\"Penis Foreskin Melanocyte Primary Cells skin01\",\"dim2\":\"Bivalent Enhancer\"\n\"dim1\":\"Penis Foreskin Melanocyte Primary Cells skin01\",\"dim2\":\"Bivalent Poised TSS\"\n\"dim1\":\"Penis Foreskin Melanocyte Primary Cells skin01\",\"dim2\":\"Enhancers\"\n\"dim1\":\"Penis Foreskin Melanocyte Primary Cells skin01\",\"dim2\":\"Flanking Active TSS\"\n\"dim1\":\"Penis Foreskin Melanocyte Primary Cells skin01\",\"dim2\":\"Flanking Bivalent TSS Enh\"\n\"dim1\":\"Penis Foreskin Melanocyte Primary Cells skin01\",\"dim2\":\"Genic enhancers\"\n\"dim1\":\"Penis Foreskin Melanocyte Primary Cells skin01\",\"dim2\":\"Heterochromatin\"\n\"dim1\":\"Penis Foreskin Melanocyte Primary Cells skin01\",\"dim2\":\"Quiescent Low\"\n\"dim1\":\"Penis Foreskin Melanocyte Primary Cells skin01\",\"dim2\":\"Repressed PolyComb\"\n\"dim1\":\"Penis Foreskin Melanocyte Primary Cells skin01\",\"dim2\":\"Strong transcription\"\n\"dim1\":\"Penis Foreskin Melanocyte Primary Cells skin01\",\"dim2\":\"Transcr at gene 5 and 3\"\n\"dim1\":\"Penis Foreskin Melanocyte Primary Cells skin01\",\"dim2\":\"Wea epressed PolyComb\"\n\"dim1\":\"Penis Foreskin Melanocyte Primary Cells skin01\",\"dim2\":\"Weak transcription\"\n\"dim1\":\"Penis Foreskin Melanocyte Primary Cells skin01\",\"dim2\":\"ZNF genes and repeats\"\n\"dim1\":\"Penis Foreskin Melanocyte Primary Cells skin03\",\"dim2\":\"Active TSS\"\n\"dim1\":\"Penis Foreskin Melanocyte Primary Cells skin03\",\"dim2\":\"Bivalent Enhancer\"\n\"dim1\":\"Penis Foreskin Melanocyte Primary Cells skin03\",\"dim2\":\"Bivalent Poised TSS\"\n\"dim1\":\"Penis Foreskin Melanocyte Primary Cells skin03\",\"dim2\":\"Enhancers\"\n\"dim1\":\"Penis Foreskin Melanocyte Primary Cells skin03\",\"dim2\":\"Flanking Active TSS\"\n\"dim1\":\"Penis Foreskin Melanocyte Primary Cells skin03\",\"dim2\":\"Flanking Bivalent TSS Enh\"\n\"dim1\":\"Penis Foreskin Melanocyte Primary Cells skin03\",\"dim2\":\"Genic enhancers\"\n\"dim1\":\"Penis Foreskin Melanocyte Primary Cells skin03\",\"dim2\":\"Heterochromatin\"\n\"dim1\":\"Penis Foreskin Melanocyte Primary Cells skin03\",\"dim2\":\"Quiescent Low\"\n\"dim1\":\"Penis Foreskin Melanocyte Primary Cells skin03\",\"dim2\":\"Repressed PolyComb\"\n\"dim1\":\"Penis Foreskin Melanocyte Primary Cells skin03\",\"dim2\":\"Strong transcription\"\n\"dim1\":\"Penis Foreskin Melanocyte Primary Cells skin03\",\"dim2\":\"Transcr at gene 5 and 3\"\n\"dim1\":\"Penis Foreskin Melanocyte Primary Cells skin03\",\"dim2\":\"Wea epressed PolyComb\"\n\"dim1\":\"Penis Foreskin Melanocyte Primary Cells skin03\",\"dim2\":\"Weak transcription\"\n\"dim1\":\"Penis Foreskin Melanocyte Primary Cells skin03\",\"dim2\":\"ZNF genes and repeats\"\n\"dim1\":\"Peripheral Blood Mononuclear Primary Cells\",\"dim2\":\"Active TSS\"\n\"dim1\":\"Peripheral Blood Mononuclear Primary Cells\",\"dim2\":\"Bivalent Enhancer\"\n\"dim1\":\"Peripheral Blood Mononuclear Primary Cells\",\"dim2\":\"Bivalent Poised TSS\"\n\"dim1\":\"Peripheral Blood Mononuclear Primary Cells\",\"dim2\":\"Enhancers\"\n\"dim1\":\"Peripheral Blood Mononuclear Primary Cells\",\"dim2\":\"Flanking Active TSS\"\n\"dim1\":\"Peripheral Blood Mononuclear Primary Cells\",\"dim2\":\"Flanking Bivalent TSS Enh\"\n\"dim1\":\"Peripheral Blood Mononuclear Primary Cells\",\"dim2\":\"Genic enhancers\"\n\"dim1\":\"Peripheral Blood Mononuclear Primary Cells\",\"dim2\":\"Heterochromatin\"\n\"dim1\":\"Peripheral Blood Mononuclear Primary Cells\",\"dim2\":\"Quiescent Low\"\n\"dim1\":\"Peripheral Blood Mononuclear Primary Cells\",\"dim2\":\"Repressed PolyComb\"\n\"dim1\":\"Peripheral Blood Mononuclear Primary Cells\",\"dim2\":\"Strong transcription\"\n\"dim1\":\"Peripheral Blood Mononuclear Primary Cells\",\"dim2\":\"Transcr at gene 5 and 3\"\n\"dim1\":\"Peripheral Blood Mononuclear Primary Cells\",\"dim2\":\"Wea epressed PolyComb\"\n\"dim1\":\"Peripheral Blood Mononuclear Primary Cells\",\"dim2\":\"Weak transcription\"\n\"dim1\":\"Peripheral Blood Mononuclear Primary Cells\",\"dim2\":\"ZNF genes and repeats\"\n\"dim1\":\"Placenta Amnion\",\"dim2\":\"Active TSS\"\n\"dim1\":\"Placenta Amnion\",\"dim2\":\"Bivalent Enhancer\"\n\"dim1\":\"Placenta Amnion\",\"dim2\":\"Bivalent Poised TSS\"\n\"dim1\":\"Placenta Amnion\",\"dim2\":\"Enhancers\"\n\"dim1\":\"Placenta Amnion\",\"dim2\":\"Flanking Active TSS\"\n\"dim1\":\"Placenta Amnion\",\"dim2\":\"Flanking Bivalent TSS Enh\"\n\"dim1\":\"Placenta Amnion\",\"dim2\":\"Genic enhancers\"\n\"dim1\":\"Placenta Amnion\",\"dim2\":\"Heterochromatin\"\n\"dim1\":\"Placenta Amnion\",\"dim2\":\"Quiescent Low\"\n\"dim1\":\"Placenta Amnion\",\"dim2\":\"Repressed PolyComb\"\n\"dim1\":\"Placenta Amnion\",\"dim2\":\"Strong transcription\"\n\"dim1\":\"Placenta Amnion\",\"dim2\":\"Transcr at gene 5 and 3\"\n\"dim1\":\"Placenta Amnion\",\"dim2\":\"Wea epressed PolyComb\"\n\"dim1\":\"Placenta Amnion\",\"dim2\":\"Weak transcription\"\n\"dim1\":\"Placenta Amnion\",\"dim2\":\"ZNF genes and repeats\"\n\"dim1\":\"Psoas Muscle\",\"dim2\":\"Active TSS\"\n\"dim1\":\"Psoas Muscle\",\"dim2\":\"Bivalent Enhancer\"\n\"dim1\":\"Psoas Muscle\",\"dim2\":\"Bivalent Poised TSS\"\n\"dim1\":\"Psoas Muscle\",\"dim2\":\"Enhancers\"\n\"dim1\":\"Psoas Muscle\",\"dim2\":\"Flanking Active TSS\"\n\"dim1\":\"Psoas Muscle\",\"dim2\":\"Flanking Bivalent TSS Enh\"\n\"dim1\":\"Psoas Muscle\",\"dim2\":\"Genic enhancers\"\n\"dim1\":\"Psoas Muscle\",\"dim2\":\"Heterochromatin\"\n\"dim1\":\"Psoas Muscle\",\"dim2\":\"Quiescent Low\"\n\"dim1\":\"Psoas Muscle\",\"dim2\":\"Repressed PolyComb\"\n\"dim1\":\"Psoas Muscle\",\"dim2\":\"Strong transcription\"\n\"dim1\":\"Psoas Muscle\",\"dim2\":\"Transcr at gene 5 and 3\"\n\"dim1\":\"Psoas Muscle\",\"dim2\":\"Wea epressed PolyComb\"\n\"dim1\":\"Psoas Muscle\",\"dim2\":\"Weak transcription\"\n\"dim1\":\"Psoas Muscle\",\"dim2\":\"ZNF genes and repeats\"\n\"dim1\":\"Rectal Mucosa.Donor 29\",\"dim2\":\"Active TSS\"\n\"dim1\":\"Rectal Mucosa.Donor 29\",\"dim2\":\"Bivalent Enhancer\"\n\"dim1\":\"Rectal Mucosa.Donor 29\",\"dim2\":\"Bivalent Poised TSS\"\n\"dim1\":\"Rectal Mucosa.Donor 29\",\"dim2\":\"Enhancers\"\n\"dim1\":\"Rectal Mucosa.Donor 29\",\"dim2\":\"Flanking Active TSS\"\n\"dim1\":\"Rectal Mucosa.Donor 29\",\"dim2\":\"Flanking Bivalent TSS Enh\"\n\"dim1\":\"Rectal Mucosa.Donor 29\",\"dim2\":\"Genic enhancers\"\n\"dim1\":\"Rectal Mucosa.Donor 29\",\"dim2\":\"Heterochromatin\"\n\"dim1\":\"Rectal Mucosa.Donor 29\",\"dim2\":\"Quiescent Low\"\n\"dim1\":\"Rectal Mucosa.Donor 29\",\"dim2\":\"Repressed PolyComb\"\n\"dim1\":\"Rectal Mucosa.Donor 29\",\"dim2\":\"Strong transcription\"\n\"dim1\":\"Rectal Mucosa.Donor 29\",\"dim2\":\"Transcr at gene 5 and 3\"\n\"dim1\":\"Rectal Mucosa.Donor 29\",\"dim2\":\"Wea epressed PolyComb\"\n\"dim1\":\"Rectal Mucosa.Donor 29\",\"dim2\":\"Weak transcription\"\n\"dim1\":\"Rectal Mucosa.Donor 29\",\"dim2\":\"ZNF genes and repeats\"\n\"dim1\":\"Rectal Mucosa.Donor 31\",\"dim2\":\"Active TSS\"\n\"dim1\":\"Rectal Mucosa.Donor 31\",\"dim2\":\"Bivalent Enhancer\"\n\"dim1\":\"Rectal Mucosa.Donor 31\",\"dim2\":\"Bivalent Poised TSS\"\n\"dim1\":\"Rectal Mucosa.Donor 31\",\"dim2\":\"Enhancers\"\n\"dim1\":\"Rectal Mucosa.Donor 31\",\"dim2\":\"Flanking Active TSS\"\n\"dim1\":\"Rectal Mucosa.Donor 31\",\"dim2\":\"Flanking Bivalent TSS Enh\"\n\"dim1\":\"Rectal Mucosa.Donor 31\",\"dim2\":\"Genic enhancers\"\n\"dim1\":\"Rectal Mucosa.Donor 31\",\"dim2\":\"Heterochromatin\"\n\"dim1\":\"Rectal Mucosa.Donor 31\",\"dim2\":\"Quiescent Low\"\n\"dim1\":\"Rectal Mucosa.Donor 31\",\"dim2\":\"Repressed PolyComb\"\n\"dim1\":\"Rectal Mucosa.Donor 31\",\"dim2\":\"Strong transcription\"\n\"dim1\":\"Rectal Mucosa.Donor 31\",\"dim2\":\"Transcr at gene 5 and 3\"\n\"dim1\":\"Rectal Mucosa.Donor 31\",\"dim2\":\"Wea epressed PolyComb\"\n\"dim1\":\"Rectal Mucosa.Donor 31\",\"dim2\":\"Weak transcription\"\n\"dim1\":\"Rectal Mucosa.Donor 31\",\"dim2\":\"ZNF genes and repeats\"\n\"dim1\":\"Rectal Smooth Muscle\",\"dim2\":\"Active TSS\"\n\"dim1\":\"Rectal Smooth Muscle\",\"dim2\":\"Bivalent Enhancer\"\n\"dim1\":\"Rectal Smooth Muscle\",\"dim2\":\"Bivalent Poised TSS\"\n\"dim1\":\"Rectal Smooth Muscle\",\"dim2\":\"Enhancers\"\n\"dim1\":\"Rectal Smooth Muscle\",\"dim2\":\"Flanking Active TSS\"\n\"dim1\":\"Rectal Smooth Muscle\",\"dim2\":\"Flanking Bivalent TSS Enh\"\n\"dim1\":\"Rectal Smooth Muscle\",\"dim2\":\"Genic enhancers\"\n\"dim1\":\"Rectal Smooth Muscle\",\"dim2\":\"Heterochromatin\"\n\"dim1\":\"Rectal Smooth Muscle\",\"dim2\":\"Quiescent Low\"\n\"dim1\":\"Rectal Smooth Muscle\",\"dim2\":\"Repressed PolyComb\"\n\"dim1\":\"Rectal Smooth Muscle\",\"dim2\":\"Strong transcription\"\n\"dim1\":\"Rectal Smooth Muscle\",\"dim2\":\"Transcr at gene 5 and 3\"\n\"dim1\":\"Rectal Smooth Muscle\",\"dim2\":\"Wea epressed PolyComb\"\n\"dim1\":\"Rectal Smooth Muscle\",\"dim2\":\"Weak transcription\"\n\"dim1\":\"Rectal Smooth Muscle\",\"dim2\":\"ZNF genes and repeats\"\n\"dim1\":\"Right Atrium\",\"dim2\":\"Active TSS\"\n\"dim1\":\"Right Atrium\",\"dim2\":\"Bivalent Enhancer\"\n\"dim1\":\"Right Atrium\",\"dim2\":\"Bivalent Poised TSS\"\n\"dim1\":\"Right Atrium\",\"dim2\":\"Enhancers\"\n\"dim1\":\"Right Atrium\",\"dim2\":\"Flanking Active TSS\"\n\"dim1\":\"Right Atrium\",\"dim2\":\"Flanking Bivalent TSS Enh\"\n\"dim1\":\"Right Atrium\",\"dim2\":\"Genic enhancers\"\n\"dim1\":\"Right Atrium\",\"dim2\":\"Heterochromatin\"\n\"dim1\":\"Right Atrium\",\"dim2\":\"Quiescent Low\"\n\"dim1\":\"Right Atrium\",\"dim2\":\"Repressed PolyComb\"\n\"dim1\":\"Right Atrium\",\"dim2\":\"Strong transcription\"\n\"dim1\":\"Right Atrium\",\"dim2\":\"Transcr at gene 5 and 3\"\n\"dim1\":\"Right Atrium\",\"dim2\":\"Wea epressed PolyComb\"\n\"dim1\":\"Right Atrium\",\"dim2\":\"Weak transcription\"\n\"dim1\":\"Right Atrium\",\"dim2\":\"ZNF genes and repeats\"\n\"dim1\":\"Right Ventricle\",\"dim2\":\"Active TSS\"\n\"dim1\":\"Right Ventricle\",\"dim2\":\"Bivalent Enhancer\"\n\"dim1\":\"Right Ventricle\",\"dim2\":\"Bivalent Poised TSS\"\n\"dim1\":\"Right Ventricle\",\"dim2\":\"Enhancers\"\n\"dim1\":\"Right Ventricle\",\"dim2\":\"Flanking Active TSS\"\n\"dim1\":\"Right Ventricle\",\"dim2\":\"Flanking Bivalent TSS Enh\"\n\"dim1\":\"Right Ventricle\",\"dim2\":\"Genic enhancers\"\n\"dim1\":\"Right Ventricle\",\"dim2\":\"Heterochromatin\"\n\"dim1\":\"Right Ventricle\",\"dim2\":\"Quiescent Low\"\n\"dim1\":\"Right Ventricle\",\"dim2\":\"Repressed PolyComb\"\n\"dim1\":\"Right Ventricle\",\"dim2\":\"Strong transcription\"\n\"dim1\":\"Right Ventricle\",\"dim2\":\"Transcr at gene 5 and 3\"\n\"dim1\":\"Right Ventricle\",\"dim2\":\"Wea epressed PolyComb\"\n\"dim1\":\"Right Ventricle\",\"dim2\":\"Weak transcription\"\n\"dim1\":\"Right Ventricle\",\"dim2\":\"ZNF genes and repeats\"\n\"dim1\":\"Sigmoid Colon\",\"dim2\":\"Active TSS\"\n\"dim1\":\"Sigmoid Colon\",\"dim2\":\"Bivalent Enhancer\"\n\"dim1\":\"Sigmoid Colon\",\"dim2\":\"Bivalent Poised TSS\"\n\"dim1\":\"Sigmoid Colon\",\"dim2\":\"Enhancers\"\n\"dim1\":\"Sigmoid Colon\",\"dim2\":\"Flanking Active TSS\"\n\"dim1\":\"Sigmoid Colon\",\"dim2\":\"Flanking Bivalent TSS Enh\"\n\"dim1\":\"Sigmoid Colon\",\"dim2\":\"Genic enhancers\"\n\"dim1\":\"Sigmoid Colon\",\"dim2\":\"Heterochromatin\"\n\"dim1\":\"Sigmoid Colon\",\"dim2\":\"Quiescent Low\"\n\"dim1\":\"Sigmoid Colon\",\"dim2\":\"Repressed PolyComb\"\n\"dim1\":\"Sigmoid Colon\",\"dim2\":\"Strong transcription\"\n\"dim1\":\"Sigmoid Colon\",\"dim2\":\"Transcr at gene 5 and 3\"\n\"dim1\":\"Sigmoid Colon\",\"dim2\":\"Wea epressed PolyComb\"\n\"dim1\":\"Sigmoid Colon\",\"dim2\":\"Weak transcription\"\n\"dim1\":\"Sigmoid Colon\",\"dim2\":\"ZNF genes and repeats\"\n\"dim1\":\"Skeletal Muscle Female\",\"dim2\":\"Active TSS\"\n\"dim1\":\"Skeletal Muscle Female\",\"dim2\":\"Bivalent Enhancer\"\n\"dim1\":\"Skeletal Muscle Female\",\"dim2\":\"Bivalent Poised TSS\"\n\"dim1\":\"Skeletal Muscle Female\",\"dim2\":\"Enhancers\"\n\"dim1\":\"Skeletal Muscle Female\",\"dim2\":\"Flanking Active TSS\"\n\"dim1\":\"Skeletal Muscle Female\",\"dim2\":\"Flanking Bivalent TSS Enh\"\n\"dim1\":\"Skeletal Muscle Female\",\"dim2\":\"Genic enhancers\"\n\"dim1\":\"Skeletal Muscle Female\",\"dim2\":\"Heterochromatin\"\n\"dim1\":\"Skeletal Muscle Female\",\"dim2\":\"Quiescent Low\"\n\"dim1\":\"Skeletal Muscle Female\",\"dim2\":\"Repressed PolyComb\"\n\"dim1\":\"Skeletal Muscle Female\",\"dim2\":\"Strong transcription\"\n\"dim1\":\"Skeletal Muscle Female\",\"dim2\":\"Transcr at gene 5 and 3\"\n\"dim1\":\"Skeletal Muscle Female\",\"dim2\":\"Wea epressed PolyComb\"\n\"dim1\":\"Skeletal Muscle Female\",\"dim2\":\"Weak transcription\"\n\"dim1\":\"Skeletal Muscle Female\",\"dim2\":\"ZNF genes and repeats\"\n\"dim1\":\"Skeletal Muscle Male\",\"dim2\":\"Active TSS\"\n\"dim1\":\"Skeletal Muscle Male\",\"dim2\":\"Bivalent Enhancer\"\n\"dim1\":\"Skeletal Muscle Male\",\"dim2\":\"Bivalent Poised TSS\"\n\"dim1\":\"Skeletal Muscle Male\",\"dim2\":\"Enhancers\"\n\"dim1\":\"Skeletal Muscle Male\",\"dim2\":\"Flanking Active TSS\"\n\"dim1\":\"Skeletal Muscle Male\",\"dim2\":\"Flanking Bivalent TSS Enh\"\n\"dim1\":\"Skeletal Muscle Male\",\"dim2\":\"Genic enhancers\"\n\"dim1\":\"Skeletal Muscle Male\",\"dim2\":\"Heterochromatin\"\n\"dim1\":\"Skeletal Muscle Male\",\"dim2\":\"Quiescent Low\"\n\"dim1\":\"Skeletal Muscle Male\",\"dim2\":\"Repressed PolyComb\"\n\"dim1\":\"Skeletal Muscle Male\",\"dim2\":\"Strong transcription\"\n\"dim1\":\"Skeletal Muscle Male\",\"dim2\":\"Transcr at gene 5 and 3\"\n\"dim1\":\"Skeletal Muscle Male\",\"dim2\":\"Wea epressed PolyComb\"\n\"dim1\":\"Skeletal Muscle Male\",\"dim2\":\"Weak transcription\"\n\"dim1\":\"Skeletal Muscle Male\",\"dim2\":\"ZNF genes and repeats\"\n\"dim1\":\"Small Intestine\",\"dim2\":\"Active TSS\"\n\"dim1\":\"Small Intestine\",\"dim2\":\"Bivalent Enhancer\"\n\"dim1\":\"Small Intestine\",\"dim2\":\"Bivalent Poised TSS\"\n\"dim1\":\"Small Intestine\",\"dim2\":\"Enhancers\"\n\"dim1\":\"Small Intestine\",\"dim2\":\"Flanking Active TSS\"\n\"dim1\":\"Small Intestine\",\"dim2\":\"Flanking Bivalent TSS Enh\"\n\"dim1\":\"Small Intestine\",\"dim2\":\"Genic enhancers\"\n\"dim1\":\"Small Intestine\",\"dim2\":\"Heterochromatin\"\n\"dim1\":\"Small Intestine\",\"dim2\":\"Quiescent Low\"\n\"dim1\":\"Small Intestine\",\"dim2\":\"Repressed PolyComb\"\n\"dim1\":\"Small Intestine\",\"dim2\":\"Strong transcription\"\n\"dim1\":\"Small Intestine\",\"dim2\":\"Transcr at gene 5 and 3\"\n\"dim1\":\"Small Intestine\",\"dim2\":\"Wea epressed PolyComb\"\n\"dim1\":\"Small Intestine\",\"dim2\":\"Weak transcription\"\n\"dim1\":\"Small Intestine\",\"dim2\":\"ZNF genes and repeats\"\n\"dim1\":\"Spleen\",\"dim2\":\"Active TSS\"\n\"dim1\":\"Spleen\",\"dim2\":\"Bivalent Enhancer\"\n\"dim1\":\"Spleen\",\"dim2\":\"Bivalent Poised TSS\"\n\"dim1\":\"Spleen\",\"dim2\":\"Enhancers\"\n\"dim1\":\"Spleen\",\"dim2\":\"Flanking Active TSS\"\n\"dim1\":\"Spleen\",\"dim2\":\"Flanking Bivalent TSS Enh\"\n\"dim1\":\"Spleen\",\"dim2\":\"Genic enhancers\"\n\"dim1\":\"Spleen\",\"dim2\":\"Heterochromatin\"\n\"dim1\":\"Spleen\",\"dim2\":\"Quiescent Low\"\n\"dim1\":\"Spleen\",\"dim2\":\"Repressed PolyComb\"\n\"dim1\":\"Spleen\",\"dim2\":\"Strong transcription\"\n\"dim1\":\"Spleen\",\"dim2\":\"Transcr at gene 5 and 3\"\n\"dim1\":\"Spleen\",\"dim2\":\"Wea epressed PolyComb\"\n\"dim1\":\"Spleen\",\"dim2\":\"Weak transcription\"\n\"dim1\":\"Spleen\",\"dim2\":\"ZNF genes and repeats\"\n\"dim1\":\"Stomach Mucosa\",\"dim2\":\"Active TSS\"\n\"dim1\":\"Stomach Mucosa\",\"dim2\":\"Bivalent Enhancer\"\n\"dim1\":\"Stomach Mucosa\",\"dim2\":\"Bivalent Poised TSS\"\n\"dim1\":\"Stomach Mucosa\",\"dim2\":\"Enhancers\"\n\"dim1\":\"Stomach Mucosa\",\"dim2\":\"Flanking Active TSS\"\n\"dim1\":\"Stomach Mucosa\",\"dim2\":\"Flanking Bivalent TSS Enh\"\n\"dim1\":\"Stomach Mucosa\",\"dim2\":\"Genic enhancers\"\n\"dim1\":\"Stomach Mucosa\",\"dim2\":\"Heterochromatin\"\n\"dim1\":\"Stomach Mucosa\",\"dim2\":\"Quiescent Low\"\n\"dim1\":\"Stomach Mucosa\",\"dim2\":\"Repressed PolyComb\"\n\"dim1\":\"Stomach Mucosa\",\"dim2\":\"Strong transcription\"\n\"dim1\":\"Stomach Mucosa\",\"dim2\":\"Transcr at gene 5 and 3\"\n\"dim1\":\"Stomach Mucosa\",\"dim2\":\"Wea epressed PolyComb\"\n\"dim1\":\"Stomach Mucosa\",\"dim2\":\"Weak transcription\"\n\"dim1\":\"Stomach Mucosa\",\"dim2\":\"ZNF genes and repeats\"\n\"dim1\":\"Stomach Smooth Muscle\",\"dim2\":\"Active TSS\"\n\"dim1\":\"Stomach Smooth Muscle\",\"dim2\":\"Bivalent Enhancer\"\n\"dim1\":\"Stomach Smooth Muscle\",\"dim2\":\"Bivalent Poised TSS\"\n\"dim1\":\"Stomach Smooth Muscle\",\"dim2\":\"Enhancers\"\n\"dim1\":\"Stomach Smooth Muscle\",\"dim2\":\"Flanking Active TSS\"\n\"dim1\":\"Stomach Smooth Muscle\",\"dim2\":\"Flanking Bivalent TSS Enh\"\n\"dim1\":\"Stomach Smooth Muscle\",\"dim2\":\"Genic enhancers\"\n\"dim1\":\"Stomach Smooth Muscle\",\"dim2\":\"Heterochromatin\"\n\"dim1\":\"Stomach Smooth Muscle\",\"dim2\":\"Quiescent Low\"\n\"dim1\":\"Stomach Smooth Muscle\",\"dim2\":\"Repressed PolyComb\"\n\"dim1\":\"Stomach Smooth Muscle\",\"dim2\":\"Strong transcription\"\n\"dim1\":\"Stomach Smooth Muscle\",\"dim2\":\"Transcr at gene 5 and 3\"\n\"dim1\":\"Stomach Smooth Muscle\",\"dim2\":\"Wea epressed PolyComb\"\n\"dim1\":\"Stomach Smooth Muscle\",\"dim2\":\"Weak transcription\"\n\"dim1\":\"Stomach Smooth Muscle\",\"dim2\":\"ZNF genes and repeats\"\n\"dim1\":\"Thymus\",\"dim2\":\"Active TSS\"\n\"dim1\":\"Thymus\",\"dim2\":\"Bivalent Enhancer\"\n\"dim1\":\"Thymus\",\"dim2\":\"Bivalent Poised TSS\"\n\"dim1\":\"Thymus\",\"dim2\":\"Enhancers\"\n\"dim1\":\"Thymus\",\"dim2\":\"Flanking Active TSS\"\n\"dim1\":\"Thymus\",\"dim2\":\"Flanking Bivalent TSS Enh\"\n\"dim1\":\"Thymus\",\"dim2\":\"Genic enhancers\"\n\"dim1\":\"Thymus\",\"dim2\":\"Heterochromatin\"\n\"dim1\":\"Thymus\",\"dim2\":\"Quiescent Low\"\n\"dim1\":\"Thymus\",\"dim2\":\"Repressed PolyComb\"\n\"dim1\":\"Thymus\",\"dim2\":\"Strong transcription\"\n\"dim1\":\"Thymus\",\"dim2\":\"Transcr at gene 5 and 3\"\n\"dim1\":\"Thymus\",\"dim2\":\"Wea epressed PolyComb\"\n\"dim1\":\"Thymus\",\"dim2\":\"Weak transcription\"\n\"dim1\":\"Thymus\",\"dim2\":\"ZNF genes and repeats\"\n\"dim1\":\"hESC Derived CD184pp Endoderm Cultured Cells\",\"dim2\":\"Active TSS\"\n\"dim1\":\"hESC Derived CD184pp Endoderm Cultured Cells\",\"dim2\":\"Bivalent Enhancer\"\n\"dim1\":\"hESC Derived CD184pp Endoderm Cultured Cells\",\"dim2\":\"Bivalent Poised TSS\"\n\"dim1\":\"hESC Derived CD184pp Endoderm Cultured Cells\",\"dim2\":\"Enhancers\"\n\"dim1\":\"hESC Derived CD184pp Endoderm Cultured Cells\",\"dim2\":\"Flanking Active TSS\"\n\"dim1\":\"hESC Derived CD184pp Endoderm Cultured Cells\",\"dim2\":\"Flanking Bivalent TSS Enh\"\n\"dim1\":\"hESC Derived CD184pp Endoderm Cultured Cells\",\"dim2\":\"Genic enhancers\"\n\"dim1\":\"hESC Derived CD184pp Endoderm Cultured Cells\",\"dim2\":\"Heterochromatin\"\n\"dim1\":\"hESC Derived CD184pp Endoderm Cultured Cells\",\"dim2\":\"Quiescent Low\"\n\"dim1\":\"hESC Derived CD184pp Endoderm Cultured Cells\",\"dim2\":\"Repressed PolyComb\"\n\"dim1\":\"hESC Derived CD184pp Endoderm Cultured Cells\",\"dim2\":\"Strong transcription\"\n\"dim1\":\"hESC Derived CD184pp Endoderm Cultured Cells\",\"dim2\":\"Transcr at gene 5 and 3\"\n\"dim1\":\"hESC Derived CD184pp Endoderm Cultured Cells\",\"dim2\":\"Wea epressed PolyComb\"\n\"dim1\":\"hESC Derived CD184pp Endoderm Cultured Cells\",\"dim2\":\"Weak transcription\"\n\"dim1\":\"hESC Derived CD184pp Endoderm Cultured Cells\",\"dim2\":\"ZNF genes and repeats\"\n\"dim1\":\"hESC Derived CD56pp Ectoderm Cultured Cells\",\"dim2\":\"Active TSS\"\n\"dim1\":\"hESC Derived CD56pp Ectoderm Cultured Cells\",\"dim2\":\"Bivalent Enhancer\"\n\"dim1\":\"hESC Derived CD56pp Ectoderm Cultured Cells\",\"dim2\":\"Bivalent Poised TSS\"\n\"dim1\":\"hESC Derived CD56pp Ectoderm Cultured Cells\",\"dim2\":\"Enhancers\"\n\"dim1\":\"hESC Derived CD56pp Ectoderm Cultured Cells\",\"dim2\":\"Flanking Active TSS\"\n\"dim1\":\"hESC Derived CD56pp Ectoderm Cultured Cells\",\"dim2\":\"Flanking Bivalent TSS Enh\"\n\"dim1\":\"hESC Derived CD56pp Ectoderm Cultured Cells\",\"dim2\":\"Genic enhancers\"\n\"dim1\":\"hESC Derived CD56pp Ectoderm Cultured Cells\",\"dim2\":\"Heterochromatin\"\n\"dim1\":\"hESC Derived CD56pp Ectoderm Cultured Cells\",\"dim2\":\"Quiescent Low\"\n\"dim1\":\"hESC Derived CD56pp Ectoderm Cultured Cells\",\"dim2\":\"Repressed PolyComb\"\n\"dim1\":\"hESC Derived CD56pp Ectoderm Cultured Cells\",\"dim2\":\"Strong transcription\"\n\"dim1\":\"hESC Derived CD56pp Ectoderm Cultured Cells\",\"dim2\":\"Transcr at gene 5 and 3\"\n\"dim1\":\"hESC Derived CD56pp Ectoderm Cultured Cells\",\"dim2\":\"Wea epressed PolyComb\"\n\"dim1\":\"hESC Derived CD56pp Ectoderm Cultured Cells\",\"dim2\":\"Weak transcription\"\n\"dim1\":\"hESC Derived CD56pp Ectoderm Cultured Cells\",\"dim2\":\"ZNF genes and repeats\"\n\"dim1\":\"hESC Derived CD56pp Mesoderm Cultured Cells\",\"dim2\":\"Active TSS\"\n\"dim1\":\"hESC Derived CD56pp Mesoderm Cultured Cells\",\"dim2\":\"Bivalent Enhancer\"\n\"dim1\":\"hESC Derived CD56pp Mesoderm Cultured Cells\",\"dim2\":\"Bivalent Poised TSS\"\n\"dim1\":\"hESC Derived CD56pp Mesoderm Cultured Cells\",\"dim2\":\"Enhancers\"\n\"dim1\":\"hESC Derived CD56pp Mesoderm Cultured Cells\",\"dim2\":\"Flanking Active TSS\"\n\"dim1\":\"hESC Derived CD56pp Mesoderm Cultured Cells\",\"dim2\":\"Flanking Bivalent TSS Enh\"\n\"dim1\":\"hESC Derived CD56pp Mesoderm Cultured Cells\",\"dim2\":\"Genic enhancers\"\n\"dim1\":\"hESC Derived CD56pp Mesoderm Cultured Cells\",\"dim2\":\"Heterochromatin\"\n\"dim1\":\"hESC Derived CD56pp Mesoderm Cultured Cells\",\"dim2\":\"Quiescent Low\"\n\"dim1\":\"hESC Derived CD56pp Mesoderm Cultured Cells\",\"dim2\":\"Repressed PolyComb\"\n\"dim1\":\"hESC Derived CD56pp Mesoderm Cultured Cells\",\"dim2\":\"Strong transcription\"\n\"dim1\":\"hESC Derived CD56pp Mesoderm Cultured Cells\",\"dim2\":\"Transcr at gene 5 and 3\"\n\"dim1\":\"hESC Derived CD56pp Mesoderm Cultured Cells\",\"dim2\":\"Wea epressed PolyComb\"\n\"dim1\":\"hESC Derived CD56pp Mesoderm Cultured Cells\",\"dim2\":\"Weak transcription\"\n\"dim1\":\"hESC Derived CD56pp Mesoderm Cultured Cells\",\"dim2\":\"ZNF genes and repeats\"\n\"dim1\":\"iPS 15b Cell Line\",\"dim2\":\"Active TSS\"\n\"dim1\":\"iPS 15b Cell Line\",\"dim2\":\"Bivalent Enhancer\"\n\"dim1\":\"iPS 15b Cell Line\",\"dim2\":\"Bivalent Poised TSS\"\n\"dim1\":\"iPS 15b Cell Line\",\"dim2\":\"Enhancers\"\n\"dim1\":\"iPS 15b Cell Line\",\"dim2\":\"Flanking Active TSS\"\n\"dim1\":\"iPS 15b Cell Line\",\"dim2\":\"Flanking Bivalent TSS Enh\"\n\"dim1\":\"iPS 15b Cell Line\",\"dim2\":\"Genic enhancers\"\n\"dim1\":\"iPS 15b Cell Line\",\"dim2\":\"Heterochromatin\"\n\"dim1\":\"iPS 15b Cell Line\",\"dim2\":\"Quiescent Low\"\n\"dim1\":\"iPS 15b Cell Line\",\"dim2\":\"Repressed PolyComb\"\n\"dim1\":\"iPS 15b Cell Line\",\"dim2\":\"Strong transcription\"\n\"dim1\":\"iPS 15b Cell Line\",\"dim2\":\"Transcr at gene 5 and 3\"\n\"dim1\":\"iPS 15b Cell Line\",\"dim2\":\"Wea epressed PolyComb\"\n\"dim1\":\"iPS 15b Cell Line\",\"dim2\":\"Weak transcription\"\n\"dim1\":\"iPS 15b Cell Line\",\"dim2\":\"ZNF genes and repeats\"\n\"dim1\":\"iPS 18 Cell Line\",\"dim2\":\"Active TSS\"\n\"dim1\":\"iPS 18 Cell Line\",\"dim2\":\"Bivalent Enhancer\"\n\"dim1\":\"iPS 18 Cell Line\",\"dim2\":\"Bivalent Poised TSS\"\n\"dim1\":\"iPS 18 Cell Line\",\"dim2\":\"Enhancers\"\n\"dim1\":\"iPS 18 Cell Line\",\"dim2\":\"Flanking Active TSS\"\n\"dim1\":\"iPS 18 Cell Line\",\"dim2\":\"Flanking Bivalent TSS Enh\"\n\"dim1\":\"iPS 18 Cell Line\",\"dim2\":\"Genic enhancers\"\n\"dim1\":\"iPS 18 Cell Line\",\"dim2\":\"Heterochromatin\"\n\"dim1\":\"iPS 18 Cell Line\",\"dim2\":\"Quiescent Low\"\n\"dim1\":\"iPS 18 Cell Line\",\"dim2\":\"Repressed PolyComb\"\n\"dim1\":\"iPS 18 Cell Line\",\"dim2\":\"Strong transcription\"\n\"dim1\":\"iPS 18 Cell Line\",\"dim2\":\"Transcr at gene 5 and 3\"\n\"dim1\":\"iPS 18 Cell Line\",\"dim2\":\"Wea epressed PolyComb\"\n\"dim1\":\"iPS 18 Cell Line\",\"dim2\":\"Weak transcription\"\n\"dim1\":\"iPS 18 Cell Line\",\"dim2\":\"ZNF genes and repeats\"\n\"dim1\":\"iPS 20b Cell Line\",\"dim2\":\"Active TSS\"\n\"dim1\":\"iPS 20b Cell Line\",\"dim2\":\"Bivalent Enhancer\"\n\"dim1\":\"iPS 20b Cell Line\",\"dim2\":\"Bivalent Poised TSS\"\n\"dim1\":\"iPS 20b Cell Line\",\"dim2\":\"Enhancers\"\n\"dim1\":\"iPS 20b Cell Line\",\"dim2\":\"Flanking Active TSS\"\n\"dim1\":\"iPS 20b Cell Line\",\"dim2\":\"Flanking Bivalent TSS Enh\"\n\"dim1\":\"iPS 20b Cell Line\",\"dim2\":\"Genic enhancers\"\n\"dim1\":\"iPS 20b Cell Line\",\"dim2\":\"Heterochromatin\"\n\"dim1\":\"iPS 20b Cell Line\",\"dim2\":\"Quiescent Low\"\n\"dim1\":\"iPS 20b Cell Line\",\"dim2\":\"Repressed PolyComb\"\n\"dim1\":\"iPS 20b Cell Line\",\"dim2\":\"Strong transcription\"\n\"dim1\":\"iPS 20b Cell Line\",\"dim2\":\"Transcr at gene 5 and 3\"\n\"dim1\":\"iPS 20b Cell Line\",\"dim2\":\"Wea epressed PolyComb\"\n\"dim1\":\"iPS 20b Cell Line\",\"dim2\":\"Weak transcription\"\n\"dim1\":\"iPS 20b Cell Line\",\"dim2\":\"ZNF genes and repeats\"\n\"dim1\":\"iPS DF 19.11 Cell Line\",\"dim2\":\"Active TSS\"\n\"dim1\":\"iPS DF 19.11 Cell Line\",\"dim2\":\"Bivalent Enhancer\"\n\"dim1\":\"iPS DF 19.11 Cell Line\",\"dim2\":\"Bivalent Poised TSS\"\n\"dim1\":\"iPS DF 19.11 Cell Line\",\"dim2\":\"Enhancers\"\n\"dim1\":\"iPS DF 19.11 Cell Line\",\"dim2\":\"Flanking Active TSS\"\n\"dim1\":\"iPS DF 19.11 Cell Line\",\"dim2\":\"Flanking Bivalent TSS Enh\"\n\"dim1\":\"iPS DF 19.11 Cell Line\",\"dim2\":\"Genic enhancers\"\n\"dim1\":\"iPS DF 19.11 Cell Line\",\"dim2\":\"Heterochromatin\"\n\"dim1\":\"iPS DF 19.11 Cell Line\",\"dim2\":\"Quiescent Low\"\n\"dim1\":\"iPS DF 19.11 Cell Line\",\"dim2\":\"Repressed PolyComb\"\n\"dim1\":\"iPS DF 19.11 Cell Line\",\"dim2\":\"Strong transcription\"\n\"dim1\":\"iPS DF 19.11 Cell Line\",\"dim2\":\"Transcr at gene 5 and 3\"\n\"dim1\":\"iPS DF 19.11 Cell Line\",\"dim2\":\"Wea epressed PolyComb\"\n\"dim1\":\"iPS DF 19.11 Cell Line\",\"dim2\":\"Weak transcription\"\n\"dim1\":\"iPS DF 19.11 Cell Line\",\"dim2\":\"ZNF genes and repeats\"\n\"dim1\":\"iPS DF 6.9 Cell Line\",\"dim2\":\"Active TSS\"\n\"dim1\":\"iPS DF 6.9 Cell Line\",\"dim2\":\"Bivalent Enhancer\"\n\"dim1\":\"iPS DF 6.9 Cell Line\",\"dim2\":\"Bivalent Poised TSS\"\n\"dim1\":\"iPS DF 6.9 Cell Line\",\"dim2\":\"Enhancers\"\n\"dim1\":\"iPS DF 6.9 Cell Line\",\"dim2\":\"Flanking Active TSS\"\n\"dim1\":\"iPS DF 6.9 Cell Line\",\"dim2\":\"Flanking Bivalent TSS Enh\"\n\"dim1\":\"iPS DF 6.9 Cell Line\",\"dim2\":\"Genic enhancers\"\n\"dim1\":\"iPS DF 6.9 Cell Line\",\"dim2\":\"Heterochromatin\"\n\"dim1\":\"iPS DF 6.9 Cell Line\",\"dim2\":\"Quiescent Low\"\n\"dim1\":\"iPS DF 6.9 Cell Line\",\"dim2\":\"Repressed PolyComb\"\n\"dim1\":\"iPS DF 6.9 Cell Line\",\"dim2\":\"Strong transcription\"\n\"dim1\":\"iPS DF 6.9 Cell Line\",\"dim2\":\"Transcr at gene 5 and 3\"\n\"dim1\":\"iPS DF 6.9 Cell Line\",\"dim2\":\"Wea epressed PolyComb\"\n\"dim1\":\"iPS DF 6.9 Cell Line\",\"dim2\":\"Weak transcription\"\n\"dim1\":\"iPS DF 6.9 Cell Line\",\"dim2\":\"ZNF genes and repeats\"\n"
  },
  {
    "path": "examples/segway/cell_types.txt",
    "content": "A549\nADIPOSE_NUCLEI\nADULT_LIVER\nAG04449\nAG04450\nAG09309\nAG09319\nAG10803\nAOAF\nAORTA\nBC_COLON_H12817N\nBC_LUNG_01-11002\nBC_LUNG_H12817N\nBC_SPLEEN_H12817N\nBE2_C\nBJ\nBONE_MARROW_DERIVED_MESENCHYMAL_STEM_CELL_CULTURED_CELLS\nBRAIN_ANGULAR_GYRUS\nBRAIN_ANTERIOR_CAUDATE\nBRAIN_CINGULATE_GYRUS\nBRAIN_HIPPOCAMPUS_MIDDLE\nBRAIN_INFERIOR_TEMPORAL_LOBE\nBRAIN_MID_FRONTAL_LOBE\nBRAIN_SUBSTANTIA_NIGRA\nBREAST_MYOEPITHELIAL_CELLS\nBREAST_VHMEC\nCACO-2\nCD14_PRIMARY_CELLS\nCD19_PRIMARY_CELLS_PERIPHERAL_UW\nCD3_PRIMARY_CELLS_CORD_BI\nCD3_PRIMARY_CELLS_PERIPHERAL_UW\nCD4+_CD25+_CD127-_TREG_PRIMARY_CELLS\nCD4+_CD25-_CD45RA+_NAIVE_PRIMARY_CELLS\nCD4+_CD25-_CD45RO+_MEMORY_PRIMARY_CELLS\nCD4+_CD25-_IL17+_PMA-IONOMCYIN_STIMULATED_TH17_PRIMARY_CELLS\nCD4+_CD25-_IL17-_PMA-IONOMYCIN_STIMULATED_MACS_PURIFIED_TH_PRIMARY_CELLS\nCD4+_CD25INT_CD127+_TMEM_PRIMARY_CELLS\nCD4+_CD25-_TH_PRIMARY_CELLS\nCD4_MEMORY_PRIMARY_CELLS\nCD4_NAIVE_PRIMARY_CELLS\nCD56_PRIMARY_CELLS\nCD8_MEMORY_PRIMARY_CELLS\nCD8_NAIVE_PRIMARY_CELLS\nCHONDROCYTES_FROM_BONE_MARROW_DERIVED_MESENCHYMAL_STEM_CELL_CULTURED_CELLS\nCOLONIC_MUCOSA\nCOLON_SMOOTH_MUSCLE\nDND41\nDUODENUM_MUCOSA\nDUODENUM_SMOOTH_MUSCLE\nECC-1\nES-I3_CELL_LINE\nES-WA7_CELL_LINE\nFETAL_ADRENAL_GLAND\nFETAL_BRAIN_FEMALE\nFETAL_BRAIN_MALE\nFETAL_HEART\nFETAL_INTESTINE_LARGE\nFETAL_INTESTINE_SMALL\nFETAL_KIDNEY\nFETAL_LUNG\nFETAL_MUSCLE_LEG\nFETAL_MUSCLE_TRUNK\nFETAL_PLACENTA\nFETAL_STOMACH\nFETAL_THYMUS\nGASTRIC\nGLIOBLA\nGM06990\nGM12864\nGM12865\nGM12891\nGM12892\nH1_BMP4_DERIVED_MESENDODERM_CULTURED_CELLS\nH1_BMP4_DERIVED_TROPHOBLAST_CULTURED_CELLS\nH1_DERIVED_MESENCHYMAL_STEM_CELLS\nH1_DERIVED_NEURONAL_PROGENITOR_CULTURED_CELLS\nH1-HESC\nH7-HESC\nH9_DERIVED_NEURONAL_PROGENITOR_CULTURED_CELLS\nH9_DERIVED_NEURON_CULTURED_CELLS\nH9ES\nHAC\nHA-SP\nHBMEC\nHCFAA\nHCM\nHCPEPIC\nHCT-116\nHEEPIC\nHEK293\nHEPG2\nHESC_DERIVED_CD184+_ENDODERM_CULTURED_CELLS\nHESC_DERIVED_CD56+_ECTODERM_CULTURED_CELLS\nHESC_DERIVED_CD56+_MESODERM_CULTURED_CELLS\nHFF\nHFF-MYC\nHL-60\nHMEC\nHMF\nHPAF\nHPF\nHRE\nHRPEPIC\nHSMM\nHSMMTUBE\nHUES48_CELL_LINE\nHUES64_CELL_LINE\nHUES6_CELL_LINE\nHUVEC\nIMR90\nIPS-15B_CELL_LINE\nIPS-18_CELL_LINE\nIPS-20B_CELL_LINE\nIPS_DF_19\nIPS_DF_6\nK562\nLEFT_VENTRICLE\nLHCN-M2\nMCF-7\nMESENCHYMAL_STEM_CELL_DERIVED_ADIPOCYTE_CULTURED_CELLS\nMOBILIZED_CD34_PRIMARY_CELLS_FEMALE\nMOBILIZED_CD34_PRIMARY_CELLS_MALE\nMONOCYTES-CD14+_RO01746\nNB4\nNH-A\nNHDF-AD\nNHDF-NEO\nNHEK\nNHLF\nNT2-D1\nOSTEOBL\nOVARY\nPANC-1\nPANISLETS\nPENIS_FORESKIN_FIBROBLAST_PRIMARY_CELLS_SKIN01\nPENIS_FORESKIN_FIBROBLAST_PRIMARY_CELLS_SKIN02\nPENIS_FORESKIN_KERATINOCYTE_PRIMARY_CELLS_SKIN02\nPENIS_FORESKIN_KERATINOCYTE_PRIMARY_CELLS_SKIN03\nPENIS_FORESKIN_MELANOCYTE_PRIMARY_CELLS_SKIN01\nPENIS_FORESKIN_MELANOCYTE_PRIMARY_CELLS_SKIN03\nPERIPHERAL_BLOOD_MONONUCLEAR_PRIMARY_CELLS\nPLACENTA_AMNION\nPROGFIB\nPSOAS_MUSCLE_OC\nRECTAL_MUCOSA\nRECTAL_SMOOTH_MUSCLE\nRIGHT_ATRIUM\nRIGHT_VENTRICLE\nRPTEC\nSAEC\nSIGMOID_COLON\nSKELETAL_MUSCLE_FEMALE\nSKELETAL_MUSCLE_MALE\nSK-N-MC\nSK-N-SH\nSK-N-SH_RA\nSMALL_INTESTINE_OC\nSTOMACH_MUCOSA\nSTOMACH_SMOOTH_MUSCLE\nT-47D\nTHYMUS\nWERI-RB-1\nWI-38\n"
  },
  {
    "path": "examples/segway/data_def.json",
    "content": "{\n  \"dimensions\": [\n    {\n      \"elements\": [\n        \"A549\",\n        \"ADIPOSE_NUCLEI\",\n        \"ADULT_LIVER\",\n        \"AG04449\",\n        \"AG04450\",\n        \"AG09309\",\n        \"AG09319\",\n        \"AG10803\",\n        \"AOAF\",\n        \"AORTA\",\n        \"BC_COLON_H12817N\",\n        \"BC_LUNG_01-11002\",\n        \"BC_LUNG_H12817N\",\n        \"BC_SPLEEN_H12817N\",\n        \"BE2_C\",\n        \"BJ\",\n        \"BONE_MARROW_DERIVED_MESENCHYMAL_STEM_CELL_CULTURED_CELLS\",\n        \"BRAIN_ANGULAR_GYRUS\",\n        \"BRAIN_ANTERIOR_CAUDATE\",\n        \"BRAIN_CINGULATE_GYRUS\",\n        \"BRAIN_HIPPOCAMPUS_MIDDLE\",\n        \"BRAIN_INFERIOR_TEMPORAL_LOBE\",\n        \"BRAIN_MID_FRONTAL_LOBE\",\n        \"BRAIN_SUBSTANTIA_NIGRA\",\n        \"BREAST_MYOEPITHELIAL_CELLS\",\n        \"BREAST_VHMEC\",\n        \"CACO-2\",\n        \"CD14_PRIMARY_CELLS\",\n        \"CD19_PRIMARY_CELLS_PERIPHERAL_UW\",\n        \"CD3_PRIMARY_CELLS_CORD_BI\",\n        \"CD3_PRIMARY_CELLS_PERIPHERAL_UW\",\n        \"CD4+_CD25+_CD127-_TREG_PRIMARY_CELLS\",\n        \"CD4+_CD25-_CD45RA+_NAIVE_PRIMARY_CELLS\",\n        \"CD4+_CD25-_CD45RO+_MEMORY_PRIMARY_CELLS\",\n        \"CD4+_CD25-_IL17+_PMA-IONOMCYIN_STIMULATED_TH17_PRIMARY_CELLS\",\n        \"CD4+_CD25-_IL17-_PMA-IONOMYCIN_STIMULATED_MACS_PURIFIED_TH_PRIMARY_CELLS\",\n        \"CD4+_CD25INT_CD127+_TMEM_PRIMARY_CELLS\",\n        \"CD4+_CD25-_TH_PRIMARY_CELLS\",\n        \"CD4_MEMORY_PRIMARY_CELLS\",\n        \"CD4_NAIVE_PRIMARY_CELLS\",\n        \"CD56_PRIMARY_CELLS\",\n        \"CD8_MEMORY_PRIMARY_CELLS\",\n        \"CD8_NAIVE_PRIMARY_CELLS\",\n        \"CHONDROCYTES_FROM_BONE_MARROW_DERIVED_MESENCHYMAL_STEM_CELL_CULTURED_CELLS\",\n        \"COLONIC_MUCOSA\",\n        \"COLON_SMOOTH_MUSCLE\",\n        \"DND41\",\n        \"DUODENUM_MUCOSA\",\n        \"DUODENUM_SMOOTH_MUSCLE\",\n        \"ECC-1\",\n        \"ES-I3_CELL_LINE\",\n        \"ES-WA7_CELL_LINE\",\n        \"FETAL_ADRENAL_GLAND\",\n        \"FETAL_BRAIN_FEMALE\",\n        \"FETAL_BRAIN_MALE\",\n        \"FETAL_HEART\",\n        \"FETAL_INTESTINE_LARGE\",\n        \"FETAL_INTESTINE_SMALL\",\n        \"FETAL_KIDNEY\",\n        \"FETAL_LUNG\",\n        \"FETAL_MUSCLE_LEG\",\n        \"FETAL_MUSCLE_TRUNK\",\n        \"FETAL_PLACENTA\",\n        \"FETAL_STOMACH\",\n        \"FETAL_THYMUS\",\n        \"GASTRIC\",\n        \"GLIOBLA\",\n        \"GM06990\",\n        \"GM12864\",\n        \"GM12865\",\n        \"GM12891\",\n        \"GM12892\",\n        \"H1_BMP4_DERIVED_MESENDODERM_CULTURED_CELLS\",\n        \"H1_BMP4_DERIVED_TROPHOBLAST_CULTURED_CELLS\",\n        \"H1_DERIVED_MESENCHYMAL_STEM_CELLS\",\n        \"H1_DERIVED_NEURONAL_PROGENITOR_CULTURED_CELLS\",\n        \"H1-HESC\",\n        \"H7-HESC\",\n        \"H9_DERIVED_NEURONAL_PROGENITOR_CULTURED_CELLS\",\n        \"H9_DERIVED_NEURON_CULTURED_CELLS\",\n        \"H9ES\",\n        \"HAC\",\n        \"HA-SP\",\n        \"HBMEC\",\n        \"HCFAA\",\n        \"HCM\",\n        \"HCPEPIC\",\n        \"HCT-116\",\n        \"HEEPIC\",\n        \"HEK293\",\n        \"HEPG2\",\n        \"HESC_DERIVED_CD184+_ENDODERM_CULTURED_CELLS\",\n        \"HESC_DERIVED_CD56+_ECTODERM_CULTURED_CELLS\",\n        \"HESC_DERIVED_CD56+_MESODERM_CULTURED_CELLS\",\n        \"HFF\",\n        \"HFF-MYC\",\n        \"HL-60\",\n        \"HMEC\",\n        \"HMF\",\n        \"HPAF\",\n        \"HPF\",\n        \"HRE\",\n        \"HRPEPIC\",\n        \"HSMM\",\n        \"HSMMTUBE\",\n        \"HUES48_CELL_LINE\",\n        \"HUES64_CELL_LINE\",\n        \"HUES6_CELL_LINE\",\n        \"HUVEC\",\n        \"IMR90\",\n        \"IPS-15B_CELL_LINE\",\n        \"IPS-18_CELL_LINE\",\n        \"IPS-20B_CELL_LINE\",\n        \"IPS_DF_19\",\n        \"IPS_DF_6\",\n        \"K562\",\n        \"LEFT_VENTRICLE\",\n        \"LHCN-M2\",\n        \"MCF-7\",\n        \"MESENCHYMAL_STEM_CELL_DERIVED_ADIPOCYTE_CULTURED_CELLS\",\n        \"MOBILIZED_CD34_PRIMARY_CELLS_FEMALE\",\n        \"MOBILIZED_CD34_PRIMARY_CELLS_MALE\",\n        \"MONOCYTES-CD14+_RO01746\",\n        \"NB4\",\n        \"NH-A\",\n        \"NHDF-AD\",\n        \"NHDF-NEO\",\n        \"NHEK\",\n        \"NHLF\",\n        \"NT2-D1\",\n        \"OSTEOBL\",\n        \"OVARY\",\n        \"PANC-1\",\n        \"PANISLETS\",\n        \"PENIS_FORESKIN_FIBROBLAST_PRIMARY_CELLS_SKIN01\",\n        \"PENIS_FORESKIN_FIBROBLAST_PRIMARY_CELLS_SKIN02\",\n        \"PENIS_FORESKIN_KERATINOCYTE_PRIMARY_CELLS_SKIN02\",\n        \"PENIS_FORESKIN_KERATINOCYTE_PRIMARY_CELLS_SKIN03\",\n        \"PENIS_FORESKIN_MELANOCYTE_PRIMARY_CELLS_SKIN01\",\n        \"PENIS_FORESKIN_MELANOCYTE_PRIMARY_CELLS_SKIN03\",\n        \"PERIPHERAL_BLOOD_MONONUCLEAR_PRIMARY_CELLS\",\n        \"PLACENTA_AMNION\",\n        \"PROGFIB\",\n        \"PSOAS_MUSCLE_OC\",\n        \"RECTAL_MUCOSA\",\n        \"RECTAL_SMOOTH_MUSCLE\",\n        \"RIGHT_ATRIUM\",\n        \"RIGHT_VENTRICLE\",\n        \"RPTEC\",\n        \"SAEC\",\n        \"SIGMOID_COLON\",\n        \"SKELETAL_MUSCLE_FEMALE\",\n        \"SKELETAL_MUSCLE_MALE\",\n        \"SK-N-MC\",\n        \"SK-N-SH\",\n        \"SK-N-SH_RA\",\n        \"SMALL_INTESTINE_OC\",\n        \"STOMACH_MUCOSA\",\n        \"STOMACH_SMOOTH_MUSCLE\",\n        \"T-47D\",\n        \"THYMUS\",\n        \"WERI-RB-1\",\n        \"WI-38\"\n      ], \n      \"number\": \"163\", \n      \"title\": \"Tissues/Cell Lines\"\n    }, \n    {\n      \"elements\": [\n        \"Bivalent\",\n        \"ConstitutiveHet\",\n        \"Enhancer\",\n        \"FacultativeHet\",\n        \"LowConfidence\",\n        \"Promoter\",\n        \"Quiescent\",\n        \"RegPermissive\",\n        \"Transcribed\"\n      ], \n      \"number\": \"9\", \n      \"title\": \"Genomic States\"\n    }\n  ], \n  \"sourceFiles\": [\n    {\n      \"name\": \"A549_ConstitutiveHet.bed.gz\",\n      \"position\": [\n        0,\n        1\n      ],\n      \"type\": \"bed\"\n    },\n    {\n      \"name\": \"A549_Enhancer.bed.gz\",\n      \"position\": [\n        0,\n        2\n      ],\n      \"type\": \"bed\"\n    },\n    {\n      \"name\": \"A549_FacultativeHet.bed.gz\",\n      \"position\": [\n        0,\n        3\n      ],\n      \"type\": \"bed\"\n    },\n\n    {\n      \"name\": \"A549_LowConfidence.bed.gz\",\n      \"position\": [\n        0,\n        4\n      ],\n      \"type\": \"bed\"\n    },\n\n    {\n      \"name\": \"A549_Promoter.bed.gz\",\n      \"position\": [\n        0,\n        5\n      ],\n      \"type\": \"bed\"\n    },\n\n    {\n      \"name\": \"A549_Quiescent.bed.gz\",\n      \"position\": [\n        0,\n        6\n      ],\n      \"type\": \"bed\"\n    },\n\n    {\n      \"name\": \"A549_RegPermissive.bed.gz\",\n      \"position\": [\n        0,\n        7\n      ],\n      \"type\": \"bed\"\n    },\n\n    {\n      \"name\": \"A549_Transcribed.bed.gz\",\n      \"position\": [\n        0,\n        8\n      ],\n      \"type\": \"bed\"\n    },\n\n    {\n      \"name\": \"ADIPOSE_NUCLEI_ConstitutiveHet.bed.gz\",\n      \"position\": [\n        1,\n        1\n      ],\n      \"type\": \"bed\"\n    },\n\n    {\n      \"name\": \"ADIPOSE_NUCLEI_Enhancer.bed.gz\",\n      \"position\": [\n        1,\n        2\n      ],\n      \"type\": \"bed\"\n    },\n\n    {\n      \"name\": \"ADIPOSE_NUCLEI_FacultativeHet.bed.gz\",\n      \"position\": [\n        1,\n        3\n      ],\n      \"type\": \"bed\"\n    },\n\n    {\n      \"name\": \"ADIPOSE_NUCLEI_Quiescent.bed.gz\",\n      \"position\": [\n        1,\n        6\n      ],\n      \"type\": \"bed\"\n    },\n\n    {\n      \"name\": \"ADIPOSE_NUCLEI_RegPermissive.bed.gz\",\n      \"position\": [\n        1,\n        7\n      ],\n      \"type\": \"bed\"\n    },\n\n    {\n      \"name\": \"ADIPOSE_NUCLEI_Transcribed.bed.gz\",\n      \"position\": [\n        1,\n        8\n      ],\n      \"type\": \"bed\"\n    },\n\n    {\n      \"name\": \"ADULT_LIVER_ConstitutiveHet.bed.gz\",\n      \"position\": [\n        2,\n        1\n      ],\n      \"type\": \"bed\"\n    },\n\n    {\n      \"name\": \"ADULT_LIVER_Enhancer.bed.gz\",\n      \"position\": [\n        2,\n        2\n      ],\n      \"type\": \"bed\"\n    },\n\n    {\n      \"name\": \"ADULT_LIVER_FacultativeHet.bed.gz\",\n      \"position\": [\n        2,\n        3\n      ],\n      \"type\": \"bed\"\n    },\n\n    {\n      \"name\": \"ADULT_LIVER_Promoter.bed.gz\",\n      \"position\": [\n        2,\n        5\n      ],\n      \"type\": \"bed\"\n    },\n\n    {\n      \"name\": \"ADULT_LIVER_Quiescent.bed.gz\",\n      \"position\": [\n        2,\n        6\n      ],\n      \"type\": \"bed\"\n    },\n\n    {\n      \"name\": \"ADULT_LIVER_RegPermissive.bed.gz\",\n      \"position\": [\n        2,\n        7\n      ],\n      \"type\": \"bed\"\n    },\n\n    {\n      \"name\": \"ADULT_LIVER_Transcribed.bed.gz\",\n      \"position\": [\n        2,\n        8\n      ],\n      \"type\": \"bed\"\n    },\n\n    {\n      \"name\": \"AG04449_Enhancer.bed.gz\",\n      \"position\": [\n        3,\n        2\n      ],\n      \"type\": \"bed\"\n    },\n\n    {\n      \"name\": \"AG04449_FacultativeHet.bed.gz\",\n      \"position\": [\n        3,\n        3\n      ],\n      \"type\": \"bed\"\n    },\n\n    {\n      \"name\": \"AG04449_Promoter.bed.gz\",\n      \"position\": [\n        3,\n        5\n      ],\n      \"type\": \"bed\"\n    },\n\n    {\n      \"name\": \"AG04449_Quiescent.bed.gz\",\n      \"position\": [\n        3,\n        6\n      ],\n      \"type\": \"bed\"\n    },\n\n    {\n      \"name\": \"AG04449_RegPermissive.bed.gz\",\n      \"position\": [\n        3,\n        7\n      ],\n      \"type\": \"bed\"\n    },\n\n    {\n      \"name\": \"AG04450_Enhancer.bed.gz\",\n      \"position\": [\n        4,\n        2\n      ],\n      \"type\": \"bed\"\n    },\n\n    {\n      \"name\": \"AG04450_LowConfidence.bed.gz\",\n      \"position\": [\n        4,\n        4\n      ],\n      \"type\": \"bed\"\n    },\n\n    {\n      \"name\": \"AG04450_Promoter.bed.gz\",\n      \"position\": [\n        4,\n        5\n      ],\n      \"type\": \"bed\"\n    },\n\n    {\n      \"name\": \"AG04450_Quiescent.bed.gz\",\n      \"position\": [\n        4,\n        6\n      ],\n      \"type\": \"bed\"\n    },\n\n    {\n      \"name\": \"AG04450_RegPermissive.bed.gz\",\n      \"position\": [\n        4,\n        7\n      ],\n      \"type\": \"bed\"\n    },\n\n    {\n      \"name\": \"AG04450_Transcribed.bed.gz\",\n      \"position\": [\n        4,\n        8\n      ],\n      \"type\": \"bed\"\n    },\n\n    {\n      \"name\": \"AG09309_Enhancer.bed.gz\",\n      \"position\": [\n        5,\n        2\n      ],\n      \"type\": \"bed\"\n    },\n\n    {\n      \"name\": \"AG09309_Promoter.bed.gz\",\n      \"position\": [\n        5,\n        5\n      ],\n      \"type\": \"bed\"\n    },\n\n    {\n      \"name\": \"AG09309_Quiescent.bed.gz\",\n      \"position\": [\n        5,\n        6\n      ],\n      \"type\": \"bed\"\n    },\n\n    {\n      \"name\": \"AG09309_RegPermissive.bed.gz\",\n      \"position\": [\n        5,\n        7\n      ],\n      \"type\": \"bed\"\n    },\n\n    {\n      \"name\": \"AG09319_Bivalent.bed.gz\",\n      \"position\": [\n        6,\n        0\n      ],\n      \"type\": \"bed\"\n    },\n\n    {\n      \"name\": \"AG09319_Enhancer.bed.gz\",\n      \"position\": [\n        6,\n        2\n      ],\n      \"type\": \"bed\"\n    },\n\n    {\n      \"name\": \"AG09319_Promoter.bed.gz\",\n      \"position\": [\n        6,\n        5\n      ],\n      \"type\": \"bed\"\n    },\n\n    {\n      \"name\": \"AG09319_Quiescent.bed.gz\",\n      \"position\": [\n        6,\n        6\n      ],\n      \"type\": \"bed\"\n    },\n\n    {\n      \"name\": \"AG09319_RegPermissive.bed.gz\",\n      \"position\": [\n        6,\n        7\n      ],\n      \"type\": \"bed\"\n    },\n\n    {\n      \"name\": \"AG10803_Bivalent.bed.gz\",\n      \"position\": [\n        7,\n        0\n      ],\n      \"type\": \"bed\"\n    },\n\n    {\n      \"name\": \"AG10803_Enhancer.bed.gz\",\n      \"position\": [\n        7,\n        2\n      ],\n      \"type\": \"bed\"\n    },\n\n    {\n      \"name\": \"AG10803_FacultativeHet.bed.gz\",\n      \"position\": [\n        7,\n        3\n      ],\n      \"type\": \"bed\"\n    },\n\n    {\n      \"name\": \"AG10803_LowConfidence.bed.gz\",\n      \"position\": [\n        7,\n        4\n      ],\n      \"type\": \"bed\"\n    },\n\n    {\n      \"name\": \"AG10803_Quiescent.bed.gz\",\n      \"position\": [\n        7,\n        6\n      ],\n      \"type\": \"bed\"\n    },\n\n    {\n      \"name\": \"AG10803_RegPermissive.bed.gz\",\n      \"position\": [\n        7,\n        7\n      ],\n      \"type\": \"bed\"\n    },\n\n    {\n      \"name\": \"AOAF_Enhancer.bed.gz\",\n      \"position\": [\n        8,\n        2\n      ],\n      \"type\": \"bed\"\n    },\n\n    {\n      \"name\": \"AOAF_FacultativeHet.bed.gz\",\n      \"position\": [\n        8,\n        3\n      ],\n      \"type\": \"bed\"\n    },\n\n    {\n      \"name\": \"AOAF_Promoter.bed.gz\",\n      \"position\": [\n        8,\n        5\n      ],\n      \"type\": \"bed\"\n    },\n\n    {\n      \"name\": \"AOAF_Quiescent.bed.gz\",\n      \"position\": [\n        8,\n        6\n      ],\n      \"type\": \"bed\"\n    },\n\n    {\n      \"name\": \"AOAF_RegPermissive.bed.gz\",\n      \"position\": [\n        8,\n        7\n      ],\n      \"type\": \"bed\"\n    },\n\n    {\n      \"name\": \"AORTA_Bivalent.bed.gz\",\n      \"position\": [\n        9,\n        0\n      ],\n      \"type\": \"bed\"\n    },\n\n    {\n      \"name\": \"AORTA_ConstitutiveHet.bed.gz\",\n      \"position\": [\n        9,\n        1\n      ],\n      \"type\": \"bed\"\n    },\n\n    {\n      \"name\": \"AORTA_Enhancer.bed.gz\",\n      \"position\": [\n        9,\n        2\n      ],\n      \"type\": \"bed\"\n    },\n\n    {\n      \"name\": \"AORTA_FacultativeHet.bed.gz\",\n      \"position\": [\n        9,\n        3\n      ],\n      \"type\": \"bed\"\n    },\n\n    {\n      \"name\": \"AORTA_Promoter.bed.gz\",\n      \"position\": [\n        9,\n        5\n      ],\n      \"type\": \"bed\"\n    },\n\n    {\n      \"name\": \"AORTA_Quiescent.bed.gz\",\n      \"position\": [\n        9,\n        6\n      ],\n      \"type\": \"bed\"\n    },\n\n    {\n      \"name\": \"AORTA_RegPermissive.bed.gz\",\n      \"position\": [\n        9,\n        7\n      ],\n      \"type\": \"bed\"\n    },\n\n    {\n      \"name\": \"AORTA_Transcribed.bed.gz\",\n      \"position\": [\n        9,\n        8\n      ],\n      \"type\": \"bed\"\n    },\n\n    {\n      \"name\": \"BC_COLON_H12817N_ConstitutiveHet.bed.gz\",\n      \"position\": [\n        10,\n        1\n      ],\n      \"type\": \"bed\"\n    },\n\n    {\n      \"name\": \"BC_COLON_H12817N_Enhancer.bed.gz\",\n      \"position\": [\n        10,\n        2\n      ],\n      \"type\": \"bed\"\n    },\n\n    {\n      \"name\": \"BC_COLON_H12817N_LowConfidence.bed.gz\",\n      \"position\": [\n        10,\n        4\n      ],\n      \"type\": \"bed\"\n    },\n\n    {\n      \"name\": \"BC_COLON_H12817N_Promoter.bed.gz\",\n      \"position\": [\n        10,\n        5\n      ],\n      \"type\": \"bed\"\n    },\n\n    {\n      \"name\": \"BC_COLON_H12817N_Quiescent.bed.gz\",\n      \"position\": [\n        10,\n        6\n      ],\n      \"type\": \"bed\"\n    },\n\n    {\n      \"name\": \"BC_COLON_H12817N_RegPermissive.bed.gz\",\n      \"position\": [\n        10,\n        7\n      ],\n      \"type\": \"bed\"\n    },\n\n    {\n      \"name\": \"BC_COLON_H12817N_Transcribed.bed.gz\",\n      \"position\": [\n        10,\n        8\n      ],\n      \"type\": \"bed\"\n    },\n\n    {\n      \"name\": \"BC_LUNG_01-11002_ConstitutiveHet.bed.gz\",\n      \"position\": [\n        11,\n        1\n      ],\n      \"type\": \"bed\"\n    },\n\n    {\n      \"name\": \"BC_LUNG_01-11002_Enhancer.bed.gz\",\n      \"position\": [\n        11,\n        2\n      ],\n      \"type\": \"bed\"\n    },\n\n    {\n      \"name\": \"BC_LUNG_01-11002_FacultativeHet.bed.gz\",\n      \"position\": [\n        11,\n        3\n      ],\n      \"type\": \"bed\"\n    },\n\n    {\n      \"name\": \"BC_LUNG_01-11002_Promoter.bed.gz\",\n      \"position\": [\n        11,\n        5\n      ],\n      \"type\": \"bed\"\n    },\n\n    {\n      \"name\": \"BC_LUNG_01-11002_Quiescent.bed.gz\",\n      \"position\": [\n        11,\n        6\n      ],\n      \"type\": \"bed\"\n    },\n\n    {\n      \"name\": \"BC_LUNG_01-11002_RegPermissive.bed.gz\",\n      \"position\": [\n        11,\n        7\n      ],\n      \"type\": \"bed\"\n    },\n\n    {\n      \"name\": \"BC_LUNG_01-11002_Transcribed.bed.gz\",\n      \"position\": [\n        11,\n        8\n      ],\n      \"type\": \"bed\"\n    },\n\n    {\n      \"name\": \"BC_LUNG_H12817N_ConstitutiveHet.bed.gz\",\n      \"position\": [\n        12,\n        1\n      ],\n      \"type\": \"bed\"\n    },\n\n    {\n      \"name\": \"BC_LUNG_H12817N_Enhancer.bed.gz\",\n      \"position\": [\n        12,\n        2\n      ],\n      \"type\": \"bed\"\n    },\n\n    {\n      \"name\": \"BC_LUNG_H12817N_FacultativeHet.bed.gz\",\n      \"position\": [\n        12,\n        3\n      ],\n      \"type\": \"bed\"\n    },\n\n    {\n      \"name\": \"BC_LUNG_H12817N_Promoter.bed.gz\",\n      \"position\": [\n        12,\n        5\n      ],\n      \"type\": \"bed\"\n    },\n\n    {\n      \"name\": \"BC_LUNG_H12817N_Quiescent.bed.gz\",\n      \"position\": [\n        12,\n        6\n      ],\n      \"type\": \"bed\"\n    },\n\n    {\n      \"name\": \"BC_LUNG_H12817N_RegPermissive.bed.gz\",\n      \"position\": [\n        12,\n        7\n      ],\n      \"type\": \"bed\"\n    },\n\n    {\n      \"name\": \"BC_LUNG_H12817N_Transcribed.bed.gz\",\n      \"position\": [\n        12,\n        8\n      ],\n      \"type\": \"bed\"\n    },\n\n    {\n      \"name\": \"BC_SPLEEN_H12817N_ConstitutiveHet.bed.gz\",\n      \"position\": [\n        13,\n        1\n      ],\n      \"type\": \"bed\"\n    },\n\n    {\n      \"name\": \"BC_SPLEEN_H12817N_Enhancer.bed.gz\",\n      \"position\": [\n        13,\n        2\n      ],\n      \"type\": \"bed\"\n    },\n\n    {\n      \"name\": \"BC_SPLEEN_H12817N_FacultativeHet.bed.gz\",\n      \"position\": [\n        13,\n        3\n      ],\n      \"type\": \"bed\"\n    },\n\n    {\n      \"name\": \"BC_SPLEEN_H12817N_Promoter.bed.gz\",\n      \"position\": [\n        13,\n        5\n      ],\n      \"type\": \"bed\"\n    },\n\n    {\n      \"name\": \"BC_SPLEEN_H12817N_Quiescent.bed.gz\",\n      \"position\": [\n        13,\n        6\n      ],\n      \"type\": \"bed\"\n    },\n\n    {\n      \"name\": \"BC_SPLEEN_H12817N_RegPermissive.bed.gz\",\n      \"position\": [\n        13,\n        7\n      ],\n      \"type\": \"bed\"\n    },\n\n    {\n      \"name\": \"BC_SPLEEN_H12817N_Transcribed.bed.gz\",\n      \"position\": [\n        13,\n        8\n      ],\n      \"type\": \"bed\"\n    },\n\n    {\n      \"name\": \"BE2_C_Enhancer.bed.gz\",\n      \"position\": [\n        14,\n        2\n      ],\n      \"type\": \"bed\"\n    },\n\n    {\n      \"name\": \"BE2_C_FacultativeHet.bed.gz\",\n      \"position\": [\n        14,\n        3\n      ],\n      \"type\": \"bed\"\n    },\n\n    {\n      \"name\": \"BE2_C_Promoter.bed.gz\",\n      \"position\": [\n        14,\n        5\n      ],\n      \"type\": \"bed\"\n    },\n\n    {\n      \"name\": \"BE2_C_Quiescent.bed.gz\",\n      \"position\": [\n        14,\n        6\n      ],\n      \"type\": \"bed\"\n    },\n\n    {\n      \"name\": \"BE2_C_RegPermissive.bed.gz\",\n      \"position\": [\n        14,\n        7\n      ],\n      \"type\": \"bed\"\n    },\n\n    {\n      \"name\": \"BJ_Promoter.bed.gz\",\n      \"position\": [\n        15,\n        5\n      ],\n      \"type\": \"bed\"\n    },\n\n    {\n      \"name\": \"BJ_Quiescent.bed.gz\",\n      \"position\": [\n        15,\n        6\n      ],\n      \"type\": \"bed\"\n    },\n\n    {\n      \"name\": \"BJ_Transcribed.bed.gz\",\n      \"position\": [\n        15,\n        8\n      ],\n      \"type\": \"bed\"\n    },\n\n    {\n      \"name\": \"BONE_MARROW_DERIVED_MESENCHYMAL_STEM_CELL_CULTURED_CELLS_ConstitutiveHet.bed.gz\",\n      \"position\": [\n        16,\n        1\n      ],\n      \"type\": \"bed\"\n    },\n\n    {\n      \"name\": \"BONE_MARROW_DERIVED_MESENCHYMAL_STEM_CELL_CULTURED_CELLS_Enhancer.bed.gz\",\n      \"position\": [\n        16,\n        2\n      ],\n      \"type\": \"bed\"\n    },\n\n    {\n      \"name\": \"BONE_MARROW_DERIVED_MESENCHYMAL_STEM_CELL_CULTURED_CELLS_FacultativeHet.bed.gz\",\n      \"position\": [\n        16,\n        3\n      ],\n      \"type\": \"bed\"\n    },\n\n    {\n      \"name\": \"BONE_MARROW_DERIVED_MESENCHYMAL_STEM_CELL_CULTURED_CELLS_Promoter.bed.gz\",\n      \"position\": [\n        16,\n        5\n      ],\n      \"type\": \"bed\"\n    },\n\n    {\n      \"name\": \"BONE_MARROW_DERIVED_MESENCHYMAL_STEM_CELL_CULTURED_CELLS_Quiescent.bed.gz\",\n      \"position\": [\n        16,\n        6\n      ],\n      \"type\": \"bed\"\n    },\n\n    {\n      \"name\": \"BONE_MARROW_DERIVED_MESENCHYMAL_STEM_CELL_CULTURED_CELLS_Transcribed.bed.gz\",\n      \"position\": [\n        16,\n        8\n      ],\n      \"type\": \"bed\"\n    },\n\n    {\n      \"name\": \"BRAIN_ANGULAR_GYRUS_ConstitutiveHet.bed.gz\",\n      \"position\": [\n        17,\n        1\n      ],\n      \"type\": \"bed\"\n    },\n\n    {\n      \"name\": \"BRAIN_ANGULAR_GYRUS_Enhancer.bed.gz\",\n      \"position\": [\n        17,\n        2\n      ],\n      \"type\": \"bed\"\n    },\n\n    {\n      \"name\": \"BRAIN_ANGULAR_GYRUS_Quiescent.bed.gz\",\n      \"position\": [\n        17,\n        6\n      ],\n      \"type\": \"bed\"\n    },\n\n    {\n      \"name\": \"BRAIN_ANGULAR_GYRUS_RegPermissive.bed.gz\",\n      \"position\": [\n        17,\n        7\n      ],\n      \"type\": \"bed\"\n    },\n\n    {\n      \"name\": \"BRAIN_ANGULAR_GYRUS_Transcribed.bed.gz\",\n      \"position\": [\n        17,\n        8\n      ],\n      \"type\": \"bed\"\n    },\n\n    {\n      \"name\": \"BRAIN_ANTERIOR_CAUDATE_ConstitutiveHet.bed.gz\",\n      \"position\": [\n        18,\n        1\n      ],\n      \"type\": \"bed\"\n    },\n\n    {\n      \"name\": \"BRAIN_ANTERIOR_CAUDATE_Enhancer.bed.gz\",\n      \"position\": [\n        18,\n        2\n      ],\n      \"type\": \"bed\"\n    },\n\n    {\n      \"name\": \"BRAIN_ANTERIOR_CAUDATE_LowConfidence.bed.gz\",\n      \"position\": [\n        18,\n        4\n      ],\n      \"type\": \"bed\"\n    },\n\n    {\n      \"name\": \"BRAIN_ANTERIOR_CAUDATE_Quiescent.bed.gz\",\n      \"position\": [\n        18,\n        6\n      ],\n      \"type\": \"bed\"\n    },\n\n    {\n      \"name\": \"BRAIN_ANTERIOR_CAUDATE_Transcribed.bed.gz\",\n      \"position\": [\n        18,\n        8\n      ],\n      \"type\": \"bed\"\n    },\n\n    {\n      \"name\": \"BRAIN_CINGULATE_GYRUS_Bivalent.bed.gz\",\n      \"position\": [\n        19,\n        0\n      ],\n      \"type\": \"bed\"\n    },\n\n    {\n      \"name\": \"BRAIN_CINGULATE_GYRUS_ConstitutiveHet.bed.gz\",\n      \"position\": [\n        19,\n        1\n      ],\n      \"type\": \"bed\"\n    },\n\n    {\n      \"name\": \"BRAIN_CINGULATE_GYRUS_Enhancer.bed.gz\",\n      \"position\": [\n        19,\n        2\n      ],\n      \"type\": \"bed\"\n    },\n\n    {\n      \"name\": \"BRAIN_CINGULATE_GYRUS_FacultativeHet.bed.gz\",\n      \"position\": [\n        19,\n        3\n      ],\n      \"type\": \"bed\"\n    },\n\n    {\n      \"name\": \"BRAIN_CINGULATE_GYRUS_Quiescent.bed.gz\",\n      \"position\": [\n        19,\n        6\n      ],\n      \"type\": \"bed\"\n    },\n\n    {\n      \"name\": \"BRAIN_CINGULATE_GYRUS_Transcribed.bed.gz\",\n      \"position\": [\n        19,\n        8\n      ],\n      \"type\": \"bed\"\n    },\n\n    {\n      \"name\": \"BRAIN_HIPPOCAMPUS_MIDDLE_Bivalent.bed.gz\",\n      \"position\": [\n        20,\n        0\n      ],\n      \"type\": \"bed\"\n    },\n\n    {\n      \"name\": \"BRAIN_HIPPOCAMPUS_MIDDLE_ConstitutiveHet.bed.gz\",\n      \"position\": [\n        20,\n        1\n      ],\n      \"type\": \"bed\"\n    },\n\n    {\n      \"name\": \"BRAIN_HIPPOCAMPUS_MIDDLE_Enhancer.bed.gz\",\n      \"position\": [\n        20,\n        2\n      ],\n      \"type\": \"bed\"\n    },\n\n    {\n      \"name\": \"BRAIN_HIPPOCAMPUS_MIDDLE_FacultativeHet.bed.gz\",\n      \"position\": [\n        20,\n        3\n      ],\n      \"type\": \"bed\"\n    },\n\n    {\n      \"name\": \"BRAIN_HIPPOCAMPUS_MIDDLE_Quiescent.bed.gz\",\n      \"position\": [\n        20,\n        6\n      ],\n      \"type\": \"bed\"\n    },\n\n    {\n      \"name\": \"BRAIN_HIPPOCAMPUS_MIDDLE_RegPermissive.bed.gz\",\n      \"position\": [\n        20,\n        7\n      ],\n      \"type\": \"bed\"\n    },\n\n    {\n      \"name\": \"BRAIN_HIPPOCAMPUS_MIDDLE_Transcribed.bed.gz\",\n      \"position\": [\n        20,\n        8\n      ],\n      \"type\": \"bed\"\n    },\n\n    {\n      \"name\": \"BRAIN_INFERIOR_TEMPORAL_LOBE_ConstitutiveHet.bed.gz\",\n      \"position\": [\n        21,\n        1\n      ],\n      \"type\": \"bed\"\n    },\n\n    {\n      \"name\": \"BRAIN_INFERIOR_TEMPORAL_LOBE_Enhancer.bed.gz\",\n      \"position\": [\n        21,\n        2\n      ],\n      \"type\": \"bed\"\n    },\n\n    {\n      \"name\": \"BRAIN_INFERIOR_TEMPORAL_LOBE_FacultativeHet.bed.gz\",\n      \"position\": [\n        21,\n        3\n      ],\n      \"type\": \"bed\"\n    },\n\n    {\n      \"name\": \"BRAIN_INFERIOR_TEMPORAL_LOBE_Quiescent.bed.gz\",\n      \"position\": [\n        21,\n        6\n      ],\n      \"type\": \"bed\"\n    },\n\n    {\n      \"name\": \"BRAIN_INFERIOR_TEMPORAL_LOBE_Transcribed.bed.gz\",\n      \"position\": [\n        21,\n        8\n      ],\n      \"type\": \"bed\"\n    },\n\n    {\n      \"name\": \"BRAIN_MID_FRONTAL_LOBE_ConstitutiveHet.bed.gz\",\n      \"position\": [\n        22,\n        1\n      ],\n      \"type\": \"bed\"\n    },\n\n    {\n      \"name\": \"BRAIN_MID_FRONTAL_LOBE_Enhancer.bed.gz\",\n      \"position\": [\n        22,\n        2\n      ],\n      \"type\": \"bed\"\n    },\n\n    {\n      \"name\": \"BRAIN_MID_FRONTAL_LOBE_FacultativeHet.bed.gz\",\n      \"position\": [\n        22,\n        3\n      ],\n      \"type\": \"bed\"\n    },\n\n    {\n      \"name\": \"BRAIN_MID_FRONTAL_LOBE_Quiescent.bed.gz\",\n      \"position\": [\n        22,\n        6\n      ],\n      \"type\": \"bed\"\n    },\n\n    {\n      \"name\": \"BRAIN_MID_FRONTAL_LOBE_Transcribed.bed.gz\",\n      \"position\": [\n        22,\n        8\n      ],\n      \"type\": \"bed\"\n    },\n\n    {\n      \"name\": \"BRAIN_SUBSTANTIA_NIGRA_Bivalent.bed.gz\",\n      \"position\": [\n        23,\n        0\n      ],\n      \"type\": \"bed\"\n    },\n\n    {\n      \"name\": \"BRAIN_SUBSTANTIA_NIGRA_ConstitutiveHet.bed.gz\",\n      \"position\": [\n        23,\n        1\n      ],\n      \"type\": \"bed\"\n    },\n\n    {\n      \"name\": \"BRAIN_SUBSTANTIA_NIGRA_Enhancer.bed.gz\",\n      \"position\": [\n        23,\n        2\n      ],\n      \"type\": \"bed\"\n    },\n\n    {\n      \"name\": \"BRAIN_SUBSTANTIA_NIGRA_FacultativeHet.bed.gz\",\n      \"position\": [\n        23,\n        3\n      ],\n      \"type\": \"bed\"\n    },\n\n    {\n      \"name\": \"BRAIN_SUBSTANTIA_NIGRA_Quiescent.bed.gz\",\n      \"position\": [\n        23,\n        6\n      ],\n      \"type\": \"bed\"\n    },\n\n    {\n      \"name\": \"BRAIN_SUBSTANTIA_NIGRA_Transcribed.bed.gz\",\n      \"position\": [\n        23,\n        8\n      ],\n      \"type\": \"bed\"\n    },\n\n    {\n      \"name\": \"BREAST_MYOEPITHELIAL_CELLS_Bivalent.bed.gz\",\n      \"position\": [\n        24,\n        0\n      ],\n      \"type\": \"bed\"\n    },\n\n    {\n      \"name\": \"BREAST_MYOEPITHELIAL_CELLS_ConstitutiveHet.bed.gz\",\n      \"position\": [\n        24,\n        1\n      ],\n      \"type\": \"bed\"\n    },\n\n    {\n      \"name\": \"BREAST_MYOEPITHELIAL_CELLS_Enhancer.bed.gz\",\n      \"position\": [\n        24,\n        2\n      ],\n      \"type\": \"bed\"\n    },\n\n    {\n      \"name\": \"BREAST_MYOEPITHELIAL_CELLS_FacultativeHet.bed.gz\",\n      \"position\": [\n        24,\n        3\n      ],\n      \"type\": \"bed\"\n    },\n\n    {\n      \"name\": \"BREAST_MYOEPITHELIAL_CELLS_Quiescent.bed.gz\",\n      \"position\": [\n        24,\n        6\n      ],\n      \"type\": \"bed\"\n    },\n\n    {\n      \"name\": \"BREAST_MYOEPITHELIAL_CELLS_RegPermissive.bed.gz\",\n      \"position\": [\n        24,\n        7\n      ],\n      \"type\": \"bed\"\n    },\n\n    {\n      \"name\": \"BREAST_MYOEPITHELIAL_CELLS_Transcribed.bed.gz\",\n      \"position\": [\n        24,\n        8\n      ],\n      \"type\": \"bed\"\n    },\n\n    {\n      \"name\": \"BREAST_VHMEC_ConstitutiveHet.bed.gz\",\n      \"position\": [\n        25,\n        1\n      ],\n      \"type\": \"bed\"\n    },\n\n    {\n      \"name\": \"BREAST_VHMEC_Enhancer.bed.gz\",\n      \"position\": [\n        25,\n        2\n      ],\n      \"type\": \"bed\"\n    },\n\n    {\n      \"name\": \"BREAST_VHMEC_FacultativeHet.bed.gz\",\n      \"position\": [\n        25,\n        3\n      ],\n      \"type\": \"bed\"\n    },\n\n    {\n      \"name\": \"BREAST_VHMEC_Quiescent.bed.gz\",\n      \"position\": [\n        25,\n        6\n      ],\n      \"type\": \"bed\"\n    },\n\n    {\n      \"name\": \"BREAST_VHMEC_RegPermissive.bed.gz\",\n      \"position\": [\n        25,\n        7\n      ],\n      \"type\": \"bed\"\n    },\n\n    {\n      \"name\": \"BREAST_VHMEC_Transcribed.bed.gz\",\n      \"position\": [\n        25,\n        8\n      ],\n      \"type\": \"bed\"\n    },\n\n    {\n      \"name\": \"CACO-2_FacultativeHet.bed.gz\",\n      \"position\": [\n        26,\n        3\n      ],\n      \"type\": \"bed\"\n    },\n\n    {\n      \"name\": \"CACO-2_LowConfidence.bed.gz\",\n      \"position\": [\n        26,\n        4\n      ],\n      \"type\": \"bed\"\n    },\n\n    {\n      \"name\": \"CACO-2_Promoter.bed.gz\",\n      \"position\": [\n        26,\n        5\n      ],\n      \"type\": \"bed\"\n    },\n\n    {\n      \"name\": \"CACO-2_Quiescent.bed.gz\",\n      \"position\": [\n        26,\n        6\n      ],\n      \"type\": \"bed\"\n    },\n\n    {\n      \"name\": \"CACO-2_RegPermissive.bed.gz\",\n      \"position\": [\n        26,\n        7\n      ],\n      \"type\": \"bed\"\n    },\n\n    {\n      \"name\": \"CACO-2_Transcribed.bed.gz\",\n      \"position\": [\n        26,\n        8\n      ],\n      \"type\": \"bed\"\n    },\n\n    {\n      \"name\": \"CD14_PRIMARY_CELLS_Bivalent.bed.gz\",\n      \"position\": [\n        27,\n        0\n      ],\n      \"type\": \"bed\"\n    },\n\n    {\n      \"name\": \"CD14_PRIMARY_CELLS_ConstitutiveHet.bed.gz\",\n      \"position\": [\n        27,\n        1\n      ],\n      \"type\": \"bed\"\n    },\n\n    {\n      \"name\": \"CD14_PRIMARY_CELLS_Enhancer.bed.gz\",\n      \"position\": [\n        27,\n        2\n      ],\n      \"type\": \"bed\"\n    },\n\n    {\n      \"name\": \"CD14_PRIMARY_CELLS_FacultativeHet.bed.gz\",\n      \"position\": [\n        27,\n        3\n      ],\n      \"type\": \"bed\"\n    },\n\n    {\n      \"name\": \"CD14_PRIMARY_CELLS_Promoter.bed.gz\",\n      \"position\": [\n        27,\n        5\n      ],\n      \"type\": \"bed\"\n    },\n\n    {\n      \"name\": \"CD14_PRIMARY_CELLS_Quiescent.bed.gz\",\n      \"position\": [\n        27,\n        6\n      ],\n      \"type\": \"bed\"\n    },\n\n    {\n      \"name\": \"CD14_PRIMARY_CELLS_RegPermissive.bed.gz\",\n      \"position\": [\n        27,\n        7\n      ],\n      \"type\": \"bed\"\n    },\n\n    {\n      \"name\": \"CD14_PRIMARY_CELLS_Transcribed.bed.gz\",\n      \"position\": [\n        27,\n        8\n      ],\n      \"type\": \"bed\"\n    },\n\n    {\n      \"name\": \"CD19_PRIMARY_CELLS_PERIPHERAL_UW_Bivalent.bed.gz\",\n      \"position\": [\n        28,\n        0\n      ],\n      \"type\": \"bed\"\n    },\n\n    {\n      \"name\": \"CD19_PRIMARY_CELLS_PERIPHERAL_UW_ConstitutiveHet.bed.gz\",\n      \"position\": [\n        28,\n        1\n      ],\n      \"type\": \"bed\"\n    },\n\n    {\n      \"name\": \"CD19_PRIMARY_CELLS_PERIPHERAL_UW_FacultativeHet.bed.gz\",\n      \"position\": [\n        28,\n        3\n      ],\n      \"type\": \"bed\"\n    },\n\n    {\n      \"name\": \"CD19_PRIMARY_CELLS_PERIPHERAL_UW_LowConfidence.bed.gz\",\n      \"position\": [\n        28,\n        4\n      ],\n      \"type\": \"bed\"\n    },\n\n    {\n      \"name\": \"CD19_PRIMARY_CELLS_PERIPHERAL_UW_Promoter.bed.gz\",\n      \"position\": [\n        28,\n        5\n      ],\n      \"type\": \"bed\"\n    },\n\n    {\n      \"name\": \"CD19_PRIMARY_CELLS_PERIPHERAL_UW_Quiescent.bed.gz\",\n      \"position\": [\n        28,\n        6\n      ],\n      \"type\": \"bed\"\n    },\n\n    {\n      \"name\": \"CD19_PRIMARY_CELLS_PERIPHERAL_UW_RegPermissive.bed.gz\",\n      \"position\": [\n        28,\n        7\n      ],\n      \"type\": \"bed\"\n    },\n\n    {\n      \"name\": \"CD19_PRIMARY_CELLS_PERIPHERAL_UW_Transcribed.bed.gz\",\n      \"position\": [\n        28,\n        8\n      ],\n      \"type\": \"bed\"\n    },\n\n    {\n      \"name\": \"CD3_PRIMARY_CELLS_CORD_BI_Bivalent.bed.gz\",\n      \"position\": [\n        29,\n        0\n      ],\n      \"type\": \"bed\"\n    },\n\n    {\n      \"name\": \"CD3_PRIMARY_CELLS_CORD_BI_ConstitutiveHet.bed.gz\",\n      \"position\": [\n        29,\n        1\n      ],\n      \"type\": \"bed\"\n    },\n\n    {\n      \"name\": \"CD3_PRIMARY_CELLS_CORD_BI_Enhancer.bed.gz\",\n      \"position\": [\n        29,\n        2\n      ],\n      \"type\": \"bed\"\n    },\n\n    {\n      \"name\": \"CD3_PRIMARY_CELLS_CORD_BI_FacultativeHet.bed.gz\",\n      \"position\": [\n        29,\n        3\n      ],\n      \"type\": \"bed\"\n    },\n\n    {\n      \"name\": \"CD3_PRIMARY_CELLS_CORD_BI_LowConfidence.bed.gz\",\n      \"position\": [\n        29,\n        4\n      ],\n      \"type\": \"bed\"\n    },\n\n    {\n      \"name\": \"CD3_PRIMARY_CELLS_CORD_BI_Promoter.bed.gz\",\n      \"position\": [\n        29,\n        5\n      ],\n      \"type\": \"bed\"\n    },\n\n    {\n      \"name\": \"CD3_PRIMARY_CELLS_CORD_BI_Quiescent.bed.gz\",\n      \"position\": [\n        29,\n        6\n      ],\n      \"type\": \"bed\"\n    },\n\n    {\n      \"name\": \"CD3_PRIMARY_CELLS_CORD_BI_RegPermissive.bed.gz\",\n      \"position\": [\n        29,\n        7\n      ],\n      \"type\": \"bed\"\n    },\n\n    {\n      \"name\": \"CD3_PRIMARY_CELLS_CORD_BI_Transcribed.bed.gz\",\n      \"position\": [\n        29,\n        8\n      ],\n      \"type\": \"bed\"\n    },\n\n    {\n      \"name\": \"CD3_PRIMARY_CELLS_PERIPHERAL_UW_Bivalent.bed.gz\",\n      \"position\": [\n        30,\n        0\n      ],\n      \"type\": \"bed\"\n    },\n\n    {\n      \"name\": \"CD3_PRIMARY_CELLS_PERIPHERAL_UW_ConstitutiveHet.bed.gz\",\n      \"position\": [\n        30,\n        1\n      ],\n      \"type\": \"bed\"\n    },\n\n    {\n      \"name\": \"CD3_PRIMARY_CELLS_PERIPHERAL_UW_FacultativeHet.bed.gz\",\n      \"position\": [\n        30,\n        3\n      ],\n      \"type\": \"bed\"\n    },\n\n    {\n      \"name\": \"CD3_PRIMARY_CELLS_PERIPHERAL_UW_Promoter.bed.gz\",\n      \"position\": [\n        30,\n        5\n      ],\n      \"type\": \"bed\"\n    },\n\n    {\n      \"name\": \"CD3_PRIMARY_CELLS_PERIPHERAL_UW_Quiescent.bed.gz\",\n      \"position\": [\n        30,\n        6\n      ],\n      \"type\": \"bed\"\n    },\n\n    {\n      \"name\": \"CD3_PRIMARY_CELLS_PERIPHERAL_UW_RegPermissive.bed.gz\",\n      \"position\": [\n        30,\n        7\n      ],\n      \"type\": \"bed\"\n    },\n\n    {\n      \"name\": \"CD3_PRIMARY_CELLS_PERIPHERAL_UW_Transcribed.bed.gz\",\n      \"position\": [\n        30,\n        8\n      ],\n      \"type\": \"bed\"\n    },\n\n    {\n      \"name\": \"CD4+_CD25+_CD127-_TREG_PRIMARY_CELLS_Bivalent.bed.gz\",\n      \"position\": [\n        31,\n        0\n      ],\n      \"type\": \"bed\"\n    },\n\n    {\n      \"name\": \"CD4+_CD25+_CD127-_TREG_PRIMARY_CELLS_ConstitutiveHet.bed.gz\",\n      \"position\": [\n        31,\n        1\n      ],\n      \"type\": \"bed\"\n    },\n\n    {\n      \"name\": \"CD4+_CD25+_CD127-_TREG_PRIMARY_CELLS_Enhancer.bed.gz\",\n      \"position\": [\n        31,\n        2\n      ],\n      \"type\": \"bed\"\n    },\n\n    {\n      \"name\": \"CD4+_CD25+_CD127-_TREG_PRIMARY_CELLS_FacultativeHet.bed.gz\",\n      \"position\": [\n        31,\n        3\n      ],\n      \"type\": \"bed\"\n    },\n\n    {\n      \"name\": \"CD4+_CD25+_CD127-_TREG_PRIMARY_CELLS_Quiescent.bed.gz\",\n      \"position\": [\n        31,\n        6\n      ],\n      \"type\": \"bed\"\n    },\n\n    {\n      \"name\": \"CD4+_CD25+_CD127-_TREG_PRIMARY_CELLS_Transcribed.bed.gz\",\n      \"position\": [\n        31,\n        8\n      ],\n      \"type\": \"bed\"\n    },\n\n    {\n      \"name\": \"CD4+_CD25-_CD45RA+_NAIVE_PRIMARY_CELLS_Bivalent.bed.gz\",\n      \"position\": [\n        32,\n        0\n      ],\n      \"type\": \"bed\"\n    },\n\n    {\n      \"name\": \"CD4+_CD25-_CD45RA+_NAIVE_PRIMARY_CELLS_ConstitutiveHet.bed.gz\",\n      \"position\": [\n        32,\n        1\n      ],\n      \"type\": \"bed\"\n    },\n\n    {\n      \"name\": \"CD4+_CD25-_CD45RA+_NAIVE_PRIMARY_CELLS_Enhancer.bed.gz\",\n      \"position\": [\n        32,\n        2\n      ],\n      \"type\": \"bed\"\n    },\n\n    {\n      \"name\": \"CD4+_CD25-_CD45RA+_NAIVE_PRIMARY_CELLS_FacultativeHet.bed.gz\",\n      \"position\": [\n        32,\n        3\n      ],\n      \"type\": \"bed\"\n    },\n\n    {\n      \"name\": \"CD4+_CD25-_CD45RA+_NAIVE_PRIMARY_CELLS_Quiescent.bed.gz\",\n      \"position\": [\n        32,\n        6\n      ],\n      \"type\": \"bed\"\n    },\n\n    {\n      \"name\": \"CD4+_CD25-_CD45RA+_NAIVE_PRIMARY_CELLS_RegPermissive.bed.gz\",\n      \"position\": [\n        32,\n        7\n      ],\n      \"type\": \"bed\"\n    },\n\n    {\n      \"name\": \"CD4+_CD25-_CD45RA+_NAIVE_PRIMARY_CELLS_Transcribed.bed.gz\",\n      \"position\": [\n        32,\n        8\n      ],\n      \"type\": \"bed\"\n    },\n\n    {\n      \"name\": \"CD4+_CD25-_CD45RO+_MEMORY_PRIMARY_CELLS_ConstitutiveHet.bed.gz\",\n      \"position\": [\n        33,\n        1\n      ],\n      \"type\": \"bed\"\n    },\n\n    {\n      \"name\": \"CD4+_CD25-_CD45RO+_MEMORY_PRIMARY_CELLS_Enhancer.bed.gz\",\n      \"position\": [\n        33,\n        2\n      ],\n      \"type\": \"bed\"\n    },\n\n    {\n      \"name\": \"CD4+_CD25-_CD45RO+_MEMORY_PRIMARY_CELLS_FacultativeHet.bed.gz\",\n      \"position\": [\n        33,\n        3\n      ],\n      \"type\": \"bed\"\n    },\n\n    {\n      \"name\": \"CD4+_CD25-_CD45RO+_MEMORY_PRIMARY_CELLS_Promoter.bed.gz\",\n      \"position\": [\n        33,\n        5\n      ],\n      \"type\": \"bed\"\n    },\n\n    {\n      \"name\": \"CD4+_CD25-_CD45RO+_MEMORY_PRIMARY_CELLS_Quiescent.bed.gz\",\n      \"position\": [\n        33,\n        6\n      ],\n      \"type\": \"bed\"\n    },\n\n    {\n      \"name\": \"CD4+_CD25-_CD45RO+_MEMORY_PRIMARY_CELLS_RegPermissive.bed.gz\",\n      \"position\": [\n        33,\n        7\n      ],\n      \"type\": \"bed\"\n    },\n\n    {\n      \"name\": \"CD4+_CD25-_CD45RO+_MEMORY_PRIMARY_CELLS_Transcribed.bed.gz\",\n      \"position\": [\n        33,\n        8\n      ],\n      \"type\": \"bed\"\n    },\n\n    {\n      \"name\": \"CD4+_CD25-_IL17+_PMA-IONOMCYIN_STIMULATED_TH17_PRIMARY_CELLS_ConstitutiveHet.bed.gz\",\n      \"position\": [\n        34,\n        1\n      ],\n      \"type\": \"bed\"\n    },\n\n    {\n      \"name\": \"CD4+_CD25-_IL17+_PMA-IONOMCYIN_STIMULATED_TH17_PRIMARY_CELLS_Enhancer.bed.gz\",\n      \"position\": [\n        34,\n        2\n      ],\n      \"type\": \"bed\"\n    },\n\n    {\n      \"name\": \"CD4+_CD25-_IL17+_PMA-IONOMCYIN_STIMULATED_TH17_PRIMARY_CELLS_FacultativeHet.bed.gz\",\n      \"position\": [\n        34,\n        3\n      ],\n      \"type\": \"bed\"\n    },\n\n    {\n      \"name\": \"CD4+_CD25-_IL17+_PMA-IONOMCYIN_STIMULATED_TH17_PRIMARY_CELLS_Quiescent.bed.gz\",\n      \"position\": [\n        34,\n        6\n      ],\n      \"type\": \"bed\"\n    },\n\n    {\n      \"name\": \"CD4+_CD25-_IL17+_PMA-IONOMCYIN_STIMULATED_TH17_PRIMARY_CELLS_RegPermissive.bed.gz\",\n      \"position\": [\n        34,\n        7\n      ],\n      \"type\": \"bed\"\n    },\n\n    {\n      \"name\": \"CD4+_CD25-_IL17+_PMA-IONOMCYIN_STIMULATED_TH17_PRIMARY_CELLS_Transcribed.bed.gz\",\n      \"position\": [\n        34,\n        8\n      ],\n      \"type\": \"bed\"\n    },\n\n    {\n      \"name\": \"CD4+_CD25-_IL17-_PMA-IONOMYCIN_STIMULATED_MACS_PURIFIED_TH_PRIMARY_CELLS_ConstitutiveHet.bed.gz\",\n      \"position\": [\n        35,\n        1\n      ],\n      \"type\": \"bed\"\n    },\n\n    {\n      \"name\": \"CD4+_CD25-_IL17-_PMA-IONOMYCIN_STIMULATED_MACS_PURIFIED_TH_PRIMARY_CELLS_Enhancer.bed.gz\",\n      \"position\": [\n        35,\n        2\n      ],\n      \"type\": \"bed\"\n    },\n\n    {\n      \"name\": \"CD4+_CD25-_IL17-_PMA-IONOMYCIN_STIMULATED_MACS_PURIFIED_TH_PRIMARY_CELLS_FacultativeHet.bed.gz\",\n      \"position\": [\n        35,\n        3\n      ],\n      \"type\": \"bed\"\n    },\n\n    {\n      \"name\": \"CD4+_CD25-_IL17-_PMA-IONOMYCIN_STIMULATED_MACS_PURIFIED_TH_PRIMARY_CELLS_Quiescent.bed.gz\",\n      \"position\": [\n        35,\n        6\n      ],\n      \"type\": \"bed\"\n    },\n\n    {\n      \"name\": \"CD4+_CD25-_IL17-_PMA-IONOMYCIN_STIMULATED_MACS_PURIFIED_TH_PRIMARY_CELLS_RegPermissive.bed.gz\",\n      \"position\": [\n        35,\n        7\n      ],\n      \"type\": \"bed\"\n    },\n\n    {\n      \"name\": \"CD4+_CD25-_IL17-_PMA-IONOMYCIN_STIMULATED_MACS_PURIFIED_TH_PRIMARY_CELLS_Transcribed.bed.gz\",\n      \"position\": [\n        35,\n        8\n      ],\n      \"type\": \"bed\"\n    },\n\n    {\n      \"name\": \"CD4+_CD25INT_CD127+_TMEM_PRIMARY_CELLS_ConstitutiveHet.bed.gz\",\n      \"position\": [\n        36,\n        1\n      ],\n      \"type\": \"bed\"\n    },\n\n    {\n      \"name\": \"CD4+_CD25INT_CD127+_TMEM_PRIMARY_CELLS_Enhancer.bed.gz\",\n      \"position\": [\n        36,\n        2\n      ],\n      \"type\": \"bed\"\n    },\n\n    {\n      \"name\": \"CD4+_CD25INT_CD127+_TMEM_PRIMARY_CELLS_FacultativeHet.bed.gz\",\n      \"position\": [\n        36,\n        3\n      ],\n      \"type\": \"bed\"\n    },\n\n    {\n      \"name\": \"CD4+_CD25INT_CD127+_TMEM_PRIMARY_CELLS_LowConfidence.bed.gz\",\n      \"position\": [\n        36,\n        4\n      ],\n      \"type\": \"bed\"\n    },\n\n    {\n      \"name\": \"CD4+_CD25INT_CD127+_TMEM_PRIMARY_CELLS_Quiescent.bed.gz\",\n      \"position\": [\n        36,\n        6\n      ],\n      \"type\": \"bed\"\n    },\n\n    {\n      \"name\": \"CD4+_CD25INT_CD127+_TMEM_PRIMARY_CELLS_RegPermissive.bed.gz\",\n      \"position\": [\n        36,\n        7\n      ],\n      \"type\": \"bed\"\n    },\n\n    {\n      \"name\": \"CD4+_CD25INT_CD127+_TMEM_PRIMARY_CELLS_Transcribed.bed.gz\",\n      \"position\": [\n        36,\n        8\n      ],\n      \"type\": \"bed\"\n    },\n\n    {\n      \"name\": \"CD4+_CD25-_TH_PRIMARY_CELLS_Bivalent.bed.gz\",\n      \"position\": [\n        37,\n        0\n      ],\n      \"type\": \"bed\"\n    },\n\n    {\n      \"name\": \"CD4+_CD25-_TH_PRIMARY_CELLS_ConstitutiveHet.bed.gz\",\n      \"position\": [\n        37,\n        1\n      ],\n      \"type\": \"bed\"\n    },\n\n    {\n      \"name\": \"CD4+_CD25-_TH_PRIMARY_CELLS_Enhancer.bed.gz\",\n      \"position\": [\n        37,\n        2\n      ],\n      \"type\": \"bed\"\n    },\n\n    {\n      \"name\": \"CD4+_CD25-_TH_PRIMARY_CELLS_FacultativeHet.bed.gz\",\n      \"position\": [\n        37,\n        3\n      ],\n      \"type\": \"bed\"\n    },\n\n    {\n      \"name\": \"CD4+_CD25-_TH_PRIMARY_CELLS_Promoter.bed.gz\",\n      \"position\": [\n        37,\n        5\n      ],\n      \"type\": \"bed\"\n    },\n\n    {\n      \"name\": \"CD4+_CD25-_TH_PRIMARY_CELLS_Quiescent.bed.gz\",\n      \"position\": [\n        37,\n        6\n      ],\n      \"type\": \"bed\"\n    },\n\n    {\n      \"name\": \"CD4+_CD25-_TH_PRIMARY_CELLS_RegPermissive.bed.gz\",\n      \"position\": [\n        37,\n        7\n      ],\n      \"type\": \"bed\"\n    },\n\n    {\n      \"name\": \"CD4+_CD25-_TH_PRIMARY_CELLS_Transcribed.bed.gz\",\n      \"position\": [\n        37,\n        8\n      ],\n      \"type\": \"bed\"\n    },\n\n    {\n      \"name\": \"CD4_MEMORY_PRIMARY_CELLS_ConstitutiveHet.bed.gz\",\n      \"position\": [\n        38,\n        1\n      ],\n      \"type\": \"bed\"\n    },\n\n    {\n      \"name\": \"CD4_MEMORY_PRIMARY_CELLS_Enhancer.bed.gz\",\n      \"position\": [\n        38,\n        2\n      ],\n      \"type\": \"bed\"\n    },\n\n    {\n      \"name\": \"CD4_MEMORY_PRIMARY_CELLS_FacultativeHet.bed.gz\",\n      \"position\": [\n        38,\n        3\n      ],\n      \"type\": \"bed\"\n    },\n\n    {\n      \"name\": \"CD4_MEMORY_PRIMARY_CELLS_Quiescent.bed.gz\",\n      \"position\": [\n        38,\n        6\n      ],\n      \"type\": \"bed\"\n    },\n\n    {\n      \"name\": \"CD4_MEMORY_PRIMARY_CELLS_Transcribed.bed.gz\",\n      \"position\": [\n        38,\n        8\n      ],\n      \"type\": \"bed\"\n    },\n\n    {\n      \"name\": \"CD4_NAIVE_PRIMARY_CELLS_ConstitutiveHet.bed.gz\",\n      \"position\": [\n        39,\n        1\n      ],\n      \"type\": \"bed\"\n    },\n\n    {\n      \"name\": \"CD4_NAIVE_PRIMARY_CELLS_Enhancer.bed.gz\",\n      \"position\": [\n        39,\n        2\n      ],\n      \"type\": \"bed\"\n    },\n\n    {\n      \"name\": \"CD4_NAIVE_PRIMARY_CELLS_FacultativeHet.bed.gz\",\n      \"position\": [\n        39,\n        3\n      ],\n      \"type\": \"bed\"\n    },\n\n    {\n      \"name\": \"CD4_NAIVE_PRIMARY_CELLS_Quiescent.bed.gz\",\n      \"position\": [\n        39,\n        6\n      ],\n      \"type\": \"bed\"\n    },\n\n    {\n      \"name\": \"CD4_NAIVE_PRIMARY_CELLS_RegPermissive.bed.gz\",\n      \"position\": [\n        39,\n        7\n      ],\n      \"type\": \"bed\"\n    },\n\n    {\n      \"name\": \"CD4_NAIVE_PRIMARY_CELLS_Transcribed.bed.gz\",\n      \"position\": [\n        39,\n        8\n      ],\n      \"type\": \"bed\"\n    },\n\n    {\n      \"name\": \"CD56_PRIMARY_CELLS_Bivalent.bed.gz\",\n      \"position\": [\n        40,\n        0\n      ],\n      \"type\": \"bed\"\n    },\n\n    {\n      \"name\": \"CD56_PRIMARY_CELLS_ConstitutiveHet.bed.gz\",\n      \"position\": [\n        40,\n        1\n      ],\n      \"type\": \"bed\"\n    },\n\n    {\n      \"name\": \"CD56_PRIMARY_CELLS_FacultativeHet.bed.gz\",\n      \"position\": [\n        40,\n        3\n      ],\n      \"type\": \"bed\"\n    },\n\n    {\n      \"name\": \"CD56_PRIMARY_CELLS_LowConfidence.bed.gz\",\n      \"position\": [\n        40,\n        4\n      ],\n      \"type\": \"bed\"\n    },\n\n    {\n      \"name\": \"CD56_PRIMARY_CELLS_Promoter.bed.gz\",\n      \"position\": [\n        40,\n        5\n      ],\n      \"type\": \"bed\"\n    },\n\n    {\n      \"name\": \"CD56_PRIMARY_CELLS_Quiescent.bed.gz\",\n      \"position\": [\n        40,\n        6\n      ],\n      \"type\": \"bed\"\n    },\n\n    {\n      \"name\": \"CD56_PRIMARY_CELLS_RegPermissive.bed.gz\",\n      \"position\": [\n        40,\n        7\n      ],\n      \"type\": \"bed\"\n    },\n\n    {\n      \"name\": \"CD56_PRIMARY_CELLS_Transcribed.bed.gz\",\n      \"position\": [\n        40,\n        8\n      ],\n      \"type\": \"bed\"\n    },\n\n    {\n      \"name\": \"CD8_MEMORY_PRIMARY_CELLS_ConstitutiveHet.bed.gz\",\n      \"position\": [\n        41,\n        1\n      ],\n      \"type\": \"bed\"\n    },\n\n    {\n      \"name\": \"CD8_MEMORY_PRIMARY_CELLS_Enhancer.bed.gz\",\n      \"position\": [\n        41,\n        2\n      ],\n      \"type\": \"bed\"\n    },\n\n    {\n      \"name\": \"CD8_MEMORY_PRIMARY_CELLS_FacultativeHet.bed.gz\",\n      \"position\": [\n        41,\n        3\n      ],\n      \"type\": \"bed\"\n    },\n\n    {\n      \"name\": \"CD8_MEMORY_PRIMARY_CELLS_Quiescent.bed.gz\",\n      \"position\": [\n        41,\n        6\n      ],\n      \"type\": \"bed\"\n    },\n\n    {\n      \"name\": \"CD8_MEMORY_PRIMARY_CELLS_RegPermissive.bed.gz\",\n      \"position\": [\n        41,\n        7\n      ],\n      \"type\": \"bed\"\n    },\n\n    {\n      \"name\": \"CD8_MEMORY_PRIMARY_CELLS_Transcribed.bed.gz\",\n      \"position\": [\n        41,\n        8\n      ],\n      \"type\": \"bed\"\n    },\n\n    {\n      \"name\": \"CD8_NAIVE_PRIMARY_CELLS_ConstitutiveHet.bed.gz\",\n      \"position\": [\n        42,\n        1\n      ],\n      \"type\": \"bed\"\n    },\n\n    {\n      \"name\": \"CD8_NAIVE_PRIMARY_CELLS_Enhancer.bed.gz\",\n      \"position\": [\n        42,\n        2\n      ],\n      \"type\": \"bed\"\n    },\n\n    {\n      \"name\": \"CD8_NAIVE_PRIMARY_CELLS_FacultativeHet.bed.gz\",\n      \"position\": [\n        42,\n        3\n      ],\n      \"type\": \"bed\"\n    },\n\n    {\n      \"name\": \"CD8_NAIVE_PRIMARY_CELLS_Quiescent.bed.gz\",\n      \"position\": [\n        42,\n        6\n      ],\n      \"type\": \"bed\"\n    },\n\n    {\n      \"name\": \"CD8_NAIVE_PRIMARY_CELLS_RegPermissive.bed.gz\",\n      \"position\": [\n        42,\n        7\n      ],\n      \"type\": \"bed\"\n    },\n\n    {\n      \"name\": \"CD8_NAIVE_PRIMARY_CELLS_Transcribed.bed.gz\",\n      \"position\": [\n        42,\n        8\n      ],\n      \"type\": \"bed\"\n    },\n\n    {\n      \"name\": \"CHONDROCYTES_FROM_BONE_MARROW_DERIVED_MESENCHYMAL_STEM_CELL_CULTURED_CELLS_Bivalent.bed.gz\",\n      \"position\": [\n        43,\n        0\n      ],\n      \"type\": \"bed\"\n    },\n\n    {\n      \"name\": \"CHONDROCYTES_FROM_BONE_MARROW_DERIVED_MESENCHYMAL_STEM_CELL_CULTURED_CELLS_Enhancer.bed.gz\",\n      \"position\": [\n        43,\n        2\n      ],\n      \"type\": \"bed\"\n    },\n\n    {\n      \"name\": \"CHONDROCYTES_FROM_BONE_MARROW_DERIVED_MESENCHYMAL_STEM_CELL_CULTURED_CELLS_FacultativeHet.bed.gz\",\n      \"position\": [\n        43,\n        3\n      ],\n      \"type\": \"bed\"\n    },\n\n    {\n      \"name\": \"CHONDROCYTES_FROM_BONE_MARROW_DERIVED_MESENCHYMAL_STEM_CELL_CULTURED_CELLS_Promoter.bed.gz\",\n      \"position\": [\n        43,\n        5\n      ],\n      \"type\": \"bed\"\n    },\n\n    {\n      \"name\": \"CHONDROCYTES_FROM_BONE_MARROW_DERIVED_MESENCHYMAL_STEM_CELL_CULTURED_CELLS_Quiescent.bed.gz\",\n      \"position\": [\n        43,\n        6\n      ],\n      \"type\": \"bed\"\n    },\n\n    {\n      \"name\": \"CHONDROCYTES_FROM_BONE_MARROW_DERIVED_MESENCHYMAL_STEM_CELL_CULTURED_CELLS_RegPermissive.bed.gz\",\n      \"position\": [\n        43,\n        7\n      ],\n      \"type\": \"bed\"\n    },\n\n    {\n      \"name\": \"CHONDROCYTES_FROM_BONE_MARROW_DERIVED_MESENCHYMAL_STEM_CELL_CULTURED_CELLS_Transcribed.bed.gz\",\n      \"position\": [\n        43,\n        8\n      ],\n      \"type\": \"bed\"\n    },\n\n    {\n      \"name\": \"COLONIC_MUCOSA_Bivalent.bed.gz\",\n      \"position\": [\n        44,\n        0\n      ],\n      \"type\": \"bed\"\n    },\n\n    {\n      \"name\": \"COLONIC_MUCOSA_ConstitutiveHet.bed.gz\",\n      \"position\": [\n        44,\n        1\n      ],\n      \"type\": \"bed\"\n    },\n\n    {\n      \"name\": \"COLONIC_MUCOSA_Enhancer.bed.gz\",\n      \"position\": [\n        44,\n        2\n      ],\n      \"type\": \"bed\"\n    },\n\n    {\n      \"name\": \"COLONIC_MUCOSA_LowConfidence.bed.gz\",\n      \"position\": [\n        44,\n        4\n      ],\n      \"type\": \"bed\"\n    },\n\n    {\n      \"name\": \"COLONIC_MUCOSA_Promoter.bed.gz\",\n      \"position\": [\n        44,\n        5\n      ],\n      \"type\": \"bed\"\n    },\n\n    {\n      \"name\": \"COLONIC_MUCOSA_Quiescent.bed.gz\",\n      \"position\": [\n        44,\n        6\n      ],\n      \"type\": \"bed\"\n    },\n\n    {\n      \"name\": \"COLONIC_MUCOSA_Transcribed.bed.gz\",\n      \"position\": [\n        44,\n        8\n      ],\n      \"type\": \"bed\"\n    },\n\n    {\n      \"name\": \"COLON_SMOOTH_MUSCLE_ConstitutiveHet.bed.gz\",\n      \"position\": [\n        45,\n        1\n      ],\n      \"type\": \"bed\"\n    },\n\n    {\n      \"name\": \"COLON_SMOOTH_MUSCLE_FacultativeHet.bed.gz\",\n      \"position\": [\n        45,\n        3\n      ],\n      \"type\": \"bed\"\n    },\n\n    {\n      \"name\": \"COLON_SMOOTH_MUSCLE_Promoter.bed.gz\",\n      \"position\": [\n        45,\n        5\n      ],\n      \"type\": \"bed\"\n    },\n\n    {\n      \"name\": \"COLON_SMOOTH_MUSCLE_Quiescent.bed.gz\",\n      \"position\": [\n        45,\n        6\n      ],\n      \"type\": \"bed\"\n    },\n\n    {\n      \"name\": \"COLON_SMOOTH_MUSCLE_RegPermissive.bed.gz\",\n      \"position\": [\n        45,\n        7\n      ],\n      \"type\": \"bed\"\n    },\n\n    {\n      \"name\": \"COLON_SMOOTH_MUSCLE_Transcribed.bed.gz\",\n      \"position\": [\n        45,\n        8\n      ],\n      \"type\": \"bed\"\n    },\n\n    {\n      \"name\": \"DND41_ConstitutiveHet.bed.gz\",\n      \"position\": [\n        46,\n        1\n      ],\n      \"type\": \"bed\"\n    },\n\n    {\n      \"name\": \"DND41_Enhancer.bed.gz\",\n      \"position\": [\n        46,\n        2\n      ],\n      \"type\": \"bed\"\n    },\n\n    {\n      \"name\": \"DND41_FacultativeHet.bed.gz\",\n      \"position\": [\n        46,\n        3\n      ],\n      \"type\": \"bed\"\n    },\n\n    {\n      \"name\": \"DND41_LowConfidence.bed.gz\",\n      \"position\": [\n        46,\n        4\n      ],\n      \"type\": \"bed\"\n    },\n\n    {\n      \"name\": \"DND41_Promoter.bed.gz\",\n      \"position\": [\n        46,\n        5\n      ],\n      \"type\": \"bed\"\n    },\n\n    {\n      \"name\": \"DND41_Quiescent.bed.gz\",\n      \"position\": [\n        46,\n        6\n      ],\n      \"type\": \"bed\"\n    },\n\n    {\n      \"name\": \"DND41_RegPermissive.bed.gz\",\n      \"position\": [\n        46,\n        7\n      ],\n      \"type\": \"bed\"\n    },\n\n    {\n      \"name\": \"DND41_Transcribed.bed.gz\",\n      \"position\": [\n        46,\n        8\n      ],\n      \"type\": \"bed\"\n    },\n\n    {\n      \"name\": \"DUODENUM_MUCOSA_ConstitutiveHet.bed.gz\",\n      \"position\": [\n        47,\n        1\n      ],\n      \"type\": \"bed\"\n    },\n\n    {\n      \"name\": \"DUODENUM_MUCOSA_Enhancer.bed.gz\",\n      \"position\": [\n        47,\n        2\n      ],\n      \"type\": \"bed\"\n    },\n\n    {\n      \"name\": \"DUODENUM_MUCOSA_FacultativeHet.bed.gz\",\n      \"position\": [\n        47,\n        3\n      ],\n      \"type\": \"bed\"\n    },\n\n    {\n      \"name\": \"DUODENUM_MUCOSA_Quiescent.bed.gz\",\n      \"position\": [\n        47,\n        6\n      ],\n      \"type\": \"bed\"\n    },\n\n    {\n      \"name\": \"DUODENUM_MUCOSA_Transcribed.bed.gz\",\n      \"position\": [\n        47,\n        8\n      ],\n      \"type\": \"bed\"\n    },\n\n    {\n      \"name\": \"DUODENUM_SMOOTH_MUSCLE_Bivalent.bed.gz\",\n      \"position\": [\n        48,\n        0\n      ],\n      \"type\": \"bed\"\n    },\n\n    {\n      \"name\": \"DUODENUM_SMOOTH_MUSCLE_ConstitutiveHet.bed.gz\",\n      \"position\": [\n        48,\n        1\n      ],\n      \"type\": \"bed\"\n    },\n\n    {\n      \"name\": \"DUODENUM_SMOOTH_MUSCLE_Enhancer.bed.gz\",\n      \"position\": [\n        48,\n        2\n      ],\n      \"type\": \"bed\"\n    },\n\n    {\n      \"name\": \"DUODENUM_SMOOTH_MUSCLE_FacultativeHet.bed.gz\",\n      \"position\": [\n        48,\n        3\n      ],\n      \"type\": \"bed\"\n    },\n\n    {\n      \"name\": \"DUODENUM_SMOOTH_MUSCLE_Quiescent.bed.gz\",\n      \"position\": [\n        48,\n        6\n      ],\n      \"type\": \"bed\"\n    },\n\n    {\n      \"name\": \"DUODENUM_SMOOTH_MUSCLE_Transcribed.bed.gz\",\n      \"position\": [\n        48,\n        8\n      ],\n      \"type\": \"bed\"\n    },\n\n    {\n      \"name\": \"ECC-1_Promoter.bed.gz\",\n      \"position\": [\n        49,\n        5\n      ],\n      \"type\": \"bed\"\n    },\n\n    {\n      \"name\": \"ECC-1_Quiescent.bed.gz\",\n      \"position\": [\n        49,\n        6\n      ],\n      \"type\": \"bed\"\n    },\n\n    {\n      \"name\": \"ECC-1_RegPermissive.bed.gz\",\n      \"position\": [\n        49,\n        7\n      ],\n      \"type\": \"bed\"\n    },\n\n    {\n      \"name\": \"ECC-1_Transcribed.bed.gz\",\n      \"position\": [\n        49,\n        8\n      ],\n      \"type\": \"bed\"\n    },\n\n    {\n      \"name\": \"ES-I3_CELL_LINE_Bivalent.bed.gz\",\n      \"position\": [\n        50,\n        0\n      ],\n      \"type\": \"bed\"\n    },\n\n    {\n      \"name\": \"ES-I3_CELL_LINE_ConstitutiveHet.bed.gz\",\n      \"position\": [\n        50,\n        1\n      ],\n      \"type\": \"bed\"\n    },\n\n    {\n      \"name\": \"ES-I3_CELL_LINE_Enhancer.bed.gz\",\n      \"position\": [\n        50,\n        2\n      ],\n      \"type\": \"bed\"\n    },\n\n    {\n      \"name\": \"ES-I3_CELL_LINE_FacultativeHet.bed.gz\",\n      \"position\": [\n        50,\n        3\n      ],\n      \"type\": \"bed\"\n    },\n\n    {\n      \"name\": \"ES-I3_CELL_LINE_Quiescent.bed.gz\",\n      \"position\": [\n        50,\n        6\n      ],\n      \"type\": \"bed\"\n    },\n\n    {\n      \"name\": \"ES-I3_CELL_LINE_RegPermissive.bed.gz\",\n      \"position\": [\n        50,\n        7\n      ],\n      \"type\": \"bed\"\n    },\n\n    {\n      \"name\": \"ES-I3_CELL_LINE_Transcribed.bed.gz\",\n      \"position\": [\n        50,\n        8\n      ],\n      \"type\": \"bed\"\n    },\n\n    {\n      \"name\": \"ES-WA7_CELL_LINE_Bivalent.bed.gz\",\n      \"position\": [\n        51,\n        0\n      ],\n      \"type\": \"bed\"\n    },\n\n    {\n      \"name\": \"ES-WA7_CELL_LINE_ConstitutiveHet.bed.gz\",\n      \"position\": [\n        51,\n        1\n      ],\n      \"type\": \"bed\"\n    },\n\n    {\n      \"name\": \"ES-WA7_CELL_LINE_Enhancer.bed.gz\",\n      \"position\": [\n        51,\n        2\n      ],\n      \"type\": \"bed\"\n    },\n\n    {\n      \"name\": \"ES-WA7_CELL_LINE_FacultativeHet.bed.gz\",\n      \"position\": [\n        51,\n        3\n      ],\n      \"type\": \"bed\"\n    },\n\n    {\n      \"name\": \"ES-WA7_CELL_LINE_Quiescent.bed.gz\",\n      \"position\": [\n        51,\n        6\n      ],\n      \"type\": \"bed\"\n    },\n\n    {\n      \"name\": \"ES-WA7_CELL_LINE_Transcribed.bed.gz\",\n      \"position\": [\n        51,\n        8\n      ],\n      \"type\": \"bed\"\n    },\n\n    {\n      \"name\": \"FETAL_ADRENAL_GLAND_Bivalent.bed.gz\",\n      \"position\": [\n        52,\n        0\n      ],\n      \"type\": \"bed\"\n    },\n\n    {\n      \"name\": \"FETAL_ADRENAL_GLAND_ConstitutiveHet.bed.gz\",\n      \"position\": [\n        52,\n        1\n      ],\n      \"type\": \"bed\"\n    },\n\n    {\n      \"name\": \"FETAL_ADRENAL_GLAND_Enhancer.bed.gz\",\n      \"position\": [\n        52,\n        2\n      ],\n      \"type\": \"bed\"\n    },\n\n    {\n      \"name\": \"FETAL_ADRENAL_GLAND_FacultativeHet.bed.gz\",\n      \"position\": [\n        52,\n        3\n      ],\n      \"type\": \"bed\"\n    },\n\n    {\n      \"name\": \"FETAL_ADRENAL_GLAND_Promoter.bed.gz\",\n      \"position\": [\n        52,\n        5\n      ],\n      \"type\": \"bed\"\n    },\n\n    {\n      \"name\": \"FETAL_ADRENAL_GLAND_Quiescent.bed.gz\",\n      \"position\": [\n        52,\n        6\n      ],\n      \"type\": \"bed\"\n    },\n\n    {\n      \"name\": \"FETAL_ADRENAL_GLAND_RegPermissive.bed.gz\",\n      \"position\": [\n        52,\n        7\n      ],\n      \"type\": \"bed\"\n    },\n\n    {\n      \"name\": \"FETAL_ADRENAL_GLAND_Transcribed.bed.gz\",\n      \"position\": [\n        52,\n        8\n      ],\n      \"type\": \"bed\"\n    },\n\n    {\n      \"name\": \"FETAL_BRAIN_FEMALE_Bivalent.bed.gz\",\n      \"position\": [\n        53,\n        0\n      ],\n      \"type\": \"bed\"\n    },\n\n    {\n      \"name\": \"FETAL_BRAIN_FEMALE_ConstitutiveHet.bed.gz\",\n      \"position\": [\n        53,\n        1\n      ],\n      \"type\": \"bed\"\n    },\n\n    {\n      \"name\": \"FETAL_BRAIN_FEMALE_FacultativeHet.bed.gz\",\n      \"position\": [\n        53,\n        3\n      ],\n      \"type\": \"bed\"\n    },\n\n    {\n      \"name\": \"FETAL_BRAIN_FEMALE_LowConfidence.bed.gz\",\n      \"position\": [\n        53,\n        4\n      ],\n      \"type\": \"bed\"\n    },\n\n    {\n      \"name\": \"FETAL_BRAIN_FEMALE_Quiescent.bed.gz\",\n      \"position\": [\n        53,\n        6\n      ],\n      \"type\": \"bed\"\n    },\n\n    {\n      \"name\": \"FETAL_BRAIN_FEMALE_RegPermissive.bed.gz\",\n      \"position\": [\n        53,\n        7\n      ],\n      \"type\": \"bed\"\n    },\n\n    {\n      \"name\": \"FETAL_BRAIN_FEMALE_Transcribed.bed.gz\",\n      \"position\": [\n        53,\n        8\n      ],\n      \"type\": \"bed\"\n    },\n\n    {\n      \"name\": \"FETAL_BRAIN_MALE_ConstitutiveHet.bed.gz\",\n      \"position\": [\n        54,\n        1\n      ],\n      \"type\": \"bed\"\n    },\n\n    {\n      \"name\": \"FETAL_BRAIN_MALE_Enhancer.bed.gz\",\n      \"position\": [\n        54,\n        2\n      ],\n      \"type\": \"bed\"\n    },\n\n    {\n      \"name\": \"FETAL_BRAIN_MALE_FacultativeHet.bed.gz\",\n      \"position\": [\n        54,\n        3\n      ],\n      \"type\": \"bed\"\n    },\n\n    {\n      \"name\": \"FETAL_BRAIN_MALE_Promoter.bed.gz\",\n      \"position\": [\n        54,\n        5\n      ],\n      \"type\": \"bed\"\n    },\n\n    {\n      \"name\": \"FETAL_BRAIN_MALE_Quiescent.bed.gz\",\n      \"position\": [\n        54,\n        6\n      ],\n      \"type\": \"bed\"\n    },\n\n    {\n      \"name\": \"FETAL_BRAIN_MALE_RegPermissive.bed.gz\",\n      \"position\": [\n        54,\n        7\n      ],\n      \"type\": \"bed\"\n    },\n\n    {\n      \"name\": \"FETAL_BRAIN_MALE_Transcribed.bed.gz\",\n      \"position\": [\n        54,\n        8\n      ],\n      \"type\": \"bed\"\n    },\n\n    {\n      \"name\": \"FETAL_HEART_ConstitutiveHet.bed.gz\",\n      \"position\": [\n        55,\n        1\n      ],\n      \"type\": \"bed\"\n    },\n\n    {\n      \"name\": \"FETAL_HEART_Enhancer.bed.gz\",\n      \"position\": [\n        55,\n        2\n      ],\n      \"type\": \"bed\"\n    },\n\n    {\n      \"name\": \"FETAL_HEART_FacultativeHet.bed.gz\",\n      \"position\": [\n        55,\n        3\n      ],\n      \"type\": \"bed\"\n    },\n\n    {\n      \"name\": \"FETAL_HEART_LowConfidence.bed.gz\",\n      \"position\": [\n        55,\n        4\n      ],\n      \"type\": \"bed\"\n    },\n\n    {\n      \"name\": \"FETAL_HEART_Quiescent.bed.gz\",\n      \"position\": [\n        55,\n        6\n      ],\n      \"type\": \"bed\"\n    },\n\n    {\n      \"name\": \"FETAL_HEART_RegPermissive.bed.gz\",\n      \"position\": [\n        55,\n        7\n      ],\n      \"type\": \"bed\"\n    },\n\n    {\n      \"name\": \"FETAL_HEART_Transcribed.bed.gz\",\n      \"position\": [\n        55,\n        8\n      ],\n      \"type\": \"bed\"\n    },\n\n    {\n      \"name\": \"FETAL_INTESTINE_LARGE_Bivalent.bed.gz\",\n      \"position\": [\n        56,\n        0\n      ],\n      \"type\": \"bed\"\n    },\n\n    {\n      \"name\": \"FETAL_INTESTINE_LARGE_ConstitutiveHet.bed.gz\",\n      \"position\": [\n        56,\n        1\n      ],\n      \"type\": \"bed\"\n    },\n\n    {\n      \"name\": \"FETAL_INTESTINE_LARGE_Enhancer.bed.gz\",\n      \"position\": [\n        56,\n        2\n      ],\n      \"type\": \"bed\"\n    },\n\n    {\n      \"name\": \"FETAL_INTESTINE_LARGE_FacultativeHet.bed.gz\",\n      \"position\": [\n        56,\n        3\n      ],\n      \"type\": \"bed\"\n    },\n\n    {\n      \"name\": \"FETAL_INTESTINE_LARGE_Promoter.bed.gz\",\n      \"position\": [\n        56,\n        5\n      ],\n      \"type\": \"bed\"\n    },\n\n    {\n      \"name\": \"FETAL_INTESTINE_LARGE_Quiescent.bed.gz\",\n      \"position\": [\n        56,\n        6\n      ],\n      \"type\": \"bed\"\n    },\n\n    {\n      \"name\": \"FETAL_INTESTINE_LARGE_RegPermissive.bed.gz\",\n      \"position\": [\n        56,\n        7\n      ],\n      \"type\": \"bed\"\n    },\n\n    {\n      \"name\": \"FETAL_INTESTINE_LARGE_Transcribed.bed.gz\",\n      \"position\": [\n        56,\n        8\n      ],\n      \"type\": \"bed\"\n    },\n\n    {\n      \"name\": \"FETAL_INTESTINE_SMALL_Bivalent.bed.gz\",\n      \"position\": [\n        57,\n        0\n      ],\n      \"type\": \"bed\"\n    },\n\n    {\n      \"name\": \"FETAL_INTESTINE_SMALL_ConstitutiveHet.bed.gz\",\n      \"position\": [\n        57,\n        1\n      ],\n      \"type\": \"bed\"\n    },\n\n    {\n      \"name\": \"FETAL_INTESTINE_SMALL_Enhancer.bed.gz\",\n      \"position\": [\n        57,\n        2\n      ],\n      \"type\": \"bed\"\n    },\n\n    {\n      \"name\": \"FETAL_INTESTINE_SMALL_FacultativeHet.bed.gz\",\n      \"position\": [\n        57,\n        3\n      ],\n      \"type\": \"bed\"\n    },\n\n    {\n      \"name\": \"FETAL_INTESTINE_SMALL_Promoter.bed.gz\",\n      \"position\": [\n        57,\n        5\n      ],\n      \"type\": \"bed\"\n    },\n\n    {\n      \"name\": \"FETAL_INTESTINE_SMALL_Quiescent.bed.gz\",\n      \"position\": [\n        57,\n        6\n      ],\n      \"type\": \"bed\"\n    },\n\n    {\n      \"name\": \"FETAL_INTESTINE_SMALL_RegPermissive.bed.gz\",\n      \"position\": [\n        57,\n        7\n      ],\n      \"type\": \"bed\"\n    },\n\n    {\n      \"name\": \"FETAL_INTESTINE_SMALL_Transcribed.bed.gz\",\n      \"position\": [\n        57,\n        8\n      ],\n      \"type\": \"bed\"\n    },\n\n    {\n      \"name\": \"FETAL_KIDNEY_ConstitutiveHet.bed.gz\",\n      \"position\": [\n        58,\n        1\n      ],\n      \"type\": \"bed\"\n    },\n\n    {\n      \"name\": \"FETAL_KIDNEY_Enhancer.bed.gz\",\n      \"position\": [\n        58,\n        2\n      ],\n      \"type\": \"bed\"\n    },\n\n    {\n      \"name\": \"FETAL_KIDNEY_FacultativeHet.bed.gz\",\n      \"position\": [\n        58,\n        3\n      ],\n      \"type\": \"bed\"\n    },\n\n    {\n      \"name\": \"FETAL_KIDNEY_Promoter.bed.gz\",\n      \"position\": [\n        58,\n        5\n      ],\n      \"type\": \"bed\"\n    },\n\n    {\n      \"name\": \"FETAL_KIDNEY_Quiescent.bed.gz\",\n      \"position\": [\n        58,\n        6\n      ],\n      \"type\": \"bed\"\n    },\n\n    {\n      \"name\": \"FETAL_KIDNEY_RegPermissive.bed.gz\",\n      \"position\": [\n        58,\n        7\n      ],\n      \"type\": \"bed\"\n    },\n\n    {\n      \"name\": \"FETAL_KIDNEY_Transcribed.bed.gz\",\n      \"position\": [\n        58,\n        8\n      ],\n      \"type\": \"bed\"\n    },\n\n    {\n      \"name\": \"FETAL_LUNG_Bivalent.bed.gz\",\n      \"position\": [\n        59,\n        0\n      ],\n      \"type\": \"bed\"\n    },\n\n    {\n      \"name\": \"FETAL_LUNG_ConstitutiveHet.bed.gz\",\n      \"position\": [\n        59,\n        1\n      ],\n      \"type\": \"bed\"\n    },\n\n    {\n      \"name\": \"FETAL_LUNG_FacultativeHet.bed.gz\",\n      \"position\": [\n        59,\n        3\n      ],\n      \"type\": \"bed\"\n    },\n\n    {\n      \"name\": \"FETAL_LUNG_Promoter.bed.gz\",\n      \"position\": [\n        59,\n        5\n      ],\n      \"type\": \"bed\"\n    },\n\n    {\n      \"name\": \"FETAL_LUNG_Quiescent.bed.gz\",\n      \"position\": [\n        59,\n        6\n      ],\n      \"type\": \"bed\"\n    },\n\n    {\n      \"name\": \"FETAL_LUNG_RegPermissive.bed.gz\",\n      \"position\": [\n        59,\n        7\n      ],\n      \"type\": \"bed\"\n    },\n\n    {\n      \"name\": \"FETAL_LUNG_Transcribed.bed.gz\",\n      \"position\": [\n        59,\n        8\n      ],\n      \"type\": \"bed\"\n    },\n\n    {\n      \"name\": \"FETAL_MUSCLE_LEG_Bivalent.bed.gz\",\n      \"position\": [\n        60,\n        0\n      ],\n      \"type\": \"bed\"\n    },\n\n    {\n      \"name\": \"FETAL_MUSCLE_LEG_ConstitutiveHet.bed.gz\",\n      \"position\": [\n        60,\n        1\n      ],\n      \"type\": \"bed\"\n    },\n\n    {\n      \"name\": \"FETAL_MUSCLE_LEG_Enhancer.bed.gz\",\n      \"position\": [\n        60,\n        2\n      ],\n      \"type\": \"bed\"\n    },\n\n    {\n      \"name\": \"FETAL_MUSCLE_LEG_FacultativeHet.bed.gz\",\n      \"position\": [\n        60,\n        3\n      ],\n      \"type\": \"bed\"\n    },\n\n    {\n      \"name\": \"FETAL_MUSCLE_LEG_LowConfidence.bed.gz\",\n      \"position\": [\n        60,\n        4\n      ],\n      \"type\": \"bed\"\n    },\n\n    {\n      \"name\": \"FETAL_MUSCLE_LEG_Promoter.bed.gz\",\n      \"position\": [\n        60,\n        5\n      ],\n      \"type\": \"bed\"\n    },\n\n    {\n      \"name\": \"FETAL_MUSCLE_LEG_Quiescent.bed.gz\",\n      \"position\": [\n        60,\n        6\n      ],\n      \"type\": \"bed\"\n    },\n\n    {\n      \"name\": \"FETAL_MUSCLE_LEG_Transcribed.bed.gz\",\n      \"position\": [\n        60,\n        8\n      ],\n      \"type\": \"bed\"\n    },\n\n    {\n      \"name\": \"FETAL_MUSCLE_TRUNK_Bivalent.bed.gz\",\n      \"position\": [\n        61,\n        0\n      ],\n      \"type\": \"bed\"\n    },\n\n    {\n      \"name\": \"FETAL_MUSCLE_TRUNK_ConstitutiveHet.bed.gz\",\n      \"position\": [\n        61,\n        1\n      ],\n      \"type\": \"bed\"\n    },\n\n    {\n      \"name\": \"FETAL_MUSCLE_TRUNK_Enhancer.bed.gz\",\n      \"position\": [\n        61,\n        2\n      ],\n      \"type\": \"bed\"\n    },\n\n    {\n      \"name\": \"FETAL_MUSCLE_TRUNK_FacultativeHet.bed.gz\",\n      \"position\": [\n        61,\n        3\n      ],\n      \"type\": \"bed\"\n    },\n\n    {\n      \"name\": \"FETAL_MUSCLE_TRUNK_LowConfidence.bed.gz\",\n      \"position\": [\n        61,\n        4\n      ],\n      \"type\": \"bed\"\n    },\n\n    {\n      \"name\": \"FETAL_MUSCLE_TRUNK_Promoter.bed.gz\",\n      \"position\": [\n        61,\n        5\n      ],\n      \"type\": \"bed\"\n    },\n\n    {\n      \"name\": \"FETAL_MUSCLE_TRUNK_Quiescent.bed.gz\",\n      \"position\": [\n        61,\n        6\n      ],\n      \"type\": \"bed\"\n    },\n\n    {\n      \"name\": \"FETAL_MUSCLE_TRUNK_RegPermissive.bed.gz\",\n      \"position\": [\n        61,\n        7\n      ],\n      \"type\": \"bed\"\n    },\n\n    {\n      \"name\": \"FETAL_MUSCLE_TRUNK_Transcribed.bed.gz\",\n      \"position\": [\n        61,\n        8\n      ],\n      \"type\": \"bed\"\n    },\n\n    {\n      \"name\": \"FETAL_PLACENTA_Bivalent.bed.gz\",\n      \"position\": [\n        62,\n        0\n      ],\n      \"type\": \"bed\"\n    },\n\n    {\n      \"name\": \"FETAL_PLACENTA_ConstitutiveHet.bed.gz\",\n      \"position\": [\n        62,\n        1\n      ],\n      \"type\": \"bed\"\n    },\n\n    {\n      \"name\": \"FETAL_PLACENTA_Enhancer.bed.gz\",\n      \"position\": [\n        62,\n        2\n      ],\n      \"type\": \"bed\"\n    },\n\n    {\n      \"name\": \"FETAL_PLACENTA_FacultativeHet.bed.gz\",\n      \"position\": [\n        62,\n        3\n      ],\n      \"type\": \"bed\"\n    },\n\n    {\n      \"name\": \"FETAL_PLACENTA_Promoter.bed.gz\",\n      \"position\": [\n        62,\n        5\n      ],\n      \"type\": \"bed\"\n    },\n\n    {\n      \"name\": \"FETAL_PLACENTA_Quiescent.bed.gz\",\n      \"position\": [\n        62,\n        6\n      ],\n      \"type\": \"bed\"\n    },\n\n    {\n      \"name\": \"FETAL_PLACENTA_RegPermissive.bed.gz\",\n      \"position\": [\n        62,\n        7\n      ],\n      \"type\": \"bed\"\n    },\n\n    {\n      \"name\": \"FETAL_PLACENTA_Transcribed.bed.gz\",\n      \"position\": [\n        62,\n        8\n      ],\n      \"type\": \"bed\"\n    },\n\n    {\n      \"name\": \"FETAL_STOMACH_Bivalent.bed.gz\",\n      \"position\": [\n        63,\n        0\n      ],\n      \"type\": \"bed\"\n    },\n\n    {\n      \"name\": \"FETAL_STOMACH_ConstitutiveHet.bed.gz\",\n      \"position\": [\n        63,\n        1\n      ],\n      \"type\": \"bed\"\n    },\n\n    {\n      \"name\": \"FETAL_STOMACH_Enhancer.bed.gz\",\n      \"position\": [\n        63,\n        2\n      ],\n      \"type\": \"bed\"\n    },\n\n    {\n      \"name\": \"FETAL_STOMACH_FacultativeHet.bed.gz\",\n      \"position\": [\n        63,\n        3\n      ],\n      \"type\": \"bed\"\n    },\n\n    {\n      \"name\": \"FETAL_STOMACH_Promoter.bed.gz\",\n      \"position\": [\n        63,\n        5\n      ],\n      \"type\": \"bed\"\n    },\n\n    {\n      \"name\": \"FETAL_STOMACH_Quiescent.bed.gz\",\n      \"position\": [\n        63,\n        6\n      ],\n      \"type\": \"bed\"\n    },\n\n    {\n      \"name\": \"FETAL_STOMACH_RegPermissive.bed.gz\",\n      \"position\": [\n        63,\n        7\n      ],\n      \"type\": \"bed\"\n    },\n\n    {\n      \"name\": \"FETAL_STOMACH_Transcribed.bed.gz\",\n      \"position\": [\n        63,\n        8\n      ],\n      \"type\": \"bed\"\n    },\n\n    {\n      \"name\": \"FETAL_THYMUS_Bivalent.bed.gz\",\n      \"position\": [\n        64,\n        0\n      ],\n      \"type\": \"bed\"\n    },\n\n    {\n      \"name\": \"FETAL_THYMUS_ConstitutiveHet.bed.gz\",\n      \"position\": [\n        64,\n        1\n      ],\n      \"type\": \"bed\"\n    },\n\n    {\n      \"name\": \"FETAL_THYMUS_Enhancer.bed.gz\",\n      \"position\": [\n        64,\n        2\n      ],\n      \"type\": \"bed\"\n    },\n\n    {\n      \"name\": \"FETAL_THYMUS_FacultativeHet.bed.gz\",\n      \"position\": [\n        64,\n        3\n      ],\n      \"type\": \"bed\"\n    },\n\n    {\n      \"name\": \"FETAL_THYMUS_Promoter.bed.gz\",\n      \"position\": [\n        64,\n        5\n      ],\n      \"type\": \"bed\"\n    },\n\n    {\n      \"name\": \"FETAL_THYMUS_Quiescent.bed.gz\",\n      \"position\": [\n        64,\n        6\n      ],\n      \"type\": \"bed\"\n    },\n\n    {\n      \"name\": \"FETAL_THYMUS_RegPermissive.bed.gz\",\n      \"position\": [\n        64,\n        7\n      ],\n      \"type\": \"bed\"\n    },\n\n    {\n      \"name\": \"FETAL_THYMUS_Transcribed.bed.gz\",\n      \"position\": [\n        64,\n        8\n      ],\n      \"type\": \"bed\"\n    },\n\n    {\n      \"name\": \"GASTRIC_Bivalent.bed.gz\",\n      \"position\": [\n        65,\n        0\n      ],\n      \"type\": \"bed\"\n    },\n\n    {\n      \"name\": \"GASTRIC_ConstitutiveHet.bed.gz\",\n      \"position\": [\n        65,\n        1\n      ],\n      \"type\": \"bed\"\n    },\n\n    {\n      \"name\": \"GASTRIC_Enhancer.bed.gz\",\n      \"position\": [\n        65,\n        2\n      ],\n      \"type\": \"bed\"\n    },\n\n    {\n      \"name\": \"GASTRIC_FacultativeHet.bed.gz\",\n      \"position\": [\n        65,\n        3\n      ],\n      \"type\": \"bed\"\n    },\n\n    {\n      \"name\": \"GASTRIC_LowConfidence.bed.gz\",\n      \"position\": [\n        65,\n        4\n      ],\n      \"type\": \"bed\"\n    },\n\n    {\n      \"name\": \"GASTRIC_Promoter.bed.gz\",\n      \"position\": [\n        65,\n        5\n      ],\n      \"type\": \"bed\"\n    },\n\n    {\n      \"name\": \"GASTRIC_Quiescent.bed.gz\",\n      \"position\": [\n        65,\n        6\n      ],\n      \"type\": \"bed\"\n    },\n\n    {\n      \"name\": \"GASTRIC_RegPermissive.bed.gz\",\n      \"position\": [\n        65,\n        7\n      ],\n      \"type\": \"bed\"\n    },\n\n    {\n      \"name\": \"GASTRIC_Transcribed.bed.gz\",\n      \"position\": [\n        65,\n        8\n      ],\n      \"type\": \"bed\"\n    },\n\n    {\n      \"name\": \"GLIOBLA_Bivalent.bed.gz\",\n      \"position\": [\n        66,\n        0\n      ],\n      \"type\": \"bed\"\n    },\n\n    {\n      \"name\": \"GLIOBLA_ConstitutiveHet.bed.gz\",\n      \"position\": [\n        66,\n        1\n      ],\n      \"type\": \"bed\"\n    },\n\n    {\n      \"name\": \"GLIOBLA_FacultativeHet.bed.gz\",\n      \"position\": [\n        66,\n        3\n      ],\n      \"type\": \"bed\"\n    },\n\n    {\n      \"name\": \"GLIOBLA_LowConfidence.bed.gz\",\n      \"position\": [\n        66,\n        4\n      ],\n      \"type\": \"bed\"\n    },\n\n    {\n      \"name\": \"GLIOBLA_Promoter.bed.gz\",\n      \"position\": [\n        66,\n        5\n      ],\n      \"type\": \"bed\"\n    },\n\n    {\n      \"name\": \"GLIOBLA_Quiescent.bed.gz\",\n      \"position\": [\n        66,\n        6\n      ],\n      \"type\": \"bed\"\n    },\n\n    {\n      \"name\": \"GLIOBLA_RegPermissive.bed.gz\",\n      \"position\": [\n        66,\n        7\n      ],\n      \"type\": \"bed\"\n    },\n\n    {\n      \"name\": \"GM06990_ConstitutiveHet.bed.gz\",\n      \"position\": [\n        67,\n        1\n      ],\n      \"type\": \"bed\"\n    },\n\n    {\n      \"name\": \"GM06990_Promoter.bed.gz\",\n      \"position\": [\n        67,\n        5\n      ],\n      \"type\": \"bed\"\n    },\n\n    {\n      \"name\": \"GM06990_Quiescent.bed.gz\",\n      \"position\": [\n        67,\n        6\n      ],\n      \"type\": \"bed\"\n    },\n\n    {\n      \"name\": \"GM06990_Transcribed.bed.gz\",\n      \"position\": [\n        67,\n        8\n      ],\n      \"type\": \"bed\"\n    },\n\n    {\n      \"name\": \"GM12864_FacultativeHet.bed.gz\",\n      \"position\": [\n        68,\n        3\n      ],\n      \"type\": \"bed\"\n    },\n\n    {\n      \"name\": \"GM12864_LowConfidence.bed.gz\",\n      \"position\": [\n        68,\n        4\n      ],\n      \"type\": \"bed\"\n    },\n\n    {\n      \"name\": \"GM12864_Promoter.bed.gz\",\n      \"position\": [\n        68,\n        5\n      ],\n      \"type\": \"bed\"\n    },\n\n    {\n      \"name\": \"GM12864_Quiescent.bed.gz\",\n      \"position\": [\n        68,\n        6\n      ],\n      \"type\": \"bed\"\n    },\n\n    {\n      \"name\": \"GM12864_RegPermissive.bed.gz\",\n      \"position\": [\n        68,\n        7\n      ],\n      \"type\": \"bed\"\n    },\n\n    {\n      \"name\": \"GM12864_Transcribed.bed.gz\",\n      \"position\": [\n        68,\n        8\n      ],\n      \"type\": \"bed\"\n    },\n\n    {\n      \"name\": \"GM12865_Enhancer.bed.gz\",\n      \"position\": [\n        69,\n        2\n      ],\n      \"type\": \"bed\"\n    },\n\n    {\n      \"name\": \"GM12865_FacultativeHet.bed.gz\",\n      \"position\": [\n        69,\n        3\n      ],\n      \"type\": \"bed\"\n    },\n\n    {\n      \"name\": \"GM12865_LowConfidence.bed.gz\",\n      \"position\": [\n        69,\n        4\n      ],\n      \"type\": \"bed\"\n    },\n\n    {\n      \"name\": \"GM12865_Quiescent.bed.gz\",\n      \"position\": [\n        69,\n        6\n      ],\n      \"type\": \"bed\"\n    },\n\n    {\n      \"name\": \"GM12865_Transcribed.bed.gz\",\n      \"position\": [\n        69,\n        8\n      ],\n      \"type\": \"bed\"\n    },\n\n    {\n      \"name\": \"GM12891_Bivalent.bed.gz\",\n      \"position\": [\n        70,\n        0\n      ],\n      \"type\": \"bed\"\n    },\n\n    {\n      \"name\": \"GM12891_FacultativeHet.bed.gz\",\n      \"position\": [\n        70,\n        3\n      ],\n      \"type\": \"bed\"\n    },\n\n    {\n      \"name\": \"GM12891_Promoter.bed.gz\",\n      \"position\": [\n        70,\n        5\n      ],\n      \"type\": \"bed\"\n    },\n\n    {\n      \"name\": \"GM12891_Quiescent.bed.gz\",\n      \"position\": [\n        70,\n        6\n      ],\n      \"type\": \"bed\"\n    },\n\n    {\n      \"name\": \"GM12891_RegPermissive.bed.gz\",\n      \"position\": [\n        70,\n        7\n      ],\n      \"type\": \"bed\"\n    },\n\n    {\n      \"name\": \"GM12891_Transcribed.bed.gz\",\n      \"position\": [\n        70,\n        8\n      ],\n      \"type\": \"bed\"\n    },\n\n    {\n      \"name\": \"GM12892_FacultativeHet.bed.gz\",\n      \"position\": [\n        71,\n        3\n      ],\n      \"type\": \"bed\"\n    },\n\n    {\n      \"name\": \"GM12892_Promoter.bed.gz\",\n      \"position\": [\n        71,\n        5\n      ],\n      \"type\": \"bed\"\n    },\n\n    {\n      \"name\": \"GM12892_Quiescent.bed.gz\",\n      \"position\": [\n        71,\n        6\n      ],\n      \"type\": \"bed\"\n    },\n\n    {\n      \"name\": \"GM12892_RegPermissive.bed.gz\",\n      \"position\": [\n        71,\n        7\n      ],\n      \"type\": \"bed\"\n    },\n\n    {\n      \"name\": \"GM12892_Transcribed.bed.gz\",\n      \"position\": [\n        71,\n        8\n      ],\n      \"type\": \"bed\"\n    },\n\n    {\n      \"name\": \"H1_BMP4_DERIVED_MESENDODERM_CULTURED_CELLS_ConstitutiveHet.bed.gz\",\n      \"position\": [\n        72,\n        1\n      ],\n      \"type\": \"bed\"\n    },\n\n    {\n      \"name\": \"H1_BMP4_DERIVED_MESENDODERM_CULTURED_CELLS_Enhancer.bed.gz\",\n      \"position\": [\n        72,\n        2\n      ],\n      \"type\": \"bed\"\n    },\n\n    {\n      \"name\": \"H1_BMP4_DERIVED_MESENDODERM_CULTURED_CELLS_FacultativeHet.bed.gz\",\n      \"position\": [\n        72,\n        3\n      ],\n      \"type\": \"bed\"\n    },\n\n    {\n      \"name\": \"H1_BMP4_DERIVED_MESENDODERM_CULTURED_CELLS_LowConfidence.bed.gz\",\n      \"position\": [\n        72,\n        4\n      ],\n      \"type\": \"bed\"\n    },\n\n    {\n      \"name\": \"H1_BMP4_DERIVED_MESENDODERM_CULTURED_CELLS_Promoter.bed.gz\",\n      \"position\": [\n        72,\n        5\n      ],\n      \"type\": \"bed\"\n    },\n\n    {\n      \"name\": \"H1_BMP4_DERIVED_MESENDODERM_CULTURED_CELLS_Quiescent.bed.gz\",\n      \"position\": [\n        72,\n        6\n      ],\n      \"type\": \"bed\"\n    },\n\n    {\n      \"name\": \"H1_BMP4_DERIVED_MESENDODERM_CULTURED_CELLS_RegPermissive.bed.gz\",\n      \"position\": [\n        72,\n        7\n      ],\n      \"type\": \"bed\"\n    },\n\n    {\n      \"name\": \"H1_BMP4_DERIVED_MESENDODERM_CULTURED_CELLS_Transcribed.bed.gz\",\n      \"position\": [\n        72,\n        8\n      ],\n      \"type\": \"bed\"\n    },\n\n    {\n      \"name\": \"H1_BMP4_DERIVED_TROPHOBLAST_CULTURED_CELLS_Bivalent.bed.gz\",\n      \"position\": [\n        73,\n        0\n      ],\n      \"type\": \"bed\"\n    },\n\n    {\n      \"name\": \"H1_BMP4_DERIVED_TROPHOBLAST_CULTURED_CELLS_ConstitutiveHet.bed.gz\",\n      \"position\": [\n        73,\n        1\n      ],\n      \"type\": \"bed\"\n    },\n\n    {\n      \"name\": \"H1_BMP4_DERIVED_TROPHOBLAST_CULTURED_CELLS_Enhancer.bed.gz\",\n      \"position\": [\n        73,\n        2\n      ],\n      \"type\": \"bed\"\n    },\n\n    {\n      \"name\": \"H1_BMP4_DERIVED_TROPHOBLAST_CULTURED_CELLS_Promoter.bed.gz\",\n      \"position\": [\n        73,\n        5\n      ],\n      \"type\": \"bed\"\n    },\n\n    {\n      \"name\": \"H1_BMP4_DERIVED_TROPHOBLAST_CULTURED_CELLS_Quiescent.bed.gz\",\n      \"position\": [\n        73,\n        6\n      ],\n      \"type\": \"bed\"\n    },\n\n    {\n      \"name\": \"H1_BMP4_DERIVED_TROPHOBLAST_CULTURED_CELLS_RegPermissive.bed.gz\",\n      \"position\": [\n        73,\n        7\n      ],\n      \"type\": \"bed\"\n    },\n\n    {\n      \"name\": \"H1_BMP4_DERIVED_TROPHOBLAST_CULTURED_CELLS_Transcribed.bed.gz\",\n      \"position\": [\n        73,\n        8\n      ],\n      \"type\": \"bed\"\n    },\n\n    {\n      \"name\": \"H1_DERIVED_MESENCHYMAL_STEM_CELLS_Bivalent.bed.gz\",\n      \"position\": [\n        74,\n        0\n      ],\n      \"type\": \"bed\"\n    },\n\n    {\n      \"name\": \"H1_DERIVED_MESENCHYMAL_STEM_CELLS_ConstitutiveHet.bed.gz\",\n      \"position\": [\n        74,\n        1\n      ],\n      \"type\": \"bed\"\n    },\n\n    {\n      \"name\": \"H1_DERIVED_MESENCHYMAL_STEM_CELLS_Enhancer.bed.gz\",\n      \"position\": [\n        74,\n        2\n      ],\n      \"type\": \"bed\"\n    },\n\n    {\n      \"name\": \"H1_DERIVED_MESENCHYMAL_STEM_CELLS_FacultativeHet.bed.gz\",\n      \"position\": [\n        74,\n        3\n      ],\n      \"type\": \"bed\"\n    },\n\n    {\n      \"name\": \"H1_DERIVED_MESENCHYMAL_STEM_CELLS_LowConfidence.bed.gz\",\n      \"position\": [\n        74,\n        4\n      ],\n      \"type\": \"bed\"\n    },\n\n    {\n      \"name\": \"H1_DERIVED_MESENCHYMAL_STEM_CELLS_Promoter.bed.gz\",\n      \"position\": [\n        74,\n        5\n      ],\n      \"type\": \"bed\"\n    },\n\n    {\n      \"name\": \"H1_DERIVED_MESENCHYMAL_STEM_CELLS_Quiescent.bed.gz\",\n      \"position\": [\n        74,\n        6\n      ],\n      \"type\": \"bed\"\n    },\n\n    {\n      \"name\": \"H1_DERIVED_MESENCHYMAL_STEM_CELLS_RegPermissive.bed.gz\",\n      \"position\": [\n        74,\n        7\n      ],\n      \"type\": \"bed\"\n    },\n\n    {\n      \"name\": \"H1_DERIVED_MESENCHYMAL_STEM_CELLS_Transcribed.bed.gz\",\n      \"position\": [\n        74,\n        8\n      ],\n      \"type\": \"bed\"\n    },\n\n    {\n      \"name\": \"H1_DERIVED_NEURONAL_PROGENITOR_CULTURED_CELLS_Bivalent.bed.gz\",\n      \"position\": [\n        75,\n        0\n      ],\n      \"type\": \"bed\"\n    },\n\n    {\n      \"name\": \"H1_DERIVED_NEURONAL_PROGENITOR_CULTURED_CELLS_FacultativeHet.bed.gz\",\n      \"position\": [\n        75,\n        3\n      ],\n      \"type\": \"bed\"\n    },\n\n    {\n      \"name\": \"H1_DERIVED_NEURONAL_PROGENITOR_CULTURED_CELLS_LowConfidence.bed.gz\",\n      \"position\": [\n        75,\n        4\n      ],\n      \"type\": \"bed\"\n    },\n\n    {\n      \"name\": \"H1_DERIVED_NEURONAL_PROGENITOR_CULTURED_CELLS_Promoter.bed.gz\",\n      \"position\": [\n        75,\n        5\n      ],\n      \"type\": \"bed\"\n    },\n\n    {\n      \"name\": \"H1_DERIVED_NEURONAL_PROGENITOR_CULTURED_CELLS_Quiescent.bed.gz\",\n      \"position\": [\n        75,\n        6\n      ],\n      \"type\": \"bed\"\n    },\n\n    {\n      \"name\": \"H1_DERIVED_NEURONAL_PROGENITOR_CULTURED_CELLS_RegPermissive.bed.gz\",\n      \"position\": [\n        75,\n        7\n      ],\n      \"type\": \"bed\"\n    },\n\n    {\n      \"name\": \"H1_DERIVED_NEURONAL_PROGENITOR_CULTURED_CELLS_Transcribed.bed.gz\",\n      \"position\": [\n        75,\n        8\n      ],\n      \"type\": \"bed\"\n    },\n\n    {\n      \"name\": \"H1-HESC_Bivalent.bed.gz\",\n      \"position\": [\n        76,\n        0\n      ],\n      \"type\": \"bed\"\n    },\n\n    {\n      \"name\": \"H1-HESC_ConstitutiveHet.bed.gz\",\n      \"position\": [\n        76,\n        1\n      ],\n      \"type\": \"bed\"\n    },\n\n    {\n      \"name\": \"H1-HESC_Enhancer.bed.gz\",\n      \"position\": [\n        76,\n        2\n      ],\n      \"type\": \"bed\"\n    },\n\n    {\n      \"name\": \"H1-HESC_FacultativeHet.bed.gz\",\n      \"position\": [\n        76,\n        3\n      ],\n      \"type\": \"bed\"\n    },\n\n    {\n      \"name\": \"H1-HESC_LowConfidence.bed.gz\",\n      \"position\": [\n        76,\n        4\n      ],\n      \"type\": \"bed\"\n    },\n\n    {\n      \"name\": \"H1-HESC_Quiescent.bed.gz\",\n      \"position\": [\n        76,\n        6\n      ],\n      \"type\": \"bed\"\n    },\n\n    {\n      \"name\": \"H1-HESC_RegPermissive.bed.gz\",\n      \"position\": [\n        76,\n        7\n      ],\n      \"type\": \"bed\"\n    },\n\n    {\n      \"name\": \"H1-HESC_Transcribed.bed.gz\",\n      \"position\": [\n        76,\n        8\n      ],\n      \"type\": \"bed\"\n    },\n\n    {\n      \"name\": \"H7-HESC_Bivalent.bed.gz\",\n      \"position\": [\n        77,\n        0\n      ],\n      \"type\": \"bed\"\n    },\n\n    {\n      \"name\": \"H7-HESC_LowConfidence.bed.gz\",\n      \"position\": [\n        77,\n        4\n      ],\n      \"type\": \"bed\"\n    },\n\n    {\n      \"name\": \"H7-HESC_Quiescent.bed.gz\",\n      \"position\": [\n        77,\n        6\n      ],\n      \"type\": \"bed\"\n    },\n\n    {\n      \"name\": \"H7-HESC_RegPermissive.bed.gz\",\n      \"position\": [\n        77,\n        7\n      ],\n      \"type\": \"bed\"\n    },\n\n    {\n      \"name\": \"H7-HESC_Transcribed.bed.gz\",\n      \"position\": [\n        77,\n        8\n      ],\n      \"type\": \"bed\"\n    },\n\n    {\n      \"name\": \"H9_DERIVED_NEURONAL_PROGENITOR_CULTURED_CELLS_ConstitutiveHet.bed.gz\",\n      \"position\": [\n        78,\n        1\n      ],\n      \"type\": \"bed\"\n    },\n\n    {\n      \"name\": \"H9_DERIVED_NEURONAL_PROGENITOR_CULTURED_CELLS_Enhancer.bed.gz\",\n      \"position\": [\n        78,\n        2\n      ],\n      \"type\": \"bed\"\n    },\n\n    {\n      \"name\": \"H9_DERIVED_NEURONAL_PROGENITOR_CULTURED_CELLS_FacultativeHet.bed.gz\",\n      \"position\": [\n        78,\n        3\n      ],\n      \"type\": \"bed\"\n    },\n\n    {\n      \"name\": \"H9_DERIVED_NEURONAL_PROGENITOR_CULTURED_CELLS_Quiescent.bed.gz\",\n      \"position\": [\n        78,\n        6\n      ],\n      \"type\": \"bed\"\n    },\n\n    {\n      \"name\": \"H9_DERIVED_NEURONAL_PROGENITOR_CULTURED_CELLS_Transcribed.bed.gz\",\n      \"position\": [\n        78,\n        8\n      ],\n      \"type\": \"bed\"\n    },\n\n    {\n      \"name\": \"H9_DERIVED_NEURON_CULTURED_CELLS_ConstitutiveHet.bed.gz\",\n      \"position\": [\n        79,\n        1\n      ],\n      \"type\": \"bed\"\n    },\n\n    {\n      \"name\": \"H9_DERIVED_NEURON_CULTURED_CELLS_Enhancer.bed.gz\",\n      \"position\": [\n        79,\n        2\n      ],\n      \"type\": \"bed\"\n    },\n\n    {\n      \"name\": \"H9_DERIVED_NEURON_CULTURED_CELLS_FacultativeHet.bed.gz\",\n      \"position\": [\n        79,\n        3\n      ],\n      \"type\": \"bed\"\n    },\n\n    {\n      \"name\": \"H9_DERIVED_NEURON_CULTURED_CELLS_LowConfidence.bed.gz\",\n      \"position\": [\n        79,\n        4\n      ],\n      \"type\": \"bed\"\n    },\n\n    {\n      \"name\": \"H9_DERIVED_NEURON_CULTURED_CELLS_Quiescent.bed.gz\",\n      \"position\": [\n        79,\n        6\n      ],\n      \"type\": \"bed\"\n    },\n\n    {\n      \"name\": \"H9_DERIVED_NEURON_CULTURED_CELLS_RegPermissive.bed.gz\",\n      \"position\": [\n        79,\n        7\n      ],\n      \"type\": \"bed\"\n    },\n\n    {\n      \"name\": \"H9_DERIVED_NEURON_CULTURED_CELLS_Transcribed.bed.gz\",\n      \"position\": [\n        79,\n        8\n      ],\n      \"type\": \"bed\"\n    },\n\n    {\n      \"name\": \"H9ES_Bivalent.bed.gz\",\n      \"position\": [\n        80,\n        0\n      ],\n      \"type\": \"bed\"\n    },\n\n    {\n      \"name\": \"H9ES_FacultativeHet.bed.gz\",\n      \"position\": [\n        80,\n        3\n      ],\n      \"type\": \"bed\"\n    },\n\n    {\n      \"name\": \"H9ES_Promoter.bed.gz\",\n      \"position\": [\n        80,\n        5\n      ],\n      \"type\": \"bed\"\n    },\n\n    {\n      \"name\": \"H9ES_Quiescent.bed.gz\",\n      \"position\": [\n        80,\n        6\n      ],\n      \"type\": \"bed\"\n    },\n\n    {\n      \"name\": \"H9ES_RegPermissive.bed.gz\",\n      \"position\": [\n        80,\n        7\n      ],\n      \"type\": \"bed\"\n    },\n\n    {\n      \"name\": \"H9ES_Transcribed.bed.gz\",\n      \"position\": [\n        80,\n        8\n      ],\n      \"type\": \"bed\"\n    },\n\n    {\n      \"name\": \"HAC_Enhancer.bed.gz\",\n      \"position\": [\n        81,\n        2\n      ],\n      \"type\": \"bed\"\n    },\n\n    {\n      \"name\": \"HAC_LowConfidence.bed.gz\",\n      \"position\": [\n        81,\n        4\n      ],\n      \"type\": \"bed\"\n    },\n\n    {\n      \"name\": \"HAC_Promoter.bed.gz\",\n      \"position\": [\n        81,\n        5\n      ],\n      \"type\": \"bed\"\n    },\n\n    {\n      \"name\": \"HAC_Quiescent.bed.gz\",\n      \"position\": [\n        81,\n        6\n      ],\n      \"type\": \"bed\"\n    },\n\n    {\n      \"name\": \"HAC_RegPermissive.bed.gz\",\n      \"position\": [\n        81,\n        7\n      ],\n      \"type\": \"bed\"\n    },\n\n    {\n      \"name\": \"HAC_Transcribed.bed.gz\",\n      \"position\": [\n        81,\n        8\n      ],\n      \"type\": \"bed\"\n    },\n\n    {\n      \"name\": \"HA-SP_ConstitutiveHet.bed.gz\",\n      \"position\": [\n        82,\n        1\n      ],\n      \"type\": \"bed\"\n    },\n\n    {\n      \"name\": \"HA-SP_Enhancer.bed.gz\",\n      \"position\": [\n        82,\n        2\n      ],\n      \"type\": \"bed\"\n    },\n\n    {\n      \"name\": \"HA-SP_FacultativeHet.bed.gz\",\n      \"position\": [\n        82,\n        3\n      ],\n      \"type\": \"bed\"\n    },\n\n    {\n      \"name\": \"HA-SP_Quiescent.bed.gz\",\n      \"position\": [\n        82,\n        6\n      ],\n      \"type\": \"bed\"\n    },\n\n    {\n      \"name\": \"HA-SP_RegPermissive.bed.gz\",\n      \"position\": [\n        82,\n        7\n      ],\n      \"type\": \"bed\"\n    },\n\n    {\n      \"name\": \"HBMEC_Enhancer.bed.gz\",\n      \"position\": [\n        83,\n        2\n      ],\n      \"type\": \"bed\"\n    },\n\n    {\n      \"name\": \"HBMEC_FacultativeHet.bed.gz\",\n      \"position\": [\n        83,\n        3\n      ],\n      \"type\": \"bed\"\n    },\n\n    {\n      \"name\": \"HBMEC_LowConfidence.bed.gz\",\n      \"position\": [\n        83,\n        4\n      ],\n      \"type\": \"bed\"\n    },\n\n    {\n      \"name\": \"HBMEC_Promoter.bed.gz\",\n      \"position\": [\n        83,\n        5\n      ],\n      \"type\": \"bed\"\n    },\n\n    {\n      \"name\": \"HBMEC_Quiescent.bed.gz\",\n      \"position\": [\n        83,\n        6\n      ],\n      \"type\": \"bed\"\n    },\n\n    {\n      \"name\": \"HBMEC_RegPermissive.bed.gz\",\n      \"position\": [\n        83,\n        7\n      ],\n      \"type\": \"bed\"\n    },\n\n    {\n      \"name\": \"HCFAA_Enhancer.bed.gz\",\n      \"position\": [\n        84,\n        2\n      ],\n      \"type\": \"bed\"\n    },\n\n    {\n      \"name\": \"HCFAA_FacultativeHet.bed.gz\",\n      \"position\": [\n        84,\n        3\n      ],\n      \"type\": \"bed\"\n    },\n\n    {\n      \"name\": \"HCFAA_Promoter.bed.gz\",\n      \"position\": [\n        84,\n        5\n      ],\n      \"type\": \"bed\"\n    },\n\n    {\n      \"name\": \"HCFAA_Quiescent.bed.gz\",\n      \"position\": [\n        84,\n        6\n      ],\n      \"type\": \"bed\"\n    },\n\n    {\n      \"name\": \"HCFAA_RegPermissive.bed.gz\",\n      \"position\": [\n        84,\n        7\n      ],\n      \"type\": \"bed\"\n    },\n\n    {\n      \"name\": \"HCM_Bivalent.bed.gz\",\n      \"position\": [\n        85,\n        0\n      ],\n      \"type\": \"bed\"\n    },\n\n    {\n      \"name\": \"HCM_LowConfidence.bed.gz\",\n      \"position\": [\n        85,\n        4\n      ],\n      \"type\": \"bed\"\n    },\n\n    {\n      \"name\": \"HCM_Promoter.bed.gz\",\n      \"position\": [\n        85,\n        5\n      ],\n      \"type\": \"bed\"\n    },\n\n    {\n      \"name\": \"HCM_Quiescent.bed.gz\",\n      \"position\": [\n        85,\n        6\n      ],\n      \"type\": \"bed\"\n    },\n\n    {\n      \"name\": \"HCM_RegPermissive.bed.gz\",\n      \"position\": [\n        85,\n        7\n      ],\n      \"type\": \"bed\"\n    },\n\n    {\n      \"name\": \"HCPEPIC_Enhancer.bed.gz\",\n      \"position\": [\n        86,\n        2\n      ],\n      \"type\": \"bed\"\n    },\n\n    {\n      \"name\": \"HCPEPIC_LowConfidence.bed.gz\",\n      \"position\": [\n        86,\n        4\n      ],\n      \"type\": \"bed\"\n    },\n\n    {\n      \"name\": \"HCPEPIC_Promoter.bed.gz\",\n      \"position\": [\n        86,\n        5\n      ],\n      \"type\": \"bed\"\n    },\n\n    {\n      \"name\": \"HCPEPIC_Quiescent.bed.gz\",\n      \"position\": [\n        86,\n        6\n      ],\n      \"type\": \"bed\"\n    },\n\n    {\n      \"name\": \"HCPEPIC_RegPermissive.bed.gz\",\n      \"position\": [\n        86,\n        7\n      ],\n      \"type\": \"bed\"\n    },\n\n    {\n      \"name\": \"HCT-116_FacultativeHet.bed.gz\",\n      \"position\": [\n        87,\n        3\n      ],\n      \"type\": \"bed\"\n    },\n\n    {\n      \"name\": \"HCT-116_Promoter.bed.gz\",\n      \"position\": [\n        87,\n        5\n      ],\n      \"type\": \"bed\"\n    },\n\n    {\n      \"name\": \"HCT-116_Quiescent.bed.gz\",\n      \"position\": [\n        87,\n        6\n      ],\n      \"type\": \"bed\"\n    },\n\n    {\n      \"name\": \"HCT-116_RegPermissive.bed.gz\",\n      \"position\": [\n        87,\n        7\n      ],\n      \"type\": \"bed\"\n    },\n\n    {\n      \"name\": \"HCT-116_Transcribed.bed.gz\",\n      \"position\": [\n        87,\n        8\n      ],\n      \"type\": \"bed\"\n    },\n\n    {\n      \"name\": \"HEEPIC_Enhancer.bed.gz\",\n      \"position\": [\n        88,\n        2\n      ],\n      \"type\": \"bed\"\n    },\n\n    {\n      \"name\": \"HEEPIC_LowConfidence.bed.gz\",\n      \"position\": [\n        88,\n        4\n      ],\n      \"type\": \"bed\"\n    },\n\n    {\n      \"name\": \"HEEPIC_Promoter.bed.gz\",\n      \"position\": [\n        88,\n        5\n      ],\n      \"type\": \"bed\"\n    },\n\n    {\n      \"name\": \"HEEPIC_Quiescent.bed.gz\",\n      \"position\": [\n        88,\n        6\n      ],\n      \"type\": \"bed\"\n    },\n\n    {\n      \"name\": \"HEEPIC_RegPermissive.bed.gz\",\n      \"position\": [\n        88,\n        7\n      ],\n      \"type\": \"bed\"\n    },\n\n    {\n      \"name\": \"HEK293_FacultativeHet.bed.gz\",\n      \"position\": [\n        89,\n        3\n      ],\n      \"type\": \"bed\"\n    },\n\n    {\n      \"name\": \"HEK293_LowConfidence.bed.gz\",\n      \"position\": [\n        89,\n        4\n      ],\n      \"type\": \"bed\"\n    },\n\n    {\n      \"name\": \"HEK293_Promoter.bed.gz\",\n      \"position\": [\n        89,\n        5\n      ],\n      \"type\": \"bed\"\n    },\n\n    {\n      \"name\": \"HEK293_Quiescent.bed.gz\",\n      \"position\": [\n        89,\n        6\n      ],\n      \"type\": \"bed\"\n    },\n\n    {\n      \"name\": \"HEK293_RegPermissive.bed.gz\",\n      \"position\": [\n        89,\n        7\n      ],\n      \"type\": \"bed\"\n    },\n\n    {\n      \"name\": \"HEPG2_Bivalent.bed.gz\",\n      \"position\": [\n        90,\n        0\n      ],\n      \"type\": \"bed\"\n    },\n\n    {\n      \"name\": \"HEPG2_ConstitutiveHet.bed.gz\",\n      \"position\": [\n        90,\n        1\n      ],\n      \"type\": \"bed\"\n    },\n\n    {\n      \"name\": \"HEPG2_Enhancer.bed.gz\",\n      \"position\": [\n        90,\n        2\n      ],\n      \"type\": \"bed\"\n    },\n\n    {\n      \"name\": \"HEPG2_FacultativeHet.bed.gz\",\n      \"position\": [\n        90,\n        3\n      ],\n      \"type\": \"bed\"\n    },\n\n    {\n      \"name\": \"HEPG2_Promoter.bed.gz\",\n      \"position\": [\n        90,\n        5\n      ],\n      \"type\": \"bed\"\n    },\n\n    {\n      \"name\": \"HEPG2_Quiescent.bed.gz\",\n      \"position\": [\n        90,\n        6\n      ],\n      \"type\": \"bed\"\n    },\n\n    {\n      \"name\": \"HEPG2_RegPermissive.bed.gz\",\n      \"position\": [\n        90,\n        7\n      ],\n      \"type\": \"bed\"\n    },\n\n    {\n      \"name\": \"HEPG2_Transcribed.bed.gz\",\n      \"position\": [\n        90,\n        8\n      ],\n      \"type\": \"bed\"\n    },\n\n    {\n      \"name\": \"HESC_DERIVED_CD184+_ENDODERM_CULTURED_CELLS_Bivalent.bed.gz\",\n      \"position\": [\n        91,\n        0\n      ],\n      \"type\": \"bed\"\n    },\n\n    {\n      \"name\": \"HESC_DERIVED_CD184+_ENDODERM_CULTURED_CELLS_ConstitutiveHet.bed.gz\",\n      \"position\": [\n        91,\n        1\n      ],\n      \"type\": \"bed\"\n    },\n\n    {\n      \"name\": \"HESC_DERIVED_CD184+_ENDODERM_CULTURED_CELLS_FacultativeHet.bed.gz\",\n      \"position\": [\n        91,\n        3\n      ],\n      \"type\": \"bed\"\n    },\n\n    {\n      \"name\": \"HESC_DERIVED_CD184+_ENDODERM_CULTURED_CELLS_Promoter.bed.gz\",\n      \"position\": [\n        91,\n        5\n      ],\n      \"type\": \"bed\"\n    },\n\n    {\n      \"name\": \"HESC_DERIVED_CD184+_ENDODERM_CULTURED_CELLS_Quiescent.bed.gz\",\n      \"position\": [\n        91,\n        6\n      ],\n      \"type\": \"bed\"\n    },\n\n    {\n      \"name\": \"HESC_DERIVED_CD184+_ENDODERM_CULTURED_CELLS_RegPermissive.bed.gz\",\n      \"position\": [\n        91,\n        7\n      ],\n      \"type\": \"bed\"\n    },\n\n    {\n      \"name\": \"HESC_DERIVED_CD184+_ENDODERM_CULTURED_CELLS_Transcribed.bed.gz\",\n      \"position\": [\n        91,\n        8\n      ],\n      \"type\": \"bed\"\n    },\n\n    {\n      \"name\": \"HESC_DERIVED_CD56+_ECTODERM_CULTURED_CELLS_Bivalent.bed.gz\",\n      \"position\": [\n        92,\n        0\n      ],\n      \"type\": \"bed\"\n    },\n\n    {\n      \"name\": \"HESC_DERIVED_CD56+_ECTODERM_CULTURED_CELLS_ConstitutiveHet.bed.gz\",\n      \"position\": [\n        92,\n        1\n      ],\n      \"type\": \"bed\"\n    },\n\n    {\n      \"name\": \"HESC_DERIVED_CD56+_ECTODERM_CULTURED_CELLS_Enhancer.bed.gz\",\n      \"position\": [\n        92,\n        2\n      ],\n      \"type\": \"bed\"\n    },\n\n    {\n      \"name\": \"HESC_DERIVED_CD56+_ECTODERM_CULTURED_CELLS_FacultativeHet.bed.gz\",\n      \"position\": [\n        92,\n        3\n      ],\n      \"type\": \"bed\"\n    },\n\n    {\n      \"name\": \"HESC_DERIVED_CD56+_ECTODERM_CULTURED_CELLS_Quiescent.bed.gz\",\n      \"position\": [\n        92,\n        6\n      ],\n      \"type\": \"bed\"\n    },\n\n    {\n      \"name\": \"HESC_DERIVED_CD56+_ECTODERM_CULTURED_CELLS_Transcribed.bed.gz\",\n      \"position\": [\n        92,\n        8\n      ],\n      \"type\": \"bed\"\n    },\n\n    {\n      \"name\": \"HESC_DERIVED_CD56+_MESODERM_CULTURED_CELLS_Bivalent.bed.gz\",\n      \"position\": [\n        93,\n        0\n      ],\n      \"type\": \"bed\"\n    },\n\n    {\n      \"name\": \"HESC_DERIVED_CD56+_MESODERM_CULTURED_CELLS_ConstitutiveHet.bed.gz\",\n      \"position\": [\n        93,\n        1\n      ],\n      \"type\": \"bed\"\n    },\n\n    {\n      \"name\": \"HESC_DERIVED_CD56+_MESODERM_CULTURED_CELLS_Enhancer.bed.gz\",\n      \"position\": [\n        93,\n        2\n      ],\n      \"type\": \"bed\"\n    },\n\n    {\n      \"name\": \"HESC_DERIVED_CD56+_MESODERM_CULTURED_CELLS_FacultativeHet.bed.gz\",\n      \"position\": [\n        93,\n        3\n      ],\n      \"type\": \"bed\"\n    },\n\n    {\n      \"name\": \"HESC_DERIVED_CD56+_MESODERM_CULTURED_CELLS_LowConfidence.bed.gz\",\n      \"position\": [\n        93,\n        4\n      ],\n      \"type\": \"bed\"\n    },\n\n    {\n      \"name\": \"HESC_DERIVED_CD56+_MESODERM_CULTURED_CELLS_Quiescent.bed.gz\",\n      \"position\": [\n        93,\n        6\n      ],\n      \"type\": \"bed\"\n    },\n\n    {\n      \"name\": \"HESC_DERIVED_CD56+_MESODERM_CULTURED_CELLS_RegPermissive.bed.gz\",\n      \"position\": [\n        93,\n        7\n      ],\n      \"type\": \"bed\"\n    },\n\n    {\n      \"name\": \"HESC_DERIVED_CD56+_MESODERM_CULTURED_CELLS_Transcribed.bed.gz\",\n      \"position\": [\n        93,\n        8\n      ],\n      \"type\": \"bed\"\n    },\n\n    {\n      \"name\": \"HFF_Bivalent.bed.gz\",\n      \"position\": [\n        94,\n        0\n      ],\n      \"type\": \"bed\"\n    },\n\n    {\n      \"name\": \"HFF_Enhancer.bed.gz\",\n      \"position\": [\n        94,\n        2\n      ],\n      \"type\": \"bed\"\n    },\n\n    {\n      \"name\": \"HFF_FacultativeHet.bed.gz\",\n      \"position\": [\n        94,\n        3\n      ],\n      \"type\": \"bed\"\n    },\n\n    {\n      \"name\": \"HFF_LowConfidence.bed.gz\",\n      \"position\": [\n        94,\n        4\n      ],\n      \"type\": \"bed\"\n    },\n\n    {\n      \"name\": \"HFF-MYC_Enhancer.bed.gz\",\n      \"position\": [\n        95,\n        2\n      ],\n      \"type\": \"bed\"\n    },\n\n    {\n      \"name\": \"HFF-MYC_FacultativeHet.bed.gz\",\n      \"position\": [\n        95,\n        3\n      ],\n      \"type\": \"bed\"\n    },\n\n    {\n      \"name\": \"HFF-MYC_LowConfidence.bed.gz\",\n      \"position\": [\n        95,\n        4\n      ],\n      \"type\": \"bed\"\n    },\n\n    {\n      \"name\": \"HFF-MYC_Promoter.bed.gz\",\n      \"position\": [\n        95,\n        5\n      ],\n      \"type\": \"bed\"\n    },\n\n    {\n      \"name\": \"HFF-MYC_Quiescent.bed.gz\",\n      \"position\": [\n        95,\n        6\n      ],\n      \"type\": \"bed\"\n    },\n\n    {\n      \"name\": \"HFF-MYC_RegPermissive.bed.gz\",\n      \"position\": [\n        95,\n        7\n      ],\n      \"type\": \"bed\"\n    },\n\n    {\n      \"name\": \"HFF_Promoter.bed.gz\",\n      \"position\": [\n        94,\n        5\n      ],\n      \"type\": \"bed\"\n    },\n\n    {\n      \"name\": \"HFF_Quiescent.bed.gz\",\n      \"position\": [\n        94,\n        6\n      ],\n      \"type\": \"bed\"\n    },\n\n    {\n      \"name\": \"HFF_RegPermissive.bed.gz\",\n      \"position\": [\n        94,\n        7\n      ],\n      \"type\": \"bed\"\n    },\n\n    {\n      \"name\": \"HL-60_Promoter.bed.gz\",\n      \"position\": [\n        96,\n        5\n      ],\n      \"type\": \"bed\"\n    },\n\n    {\n      \"name\": \"HL-60_Quiescent.bed.gz\",\n      \"position\": [\n        96,\n        6\n      ],\n      \"type\": \"bed\"\n    },\n\n    {\n      \"name\": \"HL-60_RegPermissive.bed.gz\",\n      \"position\": [\n        96,\n        7\n      ],\n      \"type\": \"bed\"\n    },\n\n    {\n      \"name\": \"HL-60_Transcribed.bed.gz\",\n      \"position\": [\n        96,\n        8\n      ],\n      \"type\": \"bed\"\n    },\n\n    {\n      \"name\": \"HMEC_ConstitutiveHet.bed.gz\",\n      \"position\": [\n        97,\n        1\n      ],\n      \"type\": \"bed\"\n    },\n\n    {\n      \"name\": \"HMEC_Enhancer.bed.gz\",\n      \"position\": [\n        97,\n        2\n      ],\n      \"type\": \"bed\"\n    },\n\n    {\n      \"name\": \"HMEC_FacultativeHet.bed.gz\",\n      \"position\": [\n        97,\n        3\n      ],\n      \"type\": \"bed\"\n    },\n\n    {\n      \"name\": \"HMEC_Promoter.bed.gz\",\n      \"position\": [\n        97,\n        5\n      ],\n      \"type\": \"bed\"\n    },\n\n    {\n      \"name\": \"HMEC_Quiescent.bed.gz\",\n      \"position\": [\n        97,\n        6\n      ],\n      \"type\": \"bed\"\n    },\n\n    {\n      \"name\": \"HMEC_RegPermissive.bed.gz\",\n      \"position\": [\n        97,\n        7\n      ],\n      \"type\": \"bed\"\n    },\n\n    {\n      \"name\": \"HMEC_Transcribed.bed.gz\",\n      \"position\": [\n        97,\n        8\n      ],\n      \"type\": \"bed\"\n    },\n\n    {\n      \"name\": \"HMF_Enhancer.bed.gz\",\n      \"position\": [\n        98,\n        2\n      ],\n      \"type\": \"bed\"\n    },\n\n    {\n      \"name\": \"HMF_Promoter.bed.gz\",\n      \"position\": [\n        98,\n        5\n      ],\n      \"type\": \"bed\"\n    },\n\n    {\n      \"name\": \"HMF_Quiescent.bed.gz\",\n      \"position\": [\n        98,\n        6\n      ],\n      \"type\": \"bed\"\n    },\n\n    {\n      \"name\": \"HMF_RegPermissive.bed.gz\",\n      \"position\": [\n        98,\n        7\n      ],\n      \"type\": \"bed\"\n    },\n\n    {\n      \"name\": \"HPAF_Enhancer.bed.gz\",\n      \"position\": [\n        99,\n        2\n      ],\n      \"type\": \"bed\"\n    },\n\n    {\n      \"name\": \"HPAF_FacultativeHet.bed.gz\",\n      \"position\": [\n        99,\n        3\n      ],\n      \"type\": \"bed\"\n    },\n\n    {\n      \"name\": \"HPAF_Promoter.bed.gz\",\n      \"position\": [\n        99,\n        5\n      ],\n      \"type\": \"bed\"\n    },\n\n    {\n      \"name\": \"HPAF_Quiescent.bed.gz\",\n      \"position\": [\n        99,\n        6\n      ],\n      \"type\": \"bed\"\n    },\n\n    {\n      \"name\": \"HPAF_RegPermissive.bed.gz\",\n      \"position\": [\n        99,\n        7\n      ],\n      \"type\": \"bed\"\n    },\n\n    {\n      \"name\": \"HPAF_Transcribed.bed.gz\",\n      \"position\": [\n        99,\n        8\n      ],\n      \"type\": \"bed\"\n    },\n\n    {\n      \"name\": \"HPF_Promoter.bed.gz\",\n      \"position\": [\n        100,\n        5\n      ],\n      \"type\": \"bed\"\n    },\n\n    {\n      \"name\": \"HPF_Quiescent.bed.gz\",\n      \"position\": [\n        100,\n        6\n      ],\n      \"type\": \"bed\"\n    },\n\n    {\n      \"name\": \"HPF_RegPermissive.bed.gz\",\n      \"position\": [\n        100,\n        7\n      ],\n      \"type\": \"bed\"\n    },\n\n    {\n      \"name\": \"HRE_Bivalent.bed.gz\",\n      \"position\": [\n        101,\n        0\n      ],\n      \"type\": \"bed\"\n    },\n\n    {\n      \"name\": \"HRE_Enhancer.bed.gz\",\n      \"position\": [\n        101,\n        2\n      ],\n      \"type\": \"bed\"\n    },\n\n    {\n      \"name\": \"HRE_FacultativeHet.bed.gz\",\n      \"position\": [\n        101,\n        3\n      ],\n      \"type\": \"bed\"\n    },\n\n    {\n      \"name\": \"HRE_LowConfidence.bed.gz\",\n      \"position\": [\n        101,\n        4\n      ],\n      \"type\": \"bed\"\n    },\n\n    {\n      \"name\": \"HRE_Promoter.bed.gz\",\n      \"position\": [\n        101,\n        5\n      ],\n      \"type\": \"bed\"\n    },\n\n    {\n      \"name\": \"HRE_Quiescent.bed.gz\",\n      \"position\": [\n        101,\n        6\n      ],\n      \"type\": \"bed\"\n    },\n\n    {\n      \"name\": \"HRE_Transcribed.bed.gz\",\n      \"position\": [\n        101,\n        8\n      ],\n      \"type\": \"bed\"\n    },\n\n    {\n      \"name\": \"HRPEPIC_Bivalent.bed.gz\",\n      \"position\": [\n        102,\n        0\n      ],\n      \"type\": \"bed\"\n    },\n\n    {\n      \"name\": \"HRPEPIC_Enhancer.bed.gz\",\n      \"position\": [\n        102,\n        2\n      ],\n      \"type\": \"bed\"\n    },\n\n    {\n      \"name\": \"HRPEPIC_Promoter.bed.gz\",\n      \"position\": [\n        102,\n        5\n      ],\n      \"type\": \"bed\"\n    },\n\n    {\n      \"name\": \"HRPEPIC_Quiescent.bed.gz\",\n      \"position\": [\n        102,\n        6\n      ],\n      \"type\": \"bed\"\n    },\n\n    {\n      \"name\": \"HRPEPIC_RegPermissive.bed.gz\",\n      \"position\": [\n        102,\n        7\n      ],\n      \"type\": \"bed\"\n    },\n\n    {\n      \"name\": \"HSMM_Bivalent.bed.gz\",\n      \"position\": [\n        103,\n        0\n      ],\n      \"type\": \"bed\"\n    },\n\n    {\n      \"name\": \"HSMM_ConstitutiveHet.bed.gz\",\n      \"position\": [\n        103,\n        1\n      ],\n      \"type\": \"bed\"\n    },\n\n    {\n      \"name\": \"HSMM_Enhancer.bed.gz\",\n      \"position\": [\n        103,\n        2\n      ],\n      \"type\": \"bed\"\n    },\n\n    {\n      \"name\": \"HSMM_Promoter.bed.gz\",\n      \"position\": [\n        103,\n        5\n      ],\n      \"type\": \"bed\"\n    },\n\n    {\n      \"name\": \"HSMM_Quiescent.bed.gz\",\n      \"position\": [\n        103,\n        6\n      ],\n      \"type\": \"bed\"\n    },\n\n    {\n      \"name\": \"HSMM_RegPermissive.bed.gz\",\n      \"position\": [\n        103,\n        7\n      ],\n      \"type\": \"bed\"\n    },\n\n    {\n      \"name\": \"HSMM_Transcribed.bed.gz\",\n      \"position\": [\n        103,\n        8\n      ],\n      \"type\": \"bed\"\n    },\n\n    {\n      \"name\": \"HSMMTUBE_Bivalent.bed.gz\",\n      \"position\": [\n        104,\n        0\n      ],\n      \"type\": \"bed\"\n    },\n\n    {\n      \"name\": \"HSMMTUBE_ConstitutiveHet.bed.gz\",\n      \"position\": [\n        104,\n        1\n      ],\n      \"type\": \"bed\"\n    },\n\n    {\n      \"name\": \"HSMMTUBE_Enhancer.bed.gz\",\n      \"position\": [\n        104,\n        2\n      ],\n      \"type\": \"bed\"\n    },\n\n    {\n      \"name\": \"HSMMTUBE_FacultativeHet.bed.gz\",\n      \"position\": [\n        104,\n        3\n      ],\n      \"type\": \"bed\"\n    },\n\n    {\n      \"name\": \"HSMMTUBE_Promoter.bed.gz\",\n      \"position\": [\n        104,\n        5\n      ],\n      \"type\": \"bed\"\n    },\n\n    {\n      \"name\": \"HSMMTUBE_Quiescent.bed.gz\",\n      \"position\": [\n        104,\n        6\n      ],\n      \"type\": \"bed\"\n    },\n\n    {\n      \"name\": \"HSMMTUBE_RegPermissive.bed.gz\",\n      \"position\": [\n        104,\n        7\n      ],\n      \"type\": \"bed\"\n    },\n\n    {\n      \"name\": \"HSMMTUBE_Transcribed.bed.gz\",\n      \"position\": [\n        104,\n        8\n      ],\n      \"type\": \"bed\"\n    },\n\n    {\n      \"name\": \"HUES48_CELL_LINE_Bivalent.bed.gz\",\n      \"position\": [\n        105,\n        0\n      ],\n      \"type\": \"bed\"\n    },\n\n    {\n      \"name\": \"HUES48_CELL_LINE_ConstitutiveHet.bed.gz\",\n      \"position\": [\n        105,\n        1\n      ],\n      \"type\": \"bed\"\n    },\n\n    {\n      \"name\": \"HUES48_CELL_LINE_Enhancer.bed.gz\",\n      \"position\": [\n        105,\n        2\n      ],\n      \"type\": \"bed\"\n    },\n\n    {\n      \"name\": \"HUES48_CELL_LINE_FacultativeHet.bed.gz\",\n      \"position\": [\n        105,\n        3\n      ],\n      \"type\": \"bed\"\n    },\n\n    {\n      \"name\": \"HUES48_CELL_LINE_Quiescent.bed.gz\",\n      \"position\": [\n        105,\n        6\n      ],\n      \"type\": \"bed\"\n    },\n\n    {\n      \"name\": \"HUES48_CELL_LINE_RegPermissive.bed.gz\",\n      \"position\": [\n        105,\n        7\n      ],\n      \"type\": \"bed\"\n    },\n\n    {\n      \"name\": \"HUES48_CELL_LINE_Transcribed.bed.gz\",\n      \"position\": [\n        105,\n        8\n      ],\n      \"type\": \"bed\"\n    },\n\n    {\n      \"name\": \"HUES64_CELL_LINE_Bivalent.bed.gz\",\n      \"position\": [\n        106,\n        0\n      ],\n      \"type\": \"bed\"\n    },\n\n    {\n      \"name\": \"HUES64_CELL_LINE_ConstitutiveHet.bed.gz\",\n      \"position\": [\n        106,\n        1\n      ],\n      \"type\": \"bed\"\n    },\n\n    {\n      \"name\": \"HUES64_CELL_LINE_Enhancer.bed.gz\",\n      \"position\": [\n        106,\n        2\n      ],\n      \"type\": \"bed\"\n    },\n\n    {\n      \"name\": \"HUES64_CELL_LINE_Quiescent.bed.gz\",\n      \"position\": [\n        106,\n        6\n      ],\n      \"type\": \"bed\"\n    },\n\n    {\n      \"name\": \"HUES64_CELL_LINE_Transcribed.bed.gz\",\n      \"position\": [\n        106,\n        8\n      ],\n      \"type\": \"bed\"\n    },\n\n    {\n      \"name\": \"HUES6_CELL_LINE_Bivalent.bed.gz\",\n      \"position\": [\n        107,\n        0\n      ],\n      \"type\": \"bed\"\n    },\n\n    {\n      \"name\": \"HUES6_CELL_LINE_ConstitutiveHet.bed.gz\",\n      \"position\": [\n        107,\n        1\n      ],\n      \"type\": \"bed\"\n    },\n\n    {\n      \"name\": \"HUES6_CELL_LINE_Enhancer.bed.gz\",\n      \"position\": [\n        107,\n        2\n      ],\n      \"type\": \"bed\"\n    },\n\n    {\n      \"name\": \"HUES6_CELL_LINE_FacultativeHet.bed.gz\",\n      \"position\": [\n        107,\n        3\n      ],\n      \"type\": \"bed\"\n    },\n\n    {\n      \"name\": \"HUES6_CELL_LINE_Promoter.bed.gz\",\n      \"position\": [\n        107,\n        5\n      ],\n      \"type\": \"bed\"\n    },\n\n    {\n      \"name\": \"HUES6_CELL_LINE_Quiescent.bed.gz\",\n      \"position\": [\n        107,\n        6\n      ],\n      \"type\": \"bed\"\n    },\n\n    {\n      \"name\": \"HUES6_CELL_LINE_Transcribed.bed.gz\",\n      \"position\": [\n        107,\n        8\n      ],\n      \"type\": \"bed\"\n    },\n\n    {\n      \"name\": \"HUVEC_ConstitutiveHet.bed.gz\",\n      \"position\": [\n        108,\n        1\n      ],\n      \"type\": \"bed\"\n    },\n\n    {\n      \"name\": \"HUVEC_Enhancer.bed.gz\",\n      \"position\": [\n        108,\n        2\n      ],\n      \"type\": \"bed\"\n    },\n\n    {\n      \"name\": \"HUVEC_Promoter.bed.gz\",\n      \"position\": [\n        108,\n        5\n      ],\n      \"type\": \"bed\"\n    },\n\n    {\n      \"name\": \"HUVEC_Quiescent.bed.gz\",\n      \"position\": [\n        108,\n        6\n      ],\n      \"type\": \"bed\"\n    },\n\n    {\n      \"name\": \"HUVEC_Transcribed.bed.gz\",\n      \"position\": [\n        108,\n        8\n      ],\n      \"type\": \"bed\"\n    },\n\n    {\n      \"name\": \"IMR90_ConstitutiveHet.bed.gz\",\n      \"position\": [\n        109,\n        1\n      ],\n      \"type\": \"bed\"\n    },\n\n    {\n      \"name\": \"IMR90_FacultativeHet.bed.gz\",\n      \"position\": [\n        109,\n        3\n      ],\n      \"type\": \"bed\"\n    },\n\n    {\n      \"name\": \"IMR90_Promoter.bed.gz\",\n      \"position\": [\n        109,\n        5\n      ],\n      \"type\": \"bed\"\n    },\n\n    {\n      \"name\": \"IMR90_Quiescent.bed.gz\",\n      \"position\": [\n        109,\n        6\n      ],\n      \"type\": \"bed\"\n    },\n\n    {\n      \"name\": \"IMR90_RegPermissive.bed.gz\",\n      \"position\": [\n        109,\n        7\n      ],\n      \"type\": \"bed\"\n    },\n\n    {\n      \"name\": \"IMR90_Transcribed.bed.gz\",\n      \"position\": [\n        109,\n        8\n      ],\n      \"type\": \"bed\"\n    },\n\n    {\n      \"name\": \"IPS-15B_CELL_LINE_Bivalent.bed.gz\",\n      \"position\": [\n        110,\n        0\n      ],\n      \"type\": \"bed\"\n    },\n\n    {\n      \"name\": \"IPS-15B_CELL_LINE_ConstitutiveHet.bed.gz\",\n      \"position\": [\n        110,\n        1\n      ],\n      \"type\": \"bed\"\n    },\n\n    {\n      \"name\": \"IPS-15B_CELL_LINE_FacultativeHet.bed.gz\",\n      \"position\": [\n        110,\n        3\n      ],\n      \"type\": \"bed\"\n    },\n\n    {\n      \"name\": \"IPS-15B_CELL_LINE_Quiescent.bed.gz\",\n      \"position\": [\n        110,\n        6\n      ],\n      \"type\": \"bed\"\n    },\n\n    {\n      \"name\": \"IPS-15B_CELL_LINE_RegPermissive.bed.gz\",\n      \"position\": [\n        110,\n        7\n      ],\n      \"type\": \"bed\"\n    },\n\n    {\n      \"name\": \"IPS-15B_CELL_LINE_Transcribed.bed.gz\",\n      \"position\": [\n        110,\n        8\n      ],\n      \"type\": \"bed\"\n    },\n\n    {\n      \"name\": \"IPS-18_CELL_LINE_Bivalent.bed.gz\",\n      \"position\": [\n        111,\n        0\n      ],\n      \"type\": \"bed\"\n    },\n\n    {\n      \"name\": \"IPS-18_CELL_LINE_ConstitutiveHet.bed.gz\",\n      \"position\": [\n        111,\n        1\n      ],\n      \"type\": \"bed\"\n    },\n\n    {\n      \"name\": \"IPS-18_CELL_LINE_Enhancer.bed.gz\",\n      \"position\": [\n        111,\n        2\n      ],\n      \"type\": \"bed\"\n    },\n\n    {\n      \"name\": \"IPS-18_CELL_LINE_FacultativeHet.bed.gz\",\n      \"position\": [\n        111,\n        3\n      ],\n      \"type\": \"bed\"\n    },\n\n    {\n      \"name\": \"IPS-18_CELL_LINE_Quiescent.bed.gz\",\n      \"position\": [\n        111,\n        6\n      ],\n      \"type\": \"bed\"\n    },\n\n    {\n      \"name\": \"IPS-18_CELL_LINE_Transcribed.bed.gz\",\n      \"position\": [\n        111,\n        8\n      ],\n      \"type\": \"bed\"\n    },\n\n    {\n      \"name\": \"IPS-20B_CELL_LINE_Bivalent.bed.gz\",\n      \"position\": [\n        112,\n        0\n      ],\n      \"type\": \"bed\"\n    },\n\n    {\n      \"name\": \"IPS-20B_CELL_LINE_ConstitutiveHet.bed.gz\",\n      \"position\": [\n        112,\n        1\n      ],\n      \"type\": \"bed\"\n    },\n\n    {\n      \"name\": \"IPS-20B_CELL_LINE_FacultativeHet.bed.gz\",\n      \"position\": [\n        112,\n        3\n      ],\n      \"type\": \"bed\"\n    },\n\n    {\n      \"name\": \"IPS-20B_CELL_LINE_LowConfidence.bed.gz\",\n      \"position\": [\n        112,\n        4\n      ],\n      \"type\": \"bed\"\n    },\n\n    {\n      \"name\": \"IPS-20B_CELL_LINE_Promoter.bed.gz\",\n      \"position\": [\n        112,\n        5\n      ],\n      \"type\": \"bed\"\n    },\n\n    {\n      \"name\": \"IPS-20B_CELL_LINE_Quiescent.bed.gz\",\n      \"position\": [\n        112,\n        6\n      ],\n      \"type\": \"bed\"\n    },\n\n    {\n      \"name\": \"IPS-20B_CELL_LINE_Transcribed.bed.gz\",\n      \"position\": [\n        112,\n        8\n      ],\n      \"type\": \"bed\"\n    },\n\n    {\n      \"name\": \"IPS_DF_19_Bivalent.bed.gz\",\n      \"position\": [\n        113,\n        0\n      ],\n      \"type\": \"bed\"\n    },\n\n    {\n      \"name\": \"IPS_DF_19_Enhancer.bed.gz\",\n      \"position\": [\n        113,\n        2\n      ],\n      \"type\": \"bed\"\n    },\n\n    {\n      \"name\": \"IPS_DF_19_LowConfidence.bed.gz\",\n      \"position\": [\n        113,\n        4\n      ],\n      \"type\": \"bed\"\n    },\n\n    {\n      \"name\": \"IPS_DF_19_Promoter.bed.gz\",\n      \"position\": [\n        113,\n        5\n      ],\n      \"type\": \"bed\"\n    },\n\n    {\n      \"name\": \"IPS_DF_19_Quiescent.bed.gz\",\n      \"position\": [\n        113,\n        6\n      ],\n      \"type\": \"bed\"\n    },\n\n    {\n      \"name\": \"IPS_DF_19_RegPermissive.bed.gz\",\n      \"position\": [\n        113,\n        7\n      ],\n      \"type\": \"bed\"\n    },\n\n    {\n      \"name\": \"IPS_DF_19_Transcribed.bed.gz\",\n      \"position\": [\n        113,\n        8\n      ],\n      \"type\": \"bed\"\n    },\n\n    {\n      \"name\": \"IPS_DF_6_Bivalent.bed.gz\",\n      \"position\": [\n        114,\n        0\n      ],\n      \"type\": \"bed\"\n    },\n\n    {\n      \"name\": \"IPS_DF_6_ConstitutiveHet.bed.gz\",\n      \"position\": [\n        114,\n        1\n      ],\n      \"type\": \"bed\"\n    },\n\n    {\n      \"name\": \"IPS_DF_6_Enhancer.bed.gz\",\n      \"position\": [\n        114,\n        2\n      ],\n      \"type\": \"bed\"\n    },\n\n    {\n      \"name\": \"IPS_DF_6_FacultativeHet.bed.gz\",\n      \"position\": [\n        114,\n        3\n      ],\n      \"type\": \"bed\"\n    },\n\n    {\n      \"name\": \"IPS_DF_6_LowConfidence.bed.gz\",\n      \"position\": [\n        114,\n        4\n      ],\n      \"type\": \"bed\"\n    },\n\n    {\n      \"name\": \"IPS_DF_6_Promoter.bed.gz\",\n      \"position\": [\n        114,\n        5\n      ],\n      \"type\": \"bed\"\n    },\n\n    {\n      \"name\": \"IPS_DF_6_Quiescent.bed.gz\",\n      \"position\": [\n        114,\n        6\n      ],\n      \"type\": \"bed\"\n    },\n\n    {\n      \"name\": \"IPS_DF_6_RegPermissive.bed.gz\",\n      \"position\": [\n        114,\n        7\n      ],\n      \"type\": \"bed\"\n    },\n\n    {\n      \"name\": \"IPS_DF_6_Transcribed.bed.gz\",\n      \"position\": [\n        114,\n        8\n      ],\n      \"type\": \"bed\"\n    },\n\n    {\n      \"name\": \"K562_Bivalent.bed.gz\",\n      \"position\": [\n        115,\n        0\n      ],\n      \"type\": \"bed\"\n    },\n\n    {\n      \"name\": \"K562_ConstitutiveHet.bed.gz\",\n      \"position\": [\n        115,\n        1\n      ],\n      \"type\": \"bed\"\n    },\n\n    {\n      \"name\": \"K562_FacultativeHet.bed.gz\",\n      \"position\": [\n        115,\n        3\n      ],\n      \"type\": \"bed\"\n    },\n\n    {\n      \"name\": \"K562_LowConfidence.bed.gz\",\n      \"position\": [\n        115,\n        4\n      ],\n      \"type\": \"bed\"\n    },\n\n    {\n      \"name\": \"K562_Promoter.bed.gz\",\n      \"position\": [\n        115,\n        5\n      ],\n      \"type\": \"bed\"\n    },\n\n    {\n      \"name\": \"K562_Quiescent.bed.gz\",\n      \"position\": [\n        115,\n        6\n      ],\n      \"type\": \"bed\"\n    },\n\n    {\n      \"name\": \"K562_RegPermissive.bed.gz\",\n      \"position\": [\n        115,\n        7\n      ],\n      \"type\": \"bed\"\n    },\n\n    {\n      \"name\": \"K562_Transcribed.bed.gz\",\n      \"position\": [\n        115,\n        8\n      ],\n      \"type\": \"bed\"\n    },\n\n    {\n      \"name\": \"LEFT_VENTRICLE_Bivalent.bed.gz\",\n      \"position\": [\n        116,\n        0\n      ],\n      \"type\": \"bed\"\n    },\n\n    {\n      \"name\": \"LEFT_VENTRICLE_ConstitutiveHet.bed.gz\",\n      \"position\": [\n        116,\n        1\n      ],\n      \"type\": \"bed\"\n    },\n\n    {\n      \"name\": \"LEFT_VENTRICLE_Enhancer.bed.gz\",\n      \"position\": [\n        116,\n        2\n      ],\n      \"type\": \"bed\"\n    },\n\n    {\n      \"name\": \"LEFT_VENTRICLE_FacultativeHet.bed.gz\",\n      \"position\": [\n        116,\n        3\n      ],\n      \"type\": \"bed\"\n    },\n\n    {\n      \"name\": \"LEFT_VENTRICLE_Promoter.bed.gz\",\n      \"position\": [\n        116,\n        5\n      ],\n      \"type\": \"bed\"\n    },\n\n    {\n      \"name\": \"LEFT_VENTRICLE_Quiescent.bed.gz\",\n      \"position\": [\n        116,\n        6\n      ],\n      \"type\": \"bed\"\n    },\n\n    {\n      \"name\": \"LEFT_VENTRICLE_RegPermissive.bed.gz\",\n      \"position\": [\n        116,\n        7\n      ],\n      \"type\": \"bed\"\n    },\n\n    {\n      \"name\": \"LEFT_VENTRICLE_Transcribed.bed.gz\",\n      \"position\": [\n        116,\n        8\n      ],\n      \"type\": \"bed\"\n    },\n\n    {\n      \"name\": \"LHCN-M2_ConstitutiveHet.bed.gz\",\n      \"position\": [\n        117,\n        1\n      ],\n      \"type\": \"bed\"\n    },\n\n    {\n      \"name\": \"LHCN-M2_Enhancer.bed.gz\",\n      \"position\": [\n        117,\n        2\n      ],\n      \"type\": \"bed\"\n    },\n\n    {\n      \"name\": \"LHCN-M2_FacultativeHet.bed.gz\",\n      \"position\": [\n        117,\n        3\n      ],\n      \"type\": \"bed\"\n    },\n\n    {\n      \"name\": \"LHCN-M2_Quiescent.bed.gz\",\n      \"position\": [\n        117,\n        6\n      ],\n      \"type\": \"bed\"\n    },\n\n    {\n      \"name\": \"LHCN-M2_RegPermissive.bed.gz\",\n      \"position\": [\n        117,\n        7\n      ],\n      \"type\": \"bed\"\n    },\n\n    {\n      \"name\": \"LHCN-M2_Transcribed.bed.gz\",\n      \"position\": [\n        117,\n        8\n      ],\n      \"type\": \"bed\"\n    },\n\n    {\n      \"name\": \"MCF-7_Promoter.bed.gz\",\n      \"position\": [\n        118,\n        5\n      ],\n      \"type\": \"bed\"\n    },\n\n    {\n      \"name\": \"MCF-7_Quiescent.bed.gz\",\n      \"position\": [\n        118,\n        6\n      ],\n      \"type\": \"bed\"\n    },\n\n    {\n      \"name\": \"MCF-7_RegPermissive.bed.gz\",\n      \"position\": [\n        118,\n        7\n      ],\n      \"type\": \"bed\"\n    },\n\n    {\n      \"name\": \"MCF-7_Transcribed.bed.gz\",\n      \"position\": [\n        118,\n        8\n      ],\n      \"type\": \"bed\"\n    },\n\n    {\n      \"name\": \"MESENCHYMAL_STEM_CELL_DERIVED_ADIPOCYTE_CULTURED_CELLS_ConstitutiveHet.bed.gz\",\n      \"position\": [\n        119,\n        1\n      ],\n      \"type\": \"bed\"\n    },\n\n    {\n      \"name\": \"MESENCHYMAL_STEM_CELL_DERIVED_ADIPOCYTE_CULTURED_CELLS_FacultativeHet.bed.gz\",\n      \"position\": [\n        119,\n        3\n      ],\n      \"type\": \"bed\"\n    },\n\n    {\n      \"name\": \"MESENCHYMAL_STEM_CELL_DERIVED_ADIPOCYTE_CULTURED_CELLS_Promoter.bed.gz\",\n      \"position\": [\n        119,\n        5\n      ],\n      \"type\": \"bed\"\n    },\n\n    {\n      \"name\": \"MESENCHYMAL_STEM_CELL_DERIVED_ADIPOCYTE_CULTURED_CELLS_Quiescent.bed.gz\",\n      \"position\": [\n        119,\n        6\n      ],\n      \"type\": \"bed\"\n    },\n\n    {\n      \"name\": \"MESENCHYMAL_STEM_CELL_DERIVED_ADIPOCYTE_CULTURED_CELLS_RegPermissive.bed.gz\",\n      \"position\": [\n        119,\n        7\n      ],\n      \"type\": \"bed\"\n    },\n\n    {\n      \"name\": \"MESENCHYMAL_STEM_CELL_DERIVED_ADIPOCYTE_CULTURED_CELLS_Transcribed.bed.gz\",\n      \"position\": [\n        119,\n        8\n      ],\n      \"type\": \"bed\"\n    },\n\n    {\n      \"name\": \"MOBILIZED_CD34_PRIMARY_CELLS_FEMALE_Bivalent.bed.gz\",\n      \"position\": [\n        120,\n        0\n      ],\n      \"type\": \"bed\"\n    },\n\n    {\n      \"name\": \"MOBILIZED_CD34_PRIMARY_CELLS_FEMALE_ConstitutiveHet.bed.gz\",\n      \"position\": [\n        120,\n        1\n      ],\n      \"type\": \"bed\"\n    },\n\n    {\n      \"name\": \"MOBILIZED_CD34_PRIMARY_CELLS_FEMALE_Enhancer.bed.gz\",\n      \"position\": [\n        120,\n        2\n      ],\n      \"type\": \"bed\"\n    },\n\n    {\n      \"name\": \"MOBILIZED_CD34_PRIMARY_CELLS_FEMALE_FacultativeHet.bed.gz\",\n      \"position\": [\n        120,\n        3\n      ],\n      \"type\": \"bed\"\n    },\n\n    {\n      \"name\": \"MOBILIZED_CD34_PRIMARY_CELLS_FEMALE_Promoter.bed.gz\",\n      \"position\": [\n        120,\n        5\n      ],\n      \"type\": \"bed\"\n    },\n\n    {\n      \"name\": \"MOBILIZED_CD34_PRIMARY_CELLS_FEMALE_Quiescent.bed.gz\",\n      \"position\": [\n        120,\n        6\n      ],\n      \"type\": \"bed\"\n    },\n\n    {\n      \"name\": \"MOBILIZED_CD34_PRIMARY_CELLS_FEMALE_Transcribed.bed.gz\",\n      \"position\": [\n        120,\n        8\n      ],\n      \"type\": \"bed\"\n    },\n\n    {\n      \"name\": \"MOBILIZED_CD34_PRIMARY_CELLS_MALE_Bivalent.bed.gz\",\n      \"position\": [\n        121,\n        0\n      ],\n      \"type\": \"bed\"\n    },\n\n    {\n      \"name\": \"MOBILIZED_CD34_PRIMARY_CELLS_MALE_ConstitutiveHet.bed.gz\",\n      \"position\": [\n        121,\n        1\n      ],\n      \"type\": \"bed\"\n    },\n\n    {\n      \"name\": \"MOBILIZED_CD34_PRIMARY_CELLS_MALE_Enhancer.bed.gz\",\n      \"position\": [\n        121,\n        2\n      ],\n      \"type\": \"bed\"\n    },\n\n    {\n      \"name\": \"MOBILIZED_CD34_PRIMARY_CELLS_MALE_FacultativeHet.bed.gz\",\n      \"position\": [\n        121,\n        3\n      ],\n      \"type\": \"bed\"\n    },\n\n    {\n      \"name\": \"MOBILIZED_CD34_PRIMARY_CELLS_MALE_Promoter.bed.gz\",\n      \"position\": [\n        121,\n        5\n      ],\n      \"type\": \"bed\"\n    },\n\n    {\n      \"name\": \"MOBILIZED_CD34_PRIMARY_CELLS_MALE_Quiescent.bed.gz\",\n      \"position\": [\n        121,\n        6\n      ],\n      \"type\": \"bed\"\n    },\n\n    {\n      \"name\": \"MOBILIZED_CD34_PRIMARY_CELLS_MALE_RegPermissive.bed.gz\",\n      \"position\": [\n        121,\n        7\n      ],\n      \"type\": \"bed\"\n    },\n\n    {\n      \"name\": \"MOBILIZED_CD34_PRIMARY_CELLS_MALE_Transcribed.bed.gz\",\n      \"position\": [\n        121,\n        8\n      ],\n      \"type\": \"bed\"\n    },\n\n    {\n      \"name\": \"MONOCYTES-CD14+_RO01746_Bivalent.bed.gz\",\n      \"position\": [\n        122,\n        0\n      ],\n      \"type\": \"bed\"\n    },\n\n    {\n      \"name\": \"MONOCYTES-CD14+_RO01746_Enhancer.bed.gz\",\n      \"position\": [\n        122,\n        2\n      ],\n      \"type\": \"bed\"\n    },\n\n    {\n      \"name\": \"MONOCYTES-CD14+_RO01746_FacultativeHet.bed.gz\",\n      \"position\": [\n        122,\n        3\n      ],\n      \"type\": \"bed\"\n    },\n\n    {\n      \"name\": \"MONOCYTES-CD14+_RO01746_Promoter.bed.gz\",\n      \"position\": [\n        122,\n        5\n      ],\n      \"type\": \"bed\"\n    },\n\n    {\n      \"name\": \"MONOCYTES-CD14+_RO01746_Quiescent.bed.gz\",\n      \"position\": [\n        122,\n        6\n      ],\n      \"type\": \"bed\"\n    },\n\n    {\n      \"name\": \"MONOCYTES-CD14+_RO01746_RegPermissive.bed.gz\",\n      \"position\": [\n        122,\n        7\n      ],\n      \"type\": \"bed\"\n    },\n\n    {\n      \"name\": \"MONOCYTES-CD14+_RO01746_Transcribed.bed.gz\",\n      \"position\": [\n        122,\n        8\n      ],\n      \"type\": \"bed\"\n    },\n\n    {\n      \"name\": \"NB4_Enhancer.bed.gz\",\n      \"position\": [\n        123,\n        2\n      ],\n      \"type\": \"bed\"\n    },\n\n    {\n      \"name\": \"NB4_LowConfidence.bed.gz\",\n      \"position\": [\n        123,\n        4\n      ],\n      \"type\": \"bed\"\n    },\n\n    {\n      \"name\": \"NB4_Promoter.bed.gz\",\n      \"position\": [\n        123,\n        5\n      ],\n      \"type\": \"bed\"\n    },\n\n    {\n      \"name\": \"NB4_Quiescent.bed.gz\",\n      \"position\": [\n        123,\n        6\n      ],\n      \"type\": \"bed\"\n    },\n\n    {\n      \"name\": \"NB4_Transcribed.bed.gz\",\n      \"position\": [\n        123,\n        8\n      ],\n      \"type\": \"bed\"\n    },\n\n    {\n      \"name\": \"NH-A_Bivalent.bed.gz\",\n      \"position\": [\n        124,\n        0\n      ],\n      \"type\": \"bed\"\n    },\n\n    {\n      \"name\": \"NH-A_ConstitutiveHet.bed.gz\",\n      \"position\": [\n        124,\n        1\n      ],\n      \"type\": \"bed\"\n    },\n\n    {\n      \"name\": \"NH-A_Enhancer.bed.gz\",\n      \"position\": [\n        124,\n        2\n      ],\n      \"type\": \"bed\"\n    },\n\n    {\n      \"name\": \"NH-A_FacultativeHet.bed.gz\",\n      \"position\": [\n        124,\n        3\n      ],\n      \"type\": \"bed\"\n    },\n\n    {\n      \"name\": \"NH-A_Promoter.bed.gz\",\n      \"position\": [\n        124,\n        5\n      ],\n      \"type\": \"bed\"\n    },\n\n    {\n      \"name\": \"NH-A_Quiescent.bed.gz\",\n      \"position\": [\n        124,\n        6\n      ],\n      \"type\": \"bed\"\n    },\n\n    {\n      \"name\": \"NH-A_RegPermissive.bed.gz\",\n      \"position\": [\n        124,\n        7\n      ],\n      \"type\": \"bed\"\n    },\n\n    {\n      \"name\": \"NH-A_Transcribed.bed.gz\",\n      \"position\": [\n        124,\n        8\n      ],\n      \"type\": \"bed\"\n    },\n\n    {\n      \"name\": \"NHDF-AD_Bivalent.bed.gz\",\n      \"position\": [\n        125,\n        0\n      ],\n      \"type\": \"bed\"\n    },\n\n    {\n      \"name\": \"NHDF-AD_ConstitutiveHet.bed.gz\",\n      \"position\": [\n        125,\n        1\n      ],\n      \"type\": \"bed\"\n    },\n\n    {\n      \"name\": \"NHDF-AD_Enhancer.bed.gz\",\n      \"position\": [\n        125,\n        2\n      ],\n      \"type\": \"bed\"\n    },\n\n    {\n      \"name\": \"NHDF-AD_FacultativeHet.bed.gz\",\n      \"position\": [\n        125,\n        3\n      ],\n      \"type\": \"bed\"\n    },\n\n    {\n      \"name\": \"NHDF-AD_LowConfidence.bed.gz\",\n      \"position\": [\n        125,\n        4\n      ],\n      \"type\": \"bed\"\n    },\n\n    {\n      \"name\": \"NHDF-AD_Quiescent.bed.gz\",\n      \"position\": [\n        125,\n        6\n      ],\n      \"type\": \"bed\"\n    },\n\n    {\n      \"name\": \"NHDF-AD_RegPermissive.bed.gz\",\n      \"position\": [\n        125,\n        7\n      ],\n      \"type\": \"bed\"\n    },\n\n    {\n      \"name\": \"NHDF-AD_Transcribed.bed.gz\",\n      \"position\": [\n        125,\n        8\n      ],\n      \"type\": \"bed\"\n    },\n\n    {\n      \"name\": \"NHDF-NEO_Enhancer.bed.gz\",\n      \"position\": [\n        126,\n        2\n      ],\n      \"type\": \"bed\"\n    },\n\n    {\n      \"name\": \"NHDF-NEO_FacultativeHet.bed.gz\",\n      \"position\": [\n        126,\n        3\n      ],\n      \"type\": \"bed\"\n    },\n\n    {\n      \"name\": \"NHDF-NEO_LowConfidence.bed.gz\",\n      \"position\": [\n        126,\n        4\n      ],\n      \"type\": \"bed\"\n    },\n\n    {\n      \"name\": \"NHDF-NEO_Promoter.bed.gz\",\n      \"position\": [\n        126,\n        5\n      ],\n      \"type\": \"bed\"\n    },\n\n    {\n      \"name\": \"NHDF-NEO_Quiescent.bed.gz\",\n      \"position\": [\n        126,\n        6\n      ],\n      \"type\": \"bed\"\n    },\n\n    {\n      \"name\": \"NHDF-NEO_Transcribed.bed.gz\",\n      \"position\": [\n        126,\n        8\n      ],\n      \"type\": \"bed\"\n    },\n\n    {\n      \"name\": \"NHEK_Enhancer.bed.gz\",\n      \"position\": [\n        127,\n        2\n      ],\n      \"type\": \"bed\"\n    },\n\n    {\n      \"name\": \"NHEK_Promoter.bed.gz\",\n      \"position\": [\n        127,\n        5\n      ],\n      \"type\": \"bed\"\n    },\n\n    {\n      \"name\": \"NHEK_Quiescent.bed.gz\",\n      \"position\": [\n        127,\n        6\n      ],\n      \"type\": \"bed\"\n    },\n\n    {\n      \"name\": \"NHEK_Transcribed.bed.gz\",\n      \"position\": [\n        127,\n        8\n      ],\n      \"type\": \"bed\"\n    },\n\n    {\n      \"name\": \"NHLF_Bivalent.bed.gz\",\n      \"position\": [\n        128,\n        0\n      ],\n      \"type\": \"bed\"\n    },\n\n    {\n      \"name\": \"NHLF_ConstitutiveHet.bed.gz\",\n      \"position\": [\n        128,\n        1\n      ],\n      \"type\": \"bed\"\n    },\n\n    {\n      \"name\": \"NHLF_Enhancer.bed.gz\",\n      \"position\": [\n        128,\n        2\n      ],\n      \"type\": \"bed\"\n    },\n\n    {\n      \"name\": \"NHLF_FacultativeHet.bed.gz\",\n      \"position\": [\n        128,\n        3\n      ],\n      \"type\": \"bed\"\n    },\n\n    {\n      \"name\": \"NHLF_Promoter.bed.gz\",\n      \"position\": [\n        128,\n        5\n      ],\n      \"type\": \"bed\"\n    },\n\n    {\n      \"name\": \"NHLF_Quiescent.bed.gz\",\n      \"position\": [\n        128,\n        6\n      ],\n      \"type\": \"bed\"\n    },\n\n    {\n      \"name\": \"NHLF_RegPermissive.bed.gz\",\n      \"position\": [\n        128,\n        7\n      ],\n      \"type\": \"bed\"\n    },\n\n    {\n      \"name\": \"NHLF_Transcribed.bed.gz\",\n      \"position\": [\n        128,\n        8\n      ],\n      \"type\": \"bed\"\n    },\n\n    {\n      \"name\": \"NT2-D1_Bivalent.bed.gz\",\n      \"position\": [\n        129,\n        0\n      ],\n      \"type\": \"bed\"\n    },\n\n    {\n      \"name\": \"NT2-D1_LowConfidence.bed.gz\",\n      \"position\": [\n        129,\n        4\n      ],\n      \"type\": \"bed\"\n    },\n\n    {\n      \"name\": \"NT2-D1_Promoter.bed.gz\",\n      \"position\": [\n        129,\n        5\n      ],\n      \"type\": \"bed\"\n    },\n\n    {\n      \"name\": \"NT2-D1_Quiescent.bed.gz\",\n      \"position\": [\n        129,\n        6\n      ],\n      \"type\": \"bed\"\n    },\n\n    {\n      \"name\": \"NT2-D1_RegPermissive.bed.gz\",\n      \"position\": [\n        129,\n        7\n      ],\n      \"type\": \"bed\"\n    },\n\n    {\n      \"name\": \"OSTEOBL_Bivalent.bed.gz\",\n      \"position\": [\n        130,\n        0\n      ],\n      \"type\": \"bed\"\n    },\n\n    {\n      \"name\": \"OSTEOBL_ConstitutiveHet.bed.gz\",\n      \"position\": [\n        130,\n        1\n      ],\n      \"type\": \"bed\"\n    },\n\n    {\n      \"name\": \"OSTEOBL_Enhancer.bed.gz\",\n      \"position\": [\n        130,\n        2\n      ],\n      \"type\": \"bed\"\n    },\n\n    {\n      \"name\": \"OSTEOBL_FacultativeHet.bed.gz\",\n      \"position\": [\n        130,\n        3\n      ],\n      \"type\": \"bed\"\n    },\n\n    {\n      \"name\": \"OSTEOBL_Quiescent.bed.gz\",\n      \"position\": [\n        130,\n        6\n      ],\n      \"type\": \"bed\"\n    },\n\n    {\n      \"name\": \"OSTEOBL_Transcribed.bed.gz\",\n      \"position\": [\n        130,\n        8\n      ],\n      \"type\": \"bed\"\n    },\n\n    {\n      \"name\": \"OVARY_Bivalent.bed.gz\",\n      \"position\": [\n        131,\n        0\n      ],\n      \"type\": \"bed\"\n    },\n\n    {\n      \"name\": \"OVARY_ConstitutiveHet.bed.gz\",\n      \"position\": [\n        131,\n        1\n      ],\n      \"type\": \"bed\"\n    },\n\n    {\n      \"name\": \"OVARY_Enhancer.bed.gz\",\n      \"position\": [\n        131,\n        2\n      ],\n      \"type\": \"bed\"\n    },\n\n    {\n      \"name\": \"OVARY_FacultativeHet.bed.gz\",\n      \"position\": [\n        131,\n        3\n      ],\n      \"type\": \"bed\"\n    },\n\n    {\n      \"name\": \"OVARY_LowConfidence.bed.gz\",\n      \"position\": [\n        131,\n        4\n      ],\n      \"type\": \"bed\"\n    },\n\n    {\n      \"name\": \"OVARY_Quiescent.bed.gz\",\n      \"position\": [\n        131,\n        6\n      ],\n      \"type\": \"bed\"\n    },\n\n    {\n      \"name\": \"OVARY_RegPermissive.bed.gz\",\n      \"position\": [\n        131,\n        7\n      ],\n      \"type\": \"bed\"\n    },\n\n    {\n      \"name\": \"OVARY_Transcribed.bed.gz\",\n      \"position\": [\n        131,\n        8\n      ],\n      \"type\": \"bed\"\n    },\n\n    {\n      \"name\": \"PANC-1_Enhancer.bed.gz\",\n      \"position\": [\n        132,\n        2\n      ],\n      \"type\": \"bed\"\n    },\n\n    {\n      \"name\": \"PANC-1_FacultativeHet.bed.gz\",\n      \"position\": [\n        132,\n        3\n      ],\n      \"type\": \"bed\"\n    },\n\n    {\n      \"name\": \"PANC-1_LowConfidence.bed.gz\",\n      \"position\": [\n        132,\n        4\n      ],\n      \"type\": \"bed\"\n    },\n\n    {\n      \"name\": \"PANC-1_Promoter.bed.gz\",\n      \"position\": [\n        132,\n        5\n      ],\n      \"type\": \"bed\"\n    },\n\n    {\n      \"name\": \"PANC-1_Quiescent.bed.gz\",\n      \"position\": [\n        132,\n        6\n      ],\n      \"type\": \"bed\"\n    },\n\n    {\n      \"name\": \"PANC-1_RegPermissive.bed.gz\",\n      \"position\": [\n        132,\n        7\n      ],\n      \"type\": \"bed\"\n    },\n\n    {\n      \"name\": \"PANC-1_Transcribed.bed.gz\",\n      \"position\": [\n        132,\n        8\n      ],\n      \"type\": \"bed\"\n    },\n\n    {\n      \"name\": \"PANISLETS_Bivalent.bed.gz\",\n      \"position\": [\n        133,\n        0\n      ],\n      \"type\": \"bed\"\n    },\n\n    {\n      \"name\": \"PANISLETS_ConstitutiveHet.bed.gz\",\n      \"position\": [\n        133,\n        1\n      ],\n      \"type\": \"bed\"\n    },\n\n    {\n      \"name\": \"PANISLETS_Enhancer.bed.gz\",\n      \"position\": [\n        133,\n        2\n      ],\n      \"type\": \"bed\"\n    },\n\n    {\n      \"name\": \"PANISLETS_FacultativeHet.bed.gz\",\n      \"position\": [\n        133,\n        3\n      ],\n      \"type\": \"bed\"\n    },\n\n    {\n      \"name\": \"PANISLETS_Promoter.bed.gz\",\n      \"position\": [\n        133,\n        5\n      ],\n      \"type\": \"bed\"\n    },\n\n    {\n      \"name\": \"PANISLETS_Quiescent.bed.gz\",\n      \"position\": [\n        133,\n        6\n      ],\n      \"type\": \"bed\"\n    },\n\n    {\n      \"name\": \"PANISLETS_RegPermissive.bed.gz\",\n      \"position\": [\n        133,\n        7\n      ],\n      \"type\": \"bed\"\n    },\n\n    {\n      \"name\": \"PANISLETS_Transcribed.bed.gz\",\n      \"position\": [\n        133,\n        8\n      ],\n      \"type\": \"bed\"\n    },\n\n    {\n      \"name\": \"PENIS_FORESKIN_FIBROBLAST_PRIMARY_CELLS_SKIN01_Bivalent.bed.gz\",\n      \"position\": [\n        134,\n        0\n      ],\n      \"type\": \"bed\"\n    },\n\n    {\n      \"name\": \"PENIS_FORESKIN_FIBROBLAST_PRIMARY_CELLS_SKIN01_ConstitutiveHet.bed.gz\",\n      \"position\": [\n        134,\n        1\n      ],\n      \"type\": \"bed\"\n    },\n\n    {\n      \"name\": \"PENIS_FORESKIN_FIBROBLAST_PRIMARY_CELLS_SKIN01_Enhancer.bed.gz\",\n      \"position\": [\n        134,\n        2\n      ],\n      \"type\": \"bed\"\n    },\n\n    {\n      \"name\": \"PENIS_FORESKIN_FIBROBLAST_PRIMARY_CELLS_SKIN01_FacultativeHet.bed.gz\",\n      \"position\": [\n        134,\n        3\n      ],\n      \"type\": \"bed\"\n    },\n\n    {\n      \"name\": \"PENIS_FORESKIN_FIBROBLAST_PRIMARY_CELLS_SKIN01_Quiescent.bed.gz\",\n      \"position\": [\n        134,\n        6\n      ],\n      \"type\": \"bed\"\n    },\n\n    {\n      \"name\": \"PENIS_FORESKIN_FIBROBLAST_PRIMARY_CELLS_SKIN01_RegPermissive.bed.gz\",\n      \"position\": [\n        134,\n        7\n      ],\n      \"type\": \"bed\"\n    },\n\n    {\n      \"name\": \"PENIS_FORESKIN_FIBROBLAST_PRIMARY_CELLS_SKIN01_Transcribed.bed.gz\",\n      \"position\": [\n        134,\n        8\n      ],\n      \"type\": \"bed\"\n    },\n\n    {\n      \"name\": \"PENIS_FORESKIN_FIBROBLAST_PRIMARY_CELLS_SKIN02_Bivalent.bed.gz\",\n      \"position\": [\n        135,\n        0\n      ],\n      \"type\": \"bed\"\n    },\n\n    {\n      \"name\": \"PENIS_FORESKIN_FIBROBLAST_PRIMARY_CELLS_SKIN02_ConstitutiveHet.bed.gz\",\n      \"position\": [\n        135,\n        1\n      ],\n      \"type\": \"bed\"\n    },\n\n    {\n      \"name\": \"PENIS_FORESKIN_FIBROBLAST_PRIMARY_CELLS_SKIN02_Enhancer.bed.gz\",\n      \"position\": [\n        135,\n        2\n      ],\n      \"type\": \"bed\"\n    },\n\n    {\n      \"name\": \"PENIS_FORESKIN_FIBROBLAST_PRIMARY_CELLS_SKIN02_FacultativeHet.bed.gz\",\n      \"position\": [\n        135,\n        3\n      ],\n      \"type\": \"bed\"\n    },\n\n    {\n      \"name\": \"PENIS_FORESKIN_FIBROBLAST_PRIMARY_CELLS_SKIN02_LowConfidence.bed.gz\",\n      \"position\": [\n        135,\n        4\n      ],\n      \"type\": \"bed\"\n    },\n\n    {\n      \"name\": \"PENIS_FORESKIN_FIBROBLAST_PRIMARY_CELLS_SKIN02_Promoter.bed.gz\",\n      \"position\": [\n        135,\n        5\n      ],\n      \"type\": \"bed\"\n    },\n\n    {\n      \"name\": \"PENIS_FORESKIN_FIBROBLAST_PRIMARY_CELLS_SKIN02_Quiescent.bed.gz\",\n      \"position\": [\n        135,\n        6\n      ],\n      \"type\": \"bed\"\n    },\n\n    {\n      \"name\": \"PENIS_FORESKIN_FIBROBLAST_PRIMARY_CELLS_SKIN02_RegPermissive.bed.gz\",\n      \"position\": [\n        135,\n        7\n      ],\n      \"type\": \"bed\"\n    },\n\n    {\n      \"name\": \"PENIS_FORESKIN_FIBROBLAST_PRIMARY_CELLS_SKIN02_Transcribed.bed.gz\",\n      \"position\": [\n        135,\n        8\n      ],\n      \"type\": \"bed\"\n    },\n\n    {\n      \"name\": \"PENIS_FORESKIN_KERATINOCYTE_PRIMARY_CELLS_SKIN02_Bivalent.bed.gz\",\n      \"position\": [\n        136,\n        0\n      ],\n      \"type\": \"bed\"\n    },\n\n    {\n      \"name\": \"PENIS_FORESKIN_KERATINOCYTE_PRIMARY_CELLS_SKIN02_ConstitutiveHet.bed.gz\",\n      \"position\": [\n        136,\n        1\n      ],\n      \"type\": \"bed\"\n    },\n\n    {\n      \"name\": \"PENIS_FORESKIN_KERATINOCYTE_PRIMARY_CELLS_SKIN02_Enhancer.bed.gz\",\n      \"position\": [\n        136,\n        2\n      ],\n      \"type\": \"bed\"\n    },\n\n    {\n      \"name\": \"PENIS_FORESKIN_KERATINOCYTE_PRIMARY_CELLS_SKIN02_FacultativeHet.bed.gz\",\n      \"position\": [\n        136,\n        3\n      ],\n      \"type\": \"bed\"\n    },\n\n    {\n      \"name\": \"PENIS_FORESKIN_KERATINOCYTE_PRIMARY_CELLS_SKIN02_LowConfidence.bed.gz\",\n      \"position\": [\n        136,\n        4\n      ],\n      \"type\": \"bed\"\n    },\n\n    {\n      \"name\": \"PENIS_FORESKIN_KERATINOCYTE_PRIMARY_CELLS_SKIN02_Quiescent.bed.gz\",\n      \"position\": [\n        136,\n        6\n      ],\n      \"type\": \"bed\"\n    },\n\n    {\n      \"name\": \"PENIS_FORESKIN_KERATINOCYTE_PRIMARY_CELLS_SKIN02_RegPermissive.bed.gz\",\n      \"position\": [\n        136,\n        7\n      ],\n      \"type\": \"bed\"\n    },\n\n    {\n      \"name\": \"PENIS_FORESKIN_KERATINOCYTE_PRIMARY_CELLS_SKIN02_Transcribed.bed.gz\",\n      \"position\": [\n        136,\n        8\n      ],\n      \"type\": \"bed\"\n    },\n\n    {\n      \"name\": \"PENIS_FORESKIN_KERATINOCYTE_PRIMARY_CELLS_SKIN03_Bivalent.bed.gz\",\n      \"position\": [\n        137,\n        0\n      ],\n      \"type\": \"bed\"\n    },\n\n    {\n      \"name\": \"PENIS_FORESKIN_KERATINOCYTE_PRIMARY_CELLS_SKIN03_ConstitutiveHet.bed.gz\",\n      \"position\": [\n        137,\n        1\n      ],\n      \"type\": \"bed\"\n    },\n\n    {\n      \"name\": \"PENIS_FORESKIN_KERATINOCYTE_PRIMARY_CELLS_SKIN03_Enhancer.bed.gz\",\n      \"position\": [\n        137,\n        2\n      ],\n      \"type\": \"bed\"\n    },\n\n    {\n      \"name\": \"PENIS_FORESKIN_KERATINOCYTE_PRIMARY_CELLS_SKIN03_FacultativeHet.bed.gz\",\n      \"position\": [\n        137,\n        3\n      ],\n      \"type\": \"bed\"\n    },\n\n    {\n      \"name\": \"PENIS_FORESKIN_KERATINOCYTE_PRIMARY_CELLS_SKIN03_Quiescent.bed.gz\",\n      \"position\": [\n        137,\n        6\n      ],\n      \"type\": \"bed\"\n    },\n\n    {\n      \"name\": \"PENIS_FORESKIN_KERATINOCYTE_PRIMARY_CELLS_SKIN03_RegPermissive.bed.gz\",\n      \"position\": [\n        137,\n        7\n      ],\n      \"type\": \"bed\"\n    },\n\n    {\n      \"name\": \"PENIS_FORESKIN_KERATINOCYTE_PRIMARY_CELLS_SKIN03_Transcribed.bed.gz\",\n      \"position\": [\n        137,\n        8\n      ],\n      \"type\": \"bed\"\n    },\n\n    {\n      \"name\": \"PENIS_FORESKIN_MELANOCYTE_PRIMARY_CELLS_SKIN01_Bivalent.bed.gz\",\n      \"position\": [\n        138,\n        0\n      ],\n      \"type\": \"bed\"\n    },\n\n    {\n      \"name\": \"PENIS_FORESKIN_MELANOCYTE_PRIMARY_CELLS_SKIN01_ConstitutiveHet.bed.gz\",\n      \"position\": [\n        138,\n        1\n      ],\n      \"type\": \"bed\"\n    },\n\n    {\n      \"name\": \"PENIS_FORESKIN_MELANOCYTE_PRIMARY_CELLS_SKIN01_Enhancer.bed.gz\",\n      \"position\": [\n        138,\n        2\n      ],\n      \"type\": \"bed\"\n    },\n\n    {\n      \"name\": \"PENIS_FORESKIN_MELANOCYTE_PRIMARY_CELLS_SKIN01_FacultativeHet.bed.gz\",\n      \"position\": [\n        138,\n        3\n      ],\n      \"type\": \"bed\"\n    },\n\n    {\n      \"name\": \"PENIS_FORESKIN_MELANOCYTE_PRIMARY_CELLS_SKIN01_Quiescent.bed.gz\",\n      \"position\": [\n        138,\n        6\n      ],\n      \"type\": \"bed\"\n    },\n\n    {\n      \"name\": \"PENIS_FORESKIN_MELANOCYTE_PRIMARY_CELLS_SKIN01_RegPermissive.bed.gz\",\n      \"position\": [\n        138,\n        7\n      ],\n      \"type\": \"bed\"\n    },\n\n    {\n      \"name\": \"PENIS_FORESKIN_MELANOCYTE_PRIMARY_CELLS_SKIN01_Transcribed.bed.gz\",\n      \"position\": [\n        138,\n        8\n      ],\n      \"type\": \"bed\"\n    },\n\n    {\n      \"name\": \"PENIS_FORESKIN_MELANOCYTE_PRIMARY_CELLS_SKIN03_Bivalent.bed.gz\",\n      \"position\": [\n        139,\n        0\n      ],\n      \"type\": \"bed\"\n    },\n\n    {\n      \"name\": \"PENIS_FORESKIN_MELANOCYTE_PRIMARY_CELLS_SKIN03_ConstitutiveHet.bed.gz\",\n      \"position\": [\n        139,\n        1\n      ],\n      \"type\": \"bed\"\n    },\n\n    {\n      \"name\": \"PENIS_FORESKIN_MELANOCYTE_PRIMARY_CELLS_SKIN03_Enhancer.bed.gz\",\n      \"position\": [\n        139,\n        2\n      ],\n      \"type\": \"bed\"\n    },\n\n    {\n      \"name\": \"PENIS_FORESKIN_MELANOCYTE_PRIMARY_CELLS_SKIN03_FacultativeHet.bed.gz\",\n      \"position\": [\n        139,\n        3\n      ],\n      \"type\": \"bed\"\n    },\n\n    {\n      \"name\": \"PENIS_FORESKIN_MELANOCYTE_PRIMARY_CELLS_SKIN03_Quiescent.bed.gz\",\n      \"position\": [\n        139,\n        6\n      ],\n      \"type\": \"bed\"\n    },\n\n    {\n      \"name\": \"PENIS_FORESKIN_MELANOCYTE_PRIMARY_CELLS_SKIN03_RegPermissive.bed.gz\",\n      \"position\": [\n        139,\n        7\n      ],\n      \"type\": \"bed\"\n    },\n\n    {\n      \"name\": \"PENIS_FORESKIN_MELANOCYTE_PRIMARY_CELLS_SKIN03_Transcribed.bed.gz\",\n      \"position\": [\n        139,\n        8\n      ],\n      \"type\": \"bed\"\n    },\n\n    {\n      \"name\": \"PERIPHERAL_BLOOD_MONONUCLEAR_PRIMARY_CELLS_Bivalent.bed.gz\",\n      \"position\": [\n        140,\n        0\n      ],\n      \"type\": \"bed\"\n    },\n\n    {\n      \"name\": \"PERIPHERAL_BLOOD_MONONUCLEAR_PRIMARY_CELLS_ConstitutiveHet.bed.gz\",\n      \"position\": [\n        140,\n        1\n      ],\n      \"type\": \"bed\"\n    },\n\n    {\n      \"name\": \"PERIPHERAL_BLOOD_MONONUCLEAR_PRIMARY_CELLS_Promoter.bed.gz\",\n      \"position\": [\n        140,\n        5\n      ],\n      \"type\": \"bed\"\n    },\n\n    {\n      \"name\": \"PERIPHERAL_BLOOD_MONONUCLEAR_PRIMARY_CELLS_Quiescent.bed.gz\",\n      \"position\": [\n        140,\n        6\n      ],\n      \"type\": \"bed\"\n    },\n\n    {\n      \"name\": \"PERIPHERAL_BLOOD_MONONUCLEAR_PRIMARY_CELLS_RegPermissive.bed.gz\",\n      \"position\": [\n        140,\n        7\n      ],\n      \"type\": \"bed\"\n    },\n\n    {\n      \"name\": \"PERIPHERAL_BLOOD_MONONUCLEAR_PRIMARY_CELLS_Transcribed.bed.gz\",\n      \"position\": [\n        140,\n        8\n      ],\n      \"type\": \"bed\"\n    },\n\n    {\n      \"name\": \"PLACENTA_AMNION_ConstitutiveHet.bed.gz\",\n      \"position\": [\n        141,\n        1\n      ],\n      \"type\": \"bed\"\n    },\n\n    {\n      \"name\": \"PLACENTA_AMNION_Enhancer.bed.gz\",\n      \"position\": [\n        141,\n        2\n      ],\n      \"type\": \"bed\"\n    },\n\n    {\n      \"name\": \"PLACENTA_AMNION_FacultativeHet.bed.gz\",\n      \"position\": [\n        141,\n        3\n      ],\n      \"type\": \"bed\"\n    },\n\n    {\n      \"name\": \"PLACENTA_AMNION_Promoter.bed.gz\",\n      \"position\": [\n        141,\n        5\n      ],\n      \"type\": \"bed\"\n    },\n\n    {\n      \"name\": \"PLACENTA_AMNION_Quiescent.bed.gz\",\n      \"position\": [\n        141,\n        6\n      ],\n      \"type\": \"bed\"\n    },\n\n    {\n      \"name\": \"PLACENTA_AMNION_Transcribed.bed.gz\",\n      \"position\": [\n        141,\n        8\n      ],\n      \"type\": \"bed\"\n    },\n\n    {\n      \"name\": \"PROGFIB_Bivalent.bed.gz\",\n      \"position\": [\n        142,\n        0\n      ],\n      \"type\": \"bed\"\n    },\n\n    {\n      \"name\": \"PROGFIB_LowConfidence.bed.gz\",\n      \"position\": [\n        142,\n        4\n      ],\n      \"type\": \"bed\"\n    },\n\n    {\n      \"name\": \"PROGFIB_Promoter.bed.gz\",\n      \"position\": [\n        142,\n        5\n      ],\n      \"type\": \"bed\"\n    },\n\n    {\n      \"name\": \"PROGFIB_Quiescent.bed.gz\",\n      \"position\": [\n        142,\n        6\n      ],\n      \"type\": \"bed\"\n    },\n\n    {\n      \"name\": \"PROGFIB_Transcribed.bed.gz\",\n      \"position\": [\n        142,\n        8\n      ],\n      \"type\": \"bed\"\n    },\n\n    {\n      \"name\": \"PSOAS_MUSCLE_OC_Bivalent.bed.gz\",\n      \"position\": [\n        143,\n        0\n      ],\n      \"type\": \"bed\"\n    },\n\n    {\n      \"name\": \"PSOAS_MUSCLE_OC_ConstitutiveHet.bed.gz\",\n      \"position\": [\n        143,\n        1\n      ],\n      \"type\": \"bed\"\n    },\n\n    {\n      \"name\": \"PSOAS_MUSCLE_OC_Enhancer.bed.gz\",\n      \"position\": [\n        143,\n        2\n      ],\n      \"type\": \"bed\"\n    },\n\n    {\n      \"name\": \"PSOAS_MUSCLE_OC_FacultativeHet.bed.gz\",\n      \"position\": [\n        143,\n        3\n      ],\n      \"type\": \"bed\"\n    },\n\n    {\n      \"name\": \"PSOAS_MUSCLE_OC_Promoter.bed.gz\",\n      \"position\": [\n        143,\n        5\n      ],\n      \"type\": \"bed\"\n    },\n\n    {\n      \"name\": \"PSOAS_MUSCLE_OC_Quiescent.bed.gz\",\n      \"position\": [\n        143,\n        6\n      ],\n      \"type\": \"bed\"\n    },\n\n    {\n      \"name\": \"PSOAS_MUSCLE_OC_Transcribed.bed.gz\",\n      \"position\": [\n        143,\n        8\n      ],\n      \"type\": \"bed\"\n    },\n\n    {\n      \"name\": \"RECTAL_MUCOSA_Bivalent.bed.gz\",\n      \"position\": [\n        144,\n        0\n      ],\n      \"type\": \"bed\"\n    },\n\n    {\n      \"name\": \"RECTAL_MUCOSA_ConstitutiveHet.bed.gz\",\n      \"position\": [\n        144,\n        1\n      ],\n      \"type\": \"bed\"\n    },\n\n    {\n      \"name\": \"RECTAL_MUCOSA_Enhancer.bed.gz\",\n      \"position\": [\n        144,\n        2\n      ],\n      \"type\": \"bed\"\n    },\n\n    {\n      \"name\": \"RECTAL_MUCOSA_FacultativeHet.bed.gz\",\n      \"position\": [\n        144,\n        3\n      ],\n      \"type\": \"bed\"\n    },\n\n    {\n      \"name\": \"RECTAL_MUCOSA_Promoter.bed.gz\",\n      \"position\": [\n        144,\n        5\n      ],\n      \"type\": \"bed\"\n    },\n\n    {\n      \"name\": \"RECTAL_MUCOSA_Quiescent.bed.gz\",\n      \"position\": [\n        144,\n        6\n      ],\n      \"type\": \"bed\"\n    },\n\n    {\n      \"name\": \"RECTAL_MUCOSA_RegPermissive.bed.gz\",\n      \"position\": [\n        144,\n        7\n      ],\n      \"type\": \"bed\"\n    },\n\n    {\n      \"name\": \"RECTAL_MUCOSA_Transcribed.bed.gz\",\n      \"position\": [\n        144,\n        8\n      ],\n      \"type\": \"bed\"\n    },\n\n    {\n      \"name\": \"RECTAL_SMOOTH_MUSCLE_ConstitutiveHet.bed.gz\",\n      \"position\": [\n        145,\n        1\n      ],\n      \"type\": \"bed\"\n    },\n\n    {\n      \"name\": \"RECTAL_SMOOTH_MUSCLE_Enhancer.bed.gz\",\n      \"position\": [\n        145,\n        2\n      ],\n      \"type\": \"bed\"\n    },\n\n    {\n      \"name\": \"RECTAL_SMOOTH_MUSCLE_FacultativeHet.bed.gz\",\n      \"position\": [\n        145,\n        3\n      ],\n      \"type\": \"bed\"\n    },\n\n    {\n      \"name\": \"RECTAL_SMOOTH_MUSCLE_Quiescent.bed.gz\",\n      \"position\": [\n        145,\n        6\n      ],\n      \"type\": \"bed\"\n    },\n\n    {\n      \"name\": \"RECTAL_SMOOTH_MUSCLE_RegPermissive.bed.gz\",\n      \"position\": [\n        145,\n        7\n      ],\n      \"type\": \"bed\"\n    },\n\n    {\n      \"name\": \"RECTAL_SMOOTH_MUSCLE_Transcribed.bed.gz\",\n      \"position\": [\n        145,\n        8\n      ],\n      \"type\": \"bed\"\n    },\n\n    {\n      \"name\": \"RIGHT_ATRIUM_ConstitutiveHet.bed.gz\",\n      \"position\": [\n        146,\n        1\n      ],\n      \"type\": \"bed\"\n    },\n\n    {\n      \"name\": \"RIGHT_ATRIUM_Enhancer.bed.gz\",\n      \"position\": [\n        146,\n        2\n      ],\n      \"type\": \"bed\"\n    },\n\n    {\n      \"name\": \"RIGHT_ATRIUM_FacultativeHet.bed.gz\",\n      \"position\": [\n        146,\n        3\n      ],\n      \"type\": \"bed\"\n    },\n\n    {\n      \"name\": \"RIGHT_ATRIUM_LowConfidence.bed.gz\",\n      \"position\": [\n        146,\n        4\n      ],\n      \"type\": \"bed\"\n    },\n\n    {\n      \"name\": \"RIGHT_ATRIUM_Quiescent.bed.gz\",\n      \"position\": [\n        146,\n        6\n      ],\n      \"type\": \"bed\"\n    },\n\n    {\n      \"name\": \"RIGHT_ATRIUM_RegPermissive.bed.gz\",\n      \"position\": [\n        146,\n        7\n      ],\n      \"type\": \"bed\"\n    },\n\n    {\n      \"name\": \"RIGHT_ATRIUM_Transcribed.bed.gz\",\n      \"position\": [\n        146,\n        8\n      ],\n      \"type\": \"bed\"\n    },\n\n    {\n      \"name\": \"RIGHT_VENTRICLE_Bivalent.bed.gz\",\n      \"position\": [\n        147,\n        0\n      ],\n      \"type\": \"bed\"\n    },\n\n    {\n      \"name\": \"RIGHT_VENTRICLE_ConstitutiveHet.bed.gz\",\n      \"position\": [\n        147,\n        1\n      ],\n      \"type\": \"bed\"\n    },\n\n    {\n      \"name\": \"RIGHT_VENTRICLE_Promoter.bed.gz\",\n      \"position\": [\n        147,\n        5\n      ],\n      \"type\": \"bed\"\n    },\n\n    {\n      \"name\": \"RIGHT_VENTRICLE_Quiescent.bed.gz\",\n      \"position\": [\n        147,\n        6\n      ],\n      \"type\": \"bed\"\n    },\n\n    {\n      \"name\": \"RIGHT_VENTRICLE_RegPermissive.bed.gz\",\n      \"position\": [\n        147,\n        7\n      ],\n      \"type\": \"bed\"\n    },\n\n    {\n      \"name\": \"RIGHT_VENTRICLE_Transcribed.bed.gz\",\n      \"position\": [\n        147,\n        8\n      ],\n      \"type\": \"bed\"\n    },\n\n    {\n      \"name\": \"RPTEC_FacultativeHet.bed.gz\",\n      \"position\": [\n        148,\n        3\n      ],\n      \"type\": \"bed\"\n    },\n\n    {\n      \"name\": \"RPTEC_LowConfidence.bed.gz\",\n      \"position\": [\n        148,\n        4\n      ],\n      \"type\": \"bed\"\n    },\n\n    {\n      \"name\": \"RPTEC_Promoter.bed.gz\",\n      \"position\": [\n        148,\n        5\n      ],\n      \"type\": \"bed\"\n    },\n\n    {\n      \"name\": \"RPTEC_Quiescent.bed.gz\",\n      \"position\": [\n        148,\n        6\n      ],\n      \"type\": \"bed\"\n    },\n\n    {\n      \"name\": \"RPTEC_RegPermissive.bed.gz\",\n      \"position\": [\n        148,\n        7\n      ],\n      \"type\": \"bed\"\n    },\n\n    {\n      \"name\": \"SAEC_Bivalent.bed.gz\",\n      \"position\": [\n        149,\n        0\n      ],\n      \"type\": \"bed\"\n    },\n\n    {\n      \"name\": \"SAEC_Enhancer.bed.gz\",\n      \"position\": [\n        149,\n        2\n      ],\n      \"type\": \"bed\"\n    },\n\n    {\n      \"name\": \"SAEC_FacultativeHet.bed.gz\",\n      \"position\": [\n        149,\n        3\n      ],\n      \"type\": \"bed\"\n    },\n\n    {\n      \"name\": \"SAEC_Quiescent.bed.gz\",\n      \"position\": [\n        149,\n        6\n      ],\n      \"type\": \"bed\"\n    },\n\n    {\n      \"name\": \"SAEC_RegPermissive.bed.gz\",\n      \"position\": [\n        149,\n        7\n      ],\n      \"type\": \"bed\"\n    },\n\n    {\n      \"name\": \"SAEC_Transcribed.bed.gz\",\n      \"position\": [\n        149,\n        8\n      ],\n      \"type\": \"bed\"\n    },\n\n    {\n      \"name\": \"SIGMOID_COLON_ConstitutiveHet.bed.gz\",\n      \"position\": [\n        150,\n        1\n      ],\n      \"type\": \"bed\"\n    },\n\n    {\n      \"name\": \"SIGMOID_COLON_Enhancer.bed.gz\",\n      \"position\": [\n        150,\n        2\n      ],\n      \"type\": \"bed\"\n    },\n\n    {\n      \"name\": \"SIGMOID_COLON_FacultativeHet.bed.gz\",\n      \"position\": [\n        150,\n        3\n      ],\n      \"type\": \"bed\"\n    },\n\n    {\n      \"name\": \"SIGMOID_COLON_LowConfidence.bed.gz\",\n      \"position\": [\n        150,\n        4\n      ],\n      \"type\": \"bed\"\n    },\n\n    {\n      \"name\": \"SIGMOID_COLON_Promoter.bed.gz\",\n      \"position\": [\n        150,\n        5\n      ],\n      \"type\": \"bed\"\n    },\n\n    {\n      \"name\": \"SIGMOID_COLON_Quiescent.bed.gz\",\n      \"position\": [\n        150,\n        6\n      ],\n      \"type\": \"bed\"\n    },\n\n    {\n      \"name\": \"SIGMOID_COLON_RegPermissive.bed.gz\",\n      \"position\": [\n        150,\n        7\n      ],\n      \"type\": \"bed\"\n    },\n\n    {\n      \"name\": \"SIGMOID_COLON_Transcribed.bed.gz\",\n      \"position\": [\n        150,\n        8\n      ],\n      \"type\": \"bed\"\n    },\n\n    {\n      \"name\": \"SKELETAL_MUSCLE_FEMALE_Bivalent.bed.gz\",\n      \"position\": [\n        151,\n        0\n      ],\n      \"type\": \"bed\"\n    },\n\n    {\n      \"name\": \"SKELETAL_MUSCLE_FEMALE_ConstitutiveHet.bed.gz\",\n      \"position\": [\n        151,\n        1\n      ],\n      \"type\": \"bed\"\n    },\n\n    {\n      \"name\": \"SKELETAL_MUSCLE_FEMALE_Enhancer.bed.gz\",\n      \"position\": [\n        151,\n        2\n      ],\n      \"type\": \"bed\"\n    },\n\n    {\n      \"name\": \"SKELETAL_MUSCLE_FEMALE_FacultativeHet.bed.gz\",\n      \"position\": [\n        151,\n        3\n      ],\n      \"type\": \"bed\"\n    },\n\n    {\n      \"name\": \"SKELETAL_MUSCLE_FEMALE_Promoter.bed.gz\",\n      \"position\": [\n        151,\n        5\n      ],\n      \"type\": \"bed\"\n    },\n\n    {\n      \"name\": \"SKELETAL_MUSCLE_FEMALE_Quiescent.bed.gz\",\n      \"position\": [\n        151,\n        6\n      ],\n      \"type\": \"bed\"\n    },\n\n    {\n      \"name\": \"SKELETAL_MUSCLE_FEMALE_Transcribed.bed.gz\",\n      \"position\": [\n        151,\n        8\n      ],\n      \"type\": \"bed\"\n    },\n\n    {\n      \"name\": \"SKELETAL_MUSCLE_MALE_Bivalent.bed.gz\",\n      \"position\": [\n        152,\n        0\n      ],\n      \"type\": \"bed\"\n    },\n\n    {\n      \"name\": \"SKELETAL_MUSCLE_MALE_ConstitutiveHet.bed.gz\",\n      \"position\": [\n        152,\n        1\n      ],\n      \"type\": \"bed\"\n    },\n\n    {\n      \"name\": \"SKELETAL_MUSCLE_MALE_FacultativeHet.bed.gz\",\n      \"position\": [\n        152,\n        3\n      ],\n      \"type\": \"bed\"\n    },\n\n    {\n      \"name\": \"SKELETAL_MUSCLE_MALE_Promoter.bed.gz\",\n      \"position\": [\n        152,\n        5\n      ],\n      \"type\": \"bed\"\n    },\n\n    {\n      \"name\": \"SKELETAL_MUSCLE_MALE_Quiescent.bed.gz\",\n      \"position\": [\n        152,\n        6\n      ],\n      \"type\": \"bed\"\n    },\n\n    {\n      \"name\": \"SKELETAL_MUSCLE_MALE_RegPermissive.bed.gz\",\n      \"position\": [\n        152,\n        7\n      ],\n      \"type\": \"bed\"\n    },\n\n    {\n      \"name\": \"SKELETAL_MUSCLE_MALE_Transcribed.bed.gz\",\n      \"position\": [\n        152,\n        8\n      ],\n      \"type\": \"bed\"\n    },\n\n    {\n      \"name\": \"SK-N-MC_LowConfidence.bed.gz\",\n      \"position\": [\n        153,\n        4\n      ],\n      \"type\": \"bed\"\n    },\n\n    {\n      \"name\": \"SK-N-MC_Promoter.bed.gz\",\n      \"position\": [\n        153,\n        5\n      ],\n      \"type\": \"bed\"\n    },\n\n    {\n      \"name\": \"SK-N-MC_Quiescent.bed.gz\",\n      \"position\": [\n        153,\n        6\n      ],\n      \"type\": \"bed\"\n    },\n\n    {\n      \"name\": \"SK-N-MC_RegPermissive.bed.gz\",\n      \"position\": [\n        153,\n        7\n      ],\n      \"type\": \"bed\"\n    },\n\n    {\n      \"name\": \"SK-N-MC_Transcribed.bed.gz\",\n      \"position\": [\n        153,\n        8\n      ],\n      \"type\": \"bed\"\n    },\n\n    {\n      \"name\": \"SK-N-SH_ConstitutiveHet.bed.gz\",\n      \"position\": [\n        154,\n        1\n      ],\n      \"type\": \"bed\"\n    },\n\n    {\n      \"name\": \"SK-N-SH_LowConfidence.bed.gz\",\n      \"position\": [\n        154,\n        4\n      ],\n      \"type\": \"bed\"\n    },\n\n    {\n      \"name\": \"SK-N-SH_Promoter.bed.gz\",\n      \"position\": [\n        154,\n        5\n      ],\n      \"type\": \"bed\"\n    },\n\n    {\n      \"name\": \"SK-N-SH_Quiescent.bed.gz\",\n      \"position\": [\n        154,\n        6\n      ],\n      \"type\": \"bed\"\n    },\n\n    {\n      \"name\": \"SK-N-SH_RA_Bivalent.bed.gz\",\n      \"position\": [\n        155,\n        0\n      ],\n      \"type\": \"bed\"\n    },\n\n    {\n      \"name\": \"SK-N-SH_RA_FacultativeHet.bed.gz\",\n      \"position\": [\n        155,\n        3\n      ],\n      \"type\": \"bed\"\n    },\n\n    {\n      \"name\": \"SK-N-SH_RA_Promoter.bed.gz\",\n      \"position\": [\n        155,\n        5\n      ],\n      \"type\": \"bed\"\n    },\n\n    {\n      \"name\": \"SK-N-SH_RA_Quiescent.bed.gz\",\n      \"position\": [\n        155,\n        6\n      ],\n      \"type\": \"bed\"\n    },\n\n    {\n      \"name\": \"SK-N-SH_RA_RegPermissive.bed.gz\",\n      \"position\": [\n        155,\n        7\n      ],\n      \"type\": \"bed\"\n    },\n\n    {\n      \"name\": \"SK-N-SH_RA_Transcribed.bed.gz\",\n      \"position\": [\n        155,\n        8\n      ],\n      \"type\": \"bed\"\n    },\n\n    {\n      \"name\": \"SK-N-SH_RegPermissive.bed.gz\",\n      \"position\": [\n        154,\n        7\n      ],\n      \"type\": \"bed\"\n    },\n\n    {\n      \"name\": \"SK-N-SH_Transcribed.bed.gz\",\n      \"position\": [\n        154,\n        8\n      ],\n      \"type\": \"bed\"\n    },\n\n    {\n      \"name\": \"SMALL_INTESTINE_OC_Bivalent.bed.gz\",\n      \"position\": [\n        156,\n        0\n      ],\n      \"type\": \"bed\"\n    },\n\n    {\n      \"name\": \"SMALL_INTESTINE_OC_ConstitutiveHet.bed.gz\",\n      \"position\": [\n        156,\n        1\n      ],\n      \"type\": \"bed\"\n    },\n\n    {\n      \"name\": \"SMALL_INTESTINE_OC_Enhancer.bed.gz\",\n      \"position\": [\n        156,\n        2\n      ],\n      \"type\": \"bed\"\n    },\n\n    {\n      \"name\": \"SMALL_INTESTINE_OC_LowConfidence.bed.gz\",\n      \"position\": [\n        156,\n        4\n      ],\n      \"type\": \"bed\"\n    },\n\n    {\n      \"name\": \"SMALL_INTESTINE_OC_Promoter.bed.gz\",\n      \"position\": [\n        156,\n        5\n      ],\n      \"type\": \"bed\"\n    },\n\n    {\n      \"name\": \"SMALL_INTESTINE_OC_Quiescent.bed.gz\",\n      \"position\": [\n        156,\n        6\n      ],\n      \"type\": \"bed\"\n    },\n\n    {\n      \"name\": \"SMALL_INTESTINE_OC_RegPermissive.bed.gz\",\n      \"position\": [\n        156,\n        7\n      ],\n      \"type\": \"bed\"\n    },\n\n    {\n      \"name\": \"SMALL_INTESTINE_OC_Transcribed.bed.gz\",\n      \"position\": [\n        156,\n        8\n      ],\n      \"type\": \"bed\"\n    },\n\n    {\n      \"name\": \"STOMACH_MUCOSA_ConstitutiveHet.bed.gz\",\n      \"position\": [\n        157,\n        1\n      ],\n      \"type\": \"bed\"\n    },\n\n    {\n      \"name\": \"STOMACH_MUCOSA_Enhancer.bed.gz\",\n      \"position\": [\n        157,\n        2\n      ],\n      \"type\": \"bed\"\n    },\n\n    {\n      \"name\": \"STOMACH_MUCOSA_FacultativeHet.bed.gz\",\n      \"position\": [\n        157,\n        3\n      ],\n      \"type\": \"bed\"\n    },\n\n    {\n      \"name\": \"STOMACH_MUCOSA_Promoter.bed.gz\",\n      \"position\": [\n        157,\n        5\n      ],\n      \"type\": \"bed\"\n    },\n\n    {\n      \"name\": \"STOMACH_MUCOSA_Quiescent.bed.gz\",\n      \"position\": [\n        157,\n        6\n      ],\n      \"type\": \"bed\"\n    },\n\n    {\n      \"name\": \"STOMACH_MUCOSA_Transcribed.bed.gz\",\n      \"position\": [\n        157,\n        8\n      ],\n      \"type\": \"bed\"\n    },\n\n    {\n      \"name\": \"STOMACH_SMOOTH_MUSCLE_Bivalent.bed.gz\",\n      \"position\": [\n        158,\n        0\n      ],\n      \"type\": \"bed\"\n    },\n\n    {\n      \"name\": \"STOMACH_SMOOTH_MUSCLE_ConstitutiveHet.bed.gz\",\n      \"position\": [\n        158,\n        1\n      ],\n      \"type\": \"bed\"\n    },\n\n    {\n      \"name\": \"STOMACH_SMOOTH_MUSCLE_Enhancer.bed.gz\",\n      \"position\": [\n        158,\n        2\n      ],\n      \"type\": \"bed\"\n    },\n\n    {\n      \"name\": \"STOMACH_SMOOTH_MUSCLE_FacultativeHet.bed.gz\",\n      \"position\": [\n        158,\n        3\n      ],\n      \"type\": \"bed\"\n    },\n\n    {\n      \"name\": \"STOMACH_SMOOTH_MUSCLE_Quiescent.bed.gz\",\n      \"position\": [\n        158,\n        6\n      ],\n      \"type\": \"bed\"\n    },\n\n    {\n      \"name\": \"STOMACH_SMOOTH_MUSCLE_RegPermissive.bed.gz\",\n      \"position\": [\n        158,\n        7\n      ],\n      \"type\": \"bed\"\n    },\n\n    {\n      \"name\": \"STOMACH_SMOOTH_MUSCLE_Transcribed.bed.gz\",\n      \"position\": [\n        158,\n        8\n      ],\n      \"type\": \"bed\"\n    },\n\n    {\n      \"name\": \"T-47D_LowConfidence.bed.gz\",\n      \"position\": [\n        159,\n        4\n      ],\n      \"type\": \"bed\"\n    },\n\n    {\n      \"name\": \"T-47D_Promoter.bed.gz\",\n      \"position\": [\n        159,\n        5\n      ],\n      \"type\": \"bed\"\n    },\n\n    {\n      \"name\": \"T-47D_Quiescent.bed.gz\",\n      \"position\": [\n        159,\n        6\n      ],\n      \"type\": \"bed\"\n    },\n\n    {\n      \"name\": \"T-47D_RegPermissive.bed.gz\",\n      \"position\": [\n        159,\n        7\n      ],\n      \"type\": \"bed\"\n    },\n\n    {\n      \"name\": \"T-47D_Transcribed.bed.gz\",\n      \"position\": [\n        159,\n        8\n      ],\n      \"type\": \"bed\"\n    },\n\n    {\n      \"name\": \"THYMUS_ConstitutiveHet.bed.gz\",\n      \"position\": [\n        160,\n        1\n      ],\n      \"type\": \"bed\"\n    },\n\n    {\n      \"name\": \"THYMUS_Enhancer.bed.gz\",\n      \"position\": [\n        160,\n        2\n      ],\n      \"type\": \"bed\"\n    },\n\n    {\n      \"name\": \"THYMUS_LowConfidence.bed.gz\",\n      \"position\": [\n        160,\n        4\n      ],\n      \"type\": \"bed\"\n    },\n\n    {\n      \"name\": \"THYMUS_Promoter.bed.gz\",\n      \"position\": [\n        160,\n        5\n      ],\n      \"type\": \"bed\"\n    },\n\n    {\n      \"name\": \"THYMUS_Quiescent.bed.gz\",\n      \"position\": [\n        160,\n        6\n      ],\n      \"type\": \"bed\"\n    },\n\n    {\n      \"name\": \"THYMUS_RegPermissive.bed.gz\",\n      \"position\": [\n        160,\n        7\n      ],\n      \"type\": \"bed\"\n    },\n\n    {\n      \"name\": \"THYMUS_Transcribed.bed.gz\",\n      \"position\": [\n        160,\n        8\n      ],\n      \"type\": \"bed\"\n    },\n\n    {\n      \"name\": \"WERI-RB-1_LowConfidence.bed.gz\",\n      \"position\": [\n        161,\n        4\n      ],\n      \"type\": \"bed\"\n    },\n\n    {\n      \"name\": \"WERI-RB-1_Promoter.bed.gz\",\n      \"position\": [\n        161,\n        5\n      ],\n      \"type\": \"bed\"\n    },\n\n    {\n      \"name\": \"WERI-RB-1_Quiescent.bed.gz\",\n      \"position\": [\n        161,\n        6\n      ],\n      \"type\": \"bed\"\n    },\n\n    {\n      \"name\": \"WERI-RB-1_RegPermissive.bed.gz\",\n      \"position\": [\n        161,\n        7\n      ],\n      \"type\": \"bed\"\n    },\n\n    {\n      \"name\": \"WI-38_Enhancer.bed.gz\",\n      \"position\": [\n        162,\n        2\n      ],\n      \"type\": \"bed\"\n    },\n\n    {\n      \"name\": \"WI-38_LowConfidence.bed.gz\",\n      \"position\": [\n        162,\n        4\n      ],\n      \"type\": \"bed\"\n    },\n\n    {\n      \"name\": \"WI-38_Promoter.bed.gz\",\n      \"position\": [\n        162,\n        5\n      ],\n      \"type\": \"bed\"\n    },\n\n    {\n      \"name\": \"WI-38_Quiescent.bed.gz\",\n      \"position\": [\n        162,\n        6\n      ],\n      \"type\": \"bed\"\n    },\n\n    {\n      \"name\": \"WI-38_RegPermissive.bed.gz\",\n      \"position\": [\n        162,\n        7\n      ],\n      \"type\": \"bed\"\n    }\n  ]\n}\n"
  },
  {
    "path": "examples/segway/get_data.sh",
    "content": "mkdir orig\ncd orig\nwget -r -nH -nd -np -R index.html* http://noble.gs.washington.edu/proj/encyclopedia/interpreted/\n\ncd ..\nmkdir split\n\npython ~/src/giggle/examples/segway/rename.py \"orig/*gz\" split\n\nls *bed | xargs -I{} -P 20 bash -c \"bgzip {}\"\n\ncd ..\n\nmkdir split_sort\n\n~/src/giggle/scripts/sort_bed \"split/*gz\" split_sort 30\n\ntime ~/src/giggle/bin/giggle index -i \"split_sort/*gz\" -o split_sort_b -f -s\n\ntime ~/src/giggle/bin/giggle index -i \"split_sort/*gz\" -o split_sort_b -f -s\n\nIndexed 1013379899 intervals.\n\nreal    23m28.112s\nuser    22m50.339s\nsys     0m36.730s\n"
  },
  {
    "path": "examples/segway/rename.py",
    "content": "import toolshed as ts\nimport os.path as op\nimport gzip\nimport sys\nfrom itertools import imap\n\nif len(sys.argv) != 3:\n    sys.stderr.write('usage:\\t' + \\\n                     sys.argv[0] + \\\n                     ' <input dir> <output dir>')\ninput_dir = sys.argv[1]\noutput_dir = sys.argv[2]\n\ndef process_file(fname):\n    out_files = {}\n    f = op.basename(fname).split(\".\")[0]\n    tmpl = output_dir + '/' + f + \"_%s.bed\"\n\n    for l in ts.nopen(fname):\n        name = l.rstrip().split(\"\\t\", 4)[3].split('_')[1]\n\n        fname = tmpl % name\n        if not fname in out_files:\n            out_files[fname] = open(fname, 'w')\n            print fname\n        out_files[fname].write(l)\n\n\nimport glob\nfiles = glob.glob(input_dir)\n\nimport multiprocessing\nmultiprocessing.Pool(12).map(process_file, files)\n#for i in imap(process_file, files):\n    #pass\n"
  },
  {
    "path": "examples/segway/states.txt",
    "content": "Bivalent\nConstitutiveHet\nEnhancer\nFacultativeHet\nLowConfidence\nPromoter\nQuiescent\nRegPermissive\nTranscribed\n"
  },
  {
    "path": "examples/ucsc/README.md",
    "content": "Get source code \n\n    git clone https://github.com/samtools/htslib.git\n    cd htslib\n    autoheader\n    autoconf\n    ./configure --disable-bz2 --disable-lzma --enable-libcurl \n    make -j 20\n    export HTSLIB_ROOT=`pwd`\n    cd ..\n\n    git clone https://github.com/ryanlayer/giggle.git\n    cd giggle\n    make -j 20\n    export GIGGLE_ROOT=`pwd`\n    cd ..\n\n    wget -O gargs https://github.com/brentp/gargs/releases/download/v0.3.6/gargs_linux\n    chmod +x gargs\n\nGet database data and index\n\n    mkdir ucsc_data\n    cd ucsc_data\n\n    rsync -a -P rsync://hgdownload.cse.ucsc.edu/goldenPath/hg19/database ./\n\n    mkdir parsed_tracks\n\n    ls database/*sql \\\n    | gargs -p 30 \\\n        \"python $GIGGLE_ROOT/examples/ucsc/parse_sql.py {} parsed_tracks/\"\n\n    mkdir parsed_tracks_sorted\n\n    $GIGGLE_ROOT/scripts/sort_bed \"parsed_tracks/*gz\" parsed_tracks_sorted 30\n\n    time $GIGGLE_ROOT/bin/giggle \\\n        index \\\n        -i \"parsed_tracks_sorted/*gz\" \\\n        -o parsed_tracks_sorted_b \\\n        -s \\\n        -f\n    Indexed 6980993757 intervals.\n\n    real    268m46.033s\n    user    245m44.262s\n    sys     11m51.567s\n\n    cd ..\n"
  },
  {
    "path": "examples/ucsc/data_def.json",
    "content": "{\n  \"dimensions\": [\n    {\n      \"elements\": [\n            \"acembly\",\n            \"affyGnf1h\",\n            \"affyU133\",\n            \"affyU133Plus2\",\n            \"affyU95\",\n            \"allenBrainAli\",\n            \"altLocations\",\n            \"augustusGene\",\n            \"bacEndPairs\",\n            \"ccdsGene\",\n            \"cgapSage\",\n            \"chainSelf\",\n            \"consIndelsHgMmCanFam\",\n            \"coriellDelDup\",\n            \"cosmic\",\n            \"ctgPos2\",\n            \"ctgPos\",\n            \"cytoBand\",\n            \"darned\",\n            \"denisovaMethylation\",\n            \"encodeRegions\",\n            \"ensGene\",\n            \"evoCpg\",\n            \"evofold\",\n            \"evsEsp6500\",\n            \"exoniphy\",\n            \"fishClones\",\n            \"fosEndPairs\",\n            \"gad\",\n            \"gap\",\n            \"gc5Base\",\n            \"geneid\",\n            \"geneReviews\",\n            \"genomicSuperDups\",\n            \"genscan\",\n            \"gnfAtlas2\",\n            \"gold\",\n            \"grcIncidentDb\",\n            \"gwasCatalog\",\n            \"gwipsvizRiboseq\",\n            \"hg19ContigDiff\",\n            \"hg38ContigDiff\",\n            \"hgdpGeo\",\n            \"hgIkmc\",\n            \"HInvGeneMrna\",\n            \"illuminaProbes\",\n            \"intronEst\",\n            \"knownAlt\",\n            \"knownGene\",\n            \"knownGeneOld6\",\n            \"lrg\",\n            \"lrgTranscriptAli\",\n            \"mgcFullMrna\",\n            \"microsat\",\n            \"neandertalMethylation\",\n            \"nestedRepeats\",\n            \"nscanGene\",\n            \"ntHumChimpCodingDiff\",\n            \"ntOoaHaplo\",\n            \"ntSssSnps\",\n            \"ntSssTop5p\",\n            \"ntSssZScorePMVar\",\n            \"oreganno\",\n            \"orfeomeMrna\",\n            \"peptideAtlas2014\",\n            \"pseudoYale60\",\n            \"pubsBingBlat\",\n            \"qPcrPrimers\",\n            \"recombRate\",\n            \"refGene\",\n            \"rgdQtl\",\n            \"rgdRatQtl\",\n            \"rmsk\",\n            \"rnaCluster\",\n            \"sgpGene\",\n            \"sibGene\",\n            \"sibTxGraph\",\n            \"simpleRepeat\",\n            \"snp144\",\n            \"snp144Flagged\",\n            \"snp144Mult\",\n            \"spMut\",\n            \"stsMap\",\n            \"switchDbTss\",\n            \"targetScanS\",\n            \"tfbsConsSites\",\n            \"tgpPhase3\",\n            \"tRNAs\",\n            \"ucscGenePfam\",\n            \"ucscRetroAli5\",\n            \"ucscToINSDC\",\n            \"uniGene_3\",\n            \"vistaEnhancers\",\n            \"wgRna\",\n            \"xenoRefGene\"\n      ], \n      \"number\": \"95\", \n      \"title\": \"UCSC hg19 annotations\"\n    } \n  ], \n  \"sourceFiles\": [\n    { \"name\": \"tracks/acembly.bed.gz\", \"position\": [0], \"type\": \"bed\" },\n    { \"name\": \"tracks/affyGnf1h.bed.gz\", \"position\": [1], \"type\": \"bed\" },\n    { \"name\": \"tracks/affyU133.bed.gz\", \"position\": [2], \"type\": \"bed\" },\n    { \"name\": \"tracks/affyU133Plus2.bed.gz\", \"position\": [3], \"type\": \"bed\" },\n    { \"name\": \"tracks/affyU95.bed.gz\", \"position\": [4], \"type\": \"bed\" },\n    { \"name\": \"tracks/allenBrainAli.bed.gz\", \"position\": [5], \"type\": \"bed\" },\n    { \"name\": \"tracks/altLocations.bed.gz\", \"position\": [6], \"type\": \"bed\" },\n    { \"name\": \"tracks/augustusGene.bed.gz\", \"position\": [7], \"type\": \"bed\" },\n    { \"name\": \"tracks/bacEndPairs.bed.gz\", \"position\": [8], \"type\": \"bed\" },\n    { \"name\": \"tracks/ccdsGene.bed.gz\", \"position\": [9], \"type\": \"bed\" },\n    { \"name\": \"tracks/cgapSage.bed.gz\", \"position\": [10], \"type\": \"bed\" },\n    { \"name\": \"tracks/chainSelf.bed.gz\", \"position\": [11], \"type\": \"bed\" },\n    { \"name\": \"tracks/consIndelsHgMmCanFam.bed.gz\", \"position\": [12], \"type\": \"bed\" },\n    { \"name\": \"tracks/coriellDelDup.bed.gz\", \"position\": [13], \"type\": \"bed\" },\n    { \"name\": \"tracks/cosmic.bed.gz\", \"position\": [14], \"type\": \"bed\" },\n    { \"name\": \"tracks/ctgPos2.bed.gz\", \"position\": [15], \"type\": \"bed\" },\n    { \"name\": \"tracks/ctgPos.bed.gz\", \"position\": [16], \"type\": \"bed\" },\n    { \"name\": \"tracks/cytoBand.bed.gz\", \"position\": [17], \"type\": \"bed\" },\n    { \"name\": \"tracks/darned.bed.gz\", \"position\": [18], \"type\": \"bed\" },\n    { \"name\": \"tracks/denisovaMethylation.bed.gz\", \"position\": [19], \"type\": \"bed\" },\n    { \"name\": \"tracks/encodeRegions.bed.gz\", \"position\": [20], \"type\": \"bed\" },\n    { \"name\": \"tracks/ensGene.bed.gz\", \"position\": [21], \"type\": \"bed\" },\n    { \"name\": \"tracks/evoCpg.bed.gz\", \"position\": [22], \"type\": \"bed\" },\n    { \"name\": \"tracks/evofold.bed.gz\", \"position\": [23], \"type\": \"bed\" },\n    { \"name\": \"tracks/evsEsp6500.vcf.gz\", \"position\": [24], \"type\": \"bed\" },\n    { \"name\": \"tracks/exoniphy.bed.gz\", \"position\": [25], \"type\": \"bed\" },\n    { \"name\": \"tracks/fishClones.bed.gz\", \"position\": [26], \"type\": \"bed\" },\n    { \"name\": \"tracks/fosEndPairs.bed.gz\", \"position\": [27], \"type\": \"bed\" },\n    { \"name\": \"tracks/gad.bed.gz\", \"position\": [28], \"type\": \"bed\" },\n    { \"name\": \"tracks/gap.bed.gz\", \"position\": [29], \"type\": \"bed\" },\n    { \"name\": \"tracks/gc5Base.bed.gz\", \"position\": [30], \"type\": \"bed\" },\n    { \"name\": \"tracks/geneid.bed.gz\", \"position\": [31], \"type\": \"bed\" },\n    { \"name\": \"tracks/geneReviews.bed.gz\", \"position\": [32], \"type\": \"bed\" },\n    { \"name\": \"tracks/genomicSuperDups.bed.gz\", \"position\": [33], \"type\": \"bed\" },\n    { \"name\": \"tracks/genscan.bed.gz\", \"position\": [34], \"type\": \"bed\" },\n    { \"name\": \"tracks/gnfAtlas2.bed.gz\", \"position\": [35], \"type\": \"bed\" },\n    { \"name\": \"tracks/gold.bed.gz\", \"position\": [36], \"type\": \"bed\" },\n    { \"name\": \"tracks/grcIncidentDb.bed.gz\", \"position\": [37], \"type\": \"bed\" },\n    { \"name\": \"tracks/gwasCatalog.bed.gz\", \"position\": [38], \"type\": \"bed\" },\n    { \"name\": \"tracks/gwipsvizRiboseq.bed.gz\", \"position\": [39], \"type\": \"bed\" },\n    { \"name\": \"tracks/hg19ContigDiff.bed.gz\", \"position\": [40], \"type\": \"bed\" },\n    { \"name\": \"tracks/hg38ContigDiff.bed.gz\", \"position\": [41], \"type\": \"bed\" },\n    { \"name\": \"tracks/hgdpGeo.bed.gz\", \"position\": [42], \"type\": \"bed\" },\n    { \"name\": \"tracks/hgIkmc.bed.gz\", \"position\": [43], \"type\": \"bed\" },\n    { \"name\": \"tracks/HInvGeneMrna.bed.gz\", \"position\": [44], \"type\": \"bed\" },\n    { \"name\": \"tracks/illuminaProbes.bed.gz\", \"position\": [45], \"type\": \"bed\" },\n    { \"name\": \"tracks/intronEst.bed.gz\", \"position\": [46], \"type\": \"bed\" },\n    { \"name\": \"tracks/knownAlt.bed.gz\", \"position\": [47], \"type\": \"bed\" },\n    { \"name\": \"tracks/knownGene.bed.gz\", \"position\": [48], \"type\": \"bed\" },\n    { \"name\": \"tracks/knownGeneOld6.bed.gz\", \"position\": [49], \"type\": \"bed\" },\n    { \"name\": \"tracks/lrg.bed.gz\", \"position\": [50], \"type\": \"bed\" },\n    { \"name\": \"tracks/lrgTranscriptAli.bed.gz\", \"position\": [51], \"type\": \"bed\" },\n    { \"name\": \"tracks/mgcFullMrna.bed.gz\", \"position\": [52], \"type\": \"bed\" },\n    { \"name\": \"tracks/microsat.bed.gz\", \"position\": [53], \"type\": \"bed\" },\n    { \"name\": \"tracks/neandertalMethylation.bed.gz\", \"position\": [54], \"type\": \"bed\" },\n    { \"name\": \"tracks/nestedRepeats.bed.gz\", \"position\": [55], \"type\": \"bed\" },\n    { \"name\": \"tracks/nscanGene.bed.gz\", \"position\": [56], \"type\": \"bed\" },\n    { \"name\": \"tracks/ntHumChimpCodingDiff.bed.gz\", \"position\": [57], \"type\": \"bed\" },\n    { \"name\": \"tracks/ntOoaHaplo.bed.gz\", \"position\": [58], \"type\": \"bed\" },\n    { \"name\": \"tracks/ntSssSnps.bed.gz\", \"position\": [59], \"type\": \"bed\" },\n    { \"name\": \"tracks/ntSssTop5p.bed.gz\", \"position\": [60], \"type\": \"bed\" },\n    { \"name\": \"tracks/ntSssZScorePMVar.bed.gz\", \"position\": [61], \"type\": \"bed\" },\n    { \"name\": \"tracks/oreganno.bed.gz\", \"position\": [62], \"type\": \"bed\" },\n    { \"name\": \"tracks/orfeomeMrna.bed.gz\", \"position\": [63], \"type\": \"bed\" },\n    { \"name\": \"tracks/peptideAtlas2014.bed.gz\", \"position\": [64], \"type\": \"bed\" },\n    { \"name\": \"tracks/pseudoYale60.bed.gz\", \"position\": [65], \"type\": \"bed\" },\n    { \"name\": \"tracks/pubsBingBlat.bed.gz\", \"position\": [66], \"type\": \"bed\" },\n    { \"name\": \"tracks/qPcrPrimers.bed.gz\", \"position\": [67], \"type\": \"bed\" },\n    { \"name\": \"tracks/recombRate.bed.gz\", \"position\": [68], \"type\": \"bed\" },\n    { \"name\": \"tracks/refGene.bed.gz\", \"position\": [69], \"type\": \"bed\" },\n    { \"name\": \"tracks/rgdQtl.bed.gz\", \"position\": [70], \"type\": \"bed\" },\n    { \"name\": \"tracks/rgdRatQtl.bed.gz\", \"position\": [71], \"type\": \"bed\" },\n    { \"name\": \"tracks/rmsk.bed.gz\", \"position\": [72], \"type\": \"bed\" },\n    { \"name\": \"tracks/rnaCluster.bed.gz\", \"position\": [73], \"type\": \"bed\" },\n    { \"name\": \"tracks/sgpGene.bed.gz\", \"position\": [74], \"type\": \"bed\" },\n    { \"name\": \"tracks/sibGene.bed.gz\", \"position\": [75], \"type\": \"bed\" },\n    { \"name\": \"tracks/sibTxGraph.bed.gz\", \"position\": [76], \"type\": \"bed\" },\n    { \"name\": \"tracks/simpleRepeat.bed.gz\", \"position\": [77], \"type\": \"bed\" },\n    { \"name\": \"tracks/snp144.bed.gz\", \"position\": [78], \"type\": \"bed\" },\n    { \"name\": \"tracks/snp144Flagged.bed.gz\", \"position\": [79], \"type\": \"bed\" },\n    { \"name\": \"tracks/snp144Mult.bed.gz\", \"position\": [80], \"type\": \"bed\" },\n    { \"name\": \"tracks/spMut.bed.gz\", \"position\": [81], \"type\": \"bed\" },\n    { \"name\": \"tracks/stsMap.bed.gz\", \"position\": [82], \"type\": \"bed\" },\n    { \"name\": \"tracks/switchDbTss.bed.gz\", \"position\": [83], \"type\": \"bed\" },\n    { \"name\": \"tracks/targetScanS.bed.gz\", \"position\": [84], \"type\": \"bed\" },\n    { \"name\": \"tracks/tfbsConsSites.bed.gz\", \"position\": [85], \"type\": \"bed\" },\n    { \"name\": \"tracks/tgpPhase3.vcf\", \"position\": [86], \"type\": \"bed\" },\n    { \"name\": \"tracks/tRNAs.bed.gz\", \"position\": [87], \"type\": \"bed\" },\n    { \"name\": \"tracks/ucscGenePfam.bed.gz\", \"position\": [88], \"type\": \"bed\" },\n    { \"name\": \"tracks/ucscRetroAli5.bed.gz\", \"position\": [89], \"type\": \"bed\" },\n    { \"name\": \"tracks/ucscToINSDC.bed.gz\", \"position\": [90], \"type\": \"bed\" },\n    { \"name\": \"tracks/uniGene_3.bed.gz\", \"position\": [91], \"type\": \"bed\" },\n    { \"name\": \"tracks/vistaEnhancers.bed.gz\", \"position\": [92], \"type\": \"bed\" },\n    { \"name\": \"tracks/wgRna.bed.gz\", \"position\": [93], \"type\": \"bed\" },\n    { \"name\": \"tracks/xenoRefGene.bed.gz\", \"position\": [94], \"type\": \"bed\" }\n  ]\n}\n"
  },
  {
    "path": "examples/ucsc/get_data.sh",
    "content": "rsync -a -P rsync://hgdownload.cse.ucsc.edu/goldenPath/hg19/database ./\n\nmkdir parsed_tracks\n\nls database/*sql \\\n| xargs \\\n    -I{} \\\n    -P 30 \\\n    bash -c \"python parse_sql.py {} parsed_tracks/\"\n\nmkdir parsed_tracks_sorted\n\n~/src/giggle/scripts/sort_bed \"parsed_tracks/*gz\" parsed_tracks_sorted 30\n\ntime ~/src/giggle/bin/giggle \\\n    index \\\n    -i \"parsed_tracks_sorted/*gz\" \\\n    -o parsed_tracks_sorted_b \\\n    -s \\\n    -f\nIndexed 6980993757 intervals.\n\nreal    268m46.033s\nuser    245m44.262s\nsys     11m51.567s\n"
  },
  {
    "path": "examples/ucsc/parse_sql.py",
    "content": "import sys\nimport os.path\nimport gzip\n\nif len (sys.argv) != 3:\n    print \"usage:\\t\" + sys.argv[0] + \" <sql file> <output dir>\"\n    exit(1)\n\nin_file = sys.argv[1]\nout_dir = sys.argv[2]\n\nchrom = -1\nchromEnd = -1\nchromStart = -1\ntName = -1\ntStart = -1\ntEnd = -1\ntxStart = -1\ntxEnd = -1\ngenoName = -1\ngenoStart = -1\ngenoEnd = -1\n\nbase_name = os.path.basename(in_file)[:-4]\ndata_name = in_file[:-4] + '.txt.gz'\nout_file_name = out_dir + '/' + base_name + '.bed.gz'\n\n\nlook = 0\ncol = 0\nfor l in open(in_file):\n    if \"KEY\" in l:\n        break\n    elif look == 1:\n        col += 1\n        if \"`chrom`\" in l:\n            chrom = col\n        elif \"`tName`\" in l:\n            tName = col\n        elif \"`chromEnd`\" in l:\n            chromEnd = col\n        elif \"`chromStart`\" in l:\n            chromStart = col\n        elif \"`tStart`\" in l:\n            tStart = col\n        elif \"`tEnd`\" in l:\n            tEnd = col\n        elif \"`txStart`\" in l:\n            txStart = col\n        elif \"`txEnd`\" in l:\n            txEnd = col\n        elif \"`genoName`\" in l:\n            genoName = col\n        elif \"`genoStart`\" in l:\n            genoStart = col\n        elif \"`genoEnd`\" in l:\n            genoEnd = col\n    elif 'CREATE TABLE' in l:\n        look = 1\n\ncols=[]\n\nif chrom != -1:\n    cols.append(chrom)\nelif  tName != -1:\n    cols.append(tName)\nelif  genoName != -1:\n    cols.append(genoName)\nelse:\n    cols.append(-1)\n\nif (chromStart != -1) and (chromEnd != -1):\n    cols.append(chromStart)\n    cols.append(chromEnd)\nelif (txStart != -1) and (txEnd != -1):\n    cols.append(txStart)\n    cols.append(txEnd)\nelif (tStart != -1) and (tEnd != -1):\n    cols.append(tStart)\n    cols.append(tEnd)\nelif (genoStart != -1) and (genoEnd != -1):\n    cols.append(genoStart)\n    cols.append(genoEnd)\nelse:\n    cols.append(-1)\n    cols.append(-1)\n\n\nif -1 not in cols:\n    out_file = gzip.open(out_file_name, 'wb')\n    for l in gzip.open(data_name, 'rb'):\n        A = l.rstrip().split('\\t')\n        out = []\n        for col in cols:\n            out.append(A[col - 1])\n        out_file.write('\\t'.join(out) + '\\n')\n    out_file.close()\n"
  },
  {
    "path": "experiments/cache_compression/README.html",
    "content": "<!DOCTYPE html>\r\n<html>\r\n<head>\r\n<title>README.md</title>\r\n<meta http-equiv=\"Content-type\" content=\"text/html;charset=UTF-8\">\r\n\n<style>\n/* https://github.com/microsoft/vscode/blob/master/extensions/markdown-language-features/media/markdown.css */\r\n/*---------------------------------------------------------------------------------------------\r\n *  Copyright (c) Microsoft Corporation. All rights reserved.\r\n *  Licensed under the MIT License. See License.txt in the project root for license information.\r\n *--------------------------------------------------------------------------------------------*/\r\n\r\nbody {\r\n\tfont-family: var(--vscode-markdown-font-family, -apple-system, BlinkMacSystemFont, \"Segoe WPC\", \"Segoe UI\", \"Ubuntu\", \"Droid Sans\", sans-serif);\r\n\tfont-size: var(--vscode-markdown-font-size, 14px);\r\n\tpadding: 0 26px;\r\n\tline-height: var(--vscode-markdown-line-height, 22px);\r\n\tword-wrap: break-word;\r\n}\r\n\r\n#code-csp-warning {\r\n\tposition: fixed;\r\n\ttop: 0;\r\n\tright: 0;\r\n\tcolor: white;\r\n\tmargin: 16px;\r\n\ttext-align: center;\r\n\tfont-size: 12px;\r\n\tfont-family: sans-serif;\r\n\tbackground-color:#444444;\r\n\tcursor: pointer;\r\n\tpadding: 6px;\r\n\tbox-shadow: 1px 1px 1px rgba(0,0,0,.25);\r\n}\r\n\r\n#code-csp-warning:hover {\r\n\ttext-decoration: none;\r\n\tbackground-color:#007acc;\r\n\tbox-shadow: 2px 2px 2px rgba(0,0,0,.25);\r\n}\r\n\r\nbody.scrollBeyondLastLine {\r\n\tmargin-bottom: calc(100vh - 22px);\r\n}\r\n\r\nbody.showEditorSelection .code-line {\r\n\tposition: relative;\r\n}\r\n\r\nbody.showEditorSelection .code-active-line:before,\r\nbody.showEditorSelection .code-line:hover:before {\r\n\tcontent: \"\";\r\n\tdisplay: block;\r\n\tposition: absolute;\r\n\ttop: 0;\r\n\tleft: -12px;\r\n\theight: 100%;\r\n}\r\n\r\nbody.showEditorSelection li.code-active-line:before,\r\nbody.showEditorSelection li.code-line:hover:before {\r\n\tleft: -30px;\r\n}\r\n\r\n.vscode-light.showEditorSelection .code-active-line:before {\r\n\tborder-left: 3px solid rgba(0, 0, 0, 0.15);\r\n}\r\n\r\n.vscode-light.showEditorSelection .code-line:hover:before {\r\n\tborder-left: 3px solid rgba(0, 0, 0, 0.40);\r\n}\r\n\r\n.vscode-light.showEditorSelection .code-line .code-line:hover:before {\r\n\tborder-left: none;\r\n}\r\n\r\n.vscode-dark.showEditorSelection .code-active-line:before {\r\n\tborder-left: 3px solid rgba(255, 255, 255, 0.4);\r\n}\r\n\r\n.vscode-dark.showEditorSelection .code-line:hover:before {\r\n\tborder-left: 3px solid rgba(255, 255, 255, 0.60);\r\n}\r\n\r\n.vscode-dark.showEditorSelection .code-line .code-line:hover:before {\r\n\tborder-left: none;\r\n}\r\n\r\n.vscode-high-contrast.showEditorSelection .code-active-line:before {\r\n\tborder-left: 3px solid rgba(255, 160, 0, 0.7);\r\n}\r\n\r\n.vscode-high-contrast.showEditorSelection .code-line:hover:before {\r\n\tborder-left: 3px solid rgba(255, 160, 0, 1);\r\n}\r\n\r\n.vscode-high-contrast.showEditorSelection .code-line .code-line:hover:before {\r\n\tborder-left: none;\r\n}\r\n\r\nimg {\r\n\tmax-width: 100%;\r\n\tmax-height: 100%;\r\n}\r\n\r\na {\r\n\ttext-decoration: none;\r\n}\r\n\r\na:hover {\r\n\ttext-decoration: underline;\r\n}\r\n\r\na:focus,\r\ninput:focus,\r\nselect:focus,\r\ntextarea:focus {\r\n\toutline: 1px solid -webkit-focus-ring-color;\r\n\toutline-offset: -1px;\r\n}\r\n\r\nhr {\r\n\tborder: 0;\r\n\theight: 2px;\r\n\tborder-bottom: 2px solid;\r\n}\r\n\r\nh1 {\r\n\tpadding-bottom: 0.3em;\r\n\tline-height: 1.2;\r\n\tborder-bottom-width: 1px;\r\n\tborder-bottom-style: solid;\r\n}\r\n\r\nh1, h2, h3 {\r\n\tfont-weight: normal;\r\n}\r\n\r\ntable {\r\n\tborder-collapse: collapse;\r\n}\r\n\r\ntable > thead > tr > th {\r\n\ttext-align: left;\r\n\tborder-bottom: 1px solid;\r\n}\r\n\r\ntable > thead > tr > th,\r\ntable > thead > tr > td,\r\ntable > tbody > tr > th,\r\ntable > tbody > tr > td {\r\n\tpadding: 5px 10px;\r\n}\r\n\r\ntable > tbody > tr + tr > td {\r\n\tborder-top: 1px solid;\r\n}\r\n\r\nblockquote {\r\n\tmargin: 0 7px 0 5px;\r\n\tpadding: 0 16px 0 10px;\r\n\tborder-left-width: 5px;\r\n\tborder-left-style: solid;\r\n}\r\n\r\ncode {\r\n\tfont-family: Menlo, Monaco, Consolas, \"Droid Sans Mono\", \"Courier New\", monospace, \"Droid Sans Fallback\";\r\n\tfont-size: 1em;\r\n\tline-height: 1.357em;\r\n}\r\n\r\nbody.wordWrap pre {\r\n\twhite-space: pre-wrap;\r\n}\r\n\r\npre:not(.hljs),\r\npre.hljs code > div {\r\n\tpadding: 16px;\r\n\tborder-radius: 3px;\r\n\toverflow: auto;\r\n}\r\n\r\npre code {\r\n\tcolor: var(--vscode-editor-foreground);\r\n\ttab-size: 4;\r\n}\r\n\r\n/** Theming */\r\n\r\n.vscode-light pre {\r\n\tbackground-color: rgba(220, 220, 220, 0.4);\r\n}\r\n\r\n.vscode-dark pre {\r\n\tbackground-color: rgba(10, 10, 10, 0.4);\r\n}\r\n\r\n.vscode-high-contrast pre {\r\n\tbackground-color: rgb(0, 0, 0);\r\n}\r\n\r\n.vscode-high-contrast h1 {\r\n\tborder-color: rgb(0, 0, 0);\r\n}\r\n\r\n.vscode-light table > thead > tr > th {\r\n\tborder-color: rgba(0, 0, 0, 0.69);\r\n}\r\n\r\n.vscode-dark table > thead > tr > th {\r\n\tborder-color: rgba(255, 255, 255, 0.69);\r\n}\r\n\r\n.vscode-light h1,\r\n.vscode-light hr,\r\n.vscode-light table > tbody > tr + tr > td {\r\n\tborder-color: rgba(0, 0, 0, 0.18);\r\n}\r\n\r\n.vscode-dark h1,\r\n.vscode-dark hr,\r\n.vscode-dark table > tbody > tr + tr > td {\r\n\tborder-color: rgba(255, 255, 255, 0.18);\r\n}\r\n\n</style>\n\n<style>\n/* Tomorrow Theme */\r\n/* http://jmblog.github.com/color-themes-for-google-code-highlightjs */\r\n/* Original theme - https://github.com/chriskempson/tomorrow-theme */\r\n\r\n/* Tomorrow Comment */\r\n.hljs-comment,\r\n.hljs-quote {\r\n\tcolor: #8e908c;\r\n}\r\n\r\n/* Tomorrow Red */\r\n.hljs-variable,\r\n.hljs-template-variable,\r\n.hljs-tag,\r\n.hljs-name,\r\n.hljs-selector-id,\r\n.hljs-selector-class,\r\n.hljs-regexp,\r\n.hljs-deletion {\r\n\tcolor: #c82829;\r\n}\r\n\r\n/* Tomorrow Orange */\r\n.hljs-number,\r\n.hljs-built_in,\r\n.hljs-builtin-name,\r\n.hljs-literal,\r\n.hljs-type,\r\n.hljs-params,\r\n.hljs-meta,\r\n.hljs-link {\r\n\tcolor: #f5871f;\r\n}\r\n\r\n/* Tomorrow Yellow */\r\n.hljs-attribute {\r\n\tcolor: #eab700;\r\n}\r\n\r\n/* Tomorrow Green */\r\n.hljs-string,\r\n.hljs-symbol,\r\n.hljs-bullet,\r\n.hljs-addition {\r\n\tcolor: #718c00;\r\n}\r\n\r\n/* Tomorrow Blue */\r\n.hljs-title,\r\n.hljs-section {\r\n\tcolor: #4271ae;\r\n}\r\n\r\n/* Tomorrow Purple */\r\n.hljs-keyword,\r\n.hljs-selector-tag {\r\n\tcolor: #8959a8;\r\n}\r\n\r\n.hljs {\r\n\tdisplay: block;\r\n\toverflow-x: auto;\r\n\tcolor: #4d4d4c;\r\n\tpadding: 0.5em;\r\n}\r\n\r\n.hljs-emphasis {\r\n\tfont-style: italic;\r\n}\r\n\r\n.hljs-strong {\r\n\tfont-weight: bold;\r\n}\n</style>\n\n<style>\n/*\r\n * Markdown PDF CSS\r\n */\r\n\r\n body {\r\n\tfont-family: -apple-system, BlinkMacSystemFont, \"Segoe WPC\", \"Segoe UI\", \"Ubuntu\", \"Droid Sans\", sans-serif, \"Meiryo\";\r\n\tpadding: 0 12px;\r\n}\r\n\r\npre {\r\n\tbackground-color: #f8f8f8;\r\n\tborder: 1px solid #cccccc;\r\n\tborder-radius: 3px;\r\n\toverflow-x: auto;\r\n\twhite-space: pre-wrap;\r\n\toverflow-wrap: break-word;\r\n}\r\n\r\npre:not(.hljs) {\r\n\tpadding: 23px;\r\n\tline-height: 19px;\r\n}\r\n\r\nblockquote {\r\n\tbackground: rgba(127, 127, 127, 0.1);\r\n\tborder-color: rgba(0, 122, 204, 0.5);\r\n}\r\n\r\n.emoji {\r\n\theight: 1.4em;\r\n}\r\n\r\ncode {\r\n\tfont-size: 14px;\r\n\tline-height: 19px;\r\n}\r\n\r\n/* for inline code */\r\n:not(pre):not(.hljs) > code {\r\n\tcolor: #C9AE75; /* Change the old color so it seems less like an error */\r\n\tfont-size: inherit;\r\n}\r\n\r\n/* Page Break : use <div class=\"page\"/> to insert page break\r\n-------------------------------------------------------- */\r\n.page {\r\n\tpage-break-after: always;\r\n}\r\n\n</style>\n\r\n<script src=\"https://unpkg.com/mermaid/dist/mermaid.min.js\"></script>\r\n</head>\r\n<body>\r\n  <script>\r\n    mermaid.initialize({\r\n      startOnLoad: true,\r\n      theme: document.body.classList.contains('vscode-dark') || document.body.classList.contains('vscode-high-contrast')\r\n          ? 'dark'\r\n          : 'default'\r\n    });\r\n  </script>\r\n<h1 id=\"final-report\">Final Report</h1>\n<h2 id=\"csci-5900--independent-study\">CSCI 5900- Independent Study</h2>\n<h2 id=\"sagar-pathare\">Sagar Pathare</h2>\n<h2 id=\"date-april-26-2022\">Date: April 26, 2022</h2>\n<h2 id=\"title-using-compression-algorithms-in-giggle-to-reduce-disk-space-usage\">Title: Using compression algorithms in GIGGLE to reduce disk space usage</h2>\n<h1 id=\"1-compression-of-the-b-tree-leaves\">1.  Compression of the B+ tree leaves</h1>\n<h2 id=\"motivation\">Motivation</h2>\n<p>The large genomic data sets used by GIGGLE occupy a large amount of disk space. Could we use compression algorithms to reduce disk space utilization without significantly affecting the runtime?</p>\n<h2 id=\"methodimplementation\">Method/implementation</h2>\n<p>We used the most common library for data compression in C- zlib. We created a wrapper/interface around the zlib functions for improved usability. We applied compression to the data stored in the data file. In addition to the existing data, we stored the uncompressed sizes in the index file. We added a file header/marker for both index and data files. The file header includes information about the compression method, compression level, and an extra flag reserved for future use. Files without headers from previous versions are assumed to be uncompressed and are read accordingly, thus enabling backward compatibility. We used function pointers to dynamically set the compress/uncompress functions, depending on the compression method mentioned in the file header.</p>\n<h2 id=\"results\">Results</h2>\n<h3 id=\"time-taken-for-indexing-seconds\">Time taken for Indexing (seconds)</h3>\n<table>\n<thead>\n<tr>\n<th>type</th>\n<th>time</th>\n<th>user</th>\n<th>system</th>\n</tr>\n</thead>\n<tbody>\n<tr>\n<td>uncompressed</td>\n<td>70.49318158458</td>\n<td>64.95069978</td>\n<td>5.52916806</td>\n</tr>\n<tr>\n<td>fastlz1</td>\n<td>89.33131506806</td>\n<td>82.75897032</td>\n<td>6.56374108</td>\n</tr>\n<tr>\n<td>fastlz2</td>\n<td>155.0417450156</td>\n<td>128.78304566</td>\n<td>20.595867</td>\n</tr>\n<tr>\n<td>zlib0</td>\n<td>88.7408512163</td>\n<td>78.20686414</td>\n<td>10.524262</td>\n</tr>\n<tr>\n<td>zlib1</td>\n<td>107.49964638396</td>\n<td>99.16664924</td>\n<td>8.3172525</td>\n</tr>\n<tr>\n<td>zlib3</td>\n<td>116.30003864952</td>\n<td>106.35132674</td>\n<td>8.88081164</td>\n</tr>\n<tr>\n<td>zlib6</td>\n<td>122.00174653288</td>\n<td>114.55789172</td>\n<td>7.40855448</td>\n</tr>\n<tr>\n<td>zlib9</td>\n<td>226.4432716358</td>\n<td>214.986536</td>\n<td>11.37603618</td>\n</tr>\n</tbody>\n</table>\n<p><img src=\"compression-indexing.png\" alt=\"\"></p>\n<h2 id=\"disk-space-utilization-gb\">Disk Space Utilization (GB)</h2>\n<table>\n<thead>\n<tr>\n<th>type</th>\n<th>space</th>\n</tr>\n</thead>\n<tbody>\n<tr>\n<td>uncompressed</td>\n<td>1.452596008</td>\n</tr>\n<tr>\n<td>fastlz1</td>\n<td>0.681222584</td>\n</tr>\n<tr>\n<td>fastlz2</td>\n<td>0.68060137</td>\n</tr>\n<tr>\n<td>zlib0</td>\n<td>1.459414745</td>\n</tr>\n<tr>\n<td>zlib1</td>\n<td>0.433347471</td>\n</tr>\n<tr>\n<td>zlib3</td>\n<td>0.428881416</td>\n</tr>\n<tr>\n<td>zlib6</td>\n<td>0.405332483</td>\n</tr>\n<tr>\n<td>zlib9</td>\n<td>0.40376754</td>\n</tr>\n</tbody>\n</table>\n<p><img src=\"compression-space.png\" alt=\"\"></p>\n<h2 id=\"time-taken-for-search-1-milliseconds\">Time taken for Search 1 (milliseconds)</h2>\n<table>\n<thead>\n<tr>\n<th>command</th>\n<th>mean</th>\n<th>stddev</th>\n<th>median</th>\n<th>user</th>\n<th>system</th>\n<th>min</th>\n<th>max</th>\n</tr>\n</thead>\n<tbody>\n<tr>\n<td>uncompressed</td>\n<td>45.5873693</td>\n<td>3.959420647</td>\n<td>44.7290814</td>\n<td>31.80930286</td>\n<td>13.75768714</td>\n<td>40.9441094</td>\n<td>62.0611574</td>\n</tr>\n<tr>\n<td>fastlz1</td>\n<td>59.18466978</td>\n<td>5.09236337</td>\n<td>59.78575998</td>\n<td>37.83761843</td>\n<td>21.31594118</td>\n<td>51.78323798</td>\n<td>74.08010998</td>\n</tr>\n<tr>\n<td>fastlz2</td>\n<td>56.41575026</td>\n<td>3.620396294</td>\n<td>55.79629656</td>\n<td>37.70584</td>\n<td>18.697718</td>\n<td>52.23282456</td>\n<td>77.13510456</td>\n</tr>\n<tr>\n<td>zlib0</td>\n<td>54.34283227</td>\n<td>3.636371739</td>\n<td>53.8785227</td>\n<td>37.09720143</td>\n<td>17.08244929</td>\n<td>49.7197372</td>\n<td>68.0634982</td>\n</tr>\n<tr>\n<td>zlib1</td>\n<td>74.10076984</td>\n<td>6.043988274</td>\n<td>71.65701646</td>\n<td>55.84351846</td>\n<td>18.24804923</td>\n<td>67.48732846</td>\n<td>92.28525846</td>\n</tr>\n<tr>\n<td>zlib3</td>\n<td>73.39287504</td>\n<td>4.622238952</td>\n<td>72.43769124</td>\n<td>53.72295818</td>\n<td>19.64546818</td>\n<td>66.57508224</td>\n<td>83.36368524</td>\n</tr>\n<tr>\n<td>zlib6</td>\n<td>66.19744482</td>\n<td>2.242995965</td>\n<td>65.84001782</td>\n<td>49.64041217</td>\n<td>16.5452913</td>\n<td>63.34766232</td>\n<td>74.41526232</td>\n</tr>\n<tr>\n<td>zlib9</td>\n<td>67.62356376</td>\n<td>1.623330847</td>\n<td>67.41949892</td>\n<td>52.68799767</td>\n<td>14.9192093</td>\n<td>65.11356992</td>\n<td>71.14124392</td>\n</tr>\n</tbody>\n</table>\n<p><img src=\"compression-search1.png\" alt=\"\"></p>\n<h2 id=\"time-taken-for-search-2-milliseconds\">Time taken for Search 2 (milliseconds)</h2>\n<table>\n<thead>\n<tr>\n<th>command</th>\n<th>mean</th>\n<th>stddev</th>\n<th>median</th>\n<th>user</th>\n<th>system</th>\n<th>min</th>\n<th>max</th>\n</tr>\n</thead>\n<tbody>\n<tr>\n<td>uncompressed</td>\n<td>9.189936953</td>\n<td>0.5627173893</td>\n<td>9.0503129</td>\n<td>4.956227092</td>\n<td>4.23508539</td>\n<td>8.2692079</td>\n<td>10.6013019</td>\n</tr>\n<tr>\n<td>fastlz1</td>\n<td>12.98639579</td>\n<td>1.471285836</td>\n<td>12.47858378</td>\n<td>4.174342933</td>\n<td>8.823754489</td>\n<td>11.38921178</td>\n<td>19.59861078</td>\n</tr>\n<tr>\n<td>fastlz2</td>\n<td>12.19613769</td>\n<td>0.5875847746</td>\n<td>12.03119652</td>\n<td>3.905453208</td>\n<td>8.274995</td>\n<td>11.21100202</td>\n<td>13.77797102</td>\n</tr>\n<tr>\n<td>zlib0</td>\n<td>11.95358581</td>\n<td>0.7256513148</td>\n<td>11.8664233</td>\n<td>4.200792825</td>\n<td>7.762784753</td>\n<td>10.7087693</td>\n<td>14.7913433</td>\n</tr>\n<tr>\n<td>zlib1</td>\n<td>12.96278894</td>\n<td>0.9137541321</td>\n<td>12.78595442</td>\n<td>5.075546634</td>\n<td>7.891110634</td>\n<td>11.84051342</td>\n<td>17.86654842</td>\n</tr>\n<tr>\n<td>zlib3</td>\n<td>12.6532173</td>\n<td>0.64123711</td>\n<td>12.4734273</td>\n<td>5.266293897</td>\n<td>7.37788507</td>\n<td>11.6403703</td>\n<td>15.2530783</td>\n</tr>\n<tr>\n<td>zlib6</td>\n<td>12.20321933</td>\n<td>0.5730424908</td>\n<td>12.02490832</td>\n<td>5.261854609</td>\n<td>6.953686435</td>\n<td>11.33335482</td>\n<td>14.26628082</td>\n</tr>\n<tr>\n<td>zlib9</td>\n<td>12.62452388</td>\n<td>0.5751466442</td>\n<td>12.48667264</td>\n<td>5.127496946</td>\n<td>7.492615961</td>\n<td>11.60951164</td>\n<td>14.42773764</td>\n</tr>\n</tbody>\n</table>\n<p><img src=\"compression-search2.png\" alt=\"\"></p>\n<p><strong>Note</strong>: The time duration values are approximate as they are affected by other applications running in the background.</p>\n<h2 id=\"discussion\">Discussion</h2>\n<p>The disk space usage was reduced by 70-72%, but the time taken for the search queries increased by 25-50%.\nWe can conclude that fastlz2 is the best candidate. Compared to the uncompressed version, it reduced the space by around 53%, increased the search times by only 24% and 33% respectively. The indexing time was roughly 2.2 times, which is fine for a one-time task.</p>\n<h2 id=\"steps-to-reproduce\">Steps to Reproduce</h2>\n<ol>\n<li>Get the <code>roadmap_sort.tar.gz</code> file using <code>wget https://s3.amazonaws.com/layerlab/giggle/roadmap/roadmap_sort.tar.gz</code></li>\n<li>Copy the file <a href=\"https://raw.githubusercontent.com/sspathare97/s22-is-report-giggle/main/GSM1218850_MB135DMMD.peak.q100.bed.gz\">GSM1218850_MB135DMMD.peak.q100.bed.gz</a>.</li>\n<li>Install <a href=\"https://github.com/sharkdp/hyperfine\">hyperfine</a>, a command-line benchmarking tool.</li>\n<li>In the <code>disk_store.c</code> file in the GIGGLE repo,\n<ol>\n<li>On line 31, update the <code>compression_method</code> (accepted values- <code>'z'</code> for zlib or <code>'f'</code> for fastlz)</li>\n<li>On line 32, update the <code>compression_level</code> (accepted values- <code>0</code> to <code>9</code> for zlib and <code>1</code> or <code>2</code> for fastlz)</li>\n</ol>\n</li>\n<li>Build the <code>giggle</code> binary using the <code>make</code> command in the repository. Make sure the variable <code>$GIGGLE_ROOT</code> is set.</li>\n<li>Run the following set of commands for each combination of <code>compression_method</code> and <code>compression_level</code>. For example, here the name is <code>zlib3</code> for using zlib with level 3. Replace it with other values.\n<ol>\n<li><code>hyperfine '$GIGGLE_ROOT/bin/giggle index -s -f -i &quot;roadmap_sort/*gz&quot; -o zlib3' --export-csv roadmap_sort_comparisons/index/zlib3.csv -M 1</code></li>\n<li><code>ls -l zlib3/cache* | awk '{s+=$5;}END{print &quot;zlib3,&quot;s;}' &gt;&gt; roadmap_sort_comparisons/space.csv</code></li>\n<li><code>hyperfine -w 3 '$GIGGLE_ROOT/bin/giggle search -i zlib3 -q GSM1218850_MB135DMMD.peak.q100.bed.gz' --export-csv roadmap_sort_comparisons/search1/zlib3.csv</code></li>\n<li><code>hyperfine -w 3 '$GIGGLE_ROOT/bin/giggle search -i zlib3 -r 1:1-1000000' --export-csv roadmap_sort_comparisons/search2/zlib3.csv</code></li>\n</ol>\n</li>\n<li>Analyze the results in the <code>roadmap_sort_comparisons</code> directory.</li>\n</ol>\n<h1 id=\"2-compression-of-the-offset-index\">2.  Compression of the offset index</h1>\n<p>After compressing the files for leaves, currently, the file that takes up the most space is the offset index file- <code>offset_index.dat</code>. It stores a list of a pair of integers <code>x</code> and <code>y</code> where <code>x</code> is the file ID and <code>y</code> is the line ID in that file. We need the ability to read a particular position in the compressed file. After exploring various ways to implement compression, we concluded that we should implement block impression.</p>\n<h2 id=\"structure-of-the-offsetindexdat-file\">Structure of the <code>offset_index.dat</code> file</h2>\n<ul>\n<li>0-63 (8B) : <code>num</code>- the number of <code>file_id_offset_pairs</code> stored in the file</li>\n<li>64-95 (4B) : <code>width</code>- the width of each <code>file_id_offset_pair</code>, currently 96 bits (12B)\n<ul>\n<li>Each <code>file_id_offset_pair</code> stores the two integers mentioned above\n<ul>\n<li>32 bit <code>file_id</code> (<code>x</code>)</li>\n<li>64 bit <code>offset</code> (<code>y</code>)</li>\n</ul>\n</li>\n</ul>\n</li>\n<li>96-... : <code>file_id_offset_pairs</code></li>\n</ul>\n<h2 id=\"block-compression-implementation\">Block Compression Implementation</h2>\n<p>In the following diagram, Ryan has explained well how block compression could be implemented for <code>offset_index.dat</code>.</p>\n<p><img src=\"block-compression.png\" alt=\"Block Compression\"></p>\n<p align = \"center\">\nBlock Compression- Ryan Layer\n</p>\n<ol>\n<li>We will store a fixed number of pairs of integers as one block and then apply the compression on each block. What a good block size could be needs to be determined experimentally.</li>\n<li>Currently, the leaf node stores <code>I_10</code>- which is the <code>offset_id</code> in the <code>offset_index.dat</code> file. Instead of storing <code>I_10</code>, we will store two values- the compressed block offset ID and the line offset ID within that block.</li>\n<li>We will also store the compressed offsets for each compressed block.</li>\n<li>To retrieve the original uncompressed <code>I_10</code>/<code>offset_id</code>, we will seek compressed file to the compressed block offset ID. We will uncompress the whole block and then seek to the line offset ID.</li>\n</ol>\n<h2 id=\"proposed-structure-of-the-offsetindexcompresseddat-file\">Proposed structure of the <code>offset_index_compressed.dat</code> file</h2>\n<ul>\n<li>0-63 (8B) : <code>num</code>- the number of <code>file_id_offset_pairs</code> stored in the file</li>\n<li>64-95 (4B) : <code>width</code>- the width of each <code>file_id_offset_pair</code>, currently 96 bits (12B)</li>\n<li>96-127 (4B) : <code>block_size</code>- the size of each uncompressed block- same for all blocks</li>\n<li>128-... : <code>compressed_offsets</code>- the offset of each compressed block</li>\n<li>...-... : <code>compressed_data</code>- the actual compressed blocks</li>\n</ul>\n<h2 id=\"proposed-block-compression-implementation\">Proposed Block Compression Implementation</h2>\n<p>We will create a standalone program called <code>block_compression.c</code> with the following functionality-</p>\n<ol>\n<li>Compress <code>offset_index.dat</code> to <code>offset_index_compressed.dat</code></li>\n<li>Uncompress <code>offset_index_compressed.dat</code> to <code>offset_index.dat</code></li>\n<li>Read <code>offset_id</code> from <code>offset_index.dat</code></li>\n<li>Read <code>offset_id</code> from <code>offset_index_compressed.dat</code></li>\n</ol>\n<p>We need to write unit tests to make sure the output from 3 and 4 are the same.</p>\n<h2 id=\"to-be-explained-later\">To be explained later</h2>\n<ul>\n<li><code>mmap</code> usage</li>\n<li><code>offset_data_append_data</code> function pointer usage instead of <code>fwrite</code></li>\n<li><code>OFFSET_INDEX_DATA</code> macro definition</li>\n</ul>\n<h2 id=\"blocker-to-do-for-ryan\">Blocker (To do for Ryan)</h2>\n<ul>\n<li>Figure out how to store two values in the leaf store</li>\n</ul>\n<h1 id=\"3-other-fixes-made-in-the-repository\">3. Other fixes made in the repository</h1>\n<ul>\n<li>Added data files and executable files in the unit tests to gitignore.</li>\n<li>Fixed the unit tests Makefile issue that prevented two consecutive builds without running make clean- the _Runner.c files were also being considered for tests. Added wildcard filter to ignore them.</li>\n<li>Fixed minor bugs and formatting.</li>\n</ul>\n\r\n</body>\r\n</html>\r\n"
  },
  {
    "path": "experiments/cache_compression/README.md",
    "content": "# Final Report\n## CSCI 5900- Independent Study\n## Sagar Pathare\n## Date: April 26, 2022\n\n## Title: Using compression algorithms in GIGGLE to reduce disk space usage\n\n# 1.  Compression of the B+ tree leaves\n\n## Motivation\nThe large genomic data sets used by GIGGLE occupy a large amount of disk space. Could we use compression algorithms to reduce disk space utilization without significantly affecting the runtime?\n\n## Method/implementation\nWe used the most common library for data compression in C- zlib. We created a wrapper/interface around the zlib functions for improved usability. We applied compression to the data stored in the data file. In addition to the existing data, we stored the uncompressed sizes in the index file. We added a file header/marker for both index and data files. The file header includes information about the compression method, compression level, and an extra flag reserved for future use. Files without headers from previous versions are assumed to be uncompressed and are read accordingly, thus enabling backward compatibility. We used function pointers to dynamically set the compress/uncompress functions, depending on the compression method mentioned in the file header. \n\n## Results\n\n### Time taken for Indexing (seconds)\n|type        |time           |user        |system     |\n|------------|---------------|------------|-----------|\n|uncompressed|70.49318158458 |64.95069978 |5.52916806 |\n|fastlz1     |89.33131506806 |82.75897032 |6.56374108 |\n|fastlz2     |155.0417450156 |128.78304566|20.595867  |\n|zlib0       |88.7408512163  |78.20686414 |10.524262  |\n|zlib1       |107.49964638396|99.16664924 |8.3172525  |\n|zlib3       |116.30003864952|106.35132674|8.88081164 |\n|zlib6       |122.00174653288|114.55789172|7.40855448 |\n|zlib9       |226.4432716358 |214.986536  |11.37603618|\n\n![](compression-indexing.png)\n\n## Disk Space Utilization (GB)\n|type        |space      |\n|------------|-----------|\n|uncompressed|1.452596008|\n|fastlz1     |0.681222584|\n|fastlz2     |0.68060137 |\n|zlib0       |1.459414745|\n|zlib1       |0.433347471|\n|zlib3       |0.428881416|\n|zlib6       |0.405332483|\n|zlib9       |0.40376754 |\n\n![](compression-space.png)\n\n\n## Time taken for Search 1 (milliseconds)\n|command     |mean           |stddev     |median     |user       |system     |min        |max        |\n|------------|---------------|-----------|-----------|-----------|-----------|-----------|-----------|\n|uncompressed|45.5873693     |3.959420647|44.7290814 |31.80930286|13.75768714|40.9441094 |62.0611574 |\n|fastlz1     |59.18466978    |5.09236337 |59.78575998|37.83761843|21.31594118|51.78323798|74.08010998|\n|fastlz2     |56.41575026    |3.620396294|55.79629656|37.70584   |18.697718  |52.23282456|77.13510456|\n|zlib0       |54.34283227    |3.636371739|53.8785227 |37.09720143|17.08244929|49.7197372 |68.0634982 |\n|zlib1       |74.10076984    |6.043988274|71.65701646|55.84351846|18.24804923|67.48732846|92.28525846|\n|zlib3       |73.39287504    |4.622238952|72.43769124|53.72295818|19.64546818|66.57508224|83.36368524|\n|zlib6       |66.19744482    |2.242995965|65.84001782|49.64041217|16.5452913 |63.34766232|74.41526232|\n|zlib9       |67.62356376    |1.623330847|67.41949892|52.68799767|14.9192093 |65.11356992|71.14124392|\n\n![](compression-search1.png)\n\n## Time taken for Search 2 (milliseconds)\n|command     |mean           |stddev     |median     |user       |system     |min        |max        |\n|------------|---------------|-----------|-----------|-----------|-----------|-----------|-----------|\n|uncompressed|9.189936953    |0.5627173893|9.0503129  |4.956227092|4.23508539 |8.2692079  |10.6013019 |\n|fastlz1     |12.98639579    |1.471285836|12.47858378|4.174342933|8.823754489|11.38921178|19.59861078|\n|fastlz2     |12.19613769    |0.5875847746|12.03119652|3.905453208|8.274995   |11.21100202|13.77797102|\n|zlib0       |11.95358581    |0.7256513148|11.8664233 |4.200792825|7.762784753|10.7087693 |14.7913433 |\n|zlib1       |12.96278894    |0.9137541321|12.78595442|5.075546634|7.891110634|11.84051342|17.86654842|\n|zlib3       |12.6532173     |0.64123711 |12.4734273 |5.266293897|7.37788507 |11.6403703 |15.2530783 |\n|zlib6       |12.20321933    |0.5730424908|12.02490832|5.261854609|6.953686435|11.33335482|14.26628082|\n|zlib9       |12.62452388    |0.5751466442|12.48667264|5.127496946|7.492615961|11.60951164|14.42773764|\n\n![](compression-search2.png)\n\n**Note**: The time duration values are approximate as they are affected by other applications running in the background.\n## Discussion\nThe disk space usage was reduced by 70-72%, but the time taken for the search queries increased by 25-50%. \nWe can conclude that fastlz2 is the best candidate. Compared to the uncompressed version, it reduced the space by around 53%, increased the search times by only 24% and 33% respectively. The indexing time was roughly 2.2 times, which is fine for a one-time task.\n\n## Steps to Reproduce\n1. Get the `roadmap_sort.tar.gz` file using `wget https://s3.amazonaws.com/layerlab/giggle/roadmap/roadmap_sort.tar.gz`\n2. Copy the file [GSM1218850_MB135DMMD.peak.q100.bed.gz](https://raw.githubusercontent.com/sspathare97/s22-is-report-giggle/main/GSM1218850_MB135DMMD.peak.q100.bed.gz).\n3. Install [hyperfine](https://github.com/sharkdp/hyperfine), a command-line benchmarking tool.\n4. In the `disk_store.c` file in the GIGGLE repo,\n   1. On line 31, update the `compression_method` (accepted values- `'z'` for zlib or `'f'` for fastlz)\n   2. On line 32, update the `compression_level` (accepted values- `0` to `9` for zlib and `1` or `2` for fastlz)\n5. Build the `giggle` binary using the `make` command in the repository. Make sure the variable `$GIGGLE_ROOT` is set.\n6. Run the following set of commands for each combination of `compression_method` and `compression_level`. For example, here the name is `zlib3` for using zlib with level 3. Replace it with other values.\n   1. `hyperfine '$GIGGLE_ROOT/bin/giggle index -s -f -i \"roadmap_sort/*gz\" -o zlib3' --export-csv roadmap_sort_comparisons/index/zlib3.csv -M 1`\n   2. `ls -l zlib3/cache* | awk '{s+=$5;}END{print \"zlib3,\"s;}' >> roadmap_sort_comparisons/space.csv`\n   3. `hyperfine -w 3 '$GIGGLE_ROOT/bin/giggle search -i zlib3 -q GSM1218850_MB135DMMD.peak.q100.bed.gz' --export-csv roadmap_sort_comparisons/search1/zlib3.csv`\n   4. `hyperfine -w 3 '$GIGGLE_ROOT/bin/giggle search -i zlib3 -r 1:1-1000000' --export-csv roadmap_sort_comparisons/search2/zlib3.csv`\n7. Analyze the results in the `roadmap_sort_comparisons` directory.\n\n# 2.  Compression of the offset index \n\nAfter compressing the files for leaves, currently, the file that takes up the most space is the offset index file- `offset_index.dat`. It stores a list of a pair of integers `x` and `y` where `x` is the file ID and `y` is the line ID in that file. We need the ability to read a particular position in the compressed file. After exploring various ways to implement compression, we concluded that we should implement block impression. \n\n## Structure of the `offset_index.dat` file\n* 0-63 (8B) : `num`- the number of `file_id_offset_pairs` stored in the file\n* 64-95 (4B) : `width`- the width of each `file_id_offset_pair`, currently 96 bits (12B)\n  * Each `file_id_offset_pair` stores the two integers mentioned above\n    * 32 bit `file_id` (`x`)\n    * 64 bit `offset` (`y`)\n* 96-... : `file_id_offset_pairs`\n\n## Block Compression Implementation\n\nIn the following diagram, Ryan has explained well how block compression could be implemented for `offset_index.dat`.\n\n![Block Compression](block-compression.png)\n\n<p align = \"center\">\nBlock Compression- Ryan Layer\n</p>\n\n1. We will store a fixed number of pairs of integers as one block and then apply the compression on each block. What a good block size could be needs to be determined experimentally.\n2. Currently, the leaf node stores `I_10`- which is the `offset_id` in the `offset_index.dat` file. Instead of storing `I_10`, we will store two values- the compressed block offset ID and the line offset ID within that block.\n3. We will also store the compressed offsets for each compressed block.\n4. To retrieve the original uncompressed `I_10`/`offset_id`, we will seek compressed file to the compressed block offset ID. We will uncompress the whole block and then seek to the line offset ID.\n\n## Proposed structure of the `offset_index_compressed.dat` file\n* 0-63 (8B) : `num`- the number of `file_id_offset_pairs` stored in the file\n* 64-95 (4B) : `width`- the width of each `file_id_offset_pair`, currently 96 bits (12B)\n* 96-127 (4B) : `block_size`- the size of each uncompressed block- same for all blocks\n* 128-... : `compressed_offsets`- the offset of each compressed block\n* ...-... : `compressed_data`- the actual compressed blocks\n## Proposed Block Compression Implementation\nWe will create a standalone program called `block_compression.c` with the following functionality-\n1. Compress `offset_index.dat` to `offset_index_compressed.dat`\n2. Uncompress `offset_index_compressed.dat` to `offset_index.dat`\n3. Read `offset_id` from `offset_index.dat`\n4. Read `offset_id` from `offset_index_compressed.dat`\n\nWe need to write unit tests to make sure the output from 3 and 4 are the same.\n## To be explained later\n* `mmap` usage\n* `offset_data_append_data` function pointer usage instead of `fwrite`\n* `OFFSET_INDEX_DATA` macro definition\n\n## Blocker (To do for Ryan)\n* Figure out how to store two values in the leaf store  \n# 3. Other fixes made in the repository\n* Added data files and executable files in the unit tests to gitignore.\n* Fixed the unit tests Makefile issue that prevented two consecutive builds without running make clean- the _Runner.c files were also being considered for tests. Added wildcard filter to ignore them.\n* Fixed minor bugs and formatting."
  },
  {
    "path": "experiments/cache_compression/comparison.py",
    "content": "from math import ceil\nimport matplotlib.pyplot as plt\n\ncolors = {\n    'uncompressed': 'g',\n    'fastlz': 'b',\n    'zlib': 'r',\n}\ndata = {\n    'indexing': {\n        'algo': {\n            'uncompressed': [[0], [70.49318158458]],\n            'fastlz': [[1, 2], [89.33131507, 155.041745]],\n            'zlib': [[0, 1, 3, 6, 9], [88.74085122, 107.4996464, 116.3000386, 122.0017465, 226.4432716]],\n        },\n        'y_label': 'Time (s)'\n    },\n    'space': {\n        'algo': {\n            'uncompressed': [[0], [1.452596008]],\n            'fastlz': [[1, 2], [0.681222584, 0.68060137]],\n            'zlib': [[0, 1, 3, 6, 9], [1.459414745, 0.433347471, 0.428881416, 0.405332483, 0.40376754]],\n        },\n        'y_label': 'Space (GB)'\n    },\n    'search1': {\n        'algo': {\n            'uncompressed': [[0], [45.5873693]],\n            'fastlz': [[1, 2], [59.18466978, 56.41575026]],\n            'zlib': [[0, 1, 3, 6, 9], [54.34283227, 74.10076984, 73.39287504, 66.19744482, 67.62356376]],\n        },\n        'y_label': 'Time (ms)'\n    },\n    'search2': {\n        'algo': {\n            'uncompressed': [[0], [9.189936953]],\n            'fastlz': [[1, 2], [12.98639579, 12.19613769]],\n            'zlib': [[0, 1, 3, 6, 9], [11.95358581, 12.96278894, 12.6532173, 12.20321933, 12.62452388]],\n        },\n        'y_label': 'Time (ms)'\n    }\n}\n\nfor comparison_type in data:\n    comparison = data[comparison_type]\n    plt.figure()\n    comparison_algo = comparison['algo']\n    for algo in comparison_algo:\n        color = colors[algo]\n        algo_values = comparison_algo[algo]\n\n        plt.plot(*algo_values, label=algo, color=color)\n        plt.scatter(*algo_values, marker='v', color=color)\n\n    plt.xlabel('Compression Level')\n    plt.ylabel(comparison['y_label'])\n    plt.xticks(range(10))\n    plt.gca().set_ylim(bottom=0)\n    plt.title(f'Compression Performance- {comparison_type}')\n    plt.legend()\n\n    plt.savefig(f'compression-{comparison_type}.png')\n"
  },
  {
    "path": "experiments/cache_compression/roadmap_sort_comparisons/index/fastlz1.csv",
    "content": "command,mean,stddev,median,user,system,min,max\n\"$GIGGLE_ROOT/bin/giggle index -s -f -i \"\"roadmap_sort/*gz\"\" -o fastlz1\",89.33131506806001,0,89.33131506806001,82.75897032,6.56374108,89.33131506806001,89.33131506806001\n"
  },
  {
    "path": "experiments/cache_compression/roadmap_sort_comparisons/index/fastlz2.csv",
    "content": "command,mean,stddev,median,user,system,min,max\n\"$GIGGLE_ROOT/bin/giggle index -s -f -i \"\"roadmap_sort/*gz\"\" -o fastlz2\",155.0417450156,0,155.0417450156,128.78304566,20.595867,155.0417450156,155.0417450156\n"
  },
  {
    "path": "experiments/cache_compression/roadmap_sort_comparisons/index/uncompressed.csv",
    "content": "command,mean,stddev,median,user,system,min,max\n\"$GIGGLE_ROOT/bin/giggle index -s -f -i \"\"roadmap_sort/*gz\"\" -o uncompressed\",70.49318158458,0,70.49318158458,64.95069978,5.52916806,70.49318158458,70.49318158458\n"
  },
  {
    "path": "experiments/cache_compression/roadmap_sort_comparisons/index/zlib0.csv",
    "content": "command,mean,stddev,median,user,system,min,max\n\"$GIGGLE_ROOT/bin/giggle index -s -f -i \"\"roadmap_sort/*gz\"\" -o zlib0\",88.7408512163,0,88.7408512163,78.20686414000001,10.524262,88.7408512163,88.7408512163\n"
  },
  {
    "path": "experiments/cache_compression/roadmap_sort_comparisons/index/zlib1.csv",
    "content": "command,mean,stddev,median,user,system,min,max\n\"$GIGGLE_ROOT/bin/giggle index -s -f -i \"\"roadmap_sort/*gz\"\" -o zlib1\",107.49964638396,0,107.49964638396,99.16664924,8.3172525,107.49964638396,107.49964638396\n"
  },
  {
    "path": "experiments/cache_compression/roadmap_sort_comparisons/index/zlib3.csv",
    "content": "command,mean,stddev,median,user,system,min,max\n\"$GIGGLE_ROOT/bin/giggle index -s -f -i \"\"roadmap_sort/*gz\"\" -o zlib3\",116.30003864951999,0,116.30003864951999,106.35132673999999,8.88081164,116.30003864951999,116.30003864951999\n"
  },
  {
    "path": "experiments/cache_compression/roadmap_sort_comparisons/index/zlib6.csv",
    "content": "command,mean,stddev,median,user,system,min,max\n\"$GIGGLE_ROOT/bin/giggle index -s -f -i \"\"roadmap_sort/*gz\"\" -o zlib6\",122.00174653287999,0,122.00174653287999,114.55789172,7.40855448,122.00174653287999,122.00174653287999\n"
  },
  {
    "path": "experiments/cache_compression/roadmap_sort_comparisons/index/zlib9.csv",
    "content": "command,mean,stddev,median,user,system,min,max\n\"$GIGGLE_ROOT/bin/giggle index -s -f -i \"\"roadmap_sort/*gz\"\" -o zlib9\",226.4432716358,0,226.4432716358,214.98653599999997,11.37603618,226.4432716358,226.4432716358\n"
  },
  {
    "path": "experiments/cache_compression/roadmap_sort_comparisons/index.csv",
    "content": "type,time,user,system\r\nfastlz1,89.33131506806,82.75897032,6.56374108\r\nfastlz2,155.0417450156,128.78304566,20.595867\r\nuncompressed,70.49318158458,64.95069978,5.52916806\r\nzlib0,88.7408512163,78.20686414,10.524262\r\nzlib1,107.49964638396,99.16664924,8.3172525\r\nzlib3,116.30003864952,106.35132674,8.88081164\r\nzlib6,122.00174653288,114.55789172,7.40855448\r\nzlib9,226.4432716358,214.986536,11.37603618\r\n"
  },
  {
    "path": "experiments/cache_compression/roadmap_sort_comparisons/search1/fastlz1.csv",
    "content": "command,mean,stddev,median,user,system,min,max\n$GIGGLE_ROOT/bin/giggle search -i fastlz1 -q GSM1218850_MB135DMMD.peak.q100.bed.gz,0.05918466978392158,0.005092363369844835,0.059785759980000006,0.03783761843137255,0.021315941176470583,0.05178323798,0.07408010998\n"
  },
  {
    "path": "experiments/cache_compression/roadmap_sort_comparisons/search1/fastlz2.csv",
    "content": "command,mean,stddev,median,user,system,min,max\n$GIGGLE_ROOT/bin/giggle search -i fastlz2 -q GSM1218850_MB135DMMD.peak.q100.bed.gz,0.05641575026,0.0036203962939154876,0.05579629656,0.03770584,0.018697718000000002,0.05223282456,0.07713510456000001\n"
  },
  {
    "path": "experiments/cache_compression/roadmap_sort_comparisons/search1/uncompressed.csv",
    "content": "command,mean,stddev,median,user,system,min,max\n$GIGGLE_ROOT/bin/giggle search -i uncompressed -q GSM1218850_MB135DMMD.peak.q100.bed.gz,0.04558736930000001,0.003959420646556987,0.0447290814,0.03180930285714286,0.013757687142857142,0.040944109400000005,0.062061157400000004\n"
  },
  {
    "path": "experiments/cache_compression/roadmap_sort_comparisons/search1/zlib0.csv",
    "content": "command,mean,stddev,median,user,system,min,max\n$GIGGLE_ROOT/bin/giggle search -i zlib0 -q GSM1218850_MB135DMMD.peak.q100.bed.gz,0.054342832271428575,0.0036363717387819664,0.0538785227,0.037097201428571425,0.017082449285714285,0.0497197372,0.0680634982\n"
  },
  {
    "path": "experiments/cache_compression/roadmap_sort_comparisons/search1/zlib1.csv",
    "content": "command,mean,stddev,median,user,system,min,max\n$GIGGLE_ROOT/bin/giggle search -i zlib1 -q GSM1218850_MB135DMMD.peak.q100.bed.gz,0.0741007698446154,0.006043988273777413,0.07165701646000001,0.055843518461538455,0.018248049230769225,0.06748732846000001,0.09228525846\n"
  },
  {
    "path": "experiments/cache_compression/roadmap_sort_comparisons/search1/zlib3.csv",
    "content": "command,mean,stddev,median,user,system,min,max\n$GIGGLE_ROOT/bin/giggle search -i zlib3 -q GSM1218850_MB135DMMD.peak.q100.bed.gz,0.07339287503545457,0.004622238952435892,0.07243769124,0.05372295818181818,0.019645468181818178,0.06657508224,0.08336368524\n"
  },
  {
    "path": "experiments/cache_compression/roadmap_sort_comparisons/search1/zlib6.csv",
    "content": "command,mean,stddev,median,user,system,min,max\n$GIGGLE_ROOT/bin/giggle search -i zlib6 -q GSM1218850_MB135DMMD.peak.q100.bed.gz,0.06619744481999999,0.0022429959648676513,0.06584001782000001,0.04964041217391304,0.016545291304347825,0.06334766232000001,0.07441526232000001\n"
  },
  {
    "path": "experiments/cache_compression/roadmap_sort_comparisons/search1/zlib9.csv",
    "content": "command,mean,stddev,median,user,system,min,max\n$GIGGLE_ROOT/bin/giggle search -i zlib9 -q GSM1218850_MB135DMMD.peak.q100.bed.gz,0.0676235637572093,0.0016233308468493765,0.06741949892,0.05268799767441861,0.01491920930232558,0.06511356992,0.07114124392\n"
  },
  {
    "path": "experiments/cache_compression/roadmap_sort_comparisons/search1.csv",
    "content": "command,mean,stddev,median,user,system,min,max\r\nfastlz1,59.18466978,5.09236337,59.78575998,37.83761843,21.31594118,51.78323798,74.08010998\r\nfastlz2,56.41575026,3.620396294,55.79629656,37.70584,18.697718,52.23282456,77.13510456\r\nuncompressed,45.5873693,3.959420647,44.7290814,31.80930286,13.75768714,40.9441094,62.0611574\r\nzlib0,54.34283227,3.636371739,53.8785227,37.09720143,17.08244929,49.7197372,68.0634982\r\nzlib1,74.10076984,6.043988274,71.65701646,55.84351846,18.24804923,67.48732846,92.28525846\r\nzlib3,73.39287504,4.622238952,72.43769124,53.72295818,19.64546818,66.57508224,83.36368524\r\nzlib6,66.19744482,2.242995965,65.84001782,49.64041217,16.5452913,63.34766232,74.41526232\r\nzlib9,67.62356376,1.623330847,67.41949892,52.68799767,14.9192093,65.11356992,71.14124392"
  },
  {
    "path": "experiments/cache_compression/roadmap_sort_comparisons/search2/fastlz1.csv",
    "content": "command,mean,stddev,median,user,system,min,max\n$GIGGLE_ROOT/bin/giggle search -i fastlz1 -r 1:1-1000000,0.012986395793333336,0.0014712858360844863,0.01247858378,0.004174342933333331,0.008823754488888887,0.01138921178,0.01959861078\n"
  },
  {
    "path": "experiments/cache_compression/roadmap_sort_comparisons/search2/fastlz2.csv",
    "content": "command,mean,stddev,median,user,system,min,max\n$GIGGLE_ROOT/bin/giggle search -i fastlz2 -r 1:1-1000000,0.012196137685094342,0.0005875847746391659,0.012031196520000002,0.003905453207547172,0.008274995000000004,0.011211002020000001,0.013777971020000002\n"
  },
  {
    "path": "experiments/cache_compression/roadmap_sort_comparisons/search2/uncompressed.csv",
    "content": "command,mean,stddev,median,user,system,min,max\n$GIGGLE_ROOT/bin/giggle search -i uncompressed -r 1:1-1000000,0.009189936953191499,0.0005627173892833024,0.0090503129,0.00495622709219858,0.004235085390070924,0.0082692079,0.0106013019\n"
  },
  {
    "path": "experiments/cache_compression/roadmap_sort_comparisons/search2/zlib0.csv",
    "content": "command,mean,stddev,median,user,system,min,max\n$GIGGLE_ROOT/bin/giggle search -i zlib0 -r 1:1-1000000,0.011953585806726447,0.000725651314764675,0.0118664233,0.00420079282511211,0.007762784753363227,0.0107087693,0.0147913433\n"
  },
  {
    "path": "experiments/cache_compression/roadmap_sort_comparisons/search2/zlib1.csv",
    "content": "command,mean,stddev,median,user,system,min,max\n$GIGGLE_ROOT/bin/giggle search -i zlib1 -r 1:1-1000000,0.012962788941951223,0.0009137541320874281,0.01278595442,0.005075546634146342,0.00789111063414634,0.01184051342,0.017866548420000003\n"
  },
  {
    "path": "experiments/cache_compression/roadmap_sort_comparisons/search2/zlib3.csv",
    "content": "command,mean,stddev,median,user,system,min,max\n$GIGGLE_ROOT/bin/giggle search -i zlib3 -r 1:1-1000000,0.012653217299999998,0.0006412371099664997,0.012473427300000001,0.005266293896713614,0.0073778850704225366,0.011640370300000001,0.015253078300000002\n"
  },
  {
    "path": "experiments/cache_compression/roadmap_sort_comparisons/search2/zlib6.csv",
    "content": "command,mean,stddev,median,user,system,min,max\n$GIGGLE_ROOT/bin/giggle search -i zlib6 -r 1:1-1000000,0.012203219328695645,0.0005730424908105166,0.01202490832,0.005261854608695648,0.0069536864347826055,0.01133335482,0.01426628082\n"
  },
  {
    "path": "experiments/cache_compression/roadmap_sort_comparisons/search2/zlib9.csv",
    "content": "command,mean,stddev,median,user,system,min,max\n$GIGGLE_ROOT/bin/giggle search -i zlib9 -r 1:1-1000000,0.012624523881379305,0.0005751466442043636,0.01248667264,0.005127496945812809,0.007492615960591133,0.01160951164,0.01442773764\n"
  },
  {
    "path": "experiments/cache_compression/roadmap_sort_comparisons/search2.csv",
    "content": "command,mean,stddev,median,user,system,min,max\r\nfastlz1,12.98639579,1.471285836,12.47858378,4.174342933,8.823754489,11.38921178,19.59861078\r\nfastlz2,12.19613769,0.5875847746,12.03119652,3.905453208,8.274995,11.21100202,13.77797102\r\nuncompressed,9.189936953,0.5627173893,9.0503129,4.956227092,4.23508539,8.2692079,10.6013019\r\nzlib0,11.95358581,0.7256513148,11.8664233,4.200792825,7.762784753,10.7087693,14.7913433\r\nzlib1,12.96278894,0.9137541321,12.78595442,5.075546634,7.891110634,11.84051342,17.86654842\r\nzlib3,12.6532173,0.64123711,12.4734273,5.266293897,7.37788507,11.6403703,15.2530783\r\nzlib6,12.20321933,0.5730424908,12.02490832,5.261854609,6.953686435,11.33335482,14.26628082\r\nzlib9,12.62452388,0.5751466442,12.48667264,5.127496946,7.492615961,11.60951164,14.42773764"
  },
  {
    "path": "experiments/cache_compression/roadmap_sort_comparisons/space.csv",
    "content": "type,space\nfastlz1,681222584\nfastlz2,680601370\nuncompressed,1452596008\nzlib0,1459414745\nzlib1,433347471\nzlib3,428881416\nzlib6,405332483\nzlib9,403767540"
  },
  {
    "path": "experiments/chipseq/README.md",
    "content": "Get source code\n\n    git clone https://github.com/samtools/htslib.git\n    cd htslib\n    autoheader\n    autoconf\n    ./configure --disable-bz2 --disable-lzma --enable-libcurl\n    make -j 20\n    export HTSLIB_ROOT=`pwd`\n    cd ..\n\n    git clone https://github.com/ryanlayer/giggle.git\n    cd giggle\n    make\n    export GIGGLE_ROOT=`pwd`\n    cd ..\n\n    wget -O gargs https://github.com/brentp/gargs/releases/download/v0.3.6/gargs_linux\n    chmod +x gargs\n\nGet database data and index\n\n    mkdir rme_data\n    cd rme_data\n    wget http://egg2.wustl.edu/roadmap/data/byFileType/chromhmmSegmentations/ChmmModels/coreMarks/jointModel/final/all.mnemonics.bedFiles.tgz\n    mkdir orig\n    tar zxvf all.mnemonics.bedFiles.tgz -C orig/\n    mkdir split\n\n    pip install toolshed --user\n\n    python $GIGGLE_ROOT/examples/rme/rename.py \\\n        $GIGGLE_ROOT/examples/rme/states.txt \\\n        $GIGGLE_ROOT/examples/rme/EDACC_NAME.txt \\\n        \"orig/*gz\" \\\n        \"split/\"\n\n    cd split\n    ls *.bed | ../gargs -p 30 \"bgzip {}\"\n    cd ..\n\n    mkdir split_sort\n\n    $GIGGLE_ROOT/scripts/sort_bed \"split/*gz\" split_sort/ 30\n\n    mkdir split_sort_raw\n    cd split_sort_raw\n    cp ../split_sort/* .\n    ls *.bed.gz | gargs -p 30 \"bgzip -d {}\"\n    cd ..\n    \n    time $GIGGLE_ROOT/bin/giggle index \\\n        -i \"split_sort/*gz\" \\\n        -o split_sort_b \\\n        -f -s\n    Indexed 55605005 intervals.\n\n    real    1m20.940s\n    user    1m17.933s\n    sys     0m2.969s\n    \n    cd ..\n\nRun experiment\n\n    wget ftp://ftp.ncbi.nlm.nih.gov/geo/samples/GSM1218nnn/GSM1218850/suppl/GSM1218850_MB135DMMD.peak.txt.gz\n\n    zcat GSM1218850_MB135DMMD.peak.txt.gz \\\n    | awk '$8 >= 100'\n    | $HTSLIB_ROOT/bgzip -c > GSM1218850_MB135DMMD.peak.q100.bed.gz\n\n    time $GIGGLE_ROOT/bin/giggle search \\\n    -i rme_data/split_sort_b \\\n    -q GSM1218850_MB135DMMD.peak.q100.bed.gz \\\n    -s \\\n    > GSM1218850_MB135DMMD.peak.q100.bed.gz.giggle.result\n\n    real    0m0.968s\n    user    0m0.218s\n    sys     0m0.123s\n\n    $GIGGLE_ROOT/scripts/giggle_heat_map.py \\\n        -s $GIGGLE_ROOT/examples/rme/states.txt \\\n        -c $GIGGLE_ROOT/examples/rme/EDACC_NAME.txt \\\n        -i GSM1218850_MB135DMMD.peak.q100.bed.gz.result \\\n        -o GSM1218850_MB135DMMD.peak.q100.bed.gz.result.3x11.pdf \\\n        -n $GIGGLE_ROOT/examples/rme/new_groups.txt \\\n        --x_size 3 \\\n        --y_size 11 \\\n        --stat combo \\\n        --ablines 15,26,31,43,52,60,72,82,87,89,93,101,103,116,120,122,127 \\\n        --state_names $GIGGLE_ROOT/examples/rme/short_states.txt \\\n        --group_names $GIGGLE_ROOT/examples/rme/new_groups_names.txt\n        #--no_ylabels \\\n"
  },
  {
    "path": "experiments/cistrome/README.md",
    "content": "Get source code\n\n    git clone https://github.com/samtools/htslib.git\n    cd htslib\n    autoheader\n    autoconf\n    ./configure --disable-bz2 --disable-lzma --enable-libcurl\n    make -j 20\n    export HTSLIB_ROOT=`pwd`\n    cd ..\n\n    git clone https://github.com/ryanlayer/giggle.git\n    cd giggle\n    make\n    export GIGGLE_ROOT=`pwd`\n    cd ..\n\n    wget -O gargs https://github.com/brentp/gargs/releases/download/v0.3.6/gargs_linux\n    chmod +x gargs\n\nGet database data and index\n\n    # fill out form on http://cistrome.org/db/interface.html\n    # check Human_TF Human_histone Human_chromatin_accessibility Human_other\n    # get TF_humar.tar.gz\n\n    tar -xvf TF_human.tar.gz -C data/\n    cd data\n    mkdir tmp\n    tar -zxvf TF_human.tar.gz -C tmp/\n    tar -zxvf tmp/TF_human.tar.gz\n    rm -rf tmp/\n    rm TF_human.tar.gz\n    rm ../TF_human.tar.gz\n    mkdir named\n    mkdir named_sort\n\n    cd ..\n\n    $GIGGLE_ROOT/examples/cistrome/get_qc.sh > cistrome_id_qc.txt\n\n    $GIGGLE_ROOT/examples/cistrome/rename.py \\\n        -m data/TF_human_data_information.txt \\\n        -i data/TF_human \\\n        -o data/named \\\n        -n cistrome_id_to_name_map.txt\n        \n\n    $GIGGLE_ROOT/scripts/sort_bed \"data/named/[A-J]*\" data/named_sort/ 10\n    $GIGGLE_ROOT/scripts/sort_bed \"data/named/[K-T]*\" data/named_sort/ 10\n    $GIGGLE_ROOT/scripts/sort_bed \"data/named/[U-Z]*\" data/named_sort/ 10\n\n    mkdir data/named_q100_sort\n    ls data/named_sort/ \\\n    | gargs -p 10 \"./get_top.sh data/named_sort/{} data/named_q100_sort 100\"\n    time ~/src/giggle/bin/giggle index \\\n        -i \"data/named_q100_sort/*gz\"  \\\n        -o data/named_q100_sort_b \\\n        -s -f\n    Indexed 8716024 intervals.\n\n    real    0m17.843s\n    user    0m15.791s\n    sys     0m1.575s\n\n    mkdir data/named_q100_sort_result/\n    ls data/named_q100_sort/ \\\n    | gargs -p 10 '$GIGGLE_ROOT/bin/giggle search -i data/named_q100_sort_b -q data/named_q100_sort/{} -s > data/named_q100_sort_result/{}.results'\n\n    ls data/named_q100_sort/ \\\n    | gargs -o -p 10 'echo -en \"{}\\t\"; bgzip -d -c data/named_q100_sort/{} | wc -l' \\\n    > named_q100_sort_num_lines.txt\n\n    # keep 5 GSM640420,GSM588576,GSM529981,GSM365930,GSM1116655,\n    POL2RA=GSM1116660,GSM1116661,GSM1116656,GSM808756,GSM1143125,GSM1006876,GSM822295,GSM1006865,GSM1091914,GSM1091915,GSM1091916,GSM1091917,GSM1091918,GSM1091919,GSM1091920,GSM1091921,GSM1276019,GSM1276020,GSM1276021,GSM1276023,GSM1276024,GSM1388123,GSM1388129,GSM1533404,GSM1533405,GSM1533406,GSM1533407,GSM1533408,GSM1533409,GSM1533410,GSM1533411,GSM1533413,GSM1636933,GSM1636934,GSM1523077,GSM1523078,GSM1523079,GSM1523080 \n    # GSM614622,GSM614620,GSM614619,GSM614618,GSM614613,\n    RAD21=GSM614612,GSM1010791,GSM1861937,GSM1861938,GSM1861939,GSM1861940,GSM1861941,GSM186194\n    # GSM614615,GSM614614,GSM808752,GSM808753,GSM822305,\n    CTCF=GSM1006875,GSM1022663,GSM1022658,GSM1006878,GSM822308,GSM822309,GSM1010734,GSM1817665,GSM1817666,GSM1817667,GSM631475,GSM631476,GSM631477,GSM631478,GSM631479\n    FOXA1=GSM1534740,GSM1534741,GSM1534743,GSM798436,GSM798438\n    FOXM1=GSM1000996\n    # tabeled MCF-7 by cistrome, but is \n    OTHER_EX=GSM631474\n    # siRNA\n    OTHER_EX+=,GSM1122652,GSM1122653,GSM614621,GSM986086,GSM986085,GSM986087,GSM986088\n    # Transfected\n    OTHER_EX+=,GSM1861942,GSM1388124,GSM1388125,GSM1388127\n    # Mutant lines\n    OTHER_EX+=,GSM699989,GSM699988,GSM699987\n    \n    ESR1_XENOGRAPH=GSM1669134,GSM1669138,GSM1669140,GSM1669142,GSM1669143,GSM1669144,GSM1669145,GSM1019131\n    ESR1_TREATMENT=GSM614610,GSM365928,GSM365927,GSM798435,GSM798424,GSM798434\n    ESR1_SIRNA=GSM631465,GSM631467,GSM631468,GSM986064,GSM986063,GSM986061,GSM986059,GSM986060,GSM986062,GSM1198712,GSM1198714,GSM1295590,GSM1534746,GSM1534747,GSM1534750,GSM1534751,GSM1523081,GSM1523082,GSM1967546,GSM1967547\n\n    \n    $GIGGLE_ROOT/scripts/cross.py  \\\n        -i \"data/named_q100_sort_result/*\" \\\n        -c data/TF_human_data_information.txt \\\n        --name_map cistrome_id_to_name_map.txt \\\n        --qc  cistrome_id_qc.txt \\\n        --lc named_q100_sort_num_lines.txt \\\n        -d <(cat data/TF_human_data_information.txt | awk -F '\\t' '$4==\"MCF-7\" && $7!=\"ESR1\"' | sort -k 7 | cut -f2) \\\n        -q <(cat data/TF_human_data_information.txt | awk -F '\\t' '$4==\"MCF-7\" && $7==\"ESR1\"' | cut -f2) \\\n        --x_size 30 --y_size 15 \\\n        --db_x $POL2RA,$RAD21,$CTCF,$FOXA1,$FOXM1,$OTHER_EX \\\n        --q_x $ESR1_XENOGRAPH,$ESR1_TREATMENT,$ESR1_SIRNA \\\n        --pretty_names $GIGGLE_ROOT/examples/cistrome/pretty_names.txt \\\n    -o mcf-7_esr1-all.pdf\n\n    $GIGGLE_ROOT/scripts/cross.py  \\\n        -i \"data/named_q100_sort_result/*\" \\\n        -c data/TF_human_data_information.txt \\\n        --name_map cistrome_id_to_name_map.txt \\\n        --qc  cistrome_id_qc.txt \\\n        --lc named_q100_sort_num_lines.txt \\\n        -d <(cat data/TF_human_data_information.txt | awk -F '\\t' '$4==\"MCF-7\"' | sort -k 7 | cut -f2) \\\n        -q <(cat data/TF_human_data_information.txt | awk -F '\\t' '$4==\"MCF-7\"' | sort -k 7 | cut -f2) \\\n        --x_size 100 --y_size 100 \\\n    -o mcf_7_x_mcf_y.pdf\n"
  },
  {
    "path": "experiments/fantom/README.md",
    "content": "Get source code\n\n    git clone https://github.com/samtools/htslib.git\n    cd htslib\n    autoheader\n    autoconf\n    ./configure --disable-bz2 --disable-lzma --enable-libcurl\n    make -j 20\n    export HTSLIB_ROOT=`pwd`\n    cd ..\n\n    git clone https://github.com/ryanlayer/giggle.git\n    cd giggle\n    make\n    export GIGGLE_ROOT=`pwd`\n    cd ..\n\nGet database data and index\n\n    mkdir fantom_data\n    cd fantom_data\n    wget http://fantom.gsc.riken.jp/5/datafiles/latest/extra/Enhancers/Human.sample_name2library_id.txt\n    cat Human.sample_name2library_id.txt \\\n    | sed -e \"s/, */-/g\" \\\n    | sed -e \"s/ /_/g\" \\\n    | sed -e \"s/(/-/g\" \\\n    | sed -e \"s/)/-/g\" \\\n    | sed -e \"s/:/-/g\" \\\n    | sed -e \"s/'//g\" \\\n    | sed -e \"s/\\^//g\" \\\n    | sed -e \"s/\\///g\" \\\n    >  Human.sample_name2library_id.sanitized.txt\n\n    wget http://fantom.gsc.riken.jp/5/datafiles/latest/extra/Enhancers/human_permissive_enhancers_phase_1_and_2_expression_count_matrix.txt.gz\n    zcat human_permissive_enhancers_phase_1_and_2_expression_count_matrix.txt.gz \\\n    > human_permissive_enhancers_phase_1_and_2_expression_count_matrix.txt\n\n    mkdir split\n    python $GIGGLE_ROOT/examples/fantom/rename.py \\\n        Human.sample_name2library_id.sanitized.txt \\\n        human_permissive_enhancers_phase_1_and_2_expression_count_matrix.txt \\\n        split\n    \n    mkdir split_sort\n    $GIGGLE_ROOT/scripts/sort_bed \"split/*\" split_sort/\n\n    time $GIGGLE_ROOT/bin/giggle index \\\n        -i \"split_sort/*gz\" \\\n        -o split_sort_b \\\n        -f -s\n    Indexed 11284790 intervals.\n\n    real    0m16.771s\n    user    0m15.860s\n    sys     0m0.627s\n    \n    cd ..\n\nRun experiment\n\n    wget ftp://ftp.ncbi.nlm.nih.gov/geo/samples/GSM1218nnn/GSM1218850/suppl/GSM1218850_MB135DMMD.peak.txt.gz\n\n    zcat GSM1218850_MB135DMMD.peak.txt.gz \\\n    | awk '$8 >= 100'\n    | $HTSLIB_ROOT/bgzip -c > GSM1218850_MB135DMMD.peak.q100.bed.gz\n\n\n    time $GIGGLE_ROOT/bin/giggle search \\\n    -i fantom_data/split_sort_b \\\n    -q GSM1218850_MB135DMMD.peak.q100.bed.gz \\\n    -s \\\n    > GSM1218850_MB135DMMD.peak.q100.bed.gz.giggle.result\n\n    real    0m0.633s\n    user    0m0.549s\n    sys     0m0.071s\n\n    tail -n+2 GSM1218850_MB135DMMD.peak.q100.bed.gz.giggle.result \\\n    | sort -k 8,8nr \\\n    | cut -f1,8 \\\n    | head\n"
  },
  {
    "path": "experiments/gwas/README.md",
    "content": "Get source code\n\n    git clone https://github.com/samtools/htslib.git\n    cd htslib\n    autoheader\n    autoconf\n    ./configure --disable-bz2 --disable-lzma --enable-libcurl\n    make -j 20\n    export HTSLIB_ROOT=`pwd`\n    cd ..\n\n    git clone https://github.com/ryanlayer/giggle.git\n    cd giggle\n    make\n    export GIGGLE_ROOT=`pwd`\n    cd ..\n\n    wget -O gargs https://github.com/brentp/gargs/releases/download/v0.3.6/gargs_linux\n    chmod +x gargs\n\n\nGet database data and index\n\n    mkdir data\n    cd data\n    wget http://egg2.wustl.edu/roadmap/data/byFileType/chromhmmSegmentations/ChmmModels/coreMarks/jointModel/final/all.mnemonics.bedFiles.tgz\n    mkdir orig\n    tar zxvf all.mnemonics.bedFiles.tgz -C orig/\n    mkdir split\n\n    pip install toolshed --user\n\n    python $GIGGLE_ROOT/examples/rme/rename.py \\\n        $GIGGLE_ROOT/examples/rme/states.txt \\\n        $GIGGLE_ROOT/examples/rme/EDACC_NAME.txt \\\n        \"orig/*gz\" \\\n        \"split/\"\n\n    cd split\n    ls *.bed | ../gargs -p 30 \"bgzip {}\"\n    cd ..\n\n    mkdir split_sort\n\n    $GIGGLE_ROOT/scripts/sort_bed \"split/*gz\" split_sort/ 30\n\n    time $GIGGLE_ROOT/bin/giggle index \\\n        -i \"split_sort/*gz\" \\\n        -o split_sort_b \\\n        -f -s\n    Indexed 55605005 intervals.\n\n    real    1m19.609s\n    user    1m16.027s\n    sys     0m3.127s\n\nRun experiment\n\n    wget https://www.nature.com/nature/journal/v518/n7539/extref/nature13835-s1.xls\n    # copy first five columns into a text file named gwas.txt\n\n    mkdir gwas_results\n\n    for D in `tail -n+2 gwas.txt | awk '{print $1;}'  | sort -u`; do\n        grep $D gwas.txt \\\n        | awk '{OFS=\"\\t\"; print $4,$5,$5+1;}' \\\n        | bgzip -c > $D.bed.gz\n\n        $GIGGLE_ROOT/bin/giggle search \\\n            -i rme_data/split_sort_b \\\n            -q $D.bed.gz -s \\\n        > gwas_results/$D.bed.gz.result\n\n    done\n\n    $GIGGLE_ROOT/scripts/giggle_heat_map.py \\\n        -s $GIGGLE_ROOT/examples/rme/states.txt \\\n        --state_names $GIGGLE_ROOT/examples/rme/short_states.txt \\\n        -c $GIGGLE_ROOT/examples/rme/EDACC_NAME.txt \\\n        -i gwas_results/Crohns_disease.bed.gz.result \\\n        -o Crohns_disease.bed.gz.result.pdf \\\n        -n $GIGGLE_ROOT/examples/rme/new_groups.txt \\\n        --x_size 3 \\\n        --y_size 11 \\\n        --stat combo \\\n        --ablines 15,26,31,43,52,60,72,82,87,89,93,101,103,116,120,122,127 \\\n        --group_names $GIGGLE_ROOT/examples/rme/new_groups_names.txt\n\n    $GIGGLE_ROOT/scripts/giggle_gwas_heatmap.py \\\n        -i \"gwas_results/*\" \\\n        --states Enhancers,Strong_transcription \\\n        -s $GIGGLE_ROOT/examples/rme/states.txt \\\n        -c $GIGGLE_ROOT/examples/rme/EDACC_NAME.txt \\\n        -n $GIGGLE_ROOT/examples/rme/new_groups.txt \\\n        --ablines 15,26,31,43,52,60,72,82,87,89,93,101,103,116,120,122,127 \\\n        --group_names $GIGGLE_ROOT/examples/rme/new_groups_names.txt \\\n        -o gwas.pdf \\\n        --x_size 6 \\\n        --y_size 11\n"
  },
  {
    "path": "experiments/mc_vs_table/README.md",
    "content": "Get source code\n\n    git clone https://github.com/samtools/htslib.git\n    cd htslib\n    autoheader\n    autoconf\n    ./configure --disable-bz2 --disable-lzma --enable-libcurl\n    make -j 20\n    export HTSLIB_ROOT=`pwd`\n    cd ..\n\n    git clone https://github.com/ryanlayer/giggle.git\n    cd giggle\n    make\n    export GIGGLE_ROOT=`pwd`\n    cd ..\n\n    git clone https://github.com/arq5x/bits.git\n    cd bits\n    make\n    export BITS_ROOT=`pwd`\n    cd ..\n\n    wget -O gargs https://github.com/brentp/gargs/releases/download/v0.3.6/gargs_linux\n    chmod +x gargs\n\nGet database data and index\n\n    mkdir rme_data\n    cd rme_data\n    wget http://egg2.wustl.edu/roadmap/data/byFileType/chromhmmSegmentations/ChmmModels/coreMarks/jointModel/final/all.mnemonics.bedFiles.tgz\n    mkdir orig\n    tar zxvf all.mnemonics.bedFiles.tgz -C orig/\n    mkdir split\n\n    pip install toolshed --user\n\n    python $GIGGLE_ROOT/examples/rme/rename.py \\\n        $GIGGLE_ROOT/examples/rme/states.txt \\\n        $GIGGLE_ROOT/examples/rme/EDACC_NAME.txt \\\n        \"orig/*gz\" \\\n        \"split/\"\n\n    cd split\n    ls *.bed | ../gargs -p 30 \"bgzip {}\"\n    cd ..\n\n    mkdir split_sort\n\n    $GIGGLE_ROOT/scripts/sort_bed \"split/*gz\" split_sort/ 30\n\n    mkdir split_sort_raw\n    cd split_sort_raw\n    cp ../split_sort/* .\n    ls *.bed.gz | ../gargs -p 30 \"bgzip -d {}\"\n    cd ..\n    \n    time $GIGGLE_ROOT/bin/giggle index \\\n        -i \"split_sort/*gz\" \\\n        -o split_sort_b \\\n        -f -s\n    Indexed 55605005 intervals.\n\n    real    1m20.940s\n    user    1m17.933s\n    sys     0m2.969s\n\n    cd ..\n\n    wget ftp://ftp.ncbi.nlm.nih.gov/geo/samples/GSM1218nnn/GSM1218850/suppl/GSM1218850_MB135DMMD.peak.txt.gz\n\n    zcat GSM1218850_MB135DMMD.peak.txt.gz \\\n    | awk '$8>=100' \\\n    | $HTSLIB_ROOT/bgzip -c > GSM1218850_MB135DMMD.peak.q100.bed.gz\n\n    time $GIGGLE_ROOT/bin/giggle search \\\n    -i rme_data/split_sort_b \\\n    -q GSM1218850_MB135DMMD.peak.q100.bed.gz \\\n    -s \\\n    > GSM1218850_MB135DMMD.peak.q100.bed.gz.giggle.result\n\n    real    0m0.945s\n    user    0m0.151s\n    sys     0m0.163s\n\n    zcat GSM1218850_MB135DMMD.peak.q100.bed.gz \\\n    > GSM1218850_MB135DMMD.peak.q100.bed\n\n    time \\\n    ls rme_data/split_sort_raw \\\n    | ./gargs -p 30 \\\n    \"echo -ne \\\"{}\\\\t\\\"; $BITS_ROOT/bin/bits_test -g $BITS_ROOT/genomes/human.hg19.genome -a GSM1218850_MB135DMMD.peak.q100.bed -b rme_data/split_sort_raw/{} -n 1000\" \\\n    > GSM1218850_MB135DMMD.peak.q100.bed.bits.result\n\n    real    5m14.458s\n    user    153m57.696s\n    sys     0m15.429s\n\n    paste \\\n        <(tail -n+2 GSM1218850_MB135DMMD.peak.q100.bed.gz.giggle.result | sort) \\\n        <(cat GSM1218850_MB135DMMD.peak.q100.bed.bits.result | sort) \\\n    | cut -f7,14 \\\n    | sed -e \"s/p://g\" \\ \n    | $GIGGLE_ROOT/scripts/scatter.py \\\n        -a 0.25 \\\n        -o mc_obs_fisher_pval.pdf \\\n        --y_label \"MC p-value\" \\\n        --x_label \"Fisher's exact p-value (GIGGLE)\" \\\n        --fig_x 3 \\\n        --fig_y 3 \\\n        --x_max 1.01 --x_min 0 \\\n        --y_max 1.01 --y_min 0\n\n    paste \\\n        <(tail -n+2 GSM1218850_MB135DMMD.peak.q100.bed.gz.giggle.result | sort) \\\n        <(cat GSM1218850_MB135DMMD.peak.q100.bed.bits.result | sort) \\\n    | cut -f7,14 \\\n    | sed -e \"s/p://g\" \\ \n    | awk '{OFS=\"\\t\"; print -1*(log($1)/log(10)),-1*(log($2)/log(10));}' \\\n    | $GIGGLE_ROOT/scripts/scatter.py \\\n        -a 0.25 \\\n        -o mc_obs_fisher_pval.1og10.pdf \\\n        --y_label \"-log10(MC p-value)\" \\\n        --x_label \"-log10(Fisher's exact p-value) (GIGGLE)\" \\\n        --fig_x 3 \\\n        --fig_y 3 \\\n        --x_max 1.01 --x_min 0 \\\n        --y_max 1.01 --y_min 0\n\n    paste \\\n        <(tail -n+2 GSM1218850_MB135DMMD.peak.q100.bed.gz.giggle.result | sort) \\\n        <(cat GSM1218850_MB135DMMD.peak.q100.bed.bits.result | sort) \\\n    | cut -f4,11,12 \\\n    | sed -e \"s/.://g\" \\ \n    | awk '$1!=0 && $2!=0 && $3!=0' \\\n    | awk '{print $1,$2/$3;}' \\\n    | $GIGGLE_ROOT/scripts/scatter.py \\\n        -a 0.25 \\\n        -o mc_obs_exp-odds.pdf \\\n        --y_label \"MC observed/expected\" \\\n        --x_label \"Odds ratio (GIGGLE)\" \\\n        --fig_x 3 \\\n        --fig_y 3\n"
  },
  {
    "path": "experiments/metadata_index_query_filter/README.md",
    "content": "# Final Report\n## CSCI 5900- Independent Study (Fall 2022)\n## Sagar Pathare\n## Date: December 6, 2022\n\n## Title: Building metadata index and applying query filter\n\n## Motivation\n- The input files to [GIGGLE](https://github.com/ryanlayer/giggle) may contain additional metadata columns (importance, score, etc.) with arbitrary information (columns count, data types, and sizes). \n- Currently, GIGGLE ignores this metadata. \n- The only way to access the metadata after indexing is to open the original input files. \n- Could we store this metadata as a part of GIGGLE index while indexing the input files and load it while searching? \n- We would no longer need access to the input files after indexing\n- We would no longer need the offset index used to access the input files\n- This would be useful for STIX\n\n## Method/implementation\n- Designed `metadata.conf` file format to accept the metadata columns information- a list of `<column name, data type and size>`\n- Stored the metadata types information in the header of `metadata_index.dat file`\n- Stored the actual metadata information from the input files in the rest of the file\n- Created a query parser which uses the metadata index to parse a simple query of the format `<column><operator><value>`\n  - Query example- `score>=4.59`\n\n### `metadata.conf` file format\nThe file contains a list of `<column number, column name, data type and size>`.\n- column number- the index (1-based) of the column in the interval input files\n- column name- the name declared for the column to be used for query filter\n- data type- the list of supported types:  \n  - char\n  - int_8\n  - int_16\n  - int_32\n  - int_64\n  - float\n  - double\n  - string\n- size (optional)- size of the string, only required if the data type is `string`.   \n\n#### Example- `metadata.conf`\n```\n3 interval_length int_32\n5 is_important int_8\n6 feature string 10\n4 score double\n7 strand char\n```\n\n### `metadata_index.dat` file format\n```\n<7-byte file header (GIGLMET)> <3-byte version (000)> <6-byte extra (reserved)>\n<1-byte uint8 num_cols> <1-byte uint8 col_width>\n< array of  \n  <256-byte char*, name>\n  <1-byte uint8, width>\n  <1-byte char, data type specifier>\n>\n<8-byte uint64 num_rows>\n< array of  \n  <data 1> <data 2> ... <data n>\n>\n```\n\n## Results\n\n### Time taken for Index (seconds)\n| Operation              | Mean        | User       | System     |\n|------------------------|-------------|------------|------------|\n| Index without metadata | 2.301400604 | 2.18434688 | 0.11592476 |\n| Index with metadata    | 3.217897652 | 2.90494334 |  0.3117602 |\n\n### Time taken for Search Query (milliseconds)\n| Operation                                                                        | Mean        | User        | System      |\n|----------------------------------------------------------------------------------|-------------|-------------|-------------|\n| Search using index without metadata                                              | 59.05192191 | 52.30880857 | 6.741488163 |\n| Search using index with metadata without loading metadata                        | 58.88397734 |    53.15284 |     5.73212 |\n| Search using index with metadata with loading metadata                           | 59.28336942 | 54.07237961 | 5.203470588 |\n| Search using index with metadata with loading metadata and applying query filter | 61.46501216 | 53.66404174 | 7.794006087 |\n\n### Time taken for Search Region (milliseconds)\n| Operation                                                                        | Mean        | User        | System       |\n|----------------------------------------------------------------------------------|-------------|-------------|--------------|\n| Search using index without metadata                                              | 3.400331697 | 2.852696838 | 0.5706614229 |\n| Search using index with metadata without loading metadata                        | 3.360303457 | 3.007352598 | 0.5151494662 |\n| Search using index with metadata with loading metadata                           | 3.542046965 | 3.007217495 | 0.5688710866 |\n| Search using index with metadata with loading metadata and applying query filter | 3.506091068 | 2.974596693 | 0.5560202362 |\n\n**Note**: The time duration values are approximate as they are affected by other applications running in the background.\n## Discussion\nThe time taken for indexing was increased by approximately 39%, which is fine for a one-time task. Even after building the metadata index, we still have the option not to load it, which doesn't affect the performance. Loading the metadata and applying the filter takes slightly increases the time by ~5%.\n\n## Steps to Reproduce\n1. Get the `split_stats.tar.gz` file from [https://drive.google.com/file/d/1LSK8ABVjk8ETxsaQykjGWgHwFuOtKjkr/view?usp=share_link](https://drive.google.com/file/d/1LSK8ABVjk8ETxsaQykjGWgHwFuOtKjkr/view?usp=share_link)\n2. Extract the file using `tar -zxvf split_stats.tar.gz`\n3. Install [hyperfine](https://github.com/sharkdp/hyperfine), a command-line benchmarking tool.\n4. Run the following set of commands for performing the benchmarks.\n```\n$GIGGLE_ROOT/bin/giggle index -s -f -i \"split_stats/*gz\" -o split_stats_b\n$GIGGLE_ROOT/bin/giggle index -s -f -i \"split_stats/*gz\" -o split_stats_b_m -m \"split_stats_metadata.conf\" \n\n$GIGGLE_ROOT/bin/giggle search -i split_stats_b -r 1:1-50000\n$GIGGLE_ROOT/bin/giggle search -i split_stats_b_m -r 1:1-50000\n$GIGGLE_ROOT/bin/giggle search -i split_stats_b_m -r 1:1-50000 -m\n$GIGGLE_ROOT/bin/giggle search -i split_stats_b_m -r 1:1-50000 -m -u 'mean>0.0003'\n\nhyperfine -w 3 '$GIGGLE_ROOT/bin/giggle index -s -f -i \"split_stats/*gz\" -o split_stats_b' --export-csv metadata_comparisons/i1.csv\nhyperfine -w 3 '$GIGGLE_ROOT/bin/giggle index -s -f -i \"split_stats/*gz\" -o split_stats_b_m -m \"split_stats_metadata.conf\"' --export-csv metadata_comparisons/i2.csv\n\nhyperfine -w 3 '$GIGGLE_ROOT/bin/giggle search -i split_stats_b -r 1:1-50000' --export-csv metadata_comparisons/s1.csv\nhyperfine -w 3 '$GIGGLE_ROOT/bin/giggle search -i split_stats_b_m -r 1:1-50000' --export-csv metadata_comparisons/s2.csv\nhyperfine -w 3 '$GIGGLE_ROOT/bin/giggle search -i split_stats_b_m -r 1:1-50000 -m' --export-csv metadata_comparisons/s3.csv\nhyperfine -w 3 \"$GIGGLE_ROOT/bin/giggle search -i split_stats_b_m -r 1:1-50000 -m -u 'mean>0.0003'\" --export-csv metadata_comparisons/s4.csv\n\nhyperfine -w 3 '$GIGGLE_ROOT/bin/giggle search -i split_stats_b -q GSM1218850_MB135DMMD.peak.q100.bed.gz' --export-csv metadata_comparisons/q1.csv\nhyperfine -w 3 '$GIGGLE_ROOT/bin/giggle search -i split_stats_b_m -q GSM1218850_MB135DMMD.peak.q100.bed.gz' --export-csv metadata_comparisons/q2.csv\nhyperfine -w 3 '$GIGGLE_ROOT/bin/giggle search -i split_stats_b_m -q GSM1218850_MB135DMMD.peak.q100.bed.gz -m' --export-csv metadata_comparisons/q3.csv\nhyperfine -w 3 \"$GIGGLE_ROOT/bin/giggle search -i split_stats_b_m -q GSM1218850_MB135DMMD.peak.q100.bed.gz -m -u 'mean>0.0003'\" --export-csv metadata_comparisons/q4.csv\n```\n5. Combine the reports into a single CSV using  \n```awk '(NR == 1) || (FNR > 1)' metadata_comparisons/*.csv > metadata_comparisons/combined.csv```\n6. Analyze the results in the `metadata_comparisons/combined.csv`.\n"
  },
  {
    "path": "experiments/metadata_index_query_filter/metadata_comparisons/combined.csv",
    "content": "command,mean,stddev,median,user,system,min,max\n\"$GIGGLE_ROOT/bin/giggle index -s -f -i \"\"split_stats/*gz\"\" -o split_stats_b\",2.3014006040000003,0.01886583728794614,2.3046401646000003,2.1843468800000005,0.11592475999999999,2.2725828176,2.3269391096\n\"$GIGGLE_ROOT/bin/giggle index -s -f -i \"\"split_stats/*gz\"\" -o split_stats_b_m -m \"\"split_stats_metadata.conf\"\"\",3.21789765232,0.07718254445598732,3.23337241512,2.90494334,0.3117602,3.0216530646199997,3.28775030562\n$GIGGLE_ROOT/bin/giggle search -i split_stats_b -q GSM1218850_MB135DMMD.peak.q100.bed.gz,0.059051921914693876,0.0005088443123209759,0.058950880180000005,0.05230880857142859,0.006741488163265304,0.05807585618000001,0.06034612818000001\n$GIGGLE_ROOT/bin/giggle search -i split_stats_b_m -q GSM1218850_MB135DMMD.peak.q100.bed.gz,0.058883977340000004,0.00042418272631334546,0.058831946940000004,0.05315283999999997,0.00573212,0.05821420544,0.060353847440000004\n$GIGGLE_ROOT/bin/giggle search -i split_stats_b_m -q GSM1218850_MB135DMMD.peak.q100.bed.gz -m,0.05928336942039216,0.000452416027477343,0.05930390044000001,0.05407237960784313,0.005203470588235295,0.058356044440000004,0.06041992544000001\n/home/sspathare97/layerlab/giggle/bin/giggle search -i split_stats_b_m -q GSM1218850_MB135DMMD.peak.q100.bed.gz -m -u 'mean>0.0003',0.06146501216086957,0.0005752456971642424,0.061404315900000006,0.053664041739130426,0.007794006086956524,0.0604301879,0.0639016069\n$GIGGLE_ROOT/bin/giggle search -i split_stats_b -r 1:1-50000,0.003400331696758894,0.00043316521622550316,0.0032878027600000003,0.0028526968379446608,0.0005706614229249011,0.00264221676,0.0057718577600000005\n$GIGGLE_ROOT/bin/giggle search -i split_stats_b_m -r 1:1-50000,0.003360303457366549,0.0004466208160607616,0.00322975242,0.0030073525978647655,0.0005151494661921707,0.00264272692,0.00542664792\n$GIGGLE_ROOT/bin/giggle search -i split_stats_b_m -r 1:1-50000 -m,0.0035420469646408864,0.0004794461690889922,0.0034472046000000004,0.0030072174953959478,0.0005688710865561694,0.0027772796000000003,0.0056387466\n/home/sspathare97/layerlab/giggle/bin/giggle search -i split_stats_b_m -r 1:1-50000 -m -u 'mean>0.0003',0.0035060910681889777,0.0005422508271568081,0.0033619860800000005,0.002974596692913382,0.0005560202362204725,0.00283441258,0.010824484580000002\n"
  },
  {
    "path": "experiments/metadata_index_query_filter/metadata_comparisons/i1.csv",
    "content": "command,mean,stddev,median,user,system,min,max\n\"$GIGGLE_ROOT/bin/giggle index -s -f -i \"\"split_stats/*gz\"\" -o split_stats_b\",2.3014006040000003,0.01886583728794614,2.3046401646000003,2.1843468800000005,0.11592475999999999,2.2725828176,2.3269391096\n"
  },
  {
    "path": "experiments/metadata_index_query_filter/metadata_comparisons/i2.csv",
    "content": "command,mean,stddev,median,user,system,min,max\n\"$GIGGLE_ROOT/bin/giggle index -s -f -i \"\"split_stats/*gz\"\" -o split_stats_b_m -m \"\"split_stats_metadata.conf\"\"\",3.21789765232,0.07718254445598732,3.23337241512,2.90494334,0.3117602,3.0216530646199997,3.28775030562\n"
  },
  {
    "path": "experiments/metadata_index_query_filter/metadata_comparisons/q1.csv",
    "content": "command,mean,stddev,median,user,system,min,max\n$GIGGLE_ROOT/bin/giggle search -i split_stats_b -q GSM1218850_MB135DMMD.peak.q100.bed.gz,0.059051921914693876,0.0005088443123209759,0.058950880180000005,0.05230880857142859,0.006741488163265304,0.05807585618000001,0.06034612818000001\n"
  },
  {
    "path": "experiments/metadata_index_query_filter/metadata_comparisons/q2.csv",
    "content": "command,mean,stddev,median,user,system,min,max\n$GIGGLE_ROOT/bin/giggle search -i split_stats_b_m -q GSM1218850_MB135DMMD.peak.q100.bed.gz,0.058883977340000004,0.00042418272631334546,0.058831946940000004,0.05315283999999997,0.00573212,0.05821420544,0.060353847440000004\n"
  },
  {
    "path": "experiments/metadata_index_query_filter/metadata_comparisons/q3.csv",
    "content": "command,mean,stddev,median,user,system,min,max\n$GIGGLE_ROOT/bin/giggle search -i split_stats_b_m -q GSM1218850_MB135DMMD.peak.q100.bed.gz -m,0.05928336942039216,0.000452416027477343,0.05930390044000001,0.05407237960784313,0.005203470588235295,0.058356044440000004,0.06041992544000001\n"
  },
  {
    "path": "experiments/metadata_index_query_filter/metadata_comparisons/q4.csv",
    "content": "command,mean,stddev,median,user,system,min,max\n/home/sspathare97/layerlab/giggle/bin/giggle search -i split_stats_b_m -q GSM1218850_MB135DMMD.peak.q100.bed.gz -m -u 'mean>0.0003',0.06146501216086957,0.0005752456971642424,0.061404315900000006,0.053664041739130426,0.007794006086956524,0.0604301879,0.0639016069\n"
  },
  {
    "path": "experiments/metadata_index_query_filter/metadata_comparisons/s1.csv",
    "content": "command,mean,stddev,median,user,system,min,max\n$GIGGLE_ROOT/bin/giggle search -i split_stats_b -r 1:1-50000,0.003400331696758894,0.00043316521622550316,0.0032878027600000003,0.0028526968379446608,0.0005706614229249011,0.00264221676,0.0057718577600000005\n"
  },
  {
    "path": "experiments/metadata_index_query_filter/metadata_comparisons/s2.csv",
    "content": "command,mean,stddev,median,user,system,min,max\n$GIGGLE_ROOT/bin/giggle search -i split_stats_b_m -r 1:1-50000,0.003360303457366549,0.0004466208160607616,0.00322975242,0.0030073525978647655,0.0005151494661921707,0.00264272692,0.00542664792\n"
  },
  {
    "path": "experiments/metadata_index_query_filter/metadata_comparisons/s3.csv",
    "content": "command,mean,stddev,median,user,system,min,max\n$GIGGLE_ROOT/bin/giggle search -i split_stats_b_m -r 1:1-50000 -m,0.0035420469646408864,0.0004794461690889922,0.0034472046000000004,0.0030072174953959478,0.0005688710865561694,0.0027772796000000003,0.0056387466\n"
  },
  {
    "path": "experiments/metadata_index_query_filter/metadata_comparisons/s4.csv",
    "content": "command,mean,stddev,median,user,system,min,max\n/home/sspathare97/layerlab/giggle/bin/giggle search -i split_stats_b_m -r 1:1-50000 -m -u 'mean>0.0003',0.0035060910681889777,0.0005422508271568081,0.0033619860800000005,0.002974596692913382,0.0005560202362204725,0.00283441258,0.010824484580000002\n"
  },
  {
    "path": "experiments/speed_test/README.md",
    "content": "Get source code \n\n    git clone https://github.com/arq5x/bedtools2.git\n    cd bedtools2 \n    make -j 20\n    export BEDTOOLS_ROOT=`pwd`\n    cd ..\n\n    git clone https://github.com/samtools/htslib.git\n    cd htslib\n    autoheader\n    autoconf\n    ./configure --disable-bz2 --disable-lzma --enable-libcurl \n    make -j 20\n    export HTSLIB_ROOT=`pwd`\n    cd ..\n\n    git clone https://github.com/ryanlayer/giggle.git\n    cd giggle\n    make -j 20\n    export GIGGLE_ROOT=`pwd`\n    cd ..\n\n    wget -O gsort https://github.com/brentp/gsort/releases/download/v0.0.4/gsort_linux_amd64\n    chmod +x gsort\n\n    wget -O gargs https://github.com/brentp/gargs/releases/download/v0.3.6/gargs_linux\n    chmod +x gargs\n\nGet database data and index\n\n    mkdir ucsc_data\n    cd ucsc_data\n\n    rsync -a -P rsync://hgdownload.cse.ucsc.edu/goldenPath/hg19/database ./\n\n    mkdir parsed_tracks\n\n    ls database/*sql \\\n    | gargs -p 30 \\\n        \"python $GIGGLE_ROOT/examples/ucsc/parse_sql.py {} parsed_tracks/\"\n\n    mkdir parsed_tracks_sorted\n\n    $GIGGLE_ROOT/scripts/sort_bed \"parsed_tracks/*gz\" parsed_tracks_sorted 30\n\n    time $GIGGLE_ROOT/bin/giggle \\\n        index \\\n        -i \"parsed_tracks_sorted/*gz\" \\\n        -o parsed_tracks_sorted_b \\\n        -s \\\n        -f\n    Indexed 6980993757 intervals.\n\n    real    268m46.033s\n    user    245m44.262s\n    sys     11m51.567s\n\n    cd ..\n\n    mkdir rme_data\n    cd rme_data\n    wget http://egg2.wustl.edu/roadmap/data/byFileType/chromhmmSegmentations/ChmmModels/coreMarks/jointModel/final/all.mnemonics.bedFiles.tgz\n    mkdir orig\n    tar zxvf all.mnemonics.bedFiles.tgz -C orig/\n    mkdir split\n\n    pip install --user toolshed\n\n    python $GIGGLE_ROOT/examples/rme/rename.py \\\n        $GIGGLE_ROOT/examples/rme/states.txt \\\n        $GIGGLE_ROOT/examples/rme/EDACC_NAME.txt \\\n        \"orig/*gz\" \\\n        \"split/\"\n\n    cd split\n    ls *.bed | ../gargs -p 30 \"bgzip {}\"\n    cd ..\n\n    mkdir split_sort\n    $GIGGLE_ROOT/scripts/sort_bed \"split/*gz\" split_sort/ 30\n\n    cd split_sort\n    time ls *.bed.gz | ../gargs \"tabix {}\"\n\n    real    2m49.350s\n    user    2m13.874s\n    sys     0m34.953s\n\n    cd ..\n\n    time $GIGGLE_ROOT/bin/giggle index \\\n        -i \"split_sort/*gz\" \\\n        -o split_sort_b \\\n        -f -s\n    Indexed 55605005 intervals.\n\n    real    1m22.409s\n    user    1m18.907s\n    sys     0m3.379s\n\n    cd ..\n\nRandom query sets\n\n    cd rme_data\n\n    zcat split_sort/Adipose_Nuclei_Repressed_PolyComb.bed.gz \\\n    | cut -f1 \\\n    | uniq > rme_chrm_order.txt\n\n    for s in `cat rme_chrm_order.txt`; do\n        grep -w $s $GIGGLE_ROOT/data/human.hg19.genome\n    done \\\n    > rme.human.hg19.genome\n\n    Q_SIZES=\"10 100 1000 10000 100000 1000000\"\n    for Q_SIZE in $Q_SIZES; do\n        bedtools random -n $Q_SIZE -g rme.human.hg19.genome  \\\n        | ../gsort /dev/stdin rme.human.hg19.genome \\\n        | bgzip -c \\\n        > rme_r$Q_SIZE.bed.gz\n    done\n\n    cd ..\n\n    cd ucsc_data\n\n    zcat parsed_tracks_sorted/snp147.bed.gz \\\n    | cut -f1 \\\n    | uniq \\\n    > ucsc_chrm_order.txt\n\n    for s in `cat ucsc_chrm_order.txt`; do\n        grep -w $s $GIGGLE_ROOT/data/human.hg19.genome\n    done \\\n    > ucsc.human.hg19.genome\n\n    Q_SIZES=\"10 100 1000 10000 100000 1000000\"\n    for Q_SIZE in $Q_SIZES; do\n        bedtools random -n $Q_SIZE -g ucsc.human.hg19.genome  \\\n        | ../gsort /dev/stdin ucsc.human.hg19.genome \\\n        | bgzip -c \\\n        > ucsc_r$Q_SIZE.bed.gz\n    done\n    cd ..\n\nSpeed tests\n\n    cd rme_data\n\n    export RESULTS=rme.speed_test\n\n    Q_SIZES=\"10 100 1000 10000 100000 1000000\"\n    for Q_SIZE in $Q_SIZES; do\n        $GIGGLE_ROOT/experiments/speed_test/speed_test.sh \\\n            rme_r$Q_SIZE.bed.gz \\\n            split_sort \\\n            rme.human.hg19.genome\n    done \\\n    > $RESULTS\n\n    (cat $RESULTS  |  awk '$1==\"giggle\"' |  awk '{print $4;}' |  paste -sd \" \" -;\n     cat $RESULTS  |  awk '$1==\"bedtools\"' | awk '{print $4;}' |  paste -sd \" \" -;\n     cat $RESULTS  |  awk '$1==\"tabix\"' | awk '{print $4;}' |  paste -sd \" \" -) \\\n    | $GIGGLE_ROOT/scripts/lines.py \\\n        -o $RESULTS.pdf \\\n        --legend_loc 4 \\\n        --plot_width 4 \\\n        --plot_height 3 \\\n        --xticks \",10,100,1000,1e4,1e5,1e6\" \\\n        --xlabel \"Number query intervals\" \\\n        --ylabel \"Run time (s)\" \\\n        --ylog \\\n        -c \"#00405B,#4A7C96,#0091D6\" \\\n        --x_min -0.1  --x_max 5.1 \\\n        --y_min 2e-3  --y_max 1000000 \\\n        --legend \"GIGGLE,BEDTOOLS,TABIX\" \\\n        --legend_loc 4\n\n    cd ..\n\n    cd ucsc_data\n\n    export RESULTS=ucsc.speed_test\n\n    Q_SIZES=\"10 100 1000 10000 100000 1000000\"\n    for Q_SIZE in $Q_SIZES; do\n        $GIGGLE_ROOT/experiments/speed_test/speed_test.sh \\\n            ucsc_r$Q_SIZE.bed.gz \\\n            parsed_tracks_sorted \\\n            ucsc.human.hg19.genome\n    done \\\n    > $RESULTS\n    \n    (cat $RESULTS  |  awk '$1==\"giggle\"' |  awk '{print $4;}' |  paste -sd \" \" -;\n     cat $RESULTS  |  awk '$1==\"bedtools\"' | awk '{print $4;}' |  paste -sd \" \" -;\n     cat $RESULTS  |  awk '$1==\"tabix\"' | awk '{print $4;}' |  paste -sd \" \" -) \\\n    | $GIGGLE_ROOT/scripts/lines.py \\\n        -o $RESULTS.pdf \\\n        --legend_loc 4 \\\n        --plot_width 4 \\\n        --plot_height 3 \\\n        --xticks \",10,100,1000,1e4,1e5,1e6\" \\\n        --xlabel \"Number query intervals\" \\\n        --ylabel \"Run time (s)\" \\\n        --ylog \\\n        -c \"#00405B,#4A7C96,#0091D6\" \\\n        --x_min -0.1  --x_max 5.1 \\\n        --y_min 2e-3  --y_max 1000000 \\\n        --legend \"GIGGLE,BEDTOOLS,TABIX\" \\\n        --legend_loc 4\n"
  },
  {
    "path": "experiments/speed_test/speed_test.sh",
    "content": "#!/bin/bash\n\nif [ \"$#\" -ne \"3\" ]; then\n    echo \"usage: $0 <query file> <dataset> <genome>\"\n    exit 1\nfi\n\nexport QUERY_FILE=$1\nexport DATA_DIR=$2\nexport GENOME=$3\n\necho -en \"giggle\\t$QUERY_FILE\\t$DATA_DIR\\t\"\n/usr/bin/time -f \"%e real\\t%U user\\t%S sys\" \\\n    $GIGGLE_ROOT/bin/giggle search \\\n    -i ${DATA_DIR}_b/ \\\n    -q $QUERY_FILE \\\n>/dev/null\n#| cut -d\":\" -f 3 | awk '{s+=$1;}END{print s;}'\n\necho -en \"bedtools\\t$QUERY_FILE\\t$DATA_DIR\\t\"\n/usr/bin/time -f \"%e real\\t%U user\\t%S sys\" \\\n    $BEDTOOLS_ROOT/bin/bedtools intersect \\\n    -sorted \\\n    -g $GENOME \\\n    -a $QUERY_FILE \\\n    -b $DATA_DIR/*gz \\\n> /dev/null\n#| wc -l\n\necho -en \"tabix\\t$QUERY_FILE\\t$DATA_DIR\\t\"\n/usr/bin/time -f \"%e real\\t%U user\\t%S sys\" \\\n    bash -c ' ls $DATA_DIR/*gz | xargs -I {} bash -c \"$HTSLIB_ROOT/tabix -R $QUERY_FILE {}\" > /dev/null'\n#bash -c ' ls $DATA_DIR/*gz | xargs -I {} bash -c \"$HTSLIB_ROOT/tabix -R $QUERY_FILE {}\" | wc -l'\n"
  },
  {
    "path": "flake.nix",
    "content": "{\n  inputs = {\n    nixpkgs.url = \"github:nixos/nixpkgs/nixos-25.11\";\n    utils.url = \"github:numtide/flake-utils\";\n  };\n\n  outputs =\n    {\n      self,\n      nixpkgs,\n      utils,\n    }:\n    utils.lib.eachDefaultSystem (\n      system:\n      let\n        pkgs = nixpkgs.legacyPackages.${system};\n      in\n      {\n        # Package definition for external consumption\n        packages.default = pkgs.stdenv.mkDerivation {\n          pname = \"giggle\";\n          version = \"unstable\";\n          src = ./.;\n\n          # Build tools\n          nativeBuildInputs = with pkgs; [\n            gcc\n            gnumake\n            autoconf\n            automake\n            libtool\n          ];\n\n          # Libraries\n          buildInputs = with pkgs; [\n            zlib\n            bzip2\n            xz\n            curl\n            openssl\n            htslib\n          ];\n\n          # Set the environment variables expected by the Makefile\n          preBuild = ''\n            export HTS_INC=${pkgs.htslib}/include\n            export HTS_LIB=${pkgs.htslib}/lib\n          '';\n\n          # Standard install phase to output the binary\n          installPhase = ''\n            mkdir -p $out/bin\n            cp bin/giggle $out/bin/\n          '';\n        };\n\n        # Development shell for contributors\n        devShells.default = pkgs.mkShell {\n          # Automatically inherit all the build dependencies from the package above\n          inputsFrom = [ self.packages.${system}.default ];\n\n          packages = with pkgs; [\n            # Testing/utilities not needed for the build itself, but useful for dev\n            bedtools\n          ];\n\n          shellHook = ''\n            export GIGGLE_ROOT=$PWD\n            export HTS_INC=${pkgs.htslib}/include\n            export HTS_LIB=${pkgs.htslib}/lib\n          '';\n        };\n      }\n    );\n}\n"
  },
  {
    "path": "scripts/cross.py",
    "content": "#!/usr/bin/python\nimport glob\nimport sys\nimport math\nfrom optparse import OptionParser\nimport os\n\nparser = OptionParser()\n\nparser.add_option(\"--pretty_names\",\n                  dest=\"pretty_name_file\",\n                  help=\"Map of GEO id to pretty names for axis labels\")\n\nparser.add_option( \"--q_x\",\n                  dest=\"q_x\",\n                  help=\"GEO ids to exclude from the query\")\n\n\nparser.add_option( \"--db_x\",\n                  dest=\"db_x\",\n                  help=\"GEO ids to exclude from the DB\")\n\nparser.add_option(\"-d\",\n                  \"--db_file\",\n                  dest=\"db_file\",\n                  help=\"File with database GEO sample ids to consider\")\n\nparser.add_option(\"-q\",\n                  \"--query_file\",\n                  dest=\"query_file\",\n                  help=\"File with query GEO sample ids to consider\")\n\nparser.add_option(\"-c\",\n                  \"--cistrome_data\",\n                  dest=\"cistrome_data_file\",\n                  help=\"Cistrome data\")\n\nparser.add_option(\"--qc\",\n                  dest=\"qc_data_file\",\n                  help=\"File with GEO id to file name map\")\n\nparser.add_option(\"--lc\",\n                  dest=\"line_count_file\",\n                  help=\"Number of lines in db/query file\")\n\nparser.add_option(\"--name_map\",\n                  dest=\"name_map_file\",\n                  help=\"File with cistrome name map\")\n\nparser.add_option(\"-i\",\n                  \"--input_dir\",\n                  dest=\"input_dir\",\n                  help=\"Input directory\")\n\nparser.add_option(\"-o\",\n                  \"--output\",\n                  dest=\"output_file\",\n                  help=\"Output file name\")\n\nparser.add_option(\"--x_size\",\n                  dest=\"x_size\",\n                  type=\"int\",\n                  default=10,\n                  help=\"Figure x size (Default 10)\")\n\nparser.add_option(\"--y_size\",\n                  dest=\"y_size\",\n                  type=\"int\",\n                  default=30,\n                  help=\"Figure x size (Default 30)\")\n\n(options, args) = parser.parse_args()\n\n#if not options.output_file:\n#    parser.error('Output file not given')\n#if not options.input_dir:\n#    parser.error('Iput directory not given')\n#if not options.query_file:\n#    parser.error('Querys id file not given')\n#if not options.db_file:\n#    parser.error('Database id file not given')\n\npretty_names = {}\nif options.pretty_name_file:\n    for l in open(options.pretty_name_file, 'r'):\n        A = l.rstrip().split('\\t')\n        pretty_names[A[0]] = A[1:]\n\ncistrome_to_pretty_name_map = {}\nfor l in open(options.name_map_file, 'r'):\n    A = l.rstrip().split()\n    cistrome_to_pretty_name_map[A[0]] = A[1]\n\npretty_name_to_geoid_map={}\ncistrome_data_by_geoid={}\ncistrome_id_to_geoid={}\nfor l in open(options.cistrome_data_file, 'r'):\n    A = l.rstrip().split('\\t')\n    cistrome_data_by_geoid[A[1]] = {}\n    cistrome_data_by_geoid[A[1]]['cis_id'] = A[0]\n    cistrome_data_by_geoid[A[1]]['geo_id'] = A[1]\n    cistrome_data_by_geoid[A[1]]['species'] = A[2]\n    cistrome_data_by_geoid[A[1]]['cell_line'] = A[3]\n    cistrome_data_by_geoid[A[1]]['tissue'] = A[4]\n    cistrome_data_by_geoid[A[1]]['cell_type'] = A[5]\n    cistrome_data_by_geoid[A[1]]['protein'] = A[6]\n    cistrome_data_by_geoid[A[1]]['orig_file_name'] = A[7]\n\n    pretty_name_to_geoid_map[cistrome_to_pretty_name_map[A[7]] + '.gz'] = A[1] \n\n    cistrome_id_to_geoid[A[0]] = A[1]\n\n\nqc_by_geoid=None\nif options.qc_data_file:\n    qc_by_geoid={}\n    for l in open(options.qc_data_file, 'r'):\n        A = l.rstrip().split('\\t')\n        if A[0] == 'id':\n            continue\n\n        qc_by_geoid[cistrome_id_to_geoid[A[0]]] = { \\\n                'map' : A[1], \\\n                'peaks' : A[2], \\\n                'fastqc' : A[3], \\\n                'frip' : A[4], \\\n                'pbc' : A[5], \\\n                'motif_judge' : A[6], \\\n                'dhs' : A[7]}\n\nline_count_by_geoid={}\nfor l in open(options.line_count_file, 'r'):\n    A = l.rstrip().split('\\t')\n    line_count_by_geoid[pretty_name_to_geoid_map[A[0]]] = int(A[1])\n\nDB_ids=[]\nif options.db_file:\n    for l in open(options.db_file, 'r'):\n        DB_ids.append(l.rstrip().split()[0])\n\nQ_ids=[]\nif options.query_file:\n    for l in open(options.query_file, 'r'):\n        Q_ids.append(l.rstrip().split()[0])\n\nD = []\nX_names = []\nY_names = []\n\nresults = {}\n\nQ_ids = [Q_id for Q_id in Q_ids if line_count_by_geoid[Q_id] > 20]\nif qc_by_geoid:\n    Q_ids = [Q_id for Q_id in Q_ids if qc_by_geoid[Q_id]['peaks'] == 'true']\n    Q_ids = [Q_id for Q_id in Q_ids if qc_by_geoid[Q_id]['frip'] == 'true']\n\nif options.q_x:\n    Q_x = options.q_x.split(',')\n    Q_ids = [Q_id for Q_id in Q_ids if Q_id not in Q_x]\n\nDB_ids = [DB_id for DB_id in DB_ids if line_count_by_geoid[DB_id] > 20]\nif qc_by_geoid:\n    DB_ids = [DB_id for DB_id in DB_ids if qc_by_geoid[DB_id]['peaks'] == 'true']\n    DB_ids = [DB_id for DB_id in DB_ids if qc_by_geoid[DB_id]['frip'] == 'true']\n\n\nif options.db_x:\n    DB_x = options.db_x.split(',')\n    DB_ids = [DB_id for DB_id in DB_ids if DB_id not in DB_x]\n\n\nfor file_name in glob.glob(options.input_dir):\n    query_file_name = '.'.join(file_name.split('/')[-1].split('.')[:-1])\n    query_id = pretty_name_to_geoid_map[query_file_name]\n\n    if query_id not in Q_ids:\n        continue\n\n    results[query_id] = {}\n\n    for l in open(file_name, 'r'):\n        A = l.rstrip().split('\\t')\n        if A[-1] == 'combo_score':\n            continue\n\n        db_id = pretty_name_to_geoid_map[A[0].split('/')[-1]]\n\n        if  db_id not in DB_ids:\n            continue\n\n        results[query_id][db_id] = float(A[-1])\n\n\nD = []\n\nfor Q_id in Q_ids:\n    d = []\n    for DB_id in DB_ids:\n        if DB_id not in results[Q_id]:\n            print Q_id, len(results[Q_id].keys()), 'GSM1024799' in results[Q_id]\n            sys.exit(1)\n        d.append(results[Q_id][DB_id])\n    D.append(d)\n\nY_names = []\nY_colors = []\nfor Q_id in Q_ids:\n    if Q_id in pretty_names:\n        Y_names.append(pretty_names[Q_id][0])\n        if len(pretty_names[Q_id]) > 1:\n            Y_colors.append(pretty_names[Q_id][1])\n        else:\n            Y_colors.append('black')\n    else:\n        #Y_names.append(cistrome_data_by_geoid[Q_id]['protein'] + ' ' + \\\n                        #cistrome_data_by_geoid[Q_id]['geo_id'] )\n        Y_names.append(cistrome_data_by_geoid[Q_id]['protein'])\n        Y_colors.append('black')\n\n\nX_names = []\nX_colors = []\nfor DB_id in DB_ids:\n    if DB_id in pretty_names:\n        X_names.append(pretty_names[DB_id][0])\n        if len(pretty_names[DB_id]) > 1:\n            X_colors.append(pretty_names[DB_id][1])\n        else:\n            X_colors.append('black')\n    else:\n        #X_names.append(cistrome_data_by_geoid[DB_id]['protein'] + ' ' + \\\n                        #cistrome_data_by_geoid[DB_id]['geo_id'] )\n        X_names.append(cistrome_data_by_geoid[DB_id]['protein'])\n        X_colors.append('black')\n\n#Y_names = Q_ids\n#X_names = DB_ids\n\nimport matplotlib\nmatplotlib.use('Agg')\nimport matplotlib.pyplot as plt\nimport numpy as np\n\nNP_D=np.zeros([len(Y_names),len(X_names)])\n\nc = 0\nfor d in D:\n    s = 0\n    for v in d:\n        NP_D[c,s] = v\n        s+=1\n    c+=1\n\nprint c,s\n\nfig, ax = plt.subplots(figsize=(options.x_size,options.y_size), \\\n                               dpi=300)\nfrom matplotlib import colors as mcolors\nfrom matplotlib.colors import Normalize\n\n_seismic_data = ( (0.0, 0.0, 0.3),\n                  (0.0, 0.0, 1.0),\n\n                  (1.0, 1.0, 1.0),\n\n                  (1.0, 0.0, 0.0),\n                  (0.5, 0.0, 0.0))\n\nhm = mcolors.LinearSegmentedColormap.from_list( \\\n        name='red_white_blue', \\\n        colors=_seismic_data, N=256)\n\nclass MidpointNormalize(Normalize):\n    def __init__(self, vmin=None, vmax=None, midpoint=None, clip=False):\n        self.midpoint = midpoint\n        Normalize.__init__(self, vmin, vmax, clip)\n\n    def __call__(self, value, clip=None):\n        # I'm ignoring masked values and all kinds of edge cases to make a\n        # simple example...\n        x, y = [self.vmin, self.midpoint, self.vmax], [0, 0.5, 1]\n        return np.ma.masked_array(np.interp(value, x, y))\n\nfrom pylab import get_cmap\n\ndata = NP_D\nprint data.min(), data.max()\nplt.pcolor(data, \n           cmap=get_cmap(\"Reds\"))\n           #cmap=get_cmap(\"Rlues\"))\n           #cmap=hm)\n           #norm = MidpointNormalize(midpoint=100),\n\nax.set_frame_on(False)\nax.xaxis.tick_top()\nax.xaxis.set_ticks_position('none')\nax.yaxis.set_ticks_position('none')\nax.set_xticks(np.arange(len(X_names)) + 0.5, minor=False)\nax.set_yticks(np.arange(len(Y_names)) + 0.5, minor=False)\nax.set_xticklabels(X_names,rotation=90)\n\n\ni = 0\nfor xtick in ax.get_xticklabels():\n    xtick.set_color(X_colors[i])\n    i+=1\n\ni = 0\nfor ytick in ax.get_yticklabels():\n    # colors from bottom to top\n    ytick.set_color(Y_colors[len(Y_colors) - 1 -i])\n    i+=1\n\n\nif options.pretty_name_file:\n    ax.set_yticklabels(Y_names[::-1])\nelse:\n    ax.set_yticklabels(Y_names)\nplt.ylim((0,len(Y_names)))\nplt.xlim((0,len(X_names)))\ncbar = plt.colorbar(fraction=0.046, pad=0.01, aspect=50)\ncbar.ax.tick_params(labelsize=10)\n\nplt.savefig(options.output_file,bbox_inches='tight')\n"
  },
  {
    "path": "scripts/get_overlaps.html",
    "content": "<!DOCTYPE html> \n<html>\n<head>\n<script src=\"http://ajax.googleapis.com/ajax/libs/jquery/1.11.2/jquery.min.js\" type=\"text/javascript\">\n</script>\n<!-- Latest compiled and minified CSS -->\n<link rel=\"stylesheet\" href=\"https://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/css/bootstrap.min.css\" integrity=\"sha384-1q8mTJOASx8j1Au+a5WDVnPi2lkFfwwEAa8hDDdjZlpLegxhjVME1fgjWPGmkzs7\" crossorigin=\"anonymous\">\n\n<!-- Optional theme -->\n<link rel=\"stylesheet\" href=\"https://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/css/bootstrap-theme.min.css\" integrity=\"sha384-fLW2N01lMqjakBkx3l/M9EahuwpSfeNvV63J5ezn3uZzapT0u7EYsXMjQV+0En5r\" crossorigin=\"anonymous\">\n\n<!-- Latest compiled and minified JavaScript -->\n<script src=\"https://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/js/bootstrap.min.js\" integrity=\"sha384-0mSbJDEHialfmuBBQP6A4Qrprq5OVfW37PRR3j5ELqxss1yVqOtnepnHVP9aJ7xS\" crossorigin=\"anonymous\"></script> \n<!-- Write Javascript code here -->\n<script type=\"text/javascript\">\n\n$.urlParam = function(name){\n    var results = new RegExp('[\\?&]' + name + '=([^&#]*)').exec(window.location.href);\n    if (results==null){\n        return null;\n    }else{\n        return results[1] || 0;\n    }\n}    \n\n$(document).ready(function(){\n  console.log(decodeURIComponent($.urlParam('server')));\n  if (decodeURIComponent($.urlParam('server')) != 'null') {\n    $('#servername').val(\"http://\" + decodeURIComponent($.urlParam('server')));\n  } else {\n    console.log(2);\n    $('#servername').val(\"http://localhost:8080/\");\n  }\n\n  $(':submit').on('click', function() { \n    $('#hits').html(''); // Clear #hits div\n    $('#hitshead').html(''); // Clear #hits div\n    var button = $(this).val();\n    var server = $('#RequestInfo').find('input[name=\"Server\"]').val();\n    var region = $('#RequestInfo').find('input[name=\"Region\"]').val();\n    $.ajax({\n      url: server,\n      data: 'region=' + region, \n      dataType: 'jsonp',\n      jsonp: false,\n      jsonpCallback: \"myJsonMethod\",\n    })\n    .done(function(data) { \n\n        console.log(data.dim1.vals.indexOf(\"Quiescent Low\"));\n\n        $('#hitshead').append('<td>hits</td>');\n\n        $('#hitshead').append('<td>' + data.dim1.name + '</td>');\n        $('#hitshead').append('<td>' + data.dim2.name + '</td>');\n\n        //$.each(data.files[0].info, function(key,val){\n            //$('#hitshead').append('<td>' + key + '</td>');\n        //});\n\n        for (var i in data.files) {\n            if (data.files[i].overlaps > 0 ) {\n                var row = '<tr>';\n                row = row + '<td>' + data.files[i].overlaps + '</td>';\n                $.each(data.files[i].info, function(key,val){\n                    row = row + '<td>' + val + '</td>';\n                });\n                row = row + '</tr>';\n                $('#hits').append(row);\n            }\n        }\n    });\n    return false; // keeps the page from not refreshing \n  });\n});\n</script> \n</head>\n \n<body>\n  <div id=\"RequestInfo\">\n    <input type=\"text\" name=\"Server\" id=\"servername\" value=\"http://localhost:8080/\" /> </br>\n    <input type=\"text\" name=\"Region\" value=\"chr1:100-1000\" /> </br>\n    <button value=\"all\" type=\"submit\">Get Overlaps</button>\n  </div>\n  <table id=\"hittable\" class=\"table table-striped\">\n        <thead> <tr id=\"hitshead\"></tr></thead>\n        <tbody id=\"hits\">\n        </tbody>\n  </table>\n</body>\n</html>\n"
  },
  {
    "path": "scripts/get_ucsc_url.html",
    "content": "<!DOCTYPE html> \n<html>\n<head>\n<script src=\"http://ajax.googleapis.com/ajax/libs/jquery/1.11.2/jquery.min.js\" type=\"text/javascript\">\n</script>\n<!-- Latest compiled and minified CSS -->\n<link rel=\"stylesheet\" href=\"https://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/css/bootstrap.min.css\" integrity=\"sha384-1q8mTJOASx8j1Au+a5WDVnPi2lkFfwwEAa8hDDdjZlpLegxhjVME1fgjWPGmkzs7\" crossorigin=\"anonymous\">\n\n<!-- Optional theme -->\n<link rel=\"stylesheet\" href=\"https://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/css/bootstrap-theme.min.css\" integrity=\"sha384-fLW2N01lMqjakBkx3l/M9EahuwpSfeNvV63J5ezn3uZzapT0u7EYsXMjQV+0En5r\" crossorigin=\"anonymous\">\n\n<!-- Latest compiled and minified JavaScript -->\n<script src=\"https://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/js/bootstrap.min.js\" integrity=\"sha384-0mSbJDEHialfmuBBQP6A4Qrprq5OVfW37PRR3j5ELqxss1yVqOtnepnHVP9aJ7xS\" crossorigin=\"anonymous\"></script> \n<!-- Write Javascript code here -->\n<script type=\"text/javascript\">\n$(document).ready(function(){\n\n  $(':submit').on('click', function() { // This event fires when a button is clicked\n    var button = $(this).val();\n    var server = $('#RequestInfo').find('input[name=\"Server\"]').val();\n    var region = $('#RequestInfo').find('input[name=\"Region\"]').val();\n    $.ajax({ // ajax call starts\n      url: server, // JQuery loads serverside.php\n      data: 'region=' + region, // Send value of the clicked button\n      dataType: 'jsonp', // Choosing a JSON datatype\n      jsonp: false,\n      jsonpCallback: \"myJsonMethod\",\n    })\n    .done(function(data) { // Variable data contains the data we get from serverside\n        $('#overlaps').html(''); // Clear #overlaps div\n        $('#overlaptable').append('<thead> <tr> <td>hits</td><td>track</td></tr></thead>');\n        for (var i in data.files) {\n          $('#overlaps').append('<tr><td>' + \n                                data.files[i].overlaps + \n                                '</td><td>' + \n                                data.files[i].name + \n                                '</td></tr>');\n        }\n    });\n    return false; // keeps the page from not refreshing \n  });\n});\n</script> \n</head>\n \n<body>\n  <div id=\"RequestInfo\">\n    <input type=\"text\" name=\"Server\" value=\"http://localhost:8080/\" /> </br>\n    <input type=\"text\" name=\"Region\" value=\"chr1:100-1000\" /> </br>\n    <button value=\"all\" type=\"submit\">Get Overlaps</button>\n  </div>\n  <div id=\"Time\"></div>\n  <table id=\"overlaptable\" class=\"table table-striped\">\n        <tbody id=\"overlaps\">\n        </tbody>\n  </table>\n \n</body>\n</html>\n"
  },
  {
    "path": "scripts/giggle_gwas_heatmap.py",
    "content": "#!/usr/bin/python\nimport glob\nimport sys\nimport math\nfrom optparse import OptionParser\nimport matplotlib.pyplot as plt\nimport numpy as np\nimport os\n\nparser = OptionParser()\n\nparser.add_option(\"-o\",\n                  \"--output\",\n                  dest=\"output_file\",\n                  help=\"Output file name\")\n\nparser.add_option(\"-i\",\n                  \"--input_dir\",\n                  dest=\"input_dir\",\n                  help=\"Input directory\")\n\nparser.add_option(\"-s\",\n                  \"--states_file\",\n                  dest=\"states_file\",\n                  help=\"Genomic states\")\n\nparser.add_option(\"--states\",\n                  dest=\"states_list\",\n                  help=\"CSV or states to consider\")\n\nparser.add_option(\"-n\",\n                  \"--cell_names\",\n                  dest=\"cells_names_file\",\n                  help=\"Cells names file name\")\n\nparser.add_option(\"-c\",\n                  \"--cells\",\n                  dest=\"cells_file\",\n                  help=\"Cells file name\")\n\nparser.add_option(\"--group_names\",\n                  dest=\"group_names\",\n                  help=\"Group names\")\n\nparser.add_option(\"--x_size\",\n                  dest=\"x_size\",\n                  type=\"int\",\n                  default=10,\n                  help=\"Figure x size (Default 10)\")\n\nparser.add_option(\"--y_size\",\n                  dest=\"y_size\",\n                  type=\"int\",\n                  default=30,\n                  help=\"Figure x size (Default 30)\")\n\nparser.add_option(\"-b\",\n                  action=\"store_true\",\n                  default=False,\n                  dest=\"black\",\n                  help=\"black background\")\n\nparser.add_option(\"--ablines\",\n                  dest=\"ablines\")\n\nparser.add_option(\"--no_labels\",\n                  dest=\"no_labels\",\n                  action=\"store_true\",\n                  default=False,\n                  help=\"Do not label x and y axis\");\n\nparser.add_option(\"--no_ylabels\",\n                  dest=\"no_ylabels\",\n                  action=\"store_true\",\n                  default=False,\n                  help=\"Do not label y axis\");\n\n(options, args) = parser.parse_args()\nif not options.input_dir:\n    parser.error('Input directory not given')\nif not options.states_file:\n    parser.error('States file not given')\nif not options.states_list:\n    parser.error('States file not given')\nif not options.cells_file:\n    parser.error('Cells file not given')\nif not options.cells_names_file:\n    parser.error('Cells names file not given')\n\nviz_states = options.states_list.split(',')\n\nstates = []\nfor l in open(options.states_file, 'r'):\n    states.append(l.rstrip().split('\\t')[1])\n\nsorted_states = states[::]\nsorted_states.sort(lambda x,y: cmp(len(y), len(x)))\n\ncells = []\nfor l in open(options.cells_file, 'r'):\n    cells.append(l.rstrip().split('\\t')[1])\n\nnames = []\nfor l in open(options.cells_names_file, 'r'):\n    names.append(l.rstrip().split('\\t')[1])\n\n\n#\n#group_names = {}\n#for l in open(options.group_names_file, 'r'):\n#    A = l.rstrip().split('\\t')\n#    group_names[A[0]] = A[1]\n#\n#cell_names = {}\n#cells_to_groups = {}\n#groups_to_cells = {}\n#names = []\n#for l in open(options.cells_file, 'r'):\n#    #cells.append(l.rstrip().split('\\t')[1])\n#    A = l.rstrip().split('\\t')\n#    names.append(A[1])\n#    cell_names[A[0]] = A[1]\n#    if A[0] in group_names:\n#        cells_to_groups[A[1]] = group_names[A[0]]\n#        groups_to_cells[group_names[A[0]]] = A[1]\n#\n#all_states = []\n#for l in open(options.states_file_name, 'r'):\n#    A = l.rstrip().split('\\t')\n#    all_states.append(A[1])\n#\n#all_states.sort(lambda x,y: cmp(len(y), len(x)))\n#\n#for state in states:\n#    if state not in all_states:\n#        print 'Unknown state: ' + state\n#        sys.exit(1)\n#\nresults = {}\n\nfor file_name in glob.glob(options.input_dir):\n    trait = file_name.split('/')[-1].split('.')[0]\n\n    results[trait] = {}\n\n    for l in open(file_name, 'r'):\n        A = l.rstrip().split('\\t')\n        if A[-1] == 'combo_score':\n            continue\n\n        curr_state = ''\n        for state in sorted_states:\n            if state in A[0]:\n                curr_state = state\n                break\n\n        tissue = A[0].split('/')[-1][:-7][:-1*(len(curr_state) + 1)]\n\n        if tissue not in results[trait]:\n            results[trait][tissue] = {}\n\n        if curr_state in viz_states:\n            results[trait][tissue][curr_state] = float(A[7])\n\ntraits = results.keys()\nD=np.zeros([len(cells),2*len(traits)])\n\nprint len(traits)\n\nprint '\\n'.join(traits)\n\nsorted_traits = ['Celiac_disease',\n                 'Autoimmune_thyroiditis',\n                 'Primary_biliary_cirrhosis',\n                 'Rheumatoid_arthritis',\n                 'Asthma',\n                 'Allergy',\n                 'Kawasaki_disease',\n                 'Behcets_disease',\n                 'Vitiligo',\n                 'Alopecia_areata',\n                 'Systemic_lupus_erythematosus',\n                 'Systemic_sclerosis',\n                 'Type_1_diabetes',\n                 'Crohns_disease',\n                 'Ulcerative_colitis',\n                 'Ankylosing_spondylitis',\n                 'Atopic_dermatitis',\n                 'Primary_sclerosing_cholangitis',\n                 'Juvenile_idiopathic_arthritis',\n                 'Psoriasis',\n                 'Multiple_sclerosis',\n                 'Renal_function_related_traits_BUN',\n                 'Fasting_glucose_related_traits',\n                 'Migraine',\n                 'HDL_cholesterol',\n                 'Platelet_counts',\n                 'LDL_cholesterol',\n                 'Restless_legs_syndrome',\n                 'Bone_mineral_density',\n                 'Red_blood_cell_traits',\n                 'Chronic_kidney_disease',\n                 'Progressive_supranuclear_palsy',\n                 'Alzheimers_combined',\n                 'Liver_enzyme_levels_gamma_glutamyl_transferase',\n                 'Urate_levels',\n                 'Type_2_diabetes',\n                 'Creatinine_levels',\n                 'Triglycerides',\n                 'C_reactive_protein' ]\n\nc = 0\nfor cell in cells:\n    t = 0\n    for trait in sorted_traits:\n    #for trait in traits:\n        #D[c,t] = M[cell][state]\n        D[c,t] = results[trait][cell][viz_states[0]]\n        t+=1\n    for trait in sorted_traits:\n        D[c,t] = results[trait][cell][viz_states[1]]\n        t+=1\n    c+=1\n\ndata = D\nidxs = np.argsort(names)\nnames=np.array(names)[idxs]\ndata=data[idxs]\n\n\nfig, ax = plt.subplots(figsize=(options.x_size,options.y_size), \\\n                       dpi=300)\nif options.black:\n    fig =  matplotlib.pyplot.figure(figsize=(options.x_size,options.y_size), \\\n                                    dpi=300, \\\n                                    facecolor='black')\n\n    ax = fig.add_subplot(1,1,1,axisbg='k')\n\n\nfrom matplotlib import colors as mcolors\nfrom matplotlib.colors import Normalize\n\n_seismic_data = ( (0.0, 0.0, 0.3), \n                  (0.0, 0.0, 1.0),\n\n                  (1.0, 1.0, 1.0),\n\n                  (1.0, 0.0, 0.0),\n                  (0.5, 0.0, 0.0))\n\nhm = mcolors.LinearSegmentedColormap.from_list( \\\n        name='red_white_blue', \\\n        colors=_seismic_data, N=256)\n\nclass MidpointNormalize(Normalize):\n    def __init__(self, vmin=None, vmax=None, midpoint=None, clip=False):\n        self.midpoint = midpoint\n        Normalize.__init__(self, vmin, vmax, clip)\n\n    def __call__(self, value, clip=None):\n        # I'm ignoring masked values and all kinds of edge cases to make a\n        # simple example...\n        x, y = [self.vmin, self.midpoint, self.vmax], [0, 0.5, 1]\n        return np.ma.masked_array(np.interp(value, x, y))\n\n\n#norm=matplotlib.colors.LogNorm(vmin=data.min(), vmax=data.max()), \\\nprint data.min(), data.max()\nplt.pcolor(data, \\\n           norm = MidpointNormalize(midpoint=0),\n           cmap=hm)\n           #cmap=plt.cm.seismic)\nax.xaxis.tick_top()\n\nax.xaxis.set_ticks_position('none') \nax.yaxis.set_ticks_position('none') \n\nif options.ablines:\n    for l in [int(x) for x in options.ablines.split(',')]:\n        ax.axhline(l, linestyle='--', color='k') \n\nax.axvline(21, linestyle='--', color='k') \nax.axvline(39, linestyle='-', color='k') \nax.axvline(39+21, linestyle='--', color='k') \n\n\nax.set_xticklabels(\"\")\nax.set_yticklabels(\"\")\n\nif options.no_labels:\n    ax.set_xticklabels(\"\")\n    ax.set_yticklabels(\"\")\nelif options.no_ylabels:\n    ax.set_yticklabels(\"\")\n\n    if options.state_names:\n        state_names = []\n        for l in open(options.state_names, 'r'):\n            state_names.append(l.rstrip())\n        if options.black:\n            plt.xticks(np.arange(0.5,len(state_names)+0.5,1.0),state_names,rotation=90, fontsize=10, color='white')\n        else:\n            plt.xticks(np.arange(0.5,len(state_names)+0.5,1.0),state_names,rotation=90, fontsize=10)\n    else:\n        if options.black:\n            plt.xticks(np.arange(0.5,len(states)+0.5,1.0),states,rotation=90, fontsize=10, color='white')\n        else:\n            plt.xticks(np.arange(0.5,len(states)+0.5,1.0),states,rotation=90, fontsize=10)\nelse:\n\n\n\n    if options.group_names:\n\n        group_names = []\n        for l in open(options.group_names, 'r'):\n            group_names.append(l.rstrip())\n        group_names.reverse()\n        if options.black:\n            plt.yticks(np.arange(0.5,len(group_names)+0.5,1.0),[x.decode(\"utf8\") for x in group_names], fontsize=10, color='white')\n        else:\n            plt.yticks(np.arange(0.5,len(group_names)+0.5,1.0),[x.decode(\"utf8\") for x in group_names], fontsize=10)\n\n    elif options.cells_names_file:\n        if options.black:\n            plt.yticks(np.arange(0.5,len(names)+0.5,1.0),[x.decode(\"utf8\") for x in names], fontsize=10, color='white')\n        else:\n            plt.yticks(np.arange(0.5,len(names)+0.5,1.0),[x.decode(\"utf8\") for x in names], fontsize=10)\n\n    else: \n        if options.black:\n            plt.yticks(np.arange(0.5,len(cells)+0.5,1.0),cells, fontsize=10, color='white')\n        else:\n            plt.yticks(np.arange(0.5,len(cells)+0.5,1.0),cells, fontsize=10)\n\n#    if options.state_names:\n#        state_names = []\n#        for l in open(options.state_names, 'r'):\n#            state_names.append(l.rstrip())\n#        if options.black:\n#            plt.xticks(np.arange(0.5,len(state_names)+0.5,1.0),state_names,rotation=90, fontsize=10, color='white')\n#        else:\n#            plt.xticks(np.arange(0.5,len(state_names)+0.5,1.0),state_names,rotation=90, fontsize=10)\n#    else:\n#        if options.black:\n#            plt.xticks(np.arange(0.5,len(state_names)+0.5,1.0),state_names,rotation=90, fontsize=10, color='white')\n#        else:\n#            plt.xticks(np.arange(0.5,len(states)+0.5,1.0),states,rotation=90, fontsize=10)\n\nplt.ylim((0,len(cells)))\nplt.xlim((0,2*len(traits)))\ncbar = plt.colorbar(fraction=0.026, pad=0.02, ticks=[data.min(), 0, data.max()])\ncbar.ax.tick_params(labelsize=10) \n\nif options.black:\n    cbar.ax.tick_params(color='white', labelcolor='white')\n    plt.savefig(options.output_file,bbox_inches='tight',\\\n                facecolor=fig.get_facecolor(),\\\n                transparent=True)\nelse:\n    plt.savefig(options.output_file,bbox_inches='tight')\n"
  },
  {
    "path": "scripts/giggle_heat_map.py",
    "content": "#!/usr/bin/python\nimport matplotlib\nmatplotlib.use('Agg')\nimport matplotlib.pyplot as plt\nimport numpy as np\nimport sys\nimport math\nfrom optparse import OptionParser\n\nparser = OptionParser()\n\nparser.add_option(\"-b\",\n                  action=\"store_true\",\n                  default=False,\n                  dest=\"black\",\n                  help=\"black background\")\n\nparser.add_option(\"--x_size\",\n                  dest=\"x_size\",\n                  type=\"int\",\n                  default=10,\n                  help=\"Figure x size (Default 10)\")\n\nparser.add_option(\"--y_size\",\n                  dest=\"y_size\",\n                  type=\"int\",\n                  default=30,\n                  help=\"Figure x size (Default 30)\")\n\nparser.add_option(\"--no_labels\",\n                  dest=\"no_labels\",\n                  action=\"store_true\",\n                  default=False,\n                  help=\"Do not label x and y axis\");\n\nparser.add_option(\"--no_ylabels\",\n                  dest=\"no_ylabels\",\n                  action=\"store_true\",\n                  default=False,\n                  help=\"Do not label y axis\");\n\n\nparser.add_option(\"--stat\",\n                  dest=\"stat\",\n                  default=\"combo\",\n                  help=\"Stat to plot (odds, sig, combo) (Default: combo)\")\n\nparser.add_option(\"-i\",\n                  \"--input\",\n                  dest=\"input_file\",\n                  help=\"GIGGLE result file name with '-s'\")\n\nparser.add_option(\"--ablines\",\n                  dest=\"ablines\")\n\nparser.add_option(\"-o\",\n                  \"--output\",\n                  dest=\"output_file\",\n                  help=\"Output file name\")\n\nparser.add_option(\"-s\",\n                  \"--states\",\n                  dest=\"states_file\",\n                  help=\"States file name\")\n\nparser.add_option(\"-n\",\n                  \"--cell_names\",\n                  dest=\"cells_names_file\",\n                  help=\"Cells names file name\")\n\nparser.add_option(\"--sort\",\n                  dest=\"cells_sort_file\",\n                  help=\"Cells sort order file name\")\n\nparser.add_option(\"--state_names\",\n                  dest=\"state_names\",\n                  help=\"States names\")\n\nparser.add_option(\"--group_names\",\n                  dest=\"group_names\",\n                  help=\"Group names\")\n\nparser.add_option(\"-c\",\n                  \"--cells\",\n                  dest=\"cells_file\",\n                  help=\"Cells file name\")\n\n\n(options, args) = parser.parse_args()\n\nif not options.output_file:\n    parser.error('Output file not given')\nif not options.input_file:\n    parser.error('Input file not given')\nif not options.states_file:\n    parser.error('States file not given')\nif not options.cells_file:\n    parser.error('Cells file not given')\n\nif options.stat not in ['odds', 'sig', 'combo']:\n    parser.error('Stat \"' + options.stat + '\" not supported')\n\nstates = []\nfor l in open(options.states_file, 'r'):\n    states.append(l.rstrip().split('\\t')[1])\n\ncells = []\nfor l in open(options.cells_file, 'r'):\n    cells.append(l.rstrip().split('\\t')[1])\n\nnames = []\nif options.cells_names_file:\n    for l in open(options.cells_names_file, 'r'):\n        names.append(l.rstrip().split('\\t')[1])\n\nsorts = []\nif options.cells_sort_file:\n    for l in open(options.cells_sort_file, 'r'):\n        sorts.append(l.rstrip().split('\\t')[1])\n\nM = {}\n\nfor c in cells:\n    M[c] = {}\n    for s in states:\n        M[c][s] = 0\n\nfor l in open(options.input_file,'r'):\n    if l[0] == '#':\n        continue\n    A = l.rstrip().split('\\t')\n    odds = float(A[3])\n    sig = float(A[4])\n    combo = float(A[7])\n\n    c = ''\n    s = ''\n    found = False\n    for i in cells:\n        if '/' + i in A[0]:\n            assert not found, (A[0], i)\n            c = i\n            found = True\n\n    found = False\n    for i in states:\n        if c + '_' + i in A[0]:\n            assert not found, (A[0], i)\n            s = i\n            found = True\n\n    assert M[c][s] == 0, (A[0], c, s, M[c][s])\n\n    if options.stat == 'sig':\n        M[c][s] = sig\n    elif options.stat == 'combo':\n        M[c][s] = combo\n    elif options.stat == 'odds':\n        M[c][s] = odds\n\nD=np.zeros([len(cells),len(states)])\n\nc = 0\nfor cell in cells:\n    s = 0\n    for state in states:\n        D[c,s] = M[cell][state]\n        s+=1\n    c+=1\n\ncolumn_labels = cells\nrow_labels = states\ndata = D\n\n\nfig, ax = plt.subplots(figsize=(options.x_size,options.y_size), \\\n                       dpi=300)\nif options.black:\n    fig =  matplotlib.pyplot.figure(figsize=(options.x_size,options.y_size), \\\n                                    dpi=300, \\\n                                    facecolor='black')\n\n    ax = fig.add_subplot(1,1,1,axisbg='k')\n\n#plt.pcolor(data, cmap=plt.cm.Blues)\n#plt.pcolor(data, cmap=plt.cm.bwr)\n\nif options.cells_sort_file:\n    idxs = np.argsort(sorts)\n    sorts=np.array(sorts)[idxs]\n    data=data[idxs]\nelif options.cells_names_file:\n    idxs = np.argsort(names)\n    names=np.array(names)[idxs]\n    data=data[idxs]\n\nfrom matplotlib import colors as mcolors\nfrom matplotlib.colors import Normalize\n\n_seismic_data = ( (0.0, 0.0, 0.3), \n                  (0.0, 0.0, 1.0),\n\n                  (1.0, 1.0, 1.0),\n\n                  (1.0, 0.0, 0.0),\n                  (0.5, 0.0, 0.0))\n\nhm = mcolors.LinearSegmentedColormap.from_list( \\\n        name='red_white_blue', \\\n        colors=_seismic_data, N=256)\n\nclass MidpointNormalize(Normalize):\n    def __init__(self, vmin=None, vmax=None, midpoint=None, clip=False):\n        self.midpoint = midpoint\n        Normalize.__init__(self, vmin, vmax, clip)\n\n    def __call__(self, value, clip=None):\n        # I'm ignoring masked values and all kinds of edge cases to make a\n        # simple example...\n        x, y = [self.vmin, self.midpoint, self.vmax], [0, 0.5, 1]\n        return np.ma.masked_array(np.interp(value, x, y))\n\n\n#norm=matplotlib.colors.LogNorm(vmin=data.min(), vmax=data.max()), \\\nprint data.min(), data.max()\n\nplt.pcolor(data, \\\n           norm = MidpointNormalize(midpoint=0),\n           cmap=hm)\n           #cmap=plt.cm.seismic)\nax.xaxis.tick_top()\n\nax.xaxis.set_ticks_position('none') \nax.yaxis.set_ticks_position('none') \n\nif options.ablines:\n    for l in [int(x) for x in options.ablines.split(',')]:\n        ax.axhline(l, linestyle='--', color='k') \n\nif options.no_labels:\n    ax.set_xticklabels(\"\")\n    ax.set_yticklabels(\"\")\nelif options.no_ylabels:\n    ax.set_yticklabels(\"\")\n\n    if options.state_names:\n        state_names = []\n        for l in open(options.state_names, 'r'):\n            state_names.append(l.rstrip())\n        if options.black:\n            plt.xticks(np.arange(0.5,len(state_names)+0.5,1.0),state_names,rotation=90, fontsize=10, color='white')\n        else:\n            plt.xticks(np.arange(0.5,len(state_names)+0.5,1.0),state_names,rotation=90, fontsize=10)\n    else:\n        if options.black:\n            plt.xticks(np.arange(0.5,len(states)+0.5,1.0),states,rotation=90, fontsize=10, color='white')\n        else:\n            plt.xticks(np.arange(0.5,len(states)+0.5,1.0),states,rotation=90, fontsize=10)\nelse:\n    if options.group_names:\n\n        group_names = []\n        for l in open(options.group_names, 'r'):\n            group_names.append(l.rstrip())\n        group_names.reverse()\n        if options.black:\n            plt.yticks(np.arange(0.5,len(group_names)+0.5,1.0),[x.decode(\"utf8\") for x in group_names], fontsize=10, color='white')\n        else:\n            plt.yticks(np.arange(0.5,len(group_names)+0.5,1.0),[x.decode(\"utf8\") for x in group_names], fontsize=10)\n\n    elif options.cells_names_file:\n        if options.black:\n            plt.yticks(np.arange(0.5,len(names)+0.5,1.0),[x.decode(\"utf8\") for x in names], fontsize=10, color='white')\n        else:\n            plt.yticks(np.arange(0.5,len(names)+0.5,1.0),[x.decode(\"utf8\") for x in names], fontsize=10)\n\n    else: \n        if options.black:\n            plt.yticks(np.arange(0.5,len(cells)+0.5,1.0),cells, fontsize=10, color='white')\n        else:\n            plt.yticks(np.arange(0.5,len(cells)+0.5,1.0),cells, fontsize=10)\n\n    if options.state_names:\n        state_names = []\n        for l in open(options.state_names, 'r'):\n            state_names.append(l.rstrip())\n        if options.black:\n            plt.xticks(np.arange(0.5,len(state_names)+0.5,1.0),state_names,rotation=90, fontsize=10, color='white')\n        else:\n            plt.xticks(np.arange(0.5,len(state_names)+0.5,1.0),state_names,rotation=90, fontsize=10)\n    else:\n        if options.black:\n            plt.xticks(np.arange(0.5,len(state_names)+0.5,1.0),state_names,rotation=90, fontsize=10, color='white')\n        else:\n            plt.xticks(np.arange(0.5,len(states)+0.5,1.0),states,rotation=90, fontsize=10)\n\nplt.ylim((0,len(cells)))\nplt.xlim((0,len(states)))\n\n\n#cbar_min = -1 * max([abs(data.min()), data.max()])\n#cbar_max = max([abs(data.min()), data.max()])\n\ncbar = plt.colorbar(fraction=0.046, pad=0.04, ticks=[data.min(), 0, data.max()])\ncbar.ax.tick_params(labelsize=10) \n\nif options.black:\n    cbar.ax.tick_params(color='white', labelcolor='white')\n    plt.savefig(options.output_file,bbox_inches='tight',\\\n                facecolor=fig.get_facecolor(),\\\n                transparent=True)\nelse:\n    plt.savefig(options.output_file,bbox_inches='tight')\n"
  },
  {
    "path": "scripts/lines.py",
    "content": "#!/usr/bin/env python\nimport sys\nimport numpy as np\nimport matplotlib\nmatplotlib.use('Agg')\nimport pylab\nimport random\nfrom optparse import OptionParser\n\nfrom matplotlib import rcParams\nrcParams['font.family'] = 'Arial'\nrcParams['legend.numpoints'] = 1\n\n\ndelim = '\\t'\nparser = OptionParser()\n\nparser.add_option(\"--xticks\",\n                  dest=\"xticks\",\n                  help=\"CSV of x tick lables\")\n\n\nparser.add_option(\"--numyticks\",\n                  dest=\"numyticks\",\n                  help=\"Number of Y ticks\")\n\n\nparser.add_option(\"-c\",\n                  \"--colors\",\n                  dest=\"colors\",\n                  default=\"blue,green,red,magenta,black\",\n                  help=\"Color CSV (blue,green,red,magenta,black)\")\n\n\nparser.add_option(\"-o\",\n                  \"--output_file\",\n                  dest=\"output_file\",\n                  help=\"Data file\")\n\nparser.add_option(\"-l\",\n                  \"--line_stype\",\n                  default='-o',\n                  dest=\"line_style\",\n                  help=\"Line style (Default '-o')\")\n\nparser.add_option(\"--plot_width\",\n                  dest=\"plot_width\",\n                  type='int',\n                  default=2,\n                  help=\"Line width (Default 1)\")\n\nparser.add_option(\"--plot_height\",\n                  dest=\"plot_height\",\n                  type='int',\n                  default=3,\n                  help=\"Line width (Default 1)\")\n\n\nparser.add_option(\"-w\",\n                  \"--line_width\",\n                  dest=\"line_width\",\n                  type='int',\n                  default=1,\n                  help=\"Line width (Default 1)\")\n\nparser.add_option(\"-a\",\n                  \"--ablines\",\n                  dest=\"ablines\",\n                  help=\"Ablines (e.g. h:10:-o:white)\")\n\nparser.add_option(\"--xbins\",\n                  dest=\"xbins\",\n                  help=\"Number of ticks on x-axis\")\n\n\n\nparser.add_option(\"--legend\",\n                  dest=\"legend\",\n                  help=\"Comma sperated legend\")\n\nparser.add_option(\"--legend_loc\",\n                  dest=\"legend_loc\",\n                  type=\"int\",\n                  default=4,\n                  help=\"Legend location\")\n\n\nparser.add_option(\"--title\",\n                  dest=\"title\",\n                  help=\"Title\")\n\nparser.add_option(\"--xlabel\",\n                  dest=\"xlabel\",\n                  help=\"X axis label\")\n\nparser.add_option(\"--ylabel\",\n                  dest=\"ylabel\",\n                  help=\"Y axis label\")\n\nparser.add_option( \"--xlog\",\n                  action=\"store_true\", \n                  default=False,\n                  dest=\"xlog\",\n                  help=\"X axis log\")\n\n\nparser.add_option( \"--ylog\",\n                  action=\"store_true\", \n                  default=False,\n                  dest=\"ylog\",\n                  help=\"Y axis log\")\n\nparser.add_option(\"-X\",\n                  action=\"store_true\", \n                  default=False,\n                  dest=\"X\",\n                  help=\"X values includeded (Y line i, X line i+1)\")\n\nparser.add_option(\"-b\",\n                  action=\"store_true\", \n                  default=False,\n                  dest=\"black\",\n                  help=\"black background\")\n\nparser.add_option(\"--x_max\",\n                  dest=\"max_x\",\n                  type=\"float\",\n                  help=\"Max x value\")\n\nparser.add_option(\"--x_min\",\n                  dest=\"min_x\",\n                  type=\"float\",\n                  help=\"Min x value\")\n\nparser.add_option(\"--y_max\",\n                  dest=\"max_y\",\n                  type=\"float\",\n                  help=\"Max y value\")\n\nparser.add_option(\"--y_min\",\n                  dest=\"min_y\",\n                  type=\"float\",\n                  help=\"Min y value\")\n\n(options, args) = parser.parse_args()\nif not options.output_file:\n    parser.error('Output file not given')\n\nmatplotlib.rcParams.update({'font.size': 12})\nfig = 1\nif options.black:\n    fig = matplotlib.pyplot.figure(\\\n            figsize=(options.plot_width,options.plot_height),\\\n            dpi=300,\\\n            facecolor='black')\nelse:\n    fig = matplotlib.pyplot.figure(\\\n            figsize=(options.plot_width,options.plot_height),\\\n            dpi=300)\nif options.xbins:\n    matplotlib.pyplot.locator_params(axis = 'x', nbins = options.xbins)\n#fig.subplots_adjust(top=1.0)\n\nax = 1\nif options.black:\n    ax = fig.add_subplot(1,1,1,axisbg='k')\nelse:\n    ax = fig.add_subplot(1,1,1)\n\nax.set_axisbelow(True)\nax.tick_params(labelsize=10)\n\n\n#colors = [ 'blue', \\\n#    'green', \\\n#    'red', \\\n#    'magenta', \\\n#    'black']\ncolors=options.colors.split(',')\n\ncolor_i = 0\nplts=[]\nlines = sys.stdin.readlines()\n\nif (options.X):\n    for i in range(len(lines))[::2]:\n        Y = [float(x) for x in lines[i].rstrip().split()]\n        X = [float(x) for x in lines[i+1].rstrip().split()]\n        p, = ax.plot(X,\\\n                     Y,\\\n                     options.line_style,\\\n                     color=colors[color_i],\\\n                     linewidth=options.line_width,\n                     markeredgewidth=0)\n        plts.append(p)\n        color_i = (color_i + 1) % len(colors)\nelse:\n    for i in range(len(lines))[::1]:\n        Y = [float(x) for x in lines[i].rstrip().split()]\n        p, = ax.plot(range(len(Y)), \\\n                     Y,\\\n                     options.line_style,\\\n                     color=colors[color_i], \\\n                     linewidth=options.line_width,\n                     markeredgewidth=0)\n        plts.append(p)\n        color_i = (color_i + 1) % len(colors)\n\nif options.ylog:\n    ax.set_yscale('log')\n\nif options.xlog:\n    ax.set_xscale('log')\n\nif options.legend:\n    l1=ax.legend(plts, options.legend.split(\",\"), frameon=False, fontsize=10,loc=options.legend_loc)\n    if options.black:\n        for text in l1.get_texts():\n            matplotlib.pyplot.setp(text,color='white')\n\n\nif options.title:\n    #matplotlib.pyplot.suptitle(options.title)\n    ax.set_title(options.title)\n\nif options.xlabel:\n    ax.set_xlabel(options.xlabel)\n\nif options.ylabel:\n    ax.set_ylabel(options.ylabel)\n\nif options.max_x:\n    ax.set_xlim(xmax=options.max_x)\nif options.min_x:\n    ax.set_xlim(xmin=options.min_x)\n\nif options.max_y:\n    ax.set_ylim(ymax=options.max_y)\nif options.min_y:\n    ax.set_ylim(ymin=options.min_y)\n\nax.spines['top'].set_visible(False)\nax.spines['right'].set_visible(False)\n\nif options.black:\n    ax.spines['bottom'].set_color('white')\n    ax.spines['left'].set_color('white')\n    ax.title.set_color('white')\n    ax.yaxis.label.set_color('white')\n    ax.xaxis.label.set_color('white')\n    ax.tick_params(axis='x', colors='white')\n    ax.tick_params(axis='y', colors='white')\n\nax.get_xaxis().tick_bottom()\nax.get_yaxis().tick_left()\n#ax.legend()\n\n\nif options.ablines:\n    #h:10:-o:white\n    for ab in options.ablines.split(\",\"):\n        ab_d,ab_pos,ab_ls,ab_col = ab.split(':')\n        ab_pos=float(ab_pos)\n        if ab_d == 'v':\n            ab_min, ab_max = ax.get_ylim()\n            ax.plot([ab_pos,ab_pos],[ab_min,ab_max],ab_ls,c=ab_col)\n        else:\n            ab_min, ab_max = ax.get_xlim()\n            ax.plot([ab_min,ab_max],[ab_pos,ab_pos],ab_ls,c=ab_col)\n\n\nif options.numyticks:\n    matplotlib.pyplot.locator_params(axis = 'y', nbins = int(options.numyticks))\n\nif options.xticks:\n    ax.set_xticklabels(options.xticks.split(','))\n\nif options.black:\n    matplotlib.pyplot.savefig(options.output_file,bbox_inches='tight',\\\n            facecolor=fig.get_facecolor(),\\\n              transparent=True)\nelse:\n    matplotlib.pyplot.savefig(options.output_file,bbox_inches='tight')\n"
  },
  {
    "path": "scripts/scatter.py",
    "content": "#!/usr/bin/env python\nimport sys\nimport numpy as np\nimport matplotlib\nmatplotlib.use('Agg')\nimport pylab\nimport random\nfrom optparse import OptionParser\n\nfrom matplotlib import rcParams\nrcParams['font.family'] = 'Arial'\n\ndelim = '\\t'\nparser = OptionParser()\n\nparser.add_option(\"-a\",\n                  \"--alpha\",\n                  type=\"float\",\n                  default=1.0,\n                  help=\"Alpha value for points\")\n\n\nparser.add_option(\"-l\",\n                  \"--log_y\",\n                  action=\"store_true\", dest=\"logy\", default=False,\n                  help=\"Use log scale for y-axis\")\n\nparser.add_option(\"-o\",\n                  \"--output_file\",\n                  dest=\"output_file\",\n                  help=\"Data file\")\n\nparser.add_option(\"--title\",\n                  dest=\"title\",\n                  help=\"Plot title\")\n\n\nparser.add_option(\"--x_label\",\n                  dest=\"x_label\",\n                  help=\"X axis label\")\n\nparser.add_option(\"--y_label\",\n                  dest=\"y_label\",\n                  help=\"Y axis label\")\n\n\n\nparser.add_option(\"--y_min\",\n                  dest=\"min_y\",\n                  help=\"Min y value\")\n\nparser.add_option(\"--y_max\",\n                  dest=\"max_y\",\n                  help=\"Max y value\")\n\nparser.add_option(\"--x_min\",\n                  dest=\"min_x\",\n                  help=\"Min x value\")\n\nparser.add_option(\"--x_max\",\n                  dest=\"max_x\",\n                  help=\"Max x value\")\n\n\nparser.add_option(\"--line_style\",\n                  dest=\"line_style\",\n                  default=\".\",\n                  help=\"Line style\")\n\nparser.add_option(\"--fig_x\",\n                  dest=\"fig_x\",\n                  type=\"int\",\n                  default=5,\n                  help=\"Figure width\")\n\nparser.add_option(\"--fig_y\",\n                  dest=\"fig_y\",\n                  type=\"int\",\n                  default=5,\n                  help=\"Figure height\")\n\nparser.add_option(\"-b\",\n                  action=\"store_true\", \n                  default=False,\n                  dest=\"black\",\n                  help=\"black background\")\n\nparser.add_option(\"-c\",\n                  \"--color\",\n                  dest=\"color\",\n                  default=\"black\",\n                  help=\"Color\")\n\nparser.add_option(\"--trend\",\n                  action=\"store_true\", \n                  default=False,\n                  dest=\"trend\",\n                  help=\"Trend line\")\n\nparser.add_option(\"--point_size\",\n                  dest=\"point_size\",\n                  type=\"int\",\n                  default=1,\n                  help=\"Scatter point size (defualt 1)\")\n\n\n\n(options, args) = parser.parse_args()\nif not options.output_file:\n    parser.error('Output file not given')\n\nX=[]\nY=[]\nE=[]\nfor l in sys.stdin:\n    #a = l.rstrip().split(delim)\n    a = l.rstrip().split()\n    if len(a) == 1:\n        Y.append(float(a[0]))\n    if len(a) == 2:\n        X.append(float(a[0]))\n        Y.append(float(a[1]))\n    if len(a) == 3:\n        X.append(float(a[0]))\n        Y.append(float(a[1]))\n        E.append(float(a[2]))\n\n\nmatplotlib.rcParams.update({'font.size': 12})\n#fig = matplotlib.pyplot.figure(figsize=(options.fig_x,options.fig_y),dpi=300)\nfig = 1\nif options.black:\n    fig = matplotlib.pyplot.figure(\\\n            figsize=(options.fig_x,options.fig_y),\\\n            dpi=300,\\\n            facecolor='black')\nelse:\n    fig = matplotlib.pyplot.figure(\\\n            figsize=(options.fig_x,options.fig_y),\\\n            dpi=300)\n\nfig.subplots_adjust(wspace=.05,left=.01,bottom=.01)\n\n#ax = fig.add_subplot(1,1,1)\nax = 1\nif options.black:\n    ax = fig.add_subplot(1,1,1,axisbg='k')\nelse:\n    ax = fig.add_subplot(1,1,1)\n\nax.spines['top'].set_visible(False)\nax.spines['right'].set_visible(False)\n\nif options.black:\n    ax.spines['bottom'].set_color('white')\n    ax.spines['left'].set_color('white')\n    ax.title.set_color('white')\n    ax.yaxis.label.set_color('white')\n    ax.xaxis.label.set_color('white')\n    ax.tick_params(axis='x', colors='white')\n    ax.tick_params(axis='y', colors='white')\nax.get_xaxis().tick_bottom()\nax.get_yaxis().tick_left()\n\nif len(X) == 0:\n    ax.plot(range(len(Y)),\\\n            Y,\\\n            options.line_style,color=options.color, \\\n            s=1,\\\n            linewidth=1,\n            alpha=options.alpha)\nelse:\n    ax.plot(X,Y,options.line_style,color=options.color, linewidth=1, \\\n            alpha=options.alpha)\n#ax.scatter(X,Y,s=options.point_size,color=options.color)\n\n#print X\n#print Y\n#ax.errorbar(X, Y, yerr=E, fmt='-o', color=options.color)\nif len(E)!=0:\n    ax.errorbar(X,Y,yerr=E, linestyle=\"None\", color='gray')\n\n\nif options.logy:\n    ax.set_yscale('log')\n\nif ((options.max_y) and (options.min_y)):\n    ax.set_ylim(float(options.min_y),float(options.max_y))\n\nif ((options.max_x) and (options.min_x)):\n    ax.set_xlim(float(options.min_x),float(options.max_x))\n\n#if len(X) != 0:\n#    ax.set_xticks([float(x) for x in X])\n#    #ax.set_xticklabels\n\nif options.x_label:\n    ax.set_xlabel(options.x_label)\n\nif options.y_label:\n    ax.set_ylabel(options.y_label)\n\nif options.title:\n    ax.set_title(options.title)\n\nif options.trend:\n    z = np.polyfit(X, Y, 1)\n    p = np.poly1d(z)\n    ax.plot(X,p(Y),'r--',color='red')\n\n\n\n\n\n#matplotlib.pyplot.savefig(options.output_file,bbox_inches='tight')\n\nif options.black:\n    matplotlib.pyplot.savefig(options.output_file,bbox_inches='tight',\\\n            facecolor=fig.get_facecolor(),\\\n              transparent=True)\nelse:\n    matplotlib.pyplot.savefig(options.output_file,bbox_inches='tight')\n"
  },
  {
    "path": "scripts/sort_bed",
    "content": "#!/bin/sh\nset -euo pipefail\n\nif [ \"$#\" -lt \"2\" ]; then\n    echo \"usage: `basename $0` <input path> <output dir> <threads>\"\n    exit 0\nfi\n\nexport IN_PATH=$1\nexport OUT_PATH=$2\n\nexport THREADS=1\n\nif [ \"$#\" -eq \"3\" ]; then\n    export THREADS=$3\nfi\n\n\nSORT()\n{\n    set -euo pipefail\n    IN=$1\n\n    if [ ${IN: -4} == \".bed\" ]; then\n        BASE=`basename $IN`\n        echo $BASE\n        cat $IN | LC_ALL=C sort --buffer-size 2G -k1,1 -k2,2n -k3,3n | bgzip -c > $OUT_PATH/$BASE.gz\n    elif [ ${IN: -7} == \".bed.gz\" ]; then\n        BASE=`basename $IN`\n        echo $BASE\n        gzip -d -c $IN | LC_ALL=C sort --buffer-size 2G -k1,1 -k2,2n -k3,3n | bgzip -c > $OUT_PATH/$BASE\n    else\n        echo \"SKIPPING $IN\"\n    fi\n}\n\nexport -f SORT\n\nls $IN_PATH | xargs -I{} -P $THREADS bash -c \"SORT {}\"\n"
  },
  {
    "path": "scripts/volcano.py",
    "content": "#!/usr/bin/env python\nimport sys\nimport math\nfrom operator import itemgetter\nimport sys\nimport numpy as np\nimport matplotlib\nmatplotlib.use('Agg')\nimport pylab\nimport random\nfrom optparse import OptionParser\nfrom matplotlib import colors as mcolors\n\nfrom matplotlib import rcParams\nrcParams['font.family'] = 'Arial'\n\ndelim = '\\t'\n\n\ndef log2fc(v):\n    if v == 0.0 :\n        return 0.0\n\n    if v < 1:\n        v = 1.0/v\n        return -math.log(v,2)\n\n    return math.log(v,2)\n\ndef neglog10p(v):\n    if v == 0.0 :\n        return 6.0\n    return -math.log(v,10)\n\n\nparser = OptionParser()\n\nparser.add_option(\"-l\",\n                  \"--log_y\",\n                  action=\"store_true\", dest=\"logy\", default=False,\n                  help=\"Use log scale for y-axis\")\n\nparser.add_option(\"-o\",\n                  \"--output_file\",\n                  dest=\"output_file\",\n                  help=\"Data file\")\n\nparser.add_option(\"--title\",\n                  dest=\"title\",\n                  help=\"Plot title\")\n\n\nparser.add_option(\"--x_label\",\n                  dest=\"x_label\",\n                  help=\"X axis label\")\n\nparser.add_option(\"--y_label\",\n                  dest=\"y_label\",\n                  help=\"Y axis label\")\n\n\n\nparser.add_option(\"--y_min\",\n                  dest=\"min_y\",\n                  help=\"Min y value\")\n\nparser.add_option(\"--y_max\",\n                  dest=\"max_y\",\n                  help=\"Max y value\")\n\nparser.add_option(\"--x_min\",\n                  dest=\"min_x\",\n                  help=\"Min x value\")\n\nparser.add_option(\"--x_max\",\n                  dest=\"max_x\",\n                  help=\"Max x value\")\n\n\nparser.add_option(\"--line_style\",\n                  dest=\"line_style\",\n                  default=\".\",\n                  help=\"Line style\")\n\nparser.add_option(\"--fig_x\",\n                  dest=\"fig_x\",\n                  type=\"int\",\n                  default=5,\n                  help=\"Figure width\")\n\nparser.add_option(\"--fig_y\",\n                  dest=\"fig_y\",\n                  type=\"int\",\n                  default=5,\n                  help=\"Figure height\")\n\nparser.add_option(\"-b\",\n                  action=\"store_true\", \n                  default=False,\n                  dest=\"black\",\n                  help=\"black background\")\n\nparser.add_option(\"-c\",\n                  \"--color\",\n                  dest=\"color\",\n                  default=\"black\",\n                  help=\"Color\")\n\nparser.add_option(\"--trend\",\n                  action=\"store_true\", \n                  default=False,\n                  dest=\"trend\",\n                  help=\"Trend line\")\n\nparser.add_option(\"--point_size\",\n                  dest=\"point_size\",\n                  type=\"int\",\n                  default=1,\n                  help=\"Scatter point size (defualt 1)\")\n\n\n\n(options, args) = parser.parse_args()\nif not options.output_file:\n    parser.error('Output file not given')\n\nD = []\nfor l in sys.stdin:\n    if l[0] == '#':\n        continue\n    A = l.rstrip().split()\n    ratio = float(A[3])\n    pval = float(A[4])\n    D.append([abs(log2fc(ratio)* neglog10p(pval)), log2fc(ratio), neglog10p(pval)])\n\nD.sort(key=itemgetter(0), reverse=False)\nD = [x + [i] for i, x in enumerate(D)]\nX=[]\nY=[]\nR=[]\nE=[]\n\nfor d in D:\n    #R.append(d[3]**2)\n    R.append(1+d[3])\n    X.append(d[1])\n    Y.append(d[2])\n\n\nmatplotlib.rcParams.update({'font.size': 12})\n#fig = matplotlib.pyplot.figure(figsize=(options.fig_x,options.fig_y),dpi=300)\nfig = 1\nif options.black:\n    fig = matplotlib.pyplot.figure(\\\n            figsize=(options.fig_x,options.fig_y),\\\n            dpi=300,\\\n            facecolor='black')\nelse:\n    fig = matplotlib.pyplot.figure(\\\n            figsize=(options.fig_x,options.fig_y),\\\n            dpi=300)\n\nfig.subplots_adjust(wspace=.05,left=.01,bottom=.01)\n\n#ax = fig.add_subplot(1,1,1)\nax = 1\nif options.black:\n    ax = fig.add_subplot(1,1,1,axisbg='k')\nelse:\n    ax = fig.add_subplot(1,1,1)\n\nax.spines['top'].set_visible(False)\nax.spines['right'].set_visible(False)\n\nif options.black:\n    ax.spines['bottom'].set_color('white')\n    ax.spines['left'].set_color('white')\n    ax.title.set_color('white')\n    ax.yaxis.label.set_color('white')\n    ax.xaxis.label.set_color('white')\n    ax.tick_params(axis='x', colors='white')\n    ax.tick_params(axis='y', colors='white')\nax.get_xaxis().tick_bottom()\nax.get_yaxis().tick_left()\n\n\n_seismic_data = ( (0.0, 0.0, 0.3),\n                  (0.0, 0.0, 1.0),\n                  (1.0, 1.0, 1.0),\n                  (1.0, 0.0, 0.0),\n                  (0.5, 0.0, 0.0))\n\ndef mapc(rgb_l):\n    return [x/256.0 for x in rgb_l] \n\naliceblue = (240,248,255)\nlavender = (230,230,250)\npowderblue = (176,224,230)\nlightblue = (173,216,230)\nlightskyblue = (135,206,250)\nskyblue = (135,206,235)\ndeepskyblue = (0,191,255)\nlightsteelblue = (176,196,222)\ndodgerblue = (30,144,255)\ncornflowerblue = (100,149,237)\nsteelblue = (70,130,180)\ncadetblue = (95,158,160)\nmediumslateblue = (123,104,238)\nslateblue = (106,90,205)\ndarkslateblue = (72,61,139)\nroyalblue = (65,105,225)\nblue = (0,0,255)\nmediumblue = (0,0,205)\ndarkblue = (0,0,139)\nnavy = (0,0,128)\nmidnightblue = (25,25,112)\n\n_seismic_data = (\n                 mapc((201,201,243)),\n                 mapc((201,201,243)),\n                 mapc((201,201,243)),\n                 mapc((201,201,243)),\n                 mapc((201,201,243)),\n                 mapc((201,201,243)),\n                 mapc((139,139,229)),\n                 mapc((139,139,229)),\n                 mapc((139,139,229)),\n                 mapc((139,139,229)),\n                 mapc((139,139,229)),\n                 mapc((11,11,49)))\n\n\nhm = mcolors.LinearSegmentedColormap.from_list( \\\n    name='red_white_blue', \\\n    colors=_seismic_data, N=256)\n\nsc = None\nif len(X) == 0:\n    sc = ax.plot(range(len(Y)),Y,options.line_style,color=options.color, s=1,linewidth=1)\nelse:\n    #sc = ax.scatter(X,Y,c=R,lw = 0,cmap=matplotlib.pyplot.cm.Blues)\n    #sc = ax.scatter(X,Y,c=R,lw = 0,cmap=matplotlib.pyplot.cm.seismic)\n    sc = ax.scatter(X,Y,c=R,lw = 0,cmap=hm)\n\nif len(E)!=0:\n    ax.errorbar(X,Y,yerr=E, linestyle=\"None\", color='gray')\n\n\nif options.logy:\n    ax.set_yscale('log')\n\nif ((options.max_y) and (options.min_y)):\n    ax.set_ylim(float(options.min_y),float(options.max_y))\n\nif ((options.max_x) and (options.min_x)):\n    ax.set_xlim(float(options.min_x),float(options.max_x))\n\nif options.x_label:\n    ax.set_xlabel(options.x_label)\n\nif options.y_label:\n    ax.set_ylabel(options.y_label)\n\nif options.title:\n    ax.set_title(options.title)\n\nif options.trend:\n    z = np.polyfit(X, Y, 1)\n    p = np.poly1d(z)\n    ax.plot(X,p(Y),'r--',color='red')\n\nprint len(R)\n#cbar = matplotlib.pyplot.colorbar(fraction=0.046, pad=0.04)\n#labels=[1,500,1000,1500,1905]\nlabels=[1,1000,1905]\n#cbar = matplotlib.pyplot.colorbar(sc, ticks=labels,fraction=0.015, pad=0.04)\ncbar = matplotlib.pyplot.colorbar(sc, ticks=labels, shrink=.25, aspect=7, pad=0.0)\ncbar.ax.set_yticklabels([1905,1000,1], size=10)  # horizontal colorbar\n#cbar.ax.set_title('Rank',y=1.08)\n\n#cbar.ax.set_xticklabels(list(labels).reverse())\n#cbar.ax.set_xticklabels(labels)\n\nif options.black:\n    matplotlib.pyplot.savefig(options.output_file,bbox_inches='tight',\\\n            facecolor=fig.get_facecolor(),\\\n              transparent=True)\nelse:\n    matplotlib.pyplot.savefig(options.output_file,bbox_inches='tight')\n"
  },
  {
    "path": "sharding/README.md",
    "content": "# Multi Giggle\n\nUtility for running a sharded giggle instance.\nBuilds and searches indices in parallel.\n\n# Basic Usage\n\n```bash\n> py multi_giggle.py index --help\nUsage: multi_giggle.py index [OPTIONS]\n\nOptions:\n  -i DIRECTORY  Input directory  [required]\n  -o DIRECTORY  Index output directory  [required]\n  -n INTEGER    Amount of shards  [required]\n  -m FILE       Metadata config file\n  -k            Keep temporary files after indexing\n  --help        Show this message and exit.\n\n\n> py multi_giggle.py search --help\nUsage: multi_giggle.py search [OPTIONS]\n\nOptions:\n  -i DIRECTORY  (Sharded) index directory  [required]\n  -q FILE       Query file  [required]\n  -n INTEGER    Amount of jobs to run in parallel (default: 1)\n  -s            Give significance by indexed file (requires query file).\n  -m FILE       Metadata config file\n  --help        Show this message and exit.\n>\n```\n\n**Note:** multi_giggle.py requires `giggle` to be installed and on the PATH.\n\nFor example,\n```bash\n# Create an index with 10 shards\npy multi_giggle.py index -i ./inputDataDir -o index -n 4\n\n# Search the index with 2 jobs\npy multi_giggle.py search -s -i index -q query.bed.gz -n 2\n```\n\nWhere `inputDataDir` is a directory expected to contain `.bed.gz` files."
  },
  {
    "path": "sharding/multi_giggle.py",
    "content": "import click\nimport shutil\nimport os\nimport subprocess\nfrom multiprocessing import Process, Pool\n\n\n@click.group()\ndef root():\n    # check if giggle is installed\n    installed = True\n    try:\n        FNULL = open(os.devnull, 'w')\n        retcode = subprocess.call(['giggle'],\n            stdout=FNULL,\n            stderr=subprocess.STDOUT)\n        installed = retcode == 0\n    except:\n        installed = False\n    if not installed:\n        raise click.ClickException('Make sure `giggle` is installed and in your PATH')\n\n\n@root.command()\n@click.option('-i', 'inputPath', type=click.Path(\n        exists=True,\n        file_okay=False,\n        dir_okay=True,\n        readable=True),\n    required=True,\n    help='Input directory')\n@click.option('-o', 'outputPath', type=click.Path(\n        file_okay=False,\n        dir_okay=True,\n        writable=True),\n    required=True,\n    help='Index output directory')\n@click.option('-n', 'shardAmnt',\n    required=True,\n    type=click.INT,\n    help='Amount of shards')\n@click.option('-m', 'metadataPath', type=click.Path(\n        file_okay=True,\n        dir_okay=False,\n        readable=True),\n    help='Metadata config file')\n@click.option('-k', 'keepTemp', is_flag=True, help='Keep temporary files after indexing')\ndef index(inputPath, outputPath, metadataPath, shardAmnt, keepTemp):\n    if os.path.exists(outputPath):\n        if os.listdir(outputPath):\n            raise click.ClickException('Output directory already exists')\n    else:\n        os.mkdir(outputPath)\n    \n    if shardAmnt < 1:\n        raise click.ClickException('Shard amount must be greater than 0')\n\n    inputFiles = os.listdir(inputPath)\n    inputFiles = list(map(lambda x: os.path.join(inputPath, x), inputFiles))\n    # attempts to divide files into batches of equal size\n    inputFileSizes = list(map(lambda x: os.path.getsize(x), inputFiles))\n\n    inputTotalSize = sum(inputFileSizes)\n    inputSizePerShard = inputTotalSize // shardAmnt\n    \n    threads = []\n    \n    i2 = 0\n    for i in range(shardAmnt):\n        total = 0\n        filesSubset = []\n        \n        if i != shardAmnt - 1:\n            while i2 < len(inputFiles):\n                if total and total + inputFileSizes[i2] > inputSizePerShard:\n                    break\n\n                total += inputFileSizes[i2]\n                filesSubset.append(inputFiles[i2])\n                i2 += 1\n        else:\n            # catch rounding truncation\n            while i2 < len(inputFiles):\n                filesSubset.append(inputFiles[i2])\n                i2 += 1\n        \n        if not filesSubset:\n            break\n\n        args = (i, outputPath, filesSubset, keepTemp, metadataPath)\n        p = Process(target=launch_indexer, args=args)\n        p.start()\n        threads.append(p)\n    \n    # collect all\n    for i, thread in enumerate(threads):\n        thread.join()\n\n\ndef launch_indexer(shardIndex, outputPath, inputFiles, keepInputFiles, metadataPath):\n    # 1. create shard directory\n    shardPath = os.path.join(outputPath, str.format('shard_{0}', shardIndex))\n    shardInputPath = os.path.join(shardPath, 'input')\n    os.mkdir(shardPath)\n    os.mkdir(shardInputPath)\n    \n    # 2. symlink input files\n\n    for file in inputFiles:\n        # unfortunately, giggle won't follow symlinks\n        # os.symlink(file, os.path.join(shardInputPath, os.path.basename(file)))\n        shutil.copy(file, os.path.join(shardInputPath, os.path.basename(file)))\n    \n    # 3. create giggle index\n    metadataArg = str.format('-m {0}', metadataPath) if metadataPath else ''\n    shardIndexPath = os.path.join(shardPath, 'index')\n    os.system(str.format('giggle index -i {0}/*.gz -o {1} {2}', shardInputPath, shardIndexPath, metadataArg))\n    \n    # 4. delete copied input files\n    if not keepInputFiles:\n        shutil.rmtree(shardInputPath)\n\n    click.echo(str.format('Shard {0} indexed.', shardIndex))\n\n\n@root.command()\n@click.option('-i', 'indexPath', type=click.Path(\n        exists=True,\n        file_okay=False,\n        dir_okay=True,\n        readable=True,\n        writable=True),\n    required=True,\n    help='(Sharded) index directory')\n@click.option('-q', 'queryFilePath', type=click.Path(\n        exists=True,\n        file_okay=True,\n        dir_okay=False,\n        readable=True),\n    required=True,\n    help='Query file')\n@click.option('-n', 'nThreads',\n    default=1,\n    type=click.INT,\n    help='Amount of jobs to run in parallel (default: 1)')\n@click.option('-s', 'sFlag', is_flag=True, help='Give significance by indexed file (requires query file).')\n@click.option('-m', 'metadataPath', type=click.Path(\n        file_okay=True,\n        dir_okay=False,\n        readable=True),\n    help='Metadata config file')\ndef search(indexPath, queryFilePath, nThreads, sFlag, metadataPath):\n    # gather shard directories\n    \n    shardDirs = []\n    \n    for subDir in os.listdir(indexPath):\n        path = os.path.join(indexPath, subDir)\n\n        if os.path.isdir(path):\n            if subDir.startswith('shard_'):\n                try:\n                    shardId = int(subDir.split('_')[1])\n                    \n                    foundIndex = False\n                    for file in os.listdir(path):\n                        if file == 'index':\n                            foundIndex = True\n                    if not foundIndex:\n                        raise click.ClickException(\n                            str.format('Shard {0} is missing index directory', shardId))\n\n                    shardDirs.append((shardId, path))\n                except:\n                    pass\n    \n    if not shardDirs:\n        raise click.ClickException('No shard indices found.')\n    \n    # dice query and launch searchers\n    \n    if nThreads < 1:\n        raise click.ClickException('Thread amount must be greater than 0')\n\n    results = []\n\n    i = 0\n    pool = Pool(processes=nThreads)\n    while i < len(shardDirs):\n        batchArgs = []\n        \n        for _ in range(nThreads):\n            if i < len(shardDirs):\n                args = (shardDirs[i][0], shardDirs[i][1], queryFilePath, metadataPath, sFlag, i != 0)\n                batchArgs.append(args)\n                i += 1\n            else:\n                break\n        \n        results += pool.map(launch_searcher, batchArgs)\n    \n    click.echo(''.join(results))\n\n\ndef launch_searcher(args):\n    shardId, shardPath, queryFilePath, metadataPath, sFlag, stripHeader = args\n    \n    metadataArg = str.format('-m {0}', metadataPath) if metadataPath else ''\n    indexPath = os.path.join(shardPath, 'index')\n    sArg = '-s' if sFlag else ''\n    cmd = str.format('giggle search -i {0} -q {1} {2} {3}', indexPath, queryFilePath, metadataArg, sArg)\n\n    p = subprocess.Popen(cmd,\n         shell=True,\n         stdout=subprocess.PIPE)\n    out, _ = p.communicate()\n    \n    # strip out the header\n    if stripHeader and sFlag:\n        out = out.split('\\n', 1)[1]\n\n    if isinstance(out, bytes):\n        return out.decode('utf-8')\n    return out\n\n\nif __name__ == '__main__':\n    root()\n"
  },
  {
    "path": "src/Makefile",
    "content": "BIN=../bin\nOBJ=../obj\nLIBD=../lib\nLIBMHD_INCLUDES=$(HOME)/usr/local/include\nLIBMHD_LIBS=$(HOME)/usr/local/lib\noverride CFLAGS+=-fcommon -O2 -D_FILE_OFFSET_BITS=64 -Wuninitialized -Wno-format-truncation -DBLOCK_STORE\n#CFLAGS=-g -D_FILE_OFFSET_BITS=64 -Wuninitialized\nINCLUDES=-I$(HTS_INC)\nLIBS=-ldl -lz -lm -pthread -lcurl -lhts -L$(HTS_LIB)\nLIBS+=-lcrypto\nCC=gcc\n\n\nLIB=bpt.o \\\n    disk_file_header.o \\\n    disk_store.o \\\n    zlib_wrapper.o \\\n    fastlz_wrapper.o \\\n    cache.o \\\n    data_reg.o \\\n    file_read.o \\\n    giggle_index.o \\\n    lists.o \\\n    ll.o \\\n    util.o \\\n    timer.o \\\n    wah.o \\\n    kfunc.o \\\n    index.o \\\n    offset_index.o \\\n    metadata_index.o \\\n    query_filter.o \\\n    search.o \\\n    leaf.o \\\n    pq.o \\\n    jsw_avltree.o \\\n    fastlz.o\n\n\n.SUFFIXES:\n\nOBJS=$(addprefix $(OBJ)/, $(LIB))\n\n.SECONDARY: $(OBJS)\n\n\nPROG=giggle \\\n     api_test \\\n     offset_idx_lookup\n\nLIST=$(addprefix $(BIN)/, $(PROG))\n\n\nall: $(LIST) library\n\nserver: INCLUDES+=-I$(LIBMHD_INCLUDES) -L$(LIBMHD_LIBS)\nserver: LIBS+=-lmicrohttpd\nserver: $(BIN)/server_enrichment\n\nlibrary: $(OBJS)\n\tar -cvq $(LIBD)/libgiggle.a $(OBJS)\n\n$(OBJ)/%.o: %.c\n\t$(CC) -c $(CFLAGS) -o $@ $< \\\n\t\t-I$(HTS_INC)\n\n\n$(BIN)/%: %.c $(OBJS)\n\t$(CC) $(CFLAGS) -o $@ $^ \\\n\t\t$(INCLUDES) \\\n\t\t-DSAMTOOLS=1 \\\n\t\t$(LIBS)\n\n"
  },
  {
    "path": "src/api_test.c",
    "content": "#include <stdlib.h>\n#include <stdio.h>\n#include <err.h>\n#include <string.h>\n#include <htslib/kstring.h>\n\n#include \"giggle_index.h\"\n#include \"wah.h\"\n#include \"cache.h\"\n#include \"file_read.h\"\n#include \"kfunc.h\"\n#include \"ll.h\"\n\nstruct uint_flt_pair\n{\n    uint32_t uint;\n    float flt;\n};\n\nvoid offset_data_append_uint_flt(uint8_t *dest, kstring_t *line)\n{\n    int n;\n    int *fields = ksplit(line, '\\t', &n);\n\n    struct uint_flt_pair a;\n    if (n > 7) {\n        a.uint = atoi(line->s + fields[4]);\n        a.flt = atof(line->s + fields[6]);\n    } else {\n        a.uint = 0;\n        a.flt = 0;\n    }\n\n    memcpy(dest, &a, sizeof(struct uint_flt_pair));\n\n    free(fields);\n}\n\n\nint main(int argc, char **argv)\n{\n\n    if ((argc != 6)) {\n        errx(1,\n             \"usage:\\t%s <input path> <output path> <chrom> <start> <end>\\n\",\n             argv[0]);\n    }\n\n    char *input_path = argv[1];\n    char *index_path = argv[2];\n    char *chrom = argv[3];\n    uint32_t start = atoi(argv[4]);\n    uint32_t end = atoi(argv[5]);\n\n    offset_data_size =\n            sizeof(struct uint_flt_pair);\n    offset_data_append_data = offset_data_append_uint_flt;\n\n    uint64_t num_intervals = giggle_bulk_insert(input_path,\n                                                index_path,\n                                                1);\n\n    struct giggle_index *gi = giggle_load(index_path,\n                                          uint64_t_ll_giggle_set_data_handler);\n\n    giggle_data_handler.giggle_collect_intersection =\n        giggle_collect_intersection_data_in_block;\n\n    giggle_data_handler.map_intersection_to_offset_list =\n            leaf_data_map_intersection_to_offset_list;\n\n    struct giggle_query_result *gqr = giggle_query(gi, chrom, start, end, NULL);\n\n    uint32_t i;\n    for(i = 0; i < gqr->num_files; i++) {\n        char *result = NULL;\n        struct giggle_query_iter *gqi = giggle_get_query_itr(gqr, i);\n        while (giggle_query_next(gqi, &result) == 0) {\n            printf(\"line\\t%s\\n\", result);\n        }\n        giggle_iter_destroy(&gqi);\n    }\n\n    giggle_query_result_destroy(&gqr);\n\n    gqr = giggle_query(gi, chrom, start, end, NULL);\n\n    for(i = 0; i < gqr->num_files; i++) {\n        struct uint_flt_pair *pair = NULL;\n        struct giggle_query_iter *gqi = giggle_get_query_data_itr(gqr, i);\n        while (giggle_query_next_data(gqi, (void **)&pair) == 0) {\n            printf(\"data\\t%u\\t%f\\n\", pair->uint, pair->flt);\n        }\n        giggle_iter_destroy(&gqi);\n    }\n\n    giggle_index_destroy(&gi);\n\n    cache.destroy();\n}\n"
  },
  {
    "path": "src/bpt.c",
    "content": "#define _GNU_SOURCE\n\n#include <stdio.h>\n#include <stdint.h>\n#include <stdlib.h>\n#include <string.h>\n#include <err.h>\n#include <sysexits.h>\n#include <stdbool.h>\n#include \"bpt.h\"\n#include \"lists.h\"\n//#include \"ll.h\"\n#include \"util.h\"\n// #include \"disk_store.h\"\n#include \"cache.h\"\n\n/*\n *  All bpt_nodes have an array of keys, and an array of values.\n *  In non-leaf bpt_nodes, values[i] points to the bpt_node that is either\n *  greater than or equal to key[i-1] or less than key[i].\n */\n\n//uint32_t ORDER = 4;\nuint32_t ORDER = 100;\n\nvoid (*bpt_node_repair)(uint32_t domain,\n                        struct bpt_node *,\n                        struct bpt_node *) = NULL;\n\nstruct cache_handler bpt_node_cache_handler = {bpt_node_serialize, \n                                               bpt_node_deserialize,\n                                               bpt_node_free_mem};\n\n//{{{int b_search(int key, int *D, int D_size)\nint b_search(uint32_t key, const uint32_t *D, uint32_t D_size)\n{\n    //fprintf(stderr, \"D_size:%u\\n\", D_size);\n    // This is a common case when incoming data is sorted.\n    if(key > D[D_size-1]) {\n        return D_size;\n    }\n    int lo = -1, hi = D_size, mid;\n    while ( hi - lo > 1) {\n        mid = (hi + lo) / 2;\n        if ( D[mid] < key )\n            lo = mid;\n        else\n            hi = mid;\n    }\n\n    return hi;\n}\n//}}}\n\n//{{{ bpt_node_cache_handler\n//{{{uint64_t bpt_node_serialize(void *deserialized, void **serialized)\nuint64_t bpt_node_serialize(void *deserialized, void **serialized)\n{\n    struct bpt_node *de = (struct bpt_node *)deserialized;\n\n    //uint8_t *data = (uint8_t *)calloc(2*ORDER+9, sizeof(uint32_t));\n    uint8_t *data = (uint8_t *)calloc(BPT_NODE_NUM_ELEMENTS*sizeof(uint32_t),\n                                      sizeof(uint8_t));\n    if (data == NULL)\n        err(1, \"calloc error in bpt_node_serialize()\");\n\n    memcpy(data, de->data, BPT_NODE_NUM_ELEMENTS*sizeof(uint32_t));\n\n    *serialized = (void *)data;\n    return BPT_NODE_NUM_ELEMENTS*sizeof(uint32_t);\n}\n//}}}\n\n//{{{ uint64_t bpt_node_deserialize(void *serialized,\nuint64_t bpt_node_deserialize(void *serialized,\n                             uint64_t serialized_size,\n                             void **deserialized)\n{\n    uint8_t *data = (uint8_t *)serialized;\n\n    struct bpt_node *n = (struct bpt_node *)malloc(sizeof(struct bpt_node));\n\n    if (n == NULL)\n        err(1, \"malloc error in bpt_node_deserialize().\");\n\n    n->data = (uint32_t *)calloc(BPT_NODE_NUM_ELEMENTS,sizeof(uint32_t));\n    if (n->data == NULL)\n        err(1, \"calloc error in bpt_node_deserialize().\");\n\n    memcpy(n->data, data, BPT_NODE_NUM_ELEMENTS*sizeof(uint32_t));\n\n    *deserialized = (void *)n;\n\n    return sizeof(struct bpt_node);\n}\n//}}}\n\n//{{{void bpt_node_free_mem(void **deserialized)\nvoid bpt_node_free_mem(void **deserialized)\n{\n    struct bpt_node **de = (struct bpt_node **)deserialized;\n    free((*de)->data);\n    free(*de);\n    *de = NULL;\n}\n//}}}\n//}}}\n\n//{{{ struct bpt_node *bpt_new_node()\nstruct bpt_node *bpt_new_node(uint32_t domain)\n{\n    struct bpt_node *n = (struct bpt_node *)malloc(sizeof(struct bpt_node));\n    if (n == NULL)\n        err(1, \"malloc error in bpt_new_node().\");\n\n    n->data = (uint32_t *)calloc(BPT_NODE_NUM_ELEMENTS, sizeof(uint32_t));\n    if (n->data == NULL)\n        err(1, \"calloc error in bpt_new_node().\");\n\n    // zero is null for a bpt, so the ids start at one the cache number starts\n    // at zero so add or subtract one to get the one/zero-based numbering \n    BPT_ID(n) = cache.seen(domain) + 1;\n    cache.add(domain,\n              BPT_ID(n) - 1,\n              n,\n              sizeof(struct bpt_node),\n              &bpt_node_cache_handler);\n\n    return n;\n}\n//}}}\n\n//{{{ struct bpt_node *bpt_find_leaf(struct bpt_node *curr, int key)\nuint32_t bpt_find_leaf(uint32_t domain, uint32_t curr_id, uint32_t key)\n{\n    //fprintf(stderr, \"domain:%u\\tcurr_id:%u\\n\", domain, curr_id);\n    // cache is zero-based, while bpt is one-based\n    struct bpt_node *curr = cache.get(domain,\n                                      curr_id - 1,\n                                      &bpt_node_cache_handler);\n    if (curr == NULL)\n        return 0;\n\n    while (BPT_IS_LEAF(curr) != 1) {\n        int i = bpt_find_insert_pos(curr, key);\n\n        if ((i < BPT_NUM_KEYS(curr)) && (BPT_KEYS(curr)[i] == key))\n            i+=1;\n\n        // cache is zero-based, while bpt is one-based\n        uint32_t next = BPT_POINTERS(curr)[i] - 1;\n        curr = cache.get(domain,\n                         next,\n                         &bpt_node_cache_handler);\n    }\n\n    uint32_t id = BPT_ID(curr);\n    return id;\n}\n//}}}\n\n//{{{int bpt_find_insert_pos(struct bpt_node *leaf, int key)\nint bpt_find_insert_pos(struct bpt_node *leaf, uint32_t key)\n{\n    return b_search(key, BPT_KEYS(leaf), BPT_NUM_KEYS(leaf));\n}\n//}}}\n\n//{{{struct bpt_node *bpt_split_node(struct bpt_node *root, struct bpt_node\nuint32_t bpt_split_node(uint32_t domain,\n                        uint32_t root_id,\n                        uint32_t bpt_node_id,\n                        uint32_t *lo_result_id,\n                        uint32_t *hi_result_id,\n                        int *lo_hi_split_point,\n                        void (*repair)(uint32_t domain,\n                                       struct bpt_node *,\n                                       struct bpt_node *))\n{\n#if DEBUG\n        fprintf(stderr, \"bpt_split_node\\n\");\n#endif\n\n#if DEBUG\n    {\n        fprintf(stderr, \"bpt_split_node\\n\");\n        fprintf(stderr, \"root_id:%u\\tbpt_node_id:%u\\n\", root_id, bpt_node_id);\n    }\n#endif\n\n    // cache is zero-based, while bpt is one-based\n    struct bpt_node *bpt_node = cache.get(domain,\n                                          bpt_node_id - 1,\n                                          &bpt_node_cache_handler);\n    struct bpt_node *n = bpt_new_node(domain);\n\n#if DEBUG\n    {\n        int i;\n        fprintf(stderr, \"keys\\t\");\n        for (i = 0; i < BPT_NUM_KEYS(bpt_node); ++i)\n            fprintf(stderr, \"%u\\t\", BPT_KEYS(bpt_node)[i]);\n        fprintf(stderr, \"\\n\");\n    }\n#endif\n\n    // set the split location\n    int split_point = (ORDER + 1)/2;\n\n    *lo_result_id = BPT_ID(bpt_node);\n    *hi_result_id = BPT_ID(n);\n    *lo_hi_split_point = split_point;\n\n    // copy the 2nd 1/2 of the values over to the new bpt_node\n    int bpt_node_i, new_bpt_node_i = 0;\n    for (bpt_node_i = split_point;\n         bpt_node_i < BPT_NUM_KEYS(bpt_node);\n         ++bpt_node_i) {\n\n        BPT_KEYS(n)[new_bpt_node_i] = BPT_KEYS(bpt_node)[bpt_node_i];\n        BPT_POINTERS(n)[new_bpt_node_i] = BPT_POINTERS(bpt_node)[bpt_node_i];\n        BPT_NUM_KEYS(n) += 1;\n        new_bpt_node_i += 1;\n    }\n\n    // if the bpt_node is not a leaf, the far right pointer must be coppied too\n    if (BPT_IS_LEAF(bpt_node) == 0) {\n        BPT_POINTERS(n)[new_bpt_node_i] = BPT_POINTERS(bpt_node)[bpt_node_i];\n        BPT_POINTERS(n)[0] = 0;\n    }\n\n    // set status of new bpt_node\n    BPT_IS_LEAF(n) = BPT_IS_LEAF(bpt_node);\n    BPT_PARENT(n) = BPT_PARENT(bpt_node);\n\n    BPT_NUM_KEYS(bpt_node) = split_point;\n\n    if (BPT_IS_LEAF(bpt_node) == 0) {\n        // if the bpt_node is not a leaf, then update the parent pointer of the \n        // children\n        for (bpt_node_i = 1; bpt_node_i <= BPT_NUM_KEYS(n); ++bpt_node_i) {\n            // cache is zero-based, while bpt is one-based\n            struct bpt_node *child = cache.get(domain,\n                                               BPT_POINTERS(n)[bpt_node_i] - 1,\n                                               &bpt_node_cache_handler);\n            BPT_PARENT(child) = BPT_ID(n);\n        }\n    } else {\n        // if the bpt_node is a leaf, then connect the two\n        BPT_NEXT(n)= BPT_NEXT(bpt_node);\n        BPT_NEXT(bpt_node) = BPT_ID(n);\n    }\n\n    if (bpt_node_repair != NULL) {\n        bpt_node_repair(domain, bpt_node, n);\n    }\n\n    if (BPT_ID(bpt_node) == root_id) {\n        // if we just split the root, create a new root witha single value\n        struct bpt_node *new_root = bpt_new_node(domain);\n        BPT_IS_LEAF(new_root) = 0;\n        BPT_NUM_KEYS(new_root) += 1;\n        BPT_KEYS(new_root)[0] = BPT_KEYS(n)[0];\n        BPT_POINTERS(new_root)[0] = BPT_ID(bpt_node); \n        BPT_POINTERS(new_root)[1] = BPT_ID(n); \n        BPT_PARENT(bpt_node) = BPT_ID(new_root);\n        BPT_PARENT(n) = BPT_ID(new_root);\n        return BPT_ID(new_root);\n    } else {\n        // if we didnt split the root, place the new value in the parent\n        // bpt_node\n        int trash_pos;\n        uint32_t parent_id =  BPT_PARENT(bpt_node);\n        return bpt_place_new_key_value(domain,\n                                       root_id,\n                                       &parent_id,\n                                       &trash_pos,\n                                       BPT_KEYS(n)[0],\n                                       BPT_ID(n),\n                                       NULL);\n    }\n}\n//}}}\n\n//{{{ uint32_t bpt_place_new_key_value(uint32_t domain,\nuint32_t bpt_place_new_key_value(uint32_t domain,\n                                 uint32_t root_id,\n                                 uint32_t *target_id,\n                                 int *target_key_pos,\n                                 uint32_t key,\n                                 uint32_t value_id,\n                                 struct cache_handler *handler)\n{\n#if DEBUG\n    {\n        fprintf(stderr, \"bpt_place_new_key_value\\n\");\n        fprintf(stderr,\n                \"root_id:%u\\ttarget_id:%u\\tkey:%u\\n\",\n                root_id,\n                *target_id,\n                key);\n    }\n#endif\n\n    // cache is zero-based, while bpt is one-based\n    struct bpt_node *target_bpt_node = cache.get(domain,\n                                                 *target_id - 1,\n                                                 &bpt_node_cache_handler);\n\n#if DEBUG\n    {\n        int i;\n        fprintf(stderr, \"keys\\t\");\n        for (i = 0; i < BPT_NUM_KEYS(target_bpt_node); ++i)\n            fprintf(stderr, \"%u\\t\", BPT_KEYS(target_bpt_node)[i]);\n        fprintf(stderr, \"\\n\");\n    }\n#endif\n\n    int bpt_insert_key_pos = bpt_find_insert_pos(target_bpt_node, key);\n\n    int bpt_insert_value_pos = bpt_insert_key_pos;\n\n    if (BPT_IS_LEAF(target_bpt_node) == 0)\n        bpt_insert_value_pos += 1;\n\n    if (BPT_IS_LEAF(target_bpt_node) == 1)\n        *target_key_pos = bpt_insert_key_pos;\n\n\n    if ((BPT_IS_LEAF(target_bpt_node) == 1) &&\n         (*target_key_pos < (BPT_NUM_KEYS(target_bpt_node))) &&\n        (BPT_KEYS(target_bpt_node)[*target_key_pos] == key )) {\n\n        // If the append function is NULL assume overwrite\n        if (append != NULL)\n            append(domain,\n                   value_id,\n                   BPT_POINTERS(target_bpt_node)[*target_key_pos],\n                   handler);\n        else\n            BPT_POINTERS(target_bpt_node)[*target_key_pos] = value_id;\n\n        return root_id;\n    }\n\n    // move everything over\n    int i;\n    for (i = BPT_NUM_KEYS(target_bpt_node); i > bpt_insert_key_pos; --i) {\n        BPT_KEYS(target_bpt_node)[i] = BPT_KEYS(target_bpt_node)[i-1];\n    }\n\n    if (BPT_IS_LEAF(target_bpt_node) == 1) {\n        for (i = BPT_NUM_KEYS(target_bpt_node); i > bpt_insert_value_pos; --i) \n            BPT_POINTERS(target_bpt_node)[i] = \n                    BPT_POINTERS(target_bpt_node)[i-1];\n    } else {\n        for (i = BPT_NUM_KEYS(target_bpt_node)+1;\n             i > bpt_insert_value_pos;\n             --i) {\n            BPT_POINTERS(target_bpt_node)[i] = \n                    BPT_POINTERS(target_bpt_node)[i-1];\n        }\n    }\n\n#if DEBUG\n    {\n        fprintf(stderr,\n                \"bpt_insert_key_pos:%u\\tbpt_insert_value_pos:%u\\n\",\n                bpt_insert_key_pos,\n                bpt_insert_value_pos);\n    }\n#endif\n\n    BPT_KEYS(target_bpt_node)[bpt_insert_key_pos] = key;\n    BPT_POINTERS(target_bpt_node)[bpt_insert_value_pos] = value_id;\n\n    BPT_NUM_KEYS(target_bpt_node) += 1;\n\n    // If there are now too many values in the bpt_node, split it\n    if (BPT_NUM_KEYS(target_bpt_node) > ORDER) {\n        uint32_t lo_result_id, hi_result_id;\n        int lo_hi_split_point = 0;\n        uint32_t new_root_id = bpt_split_node(domain,\n                                              root_id,\n                                              BPT_ID(target_bpt_node),\n                                              &lo_result_id,\n                                              &hi_result_id,\n                                              &lo_hi_split_point,\n                                              bpt_node_repair);\n\n        // cache is zero-based, while bpt is one-based\n        target_bpt_node = cache.get(domain,\n                                    *target_id - 1,\n                                    &bpt_node_cache_handler);\n\n        if (BPT_IS_LEAF(target_bpt_node)) {\n            if (bpt_insert_key_pos < lo_hi_split_point)\n                *target_id = lo_result_id;\n            else {\n                *target_id = hi_result_id;\n                *target_key_pos = bpt_insert_key_pos - lo_hi_split_point;\n            }\n        }\n\n        return new_root_id;\n    } else {\n        return root_id;\n    }\n}\n//}}}\n\n//{{{ uint32_t bpt_insert(uint32_t domain,\nuint32_t bpt_insert(uint32_t domain,\n                    uint32_t root_id,\n                    uint32_t key,\n                    uint32_t value_id,\n                    struct cache_handler *handler,\n                    uint32_t *leaf_id,\n                    int *pos)\n{\n#if DEBUG\n    fprintf(stderr, \"bpt_insert\\n\");\n#endif\n\n    if (root_id == 0) {\n        struct bpt_node *root = bpt_new_node(domain);\n        BPT_IS_LEAF(root) = 1;\n        BPT_KEYS(root)[0] = key;\n        BPT_POINTERS(root)[0] = value_id;\n        BPT_NUM_KEYS(root) += 1;\n\n        *leaf_id = BPT_ID(root);\n        *pos = 0;\n\n        return BPT_ID(root);\n    } else {\n        *leaf_id = bpt_find_leaf(domain, root_id, key);\n\n#if DEBUG\n        {\n            fprintf(stderr, \"root_id:%u\\tleaf_id:%u\\n\", root_id, *leaf_id);\n        }\n#endif\n\n        root_id = bpt_place_new_key_value(domain,\n                                          root_id,\n                                          leaf_id,\n                                          pos,\n                                          key,\n                                          value_id,\n                                          handler);\n        return root_id;\n    }\n}\n//}}}\n\n//{{{uint32_t bpt_insert_new_value(uint32_t root_id,\nuint32_t bpt_insert_new_value(uint32_t domain,\n                              uint32_t root_id,\n                              uint32_t key,\n                              void *value,\n                              struct cache_handler *handler,\n                              uint32_t *value_id,\n                              uint32_t *leaf_id,\n                              int *pos)\n{\n#if DEBUG\n    fprintf(stderr, \"bpt_insert_new_value\\n\");\n#endif\n\n    *value_id = cache.seen(domain) + 1;\n    cache.add(domain,\n              *value_id - 1,\n              value,\n              sizeof(void *),\n              handler);\n    return bpt_insert(domain,\n                      root_id,\n                      key,\n                      *value_id,\n                      handler,\n                      leaf_id,\n                      pos);\n}\n//}}}\n\n//{{{ uint32_t bpt_find(uint32_t root_id,\nuint32_t bpt_find(uint32_t domain,\n                  uint32_t root_id,\n                  uint32_t *leaf_id,\n                  int *pos,\n                  uint32_t key) \n{\n    if (root_id == 0)\n        return 0;\n\n    *leaf_id = bpt_find_leaf(domain, root_id, key);\n    // cache is zero-based, while bpt is one-based\n    struct bpt_node *leaf = cache.get(domain,\n                                      *leaf_id - 1,\n                                      &bpt_node_cache_handler);\n\n    int bpt_insert_key_pos = bpt_find_insert_pos(leaf, key);\n\n\n    *pos = bpt_insert_key_pos;\n    if ((bpt_insert_key_pos + 1) > BPT_NUM_KEYS(leaf)) \n        return 0;\n    else if (key != BPT_KEYS(leaf)[bpt_insert_key_pos])\n        return 0;\n    else {\n        return BPT_POINTERS(leaf)[bpt_insert_key_pos];\n    }\n}\n//}}}\n\n//{{{void bpt_write_tree(uint32_t root_id, FILE *f, char *file_name)\nbool bpt_write_tree(uint32_t domain, uint32_t root_id)\n{\n    if (root_id == 0)\n        return false;\n\n    cache.store(domain, NULL);\n\n    return true;\n    /*\n     * For each domain, start by writing out all of the non-leaf nodes.\n     * Next write the leaf-nodes, where each leaf is immediantly followed by a\n     * block of the pointer values. In this scheme the leaf-node will have a\n     * pointer (BPT_POINTERS_BLOCK) to the block of pointer values.  \n     *\n     * A pointer block contains all of the pointers for a leaf node.\n     *\n     * only the block will be tracked in the cache, and the full block must be\n     * read to access any values in the block.\n     *\n     * Leaf node pointers are relative to the values in a block.\n     *\n     * The organization of these blocks can be applicaiton specific.\n     *\n     * For GIGGLE, each poiner holds a list of starts (SA) and ends (SE).  All\n     * SAs can be grouped into a single list, and the pointers can be offsets\n     * (end positions?) into that list.  Similarly for SEs.\n     *\n     * \n     */\n\n#if 0\n    if (root_id == 0)\n        return;\n    /*\n     * The nodes may not exist in the cache in a way that makes sense to store,\n     * so we will do a BFS traversal of the tree and write/renumber the IDs\n     * accordingly and store the offsets in an indexed array.\n     */\n\n    // Make room in the file for the id -> file offset map so we can come back\n    // after and lay it down.\n    \n    uint32_t num_seen =  cache.seen(cache.cache);\n\n    struct disk_store *ds = disk_store_init(num_seen + 1, &f, file_name);\n\n    struct fifo_q *node_q = NULL, *leaf_q = NULL;\n    uint32_t *id;\n    id = (uint32_t *)malloc(sizeof(uint32_t));\n    *id = root_id;\n\n    struct bpt_node *to_write_node = (struct bpt_node *)\n            malloc(sizeof(struct bpt_node));\n    to_write_node->data = (uint32_t *)calloc(BPT_NODE_NUM_ELEMENTS,\n                                             sizeof(uint32_t));\n\n    // We run through the code an renumber the nodes so that are laid our a\n    // nicely\n\n    /*\n     * Use old_id_to_new_id_os to maintain the mapping between the IDs that\n     * are in memory and those that will be written to disk.\n     */\n    struct ordered_set *old_id_to_new_id_os =\n            ordered_set_init(cache.seen(cache.cache),\n                             uint_pair_sort_by_first_element_cmp,\n                             uint_pair_search_by_first_element_cmp,\n                             uint_pair_search_by_first_key_cmp);\n\n    struct uint_pair *p, *r;\n\n    // put root into a map between the current id and the on-disk id\n    p = (struct uint_pair *) malloc(sizeof(struct uint_pair));\n    p->first = root_id;\n    p->second = old_id_to_new_id_os->num + 1;\n    r = ordered_set_add(old_id_to_new_id_os, p);\n\n    fifo_q_push(&node_q, id);\n\n    long node_start_offset = ftell(f);\n\n    while (fifo_q_peek(node_q) != NULL) {\n        // Zero out the node that we will write to disk\n        memset(to_write_node->data, 0, BPT_NODE_SIZE);\n\n        // Get the current node's id from the queue and data from the cache\n        uint32_t *curr_idp = fifo_q_pop(&node_q);\n        uint32_t curr_id = *curr_idp;\n        free(curr_idp);\n        // cache is zero-based, while bpt is one-based\n        struct bpt_node *curr_node = cache.get(domain,\n                                               curr_id - 1,\n                                               &bpt_node_cache_handler);\n\n        // Get the on-disk id\n        uint32_t key = curr_id;\n        r = ordered_set_get(old_id_to_new_id_os, &key);\n        if (r == NULL)\n            errx(1, \"Node %u has not been seen yet.\", curr_id);\n\n        // Populate the node that we will write to disk\n        BPT_ID(to_write_node) =  r->second;\n        BPT_PARENT(to_write_node) = BPT_PARENT(curr_node);\n        BPT_IS_LEAF(to_write_node) = BPT_IS_LEAF(curr_node);\n        BPT_LEADING(to_write_node) = BPT_LEADING(curr_node);\n        BPT_NEXT(to_write_node) = BPT_NEXT(curr_node);\n        BPT_NUM_KEYS(to_write_node) = BPT_NUM_KEYS(curr_node);\n\n        uint32_t i;\n        for (i = 0; i <= BPT_NUM_KEYS(curr_node); ++i)\n            BPT_KEYS(to_write_node)[i] = BPT_KEYS(curr_node)[i];\n\n\n        // If the node is a leaf we need to deal with the leading values\n        if (BPT_IS_LEAF(curr_node)) {\n            if (BPT_LEADING(curr_node) != 0) {\n                // put a map between the current id and the to disk id\n                p = (struct uint_pair *) malloc(sizeof(struct uint_pair));\n                p->first = BPT_LEADING(curr_node);\n                p->second = old_id_to_new_id_os->num + 1;\n                r = ordered_set_add(old_id_to_new_id_os, p);\n\n                if (r->second != p->second)\n                    errx(1, \"%u has already been seen at %u\\n\",\n                            p->first, r->first);\n\n                BPT_LEADING(to_write_node) =  p->second;\n            }\n        }\n\n        // loop over all the pointers and if the are nodes put them on the q\n        uint32_t max_pointer;\n        if (BPT_IS_LEAF(curr_node)) \n            max_pointer = BPT_NUM_KEYS(curr_node) - 1;\n        else \n            max_pointer = BPT_NUM_KEYS(curr_node);\n\n        for (i = 0; i <= max_pointer; ++i) {\n            if (BPT_POINTERS(curr_node)[i] != 0) {\n                // put a map between the current id and the to disk id\n                p = (struct uint_pair *) malloc(sizeof(struct uint_pair));\n                p->first = BPT_POINTERS(curr_node)[i];\n                p->second = old_id_to_new_id_os->num + 1;\n                r = ordered_set_add(old_id_to_new_id_os, p);\n\n                if (r->second != p->second)\n                    errx(1, \"%u has already been seen at %u\\n\",\n                            p->first, r->first);\n\n                // if the node is a leaf, then its pointers are to data not\n                // other nodes.  that data will be handled later\n                if (! BPT_IS_LEAF(curr_node)) {\n                    id = (uint32_t *)malloc(sizeof(uint32_t));\n                    *id = BPT_POINTERS(curr_node)[i];\n                    fifo_q_push(&node_q, id);\n                }\n\n                if (r->second != p->second)\n                    errx(1, \"%u has already been seen at %u\\n\",\n                            p->first, r->first);\n\n                BPT_POINTERS(to_write_node)[i] =  p->second;\n            }\n        }\n\n        // we need to loop back over the leafs so we can write out the \n        // data in the pointers and leading\n        if (BPT_IS_LEAF(curr_node)) {\n            id = (uint32_t *)malloc(sizeof(uint32_t));\n            *id = BPT_ID(curr_node);\n            fifo_q_push(&leaf_q, id);\n        }\n\n        uint32_t ret = disk_store_append(ds,\n                                         to_write_node->data,\n                                         BPT_NODE_SIZE);\n\n        if (ret + 1 != BPT_ID(to_write_node))\n                errx(1,\n                     \"Disk write is out of sync.  Saw %u.  Expected %u.\",\n                     ret + 1, \n                     BPT_ID(to_write_node));\n    }\n\n    long node_end_offset = ftell(f);\n    long data_start_offset = node_end_offset;\n\n    // Write out the data to disk\n    while (fifo_q_peek(leaf_q) != NULL) {\n        // Get the current node's id from the queue and data from the cache\n        uint32_t *curr_idp = fifo_q_pop(&leaf_q);\n        uint32_t curr_id = *curr_idp;\n        free(curr_idp);\n        struct bpt_node *curr_node = cache.get(cache.cache, curr_id);\n\n        //Write the leading value\n        if (BPT_LEADING(curr_node) != 0) {\n            // Get the on-disk id\n            r = ordered_set_get(old_id_to_new_id_os, &(BPT_LEADING(curr_node)));\n            if (r == NULL)\n                errx(1,\n                     \"Node %u has not been seen yet.\",\n                     BPT_LEADING(curr_node));\n            uint32_t on_disk_id = r->second;\n\n            // Get the data\n            void *curr_pointer = cache.get(cache.cache, BPT_LEADING(curr_node));\n\n            uint8_t *serialized_data;\n            uint64_t serialized_size = serialize_leading(curr_pointer,\n                                                         &serialized_data);\n            uint32_t ret = disk_store_append(ds,\n                                             serialized_data,\n                                             serialized_size);\n            free(serialized_data);\n\n            if (ret + 1 != on_disk_id)\n                errx(1,\n                     \"Disk write is out of sync.  Saw %u.  Expected %u.\",\n                     ret + 1, \n                     on_disk_id);\n        }\n\n        //Write the pointer values\n        uint32_t i;\n        for (i = 0; i < BPT_NUM_KEYS(curr_node); ++i) {\n            if (BPT_POINTERS(curr_node)[i] != 0) {\n                // Get the on-disk id\n                r = ordered_set_get(old_id_to_new_id_os,\n                                    &(BPT_POINTERS(curr_node)[i]));\n                if (r == NULL)\n                    errx(1,\n                         \"Node %u has not been seen yet.\",\n                         BPT_POINTERS(curr_node)[i]);\n                uint32_t on_disk_id = r->second;\n\n                // get the pointer from cache\n                void *curr_pointer = cache.get(cache.cache,\n                                               BPT_POINTERS(curr_node)[i]);\n                if (curr_pointer == NULL)\n                    errx(1,\n                         \"Pointer data %u not in cache.\", \n                         BPT_POINTERS(curr_node)[i]);\n\n                uint8_t *serialized_data;\n                uint64_t serialized_size = serialize_pointer(curr_pointer,\n                                                             &serialized_data);\n                uint32_t ret = disk_store_append(ds,\n                                                 serialized_data,\n                                                 serialized_size);\n                free(serialized_data);\n\n                if (ret + 1 != on_disk_id)\n                    errx(1,\n                         \"Disk write is out of sync.  Saw %u.  Expected %u.\",\n                         ret + 1, \n                         on_disk_id);\n            }\n        }\n\n    }\n\n    disk_store_sync(ds);\n    free(ds->file_name);\n    free(ds->offsets);\n    free(ds);\n    ds = NULL;\n\n    // Move back to the end of the file before we return\n    fseek(f, 0, SEEK_END);\n\n    ordered_set_destroy(&old_id_to_new_id_os, free_wrapper);\n    free(to_write_node->data);\n    free(to_write_node);\n#endif\n    return true;\n}\n//}}}\n\n//{{{void bpt_print_node(struct bpt_node *node)\nvoid bpt_print_node(struct bpt_node *node)\n{\n//BPT_NODE_NUM_ELEMENTS (2*ORDER+9)\n//BPT_NODE_ELEMENT_SIZE sizeof(uint32_t)\n//BPT_NODE_SIZE (BPT_NODE_NUM_ELEMENTS*BPT_NODE_ELEMENT_SIZE)\n\n    printf(\"BPT_ID:%u\\t\"\n           \"BPT_PARENT:%u\\t\"\n           \"BPT_IS_LEAF:%u\\t\"\n           \"BPT_LEADING:%u\\t\"\n           \"BPT_NEXT:%u\\t\"\n           \"BPT_NUM_KEYS:%u\\t\"\n           \"\\n\",\n            BPT_ID(node),\n            BPT_PARENT(node),\n            BPT_IS_LEAF(node),\n            BPT_LEADING(node),\n            BPT_NEXT(node),\n            BPT_NUM_KEYS(node));\n\n    uint32_t i;\n    for (i = 0; i < BPT_NUM_KEYS(node); ++i) {\n        if (i !=0 )\n            printf(\"\\t\");\n        printf(\"%u:%u\", BPT_KEYS(node)[i], BPT_POINTERS(node)[i]);\n    }\n    printf(\"\\n\");\n\n//BPT_KEYS(node)\n//BPT_POINTERS(node)\n\n}\n//}}}\n"
  },
  {
    "path": "src/bpt.h",
    "content": "#ifndef __BPT_H__\n#define __BPT_H__\n\n#include <stdint.h>\n#include <stdio.h>\n#include <stdbool.h>\n#include \"lists.h\"\n#include \"cache.h\"\n\nuint32_t ORDER;\n\n#define BPT_NODE_NUM_ELEMENTS (2*ORDER+10)\n#define BPT_NODE_ELEMENT_SIZE sizeof(uint32_t)\n#define BPT_NODE_SIZE (BPT_NODE_NUM_ELEMENTS*BPT_NODE_ELEMENT_SIZE)\n\n#define BPT_ID(node)            ((node)->data[0])\n#define BPT_PARENT(node)        ((node)->data[1])\n#define BPT_IS_LEAF(node)       ((node)->data[2])\n#define BPT_LEADING(node)       ((node)->data[3])\n#define BPT_NEXT(node)          ((node)->data[4])\n#define BPT_NUM_KEYS(node)      ((node)->data[5])\n#define BPT_KEYS(node)          ((node)->data + 6)\n#define BPT_POINTERS_BLOCK(node) (((node)->data + (6+ORDER+1))[0])\n#define BPT_POINTERS(node)      ((node)->data + (6+ORDER+2))\n\nstruct ordered_set *id_to_offset_map;\n\nstruct bpt_node \n{\n    // 0 parent\n    // 1 is_leaf\n    // 2 leading\n    // 3 next\n    // 4 num_keys\n    // [5 ... 5+(ORDER+1)]\n    // [(5+(ORDER+1)) ... ((5+ORDER+1)+1)+(ORDER+2))\n    //\n    // Total size is 5+(ORDER+1)+(ORDER+2) = 2*ORDER + 9\n    \n    uint32_t *data;\n};\n\nuint64_t bpt_node_serialize(void *deserialized, void **serialized);\nuint64_t bpt_node_deserialize(void *serialized,\n                              uint64_t serialized_size,\n                              void **deserialized);\nvoid bpt_node_free_mem(void **deserialized);\n\nstruct cache_handler bpt_node_cache_handler;\n\nstruct bpt_node *bpt_new_node(uint32_t domain);\n\nuint32_t bpt_find_leaf(uint32_t domain, uint32_t curr, uint32_t key);\n\nuint32_t bpt_place_new_key_value(uint32_t domain,\n                                 uint32_t root_id,\n                                 uint32_t *target_id,\n                                 int *target_key_pos,\n                                 uint32_t key,\n                                 uint32_t value_id,\n                                 struct cache_handler *handler);\n\nuint32_t bpt_split_node(uint32_t domain,\n                        uint32_t root_id,\n                        uint32_t bpt_node_id,\n                        uint32_t *lo_result_id,\n                        uint32_t *hi_result_id,\n                        int *lo_hi_split_point,\n                        void (*repair)(uint32_t domain,\n                                       struct bpt_node *,\n                                       struct bpt_node *));\n\nvoid (*bpt_node_repair)(uint32_t domain, struct bpt_node *, struct bpt_node *);\n\n//uint64_t (*serialize_leading)(void *deserialized, uint8_t **serialized);\n//uint64_t (*serialize_pointer)(void *deserialized, uint8_t **serialized);\n//uint64_t serialize_uint32_t(void *deserialized, uint8_t **serialized);\n\nvoid (*append)(uint32_t domain,\n               uint32_t new_value_id,\n               uint32_t existing_value_id,\n               struct cache_handler *handler);\n\n//struct bpt_node *bpt_to_node(void *n);\n\nuint32_t bpt_insert(uint32_t domain,\n                    uint32_t root_id,\n                    uint32_t key,\n                    uint32_t value_id,\n                    struct cache_handler *handler,\n                    uint32_t *leaf_id,\n                    int *pos);\n\nuint32_t bpt_insert_new_value(uint32_t domain,\n                              uint32_t root_id,\n                              uint32_t key,\n                              void *value,\n                              struct cache_handler *handler,\n                              uint32_t *value_id,\n                              uint32_t *leaf_id,\n                              int *pos);\n\n//void bpt_print_tree(struct bpt_node *curr, int level);\n//void pbt_print_node(struct bpt_node *bpt_node);\n\nint b_search(uint32_t key, const uint32_t *D, uint32_t D_size);\n\nint bpt_find_insert_pos(struct bpt_node *leaf, uint32_t key);\n\n/**\n * @brief Search for a posistion within a bplus tree\n *\n * @param domain cache domain, chrom id for GIGGLE\n * @param root_id id of the tree root\n * @param leaf_id set to the id of leaf that does (or should) contain the key\n * @param pos set to possition of the key if found\n * @param key search key\n *\n * @retval 0 if the key was not found, the id to the pointer if found\n *\n */\nuint32_t bpt_find(uint32_t domain,\n                  uint32_t root_id,\n                  uint32_t *leaf_id,\n                  int *pos,\n                  uint32_t key);\n\nvoid bpt_destroy_tree(struct bpt_node **root);\n\nbool bpt_write_tree(uint32_t domain, uint32_t root_id);\nvoid bpt_print_node(struct bpt_node *node);\n#endif\n"
  },
  {
    "path": "src/cache.c",
    "content": "#define _GNU_SOURCE\n\n#include <stdlib.h>\n#include <stdio.h>\n#include <stdint.h>\n#include <err.h>\n#include <sysexits.h>\n#include <string.h>\n#include <unistd.h>\n#include <htslib/khash.h>\n\n#include \"cache.h\"\n#include \"util.h\"\n#include \"lists.h\"\n\nuint32_t CACHE_NAME_SPACE = 0;\nvoid *_cache[10] =\n    {NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL};\nstruct cache_def cache;\n\n\nstruct cache_handler uint32_t_cache_handler = {uint32_t_serialize, \n                                               uint32_t_deserialize,\n                                               uint32_t_free_mem};\n//{{{ uint32_t_cache_handler\n//{{{uint64_t uint32_t_serialize(void *deserialized, void **serialized)\nuint64_t uint32_t_serialize(void *deserialized, void **serialized)\n{\n    uint32_t *de = (uint32_t *)deserialized;\n\n    //uint8_t *data = (uint8_t *)calloc(1, sizeof(uint32_t));\n    uint8_t *data = (uint8_t *)calloc(sizeof(uint32_t), sizeof(uint8_t));\n    if (data == NULL)\n        err(1, \"calloc error in uint32_t_serialize().\");\n\n    memcpy(data, de, sizeof(uint32_t));\n\n    *serialized = (void *)data;\n    return sizeof(uint32_t);\n}\n//}}}\n\n//{{{ uint64_t uint32_t_deserialize(void *serialized,\nuint64_t uint32_t_deserialize(void *serialized,\n                             uint64_t serialized_size,\n                             void **deserialized)\n{\n    uint8_t *data = (uint8_t *)serialized;\n\n    uint32_t *u = (uint32_t *)malloc(sizeof(uint32_t));\n    if (u == NULL)\n        err(1, \"malloc error in uint32_t_deserialize().\");\n\n    memcpy(u, data, sizeof(uint32_t));\n\n    *deserialized = (void *)u;\n\n    return sizeof(uint32_t);\n}\n//}}}\n\n//{{{void uint32_t_free_mem(void **deserialized)\nvoid uint32_t_free_mem(void **deserialized)\n{\n    uint32_t **de = (uint32_t **)deserialized;\n    free(*de);\n    *de = NULL;\n}\n//}}}\n//}}}\n\n//{{{ simple_cache\nstruct cache_def simple_cache_def = {\n    simple_cache_init,\n    simple_cache_seen,\n    simple_cache_add,\n    simple_cache_get,\n    simple_cache_store,\n    NULL,\n    simple_cache_destroy\n};\n\n//{{{ void *simple_cache_init(uint32_t size,\nvoid *simple_cache_init(uint32_t size,\n                        uint32_t num_domains,\n                        char **file_names) \n{\n    struct simple_cache *sc = (struct simple_cache *)\n            malloc(sizeof(struct simple_cache));\n    if (sc == NULL)\n        err(1, \"malloc error in simple_cache_init().\");\n\n    _cache[CACHE_NAME_SPACE] = sc;\n    cache = simple_cache_def;\n\n    (void) pthread_mutex_init (&(sc->mutex), NULL);\n\n    sc->num_domains = num_domains;\n\n    sc->dirty = 0;\n\n    char *max_bytes_env = getenv(\"GIGGLE_MAX_BYTES\");\n    if (max_bytes_env != NULL) {\n        char *pend;\n        sc->max_bytes = strtoull(max_bytes_env, &pend, 10);\n    } else {\n        sc->max_bytes = 1000000000;\n    }\n\n    sc->curr_bytes = 0;\n    sc->lru_head = NULL;\n    sc->lru_tail = NULL;\n\n    //sc->ils = (struct indexed_list **)calloc(num_domains,\n                                             //sizeof(struct indexed_list *));\n    sc->hashls = (struct hash_list **)calloc(num_domains,\n                                           sizeof(struct hash_list *));\n    //if (sc->ils == NULL)\n        //err(1, \"calloc error in simple_cache_init().\");\n    if (sc->hashls == NULL)\n        err(1, \"calloc error in simple_cache_init().\");\n\n    sc->nums = (uint32_t *)calloc(num_domains, sizeof(uint32_t));\n    if (sc->nums == NULL)\n        err(1, \"calloc error in simple_cache_init().\");\n\n    sc->seens = (uint32_t *)calloc(num_domains, sizeof(uint32_t));\n    if (sc->seens == NULL)\n        err(1, \"calloc error in simple_cache_init().\");\n\n    sc->dss = NULL;\n    sc->data_file_names = NULL;\n    sc->index_file_names = NULL;\n\n    uint32_t i;\n    // opend attached files\n    if (file_names != NULL) {\n        sc->dss = (struct disk_store **)calloc(num_domains, \n                                               sizeof(struct disk_store *));\n        if (sc->dss == NULL)\n            err(1, \"calloc error in simple_cache_init().\");\n\n        sc->index_file_names = (char **)calloc(num_domains, \n                                               sizeof(char *));\n        if (sc->index_file_names == NULL)\n            err(1, \"calloc error in simple_cache_init().\");\n\n        sc->data_file_names = (char **)calloc(num_domains, \n                                              sizeof(char *));\n        if (sc->data_file_names == NULL)\n            err(1, \"calloc error in simple_cache_init().\");\n\n        uint32_t ret;\n        char *index_file_name, *data_file_name;\n        for ( i = 0; i < num_domains; ++i) {\n            ret = asprintf(&index_file_name, \"%s.idx\", file_names[i]);\n            ret = asprintf(&data_file_name, \"%s.dat\", file_names[i]);\n            sc->index_file_names[i] = index_file_name;\n            sc->data_file_names[i] = data_file_name;\n            // test to see if these files are in place\n            if( (access(index_file_name, F_OK) != -1 ) && \n                (access(data_file_name, F_OK) != -1) )\n                sc->dss[i] = disk_store_load(NULL,\n                                             index_file_name,\n                                             NULL,\n                                             data_file_name);\n            else \n                sc->dss[i] = NULL;\n                /*\n                sc->dss[i] = disk_store_init(size,\n                                             NULL,\n                                             index_file_name,\n                                             NULL,\n                                             data_file_name);\n                */\n        }\n    }\n\n    // set size\n    sc->sizes = (uint32_t *)calloc(num_domains, sizeof(uint32_t));\n    if (sc->sizes == NULL)\n        err(1, \"calloc error in simple_cache_init().\");\n\n    for ( i = 0; i < num_domains; ++i) {\n        sc->sizes[i] = size;\n        sc->nums[i] = 0;\n        sc->seens[i] = 0;\n\n        if ((sc->dss != NULL) && (sc->dss[i] != NULL)) {\n            sc->nums[i] = sc->dss[i]->num;\n            sc->seens[i] = sc->dss[i]->num;\n\n            while (sc->sizes[i] < sc->dss[i]->num)\n                sc->sizes[i] = sc->sizes[i] * 2;\n        }\n\n        //sc->ils[i] = indexed_list_init(sc->sizes[i],\n                                       //sizeof(struct value_cache_handler_pair));\n        uint64_t max_bytes = 10000000000; // 10GB\n        sc->hashls[i] = hash_list_init();\n    }\n\n    return sc;\n}\n//}}}\n\n//{{{uint32_t simple_cache_seen(void *_sc)\nuint32_t simple_cache_seen(uint32_t domain)\n{\n    if (_cache[CACHE_NAME_SPACE] == NULL)\n        errx(1, \"Cache has not been initialized.\");\n\n    struct simple_cache *sc = (struct simple_cache *)_cache[CACHE_NAME_SPACE];\n    return sc->seens[domain];\n}\n//}}}\n\n//{{{void simple_cache_add(void *_sc,\nvoid simple_cache_add(uint32_t domain,\n                      uint32_t key,\n                      void *value,\n                      uint64_t value_size,\n                      struct cache_handler *handler)\n{\n    if (_cache[CACHE_NAME_SPACE] == NULL)\n        errx(1, \"Cache has not been initialized.\");\n    struct simple_cache *sc = (struct simple_cache *)_cache[CACHE_NAME_SPACE];\n\n    while (sc->max_bytes < sc->curr_bytes + value_size) {\n        struct lru_ll_element *lru_curr = sc->lru_head;\n\n        if (lru_curr == NULL)\n            errx(1, \"Not enough memory to load current element into cache.\");\n\n        struct value_cache_handler_pair *vh_curr = \n                (struct value_cache_handler_pair *)\n                hash_list_remove(sc->hashls[lru_curr->domain], lru_curr->key);\n\n#ifdef DEBUG_CACHE\n    fprintf(stderr,\n            \"simple_cache_add: remove element from cache domain:%u key:%u\\n\",\n            lru_curr->domain,\n            lru_curr->key);\n#endif\n\n        if (vh_curr != NULL) {\n            if ((vh_curr->handler != NULL) && \n                (vh_curr->handler->free_mem != NULL))\n                vh_curr->handler->free_mem(&(vh_curr->value));\n\n            free(vh_curr);\n        }\n\n        sc->curr_bytes -= lru_curr->size;\n\n        sc->lru_head = lru_curr->next;\n        free(lru_curr);\n    }\n\n    struct value_cache_handler_pair vh;\n    vh.value = value;\n    vh.handler = handler;\n    vh.lru_node = (struct lru_ll_element *)\n            malloc(sizeof(struct lru_ll_element));\n    vh.lru_node->domain = domain;\n    vh.lru_node->key = key;\n    vh.lru_node->size = value_size;\n    vh.lru_node->prev = NULL;\n    vh.lru_node->next = NULL;\n\n    if (sc->lru_head == NULL) {\n        sc->lru_head = vh.lru_node;\n        sc->lru_tail = vh.lru_node;\n    } else {\n        sc->lru_tail->next = vh.lru_node;\n        vh.lru_node->prev = sc->lru_tail;\n        sc->lru_tail = vh.lru_node;\n    }\n\n    //indexed_list_add(sc->ils[domain], key, &vh);\n    hash_list_add(sc->hashls[domain],\n                  key,\n                  &vh,\n                  sizeof(struct value_cache_handler_pair));\n    sc->nums[domain] += 1;\n    sc->seens[domain] += 1;\n}\n//}}}\n\n//{{{void *simple_cache_get(void *_sc, uint32_t key)\nvoid *simple_cache_get(uint32_t domain,\n                       uint32_t key,\n                       struct cache_handler *handler)\n{\n    if (_cache[CACHE_NAME_SPACE] == NULL)\n        errx(1, \"Cache has not been initialized.\");\n    struct simple_cache *sc = (struct simple_cache *)_cache[CACHE_NAME_SPACE];\n    //struct value_cache_handler_pair *vh = indexed_list_get(sc->ils[domain],\n                                                           //key);\n    struct value_cache_handler_pair *vh = hash_list_get(sc->hashls[domain],\n                                                       key);\n\n    if (vh == NULL) {\n#ifdef DEBUG_CACHE\n    fprintf(stderr,\n            \"simple_cache_get: is not in cache domain:%u key:%u\\n\",\n            domain,\n            key);\n#endif\n\n        (void) pthread_mutex_lock (&(sc->mutex));\n        //vh = indexed_list_get(sc->ils[domain],\n                              //key);\n        /*\n        vh = hash_list_get(sc->hashls[domain],\n                          key);\n        if (vh != NULL) {\n            (void) pthread_mutex_unlock (&(sc->mutex));\n            return vh->value;\n        }\n        */\n\n        if ((sc->dss != NULL) && (sc->dss[domain] != NULL)) {\n            uint64_t size;\n            void *raw = disk_store_get(sc->dss[domain], key, &size);\n            if (raw == NULL)\n                return NULL;\n\n            sc->curr_bytes += size;\n\n            void *v;\n            uint64_t deserialized_size = handler->deserialize(raw,\n                                                              size,\n                                                              &v);\n\n            simple_cache_add(domain, key, v, size, handler);\n            free(raw);\n            (void) pthread_mutex_unlock (&(sc->mutex));\n            return v;\n        } else {\n            (void) pthread_mutex_unlock (&(sc->mutex));\n            return NULL;\n        }\n#ifdef DEBUG_CACHE\n    fprintf(stderr,\n            \"simple_cache_get: added to cache\\n\");\n#endif\n\n    } else { \n#ifdef DEBUG_CACHE\n    fprintf(stderr,\n            \"simple_cache_get: is in cache domain:%u key:%u\\n\",\n            domain,\n            key);\n#endif\n        // move this to the tail\n        if (sc->lru_tail != vh->lru_node) {\n            // take out of the list\n            if (sc->lru_head == vh->lru_node) {\n                sc->lru_head = vh->lru_node->next;\n            } else {\n                vh->lru_node->next->prev = vh->lru_node->prev;\n                vh->lru_node->prev->next = vh->lru_node->next;\n            }\n\n            vh->lru_node->prev = sc->lru_tail;\n            sc->lru_tail->next = vh->lru_node;\n            sc->lru_tail = vh->lru_node;\n            sc->lru_tail->next = NULL;\n        }\n\n#ifdef DEBUG_CACHE\n    fprintf(stderr,\n            \"simple_cache_get: LRU updatd\\n\");\n#endif\n        return vh->value;\n    }\n}\n//}}}\n\n//{{{void simple_cache_destroy()\nvoid simple_cache_destroy()\n{\n    if (_cache[CACHE_NAME_SPACE] == NULL)\n        errx(1, \"Cache has not been initialized.\");\n    struct simple_cache *sc = (struct simple_cache *)_cache[CACHE_NAME_SPACE];\n\n    (void) pthread_mutex_destroy (&(sc->mutex));\n\n    uint32_t i,j;\n\n    for (i = 0; i < sc->num_domains; ++i) {\n#if 0\n        for (j = 0; j <= sc->seens[i]; ++j) {\n            //struct value_cache_handler_pair *vh =\n                    //indexed_list_get(sc->ils[i], j);\n            struct value_cache_handler_pair *vh =\n                    lru_list_get(sc->lruls[i],\n                                 j);\n            if (vh != NULL) {\n                if ((vh->handler != NULL) && (vh->handler->free_mem != NULL))\n                    vh->handler->free_mem(&(vh->value));\n            }\n        }\n#endif\n        hash_list_value_cache_handler_pair_destroy(&(sc->hashls[i]));\n\n        if (sc->data_file_names != NULL)\n            free(sc->data_file_names[i]);\n\n        if (sc->index_file_names != NULL)\n            free(sc->index_file_names[i]);\n\n        //indexed_list_destroy(&(sc->ils[i]));\n    }\n\n    if (sc->data_file_names != NULL)\n        free(sc->data_file_names);\n    if (sc->index_file_names != NULL)\n        free(sc->index_file_names);\n\n    //free(sc->ils);\n    free(sc->hashls);\n    free(sc->nums);\n    free(sc->seens);\n    if ( sc->dss != NULL) {\n        for (i = 0; i < sc->num_domains; ++i)\n            if ( sc->dss[i] != NULL) \n                disk_store_destroy(&(sc->dss[i]));\n        free(sc->dss);\n    }\n    free(sc->sizes);\n\n\n    struct lru_ll_element *lru_tmp, *lru_curr = sc->lru_head;\n    while (lru_curr != NULL) {\n        lru_tmp = lru_curr->next;\n        free(lru_curr);\n        lru_curr = lru_tmp;\n    }\n\n    free(sc);\n    _cache[CACHE_NAME_SPACE] = NULL;\n}\n//}}}\n\n//{{{void simple_cache_store(uint32_t domain,\nvoid simple_cache_store(uint32_t domain,\n                        uint32_t *disk_id_order)\n{\n    if (_cache[CACHE_NAME_SPACE] == NULL)\n        errx(1, \"Cache has not been initialized.\");\n    struct simple_cache *sc = (struct simple_cache *)_cache[CACHE_NAME_SPACE];\n\n    if (sc->dss[domain] != NULL)\n        errx(1, \"Modifying and existing bpt is not currently supported.\");\n\n    /*\n    fprintf(stderr, \"%s %s\\n\", \n                                      sc->index_file_names[domain],\n                                      sc->data_file_names[domain]);\n    */\n    sc->dss[domain] = disk_store_init(sc->seens[domain],\n                                      NULL,\n                                      sc->index_file_names[domain],\n                                      NULL,\n                                      sc->data_file_names[domain]);\n\n    struct value_cache_handler_pair *vh;\n    uint32_t mem_i, disk_i, ds_id;\n    uint64_t serialized_size;\n    void *v;\n    for (disk_i = 0 ; disk_i < sc->seens[domain]; ++disk_i) {\n\n        if (disk_id_order != NULL)\n            mem_i = disk_id_order[disk_i];\n        else\n            mem_i = disk_i;\n\n        //FIXME\n        //vh = indexed_list_get(sc->ils[domain], mem_i);\n        vh = hash_list_get(sc->hashls[domain], mem_i);\n        if (vh == NULL)\n            errx(1, \"Value missing from cache.\");\n\n        if ((vh->handler == NULL) || (vh->handler->serialize == NULL))\n            errx(1, \"Cannot serialize given data without a valid handler.\");\n\n        serialized_size = vh->handler->serialize(vh->value,\n                                                          &v);\n        ds_id = disk_store_append(sc->dss[domain], v, serialized_size);\n\n        if (disk_i != ds_id)\n            errx(1, \"Cache and disk are out of sync\");\n        free(v);\n    }\n}\n//}}}\n//}}}\n\n//{{{void free_wrapper(void **v)\nvoid free_wrapper(void **v)\n{\n    free(*v);\n    *v = NULL;\n}\n//}}}\n\n#if 0\n//{{{ cc_hash\n\nuint32_t hash_A(uint32_t x, uint32_t limit)\n{\n    x = x ^ (x>>4);\n    x = (x^0xdeadbeef) + (x<<5);\n    x = x ^ (x>>11);\n    return x % limit;\n}\n\nuint32_t hash_B( uint32_t x, uint32_t limit)\n{\n    x = (x+0x7ed55d16) + (x<<12);\n    x = (x^0xc761c23c) ^ (x>>19);\n    x = (x+0x165667b1) + (x<<5);\n    x = (x+0xd3a2646c) ^ (x<<9);\n    x = (x+0xfd7046c5) + (x<<3);\n    x = (x^0xb55a4f09) ^ (x>>16);\n    return x % limit;\n}\n\nstruct cc_hash *cc_hash_init(uint32_t size)\n{\n    struct cc_hash *hash = (struct cc_hash *)malloc(sizeof(struct cc_hash));\n    hash->num = 0;\n    hash->sizes = size / 2;\n    hash->keys[0] = (uint32_t *) calloc(hash->sizes, sizeof(uint32_t));\n    hash->keys[1] = (uint32_t *) calloc(hash->sizes, sizeof(uint32_t));\n    hash->values[0] = (void **) calloc(hash->sizes, sizeof(void *));\n    hash->values[1] = (void **) calloc(hash->sizes, sizeof(void *));\n    \n    hash->hashes[0] = hash_A;\n    hash->hashes[1] = hash_B;\n\n    return hash;\n}\n\nint cc_hash_add(struct cc_hash *hash, uint32_t key, void *value)\n{\n    uint32_t pos_0 = hash->hashes[0](key, hash->sizes);\n    uint32_t pos_1 = hash->hashes[1](key, hash->sizes);\n\n    if ( (hash->keys[0][pos_0] == key) || (hash->keys[1][pos_1] == key))\n        return 1;\n\n    uint32_t h_i = 0;\n    uint32_t i, pos_i;\n\n    for (i = 0; i < hash->sizes; ++i) {\n        pos_i = hash->hashes[h_i](key, hash->sizes);\n        if ( hash->values[h_i][pos_i] == NULL ) {\n            hash->keys[h_i][pos_i] = key;\n            hash->values[h_i][pos_i] = value;\n            return 0;\n        } else {\n            uint32_t t_key = hash->keys[h_i][pos_i];\n            void *t_value = hash->values[h_i][pos_i];\n    \n            hash->keys[h_i][pos_i] = key;\n            hash->values[h_i][pos_i] = value;\n    \n            key = t_key;\n            value = t_value;\n            h_i = (h_i + 1) % 2;\n        }\n    }\n\n    errx(1, \"Could not place item\\n\");\n}\n\nvoid *cc_hash_get(struct cc_hash *hash, uint32_t key)\n{\n    uint32_t i, pos_i;\n    for (i = 0; i < 2; ++i) {\n        pos_i = hash->hashes[i](key, hash->sizes);\n        if ((hash->keys[i][pos_i] == key) && (hash->values[i][pos_i] != NULL))\n            return hash->values[i][pos_i];\n    }\n\n    return NULL;\n}\n\nvoid *cc_hash_remove(struct cc_hash *hash, uint32_t key)\n{\n    uint32_t i, pos_i;\n    for (i = 0; i < 2; ++i) {\n        pos_i = hash->hashes[i](key, hash->sizes);\n        if ((hash->keys[i][pos_i] == key) && \n            (hash->values[i][pos_i] != NULL)) {\n            void *r = hash->values[i][pos_i];\n            hash->values[i][pos_i] = NULL;\n            return r;\n        }\n    }\n\n    return NULL;\n}\n\nvoid cc_hash_destroy(struct cc_hash **hash)\n{\n    free((*hash)->keys[0]);\n    free((*hash)->keys[1]);\n    free((*hash)->values[0]);\n    free((*hash)->values[1]);\n    free(*hash);\n    *hash = NULL;\n}\n//}}}\n\n//{{{ lru_cache\n#if 0\nstruct cache_def lru_cache_def = {\n    NULL,\n    lru_cache_init,\n    lru_cache_seen,\n    lru_cache_add,\n    lru_cache_get,\n    lru_cache_remove,\n    lru_cache_destroy\n};\n\n//{{{struct lru_cache *lru_cache_init(uint32_t init_size)\nvoid *lru_cache_init(uint32_t init_size, FILE *fp)\n{\n    struct lru_cache *lruc = (struct lru_cache *)\n            malloc(sizeof(struct lru_cache));\n    lruc->size = init_size;\n    lruc->num = 0;\n    lruc->seen = 0;\n    lruc->hash_table = cc_hash_init(init_size * 2.5);\n    lruc->head = NULL;\n    lruc->tail = NULL;\n    return lruc;\n}\n//}}}\n\n//{{{uint32_t lru_cache_seen(struct lru_cache *lruc)\n//uint32_t lru_cache_seen(struct lru_cache *lruc)\nuint32_t lru_cache_seen(void *_lruc)\n{\n    struct lru_cache *lruc = (struct lru_cache *)_lruc;\n    return lruc->seen;\n}\n//}}}\n\n//{{{void lru_cache_add(struct lru_cache *lruc, uint32_t key, void *value)\nvoid lru_cache_add(void *_lruc,\n                   uint32_t key,\n                   void *value,\n                   void (*free_value)(void **data))\n{\n    struct lru_cache *lruc = (struct lru_cache *)_lruc;\n    if (cc_hash_get(lruc->hash_table, key) != NULL)\n        return;\n\n    if (lruc->num == lruc->size) {\n        // the head node is the lru\n        struct linked_list_node *to_rem_l = lruc->head;\n        lruc->head = to_rem_l->next;\n        lruc->head->prev = NULL;\n\n        struct linked_list_node *to_rem_h = \n                (struct linked_list_node *)\n                cc_hash_remove(lruc->hash_table, to_rem_l->key);\n\n        if (to_rem_h != to_rem_l)\n            errx(1, \"Inconsistency in LRU cache\");\n\n        if (to_rem_l->free_value != NULL)\n            to_rem_l->free_value(&(to_rem_l->value));\n\n        free(to_rem_l);\n        lruc->num -= 1;\n    }\n\n    struct linked_list_node *ll = (struct linked_list_node *)\n            malloc(sizeof(struct linked_list_node));\n    ll->key = key;\n    ll->free_value = free_value;\n    ll->prev = NULL;\n    ll->next = NULL;\n    ll->value = value;\n\n    if (lruc->head == NULL) {\n        lruc->head = ll;\n    } else {\n        ll->prev = lruc->tail;\n        lruc->tail->next = ll;\n    }\n\n    lruc->tail = ll;\n\n    int r = cc_hash_add(lruc->hash_table, key, ll);\n\n    lruc->num += 1;\n    lruc->seen += 1;\n}\n//}}}\n\n//{{{void *lru_cache_get(struct lru_cache *lruc, uint32_t key)\nvoid *lru_cache_get(void *_lruc, uint32_t key)\n{\n    struct lru_cache *lruc = (struct lru_cache *)_lruc;\n    struct linked_list_node *ll =\n        (struct linked_list_node *) cc_hash_get(lruc->hash_table, key);\n\n    if (ll == NULL)\n        return NULL;\n\n    // move this to the tail\n    if (lruc->tail != ll) {\n\n        // take ll out of the list\n        if (lruc->head == ll) \n            lruc->head = ll->next;\n        else {\n            ll->next->prev = ll->prev;\n            ll->prev->next = ll->next;\n        }\n\n        ll->prev = lruc->tail;\n        lruc->tail->next = ll;\n        lruc->tail = ll;\n        lruc->tail->next = NULL;\n    }\n        \n    return ll->value;\n}\n//}}}\n\n//{{{void lru_cache_remove(struct lru_cache *lruc, uint32_t key)\nvoid lru_cache_remove(void *_lruc, uint32_t key)\n{\n    struct lru_cache *lruc = (struct lru_cache *)_lruc;\n    struct linked_list_node *to_rem = \n                (struct linked_list_node *)\n                cc_hash_remove(lruc->hash_table, key);\n\n    if (to_rem == NULL)\n        return;\n\n    // Take it out of the list\n    if (to_rem == lruc->head) {\n        lruc->head = NULL;\n        lruc->tail = NULL;\n    } else if (to_rem == lruc->tail) {\n        lruc->tail->prev->next = NULL;\n        lruc->tail = lruc->tail->prev;\n    } else {\n        to_rem->prev->next = to_rem->next;\n    }\n\n\n    if (to_rem->free_value != NULL)\n        to_rem->free_value(&(to_rem->value));\n\n    free(to_rem);\n    lruc->num -= 1;\n}\n//}}}\n\n//{{{void lru_cache_destroy(struct lru_cache **lruc)\nvoid lru_cache_destroy(void **_lruc)\n{\n    struct lru_cache **lruc = (struct lru_cache **)_lruc;\n    cc_hash_destroy(&((*lruc)->hash_table));\n\n    struct linked_list_node *curr, *tmp;\n    curr = (*lruc)->head;\n\n    while (curr != NULL) {\n        tmp = curr->next;;\n        /*\n        if ( (*lruc)->free_value != NULL)\n            (*lruc)->free_value(&(curr->value));\n        */\n        if (curr->free_value != NULL)\n            curr->free_value(&(curr->value));\n        free(curr);\n        curr = tmp;\n    }\n    free(*lruc);\n    *lruc = NULL;\n}\n//}}}\n#endif\n//}}}\n#endif\n"
  },
  {
    "path": "src/cache.h",
    "content": "#ifndef __CACHE_H__\n#define __CACHE_H__\n\n#include <stdint.h>\n#include <pthread.h>\n#include <htslib/khash.h>\n#include \"disk_store.h\"\n#include \"lists.h\"\n\n\nstruct cache_handler\n{\n    uint64_t (*serialize)(void *deserialized, void **serialized);\n    uint64_t (*deserialize)(void *serialized,\n                            uint64_t serialized_size,\n                            void **deserialized);\n    void (*free_mem)(void **deserialized);\n};\n\nstruct cache_handler uint32_t_cache_handler;\nuint64_t uint32_t_serialize(void *deserialized, void **serialized);\nuint64_t uint32_t_deserialize(void *serialized,\n                             uint64_t serialized_size,\n                             void **deserialized);\nvoid uint32_t_free_mem(void **deserialized);\n\nstruct cache_def {\n    void *(*init)(uint32_t size,\n                  uint32_t num_domains,\n                  char **file_names);\n    uint32_t (*seen)(uint32_t domain);\n    void (*add)(uint32_t domain,\n                uint32_t key,\n                void *data,\n                uint64_t data_size,\n                struct cache_handler *handler);\n    void *(*get)(uint32_t domain,\n                 uint32_t key,\n                 struct cache_handler *handler);\n    void (*store)(uint32_t domain,\n                  uint32_t *disk_id_order);\n    void (*remove)(uint32_t domain, uint32_t key);\n    void (*destroy)();\n};\n\nstruct cache_def cache;\n\n//void *_cache;\nvoid *_cache[10];\nuint32_t CACHE_NAME_SPACE;\n\nstruct value_cache_handler_pair\n{\n    void *value;\n    struct cache_handler *handler;\n    struct lru_ll_element *lru_node;\n};\n\nstruct cache_def simple_cache_def;\n\nstruct lru_ll_element\n{\n    uint32_t domain, key;\n    uint64_t size;\n    struct lru_ll_element *prev, *next;\n};\n\nstruct simple_cache\n{\n    struct indexed_list **ils;\n    struct hash_list **hashls;\n    uint32_t *sizes, *nums, *seens, num_domains;\n    char **index_file_names, **data_file_names;\n    struct disk_store **dss;\n    pthread_mutex_t mutex;\n\n    struct lru_ll_element *lru_head, *lru_tail;\n    uint64_t max_bytes, curr_bytes;\n    uint32_t dirty;\n};\n\nvoid *simple_cache_init(uint32_t size,\n                        uint32_t num_domains,\n                        char **file_names);\nuint32_t simple_cache_seen(uint32_t domain);\nvoid *simple_cache_get(uint32_t domain,\n                       uint32_t key,\n                       struct cache_handler *handler);\nvoid simple_cache_remove(uint32_t key);\nvoid simple_cache_add(uint32_t domain,\n                      uint32_t key,\n                      void *value,\n                      uint64_t value_size,\n                      struct cache_handler *handler);\nvoid simple_cache_store(uint32_t domain,\n                        uint32_t *disk_id_order);\nvoid simple_cache_destroy();\n\nvoid free_wrapper(void **v);\n\n\n#if 0\nstruct cc_hash\n{\n    uint32_t num, sizes, *keys[2];\n    void **values[2];\n    uint32_t (*hashes[2])(uint32_t x, uint32_t limit);\n};\n\nuint32_t hash_A(uint32_t x, uint32_t limit);\nuint32_t hash_B(uint32_t x, uint32_t limit);\n\nstruct cc_hash *cc_hash_init(uint32_t size);\nint cc_hash_add(struct cc_hash *hash, uint32_t key, void *value);\nvoid *cc_hash_get(struct cc_hash *hash, uint32_t key);\nvoid *cc_hash_remove(struct cc_hash *hash, uint32_t key);\nvoid cc_hash_destroy(struct cc_hash **hash);\n\nstruct linked_list_node\n{\n    void *value; \n    uint32_t key;\n    struct linked_list_node *prev, *next;\n    void (*free_value)(void **data);\n};\n\nstruct lru_cache\n{\n    struct cc_hash *hash_table;\n    struct linked_list_node *head, *tail;\n    uint32_t size, num, seen;\n};\n\nvoid *lru_cache_init(uint32_t init_size, FILE *fp);\nuint32_t lru_cache_seen(void *lruc); \nvoid *lru_cache_get(void *cache, uint32_t key);\nvoid lru_cache_remove(void *cache, uint32_t key);\nvoid lru_cache_add(void *cache,\n                   uint32_t key,\n                   void *value,\n                   void (*free_value)(void **data));\nvoid lru_cache_destroy(void **lruc);\n\nstruct cache_def lru_cache_def;\n#endif\n#endif\n"
  },
  {
    "path": "src/data_reg.c",
    "content": "#include <stdlib.h>\n#include <stdio.h>\n#include <stdint.h>\n#include <err.h>\n\n#include \"data_reg.h\"\n\n//{{{struct data_reg *data_reg_init(uint32_t init_size)\nstruct data_reg *data_reg_init(uint32_t init_size)\n{\n    struct data_reg *dr = (struct data_reg *)malloc(sizeof(struct data_reg));\n    if (dr == NULL)\n        err(1, \"malloc error in data_reg_init().\");\n    dr->num_data = 0;\n    dr->data_size = init_size;\n\n    dr->data = (void **) malloc(init_size * sizeof(void *));\n    if (dr->data == NULL)\n        err(1, \"malloc error in data_reg_init().\");\n\n    return dr;\n}\n//}}}\n\n//{{{void data_reg_destroy(struct data_reg **dr)\nvoid data_reg_destroy(struct data_reg **dr)\n{\n    free((*dr)->data);\n    (*dr)->data = NULL;\n\n    free(*dr);\n    *dr = NULL;\n}\n//}}}\n\n//{{{uint32_t data_reg_add(struct data_reg *dr,\nuint32_t data_reg_add(struct data_reg *dr,\n                      void *data)\n{\n    uint32_t id = dr->num_data;\n\n    dr->num_data = dr->num_data + 1;\n\n    // check to see if there is enough space, if not grow by double\n    if ( dr->data_size == dr->num_data ) {\n        dr->data_size = dr->data_size * 2;\n        dr->data = (void *)realloc(dr->data, \n                                   dr->data_size * sizeof(void *));\n        if (dr->data == NULL)\n            err(1, \"malloc error in data_reg_add().\");\n    }\n\n    dr->data[id] = data;\n    \n    return id;\n}\n//}}}\n\n//{{{void *data_reg_get(struct data_reg *dr, uint32_t i)\nvoid *data_reg_get(struct data_reg *dr, uint32_t i)\n{\n    if (i > dr->num_data)\n        return NULL;\n\n    return dr->data[i];\n}\n//}}}\n"
  },
  {
    "path": "src/data_reg.h",
    "content": "#ifndef __DATA_REG__\n#define __DATA_REG__\n\n#include <stdint.h>\n\nstruct data_reg\n{\n    void **data;\n    uint32_t num_data, data_size;\n};\n\nstruct data_reg *data_reg_init(uint32_t init_size);\n\nvoid data_reg_destroy(struct data_reg **dr);\n\nuint32_t data_reg_add(struct data_reg *dr,\n                      void *data);\n\nvoid *data_reg_get(struct data_reg *dr, uint32_t i);\n\n//data_reg_save\n\n//data_reg_open\n\n//data_reg_sort\n\n#endif\n"
  },
  {
    "path": "src/disk_file_header.c",
    "content": "#define _GNU_SOURCE\n\n#include <stdlib.h>\n#include <string.h>\n#include <err.h>\n#include \"util.h\"\n#include \"disk_file_header.h\"\n#include \"zlib_wrapper.h\"\n#include \"fastlz_wrapper.h\"\n\nvoid set_compression_function_pointers(struct disk_file_header *h) {\n    switch (h->compression_method) {\n        case 'z':\n            h->compress = zlib_compress;\n            h->uncompress = zlib_uncompress;\n            break;\n        case 'f':\n            h->compress = fastlz_wrapper_compress;\n            h->uncompress = fastlz_wrapper_uncompress;\n            break;\n    }\n}\n\nstruct disk_file_header *new_disk_file_header(uint8_t compression_method, uint8_t compression_level) {\n    \n    struct disk_file_header *h = (struct disk_file_header *) \n            calloc(1, sizeof(struct disk_file_header));\n    if (h == NULL)\n        err(1, \"calloc error in new_disk_file_header().\");\n\n    h->compression_method = compression_method;\n    h->compression_level = compression_level;\n    set_compression_function_pointers(h);\n    return h;\n}\n\nvoid write_disk_file_header(char *file_marker, struct disk_file_header *h, FILE *fp, char *file_name) {\n    if (fwrite(file_marker, sizeof(char), GIGGLE_FILE_MARKER_LENGTH, fp) != GIGGLE_FILE_MARKER_LENGTH)\n        err(1, \"Could not write file_marker to '%s'.\", file_name);\n\n    if (fwrite(&(h->compression_method), sizeof(uint8_t), 1, fp) != 1)\n        err(1, \"Could not write compression_method to '%s'.\", file_name);\n\n    if (fwrite(&(h->compression_level), sizeof(uint8_t), 1, fp) != 1)\n        err(1, \"Could not write compression_level to '%s'.\", file_name);\n\n    if (fwrite(&(h->extra), sizeof(uint8_t), 1, fp) != 1)\n        err(1, \"Could not write extra to '%s'.\", file_name);\n}\n\nstruct disk_file_header *read_disk_file_header(FILE *fp, char *file_name, char *expected_file_marker) {\n    char file_marker[GIGGLE_FILE_MARKER_LENGTH + 1];\n    size_t fr;\n\n    fr = fread(file_marker, sizeof(char), GIGGLE_FILE_MARKER_LENGTH, fp);\n    check_file_read(file_name, fp, GIGGLE_FILE_MARKER_LENGTH, fr);\n    file_marker[GIGGLE_FILE_MARKER_LENGTH] = '\\0';  // Null-terminate for strcmp\n    if (strcmp(file_marker,  expected_file_marker) != 0) {\n        fseek(fp, 0, SEEK_SET); // uncompressed file\n        return NULL;\n    }\n    \n    struct disk_file_header *h = (struct disk_file_header *) \n            calloc(1, sizeof(struct disk_file_header));\n    if (h == NULL)\n        err(1, \"calloc error in read_disk_file_header().\");\n\n    fr = fread(&(h->compression_method), sizeof(uint8_t), 1, fp);\n    check_file_read(file_name, fp, 1, fr);\n\n    fr = fread(&(h->compression_level), sizeof(uint8_t), 1, fp);\n    check_file_read(file_name, fp, 1, fr);\n\n    fr = fread(&(h->extra), sizeof(uint8_t), 1, fp);\n    check_file_read(file_name, fp, 1, fr);\n    \n    set_compression_function_pointers(h);\n    \n    return h;\n}\n"
  },
  {
    "path": "src/disk_file_header.h",
    "content": "#ifndef __DISK_FILE_HEADER_H__\n#define __DISK_FILE_HEADER_H__\n\n#include <stdint.h>\n#include <stdio.h>\n\n#define GIGGLE_FILE_MARKER_LENGTH 7\n#define GIGGLE_INDEX_FILE_MARKER \"GIGLIDX\"\n#define GIGGLE_DATA_FILE_MARKER \"GIGLDAT\"\ntypedef unsigned long  uLong;\n\nstruct disk_file_header {\n    uint8_t compression_method, compression_level, extra;\n    void* (*compress)(void *data, uLong uncompressed_size, int level, uLong *compressed_size); //!< Compress function pointer\n    void* (*uncompress)(void *compressed_data, uLong compressed_size, uLong uncompressed_size); //!< Uncompress function pointer\n};\n\n/**\n * @brief Set compression function pointers to the disk file header\n */\nvoid set_compression_function_pointers(struct disk_file_header *h);\n\n/**\n * @brief Create a new disk file header\n */\nstruct disk_file_header *new_disk_file_header(uint8_t compression_method, uint8_t compression_level);\n\n/**\n * @brief Write disk file header to file\n */\nvoid write_disk_file_header(char *file_marker, struct disk_file_header *h, FILE *fp, char *file_name);\n\n/**\n * @brief Read disk file header\n */\nstruct disk_file_header *read_disk_file_header(FILE *fp, char *file_name, char *expected_file_marker);\n\n#endif\n"
  },
  {
    "path": "src/disk_store.c",
    "content": "#define _GNU_SOURCE\n\n#include <stdlib.h>\n#include <string.h>\n#include <stdint.h>\n#include <stdio.h>\n#include <err.h>\n#include \"util.h\"\n#include \"disk_file_header.h\"\n#include \"disk_store.h\"\n\n#define DISK_LOG 0\n\n#if DISK_LOG\n#include <sys/time.h>\n#define DISK_LOG_FILENAME \"disk_zlib_log.csv\"\n#endif\n\nstruct disk_store *disk_store_init(uint32_t size,\n                                   FILE **index_fp,\n                                   char *index_file_name,\n                                   FILE **data_fp,\n                                   char *data_file_name)\n{\n    struct disk_store *ds =\n            (struct disk_store *)calloc(1, sizeof(struct disk_store));\n    if (ds == NULL)\n        err(1, \"calloc error in disk_store_init().\");\n\n    // Only for demo purposes, not to be pushed to production. Ideally accept as cmd arg\n    uint8_t compression_method = 'z';\n    uint8_t compression_level = 6;\n    if (compression_method) {\n        ds->is_compressed = true;\n        ds->file_header = new_disk_file_header(compression_method, compression_level);\n    } else {\n        ds->is_compressed = false;\n        ds->file_header = NULL;\n    }\n\n    ds->num = 0;\n    ds->size = size;\n    ds->index_file_name = strdup(index_file_name);\n    ds->data_file_name = strdup(data_file_name);\n    ds->offsets = (uint64_t *)calloc(size, sizeof(uint64_t));\n    if (ds->offsets == NULL)\n        err(1, \"calloc error in disk_store_init().\");\n    \n    if (ds->is_compressed) {\n        ds->uncompressed_sizes = (uint32_t *)calloc(size, sizeof(uint32_t));\n        if (ds->uncompressed_sizes == NULL)\n            err(1, \"calloc error in disk_store_init().\");\n    } else {\n        ds->uncompressed_sizes = NULL;\n    }\n\n    if ((index_fp == NULL) || (*index_fp == NULL)) {\n        ds->index_fp = fopen(index_file_name, \"wb\");\n        if (ds->index_fp == NULL)\n            err(1, \"Could not open index file '%s'.\", index_file_name);\n    } else {\n        ds->index_fp = *index_fp;\n    }\n\n    if (ds->is_compressed) {\n        write_disk_file_header(GIGGLE_INDEX_FILE_MARKER, ds->file_header, \n                               ds->index_fp, ds->index_file_name);\n    }\n    \n    ds->index_start_offset = ftell(ds->index_fp);\n\n    if (fwrite(&(ds->size), sizeof(uint32_t), 1, ds->index_fp) != 1)\n        err(1, \"Could not write size to '%s'.\", ds->index_file_name);\n\n    if (fwrite(&(ds->num), sizeof(uint32_t), 1, ds->index_fp) != 1)\n        err(1, \"Could not write num to '%s'.\", ds->index_file_name);\n\n    if ((data_fp == NULL) || (*data_fp == NULL)) {\n        ds->data_fp = fopen(data_file_name, \"wb\");\n        if (ds->data_fp == NULL)\n            err(1, \"Could not open data file '%s'.\", data_file_name);\n    } else {\n        ds->data_fp = *data_fp;\n    }\n\n    if (ds->is_compressed) {\n        write_disk_file_header(GIGGLE_DATA_FILE_MARKER, ds->file_header, \n                               ds->data_fp, ds->data_file_name);\n    }\n\n    ds->data_start_offset = ftell(ds->data_fp);\n\n    return ds;\n}\n//}}}\n\n//{{{ struct disk_store *disk_store_load(FILE **index_fp,\nstruct disk_store *disk_store_load(FILE **index_fp,\n                                   char *index_file_name,\n                                   FILE **data_fp,\n                                   char *data_file_name)\n{\n\n    struct disk_store *ds =\n            (struct disk_store *)calloc(1, sizeof(struct disk_store));\n    if (ds == NULL)\n        err(1, \"calloc error in disk_store_load().\");\n\n    ds->index_file_name = strdup(index_file_name);\n\n    if ((index_fp == NULL) || (*index_fp == NULL)) {\n        ds->index_fp = fopen(index_file_name, \"r+\");\n        if (ds->index_fp == NULL)\n            err(1, \"Could not open index_file '%s'.\", index_file_name);\n    } else {\n        ds->index_fp = *index_fp;\n    }\n    \n    struct disk_file_header *index_h = read_disk_file_header(ds->index_fp, \n                                                             ds->index_file_name, \n                                                             GIGGLE_INDEX_FILE_MARKER);\n    if (index_h == NULL) {\n        ds->is_compressed = false;\n        ds->file_header = NULL;\n    } else {\n        ds->is_compressed = true;\n        ds->file_header = index_h;\n    }\n\n    ds->index_start_offset = ftell(ds->index_fp);\n\n    size_t fr = fread(&(ds->size), sizeof(uint32_t), 1, ds->index_fp);\n    check_file_read(ds->index_file_name, ds->index_fp, 1, fr);\n\n    fr = fread(&(ds->num), sizeof(uint32_t), 1, ds->index_fp);\n    check_file_read(ds->index_file_name, ds->index_fp, 1, fr);\n\n    ds->offsets = (uint64_t *)calloc(ds->size, sizeof(uint64_t));\n    if (ds->offsets == NULL)\n        err(1, \"calloc error in disk_store_load().\");\n\n    fr = fread(ds->offsets, sizeof(uint64_t), ds->size, ds->index_fp);\n    check_file_read(ds->index_file_name, ds->index_fp, ds->size, fr);\n\n    if (ds->is_compressed) {\n        ds->uncompressed_sizes = (uint32_t *)calloc(ds->size, sizeof(uint32_t));\n        if (ds->uncompressed_sizes == NULL)\n            err(1, \"calloc error in disk_store_load().\");\n\n        fr = fread(ds->uncompressed_sizes, sizeof(uint32_t), ds->size, ds->index_fp);\n        check_file_read(ds->index_file_name, ds->index_fp, ds->size, fr);\n    } else {\n        ds->uncompressed_sizes = NULL;\n    }\n\n    ds->data_file_name = strdup(data_file_name);\n\n    if ((data_fp == NULL) || (*data_fp == NULL)) {\n        ds->data_fp = fopen(data_file_name, \"r+\");\n        if (ds->data_fp == NULL)\n            err(1, \"Could not open data file '%s'.\", data_file_name);\n    } else {\n        ds->data_fp = *data_fp;\n    }\n    \n    struct disk_file_header *data_h = read_disk_file_header(ds->data_fp,\n                                                            ds->data_file_name,\n                                                            GIGGLE_DATA_FILE_MARKER);\n    if (data_h == NULL) {\n        if (ds->file_header != NULL) {\n            err(1, \"Missing file header in data file '%s' when index file '%s' has file header.\", \n            data_file_name, index_file_name);\n        }\n    } else {\n        if (ds->file_header != NULL) {\n            if (data_h->compression_method != index_h->compression_method || \n                data_h->compression_level != index_h->compression_level ||\n                data_h->extra != index_h->extra) {\n                err(1, \"File header mismatch in data file '%s' and index file '%s'.\", \n                data_file_name, index_file_name);\n            }\n        }\n        free(data_h);\n    }\n\n    ds->data_start_offset = ftell(ds->data_fp);\n\n    return ds;\n}\n//}}}\n\n//{{{void disk_store_sync(struct disk_store *ds)\nvoid disk_store_sync(struct disk_store *ds)\n{\n    if (fseek(ds->index_fp, ds->index_start_offset, SEEK_SET) != 0)\n        err(1, \"Could not seek to index start in '%s'.\", ds->index_file_name);\n\n    if (fwrite(&(ds->size), sizeof(uint32_t), 1, ds->index_fp) != 1)\n        err(1, \"Could not write size to '%s'.\", ds->index_file_name);\n\n    if (fwrite(&(ds->num), sizeof(uint32_t), 1, ds->index_fp) != 1)\n        err(1, \"Could not write num to '%s'.\", ds->index_file_name);\n\n    if (fwrite(ds->offsets, sizeof(uint64_t), ds->size, ds->index_fp) != \n            ds->size)\n        err(1, \"Could not write offsets to '%s'.\", ds->index_file_name);\n\n    if (ds->is_compressed) {\n        if (fwrite(ds->uncompressed_sizes, sizeof(uint32_t), ds->size, ds->index_fp) != \n                ds->size)\n            err(1, \"Could not write uncompressed_sizes to '%s'.\", ds->index_file_name);\n    }\n}\n//}}}\n\n//{{{void disk_store_destroy(struct disk_store **ds)\nvoid disk_store_destroy(struct disk_store **ds)\n{\n    disk_store_sync(*ds);\n\n    free((*ds)->index_file_name);\n    free((*ds)->data_file_name);\n    free((*ds)->offsets);\n    if ((*ds)->is_compressed) {\n        free((*ds)->uncompressed_sizes);\n    }\n    if ((*ds)->index_fp != (*ds)->data_fp) {\n        fclose((*ds)->data_fp);\n        (*ds)->data_fp = NULL;\n    }\n\n    fclose((*ds)->index_fp);\n    (*ds)->index_fp = NULL;\n\n    if ((*ds)->file_header != NULL) {\n        free((*ds)->file_header);\n    }\n\n    free(*ds);\n    *ds = NULL;\n}\n//}}}\n\n//{{{uint32_t disk_store_append(struct disk_store *ds, void *data, uint64_t\nuint32_t disk_store_append(struct disk_store *ds, void *data, uint64_t size)\n{\n    //if (ds->num + 1 >= ds->size)\n    //if (ds->num  >= ds->size)\n        //errx(1, \"Disk store is full.\");\n    if (ds->num >= ds->size) {\n        uint32_t old_size = ds->size;\n        ds->size = ds->size * 2;\n        ds->offsets = (uint64_t *)realloc(ds->offsets,\n                                          ds->size * sizeof(uint64_t));\n        if (ds->offsets == NULL)\n            err(1, \"realloc error in disk_store_append().\");\n\n        memset(ds->offsets + old_size,\n               0,\n               old_size * sizeof(uint64_t));\n\n        if (ds->is_compressed) {\n            ds->uncompressed_sizes = (uint32_t *)realloc(ds->uncompressed_sizes,\n                                            ds->size * sizeof(uint32_t));\n            if (ds->uncompressed_sizes == NULL)\n                err(1, \"realloc error in disk_store_append().\");\n\n            memset(ds->uncompressed_sizes + old_size,\n                0,\n                old_size * sizeof(uint32_t));\n        }\n    }\n\n    if (fseek(ds->data_fp, 0, SEEK_END) != 0)\n        err(1,\n            \"Could not seek to the end to append in '%s'.\",\n            ds->data_file_name);\n\n    uint32_t curr_id = ds->num;\n    uint64_t curr_offset = ftell(ds->data_fp);\n\n    if ( ((curr_id == 0) && (curr_offset != ds->data_start_offset)) ||\n         ((curr_id > 0) && (curr_offset != ds->offsets[curr_id - 1])) )\n        err(1, \"Index and file '%s' are out of sync.\", ds->data_file_name);\n    \n    if (ds->is_compressed) {\n        uLong compressed_size;\n        // TODO: Typecasting uint64_t to uLong -> Potential integer overflow. Will crash if (uncompressed) size > 4GB\n        void *compressed_data = ds->file_header->compress(data, size, ds->file_header->compression_level, &compressed_size);\n        if (fwrite(compressed_data, compressed_size, 1, ds->data_fp) != 1)\n            err(1, \"Could not write data to '%s'.\", ds->data_file_name);\n    } else {\n        if (fwrite(data, size, 1, ds->data_fp) != 1)\n            err(1, \"Could not write data to '%s'.\", ds->data_file_name);\n    }\n\n    ds->offsets[curr_id] = ftell(ds->data_fp);\n\n    if (ds->is_compressed) {\n        ds->uncompressed_sizes[curr_id] = size;\n    }\n    ds->num += 1;\n\n    return curr_id; \n}\n//}}}\n\n//{{{void *disk_store_get(struct disk_store *ds, uint32_t id, uint64_t *size)\nvoid *disk_store_get(struct disk_store *ds, uint32_t id, uint64_t *size)\n{\n    if (id >= ds->num) {\n        *size = 0;\n        return NULL;\n    }\n\n#if DISK_LOG\n    FILE *fp = fopen(DISK_LOG_FILENAME, \"a\");\n    if (fp == NULL)\n        err(1, \"Could not open log file.\");\n\n    // start time\n    struct timeval begin, end;\n    gettimeofday(&begin, 0);\n#endif\n\n    uint64_t start_offset = ds->data_start_offset;\n    if (id > 0)\n        start_offset = ds->offsets[id - 1];\n    uint64_t end_offset = ds->offsets[id];\n\n    void *data;\n    uLong compressed_size = 0;\n    if (ds->is_compressed) {\n        compressed_size = end_offset - start_offset;\n        data = (void *) calloc(1, compressed_size);\n    } else {\n        *size = end_offset - start_offset;\n        data = (void *) calloc(1, *size);\n    }\n\n    if (data == NULL)\n        err(1, \"calloc error in disk_store_get().\");\n\n    if (fseek(ds->data_fp, start_offset, SEEK_SET) != 0)\n        err(1, \"Could not seek to data in '%s'.\", ds->data_file_name);\n\n    size_t fr;\n    if (ds->is_compressed) {\n        fr = fread(data, compressed_size, 1, ds->data_fp);\n    } else {\n        fr = fread(data, *size, 1, ds->data_fp);\n    }\n\n    check_file_read(ds->data_file_name, ds->data_fp, 1, fr);\n\n    void *uncompressed_data;\n    if (ds->is_compressed) {\n        uint32_t uncompressed_size = ds->uncompressed_sizes[id];\n        uncompressed_data = ds->file_header->uncompress(data, compressed_size, uncompressed_size);\n        *size = uncompressed_size;\n    }\n\n#if DISK_LOG\n    // end time\n    gettimeofday(&end, 0);\n    long seconds = end.tv_sec - begin.tv_sec;\n    long microseconds = end.tv_usec - begin.tv_usec;\n    long elapsed = seconds * 1e6 + microseconds;\n\n    if (ds->is_compressed) {\n        fprintf(fp, \"%u\\t%lu\\t%lu\\n\", uncompressed_size, compressed_size, elapsed);\n    } else {\n        fprintf(fp, \"%u\\t%lu\\n\", *size, elapsed);\n    }\n\n    fclose(fp);\n#endif\n\n    if (ds->is_compressed) {\n        return uncompressed_data;\n    } else {\n        return data;\n    }\n}\n"
  },
  {
    "path": "src/disk_store.h",
    "content": "#ifndef __DISK_STORE_H__\n#define __DISK_STORE_H__\n\n#include <stdint.h>\n#include <stdio.h>\n\n/**\n * @brief The interface to on-disk storage\n *\n * \n * Files are stored using two data structures. Serialized data elements are\n * stored sequentially in the data_file (*.dat) and offsets is an array of\n * the last offset for each stored element in the data file. The size of the\n * element and its start position can be inferred by the previous element in the\n * offset array.  The offset array is stored in the index_file (*.idx).\n *\n * index_file: \n *   file_header (might be absent):\n *                0-55 (7B) : GIGLIDX (File identifier/marker)\n *               56-63 (1B) : Compression Method\n *               64-71 (1B) : Compression Level\n *               72-79 (1B) : Extra\n *   data:\n *              80-111 (4B) : size\n *             112-143 (4B) : num\n *      144-... (8B * size) : offsets\n *      ...-... (8B * size) : uncompressed_sizes // if compression is used\n *\n * data_file:\n *   file_header (might be absent):\n *                 0-55 (7B) : GIGLDAT (File identifier/marker)\n *                56-63 (1B) : Compression Method\n *                64-71 (1B) : Flag\n *                72-79 (1B) : Extra\n *   data:\n *             80-offsets[0] : 1st element\n *     offsets[0]-offsets[1] : 2nd element\n *   ...\n *   offsets[i-1]-offsets[i] : nth element\n *   ...\n */\n\nstruct disk_store\n{\n    char *index_file_name; //!< Name of file containing offsets\n    char *data_file_name; //!< Name of file containing data\n    FILE *index_fp; //!< File pointer to the open handle containing offsets\n    FILE *data_fp; //!< File pointer to the open handle containing data\n    uint32_t size; //!< Amount of allocated space in offsets array\n    uint32_t num; //!< Number of elements stored\n    uint64_t index_start_offset; //!< End of header file position in offsets\n    uint64_t data_start_offset; //!< End of header file position in data\n    uint64_t *offsets; //!< Array of data end offsets stored on disk\n    uint32_t *uncompressed_sizes; //!< Array of uncompressed_sizes of data stored on disk\n    uint8_t is_compressed; //!< Is the data stored in data file compressed?\n    struct disk_file_header *file_header; //!< File header\n};\n\n/**\n * @brief Initialize a new disk store\n */\nstruct disk_store *disk_store_init(uint32_t size,\n                                   FILE **index_fp,\n                                   char *index_file_name,\n                                   FILE **data_fp,\n                                   char *data_file_name);\n\n/**\n * @brief Open an existing disk store\n */\nstruct disk_store *disk_store_load(FILE **index_fp,\n                                   char *index_file_name,\n                                   FILE **data_fp,\n                                   char *data_file_name);\n/*\n * @brief Write the offsets file to disk\n */\nvoid disk_store_sync(struct disk_store *ds);\n\n/**\n * @brief Free up memory associated with the disk store\n */\nvoid disk_store_destroy(struct disk_store **ds);\n\n/**\n * @brief Add new elements to the store.\n *\n * This writes the element to disk and updates the in-memory version of\n * offsets, but does not write offsets to disk. disk_store_sync MUST be called\n * to save any changes.\n */\nuint32_t disk_store_append(struct disk_store *ds, void *data, uint64_t size);\n\n/**\n * @brief Get serialized elements stored in the store.\n */\nvoid *disk_store_get(struct disk_store *ds, uint32_t id, uint64_t *size);\n\n#endif\n"
  },
  {
    "path": "src/fastlz.c",
    "content": "/*  \n  FastLZ - lightning-fast lossless compression library\n\n  Copyright (C) 2007 Ariya Hidayat (ariya@kde.org)\n  Copyright (C) 2006 Ariya Hidayat (ariya@kde.org)\n  Copyright (C) 2005 Ariya Hidayat (ariya@kde.org)\n\n  Permission is hereby granted, free of charge, to any person obtaining a copy\n  of this software and associated documentation files (the \"Software\"), to deal\n  in the Software without restriction, including without limitation the rights\n  to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n  copies of the Software, and to permit persons to whom the Software is\n  furnished to do so, subject to the following conditions:\n\n  The above copyright notice and this permission notice shall be included in\n  all copies or substantial portions of the Software.\n\n  THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n  IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n  FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n  AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n  LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n  OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN\n  THE SOFTWARE.\n*/\n\n#if !defined(FASTLZ__COMPRESSOR) && !defined(FASTLZ_DECOMPRESSOR)\n\n/*\n * Always check for bound when decompressing.\n * Generally it is best to leave it defined.\n */\n#define FASTLZ_SAFE\n\n/*\n * Give hints to the compiler for branch prediction optimization.\n */\n#if defined(__GNUC__) && (__GNUC__ > 2)\n#define FASTLZ_EXPECT_CONDITIONAL(c)    (__builtin_expect((c), 1))\n#define FASTLZ_UNEXPECT_CONDITIONAL(c)  (__builtin_expect((c), 0))\n#else\n#define FASTLZ_EXPECT_CONDITIONAL(c)    (c)\n#define FASTLZ_UNEXPECT_CONDITIONAL(c)  (c)\n#endif\n\n/*\n * Use inlined functions for supported systems.\n */\n#if defined(__GNUC__) || defined(__DMC__) || defined(__POCC__) || defined(__WATCOMC__) || defined(__SUNPRO_C)\n#define FASTLZ_INLINE inline\n#elif defined(__BORLANDC__) || defined(_MSC_VER) || defined(__LCC__)\n#define FASTLZ_INLINE __inline\n#else \n#define FASTLZ_INLINE\n#endif\n\n/*\n * Prevent accessing more than 8-bit at once, except on x86 architectures.\n */\n#if !defined(FASTLZ_STRICT_ALIGN)\n#define FASTLZ_STRICT_ALIGN\n#if defined(__i386__) || defined(__386)  /* GNU C, Sun Studio */\n#undef FASTLZ_STRICT_ALIGN\n#elif defined(__i486__) || defined(__i586__) || defined(__i686__) /* GNU C */\n#undef FASTLZ_STRICT_ALIGN\n#elif defined(_M_IX86) /* Intel, MSVC */\n#undef FASTLZ_STRICT_ALIGN\n#elif defined(__386)\n#undef FASTLZ_STRICT_ALIGN\n#elif defined(_X86_) /* MinGW */\n#undef FASTLZ_STRICT_ALIGN\n#elif defined(__I86__) /* Digital Mars */\n#undef FASTLZ_STRICT_ALIGN\n#endif\n#endif\n\n/*\n * FIXME: use preprocessor magic to set this on different platforms!\n */\ntypedef unsigned char  flzuint8;\ntypedef unsigned short flzuint16;\ntypedef unsigned int   flzuint32;\n\n/* prototypes */\nint fastlz_compress(const void* input, int length, void* output);\nint fastlz_compress_level(int level, const void* input, int length, void* output);\nint fastlz_decompress(const void* input, int length, void* output, int maxout);\n\n#define MAX_COPY       32\n#define MAX_LEN       264  /* 256 + 8 */\n#define MAX_DISTANCE 8192\n\n#if !defined(FASTLZ_STRICT_ALIGN)\n#define FASTLZ_READU16(p) *((const flzuint16*)(p)) \n#else\n#define FASTLZ_READU16(p) ((p)[0] | (p)[1]<<8)\n#endif\n\n#define HASH_LOG  13\n#define HASH_SIZE (1<< HASH_LOG)\n#define HASH_MASK  (HASH_SIZE-1)\n#define HASH_FUNCTION(v,p) { v = FASTLZ_READU16(p); v ^= FASTLZ_READU16(p+1)^(v>>(16-HASH_LOG));v &= HASH_MASK; }\n\n#undef FASTLZ_LEVEL\n#define FASTLZ_LEVEL 1\n\n#undef FASTLZ_COMPRESSOR\n#undef FASTLZ_DECOMPRESSOR\n#define FASTLZ_COMPRESSOR fastlz1_compress\n#define FASTLZ_DECOMPRESSOR fastlz1_decompress\nstatic FASTLZ_INLINE int FASTLZ_COMPRESSOR(const void* input, int length, void* output);\nstatic FASTLZ_INLINE int FASTLZ_DECOMPRESSOR(const void* input, int length, void* output, int maxout);\n#include \"fastlz.c\"\n\n#undef FASTLZ_LEVEL\n#define FASTLZ_LEVEL 2\n\n#undef MAX_DISTANCE\n#define MAX_DISTANCE 8191\n#define MAX_FARDISTANCE (65535+MAX_DISTANCE-1)\n\n#undef FASTLZ_COMPRESSOR\n#undef FASTLZ_DECOMPRESSOR\n#define FASTLZ_COMPRESSOR fastlz2_compress\n#define FASTLZ_DECOMPRESSOR fastlz2_decompress\nstatic FASTLZ_INLINE int FASTLZ_COMPRESSOR(const void* input, int length, void* output);\nstatic FASTLZ_INLINE int FASTLZ_DECOMPRESSOR(const void* input, int length, void* output, int maxout);\n#include \"fastlz.c\"\n\nint fastlz_compress(const void* input, int length, void* output)\n{\n  /* for short block, choose fastlz1 */\n  if(length < 65536)\n    return fastlz1_compress(input, length, output);\n\n  /* else... */\n  return fastlz2_compress(input, length, output);\n}\n\nint fastlz_decompress(const void* input, int length, void* output, int maxout)\n{\n  /* magic identifier for compression level */\n  int level = ((*(const flzuint8*)input) >> 5) + 1;\n\n  if(level == 1)\n    return fastlz1_decompress(input, length, output, maxout);\n  if(level == 2)\n    return fastlz2_decompress(input, length, output, maxout);\n\n  /* unknown level, trigger error */\n  return 0;\n}\n\nint fastlz_compress_level(int level, const void* input, int length, void* output)\n{\n  if(level == 1)\n    return fastlz1_compress(input, length, output);\n  if(level == 2)\n    return fastlz2_compress(input, length, output);\n\n  return 0;\n}\n\n#else /* !defined(FASTLZ_COMPRESSOR) && !defined(FASTLZ_DECOMPRESSOR) */\n\nstatic FASTLZ_INLINE int FASTLZ_COMPRESSOR(const void* input, int length, void* output)\n{\n  const flzuint8* ip = (const flzuint8*) input;\n  const flzuint8* ip_bound = ip + length - 2;\n  const flzuint8* ip_limit = ip + length - 12;\n  flzuint8* op = (flzuint8*) output;\n\n  const flzuint8* htab[HASH_SIZE];\n  const flzuint8** hslot;\n  flzuint32 hval;\n\n  flzuint32 copy;\n\n  /* sanity check */\n  if(FASTLZ_UNEXPECT_CONDITIONAL(length < 4))\n  {\n    if(length)\n    {\n      /* create literal copy only */\n      *op++ = length-1;\n      ip_bound++;\n      while(ip <= ip_bound)\n        *op++ = *ip++;\n      return length+1;\n    }\n    else\n      return 0;\n  }\n\n  /* initializes hash table */\n  for (hslot = htab; hslot < htab + HASH_SIZE; hslot++)\n    *hslot = ip;\n\n  /* we start with literal copy */\n  copy = 2;\n  *op++ = MAX_COPY-1;\n  *op++ = *ip++;\n  *op++ = *ip++;\n\n  /* main loop */\n  while(FASTLZ_EXPECT_CONDITIONAL(ip < ip_limit))\n  {\n    const flzuint8* ref;\n    flzuint32 distance;\n\n    /* minimum match length */\n    flzuint32 len = 3;\n\n    /* comparison starting-point */\n    const flzuint8* anchor = ip;\n\n    /* check for a run */\n#if FASTLZ_LEVEL==2\n    if(ip[0] == ip[-1] && FASTLZ_READU16(ip-1)==FASTLZ_READU16(ip+1))\n    {\n      distance = 1;\n      ip += 3;\n      ref = anchor - 1 + 3;\n      goto match;\n    }\n#endif\n\n    /* find potential match */\n    HASH_FUNCTION(hval,ip);\n    hslot = htab + hval;\n    ref = htab[hval];\n\n    /* calculate distance to the match */\n    distance = anchor - ref;\n\n    /* update hash table */\n    *hslot = anchor;\n\n    /* is this a match? check the first 3 bytes */\n    if(distance==0 || \n#if FASTLZ_LEVEL==1\n    (distance >= MAX_DISTANCE) ||\n#else\n    (distance >= MAX_FARDISTANCE) ||\n#endif\n    *ref++ != *ip++ || *ref++!=*ip++ || *ref++!=*ip++)\n      goto literal;\n\n#if FASTLZ_LEVEL==2\n    /* far, needs at least 5-byte match */\n    if(distance >= MAX_DISTANCE)\n    {\n      if(*ip++ != *ref++ || *ip++!= *ref++) \n        goto literal;\n      len += 2;\n    }\n    \n    match:\n#endif\n\n    /* last matched byte */\n    ip = anchor + len;\n\n    /* distance is biased */\n    distance--;\n\n    if(!distance)\n    {\n      /* zero distance means a run */\n      flzuint8 x = ip[-1];\n      while(ip < ip_bound)\n        if(*ref++ != x) break; else ip++;\n    }\n    else\n    for(;;)\n    {\n      /* safe because the outer check against ip limit */\n      if(*ref++ != *ip++) break;\n      if(*ref++ != *ip++) break;\n      if(*ref++ != *ip++) break;\n      if(*ref++ != *ip++) break;\n      if(*ref++ != *ip++) break;\n      if(*ref++ != *ip++) break;\n      if(*ref++ != *ip++) break;\n      if(*ref++ != *ip++) break;\n      while(ip < ip_bound)\n        if(*ref++ != *ip++) break;\n      break;\n    }\n\n    /* if we have copied something, adjust the copy count */\n    if(copy)\n      /* copy is biased, '0' means 1 byte copy */\n      *(op-copy-1) = copy-1;\n    else\n      /* back, to overwrite the copy count */\n      op--;\n\n    /* reset literal counter */\n    copy = 0;\n\n    /* length is biased, '1' means a match of 3 bytes */\n    ip -= 3;\n    len = ip - anchor;\n\n    /* encode the match */\n#if FASTLZ_LEVEL==2\n    if(distance < MAX_DISTANCE)\n    {\n      if(len < 7)\n      {\n        *op++ = (len << 5) + (distance >> 8);\n        *op++ = (distance & 255);\n      }\n      else\n      {\n        *op++ = (7 << 5) + (distance >> 8);\n        for(len-=7; len >= 255; len-= 255)\n          *op++ = 255;\n        *op++ = len;\n        *op++ = (distance & 255);\n      }\n    }\n    else\n    {\n      /* far away, but not yet in the another galaxy... */\n      if(len < 7)\n      {\n        distance -= MAX_DISTANCE;\n        *op++ = (len << 5) + 31;\n        *op++ = 255;\n        *op++ = distance >> 8;\n        *op++ = distance & 255;\n      }\n      else\n      {\n        distance -= MAX_DISTANCE;\n        *op++ = (7 << 5) + 31;\n        for(len-=7; len >= 255; len-= 255)\n          *op++ = 255;\n        *op++ = len;\n        *op++ = 255;\n        *op++ = distance >> 8;\n        *op++ = distance & 255;\n      }\n    }\n#else\n\n    if(FASTLZ_UNEXPECT_CONDITIONAL(len > MAX_LEN-2))\n      while(len > MAX_LEN-2)\n      {\n        *op++ = (7 << 5) + (distance >> 8);\n        *op++ = MAX_LEN - 2 - 7 -2; \n        *op++ = (distance & 255);\n        len -= MAX_LEN-2;\n      }\n\n    if(len < 7)\n    {\n      *op++ = (len << 5) + (distance >> 8);\n      *op++ = (distance & 255);\n    }\n    else\n    {\n      *op++ = (7 << 5) + (distance >> 8);\n      *op++ = len - 7;\n      *op++ = (distance & 255);\n    }\n#endif\n\n    /* update the hash at match boundary */\n    HASH_FUNCTION(hval,ip);\n    htab[hval] = ip++;\n    HASH_FUNCTION(hval,ip);\n    htab[hval] = ip++;\n\n    /* assuming literal copy */\n    *op++ = MAX_COPY-1;\n\n    continue;\n\n    literal:\n      *op++ = *anchor++;\n      ip = anchor;\n      copy++;\n      if(FASTLZ_UNEXPECT_CONDITIONAL(copy == MAX_COPY))\n      {\n        copy = 0;\n        *op++ = MAX_COPY-1;\n      }\n  }\n\n  /* left-over as literal copy */\n  ip_bound++;\n  while(ip <= ip_bound)\n  {\n    *op++ = *ip++;\n    copy++;\n    if(copy == MAX_COPY)\n    {\n      copy = 0;\n      *op++ = MAX_COPY-1;\n    }\n  }\n\n  /* if we have copied something, adjust the copy length */\n  if(copy)\n    *(op-copy-1) = copy-1;\n  else\n    op--;\n\n#if FASTLZ_LEVEL==2\n  /* marker for fastlz2 */\n  *(flzuint8*)output |= (1 << 5);\n#endif\n\n  return op - (flzuint8*)output;\n}\n\nstatic FASTLZ_INLINE int FASTLZ_DECOMPRESSOR(const void* input, int length, void* output, int maxout)\n{\n  const flzuint8* ip = (const flzuint8*) input;\n  const flzuint8* ip_limit  = ip + length;\n  flzuint8* op = (flzuint8*) output;\n  flzuint8* op_limit = op + maxout;\n  flzuint32 ctrl = (*ip++) & 31;\n  int loop = 1;\n\n  do\n  {\n    const flzuint8* ref = op;\n    flzuint32 len = ctrl >> 5;\n    flzuint32 ofs = (ctrl & 31) << 8;\n\n    if(ctrl >= 32)\n    {\n#if FASTLZ_LEVEL==2\n      flzuint8 code;\n#endif\n      len--;\n      ref -= ofs;\n      if (len == 7-1)\n#if FASTLZ_LEVEL==1\n        len += *ip++;\n      ref -= *ip++;\n#else\n        do\n        {\n          code = *ip++;\n          len += code;\n        } while (code==255);\n      code = *ip++;\n      ref -= code;\n\n      /* match from 16-bit distance */\n      if(FASTLZ_UNEXPECT_CONDITIONAL(code==255))\n      if(FASTLZ_EXPECT_CONDITIONAL(ofs==(31 << 8)))\n      {\n        ofs = (*ip++) << 8;\n        ofs += *ip++;\n        ref = op - ofs - MAX_DISTANCE;\n      }\n#endif\n      \n#ifdef FASTLZ_SAFE\n      if (FASTLZ_UNEXPECT_CONDITIONAL(op + len + 3 > op_limit))\n        return 0;\n\n      if (FASTLZ_UNEXPECT_CONDITIONAL(ref-1 < (flzuint8 *)output))\n        return 0;\n#endif\n\n      if(FASTLZ_EXPECT_CONDITIONAL(ip < ip_limit))\n        ctrl = *ip++;\n      else\n        loop = 0;\n\n      if(ref == op)\n      {\n        /* optimize copy for a run */\n        flzuint8 b = ref[-1];\n        *op++ = b;\n        *op++ = b;\n        *op++ = b;\n        for(; len; --len)\n          *op++ = b;\n      }\n      else\n      {\n#if !defined(FASTLZ_STRICT_ALIGN)\n        const flzuint16* p;\n        flzuint16* q;\n#endif\n        /* copy from reference */\n        ref--;\n        *op++ = *ref++;\n        *op++ = *ref++;\n        *op++ = *ref++;\n\n#if !defined(FASTLZ_STRICT_ALIGN)\n        /* copy a byte, so that now it's word aligned */\n        if(len & 1)\n        {\n          *op++ = *ref++;\n          len--;\n        }\n\n        /* copy 16-bit at once */\n        q = (flzuint16*) op;\n        op += len;\n        p = (const flzuint16*) ref;\n        for(len>>=1; len > 4; len-=4)\n        {\n          *q++ = *p++;\n          *q++ = *p++;\n          *q++ = *p++;\n          *q++ = *p++;\n        }\n        for(; len; --len)\n          *q++ = *p++;\n#else\n        for(; len; --len)\n          *op++ = *ref++;\n#endif\n      }\n    }\n    else\n    {\n      ctrl++;\n#ifdef FASTLZ_SAFE\n      if (FASTLZ_UNEXPECT_CONDITIONAL(op + ctrl > op_limit))\n        return 0;\n      if (FASTLZ_UNEXPECT_CONDITIONAL(ip + ctrl > ip_limit))\n        return 0;\n#endif\n\n      *op++ = *ip++; \n      for(--ctrl; ctrl; ctrl--)\n        *op++ = *ip++;\n\n      loop = FASTLZ_EXPECT_CONDITIONAL(ip < ip_limit);\n      if(loop)\n        ctrl = *ip++;\n    }\n  }\n  while(FASTLZ_EXPECT_CONDITIONAL(loop));\n\n  return op - (flzuint8*)output;\n}\n\n#endif /* !defined(FASTLZ_COMPRESSOR) && !defined(FASTLZ_DECOMPRESSOR) */\n"
  },
  {
    "path": "src/fastlz.h",
    "content": "/*  \n  FastLZ - lightning-fast lossless compression library\n\n  Copyright (C) 2007 Ariya Hidayat (ariya@kde.org)\n  Copyright (C) 2006 Ariya Hidayat (ariya@kde.org)\n  Copyright (C) 2005 Ariya Hidayat (ariya@kde.org)\n\n  Permission is hereby granted, free of charge, to any person obtaining a copy\n  of this software and associated documentation files (the \"Software\"), to deal\n  in the Software without restriction, including without limitation the rights\n  to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n  copies of the Software, and to permit persons to whom the Software is\n  furnished to do so, subject to the following conditions:\n\n  The above copyright notice and this permission notice shall be included in\n  all copies or substantial portions of the Software.\n\n  THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n  IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n  FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n  AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n  LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n  OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN\n  THE SOFTWARE.\n*/\n\n#ifndef FASTLZ_H\n#define FASTLZ_H\n\n#define FASTLZ_VERSION 0x000100\n\n#define FASTLZ_VERSION_MAJOR     0\n#define FASTLZ_VERSION_MINOR     0\n#define FASTLZ_VERSION_REVISION  0\n\n#define FASTLZ_VERSION_STRING \"0.1.0\"\n\n#if defined (__cplusplus)\nextern \"C\" {\n#endif\n\n/**\n  Compress a block of data in the input buffer and returns the size of \n  compressed block. The size of input buffer is specified by length. The \n  minimum input buffer size is 16.\n\n  The output buffer must be at least 5% larger than the input buffer  \n  and can not be smaller than 66 bytes.\n\n  If the input is not compressible, the return value might be larger than\n  length (input buffer size).\n\n  The input buffer and the output buffer can not overlap.\n*/\n\nint fastlz_compress(const void* input, int length, void* output);\n\n/**\n  Decompress a block of compressed data and returns the size of the \n  decompressed block. If error occurs, e.g. the compressed data is \n  corrupted or the output buffer is not large enough, then 0 (zero) \n  will be returned instead.\n\n  The input buffer and the output buffer can not overlap.\n\n  Decompression is memory safe and guaranteed not to write the output buffer\n  more than what is specified in maxout.\n */\n\nint fastlz_decompress(const void* input, int length, void* output, int maxout); \n\n/**\n  Compress a block of data in the input buffer and returns the size of \n  compressed block. The size of input buffer is specified by length. The \n  minimum input buffer size is 16.\n\n  The output buffer must be at least 5% larger than the input buffer  \n  and can not be smaller than 66 bytes.\n\n  If the input is not compressible, the return value might be larger than\n  length (input buffer size).\n\n  The input buffer and the output buffer can not overlap.\n\n  Compression level can be specified in parameter level. At the moment, \n  only level 1 and level 2 are supported.\n  Level 1 is the fastest compression and generally useful for short data.\n  Level 2 is slightly slower but it gives better compression ratio.\n\n  Note that the compressed data, regardless of the level, can always be\n  decompressed using the function fastlz_decompress above.\n*/  \n\nint fastlz_compress_level(int level, const void* input, int length, void* output);\n\n#if defined (__cplusplus)\n}\n#endif\n\n#endif /* FASTLZ_H */\n"
  },
  {
    "path": "src/fastlz_wrapper.c",
    "content": "#define _GNU_SOURCE\n\n#include <stdlib.h>\n#include <err.h>\n#include \"fastlz_wrapper.h\"\n\nvoid* fastlz_wrapper_compress(void *data, uLong uncompressed_size, int level, uLong *compressed_size) {\n\n    *compressed_size = uncompressed_size * 1.05 + 1; // extra 1 in case of round down\n    if (*compressed_size < MINIMUM_BUFFER_SIZE) {\n        *compressed_size = MINIMUM_BUFFER_SIZE;\n    }\n\n    void *compressed_data = (void *) calloc(1, *compressed_size);\n    if (compressed_data == NULL)\n        err(1, \"calloc error in fastlz_compress().\");\n\n    // Deflate\n    *compressed_size = fastlz_compress_level(level, data, uncompressed_size, compressed_data);\n\n    return compressed_data;\n}\n\nvoid* fastlz_wrapper_uncompress(void *compressed_data, uLong compressed_size, uLong uncompressed_size) {\n\n    void *uncompressed_data = (void *) calloc(1, uncompressed_size);\n    if (uncompressed_data == NULL)\n        err(1, \"calloc error in fastlz_uncompress().\");\n\n    // Inflate\n    fastlz_decompress(compressed_data, compressed_size, uncompressed_data, uncompressed_size);\n\n    return uncompressed_data;\n}"
  },
  {
    "path": "src/fastlz_wrapper.h",
    "content": "#ifndef __FASTLZ_WRAPPER_H__\n#define __FASTLZ_WRAPPER_H__\n\n#include \"fastlz.h\"\ntypedef unsigned long  uLong;\n#define MINIMUM_BUFFER_SIZE 66\n\n/**\n * @brief level must be 1 or 2: \n * 1 is the fastest compression and generally useful for short data.\n * 2 is slightly slower but it gives better compression ratio.\n */\nvoid* fastlz_wrapper_compress(void *data, uLong uncompressed_size, int level, uLong *compressed_size);\nvoid* fastlz_wrapper_uncompress(void *compressed_data, uLong compressed_size, uLong uncompressed_size);\n\n#endif\n"
  },
  {
    "path": "src/file_read.c",
    "content": "#define _GNU_SOURCE\n\n#include <htslib/bgzf.h>\n#include <htslib/kstring.h>\n#include <htslib/hts.h>\n#include <stdlib.h>\n#include <stdio.h>\n#include <stdint.h>\n#include <string.h>\n#include <err.h>\n#include <sysexits.h>\n\n#include \"util.h\"\n#include \"file_read.h\"\n\n//{{{int scan_s(char *str, int str_len, int *s, int *e, const char delim)\nint scan_s(char *str, int str_len, int *s, int *e, const char delim) {\n    if (*e == str_len)\n        return -1;\n    for (*e = *s; *e <= str_len; *e+=1) {\n        if ((str[*e] == delim) || (*e == str_len)) {\n            return *e - *s;\n        }\n    }\n    return -2;\n}\n//}}}\n\n//{{{struct input_file *input_file_init(char *file_name)\nstruct input_file *input_file_init(char *file_name)\n{\n    struct input_file *i = (struct input_file *)\n            malloc(sizeof(struct input_file));\n    if (i == NULL)\n        err(1, \"malloc error in input_file_init().\");\n\n    i->file_name = strdup(file_name);\n\n    // .bed.gz\n    if ( (strlen(i->file_name) > 7) &&\n            strcmp(\".bed.gz\", file_name + strlen(i->file_name) - 7) == 0) {\n        i->type = BED;\n    // .vcf.gz\n    } else if ( (strlen(i->file_name) > 7) &&\n                strcmp(\".vcf.gz\", file_name + strlen(i->file_name) - 7) == 0) {\n        i->type = VCF;\n    } else if ( (strlen(i->file_name) > 4) &&\n                strcmp(\".bcf\", file_name + strlen(i->file_name) - 4) == 0) {\n        i->type = BCF;\n    } else {\n        fprintf(stderr, \"File type not supported '%s'.\\n\", i->file_name);\n        free(i->file_name);\n        free(i);\n        return NULL;\n    }\n\n    if (i->type == BED) {\n        i->kstr = (kstring_t*)calloc(1, sizeof(kstring_t));\n        if (i->kstr == NULL) {\n            fprintf(stderr, \"calloc error in input_file_init().\");\n            return NULL;\n        }\n\n        if ((i->bed_fp = bgzf_open(file_name, \"r\")) == 0) {\n            fprintf(stderr ,\"Could not open file '%s'\\n\", file_name);\n            return NULL;\n        }\n\n        if ( bgzf_compression(i->bed_fp) != bgzf ) {\n            fprintf(stderr, \"Not a BGZF file '%s'\\n\", file_name);\n            return NULL;\n        }\n\n        if ( !i->bed_fp->is_compressed ) {\n            fprintf(stderr, \"Not a bgzip compressed file '%s'\\n\", file_name);\n            return NULL;\n        }\n\n        i->last_offset = 0;\n\n        i->input_file_get_next_interval = \n            input_file_get_next_interval_bed;\n        i->input_file_get_next_line = \n            input_file_get_next_line_bgzf;\n        i->input_file_seek = \n            input_file_seek_bgzf;\n    } else if ( (i->type == VCF) || (i->type == BCF) ) {\n        i->bcf_fp = hts_open(i->file_name,\"rb\");\n        if (!i->bcf_fp) {\n            fprintf(stderr, \"Could not read file '%s'\", i->file_name);\n            return NULL;\n        }\n\n        if (i->bcf_fp->format.compression != bgzf) {\n            fprintf(stderr, \"Not a BGZF file '%s'\\n\", i->file_name);\n            return NULL;\n        }\n\n        i->line = bcf_init1();\n        i->hdr = bcf_hdr_read(i->bcf_fp);\n\n        if ( !i->hdr ) {\n            fprintf(stderr, \"Could not read the header '%s'\", i->file_name);\n            return NULL;\n        }\n\n        htsFormat type = *hts_get_format(i->bcf_fp);\n        if (type.format == bcf) {\n            fprintf(stderr, \"File type not supported '%s'.\\n\", i->file_name);\n            free(i->file_name);\n            free(i);\n            return NULL;\n        } else {\n            hts_close(i->bcf_fp);\n\n            i->kstr = (kstring_t*)calloc(1, sizeof(kstring_t));\n\n            if (i->kstr == NULL) {\n                fprintf(stderr, \"calloc error in input_file_init().\");\n                return NULL;\n            }\n\n            if ((i->bed_fp = bgzf_open(file_name, \"r\")) == 0) {\n                fprintf(stderr, \"Could not open file '%s'\\n\", i->file_name);\n                return NULL;\n            }\n\n            if ( !i->bed_fp->is_compressed ) {\n                fprintf(stderr,\n                        \"Not a bgzip compressed file '%s'\\n\",\n                        i->file_name);\n                return NULL;\n            }\n\n            // move past the header\n            while (bgzf_getline(i->bed_fp, '\\n', i->kstr) >= 0) {\n                if (i->kstr->s[0] == '#')\n                    i->last_offset = bgzf_tell(i->bed_fp);\n                else\n                    break;\n            }\n\n            if (bgzf_seek(i->bed_fp, i->last_offset, SEEK_SET) != 0) {\n                fprintf(stderr, \"Error moving past header '%s'\", i->file_name);\n                return NULL;\n            }\n\n            i->input_file_get_next_interval = \n                input_file_get_next_interval_vcf;\n            i->input_file_get_next_line = \n                input_file_get_next_line_bgzf;\n            i->input_file_seek = \n                input_file_seek_bgzf;\n        }\n    }\n\n    return i;\n}\n//}}}\n\n//{{{void input_file_destroy(struct input_file **i)\nvoid input_file_destroy(struct input_file **i)\n{\n    if ((*i)->type == VCF) {\n        bcf_hdr_destroy((*i)->hdr); \n    }\n    free((*i)->file_name);\n    bgzf_close((*i)->bed_fp);\n    free((*i)->kstr->s);\n    free((*i)->kstr);\n    free(*i);\n    *i = NULL;\n}\n//}}}\n\n//{{{int input_file_get_next_interval_bed(struct input_file *i,\nint input_file_get_next_interval_bed(struct input_file *i,\n                                     char **chrm,\n                                     int *chrm_len,\n                                     uint32_t *start,\n                                     uint32_t *end,\n                                     long *offset,\n                                     kstring_t *line)\n{\n    *offset = i->last_offset;\n    int ret = bgzf_getline(i->bed_fp, '\\n', i->kstr);\n    i->last_offset = bgzf_tell(i->bed_fp);\n\n    if (ret < 0 )\n        return ret;\n\n    line->l = 0;\n    kputs(i->kstr->s, line);\n \n    int s=0, e=0;\n    int col = 0;\n    while ( scan_s(i->kstr->s, i->kstr->l, &s, &e, '\\t') >= 0 ) {\n        col += 1;\n        if (col == 1) {\n            if ((e - s + 1) > *chrm_len) {\n                *chrm_len = *chrm_len *2;\n                *chrm = realloc(*chrm, *chrm_len * sizeof(char));\n                if (*chrm == NULL)\n                    err(1,\n                        \"realloc error in input_file_get_next_interval_bed().\");\n            }\n\n            if( strncmp(\"chr\", i->kstr->s + s, 3) == 0) {\n                memcpy(*chrm, i->kstr->s + s + 3, e - s - 3);\n                (*chrm)[e - s - 3] = '\\0';\n            } else {\n                memcpy(*chrm, i->kstr->s + s, e - s);\n                (*chrm)[e - s] = '\\0';\n            }\n\n        } else if (col == 2) {\n            *start = strtol(i->kstr->s + s, NULL, 0);\n        } else if (col == 3) {\n            *end = strtol(i->kstr->s + s, NULL, 0);\n        } else {\n            break;\n        }\n        s = e + 1;\n    }\n\n    return ret;\n}\n//}}}\n\n//{{{int input_file_get_next_interval_vcf(struct input_file *i,\nint input_file_get_next_interval_vcf(struct input_file *i,\n                                     char **chrm,\n                                     int *chrm_len,\n                                     uint32_t *start,\n                                     uint32_t *end,\n                                     long *offset,\n                                     kstring_t *line)\n{\n    *offset = i->last_offset;\n    int ret = bgzf_getline(i->bed_fp, '\\n', i->kstr);\n    i->last_offset = bgzf_tell(i->bed_fp);\n\n    if (ret < 0 )\n        return ret;\n\n    vcf_parse(i->kstr, i->hdr, i->line);\n\n    line->l = 0;\n    kputs(i->kstr->s, line);\n\n    int lensize = sizeof(uint32_t);\n    uint32_t *len = (uint32_t *) calloc(1,lensize);\n    if (len == NULL)\n        err(1, \"calloc error in input_file_get_next_interval_vcf()\");\n\n    int size = sizeof(uint32_t);\n    if (bcf_get_info_int32(i->hdr, i->line, \"END\", &end, &size) < 0) {\n        size = sizeof(uint32_t);\n        if (bcf_get_info_int32(i->hdr, i->line, \"SVLEN\", &len, &lensize) >= 0)\n            *end = i->line->pos + *len;\n        else\n            *end = i->line->pos + i->line->rlen;\n    }\n\n    *end = *end + 1;\n\n    const char *_chrm = bcf_hdr_id2name(i->hdr, i->line->rid);\n\n    while (strlen(_chrm) + 1 > *chrm_len) {\n        *chrm_len = *chrm_len *2;\n        *chrm = realloc(*chrm, *chrm_len * sizeof(char));\n        if (*chrm == NULL)\n            err(1, \"realloc error in input_file_get_next_interval_vcf()\");\n    }\n\n    if( strncmp(\"chr\", _chrm, 3) == 0)\n        memcpy(*chrm, _chrm + 3, (strlen(_chrm) + 1) - 3);\n    else\n        memcpy(*chrm, _chrm, strlen(_chrm) + 1);\n\n    *start = i->line->pos + 1;\n\n    return ret;\n}\n//}}}\n\n//{{{int input_file_get_next_line_bgzf(struct input_file *i,\nint input_file_get_next_line_bgzf(struct input_file *i,\n                                  char **str)\n{\n    int ret = bgzf_getline(i->bed_fp, '\\n', i->kstr);\n    i->last_offset = bgzf_tell(i->bed_fp);\n    *str = i->kstr->s;\n    return ret;\n}\n//}}}\n\n//{{{void input_file_get_curr_line_bgzf(struct input_file *i,\nvoid input_file_get_curr_line_bgzf(struct input_file *i,\n                                  char **str)\n{\n    //fprintf(stdout, \"****%zu\\n\", i->kstr->l);\n\n    if (i->type == VCF) {\n        i->kstr->l = 0;\n        vcf_format1(i->hdr, i->line, i->kstr);\n    }\n    *str = i->kstr->s;\n}\n//}}}\n\n//{{{void input_file_seek_bgzf(struct input_file *i, long offset)\nvoid input_file_seek_bgzf(struct input_file *i, long offset)\n{\n    if (bgzf_seek(i->bed_fp, offset, SEEK_SET) != 0)\n        err(EX_DATAERR, \"Error seeking in bgzf file.\");\n    i->last_offset = offset;\n}\n//}}}\n\n//{{{void file_data_store(void *v, FILE *f, char *file_name)\nvoid file_data_store(void *v, FILE *f, char *file_name)\n{\n    struct file_data *fd = (struct file_data *)v;\n    uint32_t size = strlen(fd->file_name) +\n                    sizeof(uint32_t) + \n                    sizeof(double);\n\n    if (fwrite(&size, sizeof(uint32_t), 1, f) != 1)\n        err(EX_IOERR,\n            \"Error writing file_data size to '%s'.\", file_name);\n\n    if (fwrite(fd->file_name,\n               sizeof(char),\n               strlen(fd->file_name), f) != strlen(fd->file_name))\n        err(EX_IOERR,\n            \"Error writing file_data file_name to '%s'.\", file_name);\n\n    if (fwrite(&(fd->num_intervals),\n               sizeof(uint32_t),\n               1, f) != 1)\n        err(EX_IOERR,\n            \"Error writing file_data num_intervals to '%s'.\", file_name);\n\n    if (fwrite(&(fd->mean_interval_size),\n               sizeof(double),\n               1, f) != 1)\n        err(EX_IOERR,\n            \"Error writing file_data mean_interval_size to '%s'.\", file_name);\n\n}\n//}}}\n\n//{{{ void *file_data_load(FILE *f, char *file_name)\nvoid *file_data_load(FILE *f, char *file_name)\n{\n    uint32_t size;\n    size_t fr = fread(&size, sizeof(uint32_t), 1, f);\n    check_file_read(file_name, f, 1, fr);\n\n    uint32_t str_len = size - sizeof(uint32_t) - sizeof(double);\n\n    struct file_data *fd = (struct file_data *)\n        calloc(1, sizeof(struct file_data));\n    if (fd == NULL)\n        err(1, \"calloc error in file_data_load()\");\n\n    fd->file_name = (char *)calloc(str_len + 1, sizeof(char));\n    if (fd->file_name == NULL)\n        err(1, \"calloc error in file_data_load()\");\n\n    fr = fread(fd->file_name, sizeof(char), str_len, f);\n    check_file_read(file_name, f, str_len, fr);\n\n    fd->file_name[str_len] = '\\0';\n\n    uint32_t v;\n    fr = fread(&v, sizeof(uint32_t), 1, f);\n    check_file_read(file_name, f, 1, fr);\n\n    fd->num_intervals = v;\n\n    fr = fread(&(fd->mean_interval_size), sizeof(double), 1, f);\n    check_file_read(file_name, f, 1, fr);\n\n    return (void *)fd;\n}\n//}}}\n\n//{{{void file_data_free(void **v)\nvoid file_data_free(void **v)\n{\n    struct file_data **fd = (struct file_data **)v;\n    free((*fd)->file_name);\n    free(*fd);\n    *fd = NULL;\n}\n//}}}\n"
  },
  {
    "path": "src/file_read.h",
    "content": "#ifndef __FILE_READ_H__\n#define __FILE_READ_H__\n\n#include <htslib/bgzf.h>\n#include <htslib/vcf.h>\n#include <htslib/kstring.h>\n#include <stdint.h>\n\nstruct file_data\n{\n    char *file_name;\n    uint32_t num_intervals;\n    double mean_interval_size;\n};\n\nvoid file_data_free(void **v);\nvoid file_data_store(void *v, FILE *f, char *file_name);\nvoid *file_data_load(FILE *f, char *file_name);\n\nstruct input_file\n{\n    char *file_name;\n    bcf1_t *line;\n    BGZF *bed_fp;\n    htsFile *bcf_fp;\n    bcf_hdr_t *hdr;\n    kstring_t *kstr;\n    long last_offset;\n    enum {BED,VCF,BCF} type;\n    int (*input_file_get_next_interval)(struct input_file *i,\n                                        char **chrm,\n                                        int *chrm_len,\n                                        uint32_t *start,\n                                        uint32_t *end,\n                                        long *offset,\n                                        kstring_t *line);\n    int (*input_file_get_next_line)(struct input_file *i,\n                                    char **str);\n    void (*input_file_seek)(struct input_file *i, long offset);\n};\n\nint scan_s(char *str, int str_len, int *s, int *e, const char delim);\nstruct input_file *input_file_init(char *file_name);\nvoid input_file_destroy(struct input_file **i);\nvoid input_file_seek_bgzf(struct input_file *i, long offset);\nint input_file_get_next_interval_bed(struct input_file *i,\n                                     char **chrm,\n                                     int *chrm_len,\n                                     uint32_t *start,\n                                     uint32_t *end,\n                                     long *offset,\n                                     kstring_t *line);\nint input_file_get_next_interval_vcf(struct input_file *i,\n                                     char **chrm,\n                                     int *chrm_len,\n                                     uint32_t *start,\n                                     uint32_t *end,\n                                     long *offset,\n                                     kstring_t *line);\nint input_file_get_next_line_bgzf(struct input_file *i,\n                                  char **str);\n\nvoid input_file_get_curr_line_bgzf(struct input_file *i,\n                                   char **str);\n#endif\n"
  },
  {
    "path": "src/giggle.c",
    "content": "#define _GNU_SOURCE\n#include <stdlib.h>\n#include <stdio.h>\n#include <err.h>\n#include <string.h>\n#include <sysexits.h>\n#include \"giggle_index.h\"\n#include \"wah.h\"\n#include \"cache.h\"\n\nint giggle_help(int argc, char **argv, int exit_code);\nint index_main(int argc, char **argv, char *full_cmd);\nint search_main(int argc, char **argv, char *full_cmd);\n\nint main(int argc, char **argv)\n{\n    if (argc < 2) return giggle_help(argc, argv, 0);\n    char *cmd = argv[1];\n    char *full_cmd = strdup(argv[0]);\n    int i, r, quote_next = 0;\n    for (i = 1; i < argc; ++i) {\n        if (quote_next == 1) {\n            r = asprintf(&full_cmd, \"%s \\\"%s\\\"\", full_cmd, argv[i]);\n            if (r == -1) err(EX_OSERR, \"asprintf error\");\n            quote_next = 0;\n        } else {\n            r = asprintf(&full_cmd, \"%s %s\", full_cmd, argv[i]);\n            if (r == -1) err(EX_OSERR, \"asprintf error\");\n        }\n\n        if ( (strcmp(argv[i], \"-p\") == 0) || (strcmp(argv[i], \"-g\") == 0))\n            quote_next = 1;\n    }\n\n    if (strcmp(cmd,\"index\") == 0)\n        return index_main(argc-1, argv+1, full_cmd);\n    else if (strcmp(cmd,\"search\") == 0)\n        return search_main(argc-1, argv+1, full_cmd);\n    else {\n        fprintf(stderr, \"Unknown command\\n\");\n        return giggle_help(argc, argv, EX_USAGE);\n    }\n    free(full_cmd);\n}\n\nint giggle_help(int argc, char **argv, int exit_code)\n{\n    fprintf(stderr,\n\"%s, v%s\\n\"\n\"usage:   %s <command> [options]\\n\"\n\"         index     Create an index\\n\"\n\"         search    Search an index\\n\",\n            PROGRAM_NAME, VERSION, PROGRAM_NAME);\n    return exit_code;\n}\n"
  },
  {
    "path": "src/giggle_index.c",
    "content": "#define _GNU_SOURCE\n\n#include <dirent.h>\n#include <err.h>\n#include <glob.h>\n#include <htslib/kstring.h>\n#include <inttypes.h>\n#include <libgen.h>\n#include <limits.h>\n#include <stdint.h>\n#include <stdio.h>\n#include <stdlib.h>\n#include <string.h>\n#include <sysexits.h>\n\n#include \"bpt.h\"\n#include \"cache.h\"\n#include \"fastlz.h\"\n#include \"file_read.h\"\n#include \"giggle_index.h\"\n#include \"jsw_avltree.h\"\n#include \"lists.h\"\n#include \"ll.h\"\n#include \"metadata_index.h\"\n#include \"offset_index.h\"\n#include \"timer.h\"\n#include \"util.h\"\n\nchar *CHRM_INDEX_FILE_NAME = \"chrm_index.dat\";\nchar *FILE_INDEX_FILE_NAME = \"file_index.dat\";\nchar *ROOT_IDS_FILE_NAME = \"root_ids.dat\";\nchar *CACHE_FILE_NAME_PREFIX = \"cache.\";\n\n//{{{ void *file_id_offset_pair_load(FILE *f, char *file_name)\nvoid *file_id_offset_pair_load(FILE *f, char *file_name) {\n    struct file_id_offset_pair *p =\n        (struct file_id_offset_pair *)malloc(sizeof(struct file_id_offset_pair));\n    if (p == NULL)\n        err(1, \"malloc error in file_id_offset_pair_load()\");\n\n    size_t fr = fread(&(p->file_id), sizeof(uint32_t), 1, f);\n    check_file_read(file_name, f, 1, fr);\n\n    fr = fread(&(p->offset), sizeof(long), 1, f);\n    check_file_read(file_name, f, 1, fr);\n\n    return p;\n}\n//}}}\n\n//{{{void file_id_offset_pair_store(void *v, FILE *f, char *file_name)\nvoid file_id_offset_pair_store(void *v, FILE *f, char *file_name) {\n    struct file_id_offset_pair *p = (struct file_id_offset_pair *)v;\n\n    if (fwrite(&(p->file_id), sizeof(uint32_t), 1, f) != 1)\n        err(EX_IOERR, \"Error writing file_id_offset_pair file_id '%s'.\", file_name);\n\n    if (fwrite(&(p->offset), sizeof(long), 1, f) != 1)\n        err(EX_IOERR, \"Error writing file_id_offset_pair offset '%s'.\", file_name);\n}\n//}}}\n\n//{{{ void *c_str_load(FILE *f, char *file_name)\nvoid *c_str_load(FILE *f, char *file_name) {\n    uint32_t size;\n    size_t fr = fread(&size, sizeof(uint32_t), 1, f);\n    check_file_read(file_name, f, 1, fr);\n\n    char *c_str = (char *)calloc(size, sizeof(char));\n    if (c_str == NULL)\n        err(1, \"calloc error in c_str_load()\");\n\n    fr = fread(c_str, sizeof(char), size, f);\n    check_file_read(file_name, f, size, fr);\n\n    return c_str;\n}\n//}}}\n\n//{{{void c_str_store(void *v, FILE *f, char *file_name)\nvoid c_str_store(void *v, FILE *f, char *file_name) {\n    char *c_str = (char *)v;\n    uint32_t size = strlen(c_str);\n\n    if (fwrite(&size, sizeof(uint32_t), 1, f) != 1)\n        err(EX_IOERR, \"Error writing c_str size '%s'.\", file_name);\n\n    if (fwrite(c_str, sizeof(char), size, f) != size)\n        err(EX_IOERR, \"Error writing file_id_offset_pair offset '%s'.\", file_name);\n}\n//}}}\n\n//{{{ uint32_t giggle_insert(struct bpt_node **root,\nuint32_t giggle_insert(\n    uint32_t domain,\n    uint32_t *root_id,\n    uint32_t start,\n    uint32_t end,\n    uint64_t id\n) {\n#if DEBUG\n    fprintf(stderr, \"giggle_insert\\n\");\n#endif\n    /*\n     * BP: the set of all indexing points\n     * t: is a time point\n     * t-: the point in BP immediatly before t\n     *   the point s.t. t- < t and there does not exist a point t_m in BP such\n     *   that t- < t_m < t\n     * t+: the point in BP immediatly after t\n     *   the point s.t. t < t+ and there does not exist a point t_m in BP such\n     *   that t < t_m < t+\n     * B(t): is a bucket containing pointers to all object versions whose\n     *   valid time contis the interval [t_i, t_i+ - 1]\n     * SA(t): is the set of object versions whose start time is t\n     * SE(t): is the set of object versions whose end time is is t -1\n     *\n     * t_a <- e.start\n     * t_b <- e.end + 1\n     *\n     * search for t_a\n     *\n     * if not found:\n     *   add t_a\n     *\n     * if t_a is not a leading leaf node entry:\n     *   add e into SA(t_a)\n     *\n     * search for t_b\n     *\n     * if not found:\n     *   add t_b\n     *\n     * if t_b is not a leading leaf node entry:\n     *   add e into SE(t_b)\n     *\n     * for each leading entry t_i = t_a...t_b of a leaf node\n     *   add e to B(t_i)\n     *\n     *\n     */\n\n#if DEBUG\n    fprintf(stderr, \"%u %u\\n\", start, end);\n#endif\n\n    uint32_t end_leaf_id = 0;\n    int end_pos;\n\n    uint32_t end_id = bpt_find(domain, *root_id, &end_leaf_id, &end_pos, end + 1);\n\n    if (end_id == 0) {\n#if DEBUG\n        fprintf(stderr, \"->%u\\n\", end);\n#endif\n        void *d = giggle_data_handler.new_non_leading(domain);\n        giggle_data_handler.non_leading_SE_add_scalar(domain, d, &id);\n\n        uint32_t v_id;\n        int pos;\n        *root_id = bpt_insert_new_value(\n            domain,\n            *root_id,\n            end + 1,\n            d,\n            &giggle_data_handler.non_leading_cache_handler,\n            &v_id,\n            &end_leaf_id,\n            &end_pos\n        );\n    } else {\n#if DEBUG\n        fprintf(stderr, \"||%u\\n\", end);\n#endif\n        void *end_v = cache.get(\n            domain, end_id - 1, &giggle_data_handler.non_leading_cache_handler\n        );\n        giggle_data_handler.non_leading_SE_add_scalar(domain, end_v, &id);\n    }\n\n    uint32_t start_leaf_id = 0;\n    int start_pos;\n\n    uint32_t start_id = bpt_find(domain, *root_id, &start_leaf_id, &start_pos, start);\n\n    if (start_id == 0) {\n#if DEBUG\n        fprintf(stderr, \"->%u\\n\", start);\n#endif\n        void *d = giggle_data_handler.new_non_leading(domain);\n        giggle_data_handler.non_leading_SA_add_scalar(domain, d, &id);\n        uint32_t v_id;\n        int pos;\n        *root_id = bpt_insert_new_value(\n            domain,\n            *root_id,\n            start,\n            d,\n            &giggle_data_handler.non_leading_cache_handler,\n            &v_id,\n            &start_leaf_id,\n            &start_pos\n        );\n    } else {\n#if DEBUG\n        fprintf(stderr, \"||%u\\n\", start);\n#endif\n        void *start_v = cache.get(\n            domain, start_id - 1, &giggle_data_handler.non_leading_cache_handler\n        );\n        giggle_data_handler.non_leading_SA_add_scalar(domain, start_v, &id);\n    }\n\n#if DEBUG\n    fprintf(stderr, \"s_id:%u e_id:%u\\t\", start_leaf_id, end_leaf_id);\n#endif\n\n    // For now we need to search to see which leaf the values ended up in\n    // because it is possible that the leaf split on the second insert but both\n    // keys ended up on the same leaf.  If they are differnet we just double\n    // check to see that this is not the case.\n\n    // if (start_leaf_id != end_leaf_id)\n    start_leaf_id = bpt_find_leaf(domain, *root_id, start);\n    end_leaf_id = bpt_find_leaf(domain, *root_id, end + 1);\n\n#if DEBUG\n    fprintf(stderr, \":::\\ts_id:%u e_id:%u\\n\", start_leaf_id, end_leaf_id);\n#endif\n\n#if DEBUG\n    struct bpt_node *test_leaf =\n        cache.get(domain, start_leaf_id - 1, &bpt_node_cache_handler);\n    uint32_t x;\n    for (x = 0; x < BPT_NUM_KEYS(test_leaf); ++x) {\n        fprintf(stderr, \"%u \", BPT_KEYS(test_leaf)[x]);\n    }\n    fprintf(stderr, \"\\n\");\n#endif\n\n    if (start_leaf_id != end_leaf_id) {\n        struct bpt_node *curr_leaf =\n            cache.get(domain, start_leaf_id - 1, &bpt_node_cache_handler);\n        do {\n            curr_leaf =\n                cache.get(domain, BPT_NEXT(curr_leaf) - 1, &bpt_node_cache_handler);\n\n            if (BPT_LEADING(curr_leaf) == 0) {\n                void *d = giggle_data_handler.new_leading(domain);\n                uint32_t v_id = cache.seen(domain) + 1;\n                cache.add(\n                    domain,\n                    v_id - 1,\n                    d,\n                    sizeof(void *),\n                    &giggle_data_handler.leading_cache_handler\n                );\n                giggle_data_handler.leading_B_add_scalar(domain, d, &id);\n                BPT_LEADING(curr_leaf) = v_id;\n            } else {\n                void *d = cache.get(\n                    domain,\n                    BPT_LEADING(curr_leaf) - 1,\n                    &giggle_data_handler.leading_cache_handler\n                );\n                giggle_data_handler.leading_B_add_scalar(domain, d, &id);\n            }\n        } while (BPT_ID(curr_leaf) != end_leaf_id);\n    }\n\n    return 0;\n}\n//}}}\n\n//{{{ void *giggle_search(uint32_t domain,\nvoid *giggle_search(uint32_t domain, uint32_t root_id, uint32_t start, uint32_t end) {\n#if GIGGLE_QUERY_TRACE\n    fprintf(stderr, \"giggle_search\\tdomain:%u\\tstart:%u\\tend:%u\\n\", domain, start, end);\n#endif\n\n    if (root_id == 0)\n        return 0;\n\n    uint32_t leaf_start_id;\n    int pos_start_id;\n\n    uint32_t nld_start_id =\n        bpt_find(domain, root_id, &leaf_start_id, &pos_start_id, start);\n    struct bpt_node *leaf_start =\n        cache.get(domain, leaf_start_id - 1, &bpt_node_cache_handler);\n    if ((pos_start_id == 0) && (BPT_KEYS(leaf_start)[0] != start))\n        pos_start_id = -1;\n    else if ((pos_start_id >= 0) && (pos_start_id < BPT_NUM_KEYS(leaf_start)) && (BPT_KEYS(leaf_start)[pos_start_id] > start))\n        pos_start_id -= 1;\n\n#if GIGGLE_QUERY_TRACE\n    fprintf(stderr, \"leaf_start_id:%u\\tpos_start_id:%d\\n\", leaf_start_id, pos_start_id);\n#endif\n\n    uint32_t leaf_end_id;\n    int pos_end_id;\n\n    uint32_t nld_end_id = bpt_find(domain, root_id, &leaf_end_id, &pos_end_id, end);\n\n    struct bpt_node *leaf_end =\n        cache.get(domain, leaf_end_id - 1, &bpt_node_cache_handler);\n\n    if ((pos_end_id == 0) && (BPT_KEYS(leaf_end)[0] != end))\n        pos_end_id = -1;\n    else if ((pos_end_id >= 0) && (pos_end_id < BPT_NUM_KEYS(leaf_end)) && (BPT_KEYS(leaf_end)[pos_end_id] > end))\n        pos_end_id -= 1;\n\n#if GIGGLE_QUERY_TRACE\n    fprintf(stderr, \"leaf_end_id:%u\\tpos_end_id:%u\\t\\n\", leaf_end_id, pos_end_id);\n#endif\n\n#if GIGGLE_QUERY_TRACE\n    fprintf(\n        stderr,\n        \"pos_end_id:%d %u\\n\",\n        pos_end_id,\n        (((pos_end_id >= 0) && (pos_end_id < BPT_NUM_KEYS(leaf_end)))\n             ? BPT_KEYS(leaf_end)[pos_end_id]\n             : 0)\n    );\n#endif\n\n    // if ((leaf_start_id == leaf_end_id) && (pos_start_id >= pos_end_id))\n    if ((leaf_start_id == leaf_end_id) && (pos_start_id > pos_end_id))\n        return NULL;\n\n#if GIGGLE_QUERY_TRACE\n    if (BPT_LEADING(leaf_start) == 0)\n        fprintf(stderr, \"BPT_LEADING(leaf_start) == 0\\n\");\n#endif\n\n    return giggle_data_handler.giggle_collect_intersection(\n        leaf_start_id, pos_start_id, leaf_end_id, pos_end_id, domain, NULL\n    );\n}\n//}}}\n\n//{{{void *giggle_collect_intersection_data_in_block(uint32_t leaf_start_id,\nvoid *giggle_collect_intersection_data_in_block(\n    uint32_t leaf_start_id,\n    int pos_start_id,\n    uint32_t leaf_end_id,\n    int pos_end_id,\n    uint32_t domain,\n    void **r\n) {\n#if DEBUG\n    fprintf(stderr, \"giggle_collect_intersection_data_in_block\\n\");\n#endif\n\n    uint32_t I_size = giggle_leaf_data_get_intersection_size(\n        leaf_start_id, pos_start_id, leaf_end_id, pos_end_id, domain\n    );\n\n#if GIGGLE_QUERY_TRACE\n    fprintf(\n        stderr,\n        \"giggle_collect_intersection_data_in_block\\t\"\n        \"I_size:%u\\n\",\n        I_size\n    );\n#endif\n\n    uint64_t *I = (uint64_t *)calloc(I_size, sizeof(uint64_t));\n    if (I == NULL)\n        err(1, \"calloc error in giggle_collect_intersection_data_in_block()\");\n\n    struct bpt_node *leaf_start =\n        cache.get(domain, leaf_start_id - 1, &bpt_node_cache_handler);\n    struct leaf_data *leaf_start_data =\n        cache.get(domain, BPT_POINTERS_BLOCK(leaf_start) - 1, &leaf_data_cache_handler);\n\n    // get everything in the leading value\n\n    // The first step is to take the leading and the starts up to\n    // and including pos_start_id and remove ends up to and including\n    // pos_start_id\n    uint32_t buff_size =\n        leaf_start_data->num_leading +\n        leaf_data_starts_end(leaf_start_data, leaf_start, pos_start_id) +\n        leaf_data_ends_end(leaf_start_data, leaf_start, pos_start_id);\n\n#if GIGGLE_QUERY_TRACE\n    fprintf(\n        stderr,\n        \"giggle_collect_intersection_data_in_block\\t\"\n        \"leaf_start_data->num_leading:%u \"\n        \"leaf_start_data->num_starts:%u \"\n        \"leaf_start_data->num_ends:%u\\n\",\n        leaf_start_data->num_leading,\n        leaf_start_data->num_starts,\n        leaf_start_data->num_ends\n    );\n#endif\n\n#if GIGGLE_QUERY_TRACE\n    fprintf(\n        stderr,\n        \"giggle_collect_intersection_data_in_block\\t\"\n        \"leaf_start_data->num_leading:%u \"\n        \"leaf_data_starts_end:%u \"\n        \"leaf_data_ends_end:%u \"\n        \"buff_size:%u\\n\",\n        leaf_start_data->num_leading,\n        leaf_data_starts_end(leaf_start_data, leaf_start, pos_start_id),\n        leaf_data_ends_end(leaf_start_data, leaf_start, pos_start_id),\n        buff_size\n    );\n#endif\n\n    uint64_t *buff = (uint64_t *)calloc(buff_size, sizeof(uint64_t));\n    if (buff == NULL)\n        err(1, \"calloc error in giggle_collect_intersection_data_in_block()\");\n\n    memcpy(\n        buff, leaf_start_data->leading, leaf_start_data->num_leading * sizeof(uint64_t)\n    );\n\n    uint32_t j;\n#if GIGGLE_QUERY_TRACE\n    for (j = 0; j < leaf_start_data->num_leading; ++j)\n        fprintf(stderr, \"leading\\t%llu\\n\", leaf_start_data->leading[j]);\n#endif\n\n    memcpy(\n        buff + leaf_start_data->num_leading,\n        leaf_start_data->starts,\n        leaf_data_starts_end(leaf_start_data, leaf_start, pos_start_id) *\n            sizeof(uint64_t)\n    );\n\n#if GIGGLE_QUERY_TRACE\n    for (j = 0; j < leaf_data_starts_end(leaf_start_data, leaf_start, pos_start_id);\n         ++j)\n        fprintf(stderr, \"starts\\t%llu\\n\", leaf_start_data->starts[j]);\n#endif\n\n    memcpy(\n        buff + leaf_start_data->num_leading +\n            leaf_data_starts_end(leaf_start_data, leaf_start, pos_start_id),\n        leaf_start_data->ends,\n        leaf_data_ends_end(leaf_start_data, leaf_start, pos_start_id) * sizeof(uint64_t)\n    );\n\n#if GIGGLE_QUERY_TRACE\n    for (j = 0; j < leaf_data_ends_end(leaf_start_data, leaf_start, pos_start_id); ++j)\n        fprintf(stderr, \"ends\\t%llu\\n\", leaf_start_data->ends[j]);\n#endif\n\n    qsort(buff, buff_size, sizeof(uint64_t), uint64_t_cmp);\n\n    uint32_t i, I_i = 0;\n    for (i = 0; i < buff_size; ++i) {\n        if (((i + 1) == buff_size) || (buff[i] != buff[i + 1])) {\n            I[I_i++] = buff[i];\n            if (I_i > I_size) {\n                bpt_print_node(leaf_start);\n                leaf_data_print(leaf_start_data);\n                errx(\n                    1,\n                    \"Error in giggle_collect_intersection_data_in_block. Exceeded \"\n                    \"intersection size.\"\n                );\n            }\n        } else {\n            i += 1;\n        }\n    }\n    free(buff);\n\n    // now process everything in between the start and end\n    struct bpt_node *leaf_curr = leaf_start;\n    int pos_curr_id = pos_start_id + 1;\n    struct leaf_data *ld;\n    uint32_t curr_size;\n\n    // any intermediate leaves\n    while (BPT_ID(leaf_curr) != leaf_end_id) {\n        // do from pos_curr to the last key\n        ld = cache.get(\n            domain, BPT_POINTERS_BLOCK(leaf_curr) - 1, &leaf_data_cache_handler\n        );\n\n        curr_size = leaf_data_starts_end(ld, leaf_curr, BPT_NUM_KEYS(leaf_curr) - 1) -\n                    leaf_data_starts_start(ld, leaf_curr, pos_curr_id);\n        memcpy(\n            I + I_i,\n            ld->starts + leaf_data_starts_start(ld, leaf_curr, pos_curr_id),\n            curr_size * sizeof(uint64_t)\n        );\n\n        I_i += curr_size;\n\n        leaf_curr = cache.get(domain, BPT_NEXT(leaf_curr) - 1, &bpt_node_cache_handler);\n        pos_curr_id = 0;\n    }\n\n    ld = cache.get(domain, BPT_POINTERS_BLOCK(leaf_curr) - 1, &leaf_data_cache_handler);\n\n    curr_size = leaf_data_starts_end(ld, leaf_curr, pos_end_id) -\n                leaf_data_starts_start(ld, leaf_curr, pos_curr_id);\n\n    memcpy(\n        I + I_i,\n        ld->starts + leaf_data_starts_start(ld, leaf_curr, pos_curr_id),\n        curr_size * sizeof(uint64_t)\n    );\n\n    struct leaf_data_result *ldr =\n        (struct leaf_data_result *)calloc(1, sizeof(struct leaf_data_result));\n    if (ldr == NULL)\n        err(1, \"calloc error in giggle_collect_intersection_data_in_block()\");\n\n    ldr->len = I_size;\n    ldr->data = I;\n    ldr->next = NULL;\n\n#if GIGGLE_QUERY_TRACE\n    for (i = 0; i < I_i; ++i)\n        fprintf(\n            stderr,\n            \"giggle_collect_intersection_data_in_block\\t\"\n            \"i:%u I[i]:%llu\\n\",\n            i,\n            I[i]\n        );\n#endif\n\n    if ((r == NULL) || (*r == NULL)) {\n        return ldr;\n    } else {\n        ((struct leaf_data_result *)*r)->next = ldr;\n        //*r = ldr;\n    }\n\n    return ldr;\n}\n//}}}\n\n//{{{uint32_t giggle_leaf_data_get_intersection_size(uint32_t leaf_start_id,\nuint32_t giggle_leaf_data_get_intersection_size(\n    uint32_t leaf_start_id,\n    int pos_start_id,\n    uint32_t leaf_end_id,\n    int pos_end_id,\n    uint32_t domain\n) {\n#if DEBUG\n    fprintf(\n        stderr,\n        \"giggle_leaf_data_get_intersection_size\\t\"\n        \"leaf_start_id:%u\\t\"\n        \"pos_start_id:%d\\t\"\n        \"leaf_end_id:%u\\t\"\n        \"pos_end_id:%d\\t\"\n        \"domain:%u\\n\",\n        leaf_start_id,\n        pos_start_id,\n        leaf_end_id,\n        pos_end_id,\n        domain\n    );\n#endif\n\n    struct bpt_node *leaf_start =\n        cache.get(domain, leaf_start_id - 1, &bpt_node_cache_handler);\n    struct leaf_data *leaf_start_data =\n        cache.get(domain, BPT_POINTERS_BLOCK(leaf_start) - 1, &leaf_data_cache_handler);\n\n    // Find sizes\n    // get everything in the leading value\n    uint32_t i_size = leaf_start_data->num_leading;\n#if DEBUG\n    fprintf(\n        stderr,\n        \"leaf_start_data->num_leading:%llu\\t\"\n        \"->num_starts:%llu\\t\"\n        \"->num_ends:%llu\\n\",\n        leaf_start_data->num_leading,\n        leaf_start_data->num_starts,\n        leaf_start_data->num_ends\n    );\n#endif\n\n    uint32_t i;\n\n    i_size += leaf_data_starts_end(leaf_start_data, leaf_start, pos_start_id);\n    i_size -= leaf_data_ends_end(leaf_start_data, leaf_start, pos_start_id);\n\n#if DEBUG\n    fprintf(\n        stderr,\n        \"leaf_data_starts_end:%u\\t\"\n        \"leaf_data_ends_end:%u\\n\",\n        leaf_data_starts_end(leaf_start_data, leaf_start, pos_start_id),\n        leaf_data_ends_end(leaf_start_data, leaf_start, pos_start_id)\n    );\n\n    fprintf(stderr, \"i_size:%u\\n\", i_size);\n#endif\n\n    // now process everything in between the start and end\n    struct bpt_node *leaf_curr = leaf_start;\n    struct leaf_data *leaf_curr_data = leaf_start_data;\n    int pos_curr_id = pos_start_id + 1;\n\n    // any intermediate leaves\n    while (BPT_ID(leaf_curr) != leaf_end_id) {\n#if DEBUG\n        fprintf(\n            stderr,\n            \"leaf_curr:%u\\t\"\n            \"BPT_NUM_KEYS(leaf_curr):%u\\t\"\n            \"pos_curr_id:%u\\t\"\n            \"leaf_data_starts_end:%u\\t\"\n            \"leaf_data_starts_start:%u\\t%u\\n\",\n            BPT_ID(leaf_curr),\n            BPT_NUM_KEYS(leaf_curr),\n            pos_curr_id,\n            leaf_data_starts_end(\n                leaf_curr_data, leaf_curr, BPT_NUM_KEYS(leaf_curr) - 1\n            ),\n            leaf_data_starts_start(leaf_curr_data, leaf_curr, pos_curr_id),\n            leaf_data_starts_end(\n                leaf_curr_data, leaf_curr, BPT_NUM_KEYS(leaf_curr) - 1\n            ) - leaf_data_starts_start(leaf_curr_data, leaf_curr, pos_curr_id)\n        );\n#endif\n\n        // do from pos_curr to the last key\n        i_size += leaf_data_starts_end(\n                      leaf_curr_data, leaf_curr, BPT_NUM_KEYS(leaf_curr) - 1\n                  ) -\n                  leaf_data_starts_start(leaf_curr_data, leaf_curr, pos_curr_id);\n\n#if DEBUG\n        fprintf(stderr, \"i_size:%u\\n\", i_size);\n#endif\n\n        leaf_curr = cache.get(domain, BPT_NEXT(leaf_curr) - 1, &bpt_node_cache_handler);\n        leaf_curr_data = cache.get(\n            domain, BPT_POINTERS_BLOCK(leaf_curr) - 1, &leaf_data_cache_handler\n        );\n\n        pos_curr_id = 0;\n    }\n\n    i_size += leaf_data_starts_end(leaf_curr_data, leaf_curr, pos_end_id) -\n              leaf_data_starts_start(leaf_curr_data, leaf_curr, pos_curr_id);\n\n    return i_size;\n}\n//}}}\n\n//{{{void *giggle_collect_intersection_data_in_pointers(uint32_t\nvoid *giggle_collect_intersection_data_in_pointers(\n    uint32_t leaf_start_id,\n    int pos_start_id,\n    uint32_t leaf_end_id,\n    int pos_end_id,\n    uint32_t domain,\n    void **_r\n) {\n    void *r = NULL;\n#if DEBUG\n    fprintf(stderr, \"giggle_collect_intersection_data_in_pointers\\n\");\n#endif\n\n    struct bpt_node *leaf_start =\n        cache.get(domain, leaf_start_id - 1, &bpt_node_cache_handler);\n\n    // get everything in the leading value\n    if (BPT_LEADING(leaf_start) != 0) {\n        void *ld = cache.get(\n            domain,\n            BPT_LEADING(leaf_start) - 1,\n            &giggle_data_handler.leading_cache_handler\n        );\n\n        giggle_data_handler.leading_union_with_B(domain, &r, ld);\n    }\n\n    // add any SA and remove any that are an SE up to and including this point\n    int i;\n    for (i = 0; (i < BPT_NUM_KEYS(leaf_start)) && (i <= pos_start_id); ++i) {\n#if DEBUG\n        fprintf(stderr, \"BPT_KEY(leaf_start)[%u] == %u\\n\", i, BPT_KEYS(leaf_start)[i]);\n#endif\n        void *nld = cache.get(\n            domain,\n            BPT_POINTERS(leaf_start)[i] - 1,\n            &giggle_data_handler.non_leading_cache_handler\n        );\n        giggle_data_handler.non_leading_union_with_SA_subtract_SE(domain, &r, nld);\n    }\n\n    // now process everything in between the start and end\n    struct bpt_node *leaf_curr = leaf_start;\n    int pos_curr_id = pos_start_id + 1;\n\n    // any intermediate leaves\n    while (BPT_ID(leaf_curr) != leaf_end_id) {\n        // do from pos_curr to the last key\n        for (i = pos_curr_id; i < BPT_NUM_KEYS(leaf_curr); ++i) {\n            void *nld = cache.get(\n                domain,\n                BPT_POINTERS(leaf_curr)[i] - 1,\n                &giggle_data_handler.non_leading_cache_handler\n            );\n            giggle_data_handler.non_leading_union_with_SA(domain, &r, nld);\n        }\n\n        leaf_curr = cache.get(domain, BPT_NEXT(leaf_curr) - 1, &bpt_node_cache_handler);\n        pos_curr_id = 0;\n    }\n\n    if (BPT_ID(leaf_curr) == leaf_end_id) {\n        // add all SA's from here to either the end point\n        for (i = pos_curr_id; (i < BPT_NUM_KEYS(leaf_curr)) && (i <= pos_end_id); ++i) {\n            void *nld = cache.get(\n                domain,\n                BPT_POINTERS(leaf_curr)[i] - 1,\n                &giggle_data_handler.non_leading_cache_handler\n            );\n            giggle_data_handler.non_leading_union_with_SA(domain, &r, nld);\n        }\n    }\n\n    return r;\n}\n//}}}\n\nstruct giggle_index *giggle_init_index(uint32_t init_size, char *offset_file_name) {\n    return giggle_init_index_with_metadata(init_size, offset_file_name, NULL, NULL);\n}\n\nstruct giggle_index *giggle_init_index_with_metadata(\n    uint32_t init_size,\n    char *offset_file_name,\n    char *metadata_conf_name,\n    char *metadata_file_name\n) {\n    struct giggle_index *gi =\n        (struct giggle_index *)malloc(sizeof(struct giggle_index));\n    if (gi == NULL)\n        err(1, \"malloc error in giggle_init_index()\");\n\n    gi->data_dir = NULL;\n    gi->len = init_size;\n    gi->num = 0;\n    gi->root_ids = (uint32_t *)calloc(sizeof(uint32_t), gi->len);\n    if (gi->root_ids == NULL)\n        err(1, \"calloc error in giggle_init_index()\");\n\n    gi->chrm_idx = chrm_index_init(init_size, NULL);\n    gi->file_idx = file_index_init(3, NULL);\n\n    gi->offset_idx = offset_index_init(1000, offset_file_name);\n    gi->metadata_idx = NULL;\n    if (metadata_conf_name != NULL) {\n        gi->metadata_idx = metadata_index_init(metadata_conf_name, metadata_file_name);\n    }\n\n    gi->root_ids_file_name = NULL;\n\n    return gi;\n}\n//}}}\n\n//{{{int giggle_get_chrm_id(struct giggle_index *gi, char *chrm)\nuint32_t giggle_get_chrm_id(struct giggle_index *gi, char *chrm) {\n    struct str_uint_pair *r = chrm_index_get(gi->chrm_idx, chrm);\n\n    if (r == NULL) {\n        uint32_t id = chrm_index_add(gi->chrm_idx, chrm);\n        uint32_t size = gi->chrm_idx->index->num;\n\n        gi->num += 1;\n\n        if (gi->len < size) {\n            gi->root_ids = realloc(gi->root_ids, (size) * sizeof(uint32_t));\n            if (gi->root_ids == NULL)\n                err(1, \"realloc error in giggle_get_chrm_id()\");\n            gi->len = size;\n            uint32_t i;\n            for (i = gi->num; i < gi->len; ++i)\n                gi->root_ids[i] = 0;\n        }\n\n        return id;\n    }\n\n    return r->uint;\n}\n//}}}\n\n//{{{void giggle_index_destroy(struct giggle_index **gi)\nvoid giggle_index_destroy(struct giggle_index **gi) {\n    if ((*gi)->root_ids_file_name != NULL)\n        free((*gi)->root_ids_file_name);\n    if ((*gi)->data_dir != NULL)\n        free((*gi)->data_dir);\n\n    free((*gi)->root_ids);\n\n    file_index_destroy(&((*gi)->file_idx));\n\n    offset_index_destroy(&((*gi)->offset_idx));\n\n    if ((*gi)->metadata_idx)\n        metadata_index_destroy(&((*gi)->metadata_idx));\n\n    chrm_index_destroy(&((*gi)->chrm_idx));\n\n    free(*gi);\n    *gi = NULL;\n}\n//}}}\n\n//{{{uint32_t giggle_index_file(struct giggle_index *gi,\nuint32_t giggle_index_file(struct giggle_index *gi, char *file_name) {\n    // fprintf(stderr, \"%s\\n\", file_name);\n    struct input_file *i = input_file_init(file_name);\n    if (i == NULL)\n        errx(1, \"Could not open %s.\\n\", file_name);\n\n    int chrm_len = 10;\n    char *chrm = (char *)malloc(chrm_len * sizeof(char));\n    if (chrm == NULL)\n        err(1, \"realloc error in giggle_index_file()\");\n\n    uint32_t start, end;\n    long offset;\n    kstring_t line = {0, 0, NULL};\n\n    uint32_t file_id = file_index_add(gi->file_idx, file_name);\n    struct file_data *fd = file_index_get(gi->file_idx, file_id);\n\n    uint32_t j = 0;\n\n    struct file_id_offset_pair *p;\n    uint64_t intrv_id;\n\n    while (i->input_file_get_next_interval(\n               i, &chrm, &chrm_len, &start, &end, &offset, &line\n           ) >= 0) {\n        // fprintf(stderr, \"%s %u %u\\n\", chrm, start, end);\n        intrv_id = offset_index_add(gi->offset_idx, offset, &line, file_id);\n\n        uint32_t chrm_id = giggle_get_chrm_id(gi, chrm);\n        uint32_t r =\n            giggle_insert(chrm_id, &(gi->root_ids[chrm_id]), start, end, intrv_id);\n        fd->mean_interval_size += end - start;\n        fd->num_intervals += 1;\n        j += 1;\n    }\n    fd->mean_interval_size = fd->mean_interval_size / fd->num_intervals;\n\n    if (line.s != NULL)\n        free(line.s);\n\n    input_file_destroy(&i);\n    free(chrm);\n    return (j);\n}\n//}}}\n\n//{{{void giggle_query_region(struct giggle_index *gi,\nvoid *giggle_query_region(\n    struct giggle_index *gi,\n    char *chrm,\n    uint32_t start,\n    uint32_t end\n) {\n    uint32_t off = 0;\n    if (strncmp(\"chr\", chrm, 3) == 0)\n        off = 3;\n\n    uint32_t chr_id = giggle_get_chrm_id(gi, chrm + off);\n    return giggle_search(chr_id, gi->root_ids[chr_id], start, end);\n}\n//}}}\n\n//{{{uint32_t giggle_index_directory(struct giggle_index *gi,\nuint32_t giggle_index_directory(struct giggle_index *gi, char *path_name, int verbose) {\n    glob_t results;\n    int ret = glob(path_name, 0, NULL, &results);\n    if (ret != 0)\n        fprintf(\n            stderr,\n            \"Problem with %s (%s), stopping early\\n\",\n            path_name,\n            /* ugly: */\n            (ret == GLOB_ABORTED   ? \"filesystem problem\"\n             : ret == GLOB_NOMATCH ? \"no match of pattern\"\n             : ret == GLOB_NOSPACE ? \"no dynamic memory\"\n                                   : \"unknown problem\")\n        );\n\n    int i;\n    uint32_t total = 0;\n    for (i = 0; i < results.gl_pathc; i++) {\n        if (verbose)\n            fprintf(stderr, \"%s\\n\", results.gl_pathv[i]);\n        total += giggle_index_file(gi, results.gl_pathv[i]);\n    }\n\n    globfree(&results);\n\n    return total;\n}\n//}}}\n\nstruct giggle_index *giggle_init(\n    uint32_t num_chrms,\n    char *data_dir,\n    uint32_t force,\n    void (*giggle_set_data_handler)()\n) {\n    return giggle_init_with_metadata(\n        num_chrms, data_dir, NULL, force, giggle_set_data_handler\n    );\n}\n\nstruct giggle_index *giggle_init_with_metadata(\n    uint32_t num_chrms,\n    char *data_dir,\n    char *metadata_conf_filename,\n    uint32_t force,\n    void (*giggle_set_data_handler)()\n) {\n    if (data_dir == NULL)\n        errx(1, \"giggle_init: data_dir cannot be NULL.\");\n\n    char **cache_names = NULL;\n\n    struct stat st = {0};\n    if (stat(data_dir, &st) == -1) {\n        mkdir(data_dir, 0700);\n    } else if (force == 1) {\n        rmrf(data_dir);\n        mkdir(data_dir, 0700);\n    } else {\n        fprintf(\n            stderr,\n            \"The directory '%s' already exists. \"\n            \"Use the force option to overwrite.\\n\",\n            data_dir\n        );\n        return NULL;\n    }\n\n    cache_names = (char **)calloc(num_chrms, sizeof(char *));\n    if (cache_names == NULL)\n        err(1, \"calloc error in giggle_init()\");\n\n    uint32_t i, ret;\n    for (i = 0; i < num_chrms; ++i) {\n        ret =\n            asprintf(&(cache_names[i]), \"%s/%s%u\", data_dir, CACHE_FILE_NAME_PREFIX, i);\n    }\n\n    char *offset_idx_name = NULL;\n    ret = asprintf(&offset_idx_name, \"%s/%s\", data_dir, OFFSET_INDEX_FILE_NAME);\n\n    char *metadata_idx_name = NULL;\n    if (metadata_conf_filename != NULL)\n        ret = asprintf(&metadata_idx_name, \"%s/%s\", data_dir, METADATA_INDEX_FILE_NAME);\n\n    struct giggle_index *gi = giggle_init_index_with_metadata(\n        num_chrms, offset_idx_name, metadata_conf_filename, metadata_idx_name\n    );\n    gi->data_dir = strdup(data_dir);\n\n    struct simple_cache *sc = simple_cache_init(1000, num_chrms, cache_names);\n\n    // uint64_t_ll_giggle_set_data_handler();\n    giggle_set_data_handler();\n\n    ret = asprintf(&(gi->chrm_idx->file_name), \"%s/%s\", data_dir, CHRM_INDEX_FILE_NAME);\n\n    ret = asprintf(&(gi->file_idx->file_name), \"%s/%s\", data_dir, FILE_INDEX_FILE_NAME);\n\n    ret = asprintf(&(gi->root_ids_file_name), \"%s/%s\", data_dir, ROOT_IDS_FILE_NAME);\n\n    for (i = 0; i < num_chrms; ++i)\n        free(cache_names[i]);\n    free(cache_names);\n\n    free(offset_idx_name);\n    free(metadata_idx_name);\n\n    return gi;\n}\n//}}}\n\n//{{{ uint32_t giggle_store(struct giggle_index *gi)\nuint32_t giggle_store(struct giggle_index *gi) {\n    if (gi->chrm_idx->file_name == NULL)\n        return 1;\n\n    uint32_t i;\n\n    giggle_data_handler.write_tree(gi);\n\n    FILE *f = fopen(gi->root_ids_file_name, \"wb\");\n\n    if (fwrite(&(gi->len), sizeof(uint32_t), 1, f) != 1)\n        err(EX_IOERR, \"Error writing len for root_ids'%s'.\", gi->root_ids_file_name);\n\n    if (fwrite(&(gi->num), sizeof(uint32_t), 1, f) != 1)\n        err(EX_IOERR, \"Error writing num for root_ids'%s'.\", gi->root_ids_file_name);\n\n    if (fwrite(gi->root_ids, sizeof(uint32_t), gi->len, f) != gi->len)\n        err(EX_IOERR, \"Error writing root_ids '%s'.\", gi->root_ids_file_name);\n    fclose(f);\n\n    chrm_index_store(gi->chrm_idx);\n\n    file_index_store(gi->file_idx);\n\n    offset_index_store(gi->offset_idx);\n    return 0;\n}\n//}}}\n\nstruct giggle_index *giggle_load(\n    char *data_dir,\n    void (*giggle_set_data_handler)(void)\n) {\n    return giggle_load_with_metadata(data_dir, 0, giggle_set_data_handler);\n}\n\nstruct giggle_index *giggle_load_with_metadata(\n    char *data_dir,\n    int load_metadata,\n    void (*giggle_set_data_handler)(void)\n) {\n    // ORDER = 100;\n\n    if (data_dir == NULL)\n        return NULL;\n\n    struct stat st = {0};\n    if (stat(data_dir, &st) == -1)\n        return NULL;\n\n    struct giggle_index *gi =\n        (struct giggle_index *)malloc(sizeof(struct giggle_index));\n    if (gi == NULL)\n        err(1, \"calloc error in giggle_load()\");\n\n    gi->data_dir = strdup(data_dir);\n\n    // root_ids\n#ifdef TIME\n    struct timeval read_root_ids = in();\n#endif\n    int ret =\n        asprintf(&(gi->root_ids_file_name), \"%s/%s\", data_dir, ROOT_IDS_FILE_NAME);\n\n    FILE *f = fopen(gi->root_ids_file_name, \"rb\");\n    if (f == NULL)\n        err(1, \"Could not open file '%s'.\\n\", gi->root_ids_file_name);\n\n    size_t fr = fread(&(gi->len), sizeof(uint32_t), 1, f);\n    check_file_read(gi->root_ids_file_name, f, 1, fr);\n\n    fr = fread(&(gi->num), sizeof(uint32_t), 1, f);\n    check_file_read(gi->root_ids_file_name, f, 1, fr);\n\n    gi->root_ids = (uint32_t *)calloc(gi->len, sizeof(uint32_t));\n    if (gi->root_ids == NULL)\n        err(1, \"calloc error in giggle_load()\");\n\n    fr = fread(gi->root_ids, sizeof(uint32_t), gi->len, f);\n    check_file_read(gi->root_ids_file_name, f, gi->len, fr);\n\n    fclose(f);\n#ifdef TIME\n    fprintf(stderr, \"giggle_load\\tread root_ids\\t%lu\\n\", out(read_root_ids));\n#endif\n\n    // chrm_index\n#ifdef TIME\n    struct timeval read_chrm_index = in();\n#endif\n    char *chrm_index_file_name = NULL;\n\n    ret = asprintf(&chrm_index_file_name, \"%s/%s\", data_dir, CHRM_INDEX_FILE_NAME);\n\n    gi->chrm_idx = chrm_index_load(chrm_index_file_name);\n    free(chrm_index_file_name);\n#ifdef TIME\n    fprintf(stderr, \"giggle_load\\tread chrm_index\\t%lu\\n\", out(read_chrm_index));\n#endif\n\n#ifdef TIME\n    struct timeval read_file_index = in();\n#endif\n\n    char *file_index_file_name = NULL;\n    ret = asprintf(&file_index_file_name, \"%s/%s\", data_dir, FILE_INDEX_FILE_NAME);\n    gi->file_idx = file_index_load(file_index_file_name);\n    free(file_index_file_name);\n#ifdef TIME\n    fprintf(stderr, \"giggle_load\\tread file_index\\t%lu\\n\", out(read_file_index));\n#endif\n\n#ifdef TIME\n    struct timeval read_offset_index = in();\n#endif\n    char *offset_index_file_name = NULL;\n    ret = asprintf(&offset_index_file_name, \"%s/%s\", data_dir, OFFSET_INDEX_FILE_NAME);\n    gi->offset_idx = offset_index_load(offset_index_file_name);\n    free(offset_index_file_name);\n\n    gi->metadata_idx = NULL;\n    if (load_metadata) {\n        char *metadata_index_file_name = NULL;\n        ret = asprintf(\n            &metadata_index_file_name, \"%s/%s\", data_dir, METADATA_INDEX_FILE_NAME\n        );\n        gi->metadata_idx = metadata_index_load(metadata_index_file_name);\n        free(metadata_index_file_name);\n\n        // prints the summary of the metadata index\n        // print_metadata_index(gi->metadata_idx);\n\n        // Warning- prints all the intervals if uncommented\n        // struct metadata_rows *metadata_rows =\n        // read_metadata_rows(gi->metadata_idx); print_metadata_rows(metadata_rows);\n        // metadata_rows_destroy(metadata_rows);\n    }\n\n#ifdef TIME\n    fprintf(stderr, \"giggle_load\\tread offset_index\\t%lu\\n\", out(read_offset_index));\n#endif\n\n    // start();\n    char **cache_names = (char **)calloc(gi->len, sizeof(char *));\n    if (cache_names == NULL)\n        err(1, \"calloc error in giggle_load()\");\n\n    uint32_t i;\n    for (i = 0; i < gi->len; ++i) {\n        ret =\n            asprintf(&(cache_names[i]), \"%s/%s%u\", data_dir, CACHE_FILE_NAME_PREFIX, i);\n    }\n\n#ifdef TIME\n    struct timeval load_simple_cache = in();\n#endif\n    struct simple_cache *sc = simple_cache_init(1000, gi->len, cache_names);\n    for (i = 0; i < gi->len; ++i)\n        free(cache_names[i]);\n    free(cache_names);\n\n#ifdef TIME\n    fprintf(\n        stderr, \"giggle_load\\tread load_simple_cache\\t%lu\\n\", out(load_simple_cache)\n    );\n#endif\n\n    giggle_set_data_handler();\n\n    return gi;\n}\n//}}}\n\nstruct giggle_query_result *giggle_query(\n    struct giggle_index *gi,\n    char *chrm,\n    uint32_t start,\n    uint32_t end,\n    struct giggle_query_result *_gqr\n) {\n    return giggle_query_with_query_filter(gi, chrm, start, end, NULL, _gqr);\n}\n\nstruct giggle_query_result *giggle_query_with_query_filter(\n    struct giggle_index *gi,\n    char *chrm,\n    uint32_t start,\n    uint32_t end,\n    struct query_filter *query_filter,\n    struct giggle_query_result *_gqr\n) {\n#if GIGGLE_QUERY_TRACE\n    fprintf(stderr, \"giggle_query\\t%s\\t%u\\t%u\\n\", chrm, start, end);\n#endif\n\n    uint32_t off = 0;\n    if (strncmp(\"chr\", chrm, 3) == 0)\n        off = 3;\n\n    void *R = NULL;\n    struct str_uint_pair *r = chrm_index_get(gi->chrm_idx, chrm + off);\n\n#if GIGGLE_QUERY_TRACE\n    fprintf(\n        stderr,\n        \"giggle_query\\tstr_uint_pair->str:%s\\tstr_uint_pair->uint:%u\\n\",\n        r->str,\n        r->uint\n    );\n#endif\n\n    if (r != NULL) {\n        uint32_t chr_id = giggle_get_chrm_id(gi, chrm + off);\n#if GIGGLE_QUERY_TRACE\n        fprintf(stderr, \"giggle_query\\tchr_id:%u\\n\", chr_id);\n#endif\n        // HERE R COULD BE A LIST\n        R = giggle_search(chr_id, gi->root_ids[chr_id], start, end);\n    }\n\n    uint32_t i, j;\n    struct giggle_query_result *gqr;\n    if (_gqr == NULL) {\n        gqr = (struct giggle_query_result *)malloc(sizeof(struct giggle_query_result));\n        if (gqr == NULL)\n            err(1, \"malloc error in giggle_query()\");\n\n        gqr->gi = gi;\n        gqr->num_files = gi->file_idx->index->num;\n        gqr->num_hits = 0;\n        gqr->offsets = (struct long_uint_ll **)calloc(\n            gi->file_idx->index->num, sizeof(struct long_uint_ll *)\n        );\n        if (gqr->offsets == NULL)\n            err(1, \"calloc error in giggle_query()\");\n\n        for (i = 0; i < gi->file_idx->index->num; ++i) {\n            gqr->offsets[i] = NULL;\n        }\n    } else {\n        gqr = _gqr;\n    }\n\n    if (query_filter != NULL) {\n        apply_query_filter_to_results(gi, query_filter, &R);\n    }\n\n    giggle_data_handler.map_intersection_to_offset_list(gi, gqr, R);\n\n    return gqr;\n}\n//}}}\n\nvoid apply_query_filter_to_results(\n    struct giggle_index *gi,\n    struct query_filter *query_filter,\n    void **R_ptr\n) {\n    struct leaf_data_result *R = (struct leaf_data_result *)*R_ptr;\n    if (!R)\n        return;\n    uint64_t i;\n    uint64_t len = R->len;\n    uint64_t *data = R->data;\n    uint64_t new_len = 0;\n    uint64_t diff;\n    uint8_t column_id = query_filter->column_id;\n    struct metadata_index *metadata_idx = gi->metadata_idx;\n\n    // printf(\"len: %ld, column id: %d\\n\", len, column_id);\n    for (i = 0; i < len; ++i) {\n        struct metadata_item *item =\n            read_metadata_item_by_column_id(metadata_idx, data[i], column_id);\n        int result = filter_metadata_row_by_item(item, query_filter);\n        // printf(\"interval: %ld, \", data[i]);\n        // print_metadata_item(item);\n        // printf(\", result: %d\\n\", result);\n        metadata_item_destroy(item);\n        if (result) {\n            data[new_len++] = data[i];\n        }\n    }\n\n    diff = len - new_len;\n    fprintf(\n        stderr,\n        \"Removed %llu record%s after applying query filter.\\n\",\n        diff,\n        (diff > 1) ? \"s\" : \"\"\n    );\n\n    if (new_len == 0) {\n        free(data);\n        free(R);\n        *R_ptr = NULL;\n    } else {\n        data = (uint64_t *)realloc(data, sizeof(uint64_t) * new_len);\n        if (data == NULL)\n            err(1, \"realloc failure in apply_query_filter_to_results.\\n\");\n\n        // printf(\"new_len: %ld, data: \", new_len);\n        // for (i = 0; i < new_len; ++i) {\n        //     printf(\"%ld \", data[i]);\n        // }\n        // printf(\"\\n\");\n\n        R->len = new_len;\n        R->data = data;\n    }\n}\n\n//{{{void giggle_query_result_destroy(struct giggle_query_result **gqr)\nvoid giggle_query_result_destroy(struct giggle_query_result **gqr) {\n    if (*gqr == NULL)\n        return;\n    uint32_t i;\n    for (i = 0; i < (*gqr)->gi->file_idx->index->num; ++i) {\n        long_uint_ll_free((void **)&((*gqr)->offsets[i]));\n    }\n    free((*gqr)->offsets);\n    free(*gqr);\n    *gqr = NULL;\n}\n//}}}\n\n//{{{uint32_t giggle_get_query_len(struct giggle_query_result *gqr,\nuint32_t giggle_get_query_len(struct giggle_query_result *gqr, uint32_t file_id) {\n    if (gqr->offsets[file_id] == NULL)\n        return 0;\n    else\n        return gqr->offsets[file_id]->len;\n}\n//}}}\n\n//{{{struct giggle_query_iter *giggle_get_query_itr(struct giggle_query_result\nstruct giggle_query_iter *giggle_get_query_itr(\n    struct giggle_query_result *gqr,\n    uint32_t file_id\n) {\n#ifdef DEBUG\n    fprintf(stderr, \"giggle_get_query_itr file_id:%u\\n\", file_id);\n#endif\n\n    struct giggle_query_iter *gqi =\n        (struct giggle_query_iter *)malloc(sizeof(struct giggle_query_iter));\n    if (gqi == NULL)\n        err(1, \"malloc error in giggle_get_query_itr()\");\n\n    gqi->gi = gqr->gi;\n    gqi->curr = 0;\n    gqi->num = 0;\n    gqi->file_id = file_id;\n    gqi->sorted_offsets = NULL;\n    gqi->sorted_offset_id_pairs = NULL;\n    gqi->ipf = NULL;\n\n    if (gqr->offsets[file_id] == NULL)\n        return gqi;\n\n#ifdef DEBUG\n    fprintf(\n        stderr, \"giggle_get_query_itr offsets->len:%u\\n\", gqr->offsets[file_id]->len\n    );\n#endif\n\n    gqi->num = gqr->offsets[file_id]->len;\n\n    gqi->sorted_offsets = (long *)malloc(gqr->offsets[file_id]->len * sizeof(long));\n    if (gqi->sorted_offsets == NULL)\n        err(1, \"malloc error in giggle_get_query_itr()\");\n\n    struct long_uint_ll_node *curr = gqr->offsets[file_id]->head;\n    uint32_t i = 0;\n    while (curr != NULL) {\n        gqi->sorted_offsets[i++] = curr->long_val;\n        curr = curr->next;\n    }\n\n    qsort(gqi->sorted_offsets, gqr->offsets[file_id]->len, sizeof(long), long_cmp);\n\n    return gqi;\n}\n//}}}\n\n//{{{struct giggle_query_iter *giggle_get_query_data_itr(struct\nstruct giggle_query_iter *giggle_get_query_data_itr(\n    struct giggle_query_result *gqr,\n    uint32_t file_id\n) {\n    struct giggle_query_iter *gqi =\n        (struct giggle_query_iter *)malloc(sizeof(struct giggle_query_iter));\n    if (gqi == NULL)\n        err(1, \"malloc error in giggle_get_query_data_itr()\");\n\n    gqi->gi = gqr->gi;\n    gqi->curr = 0;\n    gqi->num = 0;\n    gqi->file_id = file_id;\n    gqi->sorted_offsets = NULL;\n    gqi->sorted_offset_id_pairs = NULL;\n    gqi->ipf = NULL;\n\n    if (gqr->offsets[file_id] == NULL)\n        return gqi;\n\n    gqi->num = gqr->offsets[file_id]->len;\n\n    gqi->sorted_offset_id_pairs = (struct long_uint_pair *)malloc(\n        gqr->offsets[file_id]->len * sizeof(struct long_uint_pair)\n    );\n    if (gqi->sorted_offset_id_pairs == NULL)\n        err(1, \"malloc error in giggle_get_query_data_itr()\");\n\n    struct long_uint_ll_node *curr = gqr->offsets[file_id]->head;\n    uint32_t i = 0;\n    while (curr != NULL) {\n        gqi->sorted_offset_id_pairs[i].long_val = curr->long_val;\n        gqi->sorted_offset_id_pairs[i].uint_val = curr->uint_val;\n        i += 1;\n        curr = curr->next;\n    }\n\n    qsort(\n        gqi->sorted_offset_id_pairs,\n        gqr->offsets[file_id]->len,\n        sizeof(struct long_uint_pair),\n        long_uint_pair_cmp\n    );\n\n    return gqi;\n}\n//}}}\n\n//{{{int giggle_query_next(struct giggle_query_iter *gqi,\nint giggle_query_next(struct giggle_query_iter *gqi, char **result) {\n#ifdef DEBUG\n    fprintf(stderr, \"giggle_query_next num:%u\\tcurr:%u\\n\", gqi->num, gqi->curr);\n#endif\n\n    if ((gqi->num == 0) || (gqi->curr == gqi->num)) {\n#ifdef DEBUG\n        fprintf(stderr, \"giggle_query_next -1\\n\");\n#endif\n        return -1;\n    }\n\n    if (gqi->ipf == NULL) {\n        struct file_data *fd = file_index_get(gqi->gi->file_idx, gqi->file_id);\n        /*\n         * Assuming that the bed files directory is under the same parent as\n         * the giggle index data directory.\n         *\n         * Also assuming that the file names in the giggle index data structure\n         * are relative paths of the form $bed_dir/$file_name.\n         *\n         * Therefore we can construct the absolute path of the bed file by\n         * appending the file name to the parent directory of the giggle index\n         */\n        char index_parent_dir[4096];\n        char index_abs_path[4096];\n\n        if (realpath(gqi->gi->data_dir, index_abs_path) == NULL)\n            errx(1, \"%s not found\\n\", gqi->gi->data_dir);\n\n        safe_dirname(index_abs_path, index_parent_dir);\n\n        char data_abs_path[4096];\n        snprintf(data_abs_path, 4096, \"%s/%s\", index_parent_dir, fd->file_name);\n\n        gqi->ipf = input_file_init(data_abs_path);\n\n        if (gqi->ipf == NULL)\n            errx(1, \"Could not open %s.\\n\", fd->file_name);\n    }\n\n    gqi->ipf->input_file_seek(gqi->ipf, gqi->sorted_offsets[gqi->curr]);\n    gqi->ipf->input_file_get_next_line(gqi->ipf, result);\n\n    gqi->curr += 1;\n\n#ifdef DEBUG\n    fprintf(stderr, \"giggle_query_next 0\\n\");\n#endif\n    return 0;\n}\n//}}}\n\n//{{{int giggle_query_next_data(struct giggle_query_iter *gqi,\nint giggle_query_next_data(struct giggle_query_iter *gqi, void **result) {\n    if ((gqi->num == 0) || (gqi->curr == gqi->num)) {\n        return -1;\n    }\n\n    *result = OFFSET_INDEX_DATA(\n        gqi->gi->offset_idx, gqi->sorted_offset_id_pairs[gqi->curr].uint_val\n    );\n\n    gqi->curr += 1;\n\n    return 0;\n}\n//}}}\n\n//{{{void giggle_iter_destroy(struct giggle_query_iter **gqi)\nvoid giggle_iter_destroy(struct giggle_query_iter **gqi) {\n    if ((*gqi)->ipf != NULL)\n        input_file_destroy(&((*gqi)->ipf));\n    if ((*gqi)->sorted_offsets != NULL)\n        free((*gqi)->sorted_offsets);\n    if ((*gqi)->sorted_offset_id_pairs != NULL)\n        free((*gqi)->sorted_offset_id_pairs);\n    free(*gqi);\n    *gqi = NULL;\n}\n//}}}\n\n//{{{ void giggle_write_tree_cache_dump(void *giggle_index)\nvoid giggle_write_tree_cache_dump(void *giggle_index) {\n    struct giggle_index *gi = (struct giggle_index *)giggle_index;\n    uint32_t domain;\n    for (domain = 0; domain < gi->num; ++domain) {\n        bpt_write_tree(domain, gi->root_ids[domain]);\n    }\n}\n//}}}\n\n//{{{ void giggle_write_tree_leaf_data(void *giggle_index)\nvoid giggle_write_tree_leaf_data(void *giggle_index) {\n#if DEBUG\n    fprintf(stderr, \"giggle_write_tree_leaf_data\\n\");\n#endif\n\n    struct giggle_index *gi = (struct giggle_index *)giggle_index;\n    struct simple_cache *sc = (struct simple_cache *)_cache[CACHE_NAME_SPACE];\n\n    // we will use this node to fill in the new values for all the nodes that\n    // are in cache\n    struct bpt_node *to_write_node = (struct bpt_node *)malloc(sizeof(struct bpt_node));\n    if (to_write_node == NULL)\n        err(1, \"malloc error in giggle_write_tree_leaf_data()\");\n\n    to_write_node->data = (uint32_t *)calloc(BPT_NODE_NUM_ELEMENTS, sizeof(uint32_t));\n    if (to_write_node->data == NULL)\n        err(1, \"malloc error in giggle_write_tree_leaf_data()\");\n\n    uint32_t domain;\n    for (domain = 0; domain < gi->num; ++domain) {\n        if (sc->dss[domain] != NULL)\n            errx(1, \"Modifying and existing bpt is not currently supported.\");\n\n        // estimate the number of elements we want to write out, this is not\n        // exactly right, but that is okay\n        uint32_t num_seen = cache.seen(domain) / 2;\n\n        // Each new node or leaf data in this domain will be appended to this\n        // disk store\n        struct disk_store *ds = disk_store_init(\n            sc->seens[domain],\n            NULL,\n            sc->index_file_names[domain],\n            NULL,\n            sc->data_file_names[domain]\n        );\n\n        // Use old_id_to_new_id_os to maintain the mapping between the IDs that\n        // are in memory and those that will be written to disk.\n        struct ordered_set *old_id_to_new_id_os = ordered_set_init(\n            num_seen,\n            uint_pair_sort_by_first_element_cmp,\n            uint_pair_search_by_first_element_cmp,\n            uint_pair_search_by_first_key_cmp\n        );\n\n        // Start with the root node for this domain\n        struct bpt_node *curr_node =\n            cache.get(domain, gi->root_ids[domain] - 1, &bpt_node_cache_handler);\n\n        struct uint_pair *p, *r;\n\n        // put root into a map between the current id and the on-disk id\n        // first will but current id\n        // second is the on-disk id\n        p = (struct uint_pair *)malloc(sizeof(struct uint_pair));\n        if (p == NULL)\n            err(1, \"malloc error in giggle_write_tree_leaf_data()\");\n\n        p->first = BPT_ID(curr_node);\n        p->second = old_id_to_new_id_os->num + 1;\n        r = ordered_set_add(old_id_to_new_id_os, p);\n\n        uint32_t new_root_id = p->second;\n\n        struct fifo_q *node_q = NULL, *leaf_q = NULL;\n        uint32_t *id = (uint32_t *)malloc(sizeof(uint32_t));\n        if (id == NULL)\n            err(1, \"malloc error in giggle_write_tree_leaf_data()\");\n\n        *id = BPT_ID(curr_node);\n        fifo_q_push(&node_q, id);\n\n        while (fifo_q_peek(node_q) != NULL) {\n            // pop the next node off the queue and get it from cache\n            uint32_t *curr_idp = fifo_q_pop(&node_q);\n            uint32_t curr_id = *curr_idp;\n            free(curr_idp);\n            // cache is zero-based, while bpt is one-based\n            curr_node = cache.get(domain, curr_id - 1, &bpt_node_cache_handler);\n            // Basic steps:\n            // - copy the values over to the temp node that we will write out\n            // if the node is not a leaf:\n            //   - map the pointer values using old_id_to_new_id_os\n            //   - put the child nodes into the queue\n            //   - set the pointer head to zero\n            //   - put the node onto disk\n            // if the node is a leaf:\n            //   - get the leaf data\n            //   - add the leaf data to the and the queue cache so we can write\n            //     it out later\n            //   - set the pointer head to the disk id of the leaf data\n            //   -- each 32bit pointer will be split into 2 16bit offsets\n            //      the first will be the start offset and the second the end\n\n            // Zero out the node that we will write to disk\n            memset(to_write_node->data, 0, BPT_NODE_SIZE);\n\n            // Get the on-disk id\n            uint32_t key = curr_id;\n            r = ordered_set_get(old_id_to_new_id_os, &key);\n            if (r == NULL)\n                errx(1, \"Node %u has not been seen yet.\", curr_id);\n\n            // Populate the node that we will write to disk\n            BPT_ID(to_write_node) = r->second;\n            BPT_PARENT(to_write_node) = BPT_PARENT(curr_node);\n            BPT_IS_LEAF(to_write_node) = BPT_IS_LEAF(curr_node);\n            BPT_LEADING(to_write_node) = BPT_LEADING(curr_node);\n            BPT_NEXT(to_write_node) = BPT_NEXT(curr_node);\n            BPT_NUM_KEYS(to_write_node) = BPT_NUM_KEYS(curr_node);\n            BPT_POINTERS_BLOCK(to_write_node) = 0;\n            uint32_t i;\n            for (i = 0; i <= BPT_NUM_KEYS(curr_node); ++i)\n                BPT_KEYS(to_write_node)[i] = BPT_KEYS(curr_node)[i];\n\n            if (BPT_IS_LEAF(curr_node) == 0) {\n\n                for (i = 0; i <= BPT_NUM_KEYS(curr_node); ++i) {\n                    if (BPT_POINTERS(curr_node)[i] != 0) {\n                        // put a map between the current id and the to disk id\n                        p = (struct uint_pair *)malloc(sizeof(struct uint_pair));\n                        if (p == NULL)\n                            err(1,\n                                \"malloc error in \"\n                                \"giggle_write_tree_leaf_data()\");\n\n                        p->first = BPT_POINTERS(curr_node)[i];\n                        p->second = old_id_to_new_id_os->num + 1;\n                        r = ordered_set_add(old_id_to_new_id_os, p);\n\n                        if (r->second != p->second)\n                            errx(\n                                1,\n                                \"%u has already been seen at %u\\n\",\n                                p->first,\n                                r->first\n                            );\n\n                        // update the node we are writing to disk with the new\n                        // id\n                        BPT_POINTERS(to_write_node)[i] = p->second;\n\n                        // put the child on the queue\n                        id = (uint32_t *)malloc(sizeof(uint32_t));\n                        if (id == NULL)\n                            err(1,\n                                \"malloc error in \"\n                                \"giggle_write_tree_leaf_data()\");\n\n                        *id = BPT_POINTERS(curr_node)[i];\n                        fifo_q_push(&node_q, id);\n                    }\n                }\n\n                uint8_t *ds_node;\n                uint64_t d_size = bpt_node_serialize(to_write_node, (void **)&ds_node);\n\n                // Write the mapped node to disk\n                uint32_t ret = disk_store_append(ds, ds_node, d_size);\n\n                // Make sure it gets the ID that we expect\n                if (ret + 1 != BPT_ID(to_write_node))\n                    errx(\n                        1,\n                        \"Disk write is out of sync.  Saw %u.  Expected %u.\",\n                        ret + 1,\n                        BPT_ID(to_write_node)\n                    );\n\n                free(ds_node);\n            } else {\n\n                // replace the next id with the on disk id\n                if (BPT_NEXT(curr_node) != 0) {\n                    key = BPT_NEXT(curr_node);\n                    r = ordered_set_get(old_id_to_new_id_os, &key);\n                    if (r == NULL)\n                        errx(1, \"Node %u has not been seen yet.\", key);\n                    BPT_NEXT(to_write_node) = r->second;\n                }\n\n                // get the leaf data, then add it to the cache so we can\n                // grab it later\n                struct leaf_data *lf = NULL;\n                // uint16_t *starts_ends_offsets = NULL;\n                uint32_t leaf_data_size =\n                    giggle_get_leaf_data(gi, domain, curr_id, &lf);\n                //&starts_ends_offsets);\n                if (leaf_data_size == 0)\n                    errx(1, \"Could not get leaf data.\");\n\n                // uint8_t *output = (uint8_t *)malloc(\n                // 2*leaf_data_size * sizeof(uint32_t));\n\n                // int cs = fastlz_compress(lf->data,\n                // leaf_data_size * sizeof(uint32_t),\n                // output);\n\n                uint32_t data_id = cache.seen(domain) + 1;\n                cache.add(\n                    domain,\n                    data_id - 1,\n                    lf,\n                    sizeof(struct leaf_data),\n                    &leaf_data_cache_handler\n                );\n\n                p = (struct uint_pair *)malloc(sizeof(struct uint_pair));\n                if (p == NULL)\n                    err(1, \"malloc error in giggle_write_tree_leaf_data()\");\n\n                p->first = data_id;\n                p->second = old_id_to_new_id_os->num + 1;\n                r = ordered_set_add(old_id_to_new_id_os, p);\n\n                id = (uint32_t *)malloc(sizeof(uint32_t));\n                if (id == NULL)\n                    err(1, \"malloc error in giggle_write_tree_leaf_data()\");\n\n                *id = data_id;\n                fifo_q_push(&leaf_q, id);\n\n                BPT_POINTERS_BLOCK(to_write_node) = p->second;\n\n                uint8_t *ds_node;\n                uint64_t d_size = bpt_node_serialize(to_write_node, (void **)&ds_node);\n\n                // Write the mapped node to disk\n                uint32_t ret = disk_store_append(ds, ds_node, d_size);\n\n                // Make sure it gets the ID that we expect\n                if (ret + 1 != BPT_ID(to_write_node))\n                    errx(\n                        1,\n                        \"Disk write is out of sync.  Saw %u.  Expected %u.\",\n                        ret + 1,\n                        BPT_ID(to_write_node)\n                    );\n\n                free(ds_node);\n            }\n        }\n        while (fifo_q_peek(leaf_q) != NULL) {\n            // pop the next node off the queue and get it from cache\n            uint32_t *curr_idp = fifo_q_pop(&leaf_q);\n            uint32_t curr_id = *curr_idp;\n            free(curr_idp);\n            // cache is zero-based, while bpt is one-based\n            struct leaf_data *lf =\n                cache.get(domain, curr_id - 1, &leaf_data_cache_handler);\n\n            uint8_t *ds_data;\n            uint64_t d_size = leaf_data_serialize(lf, (void **)&ds_data);\n\n            // Write the mapped node to disk\n            uint32_t ret = disk_store_append(ds, ds_data, d_size);\n            free(ds_data);\n        }\n\n        sc->dss[domain] = ds;\n        ordered_set_destroy(&old_id_to_new_id_os, free_wrapper);\n        gi->root_ids[domain] = new_root_id;\n    }\n\n    bpt_node_free_mem((void **)&to_write_node);\n}\n//}}}\n\n//{{{ leaf_data_cache_handler\n\n/*\n * struct leaf_data {\n *   uint32_t num_leading, num_starts, num_ends;\n *   uint32_t *leading, *starts, *ends, *data;\n * };\n */\nstruct cache_handler leaf_data_cache_handler = {\n    leaf_data_serialize,\n    leaf_data_deserialize,\n    leaf_data_free_mem};\n\n//}}}\n\n//{{{ uint32_t giggle_get_leaf_data(struct giggle_index *gi,\nuint32_t giggle_get_leaf_data(\n    struct giggle_index *gi,\n    uint32_t domain,\n    uint32_t leaf_id,\n    struct leaf_data **lf\n) {\n    // cache is zero-based, while bpt is one-based\n    struct bpt_node *curr_node =\n        cache.get(domain, leaf_id - 1, &bpt_node_cache_handler);\n\n    // If the node is a leaf we need to deal with the leading values\n    if (BPT_IS_LEAF(curr_node)) {\n        *lf = (struct leaf_data *)calloc(1, sizeof(struct leaf_data));\n        if (*lf == NULL)\n            err(1, \"calloc error in giggle_get_leaf_data()\");\n\n        // Do one scan to find the sizes\n\n        // Get the number of leading values\n        if (BPT_LEADING(curr_node) != 0) {\n            struct uint64_t_ll_bpt_leading_data *ld = cache.get(\n                domain, BPT_LEADING(curr_node) - 1, &uint64_t_ll_leading_cache_handler\n            );\n            (*lf)->num_leading = ld->B->len;\n        }\n\n        uint32_t j, k;\n\n        // Get the number of starts and ends\n        for (j = 0; j <= BPT_NUM_KEYS(curr_node) - 1; ++j) {\n            struct uint64_t_ll_bpt_non_leading_data *nld = cache.get(\n                domain,\n                BPT_POINTERS(curr_node)[j] - 1,\n                &uint64_t_ll_non_leading_cache_handler\n            );\n\n            (*lf)->num_starts += (nld->SA == NULL ? 0 : nld->SA->len);\n            (*lf)->num_ends += (nld->SE == NULL ? 0 : nld->SE->len);\n        }\n\n        // Allocate the memory and put in helper pointers\n        (*lf)->data = (uint64_t *)calloc(\n            (*lf)->num_leading + (*lf)->num_starts + (*lf)->num_ends,\n            LEAF_LEADING_STARTS_ENDS_SIZE\n        );\n\n        if ((*lf)->data == NULL)\n            err(1, \"calloc error in giggle_get_leaf_data()\");\n\n        if ((*lf)->num_leading > 0)\n            (*lf)->leading = (*lf)->data;\n        else\n            (*lf)->leading = NULL;\n\n        if ((*lf)->num_starts > 0)\n            (*lf)->starts = (*lf)->data + (*lf)->num_leading;\n        else\n            (*lf)->starts = NULL;\n\n        if ((*lf)->num_ends > 0)\n            (*lf)->ends = (*lf)->data + (*lf)->num_leading + (*lf)->num_starts;\n        else\n            (*lf)->ends = NULL;\n\n        (*lf)->starts_pointers = (uint32_t *)calloc(ORDER, LEAF_POINTERS_SIZE);\n        if ((*lf)->starts_pointers == NULL)\n            err(1, \"calloc error in giggle_get_leaf_data().\\n\");\n\n        (*lf)->ends_pointers = (uint32_t *)calloc(ORDER, LEAF_POINTERS_SIZE);\n        if ((*lf)->ends_pointers == NULL)\n            err(1, \"calloc error in giggle_get_leaf_data().\\n\");\n\n        // Do a second scan to get the data into the array\n        uint32_t leading_i = 0, starts_i = 0, ends_i = 0;\n\n        // Copy data into leading buffer\n        if (BPT_LEADING(curr_node) != 0) {\n            struct uint64_t_ll_bpt_leading_data *ld = cache.get(\n                domain, BPT_LEADING(curr_node) - 1, &uint64_t_ll_leading_cache_handler\n            );\n            k = leading_i;\n            if (ld->B->len > 0) {\n                struct uint64_t_ll_node *curr = ld->B->head;\n                while (curr != NULL) {\n                    (*lf)->leading[k] = curr->val;\n                    k += 1;\n                    curr = curr->next;\n                }\n                qsort(\n                    (*lf)->leading + leading_i,\n                    ld->B->len,\n                    sizeof(uint64_t),\n                    uint64_t_cmp\n                );\n            }\n            leading_i = k;\n        }\n\n        // Copy data into starts and ends buffer\n        for (j = 0; j <= BPT_NUM_KEYS(curr_node) - 1; ++j) {\n            struct uint64_t_ll_bpt_non_leading_data *nld = cache.get(\n                domain,\n                BPT_POINTERS(curr_node)[j] - 1,\n                &uint64_t_ll_non_leading_cache_handler\n            );\n\n            k = starts_i;\n            if ((nld->SA != NULL) && (nld->SA->len > 0)) {\n                struct uint64_t_ll_node *curr = nld->SA->head;\n                while (curr != NULL) {\n                    (*lf)->starts[k] = curr->val;\n                    k += 1;\n                    curr = curr->next;\n                }\n                qsort(\n                    (*lf)->starts + starts_i,\n                    nld->SA->len,\n                    sizeof(uint64_t),\n                    uint64_t_cmp\n                );\n\n                (*lf)->starts_pointers[j] =\n                    (j == 0) ? nld->SA->len\n                             : (*lf)->starts_pointers[j - 1] + nld->SA->len;\n\n            } else {\n                (*lf)->starts_pointers[j] =\n                    (j == 0) ? 0 : (*lf)->starts_pointers[j - 1];\n            }\n\n            starts_i = k;\n\n            k = ends_i;\n            if ((nld->SE != NULL) && (nld->SE->len > 0)) {\n                struct uint64_t_ll_node *curr = nld->SE->head;\n                while (curr != NULL) {\n                    (*lf)->ends[k] = curr->val;\n                    k += 1;\n                    curr = curr->next;\n                }\n                qsort(\n                    (*lf)->ends + ends_i, nld->SE->len, sizeof(uint64_t), uint64_t_cmp\n                );\n\n                (*lf)->ends_pointers[j] =\n                    (j == 0) ? nld->SE->len\n                             : (*lf)->ends_pointers[j - 1] + nld->SE->len;\n            } else {\n                (*lf)->ends_pointers[j] = (j == 0) ? 0 : (*lf)->ends_pointers[j - 1];\n            }\n\n            ends_i = k;\n        }\n        return (*lf)->num_leading + (*lf)->num_starts + (*lf)->num_ends;\n    } else {\n        return 0;\n    }\n}\n//}}}\n\n//{{{void leaf_data_map_intersection_to_offset_list(struct giggle_index *gi,\nvoid leaf_data_map_intersection_to_offset_list(\n    struct giggle_index *gi,\n    struct giggle_query_result *gqr,\n    void *_R\n) {\n#ifdef DEBUG\n    fprintf(stderr, \"leaf_data_map_intersection_to_offset_list\\n\");\n#endif\n    struct leaf_data_result *R = (struct leaf_data_result *)_R;\n    /*\n    struct leaf_data_result {\n        uint32_t len;\n        uint32_t *data;\n        struct leaf_data_result *next;\n    };\n    */\n\n    if (R != NULL) {\n        gqr->num_hits += R->len;\n\n#ifdef GIGGLE_QUERY_TRACE\n        fprintf(\n            stderr,\n            \"leaf_data_map_intersection_to_offset_list\\t\"\n            \"R->len:%u\\n\",\n            R->len\n        );\n#endif\n\n        uint32_t i;\n        for (i = 0; i < R->len; ++i) {\n            struct file_id_offset_pair fid_off =\n                offset_index_get(gi->offset_idx, R->data[i]);\n            // long_ll_append(&(gqr->offsets[fid_off.file_id]),fid_off.offset);\n            long_uint_ll_append(\n                &(gqr->offsets[fid_off.file_id]), fid_off.offset, R->data[i]\n            );\n        }\n\n        struct leaf_data_result *tmp_R = R->next;\n        free(R->data);\n        free(R);\n        R = tmp_R;\n    }\n}\n//}}}\n\n//{{{ chrm_index\n//{{{struct chrm_index *chrm_index_init(uint32_t init_size,\nstruct chrm_index *chrm_index_init(uint32_t init_size, char *file_name) {\n    struct chrm_index *idx = (struct chrm_index *)malloc(sizeof(struct chrm_index));\n    if (idx == NULL)\n        err(1, \"malloc error in chrm_index_init()\");\n\n    idx->index = ordered_set_init(\n        init_size,\n        str_uint_pair_sort_element_cmp,\n        str_uint_pair_search_element_cmp,\n        str_uint_pair_search_key_cmp\n    );\n    if (file_name != NULL)\n        idx->file_name = strdup(file_name);\n    else\n        idx->file_name = NULL;\n\n    return idx;\n}\n//}}}\n\n//{{{struct str_uint_pair *chrm_index_get(struct chrm_index *ci,\nstruct str_uint_pair *chrm_index_get(struct chrm_index *ci, char *chrm) {\n    return (struct str_uint_pair *)ordered_set_get(ci->index, chrm);\n}\n//}}}\n\n//{{{uint32_t chrm_index_add(struct chrm_index *ci,\nuint32_t chrm_index_add(struct chrm_index *ci, char *chrm) {\n    struct str_uint_pair *p =\n        (struct str_uint_pair *)malloc(sizeof(struct str_uint_pair));\n    if (p == NULL)\n        err(1, \"malloc error in chrm_index_add()\");\n\n    p->uint = ci->index->num;\n    p->str = strdup(chrm);\n\n    struct str_uint_pair *r = (struct str_uint_pair *)ordered_set_add(ci->index, p);\n\n    return r->uint;\n}\n//}}}\n\n//{{{void chrm_index_destroy(struct chrm_index **ci)\nvoid chrm_index_destroy(struct chrm_index **ci) {\n    if ((*ci)->file_name != NULL)\n        free((*ci)->file_name);\n    ordered_set_destroy(&((*ci)->index), str_uint_pair_free);\n    free(*ci);\n    *ci = NULL;\n}\n//}}}\n\n//{{{struct chrm_index *chrm_index_load(char *file_name)\nstruct chrm_index *chrm_index_load(char *file_name) {\n    struct chrm_index *idx = (struct chrm_index *)malloc(sizeof(struct chrm_index));\n    if (idx == NULL)\n        err(1, \"malloc error in chrm_index_load()\");\n\n    idx->file_name = strdup(file_name);\n\n    FILE *f = fopen(idx->file_name, \"rb\");\n    idx->index = ordered_set_load(\n        f,\n        idx->file_name,\n        str_uint_pair_load,\n        str_uint_pair_sort_element_cmp,\n        str_uint_pair_search_element_cmp,\n        str_uint_pair_search_key_cmp\n    );\n    fclose(f);\n\n    return idx;\n}\n//}}}\n\n//{{{void chrm_index_store(struct chrm_index *ci)\nvoid chrm_index_store(struct chrm_index *ci) {\n    if (ci->file_name == NULL)\n        errx(1, \"No output file given for chrm_index.\");\n\n    FILE *f = fopen(ci->file_name, \"wb\");\n    ordered_set_store(ci->index, f, ci->file_name, str_uint_pair_store);\n    fclose(f);\n}\n//}}}\n//}}}\n\n//{{{ file_index\n//{{{struct file_index *file_index_init(uint32_t init_size, char *file_name)\nstruct file_index *file_index_init(uint32_t init_size, char *file_name) {\n    struct file_index *fi = (struct file_index *)malloc(sizeof(struct file_index));\n    if (fi == NULL)\n        err(1, \"malloc error in chrm_index_init()\");\n\n    fi->index = unordered_list_init(3);\n    fi->file_name = NULL;\n    if (file_name != NULL)\n        fi->file_name = strdup(file_name);\n    return fi;\n}\n//}}}\n\n//{{{ void file_index_destroy(struct file_index **fi)\nvoid file_index_destroy(struct file_index **fi) {\n    unordered_list_destroy(&((*fi)->index), file_data_free);\n    if ((*fi)->file_name != NULL) {\n        free((*fi)->file_name);\n        (*fi)->file_name = NULL;\n    }\n    free(*fi);\n    *fi = NULL;\n}\n//}}}\n\n//{{{uint32_t file_index_add(struct file_index *fi, char *file_name)\nuint32_t file_index_add(struct file_index *fi, char *file_name) {\n    struct file_data *fd = (struct file_data *)calloc(1, sizeof(struct file_data));\n    if (fd == NULL)\n        err(1, \"calloc error in chrm_index_add()\");\n\n    fd->file_name = strdup(file_name);\n    return unordered_list_add(fi->index, fd);\n}\n//}}}\n\n//{{{void file_index_store(struct file_index *fi)\nvoid file_index_store(struct file_index *fi) {\n    if (fi->file_name == NULL)\n        errx(1, \"No output file given for file_index.\");\n\n    FILE *f = fopen(fi->file_name, \"wb\");\n    unordered_list_store(fi->index, f, fi->file_name, file_data_store);\n    fclose(f);\n}\n//}}}\n\n//{{{struct file_index *file_index_load(char *file_name)\nstruct file_index *file_index_load(char *file_name) {\n    struct file_index *fi = (struct file_index *)malloc(sizeof(struct file_index));\n    if (fi == NULL)\n        err(1, \"malloc error in chrm_index_load()\");\n\n    fi->file_name = strdup(file_name);\n    FILE *f = fopen(file_name, \"rb\");\n    fi->index = unordered_list_load(f, fi->file_name, file_data_load);\n    fclose(f);\n\n    return fi;\n}\n//}}}\n\n//{{{struct file_data *file_index_get(struct file_index *fi, uint32_t id)\nstruct file_data *file_index_get(struct file_index *fi, uint32_t id) {\n    return (struct file_data *)unordered_list_get(fi->index, id);\n}\n//}}}\n//}}}\n\nuint64_t giggle_bulk_insert(\n    char *input_path_name,\n    char *output_path_name,\n    uint32_t force\n) {\n    return giggle_bulk_insert_with_metadata(\n        input_path_name, output_path_name, NULL, force\n    );\n}\n\nuint64_t giggle_bulk_insert_with_metadata(\n    char *input_path_name,\n    char *output_path_name,\n    char *metadata_conf_name,\n    uint32_t force\n) {\n    // Make the output directory\n    struct stat st = {0};\n    if (stat(output_path_name, &st) == -1) {\n        mkdir(output_path_name, 0700);\n    } else if (force == 1) {\n        rmrf(output_path_name);\n        mkdir(output_path_name, 0700);\n    } else {\n        fprintf(\n            stderr,\n            \"The directory '%s' already exists. \"\n            \"Use the force option to overwrite.\\n\",\n            output_path_name\n        );\n        return 0;\n    }\n\n    struct giggle_index *gi =\n        (struct giggle_index *)malloc(sizeof(struct giggle_index));\n    if (gi == NULL)\n        err(1, \"malloc error in giggle_bulk_insert()\");\n\n    gi->data_dir = strdup(output_path_name);\n\n    // open files\n    gi->file_idx = NULL;\n    struct input_file **i_files = NULL;\n    uint32_t num_input_files = giggle_bulk_insert_open_files(\n        input_path_name, gi->data_dir, &i_files, &(gi->file_idx)\n    );\n\n    // init offset index\n    char *offset_index_file_name = NULL;\n    int ret = asprintf(\n        &offset_index_file_name, \"%s/%s\", gi->data_dir, OFFSET_INDEX_FILE_NAME\n    );\n    gi->offset_idx = offset_index_init(1000, offset_index_file_name);\n    free(offset_index_file_name);\n\n    // init metadata index\n    gi->metadata_idx = NULL;\n    if (metadata_conf_name != NULL) {\n        char *metadata_index_file_name = NULL;\n        int ret = asprintf(\n            &metadata_index_file_name, \"%s/%s\", gi->data_dir, METADATA_INDEX_FILE_NAME\n        );\n        gi->metadata_idx =\n            metadata_index_init(metadata_conf_name, metadata_index_file_name);\n        free(metadata_index_file_name);\n    }\n\n    // init chrm index\n    char *chrm_index_file_name = NULL;\n    ret = asprintf(&chrm_index_file_name, \"%s/%s\", gi->data_dir, CHRM_INDEX_FILE_NAME);\n    gi->chrm_idx = chrm_index_init(24, chrm_index_file_name);\n    free(chrm_index_file_name);\n\n    // prime pqs\n    pri_queue pq_start = priq_new(num_input_files);\n    // Since we know that each file will have at most one start in the priority\n    // queue, we can reduce mallocs by reusing the array\n    struct pq_data *pqd_starts =\n        (struct pq_data *)malloc(num_input_files * sizeof(struct pq_data));\n    if (pqd_starts == NULL)\n        err(1, \"malloc error in giggle_bulk_insert()\");\n\n    pri_queue pq_end = priq_new(num_input_files);\n\n    giggle_bulk_insert_prime_pqs(\n        gi, &pq_start, pqd_starts, &pq_end, i_files, num_input_files\n    );\n\n    // scan files\n    giggle_bulk_insert_build_leaf_levels(\n        gi, &pq_start, pqd_starts, &pq_end, i_files, num_input_files\n    );\n\n    // clean up\n    priq_free(pq_end);\n    priq_free(pq_start);\n    free(pqd_starts);\n    uint32_t i;\n    for (i = 0; i < num_input_files; ++i)\n        input_file_destroy(&(i_files[i]));\n    free(i_files);\n\n    // build trees\n    giggle_bulk_insert_build_tree_on_leaves(gi);\n\n    for (i = 0; i < gi->file_idx->index->num; ++i) {\n        struct file_data *fd = file_index_get(gi->file_idx, i);\n        fd->mean_interval_size = fd->mean_interval_size / fd->num_intervals;\n    }\n\n    // save\n    FILE *f = fopen(gi->root_ids_file_name, \"wb\");\n\n    if (fwrite(&(gi->len), sizeof(uint32_t), 1, f) != 1)\n        err(EX_IOERR, \"Error writing len for root_ids'%s'.\", gi->root_ids_file_name);\n\n    if (fwrite(&(gi->num), sizeof(uint32_t), 1, f) != 1)\n        err(EX_IOERR, \"Error writing num for root_ids'%s'.\", gi->root_ids_file_name);\n\n    if (fwrite(gi->root_ids, sizeof(uint32_t), gi->len, f) != gi->len)\n        err(EX_IOERR, \"Error writing root_ids '%s'.\", gi->root_ids_file_name);\n    fclose(f);\n\n    chrm_index_store(gi->chrm_idx);\n    file_index_store(gi->file_idx);\n    offset_index_store(gi->offset_idx);\n    if (gi->metadata_idx) {\n        metadata_index_store(gi->metadata_idx);\n\n        // prints the summary of the metadata index\n        // print_metadata_index(gi->metadata_idx);\n\n        // Warning- prints all the intervals if uncommented\n        // struct metadata_rows *metadata_rows =\n        // read_metadata_rows(gi->metadata_idx); print_metadata_rows(metadata_rows);\n        // metadata_rows_destroy(metadata_rows);\n    }\n\n    uint64_t num_intervals = gi->offset_idx->index->num;\n\n    if (gi->root_ids_file_name != NULL)\n        free(gi->root_ids_file_name);\n    if (gi->data_dir != NULL)\n        free(gi->data_dir);\n\n    free(gi->root_ids);\n    file_index_destroy(&(gi->file_idx));\n    offset_index_destroy(&(gi->offset_idx));\n    if (gi->metadata_idx)\n        metadata_index_destroy(&(gi->metadata_idx));\n    chrm_index_destroy(&(gi->chrm_idx));\n    free(gi);\n    gi = NULL;\n\n    return num_intervals;\n}\n//}}}\n\n//{{{void giggle_bulk_insert_build_tree_on_leaves(struct giggle_index *gi)\nvoid giggle_bulk_insert_build_tree_on_leaves(struct giggle_index *gi) {\n    gi->len = gi->chrm_idx->index->num;\n    gi->num = gi->len;\n    gi->root_ids = (uint32_t *)malloc(gi->num * sizeof(uint32_t));\n    if (gi->root_ids == NULL)\n        err(1, \"malloc error in giggle_bulk_insert_build_tree_on_leaves()\");\n\n    int ret =\n        asprintf(&(gi->root_ids_file_name), \"%s/%s\", gi->data_dir, ROOT_IDS_FILE_NAME);\n\n    char *ds_curr_index_file_name = NULL, *ds_curr_data_file_name = NULL;\n    struct disk_store *curr_ds;\n    uint32_t curr_chrm_id;\n    for (curr_chrm_id = 0; curr_chrm_id < gi->chrm_idx->index->num; ++curr_chrm_id) {\n\n        ret = asprintf(\n            &ds_curr_index_file_name,\n            \"%s/%s%u.idx\",\n            gi->data_dir,\n            CACHE_FILE_NAME_PREFIX,\n            curr_chrm_id\n        );\n        ret = asprintf(\n            &ds_curr_data_file_name,\n            \"%s/%s%u.dat\",\n            gi->data_dir,\n            CACHE_FILE_NAME_PREFIX,\n            curr_chrm_id\n        );\n        curr_ds = disk_store_load(\n            NULL, ds_curr_index_file_name, NULL, ds_curr_data_file_name\n        );\n        free(ds_curr_index_file_name);\n        free(ds_curr_data_file_name);\n        ds_curr_index_file_name = NULL;\n        ds_curr_data_file_name = NULL;\n\n        // Here we need to loop over each level of the tree until the current\n        // level has just one element in which case that element is the root\n\n        uint32_t num_leaf_node_leaf_data = curr_ds->num;\n        uint32_t curr_level_num_nodes = num_leaf_node_leaf_data / 2;\n        uint32_t curr_level_first_id = 1;\n        uint32_t curr_level_is_leaf = 1;\n        uint32_t new_level_first_id = 0;\n        uint32_t new_level_len = giggle_bulk_insert_add_tree_level(\n            curr_ds,\n            curr_level_first_id,\n            curr_level_num_nodes,\n            curr_level_is_leaf,\n            &new_level_first_id\n        );\n\n        while (new_level_len > 1) {\n            curr_level_num_nodes = new_level_len;\n            curr_level_first_id = new_level_first_id;\n            curr_level_is_leaf = 0;\n            new_level_first_id = 0;\n            new_level_len = giggle_bulk_insert_add_tree_level(\n                curr_ds,\n                curr_level_first_id,\n                curr_level_num_nodes,\n                curr_level_is_leaf,\n                &new_level_first_id\n            );\n        }\n\n        if (new_level_len == 1) {\n            gi->root_ids[curr_chrm_id] = new_level_first_id;\n        } else if (new_level_len == 0) {\n            gi->root_ids[curr_chrm_id] = curr_level_first_id;\n        }\n\n        disk_store_destroy(&curr_ds);\n    }\n}\n//}}}\n\n//{{{void giggle_bulk_insert_build_leaf_levels(struct giggle_index *gi,\nvoid giggle_bulk_insert_build_leaf_levels(\n    struct giggle_index *gi,\n    pri_queue *pq_start,\n    struct pq_data *pqd_starts,\n    pri_queue *pq_end,\n    struct input_file **i_files,\n    uint32_t num_input_files\n) {\n    // Grab the top element on the start pq\n    priority pri_start;\n    struct pq_data *pqd_start = (struct pq_data *)priq_top(*pq_start, &pri_start);\n\n    // curr_pos and curr_chrm track the status of the indexing\n    uint32_t curr_pos = pri_start.pos;\n    char curr_chrm[50];\n    strcpy(curr_chrm, pri_start.chrm);\n\n    // register the chrom with chrom index\n    uint32_t curr_chrm_id = chrm_index_add(gi->chrm_idx, curr_chrm);\n\n    // init disk store, do this at the start of every chrom\n    char *ds_curr_index_file_name = NULL, *ds_curr_data_file_name = NULL;\n    uint32_t ret = asprintf(\n        &ds_curr_index_file_name,\n        \"%s/%s%u.idx\",\n        gi->data_dir,\n        CACHE_FILE_NAME_PREFIX,\n        curr_chrm_id\n    );\n    ret = asprintf(\n        &ds_curr_data_file_name,\n        \"%s/%s%u.dat\",\n        gi->data_dir,\n        CACHE_FILE_NAME_PREFIX,\n        curr_chrm_id\n    );\n    struct disk_store *curr_ds = disk_store_init(\n        10, NULL, ds_curr_index_file_name, NULL, ds_curr_data_file_name\n    );\n    free(ds_curr_index_file_name);\n    free(ds_curr_data_file_name);\n\n    // Collect the values into this node, then write it and clear\n    struct bpt_node *bpn = (struct bpt_node *)malloc(sizeof(struct bpt_node));\n    if (bpn == NULL)\n        err(1, \"malloc error in giggle_bulk_insert_build_leaf_levels()\");\n\n    bpn->data = (uint32_t *)malloc(BPT_NODE_NUM_ELEMENTS * sizeof(uint32_t));\n    if (bpn->data == NULL)\n        err(1, \"malloc error in giggle_bulk_insert_build_leaf_levels()\");\n\n    memset(bpn->data, 0, BPT_NODE_SIZE);\n\n    BPT_ID(bpn) = curr_ds->num + 1; // 1-based\n    BPT_PARENT(bpn) = 0;\n    BPT_IS_LEAF(bpn) = 1;\n    BPT_LEADING(bpn) = 0;\n    BPT_NEXT(bpn) = 0;\n    BPT_NUM_KEYS(bpn) = 0;\n    BPT_POINTERS_BLOCK(bpn) = 0;\n\n    // These will be used to create the leaf data for each node\n    uint32_t num_leading = 0, num_starts = 0, num_ends = 0;\n    struct uint64_t_array *leading, *starts, *ends;\n    leading = uint64_t_array_init(100);\n    starts = uint64_t_array_init(100);\n    ends = uint64_t_array_init(100);\n\n    struct uint32_t_array *starts_pointers, *ends_pointers;\n    starts_pointers = uint32_t_array_init(100);\n    ends_pointers = uint32_t_array_init(100);\n\n    // This tree will track intervals that have begun and not yet ended and\n    // will be used to populate the leading value of nodes\n    jsw_avltree_t *avl = jsw_avlnew(uint64_cmp_f, uint64_dup_f, uint64_rel_f);\n\n    // add the current possition to the node\n    ret = giggle_bulk_insert_append_bpt_key(\n        bpn,\n        curr_pos,\n        curr_ds,\n        avl,\n        leading,\n        starts,\n        ends,\n        starts_pointers,\n        ends_pointers\n    );\n\n    // These will be used to read intervals from files\n    int chrm_len = 50;\n    char *chrm = (char *)malloc(chrm_len * sizeof(char));\n    if (chrm == NULL)\n        err(1, \"malloc error in giggle_bulk_insert_build_leaf_levels()\");\n\n    uint32_t start, end;\n    long offset;\n    kstring_t line = {0, 0, NULL};\n\n    priority pri_end;\n    struct pq_data *pqd_end;\n    // Loop over the start queue until it is empty\n    while (priq_top(*pq_start, &pri_start) != NULL) {\n        // Grab the top element\n        pqd_start = (struct pq_data *)priq_pop(*pq_start, &pri_start);\n\n        /* The posibilities for this start position are that:\n         * 1) it has been seen before, in which case we will need to add the\n         * interval id associated with that position to the starts leaf data\n         * and leave the bp tree node alone\n         * 2) it has not been seen before, so it will need to be eventually\n         * added it to the tree we need to first let the ends catch up by\n         * popping any end that is less than to the start that was just seen 3)\n         * it is on a new chromosome and we need to do everything that is in 2)\n         * as well as close out the disk store for the current chrom and start\n         * a new one\n         *\n         * - Every start and end must be added to the starts and ends arrays.\n         * - Any time a new node is created, we need to move the leading,\n         *   starts, and ends arrays to a leaf node, and reset the arrays\n         */\n\n        if ((pri_start.pos == curr_pos) && (strcmp(curr_chrm, pri_start.chrm) == 0)) {\n            // The key didnt' change, so append the current\n            // interval id to the end of the leaf data starts\n\n            uint64_t idx = uint64_t_array_add(starts, pqd_start->interval_id);\n            // bump starts\n            uint32_t_array_set(\n                starts_pointers, (uint32_t)(starts->num), BPT_NUM_KEYS(bpn) - 1\n            );\n            uint32_t_array_set(\n                ends_pointers, (uint32_t)(ends->num), BPT_NUM_KEYS(bpn) - 1\n            );\n            if (starts_pointers->num > ORDER)\n                errx(1, \"too many start pointers\");\n\n                // Add interval to tree to track intervals for leading value\n#if DEBUG\n            fprintf(\n                stderr,\n                \"-> %s %u %llu\\n\",\n                pri_start.chrm,\n                pri_start.pos,\n                pqd_start->interval_id\n            );\n#endif\n\n            jsw_avlinsert(avl, &(pqd_start->interval_id));\n        } else {\n            //{{{ #2, we need to go through the ends to catch up\n            pqd_end = (struct pq_data *)priq_top(*pq_end, &pri_end);\n\n            // Since the key changed, flush out the ends to this or new keys\n            // up to the value of the next start\n            while ((pqd_end != NULL) &&                            // not empy\n                   ((strcmp(pri_start.chrm, pri_end.chrm) != 0) || // same chr\n                    (pri_end.pos < pri_start.pos))) {              // < the start we saw\n\n                pqd_end = (struct pq_data *)priq_pop(*pq_end, &pri_end);\n\n                if (curr_pos == pri_end.pos) {\n                    // The key didnt' change, so append the current\n                    // interval id to the end of the leaf data ends\n                    uint64_t idx = uint64_t_array_add(ends, pqd_end->interval_id);\n                    // bump ends\n                    uint32_t_array_set(\n                        starts_pointers, (uint32_t)(starts->num), BPT_NUM_KEYS(bpn) - 1\n                    );\n                    uint32_t_array_set(\n                        ends_pointers, (uint32_t)(ends->num), BPT_NUM_KEYS(bpn) - 1\n                    );\n\n                    if (starts_pointers->num > ORDER)\n                        errx(1, \"too many start pointers\");\n\n                        // remove end from tree tracking leading values\n#if DEBUG\n                    fprintf(\n                        stderr,\n                        \"<- %s %u %u\\n\",\n                        pri_end.chrm,\n                        pri_end.pos,\n                        pqd_end->interval_id\n                    );\n#endif\n\n                    ret = jsw_avlerase(avl, &(pqd_end->interval_id));\n                    if (ret == 0)\n                        errx(1, \"Error removing element from tree.\");\n                } else {\n                    ret = giggle_bulk_insert_append_bpt_key(\n                        bpn,\n                        pri_end.pos,\n                        curr_ds,\n                        avl,\n                        leading,\n                        starts,\n                        ends,\n                        starts_pointers,\n                        ends_pointers\n                    );\n\n                    uint64_t idx = uint64_t_array_add(ends, pqd_end->interval_id);\n                    // bump ends\n                    uint32_t_array_set(\n                        starts_pointers, (uint32_t)(starts->num), BPT_NUM_KEYS(bpn) - 1\n                    );\n                    uint32_t_array_set(\n                        ends_pointers, (uint32_t)(ends->num), BPT_NUM_KEYS(bpn) - 1\n                    );\n                    if (starts_pointers->num > ORDER)\n                        errx(1, \"too many start pointers\");\n\n                        // remove end from tree tracking leading values\n#if DEBUG\n                    fprintf(\n                        stderr,\n                        \"<- %s %u %u\\n\",\n                        pri_end.chrm,\n                        pri_end.pos,\n                        pqd_end->interval_id\n                    );\n#endif\n                    ret = jsw_avlerase(avl, &(pqd_end->interval_id));\n                    if (ret == 0)\n                        errx(1, \"Error removing element from tree.\");\n\n                    curr_pos = pri_end.pos;\n                }\n\n                free(pqd_end);\n                pqd_end = (struct pq_data *)priq_top(*pq_end, &pri_end);\n            }\n            //}}}\n\n            // If the chrom did change, we need to sync up the disk store and\n            // open up a new one\n            if (strcmp(curr_chrm, pri_start.chrm) != 0) {\n\n                if (BPT_NUM_KEYS(bpn) > 0) {\n                    BPT_POINTERS_BLOCK(bpn) = (curr_ds->num + 1) + 1; // 1-based\n                    BPT_NEXT(bpn) = 0;\n\n                    giggle_bulk_insert_write_leaf_node(\n                        bpn,\n                        curr_ds,\n                        leading,\n                        starts,\n                        ends,\n                        starts_pointers,\n                        ends_pointers\n                    );\n                    // Reset the bpt node\n                    memset(bpn->data, 0, BPT_NODE_SIZE);\n                    BPT_ID(bpn) = 1;\n                    BPT_PARENT(bpn) = 0;\n                    BPT_IS_LEAF(bpn) = 1;\n                    BPT_LEADING(bpn) = 0;\n                    BPT_NEXT(bpn) = 0;\n                    BPT_NUM_KEYS(bpn) = 0;\n                    BPT_POINTERS_BLOCK(bpn) = 0;\n                }\n\n                strcpy(curr_chrm, pri_start.chrm);\n                // register the new chrom\n                curr_chrm_id = chrm_index_add(gi->chrm_idx, curr_chrm);\n                //{{{ fix up the disk store\n                disk_store_sync(curr_ds);\n                disk_store_destroy(&curr_ds);\n\n                ret = asprintf(\n                    &ds_curr_index_file_name,\n                    \"%s/%s%u.idx\",\n                    gi->data_dir,\n                    CACHE_FILE_NAME_PREFIX,\n                    curr_chrm_id\n                );\n                ret = asprintf(\n                    &ds_curr_data_file_name,\n                    \"%s/%s%u.dat\",\n                    gi->data_dir,\n                    CACHE_FILE_NAME_PREFIX,\n                    curr_chrm_id\n                );\n                curr_ds = disk_store_init(\n                    10, NULL, ds_curr_index_file_name, NULL, ds_curr_data_file_name\n                );\n                free(ds_curr_index_file_name);\n                free(ds_curr_data_file_name);\n                //}}}\n            }\n\n            curr_pos = pri_start.pos;\n            ret = giggle_bulk_insert_append_bpt_key(\n                bpn,\n                curr_pos,\n                curr_ds,\n                avl,\n                leading,\n                starts,\n                ends,\n                starts_pointers,\n                ends_pointers\n            );\n            uint64_t idx = uint64_t_array_add(starts, pqd_start->interval_id);\n            // bump starts\n            uint32_t_array_set(\n                starts_pointers, (uint32_t)(starts->num), BPT_NUM_KEYS(bpn) - 1\n            );\n            uint32_t_array_set(\n                ends_pointers, (uint32_t)(ends->num), BPT_NUM_KEYS(bpn) - 1\n            );\n\n            if (starts_pointers->num > ORDER)\n                errx(1, \"too many start pointers\");\n                // add to tree tracking the leading values\n#if DEBUG\n            fprintf(\n                stderr,\n                \"-> %s %u %u\\n\",\n                pri_start.chrm,\n                pri_start.pos,\n                pqd_start->interval_id\n            );\n#endif\n\n            jsw_avlinsert(avl, &(pqd_start->interval_id));\n        }\n\n        //{{{ put another interval from the file that just lost one\n        int ret = i_files[pqd_start->file_id]->input_file_get_next_interval(\n            i_files[pqd_start->file_id], &chrm, &chrm_len, &start, &end, &offset, &line\n        );\n\n        if (ret >= 0) {\n            // FIXME\n            uint64_t interval_id =\n                offset_index_add(gi->offset_idx, offset, &line, pqd_start->file_id);\n\n            if (gi->metadata_idx) {\n                // register the interval with the metadata index\n                uint64_t interval_id_from_metadata =\n                    metadata_index_add(gi->metadata_idx, pqd_start->file_id, &line);\n\n                // assert that both interval_ids are the same\n                assert(interval_id == interval_id_from_metadata);\n            }\n\n            struct file_data *fd = file_index_get(gi->file_idx, pqd_start->file_id);\n            fd->mean_interval_size += end - start;\n            fd->num_intervals += 1;\n\n            pqd_starts[pqd_start->file_id].interval_id = interval_id;\n            pri_start.pos = start;\n            strcpy(pri_start.chrm, chrm);\n            priq_push(*pq_start, &(pqd_starts[pqd_start->file_id]), pri_start);\n\n            pqd_end = (struct pq_data *)malloc(sizeof(struct pq_data));\n            if (pqd_end == NULL)\n                err(1, \"malloc error in giggle_bulk_insert_build_leaf_levels()\");\n\n            pqd_end->file_id = pqd_start->file_id;\n            pqd_end->interval_id = interval_id;\n            pri_end.pos = end + 1;\n            strcpy(pri_end.chrm, chrm);\n            priq_push(*pq_end, pqd_end, pri_end);\n        }\n        //}}}\n    }\n\n    if (line.s != NULL)\n        free(line.s);\n\n    // Once the start queue is empty we need to drain the end queue\n    while (priq_top(*pq_end, &pri_end) != NULL) {\n        pqd_end = (struct pq_data *)priq_pop(*pq_end, &pri_end);\n\n        if (curr_pos == pri_end.pos) {\n            uint64_t idx = uint64_t_array_add(ends, pqd_end->interval_id);\n            // bump ends\n            uint32_t_array_set(\n                starts_pointers, (uint32_t)(starts->num), BPT_NUM_KEYS(bpn) - 1\n            );\n            uint32_t_array_set(\n                ends_pointers, (uint32_t)(ends->num), BPT_NUM_KEYS(bpn) - 1\n            );\n\n            if (starts_pointers->num > ORDER)\n                errx(1, \"too many start pointers\");\n\n                // remove from tree tracking leading values\n#if DEBUG\n            fprintf(\n                stderr, \"-> %s %u %u\\n\", pri_end.chrm, pri_end.pos, pqd_end->interval_id\n            );\n#endif\n            ret = jsw_avlerase(avl, &(pqd_end->interval_id));\n\n            if (ret == 0)\n                errx(1, \"Error removing element from tree.\");\n        } else {\n            curr_pos = pri_end.pos;\n            ret = giggle_bulk_insert_append_bpt_key(\n                bpn,\n                curr_pos,\n                curr_ds,\n                avl,\n                leading,\n                starts,\n                ends,\n                starts_pointers,\n                ends_pointers\n            );\n            uint64_t idx = uint64_t_array_add(ends, pqd_end->interval_id);\n            // bump ends\n            uint32_t_array_set(\n                starts_pointers, (uint32_t)(starts->num), BPT_NUM_KEYS(bpn) - 1\n            );\n            uint32_t_array_set(\n                ends_pointers, (uint32_t)(ends->num), BPT_NUM_KEYS(bpn) - 1\n            );\n\n            if (starts_pointers->num > ORDER)\n                errx(1, \"too many start pointers\");\n#if DEBUG\n            fprintf(\n                stderr, \"-> %s %u %u\\n\", pri_end.chrm, pri_end.pos, pqd_end->interval_id\n            );\n#endif\n            // remove from tree tracking leading values\n            ret = jsw_avlerase(avl, &(pqd_end->interval_id));\n            if (ret == 0)\n                errx(1, \"Error removing element from tree.\");\n        }\n\n        free(pqd_end);\n    }\n\n    // Write out the data if there is a partially filled node left\n    if (BPT_NUM_KEYS(bpn) > 0) {\n        BPT_POINTERS_BLOCK(bpn) = (curr_ds->num + 1) + 1; // 1-based\n        BPT_NEXT(bpn) = 0;\n\n        giggle_bulk_insert_write_leaf_node(\n            bpn, curr_ds, leading, starts, ends, starts_pointers, ends_pointers\n        );\n    }\n\n    disk_store_sync(curr_ds);\n    disk_store_destroy(&curr_ds);\n\n    jsw_avldelete(avl);\n\n    free(bpn->data);\n    free(bpn);\n    uint64_t_array_destroy(&leading);\n    uint64_t_array_destroy(&starts);\n    uint64_t_array_destroy(&ends);\n    uint32_t_array_destroy(&starts_pointers);\n    uint32_t_array_destroy(&ends_pointers);\n    free(chrm);\n}\n//}}}\n\n//{{{void giggle_bulk_insert_prime_pqs(struct giggle_index *gi,\nvoid giggle_bulk_insert_prime_pqs(\n    struct giggle_index *gi,\n    pri_queue *pq_start,\n    struct pq_data *pqd_starts,\n    pri_queue *pq_end,\n    struct input_file **i_files,\n    uint32_t num_input_files\n) {\n    // Priority queue of starts\n    // pri_queue pq_start = priq_new(results.gl_pathc);\n    priority pri_start;\n    priority pri_end;\n\n    // We cannot assume that there will be some set numberof ends per file\n    // (contained intervals) so we must malloc on each insert\n    struct pq_data *pqd_end;\n\n    // Use these to read intervals from files\n    int chrm_len = 10;\n    char *chrm = (char *)malloc(chrm_len * sizeof(char));\n    if (chrm == NULL)\n        err(1, \"malloc error in giggle_bulk_insert_prime_pqs()\");\n\n    uint32_t start, end;\n    long offset;\n    kstring_t line = {0, 0, NULL};\n\n    uint64_t interval_id = 0;\n\n    // add one interval from each file to the priority queue\n    uint32_t i, ret;\n    for (i = 0; i < num_input_files; i++) {\n        ret = i_files[i]->input_file_get_next_interval(\n            i_files[i], &chrm, &chrm_len, &start, &end, &offset, &line\n        );\n\n        struct file_data *fd = file_index_get(gi->file_idx, i);\n        fd->mean_interval_size += end - start;\n        fd->num_intervals += 1;\n\n        // register the interval with the offset index\n        interval_id = offset_index_add(gi->offset_idx, offset, &line, i);\n\n        if (gi->metadata_idx) {\n            // register the interval with the metadata index\n            uint64_t interval_id_from_metadata =\n                metadata_index_add(gi->metadata_idx, i, &line);\n\n            // assert that both interval_ids are the same\n            assert(interval_id == interval_id_from_metadata);\n        }\n\n        // fprintf(stderr, \"%s %u %u %u\\n\", chrm, start, end, interval_id);\n\n        // Update the pq data for the start, use the array to reduce mallocs\n        pqd_starts[i].file_id = i;\n        pqd_starts[i].interval_id = interval_id;\n        pri_start.pos = start;\n        strcpy(pri_start.chrm, chrm);\n        priq_push(*pq_start, &(pqd_starts[i]), pri_start);\n\n        // Update the pq data for the end\n        pqd_end = (struct pq_data *)malloc(sizeof(struct pq_data));\n        if (pqd_end == NULL)\n            err(1, \"malloc error in giggle_bulk_insert_prime_pqs()\");\n\n        pqd_end->file_id = i;\n        pqd_end->interval_id = interval_id;\n        pri_end.pos = end + 1; // use end + 1\n        strcpy(pri_end.chrm, chrm);\n        priq_push(*pq_end, pqd_end, pri_end);\n    }\n\n    if (line.s != NULL)\n        free(line.s);\n\n    free(chrm);\n}\n//}}}\n\n//{{{uint32_t giggle_bulk_insert_open_files(char *input_path_name,\nuint32_t giggle_bulk_insert_open_files(\n    char *input_path_name,\n    char *output_dir_name,\n    struct input_file ***i_files,\n    struct file_index **file_idx\n) {\n    glob_t results;\n    int ret = glob(input_path_name, 0, NULL, &results);\n    if (ret != 0)\n        errx(\n            1,\n            \"Problem with %s (%s), stopping early\\n\",\n            input_path_name,\n            (ret == GLOB_ABORTED   ? \"filesystem problem\"\n             : ret == GLOB_NOMATCH ? \"no match of pattern\"\n             : ret == GLOB_NOSPACE ? \"no dynamic memory\"\n                                   : \"unknown problem\")\n        );\n\n    // Array of open pre-sorted input files\n    *i_files =\n        (struct input_file **)malloc(results.gl_pathc * sizeof(struct input_file *));\n    if (i_files == NULL)\n        err(1, \"malloc error in giggle_bulk_insert_open_files()\");\n\n    char *file_index_file_name = NULL;\n    ret =\n        asprintf(&file_index_file_name, \"%s/%s\", output_dir_name, FILE_INDEX_FILE_NAME);\n\n    *file_idx = file_index_init(results.gl_pathc, file_index_file_name);\n    free(file_index_file_name);\n\n    uint32_t i;\n    for (i = 0; i < results.gl_pathc; i++) {\n        (*i_files)[i] = input_file_init(results.gl_pathv[i]);\n        if ((*i_files)[i] == NULL)\n            errx(1, \"Could not open %s.\\n\", results.gl_pathv[i]);\n        // register the file with the file index\n        uint32_t file_id = file_index_add(*file_idx, results.gl_pathv[i]);\n        if (i != file_id)\n            errx(\n                1,\n                \"Error with file_index synchronization. Saw %u, expected %u.\",\n                file_id,\n                i\n            );\n    }\n    uint32_t num_files = results.gl_pathc;\n    globfree(&results);\n\n    return num_files;\n}\n//}}}\n\n//{{{int giggle_bulk_insert_append_bpt_key(struct bpt_node *bpn,\nint giggle_bulk_insert_append_bpt_key(\n    struct bpt_node *bpn,\n    uint32_t key_val,\n    struct disk_store *ds,\n    jsw_avltree_t *avl,\n    struct uint64_t_array *leading,\n    struct uint64_t_array *starts,\n    struct uint64_t_array *ends,\n    struct uint32_t_array *starts_pointers,\n    struct uint32_t_array *ends_pointers\n) {\n#if DEBUG\n    fprintf(\n        stderr,\n        \"giggle_bulk_insert_append_bpt_key: append %u %u\\n\",\n        BPT_NUM_KEYS(bpn),\n        key_val\n    );\n#endif\n\n    int ret = 0;\n    if (BPT_NUM_KEYS(bpn) == ORDER) {\n        BPT_POINTERS_BLOCK(bpn) = (ds->num + 1) + 1; // 1-based\n        BPT_NEXT(bpn) = (ds->num + 2) + 1;           // 1-based\n\n        giggle_bulk_insert_write_leaf_node(\n            bpn, ds, leading, starts, ends, starts_pointers, ends_pointers\n        );\n\n        // Reset the bpt node\n        memset(bpn->data, 0, BPT_NODE_SIZE);\n        BPT_ID(bpn) = ds->num + 1; // 1-based\n        BPT_PARENT(bpn) = 0;\n        BPT_IS_LEAF(bpn) = 1;\n        BPT_LEADING(bpn) = 0;\n        BPT_NEXT(bpn) = 0;\n        BPT_NUM_KEYS(bpn) = 0;\n        BPT_POINTERS_BLOCK(bpn) = 0;\n\n        // populate the leading values for the next leaf node\n        jsw_avltrav_t *avl_t = jsw_avltnew();\n        uint64_t *id = (uint64_t *)jsw_avltfirst(avl_t, avl);\n\n        while (id != NULL) {\n            uint64_t idx = uint64_t_array_add(leading, *id);\n            id = (uint64_t *)jsw_avltnext(avl_t);\n        }\n\n        if (leading->num > 0)\n            BPT_LEADING(bpn) = 1;\n\n        jsw_avltdelete(avl_t);\n\n        ret = 1;\n    }\n\n    BPT_KEYS(bpn)[BPT_NUM_KEYS(bpn)] = key_val;\n    BPT_NUM_KEYS(bpn) = BPT_NUM_KEYS(bpn) + 1;\n\n    return ret;\n}\n//}}}\n\n//{{{void giggle_bulk_insert_write_leaf_node(struct bpt_node *bpn,\nvoid giggle_bulk_insert_write_leaf_node(\n    struct bpt_node *bpn,\n    struct disk_store *ds,\n    struct uint64_t_array *leading,\n    struct uint64_t_array *starts,\n    struct uint64_t_array *ends,\n    struct uint32_t_array *starts_pointers,\n    struct uint32_t_array *ends_pointers\n) {\n#ifdef LEAF_CHECK\n    //{{{\n    uint64_t *_leading_starts =\n        (uint64_t *)malloc((starts->num + ends->num) * sizeof(uint64_t));\n    memcpy(_leading_starts, leading->data, leading->num * sizeof(uint64_t));\n    memcpy(\n        _leading_starts + leading->num, starts->data, starts->num * sizeof(uint64_t)\n    );\n\n    qsort(_leading_starts, starts->num + ends->num, sizeof(uint64_t), uint64_t_cmp);\n\n    uint32_t j, found = 0;\n    for (j = 0; j < ends->num; ++j) {\n        uint64_t *ret = bsearch(\n            &(ends->data[j]),\n            _leading_starts,\n            starts->num + ends->num,\n            sizeof(uint64_t),\n            uint64_t_cmp\n        );\n        if (ret == NULL)\n            errx(1, \"Error: end with no matching start/n\");\n        else\n            found += 1;\n    }\n    free(_leading_starts);\n//}}}\n#endif\n\n#if DEBUG_GIGGLE_BULK_INSERT_WRITE_LEAF_NODE\n    fprintf(\n        stderr,\n        \"giggle_bulk_insert_write_leaf_node\\t\"\n        \"ORDER:%u \"\n        \"leading->num:%llu \"\n        \"starts->num:%llu \"\n        \"ends->num:%llu \"\n        \"starts_pointers->num:%u \"\n        \"ends_pointers->num:%u\\n\",\n        ORDER,\n        leading->num,\n        starts->num,\n        ends->num,\n        starts_pointers->num,\n        ends_pointers->num\n    );\n#endif\n\n    // Write the node out to disk\n    void *v;\n    uint64_t serialized_size = bpt_node_serialize((void *)bpn, &v);\n    uint32_t ds_id = disk_store_append(ds, v, serialized_size);\n    free(v);\n\n    // Write out the leaf data\n    struct leaf_data *ld = (struct leaf_data *)malloc(sizeof(struct leaf_data));\n    if (ld == NULL)\n        err(1, \"malloc error in giggle_bulk_insert_write_leaf_node()\");\n\n    ld->num_leading = leading->num;\n    ld->num_starts = starts->num;\n    ld->num_ends = ends->num;\n\n    ld->starts_pointers = (uint32_t *)calloc(ORDER, LEAF_POINTERS_SIZE);\n    if (ld->starts_pointers == NULL)\n        err(1, \"calloc error in giggle_bulk_insert_write_leaf_node.\\n\");\n    memcpy(\n        ld->starts_pointers,\n        starts_pointers->data,\n        starts_pointers->num * sizeof(uint32_t)\n    );\n\n    ld->ends_pointers = (uint32_t *)calloc(ORDER, sizeof(uint32_t));\n    memcpy(\n        ld->ends_pointers, ends_pointers->data, ends_pointers->num * sizeof(uint32_t)\n    );\n\n    ld->data = (uint64_t *)malloc(\n        (ld->num_leading + ld->num_starts + ld->num_ends) * sizeof(uint64_t)\n    );\n    if (ld->data == NULL)\n        err(1, \"malloc error in giggle_bulk_insert_write_leaf_node()\");\n\n    ld->leading = ld->data;\n    ld->starts = ld->data + ld->num_leading;\n    ld->ends = ld->data + ld->num_leading + ld->num_starts;\n    memcpy(ld->leading, leading->data, ld->num_leading * sizeof(uint64_t));\n\n    qsort(ld->leading, ld->num_leading, sizeof(uint64_t), uint64_t_cmp);\n\n    memcpy(ld->starts, starts->data, ld->num_starts * sizeof(uint64_t));\n    memcpy(ld->ends, ends->data, ld->num_ends * sizeof(uint64_t));\n\n    serialized_size = leaf_data_serialize((void *)ld, &v);\n    ds_id = disk_store_append(ds, v, serialized_size);\n    free(v);\n\n    free(ld->starts_pointers);\n    free(ld->ends_pointers);\n    free(ld->data);\n    free(ld);\n\n    // Reset the leaf data\n    leading->num = 0;\n    starts->num = 0;\n    ends->num = 0;\n\n    memset(starts_pointers->data, 0, starts_pointers->num * sizeof(uint32_t));\n    starts_pointers->num = 0;\n\n    memset(ends_pointers->data, 0, ends_pointers->num * sizeof(uint32_t));\n    ends_pointers->num = 0;\n}\n//}}}\n\n//{{{uint32_t giggle_bulk_insert_add_tree_level(struct disk_store *curr_ds,\nuint32_t giggle_bulk_insert_add_tree_level(\n    struct disk_store *curr_ds,\n    uint32_t curr_level_first_id,\n    uint32_t curr_level_num_nodes,\n    uint32_t curr_level_is_leaf,\n    uint32_t *new_level_first_id\n)\n\n{\n    // If the level only has 1 node, then it will become the root\n    if (curr_level_num_nodes == 1) {\n        *new_level_first_id = curr_level_first_id;\n        return 0;\n    }\n\n    // We will use this node to hold the data that will be written to disk\n    struct bpt_node *new_bpn = (struct bpt_node *)malloc(sizeof(struct bpt_node));\n    if (new_bpn == NULL)\n        err(1, \"malloc error in giggle_bulk_insert_add_tree_level()\");\n\n    new_bpn->data = (uint32_t *)malloc(BPT_NODE_NUM_ELEMENTS * sizeof(uint32_t));\n    if (new_bpn->data == NULL)\n        err(1, \"malloc error in giggle_bulk_insert_add_tree_level()\");\n\n    memset(new_bpn->data, 0, BPT_NODE_SIZE);\n    *new_level_first_id = curr_ds->num + 1; // 1-based\n    BPT_ID(new_bpn) = curr_ds->num + 1;     // 1-based\n\n    uint32_t curr_row_len = 0;\n\n    // put the left most node input the pointers\n    BPT_POINTERS(new_bpn)[0] = curr_level_first_id;\n    // uint32_t num_leaf_nodes_leaf_data = curr_ds->num;\n\n    uint32_t j, key_i = 0;\n    uint64_t size;\n    void *v;\n    struct bpt_node *bpn_in;\n    uint64_t deserialized_size;\n    uint64_t curr_node_id = 0;\n\n    for (j = 1; j < curr_level_num_nodes; j += 1) {\n        // Read the current node from disk\n        if (curr_level_is_leaf == 1)\n            curr_node_id = curr_level_first_id + j * 2;\n        else\n            curr_node_id = curr_level_first_id + j;\n        v = disk_store_get(curr_ds, curr_node_id - 1, &size);\n        deserialized_size = bpt_node_deserialize(v, size, (void **)&bpn_in);\n#if DEBUG\n        fprintf(stderr, \"%u(%u) \", BPT_KEYS(bpn_in)[0], BPT_ID(bpn_in));\n#endif\n\n        BPT_KEYS(new_bpn)[key_i] = BPT_KEYS(bpn_in)[0];\n        BPT_NUM_KEYS(new_bpn) = BPT_NUM_KEYS(new_bpn) + 1;\n        BPT_POINTERS(new_bpn)[key_i + 1] = BPT_ID(bpn_in);\n\n        key_i += 1;\n\n        if (key_i == ORDER) {\n            // The node is full, write it to disk and reset\n            void *v;\n            uint64_t serialized_size = bpt_node_serialize((void *)new_bpn, &v);\n            uint32_t ds_id = disk_store_append(curr_ds, v, serialized_size);\n            free(v);\n\n            memset(new_bpn->data, 0, BPT_NODE_SIZE);\n            BPT_ID(new_bpn) = curr_ds->num + 1; // 1-based\n            key_i = 0;\n            curr_row_len += 1;\n        }\n\n        free(bpn_in->data);\n        free(bpn_in);\n        free(v);\n        v = NULL;\n    }\n\n    if (key_i > 0) {\n        void *v;\n        uint64_t serialized_size = bpt_node_serialize((void *)new_bpn, &v);\n        uint32_t ds_id = disk_store_append(curr_ds, v, serialized_size);\n        free(v);\n        curr_row_len += 1;\n    }\n\n    free(new_bpn->data);\n    free(new_bpn);\n    return curr_row_len;\n}\n//}}}\n\n//{{{uint32_t giggle_get_indexed_files(char *index_dir_name,\nuint32_t giggle_get_indexed_files(\n    char *index_dir_name,\n    char ***names,\n    uint32_t **num_intervals,\n    double **mean_interval_sizes\n) {\n    char *file_index_file_name = NULL;\n    int ret =\n        asprintf(&file_index_file_name, \"%s/%s\", index_dir_name, FILE_INDEX_FILE_NAME);\n    struct file_index *file_idx = file_index_load(file_index_file_name);\n    free(file_index_file_name);\n\n    uint32_t num = file_idx->index->num;\n    *names = (char **)malloc(num * sizeof(char *));\n    *num_intervals = (uint32_t *)malloc(num * sizeof(uint32_t));\n    *mean_interval_sizes = (double *)malloc(num * sizeof(double));\n\n    uint32_t i;\n    for (i = 0; i < file_idx->index->num; ++i) {\n        struct file_data *fd = file_index_get(file_idx, i);\n        (*names)[i] = strdup(fd->file_name);\n        (*num_intervals)[i] = fd->num_intervals;\n        (*mean_interval_sizes)[i] = fd->mean_interval_size;\n    }\n    file_index_destroy(&file_idx);\n\n    return num;\n}\n//}}}\n\n//{{{void block_store_giggle_set_data_handler();\nvoid block_store_giggle_set_data_handler() {\n    bpt_node_repair = uint64_t_ll_leading_repair;\n\n    uint64_t_ll_giggle_data_handler.non_leading_cache_handler =\n        uint64_t_ll_non_leading_cache_handler;\n    uint64_t_ll_giggle_data_handler.leading_cache_handler =\n        uint64_t_ll_leading_cache_handler;\n    uint64_t_ll_giggle_data_handler.new_non_leading = uint64_t_ll_new_non_leading;\n    uint64_t_ll_giggle_data_handler.new_leading = uint64_t_ll_new_leading;\n    uint64_t_ll_giggle_data_handler.non_leading_SA_add_scalar =\n        uint64_t_ll_non_leading_SA_add_scalar;\n    uint64_t_ll_giggle_data_handler.non_leading_SE_add_scalar =\n        uint64_t_ll_non_leading_SE_add_scalar;\n    uint64_t_ll_giggle_data_handler.leading_B_add_scalar =\n        uint64_t_ll_leading_B_add_scalar;\n    uint64_t_ll_giggle_data_handler.leading_union_with_B =\n        uint64_t_ll_leading_union_with_B;\n    uint64_t_ll_giggle_data_handler.non_leading_union_with_SA =\n        uint64_t_ll_non_leading_union_with_SA;\n    uint64_t_ll_giggle_data_handler.non_leading_union_with_SA_subtract_SE =\n        uint64_t_ll_non_leading_union_with_SA_subtract_SE;\n\n    uint64_t_ll_giggle_data_handler.write_tree = giggle_write_tree_cache_dump;\n\n    giggle_data_handler = uint64_t_ll_giggle_data_handler;\n\n    giggle_data_handler.giggle_collect_intersection =\n        giggle_collect_intersection_data_in_block;\n\n    giggle_data_handler.map_intersection_to_offset_list =\n        leaf_data_map_intersection_to_offset_list;\n}\n//\n\n#if 0\n//{{{ uint32_t giggle_merge_chrom(char *chrm_string,\nuint32_t giggle_merge_chrom(char *chrm_string,\n                            struct giggle_index *gi_0,\n                            struct indexed_list *file_index_id_map_0,\n                            uint32_t gi_0_cache_name_space,\n                            struct giggle_index *gi_1,\n                            struct indexed_list *file_index_id_map_1,\n                            uint32_t gi_1_cache_name_space,\n                            struct disk_store *ds,\n                            struct file_id_offset_pairs **merged_offset_index)\n{\n    // Initialize values for tree 0\n    CACHE_NAME_SPACE = gi_0_cache_name_space;\n    uint32_t chr_id_0 = giggle_get_chrm_id(gi_0, chrm_string);\n    uint32_t curr_leaf_id_0;\n    int pos_start_id_0;\n\n    // find the left-most leaf node for tree 0\n    uint32_t nld_start_id_0 = bpt_find(chr_id_0,\n                                       gi_0->root_ids[chr_id_0],\n                                       &curr_leaf_id_0, \n                                       &pos_start_id_0,\n                                       0);\n    struct bpt_node *curr_leaf_0 = cache.get(chr_id_0,\n                                             curr_leaf_id_0 - 1,\n                                             &bpt_node_cache_handler);\n    struct leaf_data *curr_leaf_data_0 = \n            cache.get(chr_id_0,\n                      BPT_POINTERS_BLOCK(curr_leaf_0) - 1,\n                      &leaf_data_cache_handler);\n\n    // Initialize values for tree 1\n    CACHE_NAME_SPACE = gi_1_cache_name_space;\n    uint32_t chr_id_1 = giggle_get_chrm_id(gi_1, chrm_string);\n    uint32_t curr_leaf_id_1;\n    int pos_start_id_1;\n\n    // find the left-most leaf node for tree 1\n    uint32_t nld_start_id_1 = bpt_find(chr_id_1,\n                                       gi_1->root_ids[chr_id_1],\n                                       &curr_leaf_id_1, \n                                       &pos_start_id_1,\n                                       0);\n    struct bpt_node *curr_leaf_1 = cache.get(chr_id_1,\n                                              curr_leaf_id_1 - 1,\n                                              &bpt_node_cache_handler);\n    struct leaf_data *curr_leaf_data_1 = \n            cache.get(chr_id_1,\n                      BPT_POINTERS_BLOCK(curr_leaf_1) - 1,\n                      &leaf_data_cache_handler);\n\n    uint32_t i_0 = 0, i_1 = 0;\n\n    // These trees will track the intervals that are currently in context\n    jsw_avltree_t *context_tree_0 = jsw_avlnew(int_cmp_f, int_dup_f, int_rel_f);\n    jsw_avltree_t *context_tree_1 = jsw_avlnew(int_cmp_f, int_dup_f, int_rel_f);\n\n    /*\n     * As the keys/pointers are scanned in each leaf node a new leaf node is\n     * built with the merged data. At the same time a new leaf data is built\n     * and any spanning nodes must be tracked for the leading data\n     *\n     * Must keep a list of in context interval ids\n     *\n     * Interval ids from each tree must be mapped to new ids for the new tree\n     *\n     * At each start we need to add all of those nodes to context\n     *\n     * At each end we must remove those from context\n     *\n     * Anything that is in context when a leaf node is full must be placed into\n     * the leading node of the next leaf node\n     *\n     *\n     *\n     */\n\n    // offset ids must be mapped from the values in the distisct trees\n    // to merged values, offset_id_map_0 tracks the values from tree 0 and \n    // offset_id_map_1 from tree 1\n    // the key will be the original id and value will be the merged id\n    struct indexed_list *offset_id_map_0 = indexed_list_init(1000,\n                                                             sizeof(uint64_t));\n    struct indexed_list *offset_id_map_1 = indexed_list_init(1000,\n                                                             sizeof(uint64_t));\n\n    // These lists will become the leaf data for the merged node\n    uint32_t merged_starts_size = 1000, merged_starts_num = 0;\n    uint32_t merged_ends_size = 1000, merged_ends_num = 0;\n\n    uint32_t *merged_starts =\n            (uint32_t *)malloc(merged_starts_size * sizeof(uint32_t));\n    if (merged_starts  == NULL)\n        err(1, \"calloc error in giggle_merge_chrom()\");\n\n    uint32_t *merged_ends = \n            (uint32_t *)malloc(merged_ends_size * sizeof(uint32_t));\n    if (merged_ends  == NULL)\n        err(1, \"calloc error in giggle_merge_chrom()\");\n\n    // Collect the values into this node, then write it and clear \n    struct bpt_node *to_write_node = (struct bpt_node *)\n            malloc(sizeof(struct bpt_node));\n    if (to_write_node  == NULL)\n        err(1, \"calloc error in giggle_merge_chrom()\");\n\n    to_write_node->data = (uint32_t *)\n            malloc(BPT_NODE_NUM_ELEMENTS  * sizeof(uint32_t));\n    if (to_write_node->data  == NULL)\n        err(1, \"calloc error in giggle_merge_chrom()\");\n\n    memset(to_write_node->data, 0, BPT_NODE_SIZE);\n\n    BPT_ID(to_write_node) =  ds->num;\n    BPT_PARENT(to_write_node) = 0;\n    BPT_IS_LEAF(to_write_node) = 1;\n    BPT_LEADING(to_write_node) = 0;\n    BPT_NEXT(to_write_node) = 0;\n    BPT_NUM_KEYS(to_write_node) = 0;\n    BPT_POINTERS_BLOCK(to_write_node) = 0;\n\n\n    uint32_t node_key_i = 0;\n\n    // loop over all the elments in the chrom tree and merge into a single tree\n    while (true) {\n\n        if ( (curr_leaf_id_1 == 0 ) && (curr_leaf_id_0 == 0) ) \n            break;\n\n        uint32_t bpt_key_value = 0, bpt_pointer_value = 0;\n\n        // Choose the next lowest value to merge in hhhhhhhh \n        if ((curr_leaf_id_1 == 0 ) ||\n            (BPT_KEYS(curr_leaf_0)[i_0]) < (BPT_KEYS(curr_leaf_1)[i_1])) {\n            //{{{pick the value from 0 if it is the only one left, or it is\n            //less\n\n            bpt_key_value = BPT_KEYS(curr_leaf_0)[i_0];\n            \n            uint32_t orig_merged_starts_num = merged_starts_num;\n            uint32_t orig_merged_ends_num = merged_ends_num;\n\n            //fprintf(stderr,\"0: \");\n            giggle_merge_leaf_key(curr_leaf_0,\n                                  curr_leaf_data_0,\n                                  i_0,\n                                  context_tree_0,\n                                  offset_id_map_0,\n                                  file_index_id_map_0,\n                                  gi_0->offset_idx->index,\n                                  merged_offset_index,\n                                  &merged_starts, \n                                  &merged_starts_size, \n                                  &merged_starts_num, \n                                  &merged_ends,\n                                  &merged_ends_size,\n                                  &merged_ends_num);\n\n            bpt_pointer_value = (merged_starts_num << 16) + merged_ends_num;\n\n            /*\n            fprintf(stderr,\n                    \"merged s:%u-%u,%u e:%u-%u,%u\\n\",\n                    orig_merged_starts_num,\n                    merged_starts_num,\n                    (orig_merged_starts_num << 16) + merged_starts_num,\n                    orig_merged_ends_num,\n                    merged_ends_num,\n                    (orig_merged_ends_num << 16) + merged_ends_num);\n            */\n            i_0+=1;\n            //}}}\n        } else if ((curr_leaf_id_0 == 0 ) ||\n                   (BPT_KEYS(curr_leaf_0)[i_0] > BPT_KEYS(curr_leaf_1)[i_1])) {\n            //{{{ pick the value from 1 if it is the only one left, or it is\n            //less\n            bpt_key_value = BPT_KEYS(curr_leaf_1)[i_1];\n\n            uint32_t orig_merged_starts_num = merged_starts_num;\n            uint32_t orig_merged_ends_num = merged_ends_num;\n\n            //fprintf(stderr,\"1: \");\n            giggle_merge_leaf_key(curr_leaf_1,\n                                  curr_leaf_data_1,\n                                  i_1,\n                                  context_tree_1,\n                                  offset_id_map_1,\n                                  file_index_id_map_1,\n                                  gi_1->offset_idx->index,\n                                  merged_offset_index,\n                                  &merged_starts, \n                                  &merged_starts_size, \n                                  &merged_starts_num, \n                                  &merged_ends,\n                                  &merged_ends_size,\n                                  &merged_ends_num);\n\n            bpt_pointer_value = (merged_starts_num << 16) + merged_ends_num;\n\n            /*\n            fprintf(stderr,\n                    \"merged s:%u-%u,%u e:%u-%u,%u\\n\",\n                    orig_merged_starts_num,\n                    merged_starts_num,\n                    (orig_merged_starts_num << 16) + merged_starts_num,\n                    orig_merged_ends_num,\n                    merged_ends_num,\n                    (orig_merged_ends_num << 16) + merged_ends_num);\n            */\n\n            i_1+=1;\n            //}}}\n        } else if ((BPT_KEYS(curr_leaf_0)[i_0]) == \n                   (BPT_KEYS(curr_leaf_1)[i_1])) {\n            // {{{ they are equal\n\n            uint32_t orig_merged_starts_num = merged_starts_num;\n            uint32_t orig_merged_ends_num = merged_ends_num;\n\n            bpt_key_value = BPT_KEYS(curr_leaf_0)[i_0];\n\n            //fprintf(stderr,\"0 1: \");\n            giggle_merge_leaf_key(curr_leaf_0,\n                                  curr_leaf_data_0,\n                                  i_0,\n                                  context_tree_0,\n                                  offset_id_map_0,\n                                  file_index_id_map_0,\n                                  gi_0->offset_idx->index,\n                                  merged_offset_index,\n                                  &merged_starts, \n                                  &merged_starts_size, \n                                  &merged_starts_num, \n                                  &merged_ends,\n                                  &merged_ends_size,\n                                  &merged_ends_num);\n\n\n            giggle_merge_leaf_key(curr_leaf_1,\n                                  curr_leaf_data_1,\n                                  i_1,\n                                  context_tree_1,\n                                  offset_id_map_1,\n                                  file_index_id_map_1,\n                                  gi_1->offset_idx->index,\n                                  merged_offset_index,\n                                  &merged_starts, \n                                  &merged_starts_size, \n                                  &merged_starts_num, \n                                  &merged_ends,\n                                  &merged_ends_size,\n                                  &merged_ends_num);\n\n            bpt_pointer_value = (merged_starts_num << 16) + merged_ends_num;\n\n            /*\n            fprintf(stderr,\n                    \"merged s:%u-%u,%u e:%u-%u,%u\\n\",\n                    orig_merged_starts_num,\n                    merged_starts_num,\n                    (orig_merged_starts_num << 16) + merged_starts_num,\n                    orig_merged_ends_num,\n                    merged_ends_num,\n                    (orig_merged_ends_num << 16) + merged_ends_num);\n            */\n\n            i_0+=1;\n            i_1+=1;\n            //}}}\n        } else {\n            errx(1, \"Not > < or ==\");\n        }\n\n        //{{{ see if we are moving to the next leaf node on tree 0\n        if ( (curr_leaf_id_0 > 0) &&\n             (i_0 == BPT_NUM_KEYS(curr_leaf_0)) ) {\n\n            curr_leaf_id_0 = BPT_NEXT(curr_leaf_0);\n\n            if (curr_leaf_id_0 != 0) {\n                CACHE_NAME_SPACE = gi_0_cache_name_space;\n                curr_leaf_0 = cache.get(chr_id_0,\n                                        curr_leaf_id_0 - 1,\n                                        &bpt_node_cache_handler);\n                i_0 = 0;\n\n                curr_leaf_data_0 = \n                    cache.get(chr_id_0,\n                              BPT_POINTERS_BLOCK(curr_leaf_0) - 1,\n                              &leaf_data_cache_handler);\n                /*\n                fprintf(stderr,\n                        \"node_0: #:%u\\n\",\n                        BPT_NUM_KEYS(curr_leaf_0));\n                fprintf(stderr,\n                        \"leaf_0: l:%u s:%u e:%u\\n\",\n                        curr_leaf_data_0->num_leading,\n                        curr_leaf_data_0->num_starts,\n                        curr_leaf_data_0->num_ends);\n                */\n\n            }\n        }\n        //}}}\n\n        //{{{ see if we are moving to the next leaf node on tree 1\n        if ( (curr_leaf_id_1 > 0) &&\n             (i_1 == BPT_NUM_KEYS(curr_leaf_1)) ) {\n\n            curr_leaf_id_1 = BPT_NEXT(curr_leaf_1);\n\n            if (curr_leaf_id_1 != 0) {\n                CACHE_NAME_SPACE = gi_1_cache_name_space;\n                curr_leaf_1 = cache.get(chr_id_1,\n                                        curr_leaf_id_1 - 1,\n                                        &bpt_node_cache_handler);\n                i_1 = 0;\n\n                curr_leaf_data_1 = \n                    cache.get(chr_id_1,\n                              BPT_POINTERS_BLOCK(curr_leaf_1) - 1,\n                              &leaf_data_cache_handler);\n            }\n        }\n        //}}}\n\n        /*\n        fprintf(stderr,\n                \"i:%u key:%u\\tpointer:%u\\t%u\\t%u\\n\",\n                node_key_i,\n                bpt_key_value,\n                bpt_pointer_value,\n                bpt_pointer_value >> 16,\n                bpt_pointer_value & 65535);\n        */\n\n        //BPT_ID(to_write_node) =  ds->num;\n        //BPT_PARENT(to_write_node) = 0;\n        //BPT_IS_LEAF(to_write_node) = 1;\n        //BPT_LEADING(to_write_node) = 0;\n        //BPT_NEXT(to_write_node) = 0;\n        //BPT_NUM_KEYS(to_write_node) = 0;\n        //BPT_POINTERS_BLOCK(to_write_node) = ds->num + 1;\n        \n        BPT_KEYS(to_write_node)[node_key_i] = bpt_pointer_value;\n        BPT_POINTERS(to_write_node)[node_key_i] = bpt_pointer_value;\n\n        node_key_i += 1;\n\n        // The current node is full\n        if (node_key_i == ORDER - 1) {\n\n            uint32_t j;\n            for (j = 0; j < node_key_i; ++j) {\n                fprintf(stderr,\n                        \"%u\\t%u %u %u %u\\n\",\n                        j,\n                        BPT_ID(to_write_node),\n                        BPT_KEYS(to_write_node)[j],\n                        (BPT_POINTERS(to_write_node)[j]) >> 16,\n                        (BPT_POINTERS(to_write_node)[j])  & 65535);\n            }\n\n            // Add a leading node\n            if ( ( jsw_avlsize(context_tree_0) > 0 ) || \n                 ( jsw_avlsize(context_tree_0) > 0 ) ) {\n                BPT_LEADING(to_write_node) = 1;\n                BPT_POINTERS_BLOCK(to_write_node) = ds->num + 1;\n            }\n\n            // Everything is stored through the disk_store struct ds\n            // write the current node and the leaf node \n            // set up the next node\n\n            fprintf(stderr, \"tree_0 size:%zu\\n\", jsw_avlsize(context_tree_0));\n            fprintf(stderr, \"tree_1 size:%zu\\n\", jsw_avlsize(context_tree_1));\n\n            //jsw_avltrav_t *trav = jsw_avltnew ( void );\n            //void *jsw_avltfirst ( jsw_avltrav_t *trav, jsw_avltree_t *tree );\n            //void *jsw_avltnext ( jsw_avltrav_t *trav )\n            //void jsw_avltdelete ( jsw_avltrav_t *trav );\n\n            // if void           jsw_avltdelete ( jsw_avltrav_t *trav );\n        //if ( (curr_leaf_id_1 == 0 ) && (curr_leaf_id_0 == 0) ) \n        //Not going to be a next node\n\n            node_key_i = 0;\n        }\n    }\n\n    if (node_key_i > 0) {\n        uint32_t j;\n        for (j = 0; j < node_key_i; ++j) {\n            fprintf(stderr,\n                    \"%u\\t%u %u %u\\n\",\n                    j,\n                    BPT_KEYS(to_write_node)[j],\n                    (BPT_POINTERS(to_write_node)[j]) >> 16,\n                    (BPT_POINTERS(to_write_node)[j])  & 65535);\n        }\n    }\n\n\n\n    jsw_avldelete(context_tree_0);\n    jsw_avldelete(context_tree_1);\n\n    indexed_list_destroy(&offset_id_map_0);\n    indexed_list_destroy(&offset_id_map_1);\n    return 0;\n}\n//}}}\n//{{{ uint32_t giggle_merge_add_file_index(struct giggle_index *gi,\nuint32_t giggle_merge_add_file_index(struct giggle_index *gi,\n                                     struct indexed_list *file_index_id_map,\n                                     struct unordered_list *merged_file_index)\n{\n    uint32_t i;\n    for (i = 0 ; i < gi->file_idx->index->num; ++i) {\n        struct file_data *fd = file_index_get(gi->file_idx, i);\n\n        struct file_data *merged_fd = (struct file_data *)\n                malloc(sizeof(struct file_data));\n        if (merged_fd  == NULL)\n            err(1, \"calloc error in giggle_merge_add_file_index()\");\n\n        merged_fd->num_intervals = fd->num_intervals;\n        merged_fd->mean_interval_size = fd->mean_interval_size;\n        merged_fd->file_name = strdup(fd->file_name);\n\n        uint32_t merged_id = merged_file_index->num;\n\n        uint32_t r = unordered_list_add(merged_file_index, merged_fd);\n\n        r = indexed_list_add(file_index_id_map, i, &merged_id);\n    }\n\n    return gi->file_idx->index->num;\n}\n//}}}\n//{{{ uint32_t giggle_merge_get_chrm_index(struct giggle_index *gi_0,\nuint32_t giggle_merge_chrm_union(struct giggle_index *gi_0,\n                                 struct giggle_index *gi_1,\n                                 char ***merged_chrm_set)\n{\n    uint32_t gi_0_num = gi_0->chrm_idx->index->num;\n    uint32_t gi_1_num = gi_1->chrm_idx->index->num;\n    // Find the union of the two chrom sets\n    char **full_chrm_set = \n            (char **)malloc( (gi_0_num + gi_1_num) * sizeof (char *));\n    if (*full_chrm_set  == NULL)\n        err(1, \"calloc error in giggle_merge_chrm_union()\");\n\n    uint32_t i;\n    for (i = 0; i < gi_0_num; ++i) {\n        struct str_uint_pair *p = \n                (struct str_uint_pair *)gi_0->chrm_idx->index->data[i];\n        full_chrm_set[i] = strdup(p->str);\n    }\n    for (i = 0; i < gi_1_num; ++i) {\n        struct str_uint_pair *p = \n                (struct str_uint_pair *)gi_1->chrm_idx->index->data[i];\n        full_chrm_set[i + gi_0_num] = strdup(p->str);\n    }\n\n    qsort(full_chrm_set, gi_0_num + gi_1_num, sizeof(char *), char_p_cmp);\n\n    uint32_t j, num_uniq = 0;\n\n    for (i = 0; i < gi_0_num + gi_1_num; ) {\n        num_uniq += 1;\n        j = i + 1;\n        while ((j < gi_0_num + gi_1_num) &&\n               (strcmp(full_chrm_set[i], full_chrm_set[j]) == 0)) {\n            j += 1;\n        }\n        i = j;\n    }\n\n    *merged_chrm_set = (char **)malloc(num_uniq * sizeof (char *));\n    if (merged_chrm_set  == NULL)\n        err(1, \"malloc error in giggle_merge_chrm_union()\");\n\n    uint32_t merged_chrm_set_i = 0;\n    for (i = 0; i < gi_0_num + gi_1_num; ) {\n        (*merged_chrm_set)[merged_chrm_set_i] = strdup(full_chrm_set[i]);\n        merged_chrm_set_i += 1;\n        j = i + 1;\n        while ((j < gi_0_num + gi_1_num) &&\n               (strcmp(full_chrm_set[i], full_chrm_set[j]) == 0)) {\n            j += 1;\n        }\n        i = j;\n    }\n\n    for (i = 0; i < gi_0_num + gi_1_num; ++i)\n        free(full_chrm_set[i]);\n    free(full_chrm_set);\n\n    return num_uniq;\n}\n//}}}\n//{{{void giggle_merge_leaf_key(struct bpt_node *node,\nvoid giggle_merge_leaf_key(struct bpt_node *node,\n                           struct leaf_data *data,\n                           uint32_t key_i,\n                           jsw_avltree_t *context_tree,\n                           struct indexed_list *offset_id_map,\n                           struct indexed_list *file_index_id_map,\n                           struct file_id_offset_pairs *offset_index,\n                           struct file_id_offset_pairs **merged_offset_index,\n                           uint32_t **merged_starts, \n                           uint32_t *merged_starts_size, \n                           uint32_t *merged_starts_num, \n                           uint32_t **merged_ends,\n                           uint32_t *merged_ends_size,\n                           uint32_t *merged_ends_num)\n{\n    // put all of the offset ids in starts into the tree\n    // get merged offset ids for each start\n    // add the merged ids to the start for this position\n    // take all of the offset ids out of the tree\n    fprintf(stderr,\n            \"%u\\t%u\\t%u\\ts:%u-%u\\te:%u-%u\"\n            \"\\t\",\n            key_i,\n            BPT_POINTERS(node)[key_i],\n            BPT_KEYS(node)[key_i],\n            LEAF_DATA_STARTS_START(node,key_i),\n            LEAF_DATA_STARTS_END(node,key_i),\n            LEAF_DATA_ENDS_START(node,key_i),\n            LEAF_DATA_ENDS_END(node,key_i)\n            );\n\n    uint32_t *starts = NULL, *ends = NULL;\n    uint32_t starts_size = 0, ends_size = 0;\n    // get the list of starts and ends at this key\n    uint32_t buff_size = leaf_data_get_starts_ends(node,\n                                                   data,\n                                                   key_i,\n                                                   key_i,\n                                                   &starts,\n                                                   &starts_size,\n                                                   &ends,\n                                                   &ends_size);\n\n    //grow the merged offset if we need to\n    while ((*merged_offset_index)->size < \n           (*merged_offset_index)->num + starts_size) {\n\n        (*merged_offset_index)->size = (*merged_offset_index)->size * 2;\n\n        fprintf(stderr,\n                \"merged_offset_index size: %\" PRIu64 \"\\n\",\n                (*merged_offset_index)->size);\n\n\n        (*merged_offset_index)->vals = (struct file_id_offset_pair *)\n            realloc((*merged_offset_index)->vals,\n                    (*merged_offset_index)->size * \n                    sizeof(struct file_id_offset_pair));\n        if ((*merged_offset_index)->vals  == NULL)\n            err(1, \"realloc error in giggle_merge_leaf_key()\");\n\n        memset((*merged_offset_index)->vals + (*merged_offset_index)->num,\n               0,\n               ((*merged_offset_index)->size - (*merged_offset_index)->num) *\n               sizeof(struct file_id_offset_pair));\n    }\n\n    //grow the merged starts if we need to\n    while (*merged_starts_size < *merged_starts_num + starts_size) {\n        *merged_starts_size =  *merged_starts_size * 2;\n\n        fprintf(stderr, \"merged_starts: %u\\n\", *merged_starts_size);\n\n        *merged_starts = (uint32_t *)\n            realloc(*merged_starts, *merged_starts_size * sizeof(uint32_t)); \n        if (merged_starts == NULL)\n            err(1, \"realloc error in giggle_merge_leaf_key()\");\n    }\n  \n    //grow the merged ends if we need to\n    while (*merged_ends_size < *merged_ends_num + ends_size) {\n        *merged_ends_size =  *merged_ends_size * 2;\n\n        fprintf(stderr, \"merged_ends: %u\\n\", *merged_ends_size);\n\n        *merged_ends = (uint32_t *)\n            realloc(*merged_ends, *merged_ends_size * sizeof(uint32_t)); \n        if (merged_ends == NULL)\n            err(1, \"realloc error in giggle_merge_leaf_key()\");\n    }\n\n    // loop over the starts\n    // get the merged id\n    // add to context tree\n    // - add to new offset_index\n    // - add to new starts list at this position\n    uint32_t j;\n    fprintf(stderr, \"starts:\\t\");\n    for (j = 0; j < starts_size; ++j) {\n        int r = indexed_list_add(offset_id_map,\n                                 starts[j],\n                                 &((*merged_offset_index)->num));\n\n        fprintf(stderr,\n                \"oid:%u,mid:%\" PRIu64 \" \",\n                starts[j],\n                (*merged_offset_index)->num);\n\n        r = jsw_avlinsert(context_tree, starts + j);\n\n\n        uint32_t *merged_file_id = \n                indexed_list_get(file_index_id_map, \n                                 offset_index->vals[starts[j]].file_id);\n        //(*merged_offset_index)->vals[(*merged_offset_index)->num].file_id =\n            //offset_index->vals[starts[j]].file_id;\n            \n        (*merged_offset_index)->vals[(*merged_offset_index)->num].file_id =\n            *merged_file_id;\n\n        (*merged_offset_index)->vals[(*merged_offset_index)->num].offset =\n            offset_index->vals[starts[j]].offset;\n\n        (*merged_starts)[*merged_starts_num] = (*merged_offset_index)->num;\n        *merged_starts_num = *merged_starts_num + 1;\n\n        (*merged_offset_index)->num = (*merged_offset_index)->num + 1;\n    }\n    fprintf(stderr, \"\\t\");\n\n    // loop over ends\n    // remove from context tree\n    // get merged id\n    // - add to new ends list at this position\n    fprintf(stderr, \"ends:\\t\");\n    for (j = 0; j < ends_size; ++j) {\n        uint32_t *merged_id = (uint32_t *)\n                indexed_list_get(offset_id_map, ends[j]);\n        fprintf(stderr,\n                \"oid:%u,mid:%u \",\n                ends[j], \n                *merged_id);\n\n        (*merged_ends)[*merged_ends_num] = *merged_id;\n        *merged_ends_num = *merged_ends_num + 1;\n\n        int r = jsw_avlerase(context_tree, ends + j);\n    }\n    fprintf(stderr, \"\\n\");\n\n    if (starts != NULL)\n        free(starts);\n    if (ends != NULL)\n        free(ends);\n}\n//}}}\n#endif\n"
  },
  {
    "path": "src/giggle_index.h",
    "content": "#ifndef __GIGGLE_INDEX_H__\n#define __GIGGLE_INDEX_H__\n\n#include <stdint.h>\n#include <htslib/khash.h>\n#include \"bpt.h\"\n#include \"cache.h\"\n#include \"leaf.h\"\n#include \"jsw_avltree.h\"\n#include \"pq.h\"\n#include \"offset_index.h\"\n#include \"metadata_index.h\"\n#include \"query_filter.h\"\n\n#define PROGRAM_NAME  \"giggle\"\n#define MAJOR_VERSION \"0\"\n#define MINOR_VERSION \"6\"\n#define REVISION_VERSION \"3\"\n#define BUILD_VERSION \"0\"\n#define VERSION MAJOR_VERSION \".\" MINOR_VERSION \".\" REVISION_VERSION\n\nchar *CHRM_INDEX_FILE_NAME;\nchar *FILE_INDEX_FILE_NAME;\nchar *ROOT_IDS_FILE_NAME;\nchar *CACHE_FILE_NAME_PREFIX;\n\nvoid c_str_store(void *v, FILE *f, char *file_name);\nvoid *c_str_load(FILE *f, char *file_name);\n\nstruct chrm_index\n{\n    char *file_name;\n    struct ordered_set *index;\n\n};\nstruct chrm_index *chrm_index_init(uint32_t init_size, char *file_name);\nstruct chrm_index *chrm_index_load(char *file_name);\nstruct str_uint_pair *chrm_index_get(struct chrm_index *ci, char *chrm);\nuint32_t chrm_index_add(struct chrm_index *ci, char *chrm);\nvoid chrm_index_store(struct chrm_index *ci);\nvoid chrm_index_destroy(struct chrm_index **ci);\n\nstruct file_index \n{\n    char *file_name; //<! file_index file name\n    struct unordered_list *index; //<! database file_data elements list\n};\n\nstruct file_index *file_index_init(uint32_t init_size, char *file_name);\nvoid file_index_destroy(struct file_index **fi);\nuint32_t file_index_add(struct file_index *fi, char *file_name);\nvoid file_index_store(struct file_index *fi);\nstruct file_index *file_index_load(char *file_name);\nstruct file_data *file_index_get(struct file_index *fi, uint32_t id);\n\n/**\n * @brief The core GIGGLE data structure.\n *\n * Each chrom has its own tree and this struct contains the root node id within\n * each tree. The mapping between chrom strings (e.g., chr1, 1, etc.) is\n * managed by chrm_index. Details about the files contained within the index\n * are stored in file_index. The source file index (within file_index) and\n * relative position of each indexed interval are in offset_index.\n */\nstruct giggle_index\n{\n    uint32_t *root_ids; //!< list of root index for each chrom\n    uint32_t len; //<! allocated size of root_ids\n    uint32_t num; //<! number elements in root_ids\n    struct chrm_index *chrm_idx; //<! chrom string/root_id index pairs\n    struct file_index *file_idx;\n    struct offset_index *offset_idx; //<! file_index/offse pair list\n    struct metadata_index *metadata_idx; //<! metadata of each interval\n    char *data_dir; //<! database directory\n    char *root_ids_file_name; //<! root_ids file name\n};\n\nstruct giggle_query_result\n{\n    struct giggle_index *gi;\n    uint32_t num_files;\n    struct long_uint_ll **offsets;\n    uint32_t num_hits;\n};\n\nstruct giggle_query_result *giggle_query(struct giggle_index *gi,\n                                        char *chrm,\n                                        uint32_t start,\n                                        uint32_t end,\n                                        struct giggle_query_result *gqr);\n\nstruct giggle_query_result *giggle_query_with_query_filter(struct giggle_index *gi,\n                                                           char *chrm,\n                                                           uint32_t start,\n                                                           uint32_t end,\n                                                           struct query_filter *query_filter,\n                                                           struct giggle_query_result *gqr);\n\nvoid apply_query_filter_to_results(struct giggle_index *gi,\n                                   struct query_filter *query_filter,\n                                   void **R_ptr);\n\nvoid giggle_query_result_destroy(struct giggle_query_result **gqr);\n\nstruct giggle_query_iter\n{\n    struct giggle_index *gi;\n    uint32_t file_id, curr, num;\n    struct input_file *ipf;\n    long *sorted_offsets;\n    struct long_uint_pair *sorted_offset_id_pairs;\n};\n\nuint32_t giggle_get_query_len(struct giggle_query_result *gqr,\n                              uint32_t file_id);\n                      \nstruct giggle_query_iter *giggle_get_query_itr(struct giggle_query_result *gqr,\n                                               uint32_t file_id);\n\nstruct giggle_query_iter *giggle_get_query_data_itr(\n        struct giggle_query_result *gqr,\n        uint32_t file_id);\n\nint giggle_query_next(struct giggle_query_iter *gqi,\n                      char **result);\n\nint giggle_query_data(struct giggle_query_iter *gqi,\n                      void *result);\nint giggle_query_next_data(struct giggle_query_iter *gqi,\n                           void **result);\n\nvoid giggle_iter_destroy(struct giggle_query_iter **gqi);\n\n/**\n * @brief\n *\n * @param domain specifies which cache domain (i.e. which tree) to use,\n * typically chrom id\n * @param root_id index of the root node within the tree\n * @param start interval start\n * @param end interval end\n * @param id interval id, typically an index into the offset_index\n *\n * @retval\n */\nuint32_t giggle_insert(uint32_t domain,\n                       uint32_t *root_id,\n                       uint32_t start,\n                       uint32_t end,\n                       uint64_t id);\n\nvoid *giggle_search(uint32_t domain,\n                    uint32_t root_id,\n                    uint32_t start,\n                    uint32_t end);\n\nstruct giggle_def \n{\n    struct cache_handler non_leading_cache_handler;\n    struct cache_handler leading_cache_handler;\n    void *(*new_non_leading)(uint32_t domain);\n    void *(*new_leading)(uint32_t domain);\n    void (*non_leading_SA_add_scalar)(uint32_t domain,\n                                      void *non_leading,\n                                      void *scalar);\n    void (*non_leading_SE_add_scalar)(uint32_t domain, \n                                      void *non_leading,\n                                      void *scalar);\n    void (*leading_B_add_scalar)(uint32_t domain,\n                                 void *leading,\n                                 void *scalar);\n    void (*leading_union_with_B)(uint32_t domain,\n                                 void **result,\n                                 void *leading);\n    void (*non_leading_union_with_SA)(uint32_t domain,\n                                      void **result,\n                                      void *non_leading);\n    void (*non_leading_union_with_SA_subtract_SE)(uint32_t domain,\n                                                  void **result,\n                                                  void *non_leading);\n    void (*write_tree)(void *arg);\n    void *(*giggle_collect_intersection)(uint32_t leaf_start_id,\n                                         int pos_start_id,\n                                         uint32_t leaf_end_id,\n                                         int pos_end_id,\n                                         uint32_t domain,\n                                         void **r);\n    void (*map_intersection_to_offset_list)(struct giggle_index *gi,\n                                            struct giggle_query_result *gqr,\n                                            void *_R);\n};\n\nstruct giggle_def giggle_data_handler;\n\n\nstruct giggle_index *giggle_init_index(uint32_t init_size,\n                                       char *offset_file_name);\n\nstruct giggle_index *giggle_init_index_with_metadata(uint32_t init_size,\n                                                     char *offset_file_name,\n                                                     char *metadata_conf_name,\n                                                     char *metadata_file_name);\n\nvoid giggle_index_destroy(struct giggle_index **gi);\nuint32_t giggle_get_chrm_id(struct giggle_index *gi, char *chrm);\nuint32_t giggle_get_file_id(struct giggle_index *gi, char *path);\n\n/**\n * @brief Add the intervals from a file to a GIGGLE index\n *\n * The file will be added to the GIGGLE index file_index, all of the\n * intervals to the offset_index, and giggle_insert will add the interval to\n * the tree where the starnd and end are keys and the value is that interval's\n * index into the offset_index. Stats about the file (mean interval size,\n * number of intervals) are collected for statistical analysis on query\n * results.\n *\n * @param gi an initialized GIGGLE index\n * @param file_name the file to be indexed\n *\n * @retval the total number of intervals indexed\n */\nuint32_t giggle_index_file(struct giggle_index *gi,\n                           char *file_name); \n/**\n * @brief A wrapper around giggle_index_file, that loops over files in a\n * directory.\n *\n * @param gi the GIGGLE index struct to be populated\n * @param path_name path to a set of interval files to be indexed\n * stored.\n * @param verbose give extra output in the indexing process\n *\n * @retval the total number of intervals indexed\n *\n * Example Usage:\n * @code\n *      struct giggle_index *gi = g\n *              giggle_init(23,\n *                          NULL,\n *                          0,\n *                          uint64_t_ll_giggle_set_data_handler);\n *      char *path_name = \"../data/many/\\*bed.gz\";\n *      uint32_t r = giggle_index_directory(gi, path_name, 0); \n *      giggle_index_destroy(&gi);\n *      cache.destroy();\n * @endcode\n */ \nuint32_t giggle_index_directory(struct giggle_index *gi,\n                                char *path_name,\n                                int verbose);\nvoid *giggle_query_region(struct giggle_index *gi,\n                          char *chrm,\n                          uint32_t start,\n                          uint32_t end);\n\n/**\n * @brief Initialize a new GIGGLE index.\n *\n * @param num_chrms an estimate of how many chroms will be considered\n * @param output_dir the directory to store files, can be NULL if the database\n * will not be saved\n * @param force 1 to overwrite any existing index in output_dir, 0 to not\n * @param giggle_set_data_handler defines how to organize the data.\n * uint64_t_ll_giggle_set_data_handler is good for building the index from\n * scratch.\n *\n * @retval an initialize GIGGLE index\n * Example Usage:\n * @code\n *      struct giggle_index *gi = g\n *              giggle_init(23,\n *                          \"giggle_i\",\n *                          0,\n *                          uint64_t_ll_giggle_set_data_handler);\n *\n *      giggle_index_destroy(&gi);\n *      cache.destroy();\n * @endcode\n */\nstruct giggle_index *giggle_init(uint32_t num_chrms,\n                                 char *output_dir,\n                                 uint32_t force,\n                                 void (*giggle_set_data_handler)());\nstruct giggle_index *giggle_init_with_metadata(uint32_t num_chrms,\n                                               char *output_dir,\n                                               char *metadata_conf_filename,\n                                               uint32_t force,\n                                               void (*giggle_set_data_handler)());\nuint32_t giggle_store(struct giggle_index *gi);\n\n/**\n * @brief Load a previously stored GIGGLE index.\n *\n * @param data_dir the directory containing all database files\n * @param giggle_set_data_handler defines how data is stored\n *\n * @retval the GIGGLE index\n *\n * Example Usage:\n * @code\n *      \n * @endcode\n */\nstruct giggle_index *giggle_load(char *data_dir,\n                                 void (*giggle_set_data_handler)(void));\n\nstruct giggle_index *giggle_load_with_metadata(char *data_dir,\n                                               int load_metadata,\n                                               void (*giggle_set_data_handler)(void));\n\nstruct cache_handler leaf_data_cache_handler;\n\nuint32_t giggle_get_leaf_data(struct giggle_index *gi,\n                              uint32_t domain,\n                              uint32_t leaf_id,\n                              struct leaf_data **lf);\n\nstruct cache_handler leaf_data_cache_handler;\n\nuint32_t giggle_leaf_data_get_intersection_size(uint32_t leaf_start_id,\n                                                int pos_start_id,\n                                                uint32_t leaf_end_id,\n                                                int pos_end_id,\n                                                uint32_t domain);\n\nuint32_t giggle_leaf_data_get_intersection(uint32_t leaf_start_id,\n                                           int pos_start_id,\n                                           uint32_t leaf_end_id,\n                                           int pos_end_id,\n                                           uint32_t domain);\n\nvoid leaf_data_map_intersection_to_offset_list(struct giggle_index *gi,\n                                               struct giggle_query_result *gqr,\n                                               void *_R);\n\n//void giggle_write_tree(struct giggle_index *gi);\nvoid giggle_write_tree_cache_dump(void *giggle_index);\nvoid giggle_write_tree_leaf_data(void *giggle_index);\n\n\nvoid *giggle_collect_intersection_data_in_pointers(uint32_t leaf_start_id,\n                                                   int pos_start_id,\n                                                   uint32_t leaf_end_id,\n                                                   int pos_end_id,\n                                                   uint32_t domain,\n                                                   void **r);\n\nvoid *giggle_collect_intersection_data_in_block(uint32_t leaf_start_id,\n                                                int pos_start_id,\n                                                uint32_t leaf_end_id,\n                                                int pos_end_id,\n                                                uint32_t domain,\n                                                void **r);\n#if 0\nvoid giggle_merge_leaf_key(struct bpt_node *node,\n                           struct leaf_data *data,\n                           uint32_t key_i,\n                           jsw_avltree_t *context_tree,\n                           struct indexed_list *offset_id_map,\n                           struct indexed_list *file_index_id_map,\n                           struct file_id_offset_pairs *offset_index,\n                           struct file_id_offset_pairs **merged_offset_index,\n                           uint32_t **merged_starts, \n                           uint32_t *merged_starts_size, \n                           uint32_t *merged_starts_num, \n                           uint32_t **merged_ends,\n                           uint32_t *merged_ends_size,\n                           uint32_t *merged_ends_num);\n\nuint32_t giggle_merge_chrom(char *chrm_string,\n                            struct giggle_index *gi_0,\n                            struct indexed_list *file_index_id_map_0,\n                            uint32_t gi_0_cache_name_space,\n                            struct giggle_index *gi_1,\n                            struct indexed_list *file_index_id_map_1,\n                            uint32_t gi_1_cache_name_space,\n                            struct disk_store *ds,\n                            struct file_id_offset_pairs **merged_offset_index);\n\nuint32_t giggle_merge_chrm_union(struct giggle_index *gi_0,\n                                 struct giggle_index *gi_1,\n                                 char ***merged_chrm_set);\n\nuint32_t giggle_merge_add_file_index(struct giggle_index *gi,\n                                     struct indexed_list *file_index_id_map,\n                                     struct unordered_list *merged_file_index);\n#endif\n\nint giggle_bulk_insert_append_bpt_key(struct bpt_node *bpn,\n                                      uint32_t key_val,\n                                      struct disk_store *ds,\n                                      jsw_avltree_t *avl,\n                                      struct uint64_t_array *leading,\n                                      struct uint64_t_array *starts,\n                                      struct uint64_t_array *ends,\n                                      struct uint32_t_array *starts_pointers,\n                                      struct uint32_t_array *ends_pointers);\n\nvoid giggle_bulk_insert_write_leaf_node(struct bpt_node *bpn,\n                                        struct disk_store *ds,\n                                        struct uint64_t_array *leading,\n                                        struct uint64_t_array *starts,\n                                        struct uint64_t_array *ends,\n                                        struct uint32_t_array *starts_pointers,\n                                        struct uint32_t_array *ends_pointers);\n\nuint32_t giggle_bulk_insert_add_tree_level(struct disk_store *curr_ds,\n                                           uint32_t curr_level_first_id,\n                                           uint32_t curr_level_num_nodes,\n                                           uint32_t curr_level_is_leaf,\n                                           uint32_t *new_level_first_id);\nuint32_t giggle_bulk_insert_open_files(char *path_name,\n                                       char *output_dir_name,\n                                       struct input_file ***i_files,\n                                       struct file_index **file_idx);\n\nvoid giggle_bulk_insert_prime_pqs(struct giggle_index *gi,\n                                  pri_queue *pq_start,\n                                  struct pq_data *pqd_starts,\n                                  pri_queue *pq_end,\n                                  struct input_file **i_files,\n                                  uint32_t num_input_files);\nvoid giggle_bulk_insert_build_leaf_levels(struct giggle_index *gi,\n                                          pri_queue *pq_start,\n                                          struct pq_data *pqd_starts,\n                                          pri_queue *pq_end,\n                                          struct input_file **i_files,\n                                          uint32_t num_input_files);\nvoid giggle_bulk_insert_build_tree_on_leaves(struct giggle_index *gi);\n\nuint64_t giggle_bulk_insert(char *input_path_name,\n                            char *output_path_name,\n                            uint32_t force);\n\nuint64_t giggle_bulk_insert_with_metadata(char *input_path_name,\n                                          char *output_path_name,\n                                          char *metadata_conf_name,\n                                          uint32_t force);\n\nuint32_t giggle_get_indexed_files(char *index_dir_name,\n                                  char ***names,\n                                  uint32_t **num_intervals,\n                                  double **mean_interval_sizes);\n\nvoid block_store_giggle_set_data_handler();\n#endif\n"
  },
  {
    "path": "src/index.c",
    "content": "#include \"cache.h\"\n#include \"giggle_index.h\"\n#include \"ll.h\"\n#include \"util.h\"\n#include \"wah.h\"\n#include <ctype.h>\n#include <err.h>\n#include <getopt.h>\n#include <inttypes.h>\n#include <limits.h>\n#include <stdio.h>\n#include <stdlib.h>\n#include <string.h>\n#include <sysexits.h>\n#include <unistd.h>\n\nint index_help(int exit_code);\nint index_main(int argc, char **argv, char *full_cmd);\n\nint index_help(int exit_code) {\n  fprintf(stderr,\n          \"%s, v%s\\n\"\n          \"usage:   %s index -i <input files> -o <output dir> -f\\n\"\n          \"         options:\\n\"\n          \"             -s  Files are sorted\\n\"\n          \"             -i  Files to index (e.g. data/*.gz)\\n\"\n          \"             -o  Index output directory\\n\"\n          \"             -m  Metadata config file\\n\"\n          \"             -f  For reindex if output directory exists\\n\",\n          PROGRAM_NAME, VERSION, PROGRAM_NAME);\n  return exit_code;\n}\n\nint index_main(int argc, char **argv, char *full_cmd) {\n  if (argc < 2)\n    return index_help(EX_OK);\n\n  uint32_t num_chrms = 100;\n  int c;\n  char *input_pattern = NULL, *output_dir_name = NULL,\n       *metadata_conf_name = NULL;\n  char *i_type = \"i\";\n\n  int i_is_set = 0, o_is_set = 0, s_is_set = 0, f_is_set = 0, m_is_set = 0;\n\n  while ((c = getopt(argc, argv, \"i:o:m:fsh\")) != -1) {\n    switch (c) {\n    case 'i':\n      i_is_set = 1;\n      input_pattern = optarg;\n      break;\n    case 'o':\n      o_is_set = 1;\n      output_dir_name = optarg;\n      break;\n    case 'm':\n      m_is_set = 1;\n      metadata_conf_name = optarg;\n      break;\n    case 'f':\n      f_is_set = 1;\n      break;\n    case 's':\n      s_is_set = 1;\n      break;\n    case 'h':\n      return index_help(EX_OK);\n    case '?':\n      if ((optopt == 'i') || (optopt == 'o') || (optopt == 'm'))\n        fprintf(stderr, \"Option -%c requires an argument.\\n\", optopt);\n      else if (isprint(optopt))\n        fprintf(stderr, \"Unknown option `-%c'.\\n\", optopt);\n      else\n        fprintf(stderr, \"Unknown option character `\\\\x%x'.\\n\", optopt);\n      return index_help(EX_USAGE);\n    default:\n      return index_help(EX_OK);\n    }\n  }\n\n  if (i_is_set == 0) {\n    fprintf(stderr, \"Input file is not set\\n\");\n    return index_help(EX_USAGE);\n  } else if (o_is_set == 0) {\n    fprintf(stderr, \"Output file is not set\\n\");\n    return index_help(EX_USAGE);\n  }\n\n  /* Handling the giggle input and output directory paths:\n   *\n   * Assumptions:\n   * 1. giggle input_dir_name is a glob pattern that is only in a single\n   * directory\n   * 2. giggle output_dir_name and input_dir_name have the same parent\n   *     - we could technically let the input_dir_name glob pattern cover\n   * several directories as long as their parent is the same as the\n   * output_dir_name, but for now it's easiest to just require the\n   * input_dir_name to be a single directory.\n   *\n   * Procedure:\n   * 1. Get the absolute path for one of the input files (using glob)\n   * 2. Get the parent directory (basename of dirname)\n   * 3. chdir to the parent directory so that everything is relative to that\n   * directory\n   * 4. Pass the $data_dir/$glob_pattern to giggle indexing functions where\n   * $data_dir is the basename(dirname) of input_dir_name and $glob_pattern is\n   * basename of input_dir_name eg. if input_dir_name is \"/path/to/data/\\*.gz\",\n   * then data_dir = \"data\".\n   */\n\n  // Get the absolute path for one of the input files (using glob)\n  char glob_abs_path[4096];\n  abs_path_of_glob(input_pattern, glob_abs_path);\n\n  char glob_basename[4096];\n  safe_basename(input_pattern, glob_basename);\n\n  // input data is directly under this directory\n  char input_dirname[4096];\n  safe_dirname(glob_abs_path, input_dirname);\n\n  // working directory for building the index\n  char parent_dirname[4096];\n  safe_dirname(input_dirname, parent_dirname);\n\n  char output_parent_dirname[4096];\n  safe_dirname(output_dir_name, output_parent_dirname);\n  char output_parent_abs_path[4096];\n  if (realpath(output_parent_dirname, output_parent_abs_path) == NULL) {\n    fprintf(stderr, \"Invalid output directory path: %s\\n\",\n            output_parent_dirname);\n    exit(EXIT_FAILURE);\n  }\n\n  if (strcmp(parent_dirname, output_parent_abs_path) != 0) {\n    fprintf(stderr,\n            \"Input and output directories must have the same parent.\\n\");\n    exit(EXIT_FAILURE);\n  }\n\n  // just the directory names of the input/output data without the rest of the\n  // path\n  char input_dir_only[4096];\n  char output_dir_only[4096];\n  safe_basename(input_dirname, input_dir_only);\n  safe_basename(output_dir_name, output_dir_only);\n\n  char input_dir_with_glob[4096];\n  snprintf(input_dir_with_glob, 4096, \"%s/%s\", input_dir_only, glob_basename);\n\n  chdir(parent_dirname);\n  struct giggle_index *gi;\n\n  if (s_is_set == 1) {\n    uint64_t num_intervals = giggle_bulk_insert_with_metadata(\n        input_dir_with_glob, output_dir_only, metadata_conf_name, f_is_set);\n    fprintf(stderr, \"Indexed %\" PRIu64 \" intervals.\\n\", num_intervals);\n  } else {\n    gi = giggle_init_with_metadata(num_chrms, output_dir_only,\n                                   metadata_conf_name, f_is_set,\n                                   uint64_t_ll_giggle_set_data_handler);\n    if (gi == NULL)\n      return EX_DATAERR;\n\n    uint32_t r = giggle_index_directory(gi, input_dir_with_glob, 0);\n\n    fprintf(stderr, \"Indexed %u intervals.\\n\", r);\n\n#if BLOCK_STORE\n    giggle_data_handler.write_tree = giggle_write_tree_leaf_data;\n#endif\n\n    r = giggle_store(gi);\n\n    if (r != 0)\n      errx(1, \"Error storing giggle index.\");\n\n    giggle_index_destroy(&gi);\n    cache.destroy();\n  }\n  return EX_OK;\n}\n"
  },
  {
    "path": "src/index_search.c",
    "content": "#include <stdlib.h>\n#include <stdio.h>\n\n#include \"giggle_index.h\"\n#include \"ll.h\"\n\n\nint main(int argc, char **argv)\n{\n    ORDER = 10;\n    struct simple_cache *sc = simple_cache_init(1000, 30, NULL);\n    uint64_t_ll_giggle_set_data_handler();\n    struct giggle_index *gi = giggle_init_index(30);\n    char *path_name = argv[1];\n    uint32_t r = giggle_index_directory(gi, path_name, 0);\n    giggle_query_region(gi, argv[2], atoi(argv[3]), atoi(argv[4]));\n}\n"
  },
  {
    "path": "src/jsw_avltree.c",
    "content": "/*\r\n  AVL balanced tree library\r\n\r\n    > Created (Julienne Walker): June 17, 2003\r\n    > Modified (Julienne Walker): September 24, 2005\r\n*/\r\n#include <stdlib.h>\r\n#include <stdint.h>\r\n#include <stdio.h>\r\n#include <err.h>\r\n\r\n#include \"jsw_avltree.h\"\r\n\r\n#ifndef HEIGHT_LIMIT\r\n#define HEIGHT_LIMIT 64 /* Tallest allowable tree */\r\n#endif\r\n\r\ntypedef struct jsw_avlnode {\r\n  int                 balance; /* Balance factor */\r\n  void               *data;    /* User-defined content */\r\n  struct jsw_avlnode *link[2]; /* Left (0) and right (1) links */\r\n} jsw_avlnode_t;\r\n\r\nstruct jsw_avltree {\r\n  jsw_avlnode_t *root; /* Top of the tree */\r\n  cmp_f          cmp;    /* Compare two items */\r\n  dup_f          dup;    /* Clone an item (user-defined) */\r\n  rel_f          rel;    /* Destroy an item (user-defined) */\r\n  size_t         size;   /* Number of items (user-defined) */\r\n};\r\n\r\nstruct jsw_avltrav {\r\n  jsw_avltree_t *tree;               /* Paired tree */\r\n  jsw_avlnode_t *it;                 /* Current node */\r\n  jsw_avlnode_t *path[HEIGHT_LIMIT]; /* Traversal path */\r\n  size_t         top;                /* Top of stack */\r\n};\r\n\r\n/* Two way single rotation */\r\n#define jsw_single(root,dir) do {         \\\r\n  jsw_avlnode_t *save = root->link[!dir]; \\\r\n  root->link[!dir] = save->link[dir];     \\\r\n  save->link[dir] = root;                 \\\r\n  root = save;                            \\\r\n} while (0)\r\n\r\n/* Two way double rotation */\r\n#define jsw_double(root,dir) do {                    \\\r\n  jsw_avlnode_t *save = root->link[!dir]->link[dir]; \\\r\n  root->link[!dir]->link[dir] = save->link[!dir];    \\\r\n  save->link[!dir] = root->link[!dir];               \\\r\n  root->link[!dir] = save;                           \\\r\n  save = root->link[!dir];                           \\\r\n  root->link[!dir] = save->link[dir];                \\\r\n  save->link[dir] = root;                            \\\r\n  root = save;                                       \\\r\n} while (0)\r\n\r\n/* Adjust balance before double rotation */\r\n#define jsw_adjust_balance(root,dir,bal) do { \\\r\n  jsw_avlnode_t *n = root->link[dir];         \\\r\n  jsw_avlnode_t *nn = n->link[!dir];          \\\r\n  if ( nn->balance == 0 )                     \\\r\n    root->balance = n->balance = 0;           \\\r\n  else if ( nn->balance == bal ) {            \\\r\n    root->balance = -bal;                     \\\r\n    n->balance = 0;                           \\\r\n  }                                           \\\r\n  else { /* nn->balance == -bal */            \\\r\n    root->balance = 0;                        \\\r\n    n->balance = bal;                         \\\r\n  }                                           \\\r\n  nn->balance = 0;                            \\\r\n} while (0)\r\n\r\n/* Rebalance after insertion */\r\n#define jsw_insert_balance(root,dir) do {  \\\r\n  jsw_avlnode_t *n = root->link[dir];      \\\r\n  int bal = dir == 0 ? -1 : +1;            \\\r\n  if ( n->balance == bal ) {               \\\r\n    root->balance = n->balance = 0;        \\\r\n    jsw_single ( root, !dir );             \\\r\n  }                                        \\\r\n  else { /* n->balance == -bal */          \\\r\n    jsw_adjust_balance ( root, dir, bal ); \\\r\n    jsw_double ( root, !dir );             \\\r\n  }                                        \\\r\n} while (0)\r\n\r\n/* Rebalance after deletion */\r\n#define jsw_remove_balance(root,dir,done) do { \\\r\n  jsw_avlnode_t *n = root->link[!dir];         \\\r\n  int bal = dir == 0 ? -1 : +1;                \\\r\n  if ( n->balance == -bal ) {                  \\\r\n    root->balance = n->balance = 0;            \\\r\n    jsw_single ( root, dir );                  \\\r\n  }                                            \\\r\n  else if ( n->balance == bal ) {              \\\r\n    jsw_adjust_balance ( root, !dir, -bal );   \\\r\n    jsw_double ( root, dir );                  \\\r\n  }                                            \\\r\n  else { /* n->balance == 0 */                 \\\r\n    root->balance = -bal;                      \\\r\n    n->balance = bal;                          \\\r\n    jsw_single ( root, dir );                  \\\r\n    done = 1;                                  \\\r\n  }                                            \\\r\n} while (0)\r\n\r\nstatic jsw_avlnode_t *new_node ( jsw_avltree_t *tree, void *data )\r\n{\r\n  jsw_avlnode_t *rn = (jsw_avlnode_t *)malloc ( sizeof *rn );\r\n\r\n  if ( rn == NULL )\r\n    err(1, \"malloc error at new_node()\");\r\n\r\n  rn->balance = 0;\r\n  rn->data = tree->dup ( data );\r\n  rn->link[0] = rn->link[1] = NULL;\r\n\r\n  return rn;\r\n}\r\n\r\njsw_avltree_t *jsw_avlnew ( cmp_f cmp, dup_f dup, rel_f rel )\r\n{\r\n  jsw_avltree_t *rt = (jsw_avltree_t *)malloc ( sizeof *rt );\r\n\r\n  if ( rt == NULL )\r\n      err(1, \"malloc error at jsw_avlnew()\");\r\n\r\n  rt->root = NULL;\r\n  rt->cmp = cmp;\r\n  rt->dup = dup;\r\n  rt->rel = rel;\r\n  rt->size = 0;\r\n\r\n  return rt;\r\n}\r\n\r\nvoid jsw_avldelete ( jsw_avltree_t *tree )\r\n{\r\n  jsw_avlnode_t *it = tree->root;\r\n  jsw_avlnode_t *save;\r\n\r\n  /* Destruction by rotation */\r\n  while ( it != NULL ) {\r\n    if ( it->link[0] == NULL ) {\r\n      /* Remove node */\r\n      save = it->link[1];\r\n      tree->rel ( it->data );\r\n      free ( it );\r\n    }\r\n    else {\r\n      /* Rotate right */\r\n      save = it->link[0];\r\n      it->link[0] = save->link[1];\r\n      save->link[1] = it;\r\n    }\r\n\r\n    it = save;\r\n  }\r\n\r\n  free ( tree );\r\n}\r\n\r\nvoid *jsw_avlfind ( jsw_avltree_t *tree, void *data )\r\n{\r\n  jsw_avlnode_t *it = tree->root;\r\n\r\n  while ( it != NULL ) {\r\n    int cmp = tree->cmp ( it->data, data );\r\n\r\n    if ( cmp == 0 )\r\n      break;\r\n\r\n    it = it->link[cmp < 0];\r\n  }\r\n\r\n  return it == NULL ? NULL : it->data;\r\n}\r\n\r\nint jsw_avlinsert ( jsw_avltree_t *tree, void *data )\r\n{\r\n  /* Empty tree case */\r\n  if ( tree->root == NULL ) {\r\n    tree->root = new_node ( tree, data );\r\n    if ( tree->root == NULL )\r\n      return 0;\r\n  }\r\n  else {\r\n    jsw_avlnode_t head = {0}; /* Temporary tree root */\r\n    jsw_avlnode_t *s, *t;     /* Place to rebalance and parent */\r\n    jsw_avlnode_t *p, *q;     /* Iterator and save pointer */\r\n    int dir;\r\n\r\n    /* Set up false root to ease maintenance */\r\n    t = &head;\r\n    t->link[1] = tree->root;\r\n\r\n    /* Search down the tree, saving rebalance points */\r\n    for ( s = p = t->link[1]; ; p = q ) {\r\n      dir = tree->cmp ( p->data, data ) < 0;\r\n      q = p->link[dir];\r\n\r\n      if ( q == NULL )\r\n        break;\r\n      \r\n      if ( q->balance != 0 ) {\r\n        t = p;\r\n        s = q;\r\n      }\r\n    }\r\n\r\n    p->link[dir] = q = new_node ( tree, data );\r\n    if ( q == NULL )\r\n      return 0;\r\n\r\n    /* Update balance factors */\r\n    for ( p = s; p != q; p = p->link[dir] ) {\r\n      dir = tree->cmp ( p->data, data ) < 0;\r\n      p->balance += dir == 0 ? -1 : +1;\r\n    }\r\n\r\n    q = s; /* Save rebalance point for parent fix */\r\n\r\n    /* Rebalance if necessary */\r\n    if ( abs ( s->balance ) > 1 ) {\r\n      dir = tree->cmp ( s->data, data ) < 0;\r\n      jsw_insert_balance ( s, dir );\r\n    }\r\n\r\n    /* Fix parent */\r\n    if ( q == head.link[1] )\r\n      tree->root = s;\r\n    else\r\n      t->link[q == t->link[1]] = s;\r\n  }\r\n\r\n  ++tree->size;\r\n\r\n  return 1;\r\n}\r\n\r\nint jsw_avlerase ( jsw_avltree_t *tree, void *data )\r\n{\r\n  if ( tree->root != NULL ) {\r\n    jsw_avlnode_t *it, *up[HEIGHT_LIMIT];\r\n    int upd[HEIGHT_LIMIT], top = 0;\r\n    int done = 0;\r\n\r\n    it = tree->root;\r\n\r\n    /* Search down tree and save path */\r\n    for ( ; ; ) {\r\n      if ( it == NULL )\r\n        return 0;\r\n      else if ( tree->cmp ( it->data, data ) == 0 )\r\n        break;\r\n\r\n      /* Push direction and node onto stack */\r\n      upd[top] = tree->cmp ( it->data, data ) < 0;\r\n      up[top++] = it;\r\n\r\n      it = it->link[upd[top - 1]];\r\n    }\r\n\r\n    /* Remove the node */\r\n    if ( it->link[0] == NULL || it->link[1] == NULL ) {\r\n      /* Which child is not null? */\r\n      int dir = it->link[0] == NULL;\r\n\r\n      /* Fix parent */\r\n      if ( top != 0 )\r\n        up[top - 1]->link[upd[top - 1]] = it->link[dir];\r\n      else\r\n        tree->root = it->link[dir];\r\n\r\n      tree->rel ( it->data );\r\n      free ( it );\r\n    }\r\n    else {\r\n      /* Find the inorder successor */\r\n      jsw_avlnode_t *heir = it->link[1];\r\n      void *save;\r\n      \r\n      /* Save this path too */\r\n      upd[top] = 1;\r\n      up[top++] = it;\r\n\r\n      while ( heir->link[0] != NULL ) {\r\n        upd[top] = 0;\r\n        up[top++] = heir;\r\n        heir = heir->link[0];\r\n      }\r\n\r\n      /* Swap data */\r\n      save = it->data;\r\n      it->data = heir->data;\r\n      heir->data = save;\r\n\r\n      /* Unlink successor and fix parent */\r\n      up[top - 1]->link[up[top - 1] == it] = heir->link[1];\r\n\r\n      tree->rel ( heir->data );\r\n      free ( heir );\r\n    }\r\n\r\n    /* Walk back up the search path */\r\n    while ( --top >= 0 && !done ) {\r\n      /* Update balance factors */\r\n      up[top]->balance += upd[top] != 0 ? -1 : +1;\r\n\r\n      /* Terminate or rebalance as necessary */\r\n      if ( abs ( up[top]->balance ) == 1 )\r\n        break;\r\n      else if ( abs ( up[top]->balance ) > 1 ) {\r\n        jsw_remove_balance ( up[top], upd[top], done );\r\n\r\n        /* Fix parent */\r\n        if ( top != 0 )\r\n          up[top - 1]->link[upd[top - 1]] = up[top];\r\n        else\r\n          tree->root = up[0];\r\n      }\r\n    }\r\n\r\n    --tree->size;\r\n  }\r\n\r\n  return 1;\r\n}\r\n\r\nsize_t jsw_avlsize ( jsw_avltree_t *tree )\r\n{\r\n  return tree->size;\r\n}\r\n\r\njsw_avltrav_t *jsw_avltnew ( void )\r\n{\r\n  return malloc ( sizeof ( jsw_avltrav_t ) );\r\n}\r\n\r\nvoid jsw_avltdelete ( jsw_avltrav_t *trav )\r\n{\r\n  free ( trav );\r\n}\r\n\r\n/*\r\n  First step in traversal,\r\n  handles min and max\r\n*/\r\nstatic void *start ( jsw_avltrav_t *trav, jsw_avltree_t *tree, int dir )\r\n{\r\n  trav->tree = tree;\r\n  trav->it = tree->root;\r\n  trav->top = 0;\r\n\r\n  /* Build a path to work with */\r\n  if ( trav->it != NULL ) {\r\n    while ( trav->it->link[dir] != NULL ) {\r\n      trav->path[trav->top++] = trav->it;\r\n      trav->it = trav->it->link[dir];\r\n    }\r\n  }\r\n\r\n  return trav->it == NULL ? NULL : trav->it->data;\r\n}\r\n\r\n/*\r\n  Subsequent traversal steps,\r\n  handles ascending and descending\r\n*/\r\nstatic void *move ( jsw_avltrav_t *trav, int dir )\r\n{\r\n  if ( trav->it->link[dir] != NULL ) {\r\n    /* Continue down this branch */\r\n    trav->path[trav->top++] = trav->it;\r\n    trav->it = trav->it->link[dir];\r\n\r\n    while ( trav->it->link[!dir] != NULL ) {\r\n      trav->path[trav->top++] = trav->it;\r\n      trav->it = trav->it->link[!dir];\r\n    }\r\n  }\r\n  else {\r\n    /* Move to the next branch */\r\n    jsw_avlnode_t *last;\r\n\r\n    do {\r\n      if ( trav->top == 0 ) {\r\n        trav->it = NULL;\r\n        break;\r\n      }\r\n\r\n      last = trav->it;\r\n      trav->it = trav->path[--trav->top];\r\n    } while ( last == trav->it->link[dir] );\r\n  }\r\n\r\n  return trav->it == NULL ? NULL : trav->it->data;\r\n}\r\n\r\nvoid *jsw_avltfirst ( jsw_avltrav_t *trav, jsw_avltree_t *tree )\r\n{\r\n  return start ( trav, tree, 0 ); /* Min value */\r\n}\r\n\r\nvoid *jsw_avltlast ( jsw_avltrav_t *trav, jsw_avltree_t *tree )\r\n{\r\n  return start ( trav, tree, 1 ); /* Max value */\r\n}\r\n\r\nvoid *jsw_avltnext ( jsw_avltrav_t *trav )\r\n{\r\n  return move ( trav, 1 ); /* Toward larger items */\r\n}\r\n\r\nvoid *jsw_avltprev ( jsw_avltrav_t *trav )\r\n{\r\n  return move ( trav, 0 ); /* Toward smaller items */\r\n}\r\n\r\nint int_cmp_f ( const void *p1, const void *p2 )\r\n{\r\n    int *a = (int *)p1;\r\n    int *b = (int *)p2;\r\n\r\n    return *a - *b;\r\n}\r\n\r\nvoid *int_dup_f( void *p )\r\n{\r\n    int *o = (int *)p;\r\n    int *a = (int *)malloc(sizeof(int));\r\n    if (a == NULL)\r\n        err(1, \"malloc error in int_dup_f\");\r\n\r\n    *a = *o;\r\n\r\n    return a;\r\n}\r\n\r\nvoid int_rel_f( void *p )\r\n{\r\n    free(p);\r\n}\r\n\r\nint uint_cmp_f ( const void *p1, const void *p2 )\r\n{\r\n    uint32_t *a = (uint32_t *)p1;\r\n    uint32_t *b = (uint32_t *)p2;\r\n\r\n    if (*a < *b)\r\n        return -1;\r\n    else if (*a > *b)\r\n        return 1;\r\n    else \r\n        return 0;\r\n}\r\n\r\nvoid *uint_dup_f( void *p )\r\n{\r\n    uint32_t *o = (uint32_t *)p;\r\n    uint32_t *a = (uint32_t *)malloc(sizeof(uint32_t));\r\n    if (a == NULL)\r\n        err(1, \"malloc error in uint_dup_f()\");\r\n\r\n    *a = *o;\r\n\r\n    return a;\r\n}\r\n\r\nvoid uint_rel_f( void *p )\r\n{\r\n    free(p);\r\n}\r\n\r\n\r\nint uint64_cmp_f ( const void *p1, const void *p2 )\r\n{\r\n    uint64_t *a = (uint64_t *)p1;\r\n    uint64_t *b = (uint64_t *)p2;\r\n\r\n    if (*a < *b)\r\n        return -1;\r\n    else if (*a > *b)\r\n        return 1;\r\n    else \r\n        return 0;\r\n}\r\n\r\nvoid *uint64_dup_f( void *p )\r\n{\r\n    uint64_t *o = (uint64_t *)p;\r\n    uint64_t *a = (uint64_t *)malloc(sizeof(uint64_t));\r\n    if (a == NULL)\r\n        err(1, \"malloc error in uint_dup_f()\");\r\n\r\n    *a = *o;\r\n\r\n    return a;\r\n}\r\n\r\nvoid uint64_rel_f( void *p )\r\n{\r\n    free(p);\r\n}\r\n\r\n\r\n"
  },
  {
    "path": "src/jsw_avltree.h",
    "content": "#ifndef JSW_AVLTREE_H\r\n#define JSW_AVLTREE_H\r\n\r\n/*\r\n  AVL balanced tree library\r\n\r\n    > Created (Julienne Walker): June 17, 2003\r\n    > Modified (Julienne Walker): September 24, 2005\r\n\r\n  This code is in the public domain. Anyone may\r\n  use it or change it in any way that they see\r\n  fit. The author assumes no responsibility for \r\n  damages incurred through use of the original\r\n  code or any variations thereof.\r\n\r\n  It is requested, but not required, that due\r\n  credit is given to the original author and\r\n  anyone who has modified the code through\r\n  a header comment, such as this one.\r\n*/\r\n#include <stddef.h>\r\n\r\n/* Opaque types */\r\ntypedef struct jsw_avltree jsw_avltree_t;\r\ntypedef struct jsw_avltrav jsw_avltrav_t;\r\n\r\n/* User-defined item handling */\r\ntypedef int   (*cmp_f) ( const void *p1, const void *p2 );\r\ntypedef void *(*dup_f) ( void *p );\r\ntypedef void  (*rel_f) ( void *p );\r\n\r\nint int_cmp_f ( const void *p1, const void *p2 );\r\nvoid *int_dup_f( void *p );\r\nvoid int_rel_f( void *p );\r\n\r\nint uint_cmp_f ( const void *p1, const void *p2 );\r\nvoid *uint_dup_f( void *p );\r\nvoid uint_rel_f( void *p );\r\n\r\nint uint64_cmp_f ( const void *p1, const void *p2 );\r\nvoid *uint64_dup_f( void *p );\r\nvoid uint64_rel_f( void *p );\r\n\r\n/* AVL tree functions */\r\njsw_avltree_t *jsw_avlnew ( cmp_f cmp, dup_f dup, rel_f rel );\r\nvoid           jsw_avldelete ( jsw_avltree_t *tree );\r\nvoid          *jsw_avlfind ( jsw_avltree_t *tree, void *data );\r\nint            jsw_avlinsert ( jsw_avltree_t *tree, void *data );\r\nint            jsw_avlerase ( jsw_avltree_t *tree, void *data );\r\nsize_t         jsw_avlsize ( jsw_avltree_t *tree );\r\n\r\n/* Traversal functions */\r\njsw_avltrav_t *jsw_avltnew ( void );\r\nvoid           jsw_avltdelete ( jsw_avltrav_t *trav );\r\nvoid          *jsw_avltfirst ( jsw_avltrav_t *trav, jsw_avltree_t *tree );\r\nvoid          *jsw_avltlast ( jsw_avltrav_t *trav, jsw_avltree_t *tree );\r\nvoid          *jsw_avltnext ( jsw_avltrav_t *trav );\r\nvoid          *jsw_avltprev ( jsw_avltrav_t *trav );\r\n\r\n#endif\r\n"
  },
  {
    "path": "src/kfunc.c",
    "content": "/* Log gamma function\n * \\log{\\Gamma(z)}\n * AS245, 2nd algorithm, http://lib.stat.cmu.edu/apstat/245\n */\n\n#include <stdio.h>\n#include \"kfunc.h\"\n\n// log\\binom{n}{k}\nlong double _lbinom(long long n, long long k)\n{\n    if (k == 0 || n == k) return 0;\n    return lgammal(n+1) - lgammal(k+1) - lgammal(n-k+1);\n}\n\n// n11  n12  | n1_\n// n21  n22  | n2_\n//-----------+----\n// n_1  n_2  | n\n\n// hypergeometric distribution\nlong double _hypergeo(long long n11, long long n1_, long long n_1, long long n)\n{\n    //***DEBUG***\n    return expl(_lbinom(n1_, n11) + _lbinom(n-n1_, n_1-n11) - _lbinom(n, n_1));\n}\n\n\n// incremental version of hypergenometric distribution\nlong double _hypergeo_acc(long long n11, long long n1_, long long n_1, long long n, _hgacc_t *aux)\n{\n    if (n1_ || n_1 || n) {\n        aux->n11 = n11; aux->n1_ = n1_; aux->n_1 = n_1; aux->n = n;\n    } else { // then only n11 changed; the rest fixed\n        if (n11%11 && n11 + aux->n - aux->n1_ - aux->n_1) {\n            if (n11 == aux->n11 + 1) { // incremental\n                aux->p *= (long double)(aux->n1_ - aux->n11) / n11\n                    * (aux->n_1 - aux->n11) / (n11 + aux->n - aux->n1_ - aux->n_1);\n                aux->n11 = n11;\n                return aux->p;\n            }\n            if (n11 == aux->n11 - 1) { // incremental\n                aux->p *= (long double)aux->n11 / (aux->n1_ - n11)\n                    * (aux->n11 + aux->n - aux->n1_ - aux->n_1) / (aux->n_1 - n11);\n                aux->n11 = n11;\n                return aux->p;\n            }\n        }\n        aux->n11 = n11;\n    }\n    aux->p = _hypergeo(aux->n11, aux->n1_, aux->n_1, aux->n);\n\n    return aux->p;\n}\n\nlong double _kt_fisher_exact(long long n11,\n                             long long n12,\n                             long long n21,\n                             long long n22,\n                             long double *_left,\n                             long double *_right,\n                             long double *two)\n{\n    long long i, j, max, min;\n    long double p, q, left, right;\n    _hgacc_t aux;\n    long long n1_, n_1, n;\n\n    n1_ = n11 + n12; n_1 = n11 + n21; n = n11 + n12 + n21 + n22; // calculate n1_, n_1 and n\n\n    max = (n_1 < n1_) ? n_1 : n1_; // max n11, for right tail\n    min = n1_ + n_1 - n;    // not sure why n11-n22 is used instead of min(n_1,n1_)\n    if (min < 0) min = 0; // min n11, for left tail\n    *two = *_left = *_right = 1.;\n\n    if (min == max) return 1.; // no need to do test\n\n\n    q = _hypergeo_acc(n11, n1_, n_1, n, &aux); // the probability of the current table\n    if (q < 1e-200) q = 1e-200;\n\n    // left tail\n    p = _hypergeo_acc(min, 0, 0, 0, &aux);\n    for (left = 0., i = min + 1; p < 0.99999999 * q && i<=max; ++i) // loop until underflow\n        left += p, p = _hypergeo_acc(i, 0, 0, 0, &aux);\n    --i;\n    if (p < 1.00000001 * q) left += p;\n    else --i;\n    // right tail\n    p = _hypergeo_acc(max, 0, 0, 0, &aux);\n    for (right = 0., j = max - 1; p < 0.99999999 * q && j>=0; --j) // loop until underflow\n        right += p, p = _hypergeo_acc(j, 0, 0, 0, &aux);\n    ++j;\n    if (p < 1.00000001 * q) right += p;\n    else ++j;\n    // two-tail\n    *two = left + right;\n    if (*two > 1.) *two = 1.;\n    // adjust left and right\n    if (labs((long) (i - n11)) < labs((long) (j - n11)) && q != 0.0) right = 1. - left + q;\n    else left = 1.0 - right + q;\n    *_left = left; *_right = right;\n    return q;\n}\n"
  },
  {
    "path": "src/kfunc.h",
    "content": "/*\n * kfunc.h\n *\n *  Created on: May 1, 2015\n *      Author: nek3d\n */\n\n#ifndef KFUNC_H_\n#define KFUNC_H_\n\n#include <math.h>\n#include <stdlib.h>\n\n\nlong double _lbinom(long long n, long long k);\nlong double _hypergeo(long long n11, long long n1_, long long n_1, long long n);\n\ntypedef struct {\n    long long n11, n1_, n_1, n;\n    long double p;\n} _hgacc_t;\n\n// incremental version of hypergenometric distribution\nlong double _hypergeo_acc(long long n11, long long n1_, long long n_1, long long n, _hgacc_t *aux);\nlong double _kt_fisher_exact(long long n11, long long n12, long long n21, long long n22, long double *_left, long double *_right, long double *two);\n\n\n#endif /* KFUNC_H_ */\n"
  },
  {
    "path": "src/leaf.c",
    "content": "#include <stdint.h>\n#include <stdlib.h>\n#include <string.h>\n#include <err.h>\n#include <inttypes.h>\n#include \"leaf.h\"\n\nuint64_t LEAF_POINTERS_SIZE = sizeof(uint32_t);\nuint64_t LEAF_NUMS_SIZE = sizeof(uint64_t);\nuint64_t LEAF_LEADING_STARTS_ENDS_SIZE = sizeof(uint64_t);\n\n//{{{uint64_t leaf_data_serialize(void *deserialized, void **serialized)\nuint64_t leaf_data_serialize(void *deserialized, void **serialized)\n{\n#if 0\n    struct leaf_data *de = (struct leaf_data *)deserialized;\n\n    uint32_t *data = (uint32_t *)malloc(\n            3*sizeof(uint32_t) +\n            ((de->num_leading + de->num_starts + de->num_ends)\n             * sizeof(uint32_t))*2);\n    \n    data[0] = de->num_leading;\n    data[1] = de->num_starts;\n    data[2] = de->num_ends;\n\n    uint8_t *output = (uint8_t *)(data + 3);\n    int cs = fastlz_compress(de->data,\n                             (de->num_leading + \n                             de->num_starts + \n                             de->num_ends) * sizeof(uint32_t),\n                             output);\n    //realloc(data, 3*sizeof(uint32_t) + cs*sizeof(int));\n    *serialized = (void *)data;\n    return 3*sizeof(uint32_t) + cs*sizeof(int);\n\n#endif\n#if 1\n\n    struct leaf_data *de = (struct leaf_data *)deserialized;\n\n#ifdef DEBUG_LEAF_DATA\n//{{{\n    fprintf(stderr,\n            \"leaf_data_serialize\\t\"\n            \"de->num_leading:%\" PRId64 \"\\t\"\n            \"de->num_starts:%\" PRId64 \"\\t\"\n            \"de->num_ends:%\" PRId64 \"\\n\",\n            de->num_leading,\n            de->num_starts,\n            de->num_ends);\n\n    uint32_t i;\n    fprintf(stderr,\n            \"leaf_data_serialize\\t\"\n            \"starts: \");\n    for (i = 0; i < de->num_starts; ++i)\n        fprintf(stderr, \"%\" PRId64 \" \", de->starts[i]);\n    fprintf(stderr, \"\\n\");\n\n    fprintf(stderr,\n            \"leaf_data_serialize\\t\"\n            \"ends: \");\n    for (i = 0; i < de->num_ends; ++i)\n        fprintf(stderr, \"%\" PRId64 \" \", de->ends[i]);\n    fprintf(stderr, \"\\n\");\n\n    fprintf(stderr,\n            \"leaf_data_serialize\\t\"\n            \"starts_pointers: \");\n    for (i = 0; i < ORDER; ++i)\n        fprintf(stderr, \"%u \", de->starts_pointers[i]);\n    fprintf(stderr, \"\\n\");\n\n    fprintf(stderr,\n            \"leaf_data_serialize\\t\"\n            \"ends_pointers: \");\n    for (i = 0; i < ORDER; ++i)\n        fprintf(stderr, \"%u \", de->ends_pointers[i]);\n    fprintf(stderr, \"\\n\");\n//}}}\n#endif\n\n    uint64_t data_size = \n            (2 * ORDER * LEAF_POINTERS_SIZE) // starts_pointers, ends_pointers\n            + (3 *  LEAF_NUMS_SIZE) // num_leading,num_starts,num_ends\n            + ((de->num_leading + de->num_starts + de->num_ends) \n                * LEAF_LEADING_STARTS_ENDS_SIZE); // leading,starts,ends\n\n#ifdef DEBUG_LEAF_DATA\n//{{{\n    fprintf(stderr,\n            \"leaf_data_serialize\\t\"\n            \"data_size:%\" PRId64 \"\\n\",\n            data_size);\n//}}}\n#endif\n \n    uint8_t *data = (uint8_t *) malloc(data_size);\n\n    if (data == NULL)\n        err(1, \"calloc error in leaf_data_serialize.\\n\");\n\n    memset(data, 0, data_size);\n\n    // copy starts pointers\n    memcpy(data,\n           de->starts_pointers,\n           ORDER * LEAF_POINTERS_SIZE);\n\n    // copy ends pointers\n    memcpy(data + (ORDER * LEAF_POINTERS_SIZE),\n           de->ends_pointers,\n           ORDER * LEAF_POINTERS_SIZE);\n\n    // copy number of leading values\n    memcpy(data + (2 * ORDER * LEAF_POINTERS_SIZE) + (0 * LEAF_NUMS_SIZE),\n           &(de->num_leading),\n           LEAF_NUMS_SIZE);\n\n    // copy number of starts values\n    memcpy(data + (2 * ORDER * LEAF_POINTERS_SIZE) + (1 * LEAF_NUMS_SIZE),\n           &(de->num_starts),\n           LEAF_NUMS_SIZE);\n\n    // copy number of ends values\n    memcpy(data + (2 * ORDER * LEAF_POINTERS_SIZE) + (2 * LEAF_NUMS_SIZE),\n           &(de->num_ends),\n           LEAF_NUMS_SIZE);\n\n    // copy leading, starts, and ends\n    memcpy(data + (2 * ORDER * LEAF_POINTERS_SIZE) + (3 * LEAF_NUMS_SIZE),\n           de->data,\n           (de->num_leading + de->num_starts + de->num_ends) \n                * LEAF_LEADING_STARTS_ENDS_SIZE);\n    \n#ifdef DEBUG_LEAF_DATA\n//{{{\n    fprintf(stderr,\n            \"leaf_data_serialize\\t\"\n            \"serialized start pointers:\");\n    for (i = 0; i < ORDER; ++i) {\n        uint32_t v = ((uint32_t *)data)[i];\n        fprintf(stderr,\" %u\", v);\n    }\n    fprintf(stderr,\"\\n\");\n\n    fprintf(stderr,\n            \"leaf_data_serialize\\t\"\n            \"serialized end pointers:\");\n    for (i = 0; i < ORDER; ++i) {\n        uint32_t v = ((uint32_t *)(data + ORDER * LEAF_POINTERS_SIZE))[i];\n        fprintf(stderr,\" %u\", v);\n    }\n    fprintf(stderr,\"\\n\");\n\n    uint64_t v;\n    memcpy(&v,\n           data + (2 * ORDER * LEAF_POINTERS_SIZE) + (0 * LEAF_NUMS_SIZE),\n           LEAF_NUMS_SIZE);\n\n    fprintf(stderr,\n            \"leaf_data_serialize\\t\"\n            \"serialized num_leading:%\" PRId64 \"\\n\",\n            v);\n\n    memcpy(&v,\n           data + (2 * ORDER * LEAF_POINTERS_SIZE) + (1 * LEAF_NUMS_SIZE),\n           LEAF_NUMS_SIZE);\n\n    fprintf(stderr,\n            \"leaf_data_serialize\\t\"\n            \"serialized num_starts:%\" PRId64 \"\\n\",\n            v);\n\n    memcpy(&v,\n           data + (2 * ORDER * LEAF_POINTERS_SIZE) + (2 * LEAF_NUMS_SIZE),\n           LEAF_NUMS_SIZE);\n\n    fprintf(stderr,\n            \"leaf_data_serialize\\t\"\n            \"serialized num_ends:%\" PRId64 \"\\n\",\n            v);\n//}}}\n#endif\n    \n    *serialized = (void *)data;\n    return data_size;\n#endif\n}\n//}}}\n\n//{{{ uint64_t leaf_data_deserialize(void *serialized,\nuint64_t leaf_data_deserialize(void *serialized,\n                               uint64_t serialized_size,\n                               void **deserialized)\n{\n    uint8_t *data = (uint8_t *)serialized;\n    \n    struct leaf_data *lf = (struct leaf_data *) \n            calloc(1, sizeof(struct leaf_data));\n    if (lf == NULL)\n        err(1, \"calloc error in leaf_data_deserialize.\\n\");\n\n    // copy number of leading values\n    memcpy(&(lf->num_leading),\n           data + (2 * ORDER * LEAF_POINTERS_SIZE) + (0 * LEAF_NUMS_SIZE),\n           LEAF_NUMS_SIZE);\n\n    // copy number of starts values\n    memcpy(&(lf->num_starts),\n           data + (2 * ORDER * LEAF_POINTERS_SIZE) + (1 * LEAF_NUMS_SIZE),\n           LEAF_NUMS_SIZE);\n\n    // copy number of ends values\n    memcpy(&(lf->num_ends),\n           data + (2 * ORDER * LEAF_POINTERS_SIZE) + (2 * LEAF_NUMS_SIZE),\n           LEAF_NUMS_SIZE);\n\n    // copy start pointers\n    lf->starts_pointers = (uint32_t *)calloc(ORDER, LEAF_POINTERS_SIZE);\n    if (lf->starts_pointers == NULL)\n        err(1, \"calloc error in leaf_data_deserialize.\\n\");\n\n    memcpy(lf->starts_pointers,\n           data,\n           ORDER * LEAF_POINTERS_SIZE);\n   \n    // copy end pointers\n    lf->ends_pointers = (uint32_t *)calloc(ORDER, LEAF_POINTERS_SIZE);\n    if (lf->ends_pointers == NULL)\n        err(1, \"calloc error in leaf_data_deserialize.\\n\");\n\n    memcpy(lf->ends_pointers,\n           data + (ORDER * LEAF_POINTERS_SIZE),\n           ORDER * LEAF_POINTERS_SIZE);\n\n    // copy data / leading, starts, and ends\n    lf->data = (uint64_t *)calloc(lf->num_leading \n                                    + lf->num_starts \n                                    + lf->num_ends,\n                                  LEAF_LEADING_STARTS_ENDS_SIZE);\n    if (lf->data == NULL)\n        err(1, \"calloc error in leaf_data_deserialize.\\n\");\n\n    lf->leading = lf->data;\n    lf->starts = lf->data + lf->num_leading;\n    lf->ends = lf->data + lf->num_leading + lf->num_starts;\n\n    memcpy(lf->data,\n           data + (2 * ORDER * LEAF_POINTERS_SIZE) + (3 * LEAF_NUMS_SIZE),\n           (lf->num_leading + lf->num_starts + lf->num_ends)\n                * LEAF_LEADING_STARTS_ENDS_SIZE);\n\n    *deserialized = (void *)lf;\n\n    return sizeof(struct leaf_data);\n}\n//}}}\n\n//{{{void leaf_data_free_mem(void **deserialized)\nvoid leaf_data_free_mem(void **deserialized)\n{\n    struct leaf_data **de = (struct leaf_data **)deserialized;\n    free((*de)->starts_pointers);\n    free((*de)->ends_pointers);\n    free((*de)->data);\n    free(*de);\n    *de = NULL;\n}\n//}}}\n\n//{{{uint32_t leaf_data_starts_start(struct leaf_data *ld,\nuint32_t leaf_data_starts_start(struct leaf_data *ld,\n                                struct bpt_node *ln,\n                                int i)\n{\n    if (i == 0) {\n        return 0;\n    } else if (i >= BPT_NUM_KEYS(ln)) {\n        return ld->starts_pointers[BPT_NUM_KEYS(ln) - 1];\n    } else {\n        return ld->starts_pointers[i - 1];\n    }\n}\n//}}}\n\n//{{{uint32_t leaf_data_starts_end(struct leaf_data *ld,\nuint32_t leaf_data_starts_end(struct leaf_data *ld,\n                              struct bpt_node *ln,\n                              int i)\n{\n    if (i == -1) {\n        return 0;\n    } else if (i == BPT_NUM_KEYS(ln)) {\n        return ld->starts_pointers[i - 1];\n    } else {\n        return ld->starts_pointers[i];\n    }\n}\n//}}}\n\n//{{{uint32_t leaf_data_ends_start(struct leaf_data *ld,\nuint32_t leaf_data_ends_start(struct leaf_data *ld,\n                              struct bpt_node *ln,\n                              int i)\n{\n    if (i == 0) {\n        return 0;\n    } else if (i >= BPT_NUM_KEYS(ln)) {\n        return ld->ends_pointers[BPT_NUM_KEYS(ln) - 1];\n    } else {\n        return ld->ends_pointers[i - 1];\n    }\n}\n//}}}\n\n//{{{uint32_t leaf_data_ends_end(struct leaf_data *ld,\nuint32_t leaf_data_ends_end(struct leaf_data *ld,\n                            struct bpt_node *ln,\n                            int i)\n{\n    if (i == -1) {\n        return 0;\n    } else if (i == BPT_NUM_KEYS(ln)) {\n        return ld->ends_pointers[i - 1];\n    } else {\n        return ld->ends_pointers[i];\n    }\n}\n//}}}\n\nvoid leaf_data_print(struct leaf_data *ld)\n{\n    printf(\"num_leading:%\" PRId64 \"\\t\"\n           \"num_starts:%\" PRId64 \"\\t\"\n           \"num_ends:%\" PRId64 \"\\n\",\n            ld->num_leading,\n            ld->num_starts,\n            ld->num_ends);\n\n    uint32_t i;\n\n    printf(\"leading: \");\n    for (i = 0; i < ld->num_leading; ++i)\n        printf(\"%\" PRId64 \" \", ld->leading[i]);\n    printf(\"\\n\");\n\n\n    printf(\"starts: \");\n    for (i = 0; i < ld->num_starts; ++i)\n        printf(\"%\" PRId64 \" \", ld->starts[i]);\n    printf(\"\\n\");\n\n    printf(\"ends: \");\n    for (i = 0; i < ld->num_ends; ++i)\n        printf(\"%\" PRId64 \" \", ld->ends[i]);\n    printf(\"\\n\");\n\n    printf(\"starts_pointers: \");\n    for (i = 0; i < ORDER; ++i)\n        printf(\"%u \", ld->starts_pointers[i]);\n    printf(\"\\n\");\n\n    printf(\"ends_pointers: \");\n    for (i = 0; i < ORDER; ++i)\n        printf(\"%u \", ld->ends_pointers[i]);\n    printf(\"\\n\");\n}\n"
  },
  {
    "path": "src/leaf.h",
    "content": "#ifndef __LEAF_H__\n#define __LEAF_H__\n\n#include \"bpt.h\"\n\n#define LEAF_DATA_LEADING_START(node) (0)\n#define LEAF_DATA_LEADING_END(node) (node->num_leading)\n\nuint64_t LEAF_POINTERS_SIZE;\nuint64_t LEAF_NUMS_SIZE;\nuint64_t LEAF_LEADING_STARTS_ENDS_SIZE;\n\nstruct leaf_data {\n    uint64_t num_leading, num_starts, num_ends;\n    uint32_t *starts_pointers, *ends_pointers;\n    uint64_t *leading, *starts, *ends, *data;\n};\n\nstruct leaf_data_result {\n    uint64_t len;\n    uint64_t *data;\n    struct leaf_data_result *next;\n};\n\nvoid leaf_data_free_mem(void **deserialized);\nuint64_t leaf_data_deserialize(void *serialized,\n                               uint64_t serialized_size,\n                               void **deserialized);\nuint64_t leaf_data_serialize(void *deserialized, void **serialized);\n\nuint32_t leaf_data_starts_start(struct leaf_data *ld,\n                                struct bpt_node *ln,\n                                int i);\n\nuint32_t leaf_data_starts_end(struct leaf_data *ld,\n                              struct bpt_node *ln,\n                              int i);\n\nuint32_t leaf_data_ends_start(struct leaf_data *ld,\n                              struct bpt_node *ln,\n                              int i);\n\nuint32_t leaf_data_ends_end(struct leaf_data *ld,\n                            struct bpt_node *ln,\n                            int i);\n\nvoid leaf_data_print(struct leaf_data *ld);\n\n#endif\n"
  },
  {
    "path": "src/lists.c",
    "content": "#define _GNU_SOURCE\n\n#include <stdlib.h>\n#include <stdio.h>\n#include <stdint.h>\n#include <err.h>\n#include <sysexits.h>\n#include <string.h>\n#include <inttypes.h>\n\n#include \"lists.h\"\n#include \"util.h\"\n\n//{{{ bit_map\n\nstruct bit_map *bit_map_init(uint64_t bits)\n{\n    struct bit_map *b = (struct bit_map *) malloc(sizeof(struct bit_map));\n    if (b == NULL)\n        err(1, \"calloc error in bit_map_init().\\n\");\n\n    b->num_bits = bits;\n    b->num_ints = (bits + 32 - 1) / 32;\n    b->bm = (uint32_t *) calloc(b->num_ints, sizeof(uint32_t));\n    if (b->bm == NULL)\n        err(1, \"calloc error in bit_map_init().\\n\");\n\n    return b;\n}\n\nstruct bit_map *bit_map_load(FILE *f, char *file_name)\n{\n    struct bit_map *b = (struct bit_map *) malloc(sizeof(struct bit_map));\n    if (b == NULL)\n        err(1, \"calloc error in bit_map_load().\\n\");\n\n    size_t fr = fread(&(b->num_bits), sizeof(uint64_t), 1, f);\n    check_file_read(file_name, f, 1, fr);\n    fr = fread(&(b->num_ints), sizeof(uint32_t), 1, f);\n    check_file_read(file_name, f, 1, fr);\n    b->bm = (uint32_t *) calloc(b->num_ints, sizeof(uint32_t));\n    if (b->bm == NULL)\n        err(1, \"calloc error in bit_map_load().\\n\");\n\n    fr = fread(b->bm, sizeof(uint32_t), b->num_ints, f);\n    check_file_read(file_name, f, b->num_ints, fr);\n\n    return b;\n}\n\nvoid bit_map_store(struct bit_map *b, FILE *f, char *file_name)\n{\n    if (fwrite(&(b->num_bits), sizeof(uint64_t), 1, f) != 1)\n        err(EX_IOERR,\n            \"Error writing number of bits to '%s'.\",\n            file_name);\n\n    if (fwrite(&(b->num_ints), sizeof(uint32_t), 1, f) != 1)\n        err(EX_IOERR,\n            \"Error writing number of ints to '%s'.\",\n            file_name);\n\n    if (fwrite(b->bm, sizeof(uint32_t), b->num_ints, f) != b->num_ints)\n        err(EX_IOERR,\n            \"Error writing number bitmap to '%s'.\",\n            file_name);\n}\n\nvoid bit_map_destroy(struct bit_map **b)\n{\n    free((*b)->bm);\n    free(*b);\n    *b = NULL;\n}\n\nvoid bit_map_set(struct bit_map *b, uint64_t i)\n{\n    while (i >= b->num_bits) {\n        uint64_t new_bits = (b->num_bits)*2;\n        uint32_t new_ints = (new_bits + 32 - 1) / 32;\n        uint32_t *new_bm = (uint32_t *)calloc(new_ints, sizeof(uint32_t));\n        if (new_bm== NULL)\n            err(1, \"calloc error in bit_map_set().\\n\");\n\n        memcpy(new_bm, b->bm, (b->num_ints)*sizeof(uint32_t));\n\n        free(b->bm);\n        b->num_bits = new_bits;\n        b->num_ints = new_ints;\n        b->bm = new_bm;\n    }\n\n\n    b->bm[i/32] |= 1 << (31 - (i%32));\n}\n\nuint32_t bit_map_get(struct bit_map *b, uint64_t q)\n{\n    if (q > b->num_bits)\n        return 0;\n\n    return (( b->bm[q/32]) >> (31 - (q%32)) & 1);\n}\n\n//}}}\n\n//{{{ indexed_list\n//{{{ struct indexed_list *indexed_list_init(uint32_t init_size,\nstruct indexed_list *indexed_list_init(uint64_t init_size,\n                                       uint32_t element_size)\n{\n    struct indexed_list *il = (struct indexed_list *)\n            calloc(1,sizeof(struct indexed_list));\n    if (il == NULL)\n        err(1, \"calloc error in indexed_list_init().\\n\");\n\n    il->size = init_size;\n    il->element_size = element_size;\n    il->data = (char *) calloc(init_size, element_size);\n    if (il->data == NULL)\n        err(1, \"calloc error in indexed_list_init().\\n\");\n\n    il->bm = bit_map_init(init_size);\n    return il;\n}\n//}}}\n\n//{{{void indexed_list_destroy(struct indexed_list **il)\nvoid indexed_list_destroy(struct indexed_list **il)\n{\n    if (*il != NULL) {\n        bit_map_destroy(&((*il)->bm));\n        free((*il)->data);\n        free(*il);\n        *il = NULL;\n    }\n}\n//}}}\n\n//{{{uint32_t indexed_list_add(struct indexed_list *il,\nuint32_t indexed_list_add(struct indexed_list *il,\n                          uint64_t index,\n                          void *data)\n{\n    uint32_t r = 0;\n    while (index >= il->size) {\n        uint32_t old_size = il->size;\n        il->size = il->size * 2;\n        il->data = (char *)realloc(il->data, il->size * il->element_size);\n        if (il->data == NULL)\n            err(1, \"realloc error in indexed_list_add().\\n\");\n\n        memset(il->data + old_size * il->element_size,\n               0,\n               old_size * il->element_size);\n        r = 1;\n    }\n\n    bit_map_set(il->bm, index);\n\n    memcpy(il->data + (index * il->element_size), data, il->element_size);\n\n    return r;\n}\n//}}}\n\n//{{{void *indexed_list_get(struct indexed_list *il, uint32_t index)\nvoid *indexed_list_get(struct indexed_list *il, uint64_t index)\n{\n    //fprintf(stderr, \"%d\\n\", bit_map_get(il->bm, index));\n    if (bit_map_get(il->bm, index) != 0)\n        return il->data + (index * il->element_size);\n    else\n        return NULL;\n}\n//}}}\n\n//{{{void indexed_list_write(struct indexed_list *il, FILE *f, char *file_name)\nvoid indexed_list_write(struct indexed_list *il, FILE *f, char *file_name)\n{\n    if (fwrite(&(il->size), sizeof(uint64_t), 1, f) != 1)\n        err(EX_IOERR,\n            \"Error writing indexed list size to '%s'.\",\n            file_name);\n\n    if (fwrite(&(il->element_size), sizeof(uint32_t), 1, f) != 1)\n        err(EX_IOERR,\n            \"Error writing indexed list element size to '%s'.\",\n            file_name);\n\n    if (fwrite(il->data, il->element_size, il->size, f) != il->size)\n        err(EX_IOERR,\n            \"Error writing indexed list data to '%s'.\",\n            file_name);\n\n    bit_map_store(il->bm, f, file_name);\n}\n//}}}\n\n//{{{struct indexed_list *indexed_list_load(FILE *f, char *file_name)\nstruct indexed_list *indexed_list_load(FILE *f, char *file_name)\n{\n    struct indexed_list *il = (struct indexed_list *)\n            malloc(sizeof(struct indexed_list));\n    if (il == NULL)\n        err(1, \"malloc error in indexed_list_load().\\n\");\n\n    size_t fr = fread(&(il->size), sizeof(uint64_t), 1, f);\n    check_file_read(file_name, f, 1, fr);\n\n    fr = fread(&(il->element_size), sizeof(uint32_t), 1, f);\n    check_file_read(file_name, f, 1, fr);\n\n    il->data = (char *) calloc(il->size, il->element_size);\n    if (il->data == NULL)\n        err(1, \"calloc error in indexed_list_load().\\n\");\n    fr = fread(il->data, il->element_size, il->size, f);\n    check_file_read(file_name, f, il->size, fr);\n\n    il->bm = bit_map_load(f, file_name);\n\n    return il;\n}\n//}}}\n//}}}\n\n//{{{ hash_list\n\n//{{{ struct indexed_list *indexed_list_init(uint32_t init_size,\nKHASH_MAP_INIT_INT(hashl, uint8_t *)\n\nstruct hash_list *hash_list_init()\n{\n    struct hash_list *hashl = (struct hash_list *)\n                             calloc(1,sizeof(struct hash_list));\n    if (hashl == NULL)\n        err(1, \"calloc error in hash_list_init().\\n\");\n\n    hashl->hash = (void *)kh_init(hashl);\n    return hashl;\n}\n//}}}\n\n//{{{uint32_t hash_list_add(struct hash_list *il,\nuint32_t hash_list_add(struct hash_list *hashl,\n                       uint32_t index,\n                       void *data,\n                       uint32_t data_size)\n{\n    /*\n    struct lru_ll_element *e = (struct lru_ll_element *)\n            malloc(sizeof(struct lru_ll_element));\n    if (e == NULL)\n        errx(1, \"Malloc error in lru_list_add\");\n\n    e->prev = NULL;\n    e->next = NULL;\n\n    e->data = (uint8_t *) malloc(data_size);\n    if (e->data == NULL)\n        errx(1, \"Malloc error in lru_list_add\");\n\n    memcpy(e->data, data, data_size);\n\n    if (lrul->head == NULL) {\n        lrul->head = e;\n        lrul->tail = e;\n    } else {\n        lrul->tail->next = e;\n        e->prev = lrul->tail;\n        lrul->tail = e;\n    }\n    */\n\n    uint8_t *_data = (uint8_t *)malloc(data_size);\n    if (_data == NULL)\n        errx(1, \"Malloc error in hash_list_add\");\n    memcpy(_data, data, data_size);\n\n    khash_t(hashl) *hash = (khash_t(hashl)*)(hashl->hash);\n\n    int ret;\n    khiter_t k;\n    k = kh_put(hashl, hash, index, &ret);\n\n    if (ret == 0)\n        errx(1, \"Index %u already in hash_list_add.\", index);\n    else if (ret == -1)\n        errx(1, \"Error adding %u to hash_list_add.\", index);\n\n    kh_value(hash, k) = _data;\n\n    return 0;\n}\n//}}}\n\n//{{{void *hash_list_get(struct hash_list *hashl,\nvoid *hash_list_get(struct hash_list *hashl,\n                    uint32_t index)\n{\n    khash_t(hashl) *hash = (khash_t(hashl)*)(hashl->hash);\n\n    khiter_t k;\n    k = kh_get(hashl, hash, index);\n\n    if (k == kh_end(hash))\n        return NULL;\n\n    return (void *)kh_value(hash, k);\n}\n//}}}\n\n//{{{void *hash_list_remove(struct hash_list *hashl,\nvoid *hash_list_remove(struct hash_list *hashl,\n                       uint32_t index)\n{\n    khash_t(hashl) *hash = (khash_t(hashl)*)(hashl->hash);\n\n    khiter_t k;\n    k = kh_get(hashl, hash, index);\n\n    if (k == kh_end(hash))\n        return NULL;\n\n    void *v = (void *)kh_value(hash, k);\n    kh_del(hashl, hash, k);\n\n    return v;\n}\n//}}}\n\n\n//{{{ void hash_list_destroy(struct hash_list **hashl)\nvoid hash_list_destroy(struct hash_list **hashl)\n{\n    khash_t(hashl) *hash = (khash_t(hashl)*)((*hashl)->hash);\n\n    uint64_t key;\n    uint8_t *value;\n\n    if (*hashl != NULL) {\n        kh_foreach(hash, key, value, {\n            if (value != NULL) {\n                free(value);\n                value = NULL;\n            }\n        });\n\n        kh_destroy(hashl, hash);\n        free(*hashl);\n        *hashl = NULL;\n    }\n}\n//}}}\n\n//{{{void hash_list_value_cache_handler_pair_destroy(struct hash_list **hashl)\nvoid hash_list_value_cache_handler_pair_destroy(struct hash_list **hashl)\n{\n    khash_t(hashl) *hash = (khash_t(hashl)*)((*hashl)->hash);\n\n    uint64_t key;\n    uint8_t *value;\n\n    if (*hashl != NULL) {\n        kh_foreach(hash, key, value, {\n            struct value_cache_handler_pair *vh = \n                (struct value_cache_handler_pair *)value;\n\n            if (vh != NULL) {\n                if ((vh->handler != NULL) && \n                    (vh->handler->free_mem != NULL))\n                    vh->handler->free_mem(&(vh->value));\n                free(vh);\n                vh = NULL;\n            }\n        });\n\n        kh_destroy(hashl, hash);\n        free(*hashl);\n        *hashl = NULL;\n    }\n}\n//}}}\n\n//}}} \n\n//{{{unordered_list\n//{{{struct unordered_list *unordered_list_init(uint32_t init_size)\nstruct unordered_list *unordered_list_init(uint32_t init_size)\n{\n    struct unordered_list *us = (struct unordered_list *)\n            malloc(sizeof(struct unordered_list));\n    if (us == NULL)\n        err(1, \"malloc error in indexed_list_init().\\n\");\n\n    us->num = 0;\n    us->size = init_size;\n\n    us->data = (void **) malloc(init_size * sizeof(void *));\n    if (us->data == NULL)\n        err(1, \"malloc error in indexed_list_init().\\n\");\n\n    return us;\n}\n//}}}\n\n//{{{void unordered_list_destroy(struct unordered_list **ul)\nvoid unordered_list_destroy(struct unordered_list **ul,\n                            void (*free_data)(void **data))\n{\n    if (free_data != NULL) {\n        uint32_t i;\n        for (i = 0; i < (*ul)->num; ++i) {\n            free_data(&((*ul)->data[i]));\n        }\n    }\n\n    free((*ul)->data);\n    (*ul)->data = NULL;\n\n    free(*ul);\n    *ul = NULL;\n}\n//}}}\n\n//{{{uint32_t unordered_list_add(struct unordered_list *ul,\nuint32_t unordered_list_add(struct unordered_list *ul,\n                            void *data)\n{\n    uint32_t id = ul->num;\n\n    ul->num = ul->num + 1;\n\n    // check to see if there is enough space, if not grow by double\n    if ( ul->size == ul->num ) {\n        ul->size = ul->size * 2;\n        ul->data = (void *)realloc(ul->data, \n                                   ul->size * sizeof(void *));\n        if (ul->data == NULL)\n            err(1, \"realloc error in indexed_list_add().\\n\");\n    }\n\n    ul->data[id] = data;\n    \n    return id;\n}\n//}}}\n\n//{{{void *unordered_list_get(struct unordered_list *ul, uint32_t i)\nvoid *unordered_list_get(struct unordered_list *ul, uint32_t i)\n{\n    if (i >= ul->num)\n        return NULL;\n\n    return ul->data[i];\n}\n//}}}\n\nvoid unordered_list_store(struct unordered_list *ul, \n                          FILE *f,\n                          char *file_name,\n                          void (*ul_store)(void *v, FILE *f, char *file_name))\n{\n    if (fwrite(&(ul->num), sizeof(uint32_t), 1, f) != 1)\n        err(EX_IOERR,\n            \"Error writing unordered_list num '%s'.\", file_name);\n\n    if (fwrite(&(ul->size), sizeof(uint32_t), 1, f) != 1)\n        err(EX_IOERR,\n            \"Error writing unordered_list num '%s'.\", file_name);\n    uint32_t i;\n    for (i = 0; i < ul->num; ++i) {\n        ul_store(ul->data[i], f, file_name);\n    }\n}\n\nstruct unordered_list *unordered_list_load(\n                FILE *f,\n                char *file_name,\n                void *(*ul_load)(FILE *f, char *file_name))\n{\n\n    struct unordered_list *ul = (struct unordered_list *)\n                                malloc(sizeof(struct unordered_list));\n    if (ul == NULL)\n        err(1, \"realloc error in indexed_list_load().\\n\");\n\n    size_t fr = fread(&(ul->num), sizeof(uint32_t), 1, f);\n    check_file_read(file_name, f, 1, fr);\n\n    fr = fread(&(ul->size), sizeof(uint32_t), 1, f);\n    check_file_read(file_name, f, 1, fr);\n\n    ul->data = (void **) calloc(ul->size, sizeof(void *));\n    if (ul->data == NULL)\n        err(1, \"calloc error in indexed_list_load().\\n\");\n\n    uint32_t i;\n    for (i = 0; i < ul->num; ++i) {\n        ul->data[i] = ul_load(f, file_name);\n    }\n\n    return ul;\n}\n//}}}\n\n//{{{ordered_set\n//{{{ struct ordered_set *ordered_set_init(uint32_t init_size,\nstruct ordered_set \n        *ordered_set_init(\n                uint32_t init_size,\n                int (*sort_element_cmp)(const void *a, const void *b),\n                int (*search_element_cmp)(const void *a, const void *b),\n                int (*search_key_cmp)(const void *a, const void *b))\n{\n    struct ordered_set *os = (struct ordered_set *)\n                                malloc(sizeof(struct ordered_set));\n    if (os == NULL)\n        err(1, \"calloc error in ordered_set_init().\\n\");\n\n    os->num = 0;\n    os->size = init_size;\n    os->data = (void **) calloc(init_size, sizeof(void *));\n    if (os->data == NULL)\n        err(1, \"calloc error in ordered_set_init().\\n\");\n\n    os->sort_element_cmp = sort_element_cmp;\n    os->search_element_cmp = search_element_cmp;\n    os->search_key_cmp = search_key_cmp;\n\n    return os;\n}\n//}}}\n\n//{{{ void ordered_set_destroy(struct ordered_set **os,\nvoid ordered_set_destroy(struct ordered_set **os,\n                         void (*free_data)(void **data))\n{\n    if (free_data != NULL) {\n        uint32_t i;\n        for (i = 0; i < (*os)->num; ++i) {\n            free_data(&((*os)->data[i]));\n        }\n    }\n\n    free((*os)->data);\n    free(*os);\n    *os = NULL;\n}\n//}}}\n\n//{{{void *ordered_set_add(struct ordered_set *os,\nvoid *ordered_set_add(struct ordered_set *os,\n                      void *data)\n{\n    void **p  = NULL;\n\n    if (os->num != 0)\n        p = bsearch(data,\n                    os->data,\n                    os->num,\n                    sizeof(void *),\n                    os->search_element_cmp);\n\n    if (p != NULL) {\n        return *p;\n    } else {\n        // make space if needed\n        if (os->num == os->size - 1) {\n            os->size = os->size * 2;\n            os->data = realloc(os->data, os->size * sizeof(void *));\n            if (os->data == NULL)\n                err(1, \"realloc error in ordered_set_add().\\n\");\n        }\n        int i;\n        // insert we move elements to the right until we find a spot for\n        // the incoming interval.\n        for(i=os->num;i>0;i--){\n           void *p = os->data[i-1];\n           if (((*(os->sort_element_cmp))(&data, &p)) >= 0) {\n               break;\n           }\n           os->data[i] = p;\n        }\n        os->data[i] = data;\n        os->num++;\n       return data;\n    }\n}\n//}}}\n\n//{{{ void *ordered_set_get(struct unordered_list *os, void *key);\nvoid *ordered_set_get(struct ordered_set *os, void *key)\n{\n\n    if (os->num != 0) {\n        void **p = bsearch(key,\n                           os->data,\n                           os->num,\n                           sizeof(void *),\n                           os->search_key_cmp); \n        if (p == NULL)\n            return p;\n        else\n            return *p;\n    } else {\n        return NULL;\n    }\n}\n//}}}\n\n//{{{void ordered_set_store(struct ordered_set *os, \nvoid ordered_set_store(struct ordered_set *os, \n                       FILE *f,\n                       char *file_name,\n                       void (*os_store)(void *v, FILE *f, char *file_name))\n{\n    if (fwrite(&(os->num), sizeof(uint32_t), 1, f) != 1)\n        err(EX_IOERR,\n            \"Error writing ordered_set num '%s'.\", file_name);\n\n    if (fwrite(&(os->size), sizeof(uint32_t), 1, f) != 1)\n        err(EX_IOERR,\n            \"Error writing ordered_set num '%s'.\", file_name);\n    uint32_t i;\n    for (i = 0; i < os->num; ++i) {\n        os_store(os->data[i], f, file_name);\n    }\n}\n//}}}\n\n//{{{struct ordered_set *ordered_set_load(\nstruct ordered_set \n        *ordered_set_load(\n                FILE *f,\n                char *file_name,\n                void *(*os_load)(FILE *f, char *file_name),\n                int (*sort_element_cmp)(const void *a, const void *b),\n                int (*search_element_cmp)(const void *a, const void *b),\n                int (*search_key_cmp)(const void *a, const void *b))\n{\n\n    struct ordered_set *os = (struct ordered_set *)\n                                malloc(sizeof(struct ordered_set));\n    if (os == NULL)\n        err(1, \"realloc error in ordered_set_load().\\n\");\n\n    size_t fr = fread(&(os->num), sizeof(uint32_t), 1, f);\n    check_file_read(file_name, f, 1, fr);\n\n    fr = fread(&(os->size), sizeof(uint32_t), 1, f);\n    check_file_read(file_name, f, 1, fr);\n\n    os->data = (void **) calloc(os->size, sizeof(void *));\n    if (os->data == NULL)\n        err(1, \"calloc error in ordered_set_load().\\n\");\n\n    uint32_t i;\n    for (i = 0; i < os->num; ++i) {\n        os->data[i] = os_load(f, file_name);\n    }\n\n    os->sort_element_cmp = sort_element_cmp;\n    os->search_element_cmp = search_element_cmp;\n    os->search_key_cmp = search_key_cmp;\n    return os;\n}\n//}}}\n//}}}\n\n//{{{ str_uint_pair\n//{{{ int str_uint_pair_sort_element_cmp(const void *a, const void *b)\nint str_uint_pair_sort_element_cmp(const void *a, const void *b)\n{\n    struct str_uint_pair **pa = (struct str_uint_pair **)a;\n    struct str_uint_pair **pb = (struct str_uint_pair **)b;\n    return strcmp((*pa)->str, (*pb)->str);\n}\n//}}}\n\n//{{{int str_uint_pair_search_element_cmp(const void *a, const void *b)\nint str_uint_pair_search_element_cmp(const void *a, const void *b)\n{\n    struct str_uint_pair *key = (struct str_uint_pair *)a;\n    struct str_uint_pair **arg = (struct str_uint_pair **)b;\n    return strcmp(key->str, (*arg)->str);\n}\n//}}}\n\n//{{{int str_uint_pair_search_key_cmp(const void *a, const void *b)\nint str_uint_pair_search_key_cmp(const void *a, const void *b)\n{\n    char *key = (char *)a;\n    struct str_uint_pair **arg = (struct str_uint_pair **)b;\n    return strcmp(key, (*arg)->str);\n}\n//}}}\n\n//{{{void str_uint_pair_store(void *v, FILE *f, char *file_name)\nvoid str_uint_pair_store(void *v, FILE *f, char *file_name)\n{\n    struct str_uint_pair *p = (struct str_uint_pair *)v;\n\n    if (fwrite(&(p->uint), sizeof(uint32_t), 1, f) != 1)\n        err(EX_IOERR,\n            \"Error writing uint of str_uint_pair in '%s'.\", file_name);\n\n    uint32_t str_len = strlen(p->str);\n\n    if (fwrite(&str_len, sizeof(uint32_t), 1, f) != 1)\n        err(EX_IOERR,\n            \"Error writing str len of str_uint_pair in '%s'.\", file_name);\n\n    if (fwrite(p->str, sizeof(char), strlen(p->str), f) != strlen(p->str))\n        err(EX_IOERR,\n            \"Error writing str of str_uint_pair in '%s'.\", file_name);\n}\n//}}}\n\n//{{{void *str_uint_pair_load(FILE *f, char *file_name)\nvoid *str_uint_pair_load(FILE *f, char *file_name)\n{\n    struct str_uint_pair *p = (struct str_uint_pair *)\n            calloc(1,sizeof(struct str_uint_pair));\n    if (p == NULL)\n        err(1, \"calloc error in str_uint_pair_load().\\n\");\n\n    size_t fr = fread(&(p->uint), sizeof(uint32_t), 1, f);\n    check_file_read(file_name, f, 1, fr);\n\n    uint32_t str_len;\n\n    fr = fread(&str_len, sizeof(uint32_t), 1, f);\n    check_file_read(file_name, f, 1, fr);\n\n    p->str = (char *)calloc(str_len + 1, sizeof(char));\n    if (p->str == NULL)\n        err(1, \"calloc error in str_uint_pair_load().\\n\");\n\n    fr = fread(p->str, sizeof(char), str_len, f);\n    check_file_read(file_name, f, str_len, fr);\n\n    return (void *)p;\n}\n//}}}\n\n//{{{void str_uint_pair_free(void **p)\nvoid str_uint_pair_free(void **_p)\n{\n    struct str_uint_pair **p = (struct str_uint_pair **)_p;\n    if (*p != NULL) {\n        free((*p)->str);\n        free(*p);\n        *p = NULL;\n    }\n}\n//}}}\n\n//}}}\n\n//{{{ pointer_uint_pair\n//{{{ int pointer_uint_pair_sort_element_cmp(const void *a, const void *b)\nint pointer_uint_pair_sort_element_cmp(const void *a, const void *b)\n{\n    /*\n    fprintf(stderr,\n            \"pointer_uint_pair_sort_element_cmp:%p %p\\n\",\n            (*pa)->pointer,\n            (*pb)->pointer,\n            */\n\n\n    struct pointer_uint_pair **pa = (struct pointer_uint_pair **)a;\n    struct pointer_uint_pair **pb = (struct pointer_uint_pair **)b;\n    if ((*pa)->pointer < (*pb)->pointer)\n        return -1;\n    else if ((*pa)->pointer > (*pb)->pointer)\n        return 1;\n    else\n        return 0;\n}\n//}}}\n\n//{{{int pointer_uint_pair_search_element_cmp(const void *a, const void *b)\nint pointer_uint_pair_search_element_cmp(const void *a, const void *b)\n{\n    struct pointer_uint_pair *key = (struct pointer_uint_pair *)a;\n    struct pointer_uint_pair **arg = (struct pointer_uint_pair **)b;\n\n    if (key->pointer < (*arg)->pointer)\n        return -1;\n    else if (key->pointer > (*arg)->pointer)\n        return 1;\n    else\n        return 0;\n}\n//}}}\n\n//{{{int pointer_uint_pair_search_key_cmp(const void *a, const void *b)\nint pointer_uint_pair_search_key_cmp(const void *a, const void *b)\n{\n    struct pointer_uint_pair **arg = (struct pointer_uint_pair **)b;\n\n    if (a < (*arg)->pointer)\n        return -1;\n    else if (a > (*arg)->pointer)\n        return 1;\n    else\n        return 0;\n\n}\n//}}}\n//}}}\n\n//{{{ uint_offset_size_pair\n//{{{ int uint_offset_size_pair_sort_element_cmp(const void *a, const void *b)\nint uint_offset_size_pair_sort_element_cmp(const void *a, const void *b)\n{\n    struct uint_offset_size_pair **pa = (struct uint_offset_size_pair **)a;\n    struct uint_offset_size_pair **pb = (struct uint_offset_size_pair **)b;\n\n    return (*pa)->uint - (*pb)->uint;\n}\n//}}}\n\n//{{{int uint_offset_size_pair_search_element_cmp(const void *a, const void *b)\nint uint_offset_size_pair_search_element_cmp(const void *a, const void *b)\n{\n    struct uint_offset_size_pair *key = (struct uint_offset_size_pair *)a;\n    struct uint_offset_size_pair **arg = (struct uint_offset_size_pair **)b;\n\n    return key->uint - (*arg)->uint;\n}\n//}}}\n\n//{{{int uint_offset_size_pair_search_key_cmp(const void *a, const void *b)\nint uint_offset_size_pair_search_key_cmp(const void *a, const void *b)\n{\n    uint32_t *key = (uint32_t *)a;\n    struct uint_offset_size_pair **arg = (struct uint_offset_size_pair **)b;\n\n    return *key - (*arg)->uint;\n}\n//}}}\n//}}}\n\n//{{{ uint_pair\n//{{{ int uint_pair_sort_by_first_element_cmp(const void *a, const void *b)\nint uint_pair_sort_by_first_element_cmp(const void *a, const void *b)\n{\n    struct uint_pair **pa = (struct uint_pair **)a;\n    struct uint_pair **pb = (struct uint_pair **)b;\n\n    if ((*pa)->first < (*pb)->first) {\n        return -1;\n    } else if ((*pa)->first > (*pb)->first) {\n        return 1;\n    } else {\n        return 0;\n    }\n}\n//}}}\n\n//{{{int uint_pair_search_by_first_element_cmp(const void *a, const void *b)\nint uint_pair_search_by_first_element_cmp(const void *a, const void *b)\n{\n    struct uint_pair *key = (struct uint_pair *)a;\n    struct uint_pair **arg = (struct uint_pair **)b;\n\n    if (key->first < (*arg)->first) {\n        return -1;\n    } else if (key->first > (*arg)->first) {\n        return 1;\n    } else {\n        return 0;\n    }\n\n}\n//}}}\n\n//{{{int uint_pair_search_by_first_key_cmp(const void *a, const void *b)\nint uint_pair_search_by_first_key_cmp(const void *a, const void *b)\n{\n    uint32_t *key = (uint32_t *)a;\n    struct uint_pair **arg = (struct uint_pair **)b;\n\n    if (*key < (*arg)->first) {\n        return -1;\n    } else if (*key > (*arg)->first) {\n        return 1;\n    } else {\n        return 0;\n    }\n}\n//}}}\n//}}}\n\n//{{{ fifo_q\n//{{{void fifo_q_push(struct fifo_q **q, void *val)\nvoid fifo_q_push(struct fifo_q **q, void *val)\n{\n    int *v = (int *)val;\n    struct fifo_q_element *n = (struct fifo_q_element *)\n            malloc(sizeof(struct fifo_q_element));\n    if (n == NULL)\n        err(1, \"calloc error in fifo_q_push().\\n\");\n\n    n->val = val;\n    n->next = NULL;\n\n    if (*q == NULL) {\n        *q = (struct fifo_q *)malloc(sizeof(struct fifo_q));\n        if (*q == NULL)\n            err(1, \"calloc error in fifo_q_push().\\n\");\n        (*q)->head = n;\n        (*q)->tail = n;\n    } else {\n        (*q)->tail->next = n;\n        (*q)->tail = n;\n    }\n}\n//}}}\n\n//{{{void *fifo_q_pop(struct fifo_q **q)\nvoid *fifo_q_pop(struct fifo_q **q)\n{\n    if (*q == NULL)\n        return NULL;\n\n    struct fifo_q_element *n = (*q)->head;\n    void *r = n->val;\n    (*q)->head = n->next;\n    free(n);\n\n    if ((*q)->head == NULL) {\n        free(*q);\n        *q = NULL;\n    }\n\n    return r;\n}\n//}}}\n\n//{{{void *fifo_q_peek(struct fifo_q *q)\nvoid *fifo_q_peek(struct fifo_q *q)\n{\n    if (q == NULL)\n        return NULL;\n    else\n        return q->head->val;\n}\n//}}}\n//}}}\n\n//{{{ byte_array\n//{{{ struct byte_array *byte_array_init(uint32_t init_size)\nstruct byte_array *byte_array_init(uint32_t init_size)\n{\n    struct byte_array *ba = (struct byte_array *)\n            malloc(sizeof(struct byte_array));\n    if (ba == NULL)\n        err(1, \"malloc error in byte_array_init().\\n\");\n    \n    ba->data = (char *) malloc(init_size);\n    if (ba->data == NULL)\n        err(1, \"malloc error in byte_array_init().\\n\");\n\n    ba->num = 0;\n    ba->size = init_size;\n\n    return ba;\n}\n//}}}\n\n//{{{void byte_array_destory(struct byte_array **ba)\nvoid byte_array_destory(struct byte_array **ba)\n{\n    free((*ba)->data);\n    free(*ba);\n    *ba = NULL;\n}\n//}}}\n\n//{{{void byte_array_append(struct byte_array *ba, void *data, uint32_t size)\nvoid byte_array_append(struct byte_array *ba, void *data, uint32_t size)\n{\n    while (ba->num + size >= ba->size) {\n        ba->size = ba->size * 2;\n        ba->data = realloc(ba->data, ba->size * sizeof(char *));\n        if (ba->data == NULL)\n            err(1, \"realloc error in byte_array_append().\\n\");\n    }\n    if (ba->num + size >= ba->size)\n        errx(1, \"Not enough room to append on byte array\");\n\n    void *r = memcpy(ba->data + ba->num, data, size);\n    ba->num += size;\n}\n//}}}\n\n//{{{void byte_array_append_zeros(struct byte_array *ba, uint32_t size)\nvoid byte_array_append_zeros(struct byte_array *ba, uint32_t size)\n{\n    memset(ba->data + ba->num, 0, size);\n    ba->num += size;\n}\n//}}}\n//}}}\n\n//{{{ uint32_t_array\n//{{{ struct uint32_t_array *uint32_t_array_init(uint32_t init_size)\nstruct uint32_t_array *uint32_t_array_init(uint32_t init_size)\n{\n    struct uint32_t_array *ua = \n            (struct uint32_t_array *) malloc(sizeof(struct uint32_t_array));\n    if (ua == NULL)\n        err(1, \"alloc error in uint32_t_array_init().\\n\");\n\n    ua->size = init_size;\n    ua->data = (uint32_t *)malloc(init_size * sizeof(uint32_t));\n    if (ua->data == NULL)\n        err(1, \"alloc error in uint32_t_array_init().\\n\");\n\n    ua->num = 0;\n    return ua;\n}\n//}}}\n\n//{{{void uint32_t_array_destroy(struct uint32_t_array **ua);\nvoid uint32_t_array_destroy(struct uint32_t_array **ua)\n{\n    free((*ua)->data);\n    free(*ua);\n    *ua = NULL;\n}\n//}}}\n\n//{{{uint32_t uint32_t_array_add(struct uint32_t_array *oi)\nuint32_t uint32_t_array_add(struct uint32_t_array *ua, uint32_t val)\n{\n    if (ua->num == ua->size) {\n        ua->size = ua->size * 2;\n        ua->data = (uint32_t *)\n                realloc(ua->data, ua->size * sizeof(uint32_t));\n\n        if (ua->data == NULL)\n            err(1, \"alloc error in uint32_t_array_add().\\n\");\n\n        memset(ua->data + ua->num, 0, (ua->size - ua->num) * sizeof(uint32_t));\n    }\n\n    ua->data[ua->num] = val;\n    ua->num = ua->num + 1;\n    return ua->num - 1;\n}\n//}}}\n\n//{{{uint32_t uint32_t_array_set(\nuint32_t uint32_t_array_set(struct uint32_t_array *ua,\n                            uint32_t val,\n                            uint32_t index)\n{\n    while (ua->size < index) {\n        ua->size = ua->size * 2;\n        ua->data = (uint32_t *)\n                realloc(ua->data, ua->size * sizeof(uint32_t));\n        if (ua->data == NULL)\n            err(1, \"alloc error in uint32_t_array_add().\\n\");\n        memset(ua->data + ua->num, 0, (ua->size - ua->num) * sizeof(uint32_t));\n    }\n\n    ua->data[index] = val;\n    if (index + 1 > ua->num)\n        ua->num = index + 1;\n    return index;\n}\n//}}}\n\n//{{{uint32_t *uint32_t_array_get(struct uint32_t_array *ua, uint32_t index)\nuint32_t *uint32_t_array_get(struct uint32_t_array *ua, uint32_t index)\n{\n    if (index > ua->size)\n        return NULL;\n    else\n        return &(ua->data[index]);\n}\n//}}}\n//}}}\n\n//{{{ uint64_t_array\n//{{{ struct uint64_t_array *uint64_t_array_init(uint64_t init_size)\nstruct uint64_t_array *uint64_t_array_init(uint64_t init_size)\n{\n    struct uint64_t_array *ua = \n            (struct uint64_t_array *) malloc(sizeof(struct uint64_t_array));\n    if (ua == NULL)\n        err(1, \"alloc error in uint64_t_array_init().\\n\");\n\n    ua->size = init_size;\n    ua->data = (uint64_t *)malloc(init_size * sizeof(uint64_t));\n    if (ua->data == NULL)\n        err(1, \"alloc error in uint64_t_array_init().\\n\");\n\n    ua->num = 0;\n    return ua;\n}\n//}}}\n\n//{{{void uint64_t_array_destroy(struct uint64_t_array **ua);\nvoid uint64_t_array_destroy(struct uint64_t_array **ua)\n{\n    free((*ua)->data);\n    free(*ua);\n    *ua = NULL;\n}\n//}}}\n\n//{{{uint64_t uint64_t_array_add(struct uint64_t_array *oi)\nuint64_t uint64_t_array_add(struct uint64_t_array *ua, uint64_t val)\n{\n    if (ua->num == ua->size) {\n        ua->size = ua->size * 2;\n        ua->data = (uint64_t *)\n                realloc(ua->data, ua->size * sizeof(uint64_t));\n\n        if (ua->data == NULL)\n            err(1, \"alloc error in uint64_t_array_add().\\n\");\n\n        memset(ua->data + ua->num, 0, (ua->size - ua->num) * sizeof(uint64_t));\n    }\n\n    ua->data[ua->num] = val;\n    ua->num = ua->num + 1;\n    return ua->num - 1;\n}\n//}}}\n\n//{{{uint64_t *uint64_t_array_get(struct uint64_t_array *ua, uint64_t index)\nuint64_t *uint64_t_array_get(struct uint64_t_array *ua, uint64_t index)\n{\n    if (index > ua->size)\n        return NULL;\n    else\n        return &(ua->data[index]);\n}\n//}}}\n//}}}\n"
  },
  {
    "path": "src/lists.h",
    "content": "#ifndef __LISTS_H__\n#define __LISTS_H__\n\n#include <stdint.h>\n#include <htslib/khash.h>\n#include \"disk_store.h\"\n\n// BITMAP\nstruct bit_map\n{\n    uint64_t num_bits;\n    uint32_t num_ints;\n    uint32_t *bm;\n};\n\nstruct bit_map *bit_map_init(uint64_t bits);\nstruct bit_map *bit_map_load(FILE *f, char *file_name);\nvoid bit_map_store(struct bit_map *b, FILE *f, char *file_name);\nvoid bit_map_destroy(struct bit_map **b);\nvoid bit_map_set(struct bit_map *b, uint64_t i);\nuint32_t bit_map_get(struct bit_map *b, uint64_t q);\n\n// INDEXED LIST\nstruct indexed_list\n{\n    char *data;\n    uint64_t size;\n    uint32_t element_size;\n    struct bit_map *bm;\n};\nstruct indexed_list *indexed_list_init(uint64_t init_size,\n                                       uint32_t element_size);\nvoid indexed_list_destroy(struct indexed_list **il);\nuint32_t indexed_list_add(struct indexed_list *il,\n                          uint64_t index,\n                          void *data);\nvoid *indexed_list_get(struct indexed_list *il, uint64_t index);\nvoid indexed_list_write(struct indexed_list *il, FILE *f, char *file_name);\nstruct indexed_list *indexed_list_load(FILE *f, char *file_name);\n\nstruct offset_size_pair\n{\n    long offset;\n    uint32_t size;\n};\n\n// HASH LIST\nstruct hash_list\n{\n    void *hash;\n};\n\nstruct hash_list *hash_list_init();\nuint32_t hash_list_add(struct hash_list *il,\n                       uint32_t index,\n                       void *data,\n                       uint32_t data_size);\nvoid *hash_list_get(struct hash_list *il,\n                    uint32_t index);\nvoid hash_list_write(struct indexed_list *il, FILE *f, char *file_name);\nvoid *hash_list_remove(struct hash_list *il,\n                       uint32_t index);\nvoid hash_list_destroy(struct hash_list **hashl);\nvoid hash_list_value_cache_handler_pair_destroy(struct hash_list **hashl);\n\n// UNORDERD LIST\nstruct unordered_list\n{\n    void **data;\n    uint32_t num, size;\n};\n\nstruct unordered_list *unordered_list_init(uint32_t init_size);\nvoid unordered_list_destroy(struct unordered_list **ul,\n                            void (*free_data)(void **data));\nuint32_t unordered_list_add(struct unordered_list *ul,\n                            void *data);\nvoid *unordered_list_get(struct unordered_list *ul, uint32_t i);\nstruct unordered_list *unordered_list_load(\n                FILE *f,\n                char *file_name,\n                void *(*ul_load)(FILE *f, char *file_name));\nvoid unordered_list_store(struct unordered_list *ul, \n                          FILE *f,\n                          char *file_name,\n                          void (*ul_store)(void *v, FILE *f, char *file_name));\n\n\n\n// ORDERD SET\nstruct ordered_set\n{\n    void **data;\n    uint32_t num, size;\n    int (*sort_element_cmp)(const void *a, const void *b);\n    int (*search_element_cmp)(const void *a, const void *b);\n    int (*search_key_cmp)(const void *a, const void *b);\n};\n\nstruct ordered_set \n        *ordered_set_init(\n                uint32_t init_size,\n                int (*sort_element_cmp)(const void *a, const void *b),\n                int (*search_element_cmp)(const void *a, const void *b),\n                int (*search_key_cmp)(const void *a, const void *b));\n\nstruct ordered_set \n        *ordered_set_load(\n                FILE *f,\n                char *file_name,\n                void *(*os_load)(FILE *f, char *file_name),\n                int (*sort_element_cmp)(const void *a, const void *b),\n                int (*search_element_cmp)(const void *a, const void *b),\n                int (*search_key_cmp)(const void *a, const void *b));\n\nvoid ordered_set_destroy(struct ordered_set **os,\n                         void (*free_data)(void **data));\nvoid *ordered_set_add(struct ordered_set *os,\n                       void *data);\nvoid *ordered_set_get(struct ordered_set *os, void *key);\n\nvoid ordered_set_store(struct ordered_set *os, \n                       FILE *f,\n                       char *file_name,\n                       void (*os_store)(void *v, FILE *f, char *file_name));\n \n\nstruct str_uint_pair\n{\n    char *str;\n    uint32_t uint;\n};\n\nint str_uint_pair_sort_element_cmp(const void *a, const void *b);\nint str_uint_pair_search_element_cmp(const void *a, const void *b);\nint str_uint_pair_search_key_cmp(const void *a, const void *b);\nvoid str_uint_pair_store(void *v, FILE *f, char *file_name);\nvoid *str_uint_pair_load(FILE *f, char *file_name);\nvoid str_uint_pair_free(void **v);\n\nstruct pointer_uint_pair\n{\n    void *pointer;\n    uint32_t uint;\n};\nint pointer_uint_pair_sort_element_cmp(const void *a, const void *b);\nint pointer_uint_pair_search_element_cmp(const void *a, const void *b);\nint pointer_uint_pair_search_key_cmp(const void *a, const void *b);\n\nstruct uint_offset_size_pair\n{\n    uint32_t uint,size;\n    long offset;\n};\nint uint_offset_size_pair_sort_element_cmp(const void *a, const void *b);\nint uint_offset_size_pair_search_element_cmp(const void *a, const void *b);\nint uint_offset_size_pair_search_key_cmp(const void *a, const void *b);\n\nstruct uint_pair\n{\n    uint32_t first,second;\n};\nint uint_pair_sort_by_first_element_cmp(const void *a, const void *b);\nint uint_pair_search_by_first_element_cmp(const void *a, const void *b);\nint uint_pair_search_by_first_key_cmp(const void *a, const void *b);\n\n\n// FIFO Q\nstruct fifo_q_element\n{\n    void *val;\n    struct fifo_q_element *next;\n};\n\nstruct fifo_q\n{\n    struct fifo_q_element *head, *tail;\n};\n\nvoid fifo_q_push(struct fifo_q **q, void *val);\nvoid *fifo_q_pop(struct fifo_q **q);\nvoid *fifo_q_peek(struct fifo_q *q);\n\n// BYTE ARRAY\nstruct byte_array\n{\n    char *data;\n    uint32_t num, size;\n};\n\nstruct byte_array *byte_array_init(uint32_t init_size);\nvoid byte_array_destory(struct byte_array **ba);\nvoid byte_array_append(struct byte_array *ba, void *data, uint32_t size);\nvoid byte_array_append_zeros(struct byte_array *ba, uint32_t size);\n\n\n// UINT32 ARRAY\nstruct uint32_t_array\n{\n    uint32_t num, size, *data;\n};\n\nstruct uint32_t_array *uint32_t_array_init(uint32_t init_size);\nvoid uint32_t_array_destroy(struct uint32_t_array **ua);\nuint32_t uint32_t_array_add(struct uint32_t_array *ua, uint32_t val);\nuint32_t uint32_t_array_set(struct uint32_t_array *ua,\n                            uint32_t val,\n                            uint32_t index);\nuint32_t *uint32_t_array_get(struct uint32_t_array *ua, uint32_t index);\n\n// UINT64 ARRAY\nstruct uint64_t_array\n{\n    uint64_t num, size, *data;\n};\n\nstruct uint64_t_array *uint64_t_array_init(uint64_t init_size);\nvoid uint64_t_array_destroy(struct uint64_t_array **ua);\nuint64_t uint64_t_array_add(struct uint64_t_array *ua, uint64_t val);\nuint64_t *uint64_t_array_get(struct uint64_t_array *ua, uint64_t index);\n\n#endif\n"
  },
  {
    "path": "src/ll.c",
    "content": "#define _GNU_SOURCE\n\n#include <stdlib.h>\n#include <stdint.h>\n#include <err.h>\n#include \"util.h\"\n#include \"ll.h\"\n#include \"giggle_index.h\"\n\n//{{{void uint64_t_ll_map_intersection_to_offset_list(struct giggle_index *gi,\nvoid uint64_t_ll_map_intersection_to_offset_list(struct giggle_index *gi,\n                                                 struct giggle_query_result *gqr,\n                                                 void *_R)\n{\n#ifdef DEBUG\n    fprintf(stderr,\n            \"uint64_t_map_intersection_to_offset_list\\n\");\n#endif\n\n    struct uint64_t_ll *R  = (struct uint64_t_ll *)_R;\n\n    if (R != NULL) {\n        struct uint64_t_ll_node *curr = R->head;\n\n#ifdef DEBUG\n        fprintf(stderr,\n                \"giggle_query R->len:%u\\n\",\n                R->len);\n#endif\n\n        while (curr != NULL) {\n            struct file_id_offset_pair fid_off = \n                    offset_index_get(gi->offset_idx, curr->val);\n                    //gi->offset_index->vals[curr->val];\n            //long_ll_append(&(gqr->offsets[fid_off.file_id]),fid_off.offset);\n            long_uint_ll_append(&(gqr->offsets[fid_off.file_id]),\n                                fid_off.offset,\n                                curr->val);\n            curr = curr->next;\n        }\n\n        uint64_t_ll_free((void **)&R);\n        R=NULL;\n    } \n}\n//}}}\n\n//{{{ uint64_t_ll_non_leading_cache_handler\nstruct cache_handler uint64_t_ll_non_leading_cache_handler = {\n        uint64_t_ll_non_leading_serialize,\n        uint64_t_ll_non_leading_deserialize,\n        uint64_t_ll_non_leading_free\n};\n\n//{{{uint64_t uint64_t_ll_non_leading_serialize(void *deserialized,\nuint64_t uint64_t_ll_non_leading_serialize(void *deserialized,\n                                           void **serialized)\n{\n    if (deserialized == NULL) {\n        *serialized = NULL;\n        return 0;\n    }\n\n    struct uint64_t_ll_bpt_non_leading_data *d =  \n            (struct uint64_t_ll_bpt_non_leading_data *)deserialized;\n\n    uint64_t SA_len, SE_len, serialized_len;\n\n    if (d->SA != NULL)\n        SA_len = d->SA->len;\n    else\n        SA_len = 0;\n\n    if (d->SE != NULL)\n        SE_len = d->SE->len;\n    else\n        SE_len = 0;\n\n\n    serialized_len = (2 + SA_len + SE_len) * sizeof(uint64_t);\n\n    uint64_t *data = (uint64_t *)calloc(2 + SA_len + SE_len, sizeof(uint64_t));\n    if (data == NULL)\n        err(1, \"calloc error in uint64_t_ll_non_leading_serialize.\\n\");\n\n\n    uint64_t data_i = 0;\n    data[data_i++] = SA_len;\n    data[data_i++] = SE_len;\n\n    uint64_t i;\n    struct uint64_t_ll_node *curr;\n\n    if (d->SA != NULL) {\n        curr = d->SA->head;\n        i = 0;\n        while (curr != NULL) {\n            data[data_i++] = curr->val;\n            i += 1;\n            curr = curr->next;\n        }\n\n        if (i != d->SA->len)\n            errx(1, \"Incorrect length in SA:non_leading_data.\");\n    }\n\n    if (d->SE != NULL) {\n        curr = d->SE->head;\n        i = 0;\n        while (curr != NULL) {\n            data[data_i++] = curr->val;\n            i += 1;\n            curr = curr->next;\n        }\n\n        if (i != d->SE->len)\n            errx(1, \"Incorrect length in SE:non_leading_data.\");\n    }\n\n    *serialized = data;\n\n    return serialized_len; \n}\n//}}}\n\n//{{{uint64_t uint64_t_ll_non_leading_deserialize(void *serialized,\nuint64_t uint64_t_ll_non_leading_deserialize(void *serialized,\n                                             uint64_t serialized_size,\n                                             void **deserialized)\n{\n    if ((serialized_size == 0) || (serialized == NULL)) {\n        *deserialized = NULL;\n        return 0;\n    }\n\n    if (serialized_size < 2)\n        errx(1,\n             \"Malformed uint64_t_ll_non_leading serialized value. \"\n             \"Too short\");\n\n    uint64_t *data = (uint64_t *)serialized;\n\n    if ((2 + data[0] + data[1]) * sizeof(uint64_t) != serialized_size)\n        errx(1,\n             \"Malformed uint64_t_ll_non_leading serialized value. \"\n             \"Incorrect serialized_size.\");\n\n    struct uint64_t_ll_bpt_non_leading_data *d = \n            (struct uint64_t_ll_bpt_non_leading_data *)\n                    calloc(1,\n                           sizeof(struct uint64_t_ll_bpt_non_leading_data));\n    if (d == NULL)\n        err(1, \"calloc error in uint64_t_ll_non_leading_deserialize\");\n\n    d->SA = NULL;\n    d->SE = NULL;\n\n    uint64_t i;\n    for (i = 0; i < data[0]; ++i)\n        uint64_t_ll_append(&(d->SA), data[2 + i]);\n\n    for (i = 0; i < data[1]; ++i)\n        uint64_t_ll_append(&(d->SE), data[2 + data[0]+ i]);\n\n    *deserialized = d;\n\n    return sizeof(struct uint64_t_ll_bpt_non_leading_data);\n}\n//}}}\n\n//{{{void uint64_t_ll_non_leading_free(void **deserialized)\nvoid uint64_t_ll_non_leading_free(void **deserialized)\n{\n    struct uint64_t_ll_bpt_non_leading_data **d = \n            (struct uint64_t_ll_bpt_non_leading_data **)deserialized;\n    uint64_t_ll_free((void **)&((*d)->SA));\n    uint64_t_ll_free((void **)&((*d)->SE));\n    free(*d);\n    *d = NULL;\n}\n//}}}\n//}}}\n\n//{{{ uint64_t_ll_leading_cache_handler \nstruct cache_handler uint64_t_ll_leading_cache_handler = {\n        uint64_t_ll_leading_serialize,\n        uint64_t_ll_leading_deserialize,\n        uint64_t_ll_leading_free\n};\n\n//{{{uint64_t uint64_t_ll_leading_serialize(void *deserialized,\nuint64_t uint64_t_ll_leading_serialize(void *deserialized,\n                                       void **serialized)\n{\n    if (deserialized == NULL) {\n        *serialized = NULL;\n        return 0;\n    }\n\n    struct uint64_t_ll_bpt_leading_data *d =  \n            (struct uint64_t_ll_bpt_leading_data *)deserialized;\n\n    uint64_t B_len, serialized_len;\n\n    if (d->B != NULL)\n        B_len = d->B->len;\n    else\n        B_len = 0;\n\n    serialized_len = (1 + B_len) * sizeof(uint64_t);\n\n    uint64_t *data = (uint64_t *)calloc(1 + B_len , sizeof(uint64_t));\n    if (data == NULL)\n        err(1, \"calloc error in uint64_t_ll_leading_serialize().\\n\");\n\n    uint64_t data_i = 0;\n    data[data_i++] = B_len;\n\n    uint64_t i;\n    struct uint64_t_ll_node *curr;\n\n    if (d->B != NULL) {\n        curr = d->B->head;\n        i = 0;\n        while (curr != NULL) {\n            data[data_i++] = curr->val;\n            i += 1;\n            curr = curr->next;\n        }\n\n        if (i != d->B->len)\n            errx(1, \"Incorrect length in B:leading_data.\");\n    }\n\n    *serialized = data;\n\n    return serialized_len; \n}\n//}}}\n\n//{{{uint64_t uint64_t_ll_leading_deserialize(void *serialized,\nuint64_t uint64_t_ll_leading_deserialize(void *serialized,\n                                         uint64_t serialized_size,\n                                         void **deserialized)\n{\n    if ((serialized_size == 0) || (serialized == NULL)) {\n        *deserialized = NULL;\n        return 0;\n    }\n\n    uint64_t *data = (uint64_t *)serialized;\n\n    if ((1 + data[0]) * sizeof(uint64_t) != serialized_size)\n        errx(1,\n             \"Malformed uint64_t_ll_leading serialized value. \"\n             \"Incorrect serialized_size.\");\n\n    struct uint64_t_ll_bpt_leading_data *d = \n            (struct uint64_t_ll_bpt_leading_data *)\n                    calloc(1,\n                           sizeof(struct uint64_t_ll_bpt_leading_data));\n    if (d == NULL)\n        err(1, \"calloc error in uint64_t_ll_leading_deserialize.\\n\");\n\n    d->B = NULL;\n\n    uint64_t i;\n    for (i = 0; i < data[0]; ++i)\n        uint64_t_ll_append(&(d->B), data[1 + i]);\n\n    *deserialized = d;\n    return sizeof(struct uint64_t_ll_bpt_leading_data);\n}\n//}}}\n\n//{{{void uint64_t_ll_leading_free(void **deserialized)\nvoid uint64_t_ll_leading_free(void **deserialized)\n{\n    struct uint64_t_ll_bpt_leading_data **d = \n            (struct uint64_t_ll_bpt_leading_data **)deserialized;\n    uint64_t_ll_free((void **)&((*d)->B));\n    free(*d);\n    *d = NULL;\n}\n//}}}\n//}}}\n\n//{{{ giggle_data_handler :: int64_t_ll_giggle_data_handler\n\nvoid uint64_t_ll_giggle_set_data_handler()\n{\n    bpt_node_repair = uint64_t_ll_leading_repair;\n\n    uint64_t_ll_giggle_data_handler.non_leading_cache_handler =\n        uint64_t_ll_non_leading_cache_handler;\n    uint64_t_ll_giggle_data_handler.leading_cache_handler = \n        uint64_t_ll_leading_cache_handler;\n    uint64_t_ll_giggle_data_handler.new_non_leading = \n        uint64_t_ll_new_non_leading;\n    uint64_t_ll_giggle_data_handler.new_leading = \n        uint64_t_ll_new_leading;\n    uint64_t_ll_giggle_data_handler.non_leading_SA_add_scalar = \n        uint64_t_ll_non_leading_SA_add_scalar;\n    uint64_t_ll_giggle_data_handler.non_leading_SE_add_scalar = \n        uint64_t_ll_non_leading_SE_add_scalar;\n    uint64_t_ll_giggle_data_handler.leading_B_add_scalar = \n        uint64_t_ll_leading_B_add_scalar;\n    uint64_t_ll_giggle_data_handler.leading_union_with_B = \n        uint64_t_ll_leading_union_with_B;\n    uint64_t_ll_giggle_data_handler.non_leading_union_with_SA = \n        uint64_t_ll_non_leading_union_with_SA;\n    uint64_t_ll_giggle_data_handler.non_leading_union_with_SA_subtract_SE = \n        uint64_t_ll_non_leading_union_with_SA_subtract_SE;\n\n    uint64_t_ll_giggle_data_handler.write_tree = \n        giggle_write_tree_cache_dump;\n\n    uint64_t_ll_giggle_data_handler.giggle_collect_intersection =\n        giggle_collect_intersection_data_in_pointers;\n\n    uint64_t_ll_giggle_data_handler.map_intersection_to_offset_list =\n        uint64_t_ll_map_intersection_to_offset_list;\n\n    giggle_data_handler = uint64_t_ll_giggle_data_handler;\n}\n\n\n//{{{void *uint64_t_ll_new_non_leading()\nvoid *uint64_t_ll_new_non_leading(uint32_t domain)\n{\n    struct uint64_t_ll_bpt_non_leading_data *d = \n            (struct uint64_t_ll_bpt_non_leading_data *)\n            malloc(sizeof( struct uint64_t_ll_bpt_non_leading_data));\n    if (d == NULL)\n        err(1, \"malloc error in uint64_t_ll_bpt_non_leading_data.\\n\");\n\n    d->SA = NULL;\n    d->SE = NULL;\n\n    return (void *)d;\n}\n//}}}\n\n//{{{void *uint64_t_ll_new_leading()\nvoid *uint64_t_ll_new_leading(uint32_t domain)\n{\n    struct uint64_t_ll_bpt_leading_data *d = \n            (struct uint64_t_ll_bpt_leading_data *)\n            malloc(sizeof( struct uint64_t_ll_bpt_leading_data));\n    if (d == NULL)\n        err(1, \"malloc error in uint64_t_ll_new_leading.\\n\");\n\n    d->B = NULL;\n\n    return (void *)d;\n}\n//}}}\n\n//{{{void uint64_t_ll_non_leading_SA_add_scalar(void *d, void *v)\nvoid uint64_t_ll_non_leading_SA_add_scalar(uint32_t domain,\n                                           void *_nld,\n                                           void *_id)\n{\n#if DEBUG\n    fprintf(stderr, \"uint64_t_ll_non_leading_SA_add_scalar\\n\");\n#endif\n    struct uint64_t_ll_bpt_non_leading_data *nld =\n            (struct uint64_t_ll_bpt_non_leading_data *)_nld;\n    uint64_t *id = (uint64_t *)_id;\n\n#if DEBUG\n    fprintf(stderr, \"id:%u\\n\", *id);\n#endif\n\n    uint64_t_ll_uniq_append(&(nld->SA), *id);\n}\n//}}}\n\n//{{{void uint64_t_ll_non_leading_SE_add_scalar(void *d, void *v)\nvoid uint64_t_ll_non_leading_SE_add_scalar(uint32_t domain,\n                                           void *_nld,\n                                           void *_id)\n{\n#if DEBUG\n    fprintf(stderr, \"uint64_t_ll_non_leading_SE_add_scalar\\n\");\n#endif\n    struct uint64_t_ll_bpt_non_leading_data *nld =\n            (struct uint64_t_ll_bpt_non_leading_data *)_nld;\n    uint64_t *id = (uint64_t *)_id;\n\n#if DEBUG\n    fprintf(stderr, \"id:%u\\n\", *id);\n#endif\n\n    uint64_t_ll_uniq_append(&(nld->SE), *id);\n}\n//}}}\n\n//{{{void uint64_t_ll_leading_B_add_scalar(void *d, void *v)\nvoid uint64_t_ll_leading_B_add_scalar(uint32_t domain,\n                                      void *_ld,\n                                      void *_id)\n{\n#if DEBUG\n    fprintf(stderr, \"uint64_t_ll_leading_B_add_scalar\\n\");\n#endif\n    struct uint64_t_ll_bpt_leading_data *ld =\n            (struct uint64_t_ll_bpt_leading_data *)_ld;\n    uint64_t *id = (uint64_t *)_id;\n\n#if DEBUG\n    fprintf(stderr, \"id:%u\\n\", *id);\n#endif\n\n    uint64_t_ll_uniq_append(&(ld->B), *id);\n}\n//}}}\n\n//{{{void uint64_t_ll_leading_union_with_B(void **R, void *leading)\nvoid uint64_t_ll_leading_union_with_B(uint32_t domain,\n                                      void **R,\n                                      void *leading)\n{\n#if DEBUG\n    fprintf(stderr, \"uint64_t_ll_leading_union_with_B\\n\");\n#endif\n\n    struct uint64_t_ll_node *curr = \n        ((struct uint64_t_ll_bpt_leading_data *)(leading))->B->head;\n    while (curr != NULL) {\n#if DEBUG\n        fprintf(stderr, \"+%u\\n\", curr->val);\n#endif\n        uint64_t_ll_uniq_append((struct uint64_t_ll **)R, curr->val);\n        curr = curr->next;\n    }\n}\n//}}}\n\n//{{{void uint64_t_ll_non_leading_union_with_SA(void **R, void *d)\nvoid uint64_t_ll_non_leading_union_with_SA(uint32_t domain, void **R, void *d)\n{\n#if DEBUG\n    fprintf(stderr, \"uint64_t_ll_non_leading_union_with_SA\\n\");\n#endif\n    struct uint64_t_ll_bpt_non_leading_data *nld = \n            (struct uint64_t_ll_bpt_non_leading_data *) d;\n    if (nld != NULL) {\n        if ((nld->SA != NULL)) {\n            struct uint64_t_ll_node *curr = nld->SA->head;\n            while (curr != NULL) {\n#if DEBUG\n                fprintf(stderr, \"+%u\\n\", curr->val);\n#endif\n                uint64_t_ll_uniq_append((struct uint64_t_ll **)R, curr->val);\n                curr = curr->next;\n            }\n        }\n    }\n}\n//}}}\n\n//{{{void uint64_t_ll_non_leading_union_with_SA_subtract_SE(void **R, void *d)\nvoid uint64_t_ll_non_leading_union_with_SA_subtract_SE(uint32_t domain,\n                                                       void **R,\n                                                       void *d)\n{\n#if DEBUG\n    fprintf(stderr, \"uint64_t_ll_non_leading_union_with_SA_subtract_SE\\n\");\n#endif\n\n    struct uint64_t_ll_bpt_non_leading_data *nld = \n            (struct uint64_t_ll_bpt_non_leading_data *) d;\n    if (nld != NULL) {\n        if ((nld->SA != NULL)) {\n            struct uint64_t_ll_node *curr = nld->SA->head;\n            while (curr != NULL) {\n#if DEBUG\n                fprintf(stderr, \"+%u\\n\", curr->val);\n#endif\n                uint64_t_ll_uniq_append((struct uint64_t_ll **)R, curr->val);\n                curr = curr->next;\n            }\n        }\n        if ((nld->SE != NULL)) {\n            struct uint64_t_ll_node *curr = nld->SE->head;\n            while (curr != NULL) {\n#if DEBUG\n                fprintf(stderr, \"-%u\\n\", curr->val);\n#endif\n                uint64_t_ll_remove((struct uint64_t_ll **)R, curr->val);\n                curr = curr->next;\n            }\n        }\n    }\n\n}\n//}}}\n//}}}\n\n//{{{void uint64_t_ll_append(struct uint64_t_ll **ll, uint64_t val)\nvoid uint64_t_ll_append(struct uint64_t_ll **ll, uint64_t val)\n{\n    struct uint64_t_ll_node *n = (struct uint64_t_ll_node *)\n        malloc(sizeof(struct uint64_t_ll_node));\n    if (n == NULL)\n        err(1, \"malloc error in uint64_t_ll_append.\\n\");\n    n->val = val;\n    n->next = NULL;\n\n    if (*ll == NULL) {\n        *ll = (struct uint64_t_ll *)malloc(sizeof(struct uint64_t_ll));\n        if (*ll == NULL)\n            err(1, \"malloc error in uint64_t_ll_append.\\n\");\n\n        (*ll)->head = n;\n        (*ll)->len = 1;\n    } else {\n        (*ll)->tail->next = n;\n        (*ll)->len = (*ll)->len + 1;\n    }\n\n    (*ll)->tail = n;\n}\n//}}}\n\n//{{{void uint64_t_ll_uniq_append(struct uint64_t_ll **ll, uint64_t val)\nvoid uint64_t_ll_uniq_append(struct uint64_t_ll **ll, uint64_t val)\n{\n#if DEBUG\n    fprintf(stderr, \"uint64_t_ll_uniq_append\\n\");\n    fprintf(stderr, \"val:%u\\n\", val);\n#endif\n    struct uint64_t_ll_node *n = (struct uint64_t_ll_node *)\n        malloc(sizeof(struct uint64_t_ll_node));\n    if (n == NULL)\n        err(1, \"malloc error in uint64_t_ll_uniq_append.\\n\");\n\n    n->val = val;\n    n->next = NULL;\n\n    if (*ll == NULL) {\n        *ll = (struct uint64_t_ll *)malloc(sizeof(struct uint64_t_ll));\n        if (*ll == NULL)\n            err(1, \"malloc error in uint64_t_ll_uniq_append.\\n\");\n\n        (*ll)->head = n;\n        (*ll)->len = 1;\n    } else {\n\n        struct uint64_t_ll_node *curr = (*ll)->head;\n        while (curr != NULL) {\n            if (curr->val == val) {\n                free(n);\n                return;\n            }\n            curr = curr->next;\n        }\n\n        (*ll)->tail->next = n;\n        (*ll)->len = (*ll)->len + 1;\n    }\n\n    (*ll)->tail = n;\n}\n//}}}\n\n//{{{void uint64_t_ll_remove(struct uint64_t_ll **ll, uint64_t val)\nvoid uint64_t_ll_remove(struct uint64_t_ll **ll, uint64_t val)\n{\n    if (*ll != NULL) {\n        struct uint64_t_ll_node *tmp, *last = NULL, *curr = (*ll)->head;\n        while (curr != NULL) {\n            if (curr->val == val) {\n                if ((curr == (*ll)->head) && (curr == (*ll)->tail)) {\n                    free(curr);\n                    free(*ll);\n                    *ll = NULL;\n                    return;\n                } else if (curr == (*ll)->head) {\n                    tmp = curr->next;\n                    free(curr);\n                    (*ll)->head = tmp;\n                    curr = tmp;\n                    (*ll)->len = (*ll)->len - 1;\n                } else if (curr == (*ll)->tail) {\n                    free(curr);\n                    curr = NULL;\n                    (*ll)->tail = last;\n                    last->next = NULL;\n                    (*ll)->len = (*ll)->len - 1;\n                } else {\n                    tmp = curr;\n                    last->next = tmp->next;\n                    curr = tmp->next;\n                    free(tmp);\n                    (*ll)->len = (*ll)->len - 1;\n                }\n            } else {\n                last = curr;\n                curr = curr->next;\n            }\n        }\n    }\n}\n//}}}\n\n//{{{int uint64_t_ll_contains(struct uint64_t_ll *ll, uint64_t val)\nuint64_t uint64_t_ll_contains(struct uint64_t_ll *ll, uint64_t val)\n{\n    if (ll == NULL)\n       return 0; \n\n    uint64_t r = 0;\n    \n    struct uint64_t_ll_node *curr = ll->head;\n    while (curr != NULL) {\n        if (curr->val == val)\n            r += 1;\n        curr = curr->next;\n    }\n\n    return r;\n}\n//}}}\n\n//{{{void uint64_t_ll_free(struct uint64_t_ll **ll)\n//void uint64_t_ll_free(struct uint64_t_ll **ll)\nvoid uint64_t_ll_free(void **_ll)\n{\n    struct uint64_t_ll **ll = (struct uint64_t_ll **)_ll;\n    struct uint64_t_ll_node *curr, *tmp;\n\n    if (*ll != NULL) {\n        curr = (*ll)->head;\n        while (curr != NULL) {\n            tmp = curr->next;\n            free(curr);\n            curr = tmp;\n        }\n\n        free(*ll);\n        *ll = NULL;\n    }\n}\n//}}}\n\n//{{{void leading_repair(struct bpt_node *a, struct bpt_node *b)\nvoid uint64_t_ll_leading_repair(uint32_t domain, \n                                struct bpt_node *a,\n                                struct bpt_node *b)\n{\n#if DEBUG\n    fprintf(stderr, \"leading_repair\\n\");\n#endif\n\n    if ( (BPT_IS_LEAF(a) == 1) && (BPT_IS_LEAF(b) == 1) ) {\n        struct uint64_t_ll_bpt_leading_data *d = \n            (struct uint64_t_ll_bpt_leading_data *)\n            malloc(sizeof(struct uint64_t_ll_bpt_leading_data));\n        if (d == NULL)\n            err(1, \"malloc error in uint64_t_ll_leading_repair.\\n\");\n\n        d->B = NULL;\n\n        if (BPT_LEADING(a) != 0) {\n            struct uint64_t_ll_bpt_leading_data *l =  \n                    cache.get(domain,\n                              BPT_LEADING(a) - 1,\n                              &uint64_t_ll_leading_cache_handler);\n\n            struct uint64_t_ll_node *curr = l->B->head;\n\n            while (curr != NULL) {\n#if DEBUG\n                fprintf(stderr, \"+ %u\\n\", curr->val);\n#endif\n                uint64_t_ll_uniq_append(&(d->B), curr->val);\n                curr = curr->next;\n            }\n        }\n\n        uint64_t i;\n        for (i = 0 ; i < BPT_NUM_KEYS(a); ++i) {\n            struct uint64_t_ll_bpt_non_leading_data *nl = \n                    cache.get(domain,\n                              BPT_POINTERS(a)[i] - 1,\n                              &uint64_t_ll_non_leading_cache_handler);\n\n            if (nl->SA != NULL) {\n                struct uint64_t_ll_node *curr = nl->SA->head;\n                while (curr != NULL) {\n                    uint64_t_ll_uniq_append(&(d->B), curr->val);\n#if DEBUG\n                    fprintf(stderr, \"+ %u\\n\", curr->val);\n#endif\n                    curr = curr->next;\n                }\n            }\n\n            if (nl->SE != NULL) {\n                struct uint64_t_ll_node *curr = nl->SE->head;\n                while (curr != NULL) {\n                    uint64_t_ll_remove(&(d->B), curr->val);\n#if DEBUG\n                    fprintf(stderr, \"- %u\\n\", curr->val);\n#endif\n                    curr = curr->next;\n                }\n            }\n        }\n\n        if (d->B != NULL) {\n            uint64_t v_id = cache.seen(domain) + 1;\n            cache.add(domain,\n                      v_id - 1,\n                      d,\n                      sizeof(struct uint64_t_ll_bpt_leading_data),\n                      &uint64_t_ll_leading_cache_handler);\n\n            BPT_LEADING(b) = v_id;\n        } else {\n            free(d);\n        }\n    }\n}\n//}}}\n\n//{{{void long_ll_append(struct long_ll **ll, long val)\nvoid long_ll_append(struct long_ll **ll, long val)\n{\n    struct long_ll_node *n = (struct long_ll_node *)\n        malloc(sizeof(struct long_ll_node));\n    if (n == NULL)\n        err(1, \"malloc error in long_ll_append().\\n\");\n\n    n->val = val;\n    n->next = NULL;\n\n    if (*ll == NULL) {\n        *ll = (struct long_ll *)malloc(sizeof(struct long_ll));\n        if (*ll == NULL)\n            err(1, \"malloc error in long_ll_append().\\n\");\n        (*ll)->head = n;\n        (*ll)->len = 1;\n    } else {\n        (*ll)->tail->next = n;\n        (*ll)->len = (*ll)->len + 1;\n    }\n\n    (*ll)->tail = n;\n}\n//}}}\n\n//{{{void long_ll_uniq_append(struct long_ll **ll, long val)\nvoid long_ll_uniq_append(struct long_ll **ll, long val)\n{\n#if DEBUG\n    fprintf(stderr, \"long_ll_uniq_append\\n\");\n    fprintf(stderr, \"val:%lu\\n\", val);\n#endif\n    struct long_ll_node *n = (struct long_ll_node *)\n        malloc(sizeof(struct long_ll_node));\n    if (n == NULL)\n        err(1, \"malloc error in long_ll_uniq_append().\\n\");\n    n->val = val;\n    n->next = NULL;\n\n    if (*ll == NULL) {\n        *ll = (struct long_ll *)malloc(sizeof(struct long_ll));\n        if (*ll == NULL)\n            err(1, \"malloc error in long_ll_uniq_append().\\n\");\n        (*ll)->head = n;\n        (*ll)->len = 1;\n    } else {\n\n        struct long_ll_node *curr = (*ll)->head;\n        while (curr != NULL) {\n            if (curr->val == val) {\n                free(n);\n                return;\n            }\n            curr = curr->next;\n        }\n\n        (*ll)->tail->next = n;\n        (*ll)->len = (*ll)->len + 1;\n    }\n\n    (*ll)->tail = n;\n}\n//}}}\n\n//{{{void long_ll_remove(struct long_ll **ll, long val)\nvoid long_ll_remove(struct long_ll **ll, long val)\n{\n    if (*ll != NULL) {\n        struct long_ll_node *tmp, *last = NULL, *curr = (*ll)->head;\n        while (curr != NULL) {\n            if (curr->val == val) {\n                if ((curr == (*ll)->head) && (curr == (*ll)->tail)) {\n                    free(curr);\n                    free(*ll);\n                    *ll = NULL;\n                    return;\n                } else if (curr == (*ll)->head) {\n                    tmp = curr->next;\n                    free(curr);\n                    (*ll)->head = tmp;\n                    curr = tmp;\n                    (*ll)->len = (*ll)->len - 1;\n                } else if (curr == (*ll)->tail) {\n                    free(curr);\n                    curr = NULL;\n                    (*ll)->tail = last;\n                    last->next = NULL;\n                    (*ll)->len = (*ll)->len - 1;\n                } else {\n                    tmp = curr;\n                    last->next = tmp->next;\n                    curr = tmp->next;\n                    free(tmp);\n                    (*ll)->len = (*ll)->len - 1;\n                }\n            } else {\n                last = curr;\n                curr = curr->next;\n            }\n        }\n    }\n}\n//}}}\n\n//{{{int long_ll_contains(struct long_ll *ll, long val)\nuint64_t long_ll_contains(struct long_ll *ll, long val)\n{\n    if (ll == NULL)\n       return 0; \n\n    uint64_t r = 0;\n    \n    struct long_ll_node *curr = ll->head;\n    while (curr != NULL) {\n        if (curr->val == val)\n            r += 1;\n        curr = curr->next;\n    }\n\n    return r;\n}\n//}}}\n\n//{{{void long_ll_free(struct long_ll **ll)\n//void long_ll_free(struct long_ll **ll)\nvoid long_ll_free(void **_ll)\n{\n    struct long_ll **ll = (struct long_ll **)_ll;\n    struct long_ll_node *curr, *tmp;\n\n    if (*ll != NULL) {\n        curr = (*ll)->head;\n        while (curr != NULL) {\n            tmp = curr->next;\n            free(curr);\n            curr = tmp;\n        }\n\n        free(*ll);\n        *ll = NULL;\n    }\n}\n//}}}\n\n//{{{void long_uint_ll_append(struct long_uint_ll **ll, long long_val, uint64_t\nvoid long_uint_ll_append(struct long_uint_ll **ll, long long_val, uint64_t uint_val)\n{\n#if GIGGLE_QUERY_TRACE\n    fprintf(stderr,\n            \"long_uint_ll_append\\tlong_val:%lu\\tuint_val:%llu\\n\",\n            long_val,\n            uint_val);\n#endif\n    struct long_uint_ll_node *n = (struct long_uint_ll_node *)\n        malloc(sizeof(struct long_uint_ll_node));\n#if GIGGLE_QUERY_TRACE\n    fprintf(stderr,\n            \"long_uint_ll_append\\tn:%p\\n\",\n            n);\n#endif\n    if (n == NULL)\n        err(1, \"malloc error in long_uint_ll_append().\\n\");\n\n    n->long_val = long_val;\n    n->uint_val = uint_val;\n    n->next = NULL;\n\n    if (*ll == NULL) {\n        *ll = (struct long_uint_ll *)malloc(sizeof(struct long_uint_ll));\n        if (*ll == NULL)\n            err(1, \"malloc error in long_uint_ll_append().\\n\");\n        (*ll)->head = n;\n        (*ll)->len = 1;\n    } else {\n        (*ll)->tail->next = n;\n        (*ll)->len = (*ll)->len + 1;\n    }\n\n    (*ll)->tail = n;\n}\n//}}}\n\n//{{{void long_uint_ll_free(struct long_ll **ll)\nvoid long_uint_ll_free(void **_ll)\n{\n    struct long_uint_ll **ll = (struct long_uint_ll **)_ll;\n    struct long_uint_ll_node *curr, *tmp;\n\n    if (*ll != NULL) {\n        curr = (*ll)->head;\n        while (curr != NULL) {\n            tmp = curr->next;\n            free(curr);\n            curr = tmp;\n        }\n\n        free(*ll);\n        *ll = NULL;\n    }\n}\n//}}}\n"
  },
  {
    "path": "src/ll.h",
    "content": "#ifndef __LL_H__\n#define __LL_H__\n\n#include \"giggle_index.h\"\n\nstruct uint64_t_ll_bpt_non_leading_data\n{\n    struct uint64_t_ll *SA, *SE;\n};\n\nstruct uint64_t_ll_bpt_leading_data\n{\n    struct uint64_t_ll *B;\n};\n\nstruct uint64_t_ll_node\n{\n    uint64_t val;\n    struct uint64_t_ll_node *next;\n};\n\nstruct uint64_t_ll\n{\n    uint64_t len;\n    struct uint64_t_ll_node *head, *tail;\n};\n\n\nvoid uint64_t_ll_append(struct uint64_t_ll **ll, uint64_t val);\nvoid uint64_t_ll_uniq_append(struct uint64_t_ll **ll, uint64_t val);\nvoid uint64_t_ll_remove(struct uint64_t_ll **ll, uint64_t val);\nuint64_t uint64_t_ll_contains(struct uint64_t_ll *ll, uint64_t val);\nvoid uint64_t_ll_free(void **ll);\n\nstruct long_ll_node\n{\n    long val;\n    struct long_ll_node *next;\n};\n\nstruct long_ll\n{\n    uint64_t len;\n    struct long_ll_node *head, *tail;\n};\n\nvoid long_ll_append(struct long_ll **ll, long val);\nvoid long_ll_uniq_append(struct long_ll **ll, long val);\nvoid long_ll_remove(struct long_ll **ll, long val);\nuint64_t long_ll_contains(struct long_ll *ll, long val);\nvoid long_ll_free(void **ll);\n\nstruct long_uint_ll_node\n{\n    long long_val;\n    uint64_t uint_val;\n    struct long_uint_ll_node *next;\n};\n\nstruct long_uint_ll\n{\n    uint64_t len;\n    struct long_uint_ll_node *head, *tail;\n};\n\nvoid long_uint_ll_append(struct long_uint_ll **ll, long long_val, uint64_t uint_val);\nvoid long_uint_ll_uniq_append(struct long_uint_ll **ll, long val);\nvoid long_uint_ll_remove(struct long_uint_ll **ll, long val);\nuint64_t long_uint_ll_contains(struct long_uint_ll *ll, long val);\nvoid long_uint_ll_free(void **ll);\n\n\n\n// bpt_node_repair :: uint64_t_ll_leading_repair\nvoid uint64_t_ll_leading_repair(uint32_t domain,\n                                struct bpt_node *a,\n                                struct bpt_node *b);\n\n// giggle_data_handler :: int64_t_ll_giggle_data_handler\nvoid *uint64_t_ll_new_non_leading(uint32_t domain);\nvoid *uint64_t_ll_new_leading(uint32_t domain);\nvoid uint64_t_ll_non_leading_SA_add_scalar(uint32_t domain,\n                                           void *_nld,\n                                           void *_id);\nvoid uint64_t_ll_non_leading_SE_add_scalar(uint32_t domain,\n                                           void *_nld,\n                                           void *_id);\nvoid uint64_t_ll_leading_B_add_scalar(uint32_t domain,\n                                      void *_ld,\n                                      void *_id);\nvoid uint64_t_ll_leading_union_with_B(uint32_t domain,\n                                      void **R,\n                                      void *leading);\nvoid uint64_t_ll_non_leading_union_with_SA_subtract_SE(uint32_t domain,\n                                                       void **R,\n                                                       void *d);\nvoid uint64_t_ll_non_leading_union_with_SA(uint32_t domain, void **R, void *d);\n\nstruct giggle_def uint64_t_ll_giggle_data_handler;\n\n// cache_handler :: uint64_t_ll_non_leading_cache_handler\nuint64_t uint64_t_ll_non_leading_serialize(void *deserialized,\n                                           void **serialized);\nuint64_t uint64_t_ll_non_leading_deserialize(void *serialized,\n                                             uint64_t serialized_size,\n                                             void **deserialized);\nvoid uint64_t_ll_non_leading_free(void **deserialized);\nstruct cache_handler uint64_t_ll_non_leading_cache_handler;\n\n// cache_handler :: uint64_t_ll_leading_cache_handler\nuint64_t uint64_t_ll_leading_serialize(void *deserialized,\n                                       void **serialized);\nuint64_t uint64_t_ll_leading_deserialize(void *serialized,\n                                         uint64_t serialized_size,\n                                         void **deserialized);\nvoid uint64_t_ll_leading_free(void **deserialized);\nstruct cache_handler uint64_t_ll_leading_cache_handler;\n\nvoid uint64_t_ll_giggle_set_data_handler();\n\nstruct cache_handler uint64_t_ll_wah_leading_cache_handler;\nvoid uint64_t_ll_wah_giggle_set_data_handler();\nstruct cache_handler uint64_t_ll_wah_non_leading_cache_handler;\nuint64_t uint64_t_ll_leading_serialize_to_wah(void *deserialized,\n                                              void **serialized);\n\nuint64_t uint64_t_ll_non_leading_serialize_to_wah(void *deserialized,\n                                                  void **serialized);\n\nvoid uint64_t_ll_map_intersection_to_offset_list(struct giggle_index *gi,\n                                                 struct giggle_query_result *gqr,\n                                                 void *_R);\n\n#endif\n"
  },
  {
    "path": "src/metadata/Makefile",
    "content": "HTS_ROOT=../../lib/htslib\n\nmetadata:\n\tgcc ../metadata_index.c ../query_filter.c metadata_test.c -I$(HTS_ROOT) $(HTS_ROOT)/libhts.a -o bin/metadata_test -g && bin/metadata_test\n\nmetadata-mem:\n\tvalgrind --leak-check=full --show-leak-kinds=all bin/metadata_test\n"
  },
  {
    "path": "src/metadata/intervals1.tsv",
    "content": "100\t200\t100\t1.25\t1\tabc\t+\n200\t230\t30\t5\t0\tdefg\t*\n250\t300\t50\t0.03125\t0\thijklmnop\t+\n300\t500\t200\t456.5\t1\tqrstuvwxyzabcdef\t-\n"
  },
  {
    "path": "src/metadata/intervals2.tsv",
    "content": "400\t500\t100\t5.25\t0\tqwe\t+\n500\t530\t30\t65\t1\tyui\t/\n600\t800\t20\t0.140625\t0\tbnm\t-\n800\t900\t100\t3\t1\tfgh\t+\n"
  },
  {
    "path": "src/metadata/metadata.conf",
    "content": "3 interval_length int_32\n5 is_important int_8\n6 feature string 10\n4 score double\n7 strand char\n"
  },
  {
    "path": "src/metadata/metadata_test.c",
    "content": "#include <stdio.h>\n#include \"../metadata_index.h\"\n#include \"../query_filter.h\"\n\nvoid check_file_read(char *file_name, FILE *fp, size_t exp, size_t obs)\n{\n    if (exp != obs) {\n        if (feof(fp))\n            errx(EX_IOERR,\n                 \"Error reading file \\\"%s\\\": End of file\",\n                 file_name);\n        err(EX_IOERR, \"Error reading file \\\"%s\\\"\", file_name);\n    }\n}\n\nvoid metadata_index_add_all_intervals_from_file(struct metadata_index *metadata_index, uint32_t file_id, char *intervals_filename) {\n  FILE *intervals = fopen(intervals_filename, \"r\");\n  if (intervals == NULL) {\n    err(1, \"%s not found.\\n\", intervals_filename);\n  }\n  \n  char * line = NULL;\n  size_t len = 0;\n  ssize_t read;\n\n  while ((read = getline(&line, &len, intervals)) != -1) {\n    // printf(\"Retrieved line of length %zu:\\n%s\\n\", read, line);\n    kstring_t kline = {0, 0, NULL};\n    kputs(line, &kline);\n    metadata_index_add(metadata_index, file_id, &kline);\n    free(kline.s);\n  }\n\n  if (line)\n    free(line);\n\n  fclose(intervals);\n}\n\nint main(void) {\n  char *metadata_conf_filename = \"metadata.conf\";\n  char *metadata_index_filename = \"metadata_index.dat\";\n\n  // A. Index\n\n  // 1. metadata_index_init\n  struct metadata_index *metadata_index = metadata_index_init(metadata_conf_filename, metadata_index_filename);\n  printf(\"\\nInitialized Metadata Index in %s\\n\", metadata_index_filename);\n  print_metadata_index(metadata_index);\n\n  // 2. metadata_index_add \n  char *intervals_filename1 = \"intervals1.tsv\";\n  uint32_t file_id1 = 5; \n  metadata_index_add_all_intervals_from_file(metadata_index, file_id1, intervals_filename1);\n  printf(\"\\nAppended Metadata from %s to %s\\n\", intervals_filename1, metadata_index_filename);\n  \n  // 3. metadata_index_store\n  metadata_index_store(metadata_index);\n  printf(\"\\nStored Metadata Index in %s\\n\", metadata_index_filename);\n\n  int RELOAD_INDEX = 1;\n  if (RELOAD_INDEX) {\n    // 4. metadata_index_destroy\n    metadata_index_destroy(&metadata_index);\n    printf(\"\\nDestroyed Metadata Index\\n\");\n\n    // B. Search\n\n    // 1. metadata_index_load\n    metadata_index = metadata_index_load(metadata_index_filename);\n    printf(\"\\nLoaded Metadata Index from %s\\n\", metadata_index_filename);\n    print_metadata_index(metadata_index);\n  }\n  \n  // 2.i. Read metadata rows from metadata_index.dat\n  struct metadata_rows *metadata_rows = read_metadata_rows(metadata_index);\n  printf(\"\\nRead metadata_rows from %s\\n\", metadata_index_filename);\n  print_metadata_rows(metadata_rows);\n\n  // 2.ii. Read ith metadata_row\n  struct metadata_row *metadata_row_1 = read_metadata_row(metadata_index, 1);\n  struct metadata_row *metadata_row_3 = read_metadata_row(metadata_index, 3);\n  printf(\"\\nRead metadata_rows 1 and 3 from %s\\n\", metadata_index_filename);\n  printf(\"metadata_row 1 => \");\n  print_metadata_row(metadata_row_1);  \n  printf(\"metadata_row 3 => \");\n  print_metadata_row(metadata_row_3);\n\n  // 2.iii. Read ith interval's jth metadata column from metadata_index.dat\n  struct metadata_item *metadata_row_0_col_2 = read_metadata_item_by_column_id(metadata_index, 0, 2);\n  struct metadata_item *metadata_row_2_score = read_metadata_item_by_column_name(metadata_index, 2, \"score\");\n  printf(\"\\nRead metadata_items metadata_row_0_col_2 and metadata_row_2_score from %s\\n\", metadata_index_filename);\n  printf(\"metadata_row_0_col_2 => \");\n  print_metadata_item(metadata_row_0_col_2);  \n  printf(\"\\n\");\n  printf(\"metadata_row_2_score => \");\n  print_metadata_item(metadata_row_2_score);\n  printf(\"\\n\");\n\n  // 4. Read query filter\n  char *query_filter_string_1 = \"feature<my_feature\";\n  char *query_filter_string_2 = \"score>=456.5\";\n  struct query_filter *query_filter_1 = parse_query_filter_string(metadata_index, query_filter_string_1);\n  struct query_filter *query_filter_2 = parse_query_filter_string(metadata_index, query_filter_string_2);\n  printf(\"\\nParsed query filter string: %s\\n\", query_filter_string_1);\n  print_query_filter(query_filter_1);\n  printf(\"\\nParsed query filter string: %s\\n\", query_filter_string_2);\n  print_query_filter(query_filter_2);\n\n  // 5.i. Filter rows using query filters\n  int row_1_filter_1 = filter_metadata_row_by_row(metadata_row_1, query_filter_1);\n  int row_1_filter_2 = filter_metadata_row_by_row(metadata_row_1, query_filter_2);\n  int row_3_filter_1 = filter_metadata_row_by_row(metadata_row_3, query_filter_1);\n  int row_3_filter_2 = filter_metadata_row_by_row(metadata_row_3, query_filter_2);\n  printf(\"\\nFiltered rows using query filters\\n\");\n  printf(\"row_1_filter_1: %d, row_1_filter_2: %d\\n\", row_1_filter_1, row_1_filter_2);\n  printf(\"row_3_filter_1: %d, row_3_filter_2: %d\\n\", row_3_filter_1, row_3_filter_2);\n\n  // 5.ii. Filter items using query filters\n  int row_0_col_2 = filter_metadata_row_by_item(metadata_row_0_col_2, query_filter_1);\n  int row_2_score = filter_metadata_row_by_item(metadata_row_2_score, query_filter_2);\n  printf(\"\\nFiltered items using query filters\\n\");\n  printf(\"row_0_col_2: %d\\n\", row_0_col_2);\n  printf(\"row_2_score: %d\\n\", row_2_score);\n\n  // 6. metadata_index_destroy\n  metadata_index_destroy(&metadata_index);\n  query_filter_destroy(&query_filter_1);\n  query_filter_destroy(&query_filter_2);\n  metadata_item_destroy(metadata_row_0_col_2);\n  metadata_item_destroy(metadata_row_2_score);\n  metadata_row_destroy(metadata_row_1);\n  metadata_row_destroy(metadata_row_3);\n  metadata_rows_destroy(metadata_rows);\n\n  return 0;\n}\n"
  },
  {
    "path": "src/metadata_index.c",
    "content": "#define _GNU_SOURCE\n\n#include <string.h>\n#include <stdlib.h>\n#include <htslib/khash_str2int.h>\n#include \"util.h\"\n#include \"metadata_index.h\"\n\nchar *METADATA_INDEX_FILE_NAME = \"metadata_index.dat\";\n\nenum data_type data_type_string_to_enum(char type_string[8]) {\n  enum data_type type;\n  for(int i = 0; type_string[i]; ++i){\n    type_string[i] = toupper(type_string[i]);\n  }\n  if (strcmp(type_string, \"CHAR\") == 0) type = CHAR;\n  else if (strcmp(type_string, \"INT_8\") == 0) type = INT_8;\n  else if (strcmp(type_string, \"INT_16\") == 0) type = INT_16;\n  else if (strcmp(type_string, \"INT_32\") == 0) type = INT_32;\n  else if (strcmp(type_string, \"INT_64\") == 0) type = INT_64;\n  else if (strcmp(type_string, \"FLOAT\") == 0) type = FLOAT;\n  else if (strcmp(type_string, \"DOUBLE\") == 0) type = DOUBLE;\n  else if (strcmp(type_string, \"STRING\") == 0) type = STRING;\n  else {\n    err(1, \"Invalid data type %s.\\n\", type_string);\n  }\n  return type;\n}\n\nchar data_type_enum_to_char(enum data_type type) {\n  char type_char = 0;\n  switch (type) {\n    case CHAR: \n      type_char = 'c';\n      break;\n    case INT_8: \n      type_char = 'b';\n      break;\n    case INT_16: \n      type_char = 'h';\n      break;\n    case INT_32: \n      type_char = 'i';\n      break;\n    case INT_64: \n      type_char = 'l';\n      break;\n    case FLOAT: \n      type_char = 'f';\n      break;\n    case DOUBLE: \n      type_char = 'd';\n      break;\n    case STRING: \n      type_char = 's';\n      break;\n    default:\n      err(1, \"Unknown data_type %d.\\n\", type);\n  }\n  return type_char;\n}\n\nenum data_type data_type_char_to_enum(char type_char) {\n  enum data_type type;\n  switch (type_char) {\n    case 'c': \n      type = CHAR;\n      break;\n    case 'b': \n      type = INT_8;\n      break;\n    case 'h': \n      type = INT_16;\n      break;\n    case 'i': \n      type = INT_32;\n      break;\n    case 'l': \n      type = INT_64;\n      break;\n    case 'f': \n      type = FLOAT;\n      break;\n    case 'd': \n      type = DOUBLE;\n      break;\n    case 's': \n      type = STRING;\n      break;\n    default:\n      err(1, \"Unknown type_char %c.\\n\", type_char);\n  }\n  return type;\n}\n\nuint8_t get_width_of_data_type(enum data_type type) {\n  uint8_t width = 0;\n  switch (type) {\n    case CHAR: \n      width = sizeof(char);\n      break;\n    case INT_8: \n      width = sizeof(int8_t);\n      break;\n    case INT_16: \n      width = sizeof(int16_t);\n      break;\n    case INT_32: \n      width = sizeof(int32_t);\n      break;\n    case INT_64: \n      width = sizeof(int64_t);\n      break;\n    case FLOAT: \n      width = sizeof(float);\n      break;\n    case DOUBLE: \n      width = sizeof(double);\n      break;\n    case STRING: \n      break;\n    default:\n      err(1, \"Unknown data_type %d.\\n\", type);\n  }\n  return width;\n}\n\n// this function is not responsible for\n// freeing the allocated memory for the string\nchar *safe_sscanf(uint8_t str_width, char *data) {\n  char s_format[6]; // '%' + max value for int8_t + 's' + NULL -> '%255sN'\n  char *s;\n  snprintf(s_format, sizeof(s_format), \"%%%ds\", str_width - 1);\n  s = (char *)calloc(str_width, sizeof(char));\n  if (s == NULL) {\n    err(1, \"calloc failure for s in safe_sscanf.\\n\");\n  }\n  sscanf(data, s_format, s);\n  return s;\n}\n\nvoid fwrite_data_type_item(FILE *metadata_index_fp, struct metadata_type *metadata_type, char *data) {\n  enum data_type type = metadata_type->data_type;\n  char c;\n  int8_t b;\n  int16_t h;\n  int32_t i;\n  int64_t l;\n  float f;\n  double d;\n  char *s;\n  uint8_t str_width;\n\n  switch (type) {\n    case CHAR: \n      c = *data;\n      if (fwrite(&c, sizeof(char), 1, metadata_index_fp) != 1) {\n        err(1, \"fwrite failure for CHAR in fwrite_data_type_item.\\n\");\n      }\n      break;\n\n    case INT_8: \n      b = atoi(data);\n      if (fwrite(&b, sizeof(int8_t), 1, metadata_index_fp) != 1) {\n        err(1, \"fwrite failure for INT_8 in fwrite_data_type_item.\\n\");\n      }\n      break;\n      \n    case INT_16: \n      h = atoi(data);\n      if (fwrite(&h, sizeof(int16_t), 1, metadata_index_fp) != 1) {\n        err(1, \"fwrite failure for INT_16 in fwrite_data_type_item.\\n\");\n      }\n      break;\n      \n    case INT_32: \n      i = atol(data);\n      if (fwrite(&i, sizeof(int32_t), 1, metadata_index_fp) != 1) {\n        err(1, \"fwrite failure for INT_32 in fwrite_data_type_item.\\n\");\n      }\n      break;\n      \n    case INT_64: \n      l = atoll(data);\n      if (fwrite(&l, sizeof(int64_t), 1, metadata_index_fp) != 1) {\n        err(1, \"fwrite failure for INT_64 in fwrite_data_type_item.\\n\");\n      }\n      break;\n      \n    case FLOAT: \n      f = atof(data);\n      if (fwrite(&f, sizeof(float), 1, metadata_index_fp) != 1) {\n        err(1, \"fwrite failure for FLOAT in fwrite_data_type_item.\\n\");\n      }\n      break;\n      \n    case DOUBLE: \n      d = atof(data);\n      if (fwrite(&d, sizeof(double), 1, metadata_index_fp) != 1) {\n        err(1, \"fwrite failure for DOUBLE in fwrite_data_type_item.\\n\");\n      }\n      break;\n      \n    case STRING: \n      str_width = metadata_type->width;\n      s = safe_sscanf(str_width, data);\n      if (fwrite(s, sizeof(char), str_width, metadata_index_fp) != str_width) {\n        err(1, \"fwrite failure for STRING in fwrite_data_type_item.\\n\");\n      }\n      free(s);\n      break;\n      \n    default:\n      err(1, \"Unknown data_type %d.\\n\", type);\n  }\n}\n\nvoid fread_data_type_item(char *metadata_index_filename, FILE *metadata_index_fp, struct metadata_item *metadata_item) {\n  struct metadata_type *metadata_type = metadata_item->type;\n  enum data_type type = metadata_type->data_type;\n  uint8_t str_width;\n  char *s;\n  size_t fr;\n\n  switch (type) {\n    case CHAR: \n      fr = fread(&(metadata_item->data.c), sizeof(char), 1, metadata_index_fp);\n      check_file_read(metadata_index_filename, metadata_index_fp, 1, fr);\n      break;\n\n    case INT_8: \n      fr = fread(&(metadata_item->data.b), sizeof(int8_t), 1, metadata_index_fp);\n      check_file_read(metadata_index_filename, metadata_index_fp, 1, fr);\n      break;\n      \n    case INT_16: \n      fr = fread(&(metadata_item->data.h), sizeof(int16_t), 1, metadata_index_fp);\n      check_file_read(metadata_index_filename, metadata_index_fp, 1, fr);\n      break;\n      \n    case INT_32: \n      fr = fread(&(metadata_item->data.i), sizeof(int32_t), 1, metadata_index_fp);\n      check_file_read(metadata_index_filename, metadata_index_fp, 1, fr);\n      break;\n      \n    case INT_64: \n      fr = fread(&(metadata_item->data.l), sizeof(int64_t), 1, metadata_index_fp);\n      check_file_read(metadata_index_filename, metadata_index_fp, 1, fr);\n      break;\n      \n    case FLOAT: \n      fr = fread(&(metadata_item->data.f), sizeof(float), 1, metadata_index_fp);\n      check_file_read(metadata_index_filename, metadata_index_fp, 1, fr);\n      break;\n      \n    case DOUBLE: \n      fr = fread(&(metadata_item->data.d), sizeof(double), 1, metadata_index_fp);\n      check_file_read(metadata_index_filename, metadata_index_fp, 1, fr);\n      break;\n      \n    case STRING: \n      str_width = metadata_type->width;\n      s = (char *)malloc(str_width * sizeof(char));\n      if (s == NULL) {\n        err(1, \"malloc failure for s in fwrite_data_type_item.\\n\");\n      }\n      fr = fread(s, sizeof(char), str_width, metadata_index_fp);\n      check_file_read(metadata_index_filename, metadata_index_fp, str_width, fr);\n      metadata_item->data.s = s;\n      break;\n      \n    default:\n      err(1, \"Unknown data_type %d.\\n\", type);\n  }\n}\n\nstruct metadata_index *metadata_index_new() {\n  struct metadata_index *metadata_index = (struct metadata_index *)malloc(sizeof(struct metadata_index));\n  if (metadata_index == NULL) {\n    err(1, \"malloc failure for metadata_index in metadata_index_new.\\n\");\n  }\n\n  metadata_index->columns = NULL;\n  metadata_index->metadata_index_filename = NULL;\n  metadata_index->metadata_index_fp = NULL;\n  metadata_index->column_name_to_index = NULL;\n  metadata_index->col_offsets = NULL;\n  metadata_index->types = NULL;\n\n  metadata_index->num_cols = -1;\n  metadata_index->row_width = -1;\n  metadata_index->num_rows = -1;\n  metadata_index->header_offset = -1;\n\n  return metadata_index;\n}\n\nvoid read_metadata_conf(struct metadata_index *metadata_index, char *metadata_conf_filename) {\n  FILE *metadata_conf_fp = fopen(metadata_conf_filename, \"r\");\n  if (metadata_conf_fp == NULL) {\n    err(1, \"%s not found.\\n\", metadata_conf_filename);\n  }\n\n  uint8_t num_cols = 0;\n  uint16_t col_offset = 0;\n\n  metadata_index->types = (struct metadata_type **)malloc(255 * sizeof(struct metadata_type*));\n  if (metadata_index->types == NULL) {\n    err(1, \"malloc failure for metadata_index->types in read_metadata_conf.\\n\");\n  }\n  metadata_index->columns = (uint8_t *)malloc(255 * sizeof(uint8_t));\n  if (metadata_index->columns == NULL) {\n    err(1, \"malloc failure for metadata_index->columns in read_metadata_conf.\\n\");\n  }\n  metadata_index->col_offsets = (uint16_t *)malloc(255 * sizeof(uint16_t));\n  if (metadata_index->col_offsets == NULL) {\n    err(1, \"malloc failure for metadata_index->col_offsets in read_metadata_conf.\\n\");\n  }\n\n  metadata_index->column_name_to_index = khash_str2int_init();\n\n  char * line = NULL;\n  size_t len = 0;\n  ssize_t read;\n\n  while ((read = getline(&line, &len, metadata_conf_fp)) != -1) {\n    // printf(\"Retrieved line of length %zu:\\n%s\\n\", read, line);\n\n    uint8_t column;\n    char name[COLUMN_NAME_MAX_LENGTH] = {0};\n    char type_string[8];\n    uint8_t str_len = 0;\n\n    // 31 in %31s = COLUMN_NAME_MAX_LENGTH - 1\n    sscanf(line, \"%hhu %31s %7s %hhu\", &column, name, type_string, &str_len); \n    // printf(\"%d %s %s %d\\n\", column, name, type_string, str_len);\n\n    if (num_cols == 255) {\n      err(1, \"Cannot store more than 255 columns.\\n\");\n    }\n    \n    if (str_len == 255) {\n      err(1, \"Column '%s': string length cannot be more than 254.\\n\", name);\n    }\n\n    if (khash_str2int_has_key(metadata_index->column_name_to_index, name)) {\n      err(1, \"Cannot allow duplicate column '%s'.\\n\", name);\n    } else {\n      khash_str2int_set(metadata_index->column_name_to_index, strdup(name), num_cols);\n    }\n\n    struct metadata_type *metadata_type = (struct metadata_type *)calloc(1, sizeof(struct metadata_type));\n    if (metadata_type == NULL) {\n      err(1, \"calloc failure for metadata_type in read_metadata_conf.\\n\");\n    }\n\n    memcpy(metadata_type->name, name, COLUMN_NAME_MAX_LENGTH);\n    metadata_type->data_type = data_type_string_to_enum(type_string);\n    metadata_type->width += get_width_of_data_type(metadata_type->data_type);\n    if (metadata_type->data_type == STRING) {\n      metadata_type->width = str_len + 1;\n    }\n\n    metadata_index->col_offsets[num_cols] = col_offset;\n    col_offset += metadata_type->width;\n\n    metadata_index->types[num_cols] = metadata_type;\n    metadata_index->columns[num_cols] = column;\n    num_cols++;\n  }\n\n  if (num_cols < 255) {\n    metadata_index->types = (struct metadata_type **)realloc(metadata_index->types, sizeof(struct metadata_type*) * num_cols);\n    if (metadata_index->types == NULL) {\n      err(1, \"realloc failure for metadata_index->types in read_metadata_conf.\\n\");\n    }\n    metadata_index->columns = (uint8_t *)realloc(metadata_index->columns, sizeof(uint8_t) * num_cols);\n    if (metadata_index->columns == NULL) {\n      err(1, \"realloc failure for metadata_index->columns in read_metadata_conf.\\n\");\n    }\n    metadata_index->col_offsets = (uint16_t *)realloc(metadata_index->col_offsets, sizeof(uint16_t) * num_cols);\n    if (metadata_index->col_offsets == NULL) {\n      err(1, \"realloc failure for metadata_index->col_offsets in read_metadata_conf.\\n\");\n    }\n  }\n\n  metadata_index->num_cols = num_cols;\n  metadata_index->row_width = col_offset;\n\n  if (line)\n    free(line);\n\n  fclose(metadata_conf_fp);\n}\n\nvoid write_metadata_index_header(struct metadata_index *metadata_index) {\n  FILE *metadata_index_fp = metadata_index->metadata_index_fp;\n  \n  int i;\n  char extra[GIGGLE_METADATA_EXTRA_LENGTH] = {0};\n\n  if (fwrite(GIGGLE_METADATA_FILE_MARKER, sizeof(char), GIGGLE_METADATA_FILE_MARKER_LENGTH, metadata_index_fp) != GIGGLE_METADATA_FILE_MARKER_LENGTH) {\n    err(1, \"fwrite failure for file marker in write_metadata_index_header.\\n\");\n  }\n\n  if (fwrite(GIGGLE_METADATA_VERSION_MARKER, sizeof(char), GIGGLE_METADATA_VERSION_MARKER_LENGTH, metadata_index_fp) != GIGGLE_METADATA_VERSION_MARKER_LENGTH) {\n    err(1, \"fwrite failure for version marker in write_metadata_index_header.\\n\");\n  }\n\n  if (fwrite(extra, sizeof(char), GIGGLE_METADATA_EXTRA_LENGTH, metadata_index_fp) != GIGGLE_METADATA_EXTRA_LENGTH) {\n    err(1, \"fwrite failure for extra in write_metadata_index_header.\\n\");\n  }\n\n  if (fwrite(&(metadata_index->num_cols), sizeof(uint8_t), 1, metadata_index_fp) != 1) {\n    err(1, \"fwrite failure for metadata_index->num_cols in write_metadata_index_header.\\n\");\n  }\n\n  if (fwrite(&(metadata_index->row_width), sizeof(uint16_t), 1, metadata_index_fp) != 1) {\n    err(1, \"fwrite failure for metadata_index->row_width in write_metadata_index_header.\\n\");\n  }\n\n  for (i = 0; i < metadata_index->num_cols; ++i) {\n    struct metadata_type *metadata_type = metadata_index->types[i];\n    \n    char type_char = data_type_enum_to_char(metadata_type->data_type);\n    if (fwrite(&type_char, sizeof(char), 1, metadata_index_fp) != 1) {\n      err(1, \"fwrite failure for type_char in write_metadata_index_header.\\n\");\n    }\n\n    if (fwrite(&(metadata_type->width), sizeof(uint8_t), 1, metadata_index_fp) != 1) {\n      err(1, \"fwrite failure for metadata_type->width in write_metadata_index_header.\\n\");\n    }\n\n    if (fwrite(metadata_type->name, sizeof(char), COLUMN_NAME_MAX_LENGTH, metadata_index_fp) != COLUMN_NAME_MAX_LENGTH) {\n      err(1, \"fwrite failure for metadata_type->name in write_metadata_index_header.\\n\");\n    }\n  }\n\n  if (fwrite(&(metadata_index->num_rows), sizeof(uint64_t), 1, metadata_index_fp) != 1) {\n    err(1, \"fwrite failure for num_rows in write_metadata_index_header.\\n\");\n  }\n\n  metadata_index->header_offset = ftell(metadata_index_fp);\n}\n\nvoid read_metadata_index_header(struct metadata_index *metadata_index) {  \n  char *metadata_index_filename = metadata_index->metadata_index_filename;\n  FILE *metadata_index_fp = metadata_index->metadata_index_fp;\n\n  int i;\n  size_t fr;\n  char file_marker[GIGGLE_METADATA_FILE_MARKER_LENGTH + 1];\n  char version_marker[GIGGLE_METADATA_VERSION_MARKER_LENGTH + 1];\n  char extra[GIGGLE_METADATA_EXTRA_LENGTH] = {0};\n  uint16_t col_offset = 0;\n\n  metadata_index->column_name_to_index = khash_str2int_init();\n\n  fr = fread(file_marker, sizeof(char), GIGGLE_METADATA_FILE_MARKER_LENGTH, metadata_index_fp);\n  check_file_read(metadata_index_filename, metadata_index_fp, GIGGLE_METADATA_FILE_MARKER_LENGTH, fr);\n  file_marker[GIGGLE_METADATA_FILE_MARKER_LENGTH] = '\\0';\n  if (strcmp(file_marker, GIGGLE_METADATA_FILE_MARKER) != 0) {\n    err(1, \"Not a GIGGLE Metadata Index file.\\n\");\n  }\n\n  fr = fread(version_marker, sizeof(char), GIGGLE_METADATA_VERSION_MARKER_LENGTH, metadata_index_fp);\n  check_file_read(metadata_index_filename, metadata_index_fp, GIGGLE_METADATA_VERSION_MARKER_LENGTH, fr);\n  version_marker[GIGGLE_METADATA_VERSION_MARKER_LENGTH] = '\\0';\n  if (strcmp(version_marker, GIGGLE_METADATA_VERSION_MARKER) != 0) {\n    err(1, \"Incompatible GIGGLE Metadata Index version.\\n\");\n  }\n  \n  fr = fread(extra, sizeof(char), GIGGLE_METADATA_EXTRA_LENGTH, metadata_index_fp);\n  check_file_read(metadata_index_filename, metadata_index_fp, GIGGLE_METADATA_EXTRA_LENGTH, fr);\n\n  fr = fread(&(metadata_index->num_cols), sizeof(uint8_t), 1, metadata_index_fp);\n  check_file_read(metadata_index_filename, metadata_index_fp, 1, fr);\n  \n  fr = fread(&(metadata_index->row_width), sizeof(uint16_t), 1, metadata_index_fp);\n  check_file_read(metadata_index_filename, metadata_index_fp, 1, fr);\n\n  metadata_index->col_offsets = (uint16_t *)malloc(metadata_index->num_cols * sizeof(uint16_t));\n  if (metadata_index->col_offsets == NULL) {\n    err(1, \"malloc failure for metadata_index->col_offsets in read_metadata_index_header.\\n\");\n  }\n  \n  metadata_index->types = (struct metadata_type **)malloc(metadata_index->num_cols * sizeof(struct metadata_type*));\n  if (metadata_index->types == NULL) {\n    err(1, \"malloc failure for metadata_index->types in read_metadata_index_header.\\n\");\n  }\n\n  for (i = 0; i < metadata_index->num_cols; ++i) {\n    struct metadata_type *metadata_type = (struct metadata_type *)calloc(1, sizeof(struct metadata_type));\n    if (metadata_type == NULL) {\n      err(1, \"calloc failure for metadata_type in read_metadata_index_header.\\n\");\n    }\n\n    char type_char;\n    fr = fread(&type_char, sizeof(char), 1, metadata_index_fp);\n    check_file_read(metadata_index_filename, metadata_index_fp, 1, fr);\n    metadata_type->data_type = data_type_char_to_enum(type_char);\n\n    fr = fread(&(metadata_type->width), sizeof(uint8_t), 1, metadata_index_fp);\n    check_file_read(metadata_index_filename, metadata_index_fp, 1, fr);\n\n    fr = fread(&(metadata_type->name), sizeof(char), COLUMN_NAME_MAX_LENGTH, metadata_index_fp);\n    check_file_read(metadata_index_filename, metadata_index_fp, COLUMN_NAME_MAX_LENGTH, fr);\n\n    khash_str2int_set(metadata_index->column_name_to_index, strdup(metadata_type->name), i);\n\n    metadata_index->col_offsets[i] = col_offset;\n    col_offset += metadata_type->width;\n\n    metadata_index->types[i] = metadata_type;\n  }\n  \n  fr = fread(&(metadata_index->num_rows), sizeof(uint64_t), 1, metadata_index_fp);\n  check_file_read(metadata_index_filename, metadata_index_fp, 1, fr);\n\n  metadata_index->header_offset = ftell(metadata_index_fp);\n}\n\nstruct metadata_index *metadata_index_init(char *metadata_conf_filename, char *metadata_index_filename) {\n  if (metadata_conf_filename == NULL) {\n    err(1, \"metadata_conf_filename cannot be NULL.\\n\");\n  }\n  if (metadata_index_filename == NULL) {\n    err(1, \"metadata_index_filename cannot be NULL.\\n\");\n  }\n\n  struct metadata_index *metadata_index = metadata_index_new();\n  metadata_index->metadata_index_filename = strdup(metadata_index_filename);\n\n  metadata_index->num_rows = 0;\n\n  // Read metadata.conf\n  read_metadata_conf(metadata_index, metadata_conf_filename);\n\n  FILE *metadata_index_fp = fopen(metadata_index_filename, \"wb+\");\n  if (metadata_index_fp == NULL) {\n    err(1, \"%s not found.\\n\", metadata_index_filename);\n  }\n  metadata_index->metadata_index_fp = metadata_index_fp;\n\n  // Write header in metadata_index.dat\n  write_metadata_index_header(metadata_index);\n\n  return metadata_index;\n}\n\nuint64_t metadata_index_add(struct metadata_index *metadata_index, uint32_t file_id, kstring_t *line) {\n  uint8_t *columns = metadata_index->columns;\n  FILE *metadata_index_fp = metadata_index->metadata_index_fp;\n  int fields_length;\n  int *fields;\n  fields = ksplit(line, '\\t', &fields_length);\n\n  // TODO: Write file_id before metadata columns\n\n  for (int i = 0; i < metadata_index->num_cols; ++i) {\n    struct metadata_type *metadata_type = metadata_index->types[i];\n    int column = columns[i];\n    char *data = line->s + fields[column - 1];\n    fwrite_data_type_item(metadata_index_fp, metadata_type, data);\n  }\n\n  free(fields);\n  return metadata_index->num_rows++;\n}\n\nvoid metadata_index_store(struct metadata_index *metadata_index) {\n  FILE *metadata_index_fp = metadata_index->metadata_index_fp;\n\n  uint64_t total_offset = metadata_index->header_offset - sizeof(uint64_t);\n\n  if (fseek(metadata_index_fp, total_offset, SEEK_SET) != 0) {\n    err(1, \"Could not seek to metadata start in '%s'.\", metadata_index->metadata_index_filename);\n  }\n\n  if (fwrite(&(metadata_index->num_rows), sizeof(uint64_t), 1, metadata_index_fp) != 1) {\n    err(1, \"fwrite failure for num_rows in metadata_index_store.\\n\");\n  }\n}\n\nstruct metadata_index *metadata_index_load(char *metadata_index_filename) {\n  if (metadata_index_filename == NULL) {\n    err(1, \"metadata_index_filename cannot be NULL.\\n\");\n  }\n  struct metadata_index *metadata_index = metadata_index_new();\n  metadata_index->metadata_index_filename = strdup(metadata_index_filename);\n\n  FILE *metadata_index_fp = fopen(metadata_index_filename, \"rb\");\n  if (metadata_index_fp == NULL) {\n    err(1, \"%s not found.\\n\", metadata_index_filename);\n  }\n  metadata_index->metadata_index_fp = metadata_index_fp;\n  \n  // Read header from metadata_index.dat\n  read_metadata_index_header(metadata_index);\n\n  return metadata_index;\n}\n\nstruct metadata_rows *read_metadata_rows(struct metadata_index *metadata_index) {\n  char *metadata_index_filename = metadata_index->metadata_index_filename;\n  FILE *metadata_index_fp = metadata_index->metadata_index_fp;\n  \n  if (fseek(metadata_index_fp, metadata_index->header_offset, SEEK_SET) != 0) {\n    err(1, \"Could not seek to metadata start in '%s'.\", metadata_index_filename);\n  }\n  \n  struct metadata_rows *metadata_rows = (struct metadata_rows *)malloc(sizeof(struct metadata_rows));\n  if (metadata_rows == NULL) {\n    err(1, \"malloc failure for metadata_rows in read_metadata_rows.\\n\");\n  }\n\n  metadata_rows->num = metadata_index->num_rows;\n\n  int i, j;\n\n  metadata_rows->rows = (struct metadata_row **)malloc(metadata_rows->num * sizeof(struct metadata_row*));\n  if (metadata_rows->rows == NULL) {\n    err(1, \"malloc failure for metadata_rows->rows in read_metadata_rows.\\n\");\n  }\n\n  for (i = 0; i < metadata_rows->num; ++i) {\n    struct metadata_row *metadata_row = (struct metadata_row *)malloc(sizeof(struct metadata_row));\n    if (metadata_row == NULL) {\n      err(1, \"malloc failure for metadata_row in read_metadata_rows.\\n\");\n    }\n\n    metadata_row->num = metadata_index->num_cols;\n    \n    metadata_row->items = (struct metadata_item **)malloc(metadata_row->num * sizeof(struct metadata_item*));\n    if (metadata_row->items == NULL) {\n      err(1, \"malloc failure for metadata_row->items in read_metadata_rows.\\n\");\n    }\n\n    for (j = 0; j < metadata_row->num; ++j) {\n      struct metadata_item *metadata_item = (struct metadata_item *)malloc(sizeof(struct metadata_item));\n      if (metadata_item == NULL) {\n        err(1, \"malloc failure for metadata_item in read_metadata_rows.\\n\");\n      }\n      metadata_item->type = metadata_index->types[j];\n\n      fread_data_type_item(metadata_index_filename, metadata_index_fp, metadata_item);\n\n      metadata_row->items[j] = metadata_item;\n    }\n\n    metadata_rows->rows[i] = metadata_row;\n  }\n\n  return metadata_rows;\n}\n\nstruct metadata_row *read_metadata_row(struct metadata_index *metadata_index, uint64_t interval_id) {\n  char *metadata_index_filename = metadata_index->metadata_index_filename;\n  FILE *metadata_index_fp = metadata_index->metadata_index_fp;\n\n  uint64_t total_offset = metadata_index->header_offset + metadata_index->row_width * interval_id;\n  \n  if (fseek(metadata_index_fp, total_offset, SEEK_SET) != 0) {\n    err(1, \"Could not seek to metadata start in '%s'.\", metadata_index_filename);\n  }\n  \n  int i;\n  size_t fr, data_width;\n\n  struct metadata_row *metadata_row = (struct metadata_row *)malloc(sizeof(struct metadata_row));\n  if (metadata_row == NULL) {\n    err(1, \"malloc failure for metadata_row in read_metadata_row.\\n\");\n  }\n\n  metadata_row->num = metadata_index->num_cols;\n  \n  metadata_row->items = (struct metadata_item **)malloc(metadata_row->num * sizeof(struct metadata_item*));\n  if (metadata_row->items == NULL) {\n    err(1, \"malloc failure for metadata_row->items in read_metadata_row.\\n\");\n  }\n\n  for (i = 0; i < metadata_row->num; ++i) {\n    struct metadata_item *metadata_item = (struct metadata_item *)malloc(sizeof(struct metadata_item));\n    if (metadata_item == NULL) {\n      err(1, \"malloc failure for metadata_item in read_metadata_row.\\n\");\n    }\n    metadata_item->type = metadata_index->types[i];\n\n    fread_data_type_item(metadata_index_filename, metadata_index_fp, metadata_item);\n\n    metadata_row->items[i] = metadata_item;\n  }\n\n  return metadata_row;\n}\n\nstruct metadata_item *read_metadata_item_by_column_id(struct metadata_index *metadata_index, uint64_t interval_id, uint8_t column_id) {\n  char *metadata_index_filename = metadata_index->metadata_index_filename;\n  FILE *metadata_index_fp = metadata_index->metadata_index_fp;\n\n  uint64_t total_offset = metadata_index->header_offset + metadata_index->row_width * interval_id + metadata_index->col_offsets[column_id];\n  \n  if (fseek(metadata_index_fp, total_offset, SEEK_SET) != 0) {\n    err(1, \"Could not seek to metadata start in '%s'.\", metadata_index_filename);\n  }\n  \n  size_t fr;\n\n  struct metadata_item *metadata_item = (struct metadata_item *)malloc(sizeof(struct metadata_item));\n  if (metadata_item == NULL) {\n    err(1, \"malloc failure for metadata_item in read_metadata_item_by_column_id.\\n\");\n  }\n  metadata_item->type = metadata_index->types[column_id];\n\n  fread_data_type_item(metadata_index_filename, metadata_index_fp, metadata_item);\n  \n  return metadata_item;\n}\n\nstruct metadata_item *read_metadata_item_by_column_name(struct metadata_index *metadata_index, uint64_t interval_id, char *column_name) {\n  int lookup_result, column_id;\n\n  lookup_result = khash_str2int_get(metadata_index->column_name_to_index, column_name, &column_id);\n  if (lookup_result == -1) {\n    err(1, \"Column %s not found in metadata.\\n\", column_name);\n  }\n  return read_metadata_item_by_column_id(metadata_index, interval_id, column_id);\n}\n\nvoid metadata_item_destroy(struct metadata_item *metadata_item) {\n  if (metadata_item->type->data_type == STRING) {\n    free(metadata_item->data.s);\n  }\n  free(metadata_item);\n}\n\nvoid metadata_row_destroy(struct metadata_row *metadata_row) {\n  int i;\n  for (i = 0; i < metadata_row->num; ++i) {\n    struct metadata_item *metadata_item = metadata_row->items[i];\n    metadata_item_destroy(metadata_item);\n  }\n  free(metadata_row->items);\n  free(metadata_row);\n}\n\nvoid metadata_rows_destroy(struct metadata_rows *metadata_rows) {\n  int i;\n  for (i = 0; i < metadata_rows->num; ++i) {\n    metadata_row_destroy(metadata_rows->rows[i]);\n  }\n  free(metadata_rows->rows);\n  free(metadata_rows);\n}\n\nvoid metadata_index_destroy(struct metadata_index **metadata_index_ptr) {\n  struct metadata_index *metadata_index = *metadata_index_ptr;\n  int i;\n\n  free(metadata_index->columns);\n\n  free(metadata_index->metadata_index_filename);\n\n  for (i = 0; i < metadata_index->num_cols; ++i) {\n    free(metadata_index->types[i]);\n  }\n  free(metadata_index->types);\n\n  free(metadata_index->col_offsets);\n  khash_str2int_destroy_free(metadata_index->column_name_to_index);\n\n  fclose(metadata_index->metadata_index_fp);\n  free(metadata_index);\n\n  *metadata_index_ptr = NULL;\n}\n\nvoid print_metadata_data(struct metadata_type *type, union metadata_data data) {\n  printf(\"%s: \", type->name);\n  switch (type->data_type) {\n    case CHAR: \n      printf(\"%c\", data.c);\n      break;\n    case INT_8: \n      printf(\"%hhu\", data.b);\n      break;\n    case INT_16: \n      printf(\"%hu\", data.h);\n      break;\n    case INT_32: \n      printf(\"%u\", data.i);\n      break;\n    case INT_64: \n      printf(\"%llu\", data.l);\n      break;\n    case FLOAT: \n      printf(\"%f\", data.f);\n      break;\n    case DOUBLE: \n      printf(\"%lf\", data.d);\n      break;\n    case STRING: \n      printf(\"%s\", data.s);\n      break;\n    default:\n      err(1, \"Unknown data_type %d.\\n\", type->data_type);\n  }\n}\n\nvoid print_metadata_item(struct metadata_item *metadata_item) {\n  print_metadata_data(metadata_item->type, metadata_item->data);\n}\n\nvoid print_metadata_row(struct metadata_row *metadata_row) {\n  int i;\n  for (i = 0; i < metadata_row->num; ++i) {\n    struct metadata_item *metadata_item = metadata_row->items[i];\n    print_metadata_data(metadata_item->type, metadata_item->data);\n    printf(\", \");\n  }\n  printf(\"\\n\");\n}\n\nvoid print_metadata_rows(struct metadata_rows *metadata_rows) {\n  int i, j;\n  printf(\"metadata_rows => num_rows: %llu\\n\", metadata_rows->num);\n  for (i = 0; i < metadata_rows->num; ++i) {\n    struct metadata_row *metadata_row = metadata_rows->rows[i];\n    printf(\"metadata_row %d => \", i);\n    print_metadata_row(metadata_row);\n  }\n}\n\nvoid print_metadata_index(struct metadata_index *metadata_index) {\n  int i;\n  uint8_t *columns = metadata_index->columns;\n  printf(\"metadata_index => num_cols: %d, num_rows: %llu, row_width: %d, header_offset: %llu\\n\", metadata_index->num_cols, metadata_index->num_rows, metadata_index->row_width, metadata_index->header_offset);\n  for (i = 0; i < metadata_index->num_cols; ++i) {\n    struct metadata_type *metadata_type = metadata_index->types[i];\n    if (columns) {\n      printf(\"%d => column: %d, data_type: %d, type_char: %c, name: %s, width: %d\\n\", i, columns[i], metadata_type->data_type, data_type_enum_to_char(metadata_type->data_type), metadata_type->name, metadata_type->width);\n    } else {\n      printf(\"%d => data_type: %d, type_char: %c, name: %s, width: %d\\n\", i, metadata_type->data_type, data_type_enum_to_char(metadata_type->data_type), metadata_type->name, metadata_type->width);\n    }\n  }\n}\n"
  },
  {
    "path": "src/metadata_index.h",
    "content": "#ifndef __METADATA_INDEX_H__\n#define __METADATA_INDEX_H__\n\n#include <stdio.h>\n#include <stdint.h>\n#include <ctype.h>\n#include <err.h>\n#include <sysexits.h>\n#include <htslib/kstring.h>\n\n#define COLUMN_NAME_MAX_LENGTH 32\n#define GIGGLE_METADATA_FILE_MARKER_LENGTH 7\n#define GIGGLE_METADATA_FILE_MARKER \"GIGLMET\"\n#define GIGGLE_METADATA_VERSION_MARKER_LENGTH 3\n#define GIGGLE_METADATA_VERSION_MARKER \"000\"\n#define GIGGLE_METADATA_EXTRA_LENGTH 6\n\nchar *METADATA_INDEX_FILE_NAME;\n\n/*\ninput\n<column number> <column name> <data type> <optional, string length>\n\noutput\n<7-byte GIGLMET> <3-byte 000> <6-byte extra>\n<1-byte uint8 num_cols> <1-byte uint8 col_width>\n< array of  \n  <256-byte char*, name>\n  <1-byte uint8, width>\n  <1-byte char, data type specifier>\n>\n<8-byte uint64 num_rows>\n< array of  \n<data 1> <data 2> ... <data n>\n>\n*/\n\nenum data_type {\n  CHAR,   // c = char\n  INT_8,  // b = byte\n  INT_16, // h = short\n  INT_32, // i = int\n  INT_64, // l = long\n  FLOAT,  // f = float\n  DOUBLE, // d = double\n  STRING  // s = string\n};\n\nstruct metadata_type {\n  enum data_type data_type;\n  uint8_t width; // max data string length = 255\n  // max name length = COLUMN_NAME_MAX_LENGTH - 1 (null character)\n  char name[COLUMN_NAME_MAX_LENGTH]; \n};\n\nunion metadata_data {\n  char c;\n  int8_t b;\n  int16_t h;\n  int32_t i;\n  int64_t l;\n  float f;\n  double d;\n  char *s;\n};\n\nstruct metadata_item {\n  struct metadata_type *type;\n  union metadata_data data;\n};\n\nstruct metadata_row {\n  uint8_t num; // total number of columns\n  struct metadata_item **items; // array of rows\n};\n\nstruct metadata_rows {\n  uint64_t num; // total number of rows\n  struct metadata_row **rows; // data rows\n};\n\nstruct metadata_index {\n  // for storing the column numbers in the conf file, \n  // only used by the operations used in indexing- init, add \n  uint8_t *columns; \n\n  char *metadata_index_filename;\n  FILE *metadata_index_fp;\n  \n  uint8_t num_cols;\n  uint16_t row_width; // total width of each data row\n  uint64_t num_rows;\n\n  void *column_name_to_index; // khash_str2int hashmap to map column names to column indexes\n  uint16_t *col_offsets; // offset of ith column in a data row\n\n  struct metadata_type **types;\n  uint64_t header_offset; // total header offset, end of the header file position\n};\n\nenum data_type data_type_string_to_enum(char type_string[8]);\nchar data_type_enum_to_char(enum data_type type);\nenum data_type data_type_char_to_enum(char type_char);\nuint8_t get_width_of_data_type(enum data_type type);\n\nchar *safe_sscanf(uint8_t str_width, char *data);\n\nvoid fwrite_data_type_item(FILE *metadata_index_fp, struct metadata_type *metadata_type, char *data);\nvoid fread_data_type_item(char *metadata_index_filename, FILE *metadata_index_fp, struct metadata_item *metadata_item);\n\nstruct metadata_index *metadata_index_new();\nvoid read_metadata_conf(struct metadata_index *metadata_index, char *metadata_conf_filename);\nvoid write_metadata_index_header(struct metadata_index *metadata_index);\nvoid read_metadata_index_header(struct metadata_index *metadata_index);\n\nvoid print_metadata_index(struct metadata_index *metadata_index);\nvoid print_metadata_data(struct metadata_type *type, union metadata_data data);\nvoid print_metadata_item(struct metadata_item *metadata_item);\nvoid print_metadata_row(struct metadata_row *metadata_row);\nvoid print_metadata_rows(struct metadata_rows *metadata_rows);\n\n// public interfaces\n\nstruct metadata_index *metadata_index_init(char *metadata_conf_filename, char *metadata_index_filename);\nuint64_t metadata_index_add(struct metadata_index *metadata_index, uint32_t file_id, kstring_t *line);\nvoid metadata_index_store(struct metadata_index *metadata_index);\nstruct metadata_index *metadata_index_load(char *metadata_index_filename);\nvoid metadata_index_destroy(struct metadata_index **metadata_index_ptr);\n\nstruct metadata_rows *read_metadata_rows(struct metadata_index *metadata_index);\nvoid metadata_rows_destroy(struct metadata_rows *metadata_rows);\n\nstruct metadata_row *read_metadata_row(struct metadata_index *metadata_index, uint64_t interval_id);\nvoid metadata_row_destroy(struct metadata_row *metadata_row);\n\nstruct metadata_item *read_metadata_item_by_column_id(struct metadata_index *metadata_index, uint64_t interval_id, uint8_t column_id);\nstruct metadata_item *read_metadata_item_by_column_name(struct metadata_index *metadata_index, uint64_t interval_id, char *column_name);\nvoid metadata_item_destroy(struct metadata_item *metadata_item);\n\n#endif\n"
  },
  {
    "path": "src/offset_idx_lookup.c",
    "content": "#include <stdlib.h>\n#include <stdio.h>\n#include <err.h>\n#include <string.h>\n#include <htslib/kstring.h>\n\n#include \"giggle_index.h\"\n#include \"offset_index.h\"\n#include \"file_read.h\"\n\n\nint main(int argc, char **argv)\n{\n\n    if ((argc != 4)) {\n        errx(1,\n             \"usage:\\t%s <offset idx> <file idx> <idx>\",\n             argv[0]);\n    }\n\n    char *offset_idx_path = argv[1];\n    char *file_idx_path = argv[2];\n    uint64_t offset_id = atoll(argv[3]);\n\n    struct offset_index *offset_idx = offset_index_load(offset_idx_path);\n    struct file_index *file_idx = file_index_load(file_idx_path);\n\n    struct file_id_offset_pair fid_off =\n        offset_index_get(offset_idx, offset_id);\n\n    struct file_data *fd = file_index_get(file_idx, fid_off.file_id);\n\n    struct input_file *ipf = input_file_init(fd->file_name);\n\n    ipf->input_file_seek(ipf, fid_off.offset);\n\n    char *result = NULL;\n    ipf->input_file_get_next_line(ipf, &result);\n\n    printf(\"%s\\n\", result);\n\n    return 0;\n}\n"
  },
  {
    "path": "src/offset_index.c",
    "content": "#define _GNU_SOURCE\n\n#include <stdio.h>\n#include <stdlib.h>\n#include <stdint.h>\n#include <sysexits.h>\n#include <inttypes.h>\n#include <htslib/kstring.h>\n#include <err.h>\n#include <sys/mman.h>\n#include <unistd.h>\n\n#include \"offset_index.h\"\n#include \"util.h\"\n\nchar *OFFSET_INDEX_FILE_NAME = \"offset_index.dat\";\n\nuint32_t offset_data_size = 0;\n\nvoid (*offset_data_append_data)(uint8_t *dest, kstring_t *line) = NULL;\n\n//{{{struct offset_index *offset_index_init(uint32_t init_size, char\nstruct offset_index *offset_index_init(uint32_t init_size, char *file_name)\n{\n    struct offset_index *oi = \n            (struct offset_index *) malloc(sizeof(struct offset_index));\n    if (oi == NULL)\n        err(1, \"malloc error in offset_index_init()\");\n\n    oi->width = sizeof(struct file_id_offset_pair) + offset_data_size;\n    oi->index = (struct file_id_offset_pairs *)\n            malloc(sizeof(struct file_id_offset_pairs));\n    if (oi->index == NULL)\n        err(1, \"malloc error in offset_index_init()\");\n\n    oi->index->num = 0;\n    oi->index->size = init_size;\n    /*\n    oi->index->vals = (struct file_id_offset_pair *)\n            calloc(oi->index->size, oi->width);\n    */\n\n    oi->file_name = NULL;\n    if (file_name != NULL) {\n        oi->file_name = strdup(file_name);\n    }\n\n    //oi->f = NULL;\n\n    //oi->type = in_memory;\n    \n    oi->f = fopen(oi->file_name, \"w+\");\n    if (oi->f == NULL)\n        err(1, \"Could not open %s.\", oi->file_name);\n\n    int ret = ftruncate(fileno(oi->f),\n                        sizeof(uint64_t) + sizeof(uint32_t) +\n                        (oi->index->size * oi->width));\n    if ( ret != 0 )\n        err(1, \"Could not extend %s.\", oi->file_name);\n\n    oi->index->vals = (struct file_id_offset_pair *)\n            mmap(0,\n                 (oi->index->size * oi->width),\n                 PROT_WRITE | PROT_READ,\n                 MAP_SHARED,\n                 fileno(oi->f),\n                 0);\n\n    if (oi->index->vals == MAP_FAILED)\n        err(1, \"Error mmapping file.\");\n \n    oi->type = on_disk;\n\n    return oi;\n}\n//}}}\n\n//{{{void offset_index_destroy(struct offset_index **oi);\nvoid offset_index_destroy(struct offset_index **oi)\n{\n\n    if ((*oi)->file_name != NULL) {\n        free((*oi)->file_name);\n        (*oi)->file_name = NULL;\n    }\n\n    if ((*oi)->f != NULL) {\n        munmap((*oi)->index->vals, \n               sizeof(uint64_t) + sizeof(uint32_t) + \n               (*oi)->index->size * (*oi)->width);\n        fclose((*oi)->f);\n    } else {\n        free((*oi)->index->vals);\n    }\n\n    free((*oi)->index);\n\n    free(*oi);\n    *oi = NULL;\n}\n//}}}\n\n//{{{uint32_t offset_index_add(struct offset_index *oi)\nuint64_t offset_index_add(struct offset_index *oi,\n                          long offset,\n                          kstring_t *line,\n                          uint32_t file_id)\n{\n    uint64_t id = oi->index->num;\n    oi->index->num = oi->index->num + 1;\n\n    if (oi->index->num == oi->index->size) {\n        oi->index->size = oi->index->size * 2;\n\n        int ret = munmap(oi->index->vals, \n                         sizeof(uint64_t) + sizeof(uint32_t) + \n                         oi->index->num * oi->width);\n        if ( ret != 0 )\n            err(1, \"offset_index_add: Could not munmap %s.\", oi->file_name);\n\n        ret = ftruncate(fileno(oi->f), \n                        sizeof(uint64_t) + sizeof(uint32_t) +\n                        oi->index->size * oi->width);\n        if ( ret != 0 )\n            err(1, \"offset_index_add:Could not extend %s.\", oi->file_name);\n\n        oi->index->vals = (struct file_id_offset_pair *)\n                mmap(0,\n                     sizeof(uint64_t) + sizeof(uint32_t) +\n                        oi->index->size * oi->width,\n                     PROT_WRITE | PROT_READ,\n                     MAP_SHARED,\n                     fileno(oi->f),\n                     0);\n\n        if (oi->index->vals == MAP_FAILED)\n            err(1, \"Error mmapping file.\");\n\n        /*\n        oi->index->vals = (struct file_id_offset_pair *)\n                realloc(oi->index->vals, oi->index->size * oi->width);\n        if (oi->index->vals == NULL)\n            err(1, \"realloc error in offset_index_add().\\n\");\n        memset((uint8_t *)oi->index->vals + (oi->index->num * oi->width),\n               0,\n               oi->index->num * oi->width);\n        */\n    } \n    OFFSET_INDEX_PAIR(oi, id)->offset = offset;\n    OFFSET_INDEX_PAIR(oi, id)->file_id = file_id;\n\n    if (offset_data_append_data != NULL) \n        offset_data_append_data((uint8_t *)OFFSET_INDEX_DATA(oi, id), line);\n\n   return id;\n}\n//}}}\n\n//{{{void offset_index_store(struct offset_index *oi)\nvoid offset_index_store(struct offset_index *oi)\n{\n    \n    ( (uint64_t *) oi->index->vals)[0] = oi->index->num;\n    ( (uint32_t *) oi->index->vals)[2] = oi->width;\n    int ret = ftruncate(fileno(oi->f), \n                        sizeof(uint64_t) + sizeof(uint32_t) + \n                        oi->index->num * oi->width);\n    if ( ret != 0 )\n        err(1, \"offset_index_store: Could not truncate.\");\n \n/*\n    if (oi->file_name == NULL)\n        errx(1,\"No output file given for offset_index.\");\n\n    FILE *f = fopen(oi->file_name, \"wb\");\n    if (f == NULL)\n        err(1, \"Could not open %s.\", oi->file_name);\n\n    if (fwrite(&(oi->index->num),\n               sizeof(uint64_t),1, f) != 1)\n        err(EX_IOERR, \"Error writing offset_index num to '%s'.\",\n            oi->file_name);\n\n    if (fwrite(&(oi->width),\n               sizeof(uint32_t),1, f) != 1)\n        err(EX_IOERR, \"Error writing offset_index width to '%s'.\",\n            oi->file_name);\n\n    if (fwrite(oi->index->vals, \n               oi->width,\n               oi->index->num, f) != oi->index->num)\n        err(EX_IOERR, \"Error writing file_id offset pairs to '%s'.\",\n            oi->file_name);\n    fclose(f);\n*/\n}\n//}}}\n\n//{{{struct offset_index *offset_index_load(char *file_name)\nstruct offset_index *offset_index_load(char *file_name)\n{\n    struct offset_index *oi = (struct offset_index *)\n            malloc(sizeof(struct offset_index));\n    if (oi == NULL)\n        err(1, \"malloc error in offset_index_load().\\n\");\n\n    oi->file_name = strdup(file_name);\n\n    oi->f = fopen(file_name, \"rb\");\n    if (oi->f == NULL)\n        err(1, \"Could not open %s.\", oi->file_name);\n\n    oi->index = (struct file_id_offset_pairs *)\n            malloc(sizeof(struct file_id_offset_pairs));\n    if (oi->index == NULL)\n        err(1, \"malloc error in offset_index_load().\\n\");\n\n    size_t fr = fread(&(oi->index->num), sizeof(uint64_t), 1, oi->f);\n    check_file_read(oi->file_name, oi->f, 1, fr);\n\n    fr = fread(&(oi->width), sizeof(uint32_t), 1, oi->f);\n    check_file_read(oi->file_name, oi->f, 1, fr);\n\n    oi->index->size = oi->index->num;\n\n    off_t filesize = lseek(fileno(oi->f), 0, SEEK_END);\n    rewind(oi->f);\n\n    oi->index->vals = (struct file_id_offset_pair *)\n            mmap(0,\n                 filesize,\n                 PROT_READ,\n                 MAP_SHARED,\n                 fileno(oi->f),\n                 0);\n\n    if (oi->index->vals == MAP_FAILED)\n        err(1, \"Error mmapping file.\");\n    \n    oi->type = on_disk;\n\n    return oi;\n}\n//}}}\n\n//{{{struct file_id_offset_pair offset_index_get(struct offset_index *oi,\nstruct file_id_offset_pair offset_index_get(struct offset_index *oi,\n                                            uint64_t id)\n{\n    return *(OFFSET_INDEX_PAIR(oi, id));\n}\n//}}}\n"
  },
  {
    "path": "src/offset_index.h",
    "content": "#ifndef __OFFSET_H__\n#define __OFFSET_H__\n\n#include <stdint.h>\n#include <htslib/kstring.h>\n\nchar *OFFSET_INDEX_FILE_NAME;\n\nuint32_t offset_data_size;\n\nvoid (*offset_data_append_data)(uint8_t *dest, kstring_t *line);\n\nstruct file_id_offset_pair\n{\n    uint32_t file_id;\n    long offset;\n};\nvoid *file_id_offset_pair_load(FILE *f, char *file_name);\nvoid file_id_offset_pair_store(void *v, FILE *f, char *file_name);\n\nstruct file_id_offset_pairs\n{\n    uint64_t num,size;\n    struct file_id_offset_pair *vals;\n};\n\nstruct offset_index\n{\n    struct file_id_offset_pairs *index; //<! file_index/offse pair list\n    char *file_name; //<! offset_index file name\n    uint32_t width;\n    FILE *f;\n    enum {in_memory, on_disk} type;\n};\n\nstruct offset_index *offset_index_init(uint32_t init_size, char *file_name);\nvoid offset_index_destroy(struct offset_index **oi);\nvoid offset_index_store(struct offset_index *oi);\nuint64_t offset_index_add(struct offset_index *oi,\n                          long offset,\n                          kstring_t *line,\n                          uint32_t file_id);\nstruct offset_index *offset_index_load(char *file_name);\nstruct file_id_offset_pair offset_index_get(struct offset_index *oi,\n                                            uint64_t id);\n\n\n#define OFFSET_INDEX_PAIR(offset_index, i) \\\n    ( (struct file_id_offset_pair *) (((uint8_t *)(offset_index->index->vals)) \\\n        + ((offset_index->type == in_memory) \\\n            ? 0 : sizeof(uint64_t) + sizeof(uint32_t)) \\\n        + ((uint64_t)i * (uint64_t)offset_index->width)) )\n\n#define OFFSET_INDEX_DATA(offset_index, i) \\\n    ( (void *) (((uint8_t *)(offset_index->index->vals)) \\\n        + ((offset_index->type == in_memory) \\\n            ? 0 : sizeof(uint64_t) + sizeof(uint32_t)) \\\n        + ((uint64_t)i * (uint64_t)offset_index->width + sizeof(struct file_id_offset_pair))) )\n\n#endif\n"
  },
  {
    "path": "src/pq.c",
    "content": "#include <stdio.h>\n#include <stdlib.h>\n#include <string.h>\n#include \"pq.h\"\n\npri_queue priq_new(int size)\n{\n    if (size < 4) size = 4;\n\n    pri_queue q = malloc(sizeof(pri_queue_t));\n    if (!q)\n        err(EX_OSERR, \"malloc error in priq_new().\");\n    q->buf = malloc(sizeof(q_elem_t) * size);\n    if (!q->buf)\n        err(EX_OSERR, \"malloc error priq_new().\");\n    q->alloc = size;\n    q->n = 1;\n\n    return q;\n}\n\nvoid priq_push(pri_queue q, void *data, priority pri)\n{\n    q_elem_t *b;\n    int n, m;\n\n    if (q->n >= q->alloc) {\n        q->alloc *= 2;\n        b = q->buf = realloc(q->buf, sizeof(q_elem_t) * q->alloc);\n        if (b == NULL)\n            err(EX_OSERR, \"realloc error priq_push().\");\n    } else\n        b = q->buf;\n\n    n = q->n++;\n    /* append at end, then up heap */\n    //while ((m = n / 2) && pri < b[m].pri) {\n    while ((m = n / 2) && (pricmp(pri, b[m].pri) < 0)) {\n        b[n] = b[m];\n        n = m;\n    }\n    b[n].data = data;\n    b[n].pri = pri;\n}\n\n/* remove top item. returns -1 if empty. *pri can be null. */\nvoid *priq_pop(pri_queue q, priority *pri)\n{\n    void *out;\n    if (q->n == 1) return NULL;\n\n    q_elem_t *b = q->buf;\n\n    out = b[1].data;\n    if (pri) *pri = b[1].pri;\n\n    /* pull last item to top, then down heap. */\n    --q->n;\n\n    int n = 1, m;\n    while ((m = n * 2) < q->n) {\n        //if (m + 1 < q->n && b[m].pri > b[m + 1].pri) m++;\n        if ( (m + 1 < q->n) && \n             (pricmp(b[m].pri,b[m + 1].pri) > 0))\n            m++;\n\n        //if (b[q->n].pri <= b[m].pri) break;\n        if (pricmp(b[q->n].pri, b[m].pri) <= 0)\n            break;\n        b[n] = b[m];\n        n = m;\n    }\n\n    b[n] = b[q->n];\n    if (q->n < q->alloc / 2 && q->n >= 16) {\n        q->buf = realloc(q->buf, (q->alloc /= 2) * sizeof(b[0]));\n        if (q->buf == NULL)\n            err(1, \"realloc error in priq_pop().\");\n    }\n\n    return out;\n}\n\n/* get the top element without removing it from queue */\nvoid *priq_top(pri_queue q, priority *pri)\n{\n    if (q->n == 1) return NULL;\n    if (pri) *pri = q->buf[1].pri;\n    return q->buf[1].data;\n}\n\n/* this is O(n log n), but probably not the best */\nvoid priq_combine(pri_queue q, pri_queue q2)\n{\n    int i;\n    q_elem_t *e = q2->buf + 1;\n\n    for (i = q2->n - 1; i >= 1; i--, e++)\n        priq_push(q, e->data, e->pri);\n    priq_purge(q2);\n}\n\nvoid priq_free(pri_queue q)\n{\n    free(q->buf);\n    free(q);\n}\n\nint pricmp(priority a, priority b)\n{\n    int r = strcmp(a.chrm, b.chrm);\n    if (r == 0)\n        return a.pos - b.pos;\n    else \n        return r;\n}\n"
  },
  {
    "path": "src/pq.h",
    "content": "#ifndef __PQ_H__\n#define __PQ_H__\n#include <stdio.h>\n#include <stdlib.h>\n#include <stdint.h>\n#include <sysexits.h>\n#include <err.h>\n\nstruct pq_data\n{\n    uint32_t file_id;\n    uint64_t interval_id;\n};\n\ntypedef struct\n{\n    uint32_t pos;\n    char chrm[50];\n} priority;\n\ntypedef struct\n{\n    void *data;\n    priority pri;\n} q_elem_t;\n\ntypedef struct\n{\n    q_elem_t *buf;\n    int n, alloc;\n} pri_queue_t, *pri_queue;\n \n#define priq_purge(q) (q)->n = 1\n#define priq_size(q) ((q)->n - 1)\npri_queue priq_new(int size);\nvoid priq_push(pri_queue q, void *data, priority pri);\nvoid *priq_pop(pri_queue q, priority *pri);\nvoid *priq_top(pri_queue q, priority *pri);\nvoid priq_combine(pri_queue q, pri_queue q2);\nvoid priq_free(pri_queue q);\nint pricmp(priority a, priority b);\n#endif\n"
  },
  {
    "path": "src/query_filter.c",
    "content": "#define _GNU_SOURCE\n\n#include <string.h>\n#include <stdlib.h>\n#include <htslib/khash_str2int.h>\n#include \"query_filter.h\"\n\nunion metadata_data parse_query_filter_data_string(struct metadata_type *metadata_type, char *data) {\n  union metadata_data metadata_data;\n  enum data_type type = metadata_type->data_type;\n  char *s;\n\n  switch (type) {\n    case CHAR: \n      metadata_data.c = *data;\n      break;\n\n    case INT_8: \n      metadata_data.b = atoi(data);\n      break;\n      \n    case INT_16: \n      metadata_data.h = atoi(data);\n      break;\n      \n    case INT_32: \n      metadata_data.i = atol(data);\n      break;\n      \n    case INT_64: \n      metadata_data.l = atoll(data);\n      break;\n      \n    case FLOAT: \n      metadata_data.f = atof(data);\n      break;\n      \n    case DOUBLE: \n      metadata_data.d = atof(data);\n      break;\n      \n    case STRING: \n      metadata_data.s = safe_sscanf(metadata_type->width, data);\n      break;\n      \n    default:\n      err(1, \"Unknown data_type %d.\\n\", type);\n  }\n\n  return metadata_data;\n}\n\nenum comparison comparison_string_to_enum(char *query_filter_string, int *start_comparison, int *end_comparison) {\n  int i, start = -1, end;\n  for(i = 0; query_filter_string[i]; ++i) {\n    if (!(isalpha(query_filter_string[i]) || query_filter_string[i] == '_')) { // column name ended\n      start = end = i;\n      // TODO: if the first character of the string data is \n      // allowed to be =, escape logic needs to be implemented \n      if (query_filter_string[i+1] == '=') {\n        end = i+1;\n      }\n      break;\n    }\n  }\n\n  if (start == -1) {\n    err(1, \"Comparison operator not found.\\n\");\n  }\n\n  enum comparison comparison;\n  if (start == end) {\n    switch (query_filter_string[start]) {\n      case '<': \n        comparison = LESS;\n        break;\n      case '>': \n        comparison = GREATER;\n        break;\n      default:\n        err(1, \"Unknown comparison operator %c.\\n\", query_filter_string[start]);\n    }\n  } else {\n    switch (query_filter_string[start]) {\n      case '=': \n        comparison = EQUAL;\n        break;\n      case '!': \n        comparison = NOT_EQUAL;\n        break;\n      case '<': \n        comparison = LESS_EQUAL;\n        break;\n      case '>': \n        comparison = GREATER_EQUAL;\n        break;\n      default:\n        err(1, \"Unknown comparison operator %c=.\\n\", query_filter_string[start]);\n    }\n  }\n\n  *start_comparison = start;\n  *end_comparison = end;\n  return comparison;\n}\n\nstruct query_filter *parse_query_filter_string(struct metadata_index *metadata_index, char *query_filter_string_original) {\n  struct query_filter *query_filter = (struct query_filter *)malloc(sizeof(struct query_filter));\n  if (query_filter == NULL) {\n    err(1, \"malloc failure for query_filter in parse_query_filter_string.\\n\");\n  }\n\n  char *query_filter_string = strdup(query_filter_string_original);\n\n  int start_comparison, end_comparison, lookup_result;\n  char *data_string;\n  char null_tmp;\n  int column_id;\n\n  query_filter->comparison = comparison_string_to_enum(query_filter_string, &start_comparison, &end_comparison);\n  \n  null_tmp = query_filter_string[start_comparison];\n  query_filter_string[start_comparison] = 0; // null-terminate the column name after parsing comparison operator\n\n  lookup_result = khash_str2int_get(metadata_index->column_name_to_index, query_filter_string, &column_id);\n  if (lookup_result == -1) {\n    err(1, \"Column %s not found in metadata.\\n\", query_filter_string);\n  }\n\n  query_filter->type = metadata_index->types[column_id];\n  query_filter->column_id = column_id;\n\n  data_string = query_filter_string + end_comparison + 1;\n  query_filter->data = parse_query_filter_data_string(query_filter->type, data_string);\n  \n  free(query_filter_string);\n\n  return query_filter;\n}\n\nint perform_metadata_comparison(struct metadata_type *metadata_type, enum comparison comparison, union metadata_data source, union metadata_data target) {\n  enum data_type type = metadata_type->data_type;\n  int less, equal, greater;\n  int result;\n  char c;\n  int8_t b;\n  int16_t h;\n  int32_t i;\n  int64_t l;\n  float f;\n  double d;\n  int s;\n\n  switch (type) {\n    case CHAR: \n      c = source.c - target.c;\n      less = (c < 0); equal = (c == 0); greater = (c > 0);\n      break;\n    case INT_8: \n      b = source.b - target.b;\n      less = (b < 0); equal = (b == 0); greater = (b > 0);\n      break;\n    case INT_16: \n      h = source.h - target.h;\n      less = (h < 0); equal = (h == 0); greater = (h > 0);\n      break;\n    case INT_32: \n      i = source.i - target.i;\n      less = (i < 0); equal = (i == 0); greater = (i > 0);\n      break;\n    case INT_64: \n      l = source.l - target.l;\n      less = (l < 0); equal = (l == 0); greater = (l > 0);\n      break;\n    case FLOAT: \n      f = source.f - target.f;\n      // note: float equality comparison may not always work as expected\n      // due to rounding errors \n      less = (f < 0); equal = (f == 0); greater = (f > 0);\n      break;\n    case DOUBLE: \n      d = source.d - target.d;\n      // note: double equality comparison may not always work as expected\n      // due to rounding errors \n      less = (d < 0); equal = (d == 0); greater = (d > 0);\n      break;\n    case STRING: \n      s = strcmp(source.s, target.s);\n      less = (s < 0); equal = (s == 0); greater = (s > 0);\n      break;\n    default:\n      err(1, \"Unknown data_type %d.\\n\", type);\n  }\n  \n  switch (comparison) {\n    case EQUAL: \n      result = equal;\n      break;\n    case NOT_EQUAL: \n      result = !equal;\n      break;\n    case LESS: \n      result = less;\n      break;\n    case GREATER: \n      result = greater;\n      break;\n    case LESS_EQUAL: \n      result = less || equal;\n      break;\n    case GREATER_EQUAL: \n      result = greater || equal;\n      break;\n    default:\n      err(1, \"Unknown comparison %d.\\n\", comparison);\n  }\n\n  return result;\n}\n\nint filter_metadata_row_by_item(struct metadata_item *metadata_item, struct query_filter *query_filter) {  \n  struct metadata_type *metadata_type = query_filter->type;\n  struct metadata_type *item_metadata_type = metadata_item->type;\n  if (strcmp(metadata_type->name, item_metadata_type->name) != 0) {\n    err(1, \"The query filter metadata type '%s' does not match the item metadata type '%s'.\\n\", metadata_type->name, item_metadata_type->name);\n  }\n  enum comparison comparison = query_filter->comparison;\n  uint8_t column_id = query_filter->column_id;\n  union metadata_data target = query_filter->data;\n\n  union metadata_data source = metadata_item->data;\n\n  return perform_metadata_comparison(metadata_type, comparison, source, target);\n}\n\nint filter_metadata_row_by_row(struct metadata_row *metadata_row, struct query_filter *query_filter) {  \n  uint8_t column_id = query_filter->column_id;\n  struct metadata_item *metadata_item = metadata_row->items[column_id];\n  return filter_metadata_row_by_item(metadata_item, query_filter);\n}\n\nvoid query_filter_destroy(struct query_filter **query_filter_ptr) {\n  struct query_filter *query_filter = *query_filter_ptr;\n  if (query_filter->type->data_type == STRING) {\n    free(query_filter->data.s);\n  }\n  free(query_filter);\n  *query_filter_ptr = NULL;\n}\n\nvoid print_comparison(enum comparison comparison) {\n  switch (comparison) {\n    case EQUAL: \n      printf(\"==\");\n      break;\n    case NOT_EQUAL: \n      printf(\"!=\");\n      break;\n    case LESS: \n      printf(\"<\");\n      break;\n    case GREATER: \n      printf(\">\");\n      break;\n    case LESS_EQUAL: \n      printf(\"<=\");\n      break;\n    case GREATER_EQUAL: \n      printf(\">=\");\n      break;\n    default:\n      err(1, \"Unknown comparison %d.\\n\", comparison);\n  }\n}\n\nvoid print_query_filter(struct query_filter *query_filter) {\n  int i;\n  print_metadata_data(query_filter->type, query_filter->data);\n  printf(\", comparison: \");\n  print_comparison(query_filter->comparison);\n  printf(\"\\n\");\n}\n"
  },
  {
    "path": "src/query_filter.h",
    "content": "#ifndef __QUERY_FILTER_H__\n#define __QUERY_FILTER_H__\n\n#include <stdint.h>\n#include \"metadata_index.h\"\n\nenum comparison {\n  EQUAL,\n  NOT_EQUAL,\n  LESS,\n  GREATER,\n  LESS_EQUAL,\n  GREATER_EQUAL\n};\n\nstruct query_filter {\n  struct metadata_type *type;\n  uint8_t column_id;\n  enum comparison comparison;\n  union metadata_data data;\n};\n\nunion metadata_data parse_query_filter_data_string(struct metadata_type *metadata_type, char *data);\nenum comparison comparison_string_to_enum(char *query_filter_string, int *start_comparison, int *end_comparison);\n\nint perform_metadata_comparison(struct metadata_type *metadata_type, enum comparison comparison, union metadata_data source, union metadata_data target);\n\nvoid print_comparison(enum comparison comparison);\nvoid print_query_filter(struct query_filter *query_filter);\n\n// public interfaces\n\nstruct query_filter *parse_query_filter_string(struct metadata_index *metadata_index, char *query_filter_string);\nint filter_metadata_row_by_item(struct metadata_item *metadata_item, struct query_filter *query_filter);  \nint filter_metadata_row_by_row(struct metadata_row *metadata_row, struct query_filter *query_filter);  \nvoid query_filter_destroy(struct query_filter **query_filter_ptr);\n\n#endif\n"
  },
  {
    "path": "src/search.c",
    "content": "#define _GNU_SOURCE\n#include <stdlib.h>\n#include <stdio.h>\n#include <err.h>\n#include <string.h>\n#include <getopt.h>\n#include <ctype.h>\n#include <sysexits.h>\n#include <regex.h>\n#include <htslib/kstring.h>\n#include <math.h>\n\n#include \"giggle_index.h\"\n#include \"wah.h\"\n#include \"cache.h\"\n#include \"file_read.h\"\n#include \"util.h\"\n#include \"kfunc.h\"\n#include \"ll.h\"\n\n#define MAX(X, Y) (((X) > (Y)) ? (X) : (Y))\n\nint search_help(int exit_code);\nint print_giggle_query_result(struct giggle_query_result *gqr,\n                              struct giggle_index *gi,\n                              regex_t *regexs,\n                              char **file_patterns,\n                              uint32_t num_file_patterns,\n                              uint32_t num_intervals,\n                              double mean_interval_size,\n                              long long genome_size,\n                              uint32_t f_is_set,\n                              uint32_t v_is_set,\n                              uint32_t c_is_set,\n                              uint32_t s_is_set,\n                              uint32_t o_is_set);\n\n//{{{ int search_help(int exit_code)\nint search_help(int exit_code)\n{\n    fprintf(stderr,\n\"%s, v%s\\n\"\n\"usage:   %s search -i <index directory> [options]\\n\"\n\"         options:\\n\"\n\"             -i giggle index directory\\n\"\n\"             -r <regions (CSV)>\\n\"\n\"             -q <query file>\\n\"\n\"             -o give results per record in the query file (omits empty results)\\n\"\n\"             -c give counts by indexed file\\n\"\n\"             -s give significance by indexed file (requires query file)\\n\"\n\"             -v give full record results\\n\"\n\"             -f print results for files that match a pattern (regex CSV)\\n\"\n\"             -g genome size for significance testing (default 3095677412)\\n\"\n\"             -l list the files in the index\\n\"\n\"             -m load metadata index\\n\"\n\"             -u query filter\\n\",\n            PROGRAM_NAME, VERSION, PROGRAM_NAME);\n    return exit_code;\n}\n//}}}\n\n//{{{int print_giggle_query_result(struct giggle_query_result *gqr,\nint print_giggle_query_result(struct giggle_query_result *gqr,\n                              struct giggle_index *gi,\n                              regex_t *regexs,\n                              char **file_patterns,\n                              uint32_t num_file_patterns,\n                              uint32_t num_intervals,\n                              double mean_interval_size,\n                              long long genome_size,\n                              uint32_t f_is_set,\n                              uint32_t v_is_set,\n                              uint32_t c_is_set,\n                              uint32_t s_is_set,\n                              uint32_t o_is_set)\n{\n    if (gqr == NULL)\n        return EX_OK;\n\n    uint32_t i,j;\n\n    if (s_is_set == 1) {\n        printf(\"#file\\t\"\n               \"file_size\\t\"\n               \"overlaps\\t\"\n               \"odds_ratio\\t\"\n               \"fishers_two_tail\\t\"\n               \"fishers_left_tail\\t\"\n               \"fishers_right_tail\\t\"\n               \"combo_score\\n\");\n    }\n\n    for(i = 0; i < gqr->num_files; i++) {\n        struct file_data *fd = file_index_get(gi->file_idx, i);\n        if (test_pattern_match(gi,\n                               regexs,\n                               file_patterns,\n                               num_file_patterns,\n                               i,\n                               f_is_set)) {\n            if ( (v_is_set == 1) && (giggle_get_query_len(gqr, i) > 0 )){\n                //printf(\"#%s\\n\", fd->file_name);\n                char *result;\n                struct giggle_query_iter *gqi =\n                    giggle_get_query_itr(gqr, i);\n                while (giggle_query_next(gqi, &result) == 0)\n                    printf(\"%s\\t%s\\n\", result, fd->file_name);\n                giggle_iter_destroy(&gqi);\n            } else if (c_is_set == 1) {\n                printf(\"#%s\\t\"\n                       \"size:%u\\t\"\n                       \"overlaps:%u\\n\",\n                       fd->file_name,\n                       fd->num_intervals,\n                       giggle_get_query_len(gqr, i));\n            } else if (s_is_set == 1) {\n                uint32_t file_counts = giggle_get_query_len(gqr, i);\n                long long n11 = (long long)(file_counts);\n\n                //long long n12 = (long long)(MAX(0,num_intervals-file_counts));\n                long long n12 = (long long)safe_subtract(num_intervals,file_counts);\n\n                long long n21 = (long long)safe_subtract(fd->num_intervals,file_counts);\n\n                double comp_mean = fd->mean_interval_size + mean_interval_size;\n\n                long long n22_full = (long long)\n                        MAX(n11 + n12 + n21, genome_size/comp_mean);\n\n                //long long n22 = MAX(0, n22_full - (n11 + n12 + n21));\n                long long n22 = (long long)safe_subtract(n22_full, n11 + n12 + n21);\n\n                long double left, right, two;\n                long double r = _kt_fisher_exact(n11,\n                                                 n12,\n                                                 n21,\n                                                 n22,\n                                                 &left,\n                                                 &right,\n                                                 &two);\n\n                /*\n                double ratio = \n                        (((double)n11/(double)MAX(1,n12)) / \n                         ((double)n21/(double)n22));\n                */\n\n                double ratio = \n                        (((double)(n11 + 1)/(double)MAX(1,n12)) / \n                         ((double)(n21 + 1)/(double)(n22 + 1)));\n\n                printf(\"%s\\t\"\n                       \"%u\\t\"\n                       \"%u\\t\"\n                       \"%.17g\\t\"\n                       \"%.17Lg\\t\"\n                       \"%.17Lg\\t\"\n                       \"%.17Lg\\t\"\n                       \"%.17Lg\\t\"\n                       \"\\n\",\n                       fd->file_name,\n                       fd->num_intervals,\n                       file_counts,\n                       ratio,\n                       two,\n                       left,\n                       right,\n                       log2fc(ratio) * neglog10p(two));\n                /*\n                printf(\"#%s\\t\"\n                       \"size:%u\\t\"\n                       \"overlaps:%u\\t\"\n                       \"ratio:%f\\t\"\n                       \"combo:%.17Lg\\t\"\n                       \"right:%.17Lg\\t\"\n                       \"left:%.17Lg\\t\"\n                       \"two:%.17Lg\\t\"\n                       \"n11:%lld\\t\"\n                       \"n12:%lld\\t\"\n                       \"n21:%lld\\t\"\n                       \"n22:%lld\\t\"\n                       \"fd->mean_interval_size:%f\\t\"\n                       \"mean_interval_size:%f\\t\"\n                       \"comp_mean:%f\"\n                       \"\\n\",\n                       fd->file_name,\n                       fd->num_intervals,\n                       file_counts,\n                       ratio,\n                       log2fc(ratio) * neglog10p(two),\n                       right,\n                       left,\n                       two,\n                       n11,\n                       n12,\n                       n21,\n                       n22,\n                       fd->mean_interval_size,\n                       mean_interval_size,\n                       comp_mean);\n                       */\n\n            }\n        }\n    }\n\n    return EX_OK;\n}\n//}}}\n\nint search_main(int argc, char **argv, char *full_cmd)\n{\n    if (argc < 2) return search_help(EX_OK);\n\n    uint32_t num_chrms = 100;\n    int c;\n    char *index_dir_name = NULL,\n         *regions = NULL,\n         *query_file_name = NULL,\n         *file_patterns_to_be_printed = NULL,\n         *query_filter_string = NULL;\n\n\n    char *i_type = \"i\";\n\n    int i_is_set = 0,\n        l_is_set = 0,\n        r_is_set = 0,\n        q_is_set = 0,\n        c_is_set = 0,\n        s_is_set = 0,\n        v_is_set = 0,\n        f_is_set = 0,\n        o_is_set = 0,\n        m_is_set = 0,\n        u_is_set = 0;\n\n    double genome_size =  3095677412.0;\n\n    //{{{ cmd line param parsing\n    //{{{ while((c = getopt (argc, argv, \"i:r:q:cvf:h\")) != -1) {\n    while((c = getopt (argc, argv, \"i:r:q:u:csvomf:g:lh\")) != -1) {\n        switch (c) {\n            case 'i':\n                i_is_set = 1;\n                index_dir_name = optarg;\n                break;\n            case 'r':\n                r_is_set = 1;\n                regions = optarg;\n                break;\n            case 'q':\n                q_is_set = 1;\n                query_file_name = optarg;\n                break;\n            case 'u':\n                u_is_set = 1;\n                query_filter_string = optarg;\n                break;\n            case 'c':\n                c_is_set = 1;\n                break;\n            case 's':\n                s_is_set = 1;\n                break;\n            case 'v':\n                v_is_set = 1;\n                break;\n            case 'o':\n                o_is_set = 1;\n                break;\n            case 'm':\n                m_is_set = 1;\n                break;\n            case 'f':\n                f_is_set = 1;\n                file_patterns_to_be_printed = optarg;\n                break;\n            case 'g':\n                genome_size =  atof(optarg);\n                break;\n            case 'l':\n                l_is_set = 1;\n                break;\n            case 'h':\n                return search_help(EX_OK);\n            case '?':\n                 if ( (optopt == 'i') ||\n                      (optopt == 'r') ||\n                      (optopt == 'q') ||\n                      (optopt == 'u') ||\n                      (optopt == 'f') )\n                        fprintf (stderr, \"Option -%c requires an argument.\\n\",\n                                optopt);\n                    else if (isprint (optopt))\n                        fprintf (stderr, \"Unknown option `-%c'.\\n\", optopt);\n                    else\n                    fprintf(stderr,\n                            \"Unknown option character `\\\\x%x'.\\n\",\n                            optopt);\n                return search_help(EX_USAGE);\n            default:\n                return search_help(EX_OK);\n        }\n    }\n    //}}}\n\n    if (i_is_set == 0) {\n        fprintf(stderr, \"Index directory is not set\\n\");\n        return search_help(EX_USAGE);\n    } \n\n    if (l_is_set == 1) {\n        char **names = NULL;\n        uint32_t *num_intervals = NULL;\n        double *mean_interval_sizes = NULL;\n        uint32_t num_files = giggle_get_indexed_files(index_dir_name,\n                                                      &names,\n                                                      &num_intervals,\n                                                      &mean_interval_sizes);\n        uint32_t i;\n        printf(\"File name\\tNumber of intervals\\tMean interval size\\n\");\n        for (i = 0; i < num_files; ++i) {\n            printf(\"%s\\t%u\\t%lf\\n\",\n                   names[i],\n                   num_intervals[i],\n                   mean_interval_sizes[i]);\n            free(names[i]);\n        }\n        free(names);\n        free(num_intervals);\n        free(mean_interval_sizes);\n        return EX_OK;\n    } \n\n    if ( (s_is_set == 1) && (q_is_set ==0)) {\n        fprintf(stderr, \"Significance testing requires a query file input\\n\");\n        return search_help(EX_USAGE);\n    }\n\n    // need either a regions or a query file, but not both\n    if ((r_is_set == 0) && (q_is_set == 0)) {\n        fprintf(stderr, \"Neither regions nor query file is set\\n\");\n        return search_help(EX_USAGE);\n    } if ((r_is_set == 1) && (q_is_set == 1)) {\n        fprintf(stderr, \"Both regions and query file is set\\n\");\n        return search_help(EX_USAGE);\n    }\n\n    if ((u_is_set == 1) && (m_is_set == 0)) {\n        fprintf(stderr, \"Query filter needs metadata index\\n\");\n        return search_help(EX_USAGE);\n    }\n\n    if ((v_is_set == 0) && (s_is_set == 0))\n        c_is_set = 1;\n    //}}}\n\n    uint32_t num_file_patterns = 0;\n    regex_t *regexs = NULL;\n    char **file_patterns = NULL;\n\n    //{{{ comiple file name regexs\n    if (f_is_set == 1) {\n        int s = 0, e = 0;\n        while (scan_s(file_patterns_to_be_printed,\n                      strlen(file_patterns_to_be_printed),\n                      &s,\n                      &e,\n                      ',') >= 0) {\n            num_file_patterns += 1;\n            s = e + 1;\n        }\n\n        if (num_file_patterns == 0) {\n            fprintf(stderr, \"No file patterns detected.\\n\");\n            return search_help(EX_USAGE);\n        }\n\n        regexs = (regex_t *)\n                malloc(num_file_patterns * sizeof(regex_t));\n        if (regexs == NULL)\n            err(1, \"malloc error  in search_main().\");\n\n        file_patterns = (char **)\n                malloc(num_file_patterns * sizeof(char *));\n        if (file_patterns == NULL)\n            err(1, \"malloc error  in search_main().\");\n\n        uint32_t i = 0;\n        s = 0;\n        e = 0;\n        while (scan_s(file_patterns_to_be_printed,\n                      strlen(file_patterns_to_be_printed),\n                      &s,\n                      &e,\n                      ',') >= 0) {\n            file_patterns[i] = strndup(file_patterns_to_be_printed + s, e-s);\n            int r = regcomp(&(regexs[i]), file_patterns[i], 0);\n            if (r != 0) {\n                errx(EX_USAGE,\n                     \"Could not compile regex '%s'\",\n                     file_patterns[i]);\n            }\n            i += 1;\n            s = e + 1;\n        }\n    }\n    //}}}\n\n    struct giggle_index *gi =\n                giggle_load_with_metadata(index_dir_name,\n                                          m_is_set,\n                                          block_store_giggle_set_data_handler);\n\n    if (gi == NULL)\n        errx(1, \"Error loading giggle index %s.\", index_dir_name);\n\n    struct query_filter *query_filter = NULL;\n    if (query_filter_string != NULL) {\n        query_filter = parse_query_filter_string(gi->metadata_idx, query_filter_string);\n        // print_query_filter(query_filter);\n    }\n\n    struct giggle_query_result *gqr = NULL;\n\n    uint32_t num_intervals = 0;\n    double mean_interval_size = 0.0;\n\n    if (r_is_set == 1) {\n        // search the list of regions\n        uint32_t i, last = 0, len = strlen(regions);\n        char *chrm;\n        uint32_t start, end;\n        int ret;\n        for (i = 0; i <= len; ++i) {\n            if ((regions[i] == ',') || (regions[i] == '\\0') ) {\n                regions[i] = '\\0';\n                char *region;\n                ret = asprintf(&region, \"%s\", regions + last);\n                if (parse_region(region, &chrm, &start, &end) == 0) {\n                    gqr = giggle_query_with_query_filter(gi, chrm, start, end, query_filter, gqr);\n                    free(region);\n                } else {\n                    errx(EX_USAGE,\n                         \"Error parsing region '%s'\\n\",\n                         regions + last);\n                }\n                last = i + 1;\n            }\n        }\n    } else if (q_is_set == 1) {\n        // search a file\n        int chrm_len = 50;\n        char *chrm = (char *)malloc(chrm_len*sizeof(char));\n        if (chrm == NULL)\n            err(1, \"malloc error  in search_main().\");\n        uint32_t start, end;\n        long offset;\n        kstring_t line = {0, 0, NULL};\n\n        struct input_file *q_f = input_file_init(query_file_name);\n        if (q_f == NULL)\n            errx(1, \"Error loading query file %s.\", query_file_name);\n\n        while ( q_f->input_file_get_next_interval(q_f, \n                                                  &chrm,\n                                                  &chrm_len,\n                                                  &start,\n                                                  &end,\n                                                  &offset,\n                                                  &line) >= 0 ) {\n            gqr = giggle_query_with_query_filter(gi, chrm, start, end, query_filter, gqr);\n            if ( (o_is_set == 1) && (gqr->num_hits > 0) ) {\n                char *str;\n                input_file_get_curr_line_bgzf(q_f, &str);\n                printf(\"##%s\",str);\n                // Ugh\n                if (q_f->type == BED)\n                    printf(\"\\n\");\n                int r = print_giggle_query_result(gqr,\n                                                  gi,\n                                                  regexs,\n                                                  file_patterns,\n                                                  num_file_patterns,\n                                                  num_intervals,\n                                                  mean_interval_size,\n                                                  genome_size,\n                                                  f_is_set,\n                                                  v_is_set,\n                                                  c_is_set,\n                                                  s_is_set,\n                                                  o_is_set);\n                giggle_query_result_destroy(&gqr);\n            }\n            num_intervals += 1;\n            mean_interval_size += end - start;\n        }\n\n        free(chrm);\n        if (line.s != NULL)\n            free(line.s);\n\n        mean_interval_size = mean_interval_size/num_intervals;\n    }\n\n\n    int r = print_giggle_query_result(gqr,\n                                      gi,\n                                      regexs,\n                                      file_patterns,\n                                      num_file_patterns,\n                                      num_intervals,\n                                      mean_interval_size,\n                                      genome_size,\n                                      f_is_set,\n                                      v_is_set,\n                                      c_is_set,\n                                      s_is_set,\n                                      o_is_set);\n\n    giggle_query_result_destroy(&gqr);\n    if (query_filter)\n        query_filter_destroy(&query_filter);\n    giggle_index_destroy(&gi);\n    cache.destroy();\n    free(full_cmd);\n    return r;\n}\n"
  },
  {
    "path": "src/search_file.c",
    "content": "#include <stdlib.h>\n#include <stdio.h>\n#include <err.h>\n#include <string.h>\n#include <htslib/kstring.h>\n\n#include \"util.h\"\n#include \"giggle_index.h\"\n#include \"wah.h\"\n#include \"cache.h\"\n#include \"file_read.h\"\n#include \"kfunc.h\"\n#include \"ll.h\"\n\n\nint main(int argc, char **argv)\n{\n    WAH_SIZE = 32;\n    WAH_MAX_FILL_WORDS = (1<<(WAH_SIZE-1)) - 1;\n\n    uint32_t num_chrms = 100;\n\n    if ((argc != 4)) {\n        errx(1,\n             \"usage:\\t%s <input file> <index dir> <w|i>\",\n             argv[0]);\n    }\n\n    double genome_size =  3095677412.0;\n\n    char *input_file = argv[1];\n    char *index_dir = argv[2];\n    char *i_type = argv[3];\n\n    struct input_file *in_f = input_file_init(input_file);\n\n    int chrm_len = 50;\n    char *chrm = (char *)malloc(chrm_len*sizeof(char));\n    uint32_t start, end;\n    long offset;\n    kstring_t line = {0, 0, NULL};\n\n    struct giggle_index *gi;\n\n    gi = giggle_load(index_dir,\n                     uint64_t_ll_giggle_set_data_handler);\n\n    struct long_ll **offsets = (struct long_ll **)\n            calloc(gi->file_idx->index->num, sizeof(struct long_ll *));\n\n    uint32_t i,j;\n\n    for (i = 0; i < gi->file_idx->index->num; ++i)\n        offsets[i] = NULL;\n\n\n    uint32_t num_intervals = 0;\n    while ( in_f->input_file_get_next_interval(in_f, \n                                               &chrm,\n                                               &chrm_len,\n                                               &start,\n                                               &end,\n                                               &offset,\n                                               &line) >= 0 ) {\n        struct uint64_t_ll *R =\n                (struct uint64_t_ll *)giggle_query_region(gi,\n                                                          chrm,\n                                                          start,\n                                                          end);\n        if (R != NULL) {\n            struct uint64_t_ll_node *curr = R->head;\n\n            uint32_t count = 0;\n            while (curr != NULL) {\n                struct file_id_offset_pair fid_off = \n                    offset_index_get(gi->offset_idx, curr->val);\n                    //gi->offset_idx->index->vals[curr->val];\n\n                long_ll_append(&(offsets[fid_off.file_id]),fid_off.offset);\n\n                curr = curr->next;\n            }\n            uint64_t_ll_free((void **)&R);\n            R=NULL;\n        } \n        num_intervals += 1;\n    }\n\n    if (line.s != NULL)\n        free(line.s);\n\n    uint32_t sorted_offsets_num = num_intervals * 2;\n    long *sorted_offsets = (long *)malloc(sorted_offsets_num*sizeof(long));\n    for (i = 0; i < gi->file_idx->index->num; ++i) {\n\n        struct file_data *fd = file_index_get(gi->file_idx, i);\n\n        printf(\"#\\t%s\\t\", fd->file_name);\n\n        if (offsets[i] == NULL) {\n            printf(\"0\\n\");\n            continue;\n        } else {\n            printf(\"%llu\\n\", offsets[i]->len);\n        }\n\n       \n        if (sorted_offsets_num < offsets[i]->len) {\n            sorted_offsets_num = offsets[i]->len * 2;\n            sorted_offsets = (long *)realloc(sorted_offsets,\n                                             sorted_offsets_num*sizeof(long));\n        }\n    \n        j = 0;\n        struct long_ll_node *curr = offsets[i]->head;\n        while (curr != NULL) {\n            sorted_offsets[j++] = curr->val;\n            curr = curr->next;\n        }\n\n        qsort(sorted_offsets, offsets[i]->len, sizeof(long), long_cmp);\n\n        struct input_file *ipf = input_file_init(fd->file_name);\n\n\n        char *str;\n        for (j = 0; j < offsets[i]->len; ++j) {\n            ipf->input_file_seek(ipf, sorted_offsets[j]);\n            ipf->input_file_get_next_line(ipf,\n                                          &str);\n            printf(\"%s\\n\", str);\n        }\n\n        input_file_destroy(&ipf);\n    }\n\n    giggle_index_destroy(&gi);\n    cache.destroy();\n}\n"
  },
  {
    "path": "src/server_enrichment.c",
    "content": "#define _GNU_SOURCE\n#include <sys/types.h>\n#include <sys/select.h>\n#include <sys/socket.h>\n#include <stdio.h>\n#include <stdlib.h>\n#include <string.h>\n#include <microhttpd.h>\n#include <regex.h>\n#include <err.h>\n#include <sysexits.h>\n#include <htslib/kstring.h>\n#include <math.h>\n#include <getopt.h>\n#include <ctype.h>\n\n#include \"util.h\"\n#include \"giggle_index.h\"\n#include \"file_read.h\"\n#include \"ll.h\"\n#include \"kfunc.h\"\n\n\n#define MAX(X, Y) (((X) > (Y)) ? (X) : (Y))\n\n//#define PORT            8888\n#define POSTBUFFERSIZE  512\n#define MAXCLIENTS      2\n\n#define GET             0\n#define POST            1\n\nstruct region\n{\n    char *chrm;\n    uint32_t start, end;\n};\n\nstruct query_file\n{\n    char *file_name;\n};\n\nstruct request\n{\n    int success;\n    union {\n        struct region *reg;\n        struct query_file *query;\n    } data;\n    enum {\n        REQUEST_QUERY_FILE,\n        REQUEST_REGION,\n        REQUEST_DATA\n    } type;\n    uint32_t full;\n    char *file_patterns_to_be_printed;\n};\n\nstruct args {\n    struct giggle_index *gi;\n    char *data_def;\n    char *upload_dir;\n};\n\nstatic unsigned int nr_of_uploading_clients = 0;\n\nstruct connection_info_struct\n{\n  int connectiontype;\n  struct MHD_PostProcessor *postprocessor;\n  FILE *fp;\n  char *file_name;\n  const char *answerstring;\n  int answercode;\n  struct args *arg;\n};\n\n//{{{ static page data\nconst char *askpage = \"<html><body>\\n\\\n                       Upload a file, please!<br>\\n\\\n                       There are %u clients uploading at the moment.<br>\\n\\\n                       <form action=\\\"/filepost\\\" method=\\\"post\\\" enctype=\\\"multipart/form-data\\\">\\n\\\n                       <input name=\\\"file\\\" type=\\\"file\\\">\\n\\\n                       <input type=\\\"submit\\\" value=\\\" Send \\\"></form>\\n\\\n                       </body></html>\";\n\nconst char *busypage =\n  \"<html><body>This server is busy, please try again later.</body></html>\";\n\nconst char *completepage =\n  \"<html><body>The upload has been completed.</body></html>\";\n\nconst char *errorpage =\n  \"<html><body>This doesn't seem to be right.</body></html>\";\nconst char *servererrorpage =\n  \"<html><body>An internal server error has occured.</body></html>\";\nconst char *fileexistspage =\n  \"<html><body>This file already exists.</body></html>\";\nconst char *queryfile_errorpage = \"QueryFileError\";\n//}}}\n\nint SET_ACCESS_CONTROL_HEADER = 0;\n\n//{{{ uint32_t parse_file_patterns(char *file_patterns_to_be_printed,\nuint32_t parse_file_patterns(char *file_patterns_to_be_printed,\n                             uint32_t *num_file_patterns,\n                             regex_t **regexs,\n                             char ***file_patterns)\n{\n    *num_file_patterns = 0;\n    int s = 0, e = 0;\n    while (scan_s(file_patterns_to_be_printed,\n                  strlen(file_patterns_to_be_printed),\n                  &s,\n                  &e,\n                  ',') >= 0) {\n        *num_file_patterns = (*num_file_patterns) + 1;\n        s = e + 1;\n    }\n\n    if (*num_file_patterns == 0) {\n        fprintf(stderr, \"No file patterns detected.\\n\");\n        return 0;\n    }\n\n    *regexs = (regex_t *)\n            malloc(*num_file_patterns * sizeof(regex_t));\n    if (*regexs == NULL)\n        err(1, \"malloc error in parse_file_patterns().\");\n\n    *file_patterns = (char **)\n            malloc(*num_file_patterns * sizeof(char *));\n    if (*file_patterns == NULL)\n        err(1, \"malloc error in parse_file_patterns().\");\n    uint32_t i = 0;\n    s = 0;\n    e = 0;\n    while (scan_s(file_patterns_to_be_printed,\n                  strlen(file_patterns_to_be_printed),\n                  &s,\n                  &e,\n                  ',') >= 0) {\n        (*file_patterns)[i] = strndup(file_patterns_to_be_printed + s, e-s);\n        fprintf(stderr, \"%s\\n\", (*file_patterns)[i]);\n        int r = regcomp(&((*regexs)[i]), (*file_patterns)[i], 0);\n        if (r != 0) {\n            fprintf(stderr, \n                    \"Could not compile regex '%s'\",\n                    (*file_patterns)[i]);\n            return 0;\n        }\n        i += 1;\n        s = e + 1;\n    }\n\n    return 1;\n}\n//}}}\n\n//{{{ struct query_file *init_query_file()\nstruct query_file *init_query_file()\n{\n\n    struct query_file *q = (struct query_file *)\n            malloc(sizeof(struct query_file));\n    if (q == NULL)\n        err(1, \"malloc error in init_query_file().\");\n\n    q->file_name = NULL;\n    return q;\n}\n//}}}\n\n//{{{ struct region *init_region()\nstruct region *init_region()\n{\n    struct region *r = (struct region *)malloc(sizeof(struct region));\n    if (r == NULL)\n        err(1, \"malloc error in init_region().\");\n\n    r->chrm = NULL;\n    return r;\n}\n//}}}\n\n//{{{ int scan_url_vals(void *cls,\nint scan_url_vals(void *cls,\n                  enum MHD_ValueKind kind,\n                  const char *key,\n                  const char *value)\n{\n    struct request *r = (struct request *)cls;\n\n    if ((key != NULL)) {\n        if (strncmp(\"data\", key, 6) == 0) {\n            fprintf(stderr, \"scan_url_vals: data\\n\");\n            r->type = REQUEST_DATA;\n            r->success = 1;\n        } else if (strncmp(\"region\", key, 6) == 0) {\n            fprintf(stderr, \"scan_url_vals: region\\n\");\n            r->type = REQUEST_REGION;\n            if (value != NULL) {\n                if (r->data.reg == NULL)\n                    r->data.reg = init_region();\n                if (parse_region((char *)value,\n                                 &(r->data.reg->chrm), \n                                 &(r->data.reg->start),\n                                 &(r->data.reg->end)) == 0) {\n                    r->success = 1;\n                }\n            } \n        } else if (strncmp(\"query\", key, 6) == 0) {\n            fprintf(stderr, \"scan_url_vals: query\\n\");\n            r->type = REQUEST_QUERY_FILE;\n            if (value != NULL) {\n                if (r->data.query == NULL)\n                    r->data.query = init_query_file();\n\n\t\tr->data.query->file_name = strdup(value);\n                r->success = 1;\n            } \n        } else if (strncmp(\"files\", key, 5) == 0) {\n            fprintf(stderr, \"scan_url_vals: file\\n\");\n            r->file_patterns_to_be_printed  =\n                    (char *)malloc((strlen(value)+1) * sizeof(char));\n            if (r->file_patterns_to_be_printed == NULL)\n                err(1, \"malloc error in scan_url_vals().\");\n\n            strcpy(r->file_patterns_to_be_printed, value);\n#if 0\n            if (r->data.reg == NULL)\n                r->data.reg = init_region();\n            if (value != NULL) {\n\n                //fprintf(stderr, \"files:%s\\n\", value);\n                r->data.reg->file_patterns_to_be_printed = \n                    (char *)malloc((strlen(value)+1) * sizeof(char));\n                strcpy(r->data.reg->file_patterns_to_be_printed, value);\n            }\n#endif\n        } else if (strncmp(\"full\", key, 5) == 0) {\n            fprintf(stderr, \"scan_url_vals: full\\n\");\n            r->full = 1;\n        }\n    }\n\n    return MHD_YES;\n}\n//}}}\n\n//{{{ static int send_page (struct MHD_Connection *connection,\nstatic int send_page (struct MHD_Connection *connection,\n                      const char *page,\n                      int status_code,\n                      const char *type)\n{\nfprintf(stderr, \"%s\\n\", type);\n    int ret;\n    struct MHD_Response *response;\n\n    response = MHD_create_response_from_buffer(strlen (page),\n                                               (void *) page,\n                                               MHD_RESPMEM_MUST_COPY);\n    if (!response)\n        return MHD_NO;\n\n    if (SET_ACCESS_CONTROL_HEADER != 0 ) \n        MHD_add_response_header(response,\n                                MHD_HTTP_HEADER_ACCESS_CONTROL_ALLOW_ORIGIN,\n                                \"*\");\n\n    MHD_add_response_header (response, MHD_HTTP_HEADER_CONTENT_TYPE, type);\n    ret = MHD_queue_response (connection, status_code, response);\n    MHD_destroy_response (response);\n\n    return ret;\n}\n//}}}\n\n//{{{static int iterate_post(void *coninfo_cls,\nstatic int iterate_post(void *coninfo_cls,\n                        enum MHD_ValueKind kind,\n                        const char *key,\n                        const char *filename,\n                        const char *content_type,\n                        const char *transfer_encoding,\n                        const char *data,\n                        uint64_t off,\n                        size_t size)\n{\n    struct connection_info_struct *con_info = coninfo_cls;\n    FILE *fp;\n\n    int ret = asprintf(&(con_info->file_name),\n                       \"%s/%s\",\n                       con_info->arg->upload_dir,\n                       filename);\n\n    con_info->answerstring = servererrorpage;\n    con_info->answercode = MHD_HTTP_INTERNAL_SERVER_ERROR;\n\n    if (strcmp(key, \"file\") != 0)\n        return MHD_NO;\n\n    if (!con_info->fp) {\n        // Do not overwrite a file of the same name\n        /* \n        if (NULL != (fp = fopen (con_info->file_name, \"rb\"))) {\n            fclose (fp);\n            con_info->answerstring = fileexistspage;\n            con_info->answercode = MHD_HTTP_FORBIDDEN;\n            return MHD_NO;\n        }\n        */\n\n        con_info->fp = fopen (con_info->file_name, \"ab\");\n        if (!con_info->fp)\n            return MHD_NO;\n    }\n\n    if (size > 0) {\n        if (!fwrite (data, size, sizeof (char), con_info->fp))\n            return MHD_NO;\n    }\n\n    con_info->answerstring = completepage;\n    con_info->answercode = MHD_HTTP_OK;\n\n    return MHD_YES;\n}\n//}}}\n\n//{{{static void request_completed (void *cls,\nstatic void request_completed (void *cls,\n                               struct MHD_Connection *connection,\n                               void **con_cls,\n                               enum MHD_RequestTerminationCode toe)\n{\n  struct connection_info_struct *con_info = *con_cls;\n\n  if (NULL == con_info)\n    return;\n\n  if (con_info->connectiontype == POST)\n    {\n      if (NULL != con_info->postprocessor)\n        {\n          MHD_destroy_post_processor (con_info->postprocessor);\n          nr_of_uploading_clients--;\n        }\n\n      if (con_info->fp)\n        fclose (con_info->fp);\n    }\n\n  free (con_info);\n  *con_cls = NULL;\n}\n//}}}\n\n//{{{static int answer_to_connection (void *cls,\nstatic int answer_to_connection (void *cls,\n                                 struct MHD_Connection *connection,\n                                 const char *url,\n                                 const char *method,\n                                 const char *version,\n                                 const char *upload_data,\n                                 size_t *upload_data_size,\n                                 void **con_cls)\n{\n    struct args *arg = (struct args*) cls;\n\n    \n    //{{{ set up the connection info if it is null\n    if (NULL == *con_cls) {\n        struct connection_info_struct *con_info;\n\n        if (nr_of_uploading_clients >= MAXCLIENTS)\n            return send_page(connection,\n                             busypage,\n                             MHD_HTTP_SERVICE_UNAVAILABLE,\n                             \"text/html\");\n\n        con_info = malloc (sizeof (struct connection_info_struct));\n        if (con_info == NULL)\n            err(1, \"malloc error in answer_to_connection().\");\n        con_info->arg = arg;\n        if (NULL == con_info)\n            return MHD_NO;\n\n        con_info->fp = NULL;\n\n        if (0 == strcmp(method, \"POST\")) {\n            con_info->postprocessor =\n                    MHD_create_post_processor(connection,\n                                              POSTBUFFERSIZE,\n                                              iterate_post,\n                                              (void *)con_info);\n\n            if (NULL == con_info->postprocessor) {\n                free (con_info);\n                return MHD_NO;\n            }\n\n            nr_of_uploading_clients++;\n\n            con_info->connectiontype = POST;\n            con_info->answercode = MHD_HTTP_OK;\n            con_info->answerstring = completepage;\n        } else {\n            con_info->connectiontype = GET;\n        }\n\n        *con_cls = (void *) con_info;\n\n        return MHD_YES;\n    }\n    //}}}\n\n    //{{{GET\n    if (strcmp(method, \"GET\") == 0) {\n        struct request r;\n        r.success = 0;\n        r.data.reg = NULL;\n        r.file_patterns_to_be_printed = NULL;\n        r.full = 0;\n\n        uint32_t file_patterns_set_is_set = 0;\n        uint32_t num_file_patterns = 0;\n        regex_t *regexs = NULL;\n        char **file_patterns = NULL;\n\n        struct MHD_Response *response;\n        int ret = 0;\n\n        int num_vals = MHD_get_connection_values(connection,\n                                                 MHD_GET_ARGUMENT_KIND,\n                                                 scan_url_vals,\n                                                 &r);\n\n        if (num_vals == 0) {\n            //{{{ empty request\n            char buffer[1024];\n            snprintf(buffer,\n                     sizeof (buffer),\n                     askpage,\n                     nr_of_uploading_clients);\n            return send_page (connection, buffer, MHD_HTTP_OK,\"text/html\");\n            //}}}\n        } else if (r.success == 1) {\n            if (r.type == REQUEST_DATA) {\n                //{{{ asking for data def\n                size_t l = strlen(arg->data_def);\n\n                return send_page(connection,\n                                 arg->data_def,\n                                 MHD_HTTP_OK,\n                                 \"text/json\");\n                //}}}\n            } else if ( (r.type == REQUEST_REGION) || \n\t\t\t(r.type == REQUEST_QUERY_FILE)) {\n\n                // check/get file patterns to print\n                //char *file_patterns_to_be_printed = NULL;\n                uint32_t full = r.full;\n\n                if (r.file_patterns_to_be_printed != NULL) {\n                    fprintf(stderr,\n                            \"files:%s\\n\",\n                            r.file_patterns_to_be_printed);\n\n                    file_patterns_set_is_set = \n                            parse_file_patterns(r.file_patterns_to_be_printed,\n                                                &num_file_patterns,\n                                                &regexs,\n                                                &file_patterns);\n\n                }\n\n                fprintf(stderr,\n                        \"file_patterns_set_is_set:%u\\n\",\n                        file_patterns_set_is_set);\n\n                struct giggle_index *gi = arg->gi;\n                struct giggle_query_result *gqr = NULL;\n\n                // used with query file\n                uint32_t num_intervals = 0;\n                double mean_interval_size = 0.0;\n                double genome_size =  3095677412.0;\n\n                if (r.type == REQUEST_REGION) {\n                    struct region *reg = r.data.reg;\n\n                    fprintf(stderr,\n                            \"c:%s s:%u e:%u\\n\",\n                            reg->chrm,\n                            reg->start,\n                            reg->end);\n\n                    gqr = giggle_query(gi,\n                                       reg->chrm,\n                                       reg->start,\n                                       reg->end,\n                                       NULL);\n                } else {\n                    struct query_file *q = r.data.query;\n\n                    int chrm_len = 50;\n                    char *chrm = (char *)malloc(chrm_len*sizeof(char));\n                    if (chrm == NULL)\n                        err(1, \"malloc error in answer_to_connection().\");\n\n                    uint32_t start, end;\n                    long offset;\n\n                    char *full_path = NULL;\n                    int ret = asprintf(&full_path,\n                                       \"%s/%s\",\n                                       arg->upload_dir,\n                                       q->file_name);\n\n                    struct input_file *q_f = input_file_init(full_path);\n                    if (q_f == NULL) {\n                        fprintf(stderr, \"Error with file %s.\\n\", full_path);\n                \treturn send_page (connection, queryfile_errorpage, MHD_HTTP_OK, \"text/html\");\n                    }\n\n                    free(full_path);\n\n                    kstring_t line = {0, 0, NULL};\n                    while ( q_f->input_file_get_next_interval(q_f, \n                                                              &chrm,\n                                                              &chrm_len,\n                                                              &start,\n                                                              &end,\n                                                              &offset,\n                                                              &line) >= 0 ) {\n                        gqr = giggle_query(gi,\n                                           chrm,\n                                           start,\n                                           end,\n                                           gqr);\n                        num_intervals += 1;\n                        mean_interval_size += end - start;\n                    }\n\n                    if (line.s != NULL)\n                        free(line.s);\n\n                    input_file_destroy(&q_f);\n                    mean_interval_size = mean_interval_size/num_intervals;\n                }\n\n                uint32_t i, printed_i = 0;\n                char *page = NULL, *tmp_page = NULL;;\n                for(i = 0; i < gqr->num_files; i++) {\n                    struct file_data *fd = \n                            file_index_get(gi->file_idx, i);\n                        //(struct file_data *)\n                        //unordered_list_get(gi->file_index, i); \n\n                    giggle_get_query_len(gqr, i);\n                    if (test_pattern_match(gi,\n                                           regexs,\n                                           file_patterns,\n                                           num_file_patterns,\n                                           i,\n                                           file_patterns_set_is_set)) {\n                        if (printed_i == 0) {\n                            int ret = asprintf(&tmp_page,\n                                               \"#%s\\t\"\n                                               \"%u\\t\"\n                                               \"%u\\n\",\n                                               fd->file_name,\n                                               fd->num_intervals,\n                                               giggle_get_query_len(gqr, i));\n                        } else {\n                            int ret = asprintf(&tmp_page,\n                                               \"%s\"\n                                               \"#%s\\t\"\n                                               \"%u\\t\"\n                                               \"%u\\n\",\n                                               page,\n                                               fd->file_name,\n                                               fd->num_intervals,\n                                               giggle_get_query_len(gqr, i));\n                        }\n\n                            fprintf(stderr,\n                                    \"#%s\\t\"\n                                    \"%u\\t\"\n                                    \"%u\\n\",\n                                    fd->file_name,\n                                    fd->num_intervals,\n                                    giggle_get_query_len(gqr, i));\n\n\n                        free(page);\n                        page = tmp_page;\n\n                        if ( (full == 1) && \n                             (giggle_get_query_len(gqr, i) > 0 )){\n\n                            char *result = NULL;\n\n                            struct giggle_query_iter *gqi =\n                                    giggle_get_query_itr(gqr, i);\n                            while (giggle_query_next(gqi, &result) == 0) {\n                                int ret = asprintf(&tmp_page,\n                                                   \"%s%s\\n\",\n                                                   page,\n                                                   result);\n                                free(page);\n                                page = tmp_page;\n                            }\n                            giggle_iter_destroy(&gqi);\n                        }\n                        printed_i += 1;\n                    }\n                }\n\n                if (page == NULL) {\n                    page = (char *)malloc(sizeof (char));\n                    if (page == NULL)\n                        err(1, \"malloc error in answer_to_connection().\");\n\n                    page[0] = '\\0';\n                }\n\n                giggle_query_result_destroy(&gqr);\n\n                if (r.type == REQUEST_REGION) {\n                    free(r.data.reg->chrm);\n                    free(r.data.reg);\n                    r.data.reg = NULL;\n                } else {\n                    free(r.data.query->file_name);\n                    free(r.data.query);\n                    r.data.query = NULL;\n                }\n\n                if (r.file_patterns_to_be_printed != NULL) {\n                    free(r.file_patterns_to_be_printed);\n                    r.file_patterns_to_be_printed = NULL;\n                }\n                r.full = 0;\n\n\n                int ret = send_page(connection,\n                                    page,\n                                    MHD_HTTP_OK,\n                                    \"text/txt\");\n                free(page);\n                return ret;\n            }\n        }\n        return 0;\n    }\n    //}}}\n\n    //{{{ POST \n    if (0 == strcmp (method, \"POST\")) {\n        struct connection_info_struct *con_info = *con_cls;\n\n\tfprintf(stderr, \"upload_data_size: %zu\\n\", *upload_data_size);\n\n        if (0 != *upload_data_size) {\n            MHD_post_process(con_info->postprocessor,\n                             upload_data,\n                            *upload_data_size);\n            *upload_data_size = 0;\n\n            return MHD_YES;\n        } else {\n\t\t\n            fprintf(stderr, \"1\\n\");\n            if (NULL != con_info->fp) {\n                fclose (con_info->fp);\n\t\tcon_info->fp = NULL;\n\t    }\n          /* Now it is safe to open and inspect the file before calling\n           * send_page with a response */\n\n            int chrm_len = 50;\n            char *chrm = (char *)malloc(chrm_len*sizeof(char));\n            if (chrm == NULL)\n                err(1, \"malloc error in answer_to_connection().\");\n\n            uint32_t start, end;\n            long offset;\n            uint32_t num_intervals = 0;\n            double mean_interval_size = 0.0;\n            double genome_size =  3095677412.0;\n\n            //uint32_t num_file_patterns = 0;\n            //regex_t *regexs = NULL;\n            //char **file_patterns = NULL;\n\n\n            struct input_file *q_f = input_file_init(con_info->file_name);\n            if (q_f == NULL) {\n                fprintf(stderr, \"Error with file %s.\\n\", con_info->file_name);\n                return send_page (connection, queryfile_errorpage, MHD_HTTP_OK, \"text/html\");\n            }\n\n            struct giggle_query_result *gqr = NULL;\n\n            kstring_t line = {0, 0, NULL};\n            while ( q_f->input_file_get_next_interval(q_f, \n                                                     &chrm,\n                                                     &chrm_len,\n                                                     &start,\n                                                     &end,\n                                                     &offset,\n                                                     &line) >= 0 ) {\n                gqr = giggle_query(con_info->arg->gi, chrm, start, end, gqr);\n                num_intervals += 1;\n                mean_interval_size += end - start;\n            }\n\n            if (line.s != NULL)\n                free(line.s);\n\n            input_file_destroy(&q_f);\n\n            mean_interval_size = mean_interval_size/num_intervals;\n\n            uint32_t i,j;\n\n            char *page = NULL, *tmp_page = NULL;;\n\n            for(i = 0; i < gqr->num_files; i++) {\n                struct file_data *fd = \n                        file_index_get(con_info->arg->gi->file_idx, i); \n                        //(struct file_data *)\n                        //unordered_list_get(con_info->arg->gi->file_index, i); \n\n                uint32_t file_counts = giggle_get_query_len(gqr, i);\n\n                long long n11 = (long long)(file_counts);\n                long long n12;\n\n                if (file_counts > num_intervals) \n                    n12 = 0;\n                else\n                    n12 = num_intervals-file_counts;\n\n                fprintf(stderr, \"%lld %lld n12:%lld\\n\", file_counts, num_intervals, n12);\n\n                long long n12 = (long long)safe_subtract(num_intervals,file_counts);\n                long long n21 = (long long)safe_subtract(fd->num_intervals,file_counts);\n\n                double comp_mean = fd->mean_interval_size+mean_interval_size;\n\n                long long n22_full = (long long)\n                        MAX(n11 + n12 + n21, genome_size/comp_mean);\n                long long n22 = (long long)safe_subtract(n22_full, n11 + n12 + n21);\n\n\n                long double left, right, two;\n                long double r = _kt_fisher_exact(n11,\n                                                 n12,\n                                                 n21,\n                                                 n22,\n                                                 &left,\n                                                 &right,\n                                                 &two);\n                double ratio = \n                    (((double)n11/(double)n12) / ((double)n21/(double)n22));\n\n                if (i == 0) {\n                    int ret = asprintf(&tmp_page,\n                                       \"#%s\\t\"\n                                       \"size:%u\\t\"\n                                       \"overlaps:%u\\t\"\n                                       \"ratio:%f\\t\"\n                                       \"sig:%Lf\"\n                                       \"combo:%Lf\"\n                                       \"\\n\",\n                                       fd->file_name,\n                                       fd->num_intervals,\n                                       file_counts,\n                                       ratio,\n                                       right,\n                                       log2fc(ratio) * neglog10p(two));\n                } else {\n                    int ret = asprintf(&tmp_page,\n                                       \"%s\"\n                                       \"#%s\\t\"\n                                       \"size:%u\\t\"\n                                       \"overlaps:%u\\t\"\n                                       \"ratio:%f\\t\"\n                                       \"sig:%Lf\\t\"\n                                       \"combo:%Lf\"\n                                       \"\\n\",\n                                       page,\n                                       fd->file_name,\n                                       fd->num_intervals,\n                                       file_counts,\n                                       ratio,\n                                       right,\n                                       log2fc(ratio) * neglog10p(two));\n                }\n\n                free(page);\n                page = tmp_page;\n            }\n\n            int ret = send_page(connection,\n                                page,\n                                con_info->answercode,\n                                \"text/txt\");\n            free(page);\n\t    //void input_file_destroy(struct input_file **i);/\n            fprintf(stderr, \"2\\n\");\n\n            return ret;\n        }\n    }\n    //}}}\n    \n    return send_page (connection, errorpage, MHD_HTTP_BAD_REQUEST, \"text/html\");\n}\n//}}}\n\n//{{{int server_help(int exit_code)\nint server_help(int exit_code)\n{\n    fprintf(stderr,\n            \"usage: server_enrichment -i <index dir> -u <upload dir> -d <data definition> \"\n            \"-p <port> [options]\\n\"\n            \"         options:\\n\"\n            \"             -a Set Access-Control-Allow-Origin header to pages\\n\" );\n    return exit_code;\n}\n//}}}\n\n//{{{int main(int argc, char **argv)\nint main(int argc, char **argv)\n{\n    if (argc < 2) return server_help(EX_OK);\n\n    int i_is_set = 0,\n        u_is_set = 0,\n        d_is_set = 0,\n        p_is_set = 0,\n        a_is_set = 0;\n\n\n    char *index_dir_name = NULL,\n         *upload_dir_name = NULL,\n         *data_def_file_name = NULL;\n\n    uint32_t port = 0;\n\n    SET_ACCESS_CONTROL_HEADER = 0;\n\n    int c;\n    while((c = getopt (argc, argv, \"i:u:d:p:ah\")) != -1) {\n        switch(c) {\n            case 'i':\n                i_is_set = 1;\n                index_dir_name = optarg;\n                break;\n            case 'u':\n                u_is_set = 1;\n                upload_dir_name = optarg;\n                break;\n            case 'd':\n                d_is_set = 1;\n                data_def_file_name = optarg;\n                break;\n            case 'p':\n                p_is_set = 1;\n                port = atoi(optarg);\n                break;\n            case 'a':\n                a_is_set = 1;\n                SET_ACCESS_CONTROL_HEADER = 1;\n                break;\n            case '?':\n                 if ( (optopt == 'i') ||\n                      (optopt == 'u') ||\n                      (optopt == 'd') ||\n                      (optopt == 'p') )\n                        fprintf (stderr, \"Option -%c requires an argument.\\n\",\n                                optopt);\n                    else if (isprint (optopt))\n                        fprintf (stderr, \"Unknown option `-%c'.\\n\", optopt);\n                    else\n                    fprintf(stderr,\n                            \"Unknown option character `\\\\x%x'.\\n\",\n                            optopt);\n                return server_help(EX_USAGE);\n            default:\n                return server_help(EX_OK);\n        }\n    }\n\n    if (i_is_set == 0) {\n        fprintf(stderr, \"Index directory is not set\\n\");\n        return server_help(EX_USAGE);\n    }\n\n    if (u_is_set == 0) {\n        fprintf(stderr, \"Upload directory is not set\\n\");\n        return server_help(EX_USAGE);\n    }\n\n    if (d_is_set == 0) {\n        fprintf(stderr, \"Data def is not set\\n\");\n        return server_help(EX_USAGE);\n    }\n\n    if (p_is_set == 0) {\n        fprintf(stderr, \"Port is not set\\n\");\n        return server_help(EX_USAGE);\n    }\n\n\n    FILE *fp = fopen(data_def_file_name, \"r\");\n    if (!fp)\n        err(1, \"Could not open header file '%s'\", data_def_file_name);\n    fseek(fp, 0, SEEK_END);\n    long data_def_size = ftell(fp);\n    fseek(fp, 0, SEEK_SET);\n    char *data_def = (char *)malloc((data_def_size + 1)*sizeof(char));\n    if (data_def == NULL)\n        err(1, \"malloc error in main().\");\n\n    int ret = fread(data_def, data_def_size, 1, fp);\n    data_def[data_def_size] = '\\0';\n    fclose(fp);\n\n    struct args *arg = (struct args *)malloc(sizeof(struct args));\n    if (arg == NULL)\n        err(1, \"malloc error in main().\");\n\n    arg->data_def = data_def;\n    arg->upload_dir = upload_dir_name;\n\n    arg->gi = giggle_load(index_dir_name,\n                          block_store_giggle_set_data_handler);\n\n    struct MHD_Daemon *daemon;\n\n    daemon = MHD_start_daemon (MHD_USE_SELECT_INTERNALLY,\n                               port,\n                               NULL,\n                               NULL,\n                               &answer_to_connection,\n                               arg,\n                               MHD_OPTION_NOTIFY_COMPLETED,\n                               request_completed,\n                               NULL,\n                               MHD_OPTION_END);\n    if (NULL == daemon) return 1;\n\n    getchar (); \n    \n    free(arg->data_def);\n    giggle_index_destroy(&(arg->gi));\n    cache.destroy();\n    MHD_stop_daemon (daemon);\n    return 0;\n}\n//}}}\n"
  },
  {
    "path": "src/server_overlap.c",
    "content": "#include <string.h>\n#include <stdio.h>\n#include <stdlib.h>\n#include <sys/types.h>\n#include <sys/select.h>\n#include <sys/socket.h>\n#include <microhttpd.h>\n#include <regex.h>\n#include <err.h>\n\n#include \"util.h\"\n#include \"giggle_index.h\"\n#include \"file_read.h\"\n#include \"ll.h\"\n\nstruct region\n{\n    char *chrm;\n    uint32_t start, end;\n    char *file_patterns_to_be_printed;\n    uint32_t full;\n};\n\nstruct request\n{\n    int success;\n    union {\n        struct region *reg;\n    } data;\n    enum {\n        REQUEST_REGION,\n        REQUEST_DATA\n    } type;\n};\n\nstruct args {\n    struct giggle_index *gi;\n    char *data_def;\n};\n\n//{{{ struct region *init_region()\nstruct region *init_region()\n{\n    struct region *r = (struct region *)malloc(sizeof(struct region));\n    r->chrm = NULL;\n    r->file_patterns_to_be_printed = NULL;\n    r->full = 0;\n\n    return r;\n}\n//}}}\n\n//{{{ uint32_t parse_file_patterns(char *file_patterns_to_be_printed,\nuint32_t parse_file_patterns(char *file_patterns_to_be_printed,\n                             uint32_t *num_file_patterns,\n                             regex_t **regexs,\n                             char ***file_patterns)\n{\n    *num_file_patterns = 0;\n    int s = 0, e = 0;\n    while (scan_s(file_patterns_to_be_printed,\n                  strlen(file_patterns_to_be_printed),\n                  &s,\n                  &e,\n                  ',') >= 0) {\n        *num_file_patterns = (*num_file_patterns) + 1;\n        s = e + 1;\n    }\n\n    if (*num_file_patterns == 0) {\n        fprintf(stderr, \"No file patterns detected.\\n\");\n        return 0;\n    }\n\n    *regexs = (regex_t *)\n            malloc(*num_file_patterns * sizeof(regex_t));\n\n    *file_patterns = (char **)\n            malloc(*num_file_patterns * sizeof(char *));\n    uint32_t i = 0;\n    s = 0;\n    e = 0;\n    while (scan_s(file_patterns_to_be_printed,\n                  strlen(file_patterns_to_be_printed),\n                  &s,\n                  &e,\n                  ',') >= 0) {\n        (*file_patterns)[i] = strndup(file_patterns_to_be_printed + s, e-s);\n        fprintf(stderr, \"%s\\n\", (*file_patterns)[i]);\n        int r = regcomp(&((*regexs)[i]), (*file_patterns)[i], 0);\n        if (r != 0) {\n            fprintf(stderr, \n                    \"Could not compile regex '%s'\",\n                    (*file_patterns)[i]);\n            return 0;\n        }\n        i += 1;\n        s = e + 1;\n    }\n\n    return 1;\n}\n//}}}\n\n\n//{{{ int scan_url_vals(void *cls,\nint scan_url_vals(void *cls,\n                  enum MHD_ValueKind kind,\n                  const char *key,\n                  const char *value)\n{\n    struct request *r = (struct request *)cls;\n\n    if ((key != NULL)) {\n        if (strncmp(\"data\", key, 6) == 0) {\n            fprintf(stderr, \"scan_url_vals: data\\n\");\n            r->type = REQUEST_DATA;\n            r->success = 1;\n        } else if (strncmp(\"region\", key, 6) == 0) {\n            fprintf(stderr, \"scan_url_vals: region\\n\");\n            r->type = REQUEST_REGION;\n            if (value != NULL) {\n                if (r->data.reg == NULL)\n                    r->data.reg = init_region();\n                if (parse_region((char *)value,\n                                 &(r->data.reg->chrm), \n                                 &(r->data.reg->start),\n                                 &(r->data.reg->end)) == 0) {\n                    r->success = 1;\n                }\n            } \n        } else if (strncmp(\"files\", key, 5) == 0) {\n            fprintf(stderr, \"scan_url_vals: file\\n\");\n            if (r->data.reg == NULL)\n                r->data.reg = init_region();\n            if (value != NULL) {\n\n                //fprintf(stderr, \"files:%s\\n\", value);\n                r->data.reg->file_patterns_to_be_printed = \n                    (char *)malloc((strlen(value)+1) * sizeof(char));\n                strcpy(r->data.reg->file_patterns_to_be_printed, value);\n            }\n        } else if (strncmp(\"full\", key, 5) == 0) {\n            fprintf(stderr, \"scan_url_vals: full\\n\");\n            if (r->data.reg == NULL)\n                r->data.reg = init_region();\n            r->data.reg->full = 1;\n        }\n    }\n\n    return MHD_YES;\n}\n//}}}\n\nint answer_to_connection(void *cls,\n                         struct MHD_Connection *connection, \n                         const char *url, \n                         const char *method, const char *version, \n                         const char *upload_data, \n                         size_t *upload_data_size, void **con_cls)\n{\n    struct args *arg = (struct args*) cls;\n    struct MHD_Response *response;\n    int ret = 0;\n\n    struct request r;\n    r.success = 0;\n    r.data.reg = NULL;\n\n    uint32_t file_patterns_set_is_set = 0;\n    uint32_t num_file_patterns = 0;\n    regex_t *regexs = NULL;\n    char **file_patterns = NULL;\n\n    int num_vals = MHD_get_connection_values(connection,\n                                             MHD_GET_ARGUMENT_KIND,\n                                             scan_url_vals,\n                                             &r);\n\n    if (r.success == 1) {\n        if (r.type == REQUEST_DATA) {\n            size_t l = strlen(arg->data_def);\n            response = MHD_create_response_from_buffer(l,\n                                                       (void*) (arg->data_def),\n                                                       MHD_RESPMEM_PERSISTENT);\n\t    MHD_add_response_header(response,\n                                    MHD_HTTP_HEADER_ACCESS_CONTROL_ALLOW_ORIGIN,\n                                    \"*\");\n            ret = MHD_queue_response (connection, MHD_HTTP_OK, response);\n            MHD_destroy_response (response);\n        } else if (r.type == REQUEST_REGION) {\n            struct region *reg = r.data.reg;\n            fprintf(stderr,\n                    \"c:%s s:%u e:%u\\n\",\n                    reg->chrm,\n                    reg->start,\n                    reg->end);\n\n            if (reg->file_patterns_to_be_printed != NULL) {\n                fprintf(stderr,\n                        \"files:%s\\n\",\n                        reg->file_patterns_to_be_printed);\n\n                file_patterns_set_is_set = \n                        parse_file_patterns(reg->file_patterns_to_be_printed,\n                                            &num_file_patterns,\n                                            &regexs,\n                                            &file_patterns);\n            }\n\n            char *page = NULL, *tmp_page = NULL;;\n            struct giggle_index *gi = arg->gi;\n            struct giggle_query_result *gqr = giggle_query(gi,\n                                                           reg->chrm,\n                                                           reg->start,\n                                                           reg->end,\n                                                           NULL);\n\n            fprintf(stderr,\n                    \"file_patterns_set_is_set:%u\\n\",\n                    file_patterns_set_is_set);\n\n            uint32_t i, printed_i = 0;\n            for(i = 0; i < gqr->num_files; i++) {\n                struct file_data *fd = \n                    file_index_get(gi->file_idx, i);\n                    //(struct file_data *)unordered_list_get(gi->file_index, i); \n\n                //fprintf(stderr,\n                        //\"regexs:%p\\t\"\n                        //\"file_patterns:%p\\t\"\n                        //\"num_file_patterns:%u\\n\",\n                        //regexs,\n                        //file_patterns,\n                        //num_file_patterns);\n\n                if (test_pattern_match(gi,\n                                       regexs,\n                                       file_patterns,\n                                       num_file_patterns,\n                                       i,\n                                       file_patterns_set_is_set)) {\n                    if (printed_i == 0) {\n                        asprintf(&tmp_page,\n                                 \"#%s\\t\"\n                                 \"%u\\t\"\n                                 \"%u\\n\",\n                                 fd->file_name,\n                                 fd->num_intervals,\n                                 giggle_get_query_len(gqr, i));\n                    } else {\n                        asprintf(&tmp_page,\n                                 \"%s\"\n                                 \"#%s\\t\"\n                                 \"%u\\t\"\n                                 \"%u\\n\",\n                                 page,\n                                 fd->file_name,\n                                 fd->num_intervals,\n                                 giggle_get_query_len(gqr, i));\n                    }\n\n                    free(page);\n                    page = tmp_page;\n\n                    if ( (reg->full == 1) && \n                         (giggle_get_query_len(gqr, i) > 0 )){\n\n                        char *result = NULL;\n\n                        struct giggle_query_iter *gqi =\n                                giggle_get_query_itr(gqr, i);\n                        while (giggle_query_next(gqi, &result) == 0) {\n                            //printf(\"%s\\n\", result);\n                            asprintf(&tmp_page, \"%s%s\\n\", page, result);\n                            free(page);\n                            page = tmp_page;\n                        }\n\n                        giggle_iter_destroy(&gqi);\n\n                        /*\n                        if (result != NULL) {\n                            free(result);\n                            result = NULL;\n                        }\n                        */\n                    }\n\n                    printed_i += 1;\n\n                }\n            }\n\n\t    if (page == NULL) {\n\t        page = (char *)malloc(sizeof (char));\n                page[0] = '\\0';\n\t    }\n\n            response = MHD_create_response_from_buffer(strlen (page),\n                                                       (void*) page,\n                                                       MHD_RESPMEM_MUST_FREE);\n\t    MHD_add_response_header(response,\n                                    MHD_HTTP_HEADER_ACCESS_CONTROL_ALLOW_ORIGIN,\n                                    \"*\");\n\n            ret = MHD_queue_response (connection, MHD_HTTP_OK, response);\n            MHD_destroy_response (response);\n            giggle_query_result_destroy(&gqr);\n            free(reg->chrm);\n            reg->chrm = NULL;\n        }\n    }\n\n    if (regexs != NULL)\n        regfree(regexs);\n\n    return ret;\n}\n\nint main(int argc, char **argv)\n{\n    if (argc != 5) {\n        fprintf(stderr,\n                \"usage:\\t%s <num threads> <index dir> \"\n                \"<data definition> <port>\\n\",\n                argv[0]);\n        return 0;\n    }\n\n    uint32_t NUMBER_OF_THREADS = atoi(argv[1]);\n    char *index_dir_name = argv[2]; \n    char *data_def_file_name = argv[3]; \n    uint32_t port = atoi(argv[4]); \n\n    FILE *fp = fopen(data_def_file_name, \"r\");\n    if (!fp)\n        err(1, \"Could not open header file '%s'\", data_def_file_name);\n    fseek(fp, 0, SEEK_END);\n    long data_def_size = ftell(fp);\n    fseek(fp, 0, SEEK_SET);\n    char *data_def = (char *)malloc((data_def_size + 1)*sizeof(char));\n    fread(data_def, data_def_size, 1, fp);\n    data_def[data_def_size] = '\\0';\n    fclose(fp);\n\n    struct args *arg = (struct args *)malloc(sizeof(struct args));\n\n    arg->data_def = data_def;\n\n    arg->gi = giggle_load(index_dir_name,\n                          uint64_t_ll_giggle_set_data_handler);\n\n#if BLOCK_STORE\n    giggle_data_handler.giggle_collect_intersection =\n            giggle_collect_intersection_data_in_block;\n\n    giggle_data_handler.map_intersection_to_offset_list =\n            leaf_data_map_intersection_to_offset_list;\n#endif\n\n    struct MHD_Daemon *daemon;\n\n    daemon = MHD_start_daemon(MHD_USE_SELECT_INTERNALLY,\n                              port,\n                              NULL,\n                              NULL, \n                              &answer_to_connection,\n                              arg,\n                              MHD_OPTION_THREAD_POOL_SIZE,\n                              (unsigned int) NUMBER_OF_THREADS,\n                              MHD_OPTION_END);\n\n    if (NULL == daemon) return 1;\n    getchar (); \n\n    free(arg->data_def);\n    giggle_index_destroy(&(arg->gi));\n    cache.destroy();\n    MHD_stop_daemon (daemon);\n    return 0;\n}\n"
  },
  {
    "path": "src/sig_test.c",
    "content": "#include <stdlib.h>\n#include <stdio.h>\n#include <err.h>\n#include <string.h>\n\n#include \"giggle_index.h\"\n#include \"wah.h\"\n#include \"cache.h\"\n#include \"file_read.h\"\n#include \"kfunc.h\"\n#include \"util.h\"\n#include \"ll.h\"\n\n#define MAX(X, Y) (((X) > (Y)) ? (X) : (Y))\n\n\n\n\nint main(int argc, char **argv)\n{\n    WAH_SIZE = 32;\n    WAH_MAX_FILL_WORDS = (1<<(WAH_SIZE-1)) - 1;\n\n    uint32_t num_chrms = 100;\n\n    if ((argc != 4)) {\n        errx(1,\n             \"usage:\\t%s <input file> <index dir> <w|i>\",\n             argv[0]);\n    }\n\n    double genome_size =  3095677412.0;\n\n    char *input_file = argv[1];\n    char *index_dir = argv[2];\n    char *i_type = argv[3];\n\n    struct input_file *in_f = input_file_init(input_file);\n\n    int chrm_len = 50;\n    char *chrm = (char *)malloc(chrm_len*sizeof(char));\n    uint32_t start, end;\n    long offset;\n    kstring_t line = {0, 0, NULL};\n\n    struct giggle_index *gi;\n\n    gi = giggle_load(index_dir,\n                     uint64_t_ll_giggle_set_data_handler);\n\n    uint32_t *file_counts = (uint32_t *)\n            calloc(gi->file_idx->index->num, sizeof(uint32_t));\n\n    uint32_t num_intervals = 0;\n    double mean_interval_size = 0.0;\n    while ( in_f->input_file_get_next_interval(in_f, \n                                               &chrm,\n                                               &chrm_len,\n                                               &start,\n                                               &end,\n                                               &offset,\n                                               &line) >= 0 ) {\n        num_intervals += 1;\n        mean_interval_size += end - start;\n\n        struct uint64_t_ll *R =\n                (struct uint64_t_ll *)giggle_query_region(gi,\n                                                          chrm,\n                                                          start,\n                                                          end);\n        if (R != NULL) {\n            struct uint64_t_ll_node *curr = R->head;\n\n            while (curr != NULL) {\n                /*\n                struct file_id_offset_pair *fid_off = \n                    (struct file_id_offset_pair *)\n                    unordered_list_get(gi->offset_index, curr->val);\n                */\n                struct file_id_offset_pair fid_off = \n                        offset_index_get(gi->offset_idx, curr->val);\n                    //gi->offset_idx->index->vals[curr->val];\n                struct file_data *fd = file_index_get(gi->file_idx,\n                                                      fid_off.file_id);\n\n                file_counts[fid_off.file_id] += 1;\n\n                curr = curr->next;\n            }\n            uint64_t_ll_free((void **)&R);\n        }\n    }\n\n    if (line.s != NULL)\n        free(line.s);\n\n    mean_interval_size = mean_interval_size/num_intervals;\n\n    struct doubles_uint32_t_tuple *sig = (struct doubles_uint32_t_tuple *)\n            calloc(gi->file_idx->index->num,\n                   sizeof(struct doubles_uint32_t_tuple));\n\n    uint32_t i;\n    for (i = 0; i < gi->file_idx->index->num; ++i) {\n        struct file_data *fd = file_index_get(gi->file_idx, i);\n\n        long long n11 = (long long)(file_counts[i]);\n        long long n12 = (long long)(MAX(0,num_intervals - file_counts[i]));\n        long long n21 = (long long)(MAX(0,fd->num_intervals - file_counts[i]));\n        double comp_mean = ((fd->mean_interval_size+mean_interval_size));\n        long long n22_full = (long long)\n            MAX(n11 + n12 + n21, genome_size/comp_mean);\n        long long n22 = MAX(0, n22_full - (n11 + n12 + n21));\n        double left, right, two;\n        double r = kt_fisher_exact(n11, n12, n21, n22, &left, &right, &two);\n\n        double ratio = (((double)n11/(double)n12) / ((double)n21/(double)n22));\n\n        //fprintf(stderr, \"%s\\t%f\\n\", fd->file_name, two);\n        sig[i].d1 = right;\n        sig[i].d2 = ratio;\n        sig[i].u1 = i;\n        sig[i].u2 = file_counts[i];\n    }\n\n    qsort(sig,\n          gi->file_idx->index->num,\n          sizeof(struct doubles_uint32_t_tuple), \n          doubles_uint32_t_tuple_cmp);\n\n    for (i = 0; i < gi->file_idx->index->num; ++i) {\n        struct file_data *fd = file_index_get(gi->file_idx,  sig[i].u1);\n        /*\n        printf(\"%s\\t\"\n               \"right:%f\\t\"\n               \"%f\\n\", fd->file_name, sig[i].d1, sig[i].d2);\n        */\n        printf( \"sig:%f\\t\"\n                \"size:%u\\t\"\n                \"overlap:%u\\t\"\n                \"ratio:%f\\t\"\n                \"%s\\n\",\n                sig[i].d1,\n                fd->num_intervals,\n                sig[i].u2,\n                sig[i].d2,\n                fd->file_name);\n    }\n\n    giggle_index_destroy(&gi);\n    cache.destroy();\n}\n"
  },
  {
    "path": "src/speed_tests.c",
    "content": "#include <stdlib.h>\n#include <stdio.h>\n#include <err.h>\n\n#include \"wah.h\"\n#include \"timer.h\"\n#include \"ll.h\"\n\nint main(int argc, char **argv)\n{\n    WAH_SIZE = 32;\n    WAH_MAX_FILL_WORDS = (1<<(WAH_SIZE-1)) - 1;\n\n    uint32_t size = atoi(argv[1]);\n\n    uint32_t *W_1 = (uint32_t *)calloc(size, sizeof(uint32_t));\n\n    uint32_t *W_2 = (uint32_t *)calloc(size, sizeof(uint32_t));\n\n    uint32_t i;\n\n    if (argv[2][0] == 'w') {\n        uint8_t *w_2 = NULL;\n        uint8_t *w_1 = NULL;\n\n        start();\n        for (i = 0; i < size; ++i) {\n            W_1[i] = rand();\n            wah_uniq_append(&w_1, W_1[i]);\n        }\n        stop();\n        fprintf(stderr, \"%lu\\t\", report());\n\n        start();\n        for (i = 0; i < size; ++i) {\n            W_2[i] = rand();\n            wah_uniq_append(&w_2, W_2[i]);\n        }\n        stop();\n        fprintf(stderr, \"%lu\\t\", report());\n\n\n        uint8_t *r = NULL;\n        uint32_t r_size = 0;\n\n        start();\n        uint32_t resize = wah_or(w_1, w_2, &r, &r_size);\n        stop();\n        fprintf(stderr, \"%lu\\n\", report());\n    } else if (argv[2][0] == 'l') {\n     \n        struct uint64_t_ll *l_1 = NULL;\n        struct uint64_t_ll *l_2 = NULL;\n\n        start();\n        for (i = 0; i < size; ++i) {\n            W_1[i] = rand();\n            uint64_t_ll_append(&l_1, W_1[i]);\n        }\n        stop();\n        fprintf(stderr, \"%lu\\t\", report());\n\n        start();\n        for (i = 0; i < size; ++i) {\n            W_2[i] = rand();\n            uint64_t_ll_append(&l_2, W_2[i]);\n        }\n        stop();\n        fprintf(stderr, \"%lu\\t\", report());\n\n        start();\n        struct uint64_t_ll_node *curr = l_1->head;\n        while (curr != NULL) {\n            uint64_t_ll_uniq_append(&l_2, curr->val);\n            curr = curr->next;\n        }\n        stop();\n        fprintf(stderr, \"%lu\\n\", report());\n    }\n}\n"
  },
  {
    "path": "src/test.c",
    "content": "#include <stdlib.h>\n#include <stdio.h>\n#include <err.h>\n#include <string.h>\n\n#include \"giggle_index.h\"\n#include \"wah.h\"\n#include \"cache.h\"\n#include \"ll.h\"\n\nint main(int argc, char **argv)\n{\n    uint32_t num_chrms = 100;\n\n    if ((argc != 4)) {\n        errx(1,\n             \"usage:\\t%s <index dir> <region> <w|i>\",\n             argv[0]);\n    }\n\n    char *index_dir = argv[1];\n    char *region_s = argv[2];\n    char *i_type = argv[3];\n\n    struct giggle_index *gi;\n    gi = giggle_load(index_dir,\n                     uint64_t_ll_giggle_set_data_handler);\n\n\n#if 0\n    char *chrm = region_s;\n    uint32_t start = 0, end = 0;\n    uint32_t i, len = strlen(region_s);\n    \n    for (i = 0; i < len; ++i) {\n        if (region_s[i] == ':') {\n            region_s[i] = '\\0';\n            start = atoi(region_s + i + 1);\n        } else if (region_s[i] == '-') {\n            region_s[i] = '\\0';\n            end = atoi(region_s + i + 1);\n            break;\n        }\n    }\n\n    struct giggle_index *gi;\n    if (i_type[0] == 'i') {\n        gi = giggle_load(index_dir,\n                         uint64_t_ll_giggle_set_data_handler);\n\n        struct uint64_t_ll *R =\n                (struct uint64_t_ll *)giggle_query_region(gi,\n                                                          chrm,\n                                                          start,\n                                                          end);\n\n        if (R != NULL)\n            printf(\"Hits:%u\\n\", R->len);\n        else\n            printf(\"Hits:0\\n\");\n\n    } else {\n        gi = giggle_load(index_dir,\n                         wah_giggle_set_data_handler);\n\n        uint32_t chr_id = giggle_get_chrm_id(gi, chrm);\n        //return giggle_search(chr_id, gi->root_ids[chr_id], start, end);\n        \n        uint32_t domain = chr_id;\n        uint32_t root_id = gi->root_ids[chr_id];\n\n        uint32_t leaf_start_id;\n        int pos_start_id;\n\n        uint32_t nld_start_id = bpt_find(domain,\n                                         root_id,\n                                         &leaf_start_id,\n                                         &pos_start_id,\n                                         start);\n        fprintf(stderr,\n                \"nld_start_id:%u\\t\"\n                \"leaf_start_id:%u\\t\"\n                \"pos_start_id:%u\\n\",\n                nld_start_id,\n                leaf_start_id,\n                pos_start_id);\n\n        struct bpt_node *leaf_start = cache.get(domain,\n                                                leaf_start_id - 1,\n                                                &bpt_node_cache_handler);\n        bpt_print_node(leaf_start);\n\n        \n        struct wah_bpt_non_leading_data *nld = \n                cache.get(domain,\n                          BPT_POINTERS(leaf_start)[0] - 1,\n                          &wah_non_leading_cache_handler);\n\n        fprintf(stderr,\n                \"WAH_LEN:%u\\t\"\n                \"wah_get_ints_count:%u\\t\"\n                \"\\n\",\n                WAH_LEN(nld->SA),\n                wah_get_ints_count(nld->SA));\n            \n        uint32_t *R = NULL;\n        uint32_t R_len = wah_get_ints(nld->SA, &R);\n\n        uint32_t i;\n        for (i = 0; i < R_len; ++i) {\n            fprintf(stderr, \"%u:%u\\n\", i, R[i]);\n        }\n\n        /*\n        uint8_t *R = (uint8_t *)giggle_query_region(gi,\n                                                    chrm,\n                                                    start,\n                                                    end);\n        if (R != NULL)\n            printf(\"Hits:%u\\n\", wah_get_ints_count(R));\n        else\n            printf(\"Hits:0\\n\");\n        */\n\n    }\n#endif\n    giggle_index_destroy(&gi);\n    cache.destroy();\n}\n"
  },
  {
    "path": "src/timer.c",
    "content": "/*****************************************************************************\ntimer.c\n(c) 2012 - Ryan M. Layer\nHall Laboratory\nQuinlan Laboratory\nDepartment of Computer Science\nDepartment of Biochemistry and Molecular Genetics\nDepartment of Public Health Sciences and Center for Public Health Genomics,\nUniversity of Virginia\nrl6sf@virginia.edu\n\nLicenced under the GNU General Public License 2.0 license.\n******************************************************************************/\n#include <sys/time.h>\n#include \"timer.h\"\n\nstatic struct timeval _start, _stop;\n\nvoid start()\n{\n\tgettimeofday(&_start,0);\n}\n\nvoid stop()\n{\n\tgettimeofday(&_stop,0);\n}\n\nunsigned long report()\n{\n\treturn (_stop.tv_sec - _start.tv_sec) * 1000000 +  //seconds to microseconds\n\t\t_stop.tv_usec - _start.tv_usec;\n}\n\nstruct timeval in()\n{\n\tstruct timeval i;\n\tgettimeofday(&i,0);\n\treturn i;\n}\n\nunsigned long out(struct timeval i)\n{\n\tstruct timeval o;\n\tgettimeofday(&o,0);\n\n\treturn (o.tv_sec - i.tv_sec) * 1000000 +  //seconds to microseconds\n\t\to.tv_usec - i.tv_usec;\n}\n"
  },
  {
    "path": "src/timer.h",
    "content": "/*****************************************************************************\ntimer.h\n(c) 2012 - Ryan M. Layer\nHall Laboratory\nQuinlan Laboratory\nDepartment of Computer Science\nDepartment of Biochemistry and Molecular Genetics\nDepartment of Public Health Sciences and Center for Public Health Genomics,\nUniversity of Virginia\nrl6sf@virginia.edu\n\nLicenced under the GNU General Public License 2.0 license.\n******************************************************************************/\n#ifndef __TIMER_H__\n#define __TIMER_H__\n\nvoid start();\n\nvoid stop();\n\nunsigned long report();\n\nstruct timeval in();\n\nunsigned long out(struct timeval i);\n\n#endif\n"
  },
  {
    "path": "src/util.c",
    "content": "#define _GNU_SOURCE\n\n#include <err.h>\n#include <float.h>\n#include <glob.h>\n#include <libgen.h>\n#include <limits.h>\n#include <math.h>\n#include <stdint.h>\n#include <stdio.h>\n#include <stdlib.h>\n#include <string.h>\n#include <sysexits.h>\n\n#include <sys/stat.h>\n#include <sys/types.h>\n#include <unistd.h>\n\n#include <ftw.h>\n\n#include \"util.h\"\n\nint safe_subtract(uint32_t a, uint32_t b) {\n    if (a < b)\n        return 0;\n    return a - b;\n}\n\nint long_uint_pair_cmp(const void *_a, const void *_b) {\n    struct long_uint_pair *a = (struct long_uint_pair *)_a;\n    struct long_uint_pair *b = (struct long_uint_pair *)_b;\n\n    return a->long_val - b->long_val;\n}\n\nint doubles_uint32_t_tuple_cmp(const void *_a, const void *_b) {\n    struct doubles_uint32_t_tuple *a = (struct doubles_uint32_t_tuple *)_a;\n    struct doubles_uint32_t_tuple *b = (struct doubles_uint32_t_tuple *)_b;\n\n    if (a->d1 < b->d1)\n        return -1;\n    else if (a->d1 > b->d1)\n        return 1;\n    else {\n        if (a->d2 < b->d2)\n            return -1;\n        else if (a->d2 > b->d2)\n            return 1;\n\n        return 0;\n    }\n}\n\nvoid check_file_read(char *file_name, FILE *fp, size_t exp, size_t obs) {\n    if (exp != obs) {\n        if (feof(fp))\n            errx(EX_IOERR, \"Error reading file \\\"%s\\\": End of file\", file_name);\n        err(EX_IOERR, \"Error reading file \\\"%s\\\"\", file_name);\n    }\n}\n\nint unlink_cb(\n    const char *fpath,\n    const struct stat *sb,\n    int typeflag,\n    struct FTW *ftwbuf\n) {\n    int rv = remove(fpath);\n    if (rv)\n        perror(fpath);\n    return rv;\n}\n\nint rmrf(char *path) { return nftw(path, unlink_cb, 64, FTW_DEPTH | FTW_PHYS); }\n\nint uint32_t_cmp(const void *_a, const void *_b) {\n    uint32_t *a = (uint32_t *)_a;\n    uint32_t *b = (uint32_t *)_b;\n\n    if (*a < *b)\n        return -1;\n    else if (*a > *b)\n        return 1;\n    else\n        return 0;\n}\n\nint uint64_t_cmp(const void *_a, const void *_b) {\n    uint64_t *a = (uint64_t *)_a;\n    uint64_t *b = (uint64_t *)_b;\n\n    if (*a < *b)\n        return -1;\n    else if (*a > *b)\n        return 1;\n    else\n        return 0;\n}\n\nint char_p_cmp(const void *_a, const void *_b) {\n    return strcmp(*(char **)_a, *(char **)_b);\n}\n\nuint32_t bin_char_to_int(char *bin) {\n    uint32_t i = 0;\n    int j = 0;\n\n    while (bin[j] != '\\0') {\n        i = i << 1;\n        if (bin[j] == '1')\n            i += 1;\n        j += 1;\n    }\n\n    return i;\n}\n\nint long_cmp(const void *_a, const void *_b) {\n    long *a = (long *)_a;\n    long *b = (long *)_b;\n\n    if (*a < *b)\n        return -1;\n    else if (*a > *b)\n        return 1;\n    else\n        return 0;\n}\n\n//{{{int parse_region(char *region_s, char **chrm, uint32_t *start, uint32_t\nint parse_region(char *region_s, char **chrm, uint32_t *start, uint32_t *end) {\n    *chrm = NULL;\n    *start = 0;\n    *end = 0;\n    uint32_t i, len = strlen(region_s);\n\n    for (i = 0; i < len; ++i) {\n        if (region_s[i] == ':') {\n            region_s[i] = '\\0';\n            *chrm = strndup(region_s, strlen(region_s) + 1);\n            *start = atoi(region_s + i + 1);\n        } else if (region_s[i] == '-') {\n            region_s[i] = '\\0';\n            *end = atoi(region_s + i + 1);\n            if (*chrm != NULL)\n                return 0;\n            else\n                return 1;\n        }\n    }\n\n    return 1;\n}\n//}}}\n\n//{{{int test_pattern_match(struct giggle_index *gi,\nint test_pattern_match(\n    struct giggle_index *gi,\n    regex_t *regexs,\n    char **file_patterns,\n    uint32_t num_file_patterns,\n    uint32_t file_id,\n    uint32_t f_is_set\n) {\n    if (f_is_set == 0)\n        return 1;\n\n    struct file_data *fd = file_index_get(gi->file_idx, file_id);\n\n    int match = 0;\n    uint32_t j;\n    for (j = 0; j < num_file_patterns; j++) {\n        int r = regexec(&(regexs[j]), fd->file_name, 0, NULL, 0);\n        if (r == 0) {\n            match = 1;\n            break;\n        } else if (r != REG_NOMATCH) {\n            char msgbuf[100];\n            regerror(r, &regexs[j], msgbuf, sizeof(msgbuf));\n            errx(\n                EX_USAGE,\n                \"Regex '%s' match failed: %s\\n\",\n                file_patterns[file_id],\n                msgbuf\n            );\n        }\n    }\n\n    return match;\n}\n//}}}\n\n//{{{double log2fc(double ratio)\ndouble log2fc(double ratio) {\n    if (fabs(ratio) < 0.0001)\n        return 0.0;\n\n    if (ratio < 1) {\n        ratio = 1.0 / ratio;\n        return -1.0 * log2(ratio);\n    }\n\n    return log2(ratio);\n}\n//}}}\n\n//{{{double neglog10p(double sig)\nlong double neglog10p(long double sig) {\n    if (fabsl(sig) < -DBL_MAX)\n        return 10.0;\n    return -1.0 * log10l(sig);\n}\n//}}}\n\n///////////////////////////////////////////////////////////////////////////////\n// Safe versions of basename and dirname that will not modify the input path\n///////////////////////////////////////////////////////////////////////////////\nvoid safe_dirname(const char *path, char *result) {\n    if (path == NULL || result == NULL) {\n        return;\n    }\n\n    size_t len = strlen(path);\n    if (len == 0) {\n        strcpy(result, \".\");\n        return;\n    }\n\n    // Copy the path to a new buffer\n    char path_copy[4096];\n    strncpy(path_copy, path, 4096);\n\n    const char *dir = dirname(path_copy);\n    strncpy(result, dir, 4096);\n}\n\nvoid safe_basename(const char *path, char *result) {\n    if (path == NULL || result == NULL) {\n        return;\n    }\n\n    size_t len = strlen(path);\n    if (len == 0) {\n        strcpy(result, \".\");\n        return;\n    }\n\n    // Copy the path to a new buffer\n    char path_copy[4096];\n    strncpy(path_copy, path, 4096);\n\n    const char *base = basename(path_copy);\n    strncpy(result, base, 4096);\n}\n\n///////////////////////////////////////////////////////////////////////////////\n// Use glob function to get the absolute path of a glob pattern.\n// eg. path/of/glob/*.txt -> /full/path/of/glob/*.txt\n///////////////////////////////////////////////////////////////////////////////\nvoid abs_path_of_glob(const char *glob_pattern, char *result) {\n\n    glob_t glob_result;\n    if (glob(glob_pattern, 0, NULL, &glob_result) != 0) {\n        perror(\"glob\");\n        exit(EXIT_FAILURE);\n    }\n\n    // get dirname of first match\n    char rel_dirname[4096];\n    safe_dirname(glob_result.gl_pathv[0], rel_dirname);\n\n    // convert to absolute path\n    char abs_dirname[4096];\n    if (realpath(rel_dirname, abs_dirname) == NULL) {\n        perror(\"realpath\");\n        exit(EXIT_FAILURE);\n    }\n\n    // just the glob pattern minus path\n    char glob_basename[4096];\n    safe_basename(glob_pattern, glob_basename);\n\n    snprintf(result, 4096, \"%s/%s\", abs_dirname, glob_basename);\n\n    globfree(&glob_result);\n}\n"
  },
  {
    "path": "src/util.h",
    "content": "#ifndef __UTIL_H__\n#define __UTIL_H__\n\n#define _GNU_SOURCE\n\n#include <ftw.h>\n#include <regex.h>\n#include <stdint.h>\n#include <stdio.h>\n#include <sys/stat.h>\n\n#include \"file_read.h\"\n#include \"giggle_index.h\"\n\nint safe_subtract(uint32_t a, uint32_t b);\n\nstruct doubles_uint32_t_tuple {\n    double d1, d2;\n    uint32_t u1, u2, u3;\n};\nint doubles_uint32_t_tuple_cmp(const void *_a, const void *_b);\n\nstruct long_uint_pair {\n    long long_val;\n    uint32_t uint_val;\n};\nint long_uint_pair_cmp(const void *_a, const void *_b);\n\nextern struct FTW *ftwbuf;\nvoid check_file_read(char *file_name, FILE *fp, size_t exp, size_t obs);\nint unlink_cb(\n    const char *fpath,\n    const struct stat *sb,\n    int typeflag,\n    struct FTW *ftwbuf\n);\nint rmrf(char *path);\nint uint32_t_cmp(const void *_a, const void *_b);\nint uint64_t_cmp(const void *_a, const void *_b);\nint char_p_cmp(const void *_a, const void *_b);\nuint32_t bin_char_to_int(char *bin);\nint long_cmp(const void *_a, const void *_b);\nint parse_region(char *region_s, char **chrm, uint32_t *start, uint32_t *end);\nint test_pattern_match(\n    struct giggle_index *gi,\n    regex_t *regexs,\n    char **file_patterns,\n    uint32_t num_file_patterns,\n    uint32_t file_id,\n    uint32_t f_is_set\n);\n\ndouble log2fc(double ratio);\nlong double neglog10p(long double sig);\n\nvoid safe_dirname(const char *path, char *result);\nvoid safe_basename(const char *path, char *result);\n\nvoid abs_path_of_glob(const char *glob_pattern, char *result);\n\n#endif\n"
  },
  {
    "path": "src/wah.c",
    "content": "#define _GNU_SOURCE\n\n#include <stdio.h>\n#include <stdlib.h>\n#include <stdint.h>\n#include <math.h>\n#include <inttypes.h>\n#include <string.h>\n#include <err.h>\n\n\n#include \"wah.h\"\n#include \"util.h\"\n#include \"ll.h\"\n\n#define MIN(X, Y) (((X) < (Y)) ? (X) : (Y))\n#define MAX(X, Y) (((X) > (Y)) ? (X) : (Y))\n\nuint32_t WAH_SIZE = 32;\nuint32_t WAH_MAX_FILL_WORDS = 2147483647; //(1<<(WAH_SIZE-1)) - 1\n\n//{{{void set_wah_i(uint8_t *W, void *v, uint32_t word_size, uint32_t i)\nvoid set_wah_i(uint8_t *W, void *v, uint32_t word_size, uint32_t i)\n{\n    memcpy(W + sizeof(uint32_t) + i*(word_size/BYTE), v, word_size/BYTE);\n}\n//}}}\n\n//{{{void get_wah_i(uint8_t *W, void *v, uint32_t word_size, uint32_t i)\nvoid get_wah_i(uint8_t *W, void *v, uint32_t word_size, uint32_t i)\n{\n    memcpy(v,\n           W + sizeof(uint32_t) + i*(word_size/BYTE),\n           (word_size/BYTE));\n}\n//}}}\n\n//{{{uint8_t *wah_init(uint32_t val)\nuint8_t *wah_init(uint32_t val)\n{\n    uint32_t bits_per_word = WAH_SIZE - 1;\n    uint32_t num_words = (val + bits_per_word - 1) / bits_per_word;\n    // the max number of words 8-bit fill word and represent is \n    // 2**7 - 1 = 127\n    // LEN, and WAH_LEN is the number of words, it is independent of word size\n    uint32_t len = 1 + (num_words > 1 ? \n            (num_words + WAH_MAX_FILL_WORDS - 1)/WAH_MAX_FILL_WORDS : 0);\n    uint8_t *w = (uint8_t *)malloc(sizeof(uint32_t) + \n                    (len * (WAH_SIZE/BYTE)  * sizeof(uint8_t)));\n    WAH_LEN(w) = len;\n\n    uint32_t v, i = 0;\n    uint32_t saved_words;\n    while (val > bits_per_word) {\n        saved_words = MIN(num_words - 1, WAH_MAX_FILL_WORDS);\n        //WAH_I(w, WAH_SIZE, i) = (1 << (bits_per_word-10)) | (saved_words);\n        v = (1 << (bits_per_word)) + (saved_words);\n        //fprintf(stderr, \"%u\\n\", v);\n        set_wah_i(w, &v, WAH_SIZE, i);\n        val -= saved_words * bits_per_word;\n        num_words -= saved_words;\n        i+=1;\n    }\n\n    if (val > 0) {\n        //WAH_I(w, WAH_SIZE, i) =  1 << ( bits_per_word - val);\n        v = 1 << ( bits_per_word - val);\n        //fprintf(stderr, \"%u\\n\", v);\n        set_wah_i(w, &v, WAH_SIZE, i);\n    } else {\n        //WAH_I(w, WAH_SIZE,i) =  0;\n        v = 0;\n        //fprintf(stderr, \"%u\\n\", v);\n        set_wah_i(w, &v, WAH_SIZE, i);\n    }\n\n    return w;\n}\n//}}}\n\n//{{{uint8_t *wah_copy(uint8_t *w)\nuint8_t *wah_copy(uint8_t *w)\n{\n    if (w == NULL)\n        return NULL;\n\n    if (WAH_LEN(w) == 0)\n        return NULL;\n\n    uint32_t R_size = sizeof(uint32_t) + \n            (WAH_LEN(w) * (WAH_SIZE/BYTE) * sizeof(uint8_t));\n    uint8_t *R = (uint8_t *)malloc(R_size);\n    memcpy(R, w, R_size);\n\n    return R;\n}\n//}}}\n\n//{{{ uint32_t wah_or(uint8_t *X, uint8_t *Y, uint8_t **R, uint32_t *R_size)\nuint32_t wah_or(uint8_t *X, uint8_t *Y, uint8_t **R, uint32_t *R_size)\n{\n    uint32_t R_i = 0, X_i = 0, Y_i = 0;\n    uint32_t x, y;\n    //uint8_t x, y;\n    uint32_t x_size, y_size, r_size, y_done = 0, x_done = 0;\n    uint32_t X_len = WAH_LEN(X), Y_len = WAH_LEN(Y);\n    uint32_t R_len = X_len + Y_len;\n    uint32_t reset_R = 0;\n\n    if (*R == NULL) {\n        //fprintf(stderr, \"reset_R A\\n\");\n        *R_size = sizeof(uint32_t) + (R_len*(WAH_SIZE/BYTE)*sizeof(uint8_t));\n        *R = (uint8_t *)malloc(*R_size);\n        memset(*R, 0, *R_size);\n        reset_R = 1;\n    } else if (*R_size < sizeof(uint32_t) + \n            (R_len*(WAH_SIZE/BYTE)*sizeof(uint8_t))) {\n        /*\n        fprintf(stderr, \"reset_R B\\tR_size:%u\\t%lu\\n\",\n                *R_size,\n                sizeof(uint32_t) + (R_len*(WAH_SIZE/BYTE)*sizeof(uint8_t)));\n        */\n        free(*R);\n        *R_size = sizeof(uint32_t) + (R_len*(WAH_SIZE/BYTE)*sizeof(uint8_t));\n        *R = (uint8_t *)malloc(*R_size);\n        memset(*R, 0, *R_size);\n        reset_R = 1;\n    }\n\n    get_wah_i(X, &x, WAH_SIZE, X_i);\n    get_wah_i(Y, &y, WAH_SIZE, Y_i);\n\n    x_size = WAH_NUM_WORDS(x, WAH_SIZE);\n    y_size = WAH_NUM_WORDS(y, WAH_SIZE);\n\n    uint32_t v;\n    while (1) {\n        r_size = MIN(x_size, y_size);\n\n        if (r_size > 1)  {\n            v = ((1<< (WAH_SIZE - 1)) + r_size);\n        } else {\n            v = WAH_VAL(x, WAH_SIZE) | WAH_VAL(y, WAH_SIZE);\n        }\n\n        // Grow R if we need to\n        if (sizeof(uint32_t) + R_i*(WAH_SIZE/BYTE)*sizeof(uint8_t) == *R_size) {\n            uint32_t old_len = R_len;\n            reset_R = 1;\n            R_len = R_len * 2;\n            *R_size = sizeof(uint32_t) + \n                    (R_len*(WAH_SIZE/BYTE)*sizeof(uint8_t));\n            *R = (uint8_t *) realloc(*R, *R_size);\n            memset(*R + sizeof(uint32_t) + \n                    (old_len*(WAH_SIZE/BYTE)*sizeof(uint8_t)),\n                   0,\n                   old_len*(WAH_SIZE/BYTE)*sizeof(uint8_t) );\n        }\n\n        //WAH_I(*R, WAH_SIZE, R_i) = (uint8_t) v;\n        set_wah_i(*R, &v, WAH_SIZE, R_i);\n        R_i += 1;\n\n        x_size -= r_size;\n        y_size -= r_size;\n\n        if ((x_size == 0) && (x_done == 0)) {\n            X_i += 1;\n            if (X_i == X_len) {\n                x_done = 1;\n                x = 0;\n            } else {\n                //x = WAH_I(X, 8, X_i);\n                x = 0;\n                get_wah_i(X, &x, WAH_SIZE, X_i);\n                x_size = WAH_NUM_WORDS(x, WAH_SIZE);\n            }\n        }\n\n        if ((y_size == 0) && (y_done == 0)) {\n            Y_i += 1;\n            if (Y_i == Y_len) {\n                y_done = 1;\n                y = 0;\n            } else {\n                //y = WAH_I(Y, WAH_SIZE, Y_i);\n                y = 0;\n                get_wah_i(Y, &y, WAH_SIZE, Y_i);\n                y_size = WAH_NUM_WORDS(y, WAH_SIZE);\n            }\n        }\n\n        if ((x_done == 1) && (y_done == 1))\n            break;\n        else if (x_done == 1)\n            x_size = y_size;\n        else if (y_done == 1)\n            y_size = x_size;\n    }\n\n    R_len = R_i;\n    WAH_LEN(*R) = R_len;\n    if (reset_R == 1) {\n        *R_size = sizeof(uint32_t) + (R_len*(WAH_SIZE/BYTE)*sizeof(uint8_t));\n        *R = (uint8_t *)realloc(*R, *R_size);\n    }\n\n    return reset_R;\n}\n//}}}\n\n//{{{ uint32_t wah_nand(uint8_t *X, uint8_t *Y, uint8_t **R, uint32_t *R_size)\nuint32_t wah_nand(uint8_t *X, uint8_t *Y, uint8_t **R, uint32_t *R_size)\n{\n    uint32_t R_i = 0, X_i = 0, Y_i = 0;\n    uint32_t x, y;\n    uint32_t x_size, y_size, r_size, y_done = 0, x_done = 0;\n    uint32_t X_len = WAH_LEN(X), Y_len = WAH_LEN(Y);\n    uint32_t R_len = X_len + Y_len;\n    uint32_t reset_R = 0;\n\n    if (*R == NULL) {\n        *R_size = sizeof(uint32_t) + (R_len*(WAH_SIZE/BYTE)*sizeof(uint8_t));\n        *R = (uint8_t *)malloc(*R_size);\n        memset(*R, 0, *R_size);\n        reset_R = 1;\n    } else if (*R_size < sizeof(uint32_t) + \n            (R_len*(WAH_SIZE/BYTE)*sizeof(uint8_t))) {\n        free(*R);\n        *R_size = sizeof(uint32_t) + (R_len*(WAH_SIZE/BYTE)*sizeof(uint8_t));\n        *R = (uint8_t *)malloc(*R_size);\n        memset(*R, 0, *R_size);\n        reset_R = 1;\n    }\n\n    //x = WAH_I(X, WAH_SIZE, X_i);\n    get_wah_i(X, &x, WAH_SIZE, X_i);\n    //y = WAH_I(Y, WAH_SIZE, Y_i);\n    get_wah_i(Y, &y, WAH_SIZE, Y_i);\n\n    x_size = WAH_NUM_WORDS(x, WAH_SIZE);\n    y_size = WAH_NUM_WORDS(y, WAH_SIZE);\n\n    uint32_t v;\n    while (1) {\n        r_size = MIN(x_size, y_size);\n\n        if (r_size > 1)  {\n            v = ((1<< (WAH_SIZE - 1)) + r_size);\n            //v = (uint8_t) ((1<< (WAH_SIZE - 1)) + r_size);\n        } else {\n            v = (WAH_VAL(x, WAH_SIZE) & ~(WAH_VAL(y, WAH_SIZE)));\n            //v = (uint8_t) (WAH_VAL(x, WAH_SIZE) | WAH_VAL(y, WAH_SIZE));\n        }\n\n        // Grow R if we need to\n        if (sizeof(uint32_t) + R_i*(WAH_SIZE/BYTE)*sizeof(uint8_t) == *R_size) {\n            uint32_t old_len = R_len;\n            reset_R = 1;\n            R_len = R_len * 2;\n            *R_size = sizeof(uint32_t) + \n                    (R_len*(WAH_SIZE/BYTE)*sizeof(uint8_t));\n            *R = (uint8_t *) realloc(*R, *R_size);\n            memset(*R + sizeof(uint32_t) + \n                    (old_len*(WAH_SIZE/BYTE)*sizeof(uint8_t)),\n                   0,\n                   old_len*(WAH_SIZE/BYTE)*sizeof(uint8_t) );\n        }\n\n        //WAH_I(*R, WAH_SIZE, R_i) = (uint8_t) v;\n        set_wah_i(*R, &v, WAH_SIZE, R_i);\n        R_i += 1;\n\n        x_size -= r_size;\n        y_size -= r_size;\n\n        if ((x_size == 0) && (x_done == 0)) {\n            X_i += 1;\n            if (X_i == X_len) {\n                x_done = 1;\n                x = 0;\n            } else {\n                //x = WAH_I(X, 8, X_i);\n                x = 0;\n                get_wah_i(X, &x, WAH_SIZE, X_i);\n                x_size = WAH_NUM_WORDS(x, WAH_SIZE);\n            }\n        }\n\n        if ((y_size == 0) && (y_done == 0)) {\n            Y_i += 1;\n            if (Y_i == Y_len) {\n                y_done = 1;\n                y = 0;\n            } else {\n                //y = WAH_I(Y, WAH_SIZE, Y_i);\n                y = 0;\n                get_wah_i(Y, &y, WAH_SIZE, Y_i);\n                y_size = WAH_NUM_WORDS(y, WAH_SIZE);\n            }\n        }\n\n        if ((x_done == 1) && (y_done == 1))\n            break;\n        else if (x_done == 1)\n            x_size = y_size;\n        else if (y_done == 1)\n            y_size = x_size;\n    }\n\n    R_len = R_i;\n    WAH_LEN(*R) = R_len;\n    if (reset_R == 1) {\n        *R_size = sizeof(uint32_t) + (R_len*(WAH_SIZE/BYTE)*sizeof(uint8_t));\n        *R = (uint8_t *)realloc(*R, *R_size);\n    }\n\n    return reset_R;\n}\n//}}}\n\n//{{{ uint32_t wah_get_ints(uint8_t *X, uint32_t **R)\nuint32_t wah_get_ints(uint8_t *X, uint32_t **R)\n{\n    /*\n    if (X == NULL)\n        return 0;\n    */\n    //uint8_t x;\n    uint32_t x;\n    uint32_t x_i_size, x_size = 0;\n    uint32_t X_len = WAH_LEN(X);\n    uint32_t R_len = 0;\n\n    uint32_t i;\n    for (i = 0; i < X_len; ++i) {\n        //x = WAH_I(X, WAH_SIZE, i);\n        x = 0;\n        get_wah_i(X, &x, WAH_SIZE, i);\n        x_i_size = WAH_NUM_WORDS(x, WAH_SIZE);\n        if (x_i_size == 1)\n            R_len +=  __builtin_popcount(x);\n\n        x_size += x_i_size * (WAH_SIZE - 1);\n    }\n\n    //__builtin_clz(x) takes in a unsigned int, so on smaller\n    //types it will count extra zeros, diff counts how many extra there are \n    uint32_t diff = ((sizeof(unsigned int)*BYTE)/WAH_SIZE - 1)*WAH_SIZE;\n    uint32_t offset = 0;\n\n    *R = (uint32_t*)calloc(R_len, sizeof(uint32_t));\n    uint32_t R_i = 0;\n    x_size = 0;\n    for (i = 0; i < X_len; ++i) {\n        x = 0;\n        get_wah_i(X, &x, WAH_SIZE, i);\n        x_i_size = WAH_NUM_WORDS(x, WAH_SIZE);\n        if ( x_i_size == 1 ) {\n            while (x != 0) {\n                offset = __builtin_clz(x) - diff;\n                (*R)[R_i] = offset + x_size;\n                R_i += 1;\n                x &= ~(1 << (WAH_SIZE-1-offset));\n            }\n        }\n        x_size += x_i_size * (WAH_SIZE - 1);\n    }\n    return R_len;\n}\n//}}}\n\n//{{{ uint32_t wah_get_ints_count(uint8_t *X)\nuint32_t wah_get_ints_count(uint8_t *X)\n{\n    uint8_t x;\n    uint32_t x_i_size;\n    uint32_t X_len = WAH_LEN(X);\n    uint32_t R_len = 0;\n\n    uint32_t i;\n    for (i = 0; i < X_len; ++i) {\n\n        //x = WAH_I(X, WAH_SIZE, i);\n        x = 0;\n        get_wah_i(X, &x, WAH_SIZE, i);\n\n        x_i_size = WAH_NUM_WORDS(x, WAH_SIZE);\n\n        if (x_i_size == 1)\n            R_len +=  __builtin_popcount(x);\n    }\n\n    return R_len;\n}\n//}}}\n\n//{{{void wah_uniq_append(uint8_t **w, uint32_t id)\nvoid wah_uniq_append(uint8_t **w, uint32_t id)\n{\n    uint8_t *w_id = wah_init(id);\n\n    if (*w == NULL) {\n        *w = w_id;\n    } else {\n        uint8_t *r = NULL;\n        uint32_t r_size = 0;\n        uint32_t resize = wah_or(*w, w_id, &r, &r_size);\n        free(*w);\n        free(w_id);\n        *w = r;\n    }\n}\n//}}}\n\n// NOTE:  this function could easily be rewritten using the general funtions\n//{{{ void wah_leading_repair(uint32_t domain, \nvoid wah_leading_repair(uint32_t domain, \n                          struct bpt_node *a,\n                          struct bpt_node *b)\n{\n#if DEBUG\n    fprintf(stderr, \"START leading_repair\\n\");\n#endif\n\n    if ( (BPT_IS_LEAF(a) == 1) && (BPT_IS_LEAF(b) == 1) ) {\n        // make a new leading value for the new right node\n        struct wah_bpt_leading_data *d = \n            (struct wah_bpt_leading_data *)\n            malloc(sizeof(struct wah_bpt_leading_data));\n\n        d->B = NULL;\n\n        // if the left node had leading data, grab all of it\n        if (BPT_LEADING(a) != 0) {\n            // get it from cache\n            struct wah_bpt_leading_data *l =  \n                    cache.get(domain,\n                              BPT_LEADING(a) - 1,\n                              &wah_leading_cache_handler);\n#if DEBUG\n            uint32_t *R = NULL, R_size;\n            uint32_t j;\n            fprintf(stderr, \"LEADING\\t\");\n            if (l->B != NULL) {\n                R_size = wah_get_ints(l->B, &R);\n                fprintf(stderr, \"R_size:%u\\t\", R_size);\n                for (j = 0; j < R_size; ++j)\n                    fprintf(stderr, \"R[%u]:%u\\t\", j, R[j]);\n                free(R);\n                R = NULL;\n            }\n            fprintf(stderr, \"\\n\");\n#endif\n            d->B = wah_copy(l->B);\n        }\n\n        uint32_t i;\n        for (i = 0 ; i < BPT_NUM_KEYS(a); ++i) {\n            struct wah_bpt_non_leading_data *nl = \n                    cache.get(domain,\n                              BPT_POINTERS(a)[i] - 1,\n                              &wah_non_leading_cache_handler);\n\n#if DEBUG\n            uint32_t *R = NULL, R_size;\n            uint32_t j;\n\n            fprintf(stderr, \"%u\\tSA\\t\",BPT_KEYS(a)[i]);\n            if (nl->SA != NULL) {\n                R_size = wah_get_ints(nl->SA, &R);\n                fprintf(stderr, \"R_size:%u\\t\", R_size);\n                for (j = 0; j < R_size; ++j)\n                    fprintf(stderr, \"R[%u]:%u\\t\", j, R[j]);\n                free(R);\n                R = NULL;\n            }\n            fprintf(stderr, \"\\n\");\n            fprintf(stderr, \"SE\\t\");\n            if (nl->SE != NULL) {\n                R_size = wah_get_ints(nl->SE, &R);\n                fprintf(stderr, \"R_size:%u\\t\", R_size);\n                for (j = 0; j < R_size; ++j)\n                    fprintf(stderr, \"R[%u]:%u\\t\", j, R[j]);\n                free(R);\n                R = NULL;\n            }\n            fprintf(stderr, \"\\n\");\n#endif\n\n            wah_non_leading_union_with_SA_subtract_SE(domain,\n                                                        (void **)(&d->B),\n                                                        nl);\n\n\n        }\n\n        if (d->B != NULL) {\n            uint32_t v_id = cache.seen(domain) + 1;\n            cache.add(domain,\n                      v_id - 1,\n                      d,\n                      sizeof(struct wah_bpt_leading_data),\n                      &wah_leading_cache_handler);\n            BPT_LEADING(b) = v_id;\n        } else {\n            free(d);\n        }\n    }\n\n#if DEBUG\n    fprintf(stderr, \"END leading_repair\\n\");\n#endif\n}\n//}}}\n\n//{{{ giggle_data_handler :: wah_giggle_data_handler\nvoid wah_giggle_set_data_handler()\n{\n    bpt_node_repair = wah_leading_repair;\n\n    wah_giggle_data_handler.non_leading_cache_handler =\n        wah_non_leading_cache_handler;\n    wah_giggle_data_handler.leading_cache_handler = \n        wah_leading_cache_handler;\n    wah_giggle_data_handler.new_non_leading = \n        wah_new_non_leading;\n    wah_giggle_data_handler.new_leading = \n        wah_new_leading;\n    wah_giggle_data_handler.non_leading_SA_add_scalar = \n        wah_non_leading_SA_add_scalar;\n    wah_giggle_data_handler.non_leading_SE_add_scalar = \n        wah_non_leading_SE_add_scalar;\n    wah_giggle_data_handler.leading_B_add_scalar = \n        wah_leading_B_add_scalar;\n    wah_giggle_data_handler.leading_union_with_B = \n        wah_leading_union_with_B;\n    wah_giggle_data_handler.non_leading_union_with_SA = \n        wah_non_leading_union_with_SA;\n    wah_giggle_data_handler.non_leading_union_with_SA_subtract_SE = \n        wah_non_leading_union_with_SA_subtract_SE;\n    wah_giggle_data_handler.write_tree = NULL;\n\n   wah_giggle_data_handler.giggle_collect_intersection =\n        giggle_collect_intersection_data_in_pointers;\n\n    wah_giggle_data_handler.map_intersection_to_offset_list =\n        uint64_t_ll_map_intersection_to_offset_list;\n\n    giggle_data_handler = wah_giggle_data_handler;\n}\n\n//{{{void *wah_new_non_leading()\nvoid *wah_new_non_leading(uint32_t domain)\n{\n    struct wah_bpt_non_leading_data *d = \n            (struct wah_bpt_non_leading_data *)\n            malloc(sizeof( struct wah_bpt_non_leading_data));\n    d->SA = NULL;\n    d->SE = NULL;\n\n    return (void *)d;\n}\n//}}}\n\n//{{{void *wah_new_leading()\nvoid *wah_new_leading(uint32_t domain)\n{\n    struct wah_bpt_leading_data *d = \n            (struct wah_bpt_leading_data *)\n            malloc(sizeof( struct wah_bpt_leading_data));\n    d->B = NULL;\n\n    return (void *)d;\n}\n//}}}\n\n//{{{void wah_non_leading_SA_add_scalar(void *d, void *v)\nvoid wah_non_leading_SA_add_scalar(uint32_t domain,\n                                     void *_nld,\n                                     void *_id)\n{\n#if DEBUG\n    fprintf(stderr, \"uint64_t_ll_non_leading_SA_add_scalar\\n\");\n#endif\n    struct wah_bpt_non_leading_data *nld =\n            (struct wah_bpt_non_leading_data *)_nld;\n    uint32_t *id = (uint32_t *)_id;\n\n#if DEBUG\n    fprintf(stderr, \"id:%u\\n\", *id);\n#endif\n\n    // We need to add 1 here b/c we cannot store zero\n    wah_uniq_append(&(nld->SA), *id + 1);\n}\n//}}}\n\n//{{{void wah_non_leading_SE_add_scalar(void *d, void *v)\nvoid wah_non_leading_SE_add_scalar(uint32_t domain,\n                                     void *_nld,\n                                     void *_id)\n{\n#if DEBUG\n    fprintf(stderr, \"uint64_t_ll_non_leading_SA_add_scalar\\n\");\n#endif\n    struct wah_bpt_non_leading_data *nld =\n            (struct wah_bpt_non_leading_data *)_nld;\n    uint32_t *id = (uint32_t *)_id;\n\n#if DEBUG\n    fprintf(stderr, \"id:%u\\n\", *id);\n#endif\n\n    // We need to add 1 here b/c we cannot store zero\n    wah_uniq_append(&(nld->SE), *id + 1);\n}\n//}}}\n\n//{{{void wah_leading_B_add_scalar(void *d, void *v)\nvoid wah_leading_B_add_scalar(uint32_t domain,\n                                void *_ld,\n                                void *_id)\n{\n#if DEBUG\n    fprintf(stderr, \"uint64_t_ll_non_leading_SA_add_scalar\\n\");\n#endif\n    struct wah_bpt_leading_data *ld =\n            (struct wah_bpt_leading_data *)_ld;\n    uint32_t *id = (uint32_t *)_id;\n\n#if DEBUG\n    fprintf(stderr, \"id:%u\\n\", *id);\n#endif\n\n    // We need to add 1 here b/c we cannot store zero\n    wah_uniq_append(&(ld->B), *id + 1);\n}\n//}}}\n\n//{{{void wah_leading_union_with_B(void **R, void *leading)\nvoid wah_leading_union_with_B(uint32_t domain,\n                                void **R,\n                                void *leading)\n{\n    struct wah_bpt_leading_data *ld = \n            (struct wah_bpt_leading_data *)leading;\n\n    if ((ld != NULL) && (ld->B != NULL)) {\n        uint8_t **w = (uint8_t **)R;\n\n        if (*w == NULL)\n            *w = wah_init(0);\n\n        uint8_t *r = NULL;\n        uint32_t r_size = 0;\n        uint32_t resize = wah_or(*w, ld->B, &r, &r_size);\n\n        free(*w);\n        *w = r;\n    }\n}\n//}}}\n\n//{{{void wah_non_leading_union_with_SA(void **R, void *d)\nvoid wah_non_leading_union_with_SA(uint32_t domain, void **R, void *d)\n{\n    struct wah_bpt_non_leading_data *nld = \n            (struct wah_bpt_non_leading_data *) d;\n    if (nld != NULL) {\n        if ((nld->SA != NULL)) {\n            uint8_t **w = (uint8_t **)R;\n\n            if (*w == NULL)\n                *w = wah_init(0);\n\n            uint8_t *r = NULL;\n            uint32_t r_size = 0;\n            uint32_t resize = wah_or(*w, nld->SA, &r, &r_size);\n\n            free(*w);\n            *w = r;\n        }\n    }\n}\n//}}}\n\n//{{{void wah_non_leading_union_with_SA_subtract_SE(uint32_t domain,\nvoid wah_non_leading_union_with_SA_subtract_SE(uint32_t domain,\n                                                 void **R,\n                                                 void *d)\n{\n    struct wah_bpt_non_leading_data *nld = \n            (struct wah_bpt_non_leading_data *) d;\n\n    if (nld != NULL) {\n        if ((nld->SA != NULL)) {\n            uint8_t **w = (uint8_t **)R;\n\n            if (*w == NULL)\n                *w = wah_init(0);\n\n            uint8_t *r = NULL;\n            uint32_t r_size = 0;\n            uint32_t resize = wah_or(*w, nld->SA, &r, &r_size);\n\n            free(*w);\n            *w = r;\n        }\n        if ((nld->SE != NULL)) {\n            uint8_t **w = (uint8_t **)R;\n\n            if (*w == NULL)\n                *w = wah_init(0);\n\n            uint8_t *r = NULL;\n            uint32_t r_size = 0;\n            uint32_t resize = wah_nand(*w, nld->SE, &r, &r_size);\n\n            free(*w);\n            *w = r;\n        }\n    }\n}\n//}}}\n//}}}\n\n//{{{ wah_non_leading_cache_handler\nstruct cache_handler wah_non_leading_cache_handler = {\n        wah_non_leading_serialize,\n        wah_non_leading_deserialize,\n        wah_non_leading_free\n};\n\n//{{{uint64_t wah_non_leading_serialize(void *deserialized,\nuint64_t wah_non_leading_serialize(void *deserialized,\n                                     void **serialized)\n{\n    if (deserialized == NULL) {\n        *serialized = NULL;\n        return 0;\n    }\n\n    struct wah_bpt_non_leading_data *d =  \n            (struct wah_bpt_non_leading_data *)deserialized;\n\n    uint32_t SA_len = 0, SE_len = 0, serialized_len;\n\n    if (d->SA != NULL)\n        SA_len = sizeof(uint32_t) + \n            WAH_LEN(d->SA)*(WAH_SIZE/BYTE)*sizeof(uint8_t);\n\n    if (d->SE != NULL)\n        SE_len = sizeof(uint32_t) + \n            WAH_LEN(d->SE)*(WAH_SIZE/BYTE)*sizeof(uint8_t);\n\n    serialized_len = 2*sizeof(uint32_t) + SA_len + SE_len;\n\n    uint8_t *data = (uint8_t *)malloc(serialized_len);\n\n    uint32_t *data_u = (uint32_t *)data;\n    data_u[0] = SA_len;\n    data_u[1] = SE_len;\n\n    uint32_t data_i = 2*sizeof(uint32_t);\n\n\n    if (d->SA != NULL) \n        memcpy(data + data_i, d->SA, SA_len);\n\n    data_i += SA_len;\n\n\n    if (d->SE != NULL) \n        memcpy(data + data_i, d->SE, SE_len);\n\n    data_i += SE_len;\n\n    if (data_i != serialized_len)\n        errx(1,\n             \"Issue with wah_non_leading_serlize lengths. \"\n             \"Expected:%u observed:%u.\",\n             serialized_len,\n             data_i);\n\n    *serialized = data;\n\n    return serialized_len; \n}\n//}}}\n\n//{{{uint64_t wah_non_leading_deserialize(void *serialized,\nuint64_t wah_non_leading_deserialize(void *serialized,\n                                       uint64_t serialized_size,\n                                       void **deserialized)\n{\n    if ((serialized_size == 0) || (serialized == NULL)) {\n        *deserialized = NULL;\n        return 0;\n    }\n\n    if (serialized_size < sizeof(uint32_t)*2)\n        errx(1,\n             \"Malformed wah_non_leading serialized value. \"\n             \"Too short\");\n\n    uint32_t *data_u32 = (uint32_t *)serialized;\n\n    if ( 2*sizeof(uint32_t) + \n         (data_u32[0]+data_u32[1])*sizeof(uint8_t) != \n         serialized_size)\n        errx(1,\n             \"Malformed wah_non_leading serialized value. \"\n             \"Incorrect serialized_size.\");\n\n    struct wah_bpt_non_leading_data *d = \n            (struct wah_bpt_non_leading_data *)\n                    calloc(1, sizeof(struct wah_bpt_non_leading_data));\n    d->SA = NULL;\n    d->SE = NULL;\n\n    uint8_t *data_8 = (uint8_t *)(data_u32 + 2);\n\n    if (data_u32[0] > 0)\n        d->SA = wah_copy(data_8);\n\n    data_8 = data_8 + data_u32[0];\n\n    if (data_u32[1] > 0)\n        d->SE = wah_copy(data_8);\n\n\n    *deserialized = d;\n\n    return sizeof(struct wah_bpt_non_leading_data);\n}\n//}}}\n\n//{{{void wah_non_leading_free(void **deserialized)\nvoid wah_non_leading_free(void **deserialized)\n{\n    struct wah_bpt_non_leading_data **d = \n            (struct wah_bpt_non_leading_data **)deserialized;\n    if ((*d)->SA != NULL)\n        free((*d)->SA);\n    if ((*d)->SE != NULL)\n        free((*d)->SE);\n    free(*d);\n    *d = NULL;\n}\n//}}}\n//}}}\n\n//{{{ wah_leading_cache_handler \nstruct cache_handler wah_leading_cache_handler = {\n        wah_leading_serialize,\n        wah_leading_deserialize,\n        wah_leading_free\n};\n\n\n//{{{uint64_t wah_leading_serialize(void *deserialized,\nuint64_t wah_leading_serialize(void *deserialized,\n                                 void **serialized)\n{\n    if (deserialized == NULL) {\n        *serialized = NULL;\n        return 0;\n    }\n\n    struct wah_bpt_leading_data *d =  \n            (struct wah_bpt_leading_data *)deserialized;\n\n    uint32_t B_len = 0, serialized_len;\n\n    if (d->B != NULL)\n        B_len = sizeof(uint32_t) + \n                WAH_LEN(d->B)*(WAH_SIZE/BYTE)*sizeof(uint8_t);\n\n    serialized_len = sizeof(uint32_t) + B_len;\n\n    uint8_t *data = (uint8_t *)malloc(serialized_len);\n\n    uint32_t *data_u = (uint32_t *)data;\n    data_u[0] = B_len;\n\n    uint32_t data_i = sizeof(uint32_t);\n\n    if (d->B != NULL) \n        memcpy(data + data_i, d->B, B_len);\n\n    data_i += B_len;\n\n    if (data_i != serialized_len)\n        errx(1,\n             \"Issue with wah_leading_serlize lengths. \"\n             \"Expected:%u observed:%u.\",\n             serialized_len,\n             data_i);\n\n    *serialized = data;\n\n    return serialized_len; \n}\n//}}}\n\n//{{{uint64_t wah_leading_deserialize(void *serialized,\nuint64_t wah_leading_deserialize(void *serialized,\n                                   uint64_t serialized_size,\n                                   void **deserialized)\n{\n    if ((serialized_size == 0) || (serialized == NULL)) {\n        *deserialized = NULL;\n        return 0;\n    }\n\n    if (serialized_size < sizeof(uint32_t))\n        errx(1,\n             \"Malformed wah_leading serialized value. \"\n             \"Too short\");\n\n    uint32_t *data_u32 = (uint32_t *)serialized;\n\n    if ( sizeof(uint32_t) + \n         (data_u32[0])*sizeof(uint8_t) != serialized_size)\n        errx(1,\n             \"Malformed wah_leading serialized value. \"\n             \"Incorrect serialized_size.\");\n\n    struct wah_bpt_leading_data *d = \n            (struct wah_bpt_leading_data *)\n                    calloc(1, sizeof(struct wah_bpt_non_leading_data));\n    d->B = NULL;\n\n    uint8_t *data_8 = (uint8_t *)(data_u32 + 1);\n\n    if (data_u32[0] > 0)\n        d->B = wah_copy(data_8);\n\n    *deserialized = d;\n\n    return sizeof(struct wah_bpt_leading_data);\n}\n//}}}\n\n//{{{void wah_leading_free(void **deserialized)\nvoid wah_leading_free(void **deserialized)\n{\n    struct wah_bpt_leading_data **d = \n            (struct wah_bpt_leading_data **)deserialized;\n    if ( (*d)->B != NULL )\n        free ((*d)->B);\n    free(*d);\n    *d = NULL;\n}\n//}}}\n//}}}\n\n//{{{uint8_t *uints_to_wah(uint32_t *D, uint32_t D_num)\nuint8_t *uints_to_wah(uint32_t *D, uint32_t D_num)\n{\n    uint32_t bits_per_word = WAH_SIZE - 1;\n    uint32_t curr_word = 0, // num of words previously considered\n             curr_val = 0, // value at the current index\n             word_i = 0, // index into the array of words\n             dist, fill_size, first_val, last = 0;\n    uint32_t val, i;\n\n\n    uint32_t w_num = D_num*2;\n    uint8_t *w = (uint8_t *)malloc(sizeof(uint32_t) + \n                                   (w_num * (WAH_SIZE/BYTE) * sizeof(uint8_t)));\n\n    // loop over the sorted input\n    for (i = 0 ; i < D_num; ++i) {\n        // get the distance from the current value and the first value in the\n        // current word\n        val = D[i] - (curr_word * bits_per_word);\n\n        // will the val fit in the current word?\n        if (val <= bits_per_word) {\n            curr_val |= 1 << ( bits_per_word - val);\n        } else  {\n            if (curr_val > 0) {\n                set_wah_i(w, &curr_val, WAH_SIZE, word_i);\n                //fprintf(stderr,\"curr_val:%u\\tword_i:%u\\n\", curr_val, word_i);\n\n                curr_word += 1; // move to the next word\n                word_i += 1;\n                curr_val = 0;\n\n                if (word_i > w_num) {\n                    w_num *= 2;\n                    w = (uint8_t *)realloc(w,\n                                           sizeof(uint32_t) + \n                                           (w_num * \n                                           (WAH_SIZE/BYTE) * \n                                           sizeof(uint8_t)));\n                }\n\n                val = D[i] - (curr_word * bits_per_word);\n            }\n\n            uint32_t saved_words;\n            while (val > bits_per_word) {\n                fill_size = ((val + bits_per_word - 1) / bits_per_word) - 1;\n                saved_words = MIN(fill_size, WAH_MAX_FILL_WORDS);\n                curr_val = (1 << (bits_per_word)) + (saved_words);\n\n                set_wah_i(w, &curr_val, WAH_SIZE, word_i);\n                //fprintf(stderr,\"curr_val:%u\\tword_i:%u\\n\", curr_val, word_i);\n\n                curr_word += saved_words; // move to the next word\n                word_i += 1;\n                curr_val = 0;\n                if (word_i > w_num) {\n                    w_num *= 2;\n                    w = (uint8_t *)realloc(w,\n                                           sizeof(uint32_t) + \n                                           (w_num * \n                                           (WAH_SIZE/BYTE) * \n                                           sizeof(uint8_t)));\n                }\n                \n                val -= saved_words * bits_per_word;\n            }\n\n            if (val > 0) {\n                curr_val = 1 << ( bits_per_word - val);\n            } else {\n                curr_val = 0;\n            }\n        }\n    }\n\n    if (curr_val > 0)  {\n        set_wah_i(w, &curr_val, WAH_SIZE, word_i);\n        //fprintf(stderr,\"curr_val:%u\\tword_i:%u\\n\", curr_val, word_i);\n    }\n\n    w = (uint8_t *)realloc(w,\n                           sizeof(uint32_t) + \n                           ((word_i + 1) * \n                           (WAH_SIZE/BYTE) * \n                           sizeof(uint8_t)));\n\n    WAH_LEN(w) = word_i + 1;\n    //fprintf(stderr, \"WAH_LEN:%u\\n\", WAH_LEN(w));\n    return w;\n}\n//}}}\n"
  },
  {
    "path": "src/wah.h",
    "content": "#ifndef __WAH_H__\n#define __WAH_H__\n\n#include <stdint.h>\n#include \"bpt.h\"\n#include \"giggle_index.h\"\n\n#define BYTE 8\n#define WAH_LEN(W) ( ((uint32_t *)W)[0] )\n#define WAH_VAL(W,S) ( ((W >> (S-1))&1) == 1 ?  0 : W)\n#define WAH_NUM_WORDS(W,S) ( ((W >> (S-1))&1) == 1 ?  W & ~(1<< (S-1)) : 1)\n\nuint32_t WAH_SIZE;\nuint32_t WAH_MAX_FILL_WORDS;\n\n//uint8_t *wah_init(uint32_t word_size,\n                  //uint32_t val);\n\nuint8_t *wah_copy(uint8_t *w);\n\nuint8_t *wah_init(uint32_t val);\nuint32_t wah_or(uint8_t *X, uint8_t *Y, uint8_t **R, uint32_t *R_size);\nuint32_t wah_nand(uint8_t *X, uint8_t *Y, uint8_t **R, uint32_t *R_size);\n\nuint32_t wah_get_ints_count(uint8_t *X);\nuint32_t wah_get_ints(uint8_t *X, uint32_t **R);\n\nvoid wah_uniq_append(uint8_t **w, uint32_t id);\n\n\nstruct wah_bpt_non_leading_data\n{\n    uint8_t *SA, *SE;\n};\n\nstruct wah_bpt_leading_data\n{\n    uint8_t *B;\n};\n\n// bpt_node_repair :: wah_leading_repair\nvoid wah_leading_repair(uint32_t domain,\n                          struct bpt_node *a,\n                          struct bpt_node *b);\n\n// giggle_data_handler :: wah_giggle_data_handler\nvoid *wah_new_non_leading(uint32_t domain);\nvoid *wah_new_leading(uint32_t domain);\nvoid wah_non_leading_SA_add_scalar(uint32_t domain,\n                                     void *_nld,\n                                     void *_id);\nvoid wah_non_leading_SE_add_scalar(uint32_t domain,\n                                     void *_nld,\n                                     void *_id);\nvoid wah_leading_B_add_scalar(uint32_t domain,\n                                void *_ld,\n                                void *_id);\nvoid wah_leading_union_with_B(uint32_t domain,\n                                void **R,\n                                void *leading);\nvoid wah_non_leading_union_with_SA_subtract_SE(uint32_t domain,\n                                                 void **R,\n                                                 void *d);\nvoid wah_non_leading_union_with_SA(uint32_t domain, void **R, void *d);\n\nstruct giggle_def wah_giggle_data_handler;\n\n// cache_handler :: wah_non_leading_cache_handler\nuint64_t wah_non_leading_serialize(void *deserialized,\n                                     void **serialized);\nuint64_t wah_non_leading_deserialize(void *serialized,\n                                       uint64_t serialized_size,\n                                       void **deserialized);\nvoid wah_non_leading_free(void **deserialized);\nstruct cache_handler wah_non_leading_cache_handler;\n\n// cache_handler :: wah_leading_cache_handler\nuint64_t wah_leading_serialize(void *deserialized,\n                                 void **serialized);\nuint64_t wah_leading_deserialize(void *serialized,\n                                   uint64_t serialized_size,\n                                   void **deserialized);\nvoid wah_leading_free(void **deserialized);\nstruct cache_handler wah_leading_cache_handler;\n\nvoid wah_giggle_set_data_handler();\n\n\nvoid set_wah_i(uint8_t *W, void *v, uint32_t word_size, uint32_t i);\nvoid get_wah_i(uint8_t *W, void *v, uint32_t word_size, uint32_t i);\n\nuint8_t *uints_to_wah(uint32_t *D, uint32_t D_num);\n#endif\n"
  },
  {
    "path": "src/zlib_wrapper.c",
    "content": "#define _GNU_SOURCE\n\n#include <stdlib.h>\n#include <err.h>\n#include \"zlib_wrapper.h\"\n\nvoid* zlib_compress(void *data, uLong uncompressed_size, int level, uLong *compressed_size) {\n\n    *compressed_size = compressBound(uncompressed_size);\n\n    void *compressed_data = (void *) calloc(1, *compressed_size);\n    if (compressed_data == NULL)\n        err(1, \"calloc error in zlib_compress().\");\n\n    // Deflate\n    compress2((Bytef *)compressed_data, compressed_size, (Bytef *)data, uncompressed_size, level);\n\n    return compressed_data;\n}\n\nvoid* zlib_uncompress(void *compressed_data, uLong compressed_size, uLong uncompressed_size) {\n\n    void *uncompressed_data = (void *) calloc(1, uncompressed_size);\n    if (uncompressed_data == NULL)\n        err(1, \"calloc error in zlib_uncompress().\");\n\n    // Inflate\n    uncompress((Bytef *)uncompressed_data, &uncompressed_size, (Bytef *)compressed_data, compressed_size);\n\n    return uncompressed_data;\n}"
  },
  {
    "path": "src/zlib_wrapper.h",
    "content": "#ifndef __ZLIB_WRAPPER_H__\n#define __ZLIB_WRAPPER_H__\n\n#include <zlib.h>\n\n/**\n * @brief level must be between 0 and 9: \n * 1 gives best speed, 9 gives best compression, 0 gives no compression at all.\n */\nvoid* zlib_compress(void *data, uLong uncompressed_size, int level, uLong *compressed_size);\nvoid* zlib_uncompress(void *compressed_data, uLong compressed_size, uLong uncompressed_size);\n\n#endif\n"
  },
  {
    "path": "test/func/giggle_tests.sh",
    "content": "#!/bin/bash\n\ntest -e ssshtest || wget -q https://raw.githubusercontent.com/ryanlayer/ssshtest/master/ssshtest\n\n. ssshtest\n\nSTOP_ON_FAIL=0\n\nBEDTOOLS=`which bedtools`\n\necho $BEDTOOLS\n\n\n# Make the index\n../../bin/giggle index \\\n    -i \"../data/many/*gz\" \\\n    -o ../data/many_i \\\n    -f \\\n2> /dev/null\n\n../../bin/giggle index \\\n    -i \"../data/chr_mix/*gz\" \\\n    -o ../data/chr_mix_i \\\n    -f \\\n2> /dev/null\n\n\nif [ -n \"$BEDTOOLS\" ]\nthen\n    rm -f bt.out\n    ls ../data/many/*gz \\\n    | xargs -I{} \\\n        sh -c \\\n        \"$BEDTOOLS intersect -wa -b ../data/1k.sort.bed.gz -a {} >> bt.out\"\n\n    run check_intersections_per_file \\\n        ../../bin/giggle search \\\n        -q ../data/1k.sort.bed.gz \\\n        -i ../data/many_i \\\n        -v \n    assert_exit_code 0\n    assert_equal 0 $(diff <(grep -v \"#\" $STDOUT_FILE | cut -f1-3 | sort) <(cat bt.out | cut -f1-3 | sort) | wc -l)\n    rm -f bt.out\nfi\n\nfor i in `seq 1 10`\ndo\nR_CHRM=$((RANDOM%21 + 1))\nR_START=$RANDOM\nR_END=$((RANDOM*60+1+R_START))\nrun check_chr_v_nochr_search_$i \\\n        ../../bin/giggle search \\\n        -i ../data/chr_mix_i \\\n        -r $R_CHRM:$R_START-$R_END \nassert_equal 11 $(cat $STDOUT_FILE | grep \"^#\" | wc -l | awk '{print $1;}')\nassert_equal 0 $(diff $STDOUT_FILE <( ../../bin/giggle search \\\n                                        -i ../data/chr_mix_i \\\n                                        -r chr$R_CHRM:$R_START-$R_END) | wc -l)\ndone\n\n../../bin/giggle index \\\n    -i \"../data/many/*gz\" \\\n    -o ../data/many_i \\\n    -f \\\n2>/dev/null\n\n../../bin/giggle index \\\n    -s \\\n    -i \"../data/many/*gz\" \\\n    -o ../data/many_i_sort \\\n    -f \\\n2>/dev/null\n\nrun check_bulk_insert \\\n        ../../bin/giggle search \\\n        -s \\\n        -i ../data/many_i_sort \\\n        -q ../data/1k.sort.bed.gz\nassert_equal 23 $(cat $STDOUT_FILE | wc -l | awk '{print $1;}')\nassert_equal 0 $(diff $STDOUT_FILE <(../../bin/giggle search \\\n                                                      -s \\\n                                                      -i ../data/many_i \\\n                                                      -q ../data/1k.sort.bed.gz) | wc -l)\n\nrun check_offset_additional_data \\\n    ../../bin/api_test \"../data/many/*gz\" ../data/many_i 1 1000000 2000000\nassert_equal 72 $(cat $STDOUT_FILE | wc -l | awk '{print $1}')\nassert_equal 0 $(paste <(grep \"^data\" $STDOUT_FILE | cut -f2,3) \\\n                       <(grep \"^line\" $STDOUT_FILE | cut -f6,8) \\\n                 | awk '$1 !=0 && $2 != 0.000000' \\\n                 | awk '($1 != $3) || ($2-$4 > 0.001)' \\\n                 | wc -l )\n\nrun check_dense_index \\\n    ../../bin/giggle index \\\n        -s \\\n        -i \"../data/dense/*gz\" \\\n        -o ../data/dense_b \\\n        -f \\\n        -s \\\n    2>/dev/null\nassert_exit_code 0\n"
  },
  {
    "path": "test/unit/Makefile",
    "content": "UNITY_ROOT=./unity\nCC=gcc\nSRC=../../src/\nTEST_SRC = $(filter-out $(wildcard *_Runner.c), $(wildcard *.c))\nTEST_NAMES=$(TEST_SRC:.c=)\nPREFIX=Runner_\nRUNNERS=$(addprefix $(PREFIX),$(TESTS))\n\nNO_PRE_SRC_FILES= disk_store.c \\\n\t\t disk_file_header.c \\\n\t\t zlib_wrapper.c \\\n\t\t fastlz_wrapper.c \\\n\t\t cache.c \\\n\t\t giggle_index.c \\\n\t\t lists.c \\\n\t\t util.c \\\n\t\t ll.c \\\n\t\t timer.c \\\n\t\t file_read.c \\\n\t\t bpt.c \\\n\t\t wah.c \\\n\t\t leaf.c \\\n\t\t jsw_avltree.c \\\n\t\t pq.c \\\n\t\t offset_index.c \\\n\t\t metadata_index.c \\\n\t\t query_filter.c \\\n\t\t fastlz.c \\\n\t\t kfunc.c\n\n\nSRC_FILES=$(addprefix $(SRC),$(NO_PRE_SRC_FILES))\n\nall: clean $(TEST_NAMES) test\n\n\n\n%: %.c\n\t#ruby $(UNITY_ROOT)/auto/generate_test_runner.rb $@.c\n\truby $(UNITY_ROOT)/generate_test_runner.rb $@.c\n\t$(CC) -fcommon -g -o $@ \\\n\t    -I$(UNITY_ROOT) \\\n\t    -I$(SRC) \\\n\t    -I$(HTS_INC) \\\n\t    -DTEST $(UNITY_ROOT)/unity.c \\\n\t    -DSAMTOOLS=1 \\\n\t    -pthread \\\n\t    $(SRC_FILES) \\\n\t    $@.c $@_Runner.c \\\n\t    -L$(HTS_LIB) -lhts \\\n\t    -lz -lm -lcurl -lcrypto -lssl\n\t#rm $@_Runner.c\n\ntest:\n\t$(foreach var,$(TEST_NAMES),./$(var);)\n\nclean:\n\trm -f $(TEST_NAMES)\n\trm -f *_Runner.c\n\trm -rf *dSYM/\n"
  },
  {
    "path": "test/unit/test_bpt.c",
    "content": "#include <stdio.h>\n#include <stdlib.h>\n#include <time.h> \n#include <math.h>\n#include <stdio.h>\n#include <inttypes.h>\n#include <string.h>\n#include <stdbool.h>\n#include <unistd.h>\n\n#include \"bpt.h\"\n#include \"lists.h\"\n#include \"disk_store.h\"\n\n#include \"unity.h\"\n\n\nvoid setUp(void)\n{\n}\n\nvoid tearDown(void)\n{\n}\n\n//{{{ int uint32_t_cmp(const void *a, const void *b)\nstatic int uint32_t_cmp(const void *a, const void *b)\n{\n    uint32_t _a = *((uint32_t *)a), _b = *((uint32_t *)b);\n\n    if (_a < _b)\n        return -1;\n    else if (_a > _b)\n        return 1;\n    else\n\n    return 0;\n}\n//}}}\n\n//{{{ void test_b_search(void)\nvoid test_b_search(void)\n{\n    uint32_t D[10] = {2, 3, 4, 6, 8, 10, 12, 14, 16, 18};\n    uint32_t A[20] = {0, // 0\n                      0, // 1\n                      0, // 2\n                      1, // 3\n                      2, // 4\n                      3, // 5\n                      3, // 6\n                      4, // 7\n                      4, // 8\n                      5, // 9\n                      5, // 10\n                      6, // 11\n                      6, // 12\n                      7, // 13\n                      7, // 14\n                      8, // 15\n                      8, // 16\n                      9, // 17\n                      9, // 18\n                      10}; // 19\n\n    int i;\n    for (i = 0; i < 20; ++i)\n        TEST_ASSERT_EQUAL(A[i], b_search(i, D, 10));\n}\n//}}}\n\n//{{{void test_bpt_node_macros(void)\nvoid test_bpt_node_macros(void)\n{\n    ORDER = 4;\n    struct bpt_node *node = (struct bpt_node *)malloc(sizeof(struct bpt_node));\n\n    uint32_t data[18] = {1,  // id\n                         0,  // parent\n                         0,  // is_leaf\n                         0,  // leading\n                         0,  // next\n                         2,  // num_keys\n                         2, 3, 0, 0, 0,  // keys (ORDER = 4)\n                         0, // pointer head\n                         5, 6, 7, 0, 0, 0}; //pointers (ORDER = 4)\n    node->data = data;\n\n    TEST_ASSERT_EQUAL(node->data[0], BPT_ID(node));\n    TEST_ASSERT_EQUAL(node->data[1], BPT_PARENT(node));\n    TEST_ASSERT_EQUAL(node->data[2], BPT_IS_LEAF(node));\n    TEST_ASSERT_EQUAL(node->data[3], BPT_LEADING(node));\n    TEST_ASSERT_EQUAL(node->data[4], BPT_NEXT(node));\n    TEST_ASSERT_EQUAL(node->data[5], BPT_NUM_KEYS(node));\n    TEST_ASSERT_EQUAL(node->data + 6, BPT_KEYS(node));\n    TEST_ASSERT_EQUAL(node->data + 6 + ORDER + 1 + 1, BPT_POINTERS(node));\n\n    TEST_ASSERT_EQUAL(2, BPT_KEYS(node)[0]);\n    TEST_ASSERT_EQUAL(3, BPT_KEYS(node)[1]);\n    TEST_ASSERT_EQUAL(0, BPT_KEYS(node)[2]);\n    TEST_ASSERT_EQUAL(0, BPT_KEYS(node)[3]);\n    TEST_ASSERT_EQUAL(0, BPT_KEYS(node)[4]);\n\n    TEST_ASSERT_EQUAL(5, BPT_POINTERS(node)[0]);\n    TEST_ASSERT_EQUAL(6, BPT_POINTERS(node)[1]);\n    TEST_ASSERT_EQUAL(7, BPT_POINTERS(node)[2]);\n    TEST_ASSERT_EQUAL(0, BPT_POINTERS(node)[3]);\n    TEST_ASSERT_EQUAL(0, BPT_POINTERS(node)[4]);\n    TEST_ASSERT_EQUAL(0, BPT_POINTERS(node)[5]);\n\n    BPT_KEYS(node)[3] = 10;\n    TEST_ASSERT_EQUAL(10, BPT_KEYS(node)[3]);\n\n    BPT_ID(node) = 2;\n    TEST_ASSERT_EQUAL(2, BPT_ID(node));\n\n    ORDER=5;\n\n    uint32_t data2[20] = {1,\n                          0,  // parent\n                          0,  // is_leaf\n                          0,  // leading\n                          0,  // next\n                          2,  // num_keys\n                          2, 3, 0, 0, 0, 0,  // keys (ORDER = 4)\n                          0, \n                          5, 6, 7, 0, 0, 0, 0}; //pointers (ORDER = 4)\n\n    node->data = data2;\n\n    TEST_ASSERT_EQUAL(node->data[0], BPT_ID(node));\n    TEST_ASSERT_EQUAL(node->data[1], BPT_PARENT(node));\n    TEST_ASSERT_EQUAL(node->data[2], BPT_IS_LEAF(node));\n    TEST_ASSERT_EQUAL(node->data[3], BPT_LEADING(node));\n    TEST_ASSERT_EQUAL(node->data[4], BPT_NEXT(node));\n    TEST_ASSERT_EQUAL(node->data[5], BPT_NUM_KEYS(node));\n    TEST_ASSERT_EQUAL(node->data + 6, BPT_KEYS(node));\n    TEST_ASSERT_EQUAL(node->data + 6 + ORDER + 2, BPT_POINTERS(node));\n\n    TEST_ASSERT_EQUAL(2, BPT_KEYS(node)[0]);\n    TEST_ASSERT_EQUAL(3, BPT_KEYS(node)[1]);\n    TEST_ASSERT_EQUAL(0, BPT_KEYS(node)[2]);\n    TEST_ASSERT_EQUAL(0, BPT_KEYS(node)[3]);\n    TEST_ASSERT_EQUAL(0, BPT_KEYS(node)[4]);\n\n    TEST_ASSERT_EQUAL(5, BPT_POINTERS(node)[0]);\n    TEST_ASSERT_EQUAL(6, BPT_POINTERS(node)[1]);\n    TEST_ASSERT_EQUAL(7, BPT_POINTERS(node)[2]);\n    TEST_ASSERT_EQUAL(0, BPT_POINTERS(node)[3]);\n    TEST_ASSERT_EQUAL(0, BPT_POINTERS(node)[4]);\n    TEST_ASSERT_EQUAL(0, BPT_POINTERS(node)[5]);\n\n    free(node);\n}\n//}}}\n\n//{{{ void test_bpt_new_node(void)\nvoid test_bpt_new_node(void)\n{\n    struct simple_cache *sc = simple_cache_init(5, 1, NULL);\n\n    uint32_t domain = 0;\n\n    struct bpt_node *n = bpt_new_node(domain);\n    TEST_ASSERT_EQUAL(1, BPT_ID(n));\n    TEST_ASSERT_EQUAL(1, cache.seen(domain));\n\n    struct bpt_node *r = cache.get(domain, 1 - 1, &bpt_node_cache_handler);\n    TEST_ASSERT_EQUAL(n, r);\n\n    r = cache.get(domain, 2 - 1, &bpt_node_cache_handler);\n    TEST_ASSERT_EQUAL(NULL, r);\n\n    struct bpt_node *l = bpt_new_node(domain);\n    TEST_ASSERT_EQUAL(2, BPT_ID(l));\n    TEST_ASSERT_EQUAL(2, cache.seen(0));\n    \n    r = cache.get(domain, 2 - 1, &bpt_node_cache_handler);\n    TEST_ASSERT_EQUAL(l, r);\n\n    r = cache.get(domain, 3 - 1, &bpt_node_cache_handler);\n    TEST_ASSERT_EQUAL(NULL, r);\n\n    cache.destroy();\n}\n//}}}\n\n//{{{ void test_bpt_find_leaf(void)\nvoid test_bpt_find_leaf(void)\n{\n    struct simple_cache *sc = simple_cache_init(5, 1, NULL);\n\n    uint32_t domain = 0;\n\n    struct bpt_node *root = bpt_new_node(domain);\n    BPT_NUM_KEYS(root) = 1;\n    BPT_KEYS(root)[0] = 9;\n\n    struct bpt_node *n1 = bpt_new_node(domain);\n    BPT_NUM_KEYS(n1) = 1;\n    BPT_KEYS(n1)[0] = 5;\n\n    struct bpt_node *l1 = bpt_new_node(domain);\n    BPT_IS_LEAF(l1) = 1;\n    BPT_NUM_KEYS(l1) = 4;\n    BPT_KEYS(l1)[0] = 1;\n    BPT_KEYS(l1)[1] = 2;\n    BPT_KEYS(l1)[2] = 3;\n    BPT_KEYS(l1)[3] = 4;\n\n    struct bpt_node *l2 = bpt_new_node(domain);\n    BPT_IS_LEAF(l2) = 1;\n    BPT_NUM_KEYS(l2) = 4;\n    BPT_KEYS(l2)[0] = 5;\n    BPT_KEYS(l2)[1] = 6;\n    BPT_KEYS(l2)[2] = 7;\n    BPT_KEYS(l2)[3] = 8;\n\n    struct bpt_node *l3 = bpt_new_node(domain);\n    BPT_IS_LEAF(l3) = 1;\n    BPT_NUM_KEYS(l3) = 4;\n    BPT_KEYS(l3)[0] = 9;\n    BPT_KEYS(l3)[1] = 10;\n    BPT_KEYS(l3)[2] = 11;\n    BPT_KEYS(l3)[3] = 12;\n\n    BPT_NEXT(l1) = BPT_ID(l2);\n    BPT_NEXT(l2) = BPT_ID(l3);\n\n\n    BPT_POINTERS(n1)[0] = BPT_ID(l1);\n    BPT_POINTERS(n1)[1] = BPT_ID(l2);\n    BPT_PARENT(l1) = BPT_ID(n1);\n    BPT_PARENT(l2) = BPT_ID(n1);\n\n    BPT_POINTERS(root)[0] = BPT_ID(n1);\n    BPT_POINTERS(root)[1] = BPT_ID(l3);\n\n    BPT_PARENT(n1) = BPT_ID(root);\n    BPT_PARENT(l3) = BPT_ID(root);\n\n    int i;\n    for (i = 1; i <= 4; ++i)\n        TEST_ASSERT_EQUAL(BPT_ID(l1),\n                          bpt_find_leaf(domain, BPT_ID(root), i));\n\n    for (i = 5; i <= 8; ++i) \n        TEST_ASSERT_EQUAL(BPT_ID(l2),\n                          bpt_find_leaf(domain, BPT_ID(root), i));\n\n    for (i = 9; i <= 12; ++i) \n        TEST_ASSERT_EQUAL(BPT_ID(l3),\n                          bpt_find_leaf(domain, BPT_ID(root), i));\n\n    cache.destroy();\n}\n//}}}\n\n//{{{void test_bpt_split_node_non_root_parent_has_room(void)\nvoid test_bpt_split_node_non_root_parent_has_room(void)\n{\n    struct simple_cache *sc = simple_cache_init(5, 1, NULL);\n    ORDER = 4;\n\n    uint32_t domain = 0;\n    \n    /*\n     * 9\n     * 6\n     * 1,2,3,4,5\n     *\n     * Then split\n     *\n     * 9\n     * 3,6\n     * 1,2 3,4,5\n     */\n    struct bpt_node *root = bpt_new_node(domain);\n    BPT_NUM_KEYS(root) = 1;\n    BPT_KEYS(root)[0] = 9;\n\n    struct bpt_node *n1 = bpt_new_node(domain);\n    BPT_NUM_KEYS(n1) = 1;\n    BPT_KEYS(n1)[0] = 6;\n\n    BPT_POINTERS(root)[0] = BPT_ID(n1);\n    BPT_PARENT(n1) = BPT_ID(root);\n\n    struct bpt_node *l1 = bpt_new_node(domain);\n    BPT_IS_LEAF(l1) = 1;\n    BPT_NUM_KEYS(l1) = 5;\n    BPT_KEYS(l1)[0] = 1;\n    BPT_KEYS(l1)[1] = 2;\n    BPT_KEYS(l1)[2] = 3;\n    BPT_KEYS(l1)[3] = 4;\n    BPT_KEYS(l1)[4] = 5;\n\n    BPT_POINTERS(n1)[0] = BPT_ID(l1);\n    BPT_PARENT(l1) = BPT_ID(n1);\n\n    uint32_t *V_0 = (uint32_t *) malloc(sizeof(uint32_t));\n    *V_0 = 2;\n    uint32_t *V_1 = (uint32_t *) malloc(sizeof(uint32_t));\n    *V_1 = 3;\n    uint32_t *V_2 = (uint32_t *) malloc(sizeof(uint32_t));\n    *V_2 = 4;\n    uint32_t *V_3 = (uint32_t *) malloc(sizeof(uint32_t));\n    *V_3 = 5;\n    uint32_t *V_4 = (uint32_t *) malloc(sizeof(uint32_t));\n    *V_4 = 6;\n\n    // Put the data in the cache\n    TEST_ASSERT_EQUAL(4, cache.seen(domain) + 1);\n    BPT_POINTERS(l1)[0] = cache.seen(domain) + 1;\n    cache.add(domain,\n              cache.seen(domain),\n              V_0,\n              sizeof(uint32_t),\n              &uint32_t_cache_handler);\n\n    BPT_POINTERS(l1)[1] = cache.seen(domain) + 1;\n    cache.add(domain,\n              cache.seen(domain),\n              V_1, \n              sizeof(uint32_t),\n              &uint32_t_cache_handler);\n\n    BPT_POINTERS(l1)[2] = cache.seen(domain) + 1;\n    cache.add(domain,\n              cache.seen(domain),\n              V_2,\n              sizeof(uint32_t),\n              &uint32_t_cache_handler);\n\n    BPT_POINTERS(l1)[3] = cache.seen(domain) + 1;\n    cache.add(domain,\n              cache.seen(domain),\n              V_3,\n              sizeof(uint32_t),\n              &uint32_t_cache_handler);\n\n\n    BPT_POINTERS(l1)[4] = cache.seen(domain) + 1;\n    cache.add(domain,\n              cache.seen(domain),\n              V_4,\n              sizeof(uint32_t),\n              &uint32_t_cache_handler);\n\n\n\n    uint32_t lo_id, hi_id;\n    int split;\n    uint32_t root_id = bpt_split_node(domain,\n                                      BPT_ID(root),\n                                      BPT_ID(l1),\n                                      &lo_id,\n                                      &hi_id,\n                                      &split,\n                                      NULL);\n\n    TEST_ASSERT_EQUAL(BPT_ID(l1), lo_id);\n    TEST_ASSERT_EQUAL(BPT_NEXT(l1), hi_id);\n    TEST_ASSERT_EQUAL(2, split);\n\n\n    TEST_ASSERT_EQUAL(2, BPT_NUM_KEYS(l1));\n    struct bpt_node *hi_node = cache.get(domain,\n                                         hi_id - 1,\n                                         &bpt_node_cache_handler);\n    TEST_ASSERT_EQUAL(3, BPT_NUM_KEYS(hi_node));\n    TEST_ASSERT_EQUAL(2, BPT_NUM_KEYS(n1));\n    TEST_ASSERT_EQUAL(3, BPT_KEYS(n1)[0]);\n    TEST_ASSERT_EQUAL(6, BPT_KEYS(n1)[1]);\n    TEST_ASSERT_EQUAL(lo_id, BPT_POINTERS(n1)[0]);\n    TEST_ASSERT_EQUAL(hi_id, BPT_POINTERS(n1)[1]);\n\n    TEST_ASSERT_EQUAL(lo_id, bpt_find_leaf(domain, root_id, 1));\n    TEST_ASSERT_EQUAL(lo_id, bpt_find_leaf(domain, root_id, 2));\n    TEST_ASSERT_EQUAL(hi_id, bpt_find_leaf(domain, root_id, 3));\n    TEST_ASSERT_EQUAL(hi_id, bpt_find_leaf(domain, root_id, 4));\n    TEST_ASSERT_EQUAL(hi_id, bpt_find_leaf(domain, root_id, 5));\n\n    cache.destroy();\n}\n//}}}\n\n//{{{void test_bpt_split_node_root(void)\nvoid test_bpt_split_node_root(void)\n{\n    struct simple_cache *sc = simple_cache_init(5, 1, NULL);\n    uint32_t domain = 0;\n    ORDER = 4;\n\n    uint32_t *V_0 = (uint32_t *) malloc(sizeof(int));\n    *V_0 = 2;\n    uint32_t *V_1 = (uint32_t *) malloc(sizeof(int));\n    *V_1 = 3;\n    uint32_t *V_2 = (uint32_t *) malloc(sizeof(int));\n    *V_2 = 4;\n    uint32_t *V_3 = (uint32_t *) malloc(sizeof(int));\n    *V_3 = 5;\n    uint32_t *V_4 = (uint32_t *) malloc(sizeof(int));\n    *V_4 = 6;\n\n    /*\n     * 1,2,3,4,5\n     *\n     * SPLIT\n     *\n     * 3\n     * 1,2 3,4,5\n     */\n\n    struct bpt_node *root = bpt_new_node(domain);\n    BPT_IS_LEAF(root) = 1;\n    BPT_NUM_KEYS(root) = 5;\n    BPT_KEYS(root)[0] = 1;\n    BPT_KEYS(root)[1] = 2;\n    BPT_KEYS(root)[2] = 3;\n    BPT_KEYS(root)[3] = 4;\n    BPT_KEYS(root)[4] = 5;\n\n    BPT_POINTERS(root)[0] = cache.seen(domain) + 1;\n    cache.add(domain,\n            cache.seen(domain),\n            V_0,\n            sizeof(uint32_t),\n            &uint32_t_cache_handler);\n\n    BPT_POINTERS(root)[1] = cache.seen(domain) + 1;\n    cache.add(domain,\n              cache.seen(domain),\n              V_1,\n              sizeof(uint32_t),\n              &uint32_t_cache_handler);\n\n    BPT_POINTERS(root)[2] = cache.seen(domain) + 1;\n    cache.add(domain,\n              cache.seen(domain),\n              V_2,\n              sizeof(uint32_t),\n              &uint32_t_cache_handler);\n\n    BPT_POINTERS(root)[3] = cache.seen(domain) + 1;\n    cache.add(domain,\n              cache.seen(domain),\n              V_3,\n              sizeof(uint32_t),\n              &uint32_t_cache_handler);\n\n    BPT_POINTERS(root)[4] = cache.seen(domain) + 1;\n    cache.add(domain,\n              cache.seen(domain),\n              V_4,\n              sizeof(uint32_t),\n              &uint32_t_cache_handler);\n\n    uint32_t lo_id, hi_id;\n    int split;\n    uint32_t root_id = bpt_split_node(domain,\n                                      BPT_ID(root),\n                                      BPT_ID(root),\n                                      &lo_id,\n                                      &hi_id,\n                                      &split,\n                                      NULL);\n\n    TEST_ASSERT_EQUAL(BPT_ID(root), lo_id);\n    TEST_ASSERT_EQUAL(BPT_NEXT(root), hi_id);\n    TEST_ASSERT_EQUAL(2, split);\n\n\n    TEST_ASSERT_EQUAL(2, BPT_NUM_KEYS(root));\n    TEST_ASSERT_EQUAL(1, BPT_IS_LEAF(root));\n    TEST_ASSERT_EQUAL(root_id, BPT_PARENT(root));\n\n    struct bpt_node *next_node = cache.get(domain,\n                                           BPT_NEXT(root) - 1,\n                                           &bpt_node_cache_handler);\n    TEST_ASSERT_EQUAL(3, BPT_NUM_KEYS(next_node));\n    TEST_ASSERT_EQUAL(root_id, BPT_PARENT(next_node));\n\n    struct bpt_node *new_root = cache.get(domain,\n                                          root_id - 1,\n                                          &bpt_node_cache_handler);\n    TEST_ASSERT_EQUAL(1, BPT_NUM_KEYS(new_root));\n    TEST_ASSERT_EQUAL(3, BPT_KEYS(new_root)[0]);\n    TEST_ASSERT_EQUAL(lo_id, BPT_POINTERS(new_root)[0]);\n    TEST_ASSERT_EQUAL(hi_id, BPT_POINTERS(new_root)[1]);\n\n    cache.destroy();\n}\n//}}}\n\n//{{{void test_bpt_insert(void)\nvoid test_bpt_insert(void)\n{\n    struct simple_cache *sc = simple_cache_init(5, 1, NULL);\n    uint32_t domain = 0;\n\n    /*\n     * 2,3,4,5\n     *\n     * 4\n     *  2,3 4,5,6\n     *\n     * 4,6\n     *  2,3 4,5 6,7,8\n     *\n     * 4,6,8\n     *  2,3 4,5 6,7 8,9,10\n     *\n     * 4,6,8,10\n     *  2,3 4,5 6,7 8,9 10,11,12\n     *\n     * 8 \n     *  4,6 8,10,12\n     *   2,3 4,5 6,7 8,9 10,11 12,13,14\n     */\n    ORDER = 4;\n \n    uint32_t *V_0 = (uint32_t *) malloc(sizeof(uint32_t));\n    *V_0 = 1;\n    uint32_t *V_1 = (uint32_t *) malloc(sizeof(uint32_t));\n    *V_1 = 2;\n    uint32_t *V_2 = (uint32_t *) malloc(sizeof(uint32_t));\n    *V_2 = 3;\n    uint32_t *V_3 = (uint32_t *) malloc(sizeof(uint32_t));\n    *V_3 = 4;\n    uint32_t *V_4 = (uint32_t *) malloc(sizeof(uint32_t));\n    *V_4 = 5;\n    uint32_t *V_5 = (uint32_t *) malloc(sizeof(uint32_t));\n    *V_5 = 6;\n    uint32_t *V_6 = (uint32_t *) malloc(sizeof(uint32_t));\n    *V_6 = 7;\n    uint32_t *V_7 = (uint32_t *) malloc(sizeof(uint32_t));\n    *V_7 = 8;\n    uint32_t *V_8 = (uint32_t *) malloc(sizeof(uint32_t));\n    *V_8 = 9;\n    uint32_t *V_9 = (uint32_t *) malloc(sizeof(uint32_t));\n    *V_9 = 10;\n    uint32_t *V_10 = (uint32_t *) malloc(sizeof(uint32_t));\n    *V_10 = 11;\n    uint32_t *V_11 = (uint32_t *) malloc(sizeof(uint32_t));\n    *V_11 = 12;\n    uint32_t *V_12 = (uint32_t *) malloc(sizeof(uint32_t));\n    *V_12 = 13;\n\n    uint32_t leaf_id;\n    int pos;\n    uint32_t V_id = cache.seen(domain) + 1;\n    cache.add(domain,\n              V_id - 1,\n              V_0,\n              sizeof(uint32_t),\n              &uint32_t_cache_handler);\n\n    //2\n    uint32_t root_id = bpt_insert(domain,\n                                  0,\n                                  2,\n                                  V_id,\n                                  &uint32_t_cache_handler,\n                                  &leaf_id,\n                                  &pos);\n\n    struct bpt_node *root = cache.get(domain,\n                                      root_id - 1,\n                                      &bpt_node_cache_handler);\n    TEST_ASSERT_EQUAL(1, BPT_NUM_KEYS(root));\n    TEST_ASSERT_EQUAL(2, BPT_KEYS(root)[0]);\n    TEST_ASSERT_EQUAL(1, BPT_IS_LEAF(root));\n    TEST_ASSERT_EQUAL(root_id, leaf_id);\n    TEST_ASSERT_EQUAL(0, pos);\n\n    // 4\n    //  2,3 4,5,6\n    V_id = cache.seen(domain) + 1;\n    cache.add(domain,\n              V_id - 1,\n              V_1,\n              sizeof(uint32_t),\n              &uint32_t_cache_handler);\n    root_id = bpt_insert(domain,\n                         root_id,\n                         3,\n                         V_id,\n                         &uint32_t_cache_handler,\n                         &leaf_id,\n                         &pos);\n    TEST_ASSERT_EQUAL(root_id, leaf_id);\n    TEST_ASSERT_EQUAL(1, pos);\n\n    V_id = cache.seen(domain) + 1;\n    cache.add(domain,\n              V_id - 1,\n              V_2,\n              sizeof(uint32_t),\n              &uint32_t_cache_handler);\n    root_id = bpt_insert(domain,\n                         root_id,\n                         4,\n                         V_id,\n                         &uint32_t_cache_handler,\n                         &leaf_id,\n                         &pos);\n    TEST_ASSERT_EQUAL(root_id, leaf_id);\n    TEST_ASSERT_EQUAL(2, pos);\n\n    V_id = cache.seen(domain) + 1;\n    cache.add(domain,\n              V_id - 1,\n              V_3,\n              sizeof(uint32_t),\n              &uint32_t_cache_handler);\n    root_id = bpt_insert(domain,\n                         root_id,\n                         5,\n                         V_id,\n                         &uint32_t_cache_handler,\n                         &leaf_id,\n                         &pos);\n    TEST_ASSERT_EQUAL(root_id, leaf_id);\n    TEST_ASSERT_EQUAL(3, pos);\n\n    V_id = cache.seen(domain) + 1;\n    cache.add(domain,\n              V_id - 1,\n              V_4,\n              sizeof(uint32_t),\n              &uint32_t_cache_handler);\n    root_id = bpt_insert(domain,\n                         root_id,\n                         6,\n                         V_id,\n                         &uint32_t_cache_handler,\n                         &leaf_id,\n                         &pos);\n\n    TEST_ASSERT_EQUAL(2, pos);\n\n    TEST_ASSERT_FALSE(root_id == leaf_id);\n    root = cache.get(domain, root_id - 1, &bpt_node_cache_handler);\n    TEST_ASSERT_EQUAL(1, BPT_NUM_KEYS(root));\n    TEST_ASSERT_EQUAL(4, BPT_KEYS(root)[0]);\n    TEST_ASSERT_EQUAL(0, BPT_IS_LEAF(root));\n    TEST_ASSERT_EQUAL(leaf_id, BPT_POINTERS(root)[1]);\n\n    struct bpt_node *node = cache.get(domain,\n                                      BPT_POINTERS(root)[0] - 1,\n                                      &bpt_node_cache_handler);\n    TEST_ASSERT_EQUAL(2, BPT_NUM_KEYS(node));\n    TEST_ASSERT_EQUAL(2, BPT_KEYS(node)[0]);\n    TEST_ASSERT_EQUAL(3, BPT_KEYS(node)[1]);\n    TEST_ASSERT_EQUAL(1, BPT_IS_LEAF(node));\n\n    node = cache.get(domain, BPT_NEXT(node) - 1, &bpt_node_cache_handler);\n    TEST_ASSERT_EQUAL(3, BPT_NUM_KEYS(node));\n    TEST_ASSERT_EQUAL(4, BPT_KEYS(node)[0]);\n    TEST_ASSERT_EQUAL(5, BPT_KEYS(node)[1]);\n    TEST_ASSERT_EQUAL(6, BPT_KEYS(node)[2]);\n    TEST_ASSERT_EQUAL(1, BPT_IS_LEAF(node));\n\n    // 4,6\n    //  2,3 4,5 6,7,8\n    V_id = cache.seen(domain) + 1;\n    cache.add(domain,\n              V_id - 1,\n              V_5,\n              sizeof(uint32_t),\n              &uint32_t_cache_handler);\n    root_id = bpt_insert(domain,\n                         root_id,\n                         7,\n                         V_id,\n                         &uint32_t_cache_handler,\n                         &leaf_id,\n                         &pos);\n\n    V_id = cache.seen(domain) + 1;\n    cache.add(domain,\n              V_id - 1,\n              V_6,\n              sizeof(uint32_t),\n              &uint32_t_cache_handler);\n    root_id = bpt_insert(domain,\n                         root_id,\n                         8,\n                         V_id,\n                         &uint32_t_cache_handler,\n                         &leaf_id,\n                         &pos);\n\n    root = cache.get(domain, root_id - 1, &bpt_node_cache_handler);\n    TEST_ASSERT_EQUAL(2, BPT_NUM_KEYS(root));\n    TEST_ASSERT_EQUAL(4, BPT_KEYS(root)[0]);\n    TEST_ASSERT_EQUAL(6, BPT_KEYS(root)[1]);\n    TEST_ASSERT_EQUAL(0, BPT_IS_LEAF(root));\n\n    node = cache.get(domain,\n                     BPT_POINTERS(root)[0] - 1,\n                     &bpt_node_cache_handler);\n    TEST_ASSERT_EQUAL(2, BPT_NUM_KEYS(node));\n    TEST_ASSERT_EQUAL(2, BPT_KEYS(node)[0]);\n    TEST_ASSERT_EQUAL(3, BPT_KEYS(node)[1]);\n    TEST_ASSERT_EQUAL(1, BPT_IS_LEAF(node));\n\n    TEST_ASSERT_EQUAL(BPT_POINTERS(root)[1], BPT_NEXT(node));\n\n    node = cache.get(domain,\n                     BPT_POINTERS(root)[1] - 1,\n                     &bpt_node_cache_handler);\n    TEST_ASSERT_EQUAL(2, BPT_NUM_KEYS(node));\n    TEST_ASSERT_EQUAL(4, BPT_KEYS(node)[0]);\n    TEST_ASSERT_EQUAL(5, BPT_KEYS(node)[1]);\n    TEST_ASSERT_EQUAL(1, BPT_IS_LEAF(node));\n\n    TEST_ASSERT_EQUAL(BPT_POINTERS(root)[2], BPT_NEXT(node));\n\n    node = cache.get(domain,\n                     BPT_POINTERS(root)[2] - 1,\n                     &bpt_node_cache_handler);\n    TEST_ASSERT_EQUAL(3, BPT_NUM_KEYS(node));\n    TEST_ASSERT_EQUAL(6, BPT_KEYS(node)[0]);\n    TEST_ASSERT_EQUAL(7, BPT_KEYS(node)[1]);\n    TEST_ASSERT_EQUAL(8, BPT_KEYS(node)[2]);\n    TEST_ASSERT_EQUAL(1, BPT_IS_LEAF(node));\n\n    // 8\n    //   4,6 8,10,12\n    //     2,3 4,5 6,7 8,9 10,11 12,13,14\n    V_id = cache.seen(domain) + 1;\n    cache.add(domain,\n              V_id - 1,\n              V_7,\n              sizeof(uint32_t),\n              &uint32_t_cache_handler);\n    root_id = bpt_insert(domain,\n                         root_id,\n                         9,\n                         V_id,\n                         &uint32_t_cache_handler,\n                         &leaf_id,\n                         &pos);\n\n    V_id = cache.seen(domain) + 1;\n    cache.add(domain,\n              V_id - 1,\n              V_8,\n              sizeof(uint32_t),\n              &uint32_t_cache_handler);\n    root_id = bpt_insert(domain,\n                         root_id,\n                         10,\n                         V_id,\n                         &uint32_t_cache_handler,\n                         &leaf_id,\n                         &pos);\n\n    V_id = cache.seen(domain) + 1;\n    cache.add(domain,\n              V_id - 1,\n              V_9,\n              sizeof(uint32_t),\n              &uint32_t_cache_handler);\n    root_id = bpt_insert(domain,\n                         root_id,\n                         11,\n                         V_id,\n                         &uint32_t_cache_handler,\n                         &leaf_id,\n                         &pos);\n\n    V_id = cache.seen(domain) + 1;\n    cache.add(domain,\n              V_id - 1,\n              V_10,\n              sizeof(uint32_t),\n              &uint32_t_cache_handler);\n    root_id = bpt_insert(domain,\n                         root_id,\n                         12,\n                         V_id,\n                         &uint32_t_cache_handler,\n                         &leaf_id,\n                         &pos);\n\n    V_id = cache.seen(domain) + 1;\n    cache.add(domain,\n              V_id - 1,\n              V_11,\n              sizeof(uint32_t),\n              &uint32_t_cache_handler);\n    root_id = bpt_insert(domain,\n                         root_id,\n                         13,\n                         V_id,\n                         &uint32_t_cache_handler,\n                         &leaf_id,\n                         &pos);\n\n    V_id = cache.seen(domain) + 1;\n    cache.add(domain,\n              V_id - 1,\n              V_12,\n              sizeof(uint32_t),\n              &uint32_t_cache_handler);\n    root_id = bpt_insert(domain,\n                         root_id,\n                         14,\n                         V_id,\n                         &uint32_t_cache_handler,\n                         &leaf_id,\n                         &pos);\n\n    // 8\n    //   4,6 8,10,12\n    //     2,3 4,5 6,7 8,9 10,11 12,13,14\n    root = cache.get(domain,\n                     root_id - 1,\n                     &bpt_node_cache_handler);\n    TEST_ASSERT_EQUAL(1, BPT_NUM_KEYS(root));\n    TEST_ASSERT_EQUAL(8, BPT_KEYS(root)[0]);\n    TEST_ASSERT_EQUAL(0, BPT_IS_LEAF(root));\n\n    node = cache.get(domain,\n                     BPT_POINTERS(root)[0] - 1,\n                     &bpt_node_cache_handler);\n    TEST_ASSERT_EQUAL(2, BPT_NUM_KEYS(node));\n    TEST_ASSERT_EQUAL(4, BPT_KEYS(node)[0]);\n    TEST_ASSERT_EQUAL(6, BPT_KEYS(node)[1]);\n    TEST_ASSERT_EQUAL(0, BPT_IS_LEAF(node));\n\n    node = cache.get(domain,\n                     BPT_POINTERS(root)[1] - 1,\n                     &bpt_node_cache_handler);\n    TEST_ASSERT_EQUAL(3, BPT_NUM_KEYS(node));\n    TEST_ASSERT_EQUAL(8, BPT_KEYS(node)[0]);\n    TEST_ASSERT_EQUAL(10, BPT_KEYS(node)[1]);\n    TEST_ASSERT_EQUAL(12, BPT_KEYS(node)[2]);\n    TEST_ASSERT_EQUAL(0, BPT_IS_LEAF(node));\n\n    node = cache.get(domain,\n                     BPT_POINTERS(root)[0] - 1,\n                     &bpt_node_cache_handler);\n    struct bpt_node *leaf_1 = cache.get(domain,\n                                        BPT_POINTERS(node)[0] - 1,\n                                        &bpt_node_cache_handler);\n    TEST_ASSERT_EQUAL(2, BPT_NUM_KEYS(leaf_1));\n    TEST_ASSERT_EQUAL(2, BPT_KEYS(leaf_1)[0]);\n    TEST_ASSERT_EQUAL(3, BPT_KEYS(leaf_1)[1]);\n    TEST_ASSERT_EQUAL(1, BPT_IS_LEAF(leaf_1));\n\n    node = cache.get(domain,\n                     BPT_POINTERS(root)[0] - 1,\n                     &bpt_node_cache_handler);\n    struct bpt_node *leaf_2 = cache.get(domain,\n                                        BPT_POINTERS(node)[1] - 1,\n                                        &bpt_node_cache_handler);\n    TEST_ASSERT_EQUAL(2, BPT_NUM_KEYS(leaf_2));\n    TEST_ASSERT_EQUAL(4, BPT_KEYS(leaf_2)[0]);\n    TEST_ASSERT_EQUAL(5, BPT_KEYS(leaf_2)[1]);\n    TEST_ASSERT_EQUAL(1, BPT_IS_LEAF(leaf_2));\n\n    node = cache.get(domain,\n                     BPT_POINTERS(root)[0] - 1,\n                     &bpt_node_cache_handler);\n    struct bpt_node *leaf_3 = cache.get(domain,\n                                        BPT_POINTERS(node)[2] - 1,\n                                        &bpt_node_cache_handler);\n    TEST_ASSERT_EQUAL(2, BPT_NUM_KEYS(leaf_3));\n    TEST_ASSERT_EQUAL(6, BPT_KEYS(leaf_3)[0]);\n    TEST_ASSERT_EQUAL(7, BPT_KEYS(leaf_3)[1]);\n    TEST_ASSERT_EQUAL(1, BPT_IS_LEAF(leaf_3));\n\n    node = cache.get(domain,\n                     BPT_POINTERS(root)[1] - 1,\n                     &bpt_node_cache_handler);\n    struct bpt_node *leaf_4 = cache.get(domain,\n                                        BPT_POINTERS(node)[1] - 1,\n                                        &bpt_node_cache_handler);\n    TEST_ASSERT_EQUAL(2, BPT_NUM_KEYS(leaf_4));\n    TEST_ASSERT_EQUAL(8, BPT_KEYS(leaf_4)[0]);\n    TEST_ASSERT_EQUAL(9, BPT_KEYS(leaf_4)[1]);\n    TEST_ASSERT_EQUAL(1, BPT_IS_LEAF(leaf_4));\n\n    node = cache.get(domain,\n                     BPT_POINTERS(root)[1] - 1,\n                     &bpt_node_cache_handler);\n    struct bpt_node *leaf_5 = cache.get(domain,\n                                        BPT_POINTERS(node)[2] - 1,\n                                        &bpt_node_cache_handler);\n    TEST_ASSERT_EQUAL(2, BPT_NUM_KEYS(leaf_5));\n    TEST_ASSERT_EQUAL(10, BPT_KEYS(leaf_5)[0]);\n    TEST_ASSERT_EQUAL(11, BPT_KEYS(leaf_5)[1]);\n    TEST_ASSERT_EQUAL(1, BPT_IS_LEAF(leaf_5));\n\n    node = cache.get(domain,\n                     BPT_POINTERS(root)[1] - 1,\n                     &bpt_node_cache_handler);\n    struct bpt_node *leaf_6 = cache.get(domain,\n                                        BPT_POINTERS(node)[3] - 1,\n                                        &bpt_node_cache_handler);\n    TEST_ASSERT_EQUAL(3, BPT_NUM_KEYS(leaf_6));\n    TEST_ASSERT_EQUAL(12, BPT_KEYS(leaf_6)[0]);\n    TEST_ASSERT_EQUAL(13, BPT_KEYS(leaf_6)[1]);\n    TEST_ASSERT_EQUAL(14, BPT_KEYS(leaf_6)[2]);\n    TEST_ASSERT_EQUAL(1, BPT_IS_LEAF(leaf_6));\n\n    TEST_ASSERT_EQUAL(BPT_ID(leaf_2), BPT_NEXT(leaf_1));\n    TEST_ASSERT_EQUAL(BPT_ID(leaf_3), BPT_NEXT(leaf_2));\n    TEST_ASSERT_EQUAL(BPT_ID(leaf_4), BPT_NEXT(leaf_3));\n    TEST_ASSERT_EQUAL(BPT_ID(leaf_5), BPT_NEXT(leaf_4));\n    TEST_ASSERT_EQUAL(BPT_ID(leaf_6), BPT_NEXT(leaf_5));\n\n    cache.destroy();\n}\n//}}}\n\n//{{{ void test_bpt_insert_new_value(void)\nvoid test_bpt_insert_new_value(void)\n{\n    /*\n     * 8 \n     *  4,6 8,10,12\n     *   2,3 4,5 6,7 8,9 10,11 12,13,14\n     */\n    ORDER = 4;\n \n    uint32_t *V_0 = (uint32_t *) malloc(sizeof(uint32_t));\n    *V_0 = 1;\n    uint32_t *V_1 = (uint32_t *) malloc(sizeof(uint32_t));\n    *V_1 = 2;\n    uint32_t *V_2 = (uint32_t *) malloc(sizeof(uint32_t));\n    *V_2 = 3;\n    uint32_t *V_3 = (uint32_t *) malloc(sizeof(uint32_t));\n    *V_3 = 4;\n    uint32_t *V_4 = (uint32_t *) malloc(sizeof(uint32_t));\n    *V_4 = 5;\n    uint32_t *V_5 = (uint32_t *) malloc(sizeof(uint32_t));\n    *V_5 = 6;\n    uint32_t *V_6 = (uint32_t *) malloc(sizeof(uint32_t));\n    *V_6 = 7;\n    uint32_t *V_7 = (uint32_t *) malloc(sizeof(uint32_t));\n    *V_7 = 8;\n    uint32_t *V_8 = (uint32_t *) malloc(sizeof(uint32_t));\n    *V_8 = 9;\n    uint32_t *V_9 = (uint32_t *) malloc(sizeof(uint32_t));\n    *V_9 = 10;\n    uint32_t *V_10 = (uint32_t *) malloc(sizeof(uint32_t));\n    *V_10 = 11;\n    uint32_t *V_11 = (uint32_t *) malloc(sizeof(uint32_t));\n    *V_11 = 12;\n    uint32_t *V_12 = (uint32_t *) malloc(sizeof(uint32_t));\n    *V_12 = 13;\n\n    struct simple_cache *sc = simple_cache_init(5, 1, NULL);\n    uint32_t domain = 0;\n   \n    uint32_t leaf_id;\n    int pos;\n    uint32_t V_id, root_id;\n\n    root_id = bpt_insert_new_value(domain, \n                                   0,\n                                   2,\n                                   V_0,\n                                   &uint32_t_cache_handler,\n                                   &V_id,\n                                   &leaf_id,\n                                   &pos);\n\n    root_id = bpt_insert_new_value(domain,\n                                   root_id,\n                                   3,\n                                   V_1,\n                                   &uint32_t_cache_handler,\n                                   &V_id,\n                                   &leaf_id,\n                                   &pos);\n\n    root_id = bpt_insert_new_value(domain,\n                                   root_id,\n                                   4,\n                                   V_2,\n                                   &uint32_t_cache_handler,\n                                   &V_id,\n                                   &leaf_id,\n                                   &pos);\n\n    root_id = bpt_insert_new_value(domain,\n                                   root_id,\n                                   5,\n                                   V_3,\n                                   &uint32_t_cache_handler,\n                                   &V_id,\n                                   &leaf_id,\n                                   &pos);\n\n    root_id = bpt_insert_new_value(domain,\n                                   root_id,\n                                   6,\n                                   V_4,\n                                   &uint32_t_cache_handler,\n                                   &V_id,\n                                   &leaf_id,\n                                   &pos);\n\n    root_id = bpt_insert_new_value(domain,\n                                   root_id,\n                                   7,\n                                   V_5,\n                                   &uint32_t_cache_handler,\n                                   &V_id,\n                                   &leaf_id,\n                                   &pos);\n\n    root_id = bpt_insert_new_value(domain,\n                                   root_id,\n                                   8,\n                                   V_6,\n                                   &uint32_t_cache_handler,\n                                   &V_id,\n                                   &leaf_id,\n                                   &pos);\n\n    root_id = bpt_insert_new_value(domain,\n                                   root_id,\n                                   9,\n                                   V_7,\n                                   &uint32_t_cache_handler,\n                                   &V_id,\n                                   &leaf_id,\n                                   &pos);\n\n    root_id = bpt_insert_new_value(domain,\n                                   root_id,\n                                   10,\n                                   V_8,\n                                   &uint32_t_cache_handler,\n                                   &V_id,\n                                   &leaf_id,\n                                   &pos);\n\n\n    root_id = bpt_insert_new_value(domain,\n                                   root_id,\n                                   11,\n                                   V_9,\n                                   &uint32_t_cache_handler,\n                                   &V_id,\n                                   &leaf_id,\n                                   &pos);\n\n\n    root_id = bpt_insert_new_value(domain,\n                                   root_id,\n                                   12,\n                                   V_10,\n                                   &uint32_t_cache_handler,\n                                   &V_id,\n                                   &leaf_id,\n                                   &pos);\n\n\n    root_id = bpt_insert_new_value(domain,\n                                   root_id,\n                                   13,\n                                   V_11,\n                                   &uint32_t_cache_handler,\n                                   &V_id,\n                                   &leaf_id,\n                                   &pos);\n\n\n    root_id = bpt_insert_new_value(domain,\n                                   root_id,\n                                   14,\n                                   V_12,\n                                   &uint32_t_cache_handler,\n                                   &V_id,\n                                   &leaf_id,\n                                   &pos);\n\n    // 8\n    //   4,6 8,10,12\n    //     2,3 4,5 6,7 8,9 10,11 12,13,14\n    struct bpt_node *root = cache.get(domain,\n                                      root_id - 1,\n                                      &bpt_node_cache_handler);\n    TEST_ASSERT_EQUAL(1, BPT_NUM_KEYS(root));\n    TEST_ASSERT_EQUAL(8, BPT_KEYS(root)[0]);\n    TEST_ASSERT_EQUAL(0, BPT_IS_LEAF(root));\n\n    struct bpt_node *node = cache.get(domain,\n                                      BPT_POINTERS(root)[0] - 1,\n                                      &bpt_node_cache_handler);\n    TEST_ASSERT_EQUAL(2, BPT_NUM_KEYS(node));\n    TEST_ASSERT_EQUAL(4, BPT_KEYS(node)[0]);\n    TEST_ASSERT_EQUAL(6, BPT_KEYS(node)[1]);\n    TEST_ASSERT_EQUAL(0, BPT_IS_LEAF(node));\n\n    node = cache.get(domain,\n                     BPT_POINTERS(root)[1] - 1,\n                     &bpt_node_cache_handler);\n    TEST_ASSERT_EQUAL(3, BPT_NUM_KEYS(node));\n    TEST_ASSERT_EQUAL(8, BPT_KEYS(node)[0]);\n    TEST_ASSERT_EQUAL(10, BPT_KEYS(node)[1]);\n    TEST_ASSERT_EQUAL(12, BPT_KEYS(node)[2]);\n    TEST_ASSERT_EQUAL(0, BPT_IS_LEAF(node));\n\n    node = cache.get(domain,\n                     BPT_POINTERS(root)[0] - 1,\n                     &bpt_node_cache_handler);\n    struct bpt_node *leaf_1 = cache.get(domain,\n                                        BPT_POINTERS(node)[0] - 1,\n                                        &bpt_node_cache_handler);\n    TEST_ASSERT_EQUAL(2, BPT_NUM_KEYS(leaf_1));\n    TEST_ASSERT_EQUAL(2, BPT_KEYS(leaf_1)[0]);\n    TEST_ASSERT_EQUAL(3, BPT_KEYS(leaf_1)[1]);\n    TEST_ASSERT_EQUAL(1, BPT_IS_LEAF(leaf_1));\n\n    node = cache.get(domain,\n                     BPT_POINTERS(root)[0] - 1,\n                     &bpt_node_cache_handler);\n    struct bpt_node *leaf_2 = cache.get(domain,\n                                        BPT_POINTERS(node)[1] - 1,\n                                        &bpt_node_cache_handler);\n    TEST_ASSERT_EQUAL(2, BPT_NUM_KEYS(leaf_2));\n    TEST_ASSERT_EQUAL(4, BPT_KEYS(leaf_2)[0]);\n    TEST_ASSERT_EQUAL(5, BPT_KEYS(leaf_2)[1]);\n    TEST_ASSERT_EQUAL(1, BPT_IS_LEAF(leaf_2));\n\n    node = cache.get(domain,\n                     BPT_POINTERS(root)[0] - 1,\n                     &bpt_node_cache_handler);\n    struct bpt_node *leaf_3 = cache.get(domain,\n                                        BPT_POINTERS(node)[2] - 1,\n                                        &bpt_node_cache_handler);\n    TEST_ASSERT_EQUAL(2, BPT_NUM_KEYS(leaf_3));\n    TEST_ASSERT_EQUAL(6, BPT_KEYS(leaf_3)[0]);\n    TEST_ASSERT_EQUAL(7, BPT_KEYS(leaf_3)[1]);\n    TEST_ASSERT_EQUAL(1, BPT_IS_LEAF(leaf_3));\n\n    node = cache.get(domain,\n                     BPT_POINTERS(root)[1] - 1,\n                     &bpt_node_cache_handler);\n    struct bpt_node *leaf_4 = cache.get(domain,\n                                        BPT_POINTERS(node)[1] - 1,\n                                        &bpt_node_cache_handler);\n    TEST_ASSERT_EQUAL(2, BPT_NUM_KEYS(leaf_4));\n    TEST_ASSERT_EQUAL(8, BPT_KEYS(leaf_4)[0]);\n    TEST_ASSERT_EQUAL(9, BPT_KEYS(leaf_4)[1]);\n    TEST_ASSERT_EQUAL(1, BPT_IS_LEAF(leaf_4));\n\n    node = cache.get(domain,\n                     BPT_POINTERS(root)[1] - 1,\n                     &bpt_node_cache_handler);\n    struct bpt_node *leaf_5 = cache.get(domain,\n                                        BPT_POINTERS(node)[2] - 1,\n                                        &bpt_node_cache_handler);\n    TEST_ASSERT_EQUAL(2, BPT_NUM_KEYS(leaf_5));\n    TEST_ASSERT_EQUAL(10, BPT_KEYS(leaf_5)[0]);\n    TEST_ASSERT_EQUAL(11, BPT_KEYS(leaf_5)[1]);\n    TEST_ASSERT_EQUAL(1, BPT_IS_LEAF(leaf_5));\n\n    node = cache.get(domain,\n                     BPT_POINTERS(root)[1] - 1,\n                     &bpt_node_cache_handler);\n    struct bpt_node *leaf_6 = cache.get(domain,\n                                        BPT_POINTERS(node)[3] - 1,\n                                        &bpt_node_cache_handler);\n    TEST_ASSERT_EQUAL(3, BPT_NUM_KEYS(leaf_6));\n    TEST_ASSERT_EQUAL(12, BPT_KEYS(leaf_6)[0]);\n    TEST_ASSERT_EQUAL(13, BPT_KEYS(leaf_6)[1]);\n    TEST_ASSERT_EQUAL(14, BPT_KEYS(leaf_6)[2]);\n    TEST_ASSERT_EQUAL(1, BPT_IS_LEAF(leaf_6));\n\n    TEST_ASSERT_EQUAL(BPT_ID(leaf_2), BPT_NEXT(leaf_1));\n    TEST_ASSERT_EQUAL(BPT_ID(leaf_3), BPT_NEXT(leaf_2));\n    TEST_ASSERT_EQUAL(BPT_ID(leaf_4), BPT_NEXT(leaf_3));\n    TEST_ASSERT_EQUAL(BPT_ID(leaf_5), BPT_NEXT(leaf_4));\n    TEST_ASSERT_EQUAL(BPT_ID(leaf_6), BPT_NEXT(leaf_5));\n\n    cache.destroy();\n}\n//}}}\n\n//{{{ void test_bpt_insert_new_value(void)\nvoid test_bpt_rand_order_insert_new_value(void)\n{\n    /*\n     * 8 \n     *  4,6 8,10,12\n     *   2,3 4,5 6,7 8,9 10,11 12,13,14\n     */\n    ORDER = 4;\n \n    uint32_t *V_0 = (uint32_t *) malloc(sizeof(uint32_t));\n    *V_0 = 1;\n    uint32_t *V_1 = (uint32_t *) malloc(sizeof(uint32_t));\n    *V_1 = 2;\n    uint32_t *V_2 = (uint32_t *) malloc(sizeof(uint32_t));\n    *V_2 = 3;\n    uint32_t *V_3 = (uint32_t *) malloc(sizeof(uint32_t));\n    *V_3 = 4;\n    uint32_t *V_4 = (uint32_t *) malloc(sizeof(uint32_t));\n    *V_4 = 5;\n    uint32_t *V_5 = (uint32_t *) malloc(sizeof(uint32_t));\n    *V_5 = 6;\n    uint32_t *V_6 = (uint32_t *) malloc(sizeof(uint32_t));\n    *V_6 = 7;\n    uint32_t *V_7 = (uint32_t *) malloc(sizeof(uint32_t));\n    *V_7 = 8;\n    uint32_t *V_8 = (uint32_t *) malloc(sizeof(uint32_t));\n    *V_8 = 9;\n    uint32_t *V_9 = (uint32_t *) malloc(sizeof(uint32_t));\n    *V_9 = 10;\n    uint32_t *V_10 = (uint32_t *) malloc(sizeof(uint32_t));\n    *V_10 = 11;\n    uint32_t *V_11 = (uint32_t *) malloc(sizeof(uint32_t));\n    *V_11 = 12;\n    uint32_t *V_12 = (uint32_t *) malloc(sizeof(uint32_t));\n    *V_12 = 13;\n\n    struct simple_cache *sc = simple_cache_init(5, 1, NULL);\n    uint32_t domain = 0;\n   \n    uint32_t l;\n    int p;\n    uint32_t v, r;\n\n    r = bpt_insert_new_value(domain,\n                             0,\n                             4,\n                             V_2,\n                             &uint32_t_cache_handler,\n                             &v,\n                             &l,\n                             &p);\n\n    r = bpt_insert_new_value(domain,\n                             r,\n                             3,\n                             V_1,\n                             &uint32_t_cache_handler,\n                             &v,\n                             &l,\n                             &p);\n\n    r = bpt_insert_new_value(domain,\n                             r,\n                             2,\n                             V_0,\n                             &uint32_t_cache_handler,\n                             &v,\n                             &l,\n                             &p);\n\n    r = bpt_insert_new_value(domain,\n                             r,\n                             14,\n                             V_12,\n                             &uint32_t_cache_handler,\n                             &v,\n                             &l,\n                             &p);\n\n    r = bpt_insert_new_value(domain,\n                             r,\n                             5,\n                             V_3,\n                             &uint32_t_cache_handler,\n                             &v,\n                             &l,\n                             &p);\n\n    r = bpt_insert_new_value(domain,\n                             r,\n                             12,\n                             V_10,\n                             &uint32_t_cache_handler,\n                             &v,\n                             &l,\n                             &p);\n\n    r = bpt_insert_new_value(domain,\n                             r,\n                             7,\n                             V_5,\n                             &uint32_t_cache_handler,\n                             &v,\n                             &l,\n                             &p);\n\n    r = bpt_insert_new_value(domain,\n                             r,\n                             9,\n                             V_7,\n                             &uint32_t_cache_handler,\n                             &v,\n                             &l,\n                             &p);\n\n    r = bpt_insert_new_value(domain,\n                             r,\n                             8,\n                             V_6,\n                             &uint32_t_cache_handler,\n                             &v,\n                             &l,\n                             &p);\n\n    r = bpt_insert_new_value(domain,\n                             r,\n                             13,\n                             V_11,\n                             &uint32_t_cache_handler,\n                             &v,\n                             &l,\n                             &p);\n\n    r = bpt_insert_new_value(domain,\n                             r,\n                             11,\n                             V_9,\n                             &uint32_t_cache_handler,\n                             &v,\n                             &l,\n                             &p);\n\n    r = bpt_insert_new_value(domain,\n                             r,\n                             6,\n                             V_4,\n                             &uint32_t_cache_handler,\n                             &v,\n                             &l,\n                             &p);\n\n    r = bpt_insert_new_value(domain,\n                             r,\n                             10,\n                             V_8,\n                             &uint32_t_cache_handler,\n                             &v,\n                             &l,\n                             &p);\n\n    /*\n     * 4,7,9,12\n     * 2,3, 4,5,6 7,8, 9,10,11 12,13,14\n     */\n\n    struct bpt_node *root = cache.get(domain, r - 1, &bpt_node_cache_handler);\n    TEST_ASSERT_EQUAL(4, BPT_NUM_KEYS(root));\n    TEST_ASSERT_EQUAL(4, BPT_KEYS(root)[0]);\n    TEST_ASSERT_EQUAL(7, BPT_KEYS(root)[1]);\n    TEST_ASSERT_EQUAL(9, BPT_KEYS(root)[2]);\n    TEST_ASSERT_EQUAL(12, BPT_KEYS(root)[3]);\n    TEST_ASSERT_EQUAL(0, BPT_IS_LEAF(root));\n\n    struct bpt_node *leaf_1 = cache.get(domain,\n                                        BPT_POINTERS(root)[0] - 1,\n                                        &bpt_node_cache_handler);\n    TEST_ASSERT_EQUAL(2, BPT_NUM_KEYS(leaf_1));\n    TEST_ASSERT_EQUAL(2, BPT_KEYS(leaf_1)[0]);\n    TEST_ASSERT_EQUAL(3, BPT_KEYS(leaf_1)[1]);\n    TEST_ASSERT_EQUAL(1, BPT_IS_LEAF(leaf_1));\n\n    struct bpt_node *leaf_2 = cache.get(domain,\n                                        BPT_POINTERS(root)[1] - 1,\n                                        &bpt_node_cache_handler);\n    TEST_ASSERT_EQUAL(3, BPT_NUM_KEYS(leaf_2));\n    TEST_ASSERT_EQUAL(4, BPT_KEYS(leaf_2)[0]);\n    TEST_ASSERT_EQUAL(5, BPT_KEYS(leaf_2)[1]);\n    TEST_ASSERT_EQUAL(6, BPT_KEYS(leaf_2)[2]);\n    TEST_ASSERT_EQUAL(1, BPT_IS_LEAF(leaf_2));\n\n    struct bpt_node *leaf_3 = cache.get(domain,\n                                        BPT_POINTERS(root)[2] - 1,\n                                        &bpt_node_cache_handler);\n    TEST_ASSERT_EQUAL(2, BPT_NUM_KEYS(leaf_3));\n    TEST_ASSERT_EQUAL(7, BPT_KEYS(leaf_3)[0]);\n    TEST_ASSERT_EQUAL(8, BPT_KEYS(leaf_3)[1]);\n    TEST_ASSERT_EQUAL(1, BPT_IS_LEAF(leaf_3));\n\n    struct bpt_node *leaf_4 = cache.get(domain,\n                                        BPT_POINTERS(root)[3] - 1,\n                                        &bpt_node_cache_handler);\n    TEST_ASSERT_EQUAL(3, BPT_NUM_KEYS(leaf_4));\n    TEST_ASSERT_EQUAL(9, BPT_KEYS(leaf_4)[0]);\n    TEST_ASSERT_EQUAL(10, BPT_KEYS(leaf_4)[1]);\n    TEST_ASSERT_EQUAL(11, BPT_KEYS(leaf_4)[2]);\n    TEST_ASSERT_EQUAL(1, BPT_IS_LEAF(leaf_4));\n\n    struct bpt_node *leaf_5 = cache.get(domain,\n                                        BPT_POINTERS(root)[4] - 1,\n                                        &bpt_node_cache_handler);\n    TEST_ASSERT_EQUAL(3, BPT_NUM_KEYS(leaf_5));\n    TEST_ASSERT_EQUAL(12, BPT_KEYS(leaf_5)[0]);\n    TEST_ASSERT_EQUAL(13, BPT_KEYS(leaf_5)[1]);\n    TEST_ASSERT_EQUAL(14, BPT_KEYS(leaf_5)[2]);\n    TEST_ASSERT_EQUAL(1, BPT_IS_LEAF(leaf_5));\n\n    TEST_ASSERT_EQUAL(BPT_ID(leaf_2), BPT_NEXT(leaf_1));\n    TEST_ASSERT_EQUAL(BPT_ID(leaf_3), BPT_NEXT(leaf_2));\n    TEST_ASSERT_EQUAL(BPT_ID(leaf_4), BPT_NEXT(leaf_3));\n    TEST_ASSERT_EQUAL(BPT_ID(leaf_5), BPT_NEXT(leaf_4));\n\n    cache.destroy();\n}\n//}}}\n\n//{{{void test_bpt_insert_id_updated_bpt_node(void)\nvoid test_bpt_insert_id_updated_bpt_node(void)\n{\n    int V[14] = {1,2,3,4,5,6,7,8,9,10,11,12,13,14};\n    /*\n    uint32_t *V[14];\n    uint32_t i;\n    for (i = 0; i < 14; ++i) {\n        V[i] = (uint32_t *)calloc(1,sizeof(uint32_t));\n        *(V[i]) = i;\n    }\n    */\n\n    struct simple_cache *sc = simple_cache_init(5, 1, NULL);\n    uint32_t domain = 0;\n \n    uint32_t r = 0, l, v = 0, v_id;\n    int p;\n\n    //r = bpt_insert_new_value(0, 4, V_2, free_wrapper, &v, &l, &p);\n\n    r = bpt_insert_new_value(domain,\n                             r,\n                             2,\n                             (V + v++),\n                             NULL,\n                             &v_id,\n                             &l,\n                             &p);\n    r = bpt_insert_new_value(domain,\n                             r,\n                             5,\n                             (V + v++),\n                             NULL,\n                             &v_id,\n                             &l,\n                             &p);\n    r = bpt_insert_new_value(domain,\n                             r,\n                             10,\n                             (V + v++),\n                             NULL,\n                             &v_id,\n                             &l,\n                             &p);\n    r = bpt_insert_new_value(domain,\n                             r,\n                             15,\n                             (V + v++),\n                             NULL,\n                             &v_id,\n                             &l,\n                             &p);\n\n    r = bpt_insert_new_value(domain,\n                             r,\n                             1,\n                             (V + v++),\n                             NULL,\n                             &v_id,\n                             &l,\n                             &p);\n\n    struct bpt_node *root = cache.get(domain, r - 1, &bpt_node_cache_handler);\n    TEST_ASSERT_EQUAL(BPT_POINTERS(root)[0], l);\n\n    cache.destroy();\n}\n//}}}\n\n//{{{void test_find(void)\nvoid test_find(void)\n{\n    /*\n     *  -> 2\n     *  -> 4\n     *  -> 6\n     *  -> 8\n     *  2,4,6,8\n     *\n     *  -> 10 \n     *  6\n     *  2,4, 6,8,10\n     *\n     *  -> 12 \n     *  6\n     *  2,4, 6,8,10,12\n     *\n     *  -> 14 \n     *  6,10\n     *  2,4, 6,8  10,12,14\n     *\n     *  -> 16 \n     *  6,10\n     *  2,4, 6,8  10,12,14,16\n     *\n     *  -> 18 \n     *  6,10,14\n     *  2,4, 6,8  10,12 14,16,18\n     *\n     *  -> 20 \n     *  6,10,14\n     *  2,4, 6,8  10,12 14,16,18,20\n     *\n     *  -> 22 \n     *  6,10,14,18\n     *  2,4, 6,8  10,12 14,16 18,20,22\n     *\n     *  -> 24 \n     *  6,10,14,18\n     *  2,4, 6,8  10,12 14,16 18,20,22,24\n     *\n     *  -> 26 \n     *  14\n     *  6,10 14,18,22\n     *  2,4, 6,8  10,12 14,16 18,20 22,24,26\n     *\n     */\n\n    struct simple_cache *sc = simple_cache_init(5, 1, NULL);\n    uint32_t domain = 0;\n\n    int V[13] = {1,2,3,4,5,6,7,8,9,10,11,12,13};\n    int v=0;\n\n    uint32_t r_id = 0, l_id, v_id;\n    int pos;\n\n    int i;\n    for (i = 0; i < 13; ++i)\n        r_id = bpt_insert_new_value(domain,\n                                    r_id,\n                                    (i+1)*2,\n                                    (V + v++),\n                                    NULL,\n                                    &v_id,\n                                    &l_id,\n                                    &pos);\n\n    uint32_t r_i;\n    int *r, pos_r, pos_r_i = 0;\n    v=0;\n    int POS_R[13] = {0,1,0,1,0,1,0,1,0,1,0,1,2};\n    for (i = 1; i <= 13; ++i) {\n        r_i = bpt_find(domain, r_id, &l_id, &pos_r, i);\n        if (i % 2 != 0)\n            TEST_ASSERT_EQUAL(0, r_i);\n        else  {\n            r = cache.get(domain, r_i - 1, NULL);\n            TEST_ASSERT_EQUAL(i/2, *r);\n            TEST_ASSERT_EQUAL(POS_R[pos_r_i], pos_r);\n            pos_r_i += 1;\n        }\n    }\n\n    cache.destroy();\n}\n//}}}\n\n//{{{void test_split_repair(void)\nvoid decrement_repair(uint32_t domain, struct bpt_node *a, struct bpt_node *b)\n{\n    uint32_t i;\n    for (i = 0; i < BPT_NUM_KEYS(a); ++i)\n        BPT_KEYS(a)[i] = BPT_KEYS(a)[i] - 1;\n\n    for (i = 0; i < BPT_NUM_KEYS(b); ++i)\n        BPT_KEYS(b)[i] = BPT_KEYS(b)[i] + 1;\n\n}\n\nvoid test_split_repair(void)\n{\n    /*\n     * 2,3,4,5\n     *\n     * 4\n     *  2,3 4,5,6\n     *\n     * 4,6\n     *  2,3 4,5 6,7,8\n     *\n     * 4,6,8\n     *  2,3 4,5 6,7 8,9,10\n     *\n     * 4,6,8,10\n     *  2,3 4,5 6,7 8,9 10,11,12\n     *\n     * 8 \n     *  4,6 8,10,12\n     *   2,3 4,5 6,7 8,9 10,11 12,13,14\n     */\n    int V[14] = {1,2,3,4,5,6,7,8,9,10,11,12,13,14};\n    int v=0;\n\n    bpt_node_repair = decrement_repair;\n\n    struct simple_cache *sc = simple_cache_init(5, 1, NULL);\n    uint32_t domain = 0;\n\n    uint32_t r_id = 0, l_id, v_id;\n    int pos;\n\n    int i;\n    r_id = bpt_insert_new_value(domain,\n                                r_id,\n                                2,\n                                (V + v++),\n                                NULL,\n                                &v_id,\n                                &l_id,\n                                &pos);\n\n\n    struct bpt_node *root = cache.get(domain,\n                                      r_id - 1,\n                                      &bpt_node_cache_handler);\n    TEST_ASSERT_EQUAL(1, BPT_NUM_KEYS(root));\n    TEST_ASSERT_EQUAL(2, BPT_KEYS(root)[0]);\n    TEST_ASSERT_EQUAL(1, BPT_IS_LEAF(root));\n\n    //  2,3,4,5\n    r_id = bpt_insert_new_value(domain,\n                                r_id,\n                                3,\n                                (V + v++),\n                                NULL,\n                                &v_id,\n                                &l_id,\n                                &pos);\n    r_id = bpt_insert_new_value(domain,\n                                r_id,\n                                4,\n                                (V + v++),\n                                NULL,\n                                &v_id,\n                                &l_id,\n                                &pos);\n    r_id = bpt_insert_new_value(domain,\n                                r_id,\n                                5,\n                                (V + v++),\n                                NULL,\n                                &v_id,\n                                &l_id,\n                                &pos);\n\n    root = cache.get(domain, r_id - 1, &bpt_node_cache_handler);\n    TEST_ASSERT_EQUAL(4, BPT_NUM_KEYS(root));\n    TEST_ASSERT_EQUAL(2, BPT_KEYS(root)[0]);\n    TEST_ASSERT_EQUAL(3, BPT_KEYS(root)[1]);\n    TEST_ASSERT_EQUAL(4, BPT_KEYS(root)[2]);\n    TEST_ASSERT_EQUAL(5, BPT_KEYS(root)[3]);\n    TEST_ASSERT_EQUAL(1, BPT_IS_LEAF(root));\n\n    // 4\n    //  2,3 4,5,6\n    r_id = bpt_insert_new_value(domain,\n                                r_id,\n                                6,\n                                (V + v++),\n                                NULL,\n                                &v_id,\n                                &l_id,\n                                &pos);\n\n    // Using a silly split repair function just to test, \n    // -1 the keys in the left bpt_node and + those in the right\n\n    // 5\n    //  1,2 5,6,7\n    root = cache.get(domain, r_id - 1, &bpt_node_cache_handler);\n    TEST_ASSERT_EQUAL(1, BPT_NUM_KEYS(root));\n    TEST_ASSERT_EQUAL(5, BPT_KEYS(root)[0]);\n    TEST_ASSERT_EQUAL(0, BPT_IS_LEAF(root));\n\n    struct bpt_node *node_l = cache.get(domain,\n                                        BPT_POINTERS(root)[0] - 1,\n                                        &bpt_node_cache_handler);\n    struct bpt_node *node_r = cache.get(domain,\n                                        BPT_POINTERS(root)[1] - 1,\n                                        &bpt_node_cache_handler);\n    TEST_ASSERT_EQUAL(2, BPT_NUM_KEYS(node_l));\n    TEST_ASSERT_EQUAL(1, BPT_KEYS(node_l)[0]);\n    TEST_ASSERT_EQUAL(2, BPT_KEYS(node_l)[1]);\n    TEST_ASSERT_EQUAL(1, BPT_IS_LEAF(node_l));\n    TEST_ASSERT_EQUAL(BPT_POINTERS(root)[1], BPT_NEXT(node_l));\n\n    TEST_ASSERT_EQUAL(3, BPT_NUM_KEYS(node_r));\n    TEST_ASSERT_EQUAL(5, BPT_KEYS(node_r)[0]);\n    TEST_ASSERT_EQUAL(6, BPT_KEYS(node_r)[1]);\n    TEST_ASSERT_EQUAL(7, BPT_KEYS(node_r)[2]);\n    TEST_ASSERT_EQUAL(1, BPT_IS_LEAF(node_r));\n    TEST_ASSERT_EQUAL(0, BPT_NEXT(node_r));\n\n    bpt_node_repair = NULL;\n\n    cache.destroy();\n}\n//}}}\n\n//{{{ void test_rand_test(void)\nvoid test_rand_test(void)\n{\n    bpt_node_repair = NULL;\n    ORDER = 10;\n    struct simple_cache *sc = simple_cache_init(5, 1, NULL);\n    uint32_t domain = 0;\n\n    uint32_t r_id = 0, l_id, v_id;\n    int pos;\n\n    uint32_t size = 1000;\n\n    uint32_t *d = (uint32_t *)malloc(size * sizeof(uint32_t));\n    uint32_t *v = (uint32_t *)malloc(size * sizeof(uint32_t));\n\n    time_t t = time(NULL);\n    srand(t);\n\n    uint32_t i, j;\n    for (i = 0; i < size; ++i) {\n        d[i] = rand() % 100000;\n        v[i] = d[i] /2;\n        r_id = bpt_insert_new_value(domain,\n                                    r_id,\n                                    d[i],\n                                    (v + i),\n                                    NULL,\n                                    &v_id,\n                                    &l_id,\n                                    &pos);\n    }\n\n    int pos_i;\n    for (i = 0; i < size; ++i) {\n        uint32_t r_i = bpt_find(domain, r_id, &l_id, &pos_i, d[i]);\n        int *r = cache.get(domain, r_i - 1, NULL);\n        TEST_ASSERT_EQUAL(d[i]/2, *r);\n    }\n\n    free(d);\n    free(v);\n    cache.destroy();\n}\n//}}}\n\n//{{{ void test_bpt_insert_repeat(void)\nvoid test_bpt_insert_repeat(void)\n{\n    bpt_node_repair = NULL;\n    ORDER = 4;\n    struct simple_cache *sc = simple_cache_init(5, 1, NULL);\n    uint32_t domain = 0;\n\n    int V[14] = {1,2,3,4,5,6,7,8,9,10,11,12,13,14};\n\n    uint32_t r_id = 0, v_id, l_id;\n    int pos;\n\n    r_id = bpt_insert_new_value(domain,\n                                r_id,\n                                3,\n                                V,\n                                NULL,\n                                &v_id,\n                                &l_id,\n                                &pos);\n    r_id = bpt_insert_new_value(domain,\n                                r_id,\n                                5,\n                                V + 1,\n                                NULL,\n                                &v_id,\n                                &l_id,\n                                &pos);\n    r_id = bpt_insert_new_value(domain,\n                                r_id,\n                                4,\n                                V + 2,\n                                NULL,\n                                &v_id,\n                                &l_id,\n                                &pos);\n    r_id = bpt_insert_new_value(domain,\n                                r_id,\n                                6,\n                                V + 3,\n                                NULL,\n                                &v_id,\n                                &l_id,\n                                &pos);\n    r_id = bpt_insert_new_value(domain,\n                                r_id,\n                                2,\n                                V + 4,\n                                NULL,\n                                &v_id,\n                                &l_id,\n                                &pos);\n\n    r_id = bpt_insert_new_value(domain,\n                                r_id,\n                                2,\n                                V + 5,\n                                NULL,\n                                &v_id,\n                                &l_id,\n                                &pos);\n    r_id = bpt_insert_new_value(domain,\n                                r_id,\n                                3,\n                                V + 6,\n                                NULL,\n                                &v_id,\n                                &l_id,\n                                &pos);\n    r_id = bpt_insert_new_value(domain,\n                                r_id,\n                                4,\n                                V + 7,\n                                NULL,\n                                &v_id,\n                                &l_id,\n                                &pos);\n    r_id = bpt_insert_new_value(domain,\n                                r_id,\n                                5,\n                                V + 8,\n                                NULL,\n                                &v_id,\n                                &l_id,\n                                &pos);\n    r_id = bpt_insert_new_value(domain,\n                                r_id,\n                                6,\n                                V + 9,\n                                NULL,\n                                &v_id,\n                                &l_id,\n                                &pos);\n\n\n    uint32_t r_i = bpt_find(domain, r_id, &l_id, &pos, 2);\n    int *r = cache.get(domain, r_i - 1, NULL);\n    TEST_ASSERT_EQUAL(V[5], *r);\n\n    r_i = bpt_find(domain, r_id, &l_id, &pos, 3);\n    r = cache.get(domain, r_i - 1, NULL);\n    TEST_ASSERT_EQUAL(V[6], *r);\n\n    r_i = bpt_find(domain, r_id, &l_id, &pos, 4);\n    r = cache.get(domain, r_i - 1, NULL);\n    TEST_ASSERT_EQUAL(V[7], *r);\n\n    r_i = bpt_find(domain, r_id, &l_id, &pos, 5);\n    r = cache.get(domain, r_i - 1, NULL);\n    TEST_ASSERT_EQUAL(V[8], *r);\n\n    r_i = bpt_find(domain, r_id, &l_id, &pos, 6);\n    r = cache.get(domain, r_i - 1, NULL);\n    TEST_ASSERT_EQUAL(V[9], *r);\n\n    cache.destroy();\n}\n//}}}\n\n//{{{ void test_bpt_insert_repeat_append(void)\n\nvoid append_sum(uint32_t domain,\n                uint32_t new_value_id,\n                uint32_t curr_value_id,\n                struct cache_handler *handler)\n{\n\n    uint32_t *new_value = cache.get(domain, new_value_id - 1, handler);\n    uint32_t *curr_value = cache.get(domain, curr_value_id - 1, handler);\n    *curr_value = *curr_value + *new_value;\n}\n\nvoid test_bpt_insert_repeat_append(void)\n{\n    append = append_sum;\n    bpt_node_repair = NULL;\n    ORDER = 4;\n    struct simple_cache *sc = simple_cache_init(5, 1, NULL);\n    uint32_t domain = 0;\n\n    int R[14] = {1,2,3,4,5,6,7,8,9,10,11,12,13,14};\n    int V[14] = {1,2,3,4,5,6,7,8,9,10,11,12,13,14};\n\n    uint32_t r_id = 0, v_id, l_id;\n    int pos;\n\n    r_id = bpt_insert_new_value(domain,\n                                r_id,\n                                3,\n                                V,\n                                NULL,\n                                &v_id,\n                                &l_id,\n                                &pos);\n    r_id = bpt_insert_new_value(domain,\n                                r_id,\n                                5,\n                                V + 1,\n                                NULL,\n                                &v_id,\n                                &l_id,\n                                &pos);\n    r_id = bpt_insert_new_value(domain,\n                                r_id,\n                                4,\n                                V + 2,\n                                NULL,\n                                &v_id,\n                                &l_id,\n                                &pos);\n    r_id = bpt_insert_new_value(domain,\n                                r_id,\n                                6,\n                                V + 3,\n                                NULL,\n                                &v_id,\n                                &l_id,\n                                &pos);\n    r_id = bpt_insert_new_value(domain,\n                                r_id,\n                                2,\n                                V + 4,\n                                NULL,\n                                &v_id,\n                                &l_id,\n                                &pos);\n\n    r_id = bpt_insert_new_value(domain,\n                                r_id,\n                                2,\n                                V + 5,\n                                NULL,\n                                &v_id,\n                                &l_id,\n                                &pos);\n    r_id = bpt_insert_new_value(domain,\n                                r_id,\n                                3,\n                                V + 6,\n                                NULL,\n                                &v_id,\n                                &l_id,\n                                &pos);\n    r_id = bpt_insert_new_value(domain,\n                                r_id,\n                                4,\n                                V + 7,\n                                NULL,\n                                &v_id,\n                                &l_id,\n                                &pos);\n    r_id = bpt_insert_new_value(domain,\n                                r_id,\n                                5,\n                                V + 8,\n                                NULL,\n                                &v_id,\n                                &l_id,\n                                &pos);\n    r_id = bpt_insert_new_value(domain,\n                                r_id,\n                                6,\n                                V + 9,\n                                NULL,\n                                &v_id,\n                                &l_id,\n                                &pos);\n\n\n    uint32_t r_i = bpt_find(domain, r_id, &l_id, &pos, 2);\n    int *r = cache.get(domain, r_i - 1, NULL);\n    TEST_ASSERT_EQUAL(R[5] + R[4], *r);\n\n    r_i = bpt_find(domain, r_id, &l_id, &pos, 3);\n    r = cache.get(domain, r_i - 1, NULL);\n    TEST_ASSERT_EQUAL(R[6] + R[0], *r);\n\n    r_i = bpt_find(domain, r_id, &l_id, &pos, 4);\n    r = cache.get(domain, r_i - 1, NULL);\n    TEST_ASSERT_EQUAL(R[7] + R[2], *r);\n\n    r_i = bpt_find(domain, r_id, &l_id, &pos, 5);\n    r = cache.get(domain, r_i - 1, NULL);\n    TEST_ASSERT_EQUAL(R[8] + R[1], *r);\n\n    r_i = bpt_find(domain, r_id, &l_id, &pos, 6);\n    r = cache.get(domain, r_i - 1, NULL);\n    TEST_ASSERT_EQUAL(R[9] + R[3], *r);\n\n    cache.destroy();\n\n    append = NULL;\n}\n//}}}\n\n//{{{ void test_rand_test_high_order(void)\nvoid test_rand_test_high_order(void)\n{\n    struct simple_cache *sc = simple_cache_init(5, 1, NULL);\n    uint32_t domain = 0;\n    ORDER=50;\n    bpt_node_repair = NULL;\n    uint32_t size = 100000;\n\n    uint32_t *d = (uint32_t *)malloc(size * sizeof(uint32_t));\n    uint32_t *v = (uint32_t *)malloc(size * sizeof(uint32_t));\n\n    time_t t = time(NULL);\n    srand(t);\n\n    uint32_t r_id = 0, v_id, l_id;\n    int pos;\n\n \n    uint32_t i, j;\n    for (i = 0; i < size; ++i) {\n        d[i] = rand();\n        v[i] = d[i] /2;\n        r_id = bpt_insert_new_value(domain,\n                                    r_id,\n                                    d[i],\n                                    v + i,\n                                    NULL,\n                                    &v_id,\n                                    &l_id,\n                                    &pos);\n    }\n\n    uint32_t *r;\n    int pos_r;\n    for (i = 0; i < size; ++i) {\n        uint32_t r_i = bpt_find(domain, r_id, &l_id, &pos, d[i]);\n        int *r = cache.get(domain, r_i - 1, NULL);\n        TEST_ASSERT_EQUAL(v[i], *r);\n    }\n\n    free(d);\n    free(v);\n    cache.destroy();\n}\n//}}}\n\n//{{{void test_bpt_write_tree(void)\nvoid test_bpt_write_tree(void)\n{\n    char *bpt_file_out[1] = {\"test_bpt_write_tree.out\"};\n\n    if (access(\"test_bpt_write_tree.out.idx\", F_OK) != -1)\n        remove(\"test_bpt_write_tree.out.idx\");\n\n    if (access(\"test_bpt_write_tree.out.dat\", F_OK) != -1)\n        remove(\"test_bpt_write_tree.out.dat\");\n\n    struct simple_cache *sc = simple_cache_init(5, 1, bpt_file_out);\n    uint32_t domain = 0;\n    ORDER=5;\n    bpt_node_repair = NULL;\n    uint32_t size = 20;\n\n    uint32_t *keys = (uint32_t *)malloc(size * sizeof(uint32_t));\n    //uint32_t *v = (uint32_t *)malloc(size * sizeof(uint32_t));\n\n    time_t t = time(NULL);\n    srand(t);\n\n    uint32_t r_id = 0, v_id, l_id;\n    int pos;\n\n    uint32_t i, j;\n    for (i = 0; i < size; ++i) {\n        keys[i] = rand();\n        uint32_t *value = (uint32_t *)calloc(1,sizeof(uint32_t));\n        *value = keys[i] /2;\n        r_id = bpt_insert_new_value(domain,\n                                    r_id,\n                                    keys[i],\n                                    value,\n                                    &uint32_t_cache_handler,\n                                    &v_id,\n                                    &l_id,\n                                    &pos);\n    }\n\n\n    bool ret = bpt_write_tree(domain, r_id);\n\n    cache.destroy();\n\n    sc = simple_cache_init(5, 1, bpt_file_out);\n\n    uint32_t *r;\n    int pos_r;\n    for (i = 0; i < size; ++i) {\n        uint32_t r_i = bpt_find(domain, r_id, &l_id, &pos, keys[i]);\n        uint32_t *r = cache.get(domain, r_i - 1, &uint32_t_cache_handler);\n        TEST_ASSERT_EQUAL(keys[i] / 2, *r);\n    }\n\n    cache.destroy();\n    remove(\"test_bpt_write_tree.out.idx\");\n    remove(\"test_bpt_write_tree.out.dat\");\n\n    /*\n    struct disk_store *ds = disk_store_load(&f, bpt_file_out);\n\n    struct bpt_node *read_root = (struct bpt_node *)\n            malloc(sizeof(struct bpt_node));\n    uint64_t node_size;\n    read_root->data = disk_store_get(ds, 0, &node_size);\n\n    struct bpt_node *mem_root = cache.get(cache.cache, r_id);\n\n    TEST_ASSERT_EQUAL(1, BPT_ID(read_root));\n    TEST_ASSERT_EQUAL(BPT_NUM_KEYS(mem_root), BPT_NUM_KEYS(read_root));\n\n    for (i = 0; i < BPT_NUM_KEYS(mem_root); ++i) \n        TEST_ASSERT_EQUAL(BPT_KEYS(mem_root)[i], BPT_KEYS(read_root)[i]);\n\n    for (i = 0; i <= BPT_NUM_KEYS(mem_root); ++i) {\n        struct bpt_node *mem_node = cache.get(cache.cache,\n                                              BPT_POINTERS(mem_root)[i]);\n        struct bpt_node *read_node = (struct bpt_node *)\n                malloc(sizeof(struct bpt_node));\n        read_node->data = disk_store_get(ds,\n                                         BPT_POINTERS(read_root)[i] - 1,\n                                         &node_size);\n        TEST_ASSERT_EQUAL(BPT_NUM_KEYS(mem_node), BPT_NUM_KEYS(read_node));\n\n        for (j = 0; j < BPT_NUM_KEYS(mem_node); ++j) {\n            TEST_ASSERT_EQUAL(BPT_KEYS(mem_node)[j], BPT_KEYS(read_node)[j]);\n\n            uint32_t *mem_val = cache.get(cache.cache,\n                                          BPT_POINTERS(mem_node)[j]);\n            uint32_t *read_val = disk_store_get(ds,\n                                                BPT_POINTERS(read_node)[j] - 1,\n                                                &node_size);\n            TEST_ASSERT_EQUAL(*mem_val, *read_val);\n            free(read_val);\n        }\n\n        free(read_node->data);\n        free(read_node);\n    }\n\n    free(read_root->data);\n    free(read_root);\n\n    free(d);\n    free(v);\n    cache.destroy(&(cache.cache));\n    disk_store_destroy(&ds);\n    */\n}\n//}}}\n\n#if 0\n////{{{ void test_bpt_destroy_tree(void)\n//void test_bpt_destroy_tree(void)\n//{\n//    TEST_IGNORE()\n//\n//    /*\n//     * 2,3,4,5\n//     *\n//     * 4\n//     *  2,3 4,5,6\n//     *\n//     * 4,6\n//     *  2,3 4,5 6,7,8\n//     *\n//     * 4,6,8\n//     *  2,3 4,5 6,7 8,9,10\n//     *\n//     * 4,6,8,10\n//     *  2,3 4,5 6,7 8,9 10,11,12\n//     *\n//     * 8 \n//     *  4,6 8,10,12\n//     *   2,3 4,5 6,7 8,9 10,11 12,13,14\n//     */\n//    int V[14] = {1,2,3,4,5,6,7,8,9,10,11,12,13,14};\n//    int v=0;\n//\n//    struct bpt_node *root = NULL;\n//    struct bpt_node *leaf = NULL;\n//    int pos;\n//\n//    root = bpt_insert(root, 2, (void *)(V + v++), &leaf, &pos);\n//    root = bpt_insert(root, 3, (void *)(V + v++), &leaf, &pos);\n//    root = bpt_insert(root, 4, (void *)(V + v++), &leaf, &pos);\n//    root = bpt_insert(root, 5, (void *)(V + v++), &leaf, &pos);\n//    root = bpt_insert(root, 6, (void *)(V + v++), &leaf, &pos);\n//    root = bpt_insert(root, 7, (void *)(V + v++), &leaf, &pos);\n//    root = bpt_insert(root, 8, (void *)(V + v++), &leaf, &pos);\n//    root = bpt_insert(root, 9, (void *)(V + v++), &leaf, &pos);\n//    root = bpt_insert(root, 10, (void *)(V + v++), &leaf, &pos);\n//    root = bpt_insert(root, 11, (void *)(V + v++), &leaf, &pos);\n//    root = bpt_insert(root, 12, (void *)(V + v++), &leaf, &pos);\n//    root = bpt_insert(root, 13, (void *)(V + v++), &leaf, &pos);\n//    root = bpt_insert(root, 14, (void *)(V + v++), &leaf, &pos);\n//\n//    bpt_destroy_tree(&root);\n//}\n////}}}\n////{{{ void test_bpt_find_null(void)\n//void test_bpt_find_null(void)\n//{\n//    TEST_IGNORE()\n//    int V[14] = {1,2,3,4,5,6,7,8,9,10,11,12,13,14};\n//    int v=0;\n//\n//    struct bpt_node *root = NULL;\n//    struct bpt_node *leaf = NULL;\n//    int pos_r;\n//\n//    int *r = (int *)bpt_find(root, &leaf, &pos_r, 0);\n//\n//    TEST_ASSERT_EQUAL(NULL, r);\n//\n//    root = bpt_insert(root, 2, (void *)(V + v++), &leaf, &pos_r);\n//\n//    r = (int *)bpt_find(root, &leaf, &pos_r, 2);\n//    TEST_ASSERT_EQUAL(V, r);\n//\n//    r = (int *)bpt_find(root, &leaf, &pos_r, 1);\n//    TEST_ASSERT_EQUAL(NULL, r);\n//\n//    bpt_destroy_tree(&root);\n//}\n////}}}\n#endif\n"
  },
  {
    "path": "test/unit/test_bulk_insert.c",
    "content": "#define _GNU_SOURCE\n\n#include \"util.h\"\n\n#include <stdbool.h>\n#include <stdio.h>\n#include <stdlib.h>\n#include <math.h>\n#include <stdio.h>\n#include <inttypes.h>\n#include <string.h>\n#include <err.h>\n#include <sysexits.h>\n#include <glob.h>\n#include <string.h>\n#include <htslib/kstring.h>\n\n#include \"unity.h\"\n#include \"bpt.h\"\n#include \"giggle_index.h\"\n#include \"lists.h\"\n#include \"file_read.h\"\n#include \"wah.h\"\n#include \"ll.h\"\n#include \"jsw_avltree.h\"\n#include \"pq.h\"\n\n#define MIN(X, Y) (((X) < (Y)) ? (X) : (Y))\n#define MAX(X, Y) (((X) > (Y)) ? (X) : (Y))\n\n\nvoid setUp(void) { }\nvoid tearDown(void) { }\n//\n////{{{ void test_giggle_bulk_insert(void)\n//void test_giggle_bulk_insert_base(void)\n//{\n//    //{{{ Testing constants\n//    uint32_t BPT_keys_0[100] = {1, 50481, 50514, 144527, 144577, 404661, 404708,\n//        422395, 422436, 562161, 562202, 566581, 567102, 585763, 585804, 816018,\n//        816215, 829181, 829221, 935394, 936147, 936482, 936605, 1004540,\n//        1004903, 1014910, 1015319, 1243704, 1244171, 1284817, 1284894, 1333543,\n//        1334139, 1334987, 1335286, 1406946, 1407324, 1446566, 1446696, 1550487,\n//        1551148, 1585271, 1585317, 1624220, 1624282, 1689977, 1690749, 1705115,\n//        1705170, 1713720, 1714070, 1777263, 1777312, 1850348, 1850535, 2023080,\n//        2023417, 2050152, 2050195, 2111658, 2112294, 2125435, 2125603, 2139348,\n//        2139395, 2142838, 2142876, 2144034, 2144521, 2322920, 2323328, 2517907,\n//        2518312, 2540473, 2540521, 2574446, 2574807, 2741456, 2741507, 3142094,\n//        3142139, 3190381, 3190416, 3252166, 3252207, 3455260, 3455310, 3578853,\n//        3579009, 3585079, 3585112, 3612184, 3612525, 3636454, 3636501, 3689319,\n//        3691116, 3696692, 3696741, 3774727}; \n//\n//    uint32_t BPT_keys_1[100] = {3774986, 3809712, 3809783, 3825025, 3825065,\n//        4046152, 4046215, 4324287, 4324327, 4364646, 4364680, 4413593, 4413626,\n//        4480292, 4480341, 4569164, 4569196, 4582988, 4583026, 4643102, 4643134,\n//        4643898, 4643933, 4739868, 4739913, 4873368, 4873409, 4992134, 4992166,\n//        5068291, 5068337, 5068817, 5068850, 5082558, 5082596, 5309091, 5309133,\n//        5336759, 5336798, 5748446, 5748479, 5781921, 5782215, 5866231, 5866265,\n//        5945881, 5946136, 5976058, 5976417, 6077466, 6077500, 6087279, 6087335,\n//        6187730, 6187938, 6192940, 6192971, 6219287, 6219320, 6289843, 6289885,\n//        6383797, 6383831, 6423193, 6423390, 6430517, 6430567, 6453604, 6454441,\n//        6474367, 6474735, 6483544, 6483800, 6486473, 6486687, 6769020, 6769062,\n//        6793250, 6793281, 6800601, 6800646, 6849663, 6849671, 6850435, 6850470,\n//        6944351, 6944397, 6959614, 6959655, 6962099, 6962134, 7134888, 7134899,\n//        7172076, 7172248, 7189979, 7190016, 7257688, 7257739, 7278281};\n//\n//    uint32_t bpt_node_tested_0 = 0, bpt_node_tested_1 = 0;\n//    //}}}\n//\n//    char *path_name = \"../data/many/*gz\";\n//\n//    glob_t results;\n//    int ret = glob(path_name, 0, NULL, &results);\n//    if (ret != 0) \n//        errx(1,\n//             \"Problem with %s (%s), stopping early\\n\",\n//             path_name,\n//             (ret == GLOB_ABORTED ? \"filesystem problem\" :\n//             ret == GLOB_NOMATCH ? \"no match of pattern\" :\n//             ret == GLOB_NOSPACE ? \"no dynamic memory\" :\n//             \"unknown problem\"));\n//\n//    //Array of open pre-sorted input files\n//    struct input_file **i_files = (struct input_file **)\n//            malloc(results.gl_pathc * sizeof(struct input_file *));\n//\n//    // Use these to read intervals from files\n//    int chrm_len = 10;\n//    char *chrm = (char *)malloc(chrm_len * sizeof(char));\n//    uint32_t start, end;\n//    long offset;\n//    kstring_t line = {0, 0, NULL};\n//\n//    // Priority queue of starts\n//    pri_queue pq_start = priq_new(results.gl_pathc);\n//    priority pri_start;\n//    // Since we know that each file will have at most one start in the priority\n//    // queue, we can reduce mallocs by reusing the array\n//    struct pq_data *pqd_starts = (struct pq_data *)\n//            malloc(results.gl_pathc * sizeof(struct pq_data));\n//\n//    // Priority queue of ends\n//    pri_queue pq_end = priq_new(results.gl_pathc);\n//    priority pri_end;\n//    // We cannot assume that there will be some set numberof ends per file\n//    // (contained intervals) so we must malloc on each insert\n//    struct pq_data *pqd_end;\n//\n//    // Init other associated indexes\n//    struct file_index *file_idx = file_index_init(10,\n//                                                  \"test_bulk_insert.file.idx\");\n//    uint32_t interval_id = 0;\n//    struct offset_index *offset_idx = \n//            offset_index_init(1000,\n//                              \"test_bulk_insert.offset.idx\");\n// \n//    struct chrm_index *chrm_idx = chrm_index_init(24,\n//                                                  \"test_bulk_insert.chrm.idx\");\n//   \n//    //{{{ add one interval from each file to the priority queue\n//\n//    uint32_t i;\n//    uint32_t num_input_files = results.gl_pathc;\n//    for (i = 0; i < results.gl_pathc; i++) {\n//        i_files[i] = input_file_init(results.gl_pathv[i]);\n//        // register the file with the file index\n//        uint32_t file_id = file_index_add(file_idx, results.gl_pathv[i]);\n//        TEST_ASSERT_EQUAL(i, file_id);\n//        ret = i_files[i]->input_file_get_next_interval(i_files[i],\n//                                                       &chrm,\n//                                                       &chrm_len,\n//                                                       &start,\n//                                                       &end,\n//                                                       &offset,\n//                                                       &line);\n//        // register the interval with the offset index\n//        interval_id = offset_index_add(offset_idx,\n//                                       offset,\n//                                       &line,\n//                                       file_id);\n//\n//        //Update the pq data for the start, use the array to reduce mallocs\n//        pqd_starts[i].file_id = file_id;\n//        pqd_starts[i].interval_id = interval_id;\n//        pri_start.pos = start;\n//        strcpy(pri_start.chrm, chrm);\n//        priq_push(pq_start, &(pqd_starts[i]), pri_start);\n//\n//        //{{{ debug\n//        /*\n//        fprintf(stderr,\n//                \"%s\\t%u %u %u\\n\",\n//                results.gl_pathv[i],\n//                interval_id,\n//                pri.pos, start);\n//        */\n//        //}}}\n//\n//        //Update the pq data for the end\n//        pqd_end = (struct pq_data *) malloc(sizeof(struct pq_data));\n//        pqd_end->file_id = file_id;\n//        pqd_end->interval_id = interval_id;\n//        pri_end.pos = end + 1; // use end + 1\n//        strcpy(pri_end.chrm, chrm);\n//        priq_push(pq_end, pqd_end, pri_end);\n//    }\n//    globfree(&results);\n//\n//    //}}}\n//\n//    TEST_ASSERT_EQUAL(22, file_idx->index->num);\n//\n//    struct pq_data *pqd_start =\n//            (struct pq_data *)priq_top(pq_start, &pri_start);\n//\n//    // curr_pos and curr_chrm track the status of the indexing\n//    uint32_t curr_pos = pri_start.pos;\n//    char curr_chrm[10];\n//    strcpy(curr_chrm, pri_start.chrm);\n//\n//    // register the chrom with chrom index\n//    uint32_t curr_chrm_id = chrm_index_add(chrm_idx, curr_chrm);\n//\n//    //{{{ init disk store, do this at the start of every chrom\n//    char *ds_curr_index_file_name = NULL, *ds_curr_data_file_name = NULL;\n//    ret = asprintf(&ds_curr_index_file_name,\n//                   \"test_bulk_insert.ds_idx.%u\",\n//                   curr_chrm_id);\n//    ret = asprintf(&ds_curr_data_file_name,\n//                   \"test_bulk_insert.ds_data.%u\",\n//                   curr_chrm_id);\n//    struct disk_store *curr_ds = disk_store_init(10,\n//                                                 NULL,\n//                                                 ds_curr_index_file_name,\n//                                                 NULL,\n//                                                 ds_curr_data_file_name);\n//    free(ds_curr_index_file_name);\n//    free(ds_curr_data_file_name);\n//    //}}}\n//\n//    // Collect the values into this node, then write it and clear \n//    struct bpt_node *bpn = (struct bpt_node *) malloc(sizeof(struct bpt_node));\n//    bpn->data = (uint32_t *) malloc(BPT_NODE_NUM_ELEMENTS  * sizeof(uint32_t));\n//    memset(bpn->data, 0, BPT_NODE_SIZE);\n//\n//    //BPT_ID(bpn) =  curr_ds->num;\n//    BPT_ID(bpn) = 1;\n//    BPT_PARENT(bpn) = 0;\n//    BPT_IS_LEAF(bpn) = 1;\n//    BPT_LEADING(bpn) = 0;\n//    BPT_NEXT(bpn) = 0;\n//    BPT_NUM_KEYS(bpn) = 0;\n//    BPT_POINTERS_BLOCK(bpn) = 0;\n//\n//    // These will be used to create the leaf data for each node\n//    uint32_t num_leading = 0, num_starts = 0, num_ends = 0;\n//    struct uint64_t_array *leading, *starts, *ends;\n//    leading = uint64_t_array_init(100);\n//    starts = uint64_t_array_init(100);\n//    ends = uint64_t_array_init(100);\n//\n//    struct uint32_t_array *starts_pointers, *ends_pointers;\n//    starts_pointers = uint32_t_array_init(100);\n//    ends_pointers = uint32_t_array_init(100);\n//\n//\n//    // This tree will track intervals that have begun and not yet ended and\n//    // will be used to populate the leading value of nodes\n//    jsw_avltree_t *avl = jsw_avlnew(uint_cmp_f, uint_dup_f, uint_rel_f);\n//\n//    // add the current possition to the node\n//    ret = giggle_bulk_insert_append_bpt_key(bpn,\n//                                            curr_pos,\n//                                            curr_ds,\n//                                            avl,\n//                                            leading,\n//                                            starts,\n//                                            ends,\n//                                            starts_pointers,\n//                                            ends_pointers);\n//\n//    // Loop over the start queue until it is empty\n//    while (priq_top(pq_start, &pri_start) != NULL) {\n//        // Grab the top element\n//        pqd_start = (struct pq_data *)priq_pop(pq_start, &pri_start);\n//        //fprintf(stderr, \"%s s:%u\\n\", pri_start.chrm, pri_start.pos);\n//\n//        /* The posibilities for this start position are that:\n//         * 1) it has been seen before, in which case we will need to add the\n//         * interval id associated with that position to the starts leaf data\n//         * and leave the bp tree node alone\n//         * 2) it has not been seen before, so it will need to be eventually\n//         * added it to the tree we need to first let the ends catch up by\n//         * popping any end that is less than to the start that was just seen 3)\n//         * it is on a new chromosome and we need to do everything that is in 2)\n//         * as well as close out the disk store for the current chrom and start\n//         * a new one\n//         *\n//         * - Every start and end must be added to the starts and ends arrays.\n//         * - Any time a new node is created, we need to move the leading,\n//         *   starts, and ends arrays to a leaf node, and reset the arrays\n//         */\n//\n//        if ((pri_start.pos == curr_pos) && \n//            (strcmp(curr_chrm, pri_start.chrm) == 0)) {\n//            // The key didnt' change, so append the current\n//            // interval id to the end of the leaf data starts\n//\n//            uint64_t idx = uint64_t_array_add(starts, pqd_start->interval_id);\n//            // bump starts \n//            giggle_bulk_insert_set_starts(bpn, idx);\n//\n//            // Add interval to tree to track intervals for leading value\n//#if DEBUG\n//            fprintf(stderr,\n//                    \"-> %s %u %u\\n\",\n//                    pri_start.chrm,\n//                    pri_start.pos,\n//                    pqd_start->interval_id);\n//#endif\n//\n//            jsw_avlinsert(avl, &(pqd_start->interval_id));\n//        } else {\n//            //{{{ #2, we need to go through the ends to catch up\n//            pqd_end = (struct pq_data *)priq_top(pq_end, &pri_end);\n//\n//            // Since the key changed, flush out the ends to this or new keys\n//            // up to the value of the next start\n//            while ( (pqd_end != NULL) && //not empy\n//                    ((strcmp(pri_start.chrm, pri_end.chrm) != 0) || //same chr\n//                     (pri_end.pos < pri_start.pos)) ) { // < the start we saw\n//\n//                pqd_end = (struct pq_data *)priq_pop(pq_end, &pri_end);\n//                //fprintf(stderr, \"%s e:%u\\n\", pri_end.chrm, pri_end.pos);\n//\n//                if (curr_pos == pri_end.pos)  {\n//                    // The key didnt' change, so append the current\n//                    // interval id to the end of the leaf data ends\n//                    uint64_t idx = \n//                            uint64_t_array_add(ends,\n//                                               pqd_end->interval_id);\n//                    // bump ends\n//                    giggle_bulk_insert_set_ends(bpn, idx);\n//\n//                    // remove end from tree tracking leading values\n//#if DEBUG\n//                    fprintf(stderr,\n//                            \"<- %s %u %u\\n\",\n//                            pri_end.chrm,\n//                            pri_end.pos,\n//                            pqd_end->interval_id);\n//#endif\n//\n//                    ret = jsw_avlerase(avl, &(pqd_end->interval_id));\n//                    if (ret == 0)\n//                        errx(1, \"Error removing element from tree.\");\n//                } else {\n//                    ret = giggle_bulk_insert_append_bpt_key(bpn,\n//                                                            pri_end.pos,\n//                                                            curr_ds,\n//                                                            avl,\n//                                                            leading,\n//                                                            starts,\n//                                                            ends,\n//                                                            start_poiners,\n//                                                            ends_pointers);\n//\n//                    uint64_t idx =\n//                            uint64_t_array_add(ends,\n//                                               pqd_end->interval_id);\n//                    // bump ends\n//                    //giggle_bulk_insert_set_ends(bpn, idx);\n//\n//                    // remove end from tree tracking leading values\n//#if DEBUG\n//                    fprintf(stderr,\n//                            \"<- %s %u %u\\n\",\n//                            pri_end.chrm,\n//                            pri_end.pos,\n//                            pqd_end->interval_id);\n//#endif\n//                    ret = jsw_avlerase(avl, &(pqd_end->interval_id));\n//                    if (ret == 0)\n//                        errx(1, \"Error removing element from tree.\");\n//\n//\n//                    curr_pos = pri_end.pos;\n//\n//                    //{{{ bpt node contents test\n//                    if (BPT_NUM_KEYS(bpn) == ORDER) {\n//                        if (bpt_node_tested_0 == 0) {\n//                            uint32_t i;\n//                            for (i = 0; i < ORDER; ++i)\n//                                TEST_ASSERT_EQUAL(BPT_keys_0[i],\n//                                                  BPT_KEYS(bpn)[i]);\n//                            bpt_node_tested_0 = 1;\n//                        } else if (bpt_node_tested_1 == 0) {\n//                            uint32_t i;\n//                            for (i = 0; i < ORDER; ++i)\n//                                TEST_ASSERT_EQUAL(BPT_keys_1[i],\n//                                                  BPT_KEYS(bpn)[i]);\n//                            bpt_node_tested_1 = 1;\n//                        }\n//                    }\n//                    //}}}\n//                }\n//\n//                free(pqd_end);\n//                pqd_end = (struct pq_data *)priq_top(pq_end, &pri_end);\n//            }\n//            //}}}\n//\n//            // If the chrom did change, we need to sync up the disk store and\n//            // open up a new one\n//            if (strcmp(curr_chrm, pri_start.chrm) != 0) {\n//\n//                if (BPT_NUM_KEYS(bpn) > 0) {\n//                    BPT_POINTERS_BLOCK(bpn) = (curr_ds->num + 1) + 1;//1-based\n//                    BPT_NEXT(bpn) = 0;\n//\n//                    giggle_bulk_insert_write_leaf_node(bpn,\n//                                                       curr_ds,\n//                                                       leading,\n//                                                       starts,\n//                                                       ends,\n//                                                       starts_pointers,\n//                                                       ends_pointers);\n//                    // Reset the bpt node\n//                    memset(bpn->data, 0, BPT_NODE_SIZE);\n//                    BPT_ID(bpn) =  1;\n//                    BPT_PARENT(bpn) = 0;\n//                    BPT_IS_LEAF(bpn) = 1;\n//                    BPT_LEADING(bpn) = 0;\n//                    BPT_NEXT(bpn) = 0;\n//                    BPT_NUM_KEYS(bpn) = 0;\n//                    BPT_POINTERS_BLOCK(bpn) = 0;\n//                }\n//\n//                strcpy(curr_chrm, pri_start.chrm);\n//                //register the new chrom\n//                curr_chrm_id = chrm_index_add(chrm_idx,\n//                                              curr_chrm);\n//                //{{{ fix up the disk store\n//                disk_store_sync(curr_ds);\n//                disk_store_destroy(&curr_ds);\n//                ret = asprintf(&ds_curr_index_file_name,\n//                               \"test_bulk_insert.ds_idx.%u\",\n//                               curr_chrm_id);\n//                ret = asprintf(&ds_curr_data_file_name,\n//                               \"test_bulk_insert.ds_data.%u\",\n//                               curr_chrm_id);\n//                curr_ds = disk_store_init(10,\n//                                          NULL,\n//                                          ds_curr_index_file_name,\n//                                          NULL,\n//                                          ds_curr_data_file_name);\n//                free(ds_curr_index_file_name);\n//                free(ds_curr_data_file_name);\n//                //}}}\n//            }\n//\n//            curr_pos = pri_start.pos;\n//            ret = giggle_bulk_insert_append_bpt_key(bpn,\n//                                                    curr_pos,\n//                                                    curr_ds,\n//                                                    avl,\n//                                                    leading,\n//                                                    starts,\n//                                                    ends);\n//            uint64_t idx = uint64_t_array_add(starts, pqd_start->interval_id);\n//            // bump starts\n//            giggle_bulk_insert_set_starts(bpn, idx);\n//\n//            // add to tree tracking the leading values\n//#if DEBUG\n//            fprintf(stderr,\n//                    \"-> %s %u %u\\n\",\n//                    pri_start.chrm,\n//                    pri_start.pos,\n//                    pqd_start->interval_id);\n//#endif\n//\n//            jsw_avlinsert(avl, &(pqd_start->interval_id));\n//            //{{{ bpt node contents test\n//            if (BPT_NUM_KEYS(bpn) == ORDER) {\n//                if (bpt_node_tested_0 == 0) {\n//                    uint32_t i;\n//                    for (i = 0; i < ORDER; ++i)\n//                        TEST_ASSERT_EQUAL(BPT_keys_0[i],\n//                                          BPT_KEYS(bpn)[i]);\n//                    bpt_node_tested_0 = 1;\n//                } else if (bpt_node_tested_1 == 0) {\n//                    uint32_t i;\n//                    for (i = 0; i < ORDER; ++i)\n//                        TEST_ASSERT_EQUAL(BPT_keys_1[i],\n//                                          BPT_KEYS(bpn)[i]);\n//                    bpt_node_tested_1 = 1;\n//                }\n//            }\n//            //}}}\n//            //{{{ debug\n//            /*\n//            fprintf(stderr,\n//                    \"%s %u\\ts: %u(%u)\",\n//                    curr_chrm,\n//                    curr_pos,\n//                    pqd_start->interval_id,\n//                    pri.pos);\n//            */\n//            //}}}\n//        }\n//\n//        //{{{ put another interval from the file that just lost one \n//        int ret = i_files[pqd_start->file_id]->\n//                    input_file_get_next_interval(i_files[pqd_start->file_id],\n//                                                 &chrm,\n//                                                 &chrm_len,\n//                                                 &start,\n//                                                 &end,\n//                                                 &offset,\n//                                                 &line);\n//\n//        if (ret >= 0) {\n//            interval_id = offset_index_add(offset_idx,\n//                                           offset,\n//                                           &line,\n//                                           pqd_start->file_id);\n//\n//            pqd_starts[pqd_start->file_id].interval_id = interval_id;\n//            pri_start.pos = start;\n//            strcpy(pri_start.chrm, chrm);\n//            priq_push(pq_start, &(pqd_starts[pqd_start->file_id]), pri_start);\n//\n//            pqd_end = (struct pq_data *) malloc(sizeof(struct pq_data));\n//            pqd_end->file_id = pqd_start->file_id;\n//            pqd_end->interval_id = interval_id;\n//            pri_end.pos = end + 1;\n//            strcpy(pri_end.chrm, chrm);\n//            priq_push(pq_end, pqd_end, pri_end);\n//        }\n//        //}}}\n//    }\n//\n//    if (line.s != NULL)\n//        free(line.s);\n//\n//    // Once the start queue is empty we need to drain the end queue\n//    while (priq_top(pq_end, &pri_end) != NULL) {\n//        pqd_end = (struct pq_data *)priq_pop(pq_end, &pri_end);\n//        //fprintf(stderr, \"%s e:%u\\n\", pri_end.chrm, pri_end.pos);\n//\n//        if (curr_pos == pri_end.pos)  {\n//            uint64_t idx = uint64_t_array_add(ends, pqd_end->interval_id);\n//            // bump ends\n//            giggle_bulk_insert_set_ends(bpn, idx);\n//\n//            // remove from tree tracking leading values\n//#if DEBUG\n//            fprintf(stderr,\n//                    \"-> %s %u %u\\n\",\n//                    pri_end.chrm,\n//                    pri_end.pos,\n//                    pqd_end->interval_id);\n//#endif\n//            ret = jsw_avlerase(avl, &(pqd_end->interval_id));\n//\n//            if (ret == 0)\n//                errx(1, \"Error removing element from tree.\");\n//            //{{{debug\n//            /*\n//            fprintf(stderr,\n//                    \" %u(%u)\",\n//                    pqd_end->interval_id,\n//                    pri_end.pos);\n//            */\n//            //}}}\n//        } else {\n//            curr_pos = pri_end.pos;\n//            ret = giggle_bulk_insert_append_bpt_key(bpn,\n//                                                    curr_pos,\n//                                                    curr_ds,\n//                                                    avl,\n//                                                    leading,\n//                                                    starts,\n//                                                    ends);\n//            uint64_t idx = uint64_t_array_add(ends, curr_pos); \n//            // bump ends\n//            giggle_bulk_insert_set_ends(bpn, idx);\n//\n//#if DEBUG\n//            fprintf(stderr,\n//                    \"-> %s %u %u\\n\",\n//                    pri_end.chrm,\n//                    pri_end.pos,\n//                    pqd_end->interval_id);\n//#endif\n//            // remove from tree tracking leading values\n//            ret = jsw_avlerase(avl, &(pqd_end->interval_id));\n//            if (ret == 0)\n//                errx(1, \"Error removing element from tree.\");\n//\n//            //{{{ test\n//            if (BPT_NUM_KEYS(bpn) == ORDER) {\n//                if (bpt_node_tested_0 == 0) {\n//                    uint32_t i;\n//                    for (i = 0; i < ORDER; ++i)\n//                        TEST_ASSERT_EQUAL(BPT_keys_0[i],\n//                                          BPT_KEYS(bpn)[i]);\n//                    bpt_node_tested_0 = 1;\n//                } else if (bpt_node_tested_1 == 0) {\n//                    uint32_t i;\n//                    for (i = 0; i < ORDER; ++i)\n//                        TEST_ASSERT_EQUAL(BPT_keys_1[i],\n//                                          BPT_KEYS(bpn)[i]);\n//                    bpt_node_tested_1 = 1;\n//                }\n//            }\n//            //}}}\n//            //{{{ debug\n//            /*\n//            fprintf(stderr,\n//                    \"\\n%s %u\\ts:\\te: %u(%u)\",\n//                    curr_chrm,\n//                    curr_pos,\n//                    pqd_end->interval_id,\n//                    pri_end.pos);\n//            */\n//            //}}}\n//        }\n//\n//        free(pqd_end);\n//    }\n//    \n//    if (BPT_NUM_KEYS(bpn) > 0) {\n//        BPT_POINTERS_BLOCK(bpn) = (curr_ds->num + 1) + 1;//1-based\n//        BPT_NEXT(bpn) = 0;\n//\n//        giggle_bulk_insert_write_leaf_node(bpn,\n//                                           curr_ds,\n//                                           leading,\n//                                           starts,\n//                                           ends);\n//    }\n//\n//    TEST_ASSERT_EQUAL(0, jsw_avlsize(avl));\n//    TEST_ASSERT_EQUAL(24, chrm_idx->index->num);\n//    TEST_ASSERT_EQUAL(21024, offset_idx->index->num);\n//\n//    disk_store_sync(curr_ds);\n//    disk_store_destroy(&curr_ds);\n//\n//    jsw_avldelete(avl);\n//\n//    for (i = 0; i < num_input_files; ++i)\n//        input_file_destroy(&(i_files[i]));\n//    free(i_files);\n//\n//\n//    //{{{ tests\n//    for (i = 0; i < chrm_idx->index->num; ++i) {\n//        ret = asprintf(&ds_curr_index_file_name,\n//                       \"test_bulk_insert.ds_idx.%u\",\n//                       i);\n//        ret = asprintf(&ds_curr_data_file_name,\n//                       \"test_bulk_insert.ds_data.%u\",\n//                       i);\n//        curr_ds = disk_store_load(NULL,\n//                                  ds_curr_index_file_name,\n//                                  NULL,\n//                                  ds_curr_data_file_name);\n//\n//        free(ds_curr_index_file_name);\n//        free(ds_curr_data_file_name);\n//\n//        uint32_t num_starts = 0, num_ends = 0;\n//\n//        uint32_t j;\n//        for (j = 0; j < curr_ds->num; ++j) {\n//            uint64_t size;\n//            void *v = disk_store_get(curr_ds, j, &size);\n//            struct bpt_node *bpn_in;\n//            uint64_t deserialized_size =\n//                    bpt_node_deserialize(v,\n//                                        size,\n//                                        (void **)&bpn_in); \n//        \n//            TEST_ASSERT_EQUAL(j + 1, BPT_ID(bpn_in));//1-based\n//            TEST_ASSERT_EQUAL(1, BPT_IS_LEAF(bpn_in));\n//            if (j < curr_ds->num - 2) {\n//                TEST_ASSERT_EQUAL(j + 2, BPT_NEXT(bpn_in) - 1);//1-based\n//            } else {\n//                TEST_ASSERT_EQUAL(0, BPT_NEXT(bpn_in));\n//            }\n//            TEST_ASSERT_EQUAL(j + 1, BPT_POINTERS_BLOCK(bpn_in) - 1);//1-based\n//\n//            free(bpn_in->data);\n//            free(bpn_in);\n//            free(v);\n//            v = NULL;\n//\n//            j += 1;\n//        \n//            v = disk_store_get(curr_ds, j, &size);\n//            struct leaf_data *ld_in;\n//            deserialized_size = leaf_data_deserialize(v,\n//                                                      size,\n//                                                      (void **)&ld_in); \n//            num_starts += ld_in->num_starts;\n//            num_ends += ld_in->num_ends;\n//\n//            /*\n//            fprintf(stderr,\n//                    \"%u %u %u\\n\",\n//                    ld_in->num_leading,\n//                    ld_in->num_starts,\n//                    ld_in->num_ends);\n//            */\n//\n//            free(ld_in->data);\n//            free(ld_in);\n//            free(v);\n//            v = NULL;\n//        }\n//\n//        TEST_ASSERT_EQUAL(num_starts, num_ends);\n//\n//        disk_store_destroy(&curr_ds);\n//    }\n//    //}}}\n//\n//    for (i = 0; i < chrm_idx->index->num; ++i) {\n//       \n//        ret = asprintf(&ds_curr_index_file_name,\n//                       \"test_bulk_insert.ds_idx.%u\",\n//                       i);\n//        ret = asprintf(&ds_curr_data_file_name,\n//                       \"test_bulk_insert.ds_data.%u\",\n//                       i);\n//        curr_ds = disk_store_load(NULL,\n//                                  ds_curr_index_file_name,\n//                                  NULL,\n//                                  ds_curr_data_file_name);\n//        free(ds_curr_index_file_name);\n//        free(ds_curr_data_file_name);\n//        //fprintf(stderr, \"chrm:%u\\n\", i);\n//\n//        // Here we need to loop over each level of the tree until the current\n//        // level has just one element in which case that element is the root\n//\n//        uint32_t num_leaf_node_leaf_data = curr_ds->num;\n//        uint32_t curr_level_num_nodes = num_leaf_node_leaf_data / 2;\n//        uint32_t curr_level_first_id = 1;\n//        uint32_t curr_level_is_leaf = 1;\n//        uint32_t new_level_first_id = 0;\n//        uint32_t new_level_len = \n//                giggle_bulk_insert_add_tree_level(curr_ds,\n//                                                  curr_level_first_id,\n//                                                  curr_level_num_nodes,\n//                                                  curr_level_is_leaf,\n//                                                  &new_level_first_id);\n//\n//        if (curr_level_num_nodes > 1)\n//            TEST_ASSERT_EQUAL((curr_level_num_nodes + ORDER - 1) / ORDER, \n//                              new_level_len);\n//        else\n//            TEST_ASSERT_EQUAL(0, new_level_len);\n//\n//        disk_store_destroy(&curr_ds);\n//    }\n//    \n//    //{{{ remove files\n//    for (i = 0; i < chrm_idx->index->num; ++i) {\n//        ret = asprintf(&ds_curr_index_file_name,\n//                       \"test_bulk_insert.ds_idx.%u\",\n//                       i);\n//        ret = asprintf(&ds_curr_data_file_name,\n//                       \"test_bulk_insert.ds_data.%u\",\n//                       i);\n//        remove(ds_curr_index_file_name);\n//        remove(ds_curr_data_file_name);\n//        free(ds_curr_index_file_name);\n//        free(ds_curr_data_file_name);\n//    }\n//    //}}}\n//\n//    //frees\n//    free(chrm);\n//    free(pqd_starts);\n//    uint64_t_array_destroy(&leading);\n//    uint64_t_array_destroy(&starts);\n//    uint64_t_array_destroy(&ends);\n//    uint32_t_array_destroy(&starts_pointers);\n//    uint32_t_array_destroy(&ends_pointers);\n//    free(bpn->data);\n//    free(bpn);\n//    offset_index_destroy(&offset_idx);\n//    chrm_index_destroy(&chrm_idx);\n//    file_index_destroy(&file_idx);\n//    priq_free(pq_start);\n//    priq_free(pq_end);\n//    remove(\"test_bulk_insert.offset.idx\");\n//}\n////}}}\n//\n//{{{ void test_giggle_bulk_insert_open_files(void)\nvoid test_giggle_bulk_insert_open_files(void)\n{\n    char *input_path_name = \"../data/many/*gz\";\n    char *output_path_name = \"tmp_test_giggle_bulk_insert_open_files\";\n\n    /*\n    struct stat st = {0};\n    if (stat(output_path_name, &st) == -1) {\n        mkdir(output_path_name, 0700);\n    } else {\n        rmrf(output_path_name);\n        mkdir(output_path_name, 0700);\n    }\n    */\n\n    struct file_index *file_idx = NULL;\n    struct input_file **i_files = NULL;\n\n    uint32_t num_input_files = giggle_bulk_insert_open_files(input_path_name,\n                                                             output_path_name,\n                                                             &i_files,\n                                                             &file_idx);\n    TEST_ASSERT_EQUAL(22, num_input_files);\n\n    uint32_t i;\n    for (i = 0; i < num_input_files; ++i)\n        input_file_destroy(&(i_files[i]));\n\n    file_index_destroy(&file_idx);\n    free(i_files);\n}\n//}}}\n\n//{{{ void test_giggle_bulk_insert_prime_pq(void)\nvoid test_giggle_bulk_insert_prime_pq(void)\n{\n    char *input_path_name = \"../data/many/*gz\";\n    char *output_path_name = \"tmp_test_giggle_bulk_insert_open_files\";\n\n    struct stat st = {0};\n    if (stat(output_path_name, &st) == -1) {\n        mkdir(output_path_name, 0700);\n    } else {\n        rmrf(output_path_name);\n        mkdir(output_path_name, 0700);\n    }\n\n    struct giggle_index *gi = (struct giggle_index *)\n            calloc(1, sizeof(struct giggle_index));\n    gi->data_dir = strdup(output_path_name);\n\n    // open files\n    gi->file_idx = NULL;\n    struct input_file **i_files = NULL;\n    uint32_t num_input_files = giggle_bulk_insert_open_files(input_path_name,\n                                                             gi->data_dir, \n                                                             &i_files,\n                                                             &(gi->file_idx));\n\n    TEST_ASSERT_EQUAL(22, num_input_files);\n\n    //init offset index\n    char *offset_index_file_name = NULL;\n    int ret = asprintf(&offset_index_file_name,\n                       \"%s/%s\",\n                       gi->data_dir,\n                       OFFSET_INDEX_FILE_NAME);\n    gi->offset_idx = offset_index_init(1000, offset_index_file_name);\n    free(offset_index_file_name);\n \n    //init chrm index\n    char *chrm_index_file_name = NULL;\n    ret = asprintf(&chrm_index_file_name,\n                   \"%s/%s\",\n                   gi->data_dir,\n                   CHRM_INDEX_FILE_NAME);\n    gi->chrm_idx = chrm_index_init(24, chrm_index_file_name);\n    free(chrm_index_file_name);\n \n\n    // prime pqs\n    pri_queue pq_start = priq_new(num_input_files);\n    // Since we know that each file will have at most one start in the priority\n    // queue, we can reduce mallocs by reusing the array\n    struct pq_data *pqd_starts = (struct pq_data *)\n            malloc(num_input_files * sizeof(struct pq_data));\n\n    pri_queue pq_end = priq_new(num_input_files);\n\n    giggle_bulk_insert_prime_pqs(gi,\n                                 &pq_start,\n                                 pqd_starts,\n                                 &pq_end,\n                                 i_files,\n                                 num_input_files);\n    \n    TEST_ASSERT_EQUAL(num_input_files, priq_size(pq_start));\n    TEST_ASSERT_EQUAL(num_input_files, priq_size(pq_end));\n\n    uint32_t i;\n    for (i = 0; i < num_input_files; ++i)\n        input_file_destroy(&(i_files[i]));\n    free(i_files);\n\n    free(pqd_starts);\n    priq_free(pq_start);\n\n    priority pri;\n    while (priq_top(pq_end, &pri) != NULL) {\n        free(priq_pop(pq_end, &pri));\n    }\n    priq_free(pq_end);\n    free(gi->data_dir);\n    file_index_destroy(&(gi->file_idx));\n    offset_index_destroy(&(gi->offset_idx));\n    chrm_index_destroy(&(gi->chrm_idx));\n    free(gi);\n    rmrf(output_path_name);\n}\n//}}}\n\n//{{{ void test_giggle_bulk_insert_build_leaf_levels(void)\nvoid test_giggle_bulk_insert_build_leaf_levels(void)\n{\n    char *input_path_name = \"../data/many/*gz\";\n    char *output_path_name = \"tmp_test_giggle_bulk_insert_build_leaf_levels\";\n\n    struct stat st = {0};\n    if (stat(output_path_name, &st) == -1) {\n        mkdir(output_path_name, 0700);\n    } else {\n        rmrf(output_path_name);\n        mkdir(output_path_name, 0700);\n    }\n\n    struct giggle_index *gi = (struct giggle_index *)\n            calloc(1, sizeof(struct giggle_index));\n    gi->data_dir = strdup(output_path_name);\n\n    // open files\n    gi->file_idx = NULL;\n    struct input_file **i_files = NULL;\n    uint32_t num_input_files = giggle_bulk_insert_open_files(input_path_name,\n                                                             gi->data_dir, \n                                                             &i_files,\n                                                             &(gi->file_idx));\n\n    TEST_ASSERT_EQUAL(22, num_input_files);\n\n    //init offset index\n    char *offset_index_file_name = NULL;\n    int ret = asprintf(&offset_index_file_name,\n                       \"%s/%s\",\n                       gi->data_dir,\n                       OFFSET_INDEX_FILE_NAME);\n    gi->offset_idx = offset_index_init(1000, offset_index_file_name);\n    free(offset_index_file_name);\n \n    //init chrm index\n    char *chrm_index_file_name = NULL;\n    ret = asprintf(&chrm_index_file_name,\n                   \"%s/%s\",\n                   gi->data_dir,\n                   CHRM_INDEX_FILE_NAME);\n    gi->chrm_idx = chrm_index_init(24, chrm_index_file_name);\n    free(chrm_index_file_name);\n \n\n    // prime pqs\n    pri_queue pq_start = priq_new(num_input_files);\n    // Since we know that each file will have at most one start in the priority\n    // queue, we can reduce mallocs by reusing the array\n    struct pq_data *pqd_starts = (struct pq_data *)\n            malloc(num_input_files * sizeof(struct pq_data));\n\n    pri_queue pq_end = priq_new(num_input_files);\n\n    giggle_bulk_insert_prime_pqs(gi,\n                                 &pq_start,\n                                 pqd_starts,\n                                 &pq_end,\n                                 i_files,\n                                 num_input_files);\n    \n    TEST_ASSERT_EQUAL(num_input_files, priq_size(pq_start));\n    TEST_ASSERT_EQUAL(num_input_files, priq_size(pq_end));\n\n    giggle_bulk_insert_build_leaf_levels(gi,\n                                         &pq_start,\n                                         pqd_starts,\n                                         &pq_end,\n                                         i_files,\n                                         num_input_files);\n\n    TEST_ASSERT_EQUAL(21024, gi->offset_idx->index->num);\n    TEST_ASSERT_EQUAL(24, gi->chrm_idx->index->num);\n\n    TEST_ASSERT_EQUAL(0, priq_size(pq_start));\n    TEST_ASSERT_EQUAL(0, priq_size(pq_end));\n    \n    uint32_t i;\n    for (i = 0; i < num_input_files; ++i)\n        input_file_destroy(&(i_files[i]));\n    free(i_files);\n\n    free(pqd_starts);\n    priq_free(pq_start);\n    priq_free(pq_end);\n    free(gi->data_dir);\n    file_index_destroy(&(gi->file_idx));\n    offset_index_destroy(&(gi->offset_idx));\n    chrm_index_destroy(&(gi->chrm_idx));\n    free(gi);\n    rmrf(output_path_name);\n}\n//}}}\n\n//{{{ void test_giggle_bulk_insert_build_tree_on_leaves(void)\nvoid test_giggle_bulk_insert_build_tree_on_leaves(void)\n{\n    char *input_path_name = \"../data/many/*gz\";\n    char *output_path_name = \"tmp_test_giggle_bulk_insert_build_leaf_levels\";\n\n    struct stat st = {0};\n    if (stat(output_path_name, &st) == -1) {\n        mkdir(output_path_name, 0700);\n    } else {\n        rmrf(output_path_name);\n        mkdir(output_path_name, 0700);\n    }\n\n    struct giggle_index *gi = (struct giggle_index *)\n            calloc(1, sizeof(struct giggle_index));\n    gi->data_dir = strdup(output_path_name);\n\n    // open files\n    gi->file_idx = NULL;\n    struct input_file **i_files = NULL;\n    uint32_t num_input_files = giggle_bulk_insert_open_files(input_path_name,\n                                                             gi->data_dir, \n                                                             &i_files,\n                                                             &(gi->file_idx));\n\n    TEST_ASSERT_EQUAL(22, num_input_files);\n\n    //init offset index\n    char *offset_index_file_name = NULL;\n    int ret = asprintf(&offset_index_file_name,\n                       \"%s/%s\",\n                       gi->data_dir,\n                       OFFSET_INDEX_FILE_NAME);\n    gi->offset_idx = offset_index_init(1000, offset_index_file_name);\n    free(offset_index_file_name);\n \n    //init chrm index\n    char *chrm_index_file_name = NULL;\n    ret = asprintf(&chrm_index_file_name,\n                   \"%s/%s\",\n                   gi->data_dir,\n                   CHRM_INDEX_FILE_NAME);\n    gi->chrm_idx = chrm_index_init(24, chrm_index_file_name);\n    free(chrm_index_file_name);\n \n\n    // prime pqs\n    pri_queue pq_start = priq_new(num_input_files);\n    // Since we know that each file will have at most one start in the priority\n    // queue, we can reduce mallocs by reusing the array\n    struct pq_data *pqd_starts = (struct pq_data *)\n            malloc(num_input_files * sizeof(struct pq_data));\n\n    pri_queue pq_end = priq_new(num_input_files);\n\n    giggle_bulk_insert_prime_pqs(gi,\n                                 &pq_start,\n                                 pqd_starts,\n                                 &pq_end,\n                                 i_files,\n                                 num_input_files);\n    \n    TEST_ASSERT_EQUAL(num_input_files, priq_size(pq_start));\n    TEST_ASSERT_EQUAL(num_input_files, priq_size(pq_end));\n\n    giggle_bulk_insert_build_leaf_levels(gi,\n                                         &pq_start,\n                                         pqd_starts,\n                                         &pq_end,\n                                         i_files,\n                                         num_input_files);\n\n    TEST_ASSERT_EQUAL(21024, gi->offset_idx->index->num);\n    TEST_ASSERT_EQUAL(24, gi->chrm_idx->index->num);\n\n    TEST_ASSERT_EQUAL(0, priq_size(pq_start));\n    TEST_ASSERT_EQUAL(0, priq_size(pq_end));\n    \n    uint32_t i;\n    for (i = 0; i < num_input_files; ++i)\n        input_file_destroy(&(i_files[i]));\n    free(i_files);\n    free(pqd_starts);\n    priq_free(pq_start);\n    priq_free(pq_end);\n\n    giggle_bulk_insert_build_tree_on_leaves(gi);\n\n    free(gi->data_dir);\n    file_index_destroy(&(gi->file_idx));\n    offset_index_destroy(&(gi->offset_idx));\n    chrm_index_destroy(&(gi->chrm_idx));\n    free(gi);\n    rmrf(output_path_name);\n}\n//}}}\n\n//{{{ void test_giggle_bulk_insert_build_leaf_levels_few(void)\nvoid test_giggle_bulk_insert_build_leaf_levels_few(void)\n{\n    ORDER = 5;\n    char *input_path_name = \"../data/few/*gz\";\n    char *output_path_name = \n            \"tmp_test_giggle_bulk_insert_build_leaf_levels_small\";\n\n    struct stat st = {0};\n    if (stat(output_path_name, &st) == -1) {\n        mkdir(output_path_name, 0700);\n    } else {\n        rmrf(output_path_name);\n        mkdir(output_path_name, 0700);\n    }\n\n    struct giggle_index *gi = (struct giggle_index *)\n            calloc(1, sizeof(struct giggle_index));\n    gi->data_dir = strdup(output_path_name);\n\n    // open files\n    gi->file_idx = NULL;\n    struct input_file **i_files = NULL;\n    uint32_t num_input_files = giggle_bulk_insert_open_files(input_path_name,\n                                                             gi->data_dir, \n                                                             &i_files,\n                                                             &(gi->file_idx));\n\n    TEST_ASSERT_EQUAL(3, num_input_files);\n\n    //init offset index\n    char *offset_index_file_name = NULL;\n    int ret = asprintf(&offset_index_file_name,\n                       \"%s/%s\",\n                       gi->data_dir,\n                       OFFSET_INDEX_FILE_NAME);\n    gi->offset_idx = offset_index_init(1000, offset_index_file_name);\n    free(offset_index_file_name);\n \n    //init chrm index\n    char *chrm_index_file_name = NULL;\n    ret = asprintf(&chrm_index_file_name,\n                   \"%s/%s\",\n                   gi->data_dir,\n                   CHRM_INDEX_FILE_NAME);\n    gi->chrm_idx = chrm_index_init(24, chrm_index_file_name);\n    free(chrm_index_file_name);\n \n    // prime pqs\n    pri_queue pq_start = priq_new(num_input_files);\n    // Since we know that each file will have at most one start in the priority\n    // queue, we can reduce mallocs by reusing the array\n    struct pq_data *pqd_starts = (struct pq_data *)\n            malloc(num_input_files * sizeof(struct pq_data));\n\n    pri_queue pq_end = priq_new(num_input_files);\n\n    giggle_bulk_insert_prime_pqs(gi,\n                                 &pq_start,\n                                 pqd_starts,\n                                 &pq_end,\n                                 i_files,\n                                 num_input_files);\n    \n    TEST_ASSERT_EQUAL(num_input_files, priq_size(pq_start));\n    TEST_ASSERT_EQUAL(num_input_files, priq_size(pq_end));\n\n    giggle_bulk_insert_build_leaf_levels(gi,\n                                         &pq_start,\n                                         pqd_starts,\n                                         &pq_end,\n                                         i_files,\n                                         num_input_files);\n\n    TEST_ASSERT_EQUAL(16, gi->offset_idx->index->num);\n    TEST_ASSERT_EQUAL(1, gi->chrm_idx->index->num);\n\n    TEST_ASSERT_EQUAL(0, priq_size(pq_start));\n    TEST_ASSERT_EQUAL(0, priq_size(pq_end));\n    \n    uint32_t i;\n    for (i = 0; i < num_input_files; ++i)\n        input_file_destroy(&(i_files[i]));\n    free(i_files);\n\n    free(pqd_starts);\n    priq_free(pq_start);\n    priq_free(pq_end);\n    free(gi->data_dir);\n    file_index_destroy(&(gi->file_idx));\n    offset_index_destroy(&(gi->offset_idx));\n    chrm_index_destroy(&(gi->chrm_idx));\n    free(gi);\n\n\n    char *index_file_name = NULL, *data_file_name = NULL;\n    ret = asprintf(&index_file_name,\n                   \"%s/%s0.idx\",\n                   output_path_name,\n                   CACHE_FILE_NAME_PREFIX);\n     ret = asprintf(&data_file_name,\n                   \"%s/%s0.dat\",\n                   output_path_name,\n                   CACHE_FILE_NAME_PREFIX);\n    \n    struct disk_store *ds = disk_store_load(NULL,\n                                            index_file_name,\n                                            NULL,\n                                            data_file_name);\n\n    TEST_ASSERT_EQUAL(12, ds->num);\n\n    uint32_t A_keys[6][5] =  {{1,2,5,10,16},\n                              {21,25,32,36,40},\n                              {41,45,51,52,56},\n                              {60,61,65,71,72},\n                              {76,80,81,85,91},\n                              {92,96,101,106,301}};\n    uint32_t A_starts_ens[6][5][2] = { {{2,0}, {3,0}, {4,0}, {5,1}, {5,2}},\n                                       {{1,0}, {2,0}, {2,1}, {2,2}, {3,2}},\n                                       {{1,0}, {2,0}, {2,1}, {2,2}, {2,3}},\n                                       {{1,0}, {2,0}, {3,0}, {3,1}, {3,2}},\n                                       {{0,1}, {1,1}, {2,1}, {3,1}, {3,2}},\n                                       {{0,1}, {0,2}, {0,3}, {0,4}, {0,5}} };\n\n    uint32_t A_leaf_sizes[6][3] = {{0,5,2}, {3,3,2}, {4,2,3}, {3,3,2} ,\n                                   {4,3,2,}, {5,0,5}};\n\n    uint64_t A_leading_vals_1[3] = {0,1,2};\n    uint64_t A_leading_vals_2[4] = {0,1,2,7};\n    uint64_t A_leading_vals_3[3] = {0,1,2};\n    uint64_t A_leading_vals_4[4] = {0,1,2,12};\n    uint64_t A_leading_vals_5[5] = {0,1,2,14,15};\n    uint64_t *A_leading_vals[6] = {NULL,\n                                   A_leading_vals_1,\n                                   A_leading_vals_2,\n                                   A_leading_vals_3,\n                                   A_leading_vals_4,\n                                   A_leading_vals_5};\n\n    uint32_t id = 1, leaf_i = 0;\n\n    while (id != 0) {\n        uint64_t size;\n        void *v = disk_store_get(ds, id - 1, &size);\n        struct bpt_node *bpn_in;\n        uint64_t  deserialized_size = bpt_node_deserialize(v,\n                                                          size,\n                                                          (void **)&bpn_in); \n        free(v);\n        struct leaf_data *ld_in;\n        v = disk_store_get(ds, BPT_POINTERS_BLOCK(bpn_in) - 1, &size);\n        deserialized_size = leaf_data_deserialize(v,\n                                                  size,\n                                                  (void **)&ld_in);\n\n        TEST_ASSERT_EQUAL(id, BPT_ID(bpn_in));\n        TEST_ASSERT_EQUAL(id+1, BPT_POINTERS_BLOCK(bpn_in));\n        if(id < 11)\n            TEST_ASSERT_EQUAL(id+2, BPT_NEXT(bpn_in));\n        else\n            TEST_ASSERT_EQUAL(0, BPT_NEXT(bpn_in));\n\n\n        TEST_ASSERT_EQUAL(5, BPT_NUM_KEYS(bpn_in));\n\n        TEST_ASSERT_EQUAL(A_leaf_sizes[leaf_i][0], ld_in->num_leading);\n        TEST_ASSERT_EQUAL(A_leaf_sizes[leaf_i][1], ld_in->num_starts);\n        TEST_ASSERT_EQUAL(A_leaf_sizes[leaf_i][2], ld_in->num_ends);\n\n        for (i = 0; i < ld_in->num_leading; ++i)\n            TEST_ASSERT_EQUAL(A_leading_vals[leaf_i][i], ld_in->leading[i]);\n\n        for (i = 0; i < BPT_NUM_KEYS(bpn_in); ++i) {\n            TEST_ASSERT_EQUAL(A_keys[leaf_i][i], BPT_KEYS(bpn_in)[i]);\n\n            TEST_ASSERT_EQUAL(A_starts_ens[leaf_i][i][0], \n                              ld_in->starts_pointers[i]);\n\n            TEST_ASSERT_EQUAL(A_starts_ens[leaf_i][i][1],\n                              ld_in->ends_pointers[i]);\n        }\n\n        /*\n        fprintf(stderr,\" L:\");\n        for (i = 0; i < ld_in->num_leading; ++i)\n            fprintf(stderr,\"%u \", ld_in->leading[i]);\n        fprintf(stderr,\" S:\");\n        for (i = 0; i < ld_in->num_starts; ++i)\n            fprintf(stderr,\"%u \", ld_in->starts[i]);\n        fprintf(stderr,\" E:\");\n        for (i = 0; i < ld_in->num_ends; ++i)\n            fprintf(stderr,\"%u \", ld_in->ends[i]);\n        fprintf(stderr,\n                \"\\t%u -> %u\\n\",\n                BPT_POINTERS_BLOCK(bpn_in),\n                BPT_NEXT(bpn_in));\n        */\n\n        id = BPT_NEXT(bpn_in);\n        leaf_i += 1;\n        free(v);\n        free(bpn_in->data);\n        free(bpn_in);\n        leaf_data_free_mem((void **)&ld_in);\n    }\n    rmrf(output_path_name);\n}\n//}}}\n\n//{{{ void test_giggle_bulk_insert_build_tree_on_leaves_few(void)\nvoid test_giggle_bulk_insert_build_tree_on_leaves_few(void)\n{\n    ORDER = 5;\n    char *input_path_name = \"../data/few/*gz\";\n    char *output_path_name = \n            \"tmp_test_giggle_bulk_insert_build_leaf_levels_small\";\n\n    struct stat st = {0};\n    if (stat(output_path_name, &st) == -1) {\n        mkdir(output_path_name, 0700);\n    } else {\n        rmrf(output_path_name);\n        mkdir(output_path_name, 0700);\n    }\n\n    struct giggle_index *gi = (struct giggle_index *)\n            calloc(1, sizeof(struct giggle_index));\n    gi->data_dir = strdup(output_path_name);\n\n    // open files\n    gi->file_idx = NULL;\n    struct input_file **i_files = NULL;\n    uint32_t num_input_files = giggle_bulk_insert_open_files(input_path_name,\n                                                             gi->data_dir, \n                                                             &i_files,\n                                                             &(gi->file_idx));\n    //init offset index\n    char *offset_index_file_name = NULL;\n    int ret = asprintf(&offset_index_file_name,\n                       \"%s/%s\",\n                       gi->data_dir,\n                       OFFSET_INDEX_FILE_NAME);\n    gi->offset_idx = offset_index_init(1000, offset_index_file_name);\n    free(offset_index_file_name);\n \n    //init chrm index\n    char *chrm_index_file_name = NULL;\n    ret = asprintf(&chrm_index_file_name,\n                   \"%s/%s\",\n                   gi->data_dir,\n                   CHRM_INDEX_FILE_NAME);\n    gi->chrm_idx = chrm_index_init(24, chrm_index_file_name);\n    free(chrm_index_file_name);\n \n    // prime pqs\n    pri_queue pq_start = priq_new(num_input_files);\n    // Since we know that each file will have at most one start in the priority\n    // queue, we can reduce mallocs by reusing the array\n    struct pq_data *pqd_starts = (struct pq_data *)\n            malloc(num_input_files * sizeof(struct pq_data));\n\n    pri_queue pq_end = priq_new(num_input_files);\n\n    giggle_bulk_insert_prime_pqs(gi,\n                                 &pq_start,\n                                 pqd_starts,\n                                 &pq_end,\n                                 i_files,\n                                 num_input_files);\n    \n    giggle_bulk_insert_build_leaf_levels(gi,\n                                         &pq_start,\n                                         pqd_starts,\n                                         &pq_end,\n                                         i_files,\n                                         num_input_files);\n    // clean up\n    priq_free(pq_end);\n    priq_free(pq_start);\n    free(pqd_starts);\n    uint32_t i;\n    for (i = 0; i < num_input_files; ++i)\n        input_file_destroy(&(i_files[i]));\n    free(i_files);\n\n    // build trees\n    giggle_bulk_insert_build_tree_on_leaves(gi);\n\n    uint32_t root_id = gi->root_ids[0];\n\n    giggle_index_destroy(&gi);\n\n\n    char *index_file_name = NULL, *data_file_name = NULL;\n    ret = asprintf(&index_file_name,\n                   \"%s/%s0.idx\",\n                   output_path_name,\n                   CACHE_FILE_NAME_PREFIX);\n     ret = asprintf(&data_file_name,\n                   \"%s/%s0.dat\",\n                   output_path_name,\n                   CACHE_FILE_NAME_PREFIX);\n    \n    struct disk_store *ds = disk_store_load(NULL,\n                                            index_file_name,\n                                            NULL,\n                                            data_file_name);\n\n    uint64_t size;\n    void *v = disk_store_get(ds, root_id - 1, &size);\n    struct bpt_node *bpn_in;\n    uint64_t  deserialized_size = bpt_node_deserialize(v,\n                                                      size,\n                                                      (void **)&bpn_in); \n    free(v);\n\n    TEST_ASSERT_EQUAL(5, BPT_NUM_KEYS(bpn_in));\n    uint32_t A_keys[5] = {21, 41, 60, 76, 92};\n    uint32_t A_pointers[6] = {1, 3, 5, 7, 9, 11};\n\n    for (i = 0; i < 5; ++i)\n        TEST_ASSERT_EQUAL(A_keys[i], BPT_KEYS(bpn_in)[i]);\n\n    for (i = 0; i < 6; ++i)\n        TEST_ASSERT_EQUAL(A_pointers[i], BPT_POINTERS(bpn_in)[i]);\n\n    free(bpn_in->data);\n    free(bpn_in);\n    disk_store_destroy(&ds);\n    rmrf(output_path_name);\n}\n//}}}\n\n//{{{void test_giggle_bulk_insert_few(void)\nvoid test_giggle_bulk_insert_few(void)\n{\n    ORDER = 5;\n    char *input_path_name = \"../data/few/*gz\";\n    char *output_path_name = \n            \"tmp_test_giggle_bulk_insert_build_leaf_levels_small\";\n\n    uint64_t num_intervals = giggle_bulk_insert(input_path_name,\n                                                output_path_name,\n                                                1);\n\n    struct giggle_index *gi =\n                giggle_load(output_path_name,\n                            uint64_t_ll_giggle_set_data_handler);\n    giggle_data_handler.giggle_collect_intersection =\n            giggle_collect_intersection_data_in_block;\n    giggle_data_handler.map_intersection_to_offset_list =\n            leaf_data_map_intersection_to_offset_list;\n\n    TEST_ASSERT_EQUAL(1, gi->len);\n    TEST_ASSERT_EQUAL(1, gi->num);\n    TEST_ASSERT_EQUAL(3, gi->file_idx->index->num);\n    TEST_ASSERT_EQUAL(1, gi->chrm_idx->index->num);\n    TEST_ASSERT_EQUAL(16, gi->offset_idx->index->num);\n\n    struct giggle_query_result *gqr = NULL;\n    gqr = giggle_query(gi, \"1\", 1, 25, gqr);\n\n    TEST_ASSERT_EQUAL(7, gqr->num_hits);\n\n    uint32_t A_query_result_0[3] = {0,3,5};\n    uint32_t A_query_result_1[2] = {1,6};\n    uint32_t A_query_result_2[2] = {2,4};\n    uint32_t *A_query_result[3] = {A_query_result_0,\n                                   A_query_result_1,\n                                   A_query_result_2};\n\n    uint32_t A_query_len[3] = {3, 2, 2};\n    uint32_t i;\n    for(i = 0; i < gqr->num_files; i++) {\n        TEST_ASSERT_EQUAL(A_query_len[i], giggle_get_query_len(gqr, i));\n        struct giggle_query_iter *gqi = giggle_get_query_itr(gqr, i);\n        TEST_ASSERT_EQUAL(A_query_len[i], gqi->num);\n        giggle_iter_destroy(&gqi);\n    }\n\n    giggle_query_result_destroy(&gqr);\n    giggle_index_destroy(&gi);\n    cache.destroy();\n    rmrf(output_path_name);\n}\n//}}}\n\n//{{{ void test_giggle_bulk_insert_build_tree_on_leaves_few_order_4(void)\nvoid test_giggle_bulk_insert_build_tree_on_leaves_few_order_4(void)\n{\n    ORDER = 4;\n    char *input_path_name = \"../data/few/*gz\";\n    char *output_path_name = \n            \"tmp_test_giggle_bulk_insert_build_tree_on_leaves_few_order_4\";\n\n    struct stat st = {0};\n    if (stat(output_path_name, &st) == -1) {\n        mkdir(output_path_name, 0700);\n    } else {\n        rmrf(output_path_name);\n        mkdir(output_path_name, 0700);\n    }\n\n    struct giggle_index *gi = (struct giggle_index *)\n            calloc(1, sizeof(struct giggle_index));\n    gi->data_dir = strdup(output_path_name);\n\n    // open files\n    gi->file_idx = NULL;\n    struct input_file **i_files = NULL;\n    uint32_t num_input_files = giggle_bulk_insert_open_files(input_path_name,\n                                                             gi->data_dir, \n                                                             &i_files,\n                                                             &(gi->file_idx));\n    //init offset index\n    char *offset_index_file_name = NULL;\n    int ret = asprintf(&offset_index_file_name,\n                       \"%s/%s\",\n                       gi->data_dir,\n                       OFFSET_INDEX_FILE_NAME);\n    gi->offset_idx = offset_index_init(1000, offset_index_file_name);\n    free(offset_index_file_name);\n \n    //init chrm index\n    char *chrm_index_file_name = NULL;\n    ret = asprintf(&chrm_index_file_name,\n                   \"%s/%s\",\n                   gi->data_dir,\n                   CHRM_INDEX_FILE_NAME);\n    gi->chrm_idx = chrm_index_init(24, chrm_index_file_name);\n    free(chrm_index_file_name);\n \n    // prime pqs\n    pri_queue pq_start = priq_new(num_input_files);\n    // Since we know that each file will have at most one start in the priority\n    // queue, we can reduce mallocs by reusing the array\n    struct pq_data *pqd_starts = (struct pq_data *)\n            malloc(num_input_files * sizeof(struct pq_data));\n\n    pri_queue pq_end = priq_new(num_input_files);\n\n    giggle_bulk_insert_prime_pqs(gi,\n                                 &pq_start,\n                                 pqd_starts,\n                                 &pq_end,\n                                 i_files,\n                                 num_input_files);\n    \n    giggle_bulk_insert_build_leaf_levels(gi,\n                                         &pq_start,\n                                         pqd_starts,\n                                         &pq_end,\n                                         i_files,\n                                         num_input_files);\n    // clean up\n    priq_free(pq_end);\n    priq_free(pq_start);\n    free(pqd_starts);\n    uint32_t i;\n    for (i = 0; i < num_input_files; ++i)\n        input_file_destroy(&(i_files[i]));\n    free(i_files);\n\n    // build trees\n    giggle_bulk_insert_build_tree_on_leaves(gi);\n\n\n    uint32_t root_id = gi->root_ids[0];\n\n    giggle_index_destroy(&gi);\n\n\n    char *index_file_name = NULL, *data_file_name = NULL;\n    ret = asprintf(&index_file_name,\n                   \"%s/%s0.idx\",\n                   output_path_name,\n                   CACHE_FILE_NAME_PREFIX);\n     ret = asprintf(&data_file_name,\n                   \"%s/%s0.dat\",\n                   output_path_name,\n                   CACHE_FILE_NAME_PREFIX);\n    \n    struct disk_store *ds = disk_store_load(NULL,\n                                            index_file_name,\n                                            NULL,\n                                            data_file_name);\n\n    uint64_t size;\n    void *v = disk_store_get(ds, root_id - 1, &size);\n    struct bpt_node *bpn_in;\n    uint64_t  deserialized_size = bpt_node_deserialize(v,\n                                                      size,\n                                                      (void **)&bpn_in); \n    free(v);\n\n    TEST_ASSERT_EQUAL(1, BPT_NUM_KEYS(bpn_in));\n    TEST_ASSERT_EQUAL(76, BPT_KEYS(bpn_in)[0]);\n    TEST_ASSERT_EQUAL(17, BPT_POINTERS(bpn_in)[0]);\n    TEST_ASSERT_EQUAL(18, BPT_POINTERS(bpn_in)[1]);\n\n    uint32_t left_id = BPT_POINTERS(bpn_in)[0];\n    uint32_t right_id = BPT_POINTERS(bpn_in)[1];\n\n    free(bpn_in->data);\n    free(bpn_in);\n\n    v = disk_store_get(ds, left_id - 1, &size);\n    deserialized_size = bpt_node_deserialize(v,\n                                             size,\n                                             (void **)&bpn_in); \n    free(v);\n\n    TEST_ASSERT_EQUAL(4, BPT_NUM_KEYS(bpn_in));\n    uint32_t A_left_keys[4] = {16,36,51,61};\n    for (i = 0; i < 4; ++i)\n        TEST_ASSERT_EQUAL(A_left_keys[i], BPT_KEYS(bpn_in)[i]);\n\n    uint32_t A_left_pointers[5] = {1,3,5,7,9};\n    for (i = 0; i < 5; ++i)\n        TEST_ASSERT_EQUAL(A_left_pointers[i], BPT_POINTERS(bpn_in)[i]);\n\n    free(bpn_in->data);\n    free(bpn_in);\n\n    v = disk_store_get(ds, right_id - 1, &size);\n    deserialized_size = bpt_node_deserialize(v,\n                                             size,\n                                             (void **)&bpn_in); \n    free(v);\n\n    TEST_ASSERT_EQUAL(3, BPT_NUM_KEYS(bpn_in));\n    uint32_t A_right_keys[3] = {76,91,106};\n    for (i = 0; i < 3; ++i)\n        TEST_ASSERT_EQUAL(A_right_keys[i], BPT_KEYS(bpn_in)[i]);\n\n    uint32_t A_right_pointers[4] = {0,11,13,15};\n    for (i = 0; i < 4; ++i)\n        TEST_ASSERT_EQUAL(A_right_pointers[i], BPT_POINTERS(bpn_in)[i]);\n\n    free(bpn_in->data);\n    free(bpn_in);\n\n    disk_store_destroy(&ds);\n    rmrf(output_path_name);\n}\n//}}}\n\n//{{{ void test_giggle_bulk_insert_build_tree_on_leaves_few_order_3(void)\nvoid test_giggle_bulk_insert_build_tree_on_leaves_few_order_3(void)\n{\n    ORDER = 3;\n    char *input_path_name = \"../data/few/*gz\";\n    char *output_path_name = \n            \"tmp_test_giggle_bulk_insert_build_tree_on_leaves_few_order_4\";\n\n    struct stat st = {0};\n    if (stat(output_path_name, &st) == -1) {\n        mkdir(output_path_name, 0700);\n    } else {\n        rmrf(output_path_name);\n        mkdir(output_path_name, 0700);\n    }\n\n    struct giggle_index *gi = (struct giggle_index *)\n            calloc(1, sizeof(struct giggle_index));\n    gi->data_dir = strdup(output_path_name);\n\n    // open files\n    gi->file_idx = NULL;\n    struct input_file **i_files = NULL;\n    uint32_t num_input_files = giggle_bulk_insert_open_files(input_path_name,\n                                                             gi->data_dir, \n                                                             &i_files,\n                                                             &(gi->file_idx));\n    //init offset index\n    char *offset_index_file_name = NULL;\n    int ret = asprintf(&offset_index_file_name,\n                       \"%s/%s\",\n                       gi->data_dir,\n                       OFFSET_INDEX_FILE_NAME);\n    gi->offset_idx = offset_index_init(1000, offset_index_file_name);\n    free(offset_index_file_name);\n \n    //init chrm index\n    char *chrm_index_file_name = NULL;\n    ret = asprintf(&chrm_index_file_name,\n                   \"%s/%s\",\n                   gi->data_dir,\n                   CHRM_INDEX_FILE_NAME);\n    gi->chrm_idx = chrm_index_init(24, chrm_index_file_name);\n    free(chrm_index_file_name);\n \n    // prime pqs\n    pri_queue pq_start = priq_new(num_input_files);\n    // Since we know that each file will have at most one start in the priority\n    // queue, we can reduce mallocs by reusing the array\n    struct pq_data *pqd_starts = (struct pq_data *)\n            malloc(num_input_files * sizeof(struct pq_data));\n\n    pri_queue pq_end = priq_new(num_input_files);\n\n    giggle_bulk_insert_prime_pqs(gi,\n                                 &pq_start,\n                                 pqd_starts,\n                                 &pq_end,\n                                 i_files,\n                                 num_input_files);\n    \n    giggle_bulk_insert_build_leaf_levels(gi,\n                                         &pq_start,\n                                         pqd_starts,\n                                         &pq_end,\n                                         i_files,\n                                         num_input_files);\n    // clean up\n    priq_free(pq_end);\n    priq_free(pq_start);\n    free(pqd_starts);\n    uint32_t i;\n    for (i = 0; i < num_input_files; ++i)\n        input_file_destroy(&(i_files[i]));\n    free(i_files);\n\n    // build trees\n    giggle_bulk_insert_build_tree_on_leaves(gi);\n\n    uint32_t root_id = gi->root_ids[0];\n\n    TEST_ASSERT_EQUAL(24, root_id);\n\n    giggle_index_destroy(&gi);\n\n    char *index_file_name = NULL, *data_file_name = NULL;\n    ret = asprintf(&index_file_name,\n                   \"%s/%s0.idx\",\n                   output_path_name,\n                   CACHE_FILE_NAME_PREFIX);\n     ret = asprintf(&data_file_name,\n                   \"%s/%s0.dat\",\n                   output_path_name,\n                   CACHE_FILE_NAME_PREFIX);\n    \n    struct disk_store *ds = disk_store_load(NULL,\n                                            index_file_name,\n                                            NULL,\n                                            data_file_name);\n\n    uint64_t size;\n    void *v = disk_store_get(ds, root_id - 1, &size);\n    struct bpt_node *bpn_in;\n    uint64_t  deserialized_size = bpt_node_deserialize(v,\n                                                      size,\n                                                      (void **)&bpn_in); \n    free(v);\n\n    TEST_ASSERT_EQUAL(2, BPT_NUM_KEYS(bpn_in));\n    TEST_ASSERT_EQUAL(51, BPT_KEYS(bpn_in)[0]);\n    TEST_ASSERT_EQUAL(80, BPT_KEYS(bpn_in)[1]);\n    TEST_ASSERT_EQUAL(21, BPT_POINTERS(bpn_in)[0]);\n    TEST_ASSERT_EQUAL(22, BPT_POINTERS(bpn_in)[1]);\n    TEST_ASSERT_EQUAL(23, BPT_POINTERS(bpn_in)[2]);\n\n    disk_store_destroy(&ds);\n    rmrf(output_path_name);\n}\n//}}}\n\n//{{{ void test_giggle_bulk_insert_build_tree_on_leaves_few_order_4(void)\nvoid test_giggle_bulk_insert_build_tree_on_leaves_few_order_2(void)\n{\n    ORDER = 2;\n    char *input_path_name = \"../data/few/*gz\";\n    char *output_path_name = \n            \"tmp_test_giggle_bulk_insert_build_tree_on_leaves_few_order_2\";\n\n    struct stat st = {0};\n    if (stat(output_path_name, &st) == -1) {\n        mkdir(output_path_name, 0700);\n    } else {\n        rmrf(output_path_name);\n        mkdir(output_path_name, 0700);\n    }\n\n    struct giggle_index *gi = (struct giggle_index *)\n            calloc(1, sizeof(struct giggle_index));\n    gi->data_dir = strdup(output_path_name);\n\n    // open files\n    gi->file_idx = NULL;\n    struct input_file **i_files = NULL;\n    uint32_t num_input_files = giggle_bulk_insert_open_files(input_path_name,\n                                                             gi->data_dir, \n                                                             &i_files,\n                                                             &(gi->file_idx));\n    //init offset index\n    char *offset_index_file_name = NULL;\n    int ret = asprintf(&offset_index_file_name,\n                       \"%s/%s\",\n                       gi->data_dir,\n                       OFFSET_INDEX_FILE_NAME);\n    gi->offset_idx = offset_index_init(1000, offset_index_file_name);\n    free(offset_index_file_name);\n \n    //init chrm index\n    char *chrm_index_file_name = NULL;\n    ret = asprintf(&chrm_index_file_name,\n                   \"%s/%s\",\n                   gi->data_dir,\n                   CHRM_INDEX_FILE_NAME);\n    gi->chrm_idx = chrm_index_init(24, chrm_index_file_name);\n    free(chrm_index_file_name);\n \n    // prime pqs\n    pri_queue pq_start = priq_new(num_input_files);\n    // Since we know that each file will have at most one start in the priority\n    // queue, we can reduce mallocs by reusing the array\n    struct pq_data *pqd_starts = (struct pq_data *)\n            malloc(num_input_files * sizeof(struct pq_data));\n\n    pri_queue pq_end = priq_new(num_input_files);\n\n    giggle_bulk_insert_prime_pqs(gi,\n                                 &pq_start,\n                                 pqd_starts,\n                                 &pq_end,\n                                 i_files,\n                                 num_input_files);\n    \n    giggle_bulk_insert_build_leaf_levels(gi,\n                                         &pq_start,\n                                         pqd_starts,\n                                         &pq_end,\n                                         i_files,\n                                         num_input_files);\n    // clean up\n    priq_free(pq_end);\n    priq_free(pq_start);\n    free(pqd_starts);\n    uint32_t i;\n    for (i = 0; i < num_input_files; ++i)\n        input_file_destroy(&(i_files[i]));\n    free(i_files);\n\n    // build trees\n    giggle_bulk_insert_build_tree_on_leaves(gi);\n\n    uint32_t root_id = gi->root_ids[0];\n\n    TEST_ASSERT_EQUAL(41, root_id);\n\n    giggle_index_destroy(&gi);\n\n    char *index_file_name = NULL, *data_file_name = NULL;\n    ret = asprintf(&index_file_name,\n                   \"%s/%s0.idx\",\n                   output_path_name,\n                   CACHE_FILE_NAME_PREFIX);\n     ret = asprintf(&data_file_name,\n                   \"%s/%s0.dat\",\n                   output_path_name,\n                   CACHE_FILE_NAME_PREFIX);\n    \n    struct disk_store *ds = disk_store_load(NULL,\n                                            index_file_name,\n                                            NULL,\n                                            data_file_name);\n\n    uint64_t size;\n    void *v = disk_store_get(ds, root_id - 1, &size);\n    struct bpt_node *bpn_in;\n    uint64_t  deserialized_size = bpt_node_deserialize(v,\n                                                      size,\n                                                      (void **)&bpn_in); \n    free(v);\n\n    uint32_t root_keys[2] = {56, 81};\n    uint32_t root_values[3] = {38, 39, 40};\n    TEST_ASSERT_EQUAL(2, BPT_NUM_KEYS(bpn_in));\n    TEST_ASSERT_EQUAL(root_keys[0], BPT_KEYS(bpn_in)[0]);\n    TEST_ASSERT_EQUAL(root_keys[1], BPT_KEYS(bpn_in)[1]);\n    TEST_ASSERT_EQUAL(root_values[0], BPT_POINTERS(bpn_in)[0]);\n    TEST_ASSERT_EQUAL(root_values[1], BPT_POINTERS(bpn_in)[1]);\n    TEST_ASSERT_EQUAL(root_values[2], BPT_POINTERS(bpn_in)[2]);\n\n    free(bpn_in->data);\n    free(bpn_in);\n\n    v = disk_store_get(ds, root_values[0] - 1, &size);\n    deserialized_size = bpt_node_deserialize(v,\n                                             size,\n                                             (void **)&bpn_in); \n    free(v);\n\n    uint32_t left_keys[2] = {25, 41};\n    uint32_t left_values[3] = {31, 32, 33};\n    TEST_ASSERT_EQUAL(2, BPT_NUM_KEYS(bpn_in));\n    TEST_ASSERT_EQUAL(left_keys[0], BPT_KEYS(bpn_in)[0]);\n    TEST_ASSERT_EQUAL(left_keys[1], BPT_KEYS(bpn_in)[1]);\n    TEST_ASSERT_EQUAL(left_values[0], BPT_POINTERS(bpn_in)[0]);\n    TEST_ASSERT_EQUAL(left_values[1], BPT_POINTERS(bpn_in)[1]);\n    TEST_ASSERT_EQUAL(left_values[2], BPT_POINTERS(bpn_in)[2]);\n\n    free(bpn_in->data);\n    free(bpn_in);\n\n    v = disk_store_get(ds, root_values[1] - 1, &size);\n    deserialized_size = bpt_node_deserialize(v,\n                                             size,\n                                             (void **)&bpn_in); \n    free(v);\n\n\n    uint32_t middle_keys[2] = {56, 71};\n    uint32_t middle_values[3] = {0, 34, 35};\n    TEST_ASSERT_EQUAL(2, BPT_NUM_KEYS(bpn_in));\n    TEST_ASSERT_EQUAL(middle_keys[0], BPT_KEYS(bpn_in)[0]);\n    TEST_ASSERT_EQUAL(middle_keys[1], BPT_KEYS(bpn_in)[1]);\n    TEST_ASSERT_EQUAL(middle_values[0], BPT_POINTERS(bpn_in)[0]);\n    TEST_ASSERT_EQUAL(middle_values[1], BPT_POINTERS(bpn_in)[1]);\n    TEST_ASSERT_EQUAL(middle_values[2], BPT_POINTERS(bpn_in)[2]);\n\n    free(bpn_in->data);\n    free(bpn_in);\n\n    v = disk_store_get(ds, root_values[2] - 1, &size);\n    deserialized_size = bpt_node_deserialize(v,\n                                             size,\n                                             (void **)&bpn_in); \n    free(v);\n\n\n    uint32_t right_keys[2] = {81, 96};\n    uint32_t right_values[3] = {0, 36, 37};\n    TEST_ASSERT_EQUAL(2, BPT_NUM_KEYS(bpn_in));\n    TEST_ASSERT_EQUAL(right_keys[0], BPT_KEYS(bpn_in)[0]);\n    TEST_ASSERT_EQUAL(right_keys[1], BPT_KEYS(bpn_in)[1]);\n    TEST_ASSERT_EQUAL(right_values[0], BPT_POINTERS(bpn_in)[0]);\n    TEST_ASSERT_EQUAL(right_values[1], BPT_POINTERS(bpn_in)[1]);\n    TEST_ASSERT_EQUAL(right_values[2], BPT_POINTERS(bpn_in)[2]);\n\n    free(bpn_in->data);\n    free(bpn_in);\n\n    disk_store_destroy(&ds);\n    rmrf(output_path_name);\n}\n//}}}\n\n//{{{void test_giggle_bulk_insert(void)\nvoid test_giggle_bulk_insert_fews(void)\n{\n    char *input_path_name = \"../data/few/*gz\";\n    char *output_path_name = \"test_giggle_bulk_insert_fews\";\n\n    uint32_t order;\n    for (order = 2; order <= 100; ++order) {\n        ORDER = order;\n        uint64_t num_intervals = giggle_bulk_insert(input_path_name,\n                                                    output_path_name,\n                                                    1);\n        struct giggle_index *gi =\n                    giggle_load(output_path_name,\n                                uint64_t_ll_giggle_set_data_handler);\n        giggle_data_handler.giggle_collect_intersection =\n                giggle_collect_intersection_data_in_block;\n        giggle_data_handler.map_intersection_to_offset_list =\n                leaf_data_map_intersection_to_offset_list;\n\n        struct giggle_query_result *gqr = NULL;\n        gqr = giggle_query(gi, \"1\", 20, 50, gqr);\n\n        TEST_ASSERT_EQUAL(8, gqr->num_hits);\n\n        giggle_query_result_destroy(&gqr);\n        giggle_index_destroy(&gi);\n        cache.destroy();\n    }\n    rmrf(output_path_name);\n}\n//}}}\n\n//{{{void test_giggle_bulk_insert(void)\nvoid test_giggle_bulk_insert(void)\n{\n    char *input_path_name = \"../data/many/*gz\";\n    char *output_path_name = \"tmp_test_giggle_bulk_insert\";\n\n    uint64_t num_intervals = giggle_bulk_insert(input_path_name,\n                                                output_path_name,\n                                                1);\n    TEST_ASSERT_EQUAL(21024, num_intervals);\n\n    struct giggle_index *gi =\n                giggle_load(output_path_name,\n                            uint64_t_ll_giggle_set_data_handler);\n    giggle_data_handler.giggle_collect_intersection =\n            giggle_collect_intersection_data_in_block;\n    giggle_data_handler.map_intersection_to_offset_list =\n            leaf_data_map_intersection_to_offset_list;\n\n    TEST_ASSERT_EQUAL(24, gi->len);\n    TEST_ASSERT_EQUAL(24, gi->num);\n    TEST_ASSERT_EQUAL(22, gi->file_idx->index->num);\n    TEST_ASSERT_EQUAL(24, gi->chrm_idx->index->num);\n    TEST_ASSERT_EQUAL(21024, gi->offset_idx->index->num);\n\n    struct giggle_query_result *gqr = NULL;\n    gqr = giggle_query(gi, \"1\", 5000000, 6200000, gqr);\n\n    //fprintf(stderr, \"%u\\n\", gqr->num_hits);\n\n    giggle_index_destroy(&gi);\n    rmrf(output_path_name);\n}\n//}}}\n"
  },
  {
    "path": "test/unit/test_cache.c",
    "content": "#include <stdio.h>\n#include <stdlib.h>\n#include <math.h>\n#include <stdio.h>\n#include <inttypes.h>\n#include <string.h>\n\n#include \"unity.h\"\n#include \"lists.h\"\n#include \"cache.h\"\n#include \"disk_store.h\"\n\nvoid setUp(void) { }\nvoid tearDown(void) { }\n\n//{{{ tripple\nstruct tripple {\n    uint32_t a;\n    char b;\n    double c;\n};\n\nuint64_t tripple_serialize(void *deserialized, void **serialized)\n{\n    struct tripple *de = (struct tripple *)deserialized;\n\n    uint8_t *data = (uint8_t *)calloc(1, sizeof(uint32_t) + \n                                         sizeof(char) + \n                                         sizeof(double));\n\n    memcpy(data, &(de->a), sizeof(uint32_t));\n    memcpy(data + sizeof(uint32_t), &(de->b), sizeof(char));\n    memcpy(data + sizeof(uint32_t) + sizeof(char), &(de->c), sizeof(double));\n\n    *serialized = (void *)data;\n    return sizeof(uint32_t) + sizeof(char) + sizeof(double);\n}\n\nuint64_t tripple_deserialize(void *serialized,\n                             uint64_t serialized_size,\n                             void **deserialized)\n{\n    uint8_t *data = (uint8_t *)serialized;\n\n    struct tripple *t = (struct tripple *)calloc(1, sizeof(struct tripple));\n\n    memcpy(&(t->a), data, sizeof(uint32_t));\n    memcpy(&(t->b), data + sizeof(uint32_t),sizeof(char));\n    memcpy(&(t->c), data + sizeof(uint32_t) + sizeof(char), sizeof(double));\n\n    *deserialized = (void *)t;\n\n    return sizeof(struct tripple);\n}\n\nvoid tripple_free_mem(void **deserialized)\n{\n    struct tripple **de = (struct tripple **)deserialized;\n    free(*de);\n    *de = NULL;\n}\n\nstruct cache_handler tripple_cache_handler = {tripple_serialize, \n                                              tripple_deserialize,\n                                              tripple_free_mem};\n//}}}\n\n//{{{void test_simple_cache(void)\nvoid test_simple_cache(void)\n{\n    struct simple_cache *sc = simple_cache_init(5, 3, NULL);\n\n    struct tripple *t = (struct tripple *)calloc(1, sizeof(struct tripple));\n    t->a = 10;\n    t->b = 'x';\n    t->c = 10.1;\n\n    TEST_ASSERT_EQUAL(0, simple_cache_seen(0));\n    TEST_ASSERT_EQUAL(0, simple_cache_seen(1));\n    TEST_ASSERT_EQUAL(0, simple_cache_seen(2));\n\n    simple_cache_add(1, 0, t, sizeof(struct tripple), &tripple_cache_handler);\n\n    TEST_ASSERT_EQUAL(0, simple_cache_seen(0));\n    TEST_ASSERT_EQUAL(1, simple_cache_seen(1));\n    TEST_ASSERT_EQUAL(0, simple_cache_seen(2));\n\n    t = (struct tripple *)calloc(1, sizeof(struct tripple));\n    t->a = 11;\n    t->b = 'a';\n    t->c = 11.1;\n\n    simple_cache_add(0, 0, t, sizeof(struct tripple), &tripple_cache_handler);\n\n    t = (struct tripple *)calloc(1, sizeof(struct tripple));\n    t->a = 12;\n    t->b = 'b';\n    t->c = 12.1;\n\n    simple_cache_add(0, 1, t, sizeof(struct tripple), &tripple_cache_handler);\n\n    t = (struct tripple *)calloc(1, sizeof(struct tripple));\n    t->a = 13;\n    t->b = 'c';\n    t->c = 13.1;\n\n    simple_cache_add(0, 2, t, sizeof(struct tripple), &tripple_cache_handler);\n\n\n    TEST_ASSERT_EQUAL(3, simple_cache_seen(0));\n    TEST_ASSERT_EQUAL(1, simple_cache_seen(1));\n    TEST_ASSERT_EQUAL(0, simple_cache_seen(2));\n\n    t = simple_cache_get(0, 0, &tripple_cache_handler);\n\n    TEST_ASSERT_EQUAL(11, t->a);\n    TEST_ASSERT_EQUAL('a', t->b);\n    TEST_ASSERT_EQUAL_FLOAT(11.1 , t->c);\n\n    t = simple_cache_get(0, 1, &tripple_cache_handler);\n    TEST_ASSERT_EQUAL(12, t->a);\n    TEST_ASSERT_EQUAL('b', t->b);\n    TEST_ASSERT_EQUAL_FLOAT(12.1 , t->c);\n\n    t = simple_cache_get(0, 2, &tripple_cache_handler);\n    TEST_ASSERT_EQUAL(13, t->a);\n    TEST_ASSERT_EQUAL('c', t->b);\n    TEST_ASSERT_EQUAL_FLOAT(13.1 , t->c);\n\n    t = simple_cache_get(0, 15, &tripple_cache_handler);\n    TEST_ASSERT_EQUAL(NULL, t);\n\n    simple_cache_destroy();\n\n}\n///}}}\n//\n////{{{ void test_simple_cache_with_disk(void)\n//void test_simple_cache_with_disk(void)\n//{\n//\n//    char *file_names[3] = {\"tmp.one\", \"tmp.two\", \"tmp.three\"};\n//    struct simple_cache *sc = simple_cache_init(5, 3, file_names);\n//\n//    //{{{\n//    struct tripple *t = (struct tripple *)calloc(1, sizeof(struct tripple));\n//    t->a = 10;\n//    t->b = 'x';\n//    t->c = 10.1;\n//\n//    TEST_ASSERT_EQUAL(0, simple_cache_seen(0));\n//    TEST_ASSERT_EQUAL(0, simple_cache_seen(1));\n//    TEST_ASSERT_EQUAL(0, simple_cache_seen(2));\n//\n//    simple_cache_add(1, 0, t, sizeof(struct tripple), &tripple_cache_handler);\n//\n//    TEST_ASSERT_EQUAL(0, simple_cache_seen(0));\n//    TEST_ASSERT_EQUAL(1, simple_cache_seen(1));\n//    TEST_ASSERT_EQUAL(0, simple_cache_seen(2));\n//\n//    t = (struct tripple *)calloc(1, sizeof(struct tripple));\n//    t->a = 11;\n//    t->b = 'a';\n//    t->c = 11.1;\n//\n//    simple_cache_add(0, 0, t, sizeof(struct tripple), &tripple_cache_handler);\n//\n//    t = (struct tripple *)calloc(1, sizeof(struct tripple));\n//    t->a = 12;\n//    t->b = 'b';\n//    t->c = 12.1;\n//\n//    simple_cache_add(0, 1, t, sizeof(struct tripple),&tripple_cache_handler);\n//\n//    t = (struct tripple *)calloc(1, sizeof(struct tripple));\n//    t->a = 13;\n//    t->b = 'c';\n//    t->c = 13.1;\n//\n//    simple_cache_add(0, 2, t, sizeof(struct tripple), &tripple_cache_handler);\n//    //}}}\n//\n//    simple_cache_store(0, NULL);\n//    simple_cache_store(1, NULL);\n//    simple_cache_store(2, NULL);\n//\n//    simple_cache_destroy();\n//\n//    sc = simple_cache_init(5, 3, file_names);\n//\n//    TEST_ASSERT_EQUAL(3, simple_cache_seen(0));\n//    TEST_ASSERT_EQUAL(1, simple_cache_seen(1));\n//    TEST_ASSERT_EQUAL(0, simple_cache_seen(2));\n//\n//    t = simple_cache_get(0, 0, &tripple_cache_handler);\n//    TEST_ASSERT_EQUAL(11, t->a);\n//    TEST_ASSERT_EQUAL('a', t->b);\n//    TEST_ASSERT_EQUAL_FLOAT(11.1 , t->c);\n//\n//    t = simple_cache_get(0, 1, &tripple_cache_handler);\n//    TEST_ASSERT_EQUAL(12, t->a);\n//    TEST_ASSERT_EQUAL('b', t->b);\n//    TEST_ASSERT_EQUAL_FLOAT(12.1 , t->c);\n//\n//    t = simple_cache_get(0, 2, &tripple_cache_handler);\n//    TEST_ASSERT_EQUAL(13, t->a);\n//    TEST_ASSERT_EQUAL('c', t->b);\n//    TEST_ASSERT_EQUAL_FLOAT(13.1 , t->c);\n//    TEST_ASSERT_FALSE(13.1 == 9.9);\n//\n//    t = simple_cache_get(0, 15, &tripple_cache_handler);\n//    TEST_ASSERT_EQUAL(NULL, t);\n//\n//    simple_cache_destroy();\n//\n//    remove(\"tmp.one.idx\");\n//    remove(\"tmp.two.idx\");\n//    remove(\"tmp.three.idx\");\n//\n//    remove(\"tmp.one.dat\");\n//    remove(\"tmp.two.dat\");\n//    remove(\"tmp.three.dat\");\n//}\n/////}}}\n//\n////{{{ void test_simple_cache_with_disk(void)\n//void test_simple_cache_with_new_disk_order(void)\n//{\n//    char *file_names[3] = {\"tmp.one\", \"tmp.two\", \"tmp.three\"};\n//    struct simple_cache *sc = simple_cache_init(5, 3, file_names);\n//\n//    //{{{\n//    struct tripple *t = (struct tripple *)calloc(1, sizeof(struct tripple));\n//    t->a = 10;\n//    t->b = 'x';\n//    t->c = 10.1;\n//\n//    TEST_ASSERT_EQUAL(0, simple_cache_seen(0));\n//    TEST_ASSERT_EQUAL(0, simple_cache_seen(1));\n//    TEST_ASSERT_EQUAL(0, simple_cache_seen(2));\n//\n//    simple_cache_add(1, 0, t, sizeof(struct tripple), &tripple_cache_handler);\n//\n//    TEST_ASSERT_EQUAL(0, simple_cache_seen(0));\n//    TEST_ASSERT_EQUAL(1, simple_cache_seen(1));\n//    TEST_ASSERT_EQUAL(0, simple_cache_seen(2));\n//\n//    t = (struct tripple *)calloc(1, sizeof(struct tripple));\n//    t->a = 11;\n//    t->b = 'a';\n//    t->c = 11.1;\n//\n//    simple_cache_add(0, 0, t, sizeof(struct tripple), &tripple_cache_handler);\n//\n//    t = (struct tripple *)calloc(1, sizeof(struct tripple));\n//    t->a = 12;\n//    t->b = 'b';\n//    t->c = 12.1;\n//\n//    simple_cache_add(0, 1, t, sizeof(struct tripple), &tripple_cache_handler);\n//\n//    t = (struct tripple *)calloc(1, sizeof(struct tripple));\n//    t->a = 13;\n//    t->b = 'c';\n//    t->c = 13.1;\n//\n//    simple_cache_add(0, 2, t, sizeof(struct tripple), &tripple_cache_handler);\n//    //}}}\n//\n//    uint32_t new_order[3] = {1,2,0};\n//    simple_cache_store(0, new_order);\n//    simple_cache_store(1, NULL);\n//    simple_cache_store(2, NULL);\n//\n//    simple_cache_destroy();\n//\n//    sc = simple_cache_init(5, 3, file_names);\n//\n//    TEST_ASSERT_EQUAL(3, simple_cache_seen(0));\n//    TEST_ASSERT_EQUAL(1, simple_cache_seen(1));\n//    TEST_ASSERT_EQUAL(0, simple_cache_seen(2));\n//\n//    //t = simple_cache_get(sc, 0, 0, &tripple_cache_handler);\n//    t = simple_cache_get(0, 2, &tripple_cache_handler);\n//    TEST_ASSERT_EQUAL(11, t->a);\n//    TEST_ASSERT_EQUAL('a', t->b);\n//    TEST_ASSERT_EQUAL_FLOAT(11.1 , t->c);\n//\n//    //t = simple_cache_get(sc, 0, 1, &tripple_cache_handler);\n//    t = simple_cache_get(0, 0, &tripple_cache_handler);\n//    TEST_ASSERT_EQUAL(12, t->a);\n//    TEST_ASSERT_EQUAL('b', t->b);\n//    TEST_ASSERT_EQUAL_FLOAT(12.1 , t->c);\n//\n//    //t = simple_cache_get(sc, 0, 2, &tripple_cache_handler);\n//    t = simple_cache_get(0, 1, &tripple_cache_handler);\n//    TEST_ASSERT_EQUAL(13, t->a);\n//    TEST_ASSERT_EQUAL('c', t->b);\n//    TEST_ASSERT_EQUAL_FLOAT(13.1 , t->c);\n//    TEST_ASSERT_FALSE(13.1 == 9.9);\n//\n//    t = simple_cache_get(0, 15, &tripple_cache_handler);\n//    TEST_ASSERT_EQUAL(NULL, t);\n//\n//    simple_cache_destroy();\n//\n//    remove(\"tmp.one.idx\");\n//    remove(\"tmp.two.idx\");\n//    remove(\"tmp.three.idx\");\n//\n//    remove(\"tmp.one.dat\");\n//    remove(\"tmp.two.dat\");\n//    remove(\"tmp.three.dat\");\n//}\n/////}}}\n//\n////{{{ void test_simple_cache_with_disk(void)\n//void test_simple_cache_as_cache_with_new_disk_order(void)\n//{\n//    char *file_names[3] = {\"tmp.one\", \"tmp.two\", \"tmp.three\"};\n//    struct simple_cache *sc = simple_cache_init(5, 3, file_names);\n//\n//    //{{{\n//    struct tripple *t = (struct tripple *)calloc(1, sizeof(struct tripple));\n//    t->a = 10;\n//    t->b = 'x';\n//    t->c = 10.1;\n//\n//    TEST_ASSERT_EQUAL(0, cache.seen(0));\n//    TEST_ASSERT_EQUAL(0, cache.seen(1));\n//    TEST_ASSERT_EQUAL(0, cache.seen(2));\n//\n//    cache.add(1, 0, t, sizeof(struct tripple), &tripple_cache_handler);\n//\n//    TEST_ASSERT_EQUAL(0, cache.seen(0));\n//    TEST_ASSERT_EQUAL(1, cache.seen(1));\n//    TEST_ASSERT_EQUAL(0, cache.seen(2));\n//\n//    t = (struct tripple *)calloc(1, sizeof(struct tripple));\n//    t->a = 11;\n//    t->b = 'a';\n//    t->c = 11.1;\n//\n//    cache.add(0, 0, t, sizeof(struct tripple), &tripple_cache_handler);\n//\n//    t = (struct tripple *)calloc(1, sizeof(struct tripple));\n//    t->a = 12;\n//    t->b = 'b';\n//    t->c = 12.1;\n//\n//    cache.add(0, 1, t, sizeof(struct tripple),  &tripple_cache_handler);\n//\n//    t = (struct tripple *)calloc(1, sizeof(struct tripple));\n//    t->a = 13;\n//    t->b = 'c';\n//    t->c = 13.1;\n//\n//    cache.add(0, 2, t, sizeof(struct tripple),  &tripple_cache_handler);\n//    //}}}\n//\n//    uint32_t new_order[3] = {1,2,0};\n//    cache.store(0, new_order);\n//    cache.store(1, NULL);\n//    cache.store(2, NULL);\n//\n//    cache.destroy();\n//\n//    sc = simple_cache_init(5, 3, file_names);\n//\n//    TEST_ASSERT_EQUAL(3, cache.seen(0));\n//    TEST_ASSERT_EQUAL(1, cache.seen(1));\n//    TEST_ASSERT_EQUAL(0, cache.seen(2));\n//\n//    //t = simple_cache_get(sc, 0, 0, &tripple_cache_handler);\n//    t = cache.get(0, 2, &tripple_cache_handler);\n//    TEST_ASSERT_EQUAL(11, t->a);\n//    TEST_ASSERT_EQUAL('a', t->b);\n//    TEST_ASSERT_EQUAL_FLOAT(11.1 , t->c);\n//\n//    //t = simple_cache_get(sc, 0, 1, &tripple_cache_handler);\n//    t = cache.get(0, 0, &tripple_cache_handler);\n//    TEST_ASSERT_EQUAL(12, t->a);\n//    TEST_ASSERT_EQUAL('b', t->b);\n//    TEST_ASSERT_EQUAL_FLOAT(12.1 , t->c);\n//\n//    //t = simple_cache_get(sc, 0, 2, &tripple_cache_handler);\n//    t = cache.get(0, 1, &tripple_cache_handler);\n//    TEST_ASSERT_EQUAL(13, t->a);\n//    TEST_ASSERT_EQUAL('c', t->b);\n//    TEST_ASSERT_EQUAL_FLOAT(13.1 , t->c);\n//    TEST_ASSERT_FALSE(13.1 == 9.9);\n//\n//    t = cache.get(0, 15, &tripple_cache_handler);\n//    TEST_ASSERT_EQUAL(NULL, t);\n//\n//    cache.destroy();\n//\n//    remove(\"tmp.one.idx\");\n//    remove(\"tmp.two.idx\");\n//    remove(\"tmp.three.idx\");\n//\n//    remove(\"tmp.one.dat\");\n//    remove(\"tmp.two.dat\");\n//    remove(\"tmp.three.dat\");\n//}\n/////}}}\n"
  },
  {
    "path": "test/unit/test_disk_store.c",
    "content": "#include <stdio.h>\n#include <stdlib.h>\n#include <math.h>\n#include <stdio.h>\n#include <inttypes.h>\n#include <string.h>\n\n#include \"unity.h\"\n#include \"disk_store.h\"\n\nvoid setUp(void) { }\nvoid tearDown(void) { }\n\nvoid test_disk_store(void)\n{\n    char *index_file_name = \"test_disk_store.idx\";\n    char *data_file_name = \"test_disk_store.dat\";\n    FILE *index_f = NULL;\n    FILE *data_f = NULL;\n    struct disk_store *ds = disk_store_init(10,\n                                            &index_f,\n                                            index_file_name,\n                                            &data_f,\n                                            data_file_name);\n\n    TEST_ASSERT_EQUAL(0, ds->num);\n    TEST_ASSERT_EQUAL(10, ds->size);\n\n    uint32_t V[11] = {2,4,6,8,10,12,14,16,18,20,22}; \n\n    uint32_t id = disk_store_append(ds, V, sizeof(uint32_t));\n    TEST_ASSERT_EQUAL(0, id);\n\n    id = disk_store_append(ds, V+1, sizeof(uint32_t));\n    TEST_ASSERT_EQUAL(1, id);\n\n    id = disk_store_append(ds, V+2, sizeof(uint32_t));\n    TEST_ASSERT_EQUAL(2, id);\n\n    disk_store_destroy(&ds);\n    TEST_ASSERT_EQUAL(NULL, ds);\n\n    index_f = NULL;\n    data_f = NULL;\n\n    ds = disk_store_load(&index_f,\n                         index_file_name,\n                         &data_f,\n                         data_file_name);\n\n\n    TEST_ASSERT_EQUAL(3, ds->num);\n    TEST_ASSERT_EQUAL(10, ds->size);\n\n    uint64_t size;\n\n    uint32_t *v = disk_store_get(ds, 2, &size);\n    TEST_ASSERT_EQUAL(V[2], *v);\n    TEST_ASSERT_EQUAL(sizeof(uint32_t), size);\n\n    id = disk_store_append(ds, V+3, sizeof(uint32_t));\n    TEST_ASSERT_EQUAL(3, id);\n\n    id = disk_store_append(ds, V+4, sizeof(uint32_t));\n    TEST_ASSERT_EQUAL(4, id);\n\n    id = disk_store_append(ds, V+5, sizeof(uint32_t));\n    id = disk_store_append(ds, V+6, sizeof(uint32_t));\n    id = disk_store_append(ds, V+7, sizeof(uint32_t));\n    id = disk_store_append(ds, V+8, sizeof(uint32_t));\n    id = disk_store_append(ds, V+9, sizeof(uint32_t));\n    id = disk_store_append(ds, V+10, sizeof(uint32_t));\n\n    disk_store_destroy(&ds);\n\n    index_f = NULL;\n    data_f = NULL;\n\n    ds = disk_store_load(&index_f,\n                         index_file_name,\n                         &data_f,\n                         data_file_name);\n\n\n    TEST_ASSERT_EQUAL(11, ds->num);\n    TEST_ASSERT_EQUAL(20, ds->size);\n\n    free(v);\n\n    v = disk_store_get(ds, 3, &size);\n    TEST_ASSERT_EQUAL(V[3], *v);\n    TEST_ASSERT_EQUAL(sizeof(uint32_t), size);\n\n    free(v);\n\n    v = disk_store_get(ds, 1, &size);\n    TEST_ASSERT_EQUAL(V[1], *v);\n    TEST_ASSERT_EQUAL(sizeof(uint32_t), size);\n\n    v = disk_store_get(ds, 10, &size);\n    TEST_ASSERT_EQUAL(V[10], *v);\n    TEST_ASSERT_EQUAL(sizeof(uint32_t), size);\n\n    disk_store_destroy(&ds);\n    free(v);\n\n    remove(index_file_name);\n    remove(data_file_name);\n}\n"
  },
  {
    "path": "test/unit/test_file_read.c",
    "content": "#include <stdio.h>\n#include <stdlib.h>\n#include <math.h>\n#include <stdio.h>\n#include <inttypes.h>\n#include <string.h>\n#include <htslib/bgzf.h>\n#include <htslib/tbx.h>\n#include <htslib/kstring.h>\n\n#include \"unity.h\"\n#include \"bpt.h\"\n#include \"giggle_index.h\"\n#include \"file_read.h\"\n#include \"lists.h\"\n\nvoid setUp(void) { }\nvoid tearDown(void) { }\n\n//{{{void test_init_file(void)\nvoid test_init_file(void)\n{\n    struct input_file *i = input_file_init(\"../data/1k.sort.bed.gz\");\n    TEST_ASSERT_NOT_NULL(i);\n    input_file_destroy(&i);\n    TEST_ASSERT_NULL(i);\n\n    i = input_file_init(\"../data/1k.vcf\");\n    TEST_ASSERT_NULL(i);\n\n    i = input_file_init(\"../data/bad.bed.gz\");\n    TEST_ASSERT_NULL(i);\n}\n//}}}\n\n//{{{void test_bed_file_read(void)\nvoid test_bed_file_read(void)\n{\n\n    struct input_file *i = input_file_init(\"../data/1k.unsort.bed.gz\");\n\n    int chrm_len = 10;\n    char *chrm = (char *)malloc(chrm_len*sizeof(char));\n    uint32_t start, end;\n    long offset;\n    kstring_t line = { 0, 0, NULL };\n\n    char *chrm_A[10] = {\n        \"11\",\n        \"11\",  \n        \"10\",  \n        \"16\",  \n        \"15\",  \n        \"19\",  \n        \"19\",  \n        \"18\",  \n        \"21\",  \n        \"7\"};\n\n    uint32_t start_A[10] = {64691252,\n        129871988,\n        74031859, \n        3070038,\n        93346819,  \n        4374094,\n        42805980,\n        3602738,\n        9825304,\n        2393484};\n\n\n    uint32_t end_A[10] = {64692359,\n        129873775,\n        74037598,\n        3072761,\n        93347932,\n        4376369,\n        42807400,\n        3605403,\n        9827741,\n        2394629};\n\n    int j;\n    for (j = 0; j < 10; ++j) {\n        int ret = i->input_file_get_next_interval(i,\n                                                  &chrm,\n                                                  &chrm_len,\n                                                  &start,\n                                                  &end,\n                                                  &offset,\n                                                  &line);\n        TEST_ASSERT_EQUAL(0,strcmp(chrm_A[j], chrm));\n        TEST_ASSERT_EQUAL(start_A[j], start);\n        TEST_ASSERT_EQUAL(end_A[j], end);\n    }\n\n    while (i->input_file_get_next_interval(i,\n                                           &chrm,\n                                           &chrm_len,\n                                           &start,\n                                           &end,\n                                           &offset,\n                                           &line) >= 0) {\n        ++j;\n    }\n\n    if (line.s != NULL)\n        free(line.s);\n\n    TEST_ASSERT_EQUAL(0,strcmp(\"1\", chrm));\n    TEST_ASSERT_EQUAL(25895359, start);\n    TEST_ASSERT_EQUAL(25896171, end);\n\n    TEST_ASSERT_EQUAL(1000, j);\n\n    input_file_destroy(&i);\n}\n//}}}\n\n//{{{void test_get_file_stats(void)\nvoid test_get_file_stats(void)\n{\n\n    struct input_file *i = input_file_init(\"../data/1k.unsort.bed.gz\");\n    struct unordered_list *file_index = unordered_list_init(1);\n\n\n    struct file_data *fd = (struct file_data *)\n        calloc(1, sizeof(struct file_data));\n\n    uint32_t file_id = unordered_list_add(file_index, fd);\n\n    fd->file_name = strdup(\"../data/1k.unsort.bed.gz\");\n    fd->num_intervals = 0;\n    fd->mean_interval_size = 0;\n\n    int chrm_len = 10;\n    char *chrm = (char *)malloc(chrm_len*sizeof(char));\n    uint32_t start, end;\n    long offset;\n    kstring_t line = { 0, 0, NULL };\n\n    uint32_t j = 0;\n\n    struct file_id_offset_pair *p;\n    uint32_t intrv_id;\n\n    while (i->input_file_get_next_interval(i,\n                                           &chrm,\n                                           &chrm_len,\n                                           &start,\n                                           &end,\n                                           &offset,\n                                           &line) >= 0) {\n        fd->mean_interval_size += end-start;\n        fd->num_intervals += 1;\n    }\n\n    fd->mean_interval_size = fd->mean_interval_size/fd->num_intervals;\n    input_file_destroy(&i);\n    free(chrm);\n\n    if (line.s != NULL)\n        free(line.s);\n\n    char *out_file_name = \"test_file_data_read_write.tmp\";\n\n    FILE *f = fopen(out_file_name, \"wb\");\n    unordered_list_store(file_index, f, out_file_name, file_data_store);\n    fclose(f);\n\n    f = fopen(out_file_name, \"rb\");\n    struct unordered_list *file_index_r = \n        unordered_list_load(f,\n                            out_file_name,\n                            file_data_load);\n\n    struct file_data *fd_r = (struct file_data *)\n            unordered_list_get(file_index_r, file_id);\n\n    TEST_ASSERT_EQUAL(0, strcmp(fd->file_name, fd_r->file_name));\n    TEST_ASSERT_EQUAL(fd->num_intervals, fd_r->num_intervals);\n    TEST_ASSERT_EQUAL(fd->mean_interval_size, fd_r->mean_interval_size);\n\n    unordered_list_destroy(&file_index, file_data_free);\n    unordered_list_destroy(&file_index_r, file_data_free);\n\n    remove(out_file_name);\n}\n//}}}\n\n//{{{void test_get_file_stats(void)\nvoid test_input_file_get_next_interval_vcf(void)\n{\n    struct input_file *i = input_file_init(\"../data/1k.vcf.gz\");\n    int chrm_len = 10;\n    char *chrm = (char *)malloc(chrm_len*sizeof(char));\n    uint32_t start, end;\n    long offset;\n    kstring_t line = { 0, 0, NULL };\n    \n    //{{{ chrms\n    char *chrms[1000]={\"1\",\"1\",\"1\",\"1\",\"1\",\"1\",\"1\",\"1\",\"1\",\"1\",\"1\",\"1\",\"1\",\"1\",\"1\",\"1\",\"1\",\"1\",\"1\",\"1\",\"1\",\"1\",\"1\",\"1\",\"1\",\"1\",\"1\",\"1\",\"1\",\"1\",\"1\",\"1\",\"1\",\"1\",\"1\",\"1\",\"1\",\"1\",\"1\",\"1\",\"1\",\"1\",\"1\",\"1\",\"1\",\"1\",\"1\",\"1\",\"1\",\"1\",\"1\",\"1\",\"1\",\"1\",\"1\",\"1\",\"1\",\"1\",\"1\",\"1\",\"1\",\"1\",\"1\",\"10\",\"10\",\"10\",\"10\",\"10\",\"10\",\"10\",\"10\",\"10\",\"10\",\"10\",\"10\",\"10\",\"10\",\"10\",\"10\",\"10\",\"10\",\"10\",\"10\",\"10\",\"10\",\"10\",\"10\",\"10\",\"10\",\"10\",\"10\",\"10\",\"10\",\"10\",\"10\",\"10\",\"10\",\"10\",\"10\",\"10\",\"10\",\"10\",\"10\",\"10\",\"10\",\"10\",\"10\",\"10\",\"10\",\"10\",\"10\",\"10\",\"10\",\"11\",\"11\",\"11\",\"11\",\"11\",\"11\",\"11\",\"11\",\"11\",\"11\",\"11\",\"11\",\"11\",\"11\",\"11\",\"11\",\"11\",\"11\",\"11\",\"11\",\"11\",\"11\",\"11\",\"11\",\"11\",\"11\",\"11\",\"11\",\"11\",\"11\",\"11\",\"11\",\"11\",\"11\",\"11\",\"11\",\"11\",\"11\",\"11\",\"11\",\"11\",\"11\",\"11\",\"11\",\"11\",\"11\",\"11\",\"11\",\"11\",\"11\",\"11\",\"11\",\"11\",\"11\",\"11\",\"12\",\"12\",\"12\",\"12\",\"12\",\"12\",\"12\",\"12\",\"12\",\"12\",\"12\",\"12\",\"12\",\"12\",\"12\",\"12\",\"12\",\"12\",\"12\",\"12\",\"12\",\"12\",\"12\",\"12\",\"12\",\"12\",\"12\",\"12\",\"12\",\"12\",\"12\",\"12\",\"12\",\"12\",\"12\",\"12\",\"12\",\"12\",\"12\",\"12\",\"12\",\"13\",\"13\",\"13\",\"13\",\"13\",\"13\",\"13\",\"13\",\"13\",\"13\",\"13\",\"13\",\"13\",\"13\",\"13\",\"13\",\"13\",\"13\",\"13\",\"13\",\"13\",\"13\",\"13\",\"13\",\"13\",\"13\",\"13\",\"13\",\"13\",\"13\",\"13\",\"13\",\"13\",\"13\",\"13\",\"13\",\"14\",\"14\",\"14\",\"14\",\"14\",\"14\",\"14\",\"14\",\"14\",\"14\",\"14\",\"14\",\"14\",\"14\",\"14\",\"14\",\"14\",\"14\",\"14\",\"14\",\"14\",\"14\",\"14\",\"14\",\"14\",\"14\",\"15\",\"15\",\"15\",\"15\",\"15\",\"15\",\"15\",\"15\",\"15\",\"15\",\"15\",\"15\",\"15\",\"15\",\"15\",\"15\",\"15\",\"15\",\"15\",\"15\",\"15\",\"15\",\"15\",\"15\",\"15\",\"16\",\"16\",\"16\",\"16\",\"16\",\"16\",\"16\",\"16\",\"16\",\"16\",\"16\",\"16\",\"16\",\"16\",\"16\",\"16\",\"16\",\"16\",\"16\",\"16\",\"16\",\"16\",\"16\",\"16\",\"16\",\"16\",\"16\",\"16\",\"16\",\"16\",\"17\",\"17\",\"17\",\"17\",\"17\",\"17\",\"17\",\"17\",\"17\",\"17\",\"17\",\"17\",\"17\",\"17\",\"17\",\"17\",\"17\",\"17\",\"17\",\"17\",\"17\",\"17\",\"17\",\"17\",\"17\",\"17\",\"18\",\"18\",\"18\",\"18\",\"18\",\"18\",\"18\",\"18\",\"18\",\"18\",\"18\",\"18\",\"18\",\"18\",\"18\",\"18\",\"18\",\"18\",\"18\",\"18\",\"18\",\"18\",\"18\",\"18\",\"18\",\"18\",\"19\",\"19\",\"19\",\"19\",\"19\",\"19\",\"19\",\"19\",\"19\",\"19\",\"19\",\"19\",\"19\",\"19\",\"19\",\"19\",\"19\",\"19\",\"19\",\"19\",\"19\",\"19\",\"19\",\"19\",\"19\",\"19\",\"19\",\"19\",\"2\",\"2\",\"2\",\"2\",\"2\",\"2\",\"2\",\"2\",\"2\",\"2\",\"2\",\"2\",\"2\",\"2\",\"2\",\"2\",\"2\",\"2\",\"2\",\"2\",\"2\",\"2\",\"2\",\"2\",\"2\",\"2\",\"2\",\"2\",\"2\",\"2\",\"2\",\"2\",\"2\",\"2\",\"2\",\"2\",\"2\",\"2\",\"2\",\"2\",\"2\",\"2\",\"2\",\"2\",\"2\",\"2\",\"2\",\"2\",\"2\",\"2\",\"2\",\"2\",\"2\",\"2\",\"2\",\"2\",\"2\",\"2\",\"2\",\"2\",\"2\",\"2\",\"2\",\"2\",\"2\",\"2\",\"2\",\"2\",\"2\",\"2\",\"2\",\"2\",\"20\",\"20\",\"20\",\"20\",\"20\",\"20\",\"20\",\"20\",\"20\",\"20\",\"20\",\"20\",\"20\",\"20\",\"20\",\"20\",\"20\",\"20\",\"20\",\"21\",\"21\",\"21\",\"21\",\"21\",\"21\",\"21\",\"21\",\"21\",\"21\",\"21\",\"21\",\"21\",\"21\",\"22\",\"22\",\"22\",\"22\",\"22\",\"22\",\"22\",\"22\",\"22\",\"22\",\"22\",\"22\",\"22\",\"22\",\"3\",\"3\",\"3\",\"3\",\"3\",\"3\",\"3\",\"3\",\"3\",\"3\",\"3\",\"3\",\"3\",\"3\",\"3\",\"3\",\"3\",\"3\",\"3\",\"3\",\"3\",\"3\",\"3\",\"3\",\"3\",\"3\",\"3\",\"3\",\"3\",\"3\",\"3\",\"3\",\"3\",\"3\",\"3\",\"3\",\"3\",\"3\",\"3\",\"3\",\"3\",\"3\",\"3\",\"3\",\"3\",\"3\",\"3\",\"3\",\"3\",\"3\",\"3\",\"3\",\"3\",\"3\",\"3\",\"3\",\"3\",\"3\",\"3\",\"3\",\"3\",\"3\",\"3\",\"3\",\"3\",\"3\",\"3\",\"3\",\"3\",\"3\",\"3\",\"3\",\"3\",\"4\",\"4\",\"4\",\"4\",\"4\",\"4\",\"4\",\"4\",\"4\",\"4\",\"4\",\"4\",\"4\",\"4\",\"4\",\"4\",\"4\",\"4\",\"4\",\"4\",\"4\",\"4\",\"4\",\"4\",\"4\",\"4\",\"4\",\"4\",\"4\",\"4\",\"4\",\"4\",\"4\",\"4\",\"4\",\"4\",\"4\",\"4\",\"4\",\"4\",\"4\",\"4\",\"4\",\"4\",\"4\",\"4\",\"4\",\"4\",\"4\",\"4\",\"4\",\"4\",\"4\",\"4\",\"4\",\"4\",\"4\",\"4\",\"4\",\"4\",\"4\",\"4\",\"4\",\"4\",\"4\",\"4\",\"4\",\"4\",\"4\",\"4\",\"4\",\"4\",\"4\",\"5\",\"5\",\"5\",\"5\",\"5\",\"5\",\"5\",\"5\",\"5\",\"5\",\"5\",\"5\",\"5\",\"5\",\"5\",\"5\",\"5\",\"5\",\"5\",\"5\",\"5\",\"5\",\"5\",\"5\",\"5\",\"5\",\"5\",\"5\",\"5\",\"5\",\"5\",\"5\",\"5\",\"5\",\"5\",\"5\",\"5\",\"5\",\"5\",\"5\",\"5\",\"5\",\"5\",\"5\",\"5\",\"5\",\"5\",\"5\",\"5\",\"5\",\"5\",\"5\",\"5\",\"5\",\"5\",\"5\",\"5\",\"5\",\"5\",\"5\",\"5\",\"5\",\"5\",\"5\",\"5\",\"5\",\"6\",\"6\",\"6\",\"6\",\"6\",\"6\",\"6\",\"6\",\"6\",\"6\",\"6\",\"6\",\"6\",\"6\",\"6\",\"6\",\"6\",\"6\",\"6\",\"6\",\"6\",\"6\",\"6\",\"6\",\"6\",\"6\",\"6\",\"6\",\"6\",\"6\",\"6\",\"6\",\"6\",\"6\",\"6\",\"6\",\"6\",\"6\",\"6\",\"6\",\"6\",\"6\",\"6\",\"6\",\"6\",\"6\",\"6\",\"6\",\"6\",\"6\",\"6\",\"6\",\"6\",\"6\",\"6\",\"6\",\"6\",\"6\",\"6\",\"6\",\"6\",\"6\",\"6\",\"6\",\"6\",\"6\",\"6\",\"6\",\"6\",\"6\",\"6\",\"7\",\"7\",\"7\",\"7\",\"7\",\"7\",\"7\",\"7\",\"7\",\"7\",\"7\",\"7\",\"7\",\"7\",\"7\",\"7\",\"7\",\"7\",\"7\",\"7\",\"7\",\"7\",\"7\",\"7\",\"7\",\"7\",\"7\",\"7\",\"7\",\"7\",\"7\",\"7\",\"7\",\"7\",\"7\",\"7\",\"7\",\"7\",\"7\",\"7\",\"7\",\"7\",\"7\",\"7\",\"7\",\"7\",\"7\",\"7\",\"7\",\"7\",\"7\",\"7\",\"7\",\"7\",\"7\",\"7\",\"7\",\"7\",\"7\",\"7\",\"7\",\"7\",\"7\",\"8\",\"8\",\"8\",\"8\",\"8\",\"8\",\"8\",\"8\",\"8\",\"8\",\"8\",\"8\",\"8\",\"8\",\"8\",\"8\",\"8\",\"8\",\"8\",\"8\",\"8\",\"8\",\"8\",\"8\",\"8\",\"8\",\"8\",\"8\",\"8\",\"8\",\"8\",\"8\",\"8\",\"8\",\"8\",\"8\",\"8\",\"8\",\"8\",\"8\",\"8\",\"8\",\"8\",\"8\",\"8\",\"8\",\"8\",\"8\",\"8\",\"8\",\"9\",\"9\",\"9\",\"9\",\"9\",\"9\",\"9\",\"9\",\"9\",\"9\",\"9\",\"9\",\"9\",\"9\",\"9\",\"9\",\"9\",\"9\",\"9\",\"9\",\"9\",\"9\",\"9\",\"9\",\"9\",\"9\",\"9\",\"9\",\"9\",\"9\",\"9\",\"9\",\"9\",\"9\",\"9\",\"9\",\"9\",\"9\",\"9\",\"9\",\"9\",\"9\",\"X\",\"X\",\"X\",\"X\",\"X\",\"X\",\"X\",\"X\",\"X\",\"X\",\"X\",\"X\",\"X\",\"X\",\"X\",\"X\",\"X\",\"X\",\"X\",\"X\",\"X\",\"X\",\"X\",\"X\",\"X\",\"X\",\"X\",\"X\",\"X\",\"X\",\"X\",\"X\",\"X\",\"X\",\"X\",\"X\",\"X\"};\n   //}}} \n   //{{{ starts\n    uint32_t starts[1000] = {1058898,9891824,11607635,14731108,17413149,22113048,28445925,31155603,31633156,34817842,47545813,50912662,53933585,59753427,63223646,64388047,64846773,70487141,72507513,75301685,77166921,80116488,81194341,93205828,94288372,99404771,101770067,103073101,104668206,110058198,111896187,115680818,120386838,153831851,159036297,162052665,163772800,170742233,172527329,173798014,174219098,176081402,177277056,186965858,188023767,188374208,189059819,190248809,193512331,194367496,198236233,215261384,216308287,218245628,229068064,231049189,231717173,234646607,238336076,242861579,246846330,247187956,247871833,354142,1631165,3218373,4825556,9297262,13056261,18831144,19791535,24604563,36649048,37731342,43041974,43250102,43720457,45663886,47531022,49459799,52271499,53869343,57890605,60450369,64233382,65509251,68033133,68298642,69994906,70559435,70775484,71738863,75373798,76109720,81188158,82711762,86297495,87090585,91211188,92220504,92227511,92990090,93671516,95855325,97069414,107950652,108309058,109018220,115208219,118821189,121839321,128790325,131468415,4175301,6889178,7352462,10128391,10367939,16597563,19963012,22181956,23270716,23374654,23575840,25082526,26029428,32892058,37349716,37352341,37706142,40334351,40952004,41363517,43950895,44113507,48068629,55363154,55434292,59541303,66907276,71861980,72886065,78483680,79191627,83850404,85248525,88549082,90072278,90742122,93004313,95009985,95860319,98208909,101117472,103201280,106396490,106899852,109382481,109930919,115734370,122595306,123907903,128955746,129505215,129594561,130978554,132566389,134621447,577373,2527142,2905507,3057743,6218402,9956555,12658442,15858888,20473893,25112196,33324243,34582769,43045286,44580524,48929063,57258242,57876898,58991661,59272180,61522754,62417392,68229338,70578987,71188700,77518530,81080019,85161744,92796724,93013927,103014644,108634831,112181539,114131023,118755942,122067498,125544762,127132206,128276666,130573772,132368583,133825824,21488828,22335544,24376837,26816264,27466389,34738966,36818914,46897499,47387940,48792420,50579077,50816917,51735280,53037516,53070237,55238031,57395823,60441949,63813301,64263819,65185508,68747085,68977877,85105644,87770448,93703457,95290106,102176440,103500932,105036282,105809814,106226828,107033444,110062912,114427817,114570901,19267738,23109560,24186788,24852539,26701607,27248698,28415866,33254201,41731050,46410679,46581156,49268587,50110406,55018464,56163503,56777186,59266338,63659020,71945405,72099237,74115168,78996172,87748356,88929909,98179974,102950245,33093626,37792931,39520102,40896391,41465046,42617434,43093359,43921219,49609604,54883626,58231560,60909751,62651508,66241592,79084263,80023059,80815199,85122060,85923278,86827402,87890976,93888761,97651433,102146712,102335374,2805750,4798965,12445471,16224980,18119425,19980124,20672211,23746848,23773742,24675483,26118440,26860769,29131636,32598581,34242034,34815444,49335847,58477355,61323353,62302215,62544334,63301261,67209888,72424810,72572514,77747001,81177516,81646383,82319921,82416538,735172,2667560,5587680,8117279,13404936,13684795,13799548,13907785,16643880,18815297,19810587,19941644,26014177,32655027,36370453,36425043,36564468,39237648,58576247,61951741,64758260,68327441,72882606,73245181,79398735,80349858,2930232,8927355,9848335,11427642,22147879,25871829,26822681,28477467,31547319,33304597,35134173,36654359,38001931,38259899,49177778,54021694,61381884,63117336,63711870,63829973,63840612,69130286,71114426,75230171,75398294,77857360,1838097,3334367,4294839,5723008,7568221,12486739,16087938,16598142,17141632,20095927,20893029,30850007,33650408,35247982,38803646,40976153,42008540,42235749,43614841,43914732,44377945,44936656,50509418,53688110,55379078,56359635,58203870,58901043,416583,9138764,9326268,9950593,13010428,13200672,15295625,18306417,29577658,31288859,33684695,33738420,35387990,35575615,35760013,36619715,42981017,43197724,45331199,49492659,51009184,51687530,57977286,64399756,66157594,69958951,75092065,82500018,106399859,107876846,109142078,117566775,120295135,121664281,125084981,126492082,130776292,132135680,134765891,136793791,142104875,144058559,147611519,151471011,151588795,152668671,153459801,155467043,156151388,159282425,160562439,162375857,175169143,175396175,176593166,184270204,187578729,192971491,194833626,197018239,208888030,213166437,214731322,214914070,223276392,223465169,227017557,231464217,232043284,236451182,242860574,242945463,3177122,6106074,8816504,11517265,12283936,14284633,14767973,16662596,18299515,25901200,32303439,34169372,34375782,35891595,40938745,43905837,44176926,48405202,60457179,10743283,15652867,18240956,23084711,23188291,28938926,29738561,32679907,38697425,39911588,41429498,42122568,42643165,42912650,17879447,20031029,21808907,24345244,25039839,34637302,35295144,36533738,39722262,42131041,43149375,46571423,49450272,50776029,284497,1416184,2615802,4142356,7399980,10236433,11812297,12900595,22298906,22657589,22784929,23665536,32829405,35319301,35400053,47525818,47984926,48819039,49783822,50342965,51146512,52709837,59873181,66729532,67811367,69379826,76441314,76951798,82823758,84699412,86435057,86567681,88565701,89284630,90464913,94039131,95683164,97703864,101541078,106087197,106595372,108478641,108553846,110792496,113385980,114113249,123414855,124356994,124917388,130511413,131628715,132805127,135988567,138272277,138290101,141818266,142543018,151395580,152115721,158865258,159398003,161814423,163070374,165040860,166473229,170656754,174909270,181081073,191856085,192116289,194393490,195198396,197816320,880996,5484344,8766889,9636226,10512672,12848570,16713366,17300628,18860102,19735120,20474089,24375274,28350050,29907839,32704657,32940519,33473013,36855856,41068089,43014021,43286125,47991694,57460382,58805604,58826272,62284131,63026827,63445684,63727723,63972145,70527302,74475580,77238123,77445963,84391001,85082626,88649450,91265825,92450933,94348341,99680781,102475400,102787786,106244080,111625895,112367003,119085155,122403785,125292126,125621328,129303526,131036765,131248973,134479920,135481999,137248434,140528323,142312333,142783531,144726990,150133237,152898618,160603180,162343931,164138639,167412029,172736320,173557112,175194482,179429105,180984842,184938864,189793239,3100083,6024723,6955830,10887238,14540779,17716741,19078543,21603394,21715128,23023374,25335775,28151983,32085289,33174260,40138175,43870854,44929217,49588034,50075826,57386349,68591802,71255716,76853469,79428483,80882496,81905606,85296199,86112992,95343311,97187510,104350505,107079984,109474762,114880849,115461026,116954899,121476790,123278817,124923448,130595122,134000605,135621853,136059727,136452741,136490066,138777624,139752772,140794615,141917539,144131408,148571155,148639999,153975724,155939937,158916098,160275689,162166934,163072542,163172098,164174239,169548664,171905085,174412917,174783097,177653367,180191079,381951,1127106,3018199,4021012,4733829,5555042,8958791,9460377,11858045,11867171,11922598,19126124,21716408,23685987,30221997,32657952,32773435,36119523,37850150,46130270,46366480,49158287,49225123,49339482,53630502,57982166,62307638,62558389,63527383,68073852,68502446,69500848,74527801,74904345,75296289,77344489,79176411,80524946,81644845,89955521,92900768,95359256,95464267,95548109,95929814,98132878,104004177,111335532,123515058,126160374,126978740,132016110,134028921,135935983,137777669,140019503,140954711,144196404,148254814,149286024,150375259,159110017,161147297,162616509,162737994,163328861,164034953,167188348,167905836,169656705,170824453,2759405,3464088,3549790,5862765,5901547,8872625,9437987,10370518,14415043,16699780,18040402,18273084,23881776,28682568,28950615,30074455,34952936,38263731,39546348,45484063,46278176,48581297,49173341,53358295,62015892,62116858,66825745,67340864,76804368,76870796,78662193,79868212,89583536,96853483,98677585,100610894,102497562,105389481,107722761,109256795,110819951,112334961,114956601,117914839,119179386,119920762,123194557,124814705,125833422,125837850,127429410,131373038,135916815,137293926,138477963,140472196,145249875,149487134,152064321,152760103,153975785,155862520,157145784,1378565,9555102,10142002,10194949,13170250,14038290,14054820,15945390,16962205,18790846,19980262,22335670,40364408,41222278,41224704,43185150,48290772,49904859,53361086,54896949,56055614,56202359,56777472,60744951,66344795,67485720,81172610,84035279,86514700,91144724,95765395,98595392,99490889,102615334,115825993,119931098,122368426,124225928,124680183,128109046,132942724,134524224,135491414,138146244,138857136,139401876,142851052,143273215,144217771,145115952,508544,580857,2745926,5641637,6620055,8019345,9275047,10958051,11085275,13729936,17244100,26459832,28173353,34184349,34358871,35245174,76705629,87136114,87277833,88785808,89425514,104823082,106225448,108081061,109013694,110046494,110556445,111905883,111912272,112520099,114340596,117700491,120139492,125379135,127141244,127885509,128035129,134448979,135296997,138194124,140429553,140747614,541025,793147,828838,2162032,5361806,6338280,15839688,17556037,23384572,25333375,25889622,31811560,36512038,43886095,48127600,65067869,67827481,88368129,97278651,98111872,104070748,109730872,113253298,115208182,122977609,126852159,129525281,131744890,132221059,137350678,138508519,140957172,149551136,150997048,153820981,154314369,154386087};\n   //}}} \n    //{{{ ends\n    //}}}    \n    uint32_t j = 0;\n    while (i->input_file_get_next_interval(i,\n                                           &chrm,\n                                           &chrm_len,\n                                           &start,\n                                           &end,\n                                           &offset,\n                                           &line) >= 0) {\n        TEST_ASSERT_TRUE(strcmp(chrm,chrms[j]) == 0);\n        TEST_ASSERT_EQUAL(starts[j], start);\n        j+=1;\n    }\n\n    input_file_destroy(&i);\n    if (line.s != NULL)\n        free(line.s);\n}\n//}}}\n"
  },
  {
    "path": "test/unit/test_genetic_offset_index.c",
    "content": "#define _GNU_SOURCE\n\n#include \"util.h\"\n\n#include <stdbool.h>\n#include <stdio.h>\n#include <stdlib.h>\n#include <math.h>\n#include <stdio.h>\n#include <inttypes.h>\n#include <string.h>\n#include <err.h>\n#include <sysexits.h>\n#include <glob.h>\n#include <string.h>\n\n#include \"unity.h\"\n#include \"bpt.h\"\n#include \"giggle_index.h\"\n#include \"lists.h\"\n#include \"file_read.h\"\n#include \"wah.h\"\n#include \"ll.h\"\n#include \"jsw_avltree.h\"\n#include \"pq.h\"\n\n#define MIN(X, Y) (((X) < (Y)) ? (X) : (Y))\n#define MAX(X, Y) (((X) > (Y)) ? (X) : (Y))\n\n\nvoid setUp(void) { }\nvoid tearDown(void) { }\n\n//{{{ void test_giggle_bulk_insert(void)\nvoid test_generic_offset_index_basic(void)\n{\n}\n"
  },
  {
    "path": "test/unit/test_giggle.c",
    "content": "#define _GNU_SOURCE\n\n#include \"util.h\"\n\n#include <stdbool.h>\n#include <stdio.h>\n#include <stdlib.h>\n#include <math.h>\n#include <stdio.h>\n#include <inttypes.h>\n#include <string.h>\n#include <err.h>\n#include <sysexits.h>\n\n#include \"unity.h\"\n#include \"bpt.h\"\n#include \"giggle_index.h\"\n#include \"lists.h\"\n#include \"file_read.h\"\n#include \"wah.h\"\n#include \"ll.h\"\n\nvoid valid_giggle_index(struct giggle_index *gi);\n\nvoid setUp(void) { }\nvoid tearDown(void) { }\n\n//{{{void test_uint64_t_ll_giggle_insert(void)\nvoid test_uint64_t_ll_giggle_insert(void)\n{\n    ORDER = 4;\n    struct simple_cache *sc = simple_cache_init(5, 1, NULL);\n    uint32_t domain = 0;\n    uint64_t_ll_giggle_set_data_handler();\n    //wah_giggle_set_data_handler();\n\n    uint32_t root_id = 0;\n    uint32_t r = giggle_insert(domain, &root_id, 1, 3, 0);\n\n    // 1(SA:0),4(SE:0)\n    struct bpt_node *root = cache.get(domain,\n                                      root_id - 1,\n                                      &bpt_node_cache_handler);\n    TEST_ASSERT_EQUAL(2, BPT_NUM_KEYS(root));\n    TEST_ASSERT_EQUAL(1, BPT_KEYS(root)[0]);\n    TEST_ASSERT_EQUAL(4, BPT_KEYS(root)[1]);\n\n    r = giggle_insert(domain, &root_id, 2, 4, 1);\n\n    // 1(SA:0),2(SA:1),4(SE:0),5(SE:1)\n    root = cache.get(domain, root_id - 1, &bpt_node_cache_handler);\n    TEST_ASSERT_EQUAL(4, BPT_NUM_KEYS(root));\n    TEST_ASSERT_EQUAL(1, BPT_KEYS(root)[0]);\n    TEST_ASSERT_EQUAL(2, BPT_KEYS(root)[1]);\n    TEST_ASSERT_EQUAL(4, BPT_KEYS(root)[2]);\n    TEST_ASSERT_EQUAL(5, BPT_KEYS(root)[3]);\n\n    r = giggle_insert(domain, &root_id, 4, 6, 2);\n    // 4\n    // 1(SA:0),2(SA:1) (0 1)4(SA:2 SE:0),5(SE:1),7(SE:2)\n    root = cache.get(domain, root_id - 1, &bpt_node_cache_handler);\n    TEST_ASSERT_EQUAL(1, BPT_NUM_KEYS(root));\n    TEST_ASSERT_EQUAL(4, BPT_KEYS(root)[0]);\n\n    struct bpt_node *first_leaf = cache.get(domain,\n                                            BPT_POINTERS(root)[0] - 1,\n                                            &bpt_node_cache_handler);\n    TEST_ASSERT_EQUAL(2, BPT_NUM_KEYS(first_leaf));\n    TEST_ASSERT_EQUAL(1, BPT_KEYS(first_leaf)[0]);\n    TEST_ASSERT_EQUAL(2, BPT_KEYS(first_leaf)[1]);\n\n    struct bpt_node *second_leaf = cache.get(domain,\n                                             BPT_POINTERS(root)[1] - 1,\n                                             &bpt_node_cache_handler);\n    TEST_ASSERT_EQUAL(BPT_ID(second_leaf), BPT_NEXT(first_leaf));\n\n    TEST_ASSERT_EQUAL(3, BPT_NUM_KEYS(second_leaf));\n    TEST_ASSERT_EQUAL(4, BPT_KEYS(second_leaf)[0]);\n    TEST_ASSERT_EQUAL(5, BPT_KEYS(second_leaf)[1]);\n    TEST_ASSERT_EQUAL(7, BPT_KEYS(second_leaf)[2]);\n    TEST_ASSERT_EQUAL(0, BPT_LEADING(first_leaf));\n    TEST_ASSERT_TRUE(BPT_LEADING(second_leaf) != 0);\n\n    struct uint64_t_ll_bpt_leading_data *ld =\n            (struct uint64_t_ll_bpt_leading_data *)\n            cache.get(domain,\n                      BPT_LEADING(second_leaf) - 1,\n                      &giggle_data_handler.leading_cache_handler);\n    TEST_ASSERT_EQUAL(2, ld->B->len);\n    TEST_ASSERT_EQUAL(0, ld->B->head->val);\n    TEST_ASSERT_EQUAL(1, ld->B->head->next->val);\n\n    r = giggle_insert(domain, &root_id, 4, 5, 3);\n    // 4\n    // 1(SA:0),2(SA:1) (0 1)4(SA:2,3 SE:0),5(SE:1),6(SE:3),7(SE:2)\n    first_leaf = cache.get(domain,\n                           BPT_POINTERS(root)[0] - 1,\n                           &bpt_node_cache_handler);\n    TEST_ASSERT_EQUAL(0, BPT_LEADING(first_leaf));\n    TEST_ASSERT_EQUAL(2, BPT_NUM_KEYS(first_leaf));\n    struct uint64_t_ll_bpt_non_leading_data *nld = \n        cache.get(domain,\n                  BPT_POINTERS(first_leaf)[0] - 1,\n                  &giggle_data_handler.non_leading_cache_handler);\n    TEST_ASSERT_EQUAL(NULL, nld->SE);\n    TEST_ASSERT_EQUAL(1, nld->SA->len);\n    TEST_ASSERT_EQUAL(0, nld->SA->head->val);\n    nld = cache.get(domain,\n                    BPT_POINTERS(first_leaf)[1] - 1,\n                    &giggle_data_handler.non_leading_cache_handler);\n    TEST_ASSERT_EQUAL(NULL, nld->SE);\n    TEST_ASSERT_EQUAL(1, nld->SA->len);\n    TEST_ASSERT_EQUAL(1, nld->SA->head->val);\n\n    struct bpt_node *next_leaf = \n            cache.get(domain,\n                      BPT_NEXT(first_leaf) - 1,\n                      &bpt_node_cache_handler);\n    ld = cache.get(domain,\n                   BPT_LEADING(next_leaf) - 1,\n                   &giggle_data_handler.leading_cache_handler);\n\n    TEST_ASSERT_EQUAL(2, ld->B->len);\n    TEST_ASSERT_EQUAL(0, ld->B->head->val);\n    TEST_ASSERT_EQUAL(1, ld->B->head->next->val);\n    TEST_ASSERT_EQUAL(4, BPT_NUM_KEYS(next_leaf));\n    TEST_ASSERT_EQUAL(4, BPT_KEYS(next_leaf)[0]);\n    TEST_ASSERT_EQUAL(5, BPT_KEYS(next_leaf)[1]);\n    TEST_ASSERT_EQUAL(6, BPT_KEYS(next_leaf)[2]);\n    TEST_ASSERT_EQUAL(7, BPT_KEYS(next_leaf)[3]);\n    nld = cache.get(domain,\n                    BPT_POINTERS(next_leaf)[0] - 1,\n                    &giggle_data_handler.non_leading_cache_handler);\n    TEST_ASSERT_EQUAL(2, nld->SA->len);\n    TEST_ASSERT_EQUAL(2, nld->SA->head->val);\n    TEST_ASSERT_EQUAL(3, nld->SA->head->next->val);\n    TEST_ASSERT_EQUAL(1, nld->SE->len);\n    TEST_ASSERT_EQUAL(0, nld->SE->head->val);\n\n    nld = cache.get(domain,\n                    BPT_POINTERS(next_leaf)[1] - 1,\n                    &giggle_data_handler.non_leading_cache_handler);\n    TEST_ASSERT_EQUAL(NULL, nld->SA);\n    TEST_ASSERT_EQUAL(1, nld->SE->len);\n    TEST_ASSERT_EQUAL(1, nld->SE->head->val);\n\n    nld = cache.get(domain,\n                    BPT_POINTERS(next_leaf)[2] - 1,\n                    &giggle_data_handler.non_leading_cache_handler);\n    TEST_ASSERT_EQUAL(NULL, nld->SA);\n    TEST_ASSERT_EQUAL(1, nld->SE->len);\n    TEST_ASSERT_EQUAL(3, nld->SE->head->val);\n\n    nld = cache.get(domain,\n                    BPT_POINTERS(next_leaf)[3] - 1,\n                    &giggle_data_handler.non_leading_cache_handler);\n    TEST_ASSERT_EQUAL(NULL, nld->SA);\n    TEST_ASSERT_EQUAL(1, nld->SE->len);\n    TEST_ASSERT_EQUAL(2, nld->SE->head->val);\n\n    r = giggle_insert(domain, &root_id, 1, 6, 4);\n    // 4\n    // 1(SA:0,4),2(SA:1) (0 1 4)4(SA:2,3 SE:0),5(SE:1),6(SE:3),7(SE:2,4)\n    root = cache.get(domain,\n                     root_id - 1,\n                     &bpt_node_cache_handler);\n    first_leaf = cache.get(domain,\n                           BPT_POINTERS(root)[0] - 1,\n                           &bpt_node_cache_handler);\n    TEST_ASSERT_EQUAL(0, BPT_LEADING(first_leaf));\n    TEST_ASSERT_EQUAL(2, BPT_NUM_KEYS(first_leaf));\n\n    nld = cache.get(domain,\n                    BPT_POINTERS(first_leaf)[0] - 1,\n                    &giggle_data_handler.non_leading_cache_handler);\n    TEST_ASSERT_EQUAL(NULL, nld->SE);\n    TEST_ASSERT_EQUAL(2, nld->SA->len);\n    TEST_ASSERT_EQUAL(0, nld->SA->head->val);\n    TEST_ASSERT_EQUAL(4, nld->SA->head->next->val);\n\n    nld = cache.get(domain,\n                    BPT_POINTERS(first_leaf)[1] - 1,\n                    &giggle_data_handler.non_leading_cache_handler);\n    TEST_ASSERT_EQUAL(NULL, nld->SE);\n    TEST_ASSERT_EQUAL(1, nld->SA->len);\n    TEST_ASSERT_EQUAL(1, nld->SA->head->val);\n\n    next_leaf = cache.get(domain,\n                          BPT_NEXT(first_leaf) - 1,\n                          &bpt_node_cache_handler);\n    ld = cache.get(domain,\n                   BPT_LEADING(next_leaf) - 1,\n                   &giggle_data_handler.leading_cache_handler);\n    TEST_ASSERT_EQUAL(3, ld->B->len);\n    TEST_ASSERT_EQUAL(0, ld->B->head->val);\n    TEST_ASSERT_EQUAL(1, ld->B->head->next->val);\n    TEST_ASSERT_EQUAL(4, ld->B->head->next->next->val);\n\n    TEST_ASSERT_EQUAL(4, BPT_NUM_KEYS(next_leaf));\n    TEST_ASSERT_EQUAL(4, BPT_KEYS(next_leaf)[0]);\n    TEST_ASSERT_EQUAL(5, BPT_KEYS(next_leaf)[1]);\n    TEST_ASSERT_EQUAL(6, BPT_KEYS(next_leaf)[2]);\n    TEST_ASSERT_EQUAL(7, BPT_KEYS(next_leaf)[3]);\n\n    nld = cache.get(domain,\n                    BPT_POINTERS(next_leaf)[0] - 1,\n                    &giggle_data_handler.non_leading_cache_handler);\n    TEST_ASSERT_EQUAL(2, nld->SA->len);\n    TEST_ASSERT_EQUAL(2, nld->SA->head->val);\n    TEST_ASSERT_EQUAL(3, nld->SA->head->next->val);\n    TEST_ASSERT_EQUAL(1, nld->SE->len);\n    TEST_ASSERT_EQUAL(0, nld->SE->head->val);\n\n    nld = cache.get(domain,\n                    BPT_POINTERS(next_leaf)[1] - 1,\n                    &giggle_data_handler.non_leading_cache_handler);\n    TEST_ASSERT_EQUAL(NULL, nld->SA);\n    TEST_ASSERT_EQUAL(1, nld->SE->len);\n    TEST_ASSERT_EQUAL(1, nld->SE->head->val);\n\n    nld = cache.get(domain,\n                    BPT_POINTERS(next_leaf)[2] - 1,\n                    &giggle_data_handler.non_leading_cache_handler);\n    TEST_ASSERT_EQUAL(NULL, nld->SA);\n    TEST_ASSERT_EQUAL(1, nld->SE->len);\n    TEST_ASSERT_EQUAL(3, nld->SE->head->val);\n\n    nld = cache.get(domain,\n                    BPT_POINTERS(next_leaf)[3] - 1,\n                    &giggle_data_handler.non_leading_cache_handler);\n    TEST_ASSERT_EQUAL(NULL, nld->SA);\n    TEST_ASSERT_EQUAL(2, nld->SE->len);\n    TEST_ASSERT_EQUAL(2, nld->SE->head->val);\n    TEST_ASSERT_EQUAL(4, nld->SE->head->next->val);\n\n    r = giggle_insert(domain, &root_id, 1, 7, 5);\n    // 4,6\n    //   (NULL)    1(SA:0,4,5),2(SA:1)\n    //   (0 1 4 5) 4(SA:2,3 SE:0),5(SE:1)\n    //   (2 3 4 5) 6(SE:3),7(SE:2,4),8(SE:5)\n    root = cache.get(domain,\n                     root_id - 1,\n                     &bpt_node_cache_handler);\n    TEST_ASSERT_EQUAL(2, BPT_NUM_KEYS(root));\n    TEST_ASSERT_EQUAL(4, BPT_KEYS(root)[0]);\n    TEST_ASSERT_EQUAL(6, BPT_KEYS(root)[1]);\n    first_leaf = cache.get(domain,\n                           BPT_POINTERS(root)[0] - 1,\n                           &bpt_node_cache_handler);\n    TEST_ASSERT_EQUAL(0, BPT_LEADING(first_leaf));\n\n    next_leaf = cache.get(domain,\n                          BPT_NEXT(first_leaf) - 1,\n                          &bpt_node_cache_handler);\n    ld = cache.get(domain,\n                   BPT_LEADING(next_leaf) - 1,\n                   &giggle_data_handler.leading_cache_handler);\n    TEST_ASSERT_EQUAL(4, ld->B->len);\n    TEST_ASSERT_EQUAL(0, ld->B->head->val);\n    TEST_ASSERT_EQUAL(1, ld->B->head->next->val);\n    TEST_ASSERT_EQUAL(4, ld->B->head->next->next->val);\n    TEST_ASSERT_EQUAL(5, ld->B->head->next->next->next->val);\n\n    next_leaf = cache.get(domain,\n                          BPT_NEXT(next_leaf) - 1,\n                          &bpt_node_cache_handler);\n    ld = cache.get(domain,\n                   BPT_LEADING(next_leaf) - 1,\n                   &giggle_data_handler.leading_cache_handler);\n    TEST_ASSERT_EQUAL(4, ld->B->len);\n    TEST_ASSERT_EQUAL(4, ld->B->head->val);\n    TEST_ASSERT_EQUAL(2, ld->B->head->next->val);\n    TEST_ASSERT_EQUAL(3, ld->B->head->next->next->val);\n    TEST_ASSERT_EQUAL(5, ld->B->head->next->next->next->val);\n\n    cache.destroy();\n}\n//}}}\n\n//{{{void test_uint64_t_ll_giggle_insert(void)\nvoid test_wah_giggle_insert(void)\n{\n    uint32_t *R = NULL, R_size;\n    struct simple_cache *sc = simple_cache_init(5, 1, NULL);\n    uint32_t domain = 0;\n    wah_giggle_set_data_handler();\n\n    uint32_t root_id = 0;\n    uint32_t r = giggle_insert(domain, &root_id, 1, 3, 0);\n\n    // 1(SA:0),4(SE:0)\n    struct bpt_node *root = cache.get(domain,\n                                      root_id - 1,\n                                      &bpt_node_cache_handler);\n    TEST_ASSERT_EQUAL(2, BPT_NUM_KEYS(root));\n    TEST_ASSERT_EQUAL(1, BPT_KEYS(root)[0]);\n    TEST_ASSERT_EQUAL(4, BPT_KEYS(root)[1]);\n\n    r = giggle_insert(domain, &root_id, 2, 4, 1);\n\n    // 1(SA:0),2(SA:1),4(SE:0),5(SE:1)\n    root = cache.get(domain, root_id - 1, &bpt_node_cache_handler);\n    TEST_ASSERT_EQUAL(4, BPT_NUM_KEYS(root));\n    TEST_ASSERT_EQUAL(1, BPT_KEYS(root)[0]);\n    TEST_ASSERT_EQUAL(2, BPT_KEYS(root)[1]);\n    TEST_ASSERT_EQUAL(4, BPT_KEYS(root)[2]);\n    TEST_ASSERT_EQUAL(5, BPT_KEYS(root)[3]);\n\n    struct wah_bpt_non_leading_data *nld = \n        cache.get(domain,\n                  BPT_POINTERS(root)[0] - 1,\n                  &giggle_data_handler.non_leading_cache_handler);\n    TEST_ASSERT_EQUAL(NULL, nld->SE);\n    R_size = wah_get_ints(nld->SA, &R);\n    TEST_ASSERT_EQUAL(1, R_size);\n    TEST_ASSERT_EQUAL(0, R[0] - 1);\n    free(R);\n    R = NULL;\n\n    nld = cache.get(domain,\n                    BPT_POINTERS(root)[1] - 1,\n                    &giggle_data_handler.non_leading_cache_handler);\n    TEST_ASSERT_EQUAL(NULL, nld->SE);\n    R_size = wah_get_ints(nld->SA, &R);\n    TEST_ASSERT_EQUAL(1, R_size);\n    TEST_ASSERT_EQUAL(1, R[0] - 1);\n    free(R);\n    R = NULL;\n\n    nld = cache.get(domain,\n                    BPT_POINTERS(root)[2] - 1,\n                    &giggle_data_handler.non_leading_cache_handler);\n    TEST_ASSERT_EQUAL(NULL, nld->SA);\n    R_size = wah_get_ints(nld->SE, &R);\n    TEST_ASSERT_EQUAL(1, R_size);\n    TEST_ASSERT_EQUAL(0, R[0] - 1);\n    free(R);\n    R = NULL;\n\n    nld = cache.get(domain,\n                    BPT_POINTERS(root)[3] - 1,\n                    &giggle_data_handler.non_leading_cache_handler);\n    TEST_ASSERT_EQUAL(NULL, nld->SA);\n    R_size = wah_get_ints(nld->SE, &R);\n    TEST_ASSERT_EQUAL(1, R_size);\n    TEST_ASSERT_EQUAL(1, R[0] - 1);\n    free(R);\n    R = NULL;\n\n    r = giggle_insert(domain, &root_id, 4, 6, 2);\n    // 4\n    // 1(SA:0),2(SA:1) (0 1)4(SA:2 SE:0),5(SE:1),7(SE:2)\n    root = cache.get(domain, root_id - 1, &bpt_node_cache_handler);\n    TEST_ASSERT_EQUAL(1, BPT_NUM_KEYS(root));\n    TEST_ASSERT_EQUAL(4, BPT_KEYS(root)[0]);\n\n    struct bpt_node *first_leaf = cache.get(domain,\n                                            BPT_POINTERS(root)[0] - 1,\n                                            &bpt_node_cache_handler);\n    TEST_ASSERT_EQUAL(2, BPT_NUM_KEYS(first_leaf));\n    TEST_ASSERT_EQUAL(1, BPT_KEYS(first_leaf)[0]);\n    TEST_ASSERT_EQUAL(2, BPT_KEYS(first_leaf)[1]);\n\n    struct bpt_node *second_leaf = cache.get(domain,\n                                             BPT_POINTERS(root)[1] - 1,\n                                             &bpt_node_cache_handler);\n    TEST_ASSERT_EQUAL(BPT_ID(second_leaf), BPT_NEXT(first_leaf));\n\n    TEST_ASSERT_EQUAL(3, BPT_NUM_KEYS(second_leaf));\n    TEST_ASSERT_EQUAL(4, BPT_KEYS(second_leaf)[0]);\n    TEST_ASSERT_EQUAL(5, BPT_KEYS(second_leaf)[1]);\n    TEST_ASSERT_EQUAL(7, BPT_KEYS(second_leaf)[2]);\n    TEST_ASSERT_EQUAL(0, BPT_LEADING(first_leaf));\n    TEST_ASSERT_TRUE(BPT_LEADING(second_leaf) != 0);\n\n    struct wah_bpt_leading_data *ld =\n            (struct wah_bpt_leading_data *)\n            cache.get(domain,\n                      BPT_LEADING(second_leaf) - 1,\n                      &giggle_data_handler.leading_cache_handler);\n    R_size = wah_get_ints(ld->B, &R);\n    TEST_ASSERT_EQUAL(2, R_size);\n    TEST_ASSERT_EQUAL(0, R[0] - 1);\n    TEST_ASSERT_EQUAL(1, R[1] - 1);\n    free(R);\n    R = NULL;\n\n    r = giggle_insert(domain, &root_id, 4, 5, 3);\n    // 4\n    // 1(SA:0),2(SA:1) (0 1)4(SA:2,3 SE:0),5(SE:1),6(SE:3),7(SE:2)\n    first_leaf = cache.get(domain,\n                           BPT_POINTERS(root)[0] - 1,\n                           &bpt_node_cache_handler);\n    TEST_ASSERT_EQUAL(0, BPT_LEADING(first_leaf));\n    TEST_ASSERT_EQUAL(2, BPT_NUM_KEYS(first_leaf));\n\n    nld = cache.get(domain,\n                    BPT_POINTERS(first_leaf)[0] - 1,\n                    &giggle_data_handler.non_leading_cache_handler);\n    TEST_ASSERT_EQUAL(NULL, nld->SE);\n    R_size = wah_get_ints(nld->SA, &R);\n    TEST_ASSERT_EQUAL(1, R_size);\n    TEST_ASSERT_EQUAL(0, R[0] - 1);\n    free(R);\n    R = NULL;\n\n    nld = cache.get(domain,\n                    BPT_POINTERS(first_leaf)[1] - 1,\n                    &giggle_data_handler.non_leading_cache_handler);\n    TEST_ASSERT_EQUAL(NULL, nld->SE);\n    R_size = wah_get_ints(nld->SA, &R);\n    TEST_ASSERT_EQUAL(1, R_size);\n    TEST_ASSERT_EQUAL(1, R[0] - 1);\n    free(R);\n    R = NULL;\n\n    struct bpt_node *next_leaf = \n            cache.get(domain,\n                      BPT_NEXT(first_leaf) - 1,\n                      &bpt_node_cache_handler);\n    ld = cache.get(domain,\n                   BPT_LEADING(next_leaf) - 1,\n                   &giggle_data_handler.leading_cache_handler);\n    R_size = wah_get_ints(ld->B, &R);\n    TEST_ASSERT_EQUAL(2, R_size);\n    TEST_ASSERT_EQUAL(0, R[0] - 1);\n    TEST_ASSERT_EQUAL(1, R[1] - 1);\n    free(R);\n    R=NULL;\n    TEST_ASSERT_EQUAL(4, BPT_NUM_KEYS(next_leaf));\n    TEST_ASSERT_EQUAL(4, BPT_KEYS(next_leaf)[0]);\n    TEST_ASSERT_EQUAL(5, BPT_KEYS(next_leaf)[1]);\n    TEST_ASSERT_EQUAL(6, BPT_KEYS(next_leaf)[2]);\n    TEST_ASSERT_EQUAL(7, BPT_KEYS(next_leaf)[3]);\n\n    nld = cache.get(domain,\n                    BPT_POINTERS(next_leaf)[0] - 1,\n                    &giggle_data_handler.non_leading_cache_handler);\n    R_size = wah_get_ints(nld->SA, &R);\n    TEST_ASSERT_EQUAL(2, R_size);\n    TEST_ASSERT_EQUAL(2, R[0] - 1);\n    TEST_ASSERT_EQUAL(3, R[1] - 1);\n    free(R);\n    R = NULL;\n    R_size = wah_get_ints(nld->SE, &R);\n    TEST_ASSERT_EQUAL(1, R_size);\n    TEST_ASSERT_EQUAL(0, R[0] - 1);\n    free(R);\n    R = NULL;\n\n    nld = cache.get(domain,\n                    BPT_POINTERS(next_leaf)[1] - 1,\n                    &giggle_data_handler.non_leading_cache_handler);\n    TEST_ASSERT_EQUAL(NULL, nld->SA);\n    R_size = wah_get_ints(nld->SE, &R);\n    TEST_ASSERT_EQUAL(1, R_size);\n    TEST_ASSERT_EQUAL(1, R[0] - 1);\n    free(R);\n    R = NULL;\n\n    nld = cache.get(domain,\n                    BPT_POINTERS(next_leaf)[2] - 1,\n                    &giggle_data_handler.non_leading_cache_handler);\n    TEST_ASSERT_EQUAL(NULL, nld->SA);\n    R_size = wah_get_ints(nld->SE, &R);\n    TEST_ASSERT_EQUAL(1, R_size);\n    TEST_ASSERT_EQUAL(3, R[0] - 1);\n    free(R);\n    R = NULL;\n\n    nld = cache.get(domain,\n                    BPT_POINTERS(next_leaf)[3] - 1,\n                    &giggle_data_handler.non_leading_cache_handler);\n    TEST_ASSERT_EQUAL(NULL, nld->SA);\n    R_size = wah_get_ints(nld->SE, &R);\n    TEST_ASSERT_EQUAL(1, R_size);\n    TEST_ASSERT_EQUAL(2, R[0] - 1);\n    free(R);\n    R = NULL;\n\n    r = giggle_insert(domain, &root_id, 1, 6, 4);\n    // 4\n    // 1(SA:0,4),2(SA:1) (0 1 4)4(SA:2,3 SE:0),5(SE:1),6(SE:3),7(SE:2,4)\n    root = cache.get(domain,\n                     root_id - 1,\n                     &bpt_node_cache_handler);\n    first_leaf = cache.get(domain,\n                           BPT_POINTERS(root)[0] - 1,\n                           &bpt_node_cache_handler);\n    TEST_ASSERT_EQUAL(0, BPT_LEADING(first_leaf));\n    TEST_ASSERT_EQUAL(2, BPT_NUM_KEYS(first_leaf));\n\n    nld = cache.get(domain,\n                    BPT_POINTERS(first_leaf)[0] - 1,\n                    &giggle_data_handler.non_leading_cache_handler);\n    TEST_ASSERT_EQUAL(NULL, nld->SE);\n    R_size = wah_get_ints(nld->SA, &R);\n    TEST_ASSERT_EQUAL(2, R_size);\n    TEST_ASSERT_EQUAL(0, R[0] - 1);\n    TEST_ASSERT_EQUAL(4, R[1] - 1);\n    free(R);\n    R = NULL;\n\n    nld = cache.get(domain,\n                    BPT_POINTERS(first_leaf)[1] - 1,\n                    &giggle_data_handler.non_leading_cache_handler);\n    TEST_ASSERT_EQUAL(NULL, nld->SE);\n    R_size = wah_get_ints(nld->SA, &R);\n    TEST_ASSERT_EQUAL(1, R_size);\n    TEST_ASSERT_EQUAL(1, R[0] - 1);\n    free(R);\n    R = NULL;\n\n    next_leaf = cache.get(domain,\n                          BPT_NEXT(first_leaf) - 1,\n                          &bpt_node_cache_handler);\n    ld = cache.get(domain,\n                   BPT_LEADING(next_leaf) - 1,\n                   &giggle_data_handler.leading_cache_handler);\n    R_size = wah_get_ints(ld->B, &R);\n    TEST_ASSERT_EQUAL(3, R_size);\n    TEST_ASSERT_EQUAL(0, R[0] - 1);\n    TEST_ASSERT_EQUAL(1, R[1] - 1);\n    TEST_ASSERT_EQUAL(4, R[2] - 1);\n    free(R);\n    R = NULL;\n\n    TEST_ASSERT_EQUAL(4, BPT_NUM_KEYS(next_leaf));\n    TEST_ASSERT_EQUAL(4, BPT_KEYS(next_leaf)[0]);\n    TEST_ASSERT_EQUAL(5, BPT_KEYS(next_leaf)[1]);\n    TEST_ASSERT_EQUAL(6, BPT_KEYS(next_leaf)[2]);\n    TEST_ASSERT_EQUAL(7, BPT_KEYS(next_leaf)[3]);\n\n    nld = cache.get(domain,\n                    BPT_POINTERS(next_leaf)[0] - 1,\n                    &giggle_data_handler.non_leading_cache_handler);\n    R_size = wah_get_ints(nld->SA, &R);\n    TEST_ASSERT_EQUAL(2, R_size);\n    TEST_ASSERT_EQUAL(2, R[0] - 1);\n    TEST_ASSERT_EQUAL(3, R[1] - 1);\n    free(R);\n    R = NULL;\n    R_size = wah_get_ints(nld->SE, &R);\n    TEST_ASSERT_EQUAL(1, R_size);\n    TEST_ASSERT_EQUAL(0, R[0] - 1);\n    free(R);\n    R = NULL;\n\n    nld = cache.get(domain,\n                    BPT_POINTERS(next_leaf)[1] - 1,\n                    &giggle_data_handler.non_leading_cache_handler);\n    TEST_ASSERT_EQUAL(NULL, nld->SA);\n    R_size = wah_get_ints(nld->SE, &R);\n    TEST_ASSERT_EQUAL(1, R_size);\n    TEST_ASSERT_EQUAL(1, R[0] - 1);\n    free(R);\n    R = NULL;\n\n    nld = cache.get(domain,\n                    BPT_POINTERS(next_leaf)[2] - 1,\n                    &giggle_data_handler.non_leading_cache_handler);\n    TEST_ASSERT_EQUAL(NULL, nld->SA);\n    R_size = wah_get_ints(nld->SE, &R);\n    TEST_ASSERT_EQUAL(1, R_size);\n    TEST_ASSERT_EQUAL(3, R[0] - 1);\n    free(R);\n    R = NULL;\n\n    nld = cache.get(domain,\n                    BPT_POINTERS(next_leaf)[3] - 1,\n                    &giggle_data_handler.non_leading_cache_handler);\n    TEST_ASSERT_EQUAL(NULL, nld->SA);\n    R_size = wah_get_ints(nld->SE, &R);\n    TEST_ASSERT_EQUAL(2, R_size);\n    TEST_ASSERT_EQUAL(2, R[0] - 1);\n    TEST_ASSERT_EQUAL(4, R[1] - 1);\n    free(R);\n    R = NULL;\n\n    r = giggle_insert(domain, &root_id, 1, 7, 5);\n    // 4,6\n    //   (NULL)    1(SA:0,4,5),2(SA:1)\n    //   (0 1 4 5) 4(SA:2,3 SE:0),5(SE:1)\n    //   (2 3 4 5) 6(SE:3),7(SE:2,4),8(SE:5)\n    root = cache.get(domain,\n                     root_id - 1,\n                     &bpt_node_cache_handler);\n    TEST_ASSERT_EQUAL(2, BPT_NUM_KEYS(root));\n    TEST_ASSERT_EQUAL(4, BPT_KEYS(root)[0]);\n    TEST_ASSERT_EQUAL(6, BPT_KEYS(root)[1]);\n    first_leaf = cache.get(domain,\n                           BPT_POINTERS(root)[0] - 1,\n                           &bpt_node_cache_handler);\n    TEST_ASSERT_EQUAL(0, BPT_LEADING(first_leaf));\n\n    next_leaf = cache.get(domain,\n                          BPT_NEXT(first_leaf) - 1,\n                          &bpt_node_cache_handler);\n    ld = cache.get(domain,\n                   BPT_LEADING(next_leaf) - 1,\n                   &giggle_data_handler.leading_cache_handler);\n    R_size = wah_get_ints(ld->B, &R);\n    TEST_ASSERT_EQUAL(4, R_size);\n    TEST_ASSERT_EQUAL(0, R[0] - 1);\n    TEST_ASSERT_EQUAL(1, R[1] - 1);\n    TEST_ASSERT_EQUAL(4, R[2] - 1);\n    TEST_ASSERT_EQUAL(5, R[3] - 1);\n    free(R);\n    R = NULL;\n\n    next_leaf = cache.get(domain,\n                          BPT_NEXT(next_leaf) - 1,\n                          &bpt_node_cache_handler);\n    ld = cache.get(domain,\n                   BPT_LEADING(next_leaf) - 1,\n                   &giggle_data_handler.leading_cache_handler);\n    R_size = wah_get_ints(ld->B, &R);\n    TEST_ASSERT_EQUAL(4, R_size);\n    TEST_ASSERT_EQUAL(2, R[0] - 1);\n    TEST_ASSERT_EQUAL(3, R[1] - 1);\n    TEST_ASSERT_EQUAL(4, R[2] - 1);\n    TEST_ASSERT_EQUAL(5, R[3] - 1);\n    free(R);\n    R = NULL;\n\n    cache.destroy();\n}\n//}}}\n\n//{{{ void test_uint64_t_ll_giggle_search(void)\nvoid test_uint64_t_ll_giggle_search(void)\n{\n    ORDER = 7;\n    struct simple_cache *sc = simple_cache_init(5, 1, NULL);\n    uint32_t domain = 0;\n    uint64_t_ll_giggle_set_data_handler();\n\n    /*\n     *  1  2  3  4  5  6  7  8  9 10 11 12 13 14 15 16 17 18 19 20\n     *  |0-------------------------|  |1----|     |9------| \n     *     |2----|  |3-------|\n     *        |4-------|  |5----|     |7-------------------|\n     *                    |6------------|\n     *  |8----------------------------------------------|\n     *\n     */\n    uint32_t root_id = 0;\n\n    uint32_t r = giggle_insert(domain, &root_id, 1, 10, 0);\n    r = giggle_insert(domain, &root_id, 11, 13, 1);\n    r = giggle_insert(domain, &root_id, 2, 4, 2);\n    r = giggle_insert(domain, &root_id, 5, 8, 3);\n    r = giggle_insert(domain, &root_id, 3, 6, 4);\n    r = giggle_insert(domain, &root_id, 7, 9, 5);\n    r = giggle_insert(domain, &root_id, 7, 12, 6);\n\n    r = giggle_insert(domain, &root_id, 11, 18, 7);\n    r = giggle_insert(domain, &root_id, 1, 17, 8);\n    r = giggle_insert(domain, &root_id, 15, 18, 9);\n\n    /*\n    7 13\n      (NULL)    1(SA:0,8) 2(SA:2) 3(SA:4) 5(SA:3 SE:2) \n      (0 3 4 8) 7(SA:5,6 SE:4) 9(SE: 3) 10(SE:5) 11(SA:1,7 SE:0) \n      (8 6 1 7) 13(SE:6) 14(SE:1) 15(SA:9) 18(SE:8) 19(SE:7,9)\n    */\n#if 0\n    //{{{\n    struct bpt_node *root = cache.get(cache.cache, root_id);\n    TEST_ASSERT_EQUAL(2, root->num_keys);\n    TEST_ASSERT_EQUAL(7, root->keys[0]);\n    TEST_ASSERT_EQUAL(13, root->keys[1]);\n\n    struct bpt_node *first_leaf = (struct bpt_node *) root->pointers[0];\n    TEST_ASSERT_EQUAL(4, first_leaf->num_keys);\n    TEST_ASSERT_EQUAL(1, first_leaf->keys[0]);\n    TEST_ASSERT_EQUAL(2, first_leaf->keys[1]);\n    TEST_ASSERT_EQUAL(3, first_leaf->keys[2]);\n    TEST_ASSERT_EQUAL(5, first_leaf->keys[3]);\n\n    struct uint64_t_ll_bpt_leading_data *ld =\n            (struct uint64_t_ll_bpt_leading_data *)\n            first_leaf->leading;\n    TEST_ASSERT_EQUAL(NULL, ld);\n\n    TEST_ASSERT_EQUAL(4, first_leaf->next->num_keys);\n    TEST_ASSERT_EQUAL(7, first_leaf->next->keys[0]);\n    TEST_ASSERT_EQUAL(9, first_leaf->next->keys[1]);\n    TEST_ASSERT_EQUAL(10, first_leaf->next->keys[2]);\n    TEST_ASSERT_EQUAL(11, first_leaf->next->keys[3]);\n\n    ld = (struct uint64_t_ll_bpt_leading_data *) first_leaf->next->leading;\n    TEST_ASSERT_EQUAL(4, ld->B->len);\n    TEST_ASSERT_EQUAL(1, uint64_t_ll_contains(ld->B, 0));\n    TEST_ASSERT_EQUAL(1, uint64_t_ll_contains(ld->B, 3));\n    TEST_ASSERT_EQUAL(1, uint64_t_ll_contains(ld->B, 4));\n    TEST_ASSERT_EQUAL(1, uint64_t_ll_contains(ld->B, 8));\n\n    TEST_ASSERT_EQUAL(5, first_leaf->next->next->num_keys);\n    TEST_ASSERT_EQUAL(13, first_leaf->next->next->keys[0]);\n    TEST_ASSERT_EQUAL(14, first_leaf->next->next->keys[1]);\n    TEST_ASSERT_EQUAL(15, first_leaf->next->next->keys[2]);\n    TEST_ASSERT_EQUAL(18, first_leaf->next->next->keys[3]);\n    TEST_ASSERT_EQUAL(19, first_leaf->next->next->keys[4]);\n\n    ld = (struct uint64_t_ll_bpt_leading_data *)\n            first_leaf->next->next->leading;\n    TEST_ASSERT_EQUAL(4, ld->B->len);\n    TEST_ASSERT_EQUAL(1, uint64_t_ll_contains(ld->B, 8));\n    TEST_ASSERT_EQUAL(1, uint64_t_ll_contains(ld->B, 6));\n    TEST_ASSERT_EQUAL(1, uint64_t_ll_contains(ld->B, 1));\n    TEST_ASSERT_EQUAL(1, uint64_t_ll_contains(ld->B, 7));\n    //}}}\n#endif\n\n    /*\n     *  1  2  3  4  5  6  7  8  9 10 11 12 13 14 15 16 17 18 19 20\n     *  |0-------------------------|  |1----|     |9------| \n     *     |2----|  |3-------|\n     *        |4-------|  |5----|     |7-------------------|\n     *                    |6------------|\n     *  |8----------------------------------------------|\n     *\n     */\n\n    ///struct uint64_t_ll *R = (struct uint64_t_ll *)giggle_search(root, 2, 5);\n    //uint32_t R_id = \n    struct uint64_t_ll *R = giggle_search(domain, root_id, 2, 5);\n    \n    TEST_ASSERT_TRUE(R != NULL);\n    TEST_ASSERT_EQUAL(5, R->len);\n    TEST_ASSERT_EQUAL(1, uint64_t_ll_contains(R, 0));\n    TEST_ASSERT_EQUAL(1, uint64_t_ll_contains(R, 2));\n    TEST_ASSERT_EQUAL(1, uint64_t_ll_contains(R, 4));\n    TEST_ASSERT_EQUAL(1, uint64_t_ll_contains(R, 3));\n    TEST_ASSERT_EQUAL(1, uint64_t_ll_contains(R, 8));\n\n    uint64_t_ll_free((void **)&R);\n    R = NULL;\n\n    R = giggle_search(domain, root_id, 5, 15);\n    TEST_ASSERT_EQUAL(9, R->len);\n    TEST_ASSERT_EQUAL(1, uint64_t_ll_contains(R, 0));\n    TEST_ASSERT_EQUAL(1, uint64_t_ll_contains(R, 1));\n    TEST_ASSERT_EQUAL(1, uint64_t_ll_contains(R, 3));\n    TEST_ASSERT_EQUAL(1, uint64_t_ll_contains(R, 4));\n    TEST_ASSERT_EQUAL(1, uint64_t_ll_contains(R, 5));\n    TEST_ASSERT_EQUAL(1, uint64_t_ll_contains(R, 6));\n    TEST_ASSERT_EQUAL(1, uint64_t_ll_contains(R, 7));\n    TEST_ASSERT_EQUAL(1, uint64_t_ll_contains(R, 8));\n    TEST_ASSERT_EQUAL(1, uint64_t_ll_contains(R, 9));\n\n    uint64_t_ll_free((void **)&R);\n    R = NULL;\n\n    R = giggle_search(domain, root_id, 19, 20);\n    TEST_ASSERT_EQUAL(NULL, R);\n\n    uint64_t_ll_free((void **)&R);\n    R = NULL;\n\n    R = giggle_search(domain, root_id, 18, 20);\n    TEST_ASSERT_EQUAL(2, R->len);\n    TEST_ASSERT_EQUAL(1, uint64_t_ll_contains(R, 9));\n    TEST_ASSERT_EQUAL(1, uint64_t_ll_contains(R, 7));\n\n    uint64_t_ll_free((void **)&R);\n    R = NULL;\n\n    cache.destroy();\n}\n//}}}\n\n//{{{ void test_wah_giggle_search(void)\nvoid test_wah_giggle_search(void)\n{\n    ORDER = 7;\n    struct simple_cache *sc = simple_cache_init(5, 1, NULL);\n    uint32_t domain = 0;\n    wah_giggle_set_data_handler();\n\n    /*\n     *  1  2  3  4  5  6  7  8  9 10 11 12 13 14 15 16 17 18 19 20\n     *  |0-------------------------|  |1----|     |9------| \n     *     |2----|  |3-------|\n     *        |4-------|  |5----|     |7-------------------|\n     *                    |6------------|\n     *  |8----------------------------------------------|\n     *\n     */\n    uint32_t root_id = 0;\n\n    uint32_t r = giggle_insert(domain, &root_id, 1, 10, 0);\n    r = giggle_insert(domain, &root_id, 11, 13, 1);\n    r = giggle_insert(domain, &root_id, 2, 4, 2);\n    r = giggle_insert(domain, &root_id, 5, 8, 3);\n    r = giggle_insert(domain, &root_id, 3, 6, 4);\n    r = giggle_insert(domain, &root_id, 7, 9, 5);\n    r = giggle_insert(domain, &root_id, 7, 12, 6);\n\n    r = giggle_insert(domain, &root_id, 11, 18, 7);\n    r = giggle_insert(domain, &root_id, 1, 17, 8);\n    r = giggle_insert(domain, &root_id, 15, 18, 9);\n\n    /*\n    7 13\n      (NULL)    1(SA:0,8) 2(SA:2) 3(SA:4) 5(SA:3 SE:2) \n      (0 3 4 8) 7(SA:5,6 SE:4) 9(SE: 3) 10(SE:5) 11(SA:1,7 SE:0) \n      (8 6 1 7) 13(SE:6) 14(SE:1) 15(SA:9) 18(SE:8) 19(SE:7,9)\n    */\n\n    /*\n     *  1  2  3  4  5  6  7  8  9 10 11 12 13 14 15 16 17 18 19 20\n     *  |0-------------------------|  |1----|     |9------| \n     *     |2----|  |3-------|\n     *        |4-------|  |5----|     |7-------------------|\n     *                    |6------------|\n     *  |8----------------------------------------------|\n     *\n     */\n\n    ///struct uint64_t_ll *R = (struct uint64_t_ll *)giggle_search(root, 2, 5);\n    //uint32_t R_id = \n    uint8_t *w = giggle_search(domain, root_id, 2, 5);\n    uint32_t *R = NULL, R_size;\n    R_size = wah_get_ints(w, &R);\n    TEST_ASSERT_EQUAL(5, R_size);\n    TEST_ASSERT_EQUAL(0, R[0] - 1);\n    TEST_ASSERT_EQUAL(2, R[1] - 1);\n    TEST_ASSERT_EQUAL(3, R[2] - 1);\n    TEST_ASSERT_EQUAL(4, R[3] - 1);\n    TEST_ASSERT_EQUAL(8, R[4] - 1);\n\n    free(w);\n    w = NULL;\n    free(R);\n    R = NULL;\n\n    w = giggle_search(domain, root_id, 5, 15);\n    R_size = wah_get_ints(w, &R);\n    TEST_ASSERT_EQUAL(9, R_size);\n    TEST_ASSERT_EQUAL(0, R[0] - 1);\n    TEST_ASSERT_EQUAL(1, R[1] - 1);\n    TEST_ASSERT_EQUAL(3, R[2] - 1);\n    TEST_ASSERT_EQUAL(4, R[3] - 1);\n    TEST_ASSERT_EQUAL(5, R[4] - 1);\n    TEST_ASSERT_EQUAL(6, R[5] - 1);\n    TEST_ASSERT_EQUAL(7, R[6] - 1);\n    TEST_ASSERT_EQUAL(8, R[7] - 1);\n    TEST_ASSERT_EQUAL(9, R[8] - 1);\n\n    free(w);\n    w = NULL;\n    free(R);\n    R = NULL;\n\n    w = giggle_search(domain, root_id, 19, 20);\n    if (w != NULL) {\n        R_size = wah_get_ints(w, &R);\n        TEST_ASSERT_EQUAL(0, R_size);\n        free(R);\n        R = NULL;\n        free(w);\n        w = NULL;\n    } else {\n        TEST_ASSERT_EQUAL(NULL, w);\n    }\n\n    w = giggle_search(domain, root_id, 18, 20);\n    R_size = wah_get_ints(w, &R);\n    TEST_ASSERT_EQUAL(2, R_size);\n    TEST_ASSERT_EQUAL(7, R[0] - 1);\n    TEST_ASSERT_EQUAL(9, R[1] - 1);\n\n    free(w);\n    w = NULL;\n    free(R);\n    R = NULL;\n\n    cache.destroy();\n}\n//}}}\n\n//{{{void test_giggle_get_chrm_id(void)\nvoid test_giggle_get_chrm_id(void)\n{\n    struct giggle_index *gi = giggle_init_index(3, \"tmp_offset_index.idx\");\n    TEST_ASSERT_EQUAL(0, giggle_get_chrm_id(gi, \"chr2\"));\n    TEST_ASSERT_EQUAL(1, giggle_get_chrm_id(gi, \"chr1\"));\n    TEST_ASSERT_EQUAL(2, giggle_get_chrm_id(gi, \"chr3\"));\n    TEST_ASSERT_EQUAL(0, giggle_get_chrm_id(gi, \"chr2\"));\n\n    TEST_ASSERT_EQUAL(3, giggle_get_chrm_id(gi, \"chr9\"));\n    TEST_ASSERT_EQUAL(4, giggle_get_chrm_id(gi, \"chr8\"));\n    TEST_ASSERT_EQUAL(5, giggle_get_chrm_id(gi, \"chr7\"));\n    TEST_ASSERT_EQUAL(3, giggle_get_chrm_id(gi, \"chr9\"));\n    giggle_index_destroy(&gi);\n    remove(\"tmp_offset_index.idx\");\n}\n//}}}\n\n//{{{void test_giggle_index_file(void)\nvoid test_giggle_index_file(void)\n{\n    ORDER = 10;\n    struct simple_cache *sc = simple_cache_init(1000, 30, NULL);\n    uint64_t_ll_giggle_set_data_handler();\n    struct giggle_index *gi = giggle_init_index(30, \"tmp_offset_index.idx\");\n    char *file_name = \"../data/1k.unsort.bed.gz\";\n    uint32_t r = giggle_index_file(gi, file_name);\n\n    valid_giggle_index(gi);\n\n    TEST_ASSERT_EQUAL(1000, r);\n    //TEST_ASSERT_EQUAL(23, gi->chrm_index->num); \n    TEST_ASSERT_EQUAL(23, gi->chrm_idx->index->num); \n    TEST_ASSERT_EQUAL(23, gi->num); \n\n    uint32_t sizes[23] = {152,\n                          44,\n                          66,\n                          41,\n                          9,\n                          7,\n                          30,\n                          43,\n                          38,\n                          23,\n                          77,\n                          64,\n                          21,\n                          18,\n                          27,\n                          50,\n                          20,\n                          40,\n                          73,\n                          80,\n                          33,\n                          32,\n                          12};\n\n    char *chrms[23] = {\"1\",\n                       \"10\",\n                       \"11\",\n                       \"12\",\n                       \"13\",\n                       \"14\",\n                       \"15\",\n                       \"16\",\n                       \"17\",\n                       \"18\",\n                       \"19\",\n                       \"2\",\n                       \"20\",\n                       \"21\",\n                       \"22\",\n                       \"3\",\n                       \"4\",\n                       \"5\",\n                       \"6\",\n                       \"7\",\n                       \"8\",\n                       \"9\",\n                       \"X\"};\n    /*\n      for c in `gunzip -c 1k.unsort.bed.gz | cut -f1 | sort | uniq`\n      do \n        V=`gunzip -c 1k.unsort.bed.gz | grep -n -e \"$c\\t\" | cut -d\":\" -f1 | tr '\\n' ',' | sed -e \"s/,$//\"`\n        echo \"{$V}\"\n      done\n     */\n    uint32_t ids[23][152] = {\n        //{{{\n        {18,22,41,42,59,62,67,69,71,85,86,87,88,98,103,104,106,114,131,133,141,148,151,156,168,170,177,180,189,190,193,197,204,207,211,212,218,221,241,247,255,257,261,267,276,282,311,322,327,333,338,358,359,365,372,386,408,414,418,458,466,467,468,473,480,483,485,496,499,500,504,512,525,549,552,558,568,570,574,578,581,587,601,607,612,613,625,626,628,638,641,650,657,666,676,677,678,679,684,686,687,688,693,697,715,718,724,729,730,735,740,745,749,753,755,763,764,766,776,781,783,785,800,801,817,821,822,828,844,846,865,869,884,885,889,924,928,930,934,941,943,952,954,956,962,964,977,978,988,994,995,1000},\n        {3,27,34,76,79,92,113,130,164,215,216,222,271,272,332,390,409,425,463,486,519,569,585,593,606,611,622,645,665,669,689,696,719,748,775,780,790,853,855,871,886,898,908,998},\n        {1,2,55,90,91,117,118,128,129,144,147,217,244,290,317,323,326,341,342,347,383,394,413,435,436,514,515,521,528,540,544,551,557,573,590,619,633,639,660,682,702,709,714,731,738,746,760,765,774,804,816,833,834,837,856,858,863,868,873,874,904,912,913,950,957,973},\n        {47,70,80,107,124,145,159,205,210,228,236,253,258,288,393,398,401,410,474,481,507,531,537,554,579,584,588,635,640,670,704,712,713,727,770,805,810,887,896,925,974},\n        {56,82,158,194,396,426,809,849,909},\n        {102,198,501,516,672,705,918},\n        {5,37,100,105,196,279,382,387,400,442,487,518,526,562,572,597,621,651,708,710,761,769,778,806,824,826,857,953,965,999},\n        {4,50,64,115,127,149,152,214,225,248,259,275,281,293,310,321,357,421,424,439,491,506,547,609,767,768,795,862,870,872,878,893,905,906,911,915,919,921,935,944,975,979,996},\n        {29,43,96,123,171,191,203,226,264,302,331,335,348,349,420,438,471,510,610,627,636,658,692,758,779,789,814,851,861,892,894,916,917,923,931,971,980,989},\n        {8,30,31,73,122,140,162,200,213,251,309,336,378,490,524,527,556,637,711,784,802,907,983},\n        {6,7,25,39,48,49,61,77,78,84,108,110,116,126,136,137,160,165,166,185,232,260,270,277,294,295,303,307,313,315,325,345,350,356,368,369,370,375,381,385,419,422,443,454,457,465,475,495,548,560,577,598,618,620,630,685,690,706,716,717,737,747,771,794,808,811,812,845,859,891,926,932,947,958,960,961,968},\n        {17,51,60,68,101,142,175,178,227,234,235,252,254,274,286,287,292,296,298,314,316,339,344,353,361,397,433,445,448,451,455,523,530,539,594,596,599,608,629,642,674,681,732,742,754,757,762,807,815,818,825,847,854,875,900,901,902,914,938,948,963,966,981,986},\n        {23,35,65,157,280,389,395,403,444,494,563,567,605,673,721,725,803,850,883,903,936},\n        {9,112,181,209,324,402,411,520,536,564,643,683,759,798,835,836,929,997},\n        {28,66,81,94,150,169,238,245,273,284,304,377,392,456,502,604,698,791,793,797,820,838,839,882,895,991,992},\n        {24,54,72,83,89,93,139,153,161,163,224,230,242,243,269,283,300,328,346,362,363,367,373,406,428,434,460,470,476,479,488,497,513,517,532,534,543,580,617,649,664,680,723,788,827,880,881,942,945,949},\n        {53,58,97,167,188,352,376,431,446,522,555,589,614,632,662,703,726,751,939,951},\n        {16,21,57,121,174,195,223,233,237,285,297,312,320,329,337,355,404,437,441,477,498,505,511,535,550,583,586,694,699,734,787,823,830,840,866,876,879,959,976,984},\n        {14,15,33,36,44,74,99,135,138,143,154,172,173,182,183,184,199,202,220,265,266,268,278,306,308,330,371,374,391,412,417,427,447,452,469,472,478,509,538,541,542,545,553,566,576,582,592,603,623,644,653,668,675,700,720,728,733,736,744,752,756,772,777,799,843,848,860,877,888,940,969,970,982},\n        {10,11,12,13,26,40,46,52,63,95,109,132,134,176,179,201,208,219,231,240,250,256,299,305,318,319,334,340,351,354,360,384,388,415,416,423,449,453,459,461,462,529,533,546,559,561,565,571,575,595,600,615,631,634,648,655,656,663,695,701,722,741,773,782,792,819,829,864,890,897,910,922,927,933,946,967,972,985,990,993},\n        {19,20,32,45,75,111,120,146,186,229,262,263,364,399,430,432,450,464,482,489,493,508,591,602,616,624,647,661,667,671,739,813,867},\n        {38,119,125,155,187,192,206,246,289,291,301,366,379,380,429,440,484,492,646,659,691,743,750,796,831,832,841,842,899,937,955,987},\n        {239,249,343,405,407,503,652,654,707,786,852,920}};\n    //}}}\n\n    int j,k;\n    for (j = 0; j < 23; ++j) {\n        uint32_t i = giggle_get_chrm_id(gi, chrms[j]);\n        struct uint64_t_ll *R = (struct uint64_t_ll *)\n            giggle_search(i, gi->root_ids[i], 0, 3000000000);\n        TEST_ASSERT_EQUAL(sizes[j], R->len); \n        for (k = 0; k < R->len; ++k) {\n            TEST_ASSERT_EQUAL(1, uint64_t_ll_contains(R, ids[j][k]-1));\n        }\n        uint64_t_ll_free((void **)&R);\n    }\n\n    giggle_index_destroy(&gi);\n    cache.destroy();\n    remove(\"tmp_offset_index.idx\");\n}\n//}}}\n\n//{{{ void test_uint64_t_ll_giggle_query_region(void)\nvoid test_uint64_t_ll_giggle_query_region(void)\n{\n    ORDER = 10;\n    struct simple_cache *sc = simple_cache_init(1000, 30, NULL);\n    uint64_t_ll_giggle_set_data_handler();\n    struct giggle_index *gi = giggle_init_index(30, \"tmp_offset_index.idx\");\n    char *file_name = \"../data/1k.unsort.bed.gz\";\n    uint32_t ret = giggle_index_file(gi, file_name);\n\n    struct uint64_t_ll *R = (struct uint64_t_ll *)giggle_query_region(gi,\n                                                                      \"11\",\n                                                                      1000,\n                                                                      3000000);\n     //tabix 1k.sort.bed.gz chr11:1000-3000000\n     //chr11    575808  576604  .   1000    .   ...\n     //chr11    2950239 2952321 .   1000    .   ...\n    TEST_ASSERT_EQUAL(2, R->len);\n\n    /*\n    struct file_id_offset_pair *r = \n        (struct file_id_offset_pair *)\n        unordered_list_get(gi->offset_index, R->head->val);\n    */\n    struct file_id_offset_pair r = \n            offset_index_get(gi->offset_idx, R->head->val);\n        //gi->offset_index->vals[R->head->val];\n    struct file_data *fd = file_index_get(gi->file_idx, r.file_id);\n    struct input_file *i = input_file_init(fd->file_name);\n\n    i->input_file_seek(i, r.offset);\n\n    int chrm_len = 10;\n    char *chrm = (char *)malloc(chrm_len*sizeof(char));\n    uint32_t start, end;\n    long offset;\n    kstring_t line = {0, 0, NULL};\n            \n    int x = i->input_file_get_next_interval(i,\n                                            &chrm,\n                                            &chrm_len,\n                                            &start,\n                                            &end,\n                                            &offset,\n                                            &line);\n    \n    TEST_ASSERT_EQUAL(0, strcmp(\"11\", chrm));\n    TEST_ASSERT_EQUAL(575808, start);\n    TEST_ASSERT_EQUAL(576604, end);\n\n    \n    //r = (struct file_id_offset_pair *)\n            //unordered_list_get(gi->offset_index, R->head->next->val);\n    //r = gi->offset_index->vals[R->head->next->val];\n    r = offset_index_get(gi->offset_idx, R->head->next->val);\n    i->input_file_seek(i, r.offset);\n    x = i->input_file_get_next_interval(i,\n                                        &chrm,\n                                        &chrm_len,\n                                        &start,\n                                        &end,\n                                        &offset,\n                                        &line);\n\n    TEST_ASSERT_EQUAL(0, strcmp(\"11\", chrm));\n    TEST_ASSERT_EQUAL(2950239, start);\n    TEST_ASSERT_EQUAL(2952321, end);\n\n    uint64_t_ll_free((void **)&R);\n\n    free(chrm);\n    if (line.s != NULL)\n        free(line.s);\n    input_file_destroy(&i);\n    giggle_index_destroy(&gi);\n    cache.destroy();\n    remove(\"tmp_offset_index.idx\");\n}\n//}}}\n\n////{{{void test_giggle_query_region(void)\n//void test_wah_giggle_query_region(void)\n//{\n//    ORDER = 10;\n//    struct simple_cache *sc = simple_cache_init(1000, 30, NULL);\n//    wah_giggle_set_data_handler();\n//    struct giggle_index *gi = giggle_init_index(30);\n//    char *file_name = \"../data/1k.unsort.bed.gz\";\n//    uint32_t ret = giggle_index_file(gi, file_name);\n//\n//    uint8_t *R_bm = (uint8_t*)giggle_query_region(gi,\n//                                                  \"11\",\n//                                                  1000,\n//                                                  3000000);\n//    /*\n//     * tabix 1k.sort.bed.gz chr11:1000-3000000\n//     * chr11    575808  576604  .   1000    .   ...\n//     * chr11    2950239 2952321 .   1000    .   ...\n//     */\n//\n//    uint32_t *R = NULL;\n//    uint32_t R_len = wah_get_ints(R_bm, &R);\n//    TEST_ASSERT_EQUAL(2, R_len);\n//\n//    //struct file_id_offset_pair *r = \n//        //(struct file_id_offset_pair *)\n//        //unordered_list_get(gi->offset_index, R[0] - 1);\n//    struct file_id_offset_pair r = gi->offset_index->vals[R[0] - 1];\n//\n//    struct file_data *fd = unordered_list_get(gi->file_index,\n//                                              r.file_id);\n//\n//    struct input_file *i = input_file_init(fd->file_name);\n//\n//    i->input_file_seek(i, r.offset);\n//\n//    int chrm_len = 10;\n//    char *chrm = (char *)malloc(chrm_len*sizeof(char));\n//    uint32_t start, end;\n//    long offset;\n//            \n//    int x = i->input_file_get_next_interval(i,\n//                                            &chrm,\n//                                            &chrm_len,\n//                                            &start,\n//                                            &end,\n//                                            &offset);\n//\n//    TEST_ASSERT_EQUAL(0, strcmp(\"11\", chrm));\n//    TEST_ASSERT_EQUAL(575808, start);\n//    TEST_ASSERT_EQUAL(576604, end);\n//\n//    //r = (struct file_id_offset_pair *)\n//            //unordered_list_get(gi->offset_index, R[1] - 1);\n//    r = gi->offset_index->vals[R[1] - 1];\n//    i->input_file_seek(i, r.offset);\n//    x = i->input_file_get_next_interval(i,\n//                                        &chrm,\n//                                        &chrm_len,\n//                                        &start,\n//                                        &end,\n//                                        &offset);\n//\n//    TEST_ASSERT_EQUAL(0, strcmp(\"11\", chrm));\n//    TEST_ASSERT_EQUAL(2950239, start);\n//    TEST_ASSERT_EQUAL(2952321, end);\n//\n//\n//    free(R);\n//    free(R_bm);\n//    free(chrm);\n//    input_file_destroy(&i);\n//    giggle_index_destroy(&gi);\n//    cache.destroy();\n//}\n////}}}\n\n//{{{void test_giggle_index_directory(void)\nvoid test_giggle_index_directory(void)\n{\n    ORDER = 10;\n    struct simple_cache *sc = simple_cache_init(1000, 30, NULL);\n    uint64_t_ll_giggle_set_data_handler();\n    struct giggle_index *gi = giggle_init_index(30, \"tmp_offset_index.idx\");\n    char *path_name = \"../data/many/*bed.gz\";\n    uint32_t r = giggle_index_directory(gi, path_name, 0);\n\n    valid_giggle_index(gi);\n\n    TEST_ASSERT_EQUAL(21024, r);\n    TEST_ASSERT_EQUAL(22, gi->file_idx->index->num);\n    TEST_ASSERT_EQUAL(21024, gi->offset_idx->index->num);\n\n    struct uint64_t_ll *R = (struct uint64_t_ll *)\n        giggle_query_region(gi, \"11\", 1000, 3000000);\n\n    uint64_t_ll_free((void **)&R);\n\n    R = (struct uint64_t_ll *)giggle_query_region(gi,\n                                                  \"1\",\n                                                  1000,\n                                                  3000000);\n    TEST_ASSERT_EQUAL(71, R->len);\n    uint64_t_ll_free((void **)&R);\n    \n    R = (struct uint64_t_ll *)giggle_query_region(gi,\n                                                  \"1\",\n                                                  249250622,\n                                                  249250625);\n    TEST_ASSERT_EQUAL(NULL, R);\n\n    R = (struct uint64_t_ll *)giggle_query_region(gi,\n                                                  \"12\",\n                                                  52463173,\n                                                  52464215);\n\n    TEST_ASSERT_EQUAL(4, R->len);\n    uint64_t_ll_free((void **)&R);\n    giggle_index_destroy(&gi);\n    cache.destroy();\n    remove(\"tmp_offset_index.idx\");\n}\n//}}}\n\n//{{{ void test_giggle_init_store_load(void)\nvoid test_giggle_init_store_load(void)\n{\n    struct giggle_index *gi = giggle_init(\n                24,\n                \"tmp\",\n                1,\n                uint64_t_ll_giggle_set_data_handler);\n\n    char *path_name = \"../data/many/*bed.gz\";\n    uint32_t r = giggle_index_directory(gi, path_name, 0);\n\n    TEST_ASSERT_EQUAL(21024, r);\n    TEST_ASSERT_EQUAL(22, gi->file_idx->index->num);\n    TEST_ASSERT_EQUAL(21024, gi->offset_idx->index->num);\n\n    struct uint64_t_ll *R = (struct uint64_t_ll *)\n        giggle_query_region(gi, \"11\", 1000, 3000000);\n\n    uint64_t_ll_free((void **)&R);\n\n    R = (struct uint64_t_ll *)giggle_query_region(gi,\n                                                  \"1\",\n                                                  1000,\n                                                  3000000);\n    /*\n     * ls *gz | xargs -I{} tabix {} chr1:1000-3000000 | wc -l\n     * 71\n     */\n    TEST_ASSERT_EQUAL(71, R->len);\n\n    uint64_t_ll_free((void **)&R);\n    TEST_ASSERT_EQUAL(0, giggle_store(gi));\n    giggle_index_destroy(&gi);\n    cache.destroy();\n\n    gi = giggle_load(\"tmp\",\n                     uint64_t_ll_giggle_set_data_handler);\n\n    R = (struct uint64_t_ll *)giggle_query_region(gi,\n                                                   \"1\",\n                                                   1000,\n                                                   1000000);\n    TEST_ASSERT_EQUAL(16, R->len);\n    uint64_t_ll_free((void **)&R);\n\n    R = (struct uint64_t_ll *)giggle_query_region(gi,\n                                                  \"chr9\",\n                                                  112989628,\n                                                  112989630);\n\n    uint64_t_ll_free((void **)&R);\n    giggle_index_destroy(&gi);\n    cache.destroy();\n    rmrf(\"tmp\");\n}\n//}}}\n\n////{{{void test_giggle_index_store(void)\n//void test_giggle_index_store(void)\n//{\n//    struct stat st = {0};\n//    if (stat(\"tmp\", &st) == -1) {\n//            mkdir(\"tmp\", 0700);\n//    } else {\n//        rmrf(\"tmp/\");\n//        mkdir(\"tmp\", 0700);\n//    }\n//\n//    char *cache_names[30];\n//    uint32_t i, ret;\n//    for (i = 0; i < 30; ++i) {\n//        ret = asprintf(&(cache_names[i]), \"tmp/cache.%u\", i);\n//    }\n//\n//    ORDER = 10;\n//    struct simple_cache *sc = simple_cache_init(1000, 30, cache_names);\n//    uint64_t_ll_giggle_set_data_handler();\n//    struct giggle_index *gi = giggle_init_index(30);\n//    char *path_name = \"../data/many/*bed.gz\";\n//    uint32_t r = giggle_index_directory(gi, path_name, 0);\n//\n//    for (i = 0; i < 30; ++i) {\n//        bpt_write_tree(i, gi->root_ids[i]);\n//    }\n//\n//    for (i = 0; i < 30; ++i) {\n//        free(cache_names[i]);\n//    }\n//\n//\n//    char *chrm_index_file_name = \"tmp/chrm_index.dat\";\n//    char *file_index_file_name = \"tmp/file_index.dat\";\n//    char *offset_index_file_name = \"tmp/offset_index.dat\";\n//    char *root_ids_file_name = \"tmp/root_ids.dat\";\n//\n//    FILE *f = fopen(root_ids_file_name, \"wb\");\n//\n//    if (fwrite(&(gi->len), sizeof(uint32_t), 1, f) != 1)\n//        err(EX_IOERR, \"Error writing len for root_ids'%s'.\",\n//            root_ids_file_name);\n//\n//    if (fwrite(gi->root_ids, sizeof(uint32_t), gi->len, f) != gi->len)\n//        err(EX_IOERR, \"Error writing root_ids '%s'.\",\n//            root_ids_file_name);\n//    fclose(f);\n//\n//    f = fopen(chrm_index_file_name, \"wb\");\n//    ordered_set_store(gi->chrm_idx->index,\n//                      f,\n//                      chrm_index_file_name,\n//                      str_uint_pair_store);\n//    fclose(f);\n//\n//    gi->file_idx->file_name = strdup(file_index_file_name);\n//    file_index_store(gi->file_idx);\n//\n//    /*\n//    f = fopen(file_index_file_name, \"wb\");\n//    unordered_list_store(gi->file_index,\n//                         f,\n//                         file_index_file_name,\n//                         c_str_store);\n//    fclose(f);\n//    */\n//\n//    gi->offset_idx->file_name = strdup(offset_index_file_name);\n//    offset_index_store(gi->offset_idx);\n//    /*\n//    f = fopen(offset_index_file_name, \"wb\");\n//    if (fwrite(&(gi->offset_index->num),\n//               sizeof(uint64_t),1, f) != 1)\n//        err(EX_IOERR, \"Error writing offset_index num to '%s'.\",\n//            gi->offset_index_file_name);\n//    if (fwrite(gi->offset_index->vals, \n//               sizeof(struct file_id_offset_pair), \n//               gi->offset_index->num, f) != gi->offset_index->num)\n//        err(EX_IOERR, \"Error writing file_id offset pairs to '%s'.\",\n//            gi->offset_index_file_name);\n//    fclose(f);\n//    */\n//\n//    giggle_index_destroy(&gi);\n//    cache.destroy();\n//    rmrf(\"tmp\");\n//}\n////}}}\n\n//{{{void valid_giggle_index(struct giggle_index *gi)\nvoid valid_giggle_index(struct giggle_index *gi)\n{\n    uint32_t i,j;\n    for (i = 0; i < gi->num; ++i) {\n        struct uint64_t_ll *current_ids = NULL;\n        struct bpt_node *r = cache.get(i,\n                                       gi->root_ids[i] - 1,\n                                       &bpt_node_cache_handler);\n        while (BPT_IS_LEAF(r) == 0) {\n            uint32_t left_most_id = BPT_POINTERS(r)[0];\n            r = cache.get(i,\n                          left_most_id - 1,\n                          &bpt_node_cache_handler);\n        }\n\n        while (1) {\n\n            /*\n            if ((BPT_LEADING(r) == 0) && (current_ids != NULL)) {\n                struct uint64_t_ll_node *c = current_ids->head;\n                while (c != NULL) {\n                    fprintf(stderr, \"%u\\n\", c->val);\n                    c = c->next;\n                }\n                \n            }\n            */\n\n\n            /*\n            fprintf(stderr, \"%u %u\\n\",\n                    BPT_LEADING(r) == 0, current_ids==NULL);\n            */\n\n            TEST_ASSERT_TRUE(\n                    ((BPT_LEADING(r) == 0) && (current_ids==NULL))\n                    ||\n                    ((BPT_LEADING(r) != 0) && (current_ids!=NULL))\n                    );\n\n\n            if (BPT_LEADING(r) != 0) {\n                struct uint64_t_ll_bpt_leading_data *ld = \n                        cache.get(i,\n                                  BPT_LEADING(r) - 1,\n                                  &uint64_t_ll_leading_cache_handler);\n\n                if (ld->B != NULL) {\n                    struct uint64_t_ll_node *curr = ld->B->head;\n                    while (curr != NULL) {\n                        TEST_ASSERT_EQUAL(1,\n                                uint64_t_ll_contains(current_ids, curr->val));\n                        curr = curr->next;\n                    }\n                }\n            }\n\n\n            for (j = 0; j < BPT_NUM_KEYS(r); ++j) {\n                struct uint64_t_ll_bpt_non_leading_data *nld = \n                        cache.get(i,\n                                  BPT_POINTERS(r)[j] - 1,\n                                  &uint64_t_ll_non_leading_cache_handler);\n\n                if (nld->SA != NULL) {\n                    struct uint64_t_ll_node *curr = nld->SA->head;\n                    while (curr != NULL) {\n                        uint64_t_ll_uniq_append(&current_ids, curr->val);\n                        curr = curr->next;\n                    }\n                }\n\n                if (nld->SE != NULL) {\n                    struct uint64_t_ll_node *curr = nld->SE->head;\n                    while (curr != NULL) {\n                        uint64_t_ll_remove(&current_ids, curr->val);\n                        curr = curr->next;\n                    }\n                }\n            }\n\n            if (BPT_NEXT(r) == 0)\n                break;\n            r = cache.get(i,\n                          BPT_NEXT(r) - 1,\n                          &bpt_node_cache_handler);\n        }\n        TEST_ASSERT_EQUAL(NULL, current_ids);\n    }\n}\n//}}}\n\n//{{{ void test_valid_giggle_index_many(void)\nvoid test_valid_giggle_index_many(void)\n{\n    ORDER=100;\n    struct giggle_index *gi = giggle_init(24,\n                                          \"tmp\",\n                                          1,\n                                          uint64_t_ll_giggle_set_data_handler);\n\n    uint32_t total = 0;\n\n    char *files[21] = { \"../data/many/0.1.bed.gz\",\n                        \"../data/many/0.2.bed.gz\",\n                        \"../data/many/0.bed.gz\",\n                        \"../data/many/1.1.bed.gz\",\n                        \"../data/many/1.2.bed.gz\",\n                        \"../data/many/1.bed.gz\",\n                        \"../data/many/10.bed.gz\",\n                        \"../data/many/2.1.bed.gz\",\n                        \"../data/many/2.2.bed.gz\",\n                        \"../data/many/2.bed.gz\",\n                        \"../data/many/3.1.bed.gz\",\n                        \"../data/many/3.2.bed.gz\",\n                        \"../data/many/3.bed.gz\",\n                        \"../data/many/4.1.bed.gz\",\n                        \"../data/many/4.bed.gz\",\n                        \"../data/many/5.1.bed.gz\",\n                        \"../data/many/5.bed.gz\",\n                        \"../data/many/6.bed.gz\",\n                        \"../data/many/7.bed.gz\",\n                        \"../data/many/8.bed.gz\",\n                        \"../data/many/9.bed.gz\"};\n            \n    uint32_t i;\n    for (i = 0; i < 21; ++i) {\n        {\n            char *file_name = files[i];\n            //fprintf(stderr, \"%s\\n\", file_name);\n            struct input_file *i = input_file_init(file_name);\n            int chrm_len = 10;\n            char *chrm = (char *)malloc(chrm_len*sizeof(char));\n            uint32_t start, end;\n            long offset;\n            kstring_t line = {0, 0, NULL};\n\n        \n            /*\n            struct file_data *fd = (struct file_data *)\n                calloc(1, sizeof(struct file_data));\n            fd->file_name = strdup(file_name);\n       \n            uint32_t file_id = unordered_list_add(gi->file_index, fd);\n            */\n            uint32_t file_id = file_index_add(gi->file_idx, file_name);\n            struct file_data *fd = file_index_get(gi->file_idx, file_id);\n\n            uint32_t j = 0;\n\n            struct file_id_offset_pair *p;\n            uint32_t intrv_id;\n\n            while (i->input_file_get_next_interval(i,\n                                                   &chrm,\n                                                   &chrm_len,\n                                                   &start,\n                                                   &end,\n                                                   &offset,\n                                                   &line) >= 0) {\n                intrv_id = offset_index_add(gi->offset_idx,\n                                            offset,\n                                            &line,\n                                            file_id);\n\n                uint32_t chrm_id = giggle_get_chrm_id(gi, chrm);\n                uint32_t r = giggle_insert(chrm_id,\n                                           &(gi->root_ids[chrm_id]),\n                                           start,\n                                           end,\n                                           intrv_id);\n\n                //fprintf(stderr, \"%s %u %u\\n\", chrm, start, end);\n                valid_giggle_index(gi);\n\n                fd->mean_interval_size += end-start;\n                fd->num_intervals += 1;\n                j += 1;\n            }\n            fd->mean_interval_size = fd->mean_interval_size/fd->num_intervals;\n\n            input_file_destroy(&i);\n            if (line.s != NULL)\n                free(line.s);\n            free(chrm);\n        }\n    }\n    giggle_index_destroy(&gi);\n    cache.destroy();\n\n    rmrf(\"tmp\");\n}\n//}}}\n\n//{{{ void test_giggle_init_store_load(void)\nvoid test_giggle_index_search_store_search(void)\n{\n    struct giggle_index *gi = giggle_init(\n                24,\n                \"tmp\",\n                1,\n                uint64_t_ll_giggle_set_data_handler);\n\n    char *path_name = \"../data/many/*bed.gz\";\n    uint32_t r = giggle_index_directory(gi, path_name, 0);\n\n\n    struct uint64_t_ll *R = (struct uint64_t_ll *)\n                giggle_query_region(gi,\n                                    \"chr9\",\n                                    112989628,\n                                    112989630);\n   \n    //ls *gz | xargs -I{} tabix {} chr1:1000-3000000 | wc -l\n    //39\n    //TEST_ASSERT_EQUAL(39, R->len);\n    \n    uint64_t_ll_free((void **)&R);\n    TEST_ASSERT_EQUAL(0, giggle_store(gi));\n    giggle_index_destroy(&gi);\n    cache.destroy();\n\n    gi = giggle_load(\"tmp\",\n                     uint64_t_ll_giggle_set_data_handler);\n\n    R = (struct uint64_t_ll *)giggle_query_region(gi,\n                                                  \"chr9\",\n                                                  112989628,\n                                                  112989630);\n    uint64_t_ll_free((void **)&R);\n    giggle_index_destroy(&gi);\n    cache.destroy();\n    rmrf(\"tmp\");\n}\n//}}}\n\n//{{{ void test_giggle_init_store_load_block(void)\nvoid test_giggle_index_search_store_search_block(void)\n{\n    struct giggle_index *gi = giggle_init(\n                24,\n                \"tmp\",\n                1,\n                uint64_t_ll_giggle_set_data_handler);\n\n    giggle_data_handler.write_tree = giggle_write_tree_leaf_data;\n\n    char *path_name = \"../data/many/*bed.gz\";\n    uint32_t r = giggle_index_directory(gi, path_name, 0);\n\n\n    uint32_t num_tests = 10000, *chrs, *starts, *ends, *hits;\n    chrs = (uint32_t *)malloc(num_tests * sizeof(uint32_t));\n    starts = (uint32_t *)malloc(num_tests * sizeof(uint32_t));\n    ends = (uint32_t *)malloc(num_tests * sizeof(uint32_t));\n    hits = (uint32_t *)malloc(num_tests * sizeof(uint32_t));\n\n    struct giggle_query_result *gqr;\n    uint32_t count, i;\n    for(i = 0; i < num_tests; i++) {\n        chrs[i] = (rand() % 20) + 1;\n        starts[i] = (rand()%10000000)+1;\n        ends[i] = starts[i] + (rand()%10000000)+1;\n\n        char *c;\n        asprintf(&c, \"%u\", chrs[i]);\n            \n\n        gqr = giggle_query(gi,\n                           c, \n                           starts[i],\n                           ends[i],\n                           NULL);\n\n        free(c);\n\n        count = 0;\n        uint32_t j;\n        for(j = 0; j < gqr->num_files; j++) \n            count += giggle_get_query_len(gqr, j);\n        hits[i] = count;\n        giggle_query_result_destroy(&gqr);\n    }\n   \n    TEST_ASSERT_EQUAL(0, giggle_store(gi));\n    giggle_index_destroy(&gi);\n    cache.destroy();\n\n    gi = giggle_load(\"tmp\",\n                     uint64_t_ll_giggle_set_data_handler);\n\n    giggle_data_handler.giggle_collect_intersection =\n            giggle_collect_intersection_data_in_block;\n\n    giggle_data_handler.map_intersection_to_offset_list =\n            leaf_data_map_intersection_to_offset_list;\n\n    for(i = 0; i < num_tests; i++) {\n        char *c;\n        asprintf(&c, \"%u\", chrs[i]);\n            \n        gqr = giggle_query(gi,\n                           c, \n                           starts[i],\n                           ends[i],\n                           NULL);\n\n\n        count = 0;\n        uint32_t j;\n        for(j = 0; j < gqr->num_files; j++) \n            count += giggle_get_query_len(gqr, j);\n        TEST_ASSERT_EQUAL(hits[i], count);\n        giggle_query_result_destroy(&gqr);\n        free(c);\n    }\n\n    free(chrs);\n    free(starts);\n    free(ends);\n    free(hits);\n \n    giggle_index_destroy(&gi);\n    cache.destroy();\n    rmrf(\"tmp\");\n}\n//}}}\n\n//{{{ void test_giggle_query_bug_0(void)\nvoid test_giggle_query_bug_0(void)\n{\n    struct giggle_index *gi = giggle_init(\n                24,\n                \"tmp\",\n                1,\n                uint64_t_ll_giggle_set_data_handler);\n\n    giggle_data_handler.write_tree = giggle_write_tree_leaf_data;\n\n    char *path_name = \"../data/many/*bed.gz\";\n    uint32_t r = giggle_index_directory(gi, path_name, 0);\n\n    valid_giggle_index(gi);\n\n    struct giggle_query_result *gqr;\n\n    gqr = giggle_query(gi,\n                       \"18\",\n                       23669300,\n                       23671590,\n                       NULL);\n\n    uint32_t o_count = 0;\n    uint32_t j;\n    for(j = 0; j < gqr->num_files; j++) \n        o_count += giggle_get_query_len(gqr, j);\n\n\n    giggle_query_result_destroy(&gqr);\n\n    TEST_ASSERT_EQUAL(0, giggle_store(gi));\n    giggle_index_destroy(&gi);\n    cache.destroy();\n\n    gi = giggle_load(\"tmp\",\n                     uint64_t_ll_giggle_set_data_handler);\n\n    giggle_data_handler.giggle_collect_intersection =\n            giggle_collect_intersection_data_in_block;\n\n    giggle_data_handler.map_intersection_to_offset_list =\n            leaf_data_map_intersection_to_offset_list;\n\n    gqr = giggle_query(gi,\n                       \"18\",\n                       23669300,\n                       23671590,\n                       NULL);\n\n    uint32_t u_count = 0;\n    for(j = 0; j < gqr->num_files; j++) \n        u_count += giggle_get_query_len(gqr, j);\n\n    TEST_ASSERT_EQUAL(o_count, u_count);\n\n    giggle_query_result_destroy(&gqr);\n    giggle_index_destroy(&gi);\n    cache.destroy();\n\n    rmrf(\"tmp\");\n}\n//}}}\n\n//{{{ void test_giggle_query_bug_1(void)\nvoid test_giggle_query_bug_1(void)\n{\n    struct giggle_index *gi = giggle_init(\n                24,\n                \"tmp\",\n                1,\n                uint64_t_ll_giggle_set_data_handler);\n\n    giggle_data_handler.write_tree = giggle_write_tree_leaf_data;\n\n    char *path_name = \"../data/many/*bed.gz\";\n    uint32_t r = giggle_index_directory(gi, path_name, 0);\n\n    valid_giggle_index(gi);\n\n    struct giggle_query_result *gqr;\n\n    gqr = giggle_query(gi,\n                       \"1\",\n                       19228888,\n                       19229960,\n                       NULL);\n\n    uint32_t o_count = 0;\n    uint32_t j;\n    for(j = 0; j < gqr->num_files; j++) \n        o_count += giggle_get_query_len(gqr, j);\n\n\n    giggle_query_result_destroy(&gqr);\n\n    TEST_ASSERT_EQUAL(0, giggle_store(gi));\n    giggle_index_destroy(&gi);\n    cache.destroy();\n\n    gi = giggle_load(\"tmp\",\n                     uint64_t_ll_giggle_set_data_handler);\n\n    giggle_data_handler.giggle_collect_intersection =\n            giggle_collect_intersection_data_in_block;\n\n    giggle_data_handler.map_intersection_to_offset_list =\n            leaf_data_map_intersection_to_offset_list;\n\n    gqr = giggle_query(gi,\n                       \"1\",\n                       19228888,\n                       19229960,\n                       NULL);\n\n    uint32_t u_count = 0;\n    for(j = 0; j < gqr->num_files; j++) \n        u_count += giggle_get_query_len(gqr, j);\n\n    TEST_ASSERT_EQUAL(o_count, u_count);\n\n    giggle_query_result_destroy(&gqr);\n    giggle_index_destroy(&gi);\n    cache.destroy();\n    rmrf(\"tmp\");\n}\n//}}}\n\n//{{{void test_giggle_bulk_insert(void)\nvoid test_giggle_bulk_insert(void)\n{\n    char *input_path_name = \"../data/many/*gz\";\n    char *output_path_name = \"tmp_test_giggle_bulk_insert\";\n\n    uint64_t indexed_intervals = giggle_bulk_insert(input_path_name,\n                                                    output_path_name,\n                                                    1);\n\n    char **names = NULL;\n    uint32_t *num_intervals = NULL;\n    double *mean_interval_sizes = NULL;\n    uint32_t num_files = giggle_get_indexed_files(output_path_name,\n                                                  &names,\n                                                  &num_intervals,\n                                                  &mean_interval_sizes);\n    /*\n     * ls ../data/many/ | wc -l\n     * ls ../data/many/ \n     * ls ../data/many/  | xargs -I {} bash -c \"gunzip -c {} | wc -l\"\n     * ls ../data/many/  | xargs -I {} bash -c \"gunzip -c {} | awk '{s += \\$3-\\$2} END {print s/NR;}'\"\n     */\n    TEST_ASSERT_EQUAL(22, num_files);\n    \n    char *A_names[22] = {\"../data/many/0.1.bed.gz\",\n                         \"../data/many/0.2.bed.gz\",\n                         \"../data/many/0.bed.gz\",\n                         \"../data/many/1.1.bed.gz\",\n                         \"../data/many/1.2.bed.gz\",\n                         \"../data/many/1.bed.gz\",\n                         \"../data/many/10.bed.gz\",\n                         \"../data/many/2.1.bed.gz\",\n                         \"../data/many/2.2.bed.gz\",\n                         \"../data/many/2.bed.gz\",\n                         \"../data/many/3.1.bed.gz\",\n                         \"../data/many/3.2.bed.gz\",\n                         \"../data/many/3.bed.gz\",\n                         \"../data/many/4.1.bed.gz\",\n                         \"../data/many/4.bed.gz\",\n                         \"../data/many/5.1.bed.gz\",\n                         \"../data/many/5.bed.gz\",\n                         \"../data/many/6.bed.gz\",\n                         \"../data/many/7.bed.gz\",\n                         \"../data/many/8.bed.gz\",\n                         \"../data/many/9.bed.gz\",\n                         \"../data/many/full_span.bed.gz\"};\n\n    uint32_t A_num_intervals[22] = { 1000,\n                                     1000,\n                                     1000,\n                                     1000,\n                                     1000,\n                                     1000,\n                                     1000,\n                                     1000,\n                                     1000,\n                                     1000,\n                                     1000,\n                                     1000,\n                                     1000,\n                                     1000,\n                                     1000,\n                                     1000,\n                                     1000,\n                                     1000,\n                                     1000,\n                                     1000,\n                                     1000,\n                                     24};\n    double A_mean_interval_sizes[22] = { 346.222,\n                                         346.222,\n                                         346.222,\n                                         417.531,\n                                         417.531,\n                                         417.531,\n                                         40.38,\n                                         416.819,\n                                         416.819,\n                                         416.819,\n                                         393.17,\n                                         393.17,\n                                         393.17,\n                                         318.024,\n                                         318.024,\n                                         368.418,\n                                         368.418,\n                                         204.66,\n                                         524.595,\n                                         283.845,\n                                         302.331,\n                                         128986557.833333};\n    uint32_t i;\n    for (i = 0; i < num_files; ++i) {\n        TEST_ASSERT_EQUAL(0,strcmp(A_names[i], names[i]));\n        TEST_ASSERT_EQUAL(A_num_intervals[i],num_intervals[i]);\n        TEST_ASSERT_EQUAL(A_mean_interval_sizes[i],mean_interval_sizes[i]);\n        free(names[i]);\n    }\n    free(names);\n    free(num_intervals);\n    free(mean_interval_sizes);\n\n    rmrf(output_path_name);\n}\n//}}}\n"
  },
  {
    "path": "test/unit/test_hash_list.c",
    "content": "#include <stdio.h>\n#include <stdlib.h>\n#include <math.h>\n#include <stdio.h>\n#include <inttypes.h>\n#include <string.h>\n\n#include \"util.h\"\n#include \"unity.h\"\n#include \"lists.h\"\n#include \"cache.h\"\n#include \"giggle_index.h\"\n\nvoid setUp(void) { }\nvoid tearDown(void) { }\n\n//{{{void test_hash_list_init(void)\nvoid test_hash_list_init(void)\n{\n    struct hash_list *hashl = hash_list_init();\n\n    uint64_t *ret = (uint64_t *)hash_list_get(hashl, 1);\n    TEST_ASSERT_EQUAL(NULL, ret);\n\n    uint64_t d = 2;\n    uint32_t r = hash_list_add(hashl, 1, &d, sizeof(uint64_t));\n    ret = (uint64_t *)hash_list_get(hashl, 1);\n    TEST_ASSERT_EQUAL(2, *ret);\n\n    ret = (uint64_t *)hash_list_get(hashl, 100);\n    TEST_ASSERT_EQUAL(NULL, ret);\n    d = 4;\n    r = hash_list_add(hashl, 100, &d, sizeof(uint64_t));\n    ret = (uint64_t *)hash_list_get(hashl, 100);\n    TEST_ASSERT_EQUAL(4, *ret);\n\n    ret = (uint64_t *)hash_list_get(hashl, 1000);\n    TEST_ASSERT_EQUAL(NULL, ret);\n    d = 6;\n    r = hash_list_add(hashl, 1000, &d, sizeof(uint64_t));\n    ret = (uint64_t *)hash_list_get(hashl, 1000);\n    TEST_ASSERT_EQUAL(6, *ret);\n\n    ret = (uint64_t *)hash_list_remove(hashl, 1);\n    free(ret);\n    ret = (uint64_t *)hash_list_remove(hashl, 100);\n    free(ret);\n    ret = (uint64_t *)hash_list_remove(hashl, 1000);\n    free(ret);\n\n    ret = (uint64_t *)hash_list_get(hashl, 1);\n    TEST_ASSERT_EQUAL(NULL, ret);\n    ret = (uint64_t *)hash_list_get(hashl, 100);\n    TEST_ASSERT_EQUAL(NULL, ret);\n    ret = (uint64_t *)hash_list_get(hashl, 1000);\n    TEST_ASSERT_EQUAL(NULL, ret);\n\n    uint32_t i;\n    for (i = 1001; i < 100000; ++i) {\n        d = i+1;\n        r = hash_list_add(hashl, i, &d, sizeof(uint64_t));\n    }\n\n    hash_list_destroy(&hashl);\n}\n//}}}\n"
  },
  {
    "path": "test/unit/test_kfunc.c",
    "content": "#include <stdio.h>\n#include <stdlib.h>\n#include <math.h>\n\n#include \"unity.h\"\n#include \"kfunc.h\"\n\nvoid setUp(void) { }\nvoid tearDown(void) { }\n\n// Test Fisher's exact test with known values\n// Using classic \"lady tasting tea\" example:\n// contingency table where lady correctly identifies 3 of 4 cups\nvoid test_fisher_exact_basic(void)\n{\n    long double left, right, two;\n\n    // Classic 2x2 table:\n    //        Tea first | Milk first\n    // Guessed Tea    3 |     1      = 4\n    // Guessed Milk   1 |     3      = 4\n    //               ---+---\n    //                4 |     4      = 8\n\n    long double p = _kt_fisher_exact(3, 1, 1, 3, &left, &right, &two);\n\n    // Two-tailed p-value should be approximately 0.4857\n    TEST_ASSERT_FLOAT_WITHIN(0.01, 0.4857, (float)two);\n}\n\n// Test with perfect association (all in diagonal)\nvoid test_fisher_exact_perfect_association(void)\n{\n    long double left, right, two;\n\n    // Perfect positive association:\n    // 10  0\n    //  0 10\n    long double p = _kt_fisher_exact(10, 0, 0, 10, &left, &right, &two);\n\n    // Should have very small p-value (highly significant)\n    TEST_ASSERT_TRUE(two < 0.001);\n}\n\n// Test with no association (equal distribution)\nvoid test_fisher_exact_no_association(void)\n{\n    long double left, right, two;\n\n    // No association:\n    // 5 5\n    // 5 5\n    long double p = _kt_fisher_exact(5, 5, 5, 5, &left, &right, &two);\n\n    // Should have p-value close to 1 (not significant)\n    TEST_ASSERT_FLOAT_WITHIN(0.1, 1.0, (float)two);\n}\n\n// Test with zeros in the table\nvoid test_fisher_exact_with_zeros(void)\n{\n    long double left, right, two;\n\n    // Table with a zero:\n    // 10 0\n    // 5  5\n    long double p = _kt_fisher_exact(10, 0, 5, 5, &left, &right, &two);\n\n    // Should compute without error\n    TEST_ASSERT_TRUE(two >= 0.0 && two <= 1.0);\n}\n\n// Test lbinom (log binomial coefficient)\nvoid test_lbinom(void)\n{\n    // C(5,0) = 1, log(1) = 0\n    TEST_ASSERT_FLOAT_WITHIN(0.0001, 0.0, (float)_lbinom(5, 0));\n\n    // C(5,5) = 1, log(1) = 0\n    TEST_ASSERT_FLOAT_WITHIN(0.0001, 0.0, (float)_lbinom(5, 5));\n\n    // C(5,2) = 10, log(10) ~= 2.303\n    TEST_ASSERT_FLOAT_WITHIN(0.01, 2.303, (float)_lbinom(5, 2));\n\n    // C(10,5) = 252, log(252) ~= 5.529\n    TEST_ASSERT_FLOAT_WITHIN(0.01, 5.529, (float)_lbinom(10, 5));\n}\n\n// Test hypergeometric distribution\nvoid test_hypergeo(void)\n{\n    // Simple case: drawing from an urn\n    // n11=2, n1_=4, n_1=4, n=8\n    // P(X=2) when drawing 4 from urn with 4 white, 4 black\n    long double p = _hypergeo(2, 4, 4, 8);\n\n    // This should be C(4,2)*C(4,2)/C(8,4) = 36/70 ~= 0.514\n    TEST_ASSERT_FLOAT_WITHIN(0.01, 0.514, (float)p);\n}\n\n// Test edge case: single element\nvoid test_fisher_exact_single(void)\n{\n    long double left, right, two;\n\n    // Minimal table:\n    // 1 0\n    // 0 1\n    long double p = _kt_fisher_exact(1, 0, 0, 1, &left, &right, &two);\n\n    // Should be significant (p = 0.5 for this tiny table)\n    TEST_ASSERT_TRUE(two >= 0.0 && two <= 1.0);\n}\n\n// Test larger numbers\nvoid test_fisher_exact_larger_numbers(void)\n{\n    long double left, right, two;\n\n    // Larger table:\n    // 100  50\n    //  50 100\n    long double p = _kt_fisher_exact(100, 50, 50, 100, &left, &right, &two);\n\n    // Should compute without overflow and return valid p-value\n    TEST_ASSERT_TRUE(two >= 0.0 && two <= 1.0);\n    // This shows positive association, should be significant\n    TEST_ASSERT_TRUE(two < 0.05);\n}\n"
  },
  {
    "path": "test/unit/test_leaf_data.c",
    "content": "#define _GNU_SOURCE\n\n#include \"util.h\"\n\n#include <stdbool.h>\n#include <stdio.h>\n#include <stdlib.h>\n#include <math.h>\n#include <stdio.h>\n#include <inttypes.h>\n#include <string.h>\n#include <err.h>\n#include <sysexits.h>\n\n#include \"unity.h\"\n#include \"fastlz.h\"\n#include \"bpt.h\"\n#include \"giggle_index.h\"\n#include \"lists.h\"\n#include \"file_read.h\"\n#include \"wah.h\"\n#include \"cache.h\"\n#include \"ll.h\"\n\n#define MIN(X, Y) (((X) < (Y)) ? (X) : (Y))\n\nvoid setUp(void) { }\nvoid tearDown(void) { }\n\n//\n////{{{ void test_get_leaf_data(void)\n//void test_get_leaf_data(void)\n//{\n//    ORDER = 10;\n//    struct simple_cache *sc = simple_cache_init(1000, 30, NULL);\n//    uint64_t_ll_giggle_set_data_handler();\n//    struct giggle_index *gi =\n//            giggle_init_index(30, \"test_get_leaf_data_offset.idx\");\n//    char *file_name = \"../data/1k.unsort.bed.gz\";\n//    uint32_t ret = giggle_index_file(gi, file_name);\n//\n//    uint32_t i;\n//    for (i = 0; i < gi->num; ++i) {\n//        struct bpt_node *curr = cache.get(i,\n//                                          gi->root_ids[i] - 1,\n//                                          &bpt_node_cache_handler);\n//\n//        while (BPT_IS_LEAF(curr) != 1) {\n//            curr = cache.get(i,\n//                             BPT_POINTERS(curr)[0] - 1,\n//                             &bpt_node_cache_handler);\n//        }\n//\n//        uint32_t id = BPT_ID(curr);\n//        uint32_t len = 0;\n//        while (id != 0) {\n//            curr = cache.get(i,\n//                             id - 1,\n//                             &bpt_node_cache_handler);\n//\n//            struct leaf_data *lf = NULL;\n//            uint16_t *starts_ends_offsets = NULL;\n//                uint32_t leaf_data_size = \n//                        giggle_get_leaf_data(gi,\n//                                             i,\n//                                             BPT_ID(curr),\n//                                             &lf,\n//                                             &starts_ends_offsets);\n// \n//            if (BPT_LEADING(curr) != 0) {\n//                struct uint64_t_ll_bpt_leading_data *ld =\n//                    cache.get(i,\n//                              BPT_LEADING(curr) - 1,\n//                              &uint64_t_ll_leading_cache_handler);\n//                TEST_ASSERT_EQUAL(ld->B->len, lf->num_leading);\n//            } else {\n//                TEST_ASSERT_EQUAL(0, lf->num_leading);\n//            }\n//\n//            uint32_t s_len = 0;\n//            uint32_t e_len = 0;\n//            uint32_t j;\n//            for (j = 0; j < BPT_NUM_KEYS(curr) ; ++j) {\n//                if (BPT_POINTERS(curr)[j] != 0) {\n//                    struct uint64_t_ll_bpt_non_leading_data *nld =\n//                            cache.get(i,\n//                                      BPT_POINTERS(curr)[j] - 1,\n//                                      &uint64_t_ll_non_leading_cache_handler);\n//                    s_len += (nld->SA == NULL) ? 0 : nld->SA->len;\n//                    e_len += (nld->SE == NULL) ? 0 : nld->SE->len;\n//\n//                    TEST_ASSERT_EQUAL((nld->SA == NULL) ? 0 : nld->SA->len,\n//                                      starts_ends_offsets[j*2] -\n//                                      ((j==0) ? 0 \n//                                              : starts_ends_offsets[j*2-2]));\n//                    uint32_t k;\n//                    for (k = (j==0)? 0 : starts_ends_offsets[j*2-2];\n//                         k < starts_ends_offsets[j*2];\n//                         ++k) {\n//                        TEST_ASSERT_EQUAL(1,\n//                                          uint64_t_ll_contains(nld->SA,\n//                                                               lf->starts[k]));\n//                    }\n//\n//                    TEST_ASSERT_EQUAL((nld->SE == NULL) ? 0 : nld->SE->len,\n//                                      starts_ends_offsets[j*2+1] -\n//                                      ((j==0) ? 0 \n//                                              : starts_ends_offsets[j*2-1]));\n//\n//                    for (k = (j==0)? 0 : starts_ends_offsets[j*2-1];\n//                         k < starts_ends_offsets[j*2+1];\n//                         ++k) {\n//                        TEST_ASSERT_EQUAL(1,\n//                                          uint64_t_ll_contains(nld->SE,\n//                                                               lf->ends[k]));\n//                    }\n//                }\n//            }\n//            TEST_ASSERT_EQUAL(s_len, lf->num_starts);\n//            TEST_ASSERT_EQUAL(e_len, lf->num_ends);\n//\n//            id = BPT_NEXT(curr);\n//            leaf_data_free_mem((void **)&lf);\n//            free(starts_ends_offsets);\n//        }\n//    }\n//    giggle_index_destroy(&gi);\n//    cache.destroy();\n//    remove(\"test_get_leaf_data_offset.idx\");\n//}\n////}}}\n//\n////{{{ void test_get_leaf_data(void)\n//void test_leaf_data_cache_handler(void)\n//{\n//    ORDER = 10;\n//    struct simple_cache *sc = simple_cache_init(1000, 30, NULL);\n//    uint64_t_ll_giggle_set_data_handler();\n//    struct giggle_index *gi = \n//            giggle_init_index(30,\n//                              \"test_leaf_data_cache_handler_offset.idx\");\n//    char *file_name = \"../data/1k.unsort.bed.gz\";\n//    uint32_t ret = giggle_index_file(gi, file_name);\n//\n//    uint32_t i;\n//    for (i = 0; i < gi->num; ++i) {\n//        struct bpt_node *curr = cache.get(i,\n//                                          gi->root_ids[i] - 1,\n//                                          &bpt_node_cache_handler);\n//\n//        while (BPT_IS_LEAF(curr) != 1) {\n//            curr = cache.get(i,\n//                             BPT_POINTERS(curr)[0] - 1,\n//                             &bpt_node_cache_handler);\n//        }\n//\n//        uint32_t id = BPT_ID(curr);\n//        uint32_t len = 0;\n//        while (id != 0) {\n//            curr = cache.get(i,\n//                             id - 1,\n//                             &bpt_node_cache_handler);\n//\n//            struct leaf_data *lf = NULL;\n//            uint16_t *starts_ends_offsets = NULL;\n//                uint32_t leaf_data_size = \n//                        giggle_get_leaf_data(gi,\n//                                             i,\n//                                             BPT_ID(curr),\n//                                             &lf,\n//                                             &starts_ends_offsets);\n//\n//            /*\n//            leaf_data_deserialize(void *serialized,\n//                               uint64_t serialized_size,\n//                               void **deserialized);\n//            leaf_data_serialize(void *deserialized, void **serialized);\n//\n//\n//            */\n//            id = BPT_NEXT(curr);\n//            leaf_data_free_mem((void **)&lf);\n//            free(starts_ends_offsets);\n//        }\n//    }\n//\n//    giggle_index_destroy(&gi);\n//    cache.destroy();\n//    remove(\"test_leaf_data_cache_handler_offset.idx\");\n//}\n//\n////}}}\n\n//{{{void test_leaf_data_ops(void)\nvoid test_leaf_data_ops(void)\n{\n    ORDER = 5;\n    struct giggle_index *gi = giggle_init(\n                23,\n                \"tmp\",\n                1,\n                uint64_t_ll_giggle_set_data_handler);\n\n    giggle_data_handler.write_tree = &giggle_write_tree_leaf_data;\n\n    uint32_t domain = 0;\n\n    //  1    2    3    4    5    6    7    8   9   10   11   12   13   14   15\n    //1:|--------------------------------------|\n    //2:     |---------|\n    //3:          |--------------|\n    //4:               |-----------------------------------------------|\n    //5:                    |----------------------|\n    //6:                              |---------------------------|\n    //7:                              |------------|\n    //8:                                                     |--------------|\n    //\n    //Q:                              |------------------|\n\n    //   L   1    2    3    4\n    //   --------------------\n    // S     1    2    3    4\n    // E \n    //\n    //   L        5    7    10\n    //   ---------------------\n    // S 1,2,3,4  5    6,7   \n    // E          2    3    1\n    //\n    //   L     11   12   14   15    16\n    //   ------------------------\n    // S 4,6,7      8\n    // E       5    7    6    4     8\n     \n\n    uint32_t root_id = 0;\n    char *chrm = \"0\";\n    uint32_t chrm_id = giggle_get_chrm_id(gi, chrm);\n    giggle_insert(chrm_id, &root_id, 1, 9, 1);\n    giggle_insert(chrm_id, &root_id, 2, 4, 2);\n    giggle_insert(chrm_id, &root_id, 3, 6, 3);\n    giggle_insert(chrm_id, &root_id, 4, 14, 4);\n    giggle_insert(chrm_id, &root_id, 5, 10, 5);\n    giggle_insert(chrm_id, &root_id, 7, 13, 6);\n    giggle_insert(chrm_id, &root_id, 7, 11, 7);\n    giggle_insert(chrm_id, &root_id, 12, 15, 8);\n\n    gi->root_ids[chrm_id] = root_id;\n\n    giggle_store(gi);\n    giggle_index_destroy(&gi);\n    cache.destroy();\n\n    gi = giggle_load(\"tmp\",\n        uint64_t_ll_giggle_set_data_handler);\n\n    struct leaf_data_result *R = NULL;\n\n    uint32_t start = 2, end = 11;\n\n    //{{{ search\n    uint32_t leaf_start_id = 0;\n    int pos_start_id = 0;\n\n    uint32_t nld_start_id = bpt_find(domain,\n                                     gi->root_ids[domain],\n                                     &leaf_start_id, \n                                     &pos_start_id,\n                                     start);\n    struct bpt_node *leaf_start = cache.get(domain,\n                                            leaf_start_id - 1,\n                                            &bpt_node_cache_handler);\n    if ((pos_start_id == 0) && (BPT_KEYS(leaf_start)[0] != start))\n        pos_start_id = -1;\n    else if ( (pos_start_id >=0) && \n              (pos_start_id < BPT_NUM_KEYS(leaf_start)) &&\n              (BPT_KEYS(leaf_start)[pos_start_id] > start))\n        pos_start_id -= 1;\n\n\n    uint32_t leaf_end_id = 0;\n    int pos_end_id = 0;\n\n    uint32_t nld_end_id = bpt_find(domain,\n                                  gi->root_ids[domain],\n                                  &leaf_end_id, \n                                  &pos_end_id,\n                                  end);\n    struct bpt_node *leaf_end = cache.get(domain,\n                                          leaf_end_id - 1,\n                                          &bpt_node_cache_handler);\n\n    if ((pos_end_id == 0) && (BPT_KEYS(leaf_end)[0] != end))\n        pos_end_id = -1;\n    else if ( (pos_end_id >=0) && \n              (pos_end_id < BPT_NUM_KEYS(leaf_end)) &&\n              (BPT_KEYS(leaf_end)[pos_end_id] > end))\n        pos_end_id -= 1;\n    //}}}\n    \n    R = giggle_collect_intersection_data_in_block(leaf_start_id,\n                                                  pos_start_id,\n                                                  leaf_end_id,\n                                                  pos_end_id,\n                                                  domain,\n                                                  NULL);\n    // 2,11 : 1,2,3,4,5,6,7\n    TEST_ASSERT_EQUAL(7, R->len);\n    uint32_t A_2_11[7] = {1,2,3,4,5,6,7};\n\n    uint32_t i;\n    for (i = 0; i < R->len; ++i) \n        TEST_ASSERT_EQUAL(A_2_11[i], R->data[i]);\n\n    free(R->data);\n    free(R);\n\n    start = 6;\n    end = 8;\n\n    //{{{ search\n    nld_start_id = bpt_find(domain,\n                            gi->root_ids[domain],\n                            &leaf_start_id, \n                            &pos_start_id,\n                            start);\n    leaf_start = cache.get(domain,\n                           leaf_start_id - 1,\n                           &bpt_node_cache_handler);\n    if ((pos_start_id == 0) && (BPT_KEYS(leaf_start)[0] != start))\n        pos_start_id = -1;\n    else if ( (pos_start_id >=0) && \n              (pos_start_id < BPT_NUM_KEYS(leaf_start)) &&\n              (BPT_KEYS(leaf_start)[pos_start_id] > start))\n        pos_start_id -= 1;\n\n\n    nld_end_id = bpt_find(domain,\n                          gi->root_ids[domain],\n                          &leaf_end_id, \n                          &pos_end_id,\n                          end);\n\n    leaf_end = cache.get(domain,\n                         leaf_end_id - 1,\n                         &bpt_node_cache_handler);\n    if ((pos_end_id == 0) && (BPT_KEYS(leaf_end)[0] != end))\n        pos_end_id = -1;\n    else if ( (pos_end_id >=0) && \n              (pos_end_id < BPT_NUM_KEYS(leaf_end)) &&\n              (BPT_KEYS(leaf_end)[pos_end_id] > end))\n        pos_end_id -= 1;\n    //}}}\n    \n    R = giggle_collect_intersection_data_in_block(leaf_start_id,\n                                                  pos_start_id,\n                                                  leaf_end_id,\n                                                  pos_end_id,\n                                                  domain,\n                                                  NULL);\n    // 6,8 : 1,3,4,5,6,7\n    TEST_ASSERT_EQUAL(6, R->len);\n    uint32_t A_6_8[6] = {1,3,4,5,6,7};\n    for (i = 0; i < R->len; ++i) \n        TEST_ASSERT_EQUAL(A_6_8[i], R->data[i]);\n\n    free(R->data);\n    free(R);\n\n    start = 10;\n    end = 11;\n\n    //{{{ search\n    nld_start_id = bpt_find(domain,\n                            gi->root_ids[domain],\n                            &leaf_start_id, \n                            &pos_start_id,\n                            start);\n    leaf_start = cache.get(domain,\n                           leaf_start_id - 1,\n                           &bpt_node_cache_handler);\n    if ((pos_start_id == 0) && (BPT_KEYS(leaf_start)[0] != start))\n        pos_start_id = -1;\n    else if ( (pos_start_id >=0) && \n              (pos_start_id < BPT_NUM_KEYS(leaf_start)) &&\n              (BPT_KEYS(leaf_start)[pos_start_id] > start))\n        pos_start_id -= 1;\n\n\n    nld_end_id = bpt_find(domain,\n                          gi->root_ids[domain],\n                          &leaf_end_id, \n                          &pos_end_id,\n                          end);\n\n    leaf_end = cache.get(domain,\n                         leaf_end_id - 1,\n                         &bpt_node_cache_handler);\n    if ((pos_end_id == 0) && (BPT_KEYS(leaf_end)[0] != end))\n        pos_end_id = -1;\n    else if ( (pos_end_id >=0) && \n              (pos_end_id < BPT_NUM_KEYS(leaf_end)) &&\n              (BPT_KEYS(leaf_end)[pos_end_id] > end))\n        pos_end_id -= 1;\n    //}}}\n \n    R = giggle_collect_intersection_data_in_block(leaf_start_id,\n                                                  pos_start_id,\n                                                  leaf_end_id,\n                                                  pos_end_id,\n                                                  domain,\n                                                  NULL);\n\n\n    // 10,12 : 4,5,6,7\n    TEST_ASSERT_EQUAL(4, R->len);\n    uint32_t A_10_12[4] = {4,5,6,7};\n    for (i = 0; i < R->len; ++i) \n        TEST_ASSERT_EQUAL(A_10_12[i], R->data[i]);\n\n    free(R->data);\n    free(R);\n    giggle_index_destroy(&gi);\n    cache.destroy();\n    rmrf(\"tmp\");\n}\n//}}}\n\n"
  },
  {
    "path": "test/unit/test_lists.c",
    "content": "#define _GNU_SOURCE\n#include <stdio.h>\n#include <stdlib.h>\n#include <math.h>\n#include <stdio.h>\n#include <inttypes.h>\n#include <string.h>\n\n#include \"util.h\"\n#include \"unity.h\"\n#include \"lists.h\"\n#include \"cache.h\"\n#include \"giggle_index.h\"\n\nvoid setUp(void) { }\nvoid tearDown(void) { }\n\n\n//{{{void test_unordered_list_init(void)\nvoid test_unordered_list_init(void)\n{\n    struct unordered_list *ul = unordered_list_init(10);\n\n    TEST_ASSERT_EQUAL(ul->num, 0);\n    TEST_ASSERT_EQUAL(ul->size, 10);\n\n    unordered_list_destroy(&ul, NULL);\n\n    TEST_ASSERT_EQUAL(ul, NULL);\n}\n//}}}\n\n//{{{void test_unordered_list_add(void)\nvoid test_unordered_list_add(void)\n{\n    struct unordered_list *ul = unordered_list_init(10);\n\n    int i, V[20];\n\n    for (i = 0; i < 20; ++i)\n        V[i] = (i+1)*2; \n\n    for (i = 0; i < 9; ++i) {\n        TEST_ASSERT_EQUAL(i, unordered_list_add(ul, (void *)(V + i)));\n        TEST_ASSERT_EQUAL(V + i, ul->data[i]);\n        TEST_ASSERT_EQUAL(i + 1, ul->num);\n        TEST_ASSERT_EQUAL(10, ul->size);\n    }\n    for (; i < 19; ++i) {\n        TEST_ASSERT_EQUAL(i, unordered_list_add(ul, (void *)(V + i)));\n        TEST_ASSERT_EQUAL(V + i, ul->data[i]);\n        TEST_ASSERT_EQUAL(i + 1, ul->num);\n        TEST_ASSERT_EQUAL(20, ul->size);\n    }\n\n    unordered_list_destroy(&ul, NULL);\n}\n//}}}\n\n//{{{void test_unordered_list_get(void)\nvoid test_unordered_list_get(void)\n{\n    struct unordered_list *ul = unordered_list_init(10);\n\n    int i, V[20];\n\n    for (i = 0; i < 20; ++i)\n        V[i] = (i+1)*2; \n\n    for (i = 0; i < 20; ++i) \n        TEST_ASSERT_EQUAL(i, unordered_list_add(ul, (void *)(V + i)));\n\n    for (i = 0; i < 20; ++i)  {\n        int *r = (int *)unordered_list_get(ul, i);\n        TEST_ASSERT_EQUAL(V[i], (int)(*r));\n    }\n\n    void *r = unordered_list_get(ul, 5000);\n    TEST_ASSERT_EQUAL(NULL, r);\n    \n    unordered_list_destroy(&ul, NULL);\n}\n//}}}\n\n//{{{ void test_unordered_list_store_load_file_id_offset_pair(void)\nvoid test_unordered_list_store_load_file_id_offset_pair(void)\n{\n    struct unordered_list *ul = unordered_list_init(10);\n\n\n    uint32_t uints[20];\n    long longs[20];\n\n    uint32_t i;\n    for (i = 0; i < 20; ++i) {\n        uints[i] = rand();\n        longs[i] = rand();\n\n        struct file_id_offset_pair *p = \n                (struct file_id_offset_pair *)\n                malloc(sizeof(struct file_id_offset_pair));\n        p->file_id = uints[i];\n        p->offset = longs[i];\n        unordered_list_add(ul, p);\n    }\n\n    for (i = 0; i < 20; ++i) {\n        struct file_id_offset_pair *p = unordered_list_get(ul, i);\n        TEST_ASSERT_EQUAL(uints[i], p->file_id);\n        TEST_ASSERT_EQUAL(longs[i], p->offset);\n    }\n\n    char *file_name = \"test_unordered_list_store_load_file_id_offset_pair.dat\";\n    FILE *f = fopen(file_name, \"wb\");\n\n    unordered_list_store(ul, f, file_name, file_id_offset_pair_store);\n\n    fclose(f);\n\n    f = fopen(file_name, \"rb\");\n\n    struct unordered_list *ul_2 = unordered_list_load(f,\n                                                    file_name,\n                                                    file_id_offset_pair_load);\n\n    for (i = 0; i < 20; ++i) {\n        struct file_id_offset_pair *p = unordered_list_get(ul, i);\n        struct file_id_offset_pair *p_2 = unordered_list_get(ul_2, i);\n        TEST_ASSERT_EQUAL(p->file_id, p_2->file_id);\n        TEST_ASSERT_EQUAL(p->offset, p_2->offset);\n    }\n\n    unordered_list_destroy(&ul, free_wrapper);\n    unordered_list_destroy(&ul_2, free_wrapper);\n    remove(\"test_unordered_list_store_load_file_id_offset_pair.dat\");\n}\n//}}}\n\n//{{{ void test_unordered_list_store_c_str(void)\nvoid test_unordered_list_store_load_c_str(void)\n{\n    struct unordered_list *ul = unordered_list_init(5);\n\n    char *A[10];\n    asprintf(&(A[0]), \"zero\");\n    asprintf(&(A[1]), \"one\");\n    asprintf(&(A[2]), \"two\");\n    asprintf(&(A[3]), \"three\");\n    asprintf(&(A[4]), \"four\");\n    asprintf(&(A[5]), \"five\");\n    asprintf(&(A[6]), \"six\");\n    asprintf(&(A[7]), \"seven\");\n    asprintf(&(A[8]), \"eight\");\n    asprintf(&(A[9]), \"nine\");\n\n    uint32_t i;\n    for (i = 0; i < 10; ++i)\n        unordered_list_add(ul, A[i]);\n\n    for (i = 0; i < 10; ++i) {\n        char *s = unordered_list_get(ul, i);\n        TEST_ASSERT_TRUE(strcmp(A[i], s) == 0)\n    }\n\n    char *file_name = \"test_unordered_list_store_load_c_str.dat\";\n    FILE *f = fopen(file_name, \"wb\");\n\n    unordered_list_store(ul, f, file_name, c_str_store);\n\n    fclose(f);\n\n    f = fopen(file_name, \"rb\");\n\n    struct unordered_list *ul_2 = unordered_list_load(f,\n                                                    file_name,\n                                                    c_str_load);\n\n    for (i = 0; i < 10; ++i) {\n        char *s = unordered_list_get(ul, i);\n        char *s_2 = unordered_list_get(ul_2, i);\n        TEST_ASSERT_TRUE(strcmp(s, s_2) == 0)\n    }\n\n    unordered_list_destroy(&ul, free_wrapper);\n    unordered_list_destroy(&ul_2, free_wrapper);\n    remove(file_name);\n}\n//}}}\n\n//{{{void test_ordered_set_add(void)\nvoid test_ordered_set_add(void)\n{\n    struct ordered_set *os = ordered_set_init(3,\n                                              str_uint_pair_sort_element_cmp,\n                                              str_uint_pair_search_element_cmp,\n                                              str_uint_pair_search_key_cmp);\n    struct str_uint_pair *p = (struct str_uint_pair *)\n            malloc(sizeof(struct str_uint_pair));\n    p->uint = os->num;\n    p->str = strdup(\"one\");\n\n    struct str_uint_pair *r = (struct str_uint_pair *)\n            ordered_set_add(os, p);\n\n    TEST_ASSERT_EQUAL(0, r->uint);\n\n\n    p = (struct str_uint_pair *) malloc(sizeof(struct str_uint_pair));\n    p->uint = os->num;\n    p->str = strdup(\"two\");\n\n    r = (struct str_uint_pair *) ordered_set_add(os, p);\n    TEST_ASSERT_EQUAL(1, r->uint);\n\n    p = (struct str_uint_pair *) malloc(sizeof(struct str_uint_pair));\n    p->uint = os->num;\n    p->str = strdup(\"one\");\n\n    r = (struct str_uint_pair *) ordered_set_add(os, p);\n    TEST_ASSERT_EQUAL(0, r->uint);\n    str_uint_pair_free((void **)&p);\n\n    p = (struct str_uint_pair *) malloc(sizeof(struct str_uint_pair));\n    p->uint = os->num;\n    p->str = strdup(\"three\");\n\n    r = (struct str_uint_pair *) ordered_set_add(os, p);\n    TEST_ASSERT_EQUAL(2, r->uint);\n\n    p = (struct str_uint_pair *) malloc(sizeof(struct str_uint_pair));\n    p->uint = os->num;\n    p->str = strdup(\"four\");\n\n    r = (struct str_uint_pair *) ordered_set_add(os, p);\n    TEST_ASSERT_EQUAL(3, r->uint);\n\n    ordered_set_destroy(&os, str_uint_pair_free);\n}\n//}}}\n\n//{{{void test_ordered_set_get(void)\nvoid test_ordered_set_get(void)\n{\n    struct ordered_set *os = ordered_set_init(3,\n                                              str_uint_pair_sort_element_cmp,\n                                              str_uint_pair_search_element_cmp,\n                                              str_uint_pair_search_key_cmp);\n    struct str_uint_pair *p = (struct str_uint_pair *)\n            malloc(sizeof(struct str_uint_pair));\n    p->uint = os->num;\n    p->str = strdup(\"one\");\n    struct str_uint_pair *r = (struct str_uint_pair *)ordered_set_add(os, p);\n\n\n    p = (struct str_uint_pair *) malloc(sizeof(struct str_uint_pair));\n    p->uint = os->num;\n    p->str = strdup(\"three\");\n    r = (struct str_uint_pair *)ordered_set_add(os, p);\n\n    p = (struct str_uint_pair *) malloc(sizeof(struct str_uint_pair));\n    p->uint = os->num;\n    p->str = strdup(\"four\");\n    r = (struct str_uint_pair *)ordered_set_add(os, p);\n\n    p = (struct str_uint_pair *) malloc(sizeof(struct str_uint_pair));\n    p->uint = os->num;\n    p->str = strdup(\"two\");\n    r = (struct str_uint_pair *)ordered_set_add(os, p);\n\n    char *one = \"one\";\n    r = (struct str_uint_pair *) ordered_set_get(os, one);\n    TEST_ASSERT_EQUAL(0, r->uint);\n\n    char *two = \"two\";\n    r = (struct str_uint_pair *) ordered_set_get(os, two);\n    TEST_ASSERT_EQUAL(3, r->uint);\n\n    char *three = \"three\";\n    r = (struct str_uint_pair *) ordered_set_get(os, three);\n    TEST_ASSERT_EQUAL(1, r->uint);\n\n    char *four = \"four\";\n    r = (struct str_uint_pair *) ordered_set_get(os, four);\n    TEST_ASSERT_EQUAL(2, r->uint);\n\n    ordered_set_destroy(&os, str_uint_pair_free);\n}\n//}}}\n\n//{{{void test_ordered_set_store_load(void)\nvoid test_ordered_set_store_load(void)\n{\n    struct ordered_set *os = ordered_set_init(3,\n                                              str_uint_pair_sort_element_cmp,\n                                              str_uint_pair_search_element_cmp,\n                                              str_uint_pair_search_key_cmp);\n    struct str_uint_pair *p = (struct str_uint_pair *)\n            malloc(sizeof(struct str_uint_pair));\n    p->uint = os->num;\n    p->str = strdup(\"one\");\n    struct str_uint_pair *r = (struct str_uint_pair *)ordered_set_add(os, p);\n\n\n    p = (struct str_uint_pair *) malloc(sizeof(struct str_uint_pair));\n    p->uint = os->num;\n    p->str = strdup(\"three\");\n    r = (struct str_uint_pair *)ordered_set_add(os, p);\n\n    p = (struct str_uint_pair *) malloc(sizeof(struct str_uint_pair));\n    p->uint = os->num;\n    p->str = strdup(\"four\");\n    r = (struct str_uint_pair *)ordered_set_add(os, p);\n\n    p = (struct str_uint_pair *) malloc(sizeof(struct str_uint_pair));\n    p->uint = os->num;\n    p->str = strdup(\"two\");\n    r = (struct str_uint_pair *)ordered_set_add(os, p);\n\n    char *file_name = \"test_ordered_set_store_load.dat\"; \n    FILE *f = fopen(file_name, \"wb\");\n    ordered_set_store(os, f, file_name,  str_uint_pair_store);\n    fclose(f);\n\n    f = fopen(file_name, \"rb\");\n\n    struct ordered_set *os_2 = ordered_set_load(\n                f,\n                file_name,\n                str_uint_pair_load,\n                str_uint_pair_sort_element_cmp,\n                str_uint_pair_search_element_cmp,\n                str_uint_pair_search_key_cmp);\n\n    fclose(f);\n\n    TEST_ASSERT_EQUAL(os->num, os_2->num);\n    TEST_ASSERT_EQUAL(os->size, os_2->size);\n\n    struct str_uint_pair *r_2;\n\n    char *one = \"one\";\n    r = (struct str_uint_pair *) ordered_set_get(os, one);\n    r_2 = (struct str_uint_pair *) ordered_set_get(os_2, one);\n    TEST_ASSERT_EQUAL(r->uint, r_2->uint);\n\n    char *two = \"two\";\n    r = (struct str_uint_pair *) ordered_set_get(os, two);\n    r_2 = (struct str_uint_pair *) ordered_set_get(os_2, two);\n    TEST_ASSERT_EQUAL(r->uint, r_2->uint);\n\n    char *three = \"three\";\n    r = (struct str_uint_pair *) ordered_set_get(os, three);\n    r_2 = (struct str_uint_pair *) ordered_set_get(os_2, three);\n    TEST_ASSERT_EQUAL(r->uint, r_2->uint);\n\n    char *four = \"four\";\n    r = (struct str_uint_pair *) ordered_set_get(os, four);\n    r_2 = (struct str_uint_pair *) ordered_set_get(os_2, four);\n    TEST_ASSERT_EQUAL(r->uint, r_2->uint);\n\n    ordered_set_destroy(&os, str_uint_pair_free);\n    ordered_set_destroy(&os_2, str_uint_pair_free);\n    remove(file_name);\n}\n//}}}\n\n//{{{void test_uint_pair(void)\nvoid test_uint_pair(void)\n{\n    /*\n    struct uint_pair\n    {\n        uint32_t first,second;\n    };\n    int uint_pair_sort_by_first_element_cmp(const void *a, const void *b);\n    int uint_pair_search_by_first_element_cmp(const void *a, const void *b);\n    int uint_pair_search_by_first_cmp(const void *a, const void *b);\n    */\n\n\n    struct ordered_set *os =\n            ordered_set_init(3,\n                             uint_pair_sort_by_first_element_cmp,\n                             uint_pair_search_by_first_element_cmp,\n                             uint_pair_search_by_first_key_cmp);\n\n    struct uint_pair *p = (struct uint_pair *)\n            malloc(sizeof(struct uint_pair));\n    p->first = 10;\n    p->second = os->num;\n    struct uint_pair *r = ordered_set_add(os, p);\n\n    p = (struct uint_pair *) malloc(sizeof(struct uint_pair));\n    p->first = 50;\n    p->second = os->num;\n    r = ordered_set_add(os, p);\n\n    p = (struct uint_pair *) malloc(sizeof(struct uint_pair));\n    p->first = 1;\n    p->second = os->num;\n    r = ordered_set_add(os, p);\n\n    p = (struct uint_pair *) malloc(sizeof(struct uint_pair));\n    p->first = 100;\n    p->second = os->num;\n    r = ordered_set_add(os, p);\n\n\n    uint32_t k = 100;\n    r = ordered_set_get(os, &k);\n    TEST_ASSERT_EQUAL(3, r->second);\n\n    k = 1;\n    r = ordered_set_get(os, &k);\n    TEST_ASSERT_EQUAL(2, r->second);\n\n    k = 50;\n    r = ordered_set_get(os, &k);\n    TEST_ASSERT_EQUAL(1, r->second);\n\n    k = 10;\n    r = ordered_set_get(os, &k);\n    TEST_ASSERT_EQUAL(0, r->second);\n\n    k = 70;\n    r = ordered_set_get(os, &k);\n    TEST_ASSERT_EQUAL(NULL, r);\n\n    p = (struct uint_pair *) malloc(sizeof(struct uint_pair));\n    p->first = 100;\n    p->second = os->num;\n    r = ordered_set_add(os, p);\n    TEST_ASSERT_EQUAL(3, r->second);\n\n\n    ordered_set_destroy(&os, free_wrapper);\n\n    TEST_ASSERT_EQUAL(NULL, os);\n    free(p);\n}\n//}}}\n\n//{{{void test_fifo_q(void)\nvoid test_fifo_q(void)\n{\n    int V[5] = {1,2,3,4,5};\n\n    struct fifo_q *q = NULL;\n    int *r = (int *)fifo_q_peek(q);\n    TEST_ASSERT_EQUAL(NULL, r);\n\n    fifo_q_push(&q, V);\n    r = (int *)fifo_q_peek(q);\n    TEST_ASSERT_EQUAL(V[0], *r);\n\n    r = (int *)fifo_q_pop(&q);\n    TEST_ASSERT_EQUAL(V[0], *r);\n    TEST_ASSERT_EQUAL(NULL, q);\n    r = (int *)fifo_q_peek(q);\n    TEST_ASSERT_EQUAL(NULL, r);\n\n    int v = 0;\n    fifo_q_push(&q, V + v++);\n    fifo_q_push(&q, V + v++);\n    fifo_q_push(&q, V + v++);\n    fifo_q_push(&q, V + v++);\n    fifo_q_push(&q, V + v++);\n\n    r = (int *)fifo_q_peek(q);\n    TEST_ASSERT_EQUAL(V[0], *r);\n\n    r = (int *)fifo_q_pop(&q);\n    TEST_ASSERT_EQUAL(V[0], *r);\n    r = (int *)fifo_q_pop(&q);\n    TEST_ASSERT_EQUAL(V[1], *r);\n    r = (int *)fifo_q_pop(&q);\n    TEST_ASSERT_EQUAL(V[2], *r);\n    r = (int *)fifo_q_pop(&q);\n    TEST_ASSERT_EQUAL(V[3], *r);\n    r = (int *)fifo_q_pop(&q);\n    TEST_ASSERT_EQUAL(V[4], *r);\n    TEST_ASSERT_EQUAL(NULL, q);\n}\n//}}}\n\n//{{{ void test_pointer_uint_pair(void)\nvoid test_pointer_uint_pair(void)\n{\n\n    int V[10] = {1,2,3,4};\n\n    struct ordered_set *os =\n            ordered_set_init(3,\n                             pointer_uint_pair_sort_element_cmp,\n                             pointer_uint_pair_search_element_cmp,\n                             pointer_uint_pair_search_key_cmp);\n\n    struct pointer_uint_pair *p = (struct pointer_uint_pair *)\n            malloc(sizeof(struct pointer_uint_pair));\n    p->pointer = V+3;\n    p->uint = 3;\n\n    struct pointer_uint_pair *r = (struct pointer_uint_pair *)\n            ordered_set_add(os, p);\n\n    p = (struct pointer_uint_pair *)\n            malloc(sizeof(struct pointer_uint_pair));\n    p->pointer = V+1;\n    p->uint = 1;\n    r = (struct pointer_uint_pair *) ordered_set_add(os, p);\n\n    p = (struct pointer_uint_pair *)\n            malloc(sizeof(struct pointer_uint_pair));\n    p->pointer = V;\n    p->uint = 0;\n    r = (struct pointer_uint_pair *) ordered_set_add(os, p);\n\n    r = (struct pointer_uint_pair *) ordered_set_get(os, V);\n    TEST_ASSERT_EQUAL(0,r->uint);\n    r = (struct pointer_uint_pair *) ordered_set_get(os, V+1);\n    TEST_ASSERT_EQUAL(1,r->uint);\n    r = (struct pointer_uint_pair *) ordered_set_get(os, V+3);\n    TEST_ASSERT_EQUAL(3,r->uint);\n    r = (struct pointer_uint_pair *) ordered_set_get(os, V+2);\n    TEST_ASSERT_EQUAL(NULL,r);\n\n    ordered_set_destroy(&os, free_wrapper);\n}\n//}}}\n\n//{{{ void test_pointer_uint_pair(void)\nvoid test_uint_offset_size_pair(void)\n{\n    struct ordered_set *os =\n            ordered_set_init(3,\n                             uint_offset_size_pair_sort_element_cmp,\n                             uint_offset_size_pair_search_element_cmp,\n                             uint_offset_size_pair_search_key_cmp);\n\n    struct uint_offset_size_pair *p = (struct uint_offset_size_pair *)\n            malloc(sizeof(struct uint_offset_size_pair));\n    p->uint = 1;\n    p->offset = 50;\n    struct uint_offset_size_pair *r = (struct uint_offset_size_pair *)\n            ordered_set_add(os, p);\n\n    p = (struct uint_offset_size_pair *)\n            malloc(sizeof(struct uint_offset_size_pair));\n    p->uint = 5;\n    p->offset = 200;\n    r = (struct uint_offset_size_pair *) ordered_set_add(os, p);\n\n    p = (struct uint_offset_size_pair *)\n            malloc(sizeof(struct uint_offset_size_pair));\n    p->uint = 2;\n    p->offset = 100;\n    r = (struct uint_offset_size_pair *) ordered_set_add(os, p);\n\n    p = (struct uint_offset_size_pair *)\n            malloc(sizeof(struct uint_offset_size_pair));\n    p->uint = 4;\n    p->offset = 175;\n    r = (struct uint_offset_size_pair *) ordered_set_add(os, p);\n\n    p = (struct uint_offset_size_pair *)\n            malloc(sizeof(struct uint_offset_size_pair));\n    p->uint = 3;\n    p->offset = 150;\n    r = (struct uint_offset_size_pair *) ordered_set_add(os, p);\n\n\n    uint32_t s = 1;\n    r = (struct uint_offset_size_pair *) ordered_set_get(os, &s);\n    TEST_ASSERT_EQUAL(50,r->offset);\n\n    s = 2;\n    r = (struct uint_offset_size_pair *) ordered_set_get(os, &s);\n    TEST_ASSERT_EQUAL(100,r->offset);\n\n    s = 3;\n    r = (struct uint_offset_size_pair *) ordered_set_get(os, &s);\n    TEST_ASSERT_EQUAL(150,r->offset);\n\n    s = 4;\n    r = (struct uint_offset_size_pair *) ordered_set_get(os, &s);\n    TEST_ASSERT_EQUAL(175,r->offset);\n\n    s = 5;\n    r = (struct uint_offset_size_pair *) ordered_set_get(os, &s);\n    TEST_ASSERT_EQUAL(200,r->offset);\n\n    s = 7;\n    r = (struct uint_offset_size_pair *) ordered_set_get(os, &s);\n    TEST_ASSERT_EQUAL(NULL, r);\n\n    s = 0;\n    r = (struct uint_offset_size_pair *) ordered_set_get(os, &s);\n    TEST_ASSERT_EQUAL(NULL, r);\n\n    ordered_set_destroy(&os, free_wrapper);\n}\n//}}}\n\n//{{{void test_byte_array(void)\nvoid test_byte_array(void)\n{\n    struct byte_array *ba = byte_array_init(3 * sizeof(uint32_t));\n    TEST_ASSERT_EQUAL(0, ba->num);\n    TEST_ASSERT_EQUAL(3 * sizeof(uint32_t), ba->size);\n\n    uint64_t A[3] = {2,4,6};\n    uint32_t B[3] = {1,2,3};\n\n    byte_array_append(ba, A, 3*sizeof(uint64_t));\n    TEST_ASSERT_EQUAL(3*sizeof(uint64_t), ba->num);\n\n    byte_array_append(ba, B, 3*sizeof(uint32_t));\n    TEST_ASSERT_EQUAL(3*sizeof(uint64_t) + 3*sizeof(uint32_t), ba->num);\n\n    uint64_t *A_r = (uint64_t *)(ba->data);\n    TEST_ASSERT_EQUAL(A[0], A_r[0]);\n    TEST_ASSERT_EQUAL(A[1], A_r[1]);\n    TEST_ASSERT_EQUAL(A[2], A_r[2]);\n\n    uint32_t *B_r = (uint32_t *)(ba->data + 3*sizeof(uint64_t));\n    TEST_ASSERT_EQUAL(B[0], B_r[0]);\n    TEST_ASSERT_EQUAL(B[1], B_r[1]);\n    TEST_ASSERT_EQUAL(B[2], B_r[2]);\n\n    byte_array_append_zeros(ba, 5*sizeof(uint32_t));\n    byte_array_append(ba, B, 3*sizeof(uint32_t));\n    B_r = (uint32_t *)(ba->data + 3*sizeof(uint64_t));\n    TEST_ASSERT_EQUAL(0,  B_r[3]);\n    TEST_ASSERT_EQUAL(0,  B_r[4]);\n    TEST_ASSERT_EQUAL(0,  B_r[5]);\n    TEST_ASSERT_EQUAL(0,  B_r[6]);\n    TEST_ASSERT_EQUAL(0,  B_r[7]);\n    TEST_ASSERT_EQUAL(B[0], B_r[8]);\n    TEST_ASSERT_EQUAL(B[1], B_r[9]);\n    TEST_ASSERT_EQUAL(B[2], B_r[10]);\n\n    byte_array_destory(&ba);\n    TEST_ASSERT_EQUAL(NULL, ba);\n}\n//}}}\n\n//{{{void test_indexed_list(void)\nvoid test_indexed_list(void)\n{\n    struct offset_size_pair p, *r;\n\n    uint64_t max_size = 50;\n\n    struct indexed_list *il =\n            indexed_list_init(5,\n                              sizeof(struct offset_size_pair));\n    uint64_t i;\n    for (i = 0; i < 5; ++i) {\n        p.offset = i;\n        p.size = i*2;\n        TEST_ASSERT_EQUAL(0, indexed_list_add(il, i, &p));\n    }\n\n    p.offset = i;\n    p.size = i*2;\n    TEST_ASSERT_EQUAL(1, indexed_list_add(il, i, &p));\n\n    i += 1;\n\n    for (; i < max_size; ++i) {\n        p.offset = i;\n        p.size = i*2;\n        indexed_list_add(il, i, &p);\n    }\n\n   for (i = 0; i < max_size; ++i) {\n        r = (struct offset_size_pair*)indexed_list_get(il, i);\n        TEST_ASSERT_EQUAL(i, r->offset);\n        TEST_ASSERT_EQUAL(i*2, r->size);\n    }\n\n    p.offset = 100;\n    p.size = 200;\n    TEST_ASSERT_EQUAL(1, indexed_list_add(il, 100, &p));\n\n    r = (struct offset_size_pair*)indexed_list_get(il, 100);\n    TEST_ASSERT_EQUAL(100, r->offset);\n    TEST_ASSERT_EQUAL(200, r->size);\n\n    for (i = 0; i < max_size; ++i) {\n        r = (struct offset_size_pair*)indexed_list_get(il, i);\n        TEST_ASSERT_EQUAL(i, r->offset);\n        TEST_ASSERT_EQUAL(i*2, r->size);\n    }\n\n    FILE *f = fopen(\"test_indexed_list.tmp\", \"wb\");\n    indexed_list_write(il, f, \"test_indexed_list.tmp\");\n    fclose(f);\n\n    f = fopen(\"test_indexed_list.tmp\", \"rb\");\n    struct indexed_list *il_1 = indexed_list_load(f, \"test_indexed_list.tmp\");\n    fclose(f);\n\n    struct offset_size_pair *a, *b;\n    for (i = 0; i < max_size; ++i) {\n        a = (struct offset_size_pair*)indexed_list_get(il, i);\n        b = (struct offset_size_pair*)indexed_list_get(il_1, i);\n        TEST_ASSERT_EQUAL(a->offset, b->offset);\n        TEST_ASSERT_EQUAL(a->size, b->size);\n    }\n\n    indexed_list_destroy(&il);\n    indexed_list_destroy(&il_1);\n    TEST_ASSERT_EQUAL(NULL, il);\n    TEST_ASSERT_EQUAL(NULL, il_1);\n    remove(\"test_indexed_list.tmp\");\n}\n//}}}\n\n//{{{ void test_indexed_list_nulls(void)\nvoid test_indexed_list_nulls(void)\n{\n    struct offset_size_pair p, *r;\n\n    uint32_t max_size = 50;\n\n    struct indexed_list *il =\n            indexed_list_init(max_size,\n                              sizeof(struct offset_size_pair));\n\n    uint32_t i;\n    for (i = 0; i < max_size; ++i) {\n        r = (struct offset_size_pair*)indexed_list_get(il, i);\n        TEST_ASSERT_EQUAL(NULL, r);\n    }\n\n    indexed_list_destroy(&il);\n    TEST_ASSERT_EQUAL(NULL, il);\n}\n//}}}\n\n//////{{{void test_cc_hash(void)\n////void test_cc_hash(void)\n////{\n////\n////    struct cc_hash *hash = cc_hash_init(2500);\n////\n////    uint32_t size = 1000;\n////    uint32_t K[size],V[size];\n////\n////    uint32_t i;\n////\n////    for (i = 0; i < size; ++i){\n////        V[i] = i * 3;\n////        K[i] = rand();\n////        int r = cc_hash_add(hash, K[i], V+i);\n////    }\n////\n////    for (i = 0; i < size; ++i){\n////        uint32_t *r = (uint32_t *)cc_hash_get(hash, K[i]);\n////        TEST_ASSERT_EQUAL(V[i], *r);\n////    }\n////\n////    for (i = 0; i < size; ++i){\n////        uint32_t *r = (uint32_t *)cc_hash_remove(hash, K[i]);\n////        TEST_ASSERT_EQUAL(V[i], *r);\n////        r = (uint32_t *)cc_hash_remove(hash, K[i]);\n////        TEST_ASSERT_EQUAL(NULL, r);\n////    }\n////\n////    cc_hash_destroy(&hash);\n////}\n//////}}}\n//\n////{{{void test_lru_cache(void)\n////void test_lru_cache(void)\n////{\n////    struct lru_cache *lruc = lru_cache_init(5, NULL);\n////\n////    int V[10] = {2,4,6,8,10,12,14,16,18,20};\n////\n////    lru_cache_add(lruc, 1, V, NULL);\n////    TEST_ASSERT_EQUAL(1, lruc->seen);\n////\n////    TEST_ASSERT_EQUAL(V, lruc->head->value);\n////    TEST_ASSERT_EQUAL(V, lruc->tail->value);\n////\n////    int *r = (int *)lru_cache_get(lruc, 1);\n////\n////    TEST_ASSERT_EQUAL(V[0], *r);\n////    TEST_ASSERT_EQUAL(NULL, lru_cache_get(lruc, 2));\n////\n////    lru_cache_add(lruc, 2, V+1, NULL);\n////    TEST_ASSERT_EQUAL(2, lruc->seen);\n////\n////    TEST_ASSERT_EQUAL(V, lruc->head->value);\n////    TEST_ASSERT_EQUAL(V+1, lruc->tail->value);\n////\n////    r = (int *)lru_cache_get(lruc, 1);\n////\n////    TEST_ASSERT_EQUAL(V+1, lruc->head->value);\n////    TEST_ASSERT_EQUAL(V, lruc->tail->value);\n////\n////    lru_cache_add(lruc, 3, V+2, NULL);\n////    TEST_ASSERT_EQUAL(3, lruc->seen);\n////    lru_cache_add(lruc, 4, V+3, NULL);\n////    TEST_ASSERT_EQUAL(4, lruc->seen);\n////    lru_cache_add(lruc, 5, V+4, NULL);\n////    TEST_ASSERT_EQUAL(5, lruc->seen);\n////    lru_cache_add(lruc, 6, V+5, NULL);\n////    TEST_ASSERT_EQUAL(6, lruc->seen);\n////\n////    TEST_ASSERT_EQUAL(NULL, lru_cache_get(lruc, 2));\n////    r = (int *)lru_cache_get(lruc, 1);\n////    TEST_ASSERT_EQUAL(V[0], *r);\n////    r = (int *)lru_cache_get(lruc, 3);\n////    TEST_ASSERT_EQUAL(V[2], *r);\n////    r = (int *)lru_cache_get(lruc, 4);\n////    TEST_ASSERT_EQUAL(V[3], *r);\n////    r = (int *)lru_cache_get(lruc, 5);\n////    TEST_ASSERT_EQUAL(V[4], *r);\n////    r = (int *)lru_cache_get(lruc, 6);\n////    TEST_ASSERT_EQUAL(V[5], *r);\n////\n////    TEST_ASSERT_EQUAL(6, lruc->seen);\n////\n////    lru_cache_destroy((void **)&lruc);\n////}\n/////}}}\n//\n////{{{void test_simple_cache(void)\n//void test_simple_cache(void)\n//{\n//    struct simple_cache *sc = simple_cache_init(5, NULL);\n//\n//    int V[10] = {2,4,6,8,10,12,14,16,18,20};\n//\n//    simple_cache_add(sc, 1, V, NULL);\n//    TEST_ASSERT_EQUAL(1, simple_cache_seen(sc));\n//\n//    int *r = (int *)simple_cache_get(sc, 1);\n//    TEST_ASSERT_EQUAL(V[0], *r);\n//\n//    uint32_t i;\n//    for (i = 1; i<10; ++i)\n//        simple_cache_add(sc, i+1, V+i, NULL);\n//    TEST_ASSERT_EQUAL(10, simple_cache_seen(sc));\n//\n//    for (i = 0; i<10; ++i) {\n//        int *r = (int *)simple_cache_get(sc, i+1);\n//        TEST_ASSERT_EQUAL(V[i], *r);\n//    }\n//\n//    simple_cache_destroy((void **)&sc);\n//}\n/////}}}\n//\n////{{{ void test_simple_cache_with_disk(void)\n//void test_simple_cache_with_disk(void)\n//{\n//    char *file_name = \"test_simple_cache_with_disk.out\";\n//    FILE *f = NULL;\n//    struct disk_store *ds = disk_store_init(10, &f, file_name);\n//    uint32_t V[5] = {2,4,6,8,10};\n//    uint32_t id = disk_store_append(ds, V, sizeof(uint32_t));\n//    id = disk_store_append(ds, V+1, sizeof(uint32_t));\n//    id = disk_store_append(ds, V+2, sizeof(uint32_t));\n//    id = disk_store_append(ds, V+3, sizeof(uint32_t));\n//    id = disk_store_append(ds, V+4, sizeof(uint32_t));\n//\n//    disk_store_destroy(&ds);\n//\n//    f = fopen(file_name, \"r+\");\n//\n//    struct simple_cache *sc = simple_cache_init(10, f);\n//\n//    TEST_ASSERT_EQUAL(5, sc->seen);\n//    TEST_ASSERT_EQUAL(5, sc->num);\n//    \n//    uint32_t *r = (uint32_t *)simple_cache_get(sc, 0);\n//    TEST_ASSERT_EQUAL(V[0], *r);\n//    r = (uint32_t *)simple_cache_get(sc, 1);\n//    TEST_ASSERT_EQUAL(V[1], *r);\n//\n//    r = (uint32_t *)simple_cache_get(sc, 1);\n//    TEST_ASSERT_EQUAL(V[1], *r);\n//\n//    r = (uint32_t *)simple_cache_get(sc, 2);\n//    TEST_ASSERT_EQUAL(V[2], *r);\n//    r = (uint32_t *)simple_cache_get(sc, 3);\n//    TEST_ASSERT_EQUAL(V[3], *r);\n//    r = (uint32_t *)simple_cache_get(sc, 4);\n//    TEST_ASSERT_EQUAL(V[4], *r);\n//\n//    simple_cache_destroy((void **)&sc);\n//}\n/////}}}\n\n//{{{ void test_bit_map(void)\nvoid test_bit_map(void)\n{\n    struct bit_map *bm = bit_map_init(100);\n\n    TEST_ASSERT_EQUAL(0, bit_map_get(bm, 1000));\n\n    bit_map_set(bm, 1000);\n\n    TEST_ASSERT_EQUAL(1, bit_map_get(bm, 1000));\n\n\n    uint32_t A[500];\n\n    uint32_t i;\n\n    A[0] = 1000;\n\n    for (i = 1; i < 500; ++i) {\n        A[i] = rand() % 10000;\n        bit_map_set(bm, A[i]);\n    }\n\n    qsort(A, 500, sizeof(uint32_t), uint32_t_cmp);\n\n    uint32_t j;\n    for (i = 0; i < 499; ++i)  {\n        TEST_ASSERT_EQUAL(1, bit_map_get(bm, A[i]));\n        for (j = A[i]+1; j < A[i+1]; ++j)\n            TEST_ASSERT_EQUAL(0, bit_map_get(bm, j));\n    }\n\n    char *file_name = \"test_bit_map.out\";\n\n    FILE *f = fopen(file_name, \"wb\");\n\n    bit_map_store(bm, f, file_name);\n\n    fclose(f);\n\n    f = fopen(file_name, \"rb\");\n    struct bit_map *bm_r = bit_map_load(f, file_name);\n    fclose(f);\n\n    TEST_ASSERT_EQUAL(bm->num_bits, bm_r->num_bits);\n    TEST_ASSERT_EQUAL(bm->num_ints, bm_r->num_ints);\n\n    for (i = 0; i < 499; ++i)  {\n        TEST_ASSERT_EQUAL(1, bit_map_get(bm_r, A[i]));\n        for (j = A[i]+1; j < A[i+1]; ++j)\n            TEST_ASSERT_EQUAL(0, bit_map_get(bm_r, j));\n    }\n\n\n    bit_map_destroy(&bm);\n    bit_map_destroy(&bm_r);\n    remove(file_name);\n}\n//}}}\n\n//{{{void test_uint32_t_array(void)\nvoid test_uint32_t_array(void)\n{\n    /*\nstruct uint32_t_array\n{\n    uint32_t num, size, *data;\n};\n\nstruct uint32_t_array *uint32_t_array_init(uint32_t init_size);\nvoid uint32_t_array_destroy(struct uint32_t_array **ua);\nuint32_t uint32_t_array_add(struct uint32_t_array *ua, uint32_t val);\nuint32_t *uint32_t_array_get(struct uint32_t_array *ua, uint32_t index);\n*/\n\n    struct uint32_t_array *ua = uint32_t_array_init(10);\n\n    TEST_ASSERT_EQUAL(10, ua->size);\n    TEST_ASSERT_EQUAL(0, ua->num);\n\n    uint32_t ret = uint32_t_array_add(ua, 5);\n\n    TEST_ASSERT_EQUAL(10, ua->size);\n    TEST_ASSERT_EQUAL(0, ret);\n    TEST_ASSERT_EQUAL(1, ua->num);\n    TEST_ASSERT_EQUAL(5, ua->data[0]);\n\n    uint32_t *ret_p = uint32_t_array_get(ua, 0);\n    TEST_ASSERT_EQUAL(5, *ret_p);\n\n    ret_p = uint32_t_array_get(ua, 100);\n    TEST_ASSERT_EQUAL(NULL, ret_p);\n\n\n    uint32_t i;\n    for (i = 0; i < 10; ++i) {\n        ret = uint32_t_array_add(ua, 5);\n        TEST_ASSERT_EQUAL(i + 1, ret);\n    }\n\n    TEST_ASSERT_EQUAL(20, ua->size);\n    TEST_ASSERT_EQUAL(11, ua->num);\n   \n    uint32_t_array_destroy(&ua);\n\n    TEST_ASSERT_EQUAL(NULL, ua);\n}\n//}}}\n"
  },
  {
    "path": "test/unit/test_ll.c",
    "content": "#include <stdio.h>\n#include <stdlib.h>\n#include <math.h>\n#include <stdio.h>\n#include <inttypes.h>\n#include <string.h>\n\n#include \"unity.h\"\n#include \"util.h\"\n#include \"bpt.h\"\n#include \"ll.h\"\n\nvoid setUp(void) { }\nvoid tearDown(void) { }\n\n//{{{void test_uint64_t_ll_append(void)\nvoid test_uint64_t_ll_append(void)\n{\n    struct uint64_t_ll *ll = NULL;\n\n    uint64_t_ll_append(&ll, 1);\n    uint64_t_ll_append(&ll, 2);\n    uint64_t_ll_append(&ll, 5);\n\n    TEST_ASSERT_EQUAL(1, ll->head->val);\n    TEST_ASSERT_EQUAL(2, ll->head->next->val);\n    TEST_ASSERT_EQUAL(5, ll->head->next->next->val);\n\n    uint64_t_ll_free((void **)&ll);\n\n    TEST_ASSERT_EQUAL(NULL, ll);\n}\n//}}}\n\n//{{{void test_uint64_t_ll_remove(void)\nvoid test_uint64_t_ll_remove(void)\n{\n    struct uint64_t_ll *ll = NULL;\n\n    uint64_t_ll_append(&ll, 1);\n    uint64_t_ll_remove(&ll, 1);\n\n    TEST_ASSERT_EQUAL(NULL, ll);\n\n\n    uint64_t_ll_append(&ll, 1);\n    uint64_t_ll_append(&ll, 2);\n\n    uint64_t_ll_remove(&ll, 1);\n    TEST_ASSERT_EQUAL(2, ll->head->val);\n    uint64_t_ll_remove(&ll, 1);\n    TEST_ASSERT_EQUAL(2, ll->head->val);\n    uint64_t_ll_remove(&ll, 2);\n    TEST_ASSERT_EQUAL(NULL, ll);\n\n\n    uint64_t_ll_append(&ll, 1);\n    uint64_t_ll_append(&ll, 2);\n    uint64_t_ll_append(&ll, 5);\n\n    uint64_t_ll_remove(&ll, 2);\n    TEST_ASSERT_EQUAL(1, ll->head->val);\n    TEST_ASSERT_EQUAL(5, ll->head->next->val);\n    uint64_t_ll_remove(&ll, 5);\n    uint64_t_ll_remove(&ll, 1);\n    TEST_ASSERT_EQUAL(NULL, ll);\n\n    uint64_t_ll_free((void **)&ll);\n\n    TEST_ASSERT_EQUAL(NULL, ll);\n}\n//}}}\n\n//{{{void test_uint64_t_ll_contains(void)\nvoid test_uint64_t_ll_contains(void)\n{\n    struct uint64_t_ll *ll = NULL;\n\n    TEST_ASSERT_EQUAL(0, uint64_t_ll_contains(ll, 1));\n    \n    uint64_t_ll_append(&ll, 1);\n    TEST_ASSERT_EQUAL(1, uint64_t_ll_contains(ll, 1));\n\n    uint64_t_ll_append(&ll, 1);\n    TEST_ASSERT_EQUAL(2, uint64_t_ll_contains(ll, 1));\n\n    uint64_t_ll_remove(&ll, 1);\n    TEST_ASSERT_EQUAL(0, uint64_t_ll_contains(ll, 1));\n\n\n    uint64_t_ll_append(&ll, 1);\n    uint64_t_ll_append(&ll, 2);\n    uint64_t_ll_append(&ll, 5);\n\n    TEST_ASSERT_EQUAL(1, uint64_t_ll_contains(ll, 5));\n    TEST_ASSERT_EQUAL(1, uint64_t_ll_contains(ll, 1));\n    TEST_ASSERT_EQUAL(1, uint64_t_ll_contains(ll, 2));\n\n    TEST_ASSERT_EQUAL(0, uint64_t_ll_contains(ll, 7));\n\n    uint64_t_ll_free((void **)&ll);\n\n}\n//}}}\n"
  },
  {
    "path": "test/unit/test_offset_index.c",
    "content": "#define _GNU_SOURCE\n\n#include \"util.h\"\n\n#include <stdbool.h>\n#include <stdio.h>\n#include <stdlib.h>\n#include <math.h>\n#include <stdio.h>\n#include <inttypes.h>\n#include <string.h>\n#include <err.h>\n#include <sysexits.h>\n#include <glob.h>\n#include <string.h>\n#include <htslib/kstring.h>\n\n#include \"unity.h\"\n#include \"bpt.h\"\n#include \"giggle_index.h\"\n#include \"lists.h\"\n#include \"file_read.h\"\n#include \"wah.h\"\n#include \"ll.h\"\n#include \"jsw_avltree.h\"\n#include \"pq.h\"\n\n#define MIN(X, Y) (((X) < (Y)) ? (X) : (Y))\n#define MAX(X, Y) (((X) > (Y)) ? (X) : (Y))\n\n\nvoid setUp(void) { }\nvoid tearDown(void) { }\n\n//{{{ void test_offset_index_add_no_data(void)\nvoid test_offset_index_add_no_data(void)\n{ \n    //{{{ uint32_t A_offsets[1000] = \n    uint32_t A_offsets[1000] = {0, 61, 118, 173, 230, 292, 350, 412, 476, 534,\n        599, 661, 726, 784, 841, 899, 964, 1026, 1085, 1145, 1204, 1267, 1330,\n        1388, 1447, 1508, 1566, 1627, 1686, 1747, 1810, 1873, 1935, 1992, 2050,\n        2108, 2167, 2226, 2285, 2344, 2401, 2460, 2519, 2578, 2636, 2702, 2766,\n        2826, 2886, 2947, 3009, 3069, 3128, 3188, 3248, 3312, 3375, 3441, 3499,\n        3559, 3622, 3683, 3746, 3804, 3863, 3922, 3983, 4043, 4104, 4164, 4225,\n        4285, 4352, 4413, 4480, 4544, 4607, 4668, 4729, 4792, 4853, 4917, 4978,\n        5037, 5101, 5161, 5218, 5285, 5346, 5409, 5465, 5526, 5583, 5645, 5706,\n        5767, 5827, 5887, 5950, 6010, 6069, 6133, 6193, 6254, 6316, 6375, 6435,\n        6494, 6557, 6616, 6676, 6736, 6796, 6855, 6915, 6975, 7033, 7092, 7158,\n        7218, 7277, 7337, 7397, 7455, 7518, 7577, 7637, 7701, 7761, 7822, 7885,\n        7951, 8016, 8078, 8140, 8202, 8264, 8326, 8388, 8453, 8513, 8575, 8636,\n        8698, 8752, 8810, 8868, 8926, 8985, 9043, 9103, 9162, 9222, 9282, 9341,\n        9401, 9461, 9524, 9583, 9641, 9700, 9762, 9822, 9882, 9945, 10008,\n        10065, 10128, 10188, 10248, 10308, 10370, 10427, 10487, 10547, 10606,\n        10665, 10726, 10788, 10853, 10914, 10976, 11039, 11104, 11168, 11229,\n        11291, 11355, 11413, 11470, 11525, 11584, 11641, 11698, 11755, 11815,\n        11877, 11936, 11999, 12058, 12120, 12184, 12244, 12304, 12364, 12427,\n        12491, 12549, 12610, 12674, 12738, 12803, 12869, 12929, 12990, 13049,\n        13111, 13171, 13233, 13296, 13356, 13416, 13480, 13539, 13599, 13663,\n        13725, 13787, 13851, 13913, 13978, 14044, 14105, 14166, 14226, 14288,\n        14351, 14411, 14471, 14530, 14589, 14651, 14715, 14773, 14832, 14893,\n        14957, 15016, 15075, 15135, 15194, 15253, 15313, 15373, 15432, 15491,\n        15550, 15610, 15670, 15731, 15790, 15848, 15910, 15970, 16033, 16092,\n        16156, 16216, 16276, 16335, 16392, 16452, 16511, 16569, 16628, 16686,\n        16746, 16804, 16870, 16932, 16993, 17055, 17116, 17176, 17235, 17297,\n        17357, 17415, 17474, 17537, 17596, 17656, 17717, 17779, 17839, 17899,\n        17958, 18018, 18079, 18138, 18200, 18259, 18317, 18376, 18439, 18503,\n        18566, 18625, 18687, 18748, 18808, 18870, 18931, 18991, 19054, 19115,\n        19175, 19234, 19296, 19358, 19417, 19475, 19536, 19596, 19658, 19716,\n        19776, 19837, 19899, 19958, 20016, 20073, 20137, 20203, 20262, 20321,\n        20382, 20441, 20504, 20564, 20629, 20688, 20747, 20806, 20865, 20923,\n        20982, 21041, 21103, 21164, 21222, 21285, 21341, 21398, 21457, 21516,\n        21575, 21634, 21694, 21757, 21822, 21881, 21941, 22000, 22059, 22123,\n        22181, 22239, 22297, 22355, 22411, 22470, 22531, 22595, 22654, 22715,\n        22778, 22839, 22898, 22956, 23016, 23080, 23140, 23199, 23259, 23319,\n        23382, 23445, 23504, 23564, 23626, 23693, 23757, 23816, 23876, 23936,\n        23996, 24055, 24113, 24172, 24232, 24293, 24353, 24415, 24474, 24536,\n        24594, 24653, 24712, 24776, 24840, 24896, 24956, 25012, 25069, 25128,\n        25184, 25244, 25303, 25364, 25424, 25487, 25546, 25606, 25664, 25722,\n        25784, 25843, 25902, 25962, 26021, 26079, 26138, 26200, 26259, 26321,\n        26382, 26443, 26505, 26563, 26620, 26682, 26738, 26798, 26856, 26915,\n        26975, 27036, 27098, 27158, 27221, 27283, 27343, 27406, 27466, 27525,\n        27587, 27646, 27705, 27767, 27828, 27887, 27947, 28006, 28065, 28131,\n        28191, 28254, 28314, 28372, 28431, 28491, 28551, 28615, 28681, 28741,\n        28800, 28859, 28919, 28978, 29038, 29104, 29165, 29225, 29287, 29344,\n        29401, 29458, 29519, 29578, 29636, 29695, 29754, 29812, 29871, 29934,\n        29996, 30057, 30116, 30174, 30233, 30291, 30352, 30411, 30473, 30531,\n        30592, 30652, 30716, 30775, 30834, 30896, 30959, 31016, 31074, 31133,\n        31194, 31254, 31317, 31376, 31436, 31497, 31558, 31618, 31678, 31739,\n        31802, 31865, 31928, 31988, 32048, 32106, 32167, 32231, 32290, 32355,\n        32414, 32474, 32534, 32599, 32660, 32721, 32781, 32842, 32905, 32966,\n        33027, 33090, 33151, 33213, 33278, 33338, 33399, 33460, 33520, 33578,\n        33639, 33699, 33759, 33819, 33878, 33941, 34001, 34065, 34125, 34185,\n        34245, 34304, 34362, 34421, 34487, 34546, 34605, 34664, 34724, 34787,\n        34846, 34905, 34967, 35027, 35089, 35148, 35207, 35267, 35329, 35389,\n        35451, 35511, 35570, 35630, 35691, 35755, 35814, 35873, 35935, 35998,\n        36064, 36124, 36183, 36247, 36310, 36369, 36430, 36489, 36551, 36611,\n        36670, 36730, 36790, 36850, 36914, 36974, 37033, 37093, 37152, 37210,\n        37269, 37327, 37390, 37455, 37512, 37571, 37631, 37687, 37743, 37806,\n        37864, 37922, 37985, 38043, 38102, 38164, 38223, 38280, 38341, 38399,\n        38461, 38522, 38583, 38642, 38700, 38760, 38822, 38882, 38940, 38999,\n        39064, 39124, 39185, 39248, 39309, 39369, 39434, 39495, 39556, 39616,\n        39680, 39741, 39802, 39862, 39925, 39990, 40052, 40116, 40177, 40237,\n        40298, 40359, 40418, 40479, 40540, 40599, 40665, 40726, 40787, 40850,\n        40914, 40970, 41027, 41085, 41141, 41202, 41260, 41322, 41379, 41438,\n        41498, 41552, 41614, 41677, 41738, 41797, 41860, 41918, 41975, 42032,\n        42091, 42150, 42209, 42267, 42329, 42387, 42448, 42509, 42569, 42630,\n        42690, 42751, 42814, 42874, 42934, 42995, 43059, 43119, 43182, 43245,\n        43304, 43366, 43430, 43486, 43544, 43602, 43661, 43718, 43777, 43836,\n        43895, 43953, 44014, 44073, 44132, 44190, 44249, 44312, 44369, 44431,\n        44489, 44548, 44609, 44674, 44735, 44797, 44858, 44919, 44984, 45045,\n        45103, 45168, 45228, 45290, 45349, 45412, 45475, 45538, 45598, 45659,\n        45719, 45784, 45847, 45910, 45971, 46032, 46093, 46157, 46218, 46280,\n        46344, 46405, 46465, 46526, 46590, 46650, 46714, 46774, 46833, 46893,\n        46953, 47017, 47077, 47131, 47186, 47245, 47305, 47361, 47420, 47476,\n        47533, 47588, 47647, 47706, 47765, 47824, 47883, 47942, 48003, 48061,\n        48121, 48180, 48239, 48298, 48360, 48422, 48478, 48536, 48598, 48663,\n        48724, 48785, 48844, 48908, 48967, 49026, 49086, 49145, 49204, 49263,\n        49325, 49383, 49443, 49506, 49570, 49630, 49691, 49751, 49812, 49873,\n        49933, 49996, 50063, 50127, 50188, 50249, 50309, 50370, 50430, 50490,\n        50551, 50605, 50658, 50712, 50769, 50827, 50887, 50943, 51003, 51066,\n        51125, 51183, 51242, 51303, 51361, 51419, 51481, 51539, 51598, 51657,\n        51715, 51778, 51836, 51894, 51955, 52013, 52074, 52137, 52201, 52265,\n        52325, 52387, 52451, 52515, 52574, 52641, 52701, 52764, 52824, 52884,\n        52947, 53006, 53070, 53131, 53192, 53254, 53314, 53376, 53439, 53498,\n        53556, 53617, 53682, 53745, 53806, 53866, 53925, 53987, 54048, 54108,\n        54169, 54232, 54297, 54356, 54413, 54468, 54525, 54588, 54646, 54704,\n        54766, 54829, 54890, 54949, 55012, 55072, 55129, 55187, 55250, 55307,\n        55365, 55423, 55482, 55540, 55598, 55659, 55716, 55775, 55833, 55890,\n        55948, 56006, 56071, 56133, 56194, 56254, 56314, 56374, 56435, 56496,\n        56560, 56621, 56681, 56742, 56800, 56863, 56926, 56985, 57043, 57101,\n        57163, 57223, 57285, 57342, 57403, 57466, 57523, 57581, 57641, 57698,\n        57759, 57820, 57879, 57937, 57998, 58063, 58126, 58183, 58244, 58305,\n        58365, 58428, 58489, 58549, 58610, 58672, 58733, 58793, 58853, 58918,\n        58982, 59044, 59104, 59164, 59225, 59286, 59347, 59404, 59460, 59522,\n        59581, 59637, 59698, 59760, 59823, 59883, 59944, 60007, 60068, 60127,\n        60187, 60249, 60310, 60372};\n    //}}}\n\n    char *file_name = \"../data/many/2.1.bed.gz\";\n    struct input_file *i = input_file_init(file_name);\n\n    int chrm_len = 10;\n    char *chrm = (char *)malloc(chrm_len*sizeof(char));\n    uint32_t start, end;\n    long offset;\n    kstring_t line = {0, 0, NULL};\n\n    struct offset_index *offset_idx = \n            offset_index_init(100,\n                              \"tmp.test_offset_index_add\");\n    uint32_t intrv_id;\n    TEST_ASSERT_EQUAL(on_disk, offset_idx->type);\n\n    while (i->input_file_get_next_interval(i,\n                                           &chrm,\n                                           &chrm_len,\n                                           &start,\n                                           &end,\n                                           &offset,\n                                           &line) >= 0) {\n        intrv_id = offset_index_add(offset_idx,\n                                    offset,\n                                    &line,\n                                    1);\n\n    }\n    fprintf(stderr, \"\\n\");\n\n    TEST_ASSERT_EQUAL(1000, offset_idx->index->num);\n    \n    uint32_t j;\n    for (j = 0; j < 1000; ++j)\n        TEST_ASSERT_EQUAL(A_offsets[j], \n                          OFFSET_INDEX_PAIR(offset_idx, j)->offset);\n\n    offset_index_store(offset_idx);\n\n    offset_index_destroy(&offset_idx);\n\n\n    if (line.s != NULL)\n        free(line.s);\n    input_file_destroy(&i);\n    free(chrm);\n\n    offset_idx = offset_index_load(\"tmp.test_offset_index_add\");\n    TEST_ASSERT_EQUAL(on_disk, offset_idx->type);\n\n    for (j = 0; j < 1000; ++j)\n        TEST_ASSERT_EQUAL(A_offsets[j], \n                          OFFSET_INDEX_PAIR(offset_idx, j)->offset);\n\n    offset_index_destroy(&offset_idx);\n}\n//}}}\n\n//{{{ void test_offset_index_add_data(void)\nstruct offset_data_append_data_test_struct\n{\n    uint32_t data;\n};\n\nvoid offset_data_append_data_test_func(uint8_t *dest, kstring_t *line)\n{\n    int n;\n    int *fields = ksplit(line, '\\t', &n);\n\n    struct offset_data_append_data_test_struct a;\n    a.data = atoi(line->s + fields[4]);\n\n    memcpy(dest, &a, sizeof(struct offset_data_append_data_test_struct));\n\n    free(fields);\n}\n\nvoid test_offset_index_add_data(void)\n{ \n    //{{{ uint32_t A_offsets[1000] = \n    uint32_t A_offsets[1000] = {0, 61, 118, 173, 230, 292, 350, 412, 476, 534,\n        599, 661, 726, 784, 841, 899, 964, 1026, 1085, 1145, 1204, 1267, 1330,\n        1388, 1447, 1508, 1566, 1627, 1686, 1747, 1810, 1873, 1935, 1992, 2050,\n        2108, 2167, 2226, 2285, 2344, 2401, 2460, 2519, 2578, 2636, 2702, 2766,\n        2826, 2886, 2947, 3009, 3069, 3128, 3188, 3248, 3312, 3375, 3441, 3499,\n        3559, 3622, 3683, 3746, 3804, 3863, 3922, 3983, 4043, 4104, 4164, 4225,\n        4285, 4352, 4413, 4480, 4544, 4607, 4668, 4729, 4792, 4853, 4917, 4978,\n        5037, 5101, 5161, 5218, 5285, 5346, 5409, 5465, 5526, 5583, 5645, 5706,\n        5767, 5827, 5887, 5950, 6010, 6069, 6133, 6193, 6254, 6316, 6375, 6435,\n        6494, 6557, 6616, 6676, 6736, 6796, 6855, 6915, 6975, 7033, 7092, 7158,\n        7218, 7277, 7337, 7397, 7455, 7518, 7577, 7637, 7701, 7761, 7822, 7885,\n        7951, 8016, 8078, 8140, 8202, 8264, 8326, 8388, 8453, 8513, 8575, 8636,\n        8698, 8752, 8810, 8868, 8926, 8985, 9043, 9103, 9162, 9222, 9282, 9341,\n        9401, 9461, 9524, 9583, 9641, 9700, 9762, 9822, 9882, 9945, 10008,\n        10065, 10128, 10188, 10248, 10308, 10370, 10427, 10487, 10547, 10606,\n        10665, 10726, 10788, 10853, 10914, 10976, 11039, 11104, 11168, 11229,\n        11291, 11355, 11413, 11470, 11525, 11584, 11641, 11698, 11755, 11815,\n        11877, 11936, 11999, 12058, 12120, 12184, 12244, 12304, 12364, 12427,\n        12491, 12549, 12610, 12674, 12738, 12803, 12869, 12929, 12990, 13049,\n        13111, 13171, 13233, 13296, 13356, 13416, 13480, 13539, 13599, 13663,\n        13725, 13787, 13851, 13913, 13978, 14044, 14105, 14166, 14226, 14288,\n        14351, 14411, 14471, 14530, 14589, 14651, 14715, 14773, 14832, 14893,\n        14957, 15016, 15075, 15135, 15194, 15253, 15313, 15373, 15432, 15491,\n        15550, 15610, 15670, 15731, 15790, 15848, 15910, 15970, 16033, 16092,\n        16156, 16216, 16276, 16335, 16392, 16452, 16511, 16569, 16628, 16686,\n        16746, 16804, 16870, 16932, 16993, 17055, 17116, 17176, 17235, 17297,\n        17357, 17415, 17474, 17537, 17596, 17656, 17717, 17779, 17839, 17899,\n        17958, 18018, 18079, 18138, 18200, 18259, 18317, 18376, 18439, 18503,\n        18566, 18625, 18687, 18748, 18808, 18870, 18931, 18991, 19054, 19115,\n        19175, 19234, 19296, 19358, 19417, 19475, 19536, 19596, 19658, 19716,\n        19776, 19837, 19899, 19958, 20016, 20073, 20137, 20203, 20262, 20321,\n        20382, 20441, 20504, 20564, 20629, 20688, 20747, 20806, 20865, 20923,\n        20982, 21041, 21103, 21164, 21222, 21285, 21341, 21398, 21457, 21516,\n        21575, 21634, 21694, 21757, 21822, 21881, 21941, 22000, 22059, 22123,\n        22181, 22239, 22297, 22355, 22411, 22470, 22531, 22595, 22654, 22715,\n        22778, 22839, 22898, 22956, 23016, 23080, 23140, 23199, 23259, 23319,\n        23382, 23445, 23504, 23564, 23626, 23693, 23757, 23816, 23876, 23936,\n        23996, 24055, 24113, 24172, 24232, 24293, 24353, 24415, 24474, 24536,\n        24594, 24653, 24712, 24776, 24840, 24896, 24956, 25012, 25069, 25128,\n        25184, 25244, 25303, 25364, 25424, 25487, 25546, 25606, 25664, 25722,\n        25784, 25843, 25902, 25962, 26021, 26079, 26138, 26200, 26259, 26321,\n        26382, 26443, 26505, 26563, 26620, 26682, 26738, 26798, 26856, 26915,\n        26975, 27036, 27098, 27158, 27221, 27283, 27343, 27406, 27466, 27525,\n        27587, 27646, 27705, 27767, 27828, 27887, 27947, 28006, 28065, 28131,\n        28191, 28254, 28314, 28372, 28431, 28491, 28551, 28615, 28681, 28741,\n        28800, 28859, 28919, 28978, 29038, 29104, 29165, 29225, 29287, 29344,\n        29401, 29458, 29519, 29578, 29636, 29695, 29754, 29812, 29871, 29934,\n        29996, 30057, 30116, 30174, 30233, 30291, 30352, 30411, 30473, 30531,\n        30592, 30652, 30716, 30775, 30834, 30896, 30959, 31016, 31074, 31133,\n        31194, 31254, 31317, 31376, 31436, 31497, 31558, 31618, 31678, 31739,\n        31802, 31865, 31928, 31988, 32048, 32106, 32167, 32231, 32290, 32355,\n        32414, 32474, 32534, 32599, 32660, 32721, 32781, 32842, 32905, 32966,\n        33027, 33090, 33151, 33213, 33278, 33338, 33399, 33460, 33520, 33578,\n        33639, 33699, 33759, 33819, 33878, 33941, 34001, 34065, 34125, 34185,\n        34245, 34304, 34362, 34421, 34487, 34546, 34605, 34664, 34724, 34787,\n        34846, 34905, 34967, 35027, 35089, 35148, 35207, 35267, 35329, 35389,\n        35451, 35511, 35570, 35630, 35691, 35755, 35814, 35873, 35935, 35998,\n        36064, 36124, 36183, 36247, 36310, 36369, 36430, 36489, 36551, 36611,\n        36670, 36730, 36790, 36850, 36914, 36974, 37033, 37093, 37152, 37210,\n        37269, 37327, 37390, 37455, 37512, 37571, 37631, 37687, 37743, 37806,\n        37864, 37922, 37985, 38043, 38102, 38164, 38223, 38280, 38341, 38399,\n        38461, 38522, 38583, 38642, 38700, 38760, 38822, 38882, 38940, 38999,\n        39064, 39124, 39185, 39248, 39309, 39369, 39434, 39495, 39556, 39616,\n        39680, 39741, 39802, 39862, 39925, 39990, 40052, 40116, 40177, 40237,\n        40298, 40359, 40418, 40479, 40540, 40599, 40665, 40726, 40787, 40850,\n        40914, 40970, 41027, 41085, 41141, 41202, 41260, 41322, 41379, 41438,\n        41498, 41552, 41614, 41677, 41738, 41797, 41860, 41918, 41975, 42032,\n        42091, 42150, 42209, 42267, 42329, 42387, 42448, 42509, 42569, 42630,\n        42690, 42751, 42814, 42874, 42934, 42995, 43059, 43119, 43182, 43245,\n        43304, 43366, 43430, 43486, 43544, 43602, 43661, 43718, 43777, 43836,\n        43895, 43953, 44014, 44073, 44132, 44190, 44249, 44312, 44369, 44431,\n        44489, 44548, 44609, 44674, 44735, 44797, 44858, 44919, 44984, 45045,\n        45103, 45168, 45228, 45290, 45349, 45412, 45475, 45538, 45598, 45659,\n        45719, 45784, 45847, 45910, 45971, 46032, 46093, 46157, 46218, 46280,\n        46344, 46405, 46465, 46526, 46590, 46650, 46714, 46774, 46833, 46893,\n        46953, 47017, 47077, 47131, 47186, 47245, 47305, 47361, 47420, 47476,\n        47533, 47588, 47647, 47706, 47765, 47824, 47883, 47942, 48003, 48061,\n        48121, 48180, 48239, 48298, 48360, 48422, 48478, 48536, 48598, 48663,\n        48724, 48785, 48844, 48908, 48967, 49026, 49086, 49145, 49204, 49263,\n        49325, 49383, 49443, 49506, 49570, 49630, 49691, 49751, 49812, 49873,\n        49933, 49996, 50063, 50127, 50188, 50249, 50309, 50370, 50430, 50490,\n        50551, 50605, 50658, 50712, 50769, 50827, 50887, 50943, 51003, 51066,\n        51125, 51183, 51242, 51303, 51361, 51419, 51481, 51539, 51598, 51657,\n        51715, 51778, 51836, 51894, 51955, 52013, 52074, 52137, 52201, 52265,\n        52325, 52387, 52451, 52515, 52574, 52641, 52701, 52764, 52824, 52884,\n        52947, 53006, 53070, 53131, 53192, 53254, 53314, 53376, 53439, 53498,\n        53556, 53617, 53682, 53745, 53806, 53866, 53925, 53987, 54048, 54108,\n        54169, 54232, 54297, 54356, 54413, 54468, 54525, 54588, 54646, 54704,\n        54766, 54829, 54890, 54949, 55012, 55072, 55129, 55187, 55250, 55307,\n        55365, 55423, 55482, 55540, 55598, 55659, 55716, 55775, 55833, 55890,\n        55948, 56006, 56071, 56133, 56194, 56254, 56314, 56374, 56435, 56496,\n        56560, 56621, 56681, 56742, 56800, 56863, 56926, 56985, 57043, 57101,\n        57163, 57223, 57285, 57342, 57403, 57466, 57523, 57581, 57641, 57698,\n        57759, 57820, 57879, 57937, 57998, 58063, 58126, 58183, 58244, 58305,\n        58365, 58428, 58489, 58549, 58610, 58672, 58733, 58793, 58853, 58918,\n        58982, 59044, 59104, 59164, 59225, 59286, 59347, 59404, 59460, 59522,\n        59581, 59637, 59698, 59760, 59823, 59883, 59944, 60007, 60068, 60127,\n        60187, 60249, 60310, 60372};\n    //}}}\n\n    //{{{uint32_t A_data[1000] = \n    uint32_t A_data[1000] = {1000, 453, 421, 506, 1000, 426, 1000, 1000, 531,\n        1000, 1000, 1000, 490, 397, 497, 1000, 1000, 606, 680, 604, 1000, 1000,\n        534, 482, 692, 448, 893, 494, 670, 1000, 1000, 1000, 487, 565, 472,\n        427, 613, 552, 577, 371, 638, 422, 478, 397, 1000, 1000, 459, 429, 603,\n        630, 429, 426, 443, 380, 752, 768, 1000, 440, 422, 933, 537, 876, 386,\n        415, 379, 481, 415, 556, 409, 579, 473, 1000, 442, 1000, 1000, 905,\n        496, 392, 856, 489, 1000, 427, 415, 1000, 382, 408, 1000, 523, 973,\n        408, 1000, 453, 1000, 1000, 1000, 545, 517, 1000, 402, 370, 1000, 495,\n        945, 1000, 482, 430, 414, 1000, 465, 581, 499, 375, 468, 501, 538, 378,\n        443, 1000, 490, 524, 477, 517, 437, 1000, 397, 370, 1000, 416, 473,\n        993, 1000, 801, 592, 535, 433, 531, 386, 393, 1000, 385, 385, 378, 403,\n        388, 918, 1000, 956, 795, 408, 488, 378, 464, 418, 595, 502, 459, 919,\n        596, 385, 448, 931, 617, 497, 772, 754, 385, 1000, 646, 441, 515, 712,\n        379, 410, 597, 371, 420, 872, 719, 1000, 410, 410, 973, 1000, 732, 403,\n        470, 719, 1000, 400, 436, 552, 386, 389, 393, 373, 788, 371, 1000, 397,\n        896, 1000, 380, 526, 372, 937, 1000, 373, 964, 1000, 1000, 1000, 1000,\n        419, 689, 373, 888, 406, 1000, 1000, 423, 592, 1000, 423, 523, 995,\n        383, 473, 795, 472, 654, 1000, 391, 402, 407, 461, 1000, 395, 424, 407,\n        378, 872, 1000, 378, 479, 503, 1000, 400, 380, 380, 389, 370, 509, 371,\n        393, 378, 444, 436, 478, 424, 383, 393, 986, 472, 1000, 483, 1000, 380,\n        373, 516, 371, 481, 380, 407, 430, 378, 580, 373, 1000, 502, 415, 419,\n        380, 483, 382, 656, 517, 423, 391, 692, 395, 538, 699, 706, 422, 405,\n        372, 569, 841, 508, 1000, 436, 424, 439, 1000, 1000, 1000, 424, 785,\n        646, 580, 724, 640, 427, 1000, 1000, 448, 466, 554, 422, 1000, 772,\n        717, 744, 1000, 578, 499, 914, 694, 380, 402, 393, 1000, 1000, 461,\n        380, 646, 490, 1000, 495, 1000, 525, 436, 414, 393, 371, 509, 530, 668,\n        643, 375, 756, 393, 491, 490, 493, 408, 524, 567, 1000, 1000, 556, 511,\n        452, 465, 1000, 396, 375, 511, 371, 489, 432, 1000, 1000, 400, 708,\n        1000, 672, 380, 440, 391, 1000, 433, 375, 950, 483, 1000, 1000, 461,\n        625, 974, 1000, 1000, 430, 575, 433, 545, 415, 380, 470, 580, 642, 460,\n        896, 403, 754, 564, 392, 430, 1000, 1000, 370, 741, 603, 410, 643, 515,\n        371, 622, 644, 505, 1000, 375, 437, 380, 400, 706, 487, 525, 389, 393,\n        378, 389, 978, 386, 1000, 1000, 882, 1000, 547, 400, 1000, 370, 829,\n        494, 749, 610, 906, 1000, 403, 1000, 744, 423, 1000, 432, 617, 833,\n        502, 380, 996, 589, 429, 525, 416, 430, 1000, 403, 1000, 397, 381, 749,\n        432, 539, 1000, 1000, 484, 558, 422, 399, 516, 480, 1000, 684, 594,\n        677, 424, 432, 443, 864, 509, 371, 547, 501, 428, 580, 1000, 1000, 689,\n        391, 618, 524, 482, 682, 624, 1000, 436, 742, 499, 1000, 458, 397,\n        1000, 1000, 406, 375, 407, 661, 592, 662, 436, 378, 465, 508, 429, 473,\n        380, 882, 623, 1000, 409, 508, 584, 511, 1000, 375, 1000, 373, 501,\n        381, 1000, 493, 440, 494, 413, 757, 624, 491, 734, 413, 863, 1000, 397,\n        389, 386, 371, 876, 1000, 819, 460, 422, 407, 1000, 497, 1000, 432,\n        400, 422, 399, 510, 466, 1000, 436, 573, 381, 376, 1000, 578, 419, 719,\n        482, 656, 390, 388, 511, 843, 426, 723, 538, 372, 400, 884, 1000, 415,\n        450, 681, 656, 1000, 497, 425, 1000, 1000, 444, 820, 450, 816, 431,\n        399, 370, 394, 387, 1000, 625, 385, 524, 422, 385, 387, 403, 1000,\n        1000, 593, 1000, 1000, 530, 458, 1000, 472, 436, 1000, 441, 456, 1000,\n        449, 394, 786, 391, 1000, 1000, 706, 383, 375, 517, 1000, 592, 422,\n        501, 1000, 429, 449, 1000, 386, 591, 1000, 590, 591, 371, 876, 415,\n        389, 375, 1000, 1000, 795, 1000, 472, 401, 451, 392, 469, 493, 437,\n        415, 1000, 430, 554, 952, 1000, 442, 620, 634, 440, 1000, 800, 1000,\n        378, 441, 617, 373, 1000, 1000, 1000, 442, 1000, 530, 436, 499, 503,\n        597, 523, 444, 1000, 544, 691, 737, 390, 452, 385, 397, 809, 400, 380,\n        499, 846, 501, 1000, 809, 371, 640, 1000, 377, 415, 383, 524, 371, 400,\n        479, 389, 508, 985, 410, 486, 380, 423, 1000, 499, 1000, 409, 382, 436,\n        1000, 382, 660, 592, 420, 1000, 380, 389, 1000, 400, 759, 436, 808,\n        1000, 1000, 410, 415, 400, 1000, 1000, 703, 482, 646, 400, 938, 475,\n        651, 1000, 482, 596, 624, 1000, 416, 1000, 424, 373, 371, 483, 809,\n        444, 415, 390, 1000, 1000, 495, 857, 436, 445, 383, 432, 553, 621, 375,\n        460, 473, 748, 566, 632, 484, 504, 520, 1000, 1000, 380, 371, 1000,\n        1000, 1000, 914, 813, 1000, 467, 409, 797, 400, 515, 581, 1000, 524,\n        400, 821, 1000, 489, 490, 432, 524, 444, 559, 1000, 1000, 1000, 376,\n        593, 470, 468, 375, 395, 451, 422, 375, 389, 521, 751, 745, 443, 849,\n        1000, 489, 394, 445, 713, 530, 407, 1000, 503, 519, 402, 382, 1000,\n        385, 389, 901, 444, 731, 877, 1000, 1000, 525, 636, 1000, 1000, 439,\n        1000, 591, 754, 422, 489, 846, 378, 1000, 533, 533, 1000, 370, 631,\n        1000, 382, 378, 422, 1000, 669, 1000, 407, 403, 1000, 524, 372, 504,\n        994, 1000, 1000, 425, 373, 371, 1000, 432, 393, 1000, 1000, 660, 592,\n        1000, 769, 493, 400, 1000, 406, 393, 372, 385, 593, 393, 762, 482, 425,\n        416, 378, 371, 440, 1000, 684, 438, 380, 380, 385, 471, 581, 1000, 552,\n        424, 386, 459, 1000, 1000, 438, 566, 597, 1000, 482, 1000, 372, 897,\n        1000, 400, 407, 482, 534, 940, 686, 411, 424, 921, 1000, 1000, 465,\n        464, 400, 383, 714, 434, 391, 513, 884, 457, 432, 517, 1000, 773, 791,\n        525, 393, 396, 461, 1000, 429, 371, 1000, 458, 371, 713, 1000, 1000,\n        763, 436, 668, 609, 437, 443, 543, 616, 670, 694};\n    //}}}\n\n    char *file_name = \"../data/many/2.1.bed.gz\";\n    struct input_file *i = input_file_init(file_name);\n\n    int chrm_len = 10;\n    char *chrm = (char *)malloc(chrm_len*sizeof(char));\n    uint32_t start, end;\n    long offset;\n    kstring_t line = {0, 0, NULL};\n\n    offset_data_size = sizeof(struct offset_data_append_data_test_struct);\n    offset_data_append_data = offset_data_append_data_test_func;\n\n    struct offset_index *offset_idx = \n            offset_index_init(100,\n                              \"tmp.test_offset_index_add\");\n    TEST_ASSERT_EQUAL(on_disk, offset_idx->type);\n    uint32_t intrv_id;\n\n    while (i->input_file_get_next_interval(i,\n                                           &chrm,\n                                           &chrm_len,\n                                           &start,\n                                           &end,\n                                           &offset,\n                                           &line) >= 0) {\n        intrv_id = offset_index_add(offset_idx,\n                                    offset,\n                                    &line,\n                                    1);\n\n    }\n\n    TEST_ASSERT_EQUAL(1000, offset_idx->index->num);\n    \n    uint32_t j;\n    for (j = 0; j < 1000; ++j) {\n        TEST_ASSERT_EQUAL(A_offsets[j], \n                          OFFSET_INDEX_PAIR(offset_idx, j)->offset);\n        struct offset_data_append_data_test_struct *tmp;\n        tmp = (struct offset_data_append_data_test_struct *)\n                OFFSET_INDEX_DATA(offset_idx, j);\n        TEST_ASSERT_EQUAL(A_data[j], tmp->data);\n    }\n\n    if (line.s != NULL)\n        free(line.s);\n    input_file_destroy(&i);\n    offset_index_destroy(&offset_idx);\n    free(chrm);\n}\n//}}}\n\n//{{{ void test_offset_index_add_larger_data(void)\nstruct offset_data_append_data_test_struct_larger\n{\n    uint32_t uint;\n    float flt;\n    char concat[20];\n};\n\nvoid offset_data_append_data_test_func_larger(uint8_t *dest, kstring_t *line)\n{\n    int n;\n    int *fields = ksplit(line, '\\t', &n);\n\n    struct offset_data_append_data_test_struct_larger a;\n    a.uint = atoi(line->s + fields[4]);\n    a.flt = atof(line->s + fields[6]);\n    memset(&a.concat, 0, 20);\n    int ret = sprintf(a.concat, \"%u %.6f\", a.uint, a.flt);\n\n    /*\n    fprintf(stderr,\n            \"offset_data_append_data_test_func_larger: dest:%p line:%s uint:%u flt:%f\\n\",\n            dest,\n            line->s,\n            a.uint,\n            a.flt);\n    */\n\n    memcpy(dest, &a, sizeof(struct offset_data_append_data_test_struct_larger));\n\n    free(fields);\n}\n\nvoid test_offset_index_add_data_larger(void)\n{ \n    //{{{ uint32_t A_offsets[1000] = \n    uint32_t A_offsets[1000] = {0, 61, 118, 173, 230, 292, 350, 412, 476, 534,\n        599, 661, 726, 784, 841, 899, 964, 1026, 1085, 1145, 1204, 1267, 1330,\n        1388, 1447, 1508, 1566, 1627, 1686, 1747, 1810, 1873, 1935, 1992, 2050,\n        2108, 2167, 2226, 2285, 2344, 2401, 2460, 2519, 2578, 2636, 2702, 2766,\n        2826, 2886, 2947, 3009, 3069, 3128, 3188, 3248, 3312, 3375, 3441, 3499,\n        3559, 3622, 3683, 3746, 3804, 3863, 3922, 3983, 4043, 4104, 4164, 4225,\n        4285, 4352, 4413, 4480, 4544, 4607, 4668, 4729, 4792, 4853, 4917, 4978,\n        5037, 5101, 5161, 5218, 5285, 5346, 5409, 5465, 5526, 5583, 5645, 5706,\n        5767, 5827, 5887, 5950, 6010, 6069, 6133, 6193, 6254, 6316, 6375, 6435,\n        6494, 6557, 6616, 6676, 6736, 6796, 6855, 6915, 6975, 7033, 7092, 7158,\n        7218, 7277, 7337, 7397, 7455, 7518, 7577, 7637, 7701, 7761, 7822, 7885,\n        7951, 8016, 8078, 8140, 8202, 8264, 8326, 8388, 8453, 8513, 8575, 8636,\n        8698, 8752, 8810, 8868, 8926, 8985, 9043, 9103, 9162, 9222, 9282, 9341,\n        9401, 9461, 9524, 9583, 9641, 9700, 9762, 9822, 9882, 9945, 10008,\n        10065, 10128, 10188, 10248, 10308, 10370, 10427, 10487, 10547, 10606,\n        10665, 10726, 10788, 10853, 10914, 10976, 11039, 11104, 11168, 11229,\n        11291, 11355, 11413, 11470, 11525, 11584, 11641, 11698, 11755, 11815,\n        11877, 11936, 11999, 12058, 12120, 12184, 12244, 12304, 12364, 12427,\n        12491, 12549, 12610, 12674, 12738, 12803, 12869, 12929, 12990, 13049,\n        13111, 13171, 13233, 13296, 13356, 13416, 13480, 13539, 13599, 13663,\n        13725, 13787, 13851, 13913, 13978, 14044, 14105, 14166, 14226, 14288,\n        14351, 14411, 14471, 14530, 14589, 14651, 14715, 14773, 14832, 14893,\n        14957, 15016, 15075, 15135, 15194, 15253, 15313, 15373, 15432, 15491,\n        15550, 15610, 15670, 15731, 15790, 15848, 15910, 15970, 16033, 16092,\n        16156, 16216, 16276, 16335, 16392, 16452, 16511, 16569, 16628, 16686,\n        16746, 16804, 16870, 16932, 16993, 17055, 17116, 17176, 17235, 17297,\n        17357, 17415, 17474, 17537, 17596, 17656, 17717, 17779, 17839, 17899,\n        17958, 18018, 18079, 18138, 18200, 18259, 18317, 18376, 18439, 18503,\n        18566, 18625, 18687, 18748, 18808, 18870, 18931, 18991, 19054, 19115,\n        19175, 19234, 19296, 19358, 19417, 19475, 19536, 19596, 19658, 19716,\n        19776, 19837, 19899, 19958, 20016, 20073, 20137, 20203, 20262, 20321,\n        20382, 20441, 20504, 20564, 20629, 20688, 20747, 20806, 20865, 20923,\n        20982, 21041, 21103, 21164, 21222, 21285, 21341, 21398, 21457, 21516,\n        21575, 21634, 21694, 21757, 21822, 21881, 21941, 22000, 22059, 22123,\n        22181, 22239, 22297, 22355, 22411, 22470, 22531, 22595, 22654, 22715,\n        22778, 22839, 22898, 22956, 23016, 23080, 23140, 23199, 23259, 23319,\n        23382, 23445, 23504, 23564, 23626, 23693, 23757, 23816, 23876, 23936,\n        23996, 24055, 24113, 24172, 24232, 24293, 24353, 24415, 24474, 24536,\n        24594, 24653, 24712, 24776, 24840, 24896, 24956, 25012, 25069, 25128,\n        25184, 25244, 25303, 25364, 25424, 25487, 25546, 25606, 25664, 25722,\n        25784, 25843, 25902, 25962, 26021, 26079, 26138, 26200, 26259, 26321,\n        26382, 26443, 26505, 26563, 26620, 26682, 26738, 26798, 26856, 26915,\n        26975, 27036, 27098, 27158, 27221, 27283, 27343, 27406, 27466, 27525,\n        27587, 27646, 27705, 27767, 27828, 27887, 27947, 28006, 28065, 28131,\n        28191, 28254, 28314, 28372, 28431, 28491, 28551, 28615, 28681, 28741,\n        28800, 28859, 28919, 28978, 29038, 29104, 29165, 29225, 29287, 29344,\n        29401, 29458, 29519, 29578, 29636, 29695, 29754, 29812, 29871, 29934,\n        29996, 30057, 30116, 30174, 30233, 30291, 30352, 30411, 30473, 30531,\n        30592, 30652, 30716, 30775, 30834, 30896, 30959, 31016, 31074, 31133,\n        31194, 31254, 31317, 31376, 31436, 31497, 31558, 31618, 31678, 31739,\n        31802, 31865, 31928, 31988, 32048, 32106, 32167, 32231, 32290, 32355,\n        32414, 32474, 32534, 32599, 32660, 32721, 32781, 32842, 32905, 32966,\n        33027, 33090, 33151, 33213, 33278, 33338, 33399, 33460, 33520, 33578,\n        33639, 33699, 33759, 33819, 33878, 33941, 34001, 34065, 34125, 34185,\n        34245, 34304, 34362, 34421, 34487, 34546, 34605, 34664, 34724, 34787,\n        34846, 34905, 34967, 35027, 35089, 35148, 35207, 35267, 35329, 35389,\n        35451, 35511, 35570, 35630, 35691, 35755, 35814, 35873, 35935, 35998,\n        36064, 36124, 36183, 36247, 36310, 36369, 36430, 36489, 36551, 36611,\n        36670, 36730, 36790, 36850, 36914, 36974, 37033, 37093, 37152, 37210,\n        37269, 37327, 37390, 37455, 37512, 37571, 37631, 37687, 37743, 37806,\n        37864, 37922, 37985, 38043, 38102, 38164, 38223, 38280, 38341, 38399,\n        38461, 38522, 38583, 38642, 38700, 38760, 38822, 38882, 38940, 38999,\n        39064, 39124, 39185, 39248, 39309, 39369, 39434, 39495, 39556, 39616,\n        39680, 39741, 39802, 39862, 39925, 39990, 40052, 40116, 40177, 40237,\n        40298, 40359, 40418, 40479, 40540, 40599, 40665, 40726, 40787, 40850,\n        40914, 40970, 41027, 41085, 41141, 41202, 41260, 41322, 41379, 41438,\n        41498, 41552, 41614, 41677, 41738, 41797, 41860, 41918, 41975, 42032,\n        42091, 42150, 42209, 42267, 42329, 42387, 42448, 42509, 42569, 42630,\n        42690, 42751, 42814, 42874, 42934, 42995, 43059, 43119, 43182, 43245,\n        43304, 43366, 43430, 43486, 43544, 43602, 43661, 43718, 43777, 43836,\n        43895, 43953, 44014, 44073, 44132, 44190, 44249, 44312, 44369, 44431,\n        44489, 44548, 44609, 44674, 44735, 44797, 44858, 44919, 44984, 45045,\n        45103, 45168, 45228, 45290, 45349, 45412, 45475, 45538, 45598, 45659,\n        45719, 45784, 45847, 45910, 45971, 46032, 46093, 46157, 46218, 46280,\n        46344, 46405, 46465, 46526, 46590, 46650, 46714, 46774, 46833, 46893,\n        46953, 47017, 47077, 47131, 47186, 47245, 47305, 47361, 47420, 47476,\n        47533, 47588, 47647, 47706, 47765, 47824, 47883, 47942, 48003, 48061,\n        48121, 48180, 48239, 48298, 48360, 48422, 48478, 48536, 48598, 48663,\n        48724, 48785, 48844, 48908, 48967, 49026, 49086, 49145, 49204, 49263,\n        49325, 49383, 49443, 49506, 49570, 49630, 49691, 49751, 49812, 49873,\n        49933, 49996, 50063, 50127, 50188, 50249, 50309, 50370, 50430, 50490,\n        50551, 50605, 50658, 50712, 50769, 50827, 50887, 50943, 51003, 51066,\n        51125, 51183, 51242, 51303, 51361, 51419, 51481, 51539, 51598, 51657,\n        51715, 51778, 51836, 51894, 51955, 52013, 52074, 52137, 52201, 52265,\n        52325, 52387, 52451, 52515, 52574, 52641, 52701, 52764, 52824, 52884,\n        52947, 53006, 53070, 53131, 53192, 53254, 53314, 53376, 53439, 53498,\n        53556, 53617, 53682, 53745, 53806, 53866, 53925, 53987, 54048, 54108,\n        54169, 54232, 54297, 54356, 54413, 54468, 54525, 54588, 54646, 54704,\n        54766, 54829, 54890, 54949, 55012, 55072, 55129, 55187, 55250, 55307,\n        55365, 55423, 55482, 55540, 55598, 55659, 55716, 55775, 55833, 55890,\n        55948, 56006, 56071, 56133, 56194, 56254, 56314, 56374, 56435, 56496,\n        56560, 56621, 56681, 56742, 56800, 56863, 56926, 56985, 57043, 57101,\n        57163, 57223, 57285, 57342, 57403, 57466, 57523, 57581, 57641, 57698,\n        57759, 57820, 57879, 57937, 57998, 58063, 58126, 58183, 58244, 58305,\n        58365, 58428, 58489, 58549, 58610, 58672, 58733, 58793, 58853, 58918,\n        58982, 59044, 59104, 59164, 59225, 59286, 59347, 59404, 59460, 59522,\n        59581, 59637, 59698, 59760, 59823, 59883, 59944, 60007, 60068, 60127,\n        60187, 60249, 60310, 60372};\n    //}}}\n\n    //{{{uint32_t A_data[1000] = \n    uint32_t A_data[1000] = {1000, 453, 421, 506, 1000, 426, 1000, 1000, 531,\n        1000, 1000, 1000, 490, 397, 497, 1000, 1000, 606, 680, 604, 1000, 1000,\n        534, 482, 692, 448, 893, 494, 670, 1000, 1000, 1000, 487, 565, 472,\n        427, 613, 552, 577, 371, 638, 422, 478, 397, 1000, 1000, 459, 429, 603,\n        630, 429, 426, 443, 380, 752, 768, 1000, 440, 422, 933, 537, 876, 386,\n        415, 379, 481, 415, 556, 409, 579, 473, 1000, 442, 1000, 1000, 905,\n        496, 392, 856, 489, 1000, 427, 415, 1000, 382, 408, 1000, 523, 973,\n        408, 1000, 453, 1000, 1000, 1000, 545, 517, 1000, 402, 370, 1000, 495,\n        945, 1000, 482, 430, 414, 1000, 465, 581, 499, 375, 468, 501, 538, 378,\n        443, 1000, 490, 524, 477, 517, 437, 1000, 397, 370, 1000, 416, 473,\n        993, 1000, 801, 592, 535, 433, 531, 386, 393, 1000, 385, 385, 378, 403,\n        388, 918, 1000, 956, 795, 408, 488, 378, 464, 418, 595, 502, 459, 919,\n        596, 385, 448, 931, 617, 497, 772, 754, 385, 1000, 646, 441, 515, 712,\n        379, 410, 597, 371, 420, 872, 719, 1000, 410, 410, 973, 1000, 732, 403,\n        470, 719, 1000, 400, 436, 552, 386, 389, 393, 373, 788, 371, 1000, 397,\n        896, 1000, 380, 526, 372, 937, 1000, 373, 964, 1000, 1000, 1000, 1000,\n        419, 689, 373, 888, 406, 1000, 1000, 423, 592, 1000, 423, 523, 995,\n        383, 473, 795, 472, 654, 1000, 391, 402, 407, 461, 1000, 395, 424, 407,\n        378, 872, 1000, 378, 479, 503, 1000, 400, 380, 380, 389, 370, 509, 371,\n        393, 378, 444, 436, 478, 424, 383, 393, 986, 472, 1000, 483, 1000, 380,\n        373, 516, 371, 481, 380, 407, 430, 378, 580, 373, 1000, 502, 415, 419,\n        380, 483, 382, 656, 517, 423, 391, 692, 395, 538, 699, 706, 422, 405,\n        372, 569, 841, 508, 1000, 436, 424, 439, 1000, 1000, 1000, 424, 785,\n        646, 580, 724, 640, 427, 1000, 1000, 448, 466, 554, 422, 1000, 772,\n        717, 744, 1000, 578, 499, 914, 694, 380, 402, 393, 1000, 1000, 461,\n        380, 646, 490, 1000, 495, 1000, 525, 436, 414, 393, 371, 509, 530, 668,\n        643, 375, 756, 393, 491, 490, 493, 408, 524, 567, 1000, 1000, 556, 511,\n        452, 465, 1000, 396, 375, 511, 371, 489, 432, 1000, 1000, 400, 708,\n        1000, 672, 380, 440, 391, 1000, 433, 375, 950, 483, 1000, 1000, 461,\n        625, 974, 1000, 1000, 430, 575, 433, 545, 415, 380, 470, 580, 642, 460,\n        896, 403, 754, 564, 392, 430, 1000, 1000, 370, 741, 603, 410, 643, 515,\n        371, 622, 644, 505, 1000, 375, 437, 380, 400, 706, 487, 525, 389, 393,\n        378, 389, 978, 386, 1000, 1000, 882, 1000, 547, 400, 1000, 370, 829,\n        494, 749, 610, 906, 1000, 403, 1000, 744, 423, 1000, 432, 617, 833,\n        502, 380, 996, 589, 429, 525, 416, 430, 1000, 403, 1000, 397, 381, 749,\n        432, 539, 1000, 1000, 484, 558, 422, 399, 516, 480, 1000, 684, 594,\n        677, 424, 432, 443, 864, 509, 371, 547, 501, 428, 580, 1000, 1000, 689,\n        391, 618, 524, 482, 682, 624, 1000, 436, 742, 499, 1000, 458, 397,\n        1000, 1000, 406, 375, 407, 661, 592, 662, 436, 378, 465, 508, 429, 473,\n        380, 882, 623, 1000, 409, 508, 584, 511, 1000, 375, 1000, 373, 501,\n        381, 1000, 493, 440, 494, 413, 757, 624, 491, 734, 413, 863, 1000, 397,\n        389, 386, 371, 876, 1000, 819, 460, 422, 407, 1000, 497, 1000, 432,\n        400, 422, 399, 510, 466, 1000, 436, 573, 381, 376, 1000, 578, 419, 719,\n        482, 656, 390, 388, 511, 843, 426, 723, 538, 372, 400, 884, 1000, 415,\n        450, 681, 656, 1000, 497, 425, 1000, 1000, 444, 820, 450, 816, 431,\n        399, 370, 394, 387, 1000, 625, 385, 524, 422, 385, 387, 403, 1000,\n        1000, 593, 1000, 1000, 530, 458, 1000, 472, 436, 1000, 441, 456, 1000,\n        449, 394, 786, 391, 1000, 1000, 706, 383, 375, 517, 1000, 592, 422,\n        501, 1000, 429, 449, 1000, 386, 591, 1000, 590, 591, 371, 876, 415,\n        389, 375, 1000, 1000, 795, 1000, 472, 401, 451, 392, 469, 493, 437,\n        415, 1000, 430, 554, 952, 1000, 442, 620, 634, 440, 1000, 800, 1000,\n        378, 441, 617, 373, 1000, 1000, 1000, 442, 1000, 530, 436, 499, 503,\n        597, 523, 444, 1000, 544, 691, 737, 390, 452, 385, 397, 809, 400, 380,\n        499, 846, 501, 1000, 809, 371, 640, 1000, 377, 415, 383, 524, 371, 400,\n        479, 389, 508, 985, 410, 486, 380, 423, 1000, 499, 1000, 409, 382, 436,\n        1000, 382, 660, 592, 420, 1000, 380, 389, 1000, 400, 759, 436, 808,\n        1000, 1000, 410, 415, 400, 1000, 1000, 703, 482, 646, 400, 938, 475,\n        651, 1000, 482, 596, 624, 1000, 416, 1000, 424, 373, 371, 483, 809,\n        444, 415, 390, 1000, 1000, 495, 857, 436, 445, 383, 432, 553, 621, 375,\n        460, 473, 748, 566, 632, 484, 504, 520, 1000, 1000, 380, 371, 1000,\n        1000, 1000, 914, 813, 1000, 467, 409, 797, 400, 515, 581, 1000, 524,\n        400, 821, 1000, 489, 490, 432, 524, 444, 559, 1000, 1000, 1000, 376,\n        593, 470, 468, 375, 395, 451, 422, 375, 389, 521, 751, 745, 443, 849,\n        1000, 489, 394, 445, 713, 530, 407, 1000, 503, 519, 402, 382, 1000,\n        385, 389, 901, 444, 731, 877, 1000, 1000, 525, 636, 1000, 1000, 439,\n        1000, 591, 754, 422, 489, 846, 378, 1000, 533, 533, 1000, 370, 631,\n        1000, 382, 378, 422, 1000, 669, 1000, 407, 403, 1000, 524, 372, 504,\n        994, 1000, 1000, 425, 373, 371, 1000, 432, 393, 1000, 1000, 660, 592,\n        1000, 769, 493, 400, 1000, 406, 393, 372, 385, 593, 393, 762, 482, 425,\n        416, 378, 371, 440, 1000, 684, 438, 380, 380, 385, 471, 581, 1000, 552,\n        424, 386, 459, 1000, 1000, 438, 566, 597, 1000, 482, 1000, 372, 897,\n        1000, 400, 407, 482, 534, 940, 686, 411, 424, 921, 1000, 1000, 465,\n        464, 400, 383, 714, 434, 391, 513, 884, 457, 432, 517, 1000, 773, 791,\n        525, 393, 396, 461, 1000, 429, 371, 1000, 458, 371, 713, 1000, 1000,\n        763, 436, 668, 609, 437, 443, 543, 616, 670, 694};\n    //}}}\n\n    //{{{float A_flt[1000] = {\n    float A_flt[1000] = { 12.12021, 3.88225, 3.4088, 14.7654, 3.48997, 1.87484,\n        6.77027, 11.9687, 3.91381, 14.51326, 15.4361, 70.82748, 10.98394,\n        3.4088, 7.00699, 14.99353, 6.74875, 3.70339, 5.9086, 9.46891, 11.11019,\n        12.83984, 2.98867, 10.60518, 3.52535, 9.09015, 6.88074, 5.51758,\n        6.57388, 9.72435, 19.31658, 8.55989, 4.3557, 3.29518, 3.34568,\n        14.73803, 3.03005, 3.24808, 3.78756, 5.30259, 7.87982, 5.11321,\n        2.65129, 703.58101, 16.76629, 9.75298, 6.42889, 5.30259, 4.22043,\n        10.03705, 4.74661, 3.18155, 4.29257, 2.21843, 18.93783, 2.25607,\n        221.42388, 8.7114, 5.11321, 5.26471, 7.95388, 8.08975, 7.6656, 3.31412,\n        3.03005, 2.86171, 7.21588, 6.18635, 3.21943, 3.32893, 9.87197,\n        15.46589, 3.03005, 12.27171, 17.15226, 7.70302, 2.27253, 2.46191,\n        4.22459, 3.93906, 5.11321, 3.50349, 5.51496, 18.43282, 2.33566,\n        7.19637, 19.94784, 4.31782, 3.47468, 8.91237, 55.35055, 8.03434,\n        24.23541, 7.40464, 5.32535, 4.15464, 35.09704, 7.00258, 4.06529,\n        2.34536, 23.12527, 3.14278, 9.09766, 7.56379, 3.40077, 7.28391,\n        5.62886, 9.42185, 5.47251, 4.92526, 3.02764, 2.27835, 3.6744, 3.57667,\n        3.47113, 7.03608, 5.59169, 17.01169, 3.61855, 8.00551, 3.48453,\n        5.54992, 4.10438, 6.30188, 45.08121, 2.34536, 34.71985, 9.38144,\n        12.66495, 11.96134, 31.76898, 11.72681, 7.97423, 6.87972, 3.56495,\n        5.62886, 4.69072, 4.92526, 6.09794, 7.27949, 2.81443, 7.03608, 3.09587,\n        4.29351, 7.28596, 9.12913, 14.21216, 7.02574, 4.87899, 30.27434,\n        5.85479, 2.81897, 2.62071, 3.51287, 5.46447, 2.43949, 11.94931,\n        5.07415, 6.2451, 2.68886, 5.07415, 4.34927, 15.91178, 13.46601,\n        13.07569, 6.2451, 12.33409, 4.57231, 2.73223, 4.87899, 3.51287,\n        3.12255, 3.77308, 3.95198, 5.46447, 2.17928, 9.1725, 8.49777, 9.98567,\n        3.77308, 3.77308, 4.7739, 5.04813, 9.10745, 3.22013, 7.32016, 8.56192,\n        278.95909, 4.47425, 4.47425, 14.64303, 4.0675, 74.15807, 4.27088,\n        3.66075, 9.23069, 5.69451, 6.72335, 3.66075, 3.84153, 26.57438,\n        25.86841, 2.63032, 2.64388, 12.60927, 25.57446, 2.03375, 7.79605,\n        16.21919, 15.89002, 19.9522, 28.35634, 3.45738, 4.37627, 3.66075,\n        7.18593, 711.99196, 8.13501, 7.10458, 4.20309, 5.89788, 11.72182,\n        2.59303, 5.28467, 4.76479, 2.32429, 2.93764, 5.38944, 4.27088,\n        10.77889, 10.98227, 3.52517, 2.55671, 3.254, 20.84931, 20.3708,\n        3.18293, 3.18293, 4.8805, 8.27563, 7.35612, 24.57228, 8.27563,\n        17.58992, 10.50369, 10.82198, 4.6683, 4.03172, 2.63729, 3.81952,\n        7.63905, 5.38724, 1.66492, 4.45611, 8.27563, 5.94148, 12.73175,\n        9.54881, 120.4028, 2.84145, 6.90067, 4.38903, 5.14167, 8.64033,\n        6.69771, 6.37121, 2.36787, 1.76866, 7.50955, 5.6829, 6.73498, 3.85625,\n        2.60949, 6.33298, 6.08882, 7.03598, 3.65329, 16.10157, 4.22158,\n        20.45145, 3.45033, 3.85625, 6.81006, 2.65302, 7.06046, 6.27596, 4.4217,\n        3.70852, 11.79783, 2.50631, 2.46046, 12.4093, 8.80896, 5.72578,\n        2.46046, 2.78139, 5.88372, 6.4186, 7.70232, 6.2211, 4.70697, 8.98604,\n        2.11436, 6.97488, 13.93754, 9.41395, 28.7183, 5.99069, 4.27906,\n        7.41705, 6.76093, 3.97953, 2.37293, 6.10739, 6.4186, 8.49451, 1.9652,\n        3.79767, 2.43906, 8.59356, 13.44763, 14.87347, 9.17197, 14.74953,\n        6.69306, 2.89842, 8.59356, 7.23842, 4.70993, 4.29678, 8.4283, 12.27062,\n        14.30332, 7.50125, 2.25856, 4.36288, 3.8246, 6.66552, 4.21415,\n        132.01495, 16.36082, 5.12308, 5.94939, 5.20571, 6.94095, 6.02564,\n        4.6273, 9.91565, 7.68463, 3.09864, 11.56826, 8.4283, 8.4283, 14.37769,\n        3.59442, 7.65796, 4.17873, 5.65192, 7.84238, 10.78327, 3.71836,\n        6.77569, 7.18884, 5.78413, 10.23115, 2.77158, 2.45482, 3.89341,\n        1.40558, 6.64682, 10.11018, 8.14505, 24.74626, 8.89158, 3.40508,\n        7.80002, 8.41589, 2.87056, 9.10662, 3.06853, 14.19728, 23.05476,\n        2.77158, 5.50356, 1.93874, 8.97464, 4.89715, 2.34735, 4.20686, 8.78987,\n        32.86303, 15.93659, 3.2467, 3.01523, 3.76143, 2.69239, 5.14722,\n        2.53401, 14.9326, 4.55331, 5.62235, 3.36549, 5.22641, 3.2665, 6.73098,\n        6.599, 2.57361, 3.03554, 12.67008, 13.46196, 2.33794, 6.00072, 4.25505,\n        2.56394, 3.19129, 4.546, 2.12752, 5.81888, 12.42236, 2.58404, 7.85549,\n        3.6368, 4.50054, 2.63668, 5.4552, 7.85549, 5.4552, 12.73173, 17.79964,\n        5.18244, 7.09176, 3.16401, 17.89681, 7.63728, 23.66953, 7.53271,\n        13.70596, 15.50422, 6.09442, 6.58198, 13.31022, 2.92532, 4.91617,\n        8.07562, 6.985, 7.06953, 6.26855, 10.6043, 3.01674, 5.53584, 9.01975,\n        2.66413, 7.77039, 3.14472, 7.7539, 8.19699, 3.94918, 4.17865, 4.87554,\n        20.61221, 5.11931, 3.83948, 7.31331, 7.93728, 17.58677, 2.77905,\n        12.70687, 2.40294, 3.83948, 5.22379, 3.14472, 3.96137, 12.43263,\n        47.90219, 2.74249, 8.9588, 4.93648, 1.98068, 5.60687, 4.11373,\n        27.75734, 5.18026, 3.57539, 9.53361, 3.88196, 2.63503, 2.72913,\n        12.16264, 5.29359, 3.29378, 5.62242, 4.51719, 2.95768, 3.59322,\n        27.57372, 6.74442, 6.03861, 2.91735, 7.1355, 8.94028, 3.41142, 4.75769,\n        2.91735, 9.81469, 4.86226, 5.17595, 14.11624, 34.34951, 2.62718,\n        941.31799, 4.42308, 10.56239, 6.58757, 2.43113, 1.42451, 4.10654,\n        10.82245, 3.92117, 6.3523, 7.05812, 5.48964, 4.73982, 6.11703, 6.65148,\n        18.89433, 356.30091, 293.75971, 10.60102, 4.23487, 4.6113, 7.8496,\n        6.43073, 10.19506, 2.94088, 23.91918, 3.24673, 3.58787, 4.00325,\n        10.19506, 2.99435, 3.67022, 5.05831, 2.70561, 5.28051, 4.33943,\n        2.86245, 5.12367, 2.70561, 31.8797, 14.78844, 92.30747, 610.58464,\n        4.70541, 3.29378, 8.28664, 6.62077, 4.44232, 3.75888, 6.87706, 5.86581,\n        6.50748, 3.75888, 16.42786, 2.32367, 2.08447, 2.93876, 2.90459,\n        3.89557, 5.63833, 14.66536, 4.9549, 4.51066, 3.58803, 2.00758, 6.05807,\n        2.26387, 2.4399, 3.31953, 2.78779, 5.70311, 2.5287, 2.73373, 2.38517,\n        9.71738, 3.09189, 5.55278, 3.97529, 2.35572, 2.25266, 8.6573, 17.99924,\n        6.52081, 4.85869, 7.15639, 10.11753, 46.59926, 22.22549, 3.86486,\n        62.05873, 6.65638, 2.88552, 8.07947, 2.93799, 3.23178, 1.65818,\n        3.55007, 2.09856, 4.22336, 3.30523, 17.87277, 5.21493, 5.87598,\n        8.53824, 4.95785, 5.87598, 2.57074, 3.0298, 10.7948, 12.87665, 3.38472,\n        6.62337, 6.41995, 3.47825, 2.89037, 10.73001, 5.19463, 2.69441,\n        16.18051, 2.7434, 2.38164, 3.65484, 3.44885, 4.50702, 3.03308, 3.03048,\n        6.58418, 8.08771, 3.28229, 2.23951, 3.91915, 11.88933, 5.29086,\n        10.25454, 3.40792, 4.70298, 14.73023, 5.40111, 3.44885, 5.91792,\n        13.13354, 2.76646, 14.78081, 12.97096, 2.64027, 5.48681, 10.09529,\n        17.67994, 13.15142, 3.91915, 4.74909, 12.23336, 7.05448, 5.74809,\n        4.96426, 2.82179, 2.65631, 2.35149, 2.98835, 3.18431, 2.46906, 5.0949,\n        44.87433, 4.18043, 8.62214, 6.27064, 5.13025, 2.80661, 3.43829,\n        5.56028, 10.8051, 22.24113, 12.43104, 6.72841, 7.14893, 3.60658,\n        11.96839, 4.28936, 7.14893, 11.98298, 7.6851, 2.26383, 9.27773,\n        4.95659, 2.62127, 7.90684, 6.35461, 5.41946, 4.21893, 6.67234, 9.87853,\n        4.60709, 5.16776, 5.48085, 2.10496, 6.91063, 2.3234, 3.05021, 6.01702,\n        5.07265, 4.52766, 8.34042, 12.54419, 4.57531, 6.08227, 6.01702, 4.7149,\n        5.10638, 3.61955, 3.25597, 2.95997, 3.10797, 3.10797, 6.21595, 2.08336,\n        4.77296, 1.62798, 4.52876, 7.61137, 3.19677, 4.88396, 93.19067,\n        4.23694, 4.27716, 7.57789, 5.18921, 3.99597, 2.34683, 4.58796,\n        12.93933, 2.51598, 9.19883, 7.54794, 3.03397, 11.91391, 15.83552,\n        66.766, 4.46463, 4.88396, 6.51195, 4.58796, 8.73091, 6.13001, 8.6826,\n        2.35318, 166.66526, 7.99194, 10.65592, 7.2654, 6.87075, 10.34996,\n        4.3413, 2.49748, 14.62498, 3.05864, 8.58393, 7.07782, 3.77397, 4.27346,\n        6.88194, 6.90661, 8.87993, 9.19961, 9.32393, 3.99597, 3.10797, 3.32997,\n        15.53988, 6.21595, 22.91597, 1.75206, 6.51226, 4.33224, 2.9566,\n        4.07902, 4.87641, 2.58703, 3.77788, 2.62809, 2.37258, 2.60984, 2.54596,\n        3.96007, 2.66459, 2.87447, 5.0098, 4.12986, 2.73759, 2.54596, 11.49791,\n        6.67973, 3.92785, 2.20943, 3.44937, 6.33906, 10.21515, 7.68677,\n        5.46142, 5.831, 6.92731, 2.00565, 1.74629, 2.80603, 2.21745, 5.25618,\n        4.37766, 5.34069, 7.9774, 5.95029, 4.92767, 4.91707, 2.0921, 1.92053,\n        3.94214, 3.16192, 1.82823, 4.92767, 7.30306, 12.37394, 5.09193,\n        1.66445, 2.57012, 9.52684, 3.86001, 2.54596, 3.28511, 4.95543, 5.96741,\n        3.45937, 3.00965, 6.91874, 6.44925, 15.56717, 4.4107, 20.14233,\n        50.63039, 3.85473, 3.97827, 3.94368, 5.24671, 4.2995, 5.44851,\n        10.41518, 2.76749, 6.61812, 2.35866, 2.5204, 10.63757, 4.67015,\n        625.8006, 7.78358, 3.33582, 3.66116, 23.55738, 7.00523, 20.11554,\n        5.83769, 3.63234, 9.50246, 7.13495, 2.80209, 5.30362, 3.8682, 4.26244,\n        2.54735, 3.85473, 8.98668, 4.4107, 5.88093, 3.80531, 3.80531, 4.874,\n        1.72968, 4.61249, 6.14903, 2.5204, 4.4107, 6.72949, 15.48069, 5.25392,\n        9.643, 2.33507, 3.63234, 5.86931, 3.95665, 4.15124, 3.37288, 4.24559,\n        13.07643, 8.1283, 3.68784, 3.7932, 5.90054, 32.52693, 3.7932, 7.16494,\n        7.52157, 10.26848, 4.53077, 6.11127, 16.12113, 5.86378, 3.49215,\n        4.63614, 11.41474, 2.80978, 2.03709, 2.44451, 1.79123, 3.33661,\n        7.16494, 9.31376, 3.8803, 3.68784, 3.11885, 2.8449, 5.90054, 9.69375,\n        15.1404, 5.11781, 3.89857, 92.81556, 4.00394, 3.51222, 2.46859,\n        4.27488, 5.77878, 5.00768, 8.19586, 4.21467, 6.32201, 11.73622,\n        13.06006, 3.74345, 4.9373, 7.28455, 8.90334, 11.33152, 9.86449,\n        4.04697, 5.26106, 11.07399, 7.28455, 5.13173, 11.33152, 2.93405,\n        8.66052, 6.72705, 2.76543, 218.03325, 30.3523, 23.03095, 11.55227,\n        8.88089, 3.37247, 2.18536, 2.17524, 7.38572, 2.89069, 3.50737, 3.64227,\n        3.22139, 3.12195, 8.90334, 3.91207, 43.99865, 17.65578, 5.8392,\n        11.26905, 4.24932, 2.14489, 14.27604, 12.67801, 6.27863, 3.3808,\n        9.28379, 5.47368, 6.7616, 6.43962, 8.63983, 19.81925, 11.755, 2.65634,\n        5.01083, 8.09792, 4.226, 5.1517, 16.39522, 14.79535, 6.7616, 5.65767};\n    //}}}\n\n    char *file_name = \"../data/many/2.1.bed.gz\";\n    struct input_file *i = input_file_init(file_name);\n\n    int chrm_len = 10;\n    char *chrm = (char *)malloc(chrm_len*sizeof(char));\n    uint32_t start, end;\n    long offset;\n    kstring_t line = {0, 0, NULL};\n\n    offset_data_size =\n            sizeof(struct offset_data_append_data_test_struct_larger);\n    offset_data_append_data = offset_data_append_data_test_func_larger;\n\n    struct offset_index *offset_idx = \n            offset_index_init(100,\n                              \"tmp.test_offset_index_add\");\n    TEST_ASSERT_EQUAL(on_disk, offset_idx->type);\n    uint32_t intrv_id;\n\n    while (i->input_file_get_next_interval(i,\n                                           &chrm,\n                                           &chrm_len,\n                                           &start,\n                                           &end,\n                                           &offset,\n                                           &line) >= 0) {\n        intrv_id = offset_index_add(offset_idx,\n                                    offset,\n                                    &line,\n                                    1);\n\n    }\n\n    TEST_ASSERT_EQUAL(1000, offset_idx->index->num);\n    \n    uint32_t j;\n    char A_concat[20];\n    for (j = 0; j < 1000; ++j) {\n        TEST_ASSERT_EQUAL(A_offsets[j], \n                          OFFSET_INDEX_PAIR(offset_idx, j)->offset);\n        struct offset_data_append_data_test_struct_larger *tmp;\n        tmp = (struct offset_data_append_data_test_struct_larger *)\n                OFFSET_INDEX_DATA(offset_idx, j);\n        TEST_ASSERT_EQUAL(A_data[j], tmp->uint);\n        TEST_ASSERT_EQUAL(A_flt[j], tmp->flt);\n        int ret = sprintf(A_concat, \"%u %.6f\", tmp->uint,  tmp->flt);\n        TEST_ASSERT_EQUAL(0, strcmp(A_concat, tmp->concat));\n    }\n\n    if (line.s != NULL)\n        free(line.s);\n    input_file_destroy(&i);\n    offset_index_destroy(&offset_idx);\n    free(chrm);\n}\n//}}}\n\n//{{{ void test_offset_index_store_load_data(void)\nvoid test_offset_index_store_load_data(void)\n{ \n    //{{{ uint32_t A_offsets[1000] = \n    uint32_t A_offsets[1000] = {0, 61, 118, 173, 230, 292, 350, 412, 476, 534,\n        599, 661, 726, 784, 841, 899, 964, 1026, 1085, 1145, 1204, 1267, 1330,\n        1388, 1447, 1508, 1566, 1627, 1686, 1747, 1810, 1873, 1935, 1992, 2050,\n        2108, 2167, 2226, 2285, 2344, 2401, 2460, 2519, 2578, 2636, 2702, 2766,\n        2826, 2886, 2947, 3009, 3069, 3128, 3188, 3248, 3312, 3375, 3441, 3499,\n        3559, 3622, 3683, 3746, 3804, 3863, 3922, 3983, 4043, 4104, 4164, 4225,\n        4285, 4352, 4413, 4480, 4544, 4607, 4668, 4729, 4792, 4853, 4917, 4978,\n        5037, 5101, 5161, 5218, 5285, 5346, 5409, 5465, 5526, 5583, 5645, 5706,\n        5767, 5827, 5887, 5950, 6010, 6069, 6133, 6193, 6254, 6316, 6375, 6435,\n        6494, 6557, 6616, 6676, 6736, 6796, 6855, 6915, 6975, 7033, 7092, 7158,\n        7218, 7277, 7337, 7397, 7455, 7518, 7577, 7637, 7701, 7761, 7822, 7885,\n        7951, 8016, 8078, 8140, 8202, 8264, 8326, 8388, 8453, 8513, 8575, 8636,\n        8698, 8752, 8810, 8868, 8926, 8985, 9043, 9103, 9162, 9222, 9282, 9341,\n        9401, 9461, 9524, 9583, 9641, 9700, 9762, 9822, 9882, 9945, 10008,\n        10065, 10128, 10188, 10248, 10308, 10370, 10427, 10487, 10547, 10606,\n        10665, 10726, 10788, 10853, 10914, 10976, 11039, 11104, 11168, 11229,\n        11291, 11355, 11413, 11470, 11525, 11584, 11641, 11698, 11755, 11815,\n        11877, 11936, 11999, 12058, 12120, 12184, 12244, 12304, 12364, 12427,\n        12491, 12549, 12610, 12674, 12738, 12803, 12869, 12929, 12990, 13049,\n        13111, 13171, 13233, 13296, 13356, 13416, 13480, 13539, 13599, 13663,\n        13725, 13787, 13851, 13913, 13978, 14044, 14105, 14166, 14226, 14288,\n        14351, 14411, 14471, 14530, 14589, 14651, 14715, 14773, 14832, 14893,\n        14957, 15016, 15075, 15135, 15194, 15253, 15313, 15373, 15432, 15491,\n        15550, 15610, 15670, 15731, 15790, 15848, 15910, 15970, 16033, 16092,\n        16156, 16216, 16276, 16335, 16392, 16452, 16511, 16569, 16628, 16686,\n        16746, 16804, 16870, 16932, 16993, 17055, 17116, 17176, 17235, 17297,\n        17357, 17415, 17474, 17537, 17596, 17656, 17717, 17779, 17839, 17899,\n        17958, 18018, 18079, 18138, 18200, 18259, 18317, 18376, 18439, 18503,\n        18566, 18625, 18687, 18748, 18808, 18870, 18931, 18991, 19054, 19115,\n        19175, 19234, 19296, 19358, 19417, 19475, 19536, 19596, 19658, 19716,\n        19776, 19837, 19899, 19958, 20016, 20073, 20137, 20203, 20262, 20321,\n        20382, 20441, 20504, 20564, 20629, 20688, 20747, 20806, 20865, 20923,\n        20982, 21041, 21103, 21164, 21222, 21285, 21341, 21398, 21457, 21516,\n        21575, 21634, 21694, 21757, 21822, 21881, 21941, 22000, 22059, 22123,\n        22181, 22239, 22297, 22355, 22411, 22470, 22531, 22595, 22654, 22715,\n        22778, 22839, 22898, 22956, 23016, 23080, 23140, 23199, 23259, 23319,\n        23382, 23445, 23504, 23564, 23626, 23693, 23757, 23816, 23876, 23936,\n        23996, 24055, 24113, 24172, 24232, 24293, 24353, 24415, 24474, 24536,\n        24594, 24653, 24712, 24776, 24840, 24896, 24956, 25012, 25069, 25128,\n        25184, 25244, 25303, 25364, 25424, 25487, 25546, 25606, 25664, 25722,\n        25784, 25843, 25902, 25962, 26021, 26079, 26138, 26200, 26259, 26321,\n        26382, 26443, 26505, 26563, 26620, 26682, 26738, 26798, 26856, 26915,\n        26975, 27036, 27098, 27158, 27221, 27283, 27343, 27406, 27466, 27525,\n        27587, 27646, 27705, 27767, 27828, 27887, 27947, 28006, 28065, 28131,\n        28191, 28254, 28314, 28372, 28431, 28491, 28551, 28615, 28681, 28741,\n        28800, 28859, 28919, 28978, 29038, 29104, 29165, 29225, 29287, 29344,\n        29401, 29458, 29519, 29578, 29636, 29695, 29754, 29812, 29871, 29934,\n        29996, 30057, 30116, 30174, 30233, 30291, 30352, 30411, 30473, 30531,\n        30592, 30652, 30716, 30775, 30834, 30896, 30959, 31016, 31074, 31133,\n        31194, 31254, 31317, 31376, 31436, 31497, 31558, 31618, 31678, 31739,\n        31802, 31865, 31928, 31988, 32048, 32106, 32167, 32231, 32290, 32355,\n        32414, 32474, 32534, 32599, 32660, 32721, 32781, 32842, 32905, 32966,\n        33027, 33090, 33151, 33213, 33278, 33338, 33399, 33460, 33520, 33578,\n        33639, 33699, 33759, 33819, 33878, 33941, 34001, 34065, 34125, 34185,\n        34245, 34304, 34362, 34421, 34487, 34546, 34605, 34664, 34724, 34787,\n        34846, 34905, 34967, 35027, 35089, 35148, 35207, 35267, 35329, 35389,\n        35451, 35511, 35570, 35630, 35691, 35755, 35814, 35873, 35935, 35998,\n        36064, 36124, 36183, 36247, 36310, 36369, 36430, 36489, 36551, 36611,\n        36670, 36730, 36790, 36850, 36914, 36974, 37033, 37093, 37152, 37210,\n        37269, 37327, 37390, 37455, 37512, 37571, 37631, 37687, 37743, 37806,\n        37864, 37922, 37985, 38043, 38102, 38164, 38223, 38280, 38341, 38399,\n        38461, 38522, 38583, 38642, 38700, 38760, 38822, 38882, 38940, 38999,\n        39064, 39124, 39185, 39248, 39309, 39369, 39434, 39495, 39556, 39616,\n        39680, 39741, 39802, 39862, 39925, 39990, 40052, 40116, 40177, 40237,\n        40298, 40359, 40418, 40479, 40540, 40599, 40665, 40726, 40787, 40850,\n        40914, 40970, 41027, 41085, 41141, 41202, 41260, 41322, 41379, 41438,\n        41498, 41552, 41614, 41677, 41738, 41797, 41860, 41918, 41975, 42032,\n        42091, 42150, 42209, 42267, 42329, 42387, 42448, 42509, 42569, 42630,\n        42690, 42751, 42814, 42874, 42934, 42995, 43059, 43119, 43182, 43245,\n        43304, 43366, 43430, 43486, 43544, 43602, 43661, 43718, 43777, 43836,\n        43895, 43953, 44014, 44073, 44132, 44190, 44249, 44312, 44369, 44431,\n        44489, 44548, 44609, 44674, 44735, 44797, 44858, 44919, 44984, 45045,\n        45103, 45168, 45228, 45290, 45349, 45412, 45475, 45538, 45598, 45659,\n        45719, 45784, 45847, 45910, 45971, 46032, 46093, 46157, 46218, 46280,\n        46344, 46405, 46465, 46526, 46590, 46650, 46714, 46774, 46833, 46893,\n        46953, 47017, 47077, 47131, 47186, 47245, 47305, 47361, 47420, 47476,\n        47533, 47588, 47647, 47706, 47765, 47824, 47883, 47942, 48003, 48061,\n        48121, 48180, 48239, 48298, 48360, 48422, 48478, 48536, 48598, 48663,\n        48724, 48785, 48844, 48908, 48967, 49026, 49086, 49145, 49204, 49263,\n        49325, 49383, 49443, 49506, 49570, 49630, 49691, 49751, 49812, 49873,\n        49933, 49996, 50063, 50127, 50188, 50249, 50309, 50370, 50430, 50490,\n        50551, 50605, 50658, 50712, 50769, 50827, 50887, 50943, 51003, 51066,\n        51125, 51183, 51242, 51303, 51361, 51419, 51481, 51539, 51598, 51657,\n        51715, 51778, 51836, 51894, 51955, 52013, 52074, 52137, 52201, 52265,\n        52325, 52387, 52451, 52515, 52574, 52641, 52701, 52764, 52824, 52884,\n        52947, 53006, 53070, 53131, 53192, 53254, 53314, 53376, 53439, 53498,\n        53556, 53617, 53682, 53745, 53806, 53866, 53925, 53987, 54048, 54108,\n        54169, 54232, 54297, 54356, 54413, 54468, 54525, 54588, 54646, 54704,\n        54766, 54829, 54890, 54949, 55012, 55072, 55129, 55187, 55250, 55307,\n        55365, 55423, 55482, 55540, 55598, 55659, 55716, 55775, 55833, 55890,\n        55948, 56006, 56071, 56133, 56194, 56254, 56314, 56374, 56435, 56496,\n        56560, 56621, 56681, 56742, 56800, 56863, 56926, 56985, 57043, 57101,\n        57163, 57223, 57285, 57342, 57403, 57466, 57523, 57581, 57641, 57698,\n        57759, 57820, 57879, 57937, 57998, 58063, 58126, 58183, 58244, 58305,\n        58365, 58428, 58489, 58549, 58610, 58672, 58733, 58793, 58853, 58918,\n        58982, 59044, 59104, 59164, 59225, 59286, 59347, 59404, 59460, 59522,\n        59581, 59637, 59698, 59760, 59823, 59883, 59944, 60007, 60068, 60127,\n        60187, 60249, 60310, 60372};\n    //}}}\n\n    //{{{uint32_t A_data[1000] = \n    uint32_t A_data[1000] = {1000, 453, 421, 506, 1000, 426, 1000, 1000, 531,\n        1000, 1000, 1000, 490, 397, 497, 1000, 1000, 606, 680, 604, 1000, 1000,\n        534, 482, 692, 448, 893, 494, 670, 1000, 1000, 1000, 487, 565, 472,\n        427, 613, 552, 577, 371, 638, 422, 478, 397, 1000, 1000, 459, 429, 603,\n        630, 429, 426, 443, 380, 752, 768, 1000, 440, 422, 933, 537, 876, 386,\n        415, 379, 481, 415, 556, 409, 579, 473, 1000, 442, 1000, 1000, 905,\n        496, 392, 856, 489, 1000, 427, 415, 1000, 382, 408, 1000, 523, 973,\n        408, 1000, 453, 1000, 1000, 1000, 545, 517, 1000, 402, 370, 1000, 495,\n        945, 1000, 482, 430, 414, 1000, 465, 581, 499, 375, 468, 501, 538, 378,\n        443, 1000, 490, 524, 477, 517, 437, 1000, 397, 370, 1000, 416, 473,\n        993, 1000, 801, 592, 535, 433, 531, 386, 393, 1000, 385, 385, 378, 403,\n        388, 918, 1000, 956, 795, 408, 488, 378, 464, 418, 595, 502, 459, 919,\n        596, 385, 448, 931, 617, 497, 772, 754, 385, 1000, 646, 441, 515, 712,\n        379, 410, 597, 371, 420, 872, 719, 1000, 410, 410, 973, 1000, 732, 403,\n        470, 719, 1000, 400, 436, 552, 386, 389, 393, 373, 788, 371, 1000, 397,\n        896, 1000, 380, 526, 372, 937, 1000, 373, 964, 1000, 1000, 1000, 1000,\n        419, 689, 373, 888, 406, 1000, 1000, 423, 592, 1000, 423, 523, 995,\n        383, 473, 795, 472, 654, 1000, 391, 402, 407, 461, 1000, 395, 424, 407,\n        378, 872, 1000, 378, 479, 503, 1000, 400, 380, 380, 389, 370, 509, 371,\n        393, 378, 444, 436, 478, 424, 383, 393, 986, 472, 1000, 483, 1000, 380,\n        373, 516, 371, 481, 380, 407, 430, 378, 580, 373, 1000, 502, 415, 419,\n        380, 483, 382, 656, 517, 423, 391, 692, 395, 538, 699, 706, 422, 405,\n        372, 569, 841, 508, 1000, 436, 424, 439, 1000, 1000, 1000, 424, 785,\n        646, 580, 724, 640, 427, 1000, 1000, 448, 466, 554, 422, 1000, 772,\n        717, 744, 1000, 578, 499, 914, 694, 380, 402, 393, 1000, 1000, 461,\n        380, 646, 490, 1000, 495, 1000, 525, 436, 414, 393, 371, 509, 530, 668,\n        643, 375, 756, 393, 491, 490, 493, 408, 524, 567, 1000, 1000, 556, 511,\n        452, 465, 1000, 396, 375, 511, 371, 489, 432, 1000, 1000, 400, 708,\n        1000, 672, 380, 440, 391, 1000, 433, 375, 950, 483, 1000, 1000, 461,\n        625, 974, 1000, 1000, 430, 575, 433, 545, 415, 380, 470, 580, 642, 460,\n        896, 403, 754, 564, 392, 430, 1000, 1000, 370, 741, 603, 410, 643, 515,\n        371, 622, 644, 505, 1000, 375, 437, 380, 400, 706, 487, 525, 389, 393,\n        378, 389, 978, 386, 1000, 1000, 882, 1000, 547, 400, 1000, 370, 829,\n        494, 749, 610, 906, 1000, 403, 1000, 744, 423, 1000, 432, 617, 833,\n        502, 380, 996, 589, 429, 525, 416, 430, 1000, 403, 1000, 397, 381, 749,\n        432, 539, 1000, 1000, 484, 558, 422, 399, 516, 480, 1000, 684, 594,\n        677, 424, 432, 443, 864, 509, 371, 547, 501, 428, 580, 1000, 1000, 689,\n        391, 618, 524, 482, 682, 624, 1000, 436, 742, 499, 1000, 458, 397,\n        1000, 1000, 406, 375, 407, 661, 592, 662, 436, 378, 465, 508, 429, 473,\n        380, 882, 623, 1000, 409, 508, 584, 511, 1000, 375, 1000, 373, 501,\n        381, 1000, 493, 440, 494, 413, 757, 624, 491, 734, 413, 863, 1000, 397,\n        389, 386, 371, 876, 1000, 819, 460, 422, 407, 1000, 497, 1000, 432,\n        400, 422, 399, 510, 466, 1000, 436, 573, 381, 376, 1000, 578, 419, 719,\n        482, 656, 390, 388, 511, 843, 426, 723, 538, 372, 400, 884, 1000, 415,\n        450, 681, 656, 1000, 497, 425, 1000, 1000, 444, 820, 450, 816, 431,\n        399, 370, 394, 387, 1000, 625, 385, 524, 422, 385, 387, 403, 1000,\n        1000, 593, 1000, 1000, 530, 458, 1000, 472, 436, 1000, 441, 456, 1000,\n        449, 394, 786, 391, 1000, 1000, 706, 383, 375, 517, 1000, 592, 422,\n        501, 1000, 429, 449, 1000, 386, 591, 1000, 590, 591, 371, 876, 415,\n        389, 375, 1000, 1000, 795, 1000, 472, 401, 451, 392, 469, 493, 437,\n        415, 1000, 430, 554, 952, 1000, 442, 620, 634, 440, 1000, 800, 1000,\n        378, 441, 617, 373, 1000, 1000, 1000, 442, 1000, 530, 436, 499, 503,\n        597, 523, 444, 1000, 544, 691, 737, 390, 452, 385, 397, 809, 400, 380,\n        499, 846, 501, 1000, 809, 371, 640, 1000, 377, 415, 383, 524, 371, 400,\n        479, 389, 508, 985, 410, 486, 380, 423, 1000, 499, 1000, 409, 382, 436,\n        1000, 382, 660, 592, 420, 1000, 380, 389, 1000, 400, 759, 436, 808,\n        1000, 1000, 410, 415, 400, 1000, 1000, 703, 482, 646, 400, 938, 475,\n        651, 1000, 482, 596, 624, 1000, 416, 1000, 424, 373, 371, 483, 809,\n        444, 415, 390, 1000, 1000, 495, 857, 436, 445, 383, 432, 553, 621, 375,\n        460, 473, 748, 566, 632, 484, 504, 520, 1000, 1000, 380, 371, 1000,\n        1000, 1000, 914, 813, 1000, 467, 409, 797, 400, 515, 581, 1000, 524,\n        400, 821, 1000, 489, 490, 432, 524, 444, 559, 1000, 1000, 1000, 376,\n        593, 470, 468, 375, 395, 451, 422, 375, 389, 521, 751, 745, 443, 849,\n        1000, 489, 394, 445, 713, 530, 407, 1000, 503, 519, 402, 382, 1000,\n        385, 389, 901, 444, 731, 877, 1000, 1000, 525, 636, 1000, 1000, 439,\n        1000, 591, 754, 422, 489, 846, 378, 1000, 533, 533, 1000, 370, 631,\n        1000, 382, 378, 422, 1000, 669, 1000, 407, 403, 1000, 524, 372, 504,\n        994, 1000, 1000, 425, 373, 371, 1000, 432, 393, 1000, 1000, 660, 592,\n        1000, 769, 493, 400, 1000, 406, 393, 372, 385, 593, 393, 762, 482, 425,\n        416, 378, 371, 440, 1000, 684, 438, 380, 380, 385, 471, 581, 1000, 552,\n        424, 386, 459, 1000, 1000, 438, 566, 597, 1000, 482, 1000, 372, 897,\n        1000, 400, 407, 482, 534, 940, 686, 411, 424, 921, 1000, 1000, 465,\n        464, 400, 383, 714, 434, 391, 513, 884, 457, 432, 517, 1000, 773, 791,\n        525, 393, 396, 461, 1000, 429, 371, 1000, 458, 371, 713, 1000, 1000,\n        763, 436, 668, 609, 437, 443, 543, 616, 670, 694};\n    //}}}\n\n    //{{{float A_flt[1000] = {\n    float A_flt[1000] = { 12.12021, 3.88225, 3.4088, 14.7654, 3.48997, 1.87484,\n        6.77027, 11.9687, 3.91381, 14.51326, 15.4361, 70.82748, 10.98394,\n        3.4088, 7.00699, 14.99353, 6.74875, 3.70339, 5.9086, 9.46891, 11.11019,\n        12.83984, 2.98867, 10.60518, 3.52535, 9.09015, 6.88074, 5.51758,\n        6.57388, 9.72435, 19.31658, 8.55989, 4.3557, 3.29518, 3.34568,\n        14.73803, 3.03005, 3.24808, 3.78756, 5.30259, 7.87982, 5.11321,\n        2.65129, 703.58101, 16.76629, 9.75298, 6.42889, 5.30259, 4.22043,\n        10.03705, 4.74661, 3.18155, 4.29257, 2.21843, 18.93783, 2.25607,\n        221.42388, 8.7114, 5.11321, 5.26471, 7.95388, 8.08975, 7.6656, 3.31412,\n        3.03005, 2.86171, 7.21588, 6.18635, 3.21943, 3.32893, 9.87197,\n        15.46589, 3.03005, 12.27171, 17.15226, 7.70302, 2.27253, 2.46191,\n        4.22459, 3.93906, 5.11321, 3.50349, 5.51496, 18.43282, 2.33566,\n        7.19637, 19.94784, 4.31782, 3.47468, 8.91237, 55.35055, 8.03434,\n        24.23541, 7.40464, 5.32535, 4.15464, 35.09704, 7.00258, 4.06529,\n        2.34536, 23.12527, 3.14278, 9.09766, 7.56379, 3.40077, 7.28391,\n        5.62886, 9.42185, 5.47251, 4.92526, 3.02764, 2.27835, 3.6744, 3.57667,\n        3.47113, 7.03608, 5.59169, 17.01169, 3.61855, 8.00551, 3.48453,\n        5.54992, 4.10438, 6.30188, 45.08121, 2.34536, 34.71985, 9.38144,\n        12.66495, 11.96134, 31.76898, 11.72681, 7.97423, 6.87972, 3.56495,\n        5.62886, 4.69072, 4.92526, 6.09794, 7.27949, 2.81443, 7.03608, 3.09587,\n        4.29351, 7.28596, 9.12913, 14.21216, 7.02574, 4.87899, 30.27434,\n        5.85479, 2.81897, 2.62071, 3.51287, 5.46447, 2.43949, 11.94931,\n        5.07415, 6.2451, 2.68886, 5.07415, 4.34927, 15.91178, 13.46601,\n        13.07569, 6.2451, 12.33409, 4.57231, 2.73223, 4.87899, 3.51287,\n        3.12255, 3.77308, 3.95198, 5.46447, 2.17928, 9.1725, 8.49777, 9.98567,\n        3.77308, 3.77308, 4.7739, 5.04813, 9.10745, 3.22013, 7.32016, 8.56192,\n        278.95909, 4.47425, 4.47425, 14.64303, 4.0675, 74.15807, 4.27088,\n        3.66075, 9.23069, 5.69451, 6.72335, 3.66075, 3.84153, 26.57438,\n        25.86841, 2.63032, 2.64388, 12.60927, 25.57446, 2.03375, 7.79605,\n        16.21919, 15.89002, 19.9522, 28.35634, 3.45738, 4.37627, 3.66075,\n        7.18593, 711.99196, 8.13501, 7.10458, 4.20309, 5.89788, 11.72182,\n        2.59303, 5.28467, 4.76479, 2.32429, 2.93764, 5.38944, 4.27088,\n        10.77889, 10.98227, 3.52517, 2.55671, 3.254, 20.84931, 20.3708,\n        3.18293, 3.18293, 4.8805, 8.27563, 7.35612, 24.57228, 8.27563,\n        17.58992, 10.50369, 10.82198, 4.6683, 4.03172, 2.63729, 3.81952,\n        7.63905, 5.38724, 1.66492, 4.45611, 8.27563, 5.94148, 12.73175,\n        9.54881, 120.4028, 2.84145, 6.90067, 4.38903, 5.14167, 8.64033,\n        6.69771, 6.37121, 2.36787, 1.76866, 7.50955, 5.6829, 6.73498, 3.85625,\n        2.60949, 6.33298, 6.08882, 7.03598, 3.65329, 16.10157, 4.22158,\n        20.45145, 3.45033, 3.85625, 6.81006, 2.65302, 7.06046, 6.27596, 4.4217,\n        3.70852, 11.79783, 2.50631, 2.46046, 12.4093, 8.80896, 5.72578,\n        2.46046, 2.78139, 5.88372, 6.4186, 7.70232, 6.2211, 4.70697, 8.98604,\n        2.11436, 6.97488, 13.93754, 9.41395, 28.7183, 5.99069, 4.27906,\n        7.41705, 6.76093, 3.97953, 2.37293, 6.10739, 6.4186, 8.49451, 1.9652,\n        3.79767, 2.43906, 8.59356, 13.44763, 14.87347, 9.17197, 14.74953,\n        6.69306, 2.89842, 8.59356, 7.23842, 4.70993, 4.29678, 8.4283, 12.27062,\n        14.30332, 7.50125, 2.25856, 4.36288, 3.8246, 6.66552, 4.21415,\n        132.01495, 16.36082, 5.12308, 5.94939, 5.20571, 6.94095, 6.02564,\n        4.6273, 9.91565, 7.68463, 3.09864, 11.56826, 8.4283, 8.4283, 14.37769,\n        3.59442, 7.65796, 4.17873, 5.65192, 7.84238, 10.78327, 3.71836,\n        6.77569, 7.18884, 5.78413, 10.23115, 2.77158, 2.45482, 3.89341,\n        1.40558, 6.64682, 10.11018, 8.14505, 24.74626, 8.89158, 3.40508,\n        7.80002, 8.41589, 2.87056, 9.10662, 3.06853, 14.19728, 23.05476,\n        2.77158, 5.50356, 1.93874, 8.97464, 4.89715, 2.34735, 4.20686, 8.78987,\n        32.86303, 15.93659, 3.2467, 3.01523, 3.76143, 2.69239, 5.14722,\n        2.53401, 14.9326, 4.55331, 5.62235, 3.36549, 5.22641, 3.2665, 6.73098,\n        6.599, 2.57361, 3.03554, 12.67008, 13.46196, 2.33794, 6.00072, 4.25505,\n        2.56394, 3.19129, 4.546, 2.12752, 5.81888, 12.42236, 2.58404, 7.85549,\n        3.6368, 4.50054, 2.63668, 5.4552, 7.85549, 5.4552, 12.73173, 17.79964,\n        5.18244, 7.09176, 3.16401, 17.89681, 7.63728, 23.66953, 7.53271,\n        13.70596, 15.50422, 6.09442, 6.58198, 13.31022, 2.92532, 4.91617,\n        8.07562, 6.985, 7.06953, 6.26855, 10.6043, 3.01674, 5.53584, 9.01975,\n        2.66413, 7.77039, 3.14472, 7.7539, 8.19699, 3.94918, 4.17865, 4.87554,\n        20.61221, 5.11931, 3.83948, 7.31331, 7.93728, 17.58677, 2.77905,\n        12.70687, 2.40294, 3.83948, 5.22379, 3.14472, 3.96137, 12.43263,\n        47.90219, 2.74249, 8.9588, 4.93648, 1.98068, 5.60687, 4.11373,\n        27.75734, 5.18026, 3.57539, 9.53361, 3.88196, 2.63503, 2.72913,\n        12.16264, 5.29359, 3.29378, 5.62242, 4.51719, 2.95768, 3.59322,\n        27.57372, 6.74442, 6.03861, 2.91735, 7.1355, 8.94028, 3.41142, 4.75769,\n        2.91735, 9.81469, 4.86226, 5.17595, 14.11624, 34.34951, 2.62718,\n        941.31799, 4.42308, 10.56239, 6.58757, 2.43113, 1.42451, 4.10654,\n        10.82245, 3.92117, 6.3523, 7.05812, 5.48964, 4.73982, 6.11703, 6.65148,\n        18.89433, 356.30091, 293.75971, 10.60102, 4.23487, 4.6113, 7.8496,\n        6.43073, 10.19506, 2.94088, 23.91918, 3.24673, 3.58787, 4.00325,\n        10.19506, 2.99435, 3.67022, 5.05831, 2.70561, 5.28051, 4.33943,\n        2.86245, 5.12367, 2.70561, 31.8797, 14.78844, 92.30747, 610.58464,\n        4.70541, 3.29378, 8.28664, 6.62077, 4.44232, 3.75888, 6.87706, 5.86581,\n        6.50748, 3.75888, 16.42786, 2.32367, 2.08447, 2.93876, 2.90459,\n        3.89557, 5.63833, 14.66536, 4.9549, 4.51066, 3.58803, 2.00758, 6.05807,\n        2.26387, 2.4399, 3.31953, 2.78779, 5.70311, 2.5287, 2.73373, 2.38517,\n        9.71738, 3.09189, 5.55278, 3.97529, 2.35572, 2.25266, 8.6573, 17.99924,\n        6.52081, 4.85869, 7.15639, 10.11753, 46.59926, 22.22549, 3.86486,\n        62.05873, 6.65638, 2.88552, 8.07947, 2.93799, 3.23178, 1.65818,\n        3.55007, 2.09856, 4.22336, 3.30523, 17.87277, 5.21493, 5.87598,\n        8.53824, 4.95785, 5.87598, 2.57074, 3.0298, 10.7948, 12.87665, 3.38472,\n        6.62337, 6.41995, 3.47825, 2.89037, 10.73001, 5.19463, 2.69441,\n        16.18051, 2.7434, 2.38164, 3.65484, 3.44885, 4.50702, 3.03308, 3.03048,\n        6.58418, 8.08771, 3.28229, 2.23951, 3.91915, 11.88933, 5.29086,\n        10.25454, 3.40792, 4.70298, 14.73023, 5.40111, 3.44885, 5.91792,\n        13.13354, 2.76646, 14.78081, 12.97096, 2.64027, 5.48681, 10.09529,\n        17.67994, 13.15142, 3.91915, 4.74909, 12.23336, 7.05448, 5.74809,\n        4.96426, 2.82179, 2.65631, 2.35149, 2.98835, 3.18431, 2.46906, 5.0949,\n        44.87433, 4.18043, 8.62214, 6.27064, 5.13025, 2.80661, 3.43829,\n        5.56028, 10.8051, 22.24113, 12.43104, 6.72841, 7.14893, 3.60658,\n        11.96839, 4.28936, 7.14893, 11.98298, 7.6851, 2.26383, 9.27773,\n        4.95659, 2.62127, 7.90684, 6.35461, 5.41946, 4.21893, 6.67234, 9.87853,\n        4.60709, 5.16776, 5.48085, 2.10496, 6.91063, 2.3234, 3.05021, 6.01702,\n        5.07265, 4.52766, 8.34042, 12.54419, 4.57531, 6.08227, 6.01702, 4.7149,\n        5.10638, 3.61955, 3.25597, 2.95997, 3.10797, 3.10797, 6.21595, 2.08336,\n        4.77296, 1.62798, 4.52876, 7.61137, 3.19677, 4.88396, 93.19067,\n        4.23694, 4.27716, 7.57789, 5.18921, 3.99597, 2.34683, 4.58796,\n        12.93933, 2.51598, 9.19883, 7.54794, 3.03397, 11.91391, 15.83552,\n        66.766, 4.46463, 4.88396, 6.51195, 4.58796, 8.73091, 6.13001, 8.6826,\n        2.35318, 166.66526, 7.99194, 10.65592, 7.2654, 6.87075, 10.34996,\n        4.3413, 2.49748, 14.62498, 3.05864, 8.58393, 7.07782, 3.77397, 4.27346,\n        6.88194, 6.90661, 8.87993, 9.19961, 9.32393, 3.99597, 3.10797, 3.32997,\n        15.53988, 6.21595, 22.91597, 1.75206, 6.51226, 4.33224, 2.9566,\n        4.07902, 4.87641, 2.58703, 3.77788, 2.62809, 2.37258, 2.60984, 2.54596,\n        3.96007, 2.66459, 2.87447, 5.0098, 4.12986, 2.73759, 2.54596, 11.49791,\n        6.67973, 3.92785, 2.20943, 3.44937, 6.33906, 10.21515, 7.68677,\n        5.46142, 5.831, 6.92731, 2.00565, 1.74629, 2.80603, 2.21745, 5.25618,\n        4.37766, 5.34069, 7.9774, 5.95029, 4.92767, 4.91707, 2.0921, 1.92053,\n        3.94214, 3.16192, 1.82823, 4.92767, 7.30306, 12.37394, 5.09193,\n        1.66445, 2.57012, 9.52684, 3.86001, 2.54596, 3.28511, 4.95543, 5.96741,\n        3.45937, 3.00965, 6.91874, 6.44925, 15.56717, 4.4107, 20.14233,\n        50.63039, 3.85473, 3.97827, 3.94368, 5.24671, 4.2995, 5.44851,\n        10.41518, 2.76749, 6.61812, 2.35866, 2.5204, 10.63757, 4.67015,\n        625.8006, 7.78358, 3.33582, 3.66116, 23.55738, 7.00523, 20.11554,\n        5.83769, 3.63234, 9.50246, 7.13495, 2.80209, 5.30362, 3.8682, 4.26244,\n        2.54735, 3.85473, 8.98668, 4.4107, 5.88093, 3.80531, 3.80531, 4.874,\n        1.72968, 4.61249, 6.14903, 2.5204, 4.4107, 6.72949, 15.48069, 5.25392,\n        9.643, 2.33507, 3.63234, 5.86931, 3.95665, 4.15124, 3.37288, 4.24559,\n        13.07643, 8.1283, 3.68784, 3.7932, 5.90054, 32.52693, 3.7932, 7.16494,\n        7.52157, 10.26848, 4.53077, 6.11127, 16.12113, 5.86378, 3.49215,\n        4.63614, 11.41474, 2.80978, 2.03709, 2.44451, 1.79123, 3.33661,\n        7.16494, 9.31376, 3.8803, 3.68784, 3.11885, 2.8449, 5.90054, 9.69375,\n        15.1404, 5.11781, 3.89857, 92.81556, 4.00394, 3.51222, 2.46859,\n        4.27488, 5.77878, 5.00768, 8.19586, 4.21467, 6.32201, 11.73622,\n        13.06006, 3.74345, 4.9373, 7.28455, 8.90334, 11.33152, 9.86449,\n        4.04697, 5.26106, 11.07399, 7.28455, 5.13173, 11.33152, 2.93405,\n        8.66052, 6.72705, 2.76543, 218.03325, 30.3523, 23.03095, 11.55227,\n        8.88089, 3.37247, 2.18536, 2.17524, 7.38572, 2.89069, 3.50737, 3.64227,\n        3.22139, 3.12195, 8.90334, 3.91207, 43.99865, 17.65578, 5.8392,\n        11.26905, 4.24932, 2.14489, 14.27604, 12.67801, 6.27863, 3.3808,\n        9.28379, 5.47368, 6.7616, 6.43962, 8.63983, 19.81925, 11.755, 2.65634,\n        5.01083, 8.09792, 4.226, 5.1517, 16.39522, 14.79535, 6.7616, 5.65767};\n    //}}}\n\n    char *file_name = \"../data/many/2.1.bed.gz\";\n    struct input_file *i = input_file_init(file_name);\n\n    int chrm_len = 10;\n    char *chrm = (char *)malloc(chrm_len*sizeof(char));\n    uint32_t start, end;\n    long offset;\n    kstring_t line = {0, 0, NULL};\n\n    offset_data_size =\n            sizeof(struct offset_data_append_data_test_struct_larger);\n    offset_data_append_data = offset_data_append_data_test_func_larger;\n\n    struct offset_index *offset_idx = \n            offset_index_init(10,\n                              \"tmp.test_offset_index_add\");\n    TEST_ASSERT_EQUAL(on_disk, offset_idx->type);\n    uint32_t intrv_id;\n\n    while (i->input_file_get_next_interval(i,\n                                           &chrm,\n                                           &chrm_len,\n                                           &start,\n                                           &end,\n                                           &offset,\n                                           &line) >= 0) {\n        intrv_id = offset_index_add(offset_idx,\n                                    offset,\n                                    &line,\n                                    1);\n\n    }\n\n    TEST_ASSERT_EQUAL(1000, offset_idx->index->num);\n    \n    uint32_t j;\n    char A_concat[20];\n    for (j = 0; j < 1000; ++j) {\n        TEST_ASSERT_EQUAL(A_offsets[j], \n                          OFFSET_INDEX_PAIR(offset_idx, j)->offset);\n        struct offset_data_append_data_test_struct_larger *tmp;\n        tmp = (struct offset_data_append_data_test_struct_larger *)\n                OFFSET_INDEX_DATA(offset_idx, j);\n        TEST_ASSERT_EQUAL(A_data[j], tmp->uint);\n        TEST_ASSERT_EQUAL(A_flt[j], tmp->flt);\n        int ret = sprintf(A_concat, \"%u %.6f\", tmp->uint,  tmp->flt);\n        TEST_ASSERT_EQUAL(0, strcmp(A_concat, tmp->concat));\n    }\n\n    if (line.s != NULL)\n        free(line.s);\n    input_file_destroy(&i);\n\n    offset_index_store(offset_idx);\n\n    offset_index_destroy(&offset_idx);\n    free(chrm);\n\n    offset_idx = offset_index_load(\"tmp.test_offset_index_add\");\n    TEST_ASSERT_EQUAL(on_disk, offset_idx->type);\n\n    for (j = 0; j < 1000; ++j) {\n        TEST_ASSERT_EQUAL(A_offsets[j], \n                          OFFSET_INDEX_PAIR(offset_idx, j)->offset);\n        struct offset_data_append_data_test_struct_larger *tmp;\n        tmp = (struct offset_data_append_data_test_struct_larger *)\n                OFFSET_INDEX_DATA(offset_idx, j);\n        TEST_ASSERT_EQUAL(A_data[j], tmp->uint);\n        TEST_ASSERT_EQUAL(A_flt[j], tmp->flt);\n        int ret = sprintf(A_concat, \"%u %.6f\", tmp->uint,  tmp->flt);\n        TEST_ASSERT_EQUAL(0, strcmp(A_concat, tmp->concat));\n    }\n\n    offset_index_destroy(&offset_idx);\n\n    remove(\"tmp.test_offset_index_add\");\n}\n//}}}\n\n"
  },
  {
    "path": "test/unit/test_util.c",
    "content": "#include <stdio.h>\n#include <stdlib.h>\n#include <math.h>\n#include <stdio.h>\n#include <inttypes.h>\n#include <string.h>\n#include <htslib/bgzf.h>\n#include <htslib/tbx.h>\n#include <htslib/kstring.h>\n\n#include \"unity.h\"\n#include \"bpt.h\"\n#include \"giggle_index.h\"\n#include \"file_read.h\"\n#include \"lists.h\"\n#include \"util.h\"\n\nvoid setUp(void) { }\nvoid tearDown(void) { }\n\n//{{{void test_safe_subtract(void)\nvoid test_safe_subtract(void)\n{\n    uint32_t a, b, r;\n\n    a = 10;\n    b = 5;\n\n    r = safe_subtract(a, b);\n    TEST_ASSERT_EQUAL(5, r);\n\n    r = safe_subtract(b, a);\n    TEST_ASSERT_EQUAL(0, r);\n\n    r = safe_subtract(a, a);\n    TEST_ASSERT_EQUAL(0, r);\n}\n//}}}\n\n//{{{ test_parse_region\nvoid test_parse_region_basic(void)\n{\n    char *chrm = NULL;\n    uint32_t start, end;\n    char region[] = \"chr1:1000-2000\";\n\n    int result = parse_region(region, &chrm, &start, &end);\n\n    TEST_ASSERT_EQUAL(0, result);\n    TEST_ASSERT_EQUAL_STRING(\"chr1\", chrm);\n    TEST_ASSERT_EQUAL(1000, start);\n    TEST_ASSERT_EQUAL(2000, end);\n\n    free(chrm);\n}\n\nvoid test_parse_region_no_chr_prefix(void)\n{\n    char *chrm = NULL;\n    uint32_t start, end;\n    char region[] = \"1:500-1500\";\n\n    int result = parse_region(region, &chrm, &start, &end);\n\n    TEST_ASSERT_EQUAL(0, result);\n    TEST_ASSERT_EQUAL_STRING(\"1\", chrm);\n    TEST_ASSERT_EQUAL(500, start);\n    TEST_ASSERT_EQUAL(1500, end);\n\n    free(chrm);\n}\n\nvoid test_parse_region_chrX(void)\n{\n    char *chrm = NULL;\n    uint32_t start, end;\n    char region[] = \"chrX:100-200\";\n\n    int result = parse_region(region, &chrm, &start, &end);\n\n    TEST_ASSERT_EQUAL(0, result);\n    TEST_ASSERT_EQUAL_STRING(\"chrX\", chrm);\n    TEST_ASSERT_EQUAL(100, start);\n    TEST_ASSERT_EQUAL(200, end);\n\n    free(chrm);\n}\n\nvoid test_parse_region_large_coords(void)\n{\n    char *chrm = NULL;\n    uint32_t start, end;\n    char region[] = \"chr1:1000000-2000000\";\n\n    int result = parse_region(region, &chrm, &start, &end);\n\n    TEST_ASSERT_EQUAL(0, result);\n    TEST_ASSERT_EQUAL_STRING(\"chr1\", chrm);\n    TEST_ASSERT_EQUAL(1000000, start);\n    TEST_ASSERT_EQUAL(2000000, end);\n\n    free(chrm);\n}\n\nvoid test_parse_region_zero_start(void)\n{\n    char *chrm = NULL;\n    uint32_t start, end;\n    char region[] = \"chr1:0-100\";\n\n    int result = parse_region(region, &chrm, &start, &end);\n\n    TEST_ASSERT_EQUAL(0, result);\n    TEST_ASSERT_EQUAL_STRING(\"chr1\", chrm);\n    TEST_ASSERT_EQUAL(0, start);\n    TEST_ASSERT_EQUAL(100, end);\n\n    free(chrm);\n}\n//}}}\n\n//{{{ test_safe_dirname_basename\nvoid test_safe_dirname(void)\n{\n    char result[4096];\n\n    safe_dirname(\"/path/to/file.txt\", result);\n    TEST_ASSERT_EQUAL_STRING(\"/path/to\", result);\n\n    safe_dirname(\"/path/to/\", result);\n    TEST_ASSERT_EQUAL_STRING(\"/path\", result);\n\n    safe_dirname(\"file.txt\", result);\n    TEST_ASSERT_EQUAL_STRING(\".\", result);\n\n    safe_dirname(\"/\", result);\n    TEST_ASSERT_EQUAL_STRING(\"/\", result);\n}\n\nvoid test_safe_basename(void)\n{\n    char result[4096];\n\n    safe_basename(\"/path/to/file.txt\", result);\n    TEST_ASSERT_EQUAL_STRING(\"file.txt\", result);\n\n    safe_basename(\"/path/to/\", result);\n    TEST_ASSERT_EQUAL_STRING(\"to\", result);\n\n    safe_basename(\"file.txt\", result);\n    TEST_ASSERT_EQUAL_STRING(\"file.txt\", result);\n}\n//}}}\n\n//{{{ test_long_cmp\nvoid test_long_cmp(void)\n{\n    long a = 10, b = 20, c = 10;\n\n    // a < b should return negative\n    TEST_ASSERT_TRUE(long_cmp(&a, &b) < 0);\n\n    // b > a should return positive\n    TEST_ASSERT_TRUE(long_cmp(&b, &a) > 0);\n\n    // a == c should return 0\n    TEST_ASSERT_EQUAL(0, long_cmp(&a, &c));\n}\n//}}}\n\n"
  },
  {
    "path": "test/unit/test_zlib_wrapper.c",
    "content": "#include <stdio.h>\n#include <stdlib.h>\n#include <math.h>\n#include <stdio.h>\n#include <inttypes.h>\n#include <string.h>\n\n#include \"unity/unity.h\"\n#include \"zlib_wrapper.h\"\n\nvoid setUp(void) { }\nvoid tearDown(void) { }\n\nvoid test_zlib_wrapper(void)\n{\n    uint32_t x = 789;\n    void *data = &x;\n    uLong uncompressed_size = sizeof(x);\n    uLong compressed_size;\n    void *compressed_data = zlib_compress(data, uncompressed_size, 6, &compressed_size);\n    void *uncompressed_data = zlib_uncompress(compressed_data, compressed_size, uncompressed_size);\n    uint32_t y = *((uint32_t *)uncompressed_data);\n    TEST_ASSERT_EQUAL(x, y);\n}"
  },
  {
    "path": "test/unit/unity/generate_test_runner.rb",
    "content": "# ==========================================\n#   Unity Project - A Test Framework for C\n#   Copyright (c) 2007 Mike Karlesky, Mark VanderVoord, Greg Williams\n#   [Released under MIT License. Please refer to license.txt for details]\n# ==========================================\n\n$QUICK_RUBY_VERSION = RUBY_VERSION.split('.').inject(0){|vv,v| vv * 100 + v.to_i }\nFile.expand_path(File.join(File.dirname(__FILE__),'colour_prompt'))\n\nclass UnityTestRunnerGenerator\n\n  def initialize(options = nil)\n    @options = UnityTestRunnerGenerator.default_options\n    case(options)\n      when NilClass then @options\n      when String   then @options.merge!(UnityTestRunnerGenerator.grab_config(options))\n      when Hash     then @options.merge!(options)\n      else          raise \"If you specify arguments, it should be a filename or a hash of options\"\n    end\n    require \"#{File.expand_path(File.dirname(__FILE__))}/type_sanitizer\"\n  end\n\n  def self.default_options\n    {\n      :includes         => [],\n      :defines          => [],\n      :plugins          => [],\n      :framework        => :unity,\n      :test_prefix      => \"test|spec|should\",\n      :setup_name       => \"setUp\",\n      :teardown_name    => \"tearDown\",\n      :main_name        => \"main\", #set to :auto to automatically generate each time\n      :main_export_decl => \"\",\n      :cmdline_args     => false,\n      :use_param_tests  => false,\n    }\n  end\n\n  def self.grab_config(config_file)\n    options = self.default_options\n    unless (config_file.nil? or config_file.empty?)\n      require 'yaml'\n      yaml_guts = YAML.load_file(config_file)\n      options.merge!(yaml_guts[:unity] || yaml_guts[:cmock])\n      raise \"No :unity or :cmock section found in #{config_file}\" unless options\n    end\n    return(options)\n  end\n\n  def run(input_file, output_file, options=nil)\n    tests = []\n    testfile_includes = []\n    used_mocks = []\n\n    @options.merge!(options) unless options.nil?\n    module_name = File.basename(input_file)\n\n    #pull required data from source file\n    source = File.read(input_file)\n    source = source.force_encoding(\"ISO-8859-1\").encode(\"utf-8\", :replace => nil) if ($QUICK_RUBY_VERSION > 10900)\n    tests               = find_tests(source)\n    headers             = find_includes(source)\n    testfile_includes   = (headers[:local] + headers[:system])\n    used_mocks          = find_mocks(testfile_includes)\n    testfile_includes   = (testfile_includes - used_mocks)\n    testfile_includes.delete_if{|inc| inc =~ /(unity|cmock)/}\n\n    #build runner file\n    generate(input_file, output_file, tests, used_mocks, testfile_includes)\n\n    #determine which files were used to return them\n    all_files_used = [input_file, output_file]\n    all_files_used += testfile_includes.map {|filename| filename + '.c'} unless testfile_includes.empty?\n    all_files_used += @options[:includes] unless @options[:includes].empty?\n    return all_files_used.uniq\n  end\n\n  def generate(input_file, output_file, tests, used_mocks, testfile_includes)\n    File.open(output_file, 'w') do |output|\n      create_header(output, used_mocks, testfile_includes)\n      create_externs(output, tests, used_mocks)\n      create_mock_management(output, used_mocks)\n      create_suite_setup_and_teardown(output)\n      create_reset(output, used_mocks)\n      create_main(output, input_file, tests, used_mocks)\n    end\n\n    if (@options[:header_file] && !@options[:header_file].empty?)\n      File.open(@options[:header_file], 'w') do |output|\n        create_h_file(output, @options[:header_file], tests, testfile_includes, used_mocks)\n      end\n    end\n  end\n\n  def find_tests(source)\n    tests_and_line_numbers = []\n\n    source_scrubbed = source.clone\n    source_scrubbed = source_scrubbed.gsub(/\"[^\"\\n]*\"/, '')      # remove things in strings\n    source_scrubbed = source_scrubbed.gsub(/\\/\\/.*$/, '')      # remove line comments\n    source_scrubbed = source_scrubbed.gsub(/\\/\\*.*?\\*\\//m, '') # remove block comments\n    lines = source_scrubbed.split(/(^\\s*\\#.*$)                 # Treat preprocessor directives as a logical line\n                              | (;|\\{|\\}) /x)                  # Match ;, {, and } as end of lines\n\n    lines.each_with_index do |line, index|\n      #find tests\n      if line =~ /^((?:\\s*TEST_CASE\\s*\\(.*?\\)\\s*)*)\\s*void\\s+((?:#{@options[:test_prefix]}).*)\\s*\\(\\s*(.*)\\s*\\)/\n        arguments = $1\n        name = $2\n        call = $3\n        params = $4\n        args = nil\n        if (@options[:use_param_tests] and !arguments.empty?)\n          args = []\n          arguments.scan(/\\s*TEST_CASE\\s*\\((.*)\\)\\s*$/) {|a| args << a[0]}\n        end\n        tests_and_line_numbers << { :test => name, :args => args, :call => call, :params => params, :line_number => 0 }\n      end\n    end\n    tests_and_line_numbers.uniq! {|v| v[:test] }\n\n    #determine line numbers and create tests to run\n    source_lines = source.split(\"\\n\")\n    source_index = 0;\n    tests_and_line_numbers.size.times do |i|\n      source_lines[source_index..-1].each_with_index do |line, index|\n        if (line =~ /#{tests_and_line_numbers[i][:test]}/)\n          source_index += index\n          tests_and_line_numbers[i][:line_number] = source_index + 1\n          break\n        end\n      end\n    end\n\n    return tests_and_line_numbers\n  end\n\n  def find_includes(source)\n\n    #remove comments (block and line, in three steps to ensure correct precedence)\n    source.gsub!(/\\/\\/(?:.+\\/\\*|\\*(?:$|[^\\/])).*$/, '')  # remove line comments that comment out the start of blocks\n    source.gsub!(/\\/\\*.*?\\*\\//m, '')                     # remove block comments\n    source.gsub!(/\\/\\/.*$/, '')                          # remove line comments (all that remain)\n\n    #parse out includes\n    includes = {\n      :local => source.scan(/^\\s*#include\\s+\\\"\\s*(.+)\\.[hH]\\s*\\\"/).flatten,\n      :system => source.scan(/^\\s*#include\\s+<\\s*(.+)\\s*>/).flatten.map { |inc| \"<#{inc}>\" }\n    }\n    return includes\n  end\n\n  def find_mocks(includes)\n    mock_headers = []\n    includes.each do |include_path|\n      include_file = File.basename(include_path)\n      mock_headers << include_path if (include_file =~ /^mock/i)\n    end\n    return mock_headers\n  end\n\n  def create_header(output, mocks, testfile_includes=[])\n    output.puts('/* AUTOGENERATED FILE. DO NOT EDIT. */')\n    create_runtest(output, mocks)\n    output.puts(\"\\n/*=======Automagically Detected Files To Include=====*/\")\n    output.puts(\"#include \\\"#{@options[:framework].to_s}.h\\\"\")\n    output.puts('#include \"cmock.h\"') unless (mocks.empty?)\n    output.puts('#include <setjmp.h>')\n    output.puts('#include <stdio.h>')\n    output.puts('#include \"CException.h\"') if @options[:plugins].include?(:cexception)\n    if (@options[:defines] && !@options[:defines].empty?)\n      @options[:defines].each {|d| output.puts(\"#define #{d}\")}\n    end\n    if (@options[:header_file] && !@options[:header_file].empty?)\n      output.puts(\"#include \\\"#{File.basename(@options[:header_file])}\\\"\")\n    else\n      @options[:includes].flatten.uniq.compact.each do |inc|\n        output.puts(\"#include #{inc.include?('<') ? inc : \"\\\"#{inc.gsub('.h','')}.h\\\"\"}\")\n      end\n      testfile_includes.each do |inc|\n        output.puts(\"#include #{inc.include?('<') ? inc : \"\\\"#{inc.gsub('.h','')}.h\\\"\"}\")\n      end\n    end\n    mocks.each do |mock|\n      output.puts(\"#include \\\"#{mock.gsub('.h','')}.h\\\"\")\n    end\n    if @options[:enforce_strict_ordering]\n      output.puts('')\n      output.puts('int GlobalExpectCount;')\n      output.puts('int GlobalVerifyOrder;')\n      output.puts('char* GlobalOrderError;')\n    end\n  end\n\n  def create_externs(output, tests, mocks)\n    output.puts(\"\\n/*=======External Functions This Runner Calls=====*/\")\n    output.puts(\"extern void #{@options[:setup_name]}(void);\")\n    output.puts(\"extern void #{@options[:teardown_name]}(void);\")\n    tests.each do |test|\n      output.puts(\"extern void #{test[:test]}(#{test[:call] || 'void'});\")\n    end\n    output.puts('')\n  end\n\n  def create_mock_management(output, mock_headers)\n    unless (mock_headers.empty?)\n      output.puts(\"\\n/*=======Mock Management=====*/\")\n      output.puts(\"static void CMock_Init(void)\")\n      output.puts(\"{\")\n      if @options[:enforce_strict_ordering]\n        output.puts(\"  GlobalExpectCount = 0;\")\n        output.puts(\"  GlobalVerifyOrder = 0;\")\n        output.puts(\"  GlobalOrderError = NULL;\")\n      end\n      mocks = mock_headers.map {|mock| File.basename(mock)}\n      mocks.each do |mock|\n        mock_clean = TypeSanitizer.sanitize_c_identifier(mock)\n        output.puts(\"  #{mock_clean}_Init();\")\n      end\n      output.puts(\"}\\n\")\n\n      output.puts(\"static void CMock_Verify(void)\")\n      output.puts(\"{\")\n      mocks.each do |mock|\n        mock_clean = TypeSanitizer.sanitize_c_identifier(mock)\n        output.puts(\"  #{mock_clean}_Verify();\")\n      end\n      output.puts(\"}\\n\")\n\n      output.puts(\"static void CMock_Destroy(void)\")\n      output.puts(\"{\")\n      mocks.each do |mock|\n        mock_clean = TypeSanitizer.sanitize_c_identifier(mock)\n        output.puts(\"  #{mock_clean}_Destroy();\")\n      end\n      output.puts(\"}\\n\")\n    end\n  end\n\n  def create_suite_setup_and_teardown(output)\n    unless (@options[:suite_setup].nil?)\n      output.puts(\"\\n/*=======Suite Setup=====*/\")\n      output.puts(\"static void suite_setup(void)\")\n      output.puts(\"{\")\n      output.puts(@options[:suite_setup])\n      output.puts(\"}\")\n    end\n    unless (@options[:suite_teardown].nil?)\n      output.puts(\"\\n/*=======Suite Teardown=====*/\")\n      output.puts(\"static int suite_teardown(int num_failures)\")\n      output.puts(\"{\")\n      output.puts(@options[:suite_teardown])\n      output.puts(\"}\")\n    end\n  end\n\n  def create_runtest(output, used_mocks)\n    cexception = @options[:plugins].include? :cexception\n    va_args1   = @options[:use_param_tests] ? ', ...' : ''\n    va_args2   = @options[:use_param_tests] ? '__VA_ARGS__' : ''\n    output.puts(\"\\n/*=======Test Runner Used To Run Each Test Below=====*/\")\n    output.puts(\"#define RUN_TEST_NO_ARGS\") if @options[:use_param_tests]\n    output.puts(\"#define RUN_TEST(TestFunc, TestLineNum#{va_args1}) \\\\\")\n    output.puts(\"{ \\\\\")\n    output.puts(\"  Unity.CurrentTestName = #TestFunc#{va_args2.empty? ? '' : \" \\\"(\\\" ##{va_args2} \\\")\\\"\"}; \\\\\")\n    output.puts(\"  Unity.CurrentTestLineNumber = TestLineNum; \\\\\")\n    output.puts(\"  if (UnityTestMatches()) { \\\\\") if (@options[:cmdline_args])\n    output.puts(\"  Unity.NumberOfTests++; \\\\\")\n    output.puts(\"  CMock_Init(); \\\\\") unless (used_mocks.empty?)\n    output.puts(\"  UNITY_CLR_DETAILS(); \\\\\") unless (used_mocks.empty?)\n    output.puts(\"  if (TEST_PROTECT()) \\\\\")\n    output.puts(\"  { \\\\\")\n    output.puts(\"    CEXCEPTION_T e; \\\\\") if cexception\n    output.puts(\"    Try { \\\\\") if cexception\n    output.puts(\"      #{@options[:setup_name]}(); \\\\\")\n    output.puts(\"      TestFunc(#{va_args2}); \\\\\")\n    output.puts(\"    } Catch(e) { TEST_ASSERT_EQUAL_HEX32_MESSAGE(CEXCEPTION_NONE, e, \\\"Unhandled Exception!\\\"); } \\\\\") if cexception\n    output.puts(\"  } \\\\\")\n    output.puts(\"  if (TEST_PROTECT() && !TEST_IS_IGNORED) \\\\\")\n    output.puts(\"  { \\\\\")\n    output.puts(\"    #{@options[:teardown_name]}(); \\\\\")\n    output.puts(\"    CMock_Verify(); \\\\\") unless (used_mocks.empty?)\n    output.puts(\"  } \\\\\")\n    output.puts(\"  CMock_Destroy(); \\\\\") unless (used_mocks.empty?)\n    output.puts(\"  UnityConcludeTest(); \\\\\")\n    output.puts(\"  } \\\\\")  if (@options[:cmdline_args])\n    output.puts(\"}\\n\")\n  end\n\n  def create_reset(output, used_mocks)\n    output.puts(\"\\n/*=======Test Reset Option=====*/\")\n    output.puts(\"void resetTest(void);\")\n    output.puts(\"void resetTest(void)\")\n    output.puts(\"{\")\n    output.puts(\"  CMock_Verify();\") unless (used_mocks.empty?)\n    output.puts(\"  CMock_Destroy();\") unless (used_mocks.empty?)\n    output.puts(\"  #{@options[:teardown_name]}();\")\n    output.puts(\"  CMock_Init();\") unless (used_mocks.empty?)\n    output.puts(\"  #{@options[:setup_name]}();\")\n    output.puts(\"}\")\n  end\n\n  def create_main(output, filename, tests, used_mocks)\n    output.puts(\"\\n\\n/*=======MAIN=====*/\")\n    main_name = (@options[:main_name].to_sym == :auto) ? \"main_#{filename.gsub('.c','')}\" : \"#{@options[:main_name]}\"\n    if (@options[:cmdline_args])\n      if (main_name != \"main\")\n        output.puts(\"#{@options[:main_export_decl]} int #{main_name}(int argc, char** argv);\")\n      end\n      output.puts(\"#{@options[:main_export_decl]} int #{main_name}(int argc, char** argv)\")\n      output.puts(\"{\")\n      output.puts(\"  int parse_status = UnityParseOptions(argc, argv);\")\n      output.puts(\"  if (parse_status != 0)\")\n      output.puts(\"  {\")\n      output.puts(\"    if (parse_status < 0)\")\n      output.puts(\"    {\")\n      output.puts(\"      UnityPrint(\\\"#{filename.gsub('.c','')}.\\\");\")\n      output.puts(\"      UNITY_PRINT_EOL();\")\n      if (@options[:use_param_tests])\n        tests.each do |test|\n          if ((test[:args].nil?) or (test[:args].empty?))\n            output.puts(\"      UnityPrint(\\\"  #{test[:test]}(RUN_TEST_NO_ARGS)\\\");\")\n            output.puts(\"      UNITY_PRINT_EOL();\")\n          else\n            test[:args].each do |args|\n              output.puts(\"      UnityPrint(\\\"  #{test[:test]}(#{args})\\\");\")\n              output.puts(\"      UNITY_PRINT_EOL();\")\n            end\n          end\n        end\n      else\n        tests.each { |test| output.puts(\"      UnityPrint(\\\"  #{test[:test]}\\\");\\n    UNITY_PRINT_EOL();\")}\n      end\n      output.puts(\"    return 0;\")\n      output.puts(\"    }\")\n      output.puts(\"  return parse_status;\")\n      output.puts(\"  }\")\n    else\n      if (main_name != \"main\")\n        output.puts(\"#{@options[:main_export_decl]} int #{main_name}(void);\")\n      end\n      output.puts(\"int #{main_name}(void)\")\n      output.puts(\"{\")\n    end\n    output.puts(\"  suite_setup();\") unless @options[:suite_setup].nil?\n    output.puts(\"  UnityBegin(\\\"#{filename.gsub(/\\\\/,'\\\\\\\\\\\\')}\\\");\")\n    if (@options[:use_param_tests])\n      tests.each do |test|\n        if ((test[:args].nil?) or (test[:args].empty?))\n          output.puts(\"  RUN_TEST(#{test[:test]}, #{test[:line_number]}, RUN_TEST_NO_ARGS);\")\n        else\n          test[:args].each {|args| output.puts(\"  RUN_TEST(#{test[:test]}, #{test[:line_number]}, #{args});\")}\n        end\n      end\n    else\n        tests.each { |test| output.puts(\"  RUN_TEST(#{test[:test]}, #{test[:line_number]});\") }\n    end\n    output.puts()\n    output.puts(\"  CMock_Guts_MemFreeFinal();\") unless used_mocks.empty?\n    output.puts(\"  return #{@options[:suite_teardown].nil? ? \"\" : \"suite_teardown\"}(UnityEnd());\")\n    output.puts(\"}\")\n  end\n\n  def create_h_file(output, filename, tests, testfile_includes, used_mocks)\n    filename = File.basename(filename).gsub(/[-\\/\\\\\\.\\,\\s]/, \"_\").upcase\n    output.puts(\"/* AUTOGENERATED FILE. DO NOT EDIT. */\")\n    output.puts(\"#ifndef _#{filename}\")\n    output.puts(\"#define _#{filename}\\n\\n\")\n    output.puts(\"#include \\\"#{@options[:framework].to_s}.h\\\"\")\n    output.puts('#include \"cmock.h\"') unless (used_mocks.empty?)\n    @options[:includes].flatten.uniq.compact.each do |inc|\n      output.puts(\"#include #{inc.include?('<') ? inc : \"\\\"#{inc.gsub('.h','')}.h\\\"\"}\")\n    end\n    testfile_includes.each do |inc|\n      output.puts(\"#include #{inc.include?('<') ? inc : \"\\\"#{inc.gsub('.h','')}.h\\\"\"}\")\n    end\n    output.puts \"\\n\"\n    tests.each do |test|\n      if ((test[:params].nil?) or (test[:params].empty?))\n        output.puts(\"void #{test[:test]}(void);\")\n      else\n        output.puts(\"void #{test[:test]}(#{test[:params]});\")\n      end\n    end\n    output.puts(\"#endif\\n\\n\")\n  end\nend\n\nif ($0 == __FILE__)\n  options = { :includes => [] }\n  yaml_file = nil\n\n  #parse out all the options first (these will all be removed as we go)\n  ARGV.reject! do |arg|\n    case(arg)\n      when '-cexception'\n        options[:plugins] = [:cexception]; true\n      when /\\.*\\.ya?ml/\n        options = UnityTestRunnerGenerator.grab_config(arg); true\n      when /--(\\w+)=\\\"?(.*)\\\"?/\n        options[$1.to_sym] = $2; true\n      when /\\.*\\.h/\n        options[:includes] << arg; true\n      else false\n    end\n  end\n\n  #make sure there is at least one parameter left (the input file)\n  if !ARGV[0]\n    puts [\"\\nusage: ruby #{__FILE__} (files) (options) input_test_file (output)\",\n           \"\\n  input_test_file         - this is the C file you want to create a runner for\",\n           \"  output                  - this is the name of the runner file to generate\",\n           \"                            defaults to (input_test_file)_Runner\",\n           \"  files:\",\n           \"    *.yml / *.yaml        - loads configuration from here in :unity or :cmock\",\n           \"    *.h                   - header files are added as #includes in runner\",\n           \"  options:\",\n           \"    -cexception           - include cexception support\",\n           \"    --setup_name=\\\"\\\"       - redefine setUp func name to something else\",\n           \"    --teardown_name=\\\"\\\"    - redefine tearDown func name to something else\",\n           \"    --main_name=\\\"\\\"        - redefine main func name to something else\",\n           \"    --test_prefix=\\\"\\\"      - redefine test prefix from default test|spec|should\",\n           \"    --suite_setup=\\\"\\\"      - code to execute for setup of entire suite\",\n           \"    --suite_teardown=\\\"\\\"   - code to execute for teardown of entire suite\",\n           \"    --use_param_tests=1   - enable parameterized tests (disabled by default)\",\n           \"    --header_file=\\\"\\\"      - path/name of test header file to generate too\"\n          ].join(\"\\n\")\n    exit 1\n  end\n\n  #create the default test runner name if not specified\n  ARGV[1] = ARGV[0].gsub(\".c\",\"_Runner.c\") if (!ARGV[1])\n\n  UnityTestRunnerGenerator.new(options).run(ARGV[0], ARGV[1])\nend\n"
  },
  {
    "path": "test/unit/unity/type_sanitizer.rb",
    "content": "module TypeSanitizer\n  \n  def self.sanitize_c_identifier(unsanitized)\n    # convert filename to valid C identifier by replacing invalid chars with '_'\n    return unsanitized.gsub(/[-\\/\\\\\\.\\,\\s]/, \"_\")\n  end\n\nend\n"
  },
  {
    "path": "test/unit/unity/unity.c",
    "content": "/* =========================================================================\n    Unity Project - A Test Framework for C\n    Copyright (c) 2007-14 Mike Karlesky, Mark VanderVoord, Greg Williams\n    [Released under MIT License. Please refer to license.txt for details]\n============================================================================ */\n\n#include \"unity.h\"\n#include <stddef.h>\n\n/* If omitted from header, declare overrideable prototypes here so they're ready for use */\n#ifdef UNITY_OMIT_OUTPUT_CHAR_HEADER_DECLARATION\nvoid UNITY_OUTPUT_CHAR(int);\n#endif\n\n/* Helpful macros for us to use here */\n#define UNITY_FAIL_AND_BAIL   { Unity.CurrentTestFailed  = 1; longjmp(Unity.AbortFrame, 1); }\n#define UNITY_IGNORE_AND_BAIL { Unity.CurrentTestIgnored = 1; longjmp(Unity.AbortFrame, 1); }\n\n/* return prematurely if we are already in failure or ignore state */\n#define UNITY_SKIP_EXECUTION  { if ((Unity.CurrentTestFailed != 0) || (Unity.CurrentTestIgnored != 0)) {return;} }\n\nstruct _Unity Unity;\n\nstatic const char UnityStrOk[]                     = \"OK\";\nstatic const char UnityStrPass[]                   = \"PASS\";\nstatic const char UnityStrFail[]                   = \"FAIL\";\nstatic const char UnityStrIgnore[]                 = \"IGNORE\";\nstatic const char UnityStrNull[]                   = \"NULL\";\nstatic const char UnityStrSpacer[]                 = \". \";\nstatic const char UnityStrExpected[]               = \" Expected \";\nstatic const char UnityStrWas[]                    = \" Was \";\nstatic const char UnityStrElement[]                = \" Element \";\nstatic const char UnityStrByte[]                   = \" Byte \";\nstatic const char UnityStrMemory[]                 = \" Memory Mismatch.\";\nstatic const char UnityStrDelta[]                  = \" Values Not Within Delta \";\nstatic const char UnityStrPointless[]              = \" You Asked Me To Compare Nothing, Which Was Pointless.\";\nstatic const char UnityStrNullPointerForExpected[] = \" Expected pointer to be NULL\";\nstatic const char UnityStrNullPointerForActual[]   = \" Actual pointer was NULL\";\n#ifndef UNITY_EXCLUDE_FLOAT\nstatic const char UnityStrNot[]                    = \"Not \";\nstatic const char UnityStrInf[]                    = \"Infinity\";\nstatic const char UnityStrNegInf[]                 = \"Negative Infinity\";\nstatic const char UnityStrNaN[]                    = \"NaN\";\nstatic const char UnityStrDet[]                    = \"Determinate\";\nstatic const char UnityStrInvalidFloatTrait[]      = \"Invalid Float Trait\";\n#endif\nconst char UnityStrErrFloat[]                      = \"Unity Floating Point Disabled\";\nconst char UnityStrErrDouble[]                     = \"Unity Double Precision Disabled\";\nconst char UnityStrErr64[]                         = \"Unity 64-bit Support Disabled\";\nstatic const char UnityStrBreaker[]                = \"-----------------------\";\nstatic const char UnityStrResultsTests[]           = \" Tests \";\nstatic const char UnityStrResultsFailures[]        = \" Failures \";\nstatic const char UnityStrResultsIgnored[]         = \" Ignored \";\nstatic const char UnityStrDetail1Name[]            = UNITY_DETAIL1_NAME \" \";\nstatic const char UnityStrDetail2Name[]            = \" \" UNITY_DETAIL2_NAME \" \";\n\n/* compiler-generic print formatting masks */\nstatic const _U_UINT UnitySizeMask[] =\n{\n    255u,         /* 0xFF */\n    65535u,       /* 0xFFFF */\n    65535u,\n    4294967295u,  /* 0xFFFFFFFF */\n    4294967295u,\n    4294967295u,\n    4294967295u\n#ifdef UNITY_SUPPORT_64\n    ,0xFFFFFFFFFFFFFFFF\n#endif\n};\n\n/*-----------------------------------------------\n * Pretty Printers & Test Result Output Handlers\n *-----------------------------------------------*/\n\nvoid SetOutputColorRed(){printf(\"\\033[0;31m\");}\nvoid SetOutputColorGreen(){printf(\"\\033[0;32m\");}\nvoid ResetOutputColor(){printf(\"\\033[0m\");}\n\nvoid UnityPrint(const char* string)\n{\n    const char* pch = string;\n\n    if (pch != NULL)\n    {\n        while (*pch)\n        {\n            /* printable characters plus CR & LF are printed */\n            if ((*pch <= 126) && (*pch >= 32))\n            {\n                UNITY_OUTPUT_CHAR(*pch);\n            }\n            /* write escaped carriage returns */\n            else if (*pch == 13)\n            {\n                UNITY_OUTPUT_CHAR('\\\\');\n                UNITY_OUTPUT_CHAR('r');\n            }\n            /* write escaped line feeds */\n            else if (*pch == 10)\n            {\n                UNITY_OUTPUT_CHAR('\\\\');\n                UNITY_OUTPUT_CHAR('n');\n            }\n            /* unprintable characters are shown as codes */\n            else\n            {\n                UNITY_OUTPUT_CHAR('\\\\');\n                UNITY_OUTPUT_CHAR('x');\n                UnityPrintNumberHex((_U_UINT)*pch, 2);\n            }\n            pch++;\n        }\n    }\n}\n\nvoid UnityPrintLen(const char* string, const _UU32 length);\nvoid UnityPrintLen(const char* string, const _UU32 length)\n{\n    const char* pch = string;\n\n    if (pch != NULL)\n    {\n        while (*pch && (_UU32)(pch - string) < length)\n        {\n            /* printable characters plus CR & LF are printed */\n            if ((*pch <= 126) && (*pch >= 32))\n            {\n                UNITY_OUTPUT_CHAR(*pch);\n            }\n            /* write escaped carriage returns */\n            else if (*pch == 13)\n            {\n                UNITY_OUTPUT_CHAR('\\\\');\n                UNITY_OUTPUT_CHAR('r');\n            }\n            /* write escaped line feeds */\n            else if (*pch == 10)\n            {\n                UNITY_OUTPUT_CHAR('\\\\');\n                UNITY_OUTPUT_CHAR('n');\n            }\n            /* unprintable characters are shown as codes */\n            else\n            {\n                UNITY_OUTPUT_CHAR('\\\\');\n                UNITY_OUTPUT_CHAR('x');\n                UnityPrintNumberHex((_U_UINT)*pch, 2);\n            }\n            pch++;\n        }\n    }\n}\n\n/*-----------------------------------------------*/\nvoid UnityPrintNumberByStyle(const _U_SINT number, const UNITY_DISPLAY_STYLE_T style)\n{\n    if ((style & UNITY_DISPLAY_RANGE_INT) == UNITY_DISPLAY_RANGE_INT)\n    {\n        UnityPrintNumber(number);\n    }\n    else if ((style & UNITY_DISPLAY_RANGE_UINT) == UNITY_DISPLAY_RANGE_UINT)\n    {\n        UnityPrintNumberUnsigned(  (_U_UINT)number  &  UnitySizeMask[((_U_UINT)style & (_U_UINT)0x0F) - 1]  );\n    }\n    else\n    {\n        UNITY_OUTPUT_CHAR('0');\n        UNITY_OUTPUT_CHAR('x');\n        UnityPrintNumberHex((_U_UINT)number, (char)((style & 0x000F) << 1));\n    }\n}\n\n/*-----------------------------------------------*/\nvoid UnityPrintNumber(const _U_SINT number_to_print)\n{\n    _U_UINT number = (_U_UINT)number_to_print;\n\n    if (number_to_print < 0)\n    {\n        /* A negative number, including MIN negative */\n        UNITY_OUTPUT_CHAR('-');\n        number = (_U_UINT)(-number_to_print);\n    }\n    UnityPrintNumberUnsigned(number);\n}\n\n/*-----------------------------------------------\n * basically do an itoa using as little ram as possible */\nvoid UnityPrintNumberUnsigned(const _U_UINT number)\n{\n    _U_UINT divisor = 1;\n\n    /* figure out initial divisor */\n    while (number / divisor > 9)\n    {\n        divisor *= 10;\n    }\n\n    /* now mod and print, then divide divisor */\n    do\n    {\n        UNITY_OUTPUT_CHAR((char)('0' + (number / divisor % 10)));\n        divisor /= 10;\n    }\n    while (divisor > 0);\n}\n\n/*-----------------------------------------------*/\nvoid UnityPrintNumberHex(const _U_UINT number, const char nibbles_to_print)\n{\n    _U_UINT nibble;\n    char nibbles = nibbles_to_print;\n\n    while (nibbles > 0)\n    {\n        nibble = (number >> (--nibbles << 2)) & 0x0000000F;\n        if (nibble <= 9)\n        {\n            UNITY_OUTPUT_CHAR((char)('0' + nibble));\n        }\n        else\n        {\n            UNITY_OUTPUT_CHAR((char)('A' - 10 + nibble));\n        }\n    }\n}\n\n/*-----------------------------------------------*/\nvoid UnityPrintMask(const _U_UINT mask, const _U_UINT number)\n{\n    _U_UINT current_bit = (_U_UINT)1 << (UNITY_INT_WIDTH - 1);\n    _US32 i;\n\n    for (i = 0; i < UNITY_INT_WIDTH; i++)\n    {\n        if (current_bit & mask)\n        {\n            if (current_bit & number)\n            {\n                UNITY_OUTPUT_CHAR('1');\n            }\n            else\n            {\n                UNITY_OUTPUT_CHAR('0');\n            }\n        }\n        else\n        {\n            UNITY_OUTPUT_CHAR('X');\n        }\n        current_bit = current_bit >> 1;\n    }\n}\n\n/*-----------------------------------------------*/\n#ifdef UNITY_FLOAT_VERBOSE\n#include <stdio.h>\n\n#ifndef UNITY_VERBOSE_NUMBER_MAX_LENGTH\n# ifdef UNITY_DOUBLE_VERBOSE\n#  define UNITY_VERBOSE_NUMBER_MAX_LENGTH 317\n# else\n#  define UNITY_VERBOSE_NUMBER_MAX_LENGTH 47\n# endif\n#endif\n\nvoid UnityPrintFloat(_UD number)\n{\n    char TempBuffer[UNITY_VERBOSE_NUMBER_MAX_LENGTH + 1];\n    snprintf(TempBuffer, sizeof(TempBuffer), \"%.6f\", number);\n    UnityPrint(TempBuffer);\n}\n#endif\n\n/*-----------------------------------------------*/\n\nvoid UnityPrintFail(void);\nvoid UnityPrintFail(void)\n{\n    SetOutputColorRed();\n    UnityPrint(UnityStrFail);\n    ResetOutputColor();\n}\n\nvoid UnityPrintOk(void);\nvoid UnityPrintOk(void)\n{\n    SetOutputColorGreen();\n    UnityPrint(UnityStrOk);\n    ResetOutputColor();\n}\n\n/*-----------------------------------------------*/\nstatic void UnityTestResultsBegin(const char* file, const UNITY_LINE_TYPE line);\nstatic void UnityTestResultsBegin(const char* file, const UNITY_LINE_TYPE line)\n{\n#ifndef UNITY_FIXTURES\n    UnityPrint(file);\n    UNITY_OUTPUT_CHAR(':');\n    UnityPrintNumber((_U_SINT)line);\n    UNITY_OUTPUT_CHAR(':');\n    UnityPrint(Unity.CurrentTestName);\n    UNITY_OUTPUT_CHAR(':');\n#else\n    UNITY_UNUSED(file);\n    UNITY_UNUSED(line);\n#endif\n}\n\n/*-----------------------------------------------*/\nstatic void UnityTestResultsFailBegin(const UNITY_LINE_TYPE line);\nstatic void UnityTestResultsFailBegin(const UNITY_LINE_TYPE line)\n{\n#ifndef UNITY_FIXTURES\n    UnityTestResultsBegin(Unity.TestFile, line);\n#else\n    UNITY_UNUSED(line);\n#endif\n    UnityPrint(UnityStrFail);\n    UNITY_OUTPUT_CHAR(':');\n}\n\n/*-----------------------------------------------*/\nvoid UnityConcludeTest(void)\n{\n    if (Unity.CurrentTestIgnored)\n    {\n        Unity.TestIgnores++;\n    }\n    else if (!Unity.CurrentTestFailed)\n    {\n        UnityTestResultsBegin(Unity.TestFile, Unity.CurrentTestLineNumber);\n        UnityPrint(UnityStrPass);\n    }\n    else\n    {\n        Unity.TestFailures++;\n    }\n\n    Unity.CurrentTestFailed = 0;\n    Unity.CurrentTestIgnored = 0;\n    UNITY_PRINT_EOL();\n    UNITY_FLUSH_CALL();\n}\n\n/*-----------------------------------------------*/\nstatic void UnityAddMsgIfSpecified(const char* msg);\nstatic void UnityAddMsgIfSpecified(const char* msg)\n{\n    if (msg)\n    {\n        UnityPrint(UnityStrSpacer);\n#ifndef UNITY_EXCLUDE_DETAILS\n        if (Unity.CurrentDetail1)\n        {\n            UnityPrint(UnityStrDetail1Name);\n            UnityPrint(Unity.CurrentDetail1);\n            if (Unity.CurrentDetail2)\n            {\n                UnityPrint(UnityStrDetail2Name);\n                UnityPrint(Unity.CurrentDetail2);\n            }\n            UnityPrint(UnityStrSpacer);\n        }\n#endif\n        UnityPrint(msg);\n    }\n}\n\n/*-----------------------------------------------*/\nstatic void UnityPrintExpectedAndActualStrings(const char* expected, const char* actual);\nstatic void UnityPrintExpectedAndActualStrings(const char* expected, const char* actual)\n{\n    UnityPrint(UnityStrExpected);\n    if (expected != NULL)\n    {\n        UNITY_OUTPUT_CHAR('\\'');\n        UnityPrint(expected);\n        UNITY_OUTPUT_CHAR('\\'');\n    }\n    else\n    {\n      UnityPrint(UnityStrNull);\n    }\n    UnityPrint(UnityStrWas);\n    if (actual != NULL)\n    {\n        UNITY_OUTPUT_CHAR('\\'');\n        UnityPrint(actual);\n        UNITY_OUTPUT_CHAR('\\'');\n    }\n    else\n    {\n      UnityPrint(UnityStrNull);\n    }\n}\n\n/*-----------------------------------------------*/\nstatic void UnityPrintExpectedAndActualStringsLen(const char* expected, const char* actual, const _UU32 length)\n{\n    UnityPrint(UnityStrExpected);\n    if (expected != NULL)\n    {\n        UNITY_OUTPUT_CHAR('\\'');\n        UnityPrintLen(expected, length);\n        UNITY_OUTPUT_CHAR('\\'');\n    }\n    else\n    {\n      UnityPrint(UnityStrNull);\n    }\n    UnityPrint(UnityStrWas);\n    if (actual != NULL)\n    {\n        UNITY_OUTPUT_CHAR('\\'');\n        UnityPrintLen(actual, length);\n        UNITY_OUTPUT_CHAR('\\'');\n    }\n    else\n    {\n      UnityPrint(UnityStrNull);\n    }\n}\n\n\n\n/*-----------------------------------------------\n * Assertion & Control Helpers\n *-----------------------------------------------*/\n\nstatic int UnityCheckArraysForNull(UNITY_INTERNAL_PTR expected, UNITY_INTERNAL_PTR actual, const UNITY_LINE_TYPE lineNumber, const char* msg)\n{\n    /* return true if they are both NULL */\n    if ((expected == NULL) && (actual == NULL))\n        return 1;\n\n    /* throw error if just expected is NULL */\n    if (expected == NULL)\n    {\n        UnityTestResultsFailBegin(lineNumber);\n        UnityPrint(UnityStrNullPointerForExpected);\n        UnityAddMsgIfSpecified(msg);\n        UNITY_FAIL_AND_BAIL;\n    }\n\n    /* throw error if just actual is NULL */\n    if (actual == NULL)\n    {\n        UnityTestResultsFailBegin(lineNumber);\n        UnityPrint(UnityStrNullPointerForActual);\n        UnityAddMsgIfSpecified(msg);\n        UNITY_FAIL_AND_BAIL;\n    }\n\n    /* return false if neither is NULL */\n    return 0;\n}\n\n/*-----------------------------------------------\n * Assertion Functions\n *-----------------------------------------------*/\n\nvoid UnityAssertBits(const _U_SINT mask,\n                     const _U_SINT expected,\n                     const _U_SINT actual,\n                     const char* msg,\n                     const UNITY_LINE_TYPE lineNumber)\n{\n    UNITY_SKIP_EXECUTION;\n\n    if ((mask & expected) != (mask & actual))\n    {\n        UnityTestResultsFailBegin(lineNumber);\n        UnityPrint(UnityStrExpected);\n        UnityPrintMask((_U_UINT)mask, (_U_UINT)expected);\n        UnityPrint(UnityStrWas);\n        UnityPrintMask((_U_UINT)mask, (_U_UINT)actual);\n        UnityAddMsgIfSpecified(msg);\n        UNITY_FAIL_AND_BAIL;\n    }\n}\n\n/*-----------------------------------------------*/\nvoid UnityAssertEqualNumber(const _U_SINT expected,\n                            const _U_SINT actual,\n                            const char* msg,\n                            const UNITY_LINE_TYPE lineNumber,\n                            const UNITY_DISPLAY_STYLE_T style)\n{\n    UNITY_SKIP_EXECUTION;\n\n    if (expected != actual)\n    {\n        UnityTestResultsFailBegin(lineNumber);\n        UnityPrint(UnityStrExpected);\n        UnityPrintNumberByStyle(expected, style);\n        UnityPrint(UnityStrWas);\n        UnityPrintNumberByStyle(actual, style);\n        UnityAddMsgIfSpecified(msg);\n        UNITY_FAIL_AND_BAIL;\n    }\n}\n\n#define UnityPrintPointlessAndBail()       \\\n{                                          \\\n    UnityTestResultsFailBegin(lineNumber); \\\n    UnityPrint(UnityStrPointless);         \\\n    UnityAddMsgIfSpecified(msg);           \\\n    UNITY_FAIL_AND_BAIL; }\n\n/*-----------------------------------------------*/\nvoid UnityAssertEqualIntArray(UNITY_INTERNAL_PTR expected,\n                              UNITY_INTERNAL_PTR actual,\n                              const _UU32 num_elements,\n                              const char* msg,\n                              const UNITY_LINE_TYPE lineNumber,\n                              const UNITY_DISPLAY_STYLE_T style)\n{\n    _UU32 elements = num_elements;\n    UNITY_INTERNAL_PTR ptr_exp = (UNITY_INTERNAL_PTR)expected;\n    UNITY_INTERNAL_PTR ptr_act = (UNITY_INTERNAL_PTR)actual;\n\n    UNITY_SKIP_EXECUTION;\n\n    if (elements == 0)\n    {\n        UnityPrintPointlessAndBail();\n    }\n\n    if (UnityCheckArraysForNull((UNITY_INTERNAL_PTR)expected, (UNITY_INTERNAL_PTR)actual, lineNumber, msg) == 1)\n        return;\n\n    /* If style is UNITY_DISPLAY_STYLE_INT, we'll fall into the default case rather than the INT16 or INT32 (etc) case\n     * as UNITY_DISPLAY_STYLE_INT includes a flag for UNITY_DISPLAY_RANGE_AUTO, which the width-specific\n     * variants do not. Therefore remove this flag. */\n    switch(style & (UNITY_DISPLAY_STYLE_T)(~UNITY_DISPLAY_RANGE_AUTO))\n    {\n        case UNITY_DISPLAY_STYLE_HEX8:\n        case UNITY_DISPLAY_STYLE_INT8:\n        case UNITY_DISPLAY_STYLE_UINT8:\n            while (elements--)\n            {\n                if (*(UNITY_PTR_ATTRIBUTE const _US8*)ptr_exp != *(UNITY_PTR_ATTRIBUTE const _US8*)ptr_act)\n                {\n                    UnityTestResultsFailBegin(lineNumber);\n                    UnityPrint(UnityStrElement);\n                    UnityPrintNumberUnsigned(num_elements - elements - 1);\n                    UnityPrint(UnityStrExpected);\n                    UnityPrintNumberByStyle(*(UNITY_PTR_ATTRIBUTE const _US8*)ptr_exp, style);\n                    UnityPrint(UnityStrWas);\n                    UnityPrintNumberByStyle(*(UNITY_PTR_ATTRIBUTE const _US8*)ptr_act, style);\n                    UnityAddMsgIfSpecified(msg);\n                    UNITY_FAIL_AND_BAIL;\n                }\n                ptr_exp = (UNITY_INTERNAL_PTR)((_UP)ptr_exp + 1);\n                ptr_act = (UNITY_INTERNAL_PTR)((_UP)ptr_act + 1);\n            }\n            break;\n        case UNITY_DISPLAY_STYLE_HEX16:\n        case UNITY_DISPLAY_STYLE_INT16:\n        case UNITY_DISPLAY_STYLE_UINT16:\n            while (elements--)\n            {\n                if (*(UNITY_PTR_ATTRIBUTE const _US16*)ptr_exp != *(UNITY_PTR_ATTRIBUTE const _US16*)ptr_act)\n                {\n                    UnityTestResultsFailBegin(lineNumber);\n                    UnityPrint(UnityStrElement);\n                    UnityPrintNumberUnsigned(num_elements - elements - 1);\n                    UnityPrint(UnityStrExpected);\n                    UnityPrintNumberByStyle(*(UNITY_PTR_ATTRIBUTE const _US16*)ptr_exp, style);\n                    UnityPrint(UnityStrWas);\n                    UnityPrintNumberByStyle(*(UNITY_PTR_ATTRIBUTE const _US16*)ptr_act, style);\n                    UnityAddMsgIfSpecified(msg);\n                    UNITY_FAIL_AND_BAIL;\n                }\n                ptr_exp = (UNITY_INTERNAL_PTR)((_UP)ptr_exp + 2);\n                ptr_act = (UNITY_INTERNAL_PTR)((_UP)ptr_act + 2);\n            }\n            break;\n#ifdef UNITY_SUPPORT_64\n        case UNITY_DISPLAY_STYLE_HEX64:\n        case UNITY_DISPLAY_STYLE_INT64:\n        case UNITY_DISPLAY_STYLE_UINT64:\n            while (elements--)\n            {\n                if (*(UNITY_PTR_ATTRIBUTE const _US64*)ptr_exp != *(UNITY_PTR_ATTRIBUTE const _US64*)ptr_act)\n                {\n                    UnityTestResultsFailBegin(lineNumber);\n                    UnityPrint(UnityStrElement);\n                    UnityPrintNumberUnsigned(num_elements - elements - 1);\n                    UnityPrint(UnityStrExpected);\n                    UnityPrintNumberByStyle(*(UNITY_PTR_ATTRIBUTE const _US64*)ptr_exp, style);\n                    UnityPrint(UnityStrWas);\n                    UnityPrintNumberByStyle(*(UNITY_PTR_ATTRIBUTE const _US64*)ptr_act, style);\n                    UnityAddMsgIfSpecified(msg);\n                    UNITY_FAIL_AND_BAIL;\n                }\n                ptr_exp = (UNITY_INTERNAL_PTR)((_UP)ptr_exp + 8);\n                ptr_act = (UNITY_INTERNAL_PTR)((_UP)ptr_act + 8);\n            }\n            break;\n#endif\n        default:\n            while (elements--)\n            {\n                if (*(UNITY_PTR_ATTRIBUTE const _US32*)ptr_exp != *(UNITY_PTR_ATTRIBUTE const _US32*)ptr_act)\n                {\n                    UnityTestResultsFailBegin(lineNumber);\n                    UnityPrint(UnityStrElement);\n                    UnityPrintNumberUnsigned(num_elements - elements - 1);\n                    UnityPrint(UnityStrExpected);\n                    UnityPrintNumberByStyle(*(UNITY_PTR_ATTRIBUTE const _US32*)ptr_exp, style);\n                    UnityPrint(UnityStrWas);\n                    UnityPrintNumberByStyle(*(UNITY_PTR_ATTRIBUTE const _US32*)ptr_act, style);\n                    UnityAddMsgIfSpecified(msg);\n                    UNITY_FAIL_AND_BAIL;\n                }\n                ptr_exp = (UNITY_INTERNAL_PTR)((_UP)ptr_exp + 4);\n                ptr_act = (UNITY_INTERNAL_PTR)((_UP)ptr_act + 4);\n            }\n            break;\n    }\n}\n\n/*-----------------------------------------------*/\n/* Wrap this define in a function with variable types as float or double */\n#define UNITY_FLOAT_OR_DOUBLE_WITHIN(delta, expected, actual, diff)                       \\\n    if (isinf(expected) && isinf(actual) && (isneg(expected) == isneg(actual))) return 1; \\\n    if (UNITY_NAN_CHECK) return 1;                                                        \\\n    diff = actual - expected;                                                             \\\n    if (diff < 0.0f) diff = 0.0f - diff;                                                  \\\n    if (delta < 0.0f) delta = 0.0f - delta;                                               \\\n    return !(isnan(diff) || isinf(diff) || (diff > delta))\n    /* This first part of this condition will catch any NaN or Infinite values */\n#ifndef UNITY_NAN_NOT_EQUAL_NAN\n  #define UNITY_NAN_CHECK isnan(expected) && isnan(actual)\n#else\n  #define UNITY_NAN_CHECK 0\n#endif\n\n#ifndef UNITY_EXCLUDE_FLOAT\nstatic int UnityFloatsWithin(_UF delta, _UF expected, _UF actual)\n{\n    _UF diff;\n    UNITY_FLOAT_OR_DOUBLE_WITHIN(delta, expected, actual, diff);\n}\n\nvoid UnityAssertEqualFloatArray(UNITY_PTR_ATTRIBUTE const _UF* expected,\n                                UNITY_PTR_ATTRIBUTE const _UF* actual,\n                                const _UU32 num_elements,\n                                const char* msg,\n                                const UNITY_LINE_TYPE lineNumber)\n{\n    _UU32 elements = num_elements;\n    UNITY_PTR_ATTRIBUTE const _UF* ptr_expected = expected;\n    UNITY_PTR_ATTRIBUTE const _UF* ptr_actual = actual;\n\n    UNITY_SKIP_EXECUTION;\n\n    if (elements == 0)\n    {\n        UnityPrintPointlessAndBail();\n    }\n\n    if (UnityCheckArraysForNull((UNITY_INTERNAL_PTR)expected, (UNITY_INTERNAL_PTR)actual, lineNumber, msg) == 1)\n        return;\n\n    while (elements--)\n    {\n        if (!UnityFloatsWithin(*ptr_expected * UNITY_FLOAT_PRECISION, *ptr_expected, *ptr_actual))\n        {\n            UnityTestResultsFailBegin(lineNumber);\n            UnityPrint(UnityStrElement);\n            UnityPrintNumberUnsigned(num_elements - elements - 1);\n#ifdef UNITY_FLOAT_VERBOSE\n            UnityPrint(UnityStrExpected);\n            UnityPrintFloat(*ptr_expected);\n            UnityPrint(UnityStrWas);\n            UnityPrintFloat(*ptr_actual);\n#else\n            UnityPrint(UnityStrDelta);\n#endif\n            UnityAddMsgIfSpecified(msg);\n            UNITY_FAIL_AND_BAIL;\n        }\n        ptr_expected++;\n        ptr_actual++;\n    }\n}\n\n/*-----------------------------------------------*/\nvoid UnityAssertFloatsWithin(const _UF delta,\n                             const _UF expected,\n                             const _UF actual,\n                             const char* msg,\n                             const UNITY_LINE_TYPE lineNumber)\n{\n    UNITY_SKIP_EXECUTION;\n\n\n    if (!UnityFloatsWithin(delta, expected, actual))\n    {\n        UnityTestResultsFailBegin(lineNumber);\n#ifdef UNITY_FLOAT_VERBOSE\n        UnityPrint(UnityStrExpected);\n        UnityPrintFloat(expected);\n        UnityPrint(UnityStrWas);\n        UnityPrintFloat(actual);\n#else\n        UnityPrint(UnityStrDelta);\n#endif\n        UnityAddMsgIfSpecified(msg);\n        UNITY_FAIL_AND_BAIL;\n    }\n}\n\n/*-----------------------------------------------*/\nvoid UnityAssertFloatSpecial(const _UF actual,\n                             const char* msg,\n                             const UNITY_LINE_TYPE lineNumber,\n                             const UNITY_FLOAT_TRAIT_T style)\n{\n    const char* trait_names[] = { UnityStrInf, UnityStrNegInf, UnityStrNaN, UnityStrDet };\n    _U_SINT should_be_trait   = ((_U_SINT)style & 1);\n    _U_SINT is_trait          = !should_be_trait;\n    _U_SINT trait_index       = (_U_SINT)(style >> 1);\n\n    UNITY_SKIP_EXECUTION;\n\n    switch(style)\n    {\n        case UNITY_FLOAT_IS_INF:\n        case UNITY_FLOAT_IS_NOT_INF:\n            is_trait = isinf(actual) & ispos(actual);\n            break;\n        case UNITY_FLOAT_IS_NEG_INF:\n        case UNITY_FLOAT_IS_NOT_NEG_INF:\n            is_trait = isinf(actual) & isneg(actual);\n            break;\n\n        case UNITY_FLOAT_IS_NAN:\n        case UNITY_FLOAT_IS_NOT_NAN:\n            is_trait = isnan(actual) ? 1 : 0;\n            break;\n\n        /* A determinate number is non infinite and not NaN. (therefore the opposite of the two above) */\n        case UNITY_FLOAT_IS_DET:\n        case UNITY_FLOAT_IS_NOT_DET:\n            if (isinf(actual) || isnan(actual))\n                is_trait = 0;\n            else\n                is_trait = 1;\n            break;\n\n        default:\n            trait_index = 0;\n            trait_names[0] = UnityStrInvalidFloatTrait;\n            break;\n    }\n\n    if (is_trait != should_be_trait)\n    {\n        UnityTestResultsFailBegin(lineNumber);\n        UnityPrint(UnityStrExpected);\n        if (!should_be_trait)\n            UnityPrint(UnityStrNot);\n        UnityPrint(trait_names[trait_index]);\n        UnityPrint(UnityStrWas);\n#ifdef UNITY_FLOAT_VERBOSE\n        UnityPrintFloat(actual);\n#else\n        if (should_be_trait)\n            UnityPrint(UnityStrNot);\n        UnityPrint(trait_names[trait_index]);\n#endif\n        UnityAddMsgIfSpecified(msg);\n        UNITY_FAIL_AND_BAIL;\n    }\n}\n\n#endif /* not UNITY_EXCLUDE_FLOAT */\n\n/*-----------------------------------------------*/\n#ifndef UNITY_EXCLUDE_DOUBLE\nstatic int UnityDoublesWithin(_UD delta, _UD expected, _UD actual)\n{\n    _UD diff;\n    UNITY_FLOAT_OR_DOUBLE_WITHIN(delta, expected, actual, diff);\n}\n\nvoid UnityAssertEqualDoubleArray(UNITY_PTR_ATTRIBUTE const _UD* expected,\n                                 UNITY_PTR_ATTRIBUTE const _UD* actual,\n                                 const _UU32 num_elements,\n                                 const char* msg,\n                                 const UNITY_LINE_TYPE lineNumber)\n{\n    _UU32 elements = num_elements;\n    UNITY_PTR_ATTRIBUTE const _UD* ptr_expected = expected;\n    UNITY_PTR_ATTRIBUTE const _UD* ptr_actual = actual;\n\n    UNITY_SKIP_EXECUTION;\n\n    if (elements == 0)\n    {\n        UnityPrintPointlessAndBail();\n    }\n\n    if (UnityCheckArraysForNull((UNITY_INTERNAL_PTR)expected, (UNITY_INTERNAL_PTR)actual, lineNumber, msg) == 1)\n        return;\n\n    while (elements--)\n    {\n        if (!UnityDoublesWithin(*ptr_expected * UNITY_DOUBLE_PRECISION, *ptr_expected, *ptr_actual))\n        {\n            UnityTestResultsFailBegin(lineNumber);\n            UnityPrint(UnityStrElement);\n            UnityPrintNumberUnsigned(num_elements - elements - 1);\n#ifdef UNITY_DOUBLE_VERBOSE\n            UnityPrint(UnityStrExpected);\n            UnityPrintFloat((float)(*ptr_expected));\n            UnityPrint(UnityStrWas);\n            UnityPrintFloat((float)(*ptr_actual));\n#else\n            UnityPrint(UnityStrDelta);\n#endif\n            UnityAddMsgIfSpecified(msg);\n            UNITY_FAIL_AND_BAIL;\n        }\n        ptr_expected++;\n        ptr_actual++;\n    }\n}\n\n/*-----------------------------------------------*/\nvoid UnityAssertDoublesWithin(const _UD delta,\n                              const _UD expected,\n                              const _UD actual,\n                              const char* msg,\n                              const UNITY_LINE_TYPE lineNumber)\n{\n    UNITY_SKIP_EXECUTION;\n\n    if (!UnityDoublesWithin(delta, expected, actual))\n    {\n        UnityTestResultsFailBegin(lineNumber);\n#ifdef UNITY_DOUBLE_VERBOSE\n        UnityPrint(UnityStrExpected);\n        UnityPrintFloat((float)expected);\n        UnityPrint(UnityStrWas);\n        UnityPrintFloat((float)actual);\n#else\n        UnityPrint(UnityStrDelta);\n#endif\n        UnityAddMsgIfSpecified(msg);\n        UNITY_FAIL_AND_BAIL;\n    }\n}\n\n/*-----------------------------------------------*/\n\nvoid UnityAssertDoubleSpecial(const _UD actual,\n                              const char* msg,\n                              const UNITY_LINE_TYPE lineNumber,\n                              const UNITY_FLOAT_TRAIT_T style)\n{\n    const char* trait_names[] = { UnityStrInf, UnityStrNegInf, UnityStrNaN, UnityStrDet };\n    _U_SINT should_be_trait   = ((_U_SINT)style & 1);\n    _U_SINT is_trait          = !should_be_trait;\n    _U_SINT trait_index       = (_U_SINT)(style >> 1);\n\n    UNITY_SKIP_EXECUTION;\n\n     switch(style)\n    {\n        case UNITY_FLOAT_IS_INF:\n        case UNITY_FLOAT_IS_NOT_INF:\n            is_trait = isinf(actual) & ispos(actual);\n            break;\n        case UNITY_FLOAT_IS_NEG_INF:\n        case UNITY_FLOAT_IS_NOT_NEG_INF:\n            is_trait = isinf(actual) & isneg(actual);\n            break;\n\n        case UNITY_FLOAT_IS_NAN:\n        case UNITY_FLOAT_IS_NOT_NAN:\n            is_trait = isnan(actual) ? 1 : 0;\n            break;\n\n        /* A determinate number is non infinite and not NaN. (therefore the opposite of the two above) */\n        case UNITY_FLOAT_IS_DET:\n        case UNITY_FLOAT_IS_NOT_DET:\n            if (isinf(actual) || isnan(actual))\n                is_trait = 0;\n            else\n                is_trait = 1;\n            break;\n\n        default:\n            trait_index = 0;\n            trait_names[0] = UnityStrInvalidFloatTrait;\n            break;\n    }\n\n    if (is_trait != should_be_trait)\n    {\n        UnityTestResultsFailBegin(lineNumber);\n        UnityPrint(UnityStrExpected);\n        if (!should_be_trait)\n            UnityPrint(UnityStrNot);\n        UnityPrint(trait_names[trait_index]);\n        UnityPrint(UnityStrWas);\n#ifdef UNITY_DOUBLE_VERBOSE\n        UnityPrintFloat(actual);\n#else\n        if (should_be_trait)\n            UnityPrint(UnityStrNot);\n        UnityPrint(trait_names[trait_index]);\n#endif\n        UnityAddMsgIfSpecified(msg);\n        UNITY_FAIL_AND_BAIL;\n    }\n}\n\n\n#endif /* not UNITY_EXCLUDE_DOUBLE */\n\n/*-----------------------------------------------*/\nvoid UnityAssertNumbersWithin( const _U_UINT delta,\n                               const _U_SINT expected,\n                               const _U_SINT actual,\n                               const char* msg,\n                               const UNITY_LINE_TYPE lineNumber,\n                               const UNITY_DISPLAY_STYLE_T style)\n{\n    UNITY_SKIP_EXECUTION;\n\n    if ((style & UNITY_DISPLAY_RANGE_INT) == UNITY_DISPLAY_RANGE_INT)\n    {\n        if (actual > expected)\n            Unity.CurrentTestFailed = ((_U_UINT)(actual - expected) > delta);\n        else\n            Unity.CurrentTestFailed = ((_U_UINT)(expected - actual) > delta);\n    }\n    else\n    {\n        if ((_U_UINT)actual > (_U_UINT)expected)\n            Unity.CurrentTestFailed = ((_U_UINT)(actual - expected) > delta);\n        else\n            Unity.CurrentTestFailed = ((_U_UINT)(expected - actual) > delta);\n    }\n\n    if (Unity.CurrentTestFailed)\n    {\n        UnityTestResultsFailBegin(lineNumber);\n        UnityPrint(UnityStrDelta);\n        UnityPrintNumberByStyle((_U_SINT)delta, style);\n        UnityPrint(UnityStrExpected);\n        UnityPrintNumberByStyle(expected, style);\n        UnityPrint(UnityStrWas);\n        UnityPrintNumberByStyle(actual, style);\n        UnityAddMsgIfSpecified(msg);\n        UNITY_FAIL_AND_BAIL;\n    }\n}\n\n/*-----------------------------------------------*/\nvoid UnityAssertEqualString(const char* expected,\n                            const char* actual,\n                            const char* msg,\n                            const UNITY_LINE_TYPE lineNumber)\n{\n    _UU32 i;\n\n    UNITY_SKIP_EXECUTION;\n\n    /* if both pointers not null compare the strings */\n    if (expected && actual)\n    {\n        for (i = 0; expected[i] || actual[i]; i++)\n        {\n            if (expected[i] != actual[i])\n            {\n                Unity.CurrentTestFailed = 1;\n                break;\n            }\n        }\n    }\n    else\n    { /* handle case of one pointers being null (if both null, test should pass) */\n        if (expected != actual)\n        {\n            Unity.CurrentTestFailed = 1;\n        }\n    }\n\n    if (Unity.CurrentTestFailed)\n    {\n      UnityTestResultsFailBegin(lineNumber);\n      UnityPrintExpectedAndActualStrings(expected, actual);\n      UnityAddMsgIfSpecified(msg);\n      UNITY_FAIL_AND_BAIL;\n    }\n}\n\n/*-----------------------------------------------*/\nvoid UnityAssertEqualStringLen(const char* expected,\n                            const char* actual,\n                            const _UU32 length,\n                            const char* msg,\n                            const UNITY_LINE_TYPE lineNumber)\n{\n    _UU32 i;\n\n    UNITY_SKIP_EXECUTION;\n\n    /* if both pointers not null compare the strings */\n    if (expected && actual)\n    {\n        for (i = 0; (i < length) && (expected[i] || actual[i]); i++)\n        {\n            if (expected[i] != actual[i])\n            {\n                Unity.CurrentTestFailed = 1;\n                break;\n            }\n        }\n    }\n    else\n    { /* handle case of one pointers being null (if both null, test should pass) */\n        if (expected != actual)\n        {\n            Unity.CurrentTestFailed = 1;\n        }\n    }\n\n    if (Unity.CurrentTestFailed)\n    {\n      UnityTestResultsFailBegin(lineNumber);\n      UnityPrintExpectedAndActualStringsLen(expected, actual, length);\n      UnityAddMsgIfSpecified(msg);\n      UNITY_FAIL_AND_BAIL;\n    }\n}\n\n\n/*-----------------------------------------------*/\nvoid UnityAssertEqualStringArray( const char** expected,\n                                  const char** actual,\n                                  const _UU32 num_elements,\n                                  const char* msg,\n                                  const UNITY_LINE_TYPE lineNumber)\n{\n    _UU32 i, j = 0;\n\n    UNITY_SKIP_EXECUTION;\n\n    /* if no elements, it's an error */\n    if (num_elements == 0)\n    {\n        UnityPrintPointlessAndBail();\n    }\n\n    if (UnityCheckArraysForNull((UNITY_INTERNAL_PTR)expected, (UNITY_INTERNAL_PTR)actual, lineNumber, msg) == 1)\n        return;\n\n    do\n    {\n        /* if both pointers not null compare the strings */\n        if (expected[j] && actual[j])\n        {\n            for (i = 0; expected[j][i] || actual[j][i]; i++)\n            {\n                if (expected[j][i] != actual[j][i])\n                {\n                    Unity.CurrentTestFailed = 1;\n                    break;\n                }\n            }\n        }\n        else\n        { /* handle case of one pointers being null (if both null, test should pass) */\n            if (expected[j] != actual[j])\n            {\n                Unity.CurrentTestFailed = 1;\n            }\n        }\n\n        if (Unity.CurrentTestFailed)\n        {\n            UnityTestResultsFailBegin(lineNumber);\n            if (num_elements > 1)\n            {\n                UnityPrint(UnityStrElement);\n                UnityPrintNumberUnsigned(j);\n            }\n            UnityPrintExpectedAndActualStrings((const char*)(expected[j]), (const char*)(actual[j]));\n            UnityAddMsgIfSpecified(msg);\n            UNITY_FAIL_AND_BAIL;\n        }\n    } while (++j < num_elements);\n}\n\n/*-----------------------------------------------*/\nvoid UnityAssertEqualMemory( UNITY_INTERNAL_PTR expected,\n                             UNITY_INTERNAL_PTR actual,\n                             const _UU32 length,\n                             const _UU32 num_elements,\n                             const char* msg,\n                             const UNITY_LINE_TYPE lineNumber)\n{\n    UNITY_PTR_ATTRIBUTE const unsigned char* ptr_exp = (UNITY_PTR_ATTRIBUTE const unsigned char*)expected;\n    UNITY_PTR_ATTRIBUTE const unsigned char* ptr_act = (UNITY_PTR_ATTRIBUTE const unsigned char*)actual;\n    _UU32 elements = num_elements;\n    _UU32 bytes;\n\n    UNITY_SKIP_EXECUTION;\n\n    if ((elements == 0) || (length == 0))\n    {\n        UnityPrintPointlessAndBail();\n    }\n\n    if (UnityCheckArraysForNull((UNITY_INTERNAL_PTR)expected, (UNITY_INTERNAL_PTR)actual, lineNumber, msg) == 1)\n        return;\n\n    while (elements--)\n    {\n        bytes = length;\n        while (bytes--)\n        {\n            if (*ptr_exp != *ptr_act)\n            {\n                UnityTestResultsFailBegin(lineNumber);\n                UnityPrint(UnityStrMemory);\n                if (num_elements > 1)\n                {\n                    UnityPrint(UnityStrElement);\n                    UnityPrintNumberUnsigned(num_elements - elements - 1);\n                }\n                UnityPrint(UnityStrByte);\n                UnityPrintNumberUnsigned(length - bytes - 1);\n                UnityPrint(UnityStrExpected);\n                UnityPrintNumberByStyle(*ptr_exp, UNITY_DISPLAY_STYLE_HEX8);\n                UnityPrint(UnityStrWas);\n                UnityPrintNumberByStyle(*ptr_act, UNITY_DISPLAY_STYLE_HEX8);\n                UnityAddMsgIfSpecified(msg);\n                UNITY_FAIL_AND_BAIL;\n            }\n            ptr_exp = (UNITY_INTERNAL_PTR)((_UP)ptr_exp + 1);\n            ptr_act = (UNITY_INTERNAL_PTR)((_UP)ptr_act + 1);\n        }\n    }\n}\n\n/*-----------------------------------------------\n * Control Functions\n *-----------------------------------------------*/\n\nvoid UnityFail(const char* msg, const UNITY_LINE_TYPE line)\n{\n    UNITY_SKIP_EXECUTION;\n\n    UnityTestResultsBegin(Unity.TestFile, line);\n    UnityPrintFail();\n    if (msg != NULL)\n    {\n        UNITY_OUTPUT_CHAR(':');\n\n#ifndef UNITY_EXCLUDE_DETAILS\n        if (Unity.CurrentDetail1)\n        {\n            UnityPrint(UnityStrDetail1Name);\n            UnityPrint(Unity.CurrentDetail1);\n            if (Unity.CurrentDetail2)\n            {\n                UnityPrint(UnityStrDetail2Name);\n                UnityPrint(Unity.CurrentDetail2);\n            }\n            UnityPrint(UnityStrSpacer);\n        }\n#endif\n        if (msg[0] != ' ')\n        {\n            UNITY_OUTPUT_CHAR(' ');\n        }\n        UnityPrint(msg);\n    }\n\n    UNITY_FAIL_AND_BAIL;\n}\n\n/*-----------------------------------------------*/\nvoid UnityIgnore(const char* msg, const UNITY_LINE_TYPE line)\n{\n    UNITY_SKIP_EXECUTION;\n\n    UnityTestResultsBegin(Unity.TestFile, line);\n    UnityPrint(UnityStrIgnore);\n    if (msg != NULL)\n    {\n      UNITY_OUTPUT_CHAR(':');\n      UNITY_OUTPUT_CHAR(' ');\n      UnityPrint(msg);\n    }\n    UNITY_IGNORE_AND_BAIL;\n}\n\n/*-----------------------------------------------*/\n#if defined(UNITY_WEAK_ATTRIBUTE)\n    UNITY_WEAK_ATTRIBUTE void setUp(void) { }\n    UNITY_WEAK_ATTRIBUTE void tearDown(void) { }\n#elif defined(UNITY_WEAK_PRAGMA)\n#   pragma weak setUp\n    void setUp(void) { }\n#   pragma weak tearDown\n    void tearDown(void) { }\n#endif\n/*-----------------------------------------------*/\nvoid UnityDefaultTestRun(UnityTestFunction Func, const char* FuncName, const int FuncLineNum)\n{\n    Unity.CurrentTestName = FuncName;\n    Unity.CurrentTestLineNumber = (UNITY_LINE_TYPE)FuncLineNum;\n    Unity.NumberOfTests++;\n    UNITY_CLR_DETAILS();\n    if (TEST_PROTECT())\n    {\n        setUp();\n        Func();\n    }\n    if (TEST_PROTECT() && !(Unity.CurrentTestIgnored))\n    {\n        tearDown();\n    }\n    UnityConcludeTest();\n}\n\n/*-----------------------------------------------*/\nvoid UnityBegin(const char* filename)\n{\n    Unity.TestFile = filename;\n    Unity.CurrentTestName = NULL;\n    Unity.CurrentTestLineNumber = 0;\n    Unity.NumberOfTests = 0;\n    Unity.TestFailures = 0;\n    Unity.TestIgnores = 0;\n    Unity.CurrentTestFailed = 0;\n    Unity.CurrentTestIgnored = 0;\n\n    UNITY_CLR_DETAILS();\n    UNITY_OUTPUT_START();\n}\n\n/*-----------------------------------------------*/\nint UnityEnd(void)\n{\n    UNITY_PRINT_EOL();\n    UnityPrint(UnityStrBreaker);\n    UNITY_PRINT_EOL();\n    UnityPrintNumber((_U_SINT)(Unity.NumberOfTests));\n    UnityPrint(UnityStrResultsTests);\n    UnityPrintNumber((_U_SINT)(Unity.TestFailures));\n    UnityPrint(UnityStrResultsFailures);\n    UnityPrintNumber((_U_SINT)(Unity.TestIgnores));\n    UnityPrint(UnityStrResultsIgnored);\n    UNITY_PRINT_EOL();\n    if (Unity.TestFailures == 0U)\n    {\n        UnityPrintOk();\n    }\n    else\n    {\n        UnityPrintFail();\n#ifdef UNITY_DIFFERENTIATE_FINAL_FAIL\n        UNITY_OUTPUT_CHAR('E'); UNITY_OUTPUT_CHAR('D');\n#endif\n    }\n    UNITY_PRINT_EOL();\n    UNITY_FLUSH_CALL();\n    UNITY_OUTPUT_COMPLETE();\n    return (int)(Unity.TestFailures);\n}\n\n/*-----------------------------------------------\n * Command Line Argument Support\n *-----------------------------------------------*/\n#ifdef UNITY_USE_COMMAND_LINE_ARGS\n\nchar* UnityOptionIncludeNamed = NULL;\nchar* UnityOptionExcludeNamed = NULL;\nint   UnityVerbosity          = 1;\n\nint UnityParseOptions(int argc, char** argv)\n{\n    UnityOptionIncludeNamed = NULL;\n    UnityOptionExcludeNamed = NULL;\n\n    for (int i = 1; i < argc; i++)\n    {\n        if (argv[i][0] == '-')\n        {\n            switch(argv[i][1])\n            {\n                case 'l': /* list tests */\n                    return -1;\n                case 'n': /* include tests with name including this string */\n                case 'f': /* an alias for -n */\n                    if (argv[i][2] == '=')\n                        UnityOptionIncludeNamed = &argv[i][3];\n                    else if (++i < argc)\n                        UnityOptionIncludeNamed = argv[i];\n                    else\n                    {\n                        UnityPrint(\"ERROR: No Test String to Include Matches For\");\n                        UNITY_PRINT_EOL();\n                        return 1;\n                    }\n                    break;\n                case 'q': /* quiet */\n                    UnityVerbosity = 0;\n                    break;\n                case 'v': /* verbose */\n                    UnityVerbosity = 2;\n                    break;\n                case 'x': /* exclude tests with name including this string */\n                    if (argv[i][2] == '=')\n                        UnityOptionExcludeNamed = &argv[i][3];\n                    else if (++i < argc)\n                        UnityOptionExcludeNamed = argv[i];\n                    else\n                    {\n                        UnityPrint(\"ERROR: No Test String to Exclude Matches For\");\n                        UNITY_PRINT_EOL();\n                        return 1;\n                    }\n                    break;\n                default:\n                    UnityPrint(\"ERROR: Unknown Option \");\n                    UNITY_OUTPUT_CHAR(argv[i][1]);\n                    UNITY_PRINT_EOL();\n                    return 1;\n            }\n        }\n    }\n\n    return 0;\n}\n\nint IsStringInBiggerString(const char* longstring, const char* shortstring)\n{\n    char* lptr = (char*)longstring;\n    char* sptr = (char*)shortstring;\n    char* lnext = lptr;\n\n    if (*sptr == '*')\n        return 1;\n\n    while (*lptr)\n    {\n        lnext = lptr + 1;\n\n        /* If they current bytes match, go on to the next bytes */\n        while (*lptr && *sptr && (*lptr == *sptr))\n        {\n            lptr++;\n            sptr++;\n\n            /* We're done if we match the entire string or up to a wildcard */\n            if (*sptr == '*')\n                return 1;\n            if (*sptr == ',')\n                return 1;\n            if (*sptr == '\"')\n                return 1;\n            if (*sptr == '\\'')\n                return 1;\n            if (*sptr == ':')\n                return 2;\n            if (*sptr == 0)\n                return 1;\n        }\n\n        /* Otherwise we start in the long pointer 1 character further and try again */\n        lptr = lnext;\n        sptr = (char*)shortstring;\n    }\n    return 0;\n}\n\nint UnityStringArgumentMatches(const char* str)\n{\n    int retval;\n    const char* ptr1;\n    const char* ptr2;\n    const char* ptrf;\n\n    /* Go through the options and get the substrings for matching one at a time */\n    ptr1 = str;\n    while (ptr1[0] != 0)\n    {\n        if ((ptr1[0] == '\"') || (ptr1[0] == '\\''))\n            ptr1++;\n\n        /* look for the start of the next partial */\n        ptr2 = ptr1;\n        ptrf = 0;\n        do {\n            ptr2++;\n            if ((ptr2[0] == ':') && (ptr2[1] != 0) && (ptr2[0] != '\\'') && (ptr2[0] != '\"') && (ptr2[0] != ','))\n                ptrf = &ptr2[1];\n        } while ((ptr2[0] != 0) && (ptr2[0] != '\\'') && (ptr2[0] != '\"') && (ptr2[0] != ','));\n        while ((ptr2[0] != 0) && ((ptr2[0] == ':') || (ptr2[0] == '\\'') || (ptr2[0] == '\"') || (ptr2[0] == ',')))\n            ptr2++;\n\n        /* done if complete filename match */\n        retval = IsStringInBiggerString(Unity.TestFile, ptr1);\n        if (retval == 1)\n            return retval;\n\n        /* done if testname match after filename partial match */\n        if ((retval == 2) && (ptrf != 0))\n        {\n            if (IsStringInBiggerString(Unity.CurrentTestName, ptrf))\n                return 1;\n        }\n\n        /* done if complete testname match */\n        if (IsStringInBiggerString(Unity.CurrentTestName, ptr1) == 1)\n            return 1;\n\n        ptr1 = ptr2;\n    }\n\n    /* we couldn't find a match for any substrings */\n    return 0;\n}\n\nint UnityTestMatches(void)\n{\n    /* Check if this test name matches the included test pattern */\n    int retval;\n    if (UnityOptionIncludeNamed)\n    {\n        retval = UnityStringArgumentMatches(UnityOptionIncludeNamed);\n    }\n    else\n        retval = 1;\n\n    /* Check if this test name matches the excluded test pattern */\n    if (UnityOptionExcludeNamed)\n    {\n        if (UnityStringArgumentMatches(UnityOptionExcludeNamed))\n            retval = 0;\n    }\n    return retval;\n}\n\n#endif /* UNITY_USE_COMMAND_LINE_ARGS */\n/*-----------------------------------------------*/\n"
  },
  {
    "path": "test/unit/unity/unity.h",
    "content": "/* ==========================================\n    Unity Project - A Test Framework for C\n    Copyright (c) 2007-14 Mike Karlesky, Mark VanderVoord, Greg Williams\n    [Released under MIT License. Please refer to license.txt for details]\n========================================== */\n\n#ifndef UNITY_FRAMEWORK_H\n#define UNITY_FRAMEWORK_H\n#define UNITY\n\n#ifdef __cplusplus\nextern \"C\"\n{\n#endif\n\n#include \"unity_internals.h\"\n\nvoid setUp(void);\nvoid tearDown(void);\n\n/*-------------------------------------------------------\n * Configuration Options\n *-------------------------------------------------------\n * All options described below should be passed as a compiler flag to all files using Unity. If you must add #defines, place them BEFORE the #include above.\n\n * Integers/longs/pointers\n *     - Unity attempts to automatically discover your integer sizes\n *       - define UNITY_EXCLUDE_STDINT_H to stop attempting to look in <stdint.h>\n *       - define UNITY_EXCLUDE_LIMITS_H to stop attempting to look in <limits.h>\n *     - If you cannot use the automatic methods above, you can force Unity by using these options:\n *       - define UNITY_SUPPORT_64\n *       - set UNITY_INT_WIDTH\n *       - set UNITY_LONG_WIDTH\n *       - set UNITY_POINTER_WIDTH\n\n * Floats\n *     - define UNITY_EXCLUDE_FLOAT to disallow floating point comparisons\n *     - define UNITY_FLOAT_PRECISION to specify the precision to use when doing TEST_ASSERT_EQUAL_FLOAT\n *     - define UNITY_FLOAT_TYPE to specify doubles instead of single precision floats\n *     - define UNITY_FLOAT_VERBOSE to print floating point values in errors (uses sprintf)\n *     - define UNITY_INCLUDE_DOUBLE to allow double floating point comparisons\n *     - define UNITY_EXCLUDE_DOUBLE to disallow double floating point comparisons (default)\n *     - define UNITY_DOUBLE_PRECISION to specify the precision to use when doing TEST_ASSERT_EQUAL_DOUBLE\n *     - define UNITY_DOUBLE_TYPE to specify something other than double\n *     - define UNITY_DOUBLE_VERBOSE to print floating point values in errors (uses sprintf)\n *     - define UNITY_VERBOSE_NUMBER_MAX_LENGTH to change maximum length of printed numbers (used by sprintf)\n\n * Output\n *     - by default, Unity prints to standard out with putchar.  define UNITY_OUTPUT_CHAR(a) with a different function if desired\n *     - define UNITY_DIFFERENTIATE_FINAL_FAIL to print FAILED (vs. FAIL) at test end summary - for automated search for failure\n\n * Optimization\n *     - by default, line numbers are stored in unsigned shorts.  Define UNITY_LINE_TYPE with a different type if your files are huge\n *     - by default, test and failure counters are unsigned shorts.  Define UNITY_COUNTER_TYPE with a different type if you want to save space or have more than 65535 Tests.\n\n * Test Cases\n *     - define UNITY_SUPPORT_TEST_CASES to include the TEST_CASE macro, though really it's mostly about the runner generator script\n\n * Parameterized Tests\n *     - you'll want to create a define of TEST_CASE(...) which basically evaluates to nothing\n\n * Tests with Arguments\n *     - you'll want to define UNITY_USE_COMMAND_LINE_ARGS if you have the test runner passing arguments to Unity\n\n *-------------------------------------------------------\n * Basic Fail and Ignore\n *-------------------------------------------------------*/\n\n#define TEST_FAIL_MESSAGE(message)                                                                 UNITY_TEST_FAIL(__LINE__, (message))\n#define TEST_FAIL()                                                                                UNITY_TEST_FAIL(__LINE__, NULL)\n#define TEST_IGNORE_MESSAGE(message)                                                               UNITY_TEST_IGNORE(__LINE__, (message))\n#define TEST_IGNORE()                                                                              UNITY_TEST_IGNORE(__LINE__, NULL)\n#define TEST_ONLY()\n\n/* It is not necessary for you to call PASS. A PASS condition is assumed if nothing fails.\n * This method allows you to abort a test immediately with a PASS state, ignoring the remainder of the test. */\n#define TEST_PASS()                                                                                longjmp(Unity.AbortFrame, 1)\n\n/*-------------------------------------------------------\n * Test Asserts (simple)\n *-------------------------------------------------------*/\n\n/* Boolean */\n#define TEST_ASSERT(condition)                                                                     UNITY_TEST_ASSERT(       (condition), __LINE__, \" Expression Evaluated To FALSE\")\n#define TEST_ASSERT_TRUE(condition)                                                                UNITY_TEST_ASSERT(       (condition), __LINE__, \" Expected TRUE Was FALSE\")\n#define TEST_ASSERT_UNLESS(condition)                                                              UNITY_TEST_ASSERT(      !(condition), __LINE__, \" Expression Evaluated To TRUE\")\n#define TEST_ASSERT_FALSE(condition)                                                               UNITY_TEST_ASSERT(      !(condition), __LINE__, \" Expected FALSE Was TRUE\")\n#define TEST_ASSERT_NULL(pointer)                                                                  UNITY_TEST_ASSERT_NULL(    (pointer), __LINE__, \" Expected NULL\")\n#define TEST_ASSERT_NOT_NULL(pointer)                                                              UNITY_TEST_ASSERT_NOT_NULL((pointer), __LINE__, \" Expected Non-NULL\")\n\n/* Integers (of all sizes) */\n#define TEST_ASSERT_EQUAL_INT(expected, actual)                                                    UNITY_TEST_ASSERT_EQUAL_INT((expected), (actual), __LINE__, NULL)\n#define TEST_ASSERT_EQUAL_INT8(expected, actual)                                                   UNITY_TEST_ASSERT_EQUAL_INT8((expected), (actual), __LINE__, NULL)\n#define TEST_ASSERT_EQUAL_INT16(expected, actual)                                                  UNITY_TEST_ASSERT_EQUAL_INT16((expected), (actual), __LINE__, NULL)\n#define TEST_ASSERT_EQUAL_INT32(expected, actual)                                                  UNITY_TEST_ASSERT_EQUAL_INT32((expected), (actual), __LINE__, NULL)\n#define TEST_ASSERT_EQUAL_INT64(expected, actual)                                                  UNITY_TEST_ASSERT_EQUAL_INT64((expected), (actual), __LINE__, NULL)\n#define TEST_ASSERT_EQUAL(expected, actual)                                                        UNITY_TEST_ASSERT_EQUAL_INT((expected), (actual), __LINE__, NULL)\n#define TEST_ASSERT_NOT_EQUAL(expected, actual)                                                    UNITY_TEST_ASSERT(((expected) !=  (actual)), __LINE__, \" Expected Not-Equal\")\n#define TEST_ASSERT_EQUAL_UINT(expected, actual)                                                   UNITY_TEST_ASSERT_EQUAL_UINT( (expected), (actual), __LINE__, NULL)\n#define TEST_ASSERT_EQUAL_UINT8(expected, actual)                                                  UNITY_TEST_ASSERT_EQUAL_UINT8( (expected), (actual), __LINE__, NULL)\n#define TEST_ASSERT_EQUAL_UINT16(expected, actual)                                                 UNITY_TEST_ASSERT_EQUAL_UINT16( (expected), (actual), __LINE__, NULL)\n#define TEST_ASSERT_EQUAL_UINT32(expected, actual)                                                 UNITY_TEST_ASSERT_EQUAL_UINT32( (expected), (actual), __LINE__, NULL)\n#define TEST_ASSERT_EQUAL_UINT64(expected, actual)                                                 UNITY_TEST_ASSERT_EQUAL_UINT64( (expected), (actual), __LINE__, NULL)\n#define TEST_ASSERT_EQUAL_HEX(expected, actual)                                                    UNITY_TEST_ASSERT_EQUAL_HEX32((expected), (actual), __LINE__, NULL)\n#define TEST_ASSERT_EQUAL_HEX8(expected, actual)                                                   UNITY_TEST_ASSERT_EQUAL_HEX8( (expected), (actual), __LINE__, NULL)\n#define TEST_ASSERT_EQUAL_HEX16(expected, actual)                                                  UNITY_TEST_ASSERT_EQUAL_HEX16((expected), (actual), __LINE__, NULL)\n#define TEST_ASSERT_EQUAL_HEX32(expected, actual)                                                  UNITY_TEST_ASSERT_EQUAL_HEX32((expected), (actual), __LINE__, NULL)\n#define TEST_ASSERT_EQUAL_HEX64(expected, actual)                                                  UNITY_TEST_ASSERT_EQUAL_HEX64((expected), (actual), __LINE__, NULL)\n#define TEST_ASSERT_BITS(mask, expected, actual)                                                   UNITY_TEST_ASSERT_BITS((mask), (expected), (actual), __LINE__, NULL)\n#define TEST_ASSERT_BITS_HIGH(mask, actual)                                                        UNITY_TEST_ASSERT_BITS((mask), (_UU32)(-1), (actual), __LINE__, NULL)\n#define TEST_ASSERT_BITS_LOW(mask, actual)                                                         UNITY_TEST_ASSERT_BITS((mask), (_UU32)(0), (actual), __LINE__, NULL)\n#define TEST_ASSERT_BIT_HIGH(bit, actual)                                                          UNITY_TEST_ASSERT_BITS(((_UU32)1 << (bit)), (_UU32)(-1), (actual), __LINE__, NULL)\n#define TEST_ASSERT_BIT_LOW(bit, actual)                                                           UNITY_TEST_ASSERT_BITS(((_UU32)1 << (bit)), (_UU32)(0), (actual), __LINE__, NULL)\n\n/* Integer Ranges (of all sizes) */\n#define TEST_ASSERT_INT_WITHIN(delta, expected, actual)                                            UNITY_TEST_ASSERT_INT_WITHIN((delta), (expected), (actual), __LINE__, NULL)\n#define TEST_ASSERT_INT8_WITHIN(delta, expected, actual)                                           UNITY_TEST_ASSERT_INT8_WITHIN((delta), (expected), (actual), __LINE__, NULL)\n#define TEST_ASSERT_INT16_WITHIN(delta, expected, actual)                                          UNITY_TEST_ASSERT_INT16_WITHIN((delta), (expected), (actual), __LINE__, NULL)\n#define TEST_ASSERT_INT32_WITHIN(delta, expected, actual)                                          UNITY_TEST_ASSERT_INT32_WITHIN((delta), (expected), (actual), __LINE__, NULL)\n#define TEST_ASSERT_INT64_WITHIN(delta, expected, actual)                                          UNITY_TEST_ASSERT_INT64_WITHIN((delta), (expected), (actual), __LINE__, NULL)\n#define TEST_ASSERT_UINT_WITHIN(delta, expected, actual)                                           UNITY_TEST_ASSERT_UINT_WITHIN((delta), (expected), (actual), __LINE__, NULL)\n#define TEST_ASSERT_UINT8_WITHIN(delta, expected, actual)                                          UNITY_TEST_ASSERT_UINT8_WITHIN((delta), (expected), (actual), __LINE__, NULL)\n#define TEST_ASSERT_UINT16_WITHIN(delta, expected, actual)                                         UNITY_TEST_ASSERT_UINT16_WITHIN((delta), (expected), (actual), __LINE__, NULL)\n#define TEST_ASSERT_UINT32_WITHIN(delta, expected, actual)                                         UNITY_TEST_ASSERT_UINT32_WITHIN((delta), (expected), (actual), __LINE__, NULL)\n#define TEST_ASSERT_UINT64_WITHIN(delta, expected, actual)                                         UNITY_TEST_ASSERT_UINT64_WITHIN((delta), (expected), (actual), __LINE__, NULL)\n#define TEST_ASSERT_HEX_WITHIN(delta, expected, actual)                                            UNITY_TEST_ASSERT_HEX32_WITHIN((delta), (expected), (actual), __LINE__, NULL)\n#define TEST_ASSERT_HEX8_WITHIN(delta, expected, actual)                                           UNITY_TEST_ASSERT_HEX8_WITHIN((delta), (expected), (actual), __LINE__, NULL)\n#define TEST_ASSERT_HEX16_WITHIN(delta, expected, actual)                                          UNITY_TEST_ASSERT_HEX16_WITHIN((delta), (expected), (actual), __LINE__, NULL)\n#define TEST_ASSERT_HEX32_WITHIN(delta, expected, actual)                                          UNITY_TEST_ASSERT_HEX32_WITHIN((delta), (expected), (actual), __LINE__, NULL)\n#define TEST_ASSERT_HEX64_WITHIN(delta, expected, actual)                                          UNITY_TEST_ASSERT_HEX64_WITHIN((delta), (expected), (actual), __LINE__, NULL)\n\n/* Structs and Strings */\n#define TEST_ASSERT_EQUAL_PTR(expected, actual)                                                    UNITY_TEST_ASSERT_EQUAL_PTR((expected), (actual), __LINE__, NULL)\n#define TEST_ASSERT_EQUAL_STRING(expected, actual)                                                 UNITY_TEST_ASSERT_EQUAL_STRING((expected), (actual), __LINE__, NULL)\n#define TEST_ASSERT_EQUAL_STRING_LEN(expected, actual, len)                                        UNITY_TEST_ASSERT_EQUAL_STRING_LEN((expected), (actual), (len), __LINE__, NULL)\n#define TEST_ASSERT_EQUAL_MEMORY(expected, actual, len)                                            UNITY_TEST_ASSERT_EQUAL_MEMORY((expected), (actual), (len), __LINE__, NULL)\n\n/* Arrays */\n#define TEST_ASSERT_EQUAL_INT_ARRAY(expected, actual, num_elements)                                UNITY_TEST_ASSERT_EQUAL_INT_ARRAY((expected), (actual), (num_elements), __LINE__, NULL)\n#define TEST_ASSERT_EQUAL_INT8_ARRAY(expected, actual, num_elements)                               UNITY_TEST_ASSERT_EQUAL_INT8_ARRAY((expected), (actual), (num_elements), __LINE__, NULL)\n#define TEST_ASSERT_EQUAL_INT16_ARRAY(expected, actual, num_elements)                              UNITY_TEST_ASSERT_EQUAL_INT16_ARRAY((expected), (actual), (num_elements), __LINE__, NULL)\n#define TEST_ASSERT_EQUAL_INT32_ARRAY(expected, actual, num_elements)                              UNITY_TEST_ASSERT_EQUAL_INT32_ARRAY((expected), (actual), (num_elements), __LINE__, NULL)\n#define TEST_ASSERT_EQUAL_INT64_ARRAY(expected, actual, num_elements)                              UNITY_TEST_ASSERT_EQUAL_INT64_ARRAY((expected), (actual), (num_elements), __LINE__, NULL)\n#define TEST_ASSERT_EQUAL_UINT_ARRAY(expected, actual, num_elements)                               UNITY_TEST_ASSERT_EQUAL_UINT_ARRAY((expected), (actual), (num_elements), __LINE__, NULL)\n#define TEST_ASSERT_EQUAL_UINT8_ARRAY(expected, actual, num_elements)                              UNITY_TEST_ASSERT_EQUAL_UINT8_ARRAY((expected), (actual), (num_elements), __LINE__, NULL)\n#define TEST_ASSERT_EQUAL_UINT16_ARRAY(expected, actual, num_elements)                             UNITY_TEST_ASSERT_EQUAL_UINT16_ARRAY((expected), (actual), (num_elements), __LINE__, NULL)\n#define TEST_ASSERT_EQUAL_UINT32_ARRAY(expected, actual, num_elements)                             UNITY_TEST_ASSERT_EQUAL_UINT32_ARRAY((expected), (actual), (num_elements), __LINE__, NULL)\n#define TEST_ASSERT_EQUAL_UINT64_ARRAY(expected, actual, num_elements)                             UNITY_TEST_ASSERT_EQUAL_UINT64_ARRAY((expected), (actual), (num_elements), __LINE__, NULL)\n#define TEST_ASSERT_EQUAL_HEX_ARRAY(expected, actual, num_elements)                                UNITY_TEST_ASSERT_EQUAL_HEX32_ARRAY((expected), (actual), (num_elements), __LINE__, NULL)\n#define TEST_ASSERT_EQUAL_HEX8_ARRAY(expected, actual, num_elements)                               UNITY_TEST_ASSERT_EQUAL_HEX8_ARRAY((expected), (actual), (num_elements), __LINE__, NULL)\n#define TEST_ASSERT_EQUAL_HEX16_ARRAY(expected, actual, num_elements)                              UNITY_TEST_ASSERT_EQUAL_HEX16_ARRAY((expected), (actual), (num_elements), __LINE__, NULL)\n#define TEST_ASSERT_EQUAL_HEX32_ARRAY(expected, actual, num_elements)                              UNITY_TEST_ASSERT_EQUAL_HEX32_ARRAY((expected), (actual), (num_elements), __LINE__, NULL)\n#define TEST_ASSERT_EQUAL_HEX64_ARRAY(expected, actual, num_elements)                              UNITY_TEST_ASSERT_EQUAL_HEX64_ARRAY((expected), (actual), (num_elements), __LINE__, NULL)\n#define TEST_ASSERT_EQUAL_PTR_ARRAY(expected, actual, num_elements)                                UNITY_TEST_ASSERT_EQUAL_PTR_ARRAY((expected), (actual), (num_elements), __LINE__, NULL)\n#define TEST_ASSERT_EQUAL_STRING_ARRAY(expected, actual, num_elements)                             UNITY_TEST_ASSERT_EQUAL_STRING_ARRAY((expected), (actual), (num_elements), __LINE__, NULL)\n#define TEST_ASSERT_EQUAL_MEMORY_ARRAY(expected, actual, len, num_elements)                        UNITY_TEST_ASSERT_EQUAL_MEMORY_ARRAY((expected), (actual), (len), (num_elements), __LINE__, NULL)\n\n/* Floating Point (If Enabled) */\n#define TEST_ASSERT_FLOAT_WITHIN(delta, expected, actual)                                          UNITY_TEST_ASSERT_FLOAT_WITHIN((delta), (expected), (actual), __LINE__, NULL)\n#define TEST_ASSERT_EQUAL_FLOAT(expected, actual)                                                  UNITY_TEST_ASSERT_EQUAL_FLOAT((expected), (actual), __LINE__, NULL)\n#define TEST_ASSERT_EQUAL_FLOAT_ARRAY(expected, actual, num_elements)                              UNITY_TEST_ASSERT_EQUAL_FLOAT_ARRAY((expected), (actual), (num_elements), __LINE__, NULL)\n#define TEST_ASSERT_FLOAT_IS_INF(actual)                                                           UNITY_TEST_ASSERT_FLOAT_IS_INF((actual), __LINE__, NULL)\n#define TEST_ASSERT_FLOAT_IS_NEG_INF(actual)                                                       UNITY_TEST_ASSERT_FLOAT_IS_NEG_INF((actual), __LINE__, NULL)\n#define TEST_ASSERT_FLOAT_IS_NAN(actual)                                                           UNITY_TEST_ASSERT_FLOAT_IS_NAN((actual), __LINE__, NULL)\n#define TEST_ASSERT_FLOAT_IS_DETERMINATE(actual)                                                   UNITY_TEST_ASSERT_FLOAT_IS_DETERMINATE((actual), __LINE__, NULL)\n#define TEST_ASSERT_FLOAT_IS_NOT_INF(actual)                                                       UNITY_TEST_ASSERT_FLOAT_IS_NOT_INF((actual), __LINE__, NULL)\n#define TEST_ASSERT_FLOAT_IS_NOT_NEG_INF(actual)                                                   UNITY_TEST_ASSERT_FLOAT_IS_NOT_NEG_INF((actual), __LINE__, NULL)\n#define TEST_ASSERT_FLOAT_IS_NOT_NAN(actual)                                                       UNITY_TEST_ASSERT_FLOAT_IS_NOT_NAN((actual), __LINE__, NULL)\n#define TEST_ASSERT_FLOAT_IS_NOT_DETERMINATE(actual)                                               UNITY_TEST_ASSERT_FLOAT_IS_NOT_DETERMINATE((actual), __LINE__, NULL)\n\n/* Double (If Enabled) */\n#define TEST_ASSERT_DOUBLE_WITHIN(delta, expected, actual)                                         UNITY_TEST_ASSERT_DOUBLE_WITHIN((delta), (expected), (actual), __LINE__, NULL)\n#define TEST_ASSERT_EQUAL_DOUBLE(expected, actual)                                                 UNITY_TEST_ASSERT_EQUAL_DOUBLE((expected), (actual), __LINE__, NULL)\n#define TEST_ASSERT_EQUAL_DOUBLE_ARRAY(expected, actual, num_elements)                             UNITY_TEST_ASSERT_EQUAL_DOUBLE_ARRAY((expected), (actual), (num_elements), __LINE__, NULL)\n#define TEST_ASSERT_DOUBLE_IS_INF(actual)                                                          UNITY_TEST_ASSERT_DOUBLE_IS_INF((actual), __LINE__, NULL)\n#define TEST_ASSERT_DOUBLE_IS_NEG_INF(actual)                                                      UNITY_TEST_ASSERT_DOUBLE_IS_NEG_INF((actual), __LINE__, NULL)\n#define TEST_ASSERT_DOUBLE_IS_NAN(actual)                                                          UNITY_TEST_ASSERT_DOUBLE_IS_NAN((actual), __LINE__, NULL)\n#define TEST_ASSERT_DOUBLE_IS_DETERMINATE(actual)                                                  UNITY_TEST_ASSERT_DOUBLE_IS_DETERMINATE((actual), __LINE__, NULL)\n#define TEST_ASSERT_DOUBLE_IS_NOT_INF(actual)                                                      UNITY_TEST_ASSERT_DOUBLE_IS_NOT_INF((actual), __LINE__, NULL)\n#define TEST_ASSERT_DOUBLE_IS_NOT_NEG_INF(actual)                                                  UNITY_TEST_ASSERT_DOUBLE_IS_NOT_NEG_INF((actual), __LINE__, NULL)\n#define TEST_ASSERT_DOUBLE_IS_NOT_NAN(actual)                                                      UNITY_TEST_ASSERT_DOUBLE_IS_NOT_NAN((actual), __LINE__, NULL)\n#define TEST_ASSERT_DOUBLE_IS_NOT_DETERMINATE(actual)                                              UNITY_TEST_ASSERT_DOUBLE_IS_NOT_DETERMINATE((actual), __LINE__, NULL)\n\n/*-------------------------------------------------------\n * Test Asserts (with additional messages)\n *-------------------------------------------------------*/\n\n/* Boolean */\n#define TEST_ASSERT_MESSAGE(condition, message)                                                    UNITY_TEST_ASSERT(       (condition), __LINE__, (message))\n#define TEST_ASSERT_TRUE_MESSAGE(condition, message)                                               UNITY_TEST_ASSERT(       (condition), __LINE__, (message))\n#define TEST_ASSERT_UNLESS_MESSAGE(condition, message)                                             UNITY_TEST_ASSERT(      !(condition), __LINE__, (message))\n#define TEST_ASSERT_FALSE_MESSAGE(condition, message)                                              UNITY_TEST_ASSERT(      !(condition), __LINE__, (message))\n#define TEST_ASSERT_NULL_MESSAGE(pointer, message)                                                 UNITY_TEST_ASSERT_NULL(    (pointer), __LINE__, (message))\n#define TEST_ASSERT_NOT_NULL_MESSAGE(pointer, message)                                             UNITY_TEST_ASSERT_NOT_NULL((pointer), __LINE__, (message))\n\n/* Integers (of all sizes) */\n#define TEST_ASSERT_EQUAL_INT_MESSAGE(expected, actual, message)                                   UNITY_TEST_ASSERT_EQUAL_INT((expected), (actual), __LINE__, (message))\n#define TEST_ASSERT_EQUAL_INT8_MESSAGE(expected, actual, message)                                  UNITY_TEST_ASSERT_EQUAL_INT8((expected), (actual), __LINE__, (message))\n#define TEST_ASSERT_EQUAL_INT16_MESSAGE(expected, actual, message)                                 UNITY_TEST_ASSERT_EQUAL_INT16((expected), (actual), __LINE__, (message))\n#define TEST_ASSERT_EQUAL_INT32_MESSAGE(expected, actual, message)                                 UNITY_TEST_ASSERT_EQUAL_INT32((expected), (actual), __LINE__, (message))\n#define TEST_ASSERT_EQUAL_INT64_MESSAGE(expected, actual, message)                                 UNITY_TEST_ASSERT_EQUAL_INT64((expected), (actual), __LINE__, (message))\n#define TEST_ASSERT_EQUAL_MESSAGE(expected, actual, message)                                       UNITY_TEST_ASSERT_EQUAL_INT((expected), (actual), __LINE__, (message))\n#define TEST_ASSERT_NOT_EQUAL_MESSAGE(expected, actual, message)                                   UNITY_TEST_ASSERT(((expected) !=  (actual)), __LINE__, (message))\n#define TEST_ASSERT_EQUAL_UINT_MESSAGE(expected, actual, message)                                  UNITY_TEST_ASSERT_EQUAL_UINT( (expected), (actual), __LINE__, (message))\n#define TEST_ASSERT_EQUAL_UINT8_MESSAGE(expected, actual, message)                                 UNITY_TEST_ASSERT_EQUAL_UINT8( (expected), (actual), __LINE__, (message))\n#define TEST_ASSERT_EQUAL_UINT16_MESSAGE(expected, actual, message)                                UNITY_TEST_ASSERT_EQUAL_UINT16( (expected), (actual), __LINE__, (message))\n#define TEST_ASSERT_EQUAL_UINT32_MESSAGE(expected, actual, message)                                UNITY_TEST_ASSERT_EQUAL_UINT32( (expected), (actual), __LINE__, (message))\n#define TEST_ASSERT_EQUAL_UINT64_MESSAGE(expected, actual, message)                                UNITY_TEST_ASSERT_EQUAL_UINT64( (expected), (actual), __LINE__, (message))\n#define TEST_ASSERT_EQUAL_HEX_MESSAGE(expected, actual, message)                                   UNITY_TEST_ASSERT_EQUAL_HEX32((expected), (actual), __LINE__, (message))\n#define TEST_ASSERT_EQUAL_HEX8_MESSAGE(expected, actual, message)                                  UNITY_TEST_ASSERT_EQUAL_HEX8( (expected), (actual), __LINE__, (message))\n#define TEST_ASSERT_EQUAL_HEX16_MESSAGE(expected, actual, message)                                 UNITY_TEST_ASSERT_EQUAL_HEX16((expected), (actual), __LINE__, (message))\n#define TEST_ASSERT_EQUAL_HEX32_MESSAGE(expected, actual, message)                                 UNITY_TEST_ASSERT_EQUAL_HEX32((expected), (actual), __LINE__, (message))\n#define TEST_ASSERT_EQUAL_HEX64_MESSAGE(expected, actual, message)                                 UNITY_TEST_ASSERT_EQUAL_HEX64((expected), (actual), __LINE__, (message))\n#define TEST_ASSERT_BITS_MESSAGE(mask, expected, actual, message)                                  UNITY_TEST_ASSERT_BITS((mask), (expected), (actual), __LINE__, (message))\n#define TEST_ASSERT_BITS_HIGH_MESSAGE(mask, actual, message)                                       UNITY_TEST_ASSERT_BITS((mask), (_UU32)(-1), (actual), __LINE__, (message))\n#define TEST_ASSERT_BITS_LOW_MESSAGE(mask, actual, message)                                        UNITY_TEST_ASSERT_BITS((mask), (_UU32)(0), (actual), __LINE__, (message))\n#define TEST_ASSERT_BIT_HIGH_MESSAGE(bit, actual, message)                                         UNITY_TEST_ASSERT_BITS(((_UU32)1 << (bit)), (_UU32)(-1), (actual), __LINE__, (message))\n#define TEST_ASSERT_BIT_LOW_MESSAGE(bit, actual, message)                                          UNITY_TEST_ASSERT_BITS(((_UU32)1 << (bit)), (_UU32)(0), (actual), __LINE__, (message))\n\n/* Integer Ranges (of all sizes) */\n#define TEST_ASSERT_INT_WITHIN_MESSAGE(delta, expected, actual, message)                           UNITY_TEST_ASSERT_INT_WITHIN((delta), (expected), (actual), __LINE__, (message))\n#define TEST_ASSERT_INT8_WITHIN_MESSAGE(delta, expected, actual, message)                          UNITY_TEST_ASSERT_INT8_WITHIN((delta), (expected), (actual), __LINE__, (message))\n#define TEST_ASSERT_INT16_WITHIN_MESSAGE(delta, expected, actual, message)                         UNITY_TEST_ASSERT_INT16_WITHIN((delta), (expected), (actual), __LINE__, (message))\n#define TEST_ASSERT_INT32_WITHIN_MESSAGE(delta, expected, actual, message)                         UNITY_TEST_ASSERT_INT32_WITHIN((delta), (expected), (actual), __LINE__, (message))\n#define TEST_ASSERT_INT64_WITHIN_MESSAGE(delta, expected, actual, message)                         UNITY_TEST_ASSERT_INT64_WITHIN((delta), (expected), (actual), __LINE__, (message))\n#define TEST_ASSERT_UINT_WITHIN_MESSAGE(delta, expected, actual, message)                          UNITY_TEST_ASSERT_UINT_WITHIN((delta), (expected), (actual), __LINE__, (message))\n#define TEST_ASSERT_UINT8_WITHIN_MESSAGE(delta, expected, actual, message)                         UNITY_TEST_ASSERT_UINT8_WITHIN((delta), (expected), (actual), __LINE__, (message))\n#define TEST_ASSERT_UINT16_WITHIN_MESSAGE(delta, expected, actual, message)                        UNITY_TEST_ASSERT_UINT16_WITHIN((delta), (expected), (actual), __LINE__, (message))\n#define TEST_ASSERT_UINT32_WITHIN_MESSAGE(delta, expected, actual, message)                        UNITY_TEST_ASSERT_UINT32_WITHIN((delta), (expected), (actual), __LINE__, (message))\n#define TEST_ASSERT_UINT64_WITHIN_MESSAGE(delta, expected, actual, message)                        UNITY_TEST_ASSERT_UINT64_WITHIN((delta), (expected), (actual), __LINE__, (message))\n#define TEST_ASSERT_HEX_WITHIN_MESSAGE(delta, expected, actual, message)                           UNITY_TEST_ASSERT_HEX32_WITHIN((delta), (expected), (actual), __LINE__, (message))\n#define TEST_ASSERT_HEX8_WITHIN_MESSAGE(delta, expected, actual, message)                          UNITY_TEST_ASSERT_HEX8_WITHIN((delta), (expected), (actual), __LINE__, (message))\n#define TEST_ASSERT_HEX16_WITHIN_MESSAGE(delta, expected, actual, message)                         UNITY_TEST_ASSERT_HEX16_WITHIN((delta), (expected), (actual), __LINE__, (message))\n#define TEST_ASSERT_HEX32_WITHIN_MESSAGE(delta, expected, actual, message)                         UNITY_TEST_ASSERT_HEX32_WITHIN((delta), (expected), (actual), __LINE__, (message))\n#define TEST_ASSERT_HEX64_WITHIN_MESSAGE(delta, expected, actual, message)                         UNITY_TEST_ASSERT_HEX64_WITHIN((delta), (expected), (actual), __LINE__, (message))\n\n/* Structs and Strings */\n#define TEST_ASSERT_EQUAL_PTR_MESSAGE(expected, actual, message)                                   UNITY_TEST_ASSERT_EQUAL_PTR((expected), (actual), __LINE__, (message))\n#define TEST_ASSERT_EQUAL_STRING_MESSAGE(expected, actual, message)                                UNITY_TEST_ASSERT_EQUAL_STRING((expected), (actual), __LINE__, (message))\n#define TEST_ASSERT_EQUAL_STRING_LEN_MESSAGE(expected, actual, len, message)                       UNITY_TEST_ASSERT_EQUAL_STRING_LEN((expected), (actual), (len), __LINE__, (message))\n#define TEST_ASSERT_EQUAL_MEMORY_MESSAGE(expected, actual, len, message)                           UNITY_TEST_ASSERT_EQUAL_MEMORY((expected), (actual), (len), __LINE__, (message))\n\n/* Arrays */\n#define TEST_ASSERT_EQUAL_INT_ARRAY_MESSAGE(expected, actual, num_elements, message)               UNITY_TEST_ASSERT_EQUAL_INT_ARRAY((expected), (actual), (num_elements), __LINE__, (message))\n#define TEST_ASSERT_EQUAL_INT8_ARRAY_MESSAGE(expected, actual, num_elements, message)              UNITY_TEST_ASSERT_EQUAL_INT8_ARRAY((expected), (actual), (num_elements), __LINE__, (message))\n#define TEST_ASSERT_EQUAL_INT16_ARRAY_MESSAGE(expected, actual, num_elements, message)             UNITY_TEST_ASSERT_EQUAL_INT16_ARRAY((expected), (actual), (num_elements), __LINE__, (message))\n#define TEST_ASSERT_EQUAL_INT32_ARRAY_MESSAGE(expected, actual, num_elements, message)             UNITY_TEST_ASSERT_EQUAL_INT32_ARRAY((expected), (actual), (num_elements), __LINE__, (message))\n#define TEST_ASSERT_EQUAL_INT64_ARRAY_MESSAGE(expected, actual, num_elements, message)             UNITY_TEST_ASSERT_EQUAL_INT64_ARRAY((expected), (actual), (num_elements), __LINE__, (message))\n#define TEST_ASSERT_EQUAL_UINT_ARRAY_MESSAGE(expected, actual, num_elements, message)              UNITY_TEST_ASSERT_EQUAL_UINT_ARRAY((expected), (actual), (num_elements), __LINE__, (message))\n#define TEST_ASSERT_EQUAL_UINT8_ARRAY_MESSAGE(expected, actual, num_elements, message)             UNITY_TEST_ASSERT_EQUAL_UINT8_ARRAY((expected), (actual), (num_elements), __LINE__, (message))\n#define TEST_ASSERT_EQUAL_UINT16_ARRAY_MESSAGE(expected, actual, num_elements, message)            UNITY_TEST_ASSERT_EQUAL_UINT16_ARRAY((expected), (actual), (num_elements), __LINE__, (message))\n#define TEST_ASSERT_EQUAL_UINT32_ARRAY_MESSAGE(expected, actual, num_elements, message)            UNITY_TEST_ASSERT_EQUAL_UINT32_ARRAY((expected), (actual), (num_elements), __LINE__, (message))\n#define TEST_ASSERT_EQUAL_UINT64_ARRAY_MESSAGE(expected, actual, num_elements, message)            UNITY_TEST_ASSERT_EQUAL_UINT64_ARRAY((expected), (actual), (num_elements), __LINE__, (message))\n#define TEST_ASSERT_EQUAL_HEX_ARRAY_MESSAGE(expected, actual, num_elements, message)               UNITY_TEST_ASSERT_EQUAL_HEX32_ARRAY((expected), (actual), (num_elements), __LINE__, (message))\n#define TEST_ASSERT_EQUAL_HEX8_ARRAY_MESSAGE(expected, actual, num_elements, message)              UNITY_TEST_ASSERT_EQUAL_HEX8_ARRAY((expected), (actual), (num_elements), __LINE__, (message))\n#define TEST_ASSERT_EQUAL_HEX16_ARRAY_MESSAGE(expected, actual, num_elements, message)             UNITY_TEST_ASSERT_EQUAL_HEX16_ARRAY((expected), (actual), (num_elements), __LINE__, (message))\n#define TEST_ASSERT_EQUAL_HEX32_ARRAY_MESSAGE(expected, actual, num_elements, message)             UNITY_TEST_ASSERT_EQUAL_HEX32_ARRAY((expected), (actual), (num_elements), __LINE__, (message))\n#define TEST_ASSERT_EQUAL_HEX64_ARRAY_MESSAGE(expected, actual, num_elements, message)             UNITY_TEST_ASSERT_EQUAL_HEX64_ARRAY((expected), (actual), (num_elements), __LINE__, (message))\n#define TEST_ASSERT_EQUAL_PTR_ARRAY_MESSAGE(expected, actual, num_elements, message)               UNITY_TEST_ASSERT_EQUAL_PTR_ARRAY((expected), (actual), (num_elements), __LINE__, (message))\n#define TEST_ASSERT_EQUAL_STRING_ARRAY_MESSAGE(expected, actual, num_elements, message)            UNITY_TEST_ASSERT_EQUAL_STRING_ARRAY((expected), (actual), (num_elements), __LINE__, (message))\n#define TEST_ASSERT_EQUAL_MEMORY_ARRAY_MESSAGE(expected, actual, len, num_elements, message)       UNITY_TEST_ASSERT_EQUAL_MEMORY_ARRAY((expected), (actual), (len), (num_elements), __LINE__, (message))\n\n/* Floating Point (If Enabled) */\n#define TEST_ASSERT_FLOAT_WITHIN_MESSAGE(delta, expected, actual, message)                         UNITY_TEST_ASSERT_FLOAT_WITHIN((delta), (expected), (actual), __LINE__, (message))\n#define TEST_ASSERT_EQUAL_FLOAT_MESSAGE(expected, actual, message)                                 UNITY_TEST_ASSERT_EQUAL_FLOAT((expected), (actual), __LINE__, (message))\n#define TEST_ASSERT_EQUAL_FLOAT_ARRAY_MESSAGE(expected, actual, num_elements, message)             UNITY_TEST_ASSERT_EQUAL_FLOAT_ARRAY((expected), (actual), (num_elements), __LINE__, (message))\n#define TEST_ASSERT_FLOAT_IS_INF_MESSAGE(actual, message)                                          UNITY_TEST_ASSERT_FLOAT_IS_INF((actual), __LINE__, (message))\n#define TEST_ASSERT_FLOAT_IS_NEG_INF_MESSAGE(actual, message)                                      UNITY_TEST_ASSERT_FLOAT_IS_NEG_INF((actual), __LINE__, (message))\n#define TEST_ASSERT_FLOAT_IS_NAN_MESSAGE(actual, message)                                          UNITY_TEST_ASSERT_FLOAT_IS_NAN((actual), __LINE__, (message))\n#define TEST_ASSERT_FLOAT_IS_DETERMINATE_MESSAGE(actual, message)                                  UNITY_TEST_ASSERT_FLOAT_IS_DETERMINATE((actual), __LINE__, (message))\n#define TEST_ASSERT_FLOAT_IS_NOT_INF_MESSAGE(actual, message)                                      UNITY_TEST_ASSERT_FLOAT_IS_NOT_INF((actual), __LINE__, (message))\n#define TEST_ASSERT_FLOAT_IS_NOT_NEG_INF_MESSAGE(actual, message)                                  UNITY_TEST_ASSERT_FLOAT_IS_NOT_NEG_INF((actual), __LINE__, (message))\n#define TEST_ASSERT_FLOAT_IS_NOT_NAN_MESSAGE(actual, message)                                      UNITY_TEST_ASSERT_FLOAT_IS_NOT_NAN((actual), __LINE__, (message))\n#define TEST_ASSERT_FLOAT_IS_NOT_DETERMINATE_MESSAGE(actual, message)                              UNITY_TEST_ASSERT_FLOAT_IS_NOT_DETERMINATE((actual), __LINE__, (message))\n\n/* Double (If Enabled) */\n#define TEST_ASSERT_DOUBLE_WITHIN_MESSAGE(delta, expected, actual, message)                        UNITY_TEST_ASSERT_DOUBLE_WITHIN((delta), (expected), (actual), __LINE__, (message))\n#define TEST_ASSERT_EQUAL_DOUBLE_MESSAGE(expected, actual, message)                                UNITY_TEST_ASSERT_EQUAL_DOUBLE((expected), (actual), __LINE__, (message))\n#define TEST_ASSERT_EQUAL_DOUBLE_ARRAY_MESSAGE(expected, actual, num_elements, message)            UNITY_TEST_ASSERT_EQUAL_DOUBLE_ARRAY((expected), (actual), (num_elements), __LINE__, (message))\n#define TEST_ASSERT_DOUBLE_IS_INF_MESSAGE(actual, message)                                         UNITY_TEST_ASSERT_DOUBLE_IS_INF((actual), __LINE__, (message))\n#define TEST_ASSERT_DOUBLE_IS_NEG_INF_MESSAGE(actual, message)                                     UNITY_TEST_ASSERT_DOUBLE_IS_NEG_INF((actual), __LINE__, (message))\n#define TEST_ASSERT_DOUBLE_IS_NAN_MESSAGE(actual, message)                                         UNITY_TEST_ASSERT_DOUBLE_IS_NAN((actual), __LINE__, (message))\n#define TEST_ASSERT_DOUBLE_IS_DETERMINATE_MESSAGE(actual, message)                                 UNITY_TEST_ASSERT_DOUBLE_IS_DETERMINATE((actual), __LINE__, (message))\n#define TEST_ASSERT_DOUBLE_IS_NOT_INF_MESSAGE(actual, message)                                     UNITY_TEST_ASSERT_DOUBLE_IS_NOT_INF((actual), __LINE__, (message))\n#define TEST_ASSERT_DOUBLE_IS_NOT_NEG_INF_MESSAGE(actual, message)                                 UNITY_TEST_ASSERT_DOUBLE_IS_NOT_NEG_INF((actual), __LINE__, (message))\n#define TEST_ASSERT_DOUBLE_IS_NOT_NAN_MESSAGE(actual, message)                                     UNITY_TEST_ASSERT_DOUBLE_IS_NOT_NAN((actual), __LINE__, (message))\n#define TEST_ASSERT_DOUBLE_IS_NOT_DETERMINATE_MESSAGE(actual, message)                             UNITY_TEST_ASSERT_DOUBLE_IS_NOT_DETERMINATE((actual), __LINE__, (message))\n\n/* end of UNITY_FRAMEWORK_H */\n#ifdef __cplusplus\n}\n#endif\n#endif\n"
  },
  {
    "path": "test/unit/unity/unity_internals.h",
    "content": "/* ==========================================\n    Unity Project - A Test Framework for C\n    Copyright (c) 2007-14 Mike Karlesky, Mark VanderVoord, Greg Williams\n    [Released under MIT License. Please refer to license.txt for details]\n========================================== */\n\n#ifndef UNITY_INTERNALS_H\n#define UNITY_INTERNALS_H\n\n#ifdef UNITY_INCLUDE_CONFIG_H\n#include \"unity_config.h\"\n#endif\n\n#include <setjmp.h>\n\n#ifndef UNITY_EXCLUDE_MATH_H\n#include <math.h>\n#endif\n\n/* Unity Attempts to Auto-Detect Integer Types\n * Attempt 1: UINT_MAX, ULONG_MAX in <limits.h>, or default to 32 bits\n * Attempt 2: UINTPTR_MAX in <stdint.h>, or default to same size as long\n * The user may override any of these derived constants:\n * UNITY_INT_WIDTH, UNITY_LONG_WIDTH, UNITY_POINTER_WIDTH */\n#ifndef UNITY_EXCLUDE_STDINT_H\n#include <stdint.h>\n#endif\n\n#ifndef UNITY_EXCLUDE_LIMITS_H\n#include <limits.h>\n#endif\n\n/*-------------------------------------------------------\n * Guess Widths If Not Specified\n *-------------------------------------------------------*/\n\n/* Determine the size of an int, if not already specified.\n * We cannot use sizeof(int), because it is not yet defined\n * at this stage in the translation of the C program.\n * Therefore, infer it from UINT_MAX if possible. */\n#ifndef UNITY_INT_WIDTH\n  #ifdef UINT_MAX\n    #if (UINT_MAX == 0xFFFF)\n      #define UNITY_INT_WIDTH (16)\n    #elif (UINT_MAX == 0xFFFFFFFF)\n      #define UNITY_INT_WIDTH (32)\n    #elif (UINT_MAX == 0xFFFFFFFFFFFFFFFF)\n      #define UNITY_INT_WIDTH (64)\n    #endif\n  #else /* Set to default */\n    #define UNITY_INT_WIDTH (32)\n  #endif /* UINT_MAX */\n#endif\n\n/* Determine the size of a long, if not already specified. */\n#ifndef UNITY_LONG_WIDTH\n  #ifdef ULONG_MAX\n    #if (ULONG_MAX == 0xFFFF)\n      #define UNITY_LONG_WIDTH (16)\n    #elif (ULONG_MAX == 0xFFFFFFFF)\n      #define UNITY_LONG_WIDTH (32)\n    #elif (ULONG_MAX == 0xFFFFFFFFFFFFFFFF)\n      #define UNITY_LONG_WIDTH (64)\n    #endif\n  #else /* Set to default */\n    #define UNITY_LONG_WIDTH (32)\n  #endif /* ULONG_MAX */\n#endif\n\n/* Determine the size of a pointer, if not already specified. */\n#ifndef UNITY_POINTER_WIDTH\n  #ifdef UINTPTR_MAX\n    #if (UINTPTR_MAX <= 0xFFFF)\n      #define UNITY_POINTER_WIDTH (16)\n    #elif (UINTPTR_MAX <= 0xFFFFFFFF)\n      #define UNITY_POINTER_WIDTH (32)\n    #elif (UINTPTR_MAX <= 0xFFFFFFFFFFFFFFFF)\n      #define UNITY_POINTER_WIDTH (64)\n    #endif\n  #else /* Set to default */\n    #define UNITY_POINTER_WIDTH UNITY_LONG_WIDTH\n  #endif /* UINTPTR_MAX */\n#endif\n\n/*-------------------------------------------------------\n * Int Support (Define types based on detected sizes)\n *-------------------------------------------------------*/\n\n#if (UNITY_INT_WIDTH == 32)\n    typedef unsigned char   _UU8;\n    typedef unsigned short  _UU16;\n    typedef unsigned int    _UU32;\n    typedef signed char     _US8;\n    typedef signed short    _US16;\n    typedef signed int      _US32;\n#elif (UNITY_INT_WIDTH == 16)\n    typedef unsigned char   _UU8;\n    typedef unsigned int    _UU16;\n    typedef unsigned long   _UU32;\n    typedef signed char     _US8;\n    typedef signed int      _US16;\n    typedef signed long     _US32;\n#else\n    #error Invalid UNITY_INT_WIDTH specified! (16 or 32 are supported)\n#endif\n\n/*-------------------------------------------------------\n * 64-bit Support\n *-------------------------------------------------------*/\n\n#ifndef UNITY_SUPPORT_64\n  #if UNITY_LONG_WIDTH == 64 || UNITY_POINTER_WIDTH == 64\n    #define UNITY_SUPPORT_64\n  #endif\n#endif\n\n#ifndef UNITY_SUPPORT_64\n    /* No 64-bit Support */\n    typedef _UU32 _U_UINT;\n    typedef _US32 _U_SINT;\n#else\n\n    /* 64-bit Support */\n  #if (UNITY_LONG_WIDTH == 32)\n    typedef unsigned long long _UU64;\n    typedef signed long long   _US64;\n  #elif (UNITY_LONG_WIDTH == 64)\n    typedef unsigned long      _UU64;\n    typedef signed long        _US64;\n  #else\n    #error Invalid UNITY_LONG_WIDTH specified! (32 or 64 are supported)\n  #endif\n    typedef _UU64 _U_UINT;\n    typedef _US64 _U_SINT;\n\n#endif\n\n/*-------------------------------------------------------\n * Pointer Support\n *-------------------------------------------------------*/\n\n#if (UNITY_POINTER_WIDTH == 32)\n    typedef _UU32 _UP;\n#define UNITY_DISPLAY_STYLE_POINTER UNITY_DISPLAY_STYLE_HEX32\n#elif (UNITY_POINTER_WIDTH == 64)\n    typedef _UU64 _UP;\n#define UNITY_DISPLAY_STYLE_POINTER UNITY_DISPLAY_STYLE_HEX64\n#elif (UNITY_POINTER_WIDTH == 16)\n    typedef _UU16 _UP;\n#define UNITY_DISPLAY_STYLE_POINTER UNITY_DISPLAY_STYLE_HEX16\n#else\n    #error Invalid UNITY_POINTER_WIDTH specified! (16, 32 or 64 are supported)\n#endif\n\n#ifndef UNITY_PTR_ATTRIBUTE\n#define UNITY_PTR_ATTRIBUTE\n#endif\n\n#ifndef UNITY_INTERNAL_PTR\n#define UNITY_INTERNAL_PTR UNITY_PTR_ATTRIBUTE const void*\n/* #define UNITY_INTERNAL_PTR UNITY_PTR_ATTRIBUTE const _UU8* */\n#endif\n\n/*-------------------------------------------------------\n * Float Support\n *-------------------------------------------------------*/\n\n#ifdef UNITY_EXCLUDE_FLOAT\n\n/* No Floating Point Support */\n#undef UNITY_INCLUDE_FLOAT\n#undef UNITY_FLOAT_PRECISION\n#undef UNITY_FLOAT_TYPE\n#undef UNITY_FLOAT_VERBOSE\n\n#else\n\n#ifndef UNITY_INCLUDE_FLOAT\n#define UNITY_INCLUDE_FLOAT\n#endif\n\n/* Floating Point Support */\n#ifndef UNITY_FLOAT_PRECISION\n#define UNITY_FLOAT_PRECISION (0.00001f)\n#endif\n#ifndef UNITY_FLOAT_TYPE\n#define UNITY_FLOAT_TYPE float\n#endif\ntypedef UNITY_FLOAT_TYPE _UF;\n\n#ifndef isinf\n/* The value of Inf - Inf is NaN */\n#define isinf(n) (isnan((n) - (n)) && !isnan(n))\n#endif\n\n#ifndef isnan\n/* NaN is the only floating point value that does NOT equal itself.\n * Therefore if n != n, then it is NaN. */\n#define isnan(n) ((n != n) ? 1 : 0)\n#endif\n\n#ifndef isneg\n#define isneg(n) ((n < 0.0f) ? 1 : 0)\n#endif\n\n#ifndef ispos\n#define ispos(n) ((n > 0.0f) ? 1 : 0)\n#endif\n\n#endif\n\n/*-------------------------------------------------------\n * Double Float Support\n *-------------------------------------------------------*/\n\n/* unlike FLOAT, we DON'T include by default */\n#ifndef UNITY_EXCLUDE_DOUBLE\n  #ifndef UNITY_INCLUDE_DOUBLE\n  #define UNITY_EXCLUDE_DOUBLE\n  #endif\n#endif\n\n#ifdef UNITY_EXCLUDE_DOUBLE\n\n  /* No Floating Point Support */\n  #undef UNITY_DOUBLE_PRECISION\n  #undef UNITY_DOUBLE_TYPE\n  #undef UNITY_DOUBLE_VERBOSE\n\n  #ifdef UNITY_INCLUDE_DOUBLE\n    #undef UNITY_INCLUDE_DOUBLE\n  #endif\n\n  #ifdef UNITY_FLOAT_VERBOSE\n    typedef _UF _UD;\n    /* For parameter in UnityPrintFloat, double promotion required */\n  #endif\n\n#else\n\n  /* Double Floating Point Support */\n  #ifndef UNITY_DOUBLE_PRECISION\n  #define UNITY_DOUBLE_PRECISION (1e-12f)\n  #endif\n\n  #ifndef UNITY_DOUBLE_TYPE\n  #define UNITY_DOUBLE_TYPE double\n  #endif\n  typedef UNITY_DOUBLE_TYPE _UD;\n\n#endif\n\n#ifdef UNITY_DOUBLE_VERBOSE\n#ifndef UNITY_FLOAT_VERBOSE\n#define UNITY_FLOAT_VERBOSE\n#endif\n#endif\n\n/*-------------------------------------------------------\n * Output Method: stdout (DEFAULT)\n *-------------------------------------------------------*/\n#ifndef UNITY_OUTPUT_CHAR\n/* Default to using putchar, which is defined in stdio.h */\n#include <stdio.h>\n#define UNITY_OUTPUT_CHAR(a) (void)putchar(a)\n#else\n  /* If defined as something else, make sure we declare it here so it's ready for use */\n  #ifndef UNITY_OMIT_OUTPUT_CHAR_HEADER_DECLARATION\nextern void UNITY_OUTPUT_CHAR(int);\n  #endif\n#endif\n\n#ifndef UNITY_OUTPUT_FLUSH\n/* Default to using fflush, which is defined in stdio.h */\n#include <stdio.h>\n#define UNITY_OUTPUT_FLUSH (void)fflush(stdout)\n#else\n  /* If defined as something else, make sure we declare it here so it's ready for use */\n  #ifndef UNITY_OMIT_OUTPUT_FLUSH_HEADER_DECLARATION\nextern void UNITY_OUTPUT_FLUSH(void);\n  #endif\n#endif\n\n#ifndef UNITY_OUTPUT_FLUSH\n#define UNITY_FLUSH_CALL()\n#else\n#define UNITY_FLUSH_CALL() UNITY_OUTPUT_FLUSH\n#endif\n\n#ifndef UNITY_PRINT_EOL\n#define UNITY_PRINT_EOL()    UNITY_OUTPUT_CHAR('\\n')\n#endif\n\n#ifndef UNITY_OUTPUT_START\n#define UNITY_OUTPUT_START()\n#endif\n\n#ifndef UNITY_OUTPUT_COMPLETE\n#define UNITY_OUTPUT_COMPLETE()\n#endif\n\n/*-------------------------------------------------------\n * Footprint\n *-------------------------------------------------------*/\n\n#ifndef UNITY_LINE_TYPE\n#define UNITY_LINE_TYPE _U_UINT\n#endif\n\n#ifndef UNITY_COUNTER_TYPE\n#define UNITY_COUNTER_TYPE _U_UINT\n#endif\n\n/*-------------------------------------------------------\n * Language Features Available\n *-------------------------------------------------------*/\n#if !defined(UNITY_WEAK_ATTRIBUTE) && !defined(UNITY_WEAK_PRAGMA)\n#   ifdef __GNUC__ /* includes clang */\n#       if !(defined(__WIN32__) && defined(__clang__)) && !defined(__TMS470__)\n#           define UNITY_WEAK_ATTRIBUTE __attribute__((weak))\n#       endif\n#   endif\n#endif\n\n#ifdef UNITY_NO_WEAK\n#   undef UNITY_WEAK_ATTRIBUTE\n#   undef UNITY_WEAK_PRAGMA\n#endif\n\n\n/*-------------------------------------------------------\n * Internal Structs Needed\n *-------------------------------------------------------*/\n\ntypedef void (*UnityTestFunction)(void);\n\n#define UNITY_DISPLAY_RANGE_INT  (0x10)\n#define UNITY_DISPLAY_RANGE_UINT (0x20)\n#define UNITY_DISPLAY_RANGE_HEX  (0x40)\n#define UNITY_DISPLAY_RANGE_AUTO (0x80)\n\ntypedef enum\n{\nUNITY_DISPLAY_STYLE_INT = sizeof(int)+ UNITY_DISPLAY_RANGE_INT + UNITY_DISPLAY_RANGE_AUTO,\n    UNITY_DISPLAY_STYLE_INT8     = 1 + UNITY_DISPLAY_RANGE_INT,\n    UNITY_DISPLAY_STYLE_INT16    = 2 + UNITY_DISPLAY_RANGE_INT,\n    UNITY_DISPLAY_STYLE_INT32    = 4 + UNITY_DISPLAY_RANGE_INT,\n#ifdef UNITY_SUPPORT_64\n    UNITY_DISPLAY_STYLE_INT64    = 8 + UNITY_DISPLAY_RANGE_INT,\n#endif\n\nUNITY_DISPLAY_STYLE_UINT = sizeof(unsigned) + UNITY_DISPLAY_RANGE_UINT + UNITY_DISPLAY_RANGE_AUTO,\n    UNITY_DISPLAY_STYLE_UINT8    = 1 + UNITY_DISPLAY_RANGE_UINT,\n    UNITY_DISPLAY_STYLE_UINT16   = 2 + UNITY_DISPLAY_RANGE_UINT,\n    UNITY_DISPLAY_STYLE_UINT32   = 4 + UNITY_DISPLAY_RANGE_UINT,\n#ifdef UNITY_SUPPORT_64\n    UNITY_DISPLAY_STYLE_UINT64   = 8 + UNITY_DISPLAY_RANGE_UINT,\n#endif\n\n    UNITY_DISPLAY_STYLE_HEX8     = 1 + UNITY_DISPLAY_RANGE_HEX,\n    UNITY_DISPLAY_STYLE_HEX16    = 2 + UNITY_DISPLAY_RANGE_HEX,\n    UNITY_DISPLAY_STYLE_HEX32    = 4 + UNITY_DISPLAY_RANGE_HEX,\n#ifdef UNITY_SUPPORT_64\n    UNITY_DISPLAY_STYLE_HEX64    = 8 + UNITY_DISPLAY_RANGE_HEX,\n#endif\n\n    UNITY_DISPLAY_STYLE_UNKNOWN\n} UNITY_DISPLAY_STYLE_T;\n\n#ifndef UNITY_EXCLUDE_FLOAT\ntypedef enum _UNITY_FLOAT_TRAIT_T\n{\n    UNITY_FLOAT_IS_NOT_INF       = 0,\n    UNITY_FLOAT_IS_INF,\n    UNITY_FLOAT_IS_NOT_NEG_INF,\n    UNITY_FLOAT_IS_NEG_INF,\n    UNITY_FLOAT_IS_NOT_NAN,\n    UNITY_FLOAT_IS_NAN,\n    UNITY_FLOAT_IS_NOT_DET,\n    UNITY_FLOAT_IS_DET,\n    UNITY_FLOAT_INVALID_TRAIT\n} UNITY_FLOAT_TRAIT_T;\n#endif\n\nstruct _Unity\n{\n    const char* TestFile;\n    const char* CurrentTestName;\n#ifndef UNITY_EXCLUDE_DETAILS\n    const char* CurrentDetail1;\n    const char* CurrentDetail2;\n#endif\n    UNITY_LINE_TYPE CurrentTestLineNumber;\n    UNITY_COUNTER_TYPE NumberOfTests;\n    UNITY_COUNTER_TYPE TestFailures;\n    UNITY_COUNTER_TYPE TestIgnores;\n    UNITY_COUNTER_TYPE CurrentTestFailed;\n    UNITY_COUNTER_TYPE CurrentTestIgnored;\n    jmp_buf AbortFrame;\n};\n\nextern struct _Unity Unity;\n\n/*-------------------------------------------------------\n * Test Suite Management\n *-------------------------------------------------------*/\n\nvoid UnityBegin(const char* filename);\nint  UnityEnd(void);\nvoid UnityConcludeTest(void);\nvoid UnityDefaultTestRun(UnityTestFunction Func, const char* FuncName, const int FuncLineNum);\n\n/*-------------------------------------------------------\n * Details Support\n *-------------------------------------------------------*/\n\n#ifdef UNITY_EXCLUDE_DETAILS\n#define UNITY_CLR_DETAILS()\n#define UNITY_SET_DETAIL(d1)\n#define UNITY_SET_DETAILS(d1,d2)\n#else\n#define UNITY_CLR_DETAILS()      { Unity.CurrentDetail1 = 0;   Unity.CurrentDetail2 = 0;  }\n#define UNITY_SET_DETAIL(d1)     { Unity.CurrentDetail1 = d1;  Unity.CurrentDetail2 = 0;  }\n#define UNITY_SET_DETAILS(d1,d2) { Unity.CurrentDetail1 = d1;  Unity.CurrentDetail2 = d2; }\n\n#ifndef UNITY_DETAIL1_NAME\n#define UNITY_DETAIL1_NAME \"Function\"\n#endif\n\n#ifndef UNITY_DETAIL2_NAME\n#define UNITY_DETAIL2_NAME \"Argument\"\n#endif\n#endif\n\n/*-------------------------------------------------------\n * Test Output\n *-------------------------------------------------------*/\n\nvoid UnityPrint(const char* string);\nvoid UnityPrintMask(const _U_UINT mask, const _U_UINT number);\nvoid UnityPrintNumberByStyle(const _U_SINT number, const UNITY_DISPLAY_STYLE_T style);\nvoid UnityPrintNumber(const _U_SINT number);\nvoid UnityPrintNumberUnsigned(const _U_UINT number);\nvoid UnityPrintNumberHex(const _U_UINT number, const char nibbles);\n\n#ifdef UNITY_FLOAT_VERBOSE\nvoid UnityPrintFloat(const _UD number);\n#endif\n\n/*-------------------------------------------------------\n * Test Assertion Functions\n *-------------------------------------------------------\n *  Use the macros below this section instead of calling\n *  these directly. The macros have a consistent naming\n *  convention and will pull in file and line information\n *  for you. */\n\nvoid UnityAssertEqualNumber(const _U_SINT expected,\n                            const _U_SINT actual,\n                            const char* msg,\n                            const UNITY_LINE_TYPE lineNumber,\n                            const UNITY_DISPLAY_STYLE_T style);\n\nvoid UnityAssertEqualIntArray(UNITY_INTERNAL_PTR expected,\n                              UNITY_INTERNAL_PTR actual,\n                              const _UU32 num_elements,\n                              const char* msg,\n                              const UNITY_LINE_TYPE lineNumber,\n                              const UNITY_DISPLAY_STYLE_T style);\n\nvoid UnityAssertBits(const _U_SINT mask,\n                     const _U_SINT expected,\n                     const _U_SINT actual,\n                     const char* msg,\n                     const UNITY_LINE_TYPE lineNumber);\n\nvoid UnityAssertEqualString(const char* expected,\n                            const char* actual,\n                            const char* msg,\n                            const UNITY_LINE_TYPE lineNumber);\n\nvoid UnityAssertEqualStringLen(const char* expected,\n                            const char* actual,\n                            const _UU32 length,\n                            const char* msg,\n                            const UNITY_LINE_TYPE lineNumber);\n\nvoid UnityAssertEqualStringArray( const char** expected,\n                                  const char** actual,\n                                  const _UU32 num_elements,\n                                  const char* msg,\n                                  const UNITY_LINE_TYPE lineNumber);\n\nvoid UnityAssertEqualMemory( UNITY_INTERNAL_PTR expected,\n                             UNITY_INTERNAL_PTR actual,\n                             const _UU32 length,\n                             const _UU32 num_elements,\n                             const char* msg,\n                             const UNITY_LINE_TYPE lineNumber);\n\nvoid UnityAssertNumbersWithin(const _U_UINT delta,\n                              const _U_SINT expected,\n                              const _U_SINT actual,\n                              const char* msg,\n                              const UNITY_LINE_TYPE lineNumber,\n                              const UNITY_DISPLAY_STYLE_T style);\n\nvoid UnityFail(const char* message, const UNITY_LINE_TYPE line);\n\nvoid UnityIgnore(const char* message, const UNITY_LINE_TYPE line);\n\n#ifndef UNITY_EXCLUDE_FLOAT\nvoid UnityAssertFloatsWithin(const _UF delta,\n                             const _UF expected,\n                             const _UF actual,\n                             const char* msg,\n                             const UNITY_LINE_TYPE lineNumber);\n\nvoid UnityAssertEqualFloatArray(UNITY_PTR_ATTRIBUTE const _UF* expected,\n                                UNITY_PTR_ATTRIBUTE const _UF* actual,\n                                const _UU32 num_elements,\n                                const char* msg,\n                                const UNITY_LINE_TYPE lineNumber);\n\nvoid UnityAssertFloatSpecial(const _UF actual,\n                             const char* msg,\n                             const UNITY_LINE_TYPE lineNumber,\n                             const UNITY_FLOAT_TRAIT_T style);\n#endif\n\n#ifndef UNITY_EXCLUDE_DOUBLE\nvoid UnityAssertDoublesWithin(const _UD delta,\n                              const _UD expected,\n                              const _UD actual,\n                              const char* msg,\n                              const UNITY_LINE_TYPE lineNumber);\n\nvoid UnityAssertEqualDoubleArray(UNITY_PTR_ATTRIBUTE const _UD* expected,\n                                 UNITY_PTR_ATTRIBUTE const _UD* actual,\n                                 const _UU32 num_elements,\n                                 const char* msg,\n                                 const UNITY_LINE_TYPE lineNumber);\n\nvoid UnityAssertDoubleSpecial(const _UD actual,\n                              const char* msg,\n                              const UNITY_LINE_TYPE lineNumber,\n                              const UNITY_FLOAT_TRAIT_T style);\n#endif\n\n/*-------------------------------------------------------\n * Error Strings We Might Need\n *-------------------------------------------------------*/\n\nextern const char UnityStrErrFloat[];\nextern const char UnityStrErrDouble[];\nextern const char UnityStrErr64[];\n\n/*-------------------------------------------------------\n * Test Running Macros\n *-------------------------------------------------------*/\n\n#define TEST_PROTECT() (setjmp(Unity.AbortFrame) == 0)\n\n#define TEST_ABORT() {longjmp(Unity.AbortFrame, 1);}\n\n/* This tricky series of macros gives us an optional line argument to treat it as RUN_TEST(func, num=__LINE__) */\n#ifndef RUN_TEST\n#ifdef __STDC_VERSION__\n#if __STDC_VERSION__ >= 199901L\n#define RUN_TEST(...) UnityDefaultTestRun(RUN_TEST_FIRST(__VA_ARGS__), RUN_TEST_SECOND(__VA_ARGS__))\n#define RUN_TEST_FIRST(...) RUN_TEST_FIRST_HELPER(__VA_ARGS__, throwaway)\n#define RUN_TEST_FIRST_HELPER(first, ...) (first), #first\n#define RUN_TEST_SECOND(...) RUN_TEST_SECOND_HELPER(__VA_ARGS__, __LINE__, throwaway)\n#define RUN_TEST_SECOND_HELPER(first, second, ...) (second)\n#endif\n#endif\n#endif\n\n/* If we can't do the tricky version, we'll just have to require them to always include the line number */\n#ifndef RUN_TEST\n#ifdef CMOCK\n#define RUN_TEST(func, num) UnityDefaultTestRun(func, #func, num)\n#else\n#define RUN_TEST(func) UnityDefaultTestRun(func, #func, __LINE__)\n#endif\n#endif\n\n#define TEST_LINE_NUM (Unity.CurrentTestLineNumber)\n#define TEST_IS_IGNORED (Unity.CurrentTestIgnored)\n#define UNITY_NEW_TEST(a) \\\n    Unity.CurrentTestName = (a); \\\n    Unity.CurrentTestLineNumber = (UNITY_LINE_TYPE)(__LINE__); \\\n    Unity.NumberOfTests++;\n\n#ifndef UNITY_BEGIN\n#define UNITY_BEGIN() UnityBegin(__FILE__)\n#endif\n\n#ifndef UNITY_END\n#define UNITY_END() UnityEnd()\n#endif\n\n#define UNITY_UNUSED(x) (void)(sizeof(x))\n\n/*-----------------------------------------------\n * Command Line Argument Support\n *-----------------------------------------------*/\n\n#ifdef UNITY_USE_COMMAND_LINE_ARGS\nint UnityParseOptions(int argc, char** argv);\nint UnityTestMatches(void);\n#endif\n\n/*-------------------------------------------------------\n * Basic Fail and Ignore\n *-------------------------------------------------------*/\n\n#define UNITY_TEST_FAIL(line, message)   UnityFail(   (message), (UNITY_LINE_TYPE)(line))\n#define UNITY_TEST_IGNORE(line, message) UnityIgnore( (message), (UNITY_LINE_TYPE)(line))\n\n/*-------------------------------------------------------\n * Test Asserts\n *-------------------------------------------------------*/\n\n#define UNITY_TEST_ASSERT(condition, line, message)                                              if (condition) {} else {UNITY_TEST_FAIL((UNITY_LINE_TYPE)(line), (message));}\n#define UNITY_TEST_ASSERT_NULL(pointer, line, message)                                           UNITY_TEST_ASSERT(((pointer) == NULL),  (UNITY_LINE_TYPE)(line), (message))\n#define UNITY_TEST_ASSERT_NOT_NULL(pointer, line, message)                                       UNITY_TEST_ASSERT(((pointer) != NULL),  (UNITY_LINE_TYPE)(line), (message))\n\n#define UNITY_TEST_ASSERT_EQUAL_INT(expected, actual, line, message)                             UnityAssertEqualNumber((_U_SINT)(expected), (_U_SINT)(actual), (message), (UNITY_LINE_TYPE)(line), UNITY_DISPLAY_STYLE_INT)\n#define UNITY_TEST_ASSERT_EQUAL_INT8(expected, actual, line, message)                            UnityAssertEqualNumber((_U_SINT)(_US8 )(expected), (_U_SINT)(_US8 )(actual), (message), (UNITY_LINE_TYPE)(line), UNITY_DISPLAY_STYLE_INT8)\n#define UNITY_TEST_ASSERT_EQUAL_INT16(expected, actual, line, message)                           UnityAssertEqualNumber((_U_SINT)(_US16)(expected), (_U_SINT)(_US16)(actual), (message), (UNITY_LINE_TYPE)(line), UNITY_DISPLAY_STYLE_INT16)\n#define UNITY_TEST_ASSERT_EQUAL_INT32(expected, actual, line, message)                           UnityAssertEqualNumber((_U_SINT)(_US32)(expected), (_U_SINT)(_US32)(actual), (message), (UNITY_LINE_TYPE)(line), UNITY_DISPLAY_STYLE_INT32)\n#define UNITY_TEST_ASSERT_EQUAL_UINT(expected, actual, line, message)                            UnityAssertEqualNumber((_U_SINT)(expected), (_U_SINT)(actual), (message), (UNITY_LINE_TYPE)(line), UNITY_DISPLAY_STYLE_UINT)\n#define UNITY_TEST_ASSERT_EQUAL_UINT8(expected, actual, line, message)                           UnityAssertEqualNumber((_U_SINT)(_UU8 )(expected), (_U_SINT)(_UU8 )(actual), (message), (UNITY_LINE_TYPE)(line), UNITY_DISPLAY_STYLE_UINT8)\n#define UNITY_TEST_ASSERT_EQUAL_UINT16(expected, actual, line, message)                          UnityAssertEqualNumber((_U_SINT)(_UU16)(expected), (_U_SINT)(_UU16)(actual), (message), (UNITY_LINE_TYPE)(line), UNITY_DISPLAY_STYLE_UINT16)\n#define UNITY_TEST_ASSERT_EQUAL_UINT32(expected, actual, line, message)                          UnityAssertEqualNumber((_U_SINT)(_UU32)(expected), (_U_SINT)(_UU32)(actual), (message), (UNITY_LINE_TYPE)(line), UNITY_DISPLAY_STYLE_UINT32)\n#define UNITY_TEST_ASSERT_EQUAL_HEX8(expected, actual, line, message)                            UnityAssertEqualNumber((_U_SINT)(_US8 )(expected), (_U_SINT)(_US8 )(actual), (message), (UNITY_LINE_TYPE)(line), UNITY_DISPLAY_STYLE_HEX8)\n#define UNITY_TEST_ASSERT_EQUAL_HEX16(expected, actual, line, message)                           UnityAssertEqualNumber((_U_SINT)(_US16)(expected), (_U_SINT)(_US16)(actual), (message), (UNITY_LINE_TYPE)(line), UNITY_DISPLAY_STYLE_HEX16)\n#define UNITY_TEST_ASSERT_EQUAL_HEX32(expected, actual, line, message)                           UnityAssertEqualNumber((_U_SINT)(_US32)(expected), (_U_SINT)(_US32)(actual), (message), (UNITY_LINE_TYPE)(line), UNITY_DISPLAY_STYLE_HEX32)\n#define UNITY_TEST_ASSERT_BITS(mask, expected, actual, line, message)                            UnityAssertBits((_U_SINT)(mask), (_U_SINT)(expected), (_U_SINT)(actual), (message), (UNITY_LINE_TYPE)(line))\n\n#define UNITY_TEST_ASSERT_INT_WITHIN(delta, expected, actual, line, message)                     UnityAssertNumbersWithin((delta), (_U_SINT)(expected), (_U_SINT)(actual), (message), (UNITY_LINE_TYPE)(line), UNITY_DISPLAY_STYLE_INT)\n#define UNITY_TEST_ASSERT_INT8_WITHIN(delta, expected, actual, line, message)                    UnityAssertNumbersWithin((_UU8 )(delta), (_U_SINT)(_US8 )(expected), (_U_SINT)(_US8 )(actual), (message), (UNITY_LINE_TYPE)(line), UNITY_DISPLAY_STYLE_INT8)\n#define UNITY_TEST_ASSERT_INT16_WITHIN(delta, expected, actual, line, message)                   UnityAssertNumbersWithin((_UU16)(delta), (_U_SINT)(_US16)(expected), (_U_SINT)(_US16)(actual), (message), (UNITY_LINE_TYPE)(line), UNITY_DISPLAY_STYLE_INT16)\n#define UNITY_TEST_ASSERT_INT32_WITHIN(delta, expected, actual, line, message)                   UnityAssertNumbersWithin((_UU32)(delta), (_U_SINT)(_US32)(expected), (_U_SINT)(_US32)(actual), (message), (UNITY_LINE_TYPE)(line), UNITY_DISPLAY_STYLE_INT32)\n#define UNITY_TEST_ASSERT_UINT_WITHIN(delta, expected, actual, line, message)                    UnityAssertNumbersWithin((delta), (_U_SINT)(expected), (_U_SINT)(actual), (message), (UNITY_LINE_TYPE)(line), UNITY_DISPLAY_STYLE_UINT)\n#define UNITY_TEST_ASSERT_UINT8_WITHIN(delta, expected, actual, line, message)                   UnityAssertNumbersWithin((_UU8 )(delta), (_U_SINT)(_U_UINT)(_UU8 )(expected), (_U_SINT)(_U_UINT)(_UU8 )(actual), (message), (UNITY_LINE_TYPE)(line), UNITY_DISPLAY_STYLE_UINT8)\n#define UNITY_TEST_ASSERT_UINT16_WITHIN(delta, expected, actual, line, message)                  UnityAssertNumbersWithin((_UU16)(delta), (_U_SINT)(_U_UINT)(_UU16)(expected), (_U_SINT)(_U_UINT)(_UU16)(actual), (message), (UNITY_LINE_TYPE)(line), UNITY_DISPLAY_STYLE_UINT16)\n#define UNITY_TEST_ASSERT_UINT32_WITHIN(delta, expected, actual, line, message)                  UnityAssertNumbersWithin((_UU32)(delta), (_U_SINT)(_U_UINT)(_UU32)(expected), (_U_SINT)(_U_UINT)(_UU32)(actual), (message), (UNITY_LINE_TYPE)(line), UNITY_DISPLAY_STYLE_UINT32)\n#define UNITY_TEST_ASSERT_HEX8_WITHIN(delta, expected, actual, line, message)                    UnityAssertNumbersWithin((_UU8 )(delta), (_U_SINT)(_U_UINT)(_UU8 )(expected), (_U_SINT)(_U_UINT)(_UU8 )(actual), (message), (UNITY_LINE_TYPE)(line), UNITY_DISPLAY_STYLE_HEX8)\n#define UNITY_TEST_ASSERT_HEX16_WITHIN(delta, expected, actual, line, message)                   UnityAssertNumbersWithin((_UU16)(delta), (_U_SINT)(_U_UINT)(_UU16)(expected), (_U_SINT)(_U_UINT)(_UU16)(actual), (message), (UNITY_LINE_TYPE)(line), UNITY_DISPLAY_STYLE_HEX16)\n#define UNITY_TEST_ASSERT_HEX32_WITHIN(delta, expected, actual, line, message)                   UnityAssertNumbersWithin((_UU32)(delta), (_U_SINT)(_U_UINT)(_UU32)(expected), (_U_SINT)(_U_UINT)(_UU32)(actual), (message), (UNITY_LINE_TYPE)(line), UNITY_DISPLAY_STYLE_HEX32)\n\n#define UNITY_TEST_ASSERT_EQUAL_PTR(expected, actual, line, message)                             UnityAssertEqualNumber((_U_SINT)(_UP)(expected), (_U_SINT)(_UP)(actual), (message), (UNITY_LINE_TYPE)(line), UNITY_DISPLAY_STYLE_POINTER)\n#define UNITY_TEST_ASSERT_EQUAL_STRING(expected, actual, line, message)                          UnityAssertEqualString((const char*)(expected), (const char*)(actual), (message), (UNITY_LINE_TYPE)(line))\n#define UNITY_TEST_ASSERT_EQUAL_STRING_LEN(expected, actual, len, line, message)                 UnityAssertEqualStringLen((const char*)(expected), (const char*)(actual), (_UU32)(len), (message), (UNITY_LINE_TYPE)(line))\n#define UNITY_TEST_ASSERT_EQUAL_MEMORY(expected, actual, len, line, message)                     UnityAssertEqualMemory((UNITY_INTERNAL_PTR)(expected), (UNITY_INTERNAL_PTR)(actual), (_UU32)(len), 1, (message), (UNITY_LINE_TYPE)(line))\n\n#define UNITY_TEST_ASSERT_EQUAL_INT_ARRAY(expected, actual, num_elements, line, message)         UnityAssertEqualIntArray((UNITY_INTERNAL_PTR)(expected), (UNITY_INTERNAL_PTR)(actual), (_UU32)(num_elements), (message), (UNITY_LINE_TYPE)(line), UNITY_DISPLAY_STYLE_INT)\n#define UNITY_TEST_ASSERT_EQUAL_INT8_ARRAY(expected, actual, num_elements, line, message)        UnityAssertEqualIntArray((UNITY_INTERNAL_PTR)(expected), (UNITY_INTERNAL_PTR)(actual), (_UU32)(num_elements), (message), (UNITY_LINE_TYPE)(line), UNITY_DISPLAY_STYLE_INT8)\n#define UNITY_TEST_ASSERT_EQUAL_INT16_ARRAY(expected, actual, num_elements, line, message)       UnityAssertEqualIntArray((UNITY_INTERNAL_PTR)(expected), (UNITY_INTERNAL_PTR)(actual), (_UU32)(num_elements), (message), (UNITY_LINE_TYPE)(line), UNITY_DISPLAY_STYLE_INT16)\n#define UNITY_TEST_ASSERT_EQUAL_INT32_ARRAY(expected, actual, num_elements, line, message)       UnityAssertEqualIntArray((UNITY_INTERNAL_PTR)(expected), (UNITY_INTERNAL_PTR)(actual), (_UU32)(num_elements), (message), (UNITY_LINE_TYPE)(line), UNITY_DISPLAY_STYLE_INT32)\n#define UNITY_TEST_ASSERT_EQUAL_UINT_ARRAY(expected, actual, num_elements, line, message)        UnityAssertEqualIntArray((UNITY_INTERNAL_PTR)(expected), (UNITY_INTERNAL_PTR)(actual), (_UU32)(num_elements), (message), (UNITY_LINE_TYPE)(line), UNITY_DISPLAY_STYLE_UINT)\n#define UNITY_TEST_ASSERT_EQUAL_UINT8_ARRAY(expected, actual, num_elements, line, message)       UnityAssertEqualIntArray((UNITY_INTERNAL_PTR)(expected), (UNITY_INTERNAL_PTR)(actual), (_UU32)(num_elements), (message), (UNITY_LINE_TYPE)(line), UNITY_DISPLAY_STYLE_UINT8)\n#define UNITY_TEST_ASSERT_EQUAL_UINT16_ARRAY(expected, actual, num_elements, line, message)      UnityAssertEqualIntArray((UNITY_INTERNAL_PTR)(expected), (UNITY_INTERNAL_PTR)(actual), (_UU32)(num_elements), (message), (UNITY_LINE_TYPE)(line), UNITY_DISPLAY_STYLE_UINT16)\n#define UNITY_TEST_ASSERT_EQUAL_UINT32_ARRAY(expected, actual, num_elements, line, message)      UnityAssertEqualIntArray((UNITY_INTERNAL_PTR)(expected), (UNITY_INTERNAL_PTR)(actual), (_UU32)(num_elements), (message), (UNITY_LINE_TYPE)(line), UNITY_DISPLAY_STYLE_UINT32)\n#define UNITY_TEST_ASSERT_EQUAL_HEX8_ARRAY(expected, actual, num_elements, line, message)        UnityAssertEqualIntArray((UNITY_INTERNAL_PTR)(expected), (UNITY_INTERNAL_PTR)(actual), (_UU32)(num_elements), (message), (UNITY_LINE_TYPE)(line), UNITY_DISPLAY_STYLE_HEX8)\n#define UNITY_TEST_ASSERT_EQUAL_HEX16_ARRAY(expected, actual, num_elements, line, message)       UnityAssertEqualIntArray((UNITY_INTERNAL_PTR)(expected), (UNITY_INTERNAL_PTR)(actual), (_UU32)(num_elements), (message), (UNITY_LINE_TYPE)(line), UNITY_DISPLAY_STYLE_HEX16)\n#define UNITY_TEST_ASSERT_EQUAL_HEX32_ARRAY(expected, actual, num_elements, line, message)       UnityAssertEqualIntArray((UNITY_INTERNAL_PTR)(expected), (UNITY_INTERNAL_PTR)(actual), (_UU32)(num_elements), (message), (UNITY_LINE_TYPE)(line), UNITY_DISPLAY_STYLE_HEX32)\n#define UNITY_TEST_ASSERT_EQUAL_PTR_ARRAY(expected, actual, num_elements, line, message)         UnityAssertEqualIntArray((UNITY_INTERNAL_PTR)(_UP*)(expected), (UNITY_INTERNAL_PTR)(_UP*)(actual), (_UU32)(num_elements), (message), (UNITY_LINE_TYPE)(line), UNITY_DISPLAY_STYLE_POINTER)\n#define UNITY_TEST_ASSERT_EQUAL_STRING_ARRAY(expected, actual, num_elements, line, message)      UnityAssertEqualStringArray((const char**)(expected), (const char**)(actual), (_UU32)(num_elements), (message), (UNITY_LINE_TYPE)(line))\n#define UNITY_TEST_ASSERT_EQUAL_MEMORY_ARRAY(expected, actual, len, num_elements, line, message) UnityAssertEqualMemory((UNITY_INTERNAL_PTR)(expected), (UNITY_INTERNAL_PTR)(actual), (_UU32)(len), (_UU32)(num_elements), (message), (UNITY_LINE_TYPE)(line))\n\n#ifdef UNITY_SUPPORT_64\n#define UNITY_TEST_ASSERT_EQUAL_INT64(expected, actual, line, message)                           UnityAssertEqualNumber((_U_SINT)(expected), (_U_SINT)(actual), (message), (UNITY_LINE_TYPE)(line), UNITY_DISPLAY_STYLE_INT64)\n#define UNITY_TEST_ASSERT_EQUAL_UINT64(expected, actual, line, message)                          UnityAssertEqualNumber((_U_SINT)(expected), (_U_SINT)(actual), (message), (UNITY_LINE_TYPE)(line), UNITY_DISPLAY_STYLE_UINT64)\n#define UNITY_TEST_ASSERT_EQUAL_HEX64(expected, actual, line, message)                           UnityAssertEqualNumber((_U_SINT)(expected), (_U_SINT)(actual), (message), (UNITY_LINE_TYPE)(line), UNITY_DISPLAY_STYLE_HEX64)\n#define UNITY_TEST_ASSERT_EQUAL_INT64_ARRAY(expected, actual, num_elements, line, message)       UnityAssertEqualIntArray((UNITY_INTERNAL_PTR)(expected), (UNITY_INTERNAL_PTR)(actual), (_UU32)(num_elements), (message), (UNITY_LINE_TYPE)(line), UNITY_DISPLAY_STYLE_INT64)\n#define UNITY_TEST_ASSERT_EQUAL_UINT64_ARRAY(expected, actual, num_elements, line, message)      UnityAssertEqualIntArray((UNITY_INTERNAL_PTR)(expected), (UNITY_INTERNAL_PTR)(actual), (_UU32)(num_elements), (message), (UNITY_LINE_TYPE)(line), UNITY_DISPLAY_STYLE_UINT64)\n#define UNITY_TEST_ASSERT_EQUAL_HEX64_ARRAY(expected, actual, num_elements, line, message)       UnityAssertEqualIntArray((UNITY_INTERNAL_PTR)(expected), (UNITY_INTERNAL_PTR)(actual), (_UU32)(num_elements), (message), (UNITY_LINE_TYPE)(line), UNITY_DISPLAY_STYLE_HEX64)\n#define UNITY_TEST_ASSERT_INT64_WITHIN(delta, expected, actual, line, message)                   UnityAssertNumbersWithin((delta), (_U_SINT)(expected), (_U_SINT)(actual), (message), (UNITY_LINE_TYPE)(line), UNITY_DISPLAY_STYLE_INT64)\n#define UNITY_TEST_ASSERT_UINT64_WITHIN(delta, expected, actual, line, message)                  UnityAssertNumbersWithin((delta), (_U_SINT)(expected), (_U_SINT)(actual), (message), (UNITY_LINE_TYPE)(line), UNITY_DISPLAY_STYLE_UINT64)\n#define UNITY_TEST_ASSERT_HEX64_WITHIN(delta, expected, actual, line, message)                   UnityAssertNumbersWithin((delta), (_U_SINT)(expected), (_U_SINT)(actual), (message), (UNITY_LINE_TYPE)(line), UNITY_DISPLAY_STYLE_HEX64)\n#else\n#define UNITY_TEST_ASSERT_EQUAL_INT64(expected, actual, line, message)                           UNITY_TEST_FAIL((UNITY_LINE_TYPE)(line), UnityStrErr64)\n#define UNITY_TEST_ASSERT_EQUAL_UINT64(expected, actual, line, message)                          UNITY_TEST_FAIL((UNITY_LINE_TYPE)(line), UnityStrErr64)\n#define UNITY_TEST_ASSERT_EQUAL_HEX64(expected, actual, line, message)                           UNITY_TEST_FAIL((UNITY_LINE_TYPE)(line), UnityStrErr64)\n#define UNITY_TEST_ASSERT_EQUAL_INT64_ARRAY(expected, actual, num_elements, line, message)       UNITY_TEST_FAIL((UNITY_LINE_TYPE)(line), UnityStrErr64)\n#define UNITY_TEST_ASSERT_EQUAL_UINT64_ARRAY(expected, actual, num_elements, line, message)      UNITY_TEST_FAIL((UNITY_LINE_TYPE)(line), UnityStrErr64)\n#define UNITY_TEST_ASSERT_EQUAL_HEX64_ARRAY(expected, actual, num_elements, line, message)       UNITY_TEST_FAIL((UNITY_LINE_TYPE)(line), UnityStrErr64)\n#define UNITY_TEST_ASSERT_INT64_WITHIN(delta, expected, actual, line, message)                   UNITY_TEST_FAIL((UNITY_LINE_TYPE)(line), UnityStrErr64)\n#define UNITY_TEST_ASSERT_UINT64_WITHIN(delta, expected, actual, line, message)                  UNITY_TEST_FAIL((UNITY_LINE_TYPE)(line), UnityStrErr64)\n#define UNITY_TEST_ASSERT_HEX64_WITHIN(delta, expected, actual, line, message)                   UNITY_TEST_FAIL((UNITY_LINE_TYPE)(line), UnityStrErr64)\n#endif\n\n#ifdef UNITY_EXCLUDE_FLOAT\n#define UNITY_TEST_ASSERT_FLOAT_WITHIN(delta, expected, actual, line, message)                   UNITY_TEST_FAIL((UNITY_LINE_TYPE)(line), UnityStrErrFloat)\n#define UNITY_TEST_ASSERT_EQUAL_FLOAT(expected, actual, line, message)                           UNITY_TEST_FAIL((UNITY_LINE_TYPE)(line), UnityStrErrFloat)\n#define UNITY_TEST_ASSERT_EQUAL_FLOAT_ARRAY(expected, actual, num_elements, line, message)       UNITY_TEST_FAIL((UNITY_LINE_TYPE)(line), UnityStrErrFloat)\n#define UNITY_TEST_ASSERT_FLOAT_IS_INF(actual, line, message)                                    UNITY_TEST_FAIL((UNITY_LINE_TYPE)(line), UnityStrErrFloat)\n#define UNITY_TEST_ASSERT_FLOAT_IS_NEG_INF(actual, line, message)                                UNITY_TEST_FAIL((UNITY_LINE_TYPE)(line), UnityStrErrFloat)\n#define UNITY_TEST_ASSERT_FLOAT_IS_NAN(actual, line, message)                                    UNITY_TEST_FAIL((UNITY_LINE_TYPE)(line), UnityStrErrFloat)\n#define UNITY_TEST_ASSERT_FLOAT_IS_DETERMINATE(actual, line, message)                            UNITY_TEST_FAIL((UNITY_LINE_TYPE)(line), UnityStrErrFloat)\n#define UNITY_TEST_ASSERT_FLOAT_IS_NOT_INF(actual, line, message)                                UNITY_TEST_FAIL((UNITY_LINE_TYPE)(line), UnityStrErrFloat)\n#define UNITY_TEST_ASSERT_FLOAT_IS_NOT_NEG_INF(actual, line, message)                            UNITY_TEST_FAIL((UNITY_LINE_TYPE)(line), UnityStrErrFloat)\n#define UNITY_TEST_ASSERT_FLOAT_IS_NOT_NAN(actual, line, message)                                UNITY_TEST_FAIL((UNITY_LINE_TYPE)(line), UnityStrErrFloat)\n#define UNITY_TEST_ASSERT_FLOAT_IS_NOT_DETERMINATE(actual, line, message)                        UNITY_TEST_FAIL((UNITY_LINE_TYPE)(line), UnityStrErrFloat)\n#else\n#define UNITY_TEST_ASSERT_FLOAT_WITHIN(delta, expected, actual, line, message)                   UnityAssertFloatsWithin((_UF)(delta), (_UF)(expected), (_UF)(actual), (message), (UNITY_LINE_TYPE)(line))\n#define UNITY_TEST_ASSERT_EQUAL_FLOAT(expected, actual, line, message)                           UNITY_TEST_ASSERT_FLOAT_WITHIN((_UF)(expected) * (_UF)UNITY_FLOAT_PRECISION, (_UF)(expected), (_UF)(actual), (UNITY_LINE_TYPE)(line), (message))\n#define UNITY_TEST_ASSERT_EQUAL_FLOAT_ARRAY(expected, actual, num_elements, line, message)       UnityAssertEqualFloatArray((_UF*)(expected), (_UF*)(actual), (_UU32)(num_elements), (message), (UNITY_LINE_TYPE)(line))\n#define UNITY_TEST_ASSERT_FLOAT_IS_INF(actual, line, message)                                    UnityAssertFloatSpecial((_UF)(actual), (message), (UNITY_LINE_TYPE)(line), UNITY_FLOAT_IS_INF)\n#define UNITY_TEST_ASSERT_FLOAT_IS_NEG_INF(actual, line, message)                                UnityAssertFloatSpecial((_UF)(actual), (message), (UNITY_LINE_TYPE)(line), UNITY_FLOAT_IS_NEG_INF)\n#define UNITY_TEST_ASSERT_FLOAT_IS_NAN(actual, line, message)                                    UnityAssertFloatSpecial((_UF)(actual), (message), (UNITY_LINE_TYPE)(line), UNITY_FLOAT_IS_NAN)\n#define UNITY_TEST_ASSERT_FLOAT_IS_DETERMINATE(actual, line, message)                            UnityAssertFloatSpecial((_UF)(actual), (message), (UNITY_LINE_TYPE)(line), UNITY_FLOAT_IS_DET)\n#define UNITY_TEST_ASSERT_FLOAT_IS_NOT_INF(actual, line, message)                                UnityAssertFloatSpecial((_UF)(actual), (message), (UNITY_LINE_TYPE)(line), UNITY_FLOAT_IS_NOT_INF)\n#define UNITY_TEST_ASSERT_FLOAT_IS_NOT_NEG_INF(actual, line, message)                            UnityAssertFloatSpecial((_UF)(actual), (message), (UNITY_LINE_TYPE)(line), UNITY_FLOAT_IS_NOT_NEG_INF)\n#define UNITY_TEST_ASSERT_FLOAT_IS_NOT_NAN(actual, line, message)                                UnityAssertFloatSpecial((_UF)(actual), (message), (UNITY_LINE_TYPE)(line), UNITY_FLOAT_IS_NOT_NAN)\n#define UNITY_TEST_ASSERT_FLOAT_IS_NOT_DETERMINATE(actual, line, message)                        UnityAssertFloatSpecial((_UF)(actual), (message), (UNITY_LINE_TYPE)(line), UNITY_FLOAT_IS_NOT_DET)\n#endif\n\n#ifdef UNITY_EXCLUDE_DOUBLE\n#define UNITY_TEST_ASSERT_DOUBLE_WITHIN(delta, expected, actual, line, message)                  UNITY_TEST_FAIL((UNITY_LINE_TYPE)(line), UnityStrErrDouble)\n#define UNITY_TEST_ASSERT_EQUAL_DOUBLE(expected, actual, line, message)                          UNITY_TEST_FAIL((UNITY_LINE_TYPE)(line), UnityStrErrDouble)\n#define UNITY_TEST_ASSERT_EQUAL_DOUBLE_ARRAY(expected, actual, num_elements, line, message)      UNITY_TEST_FAIL((UNITY_LINE_TYPE)(line), UnityStrErrDouble)\n#define UNITY_TEST_ASSERT_DOUBLE_IS_INF(actual, line, message)                                   UNITY_TEST_FAIL((UNITY_LINE_TYPE)(line), UnityStrErrDouble)\n#define UNITY_TEST_ASSERT_DOUBLE_IS_NEG_INF(actual, line, message)                               UNITY_TEST_FAIL((UNITY_LINE_TYPE)(line), UnityStrErrDouble)\n#define UNITY_TEST_ASSERT_DOUBLE_IS_NAN(actual, line, message)                                   UNITY_TEST_FAIL((UNITY_LINE_TYPE)(line), UnityStrErrDouble)\n#define UNITY_TEST_ASSERT_DOUBLE_IS_DETERMINATE(actual, line, message)                           UNITY_TEST_FAIL((UNITY_LINE_TYPE)(line), UnityStrErrDouble)\n#define UNITY_TEST_ASSERT_DOUBLE_IS_NOT_INF(actual, line, message)                               UNITY_TEST_FAIL((UNITY_LINE_TYPE)(line), UnityStrErrDouble)\n#define UNITY_TEST_ASSERT_DOUBLE_IS_NOT_NEG_INF(actual, line, message)                           UNITY_TEST_FAIL((UNITY_LINE_TYPE)(line), UnityStrErrDouble)\n#define UNITY_TEST_ASSERT_DOUBLE_IS_NOT_NAN(actual, line, message)                               UNITY_TEST_FAIL((UNITY_LINE_TYPE)(line), UnityStrErrDouble)\n#define UNITY_TEST_ASSERT_DOUBLE_IS_NOT_DETERMINATE(actual, line, message)                       UNITY_TEST_FAIL((UNITY_LINE_TYPE)(line), UnityStrErrDouble)\n#else\n#define UNITY_TEST_ASSERT_DOUBLE_WITHIN(delta, expected, actual, line, message)                  UnityAssertDoublesWithin((_UD)(delta), (_UD)(expected), (_UD)(actual), (message), (UNITY_LINE_TYPE)line)\n#define UNITY_TEST_ASSERT_EQUAL_DOUBLE(expected, actual, line, message)                          UNITY_TEST_ASSERT_DOUBLE_WITHIN((_UD)(expected) * (_UD)UNITY_DOUBLE_PRECISION, (_UD)expected, (_UD)actual, (UNITY_LINE_TYPE)(line), message)\n#define UNITY_TEST_ASSERT_EQUAL_DOUBLE_ARRAY(expected, actual, num_elements, line, message)      UnityAssertEqualDoubleArray((_UD*)(expected), (_UD*)(actual), (_UU32)(num_elements), (message), (UNITY_LINE_TYPE)line)\n#define UNITY_TEST_ASSERT_DOUBLE_IS_INF(actual, line, message)                                   UnityAssertDoubleSpecial((_UD)(actual), (message), (UNITY_LINE_TYPE)(line), UNITY_FLOAT_IS_INF)\n#define UNITY_TEST_ASSERT_DOUBLE_IS_NEG_INF(actual, line, message)                               UnityAssertDoubleSpecial((_UD)(actual), (message), (UNITY_LINE_TYPE)(line), UNITY_FLOAT_IS_NEG_INF)\n#define UNITY_TEST_ASSERT_DOUBLE_IS_NAN(actual, line, message)                                   UnityAssertDoubleSpecial((_UD)(actual), (message), (UNITY_LINE_TYPE)(line), UNITY_FLOAT_IS_NAN)\n#define UNITY_TEST_ASSERT_DOUBLE_IS_DETERMINATE(actual, line, message)                           UnityAssertDoubleSpecial((_UD)(actual), (message), (UNITY_LINE_TYPE)(line), UNITY_FLOAT_IS_DET)\n#define UNITY_TEST_ASSERT_DOUBLE_IS_NOT_INF(actual, line, message)                               UnityAssertDoubleSpecial((_UD)(actual), (message), (UNITY_LINE_TYPE)(line), UNITY_FLOAT_IS_NOT_INF)\n#define UNITY_TEST_ASSERT_DOUBLE_IS_NOT_NEG_INF(actual, line, message)                           UnityAssertDoubleSpecial((_UD)(actual), (message), (UNITY_LINE_TYPE)(line), UNITY_FLOAT_IS_NOT_NEG_INF)\n#define UNITY_TEST_ASSERT_DOUBLE_IS_NOT_NAN(actual, line, message)                               UnityAssertDoubleSpecial((_UD)(actual), (message), (UNITY_LINE_TYPE)(line), UNITY_FLOAT_IS_NOT_NAN)\n#define UNITY_TEST_ASSERT_DOUBLE_IS_NOT_DETERMINATE(actual, line, message)                       UnityAssertDoubleSpecial((_UD)(actual), (message), (UNITY_LINE_TYPE)(line), UNITY_FLOAT_IS_NOT_DET)\n#endif\n\n/* End of UNITY_INTERNALS_H */\n#endif\n"
  }
]