Skip to content

Commit

Permalink
zomg it's a pileup
Browse files Browse the repository at this point in the history
  • Loading branch information
danvk committed Apr 17, 2015
1 parent b9071a7 commit fc4f70b
Showing 1 changed file with 8 additions and 3 deletions.
11 changes: 8 additions & 3 deletions src/PileupTrack.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,9 @@ import type * as SamRead from './SamRead';
var React = require('react/addons'),
_ = require('underscore'),
d3 = require('d3'),
types = require('./types');
types = require('./types'),
Interval = require('./Interval'),
{pileup} = require('./pileuputils');

var PileupTrack = React.createClass({
propTypes: {
Expand Down Expand Up @@ -74,6 +76,9 @@ var NonEmptyPileupTrack = React.createClass({

var scale = this.getScale();

var rows = pileup(this.props.reads.map(
r => new Interval(r.pos, r.pos + r.l_seq)));

svg.attr('width', width)
.attr('height', height);

Expand All @@ -88,8 +93,8 @@ var NonEmptyPileupTrack = React.createClass({
// Update
reads.attr({
'x': read => scale(read.pos),
'y': (read, i) => i * (READ_HEIGHT + READ_SPACING),
'width': read => (scale(read.pos + read.l_seq) - scale(read.pos)),
'y': (read, i) => rows[i] * (READ_HEIGHT + READ_SPACING),
'width': read => (scale(read.pos + read.l_seq) - scale(read.pos) - 5),
'height': READ_HEIGHT
});

Expand Down

0 comments on commit fc4f70b

Please sign in to comment.