This file is indexed.

/usr/share/perl5/Bio/Variation/VariantI.pm is in libbio-perl-perl 1.6.924-3.

This file is owned by root:root, with mode 0o644.

The actual contents of the file can be viewed below.

   1
   2
   3
   4
   5
   6
   7
   8
   9
  10
  11
  12
  13
  14
  15
  16
  17
  18
  19
  20
  21
  22
  23
  24
  25
  26
  27
  28
  29
  30
  31
  32
  33
  34
  35
  36
  37
  38
  39
  40
  41
  42
  43
  44
  45
  46
  47
  48
  49
  50
  51
  52
  53
  54
  55
  56
  57
  58
  59
  60
  61
  62
  63
  64
  65
  66
  67
  68
  69
  70
  71
  72
  73
  74
  75
  76
  77
  78
  79
  80
  81
  82
  83
  84
  85
  86
  87
  88
  89
  90
  91
  92
  93
  94
  95
  96
  97
  98
  99
 100
 101
 102
 103
 104
 105
 106
 107
 108
 109
 110
 111
 112
 113
 114
 115
 116
 117
 118
 119
 120
 121
 122
 123
 124
 125
 126
 127
 128
 129
 130
 131
 132
 133
 134
 135
 136
 137
 138
 139
 140
 141
 142
 143
 144
 145
 146
 147
 148
 149
 150
 151
 152
 153
 154
 155
 156
 157
 158
 159
 160
 161
 162
 163
 164
 165
 166
 167
 168
 169
 170
 171
 172
 173
 174
 175
 176
 177
 178
 179
 180
 181
 182
 183
 184
 185
 186
 187
 188
 189
 190
 191
 192
 193
 194
 195
 196
 197
 198
 199
 200
 201
 202
 203
 204
 205
 206
 207
 208
 209
 210
 211
 212
 213
 214
 215
 216
 217
 218
 219
 220
 221
 222
 223
 224
 225
 226
 227
 228
 229
 230
 231
 232
 233
 234
 235
 236
 237
 238
 239
 240
 241
 242
 243
 244
 245
 246
 247
 248
 249
 250
 251
 252
 253
 254
 255
 256
 257
 258
 259
 260
 261
 262
 263
 264
 265
 266
 267
 268
 269
 270
 271
 272
 273
 274
 275
 276
 277
 278
 279
 280
 281
 282
 283
 284
 285
 286
 287
 288
 289
 290
 291
 292
 293
 294
 295
 296
 297
 298
 299
 300
 301
 302
 303
 304
 305
 306
 307
 308
 309
 310
 311
 312
 313
 314
 315
 316
 317
 318
 319
 320
 321
 322
 323
 324
 325
 326
 327
 328
 329
 330
 331
 332
 333
 334
 335
 336
 337
 338
 339
 340
 341
 342
 343
 344
 345
 346
 347
 348
 349
 350
 351
 352
 353
 354
 355
 356
 357
 358
 359
 360
 361
 362
 363
 364
 365
 366
 367
 368
 369
 370
 371
 372
 373
 374
 375
 376
 377
 378
 379
 380
 381
 382
 383
 384
 385
 386
 387
 388
 389
 390
 391
 392
 393
 394
 395
 396
 397
 398
 399
 400
 401
 402
 403
 404
 405
 406
 407
 408
 409
 410
 411
 412
 413
 414
 415
 416
 417
 418
 419
 420
 421
 422
 423
 424
 425
 426
 427
 428
 429
 430
 431
 432
 433
 434
 435
 436
 437
 438
 439
 440
 441
 442
 443
 444
 445
 446
 447
 448
 449
 450
 451
 452
 453
 454
 455
 456
 457
 458
 459
 460
 461
 462
 463
 464
 465
 466
 467
 468
 469
 470
 471
 472
 473
 474
 475
 476
 477
 478
 479
 480
 481
 482
 483
 484
 485
 486
 487
 488
 489
 490
 491
 492
 493
 494
 495
 496
 497
 498
 499
 500
 501
 502
 503
 504
 505
 506
 507
 508
 509
 510
 511
 512
 513
 514
 515
 516
 517
 518
 519
 520
 521
 522
 523
 524
 525
 526
 527
 528
 529
 530
 531
 532
 533
 534
 535
 536
 537
 538
 539
 540
 541
 542
 543
 544
 545
 546
 547
 548
 549
 550
 551
 552
 553
 554
 555
 556
 557
 558
 559
 560
 561
 562
 563
 564
 565
 566
 567
 568
 569
 570
 571
 572
 573
 574
 575
 576
 577
 578
 579
 580
 581
 582
 583
 584
 585
 586
 587
 588
 589
 590
 591
 592
 593
 594
 595
 596
 597
 598
 599
 600
 601
 602
 603
 604
 605
 606
 607
 608
 609
 610
 611
 612
 613
 614
 615
 616
 617
 618
 619
 620
 621
 622
 623
 624
 625
 626
 627
 628
 629
 630
 631
 632
 633
 634
 635
 636
 637
 638
 639
 640
 641
 642
 643
 644
 645
 646
 647
 648
 649
 650
 651
 652
 653
 654
 655
 656
 657
 658
 659
 660
 661
 662
 663
 664
 665
 666
 667
 668
 669
 670
 671
 672
 673
 674
 675
 676
 677
 678
 679
 680
 681
 682
 683
 684
 685
 686
 687
 688
 689
 690
 691
 692
 693
 694
 695
 696
 697
 698
 699
 700
 701
 702
 703
 704
 705
 706
 707
 708
 709
 710
 711
 712
 713
 714
 715
 716
 717
 718
 719
 720
 721
 722
 723
 724
 725
 726
 727
 728
 729
 730
 731
 732
 733
 734
 735
 736
 737
 738
 739
 740
 741
 742
 743
 744
 745
 746
 747
 748
 749
 750
 751
 752
 753
 754
 755
 756
 757
 758
 759
 760
 761
 762
 763
 764
 765
 766
 767
 768
 769
 770
 771
 772
 773
 774
 775
 776
 777
 778
 779
 780
 781
 782
 783
 784
 785
 786
 787
 788
 789
 790
 791
 792
 793
 794
 795
 796
 797
 798
 799
 800
 801
 802
 803
 804
 805
 806
 807
 808
 809
 810
 811
 812
 813
 814
 815
 816
 817
 818
 819
 820
 821
 822
 823
 824
 825
 826
 827
 828
 829
 830
 831
 832
 833
 834
 835
 836
 837
 838
 839
 840
 841
 842
 843
 844
 845
 846
 847
 848
 849
 850
 851
 852
 853
 854
 855
 856
 857
 858
 859
 860
 861
 862
 863
 864
 865
 866
 867
 868
 869
 870
 871
 872
 873
 874
 875
 876
 877
 878
 879
 880
 881
 882
 883
 884
 885
 886
 887
 888
 889
 890
 891
 892
 893
 894
 895
 896
 897
 898
 899
 900
 901
 902
 903
 904
 905
 906
 907
 908
 909
 910
 911
 912
 913
 914
 915
 916
 917
 918
 919
 920
 921
 922
 923
 924
 925
 926
 927
 928
 929
 930
 931
 932
 933
 934
 935
 936
 937
 938
 939
 940
 941
 942
 943
 944
 945
 946
 947
 948
 949
 950
 951
 952
 953
 954
 955
 956
 957
 958
 959
 960
 961
 962
 963
 964
 965
 966
 967
 968
 969
 970
 971
 972
 973
 974
 975
 976
 977
 978
 979
 980
 981
 982
 983
 984
 985
 986
 987
 988
 989
 990
 991
 992
 993
 994
 995
 996
 997
 998
 999
