This file is indexed.

/usr/share/perl5/SWISS/GeneGroup.pm is in libswiss-perl 1.67-1.2.

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

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

use Exporter;
use Carp;
use strict;

use SWISS::TextFunc;
use SWISS::ListBase;
use SWISS::GN;

BEGIN {
  @EXPORT_OK = qw();
  
  @ISA = ( 'Exporter', 'SWISS::ListBase');

  @GN_LISTS = qw(Names OLN ORFNames);
  
  %fields = (
    'Names' => undef,
    'OLN' => undef,
    'ORFNames' => undef,
    'is_old_format' => undef,
	    );
}

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

sub initialize {
  my $self = CORE::shift;
  for my $listname (@GN_LISTS) {
    $self->{$listname} = new SWISS::ListBase;
  }
  $self->{is_old_format} = 0;
}

sub fromText {
  my $class = CORE::shift;
  my $text = CORE::shift;

  unless ($text =~ /^ *(?:Name|Synonyms|OrderedLocusNames|ORFNames)=/) {
    return _fromText_old($class, $text, @_);
  }

  my $self = new($class);
  $self->initialize;
  $text =~ s/[;\s]+$//;
  if ($text =~ s/(^|; +)ORFNames=(.*?)(?=; |;\Z|\Z)//) {
    $self->ORFNames->set(map {SWISS::GN->fromText($_)} split ', +', $2);
  }
  if ($text =~ s/(^|; +)OrderedLocusNames=(.*?)(?=; |;\Z|\Z)//) {
    $self->OLN->set(map {SWISS::GN->fromText($_)} split ', +', $2);
  }
  my @names;
  if ($text =~ s/(^|; +)Synonyms=(.*?)(?=; |;\Z|\Z)//) {
    push @names, split ', +', $2;
  }
  if ($text =~ s/(^|; +)Name=(.*?)(?=; |;\Z|\Z)//) {
    unshift @names, split ', +', $2; #ensure space because valid names may contain a comma
  }
  if (length $text) {
    if ($main::opt_warn) {
      carp "GN parse error, left text $text";
    }
    push @names, $text;
  }
  $self->Names->set(map {SWISS::GN->fromText($_)} @names);
  return $self;
}


sub _fromText_old {
  my $self = new(CORE::shift);
  my $text = CORE::shift;
  my $line;
  my @tmp;

  if( $text =~ /^\(/ && $text =~ /\)$/ ){
    $text =~ s/^\(//; 
    $text =~ s/\)$//;
  }
  $self->Names->set(map{SWISS::GN->fromText($_)}split / OR /i, $text); 
  $self->is_old_format(1);
  return $self;
}

sub toText {
  my $self = CORE::shift;
  if ($self->is_old_format) {
    return _toText_old($self, @_);
  }
  my @newText;
  if ($self->Names->size)  {
	  push @newText, "Name=" . $self->Names->head->toText . ";";
	  if ($self->Names->size > 1) {
		  push @newText, "Synonyms=" . join(", ", map {$_->toText} $self->Names->tail) . ";";
	  }
  }
  if ($self->OLN->size)  {
    push @newText, "OrderedLocusNames=" . join(", ", map {$_->toText} $self->OLN->elements) . ";";
  }
  if ($self->ORFNames->size)  {
    push @newText, "ORFNames=" . join(", ", map {$_->toText} $self->ORFNames->elements) . ";";
  }
  return join " ", @newText;
}

sub _toText_old {
  my $self = CORE::shift;
  my $delimiter = CORE::shift || ' OR ';
  my $a=join $delimiter, map{$_->toText} @{$self->list}; #FIXME
  return $a;
}

sub sort {
	my $self = CORE::shift;
	my @name1 = $self->Names->splice(0, 1);
	return $self->Names->set(@name1, sort {lc($a->text) cmp lc($b->text) || $a->text cmp $b->text} $self->Names->elements);
}

# access Name and Synonyms
sub Name {
	my $self = CORE::shift;
	if (@_) {
		my $newName = CORE::shift;
		return $self->Names->splice(0, 1, $newName);
	}
	else {
		return $self->Names->head;
	}
}

