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:R07892' => {
'substrate' => {
'name' => 'cpd:C
+16331',
'id' => '3038'
},
'type' => 'reversible',
'id' => '983',
'product' => {
'name' => 'cpd:C16
+332',
'id' => '2201'
}
},
'rn:R02687' => {
'substrate' => {
'name' => 'cpd:C
+00641',
'id' => '3607'
},
'type' => 'reversible',
'id' => '3606',
'product' => {
'name' => 'cpd:C01
+885',
'id' => '3608'
}
},
'rn:R05640' => {
'substrate' => {
'name' => 'cpd:C
+01724',
'id' => '2269'
},
'type' => 'reversible',
'id' => '651',
'product' => {
'name' => 'cpd:C11
+455',
'id' => '2270'
}
}......and so on......
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
-
Are you posting in the right place? Check out Where do I post X? to know for sure.
-
Posts may use any of the Perl Monks Approved HTML tags. Currently these include the following:
<code> <a> <b> <big>
<blockquote> <br /> <dd>
<dl> <dt> <em> <font>
<h1> <h2> <h3> <h4>
<h5> <h6> <hr /> <i>
<li> <nbsp> <ol> <p>
<small> <strike> <strong>
<sub> <sup> <table>
<td> <th> <tr> <tt>
<u> <ul>
-
Snippets of code should be wrapped in
<code> tags not
<pre> tags. In fact, <pre>
tags should generally be avoided. If they must
be used, extreme care should be
taken to ensure that their contents do not
have long lines (<70 chars), in order to prevent
horizontal scrolling (and possible janitor
intervention).
-
Want more info? How to link
or How to display code and escape characters
are good places to start.