DeconPeaker, a deconvolution model to estimate cell type proportions of mixtures.

Wrote by Huamei Li
State Key Laboratory of Bioelectronics, School of Biological Science & Medical Engineering, Southeast University, Nanjing 210096, China;
Source: DeconPeaker_demo.ipynb

Demonstrate how DeconPeaker works

Here, we will demonstrate how DeconPeaker works on chromatin accessibility datasets (ATAC-Seq) as well as gene expression datasets (RNA-Seq & Microarray), and employing Cores'syntentic dataset (GSE74912, ATAC-Seq), Liu's dataset (GSE64098, RNS-Seq) and Shen-Orr's dataset (GSE49830, Microarray) as examples.
image.png

Preprocessing chromatin accessibility datasets

DeconPeaker provides a commond line to process chromatin accessibility datasets except gene expression datasets, and this step only supports Linux system. The input file must be YAML format, and including five keys. 1) sample_ID: unique sample ID for each sample.2) bam: BAM of aligned file path 3) batch: batch ID of each sample, if cell type has replicates, batch ID must be the same.4) cellname: cell name of the pure sample. *5) peak: peak file path of the sample. The test YAML format file can see in test/GSE74912_ATAC_pure_cells.yaml

In [6]:
# python deconPeaker.py preprocess --pure=test/GSE74912_ATAC_pure_cells.yaml --thread=10 --prefix=Test --outdir=results

This commond line will create a directory, named "preprocess", including count matrix file and phenotype class file. Both files are the basis for the subsequent analysis.

In [2]:
import matplotlib
import matplotlib.pyplot as plt
import pandas as pd
import seaborn as sns; sns.set()
import matplotlib.image as mpimg 
%matplotlib inline

ATAC-Seq (Syntentic ATAC-Seq dataset)

Deconvolution of synthetic mixtures using DeconPeaker.

In [34]:
# Signature matrix file of ATAC-Seq data
profile = pd.read_csv("./test/examples/ATAC-Seq/GSE74912_Corces_MR_pure_readcounts_signature_matrix.xls", sep='\t', header=0)
In [36]:
# first column: chromosome name; second column: start position of the peak; third column: end position of the peak
profile.head()
Out[36]:
chrom start end Ery CLP CD8T GMP NK CMP CD4T B MEP MPP LMPP HSC MONO
0 chr9 138843753 138844253 525.922078 2.142857 1.015584 1.530612 5.067100 2.891234 2.672727 3.688312 44.317254 2.056277 0.627706 1.387755 4.560606
1 chr11 5248147 5248647 444.412338 3.038961 6.127273 1.591837 4.943723 1.637987 2.688312 4.889610 9.072356 2.140693 1.575758 1.575139 3.768398
2 chr17 29897866 29898366 294.891234 5.075325 2.984416 2.282004 2.452381 1.865260 4.335065 1.694805 16.423006 1.824675 0.878788 0.899814 3.201299
3 chr8 143742756 143743256 336.410714 2.202597 5.041558 2.326531 5.188312 4.012987 5.054545 11.516234 22.645640 3.458874 2.471861 0.653061 5.824675
4 chr19 11009938 11010438 796.711039 2.958442 4.509091 3.719852 4.683983 2.094156 2.496104 4.363636 50.133581 1.768398 3.874459 1.153989 4.190476
In [39]:
mixtures = pd.read_csv('test\examples\ATAC-Seq\GSE74912_Corces_MR_synthetic_mixture_counts_data.xls', sep='\t', header=0)
In [40]:
mixtures.head()
Out[40]:
chrom start end Sample_171 Sample_177 Sample_159 Sample_139 Sample_86 Sample_7 Sample_167 ... Sample_72 Sample_26 Sample_102 Sample_110 Sample_130 Sample_134 Sample_1 Sample_84 Sample_175 Sample_29
0 chr9 138843753 138844253 39 13 2 5 181 0 32 ... 0 56 21 51 28 4 4 15 2 0
1 chr11 5248147 5248647 27 14 6 2 189 4 13 ... 2 9 14 20 12 3 3 14 7 0
2 chr17 29897866 29898366 22 3 7 5 106 2 0 ... 0 13 18 20 0 0 0 2 1 1
3 chr8 143742756 143743256 35 13 3 7 121 0 12 ... 0 17 22 29 4 0 0 20 5 3
4 chr19 11009938 11010438 62 27 7 0 287 2 44 ... 2 58 36 75 32 2 2 22 3 7

5 rows × 198 columns

In [3]:
# Estimate P value of the deconvolution
%run -i deconPeaker.py deconvolution --lib-strategy=ATAC-Seq --mixture=test\examples\ATAC-Seq\GSE74912_Corces_MR_synthetic_mixture_counts_data.xls --pure=test\examples\ATAC-Seq\GSE74912_Corces_MR_pure_readcounts_signature_matrix.xls --format=TABLE --pvalue=FALSE --outdir=results\GSE74912_Corces_MR
INFO  @ Sat, 30 Mar 2019 12:11:59: Deconvolving...... 
INFO  @ Sat, 30 Mar 2019 12:12:28: Showing deconPeaker results:  
                 Ery       CLP      CD8T       GMP        NK       CMP  \
