line |
bran |
sub |
pod |
code |
1
|
|
|
|
package Sanger::CGP::Vagrent::Data::Insertion; |
2
|
|
|
|
|
3
|
|
|
|
##########LICENCE########## |
4
|
|
|
|
# Copyright (c) 2014 Genome Research Ltd. |
5
|
|
|
|
# |
6
|
|
|
|
# Author: Cancer Genome Project cgpit@sanger.ac.uk |
7
|
|
|
|
# |
8
|
|
|
|
# This file is part of VAGrENT. |
9
|
|
|
|
# |
10
|
|
|
|
# VAGrENT is free software: you can redistribute it and/or modify it under |
11
|
|
|
|
# the terms of the GNU Affero General Public License as published by the Free |
12
|
|
|
|
# Software Foundation; either version 3 of the License, or (at your option) any |
13
|
|
|
|
# later version. |
14
|
|
|
|
# |
15
|
|
|
|
# This program is distributed in the hope that it will be useful, but WITHOUT |
16
|
|
|
|
# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS |
17
|
|
|
|
# FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for more |
18
|
|
|
|
# details. |
19
|
|
|
|
# |
20
|
|
|
|
# You should have received a copy of the GNU Affero General Public License |
21
|
|
|
|
# along with this program. If not, see <http://www.gnu.org/licenses/>. |
22
|
|
|
|
##########LICENCE########## |
23
|
|
|
|
|
24
|
|
|
|
|
25
|
|
1
|
|
use strict; |
26
|
|
1
|
|
use Data::Dumper; |
27
|
|
1
|
|
use Sanger::CGP::Vagrent qw($VERSION); |
28
|
|
1
|
|
use base qw(Sanger::CGP::Vagrent::Data::AbstractGenomicPosition Sanger::CGP::Vagrent::Data::AbstractVariation); |
29
|
|
|
|
|
30
|
|
|
|
1; |
31
|
|
|
|
|
32
|
|
|
|
sub _init { |
33
|
|
194
|
|
my $self = shift; |
34
|
|
|
|
my %vars = @_; |
35
|
|
|
|
foreach my $k(keys(%vars)){ |
36
|
100
|
|
|
if($k eq 'insseq'){ |
37
|
|
|
|
$self->{_insseq} = $vars{insseq}; |
38
|
|
|
|
} |
39
|
|
|
|
} |
40
|
|
|
|
} |
41
|
|
|
|
|
42
|
|
|
|
sub isValid { |
43
|
|
194
|
1
|
my $self = shift; |
44
|
50
|
|
|
return 0 if(!defined($self->{_minpos}) || !defined($self->{_maxpos}) || $self->{_minpos} + 1 != $self->{_maxpos} || $self->{_minpos} < 1); |
45
|
50
|
|
|
return 0 if(!defined($self->{_insseq}) || length($self->{_insseq}) < 1 || $self->{_insseq} !~ m/^[atcgn]+$/i); |
46
|
|
|
|
return 1; |
47
|
|
|
|
} |
48
|
|
|
|
|
49
|
|
|
|
sub getInsertedSequence { |
50
|
|
155
|
1
|
return shift->{_insseq}; |
51
|
|
|
|
} |
52
|
|
|
|
|
53
|
|
|
|
sub toString { |
54
|
|
0
|
1
|
my $self = shift; |
55
|
|
|
|
my $out = 'chr'.$self->getChr.':g.'.$self->getMinPos.'_'.$self->getMaxPos.'ins'.$self->getInsertedSequence; |
56
|
|
|
|
return $out; |
57
|
|
|
|
} |
58
|
|
|
|
|
59
|
|
|
|
__END__ |
60
|
|
|
|
|
61
|
|
|
|
=head1 NAME |
62
|
|
|
|
|
63
|
|
|
|
Sanger::CGP::Vagrent::Data::Insertion - Data object representing an insertion event |
64
|
|
|
|
|
65
|
|
|
|
=head1 DESCRIPTION |
66
|
|
|
|
|
67
|
|
|
|
This is a data class describing an insertion variant plotted to a genome. |
68
|
|
|
|
|
69
|
|
|
|
It inherits from L<Sanger::CGP::Vagrent::Data::AbstractGenomicPosition|Sanger::CGP::Vagrent::Data::AbstractGenomicPosition> and L<Sanger::CGP::Vagrent::Data::AbstractVariation|Sanger::CGP::Vagrent::Data::AbstractVariation> |
70
|
|
|
|
|
71
|
|
|
|
=head1 METHODS |
72
|
|
|
|
|
73
|
|
|
|
=head2 Constructor |
74
|
|
|
|
|
75
|
|
|
|
=head3 new |
76
|
|
|
|
|
77
|
|
|
|
=over |
78
|
|
|
|
|
79
|
|
|
|
=item Usage : |
80
|
|
|
|
|
81
|
|
|
|
my $ins = Sanger::CGP::Vagrent::Data::Insertion->new(%params); |
82
|
|
|
|
|
83
|
|
|
|
=item Function : |
84
|
|
|
|
|
85
|
|
|
|
Builds a new Sanger::CGP::Vagrent::Data::Insertion object |
86
|
|
|
|
|
87
|
|
|
|
=item Returns : |
88
|
|
|
|
|
89
|
|
|
|
Sanger::CGP::Vagrent::Data::Insertion object initialized with parameter values |
90
|
|
|
|
|
91
|
|
|
|
=item Params : |
92
|
|
|
|
|
93
|
|
|
|
Same as the constructor from L<Sanger::CGP::Vagrent::Data::AbstractGenomicPosition|Sanger::CGP::Vagrent::Data::AbstractGenomicPosition> plus |
94
|
|
|
|
|
95
|
|
|
|
insseq => the inserted sequence fragment |
96
|
|
|
|
|
97
|
|
|
|
=back |
98
|
|
|
|
|
99
|
|
|
|
=head2 Attributes |
100
|
|
|
|
|
101
|
|
|
|
=head3 getInsertedSequence |
102
|
|
|
|
|
103
|
|
|
|
=over |
104
|
|
|
|
|
105
|
|
|
|
=item Usage : |
106
|
|
|
|
|
107
|
|
|
|
my $seq = $ins->getInsertedSequence; |
108
|
|
|
|
|
109
|
|
|
|
=item Function : |
110
|
|
|
|
|
111
|
|
|
|
Returns the inserted sequence fragment |
112
|
|
|
|
|
113
|
|
|
|
=item Returns : |
114
|
|
|
|
|
115
|
|
|
|
String - DNA sequence |
116
|
|
|
|
|
117
|
|
|
|
=back |
118
|
|
|
|
|
119
|
|
|
|
=head2 Functions |
120
|
|
|
|
|
121
|
|
|
|
=head3 toString |
122
|
|
|
|
|
123
|
|
|
|
=over |
124
|
|
|
|
|
125
|
|
|
|
=item Usage : |
126
|
|
|
|
|
127
|
|
|
|
print $variant->toString; |
128
|
|
|
|
|
129
|
|
|
|
=item Function : |
130
|
|
|
|
|
131
|
|
|
|
Returns a simple string representation of the variant in hgvs genomic syntax |
132
|
|
|
|
|
133
|
|
|
|
=item Returns : |
134
|
|
|
|
|
135
|
|
|
|
String |
136
|
|
|
|
|
137
|
|
|
|
=back |
138
|
|
|
|
|