@teselagen/ove 0.7.28 → 0.7.29

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 (285) hide show
  1. package/index.cjs.js +1055 -996
  2. package/index.es.js +1055 -996
  3. package/index.umd.js +189036 -0
  4. package/ove.css +1 -1
  5. package/package.json +2 -6
  6. package/src/helperComponents/PropertiesDialog/TranslationProperties.js +1 -1
  7. package/AASliver.js +0 -187
  8. package/AddLaddersDialog.js +0 -82
  9. package/AdditionalCutsiteInfoDialog.js +0 -599
  10. package/AlignmentVisibilityTool.js +0 -105
  11. package/AnnotationContainerHolder.js +0 -20
  12. package/AnnotationPositioner.js +0 -27
  13. package/AutoAnnotate.js +0 -501
  14. package/AutoAnnotateBpMatchingDialog.js +0 -208
  15. package/Axis.js +0 -151
  16. package/AxisNumbers.js +0 -35
  17. package/Browser.js +0 -106
  18. package/Caret.js +0 -63
  19. package/Chromatogram.js +0 -293
  20. package/CircularDnaSequence.js +0 -73
  21. package/CircularZoomMinimap.js +0 -16
  22. package/ColorPicker.js +0 -30
  23. package/CommandHotkeyHandler.js +0 -44
  24. package/CreateAnnotationsPage.js +0 -98
  25. package/Cutsite.js +0 -18
  26. package/CutsiteProperties.js +0 -176
  27. package/CutsiteSelectionLayers.js +0 -47
  28. package/Cutsites.js +0 -271
  29. package/DeletionLayer.js +0 -28
  30. package/DropHandler.css +0 -21
  31. package/DropHandler.js +0 -64
  32. package/EditCaretPosition.js +0 -234
  33. package/EditTrackNameDialog.js +0 -30
  34. package/Feature.js +0 -83
  35. package/FeatureProperties.js +0 -6
  36. package/FillWindow.js +0 -47
  37. package/GenbankView.js +0 -74
  38. package/GeneralProperties.js +0 -117
  39. package/GenericAnnotationProperties.js +0 -406
  40. package/GlobalDialog.js +0 -73
  41. package/GlobalDialogUtils.js +0 -110
  42. package/GoToDialog.js +0 -25
  43. package/HorizontalPanelDragHandle.js +0 -35
  44. package/Keyboard.js +0 -85
  45. package/Labels.js +0 -327
  46. package/Ladder.css +0 -20
  47. package/Ladder.js +0 -303
  48. package/MeltingTemp.js +0 -85
  49. package/Menlo.ttf +0 -0
  50. package/Minimap.js +0 -515
  51. package/Mismatches.js +0 -134
  52. package/Monaco.ttf +0 -0
  53. package/MultipleSeqsDetectedOnImportDialog.js +0 -74
  54. package/Orf.js +0 -109
  55. package/OrfProperties.js +0 -117
  56. package/Orfs.js +0 -35
  57. package/PCRTool.js +0 -179
  58. package/PairwiseAlignmentView.js +0 -68
  59. package/Part.js +0 -34
  60. package/PartProperties.js +0 -9
  61. package/PassThrough.js +0 -3
  62. package/PerformantSelectionLayer.js +0 -32
  63. package/PinchHelper.js +0 -24
  64. package/PointedAnnotation.js +0 -347
  65. package/PositionAnnotationOnCircle.js +0 -26
  66. package/Primer.js +0 -41
  67. package/PrimerProperties.js +0 -19
  68. package/ReflexContainer.js +0 -802
  69. package/ReflexElement.js +0 -160
  70. package/ReflexEvents.js +0 -77
  71. package/ReflexSplitter.js +0 -205
  72. package/RenameSequenceDialog.js +0 -7
  73. package/RotateCircularViewSlider.js +0 -93
  74. package/SelectDialog.js +0 -150
  75. package/SequenceName.js +0 -15
  76. package/SimpleCircularOrLinearView.js +0 -381
  77. package/SimpleOligoPreview.js +0 -39
  78. package/SingleEnzymeCutsiteInfo.js +0 -139
  79. package/ToolbarItem.js +0 -192
  80. package/Translation.js +0 -198
  81. package/TranslationProperties.js +0 -149
  82. package/UncontrolledSliderWithPlusMinusBtns.css +0 -5
  83. package/UncontrolledSliderWithPlusMinusBtns.js +0 -134
  84. package/VeTopRightContainer.js +0 -12
  85. package/ZoomCircularViewSlider.js +0 -62
  86. package/ZoomLinearView.js +0 -47
  87. package/addAlignment.js +0 -6
  88. package/addMetaToActionCreators.js +0 -12
  89. package/addWrappedAddons.js +0 -20
  90. package/alignmentTool.js +0 -503
  91. package/alignments.js +0 -379
  92. package/annotationLabelVisibility.js +0 -2
  93. package/annotationSearchSelector.js +0 -24
  94. package/annotationTypes.js +0 -35
  95. package/annotationVisibility.js +0 -196
  96. package/annotationsToSupport.js +0 -104
  97. package/arrayToObjWithIds.js +0 -17
  98. package/arrayUtils.js +0 -19
  99. package/array_move.js +0 -10
  100. package/calculateTickMarkPositionsForGivenRange.js +0 -47
  101. package/caretPosition.js +0 -27
  102. package/cdsFeaturesSelector.js +0 -9
  103. package/charWidth.js +0 -22
  104. package/circular.js +0 -19
  105. package/circularSelector.js +0 -4
  106. package/clickAndDragUtils.js +0 -576
  107. package/coerceInitialValue.js +0 -7
  108. package/combineReducersDontIgnoreKeys.js +0 -12
  109. package/commandUtils.js +0 -20
  110. package/constants.js +0 -2
  111. package/copyOptions.js +0 -34
  112. package/createFragmentLines.js +0 -120
  113. package/createMergedDefaultStateReducer.js +0 -30
  114. package/createMetaAction.js +0 -12
  115. package/createSequenceInputPopup.js +0 -290
  116. package/createSequenceInputPopupStyle.css +0 -87
  117. package/createSimpleDialog.js +0 -89
  118. package/createYourOwnEnzyme.js +0 -39
  119. package/cutsiteLabelColorSelector.js +0 -6
  120. package/cutsiteTool.js +0 -88
  121. package/cutsitesByRangeSelector.js +0 -5
  122. package/cutsitesSelector.js +0 -61
  123. package/darkmode.css +0 -98
  124. package/defaultConfig.js +0 -150
  125. package/deletionLayers.js +0 -36
  126. package/description.js +0 -21
  127. package/digestTool.js +0 -34
  128. package/dnaToColor.js +0 -17
  129. package/downloadTool.js +0 -39
  130. package/draggableClassnames.js +0 -5
  131. package/drawAnnotations.js +0 -440
  132. package/drawDirectedPiePiece.js +0 -142
  133. package/editTool.js +0 -49
  134. package/editorSelector.js +0 -2
  135. package/editorUtils.js +0 -205
  136. package/estimateRowHeight.js +0 -184
  137. package/featureLengthsToHide.js +0 -27
  138. package/featureTool.js +0 -34
  139. package/features.js +0 -19
  140. package/featuresSelector.js +0 -8
  141. package/filteredCutsitesSelector.js +0 -136
  142. package/filteredFeaturesSelector.js +0 -32
  143. package/filteredPartsSelector.js +0 -57
  144. package/filteredPrimersSelector.js +0 -27
  145. package/filteredRestrictionEnzymesSelector.js +0 -1
  146. package/find.png +0 -0
  147. package/findTool.js +0 -79
  148. package/findToolConstants.js +0 -1
  149. package/frameTranslations.js +0 -52
  150. package/fullscreen.png +0 -0
  151. package/getAdditionalEnzymesSelector.js +0 -46
  152. package/getAngleForPositionMidpoint.js +0 -3
  153. package/getAnnotationClassnames.js +0 -12
  154. package/getAnnotationNameAndStartStopString.js +0 -61
  155. package/getBpsPerRow.js +0 -19
  156. package/getCutsiteLabelHeights.js +0 -56
  157. package/getGapMap.js +0 -12
  158. package/getGaps.js +0 -27
  159. package/getInternalLabel.js +0 -40
  160. package/getOveHotkeyDefs.js +0 -12
  161. package/getPairwiseOverviewLinearViewOptions.js +0 -38
  162. package/getRangeAnglesSpecial.js +0 -12
  163. package/getStructuredBases.js +0 -97
  164. package/getTrackFromEvent.js +0 -25
  165. package/getVisibleStartEnd.js +0 -7
  166. package/getXStartAndWidthFromNonCircularRange.js +0 -12
  167. package/getXStartAndWidthOfRangeWrtRow.js +0 -27
  168. package/getXStartAndWidthOfRowAnnotation.js +0 -19
  169. package/getYOffset.js +0 -15
  170. package/hoveredAnnotation.js +0 -24
  171. package/importTool.js +0 -27
  172. package/index.js +0 -71
  173. package/inlineFindTool.js +0 -38
  174. package/isElementInViewport.js +0 -29
  175. package/isEnzymeFilterAndSelector.js +0 -1
  176. package/isTargetWithinEl.js +0 -6
  177. package/labelLineIntensity.js +0 -25
  178. package/labelSize.js +0 -23
  179. package/ladderDefaults.js +0 -25
  180. package/lastSavedId.js +0 -20
  181. package/lineageLines.js +0 -11
  182. package/linear.png +0 -0
  183. package/makeStore.js +0 -34
  184. package/massageTickSpacing.js +0 -19
  185. package/materiallyAvailable.js +0 -19
  186. package/middleware.js +0 -112
  187. package/minimumOrfSize.js +0 -24
  188. package/minimumOrfSizeSelector.js +0 -2
  189. package/modalActions.js +0 -3
  190. package/moveCaret.js +0 -58
  191. package/name.js +0 -19
  192. package/normalizeAngle.js +0 -3
  193. package/normalizeAngleRange.js +0 -9
  194. package/oligoTool.js +0 -30
  195. package/onlyUpdateForKeysDeep.js +0 -31
  196. package/orfFrameToColorMap.js +0 -10
  197. package/orfTool.js +0 -136
  198. package/orfsSelector.js +0 -15
  199. package/panelsShown.js +0 -294
  200. package/partLengthsToHide.js +0 -23
  201. package/partOverhangs.js +0 -6
  202. package/partTagSearch.js +0 -69
  203. package/partTool.js +0 -45
  204. package/parts.js +0 -19
  205. package/partsSelector.js +0 -8
  206. package/pie.png +0 -0
  207. package/polarToSpecialCartesian.js +0 -7
  208. package/positionCutsites.js +0 -6
  209. package/prepareRowData.js +0 -64
  210. package/primerBases.js +0 -221
  211. package/primerLengthsToHide.js +0 -27
  212. package/primers.js +0 -19
  213. package/primersSelector.js +0 -8
  214. package/print.png +0 -0
  215. package/printTool.js +0 -31
  216. package/propertiesTool.js +0 -40
  217. package/proteinUtils.js +0 -3
  218. package/pureNoFunc.js +0 -18
  219. package/readOnly.js +0 -25
  220. package/redoTool.js +0 -30
  221. package/reflex-styles.css +0 -128
  222. package/reflex-styles.css.map +0 -9
  223. package/relaxLabelAngles.js +0 -157
  224. package/relaxLabels_DEPRECATED.js +0 -105
  225. package/replacementLayers.js +0 -36
  226. package/restrictionEnzymes.js +0 -52
  227. package/restrictionEnzymesSelector.js +0 -34
  228. package/rowviewContants.js +0 -3
  229. package/ruler.css +0 -89
  230. package/save.png +0 -0
  231. package/saveTool.js +0 -44
  232. package/searchLayersSelector.js +0 -71
  233. package/selectedAnnotations.js +0 -89
  234. package/selectedAnnotationsSelector.js +0 -1
  235. package/selectedCutsitesSelector.js +0 -21
  236. package/selectedPartTags.js +0 -21
  237. package/selectionLayer.js +0 -25
  238. package/sequence.js +0 -12
  239. package/sequenceDataHistory.js +0 -43
  240. package/sequenceDataSelector.js +0 -2
  241. package/sequenceLengthSelector.js +0 -5
  242. package/sequenceSelector.js +0 -4
  243. package/sharedActionCreators.js +0 -0
  244. package/shouldFlipText.js +0 -4
  245. package/shouldRerender.js +0 -27
  246. package/showFileDialog.js +0 -25
  247. package/showGCContent.js +0 -23
  248. package/show_cut_sites.png +0 -0
  249. package/show_features.png +0 -0
  250. package/show_orfs.png +0 -0
  251. package/show_primers.png +0 -0
  252. package/simpleDialog.css +0 -13
  253. package/specialCutsiteFilterOptions.js +0 -22
  254. package/style.css +0 -10
  255. package/tagsToBoldSelector.js +0 -2
  256. package/toggle_views.svg +0 -1
  257. package/toolBar.js +0 -23
  258. package/translationSearchMatchesSelector.js +0 -14
  259. package/translations.js +0 -20
  260. package/translationsRawSelector.js +0 -8
  261. package/translationsSelector.js +0 -137
  262. package/typeField.js +0 -24
  263. package/undoTool.js +0 -30
  264. package/updateEditor.js +0 -200
  265. package/updateLabelsForInViewFeatures.js +0 -55
  266. package/updateLabelsForInViewFeaturesCircView.js +0 -41
  267. package/updateTrackHelper.js +0 -58
  268. package/uppercaseSequenceMapFont.js +0 -25
  269. package/upsertDeleteActionGenerator.js +0 -31
  270. package/useAAColorType.js +0 -8
  271. package/useAdditionalOrfStartCodons.js +0 -24
  272. package/useAnnotationLimits.js +0 -42
  273. package/useChromatogramPrefs.js +0 -31
  274. package/useFormValue.js +0 -7
  275. package/useLadders.js +0 -6
  276. package/useMeltingTemp.js +0 -7
  277. package/useTmType.js +0 -10
  278. package/userDefinedHandlersAndOpts.js +0 -61
  279. package/utils.js +0 -37
  280. package/versionHistory.js +0 -26
  281. package/versionHistoryTool.js +0 -21
  282. package/viewSubmenu.js +0 -479
  283. package/visibilityTool.js +0 -39
  284. package/withHover.js +0 -113
  285. package/withRestrictionEnzymes.js +0 -15
