[Bio] / FigWebServices / SimBlockPattern.cgi Repository:
ViewVC logotype

Diff of /FigWebServices/SimBlockPattern.cgi

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1.1, Wed May 4 03:17:43 2005 UTC revision 1.2, Fri Jun 10 06:21:14 2005 UTC
# Line 51  Line 51 
51  TSetup("$traceLevel Tracer", "QUEUE");  TSetup("$traceLevel Tracer", "QUEUE");
52    
53  # Our first task is to get the parameters. We need a list of the IDs of the selected  # Our first task is to get the parameters. We need a list of the IDs of the selected
54  # genomes. These lists will be found in the "set1Genomes" and "set2Genomes" parameters.  # genomes. These lists will be found in the "set0Genomes" and "set1Genomes" parameters.
55    
56  my @genomes = ();  my @set0 = $query->param("set0Genomes");
57  push @genomes, $query->param("set1Genomes"), $query->param("set2Genomes");  my @set1 = $query->param("set1Genomes");
58    my @genomes = (@set0, @set1);
59    
60  # Next, we need to get the block ID. The block ID is going to be the value of the  # Next, we need to get the block ID. The block ID is going to be the value of the
61  # "set1Blocks", "set2Blocks", or "bothBlocks" parameter, depending on whether the  # "set0Blocks", "set1Blocks", or "bothBlocks" parameter, depending on whether the
62  # "set1Button", "set2Button", or "bothButton" parameter is present.  # "set0Button", "set1Button", or "bothButton" parameter is present.
63  my $blockID;  my $blockID;
64  for my $setID ('set1', 'both', 'set2') {  for my $setID ('set0', 'both', 'set1') {
65      my $thisBlockID = $query->param("${setID}Blocks");      my $thisBlockID = $query->param("${setID}Blocks");
66      if ($thisBlockID && $query->param("${setID}Button")) {      if ($thisBlockID && $query->param("${setID}Button")) {
67          $blockID = $thisBlockID;          $blockID = $thisBlockID;
# Line 76  Line 77 
77      # Next we need the template fragment for the rows.      # Next we need the template fragment for the rows.
78      my $rowFragment = Tracer::GetFile("Html/SimBlockPatternRow.html");      my $rowFragment = Tracer::GetFile("Html/SimBlockPatternRow.html");
79      # Get the block from the similarity block database and extract its pattern.      # Get the block from the similarity block database and extract its pattern.
80      my $blockData = $simBlock->GetEntity('GroupBlock', $blockID);      my $blockData = $simBlock->GetBlock($blockID);
81      my ($pattern) = $blockData->Value('GroupBlock(pattern)');      my ($pattern) = $blockData->Value('GroupBlock(pattern)');
82      # Get the regions for the block.      # Get the regions for the block.
83      my %regions = $simBlock->GetRegions($blockID, \@genomes);      my %regions = $simBlock->GetRegions($blockID, \@genomes);
84      for my $region (sort keys %regions) {      for my $region (sort keys %regions) {
85          my $dna = $regions{$region};          my $dna = $regions{$region};
86            # Get this region's set number.
87            my $setNumber = SimBlocks::SetNumber($region, \@set0, \@set1);
88          # Mark the variant columns with EM tags.          # Mark the variant columns with EM tags.
89          $dna = SimBlocks::TagDNA($pattern, $dna, "<em>", "</em>");          $dna = SimBlocks::TagDNA($pattern, $dna, "<em>", "</em>");
90          # Create a table row for this region.          # Create a table row for this region.
91          my $row = PageBuilder::Build($rowFragment, { region => $region,          my $row = PageBuilder::Build($rowFragment, { region => $region, dna => $dna,
92                                                       dna => $dna }, "Html");                                                       setNumber => $setNumber }, "Html");
93          print $row;          print $row;
94      }      }
95        # Now we need to create the snip list. The snip list is a column-oriented
96        # table (that is, each data item is in a separate column), so we we will
97        # build the rows in parallel and plug them into the HTML fragment. First
98        # we get the snip analysis.
99        my %snips = $simBlock->SnipScan($blockID, \@set0, \@set1);
100        # Extract the positions.
101        my @positions = (sort { $a <=> $b } keys %snips);
102        # Create lists for the set1 and set2 rows.
103        my @set0Data = ();
104        my @set1Data = ();
105        # Loop through the positions.
106        for my $position (@positions) {
107            my $setList = $snips{$position};
108            push @set0Data, $setList->[0];
109            push @set1Data, $setList->[1];
110        }
111        # Create the rows from the lists.
112        my $positionRow = join "</td><td>", @positions;
113        my $set0Row = join "</td><td>", @set0Data;
114        my $set1Row = join "</td><td>", @set1Data;
115        # Plug them into the fragment and write it out.
116        my $snipData = PageBuilder::Build("<Html/SimBlockSnipFragment.html",
117                                          { positionRow => $positionRow, set0Row => $set0Row,
118                                            set1Row => $set1Row }, "Html");
119        print $snipData;
120  };  };
121  # Trace any error that occurred.  # Trace any error that occurred.
122  if ($@) {  if ($@) {

Legend:
Removed from v.1.1  
changed lines
  Added in v.1.2

MCS Webmaster
ViewVC Help
Powered by ViewVC 1.0.3