<commit_before>#!/usr/bin/env node

var MongoClient = require('mongodb').MongoClient;
    fs          = require('fs');
var sizes = process.argv.slice(2);

var bin_lut = {},
    bin_idx = {},
    bin_nts = {};

sizes.forEach(function(mb) {
  bin_idx[mb] = 0;
  bin_nts[mb] = mb*1000000;
});

MongoClient.connect('mongodb://127.0.0.1:27017/cmap', function(err, cmapdb) {
  if (err) throw err;
  var maps = cmapdb.collection("maps");
  // retrieve the maps sorted by taxonomy id
  maps.find({type:'genome'}, {}).sort({'taxon_id' : 1}).toArray(function(err, genomes) {
    if (err) throw err;
    genomes.forEach(function(map) {
      bin_lut[map.taxon_id] = {};<commit_msg>make bin sizes numeric<commit_after>#!/usr/bin/env node

var MongoClient = require('mongodb').MongoClient;
    fs          = require('fs');
var sizes = process.argv.slice(2).map(function(mb) {return +mb;});

var bin_lut = {},
    bin_idx = {},
    bin_nts = {};

sizes.forEach(function(mb) {
  bin_idx[mb] = 0;
  bin_nts[mb] = mb*1000000;
});

MongoClient.connect('mongodb://127.0.0.1:27017/cmap', function(err, cmapdb) {
  if (err) throw err;
  var maps = cmapdb.collection("maps");
  // retrieve the maps sorted by taxonomy id
  maps.find({type:'genome'}, {}).sort({'taxon_id' : 1}).toArray(function(err, genomes) {
    if (err) throw err;
    genomes.forEach(function(map) {
      bin_lut[map.taxon_id] = {};
{'fraction_non_alphanumeric': 0.1875452570601014, 'fraction_numerical': 0.03041274438812455, 'mean_word_length': 3.849122807017544, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 2, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '5684716', 'n_tokens_mistral': 559, 'n_tokens_neox': 517, 'n_words': 97}