jbrowse-plugin-msaview 3.9.0 → 3.10.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (31) hide show
  1. package/dist/BgzipFastaMsaAdapter/BgzipFastaMsaAdapter.d.ts +2 -8
  2. package/dist/BgzipFastaMsaAdapter/configSchema.d.ts +10 -3
  3. package/dist/LaunchMsaView/cleanProteinSequence.test.js +36 -2
  4. package/dist/LaunchMsaView/components/useFeatureSequence.js +3 -6
  5. package/dist/LaunchMsaView/launchTarget.test.js +1 -1
  6. package/dist/MsaViewPanel/model.d.ts +638 -209
  7. package/dist/MsaViewPanel/resolveConnectedTranscript.js +7 -13
  8. package/dist/MsaViewPanel/resolveConnectedTranscript.test.js +2 -2
  9. package/dist/MsaViewPanel/transcriptMap.js +27 -8
  10. package/dist/MsaViewPanel/transcriptMap.test.js +19 -0
  11. package/dist/index.d.ts +11 -8
  12. package/dist/jbrowse-plugin-msaview.umd.production.min.js +54 -60
  13. package/dist/jbrowse-plugin-msaview.umd.production.min.js.map +4 -4
  14. package/dist/version.d.ts +1 -1
  15. package/dist/version.js +1 -1
  16. package/package.json +18 -18
  17. package/src/LaunchMsaView/cleanProteinSequence.test.ts +37 -2
  18. package/src/LaunchMsaView/components/useFeatureSequence.ts +3 -6
  19. package/src/LaunchMsaView/launchTarget.test.ts +1 -1
  20. package/src/LaunchMsaView/launchTarget.ts +2 -3
  21. package/src/MsaViewPanel/resolveConnectedTranscript.test.ts +2 -2
  22. package/src/MsaViewPanel/resolveConnectedTranscript.ts +7 -17
  23. package/src/MsaViewPanel/transcriptMap.test.ts +23 -0
  24. package/src/MsaViewPanel/transcriptMap.ts +36 -9
  25. package/src/version.ts +1 -1
  26. package/dist/LaunchMsaView/components/calculateProteinSequence.d.ts +0 -21
  27. package/dist/LaunchMsaView/components/calculateProteinSequence.js +0 -71
  28. package/dist/LaunchMsaView/components/types.d.ts +0 -6
  29. package/dist/LaunchMsaView/components/types.js +0 -1
  30. package/src/LaunchMsaView/components/calculateProteinSequence.ts +0 -113
  31. package/src/LaunchMsaView/components/types.ts +0 -8
@@ -3,14 +3,8 @@ import type { BaseFeatureDataAdapter } from '@jbrowse/core/data_adapters/BaseAda
3
3
  export default class BgzipFastaMsaAdapter extends BaseAdapter {
4
4
  configureP: Promise<BaseFeatureDataAdapter> | undefined;
5
5
  refNamesP: Promise<string[]> | undefined;
6
- configurePre(): Promise<BaseFeatureDataAdapter<import("@jbrowse/mobx-state-tree").ModelInstanceTypeProps<Record<string, any>> & {
7
- setSubschema(slotName: string, data: Record<string, unknown>): any;
8
- setSlot(slotName: string, value: unknown): void;
9
- } & import("@jbrowse/mobx-state-tree").IStateTreeNode<import("@jbrowse/core/configuration").AnyConfigurationSchemaType>>>;
10
- configure(): Promise<BaseFeatureDataAdapter<import("@jbrowse/mobx-state-tree").ModelInstanceTypeProps<Record<string, any>> & {
11
- setSubschema(slotName: string, data: Record<string, unknown>): any;
12
- setSlot(slotName: string, value: unknown): void;
13
- } & import("@jbrowse/mobx-state-tree").IStateTreeNode<import("@jbrowse/core/configuration").AnyConfigurationSchemaType>>>;
6
+ configurePre(): Promise<BaseFeatureDataAdapter<import("@jbrowse/core/configuration").AnyConfigurationModel>>;
7
+ configure(): Promise<BaseFeatureDataAdapter<import("@jbrowse/core/configuration").AnyConfigurationModel>>;
14
8
  getMSARefs(): Promise<string[]>;
15
9
  getMsaRegex(): RegExp;
16
10
  refNameToMsaId(refName: string): string;
@@ -1,7 +1,14 @@
1
1
  import type PluginManager from '@jbrowse/core/PluginManager';
2
2
  export default function configSchemaF(pluginManager: PluginManager): import("@jbrowse/core/configuration/configurationSchema").ConfigurationSchemaType<{
3
+ msaRegex: {
4
+ type: "string";
5
+ } & {
6
+ defaultValue: string;
7
+ };
8
+ } | {
3
9
  readonly msaRegex: {
4
- readonly type: "string";
5
- readonly defaultValue: "_";
10
+ type: "string";
11
+ } & {
12
+ defaultValue: string;
6
13
  };
7
- }, import("@jbrowse/core/configuration/configurationSchema").ConfigurationSchemaOptions<import("@jbrowse/core/configuration").AnyConfigurationSchemaType, undefined>>;
14
+ }, import("@jbrowse/core/configuration/configurationSchema").ConfigurationSchemaOptions<any, undefined, undefined, import("@jbrowse/core/configuration").ConfigurationSchemaRequirement<Partial<Record<string, string[]>>, string>>>;
@@ -1,8 +1,8 @@
1
1
  import { SimpleFeature } from '@jbrowse/core/util';
