maom commited on
Commit
272d67c
·
verified ·
1 Parent(s): 8517f4e

add link to scatterplot

Browse files
Files changed (1) hide show
  1. app.py +27 -0
app.py CHANGED
@@ -50,6 +50,11 @@ top_coexp_hits = top_coexp_hits[[
50
  'gene_id_1', 'gene_symbol_1', 'description_1',
51
  'gene_id_2', 'gene_symbol_2', 'description_2',
52
  'coexp_score', 'blastp_EValue']]
 
 
 
 
 
53
  top_coexp_hits.reset_index()
54
 
55
  with col2:
@@ -80,6 +85,22 @@ fungidb_link_renderer = JsCode("""
80
  }
81
  """)
82
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
83
 
84
  grid_option_builder = GridOptionsBuilder()
85
  grid_option_builder.configure_auto_height()
@@ -107,6 +128,12 @@ grid_option_builder.configure_column(
107
  type=["numericColumn", "customNumericFormat"],
108
  precision=3,
109
  width=600)
 
 
 
 
 
 
110
  grid_option_builder.configure_selection(selection_mode=False, use_checkbox=False)
111
 
112
  AgGrid(
 
50
  'gene_id_1', 'gene_symbol_1', 'description_1',
51
  'gene_id_2', 'gene_symbol_2', 'description_2',
52
  'coexp_score', 'blastp_EValue']]
53
+ top_coexp_hits["scatter_link"] =
54
+ top_coexp_hits.apply(
55
+ lambda row: f"https://huggingface.co/spaces/maomlab/CryptoCEN-ExpressionScatter?gene_id_1={gene_id_1}&gene_id_2={gene_id_2}"},
56
+ axis = 1)
57
+
58
  top_coexp_hits.reset_index()
59
 
60
  with col2:
 
85
  }
86
  """)
87
 
88
+ coexp_scatter_link_renderer = JsCode("""
89
+ class UrlCellRenderer {
90
+ init(params) {
91
+ this.eGui = document.createElement('a');
92
+ this.eGui.innerText = plot;
93
+ this.eGui.setAttribute('href', params.value);
94
+ this.eGui.setAttribute('style', "text-decoration:none");
95
+ this.eGui.setAttribute('target', "_blank");
96
+ }
97
+ getGui() {
98
+ return this.eGui;
99
+ }
100
+ }
101
+ """)
102
+
103
+
104
 
105
  grid_option_builder = GridOptionsBuilder()
106
  grid_option_builder.configure_auto_height()
 
128
  type=["numericColumn", "customNumericFormat"],
129
  precision=3,
130
  width=600)
131
+ grid_option_builder.configure_column(
132
+ "scatter_link",
133
+ header_name="Expression Scatterplot",
134
+ cellRenderer=coexp_scatter_link_renderer,
135
+ width=550)
136
+
137
  grid_option_builder.configure_selection(selection_mode=False, use_checkbox=False)
138
 
139
  AgGrid(