Skip to content

Commit

Permalink
--save_models bugs fixed
Browse files Browse the repository at this point in the history
  • Loading branch information
ploy-np committed Aug 17, 2020
1 parent 6c56b3a commit 763a4b0
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions xpore/diffmod/io.py
Original file line number Diff line number Diff line change
Expand Up @@ -108,17 +108,18 @@ def save_models(models, model_filepath): # per gene/transcript
Path to save the models.
"""
model_file = h5py.File(model_filepath, 'w')
for model_key, model in models.items():
for model_key, model_tuple in models.items():
idx, position, kmer = model_key
model, prefiltering = model_tuple

position = str(position)
if idx not in model_file:
model_file.create_group(idx)
model_file[idx].create_group(position)
model_file[idx][position].attrs['kmer'] = kmer.encode('UTF-8')
model_file[idx][position].create_group('info')
for key, value in model.info.items():
model_file[idx][position]['info'][key] = value
# model_file[idx][position].create_group('info')
# for key, value in model.info.items():
# model_file[idx][position]['info'][key] = value

model_file[idx][position].create_group('nodes') # ['x','y','z','w','mu_tau'] => store only their params
for node_name in model.nodes:
Expand Down

0 comments on commit 763a4b0

Please sign in to comment.