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

Remove Node Sequences Option #414

Merged
merged 20 commits into from
Apr 26, 2024
Merged

Remove Node Sequences Option #414

merged 20 commits into from
Apr 26, 2024

Conversation

shreyasun
Copy link
Collaborator

Fixes #349

@adamnovak adamnovak self-requested a review April 9, 2024 15:05
@adamnovak
Copy link
Member

I think the test is failing because &dataPath=default got added back to the expected link during the merge.

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, but there are some places where I would like the code cleaned up before merging it.

Also, for PRs that add new UI like this, it would be good to have a screenshot included to show how it looks.

src/components/HeaderForm.js Show resolved Hide resolved
@@ -825,6 +832,19 @@ class HeaderForm extends Component {
this.setState({ simplify: !this.state.simplify });
};

/* Function for toggling nodeSequences button, enabling client to make request for node sequences to be displayed or note */
Copy link
Member

Choose a reason for hiding this comment

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

I don't think nodeSequences is a variable or function name, and note is a typo. We could simplify the sentence to something like:

Suggested change
/* Function for toggling nodeSequences button, enabling client to make request for node sequences to be displayed or note */
/* Function for toggling display of node sequences */

Comment on lines 840 to 846
openPopup = () => {
this.setState({ popupOpen: !this.state.popupOpen });
};

closePopup = () => {
this.setState({ popupOpen: !this.state.popupOpen });
};
Copy link
Member

Choose a reason for hiding this comment

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

These are called openPopup and closePopup but really they are two copies of a toggle-the-popup function. Either they should always do what their names say, or there should just be one togglePopup.

@@ -49,6 +49,7 @@
"react-scripts": "5.0.1",
"react-select": "^5.7.3",
"react-select-event": "^5.5.1",
"react-switch": "^7.0.0",
Copy link
Member

Choose a reason for hiding this comment

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

This is not actually the switch component documented at https://mui.com/material-ui/react-switch/ that I thought we were using. This is a completely different package documented at https://www.npmjs.com/package/react-switch#usage which has about the same API.

This one might be a little better, so maybe we should keep it?

@@ -339,7 +339,7 @@ describe("When we wait for it to load", () => {
it("produces correct link for view before & after go is pressed", async () => {
// First test that after pressing go, the link reflects the dat form
const expectedLinkBRCA1 =
"http://localhost?name=snp1kg-BRCA1&tracks[0][trackFile]=exampleData%2Finternal%2Fsnp1kg-BRCA1.vg.xg&tracks[0][trackType]=graph&tracks[0][trackColorSettings][mainPalette]=greys&tracks[0][trackColorSettings][auxPalette]=ygreys&tracks[1][trackFile]=exampleData%2Finternal%2FNA12878-BRCA1.sorted.gam&tracks[1][trackType]=read&region=17%3A1-100&bedFile=exampleData%2Finternal%2Fsnp1kg-BRCA1.bed&dataType=built-in&simplify=false";
"http://localhost?name=snp1kg-BRCA1&tracks[0][trackFile]=exampleData%2Finternal%2Fsnp1kg-BRCA1.vg.xg&tracks[0][trackType]=graph&tracks[0][trackColorSettings][mainPalette]=greys&tracks[0][trackColorSettings][auxPalette]=ygreys&tracks[1][trackFile]=exampleData%2Finternal%2FNA12878-BRCA1.sorted.gam&tracks[1][trackType]=read&dataPath=default&region=17%3A1-100&bedFile=exampleData%2Finternal%2Fsnp1kg-BRCA1.bed&dataType=built-in&simplify=false&removeSequences=false";
Copy link
Member

Choose a reason for hiding this comment

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

You probably don't mean to add back dataPath.

Suggested change
"http://localhost?name=snp1kg-BRCA1&tracks[0][trackFile]=exampleData%2Finternal%2Fsnp1kg-BRCA1.vg.xg&tracks[0][trackType]=graph&tracks[0][trackColorSettings][mainPalette]=greys&tracks[0][trackColorSettings][auxPalette]=ygreys&tracks[1][trackFile]=exampleData%2Finternal%2FNA12878-BRCA1.sorted.gam&tracks[1][trackType]=read&dataPath=default&region=17%3A1-100&bedFile=exampleData%2Finternal%2Fsnp1kg-BRCA1.bed&dataType=built-in&simplify=false&removeSequences=false";
"http://localhost?name=snp1kg-BRCA1&tracks[0][trackFile]=exampleData%2Finternal%2Fsnp1kg-BRCA1.vg.xg&tracks[0][trackType]=graph&tracks[0][trackColorSettings][mainPalette]=greys&tracks[0][trackColorSettings][auxPalette]=ygreys&tracks[1][trackFile]=exampleData%2Finternal%2FNA12878-BRCA1.sorted.gam&tracks[1][trackType]=read&region=17%3A1-100&bedFile=exampleData%2Finternal%2Fsnp1kg-BRCA1.bed&dataType=built-in&simplify=false&removeSequences=false";

src/server.mjs Outdated
{
sequence: "AGCT"
id: "1"
,
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
,
},

src/server.mjs Outdated
node: [
{
id: "1"
,
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
,
},

src/server.mjs Outdated
Comment on lines 397 to 399
]
edge: []
path: []
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
]
edge: []
path: []
],
edge: [],
path: []

src/server.mjs Outdated
Comment on lines 410 to 412
]
edge: []
path: []
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
]
edge: []
path: []
],
edge: [],
path: []

src/server.mjs Outdated
return;
}
graph.node.forEach(function(node) {
console.log("node sequence to delete:", node)
Copy link
Member

Choose a reason for hiding this comment

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

We probably should cut this; people are going to remove sequence because there's a lot of it, and we don't want a lot of sequence going to the logs.

Suggested change
console.log("node sequence to delete:", node)

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 don't think trying to use !this.openPopup as a close event handler is going to work. I think if you take the suggestions here the dialog will actually work when you go to open and close it manually; it looks like it is probably broken right now.

>
<FontAwesomeIcon icon={faGear} /> Simplify
</Button>
<PopupDialog open={this.state.popupOpen} close={!this.openPopup} width="400px">
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 openPopup() maybe needs to be renamed to togglePopup()? And you would just pass it here? It looks like you are trying to negate the function and I don't think this will actually work if you run it and try and open the dialog (so maybe that warrants a test?).

Suggested change
<PopupDialog open={this.state.popupOpen} close={!this.openPopup} width="400px">
<PopupDialog open={this.state.popupOpen} close={this.togglePopup} width="400px">

this.setState({ removeSequences: !this.state.removeSequences });
};

openPopup = () => {
Copy link
Member

Choose a reason for hiding this comment

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

This really toggles it.

Suggested change
openPopup = () => {
togglePopup = () => {

{!readsExist(this.state.tracks) && (
<>
<Button
onClick={this.openPopup}
Copy link
Member

Choose a reason for hiding this comment

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

If we rename the function we'd change it here too.

Suggested change
onClick={this.openPopup}
onClick={this.togglePopup}

@adamnovak adamnovak merged commit 5ef0f26 into master Apr 26, 2024
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.

Allow eliding node sequences from the server response
2 participants