Exemplo n.º 1
0
def test_monomer_importer(json_importer, independent_importers):
    monomer_importer = importers.MonomerImporter(json_importer)
    ids = monomer_importer.import_data()

    monomer_repo = repo.create_monomer_repository()
    backbone_repo = repo.create_backbone_repository()
    monomer_data = list(monomer_repo.load(ids))
    monomer_docs = json_importer.load(monomer_importer.saver.TYPE.STRING)
    backbone_data = list(backbone_repo.load())
    kekules = [doc['kekule'] for doc in monomer_docs]
    backbones = [mol.to_reduced_dict() for mol in backbone_data]

    assert(len(monomer_data) == 4)
    for mol in monomer_data:
        rdkit_mol = mol.mol
        assert(mol._id != None)
        assert(mol.required == bool(AllChem.CalcNumAromaticRings(rdkit_mol)))
        assert(mol.backbone in backbones)
        assert(mol.sidechain is None)
        assert(mol.connection is None)
        assert(mol.proline == bool(AllChem.CalcNumAliphaticRings(
            rdkit_mol) and rdkit_mol.HasSubstructMatch(PROLINE_N_TERM)))
        assert(mol.imported == True)
        assert(mol.kekule in kekules)
        kekules.remove(mol.kekule)
def test_initialize(initialized_repository):
    assert len(list(repo.create_backbone_repository().load())) == 3
    assert len(list(repo.create_connection_repository().load())) == 2
    assert len(list(repo.create_template_repository().load())) == 3
    assert len(list(repo.create_sidechain_repository().load())) == 3
    assert len(list(repo.create_monomer_repository().load())) == 4
    assert len(list(repo.create_regiosqm_repository().load())) == 3
    assert len(list(repo.create_pka_repository().load())) == 3
Exemplo n.º 3
0
def test_monomer_repository(monomer_mols, model_sort_key):
    monomer_repo = repo.create_monomer_repository()
    ids = monomer_repo.save(monomer_mols)
    data = list(monomer_repo.load(ids))
    data.sort(key=model_sort_key)

    for i, monomer in enumerate(monomer_mols):
        monomer.index = i

    assert data == monomer_mols
def test_initialize_predictions_only(partial_initialized_repository):
    exporter = RegioSQMExporter()
    exporter.export_regiosqm_smiles_file()

    initializer = CPMGInitializer()
    initializer._initialize_predictions_only()

    assert len(list(repo.create_backbone_repository().load())) == 3
    assert len(list(repo.create_connection_repository().load())) == 2
    assert len(list(repo.create_template_repository().load())) == 3
    assert len(list(repo.create_sidechain_repository().load())) == 3
    assert len(list(repo.create_monomer_repository().load())) == 4
    assert len(list(repo.create_regiosqm_repository().load())) == 3
    assert len(list(repo.create_pka_repository().load())) == 3
def test_initialize_mol_only(partial_initialized_repository):
    assert len(list(repo.create_backbone_repository().load())) == 3
    assert len(list(repo.create_connection_repository().load())) == 2
    assert len(list(repo.create_template_repository().load())) == 3
    assert len(list(repo.create_sidechain_repository().load())) == 3
    assert len(list(repo.create_monomer_repository().load())) == 4
 def __init__(self):
     self.plan_repo = repo.create_peptide_plan_repository()
     self.monomer_repo = repo.create_monomer_repository()
     super().__init__(repo.create_peptide_repository())
 def __init__(self):
     self.backbone_repo = repo.create_backbone_repository()
     self.sidechain_repo = repo.create_sidechain_repository()
     super().__init__(repo.create_monomer_repository())
 def __init__(self):
     self.sidechain_repo = repo.create_sidechain_repository()
     self.monomer_repo = repo.create_monomer_repository()
     self.template_repo = repo.create_template_repository()
     super().__init__(repo.create_reaction_repository())
Exemplo n.º 9
0
 def __init__(self):
     self.sidechain_repo = repo.create_sidechain_repository()
     self.monomer_repo = repo.create_monomer_repository()
Exemplo n.º 10
0
def test_monomer_repository_fail():
    monomer_repo = repo.create_monomer_repository()

    _ = monomer_repo.save(['dne'])

    assert len(monomer_repo.failed_instances) == 1
 def __init__(self, loader):
     self.loader = loader
     self.saver = repo.create_monomer_repository()
     self.backbones = {}