Sample_171  0.069005  0.002305  0.052112  0.067137  0.262002  0.013519   
Sample_177  0.018484  0.111797  0.000000  0.047688  0.263781  0.066290   
Sample_159  0.000289  0.286506  0.000000  0.090313  0.032724  0.016271   
Sample_139  0.006446  0.008090  0.000000  0.000000  0.000000  0.011153   
Sample_86   0.382248  0.165546  0.021309  0.015785  0.003639  0.090452   
Sample_7    0.007999  0.007209  0.916349  0.000000  0.000000  0.011491   
Sample_167  0.023695  0.000000  0.128361  0.187996  0.073575  0.015166   
Sample_141  0.001981  0.002019  0.000000  0.000000  0.000000  0.036645   
Sample_172  0.000000  0.000000  0.000000  0.014935  0.022604  0.154149   
Sample_166  0.049675  0.000019  0.000000  0.083622  0.127072  0.025660   
Sample_114  0.010668  0.028174  0.056157  0.008483  0.203827  0.096467   
Sample_22   0.000000  0.000000  0.055571  0.000000  0.000000  0.495939   
Sample_137  0.000000  0.000000  0.000000  0.687864  0.000000  0.033116   
Sample_169  0.112834  0.000000  0.000000  0.429466  0.000000  0.125604   
Sample_20   0.000000  0.000000  0.000000  0.065468  0.000000  0.015284   
Sample_52   0.000000  0.002601  0.000000  0.117011  0.000000  0.019065   
Sample_32   0.000357  0.000000  0.000000  0.306826  0.241635  0.025446   
Sample_185  0.019105  0.003222  0.086818  0.053216  0.012827  0.008714   
Sample_35   0.002454  0.000000  0.000000  0.000000  0.000000  0.004630   
Sample_129  0.151026  0.085505  0.206924  0.201144  0.004094  0.057004   
Sample_189  0.035838  0.000000  0.008252  0.183060  0.066069  0.052216   
Sample_53   0.006649  0.000000  0.022565  0.026886  0.002181  0.000000   
Sample_2    0.007999  0.007209  0.916349  0.000000  0.000000  0.011491   
Sample_174  0.148746  0.006895  0.307564  0.169932  0.000000  0.063525   
Sample_45   0.002300  0.259215  0.000557  0.050656  0.170581  0.003560   
Sample_124  0.028452  0.028430  0.197630  0.059512  0.067460  0.218544   
Sample_37   0.000000  0.000000  0.282987  0.000000  0.000000  0.415579   
Sample_170  0.044405  0.028099  0.000657  0.000000  0.000000  0.033562   
Sample_179  0.001213  0.001280  0.312717  0.042491  0.000000  0.194529   
Sample_109  0.051599  0.097836  0.000305  0.183930  0.072933  0.039100   
...              ...       ...       ...       ...       ...       ...   
Sample_15   0.004721  0.006773  0.000000  0.000000  0.000000  0.133061   
Sample_36   0.001719  0.074376  0.443061  0.046973  0.058309  0.018756   
Sample_144  0.006104  0.068765  0.020076  0.045633  0.000232  0.000000   
Sample_182  0.006694  0.000000  0.097451  0.016459  0.154426  0.312174   
Sample_71   0.054506  0.000000  0.041444  0.381700  0.000000  0.093443   
Sample_9    0.000000  0.765124  0.039058  0.053942  0.007162  0.000000   
Sample_111  0.063100  0.056569  0.031227  0.096524  0.045304  0.055395   
Sample_164  0.000000  0.003862  0.000000  0.038444  0.000000  0.016292   
Sample_132  0.000000  0.000000  0.000000  0.895003  0.000000  0.031205   
Sample_12   0.003808  0.004497  0.604581  0.000000  0.000000  0.012490   
Sample_19   0.001786  0.438775  0.032893  0.050169  0.001772  0.000000   
Sample_135  0.007999  0.007209  0.916349  0.000000  0.000000  0.011491   
Sample_61   0.006493  0.000000  0.213816  0.007011  0.000000  0.022820   
Sample_131  0.002437  0.002375  0.001982  0.000000  0.007154  0.007586   
Sample_191  0.007833  0.041640  0.237238  0.067803  0.167445  0.057861   
Sample_146  0.018053  0.000000  0.000000  0.036305  0.000000  0.016065   
Sample_70   0.021935  0.003993  0.000000  0.000558  0.000000  0.036680   
Sample_94   0.206965  0.112047  0.013543  0.047056  0.178262  0.063160   
Sample_76   0.005892  0.197990  0.426111  0.079746  0.000000  0.008367   
Sample_67   0.028793  0.000888  0.000000  0.079749  0.146392  0.037310   
Sample_72   0.000000  0.000000  0.191236  0.214558  0.000000  0.099053   
Sample_26   0.008170  0.000000  0.308574  0.026571  0.000000  0.000000   
Sample_102  0.031785  0.001634  0.023625  0.000000  0.000000  0.122485   
Sample_110  0.064845  0.000000  0.000000  0.149448  0.068914  0.072005   
Sample_130  0.013427  0.005491  0.078411  0.257596  0.003052  0.179436   
Sample_134  0.002720  0.000000  0.019477  0.019017  0.000000  0.017883   
Sample_1    0.002720  0.000000  0.019477  0.019017  0.000000  0.017883   
Sample_84   0.019543  0.005681  0.000000  0.008541  0.233237  0.324421   
Sample_175  0.000891  0.059974  0.021029  0.000000  0.196285  0.253763   
Sample_29   0.000000  0.044709  0.002532  0.141323  0.000000  0.028472   

                CD4T         B       MEP       MPP      LMPP       HSC  \
