def test_smooth(self): # See test_kdistlib.test_ProfileDistance_dynamic_smooth counts_left = Counter([ 'AC', 'AG', 'AT', 'CA', 'CC', 'CG', 'CT', 'GA', 'GC', 'GG', 'GT', 'TA', 'TG', 'TT' ]) counts_right = Counter([ 'AC', 'AT', 'CA', 'CC', 'CG', 'CT', 'GA', 'GC', 'GG', 'GT', 'TA', 'TC', 'TG', 'TT' ]) filename_left = self.empty() filename_right = self.empty() with utils.open_profile(self.profile(counts_left, 2)) as handle_left: with utils.open_profile(self.profile(counts_right, 2)) as handle_right: with utils.open_profile(filename_left, 'w') as out_left: with utils.open_profile(filename_right, 'w') as out_right: kmer.smooth(handle_left, handle_right, out_left, out_right, summary='min') counts_left = Counter([ 'AA', 'AA', 'AA', 'CA', 'CC', 'CG', 'CT', 'GA', 'GC', 'GG', 'GT', 'TA', 'TA', 'TA' ]) counts_right = Counter([ 'AA', 'AA', 'CA', 'CC', 'CG', 'CT', 'GA', 'GC', 'GG', 'GT', 'TA', 'TA', 'TA', 'TA' ]) utils.test_profile_file(filename_left, counts_left, 2) utils.test_profile_file(filename_right, counts_right, 2)
def test_smooth_custom_name(self): # See test_kdistlib.test_ProfileDistance_dynamic_smooth counts_left = Counter(['AC', 'AG', 'AT', 'CA', 'CC', 'CG', 'CT', 'GA', 'GC', 'GG', 'GT', 'TA', 'TG', 'TT']) counts_right = Counter(['AC', 'AT', 'CA', 'CC', 'CG', 'CT', 'GA', 'GC', 'GG', 'GT', 'TA', 'TC', 'TG', 'TT']) filename_left = self.empty() filename_right = self.empty() with utils.open_profile(self.profile(counts_left, 2)) as handle_left: with utils.open_profile(self.profile(counts_right, 2)) as handle_right: with utils.open_profile(filename_left, 'w') as out_left: with utils.open_profile(filename_right, 'w') as out_right: kmer.smooth(handle_left, handle_right, out_left, out_right, custom_summary='numpy.max')