[Bio] / FortyEight / rp_chunk_sims.pl Repository:
ViewVC logotype

Diff of /FortyEight/rp_chunk_sims.pl

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

revision 1.4, Mon Mar 16 18:47:00 2009 UTC revision 1.5, Wed Jul 8 20:18:46 2009 UTC
# Line 14  Line 14 
14  use File::Basename;  use File::Basename;
15  use Cwd 'abs_path';  use Cwd 'abs_path';
16    
17  my $usage = "Usage: $0 [-size max-size] [-include-self] fasta-file nr peg.synonyms sims-job-dir";  my $usage = "Usage: $0 [-size max-size] [-include-self] [-self-fasta fasta-file] fasta-file nr peg.synonyms sims-job-dir";
18    
19  my $max_size = 10_000;  my $max_size = 10_000;
20  my $include_self = 0;  my $include_self = 0;
21    my $self_fasta;
22    
23  while (@ARGV > 0 and $ARGV[0] =~ /^-/)  while (@ARGV > 0 and $ARGV[0] =~ /^-/)
24  {  {
# Line 30  Line 31 
31      {      {
32          $include_self++;          $include_self++;
33      }      }
34        elsif ($arg =~ /^-self-fasta/)
35        {
36            $self_fasta = shift @ARGV;
37        }
38      else      else
39      {      {
40          die $usage;          die $usage;
# Line 43  Line 48 
48  my $pegsyn = shift;  my $pegsyn = shift;
49  my $jobdir = shift;  my $jobdir = shift;
50    
51    if (!defined($self_fasta))
52    {
53        $self_fasta = $fasta;
54    }
55    
56  -d $jobdir or mkdir $jobdir or die "Cannot mkdir $jobdir: $!\n";  -d $jobdir or mkdir $jobdir or die "Cannot mkdir $jobdir: $!\n";
57    
58  my $next_task = 1;  my $next_task = 1;
# Line 66  Line 76 
76  #  #
77  # Buzz through once to ensure we can open them.  # Buzz through once to ensure we can open them.
78  #  #
79  for my $file (@fasta_files)  for my $file (@fasta_files, $self_fasta)
80  {  {
81      open(F, "<$file") or die "Cannot open $file: $!\n";      open(F, "<$file") or die "Cannot open $file: $!\n";
82      close(F);      close(F);
83  }  }
84    
 for my $file (@fasta_files)  
 {  
     my $cur_size = 0;  
     my $cur_input = '';  
   
     my $base = basename($file);  
     $file = abs_path($file);  
   
     open(F, "<$file") or die "Cannot open $file: $!\n";  
85    
86      #      #
87      # Prepare and submit self-sims.      # Prepare and submit self-sims.
88      #      #
89      if ($include_self)      if ($include_self)
90      {      {
91        #
92        # hack - leftover from legacy chunking code that wanted multiple
93        # directories of sims. we need to direct the output all to the
94        # same directory.
95        #
96        my $base = basename($fasta);
97        my $file = abs_path($self_fasta);
98    
99          system("$FIG_Config::ext_bin/formatdb", "-p", "t", "-i", $file);          system("$FIG_Config::ext_bin/formatdb", "-p", "t", "-i", $file);
100          my $task = $next_task++;          my $task = $next_task++;
101          print TASK join("\t", $task, $file, $file, $flags,          print TASK join("\t", $task, $file, $file, $flags,
102                          "$output_dir/$base/out.$task", "$error_dir/$base/err.$task"), "\n";                          "$output_dir/$base/out.$task", "$error_dir/$base/err.$task"), "\n";
103      }      }
104    
105    for my $file (@fasta_files)
106    {
107        my $cur_size = 0;
108        my $cur_input = '';
109    
110        my $base = basename($file);
111        $file = abs_path($file);
112    
113        open(F, "<$file") or die "Cannot open $file: $!\n";
114    
115      print "Chunk file $file\n";      print "Chunk file $file\n";
116    
117      while (<F>)      while (<F>)

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

MCS Webmaster
ViewVC Help
Powered by ViewVC 1.0.3