Biopython以突出基于化合物的途径

时间:2018-01-17 21:13:33

标签: biopython

我是biopython和KGML模块的新手。我想知道是否有办法突出基于化合物的途径。以下是我正在使用的代码,借助KGML教程:

import Bio
from Bio import SeqIO
from Bio.KEGG.REST import *
from Bio.KEGG.KGML import KGML_parser
from Bio.Graphics.KGML_vis import KGMLCanvas
from Bio.Graphics.ColorSpiral import ColorSpiral
from IPython.display import Image, HTML
import random

# A bit of code that will help us display the PDF output
def PDF(filename):
    return HTML('<iframe src=%s width=700 height=350></iframe>' % filename)

# A bit of helper code to shorten long text
def head(text, lines=10):
    """ Print the first lines lines of the passed text.
    """
    print '\n'.join(text.split('\n')[:lines] + ['[...]'])

def rgb_to_hex(rgb):
    rgb = tuple([int(255*val) for val in rgb])
    return '#' + ''.join([hex(val)[2:] for val in rgb]).upper()



sbi_map = KGML_parser.read((kegg_get("sbi01100", "kgml").read())) 

compArray = ["cpd:C00186","cpd:C00079"]
for element in sbi_map.compounds:
    print(element.name)
    if element.name in compArray:
        for graphic in element.graphics:
            print(graphic.type)
            graphic.bgcolor = rgb_to_hex((138,0,67))
            graphic.width = 25

然而,这只是强调复合元素。任何帮助表示赞赏。

0 个答案:

没有答案