- pdbs = entity.pdbs_and_positions - if pdbs and pdbs.any? #jmol %select.pdb %option(selected="selected") Select a pdb - found = 0 - pdbs.each do |pdb, chains| - chains.each do |pdb_chain, pdb_position| - next if pdb_position.nil? - pdb_position -= 1 %option(attr-chain=pdb_chain attr-position=pdb_position attr-pdb=pdb)= "#{ pdb} (#{[pdb_position, pdb_chain] * "/"})" - found += 1 - if found == 0 No pdbs cover that position - else #jmol_image :javascript jmolSetXHTML('jmol_image') jmolApplet(500, "", "PIZARRA"); $('select.pdb').change(function(){ var option = $(this).find('option:selected'); var pdb = option.attr('attr-pdb'); if (pdb == "Select a pdb") return false var pdb_position = option.attr('attr-position'); var pdb_chain = option.attr('attr-chain'); jmolScript("load =" + pdb + "; wireframe off; restrict water; select protein; backbone off; color pink;cartoons on;color structure; select protein and *.CA and " + pdb_position + ":" + pdb_chain + "; spacefill; color blue;", "PIZARRA"); })