Skip to content
This repository has been archived by the owner on Jan 18, 2020. It is now read-only.

Integrate JBrowse into Varify as Alamut replacement #338

Open
ryanjohara opened this issue Jun 26, 2014 · 3 comments
Open

Integrate JBrowse into Varify as Alamut replacement #338

ryanjohara opened this issue Jun 26, 2014 · 3 comments

Comments

@ryanjohara
Copy link
Contributor

The JBrowse URL (below) includes JSON for dynamically configuring some of the tracks, including the BAM and VCF tracks. The dynamic configurations currently contain direct URLs to files, like "urlTemplate":"http://localhost/jbrowse/data/Pseq_batch9_P-Pseq_0019-P-A_1.sorted.mdup.bam". @mitalia and I were talking about the easiest way to control access to these files. @bruth, does it sound reasonable to have a new Django endpoint serve the files, rather than accessing the files directly, since it knows whether or not the user has sufficient privileges? If so, where would be a good place to create this endpoint? Any other thoughts? Thanks.

http://localhost/jbrowse/?loc=chr7:121719569..121719668&tracks=DNA,Cosmic,VCF,BAM&highlight=&addTracks=[{"label":"BAM","store":"testStore","type":"JBrowse/View/Track/Alignments2"},{"label":"VCF","store":"testStoreTwo","type":"JBrowse/View/Track/CanvasVariants"}]&addStores={"testStore":{"baiUrlTemplate":"http://localhost/jbrowse/data/Pseq_batch9_P-Pseq_0019-P-A_1.sorted.mdup.bai","type":"JBrowse/Store/SeqFeature/BAM","urlTemplate":"http://localhost/jbrowse/data/Pseq_batch9_P-Pseq_0019-P-A_1.sorted.mdup.bam"},"testStoreTwo":{"tbiUrlTemplate":"http://localhost/jbrowse/data/Pseq_batch9_P-Pseq_0019-P-A_1.var_raw.vcf.gz.tbi","type":"JBrowse/Store/SeqFeature/VCFTabix","urlTemplate":"http://localhost/jbrowse/data/Pseq_batch9_P-Pseq_0019-P-A_1.var_raw.vcf.gz"}}

@bruth
Copy link
Contributor

bruth commented Jun 26, 2014

Yes, Varify would have to play a role if permissions need to be enforced. nginx and Apache both support a special header for a backend (Django) to hand-off a request it had processed. You can see an example here: http://stackoverflow.com/a/2690263/407954

Here are the docs for nginx: http://wiki.nginx.org/X-accel and the Apache module (this is not built-in) https://tn123.org/mod_xsendfile/

@ryanjohara
Copy link
Contributor Author

Thanks for the response. I ended up adding a new Varify endpoint that does something like this:

        try:
            if Sample.objects.get(id=data['id']):
                response = HttpResponse()
                response['Content-Type'] = 'application/octet-stream'

                f = data['filename']

                # Control access to files hosted by nginx
                response['X-Accel-Redirect'] = '/files/' + f
                # Control access to files hosted by Apache
                response['X-Sendfile'] = '/files/' + f

                response['Content-Disposition'] = 'attachment;filename=' + f
        except Exception:
            return self.render(
                request,
                {'message': 'No sample found for "id"'},
                status=codes.unprocessable_entity
            )

        return response

Then after saving the files to $PROJECT_ROOT/files, the following needed to be added to nginx.conf (or the analogous if you are using Apache):

    location /files/ {
        alias $project_root/files/;
        internal;
    }

@ryanjohara ryanjohara reopened this Aug 7, 2014
@ryanjohara ryanjohara changed the title Control JBrowse Access Integrate JBrowse into Varify as Alamut replacement Aug 7, 2014
ryanjohara added a commit to ryanjohara/varify that referenced this issue Aug 7, 2014
JBrowse replaces Alamut as Varify's genome browser
Fixes chop-dbhi#338

Signed-off-by: Ryan O'Hara <[email protected]>
@ryanjohara
Copy link
Contributor Author

This share page describes how to get JBrowse working with a nginx/uwsgi-deployed instance of Varify.

ryanjohara added a commit to ryanjohara/varify that referenced this issue Aug 8, 2014
JBrowse replaces Alamut as Varify's genome browser
Fixes chop-dbhi#338

Signed-off-by: Ryan O'Hara <[email protected]>
ryanjohara added a commit to ryanjohara/varify that referenced this issue Aug 8, 2014
JBrowse replaces Alamut as Varify's genome browser
Fixes chop-dbhi#338

Signed-off-by: Ryan O'Hara <[email protected]>
ryanjohara added a commit to ryanjohara/varify that referenced this issue Aug 11, 2014
JBrowse replaces Alamut as Varify's genome browser
Fixes chop-dbhi#338

