def parse_region_string(s):
    """parse a genomic region string.

    Returns tuple of contig, start, end. Missing values are None.
    """
    if not s:
        return None, None, None
    if ':' in s:
        contig, coords = s.split(':')
        if '-' in coords:
            start, end = list(map(int, coords.split('-')))
        else:
            start = int(start)
            end = None
        return contig, start, end
    else:
        return s, None, None
