Archive Ensembl HomeArchive Ensembl Home
AnophelesGambiae.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 =cut
00020 
00021 package Bio::EnsEMBL::IdMapping::StableIdGenerator::AedesAegypti;
00022 
00023 # Package that implements incrementing and verification of Aedes aegypti
00024 # stable IDs as used by the VectorBase project.
00025 # Based on Aedes_Aegypti.pm
00026 # Differs from Aedes in that Exon stable ids like Ennnnnn not AAEL.ennnnnn
00027 # and gene/transcript/translation start AGAP not AAEL
00028 # also need to exclude old Ensembl-style ids
00029 
00030 use strict;
00031 use warnings;
00032 
00033 use base qw(Bio::EnsEMBL::IdMapping::StableIdGenerator::EnsemblGeneric);
00034 
00035 sub increment_stable_id {
00036 
00037   # This method will increment a stable ID.  For Anopheles, it will
00038   # pick out the numerical part of the stable ID (no matter what type of
00039   # stable ID it is) and increment it by one.  It will then replace the
00040   # numerical part by the incremented value and return the new stable
00041   # ID.  The parsing of the stable ID is very naive.
00042 
00043   my ( $self, $stable_id ) = @_;
00044 
00045   if ( !$self->is_valid($stable_id) ) {
00046     throw("Unknown or missing stable ID: $stable_id.");
00047   }
00048 
00049   $stable_id =~ /^(\D*)(\d+)(\D*)/;
00050 
00051   my $number_as_string = "$2";
00052   my $number           = $2 + 1;
00053   $stable_id = sprintf(
00054     "%s" . sprintf( "%%0%dd", length($number_as_string) ) . "%s",
00055     $1, $number, $3 );
00056 
00057   return $stable_id;
00058 }
00059 
00060 sub is_valid {
00061 
00062   # A stable ID is a valid Anopheles stable ID if it begins with the
00063   # character string "AGAP" or (for exons) just "E"
00064   # explicitly make the exon one  E+digits to exclude old-style ENSANG ids
00065   # otherwise ENSANGnnn found as higher then AGAPnnn
00066   # when initial_stable_id method checks archive tables
00067 
00068   my ( $self, $stable_id ) = @_;
00069 
00070   if ( !( defined($stable_id) && ( $stable_id =~ /^AGAP/ || $stable_id =~ /^E\d+$/ ) ) ) {
00071     return 0;
00072   }
00073 
00074   return 1;
00075 }
00076 
00077 1;