0
|
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::InitTranscriptEffect;
|
|
22
|
|
23 use strict;
|
|
24 use warnings;
|
|
25
|
|
26 use base qw(Bio::EnsEMBL::Variation::Pipeline::BaseVariationProcess);
|
|
27
|
|
28 my $DEBUG = 0;
|
|
29
|
|
30 sub fetch_input {
|
|
31
|
|
32 my $self = shift;
|
|
33
|
|
34 my $include_lrg = $self->param('include_lrg');
|
|
35
|
|
36 my $core_dba = $self->get_species_adaptor('core');
|
|
37 my $var_dba = $self->get_species_adaptor('variation');
|
|
38
|
|
39 my $dbc = $var_dba->dbc();
|
|
40
|
|
41 my $ga = $core_dba->get_GeneAdaptor or die "Failed to get gene adaptor";
|
|
42
|
|
43 my @transcript_output_ids;
|
|
44
|
|
45 my $gene_count = 0;
|
|
46
|
|
47 # fetch all the regular genes
|
|
48
|
|
49 my @genes = @{ $ga->fetch_all };
|
|
50
|
|
51 if ($include_lrg) {
|
|
52 # fetch the LRG genes as well
|
|
53
|
|
54 push @genes, @{ $ga->fetch_all_by_biotype('LRG_gene') }
|
|
55 }
|
|
56
|
|
57 for my $gene (@genes) {
|
|
58 $gene_count++;
|
|
59
|
|
60 for my $transcript (@{ $gene->get_all_Transcripts }) {
|
|
61
|
|
62 push @transcript_output_ids, {
|
|
63 transcript_stable_id => $transcript->stable_id,
|
|
64 };
|
|
65 }
|
|
66 if ($DEBUG) {
|
|
67 last if $gene_count >= 100;
|
|
68 }
|
|
69 }
|
|
70
|
|
71 if (@transcript_output_ids) {
|
|
72
|
|
73 # check we actually found some transcripts
|
|
74
|
|
75 # truncate the table because we don't want duplicates
|
|
76
|
|
77 $dbc->do("TRUNCATE TABLE transcript_variation");
|
|
78
|
|
79 # disable the indexes on the table we're going to insert into as
|
|
80 # this significantly speeds up the TranscriptEffect process
|
|
81
|
|
82 $dbc->do("ALTER TABLE transcript_variation DISABLE KEYS");
|
|
83
|
|
84 $self->param('transcript_output_ids', \@transcript_output_ids);
|
|
85
|
|
86 $self->param(
|
|
87 'rebuild_indexes', [{
|
|
88 tables => ['transcript_variation'],
|
|
89 }]
|
|
90 );
|
|
91
|
|
92 # we need to kick off the update_vf analysis as well,
|
|
93 # but it doesn't have any parameters we need to set here
|
|
94
|
|
95 $self->param(
|
|
96 'update_vf', [{}]
|
|
97 );
|
|
98 }
|
|
99 }
|
|
100
|
|
101 sub write_output {
|
|
102 my $self = shift;
|
|
103
|
|
104 if (my $transcript_output_ids = $self->param('transcript_output_ids')) {
|
|
105 $self->dataflow_output_id($self->param('rebuild_indexes'), 2);
|
|
106 $self->dataflow_output_id($self->param('update_vf'), 3);
|
|
107 $self->dataflow_output_id($transcript_output_ids, 4);
|
|
108 }
|
|
109
|
|
110 return;
|
|
111 }
|
|
112
|
|
113 1;
|