Skip to content

Instantly share code, notes, and snippets.

@radusuciu
radusuciu / markdown_alumni_from_html.js
Created January 25, 2018 02:38
Generate a list of Cravatt alumni in markdown format from an html source
var els = Array.from(document.getElementsByTagName('tr'));
els.shift();
var processed = []
for (let el of els) {
if (!el.hasChildNodes()) {
continue;
}
'''Simplistic isoform filtering.'''
from Levenshtein import distance
import math
for sequence, item in d.items():
row = []
for protein in item:
min_distance = math.inf
symbol = protein[2]
sorted_data = sorted(data, key=lambda x: x['Sample name'])
by_sample_name = itertools.groupby(sorted_data, key=lambda x: x.get('Sample name'))
grouped = []
for name, g in by_sample_name:
d = list(g)
grouped.append(
'\t'.join([
name,
str(len(d)),
','.join(set([x['Primary site'] for x in d])),
$ = requirejs('jquery');
var $rows = $('tbody tr').slice(2),
group = null;
$rows.each(function() {
var $this = $(this),
id = $this.find('td').eq(0).text().trim();
if (id) {
(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])}})})})});})()
$('tbody tr').slice(2).each(function() {
var $this = $(this);
if (!$.trim($this.find('td:first').text())) {
$this.toggle();
}
});
#!/bin/bash
find ~ -type f -name "*.mzXML" -not -path "save-me"
echo delete me? \[y/n\]?
read yesno
if [[ $yesno == 'y' ]]; then
find ~ -type f -name "*.mzXML" -not -path "save-me" -delete
fi
(function(document) {
var previewWrap = document.createElement('div'),
preview = document.createElement('img');
previewWrap.style.position = 'absolute';
previewWrap.style.background = 'white';
previewWrap.style.border = '1px solid black';
previewWrap.style.transition = 'opacity 0.4s';
previewWrap.style.opacity = 0;
previewWrap.appendChild(preview);
/* http://keith-wood.name/svg.html
SVG for jQuery v1.4.5.
Written by Keith Wood (kbwood{at}iinet.com.au) August 2007.
Dual licensed under the GPL (http://dev.jquery.com/browser/trunk/jquery/GPL-LICENSE.txt) and
MIT (http://dev.jquery.com/browser/trunk/jquery/MIT-LICENSE.txt) licenses.
Please attribute the author if you use it. */
(function($) { // Hide scope, no $ conflict
/* SVG manager.
var qr_repost=false;var qr_errors_shown=false;var qr_active=false;var qr_ajax=null;var qr_postid=null;var qr_withquote=null;var qr_imgsrc="";var clickedelm=false;var qr_require_click=false;var QR_EditorID="vB_Editor_QR";if(typeof(vB_XHTML_Ready)!="undefined"){vB_XHTML_Ready.subscribe(qr_init)}function qr_init(){if(typeof(vBulletin.attachinfo)=="undefined"){vBulletin.attachinfo={posthash:"",poststarttime:""}}if(fetch_object("quick_reply")){qr_disable_controls();qr_init_buttons(fetch_object("posts"))}}function qr_init_buttons(D){var C=fetch_tags(D,"a");for(var B=0;B<C.length;B++){if(C[B].id&&(C[B].id.substr(0,3)=="qr_"||C[B].id.substr(0,5)=="qrwq_")){YAHOO.util.Event.on(C[B],"click",qr_newreply_activate,this)}}var A=["newreplylink_top","newreplylink_bottom"];YAHOO.util.Event.on(A,"click",qr_replytothread_activate,this);YAHOO.util.Event.on(A,"dblclick",function(E){window.location=this.href},this)}function qr_disable_controls(){if(require_click){fetch_object("qr_postid").value=0;vB_Editor[QR_EditorID].disable_edi