view 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
line wrap: on
line source

#!/usr/bin/env python
import sys
from biopython_convert import get_args, convert
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:]))