| 1 | package Bioinfo::App::Cmd::Fasta::Cmd::GetByID; | ||
| 2 | use Modern::Perl; | ||
| 3 | use Moo; | ||
| 4 | use Bioinfo::Fasta; | ||
| 5 | use MooX::Cmd; | ||
| 6 | use MooX::Options prefer_commandline => 1; | ||
| 7 | use IO::All; | ||
| 8 | use Data::Dumper; | ||
| 9 | |||
| 10 | our $VERSION = '0.1.14'; # VERSION: | ||
| 11 | # ABSTRACT: my perl module and CLIs for Biology | ||
| 12 | |||
| 13 | |||
| 14 | option input => ( | ||
| 15 | is => 'ro', | ||
| 16 | required => 1, | ||
| 17 | format => 's', | ||
| 18 | short => 'i', | ||
| 19 | doc => 'a file of seq id, one per line' | ||
| 20 | ); | ||
| 21 | |||
| 22 | |||
| 23 | option db => ( | ||
| 24 | is => 'ro', | ||
| 25 | format => 's', | ||
| 26 | short => 'd', | ||
| 27 | doc => 'fasta file', | ||
| 28 | ); | ||
| 29 | |||
| 30 | |||
| 31 | option output => ( | ||
| 32 | is => 'ro', | ||
| 33 | format => 's', | ||
| 34 | short => 'o', | ||
| 35 | doc => 'output file', | ||
| 36 | ); | ||
| 37 | |||
| 38 | |||
| 39 | sub execute { | ||
| 40 | my ($self, $args_ref, $chain_ref) = @_; | ||
| 41 | $self->options_usage unless (@$args_ref); | ||
| 42 | my $input = $self->input; | ||
| 43 | my $output = $self->output; | ||
| 44 | my $db = $self->db; | ||
| 45 | |||
| 46 | say "input:$input\toutput:$output\tdb:$db"; | ||
| 47 | my $fas_obj = Bioinfo::Fasta->new(file => $db); | ||
| 48 | $fas_obj->get_seqs_batch("$input", $output); | ||
| 49 | } | ||
| 50 | |||
| 51 | 1; | ||
| 52 | |||
| 53 | __END__ | ||
| 54 | |||
| 55 | =pod | ||
| 56 | |||
| 57 | =encoding UTF-8 | ||
| 58 | |||
| 59 | =head1 NAME | ||
| 60 | |||
| 61 | Bioinfo::App::Cmd::Fasta::Cmd::GetByID - my perl module and CLIs for Biology | ||
| 62 | |||
| 63 | =head1 VERSION | ||
| 64 | |||
| 65 | version 0.1.14 | ||
| 66 | |||
| 67 | =head1 SYNOPSIS | ||
| 68 | |||
| 69 | use Bioinfo::App::Cmd::Fasta::Cmd::GetByID; | ||
| 70 | ... | ||
| 71 | |||
| 72 | =head1 DESCRIPTION | ||
| 73 | |||
| 74 | =head1 ATTRIBUTES | ||
| 75 | |||
| 76 | =head2 input | ||
| 77 | |||
| 78 | The input file is a file of seq id(one per line) | ||
| 79 | |||
| 80 | =head2 db | ||
| 81 | |||
| 82 | path of fasta file | ||
| 83 | |||
| 84 | =head2 output | ||
| 85 | |||
| 86 | path of output file | ||
| 87 | |||
| 88 | =head1 METHODS | ||
| 89 | |||
| 90 | =head2 execute | ||
| 91 | |||
| 92 | =head1 AUTHOR | ||
| 93 | |||
| 94 | Yan Xueqing <yanxueqing621@163.com> | ||
| 95 | |||
| 96 | =head1 COPYRIGHT AND LICENSE | ||
| 97 | |||
| 98 | This software is copyright (c) 2017 by Yan Xueqing. | ||
| 99 | |||
| 100 | This is free software; you can redistribute it and/or modify it under | ||
| 101 | the same terms as the Perl 5 programming language system itself. | ||
| 102 | |||
| 103 | =cut |