@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
@@ -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
- }