Skip to content

Commit

Permalink
get files directly from pdb
Browse files Browse the repository at this point in the history
  • Loading branch information
boscoh committed Jun 28, 2015
1 parent 59deee6 commit 6637579
Show file tree
Hide file tree
Showing 4 changed files with 31 additions and 60 deletions.
19 changes: 11 additions & 8 deletions js/dataserver.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,15 +4,18 @@ jolecule_server = function(pdb_id) {
return {
pdb_id: pdb_id,
get_protein_data: function(process_protein_data) {
$.get(
'/pdb/' + pdb_id + '.txt',
// 'http://www.rcsb.org/pdb/files/' + pdb_id + '.pdb',
function(data) {
process_protein_data({
'pdb_id': pdb_id,
'pdb_text': data,
});
if (pdb_id.length == 4) {
var url = 'http://www.rcsb.org/pdb/files/' + pdb_id + '.pdb'
} else {
var url = '/pdb/' + pdb_id + '.txt'
}
var success = function(data) {
process_protein_data({
'pdb_id': pdb_id,
'pdb_text': data,
});
}
$.get(url, success);
},
get_views: function(process_views) {
$.getJSON('/pdb/' + pdb_id + '.views.json', process_views);
Expand Down
32 changes: 0 additions & 32 deletions js/embedjolecule.js
Original file line number Diff line number Diff line change
Expand Up @@ -191,38 +191,6 @@ function EmbedJolecule(params) {
this.residue_selector.change(change_fn);
}

this.show_help_dialog = function() {
var help_div = $('<div>');

var cancel_button = link_button(
'cancel', 'clear', 'jolecule-button',
function() { help_div.remove(); });

help_div
.addClass('jolecule-dialog')
.css('width', Math.min(350, this.div.width()-40))
.append("<br>")
.append("<a href='http://jolecule.appspot.com'>JOLECULE</a> ")
.append("(c) 2012, <a href='http://boscoh.com'>Bosco Ho</a>")
.append("<br>")
.append("<br>")
.append("<ul>")
.append("<li>[shift]-mouse/right-mouse: zoom/rotate</li>")
.append("<li>click on atom: center on atom</li>")
.append("<li>drag on center atom: add a distance label</li>")
.append("<li>double-click on center atom: add atom label</li>")
.append("<li>[neigh]: show all neighbouring residues of center atom</li>")
.append("</ul>")
.append("<br>")
.append("<br>")
.append(cancel_button)
.append("<br>")
.append('<br>')
;

stick_in_center(this.div, help_div, 0, 0);
}

this.create_header_div = function() {
var _this = this;

Expand Down
36 changes: 18 additions & 18 deletions js/protein.js
Original file line number Diff line number Diff line change
Expand Up @@ -54,8 +54,8 @@ var Protein = function() {
aa = ['ALA', 'CYS', 'ASP', 'GLU', 'PHE', 'GLY', 'HIS',
'ILE', 'LYS', 'LEU', 'MET', 'ASN', 'PRO', 'GLN',
'ARG', 'SER', 'THR', 'TRP', 'VAL', 'TYR'];
dna = ['DA', 'DT', 'DG', 'DC'];
rna = ['RA', 'RT', 'RG', 'RU'];
dna = ['DA', 'DT', 'DG', 'DC', 'A', 'T', 'G', 'C'];
rna = ['RA', 'RU', 'RC', 'RG', 'A', 'T', 'G', 'C', 'U'];
chonp = ['C', 'H', 'O', 'N', 'P'];

function delete_numbers(text) {
Expand Down Expand Up @@ -993,25 +993,25 @@ var Scene = function(protein) {
}

this.hide_atomic_details_for_move = function() {
if (this.saved_show === null) {
if (this.is_too_much_atomic_detail()) {
this.saved_show = clone_dict(
this.current_view.show);
this.current_view.show.hydrogen = false;
this.current_view.show.sidechain = false;
this.current_view.show.water = false;
this.changed = true;
}
}
// if (this.saved_show === null) {
// if (this.is_too_much_atomic_detail()) {
// this.saved_show = clone_dict(
// this.current_view.show);
// this.current_view.show.hydrogen = false;
// this.current_view.show.sidechain = false;
// this.current_view.show.water = false;
// this.changed = true;
// }
// }
}

this.restore_atomic_details_after_move = function() {
if (this.saved_show === null) {
return;
}
this.current_view.show = clone_dict(this.saved_show);
this.saved_show = null;
this.changed = true;
// if (this.saved_show === null) {
// return;
// }
// this.current_view.show = clone_dict(this.saved_show);
// this.saved_show = null;
// this.changed = true;
}

this.make_default_view = function(default_html) {
Expand Down
4 changes: 2 additions & 2 deletions static/jolecule.css
Original file line number Diff line number Diff line change
Expand Up @@ -102,8 +102,8 @@ h1, h2, h3, h4, h5, h6, h7 {
letter-spacing: 0.3em;
line-height: 2em;
color: #555;
flex: 0 0;
-webkit-flex: 0 0;
flex: 50px 0 0;
-webkit-flex: 50px 0 0;
}
.jolecule-selected-box {
border: 1px dotted #D66;
Expand Down

0 comments on commit 6637579

Please sign in to comment.