コード例 #1
0
ファイル: makefile.py プロジェクト: UMNPonyClub/paleomix
def _update_msa(mkfile):
    msa = mkfile["MultipleSequenceAlignment"]
    defaults = msa.pop("Defaults")
    defaults.setdefault("Program", "MAFFT")
    defaults["MAFFT"].setdefault("Algorithm", "MAFFT")

    for key in mkfile["Project"]["Regions"]:
        msa[key] = fill_dict(msa.get(key, {}), defaults)

    unknown_regions = set(msa) - set(mkfile["Project"]["Regions"])
    if unknown_regions:
        raise MakefileError("Unknown Regions of Interest in Genotyping: %s" % (", ".join(unknown_regions),))
コード例 #2
0
ファイル: makefile.py プロジェクト: KHanghoj/epiPALEOMIX
def _update_msa(mkfile):
    msa = mkfile["MultipleSequenceAlignment"]
    defaults = msa.pop("Defaults")
    defaults.setdefault("Program", "MAFFT")
    defaults["MAFFT"].setdefault("Algorithm", "MAFFT")

    for key in mkfile["Project"]["Regions"]:
        msa[key] = fill_dict(msa.get(key, {}), defaults)

    unknown_regions = set(msa) - set(mkfile["Project"]["Regions"])
    if unknown_regions:
        raise MakefileError("Unknown Regions of Interest in Genotyping: %s" \
                            % (", ".join(unknown_regions),))
コード例 #3
0
ファイル: makefile.py プロジェクト: health1987/paleomix
    def _do_update_options(options, data, path):
        options = copy.deepcopy(options)
        if "Options" in data:
            if "Features" in data["Options"]:
                raise MakefileError("Features may only be specified at root "
                                    "level, not at %r" % (":".join(path),))

            # Fill out missing values using those of prior levels
            options = fill_dict(destination=data.pop("Options"),
                                source=options)
            _update_possibly_empty_lists(options)

        if len(path) < 2:
            for key in data:
                if key != "Options":
                    _do_update_options(options, data[key], path + (key,))
        else:
            data["Options"] = options
コード例 #4
0
    def _do_update_options(options, data, path):
        options = copy.deepcopy(options)
        if "Options" in data:
            if "Features" in data["Options"]:
                raise MakefileError("Features may only be specified at root "
                                    "level, not at %r" % (":".join(path), ))

            # Fill out missing values using those of prior levels
            options = fill_dict(destination=data.pop("Options"),
                                source=options)
            _update_possibly_empty_lists(options)

        if len(path) < 2:
            for key in data:
                if key != "Options":
                    _do_update_options(options, data[key], path + (key, ))
        else:
            data["Options"] = options
コード例 #5
0
ファイル: makefile.py プロジェクト: KHanghoj/epiPALEOMIX
def _update_genotyping(mkfile):
    genotyping = mkfile["Genotyping"]
    defaults = genotyping.pop("Defaults")
    defaults.setdefault("Padding", 5)
    defaults["VCF_Filter"].setdefault("MaxReadDepth", 0)

    for (key, subdd) in genotyping.iteritems():
        if subdd.get("GenotypeEntirePrefix"):
            message = "GenotypeEntirePrefix is only allowed for prefixes " \
                      "using default parameters, but is set for %r" % (key,)
            raise MakefileError(message)

    for key in mkfile["Project"]["Regions"]:
        subdd = fill_dict(genotyping.get(key, {}), defaults)
        subdd["Random"]["--padding"] = subdd["Padding"]
        genotyping[key] = subdd

    regions = set(genotyping)
    unknown_regions = regions - set(mkfile["Project"]["Regions"])
    if unknown_regions:
        raise MakefileError("Unknown Regions of Interest in Genotyping: %s" \
                            % (", ".join(unknown_regions),))
