예제 #1
0
파일: cli.py 프로젝트: kvarq/kvarq
def scan(args):

    testsuite_paths = discover_testsuites(args.testsuite_directory or [])
    if args.select_all:
        testsuites = load_testsuites(testsuite_paths, testsuite_paths.keys())
    else:
        testsuites = load_testsuites(testsuite_paths, args.select)

    if not testsuites:
        sys.stderr.write('\n*** you must specify at least one testsuite! ***\n\n')
        sys.stderr.write('(use the -t command line switch)\n\n')
        sys.exit(ERROR_COMMAND_LINE_SWITCH)

    # prepare scanning {{{2

    try:
        fastq = Fastq(args.fastq, paired=not args.no_paired, variant=args.variant)
    except FastqFileFormatException, e:
        lo.error('cannot open file %s : %s'%(args.fastq, str(e)))
        sys.exit(ERROR_FASTQ_FORMAT_ERROR)
예제 #2
0
파일: explorer.py 프로젝트: kvarq/kvarq
        def do_export():

            js = JsonSummary()

            for jpath in self.jpaths:

                if bj.canceled:
                    break

                bj.message = 'extracting from ' + os.path.basename(jpath)

                try:
                    js.add(jpath)
                    stats['n'] += 1
                except Exception as e:
                    lo.error('could not load %s : %s'%(jpath, e))
                    continue

            try:
                js.dump(file(fname, 'w'))
            except IOError as e:
                lo.error('could not write to file %s : %s' % (fname, e))
예제 #3
0
파일: cli.py 프로젝트: kvarq/kvarq
        sys.exit(ERROR_FASTQ_FORMAT_ERROR)

    engine.config(
            nthreads=args.threads,
            maxerrors=args.errors,
            Amin=fastq.Q2A(args.quality),
            Azero=fastq.Azero,
            minreadlength=args.readlength,
            minoverlap=args.overlap
        )

    analyser = analyse.Analyser()

    if not args.force:
        if os.path.exists(args.json):
            lo.error('will not overwrite file ' + args.json)
            sys.exit(ERROR_FILE_EXISTS)
        if args.extract_hits and os.path.exists(args.extract_hits):
            lo.error('will not overwrite file ' + args.extract_hits)
            sys.exit(ERROR_FILE_EXISTS)

    # do scanning {{{2

    mb = os.path.getsize(args.fastq) / 1024 / 1024
    lo.info('scanning {} ({})...'.format(
            ', '.join(fastq.filenames()),
            ', '.join(['%.2f MB' % (filesize/1024.**2) for filesize in fastq.filesizes()])
        ))
    t0 = time.time()

    class AnalyseThread(threading.Thread):