示例#1
0
文件: test_core.py 项目: okulev/seal
    def test_bwa_init_sequences_no_trim(self):
        row_type = (ct.c_char_p * 3)
        pointers = (row_type * len(self.toy_data))()
        q_offset = bwa.Q_OFFSET["fastq-illumina"]
        for i, row in enumerate(self.toy_data):
            for j in xrange(3):
                pointers[i][j] = row[j]
        array = bwa.init_sequences(ct.cast(pointers, bwa.p_char_p),
                                   len(self.toy_data), q_offset, 0)

        resulting_qoffset = q_offset - bwa.Q_OFFSET["fastq-sanger"]
        for i, row in enumerate(self.toy_data):
            self.assertEqual(-1, array[i].tid)
            self.assertEqual(len(row[1]), array[i].len)
            self.assertEqual(len(row[1]), array[i].full_len)
            self.assertEqual(len(row[1]), array[i].clip_len)
            self.assertEqual(row[0], array[i].get_name())
            self.assertEqual(row[1][::-1], array[i].get_seq())
            self.assertEqual(
                row[2], ''.join([
                    chr(array[i].qual[k] + resulting_qoffset)
                    for k in xrange(array[i].full_len)
                ]))

        bwa.free_seq(len(self.toy_data), array)
示例#2
0
	def test_init_sequences_with_trimming(self):
		data = []
		data.append(("seq1", "NNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNN",
				"####################################################################################################"))
		row_type = (ct.c_char_p * 3)
		pointers = (row_type*len(data))()
		q_offset = bwa.Q_OFFSET["fastq-sanger"]
		for i, row in enumerate(data):
			for j in xrange(3):
				pointers[i][j] = row[j]
		array = bwa.init_sequences( ct.cast(pointers, bwa.p_char_p), len(data), q_offset, 15)
		self.assertEqual(35, array[0].clip_len)
		bwa.free_seq(len(data), array)
示例#3
0
文件: test_core.py 项目: okulev/seal
 def test_init_sequences_with_trimming(self):
     data = []
     data.append((
         "seq1",
         "NNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNN",
         "####################################################################################################"
     ))
     row_type = (ct.c_char_p * 3)
     pointers = (row_type * len(data))()
     q_offset = bwa.Q_OFFSET["fastq-sanger"]
     for i, row in enumerate(data):
         for j in xrange(3):
             pointers[i][j] = row[j]
     array = bwa.init_sequences(ct.cast(pointers, bwa.p_char_p), len(data),
                                q_offset, 15)
     self.assertEqual(35, array[0].clip_len)
     bwa.free_seq(len(data), array)
示例#4
0
	def test_bwa_init_sequences_no_trim(self):
		row_type = (ct.c_char_p * 3)
		pointers = (row_type*len(self.toy_data))()
		q_offset = bwa.Q_OFFSET["fastq-illumina"]
		for i, row in enumerate(self.toy_data):
			for j in xrange(3):
				pointers[i][j] = row[j]
		array = bwa.init_sequences( ct.cast(pointers, bwa.p_char_p), len(self.toy_data), q_offset, 0)

		resulting_qoffset = q_offset - bwa.Q_OFFSET["fastq-sanger"]
		for i, row in enumerate(self.toy_data):
			self.assertEqual(-1, array[i].tid)
			self.assertEqual(len(row[1]), array[i].len)
			self.assertEqual(len(row[1]), array[i].full_len)
			self.assertEqual(len(row[1]), array[i].clip_len)
			self.assertEqual(row[0], array[i].get_name())
			self.assertEqual(row[1][::-1], array[i].get_seq())
			self.assertEqual(row[2], ''.join( [chr(array[i].qual[k]+resulting_qoffset) for k in xrange(array[i].full_len)] ))

		bwa.free_seq(len(self.toy_data), array)