[Bio] / FigTutorial / features_around.pl Repository:
ViewVC logotype

Annotation of /FigTutorial/features_around.pl

Parent Directory Parent Directory | Revision Log Revision Log


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

1 : olson 1.2
2 :     use strict;
3 :     my($usage,$id,$fid,$peg,$loc,$contig,$beg,$end,$start_reg,$end_reg);
4 :     my($loc1,$aliases1,$trunc,$pseq,$prot_ln,$func,$features_in_region);
5 :     my($start_of_leftmost_feature,$end_of_rightmost_feature);
6 :     my($genome);
7 :    
8 :     use FIG;
9 :     my $fig = new FIG;
10 :    
11 :     $usage = "usage: features_around ID";
12 :    
13 :     ($id = shift @ARGV)
14 :     || die $usage;
15 :    
16 :     if ($peg = $fig->by_alias($id))
17 :     {
18 :     if ($loc = $fig->feature_location($peg))
19 :     {
20 :     ($contig,$beg,$end) = $fig->boundaries_of($loc);
21 :     if (defined($contig))
22 :     {
23 :     $start_reg = &FIG::min($beg,$end) - 5000;
24 :     $end_reg = &FIG::max($beg,$end) + 5000;
25 :     $genome = &FIG::genome_of($peg);
26 :     ($features_in_region,$start_of_leftmost_feature,$end_of_rightmost_feature) =
27 :     $fig->genes_in_region($genome,$contig,$start_reg,$end_reg);
28 :     foreach $fid (@$features_in_region)
29 :     {
30 :     $loc1 = $fig->feature_location($fid);
31 :     $aliases1 = $fig->feature_aliases($fid);
32 :     $trunc = $fig->possibly_truncated($fid);
33 :    
34 :     $pseq = $func = $prot_ln = "";
35 :    
36 :     if (&FIG::ftype($fid) eq "peg")
37 :     {
38 :     if ($prot_ln = $fig->translation_length($fid))
39 :     {
40 :     $pseq = $fig->get_translation($fid);
41 :     $func = $fig->function_of($fid);
42 :     }
43 :     }
44 :     print join("\t",($fid,$loc1,$aliases1,$trunc,$func,$prot_ln,$pseq)),"\n";
45 :     }
46 :     }
47 :     }
48 :     else
49 :     {
50 :     print STDERR "Sorry, could not get the location of $fid\n";
51 :     }
52 :     }
53 :     else
54 :     {
55 :     print STDERR "Sorry, could not figure out which PEG you meant by $id\n";
56 :     }

MCS Webmaster
ViewVC Help
Powered by ViewVC 1.0.3