line |
bran |
sub |
pod |
code |
1
|
|
|
|
package Sanger::CGP::Vagrent::Data::Substitution; |
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
|
|
156
|
|
my $self = shift; |
34
|
|
|
|
my %vars = @_; |
35
|
|
|
|
foreach my $k(keys(%vars)){ |
36
|
100
|
|
|
if($k eq 'wt'){ |
|
100
|
|
|
|
37
|
|
|
|
$self->{_wt} = $vars{wt}; |
38
|
|
|
|
} elsif($k eq 'mt'){ |
39
|
|
|
|
$self->{_mt} = $vars{mt}; |
40
|
|
|
|
} |
41
|
|
|
|
} |
42
|
|
|
|
} |
43
|
|
|
|
|
44
|
|
|
|
sub isValid { |
45
|
|
156
|
1
|
my $self = shift; |
46
|
50
|
|
|
return 0 unless(defined($self->{_wt}) && defined($self->{_mt})); |
47
|
50
|
|
|
return 0 unless(length($self->{_wt}) == 1 && length($self->{_mt}) == 1); |
48
|
50
|
|
|
return 0 unless($self->{_wt} =~ m/[atcg]/i && $self->{_mt} =~ m/[atcg]/i); |
49
|
50
|
|
|
return 0 if($self->{_mt} eq $self->{_wt}); |
50
|
|
|
|
|
51
|
50
|
|
|
return 0 unless(defined($self->{_minpos}) && defined($self->{_maxpos})); |
52
|
50
|
|
|
return 0 unless($self->{_minpos} == $self->{_maxpos}); |
53
|
50
|
|
|
return 0 unless($self->{_minpos} > 0); |
54
|
|
|
|
|
55
|
|
|
|
return 1; |
56
|
|
|
|
} |
57
|
|
|
|
|
58
|
|
|
|
sub getWt { |
59
|
|
84
|
1
|
return shift->{_wt}; |
60
|
|
|
|
} |
61
|
|
|
|
|
62
|
|
|
|
sub getMt { |
63
|
|
84
|
1
|
return shift->{_mt}; |
64
|
|
|
|
} |
65
|
|
|
|
|
66
|
|
|
|
sub toString { |
67
|
|
0
|
1
|
my $self = shift; |
68
|
|
|
|
return 'chr'.$self->getChr.':g.'.$self->getMinPos.$self->getWt.'>'.$self->getMt; |
69
|
|
|
|
} |
70
|
|
|
|
|
71
|
|
|
|
__END__ |
72
|
|
|
|
|
73
|
|
|
|
=head1 NAME |
74
|
|
|
|
|
75
|
|
|
|
Sanger::CGP::Vagrent::Data::Substitution - Data object representing a substitution |
76
|
|
|
|
|
77
|
|
|
|
=head1 DESCRIPTION |
78
|
|
|
|
|
79
|
|
|
|
This is a data class describing a substitution variant plotted to a genome. |
80
|
|
|
|
|
81
|
|
|
|
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> |
82
|
|
|
|
|
83
|
|
|
|
=head1 METHODS |
84
|
|
|
|
|
85
|
|
|
|
=head2 Constructor |
86
|
|
|
|
|
87
|
|
|
|
=head3 new |
88
|
|
|
|
|
89
|
|
|
|
=over |
90
|
|
|
|
|
91
|
|
|
|
=item Usage : |
92
|
|
|
|
|
93
|
|
|
|
my $cplx = Sanger::CGP::Vagrent::Data::Substitution->new(%params); |
94
|
|
|
|
|
95
|
|
|
|
=item Function : |
96
|
|
|
|
|
97
|
|
|
|
Builds a new Sanger::CGP::Vagrent::Data::Substitution object |
98
|
|
|
|
|
99
|
|
|
|
=item Returns : |
100
|
|
|
|
|
101
|
|
|
|
Sanger::CGP::Vagrent::Data::Substitution object initialized with parameter values |
102
|
|
|
|
|
103
|
|
|
|
=item Params : |
104
|
|
|
|
|
105
|
|
|
|
Same as the constructor from L<Sanger::CGP::Vagrent::Data::AbstractGenomicPosition|Sanger::CGP::Vagrent::Data::AbstractGenomicPosition> plus |
106
|
|
|
|
|
107
|
|
|
|
wt => the wildtype sequence |
108
|
|
|
|
mt => the mutant/variant sequence |
109
|
|
|
|
|
110
|
|
|
|
=back |
111
|
|
|
|
|
112
|
|
|
|
=head2 Attributes |
113
|
|
|
|
|
114
|
|
|
|
=head3 getWt |
115
|
|
|
|
|
116
|
|
|
|
=over |
117
|
|
|
|
|
118
|
|
|
|
=item Usage : |
119
|
|
|
|
|
120
|
|
|
|
my $seq = $sub->getWt; |
121
|
|
|
|
|
122
|
|
|
|
=item Function : |
123
|
|
|
|
|
124
|
|
|
|
Returns the wildtype sequence string |
125
|
|
|
|
|
126
|
|
|
|
=item Returns : |
127
|
|
|
|
|
128
|
|
|
|
String - DNA sequence |
129
|
|
|
|
|
130
|
|
|
|
=back |
131
|
|
|
|
|
132
|
|
|
|
=head3 getMt |
133
|
|
|
|
|
134
|
|
|
|
=over |
135
|
|
|
|
|
136
|
|
|
|
=item Usage : |
137
|
|
|
|
|
138
|
|
|
|
my $seq = $sub->getMt; |
139
|
|
|
|
|
140
|
|
|
|
=item Function : |
141
|
|
|
|
|
142
|
|
|
|
Returns the mutated/variant sequence string |
143
|
|
|
|
|
144
|
|
|
|
=item Returns : |
145
|
|
|
|
|
146
|
|
|
|
String - DNA sequence |
147
|
|
|
|
|
148
|
|
|
|
=back |
149
|
|
|
|
|
150
|
|
|
|
=head2 Functions |
151
|
|
|
|
|
152
|
|
|
|
=head3 toString |
153
|
|
|
|
|
154
|
|
|
|
=over |
155
|
|
|
|
|
156
|
|
|
|
=item Usage : |
157
|
|
|
|
|
158
|
|
|
|
print $variant->toString; |
159
|
|
|
|
|
160
|
|
|
|
=item Function : |
161
|
|
|
|
|
162
|
|
|
|
Returns a simple string representation of the variant in hgvs genomic syntax |
163
|
|
|
|
|
164
|
|
|
|
=item Returns : |
165
|
|
|
|
|
166
|
|
|
|
String |
167
|
|
|
|
|
168
|
|
|
|
=back |