LICENSE
Copyright [1999-2015] Wellcome Trust Sanger Institute and the EMBL-European Bioinformatics Institute Copyright [2016-2024] EMBL-European Bioinformatics Institute
Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
CONTACT
Please email comments or questions to the public Ensembl
developers list at <http://lists.ensembl.org/mailman/listinfo/dev>.
Questions may also be sent to the Ensembl help desk at
<http://www.ensembl.org/Help/Contact>.
NAME
Bio::EnsEMBL::Utils::SeqDumper
SYNOPSIS
$seq_dumper = Bio::EnsEMBL::Utils::SeqDumper->new();
# don't dump snps or repeats
$seq_dumper->disable_feature_type('repeat');
$seq_dumper->disable_feature_type('variation');
# dump EMBL format to STDOUT
$seq_dumper->dump( $slice, 'EMBL' );
# dump GENBANK format to a file
$seq_dumper->dump( $slice, 'GENBANK', 'out.genbank' );
# dump FASTA format to a file
$seq_dumper->dump( $slice, 'FASTA', 'out.fasta' );
DESCRIPTION
A relatively simple and lite-weight flat file dumper for Ensembl slices. The memory efficiency could be improved and this is currently not very good for dumping very large sequences such as whole chromosomes.
METHODS
new
Arg [1] : none
Example : $seq_dumper = Bio::EnsEMBL::Utils::SeqDumper->new;
Description: Creates a new SeqDumper
Returntype : Bio::EnsEMBL::Utils::SeqDumper
Exceptions : none
Caller : general
enable_feature_type
Arg [1] : string $type
Example : $seq_dumper->enable_feature_type('similarity');
Description: Enables the dumping of a specific type of feature
Returntype : none
Exceptions : warn if invalid feature type is passed,
thrown if no feature type is passed
Caller : general
attach_database
Arg [1] : string name
Arg [2] : Bio::EnsEMBL::DBSQL::DBAdaptor
Example : $seq_dumper->attach_database('estgene', $estgene_db);
Description: Attaches a database to the seqdumper that can be used to
dump data which is external to the ensembl core database.
Currently this is necessary to dump est genes and vega genes
Returntype : none
Exceptions : thrown if incorrect argument is supplied
Caller : general
get_database
Arg [1] : string $name
Example : $db = $seq_dumper->get_database('vega');
Description: Retrieves a database that has been attached to the
seqdumper via the attach database call.
Returntype : Bio::EnsEMBL::DBSQL::DBAdaptor
Exceptions : thrown if incorrect argument is supplied
Caller : dump_feature_table
remove_database
Arg [1] : string $name
Example : $db = $seq_dumper->remove_database('estgene');
Description: Removes a database that has been attached to the seqdumper
via the attach database call. The database that is removed
is returned (or undef if it did not exist).
Returntype : Bio::EnsEMBL::DBSQL::DBAdaptor
Exceptions : thrown if incorrect argument is supplied
Caller : general
disable_feature_type
Arg [1] : string $type
Example : $seq_dumper->disable_feature_type('genes');
Description: Disables the dumping of a specific type of feature
Returntype : none
Exceptions : warn if an invalid feature type is passed,
thrown if no feature type is passed
Caller : general
is_enabled
Arg [1] : string $type
Example : do_something() if($seq_dumper->is_enabled('gene'));
Description: checks if a specific feature type is enabled
Returntype : none
Exceptions : warning if invalid type is passed,
thrown if no type is passed
Caller : general
dump
Arg [1] : Bio::EnsEMBL::Slice slice
The slice to dump
Arg [2] : string $format
The name of the format to dump
Arg [3] : (optional) $outfile
The name of the file to dump to. If no file is specified STDOUT
is used
Arg [4] : (optional) $seq
Sequence to dump
Arg [4] : (optional) $no_append
Default action is to open the file in append mode. This will
turn that mode off
Example : $seq_dumper->dump($slice, 'EMBL');
Description: Dumps a region of a genome specified by the slice argument into
an outfile of the format $format
Returntype : none
Exceptions : thrown if slice or format args are not supplied
Caller : general
dump_embl
Arg [1] : Bio::EnsEMBL::Slice
Arg [2] : IO::File $FH
Arg [3] : optional sequence string
Example : $seq_dumper->dump_embl($slice, $FH);
Description: Dumps an EMBL flat file to an open file handle
Returntype : none
Exceptions : if calls to get/set the filehandle position fail
Caller : dump
dump_genbank
Arg [1] : Bio::EnsEMBL::Slice
Arg [2] : IO::File $FH
Example : $seq_dumper->dump_genbank($slice, $FH);
Description: Dumps a GENBANK flat file to an open file handle
Returntype : none
Exceptions : none
Caller : dump
_dump_feature_table
Arg [1] : Bio::EnsEMBL::Slice slice
Example : none
Description: Helper method used to dump feature tables used in EMBL, FASTA,
GENBANK. Assumes formating of file handle has been setup
already to use $FEAT and $VALUE values.
Returntype : none
Exceptions : none
Caller : internal
_get_codon_table_id
Arg [1] : Bio::EnsEMBL::Slice slice
Example : none
Description: Helper method to get codon_table seq region attribute
codon_table defines the genetic code table used if other than the universal genetic code table (1)
By default it is 1 and is not shown in flat files.
If it is not equal to 1, then it is shown as a transl_table qualifier on the CDS feature.
Returntype : int
Caller : internal
dump_fasta
Arg [1] : Bio::EnsEMBL::Slice
Arg [2] : IO::File $FH
Example : $seq_dumper->dump_fasta($slice, $FH);
Description: Dumps an FASTA flat file to an open file handle
Returntype : none
Exceptions : none
Caller : dump
features2location
Arg [1] : listref of Bio::EnsEMBL::SeqFeatures
Example : $location = $self->features2location(\@features);
Description: Constructs an EMBL location string from a list of features
Returntype : string
Exceptions : none
Caller : internal
annotation_source
Arg [1] : Bio::EnsEMBL::DBSQL::MetaContainer
Example : $seq_dumper->annotation_source($meta_container);
Description: Constructs a string with gene annotation sources
Returntype : string
Exceptions : none
Caller : dump_embl, dump_genbank