This function constructs the total count for each valid character in the array or loads them if they already exist.
        These will always be stored in '<DIR>/totalCounts.p', a pickled file
502843
def constructTotalCounts(self, logger):
        '''
        
        '''
        self.totalSize = self.bwt.shape[0]
        
        abtFN = self.dirName+'/totalCounts.p'
        if os.path.exists(abtFN):
            fp = open(abtFN, 'r')
            self.totalCounts = pickle.load(fp)
            fp.close()
        else:
            chunkSize = 2**20
            if logger != None:
                logger.info('First time calculation of \'%s\'' % abtFN)
            
            #figure out the counts using the standard counting techniques, one chunk at a time
            self.totalCounts = [0]*self.vcLen
            i = 0
            while i*chunkSize < self.bwt.shape[0]:
                self.totalCounts = np.add(self.totalCounts, np.bincount(self.bwt[i*chunkSize:(i+1)*chunkSize], minlength=self.vcLen))
                i += 1
            
            #save the total count to '<DIR>/totalCounts.p'
            fp = open(abtFN, 'w+')
            pickle.dump(self.totalCounts, fp)
            fp.close()
1128655
def _extract_total_number_of_chars(self):
        
        self._get_gene_codes_and_seq_lengths()

        sum = 0
        for seq_length in self._gene_codes_and_lengths.values():
            sum += sorted(seq_length, reverse=True)[0]
        self.number_chars = str(sum)
1121368
def count(args):
    
    from jcvi.utils.table import loadtable, write_csv

    p = OptionParser(count.__doc__)
    p.add_option("--dir",
                help="Sub-directory where FASTQC was run [default: %default]")
    p.add_option("--human", default=False, action="store_true",
                help="Human friendly numbers [default: %default]")
    p.set_table()
    p.set_outfile()
    opts, args = p.parse_args(args)

    if len(args) < 1:
        sys.exit(not p.print_help())

    filenames = args
    subdir = opts.dir
    header = "Filename|Total Sequences|Sequence length|Total Bases".split("|")
    rows = []
    human = opts.human
    for f in filenames:
        folder = f.replace(".gz", "").rsplit(".", 1)[0] + "_fastqc"
        if subdir:
            folder = op.join(subdir, folder)
        summaryfile = op.join(folder, "fastqc_data.txt")

        fqcdata = FastQCdata(summaryfile, human=human)
        row = [fqcdata[x] for x in header]
        rows.append(row)

    print(loadtable(header, rows), file=sys.stderr)
    write_csv(header, rows, sep=opts.sep,
              filename=opts.outfile, align=opts.align)
1043484
static int count(final String s, final char c) {

        int pos   = 0;
        int count = 0;

        if (s != null) {
            while ((pos = s.indexOf(c, pos)) > -1) {
                count++;
                pos++;
            }
        }

        return count;
    }
589571
def get_total_indentation(self, index):
        
        n = 0
        while index.isValid():
            n += 1
            index = index.parent()
        return n * self.indentation()
287442
private int countOccurrences(String haystack, char needle) {
        int count = 0;
        for (int i = 0; i < haystack.length(); i++) {
            if (haystack.charAt(i) == needle)
                count++;
        }
        return count;
    }
758499
private int countOccurrences(final String string, char c, int offset) {
        assert string != null : "String must be specified";
        return ((offset = string.indexOf(c, offset)) == -1) ? 0 : 1 + countOccurrences(string, c, offset + 1);
    }
91345
function updateCharactersCounter() {
      var remaining = options.chars - charsCount();
      if (remaining === 0) {
        $countdownDomNode.addClass('ut-text-countdown-max');
      } else {
        $countdownDomNode.removeClass('ut-text-countdown-max');
      }
      $countdownDomNode.text(remaining + ' / ' + options.chars);
    }
774691
private static int countWildcardPhraseFrequencies(File dir, String pattern)
        throws Exception {
        
        File[] files = dir.listFiles();

        int total = 0;

        for (int i = 0; i < files.length; i++) {
            File f = files[i];
            if (f.isDirectory()) {
                total += countWildcardPhraseFrequencies(f, pattern);
            } else if (f.getName().endsWith(".txt")) {
                Scanner sc = new Scanner(f);
                while (sc.hasNext()) {
                    String line = sc.nextLine();
                    if (line.matches(pattern)) {
                        total++;
                    }
                }
            }
        }
        return total;
    }
1371790
function countBrackets(str) {
    var lex = getLexer(str);
    var brackets = 0;
    var tok = lex.next();
    while (tok!==undefined) {
      if (tok.str=="(" || tok.str=="{" || tok.str=="[") brackets++;
      if (tok.str==")" || tok.str=="}" || tok.str=="]") brackets--;
      tok = lex.next();
    }
    return brackets;
  }
774537
int CountCharset(int Offset,int NumofGlyphs){
    	int format;
    	int Length=0;
    	seek(Offset);
    	// Read the format
    	format = getCard8();
    	// Calc according to format
    	switch (format){
    		case 0:
    			Length = 1+2*NumofGlyphs;
    			break;
    		case 1:
    			Length = 1+3*CountRange(NumofGlyphs,1);
    			break;
    		case 2:
    			Length = 1+4*CountRange(NumofGlyphs,2);
    			break;
    		default:
    			break;
    	}
    	return Length;
    }
280315
function tally() {
          entry.request.headerSize = Buffer.byteLength(rawReqHeaders, 'utf8');

          if (options.bodies && ALLOWED_CONTENT_TYPES.indexOf(entry.response.content._type) !== -1) {
            // Store only human-readable content (i.e., not binary)
            // (and if the user actually wants the response bodies in the HAR).
            entry.response.content.text = body;
          }
          entry.response.bodySize = bodySize;
          entry.response.content.headersSize = Buffer.byteLength(rawResHeaders, 'utf8');
          entry.response.content.size = uncompressedSize;
          entry.response.content.compression = uncompressedSize - bodySize;
          entry.response.content.bodySize = bodySize + entry.response.content.compression;

          resolve({idx: idx, data: entry});
        }
998768
private function checkCount(){
        $cnt = (int) $this->getMaxEntries();
        if ($cnt !== NULL && count($this->values) !== $cnt){
            trigger_error("Wrong count of Elements. Expected are $cnt. But right now there are ". count($this->values));
        }

    }
941093
def total_statements(self, filename=None):
        
        if filename is not None:
            statements = self._get_lines_by_filename(filename)
            return len(statements)

        total = 0
        for filename in self.files():
            statements = self._get_lines_by_filename(filename)
            total += len(statements)

        return total
464341
public static int countOccurrences( String s, char c )
	{
		int count = 0;
		int index = 0;
		while( true )
		{
			index = s.indexOf( c, index );
			if( index == -1 )
			{
				break;
			}
			count++;
		}
		return count;
	}
299860
def col_counts(col, weights=None, gap_chars='-.'):
    """"""
    cnt = defaultdict(float)
    for aa, wt in zip(col, weights):
        if aa not in gap_chars:
            cnt[aa] += wt
    return cnt
448776
def find_num_contigs(contig_lengths_dict):
    
    # Initialise the dictionary
    num_contigs_dict = dict()
    for file_name, contig_lengths in contig_lengths_dict.items():
        # Use the len() method to count the number of entries in the list
        num_contigs_dict[file_name] = len(contig_lengths)
    return num_contigs_dict