[BioPython] KEGG

2024. 9. 23. 18:43Bioinformatics

0. KEGG는 생물학적 pathway와 기능적 유전자 모듈, 유전체와 유전자 정보, 화학물질과 효소 정보, 질병, 약물, 환경 정보가 담겨있는 데이터베이스라고 한다. 

 

1. 사용법 

from Bio.KEGG import Enzyme 

records = Enzyme.parse(open(file)) 
record = list(records)[0] 
print(record.classname) 
print(record.sysname) 
print(record.substrate)
print(record.product)

 

2 . KEGG API 사용법 

#12.4.KEGG_REST_example.py
from Bio.KEGG import REST

human_pathways = REST.kegg_list("pathway", "hsa").read()

insulin_pathways = []
for line in human_pathways.rstrip().split("\n"):
    entry, description = line.split("\t")
    if "insulin" in description.lower():
        insulin_pathways.append(entry)
        print(entry, description)
print(insulin_pathways)

insulin_genes = []
for pathway in insulin_pathways:
    pathway_file = REST.kegg_get(pathway).read()
    
    current_section = None
    for line in pathway_file.rstrip().split("\n"):
        section = line[:12].strip()
        if not section == "":
            current_section = section
            
            if current_section == "GENE":
                gene_identifiers, gene_description = line[12:].split("; ")
                gene_id, gene_symbol = gene_identifiers.split()
                
                if not gene_symbol in insulin_genes:
                    insulin_genes.append(gene_symbol)
                    
print("There are %d insulin pathways and %d insulin genes. The genes are:" % (len(insulin_pathways), len(insulin_genes)))
print(", ".join(insulin_genes))

source code 출처 : https://github.com/KennethJHan/Bioinformatics_Biopython/blob/master/Section1/Chap12/12.4.KEGG_REST_example.py

 

Bioinformatics_Biopython/Section1/Chap12/12.4.KEGG_REST_example.py at master · KennethJHan/Bioinformatics_Biopython

Contribute to KennethJHan/Bioinformatics_Biopython development by creating an account on GitHub.

github.com

이런 식으로 사용하면 된다고 한다. 

 

'Bioinformatics' 카테고리의 다른 글

[Bioinformatics] pipeline tool installation  (19) 2024.11.17
[BioPython] Bio.Phylo  (0) 2024.09.22
[BioPython] Bio.SwissProt  (2) 2024.09.21
[M/O] Akkermansia muciniphila  (0) 2024.09.20
[BioPython] Entrez  (0) 2024.09.19