@teselagen/ove 0.0.14 → 0.0.15
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/index.umd.js +164777 -135861
- package/package.json +78 -2
- package/src/AlignmentTool/index.js +16 -0
- package/src/AlignmentView/AlignmentVisibilityTool.js +105 -0
- package/src/AlignmentView/EditTrackNameDialog.js +34 -0
- package/src/AlignmentView/HorizontalPanelDragHandle.js +35 -0
- package/src/AlignmentView/Minimap.js +520 -0
- package/src/AlignmentView/Mismatches.js +134 -0
- package/src/AlignmentView/PairwiseAlignmentView.js +68 -0
- package/src/AlignmentView/PerformantSelectionLayer.js +32 -0
- package/src/AlignmentView/coerceInitialValue.js +7 -0
- package/src/AlignmentView/getGapMap.js +12 -0
- package/src/AlignmentView/getGaps.js +27 -0
- package/src/AlignmentView/getPairwiseOverviewLinearViewOptions.js +38 -0
- package/src/AlignmentView/getTrackFromEvent.js +25 -0
- package/src/AlignmentView/index.js +2058 -0
- package/src/AlignmentView/isTargetWithinEl.js +6 -0
- package/src/AlignmentView/style.css +100 -0
- package/src/AlignmentView/updateTrackHelper.js +58 -0
- package/src/AutoAnnotate.js +500 -0
- package/src/AutoAnnotateBpMatchingDialog.js +208 -0
- package/src/CircularView/Axis.js +40 -0
- package/src/CircularView/AxisNumbers.js +35 -0
- package/src/CircularView/Caret.js +63 -0
- package/src/CircularView/CircularDnaSequence.js +73 -0
- package/src/CircularView/CircularZoomMinimap.js +16 -0
- package/src/CircularView/Cutsite.js +18 -0
- package/src/CircularView/Cutsites.js +113 -0
- package/src/CircularView/DeletionLayer.js +28 -0
- package/src/CircularView/Feature.js +83 -0
- package/src/CircularView/Labels/index.js +536 -0
- package/src/CircularView/Labels/relaxLabelAngles.js +157 -0
- package/src/CircularView/Labels/relaxLabels_DEPRECATED.js +105 -0
- package/src/CircularView/Labels/style.css +55 -0
- package/src/CircularView/Orf.js +25 -0
- package/src/CircularView/Part.js +34 -0
- package/src/CircularView/PositionAnnotationOnCircle.js +26 -0
- package/src/CircularView/Primer.js +41 -0
- package/src/CircularView/RotateCircularViewSlider.js +82 -0
- package/src/CircularView/SelectionLayer.js +132 -0
- package/src/CircularView/VeTopRightContainer.js +12 -0
- package/src/CircularView/ZoomCircularViewSlider.js +62 -0
- package/src/CircularView/drawAnnotations.js +433 -0
- package/src/CircularView/drawDirectedPiePiece.js +142 -0
- package/src/CircularView/getAngleForPositionMidpoint.js +3 -0
- package/src/CircularView/getInternalLabel.js +40 -0
- package/src/CircularView/getRangeAnglesSpecial.js +12 -0
- package/src/CircularView/getYOffset.js +15 -0
- package/src/CircularView/index.d.ts +20 -0
- package/src/CircularView/index.js +930 -0
- package/src/CircularView/normalizeAngle.js +3 -0
- package/src/CircularView/normalizeAngleRange.js +9 -0
- package/src/CircularView/positionCutsites.js +6 -0
- package/src/CircularView/shouldFlipText.js +4 -0
- package/src/CircularView/style.css +47 -0
- package/src/CircularView/utils/polarToSpecialCartesian.js +7 -0
- package/src/CreateAnnotationsPage.js +96 -0
- package/src/CreateCustomEnzyme/index.js +337 -0
- package/src/CreateCustomEnzyme/style.css +100 -0
- package/src/CutsiteFilter/AdditionalCutsiteInfoDialog.js +599 -0
- package/src/CutsiteFilter/index.js +408 -0
- package/src/CutsiteFilter/style.css +23 -0
- package/src/CutsiteFilter/withRestrictionEnzymes.js +15 -0
- package/src/DigestTool/AddLaddersDialog.js +82 -0
- package/src/DigestTool/DigestTool.js +223 -0
- package/src/DigestTool/Ladder.css +20 -0
- package/src/DigestTool/Ladder.js +303 -0
- package/src/DigestTool/createFragmentLines.js +120 -0
- package/src/DigestTool/ladderDefaults.js +26 -0
- package/src/DigestTool/ruler.css +89 -0
- package/src/Editor/CommandHotkeyHandler.js +44 -0
- package/src/Editor/DropHandler.css +21 -0
- package/src/Editor/DropHandler.js +64 -0
- package/src/Editor/FillWindow.js +46 -0
- package/src/Editor/darkmode.css +98 -0
- package/src/Editor/index.js +1005 -0
- package/src/Editor/style.css +235 -0
- package/src/Editor/userDefinedHandlersAndOpts.js +56 -0
- package/src/EnzymeViewer/index.js +81 -0
- package/src/EnzymeViewer/style.css +6 -0
- package/src/FindBar/index.js +411 -0
- package/src/FindBar/style.css +46 -0
- package/src/GlobalDialog.js +66 -0
- package/src/GlobalDialogUtils.js +85 -0
- package/src/LinearView/SequenceName.js +15 -0
- package/src/LinearView/ZoomLinearView.js +47 -0
- package/src/LinearView/index.js +374 -0
- package/src/LinearView/style.css +12 -0
- package/src/ManageEnzymes/index.js +326 -0
- package/src/ManageEnzymes/style.css +100 -0
- package/src/MenuBar/defaultConfig.js +149 -0
- package/src/MenuBar/index.js +98 -0
- package/src/MenuBar/viewSubmenu.js +479 -0
- package/src/PCRTool/PCRTool.js +173 -0
- package/src/Reflex/Browser.js +107 -0
- package/src/Reflex/ReflexContainer.js +802 -0
- package/src/Reflex/ReflexElement.js +160 -0
- package/src/Reflex/ReflexEvents.js +77 -0
- package/src/Reflex/ReflexSplitter.js +205 -0
- package/src/Reflex/index.js +5 -0
- package/src/Reflex/reflex-styles.css +128 -0
- package/src/Reflex/reflex-styles.css.map +9 -0
- package/src/RowItem/AnnotationContainerHolder.js +20 -0
- package/src/RowItem/AnnotationPositioner.js +27 -0
- package/src/RowItem/Axis.js +149 -0
- package/src/RowItem/Caret/index.js +64 -0
- package/src/RowItem/Caret/style.css +8 -0
- package/src/RowItem/Chromatograms/Chromatogram.js +289 -0
- package/src/RowItem/CutsiteSelectionLayers.js +47 -0
- package/src/RowItem/Cutsites.js +271 -0
- package/src/RowItem/DeletionLayers/index.js +113 -0
- package/src/RowItem/DeletionLayers/style.css +5 -0
- package/src/RowItem/Labels.js +327 -0
- package/src/RowItem/Orf.js +109 -0
- package/src/RowItem/Orfs.js +35 -0
- package/src/RowItem/ReplacementLayers/style.css +5 -0
- package/src/RowItem/SelectionLayer/index.js +184 -0
- package/src/RowItem/SelectionLayer/style.css +21 -0
- package/src/RowItem/Sequence.js +269 -0
- package/src/RowItem/StackedAnnotations/PointedAnnotation.js +347 -0
- package/src/RowItem/StackedAnnotations/getStructuredBases.js +97 -0
- package/src/RowItem/StackedAnnotations/index.js +182 -0
- package/src/RowItem/StackedAnnotations/primerBases.js +218 -0
- package/src/RowItem/StackedAnnotations/style.css +14 -0
- package/src/RowItem/Translations/AASliver.js +190 -0
- package/src/RowItem/Translations/Translation.js +162 -0
- package/src/RowItem/Translations/index.js +54 -0
- package/src/RowItem/Translations/style.css +3 -0
- package/src/RowItem/constants.js +3 -0
- package/src/RowItem/getCutsiteLabelHeights.js +56 -0
- package/src/RowItem/getXStartAndWidthFromNonCircularRange.js +12 -0
- package/src/RowItem/getXStartAndWidthOfRangeWrtRow.js +27 -0
- package/src/RowItem/getXStartAndWidthOfRowAnnotation.js +19 -0
- package/src/RowItem/index.js +647 -0
- package/src/RowItem/partOverhangs.js +6 -0
- package/src/RowItem/style.css +103 -0
- package/src/RowItem/utils.js +32 -0
- package/src/RowView/estimateRowHeight.js +184 -0
- package/src/RowView/index.d.ts +10 -0
- package/src/RowView/index.js +554 -0
- package/src/RowView/style.css +12 -0
- package/src/SimpleCircularOrLinearView.js +379 -0
- package/src/SimpleOligoPreview.js +39 -0
- package/src/StatusBar/MeltingTemp.js +81 -0
- package/src/StatusBar/index.js +275 -0
- package/src/StatusBar/style.css +38 -0
- package/src/ToolBar/ToolbarItem.js +194 -0
- package/src/ToolBar/alignmentTool.js +503 -0
- package/src/ToolBar/array_move.js +10 -0
- package/src/ToolBar/cutsiteTool.js +88 -0
- package/src/ToolBar/downloadTool.js +38 -0
- package/src/ToolBar/editTool.js +26 -0
- package/src/ToolBar/featureTool.js +34 -0
- package/src/ToolBar/findTool.js +2 -0
- package/src/ToolBar/importTool.js +27 -0
- package/src/ToolBar/index.js +231 -0
- package/src/ToolBar/inlineFindTool.js +38 -0
- package/src/ToolBar/oligoTool.js +30 -0
- package/src/ToolBar/orfTool.js +141 -0
- package/src/ToolBar/partTool.js +47 -0
- package/src/ToolBar/printTool.js +31 -0
- package/src/ToolBar/redoTool.js +30 -0
- package/src/ToolBar/saveTool.js +48 -0
- package/src/ToolBar/style.css +138 -0
- package/src/ToolBar/undoTool.js +30 -0
- package/src/ToolBar/veToolbarIcons/find.png +0 -0
- package/src/ToolBar/veToolbarIcons/fullscreen.png +0 -0
- package/src/ToolBar/veToolbarIcons/linear.png +0 -0
- package/src/ToolBar/veToolbarIcons/pie.png +0 -0
- package/src/ToolBar/veToolbarIcons/print.png +0 -0
- package/src/ToolBar/veToolbarIcons/save.png +0 -0
- package/src/ToolBar/veToolbarIcons/show_cut_sites.png +0 -0
- package/src/ToolBar/veToolbarIcons/show_features.png +0 -0
- package/src/ToolBar/veToolbarIcons/show_orfs.png +0 -0
- package/src/ToolBar/veToolbarIcons/show_primers.png +0 -0
- package/src/ToolBar/veToolbarIcons/toggle_views.svg +1 -0
- package/src/ToolBar/versionHistoryTool.js +20 -0
- package/src/ToolBar/visibilityTool.js +39 -0
- package/src/VersionHistoryView/index.js +215 -0
- package/src/addAlignment.js +6 -0
- package/src/commands/getOveHotkeyDefs.js +12 -0
- package/src/commands/index.js +1585 -0
- package/src/constants/constants.js +2 -0
- package/src/constants/dnaToColor.js +17 -0
- package/src/constants/draggableClassnames.js +5 -0
- package/src/constants/findToolConstants.js +1 -0
- package/src/constants/orfFrameToColorMap.js +10 -0
- package/src/constants/rowviewContants.js +3 -0
- package/src/constants/specialCutsiteFilterOptions.js +22 -0
- package/src/constants.js +1 -0
- package/src/createVectorEditor/index.js +138 -0
- package/src/createVectorEditor/makeStore.js +34 -0
- package/src/fileUtils.js +103 -0
- package/src/helperComponents/AddOrEditAnnotationDialog/index.js +711 -0
- package/src/helperComponents/AddOrEditAnnotationDialog/style.css +11 -0
- package/src/helperComponents/AddOrEditFeatureDialog/index.js +58 -0
- package/src/helperComponents/AddOrEditPartDialog/index.js +101 -0
- package/src/helperComponents/AddOrEditPrimerDialog/EditCaretPosition.js +234 -0
- package/src/helperComponents/AddOrEditPrimerDialog/index.js +329 -0
- package/src/helperComponents/AddOrEditPrimerDialog/style.css +41 -0
- package/src/helperComponents/EnzymesDialog/index.js +904 -0
- package/src/helperComponents/EnzymesDialog/style.css +21 -0
- package/src/helperComponents/GoToDialog.js +21 -0
- package/src/helperComponents/MergeFeaturesDialog/index.js +253 -0
- package/src/helperComponents/MergeFeaturesDialog/style.css +3 -0
- package/src/helperComponents/MultipleSeqsDetectedOnImportDialog.js +74 -0
- package/src/helperComponents/PinchHelper/PinchHelper.js +24 -0
- package/src/helperComponents/PrintDialog/index.js +396 -0
- package/src/helperComponents/PrintDialog/style.css +4 -0
- package/src/helperComponents/PropertiesDialog/ColorPicker.js +30 -0
- package/src/helperComponents/PropertiesDialog/CutsiteProperties.js +185 -0
- package/src/helperComponents/PropertiesDialog/FeatureProperties.js +6 -0
- package/src/helperComponents/PropertiesDialog/GenbankView.js +74 -0
- package/src/helperComponents/PropertiesDialog/GeneralProperties.js +140 -0
- package/src/helperComponents/PropertiesDialog/GenericAnnotationProperties.js +406 -0
- package/src/helperComponents/PropertiesDialog/OrfProperties.js +117 -0
- package/src/helperComponents/PropertiesDialog/PartProperties.js +9 -0
- package/src/helperComponents/PropertiesDialog/PrimerProperties.js +19 -0
- package/src/helperComponents/PropertiesDialog/SingleEnzymeCutsiteInfo.js +131 -0
- package/src/helperComponents/PropertiesDialog/TranslationProperties.js +149 -0
- package/src/helperComponents/PropertiesDialog/index.js +166 -0
- package/src/helperComponents/PropertiesDialog/style.css +68 -0
- package/src/helperComponents/PropertiesDialog/typeField.js +24 -0
- package/src/helperComponents/PropertiesDialog/utils.js +37 -0
- package/src/helperComponents/RemoveDuplicates/index.js +194 -0
- package/src/helperComponents/RenameSequenceDialog.js +7 -0
- package/src/helperComponents/SelectDialog.js +150 -0
- package/src/helperComponents/UncontrolledSliderWithPlusMinusBtns.css +5 -0
- package/src/helperComponents/UncontrolledSliderWithPlusMinusBtns.js +134 -0
- package/src/helperComponents/VeWarning/index.js +22 -0
- package/src/helperComponents/VeWarning/style.css +10 -0
- package/src/helperComponents/createSimpleDialog.js +89 -0
- package/src/helperComponents/partTagSearch.js +72 -0
- package/src/helperComponents/simpleDialog.css +13 -0
- package/src/helperComponents/withHover.js +90 -0
- package/src/index.js +60 -0
- package/src/redux/alignments.js +373 -0
- package/src/redux/annotationLabelVisibility.js +53 -0
- package/src/redux/annotationVisibility.js +196 -0
- package/src/redux/annotationsToSupport.js +104 -0
- package/src/redux/caretPosition.js +27 -0
- package/src/redux/charWidth.js +22 -0
- package/src/redux/copyOptions.js +34 -0
- package/src/redux/createYourOwnEnzyme.js +39 -0
- package/src/redux/deletionLayers.js +36 -0
- package/src/redux/digestTool.js +34 -0
- package/src/redux/featureLengthsToHide.js +27 -0
- package/src/redux/findTool.js +79 -0
- package/src/redux/frameTranslations.js +52 -0
- package/src/redux/hoveredAnnotation.js +24 -0
- package/src/redux/index.js +196 -0
- package/src/redux/labelLineIntensity.js +25 -0
- package/src/redux/labelSize.js +23 -0
- package/src/redux/lastSavedId.js +20 -0
- package/src/redux/middleware.js +112 -0
- package/src/redux/minimumOrfSize.js +24 -0
- package/src/redux/modalActions.js +3 -0
- package/src/redux/panelsShown.js +273 -0
- package/src/redux/partLengthsToHide.js +23 -0
- package/src/redux/primerLengthsToHide.js +27 -0
- package/src/redux/propertiesTool.js +40 -0
- package/src/redux/readOnly.js +28 -0
- package/src/redux/replacementLayers.js +36 -0
- package/src/redux/restrictionEnzymes.js +52 -0
- package/src/redux/selectedAnnotations.js +89 -0
- package/src/redux/selectedPartTags.js +21 -0
- package/src/redux/selectionLayer.js +46 -0
- package/src/redux/sequenceData/circular.js +19 -0
- package/src/redux/sequenceData/description.js +21 -0
- package/src/redux/sequenceData/features.js +19 -0
- package/src/redux/sequenceData/index.js +81 -0
- package/src/redux/sequenceData/lineageLines.js +11 -0
- package/src/redux/sequenceData/materiallyAvailable.js +19 -0
- package/src/redux/sequenceData/name.js +19 -0
- package/src/redux/sequenceData/parts.js +19 -0
- package/src/redux/sequenceData/primers.js +19 -0
- package/src/redux/sequenceData/sequence.js +12 -0
- package/src/redux/sequenceData/sharedActionCreators.js +0 -0
- package/src/redux/sequenceData/translations.js +20 -0
- package/src/redux/sequenceData/upsertDeleteActionGenerator.js +31 -0
- package/src/redux/sequenceDataHistory.js +43 -0
- package/src/redux/showGCContent.js +23 -0
- package/src/redux/toolBar.js +25 -0
- package/src/redux/uppercaseSequenceMapFont.js +25 -0
- package/src/redux/useAdditionalOrfStartCodons.js +24 -0
- package/src/redux/utils/addDashesForMatchStartAndEndForTracks/index.js +71 -0
- package/src/redux/utils/addMetaToActionCreators.js +12 -0
- package/src/redux/utils/createMergedDefaultStateReducer.js +30 -0
- package/src/redux/utils/createMetaAction.js +12 -0
- package/src/redux/versionHistory.js +27 -0
- package/src/selectors/annotationLabelVisibility.js +2 -0
- package/src/selectors/annotationSearchSelector.js +24 -0
- package/src/selectors/cdsFeaturesSelector.js +9 -0
- package/src/selectors/circularSelector.js +4 -0
- package/src/selectors/cutsiteLabelColorSelector.js +6 -0
- package/src/selectors/cutsitesByRangeSelector.js +5 -0
- package/src/selectors/cutsitesSelector.js +61 -0
- package/src/selectors/editorSelector.js +2 -0
- package/src/selectors/featuresSelector.js +8 -0
- package/src/selectors/filteredCutsitesSelector.js +137 -0
- package/src/selectors/filteredFeaturesSelector.js +32 -0
- package/src/selectors/filteredPartsSelector.js +57 -0
- package/src/selectors/filteredPrimersSelector.js +27 -0
- package/src/selectors/filteredRestrictionEnzymesSelector.js +1 -0
- package/src/selectors/getAdditionalEnzymesSelector.js +46 -0
- package/src/selectors/index.js +41 -0
- package/src/selectors/isEnzymeFilterAndSelector.js +1 -0
- package/src/selectors/minimumOrfSizeSelector.js +2 -0
- package/src/selectors/orfsSelector.js +15 -0
- package/src/selectors/partsSelector.js +8 -0
- package/src/selectors/primersSelector.js +8 -0
- package/src/selectors/restrictionEnzymesSelector.js +34 -0
- package/src/selectors/searchLayersSelector.js +71 -0
- package/src/selectors/selectedAnnotationsSelector.js +1 -0
- package/src/selectors/selectedCutsitesSelector.js +21 -0
- package/src/selectors/sequenceDataSelector.js +2 -0
- package/src/selectors/sequenceLengthSelector.js +5 -0
- package/src/selectors/sequenceSelector.js +4 -0
- package/src/selectors/tagsToBoldSelector.js +2 -0
- package/src/selectors/translationSearchMatchesSelector.js +14 -0
- package/src/selectors/translationsRawSelector.js +8 -0
- package/src/selectors/translationsSelector.js +137 -0
- package/src/style.css +82 -0
- package/src/updateEditor.js +198 -0
- package/src/utils/PassThrough.js +3 -0
- package/src/utils/addWrappedAddons.js +20 -0
- package/src/utils/annotationTypes.js +37 -0
- package/src/utils/arrayUtils.js +19 -0
- package/src/utils/calculateTickMarkPositionsForGivenRange.js +47 -0
- package/src/utils/cleanSequenceData_DEPRECATED/arrayToObjWithIds.js +17 -0
- package/src/utils/combineReducersDontIgnoreKeys.js +12 -0
- package/src/utils/commandUtils.js +18 -0
- package/src/utils/editorUtils.js +223 -0
- package/src/utils/getAnnotationClassnames.js +12 -0
- package/src/utils/getAnnotationNameAndStartStopString.js +61 -0
- package/src/utils/getVisibleStartEnd.js +7 -0
- package/src/utils/massageTickSpacing.js +19 -0
- package/src/utils/onlyUpdateForKeysDeep.js +31 -0
- package/src/utils/prepareRowData.js +64 -0
- package/src/utils/proteinUtils.js +3 -0
- package/src/utils/pureNoFunc.js +18 -0
- package/src/utils/selectionLayer.js +25 -0
- package/src/utils/shouldRerender.js +27 -0
- package/src/utils/showFileDialog.js +26 -0
- package/src/utils/updateLabelsForInViewFeatures.js +55 -0
- package/src/utils/updateLabelsForInViewFeaturesCircView.js +41 -0
- package/src/utils/useAAColorType.js +8 -0
- package/src/utils/useAnnotationLimits.js +42 -0
- package/src/utils/useChromatogramPrefs.js +31 -0
- package/src/utils/useLadders.js +6 -0
- package/src/utils/useMeltingTemp.js +7 -0
- package/src/utils/useTmType.js +10 -0
- package/src/withEditorInteractions/Keyboard.js +86 -0
- package/src/withEditorInteractions/clickAndDragUtils.js +576 -0
- package/src/withEditorInteractions/createSequenceInputPopup.js +296 -0
- package/src/withEditorInteractions/createSequenceInputPopupStyle.css +85 -0
- package/src/withEditorInteractions/getBpsPerRow.js +19 -0
- package/src/withEditorInteractions/index.js +1252 -0
- package/src/withEditorInteractions/isElementInViewport.js +29 -0
- package/src/withEditorInteractions/moveCaret.js +58 -0
- package/src/withEditorProps/index.js +1010 -0
- package/index.mjs +0 -193228
| @@ -0,0 +1,347 @@ | |
| 1 | 
            +
            import Color from "color";
         | 
