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

Add v4 CNVs #1176

Closed
wants to merge 62 commits into from
Closed

Add v4 CNVs #1176

wants to merge 62 commits into from

Conversation

elissa-alarmani
Copy link
Collaborator

No description provided.

@elissa-alarmani elissa-alarmani linked an issue Sep 21, 2023 that may be closed by this pull request
11 tasks
@elissa-alarmani elissa-alarmani self-assigned this Sep 21, 2023
@elissa-alarmani elissa-alarmani marked this pull request as draft October 10, 2023 13:37
@elissa-alarmani elissa-alarmani changed the title CNVs Draft Add v4 CNVs Oct 10, 2023
@elissa-alarmani elissa-alarmani marked this pull request as ready for review October 26, 2023 21:55
Copy link
Contributor

@rileyhgrant rileyhgrant left a comment

Choose a reason for hiding this comment

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

I didn't look through every commit, as I believe Phil is working on that, but I did want to chime in and say I noticed that on the demo, searching anything causes a crash of the page.

I'm unsure if there's some relatively quick way to disable the search feature for the v4_cnvs dataset only -- that could be a straightforward way to get the MVP out, and we could just file an issue on that and tackle it later.

Also, the amount of SVs is generally so small for a given gene, that I doubt anyone would really use the search feature.


Edit for clarity, screenshot below. Searching of a CNV variant table causes the page to crash.

@mattsolo1
Copy link
Contributor

Thanks RIley -- we def need to fix search.

@phildarnowsky-broad
Copy link
Contributor

phildarnowsky-broad commented Oct 29, 2023 via email

@elissa-alarmani
Copy link
Collaborator Author

I didn't change the demo yet, but I assumed the issue was that the coverage wasn't loading. I can access gene pages fine through the search but I am starting to notice the coverage isn't appearing when you search for genes vs go to the direct page

@rileyhgrant
Copy link
Contributor

rileyhgrant commented Oct 29, 2023

Sorry, I wasn't clear. I mean the search on the variant table:

Screenshot 2023-10-29 at 16 24 04

The console in the demo does give a helpful error message with some line numbers.

Possibly not a huge deal, as I doubt many people are going to search a table with a handful of CNVs anyways, but I wanted to flag it cause it does cause a hard crash.

@phildarnowsky-broad
Copy link
Contributor

phildarnowsky-broad commented Oct 29, 2023 via email

@elissa-alarmani
Copy link
Collaborator Author

Thanks for pointing that out Riley! Fixed it and it was a small bug with the getSearchTerms not returning strings

Copy link
Contributor

@phildarnowsky-broad phildarnowsky-broad left a comment

Choose a reason for hiding this comment

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

I requested quite a few changes, most of which involve cleaning the commit history to make it clearer what's going on. It's probably best if we get together in the morning and walk through the first few rebases together. After that, I'll need to give this at least one more look.

