Skip to content

Commit

Permalink
load-into-coungraph.py: put version into .info
Browse files Browse the repository at this point in the history
  • Loading branch information
kdm9 committed Feb 15, 2016
1 parent e6eed56 commit f89ddd5
Showing 1 changed file with 8 additions and 7 deletions.
15 changes: 8 additions & 7 deletions scripts/load-into-counting.py
Original file line number Diff line number Diff line change
Expand Up @@ -117,16 +117,17 @@ def main():
check_space_for_graph(args.output_countgraph_filename, tablesize,
args.force)

info_filename = base + ".info"
check_file_writable(base)
check_file_writable(base + ".info")
check_file_writable(info_filename)

print('Saving k-mer countgraph to %s' % base, file=sys.stderr)
print('Loading kmers from sequences in %s' %
repr(filenames), file=sys.stderr)

# clobber the '.info' file now, as we always open in append mode below
if os.path.exists(base + '.info'):
os.remove(base + '.info')
with open(info_filename, 'w') as info_fh:
print('khmer version:', khmer.__version__, file=info_fh)

print('making countgraph', file=sys.stderr)
countgraph = khmer_args.create_countgraph(args)
Expand Down Expand Up @@ -159,13 +160,13 @@ def main():
print('mid-save', base, file=sys.stderr)

countgraph.save(base)
with open(base + '.info', 'a') as info_fh:
with open(info_filename, 'a') as info_fh:
print('through', filename, file=info_fh)
total_num_reads += rparser.num_reads

n_kmers = countgraph.n_unique_kmers()
print('Total number of unique k-mers:', n_kmers, file=sys.stderr)
with open(base + '.info', 'a') as info_fp:
with open(info_filename, 'a') as info_fp:
print('Total number of unique k-mers:', n_kmers, file=info_fp)

print('saving', base, file=sys.stderr)
Expand All @@ -176,7 +177,7 @@ def main():
khmer.calc_expected_collisions(
countgraph, args.force, max_false_pos=.2)

with open(base + '.info', 'a') as info_fp:
with open(info_filename, 'a') as info_fp:
print('fp rate estimated to be %1.3f\n' % fp_rate, file=info_fp)

if args.summary_info:
Expand Down Expand Up @@ -209,7 +210,7 @@ def main():
print('fp rate estimated to be %1.3f' % fp_rate, file=sys.stderr)

print('DONE.', file=sys.stderr)
print('wrote to:', base + '.info', file=sys.stderr)
print('wrote to:', info_filename, file=sys.stderr)

if __name__ == '__main__':
main()
Expand Down

0 comments on commit f89ddd5

Please sign in to comment.