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

Update default structural dataset to SVs v4 #1260

Merged
merged 5 commits into from
Nov 6, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
26 changes: 17 additions & 9 deletions browser/src/DatasetSelector.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ import queryString from 'query-string'
import React, { Component } from 'react'
import { Link, withRouter } from 'react-router-dom'
import styled from 'styled-components'

import sampleCounts from '@gnomad/dataset-metadata/sampleCounts'

import {
Expand All @@ -16,6 +15,7 @@ import {
referenceGenome,
hasCopyNumberVariants,
shortVariantDatasetId,
isV2,
} from '@gnomad/dataset-metadata/metadata'

const NavigationMenuWrapper = styled.ul`
Expand Down Expand Up @@ -457,14 +457,14 @@ const DatasetSelector = withRouter(({ datasetOptions, history, selectedDataset }
const shortVariantDatasets = [
{
id: 'current_short_variant',
isActive: hasShortVariants(selectedDataset) && !hasCopyNumberVariants(selectedDataset),
isActive: hasShortVariants(selectedDataset),
label: labelForDataset(topLevelShortVariantDataset),
url: datasetLink(topLevelShortVariantDataset),
childReferenceGenome: referenceGenome(topLevelShortVariantDataset),
},
{
id: 'other_short_variant',
isActive: hasShortVariants(selectedDataset) && !hasCopyNumberVariants(selectedDataset),
isActive: hasShortVariants(selectedDataset),
label: 'More datasets',
children: [] as ChildDataset[],
},
Expand Down Expand Up @@ -589,17 +589,25 @@ const DatasetSelector = withRouter(({ datasetOptions, history, selectedDataset }
}

if (includeStructuralVariants || includeCopyNumberVariants) {
const topLevelStructuralVariantDataset = hasStructuralVariants(selectedDataset)
? selectedDataset
: 'gnomad_sv_r2_1'
const topLevelStructuralVariantDataset: any = (() => {
if (isV2(selectedDataset)) {
return 'gnomad_sv_r2_1'
}

if (hasStructuralVariants(selectedDataset)) {
return selectedDataset
}

return 'gnomad_sv_r4'
})()

const topLevelCopyNumberVariantDataset = hasCopyNumberVariants(selectedDataset)
? selectedDataset
: 'gnomad_cnv_r4'

const currentDataset = hasStructuralVariants(selectedDataset)
? topLevelStructuralVariantDataset
: topLevelCopyNumberVariantDataset
const currentDataset = hasCopyNumberVariants(selectedDataset)
? topLevelCopyNumberVariantDataset
: topLevelStructuralVariantDataset

datasets.push(
{
Expand Down
52 changes: 26 additions & 26 deletions browser/src/GenePage/__snapshots__/GenePage.spec.tsx.snap
Original file line number Diff line number Diff line change
Expand Up @@ -7647,12 +7647,12 @@ exports[`GenePage with non-SV dataset "exac" has no unexpected changes 1`] = `
<a
className="DatasetSelector__TopLevelNavigationLink-sc-1p2fxbn-1-Link eggTrD"
data-item="current_sv_dataset"
href="/?dataset=gnomad_cnv_r4"
href="/?dataset=gnomad_sv_r4"
onBlur={[Function]}
onClick={[Function]}
onKeyDown={[Function]}
>
gnomAD CNVs v4.0
gnomAD SVs v4.0
</a>
</li>
<li
Expand Down Expand Up @@ -10621,12 +10621,12 @@ exports[`GenePage with non-SV dataset "gnomad_r2_1" has no unexpected changes 1`
<a
className="DatasetSelector__TopLevelNavigationLink-sc-1p2fxbn-1-Link eggTrD"
data-item="current_sv_dataset"
href="/?dataset=gnomad_cnv_r4"
href="/?dataset=gnomad_sv_r2_1"
onBlur={[Function]}
onClick={[Function]}
onKeyDown={[Function]}
>
gnomAD CNVs v4.0
gnomAD SVs v2.1
</a>
</li>
<li
Expand Down Expand Up @@ -12209,12 +12209,12 @@ exports[`GenePage with non-SV dataset "gnomad_r2_1_controls" has no unexpected c
<a
className="DatasetSelector__TopLevelNavigationLink-sc-1p2fxbn-1-Link eggTrD"
data-item="current_sv_dataset"
href="/?dataset=gnomad_cnv_r4"
href="/?dataset=gnomad_sv_r2_1"
onBlur={[Function]}
onClick={[Function]}
onKeyDown={[Function]}
>
gnomAD CNVs v4.0
gnomAD SVs v2.1
</a>
</li>
<li
Expand Down Expand Up @@ -13797,12 +13797,12 @@ exports[`GenePage with non-SV dataset "gnomad_r2_1_non_cancer" has no unexpected
<a
className="DatasetSelector__TopLevelNavigationLink-sc-1p2fxbn-1-Link eggTrD"
data-item="current_sv_dataset"
href="/?dataset=gnomad_cnv_r4"
href="/?dataset=gnomad_sv_r2_1"
onBlur={[Function]}
onClick={[Function]}
onKeyDown={[Function]}
>
gnomAD CNVs v4.0
gnomAD SVs v2.1
</a>
</li>
<li
Expand Down Expand Up @@ -15385,12 +15385,12 @@ exports[`GenePage with non-SV dataset "gnomad_r2_1_non_neuro" has no unexpected
<a
className="DatasetSelector__TopLevelNavigationLink-sc-1p2fxbn-1-Link eggTrD"
data-item="current_sv_dataset"
href="/?dataset=gnomad_cnv_r4"
href="/?dataset=gnomad_sv_r2_1"
onBlur={[Function]}
onClick={[Function]}
onKeyDown={[Function]}
>
gnomAD CNVs v4.0
gnomAD SVs v2.1
</a>
</li>
<li
Expand Down Expand Up @@ -16973,12 +16973,12 @@ exports[`GenePage with non-SV dataset "gnomad_r2_1_non_topmed" has no unexpected
<a
className="DatasetSelector__TopLevelNavigationLink-sc-1p2fxbn-1-Link eggTrD"
data-item="current_sv_dataset"
href="/?dataset=gnomad_cnv_r4"
href="/?dataset=gnomad_sv_r2_1"
onBlur={[Function]}
onClick={[Function]}
onKeyDown={[Function]}
>
gnomAD CNVs v4.0
gnomAD SVs v2.1
</a>
</li>
<li
Expand Down Expand Up @@ -18561,12 +18561,12 @@ exports[`GenePage with non-SV dataset "gnomad_r3" has no unexpected changes 1`]
<a
className="DatasetSelector__TopLevelNavigationLink-sc-1p2fxbn-1-Link eggTrD"
data-item="current_sv_dataset"
href="/?dataset=gnomad_cnv_r4"
href="/?dataset=gnomad_sv_r4"
onBlur={[Function]}
onClick={[Function]}
onKeyDown={[Function]}
>
gnomAD CNVs v4.0
gnomAD SVs v4.0
</a>
</li>
<li
Expand Down Expand Up @@ -20065,12 +20065,12 @@ exports[`GenePage with non-SV dataset "gnomad_r3_controls_and_biobanks" has no u
<a
className="DatasetSelector__TopLevelNavigationLink-sc-1p2fxbn-1-Link eggTrD"
data-item="current_sv_dataset"
href="/?dataset=gnomad_cnv_r4"
href="/?dataset=gnomad_sv_r4"
onBlur={[Function]}
onClick={[Function]}
onKeyDown={[Function]}
>
gnomAD CNVs v4.0
gnomAD SVs v4.0
</a>
</li>
<li
Expand Down Expand Up @@ -21569,12 +21569,12 @@ exports[`GenePage with non-SV dataset "gnomad_r3_non_cancer" has no unexpected c
<a
className="DatasetSelector__TopLevelNavigationLink-sc-1p2fxbn-1-Link eggTrD"
data-item="current_sv_dataset"
href="/?dataset=gnomad_cnv_r4"
href="/?dataset=gnomad_sv_r4"
onBlur={[Function]}
onClick={[Function]}
onKeyDown={[Function]}
>
gnomAD CNVs v4.0
gnomAD SVs v4.0
</a>
</li>
<li
Expand Down Expand Up @@ -23073,12 +23073,12 @@ exports[`GenePage with non-SV dataset "gnomad_r3_non_neuro" has no unexpected ch
<a
className="DatasetSelector__TopLevelNavigationLink-sc-1p2fxbn-1-Link eggTrD"
data-item="current_sv_dataset"
href="/?dataset=gnomad_cnv_r4"
href="/?dataset=gnomad_sv_r4"
onBlur={[Function]}
onClick={[Function]}
onKeyDown={[Function]}
>
gnomAD CNVs v4.0
gnomAD SVs v4.0
</a>
</li>
<li
Expand Down Expand Up @@ -24577,12 +24577,12 @@ exports[`GenePage with non-SV dataset "gnomad_r3_non_topmed" has no unexpected c
<a
className="DatasetSelector__TopLevelNavigationLink-sc-1p2fxbn-1-Link eggTrD"
data-item="current_sv_dataset"
href="/?dataset=gnomad_cnv_r4"
href="/?dataset=gnomad_sv_r4"
onBlur={[Function]}
onClick={[Function]}
onKeyDown={[Function]}
>
gnomAD CNVs v4.0
gnomAD SVs v4.0
</a>
</li>
<li
Expand Down Expand Up @@ -26081,12 +26081,12 @@ exports[`GenePage with non-SV dataset "gnomad_r3_non_v2" has no unexpected chang
<a
className="DatasetSelector__TopLevelNavigationLink-sc-1p2fxbn-1-Link eggTrD"
data-item="current_sv_dataset"
href="/?dataset=gnomad_cnv_r4"
href="/?dataset=gnomad_sv_r4"
onBlur={[Function]}
onClick={[Function]}
onKeyDown={[Function]}
>
gnomAD CNVs v4.0
gnomAD SVs v4.0
</a>
</li>
<li
Expand Down Expand Up @@ -27585,12 +27585,12 @@ exports[`GenePage with non-SV dataset "gnomad_r4" has no unexpected changes 1`]
<a
className="DatasetSelector__TopLevelNavigationLink-sc-1p2fxbn-1-Link eggTrD"
data-item="current_sv_dataset"
href="/?dataset=gnomad_cnv_r4"
href="/?dataset=gnomad_sv_r4"
onBlur={[Function]}
onClick={[Function]}
onKeyDown={[Function]}
>
gnomAD CNVs v4.0
gnomAD SVs v4.0
</a>
</li>
<li
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8454,12 +8454,12 @@ exports[`MitochondrialVariantPage with dataset gnomad_r3 has no unexpected chang
<a
className="DatasetSelector__TopLevelNavigationLink-sc-1p2fxbn-1-Link eggTrD"
data-item="current_sv_dataset"
href="/?dataset=gnomad_cnv_r4"
href="/?dataset=gnomad_sv_r4"
onBlur={[Function]}
onClick={[Function]}
onKeyDown={[Function]}
>
gnomAD CNVs v4.0
gnomAD SVs v4.0
</a>
</li>
<li
Expand Down Expand Up @@ -16675,12 +16675,12 @@ exports[`MitochondrialVariantPage with dataset gnomad_r3_controls_and_biobanks h
<a
className="DatasetSelector__TopLevelNavigationLink-sc-1p2fxbn-1-Link eggTrD"
data-item="current_sv_dataset"
href="/?dataset=gnomad_cnv_r4"
href="/?dataset=gnomad_sv_r4"
onBlur={[Function]}
onClick={[Function]}
onKeyDown={[Function]}
>
gnomAD CNVs v4.0
gnomAD SVs v4.0
</a>
</li>
<li
Expand Down Expand Up @@ -24896,12 +24896,12 @@ exports[`MitochondrialVariantPage with dataset gnomad_r3_non_cancer has no unexp
<a
className="DatasetSelector__TopLevelNavigationLink-sc-1p2fxbn-1-Link eggTrD"
data-item="current_sv_dataset"
href="/?dataset=gnomad_cnv_r4"
href="/?dataset=gnomad_sv_r4"
onBlur={[Function]}
onClick={[Function]}
onKeyDown={[Function]}
>
gnomAD CNVs v4.0
gnomAD SVs v4.0
</a>
</li>
<li
Expand Down Expand Up @@ -33117,12 +33117,12 @@ exports[`MitochondrialVariantPage with dataset gnomad_r3_non_neuro has no unexpe
<a
className="DatasetSelector__TopLevelNavigationLink-sc-1p2fxbn-1-Link eggTrD"
data-item="current_sv_dataset"
href="/?dataset=gnomad_cnv_r4"
href="/?dataset=gnomad_sv_r4"
onBlur={[Function]}
onClick={[Function]}
onKeyDown={[Function]}
>
gnomAD CNVs v4.0
gnomAD SVs v4.0
</a>
</li>
<li
Expand Down Expand Up @@ -41338,12 +41338,12 @@ exports[`MitochondrialVariantPage with dataset gnomad_r3_non_topmed has no unexp
<a
className="DatasetSelector__TopLevelNavigationLink-sc-1p2fxbn-1-Link eggTrD"
data-item="current_sv_dataset"
href="/?dataset=gnomad_cnv_r4"
href="/?dataset=gnomad_sv_r4"
onBlur={[Function]}
onClick={[Function]}
onKeyDown={[Function]}
>
gnomAD CNVs v4.0
gnomAD SVs v4.0
</a>
</li>
<li
Expand Down Expand Up @@ -49559,12 +49559,12 @@ exports[`MitochondrialVariantPage with dataset gnomad_r3_non_v2 has no unexpecte
<a
className="DatasetSelector__TopLevelNavigationLink-sc-1p2fxbn-1-Link eggTrD"
data-item="current_sv_dataset"
href="/?dataset=gnomad_cnv_r4"
href="/?dataset=gnomad_sv_r4"
onBlur={[Function]}
onClick={[Function]}
onKeyDown={[Function]}
>
gnomAD CNVs v4.0
gnomAD SVs v4.0
</a>
</li>
<li
Expand Down Expand Up @@ -57780,12 +57780,12 @@ exports[`MitochondrialVariantPage with dataset gnomad_r4 has no unexpected chang
<a
className="DatasetSelector__TopLevelNavigationLink-sc-1p2fxbn-1-Link eggTrD"
data-item="current_sv_dataset"
href="/?dataset=gnomad_cnv_r4"
href="/?dataset=gnomad_sv_r4"
onBlur={[Function]}
onClick={[Function]}
onKeyDown={[Function]}
>
gnomAD CNVs v4.0
gnomAD SVs v4.0
</a>
</li>
<li
Expand Down
Loading
Loading