Included libraries | Package variables | General documentation | Methods |
WebCvs | Raw content |
_columns | Description | Code |
_default_where_clause | Description | Code |
_final_clause | Description | Code |
_join | Description | Code |
_known_sources | No description | Code |
_objs_from_sth | Description | Code |
_tables | Description | Code |
fetch_all | No description | Code |
fetch_all_by_method_link_type | No description | Code |
fetch_by_dbID | Description | Code |
fetch_by_source | Description | Code |
fetch_by_stable_id | Description | Code |
generic_fetch | Description | Code |
generic_fetch_sth | Description | Code |
get_source_id_by_source_name | No description | Code |
get_source_name_by_source_id | No description | Code |
list_dbIDs | No description | Code |
list_internal_ids | No description | Code |
store_relation | No description | Code |
store_source | No description | Code |
update_relation | No description | Code |
_columns | code | next | Top |
Args : none |
_default_where_clause | code | prev | next | Top |
Arg [1] : none |
_final_clause | code | prev | next | Top |
Arg [1] : none |
_join | code | prev | next | Top |
Arg [1] : none |
_objs_from_sth | code | prev | next | Top |
Arg [1] : DBI::row_hashref $hashref containing key-value pairs |
_tables | code | prev | next | Top |
Args : none |
fetch_by_dbID | code | prev | next | Top |
Arg [1] : int $id |
fetch_by_source | code | prev | next | Top |
fetch_by_stable_id | code | prev | next | Top |
Arg [1] : string $stable_id |
generic_fetch | code | prev | next | Top |
Arg [1] : (optional) string $constraint |
generic_fetch_sth | code | prev | next | Top |
Arg [1] : (optional) string $constraint |
_columns | description | prev | next | Top |
my $self = shift; $self->throw("abstract method _columns not defined by implementing" . " subclass of BaseFeatureAdaptor");}
_default_where_clause | description | prev | next | Top |
my $self = shift; return '';}
_final_clause | description | prev | next | Top |
my $self = shift; return ''; } # DEPRECATED METHODS}
####################
_join | description | prev | next | Top |
my $self = shift; return '';}
_known_sources | description | prev | next | Top |
my ($self) = @_; deprecate("_know_sources method is deprecated.\n");}
_objs_from_sth | description | prev | next | Top |
my $self = shift; $self->throw("abstract method _obj_from_sth not defined by implementing" . " subclass of BaseFeatureAdaptor");}
_tables | description | prev | next | Top |
my $self = shift; $self->throw("abstract method _tables not defined by implementing" . " subclass of BaseFeatureAdaptor"); return undef;}
fetch_all | description | prev | next | Top |
my $self = shift; return $self->generic_fetch();}
fetch_all_by_method_link_type | description | prev | next | Top |
my ($self,$method_link_type) = @_; $self->throw("method_link_type arg is required\n") unless ($method_link_type); my $mlss_arrayref = $self->db->get_MethodLinkSpeciesSetAdaptor->fetch_all_by_method_link_type($method_link_type); unless (scalar @{$mlss_arrayref}) { warning("There is no $method_link_type data stored in the database\n"); return []; } my $constraint = ""; if ($self->isa('Bio::EnsEMBL::Compara::Homology')) { $constraint .= " h.method_link_species_set_id in (". join (",", (map {$_->dbID} @{$mlss_arrayref})) . ")"; } elsif ($self->isa('Bio::EnsEMBL::Compara::Family')) { $constraint .= " f.method_link_species_set_id in (". join (",", (map {$_->dbID} @{$mlss_arrayref})) . ")"; } elsif ($self->isa('Bio::EnsEMBL::Compara::Domain')) { $constraint .= " d.method_link_species_set_id in (". join (",", (map {$_->dbID} @{$mlss_arrayref})) . ")"; } return $self->generic_fetch($constraint);}
fetch_by_dbID | description | prev | next | Top |
my ($self,$id) = @_; unless(defined $id) { $self->throw("fetch_by_dbID must have an id"); } my @tabs = $self->_tables; my ($name, $syn) = @{$tabs[0]}; #construct a constraint like 't1.table1_id = 1'}
my $constraint = "${syn}.${name}_id = $id"; #return first element of _generic_fetch list
my ($obj) = @{$self->generic_fetch($constraint)}; return $obj;
fetch_by_source | description | prev | next | Top |
my ($self,$source_name) = @_; deprecate("Calling $self->fetch_all_by_method_link_type instead\n"); return $self->fetch_all_by_method_link_type($source_name);}
fetch_by_stable_id | description | prev | next | Top |
my ($self,$stable_id) = @_; unless(defined $stable_id) { $self->throw("fetch_by_stable_id must have an stable_id"); } my @tabs = $self->_tables; my ($name, $syn) = @{$tabs[0]}; #construct a constraint like 't1.table1_id = 1'}
my $constraint = "${syn}.stable_id = '$stable_id'"; #return first element of _generic_fetch list
my ($obj) = @{$self->generic_fetch($constraint)}; return $obj;
generic_fetch | description | prev | next | Top |
my ($self, $constraint, $join) = @_; my $sth = $self->generic_fetch_sth($constraint, $join); return $self->_objs_from_sth($sth);}
generic_fetch_sth | description | prev | next | Top |
my ($self, $constraint, $join) = @_; my @tables = $self->_tables; my $columns = join(', ', $self->_columns()); if ($join) { foreach my $single_join (@{$join}) { my ($tablename, $condition, $extra_columns) = @{$single_join}; if ($tablename && $condition) { push @tables, $tablename; if($constraint) { $constraint .= " AND $condition"; } else { $constraint = " $condition"; } } if ($extra_columns) { $columns .= ", " . join(', ', @{$extra_columns}); } } } #construct a nice table string like 'table1 t1, table2 t2'}
my $tablenames = join(', ', map({ join(' ', @$_) } @tables)); my $sql = "SELECT $columns FROM $tablenames"; my $default_where = $self->_default_where_clause; my $final_clause = $self->_final_clause; #append a where clause if it was defined
if($constraint) { $sql .= " WHERE $constraint "; if($default_where) { $sql .= " AND $default_where "; } } elsif($default_where) { $sql .= " WHERE $default_where "; } #append additional clauses which may have been defined
$sql .= " $final_clause"; my $sth = $self->prepare($sql); # warn $sql;
$sth->execute; return $sth;
get_source_id_by_source_name | description | prev | next | Top |
my ($self, $source_name) = @_; throw("get_source_id_by_source_name method is deprecated\n");}
get_source_name_by_source_id | description | prev | next | Top |
my ($self, $source_id) = @_; throw("get_source_name_by_source_id method is deprecated\n");}
list_dbIDs | description | prev | next | Top |
my $self = shift; my @tables = $self->_tables; my ($name, $syn) = @{$tables[0]}; my $sql = "SELECT ${syn}.${name}_id from ${name} ${syn}"; my $sth = $self->prepare($sql); $sth->execute; my $internal_id; $sth->bind_columns(\$internal_id); my @internal_ids; while ($sth->fetch()) { push @internal_ids, $internal_id; } $sth->finish; return\@ internal_ids;}
list_internal_ids | description | prev | next | Top |
my $self = shift; deprecate("list_internal_ids is deprecated. Calling list_dbIDs instead.\n"); return $self->list_dbIDs; } 1;}
store_relation | description | prev | next | Top |
my ($self, $member_attribute, $relation) = @_; my ($member, $attribute) = @{$member_attribute}; my $member_adaptor = $self->db->get_MemberAdaptor; unless (defined $member->dbID) { $member_adaptor->store($member); } $attribute->member_id($member->dbID); my $sql; my $sth; if ($relation->isa('Bio::EnsEMBL::Compara::Family')) { $attribute->family_id($relation->dbID); $sql = "INSERT IGNORE INTO family_member (family_id, member_id, cigar_line) VALUES (?,?,?)"; $sth = $self->prepare($sql); $sth->execute($attribute->family_id, $attribute->member_id, $attribute->cigar_line); } elsif ($relation->isa('Bio::EnsEMBL::Compara::Domain')) { $attribute->domain_id($relation->dbID); $sql = "INSERT IGNORE INTO domain_member (domain_id, member_id, member_start, member_end) VALUES (?,?,?,?)"; $sth = $self->prepare($sql); $sth->execute($attribute->domain_id, $attribute->member_id, $attribute->member_start, $attribute->member_end); } elsif ($relation->isa('Bio::EnsEMBL::Compara::Homology')) { $attribute->homology_id($relation->dbID); # $sql = "INSERT IGNORE INTO homology_member (homology_id, member_id, peptide_member_id, cigar_line, cigar_start, cigar_end, perc_cov, perc_id, perc_pos, peptide_align_feature_id) VALUES (?,?,?,?,?,?,?,?,?,?)";}
$sql = "INSERT IGNORE INTO homology_member (homology_id, member_id, peptide_member_id, cigar_line, cigar_start, cigar_end, perc_cov, perc_id, perc_pos) VALUES (?,?,?,?,?,?,?,?,?)"; $sth = $self->prepare($sql); # $sth->execute($attribute->homology_id, $attribute->member_id, $attribute->peptide_member_id, $attribute->cigar_line, $attribute->cigar_start, $attribute->cigar_end, $attribute->perc_cov, $attribute->perc_id, $attribute->perc_pos, $attribute->peptide_align_feature_id);
$sth->execute($attribute->homology_id, $attribute->member_id, $attribute->peptide_member_id, $attribute->cigar_line, $attribute->cigar_start, $attribute->cigar_end, $attribute->perc_cov, $attribute->perc_id, $attribute->perc_pos); }
store_source | description | prev | next | Top |
my ($self,$source_name) = @_; deprecate("store_source method is deprecated. Now this data has to be pre-stored in method_link table\n");}
update_relation | description | prev | next | Top |
my ($self, $member_attribute) = @_; my ($member, $attribute) = @{$member_attribute}; my $sql; my $sth; if (defined $attribute->family_id) { $sql = "UPDATE family_member SET cigar_line = ? WHERE family_id = ? AND member_id = ?"; $sth = $self->prepare($sql); $sth->execute($attribute->cigar_line, $attribute->family_id, $attribute->member_id); } else { $self->throw("update_relation only implemented for family relation, but you have either a domain or homology relation\n"); }}