---
title: "13-IGV-klone"
output: html_document
date: "2024-12-22"
---

```{r}
if (!require("BiocManager", quietly = TRUE))
    install.packages("BiocManager")

BiocManager::install("igvR")
library(igvR)
```

```{r}
library(igvR)
```


```{r}
# Load igvR
library(igvR)

# Start an IGV session
igv2 <- igvR()
setBrowserWindowTitle(igv, "Mytilus Genome Session")

# URLs for genome and annotation
genome_url <- "https://gannet.fish.washington.edu/seashell/bu-github/project-mytilus-methylation/data/GCF_036588685.1_PNRI_Mtr1.1.1.hap1_genomic.fa"
annotation_url <- "https://gannet.fish.washington.edu/seashell/bu-github/project-mytilus-methylation/data/ncbi_dataset/data/GCF_036588685.1/genomic.gff"

# Set the custom genome (annotation optional)
setCustomGenome(
    igv2,
    genomeName = "Mytilus",
    fastaURL = genome_url,
    annotationURL = annotation_url
)
```
```{r}
library(igvR)
igv <- igvR()
setBrowserWindowTitle(igv, "hg38 explicit")
setCustomGenome(igv,
                id="hg38",
                genomeName="Human (GRCh38/hg38)",
                fastaURL="https://s3.amazonaws.com/igv.broadinstitute.org/genomes/seq/hg38/hg38.fa",
                fastaIndexURL="https://s3.amazonaws.com/igv.broadinstitute.org/genomes/seq/hg38/hg38.fa.fai",
                cytobandURL="https://s3.amazonaws.com/igv.broadinstitute.org/annotations/hg38/cytoBandIdeo.txt",
                chromosomeAliasURL=NA,
                geneAnnotationName="Refseq Genes",
                geneAnnotationURL="https://s3.amazonaws.com/igv.org.genomes/hg38/refGene.txt.gz",
                geneAnnotationTrackHeight=500,
                geneAnnotationTrackColor="darkBlue",
                initialLocus="chr5:88,621,308-89,001,037",
                visibilityWindow=5000000)
```


```{r}
library(igvR)
igv <- igvR()
setBrowserWindowTitle(igv, "Mytilus")
setCustomGenome(igv,
                id="Mytil",
                genomeName="genome name",
                fastaURL="https://gannet.fish.washington.edu/seashell/bu-github/project-mytilus-methylation/data/GCF_036588685.1_PNRI_Mtr1.1.1.hap1_genomic.fa",
                fastaIndexURL="https://gannet.fish.washington.edu/seashell/bu-github/project-mytilus-methylation/data/GCF_036588685.1_PNRI_Mtr1.1.1.hap1_genomic.fa.fai")
```



```{r}
# Load igvR

# Start IGV with a custom port
igv <- igvR(portRange = 15000:15010)  # Use a range of ports to avoid conflicts
setBrowserWindowTitle(igv, "Mytilus Genome Session")

# URLs for genome and annotation
genome_url <- "https://gannet.fish.washington.edu/seashell/bu-github/project-mytilus-methylation/data/GCF_036588685.1_PNRI_Mtr1.1.1.hap1_genomic.fa"
annotation_url <- "https://gannet.fish.washington.edu/seashell/bu-github/project-mytilus-methylation/data/ncbi_dataset/data/GCF_036588685.1/genomic.gff"

# Set the custom genome (annotation optional)
setCustomGenome(
    igv,
    genomeName = "Mytilus",
    fastaURL = genome_url,
    annotationURL = annotation_url
)
```

```{r}
setCustomGenome(
    igv,
    genomeName = "Mytilus",
    fastaURL = genome_url
)
```


```{r}
genome_url <- "https://gannet.fish.washington.edu/seashell/bu-github/project-mytilus-methylation/data/GCF_036588685.1_PNRI_Mtr1.1.1.hap1_genomic.fa"
annotation_url <- "https://gannet.fish.washington.edu/seashell/bu-github/project-mytilus-methylation/data/ncbi_dataset/data/GCF_036588685.1/genomic.gff"

download.file(genome_url, destfile = "../output/13-IGV-klone/genome.fa")
download.file(annotation_url, destfile = "../output/13-IGV-klone/annotation.gff")
```



