Exemplo n.º 1
0
def trim(source_left, source_right, dest_left, dest_right):
    fastq_pairs = itertools.izip(
        FastqStanza.stanza_generator(source_left), FastqStanza.stanza_generator(source_right))
    for (left_stanza, right_stanza) in fastq_pairs:
        FastqStanza.trim_to_shortest_sequence_length(left_stanza, right_stanza)
        dest_left.write(left_stanza.as_text())
        dest_right.write(right_stanza.as_text())
Exemplo n.º 2
0
def demultiplex(left_fastq, right_fastq, barcode_files):
    fastq_pairs = itertools.izip(FastqStanza.stanza_generator(left_fastq),
                                 FastqStanza.stanza_generator(right_fastq))
    for (left_stanza, right_stanza) in fastq_pairs:
        assert_sequence_ids_match(left_stanza, right_stanza)
        barcode = left_stanza.sequence_id.split(':')[0][1:]
        try:
            (left_out, right_out) = barcode_files[barcode]
        except KeyError:
            raise UndefinedBarcodeError(left_stanza)
        left_out.write(left_stanza.as_text())
        right_out.write(right_stanza.as_text())
Exemplo n.º 3
0
def demultiplex(left_fastq, right_fastq, barcode_files):
    fastq_pairs = itertools.izip(
        FastqStanza.stanza_generator(left_fastq), FastqStanza.stanza_generator(right_fastq))
    for (left_stanza, right_stanza) in fastq_pairs:
        assert_sequence_ids_match(left_stanza, right_stanza)
        barcode = left_stanza.sequence_id.split(':')[0][1:]
        try:
            (left_out, right_out) = barcode_files[barcode]
        except KeyError:
            raise UndefinedBarcodeError(left_stanza)
        left_out.write(left_stanza.as_text())
        right_out.write(right_stanza.as_text())