-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathlayout.py
More file actions
309 lines (260 loc) · 11.5 KB
/
layout.py
File metadata and controls
309 lines (260 loc) · 11.5 KB
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
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
import dash_core_components as dcc
import dash_html_components as html
import dash_bootstrap_components as dbc
from stylesheet import *
from bioconvert.core.registry import Registry
def get_input_format():
"""This function allows to fill the input_dropdown
: return: all the input format available in bioconvert
: rtype: dict
"""
r = Registry()
all_converter = list(r.get_converters_names())
list_format = []
# We collect input file by splitting the converters
for converter in all_converter:
input_format, output_format = converter.split('2', 1)
list_format.append(input_format)
list_format = list(set(list_format))
# to have sorted input format in the dropdown
list_format.sort()
options = []
# the dropdown option take a dictionnary as argument, so convert the list in dict. Label and value is the same
for format in list_format:
options.append(
{
'label': format,
'value': format
}
)
return options
def input_dropdown():
# This fonction return the input dropdown by calling the get_input_format function
return html.Div(children=[
html.Div('INPUT FORMAT : ', style={'display': 'inline-block', 'color': '#FF8C00', "font-weight": "bold"}),
html.Div(dcc.Dropdown(id='input-dropdown',
options=get_input_format(),
placeholder='Select an input format ...'),
style={'display': 'inline-block', 'width': '500px', 'verticalAlign': 'middle'})],
style={'display': 'block'})
def output_dropdown():
# This fonction return the output dropdown componnent
return html.Div(children=[
html.Div('OUTPUT FORMAT : ', style={'display': 'inline-block', 'color': '#FF8C00', "font-weight": "bold",}),
html.Div(dcc.Dropdown(id='output-dropdown',
placeholder='Select an output format ...'),
style={'display': 'inline-block', 'width': '500px', 'verticalAlign': 'middle'})],
style={'display': 'block'})
def get_div_title():
data = html.Div(id='Logo', children=[
html.Div(id='Title', children=[
html.H1('Bioconvert ', style=title()),
html.H1('|', style={'color': '#050D36','fontSize': 100,
'font-family': "", 'display': 'inline-block'}),
html.Div(children=[
html.P('Bioinformatics ', style={'color': '#050D36','fontSize': 25, }),
html.P(' formats converter', style={'color': '#050D36','fontSize': 25,})
], style={'display': 'inline-block', 'text-align':'center', }),
], style={'vertical-align':'middle' }),
])
return data
def get_div_first_step():
# Div for first step
data = html.Div(id='first_step', children=
[
html.Div(id='icon_first_step', children=
[
# BEGIN CERCLE
html.Div(className="circle", id="circle1",
children=
[
html.Div('1', className="circle_text") # END CERCLE_TEXT
]), # END CERCLE
html.Div('UPLOAD AN INPUT FILE', style=text_icon()),
], style={'display': 'inline-block', "background-color": "yellow"} # END TEXT_ICON
), # END ICON_FIRST_STEP
html.Div(id="DRAG_and_DROP", className='rectangle', children=
[
dcc.Upload(id="upload_file", children=
[
html.Img(src='/assets/upload.png',
style={'height': '70px', 'width': '70px','display':
'inline-block', 'vertical-align':'middle',
'marginRight':'24px'}),
html.Div("Drag and drop or select a file",
style={'display': 'inline-block','color': '#FF8C00',
"fontSize": 35, 'vertical-align':'middle'})
], style={"textAlign": "center", 'lineHeight': '90px'}), # END upload_file
html.Div(id='guess_format', style={"textAlign": "center"})
]
), # END DRAG and DROP
html.Br(),
html.Br(),
])
return data
def get_div_second_step():
# Div for second step
data= html.Div(id='second_step', children=
[
html.Div(id='icon_second_step', children=
[
html.Div(className="circle", id="circle2",
children=[
html.Div('2', className="circle_text") # END CERCLE_TEXT
]), # END CERCLE
html.Div('SELECT THE INPUT AND OUTPUT FORMAT', style=text_icon()), # END TEXT_ICON
], style={'display': 'inline-block'}
), # END ICON_SECOND_STEP
html.Div(id="InOut", className='rectangle', children=
[
input_dropdown(),
html.Br(),
output_dropdown(),
html.Br(),
html.Div(id='converter', style={"textAlign": "center"}),
], style={"textAlign": "center"} # END upload_file
), # END DRAG and DROP
])
return data
def get_div_third_step():
data = html.Div(id='third_step', children=
[
html.Div(id='icon_third_step', children=
[
html.Div(className="circle", id="circle3",
children=[
html.Div('3', className="circle_text") # END CERCLE_TEXT
]), # END CERCLE
html.Div('SUBMIT YOUR JOB',
style=text_icon()), # END TEXT_ICON
], style={'display': 'inline-block'}
), # END ICON_SECOND_STEP
html.Div(id="Submit", className='rectangle', children=
[
html.Button('SUBMIT', id='submit_button', style=submit()), # END upload_file
], style={'lineHeight': '100px'}),
html.Br(),
html.Br(),
html.Br(),
dbc.Tooltip(children=[
html.Img(src='/assets/attention.png', style=icon_style()),
html.P("You can also encourage us"),
html.P("by putting a star on"),
html.P("the bioconvert project on GitHub"),
],
target="Submit", placement='right', style=tooltip_style()),
html.Div(id='convertion', style={"textAlign": "center"}),
html.Div(id="fake", style={"display": "none"}
), # END DRAG and DROP
])
return data
def get_div_footer():
data = html.Div(id='footer', children=
[
html.Div(id='Contact_us', children=
[
html.Div(className="puce", id="puce1", style={'display': 'inline-block'}),
html.Div("Conctact us", id="title_puce", style={'display': 'inline-block',
'marginLeft': '5px'}),
html.P(' For questions about conversions contact '
' Thomas Cokelaer(thomas.cokelaer _at_ pasteur.fr)'
' or Bertrand Néron (bneron _at_ pasteur.fr) '
'or post an issue on <a href="https://github.com/bioconvert/issues">github</a>',
style={'fontSize': ".9em"}),
], style={'float': "left", 'width': "30%", 'margin': '10px 10px 20px', 'display': 'inline-block'}
), # END contact
html.Div(id='how_to_cite', children=
[
html.Div(className="puce", id="puce2", style={'display': 'inline-block'}),
html.Div("How to cite", id="title_puce2", style={'display': 'inline-block',
'marginLeft': '5px'}),
html.P(' Sulyvan Dollin, Anne Biton, Bryan Brancotte, Yoann Dufresne, Kenzo-Hugo Hillion, '
' Etienne Kornobis, Pierre Lechat, Rachel Legendre, Frédéric Lemoine, Blaise Li, '
' Nicolas Maillet, Amandine Perrin, Rachel Torchet1, Nicolas Traut, Anna Zhukova, '
' Bertrand Néron, Thomas Cokelaer: '
' Bioconvert: a collaborative bioinformatics format converter library',
style={'fontSize': "0.9em"}),
], style={'float':"right", 'width': "50%", 'margin': '10px 50px 20px', 'display': 'inline-block'} # END TEXT_ICON
), # END citation
], style=footer())
return data
def get_div_fourth_step():
data = html.Div(id='fourth_step', children=
[
html.Div(id='icon_fourth_step', children=
[
html.Div(className="circle", id="circle4",
children=[
html.Div('4', className="circle_text") # END CERCLE_TEXT
]), # END CERCLE
html.Div('DOWNLOAD YOUR DATA',
style=text_icon()), # END TEXT_ICON
]
, style={'display': 'inline-block'}
), # END ICON_SECOND_STEP
html.Div(id="link", className='rectangle', style={'lineHeight': '100px'}),
])
return data
def get_div_banner():
data= html.Div(id='Banner', children=
[
# Div for menu home
html.Div(id='Image_home',
children=
[
html.Img(src='/assets/home.png', style=icon_style()),
# Div for text menu home
html.Div('Home', style={'display': 'block'}),
], style=home_div()), # END menu home
# Div for menu
html.Div(id='section',
children=
[
html.Div('How it works', id="how_section",
style={'display': 'inline-block', "marginRight": "20px"}),
html.Div("About", id="about_section",
style={'display': 'inline-block'}),
], style=header()), # END menu
], style={'display': 'inline-block', 'width': "100%"}
)
return data
def mainframe():
return html.Div(id='Main_frame',
children=[
dcc.Store(id='input_file', storage_type='session'),
# Div for Title
get_div_title(),
html.Hr(),
get_div_first_step(),
html.Br(),
html.Br(),
dbc.Tooltip(children=[
html.Img(src='/assets/attention.png', style=icon_style()),
html.P("Be careful, you are limited"),
html.P("to a file of less than 100 MB."),
html.P(" For heavier input file"),
html.P("please install bioconvert")
],
target="DRAG_and_DROP", placement='right',
className='arrow: : before', style=tooltip_style()
),
get_div_second_step(),
html.Br(),
html.Br(),
dbc.Tooltip(children=[
html.Img(src='/assets/attention.png', style=icon_style()),
html.P("If the formats you want are"),
html.P("not available. It is possible to"),
html.P("add new converter through"),
html.P("GitHub or to make an issue.")
],
target="InOut", placement='right', style=tooltip_style()),
# Div for third step
get_div_third_step(),
html.Br(),
# Div for fourth step
get_div_fourth_step(),
html.Br(),
html.Br(),
get_div_footer()
])