Ejemplo n.º 1
0
class NP_Epitope_Prediction_Tests_Fitted(unittest.TestCase):
	"""
	Basic test for the NP_Epitope_Prediction class, 
	if this test runs successful, the NP_Epitope_Prediction is up and 
	running and can be used. This tests only the already fitted classifier.

	Assuming that the methods:
		* fit_chain
		* update_cluster_descri
		* update_onto_mapping

	did run without errors.
	"""

	def set_up(self):

		TEST_DATA_PATH = "ML_data"
		self.NP_E_Pred = NP_Epitope_Prediction(data_storage = TEST_DATA_PATH)

	def test_json_output(self):

		self.set_up()

		test_smiles = "Cc1onc(-c2c(F)cccc2Cl)c1C(=O)N[C@H](C(=O)NCCCC[C@H](N)C(=O)O)[C@@H]1N[C@@H](C(=O)O)C(C)(C)S1"

		results = self.NP_E_Pred.prediction_chain(test_smiles, 
			only_epitopes = False, 
			compute_k_best = 5, 
			show_k_best = None, 
			sort_order = "E")

		json_text_result = Results_To_Json(results)

		with open(os.path.join("test_data", "example_output.json"),"r") as json_file:
			json_test_expected = json_file.read()

		self.assertEqual(json_text_result, json_test_expected)
Ejemplo n.º 2
0
#############################

smiles = "CC(=O)NC1[C@@H](OC(C(C1O)O)CO)O"

smiles = "Cc1onc(-c2c(F)cccc2Cl)c1C(=O)N[C@H](C(=O)NCCCC[C@H](N)C(=O)O)[C@@H]1N[C@@H](C(=O)O)C(C)(C)S1"

smiles = "COC(=O)CCc1c(C)c2=CC3=[N]4C(=Cc5c(C=C)c(C)c6C=C7C(C)=C(CCC(O)=O)C8=[N]7[Mg]4(n56)n2c1=C8)C(C)=C3C=C"

smiles = "CCCCCCCCCCCCC\C=C\[C@@H](O)[C@H](CO[C@@H]1O[C@H](CO)[C@@H](O[C@@H]2O[C@H](CO)[C@H](O[C@@H]3O[C@H](CO)[C@H](O)[C@H](O[C@@H]4O[C@H](CO)[C@H](O)[C@H](O[C@@]5(C[C@H](O)[C@@H](NC(C)=O)[C@@H](O5)[C@H](O)[C@@H](CO)O[C@@]5(C[C@H](O)[C@@H](NC(C)=O)[C@@H](O5)[C@H](O)[C@H](O)CO)C(O)=O)C(O)=O)[C@H]4O)[C@H]3NC(C)=O)[C@H](O[C@@]3(C[C@H](O)[C@@H](NC(C)=O)[C@@H](O3)[C@H](O)[C@@H](CO)O[C@@]3(C[C@H](O)[C@@H](NC(C)=O)[C@@H](O3)[C@H](O)[C@H](O)CO)C(O)=O)C(O)=O)[C@H]2O)[C@H](O)[C@H]1O)NC([*])=O"

# smiles = "Cc1onc(-c2c(F)cccc2Cl)c1C(=O)N[C@H](C(=O)NCCCC[C@H](N)C(=O)O)[C@@H]1N[C@@H](C(=O)O)C(C)(C)S1"

predictor = NP_Epitope_Prediction(data_storage=DATA_PATH)

results = predictor.prediction_chain(smiles,
                                     only_epitopes=True,
                                     sort_order="E")

# for k,v in results.items():
# 	print(k, type(v))
# 	if type(v) == dict:
# 		for k2,v2 in v.items():
# 			print("\t", k2, type(v2))

# exit()
#generate a json output
json_text = Results_To_Json(results)

with open("example.json", "w") as json_file:
    json_file.write(json_text)