lib/App/Sandy/Command/Variation/Dump.pm

filter: Statementstmt 100% 3 / 3 Branchbran n/a Conditioncond n/a MC/DCmcdc n/a Subroutinesub 100% 1 / 1 Podpod n/a totaltotal 100% 4 / 4 CC 1 SCAR 0.0
CC
1
Cov
100%
BEGIN
1.0
CRAP 1.0
« lib/App/Sandy/Command/Variation/Add.pm ↑ Summary lib/App/Sandy/Command/Variation/Remove.pm »
1 package App::Sandy::Command::Variation::Dump;
2 # ABSTRACT: variation subcommand class. Dump structural variation from database.
3  
4 1 ▶use App::Sandy::Base 'class';
Subroutine BEGIN: called CC=1 SCAR=0.0
5  
6 extends 'App::Sandy::Command::Variation';
7  
8 our $VERSION = '0.25'; # VERSION
9  
10 sub validate_args {
11 my ($self, $args) = @_;
12 my $structural_variation = shift @$args;
13  
14 # Mandatory file
15 if (not defined $structural_variation) {
16 die "Missing structural variation\n";
17 }
18  
19 die "Too many arguments: '@$args'\n" if @$args;
20 }
21  
22 sub execute {
23 my ($self, $opts, $args) = @_;
24  
25 my $variation = $self->retrievedb($args);
26 print "#seqid\tposition\tid\treference\talternate\tgenotype\n";
27  
28 for my $id (sort keys %$variation) {
29 my $data = $variation->{$id};
30 for my $entry (@$data) {
31 # Index begins at 1 outside perl
32 $entry->{pos}++;
33 print "$entry->{seq_id}\t$entry->{pos}\t$entry->{id}\t$entry->{ref}\t$entry->{alt}\t$entry->{plo}\n";
34 }
35 }
36 }
37  
38 __END__
« lib/App/Sandy/Command/Variation/Add.pm ↑ Summary lib/App/Sandy/Command/Variation/Remove.pm »