From 41fb33ecffce48a0b97aae013fa64f1aebbd8da8 Mon Sep 17 00:00:00 2001 From: preecej Date: Fri, 12 Aug 2011 20:03:53 +0000 Subject: [PATCH] added commentary svn path=/; revision=153 --- preecej/perl_singletons/pathway_gene_swapper.pl | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/preecej/perl_singletons/pathway_gene_swapper.pl b/preecej/perl_singletons/pathway_gene_swapper.pl index 4c8e4a1..7e3459f 100644 --- a/preecej/perl_singletons/pathway_gene_swapper.pl +++ b/preecej/perl_singletons/pathway_gene_swapper.pl @@ -384,9 +384,12 @@ sub create_unique_hex_id($$) my $candidate_id = $first_digit . $last_four_digits; + # recurse if you haven't generated a unique id yet if (exists ${$_[0]}{$candidate_id}) { # print "not unique...\n"; # TEST + # the '&' suppresses prototype checking and avoids a runtime warning + # since this is a recursive call $candidate_id = &create_unique_hex_id($_[0],$_[1]); } else @@ -460,6 +463,7 @@ sub swap_genes $existing_hex_ids{$_->getAttributeNode("GraphId")->getValue} = $_->getTagName . ".GraphId"; } + # also build a data node hash to make lookup easier in the next section my $curr_xref_id = ($_->getElementsByTagName("Xref"))[0] ->getAttributeNode("ID")->getValue; @@ -469,6 +473,7 @@ sub swap_genes if (length($curr_xref_id) > 0) { + if ($curr_xref_id eq "AT3G12810") { print "** hit on AT3G12810\n"; } # TEST $data_nodes_by_gene_id{$curr_xref_id} = $_; } else @@ -487,6 +492,7 @@ sub swap_genes print "...\n"; foreach my $tmp_node (keys %data_nodes_by_gene_id) { print "... $tmp_node => $data_nodes_by_gene_id{$tmp_node}\n"; + if ($tmp_node eq "AT3G12810") { print "** hit on AT3G12810 node\n"; } # TEST } print "\n"; } -- 2.34.1