Count called genotypes.

        Parameters
        ----------
        axis : int, optional
            Axis over which to count, or None to perform overall count.
187443
def count_called(self, axis=None):
        
        b = self.is_called()
        return np.sum(b, axis=axis)
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)
1281477
def all_but_axis(i, axis, num_axes):
    
    the_slice  = ()
    for j in range(num_axes):
        if j == axis:
            the_slice = the_slice + (i,)
        else:
            the_slice = the_slice + (slice(None),)
    return the_slice
659666
def maf(genotypes):
    
    warnings.warn("deprecated: use 'Genotypes.maf'", DeprecationWarning)
    g = genotypes.genotypes
    maf = np.nansum(g) / (2 * np.sum(~np.isnan(g)))
    if maf > 0.5:
        maf = 1 - maf
        return maf, False

    return maf, True
1282511
def _run_collect_allelic_counts(pos_file, pos_name, work_dir, data):
    
    out_dir = utils.safe_makedir(os.path.join(dd.get_work_dir(data), "structural", "counts"))
    out_file = os.path.join(out_dir, "%s-%s-counts.tsv" % (dd.get_sample_name(data), pos_name))
    if not utils.file_exists(out_file):
        with file_transaction(data, out_file) as tx_out_file:
            params = ["-T", "CollectAllelicCounts", "-L", pos_file, "-I", dd.get_align_bam(data),
                      "-R", dd.get_ref_file(data), "-O", tx_out_file]
            _run_with_memory_scaling(params, tx_out_file, data)
    return out_file
601119
def fix_line_problems(parts):
    
    varinfo = parts[:9]
    genotypes = []
    # replace haploid calls
    for x in parts[9:]:
        if len(x) == 1:
            x = "./."
        genotypes.append(x)
    if varinfo[3] == "0": varinfo[3] = "N"
    if varinfo[4] == "0": varinfo[4] = "N"
    return varinfo, genotypes
153005
public int geneCount() {
		int count = 0;
		for (int i = 0, n = _chromosomes.length(); i < n; ++i) {
			count += _chromosomes.get(i).length();
		}
		return count;
	}
543058
def count(self):
        
        try:
            num = len(self.df.index)
        except Exception as e:
            self.err(e, "Can not count data")
            return
        self.ok("Found", num, "rows in the dataframe")
443891
public static void getGenotype(int index, Integer alleles[]) {
//        index++;
//        double value = (-3 + Math.sqrt(1 + 8 * index)) / 2;    // slower than the iterating version, right?
//        alleles[1] = new Double(Math.ceil(value)).intValue();
//        alleles[0] = alleles[1] - ((alleles[1] + 1) * (alleles[1] +2) / 2 - index);

        int cursor = 0;
        final int MAX_ALLOWED_ALLELES = 100;   // should we allow more than 100 alleles?
        for (int i = 0; i < MAX_ALLOWED_ALLELES; i++) {
            for (int j = 0; j <= i; j++) {
                if (cursor == index) {
                    alleles[0] = j;
                    alleles[1] = i;
                    return;
                }
                cursor++;
            }
        }
    }
894404
def load_genotypes(self):
        


        if self.file_index < len(self.archives):
            self.current_file = self.archives[self.file_index]
            info_filename = self.current_file.replace(Parser.gen_ext, Parser.info_ext)
            if len(self.info_files) > 0:
                info_filename = self.info_files[self.file_index]
            self.info_file = open(info_filename)
            self.info_file.readline()   # Dump the header

            if DataParser.compressed_pedigree:
                self.freq_file = gzip.open("%s" % (self.current_file), 'rb')
            else:
                self.freq_file = open(self.current_file)
            self.current_chrom = self.chroms[self.file_index]
            self.file_index += 1
        else:
            raise StopIteration
293764
def standardize(self, axis=1):
        
        if axis == 1:
            return self.map(lambda x: x / std(x))
        elif axis == 0:
            stdval = self.std().toarray()
            return self.map(lambda x: x / stdval)
        else:
            raise Exception('Axis must be 0 or 1')
1092475
def count(index,h):
    '''
    
    '''
    try:
        response = base.es.cat.count(index,h=h)
        table = base.draw_table(response)
    except Exception as e:
        click.echo(e)
    else:
        click.echo(table)
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)
713099
def count_nonzero(data, mapper=None, blen=None, storage=None,
                  create='array', **kwargs):
    """"""
    return reduce_axis(data, reducer=np.count_nonzero,
                       block_reducer=np.add, mapper=mapper,
                       blen=blen, storage=storage, create=create, **kwargs)
561373
def load_genotypes(self):
        

        if DataParser.compressed_pedigree:
            self.genotype_file = gzip.open("%s.gz" % self.tped_file, 'rb')
        else:
            self.genotype_file = open(self.tped_file)
        self.filter_missing()
1051162
def _extract_number_of_taxa(self):
        
        n_taxa = dict()
        for i in self.seq_records:
            if i.gene_code not in n_taxa:
                n_taxa[i.gene_code] = 0
            n_taxa[i.gene_code] += 1
        number_taxa = sorted([i for i in n_taxa.values()], reverse=True)[0]
        self.number_taxa = str(number_taxa)
1080987
def _genotype_in_background(rec, base_name, back_samples):
    
    def passes(rec):
        return not rec.FILTER or len(rec.FILTER) == 0
    return (passes(rec) and
            any(rec.genotype(base_name).gt_alleles == rec.genotype(back_name).gt_alleles
                for back_name in back_samples))