/usr/share/doc/libswiss-perl/examples/evTest.pl is in libswiss-perl 1.67-1.
This file is owned by root:root, with mode 0o755.
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 | #!/sw/arch/bin/perl
use SWISS::Entry;
use Data::Dumper;
use Carp;
# Read an entire record at a time
$/ = "\/\/\n";
$opt_warn=3;
my @kws = ('Transferase', 'Kinase');
while (<>){
my $entry = SWISS::Entry->fromText($_);
# get a valid evidence tag
my $tag = $entry->EV->updateEvidence('P',
'TestProgram1',
'-',
'RU000044');
# For each of the keywords in question ...
foreach my $kw (@kws) {
# Check if the keyword is already there
$matchedKWs = $entry->KWs->filter(SWISS::ListBase::attributeEquals('text',
$kw));
# Security check, there might be duplicates
if ($matchedKWs->size > 1) {
croak("More than one KW matches $kw in $_");
}
my $kwObject;
if ($matchedKWs->size == 0) {
# Create the keyword object
$kwObject = new SWISS::KW;
$kwObject->text($kw);
$kwObject->addEvidenceTag($tag);
$entry->KWs->add($kwObject);
} else {
# add the evidence tag
$kwObject = $matchedKWs->head();
$kwObject->addEvidenceTag($tag);
}
}
# Delete another evidence tag, just to see the method.
map {$_->deleteEvidenceTag('EC2')} $entry->KWs->elements();
# Output the entry
print $entry->toText();
}
|