@teselagen/ove 0.8.7 → 0.8.9

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@teselagen/ove",
3
- "version": "0.8.7",
3
+ "version": "0.8.9",
4
4
  "main": "./src/index.js",
5
5
  "type": "module",
6
6
  "exports": {
@@ -1,5 +1,5 @@
1
1
  export const searchableTypes: string[];
2
- declare const _default: ((state: any) => any[][]) & import('reselect').OutputSelectorFields<(args_0: any, args_1: any, ...args: any[]) => any[][], {
2
+ declare const _default: ((state: any) => any[]) & import('reselect').OutputSelectorFields<(args_0: any, args_1: any, ...args: any[]) => any[], {
3
3
  clearCache: () => void;
4
4
  }> & {
5
5
  clearCache: () => void;
@@ -1,4 +1,4 @@
1
- declare const _default: ((state: any) => any[]) & import('reselect').OutputSelectorFields<(args_0: any) => any[], {
1
+ declare const _default: ((state: any) => any) & import('reselect').OutputSelectorFields<(args_0: any) => any, {
2
2
  clearCache: () => void;
3
3
  }> & {
4
4
  clearCache: () => void;
@@ -1,11 +1,11 @@
1
1
  declare const _default: ((state: any) => {
2
2
  cutsitesByName: {};
3
3
  cutsitesById: {};
4
- cutsitesArray: never[];
4
+ cutsitesArray: any;
5
5
  }) & import('reselect').OutputSelectorFields<(...args: any) => {
6
6
  cutsitesByName: {};
7
7
  cutsitesById: {};
8
- cutsitesArray: never[];
8
+ cutsitesArray: any;
9
9
  }, {
10
10
  clearCache: () => void;
11
11
  }> & {
@@ -1,4 +1,4 @@
1
- declare const _default: ((state: any) => Partial<any>) & import('reselect').OutputSelectorFields<(args_0: any, args_1: any, args_2: any, args_3: any, args_4: any) => Partial<any>, {
1
+ declare const _default: ((state: any) => any) & import('reselect').OutputSelectorFields<(args_0: any, args_1: any, args_2: any, args_3: any, args_4: any) => any, {
2
2
  clearCache: () => void;
3
3
  }> & {
4
4
  clearCache: () => void;
@@ -1,4 +1,4 @@
1
- declare const _default: ((state: any) => any[]) & import('reselect').OutputSelectorFields<(args_0: any, args_1: any, args_2: any, args_3: any, args_4: any) => any[], {
1
+ declare const _default: ((state: any) => any) & import('reselect').OutputSelectorFields<(args_0: any, args_1: any, args_2: any, args_3: any, args_4: any) => any, {
2
2
  clearCache: () => void;
3
3
  }> & {
4
4
  clearCache: () => void;
@@ -1,4 +1,4 @@
1
- declare const _default: ((state: any) => Partial<any>) & import('reselect').OutputSelectorFields<(args_0: any, args_1: any, args_2: any, args_3: any) => Partial<any>, {
1
+ declare const _default: ((state: any) => any) & import('reselect').OutputSelectorFields<(args_0: any, args_1: any, args_2: any, args_3: any) => any, {
2
2
  clearCache: () => void;
3
3
  }> & {
4
4
  clearCache: () => void;
@@ -1,4 +1,4 @@
1
- declare const _default: ((state: any) => any[]) & import('reselect').OutputSelectorFields<(args_0: any, args_1: any, args_2: any, args_3: any, args_4: any, args_5: any, args_6: any, args_7: any, args_8: any) => any[], {
1
+ declare const _default: ((state: any) => any) & import('reselect').OutputSelectorFields<(args_0: any, args_1: any, args_2: any, args_3: any, args_4: any, args_5: any, args_6: any, args_7: any, args_8: any) => any, {
2
2
  clearCache: () => void;
3
3
  }> & {
4
4
  clearCache: () => void;
@@ -1,14 +1,4 @@
1
- declare const _default: ((state: any) => any) & import('reselect').OutputSelectorFields<(args_0: any, args_1: unknown, args_2: any, args_3: {
2
- start: number;
3
- end: number;
4
- length: number;
5
- internalStartCodonIndices: never[];
6
- frame: number;
7
- forward: any;
8
- annotationTypePlural: string;
9
- isOrf: boolean;
10
- id: any;
11
- }[], args_4: any, args_5: any, args_6: any[], args_7: any, args_8: any, args_9: any, args_10: any, args_11: any, args_12: any) => any, {
1
+ declare const _default: ((state: any) => any) & import('reselect').OutputSelectorFields<(...args: any) => any, {
12
2
  clearCache: () => void;
13
3
  }> & {
14
4
  clearCache: () => void;
@@ -74,7 +74,11 @@ import { coerceInitialValue } from "./coerceInitialValue";
74
74
  import { tabHeight } from "../constants";
75
75
  import LabileSitesLayer from "./LabileSitesLayer";
76
76
  import PropertySidePanel from "../PropertySidePanel";
77
- import { getAlignedAminoAcidSequenceProps } from "../utils/getAlignedAminoAcidSequenceProps";
77
+ import {
78
+ getAlignedAminoAcidSequenceProps,
79
+ getLabileSites,
80
+ parseTracks
81
+ } from "../utils/getAlignedAminoAcidSequenceProps";
78
82
 
79
83
  let charWidthInLinearViewDefault = 12;
80
84
  try {
@@ -244,6 +248,11 @@ export const AlignmentView = props => {
244
248
  }
245
249
  };
246
250
 
251
+ const aminoAcidAlignmentProperties = useMemo(() => {
252
+ if (isPairwise || !alignmentTracks[0].sequenceData.isProtein) return;
253
+ return getAlignedAminoAcidSequenceProps(alignmentTracks);
254
+ }, [alignmentTracks, isPairwise]);
255
+
247
256
  useEffect(() => {
248
257
  window.scrollAlignmentToPercent = scrollAlignmentToPercent;
249
258
  if (window.Cypress)
@@ -684,11 +693,6 @@ export const AlignmentView = props => {
684
693
  });
685
694
  };
686
695
 
687
- const aminoAcidAlignmentProperties = useMemo(() => {
688
- if (isPairwise || !alignmentTracks[0].sequenceData.isProtein) return;
689
- return getAlignedAminoAcidSequenceProps(alignmentTracks);
690
- }, [alignmentTracks, isPairwise]);
691
-
692
696
  const renderItem = (_i, _key, isTemplate, cloneProps) => {
693
697
  const isDragDisabled = !allowTrackRearrange || isPairwise;
694
698
  let i;
@@ -1966,6 +1970,9 @@ export default compose(
1966
1970
  }
1967
1971
  });
1968
1972
 
1973
+ const tracks = parseTracks(alignmentTracks);
1974
+ const labileSites = getLabileSites(tracks, 0.5);
1975
+
1969
1976
  const annotationsWithCounts = [];
1970
1977
  if (alignmentTracks) {
1971
1978
  let totalNumOfFeatures = 0;
@@ -1980,7 +1987,8 @@ export default compose(
1980
1987
  });
1981
1988
  annotationsWithCounts.push({
1982
1989
  features: totalNumOfFeatures,
1983
- parts: totalNumOfParts
1990
+ parts: totalNumOfParts,
1991
+ labileSites: labileSites.sites?.length ?? 0
1984
1992
  });
1985
1993
  } else if (pairwiseAlignments) {
1986
1994
  pairwiseAlignments.forEach(pairwise => {
@@ -6,7 +6,7 @@
6
6
  * @param {number} [props.height=150]
7
7
  * @param {string[]} [props.barColors]
8
8
  */
9
- import React from 'react'
9
+ import React from "react";
10
10
  export function BarPlot({
11
11
  data,
12
12
  width = 300,
@@ -41,7 +41,7 @@ import LinearView from "../LinearView";
41
41
  import RowView from "../RowView";
42
42
  import StatusBar from "../StatusBar";
43
43
  import DropHandler from "./DropHandler";
44
- import Properties from "../helperComponents/PropertiesDialog";
44
+ import PropertiesDialog from "../helperComponents/PropertiesDialog";
45
45
  import "./style.css";
46
46
  import { DragDropContext, Droppable, Draggable } from "@hello-pangea/dnd";
47
47
  import DigestTool from "../DigestTool/DigestTool";
@@ -76,7 +76,7 @@ const _panelMap = {
76
76
  digestTool: DigestTool,
77
77
  pcrTool: PCRTool,
78
78
  properties: {
79
- comp: Properties,
79
+ comp: PropertiesDialog,
80
80
  panelSpecificProps: ["PropertiesProps"]
81
81
  },
82
82
  mismatches: Mismatches
@@ -11,6 +11,8 @@ export const userDefinedHandlersAndOpts = [
11
11
  "allowPrimerBasesToBeEdited",
12
12
  "truncateLabelsThatDoNotFit",
13
13
  "smartCircViewLabelRender",
14
+ "on_setPanelAsActive",
15
+ "on_propertiesViewTabUpdate",
14
16
  "onConfigureFeatureTypesClick",
15
17
  "allPartTags",
16
18
  "bpLimit",
@@ -187,6 +187,7 @@ export default ({ properties, setProperties, style }) => {
187
187
  <div
188
188
  ref={sidebarRef}
189
189
  style={{
190
+ position: "relative",
190
191
  width: isOpen ? 350 : 0,
191
192
  minWidth: isOpen ? 350 : 0,
192
193
  maxWidth: isOpen ? 350 : 0,
@@ -205,7 +206,7 @@ export default ({ properties, setProperties, style }) => {
205
206
  <Button
206
207
  style={{
207
208
  position: "absolute",
208
- top: 5,
209
+ top: 0,
209
210
  right: 10,
210
211
  zIndex: 1,
211
212
  cursor: "pointer"
@@ -17,7 +17,7 @@ export const togglePanelFullScreen = createAction("togglePanelFullScreen");
17
17
  export const collapsePanel = createAction("collapsePanel");
18
18
  export const closePanel = createAction("closePanel");
19
19
  export const _collapseSplitScreen = createAction("_collapseSplitScreen");
20
- export const setPanelAsActive = createAction("setPanelAsActive");
20
+ export const setPanelAsActive = createAction("SET_PANEL_AS_ACTIVE");
21
21
  export const flipActiveTabFromLinearOrCircularIfNecessary = createAction(
22
22
  "flipActiveTabFromLinearOrCircularIfNecessary"
23
23
  );
@@ -214,7 +214,7 @@ function getIdentityAndFrequencies(alignedSequences) {
214
214
  };
215
215
  }
216
216
 
217
- function getLabileSites(alignedSequences, threshold = 0.5) {
217
+ export function getLabileSites(alignedSequences, threshold = 0.5) {
218
218
  const sequences = Object.values(alignedSequences);
219
219
  const alignmentLength = sequences[0].length;
220
220
 
@@ -261,7 +261,7 @@ function getLabileSites(alignedSequences, threshold = 0.5) {
261
261
  };
262
262
  }
263
263
 
264
- export const getAlignedAminoAcidSequenceProps = tracks => {
264
+ export function parseTracks(tracks) {
265
265
  let sequences = {};
266
266
 
267
267
  tracks.forEach(at => {
@@ -271,6 +271,12 @@ export const getAlignedAminoAcidSequenceProps = tracks => {
271
271
  };
272
272
  });
273
273
 
274
+ return sequences;
275
+ }
276
+
277
+ export const getAlignedAminoAcidSequenceProps = tracks => {
278
+ const sequences = parseTracks(tracks);
279
+
274
280
  const identity = calculateIdentityMatrix(sequences);
275
281
  const { overallIdentity, frequencies } = getIdentityAndFrequencies(sequences);
276
282
  const labileSites = getLabileSites(sequences, 0.5);
@@ -677,7 +677,8 @@ export function mapDispatchToActions(dispatch, ownProps) {
677
677
  editorName,
678
678
  actions,
679
679
  actionOverrides,
680
- dispatch
680
+ dispatch,
681
+ ownProps
681
682
  );
682
683
  const updateSel =
683
684
  ownProps.selectionLayerUpdate || actionsToPass.selectionLayerUpdate;
@@ -717,7 +718,8 @@ export function getCombinedActions(
717
718
  editorName,
718
719
  actions,
719
720
  actionOverrides,
720
- dispatch
721
+ dispatch,
722
+ ownProps
721
723
  ) {
722
724
  const meta = { editorName };
723
725
 
@@ -758,6 +760,21 @@ export function getCombinedActions(
758
760
  ...metaActions
759
761
  // ...metaOverrides
760
762
  };
763
+ function addGenericHook(hookName) {
764
+ const oldHook = actionsToPass[hookName];
765
+ actionsToPass[hookName] = (...args) => {
766
+ const toRet = oldHook(...args);
767
+ const newHookName = `on_${hookName}`;
768
+ if (ownProps[newHookName]) {
769
+ setTimeout(() => {
770
+ ownProps[newHookName](...args);
771
+ }, 0);
772
+ }
773
+ return toRet;
774
+ };
775
+ }
776
+ ["setPanelAsActive", "propertiesViewTabUpdate"].forEach(addGenericHook);
777
+
761
778
  return bindActionCreators(actionsToPass, dispatch);
762
779
  }
763
780
 
@@ -1 +1 @@
1
- export function addWrappedAddons(anns: any, seqLen: any): any[];
1
+ export function addWrappedAddons(anns: any, seqLen: any): any;
@@ -35,4 +35,4 @@ export function getStripedPattern({ color, id }: {
35
35
  color: any;
36
36
  id: any;
37
37
  }): import("react/jsx-runtime").JSX.Element;
38
- export function getEnzymeAliases(enzyme: any): any[];
38
+ export function getEnzymeAliases(enzyme: any): any;
@@ -1,3 +1,15 @@
1
+ export function getLabileSites(alignedSequences: any, threshold?: number): {
2
+ sites: {
3
+ position: number;
4
+ conservationScore: number;
5
+ residueVariation: string[];
6
+ frequencies: {};
7
+ }[];
8
+ conservationScores: (number | null)[];
9
+ totalLabileSites: number;
10
+ percentageLabile: number;
11
+ };
12
+ export function parseTracks(tracks: any): {};
1
13
  export function getAlignedAminoAcidSequenceProps(tracks: any): {
2
14
  overallIdentity: number;
3
15
  frequencies: number[];
@@ -41,17 +41,17 @@ export function updateSelectionOrCaret({ shiftHeld, sequenceLength, newRangeOrCa
41
41
  newRangeOrCaret: any;
42
42
  caretPosition: any;
43
43
  selectionLayer: any;
44
- selectionLayerUpdate?: ((...args: any[]) => void) | undefined;
45
- caretPositionUpdate?: ((...args: any[]) => void) | undefined;
44
+ selectionLayerUpdate?: any;
45
+ caretPositionUpdate?: any;
46
46
  doNotWrapOrigin: any;
47
- }): void;
47
+ }): any;
48
48
  export function editorDragged({ nearestCaretPos, doNotWrapOrigin, caretPosition, easyStore, caretPositionUpdate, selectionLayerUpdate, selectionLayer, sequenceLength }: {
49
49
  nearestCaretPos: any;
50
50
  doNotWrapOrigin: any;
51
51
  caretPosition?: number | undefined;
52
52
  easyStore: any;
53
- caretPositionUpdate?: ((...args: any[]) => void) | undefined;
54
- selectionLayerUpdate?: ((...args: any[]) => void) | undefined;
53
+ caretPositionUpdate?: any;
54
+ selectionLayerUpdate?: any;
55
55
  selectionLayer?: {
56
56
  start: number;
57
57
  end: number;
@@ -4,7 +4,7 @@ export function mapDispatchToActions(dispatch: any, ownProps: any): {
4
4
  dispatch: any;
5
5
  };
6
6
  export function fakeActionOverrides(): {};
7
- export function getCombinedActions(editorName: any, actions: any, actionOverrides: any, dispatch: any): {};
7
+ export function getCombinedActions(editorName: any, actions: any, actionOverrides: any, dispatch: any, ownProps: any): {};
8
8
  export function getShowGCContent(state: any, ownProps: any): any;
9
9
  export function handleSave(props: any): (opts?: {}) => Promise<any>;
10
10
  export function handleInverse(props: any): () => false | undefined;