Error in pretty printing script, make sure you have PPI and PPI::HTML installed.
# Perl module voor het parsen van pdb
#
# $Id: mimmap.pm 131 2006-08-10 12:02:09Z hekkel $
#
# Copyright (c) 2005
# CMBI, Radboud University Nijmegen. All rights reserved.
#
# This code is derived from software contributed by Maarten L. Hekkelman
# and Hekkelman Programmatuur b.v.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions
# are met:
# 1. Redistributions of source code must retain the above copyright
# notice, this list of conditions and the following disclaimer.
# 2. Redistributions in binary form must reproduce the above copyright
# notice, this list of conditions and the following disclaimer in the
# documentation and/or other materials provided with the distribution.
# 3. All advertising materials mentioning features or use of this software
# must display the following acknowledgement:
# This product includes software developed by the Radboud University
# Nijmegen and its contributors.
# 4. Neither the name of Radboud University nor the names of its
# contributors may be used to endorse or promote products derived
# from this software without specific prior written permission.
#
# THIS SOFTWARE IS PROVIDED BY THE RADBOUD UNIVERSITY AND CONTRIBUTORS
# ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
# TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
# PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE UNIVERSITY OR CONTRIBUTORS
# BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
# CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
# SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
# INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
# CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
# ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
# POSSIBILITY OF SUCH DAMAGE.
#
package MRS::Script::mimmap;
our @ISA = "MRS::Script";
sub new
{
my $invocant = shift;
my $self = new MRS::Script(
name => 'Mimmap, our view on genemap from OMIM',
url => 'urn:?',
section => 'other',
meta => [ 'title' ],
raw_files => qr/^genemap$/,
@_
);
$self->{raw_dir} =~ s|mimmap|omim| if defined $self->{raw_dir};
return bless $self, "MRS::Script::mimmap";
}
sub Parse
{
my $self = shift;
my ($doc, $m, $state);
my $lookahead = $self->GetLine;
$state = 0;
my $id = 0;
while (defined $lookahead)
{
my $line = $lookahead;
$lookahead = $self->GetLine;
chomp($line);
# convert genemap to mimmap
my @data = split(m/\|/, $line);
my %status = (
'C' => 'confirmed',
'P' => 'provisional',
'I' => 'inconsistent',
'L' => 'tentative'
);
my $dis = join(' ', $data[13], $data[14], $data[15]);
my @mim = split(m/\D+/, $dis);
my $mim = join(", ", grep { $_ =~ m/\d{6}/ } @mim);
my $doc=<<"EOF";
ID : $id
Code : $data[0]
MIM# : $data[9]
Date : $data[3].$data[1].$data[2]
Location: $data[4]
Symbol : $data[5]
Status : $data[6] ($status{$data[6]})
Title : $data[7] $data[8]
Method : $data[10]
Comment : $data[11] $data[12]
Disorder: $dis
MIM_Dis : $mim
Mouse : $data[16]
Refs : $data[17]
//
EOF
$self->IndexValue('id', $id);
$self->IndexWord('mim', $data[9]);
my ($year, $mon, $day) = ($data[3], $data[1], $data[2]);
$year += 1900;
$year += 100 if $year < 1970;
$self->IndexDate('date', sprintf("%4.4d-%2.2d-%2.2d", $year, $mon, $day));
$self->IndexWord('code', $data[0]) if defined $data[0];
$self->IndexWord('location', $data[4]) if defined $data[4];
$self->IndexWord('status', $status{$data[6]}) if defined $data[6];
$self->IndexText('title', join(' ', $data[7], $data[8]));
$self->IndexText('method', $data[10]) if defined $data[10];
$self->IndexText('symbol', $data[5]) if defined $data[5];
$self->IndexText('comment', join(' ', $data[11], $data[12]));
$self->IndexText('disorder', $dis);
$self->IndexTextAndNumbers('mim_dis', $mim);
$self->IndexText('mouse', $data[16]) if defined $data[16];
$self->IndexText('refs', $data[17]) if defined $data[17];
$self->StoreMetaData('title', $data[9]);
$self->Store("$doc");
$self->FlushDocument;
++$id;
}
}
1;