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
<?xml version="1.0" encoding="UTF-8" ?> | |
<!DOCTYPE html> | |
<html b:version='2' class='v2' expr:dir='data:blog.languageDirection' xmlns='http://www.w3.org/1999/xhtml' xmlns:b='http://www.google.com/2005/gml/b' xmlns:data='http://www.google.com/2005/gml/data' xmlns:expr='http://www.google.com/2005/gml/expr'> | |
<head> | |
<meta content='IE=EmulateIE7' http-equiv='X-UA-Compatible'/> | |
<b:if cond='data:blog.isMobile'> | |
<meta content='width=device-width,initial-scale=1.0,minimum-scale=1.0,maximum-scale=1.0' name='viewport'/> | |
<b:else/> | |
<meta content='width=1100' name='viewport'/> | |
</b:if> |
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
elif environ['PATH_INFO'].find('/static') != -1: | |
#ctype = environ['HTTP_ACCEPT'].split(',')[0] | |
protoctype=environ['PATH_INFO'].split('.')[-1] | |
if protoctype =='css': | |
ctype='text/css' | |
response_body = open('wsgi'+environ['PATH_INFO'],encoding='utf-8').read().encode('utf-8') | |
elif protoctype =='js': | |
ctype='text/javascript' | |
response_body = open('wsgi'+environ['PATH_INFO'],encoding='utf-8').read().encode('utf-8') | |
elif protoctype =='ico': |
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
##THIS IS PUBLICALLY RELEASED TO DEMONSTRATE A POINT NOT AS A USABLE PIECE OF CODE, HENCE THE LACK OF ANNOTATION. | |
__doc__ = ''' | |
I have peptide sequences, I need the DNA. plan: | |
Option A: | |
* find gi code | |
* look for gi code in the gbk file. | |
Option B: | |
* tblastn online | |
* download genome sequence | |
* extract sequence from nucleotide |
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
#!/usr/bin/env python3 | |
# -*- coding: utf-8 -*- | |
#Written for python 3, not tested under 2. | |
""" | |
Finds all gene symbols (`get_all_genes()` method) and find the genes in common with the word list. | |
""" | |
__author__ = "Matteo Ferla. [Github](https://github.com/matteoferla)" | |
__email__ = "matteo.ferla@gmail.com" | |
__date__ = "10/05/16" |
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
def zoospotter(zoo,fn='pubmed_scored.csv', assoclist=['infection']): | |
""" | |
Method that downloads the number of Pubmed entries associataed with a given species listed in the zoo variable. | |
The variable assoclist has the fields sought. | |
:param zoo: list of species names | |
:param fn: file name to save. | |
:param assoclist: list of terms that one wishes to see the association. E.g. 'infection' to find pathogenicity. | |
:return: None. | |
""" | |
#debugprint=print |
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
#python 3 | |
# three methods, two to float-up the path to a key or value and one that given a convoluted nested dictionary and a tuple of keys/indices returns the value. | |
# float_key(dictionary,key) | |
# float_value(dictionary,key) | |
# get_value(dictionary,(keys/indices list)) | |
# great for entrez, Uniprot, PDB XML dictionaries | |
# NB. works for dict and list like objects | |
import collections |
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
def deep_clean(element, damn): # the values have the annoying {http} field this removes them. | |
try: | |
if isinstance(element, dict): | |
return {k.replace(damn, '').replace('@', '').replace('#', ''): deep_clean(element[k], damn) for k in | |
element} | |
elif isinstance(element, list): | |
return [deep_clean(e, damn) for e in element] | |
elif isinstance(element, str): | |
if re.fullmatch('\d*', element): | |
return int(element) |
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
__description__ = """ | |
This is a collection of methods that helps handle better the ET.Element instances from Uniprot XML files. | |
They are monkeypatched to the class object itself. | |
The Element can be monkeypached by importing xmlschema, as opposed to using the __builtin__ workaround. | |
Basically, I am piggybacking my monkeypatch on it, meaning that I don't need to copypaste from SO. | |
* `ET.Element.ns_strip()` #returns the tag with the {namespace} | |
* `ET.Element.is_tag(value)` # boolean fx to check if tag == value | |
* `ET.Element.describe()` # prints the content of the elemtn for debugging, similarly to dump but better. | |
* `ET.Element.is_human()` # boolean fx to check if human or dancer |
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
%%javascript | |
//hack to fix export | |
require.config({ | |
paths: { | |
d3: 'https://cdnjs.cloudflare.com/ajax/libs/d3/5.9.2/d3', | |
jquery: 'https://code.jquery.com/jquery-3.4.1.min', | |
plotly: 'https://cdn.plot.ly/plotly-latest.min' | |
}, | |
shim: { |
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
%%javascript | |
//remember to append <script src="https://cdn.plot.ly/plotly-1.2.0.min.js"></script> to head or top of body. | |
//output_subarea output_html rendered_html | |
let index = 0; //or whatever is the number of the graph. | |
//$('.plotly-graph-div').map((i,el) => element.append('<p>'+$(el).attr('id')+'</p>')) | |
let chart = $('.plotly-graph-div').eq(index).parent(); | |
/// optionally one could change the dimensions for the .plotly-graph-div and svg elements. | |
//chart.children('.plotly-graph-div').css('height','525px'); | |
//chart.children('.plotly-graph-div').css('width','100%'); | |
let codeEl = $('<pre id="plotText"><code></code></pre>'); |
OlderNewer