diff --git a/packages/core/.storybook/main.js b/packages/core/.storybook/main.js index 840601b0f6..52a1d5b4b4 100644 --- a/packages/core/.storybook/main.js +++ b/packages/core/.storybook/main.js @@ -1,6 +1,5 @@ module.exports = { stories: ['../stories/**/*.mdx', '../stories/**/*.stories.@(js|jsx|ts|tsx)'], - staticDirs: ['../public'], addons: ['@storybook/addon-essentials'], framework: { name: '@storybook/react-webpack5', diff --git a/packages/core/BaseFeatureWidget/SequenceFeatureDetails/SequenceFeatureDetails.test.tsx b/packages/core/BaseFeatureWidget/SequenceFeatureDetails/SequenceFeatureDetails.test.tsx index 23a2b194c4..afbb62694d 100644 --- a/packages/core/BaseFeatureWidget/SequenceFeatureDetails/SequenceFeatureDetails.test.tsx +++ b/packages/core/BaseFeatureWidget/SequenceFeatureDetails/SequenceFeatureDetails.test.tsx @@ -10,6 +10,20 @@ import { SequenceFeatureDetailsF } from './model' import DLGAP3 from './test_data/DLGAP3' import NCDN from './test_data/NCDN' +const f = { + start: 1200, + end: 1500, + refName: 'chr1', + strand: 1, + type: 'mRNA', + uniqueId: 'unique', + name: 'made_up', + subfeatures: [ + { refName: 'chr1', start: 1200, end: 1500, type: 'exon' }, + { refName: 'chr1', start: 1200, end: 1500, type: 'CDS' }, + ], +} + const readFasta = (filename: string) => { return fs .readFileSync(require.resolve(filename), 'utf8') @@ -129,18 +143,7 @@ test('NCDN updownstream', () => { ) const element = getByTestId('sequence_panel') - expect(element.textContent).toMatchSnapshot() - - // expect(element.children[1].textContent).toEqual( - // 'AGTGGGCAACGCGGCGTGAGCAGCGGCCCGAGGCTCCCGGAGCATCGCGCTGGGAGAAGACTTCGCCGCTCGGGGCCGCAGCCTGGTGAGCTCAGCCCCCTTCGGGCCCTCCCCTGCATCCCAGCCGGGGCCTCTCCGAGCCGGCGCTGATCGATGCCGACACACCCCGGGGACCCTATCGCGACTCCATCGCGCCATATCGCGACACCATCGTGCCCTGTCGAGACTCCATTTTGTCACAGCCCTTTTCAATATATATCTTTTTTTTTTTTAATTTGCCCTGTCATCTTTGGGGGCTGTCTCCCATGTCGTGATTTTGACGTGATCTCTCCGTGACATCACCGCGCCATCGTGAAGTGTGATCTCATCGCCGCCCTGTCGTGACTTCATCA', - // ) - - // 3rd is a blank element, so go to 4th, not strictly needed for 3rd to be - // blank but helps test - // expect(element.children[3].textContent).toEqual( - // 'ATGTCGTGTTGTGACCTGGCTGCGGCGGGACAG', - // ) }) test('single exon cDNA should not have duplicate sequences', () => { @@ -148,21 +151,7 @@ test('single exon cDNA should not have duplicate sequences', () => { const model = SequenceFeatureDetailsF().create() model.setMode('cdna') const { getByTestId } = render( - , + , ) const element = getByTestId('sequence_panel') @@ -177,3 +166,29 @@ test('single exon cDNA should not have duplicate sequences', () => { 'ATGTCACCTCGGGTACTGCCTCTATTACAGAGGTATCTTAATGGCGCATCCAGCCTTGTGGCTGGGTCTACGTACGCGTGGGCACCATACGTATGTTGGCAGGAAAGGTCAATCATGCTTGTTTCCTCGTCGCAGAAACGTTCACACTATTGGCTCGCGGGATCGAACGGGCCTGATTATTTTTCCAGCTCCTGCGTTCCTATCACGCCAACTGTCGCTAATAAAATGTTATATAGAGATAACCCATTGCTATGCAAGGATGGAGAAACCGCTTCACAACACCCTAGAATTACTTCAGCA', ) }) + +test('single exon cDNA display genomic coords', () => { + const seq = readFasta('./test_data/volvox.fa') + const model = SequenceFeatureDetailsF().create() + model.setMode('gene') + model.setShowCoordinates('genomic') + const { getByTestId } = render( + , + ) + + const element = getByTestId('sequence_panel') + expect(element.textContent).toMatchSnapshot() +}) + +test('single exon cDNA display relative coords', () => { + const seq = readFasta('./test_data/volvox.fa') + const model = SequenceFeatureDetailsF().create() + model.setMode('gene') + model.setShowCoordinates('relative') + const { getByTestId } = render( + , + ) + + const element = getByTestId('sequence_panel') + expect(element.textContent).toMatchSnapshot() +}) diff --git a/packages/core/BaseFeatureWidget/SequenceFeatureDetails/SequenceFeatureDetails.tsx b/packages/core/BaseFeatureWidget/SequenceFeatureDetails/SequenceFeatureDetails.tsx index 92aa113138..171874c53d 100644 --- a/packages/core/BaseFeatureWidget/SequenceFeatureDetails/SequenceFeatureDetails.tsx +++ b/packages/core/BaseFeatureWidget/SequenceFeatureDetails/SequenceFeatureDetails.tsx @@ -1,11 +1,11 @@ -import React, { lazy, useRef, useState, Suspense } from 'react' +import React, { lazy, useRef, useState, Suspense, useEffect } from 'react' import { Button, Typography } from '@mui/material' import { observer } from 'mobx-react' // locals import { useFeatureSequence } from './hooks' import { ErrorMessage, LoadingEllipses } from '../../ui' -import { SimpleFeatureSerialized, getSession } from '../../util' +import { SimpleFeatureSerialized } from '../../util' import { BaseFeatureWidgetModel } from '../stateModelFactory' // icons @@ -29,6 +29,7 @@ const SequenceFeatureDetails = observer(function ({ const { upDownBp } = sequenceFeatureDetails const seqPanelRef = useRef(null) + const [openInDialog, setOpenInDialog] = useState(false) const [force, setForce] = useState(false) const { sequence, error } = useFeatureSequence( model, @@ -36,15 +37,14 @@ const SequenceFeatureDetails = observer(function ({ upDownBp, force, ) + useEffect(() => { + sequenceFeatureDetails.setFeature(feature) + }, [sequenceFeatureDetails, feature]) return ( <>
- - + { - getSession(model).queueDialog(handleClose => [ - SequenceDialog, - { model, feature, handleClose }, - ]) + // this is given a setTimeout because it allows the menu to + // close before dialog opens + setTimeout(() => setOpenInDialog(true), 1) }, }, ]} />
-
- {feature.type === 'gene' ? ( - - Note: inspect subfeature sequences for protein/CDS computations - - ) : null} - {error ? ( - - ) : !sequence ? ( - - ) : sequence ? ( - 'error' in sequence ? ( - <> - {sequence.error} - - + {openInDialog ? ( +
+ Open in dialog... + }> + setOpenInDialog(false)} + /> + +
+ ) : ( +
+ {feature.type === 'gene' ? ( + + Note: inspect subfeature sequences for protein/CDS computations + + ) : null} + {error ? ( + + ) : !sequence ? ( + + ) : sequence ? ( + 'error' in sequence ? ( + <> + {sequence.error} + + + ) : ( + }> + + + ) ) : ( - }> - - - ) - ) : ( - No sequence found - )} -
+ No sequence found + )} +
+ )} ) }) diff --git a/packages/core/BaseFeatureWidget/SequenceFeatureDetails/SequencePanel.tsx b/packages/core/BaseFeatureWidget/SequenceFeatureDetails/SequencePanel.tsx index 09156f2137..30de2e3ff7 100644 --- a/packages/core/BaseFeatureWidget/SequenceFeatureDetails/SequencePanel.tsx +++ b/packages/core/BaseFeatureWidget/SequenceFeatureDetails/SequencePanel.tsx @@ -5,6 +5,7 @@ import { defaultCodonTable, generateCodonTable, revcom, + toLocale, } from '../../util' import { SeqState, @@ -137,9 +138,9 @@ const SequencePanel = observer(
{`>${[ (feature.name || feature.id) + '-' + mode, - `${feature.refName}:${feature.start + 1}-${feature.end}(${getStrand(feature.strand as number)})`, + `${feature.refName}:${toLocale(feature.start + 1)}-${toLocale(feature.end)}(${getStrand(feature.strand as number)})`, mode.endsWith('updownstream') - ? `+/- ${model.upDownBp} up/downstream bp` + ? `+/- ${toLocale(model.upDownBp)} up/downstream bp` : '', ] .filter(f => !!f) diff --git a/packages/core/BaseFeatureWidget/SequenceFeatureDetails/__snapshots__/SequenceFeatureDetails.test.tsx.snap b/packages/core/BaseFeatureWidget/SequenceFeatureDetails/__snapshots__/SequenceFeatureDetails.test.tsx.snap index 057c0b841a..79ddb15aa2 100644 --- a/packages/core/BaseFeatureWidget/SequenceFeatureDetails/__snapshots__/SequenceFeatureDetails.test.tsx.snap +++ b/packages/core/BaseFeatureWidget/SequenceFeatureDetails/__snapshots__/SequenceFeatureDetails.test.tsx.snap @@ -1,11 +1,27 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP exports[`NCDN collapsed intron 1`] = ` -">NM_014284.3-gene_collapsed_intron NC_000001.10:36023400-36032380(+) +">NM_014284.3-gene_collapsed_intron NC_000001.10:36,023,400-36,032,380(+) agtgggcaacgcggcgtgagcagcggcccgaggctcccggagcatcgcgctgggagaagacttcgccgctcggggccgcagcctggtgagctcagcccccttcgggccctcccctgcatcccagccggggcctctccgagccggcgctgatcgatgccgacacaccccggggaccctatcgcgactccatcgcgccatatcgcgacaccatcgtgccctgtcgagactccattttgtcacagcccttttcaatatatatcttttttttttttaatttgccctgtcatctttgggggctgtctcccatgtcgtgattttgacgtgatctctccgtgacatcaccgcgccatcgtgaagtgtgatctcatcgccgccctgtcgtgacttcatcaATGTCGTGTTGTGACCTGGCTGCGGCGGGACAGgtggtgaccg...gtgttcacagTTGGGCAAGGCGAGCATCATGGCCTCGGATTGCGAGCCAGCTCTGAACCAGGCAGAGGGCCGAAACCCCACCCTGGAGCGCTACCTGGGAGCCCTCCGTGAGGCCAAGAATGACAGCGAGCAGTTTGCAGCCCTGCTGCTAgtaaggaact...ccccctatagGTGACCAAGGCAGTCAAAGCAGGTGACATAGATGCCAAAACTCGGCGGCGGATCTTCGATGCTGTCGGCTTCACCTTCCCCAATCGTCTCCTGACCACCAAGGAGGCGCCGGATGGCTGCCCTGACCATGTTCTGCGGGCTTTGGGTGTGGCCCTGCTGGCCTGCTTCTGCAGTGACCCTGAACTGGCCGCCCATCCCCAAGTCCTGAACAAGATTCCCATTCTTAGCACCTTCCTCACAGCCCGGGGGGACCCGGACGATGCTGCCCGCCGCTCCATGATTGATGACACCTACCAGTGCCTGACGGCTGTAGCAGGCACACCCAGAGGGCCTCGGCACCTCATTGCTGGTGGCACCGTGTCTGCCCTATGCCAGGCATACCTGGGGCACGGCTATGGCTTTGACCAGGCCCTGGCACTCCTGGTGGGGCTGCTGGCTGCTGCCGAGACACAGTGCTGGAAGGAGGCGGAGCCCGACCTGCTGGCCGTGTTGCGGGGCCTCAGTGAGGATTTCCAGAAAGCTGAGGATGCCAGCAAGTTTGAGCTCTGCCAGCTGCTGCCCCTCTTTTTGCCCCCGACAACCGTGCCCCCTGAATGCTACCGGGATCTGCAGGCCGGGCTGGCACGCATCCTGGGAAGCAAGCTGAGCTCCTGGCAGCGCAACCCTGCACTGAAGCTGGCAGCCCGCCTGGCACACGCCTGCGGCTCCGACTGGATCCCGGCGGGCAGCTCCGGGAGCAAGTTCCTGGCCCTGCTGGTGAATCTGGCGTGCGTGGAAGTGCGGCTGGCACTGGAGGAGACGGGCACGGAGGTGAAAGAGGATGTGGTGACCGCCTGCTATGCCCTCATGGAGTTGGGGATCCAGGAATGCACTCGCTGTGAGCAGTCACTGCTTAAGGAGCCACAGAAGGTGCAGCTCGTGAGCGTCATGAAGGAGGCCATAGGGGCTGTTATCCACTACCTGCTGCAGgtgagggtgc...gtggcaacagGTGGGGTCAGAGAAGCAGAAGGAGCCCTTTGTGTTTGCCTCGGTGCGGATCCTGGGTGCCTGGCTGGCCGAGGAGACCTCATCCTTGCGTAAGGAGGTGTGCCAGCTGCTGCCCTTCCTCGTCCGCTATGCCAAGACCCTCTACGAGGAGGCCGAGGAGGCCAATGACCTTTCCCAGCAGGTGGCCAACCTGGCCATCTCCCCCACCACCCCAGGGCCCACCTGGCCAGGAGACGCTCTCCGgtgagtctgt...acatccccagGCTCCTCCTGCCTGGCTGGTGCCACCTGACCGTTGAAGATGGGCCCCGGGAGATCCTGATCAAGGAAGGGGCCCCCTCGCTTCTGTGCAAGTATTTCCTGCAGCAGTGGGAACTCACATCCCCTGGCCACGACACCTCGGTGCTGCCTGACAGCGTGGAGATTGGCCTGCAGACCTGCTGCCACATCTTCCTCAACCTCGTGGTCACCGCACCGGGGCTGATCAAgtgaggggct...tcttttccagGCGTGACGCCTGCTTCACATCTCTAATGAACACCCTCATGACGTCGCTACCAGCACTAGTGCAGCAACAGGGAAGGCTGCTTCTGGCTGCTAATGTGGCCACCCTGGGGCTCCTCATGGCCCGGCTCCTTAGCACCTCTCCAGgtaagaactg...taccttgcagCTCTTCAGGGAACACCAGCATCCCGAGGGTTCTTCGCAGCTGCCATCCTCTTCCTATCACAGTCCCACGTGGCGCGGGCCACCCCGGGCTCAGACCAGGCAGTGCTAGCCCTGTCCCCTGAGTATGAGGGCATCTGGGCCGACCTGCAGGAGCTCTGGTTCCTGGGCATGCAGGCCTTCACCGGCTGTGTGCCTCTGCTGCCCTGGCTGGCCCCCGCTGCCCTGCGCTCCCGCTGGCCGCAGGAGCTGCTCCAGCTGCTAGGCAGTGTCAGCCCCAACTCTGTCAAGCCCGAGATGGTGGCCGCCTATCAGGGTGTCCTGGTGGAGCTGGCGCGGGCCAACCGGCTGTGCCGGGAGGCCATGAGGCTGCAGGCGGGCGAGGAGACGGCCAGCCACTACCGCATGGCTGCCTTGGAGCAGTGCCTGTCAGAGCCCTGAggggtgtccaccggggacagacccaggggcgggcagagagggaaggagggaggaggcatcttccctgaagcccccaatctggcccccccctccccagacttcctccccaaaacaccccagctttctggcttttctgagggcaagggcatggtgcccacccctcaagtgtaaggaactgcgttccgcccctcaggcccccatgggggcagggatcggcttggaaatcaacgtggttgtccccgccaggccggggaaggttggagcagcccccagggaggggggcactaggtgtcattgtgcccgatgtctggctcccctgcaggagggaggctccagggtaagacagggctggcaggagcagactgcctcagcccatgtgccctgccggccagggcgtgggctcccctcggctgtggtgcctcctctggccccccaggtccacgtcctttaaattggccctttggctcttgcccttggctcccttgggcagacagcaggcttaggccattgatatcgcagttcttcctatcagcttcagtgacccagggtctgaactgcctccatcctagggcaacctggggcagacaggcctggtggggggtggggaaacctccttccacctgagcttgcttgaagggacccagagtctttgggcccagatctttaaacctttgtgtcgtgttgcagcagagtgacgatgggggttggggggttatttattttgcctgtccttatccctgcttggacacctgagcatctgattcctgtccccctggtgccatctggcctggctggagccaggaacaggagggacacttccccagaatccgcatgtttccccagtgattacactccactgccaccgtggtgcctggctttaactcccacccctgctatgactcctctctgcagagacgcgactggcggctccagcagggactacctttcttataaacccagggggaccacacacacacacacacacacacacacacacacacacacacacacacacactcttgatcccttgcttccctcccccagtgcgttctgtgatcgccaagttcaaagctgtgcacatgtggacactcaataaatgttcattggtgacgagaa" `; exports[`NCDN updownstream 1`] = ` -">NM_014284.3-gene_updownstream NC_000001.10:36023400-36032380(+) +/- 100 up/downstream bp +">NM_014284.3-gene_updownstream NC_000001.10:36,023,400-36,032,380(+) +/- 100 up/downstream bp ctcacccggaggaggaggaggaagaggaagaaggtagtgcgggctccccacccggacagctacctctcgcctcagcctccctggacagcgacggcggccggaaacaccgcctcctcccacctccccgggaccgacccggaaacacactctccatgctaaccaagccctcccgcccctcccccgggaagggcaatgccggccgcgagaccaagggggaggaggggcagtgctgggcgggtaaaactacgcacaagcgaaggaatctgggcccccagcctctcgccgcccgctctccagaggcagtctgcaccttgcctccttcgctcgagccccagcccccagactcgggcaatacccacaagcaagatggcggcaacggcggcaccccctactgcttagcaccctgacttgccattggccagagcccggagtgaagcagccgcggattcgtcaagagcggtgcgggggtgggggtggagctgcagcagcctggagccaggagtgggcaacgcggcgtgagcagcggcccgaggctcccggagcatcgcgctgggagaagacttcgccgctcggggccgcagcctggtgagctcagcccccttcgggccctcccctgcatcccagccggggcctctccgagccggcgctgatcgatgccgacacaccccggggaccctatcgcgactccatcgcgccatatcgcgacaccatcgtgccctgtcgagactccattttgtcacagcccttttcaatatatatcttttttttttttaatttgccctgtcatctttgggggctgtctcccatgtcgtgattttgacgtgatctctccgtgacatcaccgcgccatcgtgaagtgtgatctcatcgccgccctgtcgtgacttcatcaATGTCGTGTTGTGACCTGGCTGCGGCGGGACAGgtggtgaccgccaggaaccctcctccccttctcatctccccatctcagcagccctgcttcgattatccggcttttggattctccgttgtcctgggaactatccgggaccccctcttgcttctccagcccctgccggcatccacaggctggtagcgggacggggagggcgagaagagggagcgcaaggggttaattctgctgctgccgccgccgctgctgctgctgctgcagcctctacccgagggagggaaaggagaggaggcaaggagcctgcgggggcgactgagagccctggctggaggggtggggtccccaaaggggcctccaagccttccctgttgagcgtcttgtattctcacttctgaagcgtatctctgcctctgaagaagggaggggaaaggaagcctggggtgtccttttctcccatgtcagcctgagtccggataatcgaacttcacccatgtatgtctccatttctccctgtctgtcctcaccactcactccctctgtgtccctgtggagggagataaaacccagcctccggtgccagggggacagctgagcagtggggccagctcccgcccacccccaggagactggtgaggagagctgtccggctgagcagcagcatgcatggtccttctttcccgctttctggaggtgaccttggaccagggtcccttctttatccctaaggatttgcagatccagccccttaaaggggcttctggggggaggtcagtcctgaggagtccacccctccagattctctcctcccctccctctgtgctaatccctccctccctccatcctccactctcacccccaccccacccccgtccctcctctgcagagggatgctcagtccctcttgtgttcacagTTGGGCAAGGCGAGCATCATGGCCTCGGATTGCGAGCCAGCTCTGAACCAGGCAGAGGGCCGAAACCCCACCCTGGAGCGCTACCTGGGAGCCCTCCGTGAGGCCAAGAATGACAGCGAGCAGTTTGCAGCCCTGCTGCTAgtaaggaactggctgaaaattgggaggtgggaagggctgggtggttgggcccccaaggaatggggtcagtgagtccccaaggatatgtacgtagtgctagcaaccctggaggcaccaacgaaggcccaagacccctacctttgtgctcttttttgctccccctgagaatgggggcaaagaggagaatgggactgaataaggctgtggcactaggggctgcctgggtctgttttctggggcgtcccagagcagatggaagctgactcatagggtaacagcagcaggtagtaactagtgcagagtacttgagggctggggatggttgttctgggcctggagagagtagcagggctggaagtggctggggaggggtcctaggggaaggccaggatggcagtaggtaggttaaggaatgggagctagtttggggcttagcctttttggaggaacccaagctggggacagcagagcagaagctgcagtgctaggaagggggggttgtgtgtggggggtgaagggaggagggagtacagccgctgcttgtttgccatggcaacaaggagaaggctctggagtcaagggctcacactgcagcagaggaggtgtttaggtgaaatgtaaggggaaatgttttgacaggcggagcggcgagacacaggagccatttcccctgagaaggtggcagaaatggatcagggacttctctggagggagcaattaaggaaggactttaaatccttgggagatcttaaaacattgagttctaagccccttccatcccaggttgtgggcatttagacatcaggaagaacttctcaactggccaggtgttgaaatgctcaaatgaatggttgaggaagactagacctcacttccatgggacagtcacagatgagagggatcccagaggtcacatttatctgcctctaaggagaaaaaaggagctggatgaaatgacctcagatgagtcctgttgcataacctcatcttgctagtcctcagtgccccaggatgcaggagagggacagtctttcccacttcttcctttcatcctgatgatagcacataccccctatagGTGACCAAGGCAGTCAAAGCAGGTGACATAGATGCCAAAACTCGGCGGCGGATCTTCGATGCTGTCGGCTTCACCTTCCCCAATCGTCTCCTGACCACCAAGGAGGCGCCGGATGGCTGCCCTGACCATGTTCTGCGGGCTTTGGGTGTGGCCCTGCTGGCCTGCTTCTGCAGTGACCCTGAACTGGCCGCCCATCCCCAAGTCCTGAACAAGATTCCCATTCTTAGCACCTTCCTCACAGCCCGGGGGGACCCGGACGATGCTGCCCGCCGCTCCATGATTGATGACACCTACCAGTGCCTGACGGCTGTAGCAGGCACACCCAGAGGGCCTCGGCACCTCATTGCTGGTGGCACCGTGTCTGCCCTATGCCAGGCATACCTGGGGCACGGCTATGGCTTTGACCAGGCCCTGGCACTCCTGGTGGGGCTGCTGGCTGCTGCCGAGACACAGTGCTGGAAGGAGGCGGAGCCCGACCTGCTGGCCGTGTTGCGGGGCCTCAGTGAGGATTTCCAGAAAGCTGAGGATGCCAGCAAGTTTGAGCTCTGCCAGCTGCTGCCCCTCTTTTTGCCCCCGACAACCGTGCCCCCTGAATGCTACCGGGATCTGCAGGCCGGGCTGGCACGCATCCTGGGAAGCAAGCTGAGCTCCTGGCAGCGCAACCCTGCACTGAAGCTGGCAGCCCGCCTGGCACACGCCTGCGGCTCCGACTGGATCCCGGCGGGCAGCTCCGGGAGCAAGTTCCTGGCCCTGCTGGTGAATCTGGCGTGCGTGGAAGTGCGGCTGGCACTGGAGGAGACGGGCACGGAGGTGAAAGAGGATGTGGTGACCGCCTGCTATGCCCTCATGGAGTTGGGGATCCAGGAATGCACTCGCTGTGAGCAGTCACTGCTTAAGGAGCCACAGAAGGTGCAGCTCGTGAGCGTCATGAAGGAGGCCATAGGGGCTGTTATCCACTACCTGCTGCAGgtgagggtgcagtgacccacagagggggcccagtatggggggagccagtgctggagctgggaggcaagggggaggagaataatggggagacagcgaagctgcatgtccacacaagctgatactgtagccagcactccagggagtagtgtgcggcccaacctccctctctctccctccctccacacaagcaccataccacacaccatatgtgcactcacatcacagtacacacacacgcacacacacacaacacagtaacctcccactcaaacgctccccccaatacacacacactacacgccacacacctctccccaacacatgcacacaagattgaagcagtctgttctgctcactccatagcattgttttatacacgcacacacccgaacttctaatggtgcagggaagagaagcagggctgcctggttcctggcctctatagaggtctggctagatcaattcgcctgcctcccctacatcccctcctgcctccccgcctgagaggccagctgtcctgtcccacagggattcagtcatgactctggtctctttaatggcctgctccagccaccgagctcaccagccatatattccatgcaccacgctaagctcatgtcttttttctgacttagcacaaaagagagcatcccctcactcccaccattgggagcagttacacagtagccaggaacctgccctcccaccccaggtcagagctgctgtaaagggtgtttaacttagcttttgacctatgaatttccttctagccttgagacactccagaggtagggagttagggagatgtgactggagcctcagcgagtacgggggcatgtcactcaattcactcaggcccagttcactcagcagacgtgtgtggagggcctggctcactctgtgccagtcccttgtgtgcgtccctaccacatgctaggtgctgggttcatgggacagaataaaggttggggcctgcctttgaaaggctcacaggccagaatttccttctagttgtattatttctagctggctggcctctggcaaggcagggagggtccctggtcctgctccatctcaagggggtcctgtggcaacagGTGGGGTCAGAGAAGCAGAAGGAGCCCTTTGTGTTTGCCTCGGTGCGGATCCTGGGTGCCTGGCTGGCCGAGGAGACCTCATCCTTGCGTAAGGAGGTGTGCCAGCTGCTGCCCTTCCTCGTCCGCTATGCCAAGACCCTCTACGAGGAGGCCGAGGAGGCCAATGACCTTTCCCAGCAGGTGGCCAACCTGGCCATCTCCCCCACCACCCCAGGGCCCACCTGGCCAGGAGACGCTCTCCGgtgagtctgtagttacagtctgtccagctagatcattctaccgaaaagcgttaacacaaggacacccctccccacaaactgagctgtgccaggcttcctgattgggccatgagatatcccttagggttatttctgttttggggggcttgttcccacaggactcctcggctgccaggtgtcacttgccaaccccagatttctcagttaaaagagaacttatacttattgagcacctactacgagccaggtattttgctataccctttaccaaaatgatctcatttggtccacgtggtaaatataacagaagtctcattcacatatgaaagattaggaaactgaggctcatagagattaaagtcacttgcccacagtcacactttgtggcagagcccaagtttggtcctgggttgtgcgactctgaagcttgtactttttctgtggtacctgcgaggatgtgtccttctcccctacttccatttctcttaggcaaggtgccctaaaaagggaatctatgtgccttcatctctcccaatcccacacacgtctgtcccttccacatccccagGCTCCTCCTGCCTGGCTGGTGCCACCTGACCGTTGAAGATGGGCCCCGGGAGATCCTGATCAAGGAAGGGGCCCCCTCGCTTCTGTGCAAGTATTTCCTGCAGCAGTGGGAACTCACATCCCCTGGCCACGACACCTCGGTGCTGCCTGACAGCGTGGAGATTGGCCTGCAGACCTGCTGCCACATCTTCCTCAACCTCGTGGTCACCGCACCGGGGCTGATCAAgtgaggggctcgggagaggtgggggaggaggccggaggaggcaaaggaggctgcccagttgcctcaattctcagtctcctactttgccccccatgcccatggatttgttagtggtagcatgggggtctcagagtagacatagccagccccgcacaaggattcggcatgctggaacccccaggtactgtctcagcatgtctgcttgttccaatctctgccccccagatgctatgtttggggcccaaagttaatcaccctactgcctaatttcttgccaagggcttgatttggctgtactagacccccacctacctccatccttcccccctttcttttccagGCGTGACGCCTGCTTCACATCTCTAATGAACACCCTCATGACGTCGCTACCAGCACTAGTGCAGCAACAGGGAAGGCTGCTTCTGGCTGCTAATGTGGCCACCCTGGGGCTCCTCATGGCCCGGCTCCTTAGCACCTCTCCAGgtaagaactggggatccagtcctgatgggtgaggacagaagacctgggtggacctcctgtgtttggggcaaaagtcaccatttttagaagatggttttgcagcattttctaagcaagaggaaatctttgcagtgtatctccatcccctacccccaccgttcttcccaaaatgctaacattctctttcttctgaagacttttaaggcaaagtctggtgggtgttaagtacagacctgctcacaggcacaggcataggcacctggaatccctggcagccagaggaatctgaatccagtgttttcaaggtggagccgcccccacccaggccttgagtcagaaacctgacttccttccattgatgtttttctctgctctgctcggtacctcacccccatcagtgacagccttcagcacttggtgtccctctatgcacaccttctccctagctctgcctcactctggctgtttgcagggggagggacgtcccctccagcccctggcagccctccgtgtctccctctttggctgtgggtgtctgcttgggtccctctgtccctgcctgttccctgtgccccatctgtcaggttggaggagctgagcagatgcctgggaacagggcgtaacatgcccgtaccttccactgcctctgtgttccttttgaggggttcccagcagggtaccccgtcatgggaaggggtgcacatccctgtacaccaggagcccactctgcactctcagtcccaggctgcatctctgcagcccccaatttcatggtcccagttctggctcaccctcaaataccaccaggttaggttgacagcttcctggagagcacctgcagtgtgagggtcaccccttgaacagccagtaagcaaagcagggtcacttgcttatgttcctctctggcgccctcttctggcccaaggatcaaatggtgcaactcccttaacctgtgtctgagctctgtgtccagaaccctgaggggttctctctcccatctgaccctgtgactcacccccacctccagtgccggtagaggtcttggtggttgagtgtaccaagatgatcacatttaattctcacaacaaatttctaagatgagcactattggcccattttacaagtaaagaaacagacccagaaaagttaattacccaaggtcacacagtgagcatctaaggcagggtttcaacgcaggcagtctgattccaggctgtgccctggctcctgcatgtgtctacacagaggactagggaagggtctgacacagcagctggcctgtccgattcatgccccactccttccgttaccttgcagCTCTTCAGGGAACACCAGCATCCCGAGGGTTCTTCGCAGCTGCCATCCTCTTCCTATCACAGTCCCACGTGGCGCGGGCCACCCCGGGCTCAGACCAGGCAGTGCTAGCCCTGTCCCCTGAGTATGAGGGCATCTGGGCCGACCTGCAGGAGCTCTGGTTCCTGGGCATGCAGGCCTTCACCGGCTGTGTGCCTCTGCTGCCCTGGCTGGCCCCCGCTGCCCTGCGCTCCCGCTGGCCGCAGGAGCTGCTCCAGCTGCTAGGCAGTGTCAGCCCCAACTCTGTCAAGCCCGAGATGGTGGCCGCCTATCAGGGTGTCCTGGTGGAGCTGGCGCGGGCCAACCGGCTGTGCCGGGAGGCCATGAGGCTGCAGGCGGGCGAGGAGACGGCCAGCCACTACCGCATGGCTGCCTTGGAGCAGTGCCTGTCAGAGCCCTGAggggtgtccaccggggacagacccaggggcgggcagagagggaaggagggaggaggcatcttccctgaagcccccaatctggcccccccctccccagacttcctccccaaaacaccccagctttctggcttttctgagggcaagggcatggtgcccacccctcaagtgtaaggaactgcgttccgcccctcaggcccccatgggggcagggatcggcttggaaatcaacgtggttgtccccgccaggccggggaaggttggagcagcccccagggaggggggcactaggtgtcattgtgcccgatgtctggctcccctgcaggagggaggctccagggtaagacagggctggcaggagcagactgcctcagcccatgtgccctgccggccagggcgtgggctcccctcggctgtggtgcctcctctggccccccaggtccacgtcctttaaattggccctttggctcttgcccttggctcccttgggcagacagcaggcttaggccattgatatcgcagttcttcctatcagcttcagtgacccagggtctgaactgcctccatcctagggcaacctggggcagacaggcctggtggggggtggggaaacctccttccacctgagcttgcttgaagggacccagagtctttgggcccagatctttaaacctttgtgtcgtgttgcagcagagtgacgatgggggttggggggttatttattttgcctgtccttatccctgcttggacacctgagcatctgattcctgtccccctggtgccatctggcctggctggagccaggaacaggagggacacttccccagaatccgcatgtttccccagtgattacactccactgccaccgtggtgcctggctttaactcccacccctgctatgactcctctctgcagagacgcgactggcggctccagcagggactacctttcttataaacccagggggaccacacacacacacacacacacacacacacacacacacacacacacacacactcttgatcccttgcttccctcccccagtgcgttctgtgatcgccaagttcaaagctgtgcacatgtggacactcaataaatgttcattggtgacgagaa" `; + +exports[`single exon cDNA display genomic coords 1`] = ` +">made_up-gene chr1:1,201-1,500(+) +1201 ATGTCACCTC GGGTACTGCC TCTATTACAG AGGTATCTTA ATGGCGCATC CAGCCTTGTG GCTGGGTCTA CGTACGCGTG GGCACCATAC GTATGTTGGC +1301 AGGAAAGGTC AATCATGCTT GTTTCCTCGT CGCAGAAACG TTCACACTAT TGGCTCGCGG GATCGAACGG GCCTGATTAT TTTTCCAGCT CCTGCGTTCC +1401 TATCACGCCA ACTGTCGCTA ATAAAATGTT ATATAGAGAT AACCCATTGC TATGCAAGGA TGGAGAAACC GCTTCACAAC ACCCTAGAAT TACTTCAGCA +" +`; + +exports[`single exon cDNA display relative coords 1`] = ` +">made_up-gene chr1:1,201-1,500(+) + 0 ATGTCACCTC GGGTACTGCC TCTATTACAG AGGTATCTTA ATGGCGCATC CAGCCTTGTG GCTGGGTCTA CGTACGCGTG GGCACCATAC GTATGTTGGC + 100 AGGAAAGGTC AATCATGCTT GTTTCCTCGT CGCAGAAACG TTCACACTAT TGGCTCGCGG GATCGAACGG GCCTGATTAT TTTTCCAGCT CCTGCGTTCC + 200 TATCACGCCA ACTGTCGCTA ATAAAATGTT ATATAGAGAT AACCCATTGC TATGCAAGGA TGGAGAAACC GCTTCACAAC ACCCTAGAAT TACTTCAGCA +" +`; diff --git a/packages/core/BaseFeatureWidget/SequenceFeatureDetails/dialogs/SequenceDialog.tsx b/packages/core/BaseFeatureWidget/SequenceFeatureDetails/dialogs/SequenceDialog.tsx index e1379c67ea..1d1438bb21 100644 --- a/packages/core/BaseFeatureWidget/SequenceFeatureDetails/dialogs/SequenceDialog.tsx +++ b/packages/core/BaseFeatureWidget/SequenceFeatureDetails/dialogs/SequenceDialog.tsx @@ -52,10 +52,7 @@ const SequenceDialog = observer(function ({ >
- + sub.type === 'CDS') - const hasExon = feature.subfeatures?.some(sub => sub.type === 'exon') - const hasExonOrCDS = hasExon || hasCDS - - const [selectMode, setSelectMode] = useState( - hasCDS ? 'cds' : hasExon ? 'cdna' : 'genomic', - ) - - useEffect(() => { - setMode(selectMode) - }, [setMode, hasCDS, hasExon, selectMode]) + const { intronBp, upDownBp, mode, hasCDS, hasExonOrCDS } = model return (