美文网首页
DNA Features Viewer

DNA Features Viewer

作者: 可能性之兽 | 来源:发表于2022-09-19 11:00 被阅读0次

    DNA Features Viewer

    from dna_features_viewer import GraphicFeature, GraphicRecord
    features=[
        GraphicFeature(start=0, end=20, strand=+1, color="#ffd700",
                       label="Small feature"),
        GraphicFeature(start=20, end=500, strand=+1, color="#ffcccc",
                       label="Gene 1 with a very long name"),
        GraphicFeature(start=400, end=700, strand=-1, color="#cffccc",
                       label="Gene 2"),
        GraphicFeature(start=600, end=900, strand=+1, color="#ccccff",
                       label="Gene 3")
    ]
    record = GraphicRecord(sequence_length=1000, features=features)
    record.plot(figure_width=5)
    
    image.png

    如果我们在上面的代码中用 CircularGraphicRecord 替换 GraphicRecord,我们会得到一个构造的圆形图:


    image.png

    通过使用 plot _ with _ bokeh 代替 plot,也可以生成交互式(基于浏览器的)图形:


    image.png

    DNA 特性浏览器允许在记录图下绘制核苷酸或氨基酸序列:

    from dna_features_viewer import GraphicFeature, GraphicRecord
    
    sequence = "ATGCATGCATGCATGCATGCATGCATGC"
    record = GraphicRecord(sequence=sequence, features=[
        GraphicFeature(start=5, end=10, strand=+1, color='#ffcccc'),
        GraphicFeature(start=8, end=15, strand=+1, color='#ccccff')
    ])
    
    ax, _ = record.plot(figure_width=5)
    record.plot_sequence(ax)
    record.plot_translation(ax, (8, 23), fontdict={'weight': 'bold'})
    ax.figure.savefig('sequence_and_translation.png', bbox_inches='tight')
    
    image.png

    Edinburgh-Genome-Foundry/DnaFeaturesViewer: Python library to plot DNA sequence features (e.g. from Genbank files) (github.com)

    相关文章

      网友评论

          本文标题:DNA Features Viewer

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