Esempio n. 1
0
            tis = ht.argmax(axis=0)
            colors = cm.jet(1.0 * ht.argmax(axis=0) / len(indt))
    
            # 2D plot
            fig, axs = plt.subplots(1, 2, figsize=(12, 6))
            ax = axs[0]
            ax.scatter(M3[0], M3[1], color=colors)
            ax.set_xlabel('PC1')
            ax.set_ylabel('PC2')
            ax.set_title(', '.join([patient.code] + map(str, roi)))
            ax.grid(True)
        
            # Haplotype trajectories
            from hivwholeseq.patients.get_local_haplotypes import plot_haplotype_frequencies
            plot_haplotype_frequencies(patient.times[indt], hft,
                                       figax=(fig, axs[1]),
                                       title=patient.name+', '+' '.join(map(str, roi)))
            #axs[1].set_yscale('logit')

            # 3D plot
            fig = plt.figure()
            ax = fig.add_subplot(111, projection='3d')
            ax.scatter(M3[0], M3[1], M3[2], color=colors)
            ax.set_xlabel('PC1')
            ax.set_ylabel('PC2')
            ax.set_zlabel('PC3')
            ax.set_title(', '.join([patient.code] + map(str, roi)))


    if use_plot:
        plt.ion()
Esempio n. 2
0
    
    if use_plot:
        import matplotlib.pyplot as plt
        from hivwholeseq.patients.get_local_haplotypes import plot_haplotype_frequencies

        def on_click(event):
            '''Print sequence on click'''
            mouseevent = event.mouseevent
            artist = event.artist
            i_clicked = int(artist.get_label())
            (score, ali1, ali2) = align_global(seq0, seqs[i_clicked], score_gapopen=-20)
            pretty_print_pairwise_ali((ali1, ali2), name1='cons0', name2='clicked', width=120)


        (fig, ax) = plot_haplotype_frequencies(patient.times[ind], hft,
                                               title=patient.name+', '+stname,
                                               picker=0.1)

        fig.canvas.mpl_connect('pick_event', on_click)


        plt.ion()
        plt.show()


    # Predict RNA structures
    structs = []
    for i, seq in enumerate(seqs):
        if VERBOSE >= 2:
            print 'Predicting structure n', i+1, 'of', len(seqs)
        label = stname+'_'+str(i)
Esempio n. 3
0
            colors = cm.jet(1.0 * ht.argmax(axis=0) / len(indt))

            # 2D plot
            fig, axs = plt.subplots(1, 2, figsize=(12, 6))
            ax = axs[0]
            ax.scatter(M3[0], M3[1], color=colors)
            ax.set_xlabel('PC1')
            ax.set_ylabel('PC2')
            ax.set_title(', '.join([patient.code] + map(str, roi)))
            ax.grid(True)

            # Haplotype trajectories
            from hivwholeseq.patients.get_local_haplotypes import plot_haplotype_frequencies
            plot_haplotype_frequencies(patient.times[indt],
                                       hft,
                                       figax=(fig, axs[1]),
                                       title=patient.name + ', ' +
                                       ' '.join(map(str, roi)))
            #axs[1].set_yscale('logit')

            # 3D plot
            fig = plt.figure()
            ax = fig.add_subplot(111, projection='3d')
            ax.scatter(M3[0], M3[1], M3[2], color=colors)
            ax.set_xlabel('PC1')
            ax.set_ylabel('PC2')
            ax.set_zlabel('PC3')
            ax.set_title(', '.join([patient.code] + map(str, roi)))

    if use_plot:
        plt.ion()