@teselagen/ove 0.7.27 → 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.
- package/AASliver.js +187 -0
- package/AddLaddersDialog.js +82 -0
- package/AdditionalCutsiteInfoDialog.js +599 -0
- package/AlignmentView/Mismatches.d.ts +3 -3
- package/AlignmentVisibilityTool.js +105 -0
- package/AnnotationContainerHolder.js +20 -0
- package/AnnotationPositioner.js +27 -0
- package/AutoAnnotate.js +501 -0
- package/AutoAnnotateBpMatchingDialog.js +208 -0
- package/Axis.js +151 -0
- package/AxisNumbers.js +35 -0
- package/Browser.js +106 -0
- package/Caret.js +63 -0
- package/Chromatogram.js +293 -0
- package/CircularDnaSequence.js +73 -0
- package/CircularView/Labels/index.d.ts +1 -1
- package/CircularView/index.d.ts +0 -1
- package/CircularZoomMinimap.js +16 -0
- package/ColorPicker.js +30 -0
- package/CommandHotkeyHandler.js +44 -0
- package/CreateAnnotationsPage.d.ts +4 -4
- package/CreateAnnotationsPage.js +98 -0
- package/Cutsite.js +18 -0
- package/CutsiteProperties.js +176 -0
- package/CutsiteSelectionLayers.js +47 -0
- package/Cutsites.js +271 -0
- package/DeletionLayer.js +28 -0
- package/DigestTool/Ladder.d.ts +1 -1
- package/DropHandler.css +21 -0
- package/DropHandler.js +64 -0
- package/EditCaretPosition.js +234 -0
- package/EditTrackNameDialog.js +30 -0
- package/Feature.js +83 -0
- package/FeatureProperties.js +6 -0
- package/FillWindow.js +47 -0
- package/GenbankView.js +74 -0
- package/GeneralProperties.js +117 -0
- package/GenericAnnotationProperties.js +406 -0
- package/GlobalDialog.js +73 -0
- package/GlobalDialogUtils.js +110 -0
- package/GoToDialog.js +25 -0
- package/HorizontalPanelDragHandle.js +35 -0
- package/Keyboard.js +85 -0
- package/Labels.js +327 -0
- package/Ladder.css +20 -0
- package/Ladder.js +303 -0
- package/MeltingTemp.js +85 -0
- package/Menlo.ttf +0 -0
- package/Minimap.js +515 -0
- package/Mismatches.js +134 -0
- package/Monaco.ttf +0 -0
- package/MultipleSeqsDetectedOnImportDialog.js +74 -0
- package/Orf.js +109 -0
- package/OrfProperties.js +117 -0
- package/Orfs.js +35 -0
- package/PCRTool.js +179 -0
- package/PairwiseAlignmentView.js +68 -0
- package/Part.js +34 -0
- package/PartProperties.js +9 -0
- package/PassThrough.js +3 -0
- package/PerformantSelectionLayer.js +32 -0
- package/PinchHelper.js +24 -0
- package/PointedAnnotation.js +347 -0
- package/PositionAnnotationOnCircle.js +26 -0
- package/Primer.js +41 -0
- package/PrimerProperties.js +19 -0
- package/Reflex/index.d.ts +0 -1
- package/ReflexContainer.js +802 -0
- package/ReflexElement.js +160 -0
- package/ReflexEvents.js +77 -0
- package/ReflexSplitter.js +205 -0
- package/RenameSequenceDialog.js +7 -0
- package/RotateCircularViewSlider.js +93 -0
- package/RowView/index.d.ts +0 -1
- package/SelectDialog.js +150 -0
- package/SequenceName.js +15 -0
- package/SimpleCircularOrLinearView.js +381 -0
- package/SimpleOligoPreview.js +39 -0
- package/SingleEnzymeCutsiteInfo.js +139 -0
- package/ToolBar/ToolbarItem.d.ts +1 -3
- package/ToolbarItem.js +192 -0
- package/Translation.js +198 -0
- package/TranslationProperties.js +149 -0
- package/UncontrolledSliderWithPlusMinusBtns.css +5 -0
- package/UncontrolledSliderWithPlusMinusBtns.js +134 -0
- package/VeTopRightContainer.js +12 -0
- package/ZoomCircularViewSlider.js +62 -0
- package/ZoomLinearView.js +47 -0
- package/addAlignment.js +6 -0
- package/addMetaToActionCreators.js +12 -0
- package/addWrappedAddons.js +20 -0
- package/alignmentTool.js +503 -0
- package/alignments.js +379 -0
- package/annotationLabelVisibility.js +2 -0
- package/annotationSearchSelector.js +24 -0
- package/annotationTypes.js +35 -0
- package/annotationVisibility.js +196 -0
- package/annotationsToSupport.js +104 -0
- package/arrayToObjWithIds.js +17 -0
- package/arrayUtils.js +19 -0
- package/array_move.js +10 -0
- package/calculateTickMarkPositionsForGivenRange.js +47 -0
- package/caretPosition.js +27 -0
- package/cdsFeaturesSelector.js +9 -0
- package/charWidth.js +22 -0
- package/circular.js +19 -0
- package/circularSelector.js +4 -0
- package/clickAndDragUtils.js +576 -0
- package/coerceInitialValue.js +7 -0
- package/combineReducersDontIgnoreKeys.js +12 -0
- package/commandUtils.js +20 -0
- package/constants.js +2 -0
- package/copyOptions.js +34 -0
- package/createFragmentLines.js +120 -0
- package/createMergedDefaultStateReducer.js +30 -0
- package/createMetaAction.js +12 -0
- package/createSequenceInputPopup.js +290 -0
- package/createSequenceInputPopupStyle.css +87 -0
- package/createSimpleDialog.js +89 -0
- package/createYourOwnEnzyme.js +39 -0
- package/cutsiteLabelColorSelector.js +6 -0
- package/cutsiteTool.js +88 -0
- package/cutsitesByRangeSelector.js +5 -0
- package/cutsitesSelector.js +61 -0
- package/darkmode.css +98 -0
- package/defaultConfig.js +150 -0
- package/deletionLayers.js +36 -0
- package/description.js +21 -0
- package/digestTool.js +34 -0
- package/dnaToColor.js +17 -0
- package/downloadTool.js +39 -0
- package/draggableClassnames.js +5 -0
- package/drawAnnotations.js +440 -0
- package/drawDirectedPiePiece.js +142 -0
- package/editTool.js +49 -0
- package/editorSelector.js +2 -0
- package/editorUtils.js +205 -0
- package/estimateRowHeight.js +184 -0
- package/featureLengthsToHide.js +27 -0
- package/featureTool.js +34 -0
- package/features.js +19 -0
- package/featuresSelector.js +8 -0
- package/filteredCutsitesSelector.js +136 -0
- package/filteredFeaturesSelector.js +32 -0
- package/filteredPartsSelector.js +57 -0
- package/filteredPrimersSelector.js +27 -0
- package/filteredRestrictionEnzymesSelector.js +1 -0
- package/find.png +0 -0
- package/findTool.js +79 -0
- package/findToolConstants.js +1 -0
- package/frameTranslations.js +52 -0
- package/fullscreen.png +0 -0
- package/getAdditionalEnzymesSelector.js +46 -0
- package/getAngleForPositionMidpoint.js +3 -0
- package/getAnnotationClassnames.js +12 -0
- package/getAnnotationNameAndStartStopString.js +61 -0
- package/getBpsPerRow.js +19 -0
- package/getCutsiteLabelHeights.js +56 -0
- package/getGapMap.js +12 -0
- package/getGaps.js +27 -0
- package/getInternalLabel.js +40 -0
- package/getOveHotkeyDefs.js +12 -0
- package/getPairwiseOverviewLinearViewOptions.js +38 -0
- package/getRangeAnglesSpecial.js +12 -0
- package/getStructuredBases.js +97 -0
- package/getTrackFromEvent.js +25 -0
- package/getVisibleStartEnd.js +7 -0
- package/getXStartAndWidthFromNonCircularRange.js +12 -0
- package/getXStartAndWidthOfRangeWrtRow.js +27 -0
- package/getXStartAndWidthOfRowAnnotation.js +19 -0
- package/getYOffset.js +15 -0
- package/hoveredAnnotation.js +24 -0
- package/{html2canvas.esm--JN4fLQL.js → html2canvas.esm-DiGWN1gP.js} +187 -229
- package/{html2canvas.esm-B7d7VJmQ.cjs → html2canvas.esm-J1esNpMJ.cjs} +187 -229
- package/importTool.js +27 -0
- package/index.cjs.js +48165 -47142
- package/index.es.js +47699 -46676
- package/index.js +71 -0
- package/inlineFindTool.js +38 -0
- package/isElementInViewport.js +29 -0
- package/isEnzymeFilterAndSelector.js +1 -0
- package/isTargetWithinEl.js +6 -0
- package/labelLineIntensity.js +25 -0
- package/labelSize.js +23 -0
- package/ladderDefaults.js +25 -0
- package/lastSavedId.js +20 -0
- package/lineageLines.js +11 -0
- package/linear.png +0 -0
- package/makeStore.js +34 -0
- package/massageTickSpacing.js +19 -0
- package/materiallyAvailable.js +19 -0
- package/middleware.js +112 -0
- package/minimumOrfSize.js +24 -0
- package/minimumOrfSizeSelector.js +2 -0
- package/modalActions.js +3 -0
- package/moveCaret.js +58 -0
- package/name.js +19 -0
- package/normalizeAngle.js +3 -0
- package/normalizeAngleRange.js +9 -0
- package/oligoTool.js +30 -0
- package/onlyUpdateForKeysDeep.js +31 -0
- package/orfFrameToColorMap.js +10 -0
- package/orfTool.js +136 -0
- package/orfsSelector.js +15 -0
- package/ove.css +12107 -0
- package/package.json +6 -5
- package/panelsShown.js +294 -0
- package/partLengthsToHide.js +23 -0
- package/partOverhangs.js +6 -0
- package/partTagSearch.js +69 -0
- package/partTool.js +45 -0
- package/parts.js +19 -0
- package/partsSelector.js +8 -0
- package/pie.png +0 -0
- package/polarToSpecialCartesian.js +7 -0
- package/positionCutsites.js +6 -0
- package/prepareRowData.js +64 -0
- package/primerBases.js +221 -0
- package/primerLengthsToHide.js +27 -0
- package/primers.js +19 -0
- package/primersSelector.js +8 -0
- package/print.png +0 -0
- package/printTool.js +31 -0
- package/propertiesTool.js +40 -0
- package/proteinUtils.js +3 -0
- package/pureNoFunc.js +18 -0
- package/readOnly.js +25 -0
- package/redoTool.js +30 -0
- package/reflex-styles.css +128 -0
- package/reflex-styles.css.map +9 -0
- package/relaxLabelAngles.js +157 -0
- package/relaxLabels_DEPRECATED.js +105 -0
- package/replacementLayers.js +36 -0
- package/restrictionEnzymes.js +52 -0
- package/restrictionEnzymesSelector.js +34 -0
- package/rowviewContants.js +3 -0
- package/ruler.css +89 -0
- package/save.png +0 -0
- package/saveTool.js +44 -0
- package/searchLayersSelector.js +71 -0
- package/selectedAnnotations.js +89 -0
- package/selectedAnnotationsSelector.js +1 -0
- package/selectedCutsitesSelector.js +21 -0
- package/selectedPartTags.js +21 -0
- package/selectionLayer.js +25 -0
- package/selectors/annotationSearchSelector.d.ts +1 -1
- package/sequence.js +12 -0
- package/sequenceDataHistory.js +43 -0
- package/sequenceDataSelector.js +2 -0
- package/sequenceLengthSelector.js +5 -0
- package/sequenceSelector.js +4 -0
- package/sharedActionCreators.js +0 -0
- package/shouldFlipText.js +4 -0
- package/shouldRerender.js +27 -0
- package/showFileDialog.js +25 -0
- package/showGCContent.js +23 -0
- package/show_cut_sites.png +0 -0
- package/show_features.png +0 -0
- package/show_orfs.png +0 -0
- package/show_primers.png +0 -0
- package/simpleDialog.css +13 -0
- package/specialCutsiteFilterOptions.js +22 -0
- package/src/Editor/DropHandler.js +2 -1
- package/src/Editor/index.js +0 -2
- package/src/RowItem/StackedAnnotations/getStructuredBases.js +20 -6
- package/src/ToolBar/cutsiteTool.js +1 -1
- package/src/helperComponents/PropertiesDialog/TranslationProperties.js +2 -1
- package/style.css +3 -12100
- package/tagsToBoldSelector.js +2 -0
- package/toggle_views.svg +1 -0
- package/toolBar.js +23 -0
- package/translationSearchMatchesSelector.js +14 -0
- package/translations.js +20 -0
- package/translationsRawSelector.js +8 -0
- package/translationsSelector.js +137 -0
- package/typeField.js +24 -0
- package/undoTool.js +30 -0
- package/updateEditor.d.ts +1 -3
- package/updateEditor.js +200 -0
- package/updateLabelsForInViewFeatures.js +55 -0
- package/updateLabelsForInViewFeaturesCircView.js +41 -0
- package/updateTrackHelper.js +58 -0
- package/uppercaseSequenceMapFont.js +25 -0
- package/upsertDeleteActionGenerator.js +31 -0
- package/useAAColorType.js +8 -0
- package/useAdditionalOrfStartCodons.js +24 -0
- package/useAnnotationLimits.js +42 -0
- package/useChromatogramPrefs.js +31 -0
- package/useFormValue.js +7 -0
- package/useLadders.js +6 -0
- package/useMeltingTemp.js +7 -0
- package/useTmType.js +10 -0
- package/userDefinedHandlersAndOpts.js +61 -0
- package/utils/getAnnotationNameAndStartStopString.d.ts +1 -5
- package/utils/selectionLayer.d.ts +2 -2
- package/utils.js +37 -0
- package/versionHistory.js +26 -0
- package/versionHistoryTool.js +21 -0
- package/viewSubmenu.js +479 -0
- package/visibilityTool.js +39 -0
- package/withEditorInteractions/getBpsPerRow.d.ts +1 -3
- package/withHover.js +113 -0
- package/withRestrictionEnzymes.js +15 -0
- package/index.umd.js +0 -188322
package/alignments.js
ADDED
|
@@ -0,0 +1,379 @@
|
|
|
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
|
+
}
|
|
@@ -0,0 +1,24 @@
|
|
|
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
|
+
);
|
|
@@ -0,0 +1,35 @@
|
|
|
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];
|
|
@@ -0,0 +1,196 @@
|
|
|
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;
|