def test_or__str__two_items__first_is_operator(): obj_1 = versions.Or(versions.GE(1, 2), versions.LT(2, 0)) obj_2 = versions.LT(3, 4) obj = versions.Or(obj_1, obj_2) assert_equal(str(obj), "(at least v1.2.x or prior to v2.0.x) or prior to v3.4.x")
def test_or__str__two_items__second_is_operator(): obj_1 = versions.GE(1, 2) obj_2 = versions.And(versions.GE(2, 0), versions.LT(3, 4)) obj = versions.Or(obj_1, obj_2) assert_equal(str(obj), "at least v1.2.x or (at least v2.0.x and prior to v3.4.x)")
def test_check__can_pickle(): def _do_test_can_pickle(obj): pickle.dumps(obj) yield _do_test_can_pickle, versions.EQ(1, 2, 3) yield _do_test_can_pickle, versions.GE(1, 2, 3) yield _do_test_can_pickle, versions.LT(1, 2, 3) yield _do_test_can_pickle, versions.Any() yield _do_test_can_pickle, versions.And(versions.EQ(1, 2, 3)) yield _do_test_can_pickle, versions.Or(versions.GE(1, 2, 3))
def test_or__check_version__insufficient_number_of_values__is_lazy(): obj_1 = versions.GE(1, 2) obj_2 = versions.LT(2, 0, 1) obj = versions.Or(obj_1, obj_2) assert obj((1, 3))
def _do_or_check_num_values(obj_1, obj_2): obj = versions.Or(obj_1, obj_2) assert_raises(ValueError, obj, (1, 3))
def _do_or_check_truncated(obj_1, obj_2): obj = versions.Or(obj_1, obj_2) assert obj((1, 3, 3))
def test_or__check_version__neither_true(): obj_1 = versions.And(versions.GE(1, 2), versions.LT(2, 0)) obj_2 = versions.And(versions.GE(2, 3), versions.LT(3, 0)) obj = versions.Or(obj_1, obj_2) assert not obj((2, 2))
def test_or__check_version__second_true(): obj_1 = versions.And(versions.GE(1, 2), versions.LT(2, 0)) obj_2 = versions.And(versions.GE(2, 3), versions.LT(3, 0)) obj = versions.Or(obj_1, obj_2) assert obj((2, 3))
def test_or__check_version__both_true(): obj_1 = versions.GE(1, 2) obj_2 = versions.LT(2, 0) obj = versions.Or(obj_1, obj_2) assert obj((1, 3))
def test_or__str__two_items(): obj_ge = versions.GE(1, 2) obj_lt = versions.LT(3, 4) obj = versions.Or(obj_ge, obj_lt) assert_equal(str(obj), "at least v1.2.x or prior to v3.4.x")
def test_or__str__single_item(): obj = versions.Or(versions.GE(1)) assert_equal(str(obj), "at least v1.x")
use_customizable_cli_parameters, \ create_customizable_cli_parameters from pypeline.atomiccmd.sets import ParallelCmds from pypeline.nodes.samtools import SAMTOOLS_VERSION from pypeline.common.fileutils import \ describe_paired_files, \ missing_files import pypeline.common.versions as versions import pypeline.tools.factory as factory BWA_VERSION = versions.Requirement(call=("bwa", ), search=r"Version: (\d+)\.(\d+)\.(\d+)", checks=versions.Or(versions.EQ(0, 5, 9), versions.EQ(0, 5, 10), versions.EQ(0, 6, 2), versions.GE(0, 7, 9))) BWA_VERSION_07x = versions.Requirement(call=("bwa", ), search=r"Version: (\d+)\.(\d+)\.(\d+)", checks=versions.GE(0, 7, 9)) class BWAIndexNode(CommandNode): @create_customizable_cli_parameters def customize(cls, input_file, prefix=None, dependencies=()): prefix = prefix if prefix else input_file params = _get_bwa_template(("bwa", "index"), prefix, iotype="OUT", IN_FILE=input_file,
from pypeline.node import CommandNode, NodeError from pypeline.atomiccmd.command import AtomicCmd from pypeline.atomiccmd.builder import \ AtomicCmdBuilder, \ use_customizable_cli_parameters, \ create_customizable_cli_parameters from pypeline.atomiccmd.sets import ParallelCmds from pypeline.nodes.samtools import SAMTOOLS_VERSION import pypeline.common.versions as versions BWA_VERSION = versions.Requirement(call=("bwa", ), search=r"Version: (\d+)\.(\d+)\.(\d+)", checks=versions.Or( versions.And(versions.GE(0, 5, 9), versions.LT(0, 6, 0)), versions.GE(0, 7, 5))) # Required by safeSam2Bam for 'PG' tagging support / known good version # Cannot be a lambda due to need to be able to pickle function def _get_pysam_version(): return __import__("pysam").__version__ PYSAM_VERSION = versions.Requirement(name="module 'pysam'", call=_get_pysam_version, search=r"(\d+)\.(\d+)\.(\d+)", checks=versions.GE(0, 7, 4))