This file is indexed.

/usr/share/perl5/SWISS/GNs.pm is in libswiss-perl 1.67-1.

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
package SWISS::GNs;

use vars qw($AUTOLOAD @ISA @EXPORT_OK %fields);

use Exporter;
use Carp;
use strict;

use SWISS::TextFunc;
use SWISS::ListBase;
use SWISS::GeneGroup;
use Data::Dumper;

BEGIN {
  @EXPORT_OK = qw();
  
  @ISA = ( 'Exporter', 'SWISS::ListBase');
  
  %fields = (
	and => " AND ",
	or  => " OR " ,
	    );
}

sub new {
  my $ref = shift;
  my $class = ref($ref) || $ref;
  my $self = new SWISS::ListBase;
  
  $self->rebless($class);
  return $self;
}

sub initialize {
}

sub fromText {
  my $self = new(shift);
  my $textRef = shift;
  my $line = '';
  my @tmp;
 
  if ($$textRef =~ /($SWISS::TextFunc::linePattern{'GN'})/m){ 
    $line = join ' ', map {
      $self->{indentation} += $_ =~ s/^ //;
      SWISS::TextFunc->cleanLine($_);
      } (split /\n/m, $1 );  
    $line =~ s/\.$//;
  }
  $self->text($line);
  return $self;
}

sub is_old_format {
  my $self = shift;
  if (@_) {
  map {$_->is_old_format(@_)} $self->elements;
  }
  else  {
  return grep {$_->is_old_format} $self->elements;
  }
}

sub toText {
  my $self = shift;
  my $textRef = shift;
  if ($self->is_old_format) {
    $self->is_old_format(1);
    return _toText_old($self, $textRef, @_);
  }
  $self->is_old_format(0);
  my $newText = '';
    my @groups;
    for my $group (@{$self->list}) {
    my $groupText = $group->toText;
    my $prefix = "GN   ";
    my $col = $SWISS::TextFunc::lineLength;
    $col++, $prefix=" $prefix" if $self->{indentation};
    push @groups, SWISS::TextFunc->wrapOn($prefix, $prefix, $col,
  			         $groupText, 
  			         ';\s+', ',\s+', '\s+');
  }
  my $indent = $self->{indentation} ? " " : "";
  $newText = join "${indent}GN   and\n", @groups;
  $self->{_dirty} = 0;
  return SWISS::TextFunc->insertLineGroup($textRef, $newText, 
					  $SWISS::TextFunc::linePattern{'GN'});
}