sub Synonyms {
	my $self = CORE::shift;
	if (@_) {
		if ($self->Names->size > 1) {
			return $self->Names->splice(1, $self->Names->size-1, @_);
		}
		else {
			return $self->Names->set(@_);
		}
	}
	else {
		return $self->Names->tail;
	}
}

# ListBase emulation
sub list {
	my $self = CORE::shift;
	return [$self->elements];
}

sub get {
	my $self = CORE::shift;
	my $pattern = CORE::shift;
	return grep {$_->text =~ /^$pattern$/} $self->elements;
}

sub head {
	my $self = CORE::shift;
	return $self->list->[0];
}

sub tail {
	my $self = CORE::shift;
	my @el = $self->elements;
	CORE::shift @el if @el>0;
	return @el;
}

sub size {
	my $self = CORE::shift;
	return $self->Names->size + $self->OLN->size + $self->ORFNames->size;
}

sub isEmpty {
	my $self = CORE::shift;
	return not $self->size;
}

sub elements {
	my $self = CORE::shift;
	return
		$self->Names->elements,
		$self->OLN->elements,
		$self->ORFNames->elements;
}

sub item {
	my $self = CORE::shift;
	my $n = CORE::shift;
	return $self->list->[$n];
}

sub push {
	my $self = CORE::shift;
	$self->Names->push(@_);
}

sub pop {
	my $self = CORE::shift;
	for my $listname (@GN_LISTS) {
		next unless $self->{$listname}->size;
		return $self->{$listname}->pop(@_);
	}
	return undef;
}

sub shift {
	my $self = CORE::shift;
	for my $listname (@GN_LISTS) {
		next unless $self->{$listname}->size;
		return $self->{$listname}->shift(@_);
	}
	return undef;
}

sub splice {
	my $self = CORE::shift;
	for my $listname (@GN_LISTS) {
		next unless $self->{$listname}->size;
		return $self->{$listname}->splice(@_);
	}
	return undef;
}

sub unshift {
	my $self = CORE::shift;
	$self->Names->unshift(@_);
}

sub set {
	my $self = CORE::shift;
	$self->initialize;
	$self->Names->set(@_);
}

sub add {
	my $self = CORE::shift;
	$self->Names->add(@_);
}

sub filter {
  my $self = CORE::shift;

  my $new = new ref($self);
  for my $listname (@GN_LISTS) {
    $new->{$listname} = $self->{$listname}->filter(@_);
  };

  $new->{indentation} = $self->{indentation};

  return $new;
}


1;

__END__

=head1 Name

SWISS::GeneGroup.pm

=head1 Description

A B<SWISS::GeneGroup> object contain all synonyms for a given
gene name. See B<SWISS::GNs> for a description of the gene name
format.

=head1 Inherits from

SWISS::BaseClass.pm

(also implements many methods from SWISS::ListBase.pm)

=head1 Attributes

=over

=item C<Names>

  Each list element is a SWISS::GN object, describing a primary name
  or synonym. Concatenation of Name and Synonyms lists.

=item C<OLN>

  Each list element is a SWISS::GN object, describing an
  OrderedLocusName.

=item C<ORFNames>

  Each list element is a SWISS::GN object, describing an ORFName.

=back

=head1 Methods

=head2 Standard methods

=over

=item new

=item fromText

=item toText

=back

=head2 Specific methods

=over

=item Name

Returns the Name (primary name).

=item Synonyms

Returns the Synonyms.

=item elements

  Concatenates all elements from Names, OLN and ORFNames in
  a single array.

=back

=head2 List manipulation methods

Since GeneGroup was a previous implementation of SWISS::ListBase,
the list manipulation methods below are provided to facilitate
compatibility.

=over

=item size

=item isEmpty

=item elements

=item filter

=item get I<(deprecated)>

=item head I<(deprecated)>

=item tail I<(deprecated)>

=item item I<(deprecated)>

=item push I<(deprecated)>

=item pop I<(deprecated)>

=item shift I<(deprecated)>

=item splice I<(deprecated)>

=item unshift I<(deprecated)>

=item set I<(deprecated)>

=item add I<(deprecated)>

=back