Skip to content

Commit

Permalink
flow passes
Browse files Browse the repository at this point in the history
  • Loading branch information
akmorrow13 committed Feb 16, 2021
1 parent ea02ed3 commit f5eb0c4
Show file tree
Hide file tree
Showing 13 changed files with 18 additions and 17 deletions.
4 changes: 4 additions & 0 deletions .flowconfig
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
.*node_modules/jshint.*
.*node_modules/jstransformify.*
.*node_modules/uglify.*
.*node_modules/module-deps.*
.*node_modules/data-canvas.*
.*node_modules/babel.*
.*node_modules/d3.*
Expand All @@ -31,3 +32,6 @@
[libs]
lib
node_modules/data-canvas/flowtype

[options]
suppress_comment= \\(.\\|\n\\)*\\$FlowIgnore
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@
"eslint-plugin-promise": "^4.0.0",
"eslint-plugin-react": "7.22.0",
"exorcist": "^0.4.0",
"flow-bin": "^0.144.0",
"flow-bin": "^0.120.1",
"http-server": "^0.12.3",
"install": "^0.13.0",
"istanbul": "^0.4.5",
Expand Down
2 changes: 1 addition & 1 deletion src/main/VisualizationWrapper.js
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ class VisualizationWrapper extends React.Component<Props, State> {
window.removeEventListener('resize', this.onResizeListener);
}