1000
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
1023
1024
1025
1026
1027
1028
1029
1030
1031
1032
1033
1034
1035
1036
1037
1038
1039
1040
1041
1042
1043
1044
1045
1046
1047
1048
1049
1050
1051
1052
#
# BioPerl module for Bio::Variation::VariantI
#
# Please direct questions and support issues to <bioperl-l@bioperl.org> 
#
# Cared for by Heikki Lehvaslaiho <heikki-at-bioperl-dot-org>
#
# Copyright Heikki Lehvaslaiho
#
# You may distribute this module under the same terms as perl itself

# POD documentation - main docs before the code

=head1 NAME

Bio::Variation::VariantI - Sequence Change SeqFeature abstract class

=head1 SYNOPSIS

  #get Bio::Variant::VariantI somehow
  print $var->restriction_changes, "\n";
  foreach $allele ($var->each_Allele) {
      #work on Bio::Variation::Allele objects
  }

=head1 DESCRIPTION

This superclass defines common methods to basic sequence changes.  The
instantiable classes Bio::Variation::DNAMutation,
Bio::Variation::RNAChange and Bio::Variation::AAChange use them.
See L<Bio::Variation::DNAMutation>, L<Bio::Variation::RNAChange>,
and L<Bio::Variation::AAChange> for more information.

These classes store information, heavy computation to detemine allele
sequences is done elsewhere.

The database cross-references are implemented as
Bio::Annotation::DBLink objects. The methods to access them are
defined in Bio::DBLinkContainerI. See L<Bio::Annotation::DBLink>
and L<Bio::DBLinkContainerI> for details.

Bio::Variation::VariantI redifines and extends
Bio::SeqFeature::Generic for sequence variations. This class
describes specific sequence change events. These events are always
from a specific reference sequence to something different. See
L<Bio::SeqFeature::Generic> for more information.

IMPORTANT: The notion of reference sequence permeates all
Bio::Variation classes. This is especially important to remember when
dealing with Alleles. In a polymorphic site, there can be a large
number of alleles. One of then has to be selected to be the reference
allele (allele_ori). ALL the rest has to be passed to the Variant
using the method add_Allele, including the mutated allele in a
canonical mutation. The IO modules and generated attributes depend on
it. They ignore the allele linked to using allele_mut and circulate
each Allele returned by each_Allele into allele_mut and calculate
the changes between that and allele_ori.


