Filters mentions that are proteins
978250
public static Collection<BioEntityMention> getProteins(
            Collection<BioEntityMention> mentions) {
        ArrayList<BioEntityMention> ret = new ArrayList<BioEntityMention>();
        for (BioEntityMention mention : mentions) {
            if (mention.getSpecificType() != null
                    && mention.getSpecificType().startsWith("G#protein"))
                ret.add(mention);
        }
        return ret;
    }
1154833
def join_filter(sep, seq, pred=bool):
    
    return sep.join([text_type(i) for i in seq if pred(i)])
328412
function filter(file) {
    if (files.indexOf(file) !== -1) return false;
    let include = true;
    regexs.forEach((regex) => {
      if (file.search(regex) !== -1) include = false;
    });
    return include;
  }
268221
def filter(self, table, cgroups, filter_string):
        """"""
        query = filter_string.lower()
        return [cgroup for cgroup in cgroups
                if query in cgroup.name.lower()]
1203636
def _filter_contains(self, term, field_name, field_type, is_not):
        
        if field_type == 'text':
            term_list = term.split()
        else:
            term_list = [term]

        query = self._or_query(term_list, field_name, field_type)
        if is_not:
            return xapian.Query(xapian.Query.OP_AND_NOT, self._all_query(), query)
        else:
            return query
1088946
function filterSelectors (predicate) {
  if (this._other) {
    const [a, b] = splitFilter(this.selectors, this._other.selectors, predicate);
    this.selectors = a;
    this._other.selectors = b;
  } else {
    this.selectors = this.selectors.filter(predicate);
  }
}
577418
def should_filter(items):
    
    return (vcfutils.get_paired(items) is not None and
            any("damage_filter" in dd.get_tools_on(d) for d in items))
851113
def parse_proteins(self,OrganismDB):

        '''
        
        '''

        for org in OrganismDB.organisms:
            for prot in org.proteins:
                if len(prot.hmm_hit_list) > 0:
                    try:
                        prot.hit_dataframe = prot.parse_hmm_hit_list(prot.hmm_hit_list)
                    except ValueError,e:
                        print 'error for', org.name, prot.accession, str(e)
448267
function filterStylesheetsWithSameHref(sheets) {
	let hrefs = [];
	return sheets.filter(sheet => {
		if (!sheet.href) {
			// include sheets without `href`
			return true;
		}
		// if `href` is present, ensure they are not duplicates
		if (hrefs.includes(sheet.href)) {
			return false;
		}
		hrefs.push(sheet.href);
		return true;
	});
}
428374
def parse_filters():
    """"""
    genes_str = request.args.get('gene_symbol')
    filters = {}
    for key in ('frequency', 'cadd', 'sv_len'):
        try:
            filters[key] = float(request.args.get(key))
        except (ValueError, TypeError):
            pass

    filters['gene_symbols'] = genes_str.split(',') if genes_str else None
    filters['selected_models'] = request.args.getlist('inheritance_models')
    filters['selected_consequences'] = request.args.getlist('consequences')
    filters['selected_sv_types'] = request.args.getlist('sv_types')
    filters['skip'] = int(request.args.get('skip', 0))
    filters['gene_lists'] = request.args.getlist('gene_lists')
    filters['gemini_query'] = (request.args.get('gemini_query') or
                               request.args.get('preset_gemini_query'))
    filters['impact_severities'] = request.args.getlist('impact_severities')
    filters['range'] = None

    if request.args.get('range'):
        chromosome, raw_pos = request.args.get('range').split(':')
        start, end = map(int, raw_pos.split('-'))
        filters['range'] = {'chromosome': chromosome, 'start': start,
                            'end': end}

    filters['query_dict'] = {key: request.args.getlist(key) for key
                             in request.args.keys()}
    filters['query_dict'].update({'skip': (filters['skip'] + 30)})

    return filters
351910
def _check_filter_includes(self, includes: list, resource: str = "metadata"):
        
        # check resource parameter
        if resource == "metadata":
            ref_subresources = _SUBRESOURCES_MD
        elif resource == "keyword":
            ref_subresources = _SUBRESOURCES_KW
        else:
            raise ValueError("Must be one of: metadata | keyword.")

        # sub resources manager
        if isinstance(includes, str) and includes.lower() == "all":
            includes = ",".join(ref_subresources)
        elif isinstance(includes, list):
            if len(includes) > 0:
                includes = ",".join(includes)
            else:
                includes = ""
        else:
            raise TypeError("'includes' expect a list or a str='all'")
        return includes
759627
def get_proteins_from_psm(line):
    """"""
    proteins = line[mzidtsvdata.HEADER_PROTEIN].split(';')
    outproteins = []
    for protein in proteins:
        prepost_protein = re.sub('\(pre=.*post=.*\)', '', protein).strip()
        outproteins.append(prepost_protein)
    return outproteins
275460
def filter_host_by_tag(tpl):
    

    def inner_filter(items):
        """Inner filter for host. Accept if tag in host.tags"""
        host = items["host"]
        if host is None:
            return False
        return tpl in [t.strip() for t in host.tags]

    return inner_filter
1129581
def _title(self):
        
        return (
            'Overall, proteins from %d pathogen%s were found in %d sample%s.' %
            (len(self.pathogenNames),
             '' if len(self.pathogenNames) == 1 else 's',
             len(self.sampleNames),
             '' if len(self.sampleNames) == 1 else 's'))
689362
def filter(subtags):
        
        if not isinstance(subtags, list):
            subtags = [subtags]
        return [subtag for subtag in subtags if len(tags.types(subtag)) == 0]
64015
def filter(self, table, groups, filter_string):
        """"""
        query = filter_string.lower()
        return [group for group in groups
                if query in group.name.lower()]
710072
def filter(self, table, idps, filter_string):
        """"""
        q = filter_string.lower()
        return [idp for idp in idps
                if q in idp.ud.lower()]