Count how many of each type of variant a graph has.

    :param pybel.BELGraph graph: A BEL graph
    :rtype: Counter
485655
def count_variants(graph):
    
    return Counter(
        variant_data[KIND]
        for data in graph
        if has_variant(graph, data)
        for variant_data in data[VARIANTS]
    )
708307
def count_by_value_impl(sequence):
    
    counter = collections.Counter()
    for e in sequence:
        counter[e] += 1
    return six.viewitems(counter)
611505
def count_children(obj, type=None):
    """"""
    if type is None:
        return len(obj)
    else:
        # there doesn't appear to be any hdf5 function for getting this
        # information without inspecting each child, which makes this somewhat
        # slow
        return sum(1 for x in obj if obj.get(x, getclass=True) is type)
848134
def count_features_type(features):
        
    counter={k.name: v for k, v in features.columns.to_series().groupby(features.dtypes)}
    binary=0
    if ('int64' in counter):
        binary=len(set(features.loc[:, (features<=1).all(axis=0)].columns.values) 
                & set(features.loc[:, (features>=0).all(axis=0)].columns.values) 
                & set(counter['int64']))    
    return (binary,len(counter['int64'])-binary if 'int64' in counter else 0,len(counter['float64']) if 'float64' in counter else 0)
1219069
def count(self, value):
        
        cnt = 0
        for x in self:
            if x == value:
                cnt += 1
        return cnt
253649
def allele_counts_dataframe(variant_and_allele_reads_generator):
    
    df_builder = DataFrameBuilder(
        AlleleCount,
        extra_column_fns={
            "gene": lambda variant, _: ";".join(variant.gene_names),
        })
    for variant, allele_reads in variant_and_allele_reads_generator:
        counts = count_alleles_at_variant_locus(variant, allele_reads)
        df_builder.add(variant, counts)
    return df_builder.to_dataframe()
644390
def count(direction)
      i = 0
      node = self
      while (node != nil)
        node = node.send(direction)
        i += 1
      end
      i
    end
106729
def element_count(self):
        
        result = conf.lib.clang_getNumElements(self)
        if result < 0:
            raise Exception('Type does not have elements.')

        return result
1216622
def count_missense_per_gene(lines):
    
    
    counts = {}
    for x in lines:
        x = x.split("\t")
        gene = x[0]
        consequence = x[3]
        
        if gene not in counts:
            counts[gene] = 0
        
        if consequence != "missense_variant":
            continue
        
        counts[gene] += 1
    
    return counts
1371437
def count_operations(elements: Iterable[Operation]) \
        -> Dict[Type[Operation], int]:
    
    op_count: Dict[Type[Operation], int] = defaultdict(int)
    for elem in elements:
        op_count[type(elem)] += 1
    return dict(op_count)
1053858
def count(self, seqs, nreport=100, scan_rc=True):
        
        for matches in self.scan(seqs, nreport, scan_rc):
            counts = [len(m) for m in matches]
            yield counts
1052791
def count(self):
        
        ids, _, ngroups = self.grouper.group_info
        val = self.obj.get_values()

        mask = (ids != -1) & ~isna(val)
        ids = ensure_platform_int(ids)
        minlength = ngroups or 0
        out = np.bincount(ids[mask], minlength=minlength)

        return Series(out,
                      index=self.grouper.result_index,
                      name=self._selection_name,
                      dtype='int64')
517458
def num_species(self):
        
        all_headers = reduce(lambda x, y: set(x) | set(y),
                             (rec.get_names() for rec in self.records))
        return len(all_headers)
855638
def filter_nodes(graph: BELGraph, node_predicates: NodePredicates) -> Iterable[BaseEntity]:
    """"""
    concatenated_predicate = concatenate_node_predicates(node_predicates=node_predicates)
    for node in graph:
        if concatenated_predicate(graph, node):
            yield node
355244
def get_max_counts(samples):
    
    counts = []
    for data in (x[0] for x in samples):
        count = tz.get_in(["config", "algorithm", "callable_count"], data, 1)
        vcs = tz.get_in(["config", "algorithm", "variantcaller"], data, [])
        if isinstance(vcs, six.string_types):
            vcs = [vcs]
        if vcs:
            count *= len(vcs)
        counts.append(count)
    return max(counts)
481253
private void fillTableWithMatches(VariantGraphRanking ranking, VariantGraph graph, Iterable<Token> witness, Comparator<Token> comparator) {
        Matches matches = Matches.between(graph.vertices(), witness, comparator);
        Set<Token> unique = matches.uniqueInWitness;
        Set<Token> ambiguous = matches.ambiguousInWitness;
        int rowIndex = 0;
        for (Token t : witness) {
            if (unique.contains(t) || ambiguous.contains(t)) {
                List<VariantGraph.Vertex> matchingVertices = matches.allMatches.getOrDefault(t, Collections.emptyList());
                for (VariantGraph.Vertex vgv : matchingVertices) {
                    set(rowIndex, ranking.apply(vgv) - 1, t, vgv);
                }
            }
            rowIndex++;
        }
    }
375491
public int count(T x, T y, int count) {
        if (count < 1)
            throw new IllegalArgumentException("Count must be positive: " + count);
        long index = getIndex(x, y);
        int oldCount = counts.get(index);
        int newCount = count + oldCount;
        counts.put(index, newCount);
        sum += count;
        return newCount;
    }