Skip to content

Alignment service

Jim Robinson edited this page Sep 17, 2017 · 6 revisions

Alignment Service

Note: This is a work in progress.

Use the alignment service to query a CRAM, BAM, or SAM file.

To use the alignment service, you must enable it by setting ENABLE_ALIGNMENT_SERVICE = True in _config.py. You must also install pysam using pip install pysam.

Note that the reference files and alignment files you are using must be uploaded to the server at /static/alignments/refs and /static/alignments/files respectively.

Go to /alignments and specify the parameters needed to make a samtools view call. The required parameters are:

  • reference: the reference file used for the alignment
  • file: the alignment file you would like to view
  • region: the region you would like to view

The optional parameter is:

  • options: the url encoded list of samtools options used

Examples: Assuming the server is being run at localhost:5000, here is what some basic calls would look like:

  • localhost:5000/alignments?reference=ref_file&file=example.cram&region=chr1:1000-2000
    Note that the result will be equivalent to the result from samtools view -T ref_file.fa example.cram chr1:1000-2000
  • localhost:5000/alignments?reference=ref_file&file=example.cram&region=chr1:1000-2000&options=-H
    This uses the -H option to view the header.
  • localhost:5000/alignments?reference=ref_file&file=example.cram&region=chr1:1000-2000&options=-b%20-q%2010
    This uses multiple options. When encoded, spaces become '%20' so these options would read '-b -q 10'.
  • localhost:5000/alignments?file=example.bam&region=chr1:1000-2000
    You could also view a .bam file and omit the reference.
Clone this wiki locally