当前位置: 首页>>代码示例>>Python>>正文


Python AtomicCmdBuilder.set_option方法代码示例

本文整理汇总了Python中pypeline.atomiccmd.builder.AtomicCmdBuilder.set_option方法的典型用法代码示例。如果您正苦于以下问题:Python AtomicCmdBuilder.set_option方法的具体用法?Python AtomicCmdBuilder.set_option怎么用?Python AtomicCmdBuilder.set_option使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在pypeline.atomiccmd.builder.AtomicCmdBuilder的用法示例。


在下文中一共展示了AtomicCmdBuilder.set_option方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: _get_common_parameters

# 需要导入模块: from pypeline.atomiccmd.builder import AtomicCmdBuilder [as 别名]
# 或者: from pypeline.atomiccmd.builder.AtomicCmdBuilder import set_option [as 别名]
def _get_common_parameters(version):
    global _DEPRECATION_WARNING_PRINTED

    if version == VERSION_14:
        version_check = _VERSION_14_CHECK
    elif version == VERSION_15:
        version_check = _VERSION_15_CHECK
    else:
        raise CmdError("Unknown version: %s" % version)

    cmd = AtomicCmdBuilder("AdapterRemoval",
                           CHECK_VERSION=version_check)

    # Trim Ns at read ends
    cmd.set_option("--trimns", fixed=False)
    # Trim low quality scores
    cmd.set_option("--trimqualities", fixed=False)

    try:
        if not _DEPRECATION_WARNING_PRINTED and version_check.version < (2, 0):
            import pypeline.ui as ui
            ui.print_warn("\nWARNING: AdapterRemoval v1.5.x is deprecated;")
            ui.print_warn("         Upgrading to 2.1.x is strongly adviced!\n")
            ui.print_warn("         Download the newest version of AdapterRemoval at ")
            ui.print_warn("         https://github.com/MikkelSchubert/adapterremoval\n")

            _DEPRECATION_WARNING_PRINTED = True
    except versions.VersionRequirementError:
        pass

    return cmd
开发者ID:UMNPonyClub,项目名称:paleomix,代码行数:33,代码来源:adapterremoval.py

示例2: customize

# 需要导入模块: from pypeline.atomiccmd.builder import AtomicCmdBuilder [as 别名]
# 或者: from pypeline.atomiccmd.builder.AtomicCmdBuilder import set_option [as 别名]
    def customize(cls, input_alignment, input_partition, output_alignment, output_partition, dependencies = ()):
        command = AtomicCmdBuilder("raxmlHPC")

        # Read and (in the case of empty columns) reduce input
        command.set_option("-f", "c")
        # Output files are saved with a .Pypeline postfix, and subsequently renamed
        command.set_option("-n", "Pypeline")
        # Model required, but not used
        command.set_option("-m", "GTRGAMMA")
        # Ensures that output is saved to the temporary directory
        command.set_option("-w", "%(TEMP_DIR)s")

        # Symlink to sequence and partitions, to prevent the creation of *.reduced files outside temp folder
        # In addition, it may be nessesary to remove the .reduced files if created
        command.set_option("-s", "%(TEMP_IN_ALIGNMENT)s")
        command.set_option("-q", "%(TEMP_IN_PARTITION)s")

        command.set_kwargs(IN_ALIGNMENT      = input_alignment,
                          IN_PARTITION      = input_partition,

                          TEMP_IN_ALIGNMENT = "RAxML_alignment",
                          TEMP_IN_PARTITION = "RAxML_partitions",
                          TEMP_OUT_INFO     = "RAxML_info.Pypeline",

                          OUT_ALIGNMENT     = output_alignment,
                          OUT_PARTITION     = output_partition,
                          CHECK_VERSION     = RAXML_VERSION)

        return {"command" : command}
开发者ID:CarlesV,项目名称:paleomix,代码行数:31,代码来源:raxml.py

示例3: customize

# 需要导入模块: from pypeline.atomiccmd.builder import AtomicCmdBuilder [as 别名]
# 或者: from pypeline.atomiccmd.builder.AtomicCmdBuilder import set_option [as 别名]
    def customize(cls, infile, intervals, outfile, dependencies = ()):
        params = AtomicCmdBuilder(["bam_sample_regions"],
                                  IN_PILEUP    = infile,
                                  IN_INTERVALS = intervals,
                                  OUT_STDOUT   = outfile)
        params.set_option("--genotype", "%(IN_PILEUP)s")
        params.set_option("--intervals", "%(IN_INTERVALS)s")

        return {"command" : params}
