checkQC.handlers.unidentified_index_handler module

class checkQC.handlers.unidentified_index_handler.UnidentifiedIndexHandler(*args, **kwargs)[source]

Bases: checkQC.handlers.qc_handler.QCHandler

The UnidentifiedIndexHandler will try to identify if an index is represented at to high a level in unidentified reads, and if that is the case try to pinpoint why that is.

It will not output errors, but all information will be displayed as warnings, due to the difficulty of deciding what is an error or not in this context. For most cases the % of unidentified reads will be what is used to issue the error, and then the warnings from this handler can help in identifying the possible underlying cause.

There are a number of different checks (or rules) in place, which will be checked if and index occurs more then the significance_threshold. The samplesheet will be checked to see if the index found matches and of the following rules:

  • Check if the dual indexes have been swapped
  • Check if the index has been reversed
  • Check if the index is the reverse complement
  • Check if the index is the complementary index
  • Check if the index is present in another lane

It will ignore any indexes which have N’s in them. These are assumed to be read errors.

WHITE_LIST_QC_KEY = 'white_listed_indexes'
always_warn_rule(tag, lane, percent_on_lane, **kwargs)[source]

We always want to warn about an index that is significantly represented. This rule will make sure that we do so, and all other rules will contribute extra information if there is any. :param tag: :param lane: :param percent_on_lane: :return:

static check_complement_in_dual_index(tag, lane, samplesheet_searcher, **kwargs)[source]
static check_complement_index(tag, lane, samplesheet_searcher, **kwargs)[source]
static check_if_index_in_other_lane(tag, lane, samplesheet_searcher, **kwargs)[source]
check_qc()[source]

The check_qc method provides the core behaviour of the QCHandler. It should check the values provided to it and yield instances of QCHandlerReport (or continue, if there was nothing to report)

Returns:An instance of QCHandlerReport
static check_reverse_complement_in_dual_index(tag, lane, samplesheet_searcher, **kwargs)[source]
static check_reverse_complement_index(tag, lane, samplesheet_searcher, **kwargs)[source]
static check_reversed_in_dual_index(tag, lane, samplesheet_searcher, **kwargs)[source]
static check_reversed_index(tag, lane, samplesheet_searcher, **kwargs)[source]
static check_swapped_dual_index(tag, lane, samplesheet_searcher, **kwargs)[source]
collect(signal)[source]

The implementing subclass should provide this method. It is up to instance receiving the data to decide how to handle it. Below is an example of how to handle a tuple with a key-value pair.

class MySubscriber(Subscriber):

    def __init__(self):
        self.results = []

    def collect(self, signal):
        key, value = signal
        if key == "my_key":
            self.results.append(value)
Returns:None
evaluate_index_rules(tag, lane, samplesheet_searcher, percent_on_lane)[source]

Evaluates a list of ‘rules’ and yields all warnings found by these rules. :param tag: :param lane: :param samplesheet_searcher: :param percent_on_lane: :return: generator of QCErrorFatal

static get_complementary_sequence(seq)[source]
is_significantly_represented(index_count, nbr_of_reads_on_lane)[source]
number_of_reads_per_lane()[source]

Transform conversion results into dict of lane -> total clusters pass filer :return: dict {<lane>: <total clusters pass filer>}

parser()[source]

The UnidentifiedIndexHandler fetches its information from the :return:

should_be_evaluated(tag, count, number_of_reads_on_lane)[source]
validate_configuration()[source]

This overrides the normal configuration which looks for warning/error. :return: None :raises: ConfigurationError if the configuration for the handler was not valid.

static yield_qc_warning_with_message(msg, lane, tag)[source]