jbrowse-plugin-protein3d 0.5.3 → 0.5.4
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.
- package/dist/Protein1DViewRegistry/index.js +4 -9
- package/dist/ProteinView/proteinToGenomeMapping.d.ts +1 -1
- package/dist/ProteinView/proteinToGenomeMapping.js +10 -7
- package/dist/jbrowse-plugin-protein3d.umd.production.min.js +13 -13
- package/dist/jbrowse-plugin-protein3d.umd.production.min.js.map +4 -4
- package/dist/mappings.d.ts +1 -0
- package/dist/mappings.js +14 -1
- package/dist/version.d.ts +1 -1
- package/dist/version.js +1 -1
- package/package.json +1 -1
- package/src/Protein1DViewRegistry/index.test.ts +55 -0
- package/src/Protein1DViewRegistry/index.ts +5 -11
- package/src/ProteinView/geneExplorerLinkage.test.ts +214 -0
- package/src/ProteinView/proteinToGenomeMapping.ts +12 -9
- package/src/mappings.ts +18 -1
- package/src/version.ts +1 -1
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import { SimpleFeature } from '@jbrowse/core/util';
|
|
2
|
-
import { getCodonRange } from 'g2p_mapper';
|
|
3
2
|
import { action, computed, makeObservable, observable } from 'mobx';
|
|
4
|
-
import { genomeToTranscriptSeqMapping } from '../mappings';
|
|
3
|
+
import { codonGenomeSpan, genomeToTranscriptSeqMapping } from '../mappings';
|
|
5
4
|
class Protein1DViewRegistry {
|
|
6
5
|
views = observable.map();
|
|
7
6
|
constructor() {
|
|
@@ -53,13 +52,9 @@ class Protein1DViewRegistry {
|
|
|
53
52
|
if (!mapping) {
|
|
54
53
|
return undefined;
|
|
55
54
|
}
|
|
56
|
-
const {
|
|
57
|
-
const
|
|
58
|
-
|
|
59
|
-
return undefined;
|
|
60
|
-
}
|
|
61
|
-
const [start, end] = result;
|
|
62
|
-
return { refName, start, end };
|
|
55
|
+
const { p2gCodon, refName } = mapping;
|
|
56
|
+
const span = codonGenomeSpan(p2gCodon, proteinPos);
|
|
57
|
+
return span ? { refName, start: span[0], end: span[1] } : undefined;
|
|
63
58
|
}
|
|
64
59
|
}
|
|
65
60
|
export const protein1DViewRegistry = new Protein1DViewRegistry();
|
|
@@ -2,7 +2,7 @@ import type { PairwiseAlignment } from '../mappings';
|
|
|
2
2
|
import type { IAnyStateTreeNode } from '@jbrowse/mobx-state-tree';
|
|
3
3
|
import type { LinearGenomeViewModel } from '@jbrowse/plugin-linear-genome-view';
|
|
4
4
|
interface GenomeToTranscriptSeqMapping {
|
|
5
|
-
|
|
5
|
+
p2gCodon: Record<number, number[]>;
|
|
6
6
|
strand: number;
|
|
7
7
|
refName: string;
|
|
8
8
|
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { getSession } from '@jbrowse/core/util';
|
|
2
|
-
import {
|
|
2
|
+
import { codonGenomeSpan } from '../mappings';
|
|
3
3
|
/**
|
|
4
4
|
* Maps a protein structure position to genome coordinates
|
|
5
5
|
* @returns [start, end] tuple of genome coordinates, or undefined if mapping fails
|
|
@@ -9,12 +9,11 @@ export function proteinToGenomeMapping({ model, structureSeqPos, }) {
|
|
|
9
9
|
if (!genomeToTranscriptSeqMapping || !pairwiseAlignment) {
|
|
10
10
|
return undefined;
|
|
11
11
|
}
|
|
12
|
-
const {
|
|
12
|
+
const { p2gCodon } = genomeToTranscriptSeqMapping;
|
|
13
13
|
const transcriptPos = structureSeqToTranscriptSeqPosition?.[structureSeqPos];
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
return getCodonRange(p2g, transcriptPos, strand);
|
|
14
|
+
return transcriptPos === undefined
|
|
15
|
+
? undefined
|
|
16
|
+
: codonGenomeSpan(p2gCodon, transcriptPos);
|
|
18
17
|
}
|
|
19
18
|
/**
|
|
20
19
|
* Maps a protein structure range to genome coordinates
|
|
@@ -63,7 +62,11 @@ export async function navigateToProteinPosition({ model, structureSeqPos, struct
|
|
|
63
62
|
}
|
|
64
63
|
const [start, end] = result;
|
|
65
64
|
if (zoomToBaseLevel) {
|
|
66
|
-
|
|
65
|
+
// start/end are 0-based half-open (from getCodonRanges). navToLocString
|
|
66
|
+
// parses a 1-based locString (parseLocString does start -= 1), so the start
|
|
67
|
+
// must be shifted to 1-based; the half-open end already equals the 1-based
|
|
68
|
+
// inclusive end. Passing the raw 0-based start landed the view 1bp 5'.
|
|
69
|
+
await connectedView.navToLocString(`${refName}:${start + 1}-${end}${strand === -1 ? '[rev]' : ''}`, undefined, 0.2);
|
|
67
70
|
}
|
|
68
71
|
else {
|
|
69
72
|
const { assemblyManager } = session;
|