def test_template_unmapped_filter_length():
    infile = gt.InputFile(testfiles["test.map.gz"])
    assert 1 == len([x for x in gt.unmapped(infile, 1)]), len([x for x in gt.unmapped(infile, 1)])
    assert 5 == len([x for x in gt.unmapped(infile, 0)]), len([x for x in gt.unmapped(infile, 0)])
    assert 1 == len([x for x in gt.unmapped(infile, 2)]), len([x for x in gt.unmapped(infile, 2)])
    assert 0 == len([x for x in gt.unmapped(infile, 3)]), len([x for x in gt.unmapped(infile, 3)])
    assert 0 == len([x for x in gt.unmapped(infile, 4)]), len([x for x in gt.unmapped(infile, 4)])
def test_template_unmapped_filter_length():
    infile = gt.InputFile(testfiles["test.map.gz"])
    assert 1 == len([x for x in gt.unmapped(infile, 1)
                     ]), len([x for x in gt.unmapped(infile, 1)])
    assert 5 == len([x for x in gt.unmapped(infile, 0)
                     ]), len([x for x in gt.unmapped(infile, 0)])
    assert 1 == len([x for x in gt.unmapped(infile, 2)
                     ]), len([x for x in gt.unmapped(infile, 2)])
    assert 0 == len([x for x in gt.unmapped(infile, 3)
                     ]), len([x for x in gt.unmapped(infile, 3)])
    assert 0 == len([x for x in gt.unmapped(infile, 4)
                     ]), len([x for x in gt.unmapped(infile, 4)])
def unmapped(reads, exclude=-1):
    """Yield only unmapped reads and reads
    that have only mappings with mismatches >= exclude
    if exclude is a nubmer between 0 and 1 we use it as a
    percentage of mismatches
    """
    return gt.unmapped(reads.__iter__(), exclude)
Exemple #4
0
def unmapped(reads, exclude=-1):
    """Yield only unmapped reads and reads
    that have only mappings with mismatches >= exclude
    if exclude is a nubmer between 0 and 1 we use it as a
    percentage of mismatches
    """
    return gt.unmapped(reads.__iter__(), exclude)