@teselagen/ove 0.7.26 → 0.7.28

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (304) hide show
  1. package/AASliver.js +187 -0
  2. package/AddLaddersDialog.js +82 -0
  3. package/AdditionalCutsiteInfoDialog.js +599 -0
  4. package/AlignmentView/Mismatches.d.ts +3 -3
  5. package/AlignmentVisibilityTool.js +105 -0
  6. package/AnnotationContainerHolder.js +20 -0
  7. package/AnnotationPositioner.js +27 -0
  8. package/AutoAnnotate.js +501 -0
  9. package/AutoAnnotateBpMatchingDialog.js +208 -0
  10. package/Axis.js +151 -0
  11. package/AxisNumbers.js +35 -0
  12. package/Browser.js +106 -0
  13. package/Caret.js +63 -0
  14. package/Chromatogram.js +293 -0
  15. package/CircularDnaSequence.js +73 -0
  16. package/CircularView/Labels/index.d.ts +1 -1
  17. package/CircularView/index.d.ts +0 -1
  18. package/CircularZoomMinimap.js +16 -0
  19. package/ColorPicker.js +30 -0
  20. package/CommandHotkeyHandler.js +44 -0
  21. package/CreateAnnotationsPage.d.ts +4 -4
  22. package/CreateAnnotationsPage.js +98 -0
  23. package/Cutsite.js +18 -0
  24. package/CutsiteProperties.js +176 -0
  25. package/CutsiteSelectionLayers.js +47 -0
  26. package/Cutsites.js +271 -0
  27. package/DeletionLayer.js +28 -0
  28. package/DigestTool/Ladder.d.ts +1 -1
  29. package/DropHandler.css +21 -0
  30. package/DropHandler.js +64 -0
  31. package/EditCaretPosition.js +234 -0
  32. package/EditTrackNameDialog.js +30 -0
  33. package/Feature.js +83 -0
  34. package/FeatureProperties.js +6 -0
  35. package/FillWindow.js +47 -0
  36. package/GenbankView.js +74 -0
  37. package/GeneralProperties.js +117 -0
  38. package/GenericAnnotationProperties.js +406 -0
  39. package/GlobalDialog.js +73 -0
  40. package/GlobalDialogUtils.js +110 -0
  41. package/GoToDialog.js +25 -0
  42. package/HorizontalPanelDragHandle.js +35 -0
  43. package/Keyboard.js +85 -0
  44. package/Labels.js +327 -0
  45. package/Ladder.css +20 -0
  46. package/Ladder.js +303 -0
  47. package/MeltingTemp.js +85 -0
  48. package/Menlo.ttf +0 -0
  49. package/Minimap.js +515 -0
  50. package/Mismatches.js +134 -0
  51. package/Monaco.ttf +0 -0
  52. package/MultipleSeqsDetectedOnImportDialog.js +74 -0
  53. package/Orf.js +109 -0
  54. package/OrfProperties.js +117 -0
  55. package/Orfs.js +35 -0
  56. package/PCRTool.js +179 -0
  57. package/PairwiseAlignmentView.js +68 -0
  58. package/Part.js +34 -0
  59. package/PartProperties.js +9 -0
  60. package/PassThrough.js +3 -0
  61. package/PerformantSelectionLayer.js +32 -0
  62. package/PinchHelper.js +24 -0
  63. package/PointedAnnotation.js +347 -0
  64. package/PositionAnnotationOnCircle.js +26 -0
  65. package/Primer.js +41 -0
  66. package/PrimerProperties.js +19 -0
  67. package/Reflex/index.d.ts +0 -1
  68. package/ReflexContainer.js +802 -0
  69. package/ReflexElement.js +160 -0
  70. package/ReflexEvents.js +77 -0
  71. package/ReflexSplitter.js +205 -0
  72. package/RenameSequenceDialog.js +7 -0
  73. package/RotateCircularViewSlider.js +93 -0
  74. package/RowView/index.d.ts +0 -1
  75. package/SelectDialog.js +150 -0
  76. package/SequenceName.js +15 -0
  77. package/SimpleCircularOrLinearView.js +381 -0
  78. package/SimpleOligoPreview.js +39 -0
  79. package/SingleEnzymeCutsiteInfo.js +139 -0
  80. package/ToolBar/ToolbarItem.d.ts +1 -3
  81. package/ToolbarItem.js +192 -0
  82. package/Translation.js +198 -0
  83. package/TranslationProperties.js +149 -0
  84. package/UncontrolledSliderWithPlusMinusBtns.css +5 -0
  85. package/UncontrolledSliderWithPlusMinusBtns.js +134 -0
  86. package/VeTopRightContainer.js +12 -0
  87. package/ZoomCircularViewSlider.js +62 -0
  88. package/ZoomLinearView.js +47 -0
  89. package/addAlignment.js +6 -0
  90. package/addMetaToActionCreators.js +12 -0
  91. package/addWrappedAddons.js +20 -0
  92. package/alignmentTool.js +503 -0
  93. package/alignments.js +379 -0
  94. package/annotationLabelVisibility.js +2 -0
  95. package/annotationSearchSelector.js +24 -0
  96. package/annotationTypes.js +35 -0
  97. package/annotationVisibility.js +196 -0
  98. package/annotationsToSupport.js +104 -0
  99. package/arrayToObjWithIds.js +17 -0
  100. package/arrayUtils.js +19 -0
  101. package/array_move.js +10 -0
  102. package/calculateTickMarkPositionsForGivenRange.js +47 -0
  103. package/caretPosition.js +27 -0
  104. package/cdsFeaturesSelector.js +9 -0
  105. package/charWidth.js +22 -0
  106. package/circular.js +19 -0
  107. package/circularSelector.js +4 -0
  108. package/clickAndDragUtils.js +576 -0
  109. package/coerceInitialValue.js +7 -0
  110. package/combineReducersDontIgnoreKeys.js +12 -0
  111. package/commandUtils.js +20 -0
  112. package/constants.js +2 -0
  113. package/copyOptions.js +34 -0
  114. package/createFragmentLines.js +120 -0
  115. package/createMergedDefaultStateReducer.js +30 -0
  116. package/createMetaAction.js +12 -0
  117. package/createSequenceInputPopup.js +290 -0
  118. package/createSequenceInputPopupStyle.css +87 -0
  119. package/createSimpleDialog.js +89 -0
  120. package/createYourOwnEnzyme.js +39 -0
  121. package/cutsiteLabelColorSelector.js +6 -0
  122. package/cutsiteTool.js +88 -0
  123. package/cutsitesByRangeSelector.js +5 -0
  124. package/cutsitesSelector.js +61 -0
  125. package/darkmode.css +98 -0
  126. package/defaultConfig.js +150 -0
  127. package/deletionLayers.js +36 -0
  128. package/description.js +21 -0
  129. package/digestTool.js +34 -0
  130. package/dnaToColor.js +17 -0
  131. package/downloadTool.js +39 -0
  132. package/draggableClassnames.js +5 -0
  133. package/drawAnnotations.js +440 -0
  134. package/drawDirectedPiePiece.js +142 -0
  135. package/editTool.js +49 -0
  136. package/editorSelector.js +2 -0
  137. package/editorUtils.js +205 -0
  138. package/estimateRowHeight.js +184 -0
  139. package/featureLengthsToHide.js +27 -0
  140. package/featureTool.js +34 -0
  141. package/features.js +19 -0
  142. package/featuresSelector.js +8 -0
  143. package/filteredCutsitesSelector.js +136 -0
  144. package/filteredFeaturesSelector.js +32 -0
  145. package/filteredPartsSelector.js +57 -0
  146. package/filteredPrimersSelector.js +27 -0
  147. package/filteredRestrictionEnzymesSelector.js +1 -0
  148. package/find.png +0 -0
  149. package/findTool.js +79 -0
  150. package/findToolConstants.js +1 -0
  151. package/frameTranslations.js +52 -0
  152. package/fullscreen.png +0 -0
  153. package/getAdditionalEnzymesSelector.js +46 -0
  154. package/getAngleForPositionMidpoint.js +3 -0
  155. package/getAnnotationClassnames.js +12 -0
  156. package/getAnnotationNameAndStartStopString.js +61 -0
  157. package/getBpsPerRow.js +19 -0
  158. package/getCutsiteLabelHeights.js +56 -0
  159. package/getGapMap.js +12 -0
  160. package/getGaps.js +27 -0
  161. package/getInternalLabel.js +40 -0
  162. package/getOveHotkeyDefs.js +12 -0
  163. package/getPairwiseOverviewLinearViewOptions.js +38 -0
  164. package/getRangeAnglesSpecial.js +12 -0
  165. package/getStructuredBases.js +97 -0
  166. package/getTrackFromEvent.js +25 -0
  167. package/getVisibleStartEnd.js +7 -0
  168. package/getXStartAndWidthFromNonCircularRange.js +12 -0
  169. package/getXStartAndWidthOfRangeWrtRow.js +27 -0
  170. package/getXStartAndWidthOfRowAnnotation.js +19 -0
  171. package/getYOffset.js +15 -0
  172. package/hoveredAnnotation.js +24 -0
  173. package/{html2canvas.esm--JN4fLQL.js → html2canvas.esm-DiGWN1gP.js} +187 -229
  174. package/{html2canvas.esm-B7d7VJmQ.cjs → html2canvas.esm-J1esNpMJ.cjs} +187 -229
  175. package/importTool.js +27 -0
  176. package/index.cjs.js +48165 -47142
  177. package/index.es.js +47699 -46676
  178. package/index.js +71 -0
  179. package/inlineFindTool.js +38 -0
  180. package/isElementInViewport.js +29 -0
  181. package/isEnzymeFilterAndSelector.js +1 -0
  182. package/isTargetWithinEl.js +6 -0
  183. package/labelLineIntensity.js +25 -0
  184. package/labelSize.js +23 -0
  185. package/ladderDefaults.js +25 -0
  186. package/lastSavedId.js +20 -0
  187. package/lineageLines.js +11 -0
  188. package/linear.png +0 -0
  189. package/makeStore.js +34 -0
  190. package/massageTickSpacing.js +19 -0
  191. package/materiallyAvailable.js +19 -0
  192. package/middleware.js +112 -0
  193. package/minimumOrfSize.js +24 -0
  194. package/minimumOrfSizeSelector.js +2 -0
  195. package/modalActions.js +3 -0
  196. package/moveCaret.js +58 -0
  197. package/name.js +19 -0
  198. package/normalizeAngle.js +3 -0
  199. package/normalizeAngleRange.js +9 -0
  200. package/oligoTool.js +30 -0
  201. package/onlyUpdateForKeysDeep.js +31 -0
  202. package/orfFrameToColorMap.js +10 -0
  203. package/orfTool.js +136 -0
  204. package/orfsSelector.js +15 -0
  205. package/ove.css +12107 -0
  206. package/package.json +8 -7
  207. package/panelsShown.js +294 -0
  208. package/partLengthsToHide.js +23 -0
  209. package/partOverhangs.js +6 -0
  210. package/partTagSearch.js +69 -0
  211. package/partTool.js +45 -0
  212. package/parts.js +19 -0
  213. package/partsSelector.js +8 -0
  214. package/pie.png +0 -0
  215. package/polarToSpecialCartesian.js +7 -0
  216. package/positionCutsites.js +6 -0
  217. package/prepareRowData.js +64 -0
  218. package/primerBases.js +221 -0
  219. package/primerLengthsToHide.js +27 -0
  220. package/primers.js +19 -0
  221. package/primersSelector.js +8 -0
  222. package/print.png +0 -0
  223. package/printTool.js +31 -0
  224. package/propertiesTool.js +40 -0
  225. package/proteinUtils.js +3 -0
  226. package/pureNoFunc.js +18 -0
  227. package/readOnly.js +25 -0
  228. package/redoTool.js +30 -0
  229. package/reflex-styles.css +128 -0
  230. package/reflex-styles.css.map +9 -0
  231. package/relaxLabelAngles.js +157 -0
  232. package/relaxLabels_DEPRECATED.js +105 -0
  233. package/replacementLayers.js +36 -0
  234. package/restrictionEnzymes.js +52 -0
  235. package/restrictionEnzymesSelector.js +34 -0
  236. package/rowviewContants.js +3 -0
  237. package/ruler.css +89 -0
  238. package/save.png +0 -0
  239. package/saveTool.js +44 -0
  240. package/searchLayersSelector.js +71 -0
  241. package/selectedAnnotations.js +89 -0
  242. package/selectedAnnotationsSelector.js +1 -0
  243. package/selectedCutsitesSelector.js +21 -0
  244. package/selectedPartTags.js +21 -0
  245. package/selectionLayer.js +25 -0
  246. package/selectors/annotationSearchSelector.d.ts +1 -1
  247. package/sequence.js +12 -0
  248. package/sequenceDataHistory.js +43 -0
  249. package/sequenceDataSelector.js +2 -0
  250. package/sequenceLengthSelector.js +5 -0
  251. package/sequenceSelector.js +4 -0
  252. package/sharedActionCreators.js +0 -0
  253. package/shouldFlipText.js +4 -0
  254. package/shouldRerender.js +27 -0
  255. package/showFileDialog.js +25 -0
  256. package/showGCContent.js +23 -0
  257. package/show_cut_sites.png +0 -0
  258. package/show_features.png +0 -0
  259. package/show_orfs.png +0 -0
  260. package/show_primers.png +0 -0
  261. package/simpleDialog.css +13 -0
  262. package/specialCutsiteFilterOptions.js +22 -0
  263. package/src/Editor/DropHandler.js +2 -1
  264. package/src/Editor/index.js +0 -2
  265. package/src/RowItem/StackedAnnotations/getStructuredBases.js +20 -6
  266. package/src/ToolBar/cutsiteTool.js +1 -1
  267. package/src/helperComponents/PropertiesDialog/TranslationProperties.js +2 -1
  268. package/style.css +3 -12100
  269. package/tagsToBoldSelector.js +2 -0
  270. package/toggle_views.svg +1 -0
  271. package/toolBar.js +23 -0
  272. package/translationSearchMatchesSelector.js +14 -0
  273. package/translations.js +20 -0
  274. package/translationsRawSelector.js +8 -0
  275. package/translationsSelector.js +137 -0
  276. package/typeField.js +24 -0
  277. package/undoTool.js +30 -0
  278. package/updateEditor.d.ts +1 -3
  279. package/updateEditor.js +200 -0
  280. package/updateLabelsForInViewFeatures.js +55 -0
  281. package/updateLabelsForInViewFeaturesCircView.js +41 -0
  282. package/updateTrackHelper.js +58 -0
  283. package/uppercaseSequenceMapFont.js +25 -0
  284. package/upsertDeleteActionGenerator.js +31 -0
  285. package/useAAColorType.js +8 -0
  286. package/useAdditionalOrfStartCodons.js +24 -0
  287. package/useAnnotationLimits.js +42 -0
  288. package/useChromatogramPrefs.js +31 -0
  289. package/useFormValue.js +7 -0
  290. package/useLadders.js +6 -0
  291. package/useMeltingTemp.js +7 -0
  292. package/useTmType.js +10 -0
  293. package/userDefinedHandlersAndOpts.js +61 -0
  294. package/utils/getAnnotationNameAndStartStopString.d.ts +1 -5
  295. package/utils/selectionLayer.d.ts +2 -2
  296. package/utils.js +37 -0
  297. package/versionHistory.js +26 -0
  298. package/versionHistoryTool.js +21 -0
  299. package/viewSubmenu.js +479 -0
  300. package/visibilityTool.js +39 -0
  301. package/withEditorInteractions/getBpsPerRow.d.ts +1 -3
  302. package/withHover.js +113 -0
  303. package/withRestrictionEnzymes.js +15 -0
  304. package/index.umd.js +0 -188322