=head1 FEEDBACK

=head2 Mailing Lists

User feedback is an integral part of the evolution of this and other
Bioperl modules. Send your comments and suggestions preferably to the 
Bioperl mailing lists  Your participation is much appreciated.

  bioperl-l@bioperl.org                  - General discussion
  http://bioperl.org/wiki/Mailing_lists  - About the mailing lists

=head2 Support 

Please direct usage questions or support issues to the mailing list:

I<bioperl-l@bioperl.org>

rather than to the module maintainer directly. Many experienced and 
reponsive experts will be able look at the problem and quickly 
address it. Please include a thorough description of the problem 
with code and data examples if at all possible.

=head2 Reporting Bugs

Report bugs to the Bioperl bug tracking system to help us keep track
the bugs and their resolution.  Bug reports can be submitted via the
web:

  https://github.com/bioperl/bioperl-live/issues

=head1 AUTHOR - Heikki Lehvaslaiho

Email:  heikki-at-bioperl-dot-org

=head1 APPENDIX

The rest of the documentation details each of the object
methods. Internal methods are usually preceded with a _

=cut


# Let the code begin...


package Bio::Variation::VariantI;
use strict;
# Object preamble - inheritance

use base qw(Bio::Root::Root Bio::SeqFeature::Generic Bio::DBLinkContainerI);

=head2 id

 Title   : id
 Usage   : $obj->id
 Function:

           Read only method. Returns the id of the variation object.
           The id is the id of the first DBLink object attached to this object.

 Example :
 Returns : scalar
 Args    : none

=cut

sub id {
   my ($self) = @_;
   my @ids = $self->each_DBLink;
   my $id = $ids[0] if scalar @ids > 0;
   return $id->database. "::". $id->primary_id if $id;
}


=head2 add_Allele

 Title   : add_Allele
 Usage   : $self->add_Allele($allele)
 Function: 

	    Adds one Bio::Variation::Allele into the list of alleles.
            Note that the method forces the convention that nucleotide
            sequence is in lower case and amino acds are in upper
            case.

 Example : 
 Returns : 1 when succeeds, 0 for failure.
 Args    : Allele object

=cut


sub add_Allele {
  my ($self,$value) = @_;
  if (defined $value) {
      if( ! $value->isa('Bio::Variation::Allele') ) {
	  my $com = ref $value;
	  $self->throw("Is not a Allele object but a  [$com]");
	  return 0;
      } else {
	  if ( $self->isa('Bio::Variation::AAChange') ) {
	      $value->seq( uc $value->seq) if $value->seq;
	  } else {
	      $value->seq( lc $value->seq) if $value->seq;
	  } 
	  push(@{$self->{'alleles'}},$value); 
	  $self->allele_mut($value); #????
	  return 1;
      }
  } else {
      return 0;
  }
}


=head2 each_Allele

 Title   : alleles
 Usage   : $obj->each_Allele();
 Function: 

	     Returns a list of Bio::Variation::Allele objects

 Example : 
 Returns : list of Alleles
 Args    : none

=cut

sub each_Allele{
   my ($self,@args) = @_;
   return @{$self->{'alleles'}};
}


=head2 isMutation

 Title   : isMutation
 Usage   : print join('/', $obj->each_Allele) if not $obj->isMutation;
 Function:

           Returns or sets the boolean value indicating that the
           variant descibed is a canonical mutation with two alleles
           assinged to be the original (wild type) allele and mutated
           allele, respectively. If this value is not set, it is
           assumed that the Variant descibes polymorphisms.

 Returns : a boolean

=cut

sub isMutation {
    my ($self,$value) = @_;
    if (defined $value) {
        if ($value ) {
            $self->{'isMutation'} = 1;
        } else {
            $self->{'isMutation'} = 0;
        }
    }
    return $self->{'isMutation'};
} 


=head2 allele_ori

 Title   : allele_ori
 Usage   : $obj->allele_ori();
 Function: 

            Links to and returns the Bio::Variation::Allele object.
            If value is not set, returns false. All other Alleles are
            compared to this.

            Amino acid sequences are stored in upper case characters,
            others in lower case.

 Example : 
 Returns : string
 Args    : string

See L<Bio::Variation::Allele> for more.

=cut

sub allele_ori {
   my ($self,$value) = @_;
   if( defined $value) {
       if ( ! ref $value || ! $value->isa('Bio::Variation::Allele')) {
	   $self->throw("Value is not Bio::Variation::Allele but [$value]");
       } else {
	   if ( $self->isa('Bio::Variation::AAChange') ) {
	       $value->seq( uc $value->seq) if $value->seq;
	   } else {
	       $value->seq( lc $value->seq) if $value->seq;
	   } 
	   $self->{'allele_ori'} = $value;
       }
   }
   return $self->{'allele_ori'};
}


=head2 allele_mut

 Title   : allele_mut
 Usage   : $obj->allele_mut();
 Function: 

             Links to and returns the Bio::Variation::Allele
             object.  Sets and returns the mutated allele sequence.
             If value is not set, returns false.

             Amino acid sequences are stored in upper case characters,
             others in lower case.

 Example : 
 Returns : string
 Args    : string

