88874df06e5134a06ad82cd75a8e965d8914e33f mmaddren Tue Jan 25 16:21:18 2011 -0800 updated python scripts diff --git python/ucscgenomics/rafile/write.py python/ucscgenomics/rafile/write.py index e69de29..e30cf27 100644 --- python/ucscgenomics/rafile/write.py +++ python/ucscgenomics/rafile/write.py @@ -0,0 +1,27 @@ +# +# rafile/write.py +# +# Handles the writing of the raDict object. Mostly just wrapper functions for +# the class's tostring method. +# + +import sys +import radict + +def writeRaFile(raDict, *args): + + if not isinstance(raDict, radict.RaDict): + print 'ERROR: writeRaFile() - invalid raDict argument' + sys.exit(1) + + keys = map(str, args) + + # if specific keys supplied, print out the stanzas associated with them + if len(keys) > 0: + for key in keys: + print raDict.getValue(key) + + #otherwise just print the whole raDict + else: + print raDict +