forked from larssono/Analysis_helpers
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtoppGenePost.py
30 lines (23 loc) · 1.2 KB
/
toppGenePost.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
import requests
class ToppGeneEnrichement(object):
"""Given a gene list submits it to toppgene for enrichment analysis. Useful when coupled with ipython notebooks to display inline
"""
URL = "http://toppgene.cchmc.org/CheckInput.action"
LABEL_TYPES = set(['HGNC', "HGNC_SYNONYMS", "ENTREZ", "ENSEMBL", "REFSEQ", "UNIPROT", "GENOME_BROWSER"])
def __init__(self, genes, labelType='HGNC', correction=None, name='View in ToppFun'):
"""Creates a
"""
self.genes = genes
self.labelType = labelType
self.correction = correction
self.name = name
def _repr_html_(self):
#if self.correction==None:
# response = requests.post(self.URL, {'type': type, 'training_set': training_set})
#return response.text
return """<form action="https://toppgene.cchmc.org/CheckInput.action" method="post" target="_blank">
<input type="hidden" name="query" value="TOPPFUN">
<input type="hidden" id="type" name="type" value="%s">
<input type="hidden" name="training_set" id="training_set" value="%s">
<input type="submit" value="%s">
</form>""" %(self.labelType, ' '.join(self.genes), self.name)