Sample_171  0.286919  0.080115  0.049956  0.000000  0.047004  0.065608   
Sample_177  0.007585  0.049847  0.056509  0.041708  0.218438  0.074697   
Sample_159  0.245973  0.071600  0.000000  0.191758  0.014806  0.046406   
Sample_139  0.909165  0.000000  0.006506  0.000000  0.022982  0.029292   
Sample_86   0.240281  0.024951  0.025254  0.022799  0.000000  0.007111   
Sample_7    0.000000  0.000696  0.006674  0.000000  0.018458  0.025306   
Sample_167  0.077475  0.000000  0.236344  0.109661  0.003750  0.019758   
Sample_141  0.000000  0.001137  0.004514  0.457563  0.033485  0.087058   
Sample_172  0.098320  0.005416  0.094213  0.000000  0.121684  0.488681   
Sample_166  0.269313  0.044658  0.000000  0.000000  0.346870  0.053109   
Sample_114  0.125402  0.157912  0.165681  0.060025  0.032289  0.039300   
Sample_22   0.000000  0.000000  0.008251  0.000000  0.001456  0.022932   
Sample_137  0.000000  0.000000  0.000000  0.000000  0.207391  0.060863   
Sample_169  0.002846  0.101922  0.025135  0.000000  0.000000  0.038024   
Sample_20   0.000000  0.000000  0.000000  0.000000  0.409497  0.509751   
Sample_52   0.000000  0.195255  0.005126  0.000000  0.553017  0.051817   
Sample_32   0.000000  0.000000  0.000000  0.163231  0.013241  0.065218   
Sample_185  0.530688  0.027490  0.135528  0.000000  0.013779  0.079610   
Sample_35   0.225800  0.000000  0.159239  0.000000  0.081876  0.526000   
Sample_129  0.031882  0.031708  0.012263  0.013928  0.014991  0.142482   
Sample_189  0.017345  0.078755  0.000000  0.150492  0.225688  0.163530   
Sample_53   0.015599  0.568169  0.265100  0.092849  0.000000  0.000000   
Sample_2    0.000000  0.000696  0.006674  0.000000  0.018458  0.025306   
Sample_174  0.000000  0.001827  0.000000  0.055316  0.013779  0.227542   
Sample_45   0.035627  0.002814  0.326503  0.037930  0.106171  0.004086   
Sample_124  0.151884  0.000000  0.022977  0.000000  0.086560  0.069520   
Sample_37   0.000000  0.000000  0.008774  0.000000  0.011792  0.280868   
Sample_170  0.078608  0.101329  0.000000  0.398007  0.044851  0.081217   
Sample_179  0.008696  0.048417  0.005765  0.005848  0.168290  0.079154   
Sample_109  0.131991  0.000376  0.000000  0.128336  0.099053  0.155988   
...              ...       ...       ...       ...       ...       ...   
Sample_15   0.787205  0.000000  0.008430  0.000000  0.020020  0.036845   
Sample_36   0.000000  0.000000  0.000000  0.000000  0.312432  0.044375   
Sample_144  0.037720  0.039311  0.697754  0.084407  0.000000  0.000000   
Sample_182  0.000000  0.086396  0.044464  0.046613  0.095138  0.091409   
Sample_71   0.345879  0.007857  0.002259  0.000000  0.008060  0.054167   
Sample_9    0.065779  0.010654  0.000000  0.058281  0.000000  0.000000   
Sample_111  0.004282  0.000000  0.010936  0.236579  0.061940  0.333378   
Sample_164  0.000000  0.031882  0.047121  0.145297  0.157002  0.560100   
Sample_132  0.000000  0.001442  0.000000  0.000000  0.005133  0.051208   
Sample_12   0.000000  0.000000  0.004030  0.000000  0.023293  0.347301   
Sample_19   0.051345  0.006383  0.340733  0.076145  0.000000  0.000000   
Sample_135  0.000000  0.000696  0.006674  0.000000  0.018458  0.025306   
Sample_61   0.054935  0.001702  0.265303  0.325436  0.033688  0.056783   
Sample_131  0.011974  0.004552  0.000717  0.000000  0.008926  0.007960   
Sample_191  0.075073  0.026744  0.010231  0.000000  0.149302  0.092607   
Sample_146  0.179422  0.000000  0.000000  0.000000  0.287876  0.462279   
Sample_70   0.073108  0.193203  0.000000  0.523068  0.036981  0.110474   
Sample_94   0.012000  0.001544  0.000000  0.145337  0.028751  0.164530   
Sample_76   0.000000  0.006903  0.176557  0.085448  0.005635  0.004666   
Sample_67   0.089485  0.060135  0.000000  0.395739  0.032526  0.126118   
Sample_72   0.000000  0.003269  0.002863  0.000000  0.326357  0.161870   
Sample_26   0.000000  0.000000  0.597446  0.059128  0.000000  0.000000   
Sample_102  0.115827  0.018322  0.028146  0.383342  0.091775  0.107564   
Sample_110  0.167869  0.022666  0.179480  0.000000  0.074767  0.035509   
Sample_130  0.000000  0.075293  0.158648  0.015008  0.056496  0.078365   
Sample_134  0.000000  0.000000  0.000000  0.082663  0.012248  0.834613   
Sample_1    0.000000  0.000000  0.000000  0.082663  0.012248  0.834613   
Sample_84   0.211760  0.000000  0.030085  0.000000  0.124828  0.041904   
Sample_175  0.208002  0.000000  0.004527  0.064388  0.047768  0.136915   
Sample_29   0.000000  0.000000  0.000000  0.000000  0.674772  0.064291   

                MONO  Rsquared     RMSEP  P.value  
