ensembl-hive  2.7.0
ens_bio_featurePair.pm
Go to the documentation of this file.
1 =head1 LICENSE
2 
3 See the NOTICE file distributed with this work for additional information
4 regarding copyright ownership.
5 
6 Licensed under the Apache License, Version 2.0 (the "License");
7 you may not use this file except in compliance with the License.
8 You may obtain a copy of the License at
9 
10  http://www.apache.org/licenses/LICENSE-2.0
11 
12 Unless required by applicable law or agreed to in writing, software
13 distributed under the License is distributed on an "AS IS" BASIS,
14 WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15 See the License for the specific language governing permissions and
16 limitations under the License.
17 
18 =cut
19 
20 
21 =head1 CONTACT
22 
23  Please email comments or questions to the public Ensembl
24  developers list at <http://lists.ensembl.org/mailman/listinfo/dev>.
25 
26  Questions may also be sent to the Ensembl help desk at
27  <http://www.ensembl.org/Help/Contact>.
28 
29 =head1 AUTHOR
30 
31 Juguang Xiao <juguang@fugu-sg.org>
32 
33 =cut
34 
35 =head1 NAME
36 
38 
39 =head1 SYNOPISIS
40 
41 =head1 DESCRIPTION
42 
43 =head1 METHODS
44 
45 =cut
46 
47 package Bio::EnsEMBL::Utils::Converter::ens_bio_featurePair;
48 
49 use strict;
50 use vars qw(@ISA);
51 use Bio::SeqFeature::Generic;
52 use Bio::SeqFeature::FeaturePair;
55 
56 sub _convert_single {
57  my ($self, @args) = @_;
58 
59 }
60 
61 # convert object from Bio::EnsEMBL::RepeatFeature
62 # to Bio::SeqFeature::FeaturePair
63 
64 sub _convert_single_repeatFeature {
65  my ($self, $ens_repeat) = @_;
66 
67  my $feature1 = new Bio::SeqFeature::Generic(
68  -start => $ens_repeat->start,
69  -end => $ens_repeat->end,
70  -strand => $ens_repeat->strand,
71  -source_tag => $ens_repeat->source_tag
72  -primary_tag => $ens_repeat->repeat_class,
73  -seq_id => $ens_repeat->seqname
74  );
75 
76  my ($start2, $end2);
77  if($ens_repeat->strand == 1){
78  $start2 = $ens_repeat->hstart;
79  $end2 = $ens_repeat->hend;
80  }elsif($ens_repeat->strand == -1){
81  $start2 = $ens_repeat->hend;
82  $end2 = $ens_repeat->hstart;
83  }else{
84  $self->throw("strand cannot be out of range (1, -1)");
85  }
86 
87  my $feature2 = new Bio::SeqFeature::Generic(
88  -start => $start2,
89  -end => $end2,
90  -source_tag => $ens_repeat->source_tag,
91  -primary_tag => $ens_repeat->repeat_class,
92  -seq_id => $ens_repeat->repeat_name
93  );
94 
95  my $output_module = $self->out;
96  eval "require $output_module"; ## no critic
97  return new Bio::SeqFeature::FeaturePair(
98  -feature1 => $feature1,
99  -feature2 => $feature2
100  );
101 }
102 
103 1;
Bio::EnsEMBL::Utils::Converter::ens_bio_featurePair
Definition: ens_bio_featurePair.pm:11
Bio::EnsEMBL::Utils::Converter::ens_bio
Definition: ens_bio.pm:13