Returns the number of species found over all records
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)
239854
def query_count():
        '''
        
        '''
        recs = TabPost2Tag.select(
            TabPost2Tag.tag_id,
            peewee.fn.COUNT(TabPost2Tag.tag_id).alias('num')
        ).group_by(
            TabPost2Tag.tag_id
        )
        return recs
665299
def count(cls, name):
        """"""
        counter = cls.collection.find_one({'name': name}) or {}
        return counter.get('seq', 0)
527902
def count(self, with_limit_and_skip=False):
        ''' 
        '''
        return self.__get_query_result().cursor.count(with_limit_and_skip=with_limit_and_skip)
1227250
def get_counts(entities=None,
               object_category=None,
               min_count=1,
               **kwargs):
    
    if entities is None:
        entities = []
    results = search_associations(subjects=entities,
                                  subject_direct=True,
                                  rows=0,
                                  facet_fields=[M.IS_DEFINED_BY, M.SUBJECT_TAXON, M.SUBJECT_CATEGORY],
                                  object_category=object_category,
                                  facet_mincount=3, # TODO
                                  facet_limit=-1,
                                  json_facet={
                                      'categories':{
                                          'limit':-1,
                                          'type': 'terms',
                                          'field' : M.OBJECT_CLOSURE,
                                          'facet' : {
                                              'uniq_subject': "unique(subject)"
                                          }
                                      }
                                  },
                                  **kwargs)
    buckets = results['facets']['categories']['buckets']
    cmap = {}
    for bucket in buckets:
        if bucket['uniq_subject'] >= min_count:
            cmap[bucket['val']] = bucket['uniq_subject']
    return (cmap, results)
945723
def count_residues(self, record, pdb_record):
        ''''''
        mutations = self.get_record_mutations(record)
        pdb_chains = set([m['Chain'] for m in mutations])
        assert(len(pdb_chains) == 1) # we expect monomeric cases
        pdb_chain = pdb_chains.pop()
        return len(pdb_record.get('Chains', {}).get(pdb_chain, {}).get('Sequence', ''))
713960
def count(self, **query_dict):
        """"""
        param_dict = query_dict.copy()
        param_dict['count'] = 0
        resp_dict = self._get_query(**param_dict)
        return resp_dict['response']['numFound']
952372
def __get_table_count(self):
        
        _count = 0
        try:
            keys = ["paleo", "paleoData", "paleoMeasurementTable"]
            # get the count for how many tables we have. so we know to make appended filenames or not.
            for pd_name, pd_data in self.lipd_data["paleoData"].items():
                for section_name, section_data in pd_data.items():
                    _count += len(section_data)

        except Exception:
            pass

        if _count > 1:
            self.append_filenames = True

        return
938416
def sparql_count(self, query, flush=None):
        
        return self.count_statements(query, language='sparql', type='tuples',
            flush=flush)
1021669
def _record_count(self):
        

        self.filepath_or_buffer.seek(0, 2)
        total_records_length = (self.filepath_or_buffer.tell() -
                                self.record_start)

        if total_records_length % 80 != 0:
            warnings.warn("xport file may be corrupted")

        if self.record_length > 80:
            self.filepath_or_buffer.seek(self.record_start)
            return total_records_length // self.record_length

        self.filepath_or_buffer.seek(-80, 2)
        last_card = self.filepath_or_buffer.read(80)
        last_card = np.frombuffer(last_card, dtype=np.uint64)

        # 8 byte blank
        ix = np.flatnonzero(last_card == 2314885530818453536)

        if len(ix) == 0:
            tail_pad = 0
        else:
            tail_pad = 8 * len(ix)

        self.filepath_or_buffer.seek(self.record_start)

        return (total_records_length - tail_pad) // self.record_length
334863
async def count(query, clear_limit=False):
    
    clone = query.clone()
    if query._distinct or query._group_by or query._limit or query._offset:
        if clear_limit:
            clone._limit = clone._offset = None
        sql, params = clone.sql()
        wrapped = 'SELECT COUNT(1) FROM (%s) AS wrapped_select' % sql
        raw = query.model.raw(wrapped, *params)
        return (await scalar(raw)) or 0
    else:
        clone._returning = [peewee.fn.Count(peewee.SQL('*'))]
        clone._order_by = None
        return (await scalar(clone)) or 0
534898
public function NumberOfRecordsLeftToIndex()
    {
        $iCount = 0;
        if ($this->fieldIndexRunning) {
            $sIndexTableName = $this->GetIndexRawTableName();
            $query = "SHOW TABLES LIKE '".MySqlLegacySupport::getInstance()->real_escape_string($sIndexTableName)."'";
            $tRes = MySqlLegacySupport::getInstance()->query($query);
            $bTableExists = (MySqlLegacySupport::getInstance()->num_rows($tRes) >= 1);
            if ($bTableExists) {
                $query = 'SELECT COUNT(sysid) AS reccount FROM `'.MySqlLegacySupport::getInstance()->real_escape_string($sIndexTableName).'`';
                if ($trow = MySqlLegacySupport::getInstance()->fetch_assoc(MySqlLegacySupport::getInstance()->query($query))) {
                    $iCount = $trow['reccount'];
                }
            }
            if ($iCount < 1) {
                $this->StopIndex();
            }
        }

        return $iCount;
    }
473173
def all_species_release_pairs(cls):
        
        for species_name in cls.all_registered_latin_names():
            species = cls._latin_names_to_species[species_name]
            for _, release_range in species.reference_assemblies.items():
                for release in range(release_range[0], release_range[1] + 1):
                    yield species_name, release
185717
def found(self):
        
        if 'ids' in self.kwargs:
            cid = self.kwargs['query']['collection']['eq']
            return len(self.items_by_id(self.kwargs['ids'], cid))
        kwargs = {
            'page': 1,
            'limit': 0
        }
        kwargs.update(self.kwargs)
        results = self.query(**kwargs)
        return results['meta']['found']
198873
def batch_taxonomy(list_of_taxids):
    
    for taxid in list_of_taxids:
        handle = Entrez.efetch(db='Taxonomy', id=taxid, retmode="xml")
        records = Entrez.read(handle)
        yield records[0]["ScientificName"]
594349
def count(self, query=None, indices=None, doc_types=None, **query_params):
        
        from .query import MatchAllQuery

        if query is None:
            query = MatchAllQuery()
        body = {"query": query.serialize()}
        path = self._make_path(indices, doc_types, "_count")
        return self._send_request('GET', path, body, params=query_params)
359947
def get_collections(self):
        """"""
        if not self.quiet:
            print
            print "Finding " + self.current_collection_type + "s..."

        self.compute_collections()

        if not self.quiet:
            print self.current_similarity_measure, self.current_collection_type, "information:"
            table_contents = [("Collection","Indices","Size")]
            for (i, j, k) in zip(self.collection_indices,self.collection_sizes,self.collection_list):
                table_contents.append(([unit.text for unit in k], i, j))
            print_table(table_contents)