| 2 | 
            +
            import classnames from "classnames";
         | 
| 3 | 
            +
            import withHover from "../../helperComponents/withHover";
         | 
| 4 | 
            +
            import getAnnotationNameAndStartStopString from "../../utils/getAnnotationNameAndStartStopString";
         | 
| 5 | 
            +
             | 
| 6 | 
            +
            import React, { useState } from "react";
         | 
| 7 | 
            +
            import { doesLabelFitInAnnotation } from "../utils";
         | 
| 8 | 
            +
            import { noop } from "lodash";
         | 
| 9 | 
            +
            import getAnnotationClassnames from "../../utils/getAnnotationClassnames";
         | 
| 10 | 
            +
            import { getStripedPattern } from "../../utils/editorUtils";
         | 
| 11 | 
            +
            import { ANNOTATION_LABEL_FONT_WIDTH } from "../constants";
         | 
| 12 | 
            +
            import { partOverhangs } from "../partOverhangs";
         | 
| 13 | 
            +
            import { Tooltip } from "@blueprintjs/core";
         | 
| 14 | 
            +
             | 
| 15 | 
            +
            function PointedAnnotation(props) {
         | 
| 16 | 
            +
              const {
         | 
| 17 | 
            +
                className,
         | 
| 18 | 
            +
                widthInBps,
         | 
| 19 | 
            +
                charWidth,
         | 
| 20 | 
            +
                height,
         | 
| 21 | 
            +
                rangeType,
         | 
| 22 | 
            +
                forward,
         | 
| 23 | 
            +
                arrowheadType,
         | 
| 24 | 
            +
                name: _name = "",
         | 
| 25 | 
            +
                customName,
         | 
| 26 | 
            +
                type,
         | 
| 27 | 
            +
                readOnly,
         | 
| 28 | 
            +
                isStriped,
         | 
| 29 | 
            +
                onMouseLeave,
         | 
| 30 | 
            +
                onMouseOver,
         | 
| 31 | 
            +
                isProtein,
         | 
| 32 | 
            +
                id,
         | 
| 33 | 
            +
                extraHeight,
         | 
| 34 | 
            +
                flipAnnotation,
         | 
| 35 | 
            +
                insertPaths,
         | 
| 36 | 
            +
                insertTicks,
         | 
| 37 | 
            +
                hideName,
         | 
| 38 | 
            +
                color = "orange",
         | 
| 39 | 
            +
                fill,
         | 
| 40 | 
            +
                stroke,
         | 
| 41 | 
            +
                opacity,
         | 
| 42 | 
            +
                onClick = noop,
         | 
| 43 | 
            +
                onDoubleClick = noop,
         | 
| 44 | 
            +
                textColor,
         | 
| 45 | 
            +
                onRightClick = noop,
         | 
| 46 | 
            +
                gapsInside,
         | 
| 47 | 
            +
                gapsBefore,
         | 
| 48 | 
            +
                annotation,
         | 
| 49 | 
            +
                truncateLabelsThatDoNotFit,
         | 
| 50 | 
            +
                onlyShowLabelsThatDoNotFit
         | 
| 51 | 
            +
              } = props;
         | 
| 52 | 
            +
             | 
| 53 | 
            +
              const name = customName || _name;
         | 
| 54 | 
            +
              let pointiness = props.pointiness || 4;
         | 
| 55 | 
            +
              let arrowPointiness = props.arrowPointiness || 1;
         | 
| 56 | 
            +
              const [isOpen, setOpen] = useState(false);
         | 
| 57 | 
            +
              const [isOpen2, setOpen2] = useState(false);
         | 
| 58 | 
            +
              if (arrowheadType === "NONE") {
         | 
| 59 | 
            +
                pointiness = 0;
         | 
| 60 | 
            +
                arrowPointiness = 0;
         | 
| 61 | 
            +
              }
         | 
| 62 | 
            +
              const _rangeType = annotation.rangeTypeOverride || rangeType;
         | 
| 63 | 
            +
             | 
| 64 | 
            +
              const classNames = getAnnotationClassnames(annotation, {
         | 
| 65 | 
            +
                isProtein,
         | 
| 66 | 
            +
                type,
         | 
| 67 | 
            +
                viewName: "RowView"
         | 
| 68 | 
            +
              });
         | 
| 69 | 
            +
              let partOverhangStart;
         | 
| 70 | 
            +
              let partOverhangEnd;
         | 
| 71 | 
            +
             | 
| 72 | 
            +
              partOverhangs.forEach((h) => {
         | 
| 73 | 
            +
                const overhangBps = props[h];
         | 
| 74 | 
            +
                if (overhangBps) {
         | 
| 75 | 
            +
                  if (h.includes("fivePrime")) {
         | 
| 76 | 
            +
                    partOverhangStart = overhangBps;
         | 
| 77 | 
            +
                    if (h.includes("Underhang")) {
         | 
| 78 | 
            +
                      partOverhangStart += " Underhang";
         | 
| 79 | 
            +
                    } else if (h.includes("Overhang")) {
         | 
| 80 | 
            +
                      partOverhangStart += " Overhang";
         | 
| 81 | 
            +
                    }
         | 
| 82 | 
            +
                  } else {
         | 
| 83 | 
            +
                    partOverhangEnd = overhangBps;
         | 
| 84 | 
            +
                    if (h.includes("Underhang")) {
         | 
| 85 | 
            +
                      partOverhangEnd += " Underhang";
         | 
| 86 | 
            +
                    } else if (h.includes("Overhang")) {
         | 
| 87 | 
            +
                      partOverhangEnd += " Overhang";
         | 
| 88 | 
            +
                    }
         | 
| 89 | 
            +
                  }
         | 
| 90 | 
            +
                }
         | 
| 91 | 
            +
              });
         | 
| 92 | 
            +
             | 
| 93 | 
            +
              const width = (widthInBps + gapsInside) * charWidth;
         | 
| 94 | 
            +
              let charWN = charWidth; //charWN is normalized
         | 
| 95 | 
            +
              if (charWidth < 15) {
         | 
| 96 | 
            +
                //allow the arrow width to adapt
         | 
| 97 | 
            +
                if (width > 15) {
         | 
| 98 | 
            +
                  charWN = 15; //tnr: replace 15 here with a non-hardcoded number..
         | 
| 99 | 
            +
                } else {
         | 
| 100 | 
            +
                  charWN = width;
         | 
| 101 | 
            +
                }
         | 
| 102 | 
            +
              }
         | 
| 103 | 
            +
              charWN = arrowPointiness * charWN;
         | 
| 104 | 
            +
             | 
| 105 | 
            +
              const widthMinusOne = width - charWN;
         | 
| 106 | 
            +
              let path;
         | 
| 107 | 
            +
              let hasAPoint = false;
         | 
| 108 | 
            +
              const endLine = annotation.overlapsSelf
         | 
| 109 | 
            +
                ? `L 0,${height / 2}
         | 
| 110 | 
            +
              L -10,${height / 2}
         | 
| 111 | 
            +
              L 0,${height / 2} `
         | 
| 112 | 
            +
                : "";
         | 
| 113 | 
            +
              const bottomLine = `${insertTicks || ""} L 0,${height}`;
         | 
| 114 | 
            +
              const startLines = `M 0,0
         | 
| 115 | 
            +
              ${insertPaths || ""}`;
         | 
| 116 | 
            +
              const arrowLine = annotation.overlapsSelf
         | 
| 117 | 
            +
                ? `L ${width + 10},${height / 2}
         | 
| 118 | 
            +
              L ${width},${height / 2} `
         | 
| 119 | 
            +
                : "";
         | 
| 120 | 
            +
             | 
| 121 | 
            +
              // starting from the top left of the annotation
         | 
| 122 | 
            +
              if (_rangeType === "middle") {
         | 
| 123 | 
            +
                //draw a rectangle
         | 
| 124 | 
            +
                path = `
         | 
| 125 | 
            +
                    ${startLines}
         | 
| 126 | 
            +
                    L ${width - pointiness / 2},0
         | 
| 127 | 
            +
                    Q ${width + pointiness / 2},${height / 2} ${
         | 
| 128 | 
            +
                  width - pointiness / 2
         | 
| 129 | 
            +
                },${height}
         | 
| 130 | 
            +
                    ${bottomLine}
         | 
| 131 | 
            +
                    Q ${pointiness},${height / 2} ${0},${0}
         | 
| 132 | 
            +
                    z`;
         | 
| 133 | 
            +
              } else if (_rangeType === "start") {
         | 
| 134 | 
            +
                path = `
         | 
| 135 | 
            +
                    ${startLines}
         | 
| 136 | 
            +
                    L ${width - pointiness / 2},0
         | 
| 137 | 
            +
             | 
| 138 | 
            +
                    Q ${width + pointiness / 2},${height / 2} ${
         | 
| 139 | 
            +
                  width - pointiness / 2
         | 
| 140 | 
            +
                },${height}
         | 
| 141 | 
            +
             | 
| 142 | 
            +
                    ${bottomLine}
         | 
| 143 | 
            +
                    ${endLine}
         | 
| 144 | 
            +
                    z`;
         | 
| 145 | 
            +
              } else if (_rangeType === "beginningAndEnd") {
         | 
| 146 | 
            +
                hasAPoint = true;
         | 
| 147 | 
            +
                path = `
         | 
| 148 | 
            +
                    ${startLines}
         | 
| 149 | 
            +
                    L ${widthMinusOne},0
         | 
| 150 | 
            +
                    L ${width},${height / 2}
         | 
| 151 | 
            +
                    ${arrowLine}
         | 
| 152 | 
            +
                    L ${widthMinusOne},${height}
         | 
| 153 | 
            +
                    ${bottomLine}
         | 
| 154 | 
            +
                    ${endLine}
         | 
| 155 | 
            +
                    z`;
         | 
| 156 | 
            +
              } else {
         | 
| 157 | 
            +
                hasAPoint = true;
         | 
| 158 | 
            +
                path = `
         | 
| 159 | 
            +
                  ${startLines}
         | 
| 160 | 
            +
                  L ${widthMinusOne},0
         | 
| 161 | 
            +
                  L ${width},${height / 2}
         | 
| 162 | 
            +
                  ${arrowLine}
         | 
| 163 | 
            +
                  L ${widthMinusOne},${height}
         | 
| 164 | 
            +
                  ${bottomLine}
         | 
| 165 | 
            +
                  Q ${pointiness},${height / 2} ${0},${0}
         | 
| 166 | 
            +
                  z`;
         | 
| 167 | 
            +
              }
         | 
| 168 | 
            +
              let nameToDisplay = name;
         | 
| 169 | 
            +
              let textOffset =
         | 
| 170 | 
            +
                width / 2 -
         | 
| 171 | 
            +
                (name.length * 5) / 2 -
         | 
| 172 | 
            +
                (hasAPoint ? (pointiness / 2) * (forward ? 1 : -1) : 0);
         | 
| 173 | 
            +
              if (
         | 
| 174 | 
            +
                !doesLabelFitInAnnotation(name, { width }, charWidth) ||
         | 
| 175 | 
            +
                (!onlyShowLabelsThatDoNotFit &&
         | 
| 176 | 
            +
                  ["parts", "features"].includes(annotation.annotationTypePlural))
         | 
| 177 | 
            +
              ) {
         | 
| 178 | 
            +
                if (truncateLabelsThatDoNotFit) {
         | 
| 179 | 
            +
                  const fractionToDisplay =
         | 
| 180 | 
            +
                    width / (name.length * ANNOTATION_LABEL_FONT_WIDTH);
         | 
| 181 | 
            +
                  const numLetters = Math.floor(fractionToDisplay * name.length);
         | 
| 182 | 
            +
                  nameToDisplay = name.slice(0, numLetters);
         | 
| 183 | 
            +
                  if (nameToDisplay.length > 3) {
         | 
| 184 | 
            +
                    if (nameToDisplay.length !== name.length) {
         | 
| 185 | 
            +
                      nameToDisplay += "..";
         | 
| 186 | 
            +
                    }
         | 
| 187 | 
            +
             | 
| 188 | 
            +
                    textOffset =
         | 
| 189 | 
            +
                      width / 2 -
         | 
| 190 | 
            +
                      (nameToDisplay.length * 5) / 2 -
         | 
| 191 | 
            +
                      (hasAPoint ? (pointiness / 2) * (forward ? 1 : -1) : 0);
         | 
| 192 | 
            +
                  } else {
         | 
| 193 | 
            +
                    textOffset = 0;
         | 
| 194 | 
            +
                    nameToDisplay = "";
         | 
| 195 | 
            +
                  }
         | 
| 196 | 
            +
                } else {
         | 
| 197 | 
            +
                  textOffset = 0;
         | 
| 198 | 
            +
                  nameToDisplay = "";
         | 
| 199 | 
            +
                }
         | 
| 200 | 
            +
              }
         | 
| 201 | 
            +
              let _textColor = textColor;
         | 
| 202 | 
            +
              if (!textColor) {
         | 
| 203 | 
            +
                try {
         | 
| 204 | 
            +
                  _textColor = Color(color).isDark() ? "white" : "black";
         | 
| 205 | 
            +
                } catch (error) {
         | 
| 206 | 
            +
                  _textColor = "white";
         | 
| 207 | 
            +
                }
         | 
| 208 | 
            +
              }
         | 
| 209 | 
            +
             | 
| 210 | 
            +
              return (
         | 
| 211 | 
            +
                <g
         | 
| 212 | 
            +
                  {...{ onMouseLeave, onMouseOver }}
         | 
| 213 | 
            +
                  className={` clickable ${className} ${classNames} ${
         | 
| 214 | 
            +
                    forward ? "ann-forward" : `ann-reverse`
         | 
| 215 | 
            +
                  }`}
         | 
| 216 | 
            +
                  data-id={id}
         | 
| 217 | 
            +
                  onClick={function (event) {
         | 
| 218 | 
            +
                    onClick({ annotation, event, gapsBefore, gapsInside });
         | 
| 219 | 
            +
                  }}
         | 
| 220 | 
            +
                  onDoubleClick={function (event) {
         | 
| 221 | 
            +
                    onDoubleClick &&
         | 
| 222 | 
            +
                      onDoubleClick({ annotation, event, gapsBefore, gapsInside });
         | 
| 223 | 
            +
                  }}
         | 
| 224 | 
            +
                  onContextMenu={function (event) {
         | 
| 225 | 
            +
                    onRightClick({ annotation, event, gapsBefore, gapsInside });
         | 
| 226 | 
            +
                  }}
         | 
| 227 | 
            +
                >
         | 
| 228 | 
            +
                  {!(isOpen || isOpen2) && (
         | 
| 229 | 
            +
                    <title>
         | 
| 230 | 
            +
                      {getAnnotationNameAndStartStopString(annotation, {
         | 
| 231 | 
            +
                        isProtein,
         | 
| 232 | 
            +
                        readOnly
         | 
| 233 | 
            +
                      })}
         | 
| 234 | 
            +
                    </title>
         | 
| 235 | 
            +
                  )}
         | 
| 236 | 
            +
                  {isStriped && getStripedPattern({ color })}
         | 
| 237 | 
            +
             | 
| 238 | 
            +
                  <path
         | 
| 239 | 
            +
                    strokeWidth="1"
         | 
| 240 | 
            +
                    stroke={stroke || "black"}
         | 
| 241 | 
            +
                    opacity={opacity}
         | 
| 242 | 
            +
                    fill={isStriped ? "url(#diagonalHatch)" : fill || color}
         | 
| 243 | 
            +
                    transform={
         | 
| 244 | 
            +
                      forward
         | 
| 245 | 
            +
                        ? null
         | 
| 246 | 
            +
                        : "translate(" +
         | 
| 247 | 
            +
                          width +
         | 
| 248 | 
            +
                          `,${flipAnnotation ? -extraHeight + 10 : 0}) scale(-1,${
         | 
| 249 | 
            +
                            flipAnnotation ? "-" : ""
         | 
| 250 | 
            +
                          }1) `
         | 
| 251 | 
            +
                    }
         | 
| 252 | 
            +
                    d={path}
         | 
| 253 | 
            +
                  />
         | 
| 254 | 
            +
                  {partOverhangStart &&
         | 
| 255 | 
            +
                    (rangeType === (forward ? "start" : "end") ||
         | 
| 256 | 
            +
                      rangeType === "beginningAndEnd") && (
         | 
| 257 | 
            +
                      <Tooltip
         | 
| 258 | 
            +
                        onInteraction={(isOpen) => {
         | 
| 259 | 
            +
                          setOpen(isOpen);
         | 
| 260 | 
            +
                        }}
         | 
| 261 | 
            +
                        isOpen={isOpen}
         | 
| 262 | 
            +
                        wrapperTagName="g"
         | 
| 263 | 
            +
                        targetTagName="g"
         | 
| 264 | 
            +
                        content={partOverhangStart}
         | 
| 265 | 
            +
                      >
         | 
| 266 | 
            +
                        <circle
         | 
| 267 | 
            +
                          className="partWithOverhangsIndicator"
         | 
| 268 | 
            +
                          style={{ fillOpacity: 1 }}
         | 
| 269 | 
            +
                          fill="#ac68cc"
         | 
| 270 | 
            +
                          cx={(forward ? -7 : 0) + 15}
         | 
| 271 | 
            +
                          cy={7}
         | 
| 272 | 
            +
                          r={4}
         | 
| 273 | 
            +
                        ></circle>
         | 
| 274 | 
            +
                      </Tooltip>
         | 
| 275 | 
            +
                    )}
         | 
| 276 | 
            +
                  {partOverhangEnd &&
         | 
| 277 | 
            +
                    (rangeType === (forward ? "end" : "start") ||
         | 
| 278 | 
            +
                      rangeType === "beginningAndEnd") && (
         | 
| 279 | 
            +
                      <Tooltip
         | 
| 280 | 
            +
                        onInteraction={(isOpen) => {
         | 
| 281 | 
            +
                          setOpen2(isOpen);
         | 
| 282 | 
            +
                        }}
         | 
| 283 | 
            +
                        isOpen={isOpen2}
         | 
| 284 | 
            +
                        wrapperTagName="g"
         | 
| 285 | 
            +
                        targetTagName="g"
         | 
| 286 | 
            +
                        content={partOverhangEnd}
         | 
| 287 | 
            +
                      >
         | 
| 288 | 
            +
                        <circle
         | 
| 289 | 
            +
                          className="partWithOverhangsIndicator"
         | 
| 290 | 
            +
                          style={{ fillOpacity: 1 }}
         | 
| 291 | 
            +
                          fill="#ac68cc"
         | 
| 292 | 
            +
                          cx={(forward ? -7 : 0) + width - 10}
         | 
| 293 | 
            +
                          cy={7}
         | 
| 294 | 
            +
                          r={4}
         | 
| 295 | 
            +
                        ></circle>
         | 
| 296 | 
            +
                      </Tooltip>
         | 
| 297 | 
            +
                    )}
         | 
| 298 | 
            +
                  {!hideName && nameToDisplay && (
         | 
| 299 | 
            +
                    <text
         | 
| 300 | 
            +
                      className={classnames(
         | 
| 301 | 
            +
                        "veLabelText ve-monospace-font",
         | 
| 302 | 
            +
                        annotation.labelClassName
         | 
| 303 | 
            +
                      )}
         | 
| 304 | 
            +
                      style={{
         | 
| 305 | 
            +
                        fontSize: ".9em",
         | 
| 306 | 
            +
                        fill: _textColor
         | 
| 307 | 
            +
                      }}
         | 
| 308 | 
            +
                      transform={`translate(${textOffset},${height - 2})`}
         | 
| 309 | 
            +
                    >
         | 
| 310 | 
            +
                      {nameToDisplay}
         | 
| 311 | 
            +
                    </text>
         | 
| 312 | 
            +
                  )}
         | 
| 313 | 
            +
                </g>
         | 
| 314 | 
            +
              );
         | 
| 315 | 
            +
            }
         | 
