Bio-MUST-Core

 view release on metacpan or  search on metacpan

bin/export-itol.pl  view on Meta::CPAN

# TODO: use standard BMC error message scheme
sub message {
    my $response = shift;
    my $outfile  = shift;

    if ( $response->is_success() ) {
        my @res = split /\n/xms, $response->content;

        # check for export error
        if ($response->header('Content-type') =~ /text\/html/xms) {
            warn <<"EOT";
Warning: export failed. iTOL returned the following error message:
$res[0]
EOT
        }

        # if no warnings, export tree to outfile
        else {
            ### Exporting tree to: $outfile
            open my $out, '>', $outfile;
            say {$out} join "\n", @res;
        }
    }

    else {
        warn <<"EOT";
Warning: iTOL returned a web server error; full message follows:
EOT
        print $response->as_string;
    }

    return;
}

__END__

=pod

=head1 NAME

export-itol.pl - Download formatted trees from iTOL

=head1 VERSION

version 0.252040

=head1 USAGE

    export-itol.pl <infiles> [optional arguments]

=head1 REQUIRED ARGUMENTS

This script is based on C<iTOL_downloader.pl>.

=over

=item <infiles>

Path to input TSV tree id files [repeatable argument].

Such files are generated when uploading trees with the script L<import-itol.pl>.

=for Euclid: infiles.type: readable
    repeatable

=back

=head1 OPTIONS

=over

=item --config=<file>

Path to input INI config file. When not specified, INI config files must have
the same basename as C<infiles> (but see C<--in-strip> below) [default: none].

A config file requires at least the C<format> argument. Supported outfile
formats are: C<svg>, C<pdf>, C<eps>, C<ps>, C<png>, C<newick>, C<nexus> and
C<phyloxml>.

To display all optional parameters and values, see iTOL help page:
L<https://itol.embl.de/help.cgi#bExOpt>

An example of INI config file follows:

    format=svg
    dpi=300
    display_mode=2
    current_font_name=Courier
    datasets_visible=3
    range_mode=2
    include_ranges_legend=1

=for Euclid: file.type: readable

=item --in[-strip]=<str>

Substring(s) to strip from infile basenames before attempting to derive INI
infiles [default: none].

=for Euclid: str.type: string
    repeatable

=item --out[-suffix]=<suffix>

Suffix to append to tree file basenames for deriving outfile names [default:
none].

=for Euclid: suffix.type: string

=item --version

=item --usage

=item --help

=item --man

Print the usual program information

=back



( run in 1.554 second using v1.01-cache-2.11-cpan-b16cb0d3907 )