Beispiel #1
0
    def test_get_primers(self):
        """ Get primer regular expression generators out of mapping data """

        # Raise error if ReversePrimer not supplied
        header = [
            'SampleID', 'BarcodeSequence', 'LinkerPrimerSequence',
            'Description'
        ]
        mapping_data = [['s1', 'ATCG', 'TTGGCC,TTGGWC', 'ATRCCTA']]
        self.assertRaises(IndexError, get_primers, header, mapping_data)

        header = [
            'SampleID', 'BarcodeSequence', 'LinkerPrimerSequence',
            'ReversePrimer', 'Description'
        ]
        forward_primers, reverse_primers = get_primers(header, mapping_data)

        forward_primers = set([seq.pattern for seq in forward_primers])
        reverse_primers = set([seq.pattern for seq in reverse_primers])

        expected_forward_primers = set(['TTGGCC', 'TAGG[CT]AT', 'TTGG[AT]C'])
        expected_reverse_primers = set(['GGCCAA', 'AT[AG]CCTA', 'G[AT]CCAA'])

        self.assertEqual(forward_primers, expected_forward_primers)
        self.assertEqual(reverse_primers, expected_reverse_primers)
    def test_get_primers(self):
        """ Get primer regular expression generators out of mapping data """

        # Raise error if ReversePrimer not supplied
        header = ['SampleID', 'BarcodeSequence', 'LinkerPrimerSequence',
                  'Description']
        mapping_data = [['s1', 'ATCG', 'TTGGCC,TTGGWC', 'ATRCCTA']]
        self.assertRaises(IndexError, get_primers, header, mapping_data)

        header = ['SampleID', 'BarcodeSequence', 'LinkerPrimerSequence',
                  'ReversePrimer', 'Description']
        forward_primers, reverse_primers = get_primers(header, mapping_data)

        forward_primers = set([seq.pattern for seq in forward_primers])
        reverse_primers = set([seq.pattern for seq in reverse_primers])

        expected_forward_primers = set(['TTGGCC', 'TAGG[CT]AT', 'TTGG[AT]C'])
        expected_reverse_primers = set(['GGCCAA', 'AT[AG]CCTA', 'G[AT]CCAA'])

        self.assertEqual(forward_primers, expected_forward_primers)
        self.assertEqual(reverse_primers, expected_reverse_primers)