import re


def String2Location(s):
    """convert a string to location information.

    >>> String2Location("chr1:12:15")
    ('chr1', '+', 12, 15)

    Returns
    -------
    contig : string
    strand : string
    start : int
    end : int
    """

    data = re.split("[:]+", s)
    if len(data) == 3:
        return data[0], "+", int(data[1]), int(data[2])
    elif len(data) == 4:
        return data[0], data[1], int(data[2]), int(data[3])
    else:
        raise ValueError("unknown format %s" % (s))