Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Question about the RES task #1

Open
YanjingLiLi opened this issue Jul 19, 2023 · 1 comment
Open

Question about the RES task #1

YanjingLiLi opened this issue Jul 19, 2023 · 1 comment

Comments

@YanjingLiLi
Copy link

Hi, I have a question about the RES task. For each example, the subunit indices contain atoms and residues from different chains of the protein. Do you just treat them as a complete protein chain to predict the type of residue at the masked place?

@Oxer11
Copy link
Collaborator

Oxer11 commented Aug 1, 2023

Yes. The RES task is defined as predicting masked residue types based on local structural enviroments. So we save the subunit indices for each sample in each protein and use it to extract the corresponding part for each sample.

def get_item(self, index):
subunit, protein_index = self.data[index]
protein = self.protein[protein_index]
protein = protein.subgraph(subunit.node_index)
residue_mask = torch.zeros((protein.num_residue,), dtype=torch.bool)
residue_mask[protein.atom2residue] = 1
protein = protein.subresidue(residue_mask)
node_mask = (protein.residue_number[protein.atom2residue] == subunit.residue_num) & \
(protein.atom_name == data.Protein.atom_name2id["CA"])
with protein.node():
protein.ca_mask = node_mask
with protein.graph():
protein.label = torch.as_tensor(subunit.label)
if hasattr(protein, "residue_feature"):
with protein.residue():
protein.residue_feature = protein.residue_feature.to_dense()
protein.residue_feature[protein.residue_number == subunit.residue_num, :] = 0
protein.residue_type[protein.residue_number == subunit.residue_num] = 0
if not hasattr(protein, "atom_feature"):
with protein.atom():
protein.atom_feature = torch.zeros((protein.num_atom, 1))
item = {"graph": protein}
if self.transform:
item = self.transform(item)
return item

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants