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

Diff of /FigWebServices/protein.cgi

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

revision 1.174, Mon Jan 9 18:02:22 2006 UTC revision 1.175, Mon Jan 16 18:02:11 2006 UTC
# Line 2347  Line 2347 
2347  # gene, but you can (secretly) change this to get more or less sequence by setting additional_sequence  # gene, but you can (secretly) change this to get more or less sequence by setting additional_sequence
2348  # in the URL. Also, I changed the way that the display is generated above so that I can used the s///  # in the URL. Also, I changed the way that the display is generated above so that I can used the s///
2349  # to add the color and new lines.  # to add the color and new lines.
2350    #
2351    # Fixed off-by-one errors in the end of coloring (which started this all).
2352    # Modified to detect end of contig (otherwise it fails when it runs off an end).
2353    # Modified to handle multisegment locations.  -- GJO
2354    
2355  sub dna_sequence_adjacent {  sub dna_sequence_adjacent {
2356      my($fig_or_sprout,$cgi,$html,$fid) = @_;      my($fig_or_sprout,$cgi,$html,$fid) = @_;
2357      my($seq,$func,$i);      my( $contig, $beg, $end, $seq, $func, $i );
2358    
2359      unshift @$html, "<TITLE>The SEED: Nucleotide Sequence</TITLE>\n";      unshift @$html, "<TITLE>The SEED: Nucleotide Sequence</TITLE>\n";
2360      my $additional=$cgi->param("additional_sequence");      my $additional=$cgi->param("additional_sequence");
2361      $additional or ($additional = 500);      defined( $additional ) or ( $additional = 500 );
2362      # dna_sequence makes the assumption that there is only one sequence region  
2363      &feature_locationS($fig_or_sprout,$fid) =~ /(.*)\_(\d+)\_(\d+)/;      # Now handles segmented location and running off an end. -- GJO
2364      my ($id, $beg, $end)=($1,$2,$3);  
2365      ($beg < $end) ? eval {$beg -= $additional; $end += $additional} : eval {$beg += $additional; $end -= $additional};      my $genome = genome_of( $fid );
2366        my $loc = $fig_or_sprout->feature_location( $fid );
2367      if ($seq = &dna_seq($fig_or_sprout,&genome_of($fid),$id."_".$beg."_".$end)) {      my @loc = split /,/, $loc;
2368          $seq =~ s/(.{60})/$1\n/g;  
2369          $additional += int($additional/60);      # Add to beginning of the first segment:
2370          $seq =~ s/^(.{$additional})(.*)(.{$additional})$/$1<span style="color: red">$2<\/span>$3/s;  
2371          $func = &function_ofS($fig_or_sprout,$prot,$cgi->param('user'));      ( $contig, $beg, $end ) = $loc[0] =~ /^(.*)_(\d+)_(\d+)$/;
2372          push(@$html,$cgi->pre,">$fid $func\n$seq\n",$cgi->end_pre);      if ( ! ( $contig && $beg && $end ) )
2373      } else {      {
2374          push(@$html,$cgi->h1("No DNA sequence available for $fid"));          push @$html, $cgi->h2( "Bad location information for $fid" );
2375            print STDERR "SEED Error: Bad location information ($loc) for $fid in dna_sequence_adjacent\n";
2376            return;
2377        }
2378        my ( $n1, $npre );
2379        if ( $beg < $end )
2380        {
2381            $n1 = $beg - $additional;
2382            $n1 = 1 if $n1 < 1;
2383            $npre = $beg - $n1;
2384        }
2385        else
2386        {
2387            $n1 = $beg + $additional;
2388            my $clen = $fig_or_sprout->contig_ln( $genome, $contig );
2389            $n1 = $clen if $n1 > $clen;
2390            $npre = $n1 - $beg;
2391      }      }
2392        $loc[0] = join( '_', $contig, $n1, $end );
2393    
2394        # Add to the end of the last segment:
2395    
2396        ( $contig, $beg, $end ) = $loc[-1] =~ /^(.*)_(\d+)_(\d+)$/;
2397        if ( ! ( $contig && $beg && $end ) )
2398        {
2399            push @$html, $cgi->h2( "Bad location information for $fid" );
2400            print STDERR "SEED Error: Bad location information ($loc) for $fid in dna_sequence_adjacent\n";
2401            return;
2402  }  }
2403        my ( $n2, $npost );
2404        if ( $beg < $end )
2405        {
2406            $n2 = $end + $additional;
2407            my $clen = $fig_or_sprout->contig_ln( $genome, $contig );
2408            $n2 = $clen if $n2 > $clen;
2409            $npost = $n2 - $end;
2410        }
2411        else
2412        {
2413            $n2 = $end - $additional;
2414            $n2 = 1 if $n2 < 1;
2415            $npost = $end - $n2;
2416        }
2417        $loc[-1] = join( '_', $contig, $beg, $n2 );
2418    
2419        $seq = $fig_or_sprout->dna_seq( $genome, join( ',', @loc ) );
2420        if ( ! $seq )
2421        {
2422            push @$html, $cgi->h2( "No DNA sequence available for $fid" );
2423            return;
2424        }
2425    
2426        my $len = length( $seq );         # Get length before adding newlines
2427        $seq =~ s/(.{60})/$1\n/g;         # Cleaver way to wrap the sequence
2428        my $p1 = $npre + int( $npre/60 ); # End of prefix, adjusted for newlines
2429        my $p2 = $len - $npost;           # End of data,
2430        $p2 += int( $p2/60 );             #     adjusted for newlines
2431        my $diff = $p2 - $p1;             # Characters of data
2432        # Integrate the HTML codes
2433        $seq =~ s/^(.{$p1})(.{$diff})(.*)$/$1<SPAN Style="color:red">$2<\/SPAN>$3/s;
2434    
2435        $func = $fig_or_sprout->function_of( $fid, $cgi->param('user') );
2436    
2437        push @$html, $cgi->pre, ">$fid $func\n$seq\n", $cgi->end_pre;
2438    }
2439    
2440    
2441  sub show_fusions {  sub show_fusions {
2442      my($fig_or_sprout,$cgi,$html,$prot) = @_;      my($fig_or_sprout,$cgi,$html,$prot) = @_;

Legend:
Removed from v.1.174  
changed lines
  Added in v.1.175

MCS Webmaster
ViewVC Help
Powered by ViewVC 1.0.3