[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.2, Wed Nov 29 15:19:19 2006 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  @ARGV == 4 or die "Usage: $0 fasta-file nr peg.synonyms sims-job-dir\n";  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;
20    my $include_self = 0;
21    my $self_fasta;
22    
23    while (@ARGV > 0 and $ARGV[0] =~ /^-/)
24    {
25        my $arg = shift @ARGV;
26        if ($arg =~ /^-size/)
27        {
28            $max_size = shift @ARGV;
29        }
30        elsif ($arg =~ /^-include-self/)
31        {
32            $include_self++;
33        }
34        elsif ($arg =~ /^-self-fasta/)
35        {
36            $self_fasta = shift @ARGV;
37        }
38        else
39        {
40            die $usage;
41        }
42    }
43    
44    @ARGV == 4 or die $usage;
45    
46  my $fasta = shift;  my $fasta = shift;
47  my $nr_file = shift;  my $nr_file = shift;
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    
 my $max_size = 10_000;  
58  my $next_task = 1;  my $next_task = 1;
59  my $last_task;  my $last_task;
60    
# Line 45  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    
85    
86    #
87    # Prepare and submit self-sims.
88    #
89    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);
100        my $task = $next_task++;
101        print TASK join("\t", $task, $file, $file, $flags,
102                        "$output_dir/$base/out.$task", "$error_dir/$base/err.$task"), "\n";
103    }
104    
105  for my $file (@fasta_files)  for my $file (@fasta_files)
106  {  {
107      my $cur_size = 0;      my $cur_size = 0;
# Line 90  Line 141 
141      }      }
142      close(F);      close(F);
143  }  }
144    
145  close(TASK);  close(TASK);
146    
147  print "tasks\t1\t$last_task\n";  print "tasks\t1\t$last_task\n";

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

MCS Webmaster
ViewVC Help
Powered by ViewVC 1.0.3