Skip to content

convert

Conversion orchestration for structure files.

ConversionStatistics dataclass

Statistics for a single file conversion.

Attributes:

Name Type Description
input_file Path

Path to the input file.

output_file Path

Path to the output file.

uniprot_chain_mappings UniprotChainMappings

Set of UniprotChainMapping that were injected, empty set if none.

convert_to_cif_file(input_file, output_dir, copy_method, output_format='.cif', pdb2uniprot=None, chain_system='auth')

Convert a single structure file to CIF format.

Parameters:

Name Type Description Default
input_file Path

The structure file to convert. See StructureFileExtensions for supported extensions.

required
output_dir Path

Directory to save the converted file.

required
copy_method CopyMethod

How to copy when no changes are needed to output file.

required
output_format CifOutputFormat

Output file format to write.

'.cif'
pdb2uniprot Pdb2UniprotChainsMapping | None

Optional dictionary mapping PDB ID to structured UniProt chain mappings. If provided, will not use any shortcuts for copying files and will always read and write the structure to ensure UniProt accessions are verified and injected if necessary.

None
chain_system ChainIdSystem

System of chain ids in pdb2uniprot mapping.

'auth'

Returns:

Type Description
ConversionStatistics

ConversionStatistics with details about the conversion.

Raises:

Type Description
ValueError

If the requested output format is not supported.

write_conversion_stats(results, output_file)

Write conversion statistics to a CSV file.

Parameters:

Name Type Description Default
results Iterable[ConversionStatistics]

Iterable of ConversionStatistics to write.

required
output_file Path

Path to write the CSV file. Use '-' for stdout.

required