开发者ID:schae234,项目名称:pypeline,代码行数:11,代码来源:genotype.py

示例4: customize

# 需要导入模块: from pypeline.atomiccmd.builder import AtomicCmdBuilder [as 别名]
# 或者: from pypeline.atomiccmd.builder.AtomicCmdBuilder import set_option [as 别名]
    def customize(cls, input_alignment, input_partition, output_file, dependencies = ()):
        """
        Arguments:
        input_alignment  -- An alignment file in a format readable by RAxML.
        input_partition  -- A set of partitions in a format readable by RAxML.
        output_filename  -- Filename for the output binary sequence."""

        command = AtomicCmdBuilder("examlParser", set_cwd = True)

        command.set_option("-s", "%(TEMP_OUT_ALN)s")
        command.set_option("-q", "%(TEMP_OUT_PART)s")
        # Output file will be named output.binary, and placed in the CWD
        command.set_option("-n", "output")

        # Substitution model
        command.set_option("-m", "DNA", fixed = False)


        command.set_kwargs(# Auto-delete: Symlinks
                          TEMP_OUT_PART   = os.path.basename(input_partition),
                          TEMP_OUT_ALN    = os.path.basename(input_alignment),

                          # Input files, are not used directly (see below)
                          IN_ALIGNMENT    = input_alignment,
                          IN_PARTITION    = input_partition,

                          # Final output file, are not created directly
                          OUT_BINARY      = output_file,

                          CHECK_EXAML     = PARSER_VERSION)

        return {"command" : command}
开发者ID:health1987,项目名称:paleomix,代码行数:34,代码来源:examl.py

示例5: _get_common_parameters

# 需要导入模块: from pypeline.atomiccmd.builder import AtomicCmdBuilder [as 别名]
# 或者: from pypeline.atomiccmd.builder.AtomicCmdBuilder import set_option [as 别名]
def _get_common_parameters(version):
    if version == VERSION_14:
        version_check = _VERSION_14_CHECK
    elif version == VERSION_15:
        version_check = _VERSION_15_CHECK
    else:
        raise CmdError("Unknown version: %s" % version)

    cmd = AtomicCmdBuilder("AdapterRemoval",
                           CHECK_VERSION=version_check)

    # Trim Ns at read ends
    cmd.set_option("--trimns", fixed=False)
    # Trim low quality scores
    cmd.set_option("--trimqualities", fixed=False)

    return cmd
开发者ID:CarlesV,项目名称:paleomix,代码行数:19,代码来源:adapterremoval.py

示例6: __init__

# 需要导入模块: from pypeline.atomiccmd.builder import AtomicCmdBuilder [as 别名]
# 或者: from pypeline.atomiccmd.builder.AtomicCmdBuilder import set_option [as 别名]
    def __init__(self, config, reference, input_bam, output_bam, tags,
                 min_mapq=0, filter_unmapped=False, dependencies=()):
        flt_params = AtomicCmdBuilder(("samtools", "view", "-bu"),
                                      IN_BAM=input_bam,
                                      OUT_STDOUT=AtomicCmd.PIPE)

        if min_mapq:
            flt_params.set_option("-q", min_mapq, sep="")
        if filter_unmapped:
            flt_params.set_option("-F", "0x4", sep="")

        flt_params.add_value("%(IN_BAM)s")

        jar_params = picard.picard_command(config, "AddOrReplaceReadGroups")
        jar_params.set_option("INPUT", "/dev/stdin", sep="=")
        # Output is written to a named pipe, since the JVM may, in some cases,
        # emit warning messages to stdout, resulting in a malformed BAM.
        jar_params.set_option("OUTPUT", "%(TEMP_OUT_BAM)s", sep="=")
        jar_params.set_option("COMPRESSION_LEVEL", "0", sep="=")
        # Ensure that the BAM is sorted; this is required by the pipeline, and
        # needs to be done before calling calmd (avoiding pathologic runtimes).
        jar_params.set_option("SORT_ORDER", "coordinate", sep="=")

        # All tags are overwritten; ID is set since the default (e.g. '1')
        # causes problems with pysam due to type inference (is read as a length
        # 1 string, but written as a character).
        for tag in ("ID", "SM", "LB", "PU", "PL"):
            jar_params.set_option(tag, tags[tag], sep="=")

        jar_params.set_kwargs(IN_STDIN=flt_params,
                              TEMP_OUT_BAM="bam.pipe")

        calmd = AtomicCmdBuilder(["samtools", "calmd", "-b",
                                 "%(TEMP_IN_BAM)s", "%(IN_REF)s"],
                                 IN_REF=reference,
                                 TEMP_IN_BAM="bam.pipe",
                                 OUT_STDOUT=output_bam)

        commands = [cmd.finalize() for cmd in (flt_params, jar_params, calmd)]
        description = "<Cleanup BAM: %s -> '%s'>" \
            % (input_bam, output_bam)
        PicardNode.__init__(self,
                            command=ParallelCmds(commands),
                            description=description,
                            dependencies=dependencies)
