Package: bio-pypage
pyPAGEpyPAGE is a novel research tool for the analysis of differential gene expression.Its aim is to provide unbiased estimates of changes in activity of gene regulatory programs.
pyPAGE can be used to detect differentially active biological pathways, targets of transcription factors
and post-transcriptional regulons controlled either by RNA binding proteins or miRNAs.Moreover, pyPAGE is applicable both to the analysis of bulk and single-cell RNA-seq data.InstallationDownloading and installing pyPAGE is as easy as typing the following command in your terminal:pipinstallbio-pypageOr alternatively you can install it from the source:gitclonehttps://github.com/goodarzilab/pypagecdpypage
pipinstall-e.PreliminariespyPAGE is implemented as a python package.To run it, you need to, first, download the relevant gene-set annotations and precompute differential gene expression.You can download preprocessed annotations of TF and RBP regulons fromhere.Moreover,MSigDBis a great resource to search for an annotation of interest.
For example, you might want to use "GO: Gene Ontology gene sets" and "MIR: microRNA targets".
Also there is auseful resourceof TF targets annotations.Then you need to compute differential gene expression.
For the analysis of bulk data, you would typically use DESeq2, limma or EdgeR. These packages provide user with the log fold changes and their significance.
Then differential gene expression can be calculated as 'sign(log_fold_change) * (1-p-value)'.To compute differential expression in single cell data, a good strategy is to use Mann-Whitney U test:importnumpyasnpfromscipy.statsimportmannwhitneyudefcount_difexp_with_u_test(cells_A,cells_B):"""Computes differential gene expression between two groups of cellsParameters----------cells_A: np.ndarrayexpression of genes in the first group of cells (n*m matrix where n is the number of cells and m the number of genes)cells_B: np.ndarrayexpression of genes in the second group of cells"""n_genes=cells_A.shape[1]sign=np.sign(cells_A.mean(axis=0)-cells_B.mean(axis=0))p_values=np.empty(n_genes)p_values[:]=np.nanforiinrange(n_genes):ifnotnp.array_equal(np.unique(cells_A[:,i]),np.unique(cells_B[:,i])):p_values[i]=mannwhitneyu(cells_A[:,i],cells_B[:,i])[1]difexp=sign*(1-p_values)returndifexpNote, that to perform the analysis post-transcriptional regulation, you need to estimate differential trancript stability.
To do this, you need to first compute sample-wise stability estimates of transcripts usingREMBRANDTSand then compare them between two conditions with a t-test.UsageNow that we have completed the preparation, we can proceed directly to using pyPAGE.First, load the relevant gene-set annotation:frompypageimportGeneSetsdefload_annotation(ann_file):gs_ann=GeneSets(ann_file=ann_file,n_bins=3)returngs_annNext, load the expression data and convert gene names to the same format as the one used in the annotation:importpandasaspdfrompypageimportExpressionProfiledefload_expression(expression_file):df=pd.read_csv(expression_file,sep="\t",header=0,names=["gene","exp"])exp=ExpressionProfile(df.iloc[:,0],df.iloc[:,1],n_bins=10)exp.convert_from_to('refseq','ensg','human')returnexpFinally, run pyPAGE algorithm and visualize the results:frompypageimportPAGEdefrun_pyPAGE(expression,annotation):p=PAGE(expression,annotation,n_shuffle=1000,k=7,filter_redundant=True)results,hm=p.run()hm.convert_from_to('gs','ensg','human')hm.show(show_reg=True)returnresultsManualFor an exhaustive description of pyPAGE functions refer to themanual.LicenseMIT licenseCitingSee the paperAbout pyPAGEpyPAGE was developed in Goodarzi lab at UCSF by Artemy Bakulin, Noam B Teyssier and Hani Goodarzi.