Bio::EnsEMBL::Analysis::RunnableDB HaplotypeMapper
SummaryIncluded librariesPackage variablesSynopsisDescriptionGeneral documentationMethods
Toolbar
WebCvsRaw content
Summary
Bio::EnsEMBL::Analysis::RunnableDB::HaplotypeProjection
Package variables
No package variables defined.
Included modules
Bio::EnsEMBL::Analysis::Config::HaplotypeProjection qw ( )
Bio::EnsEMBL::Analysis::Runnable::HaplotypeMapper
Bio::EnsEMBL::Analysis::RunnableDB
Bio::EnsEMBL::Analysis::RunnableDB::BaseGeneBuild
Bio::EnsEMBL::Utils::Exception qw ( throw warning )
Inherit
Bio::EnsEMBL::Analysis::RunnableDB::BaseGeneBuild
Synopsis
    my $obj = Bio::EnsEMBL::Analysis::RunnableDB::HaplotypeProjection->new(
-db => $db,
-input_id => $id,
);
$obj->fetch_input
$obj->run
my @newfeatures = $obj->output;
Description
This method is used to get project the genes annotated in the reference chromosome into the Haplotype regions.
Methods
addgenebuilder
No description
Code
fetch_inputDescriptionCode
get_genebuilders
No description
Code
input_id
No description
Code
newDescriptionCode
output
No description
Code
run
No description
Code
target
No description
Code
write_outputDescriptionCode
Methods description
fetch_inputcode    nextTop
    Function:   It fetches the slice or contig according to the input_id, 
and it defines the database where the
previous annotations are stored and create a Bio::EnsEMBL::Pipeline::GeneBuilder
object for that genomic, input_id and db
Returns : nothing
Args : none
newcodeprevnextTop
    Usage   :   $self->new(-DBOBJ       => $db,
-INPUT_ID => $id,
-SEQFETCHER => $sf,
-ANALYSIS => $analysis,
);
Function: creates a Bio::EnsEMBL::Analysis::RunnableDB::HaplotypeProjection object Returns : A Bio::EnsEMBL::Analysis::RunnableDB::HaplotypeProjection object Args : -dbobj: A Bio::EnsEMBL::DBSQL::DBAdaptor (required), -input_id: Hap_pair input id (required), -seqfetcher: A Sequence Fetcher Object, -analysis: A Bio::EnsEMBL::Analysis (optional) -extend: determines the extension of the virtual contig note: not implemented yet! -golden_path: determines the name of the golden path to use
write_outputcodeprevnextTop
    Title   :   write_output
Usage : $self->write_output
Function: Writes output data to db
Returns : array of exons (with start and end)
Args : none
Methods code
addgenebuilderdescriptionprevnextTop
sub addgenebuilder {
    my ($self,$arg,$target,$query) = @_;
    
    if (defined($arg) && defined($target) && defined($query)) {
	$self->{_genebuilder}{$target->id}{$query->id} = $arg;
    } 
    else {
	$self->throw("Wrong number of inputs [$arg,$target,$query]\n");
    }
}

############################################################
}
fetch_inputdescriptionprevnextTop
sub fetch_input {
    my( $self) = @_;
    
    $self->throw("No input id") unless defined($self->input_id);

    
    my $discarded_db = $self->get_dbadaptor("DISCARDED_DB");

    print "DISCARDED GENE DB: ", $discarded_db->dbname,"\n";

    # database where the genebuild produced genes are
my $ref_db = $self->get_dbadaptor("REFERENCE_DB"); print "ENSEMBL DB : ", $ref_db->dbname,"\n"; print $self->input_id,"\n"; my @input_id = split(/:/,$self->input_id); my $hap_slice = $ref_db->get_SliceAdaptor->fetch_by_region($input_id[0],$input_id[2],$input_id[3],$input_id[4],1,$input_id[1]); my $slice = $ref_db->get_SliceAdaptor->fetch_by_region($input_id[5],$input_id[7],$input_id[8],$input_id[9],1,$input_id[6]); #$self->fetch_sequence();
print "HAP_slice: ",$hap_slice,"\n"; print "REF_slice: ",$slice,"\n"; $self->query($hap_slice); $self->target($slice); print "QUERY: ",$self->query->seq_region_name,"\n"; print "TARGET: ",$self->target->seq_region_name,"\n"; my $genebuilder = new Bio::EnsEMBL::Analysis::Runnable::HaplotypeMapper ( '-hap_slice' => $self->query, '-slice' => $self->target, '-input_id' => $self->input_id, ); $genebuilder->discarded_db($discarded_db); $genebuilder->ensembl_db($ref_db); # store the object and the piece of genomic where it will run
$self->addgenebuilder($genebuilder,$self->target,$self->query); } ############################################################
}
get_genebuildersdescriptionprevnextTop
sub get_genebuilders {
    my ($self) = @_;
    
    return $self->{_genebuilder};
}

############################################################
}
input_iddescriptionprevnextTop
sub input_id {
    my ($self,$arg) = @_;
    
    if (defined($arg)) {
	$self->{_input_id} = $arg;
    }
    
    return $self->{_input_id};
}

############################################################
}
newdescriptionprevnextTop
sub new {
    my ($class,@args) = @_;

    my $self = $class->SUPER::new(@args);    
           
    return $self;
}

############################################################
}
outputdescriptionprevnextTop
sub output {
    my ($self, @output ) = @_;
    unless ( $self->{_output} ){
	$self->{_output} = [];
    }
    if (@output){
	push( @{$self->{_output}}, @output );
    }
    return @{$self->{_output}};
}

############################################################
}
rundescriptionprevnextTop
sub run {
  my ($self) = @_;
  
  my @mapping;

  # get a hash, with keys = contig/slice and value = genebuilder object
my $genebuilders = $self->get_genebuilders; #my @genes;
foreach my $target (keys %{ $genebuilders } ) { foreach my $query (keys %{$genebuilders->{$target}}){ $genebuilders->{$target}->{$query}->create_alignment; $genebuilders->{$target}->{$query}->filter_alignment; @mapping = $genebuilders->{$target}->{$query}->make_map_regions; print "I got mappings: ",@mapping,"\n"; } } $self->output( @mapping ); } ############################################################
# override the evil RunnableDB output method:
}
targetdescriptionprevnextTop
sub target {
  my ($self,$slice) = @_;
  
  if (defined($slice)) {
    $self->{_target} = $slice;
  }
  return $self->{_target};
}


1;
}
write_outputdescriptionprevnextTop
sub write_output {
  my($self,@mappings) = @_;
  
  #my $db = $self->get_dbadaptor("REFERENCE_DB") ;
@mappings = $self->output; print "REACH TEST 2 position\n"; print "now I have mappings: ",@mappings,"\n"; my $genebuilders = $self->get_genebuilders; foreach my $target (keys %{ $genebuilders } ) { foreach my $query (keys %{$genebuilders->{$target}}){ $genebuilders->{$target}->{$query}->load_tables(@mappings); } } return 1; } ############################################################
}
General documentation
CONTACTTop
Describe contact details here
APPENDIXTop
The rest of the documentation details each of the object methods.
Internal methods are usually preceded with a _