예제 #1
0
    def test_name_check(self):
        seqs = _build_some_paired_seqs()
        try:
            list(group_pairs(seqs, n_seqs_in_pair=4))
            self.fail('InterleaveError expected')
        except InterleaveError:
            pass

        seqs = _build_some_paired_seqs()
        paired_seqs = list(
            group_pairs(seqs, n_seqs_in_pair=4, check_name_matches=False))
        assert [get_str_seq(s) for s in paired_seqs[0]] == ['A', 'C', 'T', 'G']
예제 #2
0
    def test_name_check(self):
        seqs = _build_some_paired_seqs()
        try:
            list(group_pairs(seqs, n_seqs_in_pair=4))
            self.fail('InterleaveError expected')
        except InterleaveError:
            pass

        seqs = _build_some_paired_seqs()
        paired_seqs = list(group_pairs(seqs, n_seqs_in_pair=4,
                           check_name_matches=False))
        assert [get_str_seq(s) for s in paired_seqs[0]] == ['A', 'C', 'T', 'G']
예제 #3
0
    def test_n_seqs_check(self):
        seqs = _build_some_paired_seqs()
        seqs = seqs[:-1]
        try:
            list(group_pairs(seqs, n_seqs_in_pair=2))
            self.fail('InterleaveError expected')
        except InterleaveError:
            pass

        paired_seqs = list(group_pairs(seqs, n_seqs_in_pair=2,
                           check_all_same_n_seqs=False))
        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']
예제 #4
0
    def test_pair_grouper(self):
        seqs = _build_some_paired_seqs()
        paired_seqs = list(group_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

        seqs = _build_some_paired_seqs()
        paired_seqs = list(group_pairs(seqs, n_seqs_in_pair=1,
                           check_name_matches=True))
        assert [get_str_seq(s) for pair in paired_seqs for s in pair] == ['A',
                                                                 'C', 'T', 'G']
예제 #5
0
    def test_n_seqs_check(self):
        seqs = _build_some_paired_seqs()
        seqs = seqs[:-1]
        try:
            list(group_pairs(seqs, n_seqs_in_pair=2))
            self.fail('InterleaveError expected')
        except InterleaveError:
            pass

        paired_seqs = list(
            group_pairs(seqs, n_seqs_in_pair=2, check_all_same_n_seqs=False))
        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']
예제 #6
0
    def test_pair_grouper(self):
        seqs = _build_some_paired_seqs()
        paired_seqs = list(group_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

        seqs = _build_some_paired_seqs()
        paired_seqs = list(
            group_pairs(seqs, n_seqs_in_pair=1, check_name_matches=True))
        assert [get_str_seq(s) for pair in paired_seqs
                for s in pair] == ['A', 'C', 'T', 'G']
예제 #7
0
def _read_pairs(in_fhands, paired_reads):
    seqs = read_seqs(in_fhands, prefered_seq_classes=[SEQITEM])
    if paired_reads:
        pairs = group_pairs_by_name(seqs)
    else:
        pairs = group_pairs(seqs, n_seqs_in_pair=1)
    return pairs
예제 #8
0
def _read_pairs(in_fhands, paired_reads):
    seqs = read_seqs(in_fhands, prefered_seq_classes=[SEQITEM])
    if paired_reads:
        pairs = group_pairs_by_name(seqs)
    else:
        pairs = group_pairs(seqs, n_seqs_in_pair=1)
    return pairs
예제 #9
0
파일: trim.py 프로젝트: radaniba/seq_crumbs
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_pairs_by_name(packet))
        else:
            packet = list(group_pairs(packet, n_seqs_in_pair=1))
        yield {SEQS_PASSED: packet, ORPHAN_SEQS: []}
예제 #10
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_pairs_by_name(packet))
        else:
            packet = list(group_pairs(packet, n_seqs_in_pair=1))
        yield {SEQS_PASSED: packet, SEQS_FILTERED_OUT: []}
예제 #11
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_pairs_by_name(packet))
        else:
            packet = list(group_pairs(packet, n_seqs_in_pair=1))
        yield {SEQS_PASSED: packet, ORPHAN_SEQS: []}
예제 #12
0
 def test_empty_iter():
     paired_seqs = list(group_pairs([]))
     assert not paired_seqs
예제 #13
0
 def test_empty_iter():
     paired_seqs = list(group_pairs([]))
     assert not paired_seqs