comparison bioperl_compat.py @ 4:a5cb5e374399 draft

"planemo upload for repository https://github.com/brinkmanlab/galaxy-tools/tree/master/biopython-convert commit afc9f4ade42686dcf53a2615d90e1e9962cf1561"
author brinkmanlab
date Thu, 04 Feb 2021 01:30:20 +0000
parents 869e206b3ca1
children
comparison
equal deleted inserted replaced
3:d9ae46bb9f09 4:a5cb5e374399
1 #!/usr/bin/env python 1 #!/usr/bin/env python
2 import sys 2 import sys
3 from biopython_convert import get_args, convert 3 from biopython_convert import get_args, convert
4 from Bio.SeqIO.InsdcIO import _InsdcWriter 4 from Bio.SeqIO.InsdcIO import _InsdcWriter, EmblWriter
5 import Bio
5 6
6 # Quote anticodon qualifiers 7 # Quote anticodon qualifiers
7 _InsdcWriter.FTQUAL_NO_QUOTE = tuple(v for v in _InsdcWriter.FTQUAL_NO_QUOTE if v not in ['anticodon', 'transl_except']) 8 _InsdcWriter.FTQUAL_NO_QUOTE = tuple(v for v in _InsdcWriter.FTQUAL_NO_QUOTE if v not in ['anticodon', 'transl_except'])
8 9
10 if Bio.__version__ == "1.78":
11 # TODO monkeypatch until https://github.com/biopython/biopython/pull/3476
12 _write_the_first_lines_orig = EmblWriter._write_the_first_lines
13
14 def _write_the_first_lines(self, record):
15 orig_type = record.annotations.get("molecule_type")
16 record.annotations["molecule_type"] = orig_type.upper()
17 ret = _write_the_first_lines_orig(self, record)
18 record.annotations["molecule_type"] = orig_type
19 return ret
20
21 EmblWriter._write_the_first_lines = _write_the_first_lines
22
9 if __name__ == '__main__': 23 if __name__ == '__main__':
10 convert(*get_args(sys.argv[1:])) 24 convert(*get_args(sys.argv[1:]))
11 25