Structure.subset_by_range#
- Structure.subset_by_range(start, stop, chain=None)[source]#
Return a subset of the structure within a specific range of residues.
- Parameters:
- startint
The starting residue sequence number.
- stopint
The ending residue sequence number.
- chainstr, optional
The chain identifier. If multiple chains should be selected they need to be a comma separated string, e.g. ‘A,B,CE’. If chain None, all chains are returned. Default is None.
- Returns:
Structure
A subset of the original structure within the specified residue range.
- Raises:
- ValueError
If none of the specified residue chain combinations exist.
Examples
>>> from importlib_resources import files >>> from tme import Structure >>> fname = str(files("tests.data").joinpath("Structures/5khe.cif")) >>> structure = Structure.from_file(filename=fname) >>> structure.subset_by_range(chain="A",start=150,stop=180)