开发者ID:UMNPonyClub,项目名称:paleomix,代码行数:47,代码来源:nodes.py

示例7: customize

# 需要导入模块: from pypeline.atomiccmd.builder import AtomicCmdBuilder [as 别名]
# 或者: from pypeline.atomiccmd.builder.AtomicCmdBuilder import set_option [as 别名]
    def customize(cls, reference, infile, outfile, regions = None, dependencies = ()):
        assert outfile.lower().endswith(".vcf.bgz")

        pileup = AtomicCmdBuilder(["samtools", "mpileup"],
                              IN_REFERENCE = reference,
                              IN_BAMFILE   = infile,
                              IN_REGIONS   = regions,
                              OUT_STDOUT   = AtomicCmd.PIPE,
                              CHECK_SAM    = SAMTOOLS_VERSION)
        pileup.set_option("-u") # Uncompressed output
        pileup.set_option("-f", "%(IN_REFERENCE)s")
        pileup.add_value("%(IN_BAMFILE)s")

        if regions:
            pileup.set_option("-l", "%(IN_REGIONS)s")

        genotype = AtomicCmdBuilder(["bcftools", "view"],
                                IN_STDIN     = pileup,
                                OUT_STDOUT   = AtomicCmd.PIPE)
        genotype.add_value("-")

        bgzip    = AtomicCmdBuilder(["bgzip"],
                                IN_STDIN     = genotype,
                                OUT_STDOUT   = outfile)

        return {"commands" : {"pileup"   : pileup,
                              "genotype" : genotype,
                              "bgzip"    : bgzip}}
开发者ID:schae234,项目名称:pypeline,代码行数:30,代码来源:samtools.py

示例8: _get_common_parameters

# 需要导入模块: from pypeline.atomiccmd.builder import AtomicCmdBuilder [as 别名]
# 或者: from pypeline.atomiccmd.builder.AtomicCmdBuilder import set_option [as 别名]
def _get_common_parameters(version):
    if version == VERSION_14:
        version_check = _VERSION_14_CHECK
    elif version == VERSION_15:
        version_check = _VERSION_15_CHECK
    else:
        raise CmdError("Unknown version: %s" % version)

    cmd = AtomicCmdBuilder("AdapterRemoval",
                           CHECK_VERSION = version_check)

    # Allow 1/3 mismatches in the aligned region
    cmd.set_option("--mm", 3, fixed = False)
    # Minimum length of trimmed reads
    cmd.set_option("--minlength", 25, fixed = False)
    # Trim Ns at read ends
    cmd.set_option("--trimns", fixed = False)
    # Trim low quality scores
    cmd.set_option("--trimqualities", fixed = False)
    # Offset of quality scores
    cmd.set_option("--qualitybase", 33, fixed = False)

    return cmd
开发者ID:schae234,项目名称:pypeline,代码行数:25,代码来源:adapterremoval.py

示例9: _process_output

# 需要导入模块: from pypeline.atomiccmd.builder import AtomicCmdBuilder [as 别名]
# 或者: from pypeline.atomiccmd.builder.AtomicCmdBuilder import set_option [as 别名]
def _process_output(stdin, output_file, reference, run_fixmate = False):
    convert = AtomicCmdBuilder("safeSAM2BAM")
    convert.set_option("--flag-as-sorted")
    convert.set_option("-F", "0x4", sep = "", fixed = False) # Remove misses
    convert.set_kwargs(IN_STDIN    = stdin,
                      OUT_STDOUT  = AtomicCmd.PIPE,
                      CHECK_PYSAM = PYSAM_VERSION,
                      CHECK_SAMTOOLS = SAMTOOLS_VERSION)

    fixmate = None
    if run_fixmate:
        fixmate = AtomicCmdBuilder(("samtools", "fixmate", "-", "-"),
                               IN_STDIN   = convert,
                               OUT_STDOUT = AtomicCmd.PIPE,
                               CHECK_SAMTOOLS = SAMTOOLS_VERSION)

    sort = AtomicCmdBuilder(("samtools", "sort"))
    sort.set_option("-o") # Output to STDOUT on completion
    sort.add_value("-")
    sort.add_value("%(TEMP_OUT_BAM)s")
    sort.set_kwargs(IN_STDIN     = fixmate or convert,
                   OUT_STDOUT   = AtomicCmd.PIPE,
                   TEMP_OUT_BAM = "sorted",
                   CHECK_SAM = SAMTOOLS_VERSION)

    calmd = AtomicCmdBuilder(("samtools", "calmd"))
    calmd.add_value("-")
    calmd.add_value("%(IN_REF)s")
    calmd.set_option("-b") # Output BAM
    calmd.set_kwargs(IN_REF   = reference,
                    IN_STDIN = sort,
                    OUT_STDOUT = output_file,
                    CHECK_SAM = SAMTOOLS_VERSION)

    order = ["convert", "sort", "calmd"]
    commands = {"convert" : convert,
                "sort"    : sort,
                "calmd"   : calmd}

    if run_fixmate:
        order.insert(1, "fixmate")
        commands["fixmate"] = fixmate

    return order, commands
