Get all HSPs for all the alignments for all titles.

        @return: A generator yielding L{dark.hsp.HSP} instances.
970895
def hsps(self):
        
        return (hsp for titleAlignments in self.values()
                for alignment in titleAlignments for hsp in alignment.hsps)
647234
public List<String> eachText() {
        ArrayList<String> texts = new ArrayList<>(size());
        for (Element el: this) {
            if (el.hasText())
                texts.add(el.text());
        }
        return texts;
    }
1348655
def get_completerlib():
    
    #-----------------------------------------------------------------------------
    #  Copyright (C) 2010-2011 The IPython Development Team.
    #
    #  Distributed under the terms of the BSD License.
    #
    #  The full license is in the file COPYING.txt, distributed with this software.
    #-----------------------------------------------------------------------------

    #-----------------------------------------------------------------------------
    # Imports
    #-----------------------------------------------------------------------------
    #from __future__ import print_function

    import inspect
    import os
    #import re
    #import sys

    try:
        # Python >= 3.3
        from importlib.machinery import all_suffixes
        _suffixes = all_suffixes()
    except ImportError:
        from imp import get_suffixes
        _suffixes = [ s[0] for s in get_suffixes() ]

    # Third-party imports
    from time import time
    from zipimport import zipimporter

    TIMEOUT_STORAGE = 2

    TIMEOUT_GIVEUP = 20

    # Regular expression for the python import statement
    import_re = re.compile(r'(?P<name>[a-zA-Z_][a-zA-Z0-9_]*?)'
                           r'(?P<package>[/\\]__init__)?'
                           r'(?P<suffix>%s)$' %
                           r'|'.join(re.escape(s) for s in _suffixes))

    # RE for the ipython %run command (python + ipython scripts)
    magic_run_re = re.compile(r'.*(\.ipy|\.ipynb|\.py[w]?)$')

    def module_list(path):
        """
        Return the list containing the names of the modules available in the given
        folder.
        """
        # sys.path has the cwd as an empty string, but isdir/listdir need it as '.'
        if path == '':
            path = '.'

        # A few local constants to be used in loops below
        pjoin = os.path.join

        if os.path.isdir(path):
            # Build a list of all files in the directory and all files
            # in its subdirectories. For performance reasons, do not
            # recurse more than one level into subdirectories.
            files = []
            for root, dirs, nondirs in os.walk(path):
                subdir = root[len(path)+1:]
                if subdir:
                    files.extend(pjoin(subdir, f) for f in nondirs)
                    dirs[:] = [] # Do not recurse into additional subdirectories.
                else:
                    files.extend(nondirs)

        else:
            try:
                files = list(zipimporter(path)._files.keys())
            except:
                files = []

        # Build a list of modules which match the import_re regex.
        modules = []
        for f in files:
            m = import_re.match(f)
            if m:
                modules.append(m.group('name'))
        return list(set(modules))


    def get_root_modules():
        """
        Returns a list containing the names of all the modules available in the
        folders of the pythonpath.

        ip.db['rootmodules_cache'] maps sys.path entries to list of modules.
        """
        #ip = get_ipython()
        #rootmodules_cache = ip.db.get('rootmodules_cache', {})
        rootmodules_cache = {}
        rootmodules = list(sys.builtin_module_names)
        start_time = time()
        #store = False
        for path in sys.path:
            try:
                modules = rootmodules_cache[path]
            except KeyError:
                modules = module_list(path)
                try:
                    modules.remove('__init__')
                except ValueError:
                    pass
                if path not in ('', '.'): # cwd modules should not be cached
                    rootmodules_cache[path] = modules
                if time() - start_time > TIMEOUT_STORAGE and not store:
                    #store = True
                    #print("\nCaching the list of root modules, please wait!")
                    #print("(This will only be done once - type '%rehashx' to "
                          #"reset cache!)\n")
                    sys.stdout.flush()
                if time() - start_time > TIMEOUT_GIVEUP:
                    print("This is taking too long, we give up.\n")
                    return []
            rootmodules.extend(modules)
        #if store:
            #ip.db['rootmodules_cache'] = rootmodules_cache
        rootmodules = list(set(rootmodules))
        return rootmodules


    def is_importable(module, attr, only_modules):
        if only_modules:
            return inspect.ismodule(getattr(module, attr))
        else:
            return not(attr[:2] == '__' and attr[-2:] == '__')


    def try_import(mod, only_modules=False):
        try:
            m = __import__(mod)
        except:
            return []
        mods = mod.split('.')
        for module in mods[1:]:
            m = getattr(m, module)

        m_is_init = hasattr(m, '__file__') and '__init__' in m.__file__

        completions = []
        if (not hasattr(m, '__file__')) or (not only_modules) or m_is_init:
            completions.extend( [attr for attr in dir(m) if
                                 is_importable(m, attr, only_modules)])

        completions.extend(getattr(m, '__all__', []))
        if m_is_init:
            completions.extend(module_list(os.path.dirname(m.__file__)))
        completions = set(completions)
        if '__init__' in completions:
            completions.remove('__init__')
        return list(completions)


    def module_completion(line):
        """
        Returns a list containing the completion possibilities for an import line.

        The line looks like this :
        'import xml.d'
        'from xml.dom import'
        """

        words = line.split(' ')
        nwords = len(words)

        # from whatever <tab> -> 'import '
        if nwords == 3 and words[0] == 'from':
            return ['import ']

        # 'from xy<tab>' or 'import xy<tab>'
        if nwords < 3 and (words[0] in ['import','from']) :
            if nwords == 1:
                return get_root_modules()
            mod = words[1].split('.')
            if len(mod) < 2:
                return get_root_modules()
            completion_list = try_import('.'.join(mod[:-1]), True)
            return ['.'.join(mod[:-1] + [el]) for el in completion_list]

        # 'from xyz import abc<tab>'
        if nwords >= 3 and words[0] == 'from':
            mod = words[1]
            return try_import(mod)

    return module_completion, module_list
