Skip to content
Snippets Groups Projects
Commit eb40c9cb authored by Tiago Grego's avatar Tiago Grego
Browse files

code review updates

parent ebb043a7
No related branches found
No related tags found
2 merge requests!79ensembl Utils::IO into ensembl-io,!79ensembl Utils::IO into ensembl-io
...@@ -52,7 +52,7 @@ package Bio::EnsEMBL::Utils::IO::GFFSerializer; ...@@ -52,7 +52,7 @@ package Bio::EnsEMBL::Utils::IO::GFFSerializer;
use strict; use strict;
use warnings; use warnings;
use Bio::EnsEMBL::Utils::Exception; use Bio::EnsEMBL::Utils::Exception qw/throw deprecate/;
use URI::Escape; use URI::Escape;
use Bio::EnsEMBL::Utils::IO::FeatureSerializer; use Bio::EnsEMBL::Utils::IO::FeatureSerializer;
use Bio::EnsEMBL::Utils::Scalar qw/check_ref/; use Bio::EnsEMBL::Utils::Scalar qw/check_ref/;
...@@ -69,9 +69,9 @@ my %strand_conversion = ( '1' => '+', '0' => '.', '-1' => '-'); ...@@ -69,9 +69,9 @@ my %strand_conversion = ( '1' => '+', '0' => '.', '-1' => '-');
Returntype : Bio::EnsEMBL::Utils::IO::GFFSerializer Returntype : Bio::EnsEMBL::Utils::IO::GFFSerializer
Warning : If legacy mandatory 'Ontology Adaptor' first argument provided. Warning : If legacy new() method is used.
This argument has been removed but method will continue functioning if still provided, An 'Ontology Adaptor' was required as first argument. This argument has been removed but method will
raising only a warning to the user stating that it can be removed. provide backwards comparability showing a warning to the user stating that it can be removed.
=cut =cut
...@@ -83,15 +83,15 @@ sub new { ...@@ -83,15 +83,15 @@ sub new {
# this is to support and keep scripts using the legacy constructor functioning (with an extra warning) # this is to support and keep scripts using the legacy constructor functioning (with an extra warning)
# Can probably be removed some time in the future # Can probably be removed some time in the future
if ( check_ref($arg1, "Bio::EnsEMBL::DBSQL::OntologyTermAdaptor" )) { if ( check_ref($arg1, "Bio::EnsEMBL::DBSQL::OntologyTermAdaptor" )) {
warning("GFF format does not require an instance of Bio::EnsEMBL::DBSQL::OntologyTermAdaptor anymore." deprecate("new() does not require an instance of Bio::EnsEMBL::DBSQL::OntologyTermAdaptor anymore."
. "\nFirst argument at Bio::EnsEMBL::Utils::IO::GFFSerializer->new() can be safely removed."); . "\nFirst argument of method call can be safely removed.");
$arg1 = shift; $arg1 = shift;
} }
my $arg2 = shift; my $arg2 = shift;
my $self = { my $self = {
filehandle => $arg1, filehandle => $arg1,
default_source => $arg2 default_source => $arg2
}; };
bless $self, $class; bless $self, $class;
...@@ -159,7 +159,7 @@ sub print_feature { ...@@ -159,7 +159,7 @@ sub print_feature {
} }
# could not get it, throw exception # could not get it, throw exception
if ( !$so_term ) { if ( !$so_term ) {
throw "Unable to find an SO term for feature %s.", $summary{id}; throw("Unable to find an SO term for feature %s.", $summary{id});
} }
if ($so_term eq 'protein_coding_gene') { if ($so_term eq 'protein_coding_gene') {
...@@ -269,14 +269,14 @@ sub print_feature { ...@@ -269,14 +269,14 @@ sub print_feature {
while(my $attribute = shift @keys) { while(my $attribute = shift @keys) {
my $data_written = 0; my $data_written = 0;
if (ref $summary{$attribute} eq "ARRAY") { if (ref $summary{$attribute} eq "ARRAY") {
if (scalar(@{$summary{$attribute}}) > 0) { if (scalar(@{$summary{$attribute}}) > 0) {
$row .= $attribute."=".join (',',map { uri_escape($_,'\t\n\r;=%&,') } grep { defined $_ } @{$summary{$attribute}}); $row .= $attribute."=".join (',',map { uri_escape($_,'\t\n\r;=%&,') } grep { defined $_ } @{$summary{$attribute}});
$data_written = 1; $data_written = 1;
} }
} }
else { else {
if (defined $summary{$attribute}) { if (defined $summary{$attribute}) {
$row .= $attribute."=".uri_escape($summary{$attribute},'\t\n\r;=%&,'); $row .= $attribute . "=" . uri_escape($summary{$attribute} , '\t\n\r;=%&,');
$data_written = 1; $data_written = 1;
} }
} }
......
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