Skip to content
Snippets Groups Projects
Unverified Commit b71a83ae authored by Tamara El Naboulsi's avatar Tamara El Naboulsi Committed by GitHub
Browse files

Use hit_descritpion if external description not set (#651)


Co-authored-by: default avatarTamara El Naboulsi <ten@codon-slurm-login-03.ebi.ac.uk>
parent b0c531ff
No related branches found
No related tags found
No related merge requests found
......@@ -184,6 +184,11 @@ sub to_hash {
if (lc($feature_type) eq 'gene') {
$hash->{canonical_transcript} = $feature->canonical_transcript->stable_id.".".$feature->canonical_transcript->version;
}
if (lc($feature_type) eq 'protein_feature') {
if (defined($hash->{description}) && !$hash->{description}) {
$hash->{description} = $feature->{$feature_type}->{hdescription} if defined($feature->{$feature_type}->{hdescription});
}
}
push(@hashed, $hash);
}
return \@hashed;
......
......@@ -177,7 +177,7 @@ is_json_GET(
my $expected = [{ name => 'GO', description => undef, release => undef, display_name => 'GO' }];
is_json_GET('/info/external_dbs/homo_sapiens?filter=GO', $expected, 'Checking GO filtering works');
my $xref_external_dbs_json = json_GET('info/external_dbs/homo_sapiens?feature=xref', 'Get the xref external dbs hash');
is(scalar(@{$xref_external_dbs_json}), 38, 'Ensuring we have the right number of xref external_dbs available');
is(scalar(@{$xref_external_dbs_json}), 39, 'Ensuring we have the right number of xref external_dbs available');
action_bad_regex('/info/external_dbs/wibble', qr/Could not fetch adaptor for species .+/, 'Bogus species means error message');
}
......
......@@ -543,6 +543,46 @@ $base = '/overlap/translation';
eq_or_diff($json->[0], $expected, 'Checking that the overlap is at the expected location');
}
# Check that the correct description is returned
{
my $id = 'ENSP00000371073';
cmp_deeply(json_GET("$base/$id?type=smart", 'Ensembl Smart domains'), [{
cigar_string => '',
type => 'Smart',
translation_id => 725227,
start => 33,
description => 'plcx_3',
interpro => '',
end => 202,
align_type => undef,
Parent => 'ENST00000381657',
feature_type => 'protein_feature',
hit_start => 1,
hseqname => 'SM00148',
seq_region_name => 'ENSP00000371073',
id => 'SM00148',
hit_end => 182
}], 'Protein feature description displayed for \'Smart\' type');
cmp_deeply(json_GET("$base/$id?type=pfam", 'Ensembl Pfam domains'), [{
feature_type => 'protein_feature',
hit_start => 24,
align_type => undef,
translation_id => 725227,
cigar_string => '',
start => 84,
seq_region_name => 'ENSP00000371073',
Parent => 'ENST00000381657',
hit_end => 120,
interpro => 'IPR000001',
hseqname => 'PF00388',
id => 'PF00388',
type => 'Pfam',
description => 'Kringle',
end => 183
}], 'Interpro description displayed for \'Pfam\' type');
}
# Test retrieving variation features where no variation db exists
{
my $base = '/overlap/region/meleagris_gallopavo';
......@@ -567,5 +607,4 @@ $base = '/overlap/translation';
is(scalar(@{$json}), 1, '1 somatic structural variation feature overlaps input region');
}
done_testing();
IPR000001 PF00388
......@@ -71,9 +71,9 @@
3914981 725225 35 155 0 0 PS50007 8291 10.501 0 0 \N \N \N \N
3914982 725226 18 88 0 0 SSF51695 8288 0 0.000000000048 0 \N \N \N \N
3914983 725226 35 76 0 0 PS50007 8291 8.507 0 0 \N \N \N \N
3914984 725227 84 183 24 120 PF00388 8287 33.3 0.0000000000019 0 \N \N \N \N
3914984 725227 84 183 24 120 PF00388 8287 33.3 0.0000000000019 0 \N PI-PLC-X \N \N
3914985 725227 18 319 0 0 SSF51695 8288 0 9e-67 0 \N \N \N \N
3914986 725227 33 202 1 182 SM00148 8289 -32.9 0.0011 0 \N \N \N \N
3914986 725227 33 202 1 182 SM00148 8289 -32.9 0.0011 0 \N plcx_3 \N \N
3914987 725227 35 179 0 0 PS50007 8291 12.652 0 0 \N \N \N \N
3914988 725228 18 60 0 0 SSF51695 8288 0 0.0000000018 0 \N \N \N \N
3914989 725229 18 64 0 0 SSF51695 8288 0 0.0000000005 0 \N \N \N \N
......
......@@ -756,3 +756,4 @@
3656321 4610 OTTHUMT00000460262 OTTHUMT00000460262 1 \N NONE
3656322 12410 RP11-66N11.8-001 RP11-66N11.8-001 0 DIRECT
3656323 20046 ENSG00000073614 ENSG00000073614 0 DIRECT
3656324 1200 IPR000001 Kringle 0 Kringle DIRECT \N
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