See L<Bio::Variation::Allele> for more.

=cut


sub allele_mut {
   my ($self,$value) = @_;
   if( defined $value) {
       if ( ! ref $value || ! $value->isa('Bio::Variation::Allele')) {
	   $self->throw("Value is not Bio::Variation::Allele but [$value]");
       } else {
	   if ( $self->isa('Bio::Variation::AAChange') ) {
	       $value->seq( uc $value->seq) if $value->seq;
	   } else {
	       $value->seq( lc $value->seq) if $value->seq;
	   } 
	   $self->{'allele_mut'} = $value;
       }
   }
   return $self->{'allele_mut'};
}

=head2 length

 Title   : length
 Usage   : $obj->length();
 Function: 

            Sets and returns the length of the affected original
            allele sequence.  If value is not set, returns false == 0.

            Value 0 means that the variant position is before the
            start=end sequence position. (Value 1 would denote a point
            mutation). This follows the convension to report an
            insertion (2insT) in equivalent way to a corresponding
            deletion (2delT) (Think about indel polymorpism ATC <=> AC
            where the origianal state is not known ).

 Example : 
 Returns : string
 Args    : string

=cut


sub length {
   my ($self,$value) = @_;
   if ( defined $value) {
       $self->{'length'} = $value;
  }
   if ( ! exists $self->{'length'} ) {
       return 0;
   } 
   return $self->{'length'};
}

=head2 upStreamSeq

 Title   : upStreamSeq
 Usage   : $obj->upStreamSeq();
 Function: 

            Sets and returns upstream flanking sequence string.  If
            value is not set, returns false. The sequence should be
            >=25 characters long, if possible.

 Example : 
 Returns : string or false
 Args    : string

=cut


sub upStreamSeq {
    my ($self,$value) = @_;
    if( defined $value) {
	$self->{'upstreamseq'} = $value;
    }
   return $self->{'upstreamseq'};
}


=head2 dnStreamSeq

 Title   : dnStreamSeq
 Usage   : $obj->dnStreamSeq();
 Function: 

            Sets and returns dnstream flanking sequence string.  If
            value is not set, returns false. The sequence should be
            >=25 characters long, if possible.

 Example : 
 Returns : string or false
 Args    : string

=cut


sub dnStreamSeq {
    my ($self,$value) = @_;
    if( defined $value) {
	$self->{'dnstreamseq'} = $value;
    }
    return $self->{'dnstreamseq'};
    
}


=head2 label

 Title   : label
 Usage   : $obj->label();
 Function: 

            Sets and returns mutation event label(s).  If value is not
            set, or no argument is given returns false.  Each
            instantiable class needs to implement this method. Valid
            values are listed in 'Mutation event controlled vocabulary' in
            http://www.ebi.ac.uk/mutations/recommendations/mutevent.html.

 Example : 
 Returns : string
 Args    : string

=cut


sub label {
    my ($self,$value) = @_;
    $self->throw_not_implemented();
}



=head2 status

 Title   : status
 Usage   : $obj->status()
 Function: 

           Returns the status of the sequence change object.
           Valid values are: 'suspected' and 'proven'

 Example : $obj->status('proven');
 Returns : scalar
 Args    : valid string (optional, for setting)


=cut


sub status {
   my ($self,$value) = @_;
   my %status = (suspected => 1,
		 proven => 1
		 );

   if( defined $value) {
       $value = lc $value;
       if ($status{$value}) {
	   $self->{'status'} = $value;
       } 
       else {
	   $self->throw("$value is not valid status value!");
       }
    }
   if( ! exists $self->{'status'} ) {
       return "$self";
   }
   return $self->{'status'};
}


=head2 proof

 Title   : proof
 Usage   : $obj->proof()
 Function: 

           Returns the proof of the sequence change object.
           Valid values are: 'computed' and 'experimental'.

 Example : $obj->proof('computed');
 Returns : scalar
 Args    : valid string (optional, for setting)


=cut


sub proof {
    my ($self,$value) = @_;
    my %proof = (computed => 1,
		 experimental => 1
		 );

    if( defined $value) {
	$value = lc $value;
	if ($proof{$value}) {
	    $self->{'proof'} = $value;
	} else {
	    $self->throw("$value is not valid proof value!");
	}
    }
    return $self->{'proof'};
}


=head2 region

 Title   : region
 Usage   : $obj->region();
 Function: 

            Sets and returns the name of the sequence region type or
            protein domain at this location.  If value is not set,
            returns false.

 Example : 
 Returns : string
 Args    : string

=cut


sub region {
    my ($self,$value) = @_;
    if( defined $value) {
	$self->{'region'} = $value;
    }
    return $self->{'region'};
}


=head2 region_value

 Title   : region_value
 Usage   : $obj->region_value();
 Function: 

            Sets and returns the name of the sequence region_value or
            protein domain at this location.  If value is not set,
            returns false.

 Example : 
 Returns : string
 Args    : string

