@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,503 @@ | |
| 1 | 
            +
            import React from "react";
         | 
| 2 | 
            +
            import { Icon, Button, Intent, Classes, Callout } from "@blueprintjs/core";
         | 
| 3 | 
            +
            import {
         | 
| 4 | 
            +
              FileUploadField,
         | 
| 5 | 
            +
              TextareaField,
         | 
| 6 | 
            +
              EditableTextField,
         | 
| 7 | 
            +
              CheckboxField,
         | 
| 8 | 
            +
              wrapDialog
         | 
| 9 | 
            +
            } from "@teselagen/ui";
         | 
| 10 | 
            +
            import { reduxForm, FieldArray } from "redux-form";
         | 
| 11 | 
            +
            import { anyToJson } from "@teselagen/bio-parsers";
         | 
| 12 | 
            +
            import { flatMap } from "lodash";
         | 
| 13 | 
            +
            import uniqid from "shortid";
         | 
| 14 | 
            +
            import { cloneDeep } from "lodash";
         | 
| 15 | 
            +
            import classNames from "classnames";
         | 
| 16 | 
            +
             | 
| 17 | 
            +
            import ToolbarItem from "./ToolbarItem";
         | 
| 18 | 
            +
            import { connectToEditor } from "../withEditorProps";
         | 
| 19 | 
            +
            import withEditorProps from "../withEditorProps";
         | 
| 20 | 
            +
            import { showDialog } from "../GlobalDialogUtils";
         | 
| 21 | 
            +
            import { compose } from "recompose";
         | 
| 22 | 
            +
            import { array_move } from "./array_move";
         | 
| 23 | 
            +
             | 
| 24 | 
            +
            export default connectToEditor(({ readOnly, toolBar = {} }) => {
         | 
| 25 | 
            +
              return {
         | 
| 26 | 
            +
                readOnly: readOnly,
         | 
| 27 | 
            +
                isOpen: toolBar.openItem === "alignmentTool"
         | 
| 28 | 
            +
              };
         | 
| 29 | 
            +
            })(({ toolbarItemProps, isOpen }) => {
         | 
| 30 | 
            +
              return (
         | 
| 31 | 
            +
                <ToolbarItem
         | 
| 32 | 
            +
                  {...{
         | 
| 33 | 
            +
                    Icon: <Icon data-test="alignmentTool" icon="align-left" />,
         | 
| 34 | 
            +
                    // toggled: alignmentTool.isOpen,
         | 
| 35 | 
            +
                    renderIconAbove: isOpen,
         | 
| 36 | 
            +
                    // onIconClick: toggleFindTool,
         | 
| 37 | 
            +
                    Dropdown: ConnectedAlignmentToolDropdown,
         | 
| 38 | 
            +
                    onIconClick: "toggleDropdown",
         | 
| 39 | 
            +
                    noDropdownIcon: true,
         | 
| 40 | 
            +
                    tooltip: isOpen ? "Hide Alignment Tool" : "Align to This Sequence",
         | 
| 41 | 
            +
                    ...toolbarItemProps
         | 
| 42 | 
            +
                  }}
         | 
| 43 | 
            +
                />
         | 
| 44 | 
            +
              );
         | 
| 45 | 
            +
            });
         | 
| 46 | 
            +
             | 
| 47 | 
            +
            class AlignmentToolDropdown extends React.Component {
         | 
| 48 | 
            +
              render() {
         | 
| 49 | 
            +
                const {
         | 
| 50 | 
            +
                  savedAlignments = [],
         | 
| 51 | 
            +
                  hasSavedAlignments,
         | 
| 52 | 
            +
                  toggleDropdown,
         | 
| 53 | 
            +
                  sequenceData
         | 
| 54 | 
            +
                } = this.props;
         | 
| 55 | 
            +
                return (
         | 
| 56 | 
            +
                  <div>
         | 
| 57 | 
            +
                    <Button
         | 
| 58 | 
            +
                      intent={Intent.PRIMARY}
         | 
| 59 | 
            +
                      onClick={() => {
         | 
| 60 | 
            +
                        toggleDropdown();
         | 
| 61 | 
            +
                        showDialog({
         | 
| 62 | 
            +
                          dialogType: "AlignmentToolDialog",
         | 
| 63 | 
            +
                          props: {
         | 
| 64 | 
            +
                            createNewAlignment: this.props.createNewAlignment,
         | 
| 65 | 
            +
                            upsertAlignmentRun: this.props.upsertAlignmentRun,
         | 
| 66 | 
            +
                            initialValues: {
         | 
| 67 | 
            +
                              addedSequences: [{ ...sequenceData, isTemplate: true }]
         | 
| 68 | 
            +
                            }
         | 
| 69 | 
            +
                          }
         | 
| 70 | 
            +
                        });
         | 
| 71 | 
            +
                      }}
         | 
| 72 | 
            +
                    >
         | 
| 73 | 
            +
                      Create New Alignment
         | 
| 74 | 
            +
                    </Button>
         | 
| 75 | 
            +
                    <br></br>
         | 
| 76 | 
            +
                    <br></br>
         | 
| 77 | 
            +
                    <Callout intent="warning">
         | 
| 78 | 
            +
                      Note: This tool requires an alignment server to be hooked up for it to
         | 
| 79 | 
            +
                      work properly. It will NOT work in the OVE demo page.
         | 
| 80 | 
            +
                    </Callout>
         | 
| 81 | 
            +
                    <div className="vespacer" />
         | 
| 82 | 
            +
                    {hasSavedAlignments && (
         | 
| 83 | 
            +
                      <div>
         | 
| 84 | 
            +
                        <h6>Saved Alignments:</h6>
         | 
| 85 | 
            +
                        {!savedAlignments.length && (
         | 
| 86 | 
            +
                          <div style={{ fontStyle: "italic" }}> No Alignments</div>
         | 
| 87 | 
            +
                        )}
         | 
| 88 | 
            +
                        {savedAlignments.map((savedAlignment, i) => {
         | 
| 89 | 
            +
                          return <div key={i}>Saved Alignment {i}</div>;
         | 
| 90 | 
            +
                        })}
         | 
| 91 | 
            +
                      </div>
         | 
| 92 | 
            +
                    )}
         | 
| 93 | 
            +
                  </div>
         | 
| 94 | 
            +
                );
         | 
| 95 | 
            +
              }
         | 
| 96 | 
            +
            }
         | 
