-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathrun_experiments.py
36 lines (31 loc) · 1.12 KB
/
run_experiments.py
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
import os
import pickle
import data
import results
import streamlit as st
K, r = 10000, 4
data_folder = os.path.abspath('data')
raw_data_fname = 'intermediate/raw_data.pkl'
processed_data_fname = 'intermediate/rna_molecules.pkl'
markov_shuffles_fname = 'intermediate/markov_shuffles.pkl'
if not os.path.exists('intermediate'):
os.mkdir('intermediate')
# Run all experiments and cache the results
if not os.path.exists(raw_data_fname):
rna_raw_data = data.process_raw_data(data_folder)
with open(raw_data_fname, 'wb') as f:
pickle.dump(rna_raw_data, f)
else:
with open(raw_data_fname, 'rb') as f:
rna_raw_data = pickle.load(f)
if not os.path.exists(processed_data_fname):
rna_molecules = data.get_rna_molecules(rna_raw_data, K, r)
with open(processed_data_fname, 'wb') as f:
pickle.dump(rna_molecules, f)
else:
with open(processed_data_fname, 'rb') as f:
rna_molecules = pickle.load(f)
if not os.path.exists(markov_shuffles_fname):
markov_shuffles = data.get_markov_shuffles(rna_molecules)
with open(markov_shuffles_fname, 'wb') as f:
pickle.dump(markov_shuffles, f)