comparison variant_effect_predictor/Bio/EnsEMBL/Compara/GeneTreeMember.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 =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 =head1 NAME
20
21 Bio::EnsEMBL::Compara::GeneTreeMember
22
23 =head1 DESCRIPTION
24
25 Currently the GeneTreeMember objects are used to represent the leaves of
26 the gene trees (whether they contain proteins or non-coding RNas).
27
28 Each GeneTreeMember object is simultaneously a tree node (inherits from
29 GeneTreeNode) and an aligned member (inherits from AlignedMember).
30
31 =head1 INHERITANCE TREE
32
33 Bio::EnsEMBL::Compara::GeneTreeMember
34 +- Bio::EnsEMBL::Compara::AlignedMember
35 `- Bio::EnsEMBL::Compara::GeneTreeNode
36
37 =head1 AUTHORSHIP
38
39 Ensembl Team. Individual contributions can be found in the CVS log.
40
41 =head1 MAINTAINER
42
43 $Author: mm14 $
44
45 =head VERSION
46
47 $Revision: 1.5 $
48
49 =head1 APPENDIX
50
51 The rest of the documentation details each of the object methods.
52 Internal methods are usually preceded with an underscore (_)
53
54 =cut
55
56 package Bio::EnsEMBL::Compara::GeneTreeMember;
57
58 use strict;
59
60 use base ('Bio::EnsEMBL::Compara::AlignedMember', 'Bio::EnsEMBL::Compara::GeneTreeNode'); # careful with the order; new() is currently inherited from Member-AlignedMember branch
61
62
63 =head2 copy
64
65 Arg [1] : none
66 Example : $copy = $gene_tree_member->copy();
67 Description : Creates a new GeneTreeMember object from an existing one
68 Returntype : Bio::EnsEMBL::Compara::GeneTreeMember
69 Exceptions : none
70 Caller : general
71 Status : Stable
72
73 =cut
74
75 sub copy {
76 my $self = shift;
77
78 my $mycopy = $self->Bio::EnsEMBL::Compara::GeneTreeNode::copy;
79 $self->Bio::EnsEMBL::Compara::AlignedMember::copy($mycopy); # we could rename this method into topup() as it is not needed by 'AlignedMember' class itself
80 bless $mycopy, 'Bio::EnsEMBL::Compara::GeneTreeMember';
81
82 return $mycopy;
83 }
84
85
86 =head2 string_node (overrides default method in Bio::EnsEMBL::Compara::NestedSet)
87
88 Arg [1] : none
89 Example : $aligned_member->string_node();
90 Description : Outputs the info for this GeneTreeMember. First, the node_id, the
91 left and right indexes are printed, then the species name. If the
92 gene member can be determined, the methods prints the stable_id,
93 the display label and location of the gene member, otherwise the
94 member_id and stable_id of the object are printed.
95 Returntype : none
96 Exceptions : none
97 Caller : general
98 Status : Stable
99
100 =cut
101
102 sub string_node {
103 my $self = shift;
104 my $str = sprintf("(%s %d,%d)", $self->node_id, $self->left_index, $self->right_index);
105 if($self->genome_db_id and $self->adaptor) {
106 my $genome_db = $self->genome_db;
107 if (!defined($genome_db)) {
108 $DB::single=1;1;
109 }
110 $str .= sprintf(" %s", $genome_db->name)
111 }
112 if($self->gene_member) {
113 $str .= sprintf(" %s %s %s:%d-%d",
114 $self->gene_member->stable_id, $self->gene_member->display_label || '', $self->gene_member->chr_name,
115 $self->gene_member->chr_start, $self->gene_member->chr_end);
116 } elsif($self->stable_id) {
117 $str .= sprintf(" (%d) %s", $self->member_id, $self->stable_id);
118 }
119 $str .= "\n";
120 }
121
122
123
124 =head2 name (overrides default method in Bio::EnsEMBL::Compara::Graph::CGObject)
125
126 Arg [1] : none
127 Example : $aligned_member->name();
128 Description : Returns the stable_id of the object (from the Bio::EnsEMBL::Compara::Member object).
129 Returntype : string
130 Exceptions : none
131 Caller : general
132 Status : Stable
133
134 =cut
135
136 sub name {
137 my $self = shift;
138 return $self->stable_id(@_);
139 }
140
141 1;
142