Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
E
ensembl
Manage
Activity
Members
Labels
Plan
Issues
0
Issue boards
Milestones
Iterations
Wiki
Requirements
Jira
Code
Merge requests
1
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Test cases
Artifacts
Deploy
Releases
Package Registry
Container Registry
Operate
Environments
Terraform modules
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Issue analytics
Insights
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
ensembl-gh-mirror
ensembl
Commits
3c3d165f
Commit
3c3d165f
authored
11 years ago
by
Alessandro Vullo
Browse files
Options
Downloads
Patches
Plain Diff
Use SequenceOntologyMapper instead of BiotypeMapper to map features to SO terms.
parent
7daab268
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
modules/Bio/EnsEMBL/Utils/IO/GFFSerializer.pm
+8
-6
8 additions, 6 deletions
modules/Bio/EnsEMBL/Utils/IO/GFFSerializer.pm
with
8 additions
and
6 deletions
modules/Bio/EnsEMBL/Utils/IO/GFFSerializer.pm
+
8
−
6
View file @
3c3d165f
...
...
@@ -17,7 +17,6 @@ GFFSerializer - Feature to GFF converter
=head1 SYNOPSIS
use Bio::EnsEMBL::Utils::IO::GFFSerializer;
use Bio::EnsEMBL::Utils::BiotypeMapper;
my $ontology_adaptor = $registry->get_adaptor( 'Multi', 'Ontology', 'OntologyTerm' );
my $serializer = Bio::EnsEMBL::Utils::IO::GFFSerializer->new($ontology_adaptor,$output_fh);
...
...
@@ -30,15 +29,17 @@ $serializer->print_feature_Iterator($iterator);
=head1 DESCRIPTION
Subclass of Serializer that can turn a feature into a line for the GFF3 format. Requires
a BiotypeMapper in order to translate biotypes to SO terms.
a SequenceOntologyMapper in order to translate features (biotypes in case of genes and
transcripts) to SO terms.
=cut
package
Bio::EnsEMBL::Utils::IO::
GFFSerializer
;
use
strict
;
use
warnings
;
use
Bio::EnsEMBL::Utils::
Exception
;
use
Bio::EnsEMBL::Utils::
Biotype
Mapper
;
use
Bio::EnsEMBL::Utils::
SequenceOntology
Mapper
;
use
URI::
Escape
;
use
Bio::EnsEMBL::Utils::IO::
FeatureSerializer
;
use
Bio::EnsEMBL::Utils::
Scalar
qw/check_ref/
;
...
...
@@ -69,7 +70,7 @@ sub new {
if
(
!
check_ref
(
$self
->
{'
ontology_adaptor
'},
"
Bio::EnsEMBL::DBSQL::OntologyTermAdaptor
"
))
{
throw
("
GFF format requires an instance of Bio::EnsEMBL::DBSQL::OntologyTermAdaptor to function. See also Bio::EnsEMBL::Utils::BiotypeMapper
");
}
$self
->
{'
mapper
'}
=
new
Bio::EnsEMBL::Utils::
Biotype
Mapper
(
$self
->
{'
ontology_adaptor
'});
$self
->
{'
mapper
'}
=
Bio::EnsEMBL::Utils::
SequenceOntology
Mapper
->
new
(
$self
->
{'
ontology_adaptor
'});
if
(
!
defined
(
$self
->
{'
filehandle
'}))
{
# no file handle, let the handle point to a copy of STDOUT instead
...
...
@@ -97,7 +98,7 @@ sub new {
sub
print_feature
{
my
$self
=
shift
;
my
$feature
=
shift
;
my
$
biotype
_mapper
=
$self
->
{'
mapper
'};
my
$
so
_mapper
=
$self
->
{'
mapper
'};
my
$text_buffer
=
"";
if
(
$feature
->
can
('
summary_as_hash
')
)
{
...
...
@@ -112,7 +113,8 @@ sub print_feature {
$row
.=
qq{\t}
;
# Column 3 - feature, the ontology term for the kind of feature this row is
my
$so_term
=
$biotype_mapper
->
translate_feature_to_SO_term
(
$feature
);
my
$so_term
=
eval
{
$so_mapper
->
to_name
(
$feature
);
};
$@
and
throw
sprintf
"
Unable to map feature %s to SO term.
\n
$@
",
$summary
{
ID
};
$row
.=
$so_term
.
"
\t
";
# Column 4 - start, the start coordinate of the feature, here shifted to chromosomal coordinates
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment