[Bio] / FigKernelScripts / p3-get-contig-data.pl Repository:
ViewVC logotype

Annotation of /FigKernelScripts/p3-get-contig-data.pl

Parent Directory Parent Directory | Revision Log Revision Log


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

1 : parrello 1.1 =head1 Return Data From Contigs in PATRIC
2 :    
3 :     p3-get-contigs-data [options]
4 :    
5 :     This script returns data about the contigs for the genomes identified in the standard input. It supports standard filtering
6 :     parameters and the specification of additional columns if desired.
7 :    
8 :     =head2 Parameters
9 :    
10 :     There are no positional parameters.
11 :    
12 :     The standard input can be overwritten using the options in L<P3Utils/ih_options>.
13 :    
14 :     Additional command-line options are those given in L<P3Utils/data_options> and L<P3Utils/col_options>.
15 :    
16 :     =cut
17 :    
18 :     use strict;
19 :     use P3DataAPI;
20 :     use P3Utils;
21 :    
22 :     # Get the command-line options.
23 :     my $opt = P3Utils::script_opts('', P3Utils::data_options(), P3Utils::col_options(), P3Utils::ih_options(),
24 :     ['fields|f', 'Show available fields']);
25 :    
26 :     my $fields = ($opt->fields ? 1 : 0);
27 :     if ($fields) {
28 :     print_usage();
29 :     exit();
30 :     }
31 :     # Get access to PATRIC.
32 :     my $p3 = P3DataAPI->new();
33 :     # Compute the output columns.
34 :     my ($selectList, $newHeaders) = P3Utils::select_clause(contig => $opt);
35 :     # Compute the filter.
36 :     my $filterList = P3Utils::form_filter($opt);
37 :     # Open the input file.
38 :     my $ih = P3Utils::ih($opt);
39 :     # Read the incoming headers.
40 :     my ($outHeaders, $keyCol) = P3Utils::process_headers($ih, $opt);
41 :     # Form the full header set and write it out.
42 :     push @$outHeaders, @$newHeaders;
43 :     P3Utils::print_cols($outHeaders);
44 :     # Loop through the input.
45 :     while (! eof $ih) {
46 :     my $couplets = P3Utils::get_couplets($ih, $keyCol, $opt);
47 :     # Get the output rows for these input couplets.
48 :     my $resultList = P3Utils::get_data($p3, contig => $filterList, $selectList, genome_id => $couplets);
49 :     # Print them.
50 :     for my $result (@$resultList) {
51 :     P3Utils::print_cols($result);
52 :     }
53 :     }
54 :    
55 :     sub print_usage {
56 : parrello 1.2 my $fieldList = P3Utils::list_object_fields('contig');
57 :     print join("\n", @$fieldList, "");
58 : parrello 1.1 }

MCS Webmaster
ViewVC Help
Powered by ViewVC 1.0.3