Created
April 22, 2016 01:08
-
-
Save radusuciu/4bf480d0e0e8a33115d9b835acbb254c to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(function() {var map={},url=document.location.href.split("/").slice(0,-1).concat(["dta","ipi_name.table"]).join("/");$.get(url).done(function(t){for(var e,n=[],a=/(\w+).+\n?/g;null!==(e=a.exec(t));)n.push(e[1]);n=n.splice(1);for(var r=[];n.length;){for(var i="",o=n.splice(0,10),l=0,c=o.length;c>l;l++)i+="accession:"+o[l]+" OR ";i=i.slice(0,-4);var s=$.get("http://www.uniprot.org/uniprot/",{query:i,columns:"id,mass",format:"tab"});s.done(function(t){for(var n=/(\w+)\t([\w,]+)\n?/g;null!==(e=n.exec(t));)map[e[1]]=e[2]}),r.push(s)}$(function(){{var t=$("tbody tr"),e=t.eq(0).find("th:last");!$.trim(t.eq(0).children("td").eq(1).text())}e.after(e.clone().text("mass")),t.eq(1).find("th:last").after(e.clone().empty()),$("colgroup:last").after("<colgroup span=1 />"),t=t.slice(2),t.append("<td />"),$.when.apply(this,r).done(function(){t.each(function(){var t=$(this);if($.trim(t.find("td:first").text())){var e=$.trim(t.find("td:eq(1)").text());map.hasOwnProperty(e)&&t.find("td:last").text(map[e])}})})})});})() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment