Skip to content

Commit

Permalink
fix on default values of variant track options
Browse files Browse the repository at this point in the history
  • Loading branch information
piotr-gawron committed Nov 11, 2016
1 parent 1746654 commit 8f50dd4
Showing 1 changed file with 9 additions and 17 deletions.
26 changes: 9 additions & 17 deletions src/main/viz/VariantTrack.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,20 +22,10 @@ import canvasUtils from './canvas-utils';
import dataCanvas from 'data-canvas';
import style from '../style';


class VariantTrack extends React.Component {
static propTypes: VizProps & {source: VcfDataSource,
variantHeightByFrequency: boolean,
allelFrequencyStrategy: Object,
onVariantClicked: Object,
};
state: void;
props: VizProps & {source: VcfDataSource};

static get defaultProps() {
return {
allelFrequencyStrategy: AllelFrequencyStrategy.Major,
};
}
state: void;

constructor(props: Object) {
super(props);
Expand Down Expand Up @@ -95,15 +85,17 @@ class VariantTrack extends React.Component {
var variantHeightRatio = 1.0;
if (this.props.options.variantHeightByFrequency) {
var frequency = null;
if (this.props.allelFrequencyStrategy === AllelFrequencyStrategy.Major) {
if (this.props.options.allelFrequencyStrategy === undefined) { //default startegy
frequency = variant.majorFrequency;
} else if (this.props.options.allelFrequencyStrategy === AllelFrequencyStrategy.Major) {
frequency = variant.majorFrequency;
} else if (this.props.allelFrequencyStrategy === AllelFrequencyStrategy.Minor) {
} else if (this.props.options.allelFrequencyStrategy === AllelFrequencyStrategy.Minor) {
frequency = variant.minorFrequency;
} else {
console.log("Unknown AllelFrequencyStrategy: ",this.props.allelFrequencyStrategy);
console.log("Unknown AllelFrequencyStrategy: ",this.props.options.allelFrequencyStrategy);
}
if (variant.significantFrequency !== null && variant.significantFrequency !== undefined) {
variantHeightRatio = variant.significantFrequency;
if (frequency !== null && frequency !== undefined) {
variantHeightRatio = frequency;
}
}
var height = style.VARIANT_HEIGHT*variantHeightRatio;
Expand Down

0 comments on commit 8f50dd4

Please sign in to comment.