def linear_tri(frags, thr):
    """
    Triangle (pyramid) of linear increase then linear decrease weights.
    Args:
       frags (list of list): [chrom,start,end] for each fragment in a GEM
    Returns:
       lin_all (list of bed entries): bed entries in format [chrom,start,end]
    """
    lin_all = []
    n = len(frags)
    for i in range(int(n/2)):
        gem_cov = frags[i][0:2]
        gem_cov.append(frags[n-i-1][2])
        if thr > 0:
            if (gem_cov[2]-gem_cov[1]) < thr:
                lin_all.append(gem_cov)
        else:
            lin_all.append(gem_cov)
    return lin_all