Skip to content

Commit

Permalink
use genome names and not genome hashes
Browse files Browse the repository at this point in the history
when exporting gene aa sequences from genomes storages.
  • Loading branch information
meren committed Nov 20, 2023
1 parent cf07d10 commit a62544f
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 3 deletions.
7 changes: 5 additions & 2 deletions anvio/genomestorage.py
Original file line number Diff line number Diff line change
Expand Up @@ -436,7 +436,7 @@ def get_all_genome_names(self):
return self.db.get_single_column_from_table(t.genome_info_table_name, 'genome_name')


def gen_combined_aa_sequences_FASTA(self, output_file_path, exclude_partial_gene_calls=False):
def gen_combined_aa_sequences_FASTA(self, output_file_path, exclude_partial_gene_calls=False, report_with_genome_name=False):
self.run.info('Exclude partial gene calls', exclude_partial_gene_calls, nl_after=1)

total_num_aa_sequences = 0
Expand All @@ -461,7 +461,10 @@ def gen_combined_aa_sequences_FASTA(self, output_file_path, exclude_partial_gene

aa_sequence = self.get_gene_sequence(genome_name, gene_caller_id)

fasta_output.write_id('%s_%d' % (genome_info_dict[genome_name]['genome_hash'], int(gene_caller_id)))
if report_with_genome_name:
fasta_output.write_id('%s_%d' % (genome_name, int(gene_caller_id)))
else:
fasta_output.write_id('%s_%d' % (genome_info_dict[genome_name]['genome_hash'], int(gene_caller_id)))
fasta_output.write_seq(aa_sequence, split=False)

total_num_aa_sequences += 1
Expand Down
2 changes: 1 addition & 1 deletion bin/anvi-get-sequences-for-gene-calls
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ def export_from_genomes_storage(genomes_storage_db_path, output_file_path):
raise ConfigError("GFF output is only relevant if you are working with a contigs database :/")

g = genomestorage.GenomeStorage(genomes_storage_db_path)
g.gen_combined_aa_sequences_FASTA(output_file_path)
g.gen_combined_aa_sequences_FASTA(output_file_path, report_with_genome_name=True)


def main(args):
Expand Down

0 comments on commit a62544f

Please sign in to comment.