Did I find the right examples for you? yes no      Crawl my project      Python Jobs

All Samples(12)  |  Call(9)  |  Derive(0)  |  Import(3)
It detects the unmasked regions of a sequence

It returns a list of (start, end) tuples

        def get_uppercase_segments(string):
    '''It detects the unmasked regions of a sequence

    It returns a list of (start, end) tuples'''
    start = 0
    for is_upper, group in itertools.groupby(string, lambda x: x.isupper()):
        group = list(group)
        end = start + len(group) - 1
        if is_upper:
            yield start, end
        start = end + 1
        


src/s/e/seq_crumbs-HEAD/crumbs/filters.py   seq_crumbs(Download)
from crumbs.utils.tags import (SEQS_PASSED, SEQS_FILTERED_OUT, SEQITEM,
                               SEQRECORD, CHIMERA, NON_CHIMERIC, UNKNOWN)
from crumbs.utils.seq_utils import uppercase_length, get_uppercase_segments
from crumbs.seq import get_name, get_file_format, get_str_seq, get_length,\
    SeqItem
            str_seq = str(seq_object.seq)
            seg_quals = [quals[segment[0]: segment[1] + 1]
                            for segment in get_uppercase_segments(str_seq)]
            qual = sum(sum(q) * len(q) for q in seg_quals) / len(quals)
        else:

src/s/e/seq_crumbs-HEAD/crumbs/trim.py   seq_crumbs(Download)
                               VECTOR, TRIMMING_KINDS, SEQS_PASSED,
                               ORPHAN_SEQS)
from crumbs.utils.seq_utils import get_uppercase_segments
from crumbs.seq import (copy_seq, get_str_seq, get_annotations, get_length,
                        slice_seq, get_int_qualities, get_name)
    def _do_trim(self, seq):
        str_seq = get_str_seq(seq)
        unmasked_segments = get_uppercase_segments(str_seq)
        segment = get_longest_segment(unmasked_segments)
        if segment is not None:

src/s/e/seq_crumbs-HEAD/test/test_seq_utils.py   seq_crumbs(Download)
from crumbs.utils.bin_utils import BIN_DIR
from crumbs.utils.file_utils import fhand_is_seekable, wrap_in_buffered_reader
from crumbs.utils.seq_utils import (uppercase_length, ChangeCase,
                                    get_uppercase_segments)
from crumbs.utils.tags import SWAPCASE, UPPERCASE, LOWERCASE, SEQRECORD
    def test_masked_locations():
        'It test the masked locations function'
 
        assert list(get_uppercase_segments('aaATTTTTTaa')) == [(2, 8)]
 
        assert list(get_uppercase_segments('aaATTTaTTaa')) == [(2, 5), (7, 8)]
 
        assert list(get_uppercase_segments('AAATaaa')) == [(0, 3)]
 
        assert list(get_uppercase_segments('aaaaAAAA')) == [(4, 7)]