Commits

Sarah Richardson committed 3f9d617

change scale to iterate; make sure the chr->iterate call obeys it!

  • Participants
  • Parent commits 0bd20fc

Comments (0)

Files changed (6)

File bin/BS_ChromosomeCutter.pl

   'CHROMOSOME=s'   => \$p{CHROMOSOME},
   'EDITOR=s'       => \$p{EDITOR},
   'MEMO=s'         => \$p{MEMO},
-  'SCALE=s'        => \$p{SCALE},
+  'ITERATE=s'      => \$p{ITERATE},
   'ACTION=s'       => \$p{ACTION},
   'STARTPOS=i'     => \$p{STARTPOS},
   'STOPPOS=i'      => \$p{STOPPOS},
 
 my $BS_FEATS = $BS->fetch_custom_features();
 
-$p{STARTPOS} = $p{STARTPOS} || 1;
-$p{STOPPOS} = $p{STOPPOS} || $chrlen;
-$p{SCALE}  = $p{SCALE}  || 'chrom';
 $p{OUTPUT} = $p{OUTPUT} || 'html';
 
 if (! $p{EDITOR} || ! $p{MEMO})
 {
   die "\n ERROR: Unrecognized custom feature requested for insertion.\n";
 }
+
+$p{STARTPOS} = $p{STARTPOS} || 1;
+$p{STOPPOS} = $p{STOPPOS} || $chrlen;
 if ($p{STOPPOS} <= $p{STARTPOS})
 {
-  die "\n ERROR: The start and stop coordinates do not parse.\n";
+  die "BSERROR: The start and stop coordinates do not parse.\n";
+}
+
+$p{ITERATE}  = $p{ITERATE}  || 'chromosome';
+if ($p{ITERATE} ne 'genome' && $p{ITERATE} ne 'chromosome')
+{
+  die "BSERROR: Argument to iterate must be 'genome' or 'chromosome'.\n";
 }
 
 ################################################################################
 ################################# CONFIGURING ##################################
 ################################################################################
-my $newchr = $chr->iterate();
+my $newchr = $chr->iterate(-version => $p{ITERATE});
 $p{REPORT} = {};
 my @changes;
 

File bin/BS_ChromosomeSplicer.pl

       'CHROMOSOME=s'      => \$p{CHROMOSOME},
       'EDITOR=s'          => \$p{EDITOR},
       'MEMO=s'            => \$p{MEMO},
-      'SCALE=s'           => \$p{SCALE},
+      'ITERATE=s'         => \$p{ITERATE},
       'ACTION=s'          => \$p{ACTION},
       'STARTPOS=i'        => \$p{STARTPOS},
       'STOPPOS=i'         => \$p{STOPPOS},
 
 my $BS_FEATS = $BS->custom_features();
 
-$p{SCALE}     = $p{SCALE}     || 'chrom';
 $p{OUTPUT}    = $p{OUTPUT}    || 'txt';
-$p{STARTPOS}  = $p{STARTPOS}  || 1;
-$p{STOPPOS}   = $p{STOPPOS}   || $chrlen;
 $p{DISTANCE}  = $p{DISTANCE}  || 0;
 $p{DESTROY}   = $p{DESTROY}   || undef;
 
 {
   die "\n BSERROR: Unrecognized custom feature requested for insertion.\n";
 }
+
+$p{STARTPOS}  = $p{STARTPOS}  || 1;
+$p{STOPPOS}   = $p{STOPPOS}   || $chrlen;
 if ($p{STOPPOS} <= $p{STARTPOS})
 {
   die "\n BSERROR: The start and stop coordinates do not parse.\n";
 }
 
+$p{ITERATE}   = $p{ITERATE}   || 'chromosome';
+if ($p{ITERATE} ne 'genome' && $p{ITERATE} ne 'chromosome')
+{
+  die "BSERROR: Argument to iterate must be 'genome' or 'chromosome'.\n";
+}
+
 ################################################################################
 ################################## SPLICING  ###################################
 ################################################################################
