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

Annotation of /FigKernelScripts/find_special_proteins.pl

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1.4 - (view) (download) (as text)

1 : gdpusch 1.1 # -*- perl -*-
2 :     ########################################################################
3 :     # Copyright (c) 2003-2006 University of Chicago and Fellowship
4 :     # for Interpretations of Genomes. All Rights Reserved.
5 :     #
6 :     # This file is part of the SEED Toolkit.
7 :     #
8 :     # The SEED Toolkit is free software. You can redistribute
9 :     # it and/or modify it under the terms of the SEED Toolkit
10 :     # Public License.
11 :     #
12 :     # You should have received a copy of the SEED Toolkit Public License
13 :     # along with this program; if not write to the University of Chicago
14 :     # at info@ci.uchicago.edu or the Fellowship for Interpretation of
15 :     # Genomes at veronika@thefig.info or download a copy from
16 :     # http://www.theseed.org/LICENSE.TXT.
17 :     ########################################################################
18 :    
19 :     use strict;
20 :     use warnings;
21 :    
22 : gdpusch 1.3 $0 =~ m/([^\/]+)$/o;
23 :     my $self = $1;
24 : gdpusch 1.1 my $usage = "usage: find_special_proteins [-h(elp)] To_Call_Dir [old]";
25 :    
26 :     use FIG;
27 :     # use FIGV;
28 :     my $fig = new FIG;
29 :    
30 :     use NewGenome;
31 :     use ToCall;
32 :    
33 :     if (@ARGV && ($ARGV[0] =~ m/-h(elp)?/)) {
34 :     print STDERR "\n $usage\n\n";
35 :     exit (0);
36 :     }
37 :    
38 :     my $to_call_dir;
39 :     ($to_call_dir = shift @ARGV) || die "\n $usage\n\n";
40 :    
41 :     ### This is a bit complex. Normally, one uses this program to call genes
42 :     # in a newly-sequenced genome. In this case the functionality of NewGenome.pm
43 :     # is needed. To call genes in an existing genome (to, for example, see how well
44 :     # we are doing) you would use ToCall.pm.
45 :    
46 :     my ($to_call, $keep);
47 :     if ((@ARGV > 0) && ($ARGV[0] =~ /^old/i)) {
48 :     $keep = 1;
49 :     $to_call = new ToCall($to_call_dir);
50 :     }
51 :     else {
52 :     $to_call = NewGenome->new($to_call_dir);
53 :     }
54 :    
55 : gdpusch 1.4 my $special_pegs_file = $keep ? qq(/dev/null) : qq($to_call_dir/special_pegs);
56 : gdpusch 1.3 open(SPECIAL_PEGS, ">>$special_pegs_file")
57 :     || die "Could not append-open $special_pegs_file";
58 :    
59 : gdpusch 1.4 my $called_by_file = $keep ? qq(/dev/null) : qq($to_call_dir/called_by);
60 :     open(CALLED_BY, ">>$called_by_file")
61 : gdpusch 1.3 || die "Could not append-open $called_by_file";
62 : gdpusch 1.2
63 : gdpusch 1.1 my @results = ();
64 :     my $contigs_file = $to_call->get_genome_dir() . qq(/contigs);
65 :    
66 :     push @results, `find_selenoproteins < $contigs_file`;
67 :     push @results, `find_selenoproteins -p < $contigs_file`;
68 :    
69 :     chomp @results;
70 :     foreach my $result (@results) {
71 :     if ($keep) {
72 : gdpusch 1.2 #...Do nothing.
73 : gdpusch 1.1 }
74 :     else {
75 : gdpusch 1.3
76 : gdpusch 1.2 my ($loc, $seq, $type, $func) = split /\t/o, $result;
77 :     my $fid = $to_call->add_feature(
78 : gdpusch 1.3 -type => qq(peg),
79 :     -loc => $to_call->from_seed_loc($loc),
80 :     -seq => $seq,
81 :     -func => ($func || $type),
82 :     -annot => [qq(RAST), qq($func\nCalled by "$self".)]
83 : gdpusch 1.2 );
84 :    
85 :     print SPECIAL_PEGS "$fid\t$type\n";
86 : gdpusch 1.3 print CALLED_BY "$fid\t$self\n";
87 : gdpusch 1.1 }
88 :     }
89 :    
90 : gdpusch 1.3 close(CALLED_BY) || die "Could not close $called_by_file";
91 :    
92 : gdpusch 1.2 close(SPECIAL_PEGS) || die "Could not close $special_pegs_file";
93 :     if (!-s $special_pegs_file) {
94 :     system("rm -f $special_pegs_file");
95 :     }
96 :    
97 : gdpusch 1.1 if (not $keep) {
98 :     $to_call->export_features();
99 :     }
100 :    
101 : gdpusch 1.2 exit(0);
102 : gdpusch 1.1

MCS Webmaster
ViewVC Help
Powered by ViewVC 1.0.3