开发者ID:schae234,项目名称:pypeline,代码行数:46,代码来源:bwa.py

示例10: test_builder__set_option__overwrite_fixed

# 需要导入模块: from pypeline.atomiccmd.builder import AtomicCmdBuilder [as 别名]
# 或者: from pypeline.atomiccmd.builder.AtomicCmdBuilder import set_option [as 别名]
def test_builder__set_option__overwrite_fixed():
    builder = AtomicCmdBuilder("find")
    builder.set_option("-name", "*.txt")
    assert_raises(AtomicCmdBuilderError, builder.set_option, "-name", "*.bat")
开发者ID:CarlesV,项目名称:paleomix,代码行数:6,代码来源:builder_test.py

示例11: test_builder__set_option__overwrite

# 需要导入模块: from pypeline.atomiccmd.builder import AtomicCmdBuilder [as 别名]
# 或者: from pypeline.atomiccmd.builder.AtomicCmdBuilder import set_option [as 别名]
def test_builder__set_option__overwrite():
    builder = AtomicCmdBuilder("find")
    builder.set_option("-name", "*.txt", fixed = False)
    builder.set_option("-name", "*.bat")
    assert_equal(builder.call, ["find", "-name", "*.bat"])
开发者ID:CarlesV,项目名称:paleomix,代码行数:7,代码来源:builder_test.py

示例12: test_builder__set_option

# 需要导入模块: from pypeline.atomiccmd.builder import AtomicCmdBuilder [as 别名]
# 或者: from pypeline.atomiccmd.builder.AtomicCmdBuilder import set_option [as 别名]
def test_builder__set_option():
    builder = AtomicCmdBuilder("find")
    builder.set_option("-name", "*.txt")
    assert_equal(builder.call, ["find", "-name", "*.txt"])
开发者ID:CarlesV,项目名称:paleomix,代码行数:6,代码来源:builder_test.py

示例13: test_builder__pop_option__missing_key

# 需要导入模块: from pypeline.atomiccmd.builder import AtomicCmdBuilder [as 别名]
# 或者: from pypeline.atomiccmd.builder.AtomicCmdBuilder import set_option [as 别名]
def test_builder__pop_option__missing_key():
    builder = AtomicCmdBuilder("find")
    builder.set_option("-size", 0)
    assert_raises(KeyError, builder.pop_option, "-isize")
开发者ID:CarlesV,项目名称:paleomix,代码行数:6,代码来源:builder_test.py

示例14: customize

