XspecT 0.1.2__py3-none-any.whl → 0.2.0__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.

Potentially problematic release.


This version of XspecT might be problematic. Click here for more details.

Files changed (57) hide show
  1. {XspecT-0.1.2.dist-info → XspecT-0.2.0.dist-info}/METADATA +23 -29
  2. XspecT-0.2.0.dist-info/RECORD +30 -0
  3. {XspecT-0.1.2.dist-info → XspecT-0.2.0.dist-info}/WHEEL +1 -1
  4. xspect/definitions.py +42 -0
  5. xspect/download_filters.py +11 -26
  6. xspect/fastapi.py +101 -0
  7. xspect/file_io.py +34 -103
  8. xspect/main.py +70 -66
  9. xspect/model_management.py +88 -0
  10. xspect/models/__init__.py +0 -0
  11. xspect/models/probabilistic_filter_model.py +277 -0
  12. xspect/models/probabilistic_filter_svm_model.py +169 -0
  13. xspect/models/probabilistic_single_filter_model.py +109 -0
  14. xspect/models/result.py +148 -0
  15. xspect/pipeline.py +201 -0
  16. xspect/run.py +38 -0
  17. xspect/train.py +304 -0
  18. xspect/train_filter/create_svm.py +6 -183
  19. xspect/train_filter/extract_and_concatenate.py +117 -121
  20. xspect/train_filter/html_scrap.py +16 -28
  21. xspect/train_filter/ncbi_api/download_assemblies.py +7 -8
  22. xspect/train_filter/ncbi_api/ncbi_assembly_metadata.py +9 -17
  23. xspect/train_filter/ncbi_api/ncbi_children_tree.py +3 -2
  24. xspect/train_filter/ncbi_api/ncbi_taxon_metadata.py +7 -5
  25. XspecT-0.1.2.dist-info/RECORD +0 -48
  26. xspect/BF_v2.py +0 -648
  27. xspect/Bootstrap.py +0 -29
  28. xspect/Classifier.py +0 -142
  29. xspect/OXA_Table.py +0 -53
  30. xspect/WebApp.py +0 -737
  31. xspect/XspecT_mini.py +0 -1377
  32. xspect/XspecT_trainer.py +0 -611
  33. xspect/map_kmers.py +0 -155
  34. xspect/search_filter.py +0 -504
  35. xspect/static/How-To.png +0 -0
  36. xspect/static/Logo.png +0 -0
  37. xspect/static/Logo2.png +0 -0
  38. xspect/static/Workflow_AspecT.png +0 -0
  39. xspect/static/Workflow_ClAssT.png +0 -0
  40. xspect/static/js.js +0 -615
  41. xspect/static/main.css +0 -280
  42. xspect/templates/400.html +0 -64
  43. xspect/templates/401.html +0 -62
  44. xspect/templates/404.html +0 -62
  45. xspect/templates/500.html +0 -62
  46. xspect/templates/about.html +0 -544
  47. xspect/templates/home.html +0 -51
  48. xspect/templates/layoutabout.html +0 -87
  49. xspect/templates/layouthome.html +0 -63
  50. xspect/templates/layoutspecies.html +0 -468
  51. xspect/templates/species.html +0 -33
  52. xspect/train_filter/get_paths.py +0 -35
  53. xspect/train_filter/interface_XspecT.py +0 -204
  54. xspect/train_filter/k_mer_count.py +0 -162
  55. {XspecT-0.1.2.dist-info → XspecT-0.2.0.dist-info}/LICENSE +0 -0
  56. {XspecT-0.1.2.dist-info → XspecT-0.2.0.dist-info}/entry_points.txt +0 -0
  57. {XspecT-0.1.2.dist-info → XspecT-0.2.0.dist-info}/top_level.txt +0 -0
