### Configure JBrowse-REST Source
Source: https://www.biodalliance.org/config-source.html
Example configuration for a JBrowse-REST source, including the base URI and query parameters.
```javascript
{
name: 'JBTest',
jbURI: 'http://my.server.com/jbrowse/rest',
jbQuery: 'type=IntergenicRegion'
}
```
--------------------------------
### Configure Tabix Source
Source: https://www.biodalliance.org/config-source.html
Example configuration for a Tabix-indexed source, specifying the URI, tier type, and payload format.
```javascript
{
name: "Variants",
uri: "http://server/myfile.vcf.gz",
tier_type: 'tabix',
payload: 'vcf'
}
```
--------------------------------
### JSON-encoded Stylesheet Example
Source: https://www.biodalliance.org/stylesheets.html
Define stylesheets using JSON format as an alternative to XML. This example shows how to specify glyph types, colors, and dimensions for 'PLIMSOLL' and 'CROSS' glyphs.
```json
[
{type: 'default',
style: {
glyph: 'PLIMSOLL',
HEIGHT: '12',
STROKECOLOR: 'black',
FGCOLOR: 'red'}},
{type: 'nasty',
style: {
glyph: 'CROSS',
FGCOLOR: 'green'}}
]
```
--------------------------------
### Configure Feature Info Plugin
Source: https://www.biodalliance.org/config-source.html
Example of configuring a feature-info plugin for a specific tier. This allows custom information to be displayed for features within that tier.
```javascript
{
name: 'BBD test',
bwgURI: 'http://www.biodalliance.org/datasets/ensGene.bb',
collapseSuperGroups: true,
featureInfoPlugin: function(f, info) {
info.add('Testing', 'This is a test');
}
}
```
--------------------------------
### Protocol-Relative URL Example
Source: https://www.biodalliance.org/https.html
Use protocol-relative URLs for resources available over both HTTP and HTTPS. The browser will automatically select the appropriate protocol.
```html
//www.biodalliance.org/datasets/ensgene.bb
```
--------------------------------
### Ensembl REST Source Configuration
Source: https://www.biodalliance.org/config-source.html
Example configuration object for an Ensembl REST source. Specifies the base URI, species, and desired feature types.
```javascript
{name: 'e! transcripts',
uri: 'http://beta.rest.ensembl.org',
tier_type: 'ensembl',
species: 'human',
type: ['transcript', 'exon', 'cds']}
```
--------------------------------
### Set Default Viewport in Dalliance
Source: https://www.biodalliance.org/config.html
Configure the initial genomic region displayed when the browser loads. Specify the chromosome and the start and end coordinates.
```javascript
chr: '22',
viewStart: 30000000,
viewEnd: 30030000
```
--------------------------------
### setLocation([chr], start, end)
Source: https://www.biodalliance.org/interacting.html
Navigates the browser to a specific genomic location. If the new location is similar to the current one and the width is the same, it scrolls; otherwise, it reloads data. If 'chr' is null or undefined, the current chromosome is used.
```APIDOC
## setLocation
### Description
Navigates the browser to a specific genomic location.
### Parameters
#### Path Parameters
- **chr** (string) - Optional - The chromosome name. If null or undefined, the current chromosome is used.
- **start** (integer) - Required - The starting position of the genomic region.
- **end** (integer) - Required - The ending position of the genomic region.
### Request Example
```javascript
browser.setLocation("chr1", 100000, 200000);
```
### Response
This method does not return a value.
```
--------------------------------
### addInitListener(callback)
Source: https://www.biodalliance.org/interacting.html
Registers a callback function to be executed on a newly constructed `Browser` instance once its initialization is complete.
```APIDOC
## addInitListener
### Description
Registers a callback function to be invoked when the `Browser` instance initialization is complete.
### Parameters
#### Request Body
- **callback** (function) - Required - The function to execute after initialization.
### Request Example
```javascript
browser.addInitListener(function() {
console.log('Dalliance browser initialized.');
});
```
### Response
This method does not return a value.
```
--------------------------------
### Configure Memstore Source
Source: https://www.biodalliance.org/config-source.html
Configuration for a Memstore source, similar to Tabix, for loading entire small textual files into memory.
```javascript
{
name: "Variants",
uri: "http://server/myfile.vcf",
tier_type: 'memstore',
payload: 'vcf'
}
```
--------------------------------
### Configure BAM Source
Source: https://www.biodalliance.org/config-source.html
Configuration for a BAM source, including the URI for the BAM file. An index file URI can also be explicitly provided.
```javascript
{
name: "MyBAMTrack",
bamURI: "http://server/myfile.sort.bam"
}
```
--------------------------------
### Configure DAS Source
Source: https://www.biodalliance.org/config-source.html
Basic configuration for a DAS source, specifying the base URI for the DAS server.
```javascript
{
name: 'MeDIP raw',
uri: 'http://www.derkholm.net:8080/das/medipseq_reads'
}
```
--------------------------------
### Add a New Browser Tier
Source: https://www.biodalliance.org/interacting.html
Use `addTier` to create a new browser tier with the provided configuration object, including its name, description, data source URI, and stylesheet URI.
```javascript
browser.addTier({
name: 'Repeats',
desc: 'Repeat annotation from Ensembl 59',
bwgURI: 'http://www.biodalliance.org/datasets/repeats.bb',
stylesheet_uri: 'http://www.biodalliance.org/stylesheets/bb-repeats.xml'
});
```
--------------------------------
### addTier(config)
Source: https://www.biodalliance.org/interacting.html
Creates a new browser tier (track) using the provided configuration object. This allows adding custom data visualizations to the browser.
```APIDOC
## addTier
### Description
Creates a new browser tier using the specified configuration object.
### Parameters
#### Request Body
- **config** (object) - Required - Configuration object for the new tier.
- **name** (string) - Required - The name of the tier.
- **desc** (string) - Optional - A description for the tier.
- **bwgURI** (string) - Required - The URI for the bigWig or bigBed data file.
- **stylesheet_uri** (string) - Optional - The URI for the stylesheet to render the tier.
### Request Example
```javascript
browser.addTier({
name: 'Repeats',
desc: 'Repeat annotation from Ensembl 59',
bwgURI: 'http://www.biodalliance.org/datasets/repeats.bb',
stylesheet_uri: 'http://www.biodalliance.org/stylesheets/bb-repeats.xml'
});
```
### Response
This method does not return a value.
```
--------------------------------
### addTierListener(callback)
Source: https://www.biodalliance.org/interacting.html
Registers a callback function to be executed when the set or order of browser tiers changes.
```APIDOC
## addTierListener
### Description
Registers a callback function that is invoked when the set or order of tiers changes.
### Parameters
#### Request Body
- **callback** (function) - Required - The function to execute when tiers change.
### Request Example
```javascript
browser.addTierListener(function() {
console.log('Tier set or order changed.');
});
```
### Response
This method does not return a value.
```
--------------------------------
### Apache Configuration for Secure Resources
Source: https://www.biodalliance.org/cors.html
This Apache configuration enables CORS for secure resources requiring authentication. It echoes the origin dynamically, allows credentials, and permits the Range header. Note that a wildcard origin is not permitted when credentials are allowed.
```apache
Options FollowSymLinks MultiViews
AllowOverride FileInfo
Order allow,deny
allow from all
Require user dalliance
AuthType Basic
AuthName "Dalliance security test"
AuthUserFile /var/data/dalliance-passwd
SetEnvIf Origin "http(s)?://.*$" AccessControlAllowOrigin=$0
Header add Access-Control-Allow-Origin %{AccessControlAllowOrigin}e env=AccessControlAllowOrigin
Header set Access-Control-Allow-Headers "Range"
Header set Access-Control-Allow-Credentials "true"
```
--------------------------------
### Apache Configuration for Static Data Files
Source: https://www.biodalliance.org/cors.html
This Apache configuration sets the necessary CORS headers for serving static data files. It allows requests from any origin and permits the use of the Range header.
```apache
Header set Access-Control-Allow-Origin "*"
Header set Access-Control-Allow-Headers "Range"
Header set Access-Control-Max-Age "36000"
```
--------------------------------
### Configure Track Hubs in Dalliance
Source: https://www.biodalliance.org/config.html
Add UCSC-style track hubs to Dalliance for displaying additional data tracks. Ensure hubs are served over HTTP and support CORS.
```javascript
hubs: ['http://www.biodalliance.org/datasets/testhub/hub.txt',
'http://ftp.ebi.ac.uk/pub/databases/ensembl/encode/integration_data_jan2011/hub.txt']
```
--------------------------------
### Configure Apache for Cross-Origin Requests
Source: https://www.biodalliance.org/adding.html
These directives enable cross-origin requests and allow the use of the Range header for fetching specific portions of data. Place them in a .htaccess file or the global Apache configuration.
```apache
Header set Access-Control-Allow-Origin "*"
Header set Access-Control-Allow-Headers "Range"
```
--------------------------------
### addViewListener(callback)
Source: https://www.biodalliance.org/interacting.html
Registers a callback function to be executed whenever the viewed region in the browser changes. The callback receives the current chromosome, minimum, and maximum visible positions.
```APIDOC
## addViewListener
### Description
Registers a callback function that is invoked when the viewed region changes.
### Parameters
#### Request Body
- **callback** (function) - Required - The function to execute when the view changes. It receives `chr` (string), `min` (integer), and `max` (integer) as arguments.
### Request Example
```javascript
browser.addViewListener(function(chr, min, max) {
console.log(`View changed to: ${chr}:${min}-${max}`);
});
```
### Response
This method does not return a value.
```
--------------------------------
### CORS Headers for Static Data Files
Source: https://www.biodalliance.org/cors.html
These headers are required when serving static data files to enable cross-origin requests. `Access-Control-Allow-Origin: *` allows requests from any origin. `Access-Control-Allow-Headers: Range` permits the use of the Range header for partial file fetching. `Access-Control-Max-Age` is optional and improves performance by caching CORS information.
```http
Access-Control-Allow-Origin: *
Access-Control-Allow-Headers: Range
Access-Control-Max-Age: 36000
```
--------------------------------
### Configure Coordinate System Mappings in Dalliance
Source: https://www.biodalliance.org/config.html
Define custom coordinate system mappings using the 'chains' property. Specify the URI, type, and coordinate details for each mapping.
```javascript
chains: {
hg18ToHg19: {
uri: 'http://www.biodalliance.org/datasets/GRCh37/hg18ToHg19.bb',
type: 'bigbed',
coords: {
speciesName: 'Human',
taxon: 9606,
auth: 'NCBI',
version: 36
}
}
}
```
--------------------------------
### Basic Dalliance Embedding
Source: https://www.biodalliance.org/embed.html
Include this script to load the Dalliance library. Then, instantiate a new Browser object with your desired configuration, specifying the genome, coordinate system, and data sources. A target div is required for the browser to render into.
```html
```
--------------------------------
### addFeatureHoverListener(callback)
Source: https://www.biodalliance.org/interacting.html
Registers a callback function to be executed when the mouse pointer hovers over a feature. This is typically not called on touch devices. The callback parameters are the same as for `addFeatureListener`.
```APIDOC
## addFeatureHoverListener
### Description
Registers a callback function that is invoked when the pointer hovers over a feature.
### Parameters
#### Request Body
- **callback** (function) - Required - The function to execute when hovering over a feature. It receives `event` (MouseEvent), `feature` (object), `hit` (array), and `tier` (object) as arguments.
### Request Example
```javascript
browser.addFeatureHoverListener(function(event, feature, hit, tier) {
console.log('Hovering over feature:', feature.name);
});
```
### Response
This method does not return a value.
```
--------------------------------
### Listen for View Changes
Source: https://www.biodalliance.org/interacting.html
Use `addViewListener` to register a callback function that is invoked whenever the viewed genomic region changes. The callback receives the current chromosome, minimum, and maximum visible positions.
```javascript
browser.addViewListener(function(chr, min, max) {
var link = document.getElementById('enslink');
link.href = 'http://www.ensembl.org/Homo_sapiens/Location/View?r=' +
chr + ':' + min + '-' + max;
});
```
--------------------------------
### Add Feature Info Plugin
Source: https://www.biodalliance.org/plugins.html
Use this to add custom rows to the default feature-info box. It runs when the user clicks on a feature. You can add strings or DOM elements.
```javascript
browser.addFeatureInfoPlugin(function(f, info) {
info.add('Testing', 'This is a test!');
});
```
--------------------------------
### addFeatureListener(callback)
Source: https://www.biodalliance.org/interacting.html
Registers a callback function to be executed when a user clicks on a feature in the browser. The callback receives event details, the feature object, hit information, and the tier it belongs to.
```APIDOC
## addFeatureListener
### Description
Registers a callback function that is invoked when the user clicks on a feature.
### Parameters
#### Request Body
- **callback** (function) - Required - The function to execute when a feature is clicked. It receives `event` (MouseEvent), `feature` (object), `hit` (array), and `tier` (object) as arguments.
### Request Example
```javascript
browser.addFeatureListener(function(event, feature, hit, tier) {
console.log('Feature clicked:', feature);
});
```
### Response
This method does not return a value.
```
--------------------------------
### highlightRegion(chr, min, max)
Source: https://www.biodalliance.org/interacting.html
Creates a visual highlight over a specified genomic region.
```APIDOC
## highlightRegion
### Description
Creates a highlight over the specified genomic region.
### Parameters
#### Path Parameters
- **chr** (string) - Required - The chromosome name.
- **min** (integer) - Required - The minimum position of the region to highlight.
- **max** (integer) - Required - The maximum position of the region to highlight.
### Request Example
```javascript
browser.highlightRegion("chr1", 50000, 75000);
```
### Response
This method does not return a value.
```
--------------------------------
### Specify Mapping for a Data Track in Dalliance
Source: https://www.biodalliance.org/config.html
Assign a configured coordinate system mapping to a data track by setting the 'mapping' property in the 'sources' array.
```javascript
sources: [
{
name: "My track",
bwgURI: "http://some/old.data.bb",
mapping: 'hg18ToHg19'
}
]
```
--------------------------------
### Configure Coordinate System in Dalliance
Source: https://www.biodalliance.org/config.html
Define the reference genome coordinate system for the browser. This is crucial for querying data sources and re-mapping data between systems. Ensure 'taxon' is an NCBI Taxonomy ID and 'auth'/'version' match DAS Registry strings.
```javascript
coordSystem: {
speciesName: 'Danio rerio',
taxon: 7955,
auth: 'Zv',
version: 9,
ucscName: 'danRer7'
}
```
--------------------------------
### removeTier(config)
Source: https://www.biodalliance.org/interacting.html
Removes a browser tier that matches the provided configuration object. Note: future versions may handle multiple matching tiers more robustly.
```APIDOC
## removeTier
### Description
Removes a browser tier whose configuration matches the specified configuration object.
### Parameters
#### Request Body
- **config** (object) - Required - The configuration object of the tier to remove.
- **name** (string) - Required - The name of the tier.
- **desc** (string) - Optional - A description for the tier.
- **bwgURI** (string) - Required - The URI for the bigWig or bigBed data file.
- **stylesheet_uri** (string) - Optional - The URI for the stylesheet to render the tier.
### Request Example
```javascript
browser.removeTier({
name: 'Repeats',
desc: 'Repeat annotation from Ensembl 59',
bwgURI: 'http://www.biodalliance.org/datasets/repeats.bb',
stylesheet_uri: 'http://www.biodalliance.org/stylesheets/bb-repeats.xml'
});
```
### Response
This method does not return a value.
```
--------------------------------
### Navigate to a Genomic Location
Source: https://www.biodalliance.org/interacting.html
Call `setLocation` to navigate to a specific genomic location. If the new location is close to the current one and the width is similar, it scrolls; otherwise, it reloads data. `chr` can be null to use the current chromosome.
```javascript
function moveRight() {
browser.setLocation(
browser.chr,
(browser.viewStart|0) + 1000,
(browser.viewEnd|0) + 1000
);
}
```
--------------------------------
### Regexp Matching in TYPE Elements
Source: https://www.biodalliance.org/stylesheets.html
Use regular expressions for 'id' and 'label' attributes in TYPE elements to filter features. This allows for more flexible matching than exact string comparisons.
```xml
10
red
10
orange
```
--------------------------------
### clearHighlights()
Source: https://www.biodalliance.org/interacting.html
Removes all currently highlighted regions from the browser view.
```APIDOC
## clearHighlights
### Description
Removes all highlighted regions from the browser.
### Request Example
```javascript
browser.clearHighlights();
```
### Response
This method does not return a value.
```
--------------------------------
### Orientation Matching in TYPE Elements
Source: https://www.biodalliance.org/stylesheets.html
Filter features based on their orientation using the 'orientation' attribute in TYPE elements. '+' matches positive orientation, and '-' matches negative orientation.
```xml
red
blue
```
--------------------------------
### SCATTER Attribute with STAR Glyph
Source: https://www.biodalliance.org/stylesheets.html
Configure a STAR glyph to display as a scatter plot. The 'SCATTER' attribute set to 'yes' adjusts the y-position based on feature score. 'POINTS', 'SIZE', 'MIN', 'MAX', and 'HEIGHT' control the appearance and range of the scatter points.
```xml
yes
8
6
blue
0
100
50
```
--------------------------------
### Remove a Browser Tier
Source: https://www.biodalliance.org/interacting.html
Call `removeTier` to remove a browser tier that matches the specified configuration object. Note: This API may change to better handle multiple matching tiers.
```javascript
browser.removeTier({
name: 'Repeats',
desc: 'Repeat annotation from Ensembl 59',
bwgURI: 'http://www.biodalliance.org/datasets/repeats.bb',
stylesheet_uri: 'http://www.biodalliance.org/stylesheets/bb-repeats.xml'
});
```
=== COMPLETE CONTENT === This response contains all available snippets from this library. No additional content exists. Do not make further requests.