コード例 #1
0
def prepare(args):
    # NOTE this needs to match the arguments in parse_args and the targets in payload
    # commas at the beginning of each option are used when that section has
    # parameters from other functions.
    options = {
        "fastq_opts": {
            "input": "'{input}'",
        },
        "write_opts": {
            "output": ", ofile='{output}'",
        },
        "method_name": {
            "method": "{method}",
        },
        "method_opts": {
            "min_quality": ", min_quality={min_quality}",
        },
        "discard_opts": {
            "discard": "{discard}",
        },
    }

    ngl_options = ngl_prepare_options(args, options)

    payload_tpl = """\
ngless "0.0"
input = fastq({fastq_opts})
preprocess(input) using |read|:
    read = {method_name}(read{method_opts})
    if len(read) < {discard_opts}:
        discard
write(input{write_opts})
""".format(**ngl_options)

    return ngl_prepare_payload(args, payload_tpl)
コード例 #2
0
def prepare(args):
    # NOTE this needs to match the arguments in parse_args and the targets in payload
    # commas at the beginning of each option are used when that section has
    # parameters from other functions. The keys are iterated in alphabetical order
    # so only the first needs to have a comma.
    options = {
        "sam_opts": {
            "input": "'{input}'",
        },
        "count_opts": {
            "features": ", features=['seqname']",
            "multiple": "multiple={{{multiple}}}",
        },
        "write_opts": {
            "output": ", ofile='{output}'",
        },
    }

    ngl_options = ngl_prepare_options(args, options)

    payload_tpl = """\
ngless "0.0"
write(count(samfile({sam_opts}){count_opts}){write_opts})\
""".format(**ngl_options)

    return ngl_prepare_payload(args, payload_tpl)
コード例 #3
0
def prepare(args):
    # NOTE this needs to match the arguments in parse_args and the targets in payload
    # commas at the beginning of each option are used when that section has
    # parameters from other functions.
    options = {
        "input_opts": {
            "input": "'{input}'",
        },
        "write_opts": {
            "output": ", ofile='{output}'",
        },
        "action_opts": {
            "action": "{action}",
        },
        "cond_opts": {
            "conditions": ngl_as_list("{conditions}", wrap_with="{}"),
        },
    }

    ngl_options = ngl_prepare_options(args, options)

    payload_tpl = """\
ngless "0.0"
mapped = samfile({input_opts})
selected = select(mapped, {action_opts}={cond_opts})
write(selected{write_opts})
""".format(**ngl_options)

    return ngl_prepare_payload(args, payload_tpl)
コード例 #4
0
ファイル: ngless-map.py プロジェクト: Python3pkg/ngless
def prepare(args):
    # NOTE this needs to match the arguments in parse_args and the targets in payload
    # commas at the beginning of each option are used when that section has
    # parameters from other functions.
    options = {
        "input_opts": {
            "input": "'{input}'",
            "input_reverse": "'{input_reverse}'",
            "input_singles": "singles='{input_singles}'",
        },
        "write_opts": {
            "output": ", ofile='{output}'",
        },
        "target_name": {
            "target": "{target}",
        },
        "target_opts": {
            "reference": ", reference='{reference}'",
            "fasta": ", fafile='{fasta}'",
        },
    }

    ngl_options = ngl_prepare_options(args, options)

    payload_tpl = """\
ngless "0.0"
input = {target_name}({input_opts})
mapped = map(input{target_opts})
write(mapped{write_opts})
""".format(**ngl_options)

    return ngl_prepare_payload(args, payload_tpl)
コード例 #5
0
def prepare(args):
    # NOTE this needs to match the arguments in parse_args and the targets in payload
    # commas at the beginning of each option are used when that section has
    # parameters from other functions.
    options = {
        "input_opts": {
            "input": "'{input}'",
        },
        "write_opts": {
            "output": ", ofile='{output}'",
        },
        "target_opts": {
            "max_copies": ", max_copies={max_copies}",
        },
    }

    ngl_options = ngl_prepare_options(args, options)

    payload_tpl = """\
ngless "0.0"
input = fastq({input_opts})
unique = unique(input{target_opts})
write(unique{write_opts})
""".format(**ngl_options)

    return ngl_prepare_payload(args, payload_tpl)
コード例 #6
0
ファイル: ngless-mapstats.py プロジェクト: Python3pkg/ngless
def prepare(args):
    # NOTE this needs to match the arguments in parse_args and the targets in payload
    # commas at the beginning of each option are used when that section has
    # parameters from other functions.
    options = {
        "input_opts": {
            "input": "'{input}'",
        },
        "write_opts": {
            "output": ", ofile='{output}'",
        },
    }

    ngl_options = ngl_prepare_options(args, options)

    payload_tpl = """\
ngless "0.0"
mapped = samfile({input_opts})
stats = mapstats(mapped)
write(stats{write_opts})
""".format(**ngl_options)

    return ngl_prepare_payload(args, payload_tpl)