Spaces:
Runtime error
Runtime error
Commit
·
d040c51
1
Parent(s):
a0bf679
Update app.py
Browse files
app.py
CHANGED
|
@@ -23,7 +23,7 @@ print(moleculekit.__version__)
|
|
| 23 |
|
| 24 |
def update(inp, file, mode, custom_resids, clustering_threshold):
|
| 25 |
try:
|
| 26 |
-
|
| 27 |
except:
|
| 28 |
print("using pdbfile")
|
| 29 |
try:
|
|
@@ -39,6 +39,7 @@ def update(inp, file, mode, custom_resids, clustering_threshold):
|
|
| 39 |
f"https://alphafold.ebi.ac.uk/files/AF-{pdb_file}-F1-model_v2.pdb",
|
| 40 |
f"files/{pdb_file}.pdb",
|
| 41 |
)
|
|
|
|
| 42 |
except AttributeError:
|
| 43 |
if len(inp) == 4:
|
| 44 |
pdb_file = inp
|
|
@@ -46,17 +47,16 @@ def update(inp, file, mode, custom_resids, clustering_threshold):
|
|
| 46 |
f"http://files.rcsb.org/download/{pdb_file.lower()}.pdb1",
|
| 47 |
f"files/{pdb_file}.pdb",
|
| 48 |
)
|
|
|
|
| 49 |
else:
|
| 50 |
return "pdb code must be 4 letters or Uniprot code does not match", ""
|
| 51 |
|
| 52 |
if mode == "All residues":
|
| 53 |
-
ids = get_all_protein_resids(
|
| 54 |
-
f"files/{pdb_file}.pdb",
|
| 55 |
-
)
|
| 56 |
elif len(custom_resids)!=0:
|
| 57 |
ids = [int(x) for x in custom_resids.split(',')]
|
| 58 |
else:
|
| 59 |
-
ids = get_all_metalbinding_resids(
|
| 60 |
|
| 61 |
voxels, prot_centers, prot_N, prots = processStructures(pdb_file, ids)
|
| 62 |
device = torch.device("cuda" if torch.cuda.is_available() else "cpu")
|
|
@@ -94,7 +94,7 @@ def update(inp, file, mode, custom_resids, clustering_threshold):
|
|
| 94 |
)
|
| 95 |
|
| 96 |
return message, molecule(
|
| 97 |
-
|
| 98 |
f"output/probes_{pdb_file}.pdb",
|
| 99 |
f"output/metal_{pdb_file}.cube",
|
| 100 |
)
|
|
|
|
| 23 |
|
| 24 |
def update(inp, file, mode, custom_resids, clustering_threshold):
|
| 25 |
try:
|
| 26 |
+
filepath = file.name
|
| 27 |
except:
|
| 28 |
print("using pdbfile")
|
| 29 |
try:
|
|
|
|
| 39 |
f"https://alphafold.ebi.ac.uk/files/AF-{pdb_file}-F1-model_v2.pdb",
|
| 40 |
f"files/{pdb_file}.pdb",
|
| 41 |
)
|
| 42 |
+
filepath = f"files/{pdb_file}.pdb"
|
| 43 |
except AttributeError:
|
| 44 |
if len(inp) == 4:
|
| 45 |
pdb_file = inp
|
|
|
|
| 47 |
f"http://files.rcsb.org/download/{pdb_file.lower()}.pdb1",
|
| 48 |
f"files/{pdb_file}.pdb",
|
| 49 |
)
|
| 50 |
+
filepath = f"files/{pdb_file}.pdb"
|
| 51 |
else:
|
| 52 |
return "pdb code must be 4 letters or Uniprot code does not match", ""
|
| 53 |
|
| 54 |
if mode == "All residues":
|
| 55 |
+
ids = get_all_protein_resids(filepath)
|
|
|
|
|
|
|
| 56 |
elif len(custom_resids)!=0:
|
| 57 |
ids = [int(x) for x in custom_resids.split(',')]
|
| 58 |
else:
|
| 59 |
+
ids = get_all_metalbinding_resids(filepath)
|
| 60 |
|
| 61 |
voxels, prot_centers, prot_N, prots = processStructures(pdb_file, ids)
|
| 62 |
device = torch.device("cuda" if torch.cuda.is_available() else "cpu")
|
|
|
|
| 94 |
)
|
| 95 |
|
| 96 |
return message, molecule(
|
| 97 |
+
filepath,
|
| 98 |
f"output/probes_{pdb_file}.pdb",
|
| 99 |
f"output/metal_{pdb_file}.cube",
|
| 100 |
)
|