Introduction

Let’s QC this data.

suppressPackageStartupMessages({
  library("gplots")
  library("reshape2")
  library("WGCNA")
  library("dplyr")
  library("DESeq2")
  library("mitch")
  library("MASS")
})

Multi-qc results

Please have a look at the multiQC report. Here are a few key points:

  • Skewer trimming resulted in loss of only a tiny number of bases. This indicates the sequence quality is very high.

  • Fastqc results showing the number of unique and duplicate reads indicates a few samples with <10M unique reads.

  • Per seqence GC content showed an unusual profile for two samples. PG1423-EOS R1 and R2 had GC profile max at 40% compared to the mean. PG2090-EOS also showed an unusual pattern with underrepresented low GC%.

  • Sequence duplication levels were elevated for some fastq files. Here are the files of concern, with <20% unique reads: PG3627-POD1_S86_R1_001 PG3627-POD1_S86_R2_001 PG3609-T0_S317_R1_001 PG2090-EOS_S134_R1_001 PG2090-EOS_S134_R2_001

  • There were two files with overrepresented sequences: PG2090-EOS R1 and R2. Others are okay.

  • Adapter content was very low which is good.

The fastq files were also checked with validatefastq-assembly which looks for signs of file corruption which can occur in large data transfers. No problematic files were detected.

rRNA amount

Ribosomal RNA carryover can be a source of noise. The proportion should be <10% and there were a few samples in excess of this including PG2020-EOS, PG815-EOS, PG1452-EOS and PG702-POD1.

rrna <- read.table("rrna_stats.txt")
rrna <- rrna[,c(1,5)]
rrna$V1 <- sapply(strsplit(rrna$V1,"\\."),"[[",1)
rrna$V5 <- gsub("\\(","",rrna$V5)
rrna$V5 <- gsub("%","",rrna$V5)
rrna$V5 <- as.numeric(rrna$V5)
str(rrna)
## 'data.frame':    319 obs. of  2 variables:
##  $ V1: chr  "3166-POD1_S266_R1_001" "3166-T0_S265_R1_001" "3167-POD1_S268_R1_001" "3167-T0_S267_R1_001" ...
##  $ V5: num  0.57 1.11 0.61 0.93 0.96 0.79 0.7 5.2 1.14 2.83 ...
rrna2 <- rrna[,2]
names(rrna2) <- rrna[,1]

par(mar=c(5,8,3,1))
barplot(rrna2,horiz=TRUE,las=1,cex.names=0.5,main="rRNA carryover")

rrna2 <- rrna2[order(-rrna2)]
barplot(head(rrna2,20),horiz=TRUE,las=1,cex.names=0.6,main="rRNA carryover")

Load the data

tmp <- read.table("3col.tsv.gz",header=FALSE)
x <- as.matrix(acast(tmp, V2~V1, value.var="V3", fun.aggregate = sum))
x <- as.data.frame(x)
accession <- sapply((strsplit(rownames(x),"\\|")),"[[",2)
symbol<-sapply((strsplit(rownames(x),"\\|")),"[[",6)
x$geneid <- paste(accession,symbol)
xx <- aggregate(. ~ geneid,x,sum)
rownames(xx) <- xx$geneid
colnames <- gsub("T0R","T0",colnames(xx))
xx$geneid = NULL
xx <- round(xx)
xx[1:10,1:6]
##                             3166-POD1 3166-T0 3167-POD1 3167-T0 3171-POD1
## ENSG00000000003.15 TSPAN6           3       1         5       5        23
## ENSG00000000005.6 TNMD              0       0         0       0         0
## ENSG00000000419.14 DPM1           685     577       521     735       811
## ENSG00000000457.14 SCYL3          622     611       550     777       789
## ENSG00000000460.17 C1orf112       181     171       232     263       215
## ENSG00000000938.13 FGR          33797   44344     31524   38959     26402
## ENSG00000000971.16 CFH            106      40        98     183       195
## ENSG00000001036.14 FUCA2         1229     769      1150     868       978
## ENSG00000001084.13 GCLC           944    1085       577     961       908
## ENSG00000001167.15 NFYA          1243    1277      1295    1605      1166
##                             3171-T0
## ENSG00000000003.15 TSPAN6         4
## ENSG00000000005.6 TNMD            1
## ENSG00000000419.14 DPM1         494
## ENSG00000000457.14 SCYL3        575
## ENSG00000000460.17 C1orf112     196
## ENSG00000000938.13 FGR        33751
## ENSG00000000971.16 CFH          130
## ENSG00000001036.14 FUCA2        805
## ENSG00000001084.13 GCLC         798
## ENSG00000001167.15 NFYA        1251

Number of reads per sample

Let’s look at the number of reads per sample

Most samples were in the range of 25-30 million assigned reads. Just 2 samples had less than 20 million reads: PG1452-EOS and PG1423-EOS. The maximum read count was about 40 million for PG7072-EOS.

xxcs <- colSums(xx)
par(mar=c(5,8,3,1))
barplot(xxcs,horiz=TRUE,las=1,main="no. reads per sample")

barplot(head(xxcs[order(xxcs)],20),horiz=TRUE,las=1,main="lowest no. reads per sample")

barplot(head(xxcs[order(-xxcs)],20),horiz=TRUE,las=1,main="highest no. reads per sample")

MDS

Some outliers are apparent.

PG2090-EOS to the left of the chart - this is clearly the effect of rRNA carryover. Other samples over to the left of the chart include PG815-EOS, PG145-EOS and PG702-POD1 which all have elevated rRNA.

heatmap.2( cor(xx),trace="none",scale="none")

mds <- cmdscale(dist(t(xx)))

par(mar=c(5,5,3,1))
minx <- min(mds[,1])
maxx <- max(mds[,1])
miny <- min(mds[,2])
maxy <- max(mds[,2])

plot(mds, xlab="Coordinate 1", ylab="Coordinate 2",
  xlim=c(minx*1.1,maxx*1.1), ylim = c(miny*1.1,maxy*1.1) ,
  type = "p", col="gray", pch=19, cex.axis=1.3,cex.lab=1.3, bty='n')
text(mds, labels=rownames(mds), cex=0.8)

col <- rownames(mds)
col <- sapply(strsplit(col,"-"),"[[",2)
col <- gsub("T0","lightblue",col)
col <- gsub("POD1","orange",col)
col <- gsub("EOS","pink",col)

plot(mds, xlab="Coordinate 1", ylab="Coordinate 2",
  xlim=c(minx*1.1,maxx*1.1), ylim = c(miny*1.1,maxy*1.1) , cex=1.5 ,
  type = "p", col=col, pch=19, cex.axis=1.3,cex.lab=1.3, bty='n')
#text(mds, labels=rownames(mds), cex=0.8) 
mtext("blue=T0, orange=POD1, pink=EOS")

Exclude PG2090-EOS and repeat the analysis.

xx <- xx[,grep("PG2090-EOS",colnames(xx),invert=TRUE)]

mds <- cmdscale(dist(t(xx)))

par(mar=c(5,5,3,1))
minx <- min(mds[,1])
maxx <- max(mds[,1])
miny <- min(mds[,2])
maxy <- max(mds[,2])

plot(mds, xlab="Coordinate 1", ylab="Coordinate 2",
  xlim=c(minx*1.1,maxx*1.1), ylim = c(miny*1.1,maxy*1.1) ,
  type = "p", col="gray", pch=19, cex.axis=1.3,cex.lab=1.3, bty='n')
text(mds, labels=rownames(mds), cex=0.8)

col <- rownames(mds)
col <- sapply(strsplit(col,"-"),"[[",2)
col <- gsub("T0","lightblue",col)
col <- gsub("POD1","orange",col)
col <- gsub("EOS","pink",col)

plot(mds, xlab="Coordinate 1", ylab="Coordinate 2",
  xlim=c(minx*1.1,maxx*1.1), ylim = c(miny*1.1,maxy*1.1) , cex=1.5 ,
  type = "p", col=col, pch=19, cex.axis=1.3,cex.lab=1.3, bty='n')
#text(mds, labels=rownames(mds), cex=0.8) 
mtext("blue=T0, orange=POD1, pink=EOS")

In the MDS plot with PG2090-EOS removed, there appears to be some separation of T0, POD1 and EOS samples. POD1 (orange) are more towards the upper side of the chart and T0 (blue) are toward the bottom right. EOS (pink) are quite spread out.

Conclusion

PG2090-EOS suffered rRNA carryover and needs to be re-prepared. The other samples with slightly higher rRNA are not a problem as the rRNA can be corrected for statistically. not sure what to do about samples with low numbers of unique reads.

Load patient info

xx <- xx[,order(colnames(xx))]

ss <- read.csv("PADDIgenomicsData.csv")
ss <- ss[order(ss$PG_number),]
colnames(ss)
##  [1] "PG_number"                        "sexD"                            
##  [3] "ageD"                             "weightD"                         
##  [5] "heightD"                          "asaD"                            
##  [7] "ethnicityD"                       "ethnicity_otherD"                
##  [9] "current_smokerD"                  "diabetes_typeD"                  
## [11] "daily_insulinD"                   "oral_hypoglycemicsD"             
## [13] "non_insulin_injectablesD"         "diabetes_yrs_since_diagnosisD"   
## [15] "DM_years"                         "creatinine_preopD"               
## [17] "crp_preopD"                       "crp_preop_typeD"                 
## [19] "crp_preop_naD"                    "hba1c_doneD"                     
## [21] "surgery_typeD"                    "surgery_procedureD"              
## [23] "surgery_dominantD"                "wound_typeOP"                    
## [25] "non_study_dexameth_steriodPOSTOP" "nonstudy_dexameth_steriodD3"     
## [27] "HbA1c"                            "bmi"                             
## [29] "whodas_total_preop"               "revised_whodas_preop"            
## [31] "neut_lymph_ratio_d0"              "neut_lymph_ratio_d1"             
## [33] "neut_lymph_ratio_change_d1"       "neut_lymph_ratio_d2"             
## [35] "neut_lymph_ratio_change_d2"       "neut_lymph_ratio_d1_2"           
## [37] "neut_lymph_ratio_d2_2"            "ab_noninfection"                 
## [39] "risk"                             "risk_cat"                        
## [41] "bmi_cat"                          "asa_cat"                         
## [43] "wound_type_cat"                   "oxygen_quin"                     
## [45] "duration_sx"                      "duration_sx_quin"                
## [47] "anyDex"                           "anyDex_count"                    
## [49] "anyDexMiss"                       "anyDex2"                         
## [51] "treatment_group"                  "deltacrp"                        
## [53] "crp_group"
str(ss)
## 'data.frame':    117 obs. of  53 variables:
##  $ PG_number                       : chr  "3166" "3167" "3171" "3172" ...
##  $ sexD                            : chr  "Male" "Male" "Male" "Male" ...
##  $ ageD                            : int  62 67 61 78 73 77 84 54 70 62 ...
##  $ weightD                         : num  64.5 78.8 71.1 43 83.6 ...
##  $ heightD                         : num  163 169 165 156 171 167 133 155 170 175 ...
##  $ asaD                            : int  2 2 2 2 2 3 3 2 2 2 ...
##  $ ethnicityD                      : chr  "Asian" "Asian" "Asian" "Asian" ...
##  $ ethnicity_otherD                : chr  "" "" "" "" ...
##  $ current_smokerD                 : chr  "No" "No" "No" "No" ...
##  $ diabetes_typeD                  : chr  "" "" "" "" ...
##  $ daily_insulinD                  : chr  "" "" "" "" ...
##  $ oral_hypoglycemicsD             : chr  "" "" "" "" ...
##  $ non_insulin_injectablesD        : chr  "" "" "" "" ...
##  $ diabetes_yrs_since_diagnosisD   : int  NA NA NA NA NA 1 NA NA NA NA ...
##  $ DM_years                        : int  NA NA NA NA NA 1 NA NA NA NA ...
##  $ creatinine_preopD               : int  68 82 82 96 105 90 54 47 109 98 ...
##  $ crp_preopD                      : chr  "2.1" "0.6" "2.7" "1.2" ...
##  $ crp_preop_typeD                 : chr  "CRP" "CRP" "CRP" "CRP" ...
##  $ crp_preop_naD                   : int  0 0 0 0 0 0 0 0 0 0 ...
##  $ hba1c_doneD                     : chr  "Yes" "Yes" "Yes" "Yes" ...
##  $ surgery_typeD                   : chr  "Laparoscopic assisted low anterior resection of rectum" "Laparoscopic sigmoidectomy" "Laparoscopic assisted anterior resection of rectum" "Robotic assisted laparoscopic radical prostatectomy, pelvic lymph node dissection" ...
##  $ surgery_procedureD              : chr  "None of the above" "None of the above" "None of the above" "None of the above" ...
##  $ surgery_dominantD               : chr  "Gastrointestinal" "Gastrointestinal" "Gastrointestinal" "Urology-renal" ...
##  $ wound_typeOP                    : chr  "Clean / contaminated" "Clean / contaminated" "Clean / contaminated" "Clean / contaminated" ...
##  $ non_study_dexameth_steriodPOSTOP: chr  "No" "No" "No" "No" ...
##  $ nonstudy_dexameth_steriodD3     : chr  "No" "No" "No" "No" ...
##  $ HbA1c                           : num  5.7 6.2 6.2 6.3 6.3 ...
##  $ bmi                             : num  24.3 27.6 26.1 17.7 28.6 ...
##  $ whodas_total_preop              : int  16 12 12 12 12 12 24 14 12 12 ...
##  $ revised_whodas_preop            : int  16 12 12 12 12 12 24 14 12 12 ...
##  $ neut_lymph_ratio_d0             : num  4.3 2.94 2.29 2.93 2.62 ...
##  $ neut_lymph_ratio_d1             : num  13 6.5 7.22 23.2 8.57 ...
##  $ neut_lymph_ratio_change_d1      : num  8.7 3.56 4.93 20.27 5.95 ...
##  $ neut_lymph_ratio_d2             : num  5.92 3.68 3.77 22 NA ...
##  $ neut_lymph_ratio_change_d2      : num  1.623 0.741 1.475 19.071 NA ...
##  $ neut_lymph_ratio_d1_2           : num  13 6.5 7.22 23.2 8.57 ...
##  $ neut_lymph_ratio_d2_2           : num  5.92 3.68 3.77 22 NA ...
##  $ ab_noninfection                 : int  1 1 0 1 1 1 1 1 1 1 ...
##  $ risk                            : int  2 2 2 2 2 5 4 1 2 1 ...
##  $ risk_cat                        : chr  "Moderate" "Moderate" "Moderate" "Moderate" ...
##  $ bmi_cat                         : chr  "Normal [18.5 to <25]" "Overweight [25 to <30]" "Overweight [25 to <30]" "Underweight [BMI<18.5]" ...
##  $ asa_cat                         : chr  "1-2" "1-2" "1-2" "1-2" ...
##  $ wound_type_cat                  : chr  "Contaminated" "Contaminated" "Contaminated" "Contaminated" ...
##  $ oxygen_quin                     : chr  "0.21-0.4" "0.21-0.4" "0.21-0.4" "0.21-0.4" ...
##  $ duration_sx                     : num  2.5 2.67 2.42 3.17 2.5 ...
##  $ duration_sx_quin                : chr  "2.18-2.82" "2.18-2.82" "2.18-2.82" "2.83-3.75" ...
##  $ anyDex                          : chr  "No" "No" "No" "No" ...
##  $ anyDex_count                    : int  0 0 0 0 0 0 0 0 0 0 ...
##  $ anyDexMiss                      : int  0 0 0 0 0 0 0 0 0 0 ...
##  $ anyDex2                         : int  0 0 0 0 0 0 0 0 0 0 ...
##  $ treatment_group                 : int  1 1 2 2 1 1 2 1 2 1 ...
##  $ deltacrp                        : num  39.3 38.3 49 189.9 7.3 ...
##  $ crp_group                       : int  1 1 1 4 1 1 4 1 4 1 ...
summary(ss)
##   PG_number             sexD                ageD          weightD      
##  Length:117         Length:117         Min.   :25.00   Min.   : 41.00  
##  Class :character   Class :character   1st Qu.:54.00   1st Qu.: 68.50  
##  Mode  :character   Mode  :character   Median :62.00   Median : 82.00  
##                                        Mean   :61.03   Mean   : 84.55  
##                                        3rd Qu.:69.00   3rd Qu.: 95.40  
##                                        Max.   :86.00   Max.   :185.00  
##                                                                        
##     heightD           asaD        ethnicityD        ethnicity_otherD  
##  Min.   :133.0   Min.   :1.000   Length:117         Length:117        
##  1st Qu.:163.0   1st Qu.:2.000   Class :character   Class :character  
##  Median :171.0   Median :2.000   Mode  :character   Mode  :character  
##  Mean   :170.2   Mean   :2.308                                        
##  3rd Qu.:178.0   3rd Qu.:3.000                                        
##  Max.   :193.0   Max.   :4.000                                        
##                                                                       
##  current_smokerD    diabetes_typeD     daily_insulinD     oral_hypoglycemicsD
##  Length:117         Length:117         Length:117         Length:117         
##  Class :character   Class :character   Class :character   Class :character   
##  Mode  :character   Mode  :character   Mode  :character   Mode  :character   
##                                                                              
##                                                                              
##                                                                              
##                                                                              
##  non_insulin_injectablesD diabetes_yrs_since_diagnosisD    DM_years     
##  Length:117               Min.   : 1.000                Min.   : 1.000  
##  Class :character         1st Qu.: 1.500                1st Qu.: 1.500  
##  Mode  :character         Median : 7.000                Median : 7.000  
##                           Mean   : 7.467                Mean   : 7.467  
##                           3rd Qu.:11.000                3rd Qu.:11.000  
##                           Max.   :18.000                Max.   :18.000  
##                           NA's   :102                   NA's   :102     
##  creatinine_preopD  crp_preopD        crp_preop_typeD    crp_preop_naD
##  Min.   : 19.0     Length:117         Length:117         Min.   :0    
##  1st Qu.: 66.0     Class :character   Class :character   1st Qu.:0    
##  Median : 76.0     Mode  :character   Mode  :character   Median :0    
##  Mean   : 80.3                                           Mean   :0    
##  3rd Qu.: 91.0                                           3rd Qu.:0    
##  Max.   :177.0                                           Max.   :0    
##  NA's   :10                                                           
##  hba1c_doneD        surgery_typeD      surgery_procedureD surgery_dominantD 
##  Length:117         Length:117         Length:117         Length:117        
##  Class :character   Class :character   Class :character   Class :character  
##  Mode  :character   Mode  :character   Mode  :character   Mode  :character  
##                                                                             
##                                                                             
##                                                                             
##                                                                             
##  wound_typeOP       non_study_dexameth_steriodPOSTOP
##  Length:117         Length:117                      
##  Class :character   Class :character                
##  Mode  :character   Mode  :character                
##                                                     
##                                                     
##                                                     
##                                                     
##  nonstudy_dexameth_steriodD3     HbA1c             bmi       
##  Length:117                  Min.   : 4.500   Min.   :16.59  
##  Class :character            1st Qu.: 5.200   1st Qu.:24.93  
##  Mode  :character            Median : 5.600   Median :28.07  
##                              Mean   : 5.714   Mean   :29.00  
##                              3rd Qu.: 5.900   3rd Qu.:31.73  
##                              Max.   :10.000   Max.   :72.27  
##                                                              
##  whodas_total_preop revised_whodas_preop neut_lymph_ratio_d0
##  Min.   :12.00      Min.   :12.00        Min.   : 0.5312    
##  1st Qu.:12.00      1st Qu.:12.00        1st Qu.: 1.8254    
##  Median :14.00      Median :14.00        Median : 2.5737    
##  Mean   :16.74      Mean   :16.74        Mean   : 2.8745    
##  3rd Qu.:17.00      3rd Qu.:17.00        3rd Qu.: 3.3338    
##  Max.   :50.00      Max.   :50.00        Max.   :11.0000    
##                                          NA's   :9          
##  neut_lymph_ratio_d1 neut_lymph_ratio_change_d1 neut_lymph_ratio_d2
##  Min.   : 1.375      Min.   :-1.255             Min.   : 0.1235    
##  1st Qu.: 5.132      1st Qu.: 2.610             1st Qu.: 3.7692    
##  Median : 7.353      Median : 4.450             Median : 6.7273    
##  Mean   : 8.882      Mean   : 6.088             Mean   : 8.1589    
##  3rd Qu.:11.627      3rd Qu.: 8.730             3rd Qu.:10.8889    
##  Max.   :44.000      Max.   :39.299             Max.   :25.6042    
##  NA's   :13          NA's   :21                 NA's   :28         
##  neut_lymph_ratio_change_d2 neut_lymph_ratio_d1_2 neut_lymph_ratio_d2_2
##  Min.   :-6.182             Min.   : 1.375        Min.   : 0.1235      
##  1st Qu.: 1.591             1st Qu.: 5.132        1st Qu.: 3.7692      
##  Median : 4.356             Median : 7.353        Median : 6.7273      
##  Mean   : 5.356             Mean   : 8.882        Mean   : 8.1589      
##  3rd Qu.: 7.403             3rd Qu.:11.627        3rd Qu.:10.8889      
##  Max.   :22.776             Max.   :44.000        Max.   :25.6042      
##  NA's   :35                 NA's   :13            NA's   :28           
##  ab_noninfection       risk         risk_cat           bmi_cat         
##  Min.   :0.0000   Min.   :0.000   Length:117         Length:117        
##  1st Qu.:0.0000   1st Qu.:1.000   Class :character   Class :character  
##  Median :0.0000   Median :1.000   Mode  :character   Mode  :character  
##  Mean   :0.4495   Mean   :1.598                                        
##  3rd Qu.:1.0000   3rd Qu.:2.000                                        
##  Max.   :1.0000   Max.   :6.000                                        
##  NA's   :8                                                             
##    asa_cat          wound_type_cat     oxygen_quin         duration_sx     
##  Length:117         Length:117         Length:117         Min.   : 0.6833  
##  Class :character   Class :character   Class :character   1st Qu.: 2.5000  
##  Mode  :character   Mode  :character   Mode  :character   Median : 3.3333  
##                                                           Mean   : 3.9007  
##                                                           3rd Qu.: 4.7667  
##                                                           Max.   :10.6667  
##                                                                            
##  duration_sx_quin      anyDex           anyDex_count      anyDexMiss      
##  Length:117         Length:117         Min.   :0.0000   Min.   :0.000000  
##  Class :character   Class :character   1st Qu.:0.0000   1st Qu.:0.000000  
##  Mode  :character   Mode  :character   Median :0.0000   Median :0.000000  
##                                        Mean   :0.1282   Mean   :0.008547  
##                                        3rd Qu.:0.0000   3rd Qu.:0.000000  
##                                        Max.   :2.0000   Max.   :1.000000  
##                                                                           
##     anyDex2       treatment_group    deltacrp       crp_group    
##  Min.   :0.0000   Min.   :1.000   Min.   :-16.7   Min.   :1.000  
##  1st Qu.:0.0000   1st Qu.:1.000   1st Qu.: 32.9   1st Qu.:1.000  
##  Median :0.0000   Median :2.000   Median : 49.5   Median :1.000  
##  Mean   :0.1111   Mean   :1.556   Mean   :130.9   Mean   :2.487  
##  3rd Qu.:0.0000   3rd Qu.:2.000   3rd Qu.:221.1   3rd Qu.:4.000  
##  Max.   :1.0000   Max.   :2.000   Max.   :359.0   Max.   :4.000  
## 
ss1 <- ss

rownames(ss) <- paste(ss$PG_number,ss$timepoint,sep="-")

dim(ss)
## [1] 117  53
ss$ageCS <- scale(ss$ageD)
ss$sexD <- as.numeric(factor(ss$sexD))
ss$ethnicityCAT <- ss$ethnicityD
ss$ethnicityD <- as.numeric(factor(ss$ethnicityD))
ss$current_smokerD <- as.numeric(factor(ss$current_smokerD))
ss$diabetes_typeD <- as.numeric(factor(ss$diabetes_typeD))
ss$daily_insulinD <- as.numeric(factor(ss$daily_insulinD))
ss$oral_hypoglycemicsD <- as.numeric(factor(ss$oral_hypoglycemicsD))
ss$crp_preopD <- as.numeric(gsub("<5","2.5",gsub("<1","0.5",gsub("<1.0","0.5",ss$crp_preopD))))
ss$surgery_dominantD <- as.numeric(factor(ss$surgery_dominantD))
ss$wound_typeOP <- as.numeric(factor(ss$wound_typeOP))
ss$risk_cat <- as.numeric(factor(ss$risk_cat,levels=c("Low","Moderate","High")))
ss$wound_type_cat <- as.numeric(factor(ss$wound_type_cat))
ss$anyDex <- as.numeric(factor(ss$anyDex))

ss$bmi_cat <- as.numeric(factor(ss$bmi_cat,
  levels=c("Underweight [BMI<18.5]","Normal [18.5 to <25]",
  "Overweight [25 to <30]","Obese [30 to <40]","Super obese [40+]")))

ss <- ss[,c("PG_number","sexD","ageD","ageCS","weightD","asaD","heightD","ethnicityCAT","ethnicityD",
  "current_smokerD","diabetes_typeD","daily_insulinD","creatinine_preopD",
  "surgery_dominantD","wound_typeOP","HbA1c","bmi","revised_whodas_preop",
  "neut_lymph_ratio_d0","neut_lymph_ratio_d1","neut_lymph_ratio_d2","ab_noninfection",
  "risk","risk_cat","bmi_cat","wound_type_cat","duration_sx","anyDex","treatment_group",
  "deltacrp","crp_group")]

ss <- ss[order(rownames(ss)),]

ss_t0 <- ss
ss_eos <- ss
ss_pod1 <- ss

ss_t0$timepoint <- "T0"
ss_eos$timepoint <- "EOS"
ss_pod1$timepoint <- "POD1"

rownames(ss_t0) <- paste(ss_t0$PG_number,"T0",sep="-")
rownames(ss_eos) <- paste(ss_t0$PG_number,"EOS",sep="-")
rownames(ss_pod1) <- paste(ss_t0$PG_number,"POD1",sep="-")

ss <- rbind(ss_t0, ss_eos, ss_pod1)

rownames(ss) <- paste(ss$PG_number,ss$timepoint,sep="-")


xt0 <- xx[,grep("T0",colnames(xx))]
xpod1 <- xx[,grep("POD1",colnames(xx))]
xeos <- xx[,grep("EOS",colnames(xx))]

xt0f <- xt0[rowMeans(xt0)>=10,]
xpod1f <- xpod1[rowMeans(xpod1)>=10,]
xeosf <- xeos[rowMeans(xeos)>=10,]

dim(xt0f)
## [1] 21935   111
dim(xpod1f)
## [1] 21313   109
dim(xeosf)
## [1] 22067    98
ss_t0 <- ss_t0[which(rownames(ss_t0) %in% colnames(xt0)),]
ss_pod1 <- ss_pod1[which(rownames(ss_pod1) %in% colnames(xpod1)),]
ss_eos <- ss_eos[which(rownames(ss_eos) %in% colnames(xeos)),]

colnames(xt0) %in% rownames(ss_t0)
##   [1] TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE
##  [16] TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE
##  [31] TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE
##  [46] TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE
##  [61] TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE
##  [76] TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE
##  [91] TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE
## [106] TRUE TRUE TRUE TRUE TRUE TRUE
colnames(xpod1) %in% rownames(ss_pod1)
##   [1] TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE
##  [16] TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE
##  [31] TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE
##  [46] TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE
##  [61] TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE
##  [76] TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE
##  [91] TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE
## [106] TRUE TRUE TRUE TRUE
colnames(xeos) %in% rownames(ss_eos)
##  [1] TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE
## [16] TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE
## [31] TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE
## [46] TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE
## [61] TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE
## [76] TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE
## [91] TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE
rownames(ss_t0) %in% colnames(xt0)
##   [1] TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE
##  [16] TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE
##  [31] TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE
##  [46] TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE
##  [61] TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE
##  [76] TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE
##  [91] TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE
## [106] TRUE TRUE TRUE TRUE TRUE TRUE
rownames(ss_pod1) %in% colnames(xpod1)
##   [1] TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE
##  [16] TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE
##  [31] TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE
##  [46] TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE
##  [61] TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE
##  [76] TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE
##  [91] TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE
## [106] TRUE TRUE TRUE TRUE
rownames(ss_eos) %in% colnames(xeos)
##  [1] TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE
## [16] TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE
## [31] TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE
## [46] TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE
## [61] TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE
## [76] TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE
## [91] TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE
xxf <- xx[rowMeans(xx)>=10,]
xxf <- xxf[,order(colnames(xxf))]

PCA Analysis

This is a clinical study and each patient has detailed clinical metadata. Not all of these will be important to the gene expression profiles. Do determine that, we will use PCA analysis of the first 5 PCs to understand which PCs associate with which clinical parameters.

mx <- xt0f
ss2 <- ss_t0
ss2$ethnicityCAT = ss2$ageCS = NULL
ss2$timepoint = ss2$PG_number = NULL

pca <- prcomp(t(mx),center = TRUE, scale = TRUE,retx=TRUE)
loadings = pca$x

par(cex=0.75, mar = c(6, 8.5, 3, 3))

plot(pca,type="lines",col="blue")

nGenes <- nrow(mx)
nSamples <- ncol(mx)
datTraits <- ss2
moduleTraitCor <- cor(loadings[,1:8], datTraits, use = "p")
moduleTraitPvalue <- corPvalueStudent(moduleTraitCor, nSamples)
textMatrix <- paste(signif(moduleTraitCor, 2), "\n(",
  signif(moduleTraitPvalue, 1), ")", sep = "")

dim(textMatrix) = dim(moduleTraitCor)

labeledHeatmap(Matrix = t(moduleTraitCor),
  xLabels = colnames(loadings)[1:ncol(t(moduleTraitCor))],
  yLabels = names(datTraits), colorLabels = FALSE, colors = blueWhiteRed(6),
  textMatrix = t(textMatrix), setStdMargins = FALSE, cex.text = 0.5,
  cex.lab.y = 0.6, zlim = c(-0.45,0.45),
  main = paste("PCA-trait relationships @T0: Top principal components"))

mx <- xeosf
ss2 <- ss_eos
ss2$ethnicityCAT = ss2$ageCS = NULL
ss2$timepoint = ss2$PG_number =NULL

pca <- prcomp(t(mx),center = TRUE, scale = TRUE,retx=TRUE)
loadings = pca$x
plot(pca,type="lines",col="blue")

nGenes <- nrow(mx)
nSamples <- ncol(mx)
datTraits <- ss2
moduleTraitCor <- cor(loadings[,1:8], datTraits, use = "p")
moduleTraitPvalue <- corPvalueStudent(moduleTraitCor, nSamples)
textMatrix <- paste(signif(moduleTraitCor, 2), "\n(",
  signif(moduleTraitPvalue, 1), ")", sep = "")

dim(textMatrix) = dim(moduleTraitCor)

labeledHeatmap(Matrix = t(moduleTraitCor),
  xLabels = colnames(loadings)[1:ncol(t(moduleTraitCor))],
  yLabels = names(datTraits), colorLabels = FALSE, colors = blueWhiteRed(6),
  textMatrix = t(textMatrix), setStdMargins = FALSE, cex.text = 0.5,
  cex.lab.y = 0.6, zlim = c(-0.45,0.45),
  main = paste("PCA-trait relationships @EOS: Top principal components"))
## Warning in numbers2colors(data, signed, colors = colors, lim = zlim, naColor =
## naColor): Some values of 'x' are above given maximum and will be truncated to
## the maximum.

mx <- xpod1f
ss2 <- ss_pod1
ss2$ethnicityCAT = ss2$ageCS = NULL
ss2$timepoint = ss2$PG_number = NULL

pca <- prcomp(t(mx),center = TRUE, scale = TRUE,retx=TRUE)
loadings = pca$x
plot(pca,type="lines",col="blue")

nGenes <- nrow(mx)
nSamples <- ncol(mx)
datTraits <- ss2
moduleTraitCor <- cor(loadings[,1:8], datTraits, use = "p")
moduleTraitPvalue <- corPvalueStudent(moduleTraitCor, nSamples)
textMatrix <- paste(signif(moduleTraitCor, 2), "\n(",
  signif(moduleTraitPvalue, 1), ")", sep = "")

dim(textMatrix) = dim(moduleTraitCor)

labeledHeatmap(Matrix = t(moduleTraitCor),
  xLabels = colnames(loadings)[1:ncol(t(moduleTraitCor))],
  yLabels = names(datTraits), colorLabels = FALSE, colors = blueWhiteRed(6),
  textMatrix = t(textMatrix), setStdMargins = FALSE, cex.text = 0.5,
  cex.lab.y = 0.6, zlim = c(-0.45,0.45),
  main = paste("PCA-trait relationships @POD1: Top principal components"))
## Warning in numbers2colors(data, signed, colors = colors, lim = zlim, naColor =
## naColor): Some values of 'x' are above given maximum and will be truncated to
## the maximum.

Now export PDF.

mx <- xt0f
ss2 <- ss_t0
ss2$ethnicityCAT = ss2$ageCS = NULL
ss2$timepoint = ss2$PG_number = NULL
pca <- prcomp(t(mx),center = TRUE, scale = TRUE,retx=TRUE)
loadings = pca$x

pdf("pca_cor.pdf",height=7,width=7)
par(cex=0.75, mar = c(6, 8.5, 3, 3))

plot(pca,type="lines",col="blue")
nGenes <- nrow(mx)
nSamples <- ncol(mx)
datTraits <- ss2
moduleTraitCor <- cor(loadings[,1:8], datTraits, use = "p")
moduleTraitPvalue <- corPvalueStudent(moduleTraitCor, nSamples)
textMatrix <- paste(signif(moduleTraitCor, 2), "\n(",
  signif(moduleTraitPvalue, 1), ")", sep = "")

dim(textMatrix) = dim(moduleTraitCor)

labeledHeatmap(Matrix = t(moduleTraitCor),
  xLabels = colnames(loadings)[1:ncol(t(moduleTraitCor))],
  yLabels = names(datTraits), colorLabels = FALSE, colors = blueWhiteRed(6),
  textMatrix = t(textMatrix), setStdMargins = FALSE, cex.text = 0.5,
  cex.lab.y = 0.6, zlim = c(-0.45,0.45),
  main = paste("PCA-trait relationships @T0: Top principal components"))

mx <- xeosf
ss2 <- ss_eos
ss2$ethnicityCAT = ss2$ageCS = NULL
ss2$timepoint = ss2$PG_number = NULL
pca <- prcomp(t(mx),center = TRUE, scale = TRUE,retx=TRUE)
loadings = pca$x
plot(pca,type="lines",col="blue")
nGenes <- nrow(mx)
nSamples <- ncol(mx)
datTraits <- ss2
moduleTraitCor <- cor(loadings[,1:8], datTraits, use = "p")
moduleTraitPvalue <- corPvalueStudent(moduleTraitCor, nSamples)
textMatrix <- paste(signif(moduleTraitCor, 2), "\n(",
  signif(moduleTraitPvalue, 1), ")", sep = "")

dim(textMatrix) = dim(moduleTraitCor)

labeledHeatmap(Matrix = t(moduleTraitCor),
  xLabels = colnames(loadings)[1:ncol(t(moduleTraitCor))],
  yLabels = names(datTraits), colorLabels = FALSE, colors = blueWhiteRed(6),
  textMatrix = t(textMatrix), setStdMargins = FALSE, cex.text = 0.5,
  cex.lab.y = 0.6, zlim = c(-0.45,0.45),
  main = paste("PCA-trait relationships @EOS: Top principal components"))
## Warning in numbers2colors(data, signed, colors = colors, lim = zlim, naColor =
## naColor): Some values of 'x' are above given maximum and will be truncated to
## the maximum.
mx <- xpod1f
ss2 <- ss_pod1
ss2$ethnicityCAT = ss2$ageCS = NULL
ss2$timepoint = ss2$PG_number = NULL
pca <- prcomp(t(mx),center = TRUE, scale = TRUE,retx=TRUE)
loadings = pca$x
plot(pca,type="lines",col="blue")
nGenes <- nrow(mx)
nSamples <- ncol(mx)
datTraits <- ss2
moduleTraitCor <- cor(loadings[,1:8], datTraits, use = "p")
moduleTraitPvalue <- corPvalueStudent(moduleTraitCor, nSamples)
textMatrix <- paste(signif(moduleTraitCor, 2), "\n(",
  signif(moduleTraitPvalue, 1), ")", sep = "")

dim(textMatrix) = dim(moduleTraitCor)

labeledHeatmap(Matrix = t(moduleTraitCor),
  xLabels = colnames(loadings)[1:ncol(t(moduleTraitCor))],
  yLabels = names(datTraits), colorLabels = FALSE, colors = blueWhiteRed(6),
  textMatrix = t(textMatrix), setStdMargins = FALSE, cex.text = 0.5,
  cex.lab.y = 0.6, zlim = c(-0.45,0.45),
  main = paste("PCA-trait relationships @POD1: Top principal components"))
## Warning in numbers2colors(data, signed, colors = colors, lim = zlim, naColor =
## naColor): Some values of 'x' are above given maximum and will be truncated to
## the maximum.
dev.off()
## png 
##   2

PCA plots

par(mfrow=c(3,3))

#T0
mx <- xt0f
ss2 <- ss_t0
pca <- prcomp(t(mx),center = TRUE, scale = TRUE,retx=TRUE)
labs=gsub("-T0","",rownames(pca$x))
XMIN=min(pca$x[,1])*1.1
XMAX=max(pca$x[,1])*1.1
plot(pca$x[,1:2],cex=2,col="gray",pch=19,bty="none", xlim=c(XMIN,XMAX) )
mtext("T0")
text(pca$x[,1:2],labels=labs)
plot(pca$x[,c(1,3)],cex=2,col="gray",pch=19,bty="none", xlim=c(XMIN,XMAX) )
mtext("T0")
text(pca$x[,c(1,3)],labels=labs)
XMIN=min(pca$x[,2])*1.1
XMAX=max(pca$x[,2])*1.1
plot(pca$x[,2:3],cex=2,col="gray",pch=19,bty="none", xlim=c(XMIN,XMAX) )
mtext("T0")
text(pca$x[,2:3],labels=labs)

