-
Notifications
You must be signed in to change notification settings - Fork 27
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Added read path information to read info dialog #382
Changes from 1 commit
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -3918,6 +3918,26 @@ function trackDoubleClick() { | |
createTubeMap(); | ||
} | ||
|
||
// Takes a track and returns a string describing the nodes it passes through | ||
// In the format of >1>2<3>4, with the intergers being nodeIDs | ||
function getPathInfo(track) { | ||
let result = ""; | ||
if (!track.sequence) { | ||
return result; | ||
} | ||
|
||
for (const nodeID of track.sequence) { | ||
// Node is approached backwards if "-" is present | ||
if (Array.from(nodeID)[0] === "-") { | ||
result = result.concat("<", nodeID.substring(1)); | ||
} else { | ||
result = result.concat(">", nodeID); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This looks like it is going to be an O(n^2) algorithm when it doesn't need to be. Building the new version of You probably want to build an array of all the pieces you want in the final string, by mutably appending to the array with |
||
} | ||
} | ||
|
||
return result; | ||
} | ||
|
||
function trackSingleClick() { | ||
/* jshint validthis: true */ | ||
// Get the track ID as a number | ||
|
@@ -3940,6 +3960,7 @@ function trackSingleClick() { | |
track_attributes.push(["Score", current_track.score]); | ||
track_attributes.push(["CIGAR string", current_track.cigar_string]); | ||
track_attributes.push(["Mapping Quality", current_track.mapping_quality]); | ||
track_attributes.push(["Path Info", getPathInfo(current_track)]); | ||
} | ||
console.log("Single Click"); | ||
console.log("read path"); | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This seems like a weird way to see if the string starts with "-", even though it looks like StackOverflow recommends it, since this looks to convert the whole string to an array just to check the first character. I would probably try the
startsWith
method instead.