-my $newchr = $chr->iterate();
+my $newchr = $chr->iterate(-version => $p{ITERATE});
 $p{REPORT} = {};
 my @changes;
 
 
 Optional arguments:
 
-  --SCALE : [genome, chrom (def)] Which version number to increment
+  --ITERATE : [genome, chromosome (def)] Which version number to increment?
   --STARTPOS : The first base eligible for editing, defaults to 1
   --STOPPOS : The last base eligible for editing, defaults to chr length
   --DESTROY : Whether or not other features should be disrupted by

File bin/BS_CodonJuggler.pl

   'CHROMOSOME=s'   => \$p{CHROMOSOME},
   'EDITOR=s'       => \$p{EDITOR},
   'MEMO=s'         => \$p{MEMO},
-  'SCALE=s'        => \$p{SCALE},
+  'ITERATE=s'      => \$p{ITERATE},
   'STARTPOS=i'     => \$p{STARTPOS},
   'STOPPOS=i'      => \$p{STOPPOS},
   'FROM=s'         => \$p{FROM},
 my $chrlen = length $oldchrseq;
 
 $p{OUTPUT} = $p{OUTPUT} || 'txt';
-$p{STARTPOS} = $p{STARTPOS} || 1;
-$p{STOPPOS} = $p{STOPPOS} || $chrlen;
 
 if ($BS->SGE())
 {
     "be done.\n";
 }
 
-$p{SCALE} = $p{SCALE} || 'chrom';
-
+$p{STARTPOS} = $p{STARTPOS} || 1;
+$p{STOPPOS} = $p{STOPPOS} || $chrlen;
 if ($p{STOPPOS} <= $p{STARTPOS})
 {
   die "BSERROR: The start and stop coordinates do not parse\n";
 }
 
+$p{ITERATE} = $p{ITERATE} || 'chromosome';
+if ($p{ITERATE} ne 'genome' && $p{ITERATE} ne 'chromosome')
+{
+  die "BSERROR: Argument to iterate must be 'genome' or 'chromosome'.\n";
+}
+
 ################################################################################
 ################################# CONFIGURING ##################################
 ################################################################################
-my $newchr = $chr->iterate();
+my $newchr = $chr->iterate(-version => $p{ITERATE});
 my $GD = $newchr->GD;
 
 $p{SWAPTYPE} = $GD->codon_change_type(-from => $p{FROM}, -to => $p{TO});
 
 Optional arguments:
 
-  -SCA, --SCALE : [genome, chrom (def)] Which version number to increment
+  --ITERATE : [genome, chromosome (def)] Which version number to increment?
   -STA, --STARTPOS : The first base for editing;
   -STO, --STOPPOS  : The last base for editing;
   -D,   --DUBWHACK : Allow nonsynonymous changes to dubious ORFs on behalf of

File bin/BS_PCRTagger.pl

   'CHROMOSOME=s'      => \$p{CHROMOSOME},
   'EDITOR=s'          => \$p{EDITOR},
   'MEMO=s'            => \$p{MEMO},
-  'SCALE=s'           => \$p{SCALE},
+  'ITERATE=s'         => \$p{ITERATE},
   'STARTPOS=i'        => \$p{STARTPOS},
   'STOPPOS=i'         => \$p{STOPPOS},
   'MINTAGMELT=i'      => \$p{MINTAGMELT},
 my $chrlen = length $chrseq;
 my $GD = $chr->GD;
 
-Readonly my $SCALE            => 'chrom';
+Readonly my $ITERATE          => 'chromosome';
 Readonly my $OUTPUT           => 'txt';
 Readonly my $MINTAGMELT       => 57.9;
 Readonly my $MINMINTAGMELT       => 20;
 Readonly my $ORF_TAG_INC      => 1000;
 
 $p{OUTPUT}           = $p{OUTPUT}           || $OUTPUT;
-$p{SCALE}            = $p{SCALE}            || $SCALE;
+$p{ITERATE}          = $p{ITERATE}          || $ITERATE;
 $p{MINTAGMELT}       = $p{MINTAGMELT}       || $MINTAGMELT;
 $p{MAXTAGMELT}       = $p{MAXTAGMELT}       || $MAXTAGMELT;
 $p{MINPERDIFF}       = $p{MINPERDIFF}       || $MINPERDIFF;
   die "\n ERROR: The minimum percent difference does not parse.\n\n";
 }
 
