skbio.sequence.Protein.index¶
- Protein.index(subsequence, start=None, end=None)[源代码]¶
找到序列中子序列首先出现的位置。
状态:0.4.0稳定。
- 参数:
subsequence (str, Sequence, or 1D np.ndarray (np.uint8 or '|S1')) -- 要在此序列中搜索的子序列。
start (int, optional) -- 开始搜索的位置(包括)。
end (int, optional) -- 停止搜索的位置(独占)。
- 返回:
位置 subsequence 第一次出现在这个序列中。
- 返回类型:
int
- 抛出:
ValueError -- 如果 subsequence 在此序列中不存在。
TypeError -- 如果 subsequence 是一个
Sequence
对象的类型与此序列不同。
示例
>>> from skbio import Sequence >>> s = Sequence('ACACGACGTT-') >>> s.index('ACG') 2