#EOS
mx <- xeosf
ss2 <- ss_eos
pca <- prcomp(t(mx),center = TRUE, scale = TRUE,retx=TRUE)
labs=gsub("-EOS","",rownames(pca$x))
XMIN=min(pca$x[,1])*1.1
XMAX=max(pca$x[,1])*1.1
plot(pca$x[,1:2],cex=2,col="gray",pch=19,bty="none", xlim=c(XMIN,XMAX) )
mtext("EOS")
text(pca$x[,1:2],labels=labs)
plot(pca$x[,c(1,3)],cex=2,col="gray",pch=19,bty="none", xlim=c(XMIN,XMAX) )
mtext("EOS")
text(pca$x[,c(1,3)],labels=labs)
XMIN=min(pca$x[,2])*1.1
XMAX=max(pca$x[,2])*1.1
plot(pca$x[,2:3],cex=2,col="gray",pch=19,bty="none", xlim=c(XMIN,XMAX) )
mtext("EOS")
text(pca$x[,2:3],labels=labs)

#POD1
mx <- xpod1f
ss2 <- ss_pod1
pca <- prcomp(t(mx),center = TRUE, scale = TRUE,retx=TRUE)
labs=gsub("-POD1","",rownames(pca$x))
XMIN=min(pca$x[,1])*1.1
XMAX=max(pca$x[,1])*1.1
plot(pca$x[,1:2],cex=2,col="gray",pch=19,bty="none", xlim=c(XMIN,XMAX) )
text(pca$x[,1:2],labels=labs)
mtext("POD1")
plot(pca$x[,c(1,3)],cex=2,col="gray",pch=19,bty="none", xlim=c(XMIN,XMAX) )
text(pca$x[,c(1,3)],labels=labs)
mtext("POD1")
XMIN=min(pca$x[,2])*1.1
XMAX=max(pca$x[,2])*1.1
plot(pca$x[,2:3],cex=2,col="gray",pch=19,bty="none", xlim=c(XMIN,XMAX) )
text(pca$x[,2:3],labels=labs)
mtext("POD1")

dev.off()
## null device 
##           1
pdf("pca_charts.pdf",width=9,height=9)
par(mfrow=c(3,3))
#T0
mx <- xt0f
ss2 <- ss_t0
pca <- prcomp(t(mx),center = TRUE, scale = TRUE,retx=TRUE)
labs=gsub("-T0","",rownames(pca$x))
XMIN=min(pca$x[,1])*1.1
XMAX=max(pca$x[,1])*1.1
plot(pca$x[,1:2],cex=2,col="gray",pch=19,bty="none", xlim=c(XMIN,XMAX) )
mtext("T0")
text(pca$x[,1:2],labels=labs)

plot(pca$x[,c(1,3)],cex=2,col="gray",pch=19,bty="none", xlim=c(XMIN,XMAX) )
mtext("T0")
text(pca$x[,c(1,3)],labels=labs)

XMIN=min(pca$x[,2])*1.1
XMAX=max(pca$x[,2])*1.1
plot(pca$x[,2:3],cex=2,col="gray",pch=19,bty="none", xlim=c(XMIN,XMAX) )
mtext("T0")
text(pca$x[,2:3],labels=labs)

#EOS
mx <- xeosf
ss2 <- ss_eos
pca <- prcomp(t(mx),center = TRUE, scale = TRUE,retx=TRUE)
labs=gsub("-EOS","",rownames(pca$x))
XMIN=min(pca$x[,1])*1.1
XMAX=max(pca$x[,1])*1.1
plot(pca$x[,1:2],cex=2,col="gray",pch=19,bty="none", xlim=c(XMIN,XMAX) )
mtext("EOS")
text(pca$x[,1:2],labels=labs)
plot(pca$x[,c(1,3)],cex=2,col="gray",pch=19,bty="none", xlim=c(XMIN,XMAX) )
mtext("EOS")
text(pca$x[,c(1,3)],labels=labs)
XMIN=min(pca$x[,2])*1.1
XMAX=max(pca$x[,2])*1.1
plot(pca$x[,2:3],cex=2,col="gray",pch=19,bty="none", xlim=c(XMIN,XMAX) )
mtext("EOS")
text(pca$x[,2:3],labels=labs)

#POD1
mx <- xpod1f
ss2 <- ss_pod1
pca <- prcomp(t(mx),center = TRUE, scale = TRUE,retx=TRUE)
labs=gsub("-POD1","",rownames(pca$x))
XMIN=min(pca$x[,1])*1.1
XMAX=max(pca$x[,1])*1.1
plot(pca$x[,1:2],cex=2,col="gray",pch=19,bty="none", xlim=c(XMIN,XMAX) )
text(pca$x[,1:2],labels=labs)
mtext("POD1")
plot(pca$x[,c(1,3)],cex=2,col="gray",pch=19,bty="none", xlim=c(XMIN,XMAX) )
text(pca$x[,c(1,3)],labels=labs)
mtext("POD1")
XMIN=min(pca$x[,2])*1.1
XMAX=max(pca$x[,2])*1.1
plot(pca$x[,2:3],cex=2,col="gray",pch=19,bty="none", xlim=c(XMIN,XMAX) )
text(pca$x[,2:3],labels=labs)
mtext("POD1")

dev.off()
## pdf 
##   2

Specific PCA charts

Specific PCAs for key clinical parameters:

  • wound type
  • surg duration
  • ethnicity
  • age
  • sex
  • treatment group

And ones we didn’t include:

  • bmi
  • asaD
  • smoker
  • diabetes_typeD
  • crp
# wound type clean (1) contaminated (2)

mx <- xt0f
ss2 <- ss_t0
pca <- prcomp(t(mx),center = TRUE, scale = TRUE,retx=TRUE)
labs=gsub("-T0","",rownames(pca$x))
XMIN=min(pca$x[,1])*1.1
XMAX=max(pca$x[,1])*1.1
cols <- as.character(ss_t0$wound_type_cat)
cols <- gsub("2","red",gsub("1","gray",cols))
plot(pca$x[,1:2],cex=2,col=cols,pch=19,bty="none", xlim=c(XMIN,XMAX) )
text(pca$x[,1:2],labels=labs,cex=0.7)
mtext("T0 - wound type")

plot(pca$x[,c(1,3)],cex=2,col=cols,pch=19,bty="none", xlim=c(XMIN,XMAX) )
text(pca$x[,c(1,3)],labels=labs,cex=0.7)
mtext("T0 - wound type")

XMIN=min(pca$x[,2])*1.1
XMAX=max(pca$x[,2])*1.1
plot(pca$x[,2:3],cex=2,col=cols,pch=19,bty="none", xlim=c(XMIN,XMAX) )
text(pca$x[,2:3],labels=labs,cex=0.7)
mtext("T0 - wound type")

# surg duration
my_palette <- colorRampPalette(c("yellow", "orange", "red"))(n = 10)
decile <- ntile(ss_t0$duration_sx, 10)
mycols <- my_palette[decile]
XMIN=min(pca$x[,1])*1.1
XMAX=max(pca$x[,1])*1.1
plot(pca$x[,1:2],cex=2,col=mycols,pch=19,bty="none", xlim=c(XMIN,XMAX) )
text(pca$x[,1:2],labels=labs,cex=0.7)
mtext("T0 - surgical duration deciles")

plot(pca$x[,c(1,3)],cex=2,col=mycols,pch=19,bty="none", xlim=c(XMIN,XMAX) )
text(pca$x[,c(1,3)],labels=labs,cex=0.7)
mtext("T0 - surgical duration deciles")

XMIN=min(pca$x[,2])*1.1
XMAX=max(pca$x[,2])*1.1
plot(pca$x[,2:3],cex=2,col=mycols,pch=19,bty="none", xlim=c(XMIN,XMAX) )
text(pca$x[,2:3],labels=labs,cex=0.7)
mtext("T0 - surgical duration deciles")

# Ethnicity Levels [1-4]: Asian, Maori/Polynesian, Other, White/Caucasian
XMIN=min(pca$x[,1])*1.1
XMAX=max(pca$x[,1])*1.1
cols <- as.character(ss_t0$ethnicityD)
plot(pca$x[,1:2],cex=2,col=cols,pch=19,bty="none", xlim=c(XMIN,XMAX) )
text(pca$x[,1:2],labels=labs,cex=0.7)
mtext("T0 - ethnicity")

plot(pca$x[,c(1,3)],cex=2,col=cols,pch=19,bty="none", xlim=c(XMIN,XMAX) )
text(pca$x[,c(1,3)],labels=labs,cex=0.7)
mtext("T0 - ethnicity")

XMIN=min(pca$x[,2])*1.1
XMAX=max(pca$x[,2])*1.1
plot(pca$x[,2:3],cex=2,col=cols,pch=19,bty="none", xlim=c(XMIN,XMAX) )
text(pca$x[,2:3],labels=labs,cex=0.7)
mtext("T0 - ethnicity")

# age
my_palette <- colorRampPalette(c("yellow", "orange", "red"))(n = 10)
decile <- ntile(ss_t0$ageD, 10)
mycols <- my_palette[decile]
XMIN=min(pca$x[,1])*1.1
XMAX=max(pca$x[,1])*1.1
plot(pca$x[,1:2],cex=2,col=mycols,pch=19,bty="none", xlim=c(XMIN,XMAX) )
text(pca$x[,1:2],labels=labs,cex=0.7)
mtext("T0 - age deciles")

plot(pca$x[,c(1,3)],cex=2,col=mycols,pch=19,bty="none", xlim=c(XMIN,XMAX) )
text(pca$x[,c(1,3)],labels=labs,cex=0.7)
mtext("T0 - age deciles")

XMIN=min(pca$x[,2])*1.1
XMAX=max(pca$x[,2])*1.1
plot(pca$x[,2:3],cex=2,col=mycols,pch=19,bty="none", xlim=c(XMIN,XMAX) )
text(pca$x[,2:3],labels=labs,cex=0.7)
mtext("T0 - age deciles")

# sex female=1 male=2
XMIN=min(pca$x[,1])*1.1
XMAX=max(pca$x[,1])*1.1
cols <- as.character(ss_t0$sexD)
cols <- gsub("1","pink",gsub("2","lightblue",cols))
plot(pca$x[,1:2],cex=2,col=cols,pch=19,bty="none", xlim=c(XMIN,XMAX) )
text(pca$x[,1:2],labels=labs,cex=0.7)
mtext("T0 - sex: female=pink, male=lightblue")

plot(pca$x[,c(1,3)],cex=2,col=cols,pch=19,bty="none", xlim=c(XMIN,XMAX) )
text(pca$x[,c(1,3)],labels=labs,cex=0.7)
mtext("T0 - sex: female=pink, male=lightblue")

XMIN=min(pca$x[,2])*1.1
XMAX=max(pca$x[,2])*1.1
plot(pca$x[,2:3],cex=2,col=cols,pch=19,bty="none", xlim=c(XMIN,XMAX) )
text(pca$x[,2:3],labels=labs,cex=0.7)
mtext("T0 - sex: female=pink, male=lightblue")

# bmi
my_palette <- colorRampPalette(c("yellow", "orange", "red"))(n = 10)
decile <- ntile(ss_t0$bmi, 10)
mycols <- my_palette[decile]
XMIN=min(pca$x[,1])*1.1
XMAX=max(pca$x[,1])*1.1
plot(pca$x[,1:2],cex=2,col=mycols,pch=19,bty="none", xlim=c(XMIN,XMAX) )
text(pca$x[,1:2],labels=labs,cex=0.7)
mtext("T0 - BMI deciles")

plot(pca$x[,c(1,3)],cex=2,col=mycols,pch=19,bty="none", xlim=c(XMIN,XMAX) )
text(pca$x[,c(1,3)],labels=labs,cex=0.7)
mtext("T0 - BMI deciles")

XMIN=min(pca$x[,2])*1.1
XMAX=max(pca$x[,2])*1.1
plot(pca$x[,2:3],cex=2,col=mycols,pch=19,bty="none", xlim=c(XMIN,XMAX) )
text(pca$x[,2:3],labels=labs,cex=0.7)
mtext("T0 - BMI deciles")

# asaD levels 1:4 black,red,green,blue
XMIN=min(pca$x[,1])*1.1
XMAX=max(pca$x[,1])*1.1
cols <- as.character(ss_t0$asaD)
plot(pca$x[,1:2],cex=2,col=cols,pch=19,bty="none", xlim=c(XMIN,XMAX) )
text(pca$x[,1:2],labels=labs,cex=0.7)
mtext("T0 - asaD")

plot(pca$x[,c(1,3)],cex=2,col=cols,pch=19,bty="none", xlim=c(XMIN,XMAX) )
text(pca$x[,c(1,3)],labels=labs,cex=0.7)
mtext("T0 - asaD")

XMIN=min(pca$x[,2])*1.1
XMAX=max(pca$x[,2])*1.1
plot(pca$x[,2:3],cex=2,col=cols,pch=19,bty="none", xlim=c(XMIN,XMAX) )
text(pca$x[,2:3],labels=labs,cex=0.7)
mtext("T0 - asaD")

# Current smoker no, yes
XMIN=min(pca$x[,1])*1.1
XMAX=max(pca$x[,1])*1.1
cols <- as.character(ss_t0$current_smokerD)
plot(pca$x[,1:2],cex=2,col=cols,pch=19,bty="none", xlim=c(XMIN,XMAX) )
text(pca$x[,1:2],labels=labs,cex=0.7)
mtext("T0 - current smoker")

plot(pca$x[,c(1,3)],cex=2,col=cols,pch=19,bty="none", xlim=c(XMIN,XMAX) )
text(pca$x[,c(1,3)],labels=labs,cex=0.7)
mtext("T0 - current smoker")

XMIN=min(pca$x[,2])*1.1
XMAX=max(pca$x[,2])*1.1
plot(pca$x[,2:3],cex=2,col=cols,pch=19,bty="none", xlim=c(XMIN,XMAX) )
text(pca$x[,2:3],labels=labs,cex=0.7)
mtext("T0 - current smoker")

# diabetes
XMIN=min(pca$x[,1])*1.1
XMAX=max(pca$x[,1])*1.1
cols <- as.character(ss_t0$diabetes_typeD)
plot(pca$x[,1:2],cex=2,col=cols,pch=19,bty="none", xlim=c(XMIN,XMAX) )
text(pca$x[,1:2],labels=labs,cex=0.7)
mtext("T0 - diabetes")

plot(pca$x[,c(1,3)],cex=2,col=cols,pch=19,bty="none", xlim=c(XMIN,XMAX) )
text(pca$x[,c(1,3)],labels=labs,cex=0.7)
mtext("T0 - diabetes")

XMIN=min(pca$x[,2])*1.1
XMAX=max(pca$x[,2])*1.1
plot(pca$x[,2:3],cex=2,col=cols,pch=19,bty="none", xlim=c(XMIN,XMAX) )
text(pca$x[,2:3],labels=labs,cex=0.7)
mtext("T0 - diabetes")

# treatment group
XMIN=min(pca$x[,1])*1.1
XMAX=max(pca$x[,1])*1.1
cols <- as.character(ss_t0$treatment_group)
cols <- gsub("2","orange",gsub("1","cyan3",cols))
plot(pca$x[,1:2],cex=2,col=cols,pch=19,bty="none", xlim=c(XMIN,XMAX) )
text(pca$x[,1:2],labels=labs,cex=0.7)
mtext("T0 - treatment group")

plot(pca$x[,c(1,3)],cex=2,col=cols,pch=19,bty="none", xlim=c(XMIN,XMAX) )
text(pca$x[,c(1,3)],labels=labs,cex=0.7)
mtext("T0 - treatment group")

XMIN=min(pca$x[,2])*1.1
XMAX=max(pca$x[,2])*1.1
plot(pca$x[,2:3],cex=2,col=cols,pch=19,bty="none", xlim=c(XMIN,XMAX) )
text(pca$x[,2:3],labels=labs,cex=0.7)
mtext("T0 - treatment group")

# treatment group
XMIN=min(pca$x[,1])*1.1
XMAX=max(pca$x[,1])*1.1
cols <- as.character(ss_t0$crp_group)
cols <- gsub("4","orange",gsub("1","cyan3",cols))
plot(pca$x[,1:2],cex=2,col=cols,pch=19,bty="none", xlim=c(XMIN,XMAX) )
text(pca$x[,1:2],labels=labs,cex=0.7)
mtext("T0 - CRP group")

plot(pca$x[,c(1,3)],cex=2,col=cols,pch=19,bty="none", xlim=c(XMIN,XMAX) )
text(pca$x[,c(1,3)],labels=labs,cex=0.7)
mtext("T0 - CRP group")

XMIN=min(pca$x[,2])*1.1
XMAX=max(pca$x[,2])*1.1
plot(pca$x[,2:3],cex=2,col=cols,pch=19,bty="none", xlim=c(XMIN,XMAX) )
text(pca$x[,2:3],labels=labs,cex=0.7)
mtext("T0 - CRP group")

EOS.

# wound type clean (1) contaminated (2)

mx <- xeosf
ss2 <- ss_eos
pca <- prcomp(t(mx),center = TRUE, scale = TRUE,retx=TRUE)
labs=gsub("-EOS","",rownames(pca$x))
XMIN=min(pca$x[,1])*1.1
XMAX=max(pca$x[,1])*1.1
cols <- as.character(ss_eos$wound_type_cat)
cols <- gsub("2","red",gsub("1","gray",cols))
plot(pca$x[,1:2],cex=2,col=cols,pch=19,bty="none", xlim=c(XMIN,XMAX) )
text(pca$x[,1:2],labels=labs,cex=0.7)
mtext("EOS - wound type")

plot(pca$x[,c(1,3)],cex=2,col=cols,pch=19,bty="none", xlim=c(XMIN,XMAX) )
text(pca$x[,c(1,3)],labels=labs,cex=0.7)
mtext("EOS - wound type")

XMIN=min(pca$x[,2])*1.1
XMAX=max(pca$x[,2])*1.1
plot(pca$x[,2:3],cex=2,col=cols,pch=19,bty="none", xlim=c(XMIN,XMAX) )
text(pca$x[,2:3],labels=labs,cex=0.7)
mtext("EOS - wound type")

# surg duration
my_palette <- colorRampPalette(c("yellow", "orange", "red"))(n = 10)
decile <- ntile(ss_eos$duration_sx, 10)
mycols <- my_palette[decile]
XMIN=min(pca$x[,1])*1.1
XMAX=max(pca$x[,1])*1.1
plot(pca$x[,1:2],cex=2,col=mycols,pch=19,bty="none", xlim=c(XMIN,XMAX) )
text(pca$x[,1:2],labels=labs,cex=0.7)
mtext("EOS - surgical duration deciles")

plot(pca$x[,c(1,3)],cex=2,col=mycols,pch=19,bty="none", xlim=c(XMIN,XMAX) )
text(pca$x[,c(1,3)],labels=labs,cex=0.7)
mtext("EOS - surgical duration deciles")

XMIN=min(pca$x[,2])*1.1
XMAX=max(pca$x[,2])*1.1
plot(pca$x[,2:3],cex=2,col=mycols,pch=19,bty="none", xlim=c(XMIN,XMAX) )
text(pca$x[,2:3],labels=labs,cex=0.7)
mtext("EOS - surgical duration deciles")

# Ethnicity Levels [1-4]: Asian, Maori/Polynesian, Other, White/Caucasian
XMIN=min(pca$x[,1])*1.1
XMAX=max(pca$x[,1])*1.1
cols <- as.character(ss_eos$ethnicityD)
plot(pca$x[,1:2],cex=2,col=cols,pch=19,bty="none", xlim=c(XMIN,XMAX) )
text(pca$x[,1:2],labels=labs,cex=0.7)
mtext("EOS  - ethnicity")

plot(pca$x[,c(1,3)],cex=2,col=cols,pch=19,bty="none", xlim=c(XMIN,XMAX) )
text(pca$x[,c(1,3)],labels=labs,cex=0.7)
mtext("EOS  - ethnicity")

XMIN=min(pca$x[,2])*1.1
XMAX=max(pca$x[,2])*1.1
plot(pca$x[,2:3],cex=2,col=cols,pch=19,bty="none", xlim=c(XMIN,XMAX) )
text(pca$x[,2:3],labels=labs,cex=0.7)
mtext("EOS  - ethnicity")

# age
my_palette <- colorRampPalette(c("yellow", "orange", "red"))(n = 10)
decile <- ntile(ss_eos$ageD, 10)
mycols <- my_palette[decile]
XMIN=min(pca$x[,1])*1.1
XMAX=max(pca$x[,1])*1.1
plot(pca$x[,1:2],cex=2,col=mycols,pch=19,bty="none", xlim=c(XMIN,XMAX) )
text(pca$x[,1:2],labels=labs,cex=0.7)
mtext("EOS - age deciles")

plot(pca$x[,c(1,3)],cex=2,col=mycols,pch=19,bty="none", xlim=c(XMIN,XMAX) )
text(pca$x[,c(1,3)],labels=labs,cex=0.7)
mtext("EOS - age deciles")

XMIN=min(pca$x[,2])*1.1
XMAX=max(pca$x[,2])*1.1
plot(pca$x[,2:3],cex=2,col=mycols,pch=19,bty="none", xlim=c(XMIN,XMAX) )
text(pca$x[,2:3],labels=labs,cex=0.7)
mtext("EOS - age deciles")

# sex female=1 male=2
XMIN=min(pca$x[,1])*1.1
XMAX=max(pca$x[,1])*1.1
cols <- as.character(ss_eos$sexD)
cols <- gsub("1","pink",gsub("2","lightblue",cols))
plot(pca$x[,1:2],cex=2,col=cols,pch=19,bty="none", xlim=c(XMIN,XMAX) )
text(pca$x[,1:2],labels=labs,cex=0.7)
mtext("EOS - sex: female=pink, male=lightblue")

plot(pca$x[,c(1,3)],cex=2,col=cols,pch=19,bty="none", xlim=c(XMIN,XMAX) )
text(pca$x[,c(1,3)],labels=labs,cex=0.7)
mtext("EOS - sex: female=pink, male=lightblue")

XMIN=min(pca$x[,2])*1.1
XMAX=max(pca$x[,2])*1.1
plot(pca$x[,2:3],cex=2,col=cols,pch=19,bty="none", xlim=c(XMIN,XMAX) )
text(pca$x[,2:3],labels=labs,cex=0.7)
mtext("EOS - sex: female=pink, male=lightblue")

# bmi
my_palette <- colorRampPalette(c("yellow", "orange", "red"))(n = 10)
decile <- ntile(ss_eos$bmi, 10)
mycols <- my_palette[decile]
XMIN=min(pca$x[,1])*1.1
XMAX=max(pca$x[,1])*1.1
plot(pca$x[,1:2],cex=2,col=mycols,pch=19,bty="none", xlim=c(XMIN,XMAX) )
text(pca$x[,1:2],labels=labs,cex=0.7)
mtext("EOS - BMI deciles")

plot(pca$x[,c(1,3)],cex=2,col=mycols,pch=19,bty="none", xlim=c(XMIN,XMAX) )
text(pca$x[,c(1,3)],labels=labs,cex=0.7)
mtext("EOS - BMI deciles")

XMIN=min(pca$x[,2])*1.1
XMAX=max(pca$x[,2])*1.1
plot(pca$x[,2:3],cex=2,col=mycols,pch=19,bty="none", xlim=c(XMIN,XMAX) )
text(pca$x[,2:3],labels=labs,cex=0.7)
mtext("EOS - BMI deciles")

# asaD levels 1:4 black,red,green,blue
XMIN=min(pca$x[,1])*1.1
XMAX=max(pca$x[,1])*1.1
cols <- as.character(ss_eos$asaD)
plot(pca$x[,1:2],cex=2,col=cols,pch=19,bty="none", xlim=c(XMIN,XMAX) )
text(pca$x[,1:2],labels=labs,cex=0.7)
mtext("EOS - asaD")

plot(pca$x[,c(1,3)],cex=2,col=cols,pch=19,bty="none", xlim=c(XMIN,XMAX) )
text(pca$x[,c(1,3)],labels=labs,cex=0.7)
mtext("EOS - asaD")

XMIN=min(pca$x[,2])*1.1
XMAX=max(pca$x[,2])*1.1
plot(pca$x[,2:3],cex=2,col=cols,pch=19,bty="none", xlim=c(XMIN,XMAX) )
text(pca$x[,2:3],labels=labs,cex=0.7)
mtext("EOS - asaD")

# Current smoker no, yes
XMIN=min(pca$x[,1])*1.1
XMAX=max(pca$x[,1])*1.1
cols <- as.character(ss_eos$current_smokerD)
plot(pca$x[,1:2],cex=2,col=cols,pch=19,bty="none", xlim=c(XMIN,XMAX) )
text(pca$x[,1:2],labels=labs,cex=0.7)
mtext("EOS - current smoker")

plot(pca$x[,c(1,3)],cex=2,col=cols,pch=19,bty="none", xlim=c(XMIN,XMAX) )
text(pca$x[,c(1,3)],labels=labs,cex=0.7)
mtext("EOS - current smoker")

XMIN=min(pca$x[,2])*1.1
XMAX=max(pca$x[,2])*1.1
plot(pca$x[,2:3],cex=2,col=cols,pch=19,bty="none", xlim=c(XMIN,XMAX) )
text(pca$x[,2:3],labels=labs,cex=0.7)
mtext("EOS - current smoker")

# diabetes
XMIN=min(pca$x[,1])*1.1
XMAX=max(pca$x[,1])*1.1
cols <- as.character(ss_eos$diabetes_typeD)
plot(pca$x[,1:2],cex=2,col=cols,pch=19,bty="none", xlim=c(XMIN,XMAX) )
text(pca$x[,1:2],labels=labs,cex=0.7)
mtext("EOS - diabetes")

plot(pca$x[,c(1,3)],cex=2,col=cols,pch=19,bty="none", xlim=c(XMIN,XMAX) )
text(pca$x[,c(1,3)],labels=labs,cex=0.7)
mtext("EOS - diabetes")

XMIN=min(pca$x[,2])*1.1
XMAX=max(pca$x[,2])*1.1
plot(pca$x[,2:3],cex=2,col=cols,pch=19,bty="none", xlim=c(XMIN,XMAX) )
text(pca$x[,2:3],labels=labs,cex=0.7)
mtext("EOS - diabetes")

# treatment group
XMIN=min(pca$x[,1])*1.1
XMAX=max(pca$x[,1])*1.1
cols <- as.character(ss_eos$treatment_group)
cols <- gsub("2","orange",gsub("1","cyan3",cols))
plot(pca$x[,1:2],cex=2,col=cols,pch=19,bty="none", xlim=c(XMIN,XMAX) )
text(pca$x[,1:2],labels=labs,cex=0.7)
mtext("EOS - treatment group")

plot(pca$x[,c(1,3)],cex=2,col=cols,pch=19,bty="none", xlim=c(XMIN,XMAX) )
text(pca$x[,c(1,3)],labels=labs,cex=0.7)
mtext("EOS - treatment group")

XMIN=min(pca$x[,2])*1.1
XMAX=max(pca$x[,2])*1.1
plot(pca$x[,2:3],cex=2,col=cols,pch=19,bty="none", xlim=c(XMIN,XMAX) )
text(pca$x[,2:3],labels=labs,cex=0.7)
mtext("EOS - treatment group")

# treatment group
XMIN=min(pca$x[,1])*1.1
XMAX=max(pca$x[,1])*1.1
cols <- as.character(ss_eos$crp_group)
cols <- gsub("4","orange",gsub("1","cyan3",cols))
plot(pca$x[,1:2],cex=2,col=cols,pch=19,bty="none", xlim=c(XMIN,XMAX) )
text(pca$x[,1:2],labels=labs,cex=0.7)
mtext("EOS - CRP group")

plot(pca$x[,c(1,3)],cex=2,col=cols,pch=19,bty="none", xlim=c(XMIN,XMAX) )
text(pca$x[,c(1,3)],labels=labs,cex=0.7)
mtext("EOS - CRP group")

XMIN=min(pca$x[,2])*1.1
XMAX=max(pca$x[,2])*1.1
plot(pca$x[,2:3],cex=2,col=cols,pch=19,bty="none", xlim=c(XMIN,XMAX) )
text(pca$x[,2:3],labels=labs,cex=0.7)
mtext("EOS - CRP group")

POD1.

# wound type clean (1) contaminated (2)

mx <- xpod1f
ss2 <- ss_pod1
pca <- prcomp(t(mx),center = TRUE, scale = TRUE,retx=TRUE)
labs=gsub("-POD1","",rownames(pca$x))
XMIN=min(pca$x[,1])*1.1
XMAX=max(pca$x[,1])*1.1
cols <- as.character(ss_pod1$wound_type_cat)
cols <- gsub("2","red",gsub("1","gray",cols))
plot(pca$x[,1:2],cex=2,col=cols,pch=19,bty="none", xlim=c(XMIN,XMAX) )
text(pca$x[,1:2],labels=labs,cex=0.7)
mtext("POD1 - wound type")

plot(pca$x[,c(1,3)],cex=2,col=cols,pch=19,bty="none", xlim=c(XMIN,XMAX) )
text(pca$x[,c(1,3)],labels=labs,cex=0.7)
mtext("POD1 - wound type")

XMIN=min(pca$x[,2])*1.1
XMAX=max(pca$x[,2])*1.1
plot(pca$x[,2:3],cex=2,col=cols,pch=19,bty="none", xlim=c(XMIN,XMAX) )
text(pca$x[,2:3],labels=labs,cex=0.7)
mtext("POD1 - wound type")

# surg duration
my_palette <- colorRampPalette(c("yellow", "orange", "red"))(n = 10)
decile <- ntile(ss_pod1$duration_sx, 10)
mycols <- my_palette[decile]
XMIN=min(pca$x[,1])*1.1
XMAX=max(pca$x[,1])*1.1
plot(pca$x[,1:2],cex=2,col=mycols,pch=19,bty="none", xlim=c(XMIN,XMAX) )
text(pca$x[,1:2],labels=labs,cex=0.7)
mtext("POD1 - surgical duration deciles")

plot(pca$x[,c(1,3)],cex=2,col=mycols,pch=19,bty="none", xlim=c(XMIN,XMAX) )
text(pca$x[,c(1,3)],labels=labs,cex=0.7)
mtext("POD1 - surgical duration deciles")

XMIN=min(pca$x[,2])*1.1
XMAX=max(pca$x[,2])*1.1
plot(pca$x[,2:3],cex=2,col=mycols,pch=19,bty="none", xlim=c(XMIN,XMAX) )
text(pca$x[,2:3],labels=labs,cex=0.7)
mtext("POD1 - surgical duration deciles")

# Ethnicity Levels [1-4]: Asian, Maori/Polynesian, Other, White/Caucasian
XMIN=min(pca$x[,1])*1.1
XMAX=max(pca$x[,1])*1.1
cols <- as.character(ss_pod1$ethnicityD)
plot(pca$x[,1:2],cex=2,col=cols,pch=19,bty="none", xlim=c(XMIN,XMAX) )
text(pca$x[,1:2],labels=labs,cex=0.7)
mtext("POD1  - ethnicity")

plot(pca$x[,c(1,3)],cex=2,col=cols,pch=19,bty="none", xlim=c(XMIN,XMAX) )
text(pca$x[,c(1,3)],labels=labs,cex=0.7)
mtext("POD1  - ethnicity")

XMIN=min(pca$x[,2])*1.1
XMAX=max(pca$x[,2])*1.1
plot(pca$x[,2:3],cex=2,col=cols,pch=19,bty="none", xlim=c(XMIN,XMAX) )
text(pca$x[,2:3],labels=labs,cex=0.7)
mtext("POD1  - ethnicity")

# age
my_palette <- colorRampPalette(c("yellow", "orange", "red"))(n = 10)
decile <- ntile(ss_pod1$ageD, 10)
mycols <- my_palette[decile]
XMIN=min(pca$x[,1])*1.1
XMAX=max(pca$x[,1])*1.1
plot(pca$x[,1:2],cex=2,col=mycols,pch=19,bty="none", xlim=c(XMIN,XMAX) )
text(pca$x[,1:2],labels=labs,cex=0.7)
mtext("POD1 - age deciles")

plot(pca$x[,c(1,3)],cex=2,col=mycols,pch=19,bty="none", xlim=c(XMIN,XMAX) )
text(pca$x[,c(1,3)],labels=labs,cex=0.7)
mtext("POD1 - age deciles")

XMIN=min(pca$x[,2])*1.1
XMAX=max(pca$x[,2])*1.1
plot(pca$x[,2:3],cex=2,col=mycols,pch=19,bty="none", xlim=c(XMIN,XMAX) )
text(pca$x[,2:3],labels=labs,cex=0.7)
mtext("POD1 - age deciles")

# sex female=1 male=2
XMIN=min(pca$x[,1])*1.1
XMAX=max(pca$x[,1])*1.1
cols <- as.character(ss_pod1$sexD)
cols <- gsub("1","pink",gsub("2","lightblue",cols))
plot(pca$x[,1:2],cex=2,col=cols,pch=19,bty="none", xlim=c(XMIN,XMAX) )
text(pca$x[,1:2],labels=labs,cex=0.7)
mtext("POD1 - sex: female=pink, male=lightblue")

plot(pca$x[,c(1,3)],cex=2,col=cols,pch=19,bty="none", xlim=c(XMIN,XMAX) )
text(pca$x[,c(1,3)],labels=labs,cex=0.7)
mtext("POD1 - sex: female=pink, male=lightblue")

XMIN=min(pca$x[,2])*1.1
XMAX=max(pca$x[,2])*1.1
plot(pca$x[,2:3],cex=2,col=cols,pch=19,bty="none", xlim=c(XMIN,XMAX) )
text(pca$x[,2:3],labels=labs,cex=0.7)
mtext("POD1 - sex: female=pink, male=lightblue")

# bmi
my_palette <- colorRampPalette(c("yellow", "orange", "red"))(n = 10)
decile <- ntile(ss_pod1$bmi, 10)
mycols <- my_palette[decile]
XMIN=min(pca$x[,1])*1.1
XMAX=max(pca$x[,1])*1.1
plot(pca$x[,1:2],cex=2,col=mycols,pch=19,bty="none", xlim=c(XMIN,XMAX) )
text(pca$x[,1:2],labels=labs,cex=0.7)
mtext("POD1 - BMI deciles")

plot(pca$x[,c(1,3)],cex=2,col=mycols,pch=19,bty="none", xlim=c(XMIN,XMAX) )
text(pca$x[,c(1,3)],labels=labs,cex=0.7)
mtext("POD1 - BMI deciles")

XMIN=min(pca$x[,2])*1.1
XMAX=max(pca$x[,2])*1.1
plot(pca$x[,2:3],cex=2,col=mycols,pch=19,bty="none", xlim=c(XMIN,XMAX) )
text(pca$x[,2:3],labels=labs,cex=0.7)
mtext("POD1 - BMI deciles")

# asaD levels 1:4 black,red,green,blue
XMIN=min(pca$x[,1])*1.1
XMAX=max(pca$x[,1])*1.1
cols <- as.character(ss_pod1$asaD)
plot(pca$x[,1:2],cex=2,col=cols,pch=19,bty="none", xlim=c(XMIN,XMAX) )
text(pca$x[,1:2],labels=labs,cex=0.7)
mtext("POD1 - asaD")

plot(pca$x[,c(1,3)],cex=2,col=cols,pch=19,bty="none", xlim=c(XMIN,XMAX) )
text(pca$x[,c(1,3)],labels=labs,cex=0.7)
mtext("POD1 - asaD")

XMIN=min(pca$x[,2])*1.1
XMAX=max(pca$x[,2])*1.1
plot(pca$x[,2:3],cex=2,col=cols,pch=19,bty="none", xlim=c(XMIN,XMAX) )
text(pca$x[,2:3],labels=labs,cex=0.7)
mtext("POD1 - asaD")

# Current smoker no, yes
XMIN=min(pca$x[,1])*1.1
XMAX=max(pca$x[,1])*1.1
cols <- as.character(ss_pod1$current_smokerD)
plot(pca$x[,1:2],cex=2,col=cols,pch=19,bty="none", xlim=c(XMIN,XMAX) )
text(pca$x[,1:2],labels=labs,cex=0.7)
mtext("POD1 - current smoker")

plot(pca$x[,c(1,3)],cex=2,col=cols,pch=19,bty="none", xlim=c(XMIN,XMAX) )
text(pca$x[,c(1,3)],labels=labs,cex=0.7)
mtext("POD1 - current smoker")

XMIN=min(pca$x[,2])*1.1
XMAX=max(pca$x[,2])*1.1
plot(pca$x[,2:3],cex=2,col=cols,pch=19,bty="none", xlim=c(XMIN,XMAX) )
text(pca$x[,2:3],labels=labs,cex=0.7)
mtext("POD1 - current smoker")

# diabetes
XMIN=min(pca$x[,1])*1.1
XMAX=max(pca$x[,1])*1.1
cols <- as.character(ss_pod1$diabetes_typeD)
plot(pca$x[,1:2],cex=2,col=cols,pch=19,bty="none", xlim=c(XMIN,XMAX) )
text(pca$x[,1:2],labels=labs,cex=0.7)
mtext("POD1 - diabetes")

plot(pca$x[,c(1,3)],cex=2,col=cols,pch=19,bty="none", xlim=c(XMIN,XMAX) )
text(pca$x[,c(1,3)],labels=labs,cex=0.7)
mtext("POD1 - diabetes")

XMIN=min(pca$x[,2])*1.1
XMAX=max(pca$x[,2])*1.1
plot(pca$x[,2:3],cex=2,col=cols,pch=19,bty="none", xlim=c(XMIN,XMAX) )
text(pca$x[,2:3],labels=labs,cex=0.7)
mtext("POD1 - diabetes")

# treatment group
XMIN=min(pca$x[,1])*1.1
XMAX=max(pca$x[,1])*1.1
cols <- as.character(ss_pod1$treatment_group)
cols <- gsub("2","orange",gsub("1","cyan3",cols))
plot(pca$x[,1:2],cex=2,col=cols,pch=19,bty="none", xlim=c(XMIN,XMAX) )
text(pca$x[,1:2],labels=labs,cex=0.7)
mtext("POD1 - treatment group")

