def generate_smotif(top_entry,csmotif_index,csmotif_subentry,ex1,ex2):    
    #[8, 9, 'left']
    log=top_entry[2]
    direction=csmotif_index[2]    
    if direction=='left':
        pss_index=csmotif_index[1]
        css_index=csmotif_index[0]
        dir_no,s2_struct,domain=log[pss_index][0],log[pss_index][1],log[pss_index][2]
        s1_struct=csmotif_subentry
    else:
        pss_index=csmotif_index[0]
        css_index=csmotif_index[1]
        dir_no,s1_struct,domain=log[pss_index][0],log[pss_index][1],log[pss_index][2]
        s2_struct=csmotif_subentry
    # 9_8_1 ['strand', 9, 13, 3, 112, 120] ['strand', 8, 4, 3, 123, 132] ['3po3K00', 'ARG', '70', 'THR', '77', 'PRO', '83', 'LEU', '111']
    print s1_struct,s2_struct 
    start=s1_struct[5]
    end=s2_struct[4]
    if end-start>1:                
        smotif = ud.getSmotif(s1_struct, s2_struct)
        return dir_no,domain,s1_struct,s2_struct,smotif,direction
    else:
        create_log_file(ex1,ex2)
        sys.exit()
#************************
#load in profile and map dict
#************************
f_ss = open("ss_profiles.dict", 'r')
ss_profiles = pickle.load(f_ss)
f_ss.close()

f_map = open("map_route.dict", 'r')
map_route = pickle.load(f_map)
f_map.close()

#************************
# Get the corresponding Profiles for current Smotif
#************************
s1, s2 = map_route['map_route'][0][0], map_route['map_route'][0][1]
s1_list, s2_list = ud.getPairSSProfiles(s1, s2, ss_profiles)
run_seq = ud.getRunSeq(s1_list, s2_list)

#************************
# Schedule Jobs
#************************

machines=ud.parseMachines('mpi_hostfile')
pwd=commands.getoutput('pwd')
user='******'
passwd=''
index=0
while (index != len(run_seq)):    
    for machine in machines:
        if index == len(run_seq):
            break
#************************
#load in profile and map dict
#************************
f_ss = open("ss_profiles.dict", 'r')
ss_profiles = pickle.load(f_ss)
f_ss.close()

f_map = open("map_route.dict", 'r')
map_route = pickle.load(f_map)
f_map.close()

boot_file = open("boot_rn.dict",'r')
boot_data = pickle.load(boot_file)
boot_file.close()
psmotif = ud.startUp(boot_data)

csmotif = ud.getNextSmotif(map_route,psmotif)
print psmotif, csmotif

#backup psmotif boot file
move_bf="mv boot_rn.dict boot_"+str(psmotif[0])+"_"+str(psmotif[1])+".dict"
os.system(move_bf)
#************************
# Get the corresponding Profiles for current Smotif
#************************

profile = ud.getSSProfile(ss_profiles,csmotif)
print profile

init_data = ud.testinitData('population')
Exemple #4
0
f_ss.close()

f_map = open("map_route.dict", 'r')
map_route = pickle.load(f_map)
f_map.close()

#*********************************
#load in cathdb and extract info
#*********************************

ss_indices = map_route['map_route'][0]
s1_profile = ss_profiles[ss_indices[0]][int(sys.argv[1])]
s2_profile = ss_profiles[ss_indices[1]][int(sys.argv[2])]


smotif = ud.getSmotif(s1_profile, s2_profile)
rdc_file, ss_seq, cathdb = ud.initData()
cath_entries  = ud.extractCath(smotif, cathdb)
print sys.argv[1], sys.argv[2], s1_profile, s2_profile
print smotif
print len(cath_entries)

#*********************************
# Search for needles in the haystack
#*********************************

B0     = 18.8
TinK   = 298.0
Sorder = 1.0
scal = rf.rdcScal(Sorder, B0, TinK)
    return pindex[0], pindex[1], pindex[2], direction
    
#************************
#load in profile and map dict
#************************

