@teselagen/ove 0.7.28 → 0.7.30-beta.1

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 (301) hide show
  1. package/CreateAnnotationsPage.d.ts +4 -3
  2. package/README.md +1 -1
  3. package/fileUtils.d.ts +12 -0
  4. package/html2canvas.esm--JN4fLQL.js +7891 -0
  5. package/html2canvas.esm-B7d7VJmQ.cjs +7891 -0
  6. package/index.cjs.js +1305 -1121
  7. package/index.es.js +1305 -1121
  8. package/index.umd.js +189161 -0
  9. package/ove.css +17 -4
  10. package/package.json +5 -9
  11. package/redux/findTool.d.ts +1 -0
  12. package/selectors/searchLayersSelector.d.ts +1 -1
  13. package/src/AutoAnnotate.js +1 -1
  14. package/src/CreateAnnotationsPage.js +1 -2
  15. package/src/Editor/style.css +8 -3
  16. package/src/FindBar/index.js +32 -1
  17. package/src/RowItem/SelectionLayer/index.js +42 -4
  18. package/src/RowItem/SelectionLayer/style.css +8 -0
  19. package/src/fileUtils.js +103 -0
  20. package/src/helperComponents/PropertiesDialog/TranslationProperties.js +1 -1
  21. package/src/redux/findTool.js +9 -0
  22. package/src/selectors/searchLayersSelector.js +40 -2
  23. package/style.css +12098 -1
  24. package/AASliver.js +0 -187
  25. package/AddLaddersDialog.js +0 -82
  26. package/AdditionalCutsiteInfoDialog.js +0 -599
  27. package/AlignmentVisibilityTool.js +0 -105
  28. package/AnnotationContainerHolder.js +0 -20
  29. package/AnnotationPositioner.js +0 -27
  30. package/AutoAnnotate.js +0 -501
  31. package/AutoAnnotateBpMatchingDialog.js +0 -208
  32. package/Axis.js +0 -151
  33. package/AxisNumbers.js +0 -35
  34. package/Browser.js +0 -106
  35. package/Caret.js +0 -63
  36. package/Chromatogram.js +0 -293
  37. package/CircularDnaSequence.js +0 -73
  38. package/CircularZoomMinimap.js +0 -16
  39. package/ColorPicker.js +0 -30
  40. package/CommandHotkeyHandler.js +0 -44
  41. package/CreateAnnotationsPage.js +0 -98
  42. package/Cutsite.js +0 -18
  43. package/CutsiteProperties.js +0 -176
  44. package/CutsiteSelectionLayers.js +0 -47
  45. package/Cutsites.js +0 -271
  46. package/DeletionLayer.js +0 -28
  47. package/DropHandler.css +0 -21
  48. package/DropHandler.js +0 -64
  49. package/EditCaretPosition.js +0 -234
  50. package/EditTrackNameDialog.js +0 -30
  51. package/Feature.js +0 -83
  52. package/FeatureProperties.js +0 -6
  53. package/FillWindow.js +0 -47
  54. package/GenbankView.js +0 -74
  55. package/GeneralProperties.js +0 -117
  56. package/GenericAnnotationProperties.js +0 -406
  57. package/GlobalDialog.js +0 -73
  58. package/GlobalDialogUtils.js +0 -110
  59. package/GoToDialog.js +0 -25
  60. package/HorizontalPanelDragHandle.js +0 -35
  61. package/Keyboard.js +0 -85
  62. package/Labels.js +0 -327
  63. package/Ladder.css +0 -20
  64. package/Ladder.js +0 -303
  65. package/MeltingTemp.js +0 -85
  66. package/Menlo.ttf +0 -0
  67. package/Minimap.js +0 -515
  68. package/Mismatches.js +0 -134
  69. package/Monaco.ttf +0 -0
  70. package/MultipleSeqsDetectedOnImportDialog.js +0 -74
  71. package/Orf.js +0 -109
  72. package/OrfProperties.js +0 -117
  73. package/Orfs.js +0 -35
  74. package/PCRTool.js +0 -179
  75. package/PairwiseAlignmentView.js +0 -68
  76. package/Part.js +0 -34
  77. package/PartProperties.js +0 -9
  78. package/PassThrough.js +0 -3
  79. package/PerformantSelectionLayer.js +0 -32
  80. package/PinchHelper.js +0 -24
  81. package/PointedAnnotation.js +0 -347
  82. package/PositionAnnotationOnCircle.js +0 -26
  83. package/Primer.js +0 -41
  84. package/PrimerProperties.js +0 -19
  85. package/ReflexContainer.js +0 -802
  86. package/ReflexElement.js +0 -160
  87. package/ReflexEvents.js +0 -77
  88. package/ReflexSplitter.js +0 -205
  89. package/RenameSequenceDialog.js +0 -7
  90. package/RotateCircularViewSlider.js +0 -93
  91. package/SelectDialog.js +0 -150
  92. package/SequenceName.js +0 -15
  93. package/SimpleCircularOrLinearView.js +0 -381
  94. package/SimpleOligoPreview.js +0 -39
  95. package/SingleEnzymeCutsiteInfo.js +0 -139
  96. package/ToolbarItem.js +0 -192
  97. package/Translation.js +0 -198
  98. package/TranslationProperties.js +0 -149
  99. package/UncontrolledSliderWithPlusMinusBtns.css +0 -5
  100. package/UncontrolledSliderWithPlusMinusBtns.js +0 -134
  101. package/VeTopRightContainer.js +0 -12
  102. package/ZoomCircularViewSlider.js +0 -62
  103. package/ZoomLinearView.js +0 -47
  104. package/addAlignment.js +0 -6
  105. package/addMetaToActionCreators.js +0 -12
  106. package/addWrappedAddons.js +0 -20
  107. package/alignmentTool.js +0 -503
  108. package/alignments.js +0 -379
  109. package/annotationLabelVisibility.js +0 -2
  110. package/annotationSearchSelector.js +0 -24
  111. package/annotationTypes.js +0 -35
  112. package/annotationVisibility.js +0 -196
  113. package/annotationsToSupport.js +0 -104
  114. package/arrayToObjWithIds.js +0 -17
  115. package/arrayUtils.js +0 -19
  116. package/array_move.js +0 -10
  117. package/calculateTickMarkPositionsForGivenRange.js +0 -47
  118. package/caretPosition.js +0 -27
  119. package/cdsFeaturesSelector.js +0 -9
  120. package/charWidth.js +0 -22
  121. package/circular.js +0 -19
  122. package/circularSelector.js +0 -4
  123. package/clickAndDragUtils.js +0 -576
  124. package/coerceInitialValue.js +0 -7
  125. package/combineReducersDontIgnoreKeys.js +0 -12
  126. package/commandUtils.js +0 -20
  127. package/constants.js +0 -2
  128. package/copyOptions.js +0 -34
  129. package/createFragmentLines.js +0 -120
  130. package/createMergedDefaultStateReducer.js +0 -30
  131. package/createMetaAction.js +0 -12
  132. package/createSequenceInputPopup.js +0 -290
  133. package/createSequenceInputPopupStyle.css +0 -87
  134. package/createSimpleDialog.js +0 -89
  135. package/createYourOwnEnzyme.js +0 -39
  136. package/cutsiteLabelColorSelector.js +0 -6
  137. package/cutsiteTool.js +0 -88
  138. package/cutsitesByRangeSelector.js +0 -5
  139. package/cutsitesSelector.js +0 -61
  140. package/darkmode.css +0 -98
  141. package/defaultConfig.js +0 -150
  142. package/deletionLayers.js +0 -36
  143. package/description.js +0 -21
  144. package/digestTool.js +0 -34
  145. package/dnaToColor.js +0 -17
  146. package/downloadTool.js +0 -39
  147. package/draggableClassnames.js +0 -5
  148. package/drawAnnotations.js +0 -440
  149. package/drawDirectedPiePiece.js +0 -142
  150. package/editTool.js +0 -49
  151. package/editorSelector.js +0 -2
  152. package/editorUtils.js +0 -205
  153. package/estimateRowHeight.js +0 -184
  154. package/featureLengthsToHide.js +0 -27
  155. package/featureTool.js +0 -34
  156. package/features.js +0 -19
  157. package/featuresSelector.js +0 -8
  158. package/filteredCutsitesSelector.js +0 -136
  159. package/filteredFeaturesSelector.js +0 -32
  160. package/filteredPartsSelector.js +0 -57
  161. package/filteredPrimersSelector.js +0 -27
  162. package/filteredRestrictionEnzymesSelector.js +0 -1
  163. package/find.png +0 -0
  164. package/findTool.js +0 -79
  165. package/findToolConstants.js +0 -1
  166. package/frameTranslations.js +0 -52
  167. package/fullscreen.png +0 -0
  168. package/getAdditionalEnzymesSelector.js +0 -46
  169. package/getAngleForPositionMidpoint.js +0 -3
  170. package/getAnnotationClassnames.js +0 -12
  171. package/getAnnotationNameAndStartStopString.js +0 -61
  172. package/getBpsPerRow.js +0 -19
  173. package/getCutsiteLabelHeights.js +0 -56
  174. package/getGapMap.js +0 -12
  175. package/getGaps.js +0 -27
  176. package/getInternalLabel.js +0 -40
  177. package/getOveHotkeyDefs.js +0 -12
  178. package/getPairwiseOverviewLinearViewOptions.js +0 -38
  179. package/getRangeAnglesSpecial.js +0 -12
  180. package/getStructuredBases.js +0 -97
  181. package/getTrackFromEvent.js +0 -25
  182. package/getVisibleStartEnd.js +0 -7
  183. package/getXStartAndWidthFromNonCircularRange.js +0 -12
  184. package/getXStartAndWidthOfRangeWrtRow.js +0 -27
  185. package/getXStartAndWidthOfRowAnnotation.js +0 -19
  186. package/getYOffset.js +0 -15
  187. package/hoveredAnnotation.js +0 -24
  188. package/importTool.js +0 -27
  189. package/index.js +0 -71
  190. package/inlineFindTool.js +0 -38
  191. package/isElementInViewport.js +0 -29
  192. package/isEnzymeFilterAndSelector.js +0 -1
  193. package/isTargetWithinEl.js +0 -6
  194. package/labelLineIntensity.js +0 -25
  195. package/labelSize.js +0 -23
  196. package/ladderDefaults.js +0 -25
  197. package/lastSavedId.js +0 -20
  198. package/lineageLines.js +0 -11
  199. package/linear.png +0 -0
  200. package/makeStore.js +0 -34
  201. package/massageTickSpacing.js +0 -19
  202. package/materiallyAvailable.js +0 -19
  203. package/middleware.js +0 -112
  204. package/minimumOrfSize.js +0 -24
  205. package/minimumOrfSizeSelector.js +0 -2
  206. package/modalActions.js +0 -3
  207. package/moveCaret.js +0 -58
  208. package/name.js +0 -19
  209. package/normalizeAngle.js +0 -3
  210. package/normalizeAngleRange.js +0 -9
  211. package/oligoTool.js +0 -30
  212. package/onlyUpdateForKeysDeep.js +0 -31
  213. package/orfFrameToColorMap.js +0 -10
  214. package/orfTool.js +0 -136
  215. package/orfsSelector.js +0 -15
  216. package/panelsShown.js +0 -294
  217. package/partLengthsToHide.js +0 -23
  218. package/partOverhangs.js +0 -6
  219. package/partTagSearch.js +0 -69
  220. package/partTool.js +0 -45
  221. package/parts.js +0 -19
  222. package/partsSelector.js +0 -8
  223. package/pie.png +0 -0
  224. package/polarToSpecialCartesian.js +0 -7
  225. package/positionCutsites.js +0 -6
  226. package/prepareRowData.js +0 -64
  227. package/primerBases.js +0 -221
  228. package/primerLengthsToHide.js +0 -27
  229. package/primers.js +0 -19
  230. package/primersSelector.js +0 -8
  231. package/print.png +0 -0
  232. package/printTool.js +0 -31
  233. package/propertiesTool.js +0 -40
  234. package/proteinUtils.js +0 -3
  235. package/pureNoFunc.js +0 -18
  236. package/readOnly.js +0 -25
  237. package/redoTool.js +0 -30
  238. package/reflex-styles.css +0 -128
  239. package/reflex-styles.css.map +0 -9
  240. package/relaxLabelAngles.js +0 -157
  241. package/relaxLabels_DEPRECATED.js +0 -105
  242. package/replacementLayers.js +0 -36
  243. package/restrictionEnzymes.js +0 -52
  244. package/restrictionEnzymesSelector.js +0 -34
  245. package/rowviewContants.js +0 -3
  246. package/ruler.css +0 -89
  247. package/save.png +0 -0
  248. package/saveTool.js +0 -44
  249. package/searchLayersSelector.js +0 -71
  250. package/selectedAnnotations.js +0 -89
  251. package/selectedAnnotationsSelector.js +0 -1
  252. package/selectedCutsitesSelector.js +0 -21
  253. package/selectedPartTags.js +0 -21
  254. package/selectionLayer.js +0 -25
  255. package/sequence.js +0 -12
  256. package/sequenceDataHistory.js +0 -43
  257. package/sequenceDataSelector.js +0 -2
  258. package/sequenceLengthSelector.js +0 -5
  259. package/sequenceSelector.js +0 -4
  260. package/sharedActionCreators.js +0 -0
  261. package/shouldFlipText.js +0 -4
  262. package/shouldRerender.js +0 -27
  263. package/showFileDialog.js +0 -25
  264. package/showGCContent.js +0 -23
  265. package/show_cut_sites.png +0 -0
  266. package/show_features.png +0 -0
  267. package/show_orfs.png +0 -0
  268. package/show_primers.png +0 -0
  269. package/simpleDialog.css +0 -13
  270. package/specialCutsiteFilterOptions.js +0 -22
  271. package/tagsToBoldSelector.js +0 -2
  272. package/toggle_views.svg +0 -1
  273. package/toolBar.js +0 -23
  274. package/translationSearchMatchesSelector.js +0 -14
  275. package/translations.js +0 -20
  276. package/translationsRawSelector.js +0 -8
  277. package/translationsSelector.js +0 -137
  278. package/typeField.js +0 -24
  279. package/undoTool.js +0 -30
  280. package/updateEditor.js +0 -200
  281. package/updateLabelsForInViewFeatures.js +0 -55
  282. package/updateLabelsForInViewFeaturesCircView.js +0 -41
  283. package/updateTrackHelper.js +0 -58
  284. package/uppercaseSequenceMapFont.js +0 -25
  285. package/upsertDeleteActionGenerator.js +0 -31
  286. package/useAAColorType.js +0 -8
  287. package/useAdditionalOrfStartCodons.js +0 -24
  288. package/useAnnotationLimits.js +0 -42
  289. package/useChromatogramPrefs.js +0 -31
  290. package/useFormValue.js +0 -7
  291. package/useLadders.js +0 -6
  292. package/useMeltingTemp.js +0 -7
  293. package/useTmType.js +0 -10
  294. package/userDefinedHandlersAndOpts.js +0 -61
  295. package/utils.js +0 -37
  296. package/versionHistory.js +0 -26
  297. package/versionHistoryTool.js +0 -21
  298. package/viewSubmenu.js +0 -479
  299. package/visibilityTool.js +0 -39
  300. package/withHover.js +0 -113
  301. package/withRestrictionEnzymes.js +0 -15
