def GetBEDnarrowPeakgz(URL_or_PATH_TO_file):
    """
    Reads a gz compressed BED narrow peak file from a web address or local file

    :param URL_or_PATH_TO_file: web address of path to local file

    :returns: a Pandas dataframe
    """

    if os.path.isfile(URL_or_PATH_TO_file):
        response=open(URL_or_PATH_TO_file, "r")
        compressedFile = StringIO.StringIO(response.read())
    else:
        response = urllib2.urlopen(URL_or_PATH_TO_file)
        compressedFile = StringIO.StringIO(response.read())
    decompressedFile = gzip.GzipFile(fileobj=compressedFile)
    out=decompressedFile.read().split("\n")
    out=[ s.split("\t") for s in out]
    out=pd.DataFrame(out)
    out.columns=["chrom","chromStart","chromEnd","name","score","strand","signalValue","-log10(pValue)","-log10(qvalue)","peak"]
    out["name"]=out.index.tolist()
    out["name"]="Peak_"+out["name"].astype(str)
    out=out[:-1]
    return out
Reads a gz compressed BED narrow peak file from a web address or local file

    :param URL_or_PATH_TO_file: web address of path to local file

    :returns: a Pandas dataframe