action='store_true', default=False, help="Add pseudocounts in the generated MM" ) parser.add_argument('-k','--order',dest='order',action='store',type=int, default=3, help='It sets the order of the Markov Model used.') args = parser.parse_args() ######## 1 TT SETS ###### training_filename='training_'+args.infile testing_filename='testing_'+args.infile m.training_testing_sets_separation(args.infile,3,training_filename,testing_filename) ######## 2 +/- ########### (background, signal)=m.background_signal_separation(training_filename) ######## 3 kmer dict ##### if (args.pseudocounts): back_dict=m.build_hash_pseudocount(background,args.order) sign_dit=m.build_hash_pseudocount(signal,args.order) else: back_dict=m.build_hash(background,args.order) sign_dit=m.build_hash(signal,args.order) ######### 4 print ######## m.print_hash(sign_dit,back_dict,args.outfile) sys.exit()
m.training_testing_sets_separation(args.infile,3,training_filename,testing_filename) ######## 2 +/- ########### ######## 3 kmer dict ##### if (args.pseudocounts): sys.stderr.write("Starting the training background and foreground separation...\n\n") back_dict=m.build_hash_pseudocount([x for x in m.background_separation(training_filename)],args.order) sys.stderr.write("The MM for the bg is generated...\n\n") sign_dict=m.build_hash_pseudocount([x for x in m.signal_separation(training_filename)],args.order) sys.stderr.write("The MM for the bg is generated...\n\n") else: back_dict=m.build_hash([x for x in m.background_separation(training_filename)],args.order) sign_dict=m.build_hash([x for x in m.signal_separation(training_filename)],args.order) ######### 4 print ######## output_filename=args.outfile+'.MM' sys.stderr.write("Printing the model in {}...\n\n".format(output_filename)) m.print_hash(sign_dict,back_dict,output_filename) ######## 5 windows ####### sys.stderr.write("Starting the testing background and foreground separation...\n\n") sys.stderr.write("Starting the computation of the Scores...\n\n") output_filename_fg=args.outfile+'_fg.th' output_filename_bg=args.outfile+'_bg.th' output_filename_all_top = args.outfile+'_all_top.th' output_filename_all_bot = args.outfile+'_all_bot.th'
######## 0. ARG ######## parser = argparse.ArgumentParser(description='MMDI') parser.add_argument('-i','--input',dest="infile", action="store", default= None, help="Input Interval formated file") parser.add_argument('-o','--MM_output', dest='outfile', action='store', default=None, help='The output file where the MM is going to be written.') args = parser.parse_args() ######## 1 TT SETS ###### training_filename='training_'+args.infile testing_filename='testing_'+args.infile m.training_testing_sets_separation(args.infile,3,training_filename,testing_filename) ######## 2 +/- ########### (background, signal)=m.background_signal_separation(training_filename) ######## 3 kmer dict ##### back_dict=m.build_hash(background,3) sign_dit=m.build_hash(signal,3) ######### 4 print ######## m.print_hash(sign_dit,back_dict,args.outfile) sys.exit()