@teselagen/ove 0.3.31 → 0.3.44
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.cjs.js +121 -77
- package/index.es.js +121 -77
- package/index.js +197011 -0
- package/index.mjs +196957 -0
- package/index.umd.js +276 -249
- package/package.json +4 -4
- package/src/helperComponents/AddOrEditPrimerDialog/index.js +7 -10
- package/src/utils/editorUtils.js +0 -19
- package/src/withEditorInteractions/createSequenceInputPopup.js +10 -16
- package/src/withEditorInteractions/index.js +5 -8
package/index.cjs.js
CHANGED
|
@@ -77896,6 +77896,7 @@ const minimumOrfSize$1 = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.de
|
|
|
77896
77896
|
minimumOrfSizeUpdate
|
|
77897
77897
|
}, Symbol.toStringTag, { value: "Module" }));
|
|
77898
77898
|
const protein_letters = "ACDEFGHIKLMNPQRSTVWY";
|
|
77899
|
+
const protein_letters_withUandX = "ACDEFGHIKLMNPQRSTVWYUX";
|
|
77899
77900
|
const extended_protein_letters = "ACDEFGHIKLMNPQRSTVWYBXZJUO.*-";
|
|
77900
77901
|
const ambiguous_dna_letters = "GATCRYWSMKHBVDN";
|
|
77901
77902
|
const unambiguous_dna_letters = "GATC";
|
|
@@ -77964,6 +77965,7 @@ const bioData = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.definePrope
|
|
|
77964
77965
|
extended_protein_letters,
|
|
77965
77966
|
extended_protein_values,
|
|
77966
77967
|
protein_letters,
|
|
77968
|
+
protein_letters_withUandX,
|
|
77967
77969
|
unambiguous_dna_letters,
|
|
77968
77970
|
unambiguous_rna_letters
|
|
77969
77971
|
}, Symbol.toStringTag, { value: "Module" }));
|
|
@@ -83982,20 +83984,91 @@ const modifiableTypes = [
|
|
|
83982
83984
|
"primers",
|
|
83983
83985
|
"guides"
|
|
83984
83986
|
];
|
|
83985
|
-
function filterSequenceString(sequenceString,
|
|
83986
|
-
|
|
83987
|
-
|
|
83988
|
-
|
|
83989
|
-
|
|
83990
|
-
|
|
83991
|
-
|
|
83992
|
-
|
|
83987
|
+
function filterSequenceString(sequenceString, {
|
|
83988
|
+
additionalValidChars = "",
|
|
83989
|
+
isOligo: isOligo2,
|
|
83990
|
+
name: name2,
|
|
83991
|
+
isProtein: isProtein2,
|
|
83992
|
+
isRna: isRna2,
|
|
83993
|
+
isMixedRnaAndDna,
|
|
83994
|
+
includeStopCodon
|
|
83995
|
+
} = {}) {
|
|
83996
|
+
const acceptedChars = getAcceptedChars({
|
|
83997
|
+
isOligo: isOligo2,
|
|
83998
|
+
isProtein: isProtein2,
|
|
83999
|
+
isRna: isRna2,
|
|
84000
|
+
isMixedRnaAndDna,
|
|
84001
|
+
includeStopCodon
|
|
84002
|
+
});
|
|
84003
|
+
const replaceChars = getReplaceChars({
|
|
84004
|
+
isOligo: isOligo2,
|
|
84005
|
+
isProtein: isProtein2,
|
|
84006
|
+
isRna: isRna2,
|
|
84007
|
+
isMixedRnaAndDna
|
|
84008
|
+
});
|
|
84009
|
+
let sanitizedVal = "";
|
|
84010
|
+
const invalidChars = [];
|
|
84011
|
+
const chars2 = `${acceptedChars}${additionalValidChars.split("").join("\\")}`;
|
|
84012
|
+
const warnings = [];
|
|
84013
|
+
const replaceCount = {};
|
|
84014
|
+
sequenceString.split("").forEach((letter) => {
|
|
84015
|
+
const lowerLetter = letter.toLowerCase();
|
|
84016
|
+
if (replaceChars && replaceChars[lowerLetter]) {
|
|
84017
|
+
if (!replaceCount[lowerLetter]) {
|
|
84018
|
+
replaceCount[lowerLetter] = 0;
|
|
84019
|
+
}
|
|
84020
|
+
replaceCount[lowerLetter]++;
|
|
84021
|
+
const isUpper = lowerLetter !== letter;
|
|
84022
|
+
sanitizedVal += isUpper ? replaceChars[lowerLetter].toUpperCase() : replaceChars[lowerLetter];
|
|
84023
|
+
} else if (chars2.includes(lowerLetter)) {
|
|
84024
|
+
sanitizedVal += letter;
|
|
84025
|
+
} else {
|
|
84026
|
+
invalidChars.push(letter);
|
|
84027
|
+
}
|
|
84028
|
+
});
|
|
84029
|
+
Object.keys(replaceCount).forEach((letter) => {
|
|
84030
|
+
warnings.push(
|
|
84031
|
+
`Replaced "${letter}" with "${replaceChars[letter]}"${replaceCount[letter] > 1 ? ` ${replaceCount[letter]} times` : ""}`
|
|
84032
|
+
);
|
|
84033
|
+
});
|
|
84034
|
+
if (sequenceString.length !== sanitizedVal.length) {
|
|
84035
|
+
warnings.push(
|
|
84036
|
+
`${name2 ? `Sequence ${name2}: ` : ""}Invalid character(s) detected and removed: ${invalidChars.slice(0, 100).join(", ")} `
|
|
83993
84037
|
);
|
|
83994
|
-
} else {
|
|
83995
|
-
return sequenceString;
|
|
83996
84038
|
}
|
|
84039
|
+
if (typeof window !== "undefined" && window.toastr && warnings.length) {
|
|
84040
|
+
warnings.forEach((warning2) => {
|
|
84041
|
+
window.toastr.warning(warning2);
|
|
84042
|
+
});
|
|
84043
|
+
}
|
|
84044
|
+
return [sanitizedVal, warnings];
|
|
83997
84045
|
}
|
|
83998
84046
|
__name(filterSequenceString, "filterSequenceString");
|
|
84047
|
+
function getAcceptedChars({
|
|
84048
|
+
isOligo: isOligo2,
|
|
84049
|
+
isProtein: isProtein2,
|
|
84050
|
+
isRna: isRna2,
|
|
84051
|
+
isMixedRnaAndDna,
|
|
84052
|
+
includeStopCodon
|
|
84053
|
+
} = {}) {
|
|
84054
|
+
return isProtein2 ? `${protein_letters_withUandX.toLowerCase()}${includeStopCodon ? "*." : ""}}` : isOligo2 ? ambiguous_rna_letters.toLowerCase() + "t" : isRna2 ? ambiguous_rna_letters.toLowerCase() + "t" : isMixedRnaAndDna ? ambiguous_rna_letters.toLowerCase() + ambiguous_dna_letters.toLowerCase() : (
|
|
84055
|
+
//just plain old dna
|
|
84056
|
+
ambiguous_rna_letters.toLowerCase() + ambiguous_dna_letters.toLowerCase()
|
|
84057
|
+
);
|
|
84058
|
+
}
|
|
84059
|
+
__name(getAcceptedChars, "getAcceptedChars");
|
|
84060
|
+
function getReplaceChars({
|
|
84061
|
+
isOligo: isOligo2,
|
|
84062
|
+
isProtein: isProtein2,
|
|
84063
|
+
isRna: isRna2,
|
|
84064
|
+
isMixedRnaAndDna
|
|
84065
|
+
} = {}) {
|
|
84066
|
+
return isProtein2 ? {} : isOligo2 ? {} : isRna2 ? { t: "u" } : isMixedRnaAndDna ? {} : (
|
|
84067
|
+
//just plain old dna
|
|
84068
|
+
{}
|
|
84069
|
+
);
|
|
84070
|
+
}
|
|
84071
|
+
__name(getReplaceChars, "getReplaceChars");
|
|
83999
84072
|
function tidyUpAnnotation(_annotation, {
|
|
84000
84073
|
sequenceData: sequenceData2 = {},
|
|
84001
84074
|
convertAnnotationsFromAAIndices,
|
|
@@ -84124,14 +84197,6 @@ function coerceLocation({
|
|
|
84124
84197
|
}
|
|
84125
84198
|
}
|
|
84126
84199
|
__name(coerceLocation, "coerceLocation");
|
|
84127
|
-
function filterAminoAcidSequenceString(sequenceString, options) {
|
|
84128
|
-
options = options || {};
|
|
84129
|
-
if (options.includeStopCodon) {
|
|
84130
|
-
return sequenceString == null ? void 0 : sequenceString.replace(/[^xtgalmfwkqespvicyhrndu.*]/gi, "");
|
|
84131
|
-
}
|
|
84132
|
-
return sequenceString == null ? void 0 : sequenceString.replace(/[^xtgalmfwkqespvicyhrndu]/gi, "");
|
|
84133
|
-
}
|
|
84134
|
-
__name(filterAminoAcidSequenceString, "filterAminoAcidSequenceString");
|
|
84135
84200
|
function getDegenerateDnaStringFromAAString(aaString) {
|
|
84136
84201
|
return aaString.split("").map((char) => aminoAcidToDegenerateDnaMap[char.toLowerCase()] || "nnn").join("");
|
|
84137
84202
|
}
|
|
@@ -84143,11 +84208,10 @@ function tidyUpSequenceData(pSeqData, options = {}) {
|
|
|
84143
84208
|
removeUnwantedChars,
|
|
84144
84209
|
additionalValidChars,
|
|
84145
84210
|
noTranslationData,
|
|
84146
|
-
charOverrides,
|
|
84147
84211
|
doNotProvideIdsForAnnotations,
|
|
84148
|
-
proteinFilterOptions,
|
|
84149
84212
|
noCdsTranslations,
|
|
84150
|
-
convertAnnotationsFromAAIndices
|
|
84213
|
+
convertAnnotationsFromAAIndices,
|
|
84214
|
+
topLevelSeqData
|
|
84151
84215
|
} = options;
|
|
84152
84216
|
let seqData = lodashExports.cloneDeep(pSeqData);
|
|
84153
84217
|
const response = {
|
|
@@ -84177,16 +84241,15 @@ function tidyUpSequenceData(pSeqData, options = {}) {
|
|
|
84177
84241
|
}
|
|
84178
84242
|
if (removeUnwantedChars) {
|
|
84179
84243
|
if (seqData.isProtein) {
|
|
84180
|
-
seqData.proteinSequence
|
|
84181
|
-
|
|
84182
|
-
|
|
84183
|
-
|
|
84244
|
+
const [newSeq] = filterSequenceString(seqData.proteinSequence, __spreadValues({
|
|
84245
|
+
includeStopCodon: true
|
|
84246
|
+
}, topLevelSeqData || seqData));
|
|
84247
|
+
seqData.proteinSequence = newSeq;
|
|
84184
84248
|
} else {
|
|
84185
|
-
|
|
84186
|
-
|
|
84187
|
-
|
|
84188
|
-
|
|
84189
|
-
);
|
|
84249
|
+
const [newSeq] = filterSequenceString(seqData.sequence, __spreadValues({
|
|
84250
|
+
additionalValidChars
|
|
84251
|
+
}, topLevelSeqData || seqData));
|
|
84252
|
+
seqData.sequence = newSeq;
|
|
84190
84253
|
}
|
|
84191
84254
|
}
|
|
84192
84255
|
if (seqData.isProtein) {
|
|
@@ -93533,7 +93596,8 @@ function validateSequence(sequence2, options = {}) {
|
|
|
93533
93596
|
inclusive1BasedEnd,
|
|
93534
93597
|
additionalValidChars,
|
|
93535
93598
|
allowOverflowAnnotations,
|
|
93536
|
-
coerceFeatureTypes
|
|
93599
|
+
coerceFeatureTypes,
|
|
93600
|
+
includeStopCodon
|
|
93537
93601
|
} = options;
|
|
93538
93602
|
[
|
|
93539
93603
|
"isDNA",
|
|
@@ -93583,7 +93647,6 @@ function validateSequence(sequence2, options = {}) {
|
|
|
93583
93647
|
response.messages.push("No sequence detected");
|
|
93584
93648
|
sequence2.sequence = "";
|
|
93585
93649
|
}
|
|
93586
|
-
let validChars;
|
|
93587
93650
|
if (sequence2.isProtein === void 0 && guessIfProtein) {
|
|
93588
93651
|
sequence2.isProtein = !guessIfSequenceIsDnaAndNotProtein(
|
|
93589
93652
|
sequence2.sequence,
|
|
@@ -93591,12 +93654,15 @@ function validateSequence(sequence2, options = {}) {
|
|
|
93591
93654
|
);
|
|
93592
93655
|
}
|
|
93593
93656
|
if (sequence2.isProtein) {
|
|
93594
|
-
validChars =
|
|
93657
|
+
const [validChars, warnings] = filterSequenceString(sequence2.sequence, {
|
|
93658
|
+
name: sequence2.name,
|
|
93659
|
+
isProtein: true,
|
|
93660
|
+
additionalValidChars,
|
|
93661
|
+
includeStopCodon
|
|
93662
|
+
});
|
|
93595
93663
|
if (validChars !== sequence2.sequence) {
|
|
93596
93664
|
sequence2.sequence = validChars;
|
|
93597
|
-
response.messages.push(
|
|
93598
|
-
"Import Error: Illegal character(s) detected and removed from amino acid sequence. Allowed characters are: xtgalmfwkqespvicyhrndu"
|
|
93599
|
-
);
|
|
93665
|
+
response.messages.push(...warnings);
|
|
93600
93666
|
}
|
|
93601
93667
|
sequence2.type = "PROTEIN";
|
|
93602
93668
|
sequence2.isProtein = true;
|
|
@@ -93618,12 +93684,12 @@ function validateSequence(sequence2, options = {}) {
|
|
|
93618
93684
|
} else {
|
|
93619
93685
|
sequence2.type = "DNA";
|
|
93620
93686
|
}
|
|
93621
|
-
validChars = filterSequenceString(sequence2.sequence,
|
|
93687
|
+
const [validChars, warnings] = filterSequenceString(sequence2.sequence, __spreadValues({
|
|
93688
|
+
additionalValidChars
|
|
93689
|
+
}, sequence2));
|
|
93622
93690
|
if (validChars !== sequence2.sequence) {
|
|
93623
93691
|
sequence2.sequence = validChars;
|
|
93624
|
-
response.messages.push(
|
|
93625
|
-
"Import Error: Illegal character(s) detected and removed from sequence. Allowed characters are: atgcyrswkmbvdhn"
|
|
93626
|
-
);
|
|
93692
|
+
response.messages.push(...warnings);
|
|
93627
93693
|
}
|
|
93628
93694
|
}
|
|
93629
93695
|
if (!sequence2.size) {
|
|
@@ -109105,18 +109171,6 @@ function getSelFromWrappedAddon(selectionLayer2, sequenceLength) {
|
|
|
109105
109171
|
return selToUse;
|
|
109106
109172
|
}
|
|
109107
109173
|
__name(getSelFromWrappedAddon, "getSelFromWrappedAddon");
|
|
109108
|
-
function getAcceptedChars({
|
|
109109
|
-
isOligo: isOligo2,
|
|
109110
|
-
isProtein: isProtein2,
|
|
109111
|
-
isRna: isRna2,
|
|
109112
|
-
isMixedRnaAndDna
|
|
109113
|
-
} = {}) {
|
|
109114
|
-
return isProtein2 ? extended_protein_letters.toLowerCase() : isOligo2 ? ambiguous_rna_letters.toLowerCase() + "t" : isRna2 ? ambiguous_rna_letters.toLowerCase() : isMixedRnaAndDna ? ambiguous_rna_letters.toLowerCase() + ambiguous_dna_letters.toLowerCase() : (
|
|
109115
|
-
//just plain old dna
|
|
109116
|
-
ambiguous_dna_letters.toLowerCase()
|
|
109117
|
-
);
|
|
109118
|
-
}
|
|
109119
|
-
__name(getAcceptedChars, "getAcceptedChars");
|
|
109120
109174
|
function getStripedPattern({ color: color2 }) {
|
|
109121
109175
|
return /* @__PURE__ */ React$2.createElement(
|
|
109122
109176
|
"pattern",
|
|
@@ -125723,7 +125777,7 @@ function showFileDialog({ multiple = false, onSelect }) {
|
|
|
125723
125777
|
}
|
|
125724
125778
|
__name(showFileDialog, "showFileDialog");
|
|
125725
125779
|
const name = "@teselagen/ove";
|
|
125726
|
-
const version = "0.3.
|
|
125780
|
+
const version = "0.3.43";
|
|
125727
125781
|
const main = "./src/index.js";
|
|
125728
125782
|
const exports$1 = {
|
|
125729
125783
|
".": {
|
|
@@ -129476,9 +129530,8 @@ const _SequenceInputNoHotkeys = class _SequenceInputNoHotkeys extends React$2.Co
|
|
|
129476
129530
|
selectionLayer: selectionLayer2,
|
|
129477
129531
|
sequenceLength,
|
|
129478
129532
|
isProtein: isProtein2,
|
|
129479
|
-
replaceChars,
|
|
129480
129533
|
caretPosition: caretPosition2,
|
|
129481
|
-
|
|
129534
|
+
sequenceData: sequenceData2,
|
|
129482
129535
|
maxInsertSize
|
|
129483
129536
|
} = this.props;
|
|
129484
129537
|
const { charsToInsert, hasTempError } = this.state;
|
|
@@ -129511,17 +129564,13 @@ const _SequenceInputNoHotkeys = class _SequenceInputNoHotkeys extends React$2.Co
|
|
|
129511
129564
|
autoFocus: true,
|
|
129512
129565
|
style: hasTempError ? { borderColor: "red" } : {},
|
|
129513
129566
|
onChange: (e2) => {
|
|
129514
|
-
|
|
129515
|
-
|
|
129516
|
-
|
|
129517
|
-
|
|
129518
|
-
|
|
129519
|
-
|
|
129520
|
-
|
|
129521
|
-
sanitizedVal += letter;
|
|
129522
|
-
}
|
|
129523
|
-
});
|
|
129524
|
-
if (e2.target.value.length !== sanitizedVal.length) {
|
|
129567
|
+
const [sanitizedVal, warnings] = filterSequenceString(
|
|
129568
|
+
e2.target.value,
|
|
129569
|
+
__spreadProps(__spreadValues({}, sequenceData2), {
|
|
129570
|
+
name: void 0
|
|
129571
|
+
})
|
|
129572
|
+
);
|
|
129573
|
+
if (warnings.length) {
|
|
129525
129574
|
this.setState({
|
|
129526
129575
|
hasTempError: true
|
|
129527
129576
|
});
|
|
@@ -130396,7 +130445,8 @@ function VectorInteractionHOC(Component) {
|
|
|
130396
130445
|
selectionLayer: selectionLayer2 = { start: -1, end: -1 },
|
|
130397
130446
|
readOnly: readOnly2,
|
|
130398
130447
|
onPaste,
|
|
130399
|
-
disableBpEditing
|
|
130448
|
+
disableBpEditing,
|
|
130449
|
+
sequenceData: sequenceData2
|
|
130400
130450
|
} = this.props;
|
|
130401
130451
|
if (disableBpEditing) {
|
|
130402
130452
|
return window.toastr.warning("Sorry the underlying sequence is locked");
|
|
@@ -130421,6 +130471,7 @@ function VectorInteractionHOC(Component) {
|
|
|
130421
130471
|
};
|
|
130422
130472
|
}
|
|
130423
130473
|
seqDataToInsert = tidyUpSequenceData(seqDataToInsert, {
|
|
130474
|
+
topLevelSeqData: sequenceData2,
|
|
130424
130475
|
provideNewIdsForAnnotations: true,
|
|
130425
130476
|
annotationsAsObjects: true,
|
|
130426
130477
|
removeUnwantedChars: true,
|
|
@@ -130516,8 +130567,7 @@ function VectorInteractionHOC(Component) {
|
|
|
130516
130567
|
createSequenceInputPopup({
|
|
130517
130568
|
useEventPositioning,
|
|
130518
130569
|
isReplace,
|
|
130519
|
-
|
|
130520
|
-
acceptedChars: getAcceptedChars(sequenceData2),
|
|
130570
|
+
sequenceData: sequenceData2,
|
|
130521
130571
|
isProtein: sequenceData2.isProtein,
|
|
130522
130572
|
selectionLayer: selectionLayer2,
|
|
130523
130573
|
sequenceLength,
|
|
@@ -142010,14 +142060,8 @@ const CustomContentEditable = generateField(/* @__PURE__ */ __name(function Cust
|
|
|
142010
142060
|
const newVal2 = e2.target.innerText;
|
|
142011
142061
|
const savedCaretPosition = EditCaretPositioning.saveSelection(e2.currentTarget);
|
|
142012
142062
|
setCaretPosition(savedCaretPosition);
|
|
142013
|
-
const
|
|
142014
|
-
|
|
142015
|
-
newVal2.split("").forEach((letter) => {
|
|
142016
|
-
if (acceptedChars.includes(letter.toLowerCase())) {
|
|
142017
|
-
newBases += letter;
|
|
142018
|
-
}
|
|
142019
|
-
});
|
|
142020
|
-
if (newVal2.length !== newBases.length) {
|
|
142063
|
+
const [newBases, warnings] = filterSequenceString(newVal2, sequenceData2);
|
|
142064
|
+
if (warnings.length) {
|
|
142021
142065
|
setTempError(true);
|
|
142022
142066
|
setTimeout(() => {
|
|
142023
142067
|
setTempError(false);
|
package/index.es.js
CHANGED
|
@@ -77878,6 +77878,7 @@ const minimumOrfSize$1 = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.de
|
|
|
77878
77878
|
minimumOrfSizeUpdate
|
|
77879
77879
|
}, Symbol.toStringTag, { value: "Module" }));
|
|
77880
77880
|
const protein_letters = "ACDEFGHIKLMNPQRSTVWY";
|
|
77881
|
+
const protein_letters_withUandX = "ACDEFGHIKLMNPQRSTVWYUX";
|
|
77881
77882
|
const extended_protein_letters = "ACDEFGHIKLMNPQRSTVWYBXZJUO.*-";
|
|
77882
77883
|
const ambiguous_dna_letters = "GATCRYWSMKHBVDN";
|
|
77883
77884
|
const unambiguous_dna_letters = "GATC";
|
|
@@ -77946,6 +77947,7 @@ const bioData = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.definePrope
|
|
|
77946
77947
|
extended_protein_letters,
|
|
77947
77948
|
extended_protein_values,
|
|
77948
77949
|
protein_letters,
|
|
77950
|
+
protein_letters_withUandX,
|
|
77949
77951
|
unambiguous_dna_letters,
|
|
77950
77952
|
unambiguous_rna_letters
|
|
77951
77953
|
}, Symbol.toStringTag, { value: "Module" }));
|
|
@@ -83964,20 +83966,91 @@ const modifiableTypes = [
|
|
|
83964
83966
|
"primers",
|
|
83965
83967
|
"guides"
|
|
83966
83968
|
];
|
|
83967
|
-
function filterSequenceString(sequenceString,
|
|
83968
|
-
|
|
83969
|
-
|
|
83970
|
-
|
|
83971
|
-
|
|
83972
|
-
|
|
83973
|
-
|
|
83974
|
-
|
|
83969
|
+
function filterSequenceString(sequenceString, {
|
|
83970
|
+
additionalValidChars = "",
|
|
83971
|
+
isOligo: isOligo2,
|
|
83972
|
+
name: name2,
|
|
83973
|
+
isProtein: isProtein2,
|
|
83974
|
+
isRna: isRna2,
|
|
83975
|
+
isMixedRnaAndDna,
|
|
83976
|
+
includeStopCodon
|
|
83977
|
+
} = {}) {
|
|
83978
|
+
const acceptedChars = getAcceptedChars({
|
|
83979
|
+
isOligo: isOligo2,
|
|
83980
|
+
isProtein: isProtein2,
|
|
83981
|
+
isRna: isRna2,
|
|
83982
|
+
isMixedRnaAndDna,
|
|
83983
|
+
includeStopCodon
|
|
83984
|
+
});
|
|
83985
|
+
const replaceChars = getReplaceChars({
|
|
83986
|
+
isOligo: isOligo2,
|
|
83987
|
+
isProtein: isProtein2,
|
|
83988
|
+
isRna: isRna2,
|
|
83989
|
+
isMixedRnaAndDna
|
|
83990
|
+
});
|
|
83991
|
+
let sanitizedVal = "";
|
|
83992
|
+
const invalidChars = [];
|
|
83993
|
+
const chars2 = `${acceptedChars}${additionalValidChars.split("").join("\\")}`;
|
|
83994
|
+
const warnings = [];
|
|
83995
|
+
const replaceCount = {};
|
|
83996
|
+
sequenceString.split("").forEach((letter) => {
|
|
83997
|
+
const lowerLetter = letter.toLowerCase();
|
|
83998
|
+
if (replaceChars && replaceChars[lowerLetter]) {
|
|
83999
|
+
if (!replaceCount[lowerLetter]) {
|
|
84000
|
+
replaceCount[lowerLetter] = 0;
|
|
84001
|
+
}
|
|
84002
|
+
replaceCount[lowerLetter]++;
|
|
84003
|
+
const isUpper = lowerLetter !== letter;
|
|
84004
|
+
sanitizedVal += isUpper ? replaceChars[lowerLetter].toUpperCase() : replaceChars[lowerLetter];
|
|
84005
|
+
} else if (chars2.includes(lowerLetter)) {
|
|
84006
|
+
sanitizedVal += letter;
|
|
84007
|
+
} else {
|
|
84008
|
+
invalidChars.push(letter);
|
|
84009
|
+
}
|
|
84010
|
+
});
|
|
84011
|
+
Object.keys(replaceCount).forEach((letter) => {
|
|
84012
|
+
warnings.push(
|
|
84013
|
+
`Replaced "${letter}" with "${replaceChars[letter]}"${replaceCount[letter] > 1 ? ` ${replaceCount[letter]} times` : ""}`
|
|
84014
|
+
);
|
|
84015
|
+
});
|
|
84016
|
+
if (sequenceString.length !== sanitizedVal.length) {
|
|
84017
|
+
warnings.push(
|
|
84018
|
+
`${name2 ? `Sequence ${name2}: ` : ""}Invalid character(s) detected and removed: ${invalidChars.slice(0, 100).join(", ")} `
|
|
83975
84019
|
);
|
|
83976
|
-
} else {
|
|
83977
|
-
return sequenceString;
|
|
83978
84020
|
}
|
|
84021
|
+
if (typeof window !== "undefined" && window.toastr && warnings.length) {
|
|
84022
|
+
warnings.forEach((warning2) => {
|
|
84023
|
+
window.toastr.warning(warning2);
|
|
84024
|
+
});
|
|
84025
|
+
}
|
|
84026
|
+
return [sanitizedVal, warnings];
|
|
83979
84027
|
}
|
|
83980
84028
|
__name(filterSequenceString, "filterSequenceString");
|
|
84029
|
+
function getAcceptedChars({
|
|
84030
|
+
isOligo: isOligo2,
|
|
84031
|
+
isProtein: isProtein2,
|
|
84032
|
+
isRna: isRna2,
|
|
84033
|
+
isMixedRnaAndDna,
|
|
84034
|
+
includeStopCodon
|
|
84035
|
+
} = {}) {
|
|
84036
|
+
return isProtein2 ? `${protein_letters_withUandX.toLowerCase()}${includeStopCodon ? "*." : ""}}` : isOligo2 ? ambiguous_rna_letters.toLowerCase() + "t" : isRna2 ? ambiguous_rna_letters.toLowerCase() + "t" : isMixedRnaAndDna ? ambiguous_rna_letters.toLowerCase() + ambiguous_dna_letters.toLowerCase() : (
|
|
84037
|
+
//just plain old dna
|
|
84038
|
+
ambiguous_rna_letters.toLowerCase() + ambiguous_dna_letters.toLowerCase()
|
|
84039
|
+
);
|
|
84040
|
+
}
|
|
84041
|
+
__name(getAcceptedChars, "getAcceptedChars");
|
|
84042
|
+
function getReplaceChars({
|
|
84043
|
+
isOligo: isOligo2,
|
|
84044
|
+
isProtein: isProtein2,
|
|
84045
|
+
isRna: isRna2,
|
|
84046
|
+
isMixedRnaAndDna
|
|
84047
|
+
} = {}) {
|
|
84048
|
+
return isProtein2 ? {} : isOligo2 ? {} : isRna2 ? { t: "u" } : isMixedRnaAndDna ? {} : (
|
|
84049
|
+
//just plain old dna
|
|
84050
|
+
{}
|
|
84051
|
+
);
|
|
84052
|
+
}
|
|
84053
|
+
__name(getReplaceChars, "getReplaceChars");
|
|
83981
84054
|
function tidyUpAnnotation(_annotation, {
|
|
83982
84055
|
sequenceData: sequenceData2 = {},
|
|
83983
84056
|
convertAnnotationsFromAAIndices,
|
|
@@ -84106,14 +84179,6 @@ function coerceLocation({
|
|
|
84106
84179
|
}
|
|
84107
84180
|
}
|
|
84108
84181
|
__name(coerceLocation, "coerceLocation");
|
|
84109
|
-
function filterAminoAcidSequenceString(sequenceString, options) {
|
|
84110
|
-
options = options || {};
|
|
84111
|
-
if (options.includeStopCodon) {
|
|
84112
|
-
return sequenceString == null ? void 0 : sequenceString.replace(/[^xtgalmfwkqespvicyhrndu.*]/gi, "");
|
|
84113
|
-
}
|
|
84114
|
-
return sequenceString == null ? void 0 : sequenceString.replace(/[^xtgalmfwkqespvicyhrndu]/gi, "");
|
|
84115
|
-
}
|
|
84116
|
-
__name(filterAminoAcidSequenceString, "filterAminoAcidSequenceString");
|
|
84117
84182
|
function getDegenerateDnaStringFromAAString(aaString) {
|
|
84118
84183
|
return aaString.split("").map((char) => aminoAcidToDegenerateDnaMap[char.toLowerCase()] || "nnn").join("");
|
|
84119
84184
|
}
|
|
@@ -84125,11 +84190,10 @@ function tidyUpSequenceData(pSeqData, options = {}) {
|
|
|
84125
84190
|
removeUnwantedChars,
|
|
84126
84191
|
additionalValidChars,
|
|
84127
84192
|
noTranslationData,
|
|
84128
|
-
charOverrides,
|
|
84129
84193
|
doNotProvideIdsForAnnotations,
|
|
84130
|
-
proteinFilterOptions,
|
|
84131
84194
|
noCdsTranslations,
|
|
84132
|
-
convertAnnotationsFromAAIndices
|
|
84195
|
+
convertAnnotationsFromAAIndices,
|
|
84196
|
+
topLevelSeqData
|
|
84133
84197
|
} = options;
|
|
84134
84198
|
let seqData = lodashExports.cloneDeep(pSeqData);
|
|
84135
84199
|
const response = {
|
|
@@ -84159,16 +84223,15 @@ function tidyUpSequenceData(pSeqData, options = {}) {
|
|
|
84159
84223
|
}
|
|
84160
84224
|
if (removeUnwantedChars) {
|
|
84161
84225
|
if (seqData.isProtein) {
|
|
84162
|
-
seqData.proteinSequence
|
|
84163
|
-
|
|
84164
|
-
|
|
84165
|
-
|
|
84226
|
+
const [newSeq] = filterSequenceString(seqData.proteinSequence, __spreadValues({
|
|
84227
|
+
includeStopCodon: true
|
|
84228
|
+
}, topLevelSeqData || seqData));
|
|
84229
|
+
seqData.proteinSequence = newSeq;
|
|
84166
84230
|
} else {
|
|
84167
|
-
|
|
84168
|
-
|
|
84169
|
-
|
|
84170
|
-
|
|
84171
|
-
);
|
|
84231
|
+
const [newSeq] = filterSequenceString(seqData.sequence, __spreadValues({
|
|
84232
|
+
additionalValidChars
|
|
84233
|
+
}, topLevelSeqData || seqData));
|
|
84234
|
+
seqData.sequence = newSeq;
|
|
84172
84235
|
}
|
|
84173
84236
|
}
|
|
84174
84237
|
if (seqData.isProtein) {
|
|
@@ -93515,7 +93578,8 @@ function validateSequence(sequence2, options = {}) {
|
|
|
93515
93578
|
inclusive1BasedEnd,
|
|
93516
93579
|
additionalValidChars,
|
|
93517
93580
|
allowOverflowAnnotations,
|
|
93518
|
-
coerceFeatureTypes
|
|
93581
|
+
coerceFeatureTypes,
|
|
93582
|
+
includeStopCodon
|
|
93519
93583
|
} = options;
|
|
93520
93584
|
[
|
|
93521
93585
|
"isDNA",
|
|
@@ -93565,7 +93629,6 @@ function validateSequence(sequence2, options = {}) {
|
|
|
93565
93629
|
response.messages.push("No sequence detected");
|
|
93566
93630
|
sequence2.sequence = "";
|
|
93567
93631
|
}
|
|
93568
|
-
let validChars;
|
|
93569
93632
|
if (sequence2.isProtein === void 0 && guessIfProtein) {
|
|
93570
93633
|
sequence2.isProtein = !guessIfSequenceIsDnaAndNotProtein(
|
|
93571
93634
|
sequence2.sequence,
|
|
@@ -93573,12 +93636,15 @@ function validateSequence(sequence2, options = {}) {
|
|
|
93573
93636
|
);
|
|
93574
93637
|
}
|
|
93575
93638
|
if (sequence2.isProtein) {
|
|
93576
|
-
validChars =
|
|
93639
|
+
const [validChars, warnings] = filterSequenceString(sequence2.sequence, {
|
|
93640
|
+
name: sequence2.name,
|
|
93641
|
+
isProtein: true,
|
|
93642
|
+
additionalValidChars,
|
|
93643
|
+
includeStopCodon
|
|
93644
|
+
});
|
|
93577
93645
|
if (validChars !== sequence2.sequence) {
|
|
93578
93646
|
sequence2.sequence = validChars;
|
|
93579
|
-
response.messages.push(
|
|
93580
|
-
"Import Error: Illegal character(s) detected and removed from amino acid sequence. Allowed characters are: xtgalmfwkqespvicyhrndu"
|
|
93581
|
-
);
|
|
93647
|
+
response.messages.push(...warnings);
|
|
93582
93648
|
}
|
|
93583
93649
|
sequence2.type = "PROTEIN";
|
|
93584
93650
|
sequence2.isProtein = true;
|
|
@@ -93600,12 +93666,12 @@ function validateSequence(sequence2, options = {}) {
|
|
|
93600
93666
|
} else {
|
|
93601
93667
|
sequence2.type = "DNA";
|
|
93602
93668
|
}
|
|
93603
|
-
validChars = filterSequenceString(sequence2.sequence,
|
|
93669
|
+
const [validChars, warnings] = filterSequenceString(sequence2.sequence, __spreadValues({
|
|
93670
|
+
additionalValidChars
|
|
93671
|
+
}, sequence2));
|
|
93604
93672
|
if (validChars !== sequence2.sequence) {
|
|
93605
93673
|
sequence2.sequence = validChars;
|
|
93606
|
-
response.messages.push(
|
|
93607
|
-
"Import Error: Illegal character(s) detected and removed from sequence. Allowed characters are: atgcyrswkmbvdhn"
|
|
93608
|
-
);
|
|
93674
|
+
response.messages.push(...warnings);
|
|
93609
93675
|
}
|
|
93610
93676
|
}
|
|
93611
93677
|
if (!sequence2.size) {
|
|
@@ -109087,18 +109153,6 @@ function getSelFromWrappedAddon(selectionLayer2, sequenceLength) {
|
|
|
109087
109153
|
return selToUse;
|
|
109088
109154
|
}
|
|
109089
109155
|
__name(getSelFromWrappedAddon, "getSelFromWrappedAddon");
|
|
109090
|
-
function getAcceptedChars({
|
|
109091
|
-
isOligo: isOligo2,
|
|
109092
|
-
isProtein: isProtein2,
|
|
109093
|
-
isRna: isRna2,
|
|
109094
|
-
isMixedRnaAndDna
|
|
109095
|
-
} = {}) {
|
|
109096
|
-
return isProtein2 ? extended_protein_letters.toLowerCase() : isOligo2 ? ambiguous_rna_letters.toLowerCase() + "t" : isRna2 ? ambiguous_rna_letters.toLowerCase() : isMixedRnaAndDna ? ambiguous_rna_letters.toLowerCase() + ambiguous_dna_letters.toLowerCase() : (
|
|
109097
|
-
//just plain old dna
|
|
109098
|
-
ambiguous_dna_letters.toLowerCase()
|
|
109099
|
-
);
|
|
109100
|
-
}
|
|
109101
|
-
__name(getAcceptedChars, "getAcceptedChars");
|
|
109102
109156
|
function getStripedPattern({ color: color2 }) {
|
|
109103
109157
|
return /* @__PURE__ */ React__default$1.createElement(
|
|
109104
109158
|
"pattern",
|
|
@@ -125705,7 +125759,7 @@ function showFileDialog({ multiple = false, onSelect }) {
|
|
|
125705
125759
|
}
|
|
125706
125760
|
__name(showFileDialog, "showFileDialog");
|
|
125707
125761
|
const name = "@teselagen/ove";
|
|
125708
|
-
const version = "0.3.
|
|
125762
|
+
const version = "0.3.43";
|
|
125709
125763
|
const main = "./src/index.js";
|
|
125710
125764
|
const exports$1 = {
|
|
125711
125765
|
".": {
|
|
@@ -129458,9 +129512,8 @@ const _SequenceInputNoHotkeys = class _SequenceInputNoHotkeys extends React__def
|
|
|
129458
129512
|
selectionLayer: selectionLayer2,
|
|
129459
129513
|
sequenceLength,
|
|
129460
129514
|
isProtein: isProtein2,
|
|
129461
|
-
replaceChars,
|
|
129462
129515
|
caretPosition: caretPosition2,
|
|
129463
|
-
|
|
129516
|
+
sequenceData: sequenceData2,
|
|
129464
129517
|
maxInsertSize
|
|
129465
129518
|
} = this.props;
|
|
129466
129519
|
const { charsToInsert, hasTempError } = this.state;
|
|
@@ -129493,17 +129546,13 @@ const _SequenceInputNoHotkeys = class _SequenceInputNoHotkeys extends React__def
|
|
|
129493
129546
|
autoFocus: true,
|
|
129494
129547
|
style: hasTempError ? { borderColor: "red" } : {},
|
|
129495
129548
|
onChange: (e2) => {
|
|
129496
|
-
|
|
129497
|
-
|
|
129498
|
-
|
|
129499
|
-
|
|
129500
|
-
|
|
129501
|
-
|
|
129502
|
-
|
|
129503
|
-
sanitizedVal += letter;
|
|
129504
|
-
}
|
|
129505
|
-
});
|
|
129506
|
-
if (e2.target.value.length !== sanitizedVal.length) {
|
|
129549
|
+
const [sanitizedVal, warnings] = filterSequenceString(
|
|
129550
|
+
e2.target.value,
|
|
129551
|
+
__spreadProps(__spreadValues({}, sequenceData2), {
|
|
129552
|
+
name: void 0
|
|
129553
|
+
})
|
|
129554
|
+
);
|
|
129555
|
+
if (warnings.length) {
|
|
129507
129556
|
this.setState({
|
|
129508
129557
|
hasTempError: true
|
|
129509
129558
|
});
|
|
@@ -130378,7 +130427,8 @@ function VectorInteractionHOC(Component2) {
|
|
|
130378
130427
|
selectionLayer: selectionLayer2 = { start: -1, end: -1 },
|
|
130379
130428
|
readOnly: readOnly2,
|
|
130380
130429
|
onPaste,
|
|
130381
|
-
disableBpEditing
|
|
130430
|
+
disableBpEditing,
|
|
130431
|
+
sequenceData: sequenceData2
|
|
130382
130432
|
} = this.props;
|
|
130383
130433
|
if (disableBpEditing) {
|
|
130384
130434
|
return window.toastr.warning("Sorry the underlying sequence is locked");
|
|
@@ -130403,6 +130453,7 @@ function VectorInteractionHOC(Component2) {
|
|
|
130403
130453
|
};
|
|
130404
130454
|
}
|
|
130405
130455
|
seqDataToInsert = tidyUpSequenceData(seqDataToInsert, {
|
|
130456
|
+
topLevelSeqData: sequenceData2,
|
|
130406
130457
|
provideNewIdsForAnnotations: true,
|
|
130407
130458
|
annotationsAsObjects: true,
|
|
130408
130459
|
removeUnwantedChars: true,
|
|
@@ -130498,8 +130549,7 @@ function VectorInteractionHOC(Component2) {
|
|
|
130498
130549
|
createSequenceInputPopup({
|
|
130499
130550
|
useEventPositioning,
|
|
130500
130551
|
isReplace,
|
|
130501
|
-
|
|
130502
|
-
acceptedChars: getAcceptedChars(sequenceData2),
|
|
130552
|
+
sequenceData: sequenceData2,
|
|
130503
130553
|
isProtein: sequenceData2.isProtein,
|
|
130504
130554
|
selectionLayer: selectionLayer2,
|
|
130505
130555
|
sequenceLength,
|
|
@@ -141992,14 +142042,8 @@ const CustomContentEditable = generateField(/* @__PURE__ */ __name(function Cust
|
|
|
141992
142042
|
const newVal2 = e2.target.innerText;
|
|
141993
142043
|
const savedCaretPosition = EditCaretPositioning.saveSelection(e2.currentTarget);
|
|
141994
142044
|
setCaretPosition(savedCaretPosition);
|
|
141995
|
-
const
|
|
141996
|
-
|
|
141997
|
-
newVal2.split("").forEach((letter) => {
|
|
141998
|
-
if (acceptedChars.includes(letter.toLowerCase())) {
|
|
141999
|
-
newBases += letter;
|
|
142000
|
-
}
|
|
142001
|
-
});
|
|
142002
|
-
if (newVal2.length !== newBases.length) {
|
|
142045
|
+
const [newBases, warnings] = filterSequenceString(newVal2, sequenceData2);
|
|
142046
|
+
if (warnings.length) {
|
|
142003
142047
|
setTempError(true);
|
|
142004
142048
|
setTimeout(() => {
|
|
142005
142049
|
setTempError(false);
|