aboutsummaryrefslogtreecommitdiff
path: root/gn2/wqflask/templates/edit_probeset.html
blob: 322b30067b6a61d2542c7e8e91ee2339c944a123 (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
{% extends "index_page.html" %}
{% block title %}Trait Submission{% endblock %}
{% block content %}
<!-- Start of body -->
<div class="container">
    {% with messages = get_flashed_messages(category_filter=["warning"]) %}
    {% if messages %}
    {% for message in messages %}
    <div class="alert alert-warning alert-dismissible" role="alert">
	<button class="close" type="button" data-dismiss="alert" aria-label="Close">
	    <span aria-hidden="true">&times;</span>
	</button>
	{{ message }}
    </div>
    {% endfor %}
    {% endif %}
    {% endwith %}

    {% with messages = get_flashed_messages(category_filter=["success"]) %}
    {% if messages %}
    {% for message in messages %}
    <div class="alert alert-success alert-dismissible" role="alert">
	<button class="close" type="button" data-dismiss="alert" aria-label="Close">
	    <span aria-hidden="true">&times;</span>
	</button>
	{{ message|safe }}
    </div>
    {% endfor %}
    {% endif %}
    {% endwith %}
    <div class="page-header text-left">
        <h1>Trait Metadata and Data Editing Form: {{ name }}</h1>
        <small><a href="{{url_for('metadata_edit.show_history', dataset_id=dataset_id, name=name)}}" target="_blank">[View History]</a></small>
    </div>
    <form id="edit-form" class="form-horizontal" method="post" action="/datasets/traits/{{name}}?resource-id={{resource_id}}&dataset_id={{dataset_name}}" enctype='multipart/form-data'>
	<div class="form-group">
	  <div class="controls left-block col-sm-8 col-lg-8" style="width: max-content;">
		<input name="id" class="changed" type="hidden" value="{{ probeset.id_ }}"/>
		<input name="old_id_" class="changed" type="hidden" value="{{ probeset.id_ }}"/>
		<input name="probeset_name" class="changed" type="hidden" value="{{ probeset.name }}"/>
		<input name="dataset_name" class="changed" type="hidden" value="{{ dataset_name }}"/>
		<input name="edited" class="changed" type="hidden" value="false"/>
	  </div>
	</div>
    <div>
        <h2>Edit Sample Data</h2>
        <p>
            Download a spreadsheet of sample values to edit in Excel (or a similar program) and then upload the edited file
        </p>
        <div>
            <a href="/datasets/mrna/{{ probeset_id }}/dataset/{{ dataset_name }}/csv?resource-id={{ resource_id }}" class="btn btn-link">
                Click to Download Sample Data
            </a>
        </div>
        <div class="form-group">
            <input type = "file" class="col-md-4 control-label text-left" name = "file" />
        </div>
        <input type="submit" style="width: 125px; margin-right: 25px;" class="btn btn-success form-control changed" value="Submit Change">
    </div>
    <hr>
    <div>
        <h2>Edit Metadata</h2>
		<div class="form-group">
				<label for="symbol" class="col-sm-3 col-lg-2 control-label text-left">Symbol</label>
				<div class="col-sm-4">
			<textarea name="symbol" class="form-control" rows="1">{{ probeset.symbol |default('', true) }}</textarea>
			<input name="old_symbol" class="changed" type="hidden" value="{{ probeset.symbol |default('', true) }}"/>
				</div>
		</div>
		<div class="form-group">
				<label for="description" class="col-sm-3 col-lg-2 control-label text-left">Description</label>
				<div class="col-sm-4">
			<textarea name="description" class="form-control" rows="3">{{ probeset.description |default('', true) }}</textarea>
			<input name="old_description" class="changed" type="hidden" value="{{ probeset.description |default('', true) }}"/>
				</div>
		</div>
		<div class="form-group">
				<label for="probe_target_description" class="col-sm-3 col-lg-2 control-label text-left">Probe Target Description</label>
				<div class="col-sm-4">
			<textarea name="probe_target_description" class="form-control" rows="4">{{ probeset.probe_target_description |default('', true) }}</textarea>
			<input name="old_probe_target_description" class="changed" type="hidden" value="{{ probeset.probe_target_description |default('', true) }}"/>
				</div>
		</div>
		<div class="form-group">
				<label for="chr" class="col-sm-3 col-lg-2 control-label text-left">Chr</label>
				<div class="col-sm-4">
			<textarea name="chr" class="form-control" rows="1">{{ probeset.chr_ |default('', true) }}</textarea>
			<input name="old_chr_" class="changed" type="hidden" value="{{ probeset.chr_ |default('', true) }}"/>
				</div>
		</div>
		<div class="form-group">
				<label for="mb" class="col-sm-3 col-lg-2 control-label text-left">Mb</label>
				<div class="col-sm-4">
			<textarea name="mb" class="form-control" rows="1">{{ probeset.mb |default('', true) }}</textarea>
			<input name="old_mb" class="changed" type="hidden" value="{{ probeset.mb |default('', true) }}"/>
				</div>
		</div>
		<div class="form-group">
				<label for="alias" class="col-sm-3 col-lg-2 control-label text-left">
			Alias:
				</label>
				<div class="col-sm-4">
			<textarea name="alias" class="form-control" rows="1">{{ probeset.alias |default('', true) }}</textarea>
			<input name="old_alias" class="changed" type="hidden" value="{{ probeset.alias |default('', true) }}"/>
				</div>
		</div>
		<div class="form-group">
				<label for="geneid" class="col-sm-3 col-lg-2 control-label text-left">
			Gene Id:
				</label>
				<div class="col-sm-4">
			<textarea name="geneid" class="form-control" rows="1">{{ probeset.geneid |default('', true) }}</textarea>
			<input name="old_geneid" class="changed" type="hidden" value="{{ probeset.geneid |default('', true) }}"/>
				</div>
		</div>
		<div class="form-group">
				<label for="homologeneid" class="col-sm-3 col-lg-2 control-label text-left">
			Homologene Id:
				</label>
				<div class="col-sm-4">
			<textarea name="homologeneid" class="form-control" rows="1">{{ probeset.homologeneid |default('', true) }}</textarea>
			<input name="old_homologeneid" class="changed" type="hidden" value="{{ probeset.homologeneid |default('', true) }}"/>
				</div>
		</div>
		<div class="form-group">
				<label for="unigeneid" class="col-sm-3 col-lg-2 control-label text-left">
			Unigene Id:
				</label>
				<div class="col-sm-4">
			<textarea name="unigeneid" class="form-control" rows="1">{{ probeset.unigeneid |default('', true) }}</textarea>
			<input name="old_unigeneid" class="changed" type="hidden" value="{{ probeset.unigeneid |default('', true) }}"/>
				</div>
		</div>
		<div class="form-group">
				<label for="omim" class="col-sm-3 col-lg-2 control-label text-left">OMIM</label>
				<div class="col-sm-4">
			<textarea name="omim" class="form-control" rows="1">{{ probeset.omim |default('', true) }}</textarea>
			<input name="old_omim" class="changed" type="hidden" value="{{ probeset.omim |default('', true) }}"/>
				</div>
		</div>
		<div class="form-group">
				<label for="refseq_transcriptid" class="col-sm-3 col-lg-2 control-label text-left">
			Refseq TranscriptId:
				</label>
				<div class="col-sm-4">
			<textarea name="refseq_transcriptid" class="form-control" rows="1">{{ probeset.refseq_transcriptid |default('', true) }}</textarea>
			<input name="old_refseq_transcriptid" class="changed" type="hidden" value="{{ probeset.refseq_transcriptid |default('', true) }}"/>
				</div>
		</div>
		<div class="form-group">
				<label for="blatseq" class="col-sm-3 col-lg-2 control-label text-left">BlatSeq</label>
				<div class="col-sm-8">
			<textarea name="blatseq" class="form-control" rows="6">{{ probeset.blatseq |default('', true) }}</textarea>
			<input name="old_blatseq" class="changed" type="hidden" value="{{ probeset.blatseq |default('', true) }}"/>
				</div>
		</div>
		<div class="form-group">
				<label for="targetseq" class="col-sm-3 col-lg-2 control-label text-left">TargetSeq</label>
				<div class="col-sm-8">
			<textarea name="targetseq" class="form-control" rows="6">{{ probeset.targetseq |default('', true) }}</textarea>
			<input name="old_targetseq" class="changed" type="hidden" value="{{ probeset.targetseq |default('', true) }}"/>
				</div>
		</div>
		<div class="form-group">
				<label for="strand_probe" class="col-sm-3 col-lg-2 control-label text-left">Strand Probe</label>
				<div class="col-sm-2">
			<textarea name="strand_probe" class="form-control" rows="1">{{ probeset.strand_probe |default('', true) }}</textarea>
			<input name="old_strand_probe" class="changed" type="hidden" value="{{ probeset.strand_probe |default('', true) }}"/>
				</div>
		</div>
		<div class="form-group">
				<label for="probe_set_target_region" class="col-sm-3 col-lg-2 control-label text-left">Probe Set Target Region</label>
				<div class="col-sm-8">
			<textarea name="probe_set_target_region" class="form-control" rows="1">{{ probeset.probe_set_target_region |default('', true) }}</textarea>
			<input name="old_probe_set_target_region" class="changed" type="hidden" value="{{ probeset.probe_set_target_region_ |default('', true) }}"/>
				</div>
		</div>
		<div class="form-group">
				<label for="probe_set_specificity" class="col-sm-3 col-lg-2 control-label text-left">Probeset Specificity</label>
				<div class="col-sm-8">
			<textarea name="probe_set_specificity" class="form-control" rows="1">{{ probeset.probe_set_specificity |default('', true) }}</textarea>
			<input name="old_probe_set_specificity" class="changed" type="hidden" value="{{ probeset.probe_set_specificity |default('', true) }}"/>
				</div>
		</div>
		<div class="form-group">
				<label for="probe_set_blat_score" class="col-sm-3 col-lg-2 control-label text-left">Probeset Blat Score</label>
				<div class="col-sm-8">
			<textarea name="probe_set_blat_score" class="form-control" rows="1">{{ probeset.probe_set_blat_score |default('', true) }}</textarea>
			<input name="old_probe_set_blat_score" class="changed" type="hidden" value="{{ probeset.probe_set_blat_score |default('', true) }}"/>
				</div>
		</div>
		<div class="form-group">
				<label for="probe_set_blat_mb_start" class="col-sm-3 col-lg-2 control-label text-left">
			Probeset Blat Mb Start</label>
				<div class="col-sm-8">
			<textarea name="probe_set_blat_mb_start" class="form-control" rows="1">{{ probeset.probe_set_blat_mb_start |default('', true) }}</textarea>
			<input name="old_probe_set_blat_mb_start" class="changed" type="hidden" value="{{ probeset.probe_set_blat_mb_start |default('', true) }}"/>
				</div>
		</div>
		<div class="form-group">
				<label for="probe_set_blat_mb_end" class="col-sm-3 col-lg-2 control-label text-left">Probeset Blat Mb End</label>
				<div class="col-sm-8">
			<textarea name="probe_set_blat_mb_end" class="form-control" rows="1">{{ probeset.probe_set_blat_mb_end |default('', true) }}</textarea>
			<input name="old_probe_set_blat_mb_end" class="changed" type="hidden" value="{{ probeset.probe_set_blat_mb_end |default('', true) }}"/>
				</div>
		</div>
		<div class="form-group">
				<label for="probe_set_strand" class="col-sm-3 col-lg-2 control-label text-left">Probeset Strand</label>
				<div class="col-sm-8">
			<textarea name="probe_set_strand" class="form-control" rows="6">{{ probeset.probe_set_strand |default('', true) }}</textarea>
			<input name="old_probe_set_strand" class="changed" type="hidden" value="{{ probeset.probe_set_strand |default('', true) }}"/>
				</div>
		</div>
		<div class="form-group">
				<label for="probe_set_note_by_rw" class="col-sm-3 col-lg-2 control-label text-left">Probeset Strand</label>
				<div class="col-sm-8">
			<textarea name="probe_set_note_by_rw" class="form-control" rows="6">{{ probeset.probe_set_note_by_rw |default('', true) }}</textarea>
			<input name="old_probe_set_note_by_rw" class="changed" type="hidden" value="{{ probeset.probe_set_note_by_rw |default('', true) }}"/>
				</div>
		</div>
		<input type="submit" style="width: 125px; margin-right: 25px;" class="btn btn-success form-control col-xs-2 changed" value="Submit Change">
	</div>
    <div style="padding-top: 20px;">
		<p class="text-info" style="padding-left: 5em;">
			<strong>Type "x" to delete a value.</strong>
		</p>
		  <table style="width: 500px;" class="table table-hover table-striped table-bordered left-float">
			  <thead>
				  <th></th>
				  <th>ID</th>
				  <th>Sample</th>
				  <th>Value</th>
				  <th></th>
				  <th>SE</th>
				  <th>N</th>
			  </thead>
			  <tbody>
				  {% for sample in sample_list %}
				  <tr>
					  <td><input type="checkbox"></td>
					  <td>{{ loop.index }}</td>
					  <td>{{ sample }}</td>
					  <td><input type="text" name="value:{{ sample }}" class="table_input" value="{% if sample_data.get(sample) %}{{ '%0.3f' | format(sample_data.get(sample).value | float) }}{% else %}x{% endif %}" size=4 maxlength=6></input></td>
					  <td>±</td>
					  <td><input type="text" name="error:{{ sample }}" class="table_input" value="{% if sample_data.get(sample).error %}{{ '%0.3f' | format(sample_data.get(sample).error | float) }}{% else %}x{% endif %}" size=4 maxlength=5></input></td>
					  <td><input type="text" name="n_cases:{{ sample }}" class="table_input" value="{% if sample_data.get(sample).n_cases %}{{ sample_data.get(sample).n_cases }}{% else %}x{% endif %}" size=3 maxlength=3></input></td>
				  </tr>
				  {% endfor %}
			  </tbody>
		  </table>
	</div>

    </form>
</div>

{%endblock%}

{% block js %}
<script>
 gn_server_url = "{{ gn_server_url }}";
 spans = document.querySelectorAll("[data-message-id]")
 spans.forEach((span) => {
     span.innerHTML = $("[for='" + span.getAttribute("data-message-id") + "']").text();
 });
 $("[data-message-id]").lead
 
 function MarkAsChanged(){
     $(this).addClass("changed");
 }
 $(":input").blur(MarkAsChanged).change(MarkAsChanged);

 $("input[type=submit]").click(function(){
     $(":input:not(.changed)").attr("disabled", "disabled");
 });

  // This is an awkward way to detect changes to table data, so it doesn't process it otherwise
  $(".table_input").change(function(){
    $("input[name=edited]").val("true");
 });

</script>
{% endblock %}