[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.49, Mon May 7 16:37:54 2007 UTC revision 1.50, Thu May 10 13:12:02 2007 UTC
# Line 58  Line 58 
58    
59  =cut  =cut
60    
61    
62    #### To turn on tracing, at the command line type
63    ###
64    ###  export TRACING=Ross
65    ###  trace 3 FigFam
66    ###
67    
68  sub new {  sub new {
69      my($class,$fig,$fam_id,$fam_data) = @_;      my($class,$fig,$fam_id,$fam_data) = @_;
70    
     &Tracer::ETracing();  
71      ($fam_id =~ /^FIG\d{6}$/) || confess "invalid family id: $fam_id";      ($fam_id =~ /^FIG\d{6}$/) || confess "invalid family id: $fam_id";
72    
73      my $fam = {};      my $fam = {};
# Line 80  Line 86 
86      $fam->{dir} = $dir;      $fam->{dir} = $dir;
87    
88      &FIG::verify_dir($dir);      &FIG::verify_dir($dir);
89    
90      if ((! -s "$dir/built") && (! -s "$dir/PEGs") && defined($fam_file))      if ((! -s "$dir/built") && (! -s "$dir/PEGs") && defined($fam_file))
91      {      {
92          if (-s $fam_file)          if (-s $fam_file)
# Line 91  Line 98 
98                  confess "PEG file $dir/PEGs does not exist --- $dir deleted";                  confess "PEG file $dir/PEGs does not exist --- $dir deleted";
99                  return undef;                  return undef;
100              }              }
101                &Tracer::Trace('created PEGs file') if (T(3));
102          }          }
103          else          else
104          {          {
# Line 102  Line 110 
110      if ((! -s "$dir/function") && (! -s "$dir/built"))      if ((! -s "$dir/function") && (! -s "$dir/built"))
111      {      {
112          &reset_function($fam);          &reset_function($fam);
113            &Tracer::Trace("reset function for $fam_id") if (T(3));
114      }      }
115    
116      open(FUNC,"<$dir/function") || die "could not open $dir/function";      open(FUNC,"<$dir/function") || die "could not open $dir/function";
# Line 161  Line 170 
170          }          }
171          close(FASTA);          close(FASTA);
172      }      }
 #   if ((! -s "$dir/PEGs.aln") && (-s "$dir/PEGs.fasta")) { system "runclustalw $dir/PEGs.fasta" }  
173    
174      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"))))
175      {      {
# Line 249  Line 257 
257          $fam->{bounds} = $bounds;          $fam->{bounds} = $bounds;
258      }      }
259    
260        if ((! -d "$dir/SplitNew") && (! -s "$dir/built"))
261        {
262            mkdir("$dir/SplitNew",0777) || die "could not make $dir/SplitNew";
263            my $seqs    = &gjoseqlib::read_fasta("$dir/PEGs.fasta");
264            my %seqs = map { $_->[0] => $_ } @$seqs;
265            my(undef,$sets) = &representative_sequences::rep_seq_2($seqs,{ max_sim => 0.3 });
266            my $n = 1;
267            foreach my $id (sort { @{$sets->{$b}}  <=> @{$sets->{$a}} } keys(%$sets))
268            {
269                my @ext_seqs = map { $seqs{$_} } ($id,@{$sets->{$id}});
270                if (@ext_seqs > 1)
271                {
272                    my $trimmed = &PHOB::kernel_of_trimmed_seqs(seqs => \@ext_seqs);
273                    if (@$trimmed > 1)
274                    {
275                        my $ali     = &PHOB::align_seqs(seqs => $trimmed);
276                        &gjoseqlib::print_alignment_as_fasta("$dir/SplitNew/$n.ali",$ali);
277                        $n++;
278                    }
279                }
280            }
281        }
282    
283    
284      my $blast_file = "$dir/blastout";      my $blast_file = "$dir/blastout";
285      my $rep_file   = "$dir/reps";      my $rep_file   = "$dir/reps";
286      if ((! -f $blast_file) && (! -s "$dir/built"))      if ((! -f $blast_file) && (! -s "$dir/built"))

Legend:
Removed from v.1.49  
changed lines
  Added in v.1.50

MCS Webmaster
ViewVC Help
Powered by ViewVC 1.0.3