Searches ChEBI via ols.
484367
def search(term, exact=False, rows=1e6):
    ''''''
    url = 'https://www.ebi.ac.uk/ols/api/search?ontology=chebi' + \
        '&exact=' + str(exact) + '&q=' + term + \
        '&rows=' + str(int(rows))

    response = requests.get(url)
    data = response.json()

    return [ChebiEntity(doc['obo_id']) for doc in data['response']['docs']]
39701
def search(self, query, locations: list=None):
        '''
        '''
        cas_number = re.search(r"\b[1-9]{1}[0-9]{1,5}-\d{2}-\d\b", str(query))
        if cas_number:
            query = cas_number[0]
            search_type = 'cas'   
        else:
            try:
                query = int(query)
                search_type = 'barcode'
            except ValueError:
                query = f"%{query}%"
                search_type = 'name'
        if not locations:
            locations = self.get_locations(filter_to_my_group=True)
            locations = [loc.inventory_id for loc in locations]
        data = {
            'groupid': self.groupid,
            'searchtype': search_type,
            'searchterm':  query,
            'limitlocations': locations.append(1)
        }
        r = self._post('search-search', referer_path='search', data=data)
        
        #return a list of container objects
        if r['searchresults']['containers']:
            containers = []
            for container in r['searchresults']['containers']:
                loc = Location(name=container.get('location'))
                ct = Container(
                    inventory_id = container.get('id'), 
                    compound_id = container.get('sid'),
                    name=container.get('containername'),
                    location=loc,
                    size=container.get('size'),
                    smiles=container.get('smiles'),
                    cas=container.get('cas'),
                    comments=container.get('comments'),
                    barcode=container.get('barcode'),
                    supplier=container.get('supplier'),
                    date_acquired=container.get('dateacquired'),
                    owner=container.get('owner'))
                containers.append(ct)
            return containers
        else:
            return []
866193
def lookups(self):
        ""
        for filter in self._filters:
            yield filter.key, filter.display, filter.no_argument
114190
def search_prospects(self, search_type, query, offset=None, orgoffset=None):
        
        
        params = {'q': query}
        if offset and orgoffset:
            params['orgOffset'] = orgoffset
            params['timeOffset'] = offset
          
        return self._call('search/%s' % search_type, params)
1116214
def run_with_search(model_path, config, num_days):
    """"""
    from indra.tools.machine.machine import run_with_search_helper
    run_with_search_helper(model_path, config, num_days=num_days)
480878
def find(query):
    
    assert type(query) == str or type(query) == str, 'query not a string object'
    searchurl = 'http://www.chemspider.com/Search.asmx/SimpleSearch?query=%s&token=%s' % (urlquote(query), TOKEN)
    response = urlopen(searchurl)
    tree = ET.parse(response)
    elem = tree.getroot()
    csid_tags = elem.getiterator('{http://www.chemspider.com/}int')
    compoundlist = []
    for tag in csid_tags:
        compoundlist.append(Compound(tag.text))
    return compoundlist if compoundlist else None
1182343
def get_all_compound_origins(chebi_ids):
    ''''''
    all_compound_origins = [get_compound_origins(chebi_id)
                            for chebi_id in chebi_ids]
    return [x for sublist in all_compound_origins for x in sublist]
783037
private static int unsignedBinarySearch(int[] a, int fromIndex, int toIndex, int key,
      Comparator<? super Integer> c) {
    int low = fromIndex;
    int high = toIndex - 1;

    while (low <= high) {
      int mid = (low + high) >>> 1;
      int midVal = a[mid];
      int cmp = c.compare(midVal, key);
      if (cmp < 0) {
        low = mid + 1;
      } else if (cmp > 0) {
        high = mid - 1;
      } else {
        return mid; // key found
      }
    }
    return -(low + 1); // key not found.
  }
952088
def get_all_incomings(chebi_ids):
    ''''''
    all_incomings = [get_incomings(chebi_id) for chebi_id in chebi_ids]
    return [x for sublist in all_incomings for x in sublist]
174799
private void scanAllAsearchB() {
    final long[] scanAArr = a_.getCache();
    final int arrLongsIn = scanAArr.length;
    cache_ = new long[arrLongsIn];
    for (int i = 0; i < arrLongsIn; i++ ) {
      final long hashIn = scanAArr[i];
      if ((hashIn <= 0L) || (hashIn >= thetaLong_)) { continue; }
      final int foundIdx = hashSearch(bHashTable_, lgArrLongsHT_, hashIn);
      if (foundIdx > -1) { continue; }
      cache_[curCount_++] = hashIn;
    }
  }
490248
@Override
    public synchronized void searchMCS(boolean shouldMatchBonds) {
        List<List<Integer>> mappings = null;
        try {
            if (source.getAtomCount() >= target.getAtomCount()) {
                mappings = new MCSPlus().getOverlaps(source, target, shouldMatchBonds);
            } else {
                flagExchange = true;
                mappings = new MCSPlus().getOverlaps(target, source, shouldMatchBonds);
            }
            PostFilter.filter(mappings);
            setAllMapping();
            setAllAtomMapping();
            setFirstMapping();
            setFirstAtomMapping();
        } catch (CDKException e) {
            mappings = null;
        }
    }
330349
private int findGreater(
    SearchComparator  comp,
    int               lower,
    int               upper,
    Object            searchKey)
  {
    int nkeys = numKeys(lower, upper);
    int idx = -1;
    if (nkeys < 4)
      idx = sequentialSearchGreater(comp, lower, upper, searchKey);
    else
      idx = binarySearchGreater(comp, lower, upper, searchKey);
    return idx;
  }
1122107
private int search(Object[] keys, Object toFind)
    {
        for (int i = 0; i < keys.length; ++i)
        {
            if (toFind == null)
            {
                if (keys[i] == null)
                    return i;
            }
            else if (toFind.equals(keys[i]))
                return i;
        }
        return -1; // niets gevonden
    }
954692
def search(self):
        """"""

        for cb in SearchUrl.search_callbacks:

            try:
                v = cb(self)
                if v is not None:
                    return v
            except Exception as e:
                raise
1254573
def get_all_modified_on(chebi_ids):
    ''''''
    all_modified_ons = [get_modified_on(chebi_id) for chebi_id in chebi_ids]
    all_modified_ons = [modified_on for modified_on in all_modified_ons
                        if modified_on is not None]
    return None if len(all_modified_ons) == 0 else sorted(all_modified_ons)[-1]
434765
def _extract_lookup(self, key):
        """"""
        parts = key.split('__')
        # 'exact' is the default lookup if there was no explicit comparison op in `key`
        #   Assume there is only one `__` in the key.
        #   FIXME Change for child attribute query support
        op = 'exact' if len(parts) == 1 else parts[1]

        # Construct and assign the lookup class as a filter criteria
        return parts[0], self.get_lookup(op)
109908
def get_all_names(chebi_ids):
    ''''''
    all_names = [get_names(chebi_id) for chebi_id in chebi_ids]
    return [x for sublist in all_names for x in sublist]