$individual = Bio::EnsEMBL::Variation::Individual->new
(-name => 'WI530.07',
-description => 'african',
-gender => 'Male',
-father_individual => $father_ind,
-mother_individual => $mother_ind);
...
print $individual->name(), ' - ', $individual->description(), "\n";
print "Gender: ", $individual->gender(), "\n";
print $individual->mother_Individual->name()
if($individual->mother_Individual());
print $individual->father_Individual->name()
if($individual->father_Individual());
This is a class representing a single individual. An individual may be part
of one population or several. A pedigree may be constructed using the father_Individual
and mother_Individual attributes.
sub display
{ my $self = shift;
if(@_) {
my $display = uc(shift);
if($display ne 'UNDISPLAYABLE' && $display ne 'REFERENCE' && $display ne 'DISPLAYABLE' && $display ne 'DEFAULT') {
throw('Display flag must be one of "REFERENCE", "DEFAULT", "DISPLAYABLE", "UNDISPLAYABLE"');
}
$self->{'display'} = $display;
}
return $self->{'display'}; } |
sub father_Individual
{ my $self = shift;
if(@_) {
my $ind = shift;
if(defined($ind) && (!ref($ind) ||
!$ind->isa('Bio::EnsEMBL::Variation::Individual'))) {
throw('Bio::EnsEMBL::Variation::Individual arg expected');
}
if($ind->gender() eq 'Female') {
throw("Father individual may not have gender of Female");
}
return $self->{'father_individual'} = $ind;
}
if(!defined($self->{'father_individual'}) && $self->adaptor() &&
defined($self->{'_father_individual_sample_id'})) {
$self->{'father_individual'} =
$self->adaptor->fetch_by_dbID($self->{'_father_individual_sample_id'});
}
return $self->{'father_individual'}; } |
sub gender
{ my $self = shift;
if(@_) {
my $gender = ucfirst(lc(shift));
if($gender ne 'Male' && $gender ne 'Female' && $gender ne 'Unknown') {
throw('Gender must be one of "Male","Female","Unknown"');
}
$self->{'gender'} = $gender;
}
return $self->{'gender'}; } |
sub mother_Individual
{ my $self = shift;
if(@_) {
my $ind = shift;
if(defined($ind) && (!ref($ind) ||
!$ind->isa('Bio::EnsEMBL::Variation::Individual'))) {
throw('Bio::EnsEMBL::Variation::Individual arg expected');
}
if($ind->gender() eq 'Male') {
throw("Mother individual may not have gender of Male");
}
return $self->{'mother_individual'} = $ind;
}
if(!defined($self->{'mother_individual'}) && $self->adaptor() &&
defined($self->{'_mother_individual_sample_id'})) {
$self->{'mother_individual'} =
$self->adaptor->fetch_by_dbID($self->{'_mother_individual_sample_id'});
}
return $self->{'mother_individual'}; } |
sub new
{ my $caller = shift;
my $class = ref($caller) || $caller;
my ($dbID, $adaptor, $name, $desc, $display_flag, $gender, $father, $mother, $type_name, $type_desc,
$father_id, $mother_id) =
rearrange([qw(dbID adaptor name description display gender
father_individual mother_individual
type_individual type_description
father_individual_sample_id mother_individual_sample_id)], @_);
if(defined($gender)) {
$gender = ucfirst(lc($gender));
if($gender ne 'Male' && $gender ne 'Female' && $gender ne 'Unknown') {
throw('Gender must be one of "Male","Female","Unknown"');
}
}
if (defined($type_name)){
$type_name = ucfirst(lc($type_name));
if ($type_name ne 'Fully_inbred' && $type_name ne 'Partly_inbred' && $type_name ne 'Outbred' && $type_name ne 'Mutant'){
throw('Type of individual must of one of: "fully_inbred", "partly_inbred", "outbred", "mutant"');
}
}
return bless {'dbID' => $dbID,
'adaptor' => $adaptor,
'name' => $name,
'description' => $desc,
'display' => $display_flag,
'gender' => $gender,
'father_individual' => $father,
'mother_individual' => $mother,
'type_individual' => $type_name,
'type_description' => $type_desc,
'_mother_individual_sample_id' => $mother_id,
'_father_individual_sample_id' => $father_id}, $class; } |