Skip to content

Commit

Permalink
Don't show "Show transcripts" button on mitochondrial gene page
Browse files Browse the repository at this point in the history
  • Loading branch information
phildarnowsky-broad committed Feb 11, 2025
1 parent 0211850 commit 5a61c53
Show file tree
Hide file tree
Showing 3 changed files with 1,561 additions and 7 deletions.
29 changes: 29 additions & 0 deletions browser/src/GenePage/GenePage.spec.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -281,3 +281,32 @@ describe.each([
})
}
)

describe('gene page for a mitochondrial gene', () => {
test("doesn't include a show-transcripts button", async () => {
const gene = geneFactory.build({ symbol: 'MT-ATP6', chrom: 'M' })
setMockApiResponses({
MitochondrialCoverageInGene: () => ({
gene: {
mitochondrial_coverage: [],
},
}),
MitochondrialCoverageInTranscript: () => ({
transcript: {
mitochondrial_coverage: [],
},
}),
MitochondrialVariantsInGene: () => ({
gene: { mitochondrial_variants: [], clinvar_variants: [] },
meta: { clinvar_release_date: '2022-10-31' },
}),
})

const tree = renderer.create(
<MemoryRouter>
<GenePage datasetId="gnomad_r4" gene={gene} geneId={gene.gene_id} />
</MemoryRouter>
)
expect(tree).toMatchSnapshot()
})
})
16 changes: 9 additions & 7 deletions browser/src/GenePage/GenePage.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -539,13 +539,15 @@ const GenePage = ({ datasetId, gene, geneId }: Props) => {
height={20}
width={20}
/>
<Button
onClick={() => {
setShowTranscripts((prevShowTranscripts) => !prevShowTranscripts)
}}
>
{showTranscripts ? 'Hide' : 'Show'} transcripts
</Button>
{gene.chrom !== 'M' && (
<Button
onClick={() => {
setShowTranscripts((prevShowTranscripts) => !prevShowTranscripts)
}}
>
{showTranscripts ? 'Hide' : 'Show'} transcripts
</Button>
)}
</ToggleTranscriptsPanel>
)
}}
Expand Down
Loading

0 comments on commit 5a61c53

Please sign in to comment.