Skip to content

Commit

Permalink
in principles, this fixes the weird output I mentioned in #9
Browse files Browse the repository at this point in the history
  • Loading branch information
subwaystation committed Feb 3, 2020
1 parent 71217e3 commit d0261fb
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 9 deletions.
10 changes: 9 additions & 1 deletion src/App.js
Original file line number Diff line number Diff line change
Expand Up @@ -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 (
Expand All @@ -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}
Expand Down
10 changes: 5 additions & 5 deletions src/ComponentRect.js
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}

Expand All @@ -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 <ComponentConnectorRect
key={"occupant" + i + j}
Expand All @@ -67,7 +67,7 @@ class ComponentRect extends React.Component {
};

renderAllConnectors(){
let connectorsColumn = this.props.item.departures.slice(-1)[0]
let connectorsColumn = this.props.item.departures.slice(-1)[0];
if(connectorsColumn !== undefined){
return (<>
{connectorsColumn.participants.map(
Expand All @@ -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;
Expand Down
6 changes: 3 additions & 3 deletions src/PangenomeSchematic.js
Original file line number Diff line number Diff line change
Expand Up @@ -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
}
Expand All @@ -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}
}
Expand Down

0 comments on commit d0261fb

Please sign in to comment.