def contact(): base_dir = expanduser("~") global form form = Lintools_Input() if request.method == 'POST': traj_files = request.form["trajectory_path"].rsplit(",") global output_name output_name = request.form["output_name"] inputs = request.form global lintools lintools = Lintools( inputs["topology_path_hidden"], [base_dir + x for x in traj_files if traj_files != [u'']], None, "resid " + str(inputs["ligand_selection"].rsplit(",")[0]) + " and segid " + inputs["ligand_selection"].rsplit(",")[1], inputs["residueOffset"], float(inputs["distance_cutoff"]), [None], [None], [None], float(inputs["analysis_cutoff"]), "amino", inputs["output_name"], False) lintools.save_files() lintools.data_input_and_res_time_analysis() lintools.analysis_of_prot_lig_interactions() lintools.plot_residues() lintools.draw_figure() lintools.remove_files() return redirect(url_for('input')) elif request.method == 'GET': return render_template('contact.html', form=form)
class TestBasic2(TestCase): def setUp(self): self.test_svg = TEST2 self.output_name = "test2_1" self.lintools = Lintools(AMI_GRO, [AMI_XTC], None, "resname UNK", 30, 3.5, [1], [None], [None], 0.3, "clock", self.output_name, False) self.lintools.save_files() self.lintools.data_input_and_res_time_analysis() self.lintools.analysis_of_prot_lig_interactions() self.lintools.plot_residues() self.lintools.write_config_file(None) self.lintools.draw_figure() def tearDown(self): self.lintools.remove_files() del self.lintools def test_ami_clocks(self): #Is the final svg file produced? assert_equal(os.path.isfile(self.output_name + ".svg"), True) if os.path.isfile(self.output_name + ".svg") == True: with open(self.test_svg, "r") as test: testlines = test.readlines() with open(self.output_name + ".svg", "r") as output: lines = output.readlines() i = 0 for line in lines: assert_equal(testlines[i], lines[i]) i += 1
class TestBasic3(TestCase): def setUp(self): u = MDAnalysis.Universe(PDB_4XP1) lig_name = u.select_atoms("resname LDP") self.test_svg = TEST3 self.output_name = "test3_1" self.lintools = Lintools(PDB_4XP1, [], LDP_MOL2, lig_name, 0, 3.5, [1], [None], [None], 0.3, "domains", self.output_name) self.lintools.save_files() self.lintools.data_input_and_res_time_analysis() self.lintools.analysis_of_prot_lig_interactions(False) self.lintools.plot_residues() self.lintools.draw_figure() def tearDown(self): self.lintools.remove_files() del self.lintools def test_ldp_domains(self): #Is the final svg file produced? assert_equal(os.path.isfile(self.output_name + ".svg"), True) if os.path.isfile(self.output_name + ".svg") == True: with open(self.test_svg, "r") as test: testlines = test.readlines() with open(self.output_name + ".svg", "r") as output: lines = output.readlines() i = 0 for line in lines: assert_equal(testlines[i], lines[i]) i += 1
class TestBasic3(TestCase): def setUp(self): self.test_svg = TEST3 self.output_name = "test3_1" self.lintools = Lintools(PDB_4XP1,[],None,"resname LDP",0,3.5,[1],[None],[None],0.3,0,"domains",self.output_name,False) self.lintools.save_files() self.lintools.data_input_and_res_time_analysis() self.lintools.analysis_of_prot_lig_interactions() self.lintools.plot_residues() self.lintools.write_config_file(None) self.lintools.draw_figure() def tearDown(self): self.lintools.remove_files() del self.lintools def test_ldp_domains(self): #Is the final svg file produced? assert_equal(os.path.isfile(self.output_name+".svg"),True) if os.path.isfile(self.output_name+".svg") == True: with open(self.test_svg,"r") as test: testlines = test.readlines() with open(self.output_name+".svg","r") as output: lines = output.readlines() i=0 for line in lines: assert_equal(testlines[i],lines[i]) i+=1