9a26b7380a408f1ed968d72f1b3cff18f2a1e054 max Mon Sep 9 02:41:20 2019 -0700 fixing clinvar typo added in last commit and also a missing _mouseOver field (very strange problem, possibly have not committed this file for a long time?) diff --git src/hg/utils/otto/clinvar/clinVarToBed src/hg/utils/otto/clinvar/clinVarToBed index 9432140..da8257e 100755 --- src/hg/utils/otto/clinvar/clinVarToBed +++ src/hg/utils/otto/clinvar/clinVarToBed @@ -98,33 +98,34 @@ """ returns same day as this month, but last month, e.g. for 2013-01-01 return 2012-12-01 """ days_of_month = [31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31] newmonth = ((( d.month - 1) - x ) % 12 ) + 1 newyear = d.year + ((( d.month - 1) - x ) // 12 ) if d.day > days_of_month[newmonth-1]: newday = days_of_month[newmonth-1] else: newday = d.day return datetime( newyear, newmonth, newday) def compareWithLastMonth(fname, maxDiff): " go back one month from current date, make sure that linecount diff is at most maxDiff " + todayStr = date.today().isoformat() previousDate = lastMonth(date.today()) - previousDate = previousDate.date().isoformat() - previousFname = fname.replace(today, previousDate) + previousDateStr = previousDate.date().isoformat() + previousFname = fname.replace(todayStr, previousDateStr) if not isfile(previousFname): print("Cannot find %s, cannot compare new data with previous month" % previousFname) return previousCount = sum(1 for line in open(previousFname)) todayCount = sum(1 for line in open(fname)) percDiff = (todayCount-previousCount)/float(todayCount) if percDiff < 0 and maxDiff: raise Exception("line count change negative: %s %d, %s %d. Run without --maxDiff to ignore this error. Or run the cronjob script doUpdate.sh with -nocheck to ignore this error." % \ (previousFname, previousCount, fname, todayCount)) if percDiff > maxDiff: raise Exception("line count increased too much: yesterday %d , today %d. Check if the input file is OK. If yes, remove the --maxDiff option from the clinVarToBed, call it only with the --auto option. Or run the cronjob script doUpdate.sh with -nocheck to ignore this error." % (previousCount, todayCount)) # see RM 14350 do more than just linecount # see http://stackoverflow.com/questions/1566461/how-to-count-differences-between-two-files-on-linux