f_ss = open("ss_profiles.dict", 'r')
ss_profiles = pickle.load(f_ss)
f_ss.close()

f_map = open("map_route.dict", 'r')
map_route = pickle.load(f_map)
f_map.close()

psmotif = [int(sys.argv[1]), int(sys.argv[2])]
csmotif = ud.getNextSmotif(map_route, psmotif)


top_dict, top_list = read_top(psmotif)
top_entry = top_dict[top_list[int(sys.argv[3])]]
profiles = ud.getSSProfile(ss_profiles,csmotif)

sc_profile = profiles[int(sys.argv[4])]


# sort_nchi[sum(temp_nchi)]=[temp_nchi,temp_tensor, log, domain]
log = top_entry[-2]
dir_name, sp_profile, domain, direction = getSx(log, csmotif)

if direction == 'left':
    smotif = ud.getSmotif(sc_profile, sp_profile)
#load in profile and map dict
#************************

brokerin= open('../setup/broker-ts3.txt','r')
ntags, tsets, npc_files=gettaginfo(brokerin.readlines())
brokerin.close()

f_ss=open("ss_profiles.dict",'r')
ss_profile=pickle.load(f_ss)
f_ss.close()

f_map=open("map_route.dict",'r')
map_route=pickle.load(f_map)
f_map.close()

init_data = ud.testinitData('broker_file', 'ss_seq', 'cathdb')
rdc_file, ss_seq, cathdb = init_data[0], init_data[1], init_data[2]


s1,s2=get_r0(map_route['map_route'])
s1_list,s2_list=get_profiles(s1,s2,ss_profile)

s1_struct=s1_list[int(sys.argv[1])]
s2_struct=s2_list[int(sys.argv[2])]

#smotif= get_smotif(s1_struct,s2_struct)

smotif = ud.getSmotif(s1_struct, s2_struct)
# ss_array has [['helix', 22, 2, 23], ['SStruct', len(SStruct),start_res, end_res]]
print smotif , s1_struct, s2_struct
#************************
#load in profile and map dict
#************************
f_ss = open("ss_profiles.dict", 'r')
ss_profiles = pickle.load(f_ss)
f_ss.close()

f_map = open("map_route.dict", 'r')
map_route = pickle.load(f_map)
f_map.close()

boot_file = open("boot_rn.dict",'r')
boot_data = pickle.load(boot_file)
boot_file.close()
psmotif = ud.startUp(boot_data)

#csmotif = ud.getNextSmotif(map_route,psmotif)
#print psmotif, csmotif

#************************
# Get the corresponding Profiles for current Smotif
#************************

#profile = ud.getSSProfile(ss_profiles,csmotif)
#print profile

init_data = ud.testinitData('population')
population = init_data[0]

if ud.stitchData(psmotif):

# top_entry has previously fit tensor information and coordinates
# the domin in this context is previous domain and the current domain is referred to as
# "entry" in the pymol fit
top_entry = top_dict [top_list[int(sys.argv[3])]]


profile=get_profile(ss_profile,csmotif_index)
print profile
csmotif_subentry=profile[int(sys.argv[4])]

dir_name,domain,s1_struct,s2_struct,smotif,direction = generate_smotif(top_entry,csmotif_index,csmotif_subentry,sys.argv[3],sys.argv[4])

print dir_name,domain,s1_struct,s2_struct,smotif,direction
save_dir=get_simple_save_dir(csmotif_index,sys.argv[3],sys.argv[4],direction)
print save_dir

cath_list = ud.extractCath(smotif,cathdb)
print s1_struct,s2_struct,smotif,domain,len(cath_list)

ntags, tsets, npc_files=gettaginfo(broker_file)
fit_data=[ss_seq,ntags,tsets,npc_files,s1_struct,s2_struct,top_entry]
hit_list_dict =pymol_filter(dir_name,domain,cath_list,rmsd_cutoff,direction,save_dir,fit_data)

if hit_list_dict:
    fout=open("pre_"+save_dir[2:]+".dict",'w')
    pickle.dump(hit_list_dict,fout,protocol=0)
    fout.close()
sys.exit()