def test_map_index_name(self): """Map index sequences to names """ # Some test cases from scilifelab.illumina.index_definitions import BASIC_LOOKUP random_keys = [BASIC_LOOKUP.keys()[random.randint(0,len(BASIC_LOOKUP.keys())-1)] for n in xrange(25)] for name in random_keys: self.assertIn(name,map_index_name(BASIC_LOOKUP[name],0), "Exact mapping did not return expected index name")
def test_map_index_name(self): """Map index sequences to names """ # Some test cases from scilifelab.illumina.index_definitions import BASIC_LOOKUP random_keys = [ BASIC_LOOKUP.keys()[random.randint(0, len(BASIC_LOOKUP.keys()) - 1)] for n in xrange(25) ] for name in random_keys: self.assertIn(name, map_index_name(BASIC_LOOKUP[name], 0), "Exact mapping did not return expected index name")
def map_index_name(index, mismatch=0): """Map the index sequences to the known names, if possible. Requires the samplesheet module. """ names = [] for name, sequence in BASIC_LOOKUP.items(): try: if index != sequence and hamming_distance(index, sequence) > mismatch: continue names.append(name) except: pass return names