diff --git a/src/App.js b/src/App.js index 1beed422..c4644453 100644 --- a/src/App.js +++ b/src/App.js @@ -79,6 +79,14 @@ class App extends Component { return (schematizeComponent.firstBin - this.props.store.beginBin) + (i * this.props.store.paddingSize) + schematizeComponent.offset; } + valGreaterOne(val) { + if (val > 0) { + return 1; + } else { + return 0; + } + } + renderComponent(schematizeComponent, i) { return ( @@ -89,7 +97,7 @@ class App extends Component { x={this.state.schematize[i].x + this.props.store.leftOffset} y={this.props.store.topOffset} height={this.visibleHeight()} - width={(schematizeComponent.leftPadding() + (schematizeComponent.departures.length-1))} + width={(schematizeComponent.leftPadding() + (schematizeComponent.departures.length - this.valGreaterOne(schematizeComponent.departures.length)))} binsPerPixel={this.props.store.binsPerPixel} pathsPerPixel={this.props.store.pathsPerPixel} compressed_row_mapping={this.compressed_row_mapping} diff --git a/src/ComponentRect.js b/src/ComponentRect.js index 4f9fe883..0486eade 100644 --- a/src/ComponentRect.js +++ b/src/ComponentRect.js @@ -26,8 +26,8 @@ function find_rows_visible_in_viewport(components){ /*The only components passed to this method are the components on the screen. * This returns a boolean list of which rows are on the screen. */ // let rows_present = new Array(components[0].occupants.length).fill(false); - let per_row = zip(...components.map((x)=> x.occupants)) - let rows_present = per_row.map((row, i) => row.some(x=>x)) + let per_row = zip(...components.map((x)=> x.occupants)); + let rows_present = per_row.map((row, i) => row.some(x=>x)); return rows_present; } @@ -52,7 +52,7 @@ class ComponentRect extends React.Component { renderOccupants(occupant, i, j) { const parent = this.props.item; const x_val = this.props.x + (parent.arrivals.length * this.props.binsPerPixel); - const width = (parent.leftPadding() - parent.arrivals.length) * this.props.binsPerPixel; + const width = (parent.num_bin) * this.props.binsPerPixel; if (occupant) { return {connectorsColumn.participants.map( @@ -82,7 +82,7 @@ class ComponentRect extends React.Component { } renderComponentConnector(useConnector, j) { - let component = this.props.item + let component = this.props.item; // x is the (num_bins + num_arrivals + num_departures)*binsPerPixel if (useConnector) { const x_val = this.props.x + (component.leftPadding() + component.departures.length-1) * this.props.binsPerPixel; diff --git a/src/PangenomeSchematic.js b/src/PangenomeSchematic.js index 5282931f..7bf31c1e 100644 --- a/src/PangenomeSchematic.js +++ b/src/PangenomeSchematic.js @@ -16,8 +16,8 @@ class PangenomeSchematic extends React.Component { // console.log(); // var jsonFile = require('./data/Athaliana.bin100000.schematic.json'); // This cannot be a variable // var jsonFile = require('./data/yeast_bin10k_7indiv_16chr.schematic.json'); // This cannot be a variable - // const jsonFile = require('./data/sebastian.Athaliana.all.50000.w100000.schematic.json'); // This cannot be a variable - const jsonFile = require('./data/run1.B1phi1.i1.seqwish.w100.schematic.json'); // ERIKS DATA FROM JANUARY + const jsonFile = require('./data/sebastian.Athaliana.all.50000.w100000.schematic.1D.json'); // This cannot be a variable + // const jsonFile = require('./data/run1.B1phi1.i1.seqwish.w100.schematic.json'); // ERIKS DATA FROM JANUARY // console.log(jsonFile); return jsonFile } @@ -27,7 +27,7 @@ class PangenomeSchematic extends React.Component { for (var component of this.jsonData.components) { if(component.first_bin >= beginBin){ var componentItem = new Component(component, offsetLength); - offsetLength += componentItem.arrivals.length + componentItem.departures.length-1; + offsetLength += componentItem.arrivals.length + componentItem.departures.length; // FIXME componentArray.push(componentItem); if(component.last_bin > endBin){break} }