[Bio] / FortyEightMeta / mg_chunk_sims.pl Repository:
ViewVC logotype

Diff of /FortyEightMeta/mg_chunk_sims.pl

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

revision 1.1, Fri Mar 23 20:41:31 2007 UTC revision 1.2, Fri May 30 23:23:51 2008 UTC
# Line 15  Line 15 
15  use File::Basename;  use File::Basename;
16  use Cwd 'abs_path';  use Cwd 'abs_path';
17    
18  my $usage = "$0 [-p blastprog] [-o blastopts] [-n num-seqs] -nr nr-file -j jobdir fasta [fasta...]";  my $usage = "$0 [-p blastprog] [-o blastopts] [-N num-chars] [-n num-seqs] -nr nr-file -j jobdir fasta [fasta...]";
19    
20  my $blastprog = "blastp";  my $blastprog = "blastp";
21  my $flags = "-m 8 -e 1.0e-5 -FF";  my $flags = "-m 8 -e 1.0e-5 -FF";
22  my $max_seqs = 500;  my $max_seqs;
23    my $max_chars;
24  my $nr_file;  my $nr_file;
25  my $jobdir;  my $jobdir;
26    
# Line 38  Line 39 
39      {      {
40          $max_seqs = shift;          $max_seqs = shift;
41      }      }
42        elsif ($opt eq '-N')
43        {
44            $max_chars = shift;
45        }
46      elsif ($opt eq '-nr')      elsif ($opt eq '-nr')
47      {      {
48          $nr_file = shift;          $nr_file = shift;
# Line 71  Line 76 
76      -f $f or die "Fasta file $f does not exist\n";      -f $f or die "Fasta file $f does not exist\n";
77  }  }
78    
79    if (!defined($max_seqs) and !defined($max_chars))
80    {
81        die "Must pass either -n or -N option\n";
82    }
83    
84  -d $jobdir or mkdir $jobdir or die "Cannot mkdir $jobdir: $!\n";  -d $jobdir or mkdir $jobdir or die "Cannot mkdir $jobdir: $!\n";
85    
86  my $next_task = 1;  my $next_task = 1;
# Line 108  Line 118 
118      {      {
119          if (/^>/)          if (/^>/)
120          {          {
121              if ($cur_count >= $max_seqs)              if ((defined($max_seqs) and ($cur_count >= $max_seqs)) or
122                    (defined($max_chars) and ($cur_size >= $max_chars)))
123              {              {
124                  write_task($base, $input_dir, $output_dir, $error_dir, $cur_input);                  write_task($base, $input_dir, $output_dir, $error_dir, $cur_input);
125                  $cur_size = 0;                  $cur_size = 0;
# Line 116  Line 127 
127                  $cur_input = '';                  $cur_input = '';
128              }              }
129              $cur_input .= $_;              $cur_input .= $_;
             $cur_size += length($_);  
130              $cur_count++;              $cur_count++;
131          }          }
132          else          else

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

MCS Webmaster
ViewVC Help
Powered by ViewVC 1.0.3