Summary | Included libraries | Package variables | Synopsis | Description | General documentation | Methods |
WebCvs | Raw content |
my $runnableDB = Bio::EnsEMBL::Analysis::RunnableDB::Infernal->new(
-db => $db_adaptor,
-input_id => $flag_id,
-analysis => $analysis,
);
$runnabledb->fetch_input();
$runnabledb->run();
$runnabledb->write_output();
fetch_input | Description | Code |
gene_db | Description | Code |
run | Description | Code |
write_output | Description | Code |
fetch_input | code | next | Top |
Title : fetch_input |
gene_db | code | prev | next | Top |
Arg [1] : Bio::EnsEMBL::DBSQL::DBAdaptor |
run | code | prev | next | Top |
Args : none |
write_output | code | prev | next | Top |
Args : none |
fetch_input | description | prev | next | Top |
my ($self)=@_; # open connection to genes database}
# if you want to write the final genes into the pipeline database need
# to catch it first and store the $self->db as the genes->db otherwise the
# registry will cause problems
if ( $$DATABASES{'GENEBUILD_DB'}{'-dbname'} eq $self->db->dbc->dbname && $$DATABASES{'GENEBUILD_DB'}{'-host'} eq $self->db->dbc->port && $$DATABASES{'GENEBUILD_DB'}{'-port'} == $self->db->dbc->host){ $self->gene_db($self->db); } else { my $genes_db = $self->get_dbadaptor("GENEBUILD_DB"); $self->gene_db($genes_db); } #add dna_db
my $dna_db = $self->get_dbadaptor($DNA_DBNAME) ; $self->db->dnadb($dna_db); my ($start,$end); my (@dafs,@queries); my $padding = 200; my $fa = Bio::EnsEMBL::Pipeline::DBSQL::FlagAdaptor->new($self->db); my $dafa = $self->db->get_DnaAlignFeatureAdaptor; my $sa = $self->db->get_SliceAdaptor; my $runname = "Bio::EnsEMBL::Analysis::Runnable::Infernal"; if ($self->input_id =~ /(\d+):(\d+)/) { $start = $1; $end = $2; } elsif ($self->input_id =~ /^(\d+)/) { $start = $1; $end = $1; } unless ($start){ $self->throw("Input id not recognised\n"); } # get ids
for (my $i = $start ; $i <= $end ; $i++){ my $flag; # try and fetch it
eval{ $flag = $fa->fetch_by_dbID($i); }; if ($flag && $flag->goalAnalysis->logic_name eq $self->analysis->logic_name){ my $daf = $dafa->fetch_by_dbID($flag->ensembl_id); push @dafs, $daf; } } # Make the runnable
my $runnable = $runname->new ( -queries =>\@ dafs, -analysis => $self->analysis, -program => $self->analysis->program_file ); $self->runnable($runnable);
gene_db | description | prev | next | Top |
my ($self, $gene_db) = @_; if ($gene_db){ unless ($gene_db->isa("Bio::EnsEMBL::DBSQL::DBAdaptor")){ $self->throw("gene db is not a Bio::EnsEMBL::DBSQL::DBAdaptor, it is a $gene_db"); } $self->{'_gene_db'} = $gene_db; } return $self->{'_gene_db'}; } 1;}
run | description | prev | next | Top |
my ($self) = @_; foreach my $runnable (@{$self->runnable}) { $self->throw("Runnable module not set") unless ($runnable->isa("Bio::EnsEMBL::Analysis::Runnable")); $runnable->run(); $self->output($runnable->output); }}
write_output | description | prev | next | Top |
my ($self) = @_; my $adaptor = $self->gene_db->get_GeneAdaptor; my $aa = $self->gene_db->get_AttributeAdaptor; my $dbea = $self->gene_db->get_DBEntryAdaptor; my @attributes; my $xref; foreach my $gene_hash (@{$self->output}){ my $gene = $gene_hash->{'gene'}; @attributes = @{$gene_hash->{'attrib'}}; $xref = $gene_hash->{'xref'}; $gene->analysis($self->analysis); $gene->status('PREDICTED'); foreach my $trans (@{$gene->get_all_Transcripts}){ $trans->analysis($self->analysis); $trans->status('PREDICTED'); } $gene->slice($self->query) if(!$gene->slice); $self->feature_factory->validate($gene); eval{ $adaptor->store($gene); }; if($@){ $self->throw("Infernal:store failed, failed to write ".$gene." to ". "the database $@"); } foreach my $trans (@{$gene->get_all_Transcripts}){ eval{ $aa->store_on_Transcript($trans->dbID,\@attributes); $dbea->store($xref, $trans->dbID, 'Transcript') if $xref; $trans->display_xref($xref); $gene->display_xref($xref); $self->gene_db->get_TranscriptAdaptor->update($trans); $self->gene_db->get_GeneAdaptor->update($gene); }; if($@){ $self->throw("Infernal:store failed, failed to write xrefs or attributes on transcript ". $trans." in the database $@"); } } } return 1; } #########################################################}
# Containers
CONTACT | Top |