Parent Directory
|
Revision Log
Revision 1.5 - (view) (download) (as text)
1 : | parrello | 1.1 | =head1 Return Data From Contigs in PATRIC |
2 : | |||
3 : | p3-get-genome-contigs [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 : | parrello | 1.2 | The standard input can be overriddn using the options in L<P3Utils/ih_options>. |
13 : | parrello | 1.1 | |
14 : | parrello | 1.2 | Additional command-line options are those given in L<P3Utils/data_options> and L<P3Utils/col_options> plus the following. |
15 : | |||
16 : | =over 4 | ||
17 : | |||
18 : | =item fields | ||
19 : | |||
20 : | Display the available field names. | ||
21 : | |||
22 : | =back | ||
23 : | parrello | 1.1 | |
24 : | =cut | ||
25 : | |||
26 : | use strict; | ||
27 : | use P3DataAPI; | ||
28 : | use P3Utils; | ||
29 : | |||
30 : | # Get the command-line options. | ||
31 : | my $opt = P3Utils::script_opts('', P3Utils::data_options(), P3Utils::col_options(), P3Utils::ih_options(), | ||
32 : | ['fields|f', 'Show available fields']); | ||
33 : | |||
34 : | parrello | 1.5 | # Get access to PATRIC. |
35 : | my $p3 = P3DataAPI->new(); | ||
36 : | parrello | 1.1 | my $fields = ($opt->fields ? 1 : 0); |
37 : | if ($fields) { | ||
38 : | print_usage(); | ||
39 : | exit(); | ||
40 : | } | ||
41 : | # Compute the output columns. | ||
42 : | parrello | 1.3 | my ($selectList, $newHeaders) = P3Utils::select_clause($p3, contig => $opt); |
43 : | parrello | 1.1 | # Compute the filter. |
44 : | my $filterList = P3Utils::form_filter($opt); | ||
45 : | # Open the input file. | ||
46 : | my $ih = P3Utils::ih($opt); | ||
47 : | # Read the incoming headers. | ||
48 : | my ($outHeaders, $keyCol) = P3Utils::process_headers($ih, $opt); | ||
49 : | # Form the full header set and write it out. | ||
50 : | parrello | 1.2 | if (! $opt->nohead) { |
51 : | push @$outHeaders, @$newHeaders; | ||
52 : | P3Utils::print_cols($outHeaders); | ||
53 : | } | ||
54 : | parrello | 1.1 | # Loop through the input. |
55 : | while (! eof $ih) { | ||
56 : | my $couplets = P3Utils::get_couplets($ih, $keyCol, $opt); | ||
57 : | # Get the output rows for these input couplets. | ||
58 : | my $resultList = P3Utils::get_data($p3, contig => $filterList, $selectList, genome_id => $couplets); | ||
59 : | # Print them. | ||
60 : | for my $result (@$resultList) { | ||
61 : | P3Utils::print_cols($result); | ||
62 : | } | ||
63 : | } | ||
64 : | |||
65 : | sub print_usage { | ||
66 : | parrello | 1.4 | my $fieldList = P3Utils::list_object_fields($p3, 'contig'); |
67 : | parrello | 1.1 | print join("\n", @$fieldList, ""); |
68 : | } |
MCS Webmaster | ViewVC Help |
Powered by ViewVC 1.0.3 |