@@ -1,599 +0,0 @@
1
- import { compose } from "recompose";
2
- import { wrapDialog, DropdownButton } from "@teselagen/ui";
3
- import React from "react";
4
- import { Classes, Icon, Menu, MenuItem, Tag } from "@blueprintjs/core";
5
- import withEditorProps from "../withEditorProps";
6
- import specialCutsiteFilterOptions from "../constants/specialCutsiteFilterOptions";
7
- import {
8
- differenceBy,
9
- find,
10
- flatMap,
11
- forEach,
12
- intersectionBy,
13
- map,
14
- noop,
15
- sortBy
16
- } from "lodash-es";
17
- import SingleEnzymeCutsiteInfo from "../helperComponents/PropertiesDialog/SingleEnzymeCutsiteInfo";
18
- import { showDialog } from "../GlobalDialogUtils";
19
-
20
- import {
21
- aliasedEnzymesByName,
22
- cutSequenceByRestrictionEnzyme,
23
- defaultEnzymesByName
24
- } from "@teselagen/sequence-utils";
25
- import { withRestrictionEnzymes } from "./withRestrictionEnzymes";
26
- import { getEnzymeAliases } from "../utils/editorUtils";
27
-
28
- function getUserEnzymeGroups(p) {
29
- return p.enzymeGroupsOverride || window.getExistingEnzymeGroups();
30
- }
31
-
32
- function isGroup({ cutsiteOrGroupKey }) {
33
- const isUserCreatedGroup = cutsiteOrGroupKey.startsWith("__userCreatedGroup");
34
- const specialCutsiteFilterOption =
35
- specialCutsiteFilterOptions[cutsiteOrGroupKey];
36
- return isUserCreatedGroup || specialCutsiteFilterOption;
37
- }
38
-
39
- export const AdditionalCutsiteInfoDialog = compose(
40
- withEditorProps,
41
- withRestrictionEnzymes,
42
- wrapDialog({
43
- isDraggable: true,
44
- getDialogProps: props => {
45
- if (isGroup(props)) {
46
- return {
47
- title: (
48
- <div style={{ display: "flex" }}>
49
- Group - &nbsp;
50
- {getGroupElAndCutsites(props).title}
51
- </div>
52
- )
53
- };
54
- } else {
55
- let c = props.allCutsites.cutsitesByName;
56
- const name = props.cutsiteOrGroupKey.toLowerCase();
57
- if (!c[name]) {
58
- const e = aliasedEnzymesByName[name];
59
- if (e) {
60
- const res = cutSequenceByRestrictionEnzyme(
61
- props.sequenceData.sequence,
62
- true,
63
- e
64
- );
65
- c = { ...c, [name]: res };
66
- }
67
- }
68
- return {
69
- title: (
70
- <div style={{ display: "flex" }}>
71
- Enzyme - &nbsp;
72
- <CutsiteTag
73
- noClick
74
- showActiveText
75
- allRestrictionEnzymes={props.allRestrictionEnzymes}
76
- cutsitesByNameActive={props.filteredCutsites.cutsitesByName}
77
- cutsitesByName={c}
78
- name={props.cutsiteOrGroupKey}
79
- ></CutsiteTag>
80
- </div>
81
- )
82
- };
83
- }
84
- }
85
- })
86
- )(function (props) {
87
- const {
88
- dispatch,
89
- editorName,
90
- cutsiteOrGroupKey,
91
- allCutsites: { cutsitesByName },
92
- filteredCutsites: { cutsitesByName: cutsitesByNameActive },
93
- selectedAnnotationId,
94
- allRestrictionEnzymes
95
- } = props;
96
-
97
- let inner;
98
-
99
- const userEnzymeGroups = getUserEnzymeGroups(props);
100
- if (isGroup(props)) {
101
- //group case
102
- const ret = getGroupElAndCutsites(props);
103
- const enzymesThatCutInSeq = ret.enzymesThatCutInSeq;
104
- const enzymesThatDontCutInSeq = ret.enzymesThatDontCutInSeq;
105
- inner = (
106
- <div>
107
- <div>
108
- <DropdownButton
109
- minimal
110
- menu={
111
- <Menu>
112
- {flatMap(
113
- [
114
- ...map(specialCutsiteFilterOptions),
115
- ...map(userEnzymeGroups, (v, key) => ({
116
- label: key,
117
- value: "__userCreatedGroup" + key
118
- }))
119
- ],
120
- ({ label, value }, key, i) => {
121
- if (value === cutsiteOrGroupKey) return [];
122
- return (
123
- <MenuItem
124
- onClick={() => {
125
- showDialog({
126
- dialogType: "CompareEnzymeGroupsDialog",
127
- props: {
128
- dialogProps: {
129
- title: "Comparing Groups",
130
- width: 450
131
- },
132
- group1: cutsiteOrGroupKey,
133
- group2: value
134
- }
135
- });
136
- }}
137
- key={i}
138
- text={`vs ${label}`}
139
- ></MenuItem>
140
- );
141
- }
142
- )}
143
- </Menu>
144
- }
145
- text="Compare.."
146
- ></DropdownButton>
147
- <br></br>
148
- <br></br>
149
- </div>
150
-
151
- <div style={{ display: "flex", justifyContent: "space-between" }}>
152
- {!!enzymesThatCutInSeq.length && (
153
- <div>
154
- <div
155
- style={{
156
- display: "flex",
157
- flexDirection: "column",
158
- overflow: "auto"
159
- // maxHeight: 400
160
- }}
161
- >
162
- {enzymesThatCutInSeq.map((e, i) => (
163
- <CutsiteTag
164
- allRestrictionEnzymes={props.allRestrictionEnzymes}
165
- cutsitesByName={props.allCutsites.cutsitesByName}
166
- cutsitesByNameActive={cutsitesByNameActive}
167
- key={i}
168
- {...e}
169
- ></CutsiteTag>
170
- ))}
171
- </div>
172
- </div>
173
- )}
174
- {enzymesThatDontCutInSeq && (
175
- <div>
176
- <div
177
- style={{
178
- display: "flex",
179
- flexDirection: "column",
180
- overflow: "auto"
181
- }}
182
- >
183
- {enzymesThatDontCutInSeq.map((e, i) => (
184
- <CutsiteTag
185
- allRestrictionEnzymes={props.allRestrictionEnzymes}
186
- cutsitesByName={props.allCutsites.cutsitesByName}
187
- cutsitesByNameActive={cutsitesByNameActive}
188
- key={i}
189
- {...e}
190
- ></CutsiteTag>
191
- ))}
192
- </div>
193
- </div>
194
- )}
195
- </div>
196
- </div>
197
- );
198
- } else if (
199
- //single enzyme case
200
- cutsitesByName[cutsiteOrGroupKey.toLowerCase()] ||
201
- allRestrictionEnzymes[cutsiteOrGroupKey.toLowerCase()] ||
202
- aliasedEnzymesByName[cutsiteOrGroupKey.toLowerCase()]
203
- ) {
204
- const inTheseUserGroups = [];
205
- const cutsiteGroup = cutsitesByName[cutsiteOrGroupKey.toLowerCase()] || [];
206
- const enzyme = cutsiteGroup[0]
207
- ? cutsiteGroup[0].restrictionEnzyme
208
- : allRestrictionEnzymes[cutsiteOrGroupKey.toLowerCase()] ||
209
- aliasedEnzymesByName[cutsiteOrGroupKey.toLowerCase()];
210
-
211
- if (cutsiteGroup.length && cutsiteGroup.length <= 3) {
212
- const { el } = getGroupElAndCutsites({
213
- ...props,
214
- cutsiteOrGroupKey: find(
215
- specialCutsiteFilterOptions,
216
- ({ cutsThisManyTimes }) => cutsThisManyTimes === cutsiteGroup.length
217
- ).value
218
- });
219
-
220
- inTheseUserGroups.push(el);
221
- }
222
-
223
- const enzymeName = enzyme.name;
224
-
225
- forEach(userEnzymeGroups, (nameArray, name) => {
226
- let isInGroup;
227
- forEach(nameArray, n => {
228
- if (n.toLowerCase() === enzymeName.toLowerCase()) {
229
- isInGroup = true;
230
- }
231
- });
232
- if (isInGroup) {
233
- const cutsiteOrGroupKey = "__userCreatedGroup" + name;
234
-
235
- const { el } = getGroupElAndCutsites({
236
- ...props,
237
- cutsiteOrGroupKey
238
- });
239
-
240
- inTheseUserGroups.push(el);
241
- }
242
- });
243
- inner = (
244
- <div>
245
- {!!inTheseUserGroups.length && (
246
- <div style={{ marginBottom: 20 }}>{inTheseUserGroups}</div>
247
- )}
248
- <SingleEnzymeCutsiteInfo
249
- {...{
250
- dispatch,
251
- editorName,
252
- selectedAnnotationId,
253
- cutsiteGroup,
254
- enzyme,
255
- allRestrictionEnzymes,
256
- allCutsites: props.allCutsites,
257
- filteredCutsites: props.filteredCutsites
258
- }}
259
- ></SingleEnzymeCutsiteInfo>
260
- </div>
261
- );
262
- } else {
263
- console.error(`we shouldn't be here!:`, cutsiteOrGroupKey);
264
- return null;
265
- }
266
-
267
- return <div className={Classes.DIALOG_BODY}>{inner}</div>;
268
- });
269
-
270
- export const CompareEnzymeGroupsDialog = compose(
271
- withEditorProps,
272
- withRestrictionEnzymes,
273
- wrapDialog({
274
- isDraggable: true
275
- })
276
- )(function (props) {
277
- const {
278
- group1,
279
- group2,
280
- filteredCutsites: { cutsitesByName: cutsitesByNameActive }
281
- } = props;
282
-
283
- const g1 = getGroupElAndCutsites({
284
- ...props,
285
- cutsiteOrGroupKey: group1
286
- });
287
-
288
- const g2 = getGroupElAndCutsites({
289
- ...props,
290
- cutsiteOrGroupKey: group2
291
- });
292
- const byNameLower = n => n.name.toLowerCase();
293
- const shared = intersectionBy(
294
- g1.allEnzymesInGroup,
295
- g2.allEnzymesInGroup,
296
- byNameLower
297
- );
298
-
299
- const g1Only = differenceBy(g1.allEnzymesInGroup, shared, byNameLower);
300
- const g2Only = differenceBy(g2.allEnzymesInGroup, shared, byNameLower);
301
- return (
302
- <div
303
- style={{ display: "flex", justifyContent: "space-between" }}
304
- className={Classes.DIALOG_BODY}
305
- >
306
- <Column
307
- dataTest="tg-column-1"
308
- title="In"
309
- header={g1.el}
310
- body={g1Only.map((e, i) => {
311
- return (
312
- <CutsiteTag
313
- allRestrictionEnzymes={props.allRestrictionEnzymes}
314
- cutsitesByName={props.allCutsites.cutsitesByName}
315
- cutsitesByNameActive={cutsitesByNameActive}
316
- key={i}
317
- {...e}
318
- ></CutsiteTag>
319
- );
320
- })}
321
- />
322
-
323
- <Column
324
- dataTest="tg-column-2"
325
- title="In Both"
326
- header={
327
- <div>
328
- {g1.el} {g2.el}
329
- </div>
330
- }
331
- body={shared.map((e, i) => {
332
- return (
333
- <CutsiteTag
334
- allRestrictionEnzymes={props.allRestrictionEnzymes}
335
- cutsitesByName={props.allCutsites.cutsitesByName}
336
- cutsitesByNameActive={cutsitesByNameActive}
337
- key={i}
338
- {...e}
339
- ></CutsiteTag>
340
- );
341
- })}
342
- />
343
-
344
- <Column
345
- dataTest="tg-column-3"
346
- title="In"
347
- header={g2.el}
348
- body={g2Only.map((e, i) => {
349
- return (
350
- <CutsiteTag
351
- allRestrictionEnzymes={props.allRestrictionEnzymes}
352
- cutsitesByName={props.allCutsites.cutsitesByName}
353
- cutsitesByNameActive={cutsitesByNameActive}
354
- key={i}
355
- {...e}
356
- ></CutsiteTag>
357
- );
358
- })}
359
- />
360
- </div>
361
- );
362
- });
363
-
364
- function isUserEnzymeGroup(group) {
365
- const isUserCreatedGroup = group.startsWith("__userCreatedGroup");
366
- return isUserCreatedGroup;
367
- }
368
-
369
- const getGroupElAndCutsites = ({
370
- enzymeGroupsOverride,
371
- cutsiteOrGroupKey,
372
- filteredRestrictionEnzymes,
373
- allCutsites
374
- }) => {
375
- const userEnzymeGroups =
376
- enzymeGroupsOverride || window.getExistingEnzymeGroups();
377
-
378
- let isGroupActive;
379
- let label;
380
-
381
- const enzymesThatDontCutInSeq = [];
382
- let enzymesThatCutInSeq = [];
383
- forEach(filteredRestrictionEnzymes, g => {
384
- if (g.value === cutsiteOrGroupKey) {
385
- isGroupActive = true;
386
- }
387
- });
388
-
389
- if (cutsiteOrGroupKey === "type2s") {
390
- const nameArray = flatMap(defaultEnzymesByName, e =>
391
- e.isType2S ? e.name : []
392
- );
393
- label = "Type IIS Enzymes";
394
-
395
- sortBy(nameArray).forEach(name => {
396
- const cutsites = allCutsites.cutsitesByName[name.toLowerCase()];
397
- if (!cutsites) {
398
- enzymesThatDontCutInSeq.push({ name, sites: [] });
399
- } else {
400
- enzymesThatCutInSeq.push({ name, sites: cutsites });
401
- }
402
- });
403
- } else if (isUserEnzymeGroup(cutsiteOrGroupKey)) {
404
- const name = cutsiteOrGroupKey.replace("__userCreatedGroup", "");
405
- const nameArray = userEnzymeGroups[name];
406
- label = getUserGroupLabel({ name, nameArray });
407
-
408
- sortBy(nameArray).forEach(name => {
409
- const cutsites = allCutsites.cutsitesByName[name.toLowerCase()];
410
- if (!cutsites) {
411
- enzymesThatDontCutInSeq.push({ name, sites: [] });
412
- } else {
413
- enzymesThatCutInSeq.push({ name, sites: cutsites });
414
- }
415
- });
416
- } else {
417
- //it's a single/double/etc
418
- const specialCutsiteFilterOption =
419
- specialCutsiteFilterOptions[cutsiteOrGroupKey];
420
- label = specialCutsiteFilterOption.label;
421
- enzymesThatCutInSeq = map(allCutsites.cutsitesByName, cutsites =>
422
- cutsites.length === specialCutsiteFilterOption.cutsThisManyTimes
423
- ? { name: cutsites[0].name, sites: cutsites }
424
- : null
425
- ).filter(n => n !== null);
426
- }
427
- const title = (
428
- <div style={{ display: "flex" }}>
429
- {label} &nbsp;
430
- {isGroupActive ? "" : "(inactive)"}
431
- </div>
432
- );
433
- const el = addCutsiteGroupClickHandler({
434
- cutsiteOrGroupKey,
435
- el: (
436
- <Tag minimal intent={isGroupActive && "primary"} style={{ margin: 3 }}>
437
- {label}
438
- </Tag>
439
- ),
440
- title
441
- });
442
-
443
- return {
444
- el,
445
- title,
446
- enzymesThatDontCutInSeq,
447
- enzymesThatCutInSeq,
448
- allEnzymesInGroup: [...enzymesThatCutInSeq, ...enzymesThatDontCutInSeq]
449
- // cutsitesInGroup: [] //tnrtodo
450
- };
451
- };
452
-
453
- export const CutsiteTag = ({
454
- allRestrictionEnzymes,
455
- showActiveText,
456
- cutsitesByNameActive,
457
- cutsitesByName,
458
- name,
459
- onWrapperClick,
460
- doNotShowCuts,
461
- noClick,
462
- forceOpenCutsiteInfo
463
- }) => {
464
- const isHidden = getIsEnzymeHidden({ name, allRestrictionEnzymes });
465
-
466
- let numCuts = (cutsitesByName[name.toLowerCase()] || []).length;
467
-
468
- const aliases = getEnzymeAliases(name);
469
- aliases.forEach(alias => {
470
- if (numCuts === 0) {
471
- numCuts = (cutsitesByName[alias.toLowerCase()] || []).length;
472
- }
473
- });
474
- const isActive = numCuts
475
- ? cutsitesByNameActive[name.toLowerCase()]
476
- ? "primary"
477
- : undefined
478
- : undefined;
479
-
480
- const el = (
481
- <Tag
482
- onClick={onWrapperClick}
483
- intent={isActive}
484
- style={{ margin: 3, opacity: isHidden ? 0.5 : 1 }}
485
- >
486
- <div style={{ display: "flex" }}>
487
- {getCutsiteWithNumCuts({
488
- name,
489
- numCuts,
490
- doNotShowCuts
491
- })}
492
- {showActiveText ? (
493
- isHidden ? (
494
- <span>&nbsp; hidden</span>
495
- ) : isActive ? (
496
- <span>&nbsp; active</span>
497
- ) : (
498
- <span>&nbsp; inactive</span>
499
- )
500
- ) : null}
501
- </div>
502
- </Tag>
503
- );
504
-
505
- return addCutsiteGroupClickHandler({
506
- el,
507
- noClick,
508
- cutsiteOrGroupKey: name,
509
- forceOpenCutsiteInfo
510
- });
511
- };
512
-
513
- export const getUserGroupLabel = ({ name, nameArray }) => (
514
- <span
515
- style={{ display: "flex", alignItems: "center" }}
516
- title={`User created enzyme group ${name} -- ${nameArray.join(" ")}`}
517
- >
518
- <Icon size={10} icon="user"></Icon>&nbsp;{name}
519
- </span>
520
- );
521
-
522
- export const getCutsiteWithNumCuts = ({ name, numCuts, doNotShowCuts }) => {
523
- return (
524
- <div
525
- style={{
526
- display: "flex",
527
- alignItems: "center",
528
- justifyContent: "space-between"
529
- }}
530
- >
531
- {" "}
532
- <div>{name}</div>{" "}
533
- {!doNotShowCuts && (
534
- <div style={{ fontSize: 12 }}>
535
- &nbsp;({numCuts} cut{numCuts === 1 ? "" : "s"})
536
- </div>
537
- )}
538
- </div>
539
- );
540
- };
541
-
542
- export const addCutsiteGroupClickHandler = ({
543
- closeDropDown = noop,
544
- cutsiteOrGroupKey,
545
- el,
546
- noClick,
547
- forceOpenCutsiteInfo
548
- }) => (
549
- <div
550
- className={noClick ? "tg-cutsite-label" : "tg-clickable-cutsite-label"}
551
- style={noClick ? {} : { cursor: "pointer" }}
552
- onClick={
553
- noClick
554
- ? undefined
555
- : e => {
556
- const isInMultiSelect = e.target.closest(
557
- ".bp3-multi-select-popover"
558
- );
559
- if (!forceOpenCutsiteInfo && isInMultiSelect) return true;
560
- closeDropDown();
561
- showDialog({
562
- dialogType: "AdditionalCutsiteInfoDialog",
563
- props: {
564
- cutsiteOrGroupKey
565
- }
566
- });
567
- }
568
- }
569
- >
570
- {el}
571
- </div>
572
- );
573
-
574
- function Column({ dataTest, header, body, title }) {
575
- return (
576
- <div data-test={dataTest} style={{ flexGrow: "1", flexBasis: "0" }}>
577
- {title}:
578
- <div
579
- style={{
580
- height: 60,
581
-
582
- marginBottom: 20,
583
- borderBottom: "1px solid lightgrey"
584
- }}
585
- >
586
- {header}
587
- </div>
588
- {body}
589
- </div>
590
- );
591
- }
592
-
593
- function getIsEnzymeHidden({ name, allRestrictionEnzymes }) {
594
- let isHidden = true;
595
- if (allRestrictionEnzymes[name.toLowerCase()]) {
596
- isHidden = false;
597
- }
598
- return isHidden;
599
- }
@@ -1,105 +0,0 @@
1
- import {
2
- Button,
3
- Popover,
4
- Intent,
5
- Tooltip,
6
- Tag,
7
- Menu,
8
- MenuItem
9
- } from "@blueprintjs/core";
10
- import React from "react";
11
- import { map, startCase } from "lodash-es";
12
- import pureNoFunc from "../utils/pureNoFunc";
13
- // import { fullSequenceTranslationMenu } from "../MenuBar/viewSubmenu";
14
-
15
- export default pureNoFunc(function AlignmentVisibilityTool(props) {
16
- return (
17
- <Popover
18
- minimal
19
- position="bottom"
20
- content={<VisibilityOptions {...props} />}
21
- target={
22
- <Tooltip content="Visibility Options">
23
- <Button
24
- className="tg-alignment-visibility-toggle"
25
- small
26
- rightIcon="caret-down"
27
- intent={Intent.PRIMARY}
28
- minimal
29
- icon="eye-open"
30
- />
31
- </Tooltip>
32
- }
33
- />
34
- );
35
- });
36
-
37
- function VisibilityOptions({
38
- // alignmentAnnotationVisibility = {},
39
- alignmentAnnotationVisibilityToggle,
40
- togglableAlignmentAnnotationSettings = {},
41
- // alignmentAnnotationLabelVisibility = {},
42
- // alignmentAnnotationLabelVisibilityToggle
43
- annotationsWithCounts,
44
- currentPairwiseAlignmentIndex
45
- }) {
46
- let annotationCountToUse = {};
47
- if (currentPairwiseAlignmentIndex) {
48
- annotationCountToUse = annotationsWithCounts[currentPairwiseAlignmentIndex];
49
- } else {
50
- annotationCountToUse = annotationsWithCounts[0];
51
- }
52
- return (
53
- <Menu
54
- style={{ padding: 10 }}
55
- className="alignmentAnnotationVisibilityToolInner"
56
- >
57
- {map(togglableAlignmentAnnotationSettings, (visible, annotationName) => {
58
- return (
59
- <MenuItem
60
- icon={visible ? "tick" : ""}
61
- onClick={e => {
62
- e.stopPropagation();
63
- if (annotationName === "axis") {
64
- return alignmentAnnotationVisibilityToggle({
65
- axisNumbers: !visible,
66
- axis: !visible
67
- });
68
- }
69
- if (annotationName === "cdsFeatureTranslations" && !visible) {
70
- return alignmentAnnotationVisibilityToggle({
71
- cdsFeatureTranslations: !visible,
72
- translations: !visible
73
- });
74
- }
75
-
76
- alignmentAnnotationVisibilityToggle({
77
- [annotationName]: !visible
78
- });
79
- }}
80
- text={
81
- <>
82
- {startCase(annotationName)
83
- .replace("Cds", "CDS")
84
- .replace("Dna", "DNA")}
85
- {annotationName in annotationCountToUse ? (
86
- <Tag round style={{ marginLeft: 7 }}>
87
- {annotationCountToUse[annotationName]}
88
- </Tag>
89
- ) : (
90
- ""
91
- )}
92
- </>
93
- }
94
- key={annotationName}
95
- ></MenuItem>
96
- );
97
- })}
98
- {/* <MenuItem icon="" text={fullSequenceTranslationMenu.text}>
99
- {fullSequenceTranslationMenu.submenu.map(({ text, cmd }) => {
100
- return <MenuItem key={cmd} text={text}></MenuItem>;
101
- })}
102
- </MenuItem> */}
103
- </Menu>
104
- );
105
- }