Bio::Cluster SequenceFamily
SummaryIncluded librariesPackage variablesSynopsisDescriptionGeneral documentationMethods
Toolbar
WebCvsRaw content
Summary
Bio::Cluster::SequenceFamily - Sequence Family object
Package variables
No package variables defined.
Included modules
Bio::Cluster::FamilyI
Bio::Root::Root
Inherit
Bio::Cluster::FamilyI Bio::Root::Root
Synopsis
  use Bio::Cluster::SequenceFamily
use Bio::SeqIO; use Bio::Cluster::SequenceFamily; my $file = Bio::Root::IO->catfile('t','data','swiss.dat'); my $seqio= new Bio::SeqIO('-format' => 'swiss', '-file' => $file); my @mem; while(my $seq = $seqio->next_seq){ push @mem, $seq; } #create the family my $family = Bio::Cluster::SequenceFamily->new(-family_id=>"Family_1", -description=>"Family Description Here", -annotation_score=>"100", -members=>\@mem); #access the family foreach my $mem ($family->get_members){ print $mem->display_id."\t".$mem->desc."\n"; } #select members if members have a Bio::Species Object my @mem = $family->get_members(-binomial=>"Homo sapiens"); @mem = $family->get_members(-ncbi_taxid => 9606); @mem = $family->get_members(-common_name=>"Human"); @mem = $family->get_members(-species=>"sapiens"); @mem = $family->get_members(-genus=>"Homo");
Description
This is a simple Family object that may hold any group of object. For more
specific families, one should derive from FamilyI.
Methods
add_membersDescriptionCode
alignmentDescriptionCode
annotation_scoreDescriptionCode
cluster_scoreDescriptionCode
descriptionDescriptionCode
display_idDescriptionCode
family_idDescriptionCode
family_scoreDescriptionCode
get_membersDescriptionCode
members
No description
Code
newDescriptionCode
remove_membersDescriptionCode
sizeDescriptionCode
treeDescriptionCode
versionDescriptionCode
Methods description
add_memberscode    nextTop
 Title   : add_members
Usage : $fam->add_member([$seq1,$seq1]);
Function: add members to a family
Returns :
Args : the member(s) to add, as an array or arrayref
alignmentcodeprevnextTop
 Title   : alignment
Usage : $family->alignment($align);
Function: get/set for an alignment object representing
the multiple alignment of the members of the family.
Returns : Bio::SimpleAlign
annotation_scorecodeprevnextTop
 Title   : annotation_score
Usage : $family->annotation_score(100);
Function: get/set for annotation_score which
represent the confidence in which the
consensus description has been assigned
to the family.
Returns : Bio::SimpleAlign
cluster_scorecodeprevnextTop
 Title   : cluster_score
Usage : $fam->cluster_score(100);
Function: get/set for cluster_score which
represent the score in which the clustering
algorithm assigns to this cluster.
Returns : a number
descriptioncodeprevnextTop
 Title   : description
Usage : $fam->description("POLYUBIQUITIN")
Function: get/set for the consensus description of the cluster
Returns : the description string
Args : Optional the description string
display_idcodeprevnextTop
 Title   : display_id
Usage :
Function: Get/set the display name or identifier for the cluster
Returns : a string
Args : optional, on set the display ID ( a string)
family_idcodeprevnextTop
 Title   : family_id
Usage : $family->family_id("Family_1");
Function: get/set for family id
This is aliased to display_id(). Returns : a string specifying identifier of the family
family_scorecodeprevnextTop
 Title   : family_score
Usage : Bio::Cluster::FamilyI->family_score(95);
Function: get/set for the score of algorithm used to generate
the family if present
This is aliased to cluster_score(). Returns : the score Args : the score
get_memberscodeprevnextTop
 Title   : get_members
Usage : Valid criteria:
-common_name
-binomial
-ncbi_taxid
-organelle
-genus
$family->get_members(-common_name =>"human");
$family->get_members(-species =>"homo sapiens");
$family->get_members(-ncbi_taxid => 9606);
For now, multiple critieria are ORed.
Will return all members if no criteria are provided. Function: get members using methods from Bio::Species
the phylogenetic tree of the family.
Returns : an array of objects that are member of this family.
newcodeprevnextTop
 Title   : new
Usage : my $family = Bio::Cluster::SequenceFamily->new(-family_id=>"Family_1",
-description=>"Family Description Here",
-annotation_score=>"100",
-members=>\@mem);
Function: Constructor for SequenceFamily object
Returns : Bio::Cluster::SequenceFamily object
remove_memberscodeprevnextTop
 Title   : remove_members
Usage : $fam->remove_members();
Function: remove all members from a family
Returns : the previous array of members
Args : none
sizecodeprevnextTop
 Title   : size
Usage : $fam->size();
Function: get/set for the size of the family,
calculated from the number of members
Returns : the size of the family
Args :
treecodeprevnextTop
 Title   : tree
Usage : $family->tree($tree);
Function: get/set for an tree object representing
the phylogenetic tree of the family.
Returns : Bio::Tree
versioncodeprevnextTop
 Title   : version
