This repository was archived by the owner on Jan 3, 2019. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathLocusZoom.ts
More file actions
57 lines (49 loc) · 1.52 KB
/
Copy pathLocusZoom.ts
File metadata and controls
57 lines (49 loc) · 1.52 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
/**
* author: Samuel Gratzl
* email: samuel_gratzl@gmx.at
* created: 2016-10-28T11:19:52.797Z
*/
import * as React from 'react';
import merge from 'datavisyn-scatterplot/src/merge';
import {formatPrefix} from 'd3-format';
import {EScaleAxes, IScatterplotOptions} from 'datavisyn-scatterplot/src';
export {IScatterplotOptions} from 'datavisyn-scatterplot/src';
import Scatterplot, {IScatterplotProps} from './index';
export interface ILocusZoomProps<T> extends IScatterplotProps<T> {
chromosome?: string;
}
export default class LocusZoom<T> extends React.Component<ILocusZoomProps<T>,{}> {
static propTypes = {
data: React.PropTypes.array.isRequired,
selection: React.PropTypes.any,
options: React.PropTypes.object,
onSelectionChanged: React.PropTypes.func,
onWindowChanged: React.PropTypes.func
};
static defaultProps = {
data: [],
onSelectionChanged: () => undefined,
chromosome: 'Chromosome'
};
constructor(props: ILocusZoomProps<T>, context?: any) {
super(props, context);
}
render() {
const options: IScatterplotOptions<T> = {
margin: {
left: 50,
bottom: 30
},
format: {
x: formatPrefix('.2', 1e6) // SI-prefix with two significant digits, "42M"
},
zoom: {
scale: EScaleAxes.x
},
xlabel: this.props.chromosome,
ylabel: '-log10 p-value',
aspectRatio: 5 // a wild guess that x is 5 times as width as height
};
return React.createElement(Scatterplot, merge({options}, this.props));
}
}