Skip to content

Commit

Permalink
Make sure dual index hit is exact
Browse files Browse the repository at this point in the history
  • Loading branch information
Johan Dahlberg committed Dec 18, 2018
1 parent 0a49112 commit f741a80
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions checkQC/handlers/unidentified_index_handler.py
Original file line number Diff line number Diff line change
Expand Up @@ -148,7 +148,7 @@ def check_swapped_dual_index(tag, lane, samplesheet_searcher, **kwargs):
if '+' in tag:
split_tag = tag.split('+')
swapped_tag = '{}+{}'.format(split_tag[1], split_tag[0])
hits = samplesheet_searcher.one_index_match_in_samplesheet(swapped_tag)
hits = samplesheet_searcher.exact_index_in_samplesheet(swapped_tag)
for hit in hits:
msg = '\tIt appears that maybe the dual index tag: {} was swapped. There was a hit for' \
' the swapped index: {} at: {}'.format(tag, swapped_tag, hit)
Expand All @@ -159,7 +159,7 @@ def check_reversed_in_dual_index(tag, lane, samplesheet_searcher, **kwargs):
if '+' in tag:
split_tags = tag.split('+')
for single_tag in split_tags:
hits = samplesheet_searcher.one_index_match_in_samplesheet(single_tag[::-1])
hits = samplesheet_searcher.one_index_match_from_dual_index_in_samplesheet(single_tag[::-1])
for hit in hits:
msg = '\tWe found a possible match for the reverse of tag: {}, on: {}. ' \
'This originated from the dual index tag: {}'.format(single_tag, hit, tag)
Expand All @@ -170,7 +170,7 @@ def check_reverse_complement_in_dual_index(tag, lane, samplesheet_searcher, **kw
if '+' in tag:
split_tags = tag.split('+')
for single_tag in split_tags:
hits = samplesheet_searcher.one_index_match_in_samplesheet(
hits = samplesheet_searcher.one_index_match_from_dual_index_in_samplesheet(
UnidentifiedIndexHandler.get_complementary_sequence(single_tag)[::-1])
for hit in hits:
msg = '\tWe found a possible match for the reverse complement of tag: {}, on: {}. ' \
Expand Down Expand Up @@ -296,7 +296,7 @@ def exact_index_in_samplesheet(self, index):
for lane, sample in index_hits.items():
yield _SamplesheetSearcher.SearchHit(index, sample, lane)

def one_index_match_in_samplesheet(self, index):
def one_index_match_from_dual_index_in_samplesheet(self, index):
"""
Search for in-exact matches in samplesheet, i.e. hits where there is a hit, for one, but not
both indexes in a dual index tag.
Expand All @@ -305,6 +305,6 @@ def one_index_match_in_samplesheet(self, index):
"""

for samplesheet_index in self.samplesheet_dict.keys():
if index in samplesheet_index:
if index in set(samplesheet_index.split('+')):
for lane, sample in self.samplesheet_dict[samplesheet_index].items():
yield _SamplesheetSearcher.SearchHit(index, sample, lane)

0 comments on commit f741a80

Please sign in to comment.