=cut


sub region_value {
    my ($self,$value) = @_;
    if( defined $value) {
	$self->{'region_value'} = $value;
    }
    return $self->{'region_value'};
}

=head2 region_dist

 Title   : region_dist
 Usage   : $obj->region_dist();
 Function: 

            Sets and returns the distance tot the closest region
            (i.e. intro/exon or domain) boundary. If distance is not
            set, returns false.

 Example : 
 Returns : integer
 Args    : integer

=cut


sub region_dist {
    my ($self,$value) = @_;
    if( defined $value) {
       if (  not $value =~ /^[+-]?\d+$/ ) {
	   $self->throw("[$value] for region_dist has to be an integer\n");
        } else {
	    $self->{'region_dist'} = $value;
        }
    }
    return $self->{'region_dist'};
}


=head2 numbering

 Title   : numbering
 Usage   : $obj->numbering()
 Function: 

           Returns the numbering chema used locating sequnce features.
           Valid values are: 'entry' and 'coding'

 Example : $obj->numbering('coding');
 Returns : scalar
 Args    : valid string (optional, for setting)


=cut


sub numbering {
   my ($self,$value) = @_;
   my %numbering = (entry => 1,
		    coding => 1
		    );

   if( defined $value) {
       $value = lc $value;
       if ($numbering{$value}) {
	   $self->{'numbering'} = $value;
       } 
       else {
	   $self->throw("'$value' is not a valid for numbering!");
       }
    }
   if( ! exists $self->{'numbering'} ) {
       return "$self";
   }
   return $self->{'numbering'};
}

=head2 mut_number

 Title   : mut_number
 Usage   : $num = $obj->mut_number;
         : $num = $obj->mut_number($number);
 Function: 

           Returns or sets the number identifying the order in which the
           mutation has been issued. Numbers shouldstart from 1.
           If the number has never been set, the method will return ''

           If you want the output from IO modules look nice and, for
           multivariant/allele variations, make sense you better set
           this attribute.

 Returns : an integer

=cut


sub mut_number {
    my ($self,$value) = @_;
    if (defined $value) {
	$self->{'mut_number'} = $value;
    }
    unless (exists $self->{'mut_number'}) {
	return ('');
    } else {
	return $self->{'mut_number'};
    }
}       


=head2 SeqDiff

 Title   : SeqDiff
 Usage   : $mutobj = $obj->SeqDiff;
         : $mutobj = $obj->SeqDiff($objref);
 Function: 

           Returns or sets the link-reference to the umbrella
           Bio::Variation::SeqDiff object.  If there is no link,
           it will return undef

           Note: Adding a variant into a SeqDiff object will
           automatically set this value.

 Returns : an obj_ref or undef

See L<Bio::Variation::SeqDiff> for more information.

=cut

sub SeqDiff {
    my ($self,$value) = @_;
    if (defined $value) {
	if( ! $value->isa('Bio::Variation::SeqDiff') ) {
	    $self->throw("Is not a Bio::Variation::SeqDiff object but a [$value]");
	    return;
	}
	else {
	    $self->{'seqDiff'} = $value;
	}
    }
    unless (exists $self->{'seqDiff'}) {
	return;
    } else {
	return $self->{'seqDiff'};
    }
}

=head2 add_DBLink

 Title   : add_DBLink
 Usage   : $self->add_DBLink($ref)
 Function: adds a link object
 Example :
 Returns : 
 Args    :


=cut


sub add_DBLink{
   my ($self,$com) = @_;
   if( $com && ! $com->isa('Bio::Annotation::DBLink') ) {
       $self->throw("Is not a link object but a  [$com]");
   }
   $com && push(@{$self->{'link'}},$com);
}

=head2 each_DBLink

 Title   : each_DBLink
 Usage   : foreach $ref ( $self->each_DBlink() )
 Function: gets an array of DBlink of objects
 Example :
 Returns : 
 Args    :


=cut

sub each_DBLink{
   my ($self) = @_;
   
   return @{$self->{'link'}}; 
}

=head2 restriction_changes

 Title   : restriction_changes
 Usage   : $obj->restriction_changes();
 Function: 

            Returns a string containing a list of restriction
            enzyme changes of form +EcoRI, separated by
            commas. Strings need to be valid restriction enzyme names
            as stored in REBASE. allele_ori and allele_mut need to be assigned.

 Example : 
 Returns : string
 Args    : string

=cut