| 316 | 
            +
             | 
| 317 | 
            +
            export default withHover(PointedAnnotation);
         | 
| 318 | 
            +
             | 
| 319 | 
            +
            //  {/* <Tooltip
         | 
| 320 | 
            +
            //               wrapperTagName="g"
         | 
| 321 | 
            +
            //               targetTagName="g"
         | 
| 322 | 
            +
            //               content={"asdfasdfasdfasfdp"}
         | 
| 323 | 
            +
            //             >
         | 
| 324 | 
            +
            //               <rect
         | 
| 325 | 
            +
            //                 style={{ fillOpacity: 1 }}
         | 
| 326 | 
            +
            //                 stroke="#ac68cc"
         | 
| 327 | 
            +
            //                 fill="none"
         | 
| 328 | 
            +
            //                 x={-10}
         | 
| 329 | 
            +
            //                 width={10}
         | 
| 330 | 
            +
            //                 height={5}
         | 
| 331 | 
            +
            //               ></rect>
         | 
| 332 | 
            +
            //             </Tooltip>
         | 
| 333 | 
            +
            //             <Tooltip
         | 
| 334 | 
            +
            //               wrapperTagName="g"
         | 
| 335 | 
            +
            //               targetTagName="g"
         | 
| 336 | 
            +
            //               content={"asdfasdfasdfasfdp"}
         | 
