Skip to content
Snippets Groups Projects
Commit dc9ce250 authored by Magali Ruffier's avatar Magali Ruffier
Browse files

ENSCORESW-914: idesc should really be xref.description field

ilabel added for xref.display_label field
parent 4f241913
No related branches found
No related tags found
3 merge requests!25GFF3 export: unstranded features and using analysis.gff_source,!25GFF3 export: unstranded features and using analysis.gff_source,!25GFF3 export: unstranded features and using analysis.gff_source
......@@ -92,13 +92,13 @@ sub fetch_all_by_translation_id {
my @features;
my $analysis_adaptor = $self->db()->get_AnalysisAdaptor();
my $sth = $self->prepare("SELECT protein_feature_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.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.translation_id = ?");
my $sth = $self->prepare("SELECT protein_feature_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.translation_id = ?");
$sth->bind_param(1, $translation_id, SQL_INTEGER);
$sth->execute();
while (my $row = $sth->fetchrow_arrayref) {
my ($dbID, $start, $end, $analysisid, $score, $perc_id, $evalue, $hstart, $hend, $hid, $hdesc, $desc, $interpro_ac) = @$row;
my ($dbID, $start, $end, $analysisid, $score, $perc_id, $evalue, $hstart, $hend, $hid, $hdesc, $desc, $ilabel, $interpro_ac) = @$row;
my $analysis = $analysis_adaptor->fetch_by_dbID($analysisid);
......@@ -120,6 +120,7 @@ sub fetch_all_by_translation_id {
-HSEQNAME => $hid,
-HDESCRIPTION => $hdesc,
-IDESC => $desc,
-ILABEL => $ilabel,
-INTERPRO_AC => $interpro_ac);
push(@features, $feat);
......@@ -146,13 +147,13 @@ sub fetch_all_by_translation_id {
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.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.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 = ?");
$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, $interpro_ac) = $sth->fetchrow_array();
$hend, $hseqname, $idesc, $ilabel, $interpro_ac) = $sth->fetchrow_array();
if($sth->rows == 0) {
$sth->finish();
......@@ -176,6 +177,7 @@ sub fetch_by_dbID {
-P_VALUE => $pvalue,
-PERCENT_ID => $perc_ident,
-IDESC => $idesc,
-ILABEL => $ilabel,
-INTERPRO_AC => $interpro_ac);
} ## end sub fetch_by_dbID
......
......@@ -86,13 +86,14 @@ sub new {
my $class = ref($proto) || $proto;
my ($idesc, $interpro_ac, $translation_id) = rearrange(['IDESC', 'INTERPRO_AC', 'TRANSLATION_ID'], @_);
my ($idesc, $ilabel, $interpro_ac, $translation_id) = rearrange(['IDESC', 'ILABEL', 'INTERPRO_AC', 'TRANSLATION_ID'], @_);
my $self = $class->SUPER::new(@_);
# the strand of protein features is always 0
$self->{'strand'} = 0;
$self->{'idesc'} = $idesc || '';
$self->{'ilabel'} = $ilabel || '';
$self->{'interpro_ac'} = $interpro_ac || '';
$self->{'translation_id'} = $translation_id || '';
......@@ -134,6 +135,25 @@ sub idesc {
return $self->{'idesc'};
}
=head2 ilabel
Arg [1] : (optional) string The interpro label
Example : print $protein_feature->ilabel();
Description: Getter/Setter for the interpro label of this protein
feature.
Returntype : string
Exceptions : none
Caller : general
Status : Stable
=cut
sub ilabel {
my $self = shift;
$self->{'ilabel'} = shift if (@_);
return $self->{'ilabel'};
}
=head2 interpro_ac
Arg [1] : (optional) string The interpro accession
......
......@@ -41,6 +41,7 @@ my $hspecies = 'Mus_musculus';
my $hdes = "Hit description";
my $idesc = 'interpro description';
my $ilabel = 'interpro label';
my $interpro_ac = 'interpro accession';
my $analysis = Bio::EnsEMBL::Analysis->new(-LOGIC_NAME => 'test');
......@@ -60,6 +61,7 @@ my $f = Bio::EnsEMBL::ProteinFeature->new
-HSPECIES => $hspecies,
-HDESCRIPTION=> $hdes,
-IDESC => $idesc,
-ILABEL => $ilabel,
-INTERPRO_AC => $interpro_ac);
......@@ -81,6 +83,7 @@ ok($f->hspecies eq $hspecies);
ok($f->hdescription eq $hdes);
ok($f->idesc eq $idesc);
ok($f->ilabel eq $ilabel);
ok($f->interpro_ac eq $interpro_ac);
# check that the strand is 0
......@@ -90,6 +93,7 @@ ok($f->strand == 0);
# Test setters
#
ok(test_getter_setter($f, 'idesc', 'interpro desc1'));
ok(test_getter_setter($f, 'ilabel', 'interpro label1'));
ok(test_getter_setter($f, 'interpro_ac', 'interpro ac1'));
......
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