Beispiel #1
0
                toks[6],
                toks[7],
                toks[8],
                '.',
                toks[-1],
                '.',
                toks[7],
                toks[8],
                '0,0,0',
            ]
            )

            yield contact
bt = pybedtools.BedTool(get_contacts()).saveas()
if len(bt) == 0:
    bt = pybedtools.BedTool('chr5_random		92416	92417	.	0	.	92416	92417	0,0,0', from_string=True)
else:
    norm = bt.colormap_normalize(vmin=7.0, vmax=18.0)
    bt = pybedtools.BedTool(itertools.chain(bt, [get_bait()])).saveas()
    cmap = utils.singlecolormap('k')

    def recolor(f):
        if f.name == '.':
            f = featurefuncs.add_color(f, cmap, norm)
        f.score = '0'
        return f


    bt = bt.each(recolor).sort()
bigbed(bt, genome='mm9', output=target)
Beispiel #2
0
# Raw data are in GFF-like format. Convert them, add leading "chr" to chrom
# names, and retain score in both score field as well as name field.
def fix(x):
    x = featurefuncs.gff2bed(x, name_field=5)
    x[4] = x.name
    x.chrom = 'chr' + x.chrom
    return x

x = pybedtools.BedTool(source)\
    .each(fix)\
    .saveas()

# Normalize the colormap based on the scores.
norm = x.colormap_normalize()
color = '#000000'
cm = singlecolormap(color)

# Since we've constructed a separate colormap, we disable the score by setting
# to '0'. Keep the names as scores though so we can check in the browser.
def zero_score(f):
    f.name = '%.4f' % float(f.score)
    f.score = '0'
    return f

x = x.each(featurefuncs.add_color, cm, norm)\
    .each(zero_score)\
    .sort()

bigbed(x.fn, 'dm2', target)