a.cleanup_tree() if VERBOSE >= 2: print 'Annotate tree' annotate_tree_time_freq_count(tree, ali) annotate_tree(patient, tree, VERBOSE=VERBOSE) if VERBOSE >= 2: print 'Ladderize tree' tree.ladderize() if use_save: if VERBOSE >= 2: print 'Save tree (JSON)' rname = 'scan_'+str(win_start)+'-'+str(win_end) fn = patient.get_local_tree_filename(rname, format='json') mkdirs(os.path.dirname(fn)) tree_json = tree_to_json(tree.root, fields=('DSI', 'sequence', 'muts', 'VL', 'CD4', 'frequency', 'count', 'confidence'), ) write_json(tree_json, fn) if use_plot: if VERBOSE >= 2: print 'Plot' plot_tree(tree, title=patient.code+', '+str(win_start)+'-'+str(win_end))
maxreads = args.maxreads use_plot = args.plot freqmin = args.freqmin patients = load_patients() if pnames is not None: patients = patients.loc[pnames] for pname, patient in patients.iterrows(): patient = Patient(patient) if VERBOSE >= 1: print pname if os.path.isfile( patient.get_local_tree_filename(roi[0], format='json')): if VERBOSE >= 2: print 'Get tree' region = roi[0] tree = patient.get_local_tree(region) elif os.path.isfile( patient.get_local_tree_filename(' '.join(map(str, roi)), format='json')): if VERBOSE >= 2: print 'Get tree' region = ' '.join(map(str, roi)) tree = patient.get_local_tree(region) else: raise IOError('Tree file not found')
a.cleanup_tree() if VERBOSE >= 2: print 'Annotate tree' annotate_tree_time_freq_count(tree, ali) annotate_tree(patient, tree, VERBOSE=VERBOSE) if VERBOSE >= 2: print 'Ladderize tree' tree.ladderize() if use_save: if VERBOSE >= 2: print 'Save tree (JSON)' rname = 'scan_' + str(win_start) + '-' + str(win_end) fn = patient.get_local_tree_filename(rname, format='json') mkdirs(os.path.dirname(fn)) tree_json = tree_to_json( tree.root, fields=('DSI', 'sequence', 'muts', 'VL', 'CD4', 'frequency', 'count', 'confidence'), ) write_json(tree_json, fn) if use_plot: if VERBOSE >= 2: print 'Plot' plot_tree(tree, title=patient.code + ', ' + str(win_start) + '-' + str(win_end))
VERBOSE = args.verbose maxreads = args.maxreads use_plot = args.plot freqmin = args.freqmin patients = load_patients() if pnames is not None: patients = patients.loc[pnames] for pname, patient in patients.iterrows(): patient = Patient(patient) if VERBOSE >= 1: print pname if os.path.isfile(patient.get_local_tree_filename(roi[0], format='json')): if VERBOSE >= 2: print 'Get tree' region = roi[0] tree = patient.get_local_tree(region) elif os.path.isfile(patient.get_local_tree_filename(' '.join(map(str, roi)), format='json')): if VERBOSE >= 2: print 'Get tree' region = ' '.join(map(str, roi)) tree = patient.get_local_tree(region) else: raise IOError('Tree file not found') if VERBOSE >= 2: