Ejemplo n.º 1
0
    def volcano_plot(self, save_name=None, out_dir=None, sig_column=False,
                     p_value=0.1, fold_change_cutoff=1.5, x_range=None,
                     y_range=None):
        """ Create a volcano plot of data


        Parameters
        ----------
        save_name: str
            name to save figure
        out_dir: str, directory
            Location to save figure
        sig_column: bool, optional
            If to use significant flags of data
        p_value: float, optional
            Criteria for significant
        fold_change_cutoff: float, optional
            Criteria for significant
        y_range: array_like
            upper and lower bounds of plot in y direction
        x_range: array_like
            upper and lower bounds of plot in x direction

        Returns
        -------
        matplotlib.Figure

        """
        fig = v_plot.volcano_plot(self, save_name=save_name, out_dir=out_dir,
                                  sig_column=sig_column, p_value=p_value,
                                  fold_change_cutoff=fold_change_cutoff,
                                  x_range=x_range, y_range=y_range)
        return fig
Ejemplo n.º 2
0
    def volcano_plot(self,
                     exp_data_type,
                     save_name,
                     out_dir=None,
                     sig_column=False,
                     p_value=0.1,
                     fold_change_cutoff=1.5,
                     x_range=None,
                     y_range=None):
        """ Create a volcano plot of data

        Creates a volcano plot of data type provided

        Parameters
        ----------
        exp_data_type: str
            Type of experimental method for plot
        save_name: str
            name to save figure
        out_dir: str, directory
            Location to save figure
        sig_column: bool, optional
            If to use significant flags of data
        p_value: float, optional
            Criteria for significant
        fold_change_cutoff: float, optional
            Criteria for significant
        y_range: array_like
            upper and lower bounds of plot in y direction
        x_range: array_like
            upper and lower bounds of plot in x direction

        Returns
        -------


        """

        if not self._check_experiment_type_existence(exp_type=exp_data_type):
            return
        data = self.data[self.data[exp_method] == exp_data_type].copy()
        fig = v_plot.volcano_plot(data,
                                  save_name=save_name,
                                  out_dir=out_dir,
                                  sig_column=sig_column,
                                  p_value=p_value,
                                  fold_change_cutoff=fold_change_cutoff,
                                  x_range=x_range,
                                  y_range=y_range)
        return fig
Ejemplo n.º 3
0
    def volcano_plot(self,
                     save_name=None,
                     out_dir=None,
                     sig_column=False,
                     p_value=0.1,
                     fold_change_cutoff=1.5,
                     x_range=None,
                     y_range=None):
        """ Create a volcano plot of data


        Parameters
        ----------
        save_name: str
            name to save figure
        out_dir: str, directory
            Location to save figure
        sig_column: bool, optional
            If to use significant flags of data
        p_value: float, optional
            Criteria for significant
        fold_change_cutoff: float, optional
            Criteria for significant
        y_range: array_like
            upper and lower bounds of plot in y direction
        x_range: array_like
            upper and lower bounds of plot in x direction

        Returns
        -------
        matplotlib.Figure

        """
        fig = v_plot.volcano_plot(self,
                                  save_name=save_name,
                                  out_dir=out_dir,
                                  sig_column=sig_column,
                                  p_value=p_value,
                                  fold_change_cutoff=fold_change_cutoff,
                                  x_range=x_range,
                                  y_range=y_range)
        return fig
# import matplotlib.pyplot as plt
# plt.plot(data['padj'], data['p_value_group_1_and_group_2'], '.')
# plt.show()

data['p_value_group_1_and_group_2'] = data['padj']
# data['p_value_group_1_and_group_2'] = data['PValue']
data[fold_change] = np.where(data[fold_change] > 2, np.exp2(data[fold_change]),
                             -1 * np.exp2(-1 * data[fold_change]))
data[flag] = False

location = (np.abs(data[fold_change]) > 1.5) & (data['padj'] < 0.1)
data.loc[location, flag] = True
data['species_type'] = 'protein'
data['gene'] = data['gene_id']
data['protein'] = data['gene']
data['time'] = 0

data.to_csv('HMCES_two_controls_data.csv', index=False)
# print(data.dtypes)
# exp_data = ExperimentalData('magine_RPE_data.csv', data_directory='.')
vp.volcano_plot(data, 'HMCES_controls',
                image_type='pdf')  #, x_range=[-3,3], y_range=[-1,12])

quit()

magine = Analyzer(exp_data,
                  network='1',
                  metric='enrichment',
                  output_directory='RPE_HTML')
magine.run_go(data_type='rnaseq', run_type='changed', metric='enrichment')
quit