@teselagen/ove 0.7.26 → 0.7.28

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 (304) hide show
  1. package/AASliver.js +187 -0
  2. package/AddLaddersDialog.js +82 -0
  3. package/AdditionalCutsiteInfoDialog.js +599 -0
  4. package/AlignmentView/Mismatches.d.ts +3 -3
  5. package/AlignmentVisibilityTool.js +105 -0
  6. package/AnnotationContainerHolder.js +20 -0
  7. package/AnnotationPositioner.js +27 -0
  8. package/AutoAnnotate.js +501 -0
  9. package/AutoAnnotateBpMatchingDialog.js +208 -0
  10. package/Axis.js +151 -0
  11. package/AxisNumbers.js +35 -0
  12. package/Browser.js +106 -0
  13. package/Caret.js +63 -0
  14. package/Chromatogram.js +293 -0
  15. package/CircularDnaSequence.js +73 -0
  16. package/CircularView/Labels/index.d.ts +1 -1
  17. package/CircularView/index.d.ts +0 -1
  18. package/CircularZoomMinimap.js +16 -0
  19. package/ColorPicker.js +30 -0
  20. package/CommandHotkeyHandler.js +44 -0
  21. package/CreateAnnotationsPage.d.ts +4 -4
  22. package/CreateAnnotationsPage.js +98 -0
  23. package/Cutsite.js +18 -0
  24. package/CutsiteProperties.js +176 -0
  25. package/CutsiteSelectionLayers.js +47 -0
  26. package/Cutsites.js +271 -0
  27. package/DeletionLayer.js +28 -0
  28. package/DigestTool/Ladder.d.ts +1 -1
  29. package/DropHandler.css +21 -0
  30. package/DropHandler.js +64 -0
  31. package/EditCaretPosition.js +234 -0
  32. package/EditTrackNameDialog.js +30 -0
  33. package/Feature.js +83 -0
  34. package/FeatureProperties.js +6 -0
  35. package/FillWindow.js +47 -0
  36. package/GenbankView.js +74 -0
  37. package/GeneralProperties.js +117 -0
  38. package/GenericAnnotationProperties.js +406 -0
  39. package/GlobalDialog.js +73 -0
  40. package/GlobalDialogUtils.js +110 -0
  41. package/GoToDialog.js +25 -0
  42. package/HorizontalPanelDragHandle.js +35 -0
  43. package/Keyboard.js +85 -0
  44. package/Labels.js +327 -0
  45. package/Ladder.css +20 -0
  46. package/Ladder.js +303 -0
  47. package/MeltingTemp.js +85 -0
  48. package/Menlo.ttf +0 -0
  49. package/Minimap.js +515 -0
  50. package/Mismatches.js +134 -0
  51. package/Monaco.ttf +0 -0
  52. package/MultipleSeqsDetectedOnImportDialog.js +74 -0
  53. package/Orf.js +109 -0
  54. package/OrfProperties.js +117 -0
  55. package/Orfs.js +35 -0
  56. package/PCRTool.js +179 -0
  57. package/PairwiseAlignmentView.js +68 -0
  58. package/Part.js +34 -0
  59. package/PartProperties.js +9 -0
  60. package/PassThrough.js +3 -0
  61. package/PerformantSelectionLayer.js +32 -0
  62. package/PinchHelper.js +24 -0
  63. package/PointedAnnotation.js +347 -0
  64. package/PositionAnnotationOnCircle.js +26 -0
  65. package/Primer.js +41 -0
  66. package/PrimerProperties.js +19 -0
  67. package/Reflex/index.d.ts +0 -1
  68. package/ReflexContainer.js +802 -0
  69. package/ReflexElement.js +160 -0
  70. package/ReflexEvents.js +77 -0
  71. package/ReflexSplitter.js +205 -0
  72. package/RenameSequenceDialog.js +7 -0
  73. package/RotateCircularViewSlider.js +93 -0
  74. package/RowView/index.d.ts +0 -1
  75. package/SelectDialog.js +150 -0
  76. package/SequenceName.js +15 -0
  77. package/SimpleCircularOrLinearView.js +381 -0
  78. package/SimpleOligoPreview.js +39 -0
  79. package/SingleEnzymeCutsiteInfo.js +139 -0
  80. package/ToolBar/ToolbarItem.d.ts +1 -3
  81. package/ToolbarItem.js +192 -0
  82. package/Translation.js +198 -0
  83. package/TranslationProperties.js +149 -0
  84. package/UncontrolledSliderWithPlusMinusBtns.css +5 -0
  85. package/UncontrolledSliderWithPlusMinusBtns.js +134 -0
  86. package/VeTopRightContainer.js +12 -0
  87. package/ZoomCircularViewSlider.js +62 -0
  88. package/ZoomLinearView.js +47 -0
  89. package/addAlignment.js +6 -0
  90. package/addMetaToActionCreators.js +12 -0
  91. package/addWrappedAddons.js +20 -0
  92. package/alignmentTool.js +503 -0
  93. package/alignments.js +379 -0
  94. package/annotationLabelVisibility.js +2 -0
  95. package/annotationSearchSelector.js +24 -0
  96. package/annotationTypes.js +35 -0
  97. package/annotationVisibility.js +196 -0
  98. package/annotationsToSupport.js +104 -0
  99. package/arrayToObjWithIds.js +17 -0
  100. package/arrayUtils.js +19 -0
  101. package/array_move.js +10 -0
  102. package/calculateTickMarkPositionsForGivenRange.js +47 -0
  103. package/caretPosition.js +27 -0
  104. package/cdsFeaturesSelector.js +9 -0
  105. package/charWidth.js +22 -0
  106. package/circular.js +19 -0
  107. package/circularSelector.js +4 -0
  108. package/clickAndDragUtils.js +576 -0
  109. package/coerceInitialValue.js +7 -0
  110. package/combineReducersDontIgnoreKeys.js +12 -0
  111. package/commandUtils.js +20 -0
  112. package/constants.js +2 -0
  113. package/copyOptions.js +34 -0
  114. package/createFragmentLines.js +120 -0
  115. package/createMergedDefaultStateReducer.js +30 -0
  116. package/createMetaAction.js +12 -0
  117. package/createSequenceInputPopup.js +290 -0
  118. package/createSequenceInputPopupStyle.css +87 -0
  119. package/createSimpleDialog.js +89 -0
  120. package/createYourOwnEnzyme.js +39 -0
  121. package/cutsiteLabelColorSelector.js +6 -0
  122. package/cutsiteTool.js +88 -0
  123. package/cutsitesByRangeSelector.js +5 -0
  124. package/cutsitesSelector.js +61 -0
  125. package/darkmode.css +98 -0
  126. package/defaultConfig.js +150 -0
  127. package/deletionLayers.js +36 -0
  128. package/description.js +21 -0
  129. package/digestTool.js +34 -0
  130. package/dnaToColor.js +17 -0
  131. package/downloadTool.js +39 -0
  132. package/draggableClassnames.js +5 -0
  133. package/drawAnnotations.js +440 -0
  134. package/drawDirectedPiePiece.js +142 -0
  135. package/editTool.js +49 -0
  136. package/editorSelector.js +2 -0
  137. package/editorUtils.js +205 -0
  138. package/estimateRowHeight.js +184 -0
  139. package/featureLengthsToHide.js +27 -0
  140. package/featureTool.js +34 -0
  141. package/features.js +19 -0
  142. package/featuresSelector.js +8 -0
  143. package/filteredCutsitesSelector.js +136 -0
  144. package/filteredFeaturesSelector.js +32 -0
  145. package/filteredPartsSelector.js +57 -0
  146. package/filteredPrimersSelector.js +27 -0
  147. package/filteredRestrictionEnzymesSelector.js +1 -0
  148. package/find.png +0 -0
  149. package/findTool.js +79 -0
  150. package/findToolConstants.js +1 -0
  151. package/frameTranslations.js +52 -0
  152. package/fullscreen.png +0 -0
  153. package/getAdditionalEnzymesSelector.js +46 -0
  154. package/getAngleForPositionMidpoint.js +3 -0
  155. package/getAnnotationClassnames.js +12 -0
  156. package/getAnnotationNameAndStartStopString.js +61 -0
  157. package/getBpsPerRow.js +19 -0
  158. package/getCutsiteLabelHeights.js +56 -0
  159. package/getGapMap.js +12 -0
  160. package/getGaps.js +27 -0
  161. package/getInternalLabel.js +40 -0
  162. package/getOveHotkeyDefs.js +12 -0
  163. package/getPairwiseOverviewLinearViewOptions.js +38 -0
  164. package/getRangeAnglesSpecial.js +12 -0
  165. package/getStructuredBases.js +97 -0
  166. package/getTrackFromEvent.js +25 -0
  167. package/getVisibleStartEnd.js +7 -0
  168. package/getXStartAndWidthFromNonCircularRange.js +12 -0
  169. package/getXStartAndWidthOfRangeWrtRow.js +27 -0
  170. package/getXStartAndWidthOfRowAnnotation.js +19 -0
  171. package/getYOffset.js +15 -0
  172. package/hoveredAnnotation.js +24 -0
  173. package/{html2canvas.esm--JN4fLQL.js → html2canvas.esm-DiGWN1gP.js} +187 -229
  174. package/{html2canvas.esm-B7d7VJmQ.cjs → html2canvas.esm-J1esNpMJ.cjs} +187 -229
  175. package/importTool.js +27 -0
  176. package/index.cjs.js +48165 -47142
  177. package/index.es.js +47699 -46676
  178. package/index.js +71 -0
  179. package/inlineFindTool.js +38 -0
  180. package/isElementInViewport.js +29 -0
  181. package/isEnzymeFilterAndSelector.js +1 -0
  182. package/isTargetWithinEl.js +6 -0
  183. package/labelLineIntensity.js +25 -0
  184. package/labelSize.js +23 -0
  185. package/ladderDefaults.js +25 -0
  186. package/lastSavedId.js +20 -0
  187. package/lineageLines.js +11 -0
  188. package/linear.png +0 -0
  189. package/makeStore.js +34 -0
  190. package/massageTickSpacing.js +19 -0
  191. package/materiallyAvailable.js +19 -0
  192. package/middleware.js +112 -0
  193. package/minimumOrfSize.js +24 -0
  194. package/minimumOrfSizeSelector.js +2 -0
  195. package/modalActions.js +3 -0
  196. package/moveCaret.js +58 -0
  197. package/name.js +19 -0
  198. package/normalizeAngle.js +3 -0
  199. package/normalizeAngleRange.js +9 -0
  200. package/oligoTool.js +30 -0
  201. package/onlyUpdateForKeysDeep.js +31 -0
  202. package/orfFrameToColorMap.js +10 -0
  203. package/orfTool.js +136 -0
  204. package/orfsSelector.js +15 -0
  205. package/ove.css +12107 -0
  206. package/package.json +8 -7
  207. package/panelsShown.js +294 -0
  208. package/partLengthsToHide.js +23 -0
  209. package/partOverhangs.js +6 -0
  210. package/partTagSearch.js +69 -0
  211. package/partTool.js +45 -0
  212. package/parts.js +19 -0
  213. package/partsSelector.js +8 -0
  214. package/pie.png +0 -0
  215. package/polarToSpecialCartesian.js +7 -0
  216. package/positionCutsites.js +6 -0
  217. package/prepareRowData.js +64 -0
  218. package/primerBases.js +221 -0
  219. package/primerLengthsToHide.js +27 -0
  220. package/primers.js +19 -0
  221. package/primersSelector.js +8 -0
  222. package/print.png +0 -0
  223. package/printTool.js +31 -0
  224. package/propertiesTool.js +40 -0
  225. package/proteinUtils.js +3 -0
  226. package/pureNoFunc.js +18 -0
  227. package/readOnly.js +25 -0
  228. package/redoTool.js +30 -0
  229. package/reflex-styles.css +128 -0
  230. package/reflex-styles.css.map +9 -0
  231. package/relaxLabelAngles.js +157 -0
  232. package/relaxLabels_DEPRECATED.js +105 -0
  233. package/replacementLayers.js +36 -0
  234. package/restrictionEnzymes.js +52 -0
  235. package/restrictionEnzymesSelector.js +34 -0
  236. package/rowviewContants.js +3 -0
  237. package/ruler.css +89 -0
  238. package/save.png +0 -0
  239. package/saveTool.js +44 -0
  240. package/searchLayersSelector.js +71 -0
  241. package/selectedAnnotations.js +89 -0
  242. package/selectedAnnotationsSelector.js +1 -0
  243. package/selectedCutsitesSelector.js +21 -0
  244. package/selectedPartTags.js +21 -0
  245. package/selectionLayer.js +25 -0
  246. package/selectors/annotationSearchSelector.d.ts +1 -1
  247. package/sequence.js +12 -0
  248. package/sequenceDataHistory.js +43 -0
  249. package/sequenceDataSelector.js +2 -0
  250. package/sequenceLengthSelector.js +5 -0
  251. package/sequenceSelector.js +4 -0
  252. package/sharedActionCreators.js +0 -0
  253. package/shouldFlipText.js +4 -0
  254. package/shouldRerender.js +27 -0
  255. package/showFileDialog.js +25 -0
  256. package/showGCContent.js +23 -0
  257. package/show_cut_sites.png +0 -0
  258. package/show_features.png +0 -0
  259. package/show_orfs.png +0 -0
  260. package/show_primers.png +0 -0
  261. package/simpleDialog.css +13 -0
  262. package/specialCutsiteFilterOptions.js +22 -0
  263. package/src/Editor/DropHandler.js +2 -1
  264. package/src/Editor/index.js +0 -2
  265. package/src/RowItem/StackedAnnotations/getStructuredBases.js +20 -6
  266. package/src/ToolBar/cutsiteTool.js +1 -1
  267. package/src/helperComponents/PropertiesDialog/TranslationProperties.js +2 -1
  268. package/style.css +3 -12100
  269. package/tagsToBoldSelector.js +2 -0
  270. package/toggle_views.svg +1 -0
  271. package/toolBar.js +23 -0
  272. package/translationSearchMatchesSelector.js +14 -0
  273. package/translations.js +20 -0
  274. package/translationsRawSelector.js +8 -0
  275. package/translationsSelector.js +137 -0
  276. package/typeField.js +24 -0
  277. package/undoTool.js +30 -0
  278. package/updateEditor.d.ts +1 -3
  279. package/updateEditor.js +200 -0
  280. package/updateLabelsForInViewFeatures.js +55 -0
  281. package/updateLabelsForInViewFeaturesCircView.js +41 -0
  282. package/updateTrackHelper.js +58 -0
  283. package/uppercaseSequenceMapFont.js +25 -0
  284. package/upsertDeleteActionGenerator.js +31 -0
  285. package/useAAColorType.js +8 -0
  286. package/useAdditionalOrfStartCodons.js +24 -0
  287. package/useAnnotationLimits.js +42 -0
  288. package/useChromatogramPrefs.js +31 -0
  289. package/useFormValue.js +7 -0
  290. package/useLadders.js +6 -0
  291. package/useMeltingTemp.js +7 -0
  292. package/useTmType.js +10 -0
  293. package/userDefinedHandlersAndOpts.js +61 -0
  294. package/utils/getAnnotationNameAndStartStopString.d.ts +1 -5
  295. package/utils/selectionLayer.d.ts +2 -2
  296. package/utils.js +37 -0
  297. package/versionHistory.js +26 -0
  298. package/versionHistoryTool.js +21 -0
  299. package/viewSubmenu.js +479 -0
  300. package/visibilityTool.js +39 -0
  301. package/withEditorInteractions/getBpsPerRow.d.ts +1 -3
  302. package/withHover.js +113 -0
  303. package/withRestrictionEnzymes.js +15 -0
  304. package/index.umd.js +0 -188322
