Skip to content
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

Eliding small snarls #374

Merged
merged 14 commits into from
Dec 7, 2023
Merged

Eliding small snarls #374

merged 14 commits into from
Dec 7, 2023

Conversation

shreyasun
Copy link
Collaborator

Fixes #196

@adamnovak
Copy link
Member

@shreyasun It looks like you need to add &simplify=false to the correct copied links in the link copying tests. Can you do that?

Copy link
Member

@adamnovak adamnovak left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This looks like it should work great, but some of the comments, error messages, and documentation need to be improved before we merge it.

Also, there are some places where the code should be simplified.

@@ -27,5 +27,6 @@ The following procedure describes adding and updating settings of custom tracks.
* A start position and a distance (e.g. "chr1:1+100")
* A node ID anchor and a distance (e.g. "node:100+10")
![Region Input Options](helpGuideImages/img8.png)
9. Click Go to see the selected tracks render in the visualization area.
4. There is an option to click on the "Simplify Off" button to enable vg simplify, which would remove eliding small snarls in the graph. This would only work for BED files or graph tracks (not reads or haplotypes).
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This makes it sound like you can turn on simplification for all BED file chunks. It also reads like the user should expect to see a non-functional simplify button sometimes, when actually the button only appears when it is going to work.

I think we want to communicate that the button is not always visible (so people aren't surprised when they don't see it), and that people should expect to see it only when there aren't any reads to be displayed.

I think it does work with haplotype tracks; the haplotype information goes into vg chunk and the vg simplify pass happens after that.

src/common.mjs Outdated
@@ -111,6 +111,16 @@ export function defaultTrackColors(trackType){
}
}

/* Function to determine if reads are added, where tracks is an object */
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Tracks isn't just any object, right? It is meant to be an object full of track objects (which is a type we've defined).

And by "reads are added", we mean that we're checking to see if any of the tracks is a read track. I'm not sure "added" is the right word here; we're checking to see if they are present.

Comment on lines 87 to 92
let resultSimplify = result.simplify;
if (resultSimplify === "true"){
result.simplify = true;
} else if (resultSimplify === "false"){
result.simplify = false;
}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think the resultSimplify variable could be eliminated here to improve the code.

@@ -713,6 +718,11 @@ class HeaderForm extends Component {
};
};

/* Function for simplify */
enableSimplify = () => {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This doesn't actually "enable" simplification; it toggles it. I think toggling it is the correct behavior so the function name should be changed.

@@ -713,6 +718,11 @@ class HeaderForm extends Component {
};
};

/* Function for simplify */
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This comment doesn't do very much to explain the function. It should say what the function needs to do. Or you could say this is the setter function for the simplify two-way binding to the button and let that imply what it is supposed to do.

@@ -752,6 +762,9 @@ class HeaderForm extends Component {
const examplesFlag = this.state.dataType === dataTypes.EXAMPLES;
const viewTargetHasChange = !viewTargetsEqual(this.getNextViewTarget(), this.props.getCurrentViewTarget());

const ifReadsExist = readsExist(this.state.tracks);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It looks like this variable is sued exactly once, so maybe the function call should just be made where the variable is used?

Or if you need the variable to simplify the complicated logic where it is used, maybe we could move the variable closer to the logic it goes with?

src/server.mjs Outdated
VG_PATH +
"vg " +
"simplify " +
"- " +
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This doesn't accurately report the command that was called; when we run vg simplify here we give it a filename as an argument and not -.

src/server.mjs Outdated
console.log(`vg simplify exited with code ${code}`);
vgViewCall.stdin.end();
if (code !== 0) {
console.log("Error from " + VG_PATH + "vg " + "simplify - ");
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Here also we're incorrectly claiming that we called vg simplify -.

Copy link
Member

@adamnovak adamnovak left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think my comments were addressed.

@adamnovak adamnovak merged commit 050b962 into master Dec 7, 2023
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Eliding small snarls
2 participants