Commit fc0ac667 authored by Jorge Navarro Muñoz's avatar Jorge Navarro Muñoz
Browse files

Bugfix: If translation is not available in GenBank file and manual translation

is needed, only use a translation table (transl_table) from the GenBank if it
really is available
parent 9b98971b
......@@ -744,9 +744,12 @@ def generateFasta(gbkfilePath, outputdir):
nt_seq = nt_seq[:-2]
# The Genetic Codes: www.ncbi.nlm.nih.gov/Taxonomy/Utils/wprintgc.cgi
CDStable = CDS.qualifiers.get("transl_table", "")[0]
prot_seq = str(nt_seq.translate(table=CDStable, to_stop=True, cds=complete_cds))
if "transl_table" in CDS.qualifiers.keys():
CDStable = CDS.qualifiers.get("transl_table", "")[0]
prot_seq = str(nt_seq.translate(table=CDStable, to_stop=True, cds=complete_cds))
else:
prot_seq = str(nt_seq.translate(to_stop=True, cds=complete_cds))
fasta_header = outputbase + "_ORF" + str(cds_ctr)+ ":gid:" + str(gene_id) + ":pid:" + str(protein_id) + ":loc:" + str(gene_start) + ":" + str(gene_end) + ":strand:" + strand
fasta_header = fasta_header.replace(">","") #the coordinates might contain larger than signs, tools upstream don't like this
fasta_header = ">"+(fasta_header.replace(" ", "")) #the domtable output format (hmmscan) uses spaces as a delimiter, so these cannot be present in the fasta header
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment