/var/lib/mrs/parsers/omim.pm is in mrs 6.0.5+dfsg-3ubuntu1.
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 | package M6::Script::omim;
our @ISA = "M6::Script";
sub new
{
my $invocant = shift;
my $self = new M6::Script(
firstdocline => '*RECORD*',
trailer => '*THEEND*',
indices => {
'no' => 'Number',
'id' => 'Number',
'ti' => 'Title',
'mn' => 'Mini-Mim',
'av' => 'Allelic variation',
'tx' => 'Text',
'sa' => 'See also',
'rf' => 'References',
'cs' => 'Clinical Synopsis',
'cn' => 'Contributor name',
'cd' => 'Creation name',
'cd_date' => 'Creation date',
'ed' => 'Edit history',
'ed_date' => 'Edit history (date)',
},
@_
);
return bless $self, "M6::Script::omim";
}
sub parse
{
my ($self, $text) = @_;
while ($text =~ m/^\*FIELD\* (\w\w)\n((?:(?:\n|[^*\n].*\n)++|\*(?!FIELD).*\n)+)/mg)
{
my $key = $1;
my $value = $2;
if ($key eq 'NO')
{
$value =~ s/\s+$//;
$self->index_unique_string('id', $value);
$self->set_attribute('id', $value);
}
elsif ($key eq 'TI')
{
$self->index_text('title', $value);
$value = $1 if $value =~ m/^[*#+%^]?[0-9]{6} (.+)/m ;
$self->set_attribute('title', lc $value);
}
elsif ($key eq 'CD' or $key eq 'ED')
{
while ($value =~ m|^(.+?): (\d+)/(\d+)/(\d+)|gm)
{
my $date = sprintf('%4.4d-%2.2d-%2.2d', $4, $2, $3);
$self->index_text(lc $key, $1);
# $self->index_date(lc $key, $date);
$self->index_string(lc($key) . '_date', $date);
}
}
else
{
$self->index_text('text', $value);
}
}
}
1;
|