aboutsummaryrefslogtreecommitdiff
path: root/bh20simplewebuploader/templates/form.html
blob: 6993cf58c8bbe1b59f525d2e5e3da232b9bc2fde (plain)
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
310
311
312
313
314
315
316
317
318
319
320
321
322
323
<!DOCTYPE html>
<html>
    <style>
     hr {
         margin: auto 0;
     }

     body {
         color: #101010;
         background-color: #F9EDE1;
     }

     h1, h2, h3, h4 {
         font-family: 'Roboto Slab', serif;
         color: darkblue;
     }

     h1 {
         text-align: center;
     }

     p {
         color: #505050;
         font-style: italic;
     }
     .header {
         background-color: white;
         margin: 0 auto;
         padding: 20px;
         text-align: center;
         height: 150px;
     }

     .logo {
         float: right;
     }

     p, form, .about, .footer {
         font-family: 'Raleway', sans-serif;
         line-height: 1.5;
     }

     form h4 {
         text-transform: 'uppercase';
     }

     .intro, form {
         padding: 20px;
     }

     .intro {
         background-color: lightgrey;
         margin: 0 auto;
         padding: 20px;
     }

     .about {
         background-color: lightgrey;
         margin: 0 auto;
         padding: 20px;
     }
     .footer {
         background-color: white;
         margin: 0 auto;
     }

     span.dropt {border-bottom: thin dotted; background: #ffeedd;}
     span.dropt:hover {text-decoration: none; background: #ffffff; z-index: 6; }

     .grid-container {
         display: grid;
         grid-template-columns: repeat(4, 1fr);
         grid-template-rows: auto;
         row-gap:5px;
         grid-template-areas:
             "a a b b"
             "a a c c"
             "a a d d"
             "e e e e"
             "f f f f";
         grid-auto-flow: column;
     }

     .intro {
         grid-area: a;
     }

     .fasta-file-select {
         padding: 1em;
         grid-area: b;
     }

     .metadata {
         padding: 1em;
         grid-area: c;
     }
     .metadata_upload_form {
         padding: 1em;
         grid-area: c;
     }

     #metadata_upload_form_spot {
         grid-area: d;
     }

     #metadata_fill_form_spot {
         grid-area: e;
     }

     #metadata_fill_form {
         column-count: 4;
         margin-top: 0.5em;
         column-width: 250px;
     }

     .record {
         display: flex;
         flex-direction: column;
         border: solid 1px #808080;
         padding: 1em;
         background: #F8F8F8;
         margin-bottom: 1em;
         -webkit-column-break-inside: avoid; /* Chrome, Safari, Opera */
         page-break-inside: avoid; /* Firefox */
         break-inside: avoid;
     }

     .record label {
         font-size: small;
         margin-top: 10px;
     }

     .submit {
         grid-area: f;
         width: 17em;
         justify-self: center;
     }

     @media only screen and (max-device-width: 480px) {
         .grid-container {
             display: flex;
             flex-direction: column;
         }
     }
    </style>

    <head>
        <meta charset="UTF-8">
        <link href="https://fonts.googleapis.com/css2?family=Raleway:wght@500&family=Roboto+Slab&display=swap" rel="stylesheet">
        <meta name="viewport" content="width=device-width, initial-scale=1">
        <title>Web uploader for Public SARS-CoV-2 Sequence Resource</title>
    </head>
    <body>
      <section class="header">
      <div class="logo"><a href="http://covid-19.genenetwork.org/"><img src="static/image/coronasmallcomp.gif" width="150" title="COVID-19 image by Tyler Morgan-Wall"></a></div>
      <h1>Web uploader for Public SARS-CoV-2 Sequence Resource</h1>

