Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
if (payloadToUse.pairwiseAlignments) {
if (
payloadToUse.pairwiseAlignments[0][0].alignmentData.matchStart !==
undefined
) {
payloadToUse.pairwiseAlignments = payloadToUse.pairwiseAlignments.map(
addDashesForMatchStartAndEndForTracks
);
}
const templateSeq = payloadToUse.pairwiseAlignments[0][0];
//we need to get all of the sequences in a single alignment (turning inserts into single BP red highlights)
const pairwiseOverviewAlignmentTracks = [
{
//add the template seq as the first track in the Pairwise Alignment Overview
...templateSeq,
sequenceData: tidyUpSequenceData(templateSeq.sequenceData),
alignmentData: { sequence: templateSeq.sequenceData.sequence } //remove the gaps from the template sequence
}
]; // start with just the template seq in there!
payloadToUse.pairwiseAlignments.forEach(([template, alignedSeq]) => {
const condensedSeq = condensePairwiseAlignmentDifferences(
template.alignmentData.sequence,
alignedSeq.alignmentData.sequence
);
let re = /r+/gi;
let match;
const additionalSelectionLayers = [];
while ((match = re.exec(condensedSeq)) != null) {
additionalSelectionLayers.push({
start: match.index,
end: match.index + match[0].length - 1,
return (
_sequenceDataToInsert,
_existingSequenceData,
_caretPositionOrRange,
_options
) => {
const {
sequenceDataToInsert,
existingSequenceData,
caretPositionOrRange,
options
} = props.beforeSequenceInsertOrDelete
? props.beforeSequenceInsertOrDelete(
tidyUpSequenceData(_sequenceDataToInsert),
tidyUpSequenceData(_existingSequenceData),
_caretPositionOrRange,
_options
) || {}
: {};
return [
insertSequenceDataAtPositionOrRange(
sequenceDataToInsert || _sequenceDataToInsert,
existingSequenceData || _existingSequenceData,
caretPositionOrRange || _caretPositionOrRange,
options || _options
),
options || _options || {}
];
};
},
translations: true,
primaryProteinSequence: false,
parts: true,
orfs: true,
cutsites: true,
primers: true,
...annotationsToSupport
}
};
}
}
const initialValuesToUse = {
...toSpread,
...rest,
...(sequenceData && {
sequenceData: tidyUpSequenceData(sequenceData, {
convertAnnotationsFromAAIndices,
//if we have sequence data coming in make sure to tidy it up for the user :)
annotationsAsObjects: true
})
})
};
store.dispatch({
type: "VECTOR_EDITOR_UPDATE",
payload: initialValuesToUse,
meta: {
editorName,
disregardUndo: true,
...extraMeta
}
});
updateSeqData = sequenceData => {
this.activeSeqData = sequenceData;
this.props.vectorEditorInitialize(
{
sequenceData:
(sequenceData && tidyUpSequenceData(sequenceData)) ||
tidyUpSequenceData({
sequence: "gTAGAGACAAGA"
})
},
{
editorName: "veVersionHistoryView"
}
);
};
componentDidMount = async () => {
return (
_sequenceDataToInsert,
_existingSequenceData,
_caretPositionOrRange,
_options
) => {
const {
sequenceDataToInsert,
existingSequenceData,
caretPositionOrRange,
options
} = props.beforeSequenceInsertOrDelete
? props.beforeSequenceInsertOrDelete(
tidyUpSequenceData(_sequenceDataToInsert),
tidyUpSequenceData(_existingSequenceData),
_caretPositionOrRange,
_options
) || {}
: {};
return [
insertSequenceDataAtPositionOrRange(
sequenceDataToInsert || _sequenceDataToInsert,
existingSequenceData || _existingSequenceData,
caretPositionOrRange || _caretPositionOrRange,
options || _options
),
options || _options || {}
];
};
},
hook: isProtein => {
isProtein
? updateEditor(store, "DemoEditor", {
readOnly: false,
sequenceData: tidyUpSequenceData(exampleProteinData, {
convertAnnotationsFromAAIndices: true
})
})
: updateEditor(store, "DemoEditor", {
readOnly: false,
sequenceData: exampleSequenceData
});
}
})}
updateSeqData = sequenceData => {
this.activeSeqData = sequenceData;
this.props.vectorEditorInitialize(
{
sequenceData:
(sequenceData && tidyUpSequenceData(sequenceData)) ||
tidyUpSequenceData({
sequence: "gTAGAGACAAGA"
})
},
{
editorName: "veVersionHistoryView"
}
);
};
componentDidMount = async () => {
export const updateSequenceData = function(seqData, type, ...rest) {
//tnrtodo: currently we're not using that type variable for anything
return _updateSequenceData(
tidyUpSequenceData(seqData, { annotationsAsObjects: true }),
...rest
);
};
readOnly,
alwaysAllowSave,
sequenceData,
lastSavedIdUpdate
} = props;
const saveHandler = opts.isSaveAs ? onSaveAs || onSave : onSave;
const updateLastSavedIdToCurrent = () => {
lastSavedIdUpdate(sequenceData.stateTrackingId);
};
const promiseOrVal =
(!readOnly || alwaysAllowSave || opts.isSaveAs) &&
saveHandler &&
saveHandler(
opts,
tidyUpSequenceData(sequenceData, { annotationsAsObjects: true }),
props,
updateLastSavedIdToCurrent
);
if (promiseOrVal && promiseOrVal.then) {
return promiseOrVal.then(updateLastSavedIdToCurrent);
}
};
handleCutOrCopy = isCut => e => {
const {
onCopy = () => {},
sequenceData,
selectionLayer,
copyOptions
} = this.props;
const onCut = this.props.onCut || this.props.onCopy || (() => {});
const seqData = tidyUpSequenceData(
this.sequenceDataToCopy ||
getSequenceDataBetweenRange(sequenceData, selectionLayer, {
excludePartial: {
features: !copyOptions.partialFeatures,
parts: !copyOptions.partialParts
},
exclude: {
features: !copyOptions.features,
parts: !copyOptions.parts
}
}),
{ annotationsAsObjects: true }
);
if (!seqData.sequence.length)
return window.toastr.warning(
`No Sequence Selected To ${isCut ? "Cut" : "Copy"}`