« EnsEMBL/IdMapping/StableIdGenerator/AnophelesGambiae.pm
↑ Summary
EnsEMBL/DBSQL/SeqRegionSynonymAdaptor.pm »
| 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 WormBase | ||
| 24 | help list at <help@wormbase.org>. | ||
| 25 | |||
| 26 | =cut | ||
| 27 | |||
| 28 | package Bio::EnsEMBL::IdMapping::StableIdGenerator::PristionchusPacificus; | ||
| 29 | $Bio::EnsEMBL::IdMapping::StableIdGenerator::PristionchusPacificus::VERSION = '114.0.0'; | ||
| 30 | # Class to generate WormBase conform Pristionchus IDs to be injected into the mapper | ||
| 31 | |||
| 32 | use strict; | ||
| 33 | use warnings; | ||
| 34 | |||
| 35 | use base qw(Bio::EnsEMBL::IdMapping::StableIdGenerator::EnsemblGeneric); | ||
| 36 | |||
| 37 | # PPAxxxxx | ||
| 38 | # ups the id by one | ||
| 39 | sub increment_stable_id { | ||
| 40 | my ( $self, $lastId ) = @_; | ||
| 41 | |||
| 42 | throw("invalid stable ID: $lastId.") unless ($lastId=~/PPA/); | ||
| 43 | |||
| 44 | $lastId =~ /^PPA(\d+)/; | ||
| 45 | |||
| 46 | my $number = $1+1; | ||
| 47 | my $stable_id = sprintf("PPA%05d",$number); | ||
| 48 | |||
| 49 | return $stable_id; | ||
| 50 | } | ||
| 51 | |||
| 52 | # just in case it is actually used somewhere | ||
| 53 | sub is_valid { | ||
| 54 | my ( $self, $stableId ) = @_; | ||
| 55 | |||
| 56 | if ( defined($stableId) && $stableId =~ /^PPA\d+/) | ||
| 57 | {return 1} else {return undef} | ||
| 58 | } | ||
| 59 | |||
| 60 | 1; |