X-Git-Url: http://woldlab.caltech.edu/gitweb/?p=erange.git;a=blobdiff_plain;f=chkSNPrmask.py;fp=chkSNPrmask.py;h=d52c9405afa32654e0b02e4dcce0c8d5c3b1d503;hp=498ef491ca6e1ffda95da172e5c8a7096f75b6d5;hb=0d3e3112fd04c2e6b44a25cacef1d591658ad181;hpb=5e4ae21098dba3d1edcf11e7279da0d84c3422e4 diff --git a/chkSNPrmask.py b/chkSNPrmask.py index 498ef49..d52c940 100755 --- a/chkSNPrmask.py +++ b/chkSNPrmask.py @@ -4,18 +4,19 @@ try: except: pass -import sqlite3 as sqlite import sys -import tempfile, shutil, os, optparse -from os import environ +import tempfile +import shutil +import os +import optparse +import sqlite3 as sqlite +from commoncode import getConfigParser, getConfigOption, getConfigBoolOption -if environ.get("CISTEMATIC_TEMP"): - cisTemp = environ.get("CISTEMATIC_TEMP") -else: - cisTemp = "/tmp" +configParser = getConfigParser() +cisTemp = getConfigOption(configParser, "general", "cistematic_temp", default="/tmp") tempfile.tempdir = cisTemp -print "version 3.3: %prog" +print "chkSNPrmask: version 3.4" def main(argv=None): @@ -24,10 +25,7 @@ def main(argv=None): usage = "usage: python %s dbfile snpsfile nr_snps_outfile [--cache numPages] [--repeats]" - parser = optparse.OptionParser(usage=usage) - parser.add_option("--repeats", action="store_true", dest="repeats") - parser.add_option("--cache", type="int", dest="cachePages") - parser.set_defaults(repeats=False, cachePages=None) + parser = makeParser(usage) (options, args) = parser.parse_args(argv[1:]) if len(args) < 3: @@ -41,6 +39,21 @@ def main(argv=None): chkSNPrmask(dbfile, filename, outfile, options.repeats, options.cachePages) +def makeParser(usage=""): + parser = optparse.OptionParser(usage=usage) + parser.add_option("--repeats", action="store_true", dest="repeats") + parser.add_option("--cache", type="int", dest="cachePages") + + configParser = getConfigParser() + section = "checkSNPrmask" + repeats = getConfigBoolOption(configParser, section, "repeats", False) + cachePages = getConfigOption(configParser, section, "cachePages", None) + + parser.set_defaults(repeats=repeats, cachePages=cachePages) + + return parser + + def chkSNPrmask(dbfile, filename, outfile, repeats=False, cachePages=None): print dbfile