| 97 | 
            +
            const ConnectedAlignmentToolDropdown = withEditorProps(AlignmentToolDropdown);
         | 
| 98 | 
            +
             | 
| 99 | 
            +
            class AlignmentTool extends React.Component {
         | 
| 100 | 
            +
              state = {
         | 
| 101 | 
            +
                templateSeqIndex: 0
         | 
| 102 | 
            +
              };
         | 
| 103 | 
            +
              sendSelectedDataToBackendForAlignment = async (values) => {
         | 
| 104 | 
            +
                const {
         | 
| 105 | 
            +
                  addedSequences,
         | 
| 106 | 
            +
                  isPairwiseAlignment,
         | 
| 107 | 
            +
                  isAlignToRefSeq,
         | 
| 108 | 
            +
                  isAutotrimmedSeq
         | 
| 109 | 
            +
                } = values;
         | 
| 110 | 
            +
                const {
         | 
| 111 | 
            +
                  hideModal,
         | 
| 112 | 
            +
                  /* onAlignmentSuccess, */ createNewAlignment,
         | 
| 113 | 
            +
                  // createNewMismatchesList,
         | 
| 114 | 
            +
                  upsertAlignmentRun
         | 
| 115 | 
            +
                } = this.props;
         | 
| 116 | 
            +
                const { templateSeqIndex } = this.state;
         | 
| 117 | 
            +
                const addedSequencesToUse = array_move(addedSequences, templateSeqIndex, 0);
         | 
| 118 | 
            +
             | 
| 119 | 
            +
                let addedSequencesToUseTrimmed;
         | 
| 120 | 
            +
                if (isAutotrimmedSeq) {
         | 
| 121 | 
            +
                  addedSequencesToUseTrimmed = cloneDeep(addedSequencesToUse);
         | 
| 122 | 
            +
                  // trimming any sequences with chromatogram data
         | 
| 123 | 
            +
                  for (let i = 0; i < addedSequencesToUseTrimmed.length; i++) {
         | 
| 124 | 
            +
                    if ("chromatogramData" in addedSequencesToUseTrimmed[i]) {
         | 
| 125 | 
            +
                      // if (addedSequencesToUseTrimmed[i].chromatogramData.qualNums) {
         | 
| 126 | 
            +
                      if ("qualNums" in addedSequencesToUseTrimmed[i].chromatogramData) {
         | 
| 127 | 
            +
                        // returning bp pos for { suggestedTrimStart, suggestedTrimEnd }
         | 
| 128 | 
            +
                        const { suggestedTrimStart, suggestedTrimEnd } = mottTrim(
         | 
| 129 | 
            +
                          addedSequencesToUseTrimmed[i].chromatogramData.qualNums
         | 
| 130 | 
            +
                        );
         | 
| 131 | 
            +
                        addedSequencesToUseTrimmed[i].sequence = addedSequencesToUseTrimmed[
         | 
| 132 | 
            +
                          i
         | 
| 133 | 
            +
                        ].sequence.slice(suggestedTrimStart, suggestedTrimEnd + 1);
         | 
| 134 | 
            +
                        const elementsToTrim = ["baseCalls", "basePos", "qualNums"];
         | 
| 135 | 
            +
                        // eslint-disable-next-line no-unused-vars
         | 
| 136 | 
            +
                        for (const element in addedSequencesToUseTrimmed[i]
         | 
| 137 | 
            +
                          .chromatogramData) {
         | 
| 138 | 
            +
                          if (elementsToTrim.indexOf(element) !== -1) {
         | 
| 139 | 
            +
                            addedSequencesToUseTrimmed[i].chromatogramData[element] =
         | 
| 140 | 
            +
                              addedSequencesToUseTrimmed[i].chromatogramData[element].slice(
         | 
| 141 | 
            +
                                suggestedTrimStart,
         | 
| 142 | 
            +
                                suggestedTrimEnd + 1
         | 
| 143 | 
            +
                              );
         | 
| 144 | 
            +
                          }
         | 
| 145 | 
            +
                        }
         | 
| 146 | 
            +
                      }
         | 
| 147 | 
            +
                    }
         | 
| 148 | 
            +
                  }
         | 
| 149 | 
            +
                }
         | 
| 150 | 
            +
                let seqsToAlign;
         | 
| 151 | 
            +
                if (addedSequencesToUseTrimmed) {
         | 
| 152 | 
            +
                  seqsToAlign = addedSequencesToUseTrimmed;
         | 
| 153 | 
            +
                } else {
         | 
| 154 | 
            +
                  seqsToAlign = addedSequencesToUse;
         | 
| 155 | 
            +
                }
         | 
| 156 | 
            +
             | 
| 157 | 
            +
                hideModal();
         | 
| 158 | 
            +
                const alignmentId = uniqid();
         | 
| 159 | 
            +
                // const alignmentIdMismatches = uniqid();
         | 
| 160 | 
            +
                createNewAlignment({
         | 
| 161 | 
            +
                  id: alignmentId,
         | 
| 162 | 
            +
                  name: seqsToAlign[0].name + " Alignment"
         | 
| 163 | 
            +
                });
         | 
| 164 | 
            +
                //set the alignment to loading
         | 
| 165 | 
            +
                upsertAlignmentRun({
         | 
| 166 | 
            +
                  id: alignmentId,
         | 
| 167 | 
            +
                  loading: true
         | 
| 168 | 
            +
                });
         | 
| 169 | 
            +
                // createNewMismatchesList({
         | 
| 170 | 
            +
                //   id: alignmentIdMismatches,
         | 
| 171 | 
            +
                //   name: addedSequencesToUse[0].name + " Mismatches",
         | 
| 172 | 
            +
                //   alignmentId: alignmentId
         | 
| 173 | 
            +
                // });
         | 
| 174 | 
            +
             | 
| 175 | 
            +
                // const j5server = process.env.REMOTE_J5 || "http://j5server.teselagen.com"
         | 
| 176 | 
            +
             | 
| 177 | 
            +
                window.toastr.success("Alignment submitted.");
         | 
| 178 | 
            +
                const replaceProtocol = (url) => {
         | 
| 179 | 
            +
                  return url.replace("http://", window.location.protocol + "//");
         | 
| 180 | 
            +
                };
         | 
| 181 | 
            +
             | 
| 182 | 
            +
                const seqInfoToSend = seqsToAlign.map(({ sequence, name, id }) => {
         | 
| 183 | 
            +
                  return {
         | 
| 184 | 
            +
                    sequence,
         | 
| 185 | 
            +
                    name,
         | 
| 186 | 
            +
                    id
         | 
| 187 | 
            +
                  };
         | 
| 188 | 
            +
                });
         | 
| 189 | 
            +
             | 
| 190 | 
            +
                const {
         | 
| 191 | 
            +
                  alignedSequences: _alignedSequences,
         | 
| 192 | 
            +
                  pairwiseAlignments,
         | 
| 193 | 
            +
                  alignmentsToRefSeq
         | 
| 194 | 
            +
                } = await (
         | 
| 195 | 
            +
                  await fetch({
         | 
| 196 | 
            +
                    url: replaceProtocol("http://j5server.teselagen.com/alignment/run"),
         | 
| 197 | 
            +
                    method: "post",
         | 
| 198 | 
            +
                    body: JSON.stringify({
         | 
| 199 | 
            +
                      //only send over the bear necessities :)
         | 
| 200 | 
            +
                      sequencesToAlign: seqInfoToSend,
         | 
| 201 | 
            +
                      isPairwiseAlignment,
         | 
| 202 | 
            +
                      isAlignToRefSeq
         | 
| 203 | 
            +
                    })
         | 
| 204 | 
            +
                  })
         | 
| 205 | 
            +
                ).json();
         | 
| 206 | 
            +
             | 
| 207 | 
            +
                // alignmentsToRefSeq set to alignedSequences for now
         | 
| 208 | 
            +
                let alignedSequences = _alignedSequences;
         | 
| 209 | 
            +
                if (alignmentsToRefSeq) {
         | 
| 210 | 
            +
                  alignedSequences = alignmentsToRefSeq;
         | 
| 211 | 
            +
                }
         | 
| 212 | 
            +
                if (!alignedSequences && !pairwiseAlignments)
         | 
| 213 | 
            +
                  window.toastr.error("Error running sequence alignment!");
         | 
| 214 | 
            +
                //set the alignment to loading
         | 
| 215 | 
            +
                upsertAlignmentRun({
         | 
| 216 | 
            +
                  id: alignmentId,
         | 
| 217 | 
            +
                  pairwiseAlignments:
         | 
| 218 | 
            +
                    pairwiseAlignments &&
         | 
| 219 | 
            +
                    pairwiseAlignments.map((alignedSequences, topIndex) => {
         | 
| 220 | 
            +
                      return alignedSequences.map((alignmentData, innerIndex) => {
         | 
| 221 | 
            +
                        return {
         | 
| 222 | 
            +
                          sequenceData: seqsToAlign[innerIndex > 0 ? topIndex + 1 : 0],
         | 
| 223 | 
            +
                          alignmentData,
         | 
| 224 | 
            +
                          chromatogramData: seqsToAlign[innerIndex].chromatogramData
         | 
| 225 | 
            +
                        };
         | 
| 226 | 
            +
                      });
         | 
| 227 | 
            +
                    }),
         | 
| 228 | 
            +
                  alignmentTracks:
         | 
| 229 | 
            +
                    alignedSequences &&
         | 
| 230 | 
            +
                    alignedSequences.map((alignmentData) => {
         | 
| 231 | 
            +
                      return {
         | 
| 232 | 
            +
                        sequenceData:
         | 
| 233 | 
            +
                          seqsToAlign[
         | 
| 234 | 
            +
                            alignmentData.name.slice(0, alignmentData.name.indexOf("_"))
         | 
| 235 | 
            +
                          ],
         | 
| 236 | 
            +
                        alignmentData,
         | 
| 237 | 
            +
                        chromatogramData:
         | 
| 238 | 
            +
                          seqsToAlign[
         | 
| 239 | 
            +
                            alignmentData.name.slice(0, alignmentData.name.indexOf("_"))
         | 
| 240 | 
            +
                          ].chromatogramData
         | 
| 241 | 
            +
                      };
         | 
| 242 | 
            +
                    })
         | 
| 243 | 
            +
                  // alignmentTracks:
         | 
| 244 | 
            +
                  //   alignedSequences &&
         | 
| 245 | 
            +
                  //   alignedSequences.map((alignmentData, i) => {
         | 
| 246 | 
            +
                  //     return {
         | 
| 247 | 
            +
                  //       sequenceData: addedSequencesToUse[i],
         | 
| 248 | 
            +
                  //       alignmentData,
         | 
| 249 | 
            +
                  //       chromatogramData: addedSequencesToUse[i].chromatogramData
         | 
| 250 | 
            +
                  //     };
         | 
| 251 | 
            +
                  //   })
         | 
| 252 | 
            +
                });
         | 
| 253 | 
            +
              };
         | 
| 254 | 
            +
             | 
| 255 | 
            +
              handleFileUpload = (files, onChange) => {
         | 
| 256 | 
            +
                const { array } = this.props;
         | 
| 257 | 
            +
                flatMap(files, async (file) => {
         | 
| 258 | 
            +
                  const results = await anyToJson(file.originalFileObj, {
         | 
| 259 | 
            +
                    fileName: file.name,
         | 
| 260 | 
            +
                    acceptParts: true
         | 
| 261 | 
            +
                  });
         | 
| 262 | 
            +
                  return results.forEach((result) => {
         | 
| 263 | 
            +
                    if (result.success) {
         | 
| 264 | 
            +
                      array.push("addedSequences", result.parsedSequence);
         | 
| 265 | 
            +
                    } else {
         | 
| 266 | 
            +
                      return window.toastr.warning("Error parsing file: ", file.name);
         | 
| 267 | 
            +
                    }
         | 
| 268 | 
            +
                  });
         | 
| 269 | 
            +
                });
         | 
| 270 | 
            +
                onChange([]);
         | 
| 271 | 
            +
              };
         | 
| 272 | 
            +
              renderAddSequence = ({ fields, templateSeqIndex }) => {
         | 
| 273 | 
            +
                const { handleSubmit } = this.props;
         | 
| 274 | 
            +
             | 
| 275 | 
            +
                const sequencesToAlign = fields.getAll() || [];
         | 
| 276 | 
            +
                return (
         | 
| 277 | 
            +
                  <div>
         | 
| 278 | 
            +
                    <h6>Or enter sequences in plain text format</h6>
         | 
| 279 | 
            +
                    <div>
         | 
| 280 | 
            +
                      <AddYourOwnSeqForm
         | 
| 281 | 
            +
                        addSeq={(newSeq) => {
         | 
| 282 | 
            +
                          fields.push(newSeq);
         | 
| 283 | 
            +
                        }}
         | 
| 284 | 
            +
                      />
         | 
| 285 | 
            +
                      <h6 style={{ marginTop: 15 }}>Sequences To Align: </h6>
         | 
| 286 | 
            +
                      {!fields.getAll() && <div>No sequences added yet.</div>}
         | 
| 287 | 
            +
                      <div
         | 
| 288 | 
            +
                        style={{ maxHeight: 180, overflowY: "auto" }}
         | 
| 289 | 
            +
                        className="veAlignmentToolSelectedSequenceList"
         | 
| 290 | 
            +
                      >
         | 
| 291 | 
            +
                        {sequencesToAlign.map((addedSeq, index) => {
         | 
| 292 | 
            +
                          return (
         | 
| 293 | 
            +
                            <div
         | 
| 294 | 
            +
                              onClick={() => {
         | 
| 295 | 
            +
                                this.setState({
         | 
| 296 | 
            +
                                  templateSeqIndex: index
         | 
| 297 | 
            +
                                });
         | 
| 298 | 
            +
                              }}
         | 
| 299 | 
            +
                              style={{
         | 
| 300 | 
            +
                                borderBottom: "1px solid lightgrey",
         | 
| 301 | 
            +
                                paddingBottom: 4,
         | 
| 302 | 
            +
                                marginBottom: 4,
         | 
| 303 | 
            +
                                width: "100%",
         | 
| 304 | 
            +
                                justifyContent: "space-between",
         | 
| 305 | 
            +
                                alignItems: "center",
         | 
| 306 | 
            +
                                display: "flex"
         | 
| 307 | 
            +
                              }}
         | 
| 308 | 
            +
                              key={index}
         | 
| 309 | 
            +
                            >
         | 
| 310 | 
            +
                              <div>
         | 
| 311 | 
            +
                                {addedSeq.name}{" "}
         | 
| 312 | 
            +
                                <span style={{ fontSize: 10 }}>
         | 
| 313 | 
            +
                                  {" "}
         | 
| 314 | 
            +
                                  ({addedSeq.sequence.length} bps)
         | 
| 315 | 
            +
                                </span>
         | 
| 316 | 
            +
                              </div>
         | 
| 317 | 
            +
                              {index === templateSeqIndex && (
         | 
| 318 | 
            +
                                <div
         | 
| 319 | 
            +
                                  className={classNames(
         | 
| 320 | 
            +
                                    Classes.TAG,
         | 
| 321 | 
            +
                                    Classes.ROUND,
         | 
| 322 | 
            +
                                    Classes.INTENT_PRIMARY
         | 
| 323 | 
            +
                                  )}
         | 
| 324 | 
            +
                                >
         | 
| 325 | 
            +
                                  template
         | 
| 326 | 
            +
                                </div>
         | 
| 327 | 
            +
                              )}
         | 
| 328 | 
            +
             | 
| 329 | 
            +
                              <Button
         | 
| 330 | 
            +
                                onClick={(e) => {
         | 
| 331 | 
            +
                                  e.stopPropagation();
         | 
| 332 | 
            +
                                  e.preventDefault();
         | 
| 333 | 
            +
                                  fields.remove(index);
         | 
| 334 | 
            +
                                  if (index === templateSeqIndex) {
         | 
| 335 | 
            +
                                    this.setState({ templateSeqIndex: 0 });
         | 
| 336 | 
            +
                                  }
         | 
| 337 | 
            +
                                }}
         | 
| 338 | 
            +
                              >
         | 
| 339 | 
            +
                                Remove
         | 
| 340 | 
            +
                              </Button>
         | 
| 341 | 
            +
                            </div>
         | 
| 342 | 
            +
                          );
         | 
| 343 | 
            +
                        })}
         | 
| 344 | 
            +
                      </div>
         | 
| 345 | 
            +
                      <br />
         | 
| 346 | 
            +
                      <CheckboxField
         | 
| 347 | 
            +
                        name="isPairwiseAlignment"
         | 
| 348 | 
            +
                        style={{ display: "flex", alignItems: "center" }}
         | 
| 349 | 
            +
                        label={
         | 
| 350 | 
            +
                          <div>
         | 
| 351 | 
            +
                            Create Pairwise Alignment{" "}
         | 
| 352 | 
            +
                            <span style={{ fontSize: 11 }}>
         | 
| 353 | 
            +
                              Individually align each uploaded file against the template
         | 
| 354 | 
            +
                              sequence (instead of creating a single Multiple Sequence
         | 
| 355 | 
            +
                              Alignment)
         | 
| 356 | 
            +
                            </span>
         | 
| 357 | 
            +
                          </div>
         | 
| 358 | 
            +
                        }
         | 
| 359 | 
            +
                      />
         | 
| 360 | 
            +
                      <CheckboxField
         | 
| 361 | 
            +
                        name="isAlignToRefSeq"
         | 
| 362 | 
            +
                        style={{ display: "flex", alignItems: "center" }}
         | 
| 363 | 
            +
                        label={
         | 
| 364 | 
            +
                          <div>
         | 
| 365 | 
            +
                            Align Sequencing Reads to Reference Sequence{" "}
         | 
| 366 | 
            +
                            <span style={{ fontSize: 11 }}>
         | 
| 367 | 
            +
                              Align short sequencing reads to a long reference sequence
         | 
| 368 | 
            +
                            </span>
         | 
| 369 | 
            +
                          </div>
         | 
| 370 | 
            +
                        }
         | 
| 371 | 
            +
                      />
         | 
| 372 | 
            +
                      <CheckboxField
         | 
| 373 | 
            +
                        name="isAutotrimmedSeq"
         | 
| 374 | 
            +
                        style={{ display: "flex", alignItems: "center" }}
         | 
| 375 | 
            +
                        label={
         | 
| 376 | 
            +
                          <div>
         | 
| 377 | 
            +
                            Auto-Trim Sequences{" "}
         | 
| 378 | 
            +
                            <span style={{ fontSize: 11 }}>
         | 
| 379 | 
            +
                              Automatically trim low-quality ends of sequences based on
         | 
| 380 | 
            +
                              quality scores
         | 
| 381 | 
            +
                            </span>
         | 
| 382 | 
            +
                          </div>
         | 
| 383 | 
            +
                        }
         | 
| 384 | 
            +
                      />
         | 
| 385 | 
            +
             | 
| 386 | 
            +
                      <Button
         | 
| 387 | 
            +
                        style={{ marginTop: 15, float: "right" }}
         | 
| 388 | 
            +
                        intent={Intent.PRIMARY}
         | 
| 389 | 
            +
                        disabled={sequencesToAlign.length < 2}
         | 
| 390 | 
            +
                        onClick={handleSubmit(this.sendSelectedDataToBackendForAlignment)}
         | 
| 391 | 
            +
                      >
         | 
| 392 | 
            +
                        Create alignment
         | 
| 393 | 
            +
                      </Button>
         | 
| 394 | 
            +
                    </div>
         | 
| 395 | 
            +
                  </div>
         | 
| 396 | 
            +
                );
         | 
| 397 | 
            +
              };
         | 
| 398 | 
            +
             | 
| 399 | 
            +
              render() {
         | 
| 400 | 
            +
                const { selectFromSequenceLibraryHook } = this.props;
         | 
| 401 | 
            +
                const { templateSeqIndex } = this.state;
         | 
| 402 | 
            +
                return (
         | 
| 403 | 
            +
                  <div style={{ padding: 20 }} className="veAlignmentTool">
         | 
| 404 | 
            +
                    <h6>Upload files you'd like to align (.ab1, .fasta, .gb) </h6>
         | 
| 405 | 
            +
                    <FileUploadField
         | 
| 406 | 
            +
                      name="alignmentToolSequenceUpload"
         | 
| 407 | 
            +
                      style={{ maxWidth: 400 }}
         | 
| 408 | 
            +
                      beforeUpload={this.handleFileUpload}
         | 
| 409 | 
            +
                    />
         | 
| 410 | 
            +
                    {selectFromSequenceLibraryHook && (
         | 
| 411 | 
            +
                      <h6>Or Select from your sequence library </h6>
         | 
| 412 | 
            +
                    )}
         | 
| 413 | 
            +
             | 
| 414 | 
            +
                    <FieldArray
         | 
| 415 | 
            +
                      name="addedSequences"
         | 
| 416 | 
            +
                      templateSeqIndex={templateSeqIndex}
         | 
| 417 | 
            +
                      component={this.renderAddSequence}
         | 
| 418 | 
            +
                    />
         | 
| 419 | 
            +
                  </div>
         | 
| 420 | 
            +
                );
         | 
| 421 | 
            +
              }
         | 
| 422 | 
            +
            }
         | 
