ind=datum['ind'], times=datum['times'], seqs=datum['seqs'], ali=datum['alim'], ) if VERBOSE >= 2: print 'Build tree' times = datum['times'] alim = datum['alim'] hct = datum['hct'] hft = 1.0 * hct / hct.sum(axis=0) ali = expand_annotate_alignment(alim, hft, hct, times, freqmin=freqmin, VERBOSE=VERBOSE) tree = build_tree_fasttree(ali, VERBOSE=VERBOSE) if VERBOSE >= 2: print 'Infer ancestral sequences' a = ancestral_sequences(tree, ali, alphabet='ACGT-N', copy_tree=False, attrname='sequence', seqtype='str') a.calc_ancestral_sequences() 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'
for region in regionspat: if VERBOSE >= 1: print pname, region if VERBOSE == 1: print '' if VERBOSE >= 2: print 'Get alignment' ali = patient.get_consensi_alignment(region) if VERBOSE >= 2: print 'Build tree' sys.stdout.flush() tree = build_tree_fasttree(ali, rootname=ali[0].id, VERBOSE=VERBOSE) if VERBOSE >= 2: print 'Infer ancestral sequences' a = ancestral_sequences(tree, ali, alphabet='ACGT-N', copy_tree=False, attrname='sequence', seqtype='str') a.calc_ancestral_sequences() a.cleanup_tree() if VERBOSE >= 2: print 'Annotate tree' fields = ['DSI', 'muts', 'VL', 'ntemplates', 'CD4', 'subtype'] if region in regionsprot: fields.append('mutsprot')
for region in regions: if VERBOSE >= 1: print region if use_save: if VERBOSE >= 2: print 'Get alignment' ali = get_subtype_reference_alignment(region, subtype=subtype, refname=refname, type=alitype, VERBOSE=VERBOSE) if VERBOSE >= 2: print 'Calculate tree' tree = build_tree_fasttree(ali, VERBOSE=VERBOSE) if VERBOSE >= 2: print 'Save to file, newick' fn_out = get_subtype_reference_alignment_tree_filename(region, subtype=subtype, refname=refname, type=alitype, VERBOSE=VERBOSE, format='newick') Phylo.write([tree], fn_out, 'newick') if VERBOSE >= 2: print 'Annotate tree (for JSON format)'
for region in regionspat: if VERBOSE >= 1: print pname, region if VERBOSE == 1: print '' if VERBOSE >= 2: print 'Get alignment' ali = patient.get_consensi_alignment(region) if VERBOSE >= 2: print 'Build tree' sys.stdout.flush() tree = build_tree_fasttree(ali, rootname=ali[0].id, VERBOSE=VERBOSE) if VERBOSE >= 2: print 'Infer ancestral sequences' a = ancestral_sequences(tree, ali, alphabet='ACGT-N', copy_tree=False, attrname='sequence', seqtype='str') a.calc_ancestral_sequences() a.cleanup_tree() if VERBOSE >= 2: print 'Annotate tree'