7ce536b83750a2408845dfef61b11400165bec9a wong Wed Sep 7 09:28:21 2011 -0700 changed how libraries are handles, and added usage statement diff --git python/programs/DateCheck/dateCheck.py python/programs/DateCheck/dateCheck.py index c5f43d3..77f1028 100755 --- python/programs/DateCheck/dateCheck.py +++ python/programs/DateCheck/dateCheck.py @@ -1,20 +1,30 @@ #!/usr/bin/python import sys +import os import datetime -sys.path.append('/cluster/home/wong/kent/python/lib/') +dir = os.path.dirname(os.path.abspath(__file__)) +#print "dir = %s" % dir + +library = os.path.join(dir,"../../lib") +#print library + + + +sys.path.append(library) +#sys.path.append('/cluster/home/wong/kent/python/lib/') from ucscgenomics.rafile.RaFile import * def indexhg18(rafile): objlist = {} rahg18 = RaFile(rafile) #structure is hg18expids[expIdviewreplicate] = information dict #used for easy lookup of an equivalent hg18 object, it will only run through the list of expids first instead of all objects looking for a match hg18expids = {} for key in rahg18.keys(): stanza = rahg18[key] if not ('replicate' in stanza): stanza['replicate'] = "NA" @@ -45,30 +55,36 @@ #print "hg19:%s" % (stanza['metaObject']) if 'expId' in stanza: objinfo['expId'] = stanza['expId'] objinfo['view'] = stanza['view'] objinfo['replicate'] = stanza['replicate'] if 'dateUnrestricted' in stanza: objinfo['dateUnrestricted'] = stanza['dateUnrestricted'] objinfo['dateSubmitted'] = stanza['dateSubmitted'] objlist[stanza['metaObject']] = objinfo return(objlist) def main(): + if len(sys.argv) != 3: + arglen = len(sys.argv) + print arglen + sys.exit("usage: dateCheck.py hg19.ra hg18.ra") + #sys.exit() + hg18expids = indexhg18(sys.argv[2]) hg19objects = gethg19objects(sys.argv[1]) date = datetime.date today = str(date.today()) #print today for key in hg19objects.keys(): expid = hg19objects[key]['expId'] rep = hg19objects[key]['replicate'] view = hg19objects[key]['view'] key2 = "%s%s%s" % (expid, rep, view) #print "key2 = %s" % (key2) if key2 in hg18expids: infodict = hg18expids[key2]