Skip to content

Commit

Permalink
Merge pull request #61 from agduncan94/develop
Browse files Browse the repository at this point in the history
Release 0.1.9
  • Loading branch information
agduncan94 authored Mar 25, 2020
2 parents ada6318 + 011de97 commit 616cb52
Show file tree
Hide file tree
Showing 30 changed files with 559 additions and 418 deletions.
176 changes: 2 additions & 174 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,177 +1,5 @@
[![Build Status](https://travis-ci.org/agduncan94/icgc-viewer.svg?branch=develop)](https://travis-ci.org/agduncan94/icgc-viewer)
# ICGC JBrowse Plugin
A plugin for [JBrowse](https://jbrowse.org/) for viewing [ICGC](https://icgc.org/) data. For any bugs, issues, or feature recommendations please create an issue through GitHub.
A plugin for [JBrowse](https://jbrowse.org/) for viewing [ICGC](https://icgc.org/) data. For any bugs, issues, or feature recommendations please create an issue or PR through GitHub.

# Installation and Setup
## 1. Install JBrowse
Quick setup of JBrowse - https://github.com/GMOD/jbrowse/#install-jbrowse-from-github-for-developers

## 2. Install Plugin
See [JBrowse - Installing Plugins](https://jbrowse.org/docs/plugins.html) for a general approach to installing plugins.

For installing icgc-viewer plugin:
1) Copy the icgc-viewer folder into the JBrowse `plugins` directory.
2) Add 'icgc-viewer' to the array of plugins in the `jbrowse_conf.json`.

## 3. Install Reference Sequence Data
Now setup the reference sequence used. ICGC requires the GRCh37 Human reference files.

Download the GRCh37 `.fa` and `.fa.fai` files online (ex. http://bioinfo.hpc.cam.ac.uk/downloads/datasets/fasta/grch37/). Then put the following in `./data/tracks.conf` (note files may be named something else).

```
refSeqs=GRCh37.genome.fa.fai
[tracks.refseqs]
urlTemplate=GRCh37.genome.fa
```

## 4. Adding new tracks
We have some basic example tracks in `data/tracks.conf`. You can also add new tracks by using the ICGC Dialog accessible within JBrowse. These are present in the menu under `ICGC`. See [Dynamic Track Generation](#dynamic-track-generation) for more details.

## 5. Run JBrowse
You'll have to run the following commands:

```
./setup.sh
utils/jb_run.js -p 3000
```

JBrowse should now be running with the ICGC Plugin working!

# JBrowse configuration
## Faceted Track Selector
Add the following to your jbrowse.conf to use the faceted track selector.
```
[trackSelector]
type = Faceted
displayColumns =
+ label
+ key
+ datatype
+ donor
+ project
```

# Available Store SeqFeature
## A note on filters
All SeqFeatures support filters as they are used in the ICGC API Documentation.

You can view/edit the filters associated with a track by clicking the down arrow for the track menu and selecting `View Applied Filters`. Be careful, there are currently no checks to see if the filters are valid before applying them.

## Genes
A simple view of all genes returned by the ICGC portal for a given range of the chromosome you are looking at.

If you specify a donor ID (donor field) in the track config file, only genes related to that donor will appear.
```
donor: DO229446
```

You can also use the filters field to pass filters to be applied to the track. The expected input is a filter object like the following:

```
{
"gene" : {
"type": {
"is": [
"protein_coding"
]
}
}
}
```

To put it in the track config file you may want to minimize it as such:
```
filters={"gene":{"type":{"is":["protein_coding"]}}}
```

Example Track:
```
[tracks.ICGC_Genes_protein-coding]
storeClass=icgc-viewer/Store/SeqFeature/Genes
type=icgc-viewer/View/Track/GeneTrack
key=ICGC_Genes_protein-coding
unsafePopup=true
filters={"gene":{"type":{"is":["protein_coding"]}}}
```

![ICGC Genes](images/ICGC-Genes-protein-coding.png)

### Extra notes
You can also set the `size` attribute (defaults to 1000). This is the theoretical maximum number of genes displayed at a time in JBrowse (per panel). The smaller the value, the faster JBrowse will be.

## SimpleSomaticMutations
A simple view of all the simple somatic mutations across all donors in the ICGC portal.

If you specify a donor ID (donor field) in the track config file, only mutations related to the given donor will be shown (if the donor exists).
```
donor: DO229446
```

You can also use the filters field to pass filters to be applied to the track. The expected input is a filter object like the following:

```
{
"mutation" : {
"functionalImpact": {
"is": [
"High"
]
}
}
}
```

To put it in the track config file you may want to minimize it as such:
```
filters={"mutation":{"functionalImpact":{"is":["High"]}}}
```

Example Track:
```
[tracks.ICGC_Mutations_high-impact]
storeClass=icgc-viewer/Store/SeqFeature/SimpleSomaticMutations
type=icgc-viewer/View/Track/SSMTrack
key=ICGC_Mutations_high-impact
unsafePopup=true
filters={"mutation":{"functionalImpact":{"is":["High"]}}}
```

![ICGC SSMs](images/ICGC-SSM-high-impact.png)

### Extra notes
You can also set the `size` attribute (defaults to 500). This is the theoretical maximum number of mutations displayed at a time in JBrowse(per panel). The smaller the value, the faster JBrowse will be.

# Dynamic track generation
## Explore donors, genes and mutations
In the menubar there is an ICGC button with an option to `Explore donors, genes and mutations`. This will bring up a dialog similar to the [advanced search page](https://dcc.icgc.org/search) on the ICGC portal. Here you can apply facets related to donor, gene and mutation. You can then create tracks based on the chosen facets.

![ICGC Explore](images/ICGC-Explore-Dialog.png)

## Explore projects
There is also an options to search ICGC by projects. This allows you to see all of the associated SSMs and Genes per project in one track. If you want to apply additional facets to a project, you'll need to use the `Explore donors, genes and mutations` dialog.
![ICGC Projects](images/ICGC-Projects-Dialog.png)

# Export Types
The following export types are supported by both Genes and SSMs. To export, select `Save track data` in the track dropdown. Note that not all track information is carried over to the exported file.
* BED
* GFF3
* Sequin Table
* CSV
* Track Config

# Miscellaneous
## Advanced Usage of Tracks
You do not need to add tracks directly from the ICGC Dialog. You can also define them in the `tracks.conf` file.

See `data/advanced-tracks.conf` for some more complex usages, including filters.

# Automated testing
Cypress.io is used for testing this plugin. The following steps show how to run the tests locally.
1. Install JBrowse and but don't install chromosome files.
2. Download Chr 1 fasta from `http://ftp.ensembl.org/pub/release-75/fasta/homo_sapiens/dna/Homo_sapiens.GRCh37.75.dna.chromosome.1.fa.gz`. There should be the fasta index file in `cypress/data/Homo_sapiens.GRCh37.75.dna.chromosome.1.fa.fai`. Put these files into `jbrowse/data/`.
3. Install Cypress.io with `npm install`.
4. Place `cypress/data/tracks.conf` into your `jbrowse/data/` directory. Make sure no other tracks are present.
5. Run `npx cypress open` or `npx cypress run` or `npm run e2e`

**Note** while some tests have mocked endpoints, not all endpoints are mocked. This could lead to breakage of tests in the future.
Check out [our documentation](https://agduncan94.github.io/icgc-viewer/) for information on installation, available features, and more.
2 changes: 1 addition & 1 deletion cypress/fixtures/gene/track-conf-export.conf
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,4 @@ key=ICGC_Genes
metadata.datatype=Genes
unsafePopup=true
size=1000
filters={"gene":{"location":{"is":["1:0-249012431"]}}}
filters={}
2 changes: 1 addition & 1 deletion cypress/fixtures/ssm/track-conf-export.conf
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,4 @@ key=ICGC_Mutations
metadata.datatype=SimpleSomaticMutations
unsafePopup=true
size=500
filters={"mutation":{"location":{"is":["1:0-249012431"]}}}
filters={}
8 changes: 4 additions & 4 deletions cypress/integration/ExploreICGC.js
Original file line number Diff line number Diff line change
Expand Up @@ -145,8 +145,8 @@ describe('Explore ICGC', function() {

// Add tracks and check that they were added
cy.get('.dijitTabContainer').eq(1).within(() => {
cy.contains('All Genes for Donor').eq(0).click()
cy.contains('All SSMs for Donor').eq(0).click()
cy.contains('All Genes').eq(0).click()
cy.contains('All Mutations').eq(0).click()
})

closePopup()
Expand Down Expand Up @@ -178,7 +178,7 @@ describe('Explore ICGC', function() {
// Apply gene filter - type rRNA
selectResultsTab(0)
cy.get('.dijitDialog').within(() => {
selectFacetTab(1, 1, 24)
selectFacetTab(1, 1, 9)
})

checkAllResultsTab(
Expand All @@ -190,7 +190,7 @@ describe('Explore ICGC', function() {
// Apply mutation filter - consequence type exon variant
selectResultsTab(0)
cy.get('.dijitDialog').within(() => {
selectFacetTab(2, 5, 1)
selectFacetTab(2, 5, 2)
})

checkAllResultsTab(
Expand Down
4 changes: 2 additions & 2 deletions cypress/integration/GeneExport.js
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ describe('Gene track', function() {
it('Should be able to export genes in various export formats', function() {
testExport(2, 'GFF3', ['##gff-version 3', '##sequence-region', 'protein_coding'])
testExport(3, 'BED', ['track name="ICGC_Genes" useScore=0', '1 237205504 237997287 ENSG00000198626 +'])
testExport(4, 'CSV', ['type,start,end,strand,id,gene name,biotype,symbol,type', 'protein_coding,237205504,237997287,1,,ryanodine receptor 2 (cardiac),,RYR2,protein_coding'])
testExport(4, 'CSV', ['id,type,chromosome,start,end,strand,gene name,symbol', 'ENSG00000198626,protein_coding,1,237205504,237997287,1,+,ryanodine receptor 2 (cardiac),RYR2'])
testExport(5, 'Sequin Table', ['>Feature 1', '237205505 237997287 protein_coding'])
cy.fixture('gene/track-conf-export.conf').then((json) => {
testExport(6, 'Track Config', [json])
Expand All @@ -90,7 +90,7 @@ describe('Gene track', function() {
\t},
\t"unsafePopup": true,
\t"size": 1000,
\t"filters": "{\\"gene\\":{\\"location\\":{\\"is\\":[\\"1:0-249012431\\"]}}}"
\t"filters": "{}"
}`
])
})
Expand Down
6 changes: 3 additions & 3 deletions cypress/integration/ProjectDialog.js
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ describe('Project dialog', function() {
it('Should be able to view projects', function() {
// Open track menu
cy.get('#dropdownbutton_icgc').type('{enter}')
cy.contains('Explore Projects').click()
cy.contains('Explore projects').click()

// Check that projects viewer is opened and has expected content
cy.contains('View projects available on the ICGC Data Portal')
Expand All @@ -50,10 +50,10 @@ describe('Project dialog', function() {

// Add SSM and Gene track for project BRCA-US (assume first in list)
cy.get('#dijit_form_ComboButton_0_arrow').should('be.visible').type('{enter}')
cy.contains('SSMs for Project').click()
cy.contains('All Mutations').click()

cy.get('#dijit_form_ComboButton_0_arrow').should('be.visible').type('{enter}')
cy.contains('Genes for Project').click()
cy.contains('All Genes').click()

// Go to next page and ensure pagination works (assume PRAD-CA on second page)
cy.contains('Next').click()
Expand Down
4 changes: 2 additions & 2 deletions cypress/integration/SSMExport.js
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ describe('SSM track', function() {
it('Should be able to export SSMs in various export formats', function() {
testExport(2, 'GFF3', ['##gff-version 3', '##sequence-region', 'single base substitution'])
testExport(3, 'BED', ['track name="ICGC_Mutations" useScore=0', '1 115256528 115256528 MU68272'])
testExport(4, 'CSV', ['type,start,end,strand,id,allele in the reference assembly,mutation,reference genome assembly', 'single base substitution,115256528,115256528,,,T,T>C,GRCh37'])
testExport(4, 'CSV', ['id,type,chromosome,start,end,allele in the reference assembly,mutation,reference genome assembly', 'MU68272,single base substitution,1,115256528,115256528,T,T>C,GRCh37'])
testExport(5, 'Sequin Table', ['>Feature 1', '115256529 115256528 single base substitution'])

cy.fixture('ssm/track-conf-export.conf').then((json) => {
Expand All @@ -96,7 +96,7 @@ describe('SSM track', function() {
\t},
\t"unsafePopup": true,
\t"size": 500,
\t"filters": "{\\"mutation\\":{\\"location\\":{\\"is\\":[\\"1:0-249012431\\"]}}}"
\t"filters": "{}"
}`
])
})
Expand Down
3 changes: 3 additions & 0 deletions docs/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
_site
.sass-cache
.jekyll-metadata
24 changes: 24 additions & 0 deletions docs/404.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
---
layout: default
---

<style type="text/css" media="screen">
.container {
margin: 10px auto;
max-width: 600px;
text-align: center;
}
h1 {
margin: 30px 0;
font-size: 4em;
line-height: 1;
letter-spacing: -1px;
}
</style>

<div class="container">
<h1>404</h1>

<p><strong>Page not found :(</strong></p>
<p>The requested page could not be found.</p>
</div>
31 changes: 31 additions & 0 deletions docs/Gemfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
source "https://rubygems.org"

# Hello! This is where you manage which Jekyll version is used to run.
# When you want to use a different version, change it below, save the
# file and run `bundle install`. Run Jekyll with `bundle exec`, like so:
#
# bundle exec jekyll serve
#
# This will help ensure the proper Jekyll version is running.
# Happy Jekylling!
gem "jekyll", "~> 3.7.4"

# This is the default theme for new Jekyll sites. You may change this to anything you like.
gem "minima", "~> 2.0"

# If you want to use GitHub Pages, remove the "gem "jekyll"" above and
# uncomment the line below. To upgrade, run `bundle update github-pages`.
# gem "github-pages", group: :jekyll_plugins

# If you have any plugins, put them here!
group :jekyll_plugins do
gem "jekyll-feed", "~> 0.6"
end

# Windows does not include zoneinfo files, so bundle the tzinfo-data gem
gem "tzinfo-data", platforms: [:mingw, :mswin, :x64_mingw, :jruby]

# Performance-booster for watching directories on Windows
gem "wdm", "~> 0.1.0" if Gem.win_platform?

gem "just-the-docs"
Loading

0 comments on commit 616cb52

Please sign in to comment.