Bio::EnsEMBL::Compara::Production
GeneSet
Toolbar
Summary
Bio::EnsEMBL::Compara::Production::GeneSet
Package variables
No package variables defined.
Included modules
Inherit
Synopsis
An abstract data class for holding an arbitrary collection of
(ENSEMBLGENE)Member objects and providing set operations and
cross-reference operations to compare to another GeneSet object.
Also used by HomologySet.
Description
A 'set' object of Gene objects. Uses Member::stable_id to identify unique genes.
Is used for comparing GeneSet objects with each other and building comparison
matrixes.
Not really a production object, but more an abstract data type for use by
post analysis scripts. Placed in Production since I could not think of a better location.
The design of this object essentially was within the homology_diff.pl script
but has now been formalized into a proper object design.
Methods
add | No description | Code |
clear | No description | Code |
dealloc | No description | Code |
find_gene_like | No description | Code |
hashref_by_genome | No description | Code |
includes | No description | Code |
init | No description | Code |
intersection | No description | Code |
list | No description | Code |
merge | No description | Code |
print_stats | No description | Code |
relative_complement | No description | Code |
size | No description | Code |
Methods description
None available.
Methods code
sub add
{ my $self = shift;
my @gene_list = @_;
foreach my $gene (@gene_list) {
next if(defined($self->{'gene_hash'}->{$gene->stable_id}));
$self->{'gene_hash'}->{$gene->stable_id} = $gene;
}
return $self; } |
sub clear
{ my $self = shift;
$self->{'gene_hash'} = {}; } |
sub dealloc
{ my $self = shift;
return $self->SUPER::dealloc; } |
sub find_gene_like
{ my $self = shift;
my $gene = shift;
return $self->{'gene_hash'}->{$gene->stable_id};
}
} |
sub hashref_by_genome
{ my $self = shift;
my %types;
foreach my $gene (@{$self->list}) {
unless(defined($types{$gene->genome_db_id})) {
$types{$gene->genome_db_id} =
new Bio::EnsEMBL::Compara::Production::GeneSet;
}
$types{$gene->genome_db_id}->add($gene);
}
return\% types;
}
} |
sub includes
{ my $self = shift;
my $gene = shift;
return 1 if(defined($self->{'gene_hash'}->{$gene->stable_id}));
return 0; } |
sub init
{ my $self = shift;
$self->SUPER::init;
$self->clear;
return $self; } |
sub intersection
{ my $self = shift;
my $other_set = shift;
my $new_set = new Bio::EnsEMBL::Compara::Production::GeneSet;
foreach my $gene (@{$self->list}) {
if($other_set->includes($gene)) {
$new_set->add($gene);
}
}
return $new_set;
}
1; } |
sub list
{ my $self = shift;
my @genes = values(%{$self->{'gene_hash'}});
return\@ genes; } |
sub merge
{ my $self = shift;
my $other_set = shift;
$self->add(@{$other_set->list});
return $self;
}
} |
sub print_stats
{ my $self = shift;
printf("%d unique genes\n", $self->size); } |
sub relative_complement
{ my $self = shift;
my $other_set = shift;
my $new_set = new Bio::EnsEMBL::Compara::Production::GeneSet;
foreach my $gene (@{$other_set->list}) {
unless($self->includes($gene)) {
$new_set->add($gene);
}
}
return $new_set; } |
sub size
{ my $self = shift;
return scalar(@{$self->list}); } |
General documentation
The rest of the documentation details each of the object methods.
Internal methods are usually preceded with a _