Пример #1
0
    def setUpClass(cls):
        cls.ab_collection_1 = ChainCollection.load_from_file(path='./tests/Data/sequence_alignment_seq_1.json',
                                                             show_progressbar=False, verbose=False)
        cls.ab_collection_2 = ChainCollection.load_from_file(path='./tests/Data/sequence_alignment_seq_2.json',
                                                             show_progressbar=False, verbose=False)

        cls.seq2_aligned = read_sequence_from_file('./tests/Data/BLOSUM62_aligned_sequence')
Пример #2
0
 def test_FabCollection_json1(self):
     light_chain_collection = ChainCollection.load_from_file(
         path='./tests/Data/chain_collection_light_2_sequences.json')
     heavy_chain_collection = ChainCollection.load_from_file(
         path='./tests/Data/chain_collection_heavy_2_sequences.json')
     fab_collection = FabCollection(light_chains=light_chain_collection,
                                    heavy_chains=heavy_chain_collection,
                                    names=['Fab1', 'Fab2'])
     fab_collection.save(file_format='json', path='./tests/fab_1')
     self.assertTrue(os.path.isfile('./tests/fab_1.json'))
Пример #3
0
 def test_FabCollection_input4(self):
     light_chain_collection = ChainCollection.load_from_file(
         path='./tests/Data/chain_collection_light_2_sequences.json')
     heavy_chain_collection = ChainCollection.load_from_file(
         path='./tests/Data/chain_collection_heavy_2_sequences.json')
     fab_collection = FabCollection(light_chains=light_chain_collection,
                                    heavy_chains=heavy_chain_collection,
                                    names=['Fab1', 'Fab2'])
     self.assertEqual(
         fab_collection.numbering_table()['Light']['CDR3']
         ['L89'].loc['Fab1'], 'Q')
 def test_ChainCollection_append_1(self):
     antibody_collection_1 = ChainCollection.load_from_file(
         path='./tests/Data/chain_collection_1_heavy.json',
         show_progressbar=False,
         verbose=False)
     antibody_collection_2 = ChainCollection.load_from_file(
         path='./tests/Data/chain_collection_2_heavy.json',
         show_progressbar=False,
         verbose=False)
     antibody_collection_1.append(antibody_collection_2)
     self.assertEqual(antibody_collection_1.n_ab, 2)
Пример #5
0
 def test_FabCollection_json2(self):
     fab_collection = FabCollection.load_from_file(
         path='./tests/fab_1.json', show_progressbar=False, verbose=False)
     light_chain_collection = ChainCollection.load_from_file(
         path='./tests/Data/chain_collection_light_2_sequences.json')
     heavy_chain_collection = ChainCollection.load_from_file(
         path='./tests/Data/chain_collection_heavy_2_sequences.json')
     self.assertEqual(fab_collection._light_chains.sequences[0],
                      light_chain_collection.sequences[0])
     self.assertEqual(fab_collection._heavy_chains.sequences[0],
                      heavy_chain_collection.sequences[0])
Пример #6
0
    def setUpClass(cls):
        cls.light_chain_collection = ChainCollection.load_from_file(
            path='./tests/Data/chain_collection_1_light.json',
            verbose=False,
            show_progressbar=False)
        cls.heavy_chain_collection = ChainCollection.load_from_file(
            path='./tests/Data/chain_collection_1_heavy.json',
            verbose=False,
            show_progressbar=False)

        cls.heavy_chain = cls.heavy_chain_collection[0]
        cls.light_chain = cls.light_chain_collection[0]
 def test_ChainCollection_json(self):
     antibody_collection_1 = ChainCollection.load_from_file(
         path='./tests/Data/chain_collection_1_heavy.json',
         show_progressbar=False,
         verbose=False)
     antibody_collection_1.save(file_format='json', path='./tests/SaveTest')
     antibody_collection_2 = ChainCollection.load_from_file(
         path='./tests/SaveTest.json',
         show_progressbar=False,
         verbose=False)
     self.assertEqual(antibody_collection_1.sequences[0],
                      antibody_collection_2.sequences[0])
 def test_ChainCollection_append_2(self):
     antibody_collection_1 = ChainCollection.load_from_file(
         path='./tests/Data/chain_collection_1_heavy.json',
         show_progressbar=False,
         verbose=False)
     antibody_collection_2 = ChainCollection.load_from_file(
         path='./tests/Data/chain_collection_2_heavy.json',
         show_progressbar=False,
         verbose=False)
     antibody_collection_1.append(antibody_collection_2)
     self.assertEqual(antibody_collection_1.hydrophobicity_matrix().shape,
                      (2, 158))
 def test_ChainCollection_add(self):
     # check if adding two ChainCollection objects with one sequence each
     # results in a ChainCollection object with two sequences
     antibody_collection_1 = ChainCollection.load_from_file(
         path='./tests/Data/chain_collection_1_heavy.json',
         show_progressbar=False,
         verbose=False)
     antibody_collection_2 = ChainCollection.load_from_file(
         path='./tests/Data/chain_collection_2_heavy.json',
         show_progressbar=False,
         verbose=False)
     antibody_collection_3 = antibody_collection_1 + antibody_collection_2
     self.assertEqual(antibody_collection_3.n_ab, 2)
