Upload 23 files
Browse files- anti_mammalian_cells_yd_threshold.csv +11 -0
- antibacterial_yd_threshold.csv +11 -0
- antibiofilm_yd_threshold.csv +11 -0
- anticancer_yd_threshold.csv +11 -0
- anticandida_yd_threshold.csv +11 -0
- antifungal_yd_threshold.csv +11 -0
- antigram-negative_yd_threshold.csv +11 -0
- antigram-positive_yd_threshold.csv +11 -0
- antihiv_yd_threshold.csv +11 -0
- antimalarial_yd_threshold.csv +11 -0
- antimrsa_yd_threshold.csv +11 -0
- antiparasitic_yd_threshold.csv +11 -0
- antiplasmodial_yd_threshold.csv +11 -0
- antiprotozoal_yd_threshold.csv +11 -0
- antitb_yd_threshold.csv +11 -0
- antiviral_yd_threshold.csv +11 -0
- anurandefense_yd_threshold.csv +11 -0
- app.py +223 -0
- chemotactic_yd_threshold.csv +11 -0
- cytotoxic_yd_threshold.csv +11 -0
- endotoxin_yd_threshold.csv +11 -0
- hemolytic_yd_threshold.csv +11 -0
- insecticidal_yd_threshold.csv +11 -0
anti_mammalian_cells_yd_threshold.csv
ADDED
@@ -0,0 +1,11 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
,threshold
|
2 |
+
0,0.1525790244340896
|
3 |
+
1,0.0760533288121223
|
4 |
+
2,0.1492621749639511
|
5 |
+
3,0.1219991967082023
|
6 |
+
4,0.1047019213438034
|
7 |
+
5,0.1363092511892318
|
8 |
+
6,0.0930725336074829
|
9 |
+
7,0.0958817079663276
|
10 |
+
8,0.1338892579078674
|
11 |
+
9,0.0932814627885818
|
antibacterial_yd_threshold.csv
ADDED
@@ -0,0 +1,11 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
,threshold
|
2 |
+
0,0.4496227502822876
|
3 |
+
1,0.3883198201656341
|
4 |
+
2,0.3562843203544616
|
5 |
+
3,0.298247218132019
|
6 |
+
4,0.4385020732879638
|
7 |
+
5,0.4251146614551544
|
8 |
+
6,0.4341979026794433
|
9 |
+
7,0.2845156490802765
|
10 |
+
8,0.3436572253704071
|
11 |
+
9,0.3261722922325134
|
antibiofilm_yd_threshold.csv
ADDED
@@ -0,0 +1,11 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
,threshold
|
2 |
+
0,0.0010717363329604
|
3 |
+
1,0.0004516514600254
|
4 |
+
2,0.000373906281311
|
5 |
+
3,0.0007363113109022
|
6 |
+
4,3.484930857666768e-05
|
7 |
+
5,0.0003151300188619
|
8 |
+
6,0.0011047080624848
|
9 |
+
7,0.0007902314537204
|
10 |
+
8,0.0006953802076168
|
11 |
+
9,0.0003028515202458
|
anticancer_yd_threshold.csv
ADDED
@@ -0,0 +1,11 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
,threshold
|
2 |
+
0,0.1051242128014564
|
3 |
+
1,0.0922926068305969
|
4 |
+
2,0.0994595140218734
|
5 |
+
3,0.0824442058801651
|
6 |
+
4,0.0792957991361618
|
7 |
+
5,0.072281502187252
|
8 |
+
6,0.0954500809311866
|
9 |
+
7,0.0436021983623504
|
10 |
+
8,0.0734143629670143
|
11 |
+
9,0.0542230121791362
|
anticandida_yd_threshold.csv
ADDED
@@ -0,0 +1,11 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
,threshold
|
2 |
+
0,0.0272127203643322
|
3 |
+
1,0.0113312294706702
|
4 |
+
2,0.0158187840133905
|
5 |
+
3,0.009648754261434
|
6 |
+
4,0.0055011077784001
|
7 |
+
5,0.011053130030632
|
8 |
+
6,0.0015367614105343
|
9 |
+
7,0.0144472680985927
|
10 |
+
8,0.0127825438976287
|
11 |
+
9,0.01068951562047
|
antifungal_yd_threshold.csv
ADDED
@@ -0,0 +1,11 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
,threshold
|
2 |
+
0,0.1905697137117386
|
3 |
+
1,0.2031028866767883
|
4 |
+
2,0.1090441793203353
|
5 |
+
3,0.1683354675769806
|
6 |
+
4,0.2166067212820053
|
7 |
+
5,0.1459249407052993
|
8 |
+
6,0.1769887655973434
|
9 |
+
7,0.123556450009346
|
10 |
+
8,0.1815296709537506
|
11 |
+
9,0.1819620281457901
|
antigram-negative_yd_threshold.csv
ADDED
@@ -0,0 +1,11 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
,threshold
|
2 |
+
0,0.350467324256897
|
3 |
+
1,0.2841741442680359
|
4 |
+
2,0.1829241067171096
|
5 |
+
3,0.2051365971565246
|
6 |
+
4,0.2392990440130233
|
7 |
+
5,0.250076562166214
|
8 |
+
6,0.2709463834762573
|
9 |
+
7,0.3161788880825043
|
10 |
+
8,0.2945723533630371
|
11 |
+
9,0.3661049306392669
|
antigram-positive_yd_threshold.csv
ADDED
@@ -0,0 +1,11 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
,threshold
|
2 |
+
0,0.159443125128746
|
3 |
+
1,0.175675019621849
|
4 |
+
2,0.1815598160028457
|
5 |
+
3,0.2127318680286407
|
6 |
+
4,0.1937155872583389
|
7 |
+
5,0.1311574429273605
|
8 |
+
6,0.2421468198299408
|
9 |
+
7,0.164654865860939
|
10 |
+
8,0.2011494487524032
|
11 |
+
9,0.1703412532806396
|
antihiv_yd_threshold.csv
ADDED
@@ -0,0 +1,11 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
,threshold
|
2 |
+
0,0.001297834329307
|
3 |
+
1,0.0147092789411544
|
4 |
+
2,0.0280767139047384
|
5 |
+
3,0.0188311729580163
|
6 |
+
4,0.0316063687205314
|
7 |
+
5,0.0002793179592117
|
8 |
+
6,0.0394531860947608
|
9 |
+
7,0.0352290384471416
|
10 |
+
8,0.0161530096083879
|
11 |
+
9,0.0399153716862201
|
antimalarial_yd_threshold.csv
ADDED
@@ -0,0 +1,11 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
,threshold
|
2 |
+
0,0.0002518623368814
|
3 |
+
1,0.0011312034912407
|
4 |
+
2,0.0008880426757968
|
5 |
+
3,0.000496806751471
|
6 |
+
4,0.0012301608221605
|
7 |
+
5,0.0008584852912463
|
8 |
+
6,0.0002407601568847
|
9 |
+
7,0.0007967063575051
|
10 |
+
8,0.0017376942560076
|
11 |
+
9,0.0015417954418808
|
antimrsa_yd_threshold.csv
ADDED
@@ -0,0 +1,11 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
,threshold
|
2 |
+
0,0.0141361905261874
|
3 |
+
1,0.0036627338267862
|
4 |
+
2,0.0077131749130785
|
5 |
+
3,0.0193892307579517
|
6 |
+
4,0.0269243717193603
|
7 |
+
5,0.011976390145719
|
8 |
+
6,0.014747904613614
|
9 |
+
7,0.0004355635028332
|
10 |
+
8,0.0149725144729018
|
11 |
+
9,0.001316599198617
|
antiparasitic_yd_threshold.csv
ADDED
@@ -0,0 +1,11 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
,threshold
|
2 |
+
0,0.0133489668369293
|
3 |
+
1,0.013213163241744
|
4 |
+
2,0.0098364204168319
|
5 |
+
3,0.0098508978262543
|
6 |
+
4,0.0078889606520533
|
7 |
+
5,0.0084595428779721
|
8 |
+
6,0.0112555986270308
|
9 |
+
7,0.009906081482768
|
10 |
+
8,0.0203342288732528
|
11 |
+
9,0.0079685244709253
|
antiplasmodial_yd_threshold.csv
ADDED
@@ -0,0 +1,11 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
,threshold
|
2 |
+
0,0.0001347773213637
|
3 |
+
1,0.0009133622515946
|
4 |
+
2,9.326116014563011e-06
|
5 |
+
3,0.0001174091376014
|
6 |
+
4,3.263696635258384e-05
|
7 |
+
5,8.079609688138589e-05
|
8 |
+
6,0.002609065035358
|
9 |
+
7,0.0026866241823881
|
10 |
+
8,0.0004498923080973
|
11 |
+
9,4.718012496596202e-05
|
antiprotozoal_yd_threshold.csv
ADDED
@@ -0,0 +1,11 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
,threshold
|
2 |
+
0,0.003057480789721
|
3 |
+
1,0.0040516722947359
|
4 |
+
2,0.0025351848453283
|
5 |
+
3,0.0045190006494522
|
6 |
+
4,0.0001927299890667
|
7 |
+
5,0.000583435583394
|
8 |
+
6,0.0027324347756803
|
9 |
+
7,1.884532684925944e-05
|
10 |
+
8,0.0009825642919167
|
11 |
+
9,0.0006906135822646
|
antitb_yd_threshold.csv
ADDED
@@ -0,0 +1,11 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
,threshold
|
2 |
+
0,0.000651930575259
|
3 |
+
1,0.0006640456267632
|
4 |
+
2,0.007218284998089
|
5 |
+
3,0.0021461523137986
|
6 |
+
4,0.0012260759249329
|
7 |
+
5,0.0005806351546198
|
8 |
+
6,0.0083108721300959
|
9 |
+
7,0.0032738070003688
|
10 |
+
8,0.0002077087265206
|
11 |
+
9,0.0016663705464452
|
antiviral_yd_threshold.csv
ADDED
@@ -0,0 +1,11 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
,threshold
|
2 |
+
0,0.2781128883361816
|
3 |
+
1,0.2598320543766022
|
4 |
+
2,0.2447118610143661
|
5 |
+
3,0.2298509180545807
|
6 |
+
4,0.3155396282672882
|
7 |
+
5,0.3103104829788208
|
8 |
+
6,0.2029070407152176
|
9 |
+
7,0.2685596346855163
|
10 |
+
8,0.2826785147190094
|
11 |
+
9,0.2654517292976379
|
anurandefense_yd_threshold.csv
ADDED
@@ -0,0 +1,11 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
,threshold
|
2 |
+
0,0.06325114518404
|
3 |
+
1,0.040009070187807
|
4 |
+
2,0.0438646599650383
|
5 |
+
3,0.0655954405665397
|
6 |
+
4,0.0161753576248884
|
7 |
+
5,0.0274067930877208
|
8 |
+
6,0.0275417882949113
|
9 |
+
7,0.0296123120933771
|
10 |
+
8,0.1663894206285476
|
11 |
+
9,0.0152728063985705
|
app.py
ADDED
@@ -0,0 +1,223 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
from Bio import SeqIO
|
2 |
+
import os
|
3 |
+
import torch
|
4 |
+
import torch.nn as nn
|
5 |
+
import torch.optim as optim
|
6 |
+
import torch.nn.functional as F
|
7 |
+
from tqdm import tqdm
|
8 |
+
import numpy as np
|
9 |
+
import scipy.stats
|
10 |
+
import pathlib
|
11 |
+
import copy
|
12 |
+
import time
|
13 |
+
# from termcolor import colored
|
14 |
+
import vocab
|
15 |
+
from model import SequenceMultiTypeMultiCNN_1
|
16 |
+
from tools import EarlyStopping
|
17 |
+
from data_feature import Dataset
|
18 |
+
from sklearn.metrics import roc_auc_score
|
19 |
+
from sklearn.metrics import accuracy_score, f1_score, confusion_matrix, matthews_corrcoef
|
20 |
+
import pandas as pd
|
21 |
+
import argparse
|
22 |
+
from tqdm import tqdm
|
23 |
+
from io import StringIO
|
24 |
+
import gradio as gr
|
25 |
+
|
26 |
+
device = torch.device("cpu")
|
27 |
+
|
28 |
+
|
29 |
+
def return_y(data_iter, net):
|
30 |
+
y_pred = []
|
31 |
+
|
32 |
+
all_seq = []
|
33 |
+
for batch in data_iter:
|
34 |
+
all_seq += batch['sequence']
|
35 |
+
|
36 |
+
AAI_feat = batch['seq_enc_AAI'].to(device)
|
37 |
+
onehot_feat = batch['seq_enc_onehot'].to(device)
|
38 |
+
BLOSUM62_feat = batch['seq_enc_BLOSUM62'].to(device)
|
39 |
+
PAAC_feat = batch['seq_enc_PAAC'].to(device)
|
40 |
+
# bert_feat=batch['seq_enc_bert'].to(device)
|
41 |
+
# bert_mask=batch['seq_enc_mask'].to(device)
|
42 |
+
outputs = net(AAI_feat, onehot_feat, BLOSUM62_feat, PAAC_feat)
|
43 |
+
# outputs = model(x)
|
44 |
+
y_pred.extend(outputs.cpu().numpy())
|
45 |
+
|
46 |
+
return y_pred, all_seq
|
47 |
+
|
48 |
+
|
49 |
+
def testing(batch_size, patience, n_epochs, testfasta, seq_len, cdhit_value, cv_number, save_file, model_file):
|
50 |
+
model = SequenceMultiTypeMultiCNN_1(d_input=[531, 21, 23, 3], vocab_size=21, seq_len=seq_len,
|
51 |
+
dropout=0.1, d_another_h=128, k_cnn=[2, 3, 4, 5, 6], d_output=1).to(device)
|
52 |
+
|
53 |
+
dataset = Dataset(fasta=testfasta)
|
54 |
+
test_loader = dataset.get_dataloader(batch_size=batch_size, max_length=seq_len)
|
55 |
+
|
56 |
+
model.load_state_dict(torch.load(model_file, map_location=torch.device('cpu'))['state_dict'])
|
57 |
+
model.eval()
|
58 |
+
with torch.no_grad():
|
59 |
+
new_y_pred, all_seq = return_y(test_loader, model)
|
60 |
+
|
61 |
+
final_y_pred = copy.deepcopy(new_y_pred)
|
62 |
+
|
63 |
+
final_y_pred = np.array(final_y_pred).T[0].tolist()
|
64 |
+
|
65 |
+
pred_dict = {'seq': all_seq, 'predictions': final_y_pred}
|
66 |
+
pred_df = pd.DataFrame(pred_dict)
|
67 |
+
pred_df.to_csv(save_file, index=None)
|
68 |
+
|
69 |
+
|
70 |
+
all_function_names = ['antibacterial', 'antigram-positive', 'antigram-negative', 'antifungal', 'antiviral', \
|
71 |
+
'anti_mammalian_cells', 'antihiv', 'antibiofilm', 'anticancer', 'antimrsa', 'antiparasitic', \
|
72 |
+
'hemolytic', 'chemotactic', 'antitb', 'anurandefense', 'cytotoxic', \
|
73 |
+
'endotoxin', 'insecticidal', 'antimalarial', 'anticandida', 'antiplasmodial', 'antiprotozoal']
|
74 |
+
|
75 |
+
|
76 |
+
# os.environ['CUDA_LAUNCH_BLOCKING'] = 1
|
77 |
+
|
78 |
+
|
79 |
+
def predict(test_file):
|
80 |
+
# fas_id = []
|
81 |
+
fas_seq = [test_file]
|
82 |
+
# for seq_record in SeqIO.parse(test_file, "fasta"):
|
83 |
+
# fas_seq.append(str(seq_record.seq).upper())
|
84 |
+
# fas_id.append(str(seq_record.id))
|
85 |
+
|
86 |
+
seq_len = 200
|
87 |
+
batch_size = 32
|
88 |
+
cdhit_value = 40
|
89 |
+
vocab_size = len(vocab.AMINO_ACIDS)
|
90 |
+
|
91 |
+
epochs = 300
|
92 |
+
temp_save_AMP_filename = '%s ' % (time.strftime('%Y-%m-%d-%H-%M-%S', time.localtime()))
|
93 |
+
for cv_number in tqdm(range(10)):
|
94 |
+
testing(testfasta=fas_seq,
|
95 |
+
model_file=f'textcnn_cdhit_40_{cv_number}.pth.tar',
|
96 |
+
save_file=f'{temp_save_AMP_filename}_{cv_number}.csv',
|
97 |
+
batch_size=batch_size, patience=10, n_epochs=epochs, seq_len=seq_len, cdhit_value=cdhit_value
|
98 |
+
, cv_number=cv_number)
|
99 |
+
|
100 |
+
pred_prob = []
|
101 |
+
for cv_number in tqdm(range(10)):
|
102 |
+
df = pd.read_csv(f'{temp_save_AMP_filename}_{cv_number}.csv')
|
103 |
+
data = df.values.tolist()
|
104 |
+
temp = []
|
105 |
+
for i in tqdm(range(len(data))):
|
106 |
+
temp.append(data[i][1])
|
107 |
+
pred_prob.append(temp)
|
108 |
+
pred_prob = np.average(pred_prob, 0)
|
109 |
+
pred_AMP_label = []
|
110 |
+
for i in tqdm(range(len(pred_prob))):
|
111 |
+
if pred_prob[i] > 0.5:
|
112 |
+
pred_AMP_label.append('Yes')
|
113 |
+
else:
|
114 |
+
pred_AMP_label.append('No')
|
115 |
+
|
116 |
+
for function_name in all_function_names:
|
117 |
+
temp_dir_list = os.listdir('tmp_save')
|
118 |
+
if function_name not in temp_dir_list:
|
119 |
+
os.mkdir( function_name)
|
120 |
+
for cv_number in tqdm(range(10)):
|
121 |
+
testing(testfasta=fas_seq,
|
122 |
+
model_file=f'{function_name}textcnn_cdhit_100_0.pth.tar',
|
123 |
+
save_file=f'{function_name}{temp_save_AMP_filename}_{cv_number}.csv',
|
124 |
+
batch_size=batch_size, patience=10, n_epochs=epochs, seq_len=seq_len, cdhit_value=cdhit_value
|
125 |
+
, cv_number=cv_number)
|
126 |
+
|
127 |
+
all_function_pred_label = []
|
128 |
+
for function_name in all_function_names:
|
129 |
+
|
130 |
+
function_threshold_df = pd.read_csv(f'{function_name}_yd_threshold.csv', index_col=0)
|
131 |
+
function_thresholds = function_threshold_df.values[:, 0]
|
132 |
+
|
133 |
+
each_function_data = []
|
134 |
+
|
135 |
+
for cv_number in tqdm(range(10)):
|
136 |
+
df = pd.read_csv(f'{function_name}{temp_save_AMP_filename}_{cv_number}.csv')
|
137 |
+
data = df.values.tolist()
|
138 |
+
temp = []
|
139 |
+
for i in tqdm(range(len(data))):
|
140 |
+
|
141 |
+
if data[i][1] > function_thresholds[cv_number]:
|
142 |
+
temp.append(1)
|
143 |
+
else:
|
144 |
+
temp.append(0)
|
145 |
+
each_function_data.append(temp)
|
146 |
+
each_function_data = np.average(each_function_data, 0)
|
147 |
+
pred_each_function_label = []
|
148 |
+
for i in tqdm(range(len(each_function_data))):
|
149 |
+
if each_function_data[i] > 0.5:
|
150 |
+
pred_each_function_label.append('Yes')
|
151 |
+
else:
|
152 |
+
pred_each_function_label.append('No')
|
153 |
+
|
154 |
+
all_function_pred_label.append(pred_each_function_label)
|
155 |
+
|
156 |
+
all_function_cols = ['antibacterial', 'anti-Gram-positive', 'anti-Gram-negative', 'antifungal', 'antiviral', \
|
157 |
+
'anti-mammalian-cells', 'anti-HIV', 'antibiofilm', 'anticancer', 'anti-MRSA', 'antiparasitic', \
|
158 |
+
'hemolytic', 'chemotactic', 'anti-TB', 'anurandefense', 'cytotoxic', \
|
159 |
+
'endotoxin', 'insecticidal', 'antimalarial', 'anticandida', 'antiplasmodial', 'antiprotozoal']
|
160 |
+
|
161 |
+
pred_contents_dict = {'sequence': fas_seq, 'AMP': pred_AMP_label}
|
162 |
+
for i in tqdm(range(len(all_function_cols))):
|
163 |
+
pred_contents_dict[all_function_cols[i]] = all_function_pred_label[i]
|
164 |
+
|
165 |
+
pred_contents_df = pd.DataFrame(pred_contents_dict)
|
166 |
+
|
167 |
+
for function_name in all_function_names:
|
168 |
+
for cv_number in tqdm(range(10)):
|
169 |
+
os.remove(f'{function_name}{temp_save_AMP_filename}_{cv_number}.csv')
|
170 |
+
for cv_number in tqdm(range(10)):
|
171 |
+
os.remove(f'{temp_save_AMP_filename}_{cv_number}.csv')
|
172 |
+
result_csv = pd.DataFrame({ 'Prediction': pred_AMP_label})
|
173 |
+
result_csv_string = StringIO()
|
174 |
+
result_csv.to_csv(result_csv_string, index=False)
|
175 |
+
result_csv_string.seek(0)
|
176 |
+
|
177 |
+
return pred_contents_df
|
178 |
+
# master.insert_one({'Test Report': res_val})
|
179 |
+
|
180 |
+
|
181 |
+
if __name__ == '__main__':
|
182 |
+
pd.set_option('display.max_columns', None)
|
183 |
+
pd.set_option('display.max_colwidth', -1)
|
184 |
+
|
185 |
+
# parser = argparse.ArgumentParser(description='proposed model')
|
186 |
+
|
187 |
+
# parser.add_argument('-output_file_name', default='prediction_output', type=str)
|
188 |
+
|
189 |
+
# parser.add_argument('-test_fasta_file', default='examples/samples.fasta', type=str)
|
190 |
+
# args = parser.parse_args()
|
191 |
+
|
192 |
+
# output_file_name = args.output_file_name
|
193 |
+
# test_file = args.test_fasta_file
|
194 |
+
# flag = 0
|
195 |
+
# for seq_record in SeqIO.parse(test_file, "fasta"):
|
196 |
+
# temp_id = str(seq_record.id)
|
197 |
+
# temp_seq = str(seq_record.seq)
|
198 |
+
# if len(set(temp_seq.upper()).difference(set('ACDEFGHIKLMNPQRSTVWY'))) > 0:
|
199 |
+
# flag = 1
|
200 |
+
# print('input error: have unusual amino acids')
|
201 |
+
# break
|
202 |
+
|
203 |
+
# if flag == 0:
|
204 |
+
# pred_df = predict(test_file)
|
205 |
+
# pred_df.to_csv(output_file_name + '.csv')
|
206 |
+
with gr.Blocks() as demo:
|
207 |
+
gr.Markdown(
|
208 |
+
"""
|
209 |
+
|
210 |
+
# Welcome to Antimicrobial Peptide Attribute Prediction Model
|
211 |
+
|
212 |
+
This is an online model for predicting attributes of antimicrobial peptides. Here, you can simply input a protein sequence, such as QGLFFLGAKLFYLLTLFL, and the model will generate predictions for various attributes.
|
213 |
+
|
214 |
+
Please note that due to server limitations, large-scale predictions may not be supported online. If you have a need for large-scale predictions, I can provide you with the code or assist you with the predictions directly, free of charge. Feel free to contact me for any inquiries:
|
215 |
+
|
216 |
+
Email: [email protected]
|
217 |
+
|
218 |
+
Let's get started!
|
219 |
+
|
220 |
+
""")
|
221 |
+
|
222 |
+
iface = gr.Interface(fn=predict, inputs="text", outputs="text")
|
223 |
+
demo.launch(server_name='127.0.0.1', server_port=7788)
|
chemotactic_yd_threshold.csv
ADDED
@@ -0,0 +1,11 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
,threshold
|
2 |
+
0,0.0060868617147207
|
3 |
+
1,9.572660201229156e-05
|
4 |
+
2,0.0008185741025954
|
5 |
+
3,9.364341531181708e-05
|
6 |
+
4,0.0002393810573266
|
7 |
+
5,0.0022423025220632
|
8 |
+
6,0.0084763616323471
|
9 |
+
7,0.0027119170408695
|
10 |
+
8,3.411575744394213e-05
|
11 |
+
9,0.0029187819454818
|
cytotoxic_yd_threshold.csv
ADDED
@@ -0,0 +1,11 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
,threshold
|
2 |
+
0,0.0080689117312431
|
3 |
+
1,0.0061783450655639
|
4 |
+
2,0.0107948025688529
|
5 |
+
3,0.012933705933392
|
6 |
+
4,0.0074981972575187
|
7 |
+
5,0.000167274614796
|
8 |
+
6,0.0103498054668307
|
9 |
+
7,0.0073629915714263
|
10 |
+
8,0.0012240845244377
|
11 |
+
9,0.0001633148203836
|
endotoxin_yd_threshold.csv
ADDED
@@ -0,0 +1,11 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
,threshold
|
2 |
+
0,0.0015385682927444
|
3 |
+
1,0.0006175263551995
|
4 |
+
2,0.0014237745199352
|
5 |
+
3,0.0001627063029445
|
6 |
+
4,0.001902371761389
|
7 |
+
5,0.0006754832575097
|
8 |
+
6,0.0008196207927539
|
9 |
+
7,0.0021725625265389
|
10 |
+
8,0.0004220827540848
|
11 |
+
9,0.0006830523489043
|
hemolytic_yd_threshold.csv
ADDED
@@ -0,0 +1,11 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
,threshold
|
2 |
+
0,0.0221392400562763
|
3 |
+
1,0.0695223584771156
|
4 |
+
2,0.0811304897069931
|
5 |
+
3,0.0350562147796154
|
6 |
+
4,0.0791068449616432
|
7 |
+
5,0.0475858710706234
|
8 |
+
6,0.0865858867764473
|
9 |
+
7,0.0352442301809787
|
10 |
+
8,0.0357107110321521
|
11 |
+
9,0.0703328251838684
|
insecticidal_yd_threshold.csv
ADDED
@@ -0,0 +1,11 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
,threshold
|
2 |
+
0,0.0042725815437734
|
3 |
+
1,0.0039733867160975
|
4 |
+
2,0.0020466167479753
|
5 |
+
3,0.0001893758308142
|
6 |
+
4,0.005238143261522
|
7 |
+
5,0.003733716905117
|
8 |
+
6,0.0044953846372663
|
9 |
+
7,0.0027529671788215
|
10 |
+
8,0.0010488195111975
|
11 |
+
9,0.0006791127379983
|