def _check_euk_contamination(self, hmm_hit_tables):
        '''
        check_euk_contamination - Check output HMM tables hits reads that hit
                                  the 18S HMM with a higher bit score.

        Parameters
        ----------
        hmm_hit_tables : array
            Array of paths to the output files produced by hmmsearch or
            nhmmer.
        run_stats : dict
            A dictionary to updatewith the number of unique 18S reads and reads
            detected by both 18S and non-18S HMMs

        Returns
        -------
        euk_reads : set
            Non-redundant set of all read names deemed to be eukaryotic
        '''
        
        euk_hit_table = HMMreader(hmm_hit_tables.pop(-1))
        other_hit_tables = [HMMreader(x) for x in hmm_hit_tables]
        reads_unique_to_eukaryotes = []
        reads_with_better_euk_hit = []

        for hit in euk_hit_table.names():
            bits = []
            for hit_table in other_hit_tables:
                if hit in hit_table.names():
                    bits.append(hit_table.bit(hit))
                else:
                    reads_unique_to_eukaryotes.append(hit)
            if bits:
                if any([x for x in bits if x > euk_hit_table.bit(hit)]):
                    continue
                else:
                    reads_with_better_euk_hit.append(hit)
            else:
                continue

        if len(reads_with_better_euk_hit) == 0:
            logging.info("No contaminating eukaryotic reads detected")
        else:
            logging.info("Found %s read(s) that may be eukaryotic" % len(reads_with_better_euk_hit + reads_unique_to_eukaryotes))

        euk_reads = set(reads_with_better_euk_hit + reads_unique_to_eukaryotes)

        return euk_reads
def _check_euk_contamination ( self , hmm_hit_tables ) : euk_hit_table = HMMreader ( hmm_hit_tables . pop ( - 1 ) ) other_hit_tables = [ HMMreader ( x ) for x in hmm_hit_tables ] reads_unique_to_eukaryotes = [ ] reads_with_better_euk_hit = [ ] for hit in euk_hit_table . names ( ) : bits = [ ] for hit_table in other_hit_tables : if hit in hit_table . names ( ) : bits . append ( hit_table . bit ( hit ) ) else : reads_unique_to_eukaryotes . append ( hit ) if bits : if any ( [ x for x in bits if x > euk_hit_table . bit ( hit ) ] ) : continue else : reads_with_better_euk_hit . append ( hit ) else : continue if len ( reads_with_better_euk_hit ) == 0 : logging . info ( "No contaminating eukaryotic reads detected" ) else : logging . info ( "Found %s read(s) that may be eukaryotic" % len ( reads_with_better_euk_hit + reads_unique_to_eukaryotes ) ) euk_reads = set ( reads_with_better_euk_hit + reads_unique_to_eukaryotes ) return euk_reads
check_euk_contamination - Check output HMM tables hits reads that hit
                                  the 18S HMM with a higher bit score.

        Parameters
        ----------
        hmm_hit_tables : array
            Array of paths to the output files produced by hmmsearch or
            nhmmer.
        run_stats : dict
            A dictionary to updatewith the number of unique 18S reads and reads
            detected by both 18S and non-18S HMMs

        Returns
        -------
        euk_reads : set
            Non-redundant set of all read names deemed to be eukaryotic