Example #1
0
    def save_frame_handler(self, data):
        data = convert_to_utf8(json.loads(data))
#             print "DATA", data
        path = os.path.join(data["paths"]["results"], "representatives.pdb")

#             try:
#             print "PRIM PATH",path
        file_handler_in = open(path,"r")
        file_handler_out = open("results/tmp/prototype.pdb","w")
        grab_existing_frame_from_trajectory(file_handler_in, file_handler_out, data["frame"])
        file_handler_in.close()
        file_handler_out.close()
        self.wfile.write('{"path":"results/tmp/prototype.pdb"}')
Example #2
0
 def test_grab_existing_frames_from_trajectory(self):
     input_pdb_handler = cStringIO.StringIO(test_data.proto_pdb)
     output_file_handler = cStringIO.StringIO()
     grab_existing_frame_from_trajectory(input_pdb_handler, output_file_handler, 48)
     self.assertEqual(test_data.proto_48_pdb, output_file_handler.getvalue())
Example #3
0
 def test_grab_existing_frames_from_trajectory(self):
     input_pdb_handler = cStringIO.StringIO(test_data.proto_pdb)
     output_file_handler = cStringIO.StringIO()
     grab_existing_frame_from_trajectory(input_pdb_handler, output_file_handler, 48)
     self.assertEqual(test_data.proto_48_pdb, output_file_handler.getvalue())