plot(pca$x[,c(1,3)],cex=2,col=cols,pch=19,bty="none", xlim=c(XMIN,XMAX) )
text(pca$x[,c(1,3)],labels=labs,cex=0.7)
mtext("POD1 - treatment group")

XMIN=min(pca$x[,2])*1.1
XMAX=max(pca$x[,2])*1.1
plot(pca$x[,2:3],cex=2,col=cols,pch=19,bty="none", xlim=c(XMIN,XMAX) )
text(pca$x[,2:3],labels=labs,cex=0.7)
mtext("POD1 - treatment group")

# treatment group
XMIN=min(pca$x[,1])*1.1
XMAX=max(pca$x[,1])*1.1
cols <- as.character(ss_pod1$crp_group)
cols <- gsub("4","orange",gsub("1","cyan3",cols))
plot(pca$x[,1:2],cex=2,col=cols,pch=19,bty="none", xlim=c(XMIN,XMAX) )
text(pca$x[,1:2],labels=labs,cex=0.7)
mtext("POD1 - CRP group")

plot(pca$x[,c(1,3)],cex=2,col=cols,pch=19,bty="none", xlim=c(XMIN,XMAX) )
text(pca$x[,c(1,3)],labels=labs,cex=0.7)
mtext("POD1 - CRP group")

XMIN=min(pca$x[,2])*1.1
XMAX=max(pca$x[,2])*1.1
plot(pca$x[,2:3],cex=2,col=cols,pch=19,bty="none", xlim=c(XMIN,XMAX) )
text(pca$x[,2:3],labels=labs,cex=0.7)
mtext("POD1 - CRP group")

Blood composition

xn <- xx
gt <- as.data.frame(sapply(strsplit(rownames(xn)," "),"[[",2) )
rownames(gt) <- rownames(xx)
colnames(gt) = "genesymbol"
gt$geneID <- rownames(xx)
blood <- read.table("https://raw.githubusercontent.com/giannimonaco/ABIS/master/data/sigmatrixRNAseq.txt")
blood2 <- merge(gt,blood,by.x="genesymbol",by.y=0)
blood2 <- blood2[which(!duplicated(blood2$genesymbol)),]
rownames(blood2) <- blood2$geneID
blood2 <- blood2[,c(3:ncol(blood2))]
genes <- intersect(rownames(xx), rownames(blood2))
dec <- apply(xx[genes, , drop=F], 2, function(x) coef(rlm( as.matrix(blood2[genes,]), x, maxit =100 ))) *100
## Warning in rlm.default(as.matrix(blood2[genes, ]), x, maxit = 100): 'rlm'
## failed to converge in 100 steps
## Warning in rlm.default(as.matrix(blood2[genes, ]), x, maxit = 100): 'rlm'
## failed to converge in 100 steps
dec <- t(dec/colSums(dec)*100)
dec <- signif(dec, 3)
# remove negative values
dec2 <- t(apply(dec,2,function(x) { mymin=min(x) ; if (mymin<0) { x + (mymin * -1) } else { x } } ))
dec2 <- apply(dec2,2,function(x) {x / sum(x) *100} )
colfunc <- colorRampPalette(c("blue", "white", "red"))
heatmap.2( dec2, col=colfunc(25),scale="row",
 trace="none",margins = c(5,5), cexRow=.7, cexCol=.8,  main="cell type abundances")

heatmap.2( dec2, col=colfunc(25),scale="none",
 trace="none",margins = c(5,5), cexRow=.7, cexCol=.8,  main="cell type abundances")

par(mar=c(5,10,3,1))
boxplot(t(dec2[order(rowMeans(dec2)),]),horizontal=TRUE,las=1, xlab="estimated cell proportion (%)")

par(mar = c(5.1, 4.1, 4.1, 2.1))
heatmap.2( cor(dec2),trace="none",scale="none")

heatmap.2( cor(t(dec2)),trace="none",scale="none", margins = c(8,8))

par(mar=c(5,10,3,1))
barplot(apply(dec2,1,sd),horiz=TRUE,las=1,xlab="SD of cell proportions (%)")

which(apply(dec2,1,sd)>4)
##    Monocytes.C             NK   T.CD8.Memory    T.CD4.Naive Neutrophils.LD 
##              1              2              3              4             10

Based on this analysis we can begin with correction of:

  • Monocytes.C
  • NK
  • T.CD8.Memory
  • T.CD4.Naive
  • Neutrophils.LD

According to the correlation heatmap, these are not strongly correlated.

Now look at how the cell proportions change over time.

ct0 <- dec2[,grep("-T0",colnames(dec2))]
ceos <- dec2[,grep("-EOS",colnames(dec2))]
cpod1 <- dec2[,grep("-POD1",colnames(dec2))]
par(mar=c(5,10,3,1))
boxplot(t(ct0),horizontal=TRUE,las=1, xlab="estimated cell proportion (%)",main="T0")

boxplot(t(ceos),horizontal=TRUE,las=1, xlab="estimated cell proportion (%)",main="EOS")

boxplot(t(cpod1),horizontal=TRUE,las=1, xlab="estimated cell proportion (%)",main="POD1")

sscell <- as.data.frame(t(dec2))
sscell_t0 <- sscell[grep("-T0",rownames(sscell)),]
sscell_eos <- sscell[grep("-EOS",rownames(sscell)),]
sscell_pod1 <- sscell[grep("POD1",rownames(sscell)),]

Now look at how cell types associate with the PCAs.

#xt0f xeosf xpod1f
#sscell_t0 sscell_eos sscell_pod1


## T0
mx <- xt0f

ss2 <- sscell_t0

pca <- prcomp(t(mx),center = TRUE, scale = TRUE,retx=TRUE)

loadings = pca$x
par(mar = c(5.1, 4.1, 4.1, 2.1))
plot(pca,type="lines",col="blue")

nGenes <- nrow(mx)
nSamples <- ncol(mx)
datTraits <- ss2
moduleTraitCor <- cor(loadings[,1:8], datTraits, use = "p")
moduleTraitPvalue <- corPvalueStudent(moduleTraitCor, nSamples)
textMatrix <- paste(signif(moduleTraitCor, 2), "\n(",
  signif(moduleTraitPvalue, 1), ")", sep = "")

dim(textMatrix) = dim(moduleTraitCor)

labeledHeatmap(Matrix = t(moduleTraitCor),
  xLabels = colnames(loadings)[1:ncol(t(moduleTraitCor))],
  yLabels = names(datTraits), colorLabels = FALSE, colors = blueWhiteRed(6),
  textMatrix = t(textMatrix), setStdMargins = FALSE, cex.text = 0.5,
  cex.lab.y = 0.6, zlim = c(-0.45,0.45),
  main = paste("PCA-cell relationships @T0: Top principal components"))
## Warning in numbers2colors(data, signed, colors = colors, lim = zlim, naColor =
## naColor): Some values of 'x' are below given minimum and will be truncated to
## the minimum.
## Warning in numbers2colors(data, signed, colors = colors, lim = zlim, naColor =
## naColor): Some values of 'x' are above given maximum and will be truncated to
## the maximum.

## EOS
mx <- xeosf

ss2 <- sscell_eos

pca <- prcomp(t(mx),center = TRUE, scale = TRUE,retx=TRUE)

loadings = pca$x

plot(pca,type="lines",col="blue")

nGenes <- nrow(mx)
nSamples <- ncol(mx)
datTraits <- ss2
moduleTraitCor <- cor(loadings[,1:8], datTraits, use = "p")
moduleTraitPvalue <- corPvalueStudent(moduleTraitCor, nSamples)
textMatrix <- paste(signif(moduleTraitCor, 2), "\n(",
  signif(moduleTraitPvalue, 1), ")", sep = "")

dim(textMatrix) = dim(moduleTraitCor)

labeledHeatmap(Matrix = t(moduleTraitCor),
  xLabels = colnames(loadings)[1:ncol(t(moduleTraitCor))],
  yLabels = names(datTraits), colorLabels = FALSE, colors = blueWhiteRed(6),
  textMatrix = t(textMatrix), setStdMargins = FALSE, cex.text = 0.5,
  cex.lab.y = 0.6, zlim = c(-0.45,0.45),
  main = paste("PCA-cell relationships @EOS: Top principal components"))
## Warning in numbers2colors(data, signed, colors = colors, lim = zlim, naColor =
## naColor): Some values of 'x' are below given minimum and will be truncated to
## the minimum.
## Warning in numbers2colors(data, signed, colors = colors, lim = zlim, naColor =
## naColor): Some values of 'x' are above given maximum and will be truncated to
## the maximum.

## POD1
mx <- xpod1f

ss2 <- sscell_pod1

pca <- prcomp(t(mx),center = TRUE, scale = TRUE,retx=TRUE)

loadings = pca$x

plot(pca,type="lines",col="blue")

nGenes <- nrow(mx)
nSamples <- ncol(mx)
datTraits <- ss2
moduleTraitCor <- cor(loadings[,1:8], datTraits, use = "p")
moduleTraitPvalue <- corPvalueStudent(moduleTraitCor, nSamples)
textMatrix <- paste(signif(moduleTraitCor, 2), "\n(",
  signif(moduleTraitPvalue, 1), ")", sep = "")

dim(textMatrix) = dim(moduleTraitCor)

labeledHeatmap(Matrix = t(moduleTraitCor),
  xLabels = colnames(loadings)[1:ncol(t(moduleTraitCor))],
  yLabels = names(datTraits), colorLabels = FALSE, colors = blueWhiteRed(6),
  textMatrix = t(textMatrix), setStdMargins = FALSE, cex.text = 0.5,
  cex.lab.y = 0.6, zlim = c(-0.45,0.45),
  main = paste("PCA-cell relationships @POD1: Top principal components"))
## Warning in numbers2colors(data, signed, colors = colors, lim = zlim, naColor =
## naColor): Some values of 'x' are below given minimum and will be truncated to
## the minimum.
## Warning in numbers2colors(data, signed, colors = colors, lim = zlim, naColor =
## naColor): Some values of 'x' are above given maximum and will be truncated to
## the maximum.

The conclusion here is that the cell types correlate strongly with the principal components. The good news is that we have selected the cell types that associate the strongest, so we can correct for their contribution.

Differential expression

Specific PCAs for key clinical parameters:

  • wound type
  • surg duration
  • ethnicity
  • age
  • sex

And blood composition:

  • Monocytes.C
  • NK
  • T.CD8.Memory
  • T.CD4.Naive
  • Neutrophils.LD

And ones we didn’t include:

  • bmi
  • asaD
  • smoker
  • diabetes_typeD

TODO:

  • age data centred and scaled

  • ethnicity categories unordered

Overview

  1. CRP group comparisons not stratified for treatment group (inflamation)

  2. Treatment group comparisons not stratified for CRP group (Steroid)

  3. CRP group comparisons statified for treatment group: inflammation and steroid

  4. Treatment group complarisons stratified for CRP group: steroid and inflammation

CRP group differences not stratified

CRP low vs high at t=0

mx <- xt0f
ss2 <- as.data.frame(cbind(ss_t0,sscell_t0))
mx <- mx[,colnames(mx) %in% rownames(ss2)]

# base model
dds <- DESeqDataSetFromMatrix(countData = mx , colData = ss2,
  design = ~ crp_group )
## converting counts to integer mode
##   the design formula contains one or more numeric variables with integer values,
##   specifying a model with increasing fold change for higher values.
##   did you mean for this to be a factor? if so, first convert
##   this variable to a factor using the factor() function
res <- DESeq(dds)
## estimating size factors
## estimating dispersions
## gene-wise dispersion estimates
## mean-dispersion relationship
## final dispersion estimates
## fitting model and testing
## -- replacing outliers and refitting for 390 genes
## -- DESeq argument 'minReplicatesForReplace' = 7 
## -- original counts are preserved in counts(dds)
## estimating dispersions
## fitting model and testing
z <- results(res)
vsd <- vst(dds, blind=FALSE)
zz <- cbind(as.data.frame(z),assay(vsd))
dge <- as.data.frame(zz[order(zz$pvalue),])
head(dge[order(dge$pvalue),1:6],10)
##                                  baseMean log2FoldChange      lfcSE      stat
## ENSG00000179593.16 ALOX15B      192.12350     -0.7187508 0.10489179 -6.852308
## ENSG00000141744.4 PNMT           35.64128     -0.4354625 0.09456325 -4.604986
## ENSG00000087116.16 ADAMTS2       96.08857     -0.5387022 0.12313891 -4.374752
## ENSG00000057294.16 PKP2          83.96200     -0.3049742 0.07109219 -4.289842
## ENSG00000279359.1 RP11-36D19.9   12.76771     -0.5030155 0.11986382 -4.196558
## ENSG00000276168.1 RN7SL1        591.11188      0.2489061 0.06119920  4.067147
## ENSG00000063438.20 AHRR          92.23299     -0.4595163 0.11376981 -4.039000
## ENSG00000233916.1 ZDHHC20P1      21.16714     -0.3347389 0.08736544 -3.831480
## ENSG00000189056.15 RELN          17.27434      0.1809771 0.04776302  3.789062
## ENSG00000274012.1 RN7SL2       1037.64399      0.2367552 0.06518141  3.632250
##                                      pvalue         padj
## ENSG00000179593.16 ALOX15B     7.266794e-12 1.593971e-07
## ENSG00000141744.4 PNMT         4.124926e-06 4.524013e-02
## ENSG00000087116.16 ADAMTS2     1.215705e-05 8.888828e-02
## ENSG00000057294.16 PKP2        1.788006e-05 9.804975e-02
## ENSG00000279359.1 RP11-36D19.9 2.710017e-05 1.188885e-01
## ENSG00000276168.1 RN7SL1       4.759225e-05 1.682084e-01
## ENSG00000063438.20 AHRR        5.367947e-05 1.682084e-01
## ENSG00000233916.1 ZDHHC20P1    1.273749e-04 3.492459e-01
## ENSG00000189056.15 RELN        1.512169e-04 3.685491e-01
## ENSG00000274012.1 RN7SL2       2.809608e-04 6.162874e-01
mean(abs(dge$stat))
## [1] 0.7207644
# model with clinical covariates
dds <- DESeqDataSetFromMatrix(countData = mx , colData = ss2,
  design = ~ sexD + wound_typeOP + duration_sx + ethnicityCAT + ageCS + crp_group )
## converting counts to integer mode
## Warning in DESeqDataSet(se, design = design, ignoreRank): some variables in
## design formula are characters, converting to factors
##   the design formula contains one or more numeric variables with integer values,
##   specifying a model with increasing fold change for higher values.
##   did you mean for this to be a factor? if so, first convert
##   this variable to a factor using the factor() function
##   Note: levels of factors in the design contain characters other than
##   letters, numbers, '_' and '.'. It is recommended (but not required) to use
##   only letters, numbers, and delimiters '_' or '.', as these are safe characters
##   for column names in R. [This is a message, not a warning or an error]
res <- DESeq(dds)
## estimating size factors
##   Note: levels of factors in the design contain characters other than
##   letters, numbers, '_' and '.'. It is recommended (but not required) to use
##   only letters, numbers, and delimiters '_' or '.', as these are safe characters
##   for column names in R. [This is a message, not a warning or an error]
## estimating dispersions
## gene-wise dispersion estimates
## mean-dispersion relationship
##   Note: levels of factors in the design contain characters other than
##   letters, numbers, '_' and '.'. It is recommended (but not required) to use
##   only letters, numbers, and delimiters '_' or '.', as these are safe characters
##   for column names in R. [This is a message, not a warning or an error]
## final dispersion estimates
## fitting model and testing
## 19 rows did not converge in beta, labelled in mcols(object)$betaConv. Use larger maxit argument with nbinomWaldTest
z <- results(res)
vsd <- vst(dds, blind=FALSE)
##   Note: levels of factors in the design contain characters other than
##   letters, numbers, '_' and '.'. It is recommended (but not required) to use
##   only letters, numbers, and delimiters '_' or '.', as these are safe characters
##   for column names in R. [This is a message, not a warning or an error]
zz <- cbind(as.data.frame(z),assay(vsd))
dge <- as.data.frame(zz[order(zz$pvalue),])
head(dge[order(dge$pvalue),1:6],10)
##                                  baseMean log2FoldChange      lfcSE      stat
## ENSG00000223609.11 HBD          153.11532      0.6127017 0.13080850  4.683959
## ENSG00000261026.1 CTD-3247F14.2  13.74757     -1.0503473 0.23156953 -4.535775
## ENSG00000206177.7 HBM            45.70050      0.6155113 0.14218666  4.328896
## ENSG00000004939.16 SLC4A1       233.82225      0.4920445 0.12031713  4.089563
## ENSG00000169877.10 AHSP          34.93993      0.6188578 0.15316672  4.040419
## ENSG00000179593.16 ALOX15B      250.75091     -0.3691708 0.09277372 -3.979261
## ENSG00000218052.5 ADAMTS7P4      23.44923      0.2098524 0.05372181  3.906280
## ENSG00000268734.1 CTB-61M7.2     10.82400     -1.4946787 0.38782949 -3.853958
## ENSG00000166947.15 EPB42         37.40076      0.4773174 0.12488402  3.822085
## ENSG00000179388.9 EGR3          270.39768     -0.5197675 0.13823652 -3.759987
##                                       pvalue      padj
## ENSG00000223609.11 HBD          2.813859e-06 0.0617220
## ENSG00000261026.1 CTD-3247F14.2 5.739229e-06 0.0629450
## ENSG00000206177.7 HBM           1.498584e-05 0.1095715
## ENSG00000004939.16 SLC4A1       4.321860e-05 0.2340715
## ENSG00000169877.10 AHSP         5.335572e-05 0.2340715
## ENSG00000179593.16 ALOX15B      6.912983e-05 0.2527272
## ENSG00000218052.5 ADAMTS7P4     9.372795e-05 0.2937032
## ENSG00000268734.1 CTB-61M7.2    1.162234e-04 0.3186701
## ENSG00000166947.15 EPB42        1.323281e-04 0.3225129
## ENSG00000179388.9 EGR3          1.699222e-04 0.3727244
mean(abs(dge$stat))
## [1] 0.7617784
crp_t0 <- dge

# model with clinical and cell covariates
# Monocytes.C NK T.CD8.Memory T.CD4.Naive Neutrophils.LD
dds <- DESeqDataSetFromMatrix(countData = mx , colData = ss2,
  design = ~ sexD + wound_typeOP + duration_sx + ethnicityCAT + ageCS +
    Monocytes.C + NK + T.CD8.Memory + T.CD4.Naive + Neutrophils.LD + crp_group )
## converting counts to integer mode
## Warning in DESeqDataSet(se, design = design, ignoreRank): some variables in
## design formula are characters, converting to factors
##   the design formula contains one or more numeric variables with integer values,
##   specifying a model with increasing fold change for higher values.
##   did you mean for this to be a factor? if so, first convert
##   this variable to a factor using the factor() function
##   the design formula contains one or more numeric variables that have mean or
##   standard deviation larger than 5 (an arbitrary threshold to trigger this message).
##   Including numeric variables with large mean can induce collinearity with the intercept.
##   Users should center and scale numeric variables in the design to improve GLM convergence.
##   Note: levels of factors in the design contain characters other than
##   letters, numbers, '_' and '.'. It is recommended (but not required) to use
##   only letters, numbers, and delimiters '_' or '.', as these are safe characters
##   for column names in R. [This is a message, not a warning or an error]
res <- DESeq(dds)
## estimating size factors
##   Note: levels of factors in the design contain characters other than
##   letters, numbers, '_' and '.'. It is recommended (but not required) to use
##   only letters, numbers, and delimiters '_' or '.', as these are safe characters
##   for column names in R. [This is a message, not a warning or an error]
## estimating dispersions
## gene-wise dispersion estimates
## mean-dispersion relationship
##   Note: levels of factors in the design contain characters other than
##   letters, numbers, '_' and '.'. It is recommended (but not required) to use
##   only letters, numbers, and delimiters '_' or '.', as these are safe characters
##   for column names in R. [This is a message, not a warning or an error]
## final dispersion estimates
## fitting model and testing
## 10 rows did not converge in beta, labelled in mcols(object)$betaConv. Use larger maxit argument with nbinomWaldTest
z <- results(res)
vsd <- vst(dds, blind=FALSE)
##   Note: levels of factors in the design contain characters other than
##   letters, numbers, '_' and '.'. It is recommended (but not required) to use
##   only letters, numbers, and delimiters '_' or '.', as these are safe characters
##   for column names in R. [This is a message, not a warning or an error]
zz <- cbind(as.data.frame(z),assay(vsd))
dge <- as.data.frame(zz[order(zz$pvalue),])
head(dge[order(dge$pvalue),1:6],10)
##                              baseMean log2FoldChange      lfcSE      stat
## ENSG00000223609.11 HBD      153.11532     0.58209593 0.13422143  4.336833
## ENSG00000206177.7 HBM        45.70050     0.55382261 0.14446831  3.833523
## ENSG00000004939.16 SLC4A1   233.82225     0.46687689 0.12375126  3.772704
## ENSG00000132122.12 SPATA6   215.55260    -0.09259567 0.02479843 -3.733933
## ENSG00000169877.10 AHSP      34.93993     0.58801794 0.15784167  3.725366
## ENSG00000076864.20 RAP1GAP   14.58834     0.30003375 0.08110668  3.699248
## ENSG00000181126.13 HLA-V    366.66600    -0.44464770 0.12076431 -3.681946
## ENSG00000218052.5 ADAMTS7P4  23.44923     0.18427003 0.05011221  3.677148
## ENSG00000170153.11 RNF150    16.74377    -0.64212105 0.17646644 -3.638771
## ENSG00000166947.15 EPB42     37.40076     0.45926219 0.12825639  3.580813
##                                   pvalue      padj
## ENSG00000223609.11 HBD      1.445504e-05 0.3170712
## ENSG00000206177.7 HBM       1.263209e-04 0.6219399
## ENSG00000004939.16 SLC4A1   1.614877e-04 0.6219399
## ENSG00000132122.12 SPATA6   1.885127e-04 0.6219399
## ENSG00000169877.10 AHSP     1.950322e-04 0.6219399
## ENSG00000076864.20 RAP1GAP  2.162390e-04 0.6219399
## ENSG00000181126.13 HLA-V    2.314602e-04 0.6219399
## ENSG00000218052.5 ADAMTS7P4 2.358558e-04 0.6219399
## ENSG00000170153.11 RNF150   2.739418e-04 0.6219399
## ENSG00000166947.15 EPB42    3.425263e-04 0.6219399
mean(abs(dge$stat))
## [1] 0.7499787
crp_t0_adj <- dge

CRP low vs high at EOS

mx <- xeosf
ss2 <- as.data.frame(cbind(ss_eos,sscell_eos))
mx <- mx[,colnames(mx) %in% rownames(ss2)]

# base model
dds <- DESeqDataSetFromMatrix(countData = mx , colData = ss2,
  design = ~ crp_group )
## converting counts to integer mode
##   the design formula contains one or more numeric variables with integer values,
##   specifying a model with increasing fold change for higher values.
##   did you mean for this to be a factor? if so, first convert
##   this variable to a factor using the factor() function
res <- DESeq(dds)
## estimating size factors
## estimating dispersions
## gene-wise dispersion estimates
## mean-dispersion relationship
## final dispersion estimates
## fitting model and testing
## -- replacing outliers and refitting for 118 genes
## -- DESeq argument 'minReplicatesForReplace' = 7 
## -- original counts are preserved in counts(dds)
## estimating dispersions
## fitting model and testing
z <- results(res)
vsd <- vst(dds, blind=FALSE)
zz <- cbind(as.data.frame(z),assay(vsd))
dge <- as.data.frame(zz[order(zz$pvalue),])
head(dge[order(dge$pvalue),1:6],10)
##                                   baseMean log2FoldChange      lfcSE     stat
## ENSG00000139572.4 GPR84          231.01210      0.7893177 0.09543038 8.271137
## ENSG00000113368.12 LMNB1        2665.88768      0.4224482 0.05453011 7.747062
## ENSG00000280091.1 CTC-312O10.3    32.83608      0.5061573 0.06958189 7.274267
## ENSG00000137193.14 PIM1         7966.43548      0.3023359 0.04160685 7.266494
## ENSG00000170525.21 PFKFB3       4788.95198      0.5364125 0.07387475 7.261108
## ENSG00000079385.23 CEACAM1      1095.76169      0.7812428 0.10858770 7.194579
## ENSG00000069399.15 BCL3         3591.85376      0.4579237 0.06480903 7.065740
## ENSG00000184557.4 SOCS3        13113.96513      0.6655088 0.09494900 7.009118
## ENSG00000198019.13 FCGR1B        681.83152      0.5275512 0.07634910 6.909724
## ENSG00000163251.4 FZD5            91.58576      0.4341470 0.06308193 6.882272
##                                      pvalue         padj
## ENSG00000139572.4 GPR84        1.326872e-16 2.871217e-12
## ENSG00000113368.12 LMNB1       9.404335e-15 1.017502e-10
## ENSG00000280091.1 CTC-312O10.3 3.483056e-13 1.661581e-09
## ENSG00000137193.14 PIM1        3.689370e-13 1.661581e-09
## ENSG00000170525.21 PFKFB3      3.839320e-13 1.661581e-09
## ENSG00000079385.23 CEACAM1     6.265387e-13 2.259612e-09
## ENSG00000069399.15 BCL3        1.597623e-12 4.938709e-09
## ENSG00000184557.4 SOCS3        2.398244e-12 6.486949e-09
## ENSG00000198019.13 FCGR1B      4.855988e-12 1.167541e-08
## ENSG00000163251.4 FZD5         5.890533e-12 1.274652e-08
mean(abs(dge$stat))
## [1] 1.485292
# model with clinical covariates
dds <- DESeqDataSetFromMatrix(countData = mx , colData = ss2,
  design = ~ sexD + wound_typeOP + duration_sx + ethnicityCAT + ageCS + crp_group )
## converting counts to integer mode
## Warning in DESeqDataSet(se, design = design, ignoreRank): some variables in
## design formula are characters, converting to factors
##   the design formula contains one or more numeric variables with integer values,
##   specifying a model with increasing fold change for higher values.
##   did you mean for this to be a factor? if so, first convert
##   this variable to a factor using the factor() function
##   Note: levels of factors in the design contain characters other than
##   letters, numbers, '_' and '.'. It is recommended (but not required) to use
##   only letters, numbers, and delimiters '_' or '.', as these are safe characters
##   for column names in R. [This is a message, not a warning or an error]
res <- DESeq(dds)
## estimating size factors
##   Note: levels of factors in the design contain characters other than
##   letters, numbers, '_' and '.'. It is recommended (but not required) to use
##   only letters, numbers, and delimiters '_' or '.', as these are safe characters
##   for column names in R. [This is a message, not a warning or an error]
## estimating dispersions
## gene-wise dispersion estimates
## mean-dispersion relationship
##   Note: levels of factors in the design contain characters other than
##   letters, numbers, '_' and '.'. It is recommended (but not required) to use
##   only letters, numbers, and delimiters '_' or '.', as these are safe characters
##   for column names in R. [This is a message, not a warning or an error]
## final dispersion estimates
## fitting model and testing
## 14 rows did not converge in beta, labelled in mcols(object)$betaConv. Use larger maxit argument with nbinomWaldTest
z <- results(res)
vsd <- vst(dds, blind=FALSE)
##   Note: levels of factors in the design contain characters other than
##   letters, numbers, '_' and '.'. It is recommended (but not required) to use
##   only letters, numbers, and delimiters '_' or '.', as these are safe characters
##   for column names in R. [This is a message, not a warning or an error]
zz <- cbind(as.data.frame(z),assay(vsd))
dge <- as.data.frame(zz[order(zz$pvalue),])
head(dge[order(dge$pvalue),1:6],10)
##                              baseMean log2FoldChange      lfcSE     stat
## ENSG00000139572.4 GPR84     231.01210      0.7183062 0.11564967 6.211053
## ENSG00000127954.13 STEAP4  2533.73582      0.5130516 0.09062352 5.661352
## ENSG00000184557.4 SOCS3   13113.96513      0.6216040 0.11307436 5.497303
## ENSG00000176597.12 B3GNT5   367.05640      0.4553917 0.08837595 5.152891
## ENSG00000059804.16 SLC2A3  9795.99656      0.4116953 0.08137334 5.059338
## ENSG00000170525.21 PFKFB3  4788.95198      0.4492633 0.08908047 5.043343
## ENSG00000069399.15 BCL3    3591.85376      0.3933702 0.07815095 5.033467
## ENSG00000121742.19 GJB6      54.89967      0.6668659 0.13279923 5.021610
## ENSG00000113368.12 LMNB1   2665.88768      0.3025021 0.06103820 4.955947
## ENSG00000173281.5 PPP1R3B  1142.35672      0.4439020 0.08968117 4.949780
##                                 pvalue         padj
## ENSG00000139572.4 GPR84   5.263078e-10 1.138877e-05
## ENSG00000127954.13 STEAP4 1.501854e-08 1.624930e-04
## ENSG00000184557.4 SOCS3   3.856442e-08 2.781651e-04
## ENSG00000176597.12 B3GNT5 2.565005e-07 1.385985e-03
## ENSG00000059804.16 SLC2A3 4.207135e-07 1.385985e-03
## ENSG00000170525.21 PFKFB3 4.574686e-07 1.385985e-03
## ENSG00000069399.15 BCL3   4.816882e-07 1.385985e-03
## ENSG00000121742.19 GJB6   5.124025e-07 1.385985e-03
## ENSG00000113368.12 LMNB1  7.197870e-07 1.407299e-03
## ENSG00000173281.5 PPP1R3B 7.429758e-07 1.407299e-03
mean(abs(dge$stat))
## [1] 1.185118
crp_eos <- dge

# model with clinical and cell covariates
# Monocytes.C NK T.CD8.Memory T.CD4.Naive Neutrophils.LD
dds <- DESeqDataSetFromMatrix(countData = mx , colData = ss2,
  design = ~ sexD + wound_typeOP + duration_sx + ethnicityCAT + ageCS +
    Monocytes.C + NK + T.CD8.Memory + T.CD4.Naive + Neutrophils.LD + crp_group )
## converting counts to integer mode
## Warning in DESeqDataSet(se, design = design, ignoreRank): some variables in
## design formula are characters, converting to factors
##   the design formula contains one or more numeric variables with integer values,
##   specifying a model with increasing fold change for higher values.
##   did you mean for this to be a factor? if so, first convert
##   this variable to a factor using the factor() function
##   the design formula contains one or more numeric variables that have mean or
##   standard deviation larger than 5 (an arbitrary threshold to trigger this message).
##   Including numeric variables with large mean can induce collinearity with the intercept.
##   Users should center and scale numeric variables in the design to improve GLM convergence.
##   Note: levels of factors in the design contain characters other than
##   letters, numbers, '_' and '.'. It is recommended (but not required) to use
##   only letters, numbers, and delimiters '_' or '.', as these are safe characters
##   for column names in R. [This is a message, not a warning or an error]
res <- DESeq(dds)
## estimating size factors
##   Note: levels of factors in the design contain characters other than
##   letters, numbers, '_' and '.'. It is recommended (but not required) to use
##   only letters, numbers, and delimiters '_' or '.', as these are safe characters
##   for column names in R. [This is a message, not a warning or an error]
## estimating dispersions
## gene-wise dispersion estimates
## mean-dispersion relationship
##   Note: levels of factors in the design contain characters other than
##   letters, numbers, '_' and '.'. It is recommended (but not required) to use
##   only letters, numbers, and delimiters '_' or '.', as these are safe characters
##   for column names in R. [This is a message, not a warning or an error]
## final dispersion estimates
## fitting model and testing
## 9 rows did not converge in beta, labelled in mcols(object)$betaConv. Use larger maxit argument with nbinomWaldTest
z <- results(res)
vsd <- vst(dds, blind=FALSE)
##   Note: levels of factors in the design contain characters other than
##   letters, numbers, '_' and '.'. It is recommended (but not required) to use
##   only letters, numbers, and delimiters '_' or '.', as these are safe characters
##   for column names in R. [This is a message, not a warning or an error]
zz <- cbind(as.data.frame(z),assay(vsd))
dge <- as.data.frame(zz[order(zz$pvalue),])
head(dge[order(dge$pvalue),1:6],10)
##                                  baseMean log2FoldChange      lfcSE      stat
## ENSG00000197632.9 SERPINB2      260.41250      0.3545761 0.06850137  5.176189
## ENSG00000127954.13 STEAP4      2533.73582      0.2836443 0.05488758  5.167732
## ENSG00000139572.4 GPR84         231.01210      0.4490274 0.08779641  5.114416
## ENSG00000211459.2 MT-RNR1    100058.33839     -0.2858692 0.05843432 -4.892145
## ENSG00000241560.7 ZBTB20-AS1     46.10569      0.2579937 0.05302105  4.865873
## ENSG00000210082.2 MT-RNR2    242496.36564     -0.2401137 0.04976253 -4.825190
## ENSG00000064763.11 FAR2         604.97645     -0.2053606 0.04311803 -4.762754
## ENSG00000135678.12 CPM          575.43286     -0.3101463 0.06641943 -4.669512
## ENSG00000155659.15 VSIG4        356.81388     -0.4006950 0.08583339 -4.668288
## ENSG00000050730.16 TNIP3         55.66088      0.2325018 0.04992622  4.656908
##                                    pvalue        padj
## ENSG00000197632.9 SERPINB2   2.264642e-07 0.002314927
## ENSG00000127954.13 STEAP4    2.369520e-07 0.002314927
## ENSG00000139572.4 GPR84      3.147134e-07 0.002314927
## ENSG00000211459.2 MT-RNR1    9.974275e-07 0.005029176
## ENSG00000241560.7 ZBTB20-AS1 1.139524e-06 0.005029176
## ENSG00000210082.2 MT-RNR2    1.398696e-06 0.005144171
## ENSG00000064763.11 FAR2      1.909682e-06 0.006020136
## ENSG00000135678.12 CPM       3.019165e-06 0.007083372
## ENSG00000155659.15 VSIG4     3.037196e-06 0.007083372
## ENSG00000050730.16 TNIP3     3.209939e-06 0.007083372
mean(abs(dge$stat))
## [1] 0.9721215
crp_eos_adj <- dge

CRP low vs high at POD1

mx <- xpod1f
ss2 <- as.data.frame(cbind(ss_pod1,sscell_pod1))
mx <- mx[,colnames(mx) %in% rownames(ss2)]

# base model
dds <- DESeqDataSetFromMatrix(countData = mx , colData = ss2,
  design = ~ crp_group )
## converting counts to integer mode
##   the design formula contains one or more numeric variables with integer values,
##   specifying a model with increasing fold change for higher values.
##   did you mean for this to be a factor? if so, first convert
##   this variable to a factor using the factor() function
res <- DESeq(dds)
## estimating size factors
## estimating dispersions
## gene-wise dispersion estimates
## mean-dispersion relationship
## final dispersion estimates
## fitting model and testing
## -- replacing outliers and refitting for 134 genes
## -- DESeq argument 'minReplicatesForReplace' = 7 
## -- original counts are preserved in counts(dds)
## estimating dispersions
## fitting model and testing
z <- results(res)
vsd <- vst(dds, blind=FALSE)
zz <- cbind(as.data.frame(z),assay(vsd))
dge <- as.data.frame(zz[order(zz$pvalue),])
head(dge[order(dge$pvalue),1:6],10)
##                               baseMean log2FoldChange      lfcSE      stat
## ENSG00000007968.7 E2F2       870.17416      0.4436761 0.03676788 12.066948
## ENSG00000137869.15 CYP19A1    81.93527      0.9960649 0.09264040 10.751949
## ENSG00000163710.9 PCOLCE2     18.25602      1.0744848 0.10096581 10.642066
## ENSG00000104918.8 RETN      1801.19251      0.7757049 0.07614859 10.186726
## ENSG00000132170.24 PPARG     168.63657      0.5429631 0.05405474 10.044690
## ENSG00000145287.11 PLAC8    4671.33188      0.3457873 0.03478431  9.940898
## ENSG00000183578.8 TNFAIP8L3   24.65972      0.7720344 0.07809643  9.885655
## ENSG00000135424.18 ITGA7     436.10324      0.5378278 0.05479987  9.814399
## ENSG00000108950.12 FAM20A   1751.41363      0.6102328 0.06295930  9.692497
## ENSG00000165092.13 ALDH1A1   410.41112     -0.5138028 0.05334920 -9.630936
##                                   pvalue         padj
## ENSG00000007968.7 E2F2      1.578813e-33 3.364925e-29
## ENSG00000137869.15 CYP19A1  5.802268e-27 6.183186e-23
## ENSG00000163710.9 PCOLCE2   1.898717e-26 1.348912e-22
## ENSG00000104918.8 RETN      2.272894e-24 1.211055e-20
## ENSG00000132170.24 PPARG    9.695213e-24 4.132682e-20
## ENSG00000145287.11 PLAC8    2.763251e-23 9.815527e-20
## ENSG00000183578.8 TNFAIP8L3 4.804293e-23 1.462770e-19
## ENSG00000135424.18 ITGA7    9.761766e-23 2.600656e-19
## ENSG00000108950.12 FAM20A   3.244949e-22 7.684400e-19
## ENSG00000165092.13 ALDH1A1  5.918789e-22 1.261472e-18
mean(abs(dge$stat))
## [1] 1.827282
# model with clinical covariates
dds <- DESeqDataSetFromMatrix(countData = mx , colData = ss2,
  design = ~ sexD + wound_typeOP + duration_sx + ethnicityCAT + ageCS + crp_group )
