BioJS |
The Feature viewer presents sequence feature tracks under a ruler that represents sequence length for the selected protein.
Click here for more infoYour own web page using the UniProt Feature Viewer!
See the Pen Feature Viewer by Jose Villaveces (@secevalliv) on CodePen.
<html>
<head>
<meta charset='utf-8'>
</head>
<body>
<!-- We will use this div to host the feature viewer. -->
<!-- Identify it as target_ft and give it a width of 1200px -->
<div id="" width=""/>
</body>
</html>
<html>
<head>
<meta charset='utf-8'>
</head>
<body>
<!-- We will use this div to create an input element identified
as accession. -->
<!-- Additionally, we will create a button. The button will
trigger the function getData when clicked. -->
<div>
<input id="">
<button onClick="">Get Data/<button>
</div>
<div id="target_ft" width="1200px"/>
</body>
</html>
In order to get the protein data, we need to enable users to let us know which protein accession they want to use
<html>
<head>
<meta charset='utf-8'>
<script>
var getData = function(){
/* Get the value inside the input identfied as 'accession'
Tip: use the attribute 'html'*/
var accession = '';
/* Get the element identified as 'target_ft' */
var element = null;
}
</script>
</head>
<body>
<div>
<input id="accession">
<button onClick="getData()">Get Data/<button>
</div>
<div id="target_ft" width="1200px"/>
</body>
</html>
Let’s see if we are indeed capturing what the user has written down in our input element
<html>
<head>
<meta charset='utf-8'>
<script>
var getData = function(){
var accession = document.getElementById('accession').html;
var element = document.getElementById('target_ft');
alert(accession);
}
</script>
</head>
<body>
<div>
<input id="accession">
<button onClick="getData()">Get Data/<button>
</div>
<div id="target_ft" width="1200px"/>
</body>
</html>
<html>
<head>
<meta charset='utf-8'>
<!-- Required libs! -->
<script src="http://ebi-uniprot.github.io/CDN/feature-viewer/featuresviewer.js"></script>
<link href="http://ebi-uniprot.github.io/CDN/feature-viewer/css/main.css" rel="stylesheet"/>
<link href="http://ebi-uniprot.github.io/CDN/feature-viewer/css/fontello.css" rel="stylesheet"/>
<script>
var getData = function(){
var accession = document.getElementById('accession').html;
var element = document.getElementById('target_ft');
}
</script>
</head>
<body>
<div>
<input id="accession">
<button onClick="getData()">Get Data/<button>
</div>
<div id="target_ft" width="1200px"/>
</body>
</html>
<html>
<head>
<meta charset='utf-8'>
<!-- Required libs! -->
<script src="http://ebi-uniprot.github.io/CDN/feature-viewer/featuresviewer.js"></script>
<link href="http://ebi-uniprot.github.io/CDN/feature-viewer/css/main.css" rel="stylesheet"/>
<link href="http://ebi-uniprot.github.io/CDN/feature-viewer/css/fontello.css" rel="stylesheet"/>
<script>
var getData = function(){
var accession = document.getElementById('accession').html;
var element = document.getElementById('target_ft');
var app = require('biojs-vis-proteinfeaturesviewer');
var instance = new app({
el: element,
uniprotacc: accession
});
}
</script>
</head>
<body>
<div>
<input id="accession">
<button onClick="getData()">Get Data/<button>
</div>
<div id="target_ft" width="1200px"/>
</body>
</html>
See the Pen Feature Viewer by Jose Villaveces (@secevalliv) on CodePen.