+if ($p{ITERATE} ne 'genome' && $p{ITERATE} ne 'chromosome')
+{
+  die "BSERROR: Argument to iterate must be 'genome' or 'chromosome'.\n";
+}
+
 #Single family codons can't be first or last codons
 #codons that don't share their siblings' first two bases can't be first codons
 my %fams;
 ################################################################################
 ################################# CONFIGURING ##################################
 ################################################################################
-my $newchr = $chr->iterate();
+my $newchr = $chr->iterate(-version => $p{ITERATE});
 
 my $genome = $BS->gather_latest_genome($chr->species);
 my $result = $BS->SGE
 
 Optional arguments:
 
-  -SCA, --SCALE : [genome, chrom (def)] Which version number to increment
+  --ITERATE : [genome, chromosome (def)] Which version number to increment?
   -STA, --STARTPOS : The first base for analysis;
   -STO, --STOPPOS  : The last base for analysis;
   --MINTAGMELT : (default 58) Minimum melting temperature for tags

File bin/BS_RepeatSmasher.pl

   'CHROMOSOME=s'   => \$p{CHROMOSOME},
   'EDITOR=s'       => \$p{EDITOR},
   'MEMO=s'         => \$p{MEMO},
-  'SCALE=s'        => \$p{SCALE},
+  'ITERATE=s'      => \$p{ITERATE},
   'STARTPOS=i'     => \$p{STARTPOS},
   'STOPPOS=i'      => \$p{STOPPOS},
   'OUTPUT=s'       => \$p{OUTPUT},
 my $GD = $chr->GD();
 $p{STARTPOS} = $p{STARTPOS} || 1;
 $p{STOPPOS} = $p{STOPPOS} || $chrlen;
-$p{SCALE}  = $p{SCALE}  || 'chrom';
+$p{ITERATE}  = $p{ITERATE}  || 'chromosome';
 $p{OUTPUT} = $p{OUTPUT} || 'html';
 
 unless ($p{EDITOR} && $p{MEMO})
 {
   die "\n ERROR: Both an editor's id and a memo must be supplied.";
 }
-
 if ((! $p{STARTPOS} || ! $p{STOPPOS}) || $p{STOPPOS} <= $p{STARTPOS})
 {
   die "\n ERROR: The start and stop coordinates do not parse.";
 }
+if ($p{ITERATE} ne 'genome' && $p{ITERATE} ne 'chromosome')
+{
+  die "BSERROR: Argument to iterate must be 'genome' or 'chromosome'.\n";
+}
 
 ################################################################################
 ################################# CONFIGURING ##################################
 ################################################################################
 my $REPORT = {};
-my $newchr = $chr->iterate();
+my $newchr = $chr->iterate(-version => $p{ITERATE});
 
 ################################################################################
 ############################### REPEAT SMASHING ################################
 
 Optional arguments:
 
-  --SCALE : [genome, chrom (def)] Which version number to increment
-  --OUTPUT : html or txt
+  --ITERATE : [genome, chromosome (def)] Which version number to increment?
   -h,   --help : Display this message
 
 =cut

File lib/Bio/BioStudio/Chromosome.pm

 {
   my ($self, @args) = @_;
   
-  my ($gen, $chr, $tag) = $self->_rearrange([qw(genver chrver tag)], @args);
+  my $a = [qw(genver chrver tag version)];
+  my ($gen, $chr, $tag, $ver) = $self->_rearrange($a, @args);
   
-  $gen = $gen || 0;
-  $chr = $chr || 1;
+  if (defined $ver)
+  {
+    $gen = $ver =~ m{g}msix ? 1 : 0;
+    $chr = $ver =~ m{c}msix ? 1 : 0;
+  }
+  else
+  {
+    $gen = $gen || 0;
+    $chr = $chr || 1;
+  }
   $tag = $tag || undef;
   my $oldpath = $self->path_to_GFF;