Hello!

To see the file structure, click on "tree".

Note that updates take place every 10 minutes, commits may not be seen immediately.
Added comments for future version of script; added verbose display of
authorpreecej <preecej@localhost>
Mon, 15 Aug 2011 20:32:48 +0000 (20:32 +0000)
committerpreecej <preecej@localhost>
Mon, 15 Aug 2011 20:32:48 +0000 (20:32 +0000)
original file's gene nodes (textlabel and xref id)

svn path=/; revision=155

preecej/perl_singletons/pathway_gene_swapper.pl

index cc9c4d7eb4f8d49748adbfe904cca252650acadb..7c98f2908907cee8432f0d02cd5ed4125d539b47 100644 (file)
@@ -33,6 +33,16 @@ Any new gene boxes may be painted with a custom color and border, and
 will be stacked and offset for ease of visualization (much like a deck
 of cards).
 
+=head1 FUTURE CHANGES
+
+Add the option to read in an extra column of gene symbols, if the 
+user wishes to provide their own. Otherwise, continue to use the label
+prefix and auto-numbering suffix settings.
+
+Add a comment containing the NCBI species id of the new homolog (for 
+the purpose of multi-species pathway comparison or host-pathogen 
+interaction diagrams).
+
 =head1 USAGE
 
 pathway_gene_swapper.pl -i INPUT_FILE -g GENE_FILE -c CONFIG_FILE -o OUTPUT_FILE -L -v -G -d
@@ -455,6 +465,10 @@ sub swap_genes
     # indexed by the id of the gene located in the <Xref> element for each
     # node, and sub-indexed by the GraphId of each corresponding node
     my %data_nodes_by_gene_id;
+
+    if ($verbose) {
+        print "[Original genes]\n";
+    }
     
     # create a hash of all 5-digit hex ids in the gpml doc (this is the black list)
     # one list of DataNode.GraphId, Group.GroupId, and Group.GraphId
@@ -462,6 +476,7 @@ sub swap_genes
     for (@$data_nodes)
     {
         # print $_ . "\n"; # TEST
+
         if ($_->getAttributeNode("GraphId"))
         {
             $existing_hex_ids{$_->getAttributeNode("GraphId")->getValue}
@@ -472,10 +487,15 @@ sub swap_genes
         my $curr_xref_id = ($_->getElementsByTagName("Xref"))[0]
             ->getAttributeNode("ID")->getValue;
         my $curr_graph_id = $_->getAttributeNode("GraphId")->getValue;
-
+        
         $curr_xref_id =~ s/\s+$//; # rtrim whitespace
         $curr_xref_id =~ s/^\s+//; # ltrim whitespace
-        #$curr_xref_id =~ s/^("|')("|')$//; # strip quotes - may not be necessary
+
+        if ($verbose) {
+            my $curr_text_label = $_->getAttributeNode('TextLabel')->getValue;
+            $curr_text_label =~ s/^\s+|\s+$//; # trim whitespace
+            print "$curr_text_label\t$curr_xref_id\n";
+        }
         
         if (length($curr_xref_id) > 0)
         {