dalexanderch commited on
Commit
bdac097
1 Parent(s): c20f071

Upload app.py

Browse files
Files changed (1) hide show
  1. app.py +41 -0
app.py CHANGED
@@ -6,7 +6,48 @@ import gradio as gr
6
  from glycowork.ml.processing import dataset_to_dataloader
7
  import numpy as np
8
  import torch
 
9
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
10
 
11
  def fn(model, class_list):
12
  def f(glycan):
 
6
  from glycowork.ml.processing import dataset_to_dataloader
7
  import numpy as np
8
  import torch
9
+ from glycowork.glycan_data.loader import lib
10
 
11
+ # Update lib
12
+ equivalence_classes = [
13
+ ["Glc", "Man", "Gal", "Gul", "Alt", "All", "Tal", "Ido" ],
14
+ ["GlcNAc", "ManNAc", "GalNAc", "GulNAc", "AltNAc", "AllNAc", "TalNAc", "IdoNAc"],
15
+ ["GlcN", "ManN", "GalN", "GulN", "AltN", "AllN", "TalN", "IdoN"],
16
+ ["GlcA", "ManA", "GalA", "GulA", "AltA", "AllA", "TalA", "IdoA"],
17
+ ["Qui", "Rha", "6dGul", "6dAlt", "6dTal", "Fuc"],
18
+ ["QuiNAc", "RhaNAc", "6dAltNAc", "6dTalNAc", "FucNAc"],
19
+ ["Oli", "Tyv", "Abe", "Par", "Dig", "Col"],
20
+ ["Ara", "Lyx", "Xyl", "Rib"],
21
+ ["Kdn", "Neu5Ac", "Neu5Gc", "Neu", "Sia"],
22
+ ["Pse", "Leg", "Aci", "4eLeg"],
23
+ ["Bac", "LDmanHep", "Kdo", "Dha", "DDmanHep", "MurNAc", "MurNGc", "Mur", "Api", "Fru", "Tag", "Sor", "Psi"]
24
+ ]
25
+
26
+ linkage_classes = [
27
+ ["a1-2", "a1-z", "z1-2", "z1-z"],
28
+ ["a1-3", "a1-z", "z1-3", "z1-z"],
29
+ ["a1-4", "a1-z", "z1-4", "z1-z"],
30
+ ["a1-6", "a1-z", "z1-6", "z1-z"],
31
+ ["b1-2", "b1-z", "z1-2", "z1-z"],
32
+ ["b1-3", "b1-z", "z1-3", "z1-z"],
33
+ ["b1-4", "b1-z", "z1-4", "z1-z"],
34
+ ["b1-6", "b1-z", "z1-6", "z1-z"],
35
+ ["a2-3", "a2-z", "z2-3", "z2-z"],
36
+ ["a2-6", "a2-z", "z2-6", "z2-z"],
37
+ ["a2-8", "a2-z", "z2-8", "z2-z"]
38
+ ]
39
+
40
+ # Update lib
41
+ print(len(lib))
42
+ for equivalence_class in equivalence_classes:
43
+ for target in equivalence_class:
44
+ if target not in lib:
45
+ lib.append(target)
46
+ for linkage_class in linkage_classes:
47
+ for target in linkage_class:
48
+ if target not in lib:
49
+ lib.append(target)
50
+ print(len(lib))
51
 
52
  def fn(model, class_list):
53
  def f(glycan):