@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.
- package/CreateAnnotationsPage.d.ts +4 -3
- package/README.md +1 -1
- package/fileUtils.d.ts +12 -0
- package/html2canvas.esm--JN4fLQL.js +7891 -0
- package/html2canvas.esm-B7d7VJmQ.cjs +7891 -0
- package/index.cjs.js +1305 -1121
- package/index.es.js +1305 -1121
- package/index.umd.js +189161 -0
- package/ove.css +17 -4
- package/package.json +5 -9
- package/redux/findTool.d.ts +1 -0
- package/selectors/searchLayersSelector.d.ts +1 -1
- package/src/AutoAnnotate.js +1 -1
- package/src/CreateAnnotationsPage.js +1 -2
- package/src/Editor/style.css +8 -3
- package/src/FindBar/index.js +32 -1
- package/src/RowItem/SelectionLayer/index.js +42 -4
- package/src/RowItem/SelectionLayer/style.css +8 -0
- package/src/fileUtils.js +103 -0
- package/src/helperComponents/PropertiesDialog/TranslationProperties.js +1 -1
- package/src/redux/findTool.js +9 -0
- package/src/selectors/searchLayersSelector.js +40 -2
- package/style.css +12098 -1
- package/AASliver.js +0 -187
- package/AddLaddersDialog.js +0 -82
- package/AdditionalCutsiteInfoDialog.js +0 -599
- package/AlignmentVisibilityTool.js +0 -105
- package/AnnotationContainerHolder.js +0 -20
- package/AnnotationPositioner.js +0 -27
- package/AutoAnnotate.js +0 -501
- package/AutoAnnotateBpMatchingDialog.js +0 -208
- package/Axis.js +0 -151
- package/AxisNumbers.js +0 -35
- package/Browser.js +0 -106
- package/Caret.js +0 -63
- package/Chromatogram.js +0 -293
- package/CircularDnaSequence.js +0 -73
- package/CircularZoomMinimap.js +0 -16
- package/ColorPicker.js +0 -30
- package/CommandHotkeyHandler.js +0 -44
- package/CreateAnnotationsPage.js +0 -98
- package/Cutsite.js +0 -18
- package/CutsiteProperties.js +0 -176
- package/CutsiteSelectionLayers.js +0 -47
- package/Cutsites.js +0 -271
- package/DeletionLayer.js +0 -28
- package/DropHandler.css +0 -21
- package/DropHandler.js +0 -64
- package/EditCaretPosition.js +0 -234
- package/EditTrackNameDialog.js +0 -30
- package/Feature.js +0 -83
- package/FeatureProperties.js +0 -6
- package/FillWindow.js +0 -47
- package/GenbankView.js +0 -74
- package/GeneralProperties.js +0 -117
- package/GenericAnnotationProperties.js +0 -406
- package/GlobalDialog.js +0 -73
- package/GlobalDialogUtils.js +0 -110
- package/GoToDialog.js +0 -25
- package/HorizontalPanelDragHandle.js +0 -35
- package/Keyboard.js +0 -85
- package/Labels.js +0 -327
- package/Ladder.css +0 -20
- package/Ladder.js +0 -303
- package/MeltingTemp.js +0 -85
- package/Menlo.ttf +0 -0
- package/Minimap.js +0 -515
- package/Mismatches.js +0 -134
- package/Monaco.ttf +0 -0
- package/MultipleSeqsDetectedOnImportDialog.js +0 -74
- package/Orf.js +0 -109
- package/OrfProperties.js +0 -117
- package/Orfs.js +0 -35
- package/PCRTool.js +0 -179
- package/PairwiseAlignmentView.js +0 -68
- package/Part.js +0 -34
- package/PartProperties.js +0 -9
- package/PassThrough.js +0 -3
- package/PerformantSelectionLayer.js +0 -32
- package/PinchHelper.js +0 -24
- package/PointedAnnotation.js +0 -347
- package/PositionAnnotationOnCircle.js +0 -26
- package/Primer.js +0 -41
- package/PrimerProperties.js +0 -19
- package/ReflexContainer.js +0 -802
- package/ReflexElement.js +0 -160
- package/ReflexEvents.js +0 -77
- package/ReflexSplitter.js +0 -205
- package/RenameSequenceDialog.js +0 -7
- package/RotateCircularViewSlider.js +0 -93
- package/SelectDialog.js +0 -150
- package/SequenceName.js +0 -15
- package/SimpleCircularOrLinearView.js +0 -381
- package/SimpleOligoPreview.js +0 -39
- package/SingleEnzymeCutsiteInfo.js +0 -139
- package/ToolbarItem.js +0 -192
- package/Translation.js +0 -198
- package/TranslationProperties.js +0 -149
- package/UncontrolledSliderWithPlusMinusBtns.css +0 -5
- package/UncontrolledSliderWithPlusMinusBtns.js +0 -134
- package/VeTopRightContainer.js +0 -12
- package/ZoomCircularViewSlider.js +0 -62
- package/ZoomLinearView.js +0 -47
- package/addAlignment.js +0 -6
- package/addMetaToActionCreators.js +0 -12
- package/addWrappedAddons.js +0 -20
- package/alignmentTool.js +0 -503
- package/alignments.js +0 -379
- package/annotationLabelVisibility.js +0 -2
- package/annotationSearchSelector.js +0 -24
- package/annotationTypes.js +0 -35
- package/annotationVisibility.js +0 -196
- package/annotationsToSupport.js +0 -104
- package/arrayToObjWithIds.js +0 -17
- package/arrayUtils.js +0 -19
- package/array_move.js +0 -10
- package/calculateTickMarkPositionsForGivenRange.js +0 -47
- package/caretPosition.js +0 -27
- package/cdsFeaturesSelector.js +0 -9
- package/charWidth.js +0 -22
- package/circular.js +0 -19
- package/circularSelector.js +0 -4
- package/clickAndDragUtils.js +0 -576
- package/coerceInitialValue.js +0 -7
- package/combineReducersDontIgnoreKeys.js +0 -12
- package/commandUtils.js +0 -20
- package/constants.js +0 -2
- package/copyOptions.js +0 -34
- package/createFragmentLines.js +0 -120
- package/createMergedDefaultStateReducer.js +0 -30
- package/createMetaAction.js +0 -12
- package/createSequenceInputPopup.js +0 -290
- package/createSequenceInputPopupStyle.css +0 -87
- package/createSimpleDialog.js +0 -89
- package/createYourOwnEnzyme.js +0 -39
- package/cutsiteLabelColorSelector.js +0 -6
- package/cutsiteTool.js +0 -88
- package/cutsitesByRangeSelector.js +0 -5
- package/cutsitesSelector.js +0 -61
- package/darkmode.css +0 -98
- package/defaultConfig.js +0 -150
- package/deletionLayers.js +0 -36
- package/description.js +0 -21
- package/digestTool.js +0 -34
- package/dnaToColor.js +0 -17
- package/downloadTool.js +0 -39
- package/draggableClassnames.js +0 -5
- package/drawAnnotations.js +0 -440
- package/drawDirectedPiePiece.js +0 -142
- package/editTool.js +0 -49
- package/editorSelector.js +0 -2
- package/editorUtils.js +0 -205
- package/estimateRowHeight.js +0 -184
- package/featureLengthsToHide.js +0 -27
- package/featureTool.js +0 -34
- package/features.js +0 -19
- package/featuresSelector.js +0 -8
- package/filteredCutsitesSelector.js +0 -136
- package/filteredFeaturesSelector.js +0 -32
- package/filteredPartsSelector.js +0 -57
- package/filteredPrimersSelector.js +0 -27
- package/filteredRestrictionEnzymesSelector.js +0 -1
- package/find.png +0 -0
- package/findTool.js +0 -79
- package/findToolConstants.js +0 -1
- package/frameTranslations.js +0 -52
- package/fullscreen.png +0 -0
- package/getAdditionalEnzymesSelector.js +0 -46
- package/getAngleForPositionMidpoint.js +0 -3
- package/getAnnotationClassnames.js +0 -12
- package/getAnnotationNameAndStartStopString.js +0 -61
- package/getBpsPerRow.js +0 -19
- package/getCutsiteLabelHeights.js +0 -56
- package/getGapMap.js +0 -12
- package/getGaps.js +0 -27
- package/getInternalLabel.js +0 -40
- package/getOveHotkeyDefs.js +0 -12
- package/getPairwiseOverviewLinearViewOptions.js +0 -38
- package/getRangeAnglesSpecial.js +0 -12
- package/getStructuredBases.js +0 -97
- package/getTrackFromEvent.js +0 -25
- package/getVisibleStartEnd.js +0 -7
- package/getXStartAndWidthFromNonCircularRange.js +0 -12
- package/getXStartAndWidthOfRangeWrtRow.js +0 -27
- package/getXStartAndWidthOfRowAnnotation.js +0 -19
- package/getYOffset.js +0 -15
- package/hoveredAnnotation.js +0 -24
- package/importTool.js +0 -27
- package/index.js +0 -71
- package/inlineFindTool.js +0 -38
- package/isElementInViewport.js +0 -29
- package/isEnzymeFilterAndSelector.js +0 -1
- package/isTargetWithinEl.js +0 -6
- package/labelLineIntensity.js +0 -25
- package/labelSize.js +0 -23
- package/ladderDefaults.js +0 -25
- package/lastSavedId.js +0 -20
- package/lineageLines.js +0 -11
- package/linear.png +0 -0
- package/makeStore.js +0 -34
- package/massageTickSpacing.js +0 -19
- package/materiallyAvailable.js +0 -19
- package/middleware.js +0 -112
- package/minimumOrfSize.js +0 -24
- package/minimumOrfSizeSelector.js +0 -2
- package/modalActions.js +0 -3
- package/moveCaret.js +0 -58
- package/name.js +0 -19
- package/normalizeAngle.js +0 -3
- package/normalizeAngleRange.js +0 -9
- package/oligoTool.js +0 -30
- package/onlyUpdateForKeysDeep.js +0 -31
- package/orfFrameToColorMap.js +0 -10
- package/orfTool.js +0 -136
- package/orfsSelector.js +0 -15
- package/panelsShown.js +0 -294
- package/partLengthsToHide.js +0 -23
- package/partOverhangs.js +0 -6
- package/partTagSearch.js +0 -69
- package/partTool.js +0 -45
- package/parts.js +0 -19
- package/partsSelector.js +0 -8
- package/pie.png +0 -0
- package/polarToSpecialCartesian.js +0 -7
- package/positionCutsites.js +0 -6
- package/prepareRowData.js +0 -64
- package/primerBases.js +0 -221
- package/primerLengthsToHide.js +0 -27
- package/primers.js +0 -19
- package/primersSelector.js +0 -8
- package/print.png +0 -0
- package/printTool.js +0 -31
- package/propertiesTool.js +0 -40
- package/proteinUtils.js +0 -3
- package/pureNoFunc.js +0 -18
- package/readOnly.js +0 -25
- package/redoTool.js +0 -30
- package/reflex-styles.css +0 -128
- package/reflex-styles.css.map +0 -9
- package/relaxLabelAngles.js +0 -157
- package/relaxLabels_DEPRECATED.js +0 -105
- package/replacementLayers.js +0 -36
- package/restrictionEnzymes.js +0 -52
- package/restrictionEnzymesSelector.js +0 -34
- package/rowviewContants.js +0 -3
- package/ruler.css +0 -89
- package/save.png +0 -0
- package/saveTool.js +0 -44
- package/searchLayersSelector.js +0 -71
- package/selectedAnnotations.js +0 -89
- package/selectedAnnotationsSelector.js +0 -1
- package/selectedCutsitesSelector.js +0 -21
- package/selectedPartTags.js +0 -21
- package/selectionLayer.js +0 -25
- package/sequence.js +0 -12
- package/sequenceDataHistory.js +0 -43
- package/sequenceDataSelector.js +0 -2
- package/sequenceLengthSelector.js +0 -5
- package/sequenceSelector.js +0 -4
- package/sharedActionCreators.js +0 -0
- package/shouldFlipText.js +0 -4
- package/shouldRerender.js +0 -27
- package/showFileDialog.js +0 -25
- package/showGCContent.js +0 -23
- 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 +0 -13
- package/specialCutsiteFilterOptions.js +0 -22
- package/tagsToBoldSelector.js +0 -2
- package/toggle_views.svg +0 -1
- package/toolBar.js +0 -23
- package/translationSearchMatchesSelector.js +0 -14
- package/translations.js +0 -20
- package/translationsRawSelector.js +0 -8
- package/translationsSelector.js +0 -137
- package/typeField.js +0 -24
- package/undoTool.js +0 -30
- package/updateEditor.js +0 -200
- package/updateLabelsForInViewFeatures.js +0 -55
- package/updateLabelsForInViewFeaturesCircView.js +0 -41
- package/updateTrackHelper.js +0 -58
- package/uppercaseSequenceMapFont.js +0 -25
- package/upsertDeleteActionGenerator.js +0 -31
- package/useAAColorType.js +0 -8
- package/useAdditionalOrfStartCodons.js +0 -24
- package/useAnnotationLimits.js +0 -42
- package/useChromatogramPrefs.js +0 -31
- package/useFormValue.js +0 -7
- package/useLadders.js +0 -6
- package/useMeltingTemp.js +0 -7
- package/useTmType.js +0 -10
- package/userDefinedHandlersAndOpts.js +0 -61
- package/utils.js +0 -37
- package/versionHistory.js +0 -26
- package/versionHistoryTool.js +0 -21
- package/viewSubmenu.js +0 -479
- package/visibilityTool.js +0 -39
- package/withHover.js +0 -113
- package/withRestrictionEnzymes.js +0 -15
package/editorUtils.js
DELETED
|
@@ -1,205 +0,0 @@
|
|
|
1
|
-
import { getRangeLength, getSequenceWithinRange } from "@teselagen/range-utils";
|
|
2
|
-
import React from "react";
|
|
3
|
-
import { divideBy3 } from "./proteinUtils";
|
|
4
|
-
import {
|
|
5
|
-
getInsertBetweenVals,
|
|
6
|
-
calculatePercentGC,
|
|
7
|
-
aliasedEnzymesByName
|
|
8
|
-
} from "@teselagen/sequence-utils";
|
|
9
|
-
import { get, sortBy } from "lodash-es";
|
|
10
|
-
import VeWarning from "../helperComponents/VeWarning";
|
|
11
|
-
import { normalizePositionByRangeLength } from "@teselagen/range-utils";
|
|
12
|
-
import { filter } from "lodash-es";
|
|
13
|
-
|
|
14
|
-
export function getSelectionMessage({
|
|
15
|
-
caretPosition = -1,
|
|
16
|
-
selectionLayer = { start: -1, end: -1 },
|
|
17
|
-
customTitle,
|
|
18
|
-
sequenceLength,
|
|
19
|
-
sequenceData,
|
|
20
|
-
showGCContent, //these are only passed in for the status bar
|
|
21
|
-
GCDecimalDigits, //these are only passed in for the status bar
|
|
22
|
-
isProtein
|
|
23
|
-
}) {
|
|
24
|
-
let _selectionLayer = selectionLayer;
|
|
25
|
-
const isSelecting = selectionLayer.start > -1;
|
|
26
|
-
if (isSelecting) {
|
|
27
|
-
_selectionLayer = getSelFromWrappedAddon(selectionLayer, sequenceLength);
|
|
28
|
-
const length = getRangeLength(_selectionLayer, sequenceLength);
|
|
29
|
-
const GCContent = (numDecimalDigits = 0) =>
|
|
30
|
-
calculatePercentGC(
|
|
31
|
-
getSequenceWithinRange(_selectionLayer, sequenceData.sequence)
|
|
32
|
-
).toFixed(numDecimalDigits);
|
|
33
|
-
const seqLen = divideBy3(length, isProtein);
|
|
34
|
-
return `${customTitle || "Selecting"} ${seqLen} ${
|
|
35
|
-
(isProtein ? "AA" : "bp") + (seqLen === 1 ? "" : "s")
|
|
36
|
-
} from ${divideBy3(_selectionLayer.start, isProtein) + 1} to ${divideBy3(
|
|
37
|
-
_selectionLayer.end + 1,
|
|
38
|
-
isProtein
|
|
39
|
-
)}${
|
|
40
|
-
showGCContent && !isProtein ? ` (${GCContent(GCDecimalDigits)}% GC)` : ""
|
|
41
|
-
}`;
|
|
42
|
-
} else if (caretPosition > -1) {
|
|
43
|
-
const insertBetween = getInsertBetweenVals(
|
|
44
|
-
caretPosition,
|
|
45
|
-
_selectionLayer,
|
|
46
|
-
sequenceLength
|
|
47
|
-
);
|
|
48
|
-
return (
|
|
49
|
-
`Caret Between ` +
|
|
50
|
-
(isProtein
|
|
51
|
-
? `AAs ${divideBy3(insertBetween[0], true)} and ${divideBy3(
|
|
52
|
-
insertBetween[1] + 2,
|
|
53
|
-
true
|
|
54
|
-
)}`
|
|
55
|
-
: `Bases ${insertBetween[0]} and ${insertBetween[1]}`)
|
|
56
|
-
);
|
|
57
|
-
} else {
|
|
58
|
-
return "No Selection";
|
|
59
|
-
}
|
|
60
|
-
}
|
|
61
|
-
|
|
62
|
-
export function preventDefaultStopPropagation(e) {
|
|
63
|
-
if (e) {
|
|
64
|
-
e.stopPropagation();
|
|
65
|
-
e.preventDefault();
|
|
66
|
-
}
|
|
67
|
-
}
|
|
68
|
-
|
|
69
|
-
export function getNodeToRefocus(caretEl) {
|
|
70
|
-
let nodeToReFocus;
|
|
71
|
-
if (
|
|
72
|
-
caretEl &&
|
|
73
|
-
caretEl.closest &&
|
|
74
|
-
caretEl.closest(".veVectorInteractionWrapper")
|
|
75
|
-
) {
|
|
76
|
-
nodeToReFocus = caretEl.closest(".veVectorInteractionWrapper");
|
|
77
|
-
}
|
|
78
|
-
return nodeToReFocus;
|
|
79
|
-
}
|
|
80
|
-
|
|
81
|
-
export function getEmptyText({ sequenceData, caretPosition }) {
|
|
82
|
-
return sequenceData.sequence.length === 0 && caretPosition === -1 ? (
|
|
83
|
-
<div className="veEmptySeqText">Insert Sequence Here</div>
|
|
84
|
-
) : null;
|
|
85
|
-
}
|
|
86
|
-
|
|
87
|
-
export function tryToRefocusEditor() {
|
|
88
|
-
const ed = document.querySelector(".veVectorInteractionWrapper");
|
|
89
|
-
ed && ed.focus();
|
|
90
|
-
}
|
|
91
|
-
export function getCustomEnzymes() {
|
|
92
|
-
try {
|
|
93
|
-
const customEnzymes = JSON.parse(
|
|
94
|
-
window.localStorage.getItem("customEnzymes") || "{}"
|
|
95
|
-
);
|
|
96
|
-
return customEnzymes;
|
|
97
|
-
} catch (error) {
|
|
98
|
-
return {};
|
|
99
|
-
}
|
|
100
|
-
}
|
|
101
|
-
export function addCustomEnzyme(newEnz) {
|
|
102
|
-
const customEnzymes = getCustomEnzymes();
|
|
103
|
-
window.localStorage.setItem(
|
|
104
|
-
"customEnzymes",
|
|
105
|
-
JSON.stringify({
|
|
106
|
-
...customEnzymes,
|
|
107
|
-
[newEnz.name.toLowerCase()]: newEnz
|
|
108
|
-
})
|
|
109
|
-
);
|
|
110
|
-
}
|
|
111
|
-
|
|
112
|
-
export function pareDownAnnotations(annotations, max) {
|
|
113
|
-
let annotationsToPass = annotations;
|
|
114
|
-
let paredDown = false;
|
|
115
|
-
if (Object.keys(annotations).length > max) {
|
|
116
|
-
paredDown = true;
|
|
117
|
-
const sortedAnnotations = sortBy(annotations, function (annotation) {
|
|
118
|
-
return -getRangeLength(annotation);
|
|
119
|
-
});
|
|
120
|
-
annotationsToPass = sortedAnnotations.slice(0, max).reduce(function (
|
|
121
|
-
obj,
|
|
122
|
-
item
|
|
123
|
-
) {
|
|
124
|
-
obj[item.id] = item;
|
|
125
|
-
return obj;
|
|
126
|
-
}, {});
|
|
127
|
-
}
|
|
128
|
-
return [annotationsToPass, paredDown];
|
|
129
|
-
}
|
|
130
|
-
export function getParedDownWarning({ nameUpper, maxToShow, isAdjustable }) {
|
|
131
|
-
return (
|
|
132
|
-
<VeWarning
|
|
133
|
-
key={`ve-warning-max${nameUpper}ToDisplay`}
|
|
134
|
-
data-test={`ve-warning-max${nameUpper}ToDisplay`}
|
|
135
|
-
tooltip={`Warning: More than ${maxToShow} ${
|
|
136
|
-
nameUpper === "Cutsites" ? "Cut Sites" : nameUpper
|
|
137
|
-
}. Only displaying ${maxToShow} ${
|
|
138
|
-
isAdjustable ? "(Configure this under View > Limits)" : ""
|
|
139
|
-
} `}
|
|
140
|
-
/>
|
|
141
|
-
);
|
|
142
|
-
}
|
|
143
|
-
|
|
144
|
-
export function getClientX(event) {
|
|
145
|
-
return event.clientX || get(event, "touches[0].clientX");
|
|
146
|
-
}
|
|
147
|
-
export function getClientY(event) {
|
|
148
|
-
return event.clientY || get(event, "touches[0].clientY");
|
|
149
|
-
}
|
|
150
|
-
|
|
151
|
-
export function hideAnnByLengthFilter(hideOpts, ann, seqLen) {
|
|
152
|
-
const featLength = getRangeLength(ann, seqLen);
|
|
153
|
-
return (
|
|
154
|
-
hideOpts.enabled && (featLength < hideOpts.min || featLength > hideOpts.max)
|
|
155
|
-
);
|
|
156
|
-
}
|
|
157
|
-
|
|
158
|
-
export function getSelFromWrappedAddon(selectionLayer, sequenceLength) {
|
|
159
|
-
const selToUse = {
|
|
160
|
-
...selectionLayer
|
|
161
|
-
};
|
|
162
|
-
if (selectionLayer.isWrappedAddon) {
|
|
163
|
-
const oldEnd = selToUse.end;
|
|
164
|
-
selToUse.end = normalizePositionByRangeLength(
|
|
165
|
-
selToUse.start - 1,
|
|
166
|
-
sequenceLength
|
|
167
|
-
);
|
|
168
|
-
selToUse.start = normalizePositionByRangeLength(oldEnd + 1, sequenceLength);
|
|
169
|
-
delete selToUse.isWrappedAddon;
|
|
170
|
-
}
|
|
171
|
-
return selToUse;
|
|
172
|
-
}
|
|
173
|
-
|
|
174
|
-
export function getStripedPattern({ color, id }) {
|
|
175
|
-
return (
|
|
176
|
-
<pattern
|
|
177
|
-
id={`diagonalHatch-${id}`}
|
|
178
|
-
patternUnits="userSpaceOnUse"
|
|
179
|
-
width="4"
|
|
180
|
-
height="4"
|
|
181
|
-
>
|
|
182
|
-
<path
|
|
183
|
-
d="M-1,1 l2,-2
|
|
184
|
-
M0,4 l4,-4
|
|
185
|
-
M3,5 l2,-2"
|
|
186
|
-
style={{
|
|
187
|
-
stroke: color,
|
|
188
|
-
strokeWidth: 2,
|
|
189
|
-
fill: "blue",
|
|
190
|
-
opacity: 0.4
|
|
191
|
-
}}
|
|
192
|
-
/>
|
|
193
|
-
</pattern>
|
|
194
|
-
);
|
|
195
|
-
}
|
|
196
|
-
export const getEnzymeAliases = enzyme => {
|
|
197
|
-
let lowerName = (enzyme.name && enzyme.name.toLowerCase()) || "";
|
|
198
|
-
if (typeof enzyme === "string") {
|
|
199
|
-
lowerName = enzyme.toLowerCase();
|
|
200
|
-
}
|
|
201
|
-
return filter(
|
|
202
|
-
(aliasedEnzymesByName[lowerName] || {}).aliases,
|
|
203
|
-
n => n.toLowerCase() !== lowerName //filter out current enzyme
|
|
204
|
-
);
|
|
205
|
-
};
|
package/estimateRowHeight.js
DELETED
|
@@ -1,184 +0,0 @@
|
|
|
1
|
-
import { forEach } from "lodash-es";
|
|
2
|
-
|
|
3
|
-
const debug = 0;
|
|
4
|
-
// const debug = console.log("comment me back out!") || 1;
|
|
5
|
-
|
|
6
|
-
export const rowHeights = {
|
|
7
|
-
rowJumpButtons: { height: 30 },
|
|
8
|
-
spacer: { height: 10 },
|
|
9
|
-
aminoAcidNumbers: { height: 9 },
|
|
10
|
-
translations: { spaceBetweenAnnotations: 2, marginTop: 5, height: 17 },
|
|
11
|
-
chromatogram: { height: 134 },
|
|
12
|
-
parts: { spaceBetweenAnnotations: 2, marginTop: 5, height: 15 },
|
|
13
|
-
primers: { spaceBetweenAnnotations: 2, marginTop: 5, height: 18 },
|
|
14
|
-
features: { spaceBetweenAnnotations: 2, marginTop: 5, height: 15 },
|
|
15
|
-
warnings: { spaceBetweenAnnotations: 2, marginTop: 5, height: 15 },
|
|
16
|
-
assemblyPieces: { spaceBetweenAnnotations: 2, marginTop: 5, height: 15 },
|
|
17
|
-
lineageAnnotations: { spaceBetweenAnnotations: 2, marginTop: 5, height: 15 },
|
|
18
|
-
orfs: { spaceBetweenAnnotations: 2, marginTop: 5, height: 15 },
|
|
19
|
-
//tnrtodo -- we should estimate external label height for parts/features/primers
|
|
20
|
-
cutsiteLabels: { spaceBetweenAnnotations: 0, height: 15 },
|
|
21
|
-
sequence: { height: 15 },
|
|
22
|
-
reverseSequence: { height: 15 },
|
|
23
|
-
axis: { marginTop: 5, height: 15 }
|
|
24
|
-
};
|
|
25
|
-
|
|
26
|
-
rowHeights.primaryProteinSequence = rowHeights.translations;
|
|
27
|
-
|
|
28
|
-
Object.keys(rowHeights).forEach(k => {
|
|
29
|
-
rowHeights[k].type = k;
|
|
30
|
-
rowHeights[k].marginTop = rowHeights[k].marginTop || 0;
|
|
31
|
-
rowHeights[k].marginBottom = rowHeights[k].marginBottom || 0;
|
|
32
|
-
rowHeights[k].spaceBetweenAnnotations =
|
|
33
|
-
rowHeights[k].spaceBetweenAnnotations || 0;
|
|
34
|
-
});
|
|
35
|
-
const translations = {
|
|
36
|
-
getHeight: props => {
|
|
37
|
-
if (props.annotationVisibility.aminoAcidNumbers) {
|
|
38
|
-
return [rowHeights.aminoAcidNumbers.type, rowHeights.translations.type];
|
|
39
|
-
}
|
|
40
|
-
return rowHeights.translations.type;
|
|
41
|
-
},
|
|
42
|
-
hasYOffset: true
|
|
43
|
-
};
|
|
44
|
-
|
|
45
|
-
const annotationsToCompute = {
|
|
46
|
-
spacer: {
|
|
47
|
-
alwaysVisible: true,
|
|
48
|
-
height: rowHeights.spacer.type
|
|
49
|
-
},
|
|
50
|
-
primaryProteinSequence: translations,
|
|
51
|
-
translations,
|
|
52
|
-
parts: {
|
|
53
|
-
height: rowHeights.parts.type,
|
|
54
|
-
hasYOffset: true
|
|
55
|
-
},
|
|
56
|
-
primers: {
|
|
57
|
-
height: rowHeights.primers.type,
|
|
58
|
-
hasYOffset: true
|
|
59
|
-
},
|
|
60
|
-
features: {
|
|
61
|
-
height: rowHeights.features.type,
|
|
62
|
-
hasYOffset: true
|
|
63
|
-
},
|
|
64
|
-
chromatogram: {
|
|
65
|
-
height: rowHeights.chromatogram.type
|
|
66
|
-
},
|
|
67
|
-
warnings: {
|
|
68
|
-
height: rowHeights.warnings.type,
|
|
69
|
-
hasYOffset: true
|
|
70
|
-
},
|
|
71
|
-
orfs: {
|
|
72
|
-
height: rowHeights.orfs.type,
|
|
73
|
-
hasYOffset: true
|
|
74
|
-
},
|
|
75
|
-
sequence: {
|
|
76
|
-
height: rowHeights.sequence.type
|
|
77
|
-
},
|
|
78
|
-
reverseSequence: {
|
|
79
|
-
height: rowHeights.reverseSequence.type
|
|
80
|
-
},
|
|
81
|
-
axis: {
|
|
82
|
-
height: rowHeights.axis.type
|
|
83
|
-
},
|
|
84
|
-
cutsiteLabels: {
|
|
85
|
-
typeOverride: "cutsites",
|
|
86
|
-
height: rowHeights.cutsiteLabels.type,
|
|
87
|
-
hasYOffset: true
|
|
88
|
-
}
|
|
89
|
-
};
|
|
90
|
-
|
|
91
|
-
export default props => {
|
|
92
|
-
let {
|
|
93
|
-
index,
|
|
94
|
-
cache,
|
|
95
|
-
clearCache,
|
|
96
|
-
chromatogramData,
|
|
97
|
-
rowCount,
|
|
98
|
-
row,
|
|
99
|
-
showJumpButtons,
|
|
100
|
-
annotationVisibility
|
|
101
|
-
} = props;
|
|
102
|
-
if (clearCache) {
|
|
103
|
-
cache = {};
|
|
104
|
-
}
|
|
105
|
-
|
|
106
|
-
if (cache[index]) {
|
|
107
|
-
return cache[index];
|
|
108
|
-
}
|
|
109
|
-
if (!row) return 0;
|
|
110
|
-
let totalHeight = 0; //account for spacer
|
|
111
|
-
if (showJumpButtons && (index === 0 || index === rowCount - 1)) {
|
|
112
|
-
totalHeight += rowHeights.rowJumpButtons.height;
|
|
113
|
-
}
|
|
114
|
-
forEach(
|
|
115
|
-
annotationsToCompute,
|
|
116
|
-
(
|
|
117
|
-
{ height: _height, alwaysVisible, getHeight, hasYOffset, typeOverride },
|
|
118
|
-
key
|
|
119
|
-
) => {
|
|
120
|
-
const shouldShow =
|
|
121
|
-
alwaysVisible || annotationVisibility[typeOverride || key];
|
|
122
|
-
if (!shouldShow) return;
|
|
123
|
-
if (key === "chromatogram" && !chromatogramData) return;
|
|
124
|
-
const heightKeys = getHeight ? getHeight(props) : _height;
|
|
125
|
-
const [annotationHeight, marginHeight] = getSummedHeights(
|
|
126
|
-
heightKeys,
|
|
127
|
-
props
|
|
128
|
-
);
|
|
129
|
-
|
|
130
|
-
let heightToAdd = annotationHeight;
|
|
131
|
-
if (hasYOffset) {
|
|
132
|
-
const annotations = row[typeOverride || key];
|
|
133
|
-
if (hasYOffset) {
|
|
134
|
-
let maxYOffset = 0;
|
|
135
|
-
annotations &&
|
|
136
|
-
annotations.forEach(a => {
|
|
137
|
-
if (a.yOffset + 1 > maxYOffset) maxYOffset = a.yOffset + 1;
|
|
138
|
-
});
|
|
139
|
-
heightToAdd = maxYOffset * annotationHeight;
|
|
140
|
-
}
|
|
141
|
-
}
|
|
142
|
-
if (heightToAdd > 0) heightToAdd += marginHeight;
|
|
143
|
-
|
|
144
|
-
if (debug) {
|
|
145
|
-
heightToAdd !== 0 &&
|
|
146
|
-
console.info(`heightToAdd, key:`, heightToAdd, key);
|
|
147
|
-
}
|
|
148
|
-
totalHeight += heightToAdd;
|
|
149
|
-
}
|
|
150
|
-
);
|
|
151
|
-
if (debug) {
|
|
152
|
-
console.info(`totalHeight:`, totalHeight);
|
|
153
|
-
}
|
|
154
|
-
if (annotationVisibility.compactNames) {
|
|
155
|
-
totalHeight = Math.max(totalHeight, 31);
|
|
156
|
-
}
|
|
157
|
-
cache[index] = totalHeight;
|
|
158
|
-
return totalHeight;
|
|
159
|
-
};
|
|
160
|
-
|
|
161
|
-
function getHeights(heightKey, props) {
|
|
162
|
-
const annotationHeight = !heightKey
|
|
163
|
-
? 0
|
|
164
|
-
: props[heightKey + "Height"] || (rowHeights[heightKey] || {}).height || 0;
|
|
165
|
-
|
|
166
|
-
const marginHeight =
|
|
167
|
-
(props[heightKey + "MarginTop"] ||
|
|
168
|
-
(rowHeights[heightKey] || {}).marginTop ||
|
|
169
|
-
0) +
|
|
170
|
-
(props[heightKey + "MarginBottom"] ||
|
|
171
|
-
(rowHeights[heightKey] || {}).marginBottom ||
|
|
172
|
-
0);
|
|
173
|
-
return [annotationHeight, marginHeight];
|
|
174
|
-
}
|
|
175
|
-
function getSummedHeights(heightKeys, props) {
|
|
176
|
-
let height = 0;
|
|
177
|
-
let marginHeight = 0;
|
|
178
|
-
(Array.isArray(heightKeys) ? heightKeys : [heightKeys]).forEach(k => {
|
|
179
|
-
const [h, m] = getHeights(k, props);
|
|
180
|
-
height += h;
|
|
181
|
-
marginHeight += m;
|
|
182
|
-
});
|
|
183
|
-
return [height, marginHeight];
|
|
184
|
-
}
|
package/featureLengthsToHide.js
DELETED
|
@@ -1,27 +0,0 @@
|
|
|
1
|
-
import createMergedDefaultStateReducer from "./utils/createMergedDefaultStateReducer";
|
|
2
|
-
import createAction from "./utils/createMetaAction";
|
|
3
|
-
|
|
4
|
-
// ------------------------------------
|
|
5
|
-
// Actions
|
|
6
|
-
// ------------------------------------
|
|
7
|
-
export const updateFeatureLengthsToHide = createAction(
|
|
8
|
-
"updateFeatureLengthsToHide"
|
|
9
|
-
);
|
|
10
|
-
export const toggleFeatureLengthsToHide = createAction(
|
|
11
|
-
"toggleFeatureLengthsToHide"
|
|
12
|
-
);
|
|
13
|
-
|
|
14
|
-
// ------------------------------------
|
|
15
|
-
// Reducer
|
|
16
|
-
// ------------------------------------
|
|
17
|
-
export default createMergedDefaultStateReducer(
|
|
18
|
-
{
|
|
19
|
-
[updateFeatureLengthsToHide]: (state, payload) => {
|
|
20
|
-
return { ...state, ...payload };
|
|
21
|
-
},
|
|
22
|
-
[toggleFeatureLengthsToHide]: state => {
|
|
23
|
-
return { ...state, enabled: !state["enabled"] };
|
|
24
|
-
}
|
|
25
|
-
},
|
|
26
|
-
{ enabled: false, min: 0, max: 800 }
|
|
27
|
-
);
|
package/featureTool.js
DELETED
|
@@ -1,34 +0,0 @@
|
|
|
1
|
-
import { Icon } from "@blueprintjs/core";
|
|
2
|
-
// import { Checkbox, Button } from "@blueprintjs/core";
|
|
3
|
-
import React from "react";
|
|
4
|
-
// import { connect } from "react-redux";
|
|
5
|
-
// import { convertRangeTo1Based } from "@teselagen/range-utils";
|
|
6
|
-
import { featureIcon } from "@teselagen/ui";
|
|
7
|
-
import ToolbarItem from "./ToolbarItem";
|
|
8
|
-
import { connectToEditor } from "../withEditorProps";
|
|
9
|
-
|
|
10
|
-
export default connectToEditor(
|
|
11
|
-
({ annotationVisibility = {}, toolBar = {} }) => {
|
|
12
|
-
return {
|
|
13
|
-
toggled: annotationVisibility.features,
|
|
14
|
-
isOpen: toolBar.openItem === "featureTool"
|
|
15
|
-
};
|
|
16
|
-
}
|
|
17
|
-
)(({ toolbarItemProps, toggled, annotationVisibilityToggle, isOpen }) => {
|
|
18
|
-
return (
|
|
19
|
-
<ToolbarItem
|
|
20
|
-
{...{
|
|
21
|
-
Icon: <Icon icon={featureIcon} />,
|
|
22
|
-
onIconClick: function () {
|
|
23
|
-
annotationVisibilityToggle("features");
|
|
24
|
-
},
|
|
25
|
-
toggled,
|
|
26
|
-
tooltip: "Show features",
|
|
27
|
-
tooltipToggled: "Hide features",
|
|
28
|
-
// Dropdown: ConnectedFeatureToolDropdown,
|
|
29
|
-
dropdowntooltip: (!isOpen ? "Show" : "Hide") + " Feature Options",
|
|
30
|
-
...toolbarItemProps
|
|
31
|
-
}}
|
|
32
|
-
/>
|
|
33
|
-
);
|
|
34
|
-
});
|
package/features.js
DELETED
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
import { createReducer } from "redux-act";
|
|
2
|
-
import createAction from "../utils/createMetaAction";
|
|
3
|
-
import upsertDeleteActionGenerator from "./upsertDeleteActionGenerator";
|
|
4
|
-
|
|
5
|
-
// ------------------------------------
|
|
6
|
-
// Actions
|
|
7
|
-
// ------------------------------------
|
|
8
|
-
export const upsertFeature = createAction("UPSERT_FEATURE");
|
|
9
|
-
export const deleteFeature = createAction("DELETE_FEATURE");
|
|
10
|
-
|
|
11
|
-
// ------------------------------------
|
|
12
|
-
// Reducer
|
|
13
|
-
// ------------------------------------
|
|
14
|
-
export default createReducer(
|
|
15
|
-
{
|
|
16
|
-
...upsertDeleteActionGenerator(upsertFeature, deleteFeature)
|
|
17
|
-
},
|
|
18
|
-
{}
|
|
19
|
-
);
|
package/featuresSelector.js
DELETED
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
import { createSelector } from "reselect";
|
|
2
|
-
import sequenceDataSelector from "./sequenceDataSelector";
|
|
3
|
-
|
|
4
|
-
function featuresRawSelector(sequenceData) {
|
|
5
|
-
return sequenceData.features;
|
|
6
|
-
}
|
|
7
|
-
|
|
8
|
-
export default createSelector(sequenceDataSelector, featuresRawSelector);
|
|
@@ -1,136 +0,0 @@
|
|
|
1
|
-
import flatmap from "lodash/flatMap";
|
|
2
|
-
import { createSelector } from "reselect";
|
|
3
|
-
import cutsitesSelector from "./cutsitesSelector";
|
|
4
|
-
import filteredRestrictionEnzymesSelector from "./filteredRestrictionEnzymesSelector";
|
|
5
|
-
import specialCutsiteFilterOptions from "../constants/specialCutsiteFilterOptions";
|
|
6
|
-
import { flatMap } from "lodash-es";
|
|
7
|
-
import isEnzymeFilterAndSelector from "./isEnzymeFilterAndSelector";
|
|
8
|
-
|
|
9
|
-
export default createSelector(
|
|
10
|
-
cutsitesSelector,
|
|
11
|
-
filteredRestrictionEnzymesSelector,
|
|
12
|
-
isEnzymeFilterAndSelector,
|
|
13
|
-
(state, addEnzs, enzymeGroupsOverride) => enzymeGroupsOverride,
|
|
14
|
-
function (
|
|
15
|
-
{ cutsitesByName },
|
|
16
|
-
filteredRestrictionEnzymes,
|
|
17
|
-
isEnzymeFilterAnd,
|
|
18
|
-
enzymeGroupsOverride
|
|
19
|
-
) {
|
|
20
|
-
const returnVal = {
|
|
21
|
-
cutsitesByName: {}
|
|
22
|
-
};
|
|
23
|
-
// const cutsitesByName = getLowerCaseObj(cutsitesByName);
|
|
24
|
-
const hiddenEnzymesByName = {};
|
|
25
|
-
let filteredEnzymes = [];
|
|
26
|
-
let enzymesFromGroups = [];
|
|
27
|
-
let hasUserGroup;
|
|
28
|
-
let groupCount = 0;
|
|
29
|
-
//handle adding enzymes that are included in user created groups
|
|
30
|
-
filteredRestrictionEnzymes.forEach(e => {
|
|
31
|
-
if (e.value.includes("__userCreatedGroup")) {
|
|
32
|
-
hasUserGroup = true;
|
|
33
|
-
const existingGroups = {
|
|
34
|
-
...window.getExistingEnzymeGroups(),
|
|
35
|
-
...enzymeGroupsOverride
|
|
36
|
-
};
|
|
37
|
-
const enzymes =
|
|
38
|
-
existingGroups[e.value.replace("__userCreatedGroup", "")] || [];
|
|
39
|
-
const zs = flatMap(enzymes, e => (e ? { value: e } : []));
|
|
40
|
-
filteredEnzymes = filteredEnzymes.concat(zs);
|
|
41
|
-
enzymesFromGroups = enzymesFromGroups.concat(zs);
|
|
42
|
-
groupCount += 1;
|
|
43
|
-
} else if (e.isHidden) {
|
|
44
|
-
hiddenEnzymesByName[e.value] = e;
|
|
45
|
-
} else {
|
|
46
|
-
if (!e) return;
|
|
47
|
-
groupCount += 1;
|
|
48
|
-
filteredEnzymes.push(e);
|
|
49
|
-
}
|
|
50
|
-
});
|
|
51
|
-
const cutSiteList = [];
|
|
52
|
-
if (!filteredEnzymes || (filteredEnzymes.length === 0 && !hasUserGroup)) {
|
|
53
|
-
returnVal.cutsitesByName = cutsitesByName;
|
|
54
|
-
} else {
|
|
55
|
-
//loop through each filter option ('Single Cutters', 'BamHI')
|
|
56
|
-
filteredEnzymes.forEach(function ({ value, ...rest }) {
|
|
57
|
-
if (!value) {
|
|
58
|
-
console.error(`Missing value for filtered enzyme`, rest);
|
|
59
|
-
return;
|
|
60
|
-
}
|
|
61
|
-
const lowerValue = value.toLowerCase();
|
|
62
|
-
const cutsThisManyTimes =
|
|
63
|
-
specialCutsiteFilterOptions[value] &&
|
|
64
|
-
specialCutsiteFilterOptions[value].cutsThisManyTimes;
|
|
65
|
-
if (value === "type2s") {
|
|
66
|
-
Object.keys(cutsitesByName).forEach(function (key) {
|
|
67
|
-
if (hiddenEnzymesByName[key]) return; //don't show that cutsite
|
|
68
|
-
if (
|
|
69
|
-
cutsitesByName[key].length &&
|
|
70
|
-
cutsitesByName[key][0]?.restrictionEnzyme?.isType2S
|
|
71
|
-
) {
|
|
72
|
-
cutSiteList.push(key);
|
|
73
|
-
returnVal.cutsitesByName[key] = cutsitesByName[key];
|
|
74
|
-
}
|
|
75
|
-
});
|
|
76
|
-
} else if (cutsThisManyTimes > 0) {
|
|
77
|
-
//the cutter type is either 1,2,3 for single, double or triple cutters
|
|
78
|
-
Object.keys(cutsitesByName).forEach(function (key) {
|
|
79
|
-
if (hiddenEnzymesByName[key]) return; //don't show that cutsite
|
|
80
|
-
if (cutsitesByName[key].length === cutsThisManyTimes) {
|
|
81
|
-
cutSiteList.push(key);
|
|
82
|
-
returnVal.cutsitesByName[key] = cutsitesByName[key];
|
|
83
|
-
}
|
|
84
|
-
});
|
|
85
|
-
} else {
|
|
86
|
-
if (hiddenEnzymesByName[lowerValue]) return; //don't show that cutsite
|
|
87
|
-
//normal enzyme ('BamHI')
|
|
88
|
-
if (!cutsitesByName[lowerValue]) return;
|
|
89
|
-
cutSiteList.push(lowerValue);
|
|
90
|
-
returnVal.cutsitesByName[lowerValue] = cutsitesByName[lowerValue];
|
|
91
|
-
}
|
|
92
|
-
});
|
|
93
|
-
}
|
|
94
|
-
|
|
95
|
-
const enzymeCounts = {};
|
|
96
|
-
cutSiteList.forEach(
|
|
97
|
-
enzyme =>
|
|
98
|
-
(enzymeCounts[enzyme] = enzymeCounts[enzyme]
|
|
99
|
-
? enzymeCounts[enzyme] + 1
|
|
100
|
-
: 1)
|
|
101
|
-
);
|
|
102
|
-
|
|
103
|
-
const intersectionCutSites = [];
|
|
104
|
-
Object.keys(enzymeCounts).forEach(key => {
|
|
105
|
-
if (enzymeCounts[key] === groupCount) intersectionCutSites.push(key);
|
|
106
|
-
});
|
|
107
|
-
|
|
108
|
-
returnVal.cutsiteIntersectionCount = intersectionCutSites.length;
|
|
109
|
-
|
|
110
|
-
const cutsbyname_AND = {};
|
|
111
|
-
intersectionCutSites.forEach(value => {
|
|
112
|
-
cutsbyname_AND[value] = cutsitesByName[value];
|
|
113
|
-
});
|
|
114
|
-
|
|
115
|
-
returnVal.cutsiteTotalCount = Object.keys(returnVal.cutsitesByName).length;
|
|
116
|
-
|
|
117
|
-
if (isEnzymeFilterAnd && returnVal.cutsiteIntersectionCount > 0) {
|
|
118
|
-
returnVal.cutsitesByName = cutsbyname_AND;
|
|
119
|
-
}
|
|
120
|
-
|
|
121
|
-
returnVal.cutsitesArray = flatmap(
|
|
122
|
-
returnVal.cutsitesByName,
|
|
123
|
-
cutsitesByNameArray => cutsitesByNameArray
|
|
124
|
-
);
|
|
125
|
-
returnVal.cutsitesById = returnVal.cutsitesArray.reduce(function (
|
|
126
|
-
obj,
|
|
127
|
-
item
|
|
128
|
-
) {
|
|
129
|
-
if (item && item.id) {
|
|
130
|
-
obj[item.id] = item;
|
|
131
|
-
}
|
|
132
|
-
return obj;
|
|
133
|
-
}, {});
|
|
134
|
-
return returnVal;
|
|
135
|
-
}
|
|
136
|
-
);
|
|
@@ -1,32 +0,0 @@
|
|
|
1
|
-
import { createSelector } from "reselect";
|
|
2
|
-
import { omitBy } from "lodash-es";
|
|
3
|
-
import featuresSelector from "./featuresSelector";
|
|
4
|
-
import sequenceLengthSelector from "./sequenceLengthSelector";
|
|
5
|
-
import { hideAnnByLengthFilter } from "../utils/editorUtils";
|
|
6
|
-
|
|
7
|
-
function filteredFeaturesSelector(
|
|
8
|
-
features,
|
|
9
|
-
seqLen,
|
|
10
|
-
featureIndividualToHide,
|
|
11
|
-
featureTypesToHide,
|
|
12
|
-
lengthsToHide
|
|
13
|
-
) {
|
|
14
|
-
return omitBy(features, ann => {
|
|
15
|
-
const hideIndividually = featureIndividualToHide[ann.id];
|
|
16
|
-
const hideFeaturesByType = featureTypesToHide[ann.type];
|
|
17
|
-
return (
|
|
18
|
-
hideAnnByLengthFilter(lengthsToHide, ann, seqLen) ||
|
|
19
|
-
hideFeaturesByType ||
|
|
20
|
-
hideIndividually
|
|
21
|
-
);
|
|
22
|
-
});
|
|
23
|
-
}
|
|
24
|
-
|
|
25
|
-
export default createSelector(
|
|
26
|
-
featuresSelector,
|
|
27
|
-
sequenceLengthSelector,
|
|
28
|
-
state => state.annotationVisibility.featureIndividualToHide,
|
|
29
|
-
state => state.annotationVisibility.featureTypesToHide,
|
|
30
|
-
state => state.featureLengthsToHide,
|
|
31
|
-
filteredFeaturesSelector
|
|
32
|
-
);
|