libokj commited on
Commit
1576887
·
verified ·
1 Parent(s): 0dd77ac

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +7 -4
app.py CHANGED
@@ -1130,15 +1130,18 @@ def create_html_report(df, file=None, task=None, opts=(), progress=gr.Progress(t
1130
  else:
1131
  image_zoom_formatter = HTMLTemplateFormatter(template='<div class="image-zoom-viewer"><%= value %></div>')
1132
  uniprot_id_formatter = HTMLTemplateFormatter(
1133
- template='<a href="<% '
1134
  'if (/^[OPQ][0-9][A-Z0-9]{3}[0-9]|[A-NR-Z][0-9]([A-Z][A-Z0-9]{2}[0-9]){1,2}$/.test(value)) '
1135
  '{ %>https://www.uniprot.org/uniprotkb/<%= value %><% } '
1136
  'else { %><textarea style="width: 60ch;"><%= value %></textarea><% } '
1137
  '%>" target="_blank"><%= value %></a>'
 
1138
  )
1139
  pubchem_id_formatter = HTMLTemplateFormatter(
1140
- template='<a href="https://pubchem.ncbi.nlm.nih.gov/#query=<%= value %>" '
 
1141
  'target="_blank"><%= value %></a>'
 
1142
  )
1143
  bool_formatters = {col: BooleanFormatter() for col in bool_cols}
1144
  float_formatters = {col: NumberFormatter(format='0.000') for col in df_html.select_dtypes('floating').columns}
@@ -1252,7 +1255,7 @@ def create_html_report(df, file=None, task=None, opts=(), progress=gr.Progress(t
1252
  template = pn.template.VanillaTemplate(
1253
  title=f'DeepSEQreen {job} Report',
1254
  sidebar=[],
1255
- favicon='deepseqreen.svg',
1256
  logo='deepseqreen.svg',
1257
  header_background='#F3F5F7',
1258
  header_color='#4372c4',
@@ -1284,7 +1287,7 @@ def create_html_report(df, file=None, task=None, opts=(), progress=gr.Progress(t
1284
  margin=10)
1285
  )
1286
 
1287
- template.save(file, resources=INLINE)
1288
  return file
1289
 
1290
 
 
1130
  else:
1131
  image_zoom_formatter = HTMLTemplateFormatter(template='<div class="image-zoom-viewer"><%= value %></div>')
1132
  uniprot_id_formatter = HTMLTemplateFormatter(
1133
+ template='<% if (value == value) { ' # Check if value is not NaN
1134
  'if (/^[OPQ][0-9][A-Z0-9]{3}[0-9]|[A-NR-Z][0-9]([A-Z][A-Z0-9]{2}[0-9]){1,2}$/.test(value)) '
1135
  '{ %>https://www.uniprot.org/uniprotkb/<%= value %><% } '
1136
  'else { %><textarea style="width: 60ch;"><%= value %></textarea><% } '
1137
  '%>" target="_blank"><%= value %></a>'
1138
+ '<% } else { %><% } %>' # Output empty string if value is NaN
1139
  )
1140
  pubchem_id_formatter = HTMLTemplateFormatter(
1141
+ template='<% if (value == value) { ' # Check if value is not NaN
1142
+ '<a href="https://pubchem.ncbi.nlm.nih.gov/#query=<%= value %>" '
1143
  'target="_blank"><%= value %></a>'
1144
+ '<% } else { %><% } %>' # Output empty string if value is NaN
1145
  )
1146
  bool_formatters = {col: BooleanFormatter() for col in bool_cols}
1147
  float_formatters = {col: NumberFormatter(format='0.000') for col in df_html.select_dtypes('floating').columns}
 
1255
  template = pn.template.VanillaTemplate(
1256
  title=f'DeepSEQreen {job} Report',
1257
  sidebar=[],
1258
+ favicon='deepseqreen.ico',
1259
  logo='deepseqreen.svg',
1260
  header_background='#F3F5F7',
1261
  header_color='#4372c4',
 
1287
  margin=10)
1288
  )
1289
 
1290
+ template.save(file, resources=INLINE, title=f'DeepSEQreen {job} Report')
1291
  return file
1292
 
1293