<small>Disabled until we got everything wired up</small>

      </section>
        <hr>

        <section>
            <form action="/submit" method="POST" enctype="multipart/form-data" id="main_form" class="grid-container">
              <p class="intro">
                Upload your SARS-CoV-2 sequence (FASTA or FASTQ formats) with metadata (JSONLD) to the <a href="https://workbench.lugli.arvadosapi.com/collections/lugli-4zz18-z513nlpqm03hpca">public sequence resource</a>. The upload will trigger a
                recompute with all available sequences into a Pangenome
                available for
                <a href="https://workbench.lugli.arvadosapi.com/collections/lugli-4zz18-z513nlpqm03hpca">download</a>!
                Your uploaded sequence will automatically be processed
                and incorporated into the public pangenome with
                metadata using worklows from the High Performance Open Biology Lab defined <a href="https://github.com/hpobio-lab/viral-analysis/tree/master/cwl/pangenome-generate">here</a>. All data is published under
                a <a href="https://creativecommons.org/licenses/by/4.0/">Creative
                Commons 4.0 attribution license</a> (CC-BY-4.0). You
                can take the published (GFA/RDF/FASTA) data and store it in
                a triple store for further processing. We also plan to
                combine identifiers with clinical data stored securely at <a href="https://redcap-covid19.elixir-luxembourg.org/redcap/">REDCap</a>.
                A free command line version of the uploader can be
                installed from <a href="https://github.com/arvados/bh20-seq-resource">source</a>.
              </p>

                <div class="fasta-file-select">
                    <label for="fasta">Select FASTA file of assembled genome (max 50K), or FASTQ of reads (<span class="dropt" title="For a larger fastq file you'll need to use a CLI uploader">max 150MB<span style="width:500px;"></span></span>) : </label>
                    <br>
                    <input type="file" id="fasta" name="fasta" accept=".fa,.fasta,.fna,.fq" required>
                    <br>
                    <small>
                    Note that by uploading your data you automatically agree to a <a href="https://creativecommons.org/licenses/by/4.0/">CC-BY-4.0 license</a>. </small>
                </div>

                <div class="metadata">
                  <label>Select metadata submission method:</label>
                  <br>
                  <input type="radio" id="metadata_form" name="metadata_type" value="fill" onchange="setMode()" checked required>
                  <label for="metadata_form">Fill in metadata manually</label>
                  <input type="radio" id="metadata_upload" name="metadata_type" value="upload" onchange="setMode()" required>
                  <label for="metadata_upload">Upload metadata file</label>
                  <br>
                  <small>Make sure the metadata has submitter attribution details.</small>

                  <div id="metadata_upload_form_spot">
                    <div id="metadata_upload_form">
                      <br>
                      <label for="metadata">Select JSON or YAML metadata file following <a href="https://github.com/arvados/bh20-seq-resource/blob/master/bh20sequploader/bh20seq-schema.yml" target="_blank">this schema</a> and <a href="https://github.com/arvados/bh20-seq-resource/blob/master/example/metadata.yaml" target="_blank">example</a> (max 50K):</label>
                      <br>
                      <input type="file" id="metadata" name="metadata" accept=".json,.yml,.yaml" required>
                      <br>
                    </div>
                  </div>
                </div>

                <div id="metadata_fill_form_spot">
                    <div id="metadata_fill_form">
                        {% for record in fields %}

                        {% if 'heading' in record %}
                        {% if loop.index > 1 and 2 < 3  %}
                    </div>
                    {% endif %}
                    <div class="record">
                        <h4>{{ record['heading'] }}</h4>
                        {% else %}
                        <label for="{{ record['id'] }}" title="{{ record.get('docstring', '') }}">
                            {{ record['label'] }}
                            {{ "*" if record['required'] else "" }}
                            {% if 'docstring' in record %}
                            <a href='javascript:alert({{ record['docstring'] | tojson }})'></a>
                            {% endif %}
                            {% if 'ref_iri' in record %}
                            <a href="{{ record['ref_iri'] }}" target="_blank" title="Ontology Link">🔗</a>
                            {% endif %}
                        </label>
                        {% if record['type'] == 'select' %}
                        <select id="{{ record['id'] }}" name="{{ record['id'] }}" {{ "required" if record['required'] else "" }}>
                            <option value="" selected>Choose one...</option>
                            {% for option in record['options'] %}
                            <option value="{{ option[1] }}">{{ option[0] }}</option>
                            {% endfor %}
                        </select>
                        {% else %}
                        <input type="{{ record['type'] }}" id="{{ record['id'] }}" name="{{ record['id'] }}" {{ "required" if record['required'] else "" }}>
                        {% endif %}
                        {% endif %}
                        {% if loop.index == loop.length %}
                    </div>
                    {% endif %}
                    {% endfor %}
                </div>
                </div>


<input class="submit" type="submit" value="Add to Pangenome">
            </form>
        </section>
<hr>
<br>
<div class="about">
  <h3>ABOUT</h3>
  <p>
  This a public repository created at the COVID-19 BioHackathon
    that has a low barrier to entry for uploading sequence data using
    best practices. I.e., data is published with a creative commons
    4.0 (CC-4.0) license with metadata using state-of-the art
    standards and, perhaps most importantly, providing standardized
    workflows that get triggered on upload, so that results are
    immediately available in standardized data formats. The repository
    will be maintained and expanded for the duration of the
    pandemic. To contribute data simply upload it! To contribute code
    and/or workflows see
    the <a href="https://github.com/arvados/bh20-seq-resource">project
    repository</a>. For more information see the <a href="https://github.com/arvados/bh20-seq-resource/blob/master/paper/paper.md">paper</a> (WIP).
  </p>
                    <br>
</div>

                    <hr>
<div class="footer">
                    <a href="https://arvados.org/"><img src="static/image/arvados-logo.png" align="top"></a>
                    <a href="https://www.commonwl.org/"><img src="static/image/CWL-Logo-Header.png" height="70"></a>

        <a href="https://github.com/virtual-biohackathons/covid-19-bh20">
        <img src="static/image/covid19biohackathon.png" align="right" height="70"></a>

        <center>
        <small><a href="https://github.com/arvados/bh20-seq-resource">Source code</a> &middot; Powered by <a href="https://www.commonwl.org/">Common Workflow Language</a> &amp; <a href="https://arvados.org/">Arvados</a>; Made for <a href="https://github.com/virtual-biohackathons/covid-19-bh20">COVID-19-BH20</a>
        </small>
        </center>


</div>

        <script type="text/javascript">
         let uploadForm = document.getElementById('metadata_upload_form')
         let uploadFormSpot = document.getElementById('metadata_upload_form_spot')
         let fillForm = document.getElementById('metadata_fill_form')
         let fillFormSpot = document.getElementById('metadata_fill_form_spot')

         function setUploadMode() {
             // Make the upload form the one in use
             uploadFormSpot.appendChild(uploadForm)
             fillFormSpot.removeChild(fillForm)
         }

         function setFillMode() {
             // Make the fillable form the one in use
             uploadFormSpot.removeChild(uploadForm)
             fillFormSpot.appendChild(fillForm)
         }

         function setMode() {
             // Pick mode based on radio
             if (document.getElementById('metadata_upload').checked) {
                 setUploadMode()
             } else {
                 setFillMode()
             }
         }

         // Start in mode appropriate to selected form item
         setMode()
        </script>
    </body>
</html>