getPositions static method
List<int>
getPositions(
- NucleotideSequence seq,
- NucleotideSequence target,
- bool compareOnlyBase, {
- bool fuzzyComp = false,
(en) Returns a list of the indices of the beginning of the pattern where the specified pattern occurs.
(ja) 指定したパターンが出現する、パターンの先頭のインデックスをリストで返します。
seq
: The sequence data.target
: The target pattern.compareOnlyBase
: If true, compare only Nucleotide.base. If false, compare also Nucleotide.infoKey.fuzzyComp
: If true, Can contain m, r, w, s, y, k, v, h, d, b, n. If true, t and u are searched as the same.
Implementation
static List<int> getPositions(
NucleotideSequence seq, NucleotideSequence target, bool compareOnlyBase,
{bool fuzzyComp = false}) {
List<int> r = [];
for (int i = 0; i <= seq.length() - target.length(); i++) {
if (compareOnlyBase) {
if (UtilCompareNucleotide.compareBase(
seq.subSeqNonInfo(i, i + target.length()), target, fuzzyComp)) {
r.add(i);
}
} else {
if (UtilCompareNucleotide.compare(
seq.subSeq(i, i + target.length()), target, fuzzyComp)) {
r.add(i);
}
}
}
return r;
}