Update app.py
Browse files
app.py
CHANGED
@@ -51,7 +51,7 @@ class MyDataset(Dataset):
|
|
51 |
def __init__(self,dict_data) -> None:
|
52 |
super(MyDataset,self).__init__()
|
53 |
self.data=dict_data
|
54 |
-
self.structure=pdb_structure(dict_data['
|
55 |
def __getitem__(self, index):
|
56 |
return self.data['text'][index], self.structure[index]
|
57 |
def __len__(self):
|
@@ -178,34 +178,29 @@ class MyModel(nn.Module):
|
|
178 |
return torch.softmax(output_feature,dim=1)
|
179 |
|
180 |
|
181 |
-
def pdb_structure(
|
182 |
-
|
183 |
-
|
184 |
-
|
185 |
-
|
186 |
-
|
187 |
-
|
188 |
-
|
189 |
-
|
190 |
-
|
191 |
-
|
192 |
-
|
193 |
-
|
194 |
-
|
195 |
-
|
196 |
-
|
197 |
-
|
198 |
-
|
199 |
-
|
200 |
-
|
201 |
-
|
202 |
-
|
203 |
-
|
204 |
-
atoms_channel = atoms_channel.to(device)
|
205 |
-
SurfacePoitCloud = PointCloudSurfaceObject(coords, radius)
|
206 |
-
feature = SurfacePoitCloud.view(pdb_num,-1,3).cpu()
|
207 |
-
SurfacePoitCloud_all.append(feature)
|
208 |
-
SurfacePoitCloud_all_tensor = torch.squeeze(torch.stack(SurfacePoitCloud_all),dim=1)
|
209 |
return SurfacePoitCloud_all_tensor
|
210 |
|
211 |
def ACE(file):
|
|
|
51 |
def __init__(self,dict_data) -> None:
|
52 |
super(MyDataset,self).__init__()
|
53 |
self.data=dict_data
|
54 |
+
self.structure=pdb_structure(dict_data['test_sequences'])
|
55 |
def __getitem__(self, index):
|
56 |
return self.data['text'][index], self.structure[index]
|
57 |
def __len__(self):
|
|
|
178 |
return torch.softmax(output_feature,dim=1)
|
179 |
|
180 |
|
181 |
+
def pdb_structure(test_sequences):
|
182 |
+
# structure_folder = join(temp_path, str(index)+".pdb")
|
183 |
+
# created_folders.append(structure_folder)
|
184 |
+
# pdb_file = join(pdb_path, f"{index}.pdb")
|
185 |
+
# if os.path.exists(pdb_file):
|
186 |
+
# shutil.copy2(pdb_file, structure_folder)
|
187 |
+
# else:
|
188 |
+
# print(f"PDB file not found for structure {index}")
|
189 |
+
print("=================================Structure prediction========================")
|
190 |
+
command = ["curl", "-X", "POST", "-k", "--data", f"{test_sequences}", "https://api.esmatlas.com/foldSequence/v1/pdb/"]
|
191 |
+
result = subprocess.run(command, capture_output=True, text=True)
|
192 |
+
# with open(os.path.join(pdb_path, f'{test_Structure_index[i]}.pdb'), 'w') as file:
|
193 |
+
# file.write(result.stdout)
|
194 |
+
coords, atname, pdbname, pdb_num = utils.parsePDB(result.stdout)
|
195 |
+
atoms_channel = utils.atomlistToChannels(atname)
|
196 |
+
radius = utils.atomlistToRadius(atname)
|
197 |
+
PointCloudSurfaceObject = VolumeMaker.PointCloudSurface(device=device)
|
198 |
+
coords = coords.to(device)
|
199 |
+
radius = radius.to(device)
|
200 |
+
atoms_channel = atoms_channel.to(device)
|
201 |
+
SurfacePoitCloud = PointCloudSurfaceObject(coords, radius)
|
202 |
+
feature = SurfacePoitCloud.view(pdb_num,-1,3).cpu()
|
203 |
+
SurfacePoitCloud_all_tensor = torch.squeeze(torch.stack(feature),dim=1)
|
|
|
|
|
|
|
|
|
|
|
204 |
return SurfacePoitCloud_all_tensor
|
205 |
|
206 |
def ACE(file):
|