---
title: Visualizing tandem repeats within HRP2 and HRP3
---
```{r setup, echo=FALSE, message=FALSE}
source("../common.R")
```
```{bash, eval = F}
elucidator gffRecordIDToGeneInfo --id PF3D7_0831800,PF3D7_1372200 --dout hrps_geneInfos --gff /work/nhathawa/genomes/pfGenomes_updatedPlusPFSD01/info/gff/Pf3D7.gff --2bit /work/nhathawa/genomes/pfGenomes_updatedPlusPFSD01/genomes/Pf3D7.2bit --overWriteDir
elucidator runTRF --fasta out_PF3D7_0831800.1_gDNA.fasta --dout hrpII_trf_output --supplement --overWriteDir
elucidator runTRF --fasta out_PF3D7_1372200.1_gDNA.fasta --dout hrpIII_trf_output --supplement --overWriteDir
elucidator bedAddSmartIDForPlotting --bed hrpII_trf_output/repeats.bed --overWrite --out hrpII_trf_output/repeats_withID.bed
elucidator bedAddSmartIDForPlotting --bed hrpIII_trf_output/repeats.bed --overWrite --out hrpIII_trf_output/repeats_withID.bed
elucidator bedAddSmartIDForPlotting --bed hrpII_trf_output/combined.bed --overWrite --out hrpII_trf_output/combined_withID.bed
elucidator bedAddSmartIDForPlotting --bed hrpIII_trf_output/combined.bed --overWrite --out hrpIII_trf_output/combined_withID.bed
```
# HRPII
```{r}
hrpII_exonsIntrons = readr::read_tsv("../../mappingOutSurroundingRegions/hrps_geneInfos/out_PF3D7_0831800.1_exonIntronPositions.bed", col_names = F) %>%
mutate(type = ifelse(grepl("exon", X4), "exon", "intron"))
hrpII_repeats = readr::read_tsv("../../mappingOutSurroundingRegions/hrps_geneInfos/hrpII_trf_output/combined_withID.bed", col_names = F) %>%
mutate(X2 = max(hrpII_exonsIntrons$X3) -1 - X2)%>%
mutate(X3 = max(hrpII_exonsIntrons$X3) -1 - X3) %>%
mutate(X1 = unique(hrpII_exonsIntrons$X1))
hrpII_plot = ggplot() +
geom_rect(data =hrpII_exonsIntrons, aes(xmin = X2, xmax = X3,
ymin = 0, ymax = 1,name = X4, fill = type), color = "black")+
geom_rect(data =hrpII_repeats, aes(xmin = X2, xmax = X3,
ymin = X7 + 1, ymax = X7 + 2,
name = X4,
),fill = "#AA0A3C", color = "black") +
sofonias_theme + ggtitle("HRPII") +
scale_fill_brewer(palette = "Dark2")
ggplotly(hrpII_plot)
```
# HRPIII
```{r}
hrpIII_exonsIntrons = readr::read_tsv("../../mappingOutSurroundingRegions/hrps_geneInfos/out_PF3D7_1372200.1_exonIntronPositions.bed", col_names = F) %>%
mutate(type = ifelse(grepl("exon", X4), "exon", "intron"))
hrpIII_repeats = readr::read_tsv("../../mappingOutSurroundingRegions/hrps_geneInfos/hrpIII_trf_output/combined_withID.bed", col_names = F) %>%
mutate(X2 = max(hrpIII_exonsIntrons$X3) -1 - X2)%>%
mutate(X3 = max(hrpIII_exonsIntrons$X3) -1 - X3) %>%
mutate(X1 = unique(hrpIII_exonsIntrons$X1))
hrpIII_plot = ggplot() +
geom_rect(data =hrpIII_exonsIntrons, aes(xmin = X2, xmax = X3,
ymin = 0, ymax = 1, name = X4, fill = type), color = "black")+
geom_rect(data =hrpIII_repeats, aes(xmin = X2, xmax = X3,
ymin = X7 + 1, ymax = X7 + 2,
name = X4,
),fill = "#AA0A3C", color = "black") +
sofonias_theme + ggtitle("HRPIII") +
scale_fill_brewer(palette = "Dark2")
ggplotly(hrpIII_plot)
```