Motivation:

key update:

outputprefix="Coloncancer.plasma.0.05.top100"
library("DeconRNASeq")
## Loading required package: limSolve
## Loading required package: pcaMethods
## Loading required package: Biobase
## Loading required package: BiocGenerics
## Loading required package: parallel
## 
## Attaching package: 'BiocGenerics'
## The following objects are masked from 'package:parallel':
## 
##     clusterApply, clusterApplyLB, clusterCall, clusterEvalQ,
##     clusterExport, clusterMap, parApply, parCapply, parLapply,
##     parLapplyLB, parRapply, parSapply, parSapplyLB
## The following objects are masked from 'package:stats':
## 
##     IQR, mad, xtabs
## The following objects are masked from 'package:base':
## 
##     anyDuplicated, append, as.data.frame, as.vector, cbind,
##     colnames, do.call, duplicated, eval, evalq, Filter, Find, get,
##     grep, grepl, intersect, is.unsorted, lapply, lengths, Map,
##     mapply, match, mget, order, paste, pmax, pmax.int, pmin,
##     pmin.int, Position, rank, rbind, Reduce, rownames, sapply,
##     setdiff, sort, table, tapply, union, unique, unlist, unsplit
## Welcome to Bioconductor
## 
##     Vignettes contain introductory material; view with
##     'browseVignettes()'. To cite Bioconductor, see
##     'citation("Biobase")', and for packages 'citation("pkgname")'.
## 
## Attaching package: 'pcaMethods'
## The following object is masked from 'package:stats':
## 
##     loadings
## Loading required package: ggplot2
## 
## Attaching package: 'ggplot2'
## The following object is masked from 'package:limSolve':
## 
##     resolution
## Loading required package: grid
library("ggplot2")
setwd("/home/shg047/oasis/monod/hapinfo/June")
# Colon<-Coloncancerdatapre()
# save(Colon,file=paste(outputprefix,".input.RData",sep=""))
load("Coloncancer.plasma.0.05.top100.input.RData")
######################################################################################################
############## feature selection of tissue specific MHBs for deconvolution ########################
######################################################################################################
# select MHBs with linear pattern in mixture
load("Colon.Decov.linear.Var.RData")
data1=Colon$data[match(linearMHBs,rownames(Colon$data)),]
data1_ref=Colon$ref[match(linearMHBs,rownames(Colon$ref)),]
# select tissue specific MHBs
signatures<-AverageWithGroup(data1_ref)  
outputprefix="TopGSIByCategory"
topGSIVar<-300
topgsi<-TopGSIByCategory(na.omit(Colon$GSI),top=topGSIVar,thresHigh=0.3,thresLow=0.1,plotfigure=T,figprefix=outputprefix)
## 
## Attaching package: 'gplots'
## The following object is masked from 'package:stats':
## 
##     lowess
# simulation data and real data
VirtualMatrix<-data.frame((data1[,grep("CCTmix",colnames(data1))]))
RealMatrix<-data.frame((data1[,grep("CCP|LCP|NCP",colnames(data1))]))

