Ejemplo n.º 1
0
def test_bowtie2_build_exec_notexist():
    """Error thrown if bowtie_build executable does not exist"""
    try:
        obj = bowtie_build.Bowtie2_Build(os.path.join(".", "bowtie2-build"))
    except NotExecutableError:
        return True
    else:
        return False
Ejemplo n.º 2
0
def test_bowtie2_build_notexec():
    """Error thrown if bowtie2-build not executable"""
    try:
        obj = bowtie_build.Bowtie2_Build("LICENSE")
    except NotExecutableError:
        return True
    else:
        return False
def test_bowtie_index_exec():
    """Run bowtie_index on test FQ data and compare output
    to precomputed target"""
    obj = bowtie_build.Bowtie2_Build("bowtie2-build")
    result = obj.run(DATABASE, FA_INDEX)
    # test to see if it has produced the bai file.
    if not os.path.isfile(result.index + "1"):
        return False
Ejemplo n.º 4
0
def test_bowtie2_build_cmd():
    """bowtie2-build returns correct form of cmd-line"""
    bowtie2_idx = bowtie_build.Bowtie2_Build("bowtie2-build")
    target = ' '.join(["bowtie2-build",
                       "--quiet",
                       "-f",
                       DATABASE,
                       FA_INDEX])
    result = bowtie2_idx.run(DATABASE, FA_INDEX, dry_run=True)
    assert_equal(result.command, target)
def test_bowtie_index_cmd():
    """bowtie2 instantiates, runs and returns correct form of cmd-line"""
    obj = bowtie_build.Bowtie2_Build("bowtie2-build")
    target = ' '.join(["bowtie2-build",
                       "--quiet",
                       "-f",
                       DATABASE,
                       FA_INDEX])
    assert_equal(obj.run(DATABASE, FA_INDEX, dry_run=True),
                 target)
Ejemplo n.º 6
0
def test_bowtie2_build_exec():
    """bowtie2-build indexes the file correctly"""
    bowtie2_idx = bowtie_build.Bowtie2_Build("bowtie2-build")
    result = bowtie2_idx.run(DATABASE, FA_INDEX)
    # Test for equality of output and target MD5 hashes
    for fname in os.listdir(OUTDIR):
        with open(os.path.join(OUTDIR, fname), "rb") as outfh:
            outhash = hashlib.md5()
            outhash.update(outfh.read())
        with open(os.path.join(TARGETDIR, fname), "rb") as tgtfh:
            tgthash = hashlib.md5()
            tgthash.update(tgtfh.read())
        assert_equal(tgthash.digest(), outhash.digest())
Ejemplo n.º 7
0
def test_bowtie2_build_path():
    """bowtie2-build executable is in $PATH"""
    bowtie_build.Bowtie2_Build("bowtie2-build")
def test_bowtie():
    """bowtie_index instantiates with cmd-line if bowtie is in $PATH"""
    bowtie_build.Bowtie2_Build("bowtie2-build")