コード例 #1
0
    # three object are being created
    etable = ScoreTable( density_score_Dict, overlap_score_Dict, nonoverlap_score_Dict )     
    wts = Weights( args.density_score_wt, args.overlap_score_wt, args.closab_score_wt, args.clash_score_wt )
    scorefxn = ScoreFunction( etable, wts, args.null_frag_score )

    for each_round in range( 1, args.round+1 ):
        scorefxn.clean_selected_frags_dict()

        if args.starts_with:
            assert not args.dump_results == args.starts_with
            print "Initialize with %s" % args.starts_with
            pkl = open( args.starts_with , "rb" )
            scorefxn.selected_frags_dict = pickle.load( pkl )
        else:
            if args.initialization == "lowdens": scorefxn.lowest_density_score_placements()
            elif args.initialization == "random": scorefxn.randomize_initial_placements()

        for each_step in range( args.steps ):
            print "round: %s  cycle: %s" %( each_round, each_step )

            # pick a random mer (because I would mix different mers in the future)
            mer  = mer_list[ random.randrange( 0, len(mer_list) ) ]

            # pick a residue number to start with
            if args.designated_position: pos = args.designated_position
            else: pos = pos_list[ random.randrange( 0, len( pos_list ) ) ]

            boltzmann_prob_Dict = {}
            ''' After picking a position to optimize,
                calculate compatibility scores for all the candidate placements at that residue'''