---
title: "Extracellular Matrix Genes Heatmap"
output: html_notebook
---

This is an [R Markdown](http://rmarkdown.rstudio.com) Notebook. When you execute code within the notebook, the results appear beneath the code. 






#Uploading the Data for Future Use


```{r}

setwd("D:/Documents/Work Documents/IL1B and RV Fibrosis Raw Data and Information/Figure 6/Heatmaps")

ECMgenes <- read.csv("10.21.2020_Combined_Human_ECM_Log_CSV.csv", sep=",")

```


#Sort Data

```{r}

ECMgenes <- ECMgenes[order(ECMgenes$IL1B),]

```



First column will need to be turned into row names as well as the data must then exclude this name row

#Setting Row Names

```{r}

row.names(ECMgenes) <- ECMgenes$Gene
ECMgenes <- ECMgenes[,16:21]

```


Data needs to be represented as a matrix:

#Creation of data matrix
```{r}

ECM_matrix <- data.matrix(ECMgenes)

```

Now that data matrix exists, the heatmap can be created:

#Creating Heatmap

```{r}

colorpalette <- colorRampPalette(c("blue", "white", "red")) (n=599)



breaks = seq(-3,3,1000)
gradient1 = colorz(sum(breaks[-1]<=0), "blue", "white")
gradient2 = colorpanel(sum(breaks[-1]>0), "white", "red")

hm.colors = c(gradient1,gradient2)

                       
                       
                               


col_breaks = c(seq(-3,-0.2,length=200),  
  seq(-0.19,0.19,length=200),           
  seq(0.2,3,length=200))



tiff(file="ECMGenesNew.tiff")
ECMgenes_heatmap <- heatmap.2(ECM_matrix, Rowv=NA, Colv=NA, breaks = col_breaks, col= colorpalette, margins = c(4,10), density.info = "none", trace = "none")


```