| 423 | 
            +
             | 
| 424 | 
            +
            export const AlignmentToolDialog = compose(
         | 
| 425 | 
            +
              wrapDialog({ title: "Create New Alignment" }),
         | 
| 426 | 
            +
              reduxForm({
         | 
| 427 | 
            +
                form: "veAlignmentTool"
         | 
| 428 | 
            +
              })
         | 
| 429 | 
            +
            )(AlignmentTool);
         | 
| 430 | 
            +
             | 
| 431 | 
            +
            const AddYourOwnSeqForm = reduxForm({
         | 
| 432 | 
            +
              form: "AddYourOwnSeqForm",
         | 
| 433 | 
            +
              validate: ({ name, sequence }) => {
         | 
| 434 | 
            +
                const errors = {};
         | 
| 435 | 
            +
                if (!name) {
         | 
| 436 | 
            +
                  errors.name = "Required";
         | 
| 437 | 
            +
                }
         | 
| 438 | 
            +
                if (!sequence) {
         | 
| 439 | 
            +
                  errors.sequence = "Required";
         | 
| 440 | 
            +
                }
         | 
| 441 | 
            +
                return errors;
         | 
| 442 | 
            +
              }
         | 
| 443 | 
            +
            })(({ pristine, error, handleSubmit, reset, addSeq }) => {
         | 
| 444 | 
            +
              return (
         | 
| 445 | 
            +
                <form
         | 
| 446 | 
            +
                  onSubmit={handleSubmit((vals) => {
         | 
| 447 | 
            +
                    reset();
         | 
| 448 | 
            +
                    addSeq(vals);
         | 
| 449 | 
            +
                  })}
         | 
| 450 | 
            +
                >
         | 
| 451 | 
            +
                  <EditableTextField
         | 
| 452 | 
            +
                    style={{ maxWidth: 200 }}
         | 
| 453 | 
            +
                    placeholder="Untitled Sequence"
         | 
| 454 | 
            +
                    name="name"
         | 
| 455 | 
            +
                  />
         | 
| 456 | 
            +
                  <TextareaField
         | 
| 457 | 
            +
                    style={{ maxWidth: 400 }}
         | 
| 458 | 
            +
                    placeholder="AGTTGAGC"
         | 
| 459 | 
            +
                    name="sequence"
         | 
| 460 | 
            +
                  />
         | 
| 461 | 
            +
                  <Button disabled={pristine || error} type="submit">
         | 
| 462 | 
            +
                    Add
         | 
| 463 | 
            +
                  </Button>
         | 
| 464 | 
            +
                </form>
         | 
| 465 | 
            +
              );
         | 
| 466 | 
            +
            });
         | 
