subSeq method

NucleotideSequence subSeq(
  1. int startIndex, [
  2. int? endIndex
])

(en) Get a partial sequence. Data other than seq are copied.

(ja) 部分的なシーケンスを取得します。seq以外のデータについてはコピーされます。

  • startIndex : Copy start index.
  • endIndex : Copy end index. Works the same as list.sublist.

Implementation

NucleotideSequence subSeq(int startIndex, [int? endIndex]) {
  List<Nucleotide> copySeq = [];
  for (Nucleotide i in sequence.sublist(startIndex, endIndex)) {
    copySeq.add(i.deepCopy());
  }
  Map<String, NucleotideInfo>? copyNInfo;
  if (nucleotideInfo != null) {
    copyNInfo = {};
    for (String i in nucleotideInfo!.keys) {
      copyNInfo[i] = nucleotideInfo![i]!.deepCopy();
    }
  }
  return NucleotideSequence.fromSeq(copySeq,
      type: type,
      id: id,
      direction: direction,
      description: description,
      info: info != null ? {...info!} : null,
      nucleotideInfo: copyNInfo);
}