How to use the comparem.kmer_usage.KmerUsage function in comparem

To help you get started, we’ve selected a few comparem examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github dparks1134 / CompareM / comparem / main.py View on Github external
def kmer_usage(self, options):
        """Kmer usage command"""

        if options.k > 10 or options.k <= 0:
            self.logger.warning('CompareM only support kmers with k <= 10.')
            sys.exit(0)

        genome_files = self._input_files(options.genome_files, options.file_ext)

        # calculate amino acid usage
        kmer_usage = KmerUsage(options.k, options.cpus)
        genome_kmer_usage, kmer_set = kmer_usage.run(genome_files)

        # write out results
        self.logger.info('Writing kmer profiles to file (be patient!).')
        self._write_usage_profile(genome_kmer_usage, 
                                    kmer_set, 
                                    options.counts, 
                                    options.output_file)

        self.logger.info('Kmer usage written to: %s' % options.output_file)