Closed fungs closed 4 years ago
If I replace gaps with Ns, it gives the same error message.
@fungs Thanks for reporting. Will take a look at this soon...
Same problem here, also seqmagick 0.7.0 -- it looks to be any translation under Biopython newer than version 1.70. Here's a minimal working example:
$ echo -e '>seq\nATG' | seqmagick convert --translate dna2protein - -
>seq
M
And then with newer Biopython I get the same TypeError @fungs reported.
Trying an idea from near the end of that traceback:
>>> import Bio.Data.CodonTable
>>> tbl = Bio.Data.CodonTable.ambiguous_dna_by_name["Standard"]
>>> tbl_wrn = seqmagick.transform.CodonWarningTable(tbl.forward_table)
>>> tbl.forward_table["ATG"]
'M'
>>> tbl_wrn["ATG"]
'M'
>>> "ATG" in tbl.forward_table
True
>>> "ATG" in tbl_wrn
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/home/jesse/miniconda3/lib/python3.6/site-packages/seqmagick/transform.py", line 663, in __getitem__
elif '-' in codon:
TypeError: argument of type 'int' is not iterable
Just a shot in the dark, but does CodonWarningTable need to implement __contains__
for this to work again? Something like this, maybe?
>>> class CodonWarningTable2(seqmagick.transform.CodonWarningTable):
... def __contains__(self, codon):
... return codon in self.wrapped
...
>>> tbl_wrn2 = Tbl2(tbl.forward_table)
>>> "ATG" in tbl2
True
@ressy in case you need a good tool for translation, https://github.com/shenwei356/seqkit is working flawlessly
Thanks! I hadn't seen that one before.
fixed in #76 and released in #82
I'm translating nucleotide multiple sequence alignments to amino acid. Codons can contain gap symbols which should be ignored. I'm using seqmagick 0.7.0 in both cases. The command I'm using is
This is working with BioPython 1.70 but not working with BioPython 1.72. This is the error message:
It seems, Biopython changed the way the process the translation lookup.