Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
Flag indicating if RBH should be written to file.
output_dir : str
Directory to store AAI results.
"""
# read taxonomic identification of each genome
taxonomy = {}
if taxonomy_file:
for line in open(taxonomy_file):
genome_id, taxa_str = line.rstrip().split('\t')
taxonomy[genome_id] = taxa_str
# calculate AAI between query and target genomes
aai_output_dir = os.path.join(output_dir, 'aai')
make_sure_path_exists(aai_output_dir)
aai_calculator = AAICalculator(self.cpus)
aai_output_file, rbh_output_file = aai_calculator.run(query_gene_file,
target_gene_file,
sorted_hit_table,
evalue_threshold,
per_iden_threshold,
per_aln_len_threshold,
keep_rbhs,
aai_output_dir)
# determine matches to each query genomes
aai_results_file = os.path.join(aai_output_dir, 'aai_summary.tsv')
with open(aai_results_file) as f:
f.readline()
hits = defaultdict(list)
for line in f:
def aai(self, options):
"""AAI command"""
check_file_exists(options.sorted_hit_table)
make_sure_path_exists(options.output_dir)
aai_calculator = AAICalculator(options.cpus)
aai_output_file, rbh_output_file = aai_calculator.run(options.query_gene_file,
None,
options.sorted_hit_table,
options.evalue,
options.per_identity,
options.per_aln_len,
options.keep_rbhs,
options.output_dir)
if rbh_output_file:
self.logger.info('Identified reciprocal best hits written to: %s' % rbh_output_file)
self.logger.info('AAI between genomes written to: %s' % aai_output_file)