sub restriction_changes { 
    my ($self) = @_;

    if (not $self->{'re_changes'}) { 
	my %re = &_enzymes;
	
	# complain if used on AA data
	if ($self->isa('Bio::Variation::AAChange')) {
	    $self->throw('Restriction enzymes do not bite polypeptides!');
	}
	
	#sanity checks
	$self->warn('Upstream sequence is empty!')
	    if $self->upStreamSeq eq '';
	$self->warn('Downstream sequence is empty!')
	    if $self->dnStreamSeq eq '';
#	 $self->warn('Original allele sequence is empty!')
#	     if $self->allele_ori eq '';
#	 $self->warn('Mutated allele sequence is empty!')
#	     if $self->allele_mut eq '';
	
	#reuse the non empty DNA level list at RNA level if the flanks are identical
	#Hint: Check DNAMutation object first
	if ($self->isa('Bio::Variation::RNAChange') and  $self->DNAMutation and
	    $self->upStreamSeq eq $self->DNAMutation->upStreamSeq  and 
	    $self->dnStreamSeq eq $self->DNAMutation->dnStreamSeq and
	    $self->DNAMutation->restriction_changes ne '' ) {
	    $self->{'re_changes'} = $self->DNAMutation->restriction_changes;
	} else {
	    
	    #maximum length of a type II restriction site in the current REBASE
	    my ($le_dn) = 15; 
	    my ($le_up) = $le_dn;

	    #reduce the flank lengths if the desired length is not available
	    $le_dn = CORE::length ($self->dnStreamSeq) if $le_dn > CORE::length ($self->dnStreamSeq);
	    $le_up = CORE::length ($self->upStreamSeq) if $le_up > CORE::length ($self->upStreamSeq);

	    #Build sequence strings to compare
	    my ($oriseq, $mutseq);    
	    $oriseq  = $mutseq = substr($self->upStreamSeq, -$le_up, $le_up);
	    $oriseq .= $self->allele_ori->seq if $self->allele_ori->seq;
	    $mutseq .= $self->allele_mut->seq if $self->allele_mut->seq;
	    $oriseq .= substr($self->dnStreamSeq, 0, $le_dn);
	    $mutseq .= substr($self->dnStreamSeq, 0, $le_dn);
	    
	    # ... and their reverse complements
	    my $oriseq_rev = _revcompl ($oriseq);
	    my $mutseq_rev = _revcompl ($mutseq);

	    # collect results into a string
	    my $rec = '';
	    foreach my $enz (sort keys (%re)) {
		my $site = $re{$enz};
		my @ori = ($oriseq=~ /$site/g);
		my @mut = ($mutseq=~ /$site/g);
		my @ori_r = ($oriseq_rev =~ /$site/g);
		my @mut_r = ($mutseq_rev =~ /$site/g);
		
		$rec .= '+'. $enz. ", " 
		    if (scalar @ori < scalar @mut) or (scalar @ori_r < scalar @mut_r);
		$rec .= '-'. $enz. ", " 		    
		    if (scalar @ori > scalar @mut) or (scalar @ori_r > scalar @mut_r);
		
	    }
	    $rec = substr($rec, 0, CORE::length($rec) - 2) if $rec ne '';
	    $self->{'re_changes'} =  $rec;
	}
    }
    return $self->{'re_changes'}
}


sub _revcompl { 
    # side effect: lower case letters
    my ($seq) = shift;

    $seq = lc $seq;
    $seq =~ tr/acgtrymkswhbvdnx/tgcayrkmswdvbhnx/;
    return CORE::reverse $seq;
}