Пример #10
0
 def setUpClass(cls):
     cls.test_sequence = read_sequence(
         './tests/Data/chain_collection_fasta_test.fasta')
     cls.heavy_chain_collection_object = ChainCollection.load_from_file(
         path='./tests/Data/chain_collection_1_heavy.json',
         show_progressbar=False,
         verbose=False)
     cls.heavy_chain_object = cls.heavy_chain_collection_object[0]
     cls.light_chain_collection_object = ChainCollection.load_from_file(
         path='./tests/Data/chain_collection_1_light.json',
         show_progressbar=False,
         verbose=False)
     cls.light_chain_object = cls.light_chain_collection_object[0]
Пример #11
0
 def test_ChainCollection_add_exception_1(self):
     # check if adding two ChainCollection objects with one sequence each
     # results in a ChainCollection object with two sequences
     antibody_chothia = ChainCollection.load_from_file(
         path='./tests/Data/chain_collection_fasta_test.fasta',
         numbering_scheme='chothia',
         show_progressbar=False,
         verbose=False)
     antibody_kabat = ChainCollection.load_from_file(
         path='./tests/Data/chain_collection_fasta_test.fasta',
         numbering_scheme='kabat',
         show_progressbar=False,
         verbose=False)
     self.assertRaises(ValueError, operator.add, antibody_chothia,
                       antibody_kabat)
Пример #12
0
 def test_ChainCollection_get_object_2(self):
     # check if get_object returns a Chain object and keeps the information (i.e. name)
     antibody_collection_1 = ChainCollection.load_from_file(
         path='./tests/Data/chain_collection_1_heavy.json',
         show_progressbar=False,
         verbose=False)
     self.assertEqual(antibody_collection_1.get_object('test').name, 'test')
Пример #13
0
 def test_ChainCollection_charge(self):
     antibody_collection_1 = ChainCollection.load_from_file(
         path='./tests/Data/chain_collection_1_heavy.json',
         show_progressbar=False,
         verbose=False)
     self.assertAlmostEqual(antibody_collection_1.charge.sum(),
                            1.7497642167513607)
Пример #14
0
 def test_ChainCollection_slicing_1_obj(self):
     antibody_collection_1 = ChainCollection.load_from_file(
         path='./tests/Data/chain_collection_1_heavy.json',
         show_progressbar=False,
         verbose=False)
     # if returning a single chain abpytools automatically creates a new Chain object
     self.assertIsInstance(antibody_collection_1[0], Chain)
Пример #15
0
 def test_ChainCollection_slicing_2_obj(self):
     antibody_collection_1 = ChainCollection.load_from_file(
         path='./tests/Data/chain_collection_heavy_2_sequences.json',
         show_progressbar=False,
         verbose=False)
     # slicing multiple sequences returns a ChainCollection object
     self.assertIsInstance(antibody_collection_1[[0, 1]], ChainCollection)
Пример #16
0
 def test_ChainCollection_cdr_regions_part1(self):
     antibody_collection_1 = ChainCollection.load_from_file(
         path='./tests/Data/chain_collection_1_heavy.json',
         show_progressbar=False,
         verbose=False)
     self.assertCountEqual(antibody_collection_1.ab_region_index().keys(),
                           [self.antibody_collection_1_name])
Пример #17
0
 def test_Chain_abysis_parser_kabat(self):
     antibody = ChainCollection.load_from_file(
         path='./tests/Data/chain_collection_fasta_test.fasta',
         numbering_scheme='kabat',
         verbose=False,
         show_progressbar=False)
     self.assertEqual(antibody.numbering_table(as_array=True)[0][-1], '-')
Пример #18
0
 def test_Chain_abysis_parser(self):
     antibody = ChainCollection.load_from_file(
         path='./tests/Data/chain_collection_fasta_test.fasta',
         numbering_scheme='chothia',
         verbose=False,
         show_progressbar=False)
     self.assertEqual(antibody.chain, 'heavy')
