Beispiel #1
0
def _parse_statistics(stats: ProcStats, report):
    with open(report, "r", encoding="utf-8") as r:
        log = r.readlines()

    for n, line in enumerate(log):
        if "Unit cell and space group:" in line:
            parts = line.split()
            stats.space_group = "".join(parts[11:]).replace("'", "")
            (
                stats.unit_cell_a,
                stats.unit_cell_b,
                stats.unit_cell_c,
                stats.unit_cell_alpha,
                stats.unit_cell_beta,
                stats.unit_cell_gamma,
            ) = parts[5:11]
        if "Low resolution limit  " in line:
            stats.low_resolution_average, stats.low_resolution_out = (
                line.split()[3],
                line.split()[5],
            )
        if "High resolution limit  " in line:
            stats.high_resolution_out, stats.high_resolution_average = (
                line.split()[3],
                line.split()[5],
            )
        if "Total number of observations  " in line:
            stats.reflections = line.split()[-3]
        if "Total number unique  " in line:
            stats.unique_reflections = line.split()[-3]
        if "Multiplicity  " in line:
            stats.multiplicity = line.split()[1]
        if "Mean(I)/sd(I)" in line:
            stats.i_sig_average = line.split()[1]
            stats.i_sig_out = line.split()[-1]
        if "Completeness (ellipsoidal)" in line or "Completeness (spherical)" in line:
            stats.completeness_average = line.split()[2]
            stats.completeness_out = line.split()[-1]
        if "Rmeas   (all I+ & I-)" in line:
            stats.r_meas_average = line.split()[-3]
            stats.r_meas_out = line.split()[-1]
        elif "Rmeas" in line:
            stats.r_meas_average = line.split()[-3]
            stats.r_meas_out = line.split()[-1]
        if "CRYSTAL MOSAICITY (DEGREES)" in line:
            stats.mosaicity = line.split()[-1]
        if "ISa (" in line:
            stats.isa = log[n + 1].split()[-1]

    return stats
Beispiel #2
0
def _parse_statistics(project: Project, edna_dir: Path, dataset, stats: ProcStats):
    log_file = Path(edna_dir, f"ep_{dataset.name}_aimless_anom.log")

    with open(log_file, "r", encoding="utf-8") as r:
        log = r.readlines()

    for line in log:
        if "Space group:" in line:
            stats.space_group = "".join(line.split()[2:])
        if "Number of unique reflections" in line:
            stats.unique_reflections = line.split()[-1]
        if "Total number of observations" in line:
            stats.reflections = line.split()[-3]
        if "Low resolution limit" in line:
            stats.low_resolution_average = line.split()[3]
            stats.low_resolution_out = line.split()[-1]
        if "High resolution limit" in line:
            stats.high_resolution_average = line.split()[3]
            stats.high_resolution_out = line.split()[-1]
        if line.startswith(UNIT_CELL):
            (
                stats.unit_cell_a,
                stats.unit_cell_b,
                stats.unit_cell_c,
                stats.unit_cell_alpha,
                stats.unit_cell_beta,
                stats.unit_cell_gamma,
            ) = line[len(UNIT_CELL) :].split()
        if "Multiplicity" in line:
            stats.multiplicity = line.split()[1]
        if "Mean((I)/sd(I))" in line:
            stats.i_sig_average = line.split()[1]
            stats.i_sig_out = line.split()[-1]
        if "Rmeas (all I+ & I-)" in line:
            stats.r_meas_average = line.split()[5]
            stats.r_meas_out = line.split()[-1]
        if "completeness" in line:
            stats.completeness_average = line.split()[-3]
            stats.completeness_out = line.split()[-1]
        if "mosaicity" in line:
            stats.mosaicity = line.split()[-1]

    return stats
Beispiel #3
0
def _parse_xia2_html(project: Project, xia2_html: Path, stats: ProcStats):
    for line in read_text_lines(project, xia2_html):
        if "High resolution limit  " in line:
            stats.high_resolution_average = line.split()[-3]
            stats.high_resolution_out = line.split()[-1]
        if "Low resolution limit  " in line:
            stats.low_resolution_average = line.split()[-3]
            stats.low_resolution_out = line.split()[-1]
        if "Completeness  " in line:
            stats.completeness_average = line.split()[-3]
            stats.completeness_out = line.split()[-1]
        if "Multiplicity  " in line:
            stats.multiplicity = line.split()[-3]
        if "Rmeas(I+/-) " in line:
            stats.r_meas_average = line.split()[-3]
            stats.r_meas_out = line.split()[-1]
        if "Total unique" in line:
            stats.unique_reflections = line.split()[-3]
        if "Total observations" in line:
            stats.reflections = line.split()[-3]
        if "Mosaic spread" in line:
            stats.mosaicity = line.split()[-1]
        if "I/sigma  " in line:
            stats.i_sig_average = line.split()[-3]
            stats.i_sig_out = line.split()[-1]
        if "Space group:  " in line:
            stats.space_group = "".join(line.split()[2:])
        if "Unit cell: " in line:
            vals = line.split(":")[1].strip()
            (
                stats.unit_cell_a,
                stats.unit_cell_b,
                stats.unit_cell_c,
                stats.unit_cell_alpha,
                stats.unit_cell_beta,
                stats.unit_cell_gamma,
            ) = vals.split(", ")