sub _enzymes {
 #REBASE version 005   type2.005
 my %enzymes =  (
         'AarI' => 'cacctgc',
         'AatII' => 'gacgtc',
         'AccI' => 'gt[ac][gt]ac',
         'AceIII' => 'cagctc',
         'AciI' => 'ccgc',
         'AclI' => 'aacgtt',
         'AcyI' => 'g[ag]cg[ct]c',
         'AflII' => 'cttaag',
         'AflIII' => 'ac[ag][ct]gt',
         'AgeI' => 'accggt',
         'AhaIII' => 'tttaaa',
         'AloI' => 'gaac[acgt][acgt][acgt][acgt][acgt][acgt]tcc',
         'AluI' => 'agct',
         'AlwNI' => 'cag[acgt][acgt][acgt]ctg',
         'ApaBI' => 'gca[acgt][acgt][acgt][acgt][acgt]tgc',
         'ApaI' => 'gggccc',
         'ApaLI' => 'gtgcac',
         'ApoI' => '[ag]aatt[ct]',
         'AscI' => 'ggcgcgcc',
         'AsuI' => 'gg[acgt]cc',
         'AsuII' => 'ttcgaa',
         'AvaI' => 'c[ct]cg[ag]g',
         'AvaII' => 'gg[at]cc',
         'AvaIII' => 'atgcat',
         'AvrII' => 'cctagg',
         'BaeI' => 'ac[acgt][acgt][acgt][acgt]gta[ct]c',
         'BalI' => 'tggcca',
         'BamHI' => 'ggatcc',
         'BbvCI' => 'cctcagc',
         'BbvI' => 'gcagc',
         'BbvII' => 'gaagac',
         'BccI' => 'ccatc',
         'Bce83I' => 'cttgag',
         'BcefI' => 'acggc',
         'BcgI' => 'cga[acgt][acgt][acgt][acgt][acgt][acgt]tgc',
         'BciVI' => 'gtatcc',
         'BclI' => 'tgatca',
         'BetI' => '[at]ccgg[at]',
         'BfiI' => 'actggg',
         'BglI' => 'gcc[acgt][acgt][acgt][acgt][acgt]ggc',
         'BglII' => 'agatct',
         'BinI' => 'ggatc',
         'BmgI' => 'g[gt]gccc',
         'BplI' => 'gag[acgt][acgt][acgt][acgt][acgt]ctc',
         'Bpu10I' => 'cct[acgt]agc',
         'BsaAI' => '[ct]acgt[ag]',
         'BsaBI' => 'gat[acgt][acgt][acgt][acgt]atc',
         'BsaXI' => 'ac[acgt][acgt][acgt][acgt][acgt]ctcc',
         'BsbI' => 'caacac',
         'BscGI' => 'cccgt',
         'BseMII' => 'ctcag',
         'BsePI' => 'gcgcgc',
         'BseRI' => 'gaggag',
         'BseSI' => 'g[gt]gc[ac]c',
         'BsgI' => 'gtgcag',
         'BsiI' => 'cacgag',
         'BsiYI' => 'cc[acgt][acgt][acgt][acgt][acgt][acgt][acgt]gg',
         'BsmAI' => 'gtctc',
         'BsmI' => 'gaatgc',
         'Bsp1407I' => 'tgtaca',
         'Bsp24I' => 'gac[acgt][acgt][acgt][acgt][acgt][acgt]tgg',
         'BspGI' => 'ctggac',
         'BspHI' => 'tcatga',
         'BspLU11I' => 'acatgt',
         'BspMI' => 'acctgc',
         'BspMII' => 'tccgga',
         'BsrBI' => 'ccgctc',
         'BsrDI' => 'gcaatg',
         'BsrI' => 'actgg',
         'BstEII' => 'ggt[acgt]acc',
         'BstXI' => 'cca[acgt][acgt][acgt][acgt][acgt][acgt]tgg',
         'BtrI' => 'cacgtc',
         'BtsI' => 'gcagtg',
         'Cac8I' => 'gc[acgt][acgt]gc',
         'CauII' => 'cc[cg]gg',
         'Cfr10I' => '[ag]ccgg[ct]',
         'CfrI' => '[ct]ggcc[ag]',
         'CjeI' => 'cca[acgt][acgt][acgt][acgt][acgt][acgt]gt',
         'CjePI' => 'cca[acgt][acgt][acgt][acgt][acgt][acgt][acgt]tc',
         'ClaI' => 'atcgat',
         'CviJI' => '[ag]gc[ct]',
         'CviRI' => 'tgca',
         'DdeI' => 'ct[acgt]ag',
         'DpnI' => 'gatc',
         'DraII' => '[ag]gg[acgt]cc[ct]',
         'DraIII' => 'cac[acgt][acgt][acgt]gtg',
         'DrdI' => 'gac[acgt][acgt][acgt][acgt][acgt][acgt]gtc',
         'DrdII' => 'gaacca',
         'DsaI' => 'cc[ag][ct]gg',
         'Eam1105I' => 'gac[acgt][acgt][acgt][acgt][acgt]gtc',
         'EciI' => 'ggcgga',
         'Eco31I' => 'ggtctc',
         'Eco47III' => 'agcgct',
         'Eco57I' => 'ctgaag',
         'EcoNI' => 'cct[acgt][acgt][acgt][acgt][acgt]agg',
         'EcoRI' => 'gaattc',
         'EcoRII' => 'cc[at]gg',
         'EcoRV' => 'gatatc',
         'Esp3I' => 'cgtctc',
         'EspI' => 'gct[acgt]agc',
         'FauI' => 'cccgc',
         'FinI' => 'gggac',
         'Fnu4HI' => 'gc[acgt]gc',
         'FnuDII' => 'cgcg',
         'FokI' => 'ggatg',
         'FseI' => 'ggccggcc',
         'GdiII' => 'cggcc[ag]',
         'GsuI' => 'ctggag',
         'HaeI' => '[at]ggcc[at]',
         'HaeII' => '[ag]gcgc[ct]',
         'HaeIII' => 'ggcc',
         'HaeIV' => 'ga[ct][acgt][acgt][acgt][acgt][acgt][ag]tc',
         'HgaI' => 'gacgc',
         'HgiAI' => 'g[at]gc[at]c',
         'HgiCI' => 'gg[ct][ag]cc',
         'HgiEII' => 'acc[acgt][acgt][acgt][acgt][acgt][acgt]ggt',
         'HgiJII' => 'g[ag]gc[ct]c',
         'HhaI' => 'gcgc',
         'Hin4I' => 'ga[cgt][acgt][acgt][acgt][acgt][acgt][acg]tc',
         'HindII' => 'gt[ct][ag]ac',
         'HindIII' => 'aagctt',
         'HinfI' => 'ga[acgt]tc',
         'HpaI' => 'gttaac',
         'HpaII' => 'ccgg',
         'HphI' => 'ggtga',
         'Hpy178III' => 'tc[acgt][acgt]ga',
         'Hpy188I' => 'tc[acgt]ga',
         'Hpy99I' => 'cg[at]cg',
         'KpnI' => 'ggtacc',
         'Ksp632I' => 'ctcttc',
         'MaeI' => 'ctag',
         'MaeII' => 'acgt',
         'MaeIII' => 'gt[acgt]ac',
         'MboI' => 'gatc',
         'MboII' => 'gaaga',
         'McrI' => 'cg[ag][ct]cg',
         'MfeI' => 'caattg',
         'MjaIV' => 'gt[acgt][acgt]ac',
         'MluI' => 'acgcgt',
         'MmeI' => 'tcc[ag]ac',
         'MnlI' => 'cctc',
         'MseI' => 'ttaa',
         'MslI' => 'ca[ct][acgt][acgt][acgt][acgt][ag]tg',
         'MstI' => 'tgcgca',
         'MwoI' => 'gc[acgt][acgt][acgt][acgt][acgt][acgt][acgt]gc',
         'NaeI' => 'gccggc',
         'NarI' => 'ggcgcc',
         'NcoI' => 'ccatgg',
         'NdeI' => 'catatg',
         'NheI' => 'gctagc',
         'NlaIII' => 'catg',
         'NlaIV' => 'gg[acgt][acgt]cc',
         'NotI' => 'gcggccgc',
         'NruI' => 'tcgcga',
         'NspBII' => 'c[ac]gc[gt]g',
         'NspI' => '[ag]catg[ct]',
         'PacI' => 'ttaattaa',
         'Pfl1108I' => 'tcgtag',
         'PflMI' => 'cca[acgt][acgt][acgt][acgt][acgt]tgg',
         'PleI' => 'gagtc',
         'PmaCI' => 'cacgtg',
         'PmeI' => 'gtttaaac',
         'PpiI' => 'gaac[acgt][acgt][acgt][acgt][acgt]ctc',
         'PpuMI' => '[ag]gg[at]cc[ct]',
         'PshAI' => 'gac[acgt][acgt][acgt][acgt]gtc',
         'PsiI' => 'ttataa',
         'PstI' => 'ctgcag',
         'PvuI' => 'cgatcg',
         'PvuII' => 'cagctg',
         'RleAI' => 'cccaca',
         'RsaI' => 'gtac',
         'RsrII' => 'cgg[at]ccg',
         'SacI' => 'gagctc',
         'SacII' => 'ccgcgg',
         'SalI' => 'gtcgac',
         'SanDI' => 'ggg[at]ccc',
         'SapI' => 'gctcttc',
         'SauI' => 'cct[acgt]agg',
         'ScaI' => 'agtact',
         'ScrFI' => 'cc[acgt]gg',
         'SduI' => 'g[agt]gc[act]c',
         'SecI' => 'cc[acgt][acgt]gg',
         'SexAI' => 'acc[at]ggt',
         'SfaNI' => 'gcatc',
         'SfeI' => 'ct[ag][ct]ag',
         'SfiI' => 'ggcc[acgt][acgt][acgt][acgt][acgt]ggcc',
         'SgfI' => 'gcgatcgc',
         'SgrAI' => 'c[ag]ccgg[ct]g',
         'SimI' => 'gggtc',
         'SmaI' => 'cccggg',
         'SmlI' => 'ct[ct][ag]ag',
         'SnaBI' => 'tacgta',
         'SnaI' => 'gtatac',
         'SpeI' => 'actagt',
         'SphI' => 'gcatgc',
         'SplI' => 'cgtacg',
         'SrfI' => 'gcccgggc',
         'Sse232I' => 'cgccggcg',
         'Sse8387I' => 'cctgcagg',
         'Sse8647I' => 'agg[at]cct',
         'SspI' => 'aatatt',
         'Sth132I' => 'cccg',
         'StuI' => 'aggcct',
         'StyI' => 'cc[at][at]gg',
         'SwaI' => 'atttaaat',
         'TaqI' => 'tcga',
         'TaqII' => 'gaccga',
         'TatI' => '[at]gtac[at]',
         'TauI' => 'gc[cg]gc',
         'TfiI' => 'ga[at]tc',
         'TseI' => 'gc[at]gc',
         'Tsp45I' => 'gt[cg]ac',
         'Tsp4CI' => 'ac[acgt]gt',
         'TspEI' => 'aatt',
         'TspRI' => 'ca[cg]tg[acgt][acgt]',
         'Tth111I' => 'gac[acgt][acgt][acgt]gtc',
         'Tth111II' => 'caa[ag]ca',
         'UbaGI' => 'cac[acgt][acgt][acgt][acgt]gtg',
         'UbaPI' => 'cgaacg',
         'VspI' => 'attaat',
         'XbaI' => 'tctaga',
         'XcmI' => 'cca[acgt][acgt][acgt][acgt][acgt][acgt][acgt][acgt][acgt]tgg',
         'XhoI' => 'ctcgag',
         'XhoII' => '[ag]gatc[ct]',
         'XmaIII' => 'cggccg',
         'XmnI' => 'gaa[acgt][acgt][acgt][acgt]ttc'
        );

    return %enzymes;
}

1;