ViewVC Help
View File | Revision Log | Show Annotations | View Changeset | Root Listing
root/gclib/scripts/unirefxml2cl.pl
Revision: 24
Committed: Tue Jul 26 21:46:39 2011 UTC (8 years, 1 month ago) by gpertea
File size: 797 byte(s)
Log Message:
Line File contents
1 #!/usr/bin/perl
2 use strict;
3 my $uref; #current uniref ID
4 my $mcount; #member count
5 my @mlist; #member list
6
7 while (<>) {
8 if (m/<entry id="([\-\w]+)"/) {
9 my $id=$1;
10 if ($uref) {
11 die("Error: invalid number of members for $uref ($mcount vs ".
12 scalar(@mlist).")!\n")
13 if $mcount!=scalar(@mlist);
14 print STDOUT ">$uref ".join(' ', @mlist)."\n";
15 }
16 $uref=$id;
17 $mcount=0;
18 @mlist=();
19 undef(@mlist);
20 next;
21 }
22 if (m/<property type="member count"\s+value="(\d+)"/) {
23 $mcount=$1;
24 next;
25 }
26 if (m/<dbReference type="[\w ]+" id="([-\w]+)"/) {
27 my $mid=$1;
28 push(@mlist, $mid);
29 next;
30 }
31 }
32
33 if ($uref) {
34 die("Error: invalid number of members for $uref!\n")
35 if ($mcount!=@mlist);
36 print STDOUT ">$uref ".join(' ', @mlist)."\n";
37 }

Properties

Name Value
svn:executable *