| 337 | 
            +
            //             >
         | 
| 338 | 
            +
            //               <rect
         | 
| 339 | 
            +
            //                 style={{ fillOpacity: 1 }}
         | 
| 340 | 
            +
            //                 stroke="#ac68cc"
         | 
| 341 | 
            +
            //                 fill="none"
         | 
| 342 | 
            +
            //                 x={ width + 2 }
         | 
| 343 | 
            +
            //                 y={7}
         | 
| 344 | 
            +
            //                 width={10}
         | 
| 345 | 
            +
            //                 height={5}
         | 
| 346 | 
            +
            //               ></rect>
         | 
| 347 | 
            +
            //             </Tooltip> */}
         | 
| @@ -0,0 +1,97 @@ | |
| 1 | 
            +
            import { clone } from "lodash";
         | 
| 2 | 
            +
            import { getRangeLength, getSequenceWithinRange } from "@teselagen/range-utils";
         | 
| 3 | 
            +
            import { getComplementSequenceString } from "@teselagen/sequence-utils";
         | 
| 4 | 
            +
            import { bioData } from "@teselagen/sequence-utils";
         | 
| 5 | 
            +
            const { ambiguous_dna_values } = bioData;
         | 
| 6 | 
            +
            export function getStructuredBases({
         | 
| 7 | 
            +
              annotationRange,
         | 
| 8 | 
            +
              forward,
         | 
| 9 | 
            +
              bases = "",
         | 
| 10 | 
            +
              start,
         | 
| 11 | 
            +
              end,
         | 
| 12 | 
            +
              fullSequence,
         | 
| 13 | 
            +
              primerBindsOn,
         | 
| 14 | 
            +
              sequenceLength
         | 
| 15 | 
            +
            }) {
         | 
| 16 | 
            +
              const annLen = getRangeLength({ start, end }, sequenceLength);
         | 
| 17 | 
            +
              let basesToUse = bases;
         | 
| 18 | 
            +
              if (bases.length < annLen) {
         | 
| 19 | 
            +
                if (forward && primerBindsOn === "3prime") {
         | 
| 20 | 
            +
                  const toAddLen = annLen - bases.length;
         | 
| 21 | 
            +
                  for (let index = 0; index < toAddLen; index++) {
         | 
| 22 | 
            +
                    basesToUse = "&" + basesToUse;
         | 
| 23 | 
            +
                  }
         | 
| 24 | 
            +
                } else if (!forward && primerBindsOn === "5prime") {
         | 
| 25 | 
            +
                  const toAddLen = annLen - bases.length;
         | 
| 26 | 
            +
                  for (let index = 0; index < toAddLen; index++) {
         | 
| 27 | 
            +
                    basesToUse = basesToUse + "&";
         | 
| 28 | 
            +
                  }
         | 
| 29 | 
            +
                }
         | 
| 30 | 
            +
              }
         | 
| 31 | 
            +
              const aRange = {
         | 
| 32 | 
            +
                //tnr: this probably needs to be changed in case annotation wraps origin
         | 
| 33 | 
            +
                start: annotationRange.start - start,
         | 
| 34 | 
            +
                end: annotationRange.end - start
         | 
| 35 | 
            +
              };
         | 
| 36 | 
            +
              const r = {
         | 
| 37 | 
            +
                aRange,
         | 
| 38 | 
            +
                basesNoInserts: basesToUse,
         | 
| 39 | 
            +
                inserts: []
         | 
| 40 | 
            +
              };
         | 
| 41 | 
            +
             | 
| 42 | 
            +
              const baseLen = basesToUse.length;
         | 
| 43 | 
            +
              const diffLen = baseLen - annLen;
         | 
| 44 | 
            +
              if (diffLen > 0) {
         | 
| 45 | 
            +
                r.basesNoInserts = basesToUse.slice(
         | 
| 46 | 
            +
                  primerBindsOn === "5prime" ? 0 : diffLen,
         | 
| 47 | 
            +
                  primerBindsOn === "5prime" ? annLen : baseLen
         | 
| 48 | 
            +
                );
         | 
| 49 | 
            +
                const insertBases = basesToUse.slice(
         | 
| 50 | 
            +
                  primerBindsOn === "5prime" ? annLen : 0,
         | 
| 51 | 
            +
                  primerBindsOn === "5prime" ? baseLen : diffLen
         | 
| 52 | 
            +
                );
         | 
| 53 | 
            +
             | 
| 54 | 
            +
                r.inserts = [
         | 
| 55 | 
            +
                  {
         | 
| 56 | 
            +
                    bases: insertBases,
         | 
| 57 | 
            +
                    index: primerBindsOn === "5prime" ? annLen : 0
         | 
| 58 | 
            +
                  }
         | 
| 59 | 
            +
                ];
         | 
| 60 | 
            +
              }
         | 
| 61 | 
            +
              const basesForRange = getSequenceWithinRange(
         | 
| 62 | 
            +
                aRange,
         | 
| 63 | 
            +
                forward ? r.basesNoInserts : r.basesNoInserts.split("").reverse().join("")
         | 
| 64 | 
            +
              );
         | 
| 65 | 
            +
              r.basesNoInsertsWithMetaData = basesForRange.split("").map((b, i) => {
         | 
| 66 | 
            +
                const indexOfBase = i + annotationRange.start;
         | 
| 67 | 
            +
                let seqForBase = (fullSequence && fullSequence[indexOfBase]) || "";
         | 
| 68 | 
            +
                if (!forward) {
         | 
| 69 | 
            +
                  seqForBase = getComplementSequenceString(seqForBase);
         | 
| 70 | 
            +
                }
         | 
| 71 | 
            +
                const isMatch = seqForBase.toLowerCase() === b.toLowerCase();
         | 
| 72 | 
            +
                const isAmbiguousMatch =
         | 
| 73 | 
            +
                  !isMatch &&
         | 
| 74 | 
            +
                  ambiguous_dna_values[b.toUpperCase()].length > 1 &&
         | 
| 75 | 
            +
                  ambiguous_dna_values[b.toUpperCase()].includes(seqForBase.toUpperCase());
         | 
| 76 | 
            +
                return {
         | 
| 77 | 
            +
                  b,
         | 
| 78 | 
            +
                  isMatch,
         | 
| 79 | 
            +
                  isAmbiguousMatch
         | 
| 80 | 
            +
                };
         | 
| 81 | 
            +
              });
         | 
| 82 | 
            +
              r.allBasesWithMetaData = clone(r.basesNoInsertsWithMetaData);
         | 
| 83 | 
            +
              if (!forward) {
         | 
| 84 | 
            +
                r.allBasesWithMetaData = r.allBasesWithMetaData.reverse();
         | 
| 85 | 
            +
              }
         | 
| 86 | 
            +
              r.inserts
         | 
| 87 | 
            +
                .sort((a, b) => a.index - b.index)
         | 
| 88 | 
            +
                .forEach(({ bases, index }) => {
         | 
| 89 | 
            +
                  r.allBasesWithMetaData.splice(
         | 
| 90 | 
            +
                    index,
         | 
| 91 | 
            +
                    0,
         | 
| 92 | 
            +
                    ...bases.split("").map((b) => ({ b, isMatch: false }))
         | 
| 93 | 
            +
                  );
         | 
| 94 | 
            +
                });
         | 
| 95 | 
            +
             | 
| 96 | 
            +
              return r;
         | 
| 97 | 
            +
            }
         | 
