Table of Contents : Accessing data :
Extended Access Feature | Programmatic Access

Programmatic Access


Alamut® Visual includes a programmatic access functionality through an Application Programming Interface (API) enabling external tools to control the software.

Programmatic access for Alamut® Visual users

Alamut® Visual introduced a new Extended Access Feature allowing convenient access to gene information (see Extended Access Feature).

This query field is now open to external software: Any software tool or web page can be customized in order to request Alamut® Visual to display any information that can be processed by the field described above.

     

To use this feature, first check that the external software tool you are using enables such communication with Alamut® Visual (see list below). Second, in the Options dialog box (menu 'Tools' > 'Options' > 'API' tab), check the 'Local HTTP Server Port' option and possibly change the port according to the external software specifications. Then restart Alamut® Visual:

Information Communication between external software tools and Alamut® Visual requires that Alamut® Visual is already running.

This functionality is already available in several software tools:

Information If Alamut® Visual communication is not available in your favorite software tool, please ask your software provider to consider adding this feature in a future release of their tool(s).

Programmatic access for software providers

Alamut® Visual embeds a small local HTTP server. This server listens to local HTTP GET and POST requests coming through the port that is specified in the Options dialog box (see above). The default port is set to 10000 but it can be changed to any available port, (this requires the user to set the appropriate port in the Alamut® Visual Options dialog box).

Specifications

Two types of HTTP requests are processed by Alamut® Visual:

If you have any technical question or issue while implementing communication with Alamut® Visual, please send an email to .

Examples in JavaScript

The following examples can be embeded in a web page (for different reasons they might not work with all web browsers).

Examples in HTML with JavaScript
Show Alamut® Visual version:
Show MLH1:c.464T>G in Alamut® Visual:

Other examples can be found on the Alamut® Visual Local HTTP Server Test Page

Information For this to work Alamut® Visual must be running and the 'Local HTTP Server Port' option must be checked, with port set to 10000 in the Options dialog box (see above).


Example script for the GET 'version' request:

<script type="text/javascript">
function httpGetVersion() {
	var xmlHttp = null;
	xmlHttp = new XMLHttpRequest();
	if (xmlHttp) {
		xmlHttp.open( "GET", "http://localhost:10000/version", true );
		xmlHttp.send(null);
		xmlHttp.onreadystatechange=function() {
		if (xmlHttp.readyState==4) {
			alert("Response from Alamut® Visual:\n"+xmlHttp.response);
			}
		}
	}
}
</script>
Example HTML form using this script:

<form>
<input type="button" value='View' onclick='httpGetVersion();' />
</form>

Or view this page's source code.


Script for the GET 'show' request:

<script type="text/javascript">
function httpGetFocusOn(focus) {
	var xmlHttp = null;
	xmlHttp = new XMLHttpRequest();
	if (xmlHttp) {
		xmlHttp.open( "GET", "http://localhost:10000/show?request="+focus, true );
		xmlHttp.send(null);
	}
}
</script>

Example HTML form using this script:

<form>
<input type="button" value='View' onclick='httpGetFocusOn("MLH1:c.464T>G");' />
</form>

Or view this page's source.


Example script for the GET 'show' request to load first a gene and then load a BAM file:

<script type="text/javascript">
function httpGetLoadBam(gene,bamFile) {
	var xmlHttp = null;
	xmlHttp = new XMLHttpRequest();
	var bamXmlHttp = null;
	bamXmlHttp = new XMLHttpRequest();

	if (xmlHttp) {
		xmlHttp.open( "GET", "http://localhost:10000/show?request="+gene+"&synchronous=true", true );
		xmlHttp.send(null);
		xmlHttp.onreadystatechange=function() {
			if (xmlHttp.readyState==4) {
				bamXmlHttp.open( "GET", "http://localhost:10000/show?request=BAM%3C"+bamFile, true );
				bamXmlHttp.send(null);
			}
		}
	}
}
</script>

Example HTML form using this script:

<form>
<input type="button" value='Load a BAM file' onclick='httpGetLoadBam("MLH1","http://rd-connect.interactive-biosoftware.com/BAM/example.bam");' />
</form>

© 2020 Interactive Biosoftware - Last modified: 30 December 2017