monarch-initiative / hpoannotqc

HPO Annotation QC
http://hpo-annotation-qc.readthedocs.io/en/latest/#
MIT License
11 stars 2 forks source link

Bad dates in Orphanet parser. #13

Closed pnrobinson closed 6 years ago

pnrobinson commented 6 years ago

There is an issue with some of the dates 2018-59-12: Bad date: Month '58' out of range 0..11 at checkDate.pl line 15.

This is being produced by the Orphanet code (which actually should just be adding today's date).

I have checked with this script:

#!/usr/bin/perl -w
use strict;
use IO::File;
use Time::Local;

my $fname =shift or die "Need to pass annotation file";
my $fh=new IO::File($fname) or die "$!";
my $header=<$fh>; #discard
my $good=0;
while (<$fh>) {
    my $datestring = (split(m/\t/))[12];
    my ($year, $month, $day) = split("-",$datestring);
    eval{ 
    timelocal(0,0,0,$day, $month-1, $year); # dies in case of bad date
    $good++;
    } or print "$datestring: Bad date: $@";
}
print "Got $good good dates\n";
pnrobinson commented 6 years ago

This is now working