sub _toText_old {
  my $self = shift;
  my $textRef = shift;
  my $newText = '';
  if ($self->size){
    $newText = $self->text;
    return $textRef if !defined $newText;
    $newText .= ".";

    #wrapping rules : 
    # - whenever possible, wrap after AND.
    # - else, wrap before or after an OR or AND, so as to maximize the length of
    #   the uppermost line.

    my $or = $self->or; my $and = $self->and;
    for ($or,$and) { s/^\s+//; s/\s+$//; $_ = quotemeta $_; }
    my $pat = "(?<= $or )|(?<= $and )| (?=$or |$and )";
    my $prefix = "GN   ";
    my $col = $SWISS::TextFunc::lineLength;
    $col++, $prefix=" $prefix" if $self->{indentation};
    $newText = SWISS::TextFunc->wrapOn($prefix, $prefix, $col,
				       $newText, 
				       "\\s+$and\\s+", $pat, ',\s+', '(?=\()', '\s+');
  };
  $self->{_dirty} = 0;
  return SWISS::TextFunc->insertLineGroup($textRef, $newText, 
					  $SWISS::TextFunc::linePattern{'GN'});
}

sub text {
  my $self = shift;
  my $text = shift; 
  if (defined $text) {
    #reset GNs object from $text

    my $sep = $text =~ /^ *(?:Name|Synonyms|OrderedLocusNames|ORFNames)=/ ? "; and " : " and ";
    @{$self->list} = map {SWISS::GeneGroup->fromText($_)} split /$sep/i, $text;
    $self->{and} = $1 if $text =~ /( AND )/i;
    $self->{or} = $1 if $text =~ /( OR )/i;
    $self->{_dirty} = 0;
    if (defined $main::opt_gn_check) {     
      if ($text ne $self->text) {
        print STDERR "Warning: SWISS::GNs->text could not interpret the following line : \n".
          "$text\nDo not define \$main::opt_gn_check to remove this message.\n";
      }
    }
    return $text;
  }
  else {
    #simply return text
    @{$self->list} = grep {$_->size} @{$self->list};
    my $addParen = $self->size>1;
    return undef unless $self->size;
    return join $self->and, map {
      my $a=$_->_toText_old($self->or);
      $a="($a)" if $addParen && @{$_->list}>1;
      $a } @{$self->list};
  }
}

sub update {
  my $self = shift;
  my $force = shift;                  # force update 

  if ($force) {
    
    # make sure that GN line is deleted on update if GN object has no gene names
    
    @{$self->list} = grep {$_->size} @{$self->list};
    return undef unless $self->size;
  } 
  $self->sort();
  
  return 1;
}

sub sort {
  my $self = shift;
  return map {$_->sort(@_)} @{$self->list};
}

sub get {
  my $self = shift;
  return map {$_->get(@_)} @{$self->list};
}

sub lowercase {
  my $self = shift;
  $self->{and}=~tr/A-Z/a-z/;
  $self->{or}=~tr/A-Z/a-z/;
}

sub uppercase {
  my $self = shift;
  $self->{and}=~tr/a-z/A-Z/;
  $self->{or}=~tr/a-z/A-Z/;
}

sub getFirst {

  my ($self) = @_;

  if ($self->is_old_format) {

    for my $ggroup ($self->elements) {

      return ${$ggroup->list}[0]->text;
    }
  
  } else {
  
    for my $ggroup (@{$self->list}) {
  	  
      return ${$ggroup->list()}[0] -> text();
    }
  }
}

sub getTags {

  # return evidnece tags associated with a given gene name

  my ($self, $target) = @_;

  if ($self->is_old_format) {
  
    for my $ggroup ($self->elements) {

      for (my $n=0;$n<$ggroup->size;$n++) {
    
        if (${$ggroup->list}[$n]->text eq $target) {
      
          return ${$ggroup->list}[$n]->getEvidenceTags;
        }
      }
    }
  
  } else {
  
    for my $ggroup (@{$self->list}) {
    
      for (my $n=0;$n<$ggroup->size;$n++) {
      
        if (${$ggroup->list()}[$n] -> text() eq $target) {
      
          my $tags = ${$ggroup->list()}[0] -> evidenceTags();
          $tags =~ s/{|}|,//g;
          return $tags;
        }
      }
    }
  }
  
  return;
}

sub isPresent {

  # method to identify whether a given name is present in the GN object

  my ($self, $target) = @_;
  
  if ($self->is_old_format) {
  
    my ($self, $target) = @_;

    for my $ggroup ($self->elements) {

      for (my $n=0;$n<$ggroup->size;$n++) {
    
        if (${$ggroup->list}[$n]->text eq $target) {
      
          return 1;
        }  
      }
    }
  
  } else {
  
    for my $ggroup (@{$self->list}) {
    
      for (my $n=0;$n<$ggroup->size;$n++) {
      
        if (${$ggroup->list()}[$n] -> text() eq $target) {
      
          return 1;
        }
      }
    }
  }
  
  return;
}


sub needsReCasing {

  # method to identify whether a given name is present in the GN object, but 
  # not in mixed case
  
  # returns match in current state

  my ($self, $target) = @_;
  
  if ($self->is_old_format) {
  
    for my $ggroup ($self->elements) {

      for (my $n=0;$n<$ggroup->size;$n++) {
    
        my $existingName = ${$ggroup->list}[$n]->text;
      
        if ((uc $existingName eq uc $target) &&
            ($existingName ne $target)) {
      
          return $existingName;
        }
      }
    }
  
  } else {
  
    for my $ggroup (@{$self->list}) {
    
      for (my $n=0;$n<$ggroup->size;$n++) {
      
        my $existingName = ${$ggroup->list()}[$n] -> text(); 
      
        if ((uc $existingName eq uc $target) && ($existingName ne $target)) {
           
          return $existingName;
        } 
      }
    }
  }
  
  return;
}

sub replace {

  # replaces the first occurance of a given gene name in a GN line with the
  # replacement name.
  
  my ($self, $newName, $target, $evidenceTag) = @_;

  # no safety check: allow for adding identical names (tag addition)
  
  if ($self->is_old_format) {
  
    for my $ggroup ($self->elements) {
  
      for (my $n=0;$n<$ggroup->size;$n++) {
      
        my $geneText = ${$ggroup->list}[$n]->text;
          
        if ($geneText eq $target) {
          
           ${$ggroup->list}[$n]->text($newName);
         
           # may want to keep old evidence tags when replacing, i.e. add > 1
         
           my @tags = split /, /, $evidenceTag;
           ${$ggroup->list}[$n] -> setEvidenceTags(@tags);
           return;
        }
      }
    }
  
  } else {
  
    for my $ggroup (@{$self->list}) {
    
      for (my $n=0;$n<$ggroup->size;$n++) {
      
        my $name = ${$ggroup->list()}[$n]; 
    
        if ($name -> text() eq $target) {
  
          $name -> text($newName);           
          my @tags = split /, /, $evidenceTag;
          $name -> setEvidenceTags(@tags);
          return;
        }
      }
    }
  }
  
  return;   
}

sub delete {

  my ($self, $target) = @_;
  my $groupCount = 0;
  
  if ($self->is_old_format) {
  
    for my $ggroup ($self->elements) {
  
      for (my $n=0;$n<$ggroup->size;$n++) {
    
        my $geneText = ${$ggroup->list}[$n]->text;
      
        if ($geneText eq $target) {
      
          if ($ggroup->size == 0) {
        
            # remove gene group
          
            splice (@{$self->list}, $groupCount, 1);
          
          } else {
        
            # remove synonym from group
          
            splice (@{$ggroup -> list}, $n, 1);
          }
        
          return;
        }
      }
      
    $groupCount++;
    
    }
  
  } else {
  
    for my $ggroup ($self->elements) {
    
      CHECK: for (my $nameSet = 0; $nameSet < 3; $nameSet ++) {
        
        my @names;
        
        if ($nameSet == 0) {
        
          @names = $ggroup->Names->elements();
        
        } elsif ($nameSet == 1) {
          
          @names = $ggroup->OLN->elements();
          
        } else {
          
          @names = $ggroup->ORFNames->elements();
        }
        
        for (my $n=0;$n<scalar @names;$n++) {
      
          my $name = $names[$n]; 
    
          if ($name -> text() eq $target) {
          
            if ($ggroup->size == 0) {
        
              # remove gene group
          
              splice (@{$self->list}, $groupCount, 1);
          
            } else {
        
              # remove synonym from group
          
              splice (@names, $n, 1);
              
              if ($nameSet == 0) {
              
                @names = $ggroup->Names->list([@names]);
              
              } elsif ($nameSet == 1) {
              
                @names = $ggroup->OLN->list([@names]);
              
              } else {
              
                @names = $ggroup->ORFNames->list([@names]);
              }
              
              last CHECK;
            }
          }
        }
      }
    }
  }  
  
  return;  
}  

sub addAsNewSynonym {

  # user should first check that target exists using 'isPresent'.  If target is 
  # not found, method does nothing
  
  # otherwise method either adds new name in the gene group containing the
  # target, according to the parameter specified in $location

  # location > 1: insert name in first, second, third position etc.
  # location = 0: insert name before target
  # location = -1: insert name after target (default)
  # location = -2: insert name at end of gene group

  my ($self, $newName, $target, $evidenceTag, $location) = @_;

  # safety check: don't add duplicate gene names
  
  if (isPresent($self, $newName)) {
  
    return;
  } 

  if ($location eq '') {
  
    $location = -1;
  }
  
  my $GN = SWISS::GN -> new();
  $GN -> text($newName);
  $GN -> addEvidenceTag($evidenceTag);
  
  if ($self->is_old_format) {
    
    GENEGROUPS: for my $ggroup ($self->elements) {
  
      for (my $n=0;$n<$ggroup->size;$n++) {
      
        my $geneText = ${$ggroup->list}[$n]->text;
          
        if ($geneText eq $target) {
      
          my $position;
        
          if ($location == 0) {
        
            $position = $n;
              
          } elsif ($location == -1) {
          
            $position = $n + 1;
              
          } elsif ($location == -2) {
            
             $position = $ggroup->size;
        
          } else {
        
            $position = $location - 1;
          }
          
          splice @{$ggroup->list}, $position, 0, $GN;
          last GENEGROUPS;
        }
      }
    }
  
  } else {
  
    GENEGROUPS: for my $ggroup ($self->elements) {
    
      for (my $n=0;$n<$ggroup->size;$n++) {
      
        my $name = ${$ggroup->list()}[$n]; 
    
        if ($name -> text() eq $target) {
          
          my $position;
        
          if ($location == 0) {
        
            $position = $n;
              
          } elsif ($location == -1) {
          
            $position = $n + 1;
              
          } elsif ($location == -2) {
            
             $position = $ggroup->size;
        
          } else {
        
            $position = $location - 1;
          }
          
          splice @{$ggroup->list}, $position, 0, $GN;
          last GENEGROUPS;
        }
      }
    }
  }
  
  return;
}

sub addAsNewGeneGroup {

  # method adds a new gene name in a new gene group, $target and $location can 
  # be used to specify where in line new group should go
  
  # otherwise method either adds new name in the gene group containing the
  # target, according to the parameter specified in $location

  # location > 1: insert group in first, second, third position etc.
  # location = 0: insert group before group containing target
  # location = -1: insert group after group containing target (default)
  # location = -2: insert group at end

  # note that 'addSynonym requires a target to be specified (always).  
  # 'addAsNewGeneGroup' only requires a target if $location is 0 or -1

  my ($self, $newName, $target, $evidenceTag, $location) = @_;
  
  # safety check: don't add duplicate gene names
  
  if (isPresent($self, $newName)) {
  
    return $self;
  } 

  if ($location eq '') {
  
    $location = -1;
  }
  
  my $match = 0;
  my $position;
  my $GN = SWISS::GN -> new();
  $GN -> text($newName);
  $GN -> addEvidenceTag($evidenceTag);
  my $newGeneGroup = SWISS::GeneGroup -> new();
  
  if ($self->is_old_format) {
  
    push @{$newGeneGroup -> list}, $GN;
  
  } else {
  
    push @{$newGeneGroup -> list}, $GN;
  }
  
  if ($location < 1) {
  
    if ($location == -2) {
     
      $position = $self -> size();
      $match++;
    
    } else {
    
      my $p;
      $p = -1;
      
      if ($self->is_old_format) {
      
        GENEGROUPS: for my $ggroup ($self->elements) {
  
          $p++;
        
          for (my $n=0;$n<$ggroup->size;$n++) {
        
            my $geneText = ${$ggroup->list}[$n]->text;
          
            if ($geneText eq $target) {
      
              if ($location == 0) {
        
                $position = $p;
              
              } elsif ($location == -1) {
          
                $position = $p + 1;
              }
            
              $match++;
              last GENEGROUPS;
            }
          }
        }
        
      } else {
      
        GENEGROUPS: for my $ggroup ($self->elements) {
  
          $p++;
        
          for (my $n=0;$n<$ggroup->size;$n++) {
        
            my $geneText = ${$ggroup->list}[$n]->text;
          
            if ($geneText eq $target) {
      
              if ($location == 0) {
        
                $position = $p;
              
              } elsif ($location == -1) {
          
                $position = $p + 1;
              }
            
              $match++;
              last GENEGROUPS;
            }
          }
        }
      }
    }
  
  } else {
  
    $position = $location  - 1;
    $match++;
  }
  
  if ($match == 1) {
  
    splice @{$self -> list}, $position, 0, $newGeneGroup;
  }
  
  return;
}

sub replaceGeneGroup {

  # replaces the first gene group containing $target with the gene group
  # supplied as a paramter

  my ($self, $newGeneGroup, $target) = @_;
  my $groups = 0;
  my $hit = 0;
  my $thisGroup;

  if ($self->is_old_format) {
  
    GENEGROUPS: for my $ggroup ($self->elements) {
  
      $groups++;
  
      for (my $n=0;$n<$ggroup->size;$n++) {
      
        my $geneText = ${$ggroup->list}[$n]->text;
          
        if ($geneText eq $target) {
      
          $thisGroup = $groups;
          $hit++;
          last GENEGROUPS;
        }
      }
    }
  
  } else {
  
    GENEGROUPS: for my $ggroup ($self->elements) {
    
      $groups++;
      
      for (my $n=0;$n<$ggroup->size;$n++) {
      
        my $geneText = ${$ggroup->list}[$n]->text;
  
        if ($geneText eq $target) {
      
          $thisGroup = $groups;
          $hit++;
          last GENEGROUPS;
        }
      }
    }
  }
  
  if ($hit > 0) {
  
    splice @{$self -> list}, $thisGroup -1, 1, $newGeneGroup;
  }
}

sub getGeneGroup {
 
  my ($self, $target) = @_;
  
  GENEGROUPS: for my $ggroup ($self->elements) {
  
    for (my $n=0;$n<$ggroup->size;$n++) {
      
      my $geneText = "";
      
      if ($self->is_old_format) {
      
        $geneText = ${$ggroup->list}[$n]->text;
      
      } else {
      
        $geneText = ${$ggroup->list}[$n]->text;
      }
          
      if ($geneText eq $target) {
      
        return $ggroup;
      }
    }
  }
}

sub setToOr {

  # needed when adding C to 'A AND B', when the realtionship of C to A and B is
  # unknown: ' or ' os the default setting

  my ($self) = @_;
  my $GNs = SWISS::GNs -> new();
  my $geneGroup = SWISS::GeneGroup -> new();
  
  # maintain 'and' and 'or' values
  
  $GNs -> or($self -> or());
  $GNs -> and($self -> and());
  
  for my $ggroup ($self->elements) {
 
    for (my $n=0;$n<$ggroup->size;$n++) {
        
       push @{$geneGroup -> list}, ${$ggroup->list}[$n];
    }
  }
  
  push @{$GNs -> list}, $geneGroup;
  
  return $GNs;
}

1;

__END__

=head1 Name

SWISS::GNs.pm

=head1 Description

B<SWISS::GNs> represents the GN lines within an SWISS-PROT + TrEMBL
entry as specified in the user manual
 http://www.expasy.org/sprot/userman.html . The GNs object is a 
container object which holds a list of SWISS::GeneGroup objects.

=head1 Inherits from

SWISS::ListBase.pm

=head1 Attributes

=over

=item C<list>

  Each list element is a SWISS::GeneGroup object.

=item C<and> I<(deprecated, for old format only)>

  Delimiter used between genes. Defaults to " AND ".

=item C<or> I<(deprecated, for old format only)>

  Delimiter used between gene names. Defaults to " OR ".

=back

=head1 Methods

=head2 Standard methods

=over

=item new

=item fromText

=item toText

=back

=head2 Reading/Writing methods

=over

=item text [($newText)]

Sets the text of the GN line to the parameter if it is present, and returns
the (unwrapped) text of the line.  Also sets 'and' and 'or' delimiters to 
the first occurrences of the words "OR" and "AND" in the line, conserving
the case.

=item lowercase I<(deprecated, for old format only)>

Sets the GNs::and and GNs::or delimiters to their lower case
values.

=item uppercase I<(deprecated, for old format only)>

Sets the GNs::and and GNs::or delimiters to their upper case
values.

=item getFirst()

Returns first gene name in gene line

=item getTags($target)

Returns evidence tags associated with $target

$target is a string

=item isPresent($target)

Returns 1 if $target is present in the GN line

$target is a string

=item needsReCasing($target)

If $target is present in the GN line, but wrongly cased, method returns the
matching name in its current case

$target is a string

=item replace($newName, $target, $evidenceTag)

Replaces the first GN object in the GN line whose text attribute is $target with
a new GN object whose text attribute is set to $newName and whose evidenceTags
attribute is is set using values set by splitting $evidenceTag on /, / (as name
is not being changed, programs should keep old tag and add new tag).  Does 
nothing if $target is not found. 

=item delete($target)

Removes synonym/single-member gene group matching $target. Note that if a "Name" 
is deleted, the first "Synonym" will be promoted to "Name"

=item addAsNewSynonym($newName, $target, $evidenceTag, $location)

Adds a new GN object (with text attribute set to new $newName, and evidenceTags
attribute set to ($evidenceTag)), as a synonym to the first gene group in which
$target is a gene name.  Does nothing if $target is not found.  Will not add a
duplicate gene name.  $location determines where in gene group new object is
added: if $location == 1, 2, 3, ..., new object added in the 1st, 2nd, 3rd, ... 
position; if $location == 0, new object added before $target; if $location
== -1, new object added after $target (default); if $location == -2, new object
added at end of gene group.  Note that if the new synonym is inserted in the 
first postion, it will become the "Name" and the previous "Name" will be downgraded
to first "Synonym"

=item addAsNewGeneGroup($newName, $target, $evidenceTag, $location)

Adds a new GeneGroup object, comprising 1 GN object (with text attribute set to
new $newName, and evidenceTags attribute set to ($evidenceTag)). Will not add a
duplicate gene name.  $location and $target determine where in GNs line new 
group is added: if $location == 1, 2, 3, ..., new object added in the 1st, 2nd,
3rd, ... position; if $location == 0, new object added before $target; if
$location == -1, new object added after $target (default); if $location == -2,
new object added at end of GNs line.  Does nothing if $target is not found, and
$location == 0 or -1; otherwise $target does not need to be set.

=item replaceGeneGroup($newGeneGroup, $target)

Replaces the first gene group containing $target with $newGeneGroup.  Creating
the $newGeneGroup correctly is the user's responsibility

=item getGeneGroup($target)

Returns the first gene group that contains $target

=item setToOr()

Retruns a new GNs object, but with all GNs objects in a single gene group.  
Needed when adding 'C' to 'A and B', when the relationship of 'C' to 'A' and 
'B' is unknown: the universal use of ' or ' is the default delimeter for TrEMBL 
entries

=back

=head1 TRANSITION

The format of the GN line will change in 2004 from:

 GN   (CYSA1 OR CYSA OR RV3117 OR MT3199 OR MTCY164.27) AND (CYSA2 OR
 GN   RV0815C OR MT0837 OR MTV043.07C).

to:

 GN   Name=CysA1; Synonyms=CysA; OrderedLocusNames=Rv3117, MT3199;
 GN   ORFNames=MtCY164.27;
 GN   and
 GN   Name=CysA2; OrderedLocusNames=Rv0815c, MT0837; ORFNames=MTV043.07c;

This module supports both formats. To convert an entry from the old to
the new format, do:

 $entry->GNs->is_old_format(0);