Skip to content

Commit 0862fda

Browse files
authored
Merge pull request #466 from vgteam/fix-haplo
Always internally use "haplotype" and never "haplo" to avoid mismatches
2 parents 0452ecb + 8606ed0 commit 0862fda

File tree

1 file changed

+12
-13
lines changed

1 file changed

+12
-13
lines changed

src/util/tubemap.js

Lines changed: 12 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -449,8 +449,7 @@ function createTubeMap() {
449449

450450
for (let i = tracks.length - 1; i >= 0; i -= 1) {
451451
if (!tracks[i].hasOwnProperty("type")) {
452-
// TODO: maybe remove "haplo"-property?
453-
tracks[i].type = "haplo";
452+
tracks[i].type = "haplotype";
454453
}
455454
if (tracks[i].hasOwnProperty("hidden")) {
456455
if (tracks[i].hidden === true) {
@@ -530,15 +529,15 @@ function createTubeMap() {
530529

531530
// all drawn tracks are grouped
532531
let trackGroup = svg.append("g").attr("class", "track");
533-
drawTrackRectangles(trackRectangles, "haplo", trackGroup);
534-
drawTrackCurves("haplo", trackGroup);
532+
drawTrackRectangles(trackRectangles, "haplotype", trackGroup);
533+
drawTrackCurves("haplotype", trackGroup);
535534
drawReversalsByColor(
536535
trackCorners,
537536
trackVerticalRectangles,
538-
"haplo",
537+
"haplotype",
539538
trackGroup
540539
);
541-
drawTrackRectangles(trackRectanglesStep3, "haplo", trackGroup);
540+
drawTrackRectangles(trackRectanglesStep3, "haplotype", trackGroup);
542541
drawTrackRectangles(trackRectangles, "read", trackGroup);
543542
drawTrackCurves("read", trackGroup);
544543

@@ -580,7 +579,7 @@ function generateReadOnlyNodeAttributes() {
580579

581580
// for order values where there is no node with haplotypes, orderY is calculated via tracks
582581
tracks.forEach((track) => {
583-
if (track.type === "haplo") {
582+
if (track.type === "haplotype") {
584583
track.path.forEach((step) => {
585584
setMapToMax(orderY, step.order, step.y + track.width);
586585
});
@@ -1601,7 +1600,7 @@ function generateNodeOrder() {
16011600
tracksAndReads[i].indexSequence
16021601
); // calculate order values for all nodes until the first anchor
16031602
if (rightIndex === null) {
1604-
if (tracksAndReads[i].type === "haplo") {
1603+
if (tracksAndReads[i].type === "haplotype") {
16051604
generateNodeOrderOfSingleTrack(tracksAndReads[i].indexSequence);
16061605
} else {
16071606
tracksAndReads.splice(i, 1);
@@ -4152,7 +4151,7 @@ function drawLegend() {
41524151
const listeners = [];
41534152
// This is in terms of tracks, but when we change visibility we need to touch inputTracks, so we need to set up listeners by track ID.
41544153
for (let i = 0; i < tracks.length; i += 1) {
4155-
if (tracks[i].type === "haplo") {
4154+
if (tracks[i].type === "haplotype") {
41564155
content += `<tr><td style="text-align:right"><div class="color-box" style="background-color: ${generateTrackColor(
41574156
tracks[i],
41584157
"exon"
@@ -4774,7 +4773,7 @@ function mergeNodes() {
47744773
// add 2 predecessors, to make sure there is no node merging in this case
47754774
pred[nodeMap.get(track.sequence[i])].add(forward(nodeName));
47764775
}
4777-
} else if (track.type === "haplo") {
4776+
} else if (track.type === "haplotype") {
47784777
pred[nodeMap.get(track.sequence[i])].add("None");
47794778
}
47804779
if (i < track.sequence.length - 1) {
@@ -4784,7 +4783,7 @@ function mergeNodes() {
47844783
// add 2 successors, to make sure there is no node merging in this case
47854784
succ[nodeMap.get(track.sequence[i])].add(forward(nodeName));
47864785
}
4787-
} else if (track.type === "haplo") {
4786+
} else if (track.type === "haplotype") {
47884787
succ[nodeMap.get(track.sequence[i])].add("None");
47894788
}
47904789
} else {
@@ -4799,7 +4798,7 @@ function mergeNodes() {
47994798
succ[nodeMap.get(nodeName)].add(nodeName2);
48004799
succ[nodeMap.get(nodeName)].add(reverse(nodeName2));
48014800
}
4802-
} else if (track.type === "haplo") {
4801+
} else if (track.type === "haplotype") {
48034802
succ[nodeMap.get(nodeName)].add("None");
48044803
}
48054804
if (i < track.sequence.length - 1) {
@@ -4810,7 +4809,7 @@ function mergeNodes() {
48104809
pred[nodeMap.get(nodeName)].add(nodeName2);
48114810
pred[nodeMap.get(nodeName)].add(reverse(nodeName2));
48124811
}
4813-
} else if (track.type === "haplo") {
4812+
} else if (track.type === "haplotype") {
48144813
pred[nodeMap.get(nodeName)].add("None");
48154814
}
48164815
}

0 commit comments

Comments
 (0)