Exemplo n.º 1
0
 def test_cleave(self):
     self.assertEqual(parser._cleave('PEPTIDEKS', parser.expasy_rules['trypsin']), ['PEPTIDEK', 'S'])
     self.assertEqual(parser._cleave('PEPTIDEKS', 'trypsin'), ['PEPTIDEK', 'S'])
     for seq in self.simple_sequences:
         for elem in parser.cleave(
                 seq, 'trypsin', int(random.uniform(1, 10))):
             self.assertIn(elem, seq)
         self.assertTrue(any(elem == seq
             for elem in parser.cleave(seq, parser.expasy_rules['trypsin'], len(seq))))
Exemplo n.º 2
0
def smart_reverse(prot_seq):
    '''
    Produces a reverse decoy sequence keeping all K and R aminoacids in the same positions.
    '''
    return ''.join(
        fasta.decoy_sequence(pep, mode='reverse', keep_cterm=True)
        for pep in parser._cleave(prot_seq, '[RK]', 0))
Exemplo n.º 3
0
 def test_cleave_semi(self):
     self.assertEqual(
         parser._cleave('PEPTIDEKS',
                        parser.expasy_rules['trypsin'],
                        semi=True),
         [
             'PEPTIDEK', 'P', 'PE', 'PEP', 'PEPT', 'PEPTI', 'PEPTID',
             'EPTIDEK', 'PTIDEK', 'TIDEK', 'IDEK', 'DEK', 'EK', 'K', 'S'
         ])
     self.assertEqual(
         parser.cleave('PEPTIDEKS',
                       parser.expasy_rules['trypsin'],
                       semi=True),
         {
             'PEPTIDEK', 'P', 'PE', 'PEP', 'PEPT', 'PEPTI', 'PEPTID',
             'EPTIDEK', 'PTIDEK', 'TIDEK', 'IDEK', 'DEK', 'EK', 'K', 'S'
         })