@@ -0,0 +1,558 @@
{
Copy link
Contributor

Choose a reason for hiding this comment

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

There's a couple of changes I'm going to request to this PR that all fall into the category of making the commit history easier to follow. This is beneficial both in the short term as I review this PR now, and in the long term when we have to go back and work on this page later. Apart from that I'll give this general review both before and after you make those changes.

The ideal when you're merging a PR is that, if somebody is reading your commits one after the other, it should look basically like you got all the code right the first time, making a series of commits at logical points as you complete individual parts of what you're working on. Of course this is a lie and everyone reading the log knows it, but it does make the code much easier to understand for the reviewer or maintainer.

The main tool for neatening your commit history is interactive rebasing via git rebase -i. This can be kind of a subtle process so I'm going to start out by giving pretty explicit instructions about what I'm suggesting, but you'll get the idea quickly no doubt.

All that is general context, specific advice to follow.

v4-cnvs-test1.ipynb Outdated Show resolved Hide resolved
"block_size": 10_000,
},
},
"gnomad_v4_cnv_del_burden": {
Copy link
Contributor

Choose a reason for hiding this comment

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

This index, as well as dup_burden, don't appear to be used. They're not exposed by the GraphQL API, nor are they inputs to other pipelines. If they're not in fact used by anything, we shouldn't have the pipelines to build or export this data either.

strokeWidth={1}
/>
(
<React.Fragment>
Copy link
Contributor

Choose a reason for hiding this comment

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

FYI <> is equivalent to <React.Fragment>

@@ -0,0 +1,61 @@
import PropTypes from 'prop-types'
Copy link
Contributor

@phildarnowsky-broad phildarnowsky-broad Oct 29, 2023

Choose a reason for hiding this comment

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

We don't use proptypes in new code. But leave it for now.

)

// @ts-expect-error TS(7031) FIXME: Binding element 'scrollOffset' implicitly has an '... Remove this comment to see the full error message
const onScrollTable = useCallback(({ scrollOffset, scrollUpdateWasRequested }) => {
Copy link
Contributor

Choose a reason for hiding this comment

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

As a rule, don't name callback functions for the callback they're attached to. Rather, use the name to describe what they do, as you would with any other function. For instance, here you might call the function scrollToCurrentTrack.

@@ -33,7 +33,7 @@ exports[`CopyNumberVariantPage with dataset gnomad_cnv_r4 with variant of type D
>
<a
className="DatasetSelector__TopLevelNavigationLink-sc-1p2fxbn-1-Link eggTrD"
data-item="current_sv_or_cnv_dataset"
data-item="current_sv_dataset"
Copy link
Contributor

@phildarnowsky-broad phildarnowsky-broad Oct 29, 2023

Choose a reason for hiding this comment

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

I'm not clear on what this commit is about either. nvm, it was late and I was tired and now it's pretty clear.

@mattsolo1
Copy link
Contributor

@phildarnowsky-broad in the interest of time, should we opt for merging this soon and you guys can review the PR as a retrospective later this week? I sort of assured Elissa not to worry too much about commits so that we can get the feature done.

@phildarnowsky-broad
Copy link
Contributor

@elissa-alarmani as discussed, due to time pressure, I'm going to fork this branch and prepare a new one with the rebases I mention applied. Once the rush is done we can work through this one together, rebasing is an extremely valuable thing to have in your toolbox.

}
`

const CheckboxWrapper = styled.div`
Copy link
Contributor

Choose a reason for hiding this comment

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

For future reference if you find yourself wanting to write a styled component with no styles, it's probably fine to just use the ordinary HTML element in its place, e.g. <div> here. Don't worry about it for now though.

childReferenceGenome: referenceGenome('gnomad_cnv_r4'),
},
],
}
},
Copy link
Contributor

Choose a reason for hiding this comment

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

this commented-out chunk can come out and so it does, in a later commit. This spot is a good example of the value of tidying your commit history via rebase, since I spent a little time here reviewing a piece of code that later was cut, meaning that time was wasted.

}
}
`
const url = datasetId === 'gnomad_cnv_r4' ? '/api' : 'https://gnomad.broadinstitute.org/api/'
Copy link
Contributor

Choose a reason for hiding this comment

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

Don't forget to remove this bit before merging. When I have to do something like this which is purely to rig something temporarily for a demo, I often do that in a separate commit prefixed with the label DONTMERGE, that way I'll see it and remember to drop that commit before I merge to main

@@ -0,0 +1,309 @@
import React, { useCallback, useMemo, useRef, useState } from 'react'
Copy link
Contributor

Choose a reason for hiding this comment

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

Pretty sure I see a lot of copypasta in this file but given the circumstances I'm inclined to turn a blind eye this time. Maybe let's you and I look more carefully at this in the near future after the crunch is done.

@mattsolo1
Copy link
Contributor

Closed after rebase in #1225

@mattsolo1 mattsolo1 closed this Oct 30, 2023
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.

Add gnomAD v4 CNVs
4 participants