Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

rectangular highlight location #128

Open
wants to merge 3 commits into
base: dev
Choose a base branch
from
Open
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 11 additions & 5 deletions src/encoded/static/components/genome_browser.js
Original file line number Diff line number Diff line change
Expand Up @@ -319,16 +319,21 @@ TrackLabel.propTypes = {
class GenomeBrowser extends React.Component {
constructor(props, context) {
super(props, context);

const highlightLocationStart = +props.coordinates.split(':')[1].split('-')[0];
const highlightLocationEnd = +props.coordinates.split(':')[1].split('-')[1];
const x0 = highlightLocationStart - 2000;
const x1 = highlightLocationEnd + 2000;
this.state = {
trackList: [],
visualizer: null,
showAutoSuggest: true,
searchTerm: '',
genome: '',
contig: props.coordinates.split(':')[0],
x0: +props.coordinates.split(':')[1].split('-')[0] - 5000,
x1: +props.coordinates.split(':')[1].split('-')[1] + 5000,
x0: x0,
x1: x1,
highlightLocationStart: highlightLocationStart,
highlightLocationEnd: highlightLocationEnd,
pinnedFiles: [],
disableBrowserForIE: false,
geneSearch: false,
Expand Down Expand Up @@ -563,8 +568,9 @@ class GenomeBrowser extends React.Component {
}

drawTracks(container) {
const highlightLocation = Math.floor((this.state.x1 + this.state.x0) / 2) + 1; // browser uses base 1
const highlightString = `${this.state.contig}:${highlightLocation}`;
const highlightLocationStart = this.state.highlightLocationStart;
const highlightLocationEnd = this.state.highlightLocationEnd;
const highlightString = `${this.state.contig}:${highlightLocationStart}-${highlightLocationEnd}`;
const visualizer = new this.GV.GenomeVisualizer({
clampToTracks: true,
reorderTracks: true,
Expand Down