TextMetaDataDumper.pm
Go to the documentation of this file.
00001 =head1 LICENSE
00002 
00003 Copyright [2009-2016] EMBL-European Bioinformatics Institute
00004 
00005 Licensed under the Apache License, Version 2.0 (the "License");
00006 you may not use this file except in compliance with the License.
00007 You may obtain a copy of the License at
00008 
00009      http://www.apache.org/licenses/LICENSE-2.0
00010 
00011 Unless required by applicable law or agreed to in writing, software
00012 distributed under the License is distributed on an "AS IS" BASIS,
00013 WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
00014 See the License for the specific language governing permissions and
00015 limitations under the License.
00016 
00017 =head1 CONTACT
00018 
00019   Please email comments or questions to the public Ensembl
00020   developers list at <dev@ensembl.org>.
00021 
00022   Questions may also be sent to the Ensembl help desk at
00023   <helpdesk@ensembl.org>.
00024 
00025 =head1 NAME
00026 
00027 Bio::EnsEMBL::MetaData::MetaDataDumper::TextMetaDataDumper
00028 
00029 =head1 SYNOPSIS
00030 
00031 =head1 DESCRIPTION
00032 
00033 Implementation to dump metadata details to a TSV file.
00034 See Bio::EnsEMBL::MetaData::MetaDataDumper for method details.
00035 
00036 =head1 SEE ALSO
00037 Bio::EnsEMBL::MetaData::MetaDataDumper
00038 
00039 =head1 AUTHOR
00040 
00041 Dan Staines
00042 
00043 =cut
00044 
00045 package Bio::EnsEMBL::MetaData::MetaDataDumper::TextMetaDataDumper;
00046 use base qw( Bio::EnsEMBL::MetaData::MetaDataDumper );
00047 use Bio::EnsEMBL::Utils::Argument qw(rearrange);
00048 use Data::Dumper;
00049 use Carp;
00050 use XML::Simple;
00051 use strict;
00052 use warnings;
00053 
00054 sub new {
00055   my ($proto, @args) = @_;
00056   my $self = $proto->SUPER::new(@args);
00057   $self->{file} ||= 'species.txt';
00058   return $self;
00059 }
00060 
00061 sub start {
00062   my ($self, $divisions, $file, $dump_all) = @_;
00063   $self->SUPER::start($divisions, $file, $dump_all);
00064   for my $fh (values %{$self->{files}}) {
00065     print $fh '#'
00066       .
00067       join("\t",
00068            qw(name species division taxonomy_id assembly assembly_accession genebuild variation pan_compara peptide_compara genome_alignments other_alignments core_db species_id)
00069       ) .
00070       "\n";
00071   }
00072   return;
00073 }
00074 
00075 sub _write_metadata_to_file {
00076   my ($self, $md, $fh) = @_;
00077   print $fh join("\t",
00078                  ($md->name(),
00079                   $md->species(),
00080                   $md->division(),
00081                   $md->taxonomy_id(),
00082                   $md->assembly_name() || '',
00083                   $md->assembly_id()   || '',
00084                   $md->genebuild()     || '',
00085                   $self->yesno($md->has_variations()),
00086                   $self->yesno($md->has_pan_compara()),
00087                   $self->yesno($md->has_peptide_compara()),
00088                   $self->yesno($md->has_genome_alignments()),
00089                   $self->yesno($md->has_other_alignments()),
00090                   $md->dbname(),
00091                   $md->species_id(),
00092                   "\n"));
00093   return;
00094 }
00095 
00096 1;
00097 __END__
00098 
00099 =pod
00100 
00101 =head1 NAME
00102 
00103 Bio::EnsEMBL::MetaData::MetaDataDumper::XMLMetaDataDumper
00104 
00105 =head1 SYNOPSIS
00106 
00107 =head1 DESCRIPTION
00108 
00109 implementation to dump metadata details to an XML file
00110 
00111 =head1 SUBROUTINES/METHODS
00112 
00113 =head2 new
00114 
00115 =head2 dump_metadata
00116 Description : Dump metadata to the file supplied by the constructor 
00117 Argument : Hash of details
00118 
00119 =head1 AUTHOR
00120 
00121 dstaines
00122 
00123 =head1 MAINTAINER
00124 
00125 $Author$
00126 
00127 =head1 VERSION
00128 
00129 $Revision$
00130 
00131 =cut