# 需要导入模块: from pypeline.atomiccmd.builder import AtomicCmdBuilder [as 别名]
# 或者: from pypeline.atomiccmd.builder.AtomicCmdBuilder import set_option [as 别名]
    def customize(self, reference='', sra_infile='', wdir = '/tmp', dependencies=()):
        ''' Customize CLI parameters for Mapping commands '''
        #------------------------------------------
        # Dump SRA file into fastq format
        #------------------------------------------
        fastq_dump = AtomicCmdBuilder(['fastq-dump', '%(IN_SRA)s'],
                            IN_SRA = os.path.expanduser(sra_infile),
                            OUT_FASTQ1 = os.path.basename(sra_infile).replace('.sra','_1.fastq.gz'),
                            OUT_FASTQ2 = os.path.basename(sra_infile).replace('.sra','_2.fastq.gz')
                    ) 
        fastq_dump.set_option('--split-files')
        #------------------------------------------
        # Remove Adapters
        #------------------------------------------
        adapter_rm = AtomicCmdBuilder(['AdapterRemoval'],
                        TEMP_IN_READS_1 = 
                            os.path.join(
                                wdir,
                                os.path.basename(sra_infile).replace(".sra",'') + "_1.fastq"
                        ),
                        TEMP_IN_READS_2 = 
                            os.path.join(
                                wdir,
                                os.path.basename(sra_infile).replace(".sra",'') + "_2.fastq"
                        ),
                        TEMP_OUT_BASENAME = os.path.basename(sra_infile), 
                        TEMP_OUT_LINK_PAIR1 = 'pair_1',
                        TEMP_OUT_LINK_PAIR2 = 'pair_2',
                        TEMP_OUT_LINK_ALN = 'aligned',
                        TEMP_OUT_LINK_ALN_TRUNC = 'truncated',
                        TEMP_OUT_LINK_UNALN = 'unaligned',
                        TEMP_OUT_LINK_DISC = 'discarded',
                    )
        # Allow 1/3 mismatches in the aligned region
        adapter_rm.set_option("--mm", 3, fixed = False)
        # Minimum length of trimmed reads
        adapter_rm.set_option("--minlength", 25, fixed = False)
        # Trim Ns at read ends
        adapter_rm.set_option("--trimns", fixed = False)
        # Trim low quality scores
        adapter_rm.set_option("--trimqualities", fixed = False)
        # Offset of quality scores
        adapter_rm.set_option("--qualitybase", 33, fixed = False)
        adapter_rm.set_option('--collapse')
        # Uncompressed mate 1 and 2 reads (piped from fastq-dump)
        adapter_rm.set_option("--file1", "%(TEMP_IN_READS_1)s")
        adapter_rm.set_option("--file2", "%(TEMP_IN_READS_2)s")
        # Prefix for output files, ensure that all end up in temp folder
        adapter_rm.set_option("--basename", "%(TEMP_OUT_BASENAME)s")
        # Output files are explicity specified, to ensure that the order is the same here
        # as below. A difference in the order in which files are opened can cause a deadlock,
        # due to the use of named pipes (see __init__).
        adapter_rm.set_option("--output1", "%(TEMP_OUT_LINK_PAIR1)s")
        adapter_rm.set_option("--output2", "%(TEMP_OUT_LINK_PAIR2)s")
        adapter_rm.set_option("--outputcollapsed", "%(TEMP_OUT_LINK_ALN)s")
        adapter_rm.set_option("--outputcollapsedtruncated", "%(TEMP_OUT_LINK_ALN_TRUNC)s")
        adapter_rm.set_option("--singleton", "%(TEMP_OUT_LINK_UNALN)s")
        adapter_rm.set_option("--discarded", "%(TEMP_OUT_LINK_DISC)s")

        # Return the commands
        return {
            'commands' : {
                'fastq_dump' : fastq_dump,
                'adapter_rm' : adapter_rm,
            }
        }
开发者ID:schae234,项目名称:SRAManager,代码行数:68,代码来源:analysis.py

示例15: customize

# 需要导入模块: from pypeline.atomiccmd.builder import AtomicCmdBuilder [as 别名]
# 或者: from pypeline.atomiccmd.builder.AtomicCmdBuilder import set_option [as 别名]
    def customize(cls, input_alignment, input_partition, output_alignment, dependencies = ()):
        command = AtomicCmdBuilder("raxmlHPC", set_cwd = True)

        # Read and (in the case of empty columns) reduce input
        command.set_option("-f", "j")
        # Output files are saved with a .Pypeline postfix, and subsequently renamed
        command.set_option("-n", "Pypeline")
        # Model required, but not used
        command.set_option("-m", "GTRGAMMA")
        # Set random seed for bootstrap generation. May be set to a fixed value to allow replicability.
        command.set_option("-b", int(random.random() * 2**31 - 1), fixed = False)
        # Generate a single bootstrap alignment (makes growing the number of bootstraps easier).
        command.set_option("-N", 1, fixed = False)

        # Symlink to sequence and partitions, to prevent the creation of *.reduced files outside temp folder
        # In addition, it may be nessesary to remove the .reduced files if created
        command.set_option("-s", "input.alignment")
        command.set_option("-q", "input.partition")

        command.set_kwargs(IN_ALIGNMENT      = input_alignment,
                          IN_PARTITION      = input_partition,

                          OUT_ALIGNMENT     = output_alignment,
                          OUT_INFO          = fileutils.swap_ext(output_alignment, ".info"))

        return {"command" : command}
开发者ID:schae234,项目名称:pypeline,代码行数:28,代码来源:raxml.py


注:本文中的pypeline.atomiccmd.builder.AtomicCmdBuilder.set_option方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。