It would also be useful to parse the Rfree and number of reflections used to generate the Rfree from the PDB remarks.
FREE R VALUE
FREE R VALUE TEST SET COUNT
Something like:
def extract_rfree(pdb_dict, lines):
"""Takes a ``dict`` and adds rfree information to it by parsing
REMARK 3.
:param dict pdb_dict: the ``dict`` to update.
:param list lines: the file lines to read from."""
remark_lines = get_lines("REMARK", lines)
pattern = r"FREE R VALUE\s+:(.+)"
for remark in remark_lines:
if int(remark[7:10]) == 3 and remark[10:].strip():
matches = re.findall(pattern, remark)
if matches:
try:
pdb_dict["rfree"] = float(matches[0].strip())
break
except: pass
else:
pdb_dict["rfree"] = None
def extract_rfree_count(pdb_dict, lines):
"""Takes a ``dict`` and adds rfree information to it by parsing
REMARK 3.
:param dict pdb_dict: the ``dict`` to update.
:param list lines: the file lines to read from."""
remark_lines = get_lines("REMARK", lines)
pattern = r"FREE R VALUE TEST SET COUNT\s+:(.+)"
for remark in remark_lines:
if int(remark[7:10]) == 3 and remark[10:].strip():
matches = re.findall(pattern, remark)
if matches:
try:
pdb_dict["freecount"] = float(matches[0].strip())
break
except: pass
else:
pdb_dict["freecount"] = None
It would also be useful to parse the Rfree and number of reflections used to generate the Rfree from the PDB remarks.
FREE R VALUE FREE R VALUE TEST SET COUNT
Something like: