comparison variant_effect_predictor/Bio/EnsEMBL/Variation/Pipeline/TranscriptEffect.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::TranscriptEffect;
22
23 use strict;
24 use warnings;
25
26 use Bio::EnsEMBL::Variation::TranscriptVariation;
27 use Bio::EnsEMBL::Variation::Utils::VariationEffect qw(MAX_DISTANCE_FROM_TRANSCRIPT);
28
29 use base qw(Bio::EnsEMBL::Variation::Pipeline::BaseVariationProcess);
30
31 my $DEBUG = 0;
32
33 sub run {
34 my $self = shift;
35
36 my $transcript_id = $self->required_param('transcript_stable_id');
37
38 my $disambiguate_sn_alleles =
39 $self->param('disambiguate_single_nucleotide_alleles');
40
41 my $variations_to_include;
42
43 if (my $vars = $self->param('variations_to_include')) {
44 # turn the list of variation names into a hash to speed up checking
45 $variations_to_include = { map { $_ => 1 } @$vars };
46 }
47
48 my $core_dba = $self->get_species_adaptor('core');
49 my $var_dba = $self->get_species_adaptor('variation');
50
51 my $ta = $core_dba->get_TranscriptAdaptor;
52 my $sa = $core_dba->get_SliceAdaptor;
53
54 my $tva = $var_dba->get_TranscriptVariationAdaptor;
55
56 my $transcript = $ta->fetch_by_stable_id($transcript_id)
57 or die "failed to fetch transcript for stable id: $transcript_id";
58
59 # we need to include failed variations
60
61 $tva->db->include_failed_variations(1);
62
63 my $slice = $sa->fetch_by_transcript_stable_id(
64 $transcript->stable_id,
65 MAX_DISTANCE_FROM_TRANSCRIPT
66 ) or die "failed to get slice around transcript: ".$transcript->stable_id;
67
68 for my $vf ( @{ $slice->get_all_VariationFeatures },
69 @{ $slice->get_all_somatic_VariationFeatures } ) {
70
71 if (defined $variations_to_include) {
72 next unless $variations_to_include->{$vf->variation_name};
73 }
74
75 my $tv = Bio::EnsEMBL::Variation::TranscriptVariation->new(
76 -transcript => $transcript,
77 -variation_feature => $vf,
78 -adaptor => $tva,
79 -disambiguate_single_nucleotide_alleles => $disambiguate_sn_alleles,
80 );
81
82 # if the variation has no effect on the transcript $tv will be undef
83
84 if ($tv && ( scalar(@{ $tv->consequence_type }) > 0) ) {
85 $tva->store($tv);
86 }
87 }
88
89 return;
90 }
91
92 sub write_output {
93 my $self = shift;
94 }
95
96 1;