Exemplo n.º 1
0
def test_specs__path_is_displayed_in_exception():
    def _path_is_displayed_in_exception(spec, value):
        assert_raises_regexp(MakefileError, _DUMMY_PATH_STR, spec, _DUMMY_PATH,
                             value)

    yield _path_is_displayed_in_exception, IsInt(), "foo"
    yield _path_is_displayed_in_exception, IsUnsignedInt(), -1
    yield _path_is_displayed_in_exception, IsFloat(), "abc"
    yield _path_is_displayed_in_exception, IsBoolean(), 1
    yield _path_is_displayed_in_exception, IsStr(), 1
    yield _path_is_displayed_in_exception, IsNone(), 1
    yield _path_is_displayed_in_exception, ValueLT(0), 1
    yield _path_is_displayed_in_exception, ValueLE(0), 1
    yield _path_is_displayed_in_exception, ValueGE(0), -1
    yield _path_is_displayed_in_exception, ValueGT(0), -1
    yield _path_is_displayed_in_exception, ValueIn([1]), 2
    yield _path_is_displayed_in_exception, ValuesIntersect([1]), [2]
    yield _path_is_displayed_in_exception, ValuesSubsetOf([1]), [2]
    yield _path_is_displayed_in_exception, ValueMissing(), True
    yield _path_is_displayed_in_exception, And(IsStr), 1
    yield _path_is_displayed_in_exception, Or(IsStr), 1
    yield _path_is_displayed_in_exception, Xor(IsStr, IsInt), True
    yield _path_is_displayed_in_exception, Not(IsInt), 1
    yield _path_is_displayed_in_exception, StringIn("abc"), 1
    yield _path_is_displayed_in_exception, StringsIntersect("abc"), [1]
    yield _path_is_displayed_in_exception, StringsSubsetOf("abc"), [1]
    yield _path_is_displayed_in_exception, StringIsUppercase(), 1
    yield _path_is_displayed_in_exception, StringStartsWith("FOO"), 1
    yield _path_is_displayed_in_exception, StringEndsWith("FOO"), 1
    yield _path_is_displayed_in_exception, IsListOf(IsInt), "foo"
    yield _path_is_displayed_in_exception, IsDictOf(IsInt, IsInt), 1
Exemplo n.º 2
0
def test_is_unsigned_int__default_set__valid_value():
    spec = IsUnsignedInt(default=7913)
    assert_equal(spec.default, 7913)
Exemplo n.º 3
0
def test_is_unsigned_int__default_not_set():
    spec = IsUnsignedInt()
    assert_is(spec.default, DEFAULT_NOT_SET)
Exemplo n.º 4
0
def test_is_unsigned_int__custom_description():
    custom_desc = "any old unsigned integer"
    spec = IsUnsignedInt(description=custom_desc)
    assert_equal(spec.description, custom_desc)
Exemplo n.º 5
0
def test_is_unsigned_int__default_description():
    spec = IsUnsignedInt()
    assert_equal(spec.description, "an unsigned integer")
Exemplo n.º 6
0
 def _reject_not_str(value):
     spec = IsUnsignedInt()
     assert_raises(MakefileError, spec, _DUMMY_PATH, value)
Exemplo n.º 7
0
def test_is_unsigned_int__accepts_longs():
    spec = IsUnsignedInt()
    spec(_DUMMY_PATH, 1234L)
    spec(_DUMMY_PATH, 0L)
Exemplo n.º 8
0
def test_is_unsigned_int__accepts_non_negative_integers():
    spec = IsUnsignedInt()
    spec(_DUMMY_PATH, 1234)
    spec(_DUMMY_PATH, 0)
Exemplo n.º 9
0
         # Selection of regions of interest / settings per region
         "RegionsOfInterest": {
             IsStr: {
                 "Partitions":
                 Or(And(IsStr, ValuesSubsetOf("123456789X")),
                    ValueIn([False]),
                    default=REQUIRED_VALUE),
                 "SubsetRegions":
                 Or(IsStr, IsNone, default=None),
             },
         },
         "SubsetRegions": {
             IsStr: IsStr,
         },
         "ExaML": {
             "Bootstraps": IsUnsignedInt(default=100),
             "Replicates": IsUnsignedInt(default=1),
             "Model": StringIn(("GAMMA", "PSR"), default="gamma"),
         }
     }
 },
 "PAML": {
     "codeml": {
         "ExcludeSamples": [IsStr],
         "SubsetRegions": {
             IsStr: IsStr,
         },
         IsStr: {
             "ControlFile": IsStr(default=REQUIRED_VALUE),
             "TreeFile": IsStr(default=REQUIRED_VALUE),
         },
Exemplo n.º 10
0
    # Format to use when compressing FASTQ files ("gz" or "bz2")
    "CompressionFormat":
    ValueIn(("gz", "bz2"), default="bz2"),
    "AdapterRemoval": {
        "Version": ValueIn(("v1.4", "v1.5+"), default="v1.5+"),
        "--pcr1": IsStr,
        "--pcr2": IsStr,
        "--adapter1": IsStr,
        "--adapter2": IsStr,
        "--maxns": IsUnsignedInt,
        "--minquality": IsUnsignedInt,
        "--trimns": Or(IsNone, IsBoolean),
        "--trimqualities": Or(IsNone, IsBoolean),
        "--collapse": Or(IsNone, IsBoolean, default=True),
        "--mm": Or(IsFloat, IsUnsignedInt, default=3),
        "--minlength": IsUnsignedInt(default=25),
        "--minalignmentlength": IsUnsignedInt,
        "--shift": IsUnsignedInt,
        "--5prime": IsStr,
    },

    # Which aliger/mapper to use (BWA/Bowtie2)
    "Aligners": {
        "Program": ValueIn(("BWA", "Bowtie2"), default="BWA"),
        "BWA": {
            # Mapping algorithm; availability depends on BWA version
            "Algorithm":
            StringIn(("backtrack", "mem", "bwasw"), default="backtrack"),

            # Minimum mapping quality (PHREAD) of reads to retain
            "MinQuality":
Exemplo n.º 11
0
    description = "characters a-z, A-Z, 0-9%s allowed"
    description %= (", and %r" % whitelist, ) if whitelist else ""

    whitelist += string.ascii_letters + string.digits

    return And(IsStr(), ValuesSubsetOf(whitelist, description=description))



_VALID_BED_NAME = _VALID_TARGET_NAME = \
    And(_alphanum_check(whitelist=".-"),
        ValueGE(2, key=len, description="at least two characters long"))

_VALIDATION_OPTIONS = {
    "BamPath": IsStr,
    "--MinMappingQuality": IsUnsignedInt(default=25),
    "--MinAlignmentLength": IsUnsignedInt(default=25),
    "--NoReadsChecked": IsUnsignedInt(default=5000)
}

_VALIDATION_GCCORRECT = {
    "Enabled": IsBoolean(default=False),
    "--NoRegions": Or(IsUnsignedInt, IsStr, default=200),
    "--ChromUsed": Or(IsStr, IsUnsignedInt, default="all"),  ## the is new
    "--MappaUniqueness": IsFloat(default=0.9)
}

_VALIDATION_NUCLEO = {
    "Enabled": IsBoolean(default=False),
    "Apply_GC_Correction": IsBoolean(default=True),
    "ExcludeBed": EXCLUDEBED,