## converting counts to integer mode
## Warning in DESeqDataSet(se, design = design, ignoreRank): some variables in
## design formula are characters, converting to factors
##   the design formula contains one or more numeric variables with integer values,
##   specifying a model with increasing fold change for higher values.
##   did you mean for this to be a factor? if so, first convert
##   this variable to a factor using the factor() function
##   Note: levels of factors in the design contain characters other than
##   letters, numbers, '_' and '.'. It is recommended (but not required) to use
##   only letters, numbers, and delimiters '_' or '.', as these are safe characters
##   for column names in R. [This is a message, not a warning or an error]
res <- DESeq(dds)
## estimating size factors
##   Note: levels of factors in the design contain characters other than
##   letters, numbers, '_' and '.'. It is recommended (but not required) to use
##   only letters, numbers, and delimiters '_' or '.', as these are safe characters
##   for column names in R. [This is a message, not a warning or an error]
## estimating dispersions
## gene-wise dispersion estimates
## mean-dispersion relationship
##   Note: levels of factors in the design contain characters other than
##   letters, numbers, '_' and '.'. It is recommended (but not required) to use
##   only letters, numbers, and delimiters '_' or '.', as these are safe characters
##   for column names in R. [This is a message, not a warning or an error]
## final dispersion estimates
## fitting model and testing
## 20 rows did not converge in beta, labelled in mcols(object)$betaConv. Use larger maxit argument with nbinomWaldTest
z <- results(res)
vsd <- vst(dds, blind=FALSE)
##   Note: levels of factors in the design contain characters other than
##   letters, numbers, '_' and '.'. It is recommended (but not required) to use
##   only letters, numbers, and delimiters '_' or '.', as these are safe characters
##   for column names in R. [This is a message, not a warning or an error]
zz <- cbind(as.data.frame(z),assay(vsd))
dge <- as.data.frame(zz[order(zz$pvalue),])
head(dge[order(dge$pvalue),1:6],10)
##                              baseMean log2FoldChange      lfcSE      stat
## ENSG00000007968.7 E2F2      870.17416      0.3860936 0.04401299  8.772264
## ENSG00000163710.9 PCOLCE2    18.25602      0.9879318 0.11793493  8.376923
## ENSG00000137869.15 CYP19A1   81.93527      0.8122448 0.10657233  7.621535
## ENSG00000104918.8 RETN     1801.19251      0.6489135 0.08536396  7.601727
## ENSG00000132170.24 PPARG    168.63657      0.4789945 0.06318857  7.580398
## ENSG00000135424.18 ITGA7    436.10324      0.4767597 0.06544080  7.285359
## ENSG00000108950.12 FAM20A  1751.41363      0.5260557 0.07302081  7.204190
## ENSG00000169994.19 MYO7B    618.31752      0.3324557 0.04684399  7.097083
## ENSG00000165092.13 ALDH1A1  410.41112     -0.4432919 0.06264590 -7.076151
## ENSG00000116016.14 EPAS1    154.17271      0.3555413 0.05078144  7.001402
##                                  pvalue         padj
## ENSG00000007968.7 E2F2     1.751085e-18 3.732087e-14
## ENSG00000163710.9 PCOLCE2  5.432955e-17 5.789629e-13
## ENSG00000137869.15 CYP19A1 2.506768e-14 1.468447e-10
## ENSG00000104918.8 RETN     2.922041e-14 1.468447e-10
## ENSG00000132170.24 PPARG   3.444956e-14 1.468447e-10
## ENSG00000135424.18 ITGA7   3.208156e-13 1.139591e-09
## ENSG00000108950.12 FAM20A  5.839004e-13 1.777810e-09
## ENSG00000169994.19 MYO7B   1.274176e-12 3.394564e-09
## ENSG00000165092.13 ALDH1A1 1.482132e-12 3.509854e-09
## ENSG00000116016.14 EPAS1   2.534142e-12 5.401016e-09
mean(abs(dge$stat))
## [1] 1.324953
crp_pod1 <- dge

# model with clinical and cell covariates
# Monocytes.C NK T.CD8.Memory T.CD4.Naive Neutrophils.LD
dds <- DESeqDataSetFromMatrix(countData = mx , colData = ss2,
  design = ~ sexD + wound_typeOP + duration_sx + ethnicityCAT + ageCS +
    Monocytes.C + NK + T.CD8.Memory + T.CD4.Naive + Neutrophils.LD + crp_group )
## converting counts to integer mode
## Warning in DESeqDataSet(se, design = design, ignoreRank): some variables in
## design formula are characters, converting to factors
##   the design formula contains one or more numeric variables with integer values,
##   specifying a model with increasing fold change for higher values.
##   did you mean for this to be a factor? if so, first convert
##   this variable to a factor using the factor() function
##   the design formula contains one or more numeric variables that have mean or
##   standard deviation larger than 5 (an arbitrary threshold to trigger this message).
##   Including numeric variables with large mean can induce collinearity with the intercept.
##   Users should center and scale numeric variables in the design to improve GLM convergence.
##   Note: levels of factors in the design contain characters other than
##   letters, numbers, '_' and '.'. It is recommended (but not required) to use
##   only letters, numbers, and delimiters '_' or '.', as these are safe characters
##   for column names in R. [This is a message, not a warning or an error]
res <- DESeq(dds)
## estimating size factors
##   Note: levels of factors in the design contain characters other than
##   letters, numbers, '_' and '.'. It is recommended (but not required) to use
##   only letters, numbers, and delimiters '_' or '.', as these are safe characters
##   for column names in R. [This is a message, not a warning or an error]
## estimating dispersions
## gene-wise dispersion estimates
## mean-dispersion relationship
##   Note: levels of factors in the design contain characters other than
##   letters, numbers, '_' and '.'. It is recommended (but not required) to use
##   only letters, numbers, and delimiters '_' or '.', as these are safe characters
##   for column names in R. [This is a message, not a warning or an error]
## final dispersion estimates
## fitting model and testing
## 8 rows did not converge in beta, labelled in mcols(object)$betaConv. Use larger maxit argument with nbinomWaldTest
z <- results(res)
vsd <- vst(dds, blind=FALSE)
##   Note: levels of factors in the design contain characters other than
##   letters, numbers, '_' and '.'. It is recommended (but not required) to use
##   only letters, numbers, and delimiters '_' or '.', as these are safe characters
##   for column names in R. [This is a message, not a warning or an error]
zz <- cbind(as.data.frame(z),assay(vsd))
dge <- as.data.frame(zz[order(zz$pvalue),])
head(dge[order(dge$pvalue),1:6],10)
##                              baseMean log2FoldChange      lfcSE      stat
## ENSG00000007968.7 E2F2      870.17416      0.3472345 0.04014196  8.650163
## ENSG00000165092.13 ALDH1A1  410.41112     -0.4939869 0.05929827 -8.330545
## ENSG00000137869.15 CYP19A1   81.93527      0.7605312 0.09261922  8.211375
## ENSG00000132170.24 PPARG    168.63657      0.4271253 0.05248875  8.137464
## ENSG00000163710.9 PCOLCE2    18.25602      0.7905130 0.09924533  7.965241
## ENSG00000108950.12 FAM20A  1751.41363      0.4989988 0.06457599  7.727313
## ENSG00000135424.18 ITGA7    436.10324      0.4381670 0.05874193  7.459186
## ENSG00000116016.14 EPAS1    154.17271      0.2817621 0.03934888  7.160613
## ENSG00000104918.8 RETN     1801.19251      0.5040455 0.07279215  6.924449
## ENSG00000169994.19 MYO7B    618.31752      0.3134418 0.04566559  6.863851
##                                  pvalue         padj
## ENSG00000007968.7 E2F2     5.142606e-18 1.096044e-13
## ENSG00000165092.13 ALDH1A1 8.047109e-17 8.575401e-13
## ENSG00000137869.15 CYP19A1 2.186696e-16 1.553502e-12
## ENSG00000132170.24 PPARG   4.036438e-16 2.150715e-12
## ENSG00000163710.9 PCOLCE2  1.649018e-15 7.029105e-12
## ENSG00000108950.12 FAM20A  1.098407e-14 3.901725e-11
## ENSG00000135424.18 ITGA7   8.705862e-14 2.650686e-10
## ENSG00000116016.14 EPAS1   8.031714e-13 2.139749e-09
## ENSG00000104918.8 RETN     4.376743e-12 1.036461e-08
## ENSG00000169994.19 MYO7B   6.702845e-12 1.428577e-08
mean(abs(dge$stat))
## [1] 1.110861
crp_pod1_adj <- dge

Treatment group differences not stratified

Treatment A vs B at t0

mx <- xt0f
ss2 <- as.data.frame(cbind(ss_t0,sscell_t0))
mx <- mx[,colnames(mx) %in% rownames(ss2)]

# base model
dds <- DESeqDataSetFromMatrix(countData = mx , colData = ss2,
  design = ~ treatment_group )
## converting counts to integer mode
##   the design formula contains one or more numeric variables with integer values,
##   specifying a model with increasing fold change for higher values.
##   did you mean for this to be a factor? if so, first convert
##   this variable to a factor using the factor() function
res <- DESeq(dds)
## estimating size factors
## estimating dispersions
## gene-wise dispersion estimates
## mean-dispersion relationship
## final dispersion estimates
## fitting model and testing
## -- replacing outliers and refitting for 364 genes
## -- DESeq argument 'minReplicatesForReplace' = 7 
## -- original counts are preserved in counts(dds)
## estimating dispersions
## fitting model and testing
z <- results(res)
vsd <- vst(dds, blind=FALSE)
zz <- cbind(as.data.frame(z),assay(vsd))
dge <- as.data.frame(zz[order(zz$pvalue),])
head(dge[order(dge$pvalue),1:6],10)
##                                 baseMean log2FoldChange     lfcSE      stat
## ENSG00000179593.16 ALOX15B     250.75091     -2.4535079 0.3356004 -7.310802
## ENSG00000279359.1 RP11-36D19.9  24.97417     -2.8528835 0.4030002 -7.079112
## ENSG00000141744.4 PNMT          35.64128     -1.7581232 0.2682321 -6.554486
## ENSG00000276085.1 CCL3L1       308.64747     -1.7142384 0.3110313 -5.511466
## ENSG00000057294.16 PKP2         92.33310     -1.2052440 0.2230360 -5.403810
## ENSG00000079215.15 SLC1A3      219.79787     -1.7005517 0.3337533 -5.095236
## ENSG00000164056.11 SPRY1        69.48429     -1.1641127 0.2336978 -4.981274
## ENSG00000233916.1 ZDHHC20P1     21.16714     -1.2626226 0.2544397 -4.962364
## ENSG00000277632.2 CCL3         559.74862     -1.3892331 0.2870354 -4.839937
## ENSG00000122644.13 ARL4A       383.47521     -0.6984909 0.1479189 -4.722121
##                                      pvalue         padj
## ENSG00000179593.16 ALOX15B     2.655536e-13 5.824918e-09
## ENSG00000279359.1 RP11-36D19.9 1.450807e-12 1.591172e-08
## ENSG00000141744.4 PNMT         5.583392e-11 4.082390e-07
## ENSG00000276085.1 CCL3L1       3.558581e-08 1.951437e-04
## ENSG00000057294.16 PKP2        6.523988e-08 2.862073e-04
## ENSG00000079215.15 SLC1A3      3.483078e-07 1.273355e-03
## ENSG00000164056.11 SPRY1       6.316694e-07 1.909446e-03
## ENSG00000233916.1 ZDHHC20P1    6.964017e-07 1.909446e-03
## ENSG00000277632.2 CCL3         1.298804e-06 3.165474e-03
## ENSG00000122644.13 ARL4A       2.333975e-06 5.119575e-03
mean(abs(dge$stat))
## [1] 0.733293
# model with clinical covariates
dds <- DESeqDataSetFromMatrix(countData = mx , colData = ss2,
  design = ~ sexD + wound_typeOP + duration_sx + ethnicityCAT + ageCS + treatment_group )
## converting counts to integer mode
## Warning in DESeqDataSet(se, design = design, ignoreRank): some variables in
## design formula are characters, converting to factors
##   the design formula contains one or more numeric variables with integer values,
##   specifying a model with increasing fold change for higher values.
##   did you mean for this to be a factor? if so, first convert
##   this variable to a factor using the factor() function
##   Note: levels of factors in the design contain characters other than
##   letters, numbers, '_' and '.'. It is recommended (but not required) to use
##   only letters, numbers, and delimiters '_' or '.', as these are safe characters
##   for column names in R. [This is a message, not a warning or an error]
res <- DESeq(dds)
## estimating size factors
##   Note: levels of factors in the design contain characters other than
##   letters, numbers, '_' and '.'. It is recommended (but not required) to use
##   only letters, numbers, and delimiters '_' or '.', as these are safe characters
##   for column names in R. [This is a message, not a warning or an error]
## estimating dispersions
## gene-wise dispersion estimates
## mean-dispersion relationship
##   Note: levels of factors in the design contain characters other than
##   letters, numbers, '_' and '.'. It is recommended (but not required) to use
##   only letters, numbers, and delimiters '_' or '.', as these are safe characters
##   for column names in R. [This is a message, not a warning or an error]
## final dispersion estimates
## fitting model and testing
## 12 rows did not converge in beta, labelled in mcols(object)$betaConv. Use larger maxit argument with nbinomWaldTest
z <- results(res)
vsd <- vst(dds, blind=FALSE)
##   Note: levels of factors in the design contain characters other than
##   letters, numbers, '_' and '.'. It is recommended (but not required) to use
##   only letters, numbers, and delimiters '_' or '.', as these are safe characters
##   for column names in R. [This is a message, not a warning or an error]
zz <- cbind(as.data.frame(z),assay(vsd))
dge <- as.data.frame(zz[order(zz$pvalue),])
head(dge[order(dge$pvalue),1:6],10)
##                               baseMean log2FoldChange      lfcSE      stat
## ENSG00000123838.11 C4BPA      33.66576      2.4906731 0.51109471  4.873212
## ENSG00000131845.15 ZNF304    418.79903      0.2874110 0.06121095  4.695418
## ENSG00000277632.2 CCL3       559.74862     -1.2496211 0.26775579 -4.667018
## ENSG00000179593.16 ALOX15B   250.75091     -1.0955858 0.23730414 -4.616800
## ENSG00000122644.13 ARL4A     383.47521     -0.6835449 0.15051405 -4.541403
## ENSG00000229807.13 XIST    10626.92285     -1.8128259 0.41367719 -4.382223
## ENSG00000162599.17 NFIA      232.38832     -0.3571616 0.08172420 -4.370328
## ENSG00000276085.1 CCL3L1     308.64747     -1.2489298 0.29873614 -4.180712
## ENSG00000079215.15 SLC1A3    219.79787     -0.9048776 0.21710493 -4.167927
## ENSG00000115306.16 SPTBN1   3986.49830      0.2464913 0.06133022  4.019084
##                                  pvalue       padj
## ENSG00000123838.11 C4BPA   1.097980e-06 0.01722679
## ENSG00000131845.15 ZNF304  2.660615e-06 0.01722679
## ENSG00000277632.2 CCL3     3.056028e-06 0.01722679
## ENSG00000179593.16 ALOX15B 3.897024e-06 0.01722679
## ENSG00000122644.13 ARL4A   5.588117e-06 0.01976182
## ENSG00000229807.13 XIST    1.174742e-05 0.03133750
## ENSG00000162599.17 NFIA    1.240598e-05 0.03133750
## ENSG00000276085.1 CCL3L1   2.905975e-05 0.06039029
## ENSG00000079215.15 SLC1A3  3.073818e-05 0.06039029
## ENSG00000115306.16 SPTBN1  5.842491e-05 0.09853338
mean(abs(dge$stat))
## [1] 0.8180536
avb_t0 <- dge

# model with clinical and cell covariates
# Monocytes.C NK T.CD8.Memory T.CD4.Naive Neutrophils.LD
dds <- DESeqDataSetFromMatrix(countData = mx , colData = ss2,
  design = ~ sexD + wound_typeOP + duration_sx + ethnicityCAT + ageCS +
    Monocytes.C + NK + T.CD8.Memory + T.CD4.Naive + Neutrophils.LD + treatment_group )
## converting counts to integer mode
## Warning in DESeqDataSet(se, design = design, ignoreRank): some variables in
## design formula are characters, converting to factors
##   the design formula contains one or more numeric variables with integer values,
##   specifying a model with increasing fold change for higher values.
##   did you mean for this to be a factor? if so, first convert
##   this variable to a factor using the factor() function
##   the design formula contains one or more numeric variables that have mean or
##   standard deviation larger than 5 (an arbitrary threshold to trigger this message).
##   Including numeric variables with large mean can induce collinearity with the intercept.
##   Users should center and scale numeric variables in the design to improve GLM convergence.
##   Note: levels of factors in the design contain characters other than
##   letters, numbers, '_' and '.'. It is recommended (but not required) to use
##   only letters, numbers, and delimiters '_' or '.', as these are safe characters
##   for column names in R. [This is a message, not a warning or an error]
res <- DESeq(dds)
## estimating size factors
##   Note: levels of factors in the design contain characters other than
##   letters, numbers, '_' and '.'. It is recommended (but not required) to use
##   only letters, numbers, and delimiters '_' or '.', as these are safe characters
##   for column names in R. [This is a message, not a warning or an error]
## estimating dispersions
## gene-wise dispersion estimates
## mean-dispersion relationship
##   Note: levels of factors in the design contain characters other than
##   letters, numbers, '_' and '.'. It is recommended (but not required) to use
##   only letters, numbers, and delimiters '_' or '.', as these are safe characters
##   for column names in R. [This is a message, not a warning or an error]
## final dispersion estimates
## fitting model and testing
## 19 rows did not converge in beta, labelled in mcols(object)$betaConv. Use larger maxit argument with nbinomWaldTest
z <- results(res)
vsd <- vst(dds, blind=FALSE)
##   Note: levels of factors in the design contain characters other than
##   letters, numbers, '_' and '.'. It is recommended (but not required) to use
##   only letters, numbers, and delimiters '_' or '.', as these are safe characters
##   for column names in R. [This is a message, not a warning or an error]
zz <- cbind(as.data.frame(z),assay(vsd))
dge <- as.data.frame(zz[order(zz$pvalue),])
head(dge[order(dge$pvalue),1:6],10)
##                               baseMean log2FoldChange      lfcSE      stat
## ENSG00000169429.11 CXCL8    1371.70225     -2.0614320 0.36621890 -5.628961
## ENSG00000131845.15 ZNF304    418.79903      0.2742914 0.05932004  4.623924
## ENSG00000234665.9 LERFS       41.30684     -1.7954846 0.40114817 -4.475864
## ENSG00000122644.13 ARL4A     383.47521     -0.6387885 0.14587971 -4.378872
## ENSG00000104361.10 NIPAL2    763.75731     -0.3251850 0.07817291 -4.159817
## ENSG00000276085.1 CCL3L1     308.64747     -1.2043196 0.29535827 -4.077488
## ENSG00000162599.17 NFIA      232.38832     -0.3313865 0.08168434 -4.056915
## ENSG00000256128.6 LINC00944  120.56609     -0.4234680 0.10605135 -3.993047
## ENSG00000166394.15 CYB5R2     33.12472     -0.5263833 0.13248031 -3.973294
## ENSG00000115306.16 SPTBN1   3986.49830      0.1888577 0.04792220  3.940922
##                                   pvalue         padj
## ENSG00000169429.11 CXCL8    1.812982e-08 0.0003976776
## ENSG00000131845.15 ZNF304   3.765473e-06 0.0412978268
## ENSG00000234665.9 LERFS     7.610294e-06 0.0556439312
## ENSG00000122644.13 ARL4A    1.192954e-05 0.0654186306
## ENSG00000104361.10 NIPAL2   3.185028e-05 0.1397271679
## ENSG00000276085.1 CCL3L1    4.552497e-05 0.1558172013
## ENSG00000162599.17 NFIA     4.972512e-05 0.1558172013
## ENSG00000256128.6 LINC00944 6.522973e-05 0.1618763170
## ENSG00000166394.15 CYB5R2   7.088532e-05 0.1618763170
## ENSG00000115306.16 SPTBN1   8.116910e-05 0.1618763170
mean(abs(dge$stat))
## [1] 0.8368784
avb_t0_adj <- dge

Treatment A vs B at EOS

mx <- xeosf
ss2 <- as.data.frame(cbind(ss_eos,sscell_eos))
mx <- mx[,colnames(mx) %in% rownames(ss2)]

# base model
dds <- DESeqDataSetFromMatrix(countData = mx , colData = ss2,
  design = ~ treatment_group )
## converting counts to integer mode
##   the design formula contains one or more numeric variables with integer values,
##   specifying a model with increasing fold change for higher values.
##   did you mean for this to be a factor? if so, first convert
##   this variable to a factor using the factor() function
res <- DESeq(dds)
## estimating size factors
## estimating dispersions
## gene-wise dispersion estimates
## mean-dispersion relationship
## final dispersion estimates
## fitting model and testing
## -- replacing outliers and refitting for 129 genes
## -- DESeq argument 'minReplicatesForReplace' = 7 
## -- original counts are preserved in counts(dds)
## estimating dispersions
## fitting model and testing
z <- results(res)
vsd <- vst(dds, blind=FALSE)
zz <- cbind(as.data.frame(z),assay(vsd))
dge <- as.data.frame(zz[order(zz$pvalue),])
head(dge[order(dge$pvalue),1:6],10)
##                                   baseMean log2FoldChange      lfcSE      stat
## ENSG00000164056.11 SPRY1         165.16703     -2.6495876 0.15023175 -17.63667
## ENSG00000141744.4 PNMT            87.09740     -3.6453219 0.21308129 -17.10766
## ENSG00000048740.18 CELF2       14860.56325     -0.8538206 0.06266085 -13.62606
## ENSG00000279359.1 RP11-36D19.9   103.42684     -3.9721070 0.31107434 -12.76900
## ENSG00000179593.16 ALOX15B       847.15559     -3.1265685 0.24545606 -12.73779
## ENSG00000057294.16 PKP2          172.03315     -2.2928606 0.18394552 -12.46489
## ENSG00000064300.9 NGFR            61.81062     -2.2893270 0.18445275 -12.41145
## ENSG00000196935.9 SRGAP1         329.84060     -1.7220092 0.14799455 -11.63563
## ENSG00000272870.3 SAP30-DT       136.77299     -0.7521312 0.06569743 -11.44841
## ENSG00000145990.11 GFOD1        1933.33604     -1.2571490 0.11028762 -11.39882
##                                      pvalue         padj
## ENSG00000164056.11 SPRY1       1.288377e-69 2.843061e-65
## ENSG00000141744.4 PNMT         1.301255e-65 1.435740e-61
## ENSG00000048740.18 CELF2       2.802994e-42 2.061789e-38
## ENSG00000279359.1 RP11-36D19.9 2.442852e-37 1.347661e-33
## ENSG00000179593.16 ALOX15B     3.645637e-37 1.608966e-33
## ENSG00000057294.16 PKP2        1.160326e-35 4.267485e-32
## ENSG00000064300.9 NGFR         2.265006e-35 7.140270e-32
## ENSG00000196935.9 SRGAP1       2.715924e-31 7.491537e-28
## ENSG00000272870.3 SAP30-DT     2.394942e-30 5.872132e-27
## ENSG00000145990.11 GFOD1       4.238097e-30 9.352208e-27
mean(abs(dge$stat))
## [1] 1.492199
# model with clinical covariates
dds <- DESeqDataSetFromMatrix(countData = mx , colData = ss2,
  design = ~ sexD + wound_typeOP + duration_sx + ethnicityCAT + ageCS + treatment_group )
## converting counts to integer mode
## Warning in DESeqDataSet(se, design = design, ignoreRank): some variables in
## design formula are characters, converting to factors
##   the design formula contains one or more numeric variables with integer values,
##   specifying a model with increasing fold change for higher values.
##   did you mean for this to be a factor? if so, first convert
##   this variable to a factor using the factor() function
##   Note: levels of factors in the design contain characters other than
##   letters, numbers, '_' and '.'. It is recommended (but not required) to use
##   only letters, numbers, and delimiters '_' or '.', as these are safe characters
##   for column names in R. [This is a message, not a warning or an error]
res <- DESeq(dds)
## estimating size factors
##   Note: levels of factors in the design contain characters other than
##   letters, numbers, '_' and '.'. It is recommended (but not required) to use
##   only letters, numbers, and delimiters '_' or '.', as these are safe characters
##   for column names in R. [This is a message, not a warning or an error]
## estimating dispersions
## gene-wise dispersion estimates
## mean-dispersion relationship
##   Note: levels of factors in the design contain characters other than
##   letters, numbers, '_' and '.'. It is recommended (but not required) to use
##   only letters, numbers, and delimiters '_' or '.', as these are safe characters
##   for column names in R. [This is a message, not a warning or an error]
## final dispersion estimates
## fitting model and testing
## 9 rows did not converge in beta, labelled in mcols(object)$betaConv. Use larger maxit argument with nbinomWaldTest
z <- results(res)
vsd <- vst(dds, blind=FALSE)
##   Note: levels of factors in the design contain characters other than
##   letters, numbers, '_' and '.'. It is recommended (but not required) to use
##   only letters, numbers, and delimiters '_' or '.', as these are safe characters
##   for column names in R. [This is a message, not a warning or an error]
zz <- cbind(as.data.frame(z),assay(vsd))
dge <- as.data.frame(zz[order(zz$pvalue),])
head(dge[order(dge$pvalue),1:6],10)
##                                   baseMean log2FoldChange      lfcSE      stat
## ENSG00000164056.11 SPRY1         165.16703     -2.7059237 0.15638312 -17.30317
## ENSG00000141744.4 PNMT            87.09740     -3.5010599 0.21937506 -15.95924
## ENSG00000279359.1 RP11-36D19.9   103.42684     -4.2902517 0.32298993 -13.28293
## ENSG00000179593.16 ALOX15B       847.15559     -3.2375724 0.25327794 -12.78269
## ENSG00000196935.9 SRGAP1         329.84060     -1.8289813 0.14310723 -12.78050
## ENSG00000048740.18 CELF2       14860.56325     -0.8384829 0.06660418 -12.58904
## ENSG00000057294.16 PKP2          172.03315     -2.2412930 0.18649597 -12.01792
## ENSG00000064300.9 NGFR            61.81062     -2.3210963 0.19383753 -11.97444
## ENSG00000272870.3 SAP30-DT       136.77299     -0.7544104 0.06880368 -10.96468
## ENSG00000145990.11 GFOD1        1933.33604     -1.2370843 0.11592467 -10.67145
##                                      pvalue         padj
## ENSG00000164056.11 SPRY1       4.452072e-67 9.824386e-63
## ENSG00000141744.4 PNMT         2.456924e-57 2.710847e-53
## ENSG00000279359.1 RP11-36D19.9 2.908007e-40 2.139033e-36
## ENSG00000179593.16 ALOX15B     2.048692e-37 9.300053e-34
## ENSG00000196935.9 SRGAP1       2.107231e-37 9.300053e-34
## ENSG00000048740.18 CELF2       2.425963e-36 8.922286e-33
## ENSG00000057294.16 PKP2        2.860952e-33 9.018946e-30
## ENSG00000064300.9 NGFR         4.836794e-33 1.334169e-29
## ENSG00000272870.3 SAP30-DT     5.649914e-28 1.385296e-24
## ENSG00000145990.11 GFOD1       1.384500e-26 3.055175e-23
mean(abs(dge$stat))
## [1] 1.414203
avb_eos <- dge

# model with clinical and cell covariates
# Monocytes.C NK T.CD8.Memory T.CD4.Naive Neutrophils.LD
dds <- DESeqDataSetFromMatrix(countData = mx , colData = ss2,
  design = ~ sexD + wound_typeOP + duration_sx + ethnicityCAT + ageCS +
    Monocytes.C + NK + T.CD8.Memory + T.CD4.Naive + Neutrophils.LD + treatment_group )
## converting counts to integer mode
## Warning in DESeqDataSet(se, design = design, ignoreRank): some variables in
## design formula are characters, converting to factors
##   the design formula contains one or more numeric variables with integer values,
##   specifying a model with increasing fold change for higher values.
##   did you mean for this to be a factor? if so, first convert
##   this variable to a factor using the factor() function
##   the design formula contains one or more numeric variables that have mean or
##   standard deviation larger than 5 (an arbitrary threshold to trigger this message).
##   Including numeric variables with large mean can induce collinearity with the intercept.
##   Users should center and scale numeric variables in the design to improve GLM convergence.
##   Note: levels of factors in the design contain characters other than
##   letters, numbers, '_' and '.'. It is recommended (but not required) to use
##   only letters, numbers, and delimiters '_' or '.', as these are safe characters
##   for column names in R. [This is a message, not a warning or an error]
res <- DESeq(dds)
## estimating size factors
##   Note: levels of factors in the design contain characters other than
##   letters, numbers, '_' and '.'. It is recommended (but not required) to use
##   only letters, numbers, and delimiters '_' or '.', as these are safe characters
##   for column names in R. [This is a message, not a warning or an error]
## estimating dispersions
## gene-wise dispersion estimates
## mean-dispersion relationship
##   Note: levels of factors in the design contain characters other than
##   letters, numbers, '_' and '.'. It is recommended (but not required) to use
##   only letters, numbers, and delimiters '_' or '.', as these are safe characters
##   for column names in R. [This is a message, not a warning or an error]
## final dispersion estimates
## fitting model and testing
## 12 rows did not converge in beta, labelled in mcols(object)$betaConv. Use larger maxit argument with nbinomWaldTest
z <- results(res)
vsd <- vst(dds, blind=FALSE)
##   Note: levels of factors in the design contain characters other than
##   letters, numbers, '_' and '.'. It is recommended (but not required) to use
##   only letters, numbers, and delimiters '_' or '.', as these are safe characters
##   for column names in R. [This is a message, not a warning or an error]
zz <- cbind(as.data.frame(z),assay(vsd))
dge <- as.data.frame(zz[order(zz$pvalue),])
head(dge[order(dge$pvalue),1:6],10)
##                                  baseMean log2FoldChange      lfcSE      stat
## ENSG00000164056.11 SPRY1         165.1670     -2.7923982 0.17387073 -16.06020
## ENSG00000179593.16 ALOX15B       847.1556     -3.8150687 0.26013490 -14.66573
## ENSG00000198585.12 NUDT16       5301.4426     -1.3105279 0.09401215 -13.93998
## ENSG00000135678.12 CPM           575.4329     -1.7177297 0.12683010 -13.54355
## ENSG00000111666.11 CHPT1        1197.7668     -1.0307176 0.07716078 -13.35805
## ENSG00000279359.1 RP11-36D19.9   103.4268     -4.1756341 0.32422360 -12.87887
## ENSG00000141744.4 PNMT            87.0974     -3.0318991 0.23852957 -12.71079
## ENSG00000177575.13 CD163       25120.8560     -2.0894785 0.16631212 -12.56360
## ENSG00000171105.14 INSR         1211.6882     -1.3065370 0.10720954 -12.18676
## ENSG00000136478.8 TEX2           944.3836     -0.9718897 0.08209004 -11.83931
##                                      pvalue         padj
## ENSG00000164056.11 SPRY1       4.850104e-58 1.070273e-53
## ENSG00000179593.16 ALOX15B     1.068588e-48 1.179026e-44
## ENSG00000198585.12 NUDT16      3.620213e-44 2.662908e-40
## ENSG00000135678.12 CPM         8.650568e-42 4.772302e-38
## ENSG00000111666.11 CHPT1       1.063116e-40 4.691957e-37
## ENSG00000279359.1 RP11-36D19.9 5.919469e-38 2.177082e-34
## ENSG00000141744.4 PNMT         5.151169e-37 1.623869e-33
## ENSG00000177575.13 CD163       3.347600e-36 9.233935e-33
## ENSG00000171105.14 INSR        3.656660e-34 8.965724e-31
## ENSG00000136478.8 TEX2         2.444439e-32 5.394144e-29
mean(abs(dge$stat))
## [1] 1.213916
avb_eos_adj <- dge

Treatment A vs B at POD1

mx <- xpod1f
ss2 <- as.data.frame(cbind(ss_pod1,sscell_pod1))
mx <- mx[,colnames(mx) %in% rownames(ss2)]

# base model
dds <- DESeqDataSetFromMatrix(countData = mx , colData = ss2,
  design = ~ treatment_group )
## converting counts to integer mode
##   the design formula contains one or more numeric variables with integer values,
##   specifying a model with increasing fold change for higher values.
##   did you mean for this to be a factor? if so, first convert
##   this variable to a factor using the factor() function
res <- DESeq(dds)
## estimating size factors
## estimating dispersions
## gene-wise dispersion estimates
## mean-dispersion relationship
## final dispersion estimates
## fitting model and testing
## -- replacing outliers and refitting for 253 genes
## -- DESeq argument 'minReplicatesForReplace' = 7 
## -- original counts are preserved in counts(dds)
## estimating dispersions
## fitting model and testing
z <- results(res)
vsd <- vst(dds, blind=FALSE)
zz <- cbind(as.data.frame(z),assay(vsd))
dge <- as.data.frame(zz[order(zz$pvalue),])
head(dge[order(dge$pvalue),1:6],10)
##                                  baseMean log2FoldChange      lfcSE      stat
## ENSG00000186081.12 KRT5          14.54120      2.1890736 0.27368008  7.998659
## ENSG00000115414.21 FN1          184.93708     -1.5590144 0.21045312 -7.407894
## ENSG00000155659.15 VSIG4       1506.08672     -2.0082041 0.28041210 -7.161617
## ENSG00000149534.9 MS4A2          83.83329      1.4807287 0.21267882  6.962276
## ENSG00000154269.15 ENPP3         37.09384      1.2813396 0.18714544  6.846758
## ENSG00000131016.17 AKAP12       103.10713      1.4235129 0.21406789  6.649820
## ENSG00000259162.1 RP11-203M5.6   24.74288      1.3334574 0.20408383  6.533871
## ENSG00000140287.11 HDC          496.98643      1.4313408 0.22105777  6.474963
## ENSG00000179348.12 GATA2        687.51559      1.2570611 0.19461993  6.459056
## ENSG00000163050.18 COQ8A       2009.95700     -0.3111471 0.04862536 -6.398865
##                                      pvalue         padj
## ENSG00000186081.12 KRT5        1.257816e-15 2.680784e-11
## ENSG00000115414.21 FN1         1.283207e-13 1.367449e-09
## ENSG00000155659.15 VSIG4       7.973092e-13 5.664350e-09
## ENSG00000149534.9 MS4A2        3.348181e-12 1.783995e-08
## ENSG00000154269.15 ENPP3       7.554214e-12 3.220059e-08
## ENSG00000131016.17 AKAP12      2.934514e-11 1.042388e-07
## ENSG00000259162.1 RP11-203M5.6 6.409120e-11 1.951394e-07
## ENSG00000140287.11 HDC         9.483534e-11 2.494996e-07
## ENSG00000179348.12 GATA2       1.053581e-10 2.494996e-07
## ENSG00000163050.18 COQ8A       1.565362e-10 3.336256e-07
mean(abs(dge$stat))
## [1] 1.083107
# model with clinical covariates
dds <- DESeqDataSetFromMatrix(countData = mx , colData = ss2,
  design = ~ sexD + wound_typeOP + duration_sx + ethnicityCAT + ageCS + treatment_group )
## converting counts to integer mode
## Warning in DESeqDataSet(se, design = design, ignoreRank): some variables in
## design formula are characters, converting to factors
##   the design formula contains one or more numeric variables with integer values,
##   specifying a model with increasing fold change for higher values.
##   did you mean for this to be a factor? if so, first convert
##   this variable to a factor using the factor() function
##   Note: levels of factors in the design contain characters other than
##   letters, numbers, '_' and '.'. It is recommended (but not required) to use
##   only letters, numbers, and delimiters '_' or '.', as these are safe characters
##   for column names in R. [This is a message, not a warning or an error]
res <- DESeq(dds)
## estimating size factors
##   Note: levels of factors in the design contain characters other than
##   letters, numbers, '_' and '.'. It is recommended (but not required) to use
##   only letters, numbers, and delimiters '_' or '.', as these are safe characters
##   for column names in R. [This is a message, not a warning or an error]
## estimating dispersions
## gene-wise dispersion estimates
## mean-dispersion relationship
##   Note: levels of factors in the design contain characters other than
##   letters, numbers, '_' and '.'. It is recommended (but not required) to use
##   only letters, numbers, and delimiters '_' or '.', as these are safe characters
##   for column names in R. [This is a message, not a warning or an error]
## final dispersion estimates
## fitting model and testing
## 21 rows did not converge in beta, labelled in mcols(object)$betaConv. Use larger maxit argument with nbinomWaldTest
z <- results(res)
vsd <- vst(dds, blind=FALSE)
##   Note: levels of factors in the design contain characters other than
##   letters, numbers, '_' and '.'. It is recommended (but not required) to use
##   only letters, numbers, and delimiters '_' or '.', as these are safe characters
##   for column names in R. [This is a message, not a warning or an error]
zz <- cbind(as.data.frame(z),assay(vsd))
dge <- as.data.frame(zz[order(zz$pvalue),])
head(dge[order(dge$pvalue),1:6],10)
##                                  baseMean log2FoldChange     lfcSE      stat
## ENSG00000186081.12 KRT5          14.54120       2.189179 0.2813120  7.782032
## ENSG00000155659.15 VSIG4       1506.08672      -2.046371 0.2808756 -7.285686
## ENSG00000149534.9 MS4A2          83.83329       1.501000 0.2091159  7.177839
## ENSG00000259162.1 RP11-203M5.6   24.74288       1.419827 0.1981389  7.165817
## ENSG00000229961.3 RP11-71G12.1   66.93635       1.279558 0.1908412  6.704834
## ENSG00000154269.15 ENPP3         37.09384       1.266610 0.1901442  6.661315
## ENSG00000131016.17 AKAP12       103.10713       1.405739 0.2170297  6.477170
## ENSG00000179348.12 GATA2        687.51559       1.268771 0.1991819  6.369909
## ENSG00000115414.21 FN1          184.93708      -1.183497 0.1874768 -6.312766
## ENSG00000140287.11 HDC          496.98643       1.423136 0.2259646  6.298047
##                                      pvalue         padj
## ENSG00000186081.12 KRT5        7.136868e-15 1.521081e-10
## ENSG00000155659.15 VSIG4       3.200364e-13 3.410468e-09
## ENSG00000149534.9 MS4A2        7.082214e-13 4.120009e-09
## ENSG00000259162.1 RP11-203M5.6 7.732388e-13 4.120009e-09
## ENSG00000229961.3 RP11-71G12.1 2.016353e-11 8.594904e-08
## ENSG00000154269.15 ENPP3       2.713883e-11 9.640164e-08
## ENSG00000131016.17 AKAP12      9.345891e-11 2.845557e-07
## ENSG00000179348.12 GATA2       1.891400e-10 5.038926e-07
## ENSG00000115414.21 FN1         2.740912e-10 6.424139e-07
## ENSG00000140287.11 HDC         3.014188e-10 6.424139e-07
mean(abs(dge$stat))
## [1] 0.9476276
avb_pod1 <- dge

# model with clinical and cell covariates
# Monocytes.C NK T.CD8.Memory T.CD4.Naive Neutrophils.LD
dds <- DESeqDataSetFromMatrix(countData = mx , colData = ss2,
  design = ~ sexD + wound_typeOP + duration_sx + ethnicityCAT + ageCS +
    Monocytes.C + NK + T.CD8.Memory + T.CD4.Naive + Neutrophils.LD + treatment_group )
## converting counts to integer mode
## Warning in DESeqDataSet(se, design = design, ignoreRank): some variables in
## design formula are characters, converting to factors
##   the design formula contains one or more numeric variables with integer values,
##   specifying a model with increasing fold change for higher values.
##   did you mean for this to be a factor? if so, first convert
##   this variable to a factor using the factor() function
##   the design formula contains one or more numeric variables that have mean or
##   standard deviation larger than 5 (an arbitrary threshold to trigger this message).
##   Including numeric variables with large mean can induce collinearity with the intercept.
##   Users should center and scale numeric variables in the design to improve GLM convergence.
##   Note: levels of factors in the design contain characters other than
##   letters, numbers, '_' and '.'. It is recommended (but not required) to use
##   only letters, numbers, and delimiters '_' or '.', as these are safe characters
##   for column names in R. [This is a message, not a warning or an error]
res <- DESeq(dds)
## estimating size factors
##   Note: levels of factors in the design contain characters other than
##   letters, numbers, '_' and '.'. It is recommended (but not required) to use
##   only letters, numbers, and delimiters '_' or '.', as these are safe characters
##   for column names in R. [This is a message, not a warning or an error]
## estimating dispersions
## gene-wise dispersion estimates
## mean-dispersion relationship
##   Note: levels of factors in the design contain characters other than
##   letters, numbers, '_' and '.'. It is recommended (but not required) to use
##   only letters, numbers, and delimiters '_' or '.', as these are safe characters
##   for column names in R. [This is a message, not a warning or an error]
## final dispersion estimates
## fitting model and testing
## 7 rows did not converge in beta, labelled in mcols(object)$betaConv. Use larger maxit argument with nbinomWaldTest
z <- results(res)
vsd <- vst(dds, blind=FALSE)
##   Note: levels of factors in the design contain characters other than
##   letters, numbers, '_' and '.'. It is recommended (but not required) to use
##   only letters, numbers, and delimiters '_' or '.', as these are safe characters
##   for column names in R. [This is a message, not a warning or an error]
zz <- cbind(as.data.frame(z),assay(vsd))
dge <- as.data.frame(zz[order(zz$pvalue),])
head(dge[order(dge$pvalue),1:6],10)
##                                   baseMean log2FoldChange      lfcSE      stat
## ENSG00000186081.12 KRT5           14.54120      2.2389705 0.28501584  7.855600
## ENSG00000155659.15 VSIG4        1506.08672     -1.8413863 0.23966497 -7.683168
## ENSG00000259162.1 RP11-203M5.6    24.74288      1.4492545 0.19622316  7.385746
## ENSG00000229961.3 RP11-71G12.1    66.93635      1.3530051 0.19043462  7.104828
## ENSG00000149534.9 MS4A2           83.83329      1.4271747 0.20531024  6.951308
## ENSG00000105426.17 PTPRS         203.16124      0.8200685 0.12225141  6.708049
## ENSG00000131016.17 AKAP12        103.10713      1.4256435 0.21310542  6.689851
## ENSG00000154269.15 ENPP3          37.09384      1.1882697 0.18396236  6.459309
## ENSG00000135218.19 CD36        11489.98755      0.4990621 0.07877094  6.335612
## ENSG00000070915.10 SLC12A3        21.89994      1.1148229 0.17749304  6.280938
##                                      pvalue         padj
## ENSG00000186081.12 KRT5        3.978614e-15 8.479620e-11
## ENSG00000155659.15 VSIG4       1.552015e-14 1.653905e-10
## ENSG00000259162.1 RP11-203M5.6 1.516008e-13 1.077022e-09
## ENSG00000229961.3 RP11-71G12.1 1.204729e-12 6.419095e-09
## ENSG00000149534.9 MS4A2        3.619152e-12 1.542700e-08
## ENSG00000105426.17 PTPRS       1.972438e-11 6.801829e-08
## ENSG00000131016.17 AKAP12      2.233979e-11 6.801829e-08
## ENSG00000154269.15 ENPP3       1.051821e-10 2.802183e-07
## ENSG00000135218.19 CD36        2.364016e-10 5.598251e-07
## ENSG00000070915.10 SLC12A3     3.365353e-10 7.172577e-07
mean(abs(dge$stat))
## [1] 1.031527
avb_pod1_adj <- dge

Treatment group differences stratified

Treatment A vs B t0 in CRP low group

mx <- xt0f
ss2 <- as.data.frame(cbind(ss_t0,sscell_t0))
ss2 <- subset(ss2,crp_group==1)
mx <- mx[,colnames(mx) %in% rownames(ss2)]

# base model
dds <- DESeqDataSetFromMatrix(countData = mx , colData = ss2,
  design = ~ treatment_group )
## converting counts to integer mode
##   the design formula contains one or more numeric variables with integer values,
##   specifying a model with increasing fold change for higher values.
##   did you mean for this to be a factor? if so, first convert
##   this variable to a factor using the factor() function
res <- DESeq(dds)
## estimating size factors
## estimating dispersions
## gene-wise dispersion estimates
## mean-dispersion relationship
## final dispersion estimates
## fitting model and testing
## -- replacing outliers and refitting for 480 genes
## -- DESeq argument 'minReplicatesForReplace' = 7 
## -- original counts are preserved in counts(dds)
## estimating dispersions
## fitting model and testing
z <- results(res)
vsd <- vst(dds, blind=FALSE)
zz <- cbind(as.data.frame(z),assay(vsd))
dge <- as.data.frame(zz[order(zz$pvalue),])
head(dge[order(dge$pvalue),1:6],10)
##                                  baseMean log2FoldChange     lfcSE      stat
## ENSG00000279359.1 RP11-36D19.9  39.871182     -3.3255603 0.6426406 -5.174837
## ENSG00000141744.4 PNMT          51.670695     -2.1905424 0.4563927 -4.799687
## ENSG00000204936.10 CD177       229.544285     -2.5908627 0.5761080 -4.497182
## ENSG00000169429.11 CXCL8       901.340924     -2.4617931 0.5620815 -4.379780
## ENSG00000179593.16 ALOX15B     395.592390     -2.3562217 0.5403176 -4.360808
## ENSG00000122644.13 ARL4A       438.849245     -0.9185857 0.2291829 -4.008090
## ENSG00000115155.19 OTOF        120.892044      1.2138657 0.3046429  3.984553
## ENSG00000258471.2 RP11-84C10.4  14.882458      0.8381249 0.2161208  3.878039
## ENSG00000253230.9 MIR124-1HG     8.779545     -3.3333199 0.8661717 -3.848336
## ENSG00000079215.15 SLC1A3      309.537268     -2.0483519 0.5335749 -3.838921
##                                      pvalue        padj
## ENSG00000279359.1 RP11-36D19.9 2.281100e-07 0.005003594
## ENSG00000141744.4 PNMT         1.589136e-06 0.017428844
## ENSG00000204936.10 CD177       6.885989e-06 0.050348057
## ENSG00000169429.11 CXCL8       1.187994e-05 0.056847985
## ENSG00000179593.16 ALOX15B     1.295828e-05 0.056847985
## ENSG00000122644.13 ARL4A       6.121173e-05 0.211852584
## ENSG00000115155.19 OTOF        6.760739e-05 0.211852584
## ENSG00000258471.2 RP11-84C10.4 1.053019e-04 0.257544790
## ENSG00000253230.9 MIR124-1HG   1.189227e-04 0.257544790
## ENSG00000079215.15 SLC1A3      1.235763e-04 0.257544790
mean(abs(dge$stat))
## [1] 0.7426341
# model with clinical covariates
dds <- DESeqDataSetFromMatrix(countData = mx , colData = ss2,
  design = ~ sexD + wound_typeOP + duration_sx + ethnicityCAT + ageCS + treatment_group )
## converting counts to integer mode
## Warning in DESeqDataSet(se, design = design, ignoreRank): some variables in
## design formula are characters, converting to factors
##   the design formula contains one or more numeric variables with integer values,
##   specifying a model with increasing fold change for higher values.
##   did you mean for this to be a factor? if so, first convert
##   this variable to a factor using the factor() function
##   Note: levels of factors in the design contain characters other than
##   letters, numbers, '_' and '.'. It is recommended (but not required) to use
##   only letters, numbers, and delimiters '_' or '.', as these are safe characters
##   for column names in R. [This is a message, not a warning or an error]
res <- DESeq(dds)
## estimating size factors
##   Note: levels of factors in the design contain characters other than
##   letters, numbers, '_' and '.'. It is recommended (but not required) to use
##   only letters, numbers, and delimiters '_' or '.', as these are safe characters
##   for column names in R. [This is a message, not a warning or an error]
## estimating dispersions
## gene-wise dispersion estimates
## mean-dispersion relationship
##   Note: levels of factors in the design contain characters other than
##   letters, numbers, '_' and '.'. It is recommended (but not required) to use
##   only letters, numbers, and delimiters '_' or '.', as these are safe characters
##   for column names in R. [This is a message, not a warning or an error]
## final dispersion estimates
## fitting model and testing
## 17 rows did not converge in beta, labelled in mcols(object)$betaConv. Use larger maxit argument with nbinomWaldTest
z <- results(res)
vsd <- vst(dds, blind=FALSE)
##   Note: levels of factors in the design contain characters other than
##   letters, numbers, '_' and '.'. It is recommended (but not required) to use
##   only letters, numbers, and delimiters '_' or '.', as these are safe characters
##   for column names in R. [This is a message, not a warning or an error]
zz <- cbind(as.data.frame(z),assay(vsd))
dge <- as.data.frame(zz[order(zz$pvalue),])
head(dge[order(dge$pvalue),1:6],10)
##                                  baseMean log2FoldChange     lfcSE      stat
## ENSG00000123838.11 C4BPA         56.27087      4.1719806 0.7549688  5.526031
## ENSG00000115155.19 OTOF         120.89204      1.3340109 0.2995082  4.454005
## ENSG00000258471.2 RP11-84C10.4   14.88246      0.9535482 0.2237348  4.261957
## ENSG00000234665.9 LERFS          57.91435     -2.2458162 0.5334487 -4.209995
## ENSG00000119922.11 IFIT2       1771.40268      1.5450687 0.3900461  3.961246
## ENSG00000126262.5 FFAR2        1188.14797      1.9522596 0.5036095  3.876534
## ENSG00000185745.10 IFIT1        822.12911      1.4987801 0.3868363  3.874456
## ENSG00000215630.6 GUSBP9        203.39614     -0.6165686 0.1653777 -3.728245
## ENSG00000119917.15 IFIT3       1355.72352      1.3841010 0.3721027  3.719675
## ENSG00000287095.1 CTC-215C12.2   51.19664      0.7011972 0.1942702  3.609391
##                                      pvalue         padj
## ENSG00000123838.11 C4BPA       3.275572e-08 0.0007184966
## ENSG00000115155.19 OTOF        8.428321e-06 0.0924376158
## ENSG00000258471.2 RP11-84C10.4 2.026441e-05 0.1400421942
## ENSG00000234665.9 LERFS        2.553767e-05 0.1400421942
## ENSG00000119922.11 IFIT2       7.455966e-05 0.3270932241
## ENSG00000126262.5 FFAR2        1.059549e-04 0.3348632016
## ENSG00000185745.10 IFIT1       1.068631e-04 0.3348632016
## ENSG00000215630.6 GUSBP9       1.928181e-04 0.4861753379
## ENSG00000119917.15 IFIT3       1.994793e-04 0.4861753379
## ENSG00000287095.1 CTC-215C12.2 3.069169e-04 0.5721559718
mean(abs(dge$stat))
## [1] 0.7451909
avb_crplo_t0 <- dge

# model with clinical and cell covariates
# Monocytes.C NK T.CD8.Memory T.CD4.Naive Neutrophils.LD
dds <- DESeqDataSetFromMatrix(countData = mx , colData = ss2,
  design = ~ sexD + wound_typeOP + duration_sx + ethnicityCAT + ageCS +
    Monocytes.C + NK + T.CD8.Memory + T.CD4.Naive + Neutrophils.LD + treatment_group )
## converting counts to integer mode
## Warning in DESeqDataSet(se, design = design, ignoreRank): some variables in
## design formula are characters, converting to factors
##   the design formula contains one or more numeric variables with integer values,
##   specifying a model with increasing fold change for higher values.
##   did you mean for this to be a factor? if so, first convert
##   this variable to a factor using the factor() function
##   the design formula contains one or more numeric variables that have mean or
##   standard deviation larger than 5 (an arbitrary threshold to trigger this message).
##   Including numeric variables with large mean can induce collinearity with the intercept.
##   Users should center and scale numeric variables in the design to improve GLM convergence.
##   Note: levels of factors in the design contain characters other than
##   letters, numbers, '_' and '.'. It is recommended (but not required) to use
##   only letters, numbers, and delimiters '_' or '.', as these are safe characters
##   for column names in R. [This is a message, not a warning or an error]
res <- DESeq(dds)
## estimating size factors
##   Note: levels of factors in the design contain characters other than
##   letters, numbers, '_' and '.'. It is recommended (but not required) to use
##   only letters, numbers, and delimiters '_' or '.', as these are safe characters
##   for column names in R. [This is a message, not a warning or an error]
## estimating dispersions
## gene-wise dispersion estimates
## mean-dispersion relationship
##   Note: levels of factors in the design contain characters other than
##   letters, numbers, '_' and '.'. It is recommended (but not required) to use
##   only letters, numbers, and delimiters '_' or '.', as these are safe characters
##   for column names in R. [This is a message, not a warning or an error]
## final dispersion estimates
## fitting model and testing
## 34 rows did not converge in beta, labelled in mcols(object)$betaConv. Use larger maxit argument with nbinomWaldTest
z <- results(res)
vsd <- vst(dds, blind=FALSE)
##   Note: levels of factors in the design contain characters other than
##   letters, numbers, '_' and '.'. It is recommended (but not required) to use
##   only letters, numbers, and delimiters '_' or '.', as these are safe characters
##   for column names in R. [This is a message, not a warning or an error]
zz <- cbind(as.data.frame(z),assay(vsd))
dge <- as.data.frame(zz[order(zz$pvalue),])
head(dge[order(dge$pvalue),1:6],10)
##                                  baseMean log2FoldChange      lfcSE      stat
## ENSG00000074803.20 SLC12A1       84.81635     -2.4341141 0.56632833 -4.298062
## ENSG00000198794.12 SCAMP5       140.06582      0.6687557 0.16129243  4.146231
## ENSG00000258471.2 RP11-84C10.4   14.88246      0.9213004 0.22556852  4.084348
## ENSG00000146426.19 TIAM2        156.83010      0.2658418 0.06670186  3.985523
## ENSG00000165029.17 ABCA1        721.16202      0.4761514 0.12104587  3.933644
## ENSG00000177191.2 B3GNT8        337.40623     -0.4161721 0.10764360 -3.866204
## ENSG00000215630.6 GUSBP9        203.39614     -0.5856877 0.15250841 -3.840363
## ENSG00000125384.7 PTGER2       3444.28853     -0.3095152 0.08088605 -3.826559
## ENSG00000115155.19 OTOF         120.89204      1.1760123 0.31810878  3.696887
## ENSG00000234665.9 LERFS          57.91435     -1.9741234 0.53705027 -3.675863
##                                      pvalue      padj
## ENSG00000074803.20 SLC12A1     1.722982e-05 0.3231808
## ENSG00000198794.12 SCAMP5      3.379930e-05 0.3231808
## ENSG00000258471.2 RP11-84C10.4 4.420071e-05 0.3231808
## ENSG00000146426.19 TIAM2       6.733154e-05 0.3562985
## ENSG00000165029.17 ABCA1       8.366765e-05 0.3562985
## ENSG00000177191.2 B3GNT8       1.105425e-04 0.3562985
## ENSG00000215630.6 GUSBP9       1.228525e-04 0.3562985
## ENSG00000125384.7 PTGER2       1.299470e-04 0.3562985
## ENSG00000115155.19 OTOF        2.182591e-04 0.5031082
## ENSG00000234665.9 LERFS        2.370464e-04 0.5031082
mean(abs(dge$stat))
## [1] 0.7355216
avb_crplo_t0_adj <- dge

Treatment A vs B t0 in CRP high group

mx <- xt0f
ss2 <- as.data.frame(cbind(ss_t0,sscell_t0))
ss2 <- subset(ss2,crp_group==4)
mx <- mx[,colnames(mx) %in% rownames(ss2)]

# base model
dds <- DESeqDataSetFromMatrix(countData = mx , colData = ss2,
  design = ~ treatment_group )
## converting counts to integer mode
##   the design formula contains one or more numeric variables with integer values,
##   specifying a model with increasing fold change for higher values.
##   did you mean for this to be a factor? if so, first convert
##   this variable to a factor using the factor() function
res <- DESeq(dds)
## estimating size factors
## estimating dispersions
## gene-wise dispersion estimates
## mean-dispersion relationship
## final dispersion estimates
## fitting model and testing
## -- replacing outliers and refitting for 280 genes
## -- DESeq argument 'minReplicatesForReplace' = 7 
## -- original counts are preserved in counts(dds)
## estimating dispersions
## fitting model and testing
z <- results(res)
vsd <- vst(dds, blind=FALSE)
zz <- cbind(as.data.frame(z),assay(vsd))
dge <- as.data.frame(zz[order(zz$pvalue),])
head(dge[order(dge$pvalue),1:6],10)
##                                 baseMean log2FoldChange     lfcSE      stat
## ENSG00000211652.2 IGLV7-43      57.72448      2.1239087 0.4170212  5.093048
## ENSG00000276085.1 CCL3L1       255.05022     -2.1290046 0.4413594 -4.823744
## ENSG00000263711.6 LINC02864     15.37815     -1.0912344 0.2360114 -4.623651
## ENSG00000211655.3 IGLV1-36      15.01384      1.7966484 0.3932588  4.568616
## ENSG00000278920.1 RP3-412A9.17 103.00331     -0.4584785 0.1045193 -4.386546
## ENSG00000211644.3 IGLV1-51     213.01635      1.6268219 0.3714944  4.379130
## ENSG00000211640.4 IGLV6-57      85.08443      1.7610091 0.4123498  4.270669
## ENSG00000211673.2 IGLV3-1      232.41139      1.6806179 0.3957575  4.246585
## ENSG00000211659.2 IGLV3-25     147.02115      1.3601124 0.3264996  4.165740
## ENSG00000203999.9 LINC01270    100.96329     -0.9138279 0.2252296 -4.057317
##                                      pvalue        padj
## ENSG00000211652.2 IGLV7-43     3.523525e-07 0.007728851
## ENSG00000276085.1 CCL3L1       1.408886e-06 0.015451954
## ENSG00000263711.6 LINC02864    3.770448e-06 0.026922780
## ENSG00000211655.3 IGLV1-36     4.909556e-06 0.026922780
## ENSG00000278920.1 RP3-412A9.17 1.151649e-05 0.043560797
## ENSG00000211644.3 IGLV1-51     1.191542e-05 0.043560797
## ENSG00000211640.4 IGLV6-57     1.948878e-05 0.059513437
## ENSG00000211673.2 IGLV3-1      2.170538e-05 0.059513437
## ENSG00000211659.2 IGLV3-25     3.103448e-05 0.075637926
## ENSG00000203999.9 LINC01270    4.963970e-05 0.108884692
mean(abs(dge$stat))
## [1] 0.9391897
# model with clinical covariates
dds <- DESeqDataSetFromMatrix(countData = mx , colData = ss2,
  design = ~ sexD + wound_typeOP + duration_sx + ethnicityCAT + ageCS + treatment_group )
## converting counts to integer mode
## Warning in DESeqDataSet(se, design = design, ignoreRank): some variables in
## design formula are characters, converting to factors
##   the design formula contains one or more numeric variables with integer values,
##   specifying a model with increasing fold change for higher values.
##   did you mean for this to be a factor? if so, first convert
##   this variable to a factor using the factor() function
##   Note: levels of factors in the design contain characters other than
##   letters, numbers, '_' and '.'. It is recommended (but not required) to use
##   only letters, numbers, and delimiters '_' or '.', as these are safe characters
##   for column names in R. [This is a message, not a warning or an error]
res <- DESeq(dds)
## estimating size factors
##   Note: levels of factors in the design contain characters other than
##   letters, numbers, '_' and '.'. It is recommended (but not required) to use
##   only letters, numbers, and delimiters '_' or '.', as these are safe characters
##   for column names in R. [This is a message, not a warning or an error]
## estimating dispersions
## gene-wise dispersion estimates
## mean-dispersion relationship
##   Note: levels of factors in the design contain characters other than
##   letters, numbers, '_' and '.'. It is recommended (but not required) to use
##   only letters, numbers, and delimiters '_' or '.', as these are safe characters
##   for column names in R. [This is a message, not a warning or an error]
## final dispersion estimates
## fitting model and testing
## 10 rows did not converge in beta, labelled in mcols(object)$betaConv. Use larger maxit argument with nbinomWaldTest
z <- results(res)
vsd <- vst(dds, blind=FALSE)
##   Note: levels of factors in the design contain characters other than
##   letters, numbers, '_' and '.'. It is recommended (but not required) to use
##   only letters, numbers, and delimiters '_' or '.', as these are safe characters
##   for column names in R. [This is a message, not a warning or an error]
zz <- cbind(as.data.frame(z),assay(vsd))
dge <- as.data.frame(zz[order(zz$pvalue),])
head(dge[order(dge$pvalue),1:6],10)
##                                   baseMean log2FoldChange     lfcSE      stat
## ENSG00000274611.4 TBC1D3          75.11060     28.5191889 3.4788629  8.197848
## ENSG00000225630.1 MTND2P28       130.06123     -2.3686307 0.4535022 -5.222975
## ENSG00000276085.1 CCL3L1         255.05022     -2.3116418 0.4587641 -5.038847
## ENSG00000211652.2 IGLV7-43        57.72448      2.0854416 0.4313195  4.835027
## ENSG00000278920.1 RP3-412A9.17   103.00331     -0.5045173 0.1058888 -4.764595
## ENSG00000263711.6 LINC02864       15.37815     -1.0913346 0.2490844 -4.381385
## ENSG00000211935.3 IGHV1-3        103.80490      1.9185937 0.4471155  4.291047
## ENSG00000272763.1 RP11-357H14.17  12.74908     -1.7976987 0.4292167 -4.188324
## ENSG00000248801.7 C8orf34-AS1     64.73886     -0.4796651 0.1151577 -4.165288
## ENSG00000211655.3 IGLV1-36        15.01384      1.5932344 0.3874480  4.112124
##                                        pvalue         padj
## ENSG00000274611.4 TBC1D3         2.447286e-16 5.368122e-12
## ENSG00000225630.1 MTND2P28       1.760713e-07 1.931062e-03
## ENSG00000276085.1 CCL3L1         4.683455e-07 3.424386e-03
## ENSG00000211652.2 IGLV7-43       1.331273e-06 7.300367e-03
## ENSG00000278920.1 RP3-412A9.17   1.892338e-06 8.301685e-03
## ENSG00000263711.6 LINC02864      1.179272e-05 4.311222e-02
## ENSG00000211935.3 IGHV1-3        1.778326e-05 5.572511e-02
## ENSG00000272763.1 RP11-357H14.17 2.810225e-05 7.578767e-02
## ENSG00000248801.7 C8orf34-AS1    3.109592e-05 7.578767e-02
## ENSG00000211655.3 IGLV1-36       3.920355e-05 8.599298e-02
mean(abs(dge$stat))
## [1] 0.963999
avb_crphi_t0 <- dge

# model with clinical and cell covariates
# Monocytes.C NK T.CD8.Memory T.CD4.Naive Neutrophils.LD
dds <- DESeqDataSetFromMatrix(countData = mx , colData = ss2,
  design = ~ sexD + wound_typeOP + duration_sx + ethnicityCAT + ageCS +
    Monocytes.C + NK + T.CD8.Memory + T.CD4.Naive + Neutrophils.LD + treatment_group )
## converting counts to integer mode
## Warning in DESeqDataSet(se, design = design, ignoreRank): some variables in
## design formula are characters, converting to factors
##   the design formula contains one or more numeric variables with integer values,
##   specifying a model with increasing fold change for higher values.
##   did you mean for this to be a factor? if so, first convert
##   this variable to a factor using the factor() function
##   the design formula contains one or more numeric variables that have mean or
##   standard deviation larger than 5 (an arbitrary threshold to trigger this message).
##   Including numeric variables with large mean can induce collinearity with the intercept.
##   Users should center and scale numeric variables in the design to improve GLM convergence.
##   Note: levels of factors in the design contain characters other than
##   letters, numbers, '_' and '.'. It is recommended (but not required) to use
##   only letters, numbers, and delimiters '_' or '.', as these are safe characters
##   for column names in R. [This is a message, not a warning or an error]
res <- DESeq(dds)
## estimating size factors
##   Note: levels of factors in the design contain characters other than
##   letters, numbers, '_' and '.'. It is recommended (but not required) to use
##   only letters, numbers, and delimiters '_' or '.', as these are safe characters
##   for column names in R. [This is a message, not a warning or an error]
## estimating dispersions
## gene-wise dispersion estimates
## mean-dispersion relationship
##   Note: levels of factors in the design contain characters other than
##   letters, numbers, '_' and '.'. It is recommended (but not required) to use
##   only letters, numbers, and delimiters '_' or '.', as these are safe characters
##   for column names in R. [This is a message, not a warning or an error]
## final dispersion estimates
## fitting model and testing
## 41 rows did not converge in beta, labelled in mcols(object)$betaConv. Use larger maxit argument with nbinomWaldTest
z <- results(res)
vsd <- vst(dds, blind=FALSE)
##   Note: levels of factors in the design contain characters other than
##   letters, numbers, '_' and '.'. It is recommended (but not required) to use
##   only letters, numbers, and delimiters '_' or '.', as these are safe characters
##   for column names in R. [This is a message, not a warning or an error]
zz <- cbind(as.data.frame(z),assay(vsd))
dge <- as.data.frame(zz[order(zz$pvalue),])
head(dge[order(dge$pvalue),1:6],10)
##                                   baseMean log2FoldChange      lfcSE      stat
## ENSG00000278920.1 RP3-412A9.17   103.00331     -0.5815433 0.10376894 -5.604213
## ENSG00000184166.3 OR1D2           43.84299     -0.7606212 0.14772438 -5.148921
## ENSG00000130368.7 MAS1            36.87331     -0.6653173 0.13143995 -5.061759
## ENSG00000243290.3 IGKV1-12        66.84308      1.3286837 0.28374046  4.682743
## ENSG00000100304.13 TTLL12       1016.56775      0.3673839 0.07974216  4.607147
## ENSG00000248801.7 C8orf34-AS1     64.73886     -0.5485503 0.12079641 -4.541115
## ENSG00000261501.1 BBS7-DT         61.88604     -0.6923031 0.15272923 -4.532879
## ENSG00000287671.1 RP11-728E14.5  125.36742     -0.5274317 0.11684974 -4.513760
## ENSG00000142910.16 TINAGL1        22.44874     -0.6820575 0.15340449 -4.446138
## ENSG00000229321.2 AC008269.2      16.95875     -0.7855289 0.17956739 -4.374563
##                                       pvalue         padj
## ENSG00000278920.1 RP3-412A9.17  2.092028e-08 0.0004588863
## ENSG00000184166.3 OR1D2         2.619887e-07 0.0028733615
## ENSG00000130368.7 MAS1          4.154066e-07 0.0030373144
## ENSG00000243290.3 IGKV1-12      2.830609e-06 0.0155223525
## ENSG00000100304.13 TTLL12       4.082305e-06 0.0174625398
## ENSG00000248801.7 C8orf34-AS1   5.595761e-06 0.0174625398
## ENSG00000261501.1 BBS7-DT       5.818510e-06 0.0174625398
## ENSG00000287671.1 RP11-728E14.5 6.368831e-06 0.0174625398
## ENSG00000142910.16 TINAGL1      8.742790e-06 0.0213081227
## ENSG00000229321.2 AC008269.2    1.216759e-05 0.0248308670
mean(abs(dge$stat))
## [1] 1.015061
avb_crphi_t0_adj <- dge

Treatment A vs B EOS in CRP low group

mx <- xeosf
ss2 <- as.data.frame(cbind(ss_eos,sscell_eos))
ss2 <- subset(ss2,crp_group==1)
mx <- mx[,colnames(mx) %in% rownames(ss2)]

# base model
dds <- DESeqDataSetFromMatrix(countData = mx , colData = ss2,
  design = ~ treatment_group )
## converting counts to integer mode
##   the design formula contains one or more numeric variables with integer values,
##   specifying a model with increasing fold change for higher values.
##   did you mean for this to be a factor? if so, first convert
##   this variable to a factor using the factor() function
res <- DESeq(dds)
## estimating size factors
## estimating dispersions
## gene-wise dispersion estimates
## mean-dispersion relationship
## final dispersion estimates
## fitting model and testing
## -- replacing outliers and refitting for 107 genes
## -- DESeq argument 'minReplicatesForReplace' = 7 
## -- original counts are preserved in counts(dds)
## estimating dispersions
## fitting model and testing
z <- results(res)
vsd <- vst(dds, blind=FALSE)
zz <- cbind(as.data.frame(z),assay(vsd))
dge <- as.data.frame(zz[order(zz$pvalue),])
head(dge[order(dge$pvalue),1:6],10)
##                                   baseMean log2FoldChange      lfcSE       stat
## ENSG00000279359.1 RP11-36D19.9   119.04727     -5.1395504 0.37985433 -13.530320
## ENSG00000141744.4 PNMT           139.75155     -3.9629221 0.29974528 -13.220966
## ENSG00000164056.11 SPRY1         233.24893     -2.7293406 0.22123908 -12.336611
## ENSG00000101187.16 SLCO4A1       173.38666     -2.6729667 0.23016884 -11.613069
## ENSG00000145990.11 GFOD1        2388.12563     -1.6208396 0.15147358 -10.700478
## ENSG00000048740.18 CELF2       17256.47082     -0.9431284 0.08907268 -10.588301
## ENSG00000079215.15 SLC1A3       1233.66208     -3.3548344 0.32004337 -10.482437
## ENSG00000064300.9 NGFR            79.80579     -2.7214417 0.27282216  -9.975149
## ENSG00000057294.16 PKP2          259.99533     -2.5509565 0.28208476  -9.043227
## ENSG00000168807.16 SNTB2        1676.95276     -0.9053557 0.10490101  -8.630572
##                                      pvalue         padj
## ENSG00000279359.1 RP11-36D19.9 1.035724e-41 2.285429e-37
## ENSG00000141744.4 PNMT         6.640567e-40 7.326538e-36
## ENSG00000164056.11 SPRY1       5.752639e-35 4.231258e-31
## ENSG00000101187.16 SLCO4A1     3.536877e-31 1.951118e-27
## ENSG00000145990.11 GFOD1       1.012550e-26 4.468585e-23
## ENSG00000048740.18 CELF2       3.376656e-26 1.241821e-22
## ENSG00000079215.15 SLC1A3      1.040281e-25 3.279263e-22
## ENSG00000064300.9 NGFR         1.958070e-23 5.400845e-20
## ENSG00000057294.16 PKP2        1.521137e-19 3.729489e-16
## ENSG00000168807.16 SNTB2       6.104587e-18 1.347038e-14
mean(abs(dge$stat))
## [1] 1.272032
# model with clinical covariates
dds <- DESeqDataSetFromMatrix(countData = mx , colData = ss2,
  design = ~ sexD + wound_typeOP + duration_sx + ethnicityCAT + ageCS + treatment_group )
## converting counts to integer mode
## Warning in DESeqDataSet(se, design = design, ignoreRank): some variables in
## design formula are characters, converting to factors
##   the design formula contains one or more numeric variables with integer values,
##   specifying a model with increasing fold change for higher values.
##   did you mean for this to be a factor? if so, first convert
##   this variable to a factor using the factor() function
##   Note: levels of factors in the design contain characters other than
##   letters, numbers, '_' and '.'. It is recommended (but not required) to use
##   only letters, numbers, and delimiters '_' or '.', as these are safe characters
##   for column names in R. [This is a message, not a warning or an error]
res <- DESeq(dds)
## estimating size factors
##   Note: levels of factors in the design contain characters other than
##   letters, numbers, '_' and '.'. It is recommended (but not required) to use
##   only letters, numbers, and delimiters '_' or '.', as these are safe characters
##   for column names in R. [This is a message, not a warning or an error]
## estimating dispersions
## gene-wise dispersion estimates
## mean-dispersion relationship
##   Note: levels of factors in the design contain characters other than
##   letters, numbers, '_' and '.'. It is recommended (but not required) to use
##   only letters, numbers, and delimiters '_' or '.', as these are safe characters
##   for column names in R. [This is a message, not a warning or an error]
## final dispersion estimates
## fitting model and testing
## 13 rows did not converge in beta, labelled in mcols(object)$betaConv. Use larger maxit argument with nbinomWaldTest
z <- results(res)
vsd <- vst(dds, blind=FALSE)
##   Note: levels of factors in the design contain characters other than
##   letters, numbers, '_' and '.'. It is recommended (but not required) to use
##   only letters, numbers, and delimiters '_' or '.', as these are safe characters
##   for column names in R. [This is a message, not a warning or an error]
zz <- cbind(as.data.frame(z),assay(vsd))
dge <- as.data.frame(zz[order(zz$pvalue),])
head(dge[order(dge$pvalue),1:6],10)
##                                   baseMean log2FoldChange      lfcSE       stat
## ENSG00000279359.1 RP11-36D19.9   119.04727     -5.3472996 0.39841130 -13.421556
## ENSG00000141744.4 PNMT           139.75155     -3.7766877 0.30856468 -12.239533
## ENSG00000164056.11 SPRY1         233.24893     -2.8225809 0.23140843 -12.197399
## ENSG00000079215.15 SLC1A3       1233.66208     -3.7771409 0.31036871 -12.169851
## ENSG00000101187.16 SLCO4A1       173.38666     -2.7558923 0.24132532 -11.419822
## ENSG00000048740.18 CELF2       17256.47082     -0.9616907 0.09345649 -10.290251
## ENSG00000145990.11 GFOD1        2388.12563     -1.5620788 0.15651131  -9.980613
## ENSG00000057294.16 PKP2          259.99533     -2.7302298 0.28018872  -9.744253
## ENSG00000064300.9 NGFR            79.80579     -2.5660575 0.28091181  -9.134744
## ENSG00000119138.5 KLF9          2597.08994     -1.0787187 0.11881849  -9.078710
##                                      pvalue         padj
## ENSG00000279359.1 RP11-36D19.9 4.521202e-41 9.976937e-37
## ENSG00000141744.4 PNMT         1.911285e-34 2.108816e-30
## ENSG00000164056.11 SPRY1       3.209131e-34 2.360530e-30
## ENSG00000079215.15 SLC1A3      4.499039e-34 2.482007e-30
## ENSG00000101187.16 SLCO4A1     3.329138e-30 1.469282e-26
## ENSG00000048740.18 CELF2       7.797324e-25 2.867726e-21
## ENSG00000145990.11 GFOD1       1.853188e-23 5.842043e-20
## ENSG00000057294.16 PKP2        1.952091e-22 5.384598e-19
## ENSG00000064300.9 NGFR         6.556155e-20 1.607496e-16
## ENSG00000119138.5 KLF9         1.098688e-19 2.424474e-16
mean(abs(dge$stat))
## [1] 1.214829
avb_crplo_eos <- dge

# model with clinical and cell covariates
# Monocytes.C NK T.CD8.Memory T.CD4.Naive Neutrophils.LD
dds <- DESeqDataSetFromMatrix(countData = mx , colData = ss2,
  design = ~ sexD + wound_typeOP + duration_sx + ethnicityCAT + ageCS +
    Monocytes.C + NK + T.CD8.Memory + T.CD4.Naive + Neutrophils.LD + treatment_group )
