[Bio] / FigKernelPackages / FigFam.pm Repository:
ViewVC logotype

Diff of /FigKernelPackages/FigFam.pm

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

revision 1.44, Sat Apr 28 14:47:53 2007 UTC revision 1.45, Mon May 7 00:43:26 2007 UTC
# Line 23  Line 23 
23  use gjoseqlib;  use gjoseqlib;
24  use gjoalignment;  use gjoalignment;
25  use PHOB;  use PHOB;
26    use Tracer;
27    
28  use Carp;  use Carp;
29  use Data::Dumper;  use Data::Dumper;
# Line 60  Line 61 
61  sub new {  sub new {
62      my($class,$fig,$fam_id,$fam_data) = @_;      my($class,$fig,$fam_id,$fam_data) = @_;
63    
64        &Tracer::ETracing();
65      ($fam_id =~ /^FIG\d{6}$/) || confess "invalid family id: $fam_id";      ($fam_id =~ /^FIG\d{6}$/) || confess "invalid family id: $fam_id";
66    
67      my $fam = {};      my $fam = {};
# Line 78  Line 80 
80      $fam->{dir} = $dir;      $fam->{dir} = $dir;
81    
82      &FIG::verify_dir($dir);      &FIG::verify_dir($dir);
83      if ((! -s "$dir/PEGs") && defined($fam_file))      if ((! -s "$dir/built") && (! -s "$dir/PEGs") && defined($fam_file))
84      {      {
85          if (-s $fam_file)          if (-s $fam_file)
86          {          {
# Line 97  Line 99 
99          }          }
100      }      }
101    
102      if (! -s "$dir/function")      if ((! -s "$dir/function") && (! -s "$dir/built"))
103      {      {
104          &reset_function($fam);          &reset_function($fam);
105      }      }
# Line 117  Line 119 
119                   `cat \"$dir/PEGs\"`                   `cat \"$dir/PEGs\"`
120                  ];                  ];
121    
     if (@$pegsL < 4)  
     {  
         return undef;  
     }  
122      $fam->{pegsL} = $pegsL;      $fam->{pegsL} = $pegsL;
123      my $pegsH = {};      my $pegsH = {};
124      foreach $peg (@$pegsL)      foreach $peg (@$pegsL)
# Line 157  Line 155 
155          }          }
156          close(FASTA);          close(FASTA);
157      }      }
158    #   if ((! -s "$dir/PEGs.aln") && (-s "$dir/PEGs.fasta")) { system "runclustalw $dir/PEGs.fasta" }
159    
160      if ((! -s "$dir/built") && ((! -s "$dir/PEGs.fasta.pin") || ((-M "$dir/PEGs.fasta.pin") > (-M "$dir/PEGs.fasta"))))      if ((! -s "$dir/built") && ((! -s "$dir/PEGs.fasta.pin") || ((-M "$dir/PEGs.fasta.pin") > (-M "$dir/PEGs.fasta"))))
161      {      {
# Line 183  Line 182 
182          close(SIMS);          close(SIMS);
183      }      }
184    
185      if ((! -s "$dir/built") && (! -f "$dir/bounds"))      if ((! -s "$dir/built") && (! -s "$dir/bounds"))
186      {      {
187          print STDERR " building bounds for $fam_id\n";          print STDERR " building bounds for $fam_id\n";
188          open(BOUNDS,">$dir/bounds")    || die "could not open $dir/bounds";          open(BOUNDS,">$dir/bounds")    || die "could not open $dir/bounds";
# Line 229  Line 228 
228          $/ = "\n";          $/ = "\n";
229      }      }
230    
     open(BOUNDS,"<$dir/bounds") || die "could not open $dir/bounds";  
   
231      my $bounds = {};      my $bounds = {};
232        if (open(BOUNDS,"<$dir/bounds"))
233        {
234      my $x;      my $x;
235      while (defined($x = <BOUNDS>))      while (defined($x = <BOUNDS>))
236      {      {
# Line 242  Line 241 
241      }      }
242      close(BOUNDS);      close(BOUNDS);
243      $fam->{bounds} = $bounds;      $fam->{bounds} = $bounds;
244        }
245    
246      my $blast_file = "$dir/blastout";      my $blast_file = "$dir/blastout";
247      my $rep_file   = "$dir/reps";      my $rep_file   = "$dir/reps";
# Line 279  Line 279 
279          }          }
280      }      }
281    
282        if ((-s "$dir/Split/set.sizes") && (! -s "$dir/built"))
283        {
284            my @to_align = map { (($_ =~ /^(\d+)\t(\d+)/) && ($2 > 1)) ? $1 : () } `cat $dir/Split/set.sizes`;
285            foreach my $n (@to_align)
286            {
287                if (! -s "$dir/Split/$n.aln")
288                {
289                    system "runclustalw $dir/Split/$n";
290                }
291            }
292        }
293    
294      if ((-s $blast_file) && (! -s $rep_file) && (! -s "$dir/built"))      if ((-s $blast_file) && (! -s $rep_file) && (! -s "$dir/built"))
295      {      {
296          my $n = 1;          my $n = 1;
# Line 324  Line 336 
336    
337      $fam->{reps} = (-s $rep_file) ? [map { $_ =~ /^(\S+)/; $1 } `grep -v "^>" $rep_file`] : [];      $fam->{reps} = (-s $rep_file) ? [map { $_ =~ /^(\S+)/; $1 } `grep -v "^>" $rep_file`] : [];
338    
339      if (! -s "$dir/built") { system "echo 1 > $dir/built" }  #   if (@$pegsL < 4)
340    #   {
341    #       if (! -s "$dir/built") { system "echo 1 > $dir/built" }
342    #       return undef;
343    #   }
344    
345        if ((! -s "$dir/built") && $fam->{bounds}) { system "echo 1 > $dir/built" }
346      bless $fam,$class;      bless $fam,$class;
347      return $fam;      return $fam;
348  }  }

Legend:
Removed from v.1.44  
changed lines
  Added in v.1.45

MCS Webmaster
ViewVC Help
Powered by ViewVC 1.0.3