if (exists ${$_[0]}{$candidate_id})
{
# print "not unique...\n"; # TEST
- $candidate_id = create_unique_hex_id($_[0]);
+ $candidate_id = create_unique_hex_id($_[0],$_[1]);
}
else
{
}
# print "@new_nodes_map\n"; # TEST
- # if more than one new gene maps, you'll need a group for multiple gene boxes
+ # if more than one new paralog exists, and the old gene doesn't
+ # already belong to a group, you'll need a new Group for multiple
+ # gene boxes
+ my $new_GroupId;
+
if (scalar(@new_nodes_map) > 1)
{
# if curr old gene does not belong to a group
+
+ # print $curr_old_gene_node->toString . "\n"; # TEST
+ # print $curr_old_gene_node->getAttribute("GroupRef"); # TEST
+
+ if (!$curr_old_gene_node->getAttribute("GroupRef"))
+ {
+ #print "no existing group ref\n"; # TEST
+
+ # generate a new GroupId and Group.GraphId hex ids not
+ # already in use
+ $new_GroupId = create_unique_hex_id(\%existing_hex_ids,"Group.GroupId");
+ # my $new_Group_GraphId = create_unique_hex_id(\%existing_hex_ids,"Group.GraphId");
+ #print "new group id: $new_GroupId\n"; # TEST
+ # print "$new_GroupId, $new_Group_GraphId\n"; # TEST
+
# create a new group node
- # SUB: generate a new groupRef hex id not already in use
- # add to end of group nodes
- # for each new gene box
- # use new or existing group id for new boxes
- # add to new nodes ary
+ my $new_group = $gpml_doc->createElement("Group");
+ $new_group->setAttribute("GroupId",$new_GroupId);
+ #$new_group->setAttribute("GraphId",$new_Group_GraphId);
+ $new_group->setAttribute("Style","Group");
+
+ # add to beginning of group nodes
+ $pathway_node->insertBefore($new_group,${$group_nodes}[0]);
+ }
}
# flag for determining if there are one or many replacement paralogs
if (scalar(@new_nodes_map) > 1)
{
$gene_suffix_counter++;
- # TODO: check for new group ref to use
}
my $curr_new_node = $$_[0];
. $curr_new_node->getAttributeNode("TextLabel")->getValue
. (($gene_suffix_counter > 0) ? "-$gene_suffix_counter" : ""));
+ # add new GroupRef if necessary
+ if ($new_GroupId)
+ {
+ $curr_new_node->setAttribute("GroupRef",$new_GroupId);
+ }
+
# add Comment back-referencing TAIR locus id (use "source" attribute)
# NOTE: order is important in GPML; the <Comment> tags are first
my $new_comment = $gpml_doc->createElement("Comment");
- ($configs{"Y-Offset"} * $offset_multiplier));
}
}
+ undef $new_GroupId; # clear this out so we can test against its existence next time
# replace old node w/ new node(s)
for (@new_nodes_map) {