Skip to content

Commit

Permalink
added test for single nuc context
Browse files Browse the repository at this point in the history
  • Loading branch information
bhofmei committed Jul 14, 2017
1 parent 7717442 commit c77209c
Showing 1 changed file with 57 additions and 0 deletions.
57 changes: 57 additions & 0 deletions test/spec/NucleotideDensityPlugin.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,17 +2,21 @@ require([
'dojo/_base/declare',
'dojo/_base/array',
'JBrowse/Browser',
'JBrowse/Store/SeqFeature/SequenceChunks',
'NucleotideDensityPlugin/View/ColorHandler',
'NucleotideDensityPlugin/View/Track/NucleotideDensity',
'NucleotideDensityPlugin/Store/SeqFeature/NucDensity',
'NucleotideDensityPlugin/Store/SeqFeature/NucDensityMulti',
'NucleotideDensityPlugin/Store/Util'
], function(
declare,
array,
Browser,
SequenceChunks,
ColorHandler,
nucDensTrack,
nucDensStore,
nucDensMultiStore,
nucDensUtil
) {

Expand Down Expand Up @@ -108,5 +112,58 @@ require([
});
}); // end test color handler

describe('test stores', function(){
var browser = new Browser({unitTestMode: true});
browser.refSeq = {
length: 500001
};
var seqstore = new SequenceChunks({
urlTemplate: "../data/seq/{refseq_dirpath}/{refseq}-",
refSeq: { name: 'Chr5', start: 0, end: 50001 },
label: "refseqs",
browser: browser
});
describe('test single store', function(){
var store = nucDensStore({
store: seqstore,
browser: browser,
windowSize: 2000,
windowDelta: 2000,
nuc: 'TA',
label: 'single.nucleotide.density.track'
});
var features = [];
beforeEach(function(done){
store.getFeatures({ref:'Chr5', start: 0, end: 12001}, function(feature){
features.push(feature);
}, function(){
done();
}, function(error){
console.error(error);
done();
});
});
afterEach(function(){
features = [];
});

it('store exists', function(){
expect(store).toBeTruthy();
});
it('features length', function(){
//console.log(JSON.stringify(features));
expect(features.length).toBe(6);
});
it('features values', function(){
var scores = array.map(features, function(feat){ return feat.score; });
var expected = [0.062, 0.1015, 0.1165, 0.1085, 0.0885, 0.0895];
for(var i=0; i < scores.length; i++){
expect(scores[i]).toBeClose(expected[i],3);
}
});

});
});

});

0 comments on commit c77209c

Please sign in to comment.