Mercurial > repos > mahtabm > ensembl
comparison variant_effect_predictor/Bio/EnsEMBL/Funcgen/ExternalFeature.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 # | |
| 2 # Ensembl module for Bio::EnsEMBL::Funcgen::ExternalFeature | |
| 3 # | |
| 4 | |
| 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::ExternalFeature - A module to represent an externally curated feature | |
| 28 mapping from an external_db. | |
| 29 | |
| 30 =head1 SYNOPSIS | |
| 31 | |
| 32 use Bio::EnsEMBL::Funcgen::ExternalFeature; | |
| 33 | |
| 34 my $feature = Bio::EnsEMBL::Funcgen::ExternalFeature->new( | |
| 35 -SLICE => $chr_1_slice, | |
| 36 -START => 1_000_000, | |
| 37 -END => 1_000_024, | |
| 38 -STRAND => -1, | |
| 39 -DISPLAY_LABEL => $text, | |
| 40 -FEATURE_SET => $fset, | |
| 41 -FEATURE_TYPE => $ftype, | |
| 42 ); | |
| 43 | |
| 44 | |
| 45 | |
| 46 =head1 DESCRIPTION | |
| 47 | |
| 48 An ExternalFeature object represents the genomic placement of an externally curated | |
| 49 feature from and DB external to Ensembl. | |
| 50 | |
| 51 =cut | |
| 52 | |
| 53 use strict; | |
| 54 use warnings; | |
| 55 | |
| 56 package Bio::EnsEMBL::Funcgen::ExternalFeature; | |
| 57 | |
| 58 use Bio::EnsEMBL::Utils::Argument qw( rearrange ); | |
| 59 use Bio::EnsEMBL::Utils::Exception qw( throw ); | |
| 60 use Bio::EnsEMBL::Funcgen::SetFeature; | |
| 61 use Bio::EnsEMBL::Funcgen::FeatureType; | |
| 62 | |
| 63 use vars qw(@ISA); | |
| 64 @ISA = qw(Bio::EnsEMBL::Funcgen::SetFeature); | |
| 65 | |
| 66 | |
| 67 =head2 new | |
| 68 | |
| 69 | |
| 70 Arg [-FEATURE_SET] : Bio::EnsEMBL::Funcgen::FeatureSet | |
| 71 Arg [-FEATURE_TYPE] : Bio::EnsEMBL::Funcgen::FeatureType | |
| 72 Arg [-ANALYSIS] : Bio::EnsEMBL::Analysis | |
| 73 Arg [-SLICE] : Bio::EnsEMBL::Slice - The slice on which this feature is. | |
| 74 Arg [-START] : int - The start coordinate of this feature relative to the start of the slice | |
| 75 it is sitting on. Coordinates start at 1 and are inclusive. | |
| 76 Arg [-END] : int -The end coordinate of this feature relative to the start of the slice | |
| 77 it is sitting on. Coordinates start at 1 and are inclusive. | |
| 78 Arg [-DISPLAY_LABEL]: string - Display label for this feature | |
| 79 Arg [-STRAND] : int - The orientation of this feature. Valid values are 1, -1 and 0. | |
| 80 Arg [-dbID] : (optional) int - Internal database ID. | |
| 81 Arg [-ADAPTOR] : (optional) Bio::EnsEMBL::DBSQL::BaseAdaptor - Database adaptor. | |
| 82 Example : my $feature = Bio::EnsEMBL::Funcgen::ExternalFeature->new( | |
| 83 -SLICE => $chr_1_slice, | |
| 84 -START => 1_000_000, | |
| 85 -END => 1_000_024, | |
| 86 -STRAND => -1, | |
| 87 -DISPLAY_LABEL => $text, | |
| 88 -FEATURE_SET => $fset, | |
| 89 -FEATURE_TYPE => $ftpe, | |
| 90 ); | |
| 91 | |
| 92 | |
| 93 Description: Constructor for ExternalFeature objects. | |
| 94 Returntype : Bio::EnsEMBL::Funcgen::ExternalFeature | |
| 95 Exceptions : None | |
| 96 Caller : General | |
| 97 Status : At Risk | |
| 98 | |
| 99 =cut | |
| 100 | |
| 101 sub new { | |
| 102 my $caller = shift; | |
| 103 | |
| 104 my $class = ref($caller) || $caller; | |
| 105 my $self = $class->SUPER::new(@_); | |
| 106 | |
| 107 #Remove this method if we interdb_stable_id to SetFeature | |
| 108 ($self->{'interdb_stable_id'}) = rearrange(['INTERDB_STABLE_ID'], @_); | |
| 109 | |
| 110 return $self; | |
| 111 } | |
| 112 | |
| 113 =head2 interdb_stable_id | |
| 114 | |
| 115 Arg [1] : (optional) int - stable_id e.g 1 | |
| 116 Example : my $idb_sid = $feature->interdb_stable_id(); | |
| 117 Description: Getter for the interdb_stable_id attribute for this feature. | |
| 118 This is simply to avoid using internal db IDs for inter DB linking | |
| 119 Returntype : int | |
| 120 Exceptions : None | |
| 121 Caller : General | |
| 122 Status : At Risk | |
| 123 | |
| 124 =cut | |
| 125 | |
| 126 sub interdb_stable_id { | |
| 127 return $_[0]->{'interdb_stable_id'}; | |
| 128 } | |
| 129 | |
| 130 | |
| 131 | |
| 132 | |
| 133 =head2 display_label | |
| 134 | |
| 135 Example : my $label = $feature->display_label(); | |
| 136 Description: Getter for the display label of this feature. | |
| 137 Returntype : String | |
| 138 Exceptions : None | |
| 139 Caller : General | |
| 140 Status : Medium risk | |
| 141 | |
| 142 =cut | |
| 143 | |
| 144 sub display_label { | |
| 145 my $self = shift; | |
| 146 | |
| 147 if(! $self->{'display_label'} && $self->adaptor){ | |
| 148 | |
| 149 $self->{'display_label'} = $self->feature_set->feature_type->name().' - '; | |
| 150 $self->{'display_label'} .= $self->cell_type->name() if $self->cell_type(); | |
| 151 $self->{'display_label'} .= $self->feature_type->name() if(defined $self->{'feature_type'}); | |
| 152 } | |
| 153 | |
| 154 return $self->{'display_label'}; | |
| 155 } | |
| 156 | |
| 157 | |
| 158 | |
| 159 1; | |
| 160 |
