[Bio] / FigKernelScripts / seed2tbl.pl Repository:
ViewVC logotype

Diff of /FigKernelScripts/seed2tbl.pl

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

revision 1.1, Tue Mar 17 15:07:15 2009 UTC revision 1.2, Thu Mar 26 16:58:20 2009 UTC
# Line 7  Line 7 
7  use FIGV;  use FIGV;
8  use Carp;  use Carp;
9    
10  our ( $opt_o, $opt_s, $opt_l, $opt_p, $opt_i, $opt_r, $opt_e, $opt_x );  our ( $opt_o, $opt_s, $opt_l, $opt_p, $opt_i, $opt_r, $opt_e, $opt_x, $opt_a );
11  getopts( 'o:s:l:p:i:r:e:x:' );  getopts( 'o:s:l:p:i:r:e:x:a:' );
12    
13    
14  #my %preimages_of;  #my %preimages_of;
# Line 39  Line 39 
39    $pseudo_list = load_pseudo_list( $opt_p );    $pseudo_list = load_pseudo_list( $opt_p );
40  }  }
41    
42    #* partial genes  *#
43    my $partial_list;
44    if ( defined( $opt_a ) ) {
45      $partial_list = load_partial_list( $opt_a );
46    }
47    
48  #* locus tag prefix *#  #* locus tag prefix *#
49  my $locus_tag_prefix = $opt_l;  my $locus_tag_prefix = $opt_l;
50  if ( !defined( $locus_tag_prefix ) ) {  if ( !defined( $locus_tag_prefix ) ) {
# Line 157  Line 163 
163        next;        next;
164      }      }
165      if ( $type eq qq(CDS) ) {      if ( $type eq qq(CDS) ) {
166        &output_CDS( $entry, $feature_number, $locus_tag_prefix, *RES, *XLS_LOG );        &output_CDS( $entry, $feature_number, $locus_tag_prefix, $partial_list, *RES, *XLS_LOG );
167      }      }
168      elsif ( $type =~ m/RNA/o ) {      elsif ( $type =~ m/RNA/o ) {
169        &output_RNA( $entry, $feature_number, $locus_tag_prefix, *RES );        &output_RNA( $entry, $feature_number, $locus_tag_prefix, *RES );
# Line 307  Line 313 
313  # Write CDSs #  # Write CDSs #
314  ##############  ##############
315  sub output_CDS {  sub output_CDS {
316    my ( $entry, $feature_number, $locus_tag_prefix, $RES, $XLS_LOG ) = @_;    my ( $entry, $feature_number, $locus_tag_prefix, $partial_list, $RES, $XLS_LOG ) = @_;
317      my $fid = $entry->[FID];
318    
319    $feature_number = &zero_pad( 6, $feature_number );    $feature_number = &zero_pad( 6, $feature_number );
320    my $locus_tag = $locus_tag_prefix . $feature_number;    my $locus_tag = $locus_tag_prefix . $feature_number;
321    
322    # get entry location on the contig    # get entry location on the contig
323    my ( $nonsense, $region_beg, $region_end ) = $fig->boundaries_of( $entry->[LOCUS] );    my ( $nonsense, $region_beg, $region_end ) = $fig->boundaries_of( $entry->[LOCUS] );
324      if ( defined( $partial_list->{ $fid } ) ) {
325        my ( $st, $val ) = @{ $partial_list->{ $fid } };
326        if ( $st eq 'start' ) {
327          $region_beg = $val;
328        }
329        if ( $st eq 'stop' ) {
330          $region_end = $val;
331        }
332      }
333    
334    print $RES ( join( qq(\t), ($region_beg, $region_end, qq(gene))), qq(\n),    print $RES ( join( qq(\t), ($region_beg, $region_end, qq(gene))), qq(\n),
335                 join( qq(\t), (qq(),        qq(),        qq(),       qq(locus_tag),  $locus_tag)),  qq(\n),                 join( qq(\t), (qq(),        qq(),        qq(),       qq(locus_tag),  $locus_tag)),  qq(\n),
# Line 334  Line 350 
350    my $first_chunk = shift @chunks;    my $first_chunk = shift @chunks;
351    my ( $nonsense2, $beg, $end ) = $fig->boundaries_of( $first_chunk );    my ( $nonsense2, $beg, $end ) = $fig->boundaries_of( $first_chunk );
352    
353      if ( defined( $partial_list->{ $fid } ) ) {
354        my ( $st, $val ) = @{ $partial_list->{ $fid } };
355        if ( $st eq 'start' ) {
356          $beg = $val;
357        }
358        if ( $st eq 'stop' ) {
359          $end = $val;
360        }
361      }
362    
363    print $RES ( join( qq(\t), ( $beg, $end, qq(CDS) ) ), qq(\n) );    print $RES ( join( qq(\t), ( $beg, $end, qq(CDS) ) ), qq(\n) );
364    foreach my $chunk (@chunks) {    foreach my $chunk (@chunks) {
365      ( undef, $beg, $end ) = $fig->boundaries_of( $chunk );      ( undef, $beg, $end ) = $fig->boundaries_of( $chunk );
# Line 343  Line 369 
369    ##############################    ##############################
370    # Now about the CDS function #    # Now about the CDS function #
371    ##############################    ##############################
   my $fid   = $entry->[FID];  
372    my $func  = $entry->[FUNC];    my $func  = $entry->[FUNC];
373    $func =~ s/\s+/ /go;    $func =~ s/\s+/ /go;
374    my $original_func = $func;    my $original_func = $func;
# Line 869  Line 894 
894    return $pseudo_list;    return $pseudo_list;
895  }  }
896    
897    #########################
898    # list of partial genes #
899    #########################
900    sub load_partial_list {
901      my ( $partial_file ) = @_;
902    
903      my $partial_list;
904      open ( PL, $partial_file ) or die "cannot open $partial_file";
905    
906      while ( <PL> ) {
907        chomp;
908        next if ( !defined( $_ ) );
909        my ( $peg, $st, $val ) = split( "\t", $_ );
910        $partial_list->{ $peg } = [ $st, $val ];
911      }
912    
913      close PL;
914      return $partial_list;
915    }
916    
917    
918  #########  #########
919  # usage #  # usage #

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

MCS Webmaster
ViewVC Help
Powered by ViewVC 1.0.3