subSeq method

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

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

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

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

Implementation

AminoAcidSequence subSeq(int startIndex, [int? endIndex]) {
  List<AminoAcid> copySeq = [];
  for (AminoAcid i in sequence.sublist(startIndex, endIndex)) {
    copySeq.add(i.deepCopy());
  }
  Map<String, AminoAcidInfo>? copyAAInfo;
  if (aminoAcidInfo != null) {
    copyAAInfo = {};
    for (String i in aminoAcidInfo!.keys) {
      copyAAInfo[i] = aminoAcidInfo![i]!.deepCopy();
    }
  }
  return AminoAcidSequence.fromSeq(copySeq,
      direction: direction,
      description: description,
      info: info != null ? {...info!} : null,
      aminoAcidInfo: copyAAInfo);
}