Exemplo n.º 1
0
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)
    set9 = x.remove_dirname('altern_', None, set9)

    if 1:
        set9 = x.remove_filename('_nop_', set9)
        set9 = x.remove_filename('_rev_', set9)

    print len(set9.keys()), 'of', x.total
    set9 = x.sort_dirname(-1, set9)
    return set9
Exemplo n.º 2
0
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
Exemplo n.º 3
0
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
Exemplo n.º 5
0
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
Exemplo n.º 6
0
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
    # 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
    return x.dct
Exemplo n.º 7
0
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
Exemplo n.º 8
0
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)
Exemplo n.º 9
0
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)
# sys.exit()
Exemplo n.º 10
0
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