
rushadrena
Novice
Aug 24, 2012, 4:23 AM
Post #1 of 1
(469 views)
|
|
Parsing a complicated XML file
|
Can't Post
|
|
Hi all. I have this xml file :- http://www.genome.jp/kegg-bin/download?entry=pon01100&format=kgml I even tried parsing it with XML:Simple as :-
use strict; use XML::Simple; use Data::Dumper; my $xml_hash = XMLin('pon01100.xml'); print Dumper($xml_hash); Its dumping the output as desired to the console.
$VAR1 = { 'reaction' => { 'rn:R01500 rn:R03617' => { 'substrate' => { 'name' => 'cpd:C00195', 'id' => '1815' }, 'type' => 'reversible', 'id' => '927', 'product' => { 'name' => 'cpd:C02686', 'id' => '2154' } }, 'rn:R01001' => { 'substrate' => { 'name' => 'cpd:C02291', 'id' => '3509' }, 'type' => 'reversible', 'id' => '393', 'product' => { 'cpd:C00097' => { 'id' => '3614' }, 'cpd:C00109' => { 'id' => '1835' } } }, 'rn:R00899' => { 'substrate' => { 'name' => 'cpd:C01419', 'id' => '3103' }, 'type' => 'reversible', 'id' => '269', 'product' => { 'cpd:C00037' => { 'id' => '1865' }, 'cpd:C00097' => { 'id' => '1959' } } }, What I want to do is for each of reactions (named rn:....) I want the substrate "id" and its corresponding all product "id". There could be cases when there would be two or more products for a substrate. For each of the reactions ,I want to save "substrate id" and all its corresponding "product id". Please help
|