Skip to content

Commit

Permalink
Couple more tests
Browse files Browse the repository at this point in the history
  • Loading branch information
cmdcolin committed Jun 17, 2024
1 parent 148ce6b commit 5a80f6a
Show file tree
Hide file tree
Showing 3 changed files with 60 additions and 26 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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')
Expand Down Expand Up @@ -129,40 +143,15 @@ 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', () => {
const seq = readFasta('./test_data/volvox.fa')
const model = SequenceFeatureDetailsF().create()
model.setMode('cdna')
const { getByTestId } = render(
<SequencePanel
model={model}
sequence={{ seq }}
feature={{
start: 1200,
end: 1500,
refName: 'chr1',
type: 'mRNA',
uniqueId: 'unique',
subfeatures: [
{ refName: 'chr1', start: 1200, end: 1500, type: 'exon' },
{ refName: 'chr1', start: 1200, end: 1500, type: 'CDS' },
],
}}
/>,
<SequencePanel model={model} sequence={{ seq }} feature={f} />,
)

const element = getByTestId('sequence_panel')
Expand All @@ -177,3 +166,31 @@ 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(
<SequencePanel model={model} sequence={{ seq }} feature={f} />,
)

console.log(model.mode)

Check warning on line 179 in packages/core/BaseFeatureWidget/SequenceFeatureDetails/SequenceFeatureDetails.test.tsx

View workflow job for this annotation

GitHub Actions / Lint on node 20 and ubuntu-latest

Unexpected console statement

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(
<SequencePanel model={model} sequence={{ seq }} feature={f} />,
)

const element = getByTestId('sequence_panel')
expect(element.textContent).toMatchSnapshot()
})
Original file line number Diff line number Diff line change
Expand Up @@ -9,3 +9,19 @@ exports[`NCDN updownstream 1`] = `
">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
"
`;
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@ const CDNASequence = observer(function ({
const strand = feature.strand as number
const fullGenomicCoordinates =
showCoordinatesSetting === 'genomic' && includeIntrons && !collapseIntron
console.log({ fullGenomicCoordinates })

Check warning on line 51 in packages/core/BaseFeatureWidget/SequenceFeatureDetails/seqtypes/CDNASequence.tsx

View workflow job for this annotation

GitHub Actions / Lint on node 20 and ubuntu-latest

Unexpected console statement

let coordStart = fullGenomicCoordinates
? strand > 0
Expand Down

0 comments on commit 5a80f6a

Please sign in to comment.