def testUpdate(self): '''check if updating fields affects other variable length data ''' a = self.buildRead() b = self.buildRead() # check qname b.query_name = "read_123" checkFieldEqual(self, a, b, "query_name") b.query_name = "read_12345678" checkFieldEqual(self, a, b, "query_name") b.query_name = "read_12345" checkFieldEqual(self, a, b) # check cigar b.cigartuples = ((0, 10), ) checkFieldEqual(self, a, b, "cigartuples") b.cigartuples = ((0, 10), (2, 1), (0, 10)) checkFieldEqual(self, a, b, "cigartuples") b.cigartuples = ((0, 10), (2, 1), (0, 9), (1, 1), (0, 20)) checkFieldEqual(self, a, b) # check seq b.query_sequence = "ACGT" checkFieldEqual(self, a, b, ("query_sequence", "query_qualities", "query_length")) b.query_sequence = "ACGT" * 3 checkFieldEqual(self, a, b, ("query_sequence", "query_qualities", "query_length")) b.query_sequence = "ACGT" * 10 checkFieldEqual(self, a, b, ("query_qualities",)) # reset qual b = self.buildRead() # check flags: for x in ( "is_paired", "is_proper_pair", "is_unmapped", "mate_is_unmapped", "is_reverse", "mate_is_reverse", "is_read1", "is_read2", "is_secondary", "is_qcfail", "is_duplicate", "is_supplementary"): setattr(b, x, True) self.assertEqual(getattr(b, x), True) checkFieldEqual(self, a, b, ("flag", x,)) setattr(b, x, False) self.assertEqual(getattr(b, x), False) checkFieldEqual(self, a, b)
def testUpdate(self): '''check if updating fields affects other variable length data ''' a = self.buildRead() b = self.buildRead() # check qname b.query_name = "read_123" checkFieldEqual(self, a, b, "query_name") b.query_name = "read_12345678" checkFieldEqual(self, a, b, "query_name") b.query_name = "read_12345" checkFieldEqual(self, a, b) # check cigar b.cigartuples = ((0, 10), ) checkFieldEqual(self, a, b, "cigartuples") b.cigartuples = ((0, 10), (2, 1), (0, 10)) checkFieldEqual(self, a, b, "cigartuples") b.cigartuples = ((0, 10), (2, 1), (0, 9), (1, 1), (0, 20)) checkFieldEqual(self, a, b) # check seq b.query_sequence = "ACGT" checkFieldEqual(self, a, b, ("query_sequence", "query_qualities", "query_length")) b.query_sequence = "ACGT" * 3 checkFieldEqual(self, a, b, ("query_sequence", "query_qualities", "query_length")) b.query_sequence = "ACGT" * 10 checkFieldEqual(self, a, b, ("query_qualities", )) # reset qual b = self.buildRead() # check flags: for x in ("is_paired", "is_proper_pair", "is_unmapped", "mate_is_unmapped", "is_reverse", "mate_is_reverse", "is_read1", "is_read2", "is_secondary", "is_qcfail", "is_duplicate", "is_supplementary"): setattr(b, x, True) self.assertEqual(getattr(b, x), True) checkFieldEqual(self, a, b, ( "flag", x, )) setattr(b, x, False) self.assertEqual(getattr(b, x), False) checkFieldEqual(self, a, b)