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

Diff of /FigKernelScripts/find_SEED_SSU_rRNA_genes.pl

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

revision 1.4, Mon May 4 20:54:03 2009 UTC revision 1.5, Wed Aug 15 16:45:14 2012 UTC
# Line 34  Line 34 
34      -b         #  Add a blank line between genomes (D = no blank)      -b         #  Add a blank line between genomes (D = no blank)
35      -c nt      #  Condense the sequence to first and last nt nucleotides (D = full seq)      -c nt      #  Condense the sequence to first and last nt nucleotides (D = full seq)
36      -e dist    #  Maximum nucleotides at end to extrapolate a match (D = 10)      -e dist    #  Maximum nucleotides at end to extrapolate a match (D = 10)
37        -f         #  Fasta output format
38      -s         #  Do not show sequence      -s         #  Do not show sequence
39      -t 'tag'   #  A short tage to identify the nature of the feature; allows      -t 'tag'   #  A short tage to identify the nature of the feature; allows
40                 #    mixing of different types; empty string supresses the field                 #    mixing of different types; empty string supresses the field
# Line 48  Line 49 
49  use FIG;  use FIG;
50  my $fig = new FIG;  my $fig = new FIG;
51    
52  my $assignment = 'SSU rRNA ## 16S rRNA, small subunit ribosomal RNA';  my $extrapolate;
53  my $tag = 'SSU_rRNA';  my $assignment;
54    my $tag;
55    my @rna;
56    
57    use SSU_rRNA_reps;
58    @rna        = @SSU_rRNA_reps::RNA_reps;
59    $assignment = $SSU_rRNA_reps::assignment if $SSU_rRNA_reps::assignment;
60    $tag        = $SSU_rRNA_reps::tag        if $SSU_rRNA_reps::tag;
61    
62    ensure_defined( $extrapolate, 10 );
63    ensure_defined( $assignment, 'SSU rRNA ## 16S rRNA, small subunit ribosomal RNA' );
64    ensure_defined( $tag,        'SSU_rRNA' );
65    
66  my $blank       =  0;  my $blank       =  0;
 my $extrapolate = 10;  
67  my $condense    =  0;  my $condense    =  0;
68    my $fasta    = 0;
69    
70  while ( @ARGV && $ARGV[0] =~ s/^-// )  while ( @ARGV && $ARGV[0] =~ s/^-// )
71  {  {
72      $_ = shift;      $_ = shift;
73      if ( m/^a$/ ) { $assignment  = shift; next }      if ( s/^a// ) { $assignment  = /\S/ ? $_ : shift; next }
74      if ( s/^c// ) { $condense    = $_ || shift; next }      if ( s/^c// ) { $condense    = /\S/ ? $_ : shift; next }
75      if ( s/^e// ) { $extrapolate = $_ || shift; next }      if ( s/^e// ) { $extrapolate = /\S/ ? $_ : shift; next }
76      if ( m/^t$/ ) { $tag         = shift; next }      if ( s/^t// ) { $tag         = /\S/ ? $_ : shift; next }
77    
78      if ( s/b//  ) { $blank    = ! $blank }      if ( s/b//  ) { $blank    = ! $blank }
79        if ( s/f//  ) { $fasta = ! $fasta }
80      if ( m/\S/ )      if ( m/\S/ )
81      {      {
82          print STDERR "Bad flag '$_'\n", $usage;          print STDERR "Bad flag '$_'\n", $usage;
# Line 71  Line 84 
84      }      }
85  }  }
86    
 use SSU_rRNA_reps;  
 my @rrna = @SSU_rRNA_reps::SSU_rRNA_reps;  
   
87  my @genomes = @ARGV;  my @genomes = @ARGV;
88  if ( ! @genomes )  if ( ! @genomes )
89  {  {
# Line 89  Line 99 
99      -f $contig_file or print STDERR "Could not find contig file $contig_file\n"      -f $contig_file or print STDERR "Could not find contig file $contig_file\n"
100                      and exit;                      and exit;
101    
102      my $options = { description => 'Small subunit ribosomal RNA',      my $options = { description => $assignment,
103                      extrapolate =>  10,                      extrapolate =>  10,
104                      refseq      => \@rrna                      refseq      => \@rna
105                    };                    };
106    
107      my $instances = find_homologs::find_nucleotide_homologs( $contig_file, $options );      my $instances = find_homologs::find_nucleotide_homologs( $contig_file, $options );
# Line 108  Line 118 
118    
119      foreach ( @instances )      foreach ( @instances )
120      {      {
121            if ( ! $fasta )
122            {
123          print join( "\t", @$_,          print join( "\t", @$_,
124                            ( $tag ? $tag : () ),                            ( $tag ? $tag : () ),
125                            ( $assignment ? $assignment : () )                            ( $assignment ? $assignment : () )
126                    ), "\n"                    ), "\n"
127      }      }
128            else
129            {
130                # >genome:location assignment
131                gjoseqlib::print_seq_as_fasta( "$_->[0]:$_->[2]", $assignment, $_->[3] );
132            }
133        }
134    
135      print "\n" if @instances && $blank;  #  Blank line between genomes      print "\n" if @instances && $blank;  #  Blank line between genomes
136  }  }
137    
138    exit;
139    
140    sub ensure_defined { $_[0] = $_[1] if ! defined $_[0] }

Legend:
Removed from v.1.4  
changed lines
  Added in v.1.5

MCS Webmaster
ViewVC Help
Powered by ViewVC 1.0.3