Bio-MUST-Core

 view release on metacpan or  search on metacpan

bin/fetch-tax.pl  view on Meta::CPAN

#!/usr/bin/env perl
# PODNAME: fetch-tax.pl
# ABSTRACT: Fetch (and format) information from the NCBI Taxonomy database

use Modern::Perl '2011';
use autodie;

use Getopt::Euclid qw(:vars);
use List::AllUtils qw(apply each_array);
use Scalar::Util qw(looks_like_number);
use Smart::Comments;

use Bio::MUST::Core;
use Bio::MUST::Core::Constants qw(:ncbi);
use Bio::MUST::Core::Utils qw(change_suffix);
use aliased 'Bio::MUST::Core::IdList';
use aliased 'Bio::MUST::Core::SeqId';
use aliased 'Bio::MUST::Core::Taxonomy';


# build taxonomy object
my $tax = Taxonomy->new_from_cache( tax_dir => $ARGV_taxdir );

# setup org-mapper (or NOM) IDM format if required
my $suffix = '.tax';
my $sep = "\t";
my $sort = 0;
my $classifier;
if ($ARGV_org_mapper) {
    $ARGV_noitem    = 1;
    $ARGV_nomustid  = 0;
    $ARGV_notaxid   = 0;
    $ARGV_nolineage = 1;
    $suffix = '.org-idm';
}
if ($ARGV_legacy_nom) {
    $ARGV_noitem    = 0;                    # give precedence to items
    $ARGV_nomustid  = 1;                    # to ensure back-compatibility
    $ARGV_notaxid   = 1;
    $ARGV_nolineage = 0;
    $suffix = '.nom';
    $sep = q{ , };
    $sort = 1;
    $ARGV_missing ||= 'UNKNOWN';            # default to q{} in Euclid...
    @ARGV_levels = ( $ARGV_legacy_nom );

    # build classifier for legacy NOM file if legacy_nom is a readable FRA file
    $classifier = $tax->tax_labeler_from_systematic_frame($ARGV_legacy_nom)
        if $ARGV_legacy_nom =~ m/.fra$/xmgi && -e $ARGV_legacy_nom;
}

if (@ARGV_levels) {
    ### Specified levels: @ARGV_levels
}

### --item-type: $ARGV_item_type

# method, args and anon sub dispatch tables...
# ... for reading infiles
my $method = $ARGV_from_must ? 'load_lis' : 'load';
my $args = {
    column    => $ARGV_column - 1,      # 0-based numbering in lib
    separator => $ARGV_separator,
};

 view all matches for this distribution
 view release on metacpan -  search on metacpan

( run in 1.710 second using v1.00-cache-2.02-grep-82fe00e-cpan-f73e49a70403 )