Sample_171  0.004319  0.901882  0.363123   9999.0  
Sample_177  0.043177  0.929433  0.267294   9999.0  
Sample_159  0.003353  0.965128  0.187042   9999.0  
Sample_139  0.006367  0.971076  0.311728   9999.0  
Sample_86   0.000624  0.960036  0.219079   9999.0  
Sample_7    0.005817  0.970426  0.287941   9999.0  
Sample_167  0.124218  0.915581  0.292051   9999.0  
Sample_141  0.375598  0.964035  0.194355   9999.0  
Sample_172  0.000000  0.963829  0.193128   9999.0  
Sample_166  0.000000  0.952827  0.231412   9999.0  
Sample_114  0.015615  0.899781  0.321434   9999.0  
Sample_22   0.415850  0.958736  0.204069   9999.0  
Sample_137  0.010767  0.964120  0.193424   9999.0  
Sample_169  0.164170  0.897414  0.320054   9999.0  
Sample_20   0.000000  0.982412  0.133039   9999.0  
Sample_52   0.056108  0.969081  0.175474   9999.0  
Sample_32   0.184046  0.939251  0.263239   9999.0  
Sample_185  0.029003  0.918375  0.354923   9999.0  
Sample_35   0.000000  0.965611  0.191280   9999.0  
Sample_129  0.047049  0.889842  0.331949   9999.0  
Sample_189  0.018755  0.956900  0.213534   9999.0  
Sample_53   0.000000  0.957019  0.207844   9999.0  
Sample_2    0.005817  0.970420  0.287952   9999.0  
Sample_174  0.004874  0.923631  0.291261   9999.0  
Sample_45   0.000000  0.961413  0.235662   9999.0  
Sample_124  0.069030  0.882310  0.378099   9999.0  
Sample_37   0.000000  0.949415  0.250509   9999.0  
Sample_170  0.189265  0.937216  0.258138   9999.0  
Sample_179  0.131601  0.915110  0.321045   9999.0  
Sample_109  0.038553  0.928695  0.269380   9999.0  
...              ...       ...       ...      ...  
Sample_15   0.002944  0.961876  0.324503   9999.0  
Sample_36   0.000000  0.956149  0.225591   9999.0  
Sample_144  0.000000  0.980741  0.173848   9999.0  
Sample_182  0.048776  0.916919  0.297648   9999.0  
Sample_71   0.010684  0.895715  0.378440   9999.0  
Sample_9    0.000000  0.992885  0.135468   9999.0  
Sample_111  0.004766  0.955589  0.212073   9999.0  
Sample_164  0.000000  0.977231  0.152945   9999.0  
Sample_132  0.016009  0.956120  0.219218   9999.0  
Sample_12   0.000000  0.957900  0.286822   9999.0  
Sample_19   0.000000  0.979837  0.200670   9999.0  
Sample_135  0.005817  0.970449  0.287905   9999.0  
Sample_61   0.012012  0.956666  0.211691   9999.0  
Sample_131  0.944337  0.986944  0.114236   9999.0  
Sample_191  0.066221  0.905678  0.339293   9999.0  
Sample_146  0.000000  0.975515  0.165734   9999.0  
Sample_70   0.000000  0.958510  0.220389   9999.0  
Sample_94   0.026805  0.936631  0.256603   9999.0  
Sample_76   0.002687  0.943529  0.237747   9999.0  
Sample_67   0.002864  0.951377  0.244850   9999.0  
Sample_72   0.000794  0.964893  0.195831   9999.0  
Sample_26   0.000112  0.979318  0.151744   9999.0  
Sample_102  0.075494  0.948915  0.239723   9999.0  
Sample_110  0.164498  0.900375  0.315143   9999.0  
Sample_130  0.078777  0.906535  0.305368   9999.0  
Sample_134  0.011378  0.903714  0.313925   9999.0  
Sample_1    0.011378  0.904299  0.313042   9999.0  
Sample_84   0.000000  0.924057  0.296757   9999.0  
Sample_175  0.006459  0.927665  0.299319   9999.0  
Sample_29   0.043901  0.980949  0.138964   9999.0  

[195 rows x 16 columns]
INFO  @ Sat, 30 Mar 2019 12:12:28: Elapsed time is 29.1779999733 seconds 
<Figure size 432x288 with 0 Axes>

Scatter plot shows correlation between the preditions and the true proportions

In [42]:
%run -i test\true_VS_est_scatter_plot.py test\examples\ATAC-Seq\GSE74912_Corces_MR_Dirichlet_proportions.xls results\GSE74912_Corces_MR\deconvolution\deconPeaker-Results.xls results\GSE74912_Corces_MR\deconvolution\Truths_Vs_Predictions 
[INFO] Plotting...
<Figure size 432x288 with 0 Axes>

RNA-Seq (Liu's dataset)

Find cell type-specific genes and derive signature matrix.

In [2]:
# input file of findstsps step of DeconPeaker, of which rows represent genes and columns sample names.
profile = pd.read_csv("./test/examples/RNA-Seq/GSE64098_liu_phenotype_classes.xls", sep='\t', header=0, index_col=0)
In [3]:
profile.head()
Out[3]:
GSM1564287_R1_000_TotalRNA.txt GSM1564291_R1_100_TotalRNA.txt GSM1564292_R2_000_TotalRNA.txt GSM1564296_R2_100_TotalRNA.txt GSM1564297_R2D_000_TotalRNA.txt GSM1564301_R2D_100_TotalRNA.txt GSM1564302_R3_000_TotalRNA.txt GSM1564306_R3_100_TotalRNA.txt GSM1564307_R1_000_mRNA.txt GSM1564311_R1_100_mRNA.txt GSM1564312_R2_000_mRNA.txt GSM1564316_R2_100_mRNA.txt GSM1564317_R2D_000_mRNA.txt GSM1564321_R2D_100_mRNA.txt GSM1564322_R3_000_mRNA.txt GSM1564326_R3_100_mRNA.txt
NCI-H1975 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1
HCC827 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2
In [4]:
phenotype = pd.read_csv("./test/examples/RNA-Seq/GSE64098_liu_phenotype_classes.xls", sep='\t', header=0, index_col=0)
In [5]:
# value 1 = indicate membership of the reference sample, value 2 = indicates the class that the sample will be compared against.
phenotype.head()
Out[5]:
GSM1564287_R1_000_TotalRNA.txt GSM1564291_R1_100_TotalRNA.txt GSM1564292_R2_000_TotalRNA.txt GSM1564296_R2_100_TotalRNA.txt GSM1564297_R2D_000_TotalRNA.txt GSM1564301_R2D_100_TotalRNA.txt GSM1564302_R3_000_TotalRNA.txt GSM1564306_R3_100_TotalRNA.txt GSM1564307_R1_000_mRNA.txt GSM1564311_R1_100_mRNA.txt GSM1564312_R2_000_mRNA.txt GSM1564316_R2_100_mRNA.txt GSM1564317_R2D_000_mRNA.txt GSM1564321_R2D_100_mRNA.txt GSM1564322_R3_000_mRNA.txt GSM1564326_R3_100_mRNA.txt
NCI-H1975 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1
HCC827 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2
In [15]:
%run  -i deconPeaker.py findctsps --lib-strategy=RNA-Seq --profile=./test/examples/RNA-Seq/GSE64098_liu_pure_counts_data.xls --phenotype=./test/examples/RNA-Seq/GSE64098_liu_phenotype_classes.xls --outdir=results/GSE64098_liu
INFO  @ Sat, 30 Mar 2019 10:45:00: Loaded 23056 peaks and 16 samples 
INFO  @ Sat, 30 Mar 2019 10:45:00: Normalizing pure profile by QN method to remove batch effects 
INFO  @ Sat, 30 Mar 2019 10:45:00: Filtering out 9914 peaks and 13142 peaks have been remained 
INFO  @ Sat, 30 Mar 2019 10:45:00: Identifying cell specific peaks accross pure cell profile 
INFO  @ Sat, 30 Mar 2019 10:45:07: 13142 cell type specific peaks across 2 cell types were identified 
INFO  @ Sat, 30 Mar 2019 10:45:07: Performing optimization for cell type specific peaks 
INFO  @ Sat, 30 Mar 2019 10:45:08: 5987 cell type specific peaks across 2 cell types were identified 
INFO  @ Sat, 30 Mar 2019 10:45:08: Group size of each phenotype is 110, matrix condition number is 1.78140693448 
INFO  @ Sat, 30 Mar 2019 10:45:09: Final number of cell specific peaks is 220 
INFO  @ Sat, 30 Mar 2019 10:45:09: Elapsed time is 9.1400001049 seconds 
In [16]:
signature_matrix = pd.read_csv('results/GSE64098_liu/findctsps/GSE64098_liu_pure_counts_data_signature_matrix.xls', sep='\t', index_col=0)
In [17]:
signature_matrix.head()
Out[17]:
NCI-H1975 HCC827
56965 641.773438 227.343750
22900 762.640625 253.093750
79891 556.828125 183.898438
8563 4477.648438 1491.351562
64429 1880.257812 644.062500
In [20]:
img = mpimg.imread('results/GSE64098_liu/findctsps/GSE64098_liu_pure_counts_data_signature_heatmap.png')
plt.imshow(img)
plt.show()

Deconvolution of RNA-Seq mixtures using DeconPeaker

In [22]:
%run -i deconPeaker.py deconvolution --lib-strategy=RNA-Seq --mixture=test\examples\RNA-Seq\GSE64098_liu_mixture_counts_data.xls --pure=results\GSE64098_liu\findctsps\GSE64098_liu_pure_counts_data_signature_matrix.xls --format=TABLE --pvalue=TRUE --outdir=results\GSE64098_liu
INFO  @ Sat, 30 Mar 2019 10:59:01: Deconvolving...... 
INFO  @ Sat, 30 Mar 2019 11:01:49: Showing deconPeaker results:  
                                 NCI-H1975    HCC827  Rsquared     RMSEP  \
GSM1564287_R1_000_TotalRNA.txt    0.000000  1.000000  0.917203  0.285275   
GSM1564288_R1_025_TotalRNA.txt    0.278907  0.721093  0.958713  0.194264   
GSM1564289_R1_050_TotalRNA.txt    0.536848  0.463152  0.980185  0.138385   
GSM1564290_R1_075_TotalRNA.txt    0.767427  0.232573  0.912172  0.296004   
GSM1564291_R1_100_TotalRNA.txt    0.985548  0.014452  0.803221  0.441151   
GSM1564292_R2_000_TotalRNA.txt    0.000000  1.000000  0.916615  0.285533   
GSM1564293_R2_025_TotalRNA.txt    0.234248  0.765752  0.974492  0.156238   
GSM1564294_R2_050_TotalRNA.txt    0.484330  0.515670  0.990042  0.095879   
GSM1564295_R2_075_TotalRNA.txt    0.742951  0.257049  0.918806  0.283588   
GSM1564296_R2_100_TotalRNA.txt    0.999869  0.000131  0.812912  0.431788   
GSM1564297_R2D_000_TotalRNA.txt   0.000000  1.000000  0.905250  0.303649   
GSM1564298_R2D_025_TotalRNA.txt   0.246233  0.753767  0.970065  0.171257   
GSM1564299_R2D_050_TotalRNA.txt   0.503965  0.496035  0.969345  0.171381   
GSM1564300_R2D_075_TotalRNA.txt   0.750776  0.249224  0.917621  0.286256   
GSM1564301_R2D_100_TotalRNA.txt   1.000000  0.000000  0.769745  0.476343   
GSM1564302_R3_000_TotalRNA.txt    0.000000  1.000000  0.908718  0.297943   
GSM1564303_R3_025_TotalRNA.txt    0.222465  0.777535  0.967985  0.174491   
GSM1564304_R3_050_TotalRNA.txt    0.462828  0.537172  0.990212  0.093965   
GSM1564305_R3_075_TotalRNA.txt    0.724982  0.275018  0.926824  0.268816   
GSM1564306_R3_100_TotalRNA.txt    1.000000  0.000000  0.796575  0.448654   
GSM1564307_R1_000_mRNA.txt        0.013877  0.986123  0.912627  0.290584   
GSM1564308_R1_025_mRNA.txt        0.301285  0.698715  0.983008  0.127301   
GSM1564309_R1_050_mRNA.txt        0.555744  0.444256  0.981922  0.132486   
GSM1564310_R1_075_mRNA.txt        0.792215  0.207785  0.897155  0.318685   
GSM1564311_R1_100_mRNA.txt        0.999695  0.000305  0.802171  0.443096   
GSM1564312_R2_000_mRNA.txt        0.000000  1.000000  0.907106  0.300835   
GSM1564313_R2_025_mRNA.txt        0.233705  0.766295  0.973378  0.160122   
GSM1564314_R2_050_mRNA.txt        0.488835  0.511165  0.987716  0.107083   
GSM1564315_R2_075_mRNA.txt        0.748121  0.251879  0.914508  0.289976   
GSM1564316_R2_100_mRNA.txt        1.000000  0.000000  0.779477  0.465963   
GSM1564317_R2D_000_mRNA.txt       0.000000  1.000000  0.877934  0.345647   
GSM1564318_R2D_025_mRNA.txt       0.191149  0.808851  0.917772  0.281965   
GSM1564319_R2D_050_mRNA.txt       0.444738  0.555262  0.960783  0.194567   
GSM1564320_R2D_075_mRNA.txt       0.692115  0.307885  0.915744  0.289721   
GSM1564321_R2D_100_mRNA.txt       0.955832  0.044168  0.783326  0.463061   
GSM1564322_R3_000_mRNA.txt        0.000000  1.000000  0.913855  0.290379   
GSM1564323_R3_025_mRNA.txt        0.232364  0.767636  0.969366  0.171054   
GSM1564324_R3_050_mRNA.txt        0.492155  0.507845  0.990085  0.097234   
GSM1564325_R3_075_mRNA.txt        0.752513  0.247487  0.910358  0.297529   
GSM1564326_R3_100_mRNA.txt        1.000000  0.000000  0.793328  0.452488   

                                 P.value  
GSM1564287_R1_000_TotalRNA.txt       0.0  
GSM1564288_R1_025_TotalRNA.txt       0.0  
GSM1564289_R1_050_TotalRNA.txt       0.0  
GSM1564290_R1_075_TotalRNA.txt       0.0  
GSM1564291_R1_100_TotalRNA.txt       0.0  
GSM1564292_R2_000_TotalRNA.txt       0.0  
GSM1564293_R2_025_TotalRNA.txt       0.0  
GSM1564294_R2_050_TotalRNA.txt       0.0  
GSM1564295_R2_075_TotalRNA.txt       0.0  
GSM1564296_R2_100_TotalRNA.txt       0.0  
GSM1564297_R2D_000_TotalRNA.txt      0.0  
GSM1564298_R2D_025_TotalRNA.txt      0.0  
GSM1564299_R2D_050_TotalRNA.txt      0.0  
GSM1564300_R2D_075_TotalRNA.txt      0.0  
GSM1564301_R2D_100_TotalRNA.txt      0.0  
GSM1564302_R3_000_TotalRNA.txt       0.0  
GSM1564303_R3_025_TotalRNA.txt       0.0  
GSM1564304_R3_050_TotalRNA.txt       0.0  
GSM1564305_R3_075_TotalRNA.txt       0.0  
GSM1564306_R3_100_TotalRNA.txt       0.0  
GSM1564307_R1_000_mRNA.txt           0.0  
GSM1564308_R1_025_mRNA.txt           0.0  
GSM1564309_R1_050_mRNA.txt           0.0  
GSM1564310_R1_075_mRNA.txt           0.0  
GSM1564311_R1_100_mRNA.txt           0.0  
GSM1564312_R2_000_mRNA.txt           0.0  
GSM1564313_R2_025_mRNA.txt           0.0  
GSM1564314_R2_050_mRNA.txt           0.0  
GSM1564315_R2_075_mRNA.txt           0.0  
GSM1564316_R2_100_mRNA.txt           0.0  
GSM1564317_R2D_000_mRNA.txt          0.0  
GSM1564318_R2D_025_mRNA.txt          0.0  
GSM1564319_R2D_050_mRNA.txt          0.0  
GSM1564320_R2D_075_mRNA.txt          0.0  
GSM1564321_R2D_100_mRNA.txt          0.0  
GSM1564322_R3_000_mRNA.txt           0.0  
GSM1564323_R3_025_mRNA.txt           0.0  
GSM1564324_R3_050_mRNA.txt           0.0  
GSM1564325_R3_075_mRNA.txt           0.0  
GSM1564326_R3_100_mRNA.txt           0.0  
INFO  @ Sat, 30 Mar 2019 11:01:49: Elapsed time is 168.177000046 seconds 
<Figure size 432x288 with 0 Axes>

Scatter plot shows correlation between the preditions and the true proportions

In [33]:
%run -i test\true_VS_est_scatter_plot.py test\examples\RNA-Seq\GSE64098_liu_annotation_mixture.xls results\GSE64098_liu\deconvolution\deconPeaker-Results.xls results\GSE64098_liu\deconvolution\Truths_Vs_Predictions 
[INFO] Plotting...
<Figure size 432x288 with 0 Axes>

Microarray (Shen-Orr's dataset )

Find cell type-specific probes and derive signature matrix.

In [26]:
%run  -i deconPeaker.py findctsps --lib-strategy=Microarray --profile=./test/examples/Microarray/GSE19830_Shen_Orr_pure_data.xls --phenotype=./test/examples/Microarray/GSE19830_Shen_Orr_phenotype_classes.xls --outdir=results/GSE19830_Shen_Orr
INFO  @ Sat, 30 Mar 2019 11:13:55: Loaded 31099 peaks and 9 samples 
INFO  @ Sat, 30 Mar 2019 11:13:55: Normalizing pure profile by QN method to remove batch effects 
INFO  @ Sat, 30 Mar 2019 11:13:55: Filtering out 10517 peaks and 20582 peaks have been remained 
INFO  @ Sat, 30 Mar 2019 11:13:55: Identifying cell specific peaks accross pure cell profile 
INFO  @ Sat, 30 Mar 2019 11:14:07: 20582 cell type specific peaks across 3 cell types were identified 
INFO  @ Sat, 30 Mar 2019 11:14:07: Performing optimization for cell type specific peaks 
INFO  @ Sat, 30 Mar 2019 11:14:08: 11291 cell type specific peaks across 3 cell types were identified 
INFO  @ Sat, 30 Mar 2019 11:14:08: Group size of each phenotype is 103, matrix condition number is 1.79835755523 
INFO  @ Sat, 30 Mar 2019 11:14:09: Final number of cell specific peaks is 309 
INFO  @ Sat, 30 Mar 2019 11:14:09: Elapsed time is 13.7679998875 seconds 
In [27]:
signature_matrix = pd.read_csv('results/GSE19830_Shen_Orr/findctsps/GSE19830_Shen_Orr_pure_data_signature_matrix.xls', sep='\t', index_col=0)
In [28]:
signature_matrix.head()
Out[28]:
Liver Brain Lung
1383201_at 119.497334 451.036087 1314.770019
1390510_at 106.615310 14.195134 311.444391
1381993_at 213.118159 30.100743 614.717691
1398295_at 209.835129 36.046372 635.003223
1369943_at 427.071344 27.035801 972.969029
In [29]:
img = mpimg.imread('results/GSE19830_Shen_Orr/findctsps/GSE19830_Shen_Orr_pure_data_signature_heatmap.png')
plt.imshow(img)
plt.show()

Deconvolution of Microarray mixtures using DeconPeaker

In [30]:
# Run DeconPeaker without estimating P-value
%run -i deconPeaker.py deconvolution --lib-strategy=Microarray --mixture=test\examples\Microarray\GSE19830_Shen_Orr_mixture_data.xls --pure=results\GSE19830_Shen_Orr\findctsps\GSE19830_Shen_Orr_pure_data_signature_matrix.xls --format=TABLE --pvalue=FALSE --outdir=results\GSE19830_Shen_Orr
INFO  @ Sat, 30 Mar 2019 11:19:45: Deconvolving...... 
INFO  @ Sat, 30 Mar 2019 11:19:47: Showing deconPeaker results:  
              Liver     Brain      Lung  Rsquared     RMSEP  P.value
GSM495209  0.996216  0.003784  0.000000  0.994224  0.074113   9999.0
GSM495210  0.996341  0.003659  0.000000  0.994841  0.070987   9999.0
GSM495211  0.999140  0.000860  0.000000  0.994750  0.071515   9999.0
GSM495212  0.000000  0.992645  0.007355  0.983811  0.158610   9999.0
GSM495213  0.000000  0.988222  0.011778  0.987045  0.147998   9999.0
GSM495214  0.000000  0.986542  0.013458  0.985407  0.153179   9999.0
GSM495215  0.016343  0.009358  0.974299  0.988356  0.129861   9999.0
GSM495216  0.022262  0.007791  0.969947  0.989528  0.128198   9999.0
GSM495217  0.012915  0.013466  0.973619  0.991125  0.124993   9999.0
GSM495218  0.104356  0.282124  0.613520  0.974982  0.159715   9999.0
GSM495219  0.113998  0.277462  0.608540  0.977012  0.151924   9999.0
GSM495220  0.105900  0.278568  0.615532  0.981329  0.139141   9999.0
GSM495221  0.681506  0.075179  0.243315  0.978903  0.145634   9999.0
GSM495222  0.672425  0.077049  0.250525  0.980035  0.141819   9999.0
GSM495223  0.676821  0.073114  0.250065  0.982243  0.133953   9999.0
GSM495224  0.339238  0.601045  0.059717  0.766633  0.473838   9999.0
GSM495225  0.343823  0.602271  0.053906  0.873838  0.355616   9999.0
GSM495226  0.347979  0.596709  0.055311  0.877490  0.350486   9999.0
GSM495227  0.669657  0.276106  0.054237  0.955302  0.210130   9999.0
GSM495228  0.665056  0.275480  0.059464  0.953912  0.212929   9999.0
GSM495229  0.667258  0.274826  0.057916  0.954618  0.211560   9999.0
GSM495230  0.493681  0.410272  0.096047  0.879481  0.345256   9999.0
GSM495231  0.499193  0.406143  0.094664  0.888192  0.332085   9999.0
GSM495232  0.504479  0.400577  0.094944  0.890458  0.328935   9999.0
GSM495233  0.553054  0.217395  0.229552  0.955262  0.209880   9999.0
GSM495234  0.560348  0.215690  0.223963  0.949312  0.223388   9999.0
GSM495235  0.559376  0.216008  0.224616  0.945747  0.231079   9999.0
GSM495236  0.526423  0.298236  0.175342  0.929004  0.264062   9999.0
GSM495237  0.525521  0.298913  0.175566  0.927426  0.267065   9999.0
GSM495238  0.521566  0.302589  0.175846  0.930833  0.260362   9999.0
GSM495239  0.562861  0.301074  0.136066  0.935301  0.252592   9999.0
GSM495240  0.562595  0.300160  0.137245  0.925509  0.270911   9999.0
GSM495241  0.566489  0.296159  0.137351  0.925611  0.270587   9999.0
GSM495242  0.534005  0.371339  0.094655  0.895360  0.320866   9999.0
GSM495243  0.539363  0.366253  0.094384  0.893362  0.324820   9999.0
GSM495244  0.538455  0.368122  0.093423  0.899921  0.314384   9999.0
GSM495245  0.609537  0.333211  0.057251  0.915541  0.288960   9999.0
GSM495246  0.602622  0.339619  0.057758  0.928332  0.266229   9999.0
GSM495247  0.602907  0.336797  0.060296  0.916256  0.288057   9999.0
GSM495248  0.641023  0.335391  0.023586  0.927967  0.267693   9999.0
GSM495249  0.635061  0.340779  0.024160  0.928379  0.266273   9999.0
GSM495250  0.639054  0.335221  0.025725  0.876761  0.344111   9999.0
INFO  @ Sat, 30 Mar 2019 11:19:47: Elapsed time is 3.0720000267 seconds 
<Figure size 432x288 with 0 Axes>

Scatter plot shows correlation between the preditions and the true proportions

In [32]:
%run -i test\true_VS_est_scatter_plot.py test\examples\Microarray\GSE19830_Shen_Orr_annotation_mixture.xls results\GSE19830_Shen_Orr\deconvolution\deconPeaker-Results.xls results\GSE19830_Shen_Orr\deconvolution\Truths_Vs_Predictions 
[INFO] Plotting...
<Figure size 432x288 with 0 Axes>