[Bio] / FigKernelScripts / promote_orfs_to_pegs.pl Repository:
ViewVC logotype

Diff of /FigKernelScripts/promote_orfs_to_pegs.pl

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

revision 1.5, Sat Oct 28 14:27:05 2006 UTC revision 1.9, Fri Jun 8 18:11:21 2007 UTC
# Line 16  Line 16 
16  # http://www.theseed.org/LICENSE.TXT.  # http://www.theseed.org/LICENSE.TXT.
17  #  #
18    
19    use strict;
20  use FIG;  use FIG;
21  my $fig = new FIG;  my $fig = new FIG;
22    
# Line 47  Line 48 
48    
49  #...Build file of "nearby" PEGs  #...Build file of "nearby" PEGs
50  my $tmp_close = "$FIG_Config::temp/tmp_close_$$.fasta";  my $tmp_close = "$FIG_Config::temp/tmp_close_$$.fasta";
51  system("rm -f $tmp_close*");  system("/bin/rm -f $tmp_close*");
52  foreach $org (@neighbors) {  foreach my $org (@neighbors) {
53      print STDERR "Appending $org to $tmp_close\n" if $ENV{VERBOSE};      print STDERR "Appending $org to $tmp_close\n" if $ENV{VERBOSE};
54      system("cat $FIG_Config::organisms/$org/Features/peg/fasta >> $tmp_close");      system("cat $FIG_Config::organisms/$org/Features/peg/fasta >> $tmp_close");
55  }  }
# Line 59  Line 60 
60  open(TMP_SIMS, ">$tmp_sims")  open(TMP_SIMS, ">$tmp_sims")
61      || die "Could not write-open $tmp_sims";      || die "Could not write-open $tmp_sims";
62  foreach my $orf_id ($to_call->get_fids_for_type('orf')) {  foreach my $orf_id ($to_call->get_fids_for_type('orf')) {
63      $sims = &blast_against($to_call->get_feature_sequence($orf_id), $tmp_close);      my $sims = &blast_against($to_call->get_feature_sequence($orf_id), $tmp_close);
64    
65      if (@$sims) {      if (@$sims) {
66          print STDERR "Promoting $orf_id based on ", (scalar @$sims), " sims\n" if $ENV{VERBOSE};          print STDERR "Promoting $orf_id based on ", (scalar @$sims), " sims\n" if $ENV{VERBOSE};
# Line 77  Line 78 
78  }  }
79  close(TMP_SIMS) || die "Could not close $tmp_sims";  close(TMP_SIMS) || die "Could not close $tmp_sims";
80    
81    #
82    # Disable the auto assignment of the fids we just called.
83    #
84    if (0)
85    {
86  my $tmp_seqs = "$FIG_Config::temp/tmp_seqs.$$";  my $tmp_seqs = "$FIG_Config::temp/tmp_seqs.$$";
87  open(TMP_SEQS, ">$tmp_seqs")  open(TMP_SEQS, ">$tmp_seqs")
88      || die "Could not write-open $tmp_seqs";      || die "Could not write-open $tmp_seqs";
# Line 100  Line 106 
106      }      }
107  }  }
108  close(FOUND) || die "Could not close $found_file";  close(FOUND) || die "Could not close $found_file";
109        unlink($tmp_seqs)  || die "Could not remove $tmp_seqs";
110    }
111    
112  $to_call->promote_remaining_orfs;  $to_call->promote_remaining_orfs;
113  $to_call->export_features;  $to_call->export_features;
114    
115  if (! -s "$to_call_dir/Features/orf/tbl") {  if (! -s "$to_call_dir/Features/orf/tbl") {
116      &FIG::run("rm -fR $to_call_dir/Features/orf");      #
117        # Hrm, weird NFS effects here. There was a failure of this even though the directory
118        # was indeed empty.
119        if (system("/bin/rm -fRv $to_call_dir/Features/orf")) {
120            warn "First remove did not work; sleeping and trying again";
121            sleep(30);
122            system("/bin/rm -fRv $to_call_dir/Features/orf");
123        }
124  }  }
125  else {  else {
126      die "Something is wrong --- $to_call_dir/Features/orf/tbl is non-empty";      die "Something is wrong --- $to_call_dir/Features/orf/tbl is non-empty";
# Line 113  Line 128 
128    
129  unlink($tmp_close) || die "Could not remove $tmp_close";  unlink($tmp_close) || die "Could not remove $tmp_close";
130  unlink($tmp_sims)  || die "Could not remove $tmp_sims";  unlink($tmp_sims)  || die "Could not remove $tmp_sims";
 unlink($tmp_seqs)  || die "Could not remove $tmp_seqs";  
   
   
131    
132    
133    
# Line 130  Line 142 
142    
143      my $sims = [];      my $sims = [];
144      @$sims = map { chomp $_;      @$sims = map { chomp $_;
145                     @x = split(/\t/, $_);                     my @x = split(/\t/, $_);
146                     push @x, ($seq_len, $fig->translation_length($x[1]));                     push @x, ($seq_len, $fig->translation_length($x[1]));
147                     bless( [@x], "Sim" )                     bless( [@x], "Sim" )
148                     } `blastall -i $tmp_seq -d $db -p blastp -m8 -e1.0e-10`;                     } `blastall -i $tmp_seq -d $db -p blastp -m8 -e1.0e-10`;

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

MCS Webmaster
ViewVC Help
Powered by ViewVC 1.0.3