line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package App::Sandy::Command::Variation::Add; |
2
|
|
|
|
|
|
|
# ABSTRACT: variation subcommand class. Add structural variation to the database. |
3
|
|
|
|
|
|
|
|
4
|
1
|
|
|
1
|
|
1399
|
use App::Sandy::Base 'class'; |
|
1
|
|
|
|
|
3
|
|
|
1
|
|
|
|
|
7
|
|
5
|
|
|
|
|
|
|
|
6
|
|
|
|
|
|
|
extends 'App::Sandy::Command::Variation'; |
7
|
|
|
|
|
|
|
|
8
|
|
|
|
|
|
|
our $VERSION = '0.22'; # VERSION |
9
|
|
|
|
|
|
|
|
10
|
|
|
|
|
|
|
use constant { |
11
|
1
|
|
|
|
|
619
|
TYPE_OPT => ['raw', 'vcf'] |
12
|
1
|
|
|
1
|
|
8
|
}; |
|
1
|
|
|
|
|
3
|
|
13
|
|
|
|
|
|
|
|
14
|
|
|
|
|
|
|
override 'opt_spec' => sub { |
15
|
|
|
|
|
|
|
super, |
16
|
|
|
|
|
|
|
'verbose|v', |
17
|
|
|
|
|
|
|
'structural-variation|a=s', |
18
|
|
|
|
|
|
|
'source|s=s', |
19
|
|
|
|
|
|
|
'sample-name|n=s' |
20
|
|
|
|
|
|
|
}; |
21
|
|
|
|
|
|
|
|
22
|
|
|
|
|
|
|
sub _default_opt { |
23
|
0
|
|
|
0
|
|
|
'verbose' => 0, |
24
|
|
|
|
|
|
|
'type' => 'raw', |
25
|
|
|
|
|
|
|
'source' => 'not defined' |
26
|
|
|
|
|
|
|
} |
27
|
|
|
|
|
|
|
|
28
|
|
|
|
|
|
|
sub validate_args { |
29
|
0
|
|
|
0
|
1
|
|
my ($self, $args) = @_; |
30
|
0
|
|
|
|
|
|
my $file = shift @$args; |
31
|
|
|
|
|
|
|
|
32
|
|
|
|
|
|
|
# Mandatory file |
33
|
0
|
0
|
|
|
|
|
if (not defined $file) { |
34
|
0
|
|
|
|
|
|
die "Missing file (a variation file or vcf file)\n"; |
35
|
|
|
|
|
|
|
} |
36
|
|
|
|
|
|
|
|
37
|
|
|
|
|
|
|
# Is it really a file? |
38
|
0
|
0
|
|
|
|
|
if (not -f $file) { |
39
|
0
|
|
|
|
|
|
die "'$file' is not a file. Please, give me a valid file\n"; |
40
|
|
|
|
|
|
|
} |
41
|
|
|
|
|
|
|
|
42
|
0
|
0
|
|
|
|
|
die "Too many arguments: '@$args'\n" if @$args; |
43
|
|
|
|
|
|
|
} |
44
|
|
|
|
|
|
|
|
45
|
|
|
|
|
|
|
sub validate_opts { |
46
|
0
|
|
|
0
|
1
|
|
my ($self, $opts) = @_; |
47
|
0
|
|
|
|
|
|
my %default_opt = $self->_default_opt; |
48
|
0
|
|
|
|
|
|
$self->fill_opts($opts, \%default_opt); |
49
|
|
|
|
|
|
|
|
50
|
0
|
0
|
|
|
|
|
if (not exists $opts->{'structural-variation'}) { |
51
|
0
|
|
|
|
|
|
die "Mandatory option 'structural-variation' not defined\n"; |
52
|
|
|
|
|
|
|
} |
53
|
|
|
|
|
|
|
} |
54
|
|
|
|
|
|
|
|
55
|
|
|
|
|
|
|
sub execute { |
56
|
0
|
|
|
0
|
1
|
|
my ($self, $opts, $args) = @_; |
57
|
0
|
|
|
|
|
|
my $file = shift @$args; |
58
|
|
|
|
|
|
|
|
59
|
0
|
|
|
|
|
|
my %default_opt = $self->_default_opt; |
60
|
0
|
|
|
|
|
|
$self->fill_opts($opts, \%default_opt); |
61
|
|
|
|
|
|
|
|
62
|
|
|
|
|
|
|
# Set the type of file |
63
|
0
|
0
|
|
|
|
|
if ($file =~ /^.+\.vcf(\.gz)?$/) { |
64
|
0
|
|
|
|
|
|
$opts->{'type'} = 'vcf'; |
65
|
|
|
|
|
|
|
} |
66
|
|
|
|
|
|
|
|
67
|
|
|
|
|
|
|
# Set if user wants a verbose log |
68
|
0
|
|
|
|
|
|
$LOG_VERBOSE = $opts->{verbose}; |
69
|
|
|
|
|
|
|
|
70
|
|
|
|
|
|
|
# Go go go |
71
|
0
|
|
|
|
|
|
log_msg ":: Inserting $opts->{'structural-variation'} from $file ..."; |
72
|
|
|
|
|
|
|
$self->insertdb( |
73
|
|
|
|
|
|
|
$file, |
74
|
|
|
|
|
|
|
$opts->{'structural-variation'}, |
75
|
|
|
|
|
|
|
$opts->{'source'}, |
76
|
|
|
|
|
|
|
1, |
77
|
|
|
|
|
|
|
$opts->{'type'}, |
78
|
0
|
|
|
|
|
|
$opts->{'sample-name'} |
79
|
|
|
|
|
|
|
); |
80
|
|
|
|
|
|
|
|
81
|
0
|
|
|
|
|
|
log_msg ":: Done!"; |
82
|
|
|
|
|
|
|
} |
83
|
|
|
|
|
|
|
|
84
|
|
|
|
|
|
|
__END__ |
85
|
|
|
|
|
|
|
|
86
|
|
|
|
|
|
|
=pod |
87
|
|
|
|
|
|
|
|
88
|
|
|
|
|
|
|
=encoding UTF-8 |
89
|
|
|
|
|
|
|
|
90
|
|
|
|
|
|
|
=head1 NAME |
91
|
|
|
|
|
|
|
|
92
|
|
|
|
|
|
|
App::Sandy::Command::Variation::Add - variation subcommand class. Add structural variation to the database. |
93
|
|
|
|
|
|
|
|
94
|
|
|
|
|
|
|
=head1 VERSION |
95
|
|
|
|
|
|
|
|
96
|
|
|
|
|
|
|
version 0.22 |
97
|
|
|
|
|
|
|
|
98
|
|
|
|
|
|
|
=head1 SYNOPSIS |
99
|
|
|
|
|
|
|
|
100
|
|
|
|
|
|
|
sandy variation add -a <entry name> [-s <source>] FILE |
101
|
|
|
|
|
|
|
|
102
|
|
|
|
|
|
|
Arguments: |
103
|
|
|
|
|
|
|
a file (VCF or a structural variation file) |
104
|
|
|
|
|
|
|
|
105
|
|
|
|
|
|
|
Mandatory options: |
106
|
|
|
|
|
|
|
-a, --structural-variation a structural variation name |
107
|
|
|
|
|
|
|
|
108
|
|
|
|
|
|
|
Options: |
109
|
|
|
|
|
|
|
-h, --help brief help message |
110
|
|
|
|
|
|
|
-u, --man full documentation |
111
|
|
|
|
|
|
|
-v, --verbose print log messages |
112
|
|
|
|
|
|
|
-s, --source structural variation source detail for database |
113
|
|
|
|
|
|
|
-n, --sample-name the VCF sample column to be used |
114
|
|
|
|
|
|
|
|
115
|
|
|
|
|
|
|
=head1 DESCRIPTION |
116
|
|
|
|
|
|
|
|
117
|
|
|
|
|
|
|
Add structural-variation to the database. |
118
|
|
|
|
|
|
|
|
119
|
|
|
|
|
|
|
=head1 AUTHORS |
120
|
|
|
|
|
|
|
|
121
|
|
|
|
|
|
|
=over 4 |
122
|
|
|
|
|
|
|
|
123
|
|
|
|
|
|
|
=item * |
124
|
|
|
|
|
|
|
|
125
|
|
|
|
|
|
|
Thiago L. A. Miller <tmiller@mochsl.org.br> |
126
|
|
|
|
|
|
|
|
127
|
|
|
|
|
|
|
=item * |
128
|
|
|
|
|
|
|
|
129
|
|
|
|
|
|
|
J. Leonel Buzzo <lbuzzo@mochsl.org.br> |
130
|
|
|
|
|
|
|
|
131
|
|
|
|
|
|
|
=item * |
132
|
|
|
|
|
|
|
|
133
|
|
|
|
|
|
|
Felipe R. C. dos Santos <fsantos@mochsl.org.br> |
134
|
|
|
|
|
|
|
|
135
|
|
|
|
|
|
|
=item * |
136
|
|
|
|
|
|
|
|
137
|
|
|
|
|
|
|
Helena B. Conceição <hconceicao@mochsl.org.br> |
138
|
|
|
|
|
|
|
|
139
|
|
|
|
|
|
|
=item * |
140
|
|
|
|
|
|
|
|
141
|
|
|
|
|
|
|
Gabriela Guardia <gguardia@mochsl.org.br> |
142
|
|
|
|
|
|
|
|
143
|
|
|
|
|
|
|
=item * |
144
|
|
|
|
|
|
|
|
145
|
|
|
|
|
|
|
Fernanda Orpinelli <forpinelli@mochsl.org.br> |
146
|
|
|
|
|
|
|
|
147
|
|
|
|
|
|
|
=item * |
148
|
|
|
|
|
|
|
|
149
|
|
|
|
|
|
|
Pedro A. F. Galante <pgalante@mochsl.org.br> |
150
|
|
|
|
|
|
|
|
151
|
|
|
|
|
|
|
=back |
152
|
|
|
|
|
|
|
|
153
|
|
|
|
|
|
|
=head1 COPYRIGHT AND LICENSE |
154
|
|
|
|
|
|
|
|
155
|
|
|
|
|
|
|
This software is Copyright (c) 2018 by Teaching and Research Institute from SÃrio-Libanês Hospital. |
156
|
|
|
|
|
|
|
|
157
|
|
|
|
|
|
|
This is free software, licensed under: |
158
|
|
|
|
|
|
|
|
159
|
|
|
|
|
|
|
The GNU General Public License, Version 3, June 2007 |
160
|
|
|
|
|
|
|
|
161
|
|
|
|
|
|
|
=cut |