Skip to content

Instantly share code, notes, and snippets.

@danvk
Created April 17, 2015 19:16
Show Gist options
  • Save danvk/1f772749c481f4da5fc3 to your computer and use it in GitHub Desktop.
Save danvk/1f772749c481f4da5fc3 to your computer and use it in GitHub Desktop.
contig: range.contig,
start: range.start(),
stop: range.stop()
});
});
it('should fetch nearby features', function(done) {
this.timeout(5000);
var source = getTestSource();
// Requests are for 'chr20', while the canonical name is just '20'.
var range = new ContigInterval('chr20', 31512050, 31512150),
rangeBefore = new ContigInterval('chr20', 31512000, 31512050),
rangeAfter = new ContigInterval('chr20', 31512150, 31512199);
var reads = source.getAlignmentsInRange(range);
expect(reads).to.deep.equal([]);
// Fetching [50, 150] should cache [0, 200]
source.on('newdata', () => {
var reads = source.getAlignmentsInRange(range);
expect(reads).to.have.length(19);
expect(reads[0].toString()).to.equal('20:31511951-31512051');
expect(reads[18].toString()).to.equal('20:31512146-31512246');
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment