io
glob_structure_files(input_dir)
locate_structure_file(root, pdb_id)
Locate a structure file for a given PDB ID in the specified directory.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
root
|
Path
|
The root directory to search in. |
required |
pdb_id
|
str
|
The PDB ID to locate. |
required |
Returns:
Type | Description |
---|---|
Path
|
The path to the located structure file. |
Raises:
Type | Description |
---|---|
FileNotFoundError
|
If no structure file is found for the given PDB ID. |
nr_residues_in_chain(file, chain='A')
write_single_chain_pdb_file(input_file, chain2keep, output_dir, out_chain='A')
Write a single chain from a mmCIF/pdb file to a new mmCIF/pdb file.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
input_file
|
Path
|
Path to the input mmCIF/pdb file. |
required |
chain2keep
|
str
|
The chain to keep. |
required |
output_dir
|
Path
|
Directory to save the output file. |
required |
out_chain
|
str
|
The chain identifier for the output file. |
'A'
|
Returns:
Type | Description |
---|---|
Path | None
|
Path to the output mmCIF/pdb file or None if not created. |
write_structure(structure, path)
Write a gemmi structure to a file.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
structure
|
Structure
|
The gemmi structure to write. |
required |
path
|
Path
|
The file path to write the structure to. The format depends on the file extension. Supported extensions are .pdb, .pdb.gz, .cif, .cif.gz. |
required |
Raises:
Type | Description |
---|---|
ValueError
|
If the file extension is not supported. |