297588
def _get_alignment_lines(self):
        ''' '''

        # Strip the boilerplate lines
        lines = self.alignment_output.split("\n")
        assert(lines[0].startswith('CLUSTAL'))
        lines = '\n'.join(lines[1:]).lstrip().split('\n')

        # The sequence IDs should be unique. Reassert this here
        assert(len(self.sequence_ids.values()) == len(set(self.sequence_ids.values())))

        # Create the list of sequence IDs
        id_list = [v for k, v in sorted(self.sequence_ids.iteritems())]

        # Determine the indentation level
        first_id = id_list[0]
        header_regex = re.compile("(.*?\s+)(.*)")
        alignment_regex = re.compile("^([A-Z\-]+)\s*$")
        mtchs = header_regex.match(lines[0])
        assert(mtchs.group(1).strip() == first_id)
        indentation = len(mtchs.group(1))
        sequence = mtchs.group(2)
        assert(sequence)
        assert(alignment_regex.match(sequence))

        # Create empty lists for the sequences
        sequences = {}
        for id in id_list:
            sequences[id] = []
        sequences[-1] = []

        # Get the lists of sequences
        num_ids = len(id_list)
        for x in range(0, len(lines), num_ids + 2):
            for y in range(num_ids):
                id = id_list[y]
                assert(lines[x + y][:indentation].strip() == id)
                assert(lines[x + y][indentation - 1] == ' ')
                sequence = lines[x + y][indentation:].strip()
                assert(alignment_regex.match(sequence))
                sequences[id].append(sequence)

            # Get the length of the sequence lines
            length_of_sequences = list(set(map(len, [v[-1] for k, v in sequences.iteritems() if k != -1])))
            assert(len(length_of_sequences) == 1)
            length_of_sequences = length_of_sequences[0]

            # Parse the Clustal match line
            assert(lines[x + num_ids][:indentation].strip() == '')
            match_sequence = lines[x + num_ids][indentation:indentation + length_of_sequences]
            assert(match_sequence.strip() == lines[x + num_ids].strip())
            assert(lines[x + y][indentation - 1] == ' ')
            sequences[-1].append(match_sequence)

            # Check for the empty line
            assert(lines[x + num_ids + 1].strip() == '')

        # Create the sequences, making sure that all sequences are the same length
        lengths = set()
        for k, v in sequences.iteritems():
            sequences[k] = "".join(v)
            lengths.add(len(sequences[k]))
        assert(len(lengths) == 1)

        return sequences
1137466
def extract_match(self, list_title_matches):
        
        # Create a set of the extracted titles
        list_title_matches_set = set(list_title_matches)

        list_title_count = []
        # Count how often a title was matched and safe as tuple in list.
        for match in list_title_matches_set:
            list_title_count.append((list_title_matches.count(match), match))

        if list_title_count and max(list_title_count)[0] != min(list_title_count)[0]:
            return max(list_title_count)[1]

        return None
866934
def filterOverlappingAlignments(alignments):
    
    l = []
    alignments = alignments[:]
    sortAlignments(alignments)
    alignments.reverse()
    for pA1 in alignments:
        for pA2 in l:
            if pA1.contig1 == pA2.contig1 and getPositiveCoordinateRangeOverlap(pA1.start1+1, pA1.end1, pA2.start1+1, pA2.end1) is not None: #One offset, inclusive coordinates
                break
            if pA1.contig2 == pA2.contig2 and getPositiveCoordinateRangeOverlap(pA1.start2+1, pA1.end2, pA2.start2+1, pA2.end2) is not None: #One offset, inclusive coordinates
                break
            if pA1.contig2 == pA2.contig1 and getPositiveCoordinateRangeOverlap(pA1.start2+1, pA1.end2, pA2.start1+1, pA2.end1) is not None: #One offset, inclusive coordinates
                break
            if pA1.contig1 == pA2.contig2 and getPositiveCoordinateRangeOverlap(pA1.start1+1, pA1.end1, pA2.start2+1, pA2.end2) is not None: #One offset, inclusive coordinates
                break
        else:
            l.append(pA1)
    l.reverse()
    return l
