def test_sing_est(self): args = [ 'test_est_left_msh.txt', 'test_est_right_msh.txt', '--n', '50', '--n0', '10000', '--mut', '1e-8', '--rec', '1e-8', '--round', '3', '--outfn', 'test_est.txt', '--seed', '1' ] run_estimator(args) self.assertTrue(filecmp.cmp('test_est.txt', 'test_sing_est.txt'))
def main(argv): parser = createParser() if argv[-1] == '': argv = argv[0:-1] args = parser.parse_args(argv) #print (args.k_list) #exit() ## k_edges_group if not (args.alledges or args.k1 or args.k_all or args.k_range or args.k_list): parser.error( 'one of [--alledges, --k1, --k-range, --k-all, --k-list] must be invoked' ) #if not (args.alledges or args.k_all or args.k_range): # args.k1 = True ## rec_group options if not (args.rec_rate or args.mapname): parser.error('one of [--rec, --map] must be invoked') if args.msh_only and not args.outmsh: parser.error("--outmsh must be used with --msh-only") if args.k_range is not None and args.k_range[0] < 2: parser.error("--k-range requires a range start 2 or greater") if args.k_range is not None and args.k_range[0] > args.k_range[1]: parser.error("Start of --k-range must be not be greater than end") est_args = makemshfiles(args) if not args.msh_only: if args.k1: tempstr = " tc values for singletons only " elif args.k_all: tempstr = " tc values for all SNPs" elif args.k_range: tempstr = "tc values in SNPs with counts in range {}-{} ".format( args.k_range[0], args.k_range[1]) else: #assert args.alledges tempstr = "t0 values for all edges at positions" if args.posname: tempstr += " given in file {}".format(args.posname) else: tempstr += " adjacent to SNPs" sys.stderr.write("Generating estimates (%s): %s\n" % (tempstr, str(est_args))) estat = run_estimator(est_args) if not args.keep_msh_files: if os.path.exists(est_args[0]): os.remove(est_args[0]) if os.path.exists(est_args[1]): os.remove(est_args[1])