<commit_before>function runBigwigTests() {

    function createMockObjects(bpPerPixel) {

        igv = igv || {};
        igv.browser = igv.browser || {};
        igv.browser.referenceFrame = {bpPerPixel: bpPerPixel};

    }

    asyncTest("Bigwig meta data", function () {

        var url,
            bwReader;

        url = "http://www.broadinstitute.org/igvdata/test/data/bigwig/bigWigExample.bw";
        bwReader = new igv.BWReader({url: url});
        ok(bwReader);

        bwReader.loadHeader(function () {

            var header = bwReader.header;

            ok(header);

            //equal(20093017, bwReader.contentLength);
            equal(4, header.bwVersion);
            equal(10, header.nZoomLevels);
            equal(344, header.chromTreeOffset);
            equal(393, header.fullDataOffset);
            equal(15751049, header.fullIndexOffset);

            // Summary data
            equal(35106705, bwReader.totalSummary.basesCovered);
            equal(0, bwReader.totalSummary.minVal);
            equal(100, bwReader.totalSummary.maxVal);
            equal(77043134252.78125, bwReader.totalSummary.sumSquares);

//            // chrom tree -- values taken from IGV java
            var ctHeader = bwReader.chromTree.header;
            equal(1, ctHeader.blockSize);
            equal(5, ctHeader.keySize);
            equal(8, ctHeader.valSize);
            equal(1, ctHeader.itemCount);

            // chrom lookup  == there's only 1 chromosome in this test file
            var chrName = "chr21";
            var chrIdx = bwReader.chromTree.dictionary[chrName];
            equal(0, chrIdx);


            // Total data count -- note this is the # of "sections", not the # of data points.  Verified with grep
            equal(6857, bwReader.dataCount);

            var type = bwReader.type;
            equal("BigWig", type);

            start();
        });

    });

    //asyncTest("R+ Tree", function () {
    //    var url = "http://www.broadinstitute.org/igvdata/test/data/bigwig/bigWigExample.bw";
    //
    //    var bwReader = new igv.BWReader({url: url});
    //
    //    bwReader.loadHeader(function () {
    //
    //        var offset = bwReader.header.fullIndexOffset;
    //
    //        bwReader.loadRPTree(offset, function (rpTree) {
    //
    //            ok(rpTree.rootNode);
    //
    //            start();
    //        });
    //    });
    //});

    //asyncTest("Wig features", function () {
    //
    //    //chr21:19,146,376-19,193,466
    //    var url = "http://www.broadinstitute.org/igvdata/test/data/bigwig/bigWigExample.bw",
    //        chr = "chr21",
    //        bpStart = 19168957,
    //        bpEnd = 19170640,
    //        bpPerPixel = 0.5478515625;    // To match iOS unit test
    //
    //    createMockObjects(bpPerPixel);
    //
    //    var bWSource = new igv.BWSource({url: url});
    //
    //    bWSource.getFeatures(chr, bpStart, bpEnd, function (features) {
    //
    //        ok(features);
    //
    //        equal(features.length, 337);   // Verified in iPad app
    //
    //        start();
    //    });
    //});

    //asyncTest("Zoom data", function () {
    //
    //    //chr21:19,146,376-19,193,466
    //    var url = "http://www.broadinstitute.org/igvdata/test/data/bigwig/bigWigExample.bw",
    //        chr = "chr21",
    //        bpStart = 18728264,
    //        bpEnd = 26996291,
    //        bpPerPixel = 10765.6611328125;    // To match iOS unit test
    //
    //    createMockObjects(bpPerPixel);
    //
    //    var bWSource = new igv.BWSource({url: url});
    //
    //    bWSource.getFeatures(chr, bpStart, bpEnd, function (features) {
    //
    //        ok(features);
    //
    //        equal(features.length, 324);   // Verified in iPad app
    //
    //        start();
    //    });
    //});

    //asyncTest("Bed features", function () {
    //
    //    //chr21:19,146,376-19,193,466
    //    var url = "http://www.broadinstitute.org/igvdata/test/data/bigwig/bigBedExample.bb",
    //        chr = "chr21",
    //        bpStart = 33031597,
    //        bpEnd = 33041570,
    //        bpPerPixel = 0.5;
    //
    //    createMockObjects(bpPerPixel);
    //
    //    var bWSource = new igv.BWSource({url: url});
    //
    //    bWSource.getFeatures(chr, bpStart, bpEnd, function (features) {
    //
    //        ok(features);
    //
    //        equal(features.length, 23);   // Verified in iPad app
    //
    //        start();
    //    });
    //});


}<commit_msg>Unit test. testBigwig.js passes<commit_after>function runBigwigTests() {

    function createMockObjects(bpPerPixel) {

        igv = igv || {};
        igv.browser = igv.browser || {};
        igv.browser.referenceFrame = {bpPerPixel: bpPerPixel};

    }

    asyncTest("Bigwig meta data", function () {

        var url,
            bwReader;

        url = "http://www.broadinstitute.org/igvdata/test/data/bigwig/bigWigExample.bw";
        bwReader = new igv.BWReader({url: url});
        ok(bwReader);

        bwReader.loadHeader(function () {

            var header = bwReader.header;

            ok(header);

            equal(4, header.bwVersion);
            equal(10, header.nZoomLevels);
            equal(344, header.chromTreeOffset);
            equal(393, header.fullDataOffset);
            equal(15751049, header.fullIndexOffset);

            // Summary data
            equal(35106705, bwReader.totalSummary.basesCovered);
            equal(0, bwReader.totalSummary.minVal);
            equal(100, bwReader.totalSummary.maxVal);
            equal(77043134252.78125, bwReader.totalSummary.sumSquares);

//            // chrom tree -- values taken from IGV java
            var ctHeader = bwReader.chromTree.header;
            equal(1, ctHeader.blockSize);
            equal(5, ctHeader.keySize);
            equal(8, ctHeader.valSize);
            equal(1, ctHeader.itemCount);

            // chrom lookup  == there's only 1 chromosome in this test file
            var chrName = "chr21";
            var chrIdx = bwReader.chromTree.dictionary[chrName];
            equal(0, chrIdx);


            // Total data count -- note this is the # of "sections", not the # of data points.  Verified with grep
            equal(6857, bwReader.dataCount);

            var type = bwReader.type;
            equal("BigWig", type);

            start();
        });

    });

    asyncTest("R+ Tree", function () {
        var url = "http://www.broadinstitute.org/igvdata/test/data/bigwig/bigWigExample.bw";

        var bwReader = new igv.BWReader({url: url});

        bwReader.loadHeader(function () {

            var offset = bwReader.header.fullIndexOffset;

            bwReader.loadRPTree(offset, function (rpTree) {

                ok(rpTree.rootNode);

                start();
            });
        });
    });

    asyncTest("Wig features", function () {

        //chr21:19,146,376-19,193,466
        var url = "http://www.broadinstitute.org/igvdata/test/data/bigwig/bigWigExample.bw",
            chr = "chr21",
            bpStart = 19168957,
            bpEnd = 19170640,
            bpPerPixel = 0.5478515625;    // To match iOS unit test

        createMockObjects(bpPerPixel);

        var bWSource = new igv.BWSource({url: url});

        bWSource.getFeatures(chr, bpStart, bpEnd, function (features) {

            ok(features);

            equal(features.length, 337);   // Verified in iPad app

            start();
        });
    });

    asyncTest("Zoom data", function () {

        //chr21:19,146,376-19,193,466
        var url = "http://www.broadinstitute.org/igvdata/test/data/bigwig/bigWigExample.bw",
            chr = "chr21",
            bpStart = 18728264,
            bpEnd = 26996291,
            bpPerPixel = 10765.6611328125;    // To match iOS unit test

        createMockObjects(bpPerPixel);

        var bWSource = new igv.BWSource({url: url});

        bWSource.getFeatures(chr, bpStart, bpEnd, function (features) {

            ok(features);

            equal(features.length, 324);   // Verified in iPad app

            start();
        });
    });

    asyncTest("Bed features", function () {

        //chr21:19,146,376-19,193,466
        var url = "http://www.broadinstitute.org/igvdata/test/data/bigwig/bigBedExample.bb",
            chr = "chr21",
            bpStart = 33031597,
            bpEnd = 33041570,
            bpPerPixel = 0.5;

        createMockObjects(bpPerPixel);

        var bWSource = new igv.BWSource({url: url});

        bWSource.getFeatures(chr, bpStart, bpEnd, function (features) {

            ok(features);

            equal(features.length, 23);   // Verified in iPad app

            start();
        });
    });


}
{'fraction_non_alphanumeric': 0.13791919423142956, 'fraction_numerical': 0.046926862767540344, 'mean_word_length': 1.6927580893682588, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 10, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3349236', 'n_tokens_mistral': 3078, 'n_tokens_neox': 2658, 'n_words': 491}