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
ed50c2d0
Commit
ed50c2d0
authored
13 years ago
by
Kieron Taylor
Browse files
Options
Downloads
Patches
Plain Diff
Minor nomenclature tweaks, and better support for Bio::Seq objects
parent
96e657f9
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
modules/Bio/EnsEMBL/Utils/IO/FASTASerializer.pm
+23
-19
23 additions, 19 deletions
modules/Bio/EnsEMBL/Utils/IO/FASTASerializer.pm
with
23 additions
and
19 deletions
modules/Bio/EnsEMBL/Utils/IO/FASTASerializer.pm
+
23
−
19
View file @
ed50c2d0
...
...
@@ -27,7 +27,7 @@ Bio::EnsEMBL::Utils::IO::FASTASerializer
my $serializer = Bio::EnsEMBL::Utils::IO::FASTASerializer->new($filehandle);
$serializer->chunk_factor(1000);
$serializer->line_width(60);
$serializer->print_S
lic
e($slice);
$serializer->print_Se
q
($slice);
$serializer = Bio::EnsEMBL::Utils::IO::FASTASerializer->new($filehandle,
sub {
...
...
@@ -35,8 +35,6 @@ Bio::EnsEMBL::Utils::IO::FASTASerializer
return ">Custom header";
}
);
$serializer->print_metadata($slice);
$serializer->print_Slice($slice,"no duplicate headers please");
=head1 DESCRIPTION
...
...
@@ -56,6 +54,7 @@ package Bio::EnsEMBL::Utils::IO::FASTASerializer;
use
strict
;
use
warnings
;
use
Bio::EnsEMBL::Utils::
Exception
;
use
Bio::EnsEMBL::Utils::
Scalar
qw/assert_ref check_ref/
;
use
base
qw(Bio::EnsEMBL::Utils::IO::Serializer)
;
...
...
@@ -93,13 +92,21 @@ sub new {
else
{
$self
->
{'
header_function
'}
=
sub
{
my
$slice
=
shift
;
my
$id
=
$slice
->
seq_region_name
;
my
$seqtype
=
'
dna
';
my
$idtype
=
$slice
->
coord_system
->
name
;
my
$location
=
$slice
->
name
;
return
"
>
$id
$seqtype
:
$idtype
$location
\n
";
}
if
(
check_ref
(
$slice
,
'
Bio::EnsEMBL::Slice
'))
{
my
$id
=
$slice
->
seq_region_name
;
my
$seqtype
=
'
dna
';
my
$idtype
=
$slice
->
coord_system
->
name
;
my
$location
=
$slice
->
name
;
return
"
>
$id
$seqtype
:
$idtype
$location
";
}
else
{
# must be a Bio::Seq , or we're doomed
return
"
>
"
.
$slice
->
name
;
}
};
}
...
...
@@ -118,31 +125,28 @@ sub print_metadata {
my
$self
=
shift
;
my
$slice
=
shift
;
my
$fh
=
$self
->
{'
filehandle
'};
my
$metadata
=
&
{
$self
->
{'
header_function
'}
}
(
$slice
);
print
$fh
$metadata
;
my
$metadata
=
$self
->
{'
header_function
'}
->
(
$slice
);
print
$fh
$metadata
.
"
\n
"
;
}
=head2 print_
slice
=head2 print_
Seq
Arg [1] : Bio::EnsEMBL::Slice or other Bio::PrimarySeqI compliant object
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
sub
print_S
lic
e
{
sub
print_Se
q
{
my
$self
=
shift
;
my
$slice
=
shift
;
my
$override
=
shift
;
my
$fh
=
$self
->
{'
filehandle
'};
# Default print header, override
$self
->
print_metadata
(
$slice
)
unless
$override
;
$self
->
print_metadata
(
$slice
);
# set buffer size
my
$chunk_size
=
$self
->
{'
chunk_factor
'}
*
$self
->
{'
line_width
'};
...
...
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