> ## Documentation Index
> Fetch the complete documentation index at: https://bagel.softnanolab.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Chain

> Encodes residues and mutability of a monomeric chain, with functionality to read, write, and mutate the chain.

## Parameters

<ResponseField name="residues" type="List[Residue]" required>
  List of Residue objects
</ResponseField>

## Methods

### chain\_ID

ID of the monomer chain.

### mutability

List of mutability of each Residue in Chain.

### sequence

String (one-letter) representation of amino acids in Chain.

### mutable\_residues

List of mutable Residues in Chain

### mutable\_residue\_indexes

List of the indexes of mutable Residues in Chain

### length

Number of amino acids in Chain.

### from\_pdb

Create Chain object from a PDB file string. Residue indices are 0-indexed.

**Parameters**

<ResponseField name="file_path" type="str" required />

<ResponseField name="chain_id" type="str" required />

### from\_cif

Create Chain object from a CIF file string.

**Parameters**

<ResponseField name="cif_data" type="str" required />

### remove\_residue

Remove the Residue at the given index (0-indexed).

**Parameters**

<ResponseField name="index" type="int" required />

### add\_residue

Add a Residue of type amino\_acid at the position specified by index (0-indexed).

**Parameters**

<ResponseField name="amino_acid" type="str" required />

<ResponseField name="index" type="int" required />

### mutate\_residue

Change identity of Residue at position specified by index to 'amino\_acid'

**Parameters**

<ResponseField name="index" type="int" required />

<ResponseField name="amino_acid" type="str" required />

## Example

```python theme={null}
import bagel as bg

residues = [
    bg.Residue(name='A', chain_ID='A', index=0, mutable=True),
    bg.Residue(name='G', chain_ID='A', index=1, mutable=True),
]
chain = bg.Chain(residues=residues)
chain.mutate_residue(index=1, amino_acid='V')
```