2
+ import { translateTranscript } from '@jbrowse/core/util/translateTranscript';
2
3
  import { genomeToTranscriptSeqMapping } from 'g2p_mapper';
3
4
  import { describe, expect, test } from 'vitest';
4
5
  import { transcriptPosToVisibleCol } from '../MsaViewPanel/util';
5
- import { getProteinSequenceFromFeature } from './components/calculateProteinSequence';
6
6
  import { findQueryRow } from './detectQueryRow';
7
7
  import { cleanProteinSequence } from './util';
8
8
  describe('cleanProteinSequence', () => {
@@ -22,7 +22,7 @@ describe('a launched query row read through g2p', () => {
22
22
  function rowResidueUnder(genomePos, json) {
23
23
  const seq = json.seq;
24
24
  const feature = new SimpleFeature(json);
25
- const row = cleanProteinSequence(getProteinSequenceFromFeature({ seq, feature }));
25
+ const row = cleanProteinSequence(translateTranscript({ transcript: feature, seq })?.protein ?? '');
26
26
  const { g2p } = genomeToTranscriptSeqMapping(feature.toJSON());
27
27
  const col = transcriptPosToVisibleCol({
28
28
  querySeqName: 'QUERY',
@@ -52,6 +52,40 @@ describe('a launched query row read through g2p', () => {
52
52
  expect(rowResidueUnder(4, json)).toBe('A');
53
53
  expect(rowResidueUnder(10, json)).toBe('K');
54
54
  });
55
+ test('on the reverse strand, across an intron, after a partial first codon', () => {
56
+ // sense G | ATG GCC <intron> TGG AAA TAA, stored as the reverse complement
57
+ const json = {
58
+ uniqueId: 't1',
59
+ refName: 'chr1',
60
+ start: 0,
61
+ end: 24,
62
+ strand: -1,
63
+ type: 'mRNA',
64
+ seq: 'TTATTTCCACTACTTACGGCCATC',
65
+ subfeatures: [
66
+ {
67
+ uniqueId: 'c1',
68
+ refName: 'chr1',
69
+ type: 'CDS',
70
+ start: 17,
71
+ end: 24,
72
+ phase: 1,
73
+ },
74
+ {
75
+ uniqueId: 'c2',
76
+ refName: 'chr1',
77
+ type: 'CDS',
78
+ start: 0,
79
+ end: 9,
80
+ phase: 0,
81
+ },
82
+ ],
83
+ };
84
+ expect(rowResidueUnder(22, json)).toBe('M');
85
+ expect(rowResidueUnder(18, json)).toBe('A');
86
+ expect(rowResidueUnder(7, json)).toBe('W');
87
+ expect(rowResidueUnder(4, json)).toBe('K');
88
+ });
55
89
  test('after an internal stop', () => {
56
90
  // ATG TGA GCC TGG TAA: a selenocysteine GENCODE does not annotate
57
91
  const json = transcript('ATGTGAGCCTGGTAA', { type: 'CDS' });
@@ -1,6 +1,6 @@
1
1
  import { getSession } from '@jbrowse/core/util';
2
+ import { translateTranscript } from '@jbrowse/core/util/translateTranscript';
2
3
  import { useFetch } from '../../utils/useFetch';
3
- import { getProteinSequenceFromFeature } from './calculateProteinSequence';
4
4
  import { fetchSeq } from './fetchSeq';
5
5
  export function useFeatureSequence({ view, feature, }) {
6
6
  const assemblyName = view?.assemblyNames?.[0];
@@ -18,11 +18,8 @@ export function useFeatureSequence({ view, feature, }) {
18
18
  });
19
19
  return {
20
20
  proteinSequence: sequence && feature
21
- ? getProteinSequenceFromFeature({
22
- seq: sequence.seq,
23
- feature,
24
- assemblyGeneticCodeId: sequence.assemblyGeneticCodeId,
25
- })
21
+ ? (translateTranscript({ transcript: feature, ...sequence })?.protein ??
22
+ '')
26
23
  : '',
27
24
  sequence,
28
25
  error,
@@ -52,7 +52,7 @@ describe('launchTarget', () => {
52
52
  test('offers nothing when nothing was clicked', () => {
53
53
  expect(launchTarget({ contextMenuItems: () => [] })).toBeUndefined();
54
54
  });
55
- // v3.7.0 hosts have contextMenuFeature and nothing else; dropping this
55
+ // v4.3.0 and earlier have contextMenuFeature and nothing else; dropping this
56
56
  // fallback once took "Launch MSA view" off every host in the wild.
57
57
  test('falls back to a synchronous contextMenuFeature', () => {
58
58
  const target = launchTarget(legacyHost(feature('mRNA')));