Exemplo n.º 1
0
def _match_pairs_from_sorted_reads(sorted_reads):
    prev_reads = []
    prev_reads_name = None
    prev_reads_directions = []
    #{'read': None, 'name': None, 'direction': None}
    for read in sorted_reads:
        title = get_title(read)
        try:
            name, direction = _parse_pair_direction_and_name_from_title(title)
        except PairDirectionError:
            name, direction = None, None

        if direction is not None and prev_reads_name is None:
            prev_reads = [read]
            prev_reads_name = name
            prev_reads_directions = [direction]
            continue
        elif direction is None:
            if prev_reads:
                yield prev_reads
                prev_reads = []
                prev_reads_name = None
                prev_reads_directions = []
            yield [read]
        elif name == prev_reads_name:
            if direction == REV:
                prev_reads.append(read)
                prev_reads_directions.append(direction)
            else:
                prev_reads.insert(0, read)
                prev_reads_directions.insert(0, direction)
        else:
            if prev_reads:
                yield prev_reads
            prev_reads = [read]
            prev_reads_name = name
            prev_reads_directions = [direction]
    if prev_reads:
        yield prev_reads
Exemplo n.º 2
0
 def _key(seq):
     return get_title(seq)
Exemplo n.º 3
0
def _parse_pair_direction_and_name(seq):
    'It parses the description field to get the name and the pair direction'
    return _parse_pair_direction_and_name_from_title(get_title(seq))
Exemplo n.º 4
0
def _parse_pair_direction_and_name(seq):
    'It parses the description field to get the name and the pair direction'
    return _parse_pair_direction_and_name_from_title(get_title(seq))
Exemplo n.º 5
0
 def _key(seq):
     return get_title(seq)