Signed-off-by: Ryan O'Hara <[email protected]>
ryanjohara added a commit to ryanjohara/varify that referenced this issue Aug 11, 2014
JBrowse replaces Alamut as Varify's genome browser
Fixes chop-dbhi#338

Signed-off-by: Ryan O'Hara <[email protected]>
ryanjohara added a commit to ryanjohara/varify that referenced this issue Aug 11, 2014
JBrowse replaces Alamut as Varify's genome browser
Fixes chop-dbhi#338

Signed-off-by: Ryan O'Hara <[email protected]>
ryanjohara added a commit to ryanjohara/varify that referenced this issue Aug 11, 2014
JBrowse replaces Alamut as Varify's genome browser
Fixes chop-dbhi#338

Signed-off-by: Ryan O'Hara <[email protected]>
ryanjohara added a commit to ryanjohara/varify that referenced this issue Aug 11, 2014
JBrowse replaces Alamut as Varify's genome browser
Fixes chop-dbhi#338

Signed-off-by: Ryan O'Hara <[email protected]>
ryanjohara added a commit to ryanjohara/varify that referenced this issue Aug 11, 2014
JBrowse replaces Alamut as Varify's genome browser
Fixes chop-dbhi#338

Signed-off-by: Ryan O'Hara <[email protected]>
ryanjohara added a commit to ryanjohara/varify that referenced this issue Aug 11, 2014
JBrowse replaces Alamut as Varify's genome browser
Fixes chop-dbhi#338

Signed-off-by: Ryan O'Hara <[email protected]>
ryanjohara added a commit to ryanjohara/varify that referenced this issue Aug 11, 2014
Replace Alamut with JBrowse as Varify's genome browser
Fixes chop-dbhi#338

Signed-off-by: Ryan O'Hara <[email protected]>
ryanjohara added a commit to ryanjohara/varify that referenced this issue Aug 11, 2014
Replace Alamut with JBrowse
Fixes chop-dbhi#338

Signed-off-by: Ryan O'Hara <[email protected]>
ryanjohara added a commit to ryanjohara/varify that referenced this issue Aug 11, 2014
Replace Alamut with JBrowse
Fixes chop-dbhi#338

Signed-off-by: Ryan O'Hara <[email protected]>
ryanjohara added a commit to ryanjohara/varify that referenced this issue Aug 20, 2014
Replace Alamut with JBrowse
Fixes chop-dbhi#338

Signed-off-by: Ryan O'Hara <[email protected]>
ryanjohara added a commit to ryanjohara/varify that referenced this issue Aug 20, 2014
Replace Alamut with JBrowse
Fixes chop-dbhi#338

Signed-off-by: Ryan O'Hara <[email protected]>
ryanjohara added a commit to ryanjohara/varify that referenced this issue Aug 21, 2014
Replace Alamut with JBrowse
Fixes chop-dbhi#338

Signed-off-by: Ryan O'Hara <[email protected]>
ryanjohara added a commit to ryanjohara/varify that referenced this issue Aug 21, 2014
Replace Alamut with JBrowse
Fixes chop-dbhi#338

Signed-off-by: Ryan O'Hara <[email protected]>
ryanjohara added a commit to ryanjohara/varify that referenced this issue Aug 27, 2014
Replace Alamut with JBrowse
Fixes chop-dbhi#338

Signed-off-by: Ryan O'Hara <[email protected]>
ryanjohara added a commit to ryanjohara/varify that referenced this issue Aug 27, 2014
Replace Alamut with JBrowse
Fixes chop-dbhi#338

Signed-off-by: Ryan O'Hara <[email protected]>
ryanjohara added a commit to ryanjohara/varify that referenced this issue Sep 2, 2014
Supplement Alamut with JBrowse
Fixes chop-dbhi#338

Signed-off-by: Ryan O'Hara <[email protected]>
ryanjohara added a commit to ryanjohara/varify that referenced this issue Sep 8, 2014
Supplement Alamut with JBrowse
Fixes chop-dbhi#338

Signed-off-by: Ryan O'Hara <[email protected]>
ryanjohara added a commit to ryanjohara/varify that referenced this issue Sep 8, 2014
Supplement Alamut with JBrowse
Fixes chop-dbhi#338

Signed-off-by: Ryan O'Hara <[email protected]>
ryanjohara added a commit to ryanjohara/varify that referenced this issue Sep 8, 2014
Supplement Alamut with JBrowse
Fixes chop-dbhi#338

Signed-off-by: Ryan O'Hara <[email protected]>
ryanjohara added a commit to ryanjohara/varify that referenced this issue Sep 8, 2014
Supplement Alamut with JBrowse
Fixes chop-dbhi#338

Signed-off-by: Ryan O'Hara <[email protected]>
ryanjohara added a commit to ryanjohara/varify that referenced this issue Sep 8, 2014
Supplement Alamut with JBrowse
Fixes chop-dbhi#338

Signed-off-by: Ryan O'Hara <[email protected]>
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants