latticetower commited on
Commit
1bcc7b4
·
1 Parent(s): 908f290

reorganize code

Browse files
Files changed (4) hide show
  1. app.py +5 -2
  2. constants.py +2 -0
  3. mpl_data_plotter.py +1 -0
  4. plot_utils.py +1 -2
app.py CHANGED
@@ -9,7 +9,7 @@ from constants import *
9
  from mpl_data_plotter import MatplotlibDataPlotter
10
 
11
 
12
-
13
  single_df = pd.read_csv(SINGLE_DOMAINS_FILE, compression='gzip')
14
  single_df['biosyn_class_index'] = single_df.bgc_class.apply(lambda x: BIOSYN_CLASS_NAMES.index(x))
15
 
@@ -21,7 +21,7 @@ num_domains_in_region_df = single_df.groupby('cds_region_id', as_index=False).ag
21
 
22
  unique_domain_lengths = num_domains_in_region_df.num_domains.unique()
23
 
24
-
25
  data_plotter = MatplotlibDataPlotter(single_df, pair_df, num_domains_in_region_df)
26
 
27
 
@@ -29,6 +29,7 @@ def update_all_plots(frequency, split_name='stratified'):
29
  return data_plotter.plot_single_domains(frequency, split_name), data_plotter.plot_pair_domains(frequency, split_name)
30
 
31
 
 
32
  # Create Gradio interface
33
  with gr.Blocks(title="Interactive Wave Plotter") as demo:
34
  gr.Markdown("## Interactive Wave Plotter")
@@ -69,5 +70,7 @@ with gr.Blocks(title="Interactive Wave Plotter") as demo:
69
  outputs=[single_domains_plot, pair_domains_plot]#, cosine_plot]
70
  )
71
 
 
 
72
  demo.launch()
73
  # demo.load(filter_map, [min_price, max_price, boroughs], map)
 
9
  from mpl_data_plotter import MatplotlibDataPlotter
10
 
11
 
12
+ print(f"Loading domains data...")
13
  single_df = pd.read_csv(SINGLE_DOMAINS_FILE, compression='gzip')
14
  single_df['biosyn_class_index'] = single_df.bgc_class.apply(lambda x: BIOSYN_CLASS_NAMES.index(x))
15
 
 
21
 
22
  unique_domain_lengths = num_domains_in_region_df.num_domains.unique()
23
 
24
+ print(f"Initializing data plotter...")
25
  data_plotter = MatplotlibDataPlotter(single_df, pair_df, num_domains_in_region_df)
26
 
27
 
 
29
  return data_plotter.plot_single_domains(frequency, split_name), data_plotter.plot_pair_domains(frequency, split_name)
30
 
31
 
32
+ print(f"Defining blocks...")
33
  # Create Gradio interface
34
  with gr.Blocks(title="Interactive Wave Plotter") as demo:
35
  gr.Markdown("## Interactive Wave Plotter")
 
70
  outputs=[single_domains_plot, pair_domains_plot]#, cosine_plot]
71
  )
72
 
73
+
74
+ print(f"Launching!...")
75
  demo.launch()
76
  # demo.load(filter_map, [min_price, max_price, boroughs], map)
constants.py CHANGED
@@ -1,4 +1,6 @@
1
 
 
 
2
  BIOSYN_CLASS_NAMES = ['Alkaloid', 'NRP', 'Polyketide', 'RiPP', 'Saccharide', 'Terpene', "Other"]
3
 
4
  SINGLE_DOMAINS_FILE = 'data/single_domains.csv.gz'
 
1
 
2
+ POSTER_BLUE = '#01589C'
3
+
4
  BIOSYN_CLASS_NAMES = ['Alkaloid', 'NRP', 'Polyketide', 'RiPP', 'Saccharide', 'Terpene', "Other"]
5
 
6
  SINGLE_DOMAINS_FILE = 'data/single_domains.csv.gz'
mpl_data_plotter.py CHANGED
@@ -1,5 +1,6 @@
1
 
2
  import matplotlib.pyplot as plt
 
3
  import plot_utils
4
  from constants import *
5
 
 
1
 
2
  import matplotlib.pyplot as plt
3
+
4
  import plot_utils
5
  from constants import *
6
 
plot_utils.py CHANGED
@@ -2,8 +2,7 @@ import numpy as np
2
  import matplotlib.pyplot as plt
3
  import seaborn as sns
4
 
5
-
6
- POSTER_BLUE = '#01589C'
7
 
8
 
9
  def groupby(array_like, hue_order=None):
 
2
  import matplotlib.pyplot as plt
3
  import seaborn as sns
4
 
5
+ from constants import *
 
6
 
7
 
8
  def groupby(array_like, hue_order=None):