> For the complete documentation index, see [llms.txt](https://igb.mit.edu/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://igb.mit.edu/bioinformatics-topics/tasks-bioinformatics-methods/ucsc-genome-bioinformatics/galaxy/galaxy-snp-interval-data.md).

# Galaxy SNP Interval Data

his example is inspired by a screencast published on the Galaxy website. It consists in combining exon information and SNP information, both represented as interval data.

**1. Load exon data from UCSC tables**

* On the Tool Panel, click on Get Data → UCSC Main Table Browser.
* This tools allows you to upload data from the UCSC Tables.
  * Use the following parameters:
    * Group: Variation and Repeats
    * Track: SNP(130)
    * Region: chr19:1-100,000
    * Output format: BED
    * Send output to Galaxy: checked
  * Click "Get Output" button.
    * Select the radiobox so that one BED record is created for the whole gene.
    * Click the button "send query to Galaxy"
* With these parameters, this tool creates a BED file containing all the SNPs for the first 1M bases of chromosome 19.
* Once the job is completed, change the name of the dataset to "SNPs chr19".

<figure><img src="https://498238201-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FWuHhstIreJ3jFvE4gQ3y%2Fuploads%2F9BnbBowyRWlZuWFOGxIR%2Fimage.png?alt=media&amp;token=f3f74f60-7ac7-43e9-9103-54755648f5eb" alt=""><figcaption></figcaption></figure>

**2. Load SNP data from UCSC tables**

* On the Tool Panel, click on Get Data → UCSC Main Table Browser.
* This tools allows you to upload data from the UCSC Tables.
  * Use the following parameters:
    * Group: Genes and Gene Prediction
    * Track: UCSC Genes
    * Region: chr19:1-100,000
    * Output format: BED
    * Send output to Galaxy: checked
  * Click "Get Output" button.
    * Select the radiobox so that one BED record is created per coding exon.
    * Click the button "send query to Galaxy"
* With these parameters, this tool creates a BED file containing all the exon information for the first 1M bases of chromosome 19.
* Once the job is completed, change the name of the dataset to "exons chr19".

<figure><img src="https://498238201-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FWuHhstIreJ3jFvE4gQ3y%2Fuploads%2FlrqceChzJG0g4GU1J3tp%2Fimage.png?alt=media&amp;token=2f73ae70-1b1b-4bc6-9b00-47ae4a475477" alt=""><figcaption></figcaption></figure>

**3. Join exon and SNP information**

* On the Tool Panel, click on Operate on Genomic Intervals → Join the intervals.
* This tools allows you to join the information from two interval files based on the coordinates of each feature.
  * Select the SNP chr19 and the exons chr19 files as input.
  * Click on the "Execute" button.
* Because some exons might contain multiple SNPs, the resulting output might have size greater than the two input files.

<figure><img src="https://498238201-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FWuHhstIreJ3jFvE4gQ3y%2Fuploads%2FJlhCbIaThJ4Q6agb0tcP%2Fimage.png?alt=media&amp;token=eec160ff-96eb-4ff8-9388-2cc0cc6b60a9" alt=""><figcaption></figcaption></figure>

<figure><img src="https://498238201-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FWuHhstIreJ3jFvE4gQ3y%2Fuploads%2FqKf7OPd9rYByUtYBICiv%2Fimage.png?alt=media&amp;token=072001a1-1cb7-4150-85a0-50d60e24a221" alt=""><figcaption></figcaption></figure>

**4. Find the number of SNPs per exon**

* On the Tool Panel, click on Join, Subtract and Group → Group.
* This tools groups the information based on a given column and performs the aggregation operations on the other columns.
  * Select data 3 as input.
  * Select column 4 (exon ID).
  * Add operation to count c4.
  * Click on the "Execute" button.

<figure><img src="https://498238201-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FWuHhstIreJ3jFvE4gQ3y%2Fuploads%2FjFQxScYsqMJuDxKIBegN%2Fimage.png?alt=media&amp;token=d26dabfc-58e0-439c-9ad3-0219fefeea94" alt=""><figcaption></figcaption></figure>

**5. Find the exon with the most SNPs**

* On the Tool Panel, click on Filter and Sort → Sort.
* This tools ...
  * Select data 4 as input.
  * Select column 2 as sorting key.
  * Click on the "Execute" button.

<figure><img src="https://498238201-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FWuHhstIreJ3jFvE4gQ3y%2Fuploads%2Fwn9gVztSru8kgBOxlTFh%2Fimage.png?alt=media&amp;token=63e4a61e-7ccd-4854-a733-f393dfcd8ca4" alt=""><figcaption></figcaption></figure>

<figure><img src="https://498238201-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FWuHhstIreJ3jFvE4gQ3y%2Fuploads%2FPaKG8Whiq1kV2l2tdf26%2Fimage.png?alt=media&amp;token=ae2a5fb1-d3c2-48e8-8a4e-4fe1c7af1f9f" alt=""><figcaption></figcaption></figure>

**6. Find how many chromosomes have a given number of exons**

* On the Tool Panel, click on Join, Subtract, Group → Group.
* This tools ...
  * Select data 5 as input (sorted).
  * Select column 2 as sorting key.
  * Set the operation to "count" on column 1.
  * Click on the "Execute" button.

<figure><img src="https://498238201-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FWuHhstIreJ3jFvE4gQ3y%2Fuploads%2FE83U5oUPSjsVzhyRwcCd%2Fimage.png?alt=media&amp;token=55c7b309-1338-4a10-8d7f-11d4866f1ed3" alt=""><figcaption></figcaption></figure>

<figure><img src="https://498238201-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FWuHhstIreJ3jFvE4gQ3y%2Fuploads%2Fn7Vm9PUuteFYUcED4xqU%2Fimage.png?alt=media&amp;token=f110c836-86bb-47f2-9753-d0154c3b8c85" alt=""><figcaption></figcaption></figure>

**7. Filter exons with at least 10 SNPs**

* On the Tool Panel, click on Filter and Sort → Filter.
* This tools ...
  * Select data 5 as input (sorted).
  * Set the condition to SNP count greater than 10 (i.e. c2 >= 10).
  * Click on the "Execute" button.

<figure><img src="https://498238201-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FWuHhstIreJ3jFvE4gQ3y%2Fuploads%2Fzfbj7JNkUEmrCqFh29CO%2Fimage.png?alt=media&amp;token=231e8b17-c805-4fd1-800e-f269113245ad" alt=""><figcaption></figcaption></figure>

**8. Retrieve original information for exons**

* On the Tool Panel, click on Join, Subtract, Group → Join.
* This tools ...
* This is equivalent to a relational join (not an interval join).
  * Select the exons with more than 10 SNPs as first input.
  * Select the exon data for chr19:1-1,000,000 as second input.
  * Select column 1 (exonID) for the first file.
  * Select column 4 (exonID) for the second file.
  * Click the "Execute" button.
* Now repeat this step but invert the order of the file. Note that this time the output is a BED-formatted output, wherease before it was a tabular file.

<figure><img src="https://498238201-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FWuHhstIreJ3jFvE4gQ3y%2Fuploads%2FeUKF6gpXFHT2rotFgszF%2Fimage.png?alt=media&amp;token=895d1d92-af49-4cb9-b8a9-cb9b6dc8b07e" alt=""><figcaption></figcaption></figure>

&#x20;![](https://498238201-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FWuHhstIreJ3jFvE4gQ3y%2Fuploads%2FAx3NpNenp56VoYZz12Gp%2Fimage.png?alt=media\&token=a71c8e3b-1176-45bb-96c1-fc3778442173)

**9. Display using the UCSC Browser**

* On the Data Panel on the right-hand size, click on the last job → Display at UCSC.
  * The User track show the exons that have more than 10 SNPs in the region of chr19 considered.

<figure><img src="https://498238201-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FWuHhstIreJ3jFvE4gQ3y%2Fuploads%2FeZnD2bwojzmGCPPfspaW%2Fimage.png?alt=media&amp;token=be4d6139-6cbb-4205-8bb3-455b768a4ccd" alt=""><figcaption></figcaption></figure>