###################################################
##### Deconvolution-QR-Simulation-CCT #############
###################################################
DeconData<-data.frame(VirtualMatrix,signatures[match(rownames(VirtualMatrix),rownames(signatures)),])
DeconData<-na.omit(DeconData)
DeconData.tmp<-DeconData[na.omit(match(topgsi[,1],rownames(DeconData))),]
VirtualMatrix=data.frame(DeconData.tmp[,grep("CCTmix",colnames(DeconData))])
Signatures=data.frame(DeconData.tmp[,-grep("CCTmix",colnames(DeconData))])
library(car)
# NewVirtualMatrix=logit(VirtualMatrix)
# NewSignatures=logit(Signatures)
NewVirtualMatrix=(VirtualMatrix)
NewSignatures=(Signatures)
library("DeconRNASeq")
Rlt<-DeconRNASeq(NewVirtualMatrix,NewSignatures,checksig=FALSE,known.prop = F, use.scale = TRUE, fig = TRUE)
## svd calculated PCA
## Importance of component(s):
##                 PC1     PC2     PC3     PC4     PC5     PC6    PC7     PC8
## R2            0.894 0.08418 0.00741 0.00367 0.00267 0.00239 0.0019 0.00152
## Cumulative R2 0.894 0.97820 0.98561 0.98928 0.99195 0.99434 0.9962 0.99776
##                   PC9   PC10    PC11
## R2            0.00116 0.0007 0.00038
## Cumulative R2 0.99892 0.9996 1.00000
## 
##  Attention: the number of pure cell types = 12  defined in the signature matrix;
## 
##  PCA results indicate that the number of cell types in the mixtures = 5
acc<-Rlt$out.all
rownames(acc)=colnames(NewVirtualMatrix)
acc
##                  Brain        CCT        Colon  Esophagus Heart  Intestine
## CCTmix.0  8.932639e-05 0.01661336 0.0005286128 0.01452074     0 0.03244060
## CCTmix.1  0.000000e+00 0.02782612 0.0070326402 0.02372023     0 0.03571665
## CCTmix.10 1.583038e-02 0.12209812 0.0385686524 0.04382155     0 0.04765881
## CCTmix.15 2.940786e-02 0.16423031 0.0455947920 0.04812829     0 0.05228761
## CCTmix.20 4.351409e-02 0.18800592 0.0642582756 0.06472110     0 0.05989333
## CCTmix.25 4.825924e-02 0.20963408 0.0682378555 0.07151337     0 0.06826273
## CCTmix.30 5.200971e-02 0.22682588 0.0803512757 0.07314986     0 0.07419112
## CCTmix.35 6.011887e-02 0.23713795 0.0749494639 0.07650301     0 0.07885798
## CCTmix.45 5.915626e-02 0.25056842 0.0907372458 0.08198832     0 0.08035094
## CCTmix.5  5.934129e-03 0.07404191 0.0212339166 0.02913797     0 0.04260127
## CCTmix.50 6.674292e-02 0.26389271 0.0930340293 0.07845508     0 0.08114843
##                Kidney        LCT       Liver        Lung      Stomach
## CCTmix.0  0.003395694 0.01165826 0.003246425 0.000163903 0.0024742585
## CCTmix.1  0.001310466 0.01120690 0.000455986 0.001370924 0.0002040236
## CCTmix.10 0.014312175 0.03716157 0.000000000 0.014665960 0.0007810395
## CCTmix.15 0.020075472 0.06211861 0.006951103 0.021187061 0.0092811400
## CCTmix.20 0.028396600 0.06777927 0.013314582 0.021644275 0.0121133840
## CCTmix.25 0.034351128 0.07941853 0.021259800 0.018421303 0.0140992757
## CCTmix.30 0.038750658 0.09176269 0.022596189 0.026864663 0.0210999931
## CCTmix.35 0.045841982 0.09232136 0.030176283 0.023203712 0.0246845899
## CCTmix.45 0.051587229 0.10925795 0.029524429 0.030195869 0.0310136329
## CCTmix.5  0.000945400 0.01894663 0.000000000 0.007599829 0.0000000000
## CCTmix.50 0.055113540 0.11538981 0.031609165 0.024195536 0.0294250513
##                 WBC
## CCTmix.0  0.9148688
## CCTmix.1  0.8911561
## CCTmix.10 0.6651017
## CCTmix.15 0.5407377
## CCTmix.20 0.4363592
## CCTmix.25 0.3665427
## CCTmix.30 0.2923980
## CCTmix.35 0.2562048
## CCTmix.45 0.1856197
## CCTmix.5  0.7995590
## CCTmix.50 0.1609937
fileout=paste("Colon-mixtureSimulation.Deconvolution.",topGSIVar,"M.txt",sep="")
write.table(acc,file=fileout,col.names=NA,row.names=T,sep="\t",quote=F)

idx<-unlist(lapply(strsplit(rownames(acc),"[.]"),function(x) x[[2]]))
y<-as.numeric(acc[,2])
lm.input<-data.frame(x=as.numeric(idx),y=100*y)
lm.input<-lm.input[order(lm.input$x),]
plot(y~x,data=lm.input,type="o",xlab="Expectation",ylab="Observed")
abline(0, 1,lwd=2,col="red")

dev.off()
## null device 
##           1
plot(1,1)
abline(0, 1)




###################################################
##### Deconvolution-QR-Simulation-LCT #############
###################################################

# VirtualMatrix<-data.frame((data1[,grep("LCTmix",colnames(data1))]))
# DeconData<-data.frame(VirtualMatrix,signatures[match(rownames(VirtualMatrix),rownames(signatures)),])
# DeconData<-na.omit(DeconData)
# DeconData.tmp<-DeconData[na.omit(match(topgsi[,1],rownames(DeconData))),]
# VirtualMatrix=data.frame(DeconData.tmp[,grep("LCTmix",colnames(DeconData))])
# Signatures=data.frame(DeconData.tmp[,-grep("LCTmix",colnames(DeconData))])
# library(car)
# NewVirtualMatrix=logit(VirtualMatrix)
# NewSignatures=logit(Signatures)
# NewVirtualMatrix=(VirtualMatrix)
# NewSignatures=(Signatures)
# library("DeconRNASeq")
# Rlt<-try(DeconRNASeq(NewVirtualMatrix,NewSignatures,checksig=FALSE,known.prop = F, use.scale = TRUE, fig = TRUE))
# acc<-Rlt$out.all
# # rownames(acc)=colnames(NewVirtualMatrix)
# acc
# fileout=paste("Lung-mixtureSimulation.Deconvolution.",topGSIVar,"M.txt",sep="")
# write.table(acc,file=fileout,col.names=NA,row.names=T,sep="\t",quote=F)

