Esempio n. 1
0
def test_assign_sample_no_match():
    """
    Test :py:func:`riboviz.demultiplex_fastq.assign_sample`
    with a record with a non-matching barcode.
    """
    with StringIO() as read1_fh:
        barcode = "GGG"
        is_assigned = demultiplex_fastq.assign_sample(FASTQ_RECORD1, None,
                                                      barcode, read1_fh, None,
                                                      False, 1, "_")
        assert not is_assigned
        assert read1_fh.getvalue() == ""
Esempio n. 2
0
def test_assign_sample():
    """
    Test :py:func:`riboviz.demultiplex_fastq.assign_sample`
    with a record with a matching barcode.
    """
    with StringIO() as read1_fh:
        barcode = "AAA"
        is_assigned = demultiplex_fastq.assign_sample(FASTQ_RECORD1, None,
                                                      barcode, read1_fh, None,
                                                      False, 1, "_")
        assert is_assigned
        assert "".join(FASTQ_RECORD1) == read1_fh.getvalue()
Esempio n. 3
0
def test_assign_sample_paired_end():
    """
    Test :py:func:`riboviz.demultiplex_fastq.assign_sample`
    with a record and a paired end record with a matching barcode.
    """
    with StringIO() as read1_fh, StringIO() as read2_fh:
        barcode = "AAA"
        is_assigned = demultiplex_fastq.assign_sample(FASTQ_RECORD1,
                                                      FASTQ_RECORD2, barcode,
                                                      read1_fh, read2_fh, True,
                                                      1, "_")
        assert is_assigned
        assert "".join(FASTQ_RECORD1) == read1_fh.getvalue()
        assert "".join(FASTQ_RECORD2) == read2_fh.getvalue()
Esempio n. 4
0
def test_assign_sample_paired_end_no_match():
    """
    Test :py:func:`riboviz.demultiplex_fastq.assign_sample`
    with a record and a paired end record with a non-matching
    barcode.
    """
    with StringIO() as read1_fh, StringIO() as read2_fh:
        barcode = "GGG"
        is_assigned = demultiplex_fastq.assign_sample(FASTQ_RECORD1,
                                                      FASTQ_RECORD2, barcode,
                                                      read1_fh, read2_fh, True,
                                                      1, "_")
        assert not is_assigned
        assert read1_fh.getvalue() == ""
        assert read2_fh.getvalue() == ""