| 1 | # bioperl module for Bio::Variation::SNP | ||||||||||
| 2 | # | ||||||||||
| 3 | # Copyright Allen Day <allenday@ucla.edu>, Stan Nelson <snelson@ucla.edu> | ||||||||||
| 4 | # Human Genetics, UCLA Medical School, University of California, Los Angeles | ||||||||||
| 5 | |||||||||||
| 6 | =head1 NAME | ||||||||||
| 7 | |||||||||||
| 8 | Bio::Variation::SNP - submitted SNP | ||||||||||
| 9 | |||||||||||
| 10 | =head1 SYNOPSIS | ||||||||||
| 11 | |||||||||||
| 12 | $SNP = Bio::Variation::SNP->new (); | ||||||||||
| 13 | |||||||||||
| 14 | =head1 DESCRIPTION | ||||||||||
| 15 | |||||||||||
| 16 | Inherits from Bio::Variation::SeqDiff and Bio::Variation::Allele, with | ||||||||||
| 17 | additional methods that are (db)SNP specific (ie, refSNP/subSNP IDs, batch | ||||||||||
| 18 | IDs, validation methods). | ||||||||||
| 19 | |||||||||||
| 20 | =head1 FEEDBACK | ||||||||||
| 21 | |||||||||||
| 22 | =head2 Mailing Lists | ||||||||||
| 23 | |||||||||||
| 24 | User feedback is an integral part of the evolution of this and other | ||||||||||
| 25 | Bioperl modules. Send your comments and suggestions preferably to one | ||||||||||
| 26 | of the Bioperl mailing lists. Your participation is much appreciated. | ||||||||||
| 27 | |||||||||||
| 28 | bioperl-l@bioperl.org - General discussion | ||||||||||
| 29 | http://bioperl.org/wiki/Mailing_lists - About the mailing lists | ||||||||||
| 30 | |||||||||||
| 31 | =head2 Support | ||||||||||
| 32 | |||||||||||
| 33 | Please direct usage questions or support issues to the mailing list: | ||||||||||
| 34 | |||||||||||
| 35 | I<bioperl-l@bioperl.org> | ||||||||||
| 36 | |||||||||||
| 37 | rather than to the module maintainer directly. Many experienced and | ||||||||||
| 38 | reponsive experts will be able look at the problem and quickly | ||||||||||
| 39 | address it. Please include a thorough description of the problem | ||||||||||
| 40 | with code and data examples if at all possible. | ||||||||||
| 41 | |||||||||||
| 42 | =head2 Reporting Bugs | ||||||||||
| 43 | |||||||||||
| 44 | Report bugs to the Bioperl bug tracking system to help us keep track | ||||||||||
| 45 | the bugs and their resolution. Bug reports can be submitted via the | ||||||||||
| 46 | web: | ||||||||||
| 47 | |||||||||||
| 48 | https://github.com/bioperl/bioperl-live/issues | ||||||||||
| 49 | |||||||||||
| 50 | =head1 AUTHOR | ||||||||||
| 51 | |||||||||||
| 52 | Allen Day E<lt>allenday@ucla.eduE<gt> | ||||||||||
| 53 | |||||||||||
| 54 | =head1 APPENDIX | ||||||||||
| 55 | |||||||||||
| 56 | The rest of the documentation details each of the object | ||||||||||
| 57 | methods. Internal methods are usually preceded with a _ | ||||||||||
| 58 | |||||||||||
| 59 | =cut | ||||||||||
| 60 | |||||||||||
| 61 | # Let the code begin... | ||||||||||
| 62 | |||||||||||
| 63 | package Bio::Variation::SNP; | ||||||||||
| 64 | 2 | $Bio::Variation::SNP::VERSION = '1.7.5'; | |||||||||
| 65 | 2 | ▶ | use strict; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 66 | 2 | ▶ | use vars qw($AUTOLOAD); | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 67 | 2 | ▶ | use Bio::Root::Root; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 68 | |||||||||||
| 69 | 2 | ▶ | use base qw(Bio::Variation::SeqDiff Bio::Variation::Allele); | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 70 | |||||||||||
| 71 | =head2 get/set-able methods | ||||||||||
| 72 | |||||||||||
| 73 | Usage : $is = $snp->method() | ||||||||||
| 74 | Function: for getting/setting attributes | ||||||||||
| 75 | Returns : a value. probably a scalar. | ||||||||||
| 76 | Args : if you're trying to set an attribute, pass in the new value. | ||||||||||
| 77 | |||||||||||
| 78 | Methods: | ||||||||||
| 79 | -------- | ||||||||||
| 80 | id | ||||||||||
| 81 | type | ||||||||||
| 82 | observed | ||||||||||
| 83 | seq_5 | ||||||||||
| 84 | seq_3 | ||||||||||
| 85 | ncbi_build | ||||||||||
| 86 | ncbi_chr_hits | ||||||||||
| 87 | ncbi_ctg_hits | ||||||||||
| 88 | ncbi_seq_loc | ||||||||||
| 89 | ucsc_build | ||||||||||
| 90 | ucsc_chr_hits | ||||||||||
| 91 | ucsc_ctg_hits | ||||||||||
| 92 | heterozygous | ||||||||||
| 93 | heterozygous_SE | ||||||||||
| 94 | validated | ||||||||||
| 95 | genotype | ||||||||||
| 96 | handle | ||||||||||
| 97 | batch_id | ||||||||||
| 98 | method | ||||||||||
| 99 | locus_id | ||||||||||
| 100 | symbol | ||||||||||
| 101 | mrna | ||||||||||
| 102 | protein | ||||||||||
| 103 | functional_class | ||||||||||
| 104 | |||||||||||
| 105 | =cut | ||||||||||
| 106 | |||||||||||
| 107 | #' | ||||||||||
| 108 | 2 | my %OK_AUTOLOAD = ( | |||||||||
| 109 | id => '', | ||||||||||
| 110 | type => '', | ||||||||||
| 111 | observed => [], | ||||||||||
| 112 | seq_5 => '', | ||||||||||
| 113 | seq_3 => '', | ||||||||||
| 114 | ncbi_build => '', | ||||||||||
| 115 | ncbi_chr_hits => '', | ||||||||||
| 116 | ncbi_ctg_hits => '', | ||||||||||
| 117 | ncbi_seq_loc => '', | ||||||||||
| 118 | ucsc_build => '', | ||||||||||
| 119 | ucsc_chr_hits => '', | ||||||||||
| 120 | ucsc_ctg_hits => '', | ||||||||||
| 121 | heterozygous => '', | ||||||||||
| 122 | heterozygous_SE => '', | ||||||||||
| 123 | validated => '', | ||||||||||
| 124 | genotype => '', | ||||||||||
| 125 | handle => '', | ||||||||||
| 126 | batch_id => '', | ||||||||||
| 127 | method => '', | ||||||||||
| 128 | locus_id => '', | ||||||||||
| 129 | symbol => '', | ||||||||||
| 130 | mrna => '', | ||||||||||
| 131 | protein => '', | ||||||||||
| 132 | functional_class => '', | ||||||||||
| 133 | ); | ||||||||||
| 134 | |||||||||||
| 135 | 4 | ▶ | sub AUTOLOAD { | ||||||||
|
Subroutine
AUTOLOAD: called CC=5 SCAR=19.3
| |||||||||||
| 136 | 4 | my $self = shift; | |||||||||
| 137 | 4 | my $param = $AUTOLOAD; | |||||||||
| 138 | 4 | $param =~ s/.*:://; | |||||||||
| 139 | 4 | ▶ | $self->throw(__PACKAGE__." doesn't implement $param") unless defined $OK_AUTOLOAD{$param}; | ||||||||
|
Branch: 1 branch
| |||||||||||
| 140 | |||||||||||
| 141 | 3 | ▶ | if( ref $OK_AUTOLOAD{$param} eq 'ARRAY' ) { | ||||||||
|
Branch: 1 branch
| |||||||||||
| 142 | 0 | ▶ | push @{$self->{$param}}, shift if @_; | ||||||||
|
Branch: 1 branch
| |||||||||||
| 143 | 0 | return $self->{$param}->[scalar(@{$self->{$param}}) - 1]; | |||||||||
| 144 | } else { | ||||||||||
| 145 | 3 | ▶ | $self->{$param} = shift if @_; | ||||||||
|
Branch: 1 branch
| |||||||||||
| 146 | 3 | return $self->{$param}; | |||||||||
| 147 | } | ||||||||||
| 148 | } | ||||||||||
| 149 | |||||||||||
| 150 | |||||||||||
| 151 | #foreach my $slot (keys %RWSLOT){ | ||||||||||
| 152 | # no strict "refs"; #add class methods to package | ||||||||||
| 153 | # *$slot = sub { | ||||||||||
| 154 | # shift; | ||||||||||
| 155 | # $RWSLOT{$slot} = shift if @_; | ||||||||||
| 156 | # return $RWSLOT{$slot}; | ||||||||||
| 157 | # }; | ||||||||||
| 158 | #} | ||||||||||
| 159 | |||||||||||
| 160 | |||||||||||
| 161 | =head2 is_subsnp | ||||||||||
| 162 | |||||||||||
| 163 | Title : is_subsnp | ||||||||||
| 164 | Usage : $is = $snp->is_subsnp() | ||||||||||
| 165 | Function: returns 1 if $snp is a subSNP | ||||||||||
| 166 | Returns : 1 or undef | ||||||||||
| 167 | Args : NONE | ||||||||||
| 168 | |||||||||||
| 169 | =cut | ||||||||||
| 170 | |||||||||||
| 171 | 8 | ▶ | sub is_subsnp { | ||||||||
|
Subroutine
is_subsnp: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||
| 172 | 8 | return shift->{is_subsnp}; | |||||||||
| 173 | } | ||||||||||
| 174 | |||||||||||
| 175 | =head2 subsnp | ||||||||||
| 176 | |||||||||||
| 177 | Title : subsnp | ||||||||||
| 178 | Usage : $subsnp = $snp->subsnp() | ||||||||||
| 179 | Function: returns the currently active subSNP of $snp | ||||||||||
| 180 | Returns : Bio::Variation::SNP | ||||||||||
| 181 | Args : NONE | ||||||||||
| 182 | |||||||||||
| 183 | =cut | ||||||||||
| 184 | |||||||||||
| 185 | 4 | ▶ | sub subsnp { | ||||||||
|
Subroutine
subsnp: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||
| 186 | 4 | my $self = shift; | |||||||||
| 187 | 4 | return $self->{subsnps}->[ scalar($self->each_subsnp) - 1 ]; | |||||||||
| 188 | } | ||||||||||
| 189 | |||||||||||
| 190 | =head2 add_subsnp | ||||||||||
| 191 | |||||||||||
| 192 | Title : add_subsnp | ||||||||||
| 193 | Usage : $subsnp = $snp->add_subsnp() | ||||||||||
| 194 | Function: pushes the previous value returned by subsnp() onto a stack, | ||||||||||
| 195 | accessible with each_subsnp(). | ||||||||||
| 196 | Sets return value of subsnp() to a new Bio::Variation::SNP | ||||||||||
| 197 | object, and returns that object. | ||||||||||
| 198 | Returns : Bio::Varitiation::SNP | ||||||||||
| 199 | Args : NONE | ||||||||||
| 200 | |||||||||||
| 201 | =cut | ||||||||||
| 202 | |||||||||||
| 203 | 2 | ▶ | sub add_subsnp { | ||||||||
|
Subroutine
add_subsnp: called CC=2 SCAR=7.0
Pod
documented
| |||||||||||
| 204 | 2 | my $self = shift; | |||||||||
| 205 | 2 | ▶ | $self->throw("add_subsnp(): cannot add subSNP to subSNP, only to refSNP") | ||||||||
|
Branch: 1 branch
| |||||||||||
| 206 | if $self->is_subsnp; | ||||||||||
| 207 | |||||||||||
| 208 | 2 | my $subsnp = Bio::Variation::SNP->new; | |||||||||
| 209 | 2 | push @{$self->{subsnps}}, $subsnp; | |||||||||
| 210 | 2 | $self->subsnp->{is_subsnp} = 1; | |||||||||
| 211 | 2 | return $self->subsnp; | |||||||||
| 212 | } | ||||||||||
| 213 | |||||||||||
| 214 | =head2 each_subsnp | ||||||||||
| 215 | |||||||||||
| 216 | Title : each_subsnp | ||||||||||
| 217 | Usage : @subsnps = $snp->each_subsnp() | ||||||||||
| 218 | Function: returns a list of the subSNPs of a refSNP | ||||||||||
| 219 | Returns : list | ||||||||||
| 220 | Args : NONE | ||||||||||
| 221 | |||||||||||
| 222 | =cut | ||||||||||
| 223 | |||||||||||
| 224 | 5 | ▶ | sub each_subsnp { | ||||||||
|
Subroutine
each_subsnp: called CC=2 SCAR=7.0
Pod
documented
| |||||||||||
| 225 | 5 | my $self = shift; | |||||||||
| 226 | 5 | ▶ | $self->throw("each_subsnp(): cannot be called on a subSNP") | ||||||||
|
Branch: 1 branch
| |||||||||||
| 227 | if $self->is_subsnp; | ||||||||||
| 228 | 5 | return @{$self->{subsnps}}; | |||||||||
| 229 | } | ||||||||||
| 230 | |||||||||||
| 231 | 2 | 1; | |||||||||