###################################################
##### Deconvolution-QR-Real-Plasma-Data #############
###################################################
DeconData<-data.frame(RealMatrix,signatures[match(rownames(RealMatrix),rownames(signatures)),])
DeconData.tmp<-DeconData[na.omit(match(topgsi[,1],rownames(DeconData))),]
RealMatrix1=data.frame(DeconData.tmp[,grep("CCP",colnames(DeconData))])
RealMatrix2=data.frame(DeconData.tmp[,grep("NCP",colnames(DeconData))])
RealMatrix3=data.frame(DeconData.tmp[,grep("LCP",colnames(DeconData))])
Signatures=data.frame(DeconData.tmp[,-grep("CCP|LCP|NCP",colnames(DeconData))])
# Normalization (logit transform)
library(car)
# NewRealMatrix1=logit(RealMatrix1)
# NewRealMatrix2=logit(RealMatrix2)
# NewRealMatrix3=logit(RealMatrix3)
NewRealMatrix1=(RealMatrix1)
NewRealMatrix2=(RealMatrix2)
NewRealMatrix3=(RealMatrix3)
NewSignatures=(Signatures)

#NewRealMatrix1=RandomSamplingMean(RealMatrix1)
#NewRealMatrix2=RandomSamplingMean(RealMatrix2)
#NewRealMatrix3=RandomSamplingMean(RealMatrix3)
#NewSignatures=(Signatures)

library("DeconRNASeq")

input1<-inputrim(NewRealMatrix1,NewSignatures)
input2<-inputrim(NewRealMatrix2,NewSignatures)
input3<-inputrim(NewRealMatrix3,NewSignatures)
dim(input1$NewRealMatrix)
## [1] 266  30
dim(input2$NewRealMatrix)
## [1] 23 75
dim(input3$NewRealMatrix)
## [1] 307  29
Rlt1<-DeconRNASeq(input1$NewRealMatrix,input1$NewSignatures,checksig=FALSE,known.prop = F, use.scale = TRUE, fig = TRUE)
## svd calculated PCA
## Importance of component(s):
##                 PC1    PC2    PC3     PC4     PC5    PC6     PC7     PC8
## R2            0.128 0.1107 0.1011 0.09246 0.09136 0.0864 0.07558 0.04232
## Cumulative R2 0.128 0.2387 0.3398 0.43227 0.52363 0.6100 0.68561 0.72793
##                   PC9    PC10    PC11    PC12
## R2            0.03789 0.03644 0.03386 0.03343
## Cumulative R2 0.76582 0.80226 0.83612 0.86955
## 
##  Attention: the number of pure cell types = 12  defined in the signature matrix;
## 
##  PCA results indicate that the number of cell types in the mixtures = 1
Rlt2<-DeconRNASeq(input2$NewRealMatrix,input2$NewSignatures,checksig=FALSE,known.prop = F, use.scale = TRUE, fig = TRUE)
## svd calculated PCA
## Importance of component(s):
##                  PC1    PC2    PC3    PC4    PC5     PC6     PC7     PC8
## R2            0.2442 0.1911 0.1386 0.1311 0.1064 0.08775 0.05923 0.03316
## Cumulative R2 0.2442 0.4353 0.5739 0.7050 0.8114 0.89911 0.95834 0.99150
##                   PC9    PC10    PC11    PC12
## R2            0.00777 0.00054 0.00007 0.00004
## Cumulative R2 0.99927 0.99981 0.99988 0.99992
## 
##  Attention: the number of pure cell types = 12  defined in the signature matrix;
## 
##  PCA results indicate that the number of cell types in the mixtures = 8
Rlt3<-DeconRNASeq(input3$NewRealMatrix,input3$NewSignatures,checksig=FALSE,known.prop = F, use.scale = TRUE, fig = TRUE)
## svd calculated PCA
## Importance of component(s):
##                  PC1    PC2     PC3     PC4     PC5     PC6     PC7
## R2            0.1558 0.1115 0.09485 0.08657 0.08038 0.06697 0.06453
## Cumulative R2 0.1558 0.2673 0.36218 0.44875 0.52913 0.59610 0.66063
##                   PC8     PC9    PC10    PC11    PC12
## R2            0.05535 0.04357 0.04144 0.03581 0.02809
## Cumulative R2 0.71598 0.75955 0.80099 0.83680 0.86489
## 
##  Attention: the number of pure cell types = 12  defined in the signature matrix;
## 
##  PCA results indicate that the number of cell types in the mixtures = 1
acc1<-Rlt1$out.all
acc2<-Rlt2$out.all
acc3<-Rlt3$out.all

