Skip to content

Commit

Permalink
new
Browse files Browse the repository at this point in the history
  • Loading branch information
cmungall committed Apr 8, 2016
1 parent 49bb214 commit 26c0844
Showing 1 changed file with 45 additions and 0 deletions.
45 changes: 45 additions & 0 deletions src/gard/align2best.pl
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
#!/usr/bin/perl -w
use strict;
my %maph = ();
my %nh = ();
my $num = 0;
while(<>) {
chomp;
my ($id,$n,$x,$xn,$stem) = split(/\t/,$_);

if ($id =~ m@GARD@) {
$num++;
my $s = $x;
$s =~ s@:.*@@;
my $tuple = [$s, $x,$xn,$stem];
if (!$maph{$id}) {
$maph{$id} = $tuple;
}
else {
my $curr = $maph{$id};
my $replace = 0;
if ($stem eq 'true' && $curr->[3] eq 'false') {
# never replace a non-stem with a stemmed
$replace = 0;
}
elsif ($stem eq 'false' && $curr->[3] eq 'true' && $s eq $curr->[0]) {
# prioritize non-stem
$replace = 1;
}
elsif ($s eq 'OMIM') {
$replace = 1;
}
elsif ($s eq 'MESH') {
$replace = 0;
}
if ($replace) {
$maph{$id} = $tuple;
}
}
}
}
print STDERR "DONE: $num\n";
foreach my $k (keys %maph) {
my ($s, $x, $xn) = @{$maph{$k}};
print "$k\thttps://monarchinitiative.org/disease/$x\n";
}

0 comments on commit 26c0844

Please sign in to comment.