Skip to content
Snippets Groups Projects
Commit af33ebd3 authored by Alessandro Vullo's avatar Alessandro Vullo Committed by GitHub
Browse files

Merge pull request #157 from Ensembl/ENSCORESW-1912

Updated the new call to create the ProteinFeature object in ProteinFe…
parents 8de73f36 02956881
No related branches found
No related tags found
No related merge requests found
......@@ -143,13 +143,20 @@ sub fetch_all_by_logic_name {
sub fetch_by_dbID {
my ($self, $protfeat_id) = @_;
my $sth = $self->prepare("SELECT p.seq_start, p.seq_end, p.analysis_id, " . " p.score, p.perc_ident, p.evalue, " . " p.hit_start, p.hit_end, p.hit_name, " . " x.description, x.display_label, i.interpro_ac " . "FROM protein_feature p " . "LEFT JOIN interpro AS i ON p.hit_name = i.id " . "LEFT JOIN xref AS x ON x.dbprimary_acc = i.interpro_ac " . "WHERE p.protein_feature_id = ?");
my $sth = $self->prepare("SELECT p.translation_id, p.seq_start, p.seq_end, p.analysis_id, "
. "p.score, p.perc_ident, p.evalue, "
. "p.hit_start, p.hit_end, p.hit_name, p.hit_description, "
. "x.description, x.display_label, i.interpro_ac "
. "FROM protein_feature p "
. "LEFT JOIN interpro AS i ON p.hit_name = i.id "
. "LEFT JOIN xref AS x ON x.dbprimary_acc = i.interpro_ac "
. "WHERE p.protein_feature_id = ?");
$sth->bind_param(1, $protfeat_id, SQL_INTEGER);
my $res = $sth->execute();
my ($start, $end, $analysis_id, $score, $perc_ident, $pvalue, $hstart,
$hend, $hseqname, $idesc, $ilabel, $interpro_ac) = $sth->fetchrow_array();
my ($translation_id, $start, $end, $analysis_id, $score, $perc_ident, $pvalue, $hstart,
$hend, $hseqname, $hdesc, $idesc, $ilabel, $interpro_ac) = $sth->fetchrow_array();
if($sth->rows == 0) {
$sth->finish();
......@@ -168,13 +175,15 @@ sub fetch_by_dbID {
-HSTART => $hstart,
-HEND => $hend,
-HSEQNAME => $hseqname,
-HDESCRIPTION => $hdesc,
-ANALYSIS => $analysis,
-SCORE => $score,
-P_VALUE => $pvalue,
-PERCENT_ID => $perc_ident,
-IDESC => $idesc,
-ILABEL => $ilabel,
-INTERPRO_AC => $interpro_ac);
-ILABEL => $ilabel,
-INTERPRO_AC => $interpro_ac,
-TRANSLATION_ID => $translation_id);
} ## end sub fetch_by_dbID
=head2 store
......
......@@ -45,6 +45,7 @@ my $hdes = "Hit description";
my $idesc = 'interpro description';
my $ilabel = 'interpro label';
my $interpro_ac = 'interpro accession';
my $translation_id = 1234;
my $analysis = Bio::EnsEMBL::Analysis->new(-LOGIC_NAME => 'test');
......@@ -64,7 +65,8 @@ my $f = Bio::EnsEMBL::ProteinFeature->new
-HDESCRIPTION=> $hdes,
-IDESC => $idesc,
-ILABEL => $ilabel,
-INTERPRO_AC => $interpro_ac);
-INTERPRO_AC => $interpro_ac,
-TRANSLATION_ID => $translation_id);
......@@ -73,6 +75,7 @@ ok($f && $f->isa('Bio::EnsEMBL::ProteinFeature'));
ok($f->start == $start);
ok($f->end == $end);
ok($f->analysis == $analysis);
ok($f->translation_id == $translation_id);
ok($f->hstart == $hstart);
ok($f->hend == $hend);
......
......@@ -88,9 +88,29 @@ my $f = Bio::EnsEMBL::ProteinFeature->new
-IDESC => $idesc,
-INTERPRO_AC => $interpro_ac);
$pfa->store($f,21724);
my $dbID = $pfa->store($f,21724);
my $pfs = $pfa->fetch_all_by_translation_id(21724);
ok($dbID, "New object created has dbID");
#fetch protein feature object by dbID and compare the core attributes
#deep comparison is not possible because all the attributes are not stored in the protein_feature table
my $f_by_dbID = $pfa->fetch_by_dbID($dbID);
is($f_by_dbID->translation_id, 21724);
is($f_by_dbID->start, $start);
is($f_by_dbID->end, $end);
is($f_by_dbID->dbID, $dbID);
is($f_by_dbID->analysis->logic_name, 'test');
is($f_by_dbID->hstart, $hstart);
is($f_by_dbID->hend, $hend);
is($f_by_dbID->hseqname, $hseqname);
is($f_by_dbID->hdescription, $hdes);
is($f_by_dbID->score, $score);
is($f_by_dbID->percent_id, $percent_id);
is($f_by_dbID->p_value, $p_value);
$pfs = $pfa->fetch_all_by_translation_id(21724);
ok(@$pfs == 16);
......
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment