Bio::EnsEMBL::Utils::Converter bio_ens
SummaryIncluded librariesPackage variablesDescriptionGeneral documentationMethods
Toolbar
WebCvsRaw content
Summary
Bio::EnsEMBL::Utils::Converter::bio_ens
Package variables
No package variables defined.
Included modules
Bio::EnsEMBL::Analysis
Bio::EnsEMBL::DBSQL::DBAdaptor
Bio::EnsEMBL::Utils::Converter
Inherit
Bio::EnsEMBL::Utils::Converter
Synopsis
No synopsis!
Description
Methods
_guess_module
No description
Code
_initialize
No description
Code
analysisDescriptionCode
analysis_dbIDDescriptionCode
analysis_logic_nameDescriptionCode
contigDescriptionCode
contig_dbIDDescriptionCode
contig_nameDescriptionCode
dbadaptorDescriptionCode
ensembl_dbDescriptionCode
newDescriptionCode
slice_chr_start_endDescriptionCode
slice_dbID
No description
Code
translation_id
No description
Code
Methods description
analysiscode    nextTop
  Title   : analysis
Usage : $self->analysis
Function: get and set for analysis
Return : Bio::EnsEMBL::Analysis
Args : Bio::EnsEMBL::Analysis
analysis_dbIDcodeprevnextTop
  Title   : analysis_dbID
Usage :
Function:
Return :
Args :
analysis_logic_namecodeprevnextTop
  Title   : analysis_logic_name
Usage :
Function:
Return :
Args :
contigcodeprevnextTop
  Title   : contig
Usage : $self->contig
Function: get and set for contig
Return :
Args :
contig_dbIDcodeprevnextTop
  Title   : contig_dbID
Usage : $self->contig_dbID
Function: get and set for contig_dbID
Return :
Args :
contig_namecodeprevnextTop
  Title   : contig_name
Usage : $self->contig_name
Function: get and set for contig_name
Return :
Args :
dbadaptorcodeprevnextTop
  Title   : dbadaptor
Usage : $self->dbadaptor
Function: get and set for dbadaptor
Return : Bio::EnsEMBL::DBSQL::DBAdaptor
Args : Bio::EnsEMBL::DBSQL::DBAdaptor
ensembl_dbcodeprevnextTop
  Title   : ensembl_db
Usage :
Function:
Return :
Args :
newcodeprevnextTop
Please see Bio::EnsEMBL::Utils::Converter::new
slice_chr_start_endcodeprevnextTop
  Title   : slice_chr_start_end
Usage : my $slice = $self->slice_chr_start_end($chr, $start, $end);
Function: get and set for slice_chr_start_end
Return :
Args :
Methods code
_guess_moduledescriptionprevnextTop
sub _guess_module {
    my ($self, $in, $out) = @_;
    my $tail;
    if($in eq 'Bio::Search::HSP::GenericHSP'){
        $tail = 'bio_ens_hsp';
    }elsif($in eq 'Bio::SeqFeature::Generic'){
        $tail = 'bio_ens_seqFeature';
    }elsif($in eq 'Bio::SeqFeature::FeaturePair'){
        $tail = 'bio_ens_featurePair';
    }elsif($in eq 'Bio::Pipeline::Analysis'){
        $tail = 'bio_ens_analysis';
    }elsif($in eq 'Bio::Tools::Prediction::Gene'){
        $tail = 'bio_ens_predictionGene';
    }elsif($in eq 'Bio::Tools::Prediction::Exon'){
        $tail = 'bio_ens_predictionExon';
    }elsif($in eq 'Bio::SeqFeature::Gene::GeneStructure'){
        $tail = 'bio_ens_gene';
    }elsif($in eq 'Bio::SeqFeature::Gene::Transcript'){
        $tail = 'bio_ens_transcript';
    }elsif($in eq 'Bio::SeqFeature::Gene::Exon'){
        $tail = 'bio_ens_exon';
    }else{
        $self->throw("[$in] to [$out], not supported");
    }
    return "Bio::EnsEMBL::Utils::Converter::$tail";
}
_initializedescriptionprevnextTop
sub _initialize {
    my ($self, @args) = @_;
    $self->SUPER::_initialize(@args);
    
    my ($dbadaptor, 
        $dbdriver, $dbhost, $dbport, $dbuser, $dbpass, $dbname,
        $analysis, $analysis_dbid, $analysis_logic_name, 
        $contig, $contig_dbid, $contig_name, 
        $translation_id) =
        
        $self->_rearrange([qw(DBADAPTOR 
            DBDRIVER DBHOST DBPORT DBUSER DBPASS DBNAME
            ANALYSIS ANALYSIS_DBID ANALYSIS_LOGIC_NAME 
            CONTIG CONTIG_DBID CONTIG_NAME
            TRANSLATION_ID)], @args);

    
    if(defined $dbadaptor){
        $self->dbadaptor($dbadaptor);
    }elsif(defined $dbname){
        $self->ensembl_db(@args);
    }else{
        # No db information.
} if(defined $analysis){ $self->analysis($analysis); # then ignore the analysis_dbid and analysis_logic_name
}elsif(defined $analysis_dbid){ $self->analysis_dbID($analysis_dbid); }elsif(defined $analysis_logic_name){ $self->analysis_logic_name($analysis_logic_name); }else{ # No analysis information offered
} if(defined $contig){ ($contig) = ref($contig) eq 'ARRAY' ? @{$contig} : $contig; $self->contig($contig); }elsif(defined $contig_dbid){ $self->contig_dbID($contig_dbid); }elsif(defined $contig_name){ $self->contig_name($contig_name); }else{ # No contig information
} if(defined $translation_id){ $self->translation_id($translation_id); }
}
analysisdescriptionprevnextTop
sub analysis {
    my ($self, $arg) = @_;
    if(defined($arg)){
        # convert the analysis, if it's not Bio::Pipeline::Analysis
if($arg->isa('Bio::Pipeline::Analysis')){ my $converter_for_analysis = new Bio::EnsEMBL::Utils::Converter( -in => 'Bio::Pipeline::Analysis', -out => 'Bio::EnsEMBL::Analysis' ); ($arg) = @{ $converter_for_analysis->convert([$arg]) }; } $self->throws("A Bio::EnsEMBL::Analysis object expected.") unless($arg->isa('Bio::EnsEMBL::Analysis')); $self->{_analysis} = $arg; $self->{_analysis_dbid} = $arg->dbID; $self->{_analysis_logic_name} = $arg->logic_name; } return $self->{_analysis};
}
analysis_dbIDdescriptionprevnextTop
sub analysis_dbID {
    my ($self, $arg) = @_;

    if(defined $arg){
        my $analysis;
        eval{
            $analysis = $self->dbadaptor->get_AnalysisAdaptor->fetch_by_dbID($arg);
        };
        $self->throw("Failed during fetching analysis by dbID\n$@") if($@);
        $self->analysis($analysis);
    }
    $self->{_analysis_dbid};
}
analysis_logic_namedescriptionprevnextTop
sub analysis_logic_name {
    my ($self, $arg) = @_;
    
    return $self->{_analysis_logic_name} unless(defined $arg);
    my $analysis;
    eval{
        $analysis = 
            $self->dbadaptor->get_AnalysisAdaptor->fetch_by_logic_name($arg);
    };
    $self->throw("Not found analysis with logic name as\[ $arg\]\n$@") if($@);

    $self->analysis($analysis);
    return $self->{_analysis_logic_name};
}
contigdescriptionprevnextTop
sub contig {
    my ($self, $arg) = @_;
    if(defined($arg)){
        if($arg->isa('Bio::EnsEMBL::RawContig')){
            $self->{_contig_dbid} = $arg->dbID;
            $self->{_contig_name} = $arg->name;
        }elsif($arg->isa('Bio::EnsEMBL::Slice')){
                $self->{_slice_dbid} = $arg->dbID;
        }elsif($arg->isa('Bio::PrimarySeqI')){
            ;
        }else{
            $self->throw("a Bio::EnsEMBL::RawContig needed");
        }
        $self->{_contig} = $arg;
        
    }
    return $self->{_contig};
}
contig_dbIDdescriptionprevnextTop
sub contig_dbID {
    my ($self, $arg) = @_;
    if(defined($arg)){
        my $contig;
        eval{
            $contig = 
                $self->dbadaptor->get_RawContigAdaptor->fetch_by_dbID($arg);
        };
        $self->throw("Failed during fetching contig by dbID\n$@") if($@);
        $self->contig($contig);
    }
    return $self->{_contig_dbid};
}
contig_namedescriptionprevnextTop
sub contig_name {
    my ($self, $arg) = @_;
    if(defined($arg)){
        my $contig;
        eval{
            $contig = 
                $self->dbadaptor->get_RawContigAdaptor->fetch_by_name($arg);
        };
        $self->throw("Failed during fetching contig by dbID\n$@") if($@);
        $self->contig($contig);
    }
    return $self->{_contig_name};
}
dbadaptordescriptionprevnextTop
sub dbadaptor {
    my ($self, $arg) = @_;
    if(defined($arg)){
        $self->throws("A Bio::EnsEMBL::DBSQL::DBAdaptor object expected.") unless(defined $arg);
        $self->{_dbadaptor} = $arg;
    }
    return $self->{_dbadaptor};
}
ensembl_dbdescriptionprevnextTop
sub ensembl_db {
    my ($self, @args) = @_;
    
    my ($dbdriver, $dbhost, $dbport, $dbuser, $dbpass, $dbname) = $self->_rearrange(
        [qw(DBDRIVER DBHOST DBPORT DBUSER DBPASS DBNAME)], @args);

    my $dbadaptor = new Bio::EnsEMBL::DBSQL::DBAdaptor(
        -driver => $dbdriver,
        -host => $dbhost,
        -port => $dbport,
        -user => $dbuser,
        -pass => $dbpass,
        -dbname => $dbname
    );
    $self->dbadaptor($dbadaptor);
}
newdescriptionprevnextTop
sub new {
    my ($caller, @args) = @_;
    my $class = ref($caller) || $caller;

    if($class eq 'Bio::EnsEMBL::Utils::Converter::bio_ens'){
        my %params = @args;
        @params{map{lc $_} keys %params} = values %params;
        my $module = $class->_guess_module($params{-in}, $params{-out});
        return undef unless ($class->_load_module($module));
        return "$module"->new(@args);
    }else{
        my $self = $class->SUPER::new(@args);
#        $self->_initialize(@args);
return $self; }
}
slice_chr_start_enddescriptionprevnextTop
sub slice_chr_start_end {
    my ($self, $chr, $start, $end) = @_;
    if(defined($chr) && defined($start) && defined($end)){
        my $slice;
        eval{
            my $sliceAdaptor = $self->dbadaptor->get_SliceAdaptor;
            $slice = $sliceAdaptor->fetch_by_chr_start_end($chr, $start, $end);
        };
        $self->throw("Failed to fetch slice by chr start end\n$@") if($@);
        $self->contig($slice);
    }
}
slice_dbIDdescriptionprevnextTop
sub slice_dbID {
    my ($self, $arg) = @_;
    if(defined($arg)){
        my $slice;
        $self->throw("undefined dbadpator") unless defined $self->dbadpaotr;

        eval{
            my $sliceAdaptor = $self->dbadaptor->get_SliceAdaptor;
            $slice = $sliceAdaptor->fetch_by_dbID($arg);
        };
            
        $self->throw("Failed to fetch slice by dbID\n$@") if($@);
        $self->contig($slice);
    }
}
translation_iddescriptionprevnextTop
sub translation_id {
    my ($self, $arg) = @_;
    return $self->{_translation_id} = $arg if(defined($arg));
    return $self->{_translation_id};
}
1;
}
General documentation
LICENSETop
  Copyright (c) 1999-2009 The European Bioinformatics Institute and
Genome Research Limited. All rights reserved.
This software is distributed under a modified Apache license. For license details, please see /info/about/code_licence.html
CONTACTTop
  Please email comments or questions to the public Ensembl
developers list at <ensembl-dev@ebi.ac.uk>.
Questions may also be sent to the Ensembl help desk at <helpdesk@ensembl.org>.
AUTHORTop
Juguang Xiao <juguang@fugu-sg.org>
SYNOPISISTop
You should not use this module directly. Please check out the
Bio::EnsEMBL::Utils::Converter module.
sliceTop
  Title   : slice
Usage : $self->slice
Function: get and set for slice
Return : Bio::EnsEMBL::Slice
Args : Bio::EnsEMBL::Slice