| 467 | 
            +
             | 
| 468 | 
            +
            function mottTrim(qualNums) {
         | 
| 469 | 
            +
              if (!qualNums) return;
         | 
| 470 | 
            +
              let startPos = 0;
         | 
| 471 | 
            +
              let endPos = 0;
         | 
| 472 | 
            +
              const totalScoreInfo = [];
         | 
| 473 | 
            +
              let score = 0;
         | 
| 474 | 
            +
              let totalScore = 0;
         | 
| 475 | 
            +
              const cutoff = 0.05;
         | 
| 476 | 
            +
              for (let i = 0; i < qualNums.length; i++) {
         | 
| 477 | 
            +
                // low-quality bases have high error probabilities, so may have a negative base score
         | 
| 478 | 
            +
                score = cutoff - Math.pow(10, qualNums[i] / -10);
         | 
| 479 | 
            +
                totalScore += score;
         | 
| 480 | 
            +
                totalScoreInfo.push(totalScore);
         | 
| 481 | 
            +
                // score = score + cutoff - Math.pow(10, qualNums[i] / -10);
         | 
| 482 | 
            +
                // if (totalScore < 0) {
         | 
| 483 | 
            +
                //   tempStart = i;
         | 
| 484 | 
            +
                // }
         | 
| 485 | 
            +
                // if (i - tempStart > endPos - startPos) {
         | 
| 486 | 
            +
                //   startPos = tempStart;
         | 
| 487 | 
            +
                //   endPos = i;
         | 
| 488 | 
            +
                // }
         | 
| 489 | 
            +
                if (totalScore < 0) {
         | 
| 490 | 
            +
                  totalScore = 0;
         | 
| 491 | 
            +
                }
         | 
| 492 | 
            +
              }
         | 
| 493 | 
            +
              const firstPositiveValue = totalScoreInfo.find((e) => {
         | 
| 494 | 
            +
                return e > 0;
         | 
| 495 | 
            +
              });
         | 
| 496 | 
            +
              startPos = totalScoreInfo.indexOf(firstPositiveValue);
         | 
| 497 | 
            +
              const highestValue = Math.max(...totalScoreInfo);
         | 
| 498 | 
            +
              endPos = totalScoreInfo.lastIndexOf(highestValue);
         | 
| 499 | 
            +
              return {
         | 
| 500 | 
            +
                suggestedTrimStart: startPos,
         | 
| 501 | 
            +
                suggestedTrimEnd: endPos
         | 
| 502 | 
            +
              };
         | 
| 503 | 
            +
            }
         | 
