Filter the records, keeping only sequences whose ID is contained in the
    handle.
961099
def include_from_file(records, handle):
    
    ids = set(i.strip() for i in handle)

    for record in records:
        if record.id.strip() in ids:
            yield record
688607
def filter_by_key(self, keys, ID=None):
        
        keys = to_list(keys)
        fil = lambda x: x in keys
        if ID is None:
            ID = self.ID
        return self.filter(fil, applyto='keys', ID=ID)
55932
def prune_empty(records):
    
    for record in records:
        if not all(c == '-' for c in str(record.seq)):
            yield record
1248211
def strip_range(records):
    
    logging.info('Applying _strip_range generator: '
                 'removing /<start>-<stop> ranges from IDs')
    # Split up and be greedy.
    cut_regex = re.compile(r"(?P<id>.*)\/(?P<start>\d+)\-(?P<stop>\d+)")
    for record in records:
        name = record.id
        match = cut_regex.match(str(record.id))
        if match:
            sequence_id = match.group('id')
            start = int(match.group('start'))
            stop = int(match.group('stop'))
            if start > 0 and start <= stop:
                name = sequence_id
        yield SeqRecord(record.seq, id=name,
                        description='')
749382
protected function filterRecords()
    {
        if ($this->autoFilter && $this->request->isSearchable()) {
            $this->filtering();
        }

        if (is_callable($this->filterCallback)) {
            call_user_func($this->filterCallback, $this->resolveCallbackParameter());
        }

        $this->columnSearch();
        $this->filteredRecords = $this->isFilterApplied ? $this->filteredCount() : $this->totalRecords;
    }
288641
def filter_archives(ctx, prefix, pattern, engine):
    '''
    
    '''

    _generate_api(ctx)

    # want to achieve behavior like click.echo(' '.join(matches))

    for i, match in enumerate(ctx.obj.api.filter(
            pattern, engine, prefix=prefix)):

        click.echo(match, nl=False)
        print('')
132148
def filter_by_ids(original_list, ids_to_filter):
    """"""
    if not ids_to_filter:
        return original_list

    return [i for i in original_list if i['id'] in ids_to_filter]
459104
function _filterResidues(chain, dict) {
  var residues = chain.residues();
  if (dict.rnumRange) {
    residues =
        chain.residuesInRnumRange(dict.rnumRange[0], dict.rnumRange[1]);
  }
  var selResidues = [], i, e;
  if (dict.rindexRange !== undefined) {
    for (i = dict.rindexRange[0],
        e = Math.min(residues.length - 1, dict.rindexRange[1]);
        i <= e; ++i) {
      selResidues.push(residues[i]);
    }
    return selResidues;
  } 
  if (dict.rindices) {
    if (dict.rindices.length !== undefined) {
      selResidues = [];
      for (i = 0; i < dict.rindices.length; ++i) {
        selResidues.push(residues[dict.rindices[i]]);
      }
      return selResidues;
    }
  }
  return residues;
}
996217
def get_records(cls, ids, with_deleted=False):
        
        with db.session.no_autoflush:
            query = RecordMetadata.query.filter(RecordMetadata.id.in_(ids))
            if not with_deleted:
                query = query.filter(RecordMetadata.json != None)  # noqa

            return [cls(obj.json, model=obj) for obj in query.all()]
1080500
def filter(self, table, snapshots, filter_string):
        """"""
        query = filter_string.lower()
        return [snapshot for snapshot in snapshots
                if query in snapshot.name.lower()]
329380
def filter_sequences(self, seq_type):
        
        return DictList(x for x in self.sequences if isinstance(x, seq_type))
268221
def filter(self, table, cgroups, filter_string):
        """"""
        query = filter_string.lower()
        return [cgroup for cgroup in cgroups
                if query in cgroup.name.lower()]
918279
def delete_all(self): 
        
        for record in self.find(using_name=False, data_only=True):
            res = self.delete_one(record["id"])
247808
def excluding(self, sequence) -> Generator:
        """"""
        return (element for element in sequence
                if self.indexer(element) not in self.predicates)
42045
def filter(self, table, keypairs, filter_string):
        """"""
        query = filter_string.lower()
        return [keypair for keypair in keypairs
                if query in keypair.name.lower()]
1372206
function(pids) {
  
  var sequence_length = pids[0].seq.length;
  
  var sequence = [];
  
  var sPids = pids.sortBy(function(e){
    return e.seq.count(1);
  },true);
  
  for (var i = 0; i < sequence_length + 1; i++) {
    sPids.forEach(function(e){
      if( e.seq[i] == 1 ) {
        sequence.push(e.pid);
      }
    });
  };
  
  return sequence;
}
1154833
def join_filter(sep, seq, pred=bool):
    
    return sep.join([text_type(i) for i in seq if pred(i)])