---
title: "M. franciscanus RIdeogram - Gene Density"
output: html_document
date: "2023-02-22"
script by: Kate Castellano
---

```{r setup, include=FALSE}
knitr::opts_chunk$set(echo = TRUE)

#set your folder location for every chunk
knitr::opts_knit$set(root.dir = '<set directory here>)
```

```{r }

#Load chromosome IDs and Length of each chromosome file
  karyotype = read.csv("Mfran_chr_length_forBedtools_sort.txt", sep = "\t", header = FALSE)
    #add headers
    colnames(karyotype) <- c("Chr", "Start", "End")
    
#Load Gene Density (550 kb windows) file
  gene_density_550kb = read.csv("Mfran_genecount_550kb.bed", sep ="\t", header = FALSE)
    #add headers
    colnames(gene_density_550kb) <- c("Chr", "Start", "End", "Value")
#It is important that the headers are named as I have listed above - internally RIdeogram is looking for those exact headers
```

```{r }
#make RIdeogram

#Load RIdeogram package
library(RIdeogram)

#make ideogram
ideogram(karyotype = karyotype, overlaid = gene_density_100kb, label = repeat_count_100kb, label_type = "line")
convertSVG("chromosome.svg", device = "png")
```