forked from lapitskiy/atom
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathcl_explorer.py
More file actions
38 lines (31 loc) · 1.17 KB
/
cl_explorer.py
File metadata and controls
38 lines (31 loc) · 1.17 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
import redis
import pickle
class Explorer:
def load_atom_data(self,num,atom_system_file):
r = redis.StrictRedis(host='localhost', db=0)
atom_file_data = {}
if int(atom_system_file['count']) < num:
num = atom_system_file['count']
for i in range(0,int(atom_system_file['count'])+1):
if atom_system_file['count'] >= num:
current_atom_block = self.read_current_atom(i)
atom_file_data[i] = current_atom_block
else:
return atom_file_data
return atom_file_data
def read_system_file(self, path,filename):
with open(path+filename, 'rb') as f:
dict = pickle.load(f)
return dict
def read_current_atom(self, num):
with open('chain/' + str(num) + '.atm', 'rb') as f:
dict = pickle.load(f)
return dict
def modify_to_browser(self, dict):
#for key, value in dict.items():
# for key2, value2 in dict[key].items():
# try:
# for key3, value3 in dict[key][key2].items():
# except AttributeError:
# continue
return dict