xspect/static/js.js DELETED
@@ -1,615 +0,0 @@
1
- // Sources:
2
- // https://stackoverflow.com/questions/39479090/read-n-lines-of-a-big-text-file
3
- // https://flask.palletsprojects.com/en/1.1.x/patterns/jquery/
4
- // https://stackoverflow.com/questions/6831918/node-js-read-a-text-file-into-an-array-each-line-an-item-in-the-array/12299566
5
- // https://stackoverflow.com/questions/6831918/node-js-read-a-text-file-into-an-array-each-line-an-item-in-the-array/12299566
6
- // https://www.freecodecamp.org/news/javascript-from-callbacks-to-async-await-1cc090ddad99/
7
- // https://developer.mozilla.org/de/docs/Web/JavaScript/Reference/Statements/async_function
8
- // https://simon-schraeder.de/posts/filereader-async/
9
- class TextReader {
10
- // https://stackoverflow.com/a/55377748/9100798
11
- CHUNK_SIZE = 8192000;
12
- position = 0;
13
- length = 0;
14
-
15
- byteBuffer = new Uint8Array(0);
16
-
17
- lines = [];
18
- lineCount = 0;
19
- lineIndexTracker = 0;
20
-
21
- fileReader = new FileReader();
22
- textDecoder = new TextDecoder(`utf-8`);
23
-
24
- get allCachedLinesAreDispatched() {
25
- return !(this.lineIndexTracker < this.lineCount);
26
- }
27
-
28
- get blobIsReadInFull() {
29
- return !(this.position < this.length);
30
- }
31
-
32
- get bufferIsEmpty() {
33
- return this.byteBuffer.length === 0;
34
- }
35
-
36
- get endOfStream() {
37
- return this.blobIsReadInFull && this.allCachedLinesAreDispatched && this.bufferIsEmpty;
38
- }
39
-
40
- constructor(blob) {
41
- this.blob = blob;
42
- this.length = blob.size;
43
- }
44
-
45
- blob2arrayBuffer(blob) {
46
- return new Promise((resolve, reject) => {
47
- this.fileReader.onerror = reject;
48
- this.fileReader.onload = () => {
49
- resolve(this.fileReader.result);
50
- };
51
-
52
- this.fileReader.readAsArrayBuffer(blob);
53
- });
54
- }
55
-
56
- read(offset, count) {
57
- return new Promise(async (resolve, reject) => {
58
- if (!Number.isInteger(offset) || !Number.isInteger(count) || count < 1 || offset < 0 || offset > this.length - 1) {
59
- resolve(new ArrayBuffer(0));
60
- return
61
- }
62
-
63
- let endIndex = offset + count;
64
-
65
- if (endIndex > this.length) endIndex = this.length;
66
-
67
- let blobSlice = this.blob.slice(offset, endIndex);
68
-
69
- resolve(await this.blob2arrayBuffer(blobSlice));
70
- });
71
- }
72
-
73
- readLine() {
74
- return new Promise(async (resolve, reject) => {
75
-
76
- if (!this.allCachedLinesAreDispatched) {
77
- resolve(this.lines[this.lineIndexTracker++] + `\n`);
78
- return;
79
- }
80
-
81
- while (!this.blobIsReadInFull) {
82
- let arrayBuffer = await this.read(this.position, this.CHUNK_SIZE);
83
- this.position += arrayBuffer.byteLength;
84
-
85
- let tempByteBuffer = new Uint8Array(this.byteBuffer.length + arrayBuffer.byteLength);
86
- tempByteBuffer.set(this.byteBuffer);
87
- tempByteBuffer.set(new Uint8Array(arrayBuffer), this.byteBuffer.length);
88
-
89
- this.byteBuffer = tempByteBuffer;
90
-
91
- let lastIndexOfLineFeedCharacter = this.byteBuffer.lastIndexOf(10); // LINE FEED CHARACTER (\n) IS ONE BYTE LONG IN UTF-8 AND IS 10 IN ITS DECIMAL FORM
92
-
93
- if (lastIndexOfLineFeedCharacter > -1) {
94
- let lines = this.textDecoder.decode(this.byteBuffer).split(`\n`);
95
- this.byteBuffer = this.byteBuffer.slice(lastIndexOfLineFeedCharacter + 1);
96
-
97
- let firstLine = lines[0];
98
-
99
- this.lines = lines.slice(1, lines.length - 1);
100
- this.lineCount = this.lines.length;
101
- this.lineIndexTracker = 0;
102
-
103
- resolve(firstLine + `\n`);
104
- return;
105
- }
106
- }
107
-
108
- if (!this.bufferIsEmpty) {
109
- let line = this.textDecoder.decode(this.byteBuffer);
110
- this.byteBuffer = new Uint8Array(0);
111
- resolve(line);
112
- return;
113
- }
114
-
115
- resolve(null);
116
- });
117
- }
118
- }
119
-
120
- async function extract(Max_reads, checks, ext){
121
- let file = document.getElementById("infile").files[0];
122
- let textReader = new TextReader(file);
123
- var name = document.getElementById('infile').files[0].name;
124
- var reads = [];
125
- var lineno = 1;
126
- var max = Max_reads;
127
- while (!textReader.endOfStream) {
128
- let line = await textReader.readLine();
129
- line = line.replace(/(\r\n|\n|\r)/gm, "");
130
- // only using the sequence reads
131
- if ((ext === 'fq')||(ext === 'fastq')){
132
- if (((lineno)%2==0)&&((lineno)%4!=0)){
133
- reads.push(line);
134
- }
135
- }else{
136
- //fasta file: taking all lines
137
- if (line.charAt(0) !== '>'){
138
- reads.push(line);
139
- }
140
- else{
141
- reads.push('>');
142
- }
143
- }
144
-
145
- // stopping after n lines
146
- if (reads.length == max){
147
- break;
148
- }
149
-
150
- lineno++;
151
- }
152
- reads.push(name);
153
- result = reads.concat(checks)
154
- return result
155
- }
156
-
157
- async function asyncCall(ext) {
158
- document.getElementById("extracter").style.display = "block";
159
- var max_reads = document.getElementById("reads_max").value;
160
- var checks = [];
161
-
162
- // saving checkbox info so the Form can be hidden
163
- checks.push(document.getElementById("quick").checked);
164
- checks.push(document.getElementById("IC1").checked);
165
- checks.push(document.getElementById("IC2").checked);
166
- checks.push(document.getElementById("IC3").checked);
167
- checks.push(document.getElementById("IC4").checked);
168
- checks.push(document.getElementById("IC5").checked);
169
- checks.push(document.getElementById("IC6").checked);
170
- checks.push(document.getElementById("IC7").checked);
171
- checks.push(document.getElementById("IC8").checked);
172
- checks.push(document.getElementById("added").checked);
173
- checks.push(document.getElementById("OXA").checked);
174
- // Deactivating Checkboxes etc while extracting reads
175
- document.getElementById("opt").style.display = "none";
176
-
177
- // Complete fileupload (Max 100.000 lines) if fasta file
178
- if ((ext == 'fasta') || (ext == 'fna')){
179
- max_reads = 100000;
180
- }
181
- if (((ext == 'fq') || (ext == 'fastq')) && (document.getElementById("OXA").checked)){
182
- max_reads = 250000;
183
- }
184
- // Assigning
185
- const result = await extract(max_reads, checks, ext);
186
-
187
- return result;
188
- }
189
-
190
- async function asyncCallspec(ext) {
191
- var max_reads = document.getElementById("reads_max").value;
192
- var checks = [];
193
-
194
- // saving checkbox info so the Form can be hidden
195
- checks.push(document.getElementById("quick").checked);
196
- checks.push(document.getElementById("OXA").checked);
197
- checks.push(document.getElementById("metagenome").checked);
198
- //checks.push(document.getElementById("added").checked);
199
- // Deactivating Checkboxes etc while extracting reads
200
- //document.getElementById("opt").style.display = "none";
201
-
202
- // Complete fileupload (Max 100.000 lines) if fasta file
203
- if ((ext == 'fasta') || (ext == 'fna')){
204
- max_reads = 5000000;
205
- }
206
- //if (((ext == 'fq') || (ext == 'fastq')) && (document.getElementById("OXA").checked)){
207
- // max_reads = 250000;
208
- //}
209
-
210
- // Assigning
211
- const result = await extract(max_reads, checks, ext);
212
-
213
- return result;
214
- }
215
-
216
- // Source:
217
- // https://stackoverflow.com/questions/53694709/passing-javascript-array-in-python-flask
218
- $(document).ready(function () {
219
- $("#submit").on("click", async function() {
220
- // prevent default send
221
- event.preventDefault();
222
-
223
- let file = document.getElementById("infile").files[0];
224
- if (!file) {
225
- alert('No file selected, please select a .fq file that contains sequence reads');
226
- return;
227
- }
228
- name = document.getElementById('infile').files[0].name;
229
- ext = name.split('.').pop();
230
-
231
- if ((ext !== 'fq') && (ext !== 'fasta') && (ext !== 'fna') && (ext !== 'fastq')){
232
- alert('Wrong file-type, please select a FASTQ or FASTA/FNA file');
233
- return;
234
- }
235
-
236
- var number = document.getElementById("reads_max").value;
237
-
238
- // Converting Number field to String, then checking if
239
- // only numbers are in string (to prevent entering '.' or '+'
240
- var not_int = !(/^\d+$/.test(number.toString()));
241
-
242
- if ((not_int) || (number < 500) || (number > 1000000)){
243
- alert('Error: Number of reads must be between 500 and 100.000 and also be a Integer!');
244
- return;
245
- }
246
-
247
- // Getting Reads
248
- var js_data = JSON.stringify(await asyncCall(ext));
249
-
250
- if (js_data == null){
251
- alert('Error: This Tool does not support your Browser, please use a modern Browser.');
252
- return;
253
- }
254
-
255
- $.ajax({
256
- url: '/ic',
257
- type : 'post',
258
- contentType: 'application/json',
259
- dataType : 'json',
260
- data : js_data,
261
- success: function(){
262
- // document.getElementById("content").style.display = "none";
263
- // document.getElementById("loading-display").style.display = "block";
264
- window.location.href = '/assign'
265
-
266
- },
267
- error: function() {
268
- // document.getElementById("opt").style.display = "block";
269
- // document.getElementById("extracter").style.display = "none";
270
- // document.getElementById("loading-display").style.display = "none";
271
- alert("Your Browser does not support this Tool. Please use a valid Browser");
272
- }
273
- });
274
- });
275
- });
276
-
277
-
278
-
279
- function myFunc(literature){
280
- for (let i = 0; i < literature[0].length; i++) {
281
- const test1 = document.createElement("li");
282
- const test2 = document.createElement("p");
283
- test2.style.lineHeight = "75%";
284
- const test3 = document.createElement("a");
285
- test3.setAttribute('href',literature[0][i]);
286
- test3.innerText = literature[1][i];
287
- const test4 = document.createElement("a");
288
- test4.className = "btn";
289
- test4.setAttribute("data-bs-toggle", "collapse");
290
- test4.setAttribute("data-bs-target", "#" + literature[5][i]);
291
- const test5 = document.createElement("small");
292
- test5.innerText = "[View Details]";
293
- const test6_1 = document.createElement("br");
294
- const test6_2 = document.createElement("br");
295
- const test6_3 = document.createElement("br");
296
- //const test6_4 = document.createElement("br");
297
- //const test6_5 = document.createElement("br");
298
- const test7 = document.createElement("small");
299
- const test8 = document.createElement("small");
300
- const test9 = document.createElement("font");
301
- test9.setAttribute('color',"4d8055");
302
- const test6 = document.createElement("br");
303
- const test10 = document.createElement("p");
304
- test10.className = "collapse";
305
- test10.setAttribute('id', literature[5][i]);
306
- const test11 = document.createElement("b");
307
- test11.innerText = "Abstract:"
308
-
309
- test10.appendChild(test11);
310
- test10.appendChild(test6);
311
- var newContent = document.createTextNode(literature[2][i]);
312
- test10.appendChild(newContent);
313
-
314
- var newContent = document.createTextNode(literature[4][i]);
315
- test9.appendChild(newContent);
316
- test8.appendChild(test9);
317
- var newContent = document.createTextNode(literature[3][i]);
318
- test7.appendChild(newContent);
319
- test4.appendChild(test5);
320
-
321
- test2.appendChild(test3);
322
- test2.appendChild(test4);
323
- test2.append(test6_1);
324
- test2.appendChild(test7);
325
- test2.append(test6_2);
326
- test2.append(test6_3);
327
- // test2.append(test6_4);
328
- //test2.append(test6_5);
329
- test2.appendChild(test8);
330
-
331
- test1.appendChild(test2);
332
- test1.appendChild(test10);
333
-
334
- document.getElementById("literature").appendChild(test1);
335
- }
336
- return literature
337
- }
338
-
339
-
340
- $(document).ready(function(){
341
- $("#close_popup").on("click", async function() {
342
- event.preventDefault();
343
- document.getElementById("popup-1").classList.toggle("active");
344
- });
345
- });
346
-
347
-
348
- $(document).ready(function(){
349
- $("#tab-3").on("click", async function() {
350
- event.preventDefault();
351
- if (document.getElementById("popup-2").classList == "popup-2 active") {
352
- document.getElementById("popup-2").classList.remove("active");
353
- }
354
- });
355
- });
356
-
357
-
358
- $(document).ready(function(){
359
- $("#Display_options").on("click", async function() {
360
- event.preventDefault();
361
- document.getElementById("popup-2").classList.toggle("active");
362
- });
363
- });
364
-
365
-
366
-
367
- $(document).ready(function(){
368
- $("#infile").change(function(){
369
- name = document.getElementById('infile').files[0].name;
370
- if (document.getElementById("popup-1").classList == "popup") {
371
- document.getElementById("popup-1").classList.add("active");
372
- }
373
- ext = name.split('.').pop();
374
- if ((ext == 'fq') || (ext == 'fastq')){
375
- y = document.getElementById("AspecTinput");
376
- y.style.display = "block";
377
- }
378
- else {
379
- y = document.getElementById("AspecTinput");
380
- y.style.display = "none";
381
- }
382
- if ((ext == 'fasta') || (ext == 'fna')){
383
- y = document.getElementById("AspecTinput-2");
384
- y.style.display = "block";
385
- }
386
- else {
387
- y = document.getElementById("AspecTinput-2");
388
- y.style.display = "none";
389
- }
390
- });
391
- });
392
-
393
-
394
- $(document).ready(function(literature) {
395
- $("#apply").on("click", async function() {
396
- // prevent default send
397
- event.preventDefault();
398
- document.getElementById("popup-2").classList.toggle("active");
399
- // const clear_literature = document.getElementById("literature");
400
- // clear_literature.innerHTML = '';
401
-
402
- var js_data1 = document.getElementById("literature_max").value;
403
- var js_data2 = document.getElementById("id_sort").value;
404
- const js_data = JSON.stringify([js_data1, js_data2]);
405
-
406
- $.ajax({
407
- url: '/resultsspec',
408
- type : 'post',
409
- contentType: 'application/json; charset=utf-8',
410
- dataType : 'json',
411
- data : js_data,
412
- success: function(data){
413
- const clear_literature = document.getElementById("literature");
414
- clear_literature.innerHTML = '';
415
- myFunc(data);
416
-
417
- },
418
- error: function() {
419
- const clear_literature = document.getElementById("literature");
420
- clear_literature.innerHTML = '';
421
- myFunc(data);
422
- }
423
- });
424
- });
425
- });
426
-
427
-
428
- $(document).ready(function () {
429
- $("#submitspec").on("click", async function() {
430
- // prevent default send
431
- event.preventDefault();
432
-
433
- // Zeige den "assigning..."-Text und den Loader an, verstecke den "submit"-Text
434
- $("#assignment_text, #assignment_loader").show();
435
- $("#submit_text").hide();
436
-
437
- let file = document.getElementById("infile").files[0];
438
- if (!file) {
439
- alert('No file selected, please select a .fq file that contains sequence reads');
440
- return;
441
- }
442
-
443
- name = document.getElementById('infile').files[0].name;
444
- ext = name.split('.').pop();
445
-
446
- if ((ext !== 'fq') && (ext !== 'fasta') && (ext !== 'fna') && (ext !== 'fastq')){
447
- alert('Wrong file-type, please select a FASTQ or FASTA/FNA file');
448
- return;
449
- }
450
-
451
- test = document.getElementById("genusSelect").value;
452
- if (test == "0"){
453
- // Keine Option ausgewählt, zeige Popup an
454
- alert("No genus selected, please select a genus");
455
- return;
456
- }
457
-
458
- var number = document.getElementById("reads_max").value;
459
-
460
- // Converting Number field to String, then checking if
461
- // only numbers are in string (to prevent entering '.' or '+'
462
- var not_int = !(/^\d+$/.test(number.toString()));
463
-
464
- if ((not_int) || (number < 5000) || (number > 10000000)){
465
- alert('Error: Number of reads must be between 5000 and 10.000.000 and also be a Integer!');
466
- return;
467
- }
468
-
469
- // Getting Reads
470
- // var data = await asyncCallspec(ext)
471
- // var js_data="[";
472
- // for(var indx=0;indx<data.length-1;indx++){
473
- // js_data+=JSON.stringify(data[indx],null,4)+",";
474
- // }
475
- // js_data+=JSON.stringify(data[data.length-1],null,4)+"]";
476
- var js_data = JSON.stringify(await asyncCallspec(ext));
477
-
478
- if (js_data == null){
479
- alert('Error: This Tool does not support your Browser, please use a modern Browser.');
480
- return;
481
- }
482
-
483
-
484
- $.ajax({
485
- url: '/species',
486
- type : 'post',
487
- contentType: 'application/json',
488
- dataType : 'json',
489
- data : js_data,
490
- success: function(){
491
- // Zeige den "submit"-Text an, verstecke den Loader und den "assigning..."-Text
492
- //$("#submit_text").show();
493
- //$("#assignment_loader, #assignment_text").hide();
494
- window.location.href = '/assignspec';
495
-
496
- },
497
- error: function() {
498
- // Zeige den "submit"-Text an, verstecke den Loader und den "assigning..."-Text
499
- //$("#submit_text").show();
500
- //$("#assignment_loader, #assignment_text").hide();
501
- //document.getElementById("opt").style.display = "block";
502
- alert("Your Browser does not support this Tool. Please use a valid Browser");
503
- }
504
- });
505
-
506
- });
507
- });
508
-
509
-
510
- $(document).ready(function () {
511
- // Überwache Änderungen am Select-Element
512
- $(".form-select").change(function () {
513
- // show loader
514
- $("#load_BF").show();
515
-
516
- // Holen Sie sich den ausgewählten Wert
517
- var selectedGenus = $(this).val();
518
- console.log(selectedGenus);
519
-
520
-
521
- // Sende die Informationen an das Python-Backend (AJAX-POST-Anfrage)
522
- $.ajax({
523
- type: "POST",
524
- url: "/change_genus", // Ersetze dies durch den tatsächlichen Endpunkt deines Backends
525
- data: { genus: selectedGenus },
526
- success: function (response) {
527
- $("#load_BF").hide();
528
- // Erfolgsaktion (optional)
529
- // Aktualisiere den Text mit dem ausgewählten Genus-Wert
530
- $("#selectedGenusText").text("Most similar [" + selectedGenus + "] species");
531
- console.log("form-select change");
532
- },
533
- error: function (error) {
534
- $("#load_BF").hide();
535
- // Fehleraktion (optional)
536
- console.error("Fehler beim Senden der Daten an das Backend:", error);
537
- }
538
- });
539
- });
540
- });
541
-
542
-
543
- $(document).ready(function () {
544
- $("#train_new_genus").on("click", async function() {
545
- // Verstecke den Start-Text und zeige den Loader an
546
- $("#start_text").hide();
547
- $("#genus_loader").show();
548
- $("#loading_text").show();
549
-
550
- var js_data = $("#genus_text").val();
551
-
552
- $.ajax({
553
- url: '/train_new_genus',
554
- type: 'post',
555
- contentType: 'application/json',
556
- data: JSON.stringify({ data: js_data }),
557
- }).done(function() {
558
- // Verstecke den Loader und zeige den Start-Text an
559
- $("#genus_loader").hide();
560
- $("#loading_text").hide();
561
- $("#genus_text").val("");
562
- $("#start_text").show();
563
- alert("Genus successfully trained!");
564
- // Reload the page to update the genus options
565
- location.reload();
566
- }).fail(function() {
567
- // Verstecke den Loader und zeige den Start-Text an
568
- console.error("Fehler beim Trainieren des Genus.");
569
- $("#genus_loader").hide();
570
- $("#loading_text").hide();
571
- $("#genus_text").val("");
572
- $("#start_text").show();
573
- alert("Some Error occurred, please try again later.");
574
- });
575
- });
576
- });
577
-
578
-
579
- $(document).ready(function () {
580
- // Lade vorhandene Optionen aus der Datei beim Start
581
- loadSavedOptions();
582
-
583
- function loadSavedOptions() {
584
- // Lade Optionen aus der Datei
585
- $.ajax({
586
- url: '/load_saved_options',
587
- type: 'get',
588
- dataType: 'json',
589
- success: function(data) {
590
- // Füge die geladenen Optionen zum Select Picker hinzu
591
- data.options.forEach(function(option) {
592
- var newOption = new Option(option, option, true, true);
593
- $("#genusSelect").append(newOption);
594
- });
595
- // Überprüfe, ob die Option mit ID "Preselect" nicht ausgewählt ist
596
- var preselect = $("#Preselect");
597
- if (preselect.length > 0 && !preselect.prop("selected")) {
598
- // Setze "Preselect" als ausgewählt
599
- preselect.prop("selected", true);
600
- // Aktualisiere den Text mit dem ausgewählten Genus-Wert
601
- $("#selectedGenusText").text("Most similar [Select Genus] species");
602
- console.log("load_saved_options");
603
- }
604
- },
605
- error: function() {
606
- console.error("Error while loading saved options.");
607
- }
608
- });
609
- }
610
- });
611
-
612
-
613
-
614
-
615
-