| @@ -0,0 +1,10 @@ | |
| 1 | 
            +
            export function array_move(arr, old_index, new_index) {
         | 
| 2 | 
            +
              if (new_index >= arr.length) {
         | 
| 3 | 
            +
                let k = new_index - arr.length + 1;
         | 
| 4 | 
            +
                while (k--) {
         | 
| 5 | 
            +
                  arr.push(undefined);
         | 
| 6 | 
            +
                }
         | 
| 7 | 
            +
              }
         | 
| 8 | 
            +
              arr.splice(new_index, 0, arr.splice(old_index, 1)[0]);
         | 
| 9 | 
            +
              return arr; // for testing
         | 
| 10 | 
            +
            }
         | 
| @@ -0,0 +1,88 @@ | |
| 1 | 
            +
            import { Icon, Button, KeyCombo } from "@blueprintjs/core";
         | 
| 2 | 
            +
            import CutsiteFilter from "../CutsiteFilter";
         | 
| 3 | 
            +
            import React from "react";
         | 
| 4 | 
            +
            import ToolbarItem from "./ToolbarItem";
         | 
| 5 | 
            +
            import { connectToEditor } from "../withEditorProps";
         | 
| 6 | 
            +
            import { userDefinedHandlersAndOpts } from "../Editor/userDefinedHandlersAndOpts";
         | 
