def test_hewl():
    mtz = gemmi.read_mtz_file(data_path("hewl_data.mtz"))
    fsigf = DataItem(mtz, "F_New,SIGF_New")
    fphi = DataItem(mtz, "FWT,PHWT")
    comit = Comit(fsigf, fphi)
    assert comit.abcd.nreflections == mtz.nreflections
    assert comit.fphi.nreflections == mtz.nreflections
def test_combine_data_items():
    mtz = gemmi.read_mtz_file(data_path("1kv9_data.mtz"))
    fsigf = DataItem(mtz, "FP,SIGFP")
    freer = DataItem(mtz, "FREE")
    combined = _combine_data_items([fsigf, freer])
    assert combined.column_labels() == ["H", "K", "L", "FP", "SIGFP", "FREE"]
    assert mtz.nreflections == combined.nreflections
Beispiel #3
0
def test_1kv9():
    mtz = gemmi.read_mtz_file(data_path("1kv9_data.mtz"))
    fsigf = DataItem(mtz, "FP,SIGFP")
    freer = DataItem(mtz, "FREE")
    structure = read_structure(data_path("1kv9_model.pdb"))
    sheetbend = Sheetbend(fsigf, freer, structure)
    assert ModelStats(structure) == ModelStats(sheetbend.structure)
def test_1kv9():
    contents = AsuContents(data_path("1kv9_sequence.fasta"))
    mtz = gemmi.read_mtz_file(data_path("1kv9_data.mtz"))
    fsigf = DataItem(mtz, "FP,SIGFP")
    freer = DataItem(mtz, "FREE")
    phases = DataItem(mtz, "HL")
    parrot = Parrot(contents, fsigf, freer, phases)
    assert parrot.abcd.nreflections == mtz.nreflections
    assert parrot.fphi.nreflections == mtz.nreflections
Beispiel #5
0
def test_1kv9_prune():
    structure = read_structure(data_path("1kv9_model.pdb"))
    stats_in = ModelStats(structure)
    mtz = gemmi.read_mtz_file(data_path("1kv9_data.mtz"))
    fsigf = DataItem(mtz, "FP,SIGFP")
    freer = DataItem(mtz, "FREE")
    refmac = Refmac(structure, fsigf, freer, cycles=1)

    prune = Prune(structure, refmac.fphi_best, refmac.fphi_diff)
    stats_out = ModelStats(prune.structure)
    assert stats_out.residues < stats_in.residues
Beispiel #6
0
def test_1kv9_fix_side_chains():
    structure = read_structure(data_path("1kv9_model.pdb"))
    stats_in = ModelStats(structure)
    mtz = gemmi.read_mtz_file(data_path("1kv9_data.mtz"))
    fsigf = DataItem(mtz, "FP,SIGFP")
    freer = DataItem(mtz, "FREE")
    refmac = Refmac(structure, fsigf, freer, cycles=1)

    sidechains = FixSideChains(structure, refmac.fphi_best, refmac.fphi_diff)
    stats_out = ModelStats(sidechains.structure)
    assert stats_out.residues == stats_in.residues
def test_1kv9():
    structure = read_structure(data_path("1kv9_model.pdb"))
    mtz = gemmi.read_mtz_file(data_path("1kv9_data.mtz"))
    fsigf = DataItem(mtz, "FP,SIGFP")
    freer = DataItem(mtz, "FREE")
    refmac = Refmac(structure, fsigf, freer, cycles=1)
    assert refmac.fsigf.nreflections == mtz.nreflections
    assert refmac.abcd.nreflections == mtz.nreflections
    assert refmac.fphi_best.nreflections == mtz.nreflections
    assert refmac.fphi_diff.nreflections == mtz.nreflections
    assert refmac.fphi_calc.nreflections == mtz.nreflections
    assert refmac.rwork_change < 0
def test_1kv9_dataitem_init_types():
    mtz = gemmi.read_mtz_file(data_path("1kv9_data.mtz"))
    item = DataItem(mtz, "FP,SIGFP")  # str
    assert item.label() == "FP,SIGFP"
    item = DataItem(mtz, mtz.columns[4:6])  # gemmi.MtzColumns
    assert item.label() == "FP,SIGFP"
    item = DataItem(mtz,
                    [mtz.columns[4], mtz.columns[5]])  # List[gemmi.Mtz.Column]
    assert item.label() == "FP,SIGFP"
