Exemple #1
0
######### Process

print 'Main Routine: '
mats_lists, gl_lists = None, None

out_stem_dir = out_dir + '/' + out_stem
print '\tCleaning the output dir: ' + out_stem
if os.path.exists(out_stem_dir):
    clean_dir(out_stem_dir)
else:
    os.makedirs(out_stem_dir)

if in_wspace is None:

    print '\tLoading input data...'
    star = sub.Star()
    try:
        star.load(in_star)
    except pexceptions.PySegInputError as e:
        print 'ERROR: input STAR file for filaments could not be loaded because of "' + e.get_message(
        ) + '"'
        print 'Terminated. (' + time.strftime("%c") + ')'
        sys.exit(-1)
    set_lists, lists_dic_rows = surf.SetListTomoOMSegmentations(), dict()
    for row in range(star.get_nrows()):
        ltomos_pkl = star.get_element('_psPickleFile', row)
        ltomos = unpickle_obj(ltomos_pkl)
        set_lists.add_list_tomos(ltomos, ltomos_pkl)
        fkey = os.path.split(ltomos_pkl)[1]
        short_key_idx = fkey.index('_')
        short_key = fkey[:short_key_idx]
print '\t\t-Keep tomograms the ' + str(
    pt_keep) + 'th with the highest number of segmentations.'
print '\t\t-Minimum number of segmentations: ' + str(pt_min_segs)
if pt_min_by_tomo:
    print '\t\t-Num. segmentations computation by tomograms.'
print ''

######### Process

print 'Main Routine: '

print '\tProcessing STAR file rows: '

surfs = list()
print '\tLoading input STAR file(s)...'
star, star_out = sub.Star(), sub.Star()
try:
    star.load(in_star)
    star_out.add_column('_psPickleFile')
except pexceptions.PySegInputError as e:
    print 'ERROR: input STAR file could not be loaded because of "' + e.get_message(
    ) + '"'
    print 'Terminated. (' + time.strftime("%c") + ')'
    sys.exit(-1)

print '\tLoop for tomograms in the list: '
segs_inserted = 0
set_lists = surf.SetListTomoOMSegmentations()
for star_row in range(star.get_nrows()):

    print '\t\tNow list of tomograms initialization...'