## converting counts to integer mode
## Warning in DESeqDataSet(se, design = design, ignoreRank): some variables in
## design formula are characters, converting to factors
##   the design formula contains one or more numeric variables with integer values,
##   specifying a model with increasing fold change for higher values.
##   did you mean for this to be a factor? if so, first convert
##   this variable to a factor using the factor() function
##   the design formula contains one or more numeric variables that have mean or
##   standard deviation larger than 5 (an arbitrary threshold to trigger this message).
##   Including numeric variables with large mean can induce collinearity with the intercept.
##   Users should center and scale numeric variables in the design to improve GLM convergence.
##   Note: levels of factors in the design contain characters other than
##   letters, numbers, '_' and '.'. It is recommended (but not required) to use
##   only letters, numbers, and delimiters '_' or '.', as these are safe characters
##   for column names in R. [This is a message, not a warning or an error]
res <- DESeq(dds)
## estimating size factors
##   Note: levels of factors in the design contain characters other than
##   letters, numbers, '_' and '.'. It is recommended (but not required) to use
##   only letters, numbers, and delimiters '_' or '.', as these are safe characters
##   for column names in R. [This is a message, not a warning or an error]
## estimating dispersions
## gene-wise dispersion estimates
## mean-dispersion relationship
##   Note: levels of factors in the design contain characters other than
##   letters, numbers, '_' and '.'. It is recommended (but not required) to use
##   only letters, numbers, and delimiters '_' or '.', as these are safe characters
##   for column names in R. [This is a message, not a warning or an error]
## final dispersion estimates
## fitting model and testing
## 36 rows did not converge in beta, labelled in mcols(object)$betaConv. Use larger maxit argument with nbinomWaldTest
z <- results(res)
vsd <- vst(dds, blind=FALSE)
##   Note: levels of factors in the design contain characters other than
##   letters, numbers, '_' and '.'. It is recommended (but not required) to use
##   only letters, numbers, and delimiters '_' or '.', as these are safe characters
##   for column names in R. [This is a message, not a warning or an error]
zz <- cbind(as.data.frame(z),assay(vsd))
dge <- as.data.frame(zz[order(zz$pvalue),])
head(dge[order(dge$pvalue),1:6],10)
##                                  baseMean log2FoldChange     lfcSE       stat
## ENSG00000279359.1 RP11-36D19.9   119.0473      -5.771853 0.4355807 -13.250941
## ENSG00000079215.15 SLC1A3       1233.6621      -4.437439 0.3485794 -12.730066
## ENSG00000164056.11 SPRY1         233.2489      -2.991515 0.2506529 -11.934892
## ENSG00000177575.13 CD163       22464.4744      -2.338915 0.2145180 -10.903116
## ENSG00000198363.18 ASPH         1869.6176      -1.762933 0.1692565 -10.415751
## ENSG00000101187.16 SLCO4A1       173.3867      -2.889167 0.2818293 -10.251477
## ENSG00000179593.16 ALOX15B      1208.5228      -4.514366 0.4436746 -10.174949
## ENSG00000174705.13 SH3PXD2B      449.8765      -2.978486 0.2929394 -10.167583
## ENSG00000111666.11 CHPT1        1299.4517      -1.180981 0.1223822  -9.649940
## ENSG00000135678.12 CPM           757.4190      -2.017817 0.2097880  -9.618365
##                                      pvalue         padj
## ENSG00000279359.1 RP11-36D19.9 4.455820e-40 9.832658e-36
## ENSG00000079215.15 SLC1A3      4.024988e-37 4.440971e-33
## ENSG00000164056.11 SPRY1       7.786033e-33 5.727146e-29
## ENSG00000177575.13 CD163       1.113768e-27 6.144379e-24
## ENSG00000198363.18 ASPH        2.101319e-25 9.273963e-22
## ENSG00000101187.16 SLCO4A1     1.165485e-24 4.286460e-21
## ENSG00000179593.16 ALOX15B     2.565331e-24 7.632111e-21
## ENSG00000174705.13 SH3PXD2B    2.766887e-24 7.632111e-21
## ENSG00000111666.11 CHPT1       4.918461e-22 1.205952e-18
## ENSG00000135678.12 CPM         6.688594e-22 1.475972e-18
mean(abs(dge$stat))
## [1] 1.063151
avb_crplo_eos_adj <- dge

Treatment A vs B EOS in CRP high group

mx <- xeosf
ss2 <- as.data.frame(cbind(ss_eos,sscell_eos))
ss2 <- subset(ss2,crp_group==4)
mx <- mx[,colnames(mx) %in% rownames(ss2)]

# base model
dds <- DESeqDataSetFromMatrix(countData = mx , colData = ss2,
  design = ~ treatment_group )
## converting counts to integer mode
##   the design formula contains one or more numeric variables with integer values,
##   specifying a model with increasing fold change for higher values.
##   did you mean for this to be a factor? if so, first convert
##   this variable to a factor using the factor() function
res <- DESeq(dds)
## estimating size factors
## estimating dispersions
## gene-wise dispersion estimates
## mean-dispersion relationship
## final dispersion estimates
## fitting model and testing
## -- replacing outliers and refitting for 138 genes
## -- DESeq argument 'minReplicatesForReplace' = 7 
## -- original counts are preserved in counts(dds)
## estimating dispersions
## fitting model and testing
z <- results(res)
vsd <- vst(dds, blind=FALSE)
zz <- cbind(as.data.frame(z),assay(vsd))
dge <- as.data.frame(zz[order(zz$pvalue),])
head(dge[order(dge$pvalue),1:6],10)
##                                 baseMean log2FoldChange      lfcSE       stat
## ENSG00000164056.11 SPRY1       108.76416      -2.532611 0.23899712 -10.596828
## ENSG00000141744.4 PNMT          43.59054      -3.129900 0.34146482  -9.166098
## ENSG00000179593.16 ALOX15B     547.79622      -3.162199 0.34916134  -9.056555
## ENSG00000279359.1 RP11-36D19.9  90.34984      -4.142272 0.49438312  -8.378669
## ENSG00000196935.9 SRGAP1       282.89286      -1.854628 0.22365011  -8.292544
## ENSG00000078053.17 AMPH        157.80806      -2.281000 0.27608001  -8.262098
## ENSG00000162599.17 NFIA        308.67237      -1.033152 0.12746020  -8.105685
## ENSG00000272870.3 SAP30-DT     121.11095      -0.790170 0.09793683  -8.068160
## ENSG00000110721.12 CHKA        869.95783      -1.224275 0.15266598  -8.019306
## ENSG00000121578.13 B4GALT4     865.64102      -1.070193 0.13932538  -7.681251
##                                      pvalue         padj
## ENSG00000164056.11 SPRY1       3.082572e-26 6.802313e-22
## ENSG00000141744.4 PNMT         4.904496e-20 5.411376e-16
## ENSG00000179593.16 ALOX15B     1.346361e-19 9.903380e-16
## ENSG00000279359.1 RP11-36D19.9 5.352966e-17 2.953098e-13
## ENSG00000196935.9 SRGAP1       1.108512e-16 4.892306e-13
## ENSG00000078053.17 AMPH        1.431340e-16 5.264228e-13
## ENSG00000162599.17 NFIA        5.244902e-16 1.653418e-12
## ENSG00000272870.3 SAP30-DT     7.136550e-16 1.968528e-12
## ENSG00000110721.12 CHKA        1.063440e-15 2.607436e-12
## ENSG00000121578.13 B4GALT4     1.575425e-14 3.476490e-11
mean(abs(dge$stat))
## [1] 1.198902
# model with clinical covariates
dds <- DESeqDataSetFromMatrix(countData = mx , colData = ss2,
  design = ~ sexD + wound_typeOP + duration_sx + ethnicityCAT + ageCS + treatment_group )
## converting counts to integer mode
## Warning in DESeqDataSet(se, design = design, ignoreRank): some variables in
## design formula are characters, converting to factors
##   the design formula contains one or more numeric variables with integer values,
##   specifying a model with increasing fold change for higher values.
##   did you mean for this to be a factor? if so, first convert
##   this variable to a factor using the factor() function
##   the design formula contains one or more numeric variables that have mean or
##   standard deviation larger than 5 (an arbitrary threshold to trigger this message).
##   Including numeric variables with large mean can induce collinearity with the intercept.
##   Users should center and scale numeric variables in the design to improve GLM convergence.
##   Note: levels of factors in the design contain characters other than
##   letters, numbers, '_' and '.'. It is recommended (but not required) to use
##   only letters, numbers, and delimiters '_' or '.', as these are safe characters
##   for column names in R. [This is a message, not a warning or an error]
res <- DESeq(dds)
## estimating size factors
##   Note: levels of factors in the design contain characters other than
##   letters, numbers, '_' and '.'. It is recommended (but not required) to use
##   only letters, numbers, and delimiters '_' or '.', as these are safe characters
##   for column names in R. [This is a message, not a warning or an error]
## estimating dispersions
## gene-wise dispersion estimates
## mean-dispersion relationship
##   Note: levels of factors in the design contain characters other than
##   letters, numbers, '_' and '.'. It is recommended (but not required) to use
##   only letters, numbers, and delimiters '_' or '.', as these are safe characters
##   for column names in R. [This is a message, not a warning or an error]
## final dispersion estimates
## fitting model and testing
## 3 rows did not converge in beta, labelled in mcols(object)$betaConv. Use larger maxit argument with nbinomWaldTest
z <- results(res)
vsd <- vst(dds, blind=FALSE)
##   Note: levels of factors in the design contain characters other than
##   letters, numbers, '_' and '.'. It is recommended (but not required) to use
##   only letters, numbers, and delimiters '_' or '.', as these are safe characters
##   for column names in R. [This is a message, not a warning or an error]
zz <- cbind(as.data.frame(z),assay(vsd))
dge <- as.data.frame(zz[order(zz$pvalue),])
head(dge[order(dge$pvalue),1:6],10)
##                                  baseMean log2FoldChange      lfcSE       stat
## ENSG00000164056.11 SPRY1        108.76416     -2.6668649 0.24704112 -10.795227
## ENSG00000279359.1 RP11-36D19.9   90.34984     -4.7806957 0.51198611  -9.337550
## ENSG00000141744.4 PNMT           43.59054     -3.2127745 0.34991481  -9.181590
## ENSG00000196935.9 SRGAP1        282.89286     -1.9362951 0.21148877  -9.155545
## ENSG00000179593.16 ALOX15B      547.79622     -3.1108104 0.36495565  -8.523804
## ENSG00000272870.3 SAP30-DT      121.11095     -0.8277754 0.09990025  -8.286020
## ENSG00000198585.12 NUDT16      4719.70533     -1.1852330 0.14956356  -7.924611
## ENSG00000121578.13 B4GALT4      865.64102     -1.0802468 0.13973364  -7.730757
## ENSG00000078053.17 AMPH         157.80806     -2.1961542 0.28426014  -7.725860
## ENSG00000124523.17 SIRT5        897.95933     -0.9857449 0.12942403  -7.616398
##                                      pvalue         padj
## ENSG00000164056.11 SPRY1       3.625670e-27 8.000766e-23
## ENSG00000279359.1 RP11-36D19.9 9.858924e-21 1.087784e-16
## ENSG00000141744.4 PNMT         4.247710e-20 2.983674e-16
## ENSG00000196935.9 SRGAP1       5.408391e-20 2.983674e-16
## ENSG00000179593.16 ALOX15B     1.543970e-17 6.814156e-14
## ENSG00000272870.3 SAP30-DT     1.171015e-16 4.306798e-13
## ENSG00000198585.12 NUDT16      2.288621e-15 7.214715e-12
## ENSG00000121578.13 B4GALT4     1.069090e-14 2.724055e-11
## ENSG00000078053.17 AMPH        1.111002e-14 2.724055e-11
## ENSG00000124523.17 SIRT5       2.608535e-14 5.404484e-11
mean(abs(dge$stat))
## [1] 1.268337
avb_crphi_eos <- dge

# model with clinical and cell covariates
# Monocytes.C NK T.CD8.Memory T.CD4.Naive Neutrophils.LD
dds <- DESeqDataSetFromMatrix(countData = mx , colData = ss2,
  design = ~ sexD + wound_typeOP + duration_sx + ethnicityCAT + ageCS +
    Monocytes.C + NK + T.CD8.Memory + T.CD4.Naive + Neutrophils.LD + treatment_group )
## converting counts to integer mode
## Warning in DESeqDataSet(se, design = design, ignoreRank): some variables in
## design formula are characters, converting to factors
##   the design formula contains one or more numeric variables with integer values,
##   specifying a model with increasing fold change for higher values.
##   did you mean for this to be a factor? if so, first convert
##   this variable to a factor using the factor() function
##   the design formula contains one or more numeric variables that have mean or
##   standard deviation larger than 5 (an arbitrary threshold to trigger this message).
##   Including numeric variables with large mean can induce collinearity with the intercept.
##   Users should center and scale numeric variables in the design to improve GLM convergence.
##   Note: levels of factors in the design contain characters other than
##   letters, numbers, '_' and '.'. It is recommended (but not required) to use
##   only letters, numbers, and delimiters '_' or '.', as these are safe characters
##   for column names in R. [This is a message, not a warning or an error]
res <- DESeq(dds)
## estimating size factors
##   Note: levels of factors in the design contain characters other than
##   letters, numbers, '_' and '.'. It is recommended (but not required) to use
##   only letters, numbers, and delimiters '_' or '.', as these are safe characters
##   for column names in R. [This is a message, not a warning or an error]
## estimating dispersions
## gene-wise dispersion estimates
## mean-dispersion relationship
##   Note: levels of factors in the design contain characters other than
##   letters, numbers, '_' and '.'. It is recommended (but not required) to use
##   only letters, numbers, and delimiters '_' or '.', as these are safe characters
##   for column names in R. [This is a message, not a warning or an error]
## final dispersion estimates
## fitting model and testing
## 19 rows did not converge in beta, labelled in mcols(object)$betaConv. Use larger maxit argument with nbinomWaldTest
z <- results(res)
vsd <- vst(dds, blind=FALSE)
##   Note: levels of factors in the design contain characters other than
##   letters, numbers, '_' and '.'. It is recommended (but not required) to use
##   only letters, numbers, and delimiters '_' or '.', as these are safe characters
##   for column names in R. [This is a message, not a warning or an error]
zz <- cbind(as.data.frame(z),assay(vsd))
dge <- as.data.frame(zz[order(zz$pvalue),])
head(dge[order(dge$pvalue),1:6],10)
##                                   baseMean log2FoldChange     lfcSE      stat
## ENSG00000164056.11 SPRY1         108.76416     -2.6240004 0.2866809 -9.153036
## ENSG00000198585.12 NUDT16       4719.70533     -1.1065368 0.1246267 -8.878812
## ENSG00000179593.16 ALOX15B       547.79622     -2.9766733 0.3371682 -8.828453
## ENSG00000141744.4 PNMT            43.59054     -2.7567440 0.3639445 -7.574628
## ENSG00000135678.12 CPM           424.57761     -1.1706712 0.1570310 -7.455033
## ENSG00000136478.8 TEX2           868.89100     -0.8306822 0.1119672 -7.418975
## ENSG00000279359.1 RP11-36D19.9    90.34984     -3.6900821 0.4986320 -7.400412
## ENSG00000196935.9 SRGAP1         282.89286     -1.4946291 0.2031922 -7.355740
## ENSG00000177575.13 CD163       27248.95998     -1.9982460 0.2717813 -7.352403
## ENSG00000111666.11 CHPT1        1111.30704     -0.9224094 0.1255707 -7.345735
##                                      pvalue         padj
## ENSG00000164056.11 SPRY1       5.535555e-20 1.221531e-15
## ENSG00000198585.12 NUDT16      6.757838e-19 7.456261e-15
## ENSG00000179593.16 ALOX15B     1.061335e-18 7.806830e-15
## ENSG00000141744.4 PNMT         3.601587e-14 1.986906e-10
## ENSG00000135678.12 CPM         8.984555e-14 3.965244e-10
## ENSG00000136478.8 TEX2         1.180302e-13 4.279816e-10
## ENSG00000279359.1 RP11-36D19.9 1.357625e-13 4.279816e-10
## ENSG00000196935.9 SRGAP1       1.898722e-13 4.515593e-10
## ENSG00000177575.13 CD163       1.946742e-13 4.515593e-10
## ENSG00000111666.11 CHPT1       2.046310e-13 4.515593e-10
mean(abs(dge$stat))
## [1] 0.9300142
avb_crphi_eos_adj <- dge

Treatment A vs B POD1 in CRP low group

mx <- xpod1f
ss2 <- as.data.frame(cbind(ss_pod1,sscell_pod1))
ss2 <- subset(ss2,crp_group==1)
mx <- mx[,colnames(mx) %in% rownames(ss2)]

# base model
dds <- DESeqDataSetFromMatrix(countData = mx , colData = ss2,
  design = ~ treatment_group )
## converting counts to integer mode
##   the design formula contains one or more numeric variables with integer values,
##   specifying a model with increasing fold change for higher values.
##   did you mean for this to be a factor? if so, first convert
##   this variable to a factor using the factor() function
res <- DESeq(dds)
## estimating size factors
## estimating dispersions
## gene-wise dispersion estimates
## mean-dispersion relationship
## final dispersion estimates
## fitting model and testing
## -- replacing outliers and refitting for 101 genes
## -- DESeq argument 'minReplicatesForReplace' = 7 
## -- original counts are preserved in counts(dds)
## estimating dispersions
## fitting model and testing
z <- results(res)
vsd <- vst(dds, blind=FALSE)
zz <- cbind(as.data.frame(z),assay(vsd))
dge <- as.data.frame(zz[order(zz$pvalue),])
head(dge[order(dge$pvalue),1:6],10)
##                                  baseMean log2FoldChange     lfcSE      stat
## ENSG00000186081.12 KRT5          14.54816       2.576551 0.4235145  6.083739
## ENSG00000204044.6 SLC12A5-AS1    25.14097      -3.075518 0.5156713 -5.964106
## ENSG00000152463.15 OLAH          24.53332      -2.873612 0.4851144 -5.923576
## ENSG00000146072.6 TNFRSF21       42.89273       1.040202 0.1856047  5.604397
## ENSG00000259162.1 RP11-203M5.6   26.14874       1.581181 0.2897282  5.457464
## ENSG00000142627.13 EPHA2         19.20075       1.637299 0.3055916  5.357800
## ENSG00000204936.10 CD177        618.22625      -3.037256 0.5784007 -5.251128
## ENSG00000155659.15 VSIG4       1772.93303      -2.147337 0.4164836 -5.155873
## ENSG00000154269.15 ENPP3         32.41553       1.154158 0.2238815  5.155219
## ENSG00000229961.3 RP11-71G12.1   75.23398       1.526810 0.2963257  5.152473
##                                      pvalue         padj
## ENSG00000186081.12 KRT5        1.174117e-09 2.237975e-05
## ENSG00000204044.6 SLC12A5-AS1  2.459774e-09 2.237975e-05
## ENSG00000152463.15 OLAH        3.150155e-09 2.237975e-05
## ENSG00000146072.6 TNFRSF21     2.089813e-08 1.113505e-04
## ENSG00000259162.1 RP11-203M5.6 4.829843e-08 2.058769e-04
## ENSG00000142627.13 EPHA2       8.424125e-08 2.992389e-04
## ENSG00000204936.10 CD177       1.511709e-07 4.602722e-04
## ENSG00000155659.15 VSIG4       2.524517e-07 5.478997e-04
## ENSG00000154269.15 ENPP3       2.533344e-07 5.478997e-04
## ENSG00000229961.3 RP11-71G12.1 2.570730e-07 5.478997e-04
mean(abs(dge$stat))
## [1] 1.083967
# model with clinical covariates
dds <- DESeqDataSetFromMatrix(countData = mx , colData = ss2,
  design = ~ sexD + wound_typeOP + duration_sx + ethnicityCAT + ageCS + treatment_group )
## converting counts to integer mode
## Warning in DESeqDataSet(se, design = design, ignoreRank): some variables in
## design formula are characters, converting to factors
##   the design formula contains one or more numeric variables with integer values,
##   specifying a model with increasing fold change for higher values.
##   did you mean for this to be a factor? if so, first convert
##   this variable to a factor using the factor() function
##   Note: levels of factors in the design contain characters other than
##   letters, numbers, '_' and '.'. It is recommended (but not required) to use
##   only letters, numbers, and delimiters '_' or '.', as these are safe characters
##   for column names in R. [This is a message, not a warning or an error]
res <- DESeq(dds)
## estimating size factors
##   Note: levels of factors in the design contain characters other than
##   letters, numbers, '_' and '.'. It is recommended (but not required) to use
##   only letters, numbers, and delimiters '_' or '.', as these are safe characters
##   for column names in R. [This is a message, not a warning or an error]
## estimating dispersions
## gene-wise dispersion estimates
## mean-dispersion relationship
##   Note: levels of factors in the design contain characters other than
##   letters, numbers, '_' and '.'. It is recommended (but not required) to use
##   only letters, numbers, and delimiters '_' or '.', as these are safe characters
##   for column names in R. [This is a message, not a warning or an error]
## final dispersion estimates
## fitting model and testing
## 13 rows did not converge in beta, labelled in mcols(object)$betaConv. Use larger maxit argument with nbinomWaldTest
z <- results(res)
vsd <- vst(dds, blind=FALSE)
##   Note: levels of factors in the design contain characters other than
##   letters, numbers, '_' and '.'. It is recommended (but not required) to use
##   only letters, numbers, and delimiters '_' or '.', as these are safe characters
##   for column names in R. [This is a message, not a warning or an error]
zz <- cbind(as.data.frame(z),assay(vsd))
dge <- as.data.frame(zz[order(zz$pvalue),])
head(dge[order(dge$pvalue),1:6],10)
##                                  baseMean log2FoldChange     lfcSE      stat
## ENSG00000155659.15 VSIG4       1772.93303     -2.8430229 0.3779008 -7.523199
## ENSG00000087116.16 ADAMTS2     1436.45625     -3.7809954 0.5047904 -7.490228
## ENSG00000186081.12 KRT5          14.54816      2.8196082 0.4406358  6.398953
## ENSG00000100985.7 MMP9         3694.58444     -2.9906166 0.5378907 -5.559897
## ENSG00000229961.3 RP11-71G12.1   75.23398      1.6244682 0.2922447  5.558589
## ENSG00000259162.1 RP11-203M5.6   26.14874      1.5474793 0.2819920  5.487672
## ENSG00000105223.20 PLD3        5830.74295     -0.5634004 0.1044934 -5.391731
## ENSG00000142627.13 EPHA2         19.20075      1.7165708 0.3199429  5.365241
## ENSG00000149534.9 MS4A2          73.42690      1.3047162 0.2497248  5.224615
## ENSG00000115590.14 IL1R2       1210.70599     -2.4983175 0.4790051 -5.215638
##                                      pvalue         padj
## ENSG00000155659.15 VSIG4       5.345199e-14 4.485859e-10
## ENSG00000087116.16 ADAMTS2     6.875406e-14 4.485859e-10
## ENSG00000186081.12 KRT5        1.564457e-10           NA
## ENSG00000100985.7 MMP9         2.699346e-08 1.174126e-04
## ENSG00000229961.3 RP11-71G12.1 2.719649e-08           NA
## ENSG00000259162.1 RP11-203M5.6 4.072656e-08           NA
## ENSG00000105223.20 PLD3        6.978235e-08 2.276475e-04
## ENSG00000142627.13 EPHA2       8.084104e-08           NA
## ENSG00000149534.9 MS4A2        1.745178e-07           NA
## ENSG00000115590.14 IL1R2       1.831854e-07 4.780772e-04
mean(abs(dge$stat))
## [1] 1.26917
avb_crplo_pod1 <- dge

# model with clinical and cell covariates
# Monocytes.C NK T.CD8.Memory T.CD4.Naive Neutrophils.LD
dds <- DESeqDataSetFromMatrix(countData = mx , colData = ss2,
  design = ~ sexD + wound_typeOP + duration_sx + ethnicityCAT + ageCS +
    Monocytes.C + NK + T.CD8.Memory + T.CD4.Naive + Neutrophils.LD + treatment_group )
## converting counts to integer mode
## Warning in DESeqDataSet(se, design = design, ignoreRank): some variables in
## design formula are characters, converting to factors
##   the design formula contains one or more numeric variables with integer values,
##   specifying a model with increasing fold change for higher values.
##   did you mean for this to be a factor? if so, first convert
##   this variable to a factor using the factor() function
##   the design formula contains one or more numeric variables that have mean or
##   standard deviation larger than 5 (an arbitrary threshold to trigger this message).
##   Including numeric variables with large mean can induce collinearity with the intercept.
##   Users should center and scale numeric variables in the design to improve GLM convergence.
##   Note: levels of factors in the design contain characters other than
##   letters, numbers, '_' and '.'. It is recommended (but not required) to use
##   only letters, numbers, and delimiters '_' or '.', as these are safe characters
##   for column names in R. [This is a message, not a warning or an error]
res <- DESeq(dds)
## estimating size factors
##   Note: levels of factors in the design contain characters other than
##   letters, numbers, '_' and '.'. It is recommended (but not required) to use
##   only letters, numbers, and delimiters '_' or '.', as these are safe characters
##   for column names in R. [This is a message, not a warning or an error]
## estimating dispersions
## gene-wise dispersion estimates
## mean-dispersion relationship
##   Note: levels of factors in the design contain characters other than
##   letters, numbers, '_' and '.'. It is recommended (but not required) to use
##   only letters, numbers, and delimiters '_' or '.', as these are safe characters
##   for column names in R. [This is a message, not a warning or an error]
## final dispersion estimates
## fitting model and testing
## 32 rows did not converge in beta, labelled in mcols(object)$betaConv. Use larger maxit argument with nbinomWaldTest
z <- results(res)
vsd <- vst(dds, blind=FALSE)
##   Note: levels of factors in the design contain characters other than
##   letters, numbers, '_' and '.'. It is recommended (but not required) to use
##   only letters, numbers, and delimiters '_' or '.', as these are safe characters
##   for column names in R. [This is a message, not a warning or an error]
zz <- cbind(as.data.frame(z),assay(vsd))
dge <- as.data.frame(zz[order(zz$pvalue),])
head(dge[order(dge$pvalue),1:6],10)
##                                  baseMean log2FoldChange      lfcSE      stat
## ENSG00000155659.15 VSIG4       1772.93303     -2.0162400 0.33720409 -5.979287
## ENSG00000087116.16 ADAMTS2     1436.45625     -2.5921949 0.44416561 -5.836100
## ENSG00000186081.12 KRT5          14.54816      2.3884544 0.46530924  5.133047
## ENSG00000101004.15 NINL         135.28899     -0.8218318 0.16059437 -5.117438
## ENSG00000229961.3 RP11-71G12.1   75.23398      1.5446697 0.30769579  5.020120
## ENSG00000135218.19 CD36        8887.60274      0.5861706 0.12676967  4.623902
## ENSG00000259162.1 RP11-203M5.6   26.14874      1.3790996 0.29872566  4.616609
## ENSG00000149534.9 MS4A2          73.42690      1.1437686 0.24915410  4.590607
## ENSG00000146072.6 TNFRSF21       42.89273      0.9927942 0.21822908  4.549321
## ENSG00000102524.12 TNFSF13B    1891.40085      0.4415408 0.09736608  4.534853
##                                      pvalue         padj
## ENSG00000155659.15 VSIG4       2.241164e-09 4.776592e-05
## ENSG00000087116.16 ADAMTS2     5.343688e-09 5.694501e-05
## ENSG00000186081.12 KRT5        2.850879e-07 1.650231e-03
## ENSG00000101004.15 NINL        3.097136e-07 1.650231e-03
## ENSG00000229961.3 RP11-71G12.1 5.163929e-07 2.201176e-03
## ENSG00000135218.19 CD36        3.765872e-06 1.177432e-02
## ENSG00000259162.1 RP11-203M5.6 3.900613e-06 1.177432e-02
## ENSG00000149534.9 MS4A2        4.419584e-06 1.177432e-02
## ENSG00000146072.6 TNFRSF21     5.381922e-06 1.228560e-02
## ENSG00000102524.12 TNFSF13B    5.764368e-06 1.228560e-02
mean(abs(dge$stat))
## [1] 1.007269
avb_crplo_pod1_adj <- dge

Treatment A vs B POD in CRP high group

mx <- xpod1f
ss2 <- as.data.frame(cbind(ss_pod1,sscell_pod1))
ss2 <- subset(ss2,crp_group==4)
mx <- mx[,colnames(mx) %in% rownames(ss2)]

# base model
dds <- DESeqDataSetFromMatrix(countData = mx , colData = ss2,
  design = ~ treatment_group )
## converting counts to integer mode
##   the design formula contains one or more numeric variables with integer values,
##   specifying a model with increasing fold change for higher values.
##   did you mean for this to be a factor? if so, first convert
##   this variable to a factor using the factor() function
res <- DESeq(dds)
## estimating size factors
## estimating dispersions
## gene-wise dispersion estimates
## mean-dispersion relationship
## final dispersion estimates
## fitting model and testing
## -- replacing outliers and refitting for 250 genes
## -- DESeq argument 'minReplicatesForReplace' = 7 
## -- original counts are preserved in counts(dds)
## estimating dispersions
## fitting model and testing
z <- results(res)
vsd <- vst(dds, blind=FALSE)
zz <- cbind(as.data.frame(z),assay(vsd))
dge <- as.data.frame(zz[order(zz$pvalue),])
head(dge[order(dge$pvalue),1:6],10)
##                                  baseMean log2FoldChange     lfcSE      stat
## ENSG00000131016.17 AKAP12       118.08416       1.904352 0.3589243  5.305720
## ENSG00000149534.9 MS4A2          93.32501       1.866884 0.3696944  5.049802
## ENSG00000186081.12 KRT5          14.48988       2.017019 0.4076553  4.947854
## ENSG00000229961.3 RP11-71G12.1   58.76722       1.339119 0.2735828  4.894748
## ENSG00000140287.11 HDC          571.69806       1.885327 0.3856378  4.888854
## ENSG00000179348.12 GATA2        810.50517       1.608564 0.3351194  4.799972
## ENSG00000158715.6 SLC45A3       258.52371       1.306224 0.2724756  4.793914
## ENSG00000155659.15 VSIG4       1247.57497      -2.125654 0.4456523 -4.769759
## ENSG00000246363.3 LINC02458      30.59379       1.828502 0.3945107  4.634861
## ENSG00000259162.1 RP11-203M5.6   23.31281       1.481681 0.3212551  4.612163
##                                      pvalue        padj
## ENSG00000131016.17 AKAP12      1.122292e-07 0.002252664
## ENSG00000149534.9 MS4A2        4.422678e-07 0.004071602
## ENSG00000186081.12 KRT5        7.503634e-07 0.004071602
## ENSG00000229961.3 RP11-71G12.1 9.843169e-07 0.004071602
## ENSG00000140287.11 HDC         1.014249e-06 0.004071602
## ENSG00000179348.12 GATA2       1.586878e-06 0.004627772
## ENSG00000158715.6 SLC45A3      1.635586e-06 0.004627772
## ENSG00000155659.15 VSIG4       1.844469e-06 0.004627772
## ENSG00000246363.3 LINC02458    3.571771e-06 0.007965842
## ENSG00000259162.1 RP11-203M5.6 3.985011e-06 0.007998713
mean(abs(dge$stat))
## [1] 0.7008559
# model with clinical covariates
dds <- DESeqDataSetFromMatrix(countData = mx , colData = ss2,
  design = ~ sexD + wound_typeOP + duration_sx + ethnicityCAT + ageCS + treatment_group )
## converting counts to integer mode
## Warning in DESeqDataSet(se, design = design, ignoreRank): some variables in
## design formula are characters, converting to factors
##   the design formula contains one or more numeric variables with integer values,
##   specifying a model with increasing fold change for higher values.
##   did you mean for this to be a factor? if so, first convert
##   this variable to a factor using the factor() function
##   Note: levels of factors in the design contain characters other than
##   letters, numbers, '_' and '.'. It is recommended (but not required) to use
##   only letters, numbers, and delimiters '_' or '.', as these are safe characters
##   for column names in R. [This is a message, not a warning or an error]
res <- DESeq(dds)
## estimating size factors
##   Note: levels of factors in the design contain characters other than
##   letters, numbers, '_' and '.'. It is recommended (but not required) to use
##   only letters, numbers, and delimiters '_' or '.', as these are safe characters
##   for column names in R. [This is a message, not a warning or an error]
## estimating dispersions
## gene-wise dispersion estimates
## mean-dispersion relationship
##   Note: levels of factors in the design contain characters other than
##   letters, numbers, '_' and '.'. It is recommended (but not required) to use
##   only letters, numbers, and delimiters '_' or '.', as these are safe characters
##   for column names in R. [This is a message, not a warning or an error]
## final dispersion estimates
## fitting model and testing
## 11 rows did not converge in beta, labelled in mcols(object)$betaConv. Use larger maxit argument with nbinomWaldTest
z <- results(res)
vsd <- vst(dds, blind=FALSE)
##   Note: levels of factors in the design contain characters other than
##   letters, numbers, '_' and '.'. It is recommended (but not required) to use
##   only letters, numbers, and delimiters '_' or '.', as these are safe characters
##   for column names in R. [This is a message, not a warning or an error]
zz <- cbind(as.data.frame(z),assay(vsd))
dge <- as.data.frame(zz[order(zz$pvalue),])
head(dge[order(dge$pvalue),1:6],10)
##                              baseMean log2FoldChange     lfcSE      stat
## ENSG00000274611.4 TBC1D3     56.78775     24.6259129 3.4483190  7.141425
## ENSG00000155659.15 VSIG4   1247.57497     -2.6203399 0.4278950 -6.123792
## ENSG00000225630.1 MTND2P28  106.98061     -2.1843250 0.4275721 -5.108671
## ENSG00000078053.17 AMPH     167.98498     -1.4433937 0.2894022 -4.987501
## ENSG00000186081.12 KRT5      14.48988      2.0084378 0.4078153  4.924871
## ENSG00000198794.12 SCAMP5    65.44507      0.9688744 0.1982756  4.886503
## ENSG00000131016.17 AKAP12   118.08416      1.8265393 0.3775147  4.838327
## ENSG00000211935.3 IGHV1-3    64.54582      1.5403262 0.3349438  4.598760
## ENSG00000179348.12 GATA2    810.50517      1.6245124 0.3536185  4.593969
## ENSG00000158715.6 SLC45A3   258.52371      1.3109805 0.2872035  4.564640
##                                  pvalue         padj
## ENSG00000274611.4 TBC1D3   9.236800e-13 1.968639e-08
## ENSG00000155659.15 VSIG4   9.137432e-10 9.737304e-06
## ENSG00000225630.1 MTND2P28 3.244325e-07 2.304877e-03
## ENSG00000078053.17 AMPH    6.116527e-07 3.259039e-03
## ENSG00000186081.12 KRT5    8.441599e-07 3.598316e-03
## ENSG00000198794.12 SCAMP5  1.026427e-06 3.646041e-03
## ENSG00000131016.17 AKAP12  1.309367e-06 3.986649e-03
## ENSG00000211935.3 IGHV1-3  4.250123e-06 1.000198e-02
## ENSG00000179348.12 GATA2   4.348936e-06 1.000198e-02
## ENSG00000158715.6 SLC45A3  5.003516e-06 1.000198e-02
mean(abs(dge$stat))
## [1] 0.6749725
avb_crphi_pod1 <- dge

# model with clinical and cell covariates
# Monocytes.C NK T.CD8.Memory T.CD4.Naive Neutrophils.LD
dds <- DESeqDataSetFromMatrix(countData = mx , colData = ss2,
  design = ~ sexD + wound_typeOP + duration_sx + ethnicityCAT + ageCS +
    Monocytes.C + NK + T.CD8.Memory + T.CD4.Naive + Neutrophils.LD + treatment_group )
## converting counts to integer mode
## Warning in DESeqDataSet(se, design = design, ignoreRank): some variables in
## design formula are characters, converting to factors
##   the design formula contains one or more numeric variables with integer values,
##   specifying a model with increasing fold change for higher values.
##   did you mean for this to be a factor? if so, first convert
##   this variable to a factor using the factor() function
##   the design formula contains one or more numeric variables that have mean or
##   standard deviation larger than 5 (an arbitrary threshold to trigger this message).
##   Including numeric variables with large mean can induce collinearity with the intercept.
##   Users should center and scale numeric variables in the design to improve GLM convergence.
##   Note: levels of factors in the design contain characters other than
##   letters, numbers, '_' and '.'. It is recommended (but not required) to use
##   only letters, numbers, and delimiters '_' or '.', as these are safe characters
##   for column names in R. [This is a message, not a warning or an error]
res <- DESeq(dds)
## estimating size factors
##   Note: levels of factors in the design contain characters other than
##   letters, numbers, '_' and '.'. It is recommended (but not required) to use
##   only letters, numbers, and delimiters '_' or '.', as these are safe characters
##   for column names in R. [This is a message, not a warning or an error]
## estimating dispersions
## gene-wise dispersion estimates
## mean-dispersion relationship
##   Note: levels of factors in the design contain characters other than
##   letters, numbers, '_' and '.'. It is recommended (but not required) to use
##   only letters, numbers, and delimiters '_' or '.', as these are safe characters
##   for column names in R. [This is a message, not a warning or an error]
## final dispersion estimates
## fitting model and testing
## 28 rows did not converge in beta, labelled in mcols(object)$betaConv. Use larger maxit argument with nbinomWaldTest
z <- results(res)
vsd <- vst(dds, blind=FALSE)
##   Note: levels of factors in the design contain characters other than
##   letters, numbers, '_' and '.'. It is recommended (but not required) to use
##   only letters, numbers, and delimiters '_' or '.', as these are safe characters
##   for column names in R. [This is a message, not a warning or an error]
zz <- cbind(as.data.frame(z),assay(vsd))
dge <- as.data.frame(zz[order(zz$pvalue),])
head(dge[order(dge$pvalue),1:6],10)
##                              baseMean log2FoldChange     lfcSE      stat
## ENSG00000155659.15 VSIG4   1247.57497     -2.2950320 0.4103782 -5.592480
## ENSG00000186081.12 KRT5      14.48988      2.2017581 0.4208578  5.231596
## ENSG00000244116.3 IGKV2-28   94.97033      1.5259902 0.2978606  5.123169
## ENSG00000078053.17 AMPH     167.98498     -1.3607277 0.2682920 -5.071816
## ENSG00000198794.12 SCAMP5    65.44507      1.0198080 0.2040033  4.998977
## ENSG00000100453.13 GZMB    1428.85140      0.7408132 0.1523886  4.861341
## ENSG00000111249.14 CUX2      26.61410      1.3377186 0.2819178  4.745066
## ENSG00000132465.12 JCHAIN  1006.89958      1.1477793 0.2442314  4.699557
## ENSG00000211644.3 IGLV1-51  142.58626      1.2413126 0.2645593  4.692001
## ENSG00000211648.2 IGLV1-47  132.22632      1.2555063 0.2699166  4.651460
##                                  pvalue         padj
## ENSG00000155659.15 VSIG4   2.238485e-08 0.0004770883
## ENSG00000186081.12 KRT5    1.680525e-07 0.0017908519
## ENSG00000244116.3 IGKV2-28 3.004422e-07 0.0020995293
## ENSG00000078053.17 AMPH    3.940373e-07 0.0020995293
## ENSG00000198794.12 SCAMP5  5.763528e-07 0.0024567613
## ENSG00000100453.13 GZMB    1.165930e-06 0.0041415789
## ENSG00000111249.14 CUX2    2.084384e-06 0.0063463532
## ENSG00000132465.12 JCHAIN  2.607268e-06 0.0064068377
## ENSG00000211644.3 IGLV1-51 2.705463e-06 0.0064068377
## ENSG00000211648.2 IGLV1-47 3.295937e-06 0.0070246314
mean(abs(dge$stat))
## [1] 0.7716328
avb_crphi_pod1_adj <- dge

CRP Group Comparisons statified

CRP low vs high at t=0 treatment group A

