Skip to content

Commit

Permalink
Merge pull request #132 from AliTVTeam/develop
Browse files Browse the repository at this point in the history
Version 1.0.3
  • Loading branch information
iimog authored Jun 19, 2017
2 parents c71d8f8 + 831f4f5 commit f2af809
Show file tree
Hide file tree
Showing 5 changed files with 14 additions and 6 deletions.
2 changes: 1 addition & 1 deletion AliTV-perl-interface
3 changes: 3 additions & 0 deletions README.org
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,9 @@ The licenses of included libraries might differ, please see [[LICENSES/README.or
[[https://travis-ci.org/AliTVTeam/AliTV/][https://travis-ci.org/AliTVTeam/AliTV.svg?branch=master]]
[[https://coveralls.io/github/AliTVTeam/AliTV?branch=master][https://coveralls.io/repos/github/AliTVTeam/AliTV/badge.svg?branch=master]]
** Changelog
*** 1.0.3 <2017-06-16>
- Fix split feature bug (#131)
- Add citation info
*** 1.0.2 <2017-04-25>
- Add documentation of perl part (rtd)
- Add demo sets bacteria, chromosomes
Expand Down
11 changes: 8 additions & 3 deletions d3/js/AliTV.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
/* global bootbox: false */

// use const instead of var as soon as EcmaScript 6 (ES6 is widely used)
var AliTV_VERSION = "1.0.2";
var AliTV_VERSION = "1.0.3";

/**
* Creates an object of type AliTV for drawing whole genome alignment visualizations
Expand Down Expand Up @@ -2017,7 +2017,7 @@ AliTV.prototype.getLinearFeatureCoords = function(linearKaryoCoords) {
start = featureScale((Math.min(value.end, value.start) + shift + that.data.karyo.chromosomes[featureKaryo].length) % that.data.karyo.chromosomes[featureKaryo].length);
end = featureScale((Math.max(value.end, value.start) + shift + that.data.karyo.chromosomes[featureKaryo].length) % that.data.karyo.chromosomes[featureKaryo].length);

if (that.filters.karyo.chromosomes[featureKaryo].reverse === false && (start > end)) {
if (that.filters.karyo.chromosomes[featureKaryo].reverse === false && (start > end) && end > 0) {
currentFeature.width = featureScale(that.data.karyo.chromosomes[featureKaryo].length) - start;
linearFeatureCoords.push(currentFeature);

Expand All @@ -2031,7 +2031,12 @@ AliTV.prototype.getLinearFeatureCoords = function(linearKaryoCoords) {
"y": currentY
};
linearFeatureCoords.push(splitFeature);
} else if (that.filters.karyo.chromosomes[featureKaryo].reverse === true && (start < end)) {
} else if (that.filters.karyo.chromosomes[featureKaryo].reverse === true &&
(start < end) &&
// the next line should really compare end != featureScale(0) but as those are floats this comparison is not reliable
// a better solution would be to check for the difference to be greater than Number.EPSILON (https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number/EPSILON)
// however, this is not supported in all browsers yet, therefore, in this case 0.01 can be used as if there is a real difference it will be close to one and if there is not it will be very close to 0
(Math.abs(end - featureScale(0)) > 0.01)) {
currentFeature.x = end;
currentFeature.width = featureScale(0) - end;
linearFeatureCoords.push(currentFeature);
Expand Down
2 changes: 1 addition & 1 deletion d3/test/spec/test_AliTV.js
Original file line number Diff line number Diff line change
Expand Up @@ -1687,7 +1687,7 @@ describe('The drawLinearFeatures method of AliTV objects is supposed to draw fea
var linearKaryoCoords = ali.getLinearKaryoCoords();
var linearFeatureCoords = ali.getLinearFeatureCoords(linearKaryoCoords);
ali.drawLinearFeatures(linearFeatureCoords);
expect(ali.svgD3.selectAll('.feature').size()).toEqual(5);
expect(ali.svgD3.selectAll('.feature').size()).toEqual(4);
});
it('there should be exactly four features of different feature groups in a test svg, the patterns and forms of them are changed via the configuration', function(){
var svg = $('<svg></svg>');
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "AliTV",
"version": "1.0.2",
"version": "1.0.3",
"scripts": {
"test": "grunt travis --verbose"
},
Expand Down

0 comments on commit f2af809

Please sign in to comment.