Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
Fasta file for genome.
"""
genome_id = ntpath.basename(genome_file)
genome_id = genome_id[0:genome_id.rfind('.')]
aa_gene_file = os.path.join(self.output_dir, genome_id + '.genes.faa')
nt_gene_file = os.path.join(self.output_dir, genome_id + '.genes.fna')
gff_file = os.path.join(self.output_dir, genome_id + '.gff')
if self.called_genes:
os.system('ln -s %s %s' % (os.path.abspath(genome_file), aa_gene_file))
else:
tmp_dir = tempfile.mkdtemp()
seqIO = SeqIO()
seqs = seqIO.read_fasta(genome_file)
# determine number of bases
total_bases = 0
for seq in seqs.values():
total_bases += len(seq)
# call genes under different translation tables
table_coding_density = {}
for translation_table in [4, 11]:
os.makedirs(os.path.join(tmp_dir, str(translation_table)))
aa_gene_file_tmp = os.path.join(tmp_dir, str(translation_table), genome_id + '.genes.faa')
nt_gene_file_tmp = os.path.join(tmp_dir, str(translation_table), genome_id + '.genes.fna')
gff_file_tmp = os.path.join(tmp_dir, str(translation_table), genome_id + '.gff')
# check if there is sufficient bases to calculate prodigal parameters