rownames(acc1)=colnames(NewRealMatrix1)
rownames(acc2)=colnames(NewRealMatrix2)
rownames(acc3)=colnames(NewRealMatrix3)

acc1<-data.frame(acc1)
acc2<-data.frame(acc2)
acc3<-data.frame(acc3)

write.table(acc1,file="Colon-RealSample.Deconvolution.txt",col.names=NA,row.names=T,sep="\t",quote=F)
write.table(acc2,file="NormalPlasma-RealSample.Deconvolution.txt",col.names=NA,row.names=T,sep="\t",quote=F)
write.table(acc3,file="LungPlasma-RealSample.Deconvolution.txt",col.names=NA,row.names=T,sep="\t",quote=F)
write.table(colMeans(acc1),file="Colon-RealSample.ColMeans.Deconvolution.txt",col.names=NA,row.names=T,sep="\t,quote=F")
write.table(colMeans(acc2),file="NormalPlasma-RealSample.ColMeans.Deconvolution.txt",col.names=NA,row.names=T,sep="\t",quote=F)
write.table(colMeans(acc3),file="LungPlasma-RealSample.ColMeans.Deconvolution.txt",col.names=NA,row.names=T,sep="\t",quote=F)


gginput1<-data.frame(Conv=c(acc1[,2],acc2[,2]),group=c(rep("CCP",nrow(acc1)),rep("NP",nrow(acc2))))
gginput2<-data.frame(Conv=c(acc3[,8],acc2[,8]),group=c(rep("LCP",nrow(acc3)),rep("NP",nrow(acc2))))
#pdf("deconv.boxplot-compare.Full.contribution.pdf")
#par(mfrow=c(2,2))
ggplot(gginput1,aes(factor(group), Conv))+geom_boxplot(outlier.shape = NA,aes(fill = "blue"))+coord_cartesian(ylim=c(0,0.15))+theme_bw()+theme(panel.grid.major = element_blank(),panel.grid.minor = element_blank())+ geom_jitter()

ggplot(gginput2,aes(factor(group), Conv))+geom_boxplot(outlier.shape = NA,aes(fill = "blue"))+coord_cartesian(ylim=c(0,0.15))+theme_bw()+theme(panel.grid.major = element_blank(),panel.grid.minor = element_blank())+ geom_jitter()

#dev.off()

# CCP vs NP
wilcox.test(acc1[,2],acc2[,2])
## 
##  Wilcoxon rank sum test with continuity correction
## 
## data:  acc1[, 2] and acc2[, 2]
## W = 1846.5, p-value = 5.202e-10
## alternative hypothesis: true location shift is not equal to 0
# LCP vs NP
wilcox.test(acc3[,8],acc2[,8])
## 
##  Wilcoxon rank sum test with continuity correction
## 
## data:  acc3[, 8] and acc2[, 8]
## W = 1607.5, p-value = 3.443e-05
## alternative hypothesis: true location shift is not equal to 0
# Colon cancer plasma deconvolution: frequency of DNA from colon cancer
sum(acc1[,2]>0)/nrow(acc1)
## [1] 0.7666667
sum(acc2[,2]>0)/nrow(acc2)
## [1] 0.1333333
# Lung cancer plasma deconvolution: frequency of DNA from colon cancer
sum(acc3[,8]>0)/nrow(acc3)
## [1] 0.8965517
sum(acc2[,8]>0)/nrow(acc2)
## [1] 0.2666667
# As our prior knownlege, WBC should be have higher proportion in the plasma (suppose>0.3)
acc1<-subset(acc1,WBC>0.3)
acc2<-subset(acc2,WBC>0.3)
acc3<-subset(acc3,WBC>0.3)

