@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
package/alignments.js DELETED
@@ -1,379 +0,0 @@
1
- import {
2
- tidyUpSequenceData /* generateSequenceData */,
3
- condensePairwiseAlignmentDifferences
4
- } from "@teselagen/sequence-utils";
5
- import { convertBasePosTraceToPerBpTrace } from "@teselagen/bio-parsers";
6
- import shortid from "shortid";
7
-
8
- import addDashesForMatchStartAndEndForTracks from "./utils/addDashesForMatchStartAndEndForTracks";
9
-
10
- import { /* createReducer, */ createAction } from "redux-act";
11
- import { omit } from "lodash-es";
12
-
13
- const alignmentAnnotationSettings = {
14
- axis: true,
15
- axisNumbers: true,
16
- chromatogram: false,
17
- dnaColors: false,
18
- features: false,
19
- parts: false,
20
- reverseSequence: false,
21
- sequence: true,
22
- translations: true,
23
- orfs: false,
24
- orfTranslations: false,
25
- cdsFeatureTranslations: false,
26
- cutsites: false,
27
- primers: false,
28
- compactNames: false
29
- };
30
-
31
- const defaultVisibilities = {
32
- alignmentAnnotationVisibility: alignmentAnnotationSettings,
33
- pairwise_alignmentAnnotationVisibility: alignmentAnnotationSettings,
34
- alignmentAnnotationLabelVisibility: {
35
- features: false,
36
- parts: false,
37
- cutsites: false
38
- },
39
- pairwise_alignmentAnnotationLabelVisibility: {
40
- features: false,
41
- parts: false,
42
- cutsites: false
43
- }
44
- };
45
- const defaultVisibilityTypes = Object.keys(defaultVisibilities);
46
-
47
- try {
48
- defaultVisibilityTypes.forEach(type => {
49
- const newVal = JSON.parse(window.localStorage.getItem(type));
50
- if (newVal)
51
- defaultVisibilities[type] = {
52
- ...defaultVisibilities[type],
53
- ...newVal
54
- };
55
- });
56
- } catch (e) {
57
- console.error("error setting localstorage visibility config", e);
58
- }
59
-
60
- // ------------------------------------
61
- // Actions
62
- // ------------------------------------
63
- export const upsertAlignmentRun = createAction("UPSERT_ALIGNMENT_RUN");
64
- export const removeAlignmentFromRedux = createAction(
65
- "REMOVE_ALIGNMENT_FROM_REDUX"
66
- );
67
- export const updateAlignmentViewVisibility = createAction(
68
- "UPDATE_ALIGNMENT_VIEW_VISIBILITY"
69
- );
70
- export const alignmentRunUpdate = createAction("ALIGNMENT_RUN_UPDATE");
71
-
72
- const highlightRangeProps = {
73
- color: "red",
74
- hideCarets: true,
75
- ignoreGaps: true
76
- };
77
- function addHighlightedDifferences(alignmentTracks) {
78
- return alignmentTracks.map(track => {
79
- if (track.isUnmapped) {
80
- return track;
81
- }
82
- const sequenceData = tidyUpSequenceData(track.sequenceData, {
83
- doNotRemoveInvalidChars: true
84
- });
85
- const matchHighlightRanges = getRangeMatchesBetweenTemplateAndNonTemplate(
86
- alignmentTracks[0].alignmentData.sequence,
87
- track.alignmentData.sequence
88
- );
89
- // .filter by the user-specified mismatch overrides (initially [])
90
- const mismatches = matchHighlightRanges.filter(({ isMatch }) => !isMatch);
91
- return {
92
- ...track,
93
- sequenceData,
94
- matchHighlightRanges,
95
- additionalSelectionLayers: matchHighlightRanges
96
- .filter(({ isMatch }) => !isMatch)
97
- .map(range => {
98
- return { ...range, ...highlightRangeProps };
99
- }),
100
- mismatches
101
- };
102
- });
103
- }
104
-
105
- // alignmentTracks = addHighlightedDifferences(alignmentTracks);
106
-
107
- // ------------------------------------
108
- // Reducer
109
- // ------------------------------------
110
-
111
- export default (state = {}, { payload = {}, type }) => {
112
- if (type === "ALIGNMENT_RUN_UPDATE") {
113
- const { alignmentId } = payload;
114
- const newState = {
115
- ...state,
116
- [alignmentId]: {
117
- ...state[alignmentId],
118
- ...payload
119
- }
120
- };
121
- return newState;
122
- }
123
-
124
- if (type === "UPDATE_ALIGNMENT_VIEW_VISIBILITY") {
125
- defaultVisibilityTypes.forEach(type => {
126
- if (
127
- (type.startsWith("pairwise_") && payload.pairwiseAlignments) ||
128
- (!type.startsWith("pairwise_") && !payload.pairwiseAlignments)
129
- ) {
130
- defaultVisibilities[type] = {
131
- ...defaultVisibilities[type],
132
- ...payload[type.replace("pairwise_", "")]
133
- };
134
-
135
- localStorage.setItem(
136
- type,
137
- JSON.stringify({
138
- ...defaultVisibilities[type],
139
- ...payload[type.replace("pairwise_", "")]
140
- })
141
- );
142
- }
143
- });
144
- return {
145
- ...state,
146
- [payload.id]: { ...payload }
147
- };
148
- }
149
- if (type === "UPSERT_ALIGNMENT_RUN") {
150
- const { id } = payload;
151
- const payloadToUse = {
152
- stateTrackingId: state[id]?.stateTrackingId ? shortid() : "initialLoadId",
153
- alignmentType: state[id]?.alignmentType,
154
- ...payload,
155
- //assign default visibilities
156
- ...defaultVisibilityTypes.reduce((acc, type) => {
157
- if (
158
- (type.startsWith("pairwise_") && payload.pairwiseAlignments) ||
159
- (!type.startsWith("pairwise_") && !payload.pairwiseAlignments)
160
- ) {
161
- acc[type.replace("pairwise_", "")] = {
162
- ...defaultVisibilities[type],
163
- ...payload[type.replace("pairwise_", "")]
164
- };
165
- }
166
- return acc;
167
- }, {})
168
- };
169
- if (payloadToUse.pairwiseAlignments) {
170
- if (
171
- payloadToUse.pairwiseAlignments[0][0].alignmentData.matchStart !==
172
- undefined
173
- ) {
174
- payloadToUse.pairwiseAlignments = payloadToUse.pairwiseAlignments.map(
175
- addDashesForMatchStartAndEndForTracks
176
- );
177
- }
178
- const templateSeq = payloadToUse.pairwiseAlignments[0][0];
179
- //we need to get all of the sequences in a single alignment (turning inserts into single BP red highlights)
180
- const pairwiseOverviewAlignmentTracks = [
181
- {
182
- //add the template seq as the first track in the Pairwise Alignment Overview
183
- ...templateSeq,
184
- sequenceData: tidyUpSequenceData(templateSeq.sequenceData, {
185
- doNotRemoveInvalidChars: true
186
- }),
187
- alignmentData: { sequence: templateSeq.sequenceData.sequence } //remove the gaps from the template sequence
188
- }
189
- ]; // start with just the template seq in there!
190
-
191
- payloadToUse.pairwiseAlignments.forEach(([template, alignedSeq]) => {
192
- const condensedSeq = condensePairwiseAlignmentDifferences(
193
- template.alignmentData.sequence,
194
- alignedSeq.alignmentData.sequence
195
- );
196
- let re = /r+/gi;
197
- let match;
198
- const additionalSelectionLayers = [];
199
- while ((match = re.exec(condensedSeq)) != null) {
200
- additionalSelectionLayers.push({
201
- start: match.index,
202
- end: match.index + match[0].length - 1,
203
- ...highlightRangeProps
204
- });
205
- }
206
- re = /g+/gi;
207
- // let match;
208
- while ((match = re.exec(condensedSeq)) != null) {
209
- additionalSelectionLayers.push({
210
- start: match.index,
211
- end: match.index + match[0].length - 1,
212
- ...highlightRangeProps,
213
- color: "grey"
214
- });
215
- }
216
-
217
- const alignedSeqMinusInserts = {
218
- ...alignedSeq,
219
- sequenceData: {
220
- ...tidyUpSequenceData(alignedSeq.sequenceData, {
221
- doNotRemoveInvalidChars: true
222
- }),
223
- sequence: template.sequenceData.sequence
224
- },
225
- additionalSelectionLayers,
226
- alignmentData: {
227
- sequence: condensedSeq
228
- }
229
- };
230
- pairwiseOverviewAlignmentTracks.push(alignedSeqMinusInserts);
231
- });
232
- payloadToUse.pairwiseOverviewAlignmentTracks =
233
- pairwiseOverviewAlignmentTracks;
234
- payloadToUse.pairwiseAlignments = payloadToUse.pairwiseAlignments.map(
235
- addHighlightedDifferences
236
- );
237
- }
238
- if (payloadToUse.alignmentTracks) {
239
- payloadToUse.alignmentTracks = addHighlightedDifferences(
240
- payloadToUse.alignmentTracks
241
- );
242
- }
243
- //check for issues
244
- let hasError = checkForIssues(
245
- payloadToUse.alignmentTracks,
246
- payload.alignmentType
247
- );
248
- (payloadToUse.pairwiseAlignments || []).forEach(alignment => {
249
- const error = alignment;
250
- if (error) {
251
- hasError = error;
252
- }
253
- });
254
- return {
255
- ...state,
256
- [payload.id]: {
257
- ...payloadToUse,
258
- hasError
259
- }
260
- };
261
- }
262
- if (type === "REMOVE_ALIGNMENT_FROM_REDUX") {
263
- const { id } = payload;
264
- state = omit(state, [id]);
265
- }
266
- return state;
267
- };
268
-
269
- //returns an array like so: [{start: 0, end: 4, isMatch: false}, {start,end,isMatch} ... etc]
270
- function getRangeMatchesBetweenTemplateAndNonTemplate(tempSeq, nonTempSeq) {
271
- //assume all sequences are the same length (with gap characters "-" in some places)
272
- //loop through all non template sequences and compare them with the template
273
-
274
- const seqLength = nonTempSeq.length;
275
- const ranges = [];
276
- // const startIndex = "".match/[-]/ Math.max(0, .indexOf("-"));
277
- const nonTempSeqWithoutLeadingDashes = nonTempSeq.replace(/^-+/g, "");
278
- const nonTempSeqWithoutTrailingDashes = nonTempSeq.replace(/-+$/g, "");
279
-
280
- const startIndex = seqLength - nonTempSeqWithoutLeadingDashes.length;
281
- const endIndex =
282
- seqLength - (seqLength - nonTempSeqWithoutTrailingDashes.length);
283
- for (let index = startIndex; index < endIndex; index++) {
284
- const isMatch =
285
- tempSeq[index].toLowerCase() === nonTempSeq[index].toLowerCase();
286
- const previousRange = ranges[ranges.length - 1];
287
- if (previousRange) {
288
- if (previousRange.isMatch === isMatch) {
289
- previousRange.end++;
290
- } else {
291
- ranges.push({
292
- start: index,
293
- end: index,
294
- isMatch
295
- });
296
- }
297
- } else {
298
- ranges.push({
299
- start: startIndex,
300
- end: startIndex,
301
- isMatch
302
- });
303
- }
304
- }
305
- return ranges;
306
- }
307
-
308
- function checkForIssues(alignmentTracks, alignmentType) {
309
- if (
310
- !alignmentTracks ||
311
- !alignmentTracks[0] ||
312
- !alignmentTracks[0].alignmentData
313
- ) {
314
- return;
315
- }
316
-
317
- const alignmentTrackLength = alignmentTracks[0].alignmentData.sequence.length;
318
- let hasError;
319
- alignmentTracks.some(track => {
320
- if (track.alignmentData.sequence.length !== alignmentTrackLength) {
321
- console.error("incorrect length", alignmentTracks);
322
-
323
- return "incorrect length";
324
- }
325
- if (
326
- track.chromatogramData &&
327
- track.sequenceData.sequence.length !==
328
- track.chromatogramData.baseCalls.length
329
- ) {
330
- console.error("incorrect chromatogram length", alignmentTracks);
331
-
332
- return "incorrect chromatogram length";
333
- }
334
- if (track.chromatogramData && !track.chromatogramData.baseTraces) {
335
- if (!track.chromatogramData.basePos) {
336
- console.error("corrupted chromatogram data", alignmentTracks);
337
- return "corrupted chromatogram data";
338
- }
339
- track.chromatogramData = convertBasePosTraceToPerBpTrace(
340
- track.chromatogramData
341
- );
342
- }
343
- if (
344
- alignmentType !== "Parallel Part Creation" &&
345
- track.sequenceData.sequence.length !==
346
- track.alignmentData.sequence.replace(/-/g, "").length
347
- ) {
348
- console.error(
349
- "sequence data length does not match alignment data w/o gaps"
350
- );
351
- console.error(
352
- "track.sequenceData.sequence:",
353
- track.sequenceData.sequence
354
- );
355
- console.error(
356
- "track.sequenceData.sequence.length:",
357
- track.sequenceData.sequence.length
358
- );
359
- console.error(
360
- "track.alignmentData.sequence:",
361
- track.alignmentData.sequence
362
- );
363
- console.error(
364
- 'track.alignmentData.sequence.replace(/-/g,""):',
365
- track.alignmentData.sequence.replace(/-/g, "")
366
- );
367
- console.error(
368
- 'track.alignmentData.sequence.replace(/-/g,"").length:',
369
- track.alignmentData.sequence.replace(/-/g, "").length
370
- );
371
- hasError = "sequence data length does not match alignment data w/o gaps";
372
- return true;
373
- }
374
- return false;
375
- });
376
- if (hasError) {
377
- return hasError;
378
- }
379
- }
@@ -1,2 +0,0 @@
1
- const sequenceDataSelector = state => state.sequenceData;
2
- export default sequenceDataSelector;
@@ -1,24 +0,0 @@
1
- import { createSelector } from "reselect";
2
- import { filter } from "lodash-es";
3
- export const searchableTypes = ["parts", "features", "primers"];
4
-
5
- function annotationSearchSelector(isOpen, searchString, ...rest) {
6
- if (!searchString || !isOpen) {
7
- return [];
8
- }
9
- return searchableTypes.map((type, i) => {
10
- const annotations = rest[i];
11
- return filter(annotations, ann =>
12
- ann.name
13
- .toLowerCase()
14
- .includes(searchString ? searchString.toLowerCase() : "")
15
- );
16
- });
17
- }
18
-
19
- export default createSelector(
20
- state => state.findTool && state.findTool.isOpen,
21
- state => state.findTool && state.findTool.searchText,
22
- ...searchableTypes.map(type => state => state.sequenceData[type]),
23
- annotationSearchSelector
24
- );
@@ -1,35 +0,0 @@
1
- export const userDefinedTypes = [
2
- "parts",
3
- "features",
4
- "translations",
5
- "primers"
6
- ];
7
-
8
- export const userDefinedTypesMap = userDefinedTypes.reduce(function (
9
- nextVal,
10
- key
11
- ) {
12
- nextVal[key] = key;
13
- return nextVal;
14
- // looks like this:
15
- //{
16
- // parts: 'parts',
17
- // features: 'features',
18
- // translations: 'translations',
19
- // primers: 'primers',
20
- // }
21
- }, {});
22
-
23
- export const derivedDataTypes = ["cutsites", "orfs"];
24
- export const derivedDataTypesMap = derivedDataTypes.reduce(function (
25
- nextVal,
26
- key
27
- ) {
28
- nextVal[key] = key;
29
- return nextVal;
30
- }, {});
31
- export function getSingular(type) {
32
- return type.slice(0, -1);
33
- }
34
-
35
- export const allTypes = [...userDefinedTypes, ...derivedDataTypes];
@@ -1,196 +0,0 @@
1
- import { omit } from "lodash-es";
2
-
3
- //./caretPosition.js
4
-
5
- import createAction from "./utils/createMetaAction";
6
- import createMergedDefaultStateReducer from "./utils/createMergedDefaultStateReducer";
7
-
8
- export const visibilityDefaultValues = {
9
- featureTypesToHide: {},
10
- featureIndividualToHide: {},
11
- partIndividualToHide: {},
12
- primerIndividualToHide: {},
13
- features: true,
14
- warnings: true,
15
- assemblyPieces: true,
16
- chromatogram: true,
17
- lineageAnnotations: true,
18
- translations: true,
19
- parts: true,
20
- orfs: false,
21
- orfTranslations: false,
22
- cdsFeatureTranslations: true,
23
- axis: true,
24
- cutsites: true,
25
- // cutsites: true,
26
- cutsitesInSequence: true,
27
- primers: true,
28
- dnaColors: false,
29
- sequence: true,
30
- reverseSequence: true,
31
- fivePrimeThreePrimeHints: true,
32
- axisNumbers: true
33
- };
34
-
35
- // ------------------------------------
36
- // Actions
37
- // ------------------------------------
38
- export const annotationVisibilityToggle = createAction(
39
- "annotationVisibilityToggle"
40
- );
41
- //eg: annotationVisibilityToggle('features')
42
- export const annotationVisibilityHide = createAction(
43
- "annotationVisibilityHide"
44
- );
45
- export const annotationVisibilityShow = createAction(
46
- "annotationVisibilityShow"
47
- );
48
- export const hideFeatureTypes = createAction("hideFeatureTypes");
49
- export const showFeatureTypes = createAction("showFeatureTypes");
50
- export const resetFeatureTypesToHide = createAction("resetFeatureTypesToHide");
51
- export const hideFeatureIndividual = createAction("hideFeatureIndividual");
52
- export const showFeatureIndividual = createAction("showFeatureIndividual");
53
- export const resetFeatureIndividualToHide = createAction(
54
- "resetFeatureIndividualToHide"
55
- );
56
- export const hidePrimerIndividual = createAction("hidePrimerIndividual");
57
- export const showPrimerIndividual = createAction("showPrimerIndividual");
58
- export const resetPrimerIndividualToHide = createAction(
59
- "resetPrimerIndividualToHide"
60
- );
61
- export const hidePartIndividual = createAction("hidePartIndividual");
62
- export const showPartIndividual = createAction("showPartIndividual");
63
- export const resetPartIndividualToHide = createAction(
64
- "resetPartIndividualToHide"
65
- );
66
-
67
- // ------------------------------------
68
- // Reducer
69
- // ------------------------------------
70
- const annotationVisibility = createMergedDefaultStateReducer(
71
- {
72
- [resetPartIndividualToHide]: state => {
73
- return {
74
- ...state,
75
- partIndividualToHide: {}
76
- };
77
- },
78
- [showPartIndividual]: (state, payload) => {
79
- return {
80
- ...state,
81
- parts: true,
82
- partIndividualToHide: omit(state.partIndividualToHide, payload)
83
- };
84
- },
85
- [hidePartIndividual]: (state, payload) => {
86
- return {
87
- ...state,
88
- partIndividualToHide: {
89
- ...state.partIndividualToHide,
90
- ...payload.reduce((acc, key) => {
91
- acc[key] = true;
92
- return acc;
93
- }, {})
94
- }
95
- };
96
- },
97
- [resetFeatureIndividualToHide]: state => {
98
- return {
99
- ...state,
100
- featureIndividualToHide: {}
101
- };
102
- },
103
- [showFeatureIndividual]: (state, payload) => {
104
- return {
105
- ...state,
106
- features: true,
107
- featureIndividualToHide: omit(state.featureIndividualToHide, payload)
108
- };
109
- },
110
- [hideFeatureIndividual]: (state, payload) => {
111
- return {
112
- ...state,
113
- featureIndividualToHide: {
114
- ...state.featureIndividualToHide,
115
- ...payload.reduce((acc, key) => {
116
- acc[key] = true;
117
- return acc;
118
- }, {})
119
- }
120
- };
121
- },
122
- [resetPrimerIndividualToHide]: state => {
123
- return {
124
- ...state,
125
- primerIndividualToHide: {}
126
- };
127
- },
128
- [showPrimerIndividual]: (state, payload) => {
129
- return {
130
- ...state,
131
- primers: true,
132
- primerIndividualToHide: omit(state.primerIndividualToHide, payload)
133
- };
134
- },
135
- [hidePrimerIndividual]: (state, payload) => {
136
- return {
137
- ...state,
138
- primerIndividualToHide: {
139
- ...state.primerIndividualToHide,
140
- ...payload.reduce((acc, key) => {
141
- acc[key] = true;
142
- return acc;
143
- }, {})
144
- }
145
- };
146
- },
147
- [resetFeatureTypesToHide]: state => {
148
- return {
149
- ...state,
150
- featureTypesToHide: {}
151
- };
152
- },
153
- [showFeatureTypes]: (state, payload) => {
154
- return {
155
- ...state,
156
- featureTypesToHide: omit(state.featureTypesToHide, payload)
157
- };
158
- },
159
- [hideFeatureTypes]: (state, payload) => {
160
- return {
161
- ...state,
162
- featureTypesToHide: {
163
- ...state.featureTypesToHide,
164
- ...payload.reduce((acc, key) => {
165
- acc[key] = true;
166
- return acc;
167
- }, {})
168
- }
169
- };
170
- },
171
- [annotationVisibilityToggle]: (state, payload) => {
172
- return {
173
- ...state,
174
- [payload]: !state[payload],
175
- ...(payload === "orfs" && state.orfs === state.orfTranslations
176
- ? { orfTranslations: !state.orfTranslations }
177
- : null)
178
- };
179
- },
180
- [annotationVisibilityHide]: (state, payload) => {
181
- return {
182
- ...state,
183
- [payload]: false
184
- };
185
- },
186
- [annotationVisibilityShow]: (state, payload) => {
187
- return {
188
- ...state,
189
- [payload]: true
190
- };
191
- }
192
- },
193
- visibilityDefaultValues
194
- );
195
-
196
- export default annotationVisibility;