Example #1
0
def test_chem_illegal_character():
    smiles = "O=C(c1ccc(F)cc1)C1CCN(CCC2Cc3cc(F)ccc3C2=O)CC1*"
    target = "MEILCEDNISLSSIPNSLM*QLGDGPRL"
    drug_encoding = integer_label_smiles(smiles)
    target_encoding = integer_label_protein(target)
    assert drug_encoding.size == 85
    assert target_encoding.size == 1200
Example #2
0
 def __getitem__(self, idx):
     drug, protein, label = self.data["Drug"][idx], self.data["Target"][
         idx], self.data["Y"][idx]
     mode_drug, mode_protein = self.mode.split("_")
     if mode_drug == "cnn":
         drug = torch.LongTensor(integer_label_smiles(drug))
     if mode_protein == "cnn":
         protein = torch.LongTensor(integer_label_protein(protein))
     label = torch.Tensor([label])
     if self.drug_transform is not None:
         self.drug_transform(drug)
     if self.protein_transform is not None:
         self.protein_transform(protein)
     return drug, protein, label
Example #3
0
def test_chem_wrong_smiles():
    wrong_smiles = "NS(=O)(=O)*c1cc2C"
    assert len(integer_label_smiles(wrong_smiles))