示例#1
0
 def test_get_pandas_df(self):
     """
     get_pandas_dfのテスト
     """
     vec = KCFvec()
     vec.input_molfile(PATH)
     vec.convert_kcf_vec()
     df = vec.get_pandas_df()
     self.assertIsInstance(df, pd.DataFrame)
示例#2
0
 def test_convert_kcf_vec(self):
     """
     convert_kcf_vecのテスト
     """
     vec = KCFvec()
     vec.input_molfile(PATH)
     vec.convert_kcf_vec()
     actual = vec.kcf_vec
     self.assertIsInstance(actual, defaultdict)
示例#3
0
 def test_input_smiles(self):
     """
     input_smilesのテスト
     この場合KEGG_ATOM_LABELと順番が違うので空のdict()でないことのみ確認している
     """
     la = {
         0: {
             'atom_species': 'O',
             'atom_class': 'O4',
             'kegg_atom': 'O4a'
         },
         1: {
             'atom_species': 'C',
             'atom_class': 'C4',
             'kegg_atom': 'C4a'
         },
         2: {
             'atom_species': 'C',
             'atom_class': 'C8',
             'kegg_atom': 'C8y'
         },
         3: {
             'atom_species': 'C',
             'atom_class': 'C8',
             'kegg_atom': 'C8x'
         },
         4: {
             'atom_species': 'C',
             'atom_class': 'C8',
             'kegg_atom': 'C8x'
         },
         5: {
             'atom_species': 'C',
             'atom_class': 'C8',
             'kegg_atom': 'C8y'
         },
         6: {
             'atom_species': 'O',
             'atom_class': 'O1',
             'kegg_atom': 'O1a'
         },
         7: {
             'atom_species': 'C',
             'atom_class': 'C8',
             'kegg_atom': 'C8x'
         },
         8: {
             'atom_species': 'C',
             'atom_class': 'C8',
             'kegg_atom': 'C8x'
         }
     }
     smiles = 'O=Cc1ccc(O)cc1'
     vec = KCFvec()
     vec.input_smiles(smiles)
     actual = vec.kegg_atom_label
     self.assertEqual(actual, la)
示例#4
0
 def test_input_molfile(self):
     """
     input_from_molfileのテスト
     """
     expected = KEGG_ATOM_LABEL
     vec = KCFvec()
     vec.input_molfile(PATH)
     actual = vec.kegg_atom_label
     self.assertEqual(actual, expected)
示例#5
0
 def test_input_from_knapsack(self):
     """
     input_from_knapsackのテスト
     """
     la = {
         0: {
             'atom_species': 'C',
             'atom_class': 'C8',
             'kegg_atom': 'C8x'
         },
         1: {
             'atom_species': 'C',
             'atom_class': 'C8',
             'kegg_atom': 'C8x'
         },
         2: {
             'atom_species': 'C',
             'atom_class': 'C8',
             'kegg_atom': 'C8y'
         },
         3: {
             'atom_species': 'C',
             'atom_class': 'C8',
             'kegg_atom': 'C8x'
         },
         4: {
             'atom_species': 'C',
             'atom_class': 'C8',
             'kegg_atom': 'C8x'
         },
         5: {
             'atom_species': 'C',
             'atom_class': 'C8',
             'kegg_atom': 'C8y'
         },
         6: {
             'atom_species': 'C',
             'atom_class': 'C4',
             'kegg_atom': 'C4a'
         },
         7: {
             'atom_species': 'O',
             'atom_class': 'O1',
             'kegg_atom': 'O1a'
         },
         8: {
             'atom_species': 'O',
             'atom_class': 'O4',
             'kegg_atom': 'O4a'
         }
     }
     cid = "C00002657"
     vec = KCFvec()
     vec.input_from_knapsack(cid)
     actual = vec.kegg_atom_label
     self.assertEqual(actual, la)
示例#6
0
 def test_input_inchi(self):
     """
     input_from_molfileのテスト
     """
     la = {
         0: {
             'atom_species': 'C',
             'atom_class': 'C8',
             'kegg_atom': 'C8x'
         },
         1: {
             'atom_species': 'C',
             'atom_class': 'C8',
             'kegg_atom': 'C8x'
         },
         2: {
             'atom_species': 'C',
             'atom_class': 'C8',
             'kegg_atom': 'C8x'
         },
         3: {
             'atom_species': 'C',
             'atom_class': 'C8',
             'kegg_atom': 'C8x'
         },
         4: {
             'atom_species': 'C',
             'atom_class': 'C4',
             'kegg_atom': 'C4a'
         },
         5: {
             'atom_species': 'C',
             'atom_class': 'C8',
             'kegg_atom': 'C8y'
         },
         6: {
             'atom_species': 'C',
             'atom_class': 'C8',
             'kegg_atom': 'C8y'
         },
         7: {
             'atom_species': 'O',
             'atom_class': 'O4',
             'kegg_atom': 'O4a'
         },
         8: {
             'atom_species': 'O',
             'atom_class': 'O1',
             'kegg_atom': 'O1a'
         }
     }
     inchi = "InChI=1S/C7H6O2/c8-5-6-1-3-7(9)4-2-6/h1-5,9H"
     vec = KCFvec()
     vec.input_inchi(inchi)
     actual = vec.kegg_atom_label
     self.assertEqual(actual, la)
示例#7
0
 def test_input_from_kegg(self):
     """
     input_from_keggのテスト
     """
     cid = "C00633"
     expected = KEGG_ATOM_LABEL
     vec = KCFvec()
     vec.input_from_kegg(cid)
     actual = vec.kegg_atom_label
     self.assertEqual(actual, expected)
示例#8
0
 def test_string2seq(self):
     """
     string2seqのテスト
     """
     expected = []
     vec = KCFvec()
     vec.input_molfile(PATH)
     vec.convert_kcf_vec()
     actual = vec.string2seq
     self.assertNotEqual(actual, expected)
示例#9
0
 def test_input_rdkmol(self):
     """
     input_rdkmolのテスト
     """
     rdkmol = Chem.MolFromMolBlock(MOLBLOCK)
     expected = KEGG_ATOM_LABEL
     vec = KCFvec()
     vec.input_rdkmol(rdkmol)
     actual = vec.kegg_atom_label
     self.assertEqual(actual, expected)
示例#10
0
 def test_similarity(self):
     """
     similarityのテスト
     """
     rdkmol = Chem.MolFromMolBlock(MOLBLOCK)
     expected = (1.0, 1.0, 1.0)
     vec = KCFvec()
     vec.input_rdkmol(rdkmol)
     vec.convert_kcf_vec()
     actual = similarity(vec, vec)
     self.assertEqual(actual, expected)