@teselagen/sequence-utils 0.3.38-beta.3 → 0.3.42
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/DNAComplementMap.d.ts +1 -1
- package/README.md +2 -8
- package/addGapsToSeqReads.d.ts +3 -16
- package/adjustAnnotationsToInsert.d.ts +1 -2
- package/adjustBpsToReplaceOrInsert.d.ts +1 -2
- package/aliasedEnzymesByName.d.ts +1 -37
- package/aminoAcidToDegenerateDnaMap.d.ts +31 -1
- package/aminoAcidToDegenerateRnaMap.d.ts +1 -1
- package/annotateSingleSeq.d.ts +4 -5
- package/annotationTypes.d.ts +2 -2
- package/autoAnnotate.d.ts +8 -17
- package/bioData.d.ts +58 -10
- package/calculateEndStability.d.ts +1 -1
- package/calculateNebTa.d.ts +1 -6
- package/calculateNebTm.d.ts +4 -6
- package/calculatePercentGC.d.ts +1 -1
- package/calculateSantaLuciaTm.d.ts +114 -28
- package/calculateTm.d.ts +1 -13
- package/computeDigestFragments.d.ts +24 -30
- package/condensePairwiseAlignmentDifferences.d.ts +1 -1
- package/convertAACaretPositionOrRangeToDna.d.ts +1 -2
- package/convertDnaCaretPositionOrRangeToAA.d.ts +1 -2
- package/cutSequenceByRestrictionEnzyme.d.ts +1 -2
- package/defaultEnzymesByName.d.ts +1 -2
- package/degenerateDnaToAminoAcidMap.d.ts +1 -1
- package/degenerateRnaToAminoAcidMap.d.ts +1 -1
- package/deleteSequenceDataAtRange.d.ts +1 -2
- package/diffUtils.d.ts +7 -9
- package/doesEnzymeChopOutsideOfRecognitionSite.d.ts +1 -2
- package/featureTypesAndColors.d.ts +6 -19
- package/filterSequenceString.d.ts +10 -14
- package/findApproxMatches.d.ts +1 -7
- package/findNearestRangeOfSequenceOverlapToPosition.d.ts +1 -2
- package/findOrfsInPlasmid.d.ts +11 -2
- package/findSequenceMatches.d.ts +1 -11
- package/generateAnnotations.d.ts +1 -2
- package/generateSequenceData.d.ts +13 -8
- package/getAllInsertionsInSeqReads.d.ts +1 -11
- package/getAminoAcidDataForEachBaseOfDna.d.ts +5 -6
- package/getAminoAcidFromSequenceTriplet.d.ts +1 -1
- package/getAminoAcidStringFromSequenceString.d.ts +1 -3
- package/getCodonRangeForAASliver.d.ts +4 -3
- package/getComplementAminoAcidStringFromSequenceString.d.ts +1 -1
- package/getComplementSequenceAndAnnotations.d.ts +1 -5
- package/getComplementSequenceString.d.ts +1 -1
- package/getCutsiteType.d.ts +1 -2
- package/getCutsitesFromSequence.d.ts +1 -2
- package/getDegenerateDnaStringFromAAString.d.ts +1 -1
- package/getDegenerateRnaStringFromAAString.d.ts +1 -1
- package/getDigestFragmentsForCutsites.d.ts +1 -4
- package/getDigestFragmentsForRestrictionEnzymes.d.ts +1 -8
- package/getInsertBetweenVals.d.ts +1 -2
- package/getLeftAndRightOfSequenceInRangeGivenPosition.d.ts +1 -2
- package/getOrfsFromSequence.d.ts +11 -17
- package/getOverlapBetweenTwoSequences.d.ts +1 -2
- package/getPossiblePartsFromSequenceAndEnzymes.d.ts +1 -18
- package/getReverseAminoAcidStringFromSequenceString.d.ts +1 -1
- package/getReverseComplementAminoAcidStringFromSequenceString.d.ts +1 -1
- package/getReverseComplementAnnotation.d.ts +1 -11
- package/getReverseComplementSequenceAndAnnotations.d.ts +1 -5
- package/getReverseComplementSequenceString.d.ts +1 -1
- package/getReverseSequenceString.d.ts +1 -1
- package/getSequenceDataBetweenRange.d.ts +1 -9
- package/getVirtualDigest.d.ts +10 -11
- package/guessIfSequenceIsDnaAndNotProtein.d.ts +1 -5
- package/index.cjs +503 -734
- package/index.d.ts +5 -8
- package/index.js +503 -734
- package/index.umd.cjs +503 -734
- package/insertGapsIntoRefSeq.d.ts +1 -2
- package/insertSequenceDataAtPositionOrRange.d.ts +1 -10
- package/isEnzymeType2S.d.ts +1 -2
- package/mapAnnotationsToRows.d.ts +1 -9
- package/package.json +9 -12
- package/prepareCircularViewData.d.ts +1 -2
- package/prepareRowData.d.ts +3 -7
- package/proteinAlphabet.d.ts +1 -1
- package/rotateBpsToPosition.d.ts +1 -1
- package/rotateSequenceDataToPosition.d.ts +1 -3
- package/shiftAnnotationsByLen.d.ts +3 -4
- package/src/autoAnnotate.test.js +1 -0
- package/src/filterSequenceString.js +7 -4
- package/src/getSequenceDataBetweenRange.js +11 -2
- package/src/getSequenceDataBetweenRange.test.js +42 -0
- package/src/prepareRowData_output1.json +0 -1
- package/src/tidyUpSequenceData.js +5 -2
- package/threeLetterSequenceStringToAminoAcidMap.d.ts +921 -11
- package/tidyUpAnnotation.d.ts +11 -13
- package/tidyUpSequenceData.d.ts +1 -15
- package/src/DNAComplementMap.ts +0 -32
- package/src/addGapsToSeqReads.ts +0 -436
- package/src/adjustAnnotationsToInsert.ts +0 -20
- package/src/adjustBpsToReplaceOrInsert.ts +0 -73
- package/src/aliasedEnzymesByName.ts +0 -7366
- package/src/aminoAcidToDegenerateDnaMap.ts +0 -32
- package/src/aminoAcidToDegenerateRnaMap.ts +0 -32
- package/src/annotateSingleSeq.ts +0 -37
- package/src/annotationTypes.ts +0 -23
- package/src/autoAnnotate.ts +0 -290
- package/src/bioData.ts +0 -65
- package/src/calculateEndStability.ts +0 -91
- package/src/calculateNebTa.ts +0 -46
- package/src/calculateNebTm.ts +0 -132
- package/src/calculatePercentGC.ts +0 -3
- package/src/calculateSantaLuciaTm.ts +0 -184
- package/src/calculateTm.ts +0 -242
- package/src/computeDigestFragments.ts +0 -238
- package/src/condensePairwiseAlignmentDifferences.ts +0 -85
- package/src/convertAACaretPositionOrRangeToDna.ts +0 -28
- package/src/convertDnaCaretPositionOrRangeToAA.ts +0 -28
- package/src/cutSequenceByRestrictionEnzyme.ts +0 -345
- package/src/defaultEnzymesByName.ts +0 -280
- package/src/degenerateDnaToAminoAcidMap.ts +0 -5
- package/src/degenerateRnaToAminoAcidMap.ts +0 -5
- package/src/deleteSequenceDataAtRange.ts +0 -13
- package/src/diffUtils.ts +0 -80
- package/src/doesEnzymeChopOutsideOfRecognitionSite.ts +0 -16
- package/src/featureTypesAndColors.ts +0 -167
- package/src/filterSequenceString.ts +0 -153
- package/src/findApproxMatches.ts +0 -58
- package/src/findNearestRangeOfSequenceOverlapToPosition.ts +0 -43
- package/src/findOrfsInPlasmid.ts +0 -31
- package/src/findSequenceMatches.ts +0 -154
- package/src/generateAnnotations.ts +0 -39
- package/src/generateSequenceData.ts +0 -212
- package/src/getAllInsertionsInSeqReads.ts +0 -100
- package/src/getAminoAcidDataForEachBaseOfDna.ts +0 -305
- package/src/getAminoAcidFromSequenceTriplet.ts +0 -27
- package/src/getAminoAcidStringFromSequenceString.ts +0 -36
- package/src/getCodonRangeForAASliver.ts +0 -73
- package/src/getComplementAminoAcidStringFromSequenceString.ts +0 -10
- package/src/getComplementSequenceAndAnnotations.ts +0 -25
- package/src/getComplementSequenceString.ts +0 -23
- package/src/getCutsiteType.ts +0 -18
- package/src/getCutsitesFromSequence.ts +0 -22
- package/src/getDegenerateDnaStringFromAAString.ts +0 -15
- package/src/getDegenerateRnaStringFromAAString.ts +0 -15
- package/src/getDigestFragmentsForCutsites.ts +0 -126
- package/src/getDigestFragmentsForRestrictionEnzymes.ts +0 -50
- package/src/getInsertBetweenVals.ts +0 -31
- package/src/getLeftAndRightOfSequenceInRangeGivenPosition.ts +0 -40
- package/src/getMassOfAaString.ts +0 -29
- package/src/getOrfsFromSequence.ts +0 -132
- package/src/getOverlapBetweenTwoSequences.ts +0 -30
- package/src/getPossiblePartsFromSequenceAndEnzymes.ts +0 -149
- package/src/getReverseAminoAcidStringFromSequenceString.ts +0 -22
- package/src/getReverseComplementAminoAcidStringFromSequenceString.ts +0 -10
- package/src/getReverseComplementAnnotation.ts +0 -33
- package/src/getReverseComplementSequenceAndAnnotations.ts +0 -46
- package/src/getReverseComplementSequenceString.ts +0 -18
- package/src/getReverseSequenceString.ts +0 -12
- package/src/getSequenceDataBetweenRange.ts +0 -154
- package/src/getVirtualDigest.ts +0 -139
- package/src/guessIfSequenceIsDnaAndNotProtein.ts +0 -39
- package/src/index.test.ts +0 -43
- package/src/index.ts +0 -111
- package/src/insertGapsIntoRefSeq.ts +0 -43
- package/src/insertSequenceDataAtPosition.ts +0 -2
- package/src/insertSequenceDataAtPositionOrRange.ts +0 -328
- package/src/isEnzymeType2S.ts +0 -5
- package/src/mapAnnotationsToRows.ts +0 -256
- package/src/prepareCircularViewData.ts +0 -24
- package/src/prepareRowData.ts +0 -61
- package/src/proteinAlphabet.ts +0 -271
- package/src/rotateBpsToPosition.ts +0 -12
- package/src/rotateSequenceDataToPosition.ts +0 -54
- package/src/shiftAnnotationsByLen.ts +0 -24
- package/src/threeLetterSequenceStringToAminoAcidMap.ts +0 -198
- package/src/tidyUpAnnotation.ts +0 -205
- package/src/tidyUpSequenceData.ts +0 -213
- package/src/types.ts +0 -109
- package/types.d.ts +0 -105
|
@@ -1,238 +0,0 @@
|
|
|
1
|
-
import shortid from "shortid";
|
|
2
|
-
import { flatMap, cloneDeep } from "lodash-es";
|
|
3
|
-
import {
|
|
4
|
-
normalizePositionByRangeLength,
|
|
5
|
-
getRangeLength
|
|
6
|
-
} from "@teselagen/range-utils";
|
|
7
|
-
import getCutsitesFromSequence from "./getCutsitesFromSequence";
|
|
8
|
-
import { CutSite, DigestFragment, RestrictionEnzyme } from "./types";
|
|
9
|
-
|
|
10
|
-
// Explicitly define the params interface
|
|
11
|
-
export interface ComputeDigestFragmentsParams {
|
|
12
|
-
cutsites: CutSite[];
|
|
13
|
-
sequenceLength: number;
|
|
14
|
-
circular: boolean;
|
|
15
|
-
includeOverAndUnderHangs?: boolean;
|
|
16
|
-
computePartialDigest?: boolean;
|
|
17
|
-
computeDigestDisabled?: boolean;
|
|
18
|
-
computePartialDigestDisabled?: boolean;
|
|
19
|
-
selectionLayerUpdate?: (params: {
|
|
20
|
-
start: number;
|
|
21
|
-
end: number;
|
|
22
|
-
name: string;
|
|
23
|
-
}) => void;
|
|
24
|
-
updateSelectedFragment?: (id: string) => void;
|
|
25
|
-
}
|
|
26
|
-
|
|
27
|
-
export function computeDigestFragments({
|
|
28
|
-
cutsites,
|
|
29
|
-
sequenceLength,
|
|
30
|
-
circular,
|
|
31
|
-
//optional:
|
|
32
|
-
includeOverAndUnderHangs,
|
|
33
|
-
computePartialDigest,
|
|
34
|
-
computeDigestDisabled,
|
|
35
|
-
computePartialDigestDisabled,
|
|
36
|
-
selectionLayerUpdate,
|
|
37
|
-
updateSelectedFragment
|
|
38
|
-
}: ComputeDigestFragmentsParams) {
|
|
39
|
-
const fragments: DigestFragment[] = [];
|
|
40
|
-
const overlappingEnzymes: DigestFragment[] = [];
|
|
41
|
-
const pairs: CutSite[][] = [];
|
|
42
|
-
|
|
43
|
-
const sortedCutsites = cutsites.filter(
|
|
44
|
-
(
|
|
45
|
-
c
|
|
46
|
-
): c is CutSite & { topSnipPosition: number; bottomSnipPosition: number } =>
|
|
47
|
-
c.topSnipPosition != null && c.bottomSnipPosition != null
|
|
48
|
-
);
|
|
49
|
-
if (!circular && cutsites.length) {
|
|
50
|
-
sortedCutsites.push({
|
|
51
|
-
id: "seqTerm_" + shortid(),
|
|
52
|
-
start: 0,
|
|
53
|
-
end: 0,
|
|
54
|
-
overhangBps: "",
|
|
55
|
-
topSnipPosition: 0,
|
|
56
|
-
bottomSnipPosition: 0,
|
|
57
|
-
overhangSize: 0, // Added to satisfy CutSite
|
|
58
|
-
upstreamTopSnip: 0,
|
|
59
|
-
upstreamBottomSnip: 0,
|
|
60
|
-
upstreamTopBeforeBottom: false,
|
|
61
|
-
topSnipBeforeBottom: false,
|
|
62
|
-
recognitionSiteRange: {
|
|
63
|
-
start: 0,
|
|
64
|
-
end: 0
|
|
65
|
-
},
|
|
66
|
-
forward: true,
|
|
67
|
-
name: "Sequence_Terminus",
|
|
68
|
-
type: "START_OR_END_OF_SEQ",
|
|
69
|
-
restrictionEnzyme: {
|
|
70
|
-
name: "Sequence_Terminus",
|
|
71
|
-
site: "",
|
|
72
|
-
forwardRegex: "",
|
|
73
|
-
reverseRegex: ""
|
|
74
|
-
}
|
|
75
|
-
});
|
|
76
|
-
}
|
|
77
|
-
|
|
78
|
-
sortedCutsites.sort((a, b) => {
|
|
79
|
-
return a.topSnipPosition - b.topSnipPosition;
|
|
80
|
-
});
|
|
81
|
-
|
|
82
|
-
sortedCutsites.forEach((cutsite1, index) => {
|
|
83
|
-
if (!computeDigestDisabled) {
|
|
84
|
-
pairs.push([
|
|
85
|
-
cutsite1,
|
|
86
|
-
sortedCutsites[index + 1]
|
|
87
|
-
? sortedCutsites[index + 1]
|
|
88
|
-
: sortedCutsites[0]
|
|
89
|
-
]);
|
|
90
|
-
}
|
|
91
|
-
if (computePartialDigest && !computePartialDigestDisabled) {
|
|
92
|
-
sortedCutsites.forEach((cs, index2) => {
|
|
93
|
-
// Filter out adjacent cutsites (standard digest handles these)
|
|
94
|
-
const isAdjacent =
|
|
95
|
-
index2 === index + 1 ||
|
|
96
|
-
(index === sortedCutsites.length - 1 && index2 === 0);
|
|
97
|
-
if (isAdjacent) {
|
|
98
|
-
return;
|
|
99
|
-
}
|
|
100
|
-
pairs.push([cutsite1, sortedCutsites[index2]]);
|
|
101
|
-
});
|
|
102
|
-
}
|
|
103
|
-
});
|
|
104
|
-
|
|
105
|
-
pairs.forEach(r => {
|
|
106
|
-
let [cut1, cut2] = r;
|
|
107
|
-
|
|
108
|
-
let start: number;
|
|
109
|
-
let end: number;
|
|
110
|
-
let size: number;
|
|
111
|
-
start = normalizePositionByRangeLength(
|
|
112
|
-
cut1.topSnipPosition!,
|
|
113
|
-
sequenceLength
|
|
114
|
-
);
|
|
115
|
-
end = normalizePositionByRangeLength(
|
|
116
|
-
cut2.topSnipPosition! - 1,
|
|
117
|
-
sequenceLength
|
|
118
|
-
);
|
|
119
|
-
size = getRangeLength({ start, end }, sequenceLength);
|
|
120
|
-
let overlapsSelf: boolean | undefined;
|
|
121
|
-
if (includeOverAndUnderHangs) {
|
|
122
|
-
const oldSize = size;
|
|
123
|
-
start = normalizePositionByRangeLength(
|
|
124
|
-
cut1.topSnipBeforeBottom
|
|
125
|
-
? cut1.topSnipPosition!
|
|
126
|
-
: cut1.bottomSnipPosition!,
|
|
127
|
-
sequenceLength
|
|
128
|
-
);
|
|
129
|
-
end = normalizePositionByRangeLength(
|
|
130
|
-
cut2.topSnipBeforeBottom
|
|
131
|
-
? cut2.bottomSnipPosition! - 1
|
|
132
|
-
: cut2.topSnipPosition! - 1,
|
|
133
|
-
sequenceLength
|
|
134
|
-
);
|
|
135
|
-
size = getRangeLength({ start, end }, sequenceLength);
|
|
136
|
-
if (oldSize > size) {
|
|
137
|
-
//we've got a part that wraps on itself
|
|
138
|
-
overlapsSelf = true;
|
|
139
|
-
size += sequenceLength;
|
|
140
|
-
}
|
|
141
|
-
}
|
|
142
|
-
|
|
143
|
-
let isFormedFromLinearEnd: boolean | undefined;
|
|
144
|
-
if (cut1.name === "Sequence_Terminus") {
|
|
145
|
-
cut1 = cloneDeep(cut1);
|
|
146
|
-
isFormedFromLinearEnd = true;
|
|
147
|
-
cut1.name = "Linear_Sequence_Start";
|
|
148
|
-
cut1.restrictionEnzyme.name = "Linear_Sequence_Start";
|
|
149
|
-
} else if (cut2.name === "Sequence_Terminus") {
|
|
150
|
-
cut2 = cloneDeep(cut2);
|
|
151
|
-
isFormedFromLinearEnd = true;
|
|
152
|
-
cut2.name = "Linear_Sequence_End";
|
|
153
|
-
cut2.restrictionEnzyme.name = "Linear_Sequence_End";
|
|
154
|
-
}
|
|
155
|
-
|
|
156
|
-
// Add isOverhangIncludedInFragmentSize logic
|
|
157
|
-
cut1 = {
|
|
158
|
-
...cut1,
|
|
159
|
-
isOverhangIncludedInFragmentSize:
|
|
160
|
-
cut1.name !== "Linear_Sequence_Start" &&
|
|
161
|
-
cut1.name !== "Sequence_Terminus" &&
|
|
162
|
-
(cut1.overhangSize || 0) > 0 &&
|
|
163
|
-
!!cut1.topSnipBeforeBottom
|
|
164
|
-
};
|
|
165
|
-
cut2 = {
|
|
166
|
-
...cut2,
|
|
167
|
-
isOverhangIncludedInFragmentSize:
|
|
168
|
-
cut2.name !== "Linear_Sequence_End" &&
|
|
169
|
-
cut2.name !== "Sequence_Terminus" &&
|
|
170
|
-
(cut2.overhangSize || 0) > 0 &&
|
|
171
|
-
!cut2.topSnipBeforeBottom
|
|
172
|
-
};
|
|
173
|
-
|
|
174
|
-
const id = start + "-" + end + "-" + size + "-";
|
|
175
|
-
const name = `${cut1.restrictionEnzyme.name} -- ${cut2.restrictionEnzyme.name} ${size} bps`;
|
|
176
|
-
// getRangeLength({ start, end }, sequenceLength);
|
|
177
|
-
|
|
178
|
-
fragments.push({
|
|
179
|
-
isFormedFromLinearEnd,
|
|
180
|
-
madeFromOneCutsite: cut1.id === cut2.id,
|
|
181
|
-
start,
|
|
182
|
-
end,
|
|
183
|
-
size,
|
|
184
|
-
overlapsSelf,
|
|
185
|
-
id,
|
|
186
|
-
name,
|
|
187
|
-
cut1,
|
|
188
|
-
cut2,
|
|
189
|
-
onFragmentSelect:
|
|
190
|
-
selectionLayerUpdate && updateSelectedFragment
|
|
191
|
-
? () => {
|
|
192
|
-
selectionLayerUpdate({
|
|
193
|
-
start,
|
|
194
|
-
end,
|
|
195
|
-
name
|
|
196
|
-
});
|
|
197
|
-
|
|
198
|
-
updateSelectedFragment(id);
|
|
199
|
-
}
|
|
200
|
-
: undefined
|
|
201
|
-
});
|
|
202
|
-
});
|
|
203
|
-
fragments.filter(fragment => {
|
|
204
|
-
if (!fragment.size) {
|
|
205
|
-
overlappingEnzymes.push(fragment);
|
|
206
|
-
return false;
|
|
207
|
-
}
|
|
208
|
-
return true;
|
|
209
|
-
});
|
|
210
|
-
return {
|
|
211
|
-
computePartialDigestDisabled,
|
|
212
|
-
computeDigestDisabled,
|
|
213
|
-
fragments,
|
|
214
|
-
overlappingEnzymes
|
|
215
|
-
};
|
|
216
|
-
}
|
|
217
|
-
|
|
218
|
-
export function getDigestFragsForSeqAndEnzymes({
|
|
219
|
-
sequence,
|
|
220
|
-
circular,
|
|
221
|
-
enzymes,
|
|
222
|
-
includeOverAndUnderHangs
|
|
223
|
-
}: {
|
|
224
|
-
sequence: string;
|
|
225
|
-
circular: boolean;
|
|
226
|
-
enzymes: RestrictionEnzyme[];
|
|
227
|
-
includeOverAndUnderHangs?: boolean;
|
|
228
|
-
}) {
|
|
229
|
-
const cutsitesByName = getCutsitesFromSequence(sequence, circular, enzymes);
|
|
230
|
-
const digest = computeDigestFragments({
|
|
231
|
-
includeOverAndUnderHangs,
|
|
232
|
-
cutsites: flatMap(cutsitesByName) as CutSite[],
|
|
233
|
-
sequenceLength: sequence.length,
|
|
234
|
-
circular
|
|
235
|
-
});
|
|
236
|
-
digest.fragments.sort((a, b) => b.size - a.size);
|
|
237
|
-
return digest;
|
|
238
|
-
}
|
|
@@ -1,85 +0,0 @@
|
|
|
1
|
-
export default function condensePairwiseAlignmentDifferences(
|
|
2
|
-
referenceSeq: string,
|
|
3
|
-
alignedSeq: string
|
|
4
|
-
): string {
|
|
5
|
-
const overviewMinimapTrack: string[] = [];
|
|
6
|
-
const referenceSeqSplit = referenceSeq.toLowerCase().split("");
|
|
7
|
-
const alignedSeqSplit = alignedSeq.toLowerCase().split("");
|
|
8
|
-
const seqLength = alignedSeq.length;
|
|
9
|
-
const alignedSeqWithoutLeadingDashes = alignedSeq.replace(/^-+/g, "");
|
|
10
|
-
const alignedSeqWithoutTrailingDashes = alignedSeq.replace(/-+$/g, "");
|
|
11
|
-
|
|
12
|
-
const startIndex = seqLength - alignedSeqWithoutLeadingDashes.length;
|
|
13
|
-
const endIndex =
|
|
14
|
-
seqLength - (seqLength - alignedSeqWithoutTrailingDashes.length);
|
|
15
|
-
for (let i = 0; i < referenceSeqSplit.length; i++) {
|
|
16
|
-
if (i < startIndex || i >= endIndex) {
|
|
17
|
-
overviewMinimapTrack.push("W");
|
|
18
|
-
} else if (
|
|
19
|
-
referenceSeqSplit[i] === alignedSeqSplit[i] &&
|
|
20
|
-
referenceSeqSplit[i] !== "-" &&
|
|
21
|
-
alignedSeqSplit[i] !== "-"
|
|
22
|
-
) {
|
|
23
|
-
// ACTG match
|
|
24
|
-
overviewMinimapTrack.push("G");
|
|
25
|
-
} else if (
|
|
26
|
-
referenceSeqSplit[i] !== alignedSeqSplit[i] &&
|
|
27
|
-
referenceSeqSplit[i] !== "-" &&
|
|
28
|
-
alignedSeqSplit[i] !== "-"
|
|
29
|
-
) {
|
|
30
|
-
// ACTG mismatch
|
|
31
|
-
overviewMinimapTrack.push("R");
|
|
32
|
-
} else if (alignedSeqSplit[i] === "-") {
|
|
33
|
-
// deletion
|
|
34
|
-
overviewMinimapTrack.push("R");
|
|
35
|
-
} else if (
|
|
36
|
-
referenceSeqSplit[i] === "-" &&
|
|
37
|
-
referenceSeqSplit[i - 1] !== "-" &&
|
|
38
|
-
i !== referenceSeqSplit.length - 1 &&
|
|
39
|
-
referenceSeqSplit[i + 1] === "-"
|
|
40
|
-
) {
|
|
41
|
-
// insertion (first "-" of a >1 insertion)
|
|
42
|
-
overviewMinimapTrack.push("R");
|
|
43
|
-
} else if (
|
|
44
|
-
referenceSeqSplit[i] === "-" &&
|
|
45
|
-
referenceSeqSplit[i - 1] !== "-" &&
|
|
46
|
-
i !== referenceSeqSplit.length - 1 &&
|
|
47
|
-
referenceSeqSplit[i + 1] !== "-"
|
|
48
|
-
) {
|
|
49
|
-
// "-" of a one-bp insertion in the middle of the sequence
|
|
50
|
-
overviewMinimapTrack.push("R");
|
|
51
|
-
i++;
|
|
52
|
-
} else if (
|
|
53
|
-
i === referenceSeqSplit.length - 1 &&
|
|
54
|
-
referenceSeqSplit[i] === "-" &&
|
|
55
|
-
referenceSeqSplit[i - 1] === "-"
|
|
56
|
-
) {
|
|
57
|
-
// final "-" of a >1 insertion at the 3' end of the sequence
|
|
58
|
-
overviewMinimapTrack.splice(-2, 1);
|
|
59
|
-
} else if (
|
|
60
|
-
i === referenceSeqSplit.length - 1 &&
|
|
61
|
-
referenceSeqSplit[i] === "-" &&
|
|
62
|
-
referenceSeqSplit[i - 1] !== "-"
|
|
63
|
-
) {
|
|
64
|
-
// "-" of a one-bp insertion at the 3' end of the sequence
|
|
65
|
-
overviewMinimapTrack.pop();
|
|
66
|
-
overviewMinimapTrack.push("R");
|
|
67
|
-
} else if (
|
|
68
|
-
referenceSeqSplit[i] === "-" &&
|
|
69
|
-
referenceSeqSplit[i - 1] === "-" &&
|
|
70
|
-
referenceSeqSplit[i + 1] !== "-"
|
|
71
|
-
) {
|
|
72
|
-
// "-" at the end of an insertion
|
|
73
|
-
i++;
|
|
74
|
-
} else if (
|
|
75
|
-
referenceSeqSplit[i] === "-" &&
|
|
76
|
-
referenceSeqSplit[i - 1] === "-"
|
|
77
|
-
) {
|
|
78
|
-
// insertion (NOT first "-" of the insertion)
|
|
79
|
-
// do nothing, skip over these "-"
|
|
80
|
-
} else {
|
|
81
|
-
console.error("should not reach this step!");
|
|
82
|
-
}
|
|
83
|
-
}
|
|
84
|
-
return overviewMinimapTrack.join("");
|
|
85
|
-
}
|
|
@@ -1,28 +0,0 @@
|
|
|
1
|
-
import { Range } from "./types";
|
|
2
|
-
|
|
3
|
-
export default function convertAACaretPositionOrRangeToDna(
|
|
4
|
-
rangeOrCaret: Range | number
|
|
5
|
-
): Range | number {
|
|
6
|
-
if (typeof rangeOrCaret === "object" && rangeOrCaret !== null) {
|
|
7
|
-
return convertAARangeToDnaRange({
|
|
8
|
-
...rangeOrCaret,
|
|
9
|
-
locations: rangeOrCaret.locations
|
|
10
|
-
? rangeOrCaret.locations.map(convertAARangeToDnaRange)
|
|
11
|
-
: undefined
|
|
12
|
-
});
|
|
13
|
-
} else {
|
|
14
|
-
return convertAACaretPositionToDnaCaretPosition(rangeOrCaret as number);
|
|
15
|
-
}
|
|
16
|
-
}
|
|
17
|
-
|
|
18
|
-
function convertAACaretPositionToDnaCaretPosition(caret: number): number {
|
|
19
|
-
return caret * 3;
|
|
20
|
-
}
|
|
21
|
-
|
|
22
|
-
function convertAARangeToDnaRange(range: Range): Range {
|
|
23
|
-
return {
|
|
24
|
-
...range,
|
|
25
|
-
start: range.start > -1 ? range.start * 3 : range.start,
|
|
26
|
-
end: range.end > -1 ? range.end * 3 + 2 : range.end
|
|
27
|
-
};
|
|
28
|
-
}
|
|
@@ -1,28 +0,0 @@
|
|
|
1
|
-
import { Range } from "./types";
|
|
2
|
-
|
|
3
|
-
export default function convertDnaCaretPositionOrRangeToAA(
|
|
4
|
-
rangeOrCaret: Range | number
|
|
5
|
-
): Range | number {
|
|
6
|
-
if (typeof rangeOrCaret === "object" && rangeOrCaret !== null) {
|
|
7
|
-
return convertDnaRangeToAARange({
|
|
8
|
-
...rangeOrCaret,
|
|
9
|
-
locations: rangeOrCaret.locations
|
|
10
|
-
? rangeOrCaret.locations.map(convertDnaRangeToAARange)
|
|
11
|
-
: undefined
|
|
12
|
-
});
|
|
13
|
-
} else {
|
|
14
|
-
return convertDnaCaretPositionToAACaretPosition(rangeOrCaret as number);
|
|
15
|
-
}
|
|
16
|
-
}
|
|
17
|
-
|
|
18
|
-
function convertDnaCaretPositionToAACaretPosition(caret: number): number {
|
|
19
|
-
return Math.floor(caret / 3);
|
|
20
|
-
}
|
|
21
|
-
|
|
22
|
-
function convertDnaRangeToAARange(range: Range): Range {
|
|
23
|
-
return {
|
|
24
|
-
...range,
|
|
25
|
-
start: range.start > -1 ? Math.floor(range.start / 3) : range.start,
|
|
26
|
-
end: range.end > -1 ? Math.floor(range.end - 2) / 3 : range.end
|
|
27
|
-
};
|
|
28
|
-
}
|