def test_muscle_exec():
    """muscle aligns test data"""
    muscle_aln = muscle.Muscle("muscle")
    result = muscle_aln.run(INFILE, OUTFILE)
    with open(TARGET, "r") as target_fh:
        with open(result.outfile, "r") as test_fh:
            assert_equal(target_fh.read(), test_fh.read())
Пример #2
0
def create_interfaces(args, logger):
    """Check third-party executable dependencies exist and instantiate.

    The instantiated interfaces are returned.
    """
    # Check for presence of third-party tools, by instantiating interfaces
    logger.info("Checking third-party packages:")
    logger.info("\tFastQC... (%s)", args.fastqc)
    fastqc_qc = fastqc.FastQC(args.fastqc)
    logger.info("\ttrim_quality... (%s)", args.trim_quality)
    trim_quality = seq_crumbs.Trim_Quality(args.trim_quality, logger)
    logger.info("\tjoin_paired_ends.py... (%s)", args.join_paired_ends)
    jpe = qiime.Join_Paired_Ends(args.join_paired_ends, logger)
    logger.info("\tconvert_format... (%s)", args.convert_format)
    convert_format = seq_crumbs.Convert_Format(args.convert_format, logger)
    logger.info("\tblastclust... (%s)", args.blastclust)
    blastclust = blast.Blastclust(args.blastclust)
    logger.info("\tmuscle... (%s)", args.muscle)
    muscle_aln = muscle.Muscle(args.muscle)
    logger.info("\tpick_otus.py... (%s)", args.pick_otus)
    pick_otus = qiime.Pick_Otus(args.pick_otus, logger)
    logger.info("\tpick_closed_reference_otus.py... (%s)",
                args.pick_closed_reference_otus)
    pcro = qiime.Pick_Closed_Ref_Otus(args.pick_closed_reference_otus, logger)
    return (fastqc_qc, trim_quality, jpe, convert_format, blastclust,
            muscle_aln, pick_otus, pcro)
def test_muscle_cmd():
    """muscle instantiates, runs and returns correct form of cmd-line"""
    obj = muscle.Muscle("muscle")
    target = ' '.join(
        ["muscle", "-in", FASTA, "-out", (os.path.join(OUTFOLDER, OUTFILE))])
    qc = obj.run(FASTA, OUTFILE, OUTFOLDER)
    assert_equal(qc.command, target)
def test_muscle_notexec():
    """Error thrown if muscle exe not executable"""
    try:
        obj = muscle.Muscle("LICENSE")
    except NotExecutableError:
        return True
    else:
        return False
def test_muscle_exec_notexist():
    """Error thrown if muscle executable does not exist"""
    try:
        obj = muscle.Muscle(os.path.join(".", "muscle"))
    except NotExecutableError:
        return True
    else:
        return False
def test_muscle_exec():
    """Run muscle on test data and compare output to precomputed target"""
    obj = muscle.Muscle("muscle")
    try:
        shutil.rmtree(OUTFILE)
    except FileNotFoundError:
        pass
    os.makedirs(OUTFILE, exist_ok=True)
    result = obj.run(FASTA, OUTFILE, OUTFOLDER)
    with open(TARGET, "r") as target_fh:
        with open(result.muscle_outfile, "r") as test_fh:
            assert_equal(target_fh.read(), test_fh.read())
Пример #7
0
def check_tools_exist(WARNINGS):
    """function to check to see what tools are in the PATH,
    decide what we can use
    Returns a list of programs that were exectable and a warning string.
    The warnings are tools that were not executable"""
    tools_list = []
    Warning_out = WARNINGS + "Tool executable warning: "

    try:
        trimmomatic.Trimmomatic(args.trimmomatic)
        tools_list.append("trimmomatic")
    except ValueError:
        Warning_out = Warning_out + "trimmomatic not in path\n"

    try:
        muscle.Muscle(args.muscle)
        tools_list.append("muscle")
    except ValueError:
        Warning_out = Warning_out + "muscle not in path\n"
    return tools_list, Warning_out
def test_muscle():
    """muscle instantiates with cmd-line if muscle is in $PATH"""
    muscle.Muscle("muscle")
Пример #9
0
            sys.exit(1)

    # Check for presence of third-party tools, by instantiating interfaces
    logger.info("Checking third-party packages:")
    logger.info("\tFastQC... (%s)" % args.fastqc)
    fastQC = fastqc.FastQC(args.fastqc, logger)
    logger.info("\ttrim_quality... (%s)" % args.trim_quality)
    trim_quality = seq_crumbs.Trim_Quality(args.trim_quality, logger)
    logger.info("\tjoin_paired_ends.py... (%s)" % args.join_paired_ends)
    jpe = qiime.Join_Paired_Ends(args.join_paired_ends, logger)
    logger.info("\tconvert_format... (%s)" % args.convert_format)
    convert_format = seq_crumbs.Convert_Format(args.convert_format, logger)
    logger.info("\tblastclust... (%s)" % args.blastclust)
    blastclust = blast.Blastclust(args.blastclust)
    logger.info("\tmuscle... (%s)" % args.muscle)
    muscle = muscle.Muscle(args.muscle, logger)
    logger.info("\tpick_otus.py... (%s)" % args.pick_otus)
    pick_otus = qiime.Pick_Otus(args.pick_otus, logger)
    logger.info("\tpick_closed_reference_otus.py... (%s)" %
                args.pick_closed_reference_otus)
    pcro = qiime.Pick_Closed_Ref_Otus(args.pick_closed_reference_otus, logger)

    # How many threads are we using?
    args.threads = min(args.threads, multiprocessing.cpu_count())
    logger.info("Using %d threads/CPUs where available" % args.threads)

    # Trim reads on quality - forward and reverse reads
    logger.info("Trim reads by quality")
    try:
        trimmed_fnames = [
            trim_quality.run(fname, args.outdirname) for fname in infilenames
def test_muscle_cmd():
    """muscle wrapper returns correct form of cmd-line"""
    muscle_aln = muscle.Muscle("muscle")
    muscle_result = muscle_aln.run(INFILE, OUTFILE, dry_run=True)
    target = ' '.join(['muscle', '-in', INFILE, '-out', OUTFILE])
    assert_equal(muscle_result.command, target)
def test_muscle_path():
    """muscle executable is in $PATH"""
    muscle_aln = muscle.Muscle("muscle")