Contents

1 The Standard Hosted Genomes

Jim Robinson and his team currently provide sixteen reference genomes:

Each includes some or all of:

You specify your reference genome of interest for igvR like this:

igv <- igvR()
setGenome(igv, "hg38")

2 setCustomGenome

If you wish to use a reference genome other than those offered, we provide a method setCustomGenome. Here is a sample invocation in which the stock hg38 reference genome is specified explicitly. This could be seen as redundant, but has the virtue of relying upon dependably available reference files.

2.1 Full invocation - all arguments

See notes further below on one possible approach to serving your files if you need to do so yourself.

igv <- igvR()
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",
                chromosomeAliasURL=NA,
                cytobandURL="https://s3.amazonaws.com/igv.broadinstitute.org/annotations/hg38/cytoBandIdeo.txt",
                geneAnnotationName="Refseq Genes",
                geneAnnotationURL="https://s3.amazonaws.com/igv.org.genomes/hg38/refGene.txt.gz",
                geneAnnotationTrackHeight=300,
                geneAnnotationTrackColor="darkgreen",
                initialLocus="chr5:88,621,308-89,001,037",
                visibilityWindow=5000000)

2.2 Minimal invocation - just the DNA sequence

Many of the arguments to this method default to NA. Here is a minimalist invocation:

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")

3 Set up a (typically local and private) reference genome web server

Any igv.js-compatible web server must have two capabilities:

I have used an easily installed, easily configured Python FLASK webserver for this. Here are the details,

3.1 Python Requirements

  • Python version >= 3.5
  • Flask and flask_cors modules

3.2 Simple webserver script, localWebServer.py

   from flask import Flask
   from flask_cors import CORS
   app = Flask(__name__, static_url_path='/static')
   CORS(app)
   @app.route('/')
   def serveStaticFiles():
       return 'CORS and byte-range request flask webserver for igvR and igvShiny'
   if __name__ == "__main__":
       app.run(host='0.0.0.0', port='60050')

Place the files you wish to serve in, eg, http://locahhost:60050/static/. To run the python webserver:

bash> export FLASK_APP=serveStaticGenomeFiles.py
bash> nohup flask run -p 60050 --host=0.0.0.0 &> flask.log &

3.3 Dockerize the webserver

3.3.1 Dockerfile

FROM python
COPY serveStaticGenomeFiles.py /app/
COPY requirements.txt /app/
WORKDIR /app
RUN pip install -r requirements.txt
ENTRYPOINT ["python"]
CMD ["serveStaticGenomeFiles.py"]

3.3.2 Python requirements.txt

Flask
flask_cors

3.3.3 a makefile

build:
    docker build -t flask-cors-server:latest .
run:
    docker run -it \
    -p 5000:60050 \
    -v ~/s/examples/docker/flask/web:/app \
    flask-cors-server
stop:
    docker stop `docker ps | grep flask-cors-webserver | awk '{print $1}'`