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

Annotation of /FigKernelScripts/svr_in_runs.pl

Parent Directory Parent Directory | Revision Log Revision Log


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

1 : parrello 1.1 #!/usr/bin/perl -w
2 : parrello 1.4 use strict;
3 : parrello 1.1 use SAPserver;
4 :     use Getopt::Long;
5 :    
6 : parrello 1.4 # This is a SAS component.
7 :    
8 :     =head1 svr_in_runs
9 :    
10 : parrello 1.5 svr_in_runs <groups.tbl >operons.tbl
11 :    
12 : parrello 1.4 Make sequences of genes into operons.
13 :    
14 :     This script takes as input groups of genes and finds all the operons containing
15 :     genes in each group. For the purposes of this script, an operon is a sequence of
16 :     genes that are close together on the same contig and pointing in the same direction.
17 :     The operons may contain other genes in the vicinity of the ones specified in the
18 :     original input.
19 :    
20 :     The input must be a tab-delimited file. Each group should be the last field on
21 :     a line, and must be specified as a comma-separated list of FIG IDs. The operons
22 :     will also be rendered as a comma-separated list of FIG IDs. The output will consist
23 :     of the input lines with operons tacked onto the end. Since a group may
24 :     contain multiple operons, a single input line may produce multiple output lines.
25 :    
26 :     This is a pipe command: the input is taken from the standard input and the output
27 :     is to the standard output.
28 :    
29 :     =head2 Command-Line Options
30 :    
31 :     =over 4
32 :    
33 :     =item MaxGap
34 : parrello 1.1
35 : parrello 1.4 Maximum number of base pairs that can be between to genes in order for them to
36 :     be considered as part of the same operon. The default is 200.
37 :    
38 :     =item JustFirst
39 :    
40 :     If specified, then only the first gene in an operon will be included in the output.
41 :    
42 :     =item url
43 :    
44 :     The URL for the Sapling server, if it is to be different from the default.
45 :    
46 :     =back
47 :    
48 :     =cut
49 : parrello 1.1
50 :     my $MaxGap = 0;
51 :     my $JustFirst = 0;
52 :    
53 :     $0 =~ m/([^\/]+)$/;
54 :     my $self = $1;
55 : parrello 1.4 my $usage = "$self [--MaxGap=N --JustFirst --url=http://... ] <input >output";
56 : parrello 1.1
57 : parrello 1.4 my $rc = GetOptions("MaxGap=i" => \$MaxGap, "JustFirst" => \$JustFirst);
58 : parrello 1.1
59 :     if (!$rc) {
60 :     die "\n usage: $usage\n\n";
61 :     }
62 :    
63 :     my $ss = SAPserver->new();
64 :    
65 :     my %args;
66 :    
67 :     if ($JustFirst) {
68 : parrello 1.3 $args{-justFirst} = $JustFirst;
69 : parrello 1.1 }
70 :     if ($MaxGap) {
71 : parrello 1.3 $args{-maxGap} = $MaxGap;
72 : parrello 1.1 }
73 :    
74 :     my $line;
75 :     while (defined($line = <STDIN>)) {
76 :     # Remove the new-line.
77 :     chomp $line;
78 :     # Get the fields in the line.
79 :     my @fields = split /\t/, $line;
80 : parrello 1.2 # The last field is the group.
81 : parrello 1.3 $args{-groups} = [$fields[$#fields]];
82 : parrello 1.2 # Make the runs for this group.
83 :     my $res = $ss->make_runs(%args);
84 :     # Output the result.
85 :     foreach my $run (@{$res->{0}}) {
86 :     print join("\t", $line, $run) . "\n";
87 : parrello 1.1 }
88 :     }
89 :    
90 : parrello 1.4

MCS Webmaster
ViewVC Help
Powered by ViewVC 1.0.3