def main(): parser = khmer_args.build_nodegraph_args() parser.add_argument("--samples", nargs="+") parser.add_argument("--save-prefix") parser.add_argument("--print-tree", action="store_true", default=False) args = parser.parse_args() if not args.save_prefix: print >> sys.stderr, "No save prefix specified! Exiting..." sys.exit(1) factory = NodegraphFactory(args) root = sbt.Node(factory) for sample_fn in args.samples: print "*** Build node for", sample_fn leaf = sbt.Leaf(os.path.basename(sample_fn), os.path.basename(sample_fn), factory.create_nodegraph()) print "--- Consuming file..." leaf.graph.consume_fasta(sample_fn) print "--- Adding node to SBT..." root.add_node(leaf) print "--- Done with", sample_fn if args.print_tree: sbt.print_sbt(root) print "\n*** Saving to disk" fn = sbt.save_sbt(root, args.save_prefix) print "--- Save to", fn
def main(): parser = argparse.ArgumentParser() parser.add_argument('--sbt-file') parser.add_argument('--search', nargs='+') parser.add_argument('--threshold', type=float, default=0.9) parser.add_argument('--print-tree', action='store_true', default=False) args = parser.parse_args() tree = sbt.load_sbt(args.sbt_file) if args.search: for fn in args.search: print '*** Searching', fn for record in screed.open(fn): print '---\n', record.name print [x.metadata for x in tree.find(search_sequence, record.sequence, args.threshold)] if args.print_tree: sbt.print_sbt(tree)