Skip to content

Commit

Permalink
Update PDB header parser to get REMARK350
Browse files Browse the repository at this point in the history
  • Loading branch information
flat35hd99 committed Oct 30, 2021
1 parent a82abec commit c4aae6f
Showing 1 changed file with 43 additions and 0 deletions.
43 changes: 43 additions & 0 deletions Bio/PDB/parse_pdb_header.py
Original file line number Diff line number Diff line change
Expand Up @@ -194,6 +194,8 @@ def _parse_pdb_header_list(header):
"source": {"1": {"misc": ""}},
"has_missing_residues": False,
"missing_residues": [],
"chain_ids_to_work_symmetry_operator": [],
"symmetry_operator": [],
}

pdbh_dict["structure_reference"] = _get_references(header)
Expand Down Expand Up @@ -318,6 +320,47 @@ def _parse_pdb_header_list(header):
pdbh_dict["astral"][remark_99_keyval[0]] = remark_99_keyval[
1
]
elif hh.startswith("REMARK 350"):
if "APPLY THE FOLLOWING TO CHAINS:" in tail:
chain_id_start_number = 42
chain_ids_str = hh[chain_id_start_number:]
chain_ids = [id.strip() for id in chain_ids_str.split(sep=", ")]
pdbh_dict["chain_ids_to_work_symmetry_operator"] = chain_ids
elif re.match("BIOMT\d", tail):
tail_word_list = tail.split()
the_order_of_matrix = int(tail_word_list[1]) # 1, 2, 3, ...
# First matrix must unit matrix.
# It must be ignored.
if the_order_of_matrix == 1:
continue
else:
the_order_of_row = int(tail_word_list[0][-1]) # 1, 2, or 3
matrix_row = [float(tail_word_list[i]) for i in [2,3,4]]
translation_value = float(tail_word_list[-1])

if the_order_of_row == 1:
matrix_dict = {
"matrix": [
matrix_row,
],
"shift": [translation_value]
}
pdbh_dict["symmetry_operator"].append(matrix_dict)
else:
# symmetric_operator = [
# {
# "matrix": [
# [x11, x12, x13],
# [x21, x22, x23],
# [x31, x32, x33],
# ],
# "shift": [x, y, z]
# },
# {...},
# {...},
# ]
pdbh_dict["symmetry_operator"][the_order_of_matrix - 2]["matrix"].append(matrix_row)
pdbh_dict["symmetry_operator"][the_order_of_matrix - 2]["shift"].append(translation_value)
else:
# print(key)
pass
Expand Down

0 comments on commit c4aae6f

Please sign in to comment.