[Bio] / FigKernelScripts / p3-get-genome-contigs.pl Repository:
ViewVC logotype

View of /FigKernelScripts/p3-get-genome-contigs.pl

Parent Directory Parent Directory | Revision Log Revision Log

Revision 1.2 - (download) (as text) (annotate)
Tue Aug 8 19:18:41 2017 UTC (2 years, 5 months ago) by parrello
Branch: MAIN
Changes since 1.1: +14 -4 lines
Changes from SEEDtk

=head1 Return Data From Contigs in PATRIC

    p3-get-genome-contigs [options]

This script returns data about the contigs for the genomes identified in the standard input. 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

Display the available field names.



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|f', 'Show available fields']);

my $fields = ($opt->fields ? 1 : 0);
if ($fields) {
# Get access to PATRIC.
my $p3 = P3DataAPI->new();
# Compute the output columns.
my ($selectList, $newHeaders) = P3Utils::select_clause(contig => $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($p3, contig => $filterList, $selectList, genome_id => $couplets);
    # Print them.
    for my $result (@$resultList) {

sub print_usage {
    my $fieldList = P3Utils::list_object_fields('contig');
    print join("\n", @$fieldList, "");

MCS Webmaster
ViewVC Help
Powered by ViewVC 1.0.3