Пример #19
0
 def test_ChainCollection_get_object_1(self):
     # check if get_object returns a Chain object
     antibody_collection_1 = ChainCollection.load_from_file(
         path='./tests/Data/chain_collection_1_heavy.json',
         show_progressbar=False,
         verbose=False)
     self.assertIsInstance(antibody_collection_1.get_object('test'), Chain)
Пример #20
0
 def test_Chain_set_name(self):
     heavy_chain_object = ChainCollection.load_from_file(
         path='./tests/Data/chain_collection_1_heavy.json',
         show_progressbar=False,
         verbose=False)
     heavy_chain_object[0].set_name("new_name")
     self.assertEqual(heavy_chain_object[0].name, "new_name")
Пример #21
0
 def test_ChainCollection_numbering_scheme_kabat(self):
     antibody_collection_1 = ChainCollection.load_from_file(
         path='./tests/Data/chain_collection_1_heavy.json',
         show_progressbar=False,
         verbose=False)
     antibody_collection_1.set_numbering_scheme('kabat', realign=False)
     self.assertEqual(antibody_collection_1.numbering_scheme, 'kabat')
Пример #22
0
 def test_ChainCollection_total_charge(self):
     antibody_collection_1 = ChainCollection.load_from_file(
         path='./tests/Data/chain_collection_1_heavy.json',
         show_progressbar=False,
         verbose=False)
     self.assertAlmostEqual(
         antibody_collection_1.total_charge[
             self.antibody_collection_1_name], 1.3278508)
Пример #23
0
 def test_ChainCollection_numbering_tableDataFrame(self):
     antibody_collection_1 = ChainCollection.load_from_file(
         path='./tests/Data/chain_collection_1_heavy.json',
         show_progressbar=False,
         verbose=False)
     self.assertEqual(
         antibody_collection_1.numbering_table(
             as_array=False)['CDR1']['H32'].values[0], 'Y')
Пример #24
0
 def test_ChainCollection_numbering_table_shape_pd(self):
     antibody_collection_1 = ChainCollection.load_from_file(
         path='./tests/Data/chain_collection_1_heavy.json',
         show_progressbar=False,
         verbose=False)
     self.assertEqual(
         antibody_collection_1.numbering_table(as_array=False).shape,
         (1, 158))
Пример #25
0
 def test_ChainCollection_numbering_table_region_np(self):
     antibody_collection_1 = ChainCollection.load_from_file(
         path='./tests/Data/chain_collection_1_heavy.json',
         show_progressbar=False,
         verbose=False)
     self.assertEqual(
         antibody_collection_1.numbering_table(as_array=True,
                                               region='CDR1')[0][-1], 'Y')
Пример #26
0
 def test_ChainCollection_numbering_table_fr_region(self):
     antibody_collection_1 = ChainCollection.load_from_file(
         path='./tests/Data/chain_collection_1_heavy.json',
         show_progressbar=False,
         verbose=False)
     self.assertEqual(
         antibody_collection_1.numbering_table(
             region='FR1').loc['test'].values[0], 'Q')
Пример #27
0
 def test_ChainCollection_proto_io_1(self):
     antibody_collection_1 = ChainCollection.load_from_file(
         path='./tests/Data/chain_collection_1_heavy.json',
         show_progressbar=False,
         verbose=False)
     antibody_collection_1.save(file_format='pb2',
                                path='./tests/chain_collection_1_heavy')
     self.assertTrue(os.path.isfile('./tests/chain_collection_1_heavy.pb2'))
Пример #28
0
 def test_ChainCollection_molecular_weight_monoisotopic(self):
     antibody_collection_1 = ChainCollection.load_from_file(
         path='./tests/Data/chain_collection_1_heavy.json',
         show_progressbar=False,
         verbose=False)
     self.assertAlmostEqual(
         antibody_collection_1.molecular_weights(monoisotopic=True)[0],
         20042.1121)
Пример #29
0
 def test_ChainCollection_ec_reduced(self):
     antibody_collection_1 = ChainCollection.load_from_file(
         path='./tests/Data/chain_collection_1_heavy.json',
         show_progressbar=False,
         verbose=False)
     self.assertAlmostEqual(
         antibody_collection_1.extinction_coefficients(reduced=True)[0],
         52160.0)
Пример #30
0
 def test_ChainCollection_Hmatrix_shape(self):
     antibody_collection_1 = ChainCollection.load_from_file(
         path='./tests/Data/chain_collection_1_heavy.json',
         show_progressbar=False,
         verbose=False)
     # if this fails it means that abysis has been updated
     self.assertEqual(antibody_collection_1.hydrophobicity_matrix().shape,
                      (1, 158))