| @@ -0,0 +1,182 @@ | |
| 1 | 
            +
            import { getFeatureToColorMap } from "@teselagen/sequence-utils";
         | 
| 2 | 
            +
            import "./style.css";
         | 
| 3 | 
            +
            import forEach from "lodash/forEach";
         | 
| 4 | 
            +
            import React from "react";
         | 
| 5 | 
            +
            import IntervalTree from "node-interval-tree";
         | 
| 6 | 
            +
            import getXStartAndWidthOfRowAnnotation from "../getXStartAndWidthOfRowAnnotation";
         | 
| 7 | 
            +
             | 
| 8 | 
            +
            import { getAnnotationRangeType } from "@teselagen/range-utils";
         | 
| 9 | 
            +
            import AnnotationContainerHolder from "../AnnotationContainerHolder";
         | 
| 10 | 
            +
            import AnnotationPositioner from "../AnnotationPositioner";
         | 
| 11 | 
            +
            import PointedAnnotation from "./PointedAnnotation";
         | 
| 12 | 
            +
            import { getBasesToShow } from "./primerBases";
         | 
| 13 | 
            +
             | 
| 14 | 
            +
            function StackedAnnotations(props) {
         | 
| 15 | 
            +
              const {
         | 
| 16 | 
            +
                annotationRanges = [],
         | 
| 17 | 
            +
                bpsPerRow,
         | 
| 18 | 
            +
                charWidth,
         | 
| 19 | 
            +
                containerClassName,
         | 
| 20 | 
            +
                annotationHeight,
         | 
| 21 | 
            +
                spaceBetweenAnnotations,
         | 
| 22 | 
            +
                onClick,
         | 
| 23 | 
            +
                isProtein,
         | 
| 24 | 
            +
                onDoubleClick,
         | 
| 25 | 
            +
                disregardLocations,
         | 
| 26 | 
            +
                InnerComp,
         | 
| 27 | 
            +
                onRightClick,
         | 
| 28 | 
            +
                editorName,
         | 
| 29 | 
            +
                type,
         | 
| 30 | 
            +
                readOnly,
         | 
| 31 | 
            +
                noRedux,
         | 
| 32 | 
            +
                alignmentType,
         | 
| 33 | 
            +
                getGaps,
         | 
| 34 | 
            +
                marginTop,
         | 
| 35 | 
            +
                sequenceLength,
         | 
| 36 | 
            +
                // sequence: fullSeq,
         | 
| 37 | 
            +
                fullSequence,
         | 
| 38 | 
            +
                marginBottom,
         | 
| 39 | 
            +
                truncateLabelsThatDoNotFit,
         | 
| 40 | 
            +
                getExtraInnerCompProps,
         | 
| 41 | 
            +
                onlyShowLabelsThatDoNotFit,
         | 
| 42 | 
            +
                isStriped
         | 
| 43 | 
            +
              } = props;
         | 
| 44 | 
            +
             | 
| 45 | 
            +
              const iTree = new IntervalTree(Math.ceil(bpsPerRow / 2));
         | 
| 46 | 
            +
              const InnerCompToUse = InnerComp || PointedAnnotation;
         | 
| 47 | 
            +
              if (annotationRanges.length === 0) {
         | 
| 48 | 
            +
                return null;
         | 
| 49 | 
            +
              }
         | 
| 50 | 
            +
             | 
| 51 | 
            +
              let maxAnnotationYOffset = 0;
         | 
| 52 | 
            +
              const annotationsSVG = [];
         | 
| 53 | 
            +
              let extraHeightForContainer = 0;
         | 
| 54 | 
            +
              forEach(annotationRanges, function (annotationRange, index) {
         | 
| 55 | 
            +
                if (annotationRange.yOffset > maxAnnotationYOffset) {
         | 
| 56 | 
            +
                  maxAnnotationYOffset = annotationRange.yOffset;
         | 
| 57 | 
            +
                }
         | 
| 58 | 
            +
                let { gapsBefore, gapsInside } = getGaps(annotationRange);
         | 
| 59 | 
            +
                if (alignmentType === "Parallel Part Creation") {
         | 
| 60 | 
            +
                  gapsBefore = 0;
         | 
| 61 | 
            +
                  gapsInside = 0;
         | 
| 62 | 
            +
                }
         | 
| 63 | 
            +
                const annotation = annotationRange.annotation;
         | 
| 64 | 
            +
                const annotationColor =
         | 
| 65 | 
            +
                  annotation.color ||
         | 
| 66 | 
            +
                  (annotation.type &&
         | 
| 67 | 
            +
                    getFeatureToColorMap({ includeHidden: true })[annotation.type]) ||
         | 
| 68 | 
            +
                  "#BBBBBB";
         | 
| 69 | 
            +
                const result = getXStartAndWidthOfRowAnnotation(
         | 
| 70 | 
            +
                  annotationRange,
         | 
| 71 | 
            +
                  bpsPerRow,
         | 
| 72 | 
            +
                  charWidth,
         | 
| 73 | 
            +
                  gapsBefore,
         | 
| 74 | 
            +
                  gapsInside
         | 
| 75 | 
            +
                );
         | 
| 76 | 
            +
                let top = annotationRange.yOffset * annotationHeight;
         | 
| 77 | 
            +
                if (!disregardLocations && annotationRange.containsLocations) {
         | 
| 78 | 
            +
                  top += annotationHeight / 2 - annotationHeight / 16;
         | 
| 79 | 
            +
                }
         | 
| 80 | 
            +
             | 
| 81 | 
            +
                const {
         | 
| 82 | 
            +
                  baseEl,
         | 
| 83 | 
            +
                  extraHeight = 0,
         | 
| 84 | 
            +
                  insertPaths,
         | 
| 85 | 
            +
                  insertTicks,
         | 
| 86 | 
            +
                  flipAnnotation
         | 
| 87 | 
            +
                } = getBasesToShow({
         | 
| 88 | 
            +
                  hidePrimerBases: charWidth < 8,
         | 
| 89 | 
            +
                  sequenceLength,
         | 
| 90 | 
            +
                  iTree,
         | 
| 91 | 
            +
                  fullSequence,
         | 
| 92 | 
            +
                  annotation,
         | 
| 93 | 
            +
                  annotationRange,
         | 
| 94 | 
            +
                  charWidth,
         | 
| 95 | 
            +
                  bpsPerRow
         | 
| 96 | 
            +
                });
         | 
| 97 | 
            +
             | 
| 98 | 
            +
                const anotationHeightNoSpace = annotationHeight - spaceBetweenAnnotations;
         | 
| 99 | 
            +
                extraHeightForContainer += extraHeight;
         | 
| 100 | 
            +
                annotationsSVG.push(
         | 
| 101 | 
            +
                  <AnnotationPositioner
         | 
| 102 | 
            +
                    yOffset={annotationRange.yOffset}
         | 
| 103 | 
            +
                    height={anotationHeightNoSpace + extraHeight}
         | 
| 104 | 
            +
                    width={result.width}
         | 
| 105 | 
            +
                    key={index}
         | 
| 106 | 
            +
                    top={top}
         | 
| 107 | 
            +
                    left={result.xStart}
         | 
| 108 | 
            +
                  >
         | 
| 109 | 
            +
                    <InnerCompToUse
         | 
| 110 | 
            +
                      noRedux={noRedux}
         | 
| 111 | 
            +
                      key={index}
         | 
| 112 | 
            +
                      className={annotation.className}
         | 
| 113 | 
            +
                      arrowheadType={annotation.arrowheadType}
         | 
| 114 | 
            +
                      editorName={editorName}
         | 
| 115 | 
            +
                      id={annotation.id}
         | 
| 116 | 
            +
                      fivePrimeOverhang={annotation.fivePrimeOverhang}
         | 
| 117 | 
            +
                      fivePrimeUnderhang={annotation.fivePrimeUnderhang}
         | 
| 118 | 
            +
                      fivePrimeDigestingEnzyme={annotation.fivePrimeDigestingEnzyme}
         | 
| 119 | 
            +
                      threePrimeOverhang={annotation.threePrimeOverhang}
         | 
| 120 | 
            +
                      threePrimeUnderhang={annotation.threePrimeUnderhang}
         | 
| 121 | 
            +
                      threePrimeDigestingEnzyme={annotation.threePrimeDigestingEnzyme}
         | 
| 122 | 
            +
                      onClick={onClick}
         | 
| 123 | 
            +
                      truncateLabelsThatDoNotFit={truncateLabelsThatDoNotFit}
         | 
| 124 | 
            +
                      insertPaths={insertPaths}
         | 
| 125 | 
            +
                      insertTicks={insertTicks}
         | 
| 126 | 
            +
                      onDoubleClick={onDoubleClick}
         | 
| 127 | 
            +
                      type={type}
         | 
| 128 | 
            +
                      readOnly={readOnly}
         | 
| 129 | 
            +
                      flipAnnotation={flipAnnotation}
         | 
| 130 | 
            +
                      extraHeight={extraHeight}
         | 
| 131 | 
            +
                      onRightClick={onRightClick}
         | 
| 132 | 
            +
                      annotation={annotation}
         | 
| 133 | 
            +
                      isProtein={isProtein}
         | 
| 134 | 
            +
                      isStriped={isStriped}
         | 
| 135 | 
            +
                      gapsInside={gapsInside}
         | 
| 136 | 
            +
                      gapsBefore={gapsBefore}
         | 
| 137 | 
            +
                      color={annotationColor}
         | 
| 138 | 
            +
                      width={result.width}
         | 
| 139 | 
            +
                      annotationRange={annotationRange}
         | 
| 140 | 
            +
                      widthInBps={annotationRange.end - annotationRange.start + 1}
         | 
| 141 | 
            +
                      charWidth={charWidth}
         | 
| 142 | 
            +
                      forward={annotation.forward}
         | 
| 143 | 
            +
                      onlyShowLabelsThatDoNotFit={onlyShowLabelsThatDoNotFit}
         | 
| 144 | 
            +
                      rangeType={getAnnotationRangeType(
         | 
| 145 | 
            +
                        annotationRange,
         | 
| 146 | 
            +
                        annotation,
         | 
| 147 | 
            +
                        annotation.forward
         | 
| 148 | 
            +
                      )}
         | 
| 149 | 
            +
                      {...(annotation.bases && { pointiness: 3, arrowPointiness: 0.2 })}
         | 
| 150 | 
            +
                      height={
         | 
| 151 | 
            +
                        annotationRange.containsLocations && !disregardLocations
         | 
| 152 | 
            +
                          ? anotationHeightNoSpace / 8
         | 
| 153 | 
            +
                          : anotationHeightNoSpace
         | 
| 154 | 
            +
                      }
         | 
| 155 | 
            +
                      hideName={
         | 
| 156 | 
            +
                        (type === "primer" && annotation.bases) ||
         | 
| 157 | 
            +
                        (annotationRange.containsLocations && !disregardLocations)
         | 
| 158 | 
            +
                      }
         | 
| 159 | 
            +
                      name={annotation.name}
         | 
| 160 | 
            +
                      {...(getExtraInnerCompProps &&
         | 
| 161 | 
            +
                        getExtraInnerCompProps(annotationRange, props))}
         | 
| 162 | 
            +
                    />
         | 
| 163 | 
            +
                    {baseEl}
         | 
| 164 | 
            +
                  </AnnotationPositioner>
         | 
| 165 | 
            +
                );
         | 
| 166 | 
            +
              });
         | 
| 167 | 
            +
             | 
| 168 | 
            +
              const containerHeight = (maxAnnotationYOffset + 1) * annotationHeight;
         | 
| 169 | 
            +
              return (
         | 
| 170 | 
            +
                <AnnotationContainerHolder
         | 
| 171 | 
            +
                  marginTop={marginTop}
         | 
| 172 | 
            +
                  marginBottom={marginBottom}
         | 
| 173 | 
            +
                  className={containerClassName}
         | 
| 174 | 
            +
                  containerHeight={containerHeight}
         | 
| 175 | 
            +
                  extraMargin={extraHeightForContainer}
         | 
| 176 | 
            +
                >
         | 
| 177 | 
            +
                  {annotationsSVG}
         | 
| 178 | 
            +
                </AnnotationContainerHolder>
         | 
| 179 | 
            +
              );
         | 
| 180 | 
            +
            }
         | 
| 181 | 
            +
             | 
| 182 | 
            +
            export default StackedAnnotations;
         |