Esempio n. 1
0
	)
	
	# if no arguments, print usage and exit
	if len(sys.argv) < 2:
		print version
		print
		parser.print_usage()
		print
		print "Use -h for details."
		sys.exit(2)
	
	# parse arguments
	args = parser.parse_args()
		
	# instantiate database and load knowledge file, if any
	db = loki_db.Database(testing=args.test_data, updating=((args.update != None) or (args.update_except != None)))
	db.setVerbose(args.verbose)
	db.attachDatabaseFile(args.knowledge)
	
	# list sources?
	if args.list_sources != None:
		srcSet = set()
		for srcList in args.list_sources:
			srcSet |= set(srcList)
		if (not srcSet) or ('+' in srcSet):
			print "available source loaders:"
			srcSet = set()
		else:
			print "source loader options:"
		moduleVersions = db.getSourceModuleVersions(srcSet)
		moduleOptions = db.getSourceModuleOptions(srcSet)
Esempio n. 2
0
        if mapped_size / float(region[1] - region[0]) >= self._minFrac:
            mapped_reg = (first_seg[5], new_start, new_end)

        return mapped_reg


if __name__ == "__main__":
    from loki import loki_db

    if len(sys.argv) < 5:
        print "usage: %s <input> <lokidb> <output> <unmap> [oldhg=19] [newhg=38]" % (
            sys.argv[0], )
        sys.exit(2)

    db = loki_db.Database(sys.argv[2])

    old = int(sys.argv[5]) if (len(sys.argv) > 5) else 19
    new = int(sys.argv[6]) if (len(sys.argv) > 6) else 38
    #lo = liftOver(db, old, new, False)
    f = (sys.stdin if (sys.argv[1] == '-') else file(sys.argv[1], 'r'))
    m = (sys.stdout if (sys.argv[3] == '-') else file(sys.argv[3], 'w'))
    u = (sys.stderr if (sys.argv[4] == '-') else file(sys.argv[4], 'w'))

    def generateInputs(f):
        for l in f:
            wds = l.split()
            if wds[0].lower().startswith('chr'):
                wds[0] = wds[0][3:]
            yield (l.strip().replace(" ", ":").replace("\t", ":"),
                   db.chr_num.get(wds[0], -1), int(wds[1]), int(wds[2]), None)
Esempio n. 3
0
#		if m < 1024*1024*1024:
#			print "WARNING: ignoring '%s' memory allotment, the updater requires ~1gb at minimum" % args.memory
#		else:
#			print "using ~%1.1fMB of memory" % (m / (1024 * 1024))
#			memLimit = max(memLimit, m - 1024*1024*1024)
#	#if args.memory
	
	# set $TMPDIR so sqlite will use it for vacuum etc.
	if args.temp_directory:
		if not os.path.isdir(args.temp_directory):
			print "ERROR: '%s' is not a directory"
			sys.exit(1)
		os.environ['TMPDIR'] = os.path.abspath(args.temp_directory)
	
	# instantiate database object
	db = loki_db.Database(testing=args.test_data, updating=True)
	db.setVerbose(args.verbose)
	db.attachDatabaseFile(args.knowledge)
	
	# list sources?
	if args.list_sources != None:
		srcSet = set()
		for srcList in args.list_sources:
			srcSet |= set(srcList)
		if (not srcSet) or ('+' in srcSet):
			print "available source loaders:"
			srcSet = set()
		else:
			print "source loader options:"
		moduleVersions = db.getSourceModuleVersions(srcSet)
		moduleOptions = db.getSourceModuleOptions(srcSet)
Esempio n. 4
0
    #			print "WARNING: ignoring '%s' memory allotment, the updater requires ~1gb at minimum" % args.memory
    #		else:
    #			print "using ~%1.1fMB of memory" % (m / (1024 * 1024))
    #			memLimit = max(memLimit, m - 1024*1024*1024)
    #	#if args.memory

    # set $TMPDIR so sqlite will use it for vacuum etc.
    if args.temp_directory:
        if not os.path.isdir(args.temp_directory):
            print "ERROR: '%s' is not a directory"
            sys.exit(1)
        os.environ['TMPDIR'] = os.path.abspath(args.temp_directory)

    # instantiate database object
    db = loki_db.Database(testing=args.test_data,
                          updating=True,
                          taxID=args.taxonomy_id)
    db.setVerbose(args.verbose or (not args.quiet))

    # list sources?
    if args.list_sources != None:
        srcSet = set()
        for srcList in args.list_sources:
            srcSet |= set(srcList)
        if (not srcSet) or ('+' in srcSet):
            print "available source loaders, versions, supported species and options:"
            srcSet = set()
        else:
            print "source loader versions, supported species and options:"
        moduleVersions = db.getSourceModuleVersions(srcSet)
        moduleSpecies = db.getSourceModuleSpecies(srcSet)