Lib mmCIF¶
Handle CIF data.
- class idpconfgen.libs.libcif.CIFParser(datastr, label_priority='auth')[source]¶
mmCIFParser for structural data ONLY.
That is, fields from the m_site.` group.
- Parameters:
datastr (str) – The content of the mmCIF file in string format.
- get_line_elements_for_PDB(line=None)[source]¶
Retrieve line elements.
- Parameters:
line (int, optional) – If given retrieve values for that line and sets that as current line. Else, retrieves values for current
line
.- Returns:
list – The values of the line.
- property line¶
The current line number.
- idpconfgen.libs.libcif.find_cif_atom_site_headers(lines, cif_dict)[source]¶
Find _atom_site. headers.
Given a list of mmCIF lines, finds headers of _atom_site.
- Parameters:
lines (list) – The lines of the mmCIF files are read by file.readlines().
cif_dict (dict) – A dictionary where to initiate the atom_site. keys. Keys are assigned empty list as value.
- Returns:
int – The index of
lines
where the _atom_site. structural information starts.- Raises:
CIFFileError – If any _atom_site. keys are found in
lines
.
See also
- idpconfgen.libs.libcif.parse_cif_line(line)[source]¶
Parse CIF line according to CIF_LINE_REGEX.
- Parameters:
line (str) – The line to parse.
- Returns:
list – A list with the parsed line elements.
- idpconfgen.libs.libcif.populate_cif_dictionary(lines, start_index, cif_dict)[source]¶
Populate mmCIF dictionary.
Expects atom coordinate information to be consecutive, otherwise reading will be incomplete or errors will occur.
- Parameters:
lines (list) – The mmCIF lines. Normally the whole mmCIF file content.
start_index (int) – The line index, that is, line number 0-indexed, where the actual atom_site. structural information starts, that is, the first ATOM/HETATM line.
cif_dict (dict) – The mmCIF dictionary to populate. The dict keys should be previously prepared and should match the data in the lines.
- Returns:
None – Edits dictionary in place.
- Raises:
InvalidCIFLineError – If the number of fields in parsed line do not match expected _atom_site. fields in the dictionary.
See also