Exemplo n.º 1
0
def _read_pairs(in_fhands, paired_reads):
    seqs = read_seqs(in_fhands, prefered_seq_classes=[SEQITEM])
    if paired_reads:
        pairs = group_seqs_in_pairs(seqs)
    else:
        pairs = ([seq] for seq in seqs)
    return pairs
Exemplo n.º 2
0
def seq_to_filterpackets(seq_packets, group_paired_reads=False):
    'It yields packets suitable for the filters'

    for packet in seq_packets:
        if group_paired_reads:
            packet = list(group_seqs_in_pairs(packet))
        else:
            packet = [[seq] for seq in packet]
        yield {SEQS_PASSED: packet, SEQS_FILTERED_OUT: []}
Exemplo n.º 3
0
def seq_to_trim_packets(seq_packets, group_paired_reads=False):
    'It yields packets suitable for the filters'

    for packet in seq_packets:
        if group_paired_reads:
            packet = list(group_seqs_in_pairs(packet))
        else:
            packet = [[seq] for seq in packet]
        yield {SEQS_PASSED: packet, ORPHAN_SEQS: []}
Exemplo n.º 4
0
 def test_pair_grouper():
     seq1 = SeqWrapper(SEQITEM, SeqItem('s1', ['>s1.f\n', 'A\n']), 'fasta')
     seq2 = SeqWrapper(SEQITEM, SeqItem('s1', ['>s1.r\n', 'C\n']), 'fasta')
     seq3 = SeqWrapper(SEQITEM, SeqItem('s2', ['>s2.f\n', 'T\n']), 'fasta')
     seq4 = SeqWrapper(SEQITEM, SeqItem('s2', ['>s2.r\n', 'G\n']), 'fasta')
     seqs = seq1, seq2, seq3, seq4
     paired_seqs = list(group_seqs_in_pairs(seqs))
     assert [get_str_seq(s) for s in paired_seqs[0]] == ['A', 'C']
     assert [get_str_seq(s) for s in paired_seqs[1]] == ['T', 'G']
     assert len(paired_seqs) == 2
Exemplo n.º 5
0
 def test_pair_grouper():
     seq1 = SeqWrapper(SEQITEM, SeqItem('s1', ['>s1.f\n', 'A\n']), 'fasta')
     seq2 = SeqWrapper(SEQITEM, SeqItem('s1', ['>s1.r\n', 'C\n']), 'fasta')
     seq3 = SeqWrapper(SEQITEM, SeqItem('s2', ['>s2.f\n', 'T\n']), 'fasta')
     seq4 = SeqWrapper(SEQITEM, SeqItem('s2', ['>s2.r\n', 'G\n']), 'fasta')
     seqs = seq1, seq2, seq3, seq4
     paired_seqs = list(group_seqs_in_pairs(seqs))
     assert [get_str_seq(s) for s in paired_seqs[0]] == ['A', 'C']
     assert [get_str_seq(s) for s in paired_seqs[1]] == ['T', 'G']
     assert len(paired_seqs) == 2
Exemplo n.º 6
0
 def test_pair_grouper():
     seq1 = SeqWrapper(SEQITEM, SeqItem("s1", [">s1.f\n", "A\n"]), "fasta")
     seq2 = SeqWrapper(SEQITEM, SeqItem("s1", [">s1.r\n", "C\n"]), "fasta")
     seq3 = SeqWrapper(SEQITEM, SeqItem("s2", [">s2.f\n", "T\n"]), "fasta")
     seq4 = SeqWrapper(SEQITEM, SeqItem("s2", [">s2.r\n", "G\n"]), "fasta")
     seqs = seq1, seq2, seq3, seq4
     paired_seqs = list(group_seqs_in_pairs(seqs))
     assert [get_str_seq(s) for s in paired_seqs[0]] == ["A", "C"]
     assert [get_str_seq(s) for s in paired_seqs[1]] == ["T", "G"]
     assert len(paired_seqs) == 2
Exemplo n.º 7
0
 def test_empty_iter():
     paired_seqs = list(group_seqs_in_pairs([]))
     assert not paired_seqs
Exemplo n.º 8
0
 def test_empty_iter():
     paired_seqs = list(group_seqs_in_pairs([]))
     assert not paired_seqs