Beispiel #1
0
def test_samplegroup_from_dict_of_dicts():
    dict_of_dicts = {"sample1": {"lib1": {"rg1": {"R1": "r1.fq"}}}}
    samplegroup = SampleGroup([
        Sample(id="sample1",
               libraries=[
                   Library(id="lib1",
                           readgroups=[ReadGroup(id="rg1", R1="r1.fq")])
               ])
    ])
    assert SampleGroup.from_dict_of_dicts(dict_of_dicts) == samplegroup
Beispiel #2
0
def test_file_md5sums():
    reads_dir = (Path(FILESDIR) / Path("data")).absolute()
    samplegroup = SampleGroup([
        Sample("s1", [
            Library("l1", [
                ReadGroup(id="r1",
                          R1=str(reads_dir / Path("R1.fq")),
                          R2=str(reads_dir / Path("R2.fq")),
                          R1_md5="d8e8fca2dc0f896fd7cb4cb0031ba249",
                          R2_md5="126a8a51b9d1bbd07fddc65819a542c3")
            ])
        ])
    ])
    samplegroup.test_file_checksums()
Beispiel #3
0
def test_incorrect_samplegroup_append():
    samplegroup = SampleGroup()
    with pytest.raises(TypeError) as error:
        samplegroup.append_sample("sample1")
    assert error.match("Only sample ")
Beispiel #4
0
def test_samplegroup_append_and_access():
    sample = Sample(id="blasample")
    samplegroup = SampleGroup()
    samplegroup.append_sample(sample)
    assert samplegroup[0] == sample
FILESDIR: Path = Path(__file__).parent / Path("files")

COMPLETE_WITH_CONTROL_SAMPLEGROUP = SampleGroup([
    Sample(id="s1",
           libraries=[
               Library(id="lib1",
                       readgroups=[
                           ReadGroup(id="rg1",
                                     R1="r1.fq",
                                     R1_md5="hello",
                                     R2="r2.fq",
                                     R2_md5="hey")
                       ])
           ]),
    Sample(id="s2",
           additional_properties=dict(control="s1"),
           libraries=[
               Library(id="lib1",
                       readgroups=[
                           ReadGroup(id="rg1",
                                     R1="r1.fq",
                                     R1_md5="aa",
                                     R2="r2.fq",
                                     R2_md5="bb")
                       ])
           ])
])

WITHOUT_MD5_SAMPLEGROUP = SampleGroup([
    Sample(id="s1",