getScale(): (num: number)=>number {
getScale(): any {
if (!this.props.range) return x => x;
return d3utils.getTrackScale(this.props.range, this.state.width);
}
Expand Down
2 changes: 1 addition & 1 deletion src/main/data/BigBed.js
Original file line number Diff line number Diff line change
Expand Up @@ -162,7 +162,7 @@ class ImmediateBigBed {
contigMap: {[key:string]: number};
chrIdToContig: string[];

constructor(remoteFile, header, cirTree, contigMap: {[key:string]: number}) {
constructor(remoteFile: RemoteFile, header: Object, cirTree: Object, contigMap: {[key:string]: number}) {
this.remoteFile = remoteFile;
this.header = header;
this.cirTree = cirTree;
Expand Down
1 change: 1 addition & 0 deletions src/main/data/formats/bamTypes.js
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,7 @@ var ThickAlignment = _.extend(_.clone(ThinAlignment), {
auxiliary: ['array', {
tag: ['string', 2],
val_type: 'char',
// $FlowIgnore: TODO remove flow suppression
value: ['if', ctx => ctx.val_type == 'B', {
val_type: 'char',
num_values: 'int32',
Expand Down
2 changes: 1 addition & 1 deletion src/main/data/gene.js
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ class Gene {
codingRegion = new Interval(parseInt(thickStart.values[0].stringValue),
parseInt(thickEnd.values[0].stringValue));
} else {
codingRegion = new Interval(position.start(), position.end());
codingRegion = new Interval(position.start(), position.stop());
}

return new Gene({
Expand Down
5 changes: 2 additions & 3 deletions src/main/viz/CoverageTrack.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@ import type {DataSource} from '../sources/DataSource';
import Feature from '../data/feature';
import type {DataCanvasRenderingContext2D} from 'data-canvas';
import type {BinSummary} from './CoverageCache';
import type {Scale} from './d3utils';
import type {State} from '../types';
import type {VizProps} from '../VisualizationWrapper';

Expand Down Expand Up @@ -199,7 +198,7 @@ class CoverageTrack extends React.Component<VizProps<DataSource<Alignment | Feat
return <canvas ref='canvas' onClick={this.handleClick.bind(this)} />;
}

getScale(): Scale {
getScale(): any {
return d3utils.getTrackScale(this.props.range, this.props.width);
}

Expand Down Expand Up @@ -248,7 +247,7 @@ class CoverageTrack extends React.Component<VizProps<DataSource<Alignment | Feat
}

// Draw three ticks on the left to set the scale for the user
renderTicks(ctx: DataCanvasRenderingContext2D, yScale: (num: number)=>number) {
renderTicks(ctx: DataCanvasRenderingContext2D, yScale: any) {
var axisMax = yScale.domain()[0];
[0, Math.round(axisMax / 2), axisMax].forEach(tick => {
// Draw a line indicating the tick
Expand Down
3 changes: 1 addition & 2 deletions src/main/viz/GeneTrack.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@ import type {Strand} from '../Alignment';
import Gene from '../data/gene';
import type {DataSource} from '../sources/DataSource';
import type {VizProps} from '../VisualizationWrapper';
import type {Scale} from './d3utils';
import type {State} from '../types';

import GenericFeature from '../data/genericFeature';
Expand Down Expand Up @@ -113,7 +112,7 @@ class GeneTrack extends React.Component<VizProps<DataSource<Gene>>, State> {
this.updateVisualization();
}

getScale(): Scale {
getScale(): any {
return d3utils.getTrackScale(this.props.range, this.props.width);
}

Expand Down
3 changes: 1 addition & 2 deletions src/main/viz/GenotypeTrack.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@ import type {VcfDataSource} from '../sources/VcfDataSource';
import type {VariantContext} from '../data/variant';
import type {DataCanvasRenderingContext2D} from 'data-canvas';
import type {VizProps} from '../VisualizationWrapper';
import type {Scale} from './d3utils';

import React from 'react';
import _ from 'underscore';
Expand Down Expand Up @@ -184,7 +183,7 @@ class GenotypeTrack extends React.Component<VizProps<VcfDataSource>, State> {
this.updateVisualization();
}

getScale(): Scale {
getScale(): any {
return d3utils.getTrackScale(this.props.range, this.props.width - LABEL_WIDTH);
}

Expand Down
3 changes: 1 addition & 2 deletions src/main/viz/PileupTrack.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@ import type {VisualAlignment, InsertStats} from './PileupCache';
import type {VisualGroup} from './AbstractCache';
import type {DataCanvasRenderingContext2D} from 'data-canvas';
import type {VizProps} from '../VisualizationWrapper';
import type {Scale} from './d3utils';
import type {State, NetworkStatus} from '../types';

import React from 'react';
Expand Down Expand Up @@ -310,7 +309,7 @@ class PileupTrack extends React.Component<VizProps<DataSource<Alignment>>, State
this.updateVisualization();
}

getScale(): Scale {
getScale(): any {
return d3utils.getTrackScale(this.props.range, this.props.width);
}

Expand Down
2 changes: 1 addition & 1 deletion src/test/MappedRemoteFile.js
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ class MappedRemoteFile extends RemoteFile {
return buf;
});
} else {
return Q.reject(`Request for ${originalRequest} is not mapped in ${this.url}`);
return Q.reject(`Request for ${originalRequest.toString()} is not mapped in ${this.url}`);
}
}

Expand Down
4 changes: 2 additions & 2 deletions src/test/components-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -83,8 +83,8 @@ describe('pileup', function() {
};

// TODO: consider moving this into the data-canvas library
function hasCanvasAndObjects(div, selector) {
return div.querySelector(selector + ' canvas') && drawnObjects(div, selector).length > 0;
function hasCanvasAndObjects(div, selector): boolean {
return div.querySelector(selector + ' canvas') !== null && drawnObjects(div, selector).length > 0;
}

var ready = ((): boolean =>
Expand Down
2 changes: 1 addition & 1 deletion src/test/sources/CytoBandDataSource-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ describe('CytoBandDataSource', function() {
expect(chr.bands[0].value).to.equal('gvar');
done();
});
source.rangeChanged(range);
source.rangeChanged({contig: range.contig, start: range.start(), stop: range.stop()});
});

it('should allow a mix of chr and non-chr', function(done) {
Expand Down

0 comments on commit f5eb0c4

Please sign in to comment.