package/editorUtils.js DELETED
@@ -1,205 +0,0 @@
1
- import { getRangeLength, getSequenceWithinRange } from "@teselagen/range-utils";
2
- import React from "react";
3
- import { divideBy3 } from "./proteinUtils";
4
- import {
5
- getInsertBetweenVals,
6
- calculatePercentGC,
7
- aliasedEnzymesByName
8
- } from "@teselagen/sequence-utils";
9
- import { get, sortBy } from "lodash-es";
10
- import VeWarning from "../helperComponents/VeWarning";
11
- import { normalizePositionByRangeLength } from "@teselagen/range-utils";
12
- import { filter } from "lodash-es";
13
-
14
- export function getSelectionMessage({
15
- caretPosition = -1,
16
- selectionLayer = { start: -1, end: -1 },
17
- customTitle,
18
- sequenceLength,
19
- sequenceData,
20
- showGCContent, //these are only passed in for the status bar
21
- GCDecimalDigits, //these are only passed in for the status bar
22
- isProtein
23
- }) {
24
- let _selectionLayer = selectionLayer;
25
- const isSelecting = selectionLayer.start > -1;
26
- if (isSelecting) {
27
- _selectionLayer = getSelFromWrappedAddon(selectionLayer, sequenceLength);
28
- const length = getRangeLength(_selectionLayer, sequenceLength);
29
- const GCContent = (numDecimalDigits = 0) =>
30
- calculatePercentGC(
31
- getSequenceWithinRange(_selectionLayer, sequenceData.sequence)
32
- ).toFixed(numDecimalDigits);
33
- const seqLen = divideBy3(length, isProtein);
34
- return `${customTitle || "Selecting"} ${seqLen} ${
35
- (isProtein ? "AA" : "bp") + (seqLen === 1 ? "" : "s")
36
- } from ${divideBy3(_selectionLayer.start, isProtein) + 1} to ${divideBy3(
37
- _selectionLayer.end + 1,
38
- isProtein
39
- )}${
40
- showGCContent && !isProtein ? ` (${GCContent(GCDecimalDigits)}% GC)` : ""
41
- }`;
42
- } else if (caretPosition > -1) {
43
- const insertBetween = getInsertBetweenVals(
44
- caretPosition,
45
- _selectionLayer,
46
- sequenceLength
47
- );
48
- return (
49
- `Caret Between ` +
50
- (isProtein
51
- ? `AAs ${divideBy3(insertBetween[0], true)} and ${divideBy3(
52
- insertBetween[1] + 2,
53
- true
54
- )}`
55
- : `Bases ${insertBetween[0]} and ${insertBetween[1]}`)
56
- );
57
- } else {
58
- return "No Selection";
59
- }
60
- }
61
-
62
- export function preventDefaultStopPropagation(e) {
63
- if (e) {
64
- e.stopPropagation();
65
- e.preventDefault();
66
- }
67
- }
68
-
69
- export function getNodeToRefocus(caretEl) {
70
- let nodeToReFocus;
71
- if (
72
- caretEl &&
73
- caretEl.closest &&
74
- caretEl.closest(".veVectorInteractionWrapper")
75
- ) {
76
- nodeToReFocus = caretEl.closest(".veVectorInteractionWrapper");
77
- }
78
- return nodeToReFocus;
79
- }
80
-
81
- export function getEmptyText({ sequenceData, caretPosition }) {
82
- return sequenceData.sequence.length === 0 && caretPosition === -1 ? (
83
- <div className="veEmptySeqText">Insert Sequence Here</div>
84
- ) : null;
85
- }
86
-
87
- export function tryToRefocusEditor() {
88
- const ed = document.querySelector(".veVectorInteractionWrapper");
89
- ed && ed.focus();
90
- }
91
- export function getCustomEnzymes() {
92
- try {
93
- const customEnzymes = JSON.parse(
94
- window.localStorage.getItem("customEnzymes") || "{}"
95
- );
96
- return customEnzymes;
97
- } catch (error) {
98
- return {};
99
- }
100
- }
101
- export function addCustomEnzyme(newEnz) {
102
- const customEnzymes = getCustomEnzymes();
103
- window.localStorage.setItem(
104
- "customEnzymes",
105
- JSON.stringify({
106
- ...customEnzymes,
107
- [newEnz.name.toLowerCase()]: newEnz
108
- })
109
- );
110
- }
111
-
112
- export function pareDownAnnotations(annotations, max) {
113
- let annotationsToPass = annotations;
114
- let paredDown = false;
115
- if (Object.keys(annotations).length > max) {
116
- paredDown = true;
117
- const sortedAnnotations = sortBy(annotations, function (annotation) {
118
- return -getRangeLength(annotation);
119
- });
120
- annotationsToPass = sortedAnnotations.slice(0, max).reduce(function (
121
- obj,
122
- item
123
- ) {
124
- obj[item.id] = item;
125
- return obj;
126
- }, {});
127
- }
128
- return [annotationsToPass, paredDown];
129
- }
130
- export function getParedDownWarning({ nameUpper, maxToShow, isAdjustable }) {
131
- return (
132
- <VeWarning
133
- key={`ve-warning-max${nameUpper}ToDisplay`}
134
- data-test={`ve-warning-max${nameUpper}ToDisplay`}
135
- tooltip={`Warning: More than ${maxToShow} ${
136
- nameUpper === "Cutsites" ? "Cut Sites" : nameUpper
137
- }. Only displaying ${maxToShow} ${
138
- isAdjustable ? "(Configure this under View > Limits)" : ""
139
- } `}
140
- />
141
- );
142
- }
143
-
144
- export function getClientX(event) {
145
- return event.clientX || get(event, "touches[0].clientX");
146
- }
147
- export function getClientY(event) {
148
- return event.clientY || get(event, "touches[0].clientY");
149
- }
150
-
151
- export function hideAnnByLengthFilter(hideOpts, ann, seqLen) {
152
- const featLength = getRangeLength(ann, seqLen);
153
- return (
154
- hideOpts.enabled && (featLength < hideOpts.min || featLength > hideOpts.max)
155
- );
156
- }
157
-
158
- export function getSelFromWrappedAddon(selectionLayer, sequenceLength) {
159
- const selToUse = {
160
- ...selectionLayer
161
- };
162
- if (selectionLayer.isWrappedAddon) {
163
- const oldEnd = selToUse.end;
164
- selToUse.end = normalizePositionByRangeLength(
165
- selToUse.start - 1,
166
- sequenceLength
167
- );
168
- selToUse.start = normalizePositionByRangeLength(oldEnd + 1, sequenceLength);
169
- delete selToUse.isWrappedAddon;
170
- }
171
- return selToUse;
172
- }
173
-
174
- export function getStripedPattern({ color, id }) {
175
- return (
176
- <pattern
177
- id={`diagonalHatch-${id}`}
178
- patternUnits="userSpaceOnUse"
179
- width="4"
180
- height="4"
181
- >
182
- <path
183
- d="M-1,1 l2,-2
184
- M0,4 l4,-4
185
- M3,5 l2,-2"
186
- style={{
187
- stroke: color,
188
- strokeWidth: 2,
189
- fill: "blue",
190
- opacity: 0.4
191
- }}
192
- />
193
- </pattern>
194
- );
195
- }
196
- export const getEnzymeAliases = enzyme => {
197
- let lowerName = (enzyme.name && enzyme.name.toLowerCase()) || "";
198
- if (typeof enzyme === "string") {
199
- lowerName = enzyme.toLowerCase();
200
- }
201
- return filter(
202
- (aliasedEnzymesByName[lowerName] || {}).aliases,
203
- n => n.toLowerCase() !== lowerName //filter out current enzyme
204
- );
205
- };
@@ -1,184 +0,0 @@
1
- import { forEach } from "lodash-es";
2
-
3
- const debug = 0;
4
- // const debug = console.log("comment me back out!") || 1;
5
-
6
- export const rowHeights = {
7
- rowJumpButtons: { height: 30 },
8
- spacer: { height: 10 },
9
- aminoAcidNumbers: { height: 9 },
10
- translations: { spaceBetweenAnnotations: 2, marginTop: 5, height: 17 },
11
- chromatogram: { height: 134 },
12
- parts: { spaceBetweenAnnotations: 2, marginTop: 5, height: 15 },
13
- primers: { spaceBetweenAnnotations: 2, marginTop: 5, height: 18 },
14
- features: { spaceBetweenAnnotations: 2, marginTop: 5, height: 15 },
15
- warnings: { spaceBetweenAnnotations: 2, marginTop: 5, height: 15 },
16
- assemblyPieces: { spaceBetweenAnnotations: 2, marginTop: 5, height: 15 },
17
- lineageAnnotations: { spaceBetweenAnnotations: 2, marginTop: 5, height: 15 },
18
- orfs: { spaceBetweenAnnotations: 2, marginTop: 5, height: 15 },
19
- //tnrtodo -- we should estimate external label height for parts/features/primers
20
- cutsiteLabels: { spaceBetweenAnnotations: 0, height: 15 },
21
- sequence: { height: 15 },
22
- reverseSequence: { height: 15 },
23
- axis: { marginTop: 5, height: 15 }
24
- };
25
-
26
- rowHeights.primaryProteinSequence = rowHeights.translations;
27
-
28
- Object.keys(rowHeights).forEach(k => {
29
- rowHeights[k].type = k;
30
- rowHeights[k].marginTop = rowHeights[k].marginTop || 0;
31
- rowHeights[k].marginBottom = rowHeights[k].marginBottom || 0;
32
- rowHeights[k].spaceBetweenAnnotations =
33
- rowHeights[k].spaceBetweenAnnotations || 0;
34
- });
35
- const translations = {
36
- getHeight: props => {
37
- if (props.annotationVisibility.aminoAcidNumbers) {
38
- return [rowHeights.aminoAcidNumbers.type, rowHeights.translations.type];
39
- }
40
- return rowHeights.translations.type;
41
- },
42
- hasYOffset: true
43
- };
44
-
45
- const annotationsToCompute = {
46
- spacer: {
47
- alwaysVisible: true,
48
- height: rowHeights.spacer.type
49
- },
50
- primaryProteinSequence: translations,
51
- translations,
52
- parts: {
53
- height: rowHeights.parts.type,
54
- hasYOffset: true
55
- },
56
- primers: {
57
- height: rowHeights.primers.type,
58
- hasYOffset: true
59
- },
60
- features: {
61
- height: rowHeights.features.type,
62
- hasYOffset: true
63
- },
64
- chromatogram: {
65
- height: rowHeights.chromatogram.type
66
- },
67
- warnings: {
68
- height: rowHeights.warnings.type,
69
- hasYOffset: true
70
- },
71
- orfs: {
72
- height: rowHeights.orfs.type,
73
- hasYOffset: true
74
- },
75
- sequence: {
76
- height: rowHeights.sequence.type
77
- },
78
- reverseSequence: {
79
- height: rowHeights.reverseSequence.type
80
- },
81
- axis: {
82
- height: rowHeights.axis.type
83
- },
84
- cutsiteLabels: {
85
- typeOverride: "cutsites",
86
- height: rowHeights.cutsiteLabels.type,
87
- hasYOffset: true
88
- }
89
- };
90
-
91
- export default props => {
92
- let {
93
- index,
94
- cache,
95
- clearCache,
96
- chromatogramData,
97
- rowCount,
98
- row,
99
- showJumpButtons,
100
- annotationVisibility
101
- } = props;
102
- if (clearCache) {
103
- cache = {};
104
- }
105
-
106
- if (cache[index]) {
107
- return cache[index];
108
- }
109
- if (!row) return 0;
110
- let totalHeight = 0; //account for spacer
111
- if (showJumpButtons && (index === 0 || index === rowCount - 1)) {
112
- totalHeight += rowHeights.rowJumpButtons.height;
113
- }
114
- forEach(
115
- annotationsToCompute,
116
- (
117
- { height: _height, alwaysVisible, getHeight, hasYOffset, typeOverride },
118
- key
119
- ) => {
120
- const shouldShow =
121
- alwaysVisible || annotationVisibility[typeOverride || key];
122
- if (!shouldShow) return;
123
- if (key === "chromatogram" && !chromatogramData) return;
124
- const heightKeys = getHeight ? getHeight(props) : _height;
125
- const [annotationHeight, marginHeight] = getSummedHeights(
126
- heightKeys,
127
- props
128
- );
129
-
130
- let heightToAdd = annotationHeight;
131
- if (hasYOffset) {
132
- const annotations = row[typeOverride || key];
133
- if (hasYOffset) {
134
- let maxYOffset = 0;
135
- annotations &&
136
- annotations.forEach(a => {
137
- if (a.yOffset + 1 > maxYOffset) maxYOffset = a.yOffset + 1;
138
- });
139
- heightToAdd = maxYOffset * annotationHeight;
140
- }
141
- }
142
- if (heightToAdd > 0) heightToAdd += marginHeight;
143
-
144
- if (debug) {
145
- heightToAdd !== 0 &&
146
- console.info(`heightToAdd, key:`, heightToAdd, key);
147
- }
148
- totalHeight += heightToAdd;
149
- }
150
- );
151
- if (debug) {
152
- console.info(`totalHeight:`, totalHeight);
153
- }
154
- if (annotationVisibility.compactNames) {
155
- totalHeight = Math.max(totalHeight, 31);
156
- }
157
- cache[index] = totalHeight;
158
- return totalHeight;
159
- };
160
-
161
- function getHeights(heightKey, props) {
162
- const annotationHeight = !heightKey
163
- ? 0
164
- : props[heightKey + "Height"] || (rowHeights[heightKey] || {}).height || 0;
165
-
166
- const marginHeight =
167
- (props[heightKey + "MarginTop"] ||
168
- (rowHeights[heightKey] || {}).marginTop ||
169
- 0) +
170
- (props[heightKey + "MarginBottom"] ||
171
- (rowHeights[heightKey] || {}).marginBottom ||
172
- 0);
173
- return [annotationHeight, marginHeight];
174
- }
175
- function getSummedHeights(heightKeys, props) {
176
- let height = 0;
177
- let marginHeight = 0;
178
- (Array.isArray(heightKeys) ? heightKeys : [heightKeys]).forEach(k => {
179
- const [h, m] = getHeights(k, props);
180
- height += h;
181
- marginHeight += m;
182
- });
183
- return [height, marginHeight];
184
- }
@@ -1,27 +0,0 @@
1
- import createMergedDefaultStateReducer from "./utils/createMergedDefaultStateReducer";
2
- import createAction from "./utils/createMetaAction";
3
-
4
- // ------------------------------------
5
- // Actions
6
- // ------------------------------------
7
- export const updateFeatureLengthsToHide = createAction(
8
- "updateFeatureLengthsToHide"
9
- );
10
- export const toggleFeatureLengthsToHide = createAction(
11
- "toggleFeatureLengthsToHide"
12
- );
13
-
14
- // ------------------------------------
15
- // Reducer
16
- // ------------------------------------
17
- export default createMergedDefaultStateReducer(
18
- {
19
- [updateFeatureLengthsToHide]: (state, payload) => {
20
- return { ...state, ...payload };
21
- },
22
- [toggleFeatureLengthsToHide]: state => {
23
- return { ...state, enabled: !state["enabled"] };
24
- }
25
- },
26
- { enabled: false, min: 0, max: 800 }
27
- );
package/featureTool.js DELETED
@@ -1,34 +0,0 @@
1
- import { Icon } from "@blueprintjs/core";
2
- // import { Checkbox, Button } from "@blueprintjs/core";
3
- import React from "react";
4
- // import { connect } from "react-redux";
5
- // import { convertRangeTo1Based } from "@teselagen/range-utils";
6
- import { featureIcon } from "@teselagen/ui";
7
- import ToolbarItem from "./ToolbarItem";
8
- import { connectToEditor } from "../withEditorProps";
9
-
10
- export default connectToEditor(
11
- ({ annotationVisibility = {}, toolBar = {} }) => {
12
- return {
13
- toggled: annotationVisibility.features,
14
- isOpen: toolBar.openItem === "featureTool"
15
- };
16
- }
17
- )(({ toolbarItemProps, toggled, annotationVisibilityToggle, isOpen }) => {
18
- return (
19
- <ToolbarItem
20
- {...{
21
- Icon: <Icon icon={featureIcon} />,
22
- onIconClick: function () {
23
- annotationVisibilityToggle("features");
24
- },
25
- toggled,
26
- tooltip: "Show features",
27
- tooltipToggled: "Hide features",
28
- // Dropdown: ConnectedFeatureToolDropdown,
29
- dropdowntooltip: (!isOpen ? "Show" : "Hide") + " Feature Options",
30
- ...toolbarItemProps
31
- }}
32
- />
33
- );
34
- });
package/features.js DELETED
@@ -1,19 +0,0 @@
1
- import { createReducer } from "redux-act";
2
- import createAction from "../utils/createMetaAction";
3
- import upsertDeleteActionGenerator from "./upsertDeleteActionGenerator";
4
-
5
- // ------------------------------------
6
- // Actions
7
- // ------------------------------------
8
- export const upsertFeature = createAction("UPSERT_FEATURE");
9
- export const deleteFeature = createAction("DELETE_FEATURE");
10
-
11
- // ------------------------------------
12
- // Reducer
13
- // ------------------------------------
14
- export default createReducer(
15
- {
16
- ...upsertDeleteActionGenerator(upsertFeature, deleteFeature)
17
- },
18
- {}
19
- );
@@ -1,8 +0,0 @@
1
- import { createSelector } from "reselect";
2
- import sequenceDataSelector from "./sequenceDataSelector";
3
-
4
- function featuresRawSelector(sequenceData) {
5
- return sequenceData.features;
6
- }
7
-
8
- export default createSelector(sequenceDataSelector, featuresRawSelector);
@@ -1,136 +0,0 @@
1
- import flatmap from "lodash/flatMap";
2
- import { createSelector } from "reselect";
3
- import cutsitesSelector from "./cutsitesSelector";
4
- import filteredRestrictionEnzymesSelector from "./filteredRestrictionEnzymesSelector";
5
- import specialCutsiteFilterOptions from "../constants/specialCutsiteFilterOptions";
6
- import { flatMap } from "lodash-es";
7
- import isEnzymeFilterAndSelector from "./isEnzymeFilterAndSelector";
8
-
9
- export default createSelector(
10
- cutsitesSelector,
11
- filteredRestrictionEnzymesSelector,
12
- isEnzymeFilterAndSelector,
13
- (state, addEnzs, enzymeGroupsOverride) => enzymeGroupsOverride,
14
- function (
15
- { cutsitesByName },
16
- filteredRestrictionEnzymes,
17
- isEnzymeFilterAnd,
18
- enzymeGroupsOverride
19
- ) {
20
- const returnVal = {
21
- cutsitesByName: {}
22
- };
23
- // const cutsitesByName = getLowerCaseObj(cutsitesByName);
24
- const hiddenEnzymesByName = {};
25
- let filteredEnzymes = [];
26
- let enzymesFromGroups = [];
27
- let hasUserGroup;
28
- let groupCount = 0;
29
- //handle adding enzymes that are included in user created groups
30
- filteredRestrictionEnzymes.forEach(e => {
31
- if (e.value.includes("__userCreatedGroup")) {
32
- hasUserGroup = true;
33
- const existingGroups = {
34
- ...window.getExistingEnzymeGroups(),
35
- ...enzymeGroupsOverride
36
- };
37
- const enzymes =
38
- existingGroups[e.value.replace("__userCreatedGroup", "")] || [];
39
- const zs = flatMap(enzymes, e => (e ? { value: e } : []));
40
- filteredEnzymes = filteredEnzymes.concat(zs);
41
- enzymesFromGroups = enzymesFromGroups.concat(zs);
42
- groupCount += 1;
43
- } else if (e.isHidden) {
44
- hiddenEnzymesByName[e.value] = e;
45
- } else {
46
- if (!e) return;
47
- groupCount += 1;
48
- filteredEnzymes.push(e);
49
- }
50
- });
51
- const cutSiteList = [];
52
- if (!filteredEnzymes || (filteredEnzymes.length === 0 && !hasUserGroup)) {
53
- returnVal.cutsitesByName = cutsitesByName;
54
- } else {
55
- //loop through each filter option ('Single Cutters', 'BamHI')
56
- filteredEnzymes.forEach(function ({ value, ...rest }) {
57
- if (!value) {
58
- console.error(`Missing value for filtered enzyme`, rest);
59
- return;
60
- }
61
- const lowerValue = value.toLowerCase();
62
- const cutsThisManyTimes =
63
- specialCutsiteFilterOptions[value] &&
64
- specialCutsiteFilterOptions[value].cutsThisManyTimes;
65
- if (value === "type2s") {
66
- Object.keys(cutsitesByName).forEach(function (key) {
67
- if (hiddenEnzymesByName[key]) return; //don't show that cutsite
68
- if (
69
- cutsitesByName[key].length &&
70
- cutsitesByName[key][0]?.restrictionEnzyme?.isType2S
71
- ) {
72
- cutSiteList.push(key);
73
- returnVal.cutsitesByName[key] = cutsitesByName[key];
74
- }
75
- });
76
- } else if (cutsThisManyTimes > 0) {
77
- //the cutter type is either 1,2,3 for single, double or triple cutters
78
- Object.keys(cutsitesByName).forEach(function (key) {
79
- if (hiddenEnzymesByName[key]) return; //don't show that cutsite
80
- if (cutsitesByName[key].length === cutsThisManyTimes) {
81
- cutSiteList.push(key);
82
- returnVal.cutsitesByName[key] = cutsitesByName[key];
83
- }
84
- });
85
- } else {
86
- if (hiddenEnzymesByName[lowerValue]) return; //don't show that cutsite
87
- //normal enzyme ('BamHI')
88
- if (!cutsitesByName[lowerValue]) return;
89
- cutSiteList.push(lowerValue);
90
- returnVal.cutsitesByName[lowerValue] = cutsitesByName[lowerValue];
91
- }
92
- });
93
- }
94
-
95
- const enzymeCounts = {};
96
- cutSiteList.forEach(
97
- enzyme =>
98
- (enzymeCounts[enzyme] = enzymeCounts[enzyme]
99
- ? enzymeCounts[enzyme] + 1
100
- : 1)
101
- );
102
-
103
- const intersectionCutSites = [];
104
- Object.keys(enzymeCounts).forEach(key => {
105
- if (enzymeCounts[key] === groupCount) intersectionCutSites.push(key);
106
- });
107
-
108
- returnVal.cutsiteIntersectionCount = intersectionCutSites.length;
109
-
110
- const cutsbyname_AND = {};
111
- intersectionCutSites.forEach(value => {
112
- cutsbyname_AND[value] = cutsitesByName[value];
113
- });
114
-
115
- returnVal.cutsiteTotalCount = Object.keys(returnVal.cutsitesByName).length;
116
-
117
- if (isEnzymeFilterAnd && returnVal.cutsiteIntersectionCount > 0) {
118
- returnVal.cutsitesByName = cutsbyname_AND;
119
- }
120
-
121
- returnVal.cutsitesArray = flatmap(
122
- returnVal.cutsitesByName,
123
- cutsitesByNameArray => cutsitesByNameArray
124
- );
125
- returnVal.cutsitesById = returnVal.cutsitesArray.reduce(function (
126
- obj,
127
- item
128
- ) {
129
- if (item && item.id) {
130
- obj[item.id] = item;
131
- }
132
- return obj;
133
- }, {});
134
- return returnVal;
135
- }
136
- );
@@ -1,32 +0,0 @@
1
- import { createSelector } from "reselect";
2
- import { omitBy } from "lodash-es";
3
- import featuresSelector from "./featuresSelector";
4
- import sequenceLengthSelector from "./sequenceLengthSelector";
5
- import { hideAnnByLengthFilter } from "../utils/editorUtils";
6
-
7
- function filteredFeaturesSelector(
8
- features,
9
- seqLen,
10
- featureIndividualToHide,
11
- featureTypesToHide,
12
- lengthsToHide
13
- ) {
14
- return omitBy(features, ann => {
15
- const hideIndividually = featureIndividualToHide[ann.id];
16
- const hideFeaturesByType = featureTypesToHide[ann.type];
17
- return (
18
- hideAnnByLengthFilter(lengthsToHide, ann, seqLen) ||
19
- hideFeaturesByType ||
20
- hideIndividually
21
- );
22
- });
23
- }
24
-
25
- export default createSelector(
26
- featuresSelector,
27
- sequenceLengthSelector,
28
- state => state.annotationVisibility.featureIndividualToHide,
29
- state => state.annotationVisibility.featureTypesToHide,
30
- state => state.featureLengthsToHide,
31
- filteredFeaturesSelector
32
- );