annotate static/js/editgff.js @ 6:9a09f7072ed5 draft default tip

planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/annotateviz commit 92d0101d8677f60a314611d325ca51a809a545d7-dirty
author eduardo
date Tue, 27 Jun 2017 08:12:24 -0400
parents 92921dfea0b5
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
4
92921dfea0b5 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/annotateviz commit 230f5fe14cc469e56626201a5c377686976d81fc
eduardo
parents:
diff changeset
1 var jsonobj=[]
92921dfea0b5 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/annotateviz commit 230f5fe14cc469e56626201a5c377686976d81fc
eduardo
parents:
diff changeset
2 $.ajax({url: "gff.json", success: function(result){
92921dfea0b5 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/annotateviz commit 230f5fe14cc469e56626201a5c377686976d81fc
eduardo
parents:
diff changeset
3 jsonobj = result;
92921dfea0b5 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/annotateviz commit 230f5fe14cc469e56626201a5c377686976d81fc
eduardo
parents:
diff changeset
4 }});
92921dfea0b5 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/annotateviz commit 230f5fe14cc469e56626201a5c377686976d81fc
eduardo
parents:
diff changeset
5
92921dfea0b5 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/annotateviz commit 230f5fe14cc469e56626201a5c377686976d81fc
eduardo
parents:
diff changeset
6
92921dfea0b5 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/annotateviz commit 230f5fe14cc469e56626201a5c377686976d81fc
eduardo
parents:
diff changeset
7 function merge_prediction() {
92921dfea0b5 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/annotateviz commit 230f5fe14cc469e56626201a5c377686976d81fc
eduardo
parents:
diff changeset
8 var lpart = document.getElementById("lpart").value;
92921dfea0b5 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/annotateviz commit 230f5fe14cc469e56626201a5c377686976d81fc
eduardo
parents:
diff changeset
9 var rpart = document.getElementById("rpart").value;
92921dfea0b5 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/annotateviz commit 230f5fe14cc469e56626201a5c377686976d81fc
eduardo
parents:
diff changeset
10 edit_annot(lpart,rpart);
92921dfea0b5 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/annotateviz commit 230f5fe14cc469e56626201a5c377686976d81fc
eduardo
parents:
diff changeset
11 }
92921dfea0b5 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/annotateviz commit 230f5fe14cc469e56626201a5c377686976d81fc
eduardo
parents:
diff changeset
12
92921dfea0b5 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/annotateviz commit 230f5fe14cc469e56626201a5c377686976d81fc
eduardo
parents:
diff changeset
13
92921dfea0b5 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/annotateviz commit 230f5fe14cc469e56626201a5c377686976d81fc
eduardo
parents:
diff changeset
14
92921dfea0b5 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/annotateviz commit 230f5fe14cc469e56626201a5c377686976d81fc
eduardo
parents:
diff changeset
15
92921dfea0b5 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/annotateviz commit 230f5fe14cc469e56626201a5c377686976d81fc
eduardo
parents:
diff changeset
16 function edit_annot(lpart,rpart) {
92921dfea0b5 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/annotateviz commit 230f5fe14cc469e56626201a5c377686976d81fc
eduardo
parents:
diff changeset
17 for (var i = jsonobj.length -1; i >= 0 ; i--) {
92921dfea0b5 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/annotateviz commit 230f5fe14cc469e56626201a5c377686976d81fc
eduardo
parents:
diff changeset
18 if (jsonobj[i].attributes.hasOwnProperty("Parent")) {
92921dfea0b5 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/annotateviz commit 230f5fe14cc469e56626201a5c377686976d81fc
eduardo
parents:
diff changeset
19 if (jsonobj[i].attributes.Parent[0] === lpart){
92921dfea0b5 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/annotateviz commit 230f5fe14cc469e56626201a5c377686976d81fc
eduardo
parents:
diff changeset
20 if (jsonobj[i].featuretype == "three_prime_UTR") {
92921dfea0b5 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/annotateviz commit 230f5fe14cc469e56626201a5c377686976d81fc
eduardo
parents:
diff changeset
21 jsonobj.splice(i,1);
92921dfea0b5 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/annotateviz commit 230f5fe14cc469e56626201a5c377686976d81fc
eduardo
parents:
diff changeset
22 console.log("removed lpart three_prime_UTR");
92921dfea0b5 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/annotateviz commit 230f5fe14cc469e56626201a5c377686976d81fc
eduardo
parents:
diff changeset
23 }
92921dfea0b5 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/annotateviz commit 230f5fe14cc469e56626201a5c377686976d81fc
eduardo
parents:
diff changeset
24 else {
6
9a09f7072ed5 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/annotateviz commit 92d0101d8677f60a314611d325ca51a809a545d7-dirty
eduardo
parents: 4
diff changeset
25 jsonobj[i].attributes.Parent[0] = lpart+'.1';
4
92921dfea0b5 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/annotateviz commit 230f5fe14cc469e56626201a5c377686976d81fc
eduardo
parents:
diff changeset
26 }
92921dfea0b5 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/annotateviz commit 230f5fe14cc469e56626201a5c377686976d81fc
eduardo
parents:
diff changeset
27 }
92921dfea0b5 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/annotateviz commit 230f5fe14cc469e56626201a5c377686976d81fc
eduardo
parents:
diff changeset
28 if (jsonobj[i].attributes.Parent[0] === rpart){
92921dfea0b5 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/annotateviz commit 230f5fe14cc469e56626201a5c377686976d81fc
eduardo
parents:
diff changeset
29 if (jsonobj[i].featuretype == "five_prime_UTR") {
92921dfea0b5 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/annotateviz commit 230f5fe14cc469e56626201a5c377686976d81fc
eduardo
parents:
diff changeset
30 jsonobj.splice(i,1);
92921dfea0b5 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/annotateviz commit 230f5fe14cc469e56626201a5c377686976d81fc
eduardo
parents:
diff changeset
31 console.log("removed rpart five_prime_UTR");
92921dfea0b5 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/annotateviz commit 230f5fe14cc469e56626201a5c377686976d81fc
eduardo
parents:
diff changeset
32 }
92921dfea0b5 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/annotateviz commit 230f5fe14cc469e56626201a5c377686976d81fc
eduardo
parents:
diff changeset
33 else {
6
9a09f7072ed5 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/annotateviz commit 92d0101d8677f60a314611d325ca51a809a545d7-dirty
eduardo
parents: 4
diff changeset
34 jsonobj[i].attributes.Parent[0] = lpart+'.1'
4
92921dfea0b5 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/annotateviz commit 230f5fe14cc469e56626201a5c377686976d81fc
eduardo
parents:
diff changeset
35 }
92921dfea0b5 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/annotateviz commit 230f5fe14cc469e56626201a5c377686976d81fc
eduardo
parents:
diff changeset
36 }
92921dfea0b5 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/annotateviz commit 230f5fe14cc469e56626201a5c377686976d81fc
eduardo
parents:
diff changeset
37 }
92921dfea0b5 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/annotateviz commit 230f5fe14cc469e56626201a5c377686976d81fc
eduardo
parents:
diff changeset
38
92921dfea0b5 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/annotateviz commit 230f5fe14cc469e56626201a5c377686976d81fc
eduardo
parents:
diff changeset
39 };
92921dfea0b5 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/annotateviz commit 230f5fe14cc469e56626201a5c377686976d81fc
eduardo
parents:
diff changeset
40 }
92921dfea0b5 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/annotateviz commit 230f5fe14cc469e56626201a5c377686976d81fc
eduardo
parents:
diff changeset
41
92921dfea0b5 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/annotateviz commit 230f5fe14cc469e56626201a5c377686976d81fc
eduardo
parents:
diff changeset
42 function export_gff() {
92921dfea0b5 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/annotateviz commit 230f5fe14cc469e56626201a5c377686976d81fc
eduardo
parents:
diff changeset
43 var text="";
92921dfea0b5 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/annotateviz commit 230f5fe14cc469e56626201a5c377686976d81fc
eduardo
parents:
diff changeset
44 var line="";
92921dfea0b5 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/annotateviz commit 230f5fe14cc469e56626201a5c377686976d81fc
eduardo
parents:
diff changeset
45 for (var i=0;i<jsonobj.length;i++){
92921dfea0b5 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/annotateviz commit 230f5fe14cc469e56626201a5c377686976d81fc
eduardo
parents:
diff changeset
46 var attributes="";
92921dfea0b5 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/annotateviz commit 230f5fe14cc469e56626201a5c377686976d81fc
eduardo
parents:
diff changeset
47 for (var attribute in jsonobj[i].attributes){
92921dfea0b5 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/annotateviz commit 230f5fe14cc469e56626201a5c377686976d81fc
eduardo
parents:
diff changeset
48 attributes=attribute+'='+jsonobj[i].attributes[attribute][0]+';';
92921dfea0b5 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/annotateviz commit 230f5fe14cc469e56626201a5c377686976d81fc
eduardo
parents:
diff changeset
49 }
92921dfea0b5 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/annotateviz commit 230f5fe14cc469e56626201a5c377686976d81fc
eduardo
parents:
diff changeset
50 line = jsonobj[i].seqid+'\t'+
92921dfea0b5 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/annotateviz commit 230f5fe14cc469e56626201a5c377686976d81fc
eduardo
parents:
diff changeset
51 jsonobj[i].source+'\t'+
92921dfea0b5 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/annotateviz commit 230f5fe14cc469e56626201a5c377686976d81fc
eduardo
parents:
diff changeset
52 jsonobj[i].featuretype+'\t'+
92921dfea0b5 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/annotateviz commit 230f5fe14cc469e56626201a5c377686976d81fc
eduardo
parents:
diff changeset
53 jsonobj[i].start+'\t'+
92921dfea0b5 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/annotateviz commit 230f5fe14cc469e56626201a5c377686976d81fc
eduardo
parents:
diff changeset
54 jsonobj[i].end+'\t'+
92921dfea0b5 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/annotateviz commit 230f5fe14cc469e56626201a5c377686976d81fc
eduardo
parents:
diff changeset
55 jsonobj[i].score+'\t'+
92921dfea0b5 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/annotateviz commit 230f5fe14cc469e56626201a5c377686976d81fc
eduardo
parents:
diff changeset
56 jsonobj[i].strand+'\t'+
92921dfea0b5 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/annotateviz commit 230f5fe14cc469e56626201a5c377686976d81fc
eduardo
parents:
diff changeset
57 jsonobj[i].frame+'\t'+
92921dfea0b5 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/annotateviz commit 230f5fe14cc469e56626201a5c377686976d81fc
eduardo
parents:
diff changeset
58 attributes;
92921dfea0b5 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/annotateviz commit 230f5fe14cc469e56626201a5c377686976d81fc
eduardo
parents:
diff changeset
59 text=text+line+'\'';
92921dfea0b5 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/annotateviz commit 230f5fe14cc469e56626201a5c377686976d81fc
eduardo
parents:
diff changeset
60 }
92921dfea0b5 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/annotateviz commit 230f5fe14cc469e56626201a5c377686976d81fc
eduardo
parents:
diff changeset
61 var gfffile = new Blob([text], {type: "text/plain;charset=utf-8"});
92921dfea0b5 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/annotateviz commit 230f5fe14cc469e56626201a5c377686976d81fc
eduardo
parents:
diff changeset
62 var blob = new Blob([text], {type: "text/plain;charset=utf-8"});
92921dfea0b5 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/annotateviz commit 230f5fe14cc469e56626201a5c377686976d81fc
eduardo
parents:
diff changeset
63 var link = document.createElement('a');
92921dfea0b5 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/annotateviz commit 230f5fe14cc469e56626201a5c377686976d81fc
eduardo
parents:
diff changeset
64 link.setAttribute('href', window.URL.createObjectURL(blob));
92921dfea0b5 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/annotateviz commit 230f5fe14cc469e56626201a5c377686976d81fc
eduardo
parents:
diff changeset
65 link.setAttribute('download', "gff_export");
92921dfea0b5 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/annotateviz commit 230f5fe14cc469e56626201a5c377686976d81fc
eduardo
parents:
diff changeset
66 link.click();
92921dfea0b5 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/annotateviz commit 230f5fe14cc469e56626201a5c377686976d81fc
eduardo
parents:
diff changeset
67 }
92921dfea0b5 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/annotateviz commit 230f5fe14cc469e56626201a5c377686976d81fc
eduardo
parents:
diff changeset
68