def get_round(dct,rnd): x = FindAllFiles() set9 = x.query_dirname(rnd,-2,dct) print 'files entered:',len(dct.keys()) print 'files returned, round %s:' % rnd,len(set9.keys()) set9 = x.sort_dirname(-1,set9) return set9
def get_bydata(dct, data_name): print 'files entered:', len(dct.keys()) x = FindAllFiles() print data_name set9 = x.query_dirname(data_name, -2, dct) lst = set9.keys() return sorted(lst)
def get_doz(dct, data_name): print 'files entered:', len(dct.keys()) x = FindAllFiles() print data_name set9 = x.query_dirname(data_name, -2, dct) set9 = x.sort_dirname(-2, set9) # lst = set9.keys() # return sorted(lst) # return lst return set9
def load_dct(cwd=my_dir,pattern='*.dat'): # FindAllFiles print('cwd:',cwd) print('pattern:',pattern) dct_find = {'cwd':cwd,'pattern':pattern} x = FindAllFiles(dct_find) x.get_files() dct9 = x.sort_dirname(-1,x.dct) print(len(dct9.keys()),'of',x.total) return dct9
def load_dct(cwd=my_dir, pattern='*.dat'): # FindAllFiles print 'cwd:', cwd print 'pattern:', pattern dct_find = {'cwd': cwd, 'pattern': pattern} x = FindAllFiles(dct_find) # print x.pattern x.get_files() # x.print_query(x.dct) print len(x.dct.keys()), 'of', x.total set9 = x.dct # x.dct (last pos.) # set9 = x.sort_dirname(-1,x.dct) # x.print_ [query,class] # x.query_ [dirname,file,filename](searchstring,pos,dct) # x.remove_[dirname,file,filename](searchstring,pos,dct) # x.print_query(set9) # print len(set9.keys()),'of',x.total # sys.exit() # return set9 set9 = x.remove_dirname('fail', None, set9) set9 = x.remove_dirname('builder', None, set9) set9 = x.remove_filename('_new.dat', set9) set9 = x.remove_filename('_bac.dat', set9) set9 = x.remove_dirname('dat', -1, set9) print len(set9.keys()), 'of', x.total set9 = x.sort_dirname(-1, set9) return set9
def get_round(dct, round_name): print 'files entered:', len(dct.keys()) x = FindAllFiles() print round_name set9 = x.query_dirname(round_name, -3, dct) if len(set9.keys()) == 0: set9 = x.query_dirname(round_name, -4, dct) # if ((round_name == 'round_16') and (len(set9.keys()) == 0)): # set9 = x.query_dirname(round_name,-4,dct) set9 = x.sort_dirname(-1, set9) print 'file returned:', len(set9.keys()) return set9
def load_dct(cwd=my_dir, pattern='*.dat'): # FindAllFiles print 'cwd:', cwd print 'pattern:', pattern dct_find = {'cwd': cwd, 'pattern': pattern} x = FindAllFiles(dct_find) # print x.pattern x.get_files() # x.print_query(x.dct) # print len(x.dct.keys()),'of',x.total set9 = x.remove_dirname('fail', None, x.dct) set9 = x.remove_dirname('example', None, set9) set9 = x.remove_dirname('tops_extra', None, set9) set9 = x.query_dirname("round_%d" % rnd, None, set9) set9 = x.sort_dirname(-1, set9) return set9
def load_dct(cwd=my_dir,pattern='*_top.dat'): # FindAllFiles print 'cwd:',cwd print 'pattern:',pattern dct_find = {'cwd':cwd,'pattern':pattern} x = FindAllFiles(dct_find) x.get_files() # x.print_ [query,class] # x.query_ [dirname,file,filename](searchstring,pos,dct) # x.remove_[dirname,file,filename](searchstring,pos,dct) set9 = x.remove_dirname('fail',None,x.dct) set9 = x.remove_dirname('example',None,set9) set9 = x.remove_dirname('tops_extra',None,set9) set9 = x.query_dirname("round_%d" % proj_round,None,set9) set9 = x.sort_dirname(-1,set9) return set9
def load_dct(cwd=my_dir,pattern='*.dat'): # FindAllFiles print 'cwd:',cwd print 'pattern:',pattern dct_find = {'cwd':cwd,'pattern':pattern} x = FindAllFiles(dct_find) x.get_files() # print len(x.dct.keys()),'of',x.total set9 = x.remove_dirname('fail',None,x.dct) set9 = x.remove_dirname('example',None,set9) set9 = x.remove_dirname('tops_extra',None,set9) # if((rnd == '10') or (rnd == '11')): # set9 = x.remove_dirname('_nop_',None,set9) # set9 = x.remove_dirname('_rev_',None,set9) set9 = x.query_dirname("round_%d" % rnd,None,set9) set9 = x.sort_dirname(-1,set9) # x.print_query(set9) # sys.exit() print 'dct_matches:',len(set9.keys()) return set9
def load_dct(cwd=my_dir, pattern='*.dat'): # FindAllFiles print 'cwd:', cwd print 'pattern:', pattern dct_find = {'cwd': cwd, 'pattern': pattern} x = FindAllFiles(dct_find) # print x.pattern x.get_files() # x.print_query(x.dct) print len(x.dct.keys()), 'of', x.total set9 = x.remove_dirname('fail', None, x.dct) # set9 = x.query_filename(rnd,set9) set9 = x.sort_filename(set9) lst = [] for k, v in set9.items(): lst.append(v['file']) return lst
def check_hsa_analysis(dct): for i,k in enumerate(dct.keys()): os.chdir(dct[k]['dirname']) # FindAllFiles dct_hsa = {'cwd':dct[k]['dirname'],'pattern':'*.dat'} H = FindAllFiles(dct_hsa) set9 = H.get_files() # H.query_ [dirname,file,filename](searchstring,pos,dct) # H.remove_[dirname,file,filename](searchstring,pos,dct) set9 = H.query_file('hsa',set9) set9 = H.sort_dirname(-1,set9) H.print_query(set9) # set9 print(len(set9.keys()),'of',H.total) # if ((not os.path.exists('hsa_current')) and (len(set9.keys()) != 0)): # if (not os.path.exists('hsa_%s' % new_dir)): if ((dct[traj]['dirname'] == dct[k]['dirname']) and (not os.path.exists('hsa_current'))): print('making hsa_current') os.makedirs('hsa_current') # hcount = 0 for h in set9.keys(): # print h if os.path.basename(set9[h]['dirname']) == os.path.basename(dct[k]['dirname']): new_hsa_cur = os.path.join(dct[k]['dirname'],'hsa_current',set9[h]['filename']) # print 'moving to hsa_current:',new_hsa_cur # hcount += 1 os.rename(set9[h]['file'],new_hsa_cur) lst_hsa = glob.glob('hsa_current/hsa*.dat') # 1 if len(lst_hsa) > 0: print('base:',os.path.basename(dct[k]['dirname'])) print(lst_hsa)
def sort_routine1(dct): x = FindAllFiles() print 'files entered:', len(dct.keys())
def get_retraction_dct(dct): set9 = dct print len(set9.keys()) x = FindAllFiles() if rnd == 16: set_nop = x.remove_dirname("_nop_00",None,set9) else: set_nop = x.query_dirname("_nop_",None,set9) set_rev = x.query_dirname("_rev_",None,set9) set10 = x.merge_dct([set_rev,set_nop]) # print "Lengths:" # print len(set_rev.keys()) # print len(set_nop.keys()) # print len(set10.keys()) # sys.exit() if rnd == 16: set_for = x.query_dirname("_nop_00",None,set9) else: set_for = x.remove_dirname("_rev_",None,set9) set_for = x.remove_dirname("_nop_",None,set_for) # print "Forwards:" # print len(set_for.keys()) # sys.exit() # lst_forward_names = [] # for k,v in set10.iteritems(): # # print k,v['dirname'].split('/')[-1] # # print v # proj_name = v['dirname'].split('/')[-1] # forwards = proj_name.split('_nop_')[0] # lst_forward_names.append(forwards) lst_tup_for_retract = [] # print set_for.keys() # print set10.keys() for k,v in set_for.iteritems(): # print k,v['name'] for k1,v1 in set10.iteritems(): if rnd == 16: name_ser = v['name'].split('_nop_')[0] if re.search(name_ser,v1['name']) != None: # print v['name'],v1['name'] # print (k,k1) lst_tup_for_retract.append((k,k1)) else: if re.search(v['name'],v1['name']) != None: # print v['name'],v1['name'] # print (k,k1) lst_tup_for_retract.append((k,k1)) # for name in lst_forward_names: # # print name # for k,v in set_for.iteritems(): # if re.search(name,v['dirname']) != None: # # print k,name # f1 = k # break # try: # print f1 # except: # continue # for k,v in set10.iteritems(): # if re.search(name,v['dirname']) != None: # if (f1,k) not in lst_tup_for_retract: # lst_tup_for_retract.append((f1,k)) # break # for tup in lst_tup_for_retract: # print tup # pass print "retractions:",len(lst_tup_for_retract) # sys.exit() return lst_tup_for_retract
plot_type = 'fe' # fe | tension | rmsd | rdf data_name = dataname # seed # # save_fig(0,'fig','%s_%s_%s' % (result_type,plot_type,data_name)) combined_name = '%s_%s_%s' % (result_type, plot_type, data_name) # --------------------------------------------------------- # # Import Data! (3/4) # # --------------------------------------------------------- # # mylib my_library = os.path.expanduser('~/.pylib') sys.path.append(my_library) from mylib.FindAllFiles import * # FindAllFiles dct_find = {'cwd': my_dir, 'pattern': '.dat'} x = FindAllFiles(dct_find) x.get_files() set9 = x.dct # x.print_query(set9) set9 = x.remove_filename('curvature', set9) set9 = x.remove_filename('distance_proto_', set9) set9 = x.remove_dirname('fail', -2, set9) set9 = x.remove_filename('LOG', set9) set9 = x.remove_filename('contact', set9) set9 = x.remove_filename('mt_angles', set9) set9 = x.remove_filename('indices', set9) set9 = x.remove_filename('tubulin_inter', set9) # x.print_query(set9) set9 = x.query_dirname('3kinesin13', -3, set9) # set9 = x.sort_dirname(-2,set9) # x.print_query(set9)
if args['unit'] == None: unit = 'dimer' else: unit = args['unit'] # --------------------------------------------------------- # # Import Data! (3/4) # # --------------------------------------------------------- # # mylib my_library = os.path.expanduser('~/.pylib') sys.path.append(my_library) from mylib.FindAllFiles import * # FindAllFiles dct_find = {'cwd': my_dir, 'pattern': '.dat'} x = FindAllFiles(dct_find) x.get_files() print len(x.dct.keys()), 'of', x.total set9 = x.remove_dirname('fail', -2, x.dct) set9 = x.query_file('curvature_local', set9) set9 = x.sort_dirname(-2, set9) print len(set9.keys()), 'of', x.total # sys.exit() # data_name set9 = x.query_dirname(str(data_name), -2, set9) set9 = x.sort_dirname(-1, set9) x.print_query(set9) print len(set9.keys()), 'of', x.total # trajectory
if args['unit'] == None: unit = 'dimer' else: unit = args['unit'] # --------------------------------------------------------- # # Import Data! (3/4) # # --------------------------------------------------------- # # mylib my_library = os.path.expanduser('~/.pylib') sys.path.append(my_library) from mylib.FindAllFiles import * # FindAllFiles dct_find = {'cwd': my_dir, 'pattern': '.dat'} x = FindAllFiles(dct_find) x.get_files() set9 = x.dct # x.dct (last pos.) # x.sort_dirname # x.print_query,_class # x.query_ [dirname,file,filename](searchstring,pos,dct) # x.remove_[dirname,file,filename](searchstring,pos,dct) set9 = x.remove_dirname('fail', -2, set9) set9 = x.query_filename('distance_proto_centroids', set9) # x.print_query(set9) print len(set9.keys()), 'of', x.total set9 = x.query_dirname(str(data_name), -2, set9) set9 = x.sort_dirname(-2, set9) x.print_query(set9) print len(set9.keys()), 'of', x.total
def load_angle_dct(cwd=my_dir, pattern='*.dat'): # FindAllFiles print 'cwd:', cwd print 'pattern:', pattern dct_find = {'cwd': cwd, 'pattern': pattern} x = FindAllFiles(dct_find) # print x.pattern x.get_files() # x.print_query(x.dct) print "Grand total:", len(x.dct.keys()), 'of', x.total # x.dct (last pos.) # set9 = x.sort_dirname(-1,x.dct) # x.print_ [query,class] # x.query_ [dirname,file,filename](searchstring,pos,dct) lst_dct = [] print "Rounds:", rnd # if rnd == None: # rnd = [] if rnd != None: for r in rnd: set9 = x.query_dirname("round_%s" % r, None, x.dct) lst_dct.append(set9) # x.print_query(set9) print "subtotal:", len(set9.keys()), 'of', x.total # print len(set9.keys()) set7 = x.merge_dct(lst_dct) # x.print_query(set7) print "subtotals:", len(set7.keys()), 'of', x.total lst_dct = [] print "Positions:", position # if position == None: # position = [] if position != None: for p in position: set9 = x.query_dirname(p, -1, x.dct) lst_dct.append(set9) # x.print_query(set9) print "subtotal:", len(set9.keys()), 'of', x.total # print len(set9.keys()) set8 = x.merge_dct(lst_dct) # x.print_query(set8) print "subtotals:", len(set8.keys()), 'of', x.total if ((rnd != None) and (position != None)): set9 = x.get_overlapping_entries(set7, set8) elif (rnd != None): set9 = set7 elif (position != None): set9 = set8 else: set9 = x.dct print "Overlaps:", len(set9.keys()), 'of', x.total # x.remove_[dirname,file,filename](searchstring,pos,dct) # x.print_query(set9) # x.print_query(set9) # sys.exit() return set9
# evenodd = args['evenodd'] # ./plot_proto_angles_from3centroid.py -n 10 -d 123 # ./plot_proto_angles_from3centroid.py -d 123 -x 0 [1,2,3] # ./plot_tubulin_angles.py -d 123 -t 1 -e 2 if line_size == None: # 10 line_size = 10 # --------------------------------------------------------- # # Import Data! (3/4) # # --------------------------------------------------------- # # FindAllFiles dct_find = {'cwd': my_dir, 'pattern': 'dat'} x = FindAllFiles(dct_find) x.get_files() # x.print_query(x.dct) set9 = x.dct print len(x.dct.keys()), 'of', x.total # sys.exit() # x.dct (last pos.) # x.sort_dirname # x.print_query,_class # x.query_ [dirname,file,filename](searchstring,pos,dct) # x.remove_[dirname,file,filename](searchstring,pos,dct) set9 = x.query_dirname('3kinesin', -3) set9 = x.query_filename('tubulin', set9) set9 = x.remove_dirname('fail', -2, set9) set9 = x.remove_dirname('contact_maps', -1, set9) set9 = x.sort_dirname(-2, set9)