comparison variant_effect_predictor/Bio/EnsEMBL/Variation/Pipeline/BaseVariationProcess.pm @ 0:1f6dce3d34e0

Uploaded
author mahtabm
date Thu, 11 Apr 2013 02:01:53 -0400
parents
children
comparison
equal deleted inserted replaced
-1:000000000000 0:1f6dce3d34e0
1 =head1 LICENSE
2
3 Copyright (c) 1999-2012 The European Bioinformatics Institute and
4 Genome Research Limited. All rights reserved.
5
6 This software is distributed under a modified Apache license.
7 For license details, please see
8
9 http://www.ensembl.org/info/about/code_licence.html
10
11 =head1 CONTACT
12
13 Please email comments or questions to the public Ensembl
14 developers list at <dev@ensembl.org>.
15
16 Questions may also be sent to the Ensembl help desk at
17 <helpdesk@ensembl.org>.
18
19 =cut
20
21 package Bio::EnsEMBL::Variation::Pipeline::BaseVariationProcess;
22
23 use strict;
24 use warnings;
25
26 use Bio::EnsEMBL::Variation::Pipeline::TranscriptFileAdaptor;
27
28 use Bio::EnsEMBL::Hive::AnalysisJob;
29
30 use base qw(Bio::EnsEMBL::Hive::Process);
31
32 sub param {
33 my $self = shift;
34
35 unless ($self->input_job) {
36 # if we don't have an input job, add a dummy one (used when we're not
37 # running as part of a pipeline proper)
38 $self->input_job(Bio::EnsEMBL::Hive::AnalysisJob->new);
39 }
40
41 return $self->SUPER::param(@_);
42 }
43
44 sub required_param {
45 my $self = shift;
46 my $param_name = shift;
47
48 my $param_value = $self->param($param_name, @_);
49
50 die "$param_name is a required parameter" unless defined $param_value;
51
52 return $param_value;
53 }
54
55 sub get_transcript_file_adaptor {
56 my $self = shift;
57 my $transcripts = shift;
58
59 unless ($self->{tfa}) {
60 $self->{tfa} = Bio::EnsEMBL::Variation::Pipeline::TranscriptFileAdaptor->new(
61 fasta_file => $self->param('fasta_file'),
62 transcripts => $transcripts,
63 );
64 }
65
66 return $self->{tfa};
67 }
68
69 sub get_species_adaptor {
70 my ($self, $group) = @_;
71
72 my $species = $self->required_param('species');
73
74 return $self->get_adaptor($species, $group);
75 }
76
77 sub get_adaptor {
78 my ($self, $species, $group) = @_;
79
80 my $dba;
81
82 eval {
83 $dba = Bio::EnsEMBL::Registry->get_DBAdaptor($species, $group);
84 };
85
86 unless (defined $dba) {
87 $self->_load_registry();
88 $dba = Bio::EnsEMBL::Registry->get_DBAdaptor($species, $group);
89 }
90
91 unless (defined $dba) {
92 die "Failed to a get DBA for $species and group $group";
93 }
94
95 return $dba;
96 }
97
98 sub _load_registry {
99 my ($self) = @_;
100
101 my $reg_file = $self->required_param('ensembl_registry');
102
103 Bio::EnsEMBL::Registry->load_all($reg_file, 0, 1);
104
105 return;
106 }
107
108 1;