Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 13 additions & 7 deletions models/gat.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,10 @@ def __init__(self, num_features_xd=78, n_output=1, num_features_xt=25,

# 1D convolution on protein sequence
self.embedding_xt = nn.Embedding(num_features_xt + 1, embed_dim)
self.conv_xt1 = nn.Conv1d(in_channels=1000, out_channels=n_filters, kernel_size=8)
self.fc_xt1 = nn.Linear(32*121, output_dim)
self.conv_xt_1 = nn.Conv1d(in_channels=embed_dim, out_channels=n_filters, kernel_size=8)
self.conv_xt_2 = nn.Conv1d(in_channels=n_filters, out_channels=2*n_filters, kernel_size=8)
self.conv_xt_3 = nn.Conv1d(in_channels=2*n_filters, out_channels=3*n_filters, kernel_size=8)
self.fc1_xt = nn.Linear(3*n_filters, output_dim)

# combined layers
self.fc1 = nn.Linear(256, 1024)
Expand All @@ -46,12 +48,16 @@ def forward(self, data):
# protein input feed-forward:
target = data.target
embedded_xt = self.embedding_xt(target)
conv_xt = self.conv_xt1(embedded_xt)
conv_xt = self.relu(conv_xt)
embedded_xt = torch.permute(embedded_xt, (0, 2, 1))

# flatten
xt = conv_xt.view(-1, 32 * 121)
xt = self.fc_xt1(xt)
conv_xt = self.conv_xt_1(embedded_xt)
conv_xt = self.relu(conv_xt)
conv_xt = self.conv_xt_2(conv_xt)
conv_xt = self.relu(conv_xt)
conv_xt = self.conv_xt_3(conv_xt)
conv_xt = self.relu(conv_xt)
xt = torch.max(conv_xt, dim = -1)[0]
xt = self.fc1_xt(xt)

# concat
xc = torch.cat((x, xt), 1)
Expand Down
16 changes: 12 additions & 4 deletions models/gat_gcn.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,10 @@ def __init__(self, n_output=1, num_features_xd=78, num_features_xt=25,

# 1D convolution on protein sequence
self.embedding_xt = nn.Embedding(num_features_xt + 1, embed_dim)
self.conv_xt_1 = nn.Conv1d(in_channels=1000, out_channels=n_filters, kernel_size=8)
self.fc1_xt = nn.Linear(32*121, output_dim)
self.conv_xt_1 = nn.Conv1d(in_channels=embed_dim, out_channels=n_filters, kernel_size=8)
self.conv_xt_2 = nn.Conv1d(in_channels=n_filters, out_channels=2*n_filters, kernel_size=8)
self.conv_xt_3 = nn.Conv1d(in_channels=2*n_filters, out_channels=3*n_filters, kernel_size=8)
self.fc1_xt = nn.Linear(3*n_filters, output_dim)

# combined layers
self.fc1 = nn.Linear(256, 1024)
Expand All @@ -46,9 +48,15 @@ def forward(self, data):
x = self.fc_g2(x)

embedded_xt = self.embedding_xt(target)
embedded_xt = torch.permute(embedded_xt, (0, 2, 1))

conv_xt = self.conv_xt_1(embedded_xt)
# flatten
xt = conv_xt.view(-1, 32 * 121)
conv_xt = self.relu(conv_xt)
conv_xt = self.conv_xt_2(conv_xt)
conv_xt = self.relu(conv_xt)
conv_xt = self.conv_xt_3(conv_xt)
conv_xt = self.relu(conv_xt)
xt = torch.max(conv_xt, dim = -1)[0]
xt = self.fc1_xt(xt)

# concat
Expand Down
16 changes: 12 additions & 4 deletions models/gcn.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,10 @@ def __init__(self, n_output=1, n_filters=32, embed_dim=128,num_features_xd=78, n

# protein sequence branch (1d conv)
self.embedding_xt = nn.Embedding(num_features_xt + 1, embed_dim)
self.conv_xt_1 = nn.Conv1d(in_channels=1000, out_channels=n_filters, kernel_size=8)
self.fc1_xt = nn.Linear(32*121, output_dim)
self.conv_xt_1 = nn.Conv1d(in_channels=embed_dim, out_channels=n_filters, kernel_size=8)
self.conv_xt_2 = nn.Conv1d(in_channels=n_filters, out_channels=2*n_filters, kernel_size=8)
self.conv_xt_3 = nn.Conv1d(in_channels=2*n_filters, out_channels=3*n_filters, kernel_size=8)
self.fc1_xt = nn.Linear(3*n_filters, output_dim)

# combined layers
self.fc1 = nn.Linear(2*output_dim, 1024)
Expand Down Expand Up @@ -54,9 +56,15 @@ def forward(self, data):

# 1d conv layers
embedded_xt = self.embedding_xt(target)
embedded_xt = torch.permute(embedded_xt, (0, 2, 1))

conv_xt = self.conv_xt_1(embedded_xt)
# flatten
xt = conv_xt.view(-1, 32 * 121)
conv_xt = self.relu(conv_xt)
conv_xt = self.conv_xt_2(conv_xt)
conv_xt = self.relu(conv_xt)
conv_xt = self.conv_xt_3(conv_xt)
conv_xt = self.relu(conv_xt)
xt = torch.max(conv_xt, dim = -1)[0]
xt = self.fc1_xt(xt)

# concat
Expand Down
16 changes: 12 additions & 4 deletions models/ginconv.py
Original file line number Diff line number Diff line change
Expand Up @@ -41,8 +41,10 @@ def __init__(self, n_output=1,num_features_xd=78, num_features_xt=25,

# 1D convolution on protein sequence
self.embedding_xt = nn.Embedding(num_features_xt + 1, embed_dim)
self.conv_xt_1 = nn.Conv1d(in_channels=1000, out_channels=n_filters, kernel_size=8)
self.fc1_xt = nn.Linear(32*121, output_dim)
self.conv_xt_1 = nn.Conv1d(in_channels=embed_dim, out_channels=n_filters, kernel_size=8)
self.conv_xt_2 = nn.Conv1d(in_channels=n_filters, out_channels=2*n_filters, kernel_size=8)
self.conv_xt_3 = nn.Conv1d(in_channels=2*n_filters, out_channels=3*n_filters, kernel_size=8)
self.fc1_xt = nn.Linear(3*n_filters, output_dim)

# combined layers
self.fc1 = nn.Linear(256, 1024)
Expand All @@ -68,9 +70,15 @@ def forward(self, data):
x = F.dropout(x, p=0.2, training=self.training)

embedded_xt = self.embedding_xt(target)
embedded_xt = torch.permute(embedded_xt, (0, 2, 1))

conv_xt = self.conv_xt_1(embedded_xt)
# flatten
xt = conv_xt.view(-1, 32 * 121)
conv_xt = self.relu(conv_xt)
conv_xt = self.conv_xt_2(conv_xt)
conv_xt = self.relu(conv_xt)
conv_xt = self.conv_xt_3(conv_xt)
conv_xt = self.relu(conv_xt)
xt = torch.max(conv_xt, dim = -1)[0]
xt = self.fc1_xt(xt)

# concat
Expand Down