<commit_before>import khmer
import sys

K = 32
HASHTABLE_SIZE=4**17+1

infile = sys.argv[1]
threshold = int(sys.argv[2])
outfile = sys.argv[3]

print 'creating ht'
ht = khmer.new_hashtable(K, HASHTABLE_SIZE)
print 'eating fa', infile
total_reads, n_consumed = ht.consume_fasta(infile)

print 'hashtable occupancy:', ht.n_occupied() / float(HASHTABLE_SIZE)
#fp = open('aaa.1', 'w')
#total = 0
#for n, i in enumerate(ht.graphsize_distribution(10000)):
#    total += i
#    print >>fp, n, i, total
#fp.close()

print 'trimming to', threshold
ht.trim_graphs(infile, threshold, outfile)

#print 'hashtable occupancy:', ht.n_occupied() / float(HASHTABLE_SIZE)

#fp = open('aaa.2', 'w')
#total = 0
#for n, i in enumerate(ht.graphsize_distribution(5000)):
#    total += i
#    print >>fp, n, i, total
#fp.close()
<commit_msg>default size to something manageable<commit_after>import khmer
import sys

K = 32
HASHTABLE_SIZE=4**12+1

infile = sys.argv[1]
threshold = int(sys.argv[2])
outfile = sys.argv[3]

print 'creating ht'
ht = khmer.new_hashtable(K, HASHTABLE_SIZE)
print 'eating fa', infile
total_reads, n_consumed = ht.consume_fasta(infile)

print 'hashtable occupancy:', ht.n_occupied() / float(HASHTABLE_SIZE)
#fp = open('aaa.1', 'w')
#total = 0
#for n, i in enumerate(ht.graphsize_distribution(10000)):
#    total += i
#    print >>fp, n, i, total
#fp.close()

print 'trimming to', threshold
ht.trim_graphs(infile, threshold, outfile)

#print 'hashtable occupancy:', ht.n_occupied() / float(HASHTABLE_SIZE)

#fp = open('aaa.2', 'w')
#total = 0
#for n, i in enumerate(ht.graphsize_distribution(5000)):
#    total += i
#    print >>fp, n, i, total
#fp.close()

{'fraction_non_alphanumeric': 0.15932407966203982, 'fraction_numerical': 0.026554013277006638, 'mean_word_length': 5.163568773234201, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 11, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, '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': '4401387', 'n_tokens_mistral': 704, 'n_tokens_neox': 648, 'n_words': 162}