How to use the pomoxis.assess_homopolymers.AverageScore function in pomoxis

To help you get started, we’ve selected a few pomoxis 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 nanoporetech / pomoxis / pomoxis / assess_homopolymers.py View on Github external
def count_homopolymers(args):
    os.mkdir(args.output_dir)

    score = AverageScore()
    headers = [
        'query_name', 'ref_name', 'ref_start', 'rev_comp', 'query_start',
        'ref_base', 'query_base', 'ref_len', 'query_len']

    prefix = os.path.join(args.output_dir, 'hp')
    with open(prefix + '_catalogue.txt', 'w') as txt_fh:
        txt_fh.write('\t'.join(headers) + "\n")
        score, counts = process_bam(args.bam, txt_fh, args.homo_len, score)
    print("Found {} homopolymers in {}. Average score: {}".format(
        score.count, args.bam, score))
    save_counts(counts, prefix + '_counts.pkl')
    analyse_counts(counts, prefix)
github nanoporetech / pomoxis / pomoxis / assess_homopolymers.py View on Github external
def __add__(self, score):
        if isinstance(score, AverageScore):
            self.cumulative_score += score.cumulative_score
            self.count += score.count
        else:
            self.cumulative_score += score
            self.count += 1
        return self