def test_fna(fnaconfig, executor):
    nprofile.plan(fnaconfig, executor)
    filename = fnaconfig[nprofile.OUTPUTKEY]
    assert filename
    p = py.path.local(filename)
    assert p.exists()
    # based on the default step:51, period:3 and the genome length of testgbk
    assert 59 == len(p.readlines())
def test_gbk(gbkconfig, executor):
    "Test that the enqueue runs and returns"
    nprofile.plan(gbkconfig, executor)
    filename = gbkconfig[nprofile.OUTPUTKEY]
    assert filename
    p = py.path.local(filename)
    assert p.exists()
    # based on the default step:51, period:3 and the genome length of testgbk
    assert 59 == len(p.readlines())
Ejemplo n.º 3
0
def allplots(config, executor):
    after = []
    try:
        after.extend(extract.plan(config, executor))
    except:
        pass
    after.extend(nprofile.plan(config, executor))
    after.extend(acgt_gamma.plan(config, executor))

    parsing.length(config)
    parsing.first_page_title(config)
    parsing.following_page_title(config)
    parsing.endBase(config)

    h = Hasher()
    # Strip down to the config for this task only
    rconfig = reducedict(config, KEYS + FILE_KEYS)

    basesPerGraph = rconfig['basesPerGraph']
    graphsPerPage = rconfig['graphsPerPage']
    startBase = rconfig.pop('startBase')
    endBase = rconfig.pop('endBase')
    bp_per_page = rconfig['bp_per_page'] = basesPerGraph * graphsPerPage
    page_count = math.ceil(float(endBase - startBase) / bp_per_page)
    log.info("Generating %d pages of allplots", page_count)
    page_num = 1  # page number offset
    filenames = []
    waiton = []
    # per-page loop
    while startBase < endBase:
        pconfig = dict(rconfig.items())
        pconfig['page_num'] = page_num
        pconfig['startBase'] = startBase
        if startBase + bp_per_page < endBase:
            pconfig['endBase'] = startBase + bp_per_page
        else:
            pconfig['endBase'] = endBase
        h = Hasher().hashdict(pconfig).hashfiletime(BIN).hashfiletime(__file__)
        psname = parsing.derive_filename(config, h.hexdigest(), 'ps')
        filenames.append(psname)
        waiton.extend(enqueue(_ap, executor, pconfig, psname, after=after))
        page_num += 1
        startBase += bp_per_page

    # Finally set the output filenames into the master config dict
    config['psnames'] = filenames
    return waiton