Skip to content

Commit

Permalink
Merge branch 'master' into feature/snphighlight
Browse files Browse the repository at this point in the history
  • Loading branch information
BjornHo committed Jun 17, 2016
2 parents 96268e8 + cfe5e68 commit d6a771e
Show file tree
Hide file tree
Showing 2 changed files with 30 additions and 25 deletions.
Binary file added SE Deliverables/PL-3FinalReportDraft.pdf
Binary file not shown.
55 changes: 30 additions & 25 deletions src/main/java/gui/views/ribbon/RibbonView.java
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,10 @@
import java.util.Queue;
import java.util.Set;
import java.util.stream.Collectors;
import java.util.HashMap;
import java.util.LinkedList;
import java.util.List;
import java.util.Queue;

import javafx.scene.Group;
import javafx.scene.paint.Paint;
Expand Down Expand Up @@ -74,6 +78,7 @@ public Group createNormalRibbons() {
Line line = new Line(xcoords.get(fromId - 1), ycoords.get(fromId - 1),
xcoords.get(toId - 1), ycoords.get(toId - 1));
line.setStrokeWidth(calculateLineWidth(counts.get(fromId - 1).get(j)));

line.setStroke(colours.get(fromId - 1).get(j));
res.getChildren().add(line);
}
Expand Down Expand Up @@ -233,6 +238,30 @@ public Group createInDels() {
* @param genomes
* @return
*/
public Paint getLineColor(int ff, int tt) {
Paint color = Paint.valueOf("0xff0000ff");
ArrayList<String> from = dbm.getDbReader().getGenomesThroughSegment(ff);
ArrayList<String> to = dbm.getDbReader().getGenomesThroughSegment(tt);
if (from.size() > to.size()) {
for (int i = 0; i < to.size(); i++) {
String genome = to.get(i);
if (lineages.containsKey(genome) && from.contains(genome)
&& !genome.equals("MT_H37RV_BRD_V5.ref")) {
return NewickColourMatching.getLineageColour(lineages.get(genome));
}
}
} else {
for (int i = 0; i < from.size(); i++) {
String genome = from.get(i);
if (lineages.containsKey(genome) && to.contains(genome)
&& !genome.equals("MT_H37RV_BRD_V5.ref")) {
return NewickColourMatching.getLineageColour(lineages.get(genome));
}
}
}
return color;
}

private ArrayList<ArrayList<Paint>> calculateColours(ArrayList<ArrayList<Integer>> linkIds,
ArrayList<Integer> genomes) {
ArrayList<ArrayList<Paint>> colours =
Expand All @@ -252,37 +281,14 @@ private ArrayList<ArrayList<Paint>> calculateColours(ArrayList<ArrayList<Integer
String genome = genomeNames.get(id - 1);
if (!genome.startsWith("M")) {
colour = getMajorityColor(dbm.getDbReader().getGenomeNames(genomeIds));

}
colours.get(i).add(colour);
}
}
return colours;
}

public Paint getLineColor(int ff, int tt) {
Paint color = Paint.valueOf("0xff0000ff");
ArrayList<String> from = dbm.getDbReader().getGenomesThroughSegment(ff);
ArrayList<String> to = dbm.getDbReader().getGenomesThroughSegment(tt);
if (from.size() > to.size()) {
for (int i = 0; i < to.size(); i++) {
String genome = to.get(i);
if (lineages.containsKey(genome) && from.contains(genome)
&& !genome.equals("MT_H37RV_BRD_V5.ref")) {
return NewickColourMatching.getLineageColour(lineages.get(genome));
}
}
} else {
for (int i = 0; i < from.size(); i++) {
String genome = from.get(i);
if (lineages.containsKey(genome) && to.contains(genome)
&& !genome.equals("MT_H37RV_BRD_V5.ref")) {
return NewickColourMatching.getLineageColour(lineages.get(genome));
}
}
}
return color;
}

/**
* Calculates the majority color that is present in all the genomes that are provided.
* @param genomeNames
Expand Down Expand Up @@ -345,7 +351,6 @@ else if(fromId == links.size()/4 * 2) {
else if(fromId == links.size()/4 * 3) {
SplashController.progressNum.set(60);
}

List<Integer> edges = links.get(fromId - 1);

if (!bubbles.isEmpty() && fromId == bubbles.peek()[0]) {
Expand Down

0 comments on commit d6a771e

Please sign in to comment.