@teselagen/ove 0.7.28 → 0.7.29

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (285) hide show
  1. package/index.cjs.js +1055 -996
  2. package/index.es.js +1055 -996
  3. package/index.umd.js +189036 -0
  4. package/ove.css +1 -1
  5. package/package.json +2 -6
  6. package/src/helperComponents/PropertiesDialog/TranslationProperties.js +1 -1
  7. package/AASliver.js +0 -187
  8. package/AddLaddersDialog.js +0 -82
  9. package/AdditionalCutsiteInfoDialog.js +0 -599
  10. package/AlignmentVisibilityTool.js +0 -105
  11. package/AnnotationContainerHolder.js +0 -20
  12. package/AnnotationPositioner.js +0 -27
  13. package/AutoAnnotate.js +0 -501
  14. package/AutoAnnotateBpMatchingDialog.js +0 -208
  15. package/Axis.js +0 -151
  16. package/AxisNumbers.js +0 -35
  17. package/Browser.js +0 -106
  18. package/Caret.js +0 -63
  19. package/Chromatogram.js +0 -293
  20. package/CircularDnaSequence.js +0 -73
  21. package/CircularZoomMinimap.js +0 -16
  22. package/ColorPicker.js +0 -30
  23. package/CommandHotkeyHandler.js +0 -44
  24. package/CreateAnnotationsPage.js +0 -98
  25. package/Cutsite.js +0 -18
  26. package/CutsiteProperties.js +0 -176
  27. package/CutsiteSelectionLayers.js +0 -47
  28. package/Cutsites.js +0 -271
  29. package/DeletionLayer.js +0 -28
  30. package/DropHandler.css +0 -21
  31. package/DropHandler.js +0 -64
  32. package/EditCaretPosition.js +0 -234
  33. package/EditTrackNameDialog.js +0 -30
  34. package/Feature.js +0 -83
  35. package/FeatureProperties.js +0 -6
  36. package/FillWindow.js +0 -47
  37. package/GenbankView.js +0 -74
  38. package/GeneralProperties.js +0 -117
  39. package/GenericAnnotationProperties.js +0 -406
  40. package/GlobalDialog.js +0 -73
  41. package/GlobalDialogUtils.js +0 -110
  42. package/GoToDialog.js +0 -25
  43. package/HorizontalPanelDragHandle.js +0 -35
  44. package/Keyboard.js +0 -85
  45. package/Labels.js +0 -327
  46. package/Ladder.css +0 -20
  47. package/Ladder.js +0 -303
  48. package/MeltingTemp.js +0 -85
  49. package/Menlo.ttf +0 -0
  50. package/Minimap.js +0 -515
  51. package/Mismatches.js +0 -134
  52. package/Monaco.ttf +0 -0
  53. package/MultipleSeqsDetectedOnImportDialog.js +0 -74
  54. package/Orf.js +0 -109
  55. package/OrfProperties.js +0 -117
  56. package/Orfs.js +0 -35
  57. package/PCRTool.js +0 -179
  58. package/PairwiseAlignmentView.js +0 -68
  59. package/Part.js +0 -34
  60. package/PartProperties.js +0 -9
  61. package/PassThrough.js +0 -3
  62. package/PerformantSelectionLayer.js +0 -32
  63. package/PinchHelper.js +0 -24
  64. package/PointedAnnotation.js +0 -347
  65. package/PositionAnnotationOnCircle.js +0 -26
  66. package/Primer.js +0 -41
  67. package/PrimerProperties.js +0 -19
  68. package/ReflexContainer.js +0 -802
  69. package/ReflexElement.js +0 -160
  70. package/ReflexEvents.js +0 -77
  71. package/ReflexSplitter.js +0 -205
  72. package/RenameSequenceDialog.js +0 -7
  73. package/RotateCircularViewSlider.js +0 -93
  74. package/SelectDialog.js +0 -150
  75. package/SequenceName.js +0 -15
  76. package/SimpleCircularOrLinearView.js +0 -381
  77. package/SimpleOligoPreview.js +0 -39
  78. package/SingleEnzymeCutsiteInfo.js +0 -139
  79. package/ToolbarItem.js +0 -192
  80. package/Translation.js +0 -198
  81. package/TranslationProperties.js +0 -149
  82. package/UncontrolledSliderWithPlusMinusBtns.css +0 -5
  83. package/UncontrolledSliderWithPlusMinusBtns.js +0 -134
  84. package/VeTopRightContainer.js +0 -12
  85. package/ZoomCircularViewSlider.js +0 -62
  86. package/ZoomLinearView.js +0 -47
  87. package/addAlignment.js +0 -6
  88. package/addMetaToActionCreators.js +0 -12
  89. package/addWrappedAddons.js +0 -20
  90. package/alignmentTool.js +0 -503
  91. package/alignments.js +0 -379
  92. package/annotationLabelVisibility.js +0 -2
  93. package/annotationSearchSelector.js +0 -24
  94. package/annotationTypes.js +0 -35
  95. package/annotationVisibility.js +0 -196
  96. package/annotationsToSupport.js +0 -104
  97. package/arrayToObjWithIds.js +0 -17
  98. package/arrayUtils.js +0 -19
  99. package/array_move.js +0 -10
  100. package/calculateTickMarkPositionsForGivenRange.js +0 -47
  101. package/caretPosition.js +0 -27
  102. package/cdsFeaturesSelector.js +0 -9
  103. package/charWidth.js +0 -22
  104. package/circular.js +0 -19
  105. package/circularSelector.js +0 -4
  106. package/clickAndDragUtils.js +0 -576
  107. package/coerceInitialValue.js +0 -7
  108. package/combineReducersDontIgnoreKeys.js +0 -12
  109. package/commandUtils.js +0 -20
  110. package/constants.js +0 -2
  111. package/copyOptions.js +0 -34
  112. package/createFragmentLines.js +0 -120
  113. package/createMergedDefaultStateReducer.js +0 -30
  114. package/createMetaAction.js +0 -12
  115. package/createSequenceInputPopup.js +0 -290
  116. package/createSequenceInputPopupStyle.css +0 -87
  117. package/createSimpleDialog.js +0 -89
  118. package/createYourOwnEnzyme.js +0 -39
  119. package/cutsiteLabelColorSelector.js +0 -6
  120. package/cutsiteTool.js +0 -88
  121. package/cutsitesByRangeSelector.js +0 -5
  122. package/cutsitesSelector.js +0 -61
  123. package/darkmode.css +0 -98
  124. package/defaultConfig.js +0 -150
  125. package/deletionLayers.js +0 -36
  126. package/description.js +0 -21
  127. package/digestTool.js +0 -34
  128. package/dnaToColor.js +0 -17
  129. package/downloadTool.js +0 -39
  130. package/draggableClassnames.js +0 -5
  131. package/drawAnnotations.js +0 -440
  132. package/drawDirectedPiePiece.js +0 -142
  133. package/editTool.js +0 -49
  134. package/editorSelector.js +0 -2
  135. package/editorUtils.js +0 -205
  136. package/estimateRowHeight.js +0 -184
  137. package/featureLengthsToHide.js +0 -27
  138. package/featureTool.js +0 -34
  139. package/features.js +0 -19
  140. package/featuresSelector.js +0 -8
  141. package/filteredCutsitesSelector.js +0 -136
  142. package/filteredFeaturesSelector.js +0 -32
  143. package/filteredPartsSelector.js +0 -57
  144. package/filteredPrimersSelector.js +0 -27
  145. package/filteredRestrictionEnzymesSelector.js +0 -1
  146. package/find.png +0 -0
  147. package/findTool.js +0 -79
  148. package/findToolConstants.js +0 -1
  149. package/frameTranslations.js +0 -52
  150. package/fullscreen.png +0 -0
  151. package/getAdditionalEnzymesSelector.js +0 -46
  152. package/getAngleForPositionMidpoint.js +0 -3
  153. package/getAnnotationClassnames.js +0 -12
  154. package/getAnnotationNameAndStartStopString.js +0 -61
  155. package/getBpsPerRow.js +0 -19
  156. package/getCutsiteLabelHeights.js +0 -56
  157. package/getGapMap.js +0 -12
  158. package/getGaps.js +0 -27
  159. package/getInternalLabel.js +0 -40
  160. package/getOveHotkeyDefs.js +0 -12
  161. package/getPairwiseOverviewLinearViewOptions.js +0 -38
  162. package/getRangeAnglesSpecial.js +0 -12
  163. package/getStructuredBases.js +0 -97
  164. package/getTrackFromEvent.js +0 -25
  165. package/getVisibleStartEnd.js +0 -7
  166. package/getXStartAndWidthFromNonCircularRange.js +0 -12
  167. package/getXStartAndWidthOfRangeWrtRow.js +0 -27
  168. package/getXStartAndWidthOfRowAnnotation.js +0 -19
  169. package/getYOffset.js +0 -15
  170. package/hoveredAnnotation.js +0 -24
  171. package/importTool.js +0 -27
  172. package/index.js +0 -71
  173. package/inlineFindTool.js +0 -38
  174. package/isElementInViewport.js +0 -29
  175. package/isEnzymeFilterAndSelector.js +0 -1
  176. package/isTargetWithinEl.js +0 -6
  177. package/labelLineIntensity.js +0 -25
  178. package/labelSize.js +0 -23
  179. package/ladderDefaults.js +0 -25
  180. package/lastSavedId.js +0 -20
  181. package/lineageLines.js +0 -11
  182. package/linear.png +0 -0
  183. package/makeStore.js +0 -34
  184. package/massageTickSpacing.js +0 -19
  185. package/materiallyAvailable.js +0 -19
  186. package/middleware.js +0 -112
  187. package/minimumOrfSize.js +0 -24
  188. package/minimumOrfSizeSelector.js +0 -2
  189. package/modalActions.js +0 -3
  190. package/moveCaret.js +0 -58
  191. package/name.js +0 -19
  192. package/normalizeAngle.js +0 -3
  193. package/normalizeAngleRange.js +0 -9
  194. package/oligoTool.js +0 -30
  195. package/onlyUpdateForKeysDeep.js +0 -31
  196. package/orfFrameToColorMap.js +0 -10
  197. package/orfTool.js +0 -136
  198. package/orfsSelector.js +0 -15
  199. package/panelsShown.js +0 -294
  200. package/partLengthsToHide.js +0 -23
  201. package/partOverhangs.js +0 -6
  202. package/partTagSearch.js +0 -69
  203. package/partTool.js +0 -45
  204. package/parts.js +0 -19
  205. package/partsSelector.js +0 -8
  206. package/pie.png +0 -0
  207. package/polarToSpecialCartesian.js +0 -7
  208. package/positionCutsites.js +0 -6
  209. package/prepareRowData.js +0 -64
  210. package/primerBases.js +0 -221
  211. package/primerLengthsToHide.js +0 -27
  212. package/primers.js +0 -19
  213. package/primersSelector.js +0 -8
  214. package/print.png +0 -0
  215. package/printTool.js +0 -31
  216. package/propertiesTool.js +0 -40
  217. package/proteinUtils.js +0 -3
  218. package/pureNoFunc.js +0 -18
  219. package/readOnly.js +0 -25
  220. package/redoTool.js +0 -30
  221. package/reflex-styles.css +0 -128
  222. package/reflex-styles.css.map +0 -9
  223. package/relaxLabelAngles.js +0 -157
  224. package/relaxLabels_DEPRECATED.js +0 -105
  225. package/replacementLayers.js +0 -36
  226. package/restrictionEnzymes.js +0 -52
  227. package/restrictionEnzymesSelector.js +0 -34
  228. package/rowviewContants.js +0 -3
  229. package/ruler.css +0 -89
  230. package/save.png +0 -0
  231. package/saveTool.js +0 -44
  232. package/searchLayersSelector.js +0 -71
  233. package/selectedAnnotations.js +0 -89
  234. package/selectedAnnotationsSelector.js +0 -1
  235. package/selectedCutsitesSelector.js +0 -21
  236. package/selectedPartTags.js +0 -21
  237. package/selectionLayer.js +0 -25
  238. package/sequence.js +0 -12
  239. package/sequenceDataHistory.js +0 -43
  240. package/sequenceDataSelector.js +0 -2
  241. package/sequenceLengthSelector.js +0 -5
  242. package/sequenceSelector.js +0 -4
  243. package/sharedActionCreators.js +0 -0
  244. package/shouldFlipText.js +0 -4
  245. package/shouldRerender.js +0 -27
  246. package/showFileDialog.js +0 -25
  247. package/showGCContent.js +0 -23
  248. package/show_cut_sites.png +0 -0
  249. package/show_features.png +0 -0
  250. package/show_orfs.png +0 -0
  251. package/show_primers.png +0 -0
  252. package/simpleDialog.css +0 -13
  253. package/specialCutsiteFilterOptions.js +0 -22
  254. package/style.css +0 -10
  255. package/tagsToBoldSelector.js +0 -2
  256. package/toggle_views.svg +0 -1
  257. package/toolBar.js +0 -23
  258. package/translationSearchMatchesSelector.js +0 -14
  259. package/translations.js +0 -20
  260. package/translationsRawSelector.js +0 -8
  261. package/translationsSelector.js +0 -137
  262. package/typeField.js +0 -24
  263. package/undoTool.js +0 -30
  264. package/updateEditor.js +0 -200
  265. package/updateLabelsForInViewFeatures.js +0 -55
  266. package/updateLabelsForInViewFeaturesCircView.js +0 -41
  267. package/updateTrackHelper.js +0 -58
  268. package/uppercaseSequenceMapFont.js +0 -25
  269. package/upsertDeleteActionGenerator.js +0 -31
  270. package/useAAColorType.js +0 -8
  271. package/useAdditionalOrfStartCodons.js +0 -24
  272. package/useAnnotationLimits.js +0 -42
  273. package/useChromatogramPrefs.js +0 -31
  274. package/useFormValue.js +0 -7
  275. package/useLadders.js +0 -6
  276. package/useMeltingTemp.js +0 -7
  277. package/useTmType.js +0 -10
  278. package/userDefinedHandlersAndOpts.js +0 -61
  279. package/utils.js +0 -37
  280. package/versionHistory.js +0 -26
  281. package/versionHistoryTool.js +0 -21
  282. package/viewSubmenu.js +0 -479
  283. package/visibilityTool.js +0 -39
  284. package/withHover.js +0 -113
  285. package/withRestrictionEnzymes.js +0 -15
package/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;