# Path: mirtop/mirna/mintplates.py
# def convert(seq, encode, prefix):
#     if prefix is None:
#         prefix = ''
#     else:
#         if '-' in prefix or ' ' in prefix:
#             sys.stderr.write("Warning: Dashes and spaces are not permitted in the license plate prefix."
#                              "Program will remove all instances automatically from prefix '" + prefix + "'.\n")
#             prefix = prefix.replace('-', '')
#             prefix = prefix.replace(' ', '')
# 
#     if encode:
#         # Encode
#         if seq != '':
#             cleaned = seq.upper().replace('U', 'T')
#             if is_sequence(cleaned):
#                 return encode_sequence(cleaned, prefix)
#             else:
#                 raise KeyError('Error, exiting: Illegal characters in line "' + seq + '"')
#     else:
#         # Decode
#         if seq != '':
#             cleaned = seq.upper()
#             return decode_sequence(cleaned)


import re
import mirtop.libs.logger as mylog
from Bio import pairwise2
from Bio.Seq import Seq
from collections import defaultdict
from mirtop.mirna.mintplates import convert
            sc -= 1
        return sc

    def is_iso(self):
        """Define whether element is isomiR or not."""
        if self.external == "NA":
            return False
        if self.t5 or self.t3 or self.add or self.subs or self.external != "":
            return True
        return False


def read_id(idu):
    """
    Read a unique identifier for the sequence and
    convert it to the nucleotides,
    replacing an unique code for 5 nts.

    It uses the code from *mirtop.mirna.keys()*.

    Inspired by MINTplate: https://cm.jefferson.edu/MINTbase
    https://github.com/TJU-CMC-Org/MINTmap/tree/master/MINTplates

    Args:
        *idu(str)*: unique identifier for the sequence.

    Returns:
        *seq(str)*: nucleotides sequences.
    """
    try:

# Path: mirtop/mirna/mintplates.py
# def convert(seq, encode, prefix):
#     if prefix is None:
#         prefix = ''
#     else:
#         if '-' in prefix or ' ' in prefix:
#             sys.stderr.write("Warning: Dashes and spaces are not permitted in the license plate prefix."
#                              "Program will remove all instances automatically from prefix '" + prefix + "'.\n")
#             prefix = prefix.replace('-', '')
#             prefix = prefix.replace(' ', '')
# 
#     if encode:
#         # Encode
#         if seq != '':
#             cleaned = seq.upper().replace('U', 'T')
#             if is_sequence(cleaned):
#                 return encode_sequence(cleaned, prefix)
#             else:
#                 raise KeyError('Error, exiting: Illegal characters in line "' + seq + '"')
#     else:
#         # Decode
#         if seq != '':
#             cleaned = seq.upper()
#             return decode_sequence(cleaned)


# Path: mirtop/mirna/realign.py
import re
import mirtop.libs.logger as mylog
from Bio import pairwise2
from Bio.Seq import Seq
from collections import defaultdict
from mirtop.mirna.mintplates import convert

            sc -= 1
        return sc

    def is_iso(self):
        """Define whether element is isomiR or not."""
        if self.external == "NA":
            return False
        if self.t5 or self.t3 or self.add or self.subs or self.external != "":
            return True
        return False


def read_id(idu):
    """
    Read a unique identifier for the sequence and
    convert it to the nucleotides,
    replacing an unique code for 5 nts.

    It uses the code from *mirtop.mirna.keys()*.

    Inspired by MINTplate: https://cm.jefferson.edu/MINTbase
    https://github.com/TJU-CMC-Org/MINTmap/tree/master/MINTplates

    Args:
        *idu(str)*: unique identifier for the sequence.

    Returns:
        *seq(str)*: nucleotides sequences.
    """
    try:

        seq = convert(idu, False, 'iso')