init source
This commit is contained in:
81711
public/expanded_pathway.xml
Normal file
81711
public/expanded_pathway.xml
Normal file
File diff suppressed because it is too large
Load Diff
11011
public/expanded_pathway1.xml
Normal file
11011
public/expanded_pathway1.xml
Normal file
File diff suppressed because it is too large
Load Diff
31211
public/expanded_pathway10800.xml
Normal file
31211
public/expanded_pathway10800.xml
Normal file
File diff suppressed because it is too large
Load Diff
5961
public/expanded_pathway1800.xml
Normal file
5961
public/expanded_pathway1800.xml
Normal file
File diff suppressed because it is too large
Load Diff
61511
public/expanded_pathway21600.xml
Normal file
61511
public/expanded_pathway21600.xml
Normal file
File diff suppressed because it is too large
Load Diff
122111
public/expanded_pathway43200.xml
Normal file
122111
public/expanded_pathway43200.xml
Normal file
File diff suppressed because it is too large
Load Diff
2931
public/expanded_pathway720.xml
Normal file
2931
public/expanded_pathway720.xml
Normal file
File diff suppressed because it is too large
Load Diff
BIN
public/favicon.ico
Normal file
BIN
public/favicon.ico
Normal file
Binary file not shown.
After Width: | Height: | Size: 4.2 KiB |
362086
public/group21600.json
Normal file
362086
public/group21600.json
Normal file
File diff suppressed because it is too large
Load Diff
720646
public/group43200.json
Normal file
720646
public/group43200.json
Normal file
File diff suppressed because it is too large
Load Diff
83
public/jsonpathway.py
Normal file
83
public/jsonpathway.py
Normal file
@@ -0,0 +1,83 @@
|
||||
import xml.etree.ElementTree as ET
|
||||
import json
|
||||
|
||||
def parse_kegg_xml_with_group(xml_file):
|
||||
tree = ET.parse(xml_file)
|
||||
root = tree.getroot()
|
||||
|
||||
pathway_info = {
|
||||
"name": root.attrib.get("name"),
|
||||
"org": root.attrib.get("org"),
|
||||
"number": root.attrib.get("number"),
|
||||
"title": root.attrib.get("title"),
|
||||
"image": root.attrib.get("image"),
|
||||
"link": root.attrib.get("link"),
|
||||
"entries": [],
|
||||
"relations": [],
|
||||
"reactions": []
|
||||
}
|
||||
|
||||
for entry in root.findall("entry"):
|
||||
entry_id = int(entry.attrib.get("id"))
|
||||
entry_group = str((entry_id // 10000) * 10000) if entry_id >= 10000 else None
|
||||
graphics = entry.find("graphics")
|
||||
entry_data = {
|
||||
"id": entry_id,
|
||||
"name": entry.attrib.get("name"),
|
||||
"type": entry.attrib.get("type"),
|
||||
"link": entry.attrib.get("link"),
|
||||
"reaction": entry.attrib.get("reaction"),
|
||||
"group": entry_group,
|
||||
"graphics": {
|
||||
"name": graphics.attrib.get("name"),
|
||||
"fgcolor": graphics.attrib.get("fgcolor"),
|
||||
"bgcolor": graphics.attrib.get("bgcolor"),
|
||||
"type": graphics.attrib.get("type"),
|
||||
"x": int(graphics.attrib.get("x")),
|
||||
"y": int(graphics.attrib.get("y")),
|
||||
"width": int(graphics.attrib.get("width")),
|
||||
"height": int(graphics.attrib.get("height")),
|
||||
}
|
||||
}
|
||||
pathway_info["entries"].append(entry_data)
|
||||
|
||||
for relation in root.findall("relation"):
|
||||
rel = {
|
||||
"entry1": int(relation.attrib.get("entry1")),
|
||||
"entry2": int(relation.attrib.get("entry2")),
|
||||
"type": relation.attrib.get("type"),
|
||||
"subtypes": []
|
||||
}
|
||||
for subtype in relation.findall("subtype"):
|
||||
rel["subtypes"].append({
|
||||
"name": subtype.attrib.get("name"),
|
||||
"value": subtype.attrib.get("value")
|
||||
})
|
||||
pathway_info["relations"].append(rel)
|
||||
|
||||
for reaction in root.findall("reaction"):
|
||||
reac = {
|
||||
"id": int(reaction.attrib.get("id")),
|
||||
"name": reaction.attrib.get("name"),
|
||||
"type": reaction.attrib.get("type"),
|
||||
"substrates": [],
|
||||
"products": []
|
||||
}
|
||||
for substrate in reaction.findall("substrate"):
|
||||
reac["substrates"].append({
|
||||
"id": int(substrate.attrib.get("id")),
|
||||
"name": substrate.attrib.get("name")
|
||||
})
|
||||
for product in reaction.findall("product"):
|
||||
reac["products"].append({
|
||||
"id": int(product.attrib.get("id")),
|
||||
"name": product.attrib.get("name")
|
||||
})
|
||||
pathway_info["reactions"].append(reac)
|
||||
|
||||
return pathway_info
|
||||
|
||||
# 사용 예:
|
||||
result = parse_kegg_xml_with_group("expanded_pathway43200.xml")
|
||||
with open("group43200.json", "w", encoding="utf-8") as f:
|
||||
json.dump(result, f, ensure_ascii=False, indent=2)
|
52
public/makepathway.py
Normal file
52
public/makepathway.py
Normal file
@@ -0,0 +1,52 @@
|
||||
import xml.etree.ElementTree as ET
|
||||
import copy
|
||||
|
||||
# 원본 XML 파일 경로
|
||||
input_file = 'pon00061.xml'
|
||||
output_file = 'expanded_pathway43200.xml'
|
||||
|
||||
# 파싱
|
||||
tree = ET.parse(input_file)
|
||||
root = tree.getroot()
|
||||
|
||||
# entry 태그만 추출
|
||||
entries = [e for e in root.findall('entry')]
|
||||
|
||||
# 원본 entry 수 확인
|
||||
print(f'원본 entry 개수: {len(entries)}')
|
||||
|
||||
# 복제 단계 수: 10000~90000 까지 (1~9단계)
|
||||
MULTIPLIERS = range(1, 120)
|
||||
|
||||
# 새로운 entry 리스트
|
||||
new_entries = []
|
||||
|
||||
for mult in MULTIPLIERS:
|
||||
id_offset = mult * 10000
|
||||
xy_offset = mult * 2000
|
||||
|
||||
for entry in entries:
|
||||
new_entry = copy.deepcopy(entry)
|
||||
|
||||
# id 업데이트
|
||||
old_id = int(entry.attrib['id'])
|
||||
new_entry.attrib['id'] = str(old_id + id_offset)
|
||||
|
||||
# graphics 내부 x, y 업데이트
|
||||
graphics = new_entry.find('graphics')
|
||||
if graphics is not None:
|
||||
old_x = int(graphics.attrib['x'])
|
||||
old_y = int(graphics.attrib['y'])
|
||||
|
||||
graphics.attrib['x'] = str(old_x + xy_offset)
|
||||
graphics.attrib['y'] = str(old_y + xy_offset)
|
||||
|
||||
new_entries.append(new_entry)
|
||||
|
||||
# 원본 root에 추가
|
||||
for e in new_entries:
|
||||
root.append(e)
|
||||
|
||||
# 출력 저장
|
||||
tree.write(output_file, encoding='utf-8', xml_declaration=True)
|
||||
print(f'새로운 XML이 {output_file}에 저장되었습니다.')
|
422230
public/pathway21600.json
Normal file
422230
public/pathway21600.json
Normal file
File diff suppressed because it is too large
Load Diff
10882
public/pon00061.json
Normal file
10882
public/pon00061.json
Normal file
File diff suppressed because it is too large
Load Diff
2583
public/pon00061.xml
Normal file
2583
public/pon00061.xml
Normal file
File diff suppressed because it is too large
Load Diff
39
public/pon00062.xml
Normal file
39
public/pon00062.xml
Normal file
@@ -0,0 +1,39 @@
|
||||
<?xml version="1.0"?>
|
||||
<!DOCTYPE pathway SYSTEM "https://www.kegg.jp/kegg/xml/KGML_v0.7.2_.dtd">
|
||||
<!-- Creation date: Jul 1, 2024 17:49:43 +0900 (GMT+9) -->
|
||||
<pathway name="path:pon00061" org="pon" number="00061"
|
||||
title="Fatty acid biosynthesis"
|
||||
image="https://www.kegg.jp/kegg/pathway/pon/pon00061.png"
|
||||
link="https://www.kegg.jp/kegg-bin/show_pathway?pon00061">
|
||||
<entry id="360" name="pon:100462086" type="gene" reaction="rn:R02767"
|
||||
link="https://www.kegg.jp/dbget-bin/www_bget?pon:100462086">
|
||||
<graphics name="CBR4" fgcolor="#000000" bgcolor="#BFFFBF"
|
||||
type="rectangle" x="981" y="1260" width="46" height="17"/>
|
||||
</entry>
|
||||
<entry id="361" name="pon:100461538" type="gene"
|
||||
link="https://www.kegg.jp/dbget-bin/www_bget?pon:100461538">
|
||||
<graphics name="HSD17B8" fgcolor="#000000" bgcolor="#BFFFBF"
|
||||
type="rectangle" x="981" y="1277" width="46" height="17"/>
|
||||
</entry>
|
||||
<entry id="367" name="cpd:C05744 cpd:C00685" type="compound"
|
||||
link="https://www.kegg.jp/dbget-bin/www_bget?C05744+C00685">
|
||||
<graphics name="C05744..." fgcolor="#000000" bgcolor="#FFFFFF"
|
||||
type="circle" x="956" y="1231" width="8" height="8"/>
|
||||
</entry>
|
||||
<entry id="426" name="pon:100438452" type="gene" reaction="rn:R04355"
|
||||
link="https://www.kegg.jp/dbget-bin/www_bget?pon:100438452">
|
||||
<graphics name="OXSM" fgcolor="#000000" bgcolor="#BFFFBF"
|
||||
type="rectangle" x="855" y="1193" width="46" height="17"/>
|
||||
</entry>
|
||||
<relation entry1="426" entry2="360" type="ECrel">
|
||||
<subtype name="compound" value="367"/>
|
||||
</relation>
|
||||
<relation entry1="426" entry2="361" type="ECrel">
|
||||
<subtype name="compound" value="367"/>
|
||||
</relation>
|
||||
<reaction id="426" name="rn:R04355" type="irreversible">
|
||||
<substrate id="425" name="cpd:C03939"/>
|
||||
<substrate id="366" name="cpd:C01209"/>
|
||||
<product id="367" name="cpd:C05744"/>
|
||||
</reaction>
|
||||
</pathway>
|
2
public/robots.txt
Normal file
2
public/robots.txt
Normal file
@@ -0,0 +1,2 @@
|
||||
User-Agent: *
|
||||
Disallow:
|
Reference in New Issue
Block a user