Example #1
0
    def plot_relevance_heatmap(self, onehot_seq, label, save_fig):
        relevance = self.run_relevance(onehot_seq, label)
        seq = dbt.onehot_to_nuc(onehot_seq.T)

        fig, ax = nucheatmap.nuc_heatmap(seq,
                                         relevance,
                                         save_fig=save_fig,
                                         clims=[0, np.max(relevance)],
                                         cmap='Blues')
Example #2
0
    def plot_avg_alipanahi_mutmap_of_batcher(self, batcher, fsuffix=''):

        amutmaps = self.avg_alipanahi_mutmap_of_batcher(batcher)

        for i, amap in enumerate(amutmaps):
            # Note: amax(arr, axis=1) give greatest val for each row (nuc for nx4)

            max_avg_nuc = (amap == np.amax(amap, axis=1,
                                           keepdims=True)).astype(np.float32)

            seq = dbt.onehot_to_nuc(max_avg_nuc.T)

            alipanahi_mutmap_dir = self.save_dir + os.sep + 'alipanahi_mutmap_dir'
            if not os.path.exists(alipanahi_mutmap_dir):
                os.makedirs(alipanahi_mutmap_dir)

            save_fname = alipanahi_mutmap_dir+os.sep+'avg_batcher_mutmap_{}recs_class{}{}.png'.\
                                                        format(batcher.num_records,i,fsuffix)
            nucheatmap.nuc_heatmap(seq, amap.T, save_fig=save_fname)
Example #3
0
    def plot_mutmap(self, onehot_seq, label, save_fig):
        """
        :param onehot_seq: nx4 matrix
        :param label: 
        :returns: 
        :rtype: 
        """

        seq = dbt.onehot_to_nuc(onehot_seq.T)
        mut_onehot = self.mutmap(onehot_seq, label)
        #print "mut_onehot",mut_onehot.shape
        #print mut_onehot
        return nucheatmap.nuc_heatmap(seq, mut_onehot, save_fig=save_fig)
Example #4
0
 def plot_alipanahi_mutmap(self, onehot_seq, label, save_fig):
     seq = dbt.onehot_to_nuc(onehot_seq.T)
     amut_onehot = self.alipanahi_mutmap(onehot_seq, label)
     nucheatmap.nuc_heatmap(seq, amut_onehot.T, save_fig=save_fig)