0
|
1 =pod
|
|
2
|
|
3 =head1 NAME
|
|
4
|
|
5 Bio::EnsEMBL::Hive::RunnableDB::Funcgen::SetupAnnotationPipeline
|
|
6
|
|
7 =head1 DESCRIPTION
|
|
8
|
|
9 'SetupAnnotationPipeline' Checks cell types and creates annotation processes for each
|
|
10 This Runnable CANNOT be run multiple times in parallell!
|
|
11
|
|
12 =cut
|
|
13
|
|
14 package Bio::EnsEMBL::Funcgen::RunnableDB::SetupAnnotationPipeline;
|
|
15
|
|
16 use warnings;
|
|
17 use strict;
|
|
18 use Bio::EnsEMBL::DBSQL::DBAdaptor;
|
|
19 use Bio::EnsEMBL::Funcgen::DBSQL::DBAdaptor;
|
|
20 use Bio::EnsEMBL::Utils::Exception qw(throw warning stack_trace_dump);
|
|
21
|
|
22 use base ('Bio::EnsEMBL::Funcgen::RunnableDB::Annotation');
|
|
23
|
|
24 sub fetch_input { # fetch parameters...
|
|
25 my $self = shift @_;
|
|
26
|
|
27 $self->SUPER::fetch_input();
|
|
28
|
|
29 #Sets up the output dir
|
|
30 my $output_dir = $self->_output_dir();
|
|
31 if(! -d $output_dir){
|
|
32 system("mkdir -p $output_dir") && throw("Couldn't create output directory $output_dir");
|
|
33 }
|
|
34
|
|
35 return 1;
|
|
36 }
|
|
37
|
|
38 sub run { # Check parameters and do appropriate database/file operations...
|
|
39 my $self = shift @_;
|
|
40
|
|
41 my $efgdba = $self->_efgdba();
|
|
42 #Check how many different cell types exist with regulatory features for current species
|
|
43 #Creates the appropriate jobs
|
|
44 my @reg_sets = @{$efgdba->get_FeatureSetAdaptor->fetch_all_by_type('regulatory')};
|
|
45 my @cell_types;
|
|
46 foreach my $set (@reg_sets){
|
|
47 if($set->cell_type->name ne 'MultiCell'){
|
|
48 push @cell_types, $set->cell_type->name;
|
|
49 }
|
|
50 }
|
|
51 $self->_cell_types_to_run(\@cell_types);
|
|
52
|
|
53 return 1;
|
|
54 }
|
|
55
|
|
56
|
|
57 sub write_output { # Create the relevant job
|
|
58 my $self = shift @_;
|
|
59
|
|
60 foreach my $cell_type (@{$self->_cell_types_to_run()}){
|
|
61 my $new_input_id = eval($self->input_id);
|
|
62 $new_input_id->{"cell_type"} = $cell_type;
|
|
63 $self->dataflow_output_id($new_input_id, 2, { } );
|
|
64 }
|
|
65
|
|
66 return 1;
|
|
67
|
|
68 }
|
|
69
|
|
70 #Private getter / setter to the cell_types_to_run list
|
|
71 sub _cell_types_to_run {
|
|
72 return $_[0]->_getter_setter('cell_types_to_run',$_[1]);
|
|
73 }
|
|
74
|
|
75 1;
|