Archive Ensembl HomeArchive Ensembl Home
ens_bio_featurePair.pm
Go to the documentation of this file.
00001 =head1 LICENSE
00002 
00003   Copyright (c) 1999-2012 The European Bioinformatics Institute and
00004   Genome Research Limited.  All rights reserved.
00005 
00006   This software is distributed under a modified Apache license.
00007   For license details, please see
00008 
00009     http://www.ensembl.org/info/about/code_licence.html
00010 
00011 =head1 CONTACT
00012 
00013   Please email comments or questions to the public Ensembl
00014   developers list at <dev@ensembl.org>.
00015 
00016   Questions may also be sent to the Ensembl help desk at
00017   <helpdesk@ensembl.org>.
00018 
00019 =head1 AUTHOR
00020 
00021 Juguang Xiao <juguang@fugu-sg.org>
00022 
00023 =cut
00024 
00025 =head1 NAME
00026 
00027 Bio::EnsEMBL::Utils::Converter::ens_bio_featurePair
00028 
00029 =head1 SYNOPISIS
00030 
00031 =head1 DESCRIPTION
00032 
00033 =head1 METHODS
00034 
00035 =cut
00036 
00037 package Bio::EnsEMBL::Utils::Converter::ens_bio_featurePair;
00038 
00039 use strict;
00040 use vars qw(@ISA);
00041 use Bio::SeqFeature::Generic;
00042 use Bio::SeqFeature::FeaturePair;
00043 use Bio::EnsEMBL::Utils::Converter::ens_bio;
00044 @ISA = qw(Bio::EnsEMBL::Utils::Converter::ens_bio);
00045 
00046 sub _convert_single {
00047     my ($self, @args) = @_;
00048 
00049 }
00050 
00051 # convert object from Bio::EnsEMBL::RepeatFeature
00052 # to Bio::SeqFeature::FeaturePair
00053 
00054 sub _convert_single_repeatFeature {
00055     my ($self, $ens_repeat) = @_;
00056     
00057     my $feature1 = new Bio::SeqFeature::Generic(
00058         -start => $ens_repeat->start,
00059         -end => $ens_repeat->end,
00060         -strand => $ens_repeat->strand,
00061         -source_tag => $ens_repeat->source_tag
00062         -primary_tag => $ens_repeat->repeat_class,
00063         -seq_id => $ens_repeat->seqname
00064     );
00065     
00066     my ($start2, $end2);
00067     if($ens_repeat->strand == 1){
00068         $start2 = $ens_repeat->hstart;
00069         $end2 = $ens_repeat->hend;
00070     }elsif($ens_repeat->strand == -1){
00071         $start2 = $ens_repeat->hend;
00072         $end2 = $ens_repeat->hstart;
00073     }else{
00074         $self->throw("strand cannot be out of range (1, -1)");
00075     }
00076         
00077     my $feature2 = new Bio::SeqFeature::Generic(
00078         -start => $start2,
00079         -end => $end2,
00080         -source_tag => $ens_repeat->source_tag,
00081         -primary_tag => $ens_repeat->repeat_class,
00082         -seq_id => $ens_repeat->repeat_name
00083     );
00084     
00085     my $output_module = $self->out;
00086     require "$output_module";
00087     return new Bio::SeqFeature::FeaturePair(
00088         -feature1 => $feature1,
00089         -feature2 => $feature2
00090     );
00091 }
00092 
00093 1;