def test_1kv9():
    contents = AsuContents(data_path("1kv9_sequence.fasta"))
    mtz = gemmi.read_mtz_file(data_path("1kv9_data.mtz"))
    fsigf = DataItem(mtz, "FP,SIGFP")
    freer = DataItem(mtz, "FREE")
    phases = DataItem(mtz, "HL")
    buccaneer = Buccaneer(contents=contents,
                          fsigf=fsigf,
                          freer=freer,
                          phases=phases,
                          cycles=1)
    stats = ModelStats(buccaneer.structure)
    assert stats.residues > 0
def test_invalid_columns_for_mtz_with_multiple_datasets(columns):
    mtz = gemmi.read_mtz_file(data_path("hewl_data.mtz"))
    mtz.add_dataset("Old")
    mtz.add_column("HLA", "A")
    mtz.add_column("HLB", "A")
    mtz.add_column("HLC", "A")
    mtz.add_column("HLD", "A")
    with pytest.raises(ValueError):
        DataItem(mtz, columns)
Beispiel #11
0
def test_1kv9():
    structure = read_structure(data_path("1kv9_model.pdb"))
    stats_in = ModelStats(structure)
    mtz = gemmi.read_mtz_file(data_path("1kv9_data.mtz"))
    fsigf = DataItem(mtz, "FP,SIGFP")
    freer = DataItem(mtz, "FREE")
    refmac = Refmac(structure, fsigf, freer, cycles=1)

    findwaters = FindWaters(structure, refmac.fphi_best)
    stats_out = ModelStats(findwaters.structure)
    assert stats_out.residues == stats_in.residues
    assert stats_out.waters > stats_in.waters
    assert stats_out.dummy_atoms == stats_in.dummy_atoms

    findwaters = FindWaters(structure, refmac.fphi_best, dummy=True)
    stats_out = ModelStats(findwaters.structure)
    assert stats_out.residues == stats_in.residues
    assert stats_out.waters == stats_in.waters
    assert stats_out.dummy_atoms > stats_in.dummy_atoms
def test_valid_columns_for_mtz_with_multiple_datasets(columns):
    mtz = gemmi.read_mtz_file(data_path("hewl_data.mtz"))
    mtz.add_dataset("Old")
    mtz.add_column("HLA", "A")
    mtz.add_column("HLB", "A")
    mtz.add_column("HLC", "A")
    mtz.add_column("HLD", "A")
    abcd = DataItem(mtz, columns)
    assert abcd.types == "AAAA"
    assert len(abcd.columns) == 7
def test_valid_1kv9_free_columns(columns: str):
    mtz = gemmi.read_mtz_file(data_path("1kv9_data.mtz"))
    free = DataItem(mtz, columns)
    assert len(free.columns) == 4
def test_1kv9_item_search(types: str, expected_labels: List[str]):
    mtz = gemmi.read_mtz_file(data_path("1kv9_data.mtz"))
    labels = [item.label() for item in DataItem.search(mtz, types)]
    assert labels == expected_labels
def test_1kv9_resolution():
    mtz = gemmi.read_mtz_file(data_path("1kv9_data.mtz"))
    item = DataItem(mtz, "FP,SIGFP")
    assert item.resolution == pytest.approx(1.8, abs=0.001)
def test_invalid_1kv9_columns(columns: str):
    mtz = gemmi.read_mtz_file(data_path("1kv9_data.mtz"))
    with pytest.raises(ValueError):
        DataItem(mtz, columns)
def test_hewl_item_search(types, expected_labels):
    mtz = gemmi.read_mtz_file(data_path("hewl_data.mtz"))
    labels = [item.label() for item in DataItem.search(mtz, types)]
    assert labels == expected_labels
def test_hewl_abcd_columns(columns: str):
    mtz = gemmi.read_mtz_file(data_path("hewl_data.mtz"))
    abcd = DataItem(mtz, columns)
    assert abcd.types == "AAAA"
    assert len(abcd.columns) == 7