/usr/share/perl5/SWISS/DE.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 | package SWISS::DE;
use vars qw($AUTOLOAD @ISA @EXPORT_OK %fields);
use Exporter;
use Carp;
use strict;
use SWISS::TextFunc;
use SWISS::BaseClass;
BEGIN {
@EXPORT_OK = qw();
@ISA = ( 'Exporter', 'SWISS::BaseClass');
%fields = (
'text' => undef,
'category' => undef, # (in new format) RecName | AltName
'type' => undef, # ... Full | Short | EC | Allergen | CD_antigen
'hide_in_old' => undef, # ... for CD_antigen already seen ouside CD_antigen (to be hidden in old format)
);
}
sub new {
my $ref = shift;
my $class = ref($ref) || $ref;
my $self = new SWISS::BaseClass;
$self->rebless($class);
$self->{category} = shift;
$self->{type} = shift;
return $self;
}
sub fromText {
my $self = new(shift);
my $text = shift;
# Parse out the evidence tags
if ($text =~ s/($SWISS::TextFunc::evidencePattern)//) {
my $tmp = $1;
$self->evidenceTags($tmp);
}
$self->text($text);
$self->{_dirty} = 0;
return $self;
}
sub toText {
my $self = shift;
my $addParen = shift;
my $str = $self->text;
if (my $type = $self->{type}) {
# if defined = is new format: remove useless type txt inside name
# (!legacy from old format!)
my $process_txt_by_type = {
# transform stored name string (old format) into clean new names
'Full' => sub {
my $str = shift or return;
$str =~ s/ precursor$//;
return $str;
},
'EC' => sub {
my $str = shift or return;
$str =~ /^EC (\d.+)/;
return $1;
},
'Allergen' => sub {
my $str = shift or return;
$str =~ /^Allergen (.+)/;
return $1;
},
'CD_antigen' => sub {
my $str = shift or return;
$str =~ /^(.+) antigen$/;
return $1;
}
};
# process str (only if new format is asked! as
# .... DEs->is_old_format(1) might be used to convert new format back
# to old format ...)
$str = $process_txt_by_type->{$type}->($self->{text})
if $process_txt_by_type->{$type} and !$self->{is_old_format};
}
return '' if $self->{is_old_format} && $self->{hide_in_old};
return $addParen ? '(' . $str . ')' . $self->getEvidenceTagsString:
$str . $self->getEvidenceTagsString;
}
1;
__END__
=head1 Name
SWISS::DE.pm
=head1 Description
Each DE object represents one protein name. The container object for all names
of an entry is SWISS::DEs
=head1 Inherits from
SWISS::BaseClass
=head1 Attributes
=over
=item C<text>
The raw text of the protein name.
Note: as SwissKnife works with both new and old DE line formats, for backward
rcompatibility, with both formats everything is parsed and stored the same way as it
was with the old format. Therefore the raw text for a name of type 'EC' e.g.
6.3.5.5 will be "EC 6.3.5.5" (instead of "6.3.5.5"). Other strings only present
in old DE line text format ('precursor' flag and 'Allergen', 'antigen' strings)
are also added in the stored raw text.
The safe method to get the DE text is C<toText> (with both the new and old
DE line format), which for "EC=6.3.5.5" (new DE line format), will return
"6.3.5.5" (DE object of 'EC' type). For "(EC 6.3.5.5)" (old DE line format),
will return "EC 6.3.5.5"
=item C<category>
The category of the protein name: 'RecName', 'AltName', 'SubName' (TrEMBL only)
DE RecName: Full=CAD protein;
DE Short=CAD;
Here both names (DE objects), are of category 'RecName'
Category can be set/modified using C<category(string)>
Note: with the old DE line format, this field is undef
=item C<type>
The type of the protein name: 'Full', 'Short', 'EC' 'Allergen', 'CD_antigen',
'Biotech','INN'
DE RecName: Full=CAD protein;
DE Short=CAD;
Here the first name (DE object), is of type 'Full', the second one
is of type 'Short'
Type can be set/modified using C<type(string)>
Note: with the old DE line format, this field is undef
=back
=head1 Methods
=head2 Standard methods
=over
=item new
=item fromText
=item toText ($addParen)
addParen : (meaningful only with old DE line format) if set to true,
the name will be surrounded by parentheses, but not the evidence
tags, e.g. : '(UMP SYNTHASE){E1}'.
=back
=head1 Evidence Tags
Each protein name (DE object) can have independent evidence tags.
DE SubName: Full=Histone H3{EI1};
DE EC=3.4.21.9{EC3};
DE AltName: Full=Enterokinase{EC5};
The following methods have their prototype defined in
SWISS::BaseClass instead of the direct parent of SWISS::DEs, SWISS::ListBase :
addEvidenceTag
deleteEvidenceTags
getEvidenceTags
getEvidenceTagsString
hasEvidenceTag
setEvidenceTags
example :
$evidenceTag = $entry->Stars->EV->addEvidence('P', 'DEfix', '-', 'v1.3');
$entry->DEs->head->addEvidenceTag($evidenceTag);
The easiest way to read the evidence tags of a protein name is to use
c<getEvidenceTagsString> that will return the evidence tags as a string with
the enclosing {} brackets. If there are no evidence tags, will return an empty
string.
|