Usage : $family->version("1.0");
Function: get/set for version
Returns : a string version of the family generated.
Methods code
add_membersdescriptionprevnextTop
sub add_members {
    my ($self,@mems) = @_;

    my $mem = shift(@mems);
    if(ref($mem) eq "ARRAY"){
	push @{$self->{'_members'}},@{$mem};
    } else {
	push @{$self->{'_members'}},$mem;
    }
    push @{$self->{'_members'}}, @mems;

    return 1;
}
alignmentdescriptionprevnextTop
sub alignment {
	my ($self,$align) = @_;
  if($align){
    $self->{'_alignment'} = $align;
  }
    return $self->{'_alignment'};
}
annotation_scoredescriptionprevnextTop
sub annotation_score {
  my ($self,$score) = @_;
  if($score){
    $self->{'_annotation_score'} = $score;
  }
  return $self->{'_annotation_score'};
}
cluster_scoredescriptionprevnextTop
sub cluster_score {
  my ($self,$score) = @_;
  if($score){
    $self->{'_cluster_score'} = $score;
  }
  return $self->{'_cluster_score'};
}
descriptiondescriptionprevnextTop
sub description {
  my ($self,$desc) = @_;
  if($desc){
    $self->{'_description'} = $desc;
  }
  return $self->{'_description'};
}
display_iddescriptionprevnextTop
sub display_id {
    my ($self,$id) = @_;
    if($id){
	$self->{'_cluster_id'} = $id;
    }
    return $self->{'_cluster_id'};
}
family_iddescriptionprevnextTop
sub family_id {
    return shift->display_id(@_);
}
family_scoredescriptionprevnextTop
sub family_score {
    return shift->cluster_score(@_);
}
get_membersdescriptionprevnextTop
sub get_members {
    my $self = shift;
    my @ret;
    
    if(@_) {
	my %hash = @_;
	foreach my $mem ( @{$self->{'_members'}} ) {
	    foreach my $key ( keys %hash){
		my $method = $key;
		$method=~s/-//g;
if($mem->can('species')){ my $species = $mem->species; $species->can($method) || $self->throw("$method is an invalid criteria"); if($species->$method() eq $hash{$key} ){ push @ret, $mem; } } } } return @ret; } return @{$self->{'_members'}};
}
membersdescriptionprevnextTop
sub members {
    my $self = shift;
    if(@_) {
	# this is in set mode
$self->warn("setting members() in ".ref($self)." is deprecated.\n". "Use add_members() instead."); return $self->add_members(@_); } else { # get mode
$self->warn("members() in ".ref($self)." is deprecated.\n". "Use get_members() instead."); return $self->get_members(); } } 1;
}
newdescriptionprevnextTop
sub new {
	my ($class,@args) = @_;
  my $self = $class->SUPER::new(@args);
  my ($id,$description,$version,$annot_score,
  $family_score,$members) = $self->_rearrange([qw(FAMILY_ID DESCRIPTION VERSION 
                                                   ANNOTATION_SCORE 
                                                   FAMILY_SCORE MEMBERS)],@args);
  $self->{'_members'} = [];
  $id && $self->family_id($id);
  $description && $self->description($description);
  $version && $self->version($version);
  $annot_score && $self->annotation_score($annot_score);
  $family_score && $self->family_score($family_score);
  $members && $self->add_members($members);

  return $self;
}
remove_membersdescriptionprevnextTop
sub remove_members {
    my ($self) =  @_;
    my $mems = $self->{'_members'};
    $self->{'_members'} = [];
    return @$mems;
}

#####################################################################
# aliases for naming consistency or other reasons #
#####################################################################
*flush_members =\& remove_members; *add_member =\& add_members;
}
sizedescriptionprevnextTop
sub size {
  my ($self) = @_;

  return scalar(@{$self->{'_members'}});
}
treedescriptionprevnextTop
sub tree {
  my ($self,$tree) = @_;
  if($tree) {
    $self->{'_tree'} = $tree;
  }
  return $self->{'_tree'};
}
versiondescriptionprevnextTop
sub version {
  my ($self,$value) = @_;
  if($value){
    $self->{'_version'} =$value;
  }
  return $self->{'_version'};
}
General documentation
FEEDBACKTop
Mailing ListsTop
User feedback is an integral part of the evolution of this and other
Bioperl modules. Send your comments and suggestions preferably to one
of the Bioperl mailing lists. Your participation is much appreciated.
  bioperl-l@bioperl.org              - General discussion
http://bio.perl.org/MailList.html - About the mailing lists
Reporting BugsTop
Report bugs to the Bioperl bug tracking system to help us keep track
the bugs and their resolution. Bug reports can be submitted via email
or the web:
  bioperl-bugs@bioperl.org
http://bugzilla.bioperl.org/
AUTHOR - Shawn Hoon Top
Email shawnh@fugu-sg.org
APPENDIXTop
The rest of the documentation details each of the object
methods. Internal methods are usually preceded with a "_".
Bio::Cluster::FamilyI methodsTop
Bio::ClusterI methodsTop
Implementation specific methodsTop
  These are mostly for adding/removing/changing.