1331359
public List<SequenceGenerator<EntityMappings<T>>> getAllSequenceGenerator()
   {
      List<SequenceGenerator<EntityMappings<T>>> list = new ArrayList<SequenceGenerator<EntityMappings<T>>>();
      List<Node> nodeList = childNode.get("sequence-generator");
      for(Node node: nodeList)
      {
         SequenceGenerator<EntityMappings<T>>  type = new SequenceGeneratorImpl<EntityMappings<T>>(this, "sequence-generator", childNode, node);
         list.add(type);
      }
      return list;
   }
149430
def copy(self):
        ''' 

        '''
        return HSL(self.h, self.s, self.l, self.a)
938591
public List<MimeMappingType<WebFragmentDescriptor>> getAllMimeMapping()
   {
      List<MimeMappingType<WebFragmentDescriptor>> list = new ArrayList<MimeMappingType<WebFragmentDescriptor>>();
      List<Node> nodeList = model.get("mime-mapping");
      for(Node node: nodeList)
      {
         MimeMappingType<WebFragmentDescriptor>  type = new MimeMappingTypeImpl<WebFragmentDescriptor>(this, "mime-mapping", model, node);
         list.add(type);
      }
      return list;
   }
952927
def wrapped_setups(self):
        """"""
        lst = []
        for group in self.all_groups:
            if not group.root:
                if group.has_after_each:
                    lst.extend(self.tokens.wrap_after_each(group.kls_name, group.async_after_each))

                if group.has_before_each:
                    lst.extend(self.tokens.wrap_before_each(group.kls_name, group.async_before_each))

        if lst:
            indentation_reset = [
                  (NEWLINE, '\n')
                , (INDENT, '')
                ]
            lst = indentation_reset + lst

        return lst
326416
def allExpressionLevels(self):
        
        for dataset in self.getDatasets():
            for rnaQuantificationSet in dataset.getRnaQuantificationSets():
                for rnaQuantification in \
                        rnaQuantificationSet.getRnaQuantifications():
                    for expressionLevel in \
                            rnaQuantification.getExpressionLevels():
                        yield expressionLevel
1220722
def getRegexpsByName(regexpNames = ['all']):
    ''' 
        
    '''

    allRegexpList = getAllRegexp()
    if 'all' in regexpNames:
        return allRegexpList

    regexpList = []
    # going through the regexpList 
    for name in regexpNames:
        for r in allRegexpList:
            if name == r.name:
                regexpList.append(r)
    return regexpList
691458
public List<Tag> getAllTags()
    {
        List <Tag> ret = new Vector<Tag>(taggers.size());
        for (Tagger tagger : taggers)
            ret.add(tagger.getTag());
        return ret;
    }
466383
def findall(self, title=None):
        
        if title is None:
            return list(self._sheets)
        if title not in self._titles:
            return []
        return list(self._titles[title])
961342
def adjustHspsForPlotting(self, titleAlignments):
        
        # If we're using bit scores, there's nothing to do.
        if self.scoreClass is HigherIsBetterScore:
            return

        # Convert all e-values to high positive values, and keep track of the
        # maximum converted value.
        maxConvertedEValue = None
        zeroHsps = []

        # Note: don't call self.hsps() here because that will read them
        # from disk again, which is not what's wanted.
        for hsp in titleAlignments.hsps():
            if hsp.score.score == 0.0:
                zeroHsps.append(hsp)
            else:
                convertedEValue = -1.0 * log10(hsp.score.score)
                hsp.score.score = convertedEValue
                if (maxConvertedEValue is None or
                        convertedEValue > maxConvertedEValue):
                    maxConvertedEValue = convertedEValue

        if zeroHsps:
            # Save values so that we can use them in self.adjustPlot
            self._maxConvertedEValue = maxConvertedEValue
            self._zeroEValueFound = True

            # Adjust all zero e-value HSPs to have numerically high values.
            if self.randomizeZeroEValues:
                for hsp in zeroHsps:
                    hsp.score.score = (maxConvertedEValue + 2 + uniform(
                        0, ZERO_EVALUE_UPPER_RANDOM_INCREMENT))
            else:
                for count, hsp in enumerate(zeroHsps, start=1):
                    hsp.score.score = maxConvertedEValue + count
        else:
            self._zeroEValueFound = False
1161311
def links(self):
    '''
    
    '''

    if not getattr(self, '_links', False):
      self._links = [
        link['title']
        for link in self.__continued_query({
          'prop': 'links',
          'plnamespace': 0,
          'pllimit': 'max'
        })
      ]

    return self._links
1326932
private static List<AbstractWarningsParser> getAllParsers() {
        List<AbstractWarningsParser> parsers = Lists.newArrayList();
        parsers.add(new MsBuildParser(Messages._Warnings_PCLint_ParserName(),
                            Messages._Warnings_PCLint_LinkName(),
                            Messages._Warnings_PCLint_TrendName()));

        if (PluginDescriptor.isPluginInstalled("violations")) {
            ViolationsRegistry.addParsers(parsers);
        }
        Iterable<GroovyParser> parserDescriptions = getDynamicParserDescriptions();
        parsers.addAll(getDynamicParsers(parserDescriptions));
        parsers.addAll(all());

        return ImmutableList.copyOf(parsers);
    }