Example #1
0
File: needswx.py Project: kk7nc/NGS
    def __init__(self, *args, **kwargs):
        if wx.GetApp() is None:
            self.app = wx.App(False)

        self.args = False
        if kwargs.has_key('args'):
            self.args = kwargs['args']
            del kwargs['args']

        dotfile = None
        if 'dotfile' in kwargs:
            dotfile = kwargs['dotfile']
            del kwargs['dotfile']

        OptionParser.__init__(self, *args, **kwargs)

        self.dotfile = self.find_dotfile(dotfile)
Example #2
0
    def __init__( self, *args, **kwargs ):
        if wx.GetApp() is None:
            self.app = wx.App( False )

        self.args = False
        if kwargs.has_key('args'):
            self.args = kwargs['args']
            del kwargs['args']

	dotfile = None
        if 'dotfile' in kwargs:
	    dotfile = kwargs['dotfile']
	    del kwargs['dotfile']

        OptionParser.__init__( self, *args, **kwargs )

	self.dotfile = self.find_dotfile(dotfile)
Example #3
0
from collections import defaultdict

from version import VERSION

VERSION = '%s' % (VERSION, )

from os.path import join, dirname, realpath, split
try:
    scriptdir = dirname(realpath(__file__))
except NameError:
    scriptdir = dirname(realpath(sys.argv[0]))
sys.path.append(join(scriptdir, '..', '..', 'common', 'src'))

from optparse_gui import OptionParser, OptionGroup, ProgressText

parser = OptionParser(version=VERSION)
regexs = OptionGroup(parser, "Filename Matching")

parser.add_option("--counts",
                  type="file",
                  dest="counts",
                  default=None,
                  help="Output file from readCounts. Required.",
                  notNone=True,
                  filetypes=[("readCount Output", "*.tsv")])
parser.add_option("--cosmic",
                  type="file",
                  dest="cosmic",
                  default=None,
                  help="COSMIC Mutants.",
                  filetypes=[("COSMIC Annotations", "*.tsv;*.tsv.gz")])
Example #4
0
        shutil.rmtree(d, ignore_errors=True)


atexit.register(cleanup)

if not GUI() and len(sys.argv) == 2 and sys.argv[1] == '--GUI':
    from optparse_gui.needswx import *
    sys.exit(1)

if GUI() and len(sys.argv) == 1:
    from optparse_gui import OptionParserGUI
    parser = OptionParserGUI(version=VERSION)
    error_kwargs = {'exit': False}
    sys.excepthook = excepthook
else:
    parser = OptionParser(version=VERSION)
    error_kwargs = {}

advanced = OptionGroup(parser, "Advanced")
parser.add_option("-s",
                  "--snvs",
                  type="files",
                  dest="snvs",
                  default=None,
                  help="Single-Nucleotide-Variant files. Required.",
                  name="SNV Files",
                  notNone=True,
                  remember=True,
                  filetypes=[("SNV Files",
                              "*.vcf;*.csv;*.tsv;*.xls;*.xlsx;*.txt")])
parser.add_option("-r",
Example #5
0
	def parseParams(self):
		'''
		Use OptionParser to get parameters
		'''
		global check_interval
		if len(sys.argv) == 1 and self.is_win32:
			try:
				from optparse_gui import OptionParser
				use_gui = True
			except:
				raw_input('Need opparse_gui to enter options on Windows')
				sys.exit()
		else:
			from optparse import OptionParser
			use_gui = False

		parser = OptionParser()

		# options
		parser.add_option("--method", dest="method",
			help="method to transfer, e.g. --method=mv", type="choice", choices=['mv','rsync'], default='rsync' if sys.platform != 'win32' else "mv")
		parser.add_option("--source_path", dest="source_path",
			help="Mounted parent path to transfer, e.g. --source_path=/mnt/ddframes", metavar="PATH")
		parser.add_option("--camera_host", dest="camera_host",
			help="Camera computer hostname in leginondb, e.g. --camera_host=gatank2")
		parser.add_option("--destination_head", dest="dest_path_head",
			help="Specific head destination frame path to transfer if multiple frame transfer is run for one source to frame paths not all mounted on the same computer, e.g. --destination_head=/data1", metavar="PATH", default='')
		parser.add_option("--check_interval", dest="check_interval", help="Seconds between checking for new frames", type="int", default=check_interval)

		# parsing options
		(options, optargs) = parser.parse_args(sys.argv[1:])
		if len(optargs) > 0:
			print "Unknown commandline options: "+str(optargs)
		if not use_gui and len(sys.argv) < 2:
			parser.print_help()
			sys.exit()
		params = {}
		for i in parser.option_list:
			if isinstance(i.dest, str):
				params[i.dest] = getattr(options, i.dest)
		self.checkOptionConflicts(params)
		# set global variable check_interval
		check_interval = options.check_interval
		return params
Example #6
0
import operator

from os.path import join, dirname, realpath, split
try:
    scriptdir = dirname(realpath(__file__))
except NameError:
    scriptdir = dirname(realpath(sys.argv[0]))
sys.path.append(join(scriptdir, '..', '..', 'common', 'src'))

from version import VERSION

VERSION = '1.0.4 (%s)' % (VERSION, )

from optparse_gui import OptionParser

parser = OptionParser(version=VERSION)

parser.add_option("--exons",
                  type="file",
                  dest="exons",
                  default=None,
                  help="Exonic coordinates (sored). Required.",
                  notNone=True,
                  filetypes=[("Exonic Coordinates", "*.txt")])
parser.add_option("--input",
                  type="file",
                  dest="input",
                  default=None,
                  help="Input SNVs. Required",
                  filetypes=[("Input SNV File",
                              "*.vcf;*.csv;*.tsv;*.xls;*.xlsx;*.txt")])
Example #7
0
import gzip
import re
from collections import defaultdict

from version import VERSION
VERSION = '1.0.6 (%s)' % (VERSION,)

from os.path import join, dirname, realpath, split
try:
    scriptdir = dirname(realpath(__file__))
except NameError:
    scriptdir = dirname(realpath(sys.argv[0]))
sys.path.append(join(scriptdir, '..', '..', 'common', 'src'))

from optparse_gui import OptionParser, OptionGroup, ProgressText
parser = OptionParser(version=VERSION)
regexs = OptionGroup(parser, "Filename Matching")

parser.add_option("--counts", type="file", dest="counts", default=None,
                  help="Output file from readCounts. Required.", notNone=True,
                  filetypes=[("readCount Output", "*.tsv")])
parser.add_option("--cosmic", type="file", dest="cosmic", default=None,
                  help="COSMIC Mutants.",
                  filetypes=[("COSMIC Annotations", "*.tsv;*.tsv.gz")])
parser.add_option("--darned", type="file", dest="darned", default=None,
                  help="DARNED annotations.",
                  filetypes=[("DARNED Annotations", "*.txt")])
regexs.add_option("--normaldnare", type="str", dest="normaldnare", default=r'GDNA',
                  help="Germline/Normal DNA filename regular expression. Default: GDNA.",
                  remember=True, name="Germline DNA RE")
regexs.add_option("--normaltransre", type="str", dest="normaltransre", default=r'NRNA',