-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathinitialize_prot.js
84 lines (62 loc) · 1.69 KB
/
initialize_prot.js
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
// Fonciton
class Protein {
id_pdb;
fasta_file;
pdb_file;
constructor(id_pdb) {
this.id_pdb = id_pdb;
}
set_fasta(fasta_file){
this.fasta_file= fasta_file;
}
set_pdb(pdb_file){
this.pdb_file= pdb_file;
}
get_fasta(){
return this.fasta_file;
}
get_pdb(){
return this.pdb_file;
}
}
function download_with_id(id_pdb) {
console.log("id test");
display3D(id_pdb);
console.log("after display");
}
function test() {
console.log("test");
var file = document.getElementById('upload_pdb').files[0];
console.log("1");
var reader = new FileReader();
reader.readAsDataURL(file);
reader.onload = () => {
console.log("lecture du fichier");
pdb_protein = initialize_protein(reader.result);
let res = pdb_protein.get_pdb();
display3D(res);
console.log("after display");
}
// la faire pour voir le fichier pdb
// if (file) {
//
// reader.onload = function (evt) {
// // console.log("/4qw0.pdb".valueOf())
// file = evt.target.result
// console.log(file);
// // b=initialize_4qwo(file);
// };
// reader.onerror = function (evt) {
// console.error("An error ocurred reading the file",evt);
// };
// reader.readAsText(file, "UTF-8");
// }
}
// alert(pdb_file);
function initialize_protein(a){
let protein_4qw0 = new Protein("molecule");
protein_4qw0.set_pdb(a);
protein_4qw0.set_fasta("./rcsb_pdb_4QWO.fasta");
console.log(protein_4qw0);
return protein_4qw0;
}