mx <- xt0f
ss2 <- as.data.frame(cbind(ss_t0,sscell_t0))
ss2 <- subset(ss2,treatment_group==1)
mx <- mx[,colnames(mx) %in% rownames(ss2)]

# base model
dds <- DESeqDataSetFromMatrix(countData = mx , colData = ss2,
  design = ~ crp_group )
## converting counts to integer mode
##   the design formula contains one or more numeric variables with integer values,
##   specifying a model with increasing fold change for higher values.
##   did you mean for this to be a factor? if so, first convert
##   this variable to a factor using the factor() function
res <- DESeq(dds)
## estimating size factors
## estimating dispersions
## gene-wise dispersion estimates
## mean-dispersion relationship
## final dispersion estimates
## fitting model and testing
## -- replacing outliers and refitting for 116 genes
## -- DESeq argument 'minReplicatesForReplace' = 7 
## -- original counts are preserved in counts(dds)
## estimating dispersions
## fitting model and testing
z <- results(res)
vsd <- vst(dds, blind=FALSE)
zz <- cbind(as.data.frame(z),assay(vsd))
dge <- as.data.frame(zz[order(zz$pvalue),])
head(dge[order(dge$pvalue),1:6],10)
##                                 baseMean log2FoldChange      lfcSE      stat
## ENSG00000211640.4 IGLV6-57      73.94116     -0.5012755 0.09503047 -5.274892
## ENSG00000211644.3 IGLV1-51     249.02248     -0.6160909 0.11760002 -5.238867
## ENSG00000211652.2 IGLV7-43      52.51336     -0.6502306 0.12553982 -5.179477
## ENSG00000211655.3 IGLV1-36      15.50197     -0.6064267 0.12419400 -4.882899
## ENSG00000279359.1 RP11-36D19.9  43.68155     -1.1247960 0.24645555 -4.563890
## ENSG00000263711.6 LINC02864     16.11890      0.3756337 0.08415429  4.463631
## ENSG00000211673.2 IGLV3-1      180.11226     -0.4099034 0.09521025 -4.305244
## ENSG00000113790.11 EHHADH       70.48409      0.1809165 0.04324047  4.183961
## ENSG00000087116.16 ADAMTS2     144.89306     -0.8669518 0.21120081 -4.104869
## ENSG00000211649.3 IGLV7-46      63.48682     -0.5888044 0.14456169 -4.073032
##                                      pvalue        padj
## ENSG00000211640.4 IGLV6-57     1.328340e-07 0.001595313
## ENSG00000211644.3 IGLV1-51     1.615655e-07 0.001595313
## ENSG00000211652.2 IGLV7-43     2.225087e-07 0.001595313
## ENSG00000211655.3 IGLV1-36     1.045375e-06 0.005621245
## ENSG00000279359.1 RP11-36D19.9 5.021440e-06 0.021601231
## ENSG00000263711.6 LINC02864    8.058233e-06 0.028887422
## ENSG00000211673.2 IGLV3-1      1.668016e-05 0.051253362
## ENSG00000113790.11 EHHADH      2.864731e-05 0.077021866
## ENSG00000087116.16 ADAMTS2     4.045433e-05 0.096681348
## ENSG00000211649.3 IGLV7-46     4.640502e-05 0.099812567
mean(abs(dge$stat))
## [1] 0.8542119
# model with clinical covariates
dds <- DESeqDataSetFromMatrix(countData = mx , colData = ss2,
  design = ~ sexD + wound_typeOP + duration_sx + ethnicityCAT + ageCS + crp_group )
## converting counts to integer mode
## Warning in DESeqDataSet(se, design = design, ignoreRank): some variables in
## design formula are characters, converting to factors
##   the design formula contains one or more numeric variables with integer values,
##   specifying a model with increasing fold change for higher values.
##   did you mean for this to be a factor? if so, first convert
##   this variable to a factor using the factor() function
##   Note: levels of factors in the design contain characters other than
##   letters, numbers, '_' and '.'. It is recommended (but not required) to use
##   only letters, numbers, and delimiters '_' or '.', as these are safe characters
##   for column names in R. [This is a message, not a warning or an error]
res <- DESeq(dds)
## estimating size factors
##   Note: levels of factors in the design contain characters other than
##   letters, numbers, '_' and '.'. It is recommended (but not required) to use
##   only letters, numbers, and delimiters '_' or '.', as these are safe characters
##   for column names in R. [This is a message, not a warning or an error]
## estimating dispersions
## gene-wise dispersion estimates
## mean-dispersion relationship
##   Note: levels of factors in the design contain characters other than
##   letters, numbers, '_' and '.'. It is recommended (but not required) to use
##   only letters, numbers, and delimiters '_' or '.', as these are safe characters
##   for column names in R. [This is a message, not a warning or an error]
## final dispersion estimates
## fitting model and testing
## 29 rows did not converge in beta, labelled in mcols(object)$betaConv. Use larger maxit argument with nbinomWaldTest
z <- results(res)
vsd <- vst(dds, blind=FALSE)
##   Note: levels of factors in the design contain characters other than
##   letters, numbers, '_' and '.'. It is recommended (but not required) to use
##   only letters, numbers, and delimiters '_' or '.', as these are safe characters
##   for column names in R. [This is a message, not a warning or an error]
zz <- cbind(as.data.frame(z),assay(vsd))
dge <- as.data.frame(zz[order(zz$pvalue),])
head(dge[order(dge$pvalue),1:6],10)
##                                  baseMean log2FoldChange      lfcSE      stat
## ENSG00000274611.4 TBC1D3         61.02093     -9.1421319 1.32357018 -6.907176
## ENSG00000278599.6 TBC1D3E        18.70446     -7.7732985 1.32279633 -5.876414
## ENSG00000280035.1 RP11-10J21.2   19.49861      0.4739069 0.10831763  4.375159
## ENSG00000203999.9 LINC01270     118.07792      0.3907644 0.09069852  4.308388
## ENSG00000203814.6 H2BC18         64.74206      0.4615320 0.10714744  4.307448
## ENSG00000211652.2 IGLV7-43       52.51336     -0.6209722 0.14601307 -4.252854
## ENSG00000211655.3 IGLV1-36       15.50197     -0.5985422 0.14468746 -4.136794
## ENSG00000225764.2 P3H2-AS1       10.20911      0.3674466 0.08926867  4.116188
## ENSG00000211679.2 IGLC3         802.12582     -0.6140036 0.14922781 -4.114539
## ENSG00000267303.1 CTD-2369P2.12  14.16784      1.8586438 0.45894723  4.049798
##                                       pvalue         padj
## ENSG00000274611.4 TBC1D3        4.943970e-12 1.084460e-07
## ENSG00000278599.6 TBC1D3E       4.192497e-09 4.598122e-05
## ENSG00000280035.1 RP11-10J21.2  1.213438e-05 7.245086e-02
## ENSG00000203999.9 LINC01270     1.644490e-05 7.245086e-02
## ENSG00000203814.6 H2BC18        1.651490e-05 7.245086e-02
## ENSG00000211652.2 IGLV7-43      2.110636e-05 7.716132e-02
## ENSG00000211655.3 IGLV1-36      3.521917e-05 9.455306e-02
## ENSG00000225764.2 P3H2-AS1      3.851906e-05 9.455306e-02
## ENSG00000211679.2 IGLC3         3.879542e-05 9.455306e-02
## ENSG00000267303.1 CTD-2369P2.12 5.126177e-05 1.124427e-01
mean(abs(dge$stat))
## [1] 0.89465
crp_t0_a <- dge

# model with clinical and cell covariates
# Monocytes.C NK T.CD8.Memory T.CD4.Naive Neutrophils.LD
dds <- DESeqDataSetFromMatrix(countData = mx , colData = ss2,
  design = ~ sexD + wound_typeOP + duration_sx + ethnicityCAT + ageCS +
    Monocytes.C + NK + T.CD8.Memory + T.CD4.Naive + Neutrophils.LD + crp_group )
## converting counts to integer mode
## Warning in DESeqDataSet(se, design = design, ignoreRank): some variables in
## design formula are characters, converting to factors
##   the design formula contains one or more numeric variables with integer values,
##   specifying a model with increasing fold change for higher values.
##   did you mean for this to be a factor? if so, first convert
##   this variable to a factor using the factor() function
##   the design formula contains one or more numeric variables that have mean or
##   standard deviation larger than 5 (an arbitrary threshold to trigger this message).
##   Including numeric variables with large mean can induce collinearity with the intercept.
##   Users should center and scale numeric variables in the design to improve GLM convergence.
##   Note: levels of factors in the design contain characters other than
##   letters, numbers, '_' and '.'. It is recommended (but not required) to use
##   only letters, numbers, and delimiters '_' or '.', as these are safe characters
##   for column names in R. [This is a message, not a warning or an error]
res <- DESeq(dds)
## estimating size factors
##   Note: levels of factors in the design contain characters other than
##   letters, numbers, '_' and '.'. It is recommended (but not required) to use
##   only letters, numbers, and delimiters '_' or '.', as these are safe characters
##   for column names in R. [This is a message, not a warning or an error]
## estimating dispersions
## gene-wise dispersion estimates
## mean-dispersion relationship
##   Note: levels of factors in the design contain characters other than
##   letters, numbers, '_' and '.'. It is recommended (but not required) to use
##   only letters, numbers, and delimiters '_' or '.', as these are safe characters
##   for column names in R. [This is a message, not a warning or an error]
## final dispersion estimates
## fitting model and testing
## 64 rows did not converge in beta, labelled in mcols(object)$betaConv. Use larger maxit argument with nbinomWaldTest
z <- results(res)
vsd <- vst(dds, blind=FALSE)
##   Note: levels of factors in the design contain characters other than
##   letters, numbers, '_' and '.'. It is recommended (but not required) to use
##   only letters, numbers, and delimiters '_' or '.', as these are safe characters
##   for column names in R. [This is a message, not a warning or an error]
zz <- cbind(as.data.frame(z),assay(vsd))
dge <- as.data.frame(zz[order(zz$pvalue),])
head(dge[order(dge$pvalue),1:6],10)
##                                   baseMean log2FoldChange      lfcSE      stat
## ENSG00000159189.12 C1QC           45.19243    -0.61040271 0.11320809 -5.391865
## ENSG00000087116.16 ADAMTS2       144.89306    -0.85240097 0.18580458 -4.587621
## ENSG00000211679.2 IGLC3          802.12582    -0.62143112 0.13983515 -4.444027
## ENSG00000173372.17 C1QA          192.01764    -0.39137607 0.09031117 -4.333640
## ENSG00000203999.9 LINC01270      118.07792     0.22311851 0.05197879  4.292491
## ENSG00000173369.17 C1QB           92.28254    -0.43614730 0.10549032 -4.134477
## ENSG00000213614.11 HEXA         3639.45630    -0.06053357 0.01485216 -4.075741
## ENSG00000255446.1 CTD-2531D15.4   17.55993     0.76019150 0.18656840  4.074600
## ENSG00000225764.2 P3H2-AS1        10.20911     0.38295801 0.09524856  4.020618
## ENSG00000211652.2 IGLV7-43        52.51336    -0.56403860 0.14280690 -3.949659
##                                       pvalue        padj
## ENSG00000159189.12 C1QC         6.973031e-08 0.001529534
## ENSG00000087116.16 ADAMTS2      4.483259e-06 0.049170146
## ENSG00000211679.2 IGLC3         8.829069e-06 0.064555213
## ENSG00000173372.17 C1QA         1.466640e-05 0.077509273
## ENSG00000203999.9 LINC01270     1.766794e-05 0.077509273
## ENSG00000173369.17 C1QB         3.557638e-05 0.126382864
## ENSG00000213614.11 HEXA         4.586806e-05 0.126382864
## ENSG00000255446.1 CTD-2531D15.4 4.609359e-05 0.126382864
## ENSG00000225764.2 P3H2-AS1      5.804578e-05 0.141470463
## ENSG00000211652.2 IGLV7-43      7.826251e-05 0.164623107
mean(abs(dge$stat))
## [1] 0.9127845
crp_t0_a_adj <- dge

CRP low vs high at t=0 treatment group B

mx <- xt0f
ss2 <- as.data.frame(cbind(ss_t0,sscell_t0))
ss2 <- subset(ss2,treatment_group==2)
mx <- mx[,colnames(mx) %in% rownames(ss2)]

# base model
dds <- DESeqDataSetFromMatrix(countData = mx , colData = ss2,
  design = ~ crp_group )
## converting counts to integer mode
##   the design formula contains one or more numeric variables with integer values,
##   specifying a model with increasing fold change for higher values.
##   did you mean for this to be a factor? if so, first convert
##   this variable to a factor using the factor() function
res <- DESeq(dds)
## estimating size factors
## estimating dispersions
## gene-wise dispersion estimates
## mean-dispersion relationship
## final dispersion estimates
## fitting model and testing
## -- replacing outliers and refitting for 698 genes
## -- DESeq argument 'minReplicatesForReplace' = 7 
## -- original counts are preserved in counts(dds)
## estimating dispersions
## fitting model and testing
z <- results(res)
vsd <- vst(dds, blind=FALSE)
zz <- cbind(as.data.frame(z),assay(vsd))
dge <- as.data.frame(zz[order(zz$pvalue),])
head(dge[order(dge$pvalue),1:6],10)
##                               baseMean log2FoldChange      lfcSE      stat
## ENSG00000274012.1 RN7SL2   1005.235348      0.3958682 0.08669141  4.566406
## ENSG00000276168.1 RN7SL1    552.306545      0.3503249 0.07971834  4.394533
## ENSG00000165029.17 ABCA1    676.864267     -0.2828435 0.07210273 -3.922786
## ENSG00000050767.18 COL23A1   32.027614      0.3304131 0.08555804  3.861860
## ENSG00000134321.13 RSAD2    562.578486     -0.3324054 0.08678497 -3.830218
## ENSG00000183117.19 CSMD1     45.694830     -0.4349344 0.11463824 -3.793973
## ENSG00000160179.19 ABCG1    431.970974     -0.1967463 0.05391060 -3.649492
## ENSG00000170153.11 RNF150     8.709392     -0.6451407 0.18034165 -3.577325
## ENSG00000196565.15 HBG2     259.037625      0.6586983 0.18849443  3.494524
## ENSG00000049247.14 UTS2      39.902866      0.3607631 0.10531292  3.425630
##                                  pvalue      padj
## ENSG00000274012.1 RN7SL2   4.961569e-06 0.1088320
## ENSG00000276168.1 RN7SL1   1.110112e-05 0.1217515
## ENSG00000165029.17 ABCA1   8.753099e-05 0.5419992
## ENSG00000050767.18 COL23A1 1.125272e-04 0.5419992
## ENSG00000134321.13 RSAD2   1.280297e-04 0.5419992
## ENSG00000183117.19 CSMD1   1.482560e-04 0.5419992
## ENSG00000160179.19 ABCG1   2.627594e-04 0.8233755
## ENSG00000170153.11 RNF150  3.471282e-04 0.9483616
## ENSG00000196565.15 HBG2    4.749080e-04 0.9483616
## ENSG00000049247.14 UTS2    6.133744e-04 0.9483616
mean(abs(dge$stat))
## [1] 0.8139089
# model with clinical covariates
dds <- DESeqDataSetFromMatrix(countData = mx , colData = ss2,
  design = ~ sexD + wound_typeOP + duration_sx + ethnicityCAT + ageCS + crp_group )
## converting counts to integer mode
## Warning in DESeqDataSet(se, design = design, ignoreRank): some variables in
## design formula are characters, converting to factors
##   the design formula contains one or more numeric variables with integer values,
##   specifying a model with increasing fold change for higher values.
##   did you mean for this to be a factor? if so, first convert
##   this variable to a factor using the factor() function
##   Note: levels of factors in the design contain characters other than
##   letters, numbers, '_' and '.'. It is recommended (but not required) to use
##   only letters, numbers, and delimiters '_' or '.', as these are safe characters
##   for column names in R. [This is a message, not a warning or an error]
res <- DESeq(dds)
## estimating size factors
##   Note: levels of factors in the design contain characters other than
##   letters, numbers, '_' and '.'. It is recommended (but not required) to use
##   only letters, numbers, and delimiters '_' or '.', as these are safe characters
##   for column names in R. [This is a message, not a warning or an error]
## estimating dispersions
## gene-wise dispersion estimates
## mean-dispersion relationship
##   Note: levels of factors in the design contain characters other than
##   letters, numbers, '_' and '.'. It is recommended (but not required) to use
##   only letters, numbers, and delimiters '_' or '.', as these are safe characters
##   for column names in R. [This is a message, not a warning or an error]
## final dispersion estimates
## fitting model and testing
## 12 rows did not converge in beta, labelled in mcols(object)$betaConv. Use larger maxit argument with nbinomWaldTest
z <- results(res)
vsd <- vst(dds, blind=FALSE)
##   Note: levels of factors in the design contain characters other than
##   letters, numbers, '_' and '.'. It is recommended (but not required) to use
##   only letters, numbers, and delimiters '_' or '.', as these are safe characters
##   for column names in R. [This is a message, not a warning or an error]
zz <- cbind(as.data.frame(z),assay(vsd))
dge <- as.data.frame(zz[order(zz$pvalue),])
head(dge[order(dge$pvalue),1:6],10)
##                                   baseMean log2FoldChange      lfcSE      stat
## ENSG00000261026.1 CTD-3247F14.2   17.85183     -1.5571374 0.32799079 -4.747503
## ENSG00000078114.19 NEBL           35.44421     -0.8971179 0.19693027 -4.555510
## ENSG00000181126.13 HLA-V         336.08002     -0.6596009 0.14626672 -4.509576
## ENSG00000243224.1 RP5-1157M23.2   44.63609      0.2250026 0.05160220  4.360330
## ENSG00000139287.13 TPH2           42.04591     -0.1966640 0.04960475 -3.964621
## ENSG00000152767.17 FARP1         160.37684     -0.1615427 0.04078672 -3.960669
## ENSG00000123838.11 C4BPA          52.54006     -1.0736830 0.27120620 -3.958918
## ENSG00000254681.6 PKD1P5        2181.95360      0.3720053 0.09477315  3.925218
## ENSG00000119922.11 IFIT2        1651.64063     -0.5395922 0.13801521 -3.909657
## ENSG00000234200.2 U82671.8         7.77978     -3.3290304 0.85769092 -3.881387
##                                       pvalue       padj
## ENSG00000261026.1 CTD-3247F14.2 2.059429e-06 0.04517357
## ENSG00000078114.19 NEBL         5.225851e-06 0.04749455
## ENSG00000181126.13 HLA-V        6.495722e-06 0.04749455
## ENSG00000243224.1 RP5-1157M23.2 1.298667e-05 0.07121566
## ENSG00000139287.13 TPH2         7.351253e-05 0.21875264
## ENSG00000152767.17 FARP1        7.474008e-05 0.21875264
## ENSG00000123838.11 C4BPA        7.529022e-05 0.21875264
## ENSG00000254681.6 PKD1P5        8.665112e-05 0.21875264
## ENSG00000119922.11 IFIT2        9.242716e-05 0.21875264
## ENSG00000234200.2 U82671.8      1.038624e-04 0.21875264
mean(abs(dge$stat))
## [1] 1.048836
crp_t0_b <- dge

# model with clinical and cell covariates
# Monocytes.C NK T.CD8.Memory T.CD4.Naive Neutrophils.LD
dds <- DESeqDataSetFromMatrix(countData = mx , colData = ss2,
  design = ~ sexD + wound_typeOP + duration_sx + ethnicityCAT + ageCS +
    Monocytes.C + NK + T.CD8.Memory + T.CD4.Naive + Neutrophils.LD + crp_group )
## converting counts to integer mode
## Warning in DESeqDataSet(se, design = design, ignoreRank): some variables in
## design formula are characters, converting to factors
##   the design formula contains one or more numeric variables with integer values,
##   specifying a model with increasing fold change for higher values.
##   did you mean for this to be a factor? if so, first convert
##   this variable to a factor using the factor() function
##   the design formula contains one or more numeric variables that have mean or
##   standard deviation larger than 5 (an arbitrary threshold to trigger this message).
##   Including numeric variables with large mean can induce collinearity with the intercept.
##   Users should center and scale numeric variables in the design to improve GLM convergence.
##   Note: levels of factors in the design contain characters other than
##   letters, numbers, '_' and '.'. It is recommended (but not required) to use
##   only letters, numbers, and delimiters '_' or '.', as these are safe characters
##   for column names in R. [This is a message, not a warning or an error]
res <- DESeq(dds)
## estimating size factors
##   Note: levels of factors in the design contain characters other than
##   letters, numbers, '_' and '.'. It is recommended (but not required) to use
##   only letters, numbers, and delimiters '_' or '.', as these are safe characters
##   for column names in R. [This is a message, not a warning or an error]
## estimating dispersions
## gene-wise dispersion estimates
## mean-dispersion relationship
##   Note: levels of factors in the design contain characters other than
##   letters, numbers, '_' and '.'. It is recommended (but not required) to use
##   only letters, numbers, and delimiters '_' or '.', as these are safe characters
##   for column names in R. [This is a message, not a warning or an error]
## final dispersion estimates
## fitting model and testing
## 35 rows did not converge in beta, labelled in mcols(object)$betaConv. Use larger maxit argument with nbinomWaldTest
z <- results(res)
vsd <- vst(dds, blind=FALSE)
##   Note: levels of factors in the design contain characters other than
##   letters, numbers, '_' and '.'. It is recommended (but not required) to use
##   only letters, numbers, and delimiters '_' or '.', as these are safe characters
##   for column names in R. [This is a message, not a warning or an error]
zz <- cbind(as.data.frame(z),assay(vsd))
dge <- as.data.frame(zz[order(zz$pvalue),])
head(dge[order(dge$pvalue),1:6],10)
##                                   baseMean log2FoldChange      lfcSE      stat
## ENSG00000074803.20 SLC12A1        35.08453      0.9222055 0.20492880  4.500126
## ENSG00000181126.13 HLA-V         336.08002     -0.6874493 0.15532026 -4.426012
## ENSG00000260447.1 RP11-304L19.2   11.22085      0.5616031 0.13834177  4.059534
## ENSG00000243224.1 RP5-1157M23.2   44.63609      0.1916944 0.04730875  4.051987
## ENSG00000102854.16 MSLN           53.97058     -0.8921579 0.22198675 -4.018969
## ENSG00000268734.1 CTB-61M7.2      10.41006     -2.4530508 0.64671269 -3.793108
## ENSG00000274012.1 RN7SL2        1005.23535      0.4319977 0.11522675  3.749110
## ENSG00000154620.6 TMSB4Y          57.87988     -0.3468061 0.09388817 -3.693821
## ENSG00000249021.1 CTC-505O3.3     12.00956     -0.2429091 0.06703903 -3.623398
## ENSG00000275329.1 RP11-83N9.6      9.92069      0.3085148 0.08571373  3.599363
##                                       pvalue      padj
## ENSG00000074803.20 SLC12A1      6.791310e-06 0.1052785
## ENSG00000181126.13 HLA-V        9.599131e-06 0.1052785
## ENSG00000260447.1 RP11-304L19.2 4.917078e-05 0.2564349
## ENSG00000243224.1 RP5-1157M23.2 5.078452e-05 0.2564349
## ENSG00000102854.16 MSLN         5.845336e-05 0.2564349
## ENSG00000268734.1 CTB-61M7.2    1.487737e-04 0.5438918
## ENSG00000274012.1 RN7SL2        1.774633e-04 0.5560939
## ENSG00000154620.6 TMSB4Y        2.209090e-04 0.6057049
## ENSG00000249021.1 CTC-505O3.3   2.907582e-04 0.6556247
## ENSG00000275329.1 RP11-83N9.6   3.189981e-04 0.6556247
mean(abs(dge$stat))
## [1] 0.9050166
crp_t0_b_adj <- dge

CRP low vs high at EOS treatment group A

mx <- xeosf
ss2 <- as.data.frame(cbind(ss_eos,sscell_eos))
ss2 <- subset(ss2,treatment_group==1)
mx <- mx[,colnames(mx) %in% rownames(ss2)]

# base model
dds <- DESeqDataSetFromMatrix(countData = mx , colData = ss2,
  design = ~ crp_group )
## converting counts to integer mode
##   the design formula contains one or more numeric variables with integer values,
##   specifying a model with increasing fold change for higher values.
##   did you mean for this to be a factor? if so, first convert
##   this variable to a factor using the factor() function
res <- DESeq(dds)
## estimating size factors
## estimating dispersions
## gene-wise dispersion estimates
## mean-dispersion relationship
## final dispersion estimates
## fitting model and testing
## -- replacing outliers and refitting for 147 genes
## -- DESeq argument 'minReplicatesForReplace' = 7 
## -- original counts are preserved in counts(dds)
## estimating dispersions
## fitting model and testing
z <- results(res)
vsd <- vst(dds, blind=FALSE)
zz <- cbind(as.data.frame(z),assay(vsd))
dge <- as.data.frame(zz[order(zz$pvalue),])
head(dge[order(dge$pvalue),1:6],10)
##                              baseMean log2FoldChange      lfcSE       stat
## ENSG00000234200.2 U82671.8   23.74781     -8.4175144 0.77303756 -10.888881
## ENSG00000204936.10 CD177   2664.36071      1.3040566 0.17489685   7.456147
## ENSG00000139572.4 GPR84     194.83068      0.9793090 0.14085127   6.952788
## ENSG00000170525.21 PFKFB3  4648.61993      0.6889378 0.10435049   6.602152
## ENSG00000176597.12 B3GNT5   364.32833      0.6671879 0.10515716   6.344674
## ENSG00000132170.24 PPARG    105.03591      0.8466718 0.13451424   6.294291
## ENSG00000079385.23 CEACAM1 1083.04204      0.9180621 0.14625935   6.276946
## ENSG00000187775.17 DNAH17   603.73830      0.4485171 0.07177030   6.249342
## ENSG00000136634.7 IL10       75.57604      0.7835233 0.12565466   6.235529
## ENSG00000135916.16 ITM2C    660.76621     -0.3402779 0.05494465  -6.193103
##                                  pvalue         padj
## ENSG00000234200.2 U82671.8 1.302299e-27 2.873783e-23
## ENSG00000204936.10 CD177   8.908934e-14 9.829672e-10
## ENSG00000139572.4 GPR84    3.581374e-12 2.634339e-08
## ENSG00000170525.21 PFKFB3  4.052308e-11 2.235557e-07
## ENSG00000176597.12 B3GNT5  2.228974e-10 9.837353e-07
## ENSG00000132170.24 PPARG   3.088083e-10 1.088493e-06
## ENSG00000079385.23 CEACAM1 3.452870e-10 1.088493e-06
## ENSG00000187775.17 DNAH17  4.121860e-10 1.103974e-06
## ENSG00000136634.7 IL10     4.502544e-10 1.103974e-06
## ENSG00000135916.16 ITM2C   5.899107e-10 1.301756e-06
mean(abs(dge$stat))
## [1] 1.38808
# model with clinical covariates
dds <- DESeqDataSetFromMatrix(countData = mx , colData = ss2,
  design = ~ sexD + wound_typeOP + duration_sx + ethnicityCAT + ageCS + crp_group )
## converting counts to integer mode
## Warning in DESeqDataSet(se, design = design, ignoreRank): some variables in
## design formula are characters, converting to factors
##   the design formula contains one or more numeric variables with integer values,
##   specifying a model with increasing fold change for higher values.
##   did you mean for this to be a factor? if so, first convert
##   this variable to a factor using the factor() function
##   Note: levels of factors in the design contain characters other than
##   letters, numbers, '_' and '.'. It is recommended (but not required) to use
##   only letters, numbers, and delimiters '_' or '.', as these are safe characters
##   for column names in R. [This is a message, not a warning or an error]
res <- DESeq(dds)
## estimating size factors
##   Note: levels of factors in the design contain characters other than
##   letters, numbers, '_' and '.'. It is recommended (but not required) to use
##   only letters, numbers, and delimiters '_' or '.', as these are safe characters
##   for column names in R. [This is a message, not a warning or an error]
## estimating dispersions
## gene-wise dispersion estimates
## mean-dispersion relationship
##   Note: levels of factors in the design contain characters other than
##   letters, numbers, '_' and '.'. It is recommended (but not required) to use
##   only letters, numbers, and delimiters '_' or '.', as these are safe characters
##   for column names in R. [This is a message, not a warning or an error]
## final dispersion estimates
## fitting model and testing
## 16 rows did not converge in beta, labelled in mcols(object)$betaConv. Use larger maxit argument with nbinomWaldTest
z <- results(res)
vsd <- vst(dds, blind=FALSE)
##   Note: levels of factors in the design contain characters other than
##   letters, numbers, '_' and '.'. It is recommended (but not required) to use
##   only letters, numbers, and delimiters '_' or '.', as these are safe characters
##   for column names in R. [This is a message, not a warning or an error]
zz <- cbind(as.data.frame(z),assay(vsd))
dge <- as.data.frame(zz[order(zz$pvalue),])
head(dge[order(dge$pvalue),1:6],10)
##                                    baseMean log2FoldChange      lfcSE      stat
## ENSG00000278599.6 TBC1D3E          21.72131     -9.5091840 1.36712905 -6.955586
## ENSG00000258035.2 RP11-74K11.2     20.51590      0.7829509 0.14913630  5.249902
## ENSG00000076356.7 PLXNA2          257.73317      0.4637443 0.09006613  5.148932
## ENSG00000204936.10 CD177         2664.36071      1.1813741 0.23038336  5.127862
## ENSG00000159339.13 PADI4        13293.00692      0.8773302 0.17145591  5.116943
## ENSG00000283345.1 CTD-3092A11.3    36.24736     -0.8647693 0.17126294 -5.049366
## ENSG00000235750.10 KIAA0040      3047.27341      0.3626779 0.07233427  5.013916
## ENSG00000211966.2 IGHV5-51        190.52981     -0.6341490 0.12802140 -4.953461
## ENSG00000176597.12 B3GNT5         364.32833      0.6767111 0.13768368  4.914969
## ENSG00000203999.9 LINC01270       154.60133      0.5209756 0.10632606  4.899793
##                                       pvalue         padj
## ENSG00000278599.6 TBC1D3E       3.510989e-12 7.597430e-08
## ENSG00000258035.2 RP11-74K11.2  1.521803e-07 1.343898e-03
## ENSG00000076356.7 PLXNA2        2.619744e-07 1.343898e-03
## ENSG00000204936.10 CD177        2.930508e-07 1.343898e-03
## ENSG00000159339.13 PADI4        3.105268e-07 1.343898e-03
## ENSG00000283345.1 CTD-3092A11.3 4.432785e-07 1.598684e-03
## ENSG00000235750.10 KIAA0040     5.333326e-07 1.648683e-03
## ENSG00000211966.2 IGHV5-51      7.290485e-07 1.971985e-03
## ENSG00000176597.12 B3GNT5       8.879630e-07 2.075999e-03
## ENSG00000203999.9 LINC01270     9.593786e-07 2.075999e-03
mean(abs(dge$stat))
## [1] 1.342191
crp_eos_a <- dge

# model with clinical and cell covariates
# Monocytes.C NK T.CD8.Memory T.CD4.Naive Neutrophils.LD
dds <- DESeqDataSetFromMatrix(countData = mx , colData = ss2,
  design = ~ sexD + wound_typeOP + duration_sx + ethnicityCAT + ageCS +
    Monocytes.C + NK + T.CD8.Memory + T.CD4.Naive + Neutrophils.LD + crp_group )
## converting counts to integer mode
## Warning in DESeqDataSet(se, design = design, ignoreRank): some variables in
## design formula are characters, converting to factors
##   the design formula contains one or more numeric variables with integer values,
##   specifying a model with increasing fold change for higher values.
##   did you mean for this to be a factor? if so, first convert
##   this variable to a factor using the factor() function
##   the design formula contains one or more numeric variables that have mean or
##   standard deviation larger than 5 (an arbitrary threshold to trigger this message).
##   Including numeric variables with large mean can induce collinearity with the intercept.
##   Users should center and scale numeric variables in the design to improve GLM convergence.
##   Note: levels of factors in the design contain characters other than
##   letters, numbers, '_' and '.'. It is recommended (but not required) to use
##   only letters, numbers, and delimiters '_' or '.', as these are safe characters
##   for column names in R. [This is a message, not a warning or an error]
res <- DESeq(dds)
## estimating size factors
##   Note: levels of factors in the design contain characters other than
##   letters, numbers, '_' and '.'. It is recommended (but not required) to use
##   only letters, numbers, and delimiters '_' or '.', as these are safe characters
##   for column names in R. [This is a message, not a warning or an error]
## estimating dispersions
## gene-wise dispersion estimates
## mean-dispersion relationship
##   Note: levels of factors in the design contain characters other than
##   letters, numbers, '_' and '.'. It is recommended (but not required) to use
##   only letters, numbers, and delimiters '_' or '.', as these are safe characters
##   for column names in R. [This is a message, not a warning or an error]
## final dispersion estimates
## fitting model and testing
## 39 rows did not converge in beta, labelled in mcols(object)$betaConv. Use larger maxit argument with nbinomWaldTest
z <- results(res)
vsd <- vst(dds, blind=FALSE)
##   Note: levels of factors in the design contain characters other than
##   letters, numbers, '_' and '.'. It is recommended (but not required) to use
##   only letters, numbers, and delimiters '_' or '.', as these are safe characters
##   for column names in R. [This is a message, not a warning or an error]
zz <- cbind(as.data.frame(z),assay(vsd))
dge <- as.data.frame(zz[order(zz$pvalue),])
head(dge[order(dge$pvalue),1:6],10)
##                                    baseMean log2FoldChange      lfcSE      stat
## ENSG00000278599.6 TBC1D3E         21.721315    -10.2553792 1.57048944 -6.530053
## ENSG00000283345.1 CTD-3092A11.3   36.247361     -1.0143138 0.19599438 -5.175219
## ENSG00000282339.1 LLNLF-176F2.1    8.210905     -7.0092066 1.56534067 -4.477752
## ENSG00000228668.1 TRGV5P          68.256402     -0.6121273 0.14417889 -4.245609
## ENSG00000102524.12 TNFSF13B     1626.167180      0.2026085 0.04878493  4.153095
## ENSG00000233937.7 CTC-338M12.4   139.717383     -0.1962152 0.04828903 -4.063350
## ENSG00000087116.16 ADAMTS2       779.297104     -0.8224640 0.21388124 -3.845424
## ENSG00000260271.3 RP1-45N11.1     58.349444      0.2237876 0.05997524  3.731333
## ENSG00000204001.10 LCN8           74.503582      1.3200722 0.35412885  3.727661
## ENSG00000258035.2 RP11-74K11.2    20.515904      0.4374891 0.12062897  3.626734
##                                       pvalue         padj
## ENSG00000278599.6 TBC1D3E       6.574645e-11 1.450827e-06
## ENSG00000283345.1 CTD-3092A11.3 2.276443e-07 2.511713e-03
## ENSG00000282339.1 LLNLF-176F2.1 7.543333e-06 5.548624e-02
## ENSG00000228668.1 TRGV5P        2.180001e-05 1.202652e-01
## ENSG00000102524.12 TNFSF13B     3.280081e-05 1.447631e-01
## ENSG00000233937.7 CTC-338M12.4  4.837345e-05 1.779095e-01
## ENSG00000087116.16 ADAMTS2      1.203443e-04 3.793770e-01
## ENSG00000260271.3 RP1-45N11.1   1.904693e-04 4.738652e-01
## ENSG00000204001.10 LCN8         1.932654e-04 4.738652e-01
## ENSG00000258035.2 RP11-74K11.2  2.870291e-04 5.974092e-01
mean(abs(dge$stat))
## [1] 0.8431227
crp_eos_a_adj <- dge

CRP low vs high at EOS treatment group B

mx <- xeosf
ss2 <- as.data.frame(cbind(ss_eos,sscell_eos))
ss2 <- subset(ss2,treatment_group==2)
mx <- mx[,colnames(mx) %in% rownames(ss2)]

# base model
dds <- DESeqDataSetFromMatrix(countData = mx , colData = ss2,
  design = ~ crp_group )
## converting counts to integer mode
##   the design formula contains one or more numeric variables with integer values,
##   specifying a model with increasing fold change for higher values.
##   did you mean for this to be a factor? if so, first convert
##   this variable to a factor using the factor() function
res <- DESeq(dds)
## estimating size factors
## estimating dispersions
## gene-wise dispersion estimates
## mean-dispersion relationship
## final dispersion estimates
## fitting model and testing
## -- replacing outliers and refitting for 128 genes
## -- DESeq argument 'minReplicatesForReplace' = 7 
## -- original counts are preserved in counts(dds)
## estimating dispersions
## fitting model and testing
z <- results(res)
vsd <- vst(dds, blind=FALSE)
zz <- cbind(as.data.frame(z),assay(vsd))
dge <- as.data.frame(zz[order(zz$pvalue),])
head(dge[order(dge$pvalue),1:6],10)
##                                   baseMean log2FoldChange      lfcSE      stat
## ENSG00000254873.1 RP11-770J1.5    47.54511     -0.5668914 0.10956959 -5.173802
## ENSG00000224370.1 RP11-814E24.3   49.76184      0.4472603 0.09003302  4.967737
## ENSG00000241860.7 RP11-34P13.13 4903.99846      0.3733341 0.07548746  4.945644
## ENSG00000236911.6 RP11-78B10.2    74.74105      0.5093406 0.10317766  4.936539
## ENSG00000238035.8 AC138035.2    1313.25226      0.3740127 0.07824059  4.780290
## ENSG00000280279.1 LINC02887      485.42034      0.3717109 0.07800330  4.765323
## ENSG00000101187.16 SLCO4A1        97.59953      0.5650296 0.11859698  4.764283
## ENSG00000260528.5 FAM157C       3056.40251      0.3665312 0.07752802  4.727726
## ENSG00000230724.9 LINC01001     3269.93917      0.3263093 0.06964405  4.685387
## ENSG00000264769.1 RP11-498C9.12   41.75148      0.2941786 0.06310258  4.661910
##                                       pvalue        padj
## ENSG00000254873.1 RP11-770J1.5  2.293775e-07 0.004386980
## ENSG00000224370.1 RP11-814E24.3 6.773878e-07 0.004386980
## ENSG00000241860.7 RP11-34P13.13 7.589257e-07 0.004386980
## ENSG00000236911.6 RP11-78B10.2  7.952109e-07 0.004386980
## ENSG00000238035.8 AC138035.2    1.750423e-06 0.005974689
## ENSG00000280279.1 LINC02887     1.885513e-06 0.005974689
## ENSG00000101187.16 SLCO4A1      1.895265e-06 0.005974689
## ENSG00000260528.5 FAM157C       2.270486e-06 0.006262853
## ENSG00000230724.9 LINC01001     2.794320e-06 0.006349407
## ENSG00000264769.1 RP11-498C9.12 3.132880e-06 0.006349407
mean(abs(dge$stat))
## [1] 1.041369
# model with clinical covariates
dds <- DESeqDataSetFromMatrix(countData = mx , colData = ss2,
  design = ~ sexD + wound_typeOP + duration_sx + ethnicityCAT + ageCS + crp_group )
