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

View of /FigKernelScripts/p3-get-family-data.pl

Parent Directory Parent Directory | Revision Log Revision Log

Revision 1.6 - (download) (as text) (annotate)
Fri Oct 19 16:06:14 2018 UTC (12 months, 4 weeks ago) by parrello
Branch: MAIN
Changes since 1.5: +1 -1 lines
Changes copied from SEEDtk project.

=head1 Return Data From Protein Families in PATRIC

    p3-get-family-data [options]

This script returns information about each given family. It supports standard filtering
parameters and the specification of additional columns if desired.

=head2 Parameters

There are no positional parameters.

The standard input can be overriddn using the options in L<P3Utils/ih_options>.

Additional command-line options are those given in L<P3Utils/data_options> and L<P3Utils/col_options> plus the following.

=over 4

=item fields

Show available fields.



use strict;
use P3DataAPI;
use P3Utils;

# Get the command-line options.
my $opt = P3Utils::script_opts('', P3Utils::data_options(), P3Utils::col_options(), P3Utils::ih_options(),
        ['fields', 'list the available field names'],
# Get access to PATRIC.
my $p3 = P3DataAPI->new();
if ($opt->fields) {
    my $fieldList = P3Utils::list_object_fields($p3, 'family');
    print join("\n", @$fieldList, "");
} else {
    # Compute the output columns.
    my ($selectList, $newHeaders) = P3Utils::select_clause($p3, family => $opt);
    # Compute the filter.
    my $filterList = P3Utils::form_filter($opt);
    # Open the input file.
    my $ih = P3Utils::ih($opt);
    # Read the incoming headers.
    my ($outHeaders, $keyCol) = P3Utils::process_headers($ih, $opt);
    # Form the full header set and write it out.
    if (! $opt->nohead) {
        push @$outHeaders, @$newHeaders;
    # Loop through the input.
    while (! eof $ih) {
        my $couplets = P3Utils::get_couplets($ih, $keyCol, $opt);
        # Get the output rows for these input couplets.
        my $resultList = P3Utils::get_data_batch($p3, family => $filterList, $selectList, $couplets);
        # Print them.
        for my $result (@$resultList) {
            P3Utils::print_cols($result, opt => $opt);

MCS Webmaster
ViewVC Help
Powered by ViewVC 1.0.3