Step 1: Set the working directory. You can right click on the file and click on button “property” to find the its location.

setwd("/Users/yerui/Documents/Research/MD Anderson/Rotations/Lin Lab/U01/R dataset")

Step 2: Load the dataset.

drug_1hr <- read.csv ("1hr.csv", header=TRUE)
##             Dose X0nM X10000nM X1000nM X100nM X10nM X1nM X0.1nM
## 1     Alisertib     1     0.81    0.00   1.61  1.17 1.13   0.94
## 2        AMG 232    1       NA    6.06   0.99  0.70 0.90   0.74
## 3         AMG337    1     0.96    1.07   0.75  0.86 0.82   0.67
## 4    Azacytidine    1     0.45    1.39   1.30  1.15 1.24   1.03
## 5        AZD9291    1     1.99    0.91   0.76  0.64 0.82   0.69
## 6    Birinapant     1     0.91    0.78   0.69  0.83 0.75   0.81
## 7    Bortezomib     1     0.70    1.05   0.35  0.72 0.94   0.57
## 8  Cabozantinib     1     1.44    1.12   1.11  0.98 0.94   0.72
## 9      Dasatinib    1       NA    1.26   1.32  1.14 0.95   0.85
## 10     Erlotinib    1     1.84    1.41   0.81  0.85 0.75   0.76
## 11           FAU    1     0.82    1.10   1.13  0.78 1.15   0.79
## 12     Ibrutinib    1     1.59    1.13   0.93  0.84 1.02   0.90
## 13    INCB024360    1     0.97    1.10   1.01  0.91 1.21   1.13
## 14     Lapatinib    1     0.37    0.98   1.01  0.90 1.01   0.92
## 15  Lenalidomide    1     0.95    1.11   0.58  0.99 1.34   0.74
## 16       AZD1775    1     1.67    5.11   1.41  0.95 1.00   0.98
## 17  Pomalidomide    1     0.91    0.89   0.92  0.73 0.84   0.93
## 18   Rociletinib    1       NA    0.73   0.72  0.83 0.80   0.77
## 19   Selumetinib    1     4.01    2.88   1.10  0.79 0.80   0.79
## 20     Sorafenib    1     1.16    0.85   0.73  0.79 0.65   0.67
## 21     Sunitinib    1     0.96    0.92   0.94  0.84 0.88   0.86
## 22  Temsirolimus    1     1.32    1.33   1.35  0.93 0.90   0.83
## 23    Tivantinib    1     0.71    0.47   1.00  0.75 0.72   0.82
## 24    Trametinib    1    22.00    5.50   6.23  1.48 1.30   1.17
## 25    Vismodegib    1     0.71    0.94   0.60  0.85 0.82   0.89
## 26      VXc-984*    1     0.81    0.94   0.63  0.74 0.77   0.79
## 27       AZD8186    1     3.16    1.45   1.17  0.89 1.18   0.59
## 28   Osimertinib    1     0.31    0.81   0.82  0.72 0.86   0.88
## 29    Copanlisib    1     2.03    1.92   1.10  0.83 0.88   0.83
## 30    Belinostat    1     0.39    0.98   1.04  0.82 1.01   0.57
## 31  Pinometostat    1     0.65    0.87   0.70  0.70 0.81   0.50
## 32  Methoxyamine    1     0.92    1.07   1.20  1.03 1.11   1.03
## 33    Cediranib     1     2.05    1.21   0.71  0.97 0.99   1.10
## 34    Navitoclax    1     1.29    0.89   0.77  0.73 0.82   0.93
## 35        VX-970    1     0.34    0.68   3.57  0.84 0.82   0.82
## 36      Olaparib    1     2.81    1.88   0.93  0.80 0.73   0.44
## 37   Dabrafenib     1     1.20    3.33   1.22  0.83 0.92   0.88
## 38     Pazopanib    1    16.01    1.44   0.99  0.86 0.96   1.10
## 39     Veliparib    1     2.71    1.07   1.28  0.78 1.00   0.70
## 40  Tazemetostat    1     0.56    0.62   0.73  0.57 0.81   0.65
## 41   Entinostat     1     1.53    4.58   1.33  1.34 1.41   1.11
## 42       MLN0128    1       NA    0.35   0.88  1.10 0.87   0.97
## 43    Onalespib     1     0.73    0.48   0.97  0.75 0.96   1.25
## 44   Romidepsin     1     0.98    0.74   0.55  1.23 1.52   0.92
## 45  Talazoparib     1     1.36    0.54   0.68  2.95 1.65   1.00
## 46      Triapine    1     1.11    1.26   0.90  0.74 0.92   0.86
## 47         DMSO1    1     0.79    1.08   0.86  0.81 0.83   0.85
## 48         DMSO2    1     1.07    1.15   1.18  1.06 1.27   1.15

Step 3: Oder the dataset by SRF value of 100nM concentration

drug_1hr <- drug_1hr[order(-drug_1hr$X100nM) , ]

Step 4: Use the drug name as the row name for the R dataset

row.names(drug_1hr) <- drug_1hr$Dose

Step 5: Remove the default rowname column, dose column, and the control column

drug_1hr <- drug_1hr [,3:8]
##               X10000nM X1000nM X100nM X10nM X1nM X0.1nM
## Trametinib       22.00    5.50   6.23  1.48 1.30   1.17
## VX-970            0.34    0.68   3.57  0.84 0.82   0.82
## Alisertib         0.81    0.00   1.61  1.17 1.13   0.94
## AZD1775           1.67    5.11   1.41  0.95 1.00   0.98
## Temsirolimus      1.32    1.33   1.35  0.93 0.90   0.83
## Entinostat        1.53    4.58   1.33  1.34 1.41   1.11
## Dasatinib           NA    1.26   1.32  1.14 0.95   0.85
## Azacytidine       0.45    1.39   1.30  1.15 1.24   1.03
## Veliparib         2.71    1.07   1.28  0.78 1.00   0.70
## Dabrafenib        1.20    3.33   1.22  0.83 0.92   0.88
## Methoxyamine      0.92    1.07   1.20  1.03 1.11   1.03
## DMSO2             1.07    1.15   1.18  1.06 1.27   1.15
## AZD8186           3.16    1.45   1.17  0.89 1.18   0.59
## FAU               0.82    1.10   1.13  0.78 1.15   0.79
## Cabozantinib      1.44    1.12   1.11  0.98 0.94   0.72
## Selumetinib       4.01    2.88   1.10  0.79 0.80   0.79
## Copanlisib        2.03    1.92   1.10  0.83 0.88   0.83
## Belinostat        0.39    0.98   1.04  0.82 1.01   0.57
## INCB024360        0.97    1.10   1.01  0.91 1.21   1.13
## Lapatinib         0.37    0.98   1.01  0.90 1.01   0.92
## Tivantinib        0.71    0.47   1.00  0.75 0.72   0.82
## AMG 232             NA    6.06   0.99  0.70 0.90   0.74
## Pazopanib        16.01    1.44   0.99  0.86 0.96   1.10
## Onalespib         0.73    0.48   0.97  0.75 0.96   1.25
## Sunitinib         0.96    0.92   0.94  0.84 0.88   0.86
## Ibrutinib         1.59    1.13   0.93  0.84 1.02   0.90
## Olaparib          2.81    1.88   0.93  0.80 0.73   0.44
## Pomalidomide      0.91    0.89   0.92  0.73 0.84   0.93
## Triapine          1.11    1.26   0.90  0.74 0.92   0.86
## MLN0128             NA    0.35   0.88  1.10 0.87   0.97
## DMSO1             0.79    1.08   0.86  0.81 0.83   0.85
## Osimertinib       0.31    0.81   0.82  0.72 0.86   0.88
## Erlotinib         1.84    1.41   0.81  0.85 0.75   0.76
## Navitoclax        1.29    0.89   0.77  0.73 0.82   0.93
## AZD9291           1.99    0.91   0.76  0.64 0.82   0.69
## AMG337            0.96    1.07   0.75  0.86 0.82   0.67
## Sorafenib         1.16    0.85   0.73  0.79 0.65   0.67
## Tazemetostat      0.56    0.62   0.73  0.57 0.81   0.65
## Rociletinib         NA    0.73   0.72  0.83 0.80   0.77
## Cediranib         2.05    1.21   0.71  0.97 0.99   1.10
## Pinometostat      0.65    0.87   0.70  0.70 0.81   0.50
## Birinapant        0.91    0.78   0.69  0.83 0.75   0.81
## Talazoparib       1.36    0.54   0.68  2.95 1.65   1.00
## VXc-984*          0.81    0.94   0.63  0.74 0.77   0.79
## Vismodegib        0.71    0.94   0.60  0.85 0.82   0.89
## Lenalidomide      0.95    1.11   0.58  0.99 1.34   0.74
## Romidepsin        0.98    0.74   0.55  1.23 1.52   0.92
## Bortezomib        0.70    1.05   0.35  0.72 0.94   0.57

Step 6: Transform the dataset to data matrix

drug_1hr_matrix <- data.matrix(drug_1hr)

Step 7: Install and load “gplot”" R package

install.packages("gplots")
## Warning: unable to access index for repository <something sensible near you>/src/contrib:
##   cannot open URL '<something sensible near you>/src/contrib/PACKAGES'
## Warning: package 'gplots' is not available (for R version 3.4.3)
## Warning: unable to access index for repository <something sensible near you>/bin/macosx/el-capitan/contrib/3.4:
##   cannot open URL '<something sensible near you>/bin/macosx/el-capitan/contrib/3.4/PACKAGES'
library(gplots)
## 
## Attaching package: 'gplots'
## The following object is masked from 'package:stats':
## 
##     lowess

Step 8: Install “RColorBrewer”" R oackage

install.packages("RColorBrewer", dependencies = TRUE)
## Warning: unable to access index for repository <something sensible near you>/src/contrib:
##   cannot open URL '<something sensible near you>/src/contrib/PACKAGES'
## Warning: package 'RColorBrewer' is not available (for R version 3.4.3)
## Warning: unable to access index for repository <something sensible near you>/bin/macosx/el-capitan/contrib/3.4:
##   cannot open URL '<something sensible near you>/bin/macosx/el-capitan/contrib/3.4/PACKAGES'
library(RColorBrewer)

Step 9: Define color for heatmaps

my_palette <- colorRampPalette(c("blue","black","red")) (n=299)

Step 10: Define breaks for colors

col_breaks = c(seq(0,0.99,length=100),seq(1,1.5, length=100), seq(1.51,2.5, length=100))

Step 11: Generate the heatmap

heatmap.2(drug_1hr_matrix,dendrogram=“none”,scale=“none”,Colv=“NA”,Rowv=“NA”,main=“2GY after 2hr with Drug Only”,notecol=“black”, trace=“none”, col=my_palette, breaks=col_breaks, margin=c(6,6),key=TRUE,na.rm=TRUE,density.info=“none”,keysize=1)