Esempio n. 1
0
 def test_find_fragment(self):
     """Should return a ModernaFragment instance with the right sequence"""
     lf = FragmentFinder(self.struc['2'], self.struc['6'], Sequence('AGCU'),
                         self.struc, 10)
     frag = lf.find_fragment()
     frag.fix_backbone()
     self.assertTrue(isinstance(frag, ModernaFragment))
     self.assertEqual(
         frag.struc.get_sequence().seq_with_modifications[1:-1], 'AGCU')
Esempio n. 2
0
 def test_find_secstruc(self):
     """Secstruc can be used as an optional search criterion"""
     hairpin = ModernaStructure('file', RNA_HAIRPIN, 'D')
     lf = FragmentFinder(hairpin['30'],
                         hairpin['40'],
                         Sequence('CGGGCG'),
                         self.struc,
                         10,
                         secstruc="(....)")
     frag = lf.find_fragment()
     self.assertEqual(frag.struc.get_secstruc(), "((....))")
Esempio n. 3
0
    def insert_best_fragment(self,
                             start,
                             stop,
                             sequence,
                             candidates_number=NUMBER_OF_FRAGMENT_CANDIDATES):
        """
        Makes a LIR search to fill a gap at a given position.
        looks for possible candidates, checks the first ~20 for clashes,
        takes the best, removes anchor residue and inserts it in the model.        

        Arguments:
        - start position as a string (residue identifier)e.g. '3' - this is an identifier of the preceding anchor residue
        - stop position as above - this is an identifier of the fallowing anchor residue
        - fragment sequence as a Sequence object
        - number of fragment candidates.
        """
        log.write_message(
            '\nSearching fragment between residue %s and residue %s.' %
            (str(start), str(stop)))
        fragment_finder = FragmentFinder(self[start], self[stop], sequence,
                                         self, candidates_number)
        best_fragment = fragment_finder.find_fragment()
        log.write_message('\nBest fragment:\n%s' % str(best_fragment))
        self.insert_fragment(best_fragment)
Esempio n. 4
0
 def test_find_zero_length_fragment(self):
     lf = FragmentFinder(self.struc['2'], self.struc['4'], Sequence(''),
                         self.struc, 10)
     frag = lf.find_fragment()
     self.assertEqual(frag.struc.get_sequence(), Sequence('C_G'))