ci95(c(acc1[,12],acc2[,12],acc3[,12]))
##      rlt                              
## [1,] "mean=0.7203, 95%CI:0.659-0.7816"
ci95(c(acc1[,2]+acc1[,3]))
##      rlt                               
## [1,] "mean=0.0333, 95%CI:0.0126-0.0541"
ci95(c(acc3[,8]+acc3[,10]))
##      rlt                               
## [1,] "mean=0.0784, 95%CI:0.0199-0.1368"
ci95(c(acc1[,2],acc3[,8]))
##      rlt                               
## [1,] "mean=0.0233, 95%CI:0.0043-0.0424"
ci95(c(acc1[,3],acc3[,10]))
##      rlt                               
## [1,] "mean=0.0297, 95%CI:0.0116-0.0478"
ci95(c(acc2[,2]))
##      rlt                               
## [1,] "mean=0.0017, 95%CI:-1e-04-0.0034"
ci95(c(acc2[,8]))
##      rlt                             
## [1,] "mean=0.01, 95%CI:-7e-04-0.0206"
acc1
##              Brain         CCT       Colon  Esophagus      Heart
## CCP.9  0.025270740 0.000000000 0.063343680 0.03186697 0.02878599
## CCP.11 0.023435769 0.029439289 0.032371332 0.06595032 0.02868456
## CCP.19 0.023241743 0.071692098 0.003446407 0.07192530 0.03315948
## CCP.21 0.115219025 0.000000000 0.022489823 0.03339848 0.01736567
## CCP.22 0.000000000 0.000000000 0.012866647 0.03610563 0.02373672
## CCP.24 0.006142883 0.001848379 0.000000000 0.02753909 0.00000000
## CCP.25 0.000000000 0.000000000 0.006491701 0.00000000 0.00800996
## CCP.27 0.043875963 0.000000000 0.021796409 0.01308978 0.04511575
## CCP.29 0.006364790 0.027961271 0.006170940 0.04103095 0.08468497
##          Intestine      Kidney        LCT      Liver         Lung
## CCP.9  0.019288084 0.014844518 0.00000000 0.02836886 0.0006464271
## CCP.11 0.082839649 0.026355348 0.04510773 0.07654744 0.0053470745
## CCP.19 0.097441542 0.032748690 0.15519535 0.08282662 0.0071132641
## CCP.21 0.031356283 0.010911498 0.02355828 0.16239905 0.0859521903
## CCP.22 0.030834460 0.017929940 0.00000000 0.01325291 0.0000000000
## CCP.24 0.036982045 0.015554254 0.03464131 0.30701682 0.2476282744
## CCP.25 0.000000000 0.008784567 0.00000000 0.02610831 0.0000000000
## CCP.27 0.009609106 0.089160110 0.01060676 0.32392450 0.0121135302
## CCP.29 0.008774822 0.063170478 0.00000000 0.28840941 0.0510989552
##            Stomach       WBC
## CCP.9  0.037735729 0.7498490
## CCP.11 0.059072852 0.5248486
## CCP.19 0.115945559 0.3052640
## CCP.21 0.040562758 0.4567870
## CCP.22 0.016339467 0.8489342
## CCP.24 0.005021395 0.3176255
## CCP.25 0.024148190 0.9264573
## CCP.27 0.040637783 0.3900703
## CCP.29 0.059147325 0.3631861
boxplot(acc1,cex.axis=0.75)

