From 00e7cc8cb2d3c26800cdb2a19385991f13ffe3f8 Mon Sep 17 00:00:00 2001 From: Kieron Taylor <ktaylor@ebi.ac.uk> Date: Thu, 12 Jan 2012 11:50:17 +0000 Subject: [PATCH] Added header override, to prevent default printing. Useful in case of very custom header functions. --- modules/Bio/EnsEMBL/Utils/IO/FASTASerializer.pm | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/modules/Bio/EnsEMBL/Utils/IO/FASTASerializer.pm b/modules/Bio/EnsEMBL/Utils/IO/FASTASerializer.pm index 0e32545fab..576858a829 100644 --- a/modules/Bio/EnsEMBL/Utils/IO/FASTASerializer.pm +++ b/modules/Bio/EnsEMBL/Utils/IO/FASTASerializer.pm @@ -35,6 +35,8 @@ Bio::EnsEMBL::Utils::IO::FASTASerializer return ">Custom header"; } ); + $serializer->print_metadata($slice); + $serializer->print_Slice($slice,"no duplicate headers please"); =head1 DESCRIPTION @@ -123,9 +125,13 @@ sub print_metadata { =head2 print_slice Arg [1] : Bio::EnsEMBL::Slice or other Bio::PrimarySeqI compliant object - Description: Serialises the slice into FASTA format. Buffering is used + Arg [2] : Optional Boolean - override the default serialisation of a header + Description: Serializes the slice into FASTA format. Buffering is used While other Bioperl PrimarySeqI implementations can be used, a custom header function will be required to accommodate it. + + Add an override as second argument if more control is needed + over when and how custom headers are written. Returntype : None =cut @@ -133,9 +139,10 @@ sub print_metadata { sub print_Slice { my $self = shift; my $slice = shift; + my $override = shift; my $fh = $self->{'filehandle'}; - # Insert header line - $self->print_metadata($slice); + # Default print header, override + $self->print_metadata($slice) unless $override; # set buffer size my $chunk_size = $self->{'chunk_factor'} * $self->{'line_width'}; -- GitLab