---
title: "Inflammation 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. 

Try executing this chunk by clicking the *Run* button within the chunk or by placing your cursor inside it and pressing *Ctrl+Shift+Enter*. 

```{r}
plot(cars)
```

Add a new chunk by clicking the *Insert Chunk* button on the toolbar or by pressing *Ctrl+Alt+I*.

When you save the notebook, an HTML file containing the code and output will be saved alongside it (click the *Preview* button or press *Ctrl+Shift+K* to preview the HTML file).

The preview shows you a rendered HTML copy of the contents of the editor. Consequently, unlike *Knit*, *Preview* does not run any R code chunks. Instead, the output of the chunk when it was last run in the editor is displayed.




#Uploading the Data for Future Use


```{r}

setwd("D:/Documents/Work Documents")
inflammationgenes <- read.csv("10.21.2020_Combined_Human_Inflammation_Log_CSV.csv", sep=",")

```


#Sort Data

```{r}

inflammationgenes <- inflammationgenes[order(inflammationgenes$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(inflammationgenes) <- inflammationgenes$Gene
inflammationgenes <- inflammationgenes[,16:21]

```


Data needs to be represented as a matrix:

#Creation of data matrix
```{r}

infgenes_matrix <- data.matrix(inflammationgenes)

```

Now that data matrix exists, the heatmap can be created:

#Creating Heatmap

```{r}

colorpalette <- colorRampPalette(c("blue", "white", "red", "orange")) (n=799)






col_breaks = c(seq(-3,-0.50,length = 200),  
  seq(-0.49,0.49, length=200),           
  seq(0.5,3, length = 200),
  seq(3.01,6.5, length = 200))

tiff(file="InflammationGenesNew.tiff")
infgenes_heatmap <- heatmap.2(infgenes_matrix, Rowv=NA, Colv=NA, breaks = col_breaks, col= colorpalette, margins = c(4,10), density.info = "none", trace = "none")


range(inflammationgenes)
```


