Skip to content

Commit

Permalink
Test whole genome comparison
Browse files Browse the repository at this point in the history
  • Loading branch information
eweitz committed Aug 19, 2019
1 parent f7ef134 commit fc36fd0
Show file tree
Hide file tree
Showing 2 changed files with 94 additions and 3 deletions.
1 change: 0 additions & 1 deletion src/js/collinear-vertical.js
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,6 @@ function collinearizeVerticalChromosomes(ideo) {
if (d > maxHeight) maxHeight = d;
});
height = maxHeight + 20;
console.log(ideo.chromosomes);
} else {
height = xOffsets.slice(-1)[0] + 20;
}
Expand Down
96 changes: 94 additions & 2 deletions test/web-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -359,8 +359,6 @@ describe('Ideogram', function() {
var numSyntenicRegions = document.getElementsByClassName('syntenicRegion').length;
// console.log(d3.selectAll('.syntenicRegion'));

console.log(document.getElementsByClassName('syntenicRegion')[0][0]);

assert.equal(numSyntenicRegions, 1, 'numSyntenicRegions');

// Test related convenience methods
Expand Down Expand Up @@ -388,6 +386,100 @@ describe('Ideogram', function() {
var ideogram = new Ideogram(config);
});

it('should show 3 syntenic regions in collinear vertical genomes', function(done) {
// Tests use case from ../examples/vanilla/compare-whole-genomes
// Used for comparing multiple whole genomes

function onIdeogramLoad() {
var chrs, chr1, chr4, humanTaxid, mouseTaxid;

humanTaxid = ideogram.getTaxid('human');
mouseTaxid = ideogram.getTaxid('mouse');

chrs = ideogram.chromosomes;
chr1 = chrs[humanTaxid]['1'];
chr4 = chrs[mouseTaxid]['4'];
chr19 = chrs[mouseTaxid]['19'];
syntenicRegions = [];

range1 = {
chr: chr1,
start: 11106531,
stop: 11262557,
orientation: 'reverse'
};

range2 = {
chr: chr4,
start: 148448582,
stop: 148557685
};
// range2 = {
// chr: chr19,
// start: 61431564,
// stop: 61431565 // end of mouse chr19
// };

syntenicRegions.push({r1: range1, r2: range2});

var chr10 = chrs[humanTaxid]['10'];
var range3 = {
chr: chr10,
start: 87864470,
stop: 87965472
};
var range4 = {
chr: chr19,
start: 32758445,
stop: 32820028
};
syntenicRegions.push({r1: range3, r2: range4});

var range5 = {
chr: chr10,
start: 26216810,
stop: 26300961
};
var range6 = {
chr: chrs[mouseTaxid]['2'],
start: 22622663,
stop: 22690346
};
syntenicRegions.push({r1: range5, r2: range6});

ideogram.drawSynteny(syntenicRegions);

var selector1, selector3, line1, line3;

selector1 = '#chr1-9606_11106531_11262557___chr4-10090_148448582_148557685';
selector3 = '#chr10-9606_26216810_26300961___chr2-10090_22622663_22690346';

line1 = document.querySelector(selector1 + ' .syntenyBorder');
line3 = document.querySelector(selector3 + ' .syntenyBorder');

assert.equal(Math.round(line1.getAttribute('x1')), 23);
assert.equal(Math.round(line1.getAttribute('x2')), 220);
assert.equal(Math.round(line1.getAttribute('y1')), 14);

assert.equal(Math.round(line3.getAttribute('y1')), 315);
assert.equal(Math.round(line3.getAttribute('y2')), 52);
done();
}

config = {
organism: ['human', 'mouse'],
orientation: 'vertical',
geometry: 'collinear',
chromosomeScale: 'absolute',
chrHeight: 40,
chrMargin: 3,
dataDir: '/dist/data/bands/native/',
onLoad: onIdeogramLoad
};

ideogram = new Ideogram(config);
});

it('should have 1000 annotations in basic annotations example', function(done) {
// Tests use case from ../examples/vanilla/annotations-basic.html

Expand Down

0 comments on commit fc36fd0

Please sign in to comment.