| 7 | 
            +
            import { pick } from "lodash";
         | 
| 8 | 
            +
             | 
| 9 | 
            +
            export default connectToEditor(
         | 
| 10 | 
            +
              ({ readOnly, annotationVisibility = {}, toolBar = {} }) => {
         | 
| 11 | 
            +
                return {
         | 
| 12 | 
            +
                  readOnly,
         | 
| 13 | 
            +
                  toggled: annotationVisibility.cutsites,
         | 
| 14 | 
            +
                  isOpen: toolBar.openItem === "cutsiteTool"
         | 
| 15 | 
            +
                };
         | 
| 16 | 
            +
              }
         | 
| 17 | 
            +
            )(({ toolbarItemProps, toggled, isOpen, annotationVisibilityToggle }) => {
         | 
| 18 | 
            +
              return (
         | 
| 19 | 
            +
                <ToolbarItem
         | 
| 20 | 
            +
                  {...{
         | 
| 21 | 
            +
                    Icon: <Icon data-test="cutsiteHideShowTool" icon="cut" />,
         | 
| 22 | 
            +
                    onIconClick: function () {
         | 
| 23 | 
            +
                      annotationVisibilityToggle("cutsites");
         | 
| 24 | 
            +
                    },
         | 
| 25 | 
            +
                    toggled,
         | 
| 26 | 
            +
                    tooltip: "Show cut sites",
         | 
| 27 | 
            +
                    tooltipToggled: "Hide cut sites",
         | 
| 28 | 
            +
                    Dropdown: CutsiteToolDropDown,
         | 
| 29 | 
            +
                    dropdowntooltip: (!isOpen ? "Show" : "Hide") + " Cut Site Options",
         | 
| 30 | 
            +
                    ...toolbarItemProps
         | 
| 31 | 
            +
                  }}
         | 
| 32 | 
            +
                />
         | 
| 33 | 
            +
              );
         | 
| 34 | 
            +
            });
         | 
