new AliTV(svg)
Creates an object of type AliTV for drawing whole genome alignment visualizations
Parameters:
Name | Type | Description |
---|---|---|
svg |
Object | jQuery object containing a svg DOM element. Visualizations will be drawn on this svg. Size may be changed by object methods. Previous content will be deleted. |
Example
// initializes an AliTV object (wga) on the svg element with id 'canvas'
var svg = $('#canvas');
var wga = new AliTV(svg);
Members
cache
property to cache calculated values
Properties:
Name | Type | Description | ||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
cache |
Object | the data dependent displaying information
Properties
|
conf
property to store configuration options
Properties:
Name | Type | Description | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
linear |
Object | The configuration options for the linear layout.
Properties
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
circular |
Object | The configuration options for the circular layout.
Properties
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
minLinkIdentity |
Number | The minimum of the link identity the user wants to color. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
maxLinkIdentity |
Number | The maximum of the link identity the user wants to color. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
midLinkIdentity |
Number | The middle of the link identity the user wants to color. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
minLinkIdentityColor |
String | The color of the minimum link. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
maxLinkIdentityColor |
String | The color of the maximum link. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
midLinkIdentityColor |
String | The color of the middle link. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
minLinkLength |
Number | The minimum length of a link: | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
maxLinkLength |
Number | The maximum length of a link. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
graphicalParameters |
Object | The configuration options for all graphical parameters.
Properties
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
layout |
String | Contains the current layout, this means linear or circular. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
tree |
Object | Contains the configuration objects for drawing a tree.
Properties
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
features |
Object | Contains the configuration for feature groups.
Properties
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
labels |
Object | The configuration options for the text labels.
Properties
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
offset |
Object | Contains values for the offset
Properties
|
data
property to store the data
Properties:
Name | Type | Description | ||||||||||||||||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
karyo |
Object | the chromosome information
Properties
|
||||||||||||||||||||||||||||||||||||
features |
Object | the feature information, feature type as keys
Properties
|
||||||||||||||||||||||||||||||||||||
links |
Object | the link information, Properties
|
filters
property to store data specific drawing options (structure highly dependent on data structure)
Properties:
Name | Type | Description | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
filters |
Object | the data dependent displaying information
Properties
|
inTransaction
boolean that indicates whether AliTV is inside transaction, see functions startTransaction and endTransaction
Properties:
Name | Type | Description |
---|---|---|
inTransaction |
boolean | is AliTV currently in transaction |
onChangeCallbacks
array of registered onChange callback functions
Properties:
Name | Type | Description |
---|---|---|
onChangeCallbacks |
Array | array of callback functions |
svg
property to contain the svg DOM element as jQuery Object
svgD3
property to contain the svg DOM element as d3 Object
Methods
changeChromosomeOrder(id:, value:)
This function is supposed to change the order of chromosomes according to their genome.
If a genome has only one chromosomes it is not possible to change the order.
Parameters:
Name | Type | Description |
---|---|---|
id: |
The name of the selected chromosome. | |
value: |
+1 (moves right) and -1 (moves left). |
changeChromosomeOrientation(chromosome:)
This function is supposed to change the orientation of an assigned chromosome from reverse equal false or reverse equal true.
Parameters:
Name | Type | Description |
---|---|---|
chromosome: |
String | the selected chromosome which orientation should be changed. |
changeChromosomeVisibility(chromosomeName:)
This function is supposed to change the visibility of a selected chromosome.
The function gets the name of a chromosome and set his visibility in filters.karyo.chromosomes equal false or true.
Parameters:
Name | Type | Description |
---|---|---|
chromosomeName: |
String | the name of the selected chromosome. |
changeGenomeOrder(name:, value:)
This function is supposed to swap a genome with its adjacent genomes according to the order of all genomes which is defined in ali.filters.karyo.genome_order.
Parameters:
Name | Type | Description |
---|---|---|
name: |
String | the name of the selected genome. |
value: |
Number | +1 or -1. The number defines if the genome is moved one genome up or down. |
clearAli()
This function is supposed to clear the complete drawing area by removing all children from the svg.
colorKaryoByGenomeId()
This function color karyos according to their genome_id and is called by drawLinearKaryo within the style attribute
It operates on the genome_id of the links and therefore the genome_id should be assigned to the function
The genome_id is assigned to a color which is used by the drawLinearKaryo function, so the returned value is the RGB farbcode
colorLinksByIdentity()
This function color links according to their identity and is called by drawLinearLinks within the style attribute
It operates on the identity value of the links and therefore the identity should be assigned to the function
The identity is assigned to a color which is used by the drawLinearLinks function, so the returned value is the RGB farbcode
drawCircular()
This function draws the data in the circular layout.
It operates on the data of the object and therefore needs no parameters.
It draws directly on the svg and therefore has no return value.
drawCircularKaryo(The)
This function draws the karyos in the circular layout, color them according to their genome_id and add some eventHandlers.
Parameters:
Name | Type | Description |
---|---|---|
The |
Array | array containing the coordinates as returned by getCircularKaryoCoords() |
drawCircularLinks(The)
This function draws links in the circular layout
Parameters:
Name | Type | Description |
---|---|---|
The |
Array | array circularLinkCoords containing the coordinates of all links as returned by getCircularLinkCoords() |
drawCircularTicks(The)
This function draws the ticks to the karyos in the circular layout
Parameters:
Name | Type | Description |
---|---|---|
The |
Array | array containing the coordinates as returned by getCircularTickCoords() |
drawEqualLayout(The)
This function should draw the equal layout according to the current layout.
Parameters:
Name | Type | Description |
---|---|---|
The |
String | current layout, this means circular or linear. |
drawFeatureLegend()
This function is supposed to draw a legend for all the supportedFeatures.
drawLinear()
This function draws the data in the linear layout.
It operates on the data of the object and therefore needs no parameters.
It draws directly on the svg and therefore has no return value.
drawLinearFeatureLabels(linearFeatureLabelCoords:)
This method is supposed to draw labels to all features.
Parameters:
Name | Type | Description |
---|---|---|
linearFeatureLabelCoords: |
get the coords for the feature labels which are returned by getFeatureLabelCoords. |
drawLinearFeatures(The)
This function draws the features on the karyos in the linear layout, color them according to the configuration.
Parameters:
Name | Type | Description |
---|---|---|
The |
Array | array containing the coordinates of the features as returned by getLinearFeatureCoords() |
drawLinearGenomeLabels(linearGenomeLabelCoords:)
This function is supposed to draw the text labels for genomes.
Parameters:
Name | Type | Description |
---|---|---|
linearGenomeLabelCoords: |
gets the coords of the genome labels whcih is returned by getGenomeLabelCoords. |
drawLinearKaryo(The)
This function draws the karyos in the linear layout, color them according to their genome_id and add some events to the chromosome.
Parameters:
Name | Type | Description |
---|---|---|
The |
Array | array containing the coordinates as returned by getLinearKaryoCoords() |
drawLinearLinks(The)
This function draws adjacent links in the linear layout
Parameters:
Name | Type | Description |
---|---|---|
The |
Array | array linearLinkCoords containing the coordinates of all links as returned by getLinearLinkCoords() |
drawLinearTickLabels(linearTickCoords)
This method is supposed to label the ticks with configurable tick labels.
Parameters:
Name | Type | Description |
---|---|---|
linearTickCoords |
drawLinearTicks(The)
This function draw the ticks in the linear layout.
Parameters:
Name | Type | Description |
---|---|---|
The |
Array | array containing the coordinates as returned by getLinearTickCoords() |
drawLinkIdentityLegend()
This function is supposed to draw a legend for the color code of the link identity.
drawPhylogeneticTree()
This method is supposed to draw a phylogenetic tree next to the chromosomes.
In the default configuration the tree is not drawn, but the user can set drawTree equal true and this method wil be called.
endTransaction()
This function is supposed to end a transaction, call triggerChange once and allow for new changes to trigger directly.
fadeLinks(The)
This function is called by a mouse event.
If the mouse pointer enters the area of a chromosome all links should be faded out except the the links of the chromosome the mouse points to.
If the mouse pointer leaves the area of a chromosome all links should be faded in.
Parameters:
Name | Type | Description |
---|---|---|
The |
Number | opacity value is a number between 0 and 1 and indicates the degree of the colored link opacity. |
filterChromosomeOrder(visibleChromosomes:)
This method is supposed to filter the order of chromosomes according to all visible chromosomes.
Parameters:
Name | Type | Description |
---|---|---|
visibleChromosomes: |
gets all visible chromosomes |
Returns:
chromosomeOrder: returns the order of the visible chromosomes
filterChromosomes()
This method should call other filter functions in order to filter the visible chromosomes.
Returns:
visibleChromosomes: returns only chromosomes which are visible
filterChromosomeWithoutVisibleLinks(visibleChromosomes:)
This method should filter all chromosome which have no visible links with the current configurations
Parameters:
Name | Type | Description |
---|---|---|
visibleChromosomes: |
the method gets all current visible chromosomes. |
Returns:
filteredChromosomes: the method returns only chromosomes which have visible links
filterLinks(visibleChromosomes:)
This method should call functions in order to filter the links.
The nested link data structure with genome_ids as keys is returned as a flat structure with link_ids as keys.
The filteredLinks are also saved as an object property.
Parameters:
Name | Type | Description |
---|---|---|
visibleChromosomes: |
gets the chromosomes which are visible in the current configurations. |
Returns:
visibleLinks: return all links which are visible
filterLinksByAdjacency()
This method should filter links according to their adjacency (if the according option is set and the layout is linear).
The nested link data structure with genome_ids as keys is returned as a flat structure with link_ids as keys.
Returns:
filteredLinks: returns only links which are between chromosomes of adjacent genomes (if needed) in a flat link object.
filterLinksByIdentity(visibleLinks:)
This method should filter links according to their identity.
Parameters:
Name | Type | Description |
---|---|---|
visibleLinks: |
gets all current visible links. |
Returns:
filteredLinks: return all links which are visible with the current configuration.
filterLinksByLength(visibleLinks:)
This method should filter links according to their length.
Parameters:
Name | Type | Description |
---|---|---|
visibleLinks: |
gets all current visible links. |
Returns:
filteredLinks: return all links which are visible with the current configuration.
filterVisibleChromosomes(visibleChromosomes:)
This method should filter all chromosome which are set visible in conf.filters.karyo.chromosomes[].visible
Parameters:
Name | Type | Description |
---|---|---|
visibleChromosomes: |
the method gets all current visible chromosomes. |
Returns:
filteredChromosomes: the method returns only chromosomes whose visibility is set true
filterVisibleLinks(visibleLinks:, visibleChromosomes:)
This method should filter the visible links according to visible chromosomes
Parameters:
Name | Type | Description |
---|---|---|
visibleLinks: |
contains all currently visible links. | |
visibleChromosomes: |
contains the chromosomes, which are visible in the current configurations in order to filter all links, which have no target or source chromosome. |
Returns:
visibleLinks: returns only links which source or target are in visible chromosomes
getAlignmentRegion() → {Object}
This function returns the internal alignmentRegion g element as d3 selection. It is created if it does not exist.
It also creates and adds the clipPath if it does not exist.
Returns:
internal alignmentRegion g as d3 selection.
- Type
- Object
getCanvasHeight() → {Number}
This function returns the height of the svg drawing area.
Returns:
The height of canvas.
- Type
- Number
getCanvasWidth() → {Number}
This function returns the width of the svg drawing area.
Returns:
The width of canvas.
- Type
- Number
getCircularKaryoCoords() → {Array}
Calculates coordinates for the chromosomes to draw in the circular layout.
This function operates on the data property of the object and therefore needs no parameters.
This function is primarily meant for internal usage, the user should not need to call this directly.
Returns:
Array containing one Object for each element in data.karyo of the form {karyo: 'karyo_name', startAngle:0, endAngle:1}
- Type
- Array
getCircularLinkCoords(The) → {Array}
Calculate coordinates for the links to draw in the cirular layout and uses link-data and karyo-coordinates
This function is primarily meant for internal usage, the user should not need to call this directly
Parameters:
Name | Type | Description |
---|---|---|
The |
Array | array containing the coordinates as returned by getCircularKaryoCoords() |
Returns:
Returns an Array which is presented in the following example
- Type
- Array
Example
[
{"linkID": "l1", "source": {"startAngle":1, "endAngle":3}, "target": {"startAngle":4, "endAngle":6}}
]
getCircularTickCoords(The) → {Array}
This function calculates the coordinates (angles) for the ticks in the circular layout
Parameters:
Name | Type | Description |
---|---|---|
The |
Array | array containing the coordinates as returned by getCircularKaryoCoords() |
Returns:
Returns an Array of angles
- Type
- Array
getFeatureLabelCoords(gets)
This method is supposed to calculate the coordinates for feature labels.
This method is called if the configuration of addFeatureLabels or showAllLabels is true.
Parameters:
Name | Type | Description |
---|---|---|
gets |
the coordinates of the drawn features. |
Returns:
featureLabelCoords: returns an array which contains the coords for the feature labels.
getFeatureProperty(groupId, property) → {String}
This function returns the specified property of the given supported feature.
Parameters:
Name | Type | Description |
---|---|---|
groupId |
String | The group ID of the desired supported feature. |
property |
String | The desired property of the feature (e.g. color, form, ...). |
Throws:
-
Will throw an error if the feature groupId is not supported.
-
Will throw an error if the property is undefined in the feature group.
Returns:
The value of the property of the given supported feature.
- Type
- String
getGenomeColor() → {Array}
This function returns an array which contains the color of the first and the last genome.
The colors are defined in the conf-object.
Returns:
The color of the first and the last genome.
- Type
- Array
getGenomeDistance() → {Number}
This function calculates the appropriate genomeDistance of the linear layout for the current svg height.
Returns:
genomeDistance - the distance between genomes in the linear layout.
- Type
- Number
getGenomeLabelColor()
This function returns the color of the genomeLabels.
The color is defined in the conf-object.
Returns:
The color of the genome labels.
getGenomeLabelCoords()
This method is supposed to calculate the coordinates for genome labels.
This is called if the configuration of addGenomeLables is true.
Returns:
genomeLabelCoords: returns an array which contains the coords for the genome labels.
getGenomeLabelSize()
This function returns the size of the genomeLabels.
The size is defined in the conf-object.
Returns:
The size of the genome labels.
getInvisibleChromosomes()
This functions gets the number of all chromosomes which are set invisible.
Returns:
invisibleChromosomeSize: the number of all chromosomes which are invisible.
getInvisibleFeatures()
This functions gets the number of all features which are in ali.filters.features.invisibleFeatures
Returns:
invisibleFeatureSize: the number of all features which are invisible.
getInvisibleLinks()
This functions gets the number of all links which are in ali.filters.links.invisibleLinks
Returns:
invisibleLinkSize: the number of all Links which are invisible.
getJSON() → {Object}
This function returns the content of the AliTV object as a single object containing data, filters and conf.
Returns:
The content of the AliTV object.
- Type
- Object
getKaryoHeight() → {Number}
This function returns the height of the chromosomes between two genomes which is set in the configuration.
Returns:
The actual height of chromosomes.
- Type
- Number
getKaryoSpacer() → {Number}
This function returns the information of the spacer between two chromosomes which is set in the configuration.
Returns:
The actual spacer.
- Type
- Number
getLayout() → {String}
This function returns the current layout.
Returns:
The current layout: linear or circular.
- Type
- String
getLegendRegion() → {Object}
This function returns the internal legendRegion g element as d3 selection. It is created if it does not exist.
Returns:
internal legendRegion g as d3 selection.
- Type
- Object
getLinearFeatureCoords(linearKaryoCoords:) → {Array}
Calculates coordinates for different shapes according to the different feature classes in order to draw in the linear layout.
This function operates on the linearKaryoCoords.
This function is primarily meant for internal usage, the user should not need to call this directly.
Parameters:
Name | Type | Description |
---|---|---|
linearKaryoCoords: |
Array | contains the coordinates for all chromosomes of the form: {karyo: 'karyo_name', x:0, y:0, width:10, height:10}. |
Returns:
linearFeatureCoords: contains the coordinates for feature classes of the form: {id: "featureId", x:0, y:0, width: 45, height: 10}
- Type
- Array
getLinearKaryoCoords() → {Array}
Calculates coordinates for the chromosomes to draw in the linear layout.
This function operates on the data property of the object and therefore needs no parameters.
This function is primarily meant for internal usage, the user should not need to call this directly.
The function also updates the value cache.linear.maxGenomeSize
Returns:
Array containing one Object for each element in data.karyo of the form {karyo: 'karyo_name', x:0, y:0, width:10, height:10}
- Type
- Array
getLinearLinkCoords(The) → {Array}
Calculate coordinates for the links to draw in the linear layout and uses link-data and karyo-coordinates
this function should also check if links are adjacent or not and save this information in the link property "adjacent"
This function is primarily meant for internal usage, the user should not need to call this directly
Parameters:
Name | Type | Description |
---|---|---|
The |
Array | array containing the coordinates as returned by getLinearKaryoCoords() |
Returns:
Returns an Array which is presented in the following example
- Type
- Array
Example
[
{"linkID": "l1", "source0": {"x":0, "y":10}, "target0": {"x": 0, "y":20}, "source1": {"x":10, "y":10}, "target1": {"x":10, "y":20}, "adjacent": true}
]
getLinearTickCoords(The) → {Array}
This function calculates the tick coords and operates on the chromosomes and need the length in bp and the width in px of the karyo.
Parameters:
Name | Type | Description |
---|---|---|
The |
Array | array containing the coordinates as returned by getLinearKaryoCoords() |
Returns:
The array containing the tick coordinates as shown in the following example.
Ticks for one chromosome have to be adjacent and in the order from start to end.
- Type
- Array
Example
linearTickCoords = [{id: 'c1', x1: 0, x2: 0, y1: 860, y2: 910}, {id: 'c2', x1: 0, x2: 0, y1: 660, y2:710}]
getLinkColor() → {Array}
This function returns an array which contains the color of the minLinkIdentity and the maxLinkIdentity.
The colors are defined in the conf-object.
Returns:
The color of the links with the minimal and maximal identity.
- Type
- Array
getLinkOpacity()
This method is supposed to return the default link opacity.
Returns:
linkOpacity: the default link opacity.
getMaxChromosomeLength()
This function is supposed to return the value of the longest chromosome.
Returns:
maxLinkLength: the value of the longest chromosome in bp.
getMaxLinkIdentity()
This method is supposed to return the current maximal identity of links.
Returns:
maximalLinkIdentity: the maximal identity of links.
getMaxLinkLength()
This method is supposed to return the current maximal length of links.
Returns:
maximalLinkLength: the maximal length of links.
getMinLinkIdentity()
This method is supposed to return the current minimal identity of links.
Returns:
minimalLinkIdentity: the minimal identity of links.
getMinLinkLength()
This method is supposed to return the current minimal length of links.
Returns:
minimalLinkLength: the minimal lenght of links.
getOffset() → {Number}
This function returns the offset for a specific chromosome.
Returns:
The offset in bp of a chromosome.
- Type
- Number
getOuterRadius() → {Number}
This function calculates the appropriate outerRadius of the circular layout for the current svg dimensions.
Returns:
outerRadius - the outer radius in px
- Type
- Number
getSupportedFeatures() → {Array}
This function is supposed to return an array of supported features
Returns:
supportedFeatures
- Type
- Array
getSvgAsText() → {String}
This function returns the content of the svg as a text string.
Returns:
The content of the svg.
- Type
- String
getSvgHeight() → {Number}
This function returns the height of the svg.
Returns:
The height of svg.
- Type
- Number
getSvgWidth() → {Number}
This function returns the width of the svg.
Returns:
The width of svg.
- Type
- Number
getTickDistance() → {Number}
This function returns the distance of the chromosome ticks in bp.
Returns:
The tick distance in bp.
- Type
- Number
getTickLabelColor()
This function returns the color of the tick Labels.
The color is defined in the conf-object.
Returns:
The color of the tick labels.
getTickLabelFrequency() → {Number}
This function returns the current frequency of tick labels.
Returns:
Returns the frequency of the tick labels.
- Type
- Number
getTickLabelSize()
This function returns the size of the tick Labels.
The size is defined in the conf-object.
Returns:
The size of the tick labels.
getTreeWidth() → {Number}
This function returns the current width of the phylogenetic tree.
Returns:
The current tree width.
- Type
- Number
hasTree() → {Boolean}
This method should check if the user provides tree data.
Returns:
Returns true when tree data exists and false when there is no tree data.
- Type
- Boolean
onDataChange(callback)
This function is supposed to register callback function which are called upon data change
Parameters:
Name | Type | Description |
---|---|---|
callback |
function | callback to be called upon data change |
orderKaryosAutomatically()
This function re-orders the karyos in all genomes according to the longest hit to the reference genome (determined by globally longest sequence)
This function is transpiled using babel to make tests with phantomJS work (does not support ES6)
To see the original ES6 implementation you can check out fb68a0fb290ab38ccc381bfebd4323f267f97ca6
removeLinksOutsideVisibleRegion(linkCoords, removeHalfVisible) → {Array}
This function returns linkCoords with those removed that have their ends outside the visible region.
Optionally also links with only one end in the visible region can be removed.
Parameters:
Name | Type | Description |
---|---|---|
linkCoords |
Array | linearLinkCoords as returned by getLinearLinkCoords |
removeHalfVisible |
boolean | if true also links with one end inside the visual region will be removed |
Returns:
- filtered linearLinkCoords
- Type
- Array
resetGenomeRegion(genome_id)
This function resets the genome_region filter to default for the specified genome
Parameters:
Name | Type | Description |
---|---|---|
genome_id |
String | genome_id |
rotateTreeToGenomeOrder() → {object}
This function is supposed to generate a tree from the supplied one that matches the current genome_order.
Returns:
tree - the tree in data rotated to match the current genome_order.
- Type
- object
setCanvasHeight(The)
This function replaces the old height of the drawing area for the alignment.
When the method gets a wrong value it throws an error message.
Parameters:
Name | Type | Description |
---|---|---|
The |
Number | function gets the height of the svg drawing area which can be set by the user. |
Throws:
-
Will throw an error if the argument is empty.
-
Will throw an error if the argument is not a number.
-
Will throw an error if the argument is less than 0 or equal to 0.
setCanvasWidth(The)
This function replaces the old width of the drawing area for the alignment.
When the method gets a wrong value it throws an error message.
Parameters:
Name | Type | Description |
---|---|---|
The |
Number | function gets the width of the svg drawing area which can be set by the user. |
Throws:
-
Will throw an error if the argument is empty.
-
Will throw an error if the argument is not a number.
-
Will throw an error if the argument is less than 0 or equal to 0.
setConf(conf)
Extends the existing conf of the AliTV object.
New features override the existing ones if conflicting. Non-conflicting configuration values are kept.
For the required format see the documentation of the conf property.
If you need to override the entire conf object write directly to the conf property of your AliTV object.
This is not recommended as AliTV will not function properly if some conf values are not set.
Parameters:
Name | Type | Description |
---|---|---|
conf |
Object | Object containing conf values |
setData(data)
Sets the data of the AliTV object.
For the required format see the documentation of the data property
Parameters:
Name | Type | Description |
---|---|---|
data |
Object | Object containing karyo, link and feature information |
Example
var svg = $('#canvas');
var wga = new AliTV(svg);
var karyo = {
'chromosomes': {
'c1': {'genome_id': 0, 'length': 2000, 'seq': null},
'c2': {'genome_id': 1, 'length': 1000, 'seq': null}
}
};
var features = {
'f1': {'karyo': 'c1', 'start': 300, 'end': 800},
'f2': {'karyo': 'c2', 'start': 100, 'end': 600}
};
var links = { "l1":
{'source': 'f1', 'target': 'f2', 'identity': 90}
};
wga.setData({'karyo': karyo, 'features': features, 'links': links};
setFeatureInvisible(featureID:, group:, karyo:)
This function gets a selected feature ID and pushes it to ali.filters.Features.invisibleFeatures.
The function marks all features, which are set invisible.
Parameters:
Name | Type | Description |
---|---|---|
featureID: |
gets the ID of the selected feature. | |
group: |
gets the group of the selected feature for example invertedRepeat. | |
karyo: |
gets the chromsome which belongs to the selected feature. |
Returns:
ali.filters.features.invisibleFeatures: returns the features which are invisible in the current settings.
setFeatureProperty(groupId, property, value:)
This function replaces the old color of the specified supported feature with the new color in the config-object.
Parameters:
Name | Type | Description |
---|---|---|
groupId |
String | the supported feature groupId for which the color should be set. |
property |
String | The desired property of the feature (e.g. color, form, ...). |
value: |
the new value for the property of the supported feature. |
Throws:
-
Will throw an error if the feature is not supported.
-
Will throw an error if the argument is empty.
setFilters(filters)
Sets the filters of the AliTV object.
For the required format see the documentation of the filters property
The filters are highly dependent on the data object and have to resemble its layout
Parameters:
Name | Type | Description |
---|---|---|
filters |
Object | Object containing data specific drawing information |
Example
var svg = $('#canvas');
var wga = new AliTV(svg);
var karyo = {
'chromosomes': {
'c1': {'genome_id': 0, 'length': 2000, 'seq': null},
'c2': {'genome_id': 1, 'length': 1000, 'seq': null}
}
};
var features = {
'f1': {'karyo': 'c1', 'start': 300, 'end': 800},
'f2': {'karyo': 'c2', 'start': 100, 'end': 600}
};
var links = {"l1":
{'source': 'f1', 'target': 'f2', 'identity': 90}
};
wga.setData({'karyo': karyo, 'features': features, 'links': links};
var filters = {
'karyo': {
'order': ['c1', 'c2'],
'genome_order': ['0', '1'],
'chromosomes': {
'c1': {'reverse': false, 'visible': true},
'c2': {'reverse': false, 'visible': true}
}
}
};
wga.setFilters(filters);
wga.drawLinear();
wga.drawCircular();
setGenomeColor(color:)
This function replaces the old colors of the start genome and the end genome with the new ones.
Parameters:
Name | Type | Description |
---|---|---|
color: |
the array contains the startLineColor and the endLineColor which is returned by getGenomeColor. |
Throws:
Will throw an error if the argument is empty.
setGenomeLabelColor(color:)
This function set a new color for the genome labels.
Parameters:
Name | Type | Description |
---|---|---|
color: |
the current color of genome labels which is returned by getGenomeLabelColor. |
Throws:
Will throw an error if the argument is empty.
setGenomeLabelSize(size:, The)
This function set a new size for the genome labels.
Parameters:
Name | Type | Description |
---|---|---|
size: |
the current size of genome labels which is returned by getGenomeLabelSize. | |
The |
Number | function gets the size of genome labels which can be set by the user. |
Throws:
-
Will throw an error if the argument is empty.
-
Will throw an error if the argument is not a number.
-
Will throw an error if the argument is less than 0 or equal to 0.
setJSON(json)
This is a convenience function to set data, filters and conf of the AliTV object with a single call.
Parameters:
Name | Type | Description |
---|---|---|
json |
Object | Object containing any of data, filters and conf. |
setKaryoHeight(The)
This function replaces the old height of the chromosomes with the new value in the config-object.
It is called by a blur()-event, when the decription field loses focus.
When the method gets a wrong value it throws an error message.
Parameters:
Name | Type | Description |
---|---|---|
The |
Number | function gets the height of chromosomes which can be set by the user. |
Throws:
-
Will throw an error if the argument is empty.
-
Will throw an error if the argument is not a number.
-
Will throw an error if the argument is less than 0 or equal to 0.
setKaryoSpacer(The)
This function replaces the old spacer with the new spacer in the config-object.
It is called by a blur()-event, when the decription field loses focus.
When the method gets a wrong spacer it throws an error message.
Parameters:
Name | Type | Description |
---|---|---|
The |
Number | function gets the spacer which can be set by the user. |
Throws:
-
Will throw an error if the argument is Sorry, you entered an empty value. Please try it again..
-
Will throw an error if the argument is not a number.
-
Will throw an error if the argument is less than 0 or equal to 0.
setLinkColor(color:)
This function replaces the old colors for the minimal and maximal link identity by the new ones.
Parameters:
Name | Type | Description |
---|---|---|
color: |
the array contains the minLinkIdentityColor and the maxLinkIdentityColor which is returned by getLinkColor. |
Throws:
Will throw an error if the argument is empty.
setLinkInvisible(selectedLinkID:)
This function gets the id of a selected link, hides it and pushes it to ali.filters.links.selectedLinks.
Parameters:
Name | Type | Description |
---|---|---|
selectedLinkID: |
gets the id of the selected link |
Returns:
ali.filters.links.invisibleLinks: returns the links which are invisible in the current settings of ali.filters.links.invisibleLinks.
setLinkOpacity(The)
This function sets a new default link opacity.
When the method gets a wrong value it throws an error message.
Parameters:
Name | Type | Description |
---|---|---|
The |
Number | new opacity (value between 0 and 1) |
Throws:
-
Will throw an error if the argument is not a number.
-
Will throw an error if the argument is out of range [0,1].
setNewFeature(group:, form:, color:) → {ali.conf.features.supportedFeatures}
This function is supposed to get the parameters for adding a new feature group in conf.features.supportedFeatures.
Parameters:
Name | Type | Description |
---|---|---|
group: |
the name of the new feature group | |
form: |
the form for the group which is used by drawFeatures | |
color: |
the color for the new group |
Returns:
The current feature groups which are supported by AliTV
- Type
- ali.conf.features.supportedFeatures
setOffset(The, The)
This function sets a new offset for specific chromosome.
When the method gets a wrong value it throws an error message.
Parameters:
Name | Type | Description |
---|---|---|
The |
Number | function gets the distance for shifting chromosomes which can be set by the user. |
The |
String | function gets the Id of the chromosome which should be shifted. |
Throws:
-
Will throw an error if the argument is empty.
-
Will throw an error if the argument is not a number.
setSvgHeight(height)
This function sets the height of the svg - it does not effect the size of the canvas, tree, etc.
When the method gets a wrong value it throws an error message.
Parameters:
Name | Type | Description |
---|---|---|
height |
Number | the desired height of the svg set by the user. |
Throws:
-
Will throw an error if the argument is empty.
-
Will throw an error if the argument is not a number.
-
Will throw an error if the argument is less than 0 or equal to 0.
setSvgWidth(width)
This function sets the width of the svg - it does not effect the size of the canvas, tree, etc.
When the method gets a wrong value it throws an error message.
Parameters:
Name | Type | Description |
---|---|---|
width |
Number | the desired width of the svg set by the user. |
Throws:
-
Will throw an error if the argument is empty.
-
Will throw an error if the argument is not a number.
-
Will throw an error if the argument is less than 0 or equal to 0.
setTickDistance(The)
This function replaces the old distance between ticks with the new distance in the config-object.
It is called by a blur()-event, when the decription field loses focus.
When the method gets a wrong value it throws an error message.
Parameters:
Name | Type | Description |
---|---|---|
The |
Number | function gets the distance between ticks which can be set by the user. |
Throws:
-
Will throw an error if the argument is empty.
-
Will throw an error if the argument is not a number.
-
Will throw an error if the argument is less than 0 or equal to 0.
setTickLabelColor(color:)
This function set a new color for the tick labels.
Parameters:
Name | Type | Description |
---|---|---|
color: |
the current color of tick labels which is returned by getTickLabelColor. |
Throws:
Will throw an error if the argument is empty.
setTickLabelFrequency(tickLabelFrequency:)
This function replaces the old frequency of tick labels with the new tick label frequency in the config-object.
Parameters:
Name | Type | Description |
---|---|---|
tickLabelFrequency: |
the frequency of tick labels which is returned by getTickLabelFrequency. |
Throws:
-
Will throw an error if the argument is empty.
-
Will throw an error if the argument is not a number.
-
Will throw an error if the argument is less than 0 or equal to 0.
setTickLabelSize(size:, The)
This function set a new size for the tick labels.
Parameters:
Name | Type | Description |
---|---|---|
size: |
the current size of tick labels which is returned by getTickLabelSize. | |
The |
Number | function gets the size of tick labels which can be set by the user. |
Throws:
-
Will throw an error if the argument is empty.
-
Will throw an error if the argument is not a number.
-
Will throw an error if the argument is less than 0 or equal to 0.
setTreeWidth(The)
This function replaces the old tree width with the new tree width in the config-object.
When the method gets a wrong value it throws an error message.
Parameters:
Name | Type | Description |
---|---|---|
The |
Number | function gets the width of a phylogenetic tree which can be set by the user. |
Throws:
-
Will throw an error if the argument is empty.
-
Will throw an error if the argument is not a number.
-
Will throw an error if the argument is less than 0 or equal to 0.
showInvisibleFeature(selectedFeatureId:)
This function is supposed to get the ID of a selected feature, which is hidden and should be restored.
The function show the hidden feature and delete it from the invisibleFeatures-object in ali.filters.features.invisibleFeatures
Parameters:
Name | Type | Description |
---|---|---|
selectedFeatureId: |
the Id of the features which should be restored. |
Returns:
ali.filters.features.invisibleFeatures: the current features which are set invisible.
showInvisibleLink(selectedLinkID:)
This function is supposed to get the ID of a selected link, which is hidden and should be restored.
The function show the hidden link and delete it from the invisibleLinks-object in ali.filters.links.invisibleLinks
Parameters:
Name | Type | Description |
---|---|---|
selectedLinkID: |
the ID of the links which should be restored. |
Returns:
ali.filters.links.hiddenLinks: the current links which are set invisible.
startTransaction()
This function is supposed to start a transaction and prevent changes from being triggered during that time
triggerChange()
This function is supposed to call all registered callback functions
updateGenomeRegionBySvgRect(rect)
This function updates the genome_region filter according to the specified region on the svg
Parameters:
Name | Type | Description |
---|---|---|
rect |
Object | rect an object with properties x, y, width and height (relative to the svg) |