changeset 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 d9ae46bb9f09
children 1c71c770bfd4
files bioperl_compat.py
diffstat 1 files changed, 15 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/bioperl_compat.py	Tue Nov 10 21:14:06 2020 +0000
+++ b/bioperl_compat.py	Thu Feb 04 01:30:20 2021 +0000
@@ -1,11 +1,25 @@
 #!/usr/bin/env python
 import sys
 from biopython_convert import get_args, convert
-from Bio.SeqIO.InsdcIO import _InsdcWriter
+from Bio.SeqIO.InsdcIO import _InsdcWriter, EmblWriter
+import Bio
 
 # Quote anticodon qualifiers
 _InsdcWriter.FTQUAL_NO_QUOTE = tuple(v for v in _InsdcWriter.FTQUAL_NO_QUOTE if v not in ['anticodon', 'transl_except'])
 
+if Bio.__version__ == "1.78":
+    # TODO monkeypatch until https://github.com/biopython/biopython/pull/3476
+    _write_the_first_lines_orig = EmblWriter._write_the_first_lines
+
+    def _write_the_first_lines(self, record):
+        orig_type = record.annotations.get("molecule_type")
+        record.annotations["molecule_type"] = orig_type.upper()
+        ret = _write_the_first_lines_orig(self, record)
+        record.annotations["molecule_type"] = orig_type
+        return ret
+
+    EmblWriter._write_the_first_lines = _write_the_first_lines
+
 if __name__ == '__main__':
     convert(*get_args(sys.argv[1:]))