From ff5dbe266c60f6a855b6b118a8e37ea4ce722b1f Mon Sep 17 00:00:00 2001 From: Web Group <www-ens@sanger.ac.uk> Date: Mon, 17 Dec 2012 12:28:22 +0000 Subject: [PATCH] Copy is_patch onto branch 66 now that anacode have moved on. -- ds23 --- .../Bio/EnsEMBL/Utils/ConversionSupport.pm | 25 +++++++++++++++++++ 1 file changed, 25 insertions(+) diff --git a/modules/Bio/EnsEMBL/Utils/ConversionSupport.pm b/modules/Bio/EnsEMBL/Utils/ConversionSupport.pm index bdfcfd1555..6eb8d9e14d 100644 --- a/modules/Bio/EnsEMBL/Utils/ConversionSupport.pm +++ b/modules/Bio/EnsEMBL/Utils/ConversionSupport.pm @@ -1194,6 +1194,31 @@ sub split_chromosomes_by_size { return $chr_slices; } +=head2 is_patch + + Arg[1] : B::E::Slice + Example : if ($support->is_patch($slice)) { ... + Description : Looks at seq_region attributes to decide if a slice is a patch or not + If PATCH seq_region_attrib is not there check to see if name suggests it is a PATCH + Return type : true/false + +=cut + +sub is_patch { + my ($self,$slice) = @_; + my @patch_attrib_types = qw(patch_fix patch_novel); #seq_region_attribs used to define a patch + foreach my $attrib_type (@patch_attrib_types) { + if (@{$slice->get_all_Attributes($attrib_type)}) { + return 1; + } + } + if ($slice->seq_region_name =~ /PATCH/) { + $self->log_warning($slice->seq_region_name . " has a PATCH name does not have a patch seq_region_attrib, please check if it was present in loutre\n"); + return 1; + } + return 0; +} + =head2 log Arg[1] : String $txt - the text to log -- GitLab