# Using DNAnexus and ProteinPaint

DNAnexus provides a secure way to view unpublished/sensitive files and create tracks within ProteinPaint. Use the tips in the guide below for how to store files and create tracks in ProteinPaint.

This tutorial is specific to ProteinPaint. For more detailed information about DNAnexus, please see the documentation.

## Getting Started

- Create an account with DNAnexus. Follow the instructions from St. Jude Cloud. Please direct questions regarding account set up to the St. Jude Cloud team (support@stjude.cloud).
- Create a token from the DNAnexus platform. See this link on how to generate an authentication token. Be sure to save the token!
- Create a new project in DNAnexus with Azure (will not work with AWS funded projects). See the DNAnexus documentation See the DNAnexus documentation for instructions on how to set up a new project.
- Install dx-toolkit by following the DNAnexus documentation.

Tip: Uploading files from the command line is faster than from the web browser. Instructions for both methods are provided.

## Upload Files

### Command Line

All DNAnexus dx-toolkit commands begin with dx. A full list of commands to navigate through folders, copy files, etc. is available here.
Login into DNAnexus with your authentication token:

                $ dx login --token MyAuthenicationToken

A list of available projects will appear. Select the appropriate project from the number appearing in brackets:

                Available projects (CONTRIBUTE or higher):
                [0]My_ProteinPaint_Project

                Pick a numbered choice: 0

Upload all files to the project with the dx upload command.

Unzip the FileViewer and upload it to the project with this command:

                $ dx upload --type FileViewer 'ProteinPaint (VCF, bigWig, BEDj, junction, BAM)'

### DNAnexus Website

Uploading files through the DNAnexus website is easy but takes more time and processing power.

- Select the appropriate project
- Click the Upload button. Upload all files and the FileViewer.

## Creating URLs

### Command line

While logged into DNAnexus on the command line, create a URL with the make_download_url command. Specify the file and duration for the URL. The following is an example of a download URL command expiring in ten years.

                    dx make_download_url bigWigExample.bw -–duration 10y

See the DNAnexus documentation for more information.

### DNAnexus Website

Creating the URL from the DNAnexus website is easy but the URL expires in 24 hours. Login to the DNAnexus website and navigate to the appropriate project.

- Find the file and hover the mouse on the far right of the screen until three dots appear.
- Select 'Download' from the menu
- A popup 'Download Data' window will appear. Hover over the file to see the 'Get URL' icon (🔗) on the right. Click on the (🔗) icon.
- The icon button will change to 'Copy URL'. Click to copy the link.

Save the new URL. The next section describes how to create a ProteinPaint track using URL parameters.

## Create a Track

Create a track from stringing together URL parameters described in this document.

Start with "https://proteinpaint.stjude.org/?" and add the URL parameters separated by ampersands. In the example below, parameters for the genome, block, track name, and file URL to launch the genome browser. The final URL https://proteinpaint.stjude.org/?genome=hg19&block=1&bigwigurl=URL,https://proteinpaint.stjude.org/ppdemo/hg19/bigwig/file.bw, launches this bigwig track.

## ProteinPaint FileViewer

The ProteinPaint FileViewer launches VCF, BigWig, JSON BED, Splice Junction, and BAM tracks from the DNAnexus website. Download the ProteinPaint FileViewer from the blue button below.

### Prepare Files

Ensure all files end with one of the following extensions:

- .vcf.gz
- .bw
- .bedj.gz
- .bam

Index files for VCF, bedj, and BAM are required.
Create the index file for the VCF, bedj and BAM files with the following commands. These commands require samtools, bcftools, and htslib packages. Download these packages here.

Index a VCF or bedj file with these commands:

                $ sort -k1,1 -k2,2n FILE > FILE.sorted
                $ bgzip FILE.sorted
                $ tabix -p bed FILE.sorted.gz

Index a BAM file with the following command:

                $ samtools index bamFile.bam

### Launch FileViewer

Open the DNAnexus website and navigate to the project.

- Click on the ProteinPaint (VCF, bigWig, BEDj, junction, BAM) FileViewer.
- Select which files to visualize in ProteinPaint. Ensure to include index files.
- Click Launch Viewer in the bottom right of the window.
- The following interface will appear in the browser:

  Select the reference genome. Then, enter a genomic position or search for a gene to launch the visualization. ProteinPaint will launch in a new tab, like the example below.

Tip: The URL created from the FileViewer is only available while the tab is open. Once the tab is closed, repeat the steps in this section to launch the FileViewer again.