colMeans(acc1)
##      Brain        CCT      Colon  Esophagus      Heart  Intestine 
## 0.02706121 0.01454900 0.01877522 0.03565628 0.02994923 0.03523622 
##     Kidney        LCT      Liver       Lung    Stomach        WBC 
## 0.03105104 0.02990105 0.14542821 0.04554441 0.04429012 0.54255800
acc2
##             Brain         CCT       Colon   Esophagus        Heart
## NCP.5  0.00000000 0.000000000 0.000000000 0.000000000 0.0225619972
## NCP.9  0.00000000 0.011267598 0.000000000 0.000000000 0.0000000000
## NCP.24 0.00000000 0.000000000 0.000000000 0.002615390 0.0011329744
## NCP.25 0.00000000 0.000000000 0.000000000 0.000000000 0.0000000000
## NCP.27 0.00000000 0.000000000 0.000000000 0.000000000 0.0000000000
## NCP.28 0.00000000 0.000000000 0.000000000 0.000000000 0.0126833543
## NCP.32 0.29487750 0.000000000 0.000000000 0.000000000 0.0000000000
## NCP.33 0.00000000 0.008416962 0.000000000 0.000000000 0.0071350233
## NCP.34 0.00000000 0.000000000 0.000000000 0.000000000 0.0000000000
## NCP.35 0.00000000 0.000000000 0.038269367 0.000000000 0.0000000000
## NCP.36 0.00000000 0.000000000 0.000000000 0.000000000 0.0002635203
## NCP.38 0.00000000 0.000000000 0.000000000 0.007252322 0.0019117423
## NCP.42 0.00000000 0.000000000 0.000000000 0.000000000 0.0000000000
## NCP.43 0.00000000 0.000000000 0.000000000 0.000000000 0.0821778401
## NCP.44 0.00000000 0.000000000 0.000000000 0.000000000 0.2539760861
## NCP.46 0.00000000 0.000000000 0.000000000 0.000000000 0.1092037439
## NCP.47 0.00000000 0.000000000 0.000000000 0.000000000 0.0000000000
## NCP.48 0.00000000 0.000000000 0.000000000 0.000000000 0.0203801239
## NCP.50 0.00000000 0.000000000 0.000000000 0.000000000 0.0092515184
## NCP.52 0.00000000 0.025059656 0.000000000 0.000000000 0.0000000000
## NCP.53 0.04894342 0.016833366 0.000000000 0.000000000 0.0000000000
## NCP.54 0.18694313 0.000000000 0.000000000 0.000000000 0.0000000000
## NCP.55 0.00000000 0.000000000 0.000000000 0.007408094 0.0022891932
## NCP.57 0.00000000 0.000000000 0.000000000 0.000000000 0.0933248522
## NCP.58 0.00000000 0.000000000 0.007537285 0.000000000 0.1937624528
## NCP.59 0.03380467 0.000000000 0.000000000 0.000000000 0.0000000000
## NCP.61 0.00000000 0.000000000 0.000000000 0.000000000 0.1424488801
## NCP.62 0.00000000 0.000000000 0.000000000 0.000000000 0.0000000000
## NCP.64 0.00000000 0.000000000 0.000000000 0.000000000 0.1819818746
## NCP.66 0.00000000 0.000000000 0.000000000 0.000000000 0.0000000000
## NCP.67 0.00000000 0.000000000 0.000000000 0.000000000 0.0000000000
## NCP.68 0.00000000 0.000000000 0.000000000 0.000000000 0.0659019027
## NCP.69 0.00000000 0.000000000 0.009779630 0.000000000 0.0000000000
## NCP.71 0.00000000 0.000000000 0.000000000 0.000000000 0.0000000000
## NCP.72 0.00000000 0.000000000 0.000000000 0.000000000 0.1210910902
## NCP.73 0.00000000 0.000000000 0.000000000 0.012234298 0.0180112897
## NCP.74 0.00000000 0.000000000 0.000000000 0.000000000 0.0207947581
##        Intestine      Kidney         LCT      Liver        Lung
## NCP.5  0.0000000 0.000000000 0.000000000 0.00000000 0.004764035
## NCP.9  0.1216252 0.000000000 0.038988419 0.00000000 0.000000000
## NCP.24 0.0000000 0.000000000 0.000000000 0.00000000 0.000000000
## NCP.25 0.0000000 0.379838773 0.119521494 0.00000000 0.000000000
## NCP.27 0.0000000 0.000000000 0.000000000 0.45067203 0.000000000
## NCP.28 0.0000000 0.000000000 0.000000000 0.04139663 0.011734417
## NCP.32 0.0000000 0.000000000 0.000000000 0.00000000 0.026610212
## NCP.33 0.0000000 0.000000000 0.000000000 0.06273753 0.000000000
## NCP.34 0.0261595 0.000000000 0.000000000 0.00000000 0.007274000
## NCP.35 0.0000000 0.000000000 0.056304772 0.00000000 0.000000000
## NCP.36 0.0000000 0.005641649 0.000000000 0.00000000 0.000000000
## NCP.38 0.0000000 0.001419471 0.000000000 0.00000000 0.000000000
## NCP.42 0.0000000 0.000000000 0.000000000 0.35429064 0.000000000
## NCP.43 0.0000000 0.000000000 0.000000000 0.00000000 0.135232474
## NCP.44 0.0000000 0.000000000 0.000000000 0.00000000 0.000000000
## NCP.46 0.0000000 0.000000000 0.000000000 0.00000000 0.179793477
## NCP.47 0.0000000 0.041844578 0.000000000 0.00000000 0.000000000
## NCP.48 0.0000000 0.000000000 0.000000000 0.00000000 0.060017447
## NCP.50 0.0000000 0.000000000 0.000000000 0.03017573 0.030129432
## NCP.52 0.0000000 0.000000000 0.000000000 0.65424522 0.000000000
## NCP.53 0.1928496 0.000000000 0.145933334 0.00000000 0.067557592
## NCP.54 0.0000000 0.000000000 0.000000000 0.00000000 0.000000000
## NCP.55 0.0000000 0.001804840 0.000000000 0.00000000 0.000000000
## NCP.57 0.0000000 0.000000000 0.000000000 0.00000000 0.177890314
## NCP.58 0.0000000 0.000000000 0.000000000 0.00000000 0.298734609
## NCP.59 0.0000000 0.000000000 0.000000000 0.00000000 0.000000000
## NCP.61 0.0000000 0.000000000 0.000000000 0.00000000 0.221315699
## NCP.62 0.0264204 0.005455332 0.008642846 0.00000000 0.000000000
## NCP.64 0.0000000 0.000000000 0.000000000 0.00000000 0.000000000
## NCP.66 0.0000000 0.000000000 0.000000000 0.00000000 0.000000000
## NCP.67 0.0000000 0.053688832 0.000000000 0.10313539 0.000000000
## NCP.68 0.0000000 0.000000000 0.000000000 0.03125826 0.165758856
## NCP.69 0.0000000 0.000000000 0.000000000 0.02078924 0.000000000
## NCP.71 0.0000000 0.000000000 0.000000000 0.31059982 0.000000000
## NCP.72 0.0000000 0.000000000 0.000000000 0.00000000 0.200410804
## NCP.73 0.0000000 0.000000000 0.000000000 0.00000000 0.025173720
## NCP.74 0.0000000 0.000000000 0.000000000 0.00000000 0.030777564
##            Stomach       WBC
## NCP.5  0.000000000 0.9726740
## NCP.9  0.000000000 0.8281188
## NCP.24 0.002291566 0.9939601
## NCP.25 0.000000000 0.5006397
## NCP.27 0.000000000 0.5493280
## NCP.28 0.000000000 0.9341856
## NCP.32 0.000000000 0.6785123
## NCP.33 0.000000000 0.9217105
## NCP.34 0.000000000 0.9665665
## NCP.35 0.000000000 0.9054259
## NCP.36 0.010747828 0.9833470
## NCP.38 0.005812744 0.9836037
## NCP.42 0.000000000 0.6457094
## NCP.43 0.000000000 0.7825897
## NCP.44 0.000000000 0.7460239
## NCP.46 0.000000000 0.7110028
## NCP.47 0.000000000 0.9581554
## NCP.48 0.000000000 0.9196024
## NCP.50 0.000000000 0.9304433
## NCP.52 0.008543879 0.3121512
## NCP.53 0.000000000 0.5278827
## NCP.54 0.000000000 0.8130569
## NCP.55 0.004869215 0.9836287
## NCP.57 0.000000000 0.7287848
## NCP.58 0.046090726 0.4538749
## NCP.59 0.000000000 0.9661953
## NCP.61 0.014071273 0.6221641
## NCP.62 0.000000000 0.9594814
## NCP.64 0.000000000 0.8180181
## NCP.66 0.025779621 0.9742204
## NCP.67 0.000000000 0.8431758
## NCP.68 0.000000000 0.7370810
## NCP.69 0.000000000 0.9694311
## NCP.71 0.000000000 0.6894002
## NCP.72 0.003134362 0.6753637
## NCP.73 0.000000000 0.9445807
## NCP.74 0.000000000 0.9484277
boxplot(acc2,cex.axis=0.75)

