Repository navigation
Expand file tree
/
Copy pathModelTable.js
More file actions
145 lines (134 loc) · 4.95 KB
/
Copy pathModelTable.js
File metadata and controls
145 lines (134 loc) · 4.95 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
/* ---------------------------------- */
/* ModelTable Functions */
/* ---------------------------------- */
var ColumnNames = new Array();
var SelectedModels = "";
var selected_organism = "";
function ModelProcessData (input,column,ID) {
var ColumnNameInput = document.getElementById(ID+'_column_names');
if (!ColumnNameInput) {
return input;
}
//Initializing the column names data
if (ID >= ColumnNames.length) {
for (i=0; i <= ID; i++) {
ColumnNames[i] = new Array();
}
}
if (ColumnNames[ID].length == 0) {
ColumnNames[ID] = document.getElementById(ID+'_column_names').value.split(/,/);
}
//Initializing the selected model list
if (SelectedModels.length == 0 && document.getElementById('selected_models')) {
SelectedModels = document.getElementById('selected_models').value;
}
//Initializing the selected organism
if (selected_organism.length == 0 && document.getElementById('selected_organism')) {
selected_organism = document.getElementById('selected_organism').value;
}
if (ColumnNames[ID][column] == "Compound") {
if (SelectedModels == "NONE") {
return '<a style="text-decoration:none" href="?page=CompoundViewer&compound=' + input + '" target="_blank">' + input + "</a>";
} else {
return '<a style="text-decoration:none" href="?page=CompoundViewer&compound=' + input + '&model=' + SelectedModels + '" target="_blank">' + input + "</a>";
}
} else if (ColumnNames[ID][column] == "KEGG CID") {
return KEGGCompoundLinks(input);
} else if (ColumnNames[ID][column] == "Reaction") {
if (SelectedModels == "NONE") {
return '<a style="text-decoration:none" href="?page=ReactionViewer&reaction=' + input + '" target="_blank">' + input + "</a>";
} else {
return '<a style="text-decoration:none" href="?page=ReactionViewer&reaction=' + input + '&model=' + SelectedModels + '" target="_blank">' + input + "</a>";
}
} else if (ColumnNames[ID][column] == "Enzyme") {
return ECLinks(input);
} else if (ColumnNames[ID][column] == "KEGG RID") {
return KEGGReactionLinks(input);
} else if (ColumnNames[ID][column] == "Equation") {
return EquationLinks(input);
} else if (ColumnNames[ID][column] == "Subsystems") {
return SubsystemLinks(input);
}
return input;
}
function ECLinks(inputdata) {
if (inputdata == "Undetermined") {
return inputdata;
}
var ID_List = new Array();
ID_List = inputdata.split(/,/);
var output = "";
for (i=0;i<ID_List.length;i++) {
if (i > 0) {
output = output + "<br>";
}
output = output + '<a style="text-decoration:none" href="http://www.genome.jp/dbget-bin/www_bget?enzyme+' + ID_List[i] + '" target="_blank">' + ID_List[i] + "</a>";
}
return output;
}
function KEGGReactionLinks(inputdata) {
if (inputdata == "None") {
return inputdata;
}
var ID_List = new Array();
ID_List = inputdata.split(/,/);
var output = "";
for (i=0;i<ID_List.length;i++) {
if (i > 0) {
output = output + "<br>";
}
output = output + '<a style="text-decoration:none" href="http://www.genome.jp/dbget-bin/www_bget?rn+' + ID_List[i] + '" target="_blank">' + ID_List[i] + "</a>";
}
return output;
}
function EquationLinks(inputdata) {
var ID_List = new Array();
ID_List = inputdata.split(/\|/);
var output = "";
for (i=0;i<ID_List.length;i++) {
output = output + ID_List[i];
i++;
if (i<ID_List.length) {
if (SelectedModels == "NONE") {
output = output + '<a style="text-decoration:none" href="?page=CompoundViewer&compound=' + ID_List[i] + '" target="_blank">' + ID_List[i] + "</a>";
} else {
output = output + '<a style="text-decoration:none" href="?page=CompoundViewer&compound=' + ID_List[i] + '&model=' + SelectedModels + '" target="_blank">' + ID_List[i] + "</a>";
}
}
}
return output;
}
function SubsystemLinks(inputdata) {
if (inputdata == "None") {
return inputdata;
}
var re = new RegExp("_", "g");
var ID_List = new Array();
ID_List = inputdata.split(/\|/);
var output = "";
for (i=0;i<ID_List.length;i++) {
if (i > 0) {
output = output + "<br><br>";
}
var NeatSubsystem = ID_List[i].replace(re, " ");
ID_List[i] = ID_List[i].replace(/\([\d\/]+\)$/,"");
output = output + '<a style="text-decoration:none" href="seedviewer.cgi?page=Subsystems&subsystem=' + ID_List[i];
if (selected_organism != 'none') {
output = output + '&organism=' + selected_organism;
}
output = output + '" target="_blank">' + NeatSubsystem + "</a>";
}
return output;
}
function KEGGCompoundLinks(inputdata) {
var ID_List = new Array();
ID_List = inputdata.split(/,/);
var output = "";
for (i=0;i<ID_List.length;i++) {
if (i > 0) {
output = output + "<br>";
}
output = output + '<a style="text-decoration:none" href="http://www.genome.jp/dbget-bin/www_bget?cpd:' + ID_List[i] + '" target="_blank">' + ID_List[i] + "</a>";
}
return output;
}