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 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) # 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
# 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) # sys.exit() # projects: 123, 134, 145 set9 = x.query_dirname(dataname, -2, set9) set9 = x.sort_dirname(-2, set9) x.print_query(set9) point_start = 0 # (3000001, 7) -- confirmed point_end = 5000000 ma_value = 2500 step = 10 ts = 20.00
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
# 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 print data_name print trajectory # 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
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
# 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) # x.print_query(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