Mercurial > repos > mahtabm > ensembl
comparison variant_effect_predictor/Bio/EnsEMBL/Variation/ReadCoverage.pm @ 0:1f6dce3d34e0
Uploaded
| author | mahtabm |
|---|---|
| date | Thu, 11 Apr 2013 02:01:53 -0400 |
| parents | |
| children |
comparison
equal
deleted
inserted
replaced
| -1:000000000000 | 0:1f6dce3d34e0 |
|---|---|
| 1 =head1 LICENSE | |
| 2 | |
| 3 Copyright (c) 1999-2012 The European Bioinformatics Institute and | |
| 4 Genome Research Limited. All rights reserved. | |
| 5 | |
| 6 This software is distributed under a modified Apache license. | |
| 7 For license details, please see | |
| 8 | |
| 9 http://www.ensembl.org/info/about/code_licence.html | |
| 10 | |
| 11 =head1 CONTACT | |
| 12 | |
| 13 Please email comments or questions to the public Ensembl | |
| 14 developers list at <dev@ensembl.org>. | |
| 15 | |
| 16 Questions may also be sent to the Ensembl help desk at | |
| 17 <helpdesk@ensembl.org>. | |
| 18 | |
| 19 =cut | |
| 20 | |
| 21 # Ensembl module for Bio::EnsEMBL::Variation::ReadCoverage | |
| 22 # | |
| 23 # Copyright (c) 2005 Ensembl | |
| 24 # | |
| 25 | |
| 26 | |
| 27 =head1 NAME | |
| 28 | |
| 29 Bio::EnsEMBL::Variation::ReadCoverage - A coverage reagion for a read. | |
| 30 | |
| 31 =head1 SYNOPSIS | |
| 32 | |
| 33 # Read coverage feature representing a genomic region covered by 1 read | |
| 34 | |
| 35 $rc = Bio::EnsEMBL::Variation::ReadCoverage->new | |
| 36 (-start => 100, | |
| 37 -end => 200, | |
| 38 -slice => $slice, | |
| 39 -level => 1. | |
| 40 -sample => $individual); | |
| 41 | |
| 42 $rc = $rc->transform('supercontig'); | |
| 43 | |
| 44 print $rc->start(), "-", $rc->end(), "\n"; | |
| 45 | |
| 46 | |
| 47 =head1 DESCRIPTION | |
| 48 | |
| 49 This is a class representing the read coverage information | |
| 50 from the ensembl-variation database. A ReadCoverage behaves as any other Ensembl feature. | |
| 51 | |
| 52 See B<Bio::EnsEMBL::Feature>. | |
| 53 | |
| 54 =head1 METHODS | |
| 55 | |
| 56 =cut | |
| 57 | |
| 58 use strict; | |
| 59 use warnings; | |
| 60 | |
| 61 package Bio::EnsEMBL::Variation::ReadCoverage; | |
| 62 | |
| 63 use Bio::EnsEMBL::Feature; | |
| 64 use Bio::EnsEMBL::Utils::Exception qw(throw warning); | |
| 65 use Bio::EnsEMBL::Utils::Argument qw(rearrange); | |
| 66 | |
| 67 our @ISA = ('Bio::EnsEMBL::Feature'); | |
| 68 | |
| 69 | |
| 70 =head2 new | |
| 71 | |
| 72 Arg [-ADAPTOR] : | |
| 73 see superclass constructor | |
| 74 | |
| 75 Arg [-START] : | |
| 76 see superclass constructor | |
| 77 Arg [-END] : | |
| 78 see superclass constructor | |
| 79 Arg [-SLICE] : | |
| 80 see superclass constructor | |
| 81 | |
| 82 Arg [-LEVEL] : | |
| 83 int - the number of times the region represented by start and end has been seen | |
| 84 | |
| 85 Arg [-SAMPLE] : | |
| 86 Bio::EnsEMBL::Variation::Individual - the individual | |
| 87 in which the allele was recorded | |
| 88 | |
| 89 Example : | |
| 90 $rc = Bio::EnsEMBL::Variation::ReadCoverage->new | |
| 91 (-start => 100, | |
| 92 -end => 100, | |
| 93 -slice => $slice, | |
| 94 -level => 1, | |
| 95 -sample => $individual); | |
| 96 | |
| 97 Description: Constructor. Instantiates a new ReadCoverage object. | |
| 98 Returntype : Bio::EnsEMBL::Variation::ReadCoverage | |
| 99 Exceptions : none | |
| 100 Caller : general | |
| 101 Status : At Risk | |
| 102 | |
| 103 =cut | |
| 104 | |
| 105 sub new { | |
| 106 my $caller = shift; | |
| 107 my $class = ref($caller) || $caller; | |
| 108 | |
| 109 my $self = $class->SUPER::new(@_); | |
| 110 my ($level, $individual) = | |
| 111 rearrange([qw(LEVEL SAMPLE)], @_); | |
| 112 | |
| 113 $self->{'level'} = $level; | |
| 114 $self->{'sample'} = $individual; | |
| 115 | |
| 116 return $self; | |
| 117 } | |
| 118 | |
| 119 | |
| 120 =head2 level | |
| 121 | |
| 122 Arg[1] : int $newval (optional) | |
| 123 The new value to set the level attribute to | |
| 124 Example : $depth = $obj->level(); | |
| 125 Description : Getter/Setter for the level attribute. The level is | |
| 126 the number of times this feature has been seen in the genome | |
| 127 ReturnType : int | |
| 128 Exceptions : none | |
| 129 Caller : general | |
| 130 Status : At Risk | |
| 131 | |
| 132 =cut | |
| 133 | |
| 134 sub level{ | |
| 135 my $self = shift; | |
| 136 return $self->{'level'} = shift if (@_); | |
| 137 return $self->{'level'}; | |
| 138 } | |
| 139 | |
| 140 | |
| 141 =head2 sample | |
| 142 | |
| 143 Arg [1] : Bio::EnsEMBL::Variation::Individual $newval (optional) | |
| 144 The new value to set the sample attribute to | |
| 145 Example : $individual = $rc->sample(); | |
| 146 Description: Getter/Setter for the individual attribute | |
| 147 Returntype : Bio::EnsEMBL::Variation::Individual | |
| 148 Exceptions : throw on incorrect argument | |
| 149 Caller : general | |
| 150 Status : At Risk | |
| 151 | |
| 152 =cut | |
| 153 | |
| 154 sub sample{ | |
| 155 my $self = shift; | |
| 156 | |
| 157 if(@_) { | |
| 158 if(!ref($_[0]) || !$_[0]->isa('Bio::EnsEMBL::Variation::Individual')) { | |
| 159 throw('Bio::EnsEMBL::Variation::Individual argument expected.'); | |
| 160 } | |
| 161 $self->{'sample'} = shift; | |
| 162 } | |
| 163 | |
| 164 return $self->{'sample'}; | |
| 165 } | |
| 166 | |
| 167 1; |