@@ -0,0 +1,208 @@
1
+ /* Copyright (C) 2018 TeselaGen Biotechnology, Inc. */
2
+
3
+ import { Tab, Tabs } from "@blueprintjs/core";
4
+ import { wrapDialog } from "@teselagen/ui";
5
+
6
+ const highlightStyle = {
7
+ background: "red",
8
+ marginTop: 2
9
+ };
10
+ export const AutoAnnotateBpMatchingDialog = wrapDialog({
11
+ title: "Annotation Matching"
12
+ })(function ({ isRegex }) {
13
+ return (
14
+ <div className="bp3-dialog-body">
15
+ <Tabs defaultSelectedTabId={isRegex ? "regex" : "iupac"}>
16
+ <Tab
17
+ id="iupac"
18
+ title="IUPAC"
19
+ panel={
20
+ <div>
21
+ <p>
22
+ When in standard (IUPAC) mode, annotations are matched
23
+ case-insensitively. You can use any degenerate IUPAC base pair
24
+ as well as a couple special characters.
25
+ </p>
26
+ <h4>Special Characters:</h4>
27
+ <div
28
+ style={{
29
+ display: "grid",
30
+ columnGap: 20,
31
+ gridTemplateColumns: "1fr 5fr",
32
+ maxHeight: 200,
33
+ overflow: "auto"
34
+ }}
35
+ >
36
+ <div>#</div>
37
+ <div>
38
+ Any arbitrary string of zero or more bases can be matched
39
+ here.
40
+ </div>
41
+ <div>{"<"}</div>
42
+ <div>Any bases before a {"<"} are considered optional</div>
43
+ <div>{">"}</div>
44
+ <div>Any bases after a {">"} are considered optional</div>
45
+ <div>M</div> <div>AC</div>
46
+ <div>R</div> <div>AG</div>
47
+ <div>W</div> <div>AT</div>
48
+ <div>S</div> <div>CG</div>
49
+ <div>Y</div> <div>CT</div>
50
+ <div>K</div> <div>GT</div>
51
+ <div>V</div> <div>ACG</div>
52
+ <div>H</div> <div>ACT</div>
53
+ <div>D</div> <div>AGT</div>
54
+ <div>B</div> <div>CGT</div>
55
+ <div>X</div> <div>GATC</div>
56
+ <div>N</div> <div>GATC</div>
57
+ <div>.</div> <div>GATC</div>
58
+ </div>
59
+ <br></br>
60
+ <h4>Examples:</h4>
61
+ <div
62
+ style={{
63
+ display: "grid",
64
+ columnGap: 20,
65
+ gridTemplateColumns: "2fr 5fr"
66
+ }}
67
+ >
68
+ <h6>Annotation</h6>
69
+ <h6>
70
+ Sequence (matches in <span style={highlightStyle}>red</span>)
71
+ </h6>
72
+ <div>AATT</div>
73
+ <div>
74
+ AA<span style={highlightStyle}>AATT</span>TTGGGGGCCCCCAAGT
75
+ </div>
76
+ <div>aAkT</div>
77
+ <div>
78
+ AA<span style={highlightStyle}>AATT</span>TTGGGGGCCCCC
79
+ <span style={highlightStyle}>AAGT</span>
80
+ </div>
81
+ <div>ANT</div>
82
+ <div>
83
+ AA<span style={highlightStyle}>AAT</span>TTTGGGGGCCCCCA
84
+ <span style={highlightStyle}>AGT</span>
85
+ </div>
86
+ <div>T#C</div>
87
+ <div>
88
+ AAAATTT<span style={highlightStyle}>TGGGGGC</span>CCCCAAGT
89
+ </div>
90
+ <div>CA{"<"}ATTT</div>
91
+ <div>
92
+ AA<span style={highlightStyle}>AATTT</span>TGGGGGCCCCCAAGT
93
+ </div>
94
+ <div>
95
+ CA{"<"}ATT{">"}TTGAG
96
+ </div>
97
+ <div>
98
+ AA<span style={highlightStyle}>AATTTTG</span>GGGGCCCCCAAGT
99
+ </div>
100
+ </div>
101
+
102
+ <br></br>
103
+ {/* <ConvertApeToRegexTool></ConvertApeToRegexTool> */}
104
+ </div>
105
+ }
106
+ ></Tab>
107
+ <Tab
108
+ id="regex"
109
+ title="Regex"
110
+ panel={
111
+ <div>
112
+ <p>
113
+ When in regex mode, you can use any custom regex to match base
114
+ pairs
115
+ </p>
116
+ <p>
117
+ You can learn more and try out your custom regexes at{" "}
118
+ <a href="https://regex101.com/">https://regex101.com/</a>
119
+ </p>
120
+ <br></br>
121
+ <h4>Examples:</h4>
122
+ <div
123
+ style={{
124
+ display: "grid",
125
+ columnGap: 20,
126
+ gridTemplateColumns: "2fr 5fr"
127
+ }}
128
+ >
129
+ <h6>Annotation</h6>
130
+ <h6>
131
+ Sequence (matches in <span style={highlightStyle}>red</span>)
132
+ </h6>
133
+ <div>AATT</div>
134
+ <div>
135
+ AA<span style={highlightStyle}>AATT</span>TTGGGGGCCCCCAAGT
136
+ </div>
137
+ <div>aAtT</div>
138
+ <div>
139
+ AA<span style={highlightStyle}>AATT</span>TTGGGGGCCCCCAAGT
140
+ </div>
141
+ <div>A.T</div>
142
+ <div>
143
+ AA<span style={highlightStyle}>AAT</span>TTTGGGGGCCCCCA
144
+ <span style={highlightStyle}>AGT</span>
145
+ </div>
146
+ <div>T.*C</div>
147
+ <div>
148
+ AAAA<span style={highlightStyle}>TTTTGGGGGCCCCC</span>AAGT
149
+ </div>
150
+ <div>T[^T]*?C</div>
151
+ <div>
152
+ AAAATTT<span style={highlightStyle}>TGGGGGC</span>CCCCAAGT
153
+ </div>
154
+ <div>C?A?ATT</div>
155
+ <div>
156
+ AA<span style={highlightStyle}>AATTT</span>TGGGGGCCCCCAAGT
157
+ </div>
158
+ <div>C?A?ATTT?T?C?</div>
159
+ <div>
160
+ AA<span style={highlightStyle}>AATTTT</span>GGGGGCCCCCAAGT
161
+ </div>
162
+ </div>
163
+ <br></br>
164
+
165
+ {/* <ConvertApeToRegexTool></ConvertApeToRegexTool> */}
166
+ </div>
167
+ }
168
+ ></Tab>
169
+ </Tabs>
170
+ </div>
171
+ );
172
+ });
173
+
174
+ // function ConvertApeToRegexTool() {
175
+ // const [inputVal, setInput] = useState("CA<ANT>TTGAG");
176
+
177
+ // let convertedVal = "";
178
+ // try {
179
+ // convertedVal = convertApELikeRegexToRegex(inputVal);
180
+ // } catch (error) {
181
+ // convertedVal = "Error trying to convert to regex";
182
+ // }
183
+ // return (
184
+ // <div
185
+ // style={{
186
+ // display: "grid",
187
+ // rowGap: 10,
188
+ // columnGap: 10,
189
+ // gridTemplateColumns: "1fr 5fr"
190
+ // }}
191
+ // >
192
+ // <div>Input:</div>
193
+ // <TextArea
194
+ // value={inputVal}
195
+ // onChange={e => {
196
+ // setInput(e.target.value.replace(/\s/g, "X"));
197
+ // }}
198
+ // ></TextArea>
199
+
200
+ // <div>Output:</div>
201
+ // <div
202
+ // style={{ maxHeight: 200, overflowWrap: "anywhere", overflow: "auto" }}
203
+ // >
204
+ // {convertedVal}
205
+ // </div>
206
+ // </div>
207
+ // );
208
+ // }
package/Axis.js ADDED
@@ -0,0 +1,151 @@
1
+ import { normalizePositionByRangeLength } from "@teselagen/range-utils";
2
+ import getXStartAndWidthOfRangeWrtRow from "./getXStartAndWidthOfRangeWrtRow";
3
+ import React, { useMemo } from "react";
4
+ import calculateTickMarkPositionsForGivenRange from "../utils/calculateTickMarkPositionsForGivenRange";
5
+ import { divideBy3 } from "../utils/proteinUtils";
6
+ import { view } from "@risingstack/react-easy-state";
7
+ import { getVisibleStartEnd } from "../utils/getVisibleStartEnd";
8
+
9
+ const Axis = function (props) {
10
+ const {
11
+ row,
12
+ tickSpacing,
13
+ bpsPerRow,
14
+ charWidth,
15
+ annotationHeight,
16
+ marginTop,
17
+ sequenceLength,
18
+ showAxisNumbers = true,
19
+ getGaps,
20
+ scrollData,
21
+ isProtein,
22
+ style,
23
+ isLinearView
24
+ } = props;
25
+ const noRows = row.start === 0 && row.end === 0;
26
+ /* eslint-disable react-hooks/exhaustive-deps */
27
+ //memoize this function because it does the heavy lifting
28
+ const tickMarkPositions = useMemo(() => {
29
+ if (noRows) return [];
30
+ return calculateTickMarkPositionsForGivenRange({
31
+ tickSpacing,
32
+ range: row,
33
+ sequenceLength,
34
+ isProtein
35
+ }).map(tickMarkPosition => {
36
+ const gaps = getGaps ? getGaps(tickMarkPosition).gapsBefore : 0;
37
+ const xCenter =
38
+ (tickMarkPosition - (isProtein ? 1 : 0) + gaps) * charWidth +
39
+ charWidth / 2;
40
+ return {
41
+ tickMarkPosition,
42
+ xCenter
43
+ };
44
+ });
45
+ }, [
46
+ noRows,
47
+ tickSpacing,
48
+ row.start,
49
+ row.end,
50
+ sequenceLength,
51
+ isProtein,
52
+ charWidth
53
+ ]);
54
+ /* eslint-enable react-hooks/exhaustive-deps*/
55
+ if (noRows) {
56
+ return null;
57
+ }
58
+ const { xStart, width } = getXStartAndWidthOfRangeWrtRow({
59
+ row,
60
+ range: row,
61
+ charWidth,
62
+ sequenceLength,
63
+ ...(getGaps ? getGaps(row) : {})
64
+ });
65
+ //this function should take in a desired tickSpacing (eg 10 bps between tick mark)
66
+ //and output an array of tickMarkPositions for the given row (eg, [0, 10, 20])
67
+ const xEnd = xStart + width;
68
+ let visibleStart, visibleEnd;
69
+ if (scrollData) {
70
+ const val = getVisibleStartEnd({
71
+ scrollData,
72
+ width: sequenceLength * charWidth
73
+ });
74
+ //add a small buffer to either side of the visible start/end
75
+ visibleStart = val.visibleStart - 400;
76
+ visibleEnd = val.visibleEnd + 400;
77
+ }
78
+
79
+ const yStart = 0;
80
+ const tickMarkSVG = [];
81
+
82
+ tickMarkPositions.forEach(function ({ tickMarkPosition, xCenter }, i) {
83
+ // const xCenterPlusXStart = xCenter + xStart;
84
+
85
+ if (scrollData && !(xCenter < visibleEnd && xCenter > visibleStart)) return;
86
+ tickMarkSVG.push(
87
+ <rect
88
+ className="veAxisTick"
89
+ data-test={tickMarkPosition + 1}
90
+ key={"axisTickMarkPath " + i + " " + tickMarkPosition}
91
+ x={xCenter}
92
+ width={1}
93
+ height={5}
94
+ />
95
+ );
96
+ if (showAxisNumbers) {
97
+ const position =
98
+ normalizePositionByRangeLength(
99
+ row.start + tickMarkPosition,
100
+ sequenceLength
101
+ ) + (isProtein ? 0 : 1);
102
+ const positionLength = position.toString().length * 4;
103
+ const textInner = divideBy3(position + (isProtein ? 1 : 0), isProtein);
104
+
105
+ let x = xCenter;
106
+ if (!isLinearView) {
107
+ x =
108
+ i === 0 //if first label in row, or last label in row, we add checks to make sure the axis number labels don't go outside of the width of the row
109
+ ? Math.max(positionLength, xCenter)
110
+ : i === tickMarkPositions.length - 1
111
+ ? Math.min(bpsPerRow * charWidth - positionLength, xCenter)
112
+ : xCenter;
113
+ }
114
+ if (i === tickMarkPositions.length - 1) {
115
+ x = Math.min(x, xEnd - positionLength / 2);
116
+ }
117
+ tickMarkSVG.push(
118
+ <text
119
+ data-tick-mark={textInner}
120
+ key={"axisTickMarkText " + i + " " + tickMarkPosition}
121
+ fill="black"
122
+ x={x}
123
+ y={annotationHeight}
124
+ style={{ textAnchor: "middle", fontSize: 10, fontFamily: "Verdana" }}
125
+ >
126
+ {textInner}
127
+ </text>
128
+ );
129
+ }
130
+ });
131
+
132
+ return (
133
+ <svg
134
+ className="veRowViewAxis veAxis"
135
+ height={annotationHeight}
136
+ width={width}
137
+ style={{ marginTop, overflow: "visible", display: "block", ...style }}
138
+ >
139
+ {tickMarkSVG}
140
+ <path
141
+ className="veAxisLine"
142
+ d={"M" + xStart + "," + yStart + " L" + xEnd + "," + yStart}
143
+ stroke="black"
144
+ />
145
+ </svg>
146
+ );
147
+ };
148
+
149
+ // export default Axis
150
+ export default view(Axis);
151
+ // export default pureNoFunc(Axis);
package/AxisNumbers.js ADDED
@@ -0,0 +1,35 @@
1
+ import React from "react";
2
+ import shouldFlipText from "./shouldFlipText";
3
+ import { divideBy3 } from "../utils/proteinUtils";
4
+
5
+ export function AxisNumbers({
6
+ rotationRadians,
7
+ textHeightOffset = -5,
8
+ annotation,
9
+ isProtein,
10
+ hideNumbers
11
+ }) {
12
+ const shouldFlip = shouldFlipText(annotation.startAngle + rotationRadians);
13
+ return (
14
+ <g>
15
+ <rect y={-17} width={1} height={5} fill="black"></rect>
16
+ {!hideNumbers && (
17
+ <text
18
+ transform={
19
+ (shouldFlip ? "rotate(180)" : "") +
20
+ ` translate(0, ${
21
+ shouldFlip ? -textHeightOffset : textHeightOffset
22
+ })`
23
+ }
24
+ style={{
25
+ textAnchor: "middle",
26
+ dominantBaseline: "central",
27
+ fontSize: "small"
28
+ }}
29
+ >
30
+ {divideBy3(annotation.tickPosition + 1, isProtein) + ""}
31
+ </text>
32
+ )}
33
+ </g>
34
+ );
35
+ }
package/Browser.js ADDED
@@ -0,0 +1,106 @@
1
+ /////////////////////////////////////////////////////////
2
+ // Browser Utils
3
+ //
4
+ /////////////////////////////////////////////////////////
5
+ class Browser {
6
+ // Check if not running on server
7
+ static isBrowser() {
8
+ return typeof window !== "undefined";
9
+ }
10
+
11
+ // // Opera 8.0+ (UA detection to detect Blink/v8-powered Opera)
12
+ // static isOpera() {
13
+ // return (
14
+ // Browser.isBrowser() &&
15
+ // (!!window.opera || navigator.userAgent.indexOf(" OPR/") >= 0)
16
+ // );
17
+ // }
18
+
19
+ static isOpera() {
20
+ return Browser.isBrowser() && Browser.getUserAgent().match(/Opera Mini/i);
21
+ }
22
+
23
+ // Firefox 1.0+
24
+ static isFirefox() {
25
+ return Browser.isBrowser() && typeof InstallTrigger !== "undefined";
26
+ }
27
+
28
+ // Safari 3.0+
29
+ static isSafari() {
30
+ if (!Browser.isBrowser()) {
31
+ return false;
32
+ }
33
+
34
+ return /^((?!chrome|android).)*safari/i.test(navigator.userAgent);
35
+ }
36
+
37
+ // Internet Explorer 6-11
38
+ static isIE() {
39
+ /*@cc_on!@*/
40
+ return Browser.isBrowser() && !!document.documentMode;
41
+ }
42
+
43
+ // Edge 20+
44
+ static isEdge() {
45
+ return Browser.isBrowser() && !Browser.isIE() && !!window.StyleMedia;
46
+ }
47
+
48
+ // Chrome 1+
49
+ static isChrome() {
50
+ return Browser.isBrowser() && !!window.chrome && !!window.chrome.webstore;
51
+ }
52
+
53
+ // Blink engine detection
54
+ static isBlink() {
55
+ return (
56
+ Browser.isBrowser() &&
57
+ (Browser.isChrome() || Browser.isOpera()) &&
58
+ !!window.CSS
59
+ );
60
+ }
61
+
62
+ static getUserAgent() {
63
+ return typeof navigator === "undefined" ? "" : navigator.userAgent;
64
+ }
65
+
66
+ static isAndroid() {
67
+ return Browser.isBrowser() && Browser.getUserAgent().match(/Android/i);
68
+ }
69
+
70
+ static isBlackBerry() {
71
+ return Browser.isBrowser() && Browser.getUserAgent().match(/BlackBerry/i);
72
+ }
73
+
74
+ static isIOS() {
75
+ return (
76
+ Browser.isBrowser() && Browser.getUserAgent().match(/iPhone|iPad|iPod/i)
77
+ );
78
+ }
79
+
80
+ static isWindows() {
81
+ return (
82
+ (Browser.isBrowser() && Browser.isWindowsDesktop()) ||
83
+ Browser.isWindowsMobile()
84
+ );
85
+ }
86
+
87
+ static isWindowsMobile() {
88
+ return Browser.isBrowser() && Browser.getUserAgent().match(/IEMobile/i);
89
+ }
90
+
91
+ static isWindowsDesktop() {
92
+ return Browser.isBrowser() && Browser.getUserAgent().match(/WPDesktop/i);
93
+ }
94
+
95
+ static isMobile() {
96
+ return (
97
+ Browser.isBrowser() &&
98
+ (Browser.isWindowsMobile() ||
99
+ Browser.isBlackBerry() ||
100
+ Browser.isAndroid() ||
101
+ Browser.isIOS())
102
+ );
103
+ }
104
+ }
105
+
106
+ export default Browser;
package/Caret.js ADDED
@@ -0,0 +1,63 @@
1
+ import isNumber from "lodash/isNumber";
2
+ import { getRangeAngles } from "@teselagen/range-utils";
3
+ import PositionAnnotationOnCircle from "./PositionAnnotationOnCircle";
4
+ import React from "react";
5
+ import draggableClassnames from "../constants/draggableClassnames";
6
+ import pureNoFunc from "../utils/pureNoFunc";
7
+ import { getSelectionMessage } from "../utils/editorUtils";
8
+
9
+ function Caret({
10
+ caretPosition,
11
+ sequenceLength,
12
+ className,
13
+ onClick,
14
+ isSelection,
15
+ innerRadius,
16
+ outerRadius,
17
+ isProtein,
18
+ selectionMessage
19
+ }) {
20
+ const { startAngle, endAngle } = getRangeAngles(
21
+ { start: caretPosition, end: caretPosition },
22
+ sequenceLength || 1
23
+ );
24
+ if (!isNumber(startAngle)) {
25
+ console.error("we've got a problem!");
26
+ }
27
+ const { transform } = PositionAnnotationOnCircle({
28
+ sAngle: startAngle,
29
+ eAngle: endAngle,
30
+ height: 0
31
+ });
32
+ return (
33
+ <g
34
+ onClick={onClick}
35
+ transform={transform}
36
+ className={className + " veCaret " + draggableClassnames.caret}
37
+ >
38
+ <title>
39
+ {selectionMessage ||
40
+ getSelectionMessage({ caretPosition, isProtein, sequenceLength })}
41
+ </title>
42
+ <line
43
+ strokeWidth="1.5px"
44
+ x1={0}
45
+ y1={-innerRadius}
46
+ x2={0}
47
+ y2={-outerRadius}
48
+ // stroke="black"
49
+ />
50
+ {isSelection ? (
51
+ <polygon
52
+ className="vePolygonCaretHandle"
53
+ fill="black"
54
+ points={`0,${-outerRadius + 2} 5,${-outerRadius - 10} -5,${
55
+ -outerRadius - 10
56
+ }`}
57
+ />
58
+ ) : null}
59
+ </g>
60
+ );
61
+ }
62
+
63
+ export default pureNoFunc(Caret);