comparison variant_effect_predictor/Bio/EnsEMBL/Funcgen/SegmentationFeature.pm @ 0:21066c0abaf5 draft

Uploaded
author willmclaren
date Fri, 03 Aug 2012 10:04:48 -0400
parents
children
comparison
equal deleted inserted replaced
-1:000000000000 0:21066c0abaf5
1 #
2 # Ensembl module for Bio::EnsEMBL::Funcgen::SegmentationFeature
3 #
4 # You may distribute this module under the same terms as Perl itself
5
6 =head1 LICENSE
7
8 Copyright (c) 1999-2011 The European Bioinformatics Institute and
9 Genome Research Limited. All rights reserved.
10
11 This software is distributed under a modified Apache license.
12 For license details, please see
13
14 http://www.ensembl.org/info/about/code_licence.html
15
16 =head1 CONTACT
17
18 Please email comments or questions to the public Ensembl
19 developers list at <ensembl-dev@ebi.ac.uk>.
20
21 Questions may also be sent to the Ensembl help desk at
22 <helpdesk@ensembl.org>.
23
24
25 =head1 NAME
26
27 Bio::EnsEMBL::SegmentationFeature - Genomic segmentation feature
28
29 =head1 SYNOPSIS
30
31 use Bio::EnsEMBL::Funcgen::SegmentationFeature;
32
33 my $feature = Bio::EnsEMBL::Funcgen::SegmentationFeature->new(
34 -SLICE => $chr_1_slice,
35 -START => 1_000_000,
36 -END => 1_000_024,
37 -STRAND => 0,
38 -FEATURE_SET => $fset,
39 -FEATURE_TYPE => $ftype,
40 );
41
42
43
44 =head1 DESCRIPTION
45
46 An SegmentationFeature object represents the genomic placement of a prediction
47 generated by the eFG analysis pipeline. This normally represents the
48 output of a peak calling analysis. It can have a score and/or a summit, the
49 meaning of which depend on the specific Analysis used to infer the feature.
50 For example, in the case of a feature derived from a peak call over a ChIP-seq
51 experiment, the score is the peak caller score, and summit is the point in the
52 feature where more reads align with the genome.
53
54 =head1 SEE ALSO
55
56 Bio::EnsEMBL::Funcgen::DBSQL::SegmentationFeatureAdaptor
57
58 =cut
59
60 use strict;
61 use warnings;
62
63 package Bio::EnsEMBL::Funcgen::SegmentationFeature;
64
65 use Bio::EnsEMBL::Utils::Argument qw( rearrange );
66 use Bio::EnsEMBL::Utils::Exception qw( throw );
67 use Bio::EnsEMBL::Funcgen::SetFeature;
68
69 use vars qw(@ISA);
70 @ISA = qw(Bio::EnsEMBL::Funcgen::SetFeature);
71
72 =head2 new
73
74 Arg [-SLICE] : Bio::EnsEMBL::Slice - The slice on which this feature is.
75 Arg [-START] : int - The start coordinate of this feature relative to the start of
76 the slice it is sitting on. Coordinates start at 1 and are inclusive.
77 Arg [-END] : int -The end coordinate of this feature relative to the start of
78 the slice it is sitting on. Coordinates start at 1 and are inclusive.
79 Arg [-STRAND] : int - The orientation of this feature. Valid values are 1, -1 and 0.
80 Arg [-FEATURE_SET] : Bio::EnsEMBL::Funcgen::FeatureSet
81 Arg [-FEATURE_TYPE] : Bio::Ensembl::Funcgen::FeatureType
82 Arg [-DISPLAY_LABEL]: optional string - Display label for this feature
83 Arg [-SCORE] : optional int - Score assigned by analysis pipeline
84 Arg [-dbID] : optional int - Internal database ID.
85 Arg [-ADAPTOR] : optional Bio::EnsEMBL::DBSQL::BaseAdaptor - Database adaptor.
86
87 Example : my $feature = Bio::EnsEMBL::Funcgen::SegmentationFeature->new
88 (
89 -SLICE => $chr_1_slice,
90 -START => 1_000_000,
91 -END => 1_000_024,
92 -STRAND => -1,
93 -FEATURE_SET => $fset,
94 -FEATURE_TYPE => $ftype,
95 -DISPLAY_LABEL => $text,
96 -SCORE => $score,
97 );
98
99
100 Description: Constructor for SegmentationFeature objects.
101 Returntype : Bio::EnsEMBL::Funcgen::SegmentationFeature
102 Exceptions : None
103 Caller : General
104 Status : Medium Risk
105
106 =cut
107
108 sub new {
109 my $caller = shift;
110
111 my $class = ref($caller) || $caller;
112 my $self = $class->SUPER::new(@_);
113 #Hard code strand => 0 here? And remove from input params?
114 my ($score, $ftype) = rearrange(['SCORE', 'FEATURE_TYPE'], @_);
115
116 #test ftype as SetFeature method defaults to feature_set->feature_type
117 throw('You must pass a valid FeatureType') if ! defined $ftype;
118
119 $self->{score} = $score if $score;
120 $self->{feature_type} = $ftype;
121
122 return $self;
123 }
124
125
126 =head2 score
127
128 Arg [1] : (optional) int - score
129 Example : my $score = $feature->score();
130 Description: Getter and setter for the score attribute for this feature.
131 Returntype : int
132 Exceptions : None
133 Caller : General
134 Status : At Risk
135
136 =cut
137
138 sub score {
139 my $self = shift;
140 return $self->{'score'};
141 }
142
143
144 =head2 display_label
145
146 Example : my $label = $feature->display_label();
147 Description: Getter for the display label of this feature.
148 Returntype : String
149 Exceptions : None
150 Caller : General
151 Status : At Risk
152
153 =cut
154
155 sub display_label {
156 my $self = shift;
157
158 if(! $self->{'display_label'} && $self->adaptor){
159 $self->{'display_label'} = $self->feature_type->name()." -";
160 $self->{'display_label'} .= " ".$self->cell_type->name();
161 }
162
163 return $self->{'display_label'};
164 }
165
166
167 1;
168