@@ -0,0 +1,57 @@
1
+ import { createSelector } from "reselect";
2
+ import partsSelector from "./partsSelector";
3
+ import tagsToBoldSelector from "./tagsToBoldSelector";
4
+ import { some, keyBy, omitBy } from "lodash-es";
5
+ import { map } from "lodash-es";
6
+ import sequenceLengthSelector from "./sequenceLengthSelector";
7
+ import { hideAnnByLengthFilter } from "../utils/editorUtils";
8
+ import { addWrappedAddons } from "../utils/addWrappedAddons";
9
+
10
+ function filteredPartsSelector(
11
+ parts,
12
+ seqLen,
13
+ partIndividualToHide,
14
+ tagsToBold,
15
+ lengthsToHide
16
+ ) {
17
+ if (tagsToBold) {
18
+ const keyedTagsToBold = keyBy(tagsToBold, "value");
19
+
20
+ return map(parts || {}, p => {
21
+ if (p.tags) {
22
+ if (
23
+ some(p.tags, tagId => {
24
+ return keyedTagsToBold[tagId];
25
+ })
26
+ ) {
27
+ return {
28
+ ...p,
29
+ className: "partWithSelectedTag",
30
+ labelClassName: "partWithSelectedTag",
31
+ highPriorityLabel: true
32
+ };
33
+ } else {
34
+ return p;
35
+ }
36
+ }
37
+ });
38
+ }
39
+
40
+ const toRet = map(
41
+ omitBy(parts, ann => {
42
+ const hideIndividually = partIndividualToHide[ann.id];
43
+ return (
44
+ hideAnnByLengthFilter(lengthsToHide, ann, seqLen) || hideIndividually
45
+ );
46
+ })
47
+ );
48
+ return addWrappedAddons(toRet, seqLen);
49
+ }
50
+ export default createSelector(
51
+ partsSelector,
52
+ sequenceLengthSelector,
53
+ state => state.annotationVisibility.partIndividualToHide,
54
+ tagsToBoldSelector,
55
+ state => state.partLengthsToHide,
56
+ filteredPartsSelector
57
+ );
@@ -0,0 +1,27 @@
1
+ import { createSelector } from "reselect";
2
+ import { omitBy } from "lodash-es";
3
+ import primersSelector from "./primersSelector";
4
+ import sequenceLengthSelector from "./sequenceLengthSelector";
5
+ import { hideAnnByLengthFilter } from "../utils/editorUtils";
6
+
7
+ function filteredPrimersSelector(
8
+ primers,
9
+ seqLen,
10
+ primerIndividualToHide,
11
+ lengthsToHide
12
+ ) {
13
+ return omitBy(primers, ann => {
14
+ const hideIndividually = primerIndividualToHide[ann.id];
15
+ return (
16
+ hideAnnByLengthFilter(lengthsToHide, ann, seqLen) || hideIndividually
17
+ );
18
+ });
19
+ }
20
+
21
+ export default createSelector(
22
+ primersSelector,
23
+ sequenceLengthSelector,
24
+ state => state.annotationVisibility.primerIndividualToHide,
25
+ state => state.primerLengthsToHide,
26
+ filteredPrimersSelector
27
+ );
@@ -0,0 +1 @@
1
+ export default state => state.restrictionEnzymes.filteredRestrictionEnzymes;
package/find.png ADDED
Binary file
package/findTool.js ADDED
@@ -0,0 +1,79 @@
1
+ import createAction from "./utils/createMetaAction";
2
+ import createMergedDefaultStateReducer from "./utils/createMergedDefaultStateReducer";
3
+ import { noop } from "lodash-es";
4
+
5
+ // ------------------------------------
6
+ // Actions
7
+ // ------------------------------------
8
+ export const toggleFindTool = createAction("TOGGLE_FIND_TOOL", noop); //NOTE!!:: second argument sanitizes actions so no payload is passed!
9
+ export const toggleHighlightAll = createAction("toggleHighlightAll", noop); //NOTE!!:: second argument sanitizes actions so no payload is passed!
10
+ export const toggleIsInline = createAction("toggleIsInline", noop); //NOTE!!:: second argument sanitizes actions so no payload is passed!
11
+ export const updateSearchText = createAction("updateSearchText");
12
+ export const updateAmbiguousOrLiteral = createAction(
13
+ "updateAmbiguousOrLiteral"
14
+ );
15
+ export const updateDnaOrAA = createAction("updateDnaOrAA");
16
+ export const updateMatchNumber = createAction("updateMatchNumber");
17
+
18
+ // ------------------------------------
19
+ // Reducer
20
+ // ------------------------------------
21
+ export default createMergedDefaultStateReducer(
22
+ {
23
+ [toggleFindTool]: state => {
24
+ return {
25
+ ...state,
26
+ isOpen: !state.isOpen
27
+ };
28
+ },
29
+ [toggleHighlightAll]: state => {
30
+ return {
31
+ ...state,
32
+ highlightAll: !state.highlightAll
33
+ };
34
+ },
35
+ [toggleIsInline]: state => {
36
+ localStorage.setItem("veFindBarIsExpanded", state.isInline);
37
+ return {
38
+ ...state,
39
+ isInline: !state.isInline
40
+ };
41
+ },
42
+ [updateAmbiguousOrLiteral]: (state, payload) => {
43
+ return {
44
+ ...state,
45
+ matchNumber: 0,
46
+ ambiguousOrLiteral: payload
47
+ };
48
+ },
49
+ [updateDnaOrAA]: (state, payload) => {
50
+ return {
51
+ ...state,
52
+ matchNumber: 0,
53
+ dnaOrAA: payload
54
+ };
55
+ },
56
+ [updateSearchText]: (state, payload) => {
57
+ return {
58
+ ...state,
59
+ matchNumber: 0,
60
+ searchText: payload
61
+ };
62
+ },
63
+ [updateMatchNumber]: (state, payload) => {
64
+ return {
65
+ ...state,
66
+ matchNumber: payload
67
+ };
68
+ }
69
+ },
70
+ {
71
+ isOpen: false,
72
+ isInline: !localStorage.getItem("veFindBarIsExpanded"),
73
+ searchText: "",
74
+ dnaOrAA: "DNA",
75
+ ambiguousOrLiteral: "LITERAL",
76
+ highlightAll: false,
77
+ matchNumber: 0
78
+ }
79
+ );
@@ -0,0 +1 @@
1
+ export const MAX_MATCHES_DISPLAYED = 1000;
@@ -0,0 +1,52 @@
1
+ //./caretPosition.js
2
+ import { createReducer } from "redux-act";
3
+ import createAction from "./utils/createMetaAction";
4
+
5
+ // ------------------------------------
6
+ // Actions
7
+ // ------------------------------------
8
+ export const frameTranslationToggle = createAction("FRAME_TRANSLATION_TOGGLE");
9
+ export const frameTranslationToggleOn = createAction(
10
+ "FRAME_TRANSLATION_TOGGLE_ON"
11
+ );
12
+ export const frameTranslationToggleOff = createAction(
13
+ "FRAME_TRANSLATION_TOGGLE_OFF"
14
+ );
15
+
16
+ // ------------------------------------
17
+ // Reducer
18
+ // ------------------------------------
19
+ export default createReducer(
20
+ {
21
+ [frameTranslationToggle]: (state, payload) => {
22
+ return {
23
+ ...state,
24
+ [payload]: !state[payload]
25
+ };
26
+ },
27
+ [frameTranslationToggleOn]: (state, payload) => {
28
+ return {
29
+ ...state,
30
+ [payload]: true
31
+ };
32
+ },
33
+ [frameTranslationToggleOff]: (state, payload) => {
34
+ return {
35
+ ...state,
36
+ [payload]: false
37
+ };
38
+ }
39
+ },
40
+ {
41
+ 1: false,
42
+ 2: false,
43
+ 3: false,
44
+ "-1": false,
45
+ "-2": false,
46
+ "-3": false
47
+ }
48
+ );
49
+
50
+ export function getMinimumOrfSize(state) {
51
+ return state;
52
+ }
package/fullscreen.png ADDED
Binary file
@@ -0,0 +1,46 @@
1
+ import { pickBy } from "lodash-es";
2
+ import { createSelector } from "reselect";
3
+ import { getLowerCaseObj } from "../utils/arrayUtils";
4
+ import { getCustomEnzymes } from "../utils/editorUtils";
5
+
6
+ export default createSelector(
7
+ () => window.localStorage.getItem("customEnzymes"),
8
+ (state, additionalEnzymes) => additionalEnzymes,
9
+ (customEnzymesString, additionalEnzymes) => {
10
+ return getLowerCaseObj(
11
+ pickBy(
12
+ {
13
+ ...additionalEnzymes,
14
+ ...getCustomEnzymes(customEnzymesString)
15
+ },
16
+ (val, key) => {
17
+ if (!val) {
18
+ console.error(
19
+ "43ti3523: Error: Missing enzyme data for key: ",
20
+ key,
21
+ "Ignoring this enzyme"
22
+ );
23
+ return false;
24
+ }
25
+
26
+ // eslint-disable-next-line no-unused-vars
27
+ for (const prop of [
28
+ "forwardRegex",
29
+ "reverseRegex",
30
+ "topSnipOffset",
31
+ "bottomSnipOffset",
32
+ "site"
33
+ ]) {
34
+ if (val[prop] === undefined || val[prop] === null) {
35
+ console.error(
36
+ `23483g93h Error: Missing property ${prop} for enzyme ${key}. Ignoring this enzyme`
37
+ );
38
+ return false;
39
+ }
40
+ }
41
+ return true;
42
+ }
43
+ )
44
+ );
45
+ }
46
+ );
@@ -0,0 +1,3 @@
1
+ export default function getAngleForPositionMidpoint(position, maxLength) {
2
+ return maxLength === 0 ? 0 : ((position + 0.5) / maxLength) * Math.PI * 2;
3
+ }
@@ -0,0 +1,12 @@
1
+ import classnames from "classnames";
2
+ import { upperFirst } from "lodash-es";
3
+
4
+ export default function getAnnotationClassnames(
5
+ { overlapsSelf },
6
+ { viewName, type }
7
+ ) {
8
+ const Type = upperFirst(type);
9
+ return classnames(`ve${Type}`, `ve${viewName}${Type}`, {
10
+ overlapsSelf
11
+ });
12
+ }
@@ -0,0 +1,61 @@
1
+ import { upperFirst } from "lodash-es";
2
+ import { getSingular } from "./annotationTypes";
3
+
4
+ export default function getAnnotationNameAndStartStopString(
5
+ {
6
+ name,
7
+ start,
8
+ end,
9
+ type,
10
+ message,
11
+ annotationTypePlural,
12
+ overlapsSelf,
13
+ isWrappedAddon
14
+ },
15
+ { startText, isProtein, readOnly } = {}
16
+ ) {
17
+ const typeToUse = (() => {
18
+ if (annotationTypePlural) {
19
+ const singularKey = getSingular(annotationTypePlural);
20
+ if (singularKey === "cutsite") {
21
+ return (
22
+ "Cut site" + (annotationTypePlural === "features" ? ` (${type})` : "")
23
+ );
24
+ }
25
+ if (singularKey === "orf") {
26
+ return (
27
+ "ORF" + (annotationTypePlural === "features" ? ` (${type})` : "")
28
+ );
29
+ }
30
+ return (
31
+ upperFirst(getSingular(annotationTypePlural)) +
32
+ (annotationTypePlural === "features" ? ` (${type})` : "")
33
+ );
34
+ }
35
+ return "";
36
+ })();
37
+
38
+ if (isWrappedAddon) {
39
+ const oldEnd = end;
40
+ end = start - 1;
41
+ start = oldEnd + 1;
42
+ }
43
+ return `${startText ? startText : ""} ${typeToUse ? typeToUse + " -" : ""} ${
44
+ name ? name : ""
45
+ } - Start: ${isProtein ? (start + 3) / 3 : start + 1} End: ${
46
+ isProtein ? (end + 1) / 3 : end + 1
47
+ } ${overlapsSelf ? "(Overlaps Self) " : ""}${message ? "\n" + message : ""} ${
48
+ readOnly
49
+ ? ""
50
+ : annotationTypePlural === "cutsites"
51
+ ? `
52
+
53
+ click --> top cut position
54
+ alt/option+click --> bottom cut position
55
+ cmd/ctrl+click --> recognition range`
56
+ : `
57
+
58
+ alt/option+click --> jump row view to start/end
59
+ double click --> edit`
60
+ }`;
61
+ }
@@ -0,0 +1,19 @@
1
+ import {
2
+ defaultCharWidth,
3
+ defaultContainerWidth,
4
+ defaultMarginWidth
5
+ } from "../constants/rowviewContants";
6
+
7
+ export default function getBpsPerRow({
8
+ charWidth = defaultCharWidth,
9
+ width = defaultContainerWidth,
10
+ dimensions: { width: width2 } = {},
11
+ marginWidth = defaultMarginWidth,
12
+ sequenceData
13
+ }) {
14
+ const toRet = Math.floor(
15
+ ((width2 || width) - marginWidth) /
16
+ (sequenceData.isProtein ? charWidth * 3 : charWidth)
17
+ );
18
+ return sequenceData.isProtein ? toRet * 3 : toRet;
19
+ }
@@ -0,0 +1,56 @@
1
+ //tnr: not actually used yet. I don't think it is necessary
2
+ // for the cutsite label heights to be perfect
3
+
4
+ import getXStartAndWidthOfRowAnnotation from "./getXStartAndWidthOfRowAnnotation";
5
+ import IntervalTree from "node-interval-tree";
6
+ import getYOffset from "../CircularView/getYOffset";
7
+ import forEach from "lodash/forEach";
8
+
9
+ export default function getCutsiteLabelHeights({
10
+ bpsPerRow,
11
+ charWidth,
12
+ annotationRanges,
13
+ annotationHeight,
14
+ spaceBetweenAnnotations,
15
+ textWidth
16
+ }) {
17
+ const rowLength = bpsPerRow * charWidth;
18
+ let counter = 0;
19
+ let maxAnnotationYOffset = 0;
20
+ const rowCenter = rowLength / 2;
21
+ const iTree = new IntervalTree(rowCenter);
22
+ forEach(annotationRanges, function (annotationRange) {
23
+ counter++;
24
+ if (counter > 50) return;
25
+ let annotation = annotationRange.annotation;
26
+ if (!annotation) {
27
+ annotation = annotationRange;
28
+ }
29
+ const labelLength = annotation.restrictionEnzyme.name.length * textWidth;
30
+ let { xStart } = getXStartAndWidthOfRowAnnotation(
31
+ annotationRange,
32
+ bpsPerRow,
33
+ charWidth
34
+ );
35
+ let xEnd = xStart + labelLength;
36
+
37
+ if (xEnd > rowLength) {
38
+ xStart = xStart - (xEnd - rowLength);
39
+ xEnd = rowLength;
40
+ }
41
+ const yOffset = getYOffset(iTree, xStart, xEnd);
42
+ iTree.insert(xStart, xEnd, {
43
+ ...annotationRange,
44
+ yOffset
45
+ });
46
+
47
+ if (yOffset > maxAnnotationYOffset) {
48
+ maxAnnotationYOffset = yOffset;
49
+ }
50
+ const height = yOffset * (annotationHeight + spaceBetweenAnnotations);
51
+ annotation.height = height;
52
+ });
53
+ const containerHeight =
54
+ (maxAnnotationYOffset + 1) * (annotationHeight + spaceBetweenAnnotations);
55
+ return containerHeight;
56
+ }
package/getGapMap.js ADDED
@@ -0,0 +1,12 @@
1
+ export function getGapMap(sequence) {
2
+ const gapMap = [0]; //a map of position to how many gaps come before that position [0,0,0,5,5,5,5,17,17,17, ]
3
+ sequence.split("").forEach(char => {
4
+ if (char === "-") {
5
+ gapMap[Math.max(0, gapMap.length - 1)] =
6
+ (gapMap[Math.max(0, gapMap.length - 1)] || 0) + 1;
7
+ } else {
8
+ gapMap.push(gapMap[gapMap.length - 1] || 0);
9
+ }
10
+ });
11
+ return gapMap;
12
+ }
package/getGaps.js ADDED
@@ -0,0 +1,27 @@
1
+ import { getGapMap } from "./getGapMap";
2
+
3
+ /**
4
+ * this function is used to calculate the number of spaces that come before or inside a range
5
+ */
6
+ export let getGaps = () => ({
7
+ gapsBefore: 0,
8
+ gapsInside: 0
9
+ });
10
+ getGaps = (rangeOrCaretPosition, sequence) => {
11
+ const gapMap = getGapMap(sequence);
12
+ if (typeof rangeOrCaretPosition !== "object") {
13
+ return {
14
+ gapsBefore: gapMap[Math.min(rangeOrCaretPosition, gapMap.length - 1)]
15
+ };
16
+ }
17
+ //otherwise it is a range!
18
+ const { start, end } = rangeOrCaretPosition;
19
+ const toReturn = {
20
+ gapsBefore: gapMap[start],
21
+ gapsInside:
22
+ gapMap[Math.min(end, gapMap.length - 1)] -
23
+ gapMap[Math.min(start, gapMap.length - 1)]
24
+ };
25
+
26
+ return toReturn;
27
+ };
@@ -0,0 +1,40 @@
1
+ import Color from "color";
2
+ import React from "react";
3
+
4
+ export function getInternalLabel({
5
+ ellipsizedName,
6
+ id,
7
+ annotationType,
8
+ revTransform,
9
+ angleAdjust,
10
+ isPart,
11
+ colorToUse,
12
+ textPath,
13
+ locationNumber
14
+ }) {
15
+ if (!ellipsizedName) return null;
16
+ const pathId = `${annotationType}${id}${locationNumber ?? ""}`;
17
+ return (
18
+ <>
19
+ <path id={pathId} fill="none" d={textPath.print()}></path>
20
+ <text
21
+ className="veLabelText veCircularViewInternalLabelText ve-monospace-font"
22
+ transform={
23
+ (revTransform || "") + (angleAdjust ? ` rotate(${angleAdjust})` : "")
24
+ }
25
+ fill={
26
+ isPart ? "#ac68cc" : Color(colorToUse).isDark() ? "white" : "black"
27
+ }
28
+ dy={-3}
29
+ >
30
+ <textPath
31
+ textAnchor="middle"
32
+ startOffset="50%"
33
+ xlinkHref={`#${pathId}`}
34
+ >
35
+ {ellipsizedName}
36
+ </textPath>
37
+ </text>
38
+ </>
39
+ );
40
+ }
@@ -0,0 +1,12 @@
1
+ import getCommands from "./index";
2
+ import { getCommandHotkeys } from "@teselagen/ui";
3
+
4
+ export default function getOveHotkeyDefs({ store, editorName }) {
5
+ const commands = getCommands({
6
+ props: {
7
+ store,
8
+ editorName
9
+ }
10
+ });
11
+ return getCommandHotkeys(commands);
12
+ }
@@ -0,0 +1,38 @@
1
+ export function getPairwiseOverviewLinearViewOptions({ isTemplate }) {
2
+ if (!isTemplate) {
3
+ return {
4
+ annotationVisibilityOverrides: {
5
+ features: false,
6
+ translations: false,
7
+ parts: false,
8
+ orfs: false,
9
+ orfTranslations: false,
10
+ cdsFeatureTranslations: false,
11
+ axis: false,
12
+ cutsites: false,
13
+ primers: false,
14
+ chromatogram: false,
15
+ sequence: false,
16
+ dnaColors: false,
17
+ reverseSequence: false,
18
+ axisNumbers: false
19
+ }
20
+ };
21
+ } else {
22
+ return {
23
+ // annotationVisibilityOverrides: {
24
+ // features: false,
25
+ // yellowAxis: false,
26
+ // translations: false,
27
+ // parts: false,
28
+ // orfs: false,
29
+ // orfTranslations: false,
30
+ // axis: true,
31
+ // cutsites: false,
32
+ // primers: false,
33
+ // reverseSequence: false,
34
+ // axisNumbers: false
35
+ // }
36
+ };
37
+ }
38
+ }
@@ -0,0 +1,12 @@
1
+ import { getRangeAngles } from "@teselagen/range-utils";
2
+ export default function getRangeAnglesSpecial() {
3
+ const { endAngle, totalAngle, ...rest } = getRangeAngles.apply(
4
+ this,
5
+ arguments
6
+ );
7
+ return {
8
+ endAngle: endAngle - 0.00001, //we subtract a tiny amount because an angle of 2PI will cause nothing to be drawn!
9
+ totalAngle: totalAngle - 0.00001, //we subtract a tiny amount because we don't want the range comparisons to treat the same angle as overlapping
10
+ ...rest
11
+ };
12
+ }
@@ -0,0 +1,97 @@
1
+ import { clone } from "lodash-es";
2
+ import { getRangeLength, getSequenceWithinRange } from "@teselagen/range-utils";
3
+ import { getComplementSequenceString } from "@teselagen/sequence-utils";
4
+ import { bioData } from "@teselagen/sequence-utils";
5
+ const { ambiguous_dna_values } = bioData;
6
+ export function getStructuredBases({
7
+ annotationRange,
8
+ forward,
9
+ bases = "",
10
+ start,
11
+ end,
12
+ fullSequence,
13
+ primerBindsOn,
14
+ sequenceLength
15
+ }) {
16
+ const annLen = getRangeLength({ start, end }, sequenceLength);
17
+ let basesToUse = bases;
18
+ if (bases.length < annLen) {
19
+ if (forward && primerBindsOn === "3prime") {
20
+ const toAddLen = annLen - bases.length;
21
+ for (let index = 0; index < toAddLen; index++) {
22
+ basesToUse = "&" + basesToUse;
23
+ }
24
+ } else if (!forward && primerBindsOn === "5prime") {
25
+ const toAddLen = annLen - bases.length;
26
+ for (let index = 0; index < toAddLen; index++) {
27
+ basesToUse = basesToUse + "&";
28
+ }
29
+ }
30
+ }
31
+ const aRange = {
32
+ //tnr: this probably needs to be changed in case annotation wraps origin
33
+ start: annotationRange.start - start,
34
+ end: annotationRange.end - start
35
+ };
36
+ const r = {
37
+ aRange,
38
+ basesNoInserts: basesToUse,
39
+ inserts: []
40
+ };
41
+
42
+ const baseLen = basesToUse.length;
43
+ const diffLen = baseLen - annLen;
44
+ if (diffLen > 0) {
45
+ r.basesNoInserts = basesToUse.slice(
46
+ primerBindsOn === "5prime" ? 0 : diffLen,
47
+ primerBindsOn === "5prime" ? annLen : baseLen
48
+ );
49
+ const insertBases = basesToUse.slice(
50
+ primerBindsOn === "5prime" ? annLen : 0,
51
+ primerBindsOn === "5prime" ? baseLen : diffLen
52
+ );
53
+
54
+ r.inserts = [
55
+ {
56
+ bases: insertBases,
57
+ index: primerBindsOn === "5prime" ? annLen : 0
58
+ }
59
+ ];
60
+ }
61
+ const basesForRange = getSequenceWithinRange(
62
+ aRange,
63
+ forward ? r.basesNoInserts : r.basesNoInserts.split("").reverse().join("")
64
+ );
65
+ r.basesNoInsertsWithMetaData = basesForRange.split("").map((b, i) => {
66
+ const indexOfBase = i + annotationRange.start;
67
+ let seqForBase = (fullSequence && fullSequence[indexOfBase]) || "";
68
+ if (!forward) {
69
+ seqForBase = getComplementSequenceString(seqForBase);
70
+ }
71
+ const isMatch = seqForBase.toLowerCase() === b.toLowerCase();
72
+ const isAmbiguousMatch =
73
+ !isMatch &&
74
+ ambiguous_dna_values[b.toUpperCase()]?.length > 1 &&
75
+ ambiguous_dna_values[b.toUpperCase()]?.includes(seqForBase.toUpperCase());
76
+ return {
77
+ b,
78
+ isMatch,
79
+ isAmbiguousMatch
80
+ };
81
+ });
82
+ r.allBasesWithMetaData = clone(r.basesNoInsertsWithMetaData);
83
+ if (!forward) {
84
+ r.allBasesWithMetaData = r.allBasesWithMetaData.reverse();
85
+ }
86
+ r.inserts
87
+ .sort((a, b) => a.index - b.index)
88
+ .forEach(({ bases, index }) => {
89
+ r.allBasesWithMetaData.splice(
90
+ index,
91
+ 0,
92
+ ...bases.split("").map(b => ({ b, isMatch: false }))
93
+ );
94
+ });
95
+
96
+ return r;
97
+ }