Esempio n. 1
0
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)")
Esempio n. 2
0
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))
Esempio n. 3
0
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))
Esempio n. 4
0
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))
Esempio n. 5
0
 def _do_and_check_num_values(obj_1, obj_2):
     obj = versions.And(obj_1, obj_2)
     assert_raises(ValueError, obj, (1, 3))
Esempio n. 6
0
def test_and__check_version__first_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.And(obj_1, obj_2)
    assert not obj((1, 3))
Esempio n. 7
0
 def _do_and_check_truncated(obj_1, obj_2):
     obj = versions.And(obj_1, obj_2)
     assert obj((1, 3, 3))
Esempio n. 8
0
def test_and__check_version__both_true():
    obj_1 = versions.GE(1, 2)
    obj_2 = versions.LT(2, 0)
    obj = versions.And(obj_1, obj_2)
    assert obj((1, 3))
Esempio n. 9
0
def test_and__str__two_items():
    obj_ge = versions.GE(1, 2)
    obj_lt = versions.LT(3, 4)
    obj = versions.And(obj_ge, obj_lt)

    assert_equal(str(obj), "at least v1.2.x and prior to v3.4.x")
Esempio n. 10
0
def test_and__str__single_item():
    obj = versions.And(versions.GE(1))
    assert_equal(str(obj), "at least v1.x")
Esempio n. 11
0
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
# SOFTWARE.
#
import os

from pypeline.node import CommandNode
from pypeline.atomiccmd.command import AtomicCmd

from pypeline.common.fileutils import reroot_path, swap_ext
import pypeline.common.versions as versions


_VERSION_REGEX = r"Version: (\d+)\.(\d+)(?:\.(\d+))?"

# v0.2.0 was the pre-release version of v1.0, and lacks required features
_COMMON_CHECK = versions.And(versions.GE(0, 1, 18),
                             versions.LT(0, 2, 0))

SAMTOOLS_VERSION = versions.Requirement(call=("samtools",),
                                        search=_VERSION_REGEX,
                                        checks=_COMMON_CHECK)

BCFTOOLS_VERSION \
    = versions.Requirement(call=("bcftools",),
                           search=_VERSION_REGEX,
                           checks=_COMMON_CHECK)

TABIX_VERSION = versions.Requirement(call=("tabix",),
                                     search=_VERSION_REGEX,
                                     checks=versions.GE(0, 2, 5))

Esempio n. 12
0
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))