コード例 #6
0
ファイル: makefile.py プロジェクト: CarlesV/paleomix
def _update_genotyping(mkfile):
    genotyping = mkfile["Genotyping"]
    defaults   = genotyping.pop("Defaults")
    defaults.setdefault("Padding", 5)
    defaults["VCF_Filter"].setdefault("MaxReadDepth", 0)

    for (key, subdd) in genotyping.iteritems():
        if subdd.get("GenotypeEntirePrefix"):
            message = "GenotypeEntirePrefix is only allowed for prefixes " \
                      "using default parameters, but is set for %r" % (key,)
            raise MakefileError(message)

    for key in mkfile["Project"]["Regions"]:
        subdd = fill_dict(genotyping.get(key, {}), defaults)
        subdd["Random"]["--padding"] = subdd["Padding"]
        genotyping[key] = subdd

    regions = set(genotyping)
    unknown_regions = regions - set(mkfile["Project"]["Regions"])
    if unknown_regions:
        raise MakefileError("Unknown Regions of Interest in Genotyping: %s" \
                            % (", ".join(unknown_regions),))
コード例 #7
0
def test_fill_dict__source_not_modified():
    expected = {"a": 1, "b": {"c": 2, "d": 3}}
    source = {"a": 1, "b": {"c": 2, "d": 3}}
    destination = {"b": {"d": 0}}
    _result = utils.fill_dict(destination, source)
    assert_equal(source, expected)
コード例 #8
0
def test_fill_dict__destination_not_modified():
    source = {"a": 1, "b": {"c": 2, "d": 3}}
    destination = {"b": {"d": 0}}
    _result = utils.fill_dict(destination, source)
    assert_equal(destination, {"b": {"d": 0}})
コード例 #9
0
def test_fill_dict__filling_full_dict():
    source = {"a": 1, "b": {"c": 2, "d": 3}}
    destination = {"a": 2, "b": {"c": 3, "d": 4}}
    expected = {"a": 2, "b": {"c": 3, "d": 4}}
    result = utils.fill_dict(destination, source)
    assert_equal(result, expected)
コード例 #10
0
def test_fill_dict__filling_empty_dict():
    source = {"a": 1, "b": {"c": 2, "d": 3}}
    expected = {"a": 1, "b": {"c": 2, "d": 3}}
    result = utils.fill_dict({}, source)
    assert_equal(result, expected)
コード例 #11
0
def test_fill_dict__empty_dicts():
    result = utils.fill_dict({}, {})
    assert_equal(result, {})
コード例 #12
0
ファイル: utilities_test.py プロジェクト: CarlesV/paleomix
def test_fill_dict__source_not_modified():
    expected    = {"a" : 1, "b" : {"c" : 2, "d" : 3}}
    source      = {"a" : 1, "b" : {"c" : 2, "d" : 3}}
    destination = {"b" : {"d" : 0}}
    _result     = utils.fill_dict(destination, source)
    assert_equal(source, expected)
コード例 #13
0
ファイル: utilities_test.py プロジェクト: CarlesV/paleomix
def test_fill_dict__destination_not_modified():
    source      = {"a" : 1, "b" : {"c" : 2, "d" : 3}}
    destination = {"b" : {"d" : 0}}
    _result     = utils.fill_dict(destination, source)
    assert_equal(destination, {"b" : {"d" : 0}})
コード例 #14
0
ファイル: utilities_test.py プロジェクト: CarlesV/paleomix
def test_fill_dict__filling_full_dict():
    source       = {"a" : 1, "b" : {"c" : 2, "d" : 3}}
    destination  = {"a" : 2, "b" : {"c" : 3, "d" : 4}}
    expected     = {"a" : 2, "b" : {"c" : 3, "d" : 4}}
    result       = utils.fill_dict(destination, source)
    assert_equal(result, expected)
コード例 #15
0
ファイル: utilities_test.py プロジェクト: CarlesV/paleomix
def test_fill_dict__filling_empty_dict():
    source   = {"a" : 1, "b" : {"c" : 2, "d" : 3}}
    expected = {"a" : 1, "b" : {"c" : 2, "d" : 3}}
    result = utils.fill_dict({}, source)
    assert_equal(result, expected)
コード例 #16
0
ファイル: utilities_test.py プロジェクト: CarlesV/paleomix
def test_fill_dict__empty_dicts():
    result = utils.fill_dict({}, {})
    assert_equal(result, {})