| 35 | 
            +
            // import show_cut_sites_img from "./veToolbarIcons/show_cut_sites.png";
         | 
| 36 | 
            +
             | 
| 37 | 
            +
            // function CutsiteToolIcon({ annotationVisibilityToggle }) {
         | 
| 38 | 
            +
            //   return (
         | 
| 39 | 
            +
            //     <div
         | 
| 40 | 
            +
            //       onClick={function() {
         | 
| 41 | 
            +
            //         annotationVisibilityToggle("cutsites");
         | 
| 42 | 
            +
            //       }}
         | 
| 43 | 
            +
            //     >
         | 
| 44 | 
            +
            //       <img src={show_cut_sites_img} alt="Show cut sites" />
         | 
| 45 | 
            +
            //     </div>
         | 
| 46 | 
            +
            //   );
         | 
| 47 | 
            +
            // }
         | 
| 48 | 
            +
             | 
| 49 | 
            +
            function CutsiteToolDropDown({
         | 
| 50 | 
            +
              editorName,
         | 
| 51 | 
            +
              toggleDropdown,
         | 
| 52 | 
            +
              annotationVisibilityShow,
         | 
| 53 | 
            +
              withDigestTool,
         | 
| 54 | 
            +
              createNewDigest,
         | 
| 55 | 
            +
             | 
| 56 | 
            +
              ...rest
         | 
| 57 | 
            +
            }) {
         | 
| 58 | 
            +
              return (
         | 
| 59 | 
            +
                <div className="veToolbarCutsiteFilterHolder">
         | 
| 60 | 
            +
                  <h6>
         | 
| 61 | 
            +
                    Filter Cut Sites{" "}
         | 
| 62 | 
            +
                    <span style={{ fontSize: 12, color: "grey" }}>
         | 
| 63 | 
            +
                      (Search by name or # of cuts)
         | 
| 64 | 
            +
                    </span>
         | 
| 65 | 
            +
                  </h6>
         | 
| 66 | 
            +
                  <CutsiteFilter
         | 
| 67 | 
            +
                    {...pick(rest, userDefinedHandlersAndOpts)}
         | 
| 68 | 
            +
                    editorName={editorName}
         | 
| 69 | 
            +
                    onChangeHook={function () {
         | 
| 70 | 
            +
                      annotationVisibilityShow("cutsites");
         | 
| 71 | 
            +
                    }}
         | 
| 72 | 
            +
                    closeDropDown={toggleDropdown}
         | 
| 73 | 
            +
                  />
         | 
| 74 | 
            +
                  {withDigestTool && (
         | 
| 75 | 
            +
                    <Button
         | 
| 76 | 
            +
                      onClick={() => {
         | 
| 77 | 
            +
                        createNewDigest();
         | 
| 78 | 
            +
                        toggleDropdown();
         | 
| 79 | 
            +
                      }}
         | 
| 80 | 
            +
                    >
         | 
| 81 | 
            +
                      <span style={{ display: "flex" }}>
         | 
| 82 | 
            +
                        Virtual Digest   <KeyCombo minimal combo="mod+shift+d" />
         | 
| 83 | 
            +
                      </span>
         | 
| 84 | 
            +
                    </Button>
         | 
| 85 | 
            +
                  )}
         | 
| 86 | 
            +
                </div>
         | 
| 87 | 
            +
              );
         | 
| 88 | 
            +
            }
         | 
| @@ -0,0 +1,38 @@ | |
| 1 | 
            +
            import React from "react";
         | 
| 2 | 
            +
            import { Icon, Menu } from "@blueprintjs/core";
         | 
| 3 | 
            +
            import { createCommandMenu } from "@teselagen/ui";
         | 
| 4 | 
            +
            import getCommands from "../commands";
         | 
| 5 | 
            +
             | 
| 6 | 
            +
            import { connectToEditor } from "../withEditorProps";
         | 
| 7 | 
            +
            import ToolbarItem from "./ToolbarItem";
         | 
| 8 | 
            +
            import withEditorProps from "../withEditorProps";
         | 
| 9 | 
            +
             | 
| 10 | 
            +
            export default connectToEditor()(({ toolbarItemProps }) => {
         | 
| 11 | 
            +
              return (
         | 
| 12 | 
            +
                <ToolbarItem
         | 
| 13 | 
            +
                  {...{
         | 
| 14 | 
            +
                    tooltip: "Export",
         | 
| 15 | 
            +
                    Dropdown,
         | 
| 16 | 
            +
                    noDropdownIcon: true,
         | 
| 17 | 
            +
                    onIconClick: "toggleDropdown",
         | 
| 18 | 
            +
                    Icon: <Icon data-test="veDownloadTool" icon="import" />,
         | 
| 19 | 
            +
                    ...toolbarItemProps
         | 
| 20 | 
            +
                  }}
         | 
| 21 | 
            +
                />
         | 
| 22 | 
            +
              );
         | 
| 23 | 
            +
            });
         | 
| 24 | 
            +
             | 
| 25 | 
            +
            const Dropdown = withEditorProps(props => {
         | 
| 26 | 
            +
              return (
         | 
| 27 | 
            +
                <Menu>
         | 
| 28 | 
            +
                  {createCommandMenu(
         | 
| 29 | 
            +
                    [
         | 
| 30 | 
            +
                      "exportSequenceAsGenbank",
         | 
| 31 | 
            +
                      "exportSequenceAsFasta",
         | 
| 32 | 
            +
                      "exportSequenceAsTeselagenJson"
         | 
| 33 | 
            +
                    ],
         | 
| 34 | 
            +
                    getCommands({ props })
         | 
| 35 | 
            +
                  )}
         | 
| 36 | 
            +
                </Menu>
         | 
| 37 | 
            +
              );
         | 
| 38 | 
            +
            });
         | 
| @@ -0,0 +1,26 @@ | |
| 1 | 
            +
            import { Icon } from "@blueprintjs/core";
         | 
| 2 | 
            +
            import React from "react";
         | 
| 3 | 
            +
            import ToolbarItem from "./ToolbarItem";
         | 
| 4 | 
            +
            import { connectToEditor } from "../withEditorProps";
         | 
| 5 | 
            +
             | 
| 6 | 
            +
            export default connectToEditor((editorState) => {
         | 
| 7 | 
            +
              return {
         | 
| 8 | 
            +
                readOnly: editorState.readOnly
         | 
| 9 | 
            +
              };
         | 
| 10 | 
            +
            })(({ toolbarItemProps, readOnly, toggleReadOnlyMode, disableSetReadOnly }) => {
         | 
| 11 | 
            +
              return (
         | 
| 12 | 
            +
                <ToolbarItem
         | 
| 13 | 
            +
                  {...{
         | 
| 14 | 
            +
                    disabled: disableSetReadOnly,
         | 
| 15 | 
            +
                    Icon: <Icon icon={readOnly ? "lock" : "unlock"} />,
         | 
| 16 | 
            +
                    onIconClick: toggleReadOnlyMode,
         | 
| 17 | 
            +
                    tooltip: readOnly ? (
         | 
| 18 | 
            +
                      <span>Switch to edit mode</span>
         | 
| 19 | 
            +
                    ) : (
         | 
| 20 | 
            +
                      <span>Switch to read only mode</span>
         | 
| 21 | 
            +
                    ),
         | 
| 22 | 
            +
                    ...toolbarItemProps
         | 
| 23 | 
            +
                  }}
         | 
| 24 | 
            +
                />
         | 
| 25 | 
            +
              );
         | 
| 26 | 
            +
            });
         | 
| @@ -0,0 +1,34 @@ | |
| 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 | 
            +
            });
         |