美文网首页HiC分析基因组组装三维基因组学
数据分析实战 | Jupyter notebook + Higl

数据分析实战 | Jupyter notebook + Higl

作者: 阿狸的窝 | 来源:发表于2021-08-10 18:49 被阅读0次

    参考资料:

    软件安装


    conda create -n higlass python=3.8
    
    pip install jupyter higlass-python
    
    jupyter nbextension install --py --sys-prefix --symlink higlass
    jupyter nbextension enable --py --sys-prefix higlass
    

    启动 jupyter notebook

    jupyter notebook
    

    Examples


    chromosome-annotate + gene-annotate + bar-plot + bed-region + 2d-heatmap

    截屏2021-08-10 下午6.44.43.png

    45-rotated-heatmap + bed-region + line-plot

    截屏2021-08-10 下午6.43.59.png

    Tracks


    import higlass
    from higlass.client import View, Track
    from higlass.tilesets import cooler, chromsizes, beddb, bigwig, bigbed
    

    track:chromsome-annotate

    (mm10)

    track_chrom = Track(
        position = 'top',
        track_type = 'horizontal-chromosome-labels',
        tilesetUid = "EMo5uFThS5S263tNLbzeVw",
        server = "https://higlass.4dnucleome.org/api/v1",
    )
    
    ### track: gene-annotate
    ```python
    track_gene = Track(
        position = 'top',
        track_type = "horizontal-gene-annotations",
        tilesetUid='OHJakQICQD6gTD7skx4EWA',
        server='https://higlass.io/api/v1',
        height=100,
        
    )
    

    track: 2d-heatmap

    hic = cooler('4DNFITHTURR9.mcool')
    track_hic = Track(
        position = 'center',
        track_type = 'heatmap',
        tileset = hic
    )
    

    45-rotated-heatmap

    hic = cooler('output/agg_contact_matrix/Nagano_129G1_chr19.1000.mcool')
    track_hic = Track(
        position = 'top',
        track_type = "horizontal-heatmap",
        tileset = hic,
        height=200,
        options = {
            'name': 'Pool of 129 G1 cells',
             "labelPosition": "topLeft", 
        }
    )
    

    2d-domain (TAD)

    数据预处理: BED → BEDPE-like file

    clodius aggregate bedpe \
      --chromsizes-filename galGal6.chrom.sizes \
      --chr1-col 1 --chr2-col 1 \
      --from1-col 2 --to1-col 3 \
      --from2-col 2 --to2-col 3 \
      domain.bed
    

    得到 domain.bedpe.beddb

    domain = beddb('domain.bedpe.beddb')
    track_domain = Track(
        position = 'top',
        track_type = 'bedlike',
        tileset = domain,
        height=50
    )
    

    bed region

    数据预处理:BED → BED-like file

    clodius aggregate bedfile \
        --chromsizes-filename ${chrsize_file} \
        boundary.bed
    

    得到 boundary.bed.beddb

    domain_boundary = beddb('boundary.bed.beddb')
    track_domain_boundary = Track(
        position = 'top',
        track_type = 'bedlike',
        tileset = domain_boundary,
        height=40,
        options = {
            "name": 'TopDom domain boundary', 
            "labelPosition": "topLeft", 
            "fillColor": "red"
        }
    )
    

    line plot

    数据预处理:BEDGRPAH → BIGWIG

    in_bedgraph=boundary_freq.bedgraph
    out_bigwig=boundary_freq.bigwig
    bedGraphToBigWig ${in_bedgraph} ${chrsize_file} ${out_bigwig}
    

    得到 boundary_freq.bigwig

    f = open('/Users/ziyin/Documents/Lab/project/scHiC/data/reference/mm10.chrom.sizes')
    chromsizes = []
    for line in f.readlines():
        row = line.strip().split('\t')
        chromsizes.append( (row[0], int(row[1]) ) )
    
    ts = bigwig(boundary_freq.bigwig, chromsizes=chromsizes)
    track =  Track(
            position = 'top',
            track_type = 'line',
            tileset = ts,
            height=80,
            options = {
                "name": mode, 
                "labelPosition": "topLeft", 
                "lineStrokeColor": 'red',
                "trackBorderWidth": 1,
                "trackBorderColor": "gray",
            }
        )
    

    bar-plot

    comaprtment = bigwig('4DNFI9685Y2G.bw')
    track_compartment = Track(
        position = 'top',
        track_type = 'divergent-bar',
        tileset = comaprtment,
        height = 50,
    )
    

    Plot

    
    view = View(
        [
            track_hic,
            track_domain,
            track_chrom,
            track_gene_annotation,
        ],
        chrominfo = track_chrom,
        initialXDomain = [0, 10000000], 
        initialYDomain = [0, 10000000], 
    )
    display, server, viewconf = higlass.display([view])
    display
    

    相关文章

      网友评论

        本文标题:数据分析实战 | Jupyter notebook + Higl

        本文链接:https://www.haomeiwen.com/subject/vycfbltx.html