## converting counts to integer mode
## Warning in DESeqDataSet(se, design = design, ignoreRank): some variables in
## design formula are characters, converting to factors
##   the design formula contains one or more numeric variables with integer values,
##   specifying a model with increasing fold change for higher values.
##   did you mean for this to be a factor? if so, first convert
##   this variable to a factor using the factor() function
##   Note: levels of factors in the design contain characters other than
##   letters, numbers, '_' and '.'. It is recommended (but not required) to use
##   only letters, numbers, and delimiters '_' or '.', as these are safe characters
##   for column names in R. [This is a message, not a warning or an error]
res <- DESeq(dds)
## estimating size factors
##   Note: levels of factors in the design contain characters other than
##   letters, numbers, '_' and '.'. It is recommended (but not required) to use
##   only letters, numbers, and delimiters '_' or '.', as these are safe characters
##   for column names in R. [This is a message, not a warning or an error]
## estimating dispersions
## gene-wise dispersion estimates
## mean-dispersion relationship
##   Note: levels of factors in the design contain characters other than
##   letters, numbers, '_' and '.'. It is recommended (but not required) to use
##   only letters, numbers, and delimiters '_' or '.', as these are safe characters
##   for column names in R. [This is a message, not a warning or an error]
## final dispersion estimates
## fitting model and testing
## 6 rows did not converge in beta, labelled in mcols(object)$betaConv. Use larger maxit argument with nbinomWaldTest
z <- results(res)
vsd <- vst(dds, blind=FALSE)
##   Note: levels of factors in the design contain characters other than
##   letters, numbers, '_' and '.'. It is recommended (but not required) to use
##   only letters, numbers, and delimiters '_' or '.', as these are safe characters
##   for column names in R. [This is a message, not a warning or an error]
zz <- cbind(as.data.frame(z),assay(vsd))
dge <- as.data.frame(zz[order(zz$pvalue),])
head(dge[order(dge$pvalue),1:6],10)
##                                  baseMean log2FoldChange      lfcSE      stat
## ENSG00000181126.13 HLA-V        396.17882     -0.8065180 0.16968812 -4.752943
## ENSG00000254873.1 RP11-770J1.5   47.54511     -0.5826915 0.13036812 -4.469586
## ENSG00000175874.10 CREG2         15.85760      0.3267149 0.07358462  4.439989
## ENSG00000074803.20 SLC12A1       36.66028      0.8797267 0.20623352  4.265682
## ENSG00000147852.17 VLDLR         60.44142      0.2384517 0.05590948  4.264959
## ENSG00000136274.9 NACAD          13.87223     -0.6254904 0.14828300 -4.218221
## ENSG00000158321.18 AUTS2       1107.33233      0.2789351 0.07162732  3.894256
## ENSG00000241484.10 ARHGAP8       48.02920      0.3161707 0.08197094  3.857107
## ENSG00000179841.8 AKAP5         164.98261      0.2475874 0.06420904  3.855958
## ENSG00000043514.17 TRIT1        438.15726     -0.1127517 0.02930561 -3.847443
##                                      pvalue       padj
## ENSG00000181126.13 HLA-V       2.004768e-06 0.04423922
## ENSG00000254873.1 RP11-770J1.5 7.837117e-06 0.06617416
## ENSG00000175874.10 CREG2       8.996352e-06 0.06617416
## ENSG00000074803.20 SLC12A1     1.992921e-05 0.08824094
## ENSG00000147852.17 VLDLR       1.999387e-05 0.08824094
## ENSG00000136274.9 NACAD        2.462376e-05 0.09056209
## ENSG00000158321.18 AUTS2       9.850051e-05 0.26338539
## ENSG00000241484.10 ARHGAP8     1.147368e-04 0.26338539
## ENSG00000179841.8 AKAP5        1.152772e-04 0.26338539
## ENSG00000043514.17 TRIT1       1.193571e-04 0.26338539
mean(abs(dge$stat))
## [1] 0.8858688
crp_eos_b <- dge

# model with clinical and cell covariates
# Monocytes.C NK T.CD8.Memory T.CD4.Naive Neutrophils.LD
dds <- DESeqDataSetFromMatrix(countData = mx , colData = ss2,
  design = ~ sexD + wound_typeOP + duration_sx + ethnicityCAT + ageCS +
    Monocytes.C + NK + T.CD8.Memory + T.CD4.Naive + Neutrophils.LD + crp_group )
## converting counts to integer mode
## Warning in DESeqDataSet(se, design = design, ignoreRank): some variables in
## design formula are characters, converting to factors
##   the design formula contains one or more numeric variables with integer values,
##   specifying a model with increasing fold change for higher values.
##   did you mean for this to be a factor? if so, first convert
##   this variable to a factor using the factor() function
##   the design formula contains one or more numeric variables that have mean or
##   standard deviation larger than 5 (an arbitrary threshold to trigger this message).
##   Including numeric variables with large mean can induce collinearity with the intercept.
##   Users should center and scale numeric variables in the design to improve GLM convergence.
##   Note: levels of factors in the design contain characters other than
##   letters, numbers, '_' and '.'. It is recommended (but not required) to use
##   only letters, numbers, and delimiters '_' or '.', as these are safe characters
##   for column names in R. [This is a message, not a warning or an error]
res <- DESeq(dds)
## estimating size factors
##   Note: levels of factors in the design contain characters other than
##   letters, numbers, '_' and '.'. It is recommended (but not required) to use
##   only letters, numbers, and delimiters '_' or '.', as these are safe characters
##   for column names in R. [This is a message, not a warning or an error]
## estimating dispersions
## gene-wise dispersion estimates
## mean-dispersion relationship
##   Note: levels of factors in the design contain characters other than
##   letters, numbers, '_' and '.'. It is recommended (but not required) to use
##   only letters, numbers, and delimiters '_' or '.', as these are safe characters
##   for column names in R. [This is a message, not a warning or an error]
## final dispersion estimates
## fitting model and testing
## 42 rows did not converge in beta, labelled in mcols(object)$betaConv. Use larger maxit argument with nbinomWaldTest
z <- results(res)
vsd <- vst(dds, blind=FALSE)
##   Note: levels of factors in the design contain characters other than
##   letters, numbers, '_' and '.'. It is recommended (but not required) to use
##   only letters, numbers, and delimiters '_' or '.', as these are safe characters
##   for column names in R. [This is a message, not a warning or an error]
zz <- cbind(as.data.frame(z),assay(vsd))
dge <- as.data.frame(zz[order(zz$pvalue),])
head(dge[order(dge$pvalue),1:6],10)
##                                  baseMean log2FoldChange      lfcSE      stat
## ENSG00000074803.20 SLC12A1       36.66028      0.9974386 0.22461306  4.440697
## ENSG00000099139.14 PCSK5       1284.53014      0.3871194 0.09428587  4.105805
## ENSG00000175874.10 CREG2         15.85760      0.2917051 0.07128112  4.092320
## ENSG00000112799.9 LY86          950.19080     -0.1665188 0.04275946 -3.894314
## ENSG00000181126.13 HLA-V        396.17882     -0.7233685 0.18577054 -3.893882
## ENSG00000167680.17 SEMA6B       577.15312      0.6250133 0.16781047  3.724519
## ENSG00000225813.1 AC009299.4     13.97230      0.6532641 0.17553863  3.721484
## ENSG00000264522.6 OTUD7B        213.51620      0.1084653 0.02937036  3.693019
## ENSG00000254873.1 RP11-770J1.5   47.54511     -0.4819888 0.13089433 -3.682274
## ENSG00000188599.17 NPIPP1       219.50741     -0.1879393 0.05163696 -3.639628
##                                      pvalue      padj
## ENSG00000074803.20 SLC12A1     8.966780e-06 0.1978699
## ENSG00000099139.14 PCSK5       4.029098e-05 0.3141451
## ENSG00000175874.10 CREG2       4.270791e-05 0.3141451
## ENSG00000112799.9 LY86         9.847704e-05 0.4353942
## ENSG00000181126.13 HLA-V       9.865279e-05 0.4353942
## ENSG00000167680.17 SEMA6B      1.956880e-04 0.5667857
## ENSG00000225813.1 AC009299.4   1.980558e-04 0.5667857
## ENSG00000264522.6 OTUD7B       2.216079e-04 0.5667857
## ENSG00000254873.1 RP11-770J1.5 2.311629e-04 0.5667857
## ENSG00000188599.17 NPIPP1      2.730319e-04 0.6024996
mean(abs(dge$stat))
## [1] 0.8130102
crp_eos_b_adj <- dge

CRP low vs high at POD treatment group A

mx <- xpod1f
ss2 <- as.data.frame(cbind(ss_pod1,sscell_pod1))
ss2 <- subset(ss2,treatment_group==1)
mx <- mx[,colnames(mx) %in% rownames(ss2)]

# base model
dds <- DESeqDataSetFromMatrix(countData = mx , colData = ss2,
  design = ~ crp_group )
## converting counts to integer mode
##   the design formula contains one or more numeric variables with integer values,
##   specifying a model with increasing fold change for higher values.
##   did you mean for this to be a factor? if so, first convert
##   this variable to a factor using the factor() function
res <- DESeq(dds)
## estimating size factors
## estimating dispersions
## gene-wise dispersion estimates
## mean-dispersion relationship
## final dispersion estimates
## fitting model and testing
## -- replacing outliers and refitting for 189 genes
## -- DESeq argument 'minReplicatesForReplace' = 7 
## -- original counts are preserved in counts(dds)
## estimating dispersions
## fitting model and testing
z <- results(res)
vsd <- vst(dds, blind=FALSE)
zz <- cbind(as.data.frame(z),assay(vsd))
dge <- as.data.frame(zz[order(zz$pvalue),])
head(dge[order(dge$pvalue),1:6],10)
##                              baseMean log2FoldChange      lfcSE      stat
## ENSG00000007968.7 E2F2      650.98716      0.3793948 0.06004490  6.318518
## ENSG00000137869.15 CYP19A1   60.07323      0.9765750 0.15547632  6.281181
## ENSG00000157064.11 NMNAT2    41.43058      0.4835623 0.07985053  6.055844
## ENSG00000229647.2 MYOSLID    64.61066      0.3230300 0.05367352  6.018424
## ENSG00000165092.13 ALDH1A1  556.69422     -0.4848466 0.08067903 -6.009574
## ENSG00000145287.11 PLAC8   3561.63102      0.2630043 0.04382192  6.001663
## ENSG00000138821.14 SLC39A8  521.43838      0.2641136 0.04467962  5.911276
## ENSG00000132170.24 PPARG    144.66113      0.5565381 0.09494223  5.861861
## ENSG00000198018.7 ENTPD7    368.85840      0.2161036 0.03790805  5.700732
## ENSG00000116016.14 EPAS1    116.95950      0.3548271 0.06246220  5.680670
##                                  pvalue         padj
## ENSG00000007968.7 E2F2     2.640843e-10 2.955877e-06
## ENSG00000137869.15 CYP19A1 3.360096e-10 2.955877e-06
## ENSG00000157064.11 NMNAT2  1.396832e-09 5.727059e-06
## ENSG00000229647.2 MYOSLID  1.761237e-09 5.727059e-06
## ENSG00000165092.13 ALDH1A1 1.860109e-09 5.727059e-06
## ENSG00000145287.11 PLAC8   1.953072e-09 5.727059e-06
## ENSG00000138821.14 SLC39A8 3.394684e-09 8.532295e-06
## ENSG00000132170.24 PPARG   4.577089e-09 1.006616e-05
## ENSG00000198018.7 ENTPD7   1.192940e-08 2.332066e-05
## ENSG00000116016.14 EPAS1   1.341684e-08 2.360559e-05
mean(abs(dge$stat))
## [1] 1.199973
# model with clinical covariates
dds <- DESeqDataSetFromMatrix(countData = mx , colData = ss2,
  design = ~ sexD + wound_typeOP + duration_sx + ethnicityCAT + ageCS + crp_group )
## converting counts to integer mode
## Warning in DESeqDataSet(se, design = design, ignoreRank): some variables in
## design formula are characters, converting to factors
##   the design formula contains one or more numeric variables with integer values,
##   specifying a model with increasing fold change for higher values.
##   did you mean for this to be a factor? if so, first convert
##   this variable to a factor using the factor() function
##   Note: levels of factors in the design contain characters other than
##   letters, numbers, '_' and '.'. It is recommended (but not required) to use
##   only letters, numbers, and delimiters '_' or '.', as these are safe characters
##   for column names in R. [This is a message, not a warning or an error]
res <- DESeq(dds)
## estimating size factors
##   Note: levels of factors in the design contain characters other than
##   letters, numbers, '_' and '.'. It is recommended (but not required) to use
##   only letters, numbers, and delimiters '_' or '.', as these are safe characters
##   for column names in R. [This is a message, not a warning or an error]
## estimating dispersions
## gene-wise dispersion estimates
## mean-dispersion relationship
##   Note: levels of factors in the design contain characters other than
##   letters, numbers, '_' and '.'. It is recommended (but not required) to use
##   only letters, numbers, and delimiters '_' or '.', as these are safe characters
##   for column names in R. [This is a message, not a warning or an error]
## final dispersion estimates
## fitting model and testing
## 23 rows did not converge in beta, labelled in mcols(object)$betaConv. Use larger maxit argument with nbinomWaldTest
z <- results(res)
vsd <- vst(dds, blind=FALSE)
##   Note: levels of factors in the design contain characters other than
##   letters, numbers, '_' and '.'. It is recommended (but not required) to use
##   only letters, numbers, and delimiters '_' or '.', as these are safe characters
##   for column names in R. [This is a message, not a warning or an error]
zz <- cbind(as.data.frame(z),assay(vsd))
dge <- as.data.frame(zz[order(zz$pvalue),])
head(dge[order(dge$pvalue),1:6],10)
##                             baseMean log2FoldChange      lfcSE       stat
## ENSG00000274611.4 TBC1D3    51.46372    -29.9971014 1.33164948 -22.526274
## ENSG00000278599.6 TBC1D3E   16.34998    -24.6438767 1.33044880 -18.522980
## ENSG00000124508.17 BTN2A2 1048.79703     -0.1524054 0.02952679  -5.161599
## ENSG00000215883.11 CYB5RL  377.01565     -0.1494372 0.02926069  -5.107098
## ENSG00000145287.11 PLAC8  3561.63102      0.2386112 0.05025490   4.748019
## ENSG00000116016.14 EPAS1   116.95950      0.3652741 0.07758263   4.708195
## ENSG00000157064.11 NMNAT2   41.43058      0.4652492 0.10224666   4.550263
## ENSG00000132170.24 PPARG   144.66113      0.5281924 0.11718850   4.507203
## ENSG00000128928.10 IVD    1354.85885     -0.1506996 0.03353677  -4.493564
## ENSG00000229647.2 MYOSLID   64.61066      0.2852099 0.06372435   4.475682
##                                  pvalue          padj
## ENSG00000274611.4 TBC1D3  2.294649e-112 3.942437e-108
## ENSG00000278599.6 TBC1D3E  1.347666e-76            NA
## ENSG00000124508.17 BTN2A2  2.448497e-07  1.873552e-03
## ENSG00000215883.11 CYB5RL  3.271437e-07  1.873552e-03
## ENSG00000145287.11 PLAC8   2.054189e-06  8.587756e-03
## ENSG00000116016.14 EPAS1   2.499202e-06  8.587756e-03
## ENSG00000157064.11 NMNAT2  5.357881e-06  1.454044e-02
## ENSG00000132170.24 PPARG   6.568765e-06  1.454044e-02
## ENSG00000128928.10 IVD     7.004101e-06  1.454044e-02
## ENSG00000229647.2 MYOSLID  7.616782e-06  1.454044e-02
mean(abs(dge$stat))
## [1] 0.9984771
crp_pod1_a <- dge

# model with clinical and cell covariates
# Monocytes.C NK T.CD8.Memory T.CD4.Naive Neutrophils.LD
dds <- DESeqDataSetFromMatrix(countData = mx , colData = ss2,
  design = ~ sexD + wound_typeOP + duration_sx + ethnicityCAT + ageCS +
    Monocytes.C + NK + T.CD8.Memory + T.CD4.Naive + Neutrophils.LD + crp_group )
## converting counts to integer mode
## Warning in DESeqDataSet(se, design = design, ignoreRank): some variables in
## design formula are characters, converting to factors
##   the design formula contains one or more numeric variables with integer values,
##   specifying a model with increasing fold change for higher values.
##   did you mean for this to be a factor? if so, first convert
##   this variable to a factor using the factor() function
##   the design formula contains one or more numeric variables that have mean or
##   standard deviation larger than 5 (an arbitrary threshold to trigger this message).
##   Including numeric variables with large mean can induce collinearity with the intercept.
##   Users should center and scale numeric variables in the design to improve GLM convergence.
##   Note: levels of factors in the design contain characters other than
##   letters, numbers, '_' and '.'. It is recommended (but not required) to use
##   only letters, numbers, and delimiters '_' or '.', as these are safe characters
##   for column names in R. [This is a message, not a warning or an error]
res <- DESeq(dds)
## estimating size factors
##   Note: levels of factors in the design contain characters other than
##   letters, numbers, '_' and '.'. It is recommended (but not required) to use
##   only letters, numbers, and delimiters '_' or '.', as these are safe characters
##   for column names in R. [This is a message, not a warning or an error]
## estimating dispersions
## gene-wise dispersion estimates
## mean-dispersion relationship
##   Note: levels of factors in the design contain characters other than
##   letters, numbers, '_' and '.'. It is recommended (but not required) to use
##   only letters, numbers, and delimiters '_' or '.', as these are safe characters
##   for column names in R. [This is a message, not a warning or an error]
## final dispersion estimates
## fitting model and testing
## 44 rows did not converge in beta, labelled in mcols(object)$betaConv. Use larger maxit argument with nbinomWaldTest
z <- results(res)
vsd <- vst(dds, blind=FALSE)
##   Note: levels of factors in the design contain characters other than
##   letters, numbers, '_' and '.'. It is recommended (but not required) to use
##   only letters, numbers, and delimiters '_' or '.', as these are safe characters
##   for column names in R. [This is a message, not a warning or an error]
zz <- cbind(as.data.frame(z),assay(vsd))
dge <- as.data.frame(zz[order(zz$pvalue),])
head(dge[order(dge$pvalue),1:6],10)
##                               baseMean log2FoldChange      lfcSE      stat
## ENSG00000157064.11 NMNAT2     41.43058      0.4307897 0.07049745  6.110713
## ENSG00000137869.15 CYP19A1    60.07323      0.7601826 0.12811907  5.933407
## ENSG00000132170.24 PPARG     144.66113      0.4814874 0.08507043  5.659869
## ENSG00000188404.10 SELL    17514.30914      0.2026588 0.03680197  5.506737
## ENSG00000116016.14 EPAS1     116.95950      0.3446736 0.06274336  5.493387
## ENSG00000145287.11 PLAC8    3561.63102      0.2334478 0.04478158  5.213032
## ENSG00000124508.17 BTN2A2   1048.79703     -0.1590625 0.03058358 -5.200911
## ENSG00000148926.10 ADM      1409.50883      0.3668759 0.07139352  5.138785
## ENSG00000121316.11 PLBD1   16469.89344      0.2213555 0.04552841  4.861920
## ENSG00000213694.6 S1PR3     1119.21786     -0.2721949 0.05603887 -4.857252
##                                  pvalue         padj
## ENSG00000157064.11 NMNAT2  9.918731e-10 1.622109e-05
## ENSG00000137869.15 CYP19A1 2.967124e-09 2.426217e-05
## ENSG00000132170.24 PPARG   1.514889e-08 8.258167e-05
## ENSG00000188404.10 SELL    3.655462e-08 1.289671e-04
## ENSG00000116016.14 EPAS1   3.942984e-08 1.289671e-04
## ENSG00000145287.11 PLAC8   1.857793e-07 4.633183e-04
## ENSG00000124508.17 BTN2A2  1.983140e-07 4.633183e-04
## ENSG00000148926.10 ADM     2.765205e-07 5.652770e-04
## ENSG00000121316.11 PLBD1   1.162527e-06 1.835260e-03
## ENSG00000213694.6 S1PR3    1.190260e-06 1.835260e-03
mean(abs(dge$stat))
## [1] 1.026986
crp_pod1_a_adj <- dge

CRP low vs high at POD1 treatment group B

mx <- xpod1f
ss2 <- as.data.frame(cbind(ss_pod1,sscell_pod1))
ss2 <- subset(ss2,treatment_group==2)
mx <- mx[,colnames(mx) %in% rownames(ss2)]

# base model
dds <- DESeqDataSetFromMatrix(countData = mx , colData = ss2,
  design = ~ crp_group )
## converting counts to integer mode
##   the design formula contains one or more numeric variables with integer values,
##   specifying a model with increasing fold change for higher values.
##   did you mean for this to be a factor? if so, first convert
##   this variable to a factor using the factor() function
res <- DESeq(dds)
## estimating size factors
## estimating dispersions
## gene-wise dispersion estimates
## mean-dispersion relationship
## final dispersion estimates
## fitting model and testing
## -- replacing outliers and refitting for 155 genes
## -- DESeq argument 'minReplicatesForReplace' = 7 
## -- original counts are preserved in counts(dds)
## estimating dispersions
## fitting model and testing
z <- results(res)
vsd <- vst(dds, blind=FALSE)
zz <- cbind(as.data.frame(z),assay(vsd))
dge <- as.data.frame(zz[order(zz$pvalue),])
head(dge[order(dge$pvalue),1:6],10)
##                                  baseMean log2FoldChange      lfcSE     stat
## ENSG00000163710.9 PCOLCE2        25.62512      1.3200438 0.14618904 9.029704
## ENSG00000108950.12 FAM20A      2102.38150      0.6575075 0.07427370 8.852494
## ENSG00000100985.7 MMP9        18630.15953      1.8475668 0.21250458 8.694245
## ENSG00000007968.7 E2F2         1048.78071      0.4485439 0.05226883 8.581478
## ENSG00000137869.15 CYP19A1       99.79869      1.1020306 0.13128996 8.393869
## ENSG00000132170.24 PPARG        188.27369      0.5948070 0.07128398 8.344190
## ENSG00000204044.6 SLC12A5-AS1   114.09553      1.7590874 0.21836871 8.055583
## ENSG00000104918.8 RETN         2356.87387      0.9009685 0.11335111 7.948475
## ENSG00000170439.7 METTL7B       242.42694      0.8427309 0.10841597 7.773125
## ENSG00000135424.18 ITGA7        522.88039      0.5671980 0.07353784 7.713009
##                                     pvalue         padj
## ENSG00000163710.9 PCOLCE2     1.721371e-19 3.668585e-15
## ENSG00000108950.12 FAM20A     8.558475e-19 9.119911e-15
## ENSG00000100985.7 MMP9        3.491438e-18 2.480318e-14
## ENSG00000007968.7 E2F2        9.366156e-18 4.990288e-14
## ENSG00000137869.15 CYP19A1    4.704022e-17 2.005042e-13
## ENSG00000132170.24 PPARG      7.170384e-17 2.546921e-13
## ENSG00000204044.6 SLC12A5-AS1 7.910065e-16 2.408276e-12
## ENSG00000104918.8 RETN        1.888211e-15 5.030195e-12
## ENSG00000170439.7 METTL7B     7.657300e-15 1.813249e-11
## ENSG00000135424.18 ITGA7      1.228856e-14 2.618938e-11
mean(abs(dge$stat))
## [1] 1.485697
# model with clinical covariates
dds <- DESeqDataSetFromMatrix(countData = mx , colData = ss2,
  design = ~ sexD + wound_typeOP + duration_sx + ethnicityCAT + ageCS + crp_group )
## converting counts to integer mode
## Warning in DESeqDataSet(se, design = design, ignoreRank): some variables in
## design formula are characters, converting to factors
##   the design formula contains one or more numeric variables with integer values,
##   specifying a model with increasing fold change for higher values.
##   did you mean for this to be a factor? if so, first convert
##   this variable to a factor using the factor() function
##   Note: levels of factors in the design contain characters other than
##   letters, numbers, '_' and '.'. It is recommended (but not required) to use
##   only letters, numbers, and delimiters '_' or '.', as these are safe characters
##   for column names in R. [This is a message, not a warning or an error]
res <- DESeq(dds)
## estimating size factors
##   Note: levels of factors in the design contain characters other than
##   letters, numbers, '_' and '.'. It is recommended (but not required) to use
##   only letters, numbers, and delimiters '_' or '.', as these are safe characters
##   for column names in R. [This is a message, not a warning or an error]
## estimating dispersions
## gene-wise dispersion estimates
## mean-dispersion relationship
##   Note: levels of factors in the design contain characters other than
##   letters, numbers, '_' and '.'. It is recommended (but not required) to use
##   only letters, numbers, and delimiters '_' or '.', as these are safe characters
##   for column names in R. [This is a message, not a warning or an error]
## final dispersion estimates
## fitting model and testing
## 9 rows did not converge in beta, labelled in mcols(object)$betaConv. Use larger maxit argument with nbinomWaldTest
z <- results(res)
vsd <- vst(dds, blind=FALSE)
##   Note: levels of factors in the design contain characters other than
##   letters, numbers, '_' and '.'. It is recommended (but not required) to use
##   only letters, numbers, and delimiters '_' or '.', as these are safe characters
##   for column names in R. [This is a message, not a warning or an error]
zz <- cbind(as.data.frame(z),assay(vsd))
dge <- as.data.frame(zz[order(zz$pvalue),])
head(dge[order(dge$pvalue),1:6],10)
##                              baseMean log2FoldChange      lfcSE     stat
## ENSG00000163710.9 PCOLCE2    25.62512      1.2259018 0.16300795 7.520503
## ENSG00000108950.12 FAM20A  2102.38150      0.5855328 0.08329079 7.029983
## ENSG00000007968.7 E2F2     1048.78071      0.3962539 0.05925388 6.687392
## ENSG00000104918.8 RETN     2356.87387      0.6987862 0.11335834 6.164401
## ENSG00000132170.24 PPARG    188.27369      0.4927135 0.08019928 6.143615
## ENSG00000135424.18 ITGA7    522.88039      0.5073466 0.08559086 5.927579
## ENSG00000169994.19 MYO7B    752.03451      0.3289064 0.05770625 5.699667
## ENSG00000170439.7 METTL7B   242.42694      0.7107035 0.12800229 5.552272
## ENSG00000050767.18 COL23A1   59.82685      0.4828160 0.08728568 5.531446
## ENSG00000137869.15 CYP19A1   99.79869      0.8331307 0.15065203 5.530166
##                                  pvalue         padj
## ENSG00000163710.9 PCOLCE2  5.456575e-14 1.095298e-09
## ENSG00000108950.12 FAM20A  2.065586e-12 2.073126e-08
## ENSG00000007968.7 E2F2     2.271825e-11 1.520078e-07
## ENSG00000104918.8 RETN     7.075058e-10 3.238341e-06
## ENSG00000132170.24 PPARG   8.066410e-10 3.238341e-06
## ENSG00000135424.18 ITGA7   3.074338e-09 1.028520e-05
## ENSG00000169994.19 MYO7B   1.200415e-08 3.442275e-05
## ENSG00000170439.7 METTL7B  2.819810e-08 6.421919e-05
## ENSG00000050767.18 COL23A1 3.176018e-08 6.421919e-05
## ENSG00000137869.15 CYP19A1 3.199282e-08 6.421919e-05
mean(abs(dge$stat))
## [1] 1.126176
crp_pod1_b <- dge

# model with clinical and cell covariates
# Monocytes.C NK T.CD8.Memory T.CD4.Naive Neutrophils.LD
dds <- DESeqDataSetFromMatrix(countData = mx , colData = ss2,
  design = ~ sexD + wound_typeOP + duration_sx + ethnicityCAT + ageCS +
    Monocytes.C + NK + T.CD8.Memory + T.CD4.Naive + Neutrophils.LD + crp_group )
## converting counts to integer mode
## Warning in DESeqDataSet(se, design = design, ignoreRank): some variables in
## design formula are characters, converting to factors
##   the design formula contains one or more numeric variables with integer values,
##   specifying a model with increasing fold change for higher values.
##   did you mean for this to be a factor? if so, first convert
##   this variable to a factor using the factor() function
##   the design formula contains one or more numeric variables that have mean or
##   standard deviation larger than 5 (an arbitrary threshold to trigger this message).
##   Including numeric variables with large mean can induce collinearity with the intercept.
##   Users should center and scale numeric variables in the design to improve GLM convergence.
##   Note: levels of factors in the design contain characters other than
##   letters, numbers, '_' and '.'. It is recommended (but not required) to use
##   only letters, numbers, and delimiters '_' or '.', as these are safe characters
##   for column names in R. [This is a message, not a warning or an error]
res <- DESeq(dds)
## estimating size factors
##   Note: levels of factors in the design contain characters other than
##   letters, numbers, '_' and '.'. It is recommended (but not required) to use
##   only letters, numbers, and delimiters '_' or '.', as these are safe characters
##   for column names in R. [This is a message, not a warning or an error]
## estimating dispersions
## gene-wise dispersion estimates
## mean-dispersion relationship
##   Note: levels of factors in the design contain characters other than
##   letters, numbers, '_' and '.'. It is recommended (but not required) to use
##   only letters, numbers, and delimiters '_' or '.', as these are safe characters
##   for column names in R. [This is a message, not a warning or an error]
## final dispersion estimates
## fitting model and testing
## 13 rows did not converge in beta, labelled in mcols(object)$betaConv. Use larger maxit argument with nbinomWaldTest
z <- results(res)
vsd <- vst(dds, blind=FALSE)
##   Note: levels of factors in the design contain characters other than
##   letters, numbers, '_' and '.'. It is recommended (but not required) to use
##   only letters, numbers, and delimiters '_' or '.', as these are safe characters
##   for column names in R. [This is a message, not a warning or an error]
zz <- cbind(as.data.frame(z),assay(vsd))
dge <- as.data.frame(zz[order(zz$pvalue),])
head(dge[order(dge$pvalue),1:6],10)
##                              baseMean log2FoldChange      lfcSE      stat
## ENSG00000108950.12 FAM20A  2102.38150      0.5299315 0.07604550  6.968611
## ENSG00000163710.9 PCOLCE2    25.62512      0.9580851 0.14903229  6.428708
## ENSG00000132170.24 PPARG    188.27369      0.3979331 0.06842514  5.815597
## ENSG00000007968.7 E2F2     1048.78071      0.3171167 0.05559108  5.704454
## ENSG00000050767.18 COL23A1   59.82685      0.4708113 0.08827758  5.333306
## ENSG00000169994.19 MYO7B    752.03451      0.2899857 0.05465457  5.305789
## ENSG00000165092.13 ALDH1A1  290.37570     -0.4508214 0.08776359 -5.136770
## ENSG00000135424.18 ITGA7    522.88039      0.4244227 0.08275511  5.128659
## ENSG00000101187.16 SLCO4A1   83.64489      0.3936650 0.07837397  5.022906
## ENSG00000104918.8 RETN     2356.87387      0.4949748 0.10112306  4.894776
##                                  pvalue         padj
## ENSG00000108950.12 FAM20A  3.200849e-12 6.425064e-08
## ENSG00000163710.9 PCOLCE2  1.286929e-10 1.291626e-06
## ENSG00000132170.24 PPARG   6.041783e-09 4.042557e-05
## ENSG00000007968.7 E2F2     1.167168e-08 5.857141e-05
## ENSG00000050767.18 COL23A1 9.644083e-08 3.753197e-04
## ENSG00000169994.19 MYO7B   1.121864e-07 3.753197e-04
## ENSG00000165092.13 ALDH1A1 2.795007e-07 7.321965e-04
## ENSG00000135424.18 ITGA7   2.918135e-07 7.321965e-04
## ENSG00000101187.16 SLCO4A1 5.089559e-07 1.135141e-03
## ENSG00000104918.8 RETN     9.841752e-07 1.975535e-03
mean(abs(dge$stat))
## [1] 0.9390898
crp_pod1_b_adj <- dge

Session information

For reproducibility

save.image("qc.Rds")

sessionInfo()
## R version 4.4.1 (2024-06-14)
## Platform: x86_64-pc-linux-gnu
## Running under: Ubuntu 22.04.5 LTS
## 
## Matrix products: default
## BLAS:   /usr/lib/x86_64-linux-gnu/blas/libblas.so.3.10.0 
## LAPACK: /usr/lib/x86_64-linux-gnu/lapack/liblapack.so.3.10.0
## 
## locale:
##  [1] LC_CTYPE=en_US.UTF-8       LC_NUMERIC=C              
##  [3] LC_TIME=en_US.UTF-8        LC_COLLATE=en_US.UTF-8    
##  [5] LC_MONETARY=en_US.UTF-8    LC_MESSAGES=en_US.UTF-8   
##  [7] LC_PAPER=en_US.UTF-8       LC_NAME=C                 
##  [9] LC_ADDRESS=C               LC_TELEPHONE=C            
## [11] LC_MEASUREMENT=en_US.UTF-8 LC_IDENTIFICATION=C       
## 
## time zone: Australia/Melbourne
## tzcode source: system (glibc)
## 
## attached base packages:
## [1] stats4    stats     graphics  grDevices utils     datasets  methods  
## [8] base     
## 
## other attached packages:
##  [1] MASS_7.3-61                 mitch_1.17.4               
##  [3] DESeq2_1.44.0               SummarizedExperiment_1.34.0
##  [5] Biobase_2.64.0              MatrixGenerics_1.16.0      
##  [7] matrixStats_1.4.1           GenomicRanges_1.56.1       
##  [9] GenomeInfoDb_1.40.1         IRanges_2.38.1             
## [11] S4Vectors_0.42.1            BiocGenerics_0.50.0        
## [13] dplyr_1.1.4                 WGCNA_1.73                 
## [15] fastcluster_1.2.6           dynamicTreeCut_1.63-1      
## [17] reshape2_1.4.4              gplots_3.2.0               
## 
## loaded via a namespace (and not attached):
##   [1] RColorBrewer_1.1-3      rstudioapi_0.17.1       jsonlite_1.8.9         
##   [4] magrittr_2.0.3          rmarkdown_2.28          zlibbioc_1.50.0        
##   [7] vctrs_0.6.5             memoise_2.0.1.9000      base64enc_0.1-3        
##  [10] htmltools_0.5.8.1       S4Arrays_1.4.1          SparseArray_1.4.8      
##  [13] Formula_1.2-5           sass_0.4.9              KernSmooth_2.23-24     
##  [16] bslib_0.8.0             htmlwidgets_1.6.4       plyr_1.8.9             
##  [19] echarts4r_0.4.5         impute_1.78.0           cachem_1.1.0           
##  [22] mime_0.12               lifecycle_1.0.4         iterators_1.0.14       
##  [25] pkgconfig_2.0.3         Matrix_1.7-0            R6_2.5.1               
##  [28] fastmap_1.2.0           GenomeInfoDbData_1.2.12 shiny_1.9.1            
##  [31] digest_0.6.37           colorspace_2.1-1        GGally_2.2.1           
##  [34] AnnotationDbi_1.66.0    Hmisc_5.1-3             RSQLite_2.3.7          
##  [37] fansi_1.0.6             httr_1.4.7              abind_1.4-8            
##  [40] compiler_4.4.1          bit64_4.5.2             doParallel_1.0.17      
##  [43] htmlTable_2.4.3         backports_1.5.0         BiocParallel_1.38.0    
##  [46] DBI_1.2.3               ggstats_0.7.0           highr_0.11             
##  [49] DelayedArray_0.30.1     gtools_3.9.5            caTools_1.18.3         
##  [52] tools_4.4.1             foreign_0.8-87          beeswarm_0.4.0         
##  [55] httpuv_1.6.15           nnet_7.3-19             glue_1.8.0             
##  [58] promises_1.3.0          grid_4.4.1              checkmate_2.3.2        
##  [61] cluster_2.1.6           generics_0.1.3          gtable_0.3.5           
##  [64] preprocessCore_1.66.0   tidyr_1.3.1             data.table_1.16.0      
##  [67] xml2_1.3.6              utf8_1.2.4              XVector_0.44.0         
##  [70] foreach_1.5.2           pillar_1.9.0            stringr_1.5.1          
##  [73] later_1.3.2             splines_4.4.1           lattice_0.22-6         
##  [76] survival_3.7-0          bit_4.5.0               tidyselect_1.2.1       
##  [79] GO.db_3.19.1            locfit_1.5-9.10         Biostrings_2.72.1      
##  [82] knitr_1.48              gridExtra_2.3           svglite_2.1.3          
##  [85] xfun_0.48               stringi_1.8.4           UCSC.utils_1.0.0       
##  [88] yaml_2.3.10             kableExtra_1.4.0        evaluate_1.0.1         
##  [91] codetools_0.2-20        tibble_3.2.1            cli_3.6.3              
##  [94] rpart_4.1.23            xtable_1.8-4            systemfonts_1.1.0      
##  [97] munsell_0.5.1           jquerylib_0.1.4         Rcpp_1.0.13            
## [100] png_0.1-8               parallel_4.4.1          ggplot2_3.5.1          
## [103] blob_1.2.4              bitops_1.0-9            viridisLite_0.4.2      
## [106] scales_1.3.0            purrr_1.0.2             crayon_1.5.3           
## [109] rlang_1.1.4             KEGGREST_1.44.1