def test_special_cases(self): # ending with a mal variant appends a pks-end2 components = [ self.components["ohmal"], self.components["mal"], ("mal", "ccmal", []) ] smiles = gen_smiles(components) components.append(("pks-end2", "pks-end2", [])) assert smiles == "CC(O)CC(=O)C=CC(=O)O" == gen_smiles(components)
def test_special_cases(self): # all mal variants and and end is ccmal appends a pks-end2 polymer = "(ohmal - mal - ccmal)" assert gen_smiles(polymer) == "CC(O)CC(=O)C=CC(=O)(O)" assert gen_smiles("(ohmal - mal - ccmal - pks-end2)") == gen_smiles( polymer) # all mal variants and start is mal converts the first to pks-start1 polymer = "(mal - ohmal - mal)" assert gen_smiles(polymer) == "CCC(O)CC(=O)" assert gen_smiles("(pks-start1 - ohmal - mal)") == gen_smiles(polymer) # pk in polymer and last is a mal variant removes the monomer after # the first pk and adds a pks-end1 at the end polymer = "(pk - nrp - pk - nrp - mal)" assert gen_smiles( polymer) == "C([*])C(-O)C([*])C(-O)NC([*])C(=O)CC(=O)C(C)C(=O)(O)" assert gen_smiles("(pk - pk - nrp - mal - pks-end1)") == gen_smiles( polymer)
def test_mixed_mal(self): components = [ self.components["mal"], self.components["X"], self.components["mal"] ] assert gen_smiles(components) == "CC(=O)NC([*])C(=O)CC(=O)C(=O)O"
def test_single_ala(self): assert gen_smiles([("ala", "ala", [])]) == "NC(C)C(=O)O" # and a methylated variant assert gen_smiles([("ala", "me-ala", ["cMT"])]) == "NC(C(C))C(=O)O"
def test_single_nrp(self): assert gen_smiles([self.components["X"]])
def test_empty(self): assert gen_smiles([]) == ""
def test_mixed_mal(self): assert gen_smiles("(mal - nrp - mal)") == "CC(=O)NC([*])C(=O)CC(=O)"
def test_single_ala(self): assert gen_smiles("(ala)") == ""
def test_single_nrp(self): assert gen_smiles("(nrp)") == ""