示例#1
0
    def test_adjust_sff_cycles(self):
        sff_data = parse_binary_sff(open(self.sff_fp))
        sff_gz_data = parse_binary_sff(qiime_open(self.sff_gz_fp))
        header, reads = adjust_sff_cycles(sff_data, 2)
        header_gz, reads_gz = adjust_sff_cycles(sff_gz_data, 2)
        expected_header = {
            'header_length': 48,
            'version': 1,
            'index_length': 0,
            'magic_number': 779314790,
            'number_of_flows_per_read': 8,
            'flowgram_format_code': 1,
            'flow_chars': 'TACGTACG',
            'index_offset': 0,
            'key_sequence': 'TCAG',
            'number_of_reads': 1,
            'key_length': 4,
        }
        self.assertEqual(header, expected_header)
        self.assertEqual(header_gz, expected_header)

        expected_read = {
            'name_length':
            14,
            'Name':
            'FA6P1OK01CGMHQ',
            'flowgram_values':
            [1.04, 0.0, 1.01, 0.0, 0.0, 0.95999999999999996, 0.0, 1.02],
            'clip_adapter_left':
            0,
            'read_header_length':
            32,
            'Bases':
            'TCAG',
            'number_of_bases':
            4,
            'flow_index_per_base': (1, 2, 3, 2),
            'clip_qual_left':
            4,
            'clip_adapter_right':
            0,
            'clip_qual_right':
            4,
            'quality_scores': (32, 32, 32, 32),
        }
        reads = list(reads)
        reads_gz = list(reads_gz)
        self.assertEqual(len(reads), 1)
        self.assertEqual(len(reads_gz), 1)
        self.assertEqual(reads[0], expected_read)
        self.assertEqual(reads_gz[0], expected_read)
    def test_adjust_sff_cycles(self):
        sff_data = parse_binary_sff(open(self.sff_fp))
        header, reads = adjust_sff_cycles(sff_data, 2)
        expected_header = {
            'header_length': 48,
            'version': 1,
            'index_length': 0,
            'magic_number': 779314790,
            'number_of_flows_per_read': 8,
            'flowgram_format_code': 1,
            'flow_chars': 'TACGTACG',
            'index_offset': 0,
            'key_sequence': 'TCAG',
            'number_of_reads': 1,
            'key_length': 4,
            }
        self.assertEqual(header, expected_header)

        expected_read = {
            'name_length': 14,
            'Name': 'FA6P1OK01CGMHQ',
            'flowgram_values': [1.04, 0.0, 1.01, 0.0, 0.0, 0.95999999999999996, 0.0, 1.02],
            'clip_adapter_left': 0,
            'read_header_length': 32,
            'Bases': 'TCAG',
            'number_of_bases': 4,
            'flow_index_per_base': (1, 2, 3, 2),
            'clip_qual_left': 4,
            'clip_adapter_right': 0,
            'clip_qual_right': 4,
            'quality_scores': (32, 32, 32, 32),
            }
        reads = list(reads)
        self.assertEqual(len(reads), 1)
        self.assertEqual(reads[0], expected_read)