# Path: ariba/sequence_metadata.py
# class Error (Exception): pass
# class SequenceMetadata:
#     def __init__(self, line):
#     def __eq__(self, other):
#     def __lt__(self, other):
#     def __hash__(self):
#     def __str__(self):
#     def to_string(self, separator='\t'):
#     def has_variant(self, seq):
# 
# Path: ariba/cdhit.py
# class Error (Exception): pass
# class Runner:
#     def __init__(
#       self,
#       infile,
#       seq_identity_threshold=0.9,
#       threads=1,
#       length_diff_cutoff=0.0,
#       memory_limit=None,
#       verbose=False,
#       min_cluster_number=0
#     ):
#     def fake_run(self):
#     def _load_user_clusters_file(filename, all_ref_seqs, rename_dict=None):
#     def run_get_clusters_from_file(self, clusters_infile, all_ref_seqs, rename_dict=None):
#     def _get_clusters_from_bak_file(filename, min_cluster_number=0):
#     def get_run_cmd(self, output_file):
#     def run(self):


import json
import os
import sys
import re
import copy
import pyfastaq
from ariba import sequence_metadata, cdhit
            return False, 'REMOVE\tToo long. Length: ' + str(len(seq))
        else:
            return True, None


    @classmethod
    def _remove_bad_genes(cls, sequences, metadata, log_file, min_gene_length, max_gene_length):
        to_remove = set()

        if len(sequences) == 0:
            return to_remove

        log_fh = pyfastaq.utils.open_file_write(log_file)

        for name in sorted(sequences):
            if metadata[name]['seq_type'] != 'p':
                continue

            new_seq, message = ReferenceData._try_to_get_gene_seq(sequences[name], min_gene_length, max_gene_length)
            if new_seq is None:
                to_remove.add(name)
            else:
                sequences[name] = new_seq

            if message is not None:
                print(name, message, sep='\t', file=log_fh)

        pyfastaq.utils.close(log_fh)

        for name in to_remove:

# Path: ariba/sequence_metadata.py
# class Error (Exception): pass
# class SequenceMetadata:
#     def __init__(self, line):
#     def __eq__(self, other):
#     def __lt__(self, other):
#     def __hash__(self):
#     def __str__(self):
#     def to_string(self, separator='\t'):
#     def has_variant(self, seq):
# 
# Path: ariba/cdhit.py
# class Error (Exception): pass
# class Runner:
#     def __init__(
#       self,
#       infile,
#       seq_identity_threshold=0.9,
#       threads=1,
#       length_diff_cutoff=0.0,
#       memory_limit=None,
#       verbose=False,
#       min_cluster_number=0
#     ):
#     def fake_run(self):
#     def _load_user_clusters_file(filename, all_ref_seqs, rename_dict=None):
#     def run_get_clusters_from_file(self, clusters_infile, all_ref_seqs, rename_dict=None):
#     def _get_clusters_from_bak_file(filename, min_cluster_number=0):
#     def get_run_cmd(self, output_file):
#     def run(self):


# Path: ariba/reference_data.py
import json
import os
import sys
import re
import copy
import pyfastaq
from ariba import sequence_metadata, cdhit

            return False, 'REMOVE\tToo long. Length: ' + str(len(seq))
        else:
            return True, None


    @classmethod
    def _remove_bad_genes(cls, sequences, metadata, log_file, min_gene_length, max_gene_length):
        to_remove = set()

        if len(sequences) == 0:
            return to_remove

        log_fh = pyfastaq.utils.open_file_write(log_file)

        for name in sorted(sequences):
            if metadata[name]['seq_type'] != 'p':
                continue

            new_seq, message = ReferenceData._try_to_get_gene_seq(sequences[name], min_gene_length, max_gene_length)
            if new_seq is None:
                to_remove.add(name)
            else:
                sequences[name] = new_seq

            if message is not None:
                print(name, message, sep='\t', file=log_fh)

        pyfastaq.utils.close(log_fh)

        for name in to_remove:

            sequences.pop(name)