colMeans(acc2)
##        Brain          CCT        Colon    Esophagus        Heart 
## 0.0152586139 0.0016642590 0.0015023320 0.0007975704 0.0367644383 
##    Intestine       Kidney          LCT        Liver         Lung 
## 0.0099203963 0.0132349588 0.0099835369 0.0556567704 0.0444101258 
##      Stomach          WBC 
## 0.0032794923 0.8075275060
acc3
##             Brain        CCT      Colon  Esophagus      Heart   Intestine
## LCP.11 0.04474880 0.03685255 0.02774744 0.01021664 0.02242827 0.022052805
## LCP.12 0.15603045 0.02084895 0.08902630 0.00000000 0.00000000 0.021195006
## LCP.19 0.01030373 0.00966795 0.04100017 0.05216739 0.13841527 0.004772522
## LCP.21 0.06428793 0.02388306 0.04144403 0.03935496 0.09564646 0.042465850
## LCP.24 0.01413536 0.00000000 0.11254312 0.03534461 0.01243813 0.021945676
## LCP.26 0.01532293 0.00000000 0.04091663 0.15396974 0.04113473 0.043350417
## LCP.27 0.01112237 0.00000000 0.04531218 0.03005449 0.01973201 0.128018053
##             Kidney        LCT      Liver        Lung     Stomach       WBC
## LCP.11 0.087434285 0.01952869 0.18035958 0.026781020 0.064325948 0.4575240
## LCP.12 0.000000000 0.12800152 0.05738088 0.007770412 0.008997862 0.5107486
## LCP.19 0.061329513 0.01541319 0.03550624 0.057774991 0.016049373 0.5575997
## LCP.21 0.065892694 0.00000000 0.08583651 0.049300957 0.071562968 0.4203246
## LCP.24 0.056743425 0.06020549 0.08885315 0.132637839 0.034640707 0.4305125
## LCP.26 0.065262881 0.00000000 0.01591730 0.031541917 0.060639153 0.5319443
## LCP.27 0.001668498 0.01949638 0.20329032 0.000000000 0.035546086 0.5057596
boxplot(acc3,cex.axis=0.75)

colMeans(acc3)
##      Brain        CCT      Colon  Esophagus      Heart  Intestine 
## 0.04513594 0.01303607 0.05685570 0.04587255 0.04711355 0.04054290 
##     Kidney        LCT      Liver       Lung    Stomach        WBC 
## 0.04833304 0.03466361 0.09530628 0.04368673 0.04168030 0.48777332
out<-rbind(colMeans(acc1),colMeans(acc2),colMeans(acc3))
rownames(out)<-c("CCP","NP","LCP")
out
##          Brain         CCT       Colon    Esophagus      Heart   Intestine
## CCP 0.02706121 0.014549004 0.018775215 0.0356562810 0.02994923 0.035236221
## NP  0.01525861 0.001664259 0.001502332 0.0007975704 0.03676444 0.009920396
## LCP 0.04513594 0.013036072 0.056855697 0.0458725458 0.04711355 0.040542904
##         Kidney         LCT      Liver       Lung     Stomach       WBC
## CCP 0.03105104 0.029901047 0.14542821 0.04554441 0.044290117 0.5425580
## NP  0.01323496 0.009983537 0.05565677 0.04441013 0.003279492 0.8075275
## LCP 0.04833304 0.034663609 0.09530628 0.04368673 0.041680300 0.4877733
# pdf("deconv.boxplot.contribution.pdf")
boxplot(acc1,cex.axis=0.7,ylim=c(0,1),horizontal = T,las=1,main="CCP")

boxplot(acc3,cex.axis=0.7,ylim=c(0,1),horizontal = T,las=1,main="LCP")

boxplot(acc2,cex.axis=0.7,ylim=c(0,1),horizontal = T,las=1,main="NP")

# dev.off()

gginput1<-data.frame(Conv=c(acc1[,2],acc2[,2]),group=c(rep("CCP",nrow(acc1)),rep("NP",nrow(acc2))))
gginput2<-data.frame(Conv=c(acc3[,8],acc2[,8]),group=c(rep("LCP",nrow(acc3)),rep("NP",nrow(acc2))))
#  pdf("deconv.boxplot-compare.contribution.pdf")
# par(mfrow=c(2,2))
ggplot(gginput1,aes(factor(group), Conv))+geom_boxplot(outlier.shape = NA)+coord_cartesian(ylim=c(0,0.2))+theme_bw()+theme(panel.grid.major = element_blank(),panel.grid.minor = element_blank())+ geom_jitter()

ggplot(gginput2,aes(factor(group), Conv))+geom_boxplot(outlier.shape = NA)+coord_cartesian(ylim=c(0,0.2))+theme_bw()+theme(panel.grid.major = element_blank(),panel.grid.minor = element_blank())+ geom_jitter()

# dev.off()

ci95(c(acc1[,12],acc2[,12],acc3[,12]))
##      rlt                              
## [1,] "mean=0.7203, 95%CI:0.659-0.7816"
write.table(out,file="Plasma-RealSample.Same.Contribution.Deconvolution.txt",col.names=NA,row.names=T,sep="\t",quote=F)
save.image(file="Deconvolution.image.RData")

Conclustion

We sought to quantify the tumor load based on the deconvolution analysis to the cancer and normal plasma by non-negative decomposition with quadratic programming with the reference of LC, CRC and 10 normal tissues. We estimated that a predominant fraction, 72.0% (95% CI:0.659-0.782) in the cancer and normal plasma were contributed by white blood cells, which is consistent with the levels reported in a recent study based on lower-coverage whole genome bisulfite sequencing (69.4%)16. Primary tumor and normal tissue-of-origin contributes at the similar level of 2.3% (95% CI: 0.4%-4.2%) and 3.0% (95% CI:1.2%-4.4%). We also applied the similar analysis to normal plasma, and we found the tumor contribution to normal plasma were significantly lower (P=3.4x10-5 and 5.2x10-10 for CRC and LC, respectively) than that to cancer plasma, with the contribution of 0.17% and 1.0% for colon and lung cancer respectively. We also found 76.7% CRC and 89.6% LC samples were detected the contribution from tumor tissues while only 13% and 26% normal plasmas have certain (low) tumor contribution. Therefore, circulating cell-free DNA contains a relatively stable fraction of molecules released from various normal tissues, whereas in cancer patient tumor cells and apoptosis cells released DNA molecules that can be more abundant than normal tissues (Table S6).

# R -e 'library("rmarkdown");library("knitr");rmarkdown::render("Deconv.Rmd")'
# R -e 'library("markdown");rpubsUpload("normalDev","Deconv.html")'