-
Notifications
You must be signed in to change notification settings - Fork 45
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add mitochondrial regional constraint visualizations
- Loading branch information
1 parent
50722d0
commit f0c671c
Showing
11 changed files
with
431 additions
and
96 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
46 changes: 46 additions & 0 deletions
46
browser/src/GenePage/MitochondrialRegionConstraintTrack.spec.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
import React from 'react' | ||
import renderer from 'react-test-renderer' | ||
import { expect, test } from '@jest/globals' | ||
import MitochondrialRegionConstraintTrack, { | ||
MitochondrialConstraintRegion, | ||
} from './MitochondrialRegionConstraintTrack' | ||
import { Exon } from '../TranscriptPage/TranscriptPage' | ||
// @ts-expect-error | ||
import { RegionViewerContext } from '@gnomad/region-viewer' | ||
|
||
const childProps = { | ||
centerPanelWidth: 3, | ||
isPositionDefined: true, | ||
leftPanelWidth: 4, | ||
regions: [], | ||
rightPanelWidth: 5, | ||
scalePosition: (i: number) => i, | ||
} | ||
|
||
const exons: Exon[] = [ | ||
{ feature_type: 'CDS', start: 123, stop: 234 }, | ||
{ feature_type: 'UTR', start: 235, stop: 999 }, | ||
{ feature_type: 'CDS', start: 1000, stop: 1999 }, | ||
] | ||
|
||
test('track has no unexpected changes when gene has constraint', () => { | ||
const constraintRegions: MitochondrialConstraintRegion[] = [ | ||
{ start: 555, stop: 666, oe: 0.45, oe_lower: 0.37, oe_upper: 0.47 }, | ||
{ start: 777, stop: 888, oe: 0.56, oe_lower: 0.52, oe_upper: 0.59 }, | ||
] | ||
const tree = renderer.create( | ||
<RegionViewerContext.Provider value={childProps}> | ||
<MitochondrialRegionConstraintTrack constraintRegions={constraintRegions} exons={exons} /> | ||
</RegionViewerContext.Provider> | ||
) | ||
expect(tree).toMatchSnapshot() | ||
}) | ||
|
||
test('track has no unexpected changes when no constraint for gene', () => { | ||
const tree = renderer.create( | ||
<RegionViewerContext.Provider value={childProps}> | ||
<MitochondrialRegionConstraintTrack constraintRegions={null} exons={exons} /> | ||
</RegionViewerContext